1 This patch reflects changes in mdiobus implementation in kernel 2.6.28.
2 --- a/drivers/net/ar2313/ar2313.c
3 +++ b/drivers/net/ar2313/ar2313.c
4 @@ -159,10 +159,10 @@ static void rx_tasklet_func(unsigned lon
5 static void rx_tasklet_cleanup(struct net_device *dev);
6 static void ar2313_multicast_list(struct net_device *dev);
8 -static int mdiobus_read(struct mii_bus *bus, int phy_addr, int regnum);
9 -static int mdiobus_write(struct mii_bus *bus, int phy_addr, int regnum, u16 value);
10 -static int mdiobus_reset(struct mii_bus *bus);
11 -static int mdiobus_probe (struct net_device *dev);
12 +static int ar2313_mdiobus_read(struct mii_bus *bus, int phy_addr, int regnum);
13 +static int ar2313_mdiobus_write(struct mii_bus *bus, int phy_addr, int regnum, u16 value);
14 +static int ar2313_mdiobus_reset(struct mii_bus *bus);
15 +static int ar2313_mdiobus_probe (struct net_device *dev);
16 static void ar2313_adjust_link(struct net_device *dev);
19 @@ -286,18 +286,22 @@ int __init ar2313_probe(struct platform_
20 dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2],
21 dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5], dev->irq);
23 - sp->mii_bus.priv = dev;
24 - sp->mii_bus.read = mdiobus_read;
25 - sp->mii_bus.write = mdiobus_write;
26 - sp->mii_bus.reset = mdiobus_reset;
27 - sp->mii_bus.name = "ar2313_eth_mii";
28 - snprintf(sp->mii_bus.id, MII_BUS_ID_SIZE, "0");
29 - sp->mii_bus.irq = kmalloc(sizeof(int), GFP_KERNEL);
30 - *sp->mii_bus.irq = PHY_POLL;
31 + sp->mii_bus = mdiobus_alloc();
32 + if (sp->mii_bus == NULL)
35 + sp->mii_bus->priv = dev;
36 + sp->mii_bus->read = ar2313_mdiobus_read;
37 + sp->mii_bus->write = ar2313_mdiobus_write;
38 + sp->mii_bus->reset = ar2313_mdiobus_reset;
39 + sp->mii_bus->name = "ar2313_eth_mii";
40 + snprintf(sp->mii_bus->id, MII_BUS_ID_SIZE, "0");
41 + sp->mii_bus->irq = kmalloc(sizeof(int), GFP_KERNEL);
42 + *sp->mii_bus->irq = PHY_POLL;
44 - mdiobus_register(&sp->mii_bus);
45 + mdiobus_register(sp->mii_bus);
47 - if (mdiobus_probe(dev) != 0) {
48 + if (ar2313_mdiobus_probe(dev) != 0) {
49 printk(KERN_ERR "ar2313: mdiobus_probe failed");
50 rx_tasklet_cleanup(dev);
51 ar2313_init_cleanup(dev);
52 @@ -432,9 +436,12 @@ static void rx_tasklet_cleanup(struct ne
53 static int __exit ar2313_remove(struct platform_device *pdev)
55 struct net_device *dev = platform_get_drvdata(pdev);
56 + struct ar2313_private *sp = netdev_priv(dev);
57 rx_tasklet_cleanup(dev);
58 ar2313_init_cleanup(dev);
59 unregister_netdev(dev);
60 + mdiobus_unregister(sp->mii_bus);
61 + mdiobus_free(sp->mii_bus);
65 @@ -619,7 +626,7 @@ static void ar2313_check_link(struct net
66 struct ar2313_private *sp = netdev_priv(dev);
69 - phyData = mdiobus_read(&sp->mii_bus, sp->phy, MII_BMSR);
70 + phyData = ar2313_mdiobus_read(sp->mii_bus, sp->phy, MII_BMSR);
71 if (sp->phyData != phyData) {
72 if (phyData & BMSR_LSTATUS) {
73 /* link is present, ready link partner ability to deterine
74 @@ -628,10 +635,10 @@ static void ar2313_check_link(struct net
78 - reg = mdiobus_read(&sp->mii_bus, sp->phy, MII_BMCR);
79 + reg = ar2313_mdiobus_read(sp->mii_bus, sp->phy, MII_BMCR);
80 if (reg & BMCR_ANENABLE) {
81 /* auto neg enabled */
82 - reg = mdiobus_read(&sp->mii_bus, sp->phy, MII_LPA);
83 + reg = ar2313_mdiobus_read(sp->mii_bus, sp->phy, MII_LPA);
84 duplex = (reg & (LPA_100FULL | LPA_10FULL)) ? 1 : 0;
86 /* no auto neg, just read duplex config */
87 @@ -1320,7 +1327,7 @@ static void ar2313_adjust_link(struct ne
88 ((reg << MII_ADDR_REG_SHIFT) | (phy << MII_ADDR_PHY_SHIFT))
91 -mdiobus_read(struct mii_bus *bus, int phy_addr, int regnum)
92 +ar2313_mdiobus_read(struct mii_bus *bus, int phy_addr, int regnum)
94 struct net_device *const dev = bus->priv;
95 struct ar2313_private *sp = netdev_priv(dev);
96 @@ -1332,7 +1339,7 @@ mdiobus_read(struct mii_bus *bus, int ph
100 -mdiobus_write(struct mii_bus *bus, int phy_addr, int regnum,
101 +ar2313_mdiobus_write(struct mii_bus *bus, int phy_addr, int regnum,
104 struct net_device *const dev = bus->priv;
105 @@ -1346,7 +1353,7 @@ mdiobus_write(struct mii_bus *bus, int p
109 -static int mdiobus_reset(struct mii_bus *bus)
110 +static int ar2313_mdiobus_reset(struct mii_bus *bus)
112 struct net_device *const dev = bus->priv;
114 @@ -1355,7 +1362,7 @@ static int mdiobus_reset(struct mii_bus
118 -static int mdiobus_probe (struct net_device *dev)
119 +static int ar2313_mdiobus_probe (struct net_device *dev)
121 struct ar2313_private *const sp = netdev_priv(dev);
122 struct phy_device *phydev = NULL;
123 @@ -1363,8 +1370,8 @@ static int mdiobus_probe (struct net_dev
125 /* find the first (lowest address) PHY on the current MAC's MII bus */
126 for (phy_addr = 0; phy_addr < PHY_MAX_ADDR; phy_addr++)
127 - if (sp->mii_bus.phy_map[phy_addr]) {
128 - phydev = sp->mii_bus.phy_map[phy_addr];
129 + if (sp->mii_bus->phy_map[phy_addr]) {
130 + phydev = sp->mii_bus->phy_map[phy_addr];
131 break; /* break out with first one found */
134 --- a/drivers/net/ar2313/ar2313.h
135 +++ b/drivers/net/ar2313/ar2313.h
136 @@ -162,7 +162,7 @@ struct ar2313_private {
139 struct phy_device *phy_dev;
140 - struct mii_bus mii_bus;
141 + struct mii_bus *mii_bus;