[U-Boot] [PATCH v3 4/5] net: phy: make board_phy_config responsible for calling drv->config

Troy Kisky troy.kisky at boundarydevices.com
Thu Feb 2 02:14:46 CET 2012


Boards may have things they want done before or after normal phy config.
Letting the boards call drv->config allows them more flexibilty.
Boards affected by this change are corenet_ds and mpc8544ds.

Signed-off-by: Troy Kisky <troy.kisky at boundarydevices.com>
Acked-by: Dirk Behme <dirk.behme at de.bosch.com>
---
 board/freescale/corenet_ds/eth_p4080.c |    2 ++
 board/freescale/mpc8544ds/mpc8544ds.c  |    2 ++
 drivers/net/phy/phy.c                  |    5 ++---
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/board/freescale/corenet_ds/eth_p4080.c b/board/freescale/corenet_ds/eth_p4080.c
index 1f00c14..b87b092 100644
--- a/board/freescale/corenet_ds/eth_p4080.c
+++ b/board/freescale/corenet_ds/eth_p4080.c
@@ -96,6 +96,8 @@ struct mii_dev *mii_dev_for_muxval(u32 muxval)
 #if defined(CONFIG_SYS_P4080_ERRATUM_SERDES9) && defined(CONFIG_PHY_TERANETICS)
 int board_phy_config(struct phy_device *phydev)
 {
+	if (phydev->drv->config)
+		phydev->drv->config(phydev);
 	if (phydev->drv->uid == PHY_UID_TN2020) {
 		unsigned long timeout = 1 * 1000; /* 1 seconds */
 		enum srds_prtcl device;
diff --git a/board/freescale/mpc8544ds/mpc8544ds.c b/board/freescale/mpc8544ds/mpc8544ds.c
index 6fe8d39..24a1715 100644
--- a/board/freescale/mpc8544ds/mpc8544ds.c
+++ b/board/freescale/mpc8544ds/mpc8544ds.c
@@ -261,6 +261,8 @@ int board_phy_config(struct phy_device *phydev)
 	uint phyid;
 	struct mii_dev *bus = phydev->bus;
 
+	if (phydev->drv->config)
+		phydev->drv->config(phydev);
 	if (do_once)
 		return 0;
 
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index eb55180..7d327f7 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -733,6 +733,8 @@ int phy_startup(struct phy_device *phydev)
 
 static int __board_phy_config(struct phy_device *phydev)
 {
+	if (phydev->drv->config)
+		return phydev->drv->config(phydev);
 	return 0;
 }
 
@@ -741,9 +743,6 @@ int board_phy_config(struct phy_device *phydev)
 
 int phy_config(struct phy_device *phydev)
 {
-	if (phydev->drv->config)
-		phydev->drv->config(phydev);
-
 	/* Invoke an optional board-specific helper */
 	board_phy_config(phydev);
 
-- 
1.7.5.4



More information about the U-Boot mailing list