* [PATCH] stmmac: Allow stmmac to work with other PHY buses(v2). @ 2012-03-06 5:42 Giuseppe CAVALLARO 2012-03-06 21:57 ` David Miller 0 siblings, 1 reply; 5+ messages in thread From: Giuseppe CAVALLARO @ 2012-03-06 5:42 UTC (permalink / raw) To: netdev; +Cc: Srinivas Kandagatla, Giuseppe Cavallaro From: Srinivas Kandagatla <srinivas.kandagatla@st.com> After commit "db8857b stmmac: use an unique MDIO bus name" and "90b9a54 stmmac: fix phy naming inconsistency" stmmac cant work with other MDIO buses, because mdio_bus name is fixed in the dirver. This patch adds new variable phy_bus_name to plat_stmmacenet_data struct to let the BSP decide which phy bus to be used by stmmac driver. A typical use-case is to have generic MDIO buses like mdio-gpio on top of stmmac. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com> Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com> --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 8 +++++++- include/linux/stmmac.h | 1 + 2 files changed, 8 insertions(+), 1 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 6ee593a..da891ef9b 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -307,7 +307,13 @@ static int stmmac_init_phy(struct net_device *dev) priv->speed = 0; priv->oldduplex = -1; - snprintf(bus_id, MII_BUS_ID_SIZE, "stmmac-%x", priv->plat->bus_id); + if (priv->plat->phy_bus_name) + snprintf(bus_id, MII_BUS_ID_SIZE, "%s-%x", + priv->plat->phy_bus_name, priv->plat->bus_id); + else + snprintf(bus_id, MII_BUS_ID_SIZE, "stmmac-%x", + priv->plat->bus_id); + snprintf(phy_id, MII_BUS_ID_SIZE + 3, PHY_ID_FMT, bus_id, priv->plat->phy_addr); pr_debug("stmmac_init_phy: trying to attach to %s\n", phy_id); diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h index 0dddc9e..172b5e1 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h @@ -39,6 +39,7 @@ struct stmmac_mdio_bus_data { }; struct plat_stmmacenet_data { + char *phy_bus_name; int bus_id; int phy_addr; int interface; -- 1.7.4.4 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] stmmac: Allow stmmac to work with other PHY buses(v2). 2012-03-06 5:42 [PATCH] stmmac: Allow stmmac to work with other PHY buses(v2) Giuseppe CAVALLARO @ 2012-03-06 21:57 ` David Miller 2012-03-07 8:08 ` Srinivas KANDAGATLA 0 siblings, 1 reply; 5+ messages in thread From: David Miller @ 2012-03-06 21:57 UTC (permalink / raw) To: peppe.cavallaro; +Cc: netdev, srinivas.kandagatla From: Giuseppe CAVALLARO <peppe.cavallaro@st.com> Date: Tue, 6 Mar 2012 06:42:00 +0100 > After commit "db8857b stmmac: use an unique MDIO bus name" and "90b9a54 > stmmac: fix phy naming inconsistency" stmmac cant work with other MDIO > buses, because mdio_bus name is fixed in the dirver. This sounds inaccurate, you're making it sound like these commits introduced this limitation, as far as I can tell they did not. Before the MDIO bus name was just plain "%x" and the bus_id number was placed there. Then it became the same thing, except with some (potentially fixed) prefix. Nothing about that change makes any difference whatsoever about what you're modifications are trying to allow. BTW, also, commit "90b9a54" is ambiguous. [davem@bql net]$ git show 90b9a54 error: short SHA1 90b9a54 is ambiguous. error: short SHA1 90b9a54 is ambiguous. fatal: ambiguous argument '90b9a54': unknown revision or path not in the working tree. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] stmmac: Allow stmmac to work with other PHY buses(v2). 2012-03-06 21:57 ` David Miller @ 2012-03-07 8:08 ` Srinivas KANDAGATLA 2012-03-08 9:16 ` Florian Fainelli 2012-03-08 14:03 ` Giuseppe CAVALLARO 0 siblings, 2 replies; 5+ messages in thread From: Srinivas KANDAGATLA @ 2012-03-07 8:08 UTC (permalink / raw) To: David Miller; +Cc: peppe.cavallaro, netdev [-- Attachment #1: Type: text/plain, Size: 1667 bytes --] David Miller wrote: > From: Giuseppe CAVALLARO <peppe.cavallaro@st.com> > Date: Tue, 6 Mar 2012 06:42:00 +0100 > > >> After commit "db8857b stmmac: use an unique MDIO bus name" and "90b9a54 >> stmmac: fix phy naming inconsistency" stmmac cant work with other MDIO >> buses, because mdio_bus name is fixed in the dirver. >> > > This sounds inaccurate, you're making it sound like these commits > introduced this limitation, as far as I can tell they did not. > > Thanks for your comments, Commit comment is true to some extent, before "db8857b stmmac: use an unique MDIO bus name" and "a77e929 mdio-gpio: use an unique MDIO bus name" we managed to get stmmac use mdio bus by specifying same id in platform data of both the drivers. However after these commits this method was no more possible because stmmac can connect to phys on stmmac-x mdio buses Only. I think, originally the problem was in stmmac to some extent which became worse after adding prefix mdio bus. Here is the new patch removing the misleading comments. > Before the MDIO bus name was just plain "%x" and the bus_id number > was placed there. Then it became the same thing, except with some > (potentially fixed) prefix. > > Nothing about that change makes any difference whatsoever about > what you're modifications are trying to allow. > > BTW, also, commit "90b9a54" is ambiguous. > > Actual commit was : 90b9a5454fd2e626aa1614fe9ece6b63a0dc37af Thanks, srini > [davem@bql net]$ git show 90b9a54 > error: short SHA1 90b9a54 is ambiguous. > error: short SHA1 90b9a54 is ambiguous. > fatal: ambiguous argument '90b9a54': unknown revision or path not in the working tree. > [-- Attachment #2: 0001-stmmac-Allow-stmmac-to-work-with-other-PHY-buses-v3.patch --] [-- Type: text/x-patch, Size: 2015 bytes --] >From 1f10d82e8d2df8d5b86595954dcb4e3c2cab9011 Mon Sep 17 00:00:00 2001 From: Srinivas Kandagatla <srinivas.kandagatla@st.com> Date: Thu, 1 Mar 2012 09:40:12 +0000 Subject: [PATCH 3.3.0-rc4] stmmac: Allow stmmac to work with other PHY buses(v3). As stmmac mdio bus name prefix is hardcoded in the driver, this allows only phys on stmmac mdio buses to connect, however stmmac should allow phys on other mdio buses too. This patch adds new variable phy_bus_name to plat_stmmacenet_data struct to let the BSP decide which phy bus to be used by stmmac driver. A typical use-case is to have generic MDIO buses like mdio-gpio on top of stmmac. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com> --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 8 +++++++- include/linux/stmmac.h | 1 + 2 files changed, 8 insertions(+), 1 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 6ee593a..da891ef 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -307,7 +307,13 @@ static int stmmac_init_phy(struct net_device *dev) priv->speed = 0; priv->oldduplex = -1; - snprintf(bus_id, MII_BUS_ID_SIZE, "stmmac-%x", priv->plat->bus_id); + if (priv->plat->phy_bus_name) + snprintf(bus_id, MII_BUS_ID_SIZE, "%s-%x", + priv->plat->phy_bus_name, priv->plat->bus_id); + else + snprintf(bus_id, MII_BUS_ID_SIZE, "stmmac-%x", + priv->plat->bus_id); + snprintf(phy_id, MII_BUS_ID_SIZE + 3, PHY_ID_FMT, bus_id, priv->plat->phy_addr); pr_debug("stmmac_init_phy: trying to attach to %s\n", phy_id); diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h index 0dddc9e..172b5e1 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h @@ -39,6 +39,7 @@ struct stmmac_mdio_bus_data { }; struct plat_stmmacenet_data { + char *phy_bus_name; int bus_id; int phy_addr; int interface; -- 1.6.3.3 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] stmmac: Allow stmmac to work with other PHY buses(v2). 2012-03-07 8:08 ` Srinivas KANDAGATLA @ 2012-03-08 9:16 ` Florian Fainelli 2012-03-08 14:03 ` Giuseppe CAVALLARO 1 sibling, 0 replies; 5+ messages in thread From: Florian Fainelli @ 2012-03-08 9:16 UTC (permalink / raw) To: srinivas.kandagatla; +Cc: David Miller, peppe.cavallaro, netdev Hi, Le 03/07/12 09:08, Srinivas KANDAGATLA a écrit : > David Miller wrote: >> From: Giuseppe CAVALLARO<peppe.cavallaro@st.com> >> Date: Tue, 6 Mar 2012 06:42:00 +0100 >> >> >>> After commit "db8857b stmmac: use an unique MDIO bus name" and "90b9a54 >>> stmmac: fix phy naming inconsistency" stmmac cant work with other MDIO >>> buses, because mdio_bus name is fixed in the dirver. >>> >> >> This sounds inaccurate, you're making it sound like these commits >> introduced this limitation, as far as I can tell they did not. >> >> > Thanks for your comments, > > Commit comment is true to some extent, before "db8857b stmmac: use an > unique MDIO bus name" and "a77e929 mdio-gpio: use an unique MDIO bus > name" we managed to get stmmac use mdio bus by specifying same id in > platform data of both the drivers. You could get it working with your platform supplied MDIO bus name more by accident than on purpose. > However after these commits this method was no more possible because > stmmac can connect to phys on stmmac-x mdio buses Only. > > I think, originally the problem was in stmmac to some extent which > became worse after adding prefix mdio bus. > Here is the new patch removing the misleading comments. Your new explanation makes much more sense to me now. Feel free to add my: Acked-by: Florian Fainelli <florian@openwrt.org> > > >> Before the MDIO bus name was just plain "%x" and the bus_id number >> was placed there. Then it became the same thing, except with some >> (potentially fixed) prefix. >> >> Nothing about that change makes any difference whatsoever about >> what you're modifications are trying to allow. >> >> BTW, also, commit "90b9a54" is ambiguous. >> >> > Actual commit was : 90b9a5454fd2e626aa1614fe9ece6b63a0dc37af > > Thanks, > srini >> [davem@bql net]$ git show 90b9a54 >> error: short SHA1 90b9a54 is ambiguous. >> error: short SHA1 90b9a54 is ambiguous. >> fatal: ambiguous argument '90b9a54': unknown revision or path not in the working tree. >> > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] stmmac: Allow stmmac to work with other PHY buses(v2). 2012-03-07 8:08 ` Srinivas KANDAGATLA 2012-03-08 9:16 ` Florian Fainelli @ 2012-03-08 14:03 ` Giuseppe CAVALLARO 1 sibling, 0 replies; 5+ messages in thread From: Giuseppe CAVALLARO @ 2012-03-08 14:03 UTC (permalink / raw) To: srinivas.kandagatla; +Cc: David Miller, netdev On 3/7/2012 9:08 AM, Srinivas KANDAGATLA wrote: > David Miller wrote: >> From: Giuseppe CAVALLARO <peppe.cavallaro@st.com> >> Date: Tue, 6 Mar 2012 06:42:00 +0100 >> >> >>> After commit "db8857b stmmac: use an unique MDIO bus name" and "90b9a54 >>> stmmac: fix phy naming inconsistency" stmmac cant work with other MDIO >>> buses, because mdio_bus name is fixed in the dirver. >>> >> >> This sounds inaccurate, you're making it sound like these commits >> introduced this limitation, as far as I can tell they did not. >> >> > Thanks for your comments, > > Commit comment is true to some extent, before "db8857b stmmac: use an > unique MDIO bus name" and "a77e929 mdio-gpio: use an unique MDIO bus > name" we managed to get stmmac use mdio bus by specifying same id in > platform data of both the drivers. > However after these commits this method was no more possible because > stmmac can connect to phys on stmmac-x mdio buses Only. > > I think, originally the problem was in stmmac to some extent which > became worse after adding prefix mdio bus. > Here is the new patch removing the misleading comments. Thx Srini to have resent the patch peppe > > >> Before the MDIO bus name was just plain "%x" and the bus_id number >> was placed there. Then it became the same thing, except with some >> (potentially fixed) prefix. >> >> Nothing about that change makes any difference whatsoever about >> what you're modifications are trying to allow. >> >> BTW, also, commit "90b9a54" is ambiguous. >> >> > Actual commit was : 90b9a5454fd2e626aa1614fe9ece6b63a0dc37af > > Thanks, > srini >> [davem@bql net]$ git show 90b9a54 >> error: short SHA1 90b9a54 is ambiguous. >> error: short SHA1 90b9a54 is ambiguous. >> fatal: ambiguous argument '90b9a54': unknown revision or path not in the working tree. >> > ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-03-08 14:03 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-03-06 5:42 [PATCH] stmmac: Allow stmmac to work with other PHY buses(v2) Giuseppe CAVALLARO 2012-03-06 21:57 ` David Miller 2012-03-07 8:08 ` Srinivas KANDAGATLA 2012-03-08 9:16 ` Florian Fainelli 2012-03-08 14:03 ` Giuseppe CAVALLARO
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).