netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: eth: cpsw: Correctly attach to GPIO bitbang MDIO driver
@ 2014-01-29 10:32 Stefan Roese
  2014-01-29 11:42 ` Mugunthan V N
  2014-01-31  0:26 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Stefan Roese @ 2014-01-29 10:32 UTC (permalink / raw)
  To: netdev; +Cc: Lukas Stockmann, Mugunthan V N

When the GPIO bitbang MDIO driver is used instead of the Davinci MDIO driver
we need to configure the phy_id string differently. Otherwise this string
looks like this "gpio.6" instead of "gpio-0" and the PHY is not found when
phy_connect() is called.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Lukas Stockmann <lukas.stockmann@siemens.com>
Cc: Mugunthan V N <mugunthanvnm@ti.com>
---
 drivers/net/ethernet/ti/cpsw.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index a3ca3dd..43e6591 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -1858,8 +1858,18 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data,
 		mdio_node = of_find_node_by_phandle(be32_to_cpup(parp));
 		phyid = be32_to_cpup(parp+1);
 		mdio = of_find_device_by_node(mdio_node);
-		snprintf(slave_data->phy_id, sizeof(slave_data->phy_id),
-			 PHY_ID_FMT, mdio->name, phyid);
+
+		if (strncmp(mdio->name, "gpio", 4) == 0) {
+			/* GPIO bitbang MDIO driver attached */
+			struct mii_bus *bus = dev_get_drvdata(&mdio->dev);
+
+			snprintf(slave_data->phy_id, sizeof(slave_data->phy_id),
+				 PHY_ID_FMT, bus->id, phyid);
+		} else {
+			/* davinci MDIO driver attached */
+			snprintf(slave_data->phy_id, sizeof(slave_data->phy_id),
+				 PHY_ID_FMT, mdio->name, phyid);
+		}
 
 		mac_addr = of_get_mac_address(slave_node);
 		if (mac_addr)
-- 
1.8.5.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: eth: cpsw: Correctly attach to GPIO bitbang MDIO driver
  2014-01-29 10:32 [PATCH] net: eth: cpsw: Correctly attach to GPIO bitbang MDIO driver Stefan Roese
@ 2014-01-29 11:42 ` Mugunthan V N
  2014-01-31  0:26 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Mugunthan V N @ 2014-01-29 11:42 UTC (permalink / raw)
  To: Stefan Roese, netdev; +Cc: Lukas Stockmann

On Wednesday 29 January 2014 04:02 PM, Stefan Roese wrote:
> When the GPIO bitbang MDIO driver is used instead of the Davinci MDIO driver
> we need to configure the phy_id string differently. Otherwise this string
> looks like this "gpio.6" instead of "gpio-0" and the PHY is not found when
> phy_connect() is called.
>
> Signed-off-by: Stefan Roese <sr@denx.de>
> Cc: Lukas Stockmann <lukas.stockmann@siemens.com>
> Cc: Mugunthan V N <mugunthanvnm@ti.com>
Acked-by: Mugunthan V N <mugunthanvnm@ti.com>

Regards
Mugunthan V N

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: eth: cpsw: Correctly attach to GPIO bitbang MDIO driver
  2014-01-29 10:32 [PATCH] net: eth: cpsw: Correctly attach to GPIO bitbang MDIO driver Stefan Roese
  2014-01-29 11:42 ` Mugunthan V N
@ 2014-01-31  0:26 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2014-01-31  0:26 UTC (permalink / raw)
  To: sr; +Cc: netdev, lukas.stockmann, mugunthanvnm

From: Stefan Roese <sr@denx.de>
Date: Wed, 29 Jan 2014 11:32:37 +0100

> When the GPIO bitbang MDIO driver is used instead of the Davinci MDIO driver
> we need to configure the phy_id string differently. Otherwise this string
> looks like this "gpio.6" instead of "gpio-0" and the PHY is not found when
> phy_connect() is called.
> 
> Signed-off-by: Stefan Roese <sr@denx.de>

Applied.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-01-31  0:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-29 10:32 [PATCH] net: eth: cpsw: Correctly attach to GPIO bitbang MDIO driver Stefan Roese
2014-01-29 11:42 ` Mugunthan V N
2014-01-31  0:26 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).