summaryrefslogtreecommitdiff
path: root/nuttx/arch/arm/src
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-11-22 14:44:38 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-11-22 14:44:38 +0000
commit6bb69076e50b9dec9f3735fa8f9e168e99f6bba7 (patch)
tree5e079fa9b212ae3765b3b14888fd7b1f0b106e2f /nuttx/arch/arm/src
parent38e599c580d418182a6fc4101686843ff0ae4e18 (diff)
downloadpx4-nuttx-6bb69076e50b9dec9f3735fa8f9e168e99f6bba7.tar.gz
px4-nuttx-6bb69076e50b9dec9f3735fa8f9e168e99f6bba7.tar.bz2
px4-nuttx-6bb69076e50b9dec9f3735fa8f9e168e99f6bba7.zip
Move some PHY initialization logic for Darcy
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5382 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/arm/src')
-rw-r--r--nuttx/arch/arm/src/stm32/Kconfig10
-rw-r--r--nuttx/arch/arm/src/stm32/stm32_eth.c11
-rw-r--r--nuttx/arch/arm/src/stm32/stm32_eth.h35
3 files changed, 50 insertions, 6 deletions
diff --git a/nuttx/arch/arm/src/stm32/Kconfig b/nuttx/arch/arm/src/stm32/Kconfig
index 4e369cb1a..2807e1a47 100644
--- a/nuttx/arch/arm/src/stm32/Kconfig
+++ b/nuttx/arch/arm/src/stm32/Kconfig
@@ -2058,6 +2058,16 @@ config STM32_PHYADDR
---help---
The 5-bit address of the PHY on the board. Default: 1
+config STM32_PHYINIT
+ bool "Board-specific PHY Initialization"
+ default n
+ ---help---
+ Some boards require specialized initialization of the PHY before it can be used.
+ This may include such things as configuring GPIOs, resetting the PHY, etc. If
+ STM32_PHYINIT is defined in the configuration then the board specific logic must
+ provide stm32_phyinitialize(); The STM32 Ethernet driver will call this function
+ one time before it first uses the PHY.
+
config STM32_MII
bool "Use MII interface"
default n
diff --git a/nuttx/arch/arm/src/stm32/stm32_eth.c b/nuttx/arch/arm/src/stm32/stm32_eth.c
index 3054142ce..006f67142 100644
--- a/nuttx/arch/arm/src/stm32/stm32_eth.c
+++ b/nuttx/arch/arm/src/stm32/stm32_eth.c
@@ -2594,6 +2594,17 @@ static int stm32_phyinit(FAR struct stm32_ethmac_s *priv)
}
up_mdelay(PHY_RESET_DELAY);
+ /* Perform any necessary, board-specific PHY initialization */
+
+#ifdef CONFIG_STM32_PHYINIT
+ ret = stm32_phy_boardinitialize(0);
+ if (ret < 0)
+ {
+ ndbg("Failed to initialize the PHY: %d\n", ret);
+ return ret;
+ }
+#endif
+
/* Special workaround for the Davicom DM9161 PHY is required. */
#ifdef CONFIG_PHY_DM9161
diff --git a/nuttx/arch/arm/src/stm32/stm32_eth.h b/nuttx/arch/arm/src/stm32/stm32_eth.h
index f0c14b5b1..4501712b1 100644
--- a/nuttx/arch/arm/src/stm32/stm32_eth.h
+++ b/nuttx/arch/arm/src/stm32/stm32_eth.h
@@ -66,14 +66,13 @@ extern "C" {
* Function: stm32_ethinitialize
*
* Description:
- * Initialize the Ethernet driver for one interface. If the STM32 chip
- * supports multiple Ethernet controllers, then board specific logic
- * must implement up_netinitialize() and call this function to initialize
- * the desired interfaces.
+ * Initialize the Ethernet driver for one interface. If the STM32 chip supports
+ * multiple Ethernet controllers, then board specific logic must implement
+ * up_netinitialize() and call this function to initialize the desired interfaces.
*
* Parameters:
- * intf - In the case where there are multiple EMACs, this value
- * identifies which EMAC is to be initialized.
+ * intf - In the case where there are multiple EMACs, this value identifies which
+ * EMAC is to be initialized.
*
* Returned Value:
* OK on success; Negated errno on failure.
@@ -86,6 +85,30 @@ extern "C" {
EXTERN int stm32_ethinitialize(int intf);
#endif
+/************************************************************************************
+ * Function: stm32_phy_boardinitialize
+ *
+ * Description:
+ * Some boards require specialized initialization of the PHY before it can be used.
+ * This may include such things as configuring GPIOs, resetting the PHY, etc. If
+ * CONFIG_STM32_PHYINIT is defined in the configuration then the board specific
+ * logic must provide stm32_phyinitialize(); The STM32 Ethernet driver will call
+ * this function one time before it first uses the PHY.
+ *
+ * Parameters:
+ * intf - Always zero for now.
+ *
+ * Returned Value:
+ * OK on success; Negated errno on failure.
+ *
+ * Assumptions:
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_STM32_PHYINIT
+EXTERN int stm32_phy_boardinitialize(int intf);
+#endif
+
#undef EXTERN
#if defined(__cplusplus)
}