make ixp4xx require gpiolib
[openwrt.git] / target / linux / ar71xx / patches-2.6.28 / 802-ag71xx_mdio_dynamic_mdio_bus.patch
1 --- a/drivers/net/ag71xx/ag71xx_mdio.c
2 +++ b/drivers/net/ag71xx/ag71xx_mdio.c
3 @@ -57,7 +57,7 @@ static int ag71xx_mdio_mii_read(struct a
4 while (ag71xx_mdio_rr(am, AG71XX_REG_MII_IND) & MII_IND_BUSY) {
5 if (i-- == 0) {
6 printk(KERN_ERR "%s: mii_read timed out\n",
7 - am->mii_bus.name);
8 + am->mii_bus->name);
9 ret = 0xffff;
10 goto out;
11 }
12 @@ -88,7 +88,7 @@ static void ag71xx_mdio_mii_write(struct
13 while (ag71xx_mdio_rr(am, AG71XX_REG_MII_IND) & MII_IND_BUSY) {
14 if (i-- == 0) {
15 printk(KERN_ERR "%s: mii_write timed out\n",
16 - am->mii_bus.name);
17 + am->mii_bus->name);
18 break;
19 }
20 udelay(AG71XX_MDIO_DELAY);
21 @@ -154,23 +154,27 @@ static int __init ag71xx_mdio_probe(stru
22 goto err_free_mdio;
23 }
24
25 - am->mii_bus.name = "ag71xx_mdio";
26 - am->mii_bus.read = ag71xx_mdio_read;
27 - am->mii_bus.write = ag71xx_mdio_write;
28 - am->mii_bus.reset = ag71xx_mdio_reset;
29 - am->mii_bus.irq = am->mii_irq;
30 - am->mii_bus.priv = am;
31 - am->mii_bus.parent = &pdev->dev;
32 - snprintf(am->mii_bus.id, MII_BUS_ID_SIZE, "%x", 0);
33 + am->mii_bus = mdiobus_alloc();
34 + if (am->mii_bus == NULL)
35 + goto err_iounmap;
36 +
37 + am->mii_bus->name = "ag71xx_mdio";
38 + am->mii_bus->read = ag71xx_mdio_read;
39 + am->mii_bus->write = ag71xx_mdio_write;
40 + am->mii_bus->reset = ag71xx_mdio_reset;
41 + am->mii_bus->irq = am->mii_irq;
42 + am->mii_bus->priv = am;
43 + am->mii_bus->parent = &pdev->dev;
44 + snprintf(am->mii_bus->id, MII_BUS_ID_SIZE, "%x", 0);
45
46 pdata = pdev->dev.platform_data;
47 if (pdata)
48 - am->mii_bus.phy_mask = pdata->phy_mask;
49 + am->mii_bus->phy_mask = pdata->phy_mask;
50
51 for (i = 0; i < PHY_MAX_ADDR; i++)
52 am->mii_irq[i] = PHY_POLL;
53
54 - err = mdiobus_register(&am->mii_bus);
55 + err = mdiobus_register(am->mii_bus);
56 if (err)
57 goto err_iounmap;
58
59 @@ -194,7 +198,8 @@ static int __exit ag71xx_mdio_remove(str
60
61 if (am) {
62 ag71xx_mdio_bus = NULL;
63 - mdiobus_unregister(&am->mii_bus);
64 + mdiobus_unregister(am->mii_bus);
65 + mdiobus_free(am->mii_bus);
66 iounmap(am->mdio_base);
67 kfree(am);
68 platform_set_drvdata(pdev, NULL);
69 --- a/drivers/net/ag71xx/ag71xx.h
70 +++ b/drivers/net/ag71xx/ag71xx.h
71 @@ -102,7 +102,7 @@ struct ag71xx_ring {
72 };
73
74 struct ag71xx_mdio {
75 - struct mii_bus mii_bus;
76 + struct mii_bus *mii_bus;
77 int mii_irq[PHY_MAX_ADDR];
78 void __iomem *mdio_base;
79 };
80 --- a/drivers/net/ag71xx/ag71xx_main.c
81 +++ b/drivers/net/ag71xx/ag71xx_main.c
82 @@ -797,7 +797,7 @@ static int __init ag71xx_probe(struct pl
83 ag = netdev_priv(dev);
84 ag->pdev = pdev;
85 ag->dev = dev;
86 - ag->mii_bus = &ag71xx_mdio_bus->mii_bus;
87 + ag->mii_bus = ag71xx_mdio_bus->mii_bus;
88 ag->msg_enable = netif_msg_init(ag71xx_debug,
89 AG71XX_DEFAULT_MSG_ENABLE);
90 spin_lock_init(&ag->lock);
This page took 0.049877 seconds and 5 git commands to generate.