diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2005-11-05 15:44:48 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-11-05 15:44:48 -0500 |
commit | 18ce920a6eba05c0d55cdc95fbbadf7e4c4b457b (patch) | |
tree | c4a4a9a0455c00edf16689cf0252c82c52d518db /drivers/net | |
parent | c4811b151b6584a668de8ae59eb71c4890b9ad94 (diff) | |
parent | 70d9d825e0a5a78ec1dacaaaf5c72ff5b0206fab (diff) |
Merge branch 'master'
Diffstat (limited to 'drivers/net')
39 files changed, 830 insertions, 596 deletions
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 6d4f9ceb0a32..1958d9e16a3a 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -1203,7 +1203,7 @@ config IBM_EMAC_RX_SKB_HEADROOM | |||
1203 | 1203 | ||
1204 | config IBM_EMAC_PHY_RX_CLK_FIX | 1204 | config IBM_EMAC_PHY_RX_CLK_FIX |
1205 | bool "PHY Rx clock workaround" | 1205 | bool "PHY Rx clock workaround" |
1206 | depends on IBM_EMAC && (405EP || 440GX || 440EP) | 1206 | depends on IBM_EMAC && (405EP || 440GX || 440EP || 440GR) |
1207 | help | 1207 | help |
1208 | Enable this if EMAC attached to a PHY which doesn't generate | 1208 | Enable this if EMAC attached to a PHY which doesn't generate |
1209 | RX clock if there is no link, if this is the case, you will | 1209 | RX clock if there is no link, if this is the case, you will |
@@ -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 || MACH_MP1000 | 1377 | depends on (NET_PCI && (ISA || ARCH_IXDP2X01)) || ARCH_PNX0105 |
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 |
@@ -2258,17 +2258,6 @@ config S2IO_NAPI | |||
2258 | 2258 | ||
2259 | If in doubt, say N. | 2259 | If in doubt, say N. |
2260 | 2260 | ||
2261 | config 2BUFF_MODE | ||
2262 | bool "Use 2 Buffer Mode on Rx side." | ||
2263 | depends on S2IO | ||
2264 | ---help--- | ||
2265 | On enabling the 2 buffer mode, the received frame will be | ||
2266 | split into 2 parts before being DMA'ed to the hosts memory. | ||
2267 | The parts are the ethernet header and ethernet payload. | ||
2268 | This is useful on systems where DMA'ing to to unaligned | ||
2269 | physical memory loactions comes with a heavy price. | ||
2270 | If not sure please say N. | ||
2271 | |||
2272 | endmenu | 2261 | endmenu |
2273 | 2262 | ||
2274 | if !UML | 2263 | if !UML |
diff --git a/drivers/net/arm/am79c961a.c b/drivers/net/arm/am79c961a.c index 3d50e953faaa..877891a29aaa 100644 --- a/drivers/net/arm/am79c961a.c +++ b/drivers/net/arm/am79c961a.c | |||
@@ -26,11 +26,11 @@ | |||
26 | #include <linux/init.h> | 26 | #include <linux/init.h> |
27 | #include <linux/crc32.h> | 27 | #include <linux/crc32.h> |
28 | #include <linux/bitops.h> | 28 | #include <linux/bitops.h> |
29 | #include <linux/platform_device.h> | ||
29 | 30 | ||
30 | #include <asm/system.h> | ||
31 | #include <asm/irq.h> | ||
32 | #include <asm/hardware.h> | 31 | #include <asm/hardware.h> |
33 | #include <asm/io.h> | 32 | #include <asm/io.h> |
33 | #include <asm/system.h> | ||
34 | 34 | ||
35 | #define TX_BUFFERS 15 | 35 | #define TX_BUFFERS 15 |
36 | #define RX_BUFFERS 25 | 36 | #define RX_BUFFERS 25 |
@@ -280,10 +280,13 @@ static void am79c961_timer(unsigned long data) | |||
280 | lnkstat = read_ireg(dev->base_addr, ISALED0) & ISALED0_LNKST; | 280 | lnkstat = read_ireg(dev->base_addr, ISALED0) & ISALED0_LNKST; |
281 | carrier = netif_carrier_ok(dev); | 281 | carrier = netif_carrier_ok(dev); |
282 | 282 | ||
283 | if (lnkstat && !carrier) | 283 | if (lnkstat && !carrier) { |
284 | netif_carrier_on(dev); | 284 | netif_carrier_on(dev); |
285 | else if (!lnkstat && carrier) | 285 | printk("%s: link up\n", dev->name); |
286 | } else if (!lnkstat && carrier) { | ||
286 | netif_carrier_off(dev); | 287 | netif_carrier_off(dev); |
288 | printk("%s: link down\n", dev->name); | ||
289 | } | ||
287 | 290 | ||
288 | mod_timer(&priv->timer, jiffies + msecs_to_jiffies(500)); | 291 | mod_timer(&priv->timer, jiffies + msecs_to_jiffies(500)); |
289 | } | 292 | } |
@@ -665,17 +668,25 @@ static void __init am79c961_banner(void) | |||
665 | printk(KERN_INFO "%s", version); | 668 | printk(KERN_INFO "%s", version); |
666 | } | 669 | } |
667 | 670 | ||
668 | static int __init am79c961_init(void) | 671 | static int __init am79c961_probe(struct device *_dev) |
669 | { | 672 | { |
673 | struct platform_device *pdev = to_platform_device(_dev); | ||
674 | struct resource *res; | ||
670 | struct net_device *dev; | 675 | struct net_device *dev; |
671 | struct dev_priv *priv; | 676 | struct dev_priv *priv; |
672 | int i, ret; | 677 | int i, ret; |
673 | 678 | ||
679 | res = platform_get_resource(pdev, IORESOURCE_IO, 0); | ||
680 | if (!res) | ||
681 | return -ENODEV; | ||
682 | |||
674 | dev = alloc_etherdev(sizeof(struct dev_priv)); | 683 | dev = alloc_etherdev(sizeof(struct dev_priv)); |
675 | ret = -ENOMEM; | 684 | ret = -ENOMEM; |
676 | if (!dev) | 685 | if (!dev) |
677 | goto out; | 686 | goto out; |
678 | 687 | ||
688 | SET_NETDEV_DEV(dev, &pdev->dev); | ||
689 | |||
679 | priv = netdev_priv(dev); | 690 | priv = netdev_priv(dev); |
680 | 691 | ||
681 | /* | 692 | /* |
@@ -683,8 +694,8 @@ static int __init am79c961_init(void) | |||
683 | * The PNP initialisation should have been | 694 | * The PNP initialisation should have been |
684 | * done by the ether bootp loader. | 695 | * done by the ether bootp loader. |
685 | */ | 696 | */ |
686 | dev->base_addr = 0x220; | 697 | dev->base_addr = res->start; |
687 | dev->irq = IRQ_EBSA110_ETHERNET; | 698 | dev->irq = platform_get_irq(pdev, 0); |
688 | 699 | ||
689 | ret = -ENODEV; | 700 | ret = -ENODEV; |
690 | if (!request_region(dev->base_addr, 0x18, dev->name)) | 701 | if (!request_region(dev->base_addr, 0x18, dev->name)) |
@@ -705,11 +716,11 @@ static int __init am79c961_init(void) | |||
705 | inb(dev->base_addr + 4) != 0x2b) | 716 | inb(dev->base_addr + 4) != 0x2b) |
706 | goto release; | 717 | goto release; |
707 | 718 | ||
708 | am79c961_banner(); | ||
709 | |||
710 | for (i = 0; i < 6; i++) | 719 | for (i = 0; i < 6; i++) |
711 | dev->dev_addr[i] = inb(dev->base_addr + i * 2) & 0xff; | 720 | dev->dev_addr[i] = inb(dev->base_addr + i * 2) & 0xff; |
712 | 721 | ||
722 | am79c961_banner(); | ||
723 | |||
713 | spin_lock_init(&priv->chip_lock); | 724 | spin_lock_init(&priv->chip_lock); |
714 | init_timer(&priv->timer); | 725 | init_timer(&priv->timer); |
715 | priv->timer.data = (unsigned long)dev; | 726 | priv->timer.data = (unsigned long)dev; |
@@ -732,6 +743,7 @@ static int __init am79c961_init(void) | |||
732 | if (ret == 0) { | 743 | if (ret == 0) { |
733 | printk(KERN_INFO "%s: ether address ", dev->name); | 744 | printk(KERN_INFO "%s: ether address ", dev->name); |
734 | 745 | ||
746 | /* Retrive and print the ethernet address. */ | ||
735 | for (i = 0; i < 6; i++) | 747 | for (i = 0; i < 6; i++) |
736 | printk (i == 5 ? "%02x\n" : "%02x:", dev->dev_addr[i]); | 748 | printk (i == 5 ? "%02x\n" : "%02x:", dev->dev_addr[i]); |
737 | 749 | ||
@@ -746,4 +758,15 @@ out: | |||
746 | return ret; | 758 | return ret; |
747 | } | 759 | } |
748 | 760 | ||
761 | static struct device_driver am79c961_driver = { | ||
762 | .name = "am79c961", | ||
763 | .bus = &platform_bus_type, | ||
764 | .probe = am79c961_probe, | ||
765 | }; | ||
766 | |||
767 | static int __init am79c961_init(void) | ||
768 | { | ||
769 | return driver_register(&am79c961_driver); | ||
770 | } | ||
771 | |||
749 | __initcall(am79c961_init); | 772 | __initcall(am79c961_init); |
diff --git a/drivers/net/arm/am79c961a.h b/drivers/net/arm/am79c961a.h index 1e9b05050cbe..6a49ac7f6d46 100644 --- a/drivers/net/arm/am79c961a.h +++ b/drivers/net/arm/am79c961a.h | |||
@@ -143,6 +143,4 @@ struct dev_priv { | |||
143 | struct timer_list timer; | 143 | struct timer_list timer; |
144 | }; | 144 | }; |
145 | 145 | ||
146 | extern int am79c961_probe (struct net_device *dev); | ||
147 | |||
148 | #endif | 146 | #endif |
diff --git a/drivers/net/bmac.c b/drivers/net/bmac.c index 73f2fcfc557f..bbca8ae8018c 100644 --- a/drivers/net/bmac.c +++ b/drivers/net/bmac.c | |||
@@ -1658,6 +1658,7 @@ static struct of_device_id bmac_match[] = | |||
1658 | }, | 1658 | }, |
1659 | {}, | 1659 | {}, |
1660 | }; | 1660 | }; |
1661 | MODULE_DEVICE_TABLE (of, bmac_match); | ||
1661 | 1662 | ||
1662 | static struct macio_driver bmac_driver = | 1663 | static struct macio_driver bmac_driver = |
1663 | { | 1664 | { |
diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c index bfdae10036ed..a6078ad9b654 100644 --- a/drivers/net/cs89x0.c +++ b/drivers/net/cs89x0.c | |||
@@ -182,10 +182,6 @@ static unsigned int cs8900_irq_map[] = {IRQ_IXDP2X01_CS8900, 0, 0, 0}; | |||
182 | #define CIRRUS_DEFAULT_IRQ VH_INTC_INT_NUM_CASCADED_INTERRUPT_1 /* Event inputs bank 1 - ID 35/bit 3 */ | 182 | #define CIRRUS_DEFAULT_IRQ VH_INTC_INT_NUM_CASCADED_INTERRUPT_1 /* Event inputs bank 1 - ID 35/bit 3 */ |
183 | static unsigned int netcard_portlist[] __initdata = {CIRRUS_DEFAULT_BASE, 0}; | 183 | static unsigned int netcard_portlist[] __initdata = {CIRRUS_DEFAULT_BASE, 0}; |
184 | static unsigned int cs8900_irq_map[] = {CIRRUS_DEFAULT_IRQ, 0, 0, 0}; | 184 | static unsigned int cs8900_irq_map[] = {CIRRUS_DEFAULT_IRQ, 0, 0, 0}; |
185 | #elif defined(CONFIG_MACH_MP1000) | ||
186 | #include <asm/arch/mp1000-seprom.h> | ||
187 | static unsigned int netcard_portlist[] __initdata = {MP1000_EIO_BASE+0x300, 0}; | ||
188 | static unsigned int cs8900_irq_map[] = {IRQ_EINT3,0,0,0}; | ||
189 | #else | 185 | #else |
190 | static unsigned int netcard_portlist[] __initdata = | 186 | static unsigned int netcard_portlist[] __initdata = |
191 | { 0x300, 0x320, 0x340, 0x360, 0x200, 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0, 0}; | 187 | { 0x300, 0x320, 0x340, 0x360, 0x200, 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0, 0}; |
@@ -594,10 +590,6 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular) | |||
594 | cnt -= j; | 590 | cnt -= j; |
595 | } | 591 | } |
596 | } else | 592 | } else |
597 | #elif defined(CONFIG_MACH_MP1000) | ||
598 | if (1) { | ||
599 | memcpy(dev->dev_addr, get_eeprom_mac_address(), ETH_ALEN); | ||
600 | } else | ||
601 | #endif | 593 | #endif |
602 | 594 | ||
603 | if ((readreg(dev, PP_SelfST) & (EEPROM_OK | EEPROM_PRESENT)) == | 595 | if ((readreg(dev, PP_SelfST) & (EEPROM_OK | EEPROM_PRESENT)) == |
@@ -657,10 +649,6 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular) | |||
657 | if (1) { | 649 | if (1) { |
658 | printk(KERN_NOTICE "cs89x0: No EEPROM on HiCO.SH4\n"); | 650 | printk(KERN_NOTICE "cs89x0: No EEPROM on HiCO.SH4\n"); |
659 | } else | 651 | } else |
660 | #elif defined(CONFIG_MACH_MP1000) | ||
661 | if (1) { | ||
662 | lp->force |= FORCE_RJ45; | ||
663 | } else | ||
664 | #endif | 652 | #endif |
665 | if ((readreg(dev, PP_SelfST) & EEPROM_PRESENT) == 0) | 653 | if ((readreg(dev, PP_SelfST) & EEPROM_PRESENT) == 0) |
666 | printk(KERN_WARNING "cs89x0: No EEPROM, relying on command line....\n"); | 654 | printk(KERN_WARNING "cs89x0: No EEPROM, relying on command line....\n"); |
@@ -1243,7 +1231,7 @@ net_open(struct net_device *dev) | |||
1243 | else | 1231 | else |
1244 | #endif | 1232 | #endif |
1245 | { | 1233 | { |
1246 | #if !defined(CONFIG_ARCH_IXDP2X01) && !defined(CONFIG_ARCH_PNX0105) && !defined(CONFIG_MACH_MP1000) | 1234 | #if !defined(CONFIG_ARCH_IXDP2X01) && !defined(CONFIG_ARCH_PNX0105) |
1247 | if (((1 << dev->irq) & lp->irq_map) == 0) { | 1235 | if (((1 << dev->irq) & lp->irq_map) == 0) { |
1248 | printk(KERN_ERR "%s: IRQ %d is not in our map of allowable IRQs, which is %x\n", | 1236 | printk(KERN_ERR "%s: IRQ %d is not in our map of allowable IRQs, which is %x\n", |
1249 | dev->name, dev->irq, lp->irq_map); | 1237 | dev->name, dev->irq, lp->irq_map); |
diff --git a/drivers/net/cs89x0.h b/drivers/net/cs89x0.h index f19d1ebe0183..decea264f121 100644 --- a/drivers/net/cs89x0.h +++ b/drivers/net/cs89x0.h | |||
@@ -16,7 +16,7 @@ | |||
16 | 16 | ||
17 | #include <linux/config.h> | 17 | #include <linux/config.h> |
18 | 18 | ||
19 | #if defined(CONFIG_ARCH_IXDP2X01) || defined(CONFIG_ARCH_PNX0105) || defined (CONFIG_MACH_MP1000) | 19 | #if defined(CONFIG_ARCH_IXDP2X01) || defined(CONFIG_ARCH_PNX0105) |
20 | /* IXDP2401/IXDP2801 uses dword-aligned register addressing */ | 20 | /* IXDP2401/IXDP2801 uses dword-aligned register addressing */ |
21 | #define CS89x0_PORT(reg) ((reg) * 2) | 21 | #define CS89x0_PORT(reg) ((reg) * 2) |
22 | #else | 22 | #else |
diff --git a/drivers/net/depca.c b/drivers/net/depca.c index c4aa5fe2840e..4d26e5e7d18b 100644 --- a/drivers/net/depca.c +++ b/drivers/net/depca.c | |||
@@ -254,7 +254,7 @@ | |||
254 | #include <linux/unistd.h> | 254 | #include <linux/unistd.h> |
255 | #include <linux/ctype.h> | 255 | #include <linux/ctype.h> |
256 | #include <linux/moduleparam.h> | 256 | #include <linux/moduleparam.h> |
257 | #include <linux/device.h> | 257 | #include <linux/platform_device.h> |
258 | #include <linux/bitops.h> | 258 | #include <linux/bitops.h> |
259 | 259 | ||
260 | #include <asm/uaccess.h> | 260 | #include <asm/uaccess.h> |
diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c index abce1f730d00..c0af6fb1fbba 100644 --- a/drivers/net/dm9000.c +++ b/drivers/net/dm9000.c | |||
@@ -66,6 +66,7 @@ | |||
66 | #include <linux/mii.h> | 66 | #include <linux/mii.h> |
67 | #include <linux/dm9000.h> | 67 | #include <linux/dm9000.h> |
68 | #include <linux/delay.h> | 68 | #include <linux/delay.h> |
69 | #include <linux/platform_device.h> | ||
69 | 70 | ||
70 | #include <asm/delay.h> | 71 | #include <asm/delay.h> |
71 | #include <asm/irq.h> | 72 | #include <asm/irq.h> |
diff --git a/drivers/net/eepro.c b/drivers/net/eepro.c index 1ce2c675b8a7..a806dfe54d23 100644 --- a/drivers/net/eepro.c +++ b/drivers/net/eepro.c | |||
@@ -552,8 +552,7 @@ static int __init do_eepro_probe(struct net_device *dev) | |||
552 | { | 552 | { |
553 | unsigned short int WS[32]=WakeupSeq; | 553 | unsigned short int WS[32]=WakeupSeq; |
554 | 554 | ||
555 | if (check_region(WakeupPort, 2)==0) { | 555 | if (request_region(WakeupPort, 2, "eepro wakeup")) { |
556 | |||
557 | if (net_debug>5) | 556 | if (net_debug>5) |
558 | printk(KERN_DEBUG "Waking UP\n"); | 557 | printk(KERN_DEBUG "Waking UP\n"); |
559 | 558 | ||
@@ -563,7 +562,10 @@ static int __init do_eepro_probe(struct net_device *dev) | |||
563 | outb_p(WS[i],WakeupPort); | 562 | outb_p(WS[i],WakeupPort); |
564 | if (net_debug>5) printk(KERN_DEBUG ": %#x ",WS[i]); | 563 | if (net_debug>5) printk(KERN_DEBUG ": %#x ",WS[i]); |
565 | } | 564 | } |
566 | } else printk(KERN_WARNING "Checkregion Failed!\n"); | 565 | |
566 | release_region(WakeupPort, 2); | ||
567 | } else | ||
568 | printk(KERN_WARNING "PnP wakeup region busy!\n"); | ||
567 | } | 569 | } |
568 | #endif | 570 | #endif |
569 | 571 | ||
@@ -705,7 +707,7 @@ static void __init eepro_print_info (struct net_device *dev) | |||
705 | dev->name, (unsigned)dev->base_addr); | 707 | dev->name, (unsigned)dev->base_addr); |
706 | break; | 708 | break; |
707 | case LAN595FX: | 709 | case LAN595FX: |
708 | printk("%s: Intel EtherExpress Pro/10+ ISA\n at %#x,", | 710 | printk("%s: Intel EtherExpress Pro/10+ ISA\n at %#x,", |
709 | dev->name, (unsigned)dev->base_addr); | 711 | dev->name, (unsigned)dev->base_addr); |
710 | break; | 712 | break; |
711 | case LAN595TX: | 713 | case LAN595TX: |
@@ -713,7 +715,7 @@ static void __init eepro_print_info (struct net_device *dev) | |||
713 | dev->name, (unsigned)dev->base_addr); | 715 | dev->name, (unsigned)dev->base_addr); |
714 | break; | 716 | break; |
715 | case LAN595: | 717 | case LAN595: |
716 | printk("%s: Intel 82595-based lan card at %#x,", | 718 | printk("%s: Intel 82595-based lan card at %#x,", |
717 | dev->name, (unsigned)dev->base_addr); | 719 | dev->name, (unsigned)dev->base_addr); |
718 | } | 720 | } |
719 | 721 | ||
@@ -726,7 +728,7 @@ static void __init eepro_print_info (struct net_device *dev) | |||
726 | 728 | ||
727 | if (dev->irq > 2) | 729 | if (dev->irq > 2) |
728 | printk(", IRQ %d, %s.\n", dev->irq, ifmap[dev->if_port]); | 730 | printk(", IRQ %d, %s.\n", dev->irq, ifmap[dev->if_port]); |
729 | else | 731 | else |
730 | printk(", %s.\n", ifmap[dev->if_port]); | 732 | printk(", %s.\n", ifmap[dev->if_port]); |
731 | 733 | ||
732 | if (net_debug > 3) { | 734 | if (net_debug > 3) { |
@@ -756,7 +758,7 @@ static int __init eepro_probe1(struct net_device *dev, int autoprobe) | |||
756 | int err; | 758 | int err; |
757 | 759 | ||
758 | /* Grab the region so we can find another board if autoIRQ fails. */ | 760 | /* Grab the region so we can find another board if autoIRQ fails. */ |
759 | if (!request_region(ioaddr, EEPRO_IO_EXTENT, DRV_NAME)) { | 761 | if (!request_region(ioaddr, EEPRO_IO_EXTENT, DRV_NAME)) { |
760 | if (!autoprobe) | 762 | if (!autoprobe) |
761 | printk(KERN_WARNING "EEPRO: io-port 0x%04x in use \n", | 763 | printk(KERN_WARNING "EEPRO: io-port 0x%04x in use \n", |
762 | ioaddr); | 764 | ioaddr); |
@@ -838,15 +840,15 @@ static int __init eepro_probe1(struct net_device *dev, int autoprobe) | |||
838 | /* Mask off INT number */ | 840 | /* Mask off INT number */ |
839 | int count = lp->word[1] & 7; | 841 | int count = lp->word[1] & 7; |
840 | unsigned irqMask = lp->word[7]; | 842 | unsigned irqMask = lp->word[7]; |
841 | 843 | ||
842 | while (count--) | 844 | while (count--) |
843 | irqMask &= irqMask - 1; | 845 | irqMask &= irqMask - 1; |
844 | 846 | ||
845 | count = ffs(irqMask); | 847 | count = ffs(irqMask); |
846 | 848 | ||
847 | if (count) | 849 | if (count) |
848 | dev->irq = count - 1; | 850 | dev->irq = count - 1; |
849 | 851 | ||
850 | if (dev->irq < 2) { | 852 | if (dev->irq < 2) { |
851 | printk(KERN_ERR " Duh! illegal interrupt vector stored in EEPROM.\n"); | 853 | printk(KERN_ERR " Duh! illegal interrupt vector stored in EEPROM.\n"); |
852 | goto exit; | 854 | goto exit; |
@@ -854,7 +856,7 @@ static int __init eepro_probe1(struct net_device *dev, int autoprobe) | |||
854 | dev->irq = 9; | 856 | dev->irq = 9; |
855 | } | 857 | } |
856 | } | 858 | } |
857 | 859 | ||
858 | dev->open = eepro_open; | 860 | dev->open = eepro_open; |
859 | dev->stop = eepro_close; | 861 | dev->stop = eepro_close; |
860 | dev->hard_start_xmit = eepro_send_packet; | 862 | dev->hard_start_xmit = eepro_send_packet; |
@@ -863,7 +865,7 @@ static int __init eepro_probe1(struct net_device *dev, int autoprobe) | |||
863 | dev->tx_timeout = eepro_tx_timeout; | 865 | dev->tx_timeout = eepro_tx_timeout; |
864 | dev->watchdog_timeo = TX_TIMEOUT; | 866 | dev->watchdog_timeo = TX_TIMEOUT; |
865 | dev->ethtool_ops = &eepro_ethtool_ops; | 867 | dev->ethtool_ops = &eepro_ethtool_ops; |
866 | 868 | ||
867 | /* print boot time info */ | 869 | /* print boot time info */ |
868 | eepro_print_info(dev); | 870 | eepro_print_info(dev); |
869 | 871 | ||
@@ -1047,8 +1049,8 @@ static int eepro_open(struct net_device *dev) | |||
1047 | 1049 | ||
1048 | 1050 | ||
1049 | /* Initialize the RCV and XMT upper and lower limits */ | 1051 | /* Initialize the RCV and XMT upper and lower limits */ |
1050 | outb(lp->rcv_lower_limit >> 8, ioaddr + RCV_LOWER_LIMIT_REG); | 1052 | outb(lp->rcv_lower_limit >> 8, ioaddr + RCV_LOWER_LIMIT_REG); |
1051 | outb(lp->rcv_upper_limit >> 8, ioaddr + RCV_UPPER_LIMIT_REG); | 1053 | outb(lp->rcv_upper_limit >> 8, ioaddr + RCV_UPPER_LIMIT_REG); |
1052 | outb(lp->xmt_lower_limit >> 8, ioaddr + lp->xmt_lower_limit_reg); | 1054 | outb(lp->xmt_lower_limit >> 8, ioaddr + lp->xmt_lower_limit_reg); |
1053 | outb(lp->xmt_upper_limit >> 8, ioaddr + lp->xmt_upper_limit_reg); | 1055 | outb(lp->xmt_upper_limit >> 8, ioaddr + lp->xmt_upper_limit_reg); |
1054 | 1056 | ||
@@ -1065,12 +1067,12 @@ static int eepro_open(struct net_device *dev) | |||
1065 | eepro_clear_int(ioaddr); | 1067 | eepro_clear_int(ioaddr); |
1066 | 1068 | ||
1067 | /* Initialize RCV */ | 1069 | /* Initialize RCV */ |
1068 | outw(lp->rcv_lower_limit, ioaddr + RCV_BAR); | 1070 | outw(lp->rcv_lower_limit, ioaddr + RCV_BAR); |
1069 | lp->rx_start = lp->rcv_lower_limit; | 1071 | lp->rx_start = lp->rcv_lower_limit; |
1070 | outw(lp->rcv_upper_limit | 0xfe, ioaddr + RCV_STOP); | 1072 | outw(lp->rcv_upper_limit | 0xfe, ioaddr + RCV_STOP); |
1071 | 1073 | ||
1072 | /* Initialize XMT */ | 1074 | /* Initialize XMT */ |
1073 | outw(lp->xmt_lower_limit, ioaddr + lp->xmt_bar); | 1075 | outw(lp->xmt_lower_limit, ioaddr + lp->xmt_bar); |
1074 | lp->tx_start = lp->tx_end = lp->xmt_lower_limit; | 1076 | lp->tx_start = lp->tx_end = lp->xmt_lower_limit; |
1075 | lp->tx_last = 0; | 1077 | lp->tx_last = 0; |
1076 | 1078 | ||
@@ -1411,7 +1413,7 @@ set_multicast_list(struct net_device *dev) | |||
1411 | outb(0x08, ioaddr + STATUS_REG); | 1413 | outb(0x08, ioaddr + STATUS_REG); |
1412 | 1414 | ||
1413 | if (i & 0x20) { /* command ABORTed */ | 1415 | if (i & 0x20) { /* command ABORTed */ |
1414 | printk(KERN_NOTICE "%s: multicast setup failed.\n", | 1416 | printk(KERN_NOTICE "%s: multicast setup failed.\n", |
1415 | dev->name); | 1417 | dev->name); |
1416 | break; | 1418 | break; |
1417 | } else if ((i & 0x0f) == 0x03) { /* MC-Done */ | 1419 | } else if ((i & 0x0f) == 0x03) { /* MC-Done */ |
@@ -1512,7 +1514,7 @@ hardware_send_packet(struct net_device *dev, void *buf, short length) | |||
1512 | end = last + (((length + 3) >> 1) << 1) + XMT_HEADER; | 1514 | end = last + (((length + 3) >> 1) << 1) + XMT_HEADER; |
1513 | 1515 | ||
1514 | if (end >= lp->xmt_upper_limit + 2) { /* the transmit buffer is wrapped around */ | 1516 | if (end >= lp->xmt_upper_limit + 2) { /* the transmit buffer is wrapped around */ |
1515 | if ((lp->xmt_upper_limit + 2 - last) <= XMT_HEADER) { | 1517 | if ((lp->xmt_upper_limit + 2 - last) <= XMT_HEADER) { |
1516 | /* Arrrr!!!, must keep the xmt header together, | 1518 | /* Arrrr!!!, must keep the xmt header together, |
1517 | several days were lost to chase this one down. */ | 1519 | several days were lost to chase this one down. */ |
1518 | last = lp->xmt_lower_limit; | 1520 | last = lp->xmt_lower_limit; |
@@ -1643,7 +1645,7 @@ eepro_rx(struct net_device *dev) | |||
1643 | else if (rcv_status & 0x0800) | 1645 | else if (rcv_status & 0x0800) |
1644 | lp->stats.rx_crc_errors++; | 1646 | lp->stats.rx_crc_errors++; |
1645 | 1647 | ||
1646 | printk(KERN_DEBUG "%s: event = %#x, status = %#x, next = %#x, size = %#x\n", | 1648 | printk(KERN_DEBUG "%s: event = %#x, status = %#x, next = %#x, size = %#x\n", |
1647 | dev->name, rcv_event, rcv_status, rcv_next_frame, rcv_size); | 1649 | dev->name, rcv_event, rcv_status, rcv_next_frame, rcv_size); |
1648 | } | 1650 | } |
1649 | 1651 | ||
@@ -1674,10 +1676,10 @@ eepro_transmit_interrupt(struct net_device *dev) | |||
1674 | { | 1676 | { |
1675 | struct eepro_local *lp = netdev_priv(dev); | 1677 | struct eepro_local *lp = netdev_priv(dev); |
1676 | short ioaddr = dev->base_addr; | 1678 | short ioaddr = dev->base_addr; |
1677 | short boguscount = 25; | 1679 | short boguscount = 25; |
1678 | short xmt_status; | 1680 | short xmt_status; |
1679 | 1681 | ||
1680 | while ((lp->tx_start != lp->tx_end) && boguscount--) { | 1682 | while ((lp->tx_start != lp->tx_end) && boguscount--) { |
1681 | 1683 | ||
1682 | outw(lp->tx_start, ioaddr + HOST_ADDRESS_REG); | 1684 | outw(lp->tx_start, ioaddr + HOST_ADDRESS_REG); |
1683 | xmt_status = inw(ioaddr+IO_PORT); | 1685 | xmt_status = inw(ioaddr+IO_PORT); |
@@ -1723,7 +1725,7 @@ static int eepro_ethtool_get_settings(struct net_device *dev, | |||
1723 | { | 1725 | { |
1724 | struct eepro_local *lp = (struct eepro_local *)dev->priv; | 1726 | struct eepro_local *lp = (struct eepro_local *)dev->priv; |
1725 | 1727 | ||
1726 | cmd->supported = SUPPORTED_10baseT_Half | | 1728 | cmd->supported = SUPPORTED_10baseT_Half | |
1727 | SUPPORTED_10baseT_Full | | 1729 | SUPPORTED_10baseT_Full | |
1728 | SUPPORTED_Autoneg; | 1730 | SUPPORTED_Autoneg; |
1729 | cmd->advertising = ADVERTISED_10baseT_Half | | 1731 | cmd->advertising = ADVERTISED_10baseT_Half | |
diff --git a/drivers/net/fec_8xx/Kconfig b/drivers/net/fec_8xx/Kconfig index db36ac3ea453..4560026ed419 100644 --- a/drivers/net/fec_8xx/Kconfig +++ b/drivers/net/fec_8xx/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config FEC_8XX | 1 | config FEC_8XX |
2 | tristate "Motorola 8xx FEC driver" | 2 | tristate "Motorola 8xx FEC driver" |
3 | depends on NET_ETHERNET && 8xx && (NETTA || NETPHONE) | 3 | depends on NET_ETHERNET |
4 | select MII | 4 | select MII |
5 | 5 | ||
6 | config FEC_8XX_GENERIC_PHY | 6 | config FEC_8XX_GENERIC_PHY |
@@ -12,3 +12,9 @@ config FEC_8XX_DM9161_PHY | |||
12 | bool "Support DM9161 PHY" | 12 | bool "Support DM9161 PHY" |
13 | depends on FEC_8XX | 13 | depends on FEC_8XX |
14 | default n | 14 | default n |
15 | |||
16 | config FEC_8XX_LXT971_PHY | ||
17 | bool "Support LXT971/LXT972 PHY" | ||
18 | depends on FEC_8XX | ||
19 | default n | ||
20 | |||
diff --git a/drivers/net/fec_8xx/fec_mii.c b/drivers/net/fec_8xx/fec_mii.c index 803eb095cf8e..3b44ac1a7bfe 100644 --- a/drivers/net/fec_8xx/fec_mii.c +++ b/drivers/net/fec_8xx/fec_mii.c | |||
@@ -203,6 +203,39 @@ static void dm9161_shutdown(struct net_device *dev) | |||
203 | 203 | ||
204 | #endif | 204 | #endif |
205 | 205 | ||
206 | #ifdef CONFIG_FEC_8XX_LXT971_PHY | ||
207 | |||
208 | /* Support for LXT971/972 PHY */ | ||
209 | |||
210 | #define MII_LXT971_PCR 16 /* Port Control Register */ | ||
211 | #define MII_LXT971_SR2 17 /* Status Register 2 */ | ||
212 | #define MII_LXT971_IER 18 /* Interrupt Enable Register */ | ||
213 | #define MII_LXT971_ISR 19 /* Interrupt Status Register */ | ||
214 | #define MII_LXT971_LCR 20 /* LED Control Register */ | ||
215 | #define MII_LXT971_TCR 30 /* Transmit Control Register */ | ||
216 | |||
217 | static void lxt971_startup(struct net_device *dev) | ||
218 | { | ||
219 | struct fec_enet_private *fep = netdev_priv(dev); | ||
220 | |||
221 | fec_mii_write(dev, fep->mii_if.phy_id, MII_LXT971_IER, 0x00F2); | ||
222 | } | ||
223 | |||
224 | static void lxt971_ack_int(struct net_device *dev) | ||
225 | { | ||
226 | struct fec_enet_private *fep = netdev_priv(dev); | ||
227 | |||
228 | fec_mii_read(dev, fep->mii_if.phy_id, MII_LXT971_ISR); | ||
229 | } | ||
230 | |||
231 | static void lxt971_shutdown(struct net_device *dev) | ||
232 | { | ||
233 | struct fec_enet_private *fep = netdev_priv(dev); | ||
234 | |||
235 | fec_mii_write(dev, fep->mii_if.phy_id, MII_LXT971_IER, 0x0000); | ||
236 | } | ||
237 | #endif | ||
238 | |||
206 | /**********************************************************************************/ | 239 | /**********************************************************************************/ |
207 | 240 | ||
208 | static const struct phy_info phy_info[] = { | 241 | static const struct phy_info phy_info[] = { |
@@ -215,6 +248,15 @@ static const struct phy_info phy_info[] = { | |||
215 | .shutdown = dm9161_shutdown, | 248 | .shutdown = dm9161_shutdown, |
216 | }, | 249 | }, |
217 | #endif | 250 | #endif |
251 | #ifdef CONFIG_FEC_8XX_LXT971_PHY | ||
252 | { | ||
253 | .id = 0x0001378e, | ||
254 | .name = "LXT971/972", | ||
255 | .startup = lxt971_startup, | ||
256 | .ack_int = lxt971_ack_int, | ||
257 | .shutdown = lxt971_shutdown, | ||
258 | }, | ||
259 | #endif | ||
218 | #ifdef CONFIG_FEC_8XX_GENERIC_PHY | 260 | #ifdef CONFIG_FEC_8XX_GENERIC_PHY |
219 | { | 261 | { |
220 | .id = 0, | 262 | .id = 0, |
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c index 44fac7373289..9342d5bc7bb4 100644 --- a/drivers/net/fs_enet/fs_enet-main.c +++ b/drivers/net/fs_enet/fs_enet-main.c | |||
@@ -130,7 +130,7 @@ static int fs_enet_rx_napi(struct net_device *dev, int *budget) | |||
130 | 130 | ||
131 | skb = fep->rx_skbuff[curidx]; | 131 | skb = fep->rx_skbuff[curidx]; |
132 | 132 | ||
133 | dma_unmap_single(fep->dev, skb->data, | 133 | dma_unmap_single(fep->dev, CBDR_BUFADDR(bdp), |
134 | L1_CACHE_ALIGN(PKT_MAXBUF_SIZE), | 134 | L1_CACHE_ALIGN(PKT_MAXBUF_SIZE), |
135 | DMA_FROM_DEVICE); | 135 | DMA_FROM_DEVICE); |
136 | 136 | ||
@@ -144,7 +144,7 @@ static int fs_enet_rx_napi(struct net_device *dev, int *budget) | |||
144 | 144 | ||
145 | skb = fep->rx_skbuff[curidx]; | 145 | skb = fep->rx_skbuff[curidx]; |
146 | 146 | ||
147 | dma_unmap_single(fep->dev, skb->data, | 147 | dma_unmap_single(fep->dev, CBDR_BUFADDR(bdp), |
148 | L1_CACHE_ALIGN(PKT_MAXBUF_SIZE), | 148 | L1_CACHE_ALIGN(PKT_MAXBUF_SIZE), |
149 | DMA_FROM_DEVICE); | 149 | DMA_FROM_DEVICE); |
150 | 150 | ||
@@ -268,7 +268,7 @@ static int fs_enet_rx_non_napi(struct net_device *dev) | |||
268 | 268 | ||
269 | skb = fep->rx_skbuff[curidx]; | 269 | skb = fep->rx_skbuff[curidx]; |
270 | 270 | ||
271 | dma_unmap_single(fep->dev, skb->data, | 271 | dma_unmap_single(fep->dev, CBDR_BUFADDR(bdp), |
272 | L1_CACHE_ALIGN(PKT_MAXBUF_SIZE), | 272 | L1_CACHE_ALIGN(PKT_MAXBUF_SIZE), |
273 | DMA_FROM_DEVICE); | 273 | DMA_FROM_DEVICE); |
274 | 274 | ||
@@ -278,7 +278,7 @@ static int fs_enet_rx_non_napi(struct net_device *dev) | |||
278 | 278 | ||
279 | skb = fep->rx_skbuff[curidx]; | 279 | skb = fep->rx_skbuff[curidx]; |
280 | 280 | ||
281 | dma_unmap_single(fep->dev, skb->data, | 281 | dma_unmap_single(fep->dev, CBDR_BUFADDR(bdp), |
282 | L1_CACHE_ALIGN(PKT_MAXBUF_SIZE), | 282 | L1_CACHE_ALIGN(PKT_MAXBUF_SIZE), |
283 | DMA_FROM_DEVICE); | 283 | DMA_FROM_DEVICE); |
284 | 284 | ||
@@ -399,7 +399,8 @@ static void fs_enet_tx(struct net_device *dev) | |||
399 | fep->stats.collisions++; | 399 | fep->stats.collisions++; |
400 | 400 | ||
401 | /* unmap */ | 401 | /* unmap */ |
402 | dma_unmap_single(fep->dev, skb->data, skb->len, DMA_TO_DEVICE); | 402 | dma_unmap_single(fep->dev, CBDR_BUFADDR(bdp), |
403 | skb->len, DMA_TO_DEVICE); | ||
403 | 404 | ||
404 | /* | 405 | /* |
405 | * Free the sk buffer associated with this last transmit. | 406 | * Free the sk buffer associated with this last transmit. |
@@ -547,17 +548,19 @@ void fs_cleanup_bds(struct net_device *dev) | |||
547 | { | 548 | { |
548 | struct fs_enet_private *fep = netdev_priv(dev); | 549 | struct fs_enet_private *fep = netdev_priv(dev); |
549 | struct sk_buff *skb; | 550 | struct sk_buff *skb; |
551 | cbd_t *bdp; | ||
550 | int i; | 552 | int i; |
551 | 553 | ||
552 | /* | 554 | /* |
553 | * Reset SKB transmit buffers. | 555 | * Reset SKB transmit buffers. |
554 | */ | 556 | */ |
555 | for (i = 0; i < fep->tx_ring; i++) { | 557 | for (i = 0, bdp = fep->tx_bd_base; i < fep->tx_ring; i++, bdp++) { |
556 | if ((skb = fep->tx_skbuff[i]) == NULL) | 558 | if ((skb = fep->tx_skbuff[i]) == NULL) |
557 | continue; | 559 | continue; |
558 | 560 | ||
559 | /* unmap */ | 561 | /* unmap */ |
560 | dma_unmap_single(fep->dev, skb->data, skb->len, DMA_TO_DEVICE); | 562 | dma_unmap_single(fep->dev, CBDR_BUFADDR(bdp), |
563 | skb->len, DMA_TO_DEVICE); | ||
561 | 564 | ||
562 | fep->tx_skbuff[i] = NULL; | 565 | fep->tx_skbuff[i] = NULL; |
563 | dev_kfree_skb(skb); | 566 | dev_kfree_skb(skb); |
@@ -566,12 +569,12 @@ void fs_cleanup_bds(struct net_device *dev) | |||
566 | /* | 569 | /* |
567 | * Reset SKB receive buffers | 570 | * Reset SKB receive buffers |
568 | */ | 571 | */ |
569 | for (i = 0; i < fep->rx_ring; i++) { | 572 | for (i = 0, bdp = fep->rx_bd_base; i < fep->rx_ring; i++, bdp++) { |
570 | if ((skb = fep->rx_skbuff[i]) == NULL) | 573 | if ((skb = fep->rx_skbuff[i]) == NULL) |
571 | continue; | 574 | continue; |
572 | 575 | ||
573 | /* unmap */ | 576 | /* unmap */ |
574 | dma_unmap_single(fep->dev, skb->data, | 577 | dma_unmap_single(fep->dev, CBDR_BUFADDR(bdp), |
575 | L1_CACHE_ALIGN(PKT_MAXBUF_SIZE), | 578 | L1_CACHE_ALIGN(PKT_MAXBUF_SIZE), |
576 | DMA_FROM_DEVICE); | 579 | DMA_FROM_DEVICE); |
577 | 580 | ||
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index ae5a2ed3b264..962580f2c4ab 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c | |||
@@ -81,7 +81,7 @@ | |||
81 | #include <linux/if_vlan.h> | 81 | #include <linux/if_vlan.h> |
82 | #include <linux/spinlock.h> | 82 | #include <linux/spinlock.h> |
83 | #include <linux/mm.h> | 83 | #include <linux/mm.h> |
84 | #include <linux/device.h> | 84 | #include <linux/platform_device.h> |
85 | #include <linux/ip.h> | 85 | #include <linux/ip.h> |
86 | #include <linux/tcp.h> | 86 | #include <linux/tcp.h> |
87 | #include <linux/udp.h> | 87 | #include <linux/udp.h> |
diff --git a/drivers/net/gianfar_mii.c b/drivers/net/gianfar_mii.c index 1eca1dbca7f1..5a74d3d3dbe1 100644 --- a/drivers/net/gianfar_mii.c +++ b/drivers/net/gianfar_mii.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/mm.h> | 33 | #include <linux/mm.h> |
34 | #include <linux/module.h> | 34 | #include <linux/module.h> |
35 | #include <linux/version.h> | 35 | #include <linux/version.h> |
36 | #include <linux/platform_device.h> | ||
36 | #include <asm/ocp.h> | 37 | #include <asm/ocp.h> |
37 | #include <linux/crc32.h> | 38 | #include <linux/crc32.h> |
38 | #include <linux/mii.h> | 39 | #include <linux/mii.h> |
diff --git a/drivers/net/ibm_emac/ibm_emac.h b/drivers/net/ibm_emac/ibm_emac.h index 28c476f28c20..644edbff4f94 100644 --- a/drivers/net/ibm_emac/ibm_emac.h +++ b/drivers/net/ibm_emac/ibm_emac.h | |||
@@ -26,7 +26,8 @@ | |||
26 | /* This is a simple check to prevent use of this driver on non-tested SoCs */ | 26 | /* This is a simple check to prevent use of this driver on non-tested SoCs */ |
27 | #if !defined(CONFIG_405GP) && !defined(CONFIG_405GPR) && !defined(CONFIG_405EP) && \ | 27 | #if !defined(CONFIG_405GP) && !defined(CONFIG_405GPR) && !defined(CONFIG_405EP) && \ |
28 | !defined(CONFIG_440GP) && !defined(CONFIG_440GX) && !defined(CONFIG_440SP) && \ | 28 | !defined(CONFIG_440GP) && !defined(CONFIG_440GX) && !defined(CONFIG_440SP) && \ |
29 | !defined(CONFIG_440EP) && !defined(CONFIG_NP405H) | 29 | !defined(CONFIG_440EP) && !defined(CONFIG_NP405H) && !defined(CONFIG_440SPE) && \ |
30 | !defined(CONFIG_440GR) | ||
30 | #error "Unknown SoC. Please, check chip user manual and make sure EMAC defines are OK" | 31 | #error "Unknown SoC. Please, check chip user manual and make sure EMAC defines are OK" |
31 | #endif | 32 | #endif |
32 | 33 | ||
@@ -246,6 +247,25 @@ struct emac_regs { | |||
246 | #define EMAC_STACR_PCDA_SHIFT 5 | 247 | #define EMAC_STACR_PCDA_SHIFT 5 |
247 | #define EMAC_STACR_PRA_MASK 0x1f | 248 | #define EMAC_STACR_PRA_MASK 0x1f |
248 | 249 | ||
250 | /* | ||
251 | * For the 440SPe, AMCC inexplicably changed the polarity of | ||
252 | * the "operation complete" bit in the MII control register. | ||
253 | */ | ||
254 | #if defined(CONFIG_440SPE) | ||
255 | static inline int emac_phy_done(u32 stacr) | ||
256 | { | ||
257 | return !(stacr & EMAC_STACR_OC); | ||
258 | }; | ||
259 | #define EMAC_STACR_START EMAC_STACR_OC | ||
260 | |||
261 | #else /* CONFIG_440SPE */ | ||
262 | static inline int emac_phy_done(u32 stacr) | ||
263 | { | ||
264 | return stacr & EMAC_STACR_OC; | ||
265 | }; | ||
266 | #define EMAC_STACR_START 0 | ||
267 | #endif /* !CONFIG_440SPE */ | ||
268 | |||
249 | /* EMACx_TRTR */ | 269 | /* EMACx_TRTR */ |
250 | #if !defined(CONFIG_IBM_EMAC4) | 270 | #if !defined(CONFIG_IBM_EMAC4) |
251 | #define EMAC_TRTR_SHIFT 27 | 271 | #define EMAC_TRTR_SHIFT 27 |
diff --git a/drivers/net/ibm_emac/ibm_emac_core.c b/drivers/net/ibm_emac/ibm_emac_core.c index 943fbd1546ff..eb7d69478715 100644 --- a/drivers/net/ibm_emac/ibm_emac_core.c +++ b/drivers/net/ibm_emac/ibm_emac_core.c | |||
@@ -87,10 +87,11 @@ MODULE_LICENSE("GPL"); | |||
87 | */ | 87 | */ |
88 | static u32 busy_phy_map; | 88 | static u32 busy_phy_map; |
89 | 89 | ||
90 | #if defined(CONFIG_IBM_EMAC_PHY_RX_CLK_FIX) && (defined(CONFIG_405EP) || defined(CONFIG_440EP)) | 90 | #if defined(CONFIG_IBM_EMAC_PHY_RX_CLK_FIX) && \ |
91 | (defined(CONFIG_405EP) || defined(CONFIG_440EP) || defined(CONFIG_440GR)) | ||
91 | /* 405EP has "EMAC to PHY Control Register" (CPC0_EPCTL) which can help us | 92 | /* 405EP has "EMAC to PHY Control Register" (CPC0_EPCTL) which can help us |
92 | * with PHY RX clock problem. | 93 | * with PHY RX clock problem. |
93 | * 440EP has more sane SDR0_MFR register implementation than 440GX, which | 94 | * 440EP/440GR has more sane SDR0_MFR register implementation than 440GX, which |
94 | * also allows controlling each EMAC clock | 95 | * also allows controlling each EMAC clock |
95 | */ | 96 | */ |
96 | static inline void EMAC_RX_CLK_TX(int idx) | 97 | static inline void EMAC_RX_CLK_TX(int idx) |
@@ -100,7 +101,7 @@ static inline void EMAC_RX_CLK_TX(int idx) | |||
100 | 101 | ||
101 | #if defined(CONFIG_405EP) | 102 | #if defined(CONFIG_405EP) |
102 | mtdcr(0xf3, mfdcr(0xf3) | (1 << idx)); | 103 | mtdcr(0xf3, mfdcr(0xf3) | (1 << idx)); |
103 | #else /* CONFIG_440EP */ | 104 | #else /* CONFIG_440EP || CONFIG_440GR */ |
104 | SDR_WRITE(DCRN_SDR_MFR, SDR_READ(DCRN_SDR_MFR) | (0x08000000 >> idx)); | 105 | SDR_WRITE(DCRN_SDR_MFR, SDR_READ(DCRN_SDR_MFR) | (0x08000000 >> idx)); |
105 | #endif | 106 | #endif |
106 | 107 | ||
@@ -546,7 +547,7 @@ static int __emac_mdio_read(struct ocp_enet_private *dev, u8 id, u8 reg) | |||
546 | 547 | ||
547 | /* Wait for management interface to become idle */ | 548 | /* Wait for management interface to become idle */ |
548 | n = 10; | 549 | n = 10; |
549 | while (!(in_be32(&p->stacr) & EMAC_STACR_OC)) { | 550 | while (!emac_phy_done(in_be32(&p->stacr))) { |
550 | udelay(1); | 551 | udelay(1); |
551 | if (!--n) | 552 | if (!--n) |
552 | goto to; | 553 | goto to; |
@@ -556,11 +557,12 @@ static int __emac_mdio_read(struct ocp_enet_private *dev, u8 id, u8 reg) | |||
556 | out_be32(&p->stacr, | 557 | out_be32(&p->stacr, |
557 | EMAC_STACR_BASE(emac_opb_mhz()) | EMAC_STACR_STAC_READ | | 558 | EMAC_STACR_BASE(emac_opb_mhz()) | EMAC_STACR_STAC_READ | |
558 | (reg & EMAC_STACR_PRA_MASK) | 559 | (reg & EMAC_STACR_PRA_MASK) |
559 | | ((id & EMAC_STACR_PCDA_MASK) << EMAC_STACR_PCDA_SHIFT)); | 560 | | ((id & EMAC_STACR_PCDA_MASK) << EMAC_STACR_PCDA_SHIFT) |
561 | | EMAC_STACR_START); | ||
560 | 562 | ||
561 | /* Wait for read to complete */ | 563 | /* Wait for read to complete */ |
562 | n = 100; | 564 | n = 100; |
563 | while (!((r = in_be32(&p->stacr)) & EMAC_STACR_OC)) { | 565 | while (!emac_phy_done(r = in_be32(&p->stacr))) { |
564 | udelay(1); | 566 | udelay(1); |
565 | if (!--n) | 567 | if (!--n) |
566 | goto to; | 568 | goto to; |
@@ -594,7 +596,7 @@ static void __emac_mdio_write(struct ocp_enet_private *dev, u8 id, u8 reg, | |||
594 | 596 | ||
595 | /* Wait for management interface to be idle */ | 597 | /* Wait for management interface to be idle */ |
596 | n = 10; | 598 | n = 10; |
597 | while (!(in_be32(&p->stacr) & EMAC_STACR_OC)) { | 599 | while (!emac_phy_done(in_be32(&p->stacr))) { |
598 | udelay(1); | 600 | udelay(1); |
599 | if (!--n) | 601 | if (!--n) |
600 | goto to; | 602 | goto to; |
@@ -605,11 +607,11 @@ static void __emac_mdio_write(struct ocp_enet_private *dev, u8 id, u8 reg, | |||
605 | EMAC_STACR_BASE(emac_opb_mhz()) | EMAC_STACR_STAC_WRITE | | 607 | EMAC_STACR_BASE(emac_opb_mhz()) | EMAC_STACR_STAC_WRITE | |
606 | (reg & EMAC_STACR_PRA_MASK) | | 608 | (reg & EMAC_STACR_PRA_MASK) | |
607 | ((id & EMAC_STACR_PCDA_MASK) << EMAC_STACR_PCDA_SHIFT) | | 609 | ((id & EMAC_STACR_PCDA_MASK) << EMAC_STACR_PCDA_SHIFT) | |
608 | (val << EMAC_STACR_PHYD_SHIFT)); | 610 | (val << EMAC_STACR_PHYD_SHIFT) | EMAC_STACR_START); |
609 | 611 | ||
610 | /* Wait for write to complete */ | 612 | /* Wait for write to complete */ |
611 | n = 100; | 613 | n = 100; |
612 | while (!(in_be32(&p->stacr) & EMAC_STACR_OC)) { | 614 | while (!emac_phy_done(in_be32(&p->stacr))) { |
613 | udelay(1); | 615 | udelay(1); |
614 | if (!--n) | 616 | if (!--n) |
615 | goto to; | 617 | goto to; |
diff --git a/drivers/net/ibm_emac/ibm_emac_mal.h b/drivers/net/ibm_emac/ibm_emac_mal.h index 15b0bdae26ac..2a2d3b24b037 100644 --- a/drivers/net/ibm_emac/ibm_emac_mal.h +++ b/drivers/net/ibm_emac/ibm_emac_mal.h | |||
@@ -32,9 +32,10 @@ | |||
32 | * reflect the fact that 40x and 44x have slightly different MALs. --ebs | 32 | * reflect the fact that 40x and 44x have slightly different MALs. --ebs |
33 | */ | 33 | */ |
34 | #if defined(CONFIG_405GP) || defined(CONFIG_405GPR) || defined(CONFIG_405EP) || \ | 34 | #if defined(CONFIG_405GP) || defined(CONFIG_405GPR) || defined(CONFIG_405EP) || \ |
35 | defined(CONFIG_440EP) || defined(CONFIG_NP405H) | 35 | defined(CONFIG_440EP) || defined(CONFIG_440GR) || defined(CONFIG_NP405H) |
36 | #define MAL_VERSION 1 | 36 | #define MAL_VERSION 1 |
37 | #elif defined(CONFIG_440GP) || defined(CONFIG_440GX) || defined(CONFIG_440SP) | 37 | #elif defined(CONFIG_440GP) || defined(CONFIG_440GX) || defined(CONFIG_440SP) || \ |
38 | defined(CONFIG_440SPE) | ||
38 | #define MAL_VERSION 2 | 39 | #define MAL_VERSION 2 |
39 | #else | 40 | #else |
40 | #error "Unknown SoC, please check chip manual and choose MAL 'version'" | 41 | #error "Unknown SoC, please check chip manual and choose MAL 'version'" |
diff --git a/drivers/net/ibm_emac/ibm_emac_phy.c b/drivers/net/ibm_emac/ibm_emac_phy.c index a27e49cfe43b..67935dd33a65 100644 --- a/drivers/net/ibm_emac/ibm_emac_phy.c +++ b/drivers/net/ibm_emac/ibm_emac_phy.c | |||
@@ -236,12 +236,16 @@ static struct mii_phy_def genmii_phy_def = { | |||
236 | }; | 236 | }; |
237 | 237 | ||
238 | /* CIS8201 */ | 238 | /* CIS8201 */ |
239 | #define MII_CIS8201_10BTCSR 0x16 | ||
240 | #define TENBTCSR_ECHO_DISABLE 0x2000 | ||
239 | #define MII_CIS8201_EPCR 0x17 | 241 | #define MII_CIS8201_EPCR 0x17 |
240 | #define EPCR_MODE_MASK 0x3000 | 242 | #define EPCR_MODE_MASK 0x3000 |
241 | #define EPCR_GMII_MODE 0x0000 | 243 | #define EPCR_GMII_MODE 0x0000 |
242 | #define EPCR_RGMII_MODE 0x1000 | 244 | #define EPCR_RGMII_MODE 0x1000 |
243 | #define EPCR_TBI_MODE 0x2000 | 245 | #define EPCR_TBI_MODE 0x2000 |
244 | #define EPCR_RTBI_MODE 0x3000 | 246 | #define EPCR_RTBI_MODE 0x3000 |
247 | #define MII_CIS8201_ACSR 0x1c | ||
248 | #define ACSR_PIN_PRIO_SELECT 0x0004 | ||
245 | 249 | ||
246 | static int cis8201_init(struct mii_phy *phy) | 250 | static int cis8201_init(struct mii_phy *phy) |
247 | { | 251 | { |
@@ -269,6 +273,14 @@ static int cis8201_init(struct mii_phy *phy) | |||
269 | } | 273 | } |
270 | 274 | ||
271 | phy_write(phy, MII_CIS8201_EPCR, epcr); | 275 | phy_write(phy, MII_CIS8201_EPCR, epcr); |
276 | |||
277 | /* MII regs override strap pins */ | ||
278 | phy_write(phy, MII_CIS8201_ACSR, | ||
279 | phy_read(phy, MII_CIS8201_ACSR) | ACSR_PIN_PRIO_SELECT); | ||
280 | |||
281 | /* Disable TX_EN -> CRS echo mode, otherwise 10/HDX doesn't work */ | ||
282 | phy_write(phy, MII_CIS8201_10BTCSR, | ||
283 | phy_read(phy, MII_CIS8201_10BTCSR) | TENBTCSR_ECHO_DISABLE); | ||
272 | 284 | ||
273 | return 0; | 285 | return 0; |
274 | } | 286 | } |
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c index 36da54ad2b7b..94239f67f3a3 100644 --- a/drivers/net/ibmveth.c +++ b/drivers/net/ibmveth.c | |||
@@ -514,7 +514,7 @@ static int ibmveth_open(struct net_device *netdev) | |||
514 | 514 | ||
515 | if(lpar_rc != H_Success) { | 515 | if(lpar_rc != H_Success) { |
516 | ibmveth_error_printk("h_register_logical_lan failed with %ld\n", lpar_rc); | 516 | ibmveth_error_printk("h_register_logical_lan failed with %ld\n", lpar_rc); |
517 | ibmveth_error_printk("buffer TCE:0x%x filter TCE:0x%x rxq desc:0x%lx MAC:0x%lx\n", | 517 | ibmveth_error_printk("buffer TCE:0x%lx filter TCE:0x%lx rxq desc:0x%lx MAC:0x%lx\n", |
518 | adapter->buffer_list_dma, | 518 | adapter->buffer_list_dma, |
519 | adapter->filter_list_dma, | 519 | adapter->filter_list_dma, |
520 | rxq_desc.desc, | 520 | rxq_desc.desc, |
@@ -535,7 +535,7 @@ static int ibmveth_open(struct net_device *netdev) | |||
535 | } | 535 | } |
536 | 536 | ||
537 | ibmveth_debug_printk("initial replenish cycle\n"); | 537 | ibmveth_debug_printk("initial replenish cycle\n"); |
538 | ibmveth_replenish_task(adapter); | 538 | ibmveth_interrupt(netdev->irq, netdev, NULL); |
539 | 539 | ||
540 | netif_start_queue(netdev); | 540 | netif_start_queue(netdev); |
541 | 541 | ||
@@ -1174,14 +1174,16 @@ static struct vio_device_id ibmveth_device_table[] __devinitdata= { | |||
1174 | { "network", "IBM,l-lan"}, | 1174 | { "network", "IBM,l-lan"}, |
1175 | { "", "" } | 1175 | { "", "" } |
1176 | }; | 1176 | }; |
1177 | |||
1178 | MODULE_DEVICE_TABLE(vio, ibmveth_device_table); | 1177 | MODULE_DEVICE_TABLE(vio, ibmveth_device_table); |
1179 | 1178 | ||
1180 | static struct vio_driver ibmveth_driver = { | 1179 | static struct vio_driver ibmveth_driver = { |
1181 | .name = (char *)ibmveth_driver_name, | 1180 | .id_table = ibmveth_device_table, |
1182 | .id_table = ibmveth_device_table, | 1181 | .probe = ibmveth_probe, |
1183 | .probe = ibmveth_probe, | 1182 | .remove = ibmveth_remove, |
1184 | .remove = ibmveth_remove | 1183 | .driver = { |
1184 | .name = ibmveth_driver_name, | ||
1185 | .owner = THIS_MODULE, | ||
1186 | } | ||
1185 | }; | 1187 | }; |
1186 | 1188 | ||
1187 | static int __init ibmveth_module_init(void) | 1189 | static int __init ibmveth_module_init(void) |
diff --git a/drivers/net/irda/pxaficp_ir.c b/drivers/net/irda/pxaficp_ir.c index aef80f5e7c9c..e1aa9910503b 100644 --- a/drivers/net/irda/pxaficp_ir.c +++ b/drivers/net/irda/pxaficp_ir.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/rtnetlink.h> | 22 | #include <linux/rtnetlink.h> |
23 | #include <linux/interrupt.h> | 23 | #include <linux/interrupt.h> |
24 | #include <linux/dma-mapping.h> | 24 | #include <linux/dma-mapping.h> |
25 | #include <linux/platform_device.h> | ||
25 | #include <linux/pm.h> | 26 | #include <linux/pm.h> |
26 | 27 | ||
27 | #include <net/irda/irda.h> | 28 | #include <net/irda/irda.h> |
@@ -704,15 +705,12 @@ static int pxa_irda_stop(struct net_device *dev) | |||
704 | return 0; | 705 | return 0; |
705 | } | 706 | } |
706 | 707 | ||
707 | static int pxa_irda_suspend(struct device *_dev, pm_message_t state, u32 level) | 708 | static int pxa_irda_suspend(struct device *_dev, pm_message_t state) |
708 | { | 709 | { |
709 | struct net_device *dev = dev_get_drvdata(_dev); | 710 | struct net_device *dev = dev_get_drvdata(_dev); |
710 | struct pxa_irda *si; | 711 | struct pxa_irda *si; |
711 | 712 | ||
712 | if (!dev || level != SUSPEND_DISABLE) | 713 | if (dev && netif_running(dev)) { |
713 | return 0; | ||
714 | |||
715 | if (netif_running(dev)) { | ||
716 | si = netdev_priv(dev); | 714 | si = netdev_priv(dev); |
717 | netif_device_detach(dev); | 715 | netif_device_detach(dev); |
718 | pxa_irda_shutdown(si); | 716 | pxa_irda_shutdown(si); |
@@ -721,15 +719,12 @@ static int pxa_irda_suspend(struct device *_dev, pm_message_t state, u32 level) | |||
721 | return 0; | 719 | return 0; |
722 | } | 720 | } |
723 | 721 | ||
724 | static int pxa_irda_resume(struct device *_dev, u32 level) | 722 | static int pxa_irda_resume(struct device *_dev) |
725 | { | 723 | { |
726 | struct net_device *dev = dev_get_drvdata(_dev); | 724 | struct net_device *dev = dev_get_drvdata(_dev); |
727 | struct pxa_irda *si; | 725 | struct pxa_irda *si; |
728 | 726 | ||
729 | if (!dev || level != RESUME_ENABLE) | 727 | if (dev && netif_running(dev)) { |
730 | return 0; | ||
731 | |||
732 | if (netif_running(dev)) { | ||
733 | si = netdev_priv(dev); | 728 | si = netdev_priv(dev); |
734 | pxa_irda_startup(si); | 729 | pxa_irda_startup(si); |
735 | netif_device_attach(dev); | 730 | netif_device_attach(dev); |
diff --git a/drivers/net/irda/sa1100_ir.c b/drivers/net/irda/sa1100_ir.c index 06883309916d..76e0b9fb5e96 100644 --- a/drivers/net/irda/sa1100_ir.c +++ b/drivers/net/irda/sa1100_ir.c | |||
@@ -29,7 +29,7 @@ | |||
29 | #include <linux/rtnetlink.h> | 29 | #include <linux/rtnetlink.h> |
30 | #include <linux/interrupt.h> | 30 | #include <linux/interrupt.h> |
31 | #include <linux/delay.h> | 31 | #include <linux/delay.h> |
32 | #include <linux/device.h> | 32 | #include <linux/platform_device.h> |
33 | #include <linux/dma-mapping.h> | 33 | #include <linux/dma-mapping.h> |
34 | 34 | ||
35 | #include <net/irda/irda.h> | 35 | #include <net/irda/irda.h> |
diff --git a/drivers/net/irda/smsc-ircc2.c b/drivers/net/irda/smsc-ircc2.c index bbac720cca63..a1d207f2fa68 100644 --- a/drivers/net/irda/smsc-ircc2.c +++ b/drivers/net/irda/smsc-ircc2.c | |||
@@ -53,6 +53,7 @@ | |||
53 | #include <linux/rtnetlink.h> | 53 | #include <linux/rtnetlink.h> |
54 | #include <linux/serial_reg.h> | 54 | #include <linux/serial_reg.h> |
55 | #include <linux/dma-mapping.h> | 55 | #include <linux/dma-mapping.h> |
56 | #include <linux/platform_device.h> | ||
56 | 57 | ||
57 | #include <asm/io.h> | 58 | #include <asm/io.h> |
58 | #include <asm/dma.h> | 59 | #include <asm/dma.h> |
@@ -638,21 +639,14 @@ static void smsc_ircc_setup_qos(struct smsc_ircc_cb *self) | |||
638 | */ | 639 | */ |
639 | static void smsc_ircc_init_chip(struct smsc_ircc_cb *self) | 640 | static void smsc_ircc_init_chip(struct smsc_ircc_cb *self) |
640 | { | 641 | { |
641 | int iobase, ir_mode, ctrl, fast; | 642 | int iobase = self->io.fir_base; |
642 | |||
643 | IRDA_ASSERT(self != NULL, return;); | ||
644 | |||
645 | iobase = self->io.fir_base; | ||
646 | ir_mode = IRCC_CFGA_IRDA_SIR_A; | ||
647 | ctrl = 0; | ||
648 | fast = 0; | ||
649 | 643 | ||
650 | register_bank(iobase, 0); | 644 | register_bank(iobase, 0); |
651 | outb(IRCC_MASTER_RESET, iobase + IRCC_MASTER); | 645 | outb(IRCC_MASTER_RESET, iobase + IRCC_MASTER); |
652 | outb(0x00, iobase + IRCC_MASTER); | 646 | outb(0x00, iobase + IRCC_MASTER); |
653 | 647 | ||
654 | register_bank(iobase, 1); | 648 | register_bank(iobase, 1); |
655 | outb(((inb(iobase + IRCC_SCE_CFGA) & 0x87) | ir_mode), | 649 | outb(((inb(iobase + IRCC_SCE_CFGA) & 0x87) | IRCC_CFGA_IRDA_SIR_A), |
656 | iobase + IRCC_SCE_CFGA); | 650 | iobase + IRCC_SCE_CFGA); |
657 | 651 | ||
658 | #ifdef smsc_669 /* Uses pin 88/89 for Rx/Tx */ | 652 | #ifdef smsc_669 /* Uses pin 88/89 for Rx/Tx */ |
@@ -666,10 +660,10 @@ static void smsc_ircc_init_chip(struct smsc_ircc_cb *self) | |||
666 | outb(SMSC_IRCC2_FIFO_THRESHOLD, iobase + IRCC_FIFO_THRESHOLD); | 660 | outb(SMSC_IRCC2_FIFO_THRESHOLD, iobase + IRCC_FIFO_THRESHOLD); |
667 | 661 | ||
668 | register_bank(iobase, 4); | 662 | register_bank(iobase, 4); |
669 | outb((inb(iobase + IRCC_CONTROL) & 0x30) | ctrl, iobase + IRCC_CONTROL); | 663 | outb((inb(iobase + IRCC_CONTROL) & 0x30), iobase + IRCC_CONTROL); |
670 | 664 | ||
671 | register_bank(iobase, 0); | 665 | register_bank(iobase, 0); |
672 | outb(fast, iobase + IRCC_LCR_A); | 666 | outb(0, iobase + IRCC_LCR_A); |
673 | 667 | ||
674 | smsc_ircc_set_sir_speed(self, SMSC_IRCC2_C_IRDA_FALLBACK_SPEED); | 668 | smsc_ircc_set_sir_speed(self, SMSC_IRCC2_C_IRDA_FALLBACK_SPEED); |
675 | 669 | ||
@@ -1556,6 +1550,46 @@ static int ircc_is_receiving(struct smsc_ircc_cb *self) | |||
1556 | } | 1550 | } |
1557 | #endif /* unused */ | 1551 | #endif /* unused */ |
1558 | 1552 | ||
1553 | static int smsc_ircc_request_irq(struct smsc_ircc_cb *self) | ||
1554 | { | ||
1555 | int error; | ||
1556 | |||
1557 | error = request_irq(self->io.irq, smsc_ircc_interrupt, 0, | ||
1558 | self->netdev->name, self->netdev); | ||
1559 | if (error) | ||
1560 | IRDA_DEBUG(0, "%s(), unable to allocate irq=%d, err=%d\n", | ||
1561 | __FUNCTION__, self->io.irq, error); | ||
1562 | |||
1563 | return error; | ||
1564 | } | ||
1565 | |||
1566 | static void smsc_ircc_start_interrupts(struct smsc_ircc_cb *self) | ||
1567 | { | ||
1568 | unsigned long flags; | ||
1569 | |||
1570 | spin_lock_irqsave(&self->lock, flags); | ||
1571 | |||
1572 | self->io.speed = 0; | ||
1573 | smsc_ircc_change_speed(self, SMSC_IRCC2_C_IRDA_FALLBACK_SPEED); | ||
1574 | |||
1575 | spin_unlock_irqrestore(&self->lock, flags); | ||
1576 | } | ||
1577 | |||
1578 | static void smsc_ircc_stop_interrupts(struct smsc_ircc_cb *self) | ||
1579 | { | ||
1580 | int iobase = self->io.fir_base; | ||
1581 | unsigned long flags; | ||
1582 | |||
1583 | spin_lock_irqsave(&self->lock, flags); | ||
1584 | |||
1585 | register_bank(iobase, 0); | ||
1586 | outb(0, iobase + IRCC_IER); | ||
1587 | outb(IRCC_MASTER_RESET, iobase + IRCC_MASTER); | ||
1588 | outb(0x00, iobase + IRCC_MASTER); | ||
1589 | |||
1590 | spin_unlock_irqrestore(&self->lock, flags); | ||
1591 | } | ||
1592 | |||
1559 | 1593 | ||
1560 | /* | 1594 | /* |
1561 | * Function smsc_ircc_net_open (dev) | 1595 | * Function smsc_ircc_net_open (dev) |
@@ -1567,7 +1601,6 @@ static int smsc_ircc_net_open(struct net_device *dev) | |||
1567 | { | 1601 | { |
1568 | struct smsc_ircc_cb *self; | 1602 | struct smsc_ircc_cb *self; |
1569 | char hwname[16]; | 1603 | char hwname[16]; |
1570 | unsigned long flags; | ||
1571 | 1604 | ||
1572 | IRDA_DEBUG(1, "%s\n", __FUNCTION__); | 1605 | IRDA_DEBUG(1, "%s\n", __FUNCTION__); |
1573 | 1606 | ||
@@ -1575,6 +1608,11 @@ static int smsc_ircc_net_open(struct net_device *dev) | |||
1575 | self = netdev_priv(dev); | 1608 | self = netdev_priv(dev); |
1576 | IRDA_ASSERT(self != NULL, return 0;); | 1609 | IRDA_ASSERT(self != NULL, return 0;); |
1577 | 1610 | ||
1611 | if (self->io.suspended) { | ||
1612 | IRDA_DEBUG(0, "%s(), device is suspended\n", __FUNCTION__); | ||
1613 | return -EAGAIN; | ||
1614 | } | ||
1615 | |||
1578 | if (request_irq(self->io.irq, smsc_ircc_interrupt, 0, dev->name, | 1616 | if (request_irq(self->io.irq, smsc_ircc_interrupt, 0, dev->name, |
1579 | (void *) dev)) { | 1617 | (void *) dev)) { |
1580 | IRDA_DEBUG(0, "%s(), unable to allocate irq=%d\n", | 1618 | IRDA_DEBUG(0, "%s(), unable to allocate irq=%d\n", |
@@ -1582,11 +1620,7 @@ static int smsc_ircc_net_open(struct net_device *dev) | |||
1582 | return -EAGAIN; | 1620 | return -EAGAIN; |
1583 | } | 1621 | } |
1584 | 1622 | ||
1585 | spin_lock_irqsave(&self->lock, flags); | 1623 | smsc_ircc_start_interrupts(self); |
1586 | /*smsc_ircc_sir_start(self);*/ | ||
1587 | self->io.speed = 0; | ||
1588 | smsc_ircc_change_speed(self, SMSC_IRCC2_C_IRDA_FALLBACK_SPEED); | ||
1589 | spin_unlock_irqrestore(&self->lock, flags); | ||
1590 | 1624 | ||
1591 | /* Give self a hardware name */ | 1625 | /* Give self a hardware name */ |
1592 | /* It would be cool to offer the chip revision here - Jean II */ | 1626 | /* It would be cool to offer the chip revision here - Jean II */ |
@@ -1639,7 +1673,12 @@ static int smsc_ircc_net_close(struct net_device *dev) | |||
1639 | irlap_close(self->irlap); | 1673 | irlap_close(self->irlap); |
1640 | self->irlap = NULL; | 1674 | self->irlap = NULL; |
1641 | 1675 | ||
1642 | free_irq(self->io.irq, dev); | 1676 | smsc_ircc_stop_interrupts(self); |
1677 | |||
1678 | /* if we are called from smsc_ircc_resume we don't have IRQ reserved */ | ||
1679 | if (!self->io.suspended) | ||
1680 | free_irq(self->io.irq, dev); | ||
1681 | |||
1643 | disable_dma(self->io.dma); | 1682 | disable_dma(self->io.dma); |
1644 | free_dma(self->io.dma); | 1683 | free_dma(self->io.dma); |
1645 | 1684 | ||
@@ -1650,11 +1689,18 @@ static int smsc_ircc_suspend(struct device *dev, pm_message_t state) | |||
1650 | { | 1689 | { |
1651 | struct smsc_ircc_cb *self = dev_get_drvdata(dev); | 1690 | struct smsc_ircc_cb *self = dev_get_drvdata(dev); |
1652 | 1691 | ||
1653 | IRDA_MESSAGE("%s, Suspending\n", driver_name); | ||
1654 | |||
1655 | if (!self->io.suspended) { | 1692 | if (!self->io.suspended) { |
1656 | smsc_ircc_net_close(self->netdev); | 1693 | IRDA_DEBUG(1, "%s, Suspending\n", driver_name); |
1694 | |||
1695 | rtnl_lock(); | ||
1696 | if (netif_running(self->netdev)) { | ||
1697 | netif_device_detach(self->netdev); | ||
1698 | smsc_ircc_stop_interrupts(self); | ||
1699 | free_irq(self->io.irq, self->netdev); | ||
1700 | disable_dma(self->io.dma); | ||
1701 | } | ||
1657 | self->io.suspended = 1; | 1702 | self->io.suspended = 1; |
1703 | rtnl_unlock(); | ||
1658 | } | 1704 | } |
1659 | 1705 | ||
1660 | return 0; | 1706 | return 0; |
@@ -1665,11 +1711,25 @@ static int smsc_ircc_resume(struct device *dev) | |||
1665 | struct smsc_ircc_cb *self = dev_get_drvdata(dev); | 1711 | struct smsc_ircc_cb *self = dev_get_drvdata(dev); |
1666 | 1712 | ||
1667 | if (self->io.suspended) { | 1713 | if (self->io.suspended) { |
1668 | 1714 | IRDA_DEBUG(1, "%s, Waking up\n", driver_name); | |
1669 | smsc_ircc_net_open(self->netdev); | 1715 | |
1716 | rtnl_lock(); | ||
1717 | smsc_ircc_init_chip(self); | ||
1718 | if (netif_running(self->netdev)) { | ||
1719 | if (smsc_ircc_request_irq(self)) { | ||
1720 | /* | ||
1721 | * Don't fail resume process, just kill this | ||
1722 | * network interface | ||
1723 | */ | ||
1724 | unregister_netdevice(self->netdev); | ||
1725 | } else { | ||
1726 | enable_dma(self->io.dma); | ||
1727 | smsc_ircc_start_interrupts(self); | ||
1728 | netif_device_attach(self->netdev); | ||
1729 | } | ||
1730 | } | ||
1670 | self->io.suspended = 0; | 1731 | self->io.suspended = 0; |
1671 | 1732 | rtnl_unlock(); | |
1672 | IRDA_MESSAGE("%s, Waking up\n", driver_name); | ||
1673 | } | 1733 | } |
1674 | return 0; | 1734 | return 0; |
1675 | } | 1735 | } |
@@ -1682,9 +1742,6 @@ static int smsc_ircc_resume(struct device *dev) | |||
1682 | */ | 1742 | */ |
1683 | static int __exit smsc_ircc_close(struct smsc_ircc_cb *self) | 1743 | static int __exit smsc_ircc_close(struct smsc_ircc_cb *self) |
1684 | { | 1744 | { |
1685 | int iobase; | ||
1686 | unsigned long flags; | ||
1687 | |||
1688 | IRDA_DEBUG(1, "%s\n", __FUNCTION__); | 1745 | IRDA_DEBUG(1, "%s\n", __FUNCTION__); |
1689 | 1746 | ||
1690 | IRDA_ASSERT(self != NULL, return -1;); | 1747 | IRDA_ASSERT(self != NULL, return -1;); |
@@ -1694,22 +1751,7 @@ static int __exit smsc_ircc_close(struct smsc_ircc_cb *self) | |||
1694 | /* Remove netdevice */ | 1751 | /* Remove netdevice */ |
1695 | unregister_netdev(self->netdev); | 1752 | unregister_netdev(self->netdev); |
1696 | 1753 | ||
1697 | /* Make sure the irq handler is not exectuting */ | 1754 | smsc_ircc_stop_interrupts(self); |
1698 | spin_lock_irqsave(&self->lock, flags); | ||
1699 | |||
1700 | /* Stop interrupts */ | ||
1701 | iobase = self->io.fir_base; | ||
1702 | register_bank(iobase, 0); | ||
1703 | outb(0, iobase + IRCC_IER); | ||
1704 | outb(IRCC_MASTER_RESET, iobase + IRCC_MASTER); | ||
1705 | outb(0x00, iobase + IRCC_MASTER); | ||
1706 | #if 0 | ||
1707 | /* Reset to SIR mode */ | ||
1708 | register_bank(iobase, 1); | ||
1709 | outb(IRCC_CFGA_IRDA_SIR_A|IRCC_CFGA_TX_POLARITY, iobase + IRCC_SCE_CFGA); | ||
1710 | outb(IRCC_CFGB_IR, iobase + IRCC_SCE_CFGB); | ||
1711 | #endif | ||
1712 | spin_unlock_irqrestore(&self->lock, flags); | ||
1713 | 1755 | ||
1714 | /* Release the PORTS that this driver is using */ | 1756 | /* Release the PORTS that this driver is using */ |
1715 | IRDA_DEBUG(0, "%s(), releasing 0x%03x\n", __FUNCTION__, | 1757 | IRDA_DEBUG(0, "%s(), releasing 0x%03x\n", __FUNCTION__, |
diff --git a/drivers/net/iseries_veth.c b/drivers/net/iseries_veth.c index 3d56cf5a4e23..d86d8f055a6c 100644 --- a/drivers/net/iseries_veth.c +++ b/drivers/net/iseries_veth.c | |||
@@ -70,13 +70,14 @@ | |||
70 | #include <linux/delay.h> | 70 | #include <linux/delay.h> |
71 | #include <linux/mm.h> | 71 | #include <linux/mm.h> |
72 | #include <linux/ethtool.h> | 72 | #include <linux/ethtool.h> |
73 | #include <asm/iSeries/mf.h> | 73 | |
74 | #include <asm/iSeries/iSeries_pci.h> | 74 | #include <asm/abs_addr.h> |
75 | #include <asm/iseries/mf.h> | ||
75 | #include <asm/uaccess.h> | 76 | #include <asm/uaccess.h> |
76 | 77 | ||
77 | #include <asm/iSeries/HvLpConfig.h> | 78 | #include <asm/iseries/hv_lp_config.h> |
78 | #include <asm/iSeries/HvTypes.h> | 79 | #include <asm/iseries/hv_types.h> |
79 | #include <asm/iSeries/HvLpEvent.h> | 80 | #include <asm/iseries/hv_lp_event.h> |
80 | #include <asm/iommu.h> | 81 | #include <asm/iommu.h> |
81 | #include <asm/vio.h> | 82 | #include <asm/vio.h> |
82 | 83 | ||
@@ -1397,13 +1398,13 @@ static inline void veth_build_dma_list(struct dma_chunk *list, | |||
1397 | * it just at the granularity of iSeries real->absolute | 1398 | * it just at the granularity of iSeries real->absolute |
1398 | * mapping? Indeed, given the way the allocator works, can we | 1399 | * mapping? Indeed, given the way the allocator works, can we |
1399 | * count on them being absolutely contiguous? */ | 1400 | * count on them being absolutely contiguous? */ |
1400 | list[0].addr = ISERIES_HV_ADDR(p); | 1401 | list[0].addr = iseries_hv_addr(p); |
1401 | list[0].size = min(length, | 1402 | list[0].size = min(length, |
1402 | PAGE_SIZE - ((unsigned long)p & ~PAGE_MASK)); | 1403 | PAGE_SIZE - ((unsigned long)p & ~PAGE_MASK)); |
1403 | 1404 | ||
1404 | done = list[0].size; | 1405 | done = list[0].size; |
1405 | while (done < length) { | 1406 | while (done < length) { |
1406 | list[i].addr = ISERIES_HV_ADDR(p + done); | 1407 | list[i].addr = iseries_hv_addr(p + done); |
1407 | list[i].size = min(length-done, PAGE_SIZE); | 1408 | list[i].size = min(length-done, PAGE_SIZE); |
1408 | done += list[i].size; | 1409 | done += list[i].size; |
1409 | i++; | 1410 | i++; |
@@ -1496,8 +1497,8 @@ static void veth_receive(struct veth_lpar_connection *cnx, | |||
1496 | cnx->dst_inst, | 1497 | cnx->dst_inst, |
1497 | HvLpDma_AddressType_RealAddress, | 1498 | HvLpDma_AddressType_RealAddress, |
1498 | HvLpDma_AddressType_TceIndex, | 1499 | HvLpDma_AddressType_TceIndex, |
1499 | ISERIES_HV_ADDR(&local_list), | 1500 | iseries_hv_addr(&local_list), |
1500 | ISERIES_HV_ADDR(&remote_list), | 1501 | iseries_hv_addr(&remote_list), |
1501 | length); | 1502 | length); |
1502 | if (rc != HvLpDma_Rc_Good) { | 1503 | if (rc != HvLpDma_Rc_Good) { |
1503 | dev_kfree_skb_irq(skb); | 1504 | dev_kfree_skb_irq(skb); |
@@ -1647,10 +1648,13 @@ static struct vio_device_id veth_device_table[] __devinitdata = { | |||
1647 | MODULE_DEVICE_TABLE(vio, veth_device_table); | 1648 | MODULE_DEVICE_TABLE(vio, veth_device_table); |
1648 | 1649 | ||
1649 | static struct vio_driver veth_driver = { | 1650 | static struct vio_driver veth_driver = { |
1650 | .name = DRV_NAME, | ||
1651 | .id_table = veth_device_table, | 1651 | .id_table = veth_device_table, |
1652 | .probe = veth_probe, | 1652 | .probe = veth_probe, |
1653 | .remove = veth_remove | 1653 | .remove = veth_remove, |
1654 | .driver = { | ||
1655 | .name = DRV_NAME, | ||
1656 | .owner = THIS_MODULE, | ||
1657 | } | ||
1654 | }; | 1658 | }; |
1655 | 1659 | ||
1656 | /* | 1660 | /* |
diff --git a/drivers/net/jazzsonic.c b/drivers/net/jazzsonic.c index 8423cb6875f0..a74a5cfaf5bc 100644 --- a/drivers/net/jazzsonic.c +++ b/drivers/net/jazzsonic.c | |||
@@ -33,7 +33,7 @@ | |||
33 | #include <linux/netdevice.h> | 33 | #include <linux/netdevice.h> |
34 | #include <linux/etherdevice.h> | 34 | #include <linux/etherdevice.h> |
35 | #include <linux/skbuff.h> | 35 | #include <linux/skbuff.h> |
36 | #include <linux/device.h> | 36 | #include <linux/platform_device.h> |
37 | #include <linux/dma-mapping.h> | 37 | #include <linux/dma-mapping.h> |
38 | 38 | ||
39 | #include <asm/bootinfo.h> | 39 | #include <asm/bootinfo.h> |
diff --git a/drivers/net/mace.c b/drivers/net/mace.c index 09b1e7b364e5..2a5add257b8f 100644 --- a/drivers/net/mace.c +++ b/drivers/net/mace.c | |||
@@ -1016,6 +1016,7 @@ static struct of_device_id mace_match[] = | |||
1016 | }, | 1016 | }, |
1017 | {}, | 1017 | {}, |
1018 | }; | 1018 | }; |
1019 | MODULE_DEVICE_TABLE (of, mace_match); | ||
1019 | 1020 | ||
1020 | static struct macio_driver mace_driver = | 1021 | static struct macio_driver mace_driver = |
1021 | { | 1022 | { |
diff --git a/drivers/net/macsonic.c b/drivers/net/macsonic.c index 405e18365ede..e9c999d7eb39 100644 --- a/drivers/net/macsonic.c +++ b/drivers/net/macsonic.c | |||
@@ -47,7 +47,7 @@ | |||
47 | #include <linux/netdevice.h> | 47 | #include <linux/netdevice.h> |
48 | #include <linux/etherdevice.h> | 48 | #include <linux/etherdevice.h> |
49 | #include <linux/skbuff.h> | 49 | #include <linux/skbuff.h> |
50 | #include <linux/device.h> | 50 | #include <linux/platform_device.h> |
51 | #include <linux/dma-mapping.h> | 51 | #include <linux/dma-mapping.h> |
52 | 52 | ||
53 | #include <asm/bootinfo.h> | 53 | #include <asm/bootinfo.h> |
diff --git a/drivers/net/mipsnet.c b/drivers/net/mipsnet.c index f79f7ee72ab8..bbffb585b3b3 100644 --- a/drivers/net/mipsnet.c +++ b/drivers/net/mipsnet.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/sched.h> | 13 | #include <linux/sched.h> |
14 | #include <linux/etherdevice.h> | 14 | #include <linux/etherdevice.h> |
15 | #include <linux/netdevice.h> | 15 | #include <linux/netdevice.h> |
16 | #include <linux/platform_device.h> | ||
16 | #include <asm/io.h> | 17 | #include <asm/io.h> |
17 | #include <asm/mips-boards/simint.h> | 18 | #include <asm/mips-boards/simint.h> |
18 | 19 | ||
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c index 25c9a99c377b..71f2c6705bc3 100644 --- a/drivers/net/mv643xx_eth.c +++ b/drivers/net/mv643xx_eth.c | |||
@@ -39,6 +39,8 @@ | |||
39 | #include <linux/bitops.h> | 39 | #include <linux/bitops.h> |
40 | #include <linux/delay.h> | 40 | #include <linux/delay.h> |
41 | #include <linux/ethtool.h> | 41 | #include <linux/ethtool.h> |
42 | #include <linux/platform_device.h> | ||
43 | |||
42 | #include <asm/io.h> | 44 | #include <asm/io.h> |
43 | #include <asm/types.h> | 45 | #include <asm/types.h> |
44 | #include <asm/pgtable.h> | 46 | #include <asm/pgtable.h> |
@@ -1533,6 +1535,9 @@ static int mv643xx_eth_probe(struct device *ddev) | |||
1533 | printk(KERN_NOTICE "%s: RX NAPI Enabled \n", dev->name); | 1535 | printk(KERN_NOTICE "%s: RX NAPI Enabled \n", dev->name); |
1534 | #endif | 1536 | #endif |
1535 | 1537 | ||
1538 | if (mp->tx_sram_size > 0) | ||
1539 | printk(KERN_NOTICE "%s: Using SRAM\n", dev->name); | ||
1540 | |||
1536 | return 0; | 1541 | return 0; |
1537 | 1542 | ||
1538 | out: | 1543 | out: |
diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c index 70fe81a89df9..be319229f543 100644 --- a/drivers/net/pcnet32.c +++ b/drivers/net/pcnet32.c | |||
@@ -22,8 +22,8 @@ | |||
22 | *************************************************************************/ | 22 | *************************************************************************/ |
23 | 23 | ||
24 | #define DRV_NAME "pcnet32" | 24 | #define DRV_NAME "pcnet32" |
25 | #define DRV_VERSION "1.31a" | 25 | #define DRV_VERSION "1.31c" |
26 | #define DRV_RELDATE "12.Sep.2005" | 26 | #define DRV_RELDATE "01.Nov.2005" |
27 | #define PFX DRV_NAME ": " | 27 | #define PFX DRV_NAME ": " |
28 | 28 | ||
29 | static const char *version = | 29 | static const char *version = |
@@ -260,6 +260,11 @@ static int homepna[MAX_UNITS]; | |||
260 | * v1.31 02 Sep 2005 Hubert WS Lin <wslin@tw.ibm.c0m> added set_ringparam(). | 260 | * v1.31 02 Sep 2005 Hubert WS Lin <wslin@tw.ibm.c0m> added set_ringparam(). |
261 | * v1.31a 12 Sep 2005 Hubert WS Lin <wslin@tw.ibm.c0m> set min ring size to 4 | 261 | * v1.31a 12 Sep 2005 Hubert WS Lin <wslin@tw.ibm.c0m> set min ring size to 4 |
262 | * to allow loopback test to work unchanged. | 262 | * to allow loopback test to work unchanged. |
263 | * v1.31b 06 Oct 2005 Don Fry changed alloc_ring to show name of device | ||
264 | * if allocation fails | ||
265 | * v1.31c 01 Nov 2005 Don Fry Allied Telesyn 2700/2701 FX are 100Mbit only. | ||
266 | * Force 100Mbit FD if Auto (ASEL) is selected. | ||
267 | * See Bugzilla 2669 and 4551. | ||
263 | */ | 268 | */ |
264 | 269 | ||
265 | 270 | ||
@@ -408,7 +413,7 @@ static int pcnet32_get_regs_len(struct net_device *dev); | |||
408 | static void pcnet32_get_regs(struct net_device *dev, struct ethtool_regs *regs, | 413 | static void pcnet32_get_regs(struct net_device *dev, struct ethtool_regs *regs, |
409 | void *ptr); | 414 | void *ptr); |
410 | static void pcnet32_purge_tx_ring(struct net_device *dev); | 415 | static void pcnet32_purge_tx_ring(struct net_device *dev); |
411 | static int pcnet32_alloc_ring(struct net_device *dev); | 416 | static int pcnet32_alloc_ring(struct net_device *dev, char *name); |
412 | static void pcnet32_free_ring(struct net_device *dev); | 417 | static void pcnet32_free_ring(struct net_device *dev); |
413 | 418 | ||
414 | 419 | ||
@@ -669,15 +674,17 @@ static int pcnet32_set_ringparam(struct net_device *dev, struct ethtool_ringpara | |||
669 | lp->rx_mod_mask = lp->rx_ring_size - 1; | 674 | lp->rx_mod_mask = lp->rx_ring_size - 1; |
670 | lp->rx_len_bits = (i << 4); | 675 | lp->rx_len_bits = (i << 4); |
671 | 676 | ||
672 | if (pcnet32_alloc_ring(dev)) { | 677 | if (pcnet32_alloc_ring(dev, dev->name)) { |
673 | pcnet32_free_ring(dev); | 678 | pcnet32_free_ring(dev); |
679 | spin_unlock_irqrestore(&lp->lock, flags); | ||
674 | return -ENOMEM; | 680 | return -ENOMEM; |
675 | } | 681 | } |
676 | 682 | ||
677 | spin_unlock_irqrestore(&lp->lock, flags); | 683 | spin_unlock_irqrestore(&lp->lock, flags); |
678 | 684 | ||
679 | if (pcnet32_debug & NETIF_MSG_DRV) | 685 | if (pcnet32_debug & NETIF_MSG_DRV) |
680 | printk(KERN_INFO PFX "Ring Param Settings: RX: %d, TX: %d\n", lp->rx_ring_size, lp->tx_ring_size); | 686 | printk(KERN_INFO PFX "%s: Ring Param Settings: RX: %d, TX: %d\n", |
687 | dev->name, lp->rx_ring_size, lp->tx_ring_size); | ||
681 | 688 | ||
682 | if (netif_running(dev)) | 689 | if (netif_running(dev)) |
683 | pcnet32_open(dev); | 690 | pcnet32_open(dev); |
@@ -981,7 +988,11 @@ static void pcnet32_get_regs(struct net_device *dev, struct ethtool_regs *regs, | |||
981 | *buff++ = a->read_csr(ioaddr, 114); | 988 | *buff++ = a->read_csr(ioaddr, 114); |
982 | 989 | ||
983 | /* read bus configuration registers */ | 990 | /* read bus configuration registers */ |
984 | for (i=0; i<36; i++) { | 991 | for (i=0; i<30; i++) { |
992 | *buff++ = a->read_bcr(ioaddr, i); | ||
993 | } | ||
994 | *buff++ = 0; /* skip bcr30 so as not to hang 79C976 */ | ||
995 | for (i=31; i<36; i++) { | ||
985 | *buff++ = a->read_bcr(ioaddr, i); | 996 | *buff++ = a->read_bcr(ioaddr, i); |
986 | } | 997 | } |
987 | 998 | ||
@@ -1340,7 +1351,8 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) | |||
1340 | } | 1351 | } |
1341 | lp->a = *a; | 1352 | lp->a = *a; |
1342 | 1353 | ||
1343 | if (pcnet32_alloc_ring(dev)) { | 1354 | /* prior to register_netdev, dev->name is not yet correct */ |
1355 | if (pcnet32_alloc_ring(dev, pci_name(lp->pci_dev))) { | ||
1344 | ret = -ENOMEM; | 1356 | ret = -ENOMEM; |
1345 | goto err_free_ring; | 1357 | goto err_free_ring; |
1346 | } | 1358 | } |
@@ -1448,48 +1460,63 @@ err_release_region: | |||
1448 | } | 1460 | } |
1449 | 1461 | ||
1450 | 1462 | ||
1451 | static int pcnet32_alloc_ring(struct net_device *dev) | 1463 | /* if any allocation fails, caller must also call pcnet32_free_ring */ |
1464 | static int pcnet32_alloc_ring(struct net_device *dev, char *name) | ||
1452 | { | 1465 | { |
1453 | struct pcnet32_private *lp = dev->priv; | 1466 | struct pcnet32_private *lp = dev->priv; |
1454 | 1467 | ||
1455 | if ((lp->tx_ring = pci_alloc_consistent(lp->pci_dev, sizeof(struct pcnet32_tx_head) * lp->tx_ring_size, | 1468 | lp->tx_ring = pci_alloc_consistent(lp->pci_dev, |
1456 | &lp->tx_ring_dma_addr)) == NULL) { | 1469 | sizeof(struct pcnet32_tx_head) * lp->tx_ring_size, |
1470 | &lp->tx_ring_dma_addr); | ||
1471 | if (lp->tx_ring == NULL) { | ||
1457 | if (pcnet32_debug & NETIF_MSG_DRV) | 1472 | if (pcnet32_debug & NETIF_MSG_DRV) |
1458 | printk(KERN_ERR PFX "Consistent memory allocation failed.\n"); | 1473 | printk("\n" KERN_ERR PFX "%s: Consistent memory allocation failed.\n", |
1474 | name); | ||
1459 | return -ENOMEM; | 1475 | return -ENOMEM; |
1460 | } | 1476 | } |
1461 | 1477 | ||
1462 | if ((lp->rx_ring = pci_alloc_consistent(lp->pci_dev, sizeof(struct pcnet32_rx_head) * lp->rx_ring_size, | 1478 | lp->rx_ring = pci_alloc_consistent(lp->pci_dev, |
1463 | &lp->rx_ring_dma_addr)) == NULL) { | 1479 | sizeof(struct pcnet32_rx_head) * lp->rx_ring_size, |
1480 | &lp->rx_ring_dma_addr); | ||
1481 | if (lp->rx_ring == NULL) { | ||
1464 | if (pcnet32_debug & NETIF_MSG_DRV) | 1482 | if (pcnet32_debug & NETIF_MSG_DRV) |
1465 | printk(KERN_ERR PFX "Consistent memory allocation failed.\n"); | 1483 | printk("\n" KERN_ERR PFX "%s: Consistent memory allocation failed.\n", |
1484 | name); | ||
1466 | return -ENOMEM; | 1485 | return -ENOMEM; |
1467 | } | 1486 | } |
1468 | 1487 | ||
1469 | if (!(lp->tx_dma_addr = kmalloc(sizeof(dma_addr_t) * lp->tx_ring_size, GFP_ATOMIC))) { | 1488 | lp->tx_dma_addr = kmalloc(sizeof(dma_addr_t) * lp->tx_ring_size, |
1489 | GFP_ATOMIC); | ||
1490 | if (!lp->tx_dma_addr) { | ||
1470 | if (pcnet32_debug & NETIF_MSG_DRV) | 1491 | if (pcnet32_debug & NETIF_MSG_DRV) |
1471 | printk(KERN_ERR PFX "Memory allocation failed.\n"); | 1492 | printk("\n" KERN_ERR PFX "%s: Memory allocation failed.\n", name); |
1472 | return -ENOMEM; | 1493 | return -ENOMEM; |
1473 | } | 1494 | } |
1474 | memset(lp->tx_dma_addr, 0, sizeof(dma_addr_t) * lp->tx_ring_size); | 1495 | memset(lp->tx_dma_addr, 0, sizeof(dma_addr_t) * lp->tx_ring_size); |
1475 | 1496 | ||
1476 | if (!(lp->rx_dma_addr = kmalloc(sizeof(dma_addr_t) * lp->rx_ring_size, GFP_ATOMIC))) { | 1497 | lp->rx_dma_addr = kmalloc(sizeof(dma_addr_t) * lp->rx_ring_size, |
1498 | GFP_ATOMIC); | ||
1499 | if (!lp->rx_dma_addr) { | ||
1477 | if (pcnet32_debug & NETIF_MSG_DRV) | 1500 | if (pcnet32_debug & NETIF_MSG_DRV) |
1478 | printk(KERN_ERR PFX "Memory allocation failed.\n"); | 1501 | printk("\n" KERN_ERR PFX "%s: Memory allocation failed.\n", name); |
1479 | return -ENOMEM; | 1502 | return -ENOMEM; |
1480 | } | 1503 | } |
1481 | memset(lp->rx_dma_addr, 0, sizeof(dma_addr_t) * lp->rx_ring_size); | 1504 | memset(lp->rx_dma_addr, 0, sizeof(dma_addr_t) * lp->rx_ring_size); |
1482 | 1505 | ||
1483 | if (!(lp->tx_skbuff = kmalloc(sizeof(struct sk_buff *) * lp->tx_ring_size, GFP_ATOMIC))) { | 1506 | lp->tx_skbuff = kmalloc(sizeof(struct sk_buff *) * lp->tx_ring_size, |
1507 | GFP_ATOMIC); | ||
1508 | if (!lp->tx_skbuff) { | ||
1484 | if (pcnet32_debug & NETIF_MSG_DRV) | 1509 | if (pcnet32_debug & NETIF_MSG_DRV) |
1485 | printk(KERN_ERR PFX "Memory allocation failed.\n"); | 1510 | printk("\n" KERN_ERR PFX "%s: Memory allocation failed.\n", name); |
1486 | return -ENOMEM; | 1511 | return -ENOMEM; |
1487 | } | 1512 | } |
1488 | memset(lp->tx_skbuff, 0, sizeof(struct sk_buff *) * lp->tx_ring_size); | 1513 | memset(lp->tx_skbuff, 0, sizeof(struct sk_buff *) * lp->tx_ring_size); |
1489 | 1514 | ||
1490 | if (!(lp->rx_skbuff = kmalloc(sizeof(struct sk_buff *) * lp->rx_ring_size, GFP_ATOMIC))) { | 1515 | lp->rx_skbuff = kmalloc(sizeof(struct sk_buff *) * lp->rx_ring_size, |
1516 | GFP_ATOMIC); | ||
1517 | if (!lp->rx_skbuff) { | ||
1491 | if (pcnet32_debug & NETIF_MSG_DRV) | 1518 | if (pcnet32_debug & NETIF_MSG_DRV) |
1492 | printk(KERN_ERR PFX "Memory allocation failed.\n"); | 1519 | printk("\n" KERN_ERR PFX "%s: Memory allocation failed.\n", name); |
1493 | return -ENOMEM; | 1520 | return -ENOMEM; |
1494 | } | 1521 | } |
1495 | memset(lp->rx_skbuff, 0, sizeof(struct sk_buff *) * lp->rx_ring_size); | 1522 | memset(lp->rx_skbuff, 0, sizeof(struct sk_buff *) * lp->rx_ring_size); |
@@ -1592,12 +1619,18 @@ pcnet32_open(struct net_device *dev) | |||
1592 | val |= 0x10; | 1619 | val |= 0x10; |
1593 | lp->a.write_csr (ioaddr, 124, val); | 1620 | lp->a.write_csr (ioaddr, 124, val); |
1594 | 1621 | ||
1595 | /* Allied Telesyn AT 2700/2701 FX looses the link, so skip that */ | 1622 | /* Allied Telesyn AT 2700/2701 FX are 100Mbit only and do not negotiate */ |
1596 | if (lp->pci_dev->subsystem_vendor == PCI_VENDOR_ID_AT && | 1623 | if (lp->pci_dev->subsystem_vendor == PCI_VENDOR_ID_AT && |
1597 | (lp->pci_dev->subsystem_device == PCI_SUBDEVICE_ID_AT_2700FX || | 1624 | (lp->pci_dev->subsystem_device == PCI_SUBDEVICE_ID_AT_2700FX || |
1598 | lp->pci_dev->subsystem_device == PCI_SUBDEVICE_ID_AT_2701FX)) { | 1625 | lp->pci_dev->subsystem_device == PCI_SUBDEVICE_ID_AT_2701FX)) { |
1599 | printk(KERN_DEBUG "%s: Skipping PHY selection.\n", dev->name); | 1626 | if (lp->options & PCNET32_PORT_ASEL) { |
1600 | } else { | 1627 | lp->options = PCNET32_PORT_FD | PCNET32_PORT_100; |
1628 | if (netif_msg_link(lp)) | ||
1629 | printk(KERN_DEBUG "%s: Setting 100Mb-Full Duplex.\n", | ||
1630 | dev->name); | ||
1631 | } | ||
1632 | } | ||
1633 | { | ||
1601 | /* | 1634 | /* |
1602 | * 24 Jun 2004 according AMD, in order to change the PHY, | 1635 | * 24 Jun 2004 according AMD, in order to change the PHY, |
1603 | * DANAS (or DISPM for 79C976) must be set; then select the speed, | 1636 | * DANAS (or DISPM for 79C976) must be set; then select the speed, |
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index ad93b0da87f0..5eab9c42a111 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c | |||
@@ -61,6 +61,9 @@ int mdiobus_register(struct mii_bus *bus) | |||
61 | for (i = 0; i < PHY_MAX_ADDR; i++) { | 61 | for (i = 0; i < PHY_MAX_ADDR; i++) { |
62 | struct phy_device *phydev; | 62 | struct phy_device *phydev; |
63 | 63 | ||
64 | if (bus->phy_mask & (1 << i)) | ||
65 | continue; | ||
66 | |||
64 | phydev = get_phy_device(bus, i); | 67 | phydev = get_phy_device(bus, i); |
65 | 68 | ||
66 | if (IS_ERR(phydev)) | 69 | if (IS_ERR(phydev)) |
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c index 3f5e93aad5c7..9c4935407f26 100644 --- a/drivers/net/s2io.c +++ b/drivers/net/s2io.c | |||
@@ -30,6 +30,8 @@ | |||
30 | * in the driver. | 30 | * in the driver. |
31 | * rx_ring_sz: This defines the number of descriptors each ring can have. This | 31 | * rx_ring_sz: This defines the number of descriptors each ring can have. This |
32 | * is also an array of size 8. | 32 | * is also an array of size 8. |
33 | * rx_ring_mode: This defines the operation mode of all 8 rings. The valid | ||
34 | * values are 1, 2 and 3. | ||
33 | * tx_fifo_num: This defines the number of Tx FIFOs thats used int the driver. | 35 | * tx_fifo_num: This defines the number of Tx FIFOs thats used int the driver. |
34 | * tx_fifo_len: This too is an array of 8. Each element defines the number of | 36 | * tx_fifo_len: This too is an array of 8. Each element defines the number of |
35 | * Tx descriptors that can be associated with each corresponding FIFO. | 37 | * Tx descriptors that can be associated with each corresponding FIFO. |
@@ -65,12 +67,15 @@ | |||
65 | #include "s2io.h" | 67 | #include "s2io.h" |
66 | #include "s2io-regs.h" | 68 | #include "s2io-regs.h" |
67 | 69 | ||
68 | #define DRV_VERSION "Version 2.0.9.1" | 70 | #define DRV_VERSION "Version 2.0.9.3" |
69 | 71 | ||
70 | /* S2io Driver name & version. */ | 72 | /* S2io Driver name & version. */ |
71 | static char s2io_driver_name[] = "Neterion"; | 73 | static char s2io_driver_name[] = "Neterion"; |
72 | static char s2io_driver_version[] = DRV_VERSION; | 74 | static char s2io_driver_version[] = DRV_VERSION; |
73 | 75 | ||
76 | int rxd_size[4] = {32,48,48,64}; | ||
77 | int rxd_count[4] = {127,85,85,63}; | ||
78 | |||
74 | static inline int RXD_IS_UP2DT(RxD_t *rxdp) | 79 | static inline int RXD_IS_UP2DT(RxD_t *rxdp) |
75 | { | 80 | { |
76 | int ret; | 81 | int ret; |
@@ -104,7 +109,7 @@ static inline int rx_buffer_level(nic_t * sp, int rxb_size, int ring) | |||
104 | mac_control = &sp->mac_control; | 109 | mac_control = &sp->mac_control; |
105 | if ((mac_control->rings[ring].pkt_cnt - rxb_size) > 16) { | 110 | if ((mac_control->rings[ring].pkt_cnt - rxb_size) > 16) { |
106 | level = LOW; | 111 | level = LOW; |
107 | if (rxb_size <= MAX_RXDS_PER_BLOCK) { | 112 | if (rxb_size <= rxd_count[sp->rxd_mode]) { |
108 | level = PANIC; | 113 | level = PANIC; |
109 | } | 114 | } |
110 | } | 115 | } |
@@ -296,6 +301,7 @@ static unsigned int rx_ring_sz[MAX_RX_RINGS] = | |||
296 | {[0 ...(MAX_RX_RINGS - 1)] = 0 }; | 301 | {[0 ...(MAX_RX_RINGS - 1)] = 0 }; |
297 | static unsigned int rts_frm_len[MAX_RX_RINGS] = | 302 | static unsigned int rts_frm_len[MAX_RX_RINGS] = |
298 | {[0 ...(MAX_RX_RINGS - 1)] = 0 }; | 303 | {[0 ...(MAX_RX_RINGS - 1)] = 0 }; |
304 | static unsigned int rx_ring_mode = 1; | ||
299 | static unsigned int use_continuous_tx_intrs = 1; | 305 | static unsigned int use_continuous_tx_intrs = 1; |
300 | static unsigned int rmac_pause_time = 65535; | 306 | static unsigned int rmac_pause_time = 65535; |
301 | static unsigned int mc_pause_threshold_q0q3 = 187; | 307 | static unsigned int mc_pause_threshold_q0q3 = 187; |
@@ -304,6 +310,7 @@ static unsigned int shared_splits; | |||
304 | static unsigned int tmac_util_period = 5; | 310 | static unsigned int tmac_util_period = 5; |
305 | static unsigned int rmac_util_period = 5; | 311 | static unsigned int rmac_util_period = 5; |
306 | static unsigned int bimodal = 0; | 312 | static unsigned int bimodal = 0; |
313 | static unsigned int l3l4hdr_size = 128; | ||
307 | #ifndef CONFIG_S2IO_NAPI | 314 | #ifndef CONFIG_S2IO_NAPI |
308 | static unsigned int indicate_max_pkts; | 315 | static unsigned int indicate_max_pkts; |
309 | #endif | 316 | #endif |
@@ -357,10 +364,8 @@ static int init_shared_mem(struct s2io_nic *nic) | |||
357 | int i, j, blk_cnt, rx_sz, tx_sz; | 364 | int i, j, blk_cnt, rx_sz, tx_sz; |
358 | int lst_size, lst_per_page; | 365 | int lst_size, lst_per_page; |
359 | struct net_device *dev = nic->dev; | 366 | struct net_device *dev = nic->dev; |
360 | #ifdef CONFIG_2BUFF_MODE | ||
361 | unsigned long tmp; | 367 | unsigned long tmp; |
362 | buffAdd_t *ba; | 368 | buffAdd_t *ba; |
363 | #endif | ||
364 | 369 | ||
365 | mac_info_t *mac_control; | 370 | mac_info_t *mac_control; |
366 | struct config_param *config; | 371 | struct config_param *config; |
@@ -458,7 +463,8 @@ static int init_shared_mem(struct s2io_nic *nic) | |||
458 | /* Allocation and initialization of RXDs in Rings */ | 463 | /* Allocation and initialization of RXDs in Rings */ |
459 | size = 0; | 464 | size = 0; |
460 | for (i = 0; i < config->rx_ring_num; i++) { | 465 | for (i = 0; i < config->rx_ring_num; i++) { |
461 | if (config->rx_cfg[i].num_rxd % (MAX_RXDS_PER_BLOCK + 1)) { | 466 | if (config->rx_cfg[i].num_rxd % |
467 | (rxd_count[nic->rxd_mode] + 1)) { | ||
462 | DBG_PRINT(ERR_DBG, "%s: RxD count of ", dev->name); | 468 | DBG_PRINT(ERR_DBG, "%s: RxD count of ", dev->name); |
463 | DBG_PRINT(ERR_DBG, "Ring%d is not a multiple of ", | 469 | DBG_PRINT(ERR_DBG, "Ring%d is not a multiple of ", |
464 | i); | 470 | i); |
@@ -467,11 +473,15 @@ static int init_shared_mem(struct s2io_nic *nic) | |||
467 | } | 473 | } |
468 | size += config->rx_cfg[i].num_rxd; | 474 | size += config->rx_cfg[i].num_rxd; |
469 | mac_control->rings[i].block_count = | 475 | mac_control->rings[i].block_count = |
470 | config->rx_cfg[i].num_rxd / (MAX_RXDS_PER_BLOCK + 1); | 476 | config->rx_cfg[i].num_rxd / |
471 | mac_control->rings[i].pkt_cnt = | 477 | (rxd_count[nic->rxd_mode] + 1 ); |
472 | config->rx_cfg[i].num_rxd - mac_control->rings[i].block_count; | 478 | mac_control->rings[i].pkt_cnt = config->rx_cfg[i].num_rxd - |
479 | mac_control->rings[i].block_count; | ||
473 | } | 480 | } |
474 | size = (size * (sizeof(RxD_t))); | 481 | if (nic->rxd_mode == RXD_MODE_1) |
482 | size = (size * (sizeof(RxD1_t))); | ||
483 | else | ||
484 | size = (size * (sizeof(RxD3_t))); | ||
475 | rx_sz = size; | 485 | rx_sz = size; |
476 | 486 | ||
477 | for (i = 0; i < config->rx_ring_num; i++) { | 487 | for (i = 0; i < config->rx_ring_num; i++) { |
@@ -486,15 +496,15 @@ static int init_shared_mem(struct s2io_nic *nic) | |||
486 | mac_control->rings[i].nic = nic; | 496 | mac_control->rings[i].nic = nic; |
487 | mac_control->rings[i].ring_no = i; | 497 | mac_control->rings[i].ring_no = i; |
488 | 498 | ||
489 | blk_cnt = | 499 | blk_cnt = config->rx_cfg[i].num_rxd / |
490 | config->rx_cfg[i].num_rxd / (MAX_RXDS_PER_BLOCK + 1); | 500 | (rxd_count[nic->rxd_mode] + 1); |
491 | /* Allocating all the Rx blocks */ | 501 | /* Allocating all the Rx blocks */ |
492 | for (j = 0; j < blk_cnt; j++) { | 502 | for (j = 0; j < blk_cnt; j++) { |
493 | #ifndef CONFIG_2BUFF_MODE | 503 | rx_block_info_t *rx_blocks; |
494 | size = (MAX_RXDS_PER_BLOCK + 1) * (sizeof(RxD_t)); | 504 | int l; |
495 | #else | 505 | |
496 | size = SIZE_OF_BLOCK; | 506 | rx_blocks = &mac_control->rings[i].rx_blocks[j]; |
497 | #endif | 507 | size = SIZE_OF_BLOCK; //size is always page size |
498 | tmp_v_addr = pci_alloc_consistent(nic->pdev, size, | 508 | tmp_v_addr = pci_alloc_consistent(nic->pdev, size, |
499 | &tmp_p_addr); | 509 | &tmp_p_addr); |
500 | if (tmp_v_addr == NULL) { | 510 | if (tmp_v_addr == NULL) { |
@@ -504,11 +514,24 @@ static int init_shared_mem(struct s2io_nic *nic) | |||
504 | * memory that was alloced till the | 514 | * memory that was alloced till the |
505 | * failure happened. | 515 | * failure happened. |
506 | */ | 516 | */ |
507 | mac_control->rings[i].rx_blocks[j].block_virt_addr = | 517 | rx_blocks->block_virt_addr = tmp_v_addr; |
508 | tmp_v_addr; | ||
509 | return -ENOMEM; | 518 | return -ENOMEM; |
510 | } | 519 | } |
511 | memset(tmp_v_addr, 0, size); | 520 | memset(tmp_v_addr, 0, size); |
521 | rx_blocks->block_virt_addr = tmp_v_addr; | ||
522 | rx_blocks->block_dma_addr = tmp_p_addr; | ||
523 | rx_blocks->rxds = kmalloc(sizeof(rxd_info_t)* | ||
524 | rxd_count[nic->rxd_mode], | ||
525 | GFP_KERNEL); | ||
526 | for (l=0; l<rxd_count[nic->rxd_mode];l++) { | ||
527 | rx_blocks->rxds[l].virt_addr = | ||
528 | rx_blocks->block_virt_addr + | ||
529 | (rxd_size[nic->rxd_mode] * l); | ||
530 | rx_blocks->rxds[l].dma_addr = | ||
531 | rx_blocks->block_dma_addr + | ||
532 | (rxd_size[nic->rxd_mode] * l); | ||
533 | } | ||
534 | |||
512 | mac_control->rings[i].rx_blocks[j].block_virt_addr = | 535 | mac_control->rings[i].rx_blocks[j].block_virt_addr = |
513 | tmp_v_addr; | 536 | tmp_v_addr; |
514 | mac_control->rings[i].rx_blocks[j].block_dma_addr = | 537 | mac_control->rings[i].rx_blocks[j].block_dma_addr = |
@@ -528,62 +551,58 @@ static int init_shared_mem(struct s2io_nic *nic) | |||
528 | blk_cnt].block_dma_addr; | 551 | blk_cnt].block_dma_addr; |
529 | 552 | ||
530 | pre_rxd_blk = (RxD_block_t *) tmp_v_addr; | 553 | pre_rxd_blk = (RxD_block_t *) tmp_v_addr; |
531 | pre_rxd_blk->reserved_1 = END_OF_BLOCK; /* last RxD | ||
532 | * marker. | ||
533 | */ | ||
534 | #ifndef CONFIG_2BUFF_MODE | ||
535 | pre_rxd_blk->reserved_2_pNext_RxD_block = | 554 | pre_rxd_blk->reserved_2_pNext_RxD_block = |
536 | (unsigned long) tmp_v_addr_next; | 555 | (unsigned long) tmp_v_addr_next; |
537 | #endif | ||
538 | pre_rxd_blk->pNext_RxD_Blk_physical = | 556 | pre_rxd_blk->pNext_RxD_Blk_physical = |
539 | (u64) tmp_p_addr_next; | 557 | (u64) tmp_p_addr_next; |
540 | } | 558 | } |
541 | } | 559 | } |
542 | 560 | if (nic->rxd_mode >= RXD_MODE_3A) { | |
543 | #ifdef CONFIG_2BUFF_MODE | 561 | /* |
544 | /* | 562 | * Allocation of Storages for buffer addresses in 2BUFF mode |
545 | * Allocation of Storages for buffer addresses in 2BUFF mode | 563 | * and the buffers as well. |
546 | * and the buffers as well. | 564 | */ |
547 | */ | 565 | for (i = 0; i < config->rx_ring_num; i++) { |
548 | for (i = 0; i < config->rx_ring_num; i++) { | 566 | blk_cnt = config->rx_cfg[i].num_rxd / |
549 | blk_cnt = | 567 | (rxd_count[nic->rxd_mode]+ 1); |
550 | config->rx_cfg[i].num_rxd / (MAX_RXDS_PER_BLOCK + 1); | 568 | mac_control->rings[i].ba = |
551 | mac_control->rings[i].ba = kmalloc((sizeof(buffAdd_t *) * blk_cnt), | 569 | kmalloc((sizeof(buffAdd_t *) * blk_cnt), |
552 | GFP_KERNEL); | 570 | GFP_KERNEL); |
553 | if (!mac_control->rings[i].ba) | 571 | if (!mac_control->rings[i].ba) |
554 | return -ENOMEM; | ||
555 | for (j = 0; j < blk_cnt; j++) { | ||
556 | int k = 0; | ||
557 | mac_control->rings[i].ba[j] = kmalloc((sizeof(buffAdd_t) * | ||
558 | (MAX_RXDS_PER_BLOCK + 1)), | ||
559 | GFP_KERNEL); | ||
560 | if (!mac_control->rings[i].ba[j]) | ||
561 | return -ENOMEM; | 572 | return -ENOMEM; |
562 | while (k != MAX_RXDS_PER_BLOCK) { | 573 | for (j = 0; j < blk_cnt; j++) { |
563 | ba = &mac_control->rings[i].ba[j][k]; | 574 | int k = 0; |
564 | 575 | mac_control->rings[i].ba[j] = | |
565 | ba->ba_0_org = (void *) kmalloc | 576 | kmalloc((sizeof(buffAdd_t) * |
566 | (BUF0_LEN + ALIGN_SIZE, GFP_KERNEL); | 577 | (rxd_count[nic->rxd_mode] + 1)), |
567 | if (!ba->ba_0_org) | 578 | GFP_KERNEL); |
568 | return -ENOMEM; | 579 | if (!mac_control->rings[i].ba[j]) |
569 | tmp = (unsigned long) ba->ba_0_org; | ||
570 | tmp += ALIGN_SIZE; | ||
571 | tmp &= ~((unsigned long) ALIGN_SIZE); | ||
572 | ba->ba_0 = (void *) tmp; | ||
573 | |||
574 | ba->ba_1_org = (void *) kmalloc | ||
575 | (BUF1_LEN + ALIGN_SIZE, GFP_KERNEL); | ||
576 | if (!ba->ba_1_org) | ||
577 | return -ENOMEM; | 580 | return -ENOMEM; |
578 | tmp = (unsigned long) ba->ba_1_org; | 581 | while (k != rxd_count[nic->rxd_mode]) { |
579 | tmp += ALIGN_SIZE; | 582 | ba = &mac_control->rings[i].ba[j][k]; |
580 | tmp &= ~((unsigned long) ALIGN_SIZE); | 583 | |
581 | ba->ba_1 = (void *) tmp; | 584 | ba->ba_0_org = (void *) kmalloc |
582 | k++; | 585 | (BUF0_LEN + ALIGN_SIZE, GFP_KERNEL); |
586 | if (!ba->ba_0_org) | ||
587 | return -ENOMEM; | ||
588 | tmp = (unsigned long)ba->ba_0_org; | ||
589 | tmp += ALIGN_SIZE; | ||
590 | tmp &= ~((unsigned long) ALIGN_SIZE); | ||
591 | ba->ba_0 = (void *) tmp; | ||
592 | |||
593 | ba->ba_1_org = (void *) kmalloc | ||
594 | (BUF1_LEN + ALIGN_SIZE, GFP_KERNEL); | ||
595 | if (!ba->ba_1_org) | ||
596 | return -ENOMEM; | ||
597 | tmp = (unsigned long) ba->ba_1_org; | ||
598 | tmp += ALIGN_SIZE; | ||
599 | tmp &= ~((unsigned long) ALIGN_SIZE); | ||
600 | ba->ba_1 = (void *) tmp; | ||
601 | k++; | ||
602 | } | ||
583 | } | 603 | } |
584 | } | 604 | } |
585 | } | 605 | } |
586 | #endif | ||
587 | 606 | ||
588 | /* Allocation and initialization of Statistics block */ | 607 | /* Allocation and initialization of Statistics block */ |
589 | size = sizeof(StatInfo_t); | 608 | size = sizeof(StatInfo_t); |
@@ -669,11 +688,7 @@ static void free_shared_mem(struct s2io_nic *nic) | |||
669 | kfree(mac_control->fifos[i].list_info); | 688 | kfree(mac_control->fifos[i].list_info); |
670 | } | 689 | } |
671 | 690 | ||
672 | #ifndef CONFIG_2BUFF_MODE | ||
673 | size = (MAX_RXDS_PER_BLOCK + 1) * (sizeof(RxD_t)); | ||
674 | #else | ||
675 | size = SIZE_OF_BLOCK; | 691 | size = SIZE_OF_BLOCK; |
676 | #endif | ||
677 | for (i = 0; i < config->rx_ring_num; i++) { | 692 | for (i = 0; i < config->rx_ring_num; i++) { |
678 | blk_cnt = mac_control->rings[i].block_count; | 693 | blk_cnt = mac_control->rings[i].block_count; |
679 | for (j = 0; j < blk_cnt; j++) { | 694 | for (j = 0; j < blk_cnt; j++) { |
@@ -685,29 +700,31 @@ static void free_shared_mem(struct s2io_nic *nic) | |||
685 | break; | 700 | break; |
686 | pci_free_consistent(nic->pdev, size, | 701 | pci_free_consistent(nic->pdev, size, |
687 | tmp_v_addr, tmp_p_addr); | 702 | tmp_v_addr, tmp_p_addr); |
703 | kfree(mac_control->rings[i].rx_blocks[j].rxds); | ||
688 | } | 704 | } |
689 | } | 705 | } |
690 | 706 | ||
691 | #ifdef CONFIG_2BUFF_MODE | 707 | if (nic->rxd_mode >= RXD_MODE_3A) { |
692 | /* Freeing buffer storage addresses in 2BUFF mode. */ | 708 | /* Freeing buffer storage addresses in 2BUFF mode. */ |
693 | for (i = 0; i < config->rx_ring_num; i++) { | 709 | for (i = 0; i < config->rx_ring_num; i++) { |
694 | blk_cnt = | 710 | blk_cnt = config->rx_cfg[i].num_rxd / |
695 | config->rx_cfg[i].num_rxd / (MAX_RXDS_PER_BLOCK + 1); | 711 | (rxd_count[nic->rxd_mode] + 1); |
696 | for (j = 0; j < blk_cnt; j++) { | 712 | for (j = 0; j < blk_cnt; j++) { |
697 | int k = 0; | 713 | int k = 0; |
698 | if (!mac_control->rings[i].ba[j]) | 714 | if (!mac_control->rings[i].ba[j]) |
699 | continue; | 715 | continue; |
700 | while (k != MAX_RXDS_PER_BLOCK) { | 716 | while (k != rxd_count[nic->rxd_mode]) { |
701 | buffAdd_t *ba = &mac_control->rings[i].ba[j][k]; | 717 | buffAdd_t *ba = |
702 | kfree(ba->ba_0_org); | 718 | &mac_control->rings[i].ba[j][k]; |
703 | kfree(ba->ba_1_org); | 719 | kfree(ba->ba_0_org); |
704 | k++; | 720 | kfree(ba->ba_1_org); |
721 | k++; | ||
722 | } | ||
723 | kfree(mac_control->rings[i].ba[j]); | ||
705 | } | 724 | } |
706 | kfree(mac_control->rings[i].ba[j]); | 725 | kfree(mac_control->rings[i].ba); |
707 | } | 726 | } |
708 | kfree(mac_control->rings[i].ba); | ||
709 | } | 727 | } |
710 | #endif | ||
711 | 728 | ||
712 | if (mac_control->stats_mem) { | 729 | if (mac_control->stats_mem) { |
713 | pci_free_consistent(nic->pdev, | 730 | pci_free_consistent(nic->pdev, |
@@ -1894,20 +1911,19 @@ static int start_nic(struct s2io_nic *nic) | |||
1894 | val64 = readq(&bar0->prc_ctrl_n[i]); | 1911 | val64 = readq(&bar0->prc_ctrl_n[i]); |
1895 | if (nic->config.bimodal) | 1912 | if (nic->config.bimodal) |
1896 | val64 |= PRC_CTRL_BIMODAL_INTERRUPT; | 1913 | val64 |= PRC_CTRL_BIMODAL_INTERRUPT; |
1897 | #ifndef CONFIG_2BUFF_MODE | 1914 | if (nic->rxd_mode == RXD_MODE_1) |
1898 | val64 |= PRC_CTRL_RC_ENABLED; | 1915 | val64 |= PRC_CTRL_RC_ENABLED; |
1899 | #else | 1916 | else |
1900 | val64 |= PRC_CTRL_RC_ENABLED | PRC_CTRL_RING_MODE_3; | 1917 | val64 |= PRC_CTRL_RC_ENABLED | PRC_CTRL_RING_MODE_3; |
1901 | #endif | ||
1902 | writeq(val64, &bar0->prc_ctrl_n[i]); | 1918 | writeq(val64, &bar0->prc_ctrl_n[i]); |
1903 | } | 1919 | } |
1904 | 1920 | ||
1905 | #ifdef CONFIG_2BUFF_MODE | 1921 | if (nic->rxd_mode == RXD_MODE_3B) { |
1906 | /* Enabling 2 buffer mode by writing into Rx_pa_cfg reg. */ | 1922 | /* Enabling 2 buffer mode by writing into Rx_pa_cfg reg. */ |
1907 | val64 = readq(&bar0->rx_pa_cfg); | 1923 | val64 = readq(&bar0->rx_pa_cfg); |
1908 | val64 |= RX_PA_CFG_IGNORE_L2_ERR; | 1924 | val64 |= RX_PA_CFG_IGNORE_L2_ERR; |
1909 | writeq(val64, &bar0->rx_pa_cfg); | 1925 | writeq(val64, &bar0->rx_pa_cfg); |
1910 | #endif | 1926 | } |
1911 | 1927 | ||
1912 | /* | 1928 | /* |
1913 | * Enabling MC-RLDRAM. After enabling the device, we timeout | 1929 | * Enabling MC-RLDRAM. After enabling the device, we timeout |
@@ -2090,6 +2106,41 @@ static void stop_nic(struct s2io_nic *nic) | |||
2090 | } | 2106 | } |
2091 | } | 2107 | } |
2092 | 2108 | ||
2109 | int fill_rxd_3buf(nic_t *nic, RxD_t *rxdp, struct sk_buff *skb) | ||
2110 | { | ||
2111 | struct net_device *dev = nic->dev; | ||
2112 | struct sk_buff *frag_list; | ||
2113 | u64 tmp; | ||
2114 | |||
2115 | /* Buffer-1 receives L3/L4 headers */ | ||
2116 | ((RxD3_t*)rxdp)->Buffer1_ptr = pci_map_single | ||
2117 | (nic->pdev, skb->data, l3l4hdr_size + 4, | ||
2118 | PCI_DMA_FROMDEVICE); | ||
2119 | |||
2120 | /* skb_shinfo(skb)->frag_list will have L4 data payload */ | ||
2121 | skb_shinfo(skb)->frag_list = dev_alloc_skb(dev->mtu + ALIGN_SIZE); | ||
2122 | if (skb_shinfo(skb)->frag_list == NULL) { | ||
2123 | DBG_PRINT(ERR_DBG, "%s: dev_alloc_skb failed\n ", dev->name); | ||
2124 | return -ENOMEM ; | ||
2125 | } | ||
2126 | frag_list = skb_shinfo(skb)->frag_list; | ||
2127 | frag_list->next = NULL; | ||
2128 | tmp = (u64) frag_list->data; | ||
2129 | tmp += ALIGN_SIZE; | ||
2130 | tmp &= ~ALIGN_SIZE; | ||
2131 | frag_list->data = (void *) tmp; | ||
2132 | frag_list->tail = (void *) tmp; | ||
2133 | |||
2134 | /* Buffer-2 receives L4 data payload */ | ||
2135 | ((RxD3_t*)rxdp)->Buffer2_ptr = pci_map_single(nic->pdev, | ||
2136 | frag_list->data, dev->mtu, | ||
2137 | PCI_DMA_FROMDEVICE); | ||
2138 | rxdp->Control_2 |= SET_BUFFER1_SIZE_3(l3l4hdr_size + 4); | ||
2139 | rxdp->Control_2 |= SET_BUFFER2_SIZE_3(dev->mtu); | ||
2140 | |||
2141 | return SUCCESS; | ||
2142 | } | ||
2143 | |||
2093 | /** | 2144 | /** |
2094 | * fill_rx_buffers - Allocates the Rx side skbs | 2145 | * fill_rx_buffers - Allocates the Rx side skbs |
2095 | * @nic: device private variable | 2146 | * @nic: device private variable |
@@ -2117,18 +2168,12 @@ int fill_rx_buffers(struct s2io_nic *nic, int ring_no) | |||
2117 | struct sk_buff *skb; | 2168 | struct sk_buff *skb; |
2118 | RxD_t *rxdp; | 2169 | RxD_t *rxdp; |
2119 | int off, off1, size, block_no, block_no1; | 2170 | int off, off1, size, block_no, block_no1; |
2120 | int offset, offset1; | ||
2121 | u32 alloc_tab = 0; | 2171 | u32 alloc_tab = 0; |
2122 | u32 alloc_cnt; | 2172 | u32 alloc_cnt; |
2123 | mac_info_t *mac_control; | 2173 | mac_info_t *mac_control; |
2124 | struct config_param *config; | 2174 | struct config_param *config; |
2125 | #ifdef CONFIG_2BUFF_MODE | ||
2126 | RxD_t *rxdpnext; | ||
2127 | int nextblk; | ||
2128 | u64 tmp; | 2175 | u64 tmp; |
2129 | buffAdd_t *ba; | 2176 | buffAdd_t *ba; |
2130 | dma_addr_t rxdpphys; | ||
2131 | #endif | ||
2132 | #ifndef CONFIG_S2IO_NAPI | 2177 | #ifndef CONFIG_S2IO_NAPI |
2133 | unsigned long flags; | 2178 | unsigned long flags; |
2134 | #endif | 2179 | #endif |
@@ -2138,8 +2183,6 @@ int fill_rx_buffers(struct s2io_nic *nic, int ring_no) | |||
2138 | config = &nic->config; | 2183 | config = &nic->config; |
2139 | alloc_cnt = mac_control->rings[ring_no].pkt_cnt - | 2184 | alloc_cnt = mac_control->rings[ring_no].pkt_cnt - |
2140 | atomic_read(&nic->rx_bufs_left[ring_no]); | 2185 | atomic_read(&nic->rx_bufs_left[ring_no]); |
2141 | size = dev->mtu + HEADER_ETHERNET_II_802_3_SIZE + | ||
2142 | HEADER_802_2_SIZE + HEADER_SNAP_SIZE; | ||
2143 | 2186 | ||
2144 | while (alloc_tab < alloc_cnt) { | 2187 | while (alloc_tab < alloc_cnt) { |
2145 | block_no = mac_control->rings[ring_no].rx_curr_put_info. | 2188 | block_no = mac_control->rings[ring_no].rx_curr_put_info. |
@@ -2148,159 +2191,145 @@ int fill_rx_buffers(struct s2io_nic *nic, int ring_no) | |||
2148 | block_index; | 2191 | block_index; |
2149 | off = mac_control->rings[ring_no].rx_curr_put_info.offset; | 2192 | off = mac_control->rings[ring_no].rx_curr_put_info.offset; |
2150 | off1 = mac_control->rings[ring_no].rx_curr_get_info.offset; | 2193 | off1 = mac_control->rings[ring_no].rx_curr_get_info.offset; |
2151 | #ifndef CONFIG_2BUFF_MODE | ||
2152 | offset = block_no * (MAX_RXDS_PER_BLOCK + 1) + off; | ||
2153 | offset1 = block_no1 * (MAX_RXDS_PER_BLOCK + 1) + off1; | ||
2154 | #else | ||
2155 | offset = block_no * (MAX_RXDS_PER_BLOCK) + off; | ||
2156 | offset1 = block_no1 * (MAX_RXDS_PER_BLOCK) + off1; | ||
2157 | #endif | ||
2158 | 2194 | ||
2159 | rxdp = mac_control->rings[ring_no].rx_blocks[block_no]. | 2195 | rxdp = mac_control->rings[ring_no]. |
2160 | block_virt_addr + off; | 2196 | rx_blocks[block_no].rxds[off].virt_addr; |
2161 | if ((offset == offset1) && (rxdp->Host_Control)) { | 2197 | |
2162 | DBG_PRINT(INTR_DBG, "%s: Get and Put", dev->name); | 2198 | if ((block_no == block_no1) && (off == off1) && |
2199 | (rxdp->Host_Control)) { | ||
2200 | DBG_PRINT(INTR_DBG, "%s: Get and Put", | ||
2201 | dev->name); | ||
2163 | DBG_PRINT(INTR_DBG, " info equated\n"); | 2202 | DBG_PRINT(INTR_DBG, " info equated\n"); |
2164 | goto end; | 2203 | goto end; |
2165 | } | 2204 | } |
2166 | #ifndef CONFIG_2BUFF_MODE | 2205 | if (off && (off == rxd_count[nic->rxd_mode])) { |
2167 | if (rxdp->Control_1 == END_OF_BLOCK) { | ||
2168 | mac_control->rings[ring_no].rx_curr_put_info. | 2206 | mac_control->rings[ring_no].rx_curr_put_info. |
2169 | block_index++; | 2207 | block_index++; |
2208 | if (mac_control->rings[ring_no].rx_curr_put_info. | ||
2209 | block_index == mac_control->rings[ring_no]. | ||
2210 | block_count) | ||
2211 | mac_control->rings[ring_no].rx_curr_put_info. | ||
2212 | block_index = 0; | ||
2213 | block_no = mac_control->rings[ring_no]. | ||
2214 | rx_curr_put_info.block_index; | ||
2215 | if (off == rxd_count[nic->rxd_mode]) | ||
2216 | off = 0; | ||
2170 | mac_control->rings[ring_no].rx_curr_put_info. | 2217 | mac_control->rings[ring_no].rx_curr_put_info. |
2171 | block_index %= mac_control->rings[ring_no].block_count; | 2218 | offset = off; |
2172 | block_no = mac_control->rings[ring_no].rx_curr_put_info. | 2219 | rxdp = mac_control->rings[ring_no]. |
2173 | block_index; | 2220 | rx_blocks[block_no].block_virt_addr; |
2174 | off++; | ||
2175 | off %= (MAX_RXDS_PER_BLOCK + 1); | ||
2176 | mac_control->rings[ring_no].rx_curr_put_info.offset = | ||
2177 | off; | ||
2178 | rxdp = (RxD_t *) ((unsigned long) rxdp->Control_2); | ||
2179 | DBG_PRINT(INTR_DBG, "%s: Next block at: %p\n", | 2221 | DBG_PRINT(INTR_DBG, "%s: Next block at: %p\n", |
2180 | dev->name, rxdp); | 2222 | dev->name, rxdp); |
2181 | } | 2223 | } |
2182 | #ifndef CONFIG_S2IO_NAPI | 2224 | #ifndef CONFIG_S2IO_NAPI |
2183 | spin_lock_irqsave(&nic->put_lock, flags); | 2225 | spin_lock_irqsave(&nic->put_lock, flags); |
2184 | mac_control->rings[ring_no].put_pos = | 2226 | mac_control->rings[ring_no].put_pos = |
2185 | (block_no * (MAX_RXDS_PER_BLOCK + 1)) + off; | 2227 | (block_no * (rxd_count[nic->rxd_mode] + 1)) + off; |
2186 | spin_unlock_irqrestore(&nic->put_lock, flags); | 2228 | spin_unlock_irqrestore(&nic->put_lock, flags); |
2187 | #endif | 2229 | #endif |
2188 | #else | 2230 | if ((rxdp->Control_1 & RXD_OWN_XENA) && |
2189 | if (rxdp->Host_Control == END_OF_BLOCK) { | 2231 | ((nic->rxd_mode >= RXD_MODE_3A) && |
2232 | (rxdp->Control_2 & BIT(0)))) { | ||
2190 | mac_control->rings[ring_no].rx_curr_put_info. | 2233 | mac_control->rings[ring_no].rx_curr_put_info. |
2191 | block_index++; | 2234 | offset = off; |
2192 | mac_control->rings[ring_no].rx_curr_put_info.block_index | ||
2193 | %= mac_control->rings[ring_no].block_count; | ||
2194 | block_no = mac_control->rings[ring_no].rx_curr_put_info | ||
2195 | .block_index; | ||
2196 | off = 0; | ||
2197 | DBG_PRINT(INTR_DBG, "%s: block%d at: 0x%llx\n", | ||
2198 | dev->name, block_no, | ||
2199 | (unsigned long long) rxdp->Control_1); | ||
2200 | mac_control->rings[ring_no].rx_curr_put_info.offset = | ||
2201 | off; | ||
2202 | rxdp = mac_control->rings[ring_no].rx_blocks[block_no]. | ||
2203 | block_virt_addr; | ||
2204 | } | ||
2205 | #ifndef CONFIG_S2IO_NAPI | ||
2206 | spin_lock_irqsave(&nic->put_lock, flags); | ||
2207 | mac_control->rings[ring_no].put_pos = (block_no * | ||
2208 | (MAX_RXDS_PER_BLOCK + 1)) + off; | ||
2209 | spin_unlock_irqrestore(&nic->put_lock, flags); | ||
2210 | #endif | ||
2211 | #endif | ||
2212 | |||
2213 | #ifndef CONFIG_2BUFF_MODE | ||
2214 | if (rxdp->Control_1 & RXD_OWN_XENA) | ||
2215 | #else | ||
2216 | if (rxdp->Control_2 & BIT(0)) | ||
2217 | #endif | ||
2218 | { | ||
2219 | mac_control->rings[ring_no].rx_curr_put_info. | ||
2220 | offset = off; | ||
2221 | goto end; | 2235 | goto end; |
2222 | } | 2236 | } |
2223 | #ifdef CONFIG_2BUFF_MODE | 2237 | /* calculate size of skb based on ring mode */ |
2224 | /* | 2238 | size = dev->mtu + HEADER_ETHERNET_II_802_3_SIZE + |
2225 | * RxDs Spanning cache lines will be replenished only | 2239 | HEADER_802_2_SIZE + HEADER_SNAP_SIZE; |
2226 | * if the succeeding RxD is also owned by Host. It | 2240 | if (nic->rxd_mode == RXD_MODE_1) |
2227 | * will always be the ((8*i)+3) and ((8*i)+6) | 2241 | size += NET_IP_ALIGN; |
2228 | * descriptors for the 48 byte descriptor. The offending | 2242 | else if (nic->rxd_mode == RXD_MODE_3B) |
2229 | * decsriptor is of-course the 3rd descriptor. | 2243 | size = dev->mtu + ALIGN_SIZE + BUF0_LEN + 4; |
2230 | */ | 2244 | else |
2231 | rxdpphys = mac_control->rings[ring_no].rx_blocks[block_no]. | 2245 | size = l3l4hdr_size + ALIGN_SIZE + BUF0_LEN + 4; |
2232 | block_dma_addr + (off * sizeof(RxD_t)); | ||
2233 | if (((u64) (rxdpphys)) % 128 > 80) { | ||
2234 | rxdpnext = mac_control->rings[ring_no].rx_blocks[block_no]. | ||
2235 | block_virt_addr + (off + 1); | ||
2236 | if (rxdpnext->Host_Control == END_OF_BLOCK) { | ||
2237 | nextblk = (block_no + 1) % | ||
2238 | (mac_control->rings[ring_no].block_count); | ||
2239 | rxdpnext = mac_control->rings[ring_no].rx_blocks | ||
2240 | [nextblk].block_virt_addr; | ||
2241 | } | ||
2242 | if (rxdpnext->Control_2 & BIT(0)) | ||
2243 | goto end; | ||
2244 | } | ||
2245 | #endif | ||
2246 | 2246 | ||
2247 | #ifndef CONFIG_2BUFF_MODE | 2247 | /* allocate skb */ |
2248 | skb = dev_alloc_skb(size + NET_IP_ALIGN); | 2248 | skb = dev_alloc_skb(size); |
2249 | #else | 2249 | if(!skb) { |
2250 | skb = dev_alloc_skb(dev->mtu + ALIGN_SIZE + BUF0_LEN + 4); | ||
2251 | #endif | ||
2252 | if (!skb) { | ||
2253 | DBG_PRINT(ERR_DBG, "%s: Out of ", dev->name); | 2250 | DBG_PRINT(ERR_DBG, "%s: Out of ", dev->name); |
2254 | DBG_PRINT(ERR_DBG, "memory to allocate SKBs\n"); | 2251 | DBG_PRINT(ERR_DBG, "memory to allocate SKBs\n"); |
2255 | if (first_rxdp) { | 2252 | if (first_rxdp) { |
2256 | wmb(); | 2253 | wmb(); |
2257 | first_rxdp->Control_1 |= RXD_OWN_XENA; | 2254 | first_rxdp->Control_1 |= RXD_OWN_XENA; |
2258 | } | 2255 | } |
2259 | return -ENOMEM; | 2256 | return -ENOMEM ; |
2257 | } | ||
2258 | if (nic->rxd_mode == RXD_MODE_1) { | ||
2259 | /* 1 buffer mode - normal operation mode */ | ||
2260 | memset(rxdp, 0, sizeof(RxD1_t)); | ||
2261 | skb_reserve(skb, NET_IP_ALIGN); | ||
2262 | ((RxD1_t*)rxdp)->Buffer0_ptr = pci_map_single | ||
2263 | (nic->pdev, skb->data, size, PCI_DMA_FROMDEVICE); | ||
2264 | rxdp->Control_2 &= (~MASK_BUFFER0_SIZE_1); | ||
2265 | rxdp->Control_2 |= SET_BUFFER0_SIZE_1(size); | ||
2266 | |||
2267 | } else if (nic->rxd_mode >= RXD_MODE_3A) { | ||
2268 | /* | ||
2269 | * 2 or 3 buffer mode - | ||
2270 | * Both 2 buffer mode and 3 buffer mode provides 128 | ||
2271 | * byte aligned receive buffers. | ||
2272 | * | ||
2273 | * 3 buffer mode provides header separation where in | ||
2274 | * skb->data will have L3/L4 headers where as | ||
2275 | * skb_shinfo(skb)->frag_list will have the L4 data | ||
2276 | * payload | ||
2277 | */ | ||
2278 | |||
2279 | memset(rxdp, 0, sizeof(RxD3_t)); | ||
2280 | ba = &mac_control->rings[ring_no].ba[block_no][off]; | ||
2281 | skb_reserve(skb, BUF0_LEN); | ||
2282 | tmp = (u64)(unsigned long) skb->data; | ||
2283 | tmp += ALIGN_SIZE; | ||
2284 | tmp &= ~ALIGN_SIZE; | ||
2285 | skb->data = (void *) (unsigned long)tmp; | ||
2286 | skb->tail = (void *) (unsigned long)tmp; | ||
2287 | |||
2288 | ((RxD3_t*)rxdp)->Buffer0_ptr = | ||
2289 | pci_map_single(nic->pdev, ba->ba_0, BUF0_LEN, | ||
2290 | PCI_DMA_FROMDEVICE); | ||
2291 | rxdp->Control_2 = SET_BUFFER0_SIZE_3(BUF0_LEN); | ||
2292 | if (nic->rxd_mode == RXD_MODE_3B) { | ||
2293 | /* Two buffer mode */ | ||
2294 | |||
2295 | /* | ||
2296 | * Buffer2 will have L3/L4 header plus | ||
2297 | * L4 payload | ||
2298 | */ | ||
2299 | ((RxD3_t*)rxdp)->Buffer2_ptr = pci_map_single | ||
2300 | (nic->pdev, skb->data, dev->mtu + 4, | ||
2301 | PCI_DMA_FROMDEVICE); | ||
2302 | |||
2303 | /* Buffer-1 will be dummy buffer not used */ | ||
2304 | ((RxD3_t*)rxdp)->Buffer1_ptr = | ||
2305 | pci_map_single(nic->pdev, ba->ba_1, BUF1_LEN, | ||
2306 | PCI_DMA_FROMDEVICE); | ||
2307 | rxdp->Control_2 |= SET_BUFFER1_SIZE_3(1); | ||
2308 | rxdp->Control_2 |= SET_BUFFER2_SIZE_3 | ||
2309 | (dev->mtu + 4); | ||
2310 | } else { | ||
2311 | /* 3 buffer mode */ | ||
2312 | if (fill_rxd_3buf(nic, rxdp, skb) == -ENOMEM) { | ||
2313 | dev_kfree_skb_irq(skb); | ||
2314 | if (first_rxdp) { | ||
2315 | wmb(); | ||
2316 | first_rxdp->Control_1 |= | ||
2317 | RXD_OWN_XENA; | ||
2318 | } | ||
2319 | return -ENOMEM ; | ||
2320 | } | ||
2321 | } | ||
2322 | rxdp->Control_2 |= BIT(0); | ||
2260 | } | 2323 | } |
2261 | #ifndef CONFIG_2BUFF_MODE | ||
2262 | skb_reserve(skb, NET_IP_ALIGN); | ||
2263 | memset(rxdp, 0, sizeof(RxD_t)); | ||
2264 | rxdp->Buffer0_ptr = pci_map_single | ||
2265 | (nic->pdev, skb->data, size, PCI_DMA_FROMDEVICE); | ||
2266 | rxdp->Control_2 &= (~MASK_BUFFER0_SIZE); | ||
2267 | rxdp->Control_2 |= SET_BUFFER0_SIZE(size); | ||
2268 | rxdp->Host_Control = (unsigned long) (skb); | 2324 | rxdp->Host_Control = (unsigned long) (skb); |
2269 | if (alloc_tab & ((1 << rxsync_frequency) - 1)) | 2325 | if (alloc_tab & ((1 << rxsync_frequency) - 1)) |
2270 | rxdp->Control_1 |= RXD_OWN_XENA; | 2326 | rxdp->Control_1 |= RXD_OWN_XENA; |
2271 | off++; | 2327 | off++; |
2272 | off %= (MAX_RXDS_PER_BLOCK + 1); | 2328 | if (off == (rxd_count[nic->rxd_mode] + 1)) |
2273 | mac_control->rings[ring_no].rx_curr_put_info.offset = off; | 2329 | off = 0; |
2274 | #else | ||
2275 | ba = &mac_control->rings[ring_no].ba[block_no][off]; | ||
2276 | skb_reserve(skb, BUF0_LEN); | ||
2277 | tmp = ((unsigned long) skb->data & ALIGN_SIZE); | ||
2278 | if (tmp) | ||
2279 | skb_reserve(skb, (ALIGN_SIZE + 1) - tmp); | ||
2280 | |||
2281 | memset(rxdp, 0, sizeof(RxD_t)); | ||
2282 | rxdp->Buffer2_ptr = pci_map_single | ||
2283 | (nic->pdev, skb->data, dev->mtu + BUF0_LEN + 4, | ||
2284 | PCI_DMA_FROMDEVICE); | ||
2285 | rxdp->Buffer0_ptr = | ||
2286 | pci_map_single(nic->pdev, ba->ba_0, BUF0_LEN, | ||
2287 | PCI_DMA_FROMDEVICE); | ||
2288 | rxdp->Buffer1_ptr = | ||
2289 | pci_map_single(nic->pdev, ba->ba_1, BUF1_LEN, | ||
2290 | PCI_DMA_FROMDEVICE); | ||
2291 | |||
2292 | rxdp->Control_2 = SET_BUFFER2_SIZE(dev->mtu + 4); | ||
2293 | rxdp->Control_2 |= SET_BUFFER0_SIZE(BUF0_LEN); | ||
2294 | rxdp->Control_2 |= SET_BUFFER1_SIZE(1); /* dummy. */ | ||
2295 | rxdp->Control_2 |= BIT(0); /* Set Buffer_Empty bit. */ | ||
2296 | rxdp->Host_Control = (u64) ((unsigned long) (skb)); | ||
2297 | if (alloc_tab & ((1 << rxsync_frequency) - 1)) | ||
2298 | rxdp->Control_1 |= RXD_OWN_XENA; | ||
2299 | off++; | ||
2300 | mac_control->rings[ring_no].rx_curr_put_info.offset = off; | 2330 | mac_control->rings[ring_no].rx_curr_put_info.offset = off; |
2301 | #endif | ||
2302 | rxdp->Control_2 |= SET_RXD_MARKER; | ||
2303 | 2331 | ||
2332 | rxdp->Control_2 |= SET_RXD_MARKER; | ||
2304 | if (!(alloc_tab & ((1 << rxsync_frequency) - 1))) { | 2333 | if (!(alloc_tab & ((1 << rxsync_frequency) - 1))) { |
2305 | if (first_rxdp) { | 2334 | if (first_rxdp) { |
2306 | wmb(); | 2335 | wmb(); |
@@ -2325,6 +2354,67 @@ int fill_rx_buffers(struct s2io_nic *nic, int ring_no) | |||
2325 | return SUCCESS; | 2354 | return SUCCESS; |
2326 | } | 2355 | } |
2327 | 2356 | ||
2357 | static void free_rxd_blk(struct s2io_nic *sp, int ring_no, int blk) | ||
2358 | { | ||
2359 | struct net_device *dev = sp->dev; | ||
2360 | int j; | ||
2361 | struct sk_buff *skb; | ||
2362 | RxD_t *rxdp; | ||
2363 | mac_info_t *mac_control; | ||
2364 | buffAdd_t *ba; | ||
2365 | |||
2366 | mac_control = &sp->mac_control; | ||
2367 | for (j = 0 ; j < rxd_count[sp->rxd_mode]; j++) { | ||
2368 | rxdp = mac_control->rings[ring_no]. | ||
2369 | rx_blocks[blk].rxds[j].virt_addr; | ||
2370 | skb = (struct sk_buff *) | ||
2371 | ((unsigned long) rxdp->Host_Control); | ||
2372 | if (!skb) { | ||
2373 | continue; | ||
2374 | } | ||
2375 | if (sp->rxd_mode == RXD_MODE_1) { | ||
2376 | pci_unmap_single(sp->pdev, (dma_addr_t) | ||
2377 | ((RxD1_t*)rxdp)->Buffer0_ptr, | ||
2378 | dev->mtu + | ||
2379 | HEADER_ETHERNET_II_802_3_SIZE | ||
2380 | + HEADER_802_2_SIZE + | ||
2381 | HEADER_SNAP_SIZE, | ||
2382 | PCI_DMA_FROMDEVICE); | ||
2383 | memset(rxdp, 0, sizeof(RxD1_t)); | ||
2384 | } else if(sp->rxd_mode == RXD_MODE_3B) { | ||
2385 | ba = &mac_control->rings[ring_no]. | ||
2386 | ba[blk][j]; | ||
2387 | pci_unmap_single(sp->pdev, (dma_addr_t) | ||
2388 | ((RxD3_t*)rxdp)->Buffer0_ptr, | ||
2389 | BUF0_LEN, | ||
2390 | PCI_DMA_FROMDEVICE); | ||
2391 | pci_unmap_single(sp->pdev, (dma_addr_t) | ||
2392 | ((RxD3_t*)rxdp)->Buffer1_ptr, | ||
2393 | BUF1_LEN, | ||
2394 | PCI_DMA_FROMDEVICE); | ||
2395 | pci_unmap_single(sp->pdev, (dma_addr_t) | ||
2396 | ((RxD3_t*)rxdp)->Buffer2_ptr, | ||
2397 | dev->mtu + 4, | ||
2398 | PCI_DMA_FROMDEVICE); | ||
2399 | memset(rxdp, 0, sizeof(RxD3_t)); | ||
2400 | } else { | ||
2401 | pci_unmap_single(sp->pdev, (dma_addr_t) | ||
2402 | ((RxD3_t*)rxdp)->Buffer0_ptr, BUF0_LEN, | ||
2403 | PCI_DMA_FROMDEVICE); | ||
2404 | pci_unmap_single(sp->pdev, (dma_addr_t) | ||
2405 | ((RxD3_t*)rxdp)->Buffer1_ptr, | ||
2406 | l3l4hdr_size + 4, | ||
2407 | PCI_DMA_FROMDEVICE); | ||
2408 | pci_unmap_single(sp->pdev, (dma_addr_t) | ||
2409 | ((RxD3_t*)rxdp)->Buffer2_ptr, dev->mtu, | ||
2410 | PCI_DMA_FROMDEVICE); | ||
2411 | memset(rxdp, 0, sizeof(RxD3_t)); | ||
2412 | } | ||
2413 | dev_kfree_skb(skb); | ||
2414 | atomic_dec(&sp->rx_bufs_left[ring_no]); | ||
2415 | } | ||
2416 | } | ||
2417 | |||
2328 | /** | 2418 | /** |
2329 | * free_rx_buffers - Frees all Rx buffers | 2419 | * free_rx_buffers - Frees all Rx buffers |
2330 | * @sp: device private variable. | 2420 | * @sp: device private variable. |
@@ -2337,77 +2427,17 @@ int fill_rx_buffers(struct s2io_nic *nic, int ring_no) | |||
2337 | static void free_rx_buffers(struct s2io_nic *sp) | 2427 | static void free_rx_buffers(struct s2io_nic *sp) |
2338 | { | 2428 | { |
2339 | struct net_device *dev = sp->dev; | 2429 | struct net_device *dev = sp->dev; |
2340 | int i, j, blk = 0, off, buf_cnt = 0; | 2430 | int i, blk = 0, buf_cnt = 0; |
2341 | RxD_t *rxdp; | ||
2342 | struct sk_buff *skb; | ||
2343 | mac_info_t *mac_control; | 2431 | mac_info_t *mac_control; |
2344 | struct config_param *config; | 2432 | struct config_param *config; |
2345 | #ifdef CONFIG_2BUFF_MODE | ||
2346 | buffAdd_t *ba; | ||
2347 | #endif | ||
2348 | 2433 | ||
2349 | mac_control = &sp->mac_control; | 2434 | mac_control = &sp->mac_control; |
2350 | config = &sp->config; | 2435 | config = &sp->config; |
2351 | 2436 | ||
2352 | for (i = 0; i < config->rx_ring_num; i++) { | 2437 | for (i = 0; i < config->rx_ring_num; i++) { |
2353 | for (j = 0, blk = 0; j < config->rx_cfg[i].num_rxd; j++) { | 2438 | for (blk = 0; blk < rx_ring_sz[i]; blk++) |
2354 | off = j % (MAX_RXDS_PER_BLOCK + 1); | 2439 | free_rxd_blk(sp,i,blk); |
2355 | rxdp = mac_control->rings[i].rx_blocks[blk]. | ||
2356 | block_virt_addr + off; | ||
2357 | |||
2358 | #ifndef CONFIG_2BUFF_MODE | ||
2359 | if (rxdp->Control_1 == END_OF_BLOCK) { | ||
2360 | rxdp = | ||
2361 | (RxD_t *) ((unsigned long) rxdp-> | ||
2362 | Control_2); | ||
2363 | j++; | ||
2364 | blk++; | ||
2365 | } | ||
2366 | #else | ||
2367 | if (rxdp->Host_Control == END_OF_BLOCK) { | ||
2368 | blk++; | ||
2369 | continue; | ||
2370 | } | ||
2371 | #endif | ||
2372 | 2440 | ||
2373 | if (!(rxdp->Control_1 & RXD_OWN_XENA)) { | ||
2374 | memset(rxdp, 0, sizeof(RxD_t)); | ||
2375 | continue; | ||
2376 | } | ||
2377 | |||
2378 | skb = | ||
2379 | (struct sk_buff *) ((unsigned long) rxdp-> | ||
2380 | Host_Control); | ||
2381 | if (skb) { | ||
2382 | #ifndef CONFIG_2BUFF_MODE | ||
2383 | pci_unmap_single(sp->pdev, (dma_addr_t) | ||
2384 | rxdp->Buffer0_ptr, | ||
2385 | dev->mtu + | ||
2386 | HEADER_ETHERNET_II_802_3_SIZE | ||
2387 | + HEADER_802_2_SIZE + | ||
2388 | HEADER_SNAP_SIZE, | ||
2389 | PCI_DMA_FROMDEVICE); | ||
2390 | #else | ||
2391 | ba = &mac_control->rings[i].ba[blk][off]; | ||
2392 | pci_unmap_single(sp->pdev, (dma_addr_t) | ||
2393 | rxdp->Buffer0_ptr, | ||
2394 | BUF0_LEN, | ||
2395 | PCI_DMA_FROMDEVICE); | ||
2396 | pci_unmap_single(sp->pdev, (dma_addr_t) | ||
2397 | rxdp->Buffer1_ptr, | ||
2398 | BUF1_LEN, | ||
2399 | PCI_DMA_FROMDEVICE); | ||
2400 | pci_unmap_single(sp->pdev, (dma_addr_t) | ||
2401 | rxdp->Buffer2_ptr, | ||
2402 | dev->mtu + BUF0_LEN + 4, | ||
2403 | PCI_DMA_FROMDEVICE); | ||
2404 | #endif | ||
2405 | dev_kfree_skb(skb); | ||
2406 | atomic_dec(&sp->rx_bufs_left[i]); | ||
2407 | buf_cnt++; | ||
2408 | } | ||
2409 | memset(rxdp, 0, sizeof(RxD_t)); | ||
2410 | } | ||
2411 | mac_control->rings[i].rx_curr_put_info.block_index = 0; | 2441 | mac_control->rings[i].rx_curr_put_info.block_index = 0; |
2412 | mac_control->rings[i].rx_curr_get_info.block_index = 0; | 2442 | mac_control->rings[i].rx_curr_get_info.block_index = 0; |
2413 | mac_control->rings[i].rx_curr_put_info.offset = 0; | 2443 | mac_control->rings[i].rx_curr_put_info.offset = 0; |
@@ -2513,7 +2543,7 @@ static void rx_intr_handler(ring_info_t *ring_data) | |||
2513 | { | 2543 | { |
2514 | nic_t *nic = ring_data->nic; | 2544 | nic_t *nic = ring_data->nic; |
2515 | struct net_device *dev = (struct net_device *) nic->dev; | 2545 | struct net_device *dev = (struct net_device *) nic->dev; |
2516 | int get_block, get_offset, put_block, put_offset, ring_bufs; | 2546 | int get_block, put_block, put_offset; |
2517 | rx_curr_get_info_t get_info, put_info; | 2547 | rx_curr_get_info_t get_info, put_info; |
2518 | RxD_t *rxdp; | 2548 | RxD_t *rxdp; |
2519 | struct sk_buff *skb; | 2549 | struct sk_buff *skb; |
@@ -2532,21 +2562,22 @@ static void rx_intr_handler(ring_info_t *ring_data) | |||
2532 | get_block = get_info.block_index; | 2562 | get_block = get_info.block_index; |
2533 | put_info = ring_data->rx_curr_put_info; | 2563 | put_info = ring_data->rx_curr_put_info; |
2534 | put_block = put_info.block_index; | 2564 | put_block = put_info.block_index; |
2535 | ring_bufs = get_info.ring_len+1; | 2565 | rxdp = ring_data->rx_blocks[get_block].rxds[get_info.offset].virt_addr; |
2536 | rxdp = ring_data->rx_blocks[get_block].block_virt_addr + | ||
2537 | get_info.offset; | ||
2538 | get_offset = (get_block * (MAX_RXDS_PER_BLOCK + 1)) + | ||
2539 | get_info.offset; | ||
2540 | #ifndef CONFIG_S2IO_NAPI | 2566 | #ifndef CONFIG_S2IO_NAPI |
2541 | spin_lock(&nic->put_lock); | 2567 | spin_lock(&nic->put_lock); |
2542 | put_offset = ring_data->put_pos; | 2568 | put_offset = ring_data->put_pos; |
2543 | spin_unlock(&nic->put_lock); | 2569 | spin_unlock(&nic->put_lock); |
2544 | #else | 2570 | #else |
2545 | put_offset = (put_block * (MAX_RXDS_PER_BLOCK + 1)) + | 2571 | put_offset = (put_block * (rxd_count[nic->rxd_mode] + 1)) + |
2546 | put_info.offset; | 2572 | put_info.offset; |
2547 | #endif | 2573 | #endif |
2548 | while (RXD_IS_UP2DT(rxdp) && | 2574 | while (RXD_IS_UP2DT(rxdp)) { |
2549 | (((get_offset + 1) % ring_bufs) != put_offset)) { | 2575 | /* If your are next to put index then it's FIFO full condition */ |
2576 | if ((get_block == put_block) && | ||
2577 | (get_info.offset + 1) == put_info.offset) { | ||
2578 | DBG_PRINT(ERR_DBG, "%s: Ring Full\n",dev->name); | ||
2579 | break; | ||
2580 | } | ||
2550 | skb = (struct sk_buff *) ((unsigned long)rxdp->Host_Control); | 2581 | skb = (struct sk_buff *) ((unsigned long)rxdp->Host_Control); |
2551 | if (skb == NULL) { | 2582 | if (skb == NULL) { |
2552 | DBG_PRINT(ERR_DBG, "%s: The skb is ", | 2583 | DBG_PRINT(ERR_DBG, "%s: The skb is ", |
@@ -2555,46 +2586,52 @@ static void rx_intr_handler(ring_info_t *ring_data) | |||
2555 | spin_unlock(&nic->rx_lock); | 2586 | spin_unlock(&nic->rx_lock); |
2556 | return; | 2587 | return; |
2557 | } | 2588 | } |
2558 | #ifndef CONFIG_2BUFF_MODE | 2589 | if (nic->rxd_mode == RXD_MODE_1) { |
2559 | pci_unmap_single(nic->pdev, (dma_addr_t) | 2590 | pci_unmap_single(nic->pdev, (dma_addr_t) |
2560 | rxdp->Buffer0_ptr, | 2591 | ((RxD1_t*)rxdp)->Buffer0_ptr, |
2561 | dev->mtu + | 2592 | dev->mtu + |
2562 | HEADER_ETHERNET_II_802_3_SIZE + | 2593 | HEADER_ETHERNET_II_802_3_SIZE + |
2563 | HEADER_802_2_SIZE + | 2594 | HEADER_802_2_SIZE + |
2564 | HEADER_SNAP_SIZE, | 2595 | HEADER_SNAP_SIZE, |
2565 | PCI_DMA_FROMDEVICE); | 2596 | PCI_DMA_FROMDEVICE); |
2566 | #else | 2597 | } else if (nic->rxd_mode == RXD_MODE_3B) { |
2567 | pci_unmap_single(nic->pdev, (dma_addr_t) | 2598 | pci_unmap_single(nic->pdev, (dma_addr_t) |
2568 | rxdp->Buffer0_ptr, | 2599 | ((RxD3_t*)rxdp)->Buffer0_ptr, |
2569 | BUF0_LEN, PCI_DMA_FROMDEVICE); | 2600 | BUF0_LEN, PCI_DMA_FROMDEVICE); |
2570 | pci_unmap_single(nic->pdev, (dma_addr_t) | 2601 | pci_unmap_single(nic->pdev, (dma_addr_t) |
2571 | rxdp->Buffer1_ptr, | 2602 | ((RxD3_t*)rxdp)->Buffer1_ptr, |
2572 | BUF1_LEN, PCI_DMA_FROMDEVICE); | 2603 | BUF1_LEN, PCI_DMA_FROMDEVICE); |
2573 | pci_unmap_single(nic->pdev, (dma_addr_t) | 2604 | pci_unmap_single(nic->pdev, (dma_addr_t) |
2574 | rxdp->Buffer2_ptr, | 2605 | ((RxD3_t*)rxdp)->Buffer2_ptr, |
2575 | dev->mtu + BUF0_LEN + 4, | 2606 | dev->mtu + 4, |
2576 | PCI_DMA_FROMDEVICE); | 2607 | PCI_DMA_FROMDEVICE); |
2577 | #endif | 2608 | } else { |
2609 | pci_unmap_single(nic->pdev, (dma_addr_t) | ||
2610 | ((RxD3_t*)rxdp)->Buffer0_ptr, BUF0_LEN, | ||
2611 | PCI_DMA_FROMDEVICE); | ||
2612 | pci_unmap_single(nic->pdev, (dma_addr_t) | ||
2613 | ((RxD3_t*)rxdp)->Buffer1_ptr, | ||
2614 | l3l4hdr_size + 4, | ||
2615 | PCI_DMA_FROMDEVICE); | ||
2616 | pci_unmap_single(nic->pdev, (dma_addr_t) | ||
2617 | ((RxD3_t*)rxdp)->Buffer2_ptr, | ||
2618 | dev->mtu, PCI_DMA_FROMDEVICE); | ||
2619 | } | ||
2578 | rx_osm_handler(ring_data, rxdp); | 2620 | rx_osm_handler(ring_data, rxdp); |
2579 | get_info.offset++; | 2621 | get_info.offset++; |
2580 | ring_data->rx_curr_get_info.offset = | 2622 | ring_data->rx_curr_get_info.offset = get_info.offset; |
2581 | get_info.offset; | 2623 | rxdp = ring_data->rx_blocks[get_block]. |
2582 | rxdp = ring_data->rx_blocks[get_block].block_virt_addr + | 2624 | rxds[get_info.offset].virt_addr; |
2583 | get_info.offset; | 2625 | if (get_info.offset == rxd_count[nic->rxd_mode]) { |
2584 | if (get_info.offset && | ||
2585 | (!(get_info.offset % MAX_RXDS_PER_BLOCK))) { | ||
2586 | get_info.offset = 0; | 2626 | get_info.offset = 0; |
2587 | ring_data->rx_curr_get_info.offset | 2627 | ring_data->rx_curr_get_info.offset = get_info.offset; |
2588 | = get_info.offset; | ||
2589 | get_block++; | 2628 | get_block++; |
2590 | get_block %= ring_data->block_count; | 2629 | if (get_block == ring_data->block_count) |
2591 | ring_data->rx_curr_get_info.block_index | 2630 | get_block = 0; |
2592 | = get_block; | 2631 | ring_data->rx_curr_get_info.block_index = get_block; |
2593 | rxdp = ring_data->rx_blocks[get_block].block_virt_addr; | 2632 | rxdp = ring_data->rx_blocks[get_block].block_virt_addr; |
2594 | } | 2633 | } |
2595 | 2634 | ||
2596 | get_offset = (get_block * (MAX_RXDS_PER_BLOCK + 1)) + | ||
2597 | get_info.offset; | ||
2598 | #ifdef CONFIG_S2IO_NAPI | 2635 | #ifdef CONFIG_S2IO_NAPI |
2599 | nic->pkts_to_process -= 1; | 2636 | nic->pkts_to_process -= 1; |
2600 | if (!nic->pkts_to_process) | 2637 | if (!nic->pkts_to_process) |
@@ -3044,7 +3081,7 @@ int s2io_set_swapper(nic_t * sp) | |||
3044 | 3081 | ||
3045 | int wait_for_msix_trans(nic_t *nic, int i) | 3082 | int wait_for_msix_trans(nic_t *nic, int i) |
3046 | { | 3083 | { |
3047 | XENA_dev_config_t __iomem *bar0 = nic->bar0; | 3084 | XENA_dev_config_t *bar0 = (XENA_dev_config_t *) nic->bar0; |
3048 | u64 val64; | 3085 | u64 val64; |
3049 | int ret = 0, cnt = 0; | 3086 | int ret = 0, cnt = 0; |
3050 | 3087 | ||
@@ -3065,7 +3102,7 @@ int wait_for_msix_trans(nic_t *nic, int i) | |||
3065 | 3102 | ||
3066 | void restore_xmsi_data(nic_t *nic) | 3103 | void restore_xmsi_data(nic_t *nic) |
3067 | { | 3104 | { |
3068 | XENA_dev_config_t __iomem *bar0 = nic->bar0; | 3105 | XENA_dev_config_t *bar0 = (XENA_dev_config_t *) nic->bar0; |
3069 | u64 val64; | 3106 | u64 val64; |
3070 | int i; | 3107 | int i; |
3071 | 3108 | ||
@@ -3083,7 +3120,7 @@ void restore_xmsi_data(nic_t *nic) | |||
3083 | 3120 | ||
3084 | void store_xmsi_data(nic_t *nic) | 3121 | void store_xmsi_data(nic_t *nic) |
3085 | { | 3122 | { |
3086 | XENA_dev_config_t __iomem *bar0 = nic->bar0; | 3123 | XENA_dev_config_t *bar0 = (XENA_dev_config_t *) nic->bar0; |
3087 | u64 val64, addr, data; | 3124 | u64 val64, addr, data; |
3088 | int i; | 3125 | int i; |
3089 | 3126 | ||
@@ -3106,7 +3143,7 @@ void store_xmsi_data(nic_t *nic) | |||
3106 | 3143 | ||
3107 | int s2io_enable_msi(nic_t *nic) | 3144 | int s2io_enable_msi(nic_t *nic) |
3108 | { | 3145 | { |
3109 | XENA_dev_config_t __iomem *bar0 = nic->bar0; | 3146 | XENA_dev_config_t *bar0 = (XENA_dev_config_t *) nic->bar0; |
3110 | u16 msi_ctrl, msg_val; | 3147 | u16 msi_ctrl, msg_val; |
3111 | struct config_param *config = &nic->config; | 3148 | struct config_param *config = &nic->config; |
3112 | struct net_device *dev = nic->dev; | 3149 | struct net_device *dev = nic->dev; |
@@ -3156,7 +3193,7 @@ int s2io_enable_msi(nic_t *nic) | |||
3156 | 3193 | ||
3157 | int s2io_enable_msi_x(nic_t *nic) | 3194 | int s2io_enable_msi_x(nic_t *nic) |
3158 | { | 3195 | { |
3159 | XENA_dev_config_t __iomem *bar0 = nic->bar0; | 3196 | XENA_dev_config_t *bar0 = (XENA_dev_config_t *) nic->bar0; |
3160 | u64 tx_mat, rx_mat; | 3197 | u64 tx_mat, rx_mat; |
3161 | u16 msi_control; /* Temp variable */ | 3198 | u16 msi_control; /* Temp variable */ |
3162 | int ret, i, j, msix_indx = 1; | 3199 | int ret, i, j, msix_indx = 1; |
@@ -5537,16 +5574,7 @@ static int rx_osm_handler(ring_info_t *ring_data, RxD_t * rxdp) | |||
5537 | ((unsigned long) rxdp->Host_Control); | 5574 | ((unsigned long) rxdp->Host_Control); |
5538 | int ring_no = ring_data->ring_no; | 5575 | int ring_no = ring_data->ring_no; |
5539 | u16 l3_csum, l4_csum; | 5576 | u16 l3_csum, l4_csum; |
5540 | #ifdef CONFIG_2BUFF_MODE | 5577 | |
5541 | int buf0_len = RXD_GET_BUFFER0_SIZE(rxdp->Control_2); | ||
5542 | int buf2_len = RXD_GET_BUFFER2_SIZE(rxdp->Control_2); | ||
5543 | int get_block = ring_data->rx_curr_get_info.block_index; | ||
5544 | int get_off = ring_data->rx_curr_get_info.offset; | ||
5545 | buffAdd_t *ba = &ring_data->ba[get_block][get_off]; | ||
5546 | unsigned char *buff; | ||
5547 | #else | ||
5548 | u16 len = (u16) ((RXD_GET_BUFFER0_SIZE(rxdp->Control_2)) >> 48);; | ||
5549 | #endif | ||
5550 | skb->dev = dev; | 5578 | skb->dev = dev; |
5551 | if (rxdp->Control_1 & RXD_T_CODE) { | 5579 | if (rxdp->Control_1 & RXD_T_CODE) { |
5552 | unsigned long long err = rxdp->Control_1 & RXD_T_CODE; | 5580 | unsigned long long err = rxdp->Control_1 & RXD_T_CODE; |
@@ -5563,19 +5591,36 @@ static int rx_osm_handler(ring_info_t *ring_data, RxD_t * rxdp) | |||
5563 | rxdp->Host_Control = 0; | 5591 | rxdp->Host_Control = 0; |
5564 | sp->rx_pkt_count++; | 5592 | sp->rx_pkt_count++; |
5565 | sp->stats.rx_packets++; | 5593 | sp->stats.rx_packets++; |
5566 | #ifndef CONFIG_2BUFF_MODE | 5594 | if (sp->rxd_mode == RXD_MODE_1) { |
5567 | sp->stats.rx_bytes += len; | 5595 | int len = RXD_GET_BUFFER0_SIZE_1(rxdp->Control_2); |
5568 | #else | ||
5569 | sp->stats.rx_bytes += buf0_len + buf2_len; | ||
5570 | #endif | ||
5571 | 5596 | ||
5572 | #ifndef CONFIG_2BUFF_MODE | 5597 | sp->stats.rx_bytes += len; |
5573 | skb_put(skb, len); | 5598 | skb_put(skb, len); |
5574 | #else | 5599 | |
5575 | buff = skb_push(skb, buf0_len); | 5600 | } else if (sp->rxd_mode >= RXD_MODE_3A) { |
5576 | memcpy(buff, ba->ba_0, buf0_len); | 5601 | int get_block = ring_data->rx_curr_get_info.block_index; |
5577 | skb_put(skb, buf2_len); | 5602 | int get_off = ring_data->rx_curr_get_info.offset; |
5578 | #endif | 5603 | int buf0_len = RXD_GET_BUFFER0_SIZE_3(rxdp->Control_2); |
5604 | int buf2_len = RXD_GET_BUFFER2_SIZE_3(rxdp->Control_2); | ||
5605 | unsigned char *buff = skb_push(skb, buf0_len); | ||
5606 | |||
5607 | buffAdd_t *ba = &ring_data->ba[get_block][get_off]; | ||
5608 | sp->stats.rx_bytes += buf0_len + buf2_len; | ||
5609 | memcpy(buff, ba->ba_0, buf0_len); | ||
5610 | |||
5611 | if (sp->rxd_mode == RXD_MODE_3A) { | ||
5612 | int buf1_len = RXD_GET_BUFFER1_SIZE_3(rxdp->Control_2); | ||
5613 | |||
5614 | skb_put(skb, buf1_len); | ||
5615 | skb->len += buf2_len; | ||
5616 | skb->data_len += buf2_len; | ||
5617 | skb->truesize += buf2_len; | ||
5618 | skb_put(skb_shinfo(skb)->frag_list, buf2_len); | ||
5619 | sp->stats.rx_bytes += buf1_len; | ||
5620 | |||
5621 | } else | ||
5622 | skb_put(skb, buf2_len); | ||
5623 | } | ||
5579 | 5624 | ||
5580 | if ((rxdp->Control_1 & TCP_OR_UDP_FRAME) && | 5625 | if ((rxdp->Control_1 & TCP_OR_UDP_FRAME) && |
5581 | (sp->rx_csum)) { | 5626 | (sp->rx_csum)) { |
@@ -5711,6 +5756,7 @@ MODULE_VERSION(DRV_VERSION); | |||
5711 | 5756 | ||
5712 | module_param(tx_fifo_num, int, 0); | 5757 | module_param(tx_fifo_num, int, 0); |
5713 | module_param(rx_ring_num, int, 0); | 5758 | module_param(rx_ring_num, int, 0); |
5759 | module_param(rx_ring_mode, int, 0); | ||
5714 | module_param_array(tx_fifo_len, uint, NULL, 0); | 5760 | module_param_array(tx_fifo_len, uint, NULL, 0); |
5715 | module_param_array(rx_ring_sz, uint, NULL, 0); | 5761 | module_param_array(rx_ring_sz, uint, NULL, 0); |
5716 | module_param_array(rts_frm_len, uint, NULL, 0); | 5762 | module_param_array(rts_frm_len, uint, NULL, 0); |
@@ -5722,6 +5768,7 @@ module_param(shared_splits, int, 0); | |||
5722 | module_param(tmac_util_period, int, 0); | 5768 | module_param(tmac_util_period, int, 0); |
5723 | module_param(rmac_util_period, int, 0); | 5769 | module_param(rmac_util_period, int, 0); |
5724 | module_param(bimodal, bool, 0); | 5770 | module_param(bimodal, bool, 0); |
5771 | module_param(l3l4hdr_size, int , 0); | ||
5725 | #ifndef CONFIG_S2IO_NAPI | 5772 | #ifndef CONFIG_S2IO_NAPI |
5726 | module_param(indicate_max_pkts, int, 0); | 5773 | module_param(indicate_max_pkts, int, 0); |
5727 | #endif | 5774 | #endif |
@@ -5843,6 +5890,13 @@ Defaulting to INTA\n"); | |||
5843 | sp->pdev = pdev; | 5890 | sp->pdev = pdev; |
5844 | sp->high_dma_flag = dma_flag; | 5891 | sp->high_dma_flag = dma_flag; |
5845 | sp->device_enabled_once = FALSE; | 5892 | sp->device_enabled_once = FALSE; |
5893 | if (rx_ring_mode == 1) | ||
5894 | sp->rxd_mode = RXD_MODE_1; | ||
5895 | if (rx_ring_mode == 2) | ||
5896 | sp->rxd_mode = RXD_MODE_3B; | ||
5897 | if (rx_ring_mode == 3) | ||
5898 | sp->rxd_mode = RXD_MODE_3A; | ||
5899 | |||
5846 | sp->intr_type = dev_intr_type; | 5900 | sp->intr_type = dev_intr_type; |
5847 | 5901 | ||
5848 | if ((pdev->device == PCI_DEVICE_ID_HERC_WIN) || | 5902 | if ((pdev->device == PCI_DEVICE_ID_HERC_WIN) || |
@@ -5895,7 +5949,7 @@ Defaulting to INTA\n"); | |||
5895 | config->rx_ring_num = rx_ring_num; | 5949 | config->rx_ring_num = rx_ring_num; |
5896 | for (i = 0; i < MAX_RX_RINGS; i++) { | 5950 | for (i = 0; i < MAX_RX_RINGS; i++) { |
5897 | config->rx_cfg[i].num_rxd = rx_ring_sz[i] * | 5951 | config->rx_cfg[i].num_rxd = rx_ring_sz[i] * |
5898 | (MAX_RXDS_PER_BLOCK + 1); | 5952 | (rxd_count[sp->rxd_mode] + 1); |
5899 | config->rx_cfg[i].ring_priority = i; | 5953 | config->rx_cfg[i].ring_priority = i; |
5900 | } | 5954 | } |
5901 | 5955 | ||
@@ -6090,9 +6144,6 @@ Defaulting to INTA\n"); | |||
6090 | DBG_PRINT(ERR_DBG, "(rev %d), Version %s", | 6144 | DBG_PRINT(ERR_DBG, "(rev %d), Version %s", |
6091 | get_xena_rev_id(sp->pdev), | 6145 | get_xena_rev_id(sp->pdev), |
6092 | s2io_driver_version); | 6146 | s2io_driver_version); |
6093 | #ifdef CONFIG_2BUFF_MODE | ||
6094 | DBG_PRINT(ERR_DBG, ", Buffer mode %d",2); | ||
6095 | #endif | ||
6096 | switch(sp->intr_type) { | 6147 | switch(sp->intr_type) { |
6097 | case INTA: | 6148 | case INTA: |
6098 | DBG_PRINT(ERR_DBG, ", Intr type INTA"); | 6149 | DBG_PRINT(ERR_DBG, ", Intr type INTA"); |
@@ -6125,9 +6176,6 @@ Defaulting to INTA\n"); | |||
6125 | DBG_PRINT(ERR_DBG, "(rev %d), Version %s", | 6176 | DBG_PRINT(ERR_DBG, "(rev %d), Version %s", |
6126 | get_xena_rev_id(sp->pdev), | 6177 | get_xena_rev_id(sp->pdev), |
6127 | s2io_driver_version); | 6178 | s2io_driver_version); |
6128 | #ifdef CONFIG_2BUFF_MODE | ||
6129 | DBG_PRINT(ERR_DBG, ", Buffer mode %d",2); | ||
6130 | #endif | ||
6131 | switch(sp->intr_type) { | 6179 | switch(sp->intr_type) { |
6132 | case INTA: | 6180 | case INTA: |
6133 | DBG_PRINT(ERR_DBG, ", Intr type INTA"); | 6181 | DBG_PRINT(ERR_DBG, ", Intr type INTA"); |
@@ -6148,6 +6196,12 @@ Defaulting to INTA\n"); | |||
6148 | sp->def_mac_addr[0].mac_addr[4], | 6196 | sp->def_mac_addr[0].mac_addr[4], |
6149 | sp->def_mac_addr[0].mac_addr[5]); | 6197 | sp->def_mac_addr[0].mac_addr[5]); |
6150 | } | 6198 | } |
6199 | if (sp->rxd_mode == RXD_MODE_3B) | ||
6200 | DBG_PRINT(ERR_DBG, "%s: 2-Buffer mode support has been " | ||
6201 | "enabled\n",dev->name); | ||
6202 | if (sp->rxd_mode == RXD_MODE_3A) | ||
6203 | DBG_PRINT(ERR_DBG, "%s: 3-Buffer mode support has been " | ||
6204 | "enabled\n",dev->name); | ||
6151 | 6205 | ||
6152 | /* Initialize device name */ | 6206 | /* Initialize device name */ |
6153 | strcpy(sp->name, dev->name); | 6207 | strcpy(sp->name, dev->name); |
diff --git a/drivers/net/s2io.h b/drivers/net/s2io.h index 1cc24b56760e..419aad7f10e7 100644 --- a/drivers/net/s2io.h +++ b/drivers/net/s2io.h | |||
@@ -418,7 +418,7 @@ typedef struct list_info_hold { | |||
418 | void *list_virt_addr; | 418 | void *list_virt_addr; |
419 | } list_info_hold_t; | 419 | } list_info_hold_t; |
420 | 420 | ||
421 | /* Rx descriptor structure */ | 421 | /* Rx descriptor structure for 1 buffer mode */ |
422 | typedef struct _RxD_t { | 422 | typedef struct _RxD_t { |
423 | u64 Host_Control; /* reserved for host */ | 423 | u64 Host_Control; /* reserved for host */ |
424 | u64 Control_1; | 424 | u64 Control_1; |
@@ -439,49 +439,54 @@ typedef struct _RxD_t { | |||
439 | #define SET_RXD_MARKER vBIT(THE_RXD_MARK, 0, 2) | 439 | #define SET_RXD_MARKER vBIT(THE_RXD_MARK, 0, 2) |
440 | #define GET_RXD_MARKER(ctrl) ((ctrl & SET_RXD_MARKER) >> 62) | 440 | #define GET_RXD_MARKER(ctrl) ((ctrl & SET_RXD_MARKER) >> 62) |
441 | 441 | ||
442 | #ifndef CONFIG_2BUFF_MODE | ||
443 | #define MASK_BUFFER0_SIZE vBIT(0x3FFF,2,14) | ||
444 | #define SET_BUFFER0_SIZE(val) vBIT(val,2,14) | ||
445 | #else | ||
446 | #define MASK_BUFFER0_SIZE vBIT(0xFF,2,14) | ||
447 | #define MASK_BUFFER1_SIZE vBIT(0xFFFF,16,16) | ||
448 | #define MASK_BUFFER2_SIZE vBIT(0xFFFF,32,16) | ||
449 | #define SET_BUFFER0_SIZE(val) vBIT(val,8,8) | ||
450 | #define SET_BUFFER1_SIZE(val) vBIT(val,16,16) | ||
451 | #define SET_BUFFER2_SIZE(val) vBIT(val,32,16) | ||
452 | #endif | ||
453 | |||
454 | #define MASK_VLAN_TAG vBIT(0xFFFF,48,16) | 442 | #define MASK_VLAN_TAG vBIT(0xFFFF,48,16) |
455 | #define SET_VLAN_TAG(val) vBIT(val,48,16) | 443 | #define SET_VLAN_TAG(val) vBIT(val,48,16) |
456 | #define SET_NUM_TAG(val) vBIT(val,16,32) | 444 | #define SET_NUM_TAG(val) vBIT(val,16,32) |
457 | 445 | ||
458 | #ifndef CONFIG_2BUFF_MODE | 446 | |
459 | #define RXD_GET_BUFFER0_SIZE(Control_2) (u64)((Control_2 & vBIT(0x3FFF,2,14))) | 447 | } RxD_t; |
460 | #else | 448 | /* Rx descriptor structure for 1 buffer mode */ |
461 | #define RXD_GET_BUFFER0_SIZE(Control_2) (u8)((Control_2 & MASK_BUFFER0_SIZE) \ | 449 | typedef struct _RxD1_t { |
462 | >> 48) | 450 | struct _RxD_t h; |
463 | #define RXD_GET_BUFFER1_SIZE(Control_2) (u16)((Control_2 & MASK_BUFFER1_SIZE) \ | 451 | |
464 | >> 32) | 452 | #define MASK_BUFFER0_SIZE_1 vBIT(0x3FFF,2,14) |
465 | #define RXD_GET_BUFFER2_SIZE(Control_2) (u16)((Control_2 & MASK_BUFFER2_SIZE) \ | 453 | #define SET_BUFFER0_SIZE_1(val) vBIT(val,2,14) |
466 | >> 16) | 454 | #define RXD_GET_BUFFER0_SIZE_1(_Control_2) \ |
455 | (u16)((_Control_2 & MASK_BUFFER0_SIZE_1) >> 48) | ||
456 | u64 Buffer0_ptr; | ||
457 | } RxD1_t; | ||
458 | /* Rx descriptor structure for 3 or 2 buffer mode */ | ||
459 | |||
460 | typedef struct _RxD3_t { | ||
461 | struct _RxD_t h; | ||
462 | |||
463 | #define MASK_BUFFER0_SIZE_3 vBIT(0xFF,2,14) | ||
464 | #define MASK_BUFFER1_SIZE_3 vBIT(0xFFFF,16,16) | ||
465 | #define MASK_BUFFER2_SIZE_3 vBIT(0xFFFF,32,16) | ||
466 | #define SET_BUFFER0_SIZE_3(val) vBIT(val,8,8) | ||
467 | #define SET_BUFFER1_SIZE_3(val) vBIT(val,16,16) | ||
468 | #define SET_BUFFER2_SIZE_3(val) vBIT(val,32,16) | ||
469 | #define RXD_GET_BUFFER0_SIZE_3(Control_2) \ | ||
470 | (u8)((Control_2 & MASK_BUFFER0_SIZE_3) >> 48) | ||
471 | #define RXD_GET_BUFFER1_SIZE_3(Control_2) \ | ||
472 | (u16)((Control_2 & MASK_BUFFER1_SIZE_3) >> 32) | ||
473 | #define RXD_GET_BUFFER2_SIZE_3(Control_2) \ | ||
474 | (u16)((Control_2 & MASK_BUFFER2_SIZE_3) >> 16) | ||
467 | #define BUF0_LEN 40 | 475 | #define BUF0_LEN 40 |
468 | #define BUF1_LEN 1 | 476 | #define BUF1_LEN 1 |
469 | #endif | ||
470 | 477 | ||
471 | u64 Buffer0_ptr; | 478 | u64 Buffer0_ptr; |
472 | #ifdef CONFIG_2BUFF_MODE | ||
473 | u64 Buffer1_ptr; | 479 | u64 Buffer1_ptr; |
474 | u64 Buffer2_ptr; | 480 | u64 Buffer2_ptr; |
475 | #endif | 481 | } RxD3_t; |
476 | } RxD_t; | 482 | |
477 | 483 | ||
478 | /* Structure that represents the Rx descriptor block which contains | 484 | /* Structure that represents the Rx descriptor block which contains |
479 | * 128 Rx descriptors. | 485 | * 128 Rx descriptors. |
480 | */ | 486 | */ |
481 | #ifndef CONFIG_2BUFF_MODE | ||
482 | typedef struct _RxD_block { | 487 | typedef struct _RxD_block { |
483 | #define MAX_RXDS_PER_BLOCK 127 | 488 | #define MAX_RXDS_PER_BLOCK_1 127 |
484 | RxD_t rxd[MAX_RXDS_PER_BLOCK]; | 489 | RxD1_t rxd[MAX_RXDS_PER_BLOCK_1]; |
485 | 490 | ||
486 | u64 reserved_0; | 491 | u64 reserved_0; |
487 | #define END_OF_BLOCK 0xFEFFFFFFFFFFFFFFULL | 492 | #define END_OF_BLOCK 0xFEFFFFFFFFFFFFFFULL |
@@ -492,18 +497,13 @@ typedef struct _RxD_block { | |||
492 | * the upper 32 bits should | 497 | * the upper 32 bits should |
493 | * be 0 */ | 498 | * be 0 */ |
494 | } RxD_block_t; | 499 | } RxD_block_t; |
495 | #else | ||
496 | typedef struct _RxD_block { | ||
497 | #define MAX_RXDS_PER_BLOCK 85 | ||
498 | RxD_t rxd[MAX_RXDS_PER_BLOCK]; | ||
499 | 500 | ||
500 | #define END_OF_BLOCK 0xFEFFFFFFFFFFFFFFULL | ||
501 | u64 reserved_1; /* 0xFEFFFFFFFFFFFFFF to mark last Rxd | ||
502 | * in this blk */ | ||
503 | u64 pNext_RxD_Blk_physical; /* Phy ponter to next blk. */ | ||
504 | } RxD_block_t; | ||
505 | #define SIZE_OF_BLOCK 4096 | 501 | #define SIZE_OF_BLOCK 4096 |
506 | 502 | ||
503 | #define RXD_MODE_1 0 | ||
504 | #define RXD_MODE_3A 1 | ||
505 | #define RXD_MODE_3B 2 | ||
506 | |||
507 | /* Structure to hold virtual addresses of Buf0 and Buf1 in | 507 | /* Structure to hold virtual addresses of Buf0 and Buf1 in |
508 | * 2buf mode. */ | 508 | * 2buf mode. */ |
509 | typedef struct bufAdd { | 509 | typedef struct bufAdd { |
@@ -512,7 +512,6 @@ typedef struct bufAdd { | |||
512 | void *ba_0; | 512 | void *ba_0; |
513 | void *ba_1; | 513 | void *ba_1; |
514 | } buffAdd_t; | 514 | } buffAdd_t; |
515 | #endif | ||
516 | 515 | ||
517 | /* Structure which stores all the MAC control parameters */ | 516 | /* Structure which stores all the MAC control parameters */ |
518 | 517 | ||
@@ -539,10 +538,17 @@ typedef struct { | |||
539 | 538 | ||
540 | typedef tx_curr_get_info_t tx_curr_put_info_t; | 539 | typedef tx_curr_get_info_t tx_curr_put_info_t; |
541 | 540 | ||
541 | |||
542 | typedef struct rxd_info { | ||
543 | void *virt_addr; | ||
544 | dma_addr_t dma_addr; | ||
545 | }rxd_info_t; | ||
546 | |||
542 | /* Structure that holds the Phy and virt addresses of the Blocks */ | 547 | /* Structure that holds the Phy and virt addresses of the Blocks */ |
543 | typedef struct rx_block_info { | 548 | typedef struct rx_block_info { |
544 | RxD_t *block_virt_addr; | 549 | void *block_virt_addr; |
545 | dma_addr_t block_dma_addr; | 550 | dma_addr_t block_dma_addr; |
551 | rxd_info_t *rxds; | ||
546 | } rx_block_info_t; | 552 | } rx_block_info_t; |
547 | 553 | ||
548 | /* pre declaration of the nic structure */ | 554 | /* pre declaration of the nic structure */ |
@@ -578,10 +584,8 @@ typedef struct ring_info { | |||
578 | int put_pos; | 584 | int put_pos; |
579 | #endif | 585 | #endif |
580 | 586 | ||
581 | #ifdef CONFIG_2BUFF_MODE | ||
582 | /* Buffer Address store. */ | 587 | /* Buffer Address store. */ |
583 | buffAdd_t **ba; | 588 | buffAdd_t **ba; |
584 | #endif | ||
585 | nic_t *nic; | 589 | nic_t *nic; |
586 | } ring_info_t; | 590 | } ring_info_t; |
587 | 591 | ||
@@ -647,8 +651,6 @@ typedef struct { | |||
647 | 651 | ||
648 | /* Default Tunable parameters of the NIC. */ | 652 | /* Default Tunable parameters of the NIC. */ |
649 | #define DEFAULT_FIFO_LEN 4096 | 653 | #define DEFAULT_FIFO_LEN 4096 |
650 | #define SMALL_RXD_CNT 30 * (MAX_RXDS_PER_BLOCK+1) | ||
651 | #define LARGE_RXD_CNT 100 * (MAX_RXDS_PER_BLOCK+1) | ||
652 | #define SMALL_BLK_CNT 30 | 654 | #define SMALL_BLK_CNT 30 |
653 | #define LARGE_BLK_CNT 100 | 655 | #define LARGE_BLK_CNT 100 |
654 | 656 | ||
@@ -678,6 +680,7 @@ struct msix_info_st { | |||
678 | 680 | ||
679 | /* Structure representing one instance of the NIC */ | 681 | /* Structure representing one instance of the NIC */ |
680 | struct s2io_nic { | 682 | struct s2io_nic { |
683 | int rxd_mode; | ||
681 | #ifdef CONFIG_S2IO_NAPI | 684 | #ifdef CONFIG_S2IO_NAPI |
682 | /* | 685 | /* |
683 | * Count of packets to be processed in a given iteration, it will be indicated | 686 | * Count of packets to be processed in a given iteration, it will be indicated |
diff --git a/drivers/net/skfp/smt.c b/drivers/net/skfp/smt.c index f17c05cbe44b..99a776a51fb5 100644 --- a/drivers/net/skfp/smt.c +++ b/drivers/net/skfp/smt.c | |||
@@ -1896,7 +1896,7 @@ void smt_swap_para(struct smt_header *sm, int len, int direction) | |||
1896 | 1896 | ||
1897 | static void smt_string_swap(char *data, const char *format, int len) | 1897 | static void smt_string_swap(char *data, const char *format, int len) |
1898 | { | 1898 | { |
1899 | const char *open_paren = 0 ; | 1899 | const char *open_paren = NULL ; |
1900 | int x ; | 1900 | int x ; |
1901 | 1901 | ||
1902 | while (len > 0 && *format) { | 1902 | while (len > 0 && *format) { |
diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c index c573bb351d4c..74d5f1a6fdea 100644 --- a/drivers/net/smc91x.c +++ b/drivers/net/smc91x.c | |||
@@ -77,7 +77,7 @@ static const char version[] = | |||
77 | #include <linux/errno.h> | 77 | #include <linux/errno.h> |
78 | #include <linux/ioport.h> | 78 | #include <linux/ioport.h> |
79 | #include <linux/crc32.h> | 79 | #include <linux/crc32.h> |
80 | #include <linux/device.h> | 80 | #include <linux/platform_device.h> |
81 | #include <linux/spinlock.h> | 81 | #include <linux/spinlock.h> |
82 | #include <linux/ethtool.h> | 82 | #include <linux/ethtool.h> |
83 | #include <linux/mii.h> | 83 | #include <linux/mii.h> |
diff --git a/drivers/net/smc91x.h b/drivers/net/smc91x.h index ac9ce6509eee..817f200742c3 100644 --- a/drivers/net/smc91x.h +++ b/drivers/net/smc91x.h | |||
@@ -230,12 +230,12 @@ SMC_outw(u16 val, void __iomem *ioaddr, int reg) | |||
230 | #define SMC_CAN_USE_16BIT 1 | 230 | #define SMC_CAN_USE_16BIT 1 |
231 | #define SMC_CAN_USE_32BIT 0 | 231 | #define SMC_CAN_USE_32BIT 0 |
232 | 232 | ||
233 | #define SMC_inb(a, r) inb((a) + (r) - 0xa0000000) | 233 | #define SMC_inb(a, r) inb((u32)a) + (r)) |
234 | #define SMC_inw(a, r) inw((a) + (r) - 0xa0000000) | 234 | #define SMC_inw(a, r) inw(((u32)a) + (r)) |
235 | #define SMC_outb(v, a, r) outb(v, (a) + (r) - 0xa0000000) | 235 | #define SMC_outb(v, a, r) outb(v, ((u32)a) + (r)) |
236 | #define SMC_outw(v, a, r) outw(v, (a) + (r) - 0xa0000000) | 236 | #define SMC_outw(v, a, r) outw(v, ((u32)a) + (r)) |
237 | #define SMC_insw(a, r, p, l) insw((a) + (r) - 0xa0000000, 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((a) + (r) - 0xa0000000, 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 set_irq_type(irq, type) do {} while(0) |
241 | 241 | ||
diff --git a/drivers/net/tokenring/proteon.c b/drivers/net/tokenring/proteon.c index eb1423ede75c..d04c918ebef8 100644 --- a/drivers/net/tokenring/proteon.c +++ b/drivers/net/tokenring/proteon.c | |||
@@ -29,6 +29,7 @@ static const char version[] = "proteon.c: v1.00 02/01/2003 by Jochen Friedrich\n | |||
29 | #include <linux/init.h> | 29 | #include <linux/init.h> |
30 | #include <linux/netdevice.h> | 30 | #include <linux/netdevice.h> |
31 | #include <linux/trdevice.h> | 31 | #include <linux/trdevice.h> |
32 | #include <linux/platform_device.h> | ||
32 | 33 | ||
33 | #include <asm/system.h> | 34 | #include <asm/system.h> |
34 | #include <asm/io.h> | 35 | #include <asm/io.h> |
diff --git a/drivers/net/tokenring/skisa.c b/drivers/net/tokenring/skisa.c index 3c7c66204f74..72cf708396be 100644 --- a/drivers/net/tokenring/skisa.c +++ b/drivers/net/tokenring/skisa.c | |||
@@ -36,6 +36,7 @@ static const char version[] = "skisa.c: v1.03 09/12/2002 by Jochen Friedrich\n"; | |||
36 | #include <linux/init.h> | 36 | #include <linux/init.h> |
37 | #include <linux/netdevice.h> | 37 | #include <linux/netdevice.h> |
38 | #include <linux/trdevice.h> | 38 | #include <linux/trdevice.h> |
39 | #include <linux/platform_device.h> | ||
39 | 40 | ||
40 | #include <asm/system.h> | 41 | #include <asm/system.h> |
41 | #include <asm/io.h> | 42 | #include <asm/io.h> |
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index 750c0167539c..849ac88bcccc 100644 --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c | |||
@@ -2040,7 +2040,7 @@ static int mpi_send_packet (struct net_device *dev) | |||
2040 | return 1; | 2040 | return 1; |
2041 | } | 2041 | } |
2042 | 2042 | ||
2043 | static void get_tx_error(struct airo_info *ai, u32 fid) | 2043 | static void get_tx_error(struct airo_info *ai, s32 fid) |
2044 | { | 2044 | { |
2045 | u16 status; | 2045 | u16 status; |
2046 | 2046 | ||
diff --git a/drivers/net/wireless/prism54/islpci_mgt.c b/drivers/net/wireless/prism54/islpci_mgt.c index 4937a5ad4b2c..6a60c5970cb5 100644 --- a/drivers/net/wireless/prism54/islpci_mgt.c +++ b/drivers/net/wireless/prism54/islpci_mgt.c | |||
@@ -137,7 +137,7 @@ islpci_mgmt_rx_fill(struct net_device *ndev) | |||
137 | PCI_DMA_FROMDEVICE); | 137 | PCI_DMA_FROMDEVICE); |
138 | if (!buf->pci_addr) { | 138 | if (!buf->pci_addr) { |
139 | printk(KERN_WARNING | 139 | printk(KERN_WARNING |
140 | "Failed to make memory DMA'able\n."); | 140 | "Failed to make memory DMA'able.\n"); |
141 | return -ENOMEM; | 141 | return -ENOMEM; |
142 | } | 142 | } |
143 | } | 143 | } |