[U-Boot] [PATCH 05/10][v3] driver: ldpaa: Add api to return linked PHY ID of DPMAC

Prabhakar Kushwaha prabhakar at freescale.com
Sat Oct 31 10:32:42 CET 2015


DPMAC represents physical line on the board. This physical
line eventually asscociate with on-board PHY.

So Add an api to return linked PHY ID of DPMAC object.

Signed-off-by: Prabhakar Kushwaha <prabhakar at freescale.com>
---
 Changes for v2: Sending as it is
 Changes for v3: Sending as it is

 drivers/net/ldpaa_eth/ldpaa_wriop.c | 12 ++++++++++++
 include/fsl-mc/ldpaa_wriop.h        |  3 ++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ldpaa_eth/ldpaa_wriop.c b/drivers/net/ldpaa_eth/ldpaa_wriop.c
index 926057a..357b35a 100644
--- a/drivers/net/ldpaa_eth/ldpaa_wriop.c
+++ b/drivers/net/ldpaa_eth/ldpaa_wriop.c
@@ -27,6 +27,7 @@ void wriop_init_dpmac(int sd, int dpmac_id, int lane_prtcl)
 
 	dpmac_info[index].enabled = 0;
 	dpmac_info[index].id = 0;
+	dpmac_info[index].phy_addr = -1;
 	dpmac_info[index].enet_if = PHY_INTERFACE_MODE_NONE;
 
 	enet_if = wriop_dpmac_enet_if(index, lane_prtcl);
@@ -72,6 +73,17 @@ void wriop_enable_dpmac(int dpmac_id)
 	wriop_dpmac_enable(dpmac_id);
 }
 
+u8 wriop_is_enabled_dpmac(int dpmac_id)
+{
+	int i = wriop_dpmac_to_index(dpmac_id);
+
+	if (i == -1)
+		return -1;
+
+	return dpmac_info[i].enabled;
+}
+
+
 void wriop_set_mdio(int dpmac_id, struct mii_dev *bus)
 {
 	int i = wriop_dpmac_to_index(dpmac_id);
diff --git a/include/fsl-mc/ldpaa_wriop.h b/include/fsl-mc/ldpaa_wriop.h
index ca8e440..6dc159d 100644
--- a/include/fsl-mc/ldpaa_wriop.h
+++ b/include/fsl-mc/ldpaa_wriop.h
@@ -40,8 +40,8 @@ enum wriop_port {
 struct wriop_dpmac_info {
 	u8 enabled;
 	u8 id;
-	u8 phy_addr;
 	u8 board_mux;
+	int phy_addr;
 	void *phy_regs;
 	phy_interface_t enet_if;
 	struct phy_device *phydev;
@@ -56,6 +56,7 @@ extern struct wriop_dpmac_info dpmac_info[NUM_WRIOP_PORTS];
 void wriop_init_dpmac(int, int, int);
 void wriop_disable_dpmac(int);
 void wriop_enable_dpmac(int);
+u8 wriop_is_enabled_dpmac(int dpmac_id);
 void wriop_set_mdio(int, struct mii_dev *);
 struct mii_dev *wriop_get_mdio(int);
 void wriop_set_phy_address(int, int);
-- 
1.9.1




More information about the U-Boot mailing list