From f67363e1ff8c4a3b728421895befc976c26b8fc8 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 1 Jan 2015 08:11:17 -0600 Subject: [PATCH] Tiva PHY: Hard code some properties of the internal PHY --- arch/arm/src/tiva/Kconfig | 15 ++++++----- arch/arm/src/tiva/chip/tm4c_ethernet.h | 2 +- arch/arm/src/tiva/tm4c_ethernet.c | 37 +++++++++++++++++++++++--- 3 files changed, 44 insertions(+), 10 deletions(-) diff --git a/arch/arm/src/tiva/Kconfig b/arch/arm/src/tiva/Kconfig index c26de5c9c2..a26a0d25c4 100644 --- a/arch/arm/src/tiva/Kconfig +++ b/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/arch/arm/src/tiva/chip/tm4c_ethernet.h b/arch/arm/src/tiva/chip/tm4c_ethernet.h index 88f7097298..72bdbfe651 100644 --- a/arch/arm/src/tiva/chip/tm4c_ethernet.h +++ b/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/arch/arm/src/tiva/tm4c_ethernet.c b/arch/arm/src/tiva/tm4c_ethernet.c index cdb1bb0fbb..17ae77bc6c 100644 --- a/arch/arm/src/tiva/tm4c_ethernet.c +++ b/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