aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/au1000_eth.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/au1000_eth.c')
-rw-r--r--drivers/net/au1000_eth.c262
1 files changed, 130 insertions, 132 deletions
diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c
index 4da191b87b0..ece6128bef1 100644
--- a/drivers/net/au1000_eth.c
+++ b/drivers/net/au1000_eth.c
@@ -75,14 +75,19 @@ static int au1000_debug = 5;
75static int au1000_debug = 3; 75static int au1000_debug = 3;
76#endif 76#endif
77 77
78#define AU1000_DEF_MSG_ENABLE (NETIF_MSG_DRV | \
79 NETIF_MSG_PROBE | \
80 NETIF_MSG_LINK)
81
78#define DRV_NAME "au1000_eth" 82#define DRV_NAME "au1000_eth"
79#define DRV_VERSION "1.6" 83#define DRV_VERSION "1.7"
80#define DRV_AUTHOR "Pete Popov <ppopov@embeddedalley.com>" 84#define DRV_AUTHOR "Pete Popov <ppopov@embeddedalley.com>"
81#define DRV_DESC "Au1xxx on-chip Ethernet driver" 85#define DRV_DESC "Au1xxx on-chip Ethernet driver"
82 86
83MODULE_AUTHOR(DRV_AUTHOR); 87MODULE_AUTHOR(DRV_AUTHOR);
84MODULE_DESCRIPTION(DRV_DESC); 88MODULE_DESCRIPTION(DRV_DESC);
85MODULE_LICENSE("GPL"); 89MODULE_LICENSE("GPL");
90MODULE_VERSION(DRV_VERSION);
86 91
87/* 92/*
88 * Theory of operation 93 * Theory of operation
@@ -148,7 +153,7 @@ struct au1000_private *au_macs[NUM_ETH_INTERFACES];
148 * specific irq-map 153 * specific irq-map
149 */ 154 */
150 155
151static void enable_mac(struct net_device *dev, int force_reset) 156static void au1000_enable_mac(struct net_device *dev, int force_reset)
152{ 157{
153 unsigned long flags; 158 unsigned long flags;
154 struct au1000_private *aup = netdev_priv(dev); 159 struct au1000_private *aup = netdev_priv(dev);
@@ -182,8 +187,7 @@ static int au1000_mdio_read(struct net_device *dev, int phy_addr, int reg)
182 while (*mii_control_reg & MAC_MII_BUSY) { 187 while (*mii_control_reg & MAC_MII_BUSY) {
183 mdelay(1); 188 mdelay(1);
184 if (--timedout == 0) { 189 if (--timedout == 0) {
185 printk(KERN_ERR "%s: read_MII busy timeout!!\n", 190 netdev_err(dev, "read_MII busy timeout!!\n");
186 dev->name);
187 return -1; 191 return -1;
188 } 192 }
189 } 193 }
@@ -197,8 +201,7 @@ static int au1000_mdio_read(struct net_device *dev, int phy_addr, int reg)
197 while (*mii_control_reg & MAC_MII_BUSY) { 201 while (*mii_control_reg & MAC_MII_BUSY) {
198 mdelay(1); 202 mdelay(1);
199 if (--timedout == 0) { 203 if (--timedout == 0) {
200 printk(KERN_ERR "%s: mdio_read busy timeout!!\n", 204 netdev_err(dev, "mdio_read busy timeout!!\n");
201 dev->name);
202 return -1; 205 return -1;
203 } 206 }
204 } 207 }
@@ -217,8 +220,7 @@ static void au1000_mdio_write(struct net_device *dev, int phy_addr,
217 while (*mii_control_reg & MAC_MII_BUSY) { 220 while (*mii_control_reg & MAC_MII_BUSY) {
218 mdelay(1); 221 mdelay(1);
219 if (--timedout == 0) { 222 if (--timedout == 0) {
220 printk(KERN_ERR "%s: mdio_write busy timeout!!\n", 223 netdev_err(dev, "mdio_write busy timeout!!\n");
221 dev->name);
222 return; 224 return;
223 } 225 }
224 } 226 }
@@ -236,7 +238,7 @@ static int au1000_mdiobus_read(struct mii_bus *bus, int phy_addr, int regnum)
236 * _NOT_ hold (e.g. when PHY is accessed through other MAC's MII bus) */ 238 * _NOT_ hold (e.g. when PHY is accessed through other MAC's MII bus) */
237 struct net_device *const dev = bus->priv; 239 struct net_device *const dev = bus->priv;
238 240
239 enable_mac(dev, 0); /* make sure the MAC associated with this 241 au1000_enable_mac(dev, 0); /* make sure the MAC associated with this
240 * mii_bus is enabled */ 242 * mii_bus is enabled */
241 return au1000_mdio_read(dev, phy_addr, regnum); 243 return au1000_mdio_read(dev, phy_addr, regnum);
242} 244}
@@ -246,7 +248,7 @@ static int au1000_mdiobus_write(struct mii_bus *bus, int phy_addr, int regnum,
246{ 248{
247 struct net_device *const dev = bus->priv; 249 struct net_device *const dev = bus->priv;
248 250
249 enable_mac(dev, 0); /* make sure the MAC associated with this 251 au1000_enable_mac(dev, 0); /* make sure the MAC associated with this
250 * mii_bus is enabled */ 252 * mii_bus is enabled */
251 au1000_mdio_write(dev, phy_addr, regnum, value); 253 au1000_mdio_write(dev, phy_addr, regnum, value);
252 return 0; 254 return 0;
@@ -256,28 +258,26 @@ static int au1000_mdiobus_reset(struct mii_bus *bus)
256{ 258{
257 struct net_device *const dev = bus->priv; 259 struct net_device *const dev = bus->priv;
258 260
259 enable_mac(dev, 0); /* make sure the MAC associated with this 261 au1000_enable_mac(dev, 0); /* make sure the MAC associated with this
260 * mii_bus is enabled */ 262 * mii_bus is enabled */
261 return 0; 263 return 0;
262} 264}
263 265
264static void hard_stop(struct net_device *dev) 266static void au1000_hard_stop(struct net_device *dev)
265{ 267{
266 struct au1000_private *aup = netdev_priv(dev); 268 struct au1000_private *aup = netdev_priv(dev);
267 269
268 if (au1000_debug > 4) 270 netif_dbg(aup, drv, dev, "hard stop\n");
269 printk(KERN_INFO "%s: hard stop\n", dev->name);
270 271
271 aup->mac->control &= ~(MAC_RX_ENABLE | MAC_TX_ENABLE); 272 aup->mac->control &= ~(MAC_RX_ENABLE | MAC_TX_ENABLE);
272 au_sync_delay(10); 273 au_sync_delay(10);
273} 274}
274 275
275static void enable_rx_tx(struct net_device *dev) 276static void au1000_enable_rx_tx(struct net_device *dev)
276{ 277{
277 struct au1000_private *aup = netdev_priv(dev); 278 struct au1000_private *aup = netdev_priv(dev);
278 279
279 if (au1000_debug > 4) 280 netif_dbg(aup, hw, dev, "enable_rx_tx\n");
280 printk(KERN_INFO "%s: enable_rx_tx\n", dev->name);
281 281
282 aup->mac->control |= (MAC_RX_ENABLE | MAC_TX_ENABLE); 282 aup->mac->control |= (MAC_RX_ENABLE | MAC_TX_ENABLE);
283 au_sync_delay(10); 283 au_sync_delay(10);
@@ -297,16 +297,15 @@ au1000_adjust_link(struct net_device *dev)
297 spin_lock_irqsave(&aup->lock, flags); 297 spin_lock_irqsave(&aup->lock, flags);
298 298
299 if (phydev->link && (aup->old_speed != phydev->speed)) { 299 if (phydev->link && (aup->old_speed != phydev->speed)) {
300 // speed changed 300 /* speed changed */
301 301
302 switch(phydev->speed) { 302 switch (phydev->speed) {
303 case SPEED_10: 303 case SPEED_10:
304 case SPEED_100: 304 case SPEED_100:
305 break; 305 break;
306 default: 306 default:
307 printk(KERN_WARNING 307 netdev_warn(dev, "Speed (%d) is not 10/100 ???\n",
308 "%s: Speed (%d) is not 10/100 ???\n", 308 phydev->speed);
309 dev->name, phydev->speed);
310 break; 309 break;
311 } 310 }
312 311
@@ -316,10 +315,10 @@ au1000_adjust_link(struct net_device *dev)
316 } 315 }
317 316
318 if (phydev->link && (aup->old_duplex != phydev->duplex)) { 317 if (phydev->link && (aup->old_duplex != phydev->duplex)) {
319 // duplex mode changed 318 /* duplex mode changed */
320 319
321 /* switching duplex mode requires to disable rx and tx! */ 320 /* switching duplex mode requires to disable rx and tx! */
322 hard_stop(dev); 321 au1000_hard_stop(dev);
323 322
324 if (DUPLEX_FULL == phydev->duplex) 323 if (DUPLEX_FULL == phydev->duplex)
325 aup->mac->control = ((aup->mac->control 324 aup->mac->control = ((aup->mac->control
@@ -331,14 +330,14 @@ au1000_adjust_link(struct net_device *dev)
331 | MAC_DISABLE_RX_OWN); 330 | MAC_DISABLE_RX_OWN);
332 au_sync_delay(1); 331 au_sync_delay(1);
333 332
334 enable_rx_tx(dev); 333 au1000_enable_rx_tx(dev);
335 aup->old_duplex = phydev->duplex; 334 aup->old_duplex = phydev->duplex;
336 335
337 status_change = 1; 336 status_change = 1;
338 } 337 }
339 338
340 if(phydev->link != aup->old_link) { 339 if (phydev->link != aup->old_link) {
341 // link state changed 340 /* link state changed */
342 341
343 if (!phydev->link) { 342 if (!phydev->link) {
344 /* link went down */ 343 /* link went down */
@@ -354,15 +353,15 @@ au1000_adjust_link(struct net_device *dev)
354 353
355 if (status_change) { 354 if (status_change) {
356 if (phydev->link) 355 if (phydev->link)
357 printk(KERN_INFO "%s: link up (%d/%s)\n", 356 netdev_info(dev, "link up (%d/%s)\n",
358 dev->name, phydev->speed, 357 phydev->speed,
359 DUPLEX_FULL == phydev->duplex ? "Full" : "Half"); 358 DUPLEX_FULL == phydev->duplex ? "Full" : "Half");
360 else 359 else
361 printk(KERN_INFO "%s: link down\n", dev->name); 360 netdev_info(dev, "link down\n");
362 } 361 }
363} 362}
364 363
365static int mii_probe (struct net_device *dev) 364static int au1000_mii_probe (struct net_device *dev)
366{ 365{
367 struct au1000_private *const aup = netdev_priv(dev); 366 struct au1000_private *const aup = netdev_priv(dev);
368 struct phy_device *phydev = NULL; 367 struct phy_device *phydev = NULL;
@@ -373,8 +372,7 @@ static int mii_probe (struct net_device *dev)
373 if (aup->phy_addr) 372 if (aup->phy_addr)
374 phydev = aup->mii_bus->phy_map[aup->phy_addr]; 373 phydev = aup->mii_bus->phy_map[aup->phy_addr];
375 else 374 else
376 printk (KERN_INFO DRV_NAME ":%s: using PHY-less setup\n", 375 netdev_info(dev, "using PHY-less setup\n");
377 dev->name);
378 return 0; 376 return 0;
379 } else { 377 } else {
380 int phy_addr; 378 int phy_addr;
@@ -391,7 +389,7 @@ static int mii_probe (struct net_device *dev)
391 /* try harder to find a PHY */ 389 /* try harder to find a PHY */
392 if (!phydev && (aup->mac_id == 1)) { 390 if (!phydev && (aup->mac_id == 1)) {
393 /* no PHY found, maybe we have a dual PHY? */ 391 /* no PHY found, maybe we have a dual PHY? */
394 printk (KERN_INFO DRV_NAME ": no PHY found on MAC1, " 392 dev_info(&dev->dev, ": no PHY found on MAC1, "
395 "let's see if it's attached to MAC0...\n"); 393 "let's see if it's attached to MAC0...\n");
396 394
397 /* find the first (lowest address) non-attached PHY on 395 /* find the first (lowest address) non-attached PHY on
@@ -417,7 +415,7 @@ static int mii_probe (struct net_device *dev)
417 } 415 }
418 416
419 if (!phydev) { 417 if (!phydev) {
420 printk (KERN_ERR DRV_NAME ":%s: no PHY found\n", dev->name); 418 netdev_err(dev, "no PHY found\n");
421 return -1; 419 return -1;
422 } 420 }
423 421
@@ -428,7 +426,7 @@ static int mii_probe (struct net_device *dev)
428 0, PHY_INTERFACE_MODE_MII); 426 0, PHY_INTERFACE_MODE_MII);
429 427
430 if (IS_ERR(phydev)) { 428 if (IS_ERR(phydev)) {
431 printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name); 429 netdev_err(dev, "Could not attach to PHY\n");
432 return PTR_ERR(phydev); 430 return PTR_ERR(phydev);
433 } 431 }
434 432
@@ -449,8 +447,8 @@ static int mii_probe (struct net_device *dev)
449 aup->old_duplex = -1; 447 aup->old_duplex = -1;
450 aup->phy_dev = phydev; 448 aup->phy_dev = phydev;
451 449
452 printk(KERN_INFO "%s: attached PHY driver [%s] " 450 netdev_info(dev, "attached PHY driver [%s] "
453 "(mii_bus:phy_addr=%s, irq=%d)\n", dev->name, 451 "(mii_bus:phy_addr=%s, irq=%d)\n",
454 phydev->drv->name, dev_name(&phydev->dev), phydev->irq); 452 phydev->drv->name, dev_name(&phydev->dev), phydev->irq);
455 453
456 return 0; 454 return 0;
@@ -462,7 +460,7 @@ static int mii_probe (struct net_device *dev)
462 * has the virtual and dma address of a buffer suitable for 460 * has the virtual and dma address of a buffer suitable for
463 * both, receive and transmit operations. 461 * both, receive and transmit operations.
464 */ 462 */
465static db_dest_t *GetFreeDB(struct au1000_private *aup) 463static db_dest_t *au1000_GetFreeDB(struct au1000_private *aup)
466{ 464{
467 db_dest_t *pDB; 465 db_dest_t *pDB;
468 pDB = aup->pDBfree; 466 pDB = aup->pDBfree;
@@ -473,7 +471,7 @@ static db_dest_t *GetFreeDB(struct au1000_private *aup)
473 return pDB; 471 return pDB;
474} 472}
475 473
476void ReleaseDB(struct au1000_private *aup, db_dest_t *pDB) 474void au1000_ReleaseDB(struct au1000_private *aup, db_dest_t *pDB)
477{ 475{
478 db_dest_t *pDBfree = aup->pDBfree; 476 db_dest_t *pDBfree = aup->pDBfree;
479 if (pDBfree) 477 if (pDBfree)
@@ -481,12 +479,12 @@ void ReleaseDB(struct au1000_private *aup, db_dest_t *pDB)
481 aup->pDBfree = pDB; 479 aup->pDBfree = pDB;
482} 480}
483 481
484static void reset_mac_unlocked(struct net_device *dev) 482static void au1000_reset_mac_unlocked(struct net_device *dev)
485{ 483{
486 struct au1000_private *const aup = netdev_priv(dev); 484 struct au1000_private *const aup = netdev_priv(dev);
487 int i; 485 int i;
488 486
489 hard_stop(dev); 487 au1000_hard_stop(dev);
490 488
491 *aup->enable = MAC_EN_CLOCK_ENABLE; 489 *aup->enable = MAC_EN_CLOCK_ENABLE;
492 au_sync_delay(2); 490 au_sync_delay(2);
@@ -507,18 +505,17 @@ static void reset_mac_unlocked(struct net_device *dev)
507 505
508} 506}
509 507
510static void reset_mac(struct net_device *dev) 508static void au1000_reset_mac(struct net_device *dev)
511{ 509{
512 struct au1000_private *const aup = netdev_priv(dev); 510 struct au1000_private *const aup = netdev_priv(dev);
513 unsigned long flags; 511 unsigned long flags;
514 512
515 if (au1000_debug > 4) 513 netif_dbg(aup, hw, dev, "reset mac, aup %x\n",
516 printk(KERN_INFO "%s: reset mac, aup %x\n", 514 (unsigned)aup);
517 dev->name, (unsigned)aup);
518 515
519 spin_lock_irqsave(&aup->lock, flags); 516 spin_lock_irqsave(&aup->lock, flags);
520 517
521 reset_mac_unlocked (dev); 518 au1000_reset_mac_unlocked (dev);
522 519
523 spin_unlock_irqrestore(&aup->lock, flags); 520 spin_unlock_irqrestore(&aup->lock, flags);
524} 521}
@@ -529,7 +526,7 @@ static void reset_mac(struct net_device *dev)
529 * these are not descriptors sitting in memory. 526 * these are not descriptors sitting in memory.
530 */ 527 */
531static void 528static void
532setup_hw_rings(struct au1000_private *aup, u32 rx_base, u32 tx_base) 529au1000_setup_hw_rings(struct au1000_private *aup, u32 rx_base, u32 tx_base)
533{ 530{
534 int i; 531 int i;
535 532
@@ -582,11 +579,25 @@ au1000_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
582 info->regdump_len = 0; 579 info->regdump_len = 0;
583} 580}
584 581
582static void au1000_set_msglevel(struct net_device *dev, u32 value)
583{
584 struct au1000_private *aup = netdev_priv(dev);
585 aup->msg_enable = value;
586}
587
588static u32 au1000_get_msglevel(struct net_device *dev)
589{
590 struct au1000_private *aup = netdev_priv(dev);
591 return aup->msg_enable;
592}
593
585static const struct ethtool_ops au1000_ethtool_ops = { 594static const struct ethtool_ops au1000_ethtool_ops = {
586 .get_settings = au1000_get_settings, 595 .get_settings = au1000_get_settings,
587 .set_settings = au1000_set_settings, 596 .set_settings = au1000_set_settings,
588 .get_drvinfo = au1000_get_drvinfo, 597 .get_drvinfo = au1000_get_drvinfo,
589 .get_link = ethtool_op_get_link, 598 .get_link = ethtool_op_get_link,
599 .get_msglevel = au1000_get_msglevel,
600 .set_msglevel = au1000_set_msglevel,
590}; 601};
591 602
592 603
@@ -606,11 +617,10 @@ static int au1000_init(struct net_device *dev)
606 int i; 617 int i;
607 u32 control; 618 u32 control;
608 619
609 if (au1000_debug > 4) 620 netif_dbg(aup, hw, dev, "au1000_init\n");
610 printk("%s: au1000_init\n", dev->name);
611 621
612 /* bring the device out of reset */ 622 /* bring the device out of reset */
613 enable_mac(dev, 1); 623 au1000_enable_mac(dev, 1);
614 624
615 spin_lock_irqsave(&aup->lock, flags); 625 spin_lock_irqsave(&aup->lock, flags);
616 626
@@ -649,7 +659,7 @@ static int au1000_init(struct net_device *dev)
649 return 0; 659 return 0;
650} 660}
651 661
652static inline void update_rx_stats(struct net_device *dev, u32 status) 662static inline void au1000_update_rx_stats(struct net_device *dev, u32 status)
653{ 663{
654 struct net_device_stats *ps = &dev->stats; 664 struct net_device_stats *ps = &dev->stats;
655 665
@@ -667,8 +677,7 @@ static inline void update_rx_stats(struct net_device *dev, u32 status)
667 ps->rx_crc_errors++; 677 ps->rx_crc_errors++;
668 if (status & RX_COLL) 678 if (status & RX_COLL)
669 ps->collisions++; 679 ps->collisions++;
670 } 680 } else
671 else
672 ps->rx_bytes += status & RX_FRAME_LEN_MASK; 681 ps->rx_bytes += status & RX_FRAME_LEN_MASK;
673 682
674} 683}
@@ -685,15 +694,14 @@ static int au1000_rx(struct net_device *dev)
685 db_dest_t *pDB; 694 db_dest_t *pDB;
686 u32 frmlen; 695 u32 frmlen;
687 696
688 if (au1000_debug > 5) 697 netif_dbg(aup, rx_status, dev, "au1000_rx head %d\n", aup->rx_head);
689 printk("%s: au1000_rx head %d\n", dev->name, aup->rx_head);
690 698
691 prxd = aup->rx_dma_ring[aup->rx_head]; 699 prxd = aup->rx_dma_ring[aup->rx_head];
692 buff_stat = prxd->buff_stat; 700 buff_stat = prxd->buff_stat;
693 while (buff_stat & RX_T_DONE) { 701 while (buff_stat & RX_T_DONE) {
694 status = prxd->status; 702 status = prxd->status;
695 pDB = aup->rx_db_inuse[aup->rx_head]; 703 pDB = aup->rx_db_inuse[aup->rx_head];
696 update_rx_stats(dev, status); 704 au1000_update_rx_stats(dev, status);
697 if (!(status & RX_ERROR)) { 705 if (!(status & RX_ERROR)) {
698 706
699 /* good frame */ 707 /* good frame */
@@ -701,9 +709,7 @@ static int au1000_rx(struct net_device *dev)
701 frmlen -= 4; /* Remove FCS */ 709 frmlen -= 4; /* Remove FCS */
702 skb = dev_alloc_skb(frmlen + 2); 710 skb = dev_alloc_skb(frmlen + 2);
703 if (skb == NULL) { 711 if (skb == NULL) {
704 printk(KERN_ERR 712 netdev_err(dev, "Memory squeeze, dropping packet.\n");
705 "%s: Memory squeeze, dropping packet.\n",
706 dev->name);
707 dev->stats.rx_dropped++; 713 dev->stats.rx_dropped++;
708 continue; 714 continue;
709 } 715 }
@@ -713,8 +719,7 @@ static int au1000_rx(struct net_device *dev)
713 skb_put(skb, frmlen); 719 skb_put(skb, frmlen);
714 skb->protocol = eth_type_trans(skb, dev); 720 skb->protocol = eth_type_trans(skb, dev);
715 netif_rx(skb); /* pass the packet to upper layers */ 721 netif_rx(skb); /* pass the packet to upper layers */
716 } 722 } else {
717 else {
718 if (au1000_debug > 4) { 723 if (au1000_debug > 4) {
719 if (status & RX_MISSED_FRAME) 724 if (status & RX_MISSED_FRAME)
720 printk("rx miss\n"); 725 printk("rx miss\n");
@@ -747,7 +752,7 @@ static int au1000_rx(struct net_device *dev)
747 return 0; 752 return 0;
748} 753}
749 754
750static void update_tx_stats(struct net_device *dev, u32 status) 755static void au1000_update_tx_stats(struct net_device *dev, u32 status)
751{ 756{
752 struct au1000_private *aup = netdev_priv(dev); 757 struct au1000_private *aup = netdev_priv(dev);
753 struct net_device_stats *ps = &dev->stats; 758 struct net_device_stats *ps = &dev->stats;
@@ -760,8 +765,7 @@ static void update_tx_stats(struct net_device *dev, u32 status)
760 ps->tx_errors++; 765 ps->tx_errors++;
761 ps->tx_aborted_errors++; 766 ps->tx_aborted_errors++;
762 } 767 }
763 } 768 } else {
764 else {
765 ps->tx_errors++; 769 ps->tx_errors++;
766 ps->tx_aborted_errors++; 770 ps->tx_aborted_errors++;
767 if (status & (TX_NO_CARRIER | TX_LOSS_CARRIER)) 771 if (status & (TX_NO_CARRIER | TX_LOSS_CARRIER))
@@ -783,7 +787,7 @@ static void au1000_tx_ack(struct net_device *dev)
783 ptxd = aup->tx_dma_ring[aup->tx_tail]; 787 ptxd = aup->tx_dma_ring[aup->tx_tail];
784 788
785 while (ptxd->buff_stat & TX_T_DONE) { 789 while (ptxd->buff_stat & TX_T_DONE) {
786 update_tx_stats(dev, ptxd->status); 790 au1000_update_tx_stats(dev, ptxd->status);
787 ptxd->buff_stat &= ~TX_T_DONE; 791 ptxd->buff_stat &= ~TX_T_DONE;
788 ptxd->len = 0; 792 ptxd->len = 0;
789 au_sync(); 793 au_sync();
@@ -817,18 +821,18 @@ static int au1000_open(struct net_device *dev)
817 int retval; 821 int retval;
818 struct au1000_private *aup = netdev_priv(dev); 822 struct au1000_private *aup = netdev_priv(dev);
819 823
820 if (au1000_debug > 4) 824 netif_dbg(aup, drv, dev, "open: dev=%p\n", dev);
821 printk("%s: open: dev=%p\n", dev->name, dev);
822 825
823 if ((retval = request_irq(dev->irq, au1000_interrupt, 0, 826 retval = request_irq(dev->irq, au1000_interrupt, 0,
824 dev->name, dev))) { 827 dev->name, dev);
825 printk(KERN_ERR "%s: unable to get IRQ %d\n", 828 if (retval) {
826 dev->name, dev->irq); 829 netdev_err(dev, "unable to get IRQ %d\n", dev->irq);
827 return retval; 830 return retval;
828 } 831 }
829 832
830 if ((retval = au1000_init(dev))) { 833 retval = au1000_init(dev);
831 printk(KERN_ERR "%s: error in au1000_init\n", dev->name); 834 if (retval) {
835 netdev_err(dev, "error in au1000_init\n");
832 free_irq(dev->irq, dev); 836 free_irq(dev->irq, dev);
833 return retval; 837 return retval;
834 } 838 }
@@ -841,8 +845,7 @@ static int au1000_open(struct net_device *dev)
841 845
842 netif_start_queue(dev); 846 netif_start_queue(dev);
843 847
844 if (au1000_debug > 4) 848 netif_dbg(aup, drv, dev, "open: Initialization done.\n");
845 printk("%s: open: Initialization done.\n", dev->name);
846 849
847 return 0; 850 return 0;
848} 851}
@@ -852,15 +855,14 @@ static int au1000_close(struct net_device *dev)
852 unsigned long flags; 855 unsigned long flags;
853 struct au1000_private *const aup = netdev_priv(dev); 856 struct au1000_private *const aup = netdev_priv(dev);
854 857
855 if (au1000_debug > 4) 858 netif_dbg(aup, drv, dev, "close: dev=%p\n", dev);
856 printk("%s: close: dev=%p\n", dev->name, dev);
857 859
858 if (aup->phy_dev) 860 if (aup->phy_dev)
859 phy_stop(aup->phy_dev); 861 phy_stop(aup->phy_dev);
860 862
861 spin_lock_irqsave(&aup->lock, flags); 863 spin_lock_irqsave(&aup->lock, flags);
862 864
863 reset_mac_unlocked (dev); 865 au1000_reset_mac_unlocked (dev);
864 866
865 /* stop the device */ 867 /* stop the device */
866 netif_stop_queue(dev); 868 netif_stop_queue(dev);
@@ -884,9 +886,8 @@ static netdev_tx_t au1000_tx(struct sk_buff *skb, struct net_device *dev)
884 db_dest_t *pDB; 886 db_dest_t *pDB;
885 int i; 887 int i;
886 888
887 if (au1000_debug > 5) 889 netif_dbg(aup, tx_queued, dev, "tx: aup %x len=%d, data=%p, head %d\n",
888 printk("%s: tx: aup %x len=%d, data=%p, head %d\n", 890 (unsigned)aup, skb->len,
889 dev->name, (unsigned)aup, skb->len,
890 skb->data, aup->tx_head); 891 skb->data, aup->tx_head);
891 892
892 ptxd = aup->tx_dma_ring[aup->tx_head]; 893 ptxd = aup->tx_dma_ring[aup->tx_head];
@@ -896,9 +897,8 @@ static netdev_tx_t au1000_tx(struct sk_buff *skb, struct net_device *dev)
896 netif_stop_queue(dev); 897 netif_stop_queue(dev);
897 aup->tx_full = 1; 898 aup->tx_full = 1;
898 return NETDEV_TX_BUSY; 899 return NETDEV_TX_BUSY;
899 } 900 } else if (buff_stat & TX_T_DONE) {
900 else if (buff_stat & TX_T_DONE) { 901 au1000_update_tx_stats(dev, ptxd->status);
901 update_tx_stats(dev, ptxd->status);
902 ptxd->len = 0; 902 ptxd->len = 0;
903 } 903 }
904 904
@@ -910,12 +910,11 @@ static netdev_tx_t au1000_tx(struct sk_buff *skb, struct net_device *dev)
910 pDB = aup->tx_db_inuse[aup->tx_head]; 910 pDB = aup->tx_db_inuse[aup->tx_head];
911 skb_copy_from_linear_data(skb, (void *)pDB->vaddr, skb->len); 911 skb_copy_from_linear_data(skb, (void *)pDB->vaddr, skb->len);
912 if (skb->len < ETH_ZLEN) { 912 if (skb->len < ETH_ZLEN) {
913 for (i=skb->len; i<ETH_ZLEN; i++) { 913 for (i = skb->len; i < ETH_ZLEN; i++) {
914 ((char *)pDB->vaddr)[i] = 0; 914 ((char *)pDB->vaddr)[i] = 0;
915 } 915 }
916 ptxd->len = ETH_ZLEN; 916 ptxd->len = ETH_ZLEN;
917 } 917 } else
918 else
919 ptxd->len = skb->len; 918 ptxd->len = skb->len;
920 919
921 ps->tx_packets++; 920 ps->tx_packets++;
@@ -925,7 +924,6 @@ static netdev_tx_t au1000_tx(struct sk_buff *skb, struct net_device *dev)
925 au_sync(); 924 au_sync();
926 dev_kfree_skb(skb); 925 dev_kfree_skb(skb);
927 aup->tx_head = (aup->tx_head + 1) & (NUM_TX_DMA - 1); 926 aup->tx_head = (aup->tx_head + 1) & (NUM_TX_DMA - 1);
928 dev->trans_start = jiffies;
929 return NETDEV_TX_OK; 927 return NETDEV_TX_OK;
930} 928}
931 929
@@ -935,10 +933,10 @@ static netdev_tx_t au1000_tx(struct sk_buff *skb, struct net_device *dev)
935 */ 933 */
936static void au1000_tx_timeout(struct net_device *dev) 934static void au1000_tx_timeout(struct net_device *dev)
937{ 935{
938 printk(KERN_ERR "%s: au1000_tx_timeout: dev=%p\n", dev->name, dev); 936 netdev_err(dev, "au1000_tx_timeout: dev=%p\n", dev);
939 reset_mac(dev); 937 au1000_reset_mac(dev);
940 au1000_init(dev); 938 au1000_init(dev);
941 dev->trans_start = jiffies; 939 dev->trans_start = jiffies; /* prevent tx timeout */
942 netif_wake_queue(dev); 940 netif_wake_queue(dev);
943} 941}
944 942
@@ -946,8 +944,7 @@ static void au1000_multicast_list(struct net_device *dev)
946{ 944{
947 struct au1000_private *aup = netdev_priv(dev); 945 struct au1000_private *aup = netdev_priv(dev);
948 946
949 if (au1000_debug > 4) 947 netif_dbg(aup, drv, dev, "au1000_multicast_list: flags=%x\n", dev->flags);
950 printk("%s: au1000_multicast_list: flags=%x\n", dev->name, dev->flags);
951 948
952 if (dev->flags & IFF_PROMISC) { /* Set promiscuous. */ 949 if (dev->flags & IFF_PROMISC) { /* Set promiscuous. */
953 aup->mac->control |= MAC_PROMISCUOUS; 950 aup->mac->control |= MAC_PROMISCUOUS;
@@ -955,14 +952,14 @@ static void au1000_multicast_list(struct net_device *dev)
955 netdev_mc_count(dev) > MULTICAST_FILTER_LIMIT) { 952 netdev_mc_count(dev) > MULTICAST_FILTER_LIMIT) {
956 aup->mac->control |= MAC_PASS_ALL_MULTI; 953 aup->mac->control |= MAC_PASS_ALL_MULTI;
957 aup->mac->control &= ~MAC_PROMISCUOUS; 954 aup->mac->control &= ~MAC_PROMISCUOUS;
958 printk(KERN_INFO "%s: Pass all multicast\n", dev->name); 955 netdev_info(dev, "Pass all multicast\n");
959 } else { 956 } else {
960 struct dev_mc_list *mclist; 957 struct netdev_hw_addr *ha;
961 u32 mc_filter[2]; /* Multicast hash filter */ 958 u32 mc_filter[2]; /* Multicast hash filter */
962 959
963 mc_filter[1] = mc_filter[0] = 0; 960 mc_filter[1] = mc_filter[0] = 0;
964 netdev_for_each_mc_addr(mclist, dev) 961 netdev_for_each_mc_addr(ha, dev)
965 set_bit(ether_crc(ETH_ALEN, mclist->dmi_addr)>>26, 962 set_bit(ether_crc(ETH_ALEN, ha->addr)>>26,
966 (long *)mc_filter); 963 (long *)mc_filter);
967 aup->mac->multi_hash_high = mc_filter[1]; 964 aup->mac->multi_hash_high = mc_filter[1];
968 aup->mac->multi_hash_low = mc_filter[0]; 965 aup->mac->multi_hash_low = mc_filter[0];
@@ -975,9 +972,11 @@ static int au1000_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
975{ 972{
976 struct au1000_private *aup = netdev_priv(dev); 973 struct au1000_private *aup = netdev_priv(dev);
977 974
978 if (!netif_running(dev)) return -EINVAL; 975 if (!netif_running(dev))
976 return -EINVAL;
979 977
980 if (!aup->phy_dev) return -EINVAL; // PHY not controllable 978 if (!aup->phy_dev)
979 return -EINVAL; /* PHY not controllable */
981 980
982 return phy_mii_ioctl(aup->phy_dev, if_mii(rq), cmd); 981 return phy_mii_ioctl(aup->phy_dev, if_mii(rq), cmd);
983} 982}
@@ -996,7 +995,7 @@ static const struct net_device_ops au1000_netdev_ops = {
996 995
997static int __devinit au1000_probe(struct platform_device *pdev) 996static int __devinit au1000_probe(struct platform_device *pdev)
998{ 997{
999 static unsigned version_printed = 0; 998 static unsigned version_printed;
1000 struct au1000_private *aup = NULL; 999 struct au1000_private *aup = NULL;
1001 struct au1000_eth_platform_data *pd; 1000 struct au1000_eth_platform_data *pd;
1002 struct net_device *dev = NULL; 1001 struct net_device *dev = NULL;
@@ -1007,40 +1006,40 @@ static int __devinit au1000_probe(struct platform_device *pdev)
1007 1006
1008 base = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1007 base = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1009 if (!base) { 1008 if (!base) {
1010 printk(KERN_ERR DRV_NAME ": failed to retrieve base register\n"); 1009 dev_err(&pdev->dev, "failed to retrieve base register\n");
1011 err = -ENODEV; 1010 err = -ENODEV;
1012 goto out; 1011 goto out;
1013 } 1012 }
1014 1013
1015 macen = platform_get_resource(pdev, IORESOURCE_MEM, 1); 1014 macen = platform_get_resource(pdev, IORESOURCE_MEM, 1);
1016 if (!macen) { 1015 if (!macen) {
1017 printk(KERN_ERR DRV_NAME ": failed to retrieve MAC Enable register\n"); 1016 dev_err(&pdev->dev, "failed to retrieve MAC Enable register\n");
1018 err = -ENODEV; 1017 err = -ENODEV;
1019 goto out; 1018 goto out;
1020 } 1019 }
1021 1020
1022 irq = platform_get_irq(pdev, 0); 1021 irq = platform_get_irq(pdev, 0);
1023 if (irq < 0) { 1022 if (irq < 0) {
1024 printk(KERN_ERR DRV_NAME ": failed to retrieve IRQ\n"); 1023 dev_err(&pdev->dev, "failed to retrieve IRQ\n");
1025 err = -ENODEV; 1024 err = -ENODEV;
1026 goto out; 1025 goto out;
1027 } 1026 }
1028 1027
1029 if (!request_mem_region(base->start, resource_size(base), pdev->name)) { 1028 if (!request_mem_region(base->start, resource_size(base), pdev->name)) {
1030 printk(KERN_ERR DRV_NAME ": failed to request memory region for base registers\n"); 1029 dev_err(&pdev->dev, "failed to request memory region for base registers\n");
1031 err = -ENXIO; 1030 err = -ENXIO;
1032 goto out; 1031 goto out;
1033 } 1032 }
1034 1033
1035 if (!request_mem_region(macen->start, resource_size(macen), pdev->name)) { 1034 if (!request_mem_region(macen->start, resource_size(macen), pdev->name)) {
1036 printk(KERN_ERR DRV_NAME ": failed to request memory region for MAC enable register\n"); 1035 dev_err(&pdev->dev, "failed to request memory region for MAC enable register\n");
1037 err = -ENXIO; 1036 err = -ENXIO;
1038 goto err_request; 1037 goto err_request;
1039 } 1038 }
1040 1039
1041 dev = alloc_etherdev(sizeof(struct au1000_private)); 1040 dev = alloc_etherdev(sizeof(struct au1000_private));
1042 if (!dev) { 1041 if (!dev) {
1043 printk(KERN_ERR "%s: alloc_etherdev failed\n", DRV_NAME); 1042 dev_err(&pdev->dev, "alloc_etherdev failed\n");
1044 err = -ENOMEM; 1043 err = -ENOMEM;
1045 goto err_alloc; 1044 goto err_alloc;
1046 } 1045 }
@@ -1050,6 +1049,7 @@ static int __devinit au1000_probe(struct platform_device *pdev)
1050 aup = netdev_priv(dev); 1049 aup = netdev_priv(dev);
1051 1050
1052 spin_lock_init(&aup->lock); 1051 spin_lock_init(&aup->lock);
1052 aup->msg_enable = (au1000_debug < 4 ? AU1000_DEF_MSG_ENABLE : au1000_debug);
1053 1053
1054 /* Allocate the data buffers */ 1054 /* Allocate the data buffers */
1055 /* Snooping works fine with eth on all au1xxx */ 1055 /* Snooping works fine with eth on all au1xxx */
@@ -1057,7 +1057,7 @@ static int __devinit au1000_probe(struct platform_device *pdev)
1057 (NUM_TX_BUFFS + NUM_RX_BUFFS), 1057 (NUM_TX_BUFFS + NUM_RX_BUFFS),
1058 &aup->dma_addr, 0); 1058 &aup->dma_addr, 0);
1059 if (!aup->vaddr) { 1059 if (!aup->vaddr) {
1060 printk(KERN_ERR DRV_NAME ": failed to allocate data buffers\n"); 1060 dev_err(&pdev->dev, "failed to allocate data buffers\n");
1061 err = -ENOMEM; 1061 err = -ENOMEM;
1062 goto err_vaddr; 1062 goto err_vaddr;
1063 } 1063 }
@@ -1065,7 +1065,7 @@ static int __devinit au1000_probe(struct platform_device *pdev)
1065 /* aup->mac is the base address of the MAC's registers */ 1065 /* aup->mac is the base address of the MAC's registers */
1066 aup->mac = (volatile mac_reg_t *)ioremap_nocache(base->start, resource_size(base)); 1066 aup->mac = (volatile mac_reg_t *)ioremap_nocache(base->start, resource_size(base));
1067 if (!aup->mac) { 1067 if (!aup->mac) {
1068 printk(KERN_ERR DRV_NAME ": failed to ioremap MAC registers\n"); 1068 dev_err(&pdev->dev, "failed to ioremap MAC registers\n");
1069 err = -ENXIO; 1069 err = -ENXIO;
1070 goto err_remap1; 1070 goto err_remap1;
1071 } 1071 }
@@ -1073,7 +1073,7 @@ static int __devinit au1000_probe(struct platform_device *pdev)
1073 /* Setup some variables for quick register address access */ 1073 /* Setup some variables for quick register address access */
1074 aup->enable = (volatile u32 *)ioremap_nocache(macen->start, resource_size(macen)); 1074 aup->enable = (volatile u32 *)ioremap_nocache(macen->start, resource_size(macen));
1075 if (!aup->enable) { 1075 if (!aup->enable) {
1076 printk(KERN_ERR DRV_NAME ": failed to ioremap MAC enable register\n"); 1076 dev_err(&pdev->dev, "failed to ioremap MAC enable register\n");
1077 err = -ENXIO; 1077 err = -ENXIO;
1078 goto err_remap2; 1078 goto err_remap2;
1079 } 1079 }
@@ -1083,14 +1083,13 @@ static int __devinit au1000_probe(struct platform_device *pdev)
1083 if (prom_get_ethernet_addr(ethaddr) == 0) 1083 if (prom_get_ethernet_addr(ethaddr) == 0)
1084 memcpy(au1000_mac_addr, ethaddr, sizeof(au1000_mac_addr)); 1084 memcpy(au1000_mac_addr, ethaddr, sizeof(au1000_mac_addr));
1085 else { 1085 else {
1086 printk(KERN_INFO "%s: No MAC address found\n", 1086 netdev_info(dev, "No MAC address found\n");
1087 dev->name);
1088 /* Use the hard coded MAC addresses */ 1087 /* Use the hard coded MAC addresses */
1089 } 1088 }
1090 1089
1091 setup_hw_rings(aup, MAC0_RX_DMA_ADDR, MAC0_TX_DMA_ADDR); 1090 au1000_setup_hw_rings(aup, MAC0_RX_DMA_ADDR, MAC0_TX_DMA_ADDR);
1092 } else if (pdev->id == 1) 1091 } else if (pdev->id == 1)
1093 setup_hw_rings(aup, MAC1_RX_DMA_ADDR, MAC1_TX_DMA_ADDR); 1092 au1000_setup_hw_rings(aup, MAC1_RX_DMA_ADDR, MAC1_TX_DMA_ADDR);
1094 1093
1095 /* 1094 /*
1096 * Assign to the Ethernet ports two consecutive MAC addresses 1095 * Assign to the Ethernet ports two consecutive MAC addresses
@@ -1104,7 +1103,7 @@ static int __devinit au1000_probe(struct platform_device *pdev)
1104 1103
1105 pd = pdev->dev.platform_data; 1104 pd = pdev->dev.platform_data;
1106 if (!pd) { 1105 if (!pd) {
1107 printk(KERN_INFO DRV_NAME ": no platform_data passed, PHY search on MAC0\n"); 1106 dev_info(&pdev->dev, "no platform_data passed, PHY search on MAC0\n");
1108 aup->phy1_search_mac0 = 1; 1107 aup->phy1_search_mac0 = 1;
1109 } else { 1108 } else {
1110 aup->phy_static_config = pd->phy_static_config; 1109 aup->phy_static_config = pd->phy_static_config;
@@ -1116,7 +1115,7 @@ static int __devinit au1000_probe(struct platform_device *pdev)
1116 } 1115 }
1117 1116
1118 if (aup->phy_busid && aup->phy_busid > 0) { 1117 if (aup->phy_busid && aup->phy_busid > 0) {
1119 printk(KERN_ERR DRV_NAME ": MAC0-associated PHY attached 2nd MACs MII" 1118 dev_err(&pdev->dev, "MAC0-associated PHY attached 2nd MACs MII"
1120 "bus not supported yet\n"); 1119 "bus not supported yet\n");
1121 err = -ENODEV; 1120 err = -ENODEV;
1122 goto err_mdiobus_alloc; 1121 goto err_mdiobus_alloc;
@@ -1124,7 +1123,7 @@ static int __devinit au1000_probe(struct platform_device *pdev)
1124 1123
1125 aup->mii_bus = mdiobus_alloc(); 1124 aup->mii_bus = mdiobus_alloc();
1126 if (aup->mii_bus == NULL) { 1125 if (aup->mii_bus == NULL) {
1127 printk(KERN_ERR DRV_NAME ": failed to allocate mdiobus structure\n"); 1126 dev_err(&pdev->dev, "failed to allocate mdiobus structure\n");
1128 err = -ENOMEM; 1127 err = -ENOMEM;
1129 goto err_mdiobus_alloc; 1128 goto err_mdiobus_alloc;
1130 } 1129 }
@@ -1139,7 +1138,7 @@ static int __devinit au1000_probe(struct platform_device *pdev)
1139 if (aup->mii_bus->irq == NULL) 1138 if (aup->mii_bus->irq == NULL)
1140 goto err_out; 1139 goto err_out;
1141 1140
1142 for(i = 0; i < PHY_MAX_ADDR; ++i) 1141 for (i = 0; i < PHY_MAX_ADDR; ++i)
1143 aup->mii_bus->irq[i] = PHY_POLL; 1142 aup->mii_bus->irq[i] = PHY_POLL;
1144 /* if known, set corresponding PHY IRQs */ 1143 /* if known, set corresponding PHY IRQs */
1145 if (aup->phy_static_config) 1144 if (aup->phy_static_config)
@@ -1148,11 +1147,11 @@ static int __devinit au1000_probe(struct platform_device *pdev)
1148 1147
1149 err = mdiobus_register(aup->mii_bus); 1148 err = mdiobus_register(aup->mii_bus);
1150 if (err) { 1149 if (err) {
1151 printk(KERN_ERR DRV_NAME " failed to register MDIO bus\n"); 1150 dev_err(&pdev->dev, "failed to register MDIO bus\n");
1152 goto err_mdiobus_reg; 1151 goto err_mdiobus_reg;
1153 } 1152 }
1154 1153
1155 if (mii_probe(dev) != 0) 1154 if (au1000_mii_probe(dev) != 0)
1156 goto err_out; 1155 goto err_out;
1157 1156
1158 pDBfree = NULL; 1157 pDBfree = NULL;
@@ -1168,7 +1167,7 @@ static int __devinit au1000_probe(struct platform_device *pdev)
1168 aup->pDBfree = pDBfree; 1167 aup->pDBfree = pDBfree;
1169 1168
1170 for (i = 0; i < NUM_RX_DMA; i++) { 1169 for (i = 0; i < NUM_RX_DMA; i++) {
1171 pDB = GetFreeDB(aup); 1170 pDB = au1000_GetFreeDB(aup);
1172 if (!pDB) { 1171 if (!pDB) {
1173 goto err_out; 1172 goto err_out;
1174 } 1173 }
@@ -1176,7 +1175,7 @@ static int __devinit au1000_probe(struct platform_device *pdev)
1176 aup->rx_db_inuse[i] = pDB; 1175 aup->rx_db_inuse[i] = pDB;
1177 } 1176 }
1178 for (i = 0; i < NUM_TX_DMA; i++) { 1177 for (i = 0; i < NUM_TX_DMA; i++) {
1179 pDB = GetFreeDB(aup); 1178 pDB = au1000_GetFreeDB(aup);
1180 if (!pDB) { 1179 if (!pDB) {
1181 goto err_out; 1180 goto err_out;
1182 } 1181 }
@@ -1195,17 +1194,16 @@ static int __devinit au1000_probe(struct platform_device *pdev)
1195 * The boot code uses the ethernet controller, so reset it to start 1194 * The boot code uses the ethernet controller, so reset it to start
1196 * fresh. au1000_init() expects that the device is in reset state. 1195 * fresh. au1000_init() expects that the device is in reset state.
1197 */ 1196 */
1198 reset_mac(dev); 1197 au1000_reset_mac(dev);
1199 1198
1200 err = register_netdev(dev); 1199 err = register_netdev(dev);
1201 if (err) { 1200 if (err) {
1202 printk(KERN_ERR DRV_NAME "%s: Cannot register net device, aborting.\n", 1201 netdev_err(dev, "Cannot register net device, aborting.\n");
1203 dev->name);
1204 goto err_out; 1202 goto err_out;
1205 } 1203 }
1206 1204
1207 printk("%s: Au1xx0 Ethernet found at 0x%lx, irq %d\n", 1205 netdev_info(dev, "Au1xx0 Ethernet found at 0x%lx, irq %d\n",
1208 dev->name, (unsigned long)base->start, irq); 1206 (unsigned long)base->start, irq);
1209 if (version_printed++ == 0) 1207 if (version_printed++ == 0)
1210 printk("%s version %s %s\n", DRV_NAME, DRV_VERSION, DRV_AUTHOR); 1208 printk("%s version %s %s\n", DRV_NAME, DRV_VERSION, DRV_AUTHOR);
1211 1209
@@ -1217,15 +1215,15 @@ err_out:
1217 1215
1218 /* here we should have a valid dev plus aup-> register addresses 1216 /* here we should have a valid dev plus aup-> register addresses
1219 * so we can reset the mac properly.*/ 1217 * so we can reset the mac properly.*/
1220 reset_mac(dev); 1218 au1000_reset_mac(dev);
1221 1219
1222 for (i = 0; i < NUM_RX_DMA; i++) { 1220 for (i = 0; i < NUM_RX_DMA; i++) {
1223 if (aup->rx_db_inuse[i]) 1221 if (aup->rx_db_inuse[i])
1224 ReleaseDB(aup, aup->rx_db_inuse[i]); 1222 au1000_ReleaseDB(aup, aup->rx_db_inuse[i]);
1225 } 1223 }
1226 for (i = 0; i < NUM_TX_DMA; i++) { 1224 for (i = 0; i < NUM_TX_DMA; i++) {
1227 if (aup->tx_db_inuse[i]) 1225 if (aup->tx_db_inuse[i])
1228 ReleaseDB(aup, aup->tx_db_inuse[i]); 1226 au1000_ReleaseDB(aup, aup->tx_db_inuse[i]);
1229 } 1227 }
1230err_mdiobus_reg: 1228err_mdiobus_reg:
1231 mdiobus_free(aup->mii_bus); 1229 mdiobus_free(aup->mii_bus);
@@ -1261,11 +1259,11 @@ static int __devexit au1000_remove(struct platform_device *pdev)
1261 1259
1262 for (i = 0; i < NUM_RX_DMA; i++) 1260 for (i = 0; i < NUM_RX_DMA; i++)
1263 if (aup->rx_db_inuse[i]) 1261 if (aup->rx_db_inuse[i])
1264 ReleaseDB(aup, aup->rx_db_inuse[i]); 1262 au1000_ReleaseDB(aup, aup->rx_db_inuse[i]);
1265 1263
1266 for (i = 0; i < NUM_TX_DMA; i++) 1264 for (i = 0; i < NUM_TX_DMA; i++)
1267 if (aup->tx_db_inuse[i]) 1265 if (aup->tx_db_inuse[i])
1268 ReleaseDB(aup, aup->tx_db_inuse[i]); 1266 au1000_ReleaseDB(aup, aup->tx_db_inuse[i]);
1269 1267
1270 dma_free_noncoherent(NULL, MAX_BUF_SIZE * 1268 dma_free_noncoherent(NULL, MAX_BUF_SIZE *
1271 (NUM_TX_BUFFS + NUM_RX_BUFFS), 1269 (NUM_TX_BUFFS + NUM_RX_BUFFS),