Patchwork [U-Boot,v2,2/2] net/macb: Add arch specific routine to get mdio control

login
register
mail settings
Submitter Vipin Kumar
Date Dec. 13, 2012, 11:52 a.m.
Message ID <afabbba81e70e6c82df401e29f4747e2a1e73c11.1355399453.git.vipin.kumar@st.com>
Download mbox | patch
Permalink /patch/205816/
State Accepted
Delegated to: Joe Hershberger
Headers show

Comments

Vipin Kumar - Dec. 13, 2012, 11:52 a.m.
From: Shiraz Hashim <shiraz.hashim@st.com>

SPEAr310 and SPEAr320 Ethernet interfaces share same MDIO lines to control their
respective phys. Currently there is a fixed configuration in which only a
particular MAC can use the MDIO lines.

Call an arch specific function to take control of specific mdio lines at
runtime.

Signed-off-by: Shiraz Hashim <shiraz.hashim@st.com>
Signed-off-by: Vipin Kumar <vipin.kumar@st.com>
Acked-by: Stefan Roese <sr@denx.de>
---
Changes in v2
 Used __weak instead of __attribute__((weak...
 Improve patch comment

 drivers/net/macb.c | 8 ++++++++
 1 file changed, 8 insertions(+)
Joe Hershberger - July 8, 2013, 4:03 p.m.
On Thu, Dec 13, 2012 at 5:52 AM, Vipin Kumar <vipin.kumar@st.com> wrote:
> From: Shiraz Hashim <shiraz.hashim@st.com>
>
> SPEAr310 and SPEAr320 Ethernet interfaces share same MDIO lines to control their
> respective phys. Currently there is a fixed configuration in which only a
> particular MAC can use the MDIO lines.
>
> Call an arch specific function to take control of specific mdio lines at
> runtime.
>
> Signed-off-by: Shiraz Hashim <shiraz.hashim@st.com>
> Signed-off-by: Vipin Kumar <vipin.kumar@st.com>
> Acked-by: Stefan Roese <sr@denx.de>

Applied, Thanks.
-Joe

Patch

diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 8bacbda..6b49f0e 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -163,6 +163,11 @@  static u16 macb_mdio_read(struct macb_device *macb, u8 reg)
 	return MACB_BFEXT(DATA, frame);
 }
 
+static void __weak arch_get_mdio_control(const char *name)
+{
+	return;
+}
+
 #if defined(CONFIG_CMD_MII)
 
 int macb_miiphy_read(const char *devname, u8 phy_adr, u8 reg, u16 *value)
@@ -173,6 +178,7 @@  int macb_miiphy_read(const char *devname, u8 phy_adr, u8 reg, u16 *value)
 	if ( macb->phy_addr != phy_adr )
 		return -1;
 
+	arch_get_mdio_control(devname);
 	*value = macb_mdio_read(macb, reg);
 
 	return 0;
@@ -186,6 +192,7 @@  int macb_miiphy_write(const char *devname, u8 phy_adr, u8 reg, u16 value)
 	if ( macb->phy_addr != phy_adr )
 		return -1;
 
+	arch_get_mdio_control(devname);
 	macb_mdio_write(macb, reg, value);
 
 	return 0;
@@ -377,6 +384,7 @@  static int macb_phy_init(struct macb_device *macb)
 	int media, speed, duplex;
 	int i;
 
+	arch_get_mdio_control(netdev->name);
 #ifdef CONFIG_MACB_SEARCH_PHY
 	/* Auto-detect phy_addr */
 	if (!macb_phy_find(macb)) {