diff options
author | <jgarzik@pretzel.yyz.us> | 2005-06-04 17:15:04 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-06-04 17:15:04 -0400 |
commit | 1a9505996dd0c12a2e56d2c6af00846e75a3850d (patch) | |
tree | 311e431cad5a6acd09442d92fed36c1bd4d0c54c /drivers | |
parent | bdb7a3427be1e31327df0543cc397bf3c994b039 (diff) | |
parent | ea9375607f8b312cf4389d68909330ed32a622ef (diff) |
Automatic merge of /spare/repo/netdev-2.6 branch smc91x
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/smc91x.c | 58 | ||||
-rw-r--r-- | drivers/net/smc91x.h | 15 |
2 files changed, 37 insertions, 36 deletions
diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c index 5e561ba44333..fd80048f7f7a 100644 --- a/drivers/net/smc91x.c +++ b/drivers/net/smc91x.c | |||
@@ -129,7 +129,7 @@ MODULE_PARM_DESC(nowait, "set to 1 for no wait state"); | |||
129 | /* | 129 | /* |
130 | * Transmit timeout, default 5 seconds. | 130 | * Transmit timeout, default 5 seconds. |
131 | */ | 131 | */ |
132 | static int watchdog = 5000; | 132 | static int watchdog = 1000; |
133 | module_param(watchdog, int, 0400); | 133 | module_param(watchdog, int, 0400); |
134 | MODULE_PARM_DESC(watchdog, "transmit timeout in milliseconds"); | 134 | MODULE_PARM_DESC(watchdog, "transmit timeout in milliseconds"); |
135 | 135 | ||
@@ -660,15 +660,14 @@ static void smc_hardware_send_pkt(unsigned long data) | |||
660 | SMC_outw(((len & 1) ? (0x2000 | buf[len-1]) : 0), ioaddr, DATA_REG); | 660 | SMC_outw(((len & 1) ? (0x2000 | buf[len-1]) : 0), ioaddr, DATA_REG); |
661 | 661 | ||
662 | /* | 662 | /* |
663 | * If THROTTLE_TX_PKTS is set, we look at the TX_EMPTY flag | 663 | * If THROTTLE_TX_PKTS is set, we stop the queue here. This will |
664 | * before queueing this packet for TX, and if it's clear then | 664 | * have the effect of having at most one packet queued for TX |
665 | * we stop the queue here. This will have the effect of | 665 | * in the chip's memory at all time. |
666 | * having at most 2 packets queued for TX in the chip's memory | 666 | * |
667 | * at all time. If THROTTLE_TX_PKTS is not set then the queue | 667 | * If THROTTLE_TX_PKTS is not set then the queue is stopped only |
668 | * is stopped only when memory allocation (MC_ALLOC) does not | 668 | * when memory allocation (MC_ALLOC) does not succeed right away. |
669 | * succeed right away. | ||
670 | */ | 669 | */ |
671 | if (THROTTLE_TX_PKTS && !(SMC_GET_INT() & IM_TX_EMPTY_INT)) | 670 | if (THROTTLE_TX_PKTS) |
672 | netif_stop_queue(dev); | 671 | netif_stop_queue(dev); |
673 | 672 | ||
674 | /* queue the packet for TX */ | 673 | /* queue the packet for TX */ |
@@ -792,17 +791,20 @@ static void smc_tx(struct net_device *dev) | |||
792 | DBG(2, "%s: TX STATUS 0x%04x PNR 0x%02x\n", | 791 | DBG(2, "%s: TX STATUS 0x%04x PNR 0x%02x\n", |
793 | dev->name, tx_status, packet_no); | 792 | dev->name, tx_status, packet_no); |
794 | 793 | ||
795 | if (!(tx_status & TS_SUCCESS)) | 794 | if (!(tx_status & ES_TX_SUC)) |
796 | lp->stats.tx_errors++; | 795 | lp->stats.tx_errors++; |
797 | if (tx_status & TS_LOSTCAR) | 796 | |
797 | if (tx_status & ES_LOSTCARR) | ||
798 | lp->stats.tx_carrier_errors++; | 798 | lp->stats.tx_carrier_errors++; |
799 | 799 | ||
800 | if (tx_status & TS_LATCOL) { | 800 | if (tx_status & (ES_LATCOL | ES_16COL)) { |
801 | PRINTK("%s: late collision occurred on last xmit\n", dev->name); | 801 | PRINTK("%s: %s occurred on last xmit\n", dev->name, |
802 | (tx_status & ES_LATCOL) ? | ||
803 | "late collision" : "too many collisions"); | ||
802 | lp->stats.tx_window_errors++; | 804 | lp->stats.tx_window_errors++; |
803 | if (!(lp->stats.tx_window_errors & 63) && net_ratelimit()) { | 805 | if (!(lp->stats.tx_window_errors & 63) && net_ratelimit()) { |
804 | printk(KERN_INFO "%s: unexpectedly large numbers of " | 806 | printk(KERN_INFO "%s: unexpectedly large number of " |
805 | "late collisions. Please check duplex " | 807 | "bad collisions. Please check duplex " |
806 | "setting.\n", dev->name); | 808 | "setting.\n", dev->name); |
807 | } | 809 | } |
808 | } | 810 | } |
@@ -1236,7 +1238,7 @@ static void smc_10bt_check_media(struct net_device *dev, int init) | |||
1236 | old_carrier = netif_carrier_ok(dev) ? 1 : 0; | 1238 | old_carrier = netif_carrier_ok(dev) ? 1 : 0; |
1237 | 1239 | ||
1238 | SMC_SELECT_BANK(0); | 1240 | SMC_SELECT_BANK(0); |
1239 | new_carrier = SMC_inw(ioaddr, EPH_STATUS_REG) & ES_LINK_OK ? 1 : 0; | 1241 | new_carrier = (SMC_GET_EPH_STATUS() & ES_LINK_OK) ? 1 : 0; |
1240 | SMC_SELECT_BANK(2); | 1242 | SMC_SELECT_BANK(2); |
1241 | 1243 | ||
1242 | if (init || (old_carrier != new_carrier)) { | 1244 | if (init || (old_carrier != new_carrier)) { |
@@ -1308,15 +1310,16 @@ static irqreturn_t smc_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
1308 | if (!status) | 1310 | if (!status) |
1309 | break; | 1311 | break; |
1310 | 1312 | ||
1311 | if (status & IM_RCV_INT) { | 1313 | if (status & IM_TX_INT) { |
1312 | DBG(3, "%s: RX irq\n", dev->name); | 1314 | /* do this before RX as it will free memory quickly */ |
1313 | smc_rcv(dev); | ||
1314 | } else if (status & IM_TX_INT) { | ||
1315 | DBG(3, "%s: TX int\n", dev->name); | 1315 | DBG(3, "%s: TX int\n", dev->name); |
1316 | smc_tx(dev); | 1316 | smc_tx(dev); |
1317 | SMC_ACK_INT(IM_TX_INT); | 1317 | SMC_ACK_INT(IM_TX_INT); |
1318 | if (THROTTLE_TX_PKTS) | 1318 | if (THROTTLE_TX_PKTS) |
1319 | netif_wake_queue(dev); | 1319 | netif_wake_queue(dev); |
1320 | } else if (status & IM_RCV_INT) { | ||
1321 | DBG(3, "%s: RX irq\n", dev->name); | ||
1322 | smc_rcv(dev); | ||
1320 | } else if (status & IM_ALLOC_INT) { | 1323 | } else if (status & IM_ALLOC_INT) { |
1321 | DBG(3, "%s: Allocation irq\n", dev->name); | 1324 | DBG(3, "%s: Allocation irq\n", dev->name); |
1322 | tasklet_hi_schedule(&lp->tx_task); | 1325 | tasklet_hi_schedule(&lp->tx_task); |
@@ -1337,7 +1340,10 @@ static irqreturn_t smc_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
1337 | /* multiple collisions */ | 1340 | /* multiple collisions */ |
1338 | lp->stats.collisions += card_stats & 0xF; | 1341 | lp->stats.collisions += card_stats & 0xF; |
1339 | } else if (status & IM_RX_OVRN_INT) { | 1342 | } else if (status & IM_RX_OVRN_INT) { |
1340 | DBG(1, "%s: RX overrun\n", dev->name); | 1343 | DBG(1, "%s: RX overrun (EPH_ST 0x%04x)\n", dev->name, |
1344 | ({ int eph_st; SMC_SELECT_BANK(0); | ||
1345 | eph_st = SMC_GET_EPH_STATUS(); | ||
1346 | SMC_SELECT_BANK(2); eph_st; }) ); | ||
1341 | SMC_ACK_INT(IM_RX_OVRN_INT); | 1347 | SMC_ACK_INT(IM_RX_OVRN_INT); |
1342 | lp->stats.rx_errors++; | 1348 | lp->stats.rx_errors++; |
1343 | lp->stats.rx_fifo_errors++; | 1349 | lp->stats.rx_fifo_errors++; |
@@ -1389,7 +1395,7 @@ static void smc_timeout(struct net_device *dev) | |||
1389 | { | 1395 | { |
1390 | struct smc_local *lp = netdev_priv(dev); | 1396 | struct smc_local *lp = netdev_priv(dev); |
1391 | void __iomem *ioaddr = lp->base; | 1397 | void __iomem *ioaddr = lp->base; |
1392 | int status, mask, meminfo, fifo; | 1398 | int status, mask, eph_st, meminfo, fifo; |
1393 | 1399 | ||
1394 | DBG(2, "%s: %s\n", dev->name, __FUNCTION__); | 1400 | DBG(2, "%s: %s\n", dev->name, __FUNCTION__); |
1395 | 1401 | ||
@@ -1398,11 +1404,13 @@ static void smc_timeout(struct net_device *dev) | |||
1398 | mask = SMC_GET_INT_MASK(); | 1404 | mask = SMC_GET_INT_MASK(); |
1399 | fifo = SMC_GET_FIFO(); | 1405 | fifo = SMC_GET_FIFO(); |
1400 | SMC_SELECT_BANK(0); | 1406 | SMC_SELECT_BANK(0); |
1407 | eph_st = SMC_GET_EPH_STATUS(); | ||
1401 | meminfo = SMC_GET_MIR(); | 1408 | meminfo = SMC_GET_MIR(); |
1402 | SMC_SELECT_BANK(2); | 1409 | SMC_SELECT_BANK(2); |
1403 | spin_unlock_irq(&lp->lock); | 1410 | spin_unlock_irq(&lp->lock); |
1404 | PRINTK( "%s: INT 0x%02x MASK 0x%02x MEM 0x%04x FIFO 0x%04x\n", | 1411 | PRINTK( "%s: TX timeout (INT 0x%02x INTMASK 0x%02x " |
1405 | dev->name, status, mask, meminfo, fifo ); | 1412 | "MEM 0x%04x FIFO 0x%04x EPH_ST 0x%04x)\n", |
1413 | dev->name, status, mask, meminfo, fifo, eph_st ); | ||
1406 | 1414 | ||
1407 | smc_reset(dev); | 1415 | smc_reset(dev); |
1408 | smc_enable(dev); | 1416 | smc_enable(dev); |
@@ -1863,7 +1871,7 @@ static int __init smc_probe(struct net_device *dev, void __iomem *ioaddr) | |||
1863 | SMC_SELECT_BANK(1); | 1871 | SMC_SELECT_BANK(1); |
1864 | val = SMC_GET_BASE(); | 1872 | val = SMC_GET_BASE(); |
1865 | val = ((val & 0x1F00) >> 3) << SMC_IO_SHIFT; | 1873 | val = ((val & 0x1F00) >> 3) << SMC_IO_SHIFT; |
1866 | if (((unsigned long)ioaddr & ((PAGE_SIZE-1)<<SMC_IO_SHIFT)) != val) { /*XXX: WTF? */ | 1874 | if (((unsigned int)ioaddr & (0x3e0 << SMC_IO_SHIFT)) != val) { |
1867 | printk("%s: IOADDR %p doesn't match configuration (%x).\n", | 1875 | printk("%s: IOADDR %p doesn't match configuration (%x).\n", |
1868 | CARDNAME, ioaddr, val); | 1876 | CARDNAME, ioaddr, val); |
1869 | } | 1877 | } |
diff --git a/drivers/net/smc91x.h b/drivers/net/smc91x.h index ddd2688e7d33..946528e6b742 100644 --- a/drivers/net/smc91x.h +++ b/drivers/net/smc91x.h | |||
@@ -151,7 +151,7 @@ | |||
151 | 151 | ||
152 | /* We actually can't write halfwords properly if not word aligned */ | 152 | /* We actually can't write halfwords properly if not word aligned */ |
153 | static inline void | 153 | static inline void |
154 | SMC_outw(u16 val, unsigned long ioaddr, int reg) | 154 | SMC_outw(u16 val, void __iomem *ioaddr, int reg) |
155 | { | 155 | { |
156 | if (reg & 2) { | 156 | if (reg & 2) { |
157 | unsigned int v = val << 16; | 157 | unsigned int v = val << 16; |
@@ -317,7 +317,7 @@ static inline void SMC_outsw (unsigned long a, int r, unsigned char* p, int l) | |||
317 | #define SMC_insl(a, r, p, l) \ | 317 | #define SMC_insl(a, r, p, l) \ |
318 | smc_pxa_dma_insl(a, lp->physaddr, r, dev->dma, p, l) | 318 | smc_pxa_dma_insl(a, lp->physaddr, r, dev->dma, p, l) |
319 | static inline void | 319 | static inline void |
320 | smc_pxa_dma_insl(u_long ioaddr, u_long physaddr, int reg, int dma, | 320 | smc_pxa_dma_insl(void __iomem *ioaddr, u_long physaddr, int reg, int dma, |
321 | u_char *buf, int len) | 321 | u_char *buf, int len) |
322 | { | 322 | { |
323 | dma_addr_t dmabuf; | 323 | dma_addr_t dmabuf; |
@@ -355,7 +355,7 @@ smc_pxa_dma_insl(u_long ioaddr, u_long physaddr, int reg, int dma, | |||
355 | #define SMC_insw(a, r, p, l) \ | 355 | #define SMC_insw(a, r, p, l) \ |
356 | smc_pxa_dma_insw(a, lp->physaddr, r, dev->dma, p, l) | 356 | smc_pxa_dma_insw(a, lp->physaddr, r, dev->dma, p, l) |
357 | static inline void | 357 | static inline void |
358 | smc_pxa_dma_insw(u_long ioaddr, u_long physaddr, int reg, int dma, | 358 | smc_pxa_dma_insw(void __iomem *ioaddr, u_long physaddr, int reg, int dma, |
359 | u_char *buf, int len) | 359 | u_char *buf, int len) |
360 | { | 360 | { |
361 | dma_addr_t dmabuf; | 361 | dma_addr_t dmabuf; |
@@ -681,14 +681,6 @@ static const char * chip_ids[ 16 ] = { | |||
681 | 681 | ||
682 | 682 | ||
683 | /* | 683 | /* |
684 | . Transmit status bits | ||
685 | */ | ||
686 | #define TS_SUCCESS 0x0001 | ||
687 | #define TS_LOSTCAR 0x0400 | ||
688 | #define TS_LATCOL 0x0200 | ||
689 | #define TS_16COL 0x0010 | ||
690 | |||
691 | /* | ||
692 | . Receive status bits | 684 | . Receive status bits |
693 | */ | 685 | */ |
694 | #define RS_ALGNERR 0x8000 | 686 | #define RS_ALGNERR 0x8000 |
@@ -845,6 +837,7 @@ static const char * chip_ids[ 16 ] = { | |||
845 | #define SMC_GET_FIFO() SMC_inw( ioaddr, FIFO_REG ) | 837 | #define SMC_GET_FIFO() SMC_inw( ioaddr, FIFO_REG ) |
846 | #define SMC_GET_PTR() SMC_inw( ioaddr, PTR_REG ) | 838 | #define SMC_GET_PTR() SMC_inw( ioaddr, PTR_REG ) |
847 | #define SMC_SET_PTR(x) SMC_outw( x, ioaddr, PTR_REG ) | 839 | #define SMC_SET_PTR(x) SMC_outw( x, ioaddr, PTR_REG ) |
840 | #define SMC_GET_EPH_STATUS() SMC_inw( ioaddr, EPH_STATUS_REG ) | ||
848 | #define SMC_GET_RCR() SMC_inw( ioaddr, RCR_REG ) | 841 | #define SMC_GET_RCR() SMC_inw( ioaddr, RCR_REG ) |
849 | #define SMC_SET_RCR(x) SMC_outw( x, ioaddr, RCR_REG ) | 842 | #define SMC_SET_RCR(x) SMC_outw( x, ioaddr, RCR_REG ) |
850 | #define SMC_GET_REV() SMC_inw( ioaddr, REV_REG ) | 843 | #define SMC_GET_REV() SMC_inw( ioaddr, REV_REG ) |