From af25f1123d65420a9d05e43b6b0bc929d09150eb Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 1 Jan 2015 12:28:46 -0600 Subject: TM4C129X Ethernet: Add logic to get pre-programmed MAC address from user FLASH registers --- nuttx/arch/arm/src/tiva/Kconfig | 15 ++++++++------- nuttx/arch/arm/src/tiva/lm3s_ethernet.c | 4 ++-- nuttx/arch/arm/src/tiva/tiva_ethernet.h | 15 +++++++++++++++ nuttx/arch/arm/src/tiva/tm4c_ethernet.c | 9 +++++++++ 4 files changed, 34 insertions(+), 9 deletions(-) (limited to 'nuttx/arch/arm/src/tiva') diff --git a/nuttx/arch/arm/src/tiva/Kconfig b/nuttx/arch/arm/src/tiva/Kconfig index a26a0d25c..1e48c668f 100644 --- a/nuttx/arch/arm/src/tiva/Kconfig +++ b/nuttx/arch/arm/src/tiva/Kconfig @@ -655,13 +655,6 @@ config TIVA_ETHLEDS ---help--- Enable to use Ethernet LEDs on the board. -config TIVA_BOARDMAC - bool "Board MAC" - default n - ---help--- - If the board-specific logic can provide a MAC address (via - tiva_ethernetmac()), then this should be selected. - config TIVA_ETHHDUPLEX bool "Force Half Duplex" default n @@ -889,6 +882,14 @@ config TIVA_ETHERNET_REGDEBUG Enable very low-level register access debug. Depends on DEBUG. endmenu # Tiva Ethernet Configuration + +config TIVA_BOARDMAC + bool "Board MAC" + default n + ---help--- + If the board-specific logic can provide a MAC address (via + tiva_ethernetmac()), then this should be selected. + endif # TIVA_ETHERNET if TIVA_SSI diff --git a/nuttx/arch/arm/src/tiva/lm3s_ethernet.c b/nuttx/arch/arm/src/tiva/lm3s_ethernet.c index 22cb53d8a..899ceb2a8 100644 --- a/nuttx/arch/arm/src/tiva/lm3s_ethernet.c +++ b/nuttx/arch/arm/src/tiva/lm3s_ethernet.c @@ -1410,7 +1410,7 @@ static inline int tiva_ethinitialize(int intf) #endif priv->ld_dev.d_private = (void*)priv; /* Used to recover private state from dev */ - /* Create a watchdog for timing polling for and timing of transmisstions */ + /* Create a watchdog for timing polling for and timing of transmissions */ #if TIVA_NETHCONTROLLERS > 1 # error "A mechanism to associate base address an IRQ with an interface is needed" @@ -1422,7 +1422,7 @@ static inline int tiva_ethinitialize(int intf) /* If the board can provide us with a MAC address, get the address * from the board now. The MAC will not be applied until tiva_ifup() - * is caleld (and the MAC can be overwritten with a netdev ioctl call). + * is called (and the MAC can be overwritten with a netdev ioctl call). */ #ifdef CONFIG_TIVA_BOARDMAC diff --git a/nuttx/arch/arm/src/tiva/tiva_ethernet.h b/nuttx/arch/arm/src/tiva/tiva_ethernet.h index 660f46300..534d23437 100644 --- a/nuttx/arch/arm/src/tiva/tiva_ethernet.h +++ b/nuttx/arch/arm/src/tiva/tiva_ethernet.h @@ -98,6 +98,21 @@ extern "C" int tiva_ethinitialize(int intf); #endif +/**************************************************************************** + * Name: tiva_ethernetmac + * + * Description: + * For the Ethernet Eval Kits, the MAC address will be stored in the non- + * volatile USER0 and USER1 registers. If CONFIG_TIVA_BOARDMAC is defined, + * this function will obtain the MAC address from these registers. + * + ****************************************************************************/ + +#ifdef CONFIG_TIVA_BOARDMAC +struct ether_addr; +void tiva_ethernetmac(struct ether_addr *ethaddr); +#endif + #undef EXTERN #if defined(__cplusplus) } diff --git a/nuttx/arch/arm/src/tiva/tm4c_ethernet.c b/nuttx/arch/arm/src/tiva/tm4c_ethernet.c index 80524f6ea..74ae68bcd 100644 --- a/nuttx/arch/arm/src/tiva/tm4c_ethernet.c +++ b/nuttx/arch/arm/src/tiva/tm4c_ethernet.c @@ -3938,6 +3938,15 @@ int tiva_ethinitialize(int intf) priv->txpoll = wd_create(); /* Create periodic poll timer */ priv->txtimeout = wd_create(); /* Create TX timeout timer */ + /* If the board can provide us with a MAC address, get the address + * from the board now. The MAC will not be applied until tiva_ifup() + * is called (and the MAC can be overwritten with a netdev ioctl call). + */ + +#ifdef CONFIG_TIVA_BOARDMAC + tiva_ethernetmac(&priv->dev.d_mac); +#endif + /* Enable power and clocking to the Ethernet MAC * * - Enable Power: Applies power (only) to the EMAC peripheral. This is not -- cgit v1.2.3