diff options
| author | Jeff Garzik <jeff@garzik.org> | 2006-04-20 17:39:14 -0400 |
|---|---|---|
| committer | Jeff Garzik <jeff@garzik.org> | 2006-04-20 17:39:14 -0400 |
| commit | d5498bef6fcd8ca0e4579eeb0b0d724f20221bb1 (patch) | |
| tree | c95370d6526d60886731924cf2d467701006df13 | |
| parent | 0a0c72c9118c4e63080eb409f0cfdf15808d23a4 (diff) | |
[netdrvr smc911x] trim trailing whitespace
| -rw-r--r-- | drivers/net/smc911x.c | 210 | ||||
| -rw-r--r-- | drivers/net/smc911x.h | 18 |
2 files changed, 114 insertions, 114 deletions
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c index b3b0d360da14..bdd8702ead54 100644 --- a/drivers/net/smc911x.c +++ b/drivers/net/smc911x.c | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | * | 4 | * |
| 5 | * Copyright (C) 2005 Sensoria Corp | 5 | * Copyright (C) 2005 Sensoria Corp |
| 6 | * Derived from the unified SMC91x driver by Nicolas Pitre | 6 | * Derived from the unified SMC91x driver by Nicolas Pitre |
| 7 | * and the smsc911x.c reference driver by SMSC | 7 | * and the smsc911x.c reference driver by SMSC |
| 8 | * | 8 | * |
| 9 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License as published by | 10 | * it under the terms of the GNU General Public License as published by |
| @@ -113,7 +113,7 @@ MODULE_LICENSE("GPL"); | |||
| 113 | struct smc911x_local { | 113 | struct smc911x_local { |
| 114 | /* | 114 | /* |
| 115 | * If I have to wait until the DMA is finished and ready to reload a | 115 | * If I have to wait until the DMA is finished and ready to reload a |
| 116 | * packet, I will store the skbuff here. Then, the DMA will send it | 116 | * packet, I will store the skbuff here. Then, the DMA will send it |
| 117 | * out and free it. | 117 | * out and free it. |
| 118 | */ | 118 | */ |
| 119 | struct sk_buff *pending_tx_skb; | 119 | struct sk_buff *pending_tx_skb; |
| @@ -246,7 +246,7 @@ static void smc911x_reset(struct net_device *dev) | |||
| 246 | /* Take out of PM setting first */ | 246 | /* Take out of PM setting first */ |
| 247 | if ((SMC_GET_PMT_CTRL() & PMT_CTRL_READY_) == 0) { | 247 | if ((SMC_GET_PMT_CTRL() & PMT_CTRL_READY_) == 0) { |
| 248 | /* Write to the bytetest will take out of powerdown */ | 248 | /* Write to the bytetest will take out of powerdown */ |
| 249 | SMC_SET_BYTE_TEST(0); | 249 | SMC_SET_BYTE_TEST(0); |
| 250 | timeout=10; | 250 | timeout=10; |
| 251 | do { | 251 | do { |
| 252 | udelay(10); | 252 | udelay(10); |
| @@ -306,9 +306,9 @@ static void smc911x_reset(struct net_device *dev) | |||
| 306 | /* Set to LED outputs */ | 306 | /* Set to LED outputs */ |
| 307 | SMC_SET_GPIO_CFG(0x70070000); | 307 | SMC_SET_GPIO_CFG(0x70070000); |
| 308 | 308 | ||
| 309 | /* | 309 | /* |
| 310 | * Deassert IRQ for 1*10us for edge type interrupts | 310 | * Deassert IRQ for 1*10us for edge type interrupts |
| 311 | * and drive IRQ pin push-pull | 311 | * and drive IRQ pin push-pull |
| 312 | */ | 312 | */ |
| 313 | SMC_SET_IRQ_CFG( (1 << 24) | INT_CFG_IRQ_EN_ | INT_CFG_IRQ_TYPE_ ); | 313 | SMC_SET_IRQ_CFG( (1 << 24) | INT_CFG_IRQ_EN_ | INT_CFG_IRQ_TYPE_ ); |
| 314 | 314 | ||
| @@ -368,8 +368,8 @@ static void smc911x_enable(struct net_device *dev) | |||
| 368 | SMC_SET_FIFO_RSL(0x00); | 368 | SMC_SET_FIFO_RSL(0x00); |
| 369 | 369 | ||
| 370 | /* now, enable interrupts */ | 370 | /* now, enable interrupts */ |
| 371 | mask = INT_EN_TDFA_EN_ | INT_EN_TSFL_EN_ | INT_EN_RSFL_EN_ | | 371 | mask = INT_EN_TDFA_EN_ | INT_EN_TSFL_EN_ | INT_EN_RSFL_EN_ | |
| 372 | INT_EN_GPT_INT_EN_ | INT_EN_RXDFH_INT_EN_ | INT_EN_RXE_EN_ | | 372 | INT_EN_GPT_INT_EN_ | INT_EN_RXDFH_INT_EN_ | INT_EN_RXE_EN_ | |
| 373 | INT_EN_PHY_INT_EN_; | 373 | INT_EN_PHY_INT_EN_; |
| 374 | if (IS_REV_A(lp->revision)) | 374 | if (IS_REV_A(lp->revision)) |
| 375 | mask|=INT_EN_RDFL_EN_; | 375 | mask|=INT_EN_RDFL_EN_; |
| @@ -404,12 +404,12 @@ static void smc911x_shutdown(struct net_device *dev) | |||
| 404 | } | 404 | } |
| 405 | 405 | ||
| 406 | static inline void smc911x_drop_pkt(struct net_device *dev) | 406 | static inline void smc911x_drop_pkt(struct net_device *dev) |
| 407 | { | 407 | { |
| 408 | unsigned long ioaddr = dev->base_addr; | 408 | unsigned long ioaddr = dev->base_addr; |
| 409 | unsigned int fifo_count, timeout, reg; | 409 | unsigned int fifo_count, timeout, reg; |
| 410 | 410 | ||
| 411 | DBG(SMC_DEBUG_FUNC | SMC_DEBUG_RX, "%s: --> %s\n", CARDNAME, __FUNCTION__); | 411 | DBG(SMC_DEBUG_FUNC | SMC_DEBUG_RX, "%s: --> %s\n", CARDNAME, __FUNCTION__); |
| 412 | fifo_count = SMC_GET_RX_FIFO_INF() & 0xFFFF; | 412 | fifo_count = SMC_GET_RX_FIFO_INF() & 0xFFFF; |
| 413 | if (fifo_count <= 4) { | 413 | if (fifo_count <= 4) { |
| 414 | /* Manually dump the packet data */ | 414 | /* Manually dump the packet data */ |
| 415 | while (fifo_count--) | 415 | while (fifo_count--) |
| @@ -431,7 +431,7 @@ static inline void smc911x_drop_pkt(struct net_device *dev) | |||
| 431 | /* | 431 | /* |
| 432 | * This is the procedure to handle the receipt of a packet. | 432 | * This is the procedure to handle the receipt of a packet. |
| 433 | * It should be called after checking for packet presence in | 433 | * It should be called after checking for packet presence in |
| 434 | * the RX status FIFO. It must be called with the spin lock | 434 | * the RX status FIFO. It must be called with the spin lock |
| 435 | * already held. | 435 | * already held. |
| 436 | */ | 436 | */ |
| 437 | static inline void smc911x_rcv(struct net_device *dev) | 437 | static inline void smc911x_rcv(struct net_device *dev) |
| @@ -442,21 +442,21 @@ static inline void smc911x_rcv(struct net_device *dev) | |||
| 442 | struct sk_buff *skb; | 442 | struct sk_buff *skb; |
| 443 | unsigned char *data; | 443 | unsigned char *data; |
| 444 | 444 | ||
| 445 | DBG(SMC_DEBUG_FUNC | SMC_DEBUG_RX, "%s: --> %s\n", | 445 | DBG(SMC_DEBUG_FUNC | SMC_DEBUG_RX, "%s: --> %s\n", |
| 446 | dev->name, __FUNCTION__); | 446 | dev->name, __FUNCTION__); |
| 447 | status = SMC_GET_RX_STS_FIFO(); | 447 | status = SMC_GET_RX_STS_FIFO(); |
| 448 | DBG(SMC_DEBUG_RX, "%s: Rx pkt len %d status 0x%08x \n", | 448 | DBG(SMC_DEBUG_RX, "%s: Rx pkt len %d status 0x%08x \n", |
| 449 | dev->name, (status & 0x3fff0000) >> 16, status & 0xc000ffff); | 449 | dev->name, (status & 0x3fff0000) >> 16, status & 0xc000ffff); |
| 450 | pkt_len = (status & RX_STS_PKT_LEN_) >> 16; | 450 | pkt_len = (status & RX_STS_PKT_LEN_) >> 16; |
| 451 | if (status & RX_STS_ES_) { | 451 | if (status & RX_STS_ES_) { |
| 452 | /* Deal with a bad packet */ | 452 | /* Deal with a bad packet */ |
| 453 | lp->stats.rx_errors++; | 453 | lp->stats.rx_errors++; |
| 454 | if (status & RX_STS_CRC_ERR_) | 454 | if (status & RX_STS_CRC_ERR_) |
| 455 | lp->stats.rx_crc_errors++; | 455 | lp->stats.rx_crc_errors++; |
| 456 | else { | 456 | else { |
| 457 | if (status & RX_STS_LEN_ERR_) | 457 | if (status & RX_STS_LEN_ERR_) |
| 458 | lp->stats.rx_length_errors++; | 458 | lp->stats.rx_length_errors++; |
| 459 | if (status & RX_STS_MCAST_) | 459 | if (status & RX_STS_MCAST_) |
| 460 | lp->stats.multicast++; | 460 | lp->stats.multicast++; |
| 461 | } | 461 | } |
| 462 | /* Remove the bad packet data from the RX FIFO */ | 462 | /* Remove the bad packet data from the RX FIFO */ |
| @@ -472,9 +472,9 @@ static inline void smc911x_rcv(struct net_device *dev) | |||
| 472 | smc911x_drop_pkt(dev); | 472 | smc911x_drop_pkt(dev); |
| 473 | return; | 473 | return; |
| 474 | } | 474 | } |
| 475 | /* Align IP header to 32 bits | 475 | /* Align IP header to 32 bits |
| 476 | * Note that the device is configured to add a 2 | 476 | * Note that the device is configured to add a 2 |
| 477 | * byte padding to the packet start, so we really | 477 | * byte padding to the packet start, so we really |
| 478 | * want to write to the orignal data pointer */ | 478 | * want to write to the orignal data pointer */ |
| 479 | data = skb->data; | 479 | data = skb->data; |
| 480 | skb_reserve(skb, 2); | 480 | skb_reserve(skb, 2); |
| @@ -529,25 +529,25 @@ static void smc911x_hardware_send_pkt(struct net_device *dev) | |||
| 529 | skb = lp->pending_tx_skb; | 529 | skb = lp->pending_tx_skb; |
| 530 | lp->pending_tx_skb = NULL; | 530 | lp->pending_tx_skb = NULL; |
| 531 | 531 | ||
| 532 | /* cmdA {25:24] data alignment [20:16] start offset [10:0] buffer length */ | 532 | /* cmdA {25:24] data alignment [20:16] start offset [10:0] buffer length */ |
| 533 | /* cmdB {31:16] pkt tag [10:0] length */ | 533 | /* cmdB {31:16] pkt tag [10:0] length */ |
| 534 | #ifdef SMC_USE_DMA | 534 | #ifdef SMC_USE_DMA |
| 535 | /* 16 byte buffer alignment mode */ | 535 | /* 16 byte buffer alignment mode */ |
| 536 | buf = (char*)((u32)(skb->data) & ~0xF); | 536 | buf = (char*)((u32)(skb->data) & ~0xF); |
| 537 | len = (skb->len + 0xF + ((u32)skb->data & 0xF)) & ~0xF; | 537 | len = (skb->len + 0xF + ((u32)skb->data & 0xF)) & ~0xF; |
| 538 | cmdA = (1<<24) | (((u32)skb->data & 0xF)<<16) | | 538 | cmdA = (1<<24) | (((u32)skb->data & 0xF)<<16) | |
| 539 | TX_CMD_A_INT_FIRST_SEG_ | TX_CMD_A_INT_LAST_SEG_ | | 539 | TX_CMD_A_INT_FIRST_SEG_ | TX_CMD_A_INT_LAST_SEG_ | |
| 540 | skb->len; | 540 | skb->len; |
| 541 | #else | 541 | #else |
| 542 | buf = (char*)((u32)skb->data & ~0x3); | 542 | buf = (char*)((u32)skb->data & ~0x3); |
| 543 | len = (skb->len + 3 + ((u32)skb->data & 3)) & ~0x3; | 543 | len = (skb->len + 3 + ((u32)skb->data & 3)) & ~0x3; |
| 544 | cmdA = (((u32)skb->data & 0x3) << 16) | | 544 | cmdA = (((u32)skb->data & 0x3) << 16) | |
| 545 | TX_CMD_A_INT_FIRST_SEG_ | TX_CMD_A_INT_LAST_SEG_ | | 545 | TX_CMD_A_INT_FIRST_SEG_ | TX_CMD_A_INT_LAST_SEG_ | |
| 546 | skb->len; | 546 | skb->len; |
| 547 | #endif | 547 | #endif |
| 548 | /* tag is packet length so we can use this in stats update later */ | 548 | /* tag is packet length so we can use this in stats update later */ |
| 549 | cmdB = (skb->len << 16) | (skb->len & 0x7FF); | 549 | cmdB = (skb->len << 16) | (skb->len & 0x7FF); |
| 550 | 550 | ||
| 551 | DBG(SMC_DEBUG_TX, "%s: TX PKT LENGTH 0x%04x (%d) BUF 0x%p CMDA 0x%08x CMDB 0x%08x\n", | 551 | DBG(SMC_DEBUG_TX, "%s: TX PKT LENGTH 0x%04x (%d) BUF 0x%p CMDA 0x%08x CMDB 0x%08x\n", |
| 552 | dev->name, len, len, buf, cmdA, cmdB); | 552 | dev->name, len, len, buf, cmdA, cmdB); |
| 553 | SMC_SET_TX_FIFO(cmdA); | 553 | SMC_SET_TX_FIFO(cmdA); |
| @@ -587,7 +587,7 @@ static int smc911x_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 587 | unsigned int free; | 587 | unsigned int free; |
| 588 | unsigned long flags; | 588 | unsigned long flags; |
| 589 | 589 | ||
| 590 | DBG(SMC_DEBUG_FUNC | SMC_DEBUG_TX, "%s: --> %s\n", | 590 | DBG(SMC_DEBUG_FUNC | SMC_DEBUG_TX, "%s: --> %s\n", |
| 591 | dev->name, __FUNCTION__); | 591 | dev->name, __FUNCTION__); |
| 592 | 592 | ||
| 593 | BUG_ON(lp->pending_tx_skb != NULL); | 593 | BUG_ON(lp->pending_tx_skb != NULL); |
| @@ -597,7 +597,7 @@ static int smc911x_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 597 | 597 | ||
| 598 | /* Turn off the flow when running out of space in FIFO */ | 598 | /* Turn off the flow when running out of space in FIFO */ |
| 599 | if (free <= SMC911X_TX_FIFO_LOW_THRESHOLD) { | 599 | if (free <= SMC911X_TX_FIFO_LOW_THRESHOLD) { |
| 600 | DBG(SMC_DEBUG_TX, "%s: Disabling data flow due to low FIFO space (%d)\n", | 600 | DBG(SMC_DEBUG_TX, "%s: Disabling data flow due to low FIFO space (%d)\n", |
| 601 | dev->name, free); | 601 | dev->name, free); |
| 602 | spin_lock_irqsave(&lp->lock, flags); | 602 | spin_lock_irqsave(&lp->lock, flags); |
| 603 | /* Reenable when at least 1 packet of size MTU present */ | 603 | /* Reenable when at least 1 packet of size MTU present */ |
| @@ -607,15 +607,15 @@ static int smc911x_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 607 | spin_unlock_irqrestore(&lp->lock, flags); | 607 | spin_unlock_irqrestore(&lp->lock, flags); |
| 608 | } | 608 | } |
| 609 | 609 | ||
| 610 | /* Drop packets when we run out of space in TX FIFO | 610 | /* Drop packets when we run out of space in TX FIFO |
| 611 | * Account for overhead required for: | 611 | * Account for overhead required for: |
| 612 | * | 612 | * |
| 613 | * Tx command words 8 bytes | 613 | * Tx command words 8 bytes |
| 614 | * Start offset 15 bytes | 614 | * Start offset 15 bytes |
| 615 | * End padding 15 bytes | 615 | * End padding 15 bytes |
| 616 | */ | 616 | */ |
| 617 | if (unlikely(free < (skb->len + 8 + 15 + 15))) { | 617 | if (unlikely(free < (skb->len + 8 + 15 + 15))) { |
| 618 | printk("%s: No Tx free space %d < %d\n", | 618 | printk("%s: No Tx free space %d < %d\n", |
| 619 | dev->name, free, skb->len); | 619 | dev->name, free, skb->len); |
| 620 | lp->pending_tx_skb = NULL; | 620 | lp->pending_tx_skb = NULL; |
| 621 | lp->stats.tx_errors++; | 621 | lp->stats.tx_errors++; |
| @@ -623,11 +623,11 @@ static int smc911x_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 623 | dev_kfree_skb(skb); | 623 | dev_kfree_skb(skb); |
| 624 | return 0; | 624 | return 0; |
| 625 | } | 625 | } |
| 626 | 626 | ||
| 627 | #ifdef SMC_USE_DMA | 627 | #ifdef SMC_USE_DMA |
| 628 | { | 628 | { |
| 629 | /* If the DMA is already running then defer this packet Tx until | 629 | /* If the DMA is already running then defer this packet Tx until |
| 630 | * the DMA IRQ starts it | 630 | * the DMA IRQ starts it |
| 631 | */ | 631 | */ |
| 632 | spin_lock_irqsave(&lp->lock, flags); | 632 | spin_lock_irqsave(&lp->lock, flags); |
| 633 | if (lp->txdma_active) { | 633 | if (lp->txdma_active) { |
| @@ -660,23 +660,23 @@ static void smc911x_tx(struct net_device *dev) | |||
| 660 | struct smc911x_local *lp = netdev_priv(dev); | 660 | struct smc911x_local *lp = netdev_priv(dev); |
| 661 | unsigned int tx_status; | 661 | unsigned int tx_status; |
| 662 | 662 | ||
| 663 | DBG(SMC_DEBUG_FUNC | SMC_DEBUG_TX, "%s: --> %s\n", | 663 | DBG(SMC_DEBUG_FUNC | SMC_DEBUG_TX, "%s: --> %s\n", |
| 664 | dev->name, __FUNCTION__); | 664 | dev->name, __FUNCTION__); |
| 665 | 665 | ||
| 666 | /* Collect the TX status */ | 666 | /* Collect the TX status */ |
| 667 | while (((SMC_GET_TX_FIFO_INF() & TX_FIFO_INF_TSUSED_) >> 16) != 0) { | 667 | while (((SMC_GET_TX_FIFO_INF() & TX_FIFO_INF_TSUSED_) >> 16) != 0) { |
| 668 | DBG(SMC_DEBUG_TX, "%s: Tx stat FIFO used 0x%04x\n", | 668 | DBG(SMC_DEBUG_TX, "%s: Tx stat FIFO used 0x%04x\n", |
| 669 | dev->name, | 669 | dev->name, |
| 670 | (SMC_GET_TX_FIFO_INF() & TX_FIFO_INF_TSUSED_) >> 16); | 670 | (SMC_GET_TX_FIFO_INF() & TX_FIFO_INF_TSUSED_) >> 16); |
| 671 | tx_status = SMC_GET_TX_STS_FIFO(); | 671 | tx_status = SMC_GET_TX_STS_FIFO(); |
| 672 | lp->stats.tx_packets++; | 672 | lp->stats.tx_packets++; |
| 673 | lp->stats.tx_bytes+=tx_status>>16; | 673 | lp->stats.tx_bytes+=tx_status>>16; |
| 674 | DBG(SMC_DEBUG_TX, "%s: Tx FIFO tag 0x%04x status 0x%04x\n", | 674 | DBG(SMC_DEBUG_TX, "%s: Tx FIFO tag 0x%04x status 0x%04x\n", |
| 675 | dev->name, (tx_status & 0xffff0000) >> 16, | 675 | dev->name, (tx_status & 0xffff0000) >> 16, |
| 676 | tx_status & 0x0000ffff); | 676 | tx_status & 0x0000ffff); |
| 677 | /* count Tx errors, but ignore lost carrier errors when in | 677 | /* count Tx errors, but ignore lost carrier errors when in |
| 678 | * full-duplex mode */ | 678 | * full-duplex mode */ |
| 679 | if ((tx_status & TX_STS_ES_) && !(lp->ctl_rfduplx && | 679 | if ((tx_status & TX_STS_ES_) && !(lp->ctl_rfduplx && |
| 680 | !(tx_status & 0x00000306))) { | 680 | !(tx_status & 0x00000306))) { |
| 681 | lp->stats.tx_errors++; | 681 | lp->stats.tx_errors++; |
| 682 | } | 682 | } |
| @@ -687,10 +687,10 @@ static void smc911x_tx(struct net_device *dev) | |||
| 687 | lp->stats.collisions+=(tx_status & TX_STS_COLL_CNT_) >> 3; | 687 | lp->stats.collisions+=(tx_status & TX_STS_COLL_CNT_) >> 3; |
| 688 | } | 688 | } |
| 689 | /* carrier error only has meaning for half-duplex communication */ | 689 | /* carrier error only has meaning for half-duplex communication */ |
| 690 | if ((tx_status & (TX_STS_LOC_ | TX_STS_NO_CARR_)) && | 690 | if ((tx_status & (TX_STS_LOC_ | TX_STS_NO_CARR_)) && |
| 691 | !lp->ctl_rfduplx) { | 691 | !lp->ctl_rfduplx) { |
| 692 | lp->stats.tx_carrier_errors++; | 692 | lp->stats.tx_carrier_errors++; |
| 693 | } | 693 | } |
| 694 | if (tx_status & TX_STS_LATE_COLL_) { | 694 | if (tx_status & TX_STS_LATE_COLL_) { |
| 695 | lp->stats.collisions++; | 695 | lp->stats.collisions++; |
| 696 | lp->stats.tx_aborted_errors++; | 696 | lp->stats.tx_aborted_errors++; |
| @@ -753,7 +753,7 @@ static void smc911x_phy_detect(struct net_device *dev) | |||
| 753 | switch(lp->version) { | 753 | switch(lp->version) { |
| 754 | case 0x115: | 754 | case 0x115: |
| 755 | case 0x117: | 755 | case 0x117: |
| 756 | cfg = SMC_GET_HW_CFG(); | 756 | cfg = SMC_GET_HW_CFG(); |
| 757 | if (cfg & HW_CFG_EXT_PHY_DET_) { | 757 | if (cfg & HW_CFG_EXT_PHY_DET_) { |
| 758 | cfg &= ~HW_CFG_PHY_CLK_SEL_; | 758 | cfg &= ~HW_CFG_PHY_CLK_SEL_; |
| 759 | cfg |= HW_CFG_PHY_CLK_SEL_CLK_DIS_; | 759 | cfg |= HW_CFG_PHY_CLK_SEL_CLK_DIS_; |
| @@ -779,8 +779,8 @@ static void smc911x_phy_detect(struct net_device *dev) | |||
| 779 | SMC_GET_PHY_ID2(phyaddr & 31, id2); | 779 | SMC_GET_PHY_ID2(phyaddr & 31, id2); |
| 780 | 780 | ||
| 781 | /* Make sure it is a valid identifier */ | 781 | /* Make sure it is a valid identifier */ |
| 782 | if (id1 != 0x0000 && id1 != 0xffff && | 782 | if (id1 != 0x0000 && id1 != 0xffff && |
| 783 | id1 != 0x8000 && id2 != 0x0000 && | 783 | id1 != 0x8000 && id2 != 0x0000 && |
| 784 | id2 != 0xffff && id2 != 0x8000) { | 784 | id2 != 0xffff && id2 != 0x8000) { |
| 785 | /* Save the PHY's address */ | 785 | /* Save the PHY's address */ |
| 786 | lp->mii.phy_id = phyaddr & 31; | 786 | lp->mii.phy_id = phyaddr & 31; |
| @@ -875,9 +875,9 @@ static int smc911x_phy_reset(struct net_device *dev, int phy) | |||
| 875 | reg = SMC_GET_PMT_CTRL(); | 875 | reg = SMC_GET_PMT_CTRL(); |
| 876 | spin_unlock_irqrestore(&lp->lock, flags); | 876 | spin_unlock_irqrestore(&lp->lock, flags); |
| 877 | if (!(reg & PMT_CTRL_PHY_RST_)) { | 877 | if (!(reg & PMT_CTRL_PHY_RST_)) { |
| 878 | /* extra delay required because the phy may | 878 | /* extra delay required because the phy may |
| 879 | * not be completed with its reset | 879 | * not be completed with its reset |
| 880 | * when PHY_BCR_RESET_ is cleared. 256us | 880 | * when PHY_BCR_RESET_ is cleared. 256us |
| 881 | * should suffice, but use 500us to be safe | 881 | * should suffice, but use 500us to be safe |
| 882 | */ | 882 | */ |
| 883 | udelay(500); | 883 | udelay(500); |
| @@ -1064,9 +1064,9 @@ static void smc911x_phy_interrupt(struct net_device *dev) | |||
| 1064 | smc911x_phy_check_media(dev, 0); | 1064 | smc911x_phy_check_media(dev, 0); |
| 1065 | /* read to clear status bits */ | 1065 | /* read to clear status bits */ |
| 1066 | SMC_GET_PHY_INT_SRC(phyaddr,status); | 1066 | SMC_GET_PHY_INT_SRC(phyaddr,status); |
| 1067 | DBG(SMC_DEBUG_MISC, "%s: PHY interrupt status 0x%04x\n", | 1067 | DBG(SMC_DEBUG_MISC, "%s: PHY interrupt status 0x%04x\n", |
| 1068 | dev->name, status & 0xffff); | 1068 | dev->name, status & 0xffff); |
| 1069 | DBG(SMC_DEBUG_MISC, "%s: AFC_CFG 0x%08x\n", | 1069 | DBG(SMC_DEBUG_MISC, "%s: AFC_CFG 0x%08x\n", |
| 1070 | dev->name, SMC_GET_AFC_CFG()); | 1070 | dev->name, SMC_GET_AFC_CFG()); |
| 1071 | } | 1071 | } |
| 1072 | 1072 | ||
| @@ -1121,7 +1121,7 @@ static irqreturn_t smc911x_interrupt(int irq, void *dev_id, struct pt_regs *regs | |||
| 1121 | if (status & INT_STS_RXE_) { | 1121 | if (status & INT_STS_RXE_) { |
| 1122 | SMC_ACK_INT(INT_STS_RXE_); | 1122 | SMC_ACK_INT(INT_STS_RXE_); |
| 1123 | lp->stats.rx_errors++; | 1123 | lp->stats.rx_errors++; |
| 1124 | } | 1124 | } |
| 1125 | if (status & INT_STS_RXDFH_INT_) { | 1125 | if (status & INT_STS_RXDFH_INT_) { |
| 1126 | SMC_ACK_INT(INT_STS_RXDFH_INT_); | 1126 | SMC_ACK_INT(INT_STS_RXDFH_INT_); |
| 1127 | lp->stats.rx_dropped+=SMC_GET_RX_DROP(); | 1127 | lp->stats.rx_dropped+=SMC_GET_RX_DROP(); |
| @@ -1160,20 +1160,20 @@ static irqreturn_t smc911x_interrupt(int irq, void *dev_id, struct pt_regs *regs | |||
| 1160 | if ((status & INT_STS_RSFL_) || rx_overrun) { | 1160 | if ((status & INT_STS_RSFL_) || rx_overrun) { |
| 1161 | unsigned int fifo; | 1161 | unsigned int fifo; |
| 1162 | DBG(SMC_DEBUG_RX, "%s: RX irq\n", dev->name); | 1162 | DBG(SMC_DEBUG_RX, "%s: RX irq\n", dev->name); |
| 1163 | fifo = SMC_GET_RX_FIFO_INF(); | 1163 | fifo = SMC_GET_RX_FIFO_INF(); |
| 1164 | pkts = (fifo & RX_FIFO_INF_RXSUSED_) >> 16; | 1164 | pkts = (fifo & RX_FIFO_INF_RXSUSED_) >> 16; |
| 1165 | DBG(SMC_DEBUG_RX, "%s: Rx FIFO pkts %d, bytes %d\n", | 1165 | DBG(SMC_DEBUG_RX, "%s: Rx FIFO pkts %d, bytes %d\n", |
| 1166 | dev->name, pkts, fifo & 0xFFFF ); | 1166 | dev->name, pkts, fifo & 0xFFFF ); |
| 1167 | if (pkts != 0) { | 1167 | if (pkts != 0) { |
| 1168 | #ifdef SMC_USE_DMA | 1168 | #ifdef SMC_USE_DMA |
| 1169 | unsigned int fifo; | 1169 | unsigned int fifo; |
| 1170 | if (lp->rxdma_active){ | 1170 | if (lp->rxdma_active){ |
| 1171 | DBG(SMC_DEBUG_RX | SMC_DEBUG_DMA, | 1171 | DBG(SMC_DEBUG_RX | SMC_DEBUG_DMA, |
| 1172 | "%s: RX DMA active\n", dev->name); | 1172 | "%s: RX DMA active\n", dev->name); |
| 1173 | /* The DMA is already running so up the IRQ threshold */ | 1173 | /* The DMA is already running so up the IRQ threshold */ |
| 1174 | fifo = SMC_GET_FIFO_INT() & ~0xFF; | 1174 | fifo = SMC_GET_FIFO_INT() & ~0xFF; |
| 1175 | fifo |= pkts & 0xFF; | 1175 | fifo |= pkts & 0xFF; |
| 1176 | DBG(SMC_DEBUG_RX, | 1176 | DBG(SMC_DEBUG_RX, |
| 1177 | "%s: Setting RX stat FIFO threshold to %d\n", | 1177 | "%s: Setting RX stat FIFO threshold to %d\n", |
| 1178 | dev->name, fifo & 0xff); | 1178 | dev->name, fifo & 0xff); |
| 1179 | SMC_SET_FIFO_INT(fifo); | 1179 | SMC_SET_FIFO_INT(fifo); |
| @@ -1197,8 +1197,8 @@ static irqreturn_t smc911x_interrupt(int irq, void *dev_id, struct pt_regs *regs | |||
| 1197 | /* Handle transmit done condition */ | 1197 | /* Handle transmit done condition */ |
| 1198 | #if 1 | 1198 | #if 1 |
| 1199 | if (status & (INT_STS_TSFL_ | INT_STS_GPT_INT_)) { | 1199 | if (status & (INT_STS_TSFL_ | INT_STS_GPT_INT_)) { |
| 1200 | DBG(SMC_DEBUG_TX | SMC_DEBUG_MISC, | 1200 | DBG(SMC_DEBUG_TX | SMC_DEBUG_MISC, |
| 1201 | "%s: Tx stat FIFO limit (%d) /GPT irq\n", | 1201 | "%s: Tx stat FIFO limit (%d) /GPT irq\n", |
| 1202 | dev->name, (SMC_GET_FIFO_INT() & 0x00ff0000) >> 16); | 1202 | dev->name, (SMC_GET_FIFO_INT() & 0x00ff0000) >> 16); |
| 1203 | smc911x_tx(dev); | 1203 | smc911x_tx(dev); |
| 1204 | SMC_SET_GPT_CFG(GPT_CFG_TIMER_EN_ | 10000); | 1204 | SMC_SET_GPT_CFG(GPT_CFG_TIMER_EN_ | 10000); |
| @@ -1213,16 +1213,16 @@ static irqreturn_t smc911x_interrupt(int irq, void *dev_id, struct pt_regs *regs | |||
| 1213 | } | 1213 | } |
| 1214 | 1214 | ||
| 1215 | if (status & INT_STS_GPT_INT_) { | 1215 | if (status & INT_STS_GPT_INT_) { |
| 1216 | DBG(SMC_DEBUG_RX, "%s: IRQ_CFG 0x%08x FIFO_INT 0x%08x RX_CFG 0x%08x\n", | 1216 | DBG(SMC_DEBUG_RX, "%s: IRQ_CFG 0x%08x FIFO_INT 0x%08x RX_CFG 0x%08x\n", |
| 1217 | dev->name, | 1217 | dev->name, |
| 1218 | SMC_GET_IRQ_CFG(), | 1218 | SMC_GET_IRQ_CFG(), |
| 1219 | SMC_GET_FIFO_INT(), | 1219 | SMC_GET_FIFO_INT(), |
| 1220 | SMC_GET_RX_CFG()); | 1220 | SMC_GET_RX_CFG()); |
| 1221 | DBG(SMC_DEBUG_RX, "%s: Rx Stat FIFO Used 0x%02x " | 1221 | DBG(SMC_DEBUG_RX, "%s: Rx Stat FIFO Used 0x%02x " |
| 1222 | "Data FIFO Used 0x%04x Stat FIFO 0x%08x\n", | 1222 | "Data FIFO Used 0x%04x Stat FIFO 0x%08x\n", |
| 1223 | dev->name, | 1223 | dev->name, |
| 1224 | (SMC_GET_RX_FIFO_INF() & 0x00ff0000) >> 16, | 1224 | (SMC_GET_RX_FIFO_INF() & 0x00ff0000) >> 16, |
| 1225 | SMC_GET_RX_FIFO_INF() & 0xffff, | 1225 | SMC_GET_RX_FIFO_INF() & 0xffff, |
| 1226 | SMC_GET_RX_STS_FIFO_PEEK()); | 1226 | SMC_GET_RX_STS_FIFO_PEEK()); |
| 1227 | SMC_SET_GPT_CFG(GPT_CFG_TIMER_EN_ | 10000); | 1227 | SMC_SET_GPT_CFG(GPT_CFG_TIMER_EN_ | 10000); |
| 1228 | SMC_ACK_INT(INT_STS_GPT_INT_); | 1228 | SMC_ACK_INT(INT_STS_GPT_INT_); |
| @@ -1240,7 +1240,7 @@ static irqreturn_t smc911x_interrupt(int irq, void *dev_id, struct pt_regs *regs | |||
| 1240 | /* restore mask state */ | 1240 | /* restore mask state */ |
| 1241 | SMC_SET_INT_EN(mask); | 1241 | SMC_SET_INT_EN(mask); |
| 1242 | 1242 | ||
| 1243 | DBG(SMC_DEBUG_MISC, "%s: Interrupt done (%d loops)\n", | 1243 | DBG(SMC_DEBUG_MISC, "%s: Interrupt done (%d loops)\n", |
| 1244 | dev->name, 8-timeout); | 1244 | dev->name, 8-timeout); |
| 1245 | 1245 | ||
| 1246 | spin_unlock_irqrestore(&lp->lock, flags); | 1246 | spin_unlock_irqrestore(&lp->lock, flags); |
| @@ -1272,7 +1272,7 @@ smc911x_tx_dma_irq(int dma, void *data, struct pt_regs *regs) | |||
| 1272 | if (lp->pending_tx_skb != NULL) | 1272 | if (lp->pending_tx_skb != NULL) |
| 1273 | smc911x_hardware_send_pkt(dev); | 1273 | smc911x_hardware_send_pkt(dev); |
| 1274 | else { | 1274 | else { |
| 1275 | DBG(SMC_DEBUG_TX | SMC_DEBUG_DMA, | 1275 | DBG(SMC_DEBUG_TX | SMC_DEBUG_DMA, |
| 1276 | "%s: No pending Tx packets. DMA disabled\n", dev->name); | 1276 | "%s: No pending Tx packets. DMA disabled\n", dev->name); |
| 1277 | spin_lock_irqsave(&lp->lock, flags); | 1277 | spin_lock_irqsave(&lp->lock, flags); |
| 1278 | lp->txdma_active = 0; | 1278 | lp->txdma_active = 0; |
| @@ -1282,7 +1282,7 @@ smc911x_tx_dma_irq(int dma, void *data, struct pt_regs *regs) | |||
| 1282 | spin_unlock_irqrestore(&lp->lock, flags); | 1282 | spin_unlock_irqrestore(&lp->lock, flags); |
| 1283 | } | 1283 | } |
| 1284 | 1284 | ||
| 1285 | DBG(SMC_DEBUG_TX | SMC_DEBUG_DMA, | 1285 | DBG(SMC_DEBUG_TX | SMC_DEBUG_DMA, |
| 1286 | "%s: TX DMA irq completed\n", dev->name); | 1286 | "%s: TX DMA irq completed\n", dev->name); |
| 1287 | } | 1287 | } |
| 1288 | static void | 1288 | static void |
| @@ -1311,15 +1311,15 @@ smc911x_rx_dma_irq(int dma, void *data, struct pt_regs *regs) | |||
| 1311 | lp->stats.rx_bytes += skb->len; | 1311 | lp->stats.rx_bytes += skb->len; |
| 1312 | 1312 | ||
| 1313 | spin_lock_irqsave(&lp->lock, flags); | 1313 | spin_lock_irqsave(&lp->lock, flags); |
| 1314 | pkts = (SMC_GET_RX_FIFO_INF() & RX_FIFO_INF_RXSUSED_) >> 16; | 1314 | pkts = (SMC_GET_RX_FIFO_INF() & RX_FIFO_INF_RXSUSED_) >> 16; |
| 1315 | if (pkts != 0) { | 1315 | if (pkts != 0) { |
| 1316 | smc911x_rcv(dev); | 1316 | smc911x_rcv(dev); |
| 1317 | }else { | 1317 | }else { |
| 1318 | lp->rxdma_active = 0; | 1318 | lp->rxdma_active = 0; |
| 1319 | } | 1319 | } |
| 1320 | spin_unlock_irqrestore(&lp->lock, flags); | 1320 | spin_unlock_irqrestore(&lp->lock, flags); |
| 1321 | DBG(SMC_DEBUG_RX | SMC_DEBUG_DMA, | 1321 | DBG(SMC_DEBUG_RX | SMC_DEBUG_DMA, |
| 1322 | "%s: RX DMA irq completed. DMA RX FIFO PKTS %d\n", | 1322 | "%s: RX DMA irq completed. DMA RX FIFO PKTS %d\n", |
| 1323 | dev->name, pkts); | 1323 | dev->name, pkts); |
| 1324 | } | 1324 | } |
| 1325 | #endif /* SMC_USE_DMA */ | 1325 | #endif /* SMC_USE_DMA */ |
| @@ -1355,8 +1355,8 @@ static void smc911x_timeout(struct net_device *dev) | |||
| 1355 | dev->name, status, mask); | 1355 | dev->name, status, mask); |
| 1356 | 1356 | ||
| 1357 | /* Dump the current TX FIFO contents and restart */ | 1357 | /* Dump the current TX FIFO contents and restart */ |
| 1358 | mask = SMC_GET_TX_CFG(); | 1358 | mask = SMC_GET_TX_CFG(); |
| 1359 | SMC_SET_TX_CFG(mask | TX_CFG_TXS_DUMP_ | TX_CFG_TXD_DUMP_); | 1359 | SMC_SET_TX_CFG(mask | TX_CFG_TXS_DUMP_ | TX_CFG_TXD_DUMP_); |
| 1360 | /* | 1360 | /* |
| 1361 | * Reconfiguring the PHY doesn't seem like a bad idea here, but | 1361 | * Reconfiguring the PHY doesn't seem like a bad idea here, but |
| 1362 | * smc911x_phy_configure() calls msleep() which calls schedule_timeout() | 1362 | * smc911x_phy_configure() calls msleep() which calls schedule_timeout() |
| @@ -1387,7 +1387,7 @@ static void smc911x_set_multicast_list(struct net_device *dev) | |||
| 1387 | unsigned int mcr, update_multicast = 0; | 1387 | unsigned int mcr, update_multicast = 0; |
| 1388 | unsigned long flags; | 1388 | unsigned long flags; |
| 1389 | /* table for flipping the order of 5 bits */ | 1389 | /* table for flipping the order of 5 bits */ |
| 1390 | static const unsigned char invert5[] = | 1390 | static const unsigned char invert5[] = |
| 1391 | {0x00, 0x10, 0x08, 0x18, 0x04, 0x14, 0x0C, 0x1C, | 1391 | {0x00, 0x10, 0x08, 0x18, 0x04, 0x14, 0x0C, 0x1C, |
| 1392 | 0x02, 0x12, 0x0A, 0x1A, 0x06, 0x16, 0x0E, 0x1E, | 1392 | 0x02, 0x12, 0x0A, 0x1A, 0x06, 0x16, 0x0E, 0x1E, |
| 1393 | 0x01, 0x11, 0x09, 0x19, 0x05, 0x15, 0x0D, 0x1D, | 1393 | 0x01, 0x11, 0x09, 0x19, 0x05, 0x15, 0x0D, 0x1D, |
| @@ -1463,7 +1463,7 @@ static void smc911x_set_multicast_list(struct net_device *dev) | |||
| 1463 | /* now, the table can be loaded into the chipset */ | 1463 | /* now, the table can be loaded into the chipset */ |
| 1464 | update_multicast = 1; | 1464 | update_multicast = 1; |
| 1465 | } else { | 1465 | } else { |
| 1466 | DBG(SMC_DEBUG_MISC, "%s: ~(MAC_CR_PRMS_|MAC_CR_MCPAS_)\n", | 1466 | DBG(SMC_DEBUG_MISC, "%s: ~(MAC_CR_PRMS_|MAC_CR_MCPAS_)\n", |
| 1467 | dev->name); | 1467 | dev->name); |
| 1468 | mcr &= ~(MAC_CR_PRMS_ | MAC_CR_MCPAS_); | 1468 | mcr &= ~(MAC_CR_PRMS_ | MAC_CR_MCPAS_); |
| 1469 | 1469 | ||
| @@ -1478,8 +1478,8 @@ static void smc911x_set_multicast_list(struct net_device *dev) | |||
| 1478 | spin_lock_irqsave(&lp->lock, flags); | 1478 | spin_lock_irqsave(&lp->lock, flags); |
| 1479 | SMC_SET_MAC_CR(mcr); | 1479 | SMC_SET_MAC_CR(mcr); |
| 1480 | if (update_multicast) { | 1480 | if (update_multicast) { |
| 1481 | DBG(SMC_DEBUG_MISC, | 1481 | DBG(SMC_DEBUG_MISC, |
| 1482 | "%s: update mcast hash table 0x%08x 0x%08x\n", | 1482 | "%s: update mcast hash table 0x%08x 0x%08x\n", |
| 1483 | dev->name, multicast_table[0], multicast_table[1]); | 1483 | dev->name, multicast_table[0], multicast_table[1]); |
| 1484 | SMC_SET_HASHL(multicast_table[0]); | 1484 | SMC_SET_HASHL(multicast_table[0]); |
| 1485 | SMC_SET_HASHH(multicast_table[1]); | 1485 | SMC_SET_HASHH(multicast_table[1]); |
| @@ -1614,8 +1614,8 @@ smc911x_ethtool_getsettings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
| 1614 | cmd->transceiver = XCVR_EXTERNAL; | 1614 | cmd->transceiver = XCVR_EXTERNAL; |
| 1615 | cmd->port = 0; | 1615 | cmd->port = 0; |
| 1616 | SMC_GET_PHY_SPECIAL(lp->mii.phy_id, status); | 1616 | SMC_GET_PHY_SPECIAL(lp->mii.phy_id, status); |
| 1617 | cmd->duplex = | 1617 | cmd->duplex = |
| 1618 | (status & (PHY_SPECIAL_SPD_10FULL_ | PHY_SPECIAL_SPD_100FULL_)) ? | 1618 | (status & (PHY_SPECIAL_SPD_10FULL_ | PHY_SPECIAL_SPD_100FULL_)) ? |
| 1619 | DUPLEX_FULL : DUPLEX_HALF; | 1619 | DUPLEX_FULL : DUPLEX_HALF; |
| 1620 | ret = 0; | 1620 | ret = 0; |
| 1621 | } | 1621 | } |
| @@ -1687,11 +1687,11 @@ static void smc911x_ethtool_setmsglevel(struct net_device *dev, u32 level) | |||
| 1687 | static int smc911x_ethtool_getregslen(struct net_device *dev) | 1687 | static int smc911x_ethtool_getregslen(struct net_device *dev) |
| 1688 | { | 1688 | { |
| 1689 | /* System regs + MAC regs + PHY regs */ | 1689 | /* System regs + MAC regs + PHY regs */ |
| 1690 | return (((E2P_CMD - ID_REV)/4 + 1) + | 1690 | return (((E2P_CMD - ID_REV)/4 + 1) + |
| 1691 | (WUCSR - MAC_CR)+1 + 32) * sizeof(u32); | 1691 | (WUCSR - MAC_CR)+1 + 32) * sizeof(u32); |
| 1692 | } | 1692 | } |
| 1693 | 1693 | ||
| 1694 | static void smc911x_ethtool_getregs(struct net_device *dev, | 1694 | static void smc911x_ethtool_getregs(struct net_device *dev, |
| 1695 | struct ethtool_regs* regs, void *buf) | 1695 | struct ethtool_regs* regs, void *buf) |
| 1696 | { | 1696 | { |
| 1697 | unsigned long ioaddr = dev->base_addr; | 1697 | unsigned long ioaddr = dev->base_addr; |
| @@ -1702,19 +1702,19 @@ static void smc911x_ethtool_getregs(struct net_device *dev, | |||
| 1702 | 1702 | ||
| 1703 | regs->version = lp->version; | 1703 | regs->version = lp->version; |
| 1704 | for(i=ID_REV;i<=E2P_CMD;i+=4) { | 1704 | for(i=ID_REV;i<=E2P_CMD;i+=4) { |
| 1705 | data[j++] = SMC_inl(ioaddr,i); | 1705 | data[j++] = SMC_inl(ioaddr,i); |
| 1706 | } | 1706 | } |
| 1707 | for(i=MAC_CR;i<=WUCSR;i++) { | 1707 | for(i=MAC_CR;i<=WUCSR;i++) { |
| 1708 | spin_lock_irqsave(&lp->lock, flags); | 1708 | spin_lock_irqsave(&lp->lock, flags); |
| 1709 | SMC_GET_MAC_CSR(i, reg); | 1709 | SMC_GET_MAC_CSR(i, reg); |
| 1710 | spin_unlock_irqrestore(&lp->lock, flags); | 1710 | spin_unlock_irqrestore(&lp->lock, flags); |
| 1711 | data[j++] = reg; | 1711 | data[j++] = reg; |
| 1712 | } | 1712 | } |
| 1713 | for(i=0;i<=31;i++) { | 1713 | for(i=0;i<=31;i++) { |
| 1714 | spin_lock_irqsave(&lp->lock, flags); | 1714 | spin_lock_irqsave(&lp->lock, flags); |
| 1715 | SMC_GET_MII(i, lp->mii.phy_id, reg); | 1715 | SMC_GET_MII(i, lp->mii.phy_id, reg); |
| 1716 | spin_unlock_irqrestore(&lp->lock, flags); | 1716 | spin_unlock_irqrestore(&lp->lock, flags); |
| 1717 | data[j++] = reg & 0xFFFF; | 1717 | data[j++] = reg & 0xFFFF; |
| 1718 | } | 1718 | } |
| 1719 | } | 1719 | } |
| 1720 | 1720 | ||
| @@ -1727,60 +1727,60 @@ static int smc911x_ethtool_wait_eeprom_ready(struct net_device *dev) | |||
| 1727 | e2p_cmd = SMC_GET_E2P_CMD(); | 1727 | e2p_cmd = SMC_GET_E2P_CMD(); |
| 1728 | for(timeout=10;(e2p_cmd & E2P_CMD_EPC_BUSY_) && timeout; timeout--) { | 1728 | for(timeout=10;(e2p_cmd & E2P_CMD_EPC_BUSY_) && timeout; timeout--) { |
| 1729 | if (e2p_cmd & E2P_CMD_EPC_TIMEOUT_) { | 1729 | if (e2p_cmd & E2P_CMD_EPC_TIMEOUT_) { |
| 1730 | PRINTK("%s: %s timeout waiting for EEPROM to respond\n", | 1730 | PRINTK("%s: %s timeout waiting for EEPROM to respond\n", |
| 1731 | dev->name, __FUNCTION__); | 1731 | dev->name, __FUNCTION__); |
| 1732 | return -EFAULT; | 1732 | return -EFAULT; |
| 1733 | } | 1733 | } |
| 1734 | mdelay(1); | 1734 | mdelay(1); |
| 1735 | e2p_cmd = SMC_GET_E2P_CMD(); | 1735 | e2p_cmd = SMC_GET_E2P_CMD(); |
| 1736 | } | 1736 | } |
| 1737 | if (timeout == 0) { | 1737 | if (timeout == 0) { |
| 1738 | PRINTK("%s: %s timeout waiting for EEPROM CMD not busy\n", | 1738 | PRINTK("%s: %s timeout waiting for EEPROM CMD not busy\n", |
| 1739 | dev->name, __FUNCTION__); | 1739 | dev->name, __FUNCTION__); |
| 1740 | return -ETIMEDOUT; | 1740 | return -ETIMEDOUT; |
| 1741 | } | 1741 | } |
| 1742 | return 0; | 1742 | return 0; |
| 1743 | } | 1743 | } |
| 1744 | 1744 | ||
| 1745 | static inline int smc911x_ethtool_write_eeprom_cmd(struct net_device *dev, | 1745 | static inline int smc911x_ethtool_write_eeprom_cmd(struct net_device *dev, |
| 1746 | int cmd, int addr) | 1746 | int cmd, int addr) |
| 1747 | { | 1747 | { |
| 1748 | unsigned long ioaddr = dev->base_addr; | 1748 | unsigned long ioaddr = dev->base_addr; |
| 1749 | int ret; | 1749 | int ret; |
| 1750 | 1750 | ||
| 1751 | if ((ret = smc911x_ethtool_wait_eeprom_ready(dev))!=0) | 1751 | if ((ret = smc911x_ethtool_wait_eeprom_ready(dev))!=0) |
| 1752 | return ret; | 1752 | return ret; |
| 1753 | SMC_SET_E2P_CMD(E2P_CMD_EPC_BUSY_ | | 1753 | SMC_SET_E2P_CMD(E2P_CMD_EPC_BUSY_ | |
| 1754 | ((cmd) & (0x7<<28)) | | 1754 | ((cmd) & (0x7<<28)) | |
| 1755 | ((addr) & 0xFF)); | 1755 | ((addr) & 0xFF)); |
| 1756 | return 0; | 1756 | return 0; |
| 1757 | } | 1757 | } |
| 1758 | 1758 | ||
| 1759 | static inline int smc911x_ethtool_read_eeprom_byte(struct net_device *dev, | 1759 | static inline int smc911x_ethtool_read_eeprom_byte(struct net_device *dev, |
| 1760 | u8 *data) | 1760 | u8 *data) |
| 1761 | { | 1761 | { |
| 1762 | unsigned long ioaddr = dev->base_addr; | 1762 | unsigned long ioaddr = dev->base_addr; |
| 1763 | int ret; | 1763 | int ret; |
| 1764 | 1764 | ||
| 1765 | if ((ret = smc911x_ethtool_wait_eeprom_ready(dev))!=0) | 1765 | if ((ret = smc911x_ethtool_wait_eeprom_ready(dev))!=0) |
| 1766 | return ret; | 1766 | return ret; |
| 1767 | *data = SMC_GET_E2P_DATA(); | 1767 | *data = SMC_GET_E2P_DATA(); |
| 1768 | return 0; | 1768 | return 0; |
| 1769 | } | 1769 | } |
| 1770 | 1770 | ||
| 1771 | static inline int smc911x_ethtool_write_eeprom_byte(struct net_device *dev, | 1771 | static inline int smc911x_ethtool_write_eeprom_byte(struct net_device *dev, |
| 1772 | u8 data) | 1772 | u8 data) |
| 1773 | { | 1773 | { |
| 1774 | unsigned long ioaddr = dev->base_addr; | 1774 | unsigned long ioaddr = dev->base_addr; |
| 1775 | int ret; | 1775 | int ret; |
| 1776 | 1776 | ||
| 1777 | if ((ret = smc911x_ethtool_wait_eeprom_ready(dev))!=0) | 1777 | if ((ret = smc911x_ethtool_wait_eeprom_ready(dev))!=0) |
| 1778 | return ret; | 1778 | return ret; |
| 1779 | SMC_SET_E2P_DATA(data); | 1779 | SMC_SET_E2P_DATA(data); |
| 1780 | return 0; | 1780 | return 0; |
| 1781 | } | 1781 | } |
| 1782 | 1782 | ||
| 1783 | static int smc911x_ethtool_geteeprom(struct net_device *dev, | 1783 | static int smc911x_ethtool_geteeprom(struct net_device *dev, |
| 1784 | struct ethtool_eeprom *eeprom, u8 *data) | 1784 | struct ethtool_eeprom *eeprom, u8 *data) |
| 1785 | { | 1785 | { |
| 1786 | u8 eebuf[SMC911X_EEPROM_LEN]; | 1786 | u8 eebuf[SMC911X_EEPROM_LEN]; |
| @@ -1793,10 +1793,10 @@ static int smc911x_ethtool_geteeprom(struct net_device *dev, | |||
| 1793 | return ret; | 1793 | return ret; |
| 1794 | } | 1794 | } |
| 1795 | memcpy(data, eebuf+eeprom->offset, eeprom->len); | 1795 | memcpy(data, eebuf+eeprom->offset, eeprom->len); |
| 1796 | return 0; | 1796 | return 0; |
| 1797 | } | 1797 | } |
| 1798 | 1798 | ||
| 1799 | static int smc911x_ethtool_seteeprom(struct net_device *dev, | 1799 | static int smc911x_ethtool_seteeprom(struct net_device *dev, |
| 1800 | struct ethtool_eeprom *eeprom, u8 *data) | 1800 | struct ethtool_eeprom *eeprom, u8 *data) |
| 1801 | { | 1801 | { |
| 1802 | int i, ret; | 1802 | int i, ret; |
| @@ -1953,7 +1953,7 @@ static int __init smc911x_probe(struct net_device *dev, unsigned long ioaddr) | |||
| 1953 | retval = -EINVAL; | 1953 | retval = -EINVAL; |
| 1954 | goto err_out; | 1954 | goto err_out; |
| 1955 | } | 1955 | } |
| 1956 | 1956 | ||
| 1957 | /* fill in some of the fields */ | 1957 | /* fill in some of the fields */ |
| 1958 | dev->base_addr = ioaddr; | 1958 | dev->base_addr = ioaddr; |
| 1959 | lp->version = chip_ids[i].id; | 1959 | lp->version = chip_ids[i].id; |
| @@ -1965,7 +1965,7 @@ static int __init smc911x_probe(struct net_device *dev, unsigned long ioaddr) | |||
| 1965 | 1965 | ||
| 1966 | /* Set the automatic flow control values */ | 1966 | /* Set the automatic flow control values */ |
| 1967 | switch(lp->tx_fifo_kb) { | 1967 | switch(lp->tx_fifo_kb) { |
| 1968 | /* | 1968 | /* |
| 1969 | * AFC_HI is about ((Rx Data Fifo Size)*2/3)/64 | 1969 | * AFC_HI is about ((Rx Data Fifo Size)*2/3)/64 |
| 1970 | * AFC_LO is AFC_HI/2 | 1970 | * AFC_LO is AFC_HI/2 |
| 1971 | * BACK_DUR is about 5uS*(AFC_LO) rounded down | 1971 | * BACK_DUR is about 5uS*(AFC_LO) rounded down |
| @@ -1990,7 +1990,7 @@ static int __init smc911x_probe(struct net_device *dev, unsigned long ioaddr) | |||
| 1990 | lp->afc_cfg=0x003C1E6F;break; | 1990 | lp->afc_cfg=0x003C1E6F;break; |
| 1991 | case 11:/* 4800 Rx Data Fifo Size */ | 1991 | case 11:/* 4800 Rx Data Fifo Size */ |
| 1992 | lp->afc_cfg=0x0032195F;break; | 1992 | lp->afc_cfg=0x0032195F;break; |
| 1993 | /* | 1993 | /* |
| 1994 | * AFC_HI is ~1520 bytes less than RX Data Fifo Size | 1994 | * AFC_HI is ~1520 bytes less than RX Data Fifo Size |
| 1995 | * AFC_LO is AFC_HI/2 | 1995 | * AFC_LO is AFC_HI/2 |
| 1996 | * BACK_DUR is about 5uS*(AFC_LO) rounded down | 1996 | * BACK_DUR is about 5uS*(AFC_LO) rounded down |
| @@ -2002,13 +2002,13 @@ static int __init smc911x_probe(struct net_device *dev, unsigned long ioaddr) | |||
| 2002 | case 14:/* 1920 Rx Data Fifo Size */ | 2002 | case 14:/* 1920 Rx Data Fifo Size */ |
| 2003 | lp->afc_cfg=0x0006032F;break; | 2003 | lp->afc_cfg=0x0006032F;break; |
| 2004 | default: | 2004 | default: |
| 2005 | PRINTK("%s: ERROR -- no AFC_CFG setting found", | 2005 | PRINTK("%s: ERROR -- no AFC_CFG setting found", |
| 2006 | dev->name); | 2006 | dev->name); |
| 2007 | break; | 2007 | break; |
| 2008 | } | 2008 | } |
| 2009 | 2009 | ||
| 2010 | DBG(SMC_DEBUG_MISC | SMC_DEBUG_TX | SMC_DEBUG_RX, | 2010 | DBG(SMC_DEBUG_MISC | SMC_DEBUG_TX | SMC_DEBUG_RX, |
| 2011 | "%s: tx_fifo %d rx_fifo %d afc_cfg 0x%08x\n", CARDNAME, | 2011 | "%s: tx_fifo %d rx_fifo %d afc_cfg 0x%08x\n", CARDNAME, |
| 2012 | lp->tx_fifo_size, lp->rx_fifo_size, lp->afc_cfg); | 2012 | lp->tx_fifo_size, lp->rx_fifo_size, lp->afc_cfg); |
| 2013 | 2013 | ||
| 2014 | spin_lock_init(&lp->lock); | 2014 | spin_lock_init(&lp->lock); |
| @@ -2129,7 +2129,7 @@ static int __init smc911x_probe(struct net_device *dev, unsigned long ioaddr) | |||
| 2129 | PRINTK("%s: External PHY 0x%08x\n", dev->name, lp->phy_type); | 2129 | PRINTK("%s: External PHY 0x%08x\n", dev->name, lp->phy_type); |
| 2130 | } | 2130 | } |
| 2131 | } | 2131 | } |
| 2132 | 2132 | ||
| 2133 | err_out: | 2133 | err_out: |
| 2134 | #ifdef SMC_USE_DMA | 2134 | #ifdef SMC_USE_DMA |
| 2135 | if (retval) { | 2135 | if (retval) { |
| @@ -2292,7 +2292,7 @@ static struct platform_driver smc911x_driver = { | |||
| 2292 | .name = CARDNAME, | 2292 | .name = CARDNAME, |
| 2293 | }, | 2293 | }, |
| 2294 | }; | 2294 | }; |
| 2295 | 2295 | ||
| 2296 | static int __init smc911x_init(void) | 2296 | static int __init smc911x_init(void) |
| 2297 | { | 2297 | { |
| 2298 | return platform_driver_register(&smc911x_driver); | 2298 | return platform_driver_register(&smc911x_driver); |
diff --git a/drivers/net/smc911x.h b/drivers/net/smc911x.h index 0779a228d5a1..962a710459fc 100644 --- a/drivers/net/smc911x.h +++ b/drivers/net/smc911x.h | |||
| @@ -73,13 +73,13 @@ | |||
| 73 | #if SMC_USE_PXA_DMA | 73 | #if SMC_USE_PXA_DMA |
| 74 | #define SMC_USE_DMA | 74 | #define SMC_USE_DMA |
| 75 | 75 | ||
| 76 | /* | 76 | /* |
| 77 | * Define the request and free functions | 77 | * Define the request and free functions |
| 78 | * These are unfortunately architecture specific as no generic allocation | 78 | * These are unfortunately architecture specific as no generic allocation |
| 79 | * mechanism exits | 79 | * mechanism exits |
| 80 | */ | 80 | */ |
| 81 | #define SMC_DMA_REQUEST(dev, handler) \ | 81 | #define SMC_DMA_REQUEST(dev, handler) \ |
| 82 | pxa_request_dma(dev->name, DMA_PRIO_LOW, handler, dev) | 82 | pxa_request_dma(dev->name, DMA_PRIO_LOW, handler, dev) |
| 83 | 83 | ||
| 84 | #define SMC_DMA_FREE(dev, dma) \ | 84 | #define SMC_DMA_FREE(dev, dma) \ |
| 85 | pxa_free_dma(dma) | 85 | pxa_free_dma(dma) |
| @@ -101,14 +101,14 @@ | |||
| 101 | 101 | ||
| 102 | static dma_addr_t rx_dmabuf, tx_dmabuf; | 102 | static dma_addr_t rx_dmabuf, tx_dmabuf; |
| 103 | static int rx_dmalen, tx_dmalen; | 103 | static int rx_dmalen, tx_dmalen; |
| 104 | 104 | ||
| 105 | #ifdef SMC_insl | 105 | #ifdef SMC_insl |
| 106 | #undef SMC_insl | 106 | #undef SMC_insl |
| 107 | #define SMC_insl(a, r, p, l) \ | 107 | #define SMC_insl(a, r, p, l) \ |
| 108 | smc_pxa_dma_insl(lp->dev, a, lp->physaddr, r, lp->rxdma, p, l) | 108 | smc_pxa_dma_insl(lp->dev, a, lp->physaddr, r, lp->rxdma, p, l) |
| 109 | 109 | ||
| 110 | static inline void | 110 | static inline void |
| 111 | smc_pxa_dma_insl(struct device *dev, u_long ioaddr, u_long physaddr, | 111 | smc_pxa_dma_insl(struct device *dev, u_long ioaddr, u_long physaddr, |
| 112 | int reg, int dma, u_char *buf, int len) | 112 | int reg, int dma, u_char *buf, int len) |
| 113 | { | 113 | { |
| 114 | /* 64 bit alignment is required for memory to memory DMA */ | 114 | /* 64 bit alignment is required for memory to memory DMA */ |
| @@ -136,7 +136,7 @@ smc_pxa_dma_insl(struct device *dev, u_long ioaddr, u_long physaddr, | |||
| 136 | smc_pxa_dma_insw(lp->dev, a, lp->physaddr, r, lp->rxdma, p, l) | 136 | smc_pxa_dma_insw(lp->dev, a, lp->physaddr, r, lp->rxdma, p, l) |
| 137 | 137 | ||
| 138 | static inline void | 138 | static inline void |
| 139 | smc_pxa_dma_insw(struct device *dev, u_long ioaddr, u_long physaddr, | 139 | smc_pxa_dma_insw(struct device *dev, u_long ioaddr, u_long physaddr, |
| 140 | int reg, int dma, u_char *buf, int len) | 140 | int reg, int dma, u_char *buf, int len) |
| 141 | { | 141 | { |
| 142 | /* 64 bit alignment is required for memory to memory DMA */ | 142 | /* 64 bit alignment is required for memory to memory DMA */ |
| @@ -164,7 +164,7 @@ smc_pxa_dma_insw(struct device *dev, u_long ioaddr, u_long physaddr, | |||
| 164 | smc_pxa_dma_outsl(lp->dev, a, lp->physaddr, r, lp->txdma, p, l) | 164 | smc_pxa_dma_outsl(lp->dev, a, lp->physaddr, r, lp->txdma, p, l) |
| 165 | 165 | ||
| 166 | static inline void | 166 | static inline void |
| 167 | smc_pxa_dma_outsl(struct device *dev, u_long ioaddr, u_long physaddr, | 167 | smc_pxa_dma_outsl(struct device *dev, u_long ioaddr, u_long physaddr, |
| 168 | int reg, int dma, u_char *buf, int len) | 168 | int reg, int dma, u_char *buf, int len) |
| 169 | { | 169 | { |
| 170 | /* 64 bit alignment is required for memory to memory DMA */ | 170 | /* 64 bit alignment is required for memory to memory DMA */ |
| @@ -192,7 +192,7 @@ smc_pxa_dma_outsl(struct device *dev, u_long ioaddr, u_long physaddr, | |||
| 192 | smc_pxa_dma_outsw(lp->dev, a, lp->physaddr, r, lp->txdma, p, l) | 192 | smc_pxa_dma_outsw(lp->dev, a, lp->physaddr, r, lp->txdma, p, l) |
| 193 | 193 | ||
| 194 | static inline void | 194 | static inline void |
| 195 | smc_pxa_dma_outsw(struct device *dev, u_long ioaddr, u_long physaddr, | 195 | smc_pxa_dma_outsw(struct device *dev, u_long ioaddr, u_long physaddr, |
| 196 | int reg, int dma, u_char *buf, int len) | 196 | int reg, int dma, u_char *buf, int len) |
| 197 | { | 197 | { |
| 198 | /* 64 bit alignment is required for memory to memory DMA */ | 198 | /* 64 bit alignment is required for memory to memory DMA */ |
| @@ -607,7 +607,7 @@ struct chip_id { | |||
| 607 | u16 id; | 607 | u16 id; |
| 608 | char *name; | 608 | char *name; |
| 609 | }; | 609 | }; |
| 610 | 610 | ||
| 611 | static const struct chip_id chip_ids[] = { | 611 | static const struct chip_id chip_ids[] = { |
| 612 | { CHIP_9115, "LAN9115" }, | 612 | { CHIP_9115, "LAN9115" }, |
| 613 | { CHIP_9116, "LAN9116" }, | 613 | { CHIP_9116, "LAN9116" }, |
