diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-12-31 11:40:01 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-12-31 11:40:01 -0600 |
commit | b95e1301e0a1d985c7c60927762025e5e4ab3b05 (patch) | |
tree | 1e7d997e218298e8c27f03f7de8e96c26b7364b4 | |
parent | 577ae908a83960d65d4f826ea8ac2cc696115c65 (diff) | |
download | px4-nuttx-b95e1301e0a1d985c7c60927762025e5e4ab3b05.tar.gz px4-nuttx-b95e1301e0a1d985c7c60927762025e5e4ab3b05.tar.bz2 px4-nuttx-b95e1301e0a1d985c7c60927762025e5e4ab3b05.zip |
Tiva Ethernet: Add basic clock/power controls for Ethernet and internal PHY
-rw-r--r-- | nuttx/arch/arm/src/tiva/tiva_enablepwr.h | 44 | ||||
-rw-r--r-- | nuttx/arch/arm/src/tiva/tm4c_ethernet.c | 20 |
2 files changed, 42 insertions, 22 deletions
diff --git a/nuttx/arch/arm/src/tiva/tiva_enablepwr.h b/nuttx/arch/arm/src/tiva/tiva_enablepwr.h index 55890211b..0a5c64744 100644 --- a/nuttx/arch/arm/src/tiva/tiva_enablepwr.h +++ b/nuttx/arch/arm/src/tiva/tiva_enablepwr.h @@ -151,8 +151,8 @@ /* μDMA Power Control */ #ifdef TIVA_SYSCON_PCDMA -# define tiva_udma_enablepwr() tiva_enablepwr(TIVA_SYSCON_PCDMA,SYSCON_PCDMA_R0) -# define tiva_udma_disablepwr() tiva_disablepwr(TIVA_SYSCON_PCDMA,SYSCON_PCDMA_R0) +# define tiva_udma_enablepwr() tiva_enablepwr(TIVA_SYSCON_PCDMA,SYSCON_PCDMA_P0) +# define tiva_udma_disablepwr() tiva_disablepwr(TIVA_SYSCON_PCDMA,SYSCON_PCDMA_P0) #else # define tiva_udma_enablepwr() # define tiva_udma_disablepwr() @@ -161,8 +161,8 @@ /* EPI Power Control */ #ifdef TIVA_SYSCON_PCEPI -# define tiva_epi_enablepwr() tiva_enablepwr(TIVA_SYSCON_PCEPI,SYSCON_PCEPI_R0) -# define tiva_epi_disablepwr() tiva_disablepwr(TIVA_SYSCON_PCEPI,SYSCON_PCEPI_R0) +# define tiva_epi_enablepwr() tiva_enablepwr(TIVA_SYSCON_PCEPI,SYSCON_PCEPI_P0) +# define tiva_epi_disablepwr() tiva_disablepwr(TIVA_SYSCON_PCEPI,SYSCON_PCEPI_P0) #else # define tiva_epi_enablepwr() # define tiva_epi_disablepwr() @@ -171,8 +171,8 @@ /* Hibernation Power Control */ #ifdef TIVA_SYSCON_PCHIB -# define tiva_hib_enablepwr() tiva_enablepwr(TIVA_SYSCON_PCHIB,SYSCON_PCHIB_R0) -# define tiva_hib_disablepwr() tiva_disablepwr(TIVA_SYSCON_PCHIB,SYSCON_PCHIB_R0) +# define tiva_hib_enablepwr() tiva_enablepwr(TIVA_SYSCON_PCHIB,SYSCON_PCHIB_P0) +# define tiva_hib_disablepwr() tiva_disablepwr(TIVA_SYSCON_PCHIB,SYSCON_PCHIB_P0) #else # define tiva_hib_enablepwr() # define tiva_hib_disablepwr() @@ -261,8 +261,8 @@ /* USB Power Control */ #ifdef TIVA_SYSCON_PCUSB -# define tiva_usb_enablepwr() tiva_enablepwr(TIVA_SYSCON_PCUSB,SYSCON_PCUSB_R0) -# define tiva_usb_disablepwr() tiva_disablepwr(TIVA_SYSCON_PCUSB,SYSCON_PCUSB_R0) +# define tiva_usb_enablepwr() tiva_enablepwr(TIVA_SYSCON_PCUSB,SYSCON_PCUSB_P0) +# define tiva_usb_disablepwr() tiva_disablepwr(TIVA_SYSCON_PCUSB,SYSCON_PCUSB_P0) #else # define tiva_usb_enablepwr() # define tiva_usb_disablepwr() @@ -271,8 +271,8 @@ /* Ethernet PHY Power Control */ #ifdef TIVA_SYSCON_PCEPHY -# define tiva_ephy_enablepwr() tiva_enablepwr(TIVA_SYSCON_PCEPHY,SYSCON_PCEPHY_R0) -# define tiva_ephy_disablepwr() tiva_disablepwr(TIVA_SYSCON_PCEPHY,SYSCON_PCEPHY_R0) +# define tiva_ephy_enablepwr() tiva_enablepwr(TIVA_SYSCON_PCEPHY,SYSCON_PCEPHY_P0) +# define tiva_ephy_disablepwr() tiva_disablepwr(TIVA_SYSCON_PCEPHY,SYSCON_PCEPHY_P0) #else # define tiva_ephy_enablepwr() # define tiva_ephy_disablepwr() @@ -313,8 +313,8 @@ /* ACMP Power Control */ #ifdef TIVA_SYSCON_PCACMP -# define tiva_acmp_enablepwr() tiva_enablepwr(TIVA_SYSCON_PCACMP,SYSCON_PCACMP_R0) -# define tiva_acmp_disablepwr() tiva_disablepwr(TIVA_SYSCON_PCACMP,SYSCON_PCACMP_R0) +# define tiva_acmp_enablepwr() tiva_enablepwr(TIVA_SYSCON_PCACMP,SYSCON_PCACMP_P0) +# define tiva_acmp_disablepwr() tiva_disablepwr(TIVA_SYSCON_PCACMP,SYSCON_PCACMP_P0) #else # define tiva_acmp_enablepwr() # define tiva_acmp_disablepwr() @@ -355,8 +355,8 @@ /* EEPROM Power Control */ #ifdef TIVA_SYSCON_PCEEPROM -# define tiva_eeprom_enablepwr() tiva_enablepwr(TIVA_SYSCON_PCEEPROM,SYSCON_PCEEPROM_R0) -# define tiva_eeprom_disablepwr() tiva_disablepwr(TIVA_SYSCON_PCEEPROM,SYSCON_PCEEPROM_R0) +# define tiva_eeprom_enablepwr() tiva_enablepwr(TIVA_SYSCON_PCEEPROM,SYSCON_PCEEPROM_P0) +# define tiva_eeprom_disablepwr() tiva_disablepwr(TIVA_SYSCON_PCEEPROM,SYSCON_PCEEPROM_P0) #else # define tiva_eeprom_enablepwr() # define tiva_eeprom_disablepwr() @@ -389,8 +389,8 @@ /* CRC/Crypto Modules RunMode ClockGating Control */ #ifdef TIVA_SYSCON_PCCCM -# define tiva_ccm_enablepwr() tiva_enablepwr(TIVA_SYSCON_PCCCM,SYSCON_PCCCM_R0) -# define tiva_ccm_disablepwr() tiva_disablepwr(TIVA_SYSCON_PCCCM,SYSCON_PCCCM_R0) +# define tiva_ccm_enablepwr() tiva_enablepwr(TIVA_SYSCON_PCCCM,SYSCON_PCCCM_P0) +# define tiva_ccm_disablepwr() tiva_disablepwr(TIVA_SYSCON_PCCCM,SYSCON_PCCCM_P0) #else # define tiva_ccm_enablepwr() # define tiva_ccm_disablepwr() @@ -399,8 +399,8 @@ /* LCD Controller Power Control */ #ifdef TIVA_SYSCON_PCLCD -# define tiva_lcd_enablepwr() tiva_enablepwr(TIVA_SYSCON_PCLCD,SYSCON_PCLCD_R0) -# define tiva_lcd_disablepwr() tiva_disablepwr(TIVA_SYSCON_PCLCD,SYSCON_PCLCD_R0) +# define tiva_lcd_enablepwr() tiva_enablepwr(TIVA_SYSCON_PCLCD,SYSCON_PCLCD_P0) +# define tiva_lcd_disablepwr() tiva_disablepwr(TIVA_SYSCON_PCLCD,SYSCON_PCLCD_P0) #else # define tiva_lcd_enablepwr() # define tiva_lcd_disablepwr() @@ -409,8 +409,8 @@ /* 1-Wire Power Control */ #ifdef TIVA_SYSCON_PCOWIRE -# define tiva_owire_enablepwr() tiva_enablepwr(TIVA_SYSCON_PCOWIRE,SYSCON_PCOWIRE_R0) -# define tiva_owire_disablepwr() tiva_disablepwr(TIVA_SYSCON_PCOWIRE,SYSCON_PCOWIRE_R0) +# define tiva_owire_enablepwr() tiva_enablepwr(TIVA_SYSCON_PCOWIRE,SYSCON_PCOWIRE_P0) +# define tiva_owire_disablepwr() tiva_disablepwr(TIVA_SYSCON_PCOWIRE,SYSCON_PCOWIRE_P0) #else # define tiva_owire_enablepwr() # define tiva_owire_disablepwr() @@ -419,8 +419,8 @@ /* Ethernet MAC Power Control */ #ifdef TIVA_SYSCON_PCEMAC -# define tiva_emac_enablepwr() tiva_enablepwr(TIVA_SYSCON_PCEMAC,SYSCON_PCEMAC_R0) -# define tiva_emac_disablepwr() tiva_disablepwr(TIVA_SYSCON_PCEMAC,SYSCON_PCEMAC_R0) +# define tiva_emac_enablepwr() tiva_enablepwr(TIVA_SYSCON_PCEMAC,SYSCON_PCEMAC_P0) +# define tiva_emac_disablepwr() tiva_disablepwr(TIVA_SYSCON_PCEMAC,SYSCON_PCEMAC_P0) #else # define tiva_emac_enablepwr() # define tiva_emac_disablepwr() diff --git a/nuttx/arch/arm/src/tiva/tm4c_ethernet.c b/nuttx/arch/arm/src/tiva/tm4c_ethernet.c index 674595fc9..9c3900655 100644 --- a/nuttx/arch/arm/src/tiva/tm4c_ethernet.c +++ b/nuttx/arch/arm/src/tiva/tm4c_ethernet.c @@ -3369,6 +3369,20 @@ int tiva_ethinitialize(int intf) priv->txpoll = wd_create(); /* Create periodic poll timer */ priv->txtimeout = wd_create(); /* Create TX timeout timer */ + /* Enable power and clocking to the Ethernet MAC + * + * - Enable Power: Applies power (only) to the UART peripheral. This is not + * an essential step since enabling clocking will also apply power. The + * only significance is that the EMAC state will be retained if the EMAC + * clocking is subsequently disabled. + * - Enable Clocking: Applies both power and clocking to the EMAC peripheral, + * bringing it a fully functional state. + */ + + tiva_emac_enablepwr(); /* Ethernet MAC Power Control */ + tiva_emac_enableclk(); /* Ethernet MAC Run Mode Clock Gating Control */ + +#ifdef CONFIG_TIVA_PHY_INTERNAL /* Integrated PHY: * * "The Ethernet Controller Module and Integrated PHY receive two clock inputs: @@ -3386,9 +3400,15 @@ int tiva_ethinitialize(int intf) * External PHY support is not yet implemented. */ + /* Enable power and clocking to the Integrated PHY */ + + tiva_ephy_enablepwr(); /* Ethernet PHY Power Control */ + tiva_ephy_enableclk(); /* Ethernet PHY Run Mode Clock Gating Control */ +#else /* Configure GPIO pins to support Ethernet */ tiva_ethgpioconfig(priv); +#endif /* Attach the IRQ to the driver */ |