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
This commit is contained in:
patacongo 2012-11-22 14:44:38 +00:00
parent b3eefe8770
commit 9bf3ddfcb3
3 changed files with 50 additions and 6 deletions

View File

@ -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

View File

@ -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

View File

@ -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)
}