aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Fleming <afleming@freescale.com>2008-04-09 20:38:13 -0400
committerJeff Garzik <jgarzik@redhat.com>2008-04-16 20:09:35 -0400
commit9d9326d3bc0ea9a8bbe40bf3e5e66c7b9858caa0 (patch)
tree51b2ee6bfa87bbd6faac0bc00a787354e1fb72a0
parentd080cd6301e107e79c6a0fc654319f8979f70549 (diff)
phy: Change mii_bus id field to a string
Having the id field be an int was making more complex bus topologies excessively difficult. For now, just convert it to a string, and change all instances of "bus->id = val" to snprintf(id, MII_BUS_ID_LEN, "%x", val). Signed-off-by: Andy Fleming <afleming@freescale.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
-rw-r--r--arch/powerpc/platforms/82xx/ep8248e.c2
-rw-r--r--arch/powerpc/platforms/pasemi/gpio_mdio.c2
-rw-r--r--arch/powerpc/sysdev/fsl_soc.c5
-rw-r--r--drivers/net/au1000_eth.c6
-rw-r--r--drivers/net/bfin_mac.c2
-rw-r--r--drivers/net/cpmac.c5
-rw-r--r--drivers/net/fec_mpc52xx.c2
-rw-r--r--drivers/net/fec_mpc52xx_phy.c2
-rw-r--r--drivers/net/fs_enet/fs_enet-main.c4
-rw-r--r--drivers/net/fs_enet/mii-bitbang.c4
-rw-r--r--drivers/net/fs_enet/mii-fec.c4
-rw-r--r--drivers/net/gianfar_mii.c2
-rw-r--r--drivers/net/macb.c2
-rw-r--r--drivers/net/pasemi_mac.c2
-rw-r--r--drivers/net/phy/fixed.c2
-rw-r--r--drivers/net/sb1250-mac.c2
-rw-r--r--drivers/net/ucc_geth.c2
-rw-r--r--drivers/net/ucc_geth.h2
-rw-r--r--drivers/net/ucc_geth_mii.c2
-rw-r--r--include/linux/fsl_devices.h2
-rw-r--r--include/linux/phy.h12
21 files changed, 36 insertions, 32 deletions
diff --git a/arch/powerpc/platforms/82xx/ep8248e.c b/arch/powerpc/platforms/82xx/ep8248e.c
index ba93d8ae9b0c..d5770fdf7f09 100644
--- a/arch/powerpc/platforms/82xx/ep8248e.c
+++ b/arch/powerpc/platforms/82xx/ep8248e.c
@@ -138,7 +138,7 @@ static int __devinit ep8248e_mdio_probe(struct of_device *ofdev,
138 138
139 bus->name = "ep8248e-mdio-bitbang"; 139 bus->name = "ep8248e-mdio-bitbang";
140 bus->dev = &ofdev->dev; 140 bus->dev = &ofdev->dev;
141 bus->id = res.start; 141 snprintf(bus->id, MII_BUS_ID_SIZE, "%x", res.start);
142 142
143 return mdiobus_register(bus); 143 return mdiobus_register(bus);
144} 144}
diff --git a/arch/powerpc/platforms/pasemi/gpio_mdio.c b/arch/powerpc/platforms/pasemi/gpio_mdio.c
index b46542990cf8..ab6955412ba4 100644
--- a/arch/powerpc/platforms/pasemi/gpio_mdio.c
+++ b/arch/powerpc/platforms/pasemi/gpio_mdio.c
@@ -241,7 +241,7 @@ static int __devinit gpio_mdio_probe(struct of_device *ofdev,
241 new_bus->reset = &gpio_mdio_reset; 241 new_bus->reset = &gpio_mdio_reset;
242 242
243 prop = of_get_property(np, "reg", NULL); 243 prop = of_get_property(np, "reg", NULL);
244 new_bus->id = *prop; 244 snprintf(new_bus->id, MII_BUS_ID_SIZE, "%x", *prop);
245 new_bus->priv = priv; 245 new_bus->priv = priv;
246 246
247 new_bus->phy_mask = 0; 247 new_bus->phy_mask = 0;
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index 2c5388ce902a..3581416905ea 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -341,7 +341,7 @@ static int __init gfar_of_init(void)
341 goto unreg; 341 goto unreg;
342 } 342 }
343 343
344 gfar_data.bus_id = 0; 344 snprintf(gfar_data.bus_id, MII_BUS_ID_SIZE, "0");
345 gfar_data.phy_id = fixed_link[0]; 345 gfar_data.phy_id = fixed_link[0];
346 } else { 346 } else {
347 phy = of_find_node_by_phandle(*ph); 347 phy = of_find_node_by_phandle(*ph);
@@ -362,7 +362,8 @@ static int __init gfar_of_init(void)
362 } 362 }
363 363
364 gfar_data.phy_id = *id; 364 gfar_data.phy_id = *id;
365 gfar_data.bus_id = res.start; 365 snprintf(gfar_data.bus_id, MII_BUS_ID_SIZE, "%x",
366 res.start);
366 367
367 of_node_put(phy); 368 of_node_put(phy);
368 of_node_put(mdio); 369 of_node_put(mdio);
diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c
index 504b7ce2747d..3634b5fd7919 100644
--- a/drivers/net/au1000_eth.c
+++ b/drivers/net/au1000_eth.c
@@ -701,7 +701,7 @@ static struct net_device * au1000_probe(int port_num)
701 aup->mii_bus.write = mdiobus_write; 701 aup->mii_bus.write = mdiobus_write;
702 aup->mii_bus.reset = mdiobus_reset; 702 aup->mii_bus.reset = mdiobus_reset;
703 aup->mii_bus.name = "au1000_eth_mii"; 703 aup->mii_bus.name = "au1000_eth_mii";
704 aup->mii_bus.id = aup->mac_id; 704 snprintf(aup->mii_bus.id, MII_BUS_ID_SIZE, "%x", aup->mac_id);
705 aup->mii_bus.irq = kmalloc(sizeof(int)*PHY_MAX_ADDR, GFP_KERNEL); 705 aup->mii_bus.irq = kmalloc(sizeof(int)*PHY_MAX_ADDR, GFP_KERNEL);
706 for(i = 0; i < PHY_MAX_ADDR; ++i) 706 for(i = 0; i < PHY_MAX_ADDR; ++i)
707 aup->mii_bus.irq[i] = PHY_POLL; 707 aup->mii_bus.irq[i] = PHY_POLL;
@@ -709,11 +709,11 @@ static struct net_device * au1000_probe(int port_num)
709 /* if known, set corresponding PHY IRQs */ 709 /* if known, set corresponding PHY IRQs */
710#if defined(AU1XXX_PHY_STATIC_CONFIG) 710#if defined(AU1XXX_PHY_STATIC_CONFIG)
711# if defined(AU1XXX_PHY0_IRQ) 711# if defined(AU1XXX_PHY0_IRQ)
712 if (AU1XXX_PHY0_BUSID == aup->mii_bus.id) 712 if (AU1XXX_PHY0_BUSID == aup->mac_id)
713 aup->mii_bus.irq[AU1XXX_PHY0_ADDR] = AU1XXX_PHY0_IRQ; 713 aup->mii_bus.irq[AU1XXX_PHY0_ADDR] = AU1XXX_PHY0_IRQ;
714# endif 714# endif
715# if defined(AU1XXX_PHY1_IRQ) 715# if defined(AU1XXX_PHY1_IRQ)
716 if (AU1XXX_PHY1_BUSID == aup->mii_bus.id) 716 if (AU1XXX_PHY1_BUSID == aup->mac_id)
717 aup->mii_bus.irq[AU1XXX_PHY1_ADDR] = AU1XXX_PHY1_IRQ; 717 aup->mii_bus.irq[AU1XXX_PHY1_ADDR] = AU1XXX_PHY1_IRQ;
718# endif 718# endif
719#endif 719#endif
diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c
index 26b2dd5016cd..717dcc1aa1e9 100644
--- a/drivers/net/bfin_mac.c
+++ b/drivers/net/bfin_mac.c
@@ -969,7 +969,7 @@ static int __init bf537mac_probe(struct net_device *dev)
969 lp->mii_bus.write = mdiobus_write; 969 lp->mii_bus.write = mdiobus_write;
970 lp->mii_bus.reset = mdiobus_reset; 970 lp->mii_bus.reset = mdiobus_reset;
971 lp->mii_bus.name = "bfin_mac_mdio"; 971 lp->mii_bus.name = "bfin_mac_mdio";
972 lp->mii_bus.id = 0; 972 snprintf(lp->mii_bus.id, MII_BUS_ID_SIZE, "0");
973 lp->mii_bus.irq = kmalloc(sizeof(int)*PHY_MAX_ADDR, GFP_KERNEL); 973 lp->mii_bus.irq = kmalloc(sizeof(int)*PHY_MAX_ADDR, GFP_KERNEL);
974 for (i = 0; i < PHY_MAX_ADDR; ++i) 974 for (i = 0; i < PHY_MAX_ADDR; ++i)
975 lp->mii_bus.irq[i] = PHY_POLL; 975 lp->mii_bus.irq[i] = PHY_POLL;
diff --git a/drivers/net/cpmac.c b/drivers/net/cpmac.c
index c85194f2cd2d..9da7ff437031 100644
--- a/drivers/net/cpmac.c
+++ b/drivers/net/cpmac.c
@@ -987,7 +987,7 @@ static int external_switch;
987static int __devinit cpmac_probe(struct platform_device *pdev) 987static int __devinit cpmac_probe(struct platform_device *pdev)
988{ 988{
989 int rc, phy_id, i; 989 int rc, phy_id, i;
990 int mdio_bus_id = cpmac_mii.id; 990 char *mdio_bus_id = "0";
991 struct resource *mem; 991 struct resource *mem;
992 struct cpmac_priv *priv; 992 struct cpmac_priv *priv;
993 struct net_device *dev; 993 struct net_device *dev;
@@ -1008,8 +1008,6 @@ static int __devinit cpmac_probe(struct platform_device *pdev)
1008 if (external_switch || dumb_switch) { 1008 if (external_switch || dumb_switch) {
1009 struct fixed_phy_status status = {}; 1009 struct fixed_phy_status status = {};
1010 1010
1011 mdio_bus_id = 0;
1012
1013 /* 1011 /*
1014 * FIXME: this should be in the platform code! 1012 * FIXME: this should be in the platform code!
1015 * Since there is not platform code at all (that is, 1013 * Since there is not platform code at all (that is,
@@ -1143,6 +1141,7 @@ int __devinit cpmac_init(void)
1143 } 1141 }
1144 1142
1145 cpmac_mii.phy_mask = ~(mask | 0x80000000); 1143 cpmac_mii.phy_mask = ~(mask | 0x80000000);
1144 snprintf(cpmac_mii.id, MII_BUS_ID_SIZE, "0");
1146 1145
1147 res = mdiobus_register(&cpmac_mii); 1146 res = mdiobus_register(&cpmac_mii);
1148 if (res) 1147 if (res)
diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c
index 58b71e60204e..43b5f30743c2 100644
--- a/drivers/net/fec_mpc52xx.c
+++ b/drivers/net/fec_mpc52xx.c
@@ -198,7 +198,7 @@ static int mpc52xx_fec_init_phy(struct net_device *dev)
198 struct phy_device *phydev; 198 struct phy_device *phydev;
199 char phy_id[BUS_ID_SIZE]; 199 char phy_id[BUS_ID_SIZE];
200 200
201 snprintf(phy_id, BUS_ID_SIZE, PHY_ID_FMT, 201 snprintf(phy_id, BUS_ID_SIZE, "%x:%02x",
202 (unsigned int)dev->base_addr, priv->phy_addr); 202 (unsigned int)dev->base_addr, priv->phy_addr);
203 203
204 priv->link = PHY_DOWN; 204 priv->link = PHY_DOWN;
diff --git a/drivers/net/fec_mpc52xx_phy.c b/drivers/net/fec_mpc52xx_phy.c
index 6a3ac4ea97e9..956836fc5ec0 100644
--- a/drivers/net/fec_mpc52xx_phy.c
+++ b/drivers/net/fec_mpc52xx_phy.c
@@ -124,7 +124,7 @@ static int mpc52xx_fec_mdio_probe(struct of_device *of, const struct of_device_i
124 goto out_free; 124 goto out_free;
125 } 125 }
126 126
127 bus->id = res.start; 127 snprintf(bus->id, MII_BUS_ID_SIZE, "%x", res.start);
128 bus->priv = priv; 128 bus->priv = priv;
129 129
130 bus->dev = dev; 130 bus->dev = dev;
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c
index 940e2041ba38..67b4b0728fce 100644
--- a/drivers/net/fs_enet/fs_enet-main.c
+++ b/drivers/net/fs_enet/fs_enet-main.c
@@ -1178,7 +1178,7 @@ static int __devinit find_phy(struct device_node *np,
1178 1178
1179 data = of_get_property(np, "fixed-link", NULL); 1179 data = of_get_property(np, "fixed-link", NULL);
1180 if (data) { 1180 if (data) {
1181 snprintf(fpi->bus_id, 16, PHY_ID_FMT, 0, *data); 1181 snprintf(fpi->bus_id, 16, "%x:%02x", 0, *data);
1182 return 0; 1182 return 0;
1183 } 1183 }
1184 1184
@@ -1202,7 +1202,7 @@ static int __devinit find_phy(struct device_node *np,
1202 if (!data || len != 4) 1202 if (!data || len != 4)
1203 goto out_put_mdio; 1203 goto out_put_mdio;
1204 1204
1205 snprintf(fpi->bus_id, 16, PHY_ID_FMT, res.start, *data); 1205 snprintf(fpi->bus_id, 16, "%x:%02x", res.start, *data);
1206 1206
1207out_put_mdio: 1207out_put_mdio:
1208 of_node_put(mdionode); 1208 of_node_put(mdionode);
diff --git a/drivers/net/fs_enet/mii-bitbang.c b/drivers/net/fs_enet/mii-bitbang.c
index b8e4a736a130..1620030cd33c 100644
--- a/drivers/net/fs_enet/mii-bitbang.c
+++ b/drivers/net/fs_enet/mii-bitbang.c
@@ -130,7 +130,7 @@ static int __devinit fs_mii_bitbang_init(struct mii_bus *bus,
130 * we get is an int, and the odds of multiple bitbang mdio buses 130 * we get is an int, and the odds of multiple bitbang mdio buses
131 * is low enough that it's not worth going too crazy. 131 * is low enough that it's not worth going too crazy.
132 */ 132 */
133 bus->id = res.start; 133 snprintf(bus->id, MII_BUS_ID_SIZE, "%x", res.start);
134 134
135 data = of_get_property(np, "fsl,mdio-pin", &len); 135 data = of_get_property(np, "fsl,mdio-pin", &len);
136 if (!data || len != 4) 136 if (!data || len != 4)
@@ -307,7 +307,7 @@ static int __devinit fs_enet_mdio_probe(struct device *dev)
307 return -ENOMEM; 307 return -ENOMEM;
308 308
309 new_bus->name = "BB MII Bus", 309 new_bus->name = "BB MII Bus",
310 new_bus->id = pdev->id; 310 snprintf(new_bus->id, MII_BUS_ID_SIZE, "%x", pdev->id);
311 311
312 new_bus->phy_mask = ~0x9; 312 new_bus->phy_mask = ~0x9;
313 pdata = (struct fs_mii_bb_platform_info *)pdev->dev.platform_data; 313 pdata = (struct fs_mii_bb_platform_info *)pdev->dev.platform_data;
diff --git a/drivers/net/fs_enet/mii-fec.c b/drivers/net/fs_enet/mii-fec.c
index a89cf15090b8..ba75efc9f5b5 100644
--- a/drivers/net/fs_enet/mii-fec.c
+++ b/drivers/net/fs_enet/mii-fec.c
@@ -196,7 +196,7 @@ static int __devinit fs_enet_mdio_probe(struct of_device *ofdev,
196 if (ret) 196 if (ret)
197 return ret; 197 return ret;
198 198
199 new_bus->id = res.start; 199 snprintf(new_bus->id, MII_BUS_ID_SIZE, "%x", res.start);
200 200
201 fec->fecp = ioremap(res.start, res.end - res.start + 1); 201 fec->fecp = ioremap(res.start, res.end - res.start + 1);
202 if (!fec->fecp) 202 if (!fec->fecp)
@@ -309,7 +309,7 @@ static int __devinit fs_enet_fec_mdio_probe(struct device *dev)
309 new_bus->read = &fs_enet_fec_mii_read, 309 new_bus->read = &fs_enet_fec_mii_read,
310 new_bus->write = &fs_enet_fec_mii_write, 310 new_bus->write = &fs_enet_fec_mii_write,
311 new_bus->reset = &fs_enet_fec_mii_reset, 311 new_bus->reset = &fs_enet_fec_mii_reset,
312 new_bus->id = pdev->id; 312 snprintf(new_bus->id, MII_BUS_ID_SIZE, "%x", pdev->id);
313 313
314 pdata = (struct fs_mii_fec_platform_info *)pdev->dev.platform_data; 314 pdata = (struct fs_mii_fec_platform_info *)pdev->dev.platform_data;
315 315
diff --git a/drivers/net/gianfar_mii.c b/drivers/net/gianfar_mii.c
index 24327629bf03..b8898927236a 100644
--- a/drivers/net/gianfar_mii.c
+++ b/drivers/net/gianfar_mii.c
@@ -173,7 +173,7 @@ int gfar_mdio_probe(struct device *dev)
173 new_bus->read = &gfar_mdio_read, 173 new_bus->read = &gfar_mdio_read,
174 new_bus->write = &gfar_mdio_write, 174 new_bus->write = &gfar_mdio_write,
175 new_bus->reset = &gfar_mdio_reset, 175 new_bus->reset = &gfar_mdio_reset,
176 new_bus->id = pdev->id; 176 snprintf(new_bus->id, MII_BUS_ID_SIZE, "%x", pdev->id);
177 177
178 pdata = (struct gianfar_mdio_data *)pdev->dev.platform_data; 178 pdata = (struct gianfar_mdio_data *)pdev->dev.platform_data;
179 179
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 489c7c3b90d9..d513bb8a4902 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -246,7 +246,7 @@ static int macb_mii_init(struct macb *bp)
246 bp->mii_bus.read = &macb_mdio_read; 246 bp->mii_bus.read = &macb_mdio_read;
247 bp->mii_bus.write = &macb_mdio_write; 247 bp->mii_bus.write = &macb_mdio_write;
248 bp->mii_bus.reset = &macb_mdio_reset; 248 bp->mii_bus.reset = &macb_mdio_reset;
249 bp->mii_bus.id = bp->pdev->id; 249 snprintf(bp->mii_bus.id, MII_BUS_ID_SIZE, "%x", bp->pdev->id);
250 bp->mii_bus.priv = bp; 250 bp->mii_bus.priv = bp;
251 bp->mii_bus.dev = &bp->dev->dev; 251 bp->mii_bus.dev = &bp->dev->dev;
252 pdata = bp->pdev->dev.platform_data; 252 pdata = bp->pdev->dev.platform_data;
diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c
index 2e39e0285d8f..bcd7f9814ed8 100644
--- a/drivers/net/pasemi_mac.c
+++ b/drivers/net/pasemi_mac.c
@@ -1012,7 +1012,7 @@ static int pasemi_mac_phy_init(struct net_device *dev)
1012 goto err; 1012 goto err;
1013 1013
1014 phy_id = *prop; 1014 phy_id = *prop;
1015 snprintf(mac->phy_id, BUS_ID_SIZE, PHY_ID_FMT, (int)r.start, phy_id); 1015 snprintf(mac->phy_id, BUS_ID_SIZE, "%x:%02x", (int)r.start, phy_id);
1016 1016
1017 of_node_put(phy_dn); 1017 of_node_put(phy_dn);
1018 1018
diff --git a/drivers/net/phy/fixed.c b/drivers/net/phy/fixed.c
index ca9b040f9ad9..4e07956a483b 100644
--- a/drivers/net/phy/fixed.c
+++ b/drivers/net/phy/fixed.c
@@ -213,7 +213,7 @@ static int __init fixed_mdio_bus_init(void)
213 goto err_pdev; 213 goto err_pdev;
214 } 214 }
215 215
216 fmb->mii_bus.id = 0; 216 snprintf(fmb->mii_bus.id, MII_BUS_ID_SIZE, "0");
217 fmb->mii_bus.name = "Fixed MDIO Bus"; 217 fmb->mii_bus.name = "Fixed MDIO Bus";
218 fmb->mii_bus.dev = &pdev->dev; 218 fmb->mii_bus.dev = &pdev->dev;
219 fmb->mii_bus.read = &fixed_mdio_read; 219 fmb->mii_bus.read = &fixed_mdio_read;
diff --git a/drivers/net/sb1250-mac.c b/drivers/net/sb1250-mac.c
index 7b53d658e337..888b7dec9866 100644
--- a/drivers/net/sb1250-mac.c
+++ b/drivers/net/sb1250-mac.c
@@ -2374,7 +2374,7 @@ static int sbmac_init(struct platform_device *pldev, long long base)
2374 dev->name, base, print_mac(mac, eaddr)); 2374 dev->name, base, print_mac(mac, eaddr));
2375 2375
2376 sc->mii_bus.name = sbmac_mdio_string; 2376 sc->mii_bus.name = sbmac_mdio_string;
2377 sc->mii_bus.id = idx; 2377 snprintf(sc->mii_bus.id, MII_BUS_ID_SIZE, "%x", idx);
2378 sc->mii_bus.priv = sc; 2378 sc->mii_bus.priv = sc;
2379 sc->mii_bus.read = sbmac_mii_read; 2379 sc->mii_bus.read = sbmac_mii_read;
2380 sc->mii_bus.write = sbmac_mii_write; 2380 sc->mii_bus.write = sbmac_mii_write;
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 0ee4c168e4c0..29a4d650e8a8 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -3954,7 +3954,7 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
3954 if (err) 3954 if (err)
3955 return -1; 3955 return -1;
3956 3956
3957 ug_info->mdio_bus = res.start; 3957 snprintf(ug_info->mdio_bus, MII_BUS_ID_SIZE, "%x", res.start);
3958 } 3958 }
3959 3959
3960 /* get the phy interface type, or default to MII */ 3960 /* get the phy interface type, or default to MII */
diff --git a/drivers/net/ucc_geth.h b/drivers/net/ucc_geth.h
index 4fb95b3af948..9f8b7580a3a4 100644
--- a/drivers/net/ucc_geth.h
+++ b/drivers/net/ucc_geth.h
@@ -1156,7 +1156,7 @@ struct ucc_geth_info {
1156 u16 pausePeriod; 1156 u16 pausePeriod;
1157 u16 extensionField; 1157 u16 extensionField;
1158 u8 phy_address; 1158 u8 phy_address;
1159 u32 mdio_bus; 1159 char mdio_bus[MII_BUS_ID_SIZE];
1160 u8 weightfactor[NUM_TX_QUEUES]; 1160 u8 weightfactor[NUM_TX_QUEUES];
1161 u8 interruptcoalescingmaxvalue[NUM_RX_QUEUES]; 1161 u8 interruptcoalescingmaxvalue[NUM_RX_QUEUES];
1162 u8 l2qt[UCC_GETH_VLAN_PRIORITY_MAX]; 1162 u8 l2qt[UCC_GETH_VLAN_PRIORITY_MAX];
diff --git a/drivers/net/ucc_geth_mii.c b/drivers/net/ucc_geth_mii.c
index c69e654d539f..e4d3f330bac3 100644
--- a/drivers/net/ucc_geth_mii.c
+++ b/drivers/net/ucc_geth_mii.c
@@ -157,7 +157,7 @@ static int uec_mdio_probe(struct of_device *ofdev, const struct of_device_id *ma
157 if (err) 157 if (err)
158 goto reg_map_fail; 158 goto reg_map_fail;
159 159
160 new_bus->id = res.start; 160 snprintf(new_bus->id, MII_BUS_ID_SIZE, "%x", res.start);
161 161
162 new_bus->irq = kmalloc(32 * sizeof(int), GFP_KERNEL); 162 new_bus->irq = kmalloc(32 * sizeof(int), GFP_KERNEL);
163 163
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h
index 1831b196c70a..2cad5c67397e 100644
--- a/include/linux/fsl_devices.h
+++ b/include/linux/fsl_devices.h
@@ -50,7 +50,7 @@ struct gianfar_platform_data {
50 u32 device_flags; 50 u32 device_flags;
51 /* board specific information */ 51 /* board specific information */
52 u32 board_flags; 52 u32 board_flags;
53 u32 bus_id; 53 char bus_id[MII_BUS_ID_SIZE];
54 u32 phy_id; 54 u32 phy_id;
55 u8 mac_addr[6]; 55 u8 mac_addr[6];
56 phy_interface_t interface; 56 phy_interface_t interface;
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 5e43ae751412..6509f377bb10 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -63,8 +63,6 @@ typedef enum {
63 PHY_INTERFACE_MODE_RTBI 63 PHY_INTERFACE_MODE_RTBI
64} phy_interface_t; 64} phy_interface_t;
65 65
66#define MII_BUS_MAX 4
67
68 66
69#define PHY_INIT_TIMEOUT 100000 67#define PHY_INIT_TIMEOUT 100000
70#define PHY_STATE_TIME 1 68#define PHY_STATE_TIME 1
@@ -74,13 +72,19 @@ typedef enum {
74#define PHY_MAX_ADDR 32 72#define PHY_MAX_ADDR 32
75 73
76/* Used when trying to connect to a specific phy (mii bus id:phy device id) */ 74/* Used when trying to connect to a specific phy (mii bus id:phy device id) */
77#define PHY_ID_FMT "%x:%02x" 75#define PHY_ID_FMT "%s:%02x"
76
77/*
78 * Need to be a little smaller than phydev->dev.bus_id to leave room
79 * for the ":%02x"
80 */
81#define MII_BUS_ID_SIZE (BUS_ID_SIZE - 3)
78 82
79/* The Bus class for PHYs. Devices which provide access to 83/* The Bus class for PHYs. Devices which provide access to
80 * PHYs should register using this structure */ 84 * PHYs should register using this structure */
81struct mii_bus { 85struct mii_bus {
82 const char *name; 86 const char *name;
83 int id; 87 char id[MII_BUS_ID_SIZE];
84 void *priv; 88 void *priv;
85 int (*read)(struct mii_bus *bus, int phy_id, int regnum); 89 int (*read)(struct mii_bus *bus, int phy_id, int regnum);
86 int (*write)(struct mii_bus *bus, int phy_id, int regnum, u16 val); 90 int (*write)(struct mii_bus *bus, int phy_id, int regnum, u16 val);