From 56fc3cf880b48273888b8b77f18597d754cc9647 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 1 Jan 2015 08:11:17 -0600 Subject: Tiva PHY: Hard code some properties of the internal PHY --- nuttx/arch/arm/src/tiva/Kconfig | 15 ++++++----- nuttx/arch/arm/src/tiva/chip/tm4c_ethernet.h | 2 +- nuttx/arch/arm/src/tiva/tm4c_ethernet.c | 37 +++++++++++++++++++++++++--- 3 files changed, 44 insertions(+), 10 deletions(-) diff --git a/nuttx/arch/arm/src/tiva/Kconfig b/nuttx/arch/arm/src/tiva/Kconfig index c26de5c9c..a26a0d25c 100644 --- a/nuttx/arch/arm/src/tiva/Kconfig +++ b/nuttx/arch/arm/src/tiva/Kconfig @@ -736,18 +736,20 @@ config TIVA_PHY_RMII endchoice # PHY selection -config TIVA_PHYADDR - int "PHY address" - default 1 - ---help--- - The 5-bit address of the PHY on the board. Default: 1 - config TIVA_AUTONEG bool "Use autonegotiation" default y ---help--- Use PHY autonegotiation to determine speed and mode +if !TIVA_PHY_INTERNAL + +config TIVA_PHYADDR + int "PHY address" + default 1 + ---help--- + The 5-bit address of the PHY on the board. Default: 1 + if !TIVA_AUTONEG config TIVA_ETHFD bool "Full duplex" @@ -845,6 +847,7 @@ config TIVA_PHYSR_100FD endif # TIVA_PHYSR_ALTCONFIG endif # TIVA_AUTONEG +endif # !TIVA_PHY_INTERNAL config TIVA_EMAC_NRXDESC int "Number of RX descriptors" diff --git a/nuttx/arch/arm/src/tiva/chip/tm4c_ethernet.h b/nuttx/arch/arm/src/tiva/chip/tm4c_ethernet.h index 88f709729..72bdbfe65 100644 --- a/nuttx/arch/arm/src/tiva/chip/tm4c_ethernet.h +++ b/nuttx/arch/arm/src/tiva/chip/tm4c_ethernet.h @@ -1077,7 +1077,7 @@ #define EPHY_FCSCR_FCSCNT_SHIFT (0) /* Bits 0-7: False Carrier Event Counter */ #define EPHY_FCSCR_FCSCNT_MASK (0xff << EPHY_FCSCR_FCSCNT_SHIFT) -/* Ethernet PHY Receive Error Count *16-bit value) */ +/* Ethernet PHY Receive Error Count (16-bit value) */ /* Ethernet PHY BIST Control */ diff --git a/nuttx/arch/arm/src/tiva/tm4c_ethernet.c b/nuttx/arch/arm/src/tiva/tm4c_ethernet.c index cdb1bb0fb..17ae77bc6 100644 --- a/nuttx/arch/arm/src/tiva/tm4c_ethernet.c +++ b/nuttx/arch/arm/src/tiva/tm4c_ethernet.c @@ -102,17 +102,44 @@ # error High priority work queue support is required #endif -#ifndef CONFIG_TIVA_PHYADDR -# error CONFIG_TIVA_PHYADDR must be defined in the NuttX configuration -#endif +/* Are we using the internal PHY or an external PHY? */ #if defined(CONFIG_TIVA_PHY_INTERNAL) + +/* Internal PHY */ + # if defined(CONFIG_TIVA_PHY_MII) ||defined(CONFIG_TIVA_PHY_RMII) # warning CONFIG_TIVA_PHY_MII or CONFIG_TIVA_PHY_RMII defined with internal PHY # endif + # undef CONFIG_TIVA_PHY_MII # undef CONFIG_TIVA_PHY_RMII + +/* Properties of the internal PHY are hard-coded */ + +# undef CONFIG_TIVA_PHYADDR +# undef CONFIG_TIVA_PHYSR_ALTCONFIG +# undef CONFIG_TIVA_PHYSR_ALTMODE +# undef CONFIG_TIVA_PHYSR_10HD +# undef CONFIG_TIVA_PHYSR_100HD +# undef CONFIG_TIVA_PHYSR_10FD +# undef CONFIG_TIVA_PHYSR_100FD +# undef CONFIG_TIVA_PHYSR_SPEED +# undef CONFIG_TIVA_PHYSR_100MBPS +# undef CONFIG_TIVA_PHYSR_MODE +# undef CONFIG_TIVA_PHYSR_FULLDUPLEX + +# define CONFIG_TIVA_PHYADDR 1 +# define CONFIG_TIVA_PHYSR TIVA_EPHY_STS +# define CONFIG_TIVA_PHYSR_SPEED EPHY_STS_SPEED +# define CONFIG_TIVA_PHYSR_100MBPS 0 +# define CONFIG_TIVA_PHYSR_MODE EPHY_STS_DUPLEX +# define CONFIG_TIVA_PHYSR_FULLDUPLEX EPHY_STS_DUPLEX + #else + +/* External PHY. Properties must be provided in the configuration */ + # if !defined(CONFIG_TIVA_PHY_MII) && !defined(CONFIG_TIVA_PHY_RMII) # warning None of CONFIG_TIVA_PHY_INTERNAL, CONFIG_TIVA_PHY_MII, or CONFIG_TIVA_PHY_RMII defined # endif @@ -122,6 +149,10 @@ # endif #endif +#ifndef CONFIG_TIVA_PHYADDR +# error CONFIG_TIVA_PHYADDR must be defined in the NuttX configuration +#endif + #ifdef CONFIG_TIVA_AUTONEG # ifndef CONFIG_TIVA_PHYSR # error CONFIG_TIVA_PHYSR must be defined in the NuttX configuration -- cgit v1.2.3