Skip to contentSkip to conversation

net/designware: Do not select MIIPORT for RGMII interface

PATCH RESEND Superseded Vipin Kumar 2 participants 7 messages Dec 6, 2012 – Dec 12, 2012 Network drivers

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/2 net/designware: Do not select MIIPORT for RGMII interface

Do not select MIIPORT for RGMII interface

---
 drivers/net/designware.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/designware.c +3 -1
index bf21a08..46f6601 100644
@@ -113,7 +113,9 @@ static int mac_reset(struct eth_device *dev)
 	int timeout = CONFIG_MACRESET_TIMEOUT;
 
 	writel(DMAMAC_SRST, &dma_p->busmode);
-	writel(MII_PORTSELECT, &mac_p->conf);
+
+	if (priv->interface != PHY_INTERFACE_MODE_RGMII)
+		writel(MII_PORTSELECT, &mac_p->conf);
 
 	start = get_timer(0);
 	while (get_timer(start) < timeout) {
Signature · 1 line
1.8.0
#1 lore raw

PATCH RESEND 1/2 net/designware: Do not select MIIPORT for RGMII interface

ping

Quoted 22 lines · Vipin KUMAR

Do not select MIIPORT for RGMII interface

---
  drivers/net/designware.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/designware.c +3 -1
index bf21a08..46f6601 100644
@@ -113,7 +113,9 @@ static int mac_reset(struct eth_device *dev)
  	int timeout = CONFIG_MACRESET_TIMEOUT;
 
  	writel(DMAMAC_SRST,&dma_p->busmode);
-	writel(MII_PORTSELECT,&mac_p->conf);
+
+	if (priv->interface != PHY_INTERFACE_MODE_RGMII)
+		writel(MII_PORTSELECT,&mac_p->conf);
 
  	start = get_timer(0);
  	while (get_timer(start)<  timeout) {
#2 lore raw

PATCH RESEND 2/2 net/macb: Add arch specific routine to get mdio control

In reply to Vipin Kumar

From: Shiraz Hashim <[email protected]>

SPEAr310 and SPEAr320 Ethernet interfaces share same MDIO lines to control their respective phys. Currently their 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.

---
 drivers/net/macb.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/net/macb.c +10 -0
index 8bacbda..45fbbd7 100644
@@ -163,6 +163,13 @@ static u16 macb_mdio_read(struct macb_device *macb, u8 reg)
 	return MACB_BFEXT(DATA, frame);
 }
 
+static void __def_arch_get_mdio_control(const char *name)
+{
+	return;
+}
+int arch_get_mdio_control(const char *name)
+	__attribute__((weak, alias("__def_arch_get_mdio_control")));
+
 #if defined(CONFIG_CMD_MII)
 
 int macb_miiphy_read(const char *devname, u8 phy_adr, u8 reg, u16 *value)
@@ -173,6 +180,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 +194,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 +386,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)) {
Signature · 1 line
1.8.0
#3 lore raw

PATCH RESEND 2/2 net/macb: Add arch specific routine to get mdio control

ping. one more :)

Quoted 57 lines · Vipin KUMAR

From: Shiraz Hashim<[email protected]>

SPEAr310 and SPEAr320 Ethernet interfaces share same MDIO lines to control their respective phys. Currently their 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.

---
  drivers/net/macb.c | 10 ++++++++++
  1 file changed, 10 insertions(+)
drivers/net/macb.c +10 -0
index 8bacbda..45fbbd7 100644
@@ -163,6 +163,13 @@ static u16 macb_mdio_read(struct macb_device *macb, u8 reg)
  	return MACB_BFEXT(DATA, frame);
  }
 
+static void __def_arch_get_mdio_control(const char *name)
+{
+	return;
+}
+int arch_get_mdio_control(const char *name)
+	__attribute__((weak, alias("__def_arch_get_mdio_control")));
+
  #if defined(CONFIG_CMD_MII)
 
  int macb_miiphy_read(const char *devname, u8 phy_adr, u8 reg, u16 *value)
@@ -173,6 +180,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 +194,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 +386,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)) {
#4 lore raw

PATCH RESEND 2/2 net/macb: Add arch specific routine to get mdio control

In reply to Vipin Kumar
Quoted 5 lines · Vipin Kumar

From: Shiraz Hashim <[email protected]>

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

"there is" instead of "their is"

Quoted 14 lines

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

---
 drivers/net/macb.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/net/macb.c +0 -0
index 8bacbda..45fbbd7 100644

drivers/net/macb.c static u16 macb_mdio_read(struct macb_device *macb, u8 reg) · line 171

Quoted 9 lines
drivers/net/macb.c +6 -0
@@ -163,6 +163,13 @@ static u16 macb_mdio_read(struct macb_device *macb, u8 reg)
 	return MACB_BFEXT(DATA, frame);
 }
 
+static void __def_arch_get_mdio_control(const char *name)
+{
+	return;
+}
+int arch_get_mdio_control(const char *name)
+	__attribute__((weak, alias("__def_arch_get_mdio_control")));

__weak from linux/compiler.h please

Otherwise:

Thanks,
Stefan

#5 lore raw

PATCH RESEND 2/2 net/macb: Add arch specific routine to get mdio control

Quoted 9 lines · Stefan Roese
Quoted 5 lines · Vipin Kumar

From: Shiraz Hashim<[email protected]>

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

"there is" instead of "their is"

Thanks. I would change this in v2

Quoted 17 lines
Quoted 17 lines

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

---
  drivers/net/macb.c | 10 ++++++++++
  1 file changed, 10 insertions(+)
drivers/net/macb.c +0 -0
index 8bacbda..45fbbd7 100644
@@ -163,6 +163,13 @@ static u16 macb_mdio_read(struct macb_device *macb, u8 reg)
  	return MACB_BFEXT(DATA, frame);
  }
 
Quoted 9 lines

drivers/net/macb.c static u16 macb_mdio_read(struct macb_device *macb, u8 reg) · line 171

Quoted 6 lines
drivers/net/macb.c +6 -0
+static void __def_arch_get_mdio_control(const char *name)
+{
+	return;
+}
+int arch_get_mdio_control(const char *name)
+	__attribute__((weak, alias("__def_arch_get_mdio_control")));

__weak from linux/compiler.h please

in v2

Quoted 8 lines

Otherwise:

Thanks,
Stefan

Vipin