diff options
Diffstat (limited to 'drivers/net/au1000_eth.c')
| -rw-r--r-- | drivers/net/au1000_eth.c | 259 |
1 files changed, 129 insertions, 130 deletions
diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c index 4da191b87b0d..7abb2c84ba5d 100644 --- a/drivers/net/au1000_eth.c +++ b/drivers/net/au1000_eth.c | |||
| @@ -75,14 +75,19 @@ static int au1000_debug = 5; | |||
| 75 | static int au1000_debug = 3; | 75 | static 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 | ||
| 83 | MODULE_AUTHOR(DRV_AUTHOR); | 87 | MODULE_AUTHOR(DRV_AUTHOR); |
| 84 | MODULE_DESCRIPTION(DRV_DESC); | 88 | MODULE_DESCRIPTION(DRV_DESC); |
| 85 | MODULE_LICENSE("GPL"); | 89 | MODULE_LICENSE("GPL"); |
| 90 | MODULE_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 | ||
| 151 | static void enable_mac(struct net_device *dev, int force_reset) | 156 | static 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 | ||
| 264 | static void hard_stop(struct net_device *dev) | 266 | static 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 | ||
| 275 | static void enable_rx_tx(struct net_device *dev) | 276 | static 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 | ||
| 365 | static int mii_probe (struct net_device *dev) | 364 | static 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 | */ |
| 465 | static db_dest_t *GetFreeDB(struct au1000_private *aup) | 463 | static 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 | ||
| 476 | void ReleaseDB(struct au1000_private *aup, db_dest_t *pDB) | 474 | void 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 | ||
| 484 | static void reset_mac_unlocked(struct net_device *dev) | 482 | static 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 | ||
| 510 | static void reset_mac(struct net_device *dev) | 508 | static 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 | */ |
| 531 | static void | 528 | static void |
| 532 | setup_hw_rings(struct au1000_private *aup, u32 rx_base, u32 tx_base) | 529 | au1000_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 | ||
| 582 | static 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 | |||
| 588 | static u32 au1000_get_msglevel(struct net_device *dev) | ||
| 589 | { | ||
| 590 | struct au1000_private *aup = netdev_priv(dev); | ||
| 591 | return aup->msg_enable; | ||
| 592 | } | ||
| 593 | |||
| 585 | static const struct ethtool_ops au1000_ethtool_ops = { | 594 | static 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 | ||
| 652 | static inline void update_rx_stats(struct net_device *dev, u32 status) | 662 | static 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 | ||
| 750 | static void update_tx_stats(struct net_device *dev, u32 status) | 755 | static 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++; |
| @@ -935,8 +934,8 @@ static netdev_tx_t au1000_tx(struct sk_buff *skb, struct net_device *dev) | |||
| 935 | */ | 934 | */ |
| 936 | static void au1000_tx_timeout(struct net_device *dev) | 935 | static void au1000_tx_timeout(struct net_device *dev) |
| 937 | { | 936 | { |
| 938 | printk(KERN_ERR "%s: au1000_tx_timeout: dev=%p\n", dev->name, dev); | 937 | netdev_err(dev, "au1000_tx_timeout: dev=%p\n", dev); |
| 939 | reset_mac(dev); | 938 | au1000_reset_mac(dev); |
| 940 | au1000_init(dev); | 939 | au1000_init(dev); |
| 941 | dev->trans_start = jiffies; | 940 | dev->trans_start = jiffies; |
| 942 | netif_wake_queue(dev); | 941 | netif_wake_queue(dev); |
| @@ -946,8 +945,7 @@ static void au1000_multicast_list(struct net_device *dev) | |||
| 946 | { | 945 | { |
| 947 | struct au1000_private *aup = netdev_priv(dev); | 946 | struct au1000_private *aup = netdev_priv(dev); |
| 948 | 947 | ||
| 949 | if (au1000_debug > 4) | 948 | 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 | 949 | ||
| 952 | if (dev->flags & IFF_PROMISC) { /* Set promiscuous. */ | 950 | if (dev->flags & IFF_PROMISC) { /* Set promiscuous. */ |
| 953 | aup->mac->control |= MAC_PROMISCUOUS; | 951 | aup->mac->control |= MAC_PROMISCUOUS; |
| @@ -955,14 +953,14 @@ static void au1000_multicast_list(struct net_device *dev) | |||
| 955 | netdev_mc_count(dev) > MULTICAST_FILTER_LIMIT) { | 953 | netdev_mc_count(dev) > MULTICAST_FILTER_LIMIT) { |
| 956 | aup->mac->control |= MAC_PASS_ALL_MULTI; | 954 | aup->mac->control |= MAC_PASS_ALL_MULTI; |
| 957 | aup->mac->control &= ~MAC_PROMISCUOUS; | 955 | aup->mac->control &= ~MAC_PROMISCUOUS; |
| 958 | printk(KERN_INFO "%s: Pass all multicast\n", dev->name); | 956 | netdev_info(dev, "Pass all multicast\n"); |
| 959 | } else { | 957 | } else { |
| 960 | struct dev_mc_list *mclist; | 958 | struct netdev_hw_addr *ha; |
| 961 | u32 mc_filter[2]; /* Multicast hash filter */ | 959 | u32 mc_filter[2]; /* Multicast hash filter */ |
| 962 | 960 | ||
| 963 | mc_filter[1] = mc_filter[0] = 0; | 961 | mc_filter[1] = mc_filter[0] = 0; |
| 964 | netdev_for_each_mc_addr(mclist, dev) | 962 | netdev_for_each_mc_addr(ha, dev) |
| 965 | set_bit(ether_crc(ETH_ALEN, mclist->dmi_addr)>>26, | 963 | set_bit(ether_crc(ETH_ALEN, ha->addr)>>26, |
| 966 | (long *)mc_filter); | 964 | (long *)mc_filter); |
| 967 | aup->mac->multi_hash_high = mc_filter[1]; | 965 | aup->mac->multi_hash_high = mc_filter[1]; |
| 968 | aup->mac->multi_hash_low = mc_filter[0]; | 966 | aup->mac->multi_hash_low = mc_filter[0]; |
| @@ -975,9 +973,11 @@ static int au1000_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | |||
| 975 | { | 973 | { |
| 976 | struct au1000_private *aup = netdev_priv(dev); | 974 | struct au1000_private *aup = netdev_priv(dev); |
| 977 | 975 | ||
| 978 | if (!netif_running(dev)) return -EINVAL; | 976 | if (!netif_running(dev)) |
| 977 | return -EINVAL; | ||
| 979 | 978 | ||
| 980 | if (!aup->phy_dev) return -EINVAL; // PHY not controllable | 979 | if (!aup->phy_dev) |
| 980 | return -EINVAL; /* PHY not controllable */ | ||
| 981 | 981 | ||
| 982 | return phy_mii_ioctl(aup->phy_dev, if_mii(rq), cmd); | 982 | return phy_mii_ioctl(aup->phy_dev, if_mii(rq), cmd); |
| 983 | } | 983 | } |
| @@ -996,7 +996,7 @@ static const struct net_device_ops au1000_netdev_ops = { | |||
| 996 | 996 | ||
| 997 | static int __devinit au1000_probe(struct platform_device *pdev) | 997 | static int __devinit au1000_probe(struct platform_device *pdev) |
| 998 | { | 998 | { |
| 999 | static unsigned version_printed = 0; | 999 | static unsigned version_printed; |
| 1000 | struct au1000_private *aup = NULL; | 1000 | struct au1000_private *aup = NULL; |
| 1001 | struct au1000_eth_platform_data *pd; | 1001 | struct au1000_eth_platform_data *pd; |
| 1002 | struct net_device *dev = NULL; | 1002 | struct net_device *dev = NULL; |
| @@ -1007,40 +1007,40 @@ static int __devinit au1000_probe(struct platform_device *pdev) | |||
| 1007 | 1007 | ||
| 1008 | base = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1008 | base = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 1009 | if (!base) { | 1009 | if (!base) { |
| 1010 | printk(KERN_ERR DRV_NAME ": failed to retrieve base register\n"); | 1010 | dev_err(&pdev->dev, "failed to retrieve base register\n"); |
| 1011 | err = -ENODEV; | 1011 | err = -ENODEV; |
| 1012 | goto out; | 1012 | goto out; |
| 1013 | } | 1013 | } |
| 1014 | 1014 | ||
| 1015 | macen = platform_get_resource(pdev, IORESOURCE_MEM, 1); | 1015 | macen = platform_get_resource(pdev, IORESOURCE_MEM, 1); |
| 1016 | if (!macen) { | 1016 | if (!macen) { |
| 1017 | printk(KERN_ERR DRV_NAME ": failed to retrieve MAC Enable register\n"); | 1017 | dev_err(&pdev->dev, "failed to retrieve MAC Enable register\n"); |
| 1018 | err = -ENODEV; | 1018 | err = -ENODEV; |
| 1019 | goto out; | 1019 | goto out; |
| 1020 | } | 1020 | } |
| 1021 | 1021 | ||
| 1022 | irq = platform_get_irq(pdev, 0); | 1022 | irq = platform_get_irq(pdev, 0); |
| 1023 | if (irq < 0) { | 1023 | if (irq < 0) { |
| 1024 | printk(KERN_ERR DRV_NAME ": failed to retrieve IRQ\n"); | 1024 | dev_err(&pdev->dev, "failed to retrieve IRQ\n"); |
| 1025 | err = -ENODEV; | 1025 | err = -ENODEV; |
| 1026 | goto out; | 1026 | goto out; |
| 1027 | } | 1027 | } |
| 1028 | 1028 | ||
| 1029 | if (!request_mem_region(base->start, resource_size(base), pdev->name)) { | 1029 | 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"); | 1030 | dev_err(&pdev->dev, "failed to request memory region for base registers\n"); |
| 1031 | err = -ENXIO; | 1031 | err = -ENXIO; |
| 1032 | goto out; | 1032 | goto out; |
| 1033 | } | 1033 | } |
| 1034 | 1034 | ||
| 1035 | if (!request_mem_region(macen->start, resource_size(macen), pdev->name)) { | 1035 | 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"); | 1036 | dev_err(&pdev->dev, "failed to request memory region for MAC enable register\n"); |
| 1037 | err = -ENXIO; | 1037 | err = -ENXIO; |
| 1038 | goto err_request; | 1038 | goto err_request; |
| 1039 | } | 1039 | } |
| 1040 | 1040 | ||
| 1041 | dev = alloc_etherdev(sizeof(struct au1000_private)); | 1041 | dev = alloc_etherdev(sizeof(struct au1000_private)); |
| 1042 | if (!dev) { | 1042 | if (!dev) { |
| 1043 | printk(KERN_ERR "%s: alloc_etherdev failed\n", DRV_NAME); | 1043 | dev_err(&pdev->dev, "alloc_etherdev failed\n"); |
| 1044 | err = -ENOMEM; | 1044 | err = -ENOMEM; |
| 1045 | goto err_alloc; | 1045 | goto err_alloc; |
| 1046 | } | 1046 | } |
| @@ -1050,6 +1050,7 @@ static int __devinit au1000_probe(struct platform_device *pdev) | |||
| 1050 | aup = netdev_priv(dev); | 1050 | aup = netdev_priv(dev); |
| 1051 | 1051 | ||
| 1052 | spin_lock_init(&aup->lock); | 1052 | spin_lock_init(&aup->lock); |
| 1053 | aup->msg_enable = (au1000_debug < 4 ? AU1000_DEF_MSG_ENABLE : au1000_debug); | ||
| 1053 | 1054 | ||
| 1054 | /* Allocate the data buffers */ | 1055 | /* Allocate the data buffers */ |
| 1055 | /* Snooping works fine with eth on all au1xxx */ | 1056 | /* Snooping works fine with eth on all au1xxx */ |
| @@ -1057,7 +1058,7 @@ static int __devinit au1000_probe(struct platform_device *pdev) | |||
| 1057 | (NUM_TX_BUFFS + NUM_RX_BUFFS), | 1058 | (NUM_TX_BUFFS + NUM_RX_BUFFS), |
| 1058 | &aup->dma_addr, 0); | 1059 | &aup->dma_addr, 0); |
| 1059 | if (!aup->vaddr) { | 1060 | if (!aup->vaddr) { |
| 1060 | printk(KERN_ERR DRV_NAME ": failed to allocate data buffers\n"); | 1061 | dev_err(&pdev->dev, "failed to allocate data buffers\n"); |
| 1061 | err = -ENOMEM; | 1062 | err = -ENOMEM; |
| 1062 | goto err_vaddr; | 1063 | goto err_vaddr; |
| 1063 | } | 1064 | } |
| @@ -1065,7 +1066,7 @@ static int __devinit au1000_probe(struct platform_device *pdev) | |||
| 1065 | /* aup->mac is the base address of the MAC's registers */ | 1066 | /* 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)); | 1067 | aup->mac = (volatile mac_reg_t *)ioremap_nocache(base->start, resource_size(base)); |
| 1067 | if (!aup->mac) { | 1068 | if (!aup->mac) { |
| 1068 | printk(KERN_ERR DRV_NAME ": failed to ioremap MAC registers\n"); | 1069 | dev_err(&pdev->dev, "failed to ioremap MAC registers\n"); |
| 1069 | err = -ENXIO; | 1070 | err = -ENXIO; |
| 1070 | goto err_remap1; | 1071 | goto err_remap1; |
| 1071 | } | 1072 | } |
| @@ -1073,7 +1074,7 @@ static int __devinit au1000_probe(struct platform_device *pdev) | |||
| 1073 | /* Setup some variables for quick register address access */ | 1074 | /* Setup some variables for quick register address access */ |
| 1074 | aup->enable = (volatile u32 *)ioremap_nocache(macen->start, resource_size(macen)); | 1075 | aup->enable = (volatile u32 *)ioremap_nocache(macen->start, resource_size(macen)); |
| 1075 | if (!aup->enable) { | 1076 | if (!aup->enable) { |
| 1076 | printk(KERN_ERR DRV_NAME ": failed to ioremap MAC enable register\n"); | 1077 | dev_err(&pdev->dev, "failed to ioremap MAC enable register\n"); |
| 1077 | err = -ENXIO; | 1078 | err = -ENXIO; |
| 1078 | goto err_remap2; | 1079 | goto err_remap2; |
| 1079 | } | 1080 | } |
| @@ -1083,14 +1084,13 @@ static int __devinit au1000_probe(struct platform_device *pdev) | |||
| 1083 | if (prom_get_ethernet_addr(ethaddr) == 0) | 1084 | if (prom_get_ethernet_addr(ethaddr) == 0) |
| 1084 | memcpy(au1000_mac_addr, ethaddr, sizeof(au1000_mac_addr)); | 1085 | memcpy(au1000_mac_addr, ethaddr, sizeof(au1000_mac_addr)); |
| 1085 | else { | 1086 | else { |
| 1086 | printk(KERN_INFO "%s: No MAC address found\n", | 1087 | netdev_info(dev, "No MAC address found\n"); |
| 1087 | dev->name); | ||
| 1088 | /* Use the hard coded MAC addresses */ | 1088 | /* Use the hard coded MAC addresses */ |
| 1089 | } | 1089 | } |
| 1090 | 1090 | ||
| 1091 | setup_hw_rings(aup, MAC0_RX_DMA_ADDR, MAC0_TX_DMA_ADDR); | 1091 | au1000_setup_hw_rings(aup, MAC0_RX_DMA_ADDR, MAC0_TX_DMA_ADDR); |
| 1092 | } else if (pdev->id == 1) | 1092 | } else if (pdev->id == 1) |
| 1093 | setup_hw_rings(aup, MAC1_RX_DMA_ADDR, MAC1_TX_DMA_ADDR); | 1093 | au1000_setup_hw_rings(aup, MAC1_RX_DMA_ADDR, MAC1_TX_DMA_ADDR); |
| 1094 | 1094 | ||
| 1095 | /* | 1095 | /* |
| 1096 | * Assign to the Ethernet ports two consecutive MAC addresses | 1096 | * Assign to the Ethernet ports two consecutive MAC addresses |
| @@ -1104,7 +1104,7 @@ static int __devinit au1000_probe(struct platform_device *pdev) | |||
| 1104 | 1104 | ||
| 1105 | pd = pdev->dev.platform_data; | 1105 | pd = pdev->dev.platform_data; |
| 1106 | if (!pd) { | 1106 | if (!pd) { |
| 1107 | printk(KERN_INFO DRV_NAME ": no platform_data passed, PHY search on MAC0\n"); | 1107 | dev_info(&pdev->dev, "no platform_data passed, PHY search on MAC0\n"); |
| 1108 | aup->phy1_search_mac0 = 1; | 1108 | aup->phy1_search_mac0 = 1; |
| 1109 | } else { | 1109 | } else { |
| 1110 | aup->phy_static_config = pd->phy_static_config; | 1110 | aup->phy_static_config = pd->phy_static_config; |
| @@ -1116,7 +1116,7 @@ static int __devinit au1000_probe(struct platform_device *pdev) | |||
| 1116 | } | 1116 | } |
| 1117 | 1117 | ||
| 1118 | if (aup->phy_busid && aup->phy_busid > 0) { | 1118 | if (aup->phy_busid && aup->phy_busid > 0) { |
| 1119 | printk(KERN_ERR DRV_NAME ": MAC0-associated PHY attached 2nd MACs MII" | 1119 | dev_err(&pdev->dev, "MAC0-associated PHY attached 2nd MACs MII" |
| 1120 | "bus not supported yet\n"); | 1120 | "bus not supported yet\n"); |
| 1121 | err = -ENODEV; | 1121 | err = -ENODEV; |
| 1122 | goto err_mdiobus_alloc; | 1122 | goto err_mdiobus_alloc; |
| @@ -1124,7 +1124,7 @@ static int __devinit au1000_probe(struct platform_device *pdev) | |||
| 1124 | 1124 | ||
| 1125 | aup->mii_bus = mdiobus_alloc(); | 1125 | aup->mii_bus = mdiobus_alloc(); |
| 1126 | if (aup->mii_bus == NULL) { | 1126 | if (aup->mii_bus == NULL) { |
| 1127 | printk(KERN_ERR DRV_NAME ": failed to allocate mdiobus structure\n"); | 1127 | dev_err(&pdev->dev, "failed to allocate mdiobus structure\n"); |
| 1128 | err = -ENOMEM; | 1128 | err = -ENOMEM; |
| 1129 | goto err_mdiobus_alloc; | 1129 | goto err_mdiobus_alloc; |
| 1130 | } | 1130 | } |
| @@ -1139,7 +1139,7 @@ static int __devinit au1000_probe(struct platform_device *pdev) | |||
| 1139 | if (aup->mii_bus->irq == NULL) | 1139 | if (aup->mii_bus->irq == NULL) |
| 1140 | goto err_out; | 1140 | goto err_out; |
| 1141 | 1141 | ||
| 1142 | for(i = 0; i < PHY_MAX_ADDR; ++i) | 1142 | for (i = 0; i < PHY_MAX_ADDR; ++i) |
| 1143 | aup->mii_bus->irq[i] = PHY_POLL; | 1143 | aup->mii_bus->irq[i] = PHY_POLL; |
| 1144 | /* if known, set corresponding PHY IRQs */ | 1144 | /* if known, set corresponding PHY IRQs */ |
| 1145 | if (aup->phy_static_config) | 1145 | if (aup->phy_static_config) |
| @@ -1148,11 +1148,11 @@ static int __devinit au1000_probe(struct platform_device *pdev) | |||
| 1148 | 1148 | ||
| 1149 | err = mdiobus_register(aup->mii_bus); | 1149 | err = mdiobus_register(aup->mii_bus); |
| 1150 | if (err) { | 1150 | if (err) { |
| 1151 | printk(KERN_ERR DRV_NAME " failed to register MDIO bus\n"); | 1151 | dev_err(&pdev->dev, "failed to register MDIO bus\n"); |
| 1152 | goto err_mdiobus_reg; | 1152 | goto err_mdiobus_reg; |
| 1153 | } | 1153 | } |
| 1154 | 1154 | ||
| 1155 | if (mii_probe(dev) != 0) | 1155 | if (au1000_mii_probe(dev) != 0) |
| 1156 | goto err_out; | 1156 | goto err_out; |
| 1157 | 1157 | ||
| 1158 | pDBfree = NULL; | 1158 | pDBfree = NULL; |
| @@ -1168,7 +1168,7 @@ static int __devinit au1000_probe(struct platform_device *pdev) | |||
| 1168 | aup->pDBfree = pDBfree; | 1168 | aup->pDBfree = pDBfree; |
| 1169 | 1169 | ||
| 1170 | for (i = 0; i < NUM_RX_DMA; i++) { | 1170 | for (i = 0; i < NUM_RX_DMA; i++) { |
| 1171 | pDB = GetFreeDB(aup); | 1171 | pDB = au1000_GetFreeDB(aup); |
| 1172 | if (!pDB) { | 1172 | if (!pDB) { |
| 1173 | goto err_out; | 1173 | goto err_out; |
| 1174 | } | 1174 | } |
| @@ -1176,7 +1176,7 @@ static int __devinit au1000_probe(struct platform_device *pdev) | |||
| 1176 | aup->rx_db_inuse[i] = pDB; | 1176 | aup->rx_db_inuse[i] = pDB; |
| 1177 | } | 1177 | } |
| 1178 | for (i = 0; i < NUM_TX_DMA; i++) { | 1178 | for (i = 0; i < NUM_TX_DMA; i++) { |
| 1179 | pDB = GetFreeDB(aup); | 1179 | pDB = au1000_GetFreeDB(aup); |
| 1180 | if (!pDB) { | 1180 | if (!pDB) { |
| 1181 | goto err_out; | 1181 | goto err_out; |
| 1182 | } | 1182 | } |
| @@ -1195,17 +1195,16 @@ static int __devinit au1000_probe(struct platform_device *pdev) | |||
| 1195 | * The boot code uses the ethernet controller, so reset it to start | 1195 | * The boot code uses the ethernet controller, so reset it to start |
| 1196 | * fresh. au1000_init() expects that the device is in reset state. | 1196 | * fresh. au1000_init() expects that the device is in reset state. |
| 1197 | */ | 1197 | */ |
| 1198 | reset_mac(dev); | 1198 | au1000_reset_mac(dev); |
| 1199 | 1199 | ||
| 1200 | err = register_netdev(dev); | 1200 | err = register_netdev(dev); |
| 1201 | if (err) { | 1201 | if (err) { |
| 1202 | printk(KERN_ERR DRV_NAME "%s: Cannot register net device, aborting.\n", | 1202 | netdev_err(dev, "Cannot register net device, aborting.\n"); |
| 1203 | dev->name); | ||
| 1204 | goto err_out; | 1203 | goto err_out; |
| 1205 | } | 1204 | } |
| 1206 | 1205 | ||
| 1207 | printk("%s: Au1xx0 Ethernet found at 0x%lx, irq %d\n", | 1206 | netdev_info(dev, "Au1xx0 Ethernet found at 0x%lx, irq %d\n", |
| 1208 | dev->name, (unsigned long)base->start, irq); | 1207 | (unsigned long)base->start, irq); |
| 1209 | if (version_printed++ == 0) | 1208 | if (version_printed++ == 0) |
| 1210 | printk("%s version %s %s\n", DRV_NAME, DRV_VERSION, DRV_AUTHOR); | 1209 | printk("%s version %s %s\n", DRV_NAME, DRV_VERSION, DRV_AUTHOR); |
| 1211 | 1210 | ||
| @@ -1217,15 +1216,15 @@ err_out: | |||
| 1217 | 1216 | ||
| 1218 | /* here we should have a valid dev plus aup-> register addresses | 1217 | /* here we should have a valid dev plus aup-> register addresses |
| 1219 | * so we can reset the mac properly.*/ | 1218 | * so we can reset the mac properly.*/ |
| 1220 | reset_mac(dev); | 1219 | au1000_reset_mac(dev); |
| 1221 | 1220 | ||
| 1222 | for (i = 0; i < NUM_RX_DMA; i++) { | 1221 | for (i = 0; i < NUM_RX_DMA; i++) { |
| 1223 | if (aup->rx_db_inuse[i]) | 1222 | if (aup->rx_db_inuse[i]) |
| 1224 | ReleaseDB(aup, aup->rx_db_inuse[i]); | 1223 | au1000_ReleaseDB(aup, aup->rx_db_inuse[i]); |
| 1225 | } | 1224 | } |
| 1226 | for (i = 0; i < NUM_TX_DMA; i++) { | 1225 | for (i = 0; i < NUM_TX_DMA; i++) { |
| 1227 | if (aup->tx_db_inuse[i]) | 1226 | if (aup->tx_db_inuse[i]) |
| 1228 | ReleaseDB(aup, aup->tx_db_inuse[i]); | 1227 | au1000_ReleaseDB(aup, aup->tx_db_inuse[i]); |
| 1229 | } | 1228 | } |
| 1230 | err_mdiobus_reg: | 1229 | err_mdiobus_reg: |
| 1231 | mdiobus_free(aup->mii_bus); | 1230 | mdiobus_free(aup->mii_bus); |
| @@ -1261,11 +1260,11 @@ static int __devexit au1000_remove(struct platform_device *pdev) | |||
| 1261 | 1260 | ||
| 1262 | for (i = 0; i < NUM_RX_DMA; i++) | 1261 | for (i = 0; i < NUM_RX_DMA; i++) |
| 1263 | if (aup->rx_db_inuse[i]) | 1262 | if (aup->rx_db_inuse[i]) |
| 1264 | ReleaseDB(aup, aup->rx_db_inuse[i]); | 1263 | au1000_ReleaseDB(aup, aup->rx_db_inuse[i]); |
| 1265 | 1264 | ||
| 1266 | for (i = 0; i < NUM_TX_DMA; i++) | 1265 | for (i = 0; i < NUM_TX_DMA; i++) |
| 1267 | if (aup->tx_db_inuse[i]) | 1266 | if (aup->tx_db_inuse[i]) |
| 1268 | ReleaseDB(aup, aup->tx_db_inuse[i]); | 1267 | au1000_ReleaseDB(aup, aup->tx_db_inuse[i]); |
| 1269 | 1268 | ||
| 1270 | dma_free_noncoherent(NULL, MAX_BUF_SIZE * | 1269 | dma_free_noncoherent(NULL, MAX_BUF_SIZE * |
| 1271 | (NUM_TX_BUFFS + NUM_RX_BUFFS), | 1270 | (NUM_TX_BUFFS + NUM_RX_BUFFS), |
