More of the PHY event notification logic change: Fix some compile errors when full feature is enabled; Add some missing ioctol logic

This commit is contained in:
Gregory Nutt 2014-08-16 15:04:09 -06:00
parent 3963ad6088
commit 0873ee72f6
10 changed files with 80 additions and 71 deletions

View File

@ -41,6 +41,7 @@
#include <string.h>
#include <assert.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/arch.h>
@ -48,6 +49,8 @@
#include "sam_pio.h"
#include "sam_ethernet.h"
#include "sama5d3-xplained.h"
#ifdef HAVE_NETWORK
/************************************************************************************
@ -59,11 +62,11 @@
#endif
#ifdef CONFIG_SAMA5_EMAC_ISETH0
# SAMA5_EMAC_DEVNAME "eth0"
# SAMA5_GMAC_DEVNAME "eth1"
# define SAMA5_EMAC_DEVNAME "eth0"
# define SAMA5_GMAC_DEVNAME "eth1"
#else
# SAMA5_GMAC_DEVNAME "eth0"
# SAMA5_EMAC_DEVNAME "eth1"
# define SAMA5_GMAC_DEVNAME "eth0"
# define SAMA5_EMAC_DEVNAME "eth1"
#endif
/************************************************************************************
@ -72,10 +75,10 @@
#ifdef CONFIG_SAMA5_PIOE_IRQ
#ifdef CONFIG_SAMA5_EMACA
static xcpt g_emac_handler;
static xcpt_t g_emac_handler;
#endif
#ifdef CONFIG_SAMA5_GMAC
static xcpt g_gmac_handler;
static xcpt_t g_gmac_handler;
#endif
#endif
@ -97,7 +100,7 @@ static xcpt g_gmac_handler;
void weak_function sam_netinitialize(void)
{
#ifdef CONFIG_SAMA4_EMACA
#ifdef CONFIG_SAMA5_EMACA
/* Ethernet 10/100 (EMAC A) Port
*
* The main board contains a MICREL PHY device (KSZ8051) operating at 10/100 Mbps.
@ -120,7 +123,7 @@ void weak_function sam_netinitialize(void)
sam_configpio(PIO_INT_ETH1);
#endif
#ifdef CONFIG_SAMA4_GMAC
#ifdef CONFIG_SAMA5_GMAC
/* Tri-Speed Ethernet PHY
*
* The SAMA5D3 series-CM board is equipped with a MICREL PHY devices (MICREL
@ -191,10 +194,10 @@ void weak_function sam_netinitialize(void)
****************************************************************************/
#ifdef CONFIG_SAMA5_PIOE_IRQ
xcpt_t arch_phy_irq(FAR const char *intf, xcpt_t handler);
xcpt_t arch_phy_irq(FAR const char *intf, xcpt_t handler)
{
irqstate_t flags;
xcpt_t *handler;
xcpt_t *phandler;
xcpt_t oldhandler;
pio_pinset_t pinset;
int irq;
@ -204,18 +207,18 @@ xcpt_t arch_phy_irq(FAR const char *intf, xcpt_t handler);
#ifdef CONFIG_SAMA5_EMACA
if (strcmp(intf, SAMA5_EMAC_DEVNAME) == 0)
{
handler = &g_emac_handler;
pinset = PIO_INT_ETH1;
irq = IRQ_INT_ETH1;
phandler = &g_emac_handler;
pinset = PIO_INT_ETH1;
irq = IRQ_INT_ETH1;
}
else
#endif
#ifdef CONFIG_SAMA5_GMAC
if (strcmp(intf, SAMA5_GMAC_DEVNAME) == 0)
{
handler = &g_gmac_handler;
pinset = PIO_INT_ETH0;
irq = IRQ_INT_ETH0;
phandler = &g_gmac_handler;
pinset = PIO_INT_ETH0;
irq = IRQ_INT_ETH0;
}
else
#endif
@ -232,8 +235,8 @@ xcpt_t arch_phy_irq(FAR const char *intf, xcpt_t handler);
/* Get the old button interrupt handler and save the new one */
oldhandler = *handler;
*handler = handler;
oldhandler = *phandler;
*phandler = handler;
/* Configure the interrupt */

View File

@ -418,7 +418,7 @@
/* Ethernet */
#ifdef CONFIG_SAMA4_EMACA
#ifdef CONFIG_SAMA5_EMACA
/* ETH1: Ethernet 10/100 (EMAC A) Port
*
* The main board contains a MICREL PHY device (KSZ8051) operating at 10/100 Mbps.
@ -444,7 +444,7 @@
#endif
#ifdef CONFIG_SAMA4_GMAC
#ifdef CONFIG_SAMA5_GMAC
/* ETH0: Tri-Speed Ethernet PHY
*
* The SAMA5D3 series-CM board is equipped with a MICREL PHY devices (MICREL

View File

@ -41,6 +41,7 @@
#include <string.h>
#include <assert.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/arch.h>
@ -48,6 +49,8 @@
#include "sam_pio.h"
#include "sam_ethernet.h"
#include "sama5d3x-ek.h"
#ifdef HAVE_NETWORK
/************************************************************************************
@ -59,11 +62,11 @@
#endif
#ifdef CONFIG_SAMA5_EMAC_ISETH0
# SAMA5_EMAC_DEVNAME "eth0"
# SAMA5_GMAC_DEVNAME "eth1"
# define SAMA5_EMAC_DEVNAME "eth0"
# define SAMA5_GMAC_DEVNAME "eth1"
#else
# SAMA5_GMAC_DEVNAME "eth0"
# SAMA5_EMAC_DEVNAME "eth1"
# define SAMA5_GMAC_DEVNAME "eth0"
# define SAMA5_EMAC_DEVNAME "eth1"
#endif
/************************************************************************************
@ -72,10 +75,10 @@
#ifdef CONFIG_SAMA5_PIOE_IRQ
#ifdef CONFIG_SAMA5_EMACA
static xcpt g_emac_handler;
static xcpt_t g_emac_handler;
#endif
#ifdef CONFIG_SAMA5_GMAC
static xcpt g_gmac_handler;
static xcpt_t g_gmac_handler;
#endif
#endif
@ -97,7 +100,7 @@ static xcpt g_gmac_handler;
void weak_function sam_netinitialize(void)
{
#ifdef CONFIG_SAMA4_EMACA
#ifdef CONFIG_SAMA5_EMACA
/* Ethernet 10/100 (EMAC A) Port
*
* The main board contains a MICREL PHY device (KSZ8051) operating at 10/100 Mbps.
@ -120,7 +123,7 @@ void weak_function sam_netinitialize(void)
sam_configpio(PIO_INT_ETH1);
#endif
#ifdef CONFIG_SAMA4_GMAC
#ifdef CONFIG_SAMA5_GMAC
/* Tri-Speed Ethernet PHY
*
* The SAMA5D3 series-CM board is equipped with a MICREL PHY devices (MICREL
@ -191,10 +194,10 @@ void weak_function sam_netinitialize(void)
****************************************************************************/
#ifdef CONFIG_SAMA5_PIOE_IRQ
xcpt_t arch_phy_irq(FAR const char *intf, xcpt_t handler);
xcpt_t arch_phy_irq(FAR const char *intf, xcpt_t handler)
{
irqstate_t flags;
xcpt_t *handler;
xcpt_t *phandler;
xcpt_t oldhandler;
pio_pinset_t pinset;
int irq;
@ -204,18 +207,18 @@ xcpt_t arch_phy_irq(FAR const char *intf, xcpt_t handler);
#ifdef CONFIG_SAMA5_EMACA
if (strcmp(intf, SAMA5_EMAC_DEVNAME) == 0)
{
handler = &g_emac_handler;
pinset = PIO_INT_ETH1;
irq = IRQ_INT_ETH1;
phandler = &g_emac_handler;
pinset = PIO_INT_ETH1;
irq = IRQ_INT_ETH1;
}
else
#endif
#ifdef CONFIG_SAMA5_GMAC
if (strcmp(intf, SAMA5_GMAC_DEVNAME) == 0)
{
handler = &g_gmac_handler;
pinset = PIO_INT_ETH0;
irq = IRQ_INT_ETH0;
phandler = &g_gmac_handler;
pinset = PIO_INT_ETH0;
irq = IRQ_INT_ETH0;
}
else
#endif
@ -232,8 +235,8 @@ xcpt_t arch_phy_irq(FAR const char *intf, xcpt_t handler);
/* Get the old button interrupt handler and save the new one */
oldhandler = *handler;
*handler = handler;
oldhandler = *phandler;
*phandler = handler;
/* Configure the interrupt */

View File

@ -545,7 +545,7 @@
/* Ethernet */
#ifdef CONFIG_SAMA4_EMACA
#ifdef CONFIG_SAMA5_EMACA
/* ETH1: Ethernet 10/100 (EMAC A) Port
*
* The main board contains a MICREL PHY device (KSZ8051) operating at 10/100 Mbps.
@ -571,7 +571,7 @@
#endif
#ifdef CONFIG_SAMA4_GMAC
#ifdef CONFIG_SAMA5_GMAC
/* ETH0: Tri-Speed Ethernet PHY
*
* The SAMA5D3 series-CM board is equipped with a MICREL PHY devices (MICREL

View File

@ -41,6 +41,7 @@
#include <string.h>
#include <assert.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/arch.h>
@ -48,6 +49,8 @@
#include "sam_pio.h"
#include "sam_ethernet.h"
#include "sama5d4-ek.h"
#ifdef HAVE_NETWORK
/************************************************************************************
@ -59,11 +62,11 @@
#endif
#ifdef CONFIG_SAMA5_EMAC0_ISETH0
# SAMA5_EMAC0_DEVNAME "eth0"
# SAMA5_EMAC1_DEVNAME "eth1"
# define SAMA5_EMAC0_DEVNAME "eth0"
# define SAMA5_EMAC1_DEVNAME "eth1"
#else
# SAMA5_EMAC0_DEVNAME "eth1"
# SAMA5_EMAC1_DEVNAME "eth0"
# define SAMA5_EMAC0_DEVNAME "eth1"
# define SAMA5_EMAC1_DEVNAME "eth0"
#endif
/************************************************************************************
@ -72,10 +75,10 @@
#ifdef CONFIG_SAMA5_PIOE_IRQ
#ifdef CONFIG_SAMA5_EMAC0
static xcpt g_emac0_handler;
static xcpt_t g_emac0_handler;
#endif
#ifdef CONFIG_SAMA5_EMAC1
static xcpt g_emac1_handler;
static xcpt_t g_emac1_handler;
#endif
#endif
@ -97,11 +100,11 @@ static xcpt g_emac1_handler;
void weak_function sam_netinitialize(void)
{
#ifdef CONFIG_SAMA4_EMAC0
#ifdef CONFIG_SAMA5_EMAC0
sam_configpio(PIO_INT_ETH0);
#endif
#ifdef CONFIG_SAMA4_EMAC1
#ifdef CONFIG_SAMA5_EMAC1
sam_configpio(PIO_INT_ETH1);
#endif
}
@ -160,10 +163,10 @@ void weak_function sam_netinitialize(void)
****************************************************************************/
#ifdef CONFIG_SAMA5_PIOE_IRQ
xcpt_t arch_phy_irq(FAR const char *intf, xcpt_t handler);
xcpt_t arch_phy_irq(FAR const char *intf, xcpt_t handler)
{
irqstate_t flags;
xcpt_t *handler;
xcpt_t *phandler;
xcpt_t oldhandler;
pio_pinset_t pinset;
int irq;
@ -173,18 +176,18 @@ xcpt_t arch_phy_irq(FAR const char *intf, xcpt_t handler);
#ifdef CONFIG_SAMA5_EMAC0
if (strcmp(intf, SAMA5_EMAC0_DEVNAME) == 0)
{
handler = &g_emac0_handler;
pinset = PIO_INT_ETH0;
irq = IRQ_INT_ETH0;
phandler = &g_emac0_handler;
pinset = PIO_INT_ETH0;
irq = IRQ_INT_ETH0;
}
else
#endif
#ifdef CONFIG_SAMA5_EMAC1
if (strcmp(intf, SAMA5_EMAC1_DEVNAME) == 0)
{
handler = &g_emac1_handler;
pinset = PIO_INT_ETH1;
irq = IRQ_INT_ETH1;
phandler = &g_emac1_handler;
pinset = PIO_INT_ETH1;
irq = IRQ_INT_ETH1;
}
else
#endif
@ -201,8 +204,8 @@ xcpt_t arch_phy_irq(FAR const char *intf, xcpt_t handler);
/* Get the old button interrupt handler and save the new one */
oldhandler = *handler;
*handler = handler;
oldhandler = *phandler;
*phandler = handler;
/* Configure the interrupt */

View File

@ -33,7 +33,7 @@
*
****************************************************************************/
/* The SAMA4D4-EK provides a two SD memory card slots: (1) a full size SD
/* The SAMA5D4-EK provides a two SD memory card slots: (1) a full size SD
* card slot (J10), and (2) a microSD memory card slot (J11).
*
* The full size SD card slot connects via HSMCI0. The card detect discrete

View File

@ -4,7 +4,7 @@
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Most of this file derives from Atmel sample code for the SAMA4D4-EK
* Most of this file derives from Atmel sample code for the SAMA5D4-EK
* board. That sample code has licensing that is compatible with the NuttX
* modified BSD license:
*

View File

@ -89,7 +89,7 @@
* Name: sam_spiinitialize
*
* Description:
* Called to configure SPI chip select PIO pins for the SAMA4D4-EK board.
* Called to configure SPI chip select PIO pins for the SAMA5D4-EK board.
*
************************************************************************************/

View File

@ -197,7 +197,7 @@ static int ehci_waiter(int argc, char *argv[])
*
* Description:
* Called from sam_usbinitialize very early in inialization to setup USB-related
* GPIO pins for the SAMA4D4-EK board.
* GPIO pins for the SAMA5D4-EK board.
*
* USB Ports
* The SAMA5D4 series-MB features three USB communication ports:

View File

@ -540,7 +540,7 @@
#define MXT_I2C_ADDRESS 0x4c
/* HSMCI Card Slots *****************************************************************/
/* The SAMA4D4-EK provides a two SD memory card slots: (1) a full size SD
/* The SAMA5D4-EK provides a two SD memory card slots: (1) a full size SD
* card slot (J10), and (2) a microSD memory card slot (J11).
*
* The full size SD card slot connects via HSMCI0. The card detect discrete
@ -597,7 +597,7 @@
PIO_PORT_PIOE | PIO_PIN15)
/* USB Ports ************************************************************************/
/* The SAMA4D4-EK features three USB communication ports:
/* The SAMA5D4-EK features three USB communication ports:
*
* * Port A Host High Speed (EHCI) and Full Speed (OHCI) multiplexed with
* USB Device High Speed Micro AB connector, J1
@ -685,7 +685,7 @@
/* Ethernet */
#ifdef CONFIG_SAMA4_EMACB
#ifdef CONFIG_SAMA5_EMACB
/* ETH0/1: Ethernet 10/100 (EMAC) Ports
*
* Networking support via the can be added to NSH by selecting the following
@ -747,13 +747,13 @@
* - LCD_ETH1_CONFIG = 1 & LCD_DETECT# =0: LCD 5v enable
*/
#ifdef CONFIG_SAMA4_EMAC0
#ifdef CONFIG_SAMA5_EMAC0
# define PIO_INT_ETH0 (PIO_INPUT | PIO_CFG_PULLUP | PIO_CFG_DEGLITCH | \
PIO_INT_BOTHEDGES | PIO_PORT_PIOE | PIO_PIN1)
# define IRQ_INT_ETH0 SAM_IRQ_PE1
#endif
#ifdef CONFIG_SAMA4_EMAC1
#ifdef CONFIG_SAMA5_EMAC1
# define PIO_INT_ETH1 (PIO_INPUT | PIO_CFG_PULLUP | PIO_CFG_DEGLITCH | \
PIO_INT_BOTHEDGES | PIO_PORT_PIOE | PIO_PIN2)
# define IRQ_INT_ETH1 SAM_IRQ_PE2
@ -844,7 +844,7 @@
* Name: sam_spiinitialize
*
* Description:
* Called to configure SPI chip select PIO pins for the SAMA4D4-EK board.
* Called to configure SPI chip select PIO pins for the SAMA5D4-EK board.
*
************************************************************************************/
@ -858,7 +858,7 @@ void weak_function sam_spiinitialize(void);
* Description:
* Configures DDR2 (MT47H128M16RT 128MB or, optionally, MT47H64M16HR)
*
* Per the SAMA4D4-EK User guide: "Two SDRAM/DDR2 used as main system memory.
* Per the SAMA5D4-EK User guide: "Two SDRAM/DDR2 used as main system memory.
* MT47H128M16 - 2 Gb - 16 Meg x 16 x 8 banks, the board provides up to 2 Gb on-
* board, soldered DDR2 SDRAM. The memory bus is 32 bits wide and operates with
* up to 166 MHz."
@ -870,7 +870,7 @@ void weak_function sam_spiinitialize(void);
* Column address A[9:0] (1K)
* Bank address BA[2:0] a(24,25) (8)
*
* This logic was taken from Atmel sample code for the SAMA4D4-EK.
* This logic was taken from Atmel sample code for the SAMA5D4-EK.
*
* Input Parameters:
* devtype - Either DDRAM_MT47H128M16RT or DDRAM_MT47H64M16HR
@ -999,7 +999,7 @@ bool sam_writeprotected(int slotno);
*
* Description:
* Called from sam_usbinitialize very early in inialization to setup USB-related
* PIO pins for the SAMA4D4-EK board.
* PIO pins for the SAMA5D4-EK board.
*
************************************************************************************/