diff options
Diffstat (limited to 'drivers/net')
31 files changed, 441 insertions, 327 deletions
diff --git a/drivers/net/3c503.c b/drivers/net/3c503.c index 5c5eebdb6914..dcc98afa65d7 100644 --- a/drivers/net/3c503.c +++ b/drivers/net/3c503.c | |||
@@ -148,14 +148,6 @@ el2_pio_probe(struct net_device *dev) | |||
148 | return -ENODEV; | 148 | return -ENODEV; |
149 | } | 149 | } |
150 | 150 | ||
151 | static void cleanup_card(struct net_device *dev) | ||
152 | { | ||
153 | /* NB: el2_close() handles free_irq */ | ||
154 | release_region(dev->base_addr, EL2_IO_EXTENT); | ||
155 | if (ei_status.mem) | ||
156 | iounmap(ei_status.mem); | ||
157 | } | ||
158 | |||
159 | #ifndef MODULE | 151 | #ifndef MODULE |
160 | struct net_device * __init el2_probe(int unit) | 152 | struct net_device * __init el2_probe(int unit) |
161 | { | 153 | { |
@@ -726,6 +718,14 @@ init_module(void) | |||
726 | return -ENXIO; | 718 | return -ENXIO; |
727 | } | 719 | } |
728 | 720 | ||
721 | static void cleanup_card(struct net_device *dev) | ||
722 | { | ||
723 | /* NB: el2_close() handles free_irq */ | ||
724 | release_region(dev->base_addr, EL2_IO_EXTENT); | ||
725 | if (ei_status.mem) | ||
726 | iounmap(ei_status.mem); | ||
727 | } | ||
728 | |||
729 | void | 729 | void |
730 | cleanup_module(void) | 730 | cleanup_module(void) |
731 | { | 731 | { |
diff --git a/drivers/net/3c527.h b/drivers/net/3c527.h index c10f009ce9b6..53b5b071df08 100644 --- a/drivers/net/3c527.h +++ b/drivers/net/3c527.h | |||
@@ -32,43 +32,43 @@ | |||
32 | 32 | ||
33 | struct mc32_mailbox | 33 | struct mc32_mailbox |
34 | { | 34 | { |
35 | u16 mbox __attribute((packed)); | 35 | u16 mbox; |
36 | u16 data[1] __attribute((packed)); | 36 | u16 data[1]; |
37 | }; | 37 | } __attribute((packed)); |
38 | 38 | ||
39 | struct skb_header | 39 | struct skb_header |
40 | { | 40 | { |
41 | u8 status __attribute((packed)); | 41 | u8 status; |
42 | u8 control __attribute((packed)); | 42 | u8 control; |
43 | u16 next __attribute((packed)); /* Do not change! */ | 43 | u16 next; /* Do not change! */ |
44 | u16 length __attribute((packed)); | 44 | u16 length; |
45 | u32 data __attribute((packed)); | 45 | u32 data; |
46 | }; | 46 | } __attribute((packed)); |
47 | 47 | ||
48 | struct mc32_stats | 48 | struct mc32_stats |
49 | { | 49 | { |
50 | /* RX Errors */ | 50 | /* RX Errors */ |
51 | u32 rx_crc_errors __attribute((packed)); | 51 | u32 rx_crc_errors; |
52 | u32 rx_alignment_errors __attribute((packed)); | 52 | u32 rx_alignment_errors; |
53 | u32 rx_overrun_errors __attribute((packed)); | 53 | u32 rx_overrun_errors; |
54 | u32 rx_tooshort_errors __attribute((packed)); | 54 | u32 rx_tooshort_errors; |
55 | u32 rx_toolong_errors __attribute((packed)); | 55 | u32 rx_toolong_errors; |
56 | u32 rx_outofresource_errors __attribute((packed)); | 56 | u32 rx_outofresource_errors; |
57 | 57 | ||
58 | u32 rx_discarded __attribute((packed)); /* via card pattern match filter */ | 58 | u32 rx_discarded; /* via card pattern match filter */ |
59 | 59 | ||
60 | /* TX Errors */ | 60 | /* TX Errors */ |
61 | u32 tx_max_collisions __attribute((packed)); | 61 | u32 tx_max_collisions; |
62 | u32 tx_carrier_errors __attribute((packed)); | 62 | u32 tx_carrier_errors; |
63 | u32 tx_underrun_errors __attribute((packed)); | 63 | u32 tx_underrun_errors; |
64 | u32 tx_cts_errors __attribute((packed)); | 64 | u32 tx_cts_errors; |
65 | u32 tx_timeout_errors __attribute((packed)) ; | 65 | u32 tx_timeout_errors; |
66 | 66 | ||
67 | /* various cruft */ | 67 | /* various cruft */ |
68 | u32 dataA[6] __attribute((packed)); | 68 | u32 dataA[6]; |
69 | u16 dataB[5] __attribute((packed)); | 69 | u16 dataB[5]; |
70 | u32 dataC[14] __attribute((packed)); | 70 | u32 dataC[14]; |
71 | }; | 71 | } __attribute((packed)); |
72 | 72 | ||
73 | #define STATUS_MASK 0x0F | 73 | #define STATUS_MASK 0x0F |
74 | #define COMPLETED (1<<7) | 74 | #define COMPLETED (1<<7) |
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index e2fa29b612cd..733bc25b2bf9 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -129,7 +129,7 @@ config NET_SB1000 | |||
129 | 129 | ||
130 | If you don't have this card, of course say N. | 130 | If you don't have this card, of course say N. |
131 | 131 | ||
132 | source "drivers/net/arcnet/Kconfig" | 132 | source "drivers/net/arcnet/Kconfig" |
133 | 133 | ||
134 | source "drivers/net/phy/Kconfig" | 134 | source "drivers/net/phy/Kconfig" |
135 | 135 | ||
@@ -844,7 +844,7 @@ config SMC9194 | |||
844 | 844 | ||
845 | config DM9000 | 845 | config DM9000 |
846 | tristate "DM9000 support" | 846 | tristate "DM9000 support" |
847 | depends on ARM && NET_ETHERNET | 847 | depends on (ARM || MIPS) && NET_ETHERNET |
848 | select CRC32 | 848 | select CRC32 |
849 | select MII | 849 | select MII |
850 | ---help--- | 850 | ---help--- |
@@ -1374,7 +1374,7 @@ config FORCEDETH | |||
1374 | 1374 | ||
1375 | config CS89x0 | 1375 | config CS89x0 |
1376 | tristate "CS89x0 support" | 1376 | tristate "CS89x0 support" |
1377 | depends on (NET_PCI && (ISA || ARCH_IXDP2X01)) || ARCH_PNX0105 | 1377 | depends on NET_PCI && (ISA || ARCH_IXDP2X01 || ARCH_PNX010X) |
1378 | ---help--- | 1378 | ---help--- |
1379 | Support for CS89x0 chipset based Ethernet cards. If you have a | 1379 | Support for CS89x0 chipset based Ethernet cards. If you have a |
1380 | network (Ethernet) card of this type, say Y and read the | 1380 | network (Ethernet) card of this type, say Y and read the |
diff --git a/drivers/net/ac3200.c b/drivers/net/ac3200.c index 8a0af5453e21..7952dc6d77e3 100644 --- a/drivers/net/ac3200.c +++ b/drivers/net/ac3200.c | |||
@@ -123,14 +123,6 @@ static int __init do_ac3200_probe(struct net_device *dev) | |||
123 | return -ENODEV; | 123 | return -ENODEV; |
124 | } | 124 | } |
125 | 125 | ||
126 | static void cleanup_card(struct net_device *dev) | ||
127 | { | ||
128 | /* Someday free_irq may be in ac_close_card() */ | ||
129 | free_irq(dev->irq, dev); | ||
130 | release_region(dev->base_addr, AC_IO_EXTENT); | ||
131 | iounmap(ei_status.mem); | ||
132 | } | ||
133 | |||
134 | #ifndef MODULE | 126 | #ifndef MODULE |
135 | struct net_device * __init ac3200_probe(int unit) | 127 | struct net_device * __init ac3200_probe(int unit) |
136 | { | 128 | { |
@@ -406,6 +398,14 @@ init_module(void) | |||
406 | return -ENXIO; | 398 | return -ENXIO; |
407 | } | 399 | } |
408 | 400 | ||
401 | static void cleanup_card(struct net_device *dev) | ||
402 | { | ||
403 | /* Someday free_irq may be in ac_close_card() */ | ||
404 | free_irq(dev->irq, dev); | ||
405 | release_region(dev->base_addr, AC_IO_EXTENT); | ||
406 | iounmap(ei_status.mem); | ||
407 | } | ||
408 | |||
409 | void | 409 | void |
410 | cleanup_module(void) | 410 | cleanup_module(void) |
411 | { | 411 | { |
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h index 015c7f1d1bc0..f20bb85c1ea5 100644 --- a/drivers/net/bonding/bonding.h +++ b/drivers/net/bonding/bonding.h | |||
@@ -205,7 +205,7 @@ struct bonding { | |||
205 | * | 205 | * |
206 | * Caller must hold bond lock for read | 206 | * Caller must hold bond lock for read |
207 | */ | 207 | */ |
208 | extern inline struct slave *bond_get_slave_by_dev(struct bonding *bond, struct net_device *slave_dev) | 208 | static inline struct slave *bond_get_slave_by_dev(struct bonding *bond, struct net_device *slave_dev) |
209 | { | 209 | { |
210 | struct slave *slave = NULL; | 210 | struct slave *slave = NULL; |
211 | int i; | 211 | int i; |
@@ -219,7 +219,7 @@ extern inline struct slave *bond_get_slave_by_dev(struct bonding *bond, struct n | |||
219 | return slave; | 219 | return slave; |
220 | } | 220 | } |
221 | 221 | ||
222 | extern inline struct bonding *bond_get_bond_by_slave(struct slave *slave) | 222 | static inline struct bonding *bond_get_bond_by_slave(struct slave *slave) |
223 | { | 223 | { |
224 | if (!slave || !slave->dev->master) { | 224 | if (!slave || !slave->dev->master) { |
225 | return NULL; | 225 | return NULL; |
@@ -228,13 +228,13 @@ extern inline struct bonding *bond_get_bond_by_slave(struct slave *slave) | |||
228 | return (struct bonding *)slave->dev->master->priv; | 228 | return (struct bonding *)slave->dev->master->priv; |
229 | } | 229 | } |
230 | 230 | ||
231 | extern inline void bond_set_slave_inactive_flags(struct slave *slave) | 231 | static inline void bond_set_slave_inactive_flags(struct slave *slave) |
232 | { | 232 | { |
233 | slave->state = BOND_STATE_BACKUP; | 233 | slave->state = BOND_STATE_BACKUP; |
234 | slave->dev->flags |= IFF_NOARP; | 234 | slave->dev->flags |= IFF_NOARP; |
235 | } | 235 | } |
236 | 236 | ||
237 | extern inline void bond_set_slave_active_flags(struct slave *slave) | 237 | static inline void bond_set_slave_active_flags(struct slave *slave) |
238 | { | 238 | { |
239 | slave->state = BOND_STATE_ACTIVE; | 239 | slave->state = BOND_STATE_ACTIVE; |
240 | slave->dev->flags &= ~IFF_NOARP; | 240 | slave->dev->flags &= ~IFF_NOARP; |
diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c index a6078ad9b654..907c01009746 100644 --- a/drivers/net/cs89x0.c +++ b/drivers/net/cs89x0.c | |||
@@ -175,7 +175,7 @@ static unsigned int cs8900_irq_map[] = {1,0,0,0}; | |||
175 | #include <asm/irq.h> | 175 | #include <asm/irq.h> |
176 | static unsigned int netcard_portlist[] __initdata = {IXDP2X01_CS8900_VIRT_BASE, 0}; | 176 | static unsigned int netcard_portlist[] __initdata = {IXDP2X01_CS8900_VIRT_BASE, 0}; |
177 | static unsigned int cs8900_irq_map[] = {IRQ_IXDP2X01_CS8900, 0, 0, 0}; | 177 | static unsigned int cs8900_irq_map[] = {IRQ_IXDP2X01_CS8900, 0, 0, 0}; |
178 | #elif defined(CONFIG_ARCH_PNX0105) | 178 | #elif defined(CONFIG_ARCH_PNX010X) |
179 | #include <asm/irq.h> | 179 | #include <asm/irq.h> |
180 | #include <asm/arch/gpio.h> | 180 | #include <asm/arch/gpio.h> |
181 | #define CIRRUS_DEFAULT_BASE IO_ADDRESS(EXT_STATIC2_s0_BASE + 0x200000) /* = Physical address 0x48200000 */ | 181 | #define CIRRUS_DEFAULT_BASE IO_ADDRESS(EXT_STATIC2_s0_BASE + 0x200000) /* = Physical address 0x48200000 */ |
@@ -338,30 +338,86 @@ out: | |||
338 | } | 338 | } |
339 | #endif | 339 | #endif |
340 | 340 | ||
341 | #if defined(CONFIG_ARCH_IXDP2X01) | ||
341 | static int | 342 | static int |
342 | readreg(struct net_device *dev, int portno) | 343 | readword(unsigned long base_addr, int portno) |
343 | { | 344 | { |
344 | outw(portno, dev->base_addr + ADD_PORT); | 345 | return (u16)__raw_readl(base_addr + (portno << 1)); |
345 | return inw(dev->base_addr + DATA_PORT); | ||
346 | } | 346 | } |
347 | 347 | ||
348 | static void | 348 | static void |
349 | writereg(struct net_device *dev, int portno, int value) | 349 | writeword(unsigned long base_addr, int portno, int value) |
350 | { | 350 | { |
351 | outw(portno, dev->base_addr + ADD_PORT); | 351 | __raw_writel((u16)value, base_addr + (portno << 1)); |
352 | outw(value, dev->base_addr + DATA_PORT); | 352 | } |
353 | #else | ||
354 | #if defined(CONFIG_ARCH_PNX010X) | ||
355 | static int | ||
356 | readword(unsigned long base_addr, int portno) | ||
357 | { | ||
358 | return inw(base_addr + (portno << 1)); | ||
359 | } | ||
360 | |||
361 | static void | ||
362 | writeword(unsigned long base_addr, int portno, int value) | ||
363 | { | ||
364 | outw(value, base_addr + (portno << 1)); | ||
365 | } | ||
366 | #else | ||
367 | static int | ||
368 | readword(unsigned long base_addr, int portno) | ||
369 | { | ||
370 | return inw(base_addr + portno); | ||
371 | } | ||
372 | |||
373 | static void | ||
374 | writeword(unsigned long base_addr, int portno, int value) | ||
375 | { | ||
376 | outw(value, base_addr + portno); | ||
377 | } | ||
378 | #endif | ||
379 | #endif | ||
380 | |||
381 | static void | ||
382 | readwords(unsigned long base_addr, int portno, void *buf, int length) | ||
383 | { | ||
384 | u8 *buf8 = (u8 *)buf; | ||
385 | |||
386 | do { | ||
387 | u32 tmp32; | ||
388 | |||
389 | tmp32 = readword(base_addr, portno); | ||
390 | *buf8++ = (u8)tmp32; | ||
391 | *buf8++ = (u8)(tmp32 >> 8); | ||
392 | } while (--length); | ||
393 | } | ||
394 | |||
395 | static void | ||
396 | writewords(unsigned long base_addr, int portno, void *buf, int length) | ||
397 | { | ||
398 | u8 *buf8 = (u8 *)buf; | ||
399 | |||
400 | do { | ||
401 | u32 tmp32; | ||
402 | |||
403 | tmp32 = *buf8++; | ||
404 | tmp32 |= (*buf8++) << 8; | ||
405 | writeword(base_addr, portno, tmp32); | ||
406 | } while (--length); | ||
353 | } | 407 | } |
354 | 408 | ||
355 | static int | 409 | static int |
356 | readword(struct net_device *dev, int portno) | 410 | readreg(struct net_device *dev, int regno) |
357 | { | 411 | { |
358 | return inw(dev->base_addr + portno); | 412 | writeword(dev->base_addr, ADD_PORT, regno); |
413 | return readword(dev->base_addr, DATA_PORT); | ||
359 | } | 414 | } |
360 | 415 | ||
361 | static void | 416 | static void |
362 | writeword(struct net_device *dev, int portno, int value) | 417 | writereg(struct net_device *dev, int regno, int value) |
363 | { | 418 | { |
364 | outw(value, dev->base_addr + portno); | 419 | writeword(dev->base_addr, ADD_PORT, regno); |
420 | writeword(dev->base_addr, DATA_PORT, value); | ||
365 | } | 421 | } |
366 | 422 | ||
367 | static int __init | 423 | static int __init |
@@ -456,7 +512,7 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular) | |||
456 | #endif | 512 | #endif |
457 | } | 513 | } |
458 | 514 | ||
459 | #ifdef CONFIG_ARCH_PNX0105 | 515 | #ifdef CONFIG_ARCH_PNX010X |
460 | initialize_ebi(); | 516 | initialize_ebi(); |
461 | 517 | ||
462 | /* Map GPIO registers for the pins connected to the CS8900a. */ | 518 | /* Map GPIO registers for the pins connected to the CS8900a. */ |
@@ -491,8 +547,8 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular) | |||
491 | 547 | ||
492 | #ifdef CONFIG_SH_HICOSH4 | 548 | #ifdef CONFIG_SH_HICOSH4 |
493 | /* truely reset the chip */ | 549 | /* truely reset the chip */ |
494 | outw(0x0114, ioaddr + ADD_PORT); | 550 | writeword(ioaddr, ADD_PORT, 0x0114); |
495 | outw(0x0040, ioaddr + DATA_PORT); | 551 | writeword(ioaddr, DATA_PORT, 0x0040); |
496 | #endif | 552 | #endif |
497 | 553 | ||
498 | /* if they give us an odd I/O address, then do ONE write to | 554 | /* if they give us an odd I/O address, then do ONE write to |
@@ -503,24 +559,24 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular) | |||
503 | if (net_debug > 1) | 559 | if (net_debug > 1) |
504 | printk(KERN_INFO "%s: odd ioaddr 0x%x\n", dev->name, ioaddr); | 560 | printk(KERN_INFO "%s: odd ioaddr 0x%x\n", dev->name, ioaddr); |
505 | if ((ioaddr & 2) != 2) | 561 | if ((ioaddr & 2) != 2) |
506 | if ((inw((ioaddr & ~3)+ ADD_PORT) & ADD_MASK) != ADD_SIG) { | 562 | if ((readword(ioaddr & ~3, ADD_PORT) & ADD_MASK) != ADD_SIG) { |
507 | printk(KERN_ERR "%s: bad signature 0x%x\n", | 563 | printk(KERN_ERR "%s: bad signature 0x%x\n", |
508 | dev->name, inw((ioaddr & ~3)+ ADD_PORT)); | 564 | dev->name, readword(ioaddr & ~3, ADD_PORT)); |
509 | retval = -ENODEV; | 565 | retval = -ENODEV; |
510 | goto out2; | 566 | goto out2; |
511 | } | 567 | } |
512 | } | 568 | } |
513 | printk(KERN_DEBUG "PP_addr at %x: 0x%x\n", | 569 | printk(KERN_DEBUG "PP_addr at %x[%x]: 0x%x\n", |
514 | ioaddr + ADD_PORT, inw(ioaddr + ADD_PORT)); | 570 | ioaddr, ADD_PORT, readword(ioaddr, ADD_PORT)); |
515 | 571 | ||
516 | ioaddr &= ~3; | 572 | ioaddr &= ~3; |
517 | outw(PP_ChipID, ioaddr + ADD_PORT); | 573 | writeword(ioaddr, ADD_PORT, PP_ChipID); |
518 | 574 | ||
519 | tmp = inw(ioaddr + DATA_PORT); | 575 | tmp = readword(ioaddr, DATA_PORT); |
520 | if (tmp != CHIP_EISA_ID_SIG) { | 576 | if (tmp != CHIP_EISA_ID_SIG) { |
521 | printk(KERN_DEBUG "%s: incorrect signature at %x: 0x%x!=" | 577 | printk(KERN_DEBUG "%s: incorrect signature at %x[%x]: 0x%x!=" |
522 | CHIP_EISA_ID_SIG_STR "\n", | 578 | CHIP_EISA_ID_SIG_STR "\n", |
523 | dev->name, ioaddr + DATA_PORT, tmp); | 579 | dev->name, ioaddr, DATA_PORT, tmp); |
524 | retval = -ENODEV; | 580 | retval = -ENODEV; |
525 | goto out2; | 581 | goto out2; |
526 | } | 582 | } |
@@ -724,7 +780,7 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular) | |||
724 | } else { | 780 | } else { |
725 | i = lp->isa_config & INT_NO_MASK; | 781 | i = lp->isa_config & INT_NO_MASK; |
726 | if (lp->chip_type == CS8900) { | 782 | if (lp->chip_type == CS8900) { |
727 | #if defined(CONFIG_ARCH_IXDP2X01) || defined(CONFIG_ARCH_PNX0105) | 783 | #if defined(CONFIG_ARCH_IXDP2X01) || defined(CONFIG_ARCH_PNX010X) |
728 | i = cs8900_irq_map[0]; | 784 | i = cs8900_irq_map[0]; |
729 | #else | 785 | #else |
730 | /* Translate the IRQ using the IRQ mapping table. */ | 786 | /* Translate the IRQ using the IRQ mapping table. */ |
@@ -790,7 +846,7 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular) | |||
790 | goto out3; | 846 | goto out3; |
791 | return 0; | 847 | return 0; |
792 | out3: | 848 | out3: |
793 | outw(PP_ChipID, dev->base_addr + ADD_PORT); | 849 | writeword(dev->base_addr, ADD_PORT, PP_ChipID); |
794 | out2: | 850 | out2: |
795 | release_region(ioaddr & ~3, NETCARD_IO_EXTENT); | 851 | release_region(ioaddr & ~3, NETCARD_IO_EXTENT); |
796 | out1: | 852 | out1: |
@@ -970,11 +1026,11 @@ void __init reset_chip(struct net_device *dev) | |||
970 | #ifndef CONFIG_ARCH_IXDP2X01 | 1026 | #ifndef CONFIG_ARCH_IXDP2X01 |
971 | if (lp->chip_type != CS8900) { | 1027 | if (lp->chip_type != CS8900) { |
972 | /* Hardware problem requires PNP registers to be reconfigured after a reset */ | 1028 | /* Hardware problem requires PNP registers to be reconfigured after a reset */ |
973 | outw(PP_CS8920_ISAINT, ioaddr + ADD_PORT); | 1029 | writeword(ioaddr, ADD_PORT, PP_CS8920_ISAINT); |
974 | outb(dev->irq, ioaddr + DATA_PORT); | 1030 | outb(dev->irq, ioaddr + DATA_PORT); |
975 | outb(0, ioaddr + DATA_PORT + 1); | 1031 | outb(0, ioaddr + DATA_PORT + 1); |
976 | 1032 | ||
977 | outw(PP_CS8920_ISAMemB, ioaddr + ADD_PORT); | 1033 | writeword(ioaddr, ADD_PORT, PP_CS8920_ISAMemB); |
978 | outb((dev->mem_start >> 16) & 0xff, ioaddr + DATA_PORT); | 1034 | outb((dev->mem_start >> 16) & 0xff, ioaddr + DATA_PORT); |
979 | outb((dev->mem_start >> 8) & 0xff, ioaddr + DATA_PORT + 1); | 1035 | outb((dev->mem_start >> 8) & 0xff, ioaddr + DATA_PORT + 1); |
980 | } | 1036 | } |
@@ -1104,8 +1160,8 @@ send_test_pkt(struct net_device *dev) | |||
1104 | memcpy(test_packet, dev->dev_addr, ETH_ALEN); | 1160 | memcpy(test_packet, dev->dev_addr, ETH_ALEN); |
1105 | memcpy(test_packet+ETH_ALEN, dev->dev_addr, ETH_ALEN); | 1161 | memcpy(test_packet+ETH_ALEN, dev->dev_addr, ETH_ALEN); |
1106 | 1162 | ||
1107 | writeword(dev, TX_CMD_PORT, TX_AFTER_ALL); | 1163 | writeword(dev->base_addr, TX_CMD_PORT, TX_AFTER_ALL); |
1108 | writeword(dev, TX_LEN_PORT, ETH_ZLEN); | 1164 | writeword(dev->base_addr, TX_LEN_PORT, ETH_ZLEN); |
1109 | 1165 | ||
1110 | /* Test to see if the chip has allocated memory for the packet */ | 1166 | /* Test to see if the chip has allocated memory for the packet */ |
1111 | while (jiffies - timenow < 5) | 1167 | while (jiffies - timenow < 5) |
@@ -1115,7 +1171,7 @@ send_test_pkt(struct net_device *dev) | |||
1115 | return 0; /* this shouldn't happen */ | 1171 | return 0; /* this shouldn't happen */ |
1116 | 1172 | ||
1117 | /* Write the contents of the packet */ | 1173 | /* Write the contents of the packet */ |
1118 | outsw(dev->base_addr + TX_FRAME_PORT,test_packet,(ETH_ZLEN+1) >>1); | 1174 | writewords(dev->base_addr, TX_FRAME_PORT,test_packet,(ETH_ZLEN+1) >>1); |
1119 | 1175 | ||
1120 | if (net_debug > 1) printk("Sending test packet "); | 1176 | if (net_debug > 1) printk("Sending test packet "); |
1121 | /* wait a couple of jiffies for packet to be received */ | 1177 | /* wait a couple of jiffies for packet to be received */ |
@@ -1200,7 +1256,7 @@ net_open(struct net_device *dev) | |||
1200 | int i; | 1256 | int i; |
1201 | int ret; | 1257 | int ret; |
1202 | 1258 | ||
1203 | #if !defined(CONFIG_SH_HICOSH4) && !defined(CONFIG_ARCH_PNX0105) /* uses irq#1, so this won't work */ | 1259 | #if !defined(CONFIG_SH_HICOSH4) && !defined(CONFIG_ARCH_PNX010X) /* uses irq#1, so this won't work */ |
1204 | if (dev->irq < 2) { | 1260 | if (dev->irq < 2) { |
1205 | /* Allow interrupts to be generated by the chip */ | 1261 | /* Allow interrupts to be generated by the chip */ |
1206 | /* Cirrus' release had this: */ | 1262 | /* Cirrus' release had this: */ |
@@ -1231,7 +1287,7 @@ net_open(struct net_device *dev) | |||
1231 | else | 1287 | else |
1232 | #endif | 1288 | #endif |
1233 | { | 1289 | { |
1234 | #if !defined(CONFIG_ARCH_IXDP2X01) && !defined(CONFIG_ARCH_PNX0105) | 1290 | #if !defined(CONFIG_ARCH_IXDP2X01) && !defined(CONFIG_ARCH_PNX010X) |
1235 | if (((1 << dev->irq) & lp->irq_map) == 0) { | 1291 | if (((1 << dev->irq) & lp->irq_map) == 0) { |
1236 | printk(KERN_ERR "%s: IRQ %d is not in our map of allowable IRQs, which is %x\n", | 1292 | printk(KERN_ERR "%s: IRQ %d is not in our map of allowable IRQs, which is %x\n", |
1237 | dev->name, dev->irq, lp->irq_map); | 1293 | dev->name, dev->irq, lp->irq_map); |
@@ -1316,7 +1372,7 @@ net_open(struct net_device *dev) | |||
1316 | case A_CNF_MEDIA_10B_2: result = lp->adapter_cnf & A_CNF_10B_2; break; | 1372 | case A_CNF_MEDIA_10B_2: result = lp->adapter_cnf & A_CNF_10B_2; break; |
1317 | default: result = lp->adapter_cnf & (A_CNF_10B_T | A_CNF_AUI | A_CNF_10B_2); | 1373 | default: result = lp->adapter_cnf & (A_CNF_10B_T | A_CNF_AUI | A_CNF_10B_2); |
1318 | } | 1374 | } |
1319 | #ifdef CONFIG_ARCH_PNX0105 | 1375 | #ifdef CONFIG_ARCH_PNX010X |
1320 | result = A_CNF_10B_T; | 1376 | result = A_CNF_10B_T; |
1321 | #endif | 1377 | #endif |
1322 | if (!result) { | 1378 | if (!result) { |
@@ -1457,8 +1513,8 @@ static int net_send_packet(struct sk_buff *skb, struct net_device *dev) | |||
1457 | netif_stop_queue(dev); | 1513 | netif_stop_queue(dev); |
1458 | 1514 | ||
1459 | /* initiate a transmit sequence */ | 1515 | /* initiate a transmit sequence */ |
1460 | writeword(dev, TX_CMD_PORT, lp->send_cmd); | 1516 | writeword(dev->base_addr, TX_CMD_PORT, lp->send_cmd); |
1461 | writeword(dev, TX_LEN_PORT, skb->len); | 1517 | writeword(dev->base_addr, TX_LEN_PORT, skb->len); |
1462 | 1518 | ||
1463 | /* Test to see if the chip has allocated memory for the packet */ | 1519 | /* Test to see if the chip has allocated memory for the packet */ |
1464 | if ((readreg(dev, PP_BusST) & READY_FOR_TX_NOW) == 0) { | 1520 | if ((readreg(dev, PP_BusST) & READY_FOR_TX_NOW) == 0) { |
@@ -1472,7 +1528,7 @@ static int net_send_packet(struct sk_buff *skb, struct net_device *dev) | |||
1472 | return 1; | 1528 | return 1; |
1473 | } | 1529 | } |
1474 | /* Write the contents of the packet */ | 1530 | /* Write the contents of the packet */ |
1475 | outsw(dev->base_addr + TX_FRAME_PORT,skb->data,(skb->len+1) >>1); | 1531 | writewords(dev->base_addr, TX_FRAME_PORT,skb->data,(skb->len+1) >>1); |
1476 | spin_unlock_irq(&lp->lock); | 1532 | spin_unlock_irq(&lp->lock); |
1477 | lp->stats.tx_bytes += skb->len; | 1533 | lp->stats.tx_bytes += skb->len; |
1478 | dev->trans_start = jiffies; | 1534 | dev->trans_start = jiffies; |
@@ -1512,7 +1568,7 @@ static irqreturn_t net_interrupt(int irq, void *dev_id, struct pt_regs * regs) | |||
1512 | course, if you're on a slow machine, and packets are arriving | 1568 | course, if you're on a slow machine, and packets are arriving |
1513 | faster than you can read them off, you're screwed. Hasta la | 1569 | faster than you can read them off, you're screwed. Hasta la |
1514 | vista, baby! */ | 1570 | vista, baby! */ |
1515 | while ((status = readword(dev, ISQ_PORT))) { | 1571 | while ((status = readword(dev->base_addr, ISQ_PORT))) { |
1516 | if (net_debug > 4)printk("%s: event=%04x\n", dev->name, status); | 1572 | if (net_debug > 4)printk("%s: event=%04x\n", dev->name, status); |
1517 | handled = 1; | 1573 | handled = 1; |
1518 | switch(status & ISQ_EVENT_MASK) { | 1574 | switch(status & ISQ_EVENT_MASK) { |
@@ -1606,8 +1662,8 @@ net_rx(struct net_device *dev) | |||
1606 | int status, length; | 1662 | int status, length; |
1607 | 1663 | ||
1608 | int ioaddr = dev->base_addr; | 1664 | int ioaddr = dev->base_addr; |
1609 | status = inw(ioaddr + RX_FRAME_PORT); | 1665 | status = readword(ioaddr, RX_FRAME_PORT); |
1610 | length = inw(ioaddr + RX_FRAME_PORT); | 1666 | length = readword(ioaddr, RX_FRAME_PORT); |
1611 | 1667 | ||
1612 | if ((status & RX_OK) == 0) { | 1668 | if ((status & RX_OK) == 0) { |
1613 | count_rx_errors(status, lp); | 1669 | count_rx_errors(status, lp); |
@@ -1626,9 +1682,9 @@ net_rx(struct net_device *dev) | |||
1626 | skb_reserve(skb, 2); /* longword align L3 header */ | 1682 | skb_reserve(skb, 2); /* longword align L3 header */ |
1627 | skb->dev = dev; | 1683 | skb->dev = dev; |
1628 | 1684 | ||
1629 | insw(ioaddr + RX_FRAME_PORT, skb_put(skb, length), length >> 1); | 1685 | readwords(ioaddr, RX_FRAME_PORT, skb_put(skb, length), length >> 1); |
1630 | if (length & 1) | 1686 | if (length & 1) |
1631 | skb->data[length-1] = inw(ioaddr + RX_FRAME_PORT); | 1687 | skb->data[length-1] = readword(ioaddr, RX_FRAME_PORT); |
1632 | 1688 | ||
1633 | if (net_debug > 3) { | 1689 | if (net_debug > 3) { |
1634 | printk( "%s: received %d byte packet of type %x\n", | 1690 | printk( "%s: received %d byte packet of type %x\n", |
@@ -1901,7 +1957,7 @@ void | |||
1901 | cleanup_module(void) | 1957 | cleanup_module(void) |
1902 | { | 1958 | { |
1903 | unregister_netdev(dev_cs89x0); | 1959 | unregister_netdev(dev_cs89x0); |
1904 | outw(PP_ChipID, dev_cs89x0->base_addr + ADD_PORT); | 1960 | writeword(dev_cs89x0->base_addr, ADD_PORT, PP_ChipID); |
1905 | release_region(dev_cs89x0->base_addr, NETCARD_IO_EXTENT); | 1961 | release_region(dev_cs89x0->base_addr, NETCARD_IO_EXTENT); |
1906 | free_netdev(dev_cs89x0); | 1962 | free_netdev(dev_cs89x0); |
1907 | } | 1963 | } |
diff --git a/drivers/net/cs89x0.h b/drivers/net/cs89x0.h index decea264f121..bd954aaa636f 100644 --- a/drivers/net/cs89x0.h +++ b/drivers/net/cs89x0.h | |||
@@ -16,13 +16,6 @@ | |||
16 | 16 | ||
17 | #include <linux/config.h> | 17 | #include <linux/config.h> |
18 | 18 | ||
19 | #if defined(CONFIG_ARCH_IXDP2X01) || defined(CONFIG_ARCH_PNX0105) | ||
20 | /* IXDP2401/IXDP2801 uses dword-aligned register addressing */ | ||
21 | #define CS89x0_PORT(reg) ((reg) * 2) | ||
22 | #else | ||
23 | #define CS89x0_PORT(reg) (reg) | ||
24 | #endif | ||
25 | |||
26 | #define PP_ChipID 0x0000 /* offset 0h -> Corp -ID */ | 19 | #define PP_ChipID 0x0000 /* offset 0h -> Corp -ID */ |
27 | /* offset 2h -> Model/Product Number */ | 20 | /* offset 2h -> Model/Product Number */ |
28 | /* offset 3h -> Chip Revision Number */ | 21 | /* offset 3h -> Chip Revision Number */ |
@@ -332,16 +325,16 @@ | |||
332 | #define RAM_SIZE 0x1000 /* The card has 4k bytes or RAM */ | 325 | #define RAM_SIZE 0x1000 /* The card has 4k bytes or RAM */ |
333 | #define PKT_START PP_TxFrame /* Start of packet RAM */ | 326 | #define PKT_START PP_TxFrame /* Start of packet RAM */ |
334 | 327 | ||
335 | #define RX_FRAME_PORT CS89x0_PORT(0x0000) | 328 | #define RX_FRAME_PORT 0x0000 |
336 | #define TX_FRAME_PORT RX_FRAME_PORT | 329 | #define TX_FRAME_PORT RX_FRAME_PORT |
337 | #define TX_CMD_PORT CS89x0_PORT(0x0004) | 330 | #define TX_CMD_PORT 0x0004 |
338 | #define TX_NOW 0x0000 /* Tx packet after 5 bytes copied */ | 331 | #define TX_NOW 0x0000 /* Tx packet after 5 bytes copied */ |
339 | #define TX_AFTER_381 0x0040 /* Tx packet after 381 bytes copied */ | 332 | #define TX_AFTER_381 0x0040 /* Tx packet after 381 bytes copied */ |
340 | #define TX_AFTER_ALL 0x00c0 /* Tx packet after all bytes copied */ | 333 | #define TX_AFTER_ALL 0x00c0 /* Tx packet after all bytes copied */ |
341 | #define TX_LEN_PORT CS89x0_PORT(0x0006) | 334 | #define TX_LEN_PORT 0x0006 |
342 | #define ISQ_PORT CS89x0_PORT(0x0008) | 335 | #define ISQ_PORT 0x0008 |
343 | #define ADD_PORT CS89x0_PORT(0x000A) | 336 | #define ADD_PORT 0x000A |
344 | #define DATA_PORT CS89x0_PORT(0x000C) | 337 | #define DATA_PORT 0x000C |
345 | 338 | ||
346 | #define EEPROM_WRITE_EN 0x00F0 | 339 | #define EEPROM_WRITE_EN 0x00F0 |
347 | #define EEPROM_WRITE_DIS 0x0000 | 340 | #define EEPROM_WRITE_DIS 0x0000 |
diff --git a/drivers/net/e1000/e1000_param.c b/drivers/net/e1000/e1000_param.c index 38695d5b4637..ccbbe5ad8e0f 100644 --- a/drivers/net/e1000/e1000_param.c +++ b/drivers/net/e1000/e1000_param.c | |||
@@ -545,7 +545,7 @@ e1000_check_fiber_options(struct e1000_adapter *adapter) | |||
545 | static void __devinit | 545 | static void __devinit |
546 | e1000_check_copper_options(struct e1000_adapter *adapter) | 546 | e1000_check_copper_options(struct e1000_adapter *adapter) |
547 | { | 547 | { |
548 | int speed, dplx; | 548 | int speed, dplx, an; |
549 | int bd = adapter->bd_number; | 549 | int bd = adapter->bd_number; |
550 | 550 | ||
551 | { /* Speed */ | 551 | { /* Speed */ |
@@ -641,8 +641,12 @@ e1000_check_copper_options(struct e1000_adapter *adapter) | |||
641 | .p = an_list }} | 641 | .p = an_list }} |
642 | }; | 642 | }; |
643 | 643 | ||
644 | int an = AutoNeg[bd]; | 644 | if (num_AutoNeg > bd) { |
645 | e1000_validate_option(&an, &opt, adapter); | 645 | an = AutoNeg[bd]; |
646 | e1000_validate_option(&an, &opt, adapter); | ||
647 | } else { | ||
648 | an = opt.def; | ||
649 | } | ||
646 | adapter->hw.autoneg_advertised = an; | 650 | adapter->hw.autoneg_advertised = an; |
647 | } | 651 | } |
648 | 652 | ||
diff --git a/drivers/net/e2100.c b/drivers/net/e2100.c index f5a4dd7d8564..e5c5cd2a2712 100644 --- a/drivers/net/e2100.c +++ b/drivers/net/e2100.c | |||
@@ -140,13 +140,6 @@ static int __init do_e2100_probe(struct net_device *dev) | |||
140 | return -ENODEV; | 140 | return -ENODEV; |
141 | } | 141 | } |
142 | 142 | ||
143 | static void cleanup_card(struct net_device *dev) | ||
144 | { | ||
145 | /* NB: e21_close() handles free_irq */ | ||
146 | iounmap(ei_status.mem); | ||
147 | release_region(dev->base_addr, E21_IO_EXTENT); | ||
148 | } | ||
149 | |||
150 | #ifndef MODULE | 143 | #ifndef MODULE |
151 | struct net_device * __init e2100_probe(int unit) | 144 | struct net_device * __init e2100_probe(int unit) |
152 | { | 145 | { |
@@ -463,6 +456,13 @@ init_module(void) | |||
463 | return -ENXIO; | 456 | return -ENXIO; |
464 | } | 457 | } |
465 | 458 | ||
459 | static void cleanup_card(struct net_device *dev) | ||
460 | { | ||
461 | /* NB: e21_close() handles free_irq */ | ||
462 | iounmap(ei_status.mem); | ||
463 | release_region(dev->base_addr, E21_IO_EXTENT); | ||
464 | } | ||
465 | |||
466 | void | 466 | void |
467 | cleanup_module(void) | 467 | cleanup_module(void) |
468 | { | 468 | { |
diff --git a/drivers/net/es3210.c b/drivers/net/es3210.c index 50f8e23bb9e5..6b0ab1eac3fb 100644 --- a/drivers/net/es3210.c +++ b/drivers/net/es3210.c | |||
@@ -155,13 +155,6 @@ static int __init do_es_probe(struct net_device *dev) | |||
155 | return -ENODEV; | 155 | return -ENODEV; |
156 | } | 156 | } |
157 | 157 | ||
158 | static void cleanup_card(struct net_device *dev) | ||
159 | { | ||
160 | free_irq(dev->irq, dev); | ||
161 | release_region(dev->base_addr, ES_IO_EXTENT); | ||
162 | iounmap(ei_status.mem); | ||
163 | } | ||
164 | |||
165 | #ifndef MODULE | 158 | #ifndef MODULE |
166 | struct net_device * __init es_probe(int unit) | 159 | struct net_device * __init es_probe(int unit) |
167 | { | 160 | { |
@@ -456,6 +449,13 @@ init_module(void) | |||
456 | return -ENXIO; | 449 | return -ENXIO; |
457 | } | 450 | } |
458 | 451 | ||
452 | static void cleanup_card(struct net_device *dev) | ||
453 | { | ||
454 | free_irq(dev->irq, dev); | ||
455 | release_region(dev->base_addr, ES_IO_EXTENT); | ||
456 | iounmap(ei_status.mem); | ||
457 | } | ||
458 | |||
459 | void | 459 | void |
460 | cleanup_module(void) | 460 | cleanup_module(void) |
461 | { | 461 | { |
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c index c39344adecce..3682ec61e8a8 100644 --- a/drivers/net/forcedeth.c +++ b/drivers/net/forcedeth.c | |||
@@ -101,6 +101,7 @@ | |||
101 | * 0.46: 20 Oct 2005: Add irq optimization modes. | 101 | * 0.46: 20 Oct 2005: Add irq optimization modes. |
102 | * 0.47: 26 Oct 2005: Add phyaddr 0 in phy scan. | 102 | * 0.47: 26 Oct 2005: Add phyaddr 0 in phy scan. |
103 | * 0.48: 24 Dec 2005: Disable TSO, bugfix for pci_map_single | 103 | * 0.48: 24 Dec 2005: Disable TSO, bugfix for pci_map_single |
104 | * 0.49: 10 Dec 2005: Fix tso for large buffers. | ||
104 | * | 105 | * |
105 | * Known bugs: | 106 | * Known bugs: |
106 | * We suspect that on some hardware no TX done interrupts are generated. | 107 | * We suspect that on some hardware no TX done interrupts are generated. |
@@ -112,7 +113,7 @@ | |||
112 | * DEV_NEED_TIMERIRQ will not harm you on sane hardware, only generating a few | 113 | * DEV_NEED_TIMERIRQ will not harm you on sane hardware, only generating a few |
113 | * superfluous timer interrupts from the nic. | 114 | * superfluous timer interrupts from the nic. |
114 | */ | 115 | */ |
115 | #define FORCEDETH_VERSION "0.48" | 116 | #define FORCEDETH_VERSION "0.49" |
116 | #define DRV_NAME "forcedeth" | 117 | #define DRV_NAME "forcedeth" |
117 | 118 | ||
118 | #include <linux/module.h> | 119 | #include <linux/module.h> |
@@ -349,6 +350,8 @@ typedef union _ring_type { | |||
349 | #define NV_TX2_VALID (1<<31) | 350 | #define NV_TX2_VALID (1<<31) |
350 | #define NV_TX2_TSO (1<<28) | 351 | #define NV_TX2_TSO (1<<28) |
351 | #define NV_TX2_TSO_SHIFT 14 | 352 | #define NV_TX2_TSO_SHIFT 14 |
353 | #define NV_TX2_TSO_MAX_SHIFT 14 | ||
354 | #define NV_TX2_TSO_MAX_SIZE (1<<NV_TX2_TSO_MAX_SHIFT) | ||
352 | #define NV_TX2_CHECKSUM_L3 (1<<27) | 355 | #define NV_TX2_CHECKSUM_L3 (1<<27) |
353 | #define NV_TX2_CHECKSUM_L4 (1<<26) | 356 | #define NV_TX2_CHECKSUM_L4 (1<<26) |
354 | 357 | ||
@@ -408,15 +411,15 @@ typedef union _ring_type { | |||
408 | #define NV_WATCHDOG_TIMEO (5*HZ) | 411 | #define NV_WATCHDOG_TIMEO (5*HZ) |
409 | 412 | ||
410 | #define RX_RING 128 | 413 | #define RX_RING 128 |
411 | #define TX_RING 64 | 414 | #define TX_RING 256 |
412 | /* | 415 | /* |
413 | * If your nic mysteriously hangs then try to reduce the limits | 416 | * If your nic mysteriously hangs then try to reduce the limits |
414 | * to 1/0: It might be required to set NV_TX_LASTPACKET in the | 417 | * to 1/0: It might be required to set NV_TX_LASTPACKET in the |
415 | * last valid ring entry. But this would be impossible to | 418 | * last valid ring entry. But this would be impossible to |
416 | * implement - probably a disassembly error. | 419 | * implement - probably a disassembly error. |
417 | */ | 420 | */ |
418 | #define TX_LIMIT_STOP 63 | 421 | #define TX_LIMIT_STOP 255 |
419 | #define TX_LIMIT_START 62 | 422 | #define TX_LIMIT_START 254 |
420 | 423 | ||
421 | /* rx/tx mac addr + type + vlan + align + slack*/ | 424 | /* rx/tx mac addr + type + vlan + align + slack*/ |
422 | #define NV_RX_HEADERS (64) | 425 | #define NV_RX_HEADERS (64) |
@@ -535,6 +538,7 @@ struct fe_priv { | |||
535 | unsigned int next_tx, nic_tx; | 538 | unsigned int next_tx, nic_tx; |
536 | struct sk_buff *tx_skbuff[TX_RING]; | 539 | struct sk_buff *tx_skbuff[TX_RING]; |
537 | dma_addr_t tx_dma[TX_RING]; | 540 | dma_addr_t tx_dma[TX_RING]; |
541 | unsigned int tx_dma_len[TX_RING]; | ||
538 | u32 tx_flags; | 542 | u32 tx_flags; |
539 | }; | 543 | }; |
540 | 544 | ||
@@ -935,6 +939,7 @@ static void nv_init_tx(struct net_device *dev) | |||
935 | else | 939 | else |
936 | np->tx_ring.ex[i].FlagLen = 0; | 940 | np->tx_ring.ex[i].FlagLen = 0; |
937 | np->tx_skbuff[i] = NULL; | 941 | np->tx_skbuff[i] = NULL; |
942 | np->tx_dma[i] = 0; | ||
938 | } | 943 | } |
939 | } | 944 | } |
940 | 945 | ||
@@ -945,30 +950,27 @@ static int nv_init_ring(struct net_device *dev) | |||
945 | return nv_alloc_rx(dev); | 950 | return nv_alloc_rx(dev); |
946 | } | 951 | } |
947 | 952 | ||
948 | static void nv_release_txskb(struct net_device *dev, unsigned int skbnr) | 953 | static int nv_release_txskb(struct net_device *dev, unsigned int skbnr) |
949 | { | 954 | { |
950 | struct fe_priv *np = netdev_priv(dev); | 955 | struct fe_priv *np = netdev_priv(dev); |
951 | struct sk_buff *skb = np->tx_skbuff[skbnr]; | 956 | |
952 | unsigned int j, entry, fragments; | 957 | dprintk(KERN_INFO "%s: nv_release_txskb for skbnr %d\n", |
953 | 958 | dev->name, skbnr); | |
954 | dprintk(KERN_INFO "%s: nv_release_txskb for skbnr %d, skb %p\n", | 959 | |
955 | dev->name, skbnr, np->tx_skbuff[skbnr]); | 960 | if (np->tx_dma[skbnr]) { |
956 | 961 | pci_unmap_page(np->pci_dev, np->tx_dma[skbnr], | |
957 | entry = skbnr; | 962 | np->tx_dma_len[skbnr], |
958 | if ((fragments = skb_shinfo(skb)->nr_frags) != 0) { | 963 | PCI_DMA_TODEVICE); |
959 | for (j = fragments; j >= 1; j--) { | 964 | np->tx_dma[skbnr] = 0; |
960 | skb_frag_t *frag = &skb_shinfo(skb)->frags[j-1]; | 965 | } |
961 | pci_unmap_page(np->pci_dev, np->tx_dma[entry], | 966 | |
962 | frag->size, | 967 | if (np->tx_skbuff[skbnr]) { |
963 | PCI_DMA_TODEVICE); | 968 | dev_kfree_skb_irq(np->tx_skbuff[skbnr]); |
964 | entry = (entry - 1) % TX_RING; | 969 | np->tx_skbuff[skbnr] = NULL; |
965 | } | 970 | return 1; |
971 | } else { | ||
972 | return 0; | ||
966 | } | 973 | } |
967 | pci_unmap_single(np->pci_dev, np->tx_dma[entry], | ||
968 | skb->len - skb->data_len, | ||
969 | PCI_DMA_TODEVICE); | ||
970 | dev_kfree_skb_irq(skb); | ||
971 | np->tx_skbuff[skbnr] = NULL; | ||
972 | } | 974 | } |
973 | 975 | ||
974 | static void nv_drain_tx(struct net_device *dev) | 976 | static void nv_drain_tx(struct net_device *dev) |
@@ -981,10 +983,8 @@ static void nv_drain_tx(struct net_device *dev) | |||
981 | np->tx_ring.orig[i].FlagLen = 0; | 983 | np->tx_ring.orig[i].FlagLen = 0; |
982 | else | 984 | else |
983 | np->tx_ring.ex[i].FlagLen = 0; | 985 | np->tx_ring.ex[i].FlagLen = 0; |
984 | if (np->tx_skbuff[i]) { | 986 | if (nv_release_txskb(dev, i)) |
985 | nv_release_txskb(dev, i); | ||
986 | np->stats.tx_dropped++; | 987 | np->stats.tx_dropped++; |
987 | } | ||
988 | } | 988 | } |
989 | } | 989 | } |
990 | 990 | ||
@@ -1021,68 +1021,105 @@ static void drain_ring(struct net_device *dev) | |||
1021 | static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev) | 1021 | static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev) |
1022 | { | 1022 | { |
1023 | struct fe_priv *np = netdev_priv(dev); | 1023 | struct fe_priv *np = netdev_priv(dev); |
1024 | u32 tx_flags = 0; | ||
1024 | u32 tx_flags_extra = (np->desc_ver == DESC_VER_1 ? NV_TX_LASTPACKET : NV_TX2_LASTPACKET); | 1025 | u32 tx_flags_extra = (np->desc_ver == DESC_VER_1 ? NV_TX_LASTPACKET : NV_TX2_LASTPACKET); |
1025 | unsigned int fragments = skb_shinfo(skb)->nr_frags; | 1026 | unsigned int fragments = skb_shinfo(skb)->nr_frags; |
1026 | unsigned int nr = (np->next_tx + fragments) % TX_RING; | 1027 | unsigned int nr = (np->next_tx - 1) % TX_RING; |
1028 | unsigned int start_nr = np->next_tx % TX_RING; | ||
1027 | unsigned int i; | 1029 | unsigned int i; |
1030 | u32 offset = 0; | ||
1031 | u32 bcnt; | ||
1032 | u32 size = skb->len-skb->data_len; | ||
1033 | u32 entries = (size >> NV_TX2_TSO_MAX_SHIFT) + ((size & (NV_TX2_TSO_MAX_SIZE-1)) ? 1 : 0); | ||
1034 | |||
1035 | /* add fragments to entries count */ | ||
1036 | for (i = 0; i < fragments; i++) { | ||
1037 | entries += (skb_shinfo(skb)->frags[i].size >> NV_TX2_TSO_MAX_SHIFT) + | ||
1038 | ((skb_shinfo(skb)->frags[i].size & (NV_TX2_TSO_MAX_SIZE-1)) ? 1 : 0); | ||
1039 | } | ||
1028 | 1040 | ||
1029 | spin_lock_irq(&np->lock); | 1041 | spin_lock_irq(&np->lock); |
1030 | 1042 | ||
1031 | if ((np->next_tx - np->nic_tx + fragments) > TX_LIMIT_STOP) { | 1043 | if ((np->next_tx - np->nic_tx + entries - 1) > TX_LIMIT_STOP) { |
1032 | spin_unlock_irq(&np->lock); | 1044 | spin_unlock_irq(&np->lock); |
1033 | netif_stop_queue(dev); | 1045 | netif_stop_queue(dev); |
1034 | return NETDEV_TX_BUSY; | 1046 | return NETDEV_TX_BUSY; |
1035 | } | 1047 | } |
1036 | 1048 | ||
1037 | np->tx_skbuff[nr] = skb; | 1049 | /* setup the header buffer */ |
1038 | 1050 | do { | |
1039 | if (fragments) { | 1051 | bcnt = (size > NV_TX2_TSO_MAX_SIZE) ? NV_TX2_TSO_MAX_SIZE : size; |
1040 | dprintk(KERN_DEBUG "%s: nv_start_xmit: buffer contains %d fragments\n", dev->name, fragments); | 1052 | nr = (nr + 1) % TX_RING; |
1041 | /* setup descriptors in reverse order */ | 1053 | |
1042 | for (i = fragments; i >= 1; i--) { | 1054 | np->tx_dma[nr] = pci_map_single(np->pci_dev, skb->data + offset, bcnt, |
1043 | skb_frag_t *frag = &skb_shinfo(skb)->frags[i-1]; | 1055 | PCI_DMA_TODEVICE); |
1044 | np->tx_dma[nr] = pci_map_page(np->pci_dev, frag->page, frag->page_offset, frag->size, | 1056 | np->tx_dma_len[nr] = bcnt; |
1045 | PCI_DMA_TODEVICE); | 1057 | |
1058 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { | ||
1059 | np->tx_ring.orig[nr].PacketBuffer = cpu_to_le32(np->tx_dma[nr]); | ||
1060 | np->tx_ring.orig[nr].FlagLen = cpu_to_le32((bcnt-1) | tx_flags); | ||
1061 | } else { | ||
1062 | np->tx_ring.ex[nr].PacketBufferHigh = cpu_to_le64(np->tx_dma[nr]) >> 32; | ||
1063 | np->tx_ring.ex[nr].PacketBufferLow = cpu_to_le64(np->tx_dma[nr]) & 0x0FFFFFFFF; | ||
1064 | np->tx_ring.ex[nr].FlagLen = cpu_to_le32((bcnt-1) | tx_flags); | ||
1065 | } | ||
1066 | tx_flags = np->tx_flags; | ||
1067 | offset += bcnt; | ||
1068 | size -= bcnt; | ||
1069 | } while(size); | ||
1070 | |||
1071 | /* setup the fragments */ | ||
1072 | for (i = 0; i < fragments; i++) { | ||
1073 | skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; | ||
1074 | u32 size = frag->size; | ||
1075 | offset = 0; | ||
1076 | |||
1077 | do { | ||
1078 | bcnt = (size > NV_TX2_TSO_MAX_SIZE) ? NV_TX2_TSO_MAX_SIZE : size; | ||
1079 | nr = (nr + 1) % TX_RING; | ||
1080 | |||
1081 | np->tx_dma[nr] = pci_map_page(np->pci_dev, frag->page, frag->page_offset+offset, bcnt, | ||
1082 | PCI_DMA_TODEVICE); | ||
1083 | np->tx_dma_len[nr] = bcnt; | ||
1046 | 1084 | ||
1047 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { | 1085 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { |
1048 | np->tx_ring.orig[nr].PacketBuffer = cpu_to_le32(np->tx_dma[nr]); | 1086 | np->tx_ring.orig[nr].PacketBuffer = cpu_to_le32(np->tx_dma[nr]); |
1049 | np->tx_ring.orig[nr].FlagLen = cpu_to_le32( (frag->size-1) | np->tx_flags | tx_flags_extra); | 1087 | np->tx_ring.orig[nr].FlagLen = cpu_to_le32((bcnt-1) | tx_flags); |
1050 | } else { | 1088 | } else { |
1051 | np->tx_ring.ex[nr].PacketBufferHigh = cpu_to_le64(np->tx_dma[nr]) >> 32; | 1089 | np->tx_ring.ex[nr].PacketBufferHigh = cpu_to_le64(np->tx_dma[nr]) >> 32; |
1052 | np->tx_ring.ex[nr].PacketBufferLow = cpu_to_le64(np->tx_dma[nr]) & 0x0FFFFFFFF; | 1090 | np->tx_ring.ex[nr].PacketBufferLow = cpu_to_le64(np->tx_dma[nr]) & 0x0FFFFFFFF; |
1053 | np->tx_ring.ex[nr].FlagLen = cpu_to_le32( (frag->size-1) | np->tx_flags | tx_flags_extra); | 1091 | np->tx_ring.ex[nr].FlagLen = cpu_to_le32((bcnt-1) | tx_flags); |
1054 | } | 1092 | } |
1055 | 1093 | offset += bcnt; | |
1056 | nr = (nr - 1) % TX_RING; | 1094 | size -= bcnt; |
1095 | } while (size); | ||
1096 | } | ||
1057 | 1097 | ||
1058 | if (np->desc_ver == DESC_VER_1) | 1098 | /* set last fragment flag */ |
1059 | tx_flags_extra &= ~NV_TX_LASTPACKET; | 1099 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { |
1060 | else | 1100 | np->tx_ring.orig[nr].FlagLen |= cpu_to_le32(tx_flags_extra); |
1061 | tx_flags_extra &= ~NV_TX2_LASTPACKET; | 1101 | } else { |
1062 | } | 1102 | np->tx_ring.ex[nr].FlagLen |= cpu_to_le32(tx_flags_extra); |
1063 | } | 1103 | } |
1064 | 1104 | ||
1105 | np->tx_skbuff[nr] = skb; | ||
1106 | |||
1065 | #ifdef NETIF_F_TSO | 1107 | #ifdef NETIF_F_TSO |
1066 | if (skb_shinfo(skb)->tso_size) | 1108 | if (skb_shinfo(skb)->tso_size) |
1067 | tx_flags_extra |= NV_TX2_TSO | (skb_shinfo(skb)->tso_size << NV_TX2_TSO_SHIFT); | 1109 | tx_flags_extra = NV_TX2_TSO | (skb_shinfo(skb)->tso_size << NV_TX2_TSO_SHIFT); |
1068 | else | 1110 | else |
1069 | #endif | 1111 | #endif |
1070 | tx_flags_extra |= (skb->ip_summed == CHECKSUM_HW ? (NV_TX2_CHECKSUM_L3|NV_TX2_CHECKSUM_L4) : 0); | 1112 | tx_flags_extra = (skb->ip_summed == CHECKSUM_HW ? (NV_TX2_CHECKSUM_L3|NV_TX2_CHECKSUM_L4) : 0); |
1071 | 1113 | ||
1072 | np->tx_dma[nr] = pci_map_single(np->pci_dev, skb->data, skb->len-skb->data_len, | 1114 | /* set tx flags */ |
1073 | PCI_DMA_TODEVICE); | ||
1074 | |||
1075 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { | 1115 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { |
1076 | np->tx_ring.orig[nr].PacketBuffer = cpu_to_le32(np->tx_dma[nr]); | 1116 | np->tx_ring.orig[start_nr].FlagLen |= cpu_to_le32(tx_flags | tx_flags_extra); |
1077 | np->tx_ring.orig[nr].FlagLen = cpu_to_le32( (skb->len-skb->data_len-1) | np->tx_flags | tx_flags_extra); | ||
1078 | } else { | 1117 | } else { |
1079 | np->tx_ring.ex[nr].PacketBufferHigh = cpu_to_le64(np->tx_dma[nr]) >> 32; | 1118 | np->tx_ring.ex[start_nr].FlagLen |= cpu_to_le32(tx_flags | tx_flags_extra); |
1080 | np->tx_ring.ex[nr].PacketBufferLow = cpu_to_le64(np->tx_dma[nr]) & 0x0FFFFFFFF; | ||
1081 | np->tx_ring.ex[nr].FlagLen = cpu_to_le32( (skb->len-skb->data_len-1) | np->tx_flags | tx_flags_extra); | ||
1082 | } | 1119 | } |
1083 | 1120 | ||
1084 | dprintk(KERN_DEBUG "%s: nv_start_xmit: packet packet %d queued for transmission. tx_flags_extra: %x\n", | 1121 | dprintk(KERN_DEBUG "%s: nv_start_xmit: packet %d (entries %d) queued for transmission. tx_flags_extra: %x\n", |
1085 | dev->name, np->next_tx, tx_flags_extra); | 1122 | dev->name, np->next_tx, entries, tx_flags_extra); |
1086 | { | 1123 | { |
1087 | int j; | 1124 | int j; |
1088 | for (j=0; j<64; j++) { | 1125 | for (j=0; j<64; j++) { |
@@ -1093,7 +1130,7 @@ static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1093 | dprintk("\n"); | 1130 | dprintk("\n"); |
1094 | } | 1131 | } |
1095 | 1132 | ||
1096 | np->next_tx += 1 + fragments; | 1133 | np->next_tx += entries; |
1097 | 1134 | ||
1098 | dev->trans_start = jiffies; | 1135 | dev->trans_start = jiffies; |
1099 | spin_unlock_irq(&np->lock); | 1136 | spin_unlock_irq(&np->lock); |
@@ -1140,7 +1177,6 @@ static void nv_tx_done(struct net_device *dev) | |||
1140 | np->stats.tx_packets++; | 1177 | np->stats.tx_packets++; |
1141 | np->stats.tx_bytes += skb->len; | 1178 | np->stats.tx_bytes += skb->len; |
1142 | } | 1179 | } |
1143 | nv_release_txskb(dev, i); | ||
1144 | } | 1180 | } |
1145 | } else { | 1181 | } else { |
1146 | if (Flags & NV_TX2_LASTPACKET) { | 1182 | if (Flags & NV_TX2_LASTPACKET) { |
@@ -1156,9 +1192,9 @@ static void nv_tx_done(struct net_device *dev) | |||
1156 | np->stats.tx_packets++; | 1192 | np->stats.tx_packets++; |
1157 | np->stats.tx_bytes += skb->len; | 1193 | np->stats.tx_bytes += skb->len; |
1158 | } | 1194 | } |
1159 | nv_release_txskb(dev, i); | ||
1160 | } | 1195 | } |
1161 | } | 1196 | } |
1197 | nv_release_txskb(dev, i); | ||
1162 | np->nic_tx++; | 1198 | np->nic_tx++; |
1163 | } | 1199 | } |
1164 | if (np->next_tx - np->nic_tx < TX_LIMIT_START) | 1200 | if (np->next_tx - np->nic_tx < TX_LIMIT_START) |
@@ -2456,7 +2492,7 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i | |||
2456 | np->txrxctl_bits |= NVREG_TXRXCTL_RXCHECK; | 2492 | np->txrxctl_bits |= NVREG_TXRXCTL_RXCHECK; |
2457 | dev->features |= NETIF_F_HW_CSUM | NETIF_F_SG; | 2493 | dev->features |= NETIF_F_HW_CSUM | NETIF_F_SG; |
2458 | #ifdef NETIF_F_TSO | 2494 | #ifdef NETIF_F_TSO |
2459 | /* disabled dev->features |= NETIF_F_TSO; */ | 2495 | dev->features |= NETIF_F_TSO; |
2460 | #endif | 2496 | #endif |
2461 | } | 2497 | } |
2462 | 2498 | ||
diff --git a/drivers/net/gianfar.h b/drivers/net/gianfar.h index 94a91da84fbb..cb9d66ac3ab9 100644 --- a/drivers/net/gianfar.h +++ b/drivers/net/gianfar.h | |||
@@ -718,14 +718,14 @@ struct gfar_private { | |||
718 | uint32_t msg_enable; | 718 | uint32_t msg_enable; |
719 | }; | 719 | }; |
720 | 720 | ||
721 | extern inline u32 gfar_read(volatile unsigned *addr) | 721 | static inline u32 gfar_read(volatile unsigned *addr) |
722 | { | 722 | { |
723 | u32 val; | 723 | u32 val; |
724 | val = in_be32(addr); | 724 | val = in_be32(addr); |
725 | return val; | 725 | return val; |
726 | } | 726 | } |
727 | 727 | ||
728 | extern inline void gfar_write(volatile unsigned *addr, u32 val) | 728 | static inline void gfar_write(volatile unsigned *addr, u32 val) |
729 | { | 729 | { |
730 | out_be32(addr, val); | 730 | out_be32(addr, val); |
731 | } | 731 | } |
diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c index 3e9accf137e7..41b3d83c2ab8 100644 --- a/drivers/net/hamradio/mkiss.c +++ b/drivers/net/hamradio/mkiss.c | |||
@@ -524,6 +524,7 @@ static void ax_encaps(struct net_device *dev, unsigned char *icp, int len) | |||
524 | ax->dev->trans_start = jiffies; | 524 | ax->dev->trans_start = jiffies; |
525 | ax->xleft = count - actual; | 525 | ax->xleft = count - actual; |
526 | ax->xhead = ax->xbuff + actual; | 526 | ax->xhead = ax->xbuff + actual; |
527 | spin_unlock_bh(&ax->buflock); | ||
527 | } | 528 | } |
528 | 529 | ||
529 | /* Encapsulate an AX.25 packet and kick it into a TTY queue. */ | 530 | /* Encapsulate an AX.25 packet and kick it into a TTY queue. */ |
diff --git a/drivers/net/hp-plus.c b/drivers/net/hp-plus.c index 0abf5dd08b4c..74e167e7dea7 100644 --- a/drivers/net/hp-plus.c +++ b/drivers/net/hp-plus.c | |||
@@ -138,12 +138,6 @@ static int __init do_hpp_probe(struct net_device *dev) | |||
138 | return -ENODEV; | 138 | return -ENODEV; |
139 | } | 139 | } |
140 | 140 | ||
141 | static void cleanup_card(struct net_device *dev) | ||
142 | { | ||
143 | /* NB: hpp_close() handles free_irq */ | ||
144 | release_region(dev->base_addr - NIC_OFFSET, HP_IO_EXTENT); | ||
145 | } | ||
146 | |||
147 | #ifndef MODULE | 141 | #ifndef MODULE |
148 | struct net_device * __init hp_plus_probe(int unit) | 142 | struct net_device * __init hp_plus_probe(int unit) |
149 | { | 143 | { |
@@ -473,6 +467,12 @@ init_module(void) | |||
473 | return -ENXIO; | 467 | return -ENXIO; |
474 | } | 468 | } |
475 | 469 | ||
470 | static void cleanup_card(struct net_device *dev) | ||
471 | { | ||
472 | /* NB: hpp_close() handles free_irq */ | ||
473 | release_region(dev->base_addr - NIC_OFFSET, HP_IO_EXTENT); | ||
474 | } | ||
475 | |||
476 | void | 476 | void |
477 | cleanup_module(void) | 477 | cleanup_module(void) |
478 | { | 478 | { |
diff --git a/drivers/net/hp.c b/drivers/net/hp.c index 59cf841b14ab..cf9fb3698a6b 100644 --- a/drivers/net/hp.c +++ b/drivers/net/hp.c | |||
@@ -102,12 +102,6 @@ static int __init do_hp_probe(struct net_device *dev) | |||
102 | return -ENODEV; | 102 | return -ENODEV; |
103 | } | 103 | } |
104 | 104 | ||
105 | static void cleanup_card(struct net_device *dev) | ||
106 | { | ||
107 | free_irq(dev->irq, dev); | ||
108 | release_region(dev->base_addr - NIC_OFFSET, HP_IO_EXTENT); | ||
109 | } | ||
110 | |||
111 | #ifndef MODULE | 105 | #ifndef MODULE |
112 | struct net_device * __init hp_probe(int unit) | 106 | struct net_device * __init hp_probe(int unit) |
113 | { | 107 | { |
@@ -444,6 +438,12 @@ init_module(void) | |||
444 | return -ENXIO; | 438 | return -ENXIO; |
445 | } | 439 | } |
446 | 440 | ||
441 | static void cleanup_card(struct net_device *dev) | ||
442 | { | ||
443 | free_irq(dev->irq, dev); | ||
444 | release_region(dev->base_addr - NIC_OFFSET, HP_IO_EXTENT); | ||
445 | } | ||
446 | |||
447 | void | 447 | void |
448 | cleanup_module(void) | 448 | cleanup_module(void) |
449 | { | 449 | { |
diff --git a/drivers/net/ibm_emac/ibm_emac.h b/drivers/net/ibm_emac/ibm_emac.h index 644edbff4f94..c2dae6092c4c 100644 --- a/drivers/net/ibm_emac/ibm_emac.h +++ b/drivers/net/ibm_emac/ibm_emac.h | |||
@@ -110,6 +110,7 @@ struct emac_regs { | |||
110 | #define EMAC_MR1_TFS_2K 0x00080000 | 110 | #define EMAC_MR1_TFS_2K 0x00080000 |
111 | #define EMAC_MR1_TR0_MULT 0x00008000 | 111 | #define EMAC_MR1_TR0_MULT 0x00008000 |
112 | #define EMAC_MR1_JPSM 0x00000000 | 112 | #define EMAC_MR1_JPSM 0x00000000 |
113 | #define EMAC_MR1_MWSW_001 0x00000000 | ||
113 | #define EMAC_MR1_BASE(opb) (EMAC_MR1_TFS_2K | EMAC_MR1_TR0_MULT) | 114 | #define EMAC_MR1_BASE(opb) (EMAC_MR1_TFS_2K | EMAC_MR1_TR0_MULT) |
114 | #else | 115 | #else |
115 | #define EMAC_MR1_RFS_4K 0x00180000 | 116 | #define EMAC_MR1_RFS_4K 0x00180000 |
@@ -130,7 +131,7 @@ struct emac_regs { | |||
130 | (freq) <= 83 ? EMAC_MR1_OBCI_83 : \ | 131 | (freq) <= 83 ? EMAC_MR1_OBCI_83 : \ |
131 | (freq) <= 100 ? EMAC_MR1_OBCI_100 : EMAC_MR1_OBCI_100P) | 132 | (freq) <= 100 ? EMAC_MR1_OBCI_100 : EMAC_MR1_OBCI_100P) |
132 | #define EMAC_MR1_BASE(opb) (EMAC_MR1_TFS_2K | EMAC_MR1_TR | \ | 133 | #define EMAC_MR1_BASE(opb) (EMAC_MR1_TFS_2K | EMAC_MR1_TR | \ |
133 | EMAC_MR1_MWSW_001 | EMAC_MR1_OBCI(opb)) | 134 | EMAC_MR1_OBCI(opb)) |
134 | #endif | 135 | #endif |
135 | 136 | ||
136 | /* EMACx_TMR0 */ | 137 | /* EMACx_TMR0 */ |
diff --git a/drivers/net/ibm_emac/ibm_emac_core.c b/drivers/net/ibm_emac/ibm_emac_core.c index 1da8a66f91e1..591c5864ffb1 100644 --- a/drivers/net/ibm_emac/ibm_emac_core.c +++ b/drivers/net/ibm_emac/ibm_emac_core.c | |||
@@ -408,7 +408,7 @@ static int emac_configure(struct ocp_enet_private *dev) | |||
408 | /* Mode register */ | 408 | /* Mode register */ |
409 | r = EMAC_MR1_BASE(emac_opb_mhz()) | EMAC_MR1_VLE | EMAC_MR1_IST; | 409 | r = EMAC_MR1_BASE(emac_opb_mhz()) | EMAC_MR1_VLE | EMAC_MR1_IST; |
410 | if (dev->phy.duplex == DUPLEX_FULL) | 410 | if (dev->phy.duplex == DUPLEX_FULL) |
411 | r |= EMAC_MR1_FDE; | 411 | r |= EMAC_MR1_FDE | EMAC_MR1_MWSW_001; |
412 | dev->stop_timeout = STOP_TIMEOUT_10; | 412 | dev->stop_timeout = STOP_TIMEOUT_10; |
413 | switch (dev->phy.speed) { | 413 | switch (dev->phy.speed) { |
414 | case SPEED_1000: | 414 | case SPEED_1000: |
diff --git a/drivers/net/irda/vlsi_ir.h b/drivers/net/irda/vlsi_ir.h index 741aecc655df..a82a4ba8de4f 100644 --- a/drivers/net/irda/vlsi_ir.h +++ b/drivers/net/irda/vlsi_ir.h | |||
@@ -577,8 +577,8 @@ struct ring_descr_hw { | |||
577 | struct { | 577 | struct { |
578 | u8 addr_res[3]; | 578 | u8 addr_res[3]; |
579 | volatile u8 status; /* descriptor status */ | 579 | volatile u8 status; /* descriptor status */ |
580 | } rd_s __attribute__((packed)); | 580 | } __attribute__((packed)) rd_s; |
581 | } rd_u __attribute((packed)); | 581 | } __attribute((packed)) rd_u; |
582 | } __attribute__ ((packed)); | 582 | } __attribute__ ((packed)); |
583 | 583 | ||
584 | #define rd_addr rd_u.addr | 584 | #define rd_addr rd_u.addr |
diff --git a/drivers/net/lance.c b/drivers/net/lance.c index 1d75ca0bb939..d1d714faa6ce 100644 --- a/drivers/net/lance.c +++ b/drivers/net/lance.c | |||
@@ -309,17 +309,6 @@ static void lance_tx_timeout (struct net_device *dev); | |||
309 | 309 | ||
310 | 310 | ||
311 | 311 | ||
312 | static void cleanup_card(struct net_device *dev) | ||
313 | { | ||
314 | struct lance_private *lp = dev->priv; | ||
315 | if (dev->dma != 4) | ||
316 | free_dma(dev->dma); | ||
317 | release_region(dev->base_addr, LANCE_TOTAL_SIZE); | ||
318 | kfree(lp->tx_bounce_buffs); | ||
319 | kfree((void*)lp->rx_buffs); | ||
320 | kfree(lp); | ||
321 | } | ||
322 | |||
323 | #ifdef MODULE | 312 | #ifdef MODULE |
324 | #define MAX_CARDS 8 /* Max number of interfaces (cards) per module */ | 313 | #define MAX_CARDS 8 /* Max number of interfaces (cards) per module */ |
325 | 314 | ||
@@ -367,6 +356,17 @@ int init_module(void) | |||
367 | return -ENXIO; | 356 | return -ENXIO; |
368 | } | 357 | } |
369 | 358 | ||
359 | static void cleanup_card(struct net_device *dev) | ||
360 | { | ||
361 | struct lance_private *lp = dev->priv; | ||
362 | if (dev->dma != 4) | ||
363 | free_dma(dev->dma); | ||
364 | release_region(dev->base_addr, LANCE_TOTAL_SIZE); | ||
365 | kfree(lp->tx_bounce_buffs); | ||
366 | kfree((void*)lp->rx_buffs); | ||
367 | kfree(lp); | ||
368 | } | ||
369 | |||
370 | void cleanup_module(void) | 370 | void cleanup_module(void) |
371 | { | 371 | { |
372 | int this_dev; | 372 | int this_dev; |
diff --git a/drivers/net/lne390.c b/drivers/net/lne390.c index 309d254842cf..646e89fc3562 100644 --- a/drivers/net/lne390.c +++ b/drivers/net/lne390.c | |||
@@ -145,13 +145,6 @@ static int __init do_lne390_probe(struct net_device *dev) | |||
145 | return -ENODEV; | 145 | return -ENODEV; |
146 | } | 146 | } |
147 | 147 | ||
148 | static void cleanup_card(struct net_device *dev) | ||
149 | { | ||
150 | free_irq(dev->irq, dev); | ||
151 | release_region(dev->base_addr, LNE390_IO_EXTENT); | ||
152 | iounmap(ei_status.mem); | ||
153 | } | ||
154 | |||
155 | #ifndef MODULE | 148 | #ifndef MODULE |
156 | struct net_device * __init lne390_probe(int unit) | 149 | struct net_device * __init lne390_probe(int unit) |
157 | { | 150 | { |
@@ -440,6 +433,13 @@ int init_module(void) | |||
440 | return -ENXIO; | 433 | return -ENXIO; |
441 | } | 434 | } |
442 | 435 | ||
436 | static void cleanup_card(struct net_device *dev) | ||
437 | { | ||
438 | free_irq(dev->irq, dev); | ||
439 | release_region(dev->base_addr, LNE390_IO_EXTENT); | ||
440 | iounmap(ei_status.mem); | ||
441 | } | ||
442 | |||
443 | void cleanup_module(void) | 443 | void cleanup_module(void) |
444 | { | 444 | { |
445 | int this_dev; | 445 | int this_dev; |
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c index 3cb9b3fe0cf1..22c3a37bba5a 100644 --- a/drivers/net/mv643xx_eth.c +++ b/drivers/net/mv643xx_eth.c | |||
@@ -6,7 +6,7 @@ | |||
6 | * Copyright (C) 2002 rabeeh@galileo.co.il | 6 | * Copyright (C) 2002 rabeeh@galileo.co.il |
7 | * | 7 | * |
8 | * Copyright (C) 2003 PMC-Sierra, Inc., | 8 | * Copyright (C) 2003 PMC-Sierra, Inc., |
9 | * written by Manish Lachwani (lachwani@pmc-sierra.com) | 9 | * written by Manish Lachwani |
10 | * | 10 | * |
11 | * Copyright (C) 2003 Ralf Baechle <ralf@linux-mips.org> | 11 | * Copyright (C) 2003 Ralf Baechle <ralf@linux-mips.org> |
12 | * | 12 | * |
diff --git a/drivers/net/ne.c b/drivers/net/ne.c index 0de8fdd2aa86..94f782d51f0f 100644 --- a/drivers/net/ne.c +++ b/drivers/net/ne.c | |||
@@ -212,15 +212,6 @@ static int __init do_ne_probe(struct net_device *dev) | |||
212 | return -ENODEV; | 212 | return -ENODEV; |
213 | } | 213 | } |
214 | 214 | ||
215 | static void cleanup_card(struct net_device *dev) | ||
216 | { | ||
217 | struct pnp_dev *idev = (struct pnp_dev *)ei_status.priv; | ||
218 | if (idev) | ||
219 | pnp_device_detach(idev); | ||
220 | free_irq(dev->irq, dev); | ||
221 | release_region(dev->base_addr, NE_IO_EXTENT); | ||
222 | } | ||
223 | |||
224 | #ifndef MODULE | 215 | #ifndef MODULE |
225 | struct net_device * __init ne_probe(int unit) | 216 | struct net_device * __init ne_probe(int unit) |
226 | { | 217 | { |
@@ -859,6 +850,15 @@ int init_module(void) | |||
859 | return -ENODEV; | 850 | return -ENODEV; |
860 | } | 851 | } |
861 | 852 | ||
853 | static void cleanup_card(struct net_device *dev) | ||
854 | { | ||
855 | struct pnp_dev *idev = (struct pnp_dev *)ei_status.priv; | ||
856 | if (idev) | ||
857 | pnp_device_detach(idev); | ||
858 | free_irq(dev->irq, dev); | ||
859 | release_region(dev->base_addr, NE_IO_EXTENT); | ||
860 | } | ||
861 | |||
862 | void cleanup_module(void) | 862 | void cleanup_module(void) |
863 | { | 863 | { |
864 | int this_dev; | 864 | int this_dev; |
diff --git a/drivers/net/ne2.c b/drivers/net/ne2.c index 6d62ada85de6..e6df375a1d4b 100644 --- a/drivers/net/ne2.c +++ b/drivers/net/ne2.c | |||
@@ -278,14 +278,6 @@ static int __init do_ne2_probe(struct net_device *dev) | |||
278 | return -ENODEV; | 278 | return -ENODEV; |
279 | } | 279 | } |
280 | 280 | ||
281 | static void cleanup_card(struct net_device *dev) | ||
282 | { | ||
283 | mca_mark_as_unused(ei_status.priv); | ||
284 | mca_set_adapter_procfn( ei_status.priv, NULL, NULL); | ||
285 | free_irq(dev->irq, dev); | ||
286 | release_region(dev->base_addr, NE_IO_EXTENT); | ||
287 | } | ||
288 | |||
289 | #ifndef MODULE | 281 | #ifndef MODULE |
290 | struct net_device * __init ne2_probe(int unit) | 282 | struct net_device * __init ne2_probe(int unit) |
291 | { | 283 | { |
@@ -812,6 +804,14 @@ int init_module(void) | |||
812 | return -ENXIO; | 804 | return -ENXIO; |
813 | } | 805 | } |
814 | 806 | ||
807 | static void cleanup_card(struct net_device *dev) | ||
808 | { | ||
809 | mca_mark_as_unused(ei_status.priv); | ||
810 | mca_set_adapter_procfn( ei_status.priv, NULL, NULL); | ||
811 | free_irq(dev->irq, dev); | ||
812 | release_region(dev->base_addr, NE_IO_EXTENT); | ||
813 | } | ||
814 | |||
815 | void cleanup_module(void) | 815 | void cleanup_module(void) |
816 | { | 816 | { |
817 | int this_dev; | 817 | int this_dev; |
diff --git a/drivers/net/sk98lin/skge.c b/drivers/net/sk98lin/skge.c index 9a76ac180b11..197edd74fbb5 100644 --- a/drivers/net/sk98lin/skge.c +++ b/drivers/net/sk98lin/skge.c | |||
@@ -282,26 +282,22 @@ SK_U32 Val) /* pointer to store the read value */ | |||
282 | * Description: | 282 | * Description: |
283 | * This function initialize the PCI resources and IO | 283 | * This function initialize the PCI resources and IO |
284 | * | 284 | * |
285 | * Returns: N/A | 285 | * Returns: |
286 | * | 286 | * 0 - indicate everything worked ok. |
287 | * != 0 - error indication | ||
287 | */ | 288 | */ |
288 | int SkGeInitPCI(SK_AC *pAC) | 289 | static __devinit int SkGeInitPCI(SK_AC *pAC) |
289 | { | 290 | { |
290 | struct SK_NET_DEVICE *dev = pAC->dev[0]; | 291 | struct SK_NET_DEVICE *dev = pAC->dev[0]; |
291 | struct pci_dev *pdev = pAC->PciDev; | 292 | struct pci_dev *pdev = pAC->PciDev; |
292 | int retval; | 293 | int retval; |
293 | 294 | ||
294 | if (pci_enable_device(pdev) != 0) { | ||
295 | return 1; | ||
296 | } | ||
297 | |||
298 | dev->mem_start = pci_resource_start (pdev, 0); | 295 | dev->mem_start = pci_resource_start (pdev, 0); |
299 | pci_set_master(pdev); | 296 | pci_set_master(pdev); |
300 | 297 | ||
301 | if (pci_request_regions(pdev, "sk98lin") != 0) { | 298 | retval = pci_request_regions(pdev, "sk98lin"); |
302 | retval = 2; | 299 | if (retval) |
303 | goto out_disable; | 300 | goto out; |
304 | } | ||
305 | 301 | ||
306 | #ifdef SK_BIG_ENDIAN | 302 | #ifdef SK_BIG_ENDIAN |
307 | /* | 303 | /* |
@@ -320,9 +316,8 @@ int SkGeInitPCI(SK_AC *pAC) | |||
320 | * Remap the regs into kernel space. | 316 | * Remap the regs into kernel space. |
321 | */ | 317 | */ |
322 | pAC->IoBase = ioremap_nocache(dev->mem_start, 0x4000); | 318 | pAC->IoBase = ioremap_nocache(dev->mem_start, 0x4000); |
323 | 319 | if (!pAC->IoBase) { | |
324 | if (!pAC->IoBase){ | 320 | retval = -EIO; |
325 | retval = 3; | ||
326 | goto out_release; | 321 | goto out_release; |
327 | } | 322 | } |
328 | 323 | ||
@@ -330,8 +325,7 @@ int SkGeInitPCI(SK_AC *pAC) | |||
330 | 325 | ||
331 | out_release: | 326 | out_release: |
332 | pci_release_regions(pdev); | 327 | pci_release_regions(pdev); |
333 | out_disable: | 328 | out: |
334 | pci_disable_device(pdev); | ||
335 | return retval; | 329 | return retval; |
336 | } | 330 | } |
337 | 331 | ||
@@ -492,7 +486,7 @@ module_param_array(AutoSizing, charp, NULL, 0); | |||
492 | * 0, if everything is ok | 486 | * 0, if everything is ok |
493 | * !=0, on error | 487 | * !=0, on error |
494 | */ | 488 | */ |
495 | static int __init SkGeBoardInit(struct SK_NET_DEVICE *dev, SK_AC *pAC) | 489 | static int __devinit SkGeBoardInit(struct SK_NET_DEVICE *dev, SK_AC *pAC) |
496 | { | 490 | { |
497 | short i; | 491 | short i; |
498 | unsigned long Flags; | 492 | unsigned long Flags; |
@@ -529,7 +523,7 @@ SK_BOOL DualNet; | |||
529 | if (SkGeInit(pAC, pAC->IoBase, SK_INIT_DATA) != 0) { | 523 | if (SkGeInit(pAC, pAC->IoBase, SK_INIT_DATA) != 0) { |
530 | printk("HWInit (0) failed.\n"); | 524 | printk("HWInit (0) failed.\n"); |
531 | spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); | 525 | spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); |
532 | return(-EAGAIN); | 526 | return -EIO; |
533 | } | 527 | } |
534 | SkI2cInit( pAC, pAC->IoBase, SK_INIT_DATA); | 528 | SkI2cInit( pAC, pAC->IoBase, SK_INIT_DATA); |
535 | SkEventInit(pAC, pAC->IoBase, SK_INIT_DATA); | 529 | SkEventInit(pAC, pAC->IoBase, SK_INIT_DATA); |
@@ -551,7 +545,7 @@ SK_BOOL DualNet; | |||
551 | if (SkGeInit(pAC, pAC->IoBase, SK_INIT_IO) != 0) { | 545 | if (SkGeInit(pAC, pAC->IoBase, SK_INIT_IO) != 0) { |
552 | printk("sk98lin: HWInit (1) failed.\n"); | 546 | printk("sk98lin: HWInit (1) failed.\n"); |
553 | spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); | 547 | spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); |
554 | return(-EAGAIN); | 548 | return -EIO; |
555 | } | 549 | } |
556 | SkI2cInit( pAC, pAC->IoBase, SK_INIT_IO); | 550 | SkI2cInit( pAC, pAC->IoBase, SK_INIT_IO); |
557 | SkEventInit(pAC, pAC->IoBase, SK_INIT_IO); | 551 | SkEventInit(pAC, pAC->IoBase, SK_INIT_IO); |
@@ -583,20 +577,20 @@ SK_BOOL DualNet; | |||
583 | } else { | 577 | } else { |
584 | printk(KERN_WARNING "sk98lin: Illegal number of ports: %d\n", | 578 | printk(KERN_WARNING "sk98lin: Illegal number of ports: %d\n", |
585 | pAC->GIni.GIMacsFound); | 579 | pAC->GIni.GIMacsFound); |
586 | return -EAGAIN; | 580 | return -EIO; |
587 | } | 581 | } |
588 | 582 | ||
589 | if (Ret) { | 583 | if (Ret) { |
590 | printk(KERN_WARNING "sk98lin: Requested IRQ %d is busy.\n", | 584 | printk(KERN_WARNING "sk98lin: Requested IRQ %d is busy.\n", |
591 | dev->irq); | 585 | dev->irq); |
592 | return -EAGAIN; | 586 | return Ret; |
593 | } | 587 | } |
594 | pAC->AllocFlag |= SK_ALLOC_IRQ; | 588 | pAC->AllocFlag |= SK_ALLOC_IRQ; |
595 | 589 | ||
596 | /* Alloc memory for this board (Mem for RxD/TxD) : */ | 590 | /* Alloc memory for this board (Mem for RxD/TxD) : */ |
597 | if(!BoardAllocMem(pAC)) { | 591 | if(!BoardAllocMem(pAC)) { |
598 | printk("No memory for descriptor rings.\n"); | 592 | printk("No memory for descriptor rings.\n"); |
599 | return(-EAGAIN); | 593 | return -ENOMEM; |
600 | } | 594 | } |
601 | 595 | ||
602 | BoardInitMem(pAC); | 596 | BoardInitMem(pAC); |
@@ -612,7 +606,7 @@ SK_BOOL DualNet; | |||
612 | DualNet)) { | 606 | DualNet)) { |
613 | BoardFreeMem(pAC); | 607 | BoardFreeMem(pAC); |
614 | printk("sk98lin: SkGeInitAssignRamToQueues failed.\n"); | 608 | printk("sk98lin: SkGeInitAssignRamToQueues failed.\n"); |
615 | return(-EAGAIN); | 609 | return -EIO; |
616 | } | 610 | } |
617 | 611 | ||
618 | return (0); | 612 | return (0); |
@@ -633,8 +627,7 @@ SK_BOOL DualNet; | |||
633 | * SK_TRUE, if all memory could be allocated | 627 | * SK_TRUE, if all memory could be allocated |
634 | * SK_FALSE, if not | 628 | * SK_FALSE, if not |
635 | */ | 629 | */ |
636 | static SK_BOOL BoardAllocMem( | 630 | static __devinit SK_BOOL BoardAllocMem(SK_AC *pAC) |
637 | SK_AC *pAC) | ||
638 | { | 631 | { |
639 | caddr_t pDescrMem; /* pointer to descriptor memory area */ | 632 | caddr_t pDescrMem; /* pointer to descriptor memory area */ |
640 | size_t AllocLength; /* length of complete descriptor area */ | 633 | size_t AllocLength; /* length of complete descriptor area */ |
@@ -727,8 +720,7 @@ size_t AllocLength; /* length of complete descriptor area */ | |||
727 | * | 720 | * |
728 | * Returns: N/A | 721 | * Returns: N/A |
729 | */ | 722 | */ |
730 | static void BoardInitMem( | 723 | static __devinit void BoardInitMem(SK_AC *pAC) |
731 | SK_AC *pAC) /* pointer to adapter context */ | ||
732 | { | 724 | { |
733 | int i; /* loop counter */ | 725 | int i; /* loop counter */ |
734 | int RxDescrSize; /* the size of a rx descriptor rounded up to alignment*/ | 726 | int RxDescrSize; /* the size of a rx descriptor rounded up to alignment*/ |
@@ -4776,32 +4768,47 @@ static int __devinit skge_probe_one(struct pci_dev *pdev, | |||
4776 | struct net_device *dev = NULL; | 4768 | struct net_device *dev = NULL; |
4777 | static int boards_found = 0; | 4769 | static int boards_found = 0; |
4778 | int error = -ENODEV; | 4770 | int error = -ENODEV; |
4771 | int using_dac = 0; | ||
4779 | char DeviceStr[80]; | 4772 | char DeviceStr[80]; |
4780 | 4773 | ||
4781 | if (pci_enable_device(pdev)) | 4774 | if (pci_enable_device(pdev)) |
4782 | goto out; | 4775 | goto out; |
4783 | 4776 | ||
4784 | /* Configure DMA attributes. */ | 4777 | /* Configure DMA attributes. */ |
4785 | if (pci_set_dma_mask(pdev, DMA_64BIT_MASK) && | 4778 | if (sizeof(dma_addr_t) > sizeof(u32) && |
4786 | pci_set_dma_mask(pdev, DMA_32BIT_MASK)) | 4779 | !(error = pci_set_dma_mask(pdev, DMA_64BIT_MASK))) { |
4787 | goto out_disable_device; | 4780 | using_dac = 1; |
4788 | 4781 | error = pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK); | |
4782 | if (error < 0) { | ||
4783 | printk(KERN_ERR "sk98lin %s unable to obtain 64 bit DMA " | ||
4784 | "for consistent allocations\n", pci_name(pdev)); | ||
4785 | goto out_disable_device; | ||
4786 | } | ||
4787 | } else { | ||
4788 | error = pci_set_dma_mask(pdev, DMA_32BIT_MASK); | ||
4789 | if (error) { | ||
4790 | printk(KERN_ERR "sk98lin %s no usable DMA configuration\n", | ||
4791 | pci_name(pdev)); | ||
4792 | goto out_disable_device; | ||
4793 | } | ||
4794 | } | ||
4789 | 4795 | ||
4790 | if ((dev = alloc_etherdev(sizeof(DEV_NET))) == NULL) { | 4796 | error = -ENOMEM; |
4791 | printk(KERN_ERR "Unable to allocate etherdev " | 4797 | dev = alloc_etherdev(sizeof(DEV_NET)); |
4798 | if (!dev) { | ||
4799 | printk(KERN_ERR "sk98lin: unable to allocate etherdev " | ||
4792 | "structure!\n"); | 4800 | "structure!\n"); |
4793 | goto out_disable_device; | 4801 | goto out_disable_device; |
4794 | } | 4802 | } |
4795 | 4803 | ||
4796 | pNet = netdev_priv(dev); | 4804 | pNet = netdev_priv(dev); |
4797 | pNet->pAC = kmalloc(sizeof(SK_AC), GFP_KERNEL); | 4805 | pNet->pAC = kzalloc(sizeof(SK_AC), GFP_KERNEL); |
4798 | if (!pNet->pAC) { | 4806 | if (!pNet->pAC) { |
4799 | printk(KERN_ERR "Unable to allocate adapter " | 4807 | printk(KERN_ERR "sk98lin: unable to allocate adapter " |
4800 | "structure!\n"); | 4808 | "structure!\n"); |
4801 | goto out_free_netdev; | 4809 | goto out_free_netdev; |
4802 | } | 4810 | } |
4803 | 4811 | ||
4804 | memset(pNet->pAC, 0, sizeof(SK_AC)); | ||
4805 | pAC = pNet->pAC; | 4812 | pAC = pNet->pAC; |
4806 | pAC->PciDev = pdev; | 4813 | pAC->PciDev = pdev; |
4807 | 4814 | ||
@@ -4810,6 +4817,7 @@ static int __devinit skge_probe_one(struct pci_dev *pdev, | |||
4810 | pAC->CheckQueue = SK_FALSE; | 4817 | pAC->CheckQueue = SK_FALSE; |
4811 | 4818 | ||
4812 | dev->irq = pdev->irq; | 4819 | dev->irq = pdev->irq; |
4820 | |||
4813 | error = SkGeInitPCI(pAC); | 4821 | error = SkGeInitPCI(pAC); |
4814 | if (error) { | 4822 | if (error) { |
4815 | printk(KERN_ERR "sk98lin: PCI setup failed: %i\n", error); | 4823 | printk(KERN_ERR "sk98lin: PCI setup failed: %i\n", error); |
@@ -4844,19 +4852,25 @@ static int __devinit skge_probe_one(struct pci_dev *pdev, | |||
4844 | #endif | 4852 | #endif |
4845 | } | 4853 | } |
4846 | 4854 | ||
4855 | if (using_dac) | ||
4856 | dev->features |= NETIF_F_HIGHDMA; | ||
4857 | |||
4847 | pAC->Index = boards_found++; | 4858 | pAC->Index = boards_found++; |
4848 | 4859 | ||
4849 | if (SkGeBoardInit(dev, pAC)) | 4860 | error = SkGeBoardInit(dev, pAC); |
4861 | if (error) | ||
4850 | goto out_free_netdev; | 4862 | goto out_free_netdev; |
4851 | 4863 | ||
4852 | /* Read Adapter name from VPD */ | 4864 | /* Read Adapter name from VPD */ |
4853 | if (ProductStr(pAC, DeviceStr, sizeof(DeviceStr)) != 0) { | 4865 | if (ProductStr(pAC, DeviceStr, sizeof(DeviceStr)) != 0) { |
4866 | error = -EIO; | ||
4854 | printk(KERN_ERR "sk98lin: Could not read VPD data.\n"); | 4867 | printk(KERN_ERR "sk98lin: Could not read VPD data.\n"); |
4855 | goto out_free_resources; | 4868 | goto out_free_resources; |
4856 | } | 4869 | } |
4857 | 4870 | ||
4858 | /* Register net device */ | 4871 | /* Register net device */ |
4859 | if (register_netdev(dev)) { | 4872 | error = register_netdev(dev); |
4873 | if (error) { | ||
4860 | printk(KERN_ERR "sk98lin: Could not register device.\n"); | 4874 | printk(KERN_ERR "sk98lin: Could not register device.\n"); |
4861 | goto out_free_resources; | 4875 | goto out_free_resources; |
4862 | } | 4876 | } |
@@ -4883,15 +4897,17 @@ static int __devinit skge_probe_one(struct pci_dev *pdev, | |||
4883 | 4897 | ||
4884 | boards_found++; | 4898 | boards_found++; |
4885 | 4899 | ||
4900 | pci_set_drvdata(pdev, dev); | ||
4901 | |||
4886 | /* More then one port found */ | 4902 | /* More then one port found */ |
4887 | if ((pAC->GIni.GIMacsFound == 2 ) && (pAC->RlmtNets == 2)) { | 4903 | if ((pAC->GIni.GIMacsFound == 2 ) && (pAC->RlmtNets == 2)) { |
4888 | if ((dev = alloc_etherdev(sizeof(DEV_NET))) == 0) { | 4904 | dev = alloc_etherdev(sizeof(DEV_NET)); |
4889 | printk(KERN_ERR "Unable to allocate etherdev " | 4905 | if (!dev) { |
4906 | printk(KERN_ERR "sk98lin: unable to allocate etherdev " | ||
4890 | "structure!\n"); | 4907 | "structure!\n"); |
4891 | goto out; | 4908 | goto single_port; |
4892 | } | 4909 | } |
4893 | 4910 | ||
4894 | pAC->dev[1] = dev; | ||
4895 | pNet = netdev_priv(dev); | 4911 | pNet = netdev_priv(dev); |
4896 | pNet->PortNr = 1; | 4912 | pNet->PortNr = 1; |
4897 | pNet->NetNr = 1; | 4913 | pNet->NetNr = 1; |
@@ -4920,20 +4936,28 @@ static int __devinit skge_probe_one(struct pci_dev *pdev, | |||
4920 | #endif | 4936 | #endif |
4921 | } | 4937 | } |
4922 | 4938 | ||
4923 | if (register_netdev(dev)) { | 4939 | if (using_dac) |
4924 | printk(KERN_ERR "sk98lin: Could not register device for seconf port.\n"); | 4940 | dev->features |= NETIF_F_HIGHDMA; |
4941 | |||
4942 | error = register_netdev(dev); | ||
4943 | if (error) { | ||
4944 | printk(KERN_ERR "sk98lin: Could not register device" | ||
4945 | " for second port. (%d)\n", error); | ||
4925 | free_netdev(dev); | 4946 | free_netdev(dev); |
4926 | pAC->dev[1] = pAC->dev[0]; | 4947 | goto single_port; |
4927 | } else { | ||
4928 | memcpy(&dev->dev_addr, | ||
4929 | &pAC->Addr.Net[1].CurrentMacAddress, 6); | ||
4930 | memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); | ||
4931 | |||
4932 | printk("%s: %s\n", dev->name, DeviceStr); | ||
4933 | printk(" PrefPort:B RlmtMode:Dual Check Link State\n"); | ||
4934 | } | 4948 | } |
4949 | |||
4950 | pAC->dev[1] = dev; | ||
4951 | memcpy(&dev->dev_addr, | ||
4952 | &pAC->Addr.Net[1].CurrentMacAddress, 6); | ||
4953 | memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); | ||
4954 | |||
4955 | printk("%s: %s\n", dev->name, DeviceStr); | ||
4956 | printk(" PrefPort:B RlmtMode:Dual Check Link State\n"); | ||
4935 | } | 4957 | } |
4936 | 4958 | ||
4959 | single_port: | ||
4960 | |||
4937 | /* Save the hardware revision */ | 4961 | /* Save the hardware revision */ |
4938 | pAC->HWRevision = (((pAC->GIni.GIPciHwRev >> 4) & 0x0F)*10) + | 4962 | pAC->HWRevision = (((pAC->GIni.GIPciHwRev >> 4) & 0x0F)*10) + |
4939 | (pAC->GIni.GIPciHwRev & 0x0F); | 4963 | (pAC->GIni.GIPciHwRev & 0x0F); |
@@ -4945,7 +4969,6 @@ static int __devinit skge_probe_one(struct pci_dev *pdev, | |||
4945 | memset(&pAC->PnmiBackup, 0, sizeof(SK_PNMI_STRUCT_DATA)); | 4969 | memset(&pAC->PnmiBackup, 0, sizeof(SK_PNMI_STRUCT_DATA)); |
4946 | memcpy(&pAC->PnmiBackup, &pAC->PnmiStruct, sizeof(SK_PNMI_STRUCT_DATA)); | 4970 | memcpy(&pAC->PnmiBackup, &pAC->PnmiStruct, sizeof(SK_PNMI_STRUCT_DATA)); |
4947 | 4971 | ||
4948 | pci_set_drvdata(pdev, dev); | ||
4949 | return 0; | 4972 | return 0; |
4950 | 4973 | ||
4951 | out_free_resources: | 4974 | out_free_resources: |
diff --git a/drivers/net/smc-ultra.c b/drivers/net/smc-ultra.c index ba8593ac3f8a..3db30cd0625e 100644 --- a/drivers/net/smc-ultra.c +++ b/drivers/net/smc-ultra.c | |||
@@ -168,18 +168,6 @@ static int __init do_ultra_probe(struct net_device *dev) | |||
168 | return -ENODEV; | 168 | return -ENODEV; |
169 | } | 169 | } |
170 | 170 | ||
171 | static void cleanup_card(struct net_device *dev) | ||
172 | { | ||
173 | /* NB: ultra_close_card() does free_irq */ | ||
174 | #ifdef __ISAPNP__ | ||
175 | struct pnp_dev *idev = (struct pnp_dev *)ei_status.priv; | ||
176 | if (idev) | ||
177 | pnp_device_detach(idev); | ||
178 | #endif | ||
179 | release_region(dev->base_addr - ULTRA_NIC_OFFSET, ULTRA_IO_EXTENT); | ||
180 | iounmap(ei_status.mem); | ||
181 | } | ||
182 | |||
183 | #ifndef MODULE | 171 | #ifndef MODULE |
184 | struct net_device * __init ultra_probe(int unit) | 172 | struct net_device * __init ultra_probe(int unit) |
185 | { | 173 | { |
@@ -594,6 +582,18 @@ init_module(void) | |||
594 | return -ENXIO; | 582 | return -ENXIO; |
595 | } | 583 | } |
596 | 584 | ||
585 | static void cleanup_card(struct net_device *dev) | ||
586 | { | ||
587 | /* NB: ultra_close_card() does free_irq */ | ||
588 | #ifdef __ISAPNP__ | ||
589 | struct pnp_dev *idev = (struct pnp_dev *)ei_status.priv; | ||
590 | if (idev) | ||
591 | pnp_device_detach(idev); | ||
592 | #endif | ||
593 | release_region(dev->base_addr - ULTRA_NIC_OFFSET, ULTRA_IO_EXTENT); | ||
594 | iounmap(ei_status.mem); | ||
595 | } | ||
596 | |||
597 | void | 597 | void |
598 | cleanup_module(void) | 598 | cleanup_module(void) |
599 | { | 599 | { |
diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c index 28bf2e69eb5e..7ec08127c9d6 100644 --- a/drivers/net/smc91x.c +++ b/drivers/net/smc91x.c | |||
@@ -88,7 +88,6 @@ static const char version[] = | |||
88 | #include <linux/skbuff.h> | 88 | #include <linux/skbuff.h> |
89 | 89 | ||
90 | #include <asm/io.h> | 90 | #include <asm/io.h> |
91 | #include <asm/irq.h> | ||
92 | 91 | ||
93 | #include "smc91x.h" | 92 | #include "smc91x.h" |
94 | 93 | ||
@@ -2007,12 +2006,10 @@ static int __init smc_probe(struct net_device *dev, void __iomem *ioaddr) | |||
2007 | } | 2006 | } |
2008 | 2007 | ||
2009 | /* Grab the IRQ */ | 2008 | /* Grab the IRQ */ |
2010 | retval = request_irq(dev->irq, &smc_interrupt, 0, dev->name, dev); | 2009 | retval = request_irq(dev->irq, &smc_interrupt, SMC_IRQ_FLAGS, dev->name, dev); |
2011 | if (retval) | 2010 | if (retval) |
2012 | goto err_out; | 2011 | goto err_out; |
2013 | 2012 | ||
2014 | set_irq_type(dev->irq, SMC_IRQ_TRIGGER_TYPE); | ||
2015 | |||
2016 | #ifdef SMC_USE_PXA_DMA | 2013 | #ifdef SMC_USE_PXA_DMA |
2017 | { | 2014 | { |
2018 | int dma = pxa_request_dma(dev->name, DMA_PRIO_LOW, | 2015 | int dma = pxa_request_dma(dev->name, DMA_PRIO_LOW, |
diff --git a/drivers/net/smc91x.h b/drivers/net/smc91x.h index 5c2824be4ee6..e0efd1964e72 100644 --- a/drivers/net/smc91x.h +++ b/drivers/net/smc91x.h | |||
@@ -90,7 +90,7 @@ | |||
90 | __l--; \ | 90 | __l--; \ |
91 | } \ | 91 | } \ |
92 | } while (0) | 92 | } while (0) |
93 | #define set_irq_type(irq, type) | 93 | #define SMC_IRQ_FLAGS (0) |
94 | 94 | ||
95 | #elif defined(CONFIG_SA1100_PLEB) | 95 | #elif defined(CONFIG_SA1100_PLEB) |
96 | /* We can only do 16-bit reads and writes in the static memory space. */ | 96 | /* We can only do 16-bit reads and writes in the static memory space. */ |
@@ -109,7 +109,7 @@ | |||
109 | #define SMC_outw(v, a, r) writew(v, (a) + (r)) | 109 | #define SMC_outw(v, a, r) writew(v, (a) + (r)) |
110 | #define SMC_outsw(a, r, p, l) writesw((a) + (r), p, l) | 110 | #define SMC_outsw(a, r, p, l) writesw((a) + (r), p, l) |
111 | 111 | ||
112 | #define set_irq_type(irq, type) do {} while (0) | 112 | #define SMC_IRQ_FLAGS (0) |
113 | 113 | ||
114 | #elif defined(CONFIG_SA1100_ASSABET) | 114 | #elif defined(CONFIG_SA1100_ASSABET) |
115 | 115 | ||
@@ -185,11 +185,11 @@ SMC_outw(u16 val, void __iomem *ioaddr, int reg) | |||
185 | #include <asm/mach-types.h> | 185 | #include <asm/mach-types.h> |
186 | #include <asm/arch/cpu.h> | 186 | #include <asm/arch/cpu.h> |
187 | 187 | ||
188 | #define SMC_IRQ_TRIGGER_TYPE (( \ | 188 | #define SMC_IRQ_FLAGS (( \ |
189 | machine_is_omap_h2() \ | 189 | machine_is_omap_h2() \ |
190 | || machine_is_omap_h3() \ | 190 | || machine_is_omap_h3() \ |
191 | || (machine_is_omap_innovator() && !cpu_is_omap1510()) \ | 191 | || (machine_is_omap_innovator() && !cpu_is_omap1510()) \ |
192 | ) ? IRQT_FALLING : IRQT_RISING) | 192 | ) ? SA_TRIGGER_FALLING : SA_TRIGGER_RISING) |
193 | 193 | ||
194 | 194 | ||
195 | #elif defined(CONFIG_SH_SH4202_MICRODEV) | 195 | #elif defined(CONFIG_SH_SH4202_MICRODEV) |
@@ -209,7 +209,7 @@ SMC_outw(u16 val, void __iomem *ioaddr, int reg) | |||
209 | #define SMC_insw(a, r, p, l) insw((a) + (r) - 0xa0000000, p, l) | 209 | #define SMC_insw(a, r, p, l) insw((a) + (r) - 0xa0000000, p, l) |
210 | #define SMC_outsw(a, r, p, l) outsw((a) + (r) - 0xa0000000, p, l) | 210 | #define SMC_outsw(a, r, p, l) outsw((a) + (r) - 0xa0000000, p, l) |
211 | 211 | ||
212 | #define set_irq_type(irq, type) do {} while(0) | 212 | #define SMC_IRQ_FLAGS (0) |
213 | 213 | ||
214 | #elif defined(CONFIG_ISA) | 214 | #elif defined(CONFIG_ISA) |
215 | 215 | ||
@@ -237,7 +237,7 @@ SMC_outw(u16 val, void __iomem *ioaddr, int reg) | |||
237 | #define SMC_insw(a, r, p, l) insw(((u32)a) + (r), p, l) | 237 | #define SMC_insw(a, r, p, l) insw(((u32)a) + (r), p, l) |
238 | #define SMC_outsw(a, r, p, l) outsw(((u32)a) + (r), p, l) | 238 | #define SMC_outsw(a, r, p, l) outsw(((u32)a) + (r), p, l) |
239 | 239 | ||
240 | #define set_irq_type(irq, type) do {} while(0) | 240 | #define SMC_IRQ_FLAGS (0) |
241 | 241 | ||
242 | #define RPC_LSA_DEFAULT RPC_LED_TX_RX | 242 | #define RPC_LSA_DEFAULT RPC_LED_TX_RX |
243 | #define RPC_LSB_DEFAULT RPC_LED_100_10 | 243 | #define RPC_LSB_DEFAULT RPC_LED_100_10 |
@@ -319,7 +319,7 @@ static inline void SMC_outsw (unsigned long a, int r, unsigned char* p, int l) | |||
319 | au_writew(*_p++ , _a); \ | 319 | au_writew(*_p++ , _a); \ |
320 | } while(0) | 320 | } while(0) |
321 | 321 | ||
322 | #define set_irq_type(irq, type) do {} while (0) | 322 | #define SMC_IRQ_FLAGS (0) |
323 | 323 | ||
324 | #else | 324 | #else |
325 | 325 | ||
@@ -342,8 +342,8 @@ static inline void SMC_outsw (unsigned long a, int r, unsigned char* p, int l) | |||
342 | 342 | ||
343 | #endif | 343 | #endif |
344 | 344 | ||
345 | #ifndef SMC_IRQ_TRIGGER_TYPE | 345 | #ifndef SMC_IRQ_FLAGS |
346 | #define SMC_IRQ_TRIGGER_TYPE IRQT_RISING | 346 | #define SMC_IRQ_FLAGS SA_TRIGGER_RISING |
347 | #endif | 347 | #endif |
348 | 348 | ||
349 | #ifdef SMC_USE_PXA_DMA | 349 | #ifdef SMC_USE_PXA_DMA |
diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c index 125ed00e95a5..c67c91251d04 100644 --- a/drivers/net/tulip/tulip_core.c +++ b/drivers/net/tulip/tulip_core.c | |||
@@ -1564,7 +1564,7 @@ static int __devinit tulip_init_one (struct pci_dev *pdev, | |||
1564 | dev->dev_addr, 6); | 1564 | dev->dev_addr, 6); |
1565 | } | 1565 | } |
1566 | #endif | 1566 | #endif |
1567 | #if defined(__i386__) /* Patch up x86 BIOS bug. */ | 1567 | #if defined(__i386__) || defined(__x86_64__) /* Patch up x86 BIOS bug. */ |
1568 | if (last_irq) | 1568 | if (last_irq) |
1569 | irq = last_irq; | 1569 | irq = last_irq; |
1570 | #endif | 1570 | #endif |
diff --git a/drivers/net/wan/sdla.c b/drivers/net/wan/sdla.c index 036adc4f8ba7..22e794071cf4 100644 --- a/drivers/net/wan/sdla.c +++ b/drivers/net/wan/sdla.c | |||
@@ -329,9 +329,9 @@ static int sdla_cpuspeed(struct net_device *dev, struct ifreq *ifr) | |||
329 | 329 | ||
330 | struct _dlci_stat | 330 | struct _dlci_stat |
331 | { | 331 | { |
332 | short dlci __attribute__((packed)); | 332 | short dlci; |
333 | char flags __attribute__((packed)); | 333 | char flags; |
334 | }; | 334 | } __attribute__((packed)); |
335 | 335 | ||
336 | struct _frad_stat | 336 | struct _frad_stat |
337 | { | 337 | { |
diff --git a/drivers/net/wd.c b/drivers/net/wd.c index b03feae459fc..7caa8dc88a58 100644 --- a/drivers/net/wd.c +++ b/drivers/net/wd.c | |||
@@ -127,13 +127,6 @@ static int __init do_wd_probe(struct net_device *dev) | |||
127 | return -ENODEV; | 127 | return -ENODEV; |
128 | } | 128 | } |
129 | 129 | ||
130 | static void cleanup_card(struct net_device *dev) | ||
131 | { | ||
132 | free_irq(dev->irq, dev); | ||
133 | release_region(dev->base_addr - WD_NIC_OFFSET, WD_IO_EXTENT); | ||
134 | iounmap(ei_status.mem); | ||
135 | } | ||
136 | |||
137 | #ifndef MODULE | 130 | #ifndef MODULE |
138 | struct net_device * __init wd_probe(int unit) | 131 | struct net_device * __init wd_probe(int unit) |
139 | { | 132 | { |
@@ -538,6 +531,13 @@ init_module(void) | |||
538 | return -ENXIO; | 531 | return -ENXIO; |
539 | } | 532 | } |
540 | 533 | ||
534 | static void cleanup_card(struct net_device *dev) | ||
535 | { | ||
536 | free_irq(dev->irq, dev); | ||
537 | release_region(dev->base_addr - WD_NIC_OFFSET, WD_IO_EXTENT); | ||
538 | iounmap(ei_status.mem); | ||
539 | } | ||
540 | |||
541 | void | 541 | void |
542 | cleanup_module(void) | 542 | cleanup_module(void) |
543 | { | 543 | { |
diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c index 44cd3fcd1572..cf05661fb1bd 100644 --- a/drivers/net/wireless/ipw2100.c +++ b/drivers/net/wireless/ipw2100.c | |||
@@ -7153,7 +7153,7 @@ static int ipw2100_wx_get_range(struct net_device *dev, | |||
7153 | 7153 | ||
7154 | /* Set the Wireless Extension versions */ | 7154 | /* Set the Wireless Extension versions */ |
7155 | range->we_version_compiled = WIRELESS_EXT; | 7155 | range->we_version_compiled = WIRELESS_EXT; |
7156 | range->we_version_source = 16; | 7156 | range->we_version_source = 18; |
7157 | 7157 | ||
7158 | // range->retry_capa; /* What retry options are supported */ | 7158 | // range->retry_capa; /* What retry options are supported */ |
7159 | // range->retry_flags; /* How to decode max/min retry limit */ | 7159 | // range->retry_flags; /* How to decode max/min retry limit */ |
@@ -7184,6 +7184,9 @@ static int ipw2100_wx_get_range(struct net_device *dev, | |||
7184 | IW_EVENT_CAPA_MASK(SIOCGIWAP)); | 7184 | IW_EVENT_CAPA_MASK(SIOCGIWAP)); |
7185 | range->event_capa[1] = IW_EVENT_CAPA_K_1; | 7185 | range->event_capa[1] = IW_EVENT_CAPA_K_1; |
7186 | 7186 | ||
7187 | range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 | | ||
7188 | IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP; | ||
7189 | |||
7187 | IPW_DEBUG_WX("GET Range\n"); | 7190 | IPW_DEBUG_WX("GET Range\n"); |
7188 | 7191 | ||
7189 | return 0; | 7192 | return 0; |