Commit d76c626b authored by Florian Fainelli's avatar Florian Fainelli Committed by David S. Miller

cpmac: fix wrong MDIO bus identifier

This patch fixes the wrong MDIO bus identifier which was
set to 0 unconditionaly, suitable for external switches while
it is actually 1 for PHYs different than external switches
which are autodetected.
Signed-off-by: default avatarFlorian Fainelli <florian@openwrt.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 36cbd3dc
...@@ -1109,7 +1109,7 @@ static int external_switch; ...@@ -1109,7 +1109,7 @@ static int external_switch;
static int __devinit cpmac_probe(struct platform_device *pdev) static int __devinit cpmac_probe(struct platform_device *pdev)
{ {
int rc, phy_id; int rc, phy_id;
char *mdio_bus_id = "0"; char mdio_bus_id[BUS_ID_SIZE];
struct resource *mem; struct resource *mem;
struct cpmac_priv *priv; struct cpmac_priv *priv;
struct net_device *dev; struct net_device *dev;
...@@ -1127,7 +1127,7 @@ static int __devinit cpmac_probe(struct platform_device *pdev) ...@@ -1127,7 +1127,7 @@ static int __devinit cpmac_probe(struct platform_device *pdev)
if (phy_id == PHY_MAX_ADDR) { if (phy_id == PHY_MAX_ADDR) {
if (external_switch || dumb_switch) { if (external_switch || dumb_switch) {
mdio_bus_id = 0; /* fixed phys bus */ strncpy(mdio_bus_id, "0", BUS_ID_SIZE); /* fixed phys bus */
phy_id = pdev->id; phy_id = pdev->id;
} else { } else {
dev_err(&pdev->dev, "no PHY present\n"); dev_err(&pdev->dev, "no PHY present\n");
...@@ -1254,7 +1254,7 @@ int __devinit cpmac_init(void) ...@@ -1254,7 +1254,7 @@ int __devinit cpmac_init(void)
} }
cpmac_mii->phy_mask = ~(mask | 0x80000000); cpmac_mii->phy_mask = ~(mask | 0x80000000);
snprintf(cpmac_mii->id, MII_BUS_ID_SIZE, "0"); snprintf(cpmac_mii->id, MII_BUS_ID_SIZE, "1");
res = mdiobus_register(cpmac_mii); res = mdiobus_register(cpmac_mii);
if (res) if (res)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment