atheros: fix mdio bus registration for multiple ethernet interfaces

SVN-Revision: 14984
This commit is contained in:
Felix Fietkau 2009-03-22 22:10:54 +00:00
parent fd11bfec64
commit 8d217b7162
2 changed files with 12 additions and 11 deletions

View File

@ -25,7 +25,7 @@
obj-$(CONFIG_DECLANCE) += declance.o
--- /dev/null
+++ b/drivers/net/ar231x.c
@@ -0,0 +1,1267 @@
@@ -0,0 +1,1268 @@
+/*
+ * ar231x.c: Linux driver for the Atheros AR231x Ethernet device.
+ *
@ -301,23 +301,24 @@
+ sp->mii_bus->write = ar231x_mdiobus_write;
+ sp->mii_bus->reset = ar231x_mdiobus_reset;
+ sp->mii_bus->name = "ar231x_eth_mii";
+ snprintf(sp->mii_bus->id, MII_BUS_ID_SIZE, "0");
+ snprintf(sp->mii_bus->id, MII_BUS_ID_SIZE, "%d", pdev->id);
+ sp->mii_bus->irq = kmalloc(sizeof(int), GFP_KERNEL);
+ *sp->mii_bus->irq = PHY_POLL;
+
+ mdiobus_register(sp->mii_bus);
+
+ if (ar231x_mdiobus_probe(dev) != 0) {
+ printk(KERN_ERR "ar231x: mdiobus_probe failed");
+ printk(KERN_ERR "%s: mdiobus_probe failed\n", dev->name);
+ rx_tasklet_cleanup(dev);
+ ar231x_init_cleanup(dev);
+ unregister_netdev(dev);
+ kfree(dev);
+ } else {
+ /* start link poll timer */
+ ar231x_setup_timer(dev);
+ return -ENODEV;
+ }
+
+ /* start link poll timer */
+ ar231x_setup_timer(dev);
+
+ return 0;
+}
+

View File

@ -1,6 +1,6 @@
--- a/drivers/net/ar231x.c
+++ b/drivers/net/ar231x.c
@@ -735,6 +735,7 @@ static void ar231x_load_rx_ring(struct n
@@ -736,6 +736,7 @@ static void ar231x_load_rx_ring(struct n
for (i = 0; i < nr_bufs; i++) {
struct sk_buff *skb;
ar231x_descr_t *rd;
@ -8,7 +8,7 @@
if (sp->rx_skb[idx])
break;
@@ -753,7 +754,9 @@ static void ar231x_load_rx_ring(struct n
@@ -754,7 +755,9 @@ static void ar231x_load_rx_ring(struct n
* Make sure IP header starts on a fresh cache line.
*/
skb->dev = dev;
@ -19,7 +19,7 @@
sp->rx_skb[idx] = skb;
rd = (ar231x_descr_t *) & sp->rx_ring[idx];
@@ -828,6 +831,7 @@ static int ar231x_rx_int(struct net_devi
@@ -829,6 +832,7 @@ static int ar231x_rx_int(struct net_devi
/* alloc new buffer. */
skb_new = dev_alloc_skb(AR2313_BUFSIZE + RX_OFFSET + 128);
if (skb_new != NULL) {
@ -27,7 +27,7 @@
skb = sp->rx_skb[idx];
/* set skb */
@@ -835,13 +839,17 @@ static int ar231x_rx_int(struct net_devi
@@ -836,13 +840,17 @@ static int ar231x_rx_int(struct net_devi
((status >> DMA_RX_LEN_SHIFT) & 0x3fff) - CRC_LEN);
dev->stats.rx_bytes += skb->len;
@ -48,7 +48,7 @@
/* reset descriptor's curr_addr */
rxdesc->addr = virt_to_phys(skb_new->data);
@@ -1243,6 +1251,8 @@ static int ar231x_mdiobus_probe (struct
@@ -1244,6 +1252,8 @@ static int ar231x_mdiobus_probe (struct
return PTR_ERR(phydev);
}