diff options
Diffstat (limited to 'drivers/net')
29 files changed, 723 insertions, 760 deletions
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 5c69d57f8548..ebd7313d7fc1 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -812,7 +812,7 @@ config SMC91X | |||
812 | tristate "SMC 91C9x/91C1xxx support" | 812 | tristate "SMC 91C9x/91C1xxx support" |
813 | select CRC32 | 813 | select CRC32 |
814 | select MII | 814 | select MII |
815 | depends on NET_ETHERNET && (ARM || REDWOOD_5 || REDWOOD_6 || M32R || SUPERH) | 815 | depends on NET_ETHERNET && (ARM || REDWOOD_5 || REDWOOD_6 || M32R || SUPERH || SOC_AU1X00) |
816 | help | 816 | help |
817 | This is a driver for SMC's 91x series of Ethernet chipsets, | 817 | This is a driver for SMC's 91x series of Ethernet chipsets, |
818 | including the SMC91C94 and the SMC91C111. Say Y if you want it | 818 | including the SMC91C94 and the SMC91C111. Say Y if you want it |
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index 8f464271664d..49fa1e4413fa 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c | |||
@@ -2707,7 +2707,7 @@ bnx2_init_nvram(struct bnx2 *bp) | |||
2707 | 2707 | ||
2708 | if (j == entry_count) { | 2708 | if (j == entry_count) { |
2709 | bp->flash_info = NULL; | 2709 | bp->flash_info = NULL; |
2710 | printk(KERN_ALERT "Unknown flash/EEPROM type.\n"); | 2710 | printk(KERN_ALERT PFX "Unknown flash/EEPROM type.\n"); |
2711 | rc = -ENODEV; | 2711 | rc = -ENODEV; |
2712 | } | 2712 | } |
2713 | 2713 | ||
@@ -3903,6 +3903,8 @@ bnx2_test_loopback(struct bnx2 *bp) | |||
3903 | 3903 | ||
3904 | pkt_size = 1514; | 3904 | pkt_size = 1514; |
3905 | skb = dev_alloc_skb(pkt_size); | 3905 | skb = dev_alloc_skb(pkt_size); |
3906 | if (!skb) | ||
3907 | return -ENOMEM; | ||
3906 | packet = skb_put(skb, pkt_size); | 3908 | packet = skb_put(skb, pkt_size); |
3907 | memcpy(packet, bp->mac_addr, 6); | 3909 | memcpy(packet, bp->mac_addr, 6); |
3908 | memset(packet + 6, 0x0, 8); | 3910 | memset(packet + 6, 0x0, 8); |
@@ -4798,11 +4800,7 @@ bnx2_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, | |||
4798 | struct bnx2 *bp = dev->priv; | 4800 | struct bnx2 *bp = dev->priv; |
4799 | int rc; | 4801 | int rc; |
4800 | 4802 | ||
4801 | if (eeprom->offset > bp->flash_info->total_size) | 4803 | /* parameters already validated in ethtool_get_eeprom */ |
4802 | return -EINVAL; | ||
4803 | |||
4804 | if ((eeprom->offset + eeprom->len) > bp->flash_info->total_size) | ||
4805 | eeprom->len = bp->flash_info->total_size - eeprom->offset; | ||
4806 | 4804 | ||
4807 | rc = bnx2_nvram_read(bp, eeprom->offset, eebuf, eeprom->len); | 4805 | rc = bnx2_nvram_read(bp, eeprom->offset, eebuf, eeprom->len); |
4808 | 4806 | ||
@@ -4816,11 +4814,7 @@ bnx2_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, | |||
4816 | struct bnx2 *bp = dev->priv; | 4814 | struct bnx2 *bp = dev->priv; |
4817 | int rc; | 4815 | int rc; |
4818 | 4816 | ||
4819 | if (eeprom->offset > bp->flash_info->total_size) | 4817 | /* parameters already validated in ethtool_set_eeprom */ |
4820 | return -EINVAL; | ||
4821 | |||
4822 | if ((eeprom->offset + eeprom->len) > bp->flash_info->total_size) | ||
4823 | eeprom->len = bp->flash_info->total_size - eeprom->offset; | ||
4824 | 4818 | ||
4825 | rc = bnx2_nvram_write(bp, eeprom->offset, eebuf, eeprom->len); | 4819 | rc = bnx2_nvram_write(bp, eeprom->offset, eebuf, eeprom->len); |
4826 | 4820 | ||
diff --git a/drivers/net/depca.c b/drivers/net/depca.c index 0d33a93df96b..03804cc38be0 100644 --- a/drivers/net/depca.c +++ b/drivers/net/depca.c | |||
@@ -398,13 +398,19 @@ static struct mca_driver depca_mca_driver = { | |||
398 | }; | 398 | }; |
399 | #endif | 399 | #endif |
400 | 400 | ||
401 | static int depca_isa_probe (struct device *); | 401 | static int depca_isa_probe (struct platform_device *); |
402 | 402 | ||
403 | static struct device_driver depca_isa_driver = { | 403 | static int __devexit depca_isa_remove(struct platform_device *pdev) |
404 | .name = depca_string, | 404 | { |
405 | .bus = &platform_bus_type, | 405 | return depca_device_remove(&pdev->dev); |
406 | } | ||
407 | |||
408 | static struct platform_driver depca_isa_driver = { | ||
406 | .probe = depca_isa_probe, | 409 | .probe = depca_isa_probe, |
407 | .remove = __devexit_p(depca_device_remove), | 410 | .remove = __devexit_p(depca_isa_remove), |
411 | .driver = { | ||
412 | .name = depca_string, | ||
413 | }, | ||
408 | }; | 414 | }; |
409 | 415 | ||
410 | /* | 416 | /* |
@@ -1525,7 +1531,7 @@ static enum depca_type __init depca_shmem_probe (ulong *mem_start) | |||
1525 | return adapter; | 1531 | return adapter; |
1526 | } | 1532 | } |
1527 | 1533 | ||
1528 | static int __init depca_isa_probe (struct device *device) | 1534 | static int __init depca_isa_probe (struct platform_device *device) |
1529 | { | 1535 | { |
1530 | struct net_device *dev; | 1536 | struct net_device *dev; |
1531 | struct depca_private *lp; | 1537 | struct depca_private *lp; |
@@ -1533,7 +1539,7 @@ static int __init depca_isa_probe (struct device *device) | |||
1533 | enum depca_type adapter = unknown; | 1539 | enum depca_type adapter = unknown; |
1534 | int status = 0; | 1540 | int status = 0; |
1535 | 1541 | ||
1536 | ioaddr = (u_long) device->platform_data; | 1542 | ioaddr = (u_long) device->dev.platform_data; |
1537 | 1543 | ||
1538 | if ((status = depca_common_init (ioaddr, &dev))) | 1544 | if ((status = depca_common_init (ioaddr, &dev))) |
1539 | goto out; | 1545 | goto out; |
@@ -1553,7 +1559,7 @@ static int __init depca_isa_probe (struct device *device) | |||
1553 | lp->adapter = adapter; | 1559 | lp->adapter = adapter; |
1554 | lp->mem_start = mem_start; | 1560 | lp->mem_start = mem_start; |
1555 | 1561 | ||
1556 | if ((status = depca_hw_init(dev, device))) | 1562 | if ((status = depca_hw_init(dev, &device->dev))) |
1557 | goto out_free; | 1563 | goto out_free; |
1558 | 1564 | ||
1559 | return 0; | 1565 | return 0; |
@@ -2082,7 +2088,7 @@ static int __init depca_module_init (void) | |||
2082 | #ifdef CONFIG_EISA | 2088 | #ifdef CONFIG_EISA |
2083 | err |= eisa_driver_register (&depca_eisa_driver); | 2089 | err |= eisa_driver_register (&depca_eisa_driver); |
2084 | #endif | 2090 | #endif |
2085 | err |= driver_register (&depca_isa_driver); | 2091 | err |= platform_driver_register (&depca_isa_driver); |
2086 | depca_platform_probe (); | 2092 | depca_platform_probe (); |
2087 | 2093 | ||
2088 | return err; | 2094 | return err; |
@@ -2097,7 +2103,7 @@ static void __exit depca_module_exit (void) | |||
2097 | #ifdef CONFIG_EISA | 2103 | #ifdef CONFIG_EISA |
2098 | eisa_driver_unregister (&depca_eisa_driver); | 2104 | eisa_driver_unregister (&depca_eisa_driver); |
2099 | #endif | 2105 | #endif |
2100 | driver_unregister (&depca_isa_driver); | 2106 | platform_driver_unregister (&depca_isa_driver); |
2101 | 2107 | ||
2102 | for (i = 0; depca_io_ports[i].iobase; i++) { | 2108 | for (i = 0; depca_io_ports[i].iobase; i++) { |
2103 | if (depca_io_ports[i].device) { | 2109 | if (depca_io_ports[i].device) { |
diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c index f8c9bcdab68b..24996da4c1c4 100644 --- a/drivers/net/dm9000.c +++ b/drivers/net/dm9000.c | |||
@@ -148,7 +148,7 @@ typedef struct board_info { | |||
148 | } board_info_t; | 148 | } board_info_t; |
149 | 149 | ||
150 | /* function declaration ------------------------------------- */ | 150 | /* function declaration ------------------------------------- */ |
151 | static int dm9000_probe(struct device *); | 151 | static int dm9000_probe(struct platform_device *); |
152 | static int dm9000_open(struct net_device *); | 152 | static int dm9000_open(struct net_device *); |
153 | static int dm9000_start_xmit(struct sk_buff *, struct net_device *); | 153 | static int dm9000_start_xmit(struct sk_buff *, struct net_device *); |
154 | static int dm9000_stop(struct net_device *); | 154 | static int dm9000_stop(struct net_device *); |
@@ -378,9 +378,8 @@ dm9000_release_board(struct platform_device *pdev, struct board_info *db) | |||
378 | * Search DM9000 board, allocate space and register it | 378 | * Search DM9000 board, allocate space and register it |
379 | */ | 379 | */ |
380 | static int | 380 | static int |
381 | dm9000_probe(struct device *dev) | 381 | dm9000_probe(struct platform_device *pdev) |
382 | { | 382 | { |
383 | struct platform_device *pdev = to_platform_device(dev); | ||
384 | struct dm9000_plat_data *pdata = pdev->dev.platform_data; | 383 | struct dm9000_plat_data *pdata = pdev->dev.platform_data; |
385 | struct board_info *db; /* Point a board information structure */ | 384 | struct board_info *db; /* Point a board information structure */ |
386 | struct net_device *ndev; | 385 | struct net_device *ndev; |
@@ -398,7 +397,7 @@ dm9000_probe(struct device *dev) | |||
398 | } | 397 | } |
399 | 398 | ||
400 | SET_MODULE_OWNER(ndev); | 399 | SET_MODULE_OWNER(ndev); |
401 | SET_NETDEV_DEV(ndev, dev); | 400 | SET_NETDEV_DEV(ndev, &pdev->dev); |
402 | 401 | ||
403 | PRINTK2("dm9000_probe()"); | 402 | PRINTK2("dm9000_probe()"); |
404 | 403 | ||
@@ -569,7 +568,7 @@ dm9000_probe(struct device *dev) | |||
569 | printk("%s: Invalid ethernet MAC address. Please " | 568 | printk("%s: Invalid ethernet MAC address. Please " |
570 | "set using ifconfig\n", ndev->name); | 569 | "set using ifconfig\n", ndev->name); |
571 | 570 | ||
572 | dev_set_drvdata(dev, ndev); | 571 | platform_set_drvdata(pdev, ndev); |
573 | ret = register_netdev(ndev); | 572 | ret = register_netdev(ndev); |
574 | 573 | ||
575 | if (ret == 0) { | 574 | if (ret == 0) { |
@@ -1140,9 +1139,9 @@ dm9000_phy_write(struct net_device *dev, int phyaddr_unused, int reg, int value) | |||
1140 | } | 1139 | } |
1141 | 1140 | ||
1142 | static int | 1141 | static int |
1143 | dm9000_drv_suspend(struct device *dev, pm_message_t state) | 1142 | dm9000_drv_suspend(struct platform_device *dev, pm_message_t state) |
1144 | { | 1143 | { |
1145 | struct net_device *ndev = dev_get_drvdata(dev); | 1144 | struct net_device *ndev = platform_get_drvdata(dev); |
1146 | 1145 | ||
1147 | if (ndev) { | 1146 | if (ndev) { |
1148 | if (netif_running(ndev)) { | 1147 | if (netif_running(ndev)) { |
@@ -1154,9 +1153,9 @@ dm9000_drv_suspend(struct device *dev, pm_message_t state) | |||
1154 | } | 1153 | } |
1155 | 1154 | ||
1156 | static int | 1155 | static int |
1157 | dm9000_drv_resume(struct device *dev) | 1156 | dm9000_drv_resume(struct platform_device *dev) |
1158 | { | 1157 | { |
1159 | struct net_device *ndev = dev_get_drvdata(dev); | 1158 | struct net_device *ndev = platform_get_drvdata(dev); |
1160 | board_info_t *db = (board_info_t *) ndev->priv; | 1159 | board_info_t *db = (board_info_t *) ndev->priv; |
1161 | 1160 | ||
1162 | if (ndev) { | 1161 | if (ndev) { |
@@ -1172,12 +1171,11 @@ dm9000_drv_resume(struct device *dev) | |||
1172 | } | 1171 | } |
1173 | 1172 | ||
1174 | static int | 1173 | static int |
1175 | dm9000_drv_remove(struct device *dev) | 1174 | dm9000_drv_remove(struct platform_device *pdev) |
1176 | { | 1175 | { |
1177 | struct platform_device *pdev = to_platform_device(dev); | 1176 | struct net_device *ndev = platform_get_drvdata(pdev); |
1178 | struct net_device *ndev = dev_get_drvdata(dev); | ||
1179 | 1177 | ||
1180 | dev_set_drvdata(dev, NULL); | 1178 | platform_set_drvdata(pdev, NULL); |
1181 | 1179 | ||
1182 | unregister_netdev(ndev); | 1180 | unregister_netdev(ndev); |
1183 | dm9000_release_board(pdev, (board_info_t *) ndev->priv); | 1181 | dm9000_release_board(pdev, (board_info_t *) ndev->priv); |
@@ -1188,13 +1186,14 @@ dm9000_drv_remove(struct device *dev) | |||
1188 | return 0; | 1186 | return 0; |
1189 | } | 1187 | } |
1190 | 1188 | ||
1191 | static struct device_driver dm9000_driver = { | 1189 | static struct platform_driver dm9000_driver = { |
1192 | .name = "dm9000", | ||
1193 | .bus = &platform_bus_type, | ||
1194 | .probe = dm9000_probe, | 1190 | .probe = dm9000_probe, |
1195 | .remove = dm9000_drv_remove, | 1191 | .remove = dm9000_drv_remove, |
1196 | .suspend = dm9000_drv_suspend, | 1192 | .suspend = dm9000_drv_suspend, |
1197 | .resume = dm9000_drv_resume, | 1193 | .resume = dm9000_drv_resume, |
1194 | .driver = { | ||
1195 | .name = "dm9000", | ||
1196 | }, | ||
1198 | }; | 1197 | }; |
1199 | 1198 | ||
1200 | static int __init | 1199 | static int __init |
@@ -1202,13 +1201,13 @@ dm9000_init(void) | |||
1202 | { | 1201 | { |
1203 | printk(KERN_INFO "%s Ethernet Driver\n", CARDNAME); | 1202 | printk(KERN_INFO "%s Ethernet Driver\n", CARDNAME); |
1204 | 1203 | ||
1205 | return driver_register(&dm9000_driver); /* search board and register */ | 1204 | return platform_driver_register(&dm9000_driver); /* search board and register */ |
1206 | } | 1205 | } |
1207 | 1206 | ||
1208 | static void __exit | 1207 | static void __exit |
1209 | dm9000_cleanup(void) | 1208 | dm9000_cleanup(void) |
1210 | { | 1209 | { |
1211 | driver_unregister(&dm9000_driver); | 1210 | platform_driver_unregister(&dm9000_driver); |
1212 | } | 1211 | } |
1213 | 1212 | ||
1214 | module_init(dm9000_init); | 1213 | module_init(dm9000_init); |
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c index 22aec6ed80f5..525624fc03b4 100644 --- a/drivers/net/forcedeth.c +++ b/drivers/net/forcedeth.c | |||
@@ -80,7 +80,7 @@ | |||
80 | * into nv_close, otherwise reenabling for wol can | 80 | * into nv_close, otherwise reenabling for wol can |
81 | * cause DMA to kfree'd memory. | 81 | * cause DMA to kfree'd memory. |
82 | * 0.31: 14 Nov 2004: ethtool support for getting/setting link | 82 | * 0.31: 14 Nov 2004: ethtool support for getting/setting link |
83 | * capabilities. | 83 | * capabilities. |
84 | * 0.32: 16 Apr 2005: RX_ERROR4 handling added. | 84 | * 0.32: 16 Apr 2005: RX_ERROR4 handling added. |
85 | * 0.33: 16 May 2005: Support for MCP51 added. | 85 | * 0.33: 16 May 2005: Support for MCP51 added. |
86 | * 0.34: 18 Jun 2005: Add DEV_NEED_LINKTIMER to all nForce nics. | 86 | * 0.34: 18 Jun 2005: Add DEV_NEED_LINKTIMER to all nForce nics. |
@@ -89,14 +89,17 @@ | |||
89 | * 0.37: 10 Jul 2005: Additional ethtool support, cleanup of pci id list | 89 | * 0.37: 10 Jul 2005: Additional ethtool support, cleanup of pci id list |
90 | * 0.38: 16 Jul 2005: tx irq rewrite: Use global flags instead of | 90 | * 0.38: 16 Jul 2005: tx irq rewrite: Use global flags instead of |
91 | * per-packet flags. | 91 | * per-packet flags. |
92 | * 0.39: 18 Jul 2005: Add 64bit descriptor support. | 92 | * 0.39: 18 Jul 2005: Add 64bit descriptor support. |
93 | * 0.40: 19 Jul 2005: Add support for mac address change. | 93 | * 0.40: 19 Jul 2005: Add support for mac address change. |
94 | * 0.41: 30 Jul 2005: Write back original MAC in nv_close instead | 94 | * 0.41: 30 Jul 2005: Write back original MAC in nv_close instead |
95 | * of nv_remove | 95 | * of nv_remove |
96 | * 0.42: 06 Aug 2005: Fix lack of link speed initialization | 96 | * 0.42: 06 Aug 2005: Fix lack of link speed initialization |
97 | * in the second (and later) nv_open call | 97 | * in the second (and later) nv_open call |
98 | * 0.43: 10 Aug 2005: Add support for tx checksum. | 98 | * 0.43: 10 Aug 2005: Add support for tx checksum. |
99 | * 0.44: 20 Aug 2005: Add support for scatter gather and segmentation. | 99 | * 0.44: 20 Aug 2005: Add support for scatter gather and segmentation. |
100 | * 0.45: 18 Sep 2005: Remove nv_stop/start_rx from every link check | ||
101 | * 0.46: 20 Oct 2005: Add irq optimization modes. | ||
102 | * 0.47: 26 Oct 2005: Add phyaddr 0 in phy scan. | ||
100 | * | 103 | * |
101 | * Known bugs: | 104 | * Known bugs: |
102 | * We suspect that on some hardware no TX done interrupts are generated. | 105 | * We suspect that on some hardware no TX done interrupts are generated. |
@@ -108,7 +111,7 @@ | |||
108 | * DEV_NEED_TIMERIRQ will not harm you on sane hardware, only generating a few | 111 | * DEV_NEED_TIMERIRQ will not harm you on sane hardware, only generating a few |
109 | * superfluous timer interrupts from the nic. | 112 | * superfluous timer interrupts from the nic. |
110 | */ | 113 | */ |
111 | #define FORCEDETH_VERSION "0.44" | 114 | #define FORCEDETH_VERSION "0.47" |
112 | #define DRV_NAME "forcedeth" | 115 | #define DRV_NAME "forcedeth" |
113 | 116 | ||
114 | #include <linux/module.h> | 117 | #include <linux/module.h> |
@@ -163,7 +166,8 @@ enum { | |||
163 | #define NVREG_IRQ_LINK 0x0040 | 166 | #define NVREG_IRQ_LINK 0x0040 |
164 | #define NVREG_IRQ_TX_ERROR 0x0080 | 167 | #define NVREG_IRQ_TX_ERROR 0x0080 |
165 | #define NVREG_IRQ_TX1 0x0100 | 168 | #define NVREG_IRQ_TX1 0x0100 |
166 | #define NVREG_IRQMASK_WANTED 0x00df | 169 | #define NVREG_IRQMASK_THROUGHPUT 0x00df |
170 | #define NVREG_IRQMASK_CPU 0x0040 | ||
167 | 171 | ||
168 | #define NVREG_IRQ_UNKNOWN (~(NVREG_IRQ_RX_ERROR|NVREG_IRQ_RX|NVREG_IRQ_RX_NOBUF|NVREG_IRQ_TX_ERR| \ | 172 | #define NVREG_IRQ_UNKNOWN (~(NVREG_IRQ_RX_ERROR|NVREG_IRQ_RX|NVREG_IRQ_RX_NOBUF|NVREG_IRQ_TX_ERR| \ |
169 | NVREG_IRQ_TX_OK|NVREG_IRQ_TIMER|NVREG_IRQ_LINK|NVREG_IRQ_TX_ERROR| \ | 173 | NVREG_IRQ_TX_OK|NVREG_IRQ_TIMER|NVREG_IRQ_LINK|NVREG_IRQ_TX_ERROR| \ |
@@ -177,7 +181,8 @@ enum { | |||
177 | * NVREG_POLL_DEFAULT=97 would result in an interval length of 1 ms | 181 | * NVREG_POLL_DEFAULT=97 would result in an interval length of 1 ms |
178 | */ | 182 | */ |
179 | NvRegPollingInterval = 0x00c, | 183 | NvRegPollingInterval = 0x00c, |
180 | #define NVREG_POLL_DEFAULT 970 | 184 | #define NVREG_POLL_DEFAULT_THROUGHPUT 970 |
185 | #define NVREG_POLL_DEFAULT_CPU 13 | ||
181 | NvRegMisc1 = 0x080, | 186 | NvRegMisc1 = 0x080, |
182 | #define NVREG_MISC1_HD 0x02 | 187 | #define NVREG_MISC1_HD 0x02 |
183 | #define NVREG_MISC1_FORCE 0x3b0f3c | 188 | #define NVREG_MISC1_FORCE 0x3b0f3c |
@@ -538,6 +543,25 @@ struct fe_priv { | |||
538 | */ | 543 | */ |
539 | static int max_interrupt_work = 5; | 544 | static int max_interrupt_work = 5; |
540 | 545 | ||
546 | /* | ||
547 | * Optimization can be either throuput mode or cpu mode | ||
548 | * | ||
549 | * Throughput Mode: Every tx and rx packet will generate an interrupt. | ||
550 | * CPU Mode: Interrupts are controlled by a timer. | ||
551 | */ | ||
552 | #define NV_OPTIMIZATION_MODE_THROUGHPUT 0 | ||
553 | #define NV_OPTIMIZATION_MODE_CPU 1 | ||
554 | static int optimization_mode = NV_OPTIMIZATION_MODE_THROUGHPUT; | ||
555 | |||
556 | /* | ||
557 | * Poll interval for timer irq | ||
558 | * | ||
559 | * This interval determines how frequent an interrupt is generated. | ||
560 | * The is value is determined by [(time_in_micro_secs * 100) / (2^10)] | ||
561 | * Min = 0, and Max = 65535 | ||
562 | */ | ||
563 | static int poll_interval = -1; | ||
564 | |||
541 | static inline struct fe_priv *get_nvpriv(struct net_device *dev) | 565 | static inline struct fe_priv *get_nvpriv(struct net_device *dev) |
542 | { | 566 | { |
543 | return netdev_priv(dev); | 567 | return netdev_priv(dev); |
@@ -1328,67 +1352,71 @@ static void nv_rx_process(struct net_device *dev) | |||
1328 | if (!(Flags & NV_RX_DESCRIPTORVALID)) | 1352 | if (!(Flags & NV_RX_DESCRIPTORVALID)) |
1329 | goto next_pkt; | 1353 | goto next_pkt; |
1330 | 1354 | ||
1331 | if (Flags & NV_RX_MISSEDFRAME) { | 1355 | if (Flags & NV_RX_ERROR) { |
1332 | np->stats.rx_missed_errors++; | 1356 | if (Flags & NV_RX_MISSEDFRAME) { |
1333 | np->stats.rx_errors++; | 1357 | np->stats.rx_missed_errors++; |
1334 | goto next_pkt; | ||
1335 | } | ||
1336 | if (Flags & (NV_RX_ERROR1|NV_RX_ERROR2|NV_RX_ERROR3)) { | ||
1337 | np->stats.rx_errors++; | ||
1338 | goto next_pkt; | ||
1339 | } | ||
1340 | if (Flags & NV_RX_CRCERR) { | ||
1341 | np->stats.rx_crc_errors++; | ||
1342 | np->stats.rx_errors++; | ||
1343 | goto next_pkt; | ||
1344 | } | ||
1345 | if (Flags & NV_RX_OVERFLOW) { | ||
1346 | np->stats.rx_over_errors++; | ||
1347 | np->stats.rx_errors++; | ||
1348 | goto next_pkt; | ||
1349 | } | ||
1350 | if (Flags & NV_RX_ERROR4) { | ||
1351 | len = nv_getlen(dev, np->rx_skbuff[i]->data, len); | ||
1352 | if (len < 0) { | ||
1353 | np->stats.rx_errors++; | 1358 | np->stats.rx_errors++; |
1354 | goto next_pkt; | 1359 | goto next_pkt; |
1355 | } | 1360 | } |
1356 | } | 1361 | if (Flags & (NV_RX_ERROR1|NV_RX_ERROR2|NV_RX_ERROR3)) { |
1357 | /* framing errors are soft errors. */ | 1362 | np->stats.rx_errors++; |
1358 | if (Flags & NV_RX_FRAMINGERR) { | 1363 | goto next_pkt; |
1359 | if (Flags & NV_RX_SUBSTRACT1) { | 1364 | } |
1360 | len--; | 1365 | if (Flags & NV_RX_CRCERR) { |
1366 | np->stats.rx_crc_errors++; | ||
1367 | np->stats.rx_errors++; | ||
1368 | goto next_pkt; | ||
1369 | } | ||
1370 | if (Flags & NV_RX_OVERFLOW) { | ||
1371 | np->stats.rx_over_errors++; | ||
1372 | np->stats.rx_errors++; | ||
1373 | goto next_pkt; | ||
1374 | } | ||
1375 | if (Flags & NV_RX_ERROR4) { | ||
1376 | len = nv_getlen(dev, np->rx_skbuff[i]->data, len); | ||
1377 | if (len < 0) { | ||
1378 | np->stats.rx_errors++; | ||
1379 | goto next_pkt; | ||
1380 | } | ||
1381 | } | ||
1382 | /* framing errors are soft errors. */ | ||
1383 | if (Flags & NV_RX_FRAMINGERR) { | ||
1384 | if (Flags & NV_RX_SUBSTRACT1) { | ||
1385 | len--; | ||
1386 | } | ||
1361 | } | 1387 | } |
1362 | } | 1388 | } |
1363 | } else { | 1389 | } else { |
1364 | if (!(Flags & NV_RX2_DESCRIPTORVALID)) | 1390 | if (!(Flags & NV_RX2_DESCRIPTORVALID)) |
1365 | goto next_pkt; | 1391 | goto next_pkt; |
1366 | 1392 | ||
1367 | if (Flags & (NV_RX2_ERROR1|NV_RX2_ERROR2|NV_RX2_ERROR3)) { | 1393 | if (Flags & NV_RX2_ERROR) { |
1368 | np->stats.rx_errors++; | 1394 | if (Flags & (NV_RX2_ERROR1|NV_RX2_ERROR2|NV_RX2_ERROR3)) { |
1369 | goto next_pkt; | ||
1370 | } | ||
1371 | if (Flags & NV_RX2_CRCERR) { | ||
1372 | np->stats.rx_crc_errors++; | ||
1373 | np->stats.rx_errors++; | ||
1374 | goto next_pkt; | ||
1375 | } | ||
1376 | if (Flags & NV_RX2_OVERFLOW) { | ||
1377 | np->stats.rx_over_errors++; | ||
1378 | np->stats.rx_errors++; | ||
1379 | goto next_pkt; | ||
1380 | } | ||
1381 | if (Flags & NV_RX2_ERROR4) { | ||
1382 | len = nv_getlen(dev, np->rx_skbuff[i]->data, len); | ||
1383 | if (len < 0) { | ||
1384 | np->stats.rx_errors++; | 1395 | np->stats.rx_errors++; |
1385 | goto next_pkt; | 1396 | goto next_pkt; |
1386 | } | 1397 | } |
1387 | } | 1398 | if (Flags & NV_RX2_CRCERR) { |
1388 | /* framing errors are soft errors */ | 1399 | np->stats.rx_crc_errors++; |
1389 | if (Flags & NV_RX2_FRAMINGERR) { | 1400 | np->stats.rx_errors++; |
1390 | if (Flags & NV_RX2_SUBSTRACT1) { | 1401 | goto next_pkt; |
1391 | len--; | 1402 | } |
1403 | if (Flags & NV_RX2_OVERFLOW) { | ||
1404 | np->stats.rx_over_errors++; | ||
1405 | np->stats.rx_errors++; | ||
1406 | goto next_pkt; | ||
1407 | } | ||
1408 | if (Flags & NV_RX2_ERROR4) { | ||
1409 | len = nv_getlen(dev, np->rx_skbuff[i]->data, len); | ||
1410 | if (len < 0) { | ||
1411 | np->stats.rx_errors++; | ||
1412 | goto next_pkt; | ||
1413 | } | ||
1414 | } | ||
1415 | /* framing errors are soft errors */ | ||
1416 | if (Flags & NV_RX2_FRAMINGERR) { | ||
1417 | if (Flags & NV_RX2_SUBSTRACT1) { | ||
1418 | len--; | ||
1419 | } | ||
1392 | } | 1420 | } |
1393 | } | 1421 | } |
1394 | Flags &= NV_RX2_CHECKSUMMASK; | 1422 | Flags &= NV_RX2_CHECKSUMMASK; |
@@ -1612,6 +1640,17 @@ static void nv_set_multicast(struct net_device *dev) | |||
1612 | spin_unlock_irq(&np->lock); | 1640 | spin_unlock_irq(&np->lock); |
1613 | } | 1641 | } |
1614 | 1642 | ||
1643 | /** | ||
1644 | * nv_update_linkspeed: Setup the MAC according to the link partner | ||
1645 | * @dev: Network device to be configured | ||
1646 | * | ||
1647 | * The function queries the PHY and checks if there is a link partner. | ||
1648 | * If yes, then it sets up the MAC accordingly. Otherwise, the MAC is | ||
1649 | * set to 10 MBit HD. | ||
1650 | * | ||
1651 | * The function returns 0 if there is no link partner and 1 if there is | ||
1652 | * a good link partner. | ||
1653 | */ | ||
1615 | static int nv_update_linkspeed(struct net_device *dev) | 1654 | static int nv_update_linkspeed(struct net_device *dev) |
1616 | { | 1655 | { |
1617 | struct fe_priv *np = netdev_priv(dev); | 1656 | struct fe_priv *np = netdev_priv(dev); |
@@ -1751,13 +1790,11 @@ set_speed: | |||
1751 | static void nv_linkchange(struct net_device *dev) | 1790 | static void nv_linkchange(struct net_device *dev) |
1752 | { | 1791 | { |
1753 | if (nv_update_linkspeed(dev)) { | 1792 | if (nv_update_linkspeed(dev)) { |
1754 | if (netif_carrier_ok(dev)) { | 1793 | if (!netif_carrier_ok(dev)) { |
1755 | nv_stop_rx(dev); | ||
1756 | } else { | ||
1757 | netif_carrier_on(dev); | 1794 | netif_carrier_on(dev); |
1758 | printk(KERN_INFO "%s: link up.\n", dev->name); | 1795 | printk(KERN_INFO "%s: link up.\n", dev->name); |
1796 | nv_start_rx(dev); | ||
1759 | } | 1797 | } |
1760 | nv_start_rx(dev); | ||
1761 | } else { | 1798 | } else { |
1762 | if (netif_carrier_ok(dev)) { | 1799 | if (netif_carrier_ok(dev)) { |
1763 | netif_carrier_off(dev); | 1800 | netif_carrier_off(dev); |
@@ -1799,22 +1836,18 @@ static irqreturn_t nv_nic_irq(int foo, void *data, struct pt_regs *regs) | |||
1799 | if (!(events & np->irqmask)) | 1836 | if (!(events & np->irqmask)) |
1800 | break; | 1837 | break; |
1801 | 1838 | ||
1802 | if (events & (NVREG_IRQ_TX1|NVREG_IRQ_TX_OK|NVREG_IRQ_TX_ERROR|NVREG_IRQ_TX_ERR)) { | 1839 | spin_lock(&np->lock); |
1840 | nv_tx_done(dev); | ||
1841 | spin_unlock(&np->lock); | ||
1842 | |||
1843 | nv_rx_process(dev); | ||
1844 | if (nv_alloc_rx(dev)) { | ||
1803 | spin_lock(&np->lock); | 1845 | spin_lock(&np->lock); |
1804 | nv_tx_done(dev); | 1846 | if (!np->in_shutdown) |
1847 | mod_timer(&np->oom_kick, jiffies + OOM_REFILL); | ||
1805 | spin_unlock(&np->lock); | 1848 | spin_unlock(&np->lock); |
1806 | } | 1849 | } |
1807 | 1850 | ||
1808 | if (events & (NVREG_IRQ_RX_ERROR|NVREG_IRQ_RX|NVREG_IRQ_RX_NOBUF)) { | ||
1809 | nv_rx_process(dev); | ||
1810 | if (nv_alloc_rx(dev)) { | ||
1811 | spin_lock(&np->lock); | ||
1812 | if (!np->in_shutdown) | ||
1813 | mod_timer(&np->oom_kick, jiffies + OOM_REFILL); | ||
1814 | spin_unlock(&np->lock); | ||
1815 | } | ||
1816 | } | ||
1817 | |||
1818 | if (events & NVREG_IRQ_LINK) { | 1851 | if (events & NVREG_IRQ_LINK) { |
1819 | spin_lock(&np->lock); | 1852 | spin_lock(&np->lock); |
1820 | nv_link_irq(dev); | 1853 | nv_link_irq(dev); |
@@ -2216,7 +2249,14 @@ static int nv_open(struct net_device *dev) | |||
2216 | writel(NVREG_RNDSEED_FORCE | (i&NVREG_RNDSEED_MASK), base + NvRegRandomSeed); | 2249 | writel(NVREG_RNDSEED_FORCE | (i&NVREG_RNDSEED_MASK), base + NvRegRandomSeed); |
2217 | writel(NVREG_UNKSETUP1_VAL, base + NvRegUnknownSetupReg1); | 2250 | writel(NVREG_UNKSETUP1_VAL, base + NvRegUnknownSetupReg1); |
2218 | writel(NVREG_UNKSETUP2_VAL, base + NvRegUnknownSetupReg2); | 2251 | writel(NVREG_UNKSETUP2_VAL, base + NvRegUnknownSetupReg2); |
2219 | writel(NVREG_POLL_DEFAULT, base + NvRegPollingInterval); | 2252 | if (poll_interval == -1) { |
2253 | if (optimization_mode == NV_OPTIMIZATION_MODE_THROUGHPUT) | ||
2254 | writel(NVREG_POLL_DEFAULT_THROUGHPUT, base + NvRegPollingInterval); | ||
2255 | else | ||
2256 | writel(NVREG_POLL_DEFAULT_CPU, base + NvRegPollingInterval); | ||
2257 | } | ||
2258 | else | ||
2259 | writel(poll_interval & 0xFFFF, base + NvRegPollingInterval); | ||
2220 | writel(NVREG_UNKSETUP6_VAL, base + NvRegUnknownSetupReg6); | 2260 | writel(NVREG_UNKSETUP6_VAL, base + NvRegUnknownSetupReg6); |
2221 | writel((np->phyaddr << NVREG_ADAPTCTL_PHYSHIFT)|NVREG_ADAPTCTL_PHYVALID|NVREG_ADAPTCTL_RUNNING, | 2261 | writel((np->phyaddr << NVREG_ADAPTCTL_PHYSHIFT)|NVREG_ADAPTCTL_PHYVALID|NVREG_ADAPTCTL_RUNNING, |
2222 | base + NvRegAdapterControl); | 2262 | base + NvRegAdapterControl); |
@@ -2501,7 +2541,11 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i | |||
2501 | } else { | 2541 | } else { |
2502 | np->tx_flags = NV_TX2_VALID; | 2542 | np->tx_flags = NV_TX2_VALID; |
2503 | } | 2543 | } |
2504 | np->irqmask = NVREG_IRQMASK_WANTED; | 2544 | if (optimization_mode == NV_OPTIMIZATION_MODE_THROUGHPUT) |
2545 | np->irqmask = NVREG_IRQMASK_THROUGHPUT; | ||
2546 | else | ||
2547 | np->irqmask = NVREG_IRQMASK_CPU; | ||
2548 | |||
2505 | if (id->driver_data & DEV_NEED_TIMERIRQ) | 2549 | if (id->driver_data & DEV_NEED_TIMERIRQ) |
2506 | np->irqmask |= NVREG_IRQ_TIMER; | 2550 | np->irqmask |= NVREG_IRQ_TIMER; |
2507 | if (id->driver_data & DEV_NEED_LINKTIMER) { | 2551 | if (id->driver_data & DEV_NEED_LINKTIMER) { |
@@ -2514,16 +2558,17 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i | |||
2514 | } | 2558 | } |
2515 | 2559 | ||
2516 | /* find a suitable phy */ | 2560 | /* find a suitable phy */ |
2517 | for (i = 1; i < 32; i++) { | 2561 | for (i = 1; i <= 32; i++) { |
2518 | int id1, id2; | 2562 | int id1, id2; |
2563 | int phyaddr = i & 0x1F; | ||
2519 | 2564 | ||
2520 | spin_lock_irq(&np->lock); | 2565 | spin_lock_irq(&np->lock); |
2521 | id1 = mii_rw(dev, i, MII_PHYSID1, MII_READ); | 2566 | id1 = mii_rw(dev, phyaddr, MII_PHYSID1, MII_READ); |
2522 | spin_unlock_irq(&np->lock); | 2567 | spin_unlock_irq(&np->lock); |
2523 | if (id1 < 0 || id1 == 0xffff) | 2568 | if (id1 < 0 || id1 == 0xffff) |
2524 | continue; | 2569 | continue; |
2525 | spin_lock_irq(&np->lock); | 2570 | spin_lock_irq(&np->lock); |
2526 | id2 = mii_rw(dev, i, MII_PHYSID2, MII_READ); | 2571 | id2 = mii_rw(dev, phyaddr, MII_PHYSID2, MII_READ); |
2527 | spin_unlock_irq(&np->lock); | 2572 | spin_unlock_irq(&np->lock); |
2528 | if (id2 < 0 || id2 == 0xffff) | 2573 | if (id2 < 0 || id2 == 0xffff) |
2529 | continue; | 2574 | continue; |
@@ -2531,23 +2576,19 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i | |||
2531 | id1 = (id1 & PHYID1_OUI_MASK) << PHYID1_OUI_SHFT; | 2576 | id1 = (id1 & PHYID1_OUI_MASK) << PHYID1_OUI_SHFT; |
2532 | id2 = (id2 & PHYID2_OUI_MASK) >> PHYID2_OUI_SHFT; | 2577 | id2 = (id2 & PHYID2_OUI_MASK) >> PHYID2_OUI_SHFT; |
2533 | dprintk(KERN_DEBUG "%s: open: Found PHY %04x:%04x at address %d.\n", | 2578 | dprintk(KERN_DEBUG "%s: open: Found PHY %04x:%04x at address %d.\n", |
2534 | pci_name(pci_dev), id1, id2, i); | 2579 | pci_name(pci_dev), id1, id2, phyaddr); |
2535 | np->phyaddr = i; | 2580 | np->phyaddr = phyaddr; |
2536 | np->phy_oui = id1 | id2; | 2581 | np->phy_oui = id1 | id2; |
2537 | break; | 2582 | break; |
2538 | } | 2583 | } |
2539 | if (i == 32) { | 2584 | if (i == 33) { |
2540 | /* PHY in isolate mode? No phy attached and user wants to | ||
2541 | * test loopback? Very odd, but can be correct. | ||
2542 | */ | ||
2543 | printk(KERN_INFO "%s: open: Could not find a valid PHY.\n", | 2585 | printk(KERN_INFO "%s: open: Could not find a valid PHY.\n", |
2544 | pci_name(pci_dev)); | 2586 | pci_name(pci_dev)); |
2545 | } | 2587 | goto out_freering; |
2546 | |||
2547 | if (i != 32) { | ||
2548 | /* reset it */ | ||
2549 | phy_init(dev); | ||
2550 | } | 2588 | } |
2589 | |||
2590 | /* reset it */ | ||
2591 | phy_init(dev); | ||
2551 | 2592 | ||
2552 | /* set default link speed settings */ | 2593 | /* set default link speed settings */ |
2553 | np->linkspeed = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10; | 2594 | np->linkspeed = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10; |
@@ -2689,6 +2730,10 @@ static void __exit exit_nic(void) | |||
2689 | 2730 | ||
2690 | module_param(max_interrupt_work, int, 0); | 2731 | module_param(max_interrupt_work, int, 0); |
2691 | MODULE_PARM_DESC(max_interrupt_work, "forcedeth maximum events handled per interrupt"); | 2732 | MODULE_PARM_DESC(max_interrupt_work, "forcedeth maximum events handled per interrupt"); |
2733 | module_param(optimization_mode, int, 0); | ||
2734 | MODULE_PARM_DESC(optimization_mode, "In throughput mode (0), every tx & rx packet will generate an interrupt. In CPU mode (1), interrupts are controlled by a timer."); | ||
2735 | module_param(poll_interval, int, 0); | ||
2736 | MODULE_PARM_DESC(poll_interval, "Interval determines how frequent timer interrupt is generated by [(time_in_micro_secs * 100) / (2^10)]. Min is 0 and Max is 65535."); | ||
2692 | 2737 | ||
2693 | MODULE_AUTHOR("Manfred Spraul <manfred@colorfullife.com>"); | 2738 | MODULE_AUTHOR("Manfred Spraul <manfred@colorfullife.com>"); |
2694 | MODULE_DESCRIPTION("Reverse Engineered nForce ethernet driver"); | 2739 | MODULE_DESCRIPTION("Reverse Engineered nForce ethernet driver"); |
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c index 9342d5bc7bb4..f5d49a110654 100644 --- a/drivers/net/fs_enet/fs_enet-main.c +++ b/drivers/net/fs_enet/fs_enet-main.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <linux/ethtool.h> | 37 | #include <linux/ethtool.h> |
38 | #include <linux/bitops.h> | 38 | #include <linux/bitops.h> |
39 | #include <linux/fs.h> | 39 | #include <linux/fs.h> |
40 | #include <linux/platform_device.h> | ||
40 | 41 | ||
41 | #include <linux/vmalloc.h> | 42 | #include <linux/vmalloc.h> |
42 | #include <asm/pgtable.h> | 43 | #include <asm/pgtable.h> |
diff --git a/drivers/net/fs_enet/mac-fcc.c b/drivers/net/fs_enet/mac-fcc.c index a940b96433c7..e67b1d06611c 100644 --- a/drivers/net/fs_enet/mac-fcc.c +++ b/drivers/net/fs_enet/mac-fcc.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/ethtool.h> | 34 | #include <linux/ethtool.h> |
35 | #include <linux/bitops.h> | 35 | #include <linux/bitops.h> |
36 | #include <linux/fs.h> | 36 | #include <linux/fs.h> |
37 | #include <linux/platform_device.h> | ||
37 | 38 | ||
38 | #include <asm/immap_cpm2.h> | 39 | #include <asm/immap_cpm2.h> |
39 | #include <asm/mpc8260.h> | 40 | #include <asm/mpc8260.h> |
diff --git a/drivers/net/fs_enet/mac-fec.c b/drivers/net/fs_enet/mac-fec.c index 5ef4e845a387..2e8f44469699 100644 --- a/drivers/net/fs_enet/mac-fec.c +++ b/drivers/net/fs_enet/mac-fec.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/ethtool.h> | 34 | #include <linux/ethtool.h> |
35 | #include <linux/bitops.h> | 35 | #include <linux/bitops.h> |
36 | #include <linux/fs.h> | 36 | #include <linux/fs.h> |
37 | #include <linux/platform_device.h> | ||
37 | 38 | ||
38 | #include <asm/irq.h> | 39 | #include <asm/irq.h> |
39 | #include <asm/uaccess.h> | 40 | #include <asm/uaccess.h> |
diff --git a/drivers/net/fs_enet/mac-scc.c b/drivers/net/fs_enet/mac-scc.c index d8c6e9cadcf5..a3897fda71fa 100644 --- a/drivers/net/fs_enet/mac-scc.c +++ b/drivers/net/fs_enet/mac-scc.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/ethtool.h> | 34 | #include <linux/ethtool.h> |
35 | #include <linux/bitops.h> | 35 | #include <linux/bitops.h> |
36 | #include <linux/fs.h> | 36 | #include <linux/fs.h> |
37 | #include <linux/platform_device.h> | ||
37 | 38 | ||
38 | #include <asm/irq.h> | 39 | #include <asm/irq.h> |
39 | #include <asm/uaccess.h> | 40 | #include <asm/uaccess.h> |
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index 54d294ad6df5..e3a329539f1c 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c | |||
@@ -126,8 +126,8 @@ static irqreturn_t gfar_interrupt(int irq, void *dev_id, struct pt_regs *regs); | |||
126 | static void adjust_link(struct net_device *dev); | 126 | static void adjust_link(struct net_device *dev); |
127 | static void init_registers(struct net_device *dev); | 127 | static void init_registers(struct net_device *dev); |
128 | static int init_phy(struct net_device *dev); | 128 | static int init_phy(struct net_device *dev); |
129 | static int gfar_probe(struct device *device); | 129 | static int gfar_probe(struct platform_device *pdev); |
130 | static int gfar_remove(struct device *device); | 130 | static int gfar_remove(struct platform_device *pdev); |
131 | static void free_skb_resources(struct gfar_private *priv); | 131 | static void free_skb_resources(struct gfar_private *priv); |
132 | static void gfar_set_multi(struct net_device *dev); | 132 | static void gfar_set_multi(struct net_device *dev); |
133 | static void gfar_set_hash_for_addr(struct net_device *dev, u8 *addr); | 133 | static void gfar_set_hash_for_addr(struct net_device *dev, u8 *addr); |
@@ -156,12 +156,11 @@ int gfar_uses_fcb(struct gfar_private *priv) | |||
156 | 156 | ||
157 | /* Set up the ethernet device structure, private data, | 157 | /* Set up the ethernet device structure, private data, |
158 | * and anything else we need before we start */ | 158 | * and anything else we need before we start */ |
159 | static int gfar_probe(struct device *device) | 159 | static int gfar_probe(struct platform_device *pdev) |
160 | { | 160 | { |
161 | u32 tempval; | 161 | u32 tempval; |
162 | struct net_device *dev = NULL; | 162 | struct net_device *dev = NULL; |
163 | struct gfar_private *priv = NULL; | 163 | struct gfar_private *priv = NULL; |
164 | struct platform_device *pdev = to_platform_device(device); | ||
165 | struct gianfar_platform_data *einfo; | 164 | struct gianfar_platform_data *einfo; |
166 | struct resource *r; | 165 | struct resource *r; |
167 | int idx; | 166 | int idx; |
@@ -208,7 +207,7 @@ static int gfar_probe(struct device *device) | |||
208 | 207 | ||
209 | spin_lock_init(&priv->lock); | 208 | spin_lock_init(&priv->lock); |
210 | 209 | ||
211 | dev_set_drvdata(device, dev); | 210 | platform_set_drvdata(pdev, dev); |
212 | 211 | ||
213 | /* Stop the DMA engine now, in case it was running before */ | 212 | /* Stop the DMA engine now, in case it was running before */ |
214 | /* (The firmware could have used it, and left it running). */ | 213 | /* (The firmware could have used it, and left it running). */ |
@@ -245,7 +244,7 @@ static int gfar_probe(struct device *device) | |||
245 | dev->base_addr = (unsigned long) (priv->regs); | 244 | dev->base_addr = (unsigned long) (priv->regs); |
246 | 245 | ||
247 | SET_MODULE_OWNER(dev); | 246 | SET_MODULE_OWNER(dev); |
248 | SET_NETDEV_DEV(dev, device); | 247 | SET_NETDEV_DEV(dev, &pdev->dev); |
249 | 248 | ||
250 | /* Fill in the dev structure */ | 249 | /* Fill in the dev structure */ |
251 | dev->open = gfar_enet_open; | 250 | dev->open = gfar_enet_open; |
@@ -377,12 +376,12 @@ regs_fail: | |||
377 | return err; | 376 | return err; |
378 | } | 377 | } |
379 | 378 | ||
380 | static int gfar_remove(struct device *device) | 379 | static int gfar_remove(struct platform_device *pdev) |
381 | { | 380 | { |
382 | struct net_device *dev = dev_get_drvdata(device); | 381 | struct net_device *dev = platform_get_drvdata(pdev); |
383 | struct gfar_private *priv = netdev_priv(dev); | 382 | struct gfar_private *priv = netdev_priv(dev); |
384 | 383 | ||
385 | dev_set_drvdata(device, NULL); | 384 | platform_set_drvdata(pdev, NULL); |
386 | 385 | ||
387 | iounmap((void *) priv->regs); | 386 | iounmap((void *) priv->regs); |
388 | free_netdev(dev); | 387 | free_netdev(dev); |
@@ -1861,11 +1860,12 @@ static irqreturn_t gfar_error(int irq, void *dev_id, struct pt_regs *regs) | |||
1861 | } | 1860 | } |
1862 | 1861 | ||
1863 | /* Structure for a device driver */ | 1862 | /* Structure for a device driver */ |
1864 | static struct device_driver gfar_driver = { | 1863 | static struct platform_driver gfar_driver = { |
1865 | .name = "fsl-gianfar", | ||
1866 | .bus = &platform_bus_type, | ||
1867 | .probe = gfar_probe, | 1864 | .probe = gfar_probe, |
1868 | .remove = gfar_remove, | 1865 | .remove = gfar_remove, |
1866 | .driver = { | ||
1867 | .name = "fsl-gianfar", | ||
1868 | }, | ||
1869 | }; | 1869 | }; |
1870 | 1870 | ||
1871 | static int __init gfar_init(void) | 1871 | static int __init gfar_init(void) |
@@ -1875,7 +1875,7 @@ static int __init gfar_init(void) | |||
1875 | if (err) | 1875 | if (err) |
1876 | return err; | 1876 | return err; |
1877 | 1877 | ||
1878 | err = driver_register(&gfar_driver); | 1878 | err = platform_driver_register(&gfar_driver); |
1879 | 1879 | ||
1880 | if (err) | 1880 | if (err) |
1881 | gfar_mdio_exit(); | 1881 | gfar_mdio_exit(); |
@@ -1885,7 +1885,7 @@ static int __init gfar_init(void) | |||
1885 | 1885 | ||
1886 | static void __exit gfar_exit(void) | 1886 | static void __exit gfar_exit(void) |
1887 | { | 1887 | { |
1888 | driver_unregister(&gfar_driver); | 1888 | platform_driver_unregister(&gfar_driver); |
1889 | gfar_mdio_exit(); | 1889 | gfar_mdio_exit(); |
1890 | } | 1890 | } |
1891 | 1891 | ||
diff --git a/drivers/net/gianfar_mii.c b/drivers/net/gianfar_mii.c index 7263395d78bb..9544279e8bcd 100644 --- a/drivers/net/gianfar_mii.c +++ b/drivers/net/gianfar_mii.c | |||
@@ -133,7 +133,7 @@ int gfar_mdio_probe(struct device *dev) | |||
133 | if (NULL == dev) | 133 | if (NULL == dev) |
134 | return -EINVAL; | 134 | return -EINVAL; |
135 | 135 | ||
136 | new_bus = kmalloc(sizeof(struct mii_bus), GFP_KERNEL); | 136 | new_bus = kzalloc(sizeof(struct mii_bus), GFP_KERNEL); |
137 | 137 | ||
138 | if (NULL == new_bus) | 138 | if (NULL == new_bus) |
139 | return -ENOMEM; | 139 | return -ENOMEM; |
diff --git a/drivers/net/gt96100eth.c b/drivers/net/gt96100eth.c index 666cfbbcf6d9..5958a6314723 100644 --- a/drivers/net/gt96100eth.c +++ b/drivers/net/gt96100eth.c | |||
@@ -72,8 +72,6 @@ static void dump_tx_desc(int dbg_lvl, struct net_device *dev, int i); | |||
72 | static void dump_rx_desc(int dbg_lvl, struct net_device *dev, int i); | 72 | static void dump_rx_desc(int dbg_lvl, struct net_device *dev, int i); |
73 | static void dump_skb(int dbg_lvl, struct net_device *dev, | 73 | static void dump_skb(int dbg_lvl, struct net_device *dev, |
74 | struct sk_buff *skb); | 74 | struct sk_buff *skb); |
75 | static void dump_hw_addr(int dbg_lvl, struct net_device *dev, | ||
76 | const char* pfx, unsigned char* addr_str); | ||
77 | static void update_stats(struct gt96100_private *gp); | 75 | static void update_stats(struct gt96100_private *gp); |
78 | static void abort(struct net_device *dev, u32 abort_bits); | 76 | static void abort(struct net_device *dev, u32 abort_bits); |
79 | static void hard_stop(struct net_device *dev); | 77 | static void hard_stop(struct net_device *dev); |
@@ -334,13 +332,13 @@ dump_MII(int dbg_lvl, struct net_device *dev) | |||
334 | 332 | ||
335 | static void | 333 | static void |
336 | dump_hw_addr(int dbg_lvl, struct net_device *dev, const char* pfx, | 334 | dump_hw_addr(int dbg_lvl, struct net_device *dev, const char* pfx, |
337 | unsigned char* addr_str) | 335 | const char* func, unsigned char* addr_str) |
338 | { | 336 | { |
339 | int i; | 337 | int i; |
340 | char buf[100], octet[5]; | 338 | char buf[100], octet[5]; |
341 | 339 | ||
342 | if (dbg_lvl <= GT96100_DEBUG) { | 340 | if (dbg_lvl <= GT96100_DEBUG) { |
343 | strcpy(buf, pfx); | 341 | sprintf(buf, pfx, func); |
344 | for (i = 0; i < 6; i++) { | 342 | for (i = 0; i < 6; i++) { |
345 | sprintf(octet, "%2.2x%s", | 343 | sprintf(octet, "%2.2x%s", |
346 | addr_str[i], i<5 ? ":" : "\n"); | 344 | addr_str[i], i<5 ? ":" : "\n"); |
@@ -708,7 +706,7 @@ static int __init gt96100_probe1(struct pci_dev *pci, int port_num) | |||
708 | 706 | ||
709 | info("%s found at 0x%x, irq %d\n", | 707 | info("%s found at 0x%x, irq %d\n", |
710 | chip_name(gp->chip_rev), gtif->iobase, gtif->irq); | 708 | chip_name(gp->chip_rev), gtif->iobase, gtif->irq); |
711 | dump_hw_addr(0, dev, "HW Address ", dev->dev_addr); | 709 | dump_hw_addr(0, dev, "%s: HW Address ", __FUNCTION__, dev->dev_addr); |
712 | info("%s chip revision=%d\n", chip_name(gp->chip_rev), gp->chip_rev); | 710 | info("%s chip revision=%d\n", chip_name(gp->chip_rev), gp->chip_rev); |
713 | info("%s ethernet port %d\n", chip_name(gp->chip_rev), gp->port_num); | 711 | info("%s ethernet port %d\n", chip_name(gp->chip_rev), gp->port_num); |
714 | info("external PHY ID1=0x%04x, ID2=0x%04x\n", phy_id1, phy_id2); | 712 | info("external PHY ID1=0x%04x, ID2=0x%04x\n", phy_id1, phy_id2); |
@@ -1488,7 +1486,7 @@ gt96100_set_rx_mode(struct net_device *dev) | |||
1488 | gt96100_add_hash_entry(dev, dev->dev_addr); | 1486 | gt96100_add_hash_entry(dev, dev->dev_addr); |
1489 | 1487 | ||
1490 | for (mcptr = dev->mc_list; mcptr; mcptr = mcptr->next) { | 1488 | for (mcptr = dev->mc_list; mcptr; mcptr = mcptr->next) { |
1491 | dump_hw_addr(2, dev, __FUNCTION__ ": addr=", | 1489 | dump_hw_addr(2, dev, "%s: addr=", __FUNCTION__, |
1492 | mcptr->dmi_addr); | 1490 | mcptr->dmi_addr); |
1493 | gt96100_add_hash_entry(dev, mcptr->dmi_addr); | 1491 | gt96100_add_hash_entry(dev, mcptr->dmi_addr); |
1494 | } | 1492 | } |
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c index be191d80ef9c..ceb98fd398af 100644 --- a/drivers/net/ibmveth.c +++ b/drivers/net/ibmveth.c | |||
@@ -58,7 +58,7 @@ | |||
58 | 58 | ||
59 | #include "ibmveth.h" | 59 | #include "ibmveth.h" |
60 | 60 | ||
61 | #define DEBUG 1 | 61 | #undef DEBUG |
62 | 62 | ||
63 | #define ibmveth_printk(fmt, args...) \ | 63 | #define ibmveth_printk(fmt, args...) \ |
64 | printk(KERN_INFO "%s: " fmt, __FILE__, ## args) | 64 | printk(KERN_INFO "%s: " fmt, __FILE__, ## args) |
diff --git a/drivers/net/irda/sa1100_ir.c b/drivers/net/irda/sa1100_ir.c index 76e0b9fb5e96..63d38fbbd04e 100644 --- a/drivers/net/irda/sa1100_ir.c +++ b/drivers/net/irda/sa1100_ir.c | |||
@@ -291,9 +291,9 @@ static void sa1100_irda_shutdown(struct sa1100_irda *si) | |||
291 | /* | 291 | /* |
292 | * Suspend the IrDA interface. | 292 | * Suspend the IrDA interface. |
293 | */ | 293 | */ |
294 | static int sa1100_irda_suspend(struct device *_dev, pm_message_t state) | 294 | static int sa1100_irda_suspend(struct platform_device *pdev, pm_message_t state) |
295 | { | 295 | { |
296 | struct net_device *dev = dev_get_drvdata(_dev); | 296 | struct net_device *dev = platform_get_drvdata(pdev); |
297 | struct sa1100_irda *si; | 297 | struct sa1100_irda *si; |
298 | 298 | ||
299 | if (!dev) | 299 | if (!dev) |
@@ -316,9 +316,9 @@ static int sa1100_irda_suspend(struct device *_dev, pm_message_t state) | |||
316 | /* | 316 | /* |
317 | * Resume the IrDA interface. | 317 | * Resume the IrDA interface. |
318 | */ | 318 | */ |
319 | static int sa1100_irda_resume(struct device *_dev) | 319 | static int sa1100_irda_resume(struct platform_device *pdev) |
320 | { | 320 | { |
321 | struct net_device *dev = dev_get_drvdata(_dev); | 321 | struct net_device *dev = platform_get_drvdata(pdev); |
322 | struct sa1100_irda *si; | 322 | struct sa1100_irda *si; |
323 | 323 | ||
324 | if (!dev) | 324 | if (!dev) |
@@ -886,9 +886,8 @@ static int sa1100_irda_init_iobuf(iobuff_t *io, int size) | |||
886 | return io->head ? 0 : -ENOMEM; | 886 | return io->head ? 0 : -ENOMEM; |
887 | } | 887 | } |
888 | 888 | ||
889 | static int sa1100_irda_probe(struct device *_dev) | 889 | static int sa1100_irda_probe(struct platform_device *pdev) |
890 | { | 890 | { |
891 | struct platform_device *pdev = to_platform_device(_dev); | ||
892 | struct net_device *dev; | 891 | struct net_device *dev; |
893 | struct sa1100_irda *si; | 892 | struct sa1100_irda *si; |
894 | unsigned int baudrate_mask; | 893 | unsigned int baudrate_mask; |
@@ -967,7 +966,7 @@ static int sa1100_irda_probe(struct device *_dev) | |||
967 | 966 | ||
968 | err = register_netdev(dev); | 967 | err = register_netdev(dev); |
969 | if (err == 0) | 968 | if (err == 0) |
970 | dev_set_drvdata(&pdev->dev, dev); | 969 | platform_set_drvdata(pdev, dev); |
971 | 970 | ||
972 | if (err) { | 971 | if (err) { |
973 | err_mem_5: | 972 | err_mem_5: |
@@ -985,9 +984,9 @@ static int sa1100_irda_probe(struct device *_dev) | |||
985 | return err; | 984 | return err; |
986 | } | 985 | } |
987 | 986 | ||
988 | static int sa1100_irda_remove(struct device *_dev) | 987 | static int sa1100_irda_remove(struct platform_device *pdev) |
989 | { | 988 | { |
990 | struct net_device *dev = dev_get_drvdata(_dev); | 989 | struct net_device *dev = platform_get_drvdata(pdev); |
991 | 990 | ||
992 | if (dev) { | 991 | if (dev) { |
993 | struct sa1100_irda *si = dev->priv; | 992 | struct sa1100_irda *si = dev->priv; |
@@ -1004,13 +1003,14 @@ static int sa1100_irda_remove(struct device *_dev) | |||
1004 | return 0; | 1003 | return 0; |
1005 | } | 1004 | } |
1006 | 1005 | ||
1007 | static struct device_driver sa1100ir_driver = { | 1006 | static struct platform_driver sa1100ir_driver = { |
1008 | .name = "sa11x0-ir", | ||
1009 | .bus = &platform_bus_type, | ||
1010 | .probe = sa1100_irda_probe, | 1007 | .probe = sa1100_irda_probe, |
1011 | .remove = sa1100_irda_remove, | 1008 | .remove = sa1100_irda_remove, |
1012 | .suspend = sa1100_irda_suspend, | 1009 | .suspend = sa1100_irda_suspend, |
1013 | .resume = sa1100_irda_resume, | 1010 | .resume = sa1100_irda_resume, |
1011 | .driver = { | ||
1012 | .name = "sa11x0-ir", | ||
1013 | }, | ||
1014 | }; | 1014 | }; |
1015 | 1015 | ||
1016 | static int __init sa1100_irda_init(void) | 1016 | static int __init sa1100_irda_init(void) |
@@ -1023,12 +1023,12 @@ static int __init sa1100_irda_init(void) | |||
1023 | if (power_level > 3) | 1023 | if (power_level > 3) |
1024 | power_level = 3; | 1024 | power_level = 3; |
1025 | 1025 | ||
1026 | return driver_register(&sa1100ir_driver); | 1026 | return platform_driver_register(&sa1100ir_driver); |
1027 | } | 1027 | } |
1028 | 1028 | ||
1029 | static void __exit sa1100_irda_exit(void) | 1029 | static void __exit sa1100_irda_exit(void) |
1030 | { | 1030 | { |
1031 | driver_unregister(&sa1100ir_driver); | 1031 | platform_driver_unregister(&sa1100ir_driver); |
1032 | } | 1032 | } |
1033 | 1033 | ||
1034 | module_init(sa1100_irda_init); | 1034 | module_init(sa1100_irda_init); |
diff --git a/drivers/net/irda/smsc-ircc2.c b/drivers/net/irda/smsc-ircc2.c index a1d207f2fa68..ec94ecdb103d 100644 --- a/drivers/net/irda/smsc-ircc2.c +++ b/drivers/net/irda/smsc-ircc2.c | |||
@@ -214,14 +214,15 @@ static int smsc_ircc_probe_transceiver_smsc_ircc_atc(int fir_base); | |||
214 | 214 | ||
215 | /* Power Management */ | 215 | /* Power Management */ |
216 | 216 | ||
217 | static int smsc_ircc_suspend(struct device *dev, pm_message_t state); | 217 | static int smsc_ircc_suspend(struct platform_device *dev, pm_message_t state); |
218 | static int smsc_ircc_resume(struct device *dev); | 218 | static int smsc_ircc_resume(struct platform_device *dev); |
219 | 219 | ||
220 | static struct device_driver smsc_ircc_driver = { | 220 | static struct platform_driver smsc_ircc_driver = { |
221 | .name = SMSC_IRCC2_DRIVER_NAME, | ||
222 | .bus = &platform_bus_type, | ||
223 | .suspend = smsc_ircc_suspend, | 221 | .suspend = smsc_ircc_suspend, |
224 | .resume = smsc_ircc_resume, | 222 | .resume = smsc_ircc_resume, |
223 | .driver = { | ||
224 | .name = SMSC_IRCC2_DRIVER_NAME, | ||
225 | }, | ||
225 | }; | 226 | }; |
226 | 227 | ||
227 | /* Transceivers for SMSC-ircc */ | 228 | /* Transceivers for SMSC-ircc */ |
@@ -346,7 +347,7 @@ static int __init smsc_ircc_init(void) | |||
346 | 347 | ||
347 | IRDA_DEBUG(1, "%s\n", __FUNCTION__); | 348 | IRDA_DEBUG(1, "%s\n", __FUNCTION__); |
348 | 349 | ||
349 | ret = driver_register(&smsc_ircc_driver); | 350 | ret = platform_driver_register(&smsc_ircc_driver); |
350 | if (ret) { | 351 | if (ret) { |
351 | IRDA_ERROR("%s, Can't register driver!\n", driver_name); | 352 | IRDA_ERROR("%s, Can't register driver!\n", driver_name); |
352 | return ret; | 353 | return ret; |
@@ -378,7 +379,7 @@ static int __init smsc_ircc_init(void) | |||
378 | } | 379 | } |
379 | 380 | ||
380 | if (ret) | 381 | if (ret) |
381 | driver_unregister(&smsc_ircc_driver); | 382 | platform_driver_unregister(&smsc_ircc_driver); |
382 | 383 | ||
383 | return ret; | 384 | return ret; |
384 | } | 385 | } |
@@ -491,7 +492,7 @@ static int __init smsc_ircc_open(unsigned int fir_base, unsigned int sir_base, u | |||
491 | err = PTR_ERR(self->pldev); | 492 | err = PTR_ERR(self->pldev); |
492 | goto err_out5; | 493 | goto err_out5; |
493 | } | 494 | } |
494 | dev_set_drvdata(&self->pldev->dev, self); | 495 | platform_set_drvdata(self->pldev, self); |
495 | 496 | ||
496 | IRDA_MESSAGE("IrDA: Registered device %s\n", dev->name); | 497 | IRDA_MESSAGE("IrDA: Registered device %s\n", dev->name); |
497 | dev_count++; | 498 | dev_count++; |
@@ -1685,9 +1686,9 @@ static int smsc_ircc_net_close(struct net_device *dev) | |||
1685 | return 0; | 1686 | return 0; |
1686 | } | 1687 | } |
1687 | 1688 | ||
1688 | static int smsc_ircc_suspend(struct device *dev, pm_message_t state) | 1689 | static int smsc_ircc_suspend(struct platform_device *dev, pm_message_t state) |
1689 | { | 1690 | { |
1690 | struct smsc_ircc_cb *self = dev_get_drvdata(dev); | 1691 | struct smsc_ircc_cb *self = platform_get_drvdata(dev); |
1691 | 1692 | ||
1692 | if (!self->io.suspended) { | 1693 | if (!self->io.suspended) { |
1693 | IRDA_DEBUG(1, "%s, Suspending\n", driver_name); | 1694 | IRDA_DEBUG(1, "%s, Suspending\n", driver_name); |
@@ -1706,9 +1707,9 @@ static int smsc_ircc_suspend(struct device *dev, pm_message_t state) | |||
1706 | return 0; | 1707 | return 0; |
1707 | } | 1708 | } |
1708 | 1709 | ||
1709 | static int smsc_ircc_resume(struct device *dev) | 1710 | static int smsc_ircc_resume(struct platform_device *dev) |
1710 | { | 1711 | { |
1711 | struct smsc_ircc_cb *self = dev_get_drvdata(dev); | 1712 | struct smsc_ircc_cb *self = platform_get_drvdata(dev); |
1712 | 1713 | ||
1713 | if (self->io.suspended) { | 1714 | if (self->io.suspended) { |
1714 | IRDA_DEBUG(1, "%s, Waking up\n", driver_name); | 1715 | IRDA_DEBUG(1, "%s, Waking up\n", driver_name); |
@@ -1788,7 +1789,7 @@ static void __exit smsc_ircc_cleanup(void) | |||
1788 | smsc_ircc_close(dev_self[i]); | 1789 | smsc_ircc_close(dev_self[i]); |
1789 | } | 1790 | } |
1790 | 1791 | ||
1791 | driver_unregister(&smsc_ircc_driver); | 1792 | platform_driver_unregister(&smsc_ircc_driver); |
1792 | } | 1793 | } |
1793 | 1794 | ||
1794 | /* | 1795 | /* |
diff --git a/drivers/net/jazzsonic.c b/drivers/net/jazzsonic.c index 2fb3101cb33e..b039bd89ceb9 100644 --- a/drivers/net/jazzsonic.c +++ b/drivers/net/jazzsonic.c | |||
@@ -194,7 +194,7 @@ out: | |||
194 | * Probe for a SONIC ethernet controller on a Mips Jazz board. | 194 | * Probe for a SONIC ethernet controller on a Mips Jazz board. |
195 | * Actually probing is superfluous but we're paranoid. | 195 | * Actually probing is superfluous but we're paranoid. |
196 | */ | 196 | */ |
197 | static int __init jazz_sonic_probe(struct device *device) | 197 | static int __init jazz_sonic_probe(struct platform_device *pdev) |
198 | { | 198 | { |
199 | struct net_device *dev; | 199 | struct net_device *dev; |
200 | struct sonic_local *lp; | 200 | struct sonic_local *lp; |
@@ -212,8 +212,8 @@ static int __init jazz_sonic_probe(struct device *device) | |||
212 | return -ENOMEM; | 212 | return -ENOMEM; |
213 | 213 | ||
214 | lp = netdev_priv(dev); | 214 | lp = netdev_priv(dev); |
215 | lp->device = device; | 215 | lp->device = &pdev->dev; |
216 | SET_NETDEV_DEV(dev, device); | 216 | SET_NETDEV_DEV(dev, &pdev->dev); |
217 | SET_MODULE_OWNER(dev); | 217 | SET_MODULE_OWNER(dev); |
218 | 218 | ||
219 | netdev_boot_setup_check(dev); | 219 | netdev_boot_setup_check(dev); |
@@ -264,9 +264,9 @@ MODULE_PARM_DESC(sonic_debug, "jazzsonic debug level (1-4)"); | |||
264 | 264 | ||
265 | #include "sonic.c" | 265 | #include "sonic.c" |
266 | 266 | ||
267 | static int __devexit jazz_sonic_device_remove (struct device *device) | 267 | static int __devexit jazz_sonic_device_remove (struct platform_device *pdev) |
268 | { | 268 | { |
269 | struct net_device *dev = device->driver_data; | 269 | struct net_device *dev = platform_get_drvdata(pdev); |
270 | struct sonic_local* lp = netdev_priv(dev); | 270 | struct sonic_local* lp = netdev_priv(dev); |
271 | 271 | ||
272 | unregister_netdev (dev); | 272 | unregister_netdev (dev); |
@@ -278,18 +278,19 @@ static int __devexit jazz_sonic_device_remove (struct device *device) | |||
278 | return 0; | 278 | return 0; |
279 | } | 279 | } |
280 | 280 | ||
281 | static struct device_driver jazz_sonic_driver = { | 281 | static struct platform_driver jazz_sonic_driver = { |
282 | .name = jazz_sonic_string, | ||
283 | .bus = &platform_bus_type, | ||
284 | .probe = jazz_sonic_probe, | 282 | .probe = jazz_sonic_probe, |
285 | .remove = __devexit_p(jazz_sonic_device_remove), | 283 | .remove = __devexit_p(jazz_sonic_device_remove), |
284 | .driver = { | ||
285 | .name = jazz_sonic_string, | ||
286 | }, | ||
286 | }; | 287 | }; |
287 | 288 | ||
288 | static int __init jazz_sonic_init_module(void) | 289 | static int __init jazz_sonic_init_module(void) |
289 | { | 290 | { |
290 | int err; | 291 | int err; |
291 | 292 | ||
292 | if ((err = driver_register(&jazz_sonic_driver))) { | 293 | if ((err = platform_driver_register(&jazz_sonic_driver))) { |
293 | printk(KERN_ERR "Driver registration failed\n"); | 294 | printk(KERN_ERR "Driver registration failed\n"); |
294 | return err; | 295 | return err; |
295 | } | 296 | } |
@@ -313,7 +314,7 @@ out_unregister: | |||
313 | 314 | ||
314 | static void __exit jazz_sonic_cleanup_module(void) | 315 | static void __exit jazz_sonic_cleanup_module(void) |
315 | { | 316 | { |
316 | driver_unregister(&jazz_sonic_driver); | 317 | platform_driver_unregister(&jazz_sonic_driver); |
317 | 318 | ||
318 | if (jazz_sonic_device) { | 319 | if (jazz_sonic_device) { |
319 | platform_device_unregister(jazz_sonic_device); | 320 | platform_device_unregister(jazz_sonic_device); |
diff --git a/drivers/net/macsonic.c b/drivers/net/macsonic.c index 9ef4592aca03..02d5c6822733 100644 --- a/drivers/net/macsonic.c +++ b/drivers/net/macsonic.c | |||
@@ -525,7 +525,7 @@ int __init mac_nubus_sonic_probe(struct net_device* dev) | |||
525 | return macsonic_init(dev); | 525 | return macsonic_init(dev); |
526 | } | 526 | } |
527 | 527 | ||
528 | static int __init mac_sonic_probe(struct device *device) | 528 | static int __init mac_sonic_probe(struct platform_device *device) |
529 | { | 529 | { |
530 | struct net_device *dev; | 530 | struct net_device *dev; |
531 | struct sonic_local *lp; | 531 | struct sonic_local *lp; |
@@ -537,8 +537,8 @@ static int __init mac_sonic_probe(struct device *device) | |||
537 | return -ENOMEM; | 537 | return -ENOMEM; |
538 | 538 | ||
539 | lp = netdev_priv(dev); | 539 | lp = netdev_priv(dev); |
540 | lp->device = device; | 540 | lp->device = &device->dev; |
541 | SET_NETDEV_DEV(dev, device); | 541 | SET_NETDEV_DEV(dev, &device->dev); |
542 | SET_MODULE_OWNER(dev); | 542 | SET_MODULE_OWNER(dev); |
543 | 543 | ||
544 | /* This will catch fatal stuff like -ENOMEM as well as success */ | 544 | /* This will catch fatal stuff like -ENOMEM as well as success */ |
@@ -579,9 +579,9 @@ MODULE_PARM_DESC(sonic_debug, "macsonic debug level (1-4)"); | |||
579 | 579 | ||
580 | #include "sonic.c" | 580 | #include "sonic.c" |
581 | 581 | ||
582 | static int __devexit mac_sonic_device_remove (struct device *device) | 582 | static int __devexit mac_sonic_device_remove (struct platform_device *device) |
583 | { | 583 | { |
584 | struct net_device *dev = device->driver_data; | 584 | struct net_device *dev = platform_get_drvdata(device); |
585 | struct sonic_local* lp = netdev_priv(dev); | 585 | struct sonic_local* lp = netdev_priv(dev); |
586 | 586 | ||
587 | unregister_netdev (dev); | 587 | unregister_netdev (dev); |
@@ -592,18 +592,19 @@ static int __devexit mac_sonic_device_remove (struct device *device) | |||
592 | return 0; | 592 | return 0; |
593 | } | 593 | } |
594 | 594 | ||
595 | static struct device_driver mac_sonic_driver = { | 595 | static struct platform_driver mac_sonic_driver = { |
596 | .name = mac_sonic_string, | ||
597 | .bus = &platform_bus_type, | ||
598 | .probe = mac_sonic_probe, | 596 | .probe = mac_sonic_probe, |
599 | .remove = __devexit_p(mac_sonic_device_remove), | 597 | .remove = __devexit_p(mac_sonic_device_remove), |
598 | .driver = { | ||
599 | .name = mac_sonic_string, | ||
600 | }, | ||
600 | }; | 601 | }; |
601 | 602 | ||
602 | static int __init mac_sonic_init_module(void) | 603 | static int __init mac_sonic_init_module(void) |
603 | { | 604 | { |
604 | int err; | 605 | int err; |
605 | 606 | ||
606 | if ((err = driver_register(&mac_sonic_driver))) { | 607 | if ((err = platform_driver_register(&mac_sonic_driver))) { |
607 | printk(KERN_ERR "Driver registration failed\n"); | 608 | printk(KERN_ERR "Driver registration failed\n"); |
608 | return err; | 609 | return err; |
609 | } | 610 | } |
@@ -628,7 +629,7 @@ out_unregister: | |||
628 | 629 | ||
629 | static void __exit mac_sonic_cleanup_module(void) | 630 | static void __exit mac_sonic_cleanup_module(void) |
630 | { | 631 | { |
631 | driver_unregister(&mac_sonic_driver); | 632 | platform_driver_unregister(&mac_sonic_driver); |
632 | 633 | ||
633 | if (mac_sonic_device) { | 634 | if (mac_sonic_device) { |
634 | platform_device_unregister(mac_sonic_device); | 635 | platform_device_unregister(mac_sonic_device); |
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c index 71f2c6705bc3..3cb9b3fe0cf1 100644 --- a/drivers/net/mv643xx_eth.c +++ b/drivers/net/mv643xx_eth.c | |||
@@ -1387,9 +1387,8 @@ static void mv643xx_netpoll(struct net_device *netdev) | |||
1387 | * Input : struct device * | 1387 | * Input : struct device * |
1388 | * Output : -ENOMEM if failed , 0 if success | 1388 | * Output : -ENOMEM if failed , 0 if success |
1389 | */ | 1389 | */ |
1390 | static int mv643xx_eth_probe(struct device *ddev) | 1390 | static int mv643xx_eth_probe(struct platform_device *pdev) |
1391 | { | 1391 | { |
1392 | struct platform_device *pdev = to_platform_device(ddev); | ||
1393 | struct mv643xx_eth_platform_data *pd; | 1392 | struct mv643xx_eth_platform_data *pd; |
1394 | int port_num = pdev->id; | 1393 | int port_num = pdev->id; |
1395 | struct mv643xx_private *mp; | 1394 | struct mv643xx_private *mp; |
@@ -1402,7 +1401,7 @@ static int mv643xx_eth_probe(struct device *ddev) | |||
1402 | if (!dev) | 1401 | if (!dev) |
1403 | return -ENOMEM; | 1402 | return -ENOMEM; |
1404 | 1403 | ||
1405 | dev_set_drvdata(ddev, dev); | 1404 | platform_set_drvdata(pdev, dev); |
1406 | 1405 | ||
1407 | mp = netdev_priv(dev); | 1406 | mp = netdev_priv(dev); |
1408 | 1407 | ||
@@ -1546,21 +1545,20 @@ out: | |||
1546 | return err; | 1545 | return err; |
1547 | } | 1546 | } |
1548 | 1547 | ||
1549 | static int mv643xx_eth_remove(struct device *ddev) | 1548 | static int mv643xx_eth_remove(struct platform_device *pdev) |
1550 | { | 1549 | { |
1551 | struct net_device *dev = dev_get_drvdata(ddev); | 1550 | struct net_device *dev = platform_get_drvdata(pdev); |
1552 | 1551 | ||
1553 | unregister_netdev(dev); | 1552 | unregister_netdev(dev); |
1554 | flush_scheduled_work(); | 1553 | flush_scheduled_work(); |
1555 | 1554 | ||
1556 | free_netdev(dev); | 1555 | free_netdev(dev); |
1557 | dev_set_drvdata(ddev, NULL); | 1556 | platform_set_drvdata(pdev, NULL); |
1558 | return 0; | 1557 | return 0; |
1559 | } | 1558 | } |
1560 | 1559 | ||
1561 | static int mv643xx_eth_shared_probe(struct device *ddev) | 1560 | static int mv643xx_eth_shared_probe(struct platform_device *pdev) |
1562 | { | 1561 | { |
1563 | struct platform_device *pdev = to_platform_device(ddev); | ||
1564 | struct resource *res; | 1562 | struct resource *res; |
1565 | 1563 | ||
1566 | printk(KERN_NOTICE "MV-643xx 10/100/1000 Ethernet Driver\n"); | 1564 | printk(KERN_NOTICE "MV-643xx 10/100/1000 Ethernet Driver\n"); |
@@ -1578,7 +1576,7 @@ static int mv643xx_eth_shared_probe(struct device *ddev) | |||
1578 | 1576 | ||
1579 | } | 1577 | } |
1580 | 1578 | ||
1581 | static int mv643xx_eth_shared_remove(struct device *ddev) | 1579 | static int mv643xx_eth_shared_remove(struct platform_device *pdev) |
1582 | { | 1580 | { |
1583 | iounmap(mv643xx_eth_shared_base); | 1581 | iounmap(mv643xx_eth_shared_base); |
1584 | mv643xx_eth_shared_base = NULL; | 1582 | mv643xx_eth_shared_base = NULL; |
@@ -1586,18 +1584,20 @@ static int mv643xx_eth_shared_remove(struct device *ddev) | |||
1586 | return 0; | 1584 | return 0; |
1587 | } | 1585 | } |
1588 | 1586 | ||
1589 | static struct device_driver mv643xx_eth_driver = { | 1587 | static struct platform_driver mv643xx_eth_driver = { |
1590 | .name = MV643XX_ETH_NAME, | ||
1591 | .bus = &platform_bus_type, | ||
1592 | .probe = mv643xx_eth_probe, | 1588 | .probe = mv643xx_eth_probe, |
1593 | .remove = mv643xx_eth_remove, | 1589 | .remove = mv643xx_eth_remove, |
1590 | .driver = { | ||
1591 | .name = MV643XX_ETH_NAME, | ||
1592 | }, | ||
1594 | }; | 1593 | }; |
1595 | 1594 | ||
1596 | static struct device_driver mv643xx_eth_shared_driver = { | 1595 | static struct platform_driver mv643xx_eth_shared_driver = { |
1597 | .name = MV643XX_ETH_SHARED_NAME, | ||
1598 | .bus = &platform_bus_type, | ||
1599 | .probe = mv643xx_eth_shared_probe, | 1596 | .probe = mv643xx_eth_shared_probe, |
1600 | .remove = mv643xx_eth_shared_remove, | 1597 | .remove = mv643xx_eth_shared_remove, |
1598 | .driver = { | ||
1599 | .name = MV643XX_ETH_SHARED_NAME, | ||
1600 | }, | ||
1601 | }; | 1601 | }; |
1602 | 1602 | ||
1603 | /* | 1603 | /* |
@@ -1613,11 +1613,11 @@ static int __init mv643xx_init_module(void) | |||
1613 | { | 1613 | { |
1614 | int rc; | 1614 | int rc; |
1615 | 1615 | ||
1616 | rc = driver_register(&mv643xx_eth_shared_driver); | 1616 | rc = platform_driver_register(&mv643xx_eth_shared_driver); |
1617 | if (!rc) { | 1617 | if (!rc) { |
1618 | rc = driver_register(&mv643xx_eth_driver); | 1618 | rc = platform_driver_register(&mv643xx_eth_driver); |
1619 | if (rc) | 1619 | if (rc) |
1620 | driver_unregister(&mv643xx_eth_shared_driver); | 1620 | platform_driver_unregister(&mv643xx_eth_shared_driver); |
1621 | } | 1621 | } |
1622 | return rc; | 1622 | return rc; |
1623 | } | 1623 | } |
@@ -1633,8 +1633,8 @@ static int __init mv643xx_init_module(void) | |||
1633 | */ | 1633 | */ |
1634 | static void __exit mv643xx_cleanup_module(void) | 1634 | static void __exit mv643xx_cleanup_module(void) |
1635 | { | 1635 | { |
1636 | driver_unregister(&mv643xx_eth_driver); | 1636 | platform_driver_unregister(&mv643xx_eth_driver); |
1637 | driver_unregister(&mv643xx_eth_shared_driver); | 1637 | platform_driver_unregister(&mv643xx_eth_shared_driver); |
1638 | } | 1638 | } |
1639 | 1639 | ||
1640 | module_init(mv643xx_init_module); | 1640 | module_init(mv643xx_init_module); |
diff --git a/drivers/net/saa9730.c b/drivers/net/saa9730.c index 110e777f206e..b2acedbefa8f 100644 --- a/drivers/net/saa9730.c +++ b/drivers/net/saa9730.c | |||
@@ -1,8 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * Carsten Langgaard, carstenl@mips.com | 2 | * Copyright (C) 2000, 2005 MIPS Technologies, Inc. All rights reserved. |
3 | * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved. | 3 | * Authors: Carsten Langgaard <carstenl@mips.com> |
4 | * | 4 | * Maciej W. Rozycki <macro@mips.com> |
5 | * ######################################################################## | 5 | * Copyright (C) 2004 Ralf Baechle <ralf@linux-mips.org> |
6 | * | 6 | * |
7 | * This program is free software; you can distribute it and/or modify it | 7 | * This program is free software; you can distribute it and/or modify it |
8 | * under the terms of the GNU General Public License (Version 2) as | 8 | * under the terms of the GNU General Public License (Version 2) as |
@@ -17,15 +17,13 @@ | |||
17 | * with this program; if not, write to the Free Software Foundation, Inc., | 17 | * with this program; if not, write to the Free Software Foundation, Inc., |
18 | * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. | 18 | * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. |
19 | * | 19 | * |
20 | * ######################################################################## | ||
21 | * | ||
22 | * SAA9730 ethernet driver. | 20 | * SAA9730 ethernet driver. |
23 | * | 21 | * |
24 | * Changes: | 22 | * Changes: |
25 | * Angelo Dell'Aera <buffer@antifork.org> : Conversion to the new PCI API (pci_driver). | 23 | * Angelo Dell'Aera <buffer@antifork.org> : Conversion to the new PCI API |
26 | * Conversion to spinlocks. | 24 | * (pci_driver). |
27 | * Error handling fixes. | 25 | * Conversion to spinlocks. |
28 | * | 26 | * Error handling fixes. |
29 | */ | 27 | */ |
30 | 28 | ||
31 | #include <linux/init.h> | 29 | #include <linux/init.h> |
@@ -36,8 +34,11 @@ | |||
36 | #include <linux/skbuff.h> | 34 | #include <linux/skbuff.h> |
37 | #include <linux/pci.h> | 35 | #include <linux/pci.h> |
38 | #include <linux/spinlock.h> | 36 | #include <linux/spinlock.h> |
37 | #include <linux/types.h> | ||
39 | 38 | ||
40 | #include <asm/addrspace.h> | 39 | #include <asm/addrspace.h> |
40 | #include <asm/io.h> | ||
41 | |||
41 | #include <asm/mips-boards/prom.h> | 42 | #include <asm/mips-boards/prom.h> |
42 | 43 | ||
43 | #include "saa9730.h" | 44 | #include "saa9730.h" |
@@ -51,8 +52,8 @@ int lan_saa9730_debug; | |||
51 | #define DRV_MODULE_NAME "saa9730" | 52 | #define DRV_MODULE_NAME "saa9730" |
52 | 53 | ||
53 | static struct pci_device_id saa9730_pci_tbl[] = { | 54 | static struct pci_device_id saa9730_pci_tbl[] = { |
54 | { PCI_VENDOR_ID_PHILIPS, PCI_DEVICE_ID_PHILIPS_SAA9370, | 55 | { PCI_VENDOR_ID_PHILIPS, PCI_DEVICE_ID_PHILIPS_SAA9730, |
55 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, | 56 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, |
56 | { 0, } | 57 | { 0, } |
57 | }; | 58 | }; |
58 | 59 | ||
@@ -61,50 +62,48 @@ MODULE_DEVICE_TABLE(pci, saa9730_pci_tbl); | |||
61 | /* Non-zero only if the current card is a PCI with BIOS-set IRQ. */ | 62 | /* Non-zero only if the current card is a PCI with BIOS-set IRQ. */ |
62 | static unsigned int pci_irq_line; | 63 | static unsigned int pci_irq_line; |
63 | 64 | ||
64 | #define INL(a) inl((unsigned long)a) | ||
65 | #define OUTL(x,a) outl(x,(unsigned long)a) | ||
66 | |||
67 | static void evm_saa9730_enable_lan_int(struct lan_saa9730_private *lp) | 65 | static void evm_saa9730_enable_lan_int(struct lan_saa9730_private *lp) |
68 | { | 66 | { |
69 | OUTL(INL(&lp->evm_saa9730_regs->InterruptBlock1) | EVM_LAN_INT, | 67 | outl(readl(&lp->evm_saa9730_regs->InterruptBlock1) | EVM_LAN_INT, |
70 | &lp->evm_saa9730_regs->InterruptBlock1); | 68 | &lp->evm_saa9730_regs->InterruptBlock1); |
71 | OUTL(INL(&lp->evm_saa9730_regs->InterruptStatus1) | EVM_LAN_INT, | 69 | outl(readl(&lp->evm_saa9730_regs->InterruptStatus1) | EVM_LAN_INT, |
72 | &lp->evm_saa9730_regs->InterruptStatus1); | 70 | &lp->evm_saa9730_regs->InterruptStatus1); |
73 | OUTL(INL(&lp->evm_saa9730_regs->InterruptEnable1) | EVM_LAN_INT | | 71 | outl(readl(&lp->evm_saa9730_regs->InterruptEnable1) | EVM_LAN_INT | |
74 | EVM_MASTER_EN, &lp->evm_saa9730_regs->InterruptEnable1); | 72 | EVM_MASTER_EN, &lp->evm_saa9730_regs->InterruptEnable1); |
75 | } | 73 | } |
74 | |||
76 | static void evm_saa9730_disable_lan_int(struct lan_saa9730_private *lp) | 75 | static void evm_saa9730_disable_lan_int(struct lan_saa9730_private *lp) |
77 | { | 76 | { |
78 | OUTL(INL(&lp->evm_saa9730_regs->InterruptBlock1) & ~EVM_LAN_INT, | 77 | outl(readl(&lp->evm_saa9730_regs->InterruptBlock1) & ~EVM_LAN_INT, |
79 | &lp->evm_saa9730_regs->InterruptBlock1); | 78 | &lp->evm_saa9730_regs->InterruptBlock1); |
80 | OUTL(INL(&lp->evm_saa9730_regs->InterruptEnable1) & ~EVM_LAN_INT, | 79 | outl(readl(&lp->evm_saa9730_regs->InterruptEnable1) & ~EVM_LAN_INT, |
81 | &lp->evm_saa9730_regs->InterruptEnable1); | 80 | &lp->evm_saa9730_regs->InterruptEnable1); |
82 | } | 81 | } |
83 | 82 | ||
84 | static void evm_saa9730_clear_lan_int(struct lan_saa9730_private *lp) | 83 | static void evm_saa9730_clear_lan_int(struct lan_saa9730_private *lp) |
85 | { | 84 | { |
86 | OUTL(EVM_LAN_INT, &lp->evm_saa9730_regs->InterruptStatus1); | 85 | outl(EVM_LAN_INT, &lp->evm_saa9730_regs->InterruptStatus1); |
87 | } | 86 | } |
88 | 87 | ||
89 | static void evm_saa9730_block_lan_int(struct lan_saa9730_private *lp) | 88 | static void evm_saa9730_block_lan_int(struct lan_saa9730_private *lp) |
90 | { | 89 | { |
91 | OUTL(INL(&lp->evm_saa9730_regs->InterruptBlock1) & ~EVM_LAN_INT, | 90 | outl(readl(&lp->evm_saa9730_regs->InterruptBlock1) & ~EVM_LAN_INT, |
92 | &lp->evm_saa9730_regs->InterruptBlock1); | 91 | &lp->evm_saa9730_regs->InterruptBlock1); |
93 | } | 92 | } |
94 | 93 | ||
95 | static void evm_saa9730_unblock_lan_int(struct lan_saa9730_private *lp) | 94 | static void evm_saa9730_unblock_lan_int(struct lan_saa9730_private *lp) |
96 | { | 95 | { |
97 | OUTL(INL(&lp->evm_saa9730_regs->InterruptBlock1) | EVM_LAN_INT, | 96 | outl(readl(&lp->evm_saa9730_regs->InterruptBlock1) | EVM_LAN_INT, |
98 | &lp->evm_saa9730_regs->InterruptBlock1); | 97 | &lp->evm_saa9730_regs->InterruptBlock1); |
99 | } | 98 | } |
100 | 99 | ||
101 | static void show_saa9730_regs(struct lan_saa9730_private *lp) | 100 | static void __attribute_used__ show_saa9730_regs(struct lan_saa9730_private *lp) |
102 | { | 101 | { |
103 | int i, j; | 102 | int i, j; |
104 | printk("TxmBufferA = %x\n", lp->TxmBuffer[0][0]); | 103 | printk("TxmBufferA = %p\n", lp->TxmBuffer[0][0]); |
105 | printk("TxmBufferB = %x\n", lp->TxmBuffer[1][0]); | 104 | printk("TxmBufferB = %p\n", lp->TxmBuffer[1][0]); |
106 | printk("RcvBufferA = %x\n", lp->RcvBuffer[0][0]); | 105 | printk("RcvBufferA = %p\n", lp->RcvBuffer[0][0]); |
107 | printk("RcvBufferB = %x\n", lp->RcvBuffer[1][0]); | 106 | printk("RcvBufferB = %p\n", lp->RcvBuffer[1][0]); |
108 | for (i = 0; i < LAN_SAA9730_BUFFERS; i++) { | 107 | for (i = 0; i < LAN_SAA9730_BUFFERS; i++) { |
109 | for (j = 0; j < LAN_SAA9730_TXM_Q_SIZE; j++) { | 108 | for (j = 0; j < LAN_SAA9730_TXM_Q_SIZE; j++) { |
110 | printk("TxmBuffer[%d][%d] = %x\n", i, j, | 109 | printk("TxmBuffer[%d][%d] = %x\n", i, j, |
@@ -120,13 +119,13 @@ static void show_saa9730_regs(struct lan_saa9730_private *lp) | |||
120 | } | 119 | } |
121 | } | 120 | } |
122 | printk("lp->evm_saa9730_regs->InterruptBlock1 = %x\n", | 121 | printk("lp->evm_saa9730_regs->InterruptBlock1 = %x\n", |
123 | INL(&lp->evm_saa9730_regs->InterruptBlock1)); | 122 | readl(&lp->evm_saa9730_regs->InterruptBlock1)); |
124 | printk("lp->evm_saa9730_regs->InterruptStatus1 = %x\n", | 123 | printk("lp->evm_saa9730_regs->InterruptStatus1 = %x\n", |
125 | INL(&lp->evm_saa9730_regs->InterruptStatus1)); | 124 | readl(&lp->evm_saa9730_regs->InterruptStatus1)); |
126 | printk("lp->evm_saa9730_regs->InterruptEnable1 = %x\n", | 125 | printk("lp->evm_saa9730_regs->InterruptEnable1 = %x\n", |
127 | INL(&lp->evm_saa9730_regs->InterruptEnable1)); | 126 | readl(&lp->evm_saa9730_regs->InterruptEnable1)); |
128 | printk("lp->lan_saa9730_regs->Ok2Use = %x\n", | 127 | printk("lp->lan_saa9730_regs->Ok2Use = %x\n", |
129 | INL(&lp->lan_saa9730_regs->Ok2Use)); | 128 | readl(&lp->lan_saa9730_regs->Ok2Use)); |
130 | printk("lp->NextTxmBufferIndex = %x\n", lp->NextTxmBufferIndex); | 129 | printk("lp->NextTxmBufferIndex = %x\n", lp->NextTxmBufferIndex); |
131 | printk("lp->NextTxmPacketIndex = %x\n", lp->NextTxmPacketIndex); | 130 | printk("lp->NextTxmPacketIndex = %x\n", lp->NextTxmPacketIndex); |
132 | printk("lp->PendingTxmBufferIndex = %x\n", | 131 | printk("lp->PendingTxmBufferIndex = %x\n", |
@@ -134,23 +133,23 @@ static void show_saa9730_regs(struct lan_saa9730_private *lp) | |||
134 | printk("lp->PendingTxmPacketIndex = %x\n", | 133 | printk("lp->PendingTxmPacketIndex = %x\n", |
135 | lp->PendingTxmPacketIndex); | 134 | lp->PendingTxmPacketIndex); |
136 | printk("lp->lan_saa9730_regs->LanDmaCtl = %x\n", | 135 | printk("lp->lan_saa9730_regs->LanDmaCtl = %x\n", |
137 | INL(&lp->lan_saa9730_regs->LanDmaCtl)); | 136 | readl(&lp->lan_saa9730_regs->LanDmaCtl)); |
138 | printk("lp->lan_saa9730_regs->DmaStatus = %x\n", | 137 | printk("lp->lan_saa9730_regs->DmaStatus = %x\n", |
139 | INL(&lp->lan_saa9730_regs->DmaStatus)); | 138 | readl(&lp->lan_saa9730_regs->DmaStatus)); |
140 | printk("lp->lan_saa9730_regs->CamCtl = %x\n", | 139 | printk("lp->lan_saa9730_regs->CamCtl = %x\n", |
141 | INL(&lp->lan_saa9730_regs->CamCtl)); | 140 | readl(&lp->lan_saa9730_regs->CamCtl)); |
142 | printk("lp->lan_saa9730_regs->TxCtl = %x\n", | 141 | printk("lp->lan_saa9730_regs->TxCtl = %x\n", |
143 | INL(&lp->lan_saa9730_regs->TxCtl)); | 142 | readl(&lp->lan_saa9730_regs->TxCtl)); |
144 | printk("lp->lan_saa9730_regs->TxStatus = %x\n", | 143 | printk("lp->lan_saa9730_regs->TxStatus = %x\n", |
145 | INL(&lp->lan_saa9730_regs->TxStatus)); | 144 | readl(&lp->lan_saa9730_regs->TxStatus)); |
146 | printk("lp->lan_saa9730_regs->RxCtl = %x\n", | 145 | printk("lp->lan_saa9730_regs->RxCtl = %x\n", |
147 | INL(&lp->lan_saa9730_regs->RxCtl)); | 146 | readl(&lp->lan_saa9730_regs->RxCtl)); |
148 | printk("lp->lan_saa9730_regs->RxStatus = %x\n", | 147 | printk("lp->lan_saa9730_regs->RxStatus = %x\n", |
149 | INL(&lp->lan_saa9730_regs->RxStatus)); | 148 | readl(&lp->lan_saa9730_regs->RxStatus)); |
150 | for (i = 0; i < LAN_SAA9730_CAM_DWORDS; i++) { | 149 | for (i = 0; i < LAN_SAA9730_CAM_DWORDS; i++) { |
151 | OUTL(i, &lp->lan_saa9730_regs->CamAddress); | 150 | outl(i, &lp->lan_saa9730_regs->CamAddress); |
152 | printk("lp->lan_saa9730_regs->CamData = %x\n", | 151 | printk("lp->lan_saa9730_regs->CamData = %x\n", |
153 | INL(&lp->lan_saa9730_regs->CamData)); | 152 | readl(&lp->lan_saa9730_regs->CamData)); |
154 | } | 153 | } |
155 | printk("lp->stats.tx_packets = %lx\n", lp->stats.tx_packets); | 154 | printk("lp->stats.tx_packets = %lx\n", lp->stats.tx_packets); |
156 | printk("lp->stats.tx_errors = %lx\n", lp->stats.tx_errors); | 155 | printk("lp->stats.tx_errors = %lx\n", lp->stats.tx_errors); |
@@ -178,17 +177,17 @@ static void show_saa9730_regs(struct lan_saa9730_private *lp) | |||
178 | lp->stats.rx_length_errors); | 177 | lp->stats.rx_length_errors); |
179 | 178 | ||
180 | printk("lp->lan_saa9730_regs->DebugPCIMasterAddr = %x\n", | 179 | printk("lp->lan_saa9730_regs->DebugPCIMasterAddr = %x\n", |
181 | INL(&lp->lan_saa9730_regs->DebugPCIMasterAddr)); | 180 | readl(&lp->lan_saa9730_regs->DebugPCIMasterAddr)); |
182 | printk("lp->lan_saa9730_regs->DebugLanTxStateMachine = %x\n", | 181 | printk("lp->lan_saa9730_regs->DebugLanTxStateMachine = %x\n", |
183 | INL(&lp->lan_saa9730_regs->DebugLanTxStateMachine)); | 182 | readl(&lp->lan_saa9730_regs->DebugLanTxStateMachine)); |
184 | printk("lp->lan_saa9730_regs->DebugLanRxStateMachine = %x\n", | 183 | printk("lp->lan_saa9730_regs->DebugLanRxStateMachine = %x\n", |
185 | INL(&lp->lan_saa9730_regs->DebugLanRxStateMachine)); | 184 | readl(&lp->lan_saa9730_regs->DebugLanRxStateMachine)); |
186 | printk("lp->lan_saa9730_regs->DebugLanTxFifoPointers = %x\n", | 185 | printk("lp->lan_saa9730_regs->DebugLanTxFifoPointers = %x\n", |
187 | INL(&lp->lan_saa9730_regs->DebugLanTxFifoPointers)); | 186 | readl(&lp->lan_saa9730_regs->DebugLanTxFifoPointers)); |
188 | printk("lp->lan_saa9730_regs->DebugLanRxFifoPointers = %x\n", | 187 | printk("lp->lan_saa9730_regs->DebugLanRxFifoPointers = %x\n", |
189 | INL(&lp->lan_saa9730_regs->DebugLanRxFifoPointers)); | 188 | readl(&lp->lan_saa9730_regs->DebugLanRxFifoPointers)); |
190 | printk("lp->lan_saa9730_regs->DebugLanCtlStateMachine = %x\n", | 189 | printk("lp->lan_saa9730_regs->DebugLanCtlStateMachine = %x\n", |
191 | INL(&lp->lan_saa9730_regs->DebugLanCtlStateMachine)); | 190 | readl(&lp->lan_saa9730_regs->DebugLanCtlStateMachine)); |
192 | } | 191 | } |
193 | 192 | ||
194 | static void lan_saa9730_buffer_init(struct lan_saa9730_private *lp) | 193 | static void lan_saa9730_buffer_init(struct lan_saa9730_private *lp) |
@@ -214,98 +213,108 @@ static void lan_saa9730_buffer_init(struct lan_saa9730_private *lp) | |||
214 | } | 213 | } |
215 | } | 214 | } |
216 | 215 | ||
217 | static int lan_saa9730_allocate_buffers(struct lan_saa9730_private *lp) | 216 | static void lan_saa9730_free_buffers(struct pci_dev *pdev, |
217 | struct lan_saa9730_private *lp) | ||
218 | { | 218 | { |
219 | unsigned int mem_size; | 219 | pci_free_consistent(pdev, lp->buffer_size, lp->buffer_start, |
220 | void *Pa; | 220 | lp->dma_addr); |
221 | unsigned int i, j, RcvBufferSize, TxmBufferSize; | 221 | } |
222 | unsigned int buffer_start; | ||
223 | 222 | ||
224 | /* | 223 | static int lan_saa9730_allocate_buffers(struct pci_dev *pdev, |
225 | * Allocate all RX and TX packets in one chunk. | 224 | struct lan_saa9730_private *lp) |
226 | * The Rx and Tx packets must be PACKET_SIZE aligned. | 225 | { |
227 | */ | 226 | void *Pa; |
228 | mem_size = ((LAN_SAA9730_RCV_Q_SIZE + LAN_SAA9730_TXM_Q_SIZE) * | 227 | unsigned int i, j, rxoffset, txoffset; |
229 | LAN_SAA9730_PACKET_SIZE * LAN_SAA9730_BUFFERS) + | 228 | int ret; |
230 | LAN_SAA9730_PACKET_SIZE; | ||
231 | buffer_start = | ||
232 | (unsigned int) kmalloc(mem_size, GFP_DMA | GFP_KERNEL); | ||
233 | |||
234 | if (!buffer_start) | ||
235 | return -ENOMEM; | ||
236 | |||
237 | /* | ||
238 | * Set DMA buffer to kseg1 (uncached). | ||
239 | * Make sure to flush before using it uncached. | ||
240 | */ | ||
241 | Pa = (void *) KSEG1ADDR((buffer_start + LAN_SAA9730_PACKET_SIZE) & | ||
242 | ~(LAN_SAA9730_PACKET_SIZE - 1)); | ||
243 | dma_cache_wback_inv((unsigned long) Pa, mem_size); | ||
244 | 229 | ||
245 | /* Initialize buffer space */ | 230 | /* Initialize buffer space */ |
246 | RcvBufferSize = LAN_SAA9730_PACKET_SIZE; | ||
247 | TxmBufferSize = LAN_SAA9730_PACKET_SIZE; | ||
248 | lp->DmaRcvPackets = LAN_SAA9730_RCV_Q_SIZE; | 231 | lp->DmaRcvPackets = LAN_SAA9730_RCV_Q_SIZE; |
249 | lp->DmaTxmPackets = LAN_SAA9730_TXM_Q_SIZE; | 232 | lp->DmaTxmPackets = LAN_SAA9730_TXM_Q_SIZE; |
250 | 233 | ||
234 | /* Initialize Rx Buffer Index */ | ||
235 | lp->NextRcvPacketIndex = 0; | ||
236 | lp->NextRcvBufferIndex = 0; | ||
237 | |||
238 | /* Set current buffer index & next available packet index */ | ||
239 | lp->NextTxmPacketIndex = 0; | ||
240 | lp->NextTxmBufferIndex = 0; | ||
241 | lp->PendingTxmPacketIndex = 0; | ||
242 | lp->PendingTxmBufferIndex = 0; | ||
243 | |||
244 | /* | ||
245 | * Allocate all RX and TX packets in one chunk. | ||
246 | * The Rx and Tx packets must be PACKET_SIZE aligned. | ||
247 | */ | ||
248 | lp->buffer_size = ((LAN_SAA9730_RCV_Q_SIZE + LAN_SAA9730_TXM_Q_SIZE) * | ||
249 | LAN_SAA9730_PACKET_SIZE * LAN_SAA9730_BUFFERS) + | ||
250 | LAN_SAA9730_PACKET_SIZE; | ||
251 | lp->buffer_start = pci_alloc_consistent(pdev, lp->buffer_size, | ||
252 | &lp->dma_addr); | ||
253 | if (!lp->buffer_start) { | ||
254 | ret = -ENOMEM; | ||
255 | goto out; | ||
256 | } | ||
257 | |||
258 | Pa = (void *)ALIGN((unsigned long)lp->buffer_start, | ||
259 | LAN_SAA9730_PACKET_SIZE); | ||
260 | |||
261 | rxoffset = Pa - lp->buffer_start; | ||
262 | |||
251 | /* Init RX buffers */ | 263 | /* Init RX buffers */ |
252 | for (i = 0; i < LAN_SAA9730_BUFFERS; i++) { | 264 | for (i = 0; i < LAN_SAA9730_BUFFERS; i++) { |
253 | for (j = 0; j < LAN_SAA9730_RCV_Q_SIZE; j++) { | 265 | for (j = 0; j < LAN_SAA9730_RCV_Q_SIZE; j++) { |
254 | *(unsigned int *) Pa = | 266 | *(unsigned int *) Pa = |
255 | cpu_to_le32(RXSF_READY << | 267 | cpu_to_le32(RXSF_READY << |
256 | RX_STAT_CTL_OWNER_SHF); | 268 | RX_STAT_CTL_OWNER_SHF); |
257 | lp->RcvBuffer[i][j] = (unsigned int) Pa; | 269 | lp->RcvBuffer[i][j] = Pa; |
258 | Pa += RcvBufferSize; | 270 | Pa += LAN_SAA9730_PACKET_SIZE; |
259 | } | 271 | } |
260 | } | 272 | } |
261 | 273 | ||
274 | txoffset = Pa - lp->buffer_start; | ||
275 | |||
262 | /* Init TX buffers */ | 276 | /* Init TX buffers */ |
263 | for (i = 0; i < LAN_SAA9730_BUFFERS; i++) { | 277 | for (i = 0; i < LAN_SAA9730_BUFFERS; i++) { |
264 | for (j = 0; j < LAN_SAA9730_TXM_Q_SIZE; j++) { | 278 | for (j = 0; j < LAN_SAA9730_TXM_Q_SIZE; j++) { |
265 | *(unsigned int *) Pa = | 279 | *(unsigned int *) Pa = |
266 | cpu_to_le32(TXSF_EMPTY << | 280 | cpu_to_le32(TXSF_EMPTY << |
267 | TX_STAT_CTL_OWNER_SHF); | 281 | TX_STAT_CTL_OWNER_SHF); |
268 | lp->TxmBuffer[i][j] = (unsigned int) Pa; | 282 | lp->TxmBuffer[i][j] = Pa; |
269 | Pa += TxmBufferSize; | 283 | Pa += LAN_SAA9730_PACKET_SIZE; |
270 | } | 284 | } |
271 | } | 285 | } |
272 | 286 | ||
273 | /* | 287 | /* |
274 | * Set rx buffer A and rx buffer B to point to the first two buffer | 288 | * Set rx buffer A and rx buffer B to point to the first two buffer |
275 | * spaces. | 289 | * spaces. |
276 | */ | 290 | */ |
277 | OUTL(PHYSADDR(lp->RcvBuffer[0][0]), | 291 | outl(lp->dma_addr + rxoffset, |
278 | &lp->lan_saa9730_regs->RxBuffA); | 292 | &lp->lan_saa9730_regs->RxBuffA); |
279 | OUTL(PHYSADDR(lp->RcvBuffer[1][0]), | 293 | outl(lp->dma_addr + rxoffset + |
294 | LAN_SAA9730_PACKET_SIZE * LAN_SAA9730_RCV_Q_SIZE, | ||
280 | &lp->lan_saa9730_regs->RxBuffB); | 295 | &lp->lan_saa9730_regs->RxBuffB); |
281 | 296 | ||
282 | /* Initialize Buffer Index */ | 297 | /* |
283 | lp->NextRcvPacketIndex = 0; | ||
284 | lp->NextRcvToUseIsA = 1; | ||
285 | |||
286 | /* Set current buffer index & next availble packet index */ | ||
287 | lp->NextTxmPacketIndex = 0; | ||
288 | lp->NextTxmBufferIndex = 0; | ||
289 | lp->PendingTxmPacketIndex = 0; | ||
290 | lp->PendingTxmBufferIndex = 0; | ||
291 | |||
292 | /* | ||
293 | * Set txm_buf_a and txm_buf_b to point to the first two buffer | 298 | * Set txm_buf_a and txm_buf_b to point to the first two buffer |
294 | * space | 299 | * space |
295 | */ | 300 | */ |
296 | OUTL(PHYSADDR(lp->TxmBuffer[0][0]), | 301 | outl(lp->dma_addr + txoffset, |
297 | &lp->lan_saa9730_regs->TxBuffA); | 302 | &lp->lan_saa9730_regs->TxBuffA); |
298 | OUTL(PHYSADDR(lp->TxmBuffer[1][0]), | 303 | outl(lp->dma_addr + txoffset + |
304 | LAN_SAA9730_PACKET_SIZE * LAN_SAA9730_TXM_Q_SIZE, | ||
299 | &lp->lan_saa9730_regs->TxBuffB); | 305 | &lp->lan_saa9730_regs->TxBuffB); |
300 | 306 | ||
301 | /* Set packet number */ | 307 | /* Set packet number */ |
302 | OUTL((lp->DmaRcvPackets << PK_COUNT_RX_A_SHF) | | 308 | outl((lp->DmaRcvPackets << PK_COUNT_RX_A_SHF) | |
303 | (lp->DmaRcvPackets << PK_COUNT_RX_B_SHF) | | 309 | (lp->DmaRcvPackets << PK_COUNT_RX_B_SHF) | |
304 | (lp->DmaTxmPackets << PK_COUNT_TX_A_SHF) | | 310 | (lp->DmaTxmPackets << PK_COUNT_TX_A_SHF) | |
305 | (lp->DmaTxmPackets << PK_COUNT_TX_B_SHF), | 311 | (lp->DmaTxmPackets << PK_COUNT_TX_B_SHF), |
306 | &lp->lan_saa9730_regs->PacketCount); | 312 | &lp->lan_saa9730_regs->PacketCount); |
307 | 313 | ||
308 | return 0; | 314 | return 0; |
315 | |||
316 | out: | ||
317 | return ret; | ||
309 | } | 318 | } |
310 | 319 | ||
311 | static int lan_saa9730_cam_load(struct lan_saa9730_private *lp) | 320 | static int lan_saa9730_cam_load(struct lan_saa9730_private *lp) |
@@ -317,8 +326,8 @@ static int lan_saa9730_cam_load(struct lan_saa9730_private *lp) | |||
317 | 326 | ||
318 | for (i = 0; i < LAN_SAA9730_CAM_DWORDS; i++) { | 327 | for (i = 0; i < LAN_SAA9730_CAM_DWORDS; i++) { |
319 | /* First set address to where data is written */ | 328 | /* First set address to where data is written */ |
320 | OUTL(i, &lp->lan_saa9730_regs->CamAddress); | 329 | outl(i, &lp->lan_saa9730_regs->CamAddress); |
321 | OUTL((NetworkAddress[0] << 24) | (NetworkAddress[1] << 16) | 330 | outl((NetworkAddress[0] << 24) | (NetworkAddress[1] << 16) |
322 | | (NetworkAddress[2] << 8) | NetworkAddress[3], | 331 | | (NetworkAddress[2] << 8) | NetworkAddress[3], |
323 | &lp->lan_saa9730_regs->CamData); | 332 | &lp->lan_saa9730_regs->CamData); |
324 | NetworkAddress += 4; | 333 | NetworkAddress += 4; |
@@ -328,8 +337,7 @@ static int lan_saa9730_cam_load(struct lan_saa9730_private *lp) | |||
328 | 337 | ||
329 | static int lan_saa9730_cam_init(struct net_device *dev) | 338 | static int lan_saa9730_cam_init(struct net_device *dev) |
330 | { | 339 | { |
331 | struct lan_saa9730_private *lp = | 340 | struct lan_saa9730_private *lp = netdev_priv(dev); |
332 | (struct lan_saa9730_private *) dev->priv; | ||
333 | unsigned int i; | 341 | unsigned int i; |
334 | 342 | ||
335 | /* Copy MAC-address into all entries. */ | 343 | /* Copy MAC-address into all entries. */ |
@@ -347,7 +355,7 @@ static int lan_saa9730_mii_init(struct lan_saa9730_private *lp) | |||
347 | 355 | ||
348 | /* Check link status, spin here till station is not busy. */ | 356 | /* Check link status, spin here till station is not busy. */ |
349 | i = 0; | 357 | i = 0; |
350 | while (INL(&lp->lan_saa9730_regs->StationMgmtCtl) & MD_CA_BUSY) { | 358 | while (readl(&lp->lan_saa9730_regs->StationMgmtCtl) & MD_CA_BUSY) { |
351 | i++; | 359 | i++; |
352 | if (i > 100) { | 360 | if (i > 100) { |
353 | printk("Error: lan_saa9730_mii_init: timeout\n"); | 361 | printk("Error: lan_saa9730_mii_init: timeout\n"); |
@@ -357,12 +365,12 @@ static int lan_saa9730_mii_init(struct lan_saa9730_private *lp) | |||
357 | } | 365 | } |
358 | 366 | ||
359 | /* Now set the control and address register. */ | 367 | /* Now set the control and address register. */ |
360 | OUTL(MD_CA_BUSY | PHY_STATUS | PHY_ADDRESS << MD_CA_PHY_SHF, | 368 | outl(MD_CA_BUSY | PHY_STATUS | PHY_ADDRESS << MD_CA_PHY_SHF, |
361 | &lp->lan_saa9730_regs->StationMgmtCtl); | 369 | &lp->lan_saa9730_regs->StationMgmtCtl); |
362 | 370 | ||
363 | /* check link status, spin here till station is not busy */ | 371 | /* check link status, spin here till station is not busy */ |
364 | i = 0; | 372 | i = 0; |
365 | while (INL(&lp->lan_saa9730_regs->StationMgmtCtl) & MD_CA_BUSY) { | 373 | while (readl(&lp->lan_saa9730_regs->StationMgmtCtl) & MD_CA_BUSY) { |
366 | i++; | 374 | i++; |
367 | if (i > 100) { | 375 | if (i > 100) { |
368 | printk("Error: lan_saa9730_mii_init: timeout\n"); | 376 | printk("Error: lan_saa9730_mii_init: timeout\n"); |
@@ -375,7 +383,7 @@ static int lan_saa9730_mii_init(struct lan_saa9730_private *lp) | |||
375 | mdelay(1); | 383 | mdelay(1); |
376 | 384 | ||
377 | /* Check the link status. */ | 385 | /* Check the link status. */ |
378 | if (INL(&lp->lan_saa9730_regs->StationMgmtData) & | 386 | if (readl(&lp->lan_saa9730_regs->StationMgmtData) & |
379 | PHY_STATUS_LINK_UP) { | 387 | PHY_STATUS_LINK_UP) { |
380 | /* Link is up. */ | 388 | /* Link is up. */ |
381 | return 0; | 389 | return 0; |
@@ -383,14 +391,14 @@ static int lan_saa9730_mii_init(struct lan_saa9730_private *lp) | |||
383 | /* Link is down, reset the PHY first. */ | 391 | /* Link is down, reset the PHY first. */ |
384 | 392 | ||
385 | /* set PHY address = 'CONTROL' */ | 393 | /* set PHY address = 'CONTROL' */ |
386 | OUTL(PHY_ADDRESS << MD_CA_PHY_SHF | MD_CA_WR | PHY_CONTROL, | 394 | outl(PHY_ADDRESS << MD_CA_PHY_SHF | MD_CA_WR | PHY_CONTROL, |
387 | &lp->lan_saa9730_regs->StationMgmtCtl); | 395 | &lp->lan_saa9730_regs->StationMgmtCtl); |
388 | 396 | ||
389 | /* Wait for 1 ms. */ | 397 | /* Wait for 1 ms. */ |
390 | mdelay(1); | 398 | mdelay(1); |
391 | 399 | ||
392 | /* set 'CONTROL' = force reset and renegotiate */ | 400 | /* set 'CONTROL' = force reset and renegotiate */ |
393 | OUTL(PHY_CONTROL_RESET | PHY_CONTROL_AUTO_NEG | | 401 | outl(PHY_CONTROL_RESET | PHY_CONTROL_AUTO_NEG | |
394 | PHY_CONTROL_RESTART_AUTO_NEG, | 402 | PHY_CONTROL_RESTART_AUTO_NEG, |
395 | &lp->lan_saa9730_regs->StationMgmtData); | 403 | &lp->lan_saa9730_regs->StationMgmtData); |
396 | 404 | ||
@@ -398,12 +406,12 @@ static int lan_saa9730_mii_init(struct lan_saa9730_private *lp) | |||
398 | mdelay(50); | 406 | mdelay(50); |
399 | 407 | ||
400 | /* set 'BUSY' to start operation */ | 408 | /* set 'BUSY' to start operation */ |
401 | OUTL(MD_CA_BUSY | PHY_ADDRESS << MD_CA_PHY_SHF | MD_CA_WR | | 409 | outl(MD_CA_BUSY | PHY_ADDRESS << MD_CA_PHY_SHF | MD_CA_WR | |
402 | PHY_CONTROL, &lp->lan_saa9730_regs->StationMgmtCtl); | 410 | PHY_CONTROL, &lp->lan_saa9730_regs->StationMgmtCtl); |
403 | 411 | ||
404 | /* await completion */ | 412 | /* await completion */ |
405 | i = 0; | 413 | i = 0; |
406 | while (INL(&lp->lan_saa9730_regs->StationMgmtCtl) & | 414 | while (readl(&lp->lan_saa9730_regs->StationMgmtCtl) & |
407 | MD_CA_BUSY) { | 415 | MD_CA_BUSY) { |
408 | i++; | 416 | i++; |
409 | if (i > 100) { | 417 | if (i > 100) { |
@@ -419,13 +427,13 @@ static int lan_saa9730_mii_init(struct lan_saa9730_private *lp) | |||
419 | 427 | ||
420 | for (l = 0; l < 2; l++) { | 428 | for (l = 0; l < 2; l++) { |
421 | /* set PHY address = 'STATUS' */ | 429 | /* set PHY address = 'STATUS' */ |
422 | OUTL(MD_CA_BUSY | PHY_ADDRESS << MD_CA_PHY_SHF | | 430 | outl(MD_CA_BUSY | PHY_ADDRESS << MD_CA_PHY_SHF | |
423 | PHY_STATUS, | 431 | PHY_STATUS, |
424 | &lp->lan_saa9730_regs->StationMgmtCtl); | 432 | &lp->lan_saa9730_regs->StationMgmtCtl); |
425 | 433 | ||
426 | /* await completion */ | 434 | /* await completion */ |
427 | i = 0; | 435 | i = 0; |
428 | while (INL(&lp->lan_saa9730_regs->StationMgmtCtl) & | 436 | while (readl(&lp->lan_saa9730_regs->StationMgmtCtl) & |
429 | MD_CA_BUSY) { | 437 | MD_CA_BUSY) { |
430 | i++; | 438 | i++; |
431 | if (i > 100) { | 439 | if (i > 100) { |
@@ -440,7 +448,7 @@ static int lan_saa9730_mii_init(struct lan_saa9730_private *lp) | |||
440 | mdelay(3000); | 448 | mdelay(3000); |
441 | 449 | ||
442 | /* check the link status */ | 450 | /* check the link status */ |
443 | if (INL(&lp->lan_saa9730_regs->StationMgmtData) & | 451 | if (readl(&lp->lan_saa9730_regs->StationMgmtData) & |
444 | PHY_STATUS_LINK_UP) { | 452 | PHY_STATUS_LINK_UP) { |
445 | /* link is up */ | 453 | /* link is up */ |
446 | break; | 454 | break; |
@@ -454,7 +462,7 @@ static int lan_saa9730_mii_init(struct lan_saa9730_private *lp) | |||
454 | static int lan_saa9730_control_init(struct lan_saa9730_private *lp) | 462 | static int lan_saa9730_control_init(struct lan_saa9730_private *lp) |
455 | { | 463 | { |
456 | /* Initialize DMA control register. */ | 464 | /* Initialize DMA control register. */ |
457 | OUTL((LANMB_ANY << DMA_CTL_MAX_XFER_SHF) | | 465 | outl((LANMB_ANY << DMA_CTL_MAX_XFER_SHF) | |
458 | (LANEND_LITTLE << DMA_CTL_ENDIAN_SHF) | | 466 | (LANEND_LITTLE << DMA_CTL_ENDIAN_SHF) | |
459 | (LAN_SAA9730_RCV_Q_INT_THRESHOLD << DMA_CTL_RX_INT_COUNT_SHF) | 467 | (LAN_SAA9730_RCV_Q_INT_THRESHOLD << DMA_CTL_RX_INT_COUNT_SHF) |
460 | | DMA_CTL_RX_INT_TO_EN | DMA_CTL_RX_INT_EN | | 468 | | DMA_CTL_RX_INT_TO_EN | DMA_CTL_RX_INT_EN | |
@@ -462,27 +470,27 @@ static int lan_saa9730_control_init(struct lan_saa9730_private *lp) | |||
462 | &lp->lan_saa9730_regs->LanDmaCtl); | 470 | &lp->lan_saa9730_regs->LanDmaCtl); |
463 | 471 | ||
464 | /* Initial MAC control register. */ | 472 | /* Initial MAC control register. */ |
465 | OUTL((MACCM_MII << MAC_CONTROL_CONN_SHF) | MAC_CONTROL_FULL_DUP, | 473 | outl((MACCM_MII << MAC_CONTROL_CONN_SHF) | MAC_CONTROL_FULL_DUP, |
466 | &lp->lan_saa9730_regs->MacCtl); | 474 | &lp->lan_saa9730_regs->MacCtl); |
467 | 475 | ||
468 | /* Initialize CAM control register. */ | 476 | /* Initialize CAM control register. */ |
469 | OUTL(CAM_CONTROL_COMP_EN | CAM_CONTROL_BROAD_ACC, | 477 | outl(CAM_CONTROL_COMP_EN | CAM_CONTROL_BROAD_ACC, |
470 | &lp->lan_saa9730_regs->CamCtl); | 478 | &lp->lan_saa9730_regs->CamCtl); |
471 | 479 | ||
472 | /* | 480 | /* |
473 | * Initialize CAM enable register, only turn on first entry, should | 481 | * Initialize CAM enable register, only turn on first entry, should |
474 | * contain own addr. | 482 | * contain own addr. |
475 | */ | 483 | */ |
476 | OUTL(0x0001, &lp->lan_saa9730_regs->CamEnable); | 484 | outl(0x0001, &lp->lan_saa9730_regs->CamEnable); |
477 | 485 | ||
478 | /* Initialize Tx control register */ | 486 | /* Initialize Tx control register */ |
479 | OUTL(TX_CTL_EN_COMP, &lp->lan_saa9730_regs->TxCtl); | 487 | outl(TX_CTL_EN_COMP, &lp->lan_saa9730_regs->TxCtl); |
480 | 488 | ||
481 | /* Initialize Rcv control register */ | 489 | /* Initialize Rcv control register */ |
482 | OUTL(RX_CTL_STRIP_CRC, &lp->lan_saa9730_regs->RxCtl); | 490 | outl(RX_CTL_STRIP_CRC, &lp->lan_saa9730_regs->RxCtl); |
483 | 491 | ||
484 | /* Reset DMA engine */ | 492 | /* Reset DMA engine */ |
485 | OUTL(DMA_TEST_SW_RESET, &lp->lan_saa9730_regs->DmaTest); | 493 | outl(DMA_TEST_SW_RESET, &lp->lan_saa9730_regs->DmaTest); |
486 | 494 | ||
487 | return 0; | 495 | return 0; |
488 | } | 496 | } |
@@ -492,21 +500,21 @@ static int lan_saa9730_stop(struct lan_saa9730_private *lp) | |||
492 | int i; | 500 | int i; |
493 | 501 | ||
494 | /* Stop DMA first */ | 502 | /* Stop DMA first */ |
495 | OUTL(INL(&lp->lan_saa9730_regs->LanDmaCtl) & | 503 | outl(readl(&lp->lan_saa9730_regs->LanDmaCtl) & |
496 | ~(DMA_CTL_EN_TX_DMA | DMA_CTL_EN_RX_DMA), | 504 | ~(DMA_CTL_EN_TX_DMA | DMA_CTL_EN_RX_DMA), |
497 | &lp->lan_saa9730_regs->LanDmaCtl); | 505 | &lp->lan_saa9730_regs->LanDmaCtl); |
498 | 506 | ||
499 | /* Set the SW Reset bits in DMA and MAC control registers */ | 507 | /* Set the SW Reset bits in DMA and MAC control registers */ |
500 | OUTL(DMA_TEST_SW_RESET, &lp->lan_saa9730_regs->DmaTest); | 508 | outl(DMA_TEST_SW_RESET, &lp->lan_saa9730_regs->DmaTest); |
501 | OUTL(INL(&lp->lan_saa9730_regs->MacCtl) | MAC_CONTROL_RESET, | 509 | outl(readl(&lp->lan_saa9730_regs->MacCtl) | MAC_CONTROL_RESET, |
502 | &lp->lan_saa9730_regs->MacCtl); | 510 | &lp->lan_saa9730_regs->MacCtl); |
503 | 511 | ||
504 | /* | 512 | /* |
505 | * Wait for MAC reset to have finished. The reset bit is auto cleared | 513 | * Wait for MAC reset to have finished. The reset bit is auto cleared |
506 | * when the reset is done. | 514 | * when the reset is done. |
507 | */ | 515 | */ |
508 | i = 0; | 516 | i = 0; |
509 | while (INL(&lp->lan_saa9730_regs->MacCtl) & MAC_CONTROL_RESET) { | 517 | while (readl(&lp->lan_saa9730_regs->MacCtl) & MAC_CONTROL_RESET) { |
510 | i++; | 518 | i++; |
511 | if (i > 100) { | 519 | if (i > 100) { |
512 | printk | 520 | printk |
@@ -524,7 +532,7 @@ static int lan_saa9730_dma_init(struct lan_saa9730_private *lp) | |||
524 | /* Stop lan controller. */ | 532 | /* Stop lan controller. */ |
525 | lan_saa9730_stop(lp); | 533 | lan_saa9730_stop(lp); |
526 | 534 | ||
527 | OUTL(LAN_SAA9730_DEFAULT_TIME_OUT_CNT, | 535 | outl(LAN_SAA9730_DEFAULT_TIME_OUT_CNT, |
528 | &lp->lan_saa9730_regs->Timeout); | 536 | &lp->lan_saa9730_regs->Timeout); |
529 | 537 | ||
530 | return 0; | 538 | return 0; |
@@ -536,28 +544,27 @@ static int lan_saa9730_start(struct lan_saa9730_private *lp) | |||
536 | 544 | ||
537 | /* Initialize Rx Buffer Index */ | 545 | /* Initialize Rx Buffer Index */ |
538 | lp->NextRcvPacketIndex = 0; | 546 | lp->NextRcvPacketIndex = 0; |
539 | lp->NextRcvToUseIsA = 1; | 547 | lp->NextRcvBufferIndex = 0; |
540 | 548 | ||
541 | /* Set current buffer index & next availble packet index */ | 549 | /* Set current buffer index & next available packet index */ |
542 | lp->NextTxmPacketIndex = 0; | 550 | lp->NextTxmPacketIndex = 0; |
543 | lp->NextTxmBufferIndex = 0; | 551 | lp->NextTxmBufferIndex = 0; |
544 | lp->PendingTxmPacketIndex = 0; | 552 | lp->PendingTxmPacketIndex = 0; |
545 | lp->PendingTxmBufferIndex = 0; | 553 | lp->PendingTxmBufferIndex = 0; |
546 | 554 | ||
547 | OUTL(INL(&lp->lan_saa9730_regs->LanDmaCtl) | DMA_CTL_EN_TX_DMA | | 555 | outl(readl(&lp->lan_saa9730_regs->LanDmaCtl) | DMA_CTL_EN_TX_DMA | |
548 | DMA_CTL_EN_RX_DMA, &lp->lan_saa9730_regs->LanDmaCtl); | 556 | DMA_CTL_EN_RX_DMA, &lp->lan_saa9730_regs->LanDmaCtl); |
549 | 557 | ||
550 | /* For Tx, turn on MAC then DMA */ | 558 | /* For Tx, turn on MAC then DMA */ |
551 | OUTL(INL(&lp->lan_saa9730_regs->TxCtl) | TX_CTL_TX_EN, | 559 | outl(readl(&lp->lan_saa9730_regs->TxCtl) | TX_CTL_TX_EN, |
552 | &lp->lan_saa9730_regs->TxCtl); | 560 | &lp->lan_saa9730_regs->TxCtl); |
553 | 561 | ||
554 | /* For Rx, turn on DMA then MAC */ | 562 | /* For Rx, turn on DMA then MAC */ |
555 | OUTL(INL(&lp->lan_saa9730_regs->RxCtl) | RX_CTL_RX_EN, | 563 | outl(readl(&lp->lan_saa9730_regs->RxCtl) | RX_CTL_RX_EN, |
556 | &lp->lan_saa9730_regs->RxCtl); | 564 | &lp->lan_saa9730_regs->RxCtl); |
557 | 565 | ||
558 | /* Set Ok2Use to let hardware owns the buffers */ | 566 | /* Set Ok2Use to let hardware own the buffers. */ |
559 | OUTL(OK2USE_RX_A | OK2USE_RX_B | OK2USE_TX_A | OK2USE_TX_B, | 567 | outl(OK2USE_RX_A | OK2USE_RX_B, &lp->lan_saa9730_regs->Ok2Use); |
560 | &lp->lan_saa9730_regs->Ok2Use); | ||
561 | 568 | ||
562 | return 0; | 569 | return 0; |
563 | } | 570 | } |
@@ -572,8 +579,7 @@ static int lan_saa9730_restart(struct lan_saa9730_private *lp) | |||
572 | 579 | ||
573 | static int lan_saa9730_tx(struct net_device *dev) | 580 | static int lan_saa9730_tx(struct net_device *dev) |
574 | { | 581 | { |
575 | struct lan_saa9730_private *lp = | 582 | struct lan_saa9730_private *lp = netdev_priv(dev); |
576 | (struct lan_saa9730_private *) dev->priv; | ||
577 | unsigned int *pPacket; | 583 | unsigned int *pPacket; |
578 | unsigned int tx_status; | 584 | unsigned int tx_status; |
579 | 585 | ||
@@ -581,13 +587,11 @@ static int lan_saa9730_tx(struct net_device *dev) | |||
581 | printk("lan_saa9730_tx interrupt\n"); | 587 | printk("lan_saa9730_tx interrupt\n"); |
582 | 588 | ||
583 | /* Clear interrupt. */ | 589 | /* Clear interrupt. */ |
584 | OUTL(DMA_STATUS_MAC_TX_INT, &lp->lan_saa9730_regs->DmaStatus); | 590 | outl(DMA_STATUS_MAC_TX_INT, &lp->lan_saa9730_regs->DmaStatus); |
585 | 591 | ||
586 | while (1) { | 592 | while (1) { |
587 | pPacket = | 593 | pPacket = lp->TxmBuffer[lp->PendingTxmBufferIndex] |
588 | (unsigned int *) lp->TxmBuffer[lp-> | 594 | [lp->PendingTxmPacketIndex]; |
589 | PendingTxmBufferIndex] | ||
590 | [lp->PendingTxmPacketIndex]; | ||
591 | 595 | ||
592 | /* Get status of first packet transmitted. */ | 596 | /* Get status of first packet transmitted. */ |
593 | tx_status = le32_to_cpu(*pPacket); | 597 | tx_status = le32_to_cpu(*pPacket); |
@@ -605,23 +609,22 @@ static int lan_saa9730_tx(struct net_device *dev) | |||
605 | lp->stats.tx_errors++; | 609 | lp->stats.tx_errors++; |
606 | if (tx_status & | 610 | if (tx_status & |
607 | (TX_STATUS_EX_COLL << TX_STAT_CTL_STATUS_SHF)) | 611 | (TX_STATUS_EX_COLL << TX_STAT_CTL_STATUS_SHF)) |
608 | lp->stats.tx_aborted_errors++; | 612 | lp->stats.tx_aborted_errors++; |
609 | if (tx_status & | 613 | if (tx_status & |
610 | (TX_STATUS_LATE_COLL << | 614 | (TX_STATUS_LATE_COLL << TX_STAT_CTL_STATUS_SHF)) |
611 | TX_STAT_CTL_STATUS_SHF)) lp->stats. | 615 | lp->stats.tx_window_errors++; |
612 | tx_window_errors++; | ||
613 | if (tx_status & | 616 | if (tx_status & |
614 | (TX_STATUS_L_CARR << TX_STAT_CTL_STATUS_SHF)) | 617 | (TX_STATUS_L_CARR << TX_STAT_CTL_STATUS_SHF)) |
615 | lp->stats.tx_carrier_errors++; | 618 | lp->stats.tx_carrier_errors++; |
616 | if (tx_status & | 619 | if (tx_status & |
617 | (TX_STATUS_UNDER << TX_STAT_CTL_STATUS_SHF)) | 620 | (TX_STATUS_UNDER << TX_STAT_CTL_STATUS_SHF)) |
618 | lp->stats.tx_fifo_errors++; | 621 | lp->stats.tx_fifo_errors++; |
619 | if (tx_status & | 622 | if (tx_status & |
620 | (TX_STATUS_SQ_ERR << TX_STAT_CTL_STATUS_SHF)) | 623 | (TX_STATUS_SQ_ERR << TX_STAT_CTL_STATUS_SHF)) |
621 | lp->stats.tx_heartbeat_errors++; | 624 | lp->stats.tx_heartbeat_errors++; |
622 | 625 | ||
623 | lp->stats.collisions += | 626 | lp->stats.collisions += |
624 | tx_status & TX_STATUS_TX_COLL_MSK; | 627 | tx_status & TX_STATUS_TX_COLL_MSK; |
625 | } | 628 | } |
626 | 629 | ||
627 | /* Free buffer. */ | 630 | /* Free buffer. */ |
@@ -636,21 +639,15 @@ static int lan_saa9730_tx(struct net_device *dev) | |||
636 | } | 639 | } |
637 | } | 640 | } |
638 | 641 | ||
639 | /* Make sure A and B are available to hardware. */ | 642 | /* The tx buffer is no longer full. */ |
640 | OUTL(OK2USE_TX_A | OK2USE_TX_B, &lp->lan_saa9730_regs->Ok2Use); | 643 | netif_wake_queue(dev); |
641 | |||
642 | if (netif_queue_stopped(dev)) { | ||
643 | /* The tx buffer is no longer full. */ | ||
644 | netif_wake_queue(dev); | ||
645 | } | ||
646 | 644 | ||
647 | return 0; | 645 | return 0; |
648 | } | 646 | } |
649 | 647 | ||
650 | static int lan_saa9730_rx(struct net_device *dev) | 648 | static int lan_saa9730_rx(struct net_device *dev) |
651 | { | 649 | { |
652 | struct lan_saa9730_private *lp = | 650 | struct lan_saa9730_private *lp = netdev_priv(dev); |
653 | (struct lan_saa9730_private *) dev->priv; | ||
654 | int len = 0; | 651 | int len = 0; |
655 | struct sk_buff *skb = 0; | 652 | struct sk_buff *skb = 0; |
656 | unsigned int rx_status; | 653 | unsigned int rx_status; |
@@ -663,16 +660,13 @@ static int lan_saa9730_rx(struct net_device *dev) | |||
663 | printk("lan_saa9730_rx interrupt\n"); | 660 | printk("lan_saa9730_rx interrupt\n"); |
664 | 661 | ||
665 | /* Clear receive interrupts. */ | 662 | /* Clear receive interrupts. */ |
666 | OUTL(DMA_STATUS_MAC_RX_INT | DMA_STATUS_RX_INT | | 663 | outl(DMA_STATUS_MAC_RX_INT | DMA_STATUS_RX_INT | |
667 | DMA_STATUS_RX_TO_INT, &lp->lan_saa9730_regs->DmaStatus); | 664 | DMA_STATUS_RX_TO_INT, &lp->lan_saa9730_regs->DmaStatus); |
668 | 665 | ||
669 | /* Address next packet */ | 666 | /* Address next packet */ |
670 | if (lp->NextRcvToUseIsA) | 667 | BufferIndex = lp->NextRcvBufferIndex; |
671 | BufferIndex = 0; | ||
672 | else | ||
673 | BufferIndex = 1; | ||
674 | PacketIndex = lp->NextRcvPacketIndex; | 668 | PacketIndex = lp->NextRcvPacketIndex; |
675 | pPacket = (unsigned int *) lp->RcvBuffer[BufferIndex][PacketIndex]; | 669 | pPacket = lp->RcvBuffer[BufferIndex][PacketIndex]; |
676 | rx_status = le32_to_cpu(*pPacket); | 670 | rx_status = le32_to_cpu(*pPacket); |
677 | 671 | ||
678 | /* Process each packet. */ | 672 | /* Process each packet. */ |
@@ -715,51 +709,39 @@ static int lan_saa9730_rx(struct net_device *dev) | |||
715 | lp->stats.rx_errors++; | 709 | lp->stats.rx_errors++; |
716 | if (rx_status & | 710 | if (rx_status & |
717 | (RX_STATUS_CRC_ERR << RX_STAT_CTL_STATUS_SHF)) | 711 | (RX_STATUS_CRC_ERR << RX_STAT_CTL_STATUS_SHF)) |
718 | lp->stats.rx_crc_errors++; | 712 | lp->stats.rx_crc_errors++; |
719 | if (rx_status & | 713 | if (rx_status & |
720 | (RX_STATUS_ALIGN_ERR << | 714 | (RX_STATUS_ALIGN_ERR << RX_STAT_CTL_STATUS_SHF)) |
721 | RX_STAT_CTL_STATUS_SHF)) lp->stats. | 715 | lp->stats.rx_frame_errors++; |
722 | rx_frame_errors++; | ||
723 | if (rx_status & | 716 | if (rx_status & |
724 | (RX_STATUS_OVERFLOW << RX_STAT_CTL_STATUS_SHF)) | 717 | (RX_STATUS_OVERFLOW << RX_STAT_CTL_STATUS_SHF)) |
725 | lp->stats.rx_fifo_errors++; | 718 | lp->stats.rx_fifo_errors++; |
726 | if (rx_status & | 719 | if (rx_status & |
727 | (RX_STATUS_LONG_ERR << RX_STAT_CTL_STATUS_SHF)) | 720 | (RX_STATUS_LONG_ERR << RX_STAT_CTL_STATUS_SHF)) |
728 | lp->stats.rx_length_errors++; | 721 | lp->stats.rx_length_errors++; |
729 | } | 722 | } |
730 | 723 | ||
731 | /* Indicate we have processed the buffer. */ | 724 | /* Indicate we have processed the buffer. */ |
732 | *pPacket = | 725 | *pPacket = cpu_to_le32(RXSF_READY << RX_STAT_CTL_OWNER_SHF); |
733 | cpu_to_le32(RXSF_READY << RX_STAT_CTL_OWNER_SHF); | 726 | |
727 | /* Make sure A or B is available to hardware as appropriate. */ | ||
728 | outl(BufferIndex ? OK2USE_RX_B : OK2USE_RX_A, | ||
729 | &lp->lan_saa9730_regs->Ok2Use); | ||
734 | 730 | ||
735 | /* Go to next packet in sequence. */ | 731 | /* Go to next packet in sequence. */ |
736 | lp->NextRcvPacketIndex++; | 732 | lp->NextRcvPacketIndex++; |
737 | if (lp->NextRcvPacketIndex >= LAN_SAA9730_RCV_Q_SIZE) { | 733 | if (lp->NextRcvPacketIndex >= LAN_SAA9730_RCV_Q_SIZE) { |
738 | lp->NextRcvPacketIndex = 0; | 734 | lp->NextRcvPacketIndex = 0; |
739 | if (BufferIndex) { | 735 | lp->NextRcvBufferIndex ^= 1; |
740 | lp->NextRcvToUseIsA = 1; | ||
741 | } else { | ||
742 | lp->NextRcvToUseIsA = 0; | ||
743 | } | ||
744 | } | 736 | } |
745 | OUTL(OK2USE_RX_A | OK2USE_RX_B, | ||
746 | &lp->lan_saa9730_regs->Ok2Use); | ||
747 | 737 | ||
748 | /* Address next packet */ | 738 | /* Address next packet */ |
749 | if (lp->NextRcvToUseIsA) | 739 | BufferIndex = lp->NextRcvBufferIndex; |
750 | BufferIndex = 0; | ||
751 | else | ||
752 | BufferIndex = 1; | ||
753 | PacketIndex = lp->NextRcvPacketIndex; | 740 | PacketIndex = lp->NextRcvPacketIndex; |
754 | pPacket = | 741 | pPacket = lp->RcvBuffer[BufferIndex][PacketIndex]; |
755 | (unsigned int *) lp-> | ||
756 | RcvBuffer[BufferIndex][PacketIndex]; | ||
757 | rx_status = le32_to_cpu(*pPacket); | 742 | rx_status = le32_to_cpu(*pPacket); |
758 | } | 743 | } |
759 | 744 | ||
760 | /* Make sure A and B are available to hardware. */ | ||
761 | OUTL(OK2USE_RX_A | OK2USE_RX_B, &lp->lan_saa9730_regs->Ok2Use); | ||
762 | |||
763 | return 0; | 745 | return 0; |
764 | } | 746 | } |
765 | 747 | ||
@@ -767,8 +749,7 @@ static irqreturn_t lan_saa9730_interrupt(const int irq, void *dev_id, | |||
767 | struct pt_regs *regs) | 749 | struct pt_regs *regs) |
768 | { | 750 | { |
769 | struct net_device *dev = (struct net_device *) dev_id; | 751 | struct net_device *dev = (struct net_device *) dev_id; |
770 | struct lan_saa9730_private *lp = | 752 | struct lan_saa9730_private *lp = netdev_priv(dev); |
771 | (struct lan_saa9730_private *) dev->priv; | ||
772 | 753 | ||
773 | if (lan_saa9730_debug > 5) | 754 | if (lan_saa9730_debug > 5) |
774 | printk("lan_saa9730_interrupt\n"); | 755 | printk("lan_saa9730_interrupt\n"); |
@@ -780,11 +761,11 @@ static irqreturn_t lan_saa9730_interrupt(const int irq, void *dev_id, | |||
780 | evm_saa9730_clear_lan_int(lp); | 761 | evm_saa9730_clear_lan_int(lp); |
781 | 762 | ||
782 | /* Service pending transmit interrupts. */ | 763 | /* Service pending transmit interrupts. */ |
783 | if (INL(&lp->lan_saa9730_regs->DmaStatus) & DMA_STATUS_MAC_TX_INT) | 764 | if (readl(&lp->lan_saa9730_regs->DmaStatus) & DMA_STATUS_MAC_TX_INT) |
784 | lan_saa9730_tx(dev); | 765 | lan_saa9730_tx(dev); |
785 | 766 | ||
786 | /* Service pending receive interrupts. */ | 767 | /* Service pending receive interrupts. */ |
787 | if (INL(&lp->lan_saa9730_regs->DmaStatus) & | 768 | if (readl(&lp->lan_saa9730_regs->DmaStatus) & |
788 | (DMA_STATUS_MAC_RX_INT | DMA_STATUS_RX_INT | | 769 | (DMA_STATUS_MAC_RX_INT | DMA_STATUS_RX_INT | |
789 | DMA_STATUS_RX_TO_INT)) lan_saa9730_rx(dev); | 770 | DMA_STATUS_RX_TO_INT)) lan_saa9730_rx(dev); |
790 | 771 | ||
@@ -794,15 +775,9 @@ static irqreturn_t lan_saa9730_interrupt(const int irq, void *dev_id, | |||
794 | return IRQ_HANDLED; | 775 | return IRQ_HANDLED; |
795 | } | 776 | } |
796 | 777 | ||
797 | static int lan_saa9730_open_fail(struct net_device *dev) | ||
798 | { | ||
799 | return -ENODEV; | ||
800 | } | ||
801 | |||
802 | static int lan_saa9730_open(struct net_device *dev) | 778 | static int lan_saa9730_open(struct net_device *dev) |
803 | { | 779 | { |
804 | struct lan_saa9730_private *lp = | 780 | struct lan_saa9730_private *lp = netdev_priv(dev); |
805 | (struct lan_saa9730_private *) dev->priv; | ||
806 | 781 | ||
807 | /* Associate IRQ with lan_saa9730_interrupt */ | 782 | /* Associate IRQ with lan_saa9730_interrupt */ |
808 | if (request_irq(dev->irq, &lan_saa9730_interrupt, 0, "SAA9730 Eth", | 783 | if (request_irq(dev->irq, &lan_saa9730_interrupt, 0, "SAA9730 Eth", |
@@ -834,15 +809,13 @@ static int lan_saa9730_write(struct lan_saa9730_private *lp, | |||
834 | int PacketIndex; | 809 | int PacketIndex; |
835 | 810 | ||
836 | if (lan_saa9730_debug > 5) | 811 | if (lan_saa9730_debug > 5) |
837 | printk("lan_saa9730_write: skb=%08x\n", | 812 | printk("lan_saa9730_write: skb=%p\n", skb); |
838 | (unsigned int) skb); | ||
839 | 813 | ||
840 | BufferIndex = lp->NextTxmBufferIndex; | 814 | BufferIndex = lp->NextTxmBufferIndex; |
841 | PacketIndex = lp->NextTxmPacketIndex; | 815 | PacketIndex = lp->NextTxmPacketIndex; |
842 | 816 | ||
843 | tx_status = | 817 | tx_status = le32_to_cpu(*(unsigned int *)lp->TxmBuffer[BufferIndex] |
844 | le32_to_cpu(*(unsigned int *) lp-> | 818 | [PacketIndex]); |
845 | TxmBuffer[BufferIndex][PacketIndex]); | ||
846 | if ((tx_status & TX_STAT_CTL_OWNER_MSK) != | 819 | if ((tx_status & TX_STAT_CTL_OWNER_MSK) != |
847 | (TXSF_EMPTY << TX_STAT_CTL_OWNER_SHF)) { | 820 | (TXSF_EMPTY << TX_STAT_CTL_OWNER_SHF)) { |
848 | if (lan_saa9730_debug > 4) | 821 | if (lan_saa9730_debug > 4) |
@@ -858,29 +831,29 @@ static int lan_saa9730_write(struct lan_saa9730_private *lp, | |||
858 | lp->NextTxmBufferIndex ^= 1; | 831 | lp->NextTxmBufferIndex ^= 1; |
859 | } | 832 | } |
860 | 833 | ||
861 | pbPacketData = | 834 | pbPacketData = lp->TxmBuffer[BufferIndex][PacketIndex]; |
862 | (unsigned char *) lp->TxmBuffer[BufferIndex][PacketIndex]; | ||
863 | pbPacketData += 4; | 835 | pbPacketData += 4; |
864 | 836 | ||
865 | /* copy the bits */ | 837 | /* copy the bits */ |
866 | memcpy(pbPacketData, pbData, len); | 838 | memcpy(pbPacketData, pbData, len); |
867 | 839 | ||
868 | /* Set transmit status for hardware */ | 840 | /* Set transmit status for hardware */ |
869 | *(unsigned int *) lp->TxmBuffer[BufferIndex][PacketIndex] = | 841 | *(unsigned int *)lp->TxmBuffer[BufferIndex][PacketIndex] = |
870 | cpu_to_le32((TXSF_READY << TX_STAT_CTL_OWNER_SHF) | | 842 | cpu_to_le32((TXSF_READY << TX_STAT_CTL_OWNER_SHF) | |
871 | (TX_STAT_CTL_INT_AFTER_TX << TX_STAT_CTL_FRAME_SHF) | 843 | (TX_STAT_CTL_INT_AFTER_TX << |
872 | | (len << TX_STAT_CTL_LENGTH_SHF)); | 844 | TX_STAT_CTL_FRAME_SHF) | |
873 | 845 | (len << TX_STAT_CTL_LENGTH_SHF)); | |
874 | /* Set hardware tx buffer. */ | 846 | |
875 | OUTL(OK2USE_TX_A | OK2USE_TX_B, &lp->lan_saa9730_regs->Ok2Use); | 847 | /* Make sure A or B is available to hardware as appropriate. */ |
848 | outl(BufferIndex ? OK2USE_TX_B : OK2USE_TX_A, | ||
849 | &lp->lan_saa9730_regs->Ok2Use); | ||
876 | 850 | ||
877 | return 0; | 851 | return 0; |
878 | } | 852 | } |
879 | 853 | ||
880 | static void lan_saa9730_tx_timeout(struct net_device *dev) | 854 | static void lan_saa9730_tx_timeout(struct net_device *dev) |
881 | { | 855 | { |
882 | struct lan_saa9730_private *lp = | 856 | struct lan_saa9730_private *lp = netdev_priv(dev); |
883 | (struct lan_saa9730_private *) dev->priv; | ||
884 | 857 | ||
885 | /* Transmitter timeout, serious problems */ | 858 | /* Transmitter timeout, serious problems */ |
886 | lp->stats.tx_errors++; | 859 | lp->stats.tx_errors++; |
@@ -889,20 +862,19 @@ static void lan_saa9730_tx_timeout(struct net_device *dev) | |||
889 | lan_saa9730_restart(lp); | 862 | lan_saa9730_restart(lp); |
890 | 863 | ||
891 | dev->trans_start = jiffies; | 864 | dev->trans_start = jiffies; |
892 | netif_start_queue(dev); | 865 | netif_wake_queue(dev); |
893 | } | 866 | } |
894 | 867 | ||
895 | static int lan_saa9730_start_xmit(struct sk_buff *skb, | 868 | static int lan_saa9730_start_xmit(struct sk_buff *skb, |
896 | struct net_device *dev) | 869 | struct net_device *dev) |
897 | { | 870 | { |
898 | struct lan_saa9730_private *lp = | 871 | struct lan_saa9730_private *lp = netdev_priv(dev); |
899 | (struct lan_saa9730_private *) dev->priv; | ||
900 | unsigned long flags; | 872 | unsigned long flags; |
901 | int skblen; | 873 | int skblen; |
902 | int len; | 874 | int len; |
903 | 875 | ||
904 | if (lan_saa9730_debug > 4) | 876 | if (lan_saa9730_debug > 4) |
905 | printk("Send packet: skb=%08x\n", (unsigned int) skb); | 877 | printk("Send packet: skb=%p\n", skb); |
906 | 878 | ||
907 | skblen = skb->len; | 879 | skblen = skb->len; |
908 | 880 | ||
@@ -912,8 +884,7 @@ static int lan_saa9730_start_xmit(struct sk_buff *skb, | |||
912 | 884 | ||
913 | if (lan_saa9730_write(lp, skb, skblen)) { | 885 | if (lan_saa9730_write(lp, skb, skblen)) { |
914 | spin_unlock_irqrestore(&lp->lock, flags); | 886 | spin_unlock_irqrestore(&lp->lock, flags); |
915 | printk("Error when writing packet to controller: skb=%08x\n", | 887 | printk("Error when writing packet to controller: skb=%p\n", skb); |
916 | (unsigned int) skb); | ||
917 | netif_stop_queue(dev); | 888 | netif_stop_queue(dev); |
918 | return -1; | 889 | return -1; |
919 | } | 890 | } |
@@ -922,7 +893,7 @@ static int lan_saa9730_start_xmit(struct sk_buff *skb, | |||
922 | lp->stats.tx_packets++; | 893 | lp->stats.tx_packets++; |
923 | 894 | ||
924 | dev->trans_start = jiffies; | 895 | dev->trans_start = jiffies; |
925 | netif_start_queue(dev); | 896 | netif_wake_queue(dev); |
926 | dev_kfree_skb(skb); | 897 | dev_kfree_skb(skb); |
927 | 898 | ||
928 | spin_unlock_irqrestore(&lp->lock, flags); | 899 | spin_unlock_irqrestore(&lp->lock, flags); |
@@ -932,8 +903,7 @@ static int lan_saa9730_start_xmit(struct sk_buff *skb, | |||
932 | 903 | ||
933 | static int lan_saa9730_close(struct net_device *dev) | 904 | static int lan_saa9730_close(struct net_device *dev) |
934 | { | 905 | { |
935 | struct lan_saa9730_private *lp = | 906 | struct lan_saa9730_private *lp = netdev_priv(dev); |
936 | (struct lan_saa9730_private *) dev->priv; | ||
937 | 907 | ||
938 | if (lan_saa9730_debug > 1) | 908 | if (lan_saa9730_debug > 1) |
939 | printk("lan_saa9730_close:\n"); | 909 | printk("lan_saa9730_close:\n"); |
@@ -955,33 +925,31 @@ static int lan_saa9730_close(struct net_device *dev) | |||
955 | static struct net_device_stats *lan_saa9730_get_stats(struct net_device | 925 | static struct net_device_stats *lan_saa9730_get_stats(struct net_device |
956 | *dev) | 926 | *dev) |
957 | { | 927 | { |
958 | struct lan_saa9730_private *lp = | 928 | struct lan_saa9730_private *lp = netdev_priv(dev); |
959 | (struct lan_saa9730_private *) dev->priv; | ||
960 | 929 | ||
961 | return &lp->stats; | 930 | return &lp->stats; |
962 | } | 931 | } |
963 | 932 | ||
964 | static void lan_saa9730_set_multicast(struct net_device *dev) | 933 | static void lan_saa9730_set_multicast(struct net_device *dev) |
965 | { | 934 | { |
966 | struct lan_saa9730_private *lp = | 935 | struct lan_saa9730_private *lp = netdev_priv(dev); |
967 | (struct lan_saa9730_private *) dev->priv; | ||
968 | 936 | ||
969 | /* Stop the controller */ | 937 | /* Stop the controller */ |
970 | lan_saa9730_stop(lp); | 938 | lan_saa9730_stop(lp); |
971 | 939 | ||
972 | if (dev->flags & IFF_PROMISC) { | 940 | if (dev->flags & IFF_PROMISC) { |
973 | /* accept all packets */ | 941 | /* accept all packets */ |
974 | OUTL(CAM_CONTROL_COMP_EN | CAM_CONTROL_STATION_ACC | | 942 | outl(CAM_CONTROL_COMP_EN | CAM_CONTROL_STATION_ACC | |
975 | CAM_CONTROL_GROUP_ACC | CAM_CONTROL_BROAD_ACC, | 943 | CAM_CONTROL_GROUP_ACC | CAM_CONTROL_BROAD_ACC, |
976 | &lp->lan_saa9730_regs->CamCtl); | 944 | &lp->lan_saa9730_regs->CamCtl); |
977 | } else { | 945 | } else { |
978 | if (dev->flags & IFF_ALLMULTI) { | 946 | if (dev->flags & IFF_ALLMULTI) { |
979 | /* accept all multicast packets */ | 947 | /* accept all multicast packets */ |
980 | OUTL(CAM_CONTROL_COMP_EN | CAM_CONTROL_GROUP_ACC | | 948 | outl(CAM_CONTROL_COMP_EN | CAM_CONTROL_GROUP_ACC | |
981 | CAM_CONTROL_BROAD_ACC, | 949 | CAM_CONTROL_BROAD_ACC, |
982 | &lp->lan_saa9730_regs->CamCtl); | 950 | &lp->lan_saa9730_regs->CamCtl); |
983 | } else { | 951 | } else { |
984 | /* | 952 | /* |
985 | * Will handle the multicast stuff later. -carstenl | 953 | * Will handle the multicast stuff later. -carstenl |
986 | */ | 954 | */ |
987 | } | 955 | } |
@@ -993,91 +961,86 @@ static void lan_saa9730_set_multicast(struct net_device *dev) | |||
993 | 961 | ||
994 | static void __devexit saa9730_remove_one(struct pci_dev *pdev) | 962 | static void __devexit saa9730_remove_one(struct pci_dev *pdev) |
995 | { | 963 | { |
996 | struct net_device *dev = pci_get_drvdata(pdev); | 964 | struct net_device *dev = pci_get_drvdata(pdev); |
997 | 965 | struct lan_saa9730_private *lp = netdev_priv(dev); | |
998 | if (dev) { | 966 | |
999 | unregister_netdev(dev); | 967 | if (dev) { |
1000 | kfree(dev->priv); | 968 | unregister_netdev(dev); |
1001 | free_netdev(dev); | 969 | lan_saa9730_free_buffers(pdev, lp); |
1002 | pci_release_regions(pdev); | 970 | iounmap(lp->lan_saa9730_regs); |
1003 | pci_disable_device(pdev); | 971 | iounmap(lp->evm_saa9730_regs); |
1004 | pci_set_drvdata(pdev, NULL); | 972 | free_netdev(dev); |
1005 | } | 973 | pci_release_regions(pdev); |
974 | pci_disable_device(pdev); | ||
975 | pci_set_drvdata(pdev, NULL); | ||
976 | } | ||
1006 | } | 977 | } |
1007 | 978 | ||
1008 | 979 | ||
1009 | static int lan_saa9730_init(struct net_device *dev, int ioaddr, int irq) | 980 | static int lan_saa9730_init(struct net_device *dev, struct pci_dev *pdev, |
981 | unsigned long ioaddr, int irq) | ||
1010 | { | 982 | { |
1011 | struct lan_saa9730_private *lp; | 983 | struct lan_saa9730_private *lp = netdev_priv(dev); |
1012 | unsigned char ethernet_addr[6]; | 984 | unsigned char ethernet_addr[6]; |
1013 | int ret = 0; | 985 | int ret; |
1014 | 986 | ||
1015 | dev->open = lan_saa9730_open_fail; | 987 | if (get_ethernet_addr(ethernet_addr)) { |
988 | ret = -ENODEV; | ||
989 | goto out; | ||
990 | } | ||
1016 | 991 | ||
1017 | if (get_ethernet_addr(ethernet_addr)) | ||
1018 | return -ENODEV; | ||
1019 | |||
1020 | memcpy(dev->dev_addr, ethernet_addr, 6); | 992 | memcpy(dev->dev_addr, ethernet_addr, 6); |
1021 | dev->base_addr = ioaddr; | 993 | dev->base_addr = ioaddr; |
1022 | dev->irq = irq; | 994 | dev->irq = irq; |
1023 | |||
1024 | /* | ||
1025 | * Make certain the data structures used by the controller are aligned | ||
1026 | * and DMAble. | ||
1027 | */ | ||
1028 | /* | ||
1029 | * XXX: that is obviously broken - kfree() won't be happy with us. | ||
1030 | */ | ||
1031 | lp = (struct lan_saa9730_private *) (((unsigned long) | ||
1032 | kmalloc(sizeof(*lp) + 7, | ||
1033 | GFP_DMA | GFP_KERNEL) | ||
1034 | + 7) & ~7); | ||
1035 | 995 | ||
1036 | if (!lp) | 996 | lp->pci_dev = pdev; |
1037 | return -ENOMEM; | ||
1038 | |||
1039 | dev->priv = lp; | ||
1040 | memset(lp, 0, sizeof(*lp)); | ||
1041 | 997 | ||
1042 | /* Set SAA9730 LAN base address. */ | 998 | /* Set SAA9730 LAN base address. */ |
1043 | lp->lan_saa9730_regs = (t_lan_saa9730_regmap *) (ioaddr + | 999 | lp->lan_saa9730_regs = ioremap(ioaddr + SAA9730_LAN_REGS_ADDR, |
1044 | SAA9730_LAN_REGS_ADDR); | 1000 | SAA9730_LAN_REGS_SIZE); |
1001 | if (!lp->lan_saa9730_regs) { | ||
1002 | ret = -ENOMEM; | ||
1003 | goto out; | ||
1004 | } | ||
1045 | 1005 | ||
1046 | /* Set SAA9730 EVM base address. */ | 1006 | /* Set SAA9730 EVM base address. */ |
1047 | lp->evm_saa9730_regs = (t_evm_saa9730_regmap *) (ioaddr + | 1007 | lp->evm_saa9730_regs = ioremap(ioaddr + SAA9730_EVM_REGS_ADDR, |
1048 | SAA9730_EVM_REGS_ADDR); | 1008 | SAA9730_EVM_REGS_SIZE); |
1009 | if (!lp->evm_saa9730_regs) { | ||
1010 | ret = -ENOMEM; | ||
1011 | goto out_iounmap_lan; | ||
1012 | } | ||
1049 | 1013 | ||
1050 | /* Allocate LAN RX/TX frame buffer space. */ | 1014 | /* Allocate LAN RX/TX frame buffer space. */ |
1051 | /* FIXME: a leak */ | 1015 | if ((ret = lan_saa9730_allocate_buffers(pdev, lp))) |
1052 | if ((ret = lan_saa9730_allocate_buffers(lp))) | 1016 | goto out_iounmap; |
1053 | goto out; | ||
1054 | 1017 | ||
1055 | /* Stop LAN controller. */ | 1018 | /* Stop LAN controller. */ |
1056 | if ((ret = lan_saa9730_stop(lp))) | 1019 | if ((ret = lan_saa9730_stop(lp))) |
1057 | goto out; | 1020 | goto out_free_consistent; |
1058 | 1021 | ||
1059 | /* Initialize CAM registers. */ | 1022 | /* Initialize CAM registers. */ |
1060 | if ((ret = lan_saa9730_cam_init(dev))) | 1023 | if ((ret = lan_saa9730_cam_init(dev))) |
1061 | goto out; | 1024 | goto out_free_consistent; |
1062 | 1025 | ||
1063 | /* Initialize MII registers. */ | 1026 | /* Initialize MII registers. */ |
1064 | if ((ret = lan_saa9730_mii_init(lp))) | 1027 | if ((ret = lan_saa9730_mii_init(lp))) |
1065 | goto out; | 1028 | goto out_free_consistent; |
1066 | 1029 | ||
1067 | /* Initialize control registers. */ | 1030 | /* Initialize control registers. */ |
1068 | if ((ret = lan_saa9730_control_init(lp))) | 1031 | if ((ret = lan_saa9730_control_init(lp))) |
1069 | goto out; | 1032 | goto out_free_consistent; |
1070 | 1033 | ||
1071 | /* Load CAM registers. */ | 1034 | /* Load CAM registers. */ |
1072 | if ((ret = lan_saa9730_cam_load(lp))) | 1035 | if ((ret = lan_saa9730_cam_load(lp))) |
1073 | goto out; | 1036 | goto out_free_consistent; |
1074 | 1037 | ||
1075 | /* Initialize DMA context registers. */ | 1038 | /* Initialize DMA context registers. */ |
1076 | if ((ret = lan_saa9730_dma_init(lp))) | 1039 | if ((ret = lan_saa9730_dma_init(lp))) |
1077 | goto out; | 1040 | goto out_free_consistent; |
1078 | 1041 | ||
1079 | spin_lock_init(&lp->lock); | 1042 | spin_lock_init(&lp->lock); |
1080 | 1043 | ||
1081 | dev->open = lan_saa9730_open; | 1044 | dev->open = lan_saa9730_open; |
1082 | dev->hard_start_xmit = lan_saa9730_start_xmit; | 1045 | dev->hard_start_xmit = lan_saa9730_start_xmit; |
1083 | dev->stop = lan_saa9730_close; | 1046 | dev->stop = lan_saa9730_close; |
@@ -1086,44 +1049,43 @@ static int lan_saa9730_init(struct net_device *dev, int ioaddr, int irq) | |||
1086 | dev->tx_timeout = lan_saa9730_tx_timeout; | 1049 | dev->tx_timeout = lan_saa9730_tx_timeout; |
1087 | dev->watchdog_timeo = (HZ >> 1); | 1050 | dev->watchdog_timeo = (HZ >> 1); |
1088 | dev->dma = 0; | 1051 | dev->dma = 0; |
1089 | 1052 | ||
1090 | ret = register_netdev(dev); | 1053 | ret = register_netdev (dev); |
1091 | if (ret) | 1054 | if (ret) |
1092 | goto out; | 1055 | goto out_free_consistent; |
1056 | |||
1093 | return 0; | 1057 | return 0; |
1094 | 1058 | ||
1095 | out: | 1059 | out_free_consistent: |
1096 | kfree(dev->priv); | 1060 | lan_saa9730_free_buffers(pdev, lp); |
1061 | out_iounmap: | ||
1062 | iounmap(lp->evm_saa9730_regs); | ||
1063 | out_iounmap_lan: | ||
1064 | iounmap(lp->lan_saa9730_regs); | ||
1065 | out: | ||
1097 | return ret; | 1066 | return ret; |
1098 | } | 1067 | } |
1099 | 1068 | ||
1100 | 1069 | ||
1101 | static int __devinit saa9730_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | 1070 | static int __devinit saa9730_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
1102 | { | 1071 | { |
1103 | struct net_device *dev; | 1072 | struct net_device *dev = NULL; |
1104 | unsigned int pci_ioaddr; | 1073 | unsigned long pci_ioaddr; |
1105 | int err; | 1074 | int err; |
1106 | 1075 | ||
1107 | if (lan_saa9730_debug > 1) | 1076 | if (lan_saa9730_debug > 1) |
1108 | printk("saa9730.c: PCI bios is present, checking for devices...\n"); | 1077 | printk("saa9730.c: PCI bios is present, checking for devices...\n"); |
1109 | 1078 | ||
1110 | err = -ENOMEM; | ||
1111 | dev = alloc_etherdev(0); | ||
1112 | if (!dev) | ||
1113 | goto out; | ||
1114 | |||
1115 | SET_MODULE_OWNER(dev); | ||
1116 | |||
1117 | err = pci_enable_device(pdev); | 1079 | err = pci_enable_device(pdev); |
1118 | if (err) { | 1080 | if (err) { |
1119 | printk(KERN_ERR "Cannot enable PCI device, aborting.\n"); | 1081 | printk(KERN_ERR "Cannot enable PCI device, aborting.\n"); |
1120 | goto out1; | 1082 | goto out; |
1121 | } | 1083 | } |
1122 | 1084 | ||
1123 | err = pci_request_regions(pdev, DRV_MODULE_NAME); | 1085 | err = pci_request_regions(pdev, DRV_MODULE_NAME); |
1124 | if (err) { | 1086 | if (err) { |
1125 | printk(KERN_ERR "Cannot obtain PCI resources, aborting.\n"); | 1087 | printk(KERN_ERR "Cannot obtain PCI resources, aborting.\n"); |
1126 | goto out2; | 1088 | goto out_disable_pdev; |
1127 | } | 1089 | } |
1128 | 1090 | ||
1129 | pci_irq_line = pdev->irq; | 1091 | pci_irq_line = pdev->irq; |
@@ -1132,49 +1094,54 @@ static int __devinit saa9730_init_one(struct pci_dev *pdev, const struct pci_dev | |||
1132 | pci_ioaddr = pci_resource_start(pdev, 1); | 1094 | pci_ioaddr = pci_resource_start(pdev, 1); |
1133 | pci_set_master(pdev); | 1095 | pci_set_master(pdev); |
1134 | 1096 | ||
1135 | printk("Found SAA9730 (PCI) at %#x, irq %d.\n", | 1097 | printk("Found SAA9730 (PCI) at %lx, irq %d.\n", |
1136 | pci_ioaddr, pci_irq_line); | 1098 | pci_ioaddr, pci_irq_line); |
1137 | 1099 | ||
1138 | err = lan_saa9730_init(dev, pci_ioaddr, pci_irq_line); | 1100 | dev = alloc_etherdev(sizeof(struct lan_saa9730_private)); |
1101 | if (!dev) | ||
1102 | goto out_disable_pdev; | ||
1103 | |||
1104 | err = lan_saa9730_init(dev, pdev, pci_ioaddr, pci_irq_line); | ||
1139 | if (err) { | 1105 | if (err) { |
1140 | printk("Lan init failed"); | 1106 | printk("LAN init failed"); |
1141 | goto out2; | 1107 | goto out_free_netdev; |
1142 | } | 1108 | } |
1143 | 1109 | ||
1144 | pci_set_drvdata(pdev, dev); | 1110 | pci_set_drvdata(pdev, dev); |
1145 | SET_NETDEV_DEV(dev, &pdev->dev); | 1111 | SET_NETDEV_DEV(dev, &pdev->dev); |
1146 | return 0; | 1112 | return 0; |
1147 | 1113 | ||
1148 | out2: | 1114 | out_free_netdev: |
1149 | pci_disable_device(pdev); | ||
1150 | out1: | ||
1151 | free_netdev(dev); | 1115 | free_netdev(dev); |
1116 | out_disable_pdev: | ||
1117 | pci_disable_device(pdev); | ||
1152 | out: | 1118 | out: |
1119 | pci_set_drvdata(pdev, NULL); | ||
1153 | return err; | 1120 | return err; |
1154 | } | 1121 | } |
1155 | 1122 | ||
1156 | 1123 | ||
1157 | static struct pci_driver saa9730_driver = { | 1124 | static struct pci_driver saa9730_driver = { |
1158 | .name = DRV_MODULE_NAME, | 1125 | .name = DRV_MODULE_NAME, |
1159 | .id_table = saa9730_pci_tbl, | 1126 | .id_table = saa9730_pci_tbl, |
1160 | .probe = saa9730_init_one, | 1127 | .probe = saa9730_init_one, |
1161 | .remove = __devexit_p(saa9730_remove_one), | 1128 | .remove = __devexit_p(saa9730_remove_one), |
1162 | }; | 1129 | }; |
1163 | 1130 | ||
1164 | 1131 | ||
1165 | static int __init saa9730_init(void) | 1132 | static int __init saa9730_init(void) |
1166 | { | 1133 | { |
1167 | return pci_module_init(&saa9730_driver); | 1134 | return pci_module_init(&saa9730_driver); |
1168 | } | 1135 | } |
1169 | 1136 | ||
1170 | static void __exit saa9730_cleanup(void) | 1137 | static void __exit saa9730_cleanup(void) |
1171 | { | 1138 | { |
1172 | pci_unregister_driver(&saa9730_driver); | 1139 | pci_unregister_driver(&saa9730_driver); |
1173 | } | 1140 | } |
1174 | 1141 | ||
1175 | module_init(saa9730_init); | 1142 | module_init(saa9730_init); |
1176 | module_exit(saa9730_cleanup); | 1143 | module_exit(saa9730_cleanup); |
1177 | 1144 | ||
1178 | 1145 | MODULE_AUTHOR("Ralf Baechle <ralf@linux-mips.org>"); | |
1179 | 1146 | MODULE_DESCRIPTION("Philips SAA9730 ethernet driver"); | |
1180 | MODULE_LICENSE("GPL"); | 1147 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c index 74d5f1a6fdea..c91e2e81f131 100644 --- a/drivers/net/smc91x.c +++ b/drivers/net/smc91x.c | |||
@@ -2183,9 +2183,8 @@ static void smc_release_datacs(struct platform_device *pdev, struct net_device * | |||
2183 | * 0 --> there is a device | 2183 | * 0 --> there is a device |
2184 | * anything else, error | 2184 | * anything else, error |
2185 | */ | 2185 | */ |
2186 | static int smc_drv_probe(struct device *dev) | 2186 | static int smc_drv_probe(struct platform_device *pdev) |
2187 | { | 2187 | { |
2188 | struct platform_device *pdev = to_platform_device(dev); | ||
2189 | struct net_device *ndev; | 2188 | struct net_device *ndev; |
2190 | struct resource *res; | 2189 | struct resource *res; |
2191 | unsigned int __iomem *addr; | 2190 | unsigned int __iomem *addr; |
@@ -2212,7 +2211,7 @@ static int smc_drv_probe(struct device *dev) | |||
2212 | goto out_release_io; | 2211 | goto out_release_io; |
2213 | } | 2212 | } |
2214 | SET_MODULE_OWNER(ndev); | 2213 | SET_MODULE_OWNER(ndev); |
2215 | SET_NETDEV_DEV(ndev, dev); | 2214 | SET_NETDEV_DEV(ndev, &pdev->dev); |
2216 | 2215 | ||
2217 | ndev->dma = (unsigned char)-1; | 2216 | ndev->dma = (unsigned char)-1; |
2218 | ndev->irq = platform_get_irq(pdev, 0); | 2217 | ndev->irq = platform_get_irq(pdev, 0); |
@@ -2233,7 +2232,7 @@ static int smc_drv_probe(struct device *dev) | |||
2233 | goto out_release_attrib; | 2232 | goto out_release_attrib; |
2234 | } | 2233 | } |
2235 | 2234 | ||
2236 | dev_set_drvdata(dev, ndev); | 2235 | platform_set_drvdata(pdev, ndev); |
2237 | ret = smc_probe(ndev, addr); | 2236 | ret = smc_probe(ndev, addr); |
2238 | if (ret != 0) | 2237 | if (ret != 0) |
2239 | goto out_iounmap; | 2238 | goto out_iounmap; |
@@ -2249,7 +2248,7 @@ static int smc_drv_probe(struct device *dev) | |||
2249 | return 0; | 2248 | return 0; |
2250 | 2249 | ||
2251 | out_iounmap: | 2250 | out_iounmap: |
2252 | dev_set_drvdata(dev, NULL); | 2251 | platform_set_drvdata(pdev, NULL); |
2253 | iounmap(addr); | 2252 | iounmap(addr); |
2254 | out_release_attrib: | 2253 | out_release_attrib: |
2255 | smc_release_attrib(pdev); | 2254 | smc_release_attrib(pdev); |
@@ -2263,14 +2262,13 @@ static int smc_drv_probe(struct device *dev) | |||
2263 | return ret; | 2262 | return ret; |
2264 | } | 2263 | } |
2265 | 2264 | ||
2266 | static int smc_drv_remove(struct device *dev) | 2265 | static int smc_drv_remove(struct platform_device *pdev) |
2267 | { | 2266 | { |
2268 | struct platform_device *pdev = to_platform_device(dev); | 2267 | struct net_device *ndev = platform_get_drvdata(pdev); |
2269 | struct net_device *ndev = dev_get_drvdata(dev); | ||
2270 | struct smc_local *lp = netdev_priv(ndev); | 2268 | struct smc_local *lp = netdev_priv(ndev); |
2271 | struct resource *res; | 2269 | struct resource *res; |
2272 | 2270 | ||
2273 | dev_set_drvdata(dev, NULL); | 2271 | platform_set_drvdata(pdev, NULL); |
2274 | 2272 | ||
2275 | unregister_netdev(ndev); | 2273 | unregister_netdev(ndev); |
2276 | 2274 | ||
@@ -2295,9 +2293,9 @@ static int smc_drv_remove(struct device *dev) | |||
2295 | return 0; | 2293 | return 0; |
2296 | } | 2294 | } |
2297 | 2295 | ||
2298 | static int smc_drv_suspend(struct device *dev, pm_message_t state) | 2296 | static int smc_drv_suspend(struct platform_device *dev, pm_message_t state) |
2299 | { | 2297 | { |
2300 | struct net_device *ndev = dev_get_drvdata(dev); | 2298 | struct net_device *ndev = platform_get_drvdata(dev); |
2301 | 2299 | ||
2302 | if (ndev) { | 2300 | if (ndev) { |
2303 | if (netif_running(ndev)) { | 2301 | if (netif_running(ndev)) { |
@@ -2309,14 +2307,13 @@ static int smc_drv_suspend(struct device *dev, pm_message_t state) | |||
2309 | return 0; | 2307 | return 0; |
2310 | } | 2308 | } |
2311 | 2309 | ||
2312 | static int smc_drv_resume(struct device *dev) | 2310 | static int smc_drv_resume(struct platform_device *dev) |
2313 | { | 2311 | { |
2314 | struct platform_device *pdev = to_platform_device(dev); | 2312 | struct net_device *ndev = platform_get_drvdata(dev); |
2315 | struct net_device *ndev = dev_get_drvdata(dev); | ||
2316 | 2313 | ||
2317 | if (ndev) { | 2314 | if (ndev) { |
2318 | struct smc_local *lp = netdev_priv(ndev); | 2315 | struct smc_local *lp = netdev_priv(ndev); |
2319 | smc_enable_device(pdev); | 2316 | smc_enable_device(dev); |
2320 | if (netif_running(ndev)) { | 2317 | if (netif_running(ndev)) { |
2321 | smc_reset(ndev); | 2318 | smc_reset(ndev); |
2322 | smc_enable(ndev); | 2319 | smc_enable(ndev); |
@@ -2328,13 +2325,14 @@ static int smc_drv_resume(struct device *dev) | |||
2328 | return 0; | 2325 | return 0; |
2329 | } | 2326 | } |
2330 | 2327 | ||
2331 | static struct device_driver smc_driver = { | 2328 | static struct platform_driver smc_driver = { |
2332 | .name = CARDNAME, | ||
2333 | .bus = &platform_bus_type, | ||
2334 | .probe = smc_drv_probe, | 2329 | .probe = smc_drv_probe, |
2335 | .remove = smc_drv_remove, | 2330 | .remove = smc_drv_remove, |
2336 | .suspend = smc_drv_suspend, | 2331 | .suspend = smc_drv_suspend, |
2337 | .resume = smc_drv_resume, | 2332 | .resume = smc_drv_resume, |
2333 | .driver = { | ||
2334 | .name = CARDNAME, | ||
2335 | }, | ||
2338 | }; | 2336 | }; |
2339 | 2337 | ||
2340 | static int __init smc_init(void) | 2338 | static int __init smc_init(void) |
@@ -2348,12 +2346,12 @@ static int __init smc_init(void) | |||
2348 | #endif | 2346 | #endif |
2349 | #endif | 2347 | #endif |
2350 | 2348 | ||
2351 | return driver_register(&smc_driver); | 2349 | return platform_driver_register(&smc_driver); |
2352 | } | 2350 | } |
2353 | 2351 | ||
2354 | static void __exit smc_cleanup(void) | 2352 | static void __exit smc_cleanup(void) |
2355 | { | 2353 | { |
2356 | driver_unregister(&smc_driver); | 2354 | platform_driver_unregister(&smc_driver); |
2357 | } | 2355 | } |
2358 | 2356 | ||
2359 | module_init(smc_init); | 2357 | module_init(smc_init); |
diff --git a/drivers/net/smc91x.h b/drivers/net/smc91x.h index 817f200742c3..a10cd184d597 100644 --- a/drivers/net/smc91x.h +++ b/drivers/net/smc91x.h | |||
@@ -289,6 +289,38 @@ static inline void SMC_outsw (unsigned long a, int r, unsigned char* p, int l) | |||
289 | #define RPC_LSA_DEFAULT RPC_LED_TX_RX | 289 | #define RPC_LSA_DEFAULT RPC_LED_TX_RX |
290 | #define RPC_LSB_DEFAULT RPC_LED_100_10 | 290 | #define RPC_LSB_DEFAULT RPC_LED_100_10 |
291 | 291 | ||
292 | #elif defined(CONFIG_SOC_AU1X00) | ||
293 | |||
294 | #include <au1xxx.h> | ||
295 | |||
296 | /* We can only do 16-bit reads and writes in the static memory space. */ | ||
297 | #define SMC_CAN_USE_8BIT 0 | ||
298 | #define SMC_CAN_USE_16BIT 1 | ||
299 | #define SMC_CAN_USE_32BIT 0 | ||
300 | #define SMC_IO_SHIFT 0 | ||
301 | #define SMC_NOWAIT 1 | ||
302 | |||
303 | #define SMC_inw(a, r) au_readw((unsigned long)((a) + (r))) | ||
304 | #define SMC_insw(a, r, p, l) \ | ||
305 | do { \ | ||
306 | unsigned long _a = (unsigned long)((a) + (r)); \ | ||
307 | int _l = (l); \ | ||
308 | u16 *_p = (u16 *)(p); \ | ||
309 | while (_l-- > 0) \ | ||
310 | *_p++ = au_readw(_a); \ | ||
311 | } while(0) | ||
312 | #define SMC_outw(v, a, r) au_writew(v, (unsigned long)((a) + (r))) | ||
313 | #define SMC_outsw(a, r, p, l) \ | ||
314 | do { \ | ||
315 | unsigned long _a = (unsigned long)((a) + (r)); \ | ||
316 | int _l = (l); \ | ||
317 | const u16 *_p = (const u16 *)(p); \ | ||
318 | while (_l-- > 0) \ | ||
319 | au_writew(*_p++ , _a); \ | ||
320 | } while(0) | ||
321 | |||
322 | #define set_irq_type(irq, type) do {} while (0) | ||
323 | |||
292 | #else | 324 | #else |
293 | 325 | ||
294 | #define SMC_CAN_USE_8BIT 1 | 326 | #define SMC_CAN_USE_8BIT 1 |
diff --git a/drivers/net/spider_net.c b/drivers/net/spider_net.c index c796f41b4a52..0d765f1733b5 100644 --- a/drivers/net/spider_net.c +++ b/drivers/net/spider_net.c | |||
@@ -2290,7 +2290,6 @@ spider_net_remove(struct pci_dev *pdev) | |||
2290 | } | 2290 | } |
2291 | 2291 | ||
2292 | static struct pci_driver spider_net_driver = { | 2292 | static struct pci_driver spider_net_driver = { |
2293 | .owner = THIS_MODULE, | ||
2294 | .name = spider_net_driver_name, | 2293 | .name = spider_net_driver_name, |
2295 | .id_table = spider_net_pci_tbl, | 2294 | .id_table = spider_net_pci_tbl, |
2296 | .probe = spider_net_probe, | 2295 | .probe = spider_net_probe, |
diff --git a/drivers/net/tokenring/proteon.c b/drivers/net/tokenring/proteon.c index d04c918ebef8..4f756960db2a 100644 --- a/drivers/net/tokenring/proteon.c +++ b/drivers/net/tokenring/proteon.c | |||
@@ -344,9 +344,10 @@ module_param_array(dma, int, NULL, 0); | |||
344 | 344 | ||
345 | static struct platform_device *proteon_dev[ISATR_MAX_ADAPTERS]; | 345 | static struct platform_device *proteon_dev[ISATR_MAX_ADAPTERS]; |
346 | 346 | ||
347 | static struct device_driver proteon_driver = { | 347 | static struct platform_driver proteon_driver = { |
348 | .name = "proteon", | 348 | .driver = { |
349 | .bus = &platform_bus_type, | 349 | .name = "proteon", |
350 | }, | ||
350 | }; | 351 | }; |
351 | 352 | ||
352 | static int __init proteon_init(void) | 353 | static int __init proteon_init(void) |
@@ -355,7 +356,7 @@ static int __init proteon_init(void) | |||
355 | struct platform_device *pdev; | 356 | struct platform_device *pdev; |
356 | int i, num = 0, err = 0; | 357 | int i, num = 0, err = 0; |
357 | 358 | ||
358 | err = driver_register(&proteon_driver); | 359 | err = platform_driver_register(&proteon_driver); |
359 | if (err) | 360 | if (err) |
360 | return err; | 361 | return err; |
361 | 362 | ||
@@ -372,7 +373,7 @@ static int __init proteon_init(void) | |||
372 | err = setup_card(dev, &pdev->dev); | 373 | err = setup_card(dev, &pdev->dev); |
373 | if (!err) { | 374 | if (!err) { |
374 | proteon_dev[i] = pdev; | 375 | proteon_dev[i] = pdev; |
375 | dev_set_drvdata(&pdev->dev, dev); | 376 | platform_set_drvdata(pdev, dev); |
376 | ++num; | 377 | ++num; |
377 | } else { | 378 | } else { |
378 | platform_device_unregister(pdev); | 379 | platform_device_unregister(pdev); |
@@ -399,17 +400,17 @@ static void __exit proteon_cleanup(void) | |||
399 | 400 | ||
400 | if (!pdev) | 401 | if (!pdev) |
401 | continue; | 402 | continue; |
402 | dev = dev_get_drvdata(&pdev->dev); | 403 | dev = platform_get_drvdata(pdev); |
403 | unregister_netdev(dev); | 404 | unregister_netdev(dev); |
404 | release_region(dev->base_addr, PROTEON_IO_EXTENT); | 405 | release_region(dev->base_addr, PROTEON_IO_EXTENT); |
405 | free_irq(dev->irq, dev); | 406 | free_irq(dev->irq, dev); |
406 | free_dma(dev->dma); | 407 | free_dma(dev->dma); |
407 | tmsdev_term(dev); | 408 | tmsdev_term(dev); |
408 | free_netdev(dev); | 409 | free_netdev(dev); |
409 | dev_set_drvdata(&pdev->dev, NULL); | 410 | platform_set_drvdata(pdev, NULL); |
410 | platform_device_unregister(pdev); | 411 | platform_device_unregister(pdev); |
411 | } | 412 | } |
412 | driver_unregister(&proteon_driver); | 413 | platform_driver_unregister(&proteon_driver); |
413 | } | 414 | } |
414 | 415 | ||
415 | module_init(proteon_init); | 416 | module_init(proteon_init); |
diff --git a/drivers/net/tokenring/skisa.c b/drivers/net/tokenring/skisa.c index 72cf708396be..d6ba41cf3110 100644 --- a/drivers/net/tokenring/skisa.c +++ b/drivers/net/tokenring/skisa.c | |||
@@ -354,9 +354,10 @@ module_param_array(dma, int, NULL, 0); | |||
354 | 354 | ||
355 | static struct platform_device *sk_isa_dev[ISATR_MAX_ADAPTERS]; | 355 | static struct platform_device *sk_isa_dev[ISATR_MAX_ADAPTERS]; |
356 | 356 | ||
357 | static struct device_driver sk_isa_driver = { | 357 | static struct platform_driver sk_isa_driver = { |
358 | .name = "skisa", | 358 | .driver = { |
359 | .bus = &platform_bus_type, | 359 | .name = "skisa", |
360 | }, | ||
360 | }; | 361 | }; |
361 | 362 | ||
362 | static int __init sk_isa_init(void) | 363 | static int __init sk_isa_init(void) |
@@ -365,7 +366,7 @@ static int __init sk_isa_init(void) | |||
365 | struct platform_device *pdev; | 366 | struct platform_device *pdev; |
366 | int i, num = 0, err = 0; | 367 | int i, num = 0, err = 0; |
367 | 368 | ||
368 | err = driver_register(&sk_isa_driver); | 369 | err = platform_driver_register(&sk_isa_driver); |
369 | if (err) | 370 | if (err) |
370 | return err; | 371 | return err; |
371 | 372 | ||
@@ -382,7 +383,7 @@ static int __init sk_isa_init(void) | |||
382 | err = setup_card(dev, &pdev->dev); | 383 | err = setup_card(dev, &pdev->dev); |
383 | if (!err) { | 384 | if (!err) { |
384 | sk_isa_dev[i] = pdev; | 385 | sk_isa_dev[i] = pdev; |
385 | dev_set_drvdata(&sk_isa_dev[i]->dev, dev); | 386 | platform_set_drvdata(sk_isa_dev[i], dev); |
386 | ++num; | 387 | ++num; |
387 | } else { | 388 | } else { |
388 | platform_device_unregister(pdev); | 389 | platform_device_unregister(pdev); |
@@ -409,17 +410,17 @@ static void __exit sk_isa_cleanup(void) | |||
409 | 410 | ||
410 | if (!pdev) | 411 | if (!pdev) |
411 | continue; | 412 | continue; |
412 | dev = dev_get_drvdata(&pdev->dev); | 413 | dev = platform_get_drvdata(pdev); |
413 | unregister_netdev(dev); | 414 | unregister_netdev(dev); |
414 | release_region(dev->base_addr, SK_ISA_IO_EXTENT); | 415 | release_region(dev->base_addr, SK_ISA_IO_EXTENT); |
415 | free_irq(dev->irq, dev); | 416 | free_irq(dev->irq, dev); |
416 | free_dma(dev->dma); | 417 | free_dma(dev->dma); |
417 | tmsdev_term(dev); | 418 | tmsdev_term(dev); |
418 | free_netdev(dev); | 419 | free_netdev(dev); |
419 | dev_set_drvdata(&pdev->dev, NULL); | 420 | platform_set_drvdata(pdev, NULL); |
420 | platform_device_unregister(pdev); | 421 | platform_device_unregister(pdev); |
421 | } | 422 | } |
422 | driver_unregister(&sk_isa_driver); | 423 | platform_driver_unregister(&sk_isa_driver); |
423 | } | 424 | } |
424 | 425 | ||
425 | module_init(sk_isa_init); | 426 | module_init(sk_isa_init); |
diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig index 7187958e40ca..00e55165b760 100644 --- a/drivers/net/wireless/Kconfig +++ b/drivers/net/wireless/Kconfig | |||
@@ -330,7 +330,7 @@ config PCI_HERMES | |||
330 | 330 | ||
331 | config ATMEL | 331 | config ATMEL |
332 | tristate "Atmel at76c50x chipset 802.11b support" | 332 | tristate "Atmel at76c50x chipset 802.11b support" |
333 | depends on NET_RADIO && EXPERIMENTAL | 333 | depends on NET_RADIO |
334 | select FW_LOADER | 334 | select FW_LOADER |
335 | select CRC32 | 335 | select CRC32 |
336 | ---help--- | 336 | ---help--- |
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c index a3e23527fe7f..5e53c5258a33 100644 --- a/drivers/net/wireless/atmel.c +++ b/drivers/net/wireless/atmel.c | |||
@@ -72,7 +72,7 @@ | |||
72 | #include "atmel.h" | 72 | #include "atmel.h" |
73 | 73 | ||
74 | #define DRIVER_MAJOR 0 | 74 | #define DRIVER_MAJOR 0 |
75 | #define DRIVER_MINOR 96 | 75 | #define DRIVER_MINOR 98 |
76 | 76 | ||
77 | MODULE_AUTHOR("Simon Kelley"); | 77 | MODULE_AUTHOR("Simon Kelley"); |
78 | MODULE_DESCRIPTION("Support for Atmel at76c50x 802.11 wireless ethernet cards."); | 78 | MODULE_DESCRIPTION("Support for Atmel at76c50x 802.11 wireless ethernet cards."); |
@@ -1504,7 +1504,7 @@ static int atmel_read_proc(char *page, char **start, off_t off, | |||
1504 | return len; | 1504 | return len; |
1505 | } | 1505 | } |
1506 | 1506 | ||
1507 | struct net_device *init_atmel_card( unsigned short irq, int port, const AtmelFWType fw_type, | 1507 | struct net_device *init_atmel_card( unsigned short irq, unsigned long port, const AtmelFWType fw_type, |
1508 | struct device *sys_dev, int (*card_present)(void *), void *card) | 1508 | struct device *sys_dev, int (*card_present)(void *), void *card) |
1509 | { | 1509 | { |
1510 | struct net_device *dev; | 1510 | struct net_device *dev; |
@@ -1605,8 +1605,8 @@ struct net_device *init_atmel_card( unsigned short irq, int port, const AtmelFWT | |||
1605 | goto err_out_free; | 1605 | goto err_out_free; |
1606 | } | 1606 | } |
1607 | 1607 | ||
1608 | if (priv->bus_type == BUS_TYPE_PCI && | 1608 | if (!request_region(dev->base_addr, 32, |
1609 | !request_region( dev->base_addr, 64, dev->name )) { | 1609 | priv->bus_type == BUS_TYPE_PCCARD ? "atmel_cs" : "atmel_pci")) { |
1610 | goto err_out_irq; | 1610 | goto err_out_irq; |
1611 | } | 1611 | } |
1612 | 1612 | ||
@@ -1622,15 +1622,16 @@ struct net_device *init_atmel_card( unsigned short irq, int port, const AtmelFWT | |||
1622 | 1622 | ||
1623 | create_proc_read_entry ("driver/atmel", 0, NULL, atmel_read_proc, priv); | 1623 | create_proc_read_entry ("driver/atmel", 0, NULL, atmel_read_proc, priv); |
1624 | 1624 | ||
1625 | printk(KERN_INFO "%s: Atmel at76c50x wireless. Version %d.%d simon@thekelleys.org.uk\n", | 1625 | printk(KERN_INFO "%s: Atmel at76c50x. Version %d.%d. MAC %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n", |
1626 | dev->name, DRIVER_MAJOR, DRIVER_MINOR); | 1626 | dev->name, DRIVER_MAJOR, DRIVER_MINOR, |
1627 | dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2], | ||
1628 | dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5] ); | ||
1627 | 1629 | ||
1628 | SET_MODULE_OWNER(dev); | 1630 | SET_MODULE_OWNER(dev); |
1629 | return dev; | 1631 | return dev; |
1630 | 1632 | ||
1631 | err_out_res: | 1633 | err_out_res: |
1632 | if (priv->bus_type == BUS_TYPE_PCI) | 1634 | release_region( dev->base_addr, 32); |
1633 | release_region( dev->base_addr, 64 ); | ||
1634 | err_out_irq: | 1635 | err_out_irq: |
1635 | free_irq(dev->irq, dev); | 1636 | free_irq(dev->irq, dev); |
1636 | err_out_free: | 1637 | err_out_free: |
@@ -1640,7 +1641,7 @@ struct net_device *init_atmel_card( unsigned short irq, int port, const AtmelFWT | |||
1640 | 1641 | ||
1641 | EXPORT_SYMBOL(init_atmel_card); | 1642 | EXPORT_SYMBOL(init_atmel_card); |
1642 | 1643 | ||
1643 | void stop_atmel_card(struct net_device *dev, int freeres) | 1644 | void stop_atmel_card(struct net_device *dev) |
1644 | { | 1645 | { |
1645 | struct atmel_private *priv = netdev_priv(dev); | 1646 | struct atmel_private *priv = netdev_priv(dev); |
1646 | 1647 | ||
@@ -1654,10 +1655,7 @@ void stop_atmel_card(struct net_device *dev, int freeres) | |||
1654 | remove_proc_entry("driver/atmel", NULL); | 1655 | remove_proc_entry("driver/atmel", NULL); |
1655 | free_irq(dev->irq, dev); | 1656 | free_irq(dev->irq, dev); |
1656 | kfree(priv->firmware); | 1657 | kfree(priv->firmware); |
1657 | if (freeres) { | 1658 | release_region(dev->base_addr, 32); |
1658 | /* PCMCIA frees this stuff, so only for PCI */ | ||
1659 | release_region(dev->base_addr, 64); | ||
1660 | } | ||
1661 | free_netdev(dev); | 1659 | free_netdev(dev); |
1662 | } | 1660 | } |
1663 | 1661 | ||
@@ -1810,9 +1808,9 @@ static int atmel_set_encode(struct net_device *dev, | |||
1810 | } | 1808 | } |
1811 | if(dwrq->flags & IW_ENCODE_RESTRICTED) | 1809 | if(dwrq->flags & IW_ENCODE_RESTRICTED) |
1812 | priv->exclude_unencrypted = 1; | 1810 | priv->exclude_unencrypted = 1; |
1813 | if(dwrq->flags & IW_ENCODE_OPEN) | 1811 | if(dwrq->flags & IW_ENCODE_OPEN) |
1814 | priv->exclude_unencrypted = 0; | 1812 | priv->exclude_unencrypted = 0; |
1815 | 1813 | ||
1816 | return -EINPROGRESS; /* Call commit handler */ | 1814 | return -EINPROGRESS; /* Call commit handler */ |
1817 | } | 1815 | } |
1818 | 1816 | ||
@@ -1827,11 +1825,12 @@ static int atmel_get_encode(struct net_device *dev, | |||
1827 | 1825 | ||
1828 | if (!priv->wep_is_on) | 1826 | if (!priv->wep_is_on) |
1829 | dwrq->flags = IW_ENCODE_DISABLED; | 1827 | dwrq->flags = IW_ENCODE_DISABLED; |
1830 | else if (priv->exclude_unencrypted) | 1828 | else { |
1831 | dwrq->flags = IW_ENCODE_RESTRICTED; | 1829 | if (priv->exclude_unencrypted) |
1832 | else | 1830 | dwrq->flags = IW_ENCODE_RESTRICTED; |
1833 | dwrq->flags = IW_ENCODE_OPEN; | 1831 | else |
1834 | 1832 | dwrq->flags = IW_ENCODE_OPEN; | |
1833 | } | ||
1835 | /* Which key do we want ? -1 -> tx index */ | 1834 | /* Which key do we want ? -1 -> tx index */ |
1836 | if (index < 0 || index >= 4) | 1835 | if (index < 0 || index >= 4) |
1837 | index = priv->default_key; | 1836 | index = priv->default_key; |
@@ -2645,8 +2644,8 @@ static void handle_beacon_probe(struct atmel_private *priv, u16 capability, u8 c | |||
2645 | } | 2644 | } |
2646 | } | 2645 | } |
2647 | 2646 | ||
2648 | 2647 | ||
2649 | static void send_authentication_request(struct atmel_private *priv, u8 *challenge, int challenge_len) | 2648 | static void send_authentication_request(struct atmel_private *priv, u16 system, u8 *challenge, int challenge_len) |
2650 | { | 2649 | { |
2651 | struct ieee80211_hdr_4addr header; | 2650 | struct ieee80211_hdr_4addr header; |
2652 | struct auth_body auth; | 2651 | struct auth_body auth; |
@@ -2658,14 +2657,11 @@ static void send_authentication_request(struct atmel_private *priv, u8 *challeng | |||
2658 | memcpy(header.addr2, priv->dev->dev_addr, 6); | 2657 | memcpy(header.addr2, priv->dev->dev_addr, 6); |
2659 | memcpy(header.addr3, priv->CurrentBSSID, 6); | 2658 | memcpy(header.addr3, priv->CurrentBSSID, 6); |
2660 | 2659 | ||
2661 | if (priv->wep_is_on) { | 2660 | if (priv->wep_is_on && priv->CurrentAuthentTransactionSeqNum != 1) |
2662 | auth.alg = cpu_to_le16(C80211_MGMT_AAN_SHAREDKEY); | ||
2663 | /* no WEP for authentication frames with TrSeqNo 1 */ | 2661 | /* no WEP for authentication frames with TrSeqNo 1 */ |
2664 | if (priv->CurrentAuthentTransactionSeqNum != 1) | 2662 | header.frame_ctl |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); |
2665 | header.frame_ctl |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); | 2663 | |
2666 | } else { | 2664 | auth.alg = cpu_to_le16(system); |
2667 | auth.alg = cpu_to_le16(C80211_MGMT_AAN_OPENSYSTEM); | ||
2668 | } | ||
2669 | 2665 | ||
2670 | auth.status = 0; | 2666 | auth.status = 0; |
2671 | auth.trans_seq = cpu_to_le16(priv->CurrentAuthentTransactionSeqNum); | 2667 | auth.trans_seq = cpu_to_le16(priv->CurrentAuthentTransactionSeqNum); |
@@ -2834,6 +2830,7 @@ static void authenticate(struct atmel_private *priv, u16 frame_len) | |||
2834 | struct auth_body *auth = (struct auth_body *)priv->rx_buf; | 2830 | struct auth_body *auth = (struct auth_body *)priv->rx_buf; |
2835 | u16 status = le16_to_cpu(auth->status); | 2831 | u16 status = le16_to_cpu(auth->status); |
2836 | u16 trans_seq_no = le16_to_cpu(auth->trans_seq); | 2832 | u16 trans_seq_no = le16_to_cpu(auth->trans_seq); |
2833 | u16 system = le16_to_cpu(auth->alg); | ||
2837 | 2834 | ||
2838 | if (status == C80211_MGMT_SC_Success && !priv->wep_is_on) { | 2835 | if (status == C80211_MGMT_SC_Success && !priv->wep_is_on) { |
2839 | /* no WEP */ | 2836 | /* no WEP */ |
@@ -2855,7 +2852,7 @@ static void authenticate(struct atmel_private *priv, u16 frame_len) | |||
2855 | 2852 | ||
2856 | if (trans_seq_no == 0x0002 && | 2853 | if (trans_seq_no == 0x0002 && |
2857 | auth->el_id == C80211_MGMT_ElementID_ChallengeText) { | 2854 | auth->el_id == C80211_MGMT_ElementID_ChallengeText) { |
2858 | send_authentication_request(priv, auth->chall_text, auth->chall_text_len); | 2855 | send_authentication_request(priv, system, auth->chall_text, auth->chall_text_len); |
2859 | return; | 2856 | return; |
2860 | } | 2857 | } |
2861 | 2858 | ||
@@ -2872,14 +2869,20 @@ static void authenticate(struct atmel_private *priv, u16 frame_len) | |||
2872 | } | 2869 | } |
2873 | } | 2870 | } |
2874 | 2871 | ||
2875 | if (status == C80211_MGMT_SC_AuthAlgNotSupported && priv->connect_to_any_BSS) { | 2872 | if (status == C80211_MGMT_SC_AuthAlgNotSupported) { |
2876 | int bss_index; | 2873 | /* Do opensystem first, then try sharedkey */ |
2877 | 2874 | if (system == C80211_MGMT_AAN_OPENSYSTEM) { | |
2878 | priv->BSSinfo[(int)(priv->current_BSS)].channel |= 0x80; | 2875 | priv->CurrentAuthentTransactionSeqNum = 0x001; |
2879 | 2876 | send_authentication_request(priv, C80211_MGMT_AAN_SHAREDKEY, NULL, 0); | |
2880 | if ((bss_index = retrieve_bss(priv)) != -1) { | 2877 | } else if (priv->connect_to_any_BSS) { |
2881 | atmel_join_bss(priv, bss_index); | 2878 | int bss_index; |
2882 | return; | 2879 | |
2880 | priv->BSSinfo[(int)(priv->current_BSS)].channel |= 0x80; | ||
2881 | |||
2882 | if ((bss_index = retrieve_bss(priv)) != -1) { | ||
2883 | atmel_join_bss(priv, bss_index); | ||
2884 | return; | ||
2885 | } | ||
2883 | } | 2886 | } |
2884 | } | 2887 | } |
2885 | 2888 | ||
@@ -3205,7 +3208,7 @@ static void atmel_management_timer(u_long a) | |||
3205 | priv->AuthenticationRequestRetryCnt++; | 3208 | priv->AuthenticationRequestRetryCnt++; |
3206 | priv->CurrentAuthentTransactionSeqNum = 0x0001; | 3209 | priv->CurrentAuthentTransactionSeqNum = 0x0001; |
3207 | mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); | 3210 | mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); |
3208 | send_authentication_request(priv, NULL, 0); | 3211 | send_authentication_request(priv, C80211_MGMT_AAN_OPENSYSTEM, NULL, 0); |
3209 | } | 3212 | } |
3210 | 3213 | ||
3211 | break; | 3214 | break; |
@@ -3312,7 +3315,7 @@ static void atmel_command_irq(struct atmel_private *priv) | |||
3312 | 3315 | ||
3313 | mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); | 3316 | mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); |
3314 | priv->CurrentAuthentTransactionSeqNum = 0x0001; | 3317 | priv->CurrentAuthentTransactionSeqNum = 0x0001; |
3315 | send_authentication_request(priv, NULL, 0); | 3318 | send_authentication_request(priv, C80211_MGMT_AAN_SHAREDKEY, NULL, 0); |
3316 | } | 3319 | } |
3317 | return; | 3320 | return; |
3318 | } | 3321 | } |
@@ -3482,11 +3485,6 @@ static int probe_atmel_card(struct net_device *dev) | |||
3482 | printk(KERN_ALERT "%s: *** Invalid MAC address. UPGRADE Firmware ****\n", dev->name); | 3485 | printk(KERN_ALERT "%s: *** Invalid MAC address. UPGRADE Firmware ****\n", dev->name); |
3483 | memcpy(dev->dev_addr, default_mac, 6); | 3486 | memcpy(dev->dev_addr, default_mac, 6); |
3484 | } | 3487 | } |
3485 | printk(KERN_INFO "%s: MAC address %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n", | ||
3486 | dev->name, | ||
3487 | dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2], | ||
3488 | dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5] ); | ||
3489 | |||
3490 | } | 3488 | } |
3491 | 3489 | ||
3492 | return rc; | 3490 | return rc; |
diff --git a/drivers/net/wireless/atmel.h b/drivers/net/wireless/atmel.h index 825000edfc2c..b9b3e5b76544 100644 --- a/drivers/net/wireless/atmel.h +++ b/drivers/net/wireless/atmel.h | |||
@@ -35,9 +35,9 @@ typedef enum { | |||
35 | ATMEL_FW_TYPE_506 | 35 | ATMEL_FW_TYPE_506 |
36 | } AtmelFWType; | 36 | } AtmelFWType; |
37 | 37 | ||
38 | struct net_device *init_atmel_card(unsigned short, int, const AtmelFWType, struct device *, | 38 | struct net_device *init_atmel_card(unsigned short, unsigned long, const AtmelFWType, struct device *, |
39 | int (*present_func)(void *), void * ); | 39 | int (*present_func)(void *), void * ); |
40 | void stop_atmel_card( struct net_device *, int ); | 40 | void stop_atmel_card( struct net_device *); |
41 | int atmel_open( struct net_device * ); | 41 | int atmel_open( struct net_device * ); |
42 | 42 | ||
43 | #endif | 43 | #endif |
diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c index 1bd13146c644..17d1fd90f832 100644 --- a/drivers/net/wireless/atmel_cs.c +++ b/drivers/net/wireless/atmel_cs.c | |||
@@ -63,6 +63,7 @@ | |||
63 | be present but disabled -- but it can then be enabled for specific | 63 | be present but disabled -- but it can then be enabled for specific |
64 | modules at load time with a 'pc_debug=#' option to insmod. | 64 | modules at load time with a 'pc_debug=#' option to insmod. |
65 | */ | 65 | */ |
66 | |||
66 | #ifdef PCMCIA_DEBUG | 67 | #ifdef PCMCIA_DEBUG |
67 | static int pc_debug = PCMCIA_DEBUG; | 68 | static int pc_debug = PCMCIA_DEBUG; |
68 | module_param(pc_debug, int, 0); | 69 | module_param(pc_debug, int, 0); |
@@ -285,41 +286,6 @@ static int card_present(void *arg) | |||
285 | return 0; | 286 | return 0; |
286 | } | 287 | } |
287 | 288 | ||
288 | /* list of cards we know about and their firmware requirements. | ||
289 | Go either by Manfid or version strings. | ||
290 | Cards not in this list will need a firmware parameter to the module | ||
291 | in all probability. Note that the SMC 2632 V2 and V3 have the same | ||
292 | manfids, so we ignore those and use the version1 strings. */ | ||
293 | |||
294 | static struct { | ||
295 | int manf, card; | ||
296 | char *ver1; | ||
297 | AtmelFWType firmware; | ||
298 | char *name; | ||
299 | } card_table[] = { | ||
300 | { 0, 0, "WLAN/802.11b PC CARD", ATMEL_FW_TYPE_502D, "Actiontec 802CAT1" }, | ||
301 | { 0, 0, "ATMEL/AT76C502AR", ATMEL_FW_TYPE_502, "NoName-RFMD" }, | ||
302 | { 0, 0, "ATMEL/AT76C502AR_D", ATMEL_FW_TYPE_502D, "NoName-revD" }, | ||
303 | { 0, 0, "ATMEL/AT76C502AR_E", ATMEL_FW_TYPE_502E, "NoName-revE" }, | ||
304 | { 0, 0, "ATMEL/AT76C504", ATMEL_FW_TYPE_504, "NoName-504" }, | ||
305 | { 0, 0, "ATMEL/AT76C504A", ATMEL_FW_TYPE_504A_2958, "NoName-504a-2958" }, | ||
306 | { 0, 0, "ATMEL/AT76C504_R", ATMEL_FW_TYPE_504_2958, "NoName-504-2958" }, | ||
307 | { MANFID_3COM, 0x0620, NULL, ATMEL_FW_TYPE_502_3COM, "3com 3CRWE62092B" }, | ||
308 | { MANFID_3COM, 0x0696, NULL, ATMEL_FW_TYPE_502_3COM, "3com 3CRSHPW196" }, | ||
309 | { 0, 0, "SMC/2632W-V2", ATMEL_FW_TYPE_502, "SMC 2632W-V2" }, | ||
310 | { 0, 0, "SMC/2632W", ATMEL_FW_TYPE_502D, "SMC 2632W-V3" }, | ||
311 | { 0xd601, 0x0007, NULL, ATMEL_FW_TYPE_502, "Sitecom WLAN-011" }, | ||
312 | { 0x01bf, 0x3302, NULL, ATMEL_FW_TYPE_502E, "Belkin F5D6020-V2" }, | ||
313 | { 0, 0, "BT/Voyager 1020 Laptop Adapter", ATMEL_FW_TYPE_502, "BT Voyager 1020" }, | ||
314 | { 0, 0, "IEEE 802.11b/Wireless LAN PC Card", ATMEL_FW_TYPE_502, "Siemens Gigaset PC Card II" }, | ||
315 | { 0, 0, "IEEE 802.11b/Wireless LAN Card S", ATMEL_FW_TYPE_504_2958, "Siemens Gigaset PC Card II" }, | ||
316 | { 0, 0, "CNet/CNWLC 11Mbps Wireless PC Card V-5", ATMEL_FW_TYPE_502E, "CNet CNWLC-811ARL" }, | ||
317 | { 0, 0, "Wireless/PC_CARD", ATMEL_FW_TYPE_502D, "Planet WL-3552" }, | ||
318 | { 0, 0, "OEM/11Mbps Wireless LAN PC Card V-3", ATMEL_FW_TYPE_502, "OEM 11Mbps WLAN PCMCIA Card" }, | ||
319 | { 0, 0, "11WAVE/11WP611AL-E", ATMEL_FW_TYPE_502E, "11WAVE WaveBuddy" }, | ||
320 | { 0, 0, "LG/LW2100N", ATMEL_FW_TYPE_502E, "LG LW2100N 11Mbps WLAN PCMCIA Card" }, | ||
321 | }; | ||
322 | |||
323 | static void atmel_config(dev_link_t *link) | 289 | static void atmel_config(dev_link_t *link) |
324 | { | 290 | { |
325 | client_handle_t handle; | 291 | client_handle_t handle; |
@@ -328,10 +294,11 @@ static void atmel_config(dev_link_t *link) | |||
328 | local_info_t *dev; | 294 | local_info_t *dev; |
329 | int last_fn, last_ret; | 295 | int last_fn, last_ret; |
330 | u_char buf[64]; | 296 | u_char buf[64]; |
331 | int card_index = -1, done = 0; | 297 | struct pcmcia_device_id *did; |
332 | 298 | ||
333 | handle = link->handle; | 299 | handle = link->handle; |
334 | dev = link->priv; | 300 | dev = link->priv; |
301 | did = handle_to_dev(handle).driver_data; | ||
335 | 302 | ||
336 | DEBUG(0, "atmel_config(0x%p)\n", link); | 303 | DEBUG(0, "atmel_config(0x%p)\n", link); |
337 | 304 | ||
@@ -340,59 +307,6 @@ static void atmel_config(dev_link_t *link) | |||
340 | tuple.TupleDataMax = sizeof(buf); | 307 | tuple.TupleDataMax = sizeof(buf); |
341 | tuple.TupleOffset = 0; | 308 | tuple.TupleOffset = 0; |
342 | 309 | ||
343 | tuple.DesiredTuple = CISTPL_MANFID; | ||
344 | if (pcmcia_get_first_tuple(handle, &tuple) == 0) { | ||
345 | int i; | ||
346 | cistpl_manfid_t *manfid; | ||
347 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); | ||
348 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); | ||
349 | manfid = &(parse.manfid); | ||
350 | for (i = 0; i < sizeof(card_table)/sizeof(card_table[0]); i++) { | ||
351 | if (!card_table[i].ver1 && | ||
352 | manfid->manf == card_table[i].manf && | ||
353 | manfid->card == card_table[i].card) { | ||
354 | card_index = i; | ||
355 | done = 1; | ||
356 | } | ||
357 | } | ||
358 | } | ||
359 | |||
360 | tuple.DesiredTuple = CISTPL_VERS_1; | ||
361 | if (!done && (pcmcia_get_first_tuple(handle, &tuple) == 0)) { | ||
362 | int i, j, k; | ||
363 | cistpl_vers_1_t *ver1; | ||
364 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); | ||
365 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); | ||
366 | ver1 = &(parse.version_1); | ||
367 | |||
368 | for (i = 0; i < sizeof(card_table)/sizeof(card_table[0]); i++) { | ||
369 | for (j = 0; j < ver1->ns; j++) { | ||
370 | char *p = card_table[i].ver1; | ||
371 | char *q = &ver1->str[ver1->ofs[j]]; | ||
372 | if (!p) | ||
373 | goto mismatch; | ||
374 | for (k = 0; k < j; k++) { | ||
375 | while ((*p != '\0') && (*p != '/')) p++; | ||
376 | if (*p == '\0') { | ||
377 | if (*q != '\0') | ||
378 | goto mismatch; | ||
379 | } else { | ||
380 | p++; | ||
381 | } | ||
382 | } | ||
383 | while((*q != '\0') && (*p != '\0') && | ||
384 | (*p != '/') && (*p == *q)) p++, q++; | ||
385 | if (((*p != '\0') && *p != '/') || *q != '\0') | ||
386 | goto mismatch; | ||
387 | } | ||
388 | card_index = i; | ||
389 | break; /* done */ | ||
390 | |||
391 | mismatch: | ||
392 | j = 0; /* dummy stmt to shut up compiler */ | ||
393 | } | ||
394 | } | ||
395 | |||
396 | /* | 310 | /* |
397 | This reads the card's CONFIG tuple to find its configuration | 311 | This reads the card's CONFIG tuple to find its configuration |
398 | registers. | 312 | registers. |
@@ -509,12 +423,13 @@ static void atmel_config(dev_link_t *link) | |||
509 | ((local_info_t*)link->priv)->eth_dev = | 423 | ((local_info_t*)link->priv)->eth_dev = |
510 | init_atmel_card(link->irq.AssignedIRQ, | 424 | init_atmel_card(link->irq.AssignedIRQ, |
511 | link->io.BasePort1, | 425 | link->io.BasePort1, |
512 | card_index == -1 ? ATMEL_FW_TYPE_NONE : card_table[card_index].firmware, | 426 | did ? did->driver_info : ATMEL_FW_TYPE_NONE, |
513 | &handle_to_dev(handle), | 427 | &handle_to_dev(handle), |
514 | card_present, | 428 | card_present, |
515 | link); | 429 | link); |
516 | if (!((local_info_t*)link->priv)->eth_dev) | 430 | if (!((local_info_t*)link->priv)->eth_dev) |
517 | goto cs_failed; | 431 | goto cs_failed; |
432 | |||
518 | 433 | ||
519 | /* | 434 | /* |
520 | At this point, the dev_node_t structure(s) need to be | 435 | At this point, the dev_node_t structure(s) need to be |
@@ -523,26 +438,7 @@ static void atmel_config(dev_link_t *link) | |||
523 | strcpy(dev->node.dev_name, ((local_info_t*)link->priv)->eth_dev->name ); | 438 | strcpy(dev->node.dev_name, ((local_info_t*)link->priv)->eth_dev->name ); |
524 | dev->node.major = dev->node.minor = 0; | 439 | dev->node.major = dev->node.minor = 0; |
525 | link->dev = &dev->node; | 440 | link->dev = &dev->node; |
526 | 441 | ||
527 | /* Finally, report what we've done */ | ||
528 | printk(KERN_INFO "%s: %s%sindex 0x%02x: Vcc %d.%d", | ||
529 | dev->node.dev_name, | ||
530 | card_index == -1 ? "" : card_table[card_index].name, | ||
531 | card_index == -1 ? "" : " ", | ||
532 | link->conf.ConfigIndex, | ||
533 | link->conf.Vcc/10, link->conf.Vcc%10); | ||
534 | if (link->conf.Vpp1) | ||
535 | printk(", Vpp %d.%d", link->conf.Vpp1/10, link->conf.Vpp1%10); | ||
536 | if (link->conf.Attributes & CONF_ENABLE_IRQ) | ||
537 | printk(", irq %d", link->irq.AssignedIRQ); | ||
538 | if (link->io.NumPorts1) | ||
539 | printk(", io 0x%04x-0x%04x", link->io.BasePort1, | ||
540 | link->io.BasePort1+link->io.NumPorts1-1); | ||
541 | if (link->io.NumPorts2) | ||
542 | printk(" & 0x%04x-0x%04x", link->io.BasePort2, | ||
543 | link->io.BasePort2+link->io.NumPorts2-1); | ||
544 | printk("\n"); | ||
545 | |||
546 | link->state &= ~DEV_CONFIG_PENDING; | 442 | link->state &= ~DEV_CONFIG_PENDING; |
547 | return; | 443 | return; |
548 | 444 | ||
@@ -569,7 +465,7 @@ static void atmel_release(dev_link_t *link) | |||
569 | link->dev = NULL; | 465 | link->dev = NULL; |
570 | 466 | ||
571 | if (dev) | 467 | if (dev) |
572 | stop_atmel_card(dev, 0); | 468 | stop_atmel_card(dev); |
573 | ((local_info_t*)link->priv)->eth_dev = NULL; | 469 | ((local_info_t*)link->priv)->eth_dev = NULL; |
574 | 470 | ||
575 | /* Don't bother checking to see if these succeed or not */ | 471 | /* Don't bother checking to see if these succeed or not */ |
@@ -637,25 +533,47 @@ static int atmel_event(event_t event, int priority, | |||
637 | } /* atmel_event */ | 533 | } /* atmel_event */ |
638 | 534 | ||
639 | /*====================================================================*/ | 535 | /*====================================================================*/ |
536 | /* We use the driver_info field to store the correct firmware type for a card. */ | ||
537 | |||
538 | #define PCMCIA_DEVICE_MANF_CARD_INFO(manf, card, info) { \ | ||
539 | .match_flags = PCMCIA_DEV_ID_MATCH_MANF_ID| \ | ||
540 | PCMCIA_DEV_ID_MATCH_CARD_ID, \ | ||
541 | .manf_id = (manf), \ | ||
542 | .card_id = (card), \ | ||
543 | .driver_info = (kernel_ulong_t)(info), } | ||
544 | |||
545 | #define PCMCIA_DEVICE_PROD_ID12_INFO(v1, v2, vh1, vh2, info) { \ | ||
546 | .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \ | ||
547 | PCMCIA_DEV_ID_MATCH_PROD_ID2, \ | ||
548 | .prod_id = { (v1), (v2), NULL, NULL }, \ | ||
549 | .prod_id_hash = { (vh1), (vh2), 0, 0 }, \ | ||
550 | .driver_info = (kernel_ulong_t)(info), } | ||
551 | |||
640 | static struct pcmcia_device_id atmel_ids[] = { | 552 | static struct pcmcia_device_id atmel_ids[] = { |
641 | PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0620), | 553 | PCMCIA_DEVICE_MANF_CARD_INFO(0x0101, 0x0620, ATMEL_FW_TYPE_502_3COM), |
642 | PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0696), | 554 | PCMCIA_DEVICE_MANF_CARD_INFO(0x0101, 0x0696, ATMEL_FW_TYPE_502_3COM), |
643 | PCMCIA_DEVICE_MANF_CARD(0x01bf, 0x3302), | 555 | PCMCIA_DEVICE_MANF_CARD_INFO(0x01bf, 0x3302, ATMEL_FW_TYPE_502E), |
644 | PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0007), | 556 | PCMCIA_DEVICE_MANF_CARD_INFO(0xd601, 0x0007, ATMEL_FW_TYPE_502), |
645 | PCMCIA_DEVICE_PROD_ID12("11WAVE", "11WP611AL-E", 0x9eb2da1f, 0xc9a0d3f9), | 557 | PCMCIA_DEVICE_PROD_ID12_INFO("11WAVE", "11WP611AL-E", 0x9eb2da1f, 0xc9a0d3f9, ATMEL_FW_TYPE_502E), |
646 | PCMCIA_DEVICE_PROD_ID12("ATMEL", "AT76C502AR", 0xabda4164, 0x41b37e1f), | 558 | PCMCIA_DEVICE_PROD_ID12_INFO("ATMEL", "AT76C502AR", 0xabda4164, 0x41b37e1f, ATMEL_FW_TYPE_502), |
647 | PCMCIA_DEVICE_PROD_ID12("ATMEL", "AT76C504", 0xabda4164, 0x5040670a), | 559 | PCMCIA_DEVICE_PROD_ID12_INFO("ATMEL", "AT76C502AR_D", 0xabda4164, 0x3675d704, ATMEL_FW_TYPE_502D), |
648 | PCMCIA_DEVICE_PROD_ID12("ATMEL", "AT76C504A", 0xabda4164, 0xe15ed87f), | 560 | PCMCIA_DEVICE_PROD_ID12_INFO("ATMEL", "AT76C502AR_E", 0xabda4164, 0x4172e792, ATMEL_FW_TYPE_502E), |
649 | PCMCIA_DEVICE_PROD_ID12("BT", "Voyager 1020 Laptop Adapter", 0xae49b86a, 0x1e957cd5), | 561 | PCMCIA_DEVICE_PROD_ID12_INFO("ATMEL", "AT76C504_R", 0xabda4164, 0x917f3d72, ATMEL_FW_TYPE_504_2958), |
650 | PCMCIA_DEVICE_PROD_ID12("CNet", "CNWLC 11Mbps Wireless PC Card V-5", 0xbc477dde, 0x502fae6b), | 562 | PCMCIA_DEVICE_PROD_ID12_INFO("ATMEL", "AT76C504", 0xabda4164, 0x5040670a, ATMEL_FW_TYPE_504), |
651 | PCMCIA_DEVICE_PROD_ID12("IEEE 802.11b", "Wireless LAN PC Card", 0x5b878724, 0x122f1df6), | 563 | PCMCIA_DEVICE_PROD_ID12_INFO("ATMEL", "AT76C504A", 0xabda4164, 0xe15ed87f, ATMEL_FW_TYPE_504A_2958), |
652 | PCMCIA_DEVICE_PROD_ID12("OEM", "11Mbps Wireless LAN PC Card V-3", 0xfea54c90, 0x1c5b0f68), | 564 | PCMCIA_DEVICE_PROD_ID12_INFO("BT", "Voyager 1020 Laptop Adapter", 0xae49b86a, 0x1e957cd5, ATMEL_FW_TYPE_502), |
653 | PCMCIA_DEVICE_PROD_ID12("SMC", "2632W", 0xc4f8b18b, 0x30f38774), | 565 | PCMCIA_DEVICE_PROD_ID12_INFO("CNet", "CNWLC 11Mbps Wireless PC Card V-5", 0xbc477dde, 0x502fae6b, ATMEL_FW_TYPE_502E), |
654 | PCMCIA_DEVICE_PROD_ID12("SMC", "2632W-V2", 0xc4f8b18b, 0x172d1377), | 566 | PCMCIA_DEVICE_PROD_ID12_INFO("IEEE 802.11b", "Wireless LAN PC Card", 0x5b878724, 0x122f1df6, ATMEL_FW_TYPE_502), |
655 | PCMCIA_DEVICE_PROD_ID12("Wireless", "PC", 0xa407ecdd, 0x556e4d7e), | 567 | PCMCIA_DEVICE_PROD_ID12_INFO("IEEE 802.11b", "Wireless LAN Card S", 0x5b878724, 0x5fba533a, ATMEL_FW_TYPE_504_2958), |
656 | PCMCIA_DEVICE_PROD_ID12("WLAN", "802.11b PC CARD", 0x575c516c, 0xb1f6dbc4), | 568 | PCMCIA_DEVICE_PROD_ID12_INFO("OEM", "11Mbps Wireless LAN PC Card V-3", 0xfea54c90, 0x1c5b0f68, ATMEL_FW_TYPE_502), |
569 | PCMCIA_DEVICE_PROD_ID12_INFO("SMC", "2632W", 0xc4f8b18b, 0x30f38774, ATMEL_FW_TYPE_502D), | ||
570 | PCMCIA_DEVICE_PROD_ID12_INFO("SMC", "2632W-V2", 0xc4f8b18b, 0x172d1377, ATMEL_FW_TYPE_502), | ||
571 | PCMCIA_DEVICE_PROD_ID12_INFO("Wireless", "PC_CARD", 0xa407ecdd, 0x119f6314, ATMEL_FW_TYPE_502D), | ||
572 | PCMCIA_DEVICE_PROD_ID12_INFO("WLAN", "802.11b PC CARD", 0x575c516c, 0xb1f6dbc4, ATMEL_FW_TYPE_502D), | ||
573 | PCMCIA_DEVICE_PROD_ID12_INFO("LG", "LW2100N", 0xb474d43a, 0x6b1fec94, ATMEL_FW_TYPE_502E), | ||
657 | PCMCIA_DEVICE_NULL | 574 | PCMCIA_DEVICE_NULL |
658 | }; | 575 | }; |
576 | |||
659 | MODULE_DEVICE_TABLE(pcmcia, atmel_ids); | 577 | MODULE_DEVICE_TABLE(pcmcia, atmel_ids); |
660 | 578 | ||
661 | static struct pcmcia_driver atmel_driver = { | 579 | static struct pcmcia_driver atmel_driver = { |
diff --git a/drivers/net/wireless/atmel_pci.c b/drivers/net/wireless/atmel_pci.c index 2eb00a957bbe..a61b3bc6cccf 100644 --- a/drivers/net/wireless/atmel_pci.c +++ b/drivers/net/wireless/atmel_pci.c | |||
@@ -72,7 +72,7 @@ static int __devinit atmel_pci_probe(struct pci_dev *pdev, | |||
72 | 72 | ||
73 | static void __devexit atmel_pci_remove(struct pci_dev *pdev) | 73 | static void __devexit atmel_pci_remove(struct pci_dev *pdev) |
74 | { | 74 | { |
75 | stop_atmel_card(pci_get_drvdata(pdev), 1); | 75 | stop_atmel_card(pci_get_drvdata(pdev)); |
76 | } | 76 | } |
77 | 77 | ||
78 | static int __init atmel_init_module(void) | 78 | static int __init atmel_init_module(void) |