diff options
Diffstat (limited to 'drivers/net/arm')
-rw-r--r-- | drivers/net/arm/Kconfig | 1 | ||||
-rw-r--r-- | drivers/net/arm/am79c961a.c | 12 | ||||
-rw-r--r-- | drivers/net/arm/at91_ether.c | 10 | ||||
-rw-r--r-- | drivers/net/arm/ep93xx_eth.c | 151 | ||||
-rw-r--r-- | drivers/net/arm/ether3.c | 2 | ||||
-rw-r--r-- | drivers/net/arm/etherh.c | 1 | ||||
-rw-r--r-- | drivers/net/arm/ixp4xx_eth.c | 16 | ||||
-rw-r--r-- | drivers/net/arm/ks8695net.c | 153 | ||||
-rw-r--r-- | drivers/net/arm/w90p910_ether.c | 13 |
9 files changed, 219 insertions, 140 deletions
diff --git a/drivers/net/arm/Kconfig b/drivers/net/arm/Kconfig index c37ee9e6b67b..39e1c0d39476 100644 --- a/drivers/net/arm/Kconfig +++ b/drivers/net/arm/Kconfig | |||
@@ -68,6 +68,7 @@ config W90P910_ETH | |||
68 | tristate "Nuvoton w90p910 Ethernet support" | 68 | tristate "Nuvoton w90p910 Ethernet support" |
69 | depends on ARM && ARCH_W90X900 | 69 | depends on ARM && ARCH_W90X900 |
70 | select PHYLIB | 70 | select PHYLIB |
71 | select MII | ||
71 | help | 72 | help |
72 | Say Y here if you want to use built-in Ethernet ports | 73 | Say Y here if you want to use built-in Ethernet ports |
73 | on w90p910 processor. | 74 | on w90p910 processor. |
diff --git a/drivers/net/arm/am79c961a.c b/drivers/net/arm/am79c961a.c index 164b37e85eea..f1f58c5e27bf 100644 --- a/drivers/net/arm/am79c961a.c +++ b/drivers/net/arm/am79c961a.c | |||
@@ -351,13 +351,13 @@ static struct net_device_stats *am79c961_getstats (struct net_device *dev) | |||
351 | return &priv->stats; | 351 | return &priv->stats; |
352 | } | 352 | } |
353 | 353 | ||
354 | static void am79c961_mc_hash(struct dev_mc_list *dmi, unsigned short *hash) | 354 | static void am79c961_mc_hash(char *addr, unsigned short *hash) |
355 | { | 355 | { |
356 | if (dmi->dmi_addrlen == ETH_ALEN && dmi->dmi_addr[0] & 0x01) { | 356 | if (addr[0] & 0x01) { |
357 | int idx, bit; | 357 | int idx, bit; |
358 | u32 crc; | 358 | u32 crc; |
359 | 359 | ||
360 | crc = ether_crc_le(ETH_ALEN, dmi->dmi_addr); | 360 | crc = ether_crc_le(ETH_ALEN, addr); |
361 | 361 | ||
362 | idx = crc >> 30; | 362 | idx = crc >> 30; |
363 | bit = (crc >> 26) & 15; | 363 | bit = (crc >> 26) & 15; |
@@ -387,8 +387,8 @@ static void am79c961_setmulticastlist (struct net_device *dev) | |||
387 | 387 | ||
388 | memset(multi_hash, 0x00, sizeof(multi_hash)); | 388 | memset(multi_hash, 0x00, sizeof(multi_hash)); |
389 | 389 | ||
390 | for (dmi = dev->mc_list; dmi; dmi = dmi->next) | 390 | netdev_for_each_mc_addr(dmi, dev) |
391 | am79c961_mc_hash(dmi, multi_hash); | 391 | am79c961_mc_hash(dmi->dmi_addr, multi_hash); |
392 | } | 392 | } |
393 | 393 | ||
394 | spin_lock_irqsave(&priv->chip_lock, flags); | 394 | spin_lock_irqsave(&priv->chip_lock, flags); |
@@ -680,7 +680,7 @@ static const struct net_device_ops am79c961_netdev_ops = { | |||
680 | #endif | 680 | #endif |
681 | }; | 681 | }; |
682 | 682 | ||
683 | static int __init am79c961_probe(struct platform_device *pdev) | 683 | static int __devinit am79c961_probe(struct platform_device *pdev) |
684 | { | 684 | { |
685 | struct resource *res; | 685 | struct resource *res; |
686 | struct net_device *dev; | 686 | struct net_device *dev; |
diff --git a/drivers/net/arm/at91_ether.c b/drivers/net/arm/at91_ether.c index c8bc60a7040c..aed5b5479b50 100644 --- a/drivers/net/arm/at91_ether.c +++ b/drivers/net/arm/at91_ether.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/ethtool.h> | 27 | #include <linux/ethtool.h> |
28 | #include <linux/platform_device.h> | 28 | #include <linux/platform_device.h> |
29 | #include <linux/clk.h> | 29 | #include <linux/clk.h> |
30 | #include <linux/gfp.h> | ||
30 | 31 | ||
31 | #include <asm/io.h> | 32 | #include <asm/io.h> |
32 | #include <asm/uaccess.h> | 33 | #include <asm/uaccess.h> |
@@ -558,14 +559,11 @@ static void at91ether_sethashtable(struct net_device *dev) | |||
558 | { | 559 | { |
559 | struct dev_mc_list *curr; | 560 | struct dev_mc_list *curr; |
560 | unsigned long mc_filter[2]; | 561 | unsigned long mc_filter[2]; |
561 | unsigned int i, bitnr; | 562 | unsigned int bitnr; |
562 | 563 | ||
563 | mc_filter[0] = mc_filter[1] = 0; | 564 | mc_filter[0] = mc_filter[1] = 0; |
564 | 565 | ||
565 | curr = dev->mc_list; | 566 | netdev_for_each_mc_addr(curr, dev) { |
566 | for (i = 0; i < dev->mc_count; i++, curr = curr->next) { | ||
567 | if (!curr) break; /* unexpected end of list */ | ||
568 | |||
569 | bitnr = hash_get_index(curr->dmi_addr); | 567 | bitnr = hash_get_index(curr->dmi_addr); |
570 | mc_filter[bitnr >> 5] |= 1 << (bitnr & 31); | 568 | mc_filter[bitnr >> 5] |= 1 << (bitnr & 31); |
571 | } | 569 | } |
@@ -592,7 +590,7 @@ static void at91ether_set_multicast_list(struct net_device *dev) | |||
592 | at91_emac_write(AT91_EMAC_HSH, -1); | 590 | at91_emac_write(AT91_EMAC_HSH, -1); |
593 | at91_emac_write(AT91_EMAC_HSL, -1); | 591 | at91_emac_write(AT91_EMAC_HSL, -1); |
594 | cfg |= AT91_EMAC_MTI; | 592 | cfg |= AT91_EMAC_MTI; |
595 | } else if (dev->mc_count > 0) { /* Enable specific multicasts */ | 593 | } else if (!netdev_mc_empty(dev)) { /* Enable specific multicasts */ |
596 | at91ether_sethashtable(dev); | 594 | at91ether_sethashtable(dev); |
597 | cfg |= AT91_EMAC_MTI; | 595 | cfg |= AT91_EMAC_MTI; |
598 | } else if (dev->flags & (~IFF_ALLMULTI)) { /* Disable all multicast mode */ | 596 | } else if (dev->flags & (~IFF_ALLMULTI)) { /* Disable all multicast mode */ |
diff --git a/drivers/net/arm/ep93xx_eth.c b/drivers/net/arm/ep93xx_eth.c index b25467ac895c..cd17d09f385c 100644 --- a/drivers/net/arm/ep93xx_eth.c +++ b/drivers/net/arm/ep93xx_eth.c | |||
@@ -9,6 +9,8 @@ | |||
9 | * (at your option) any later version. | 9 | * (at your option) any later version. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #define pr_fmt(fmt) KBUILD_MODNAME ":%s: " fmt, __func__ | ||
13 | |||
12 | #include <linux/dma-mapping.h> | 14 | #include <linux/dma-mapping.h> |
13 | #include <linux/module.h> | 15 | #include <linux/module.h> |
14 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
@@ -20,9 +22,10 @@ | |||
20 | #include <linux/moduleparam.h> | 22 | #include <linux/moduleparam.h> |
21 | #include <linux/platform_device.h> | 23 | #include <linux/platform_device.h> |
22 | #include <linux/delay.h> | 24 | #include <linux/delay.h> |
23 | #include <mach/ep93xx-regs.h> | 25 | #include <linux/io.h> |
24 | #include <mach/platform.h> | 26 | #include <linux/slab.h> |
25 | #include <asm/io.h> | 27 | |
28 | #include <mach/hardware.h> | ||
26 | 29 | ||
27 | #define DRV_MODULE_NAME "ep93xx-eth" | 30 | #define DRV_MODULE_NAME "ep93xx-eth" |
28 | #define DRV_MODULE_VERSION "0.1" | 31 | #define DRV_MODULE_VERSION "0.1" |
@@ -185,7 +188,47 @@ struct ep93xx_priv | |||
185 | #define wrw(ep, off, val) __raw_writew((val), (ep)->base_addr + (off)) | 188 | #define wrw(ep, off, val) __raw_writew((val), (ep)->base_addr + (off)) |
186 | #define wrl(ep, off, val) __raw_writel((val), (ep)->base_addr + (off)) | 189 | #define wrl(ep, off, val) __raw_writel((val), (ep)->base_addr + (off)) |
187 | 190 | ||
188 | static int ep93xx_mdio_read(struct net_device *dev, int phy_id, int reg); | 191 | static int ep93xx_mdio_read(struct net_device *dev, int phy_id, int reg) |
192 | { | ||
193 | struct ep93xx_priv *ep = netdev_priv(dev); | ||
194 | int data; | ||
195 | int i; | ||
196 | |||
197 | wrl(ep, REG_MIICMD, REG_MIICMD_READ | (phy_id << 5) | reg); | ||
198 | |||
199 | for (i = 0; i < 10; i++) { | ||
200 | if ((rdl(ep, REG_MIISTS) & REG_MIISTS_BUSY) == 0) | ||
201 | break; | ||
202 | msleep(1); | ||
203 | } | ||
204 | |||
205 | if (i == 10) { | ||
206 | pr_info("mdio read timed out\n"); | ||
207 | data = 0xffff; | ||
208 | } else { | ||
209 | data = rdl(ep, REG_MIIDATA); | ||
210 | } | ||
211 | |||
212 | return data; | ||
213 | } | ||
214 | |||
215 | static void ep93xx_mdio_write(struct net_device *dev, int phy_id, int reg, int data) | ||
216 | { | ||
217 | struct ep93xx_priv *ep = netdev_priv(dev); | ||
218 | int i; | ||
219 | |||
220 | wrl(ep, REG_MIIDATA, data); | ||
221 | wrl(ep, REG_MIICMD, REG_MIICMD_WRITE | (phy_id << 5) | reg); | ||
222 | |||
223 | for (i = 0; i < 10; i++) { | ||
224 | if ((rdl(ep, REG_MIISTS) & REG_MIISTS_BUSY) == 0) | ||
225 | break; | ||
226 | msleep(1); | ||
227 | } | ||
228 | |||
229 | if (i == 10) | ||
230 | pr_info("mdio write timed out\n"); | ||
231 | } | ||
189 | 232 | ||
190 | static struct net_device_stats *ep93xx_get_stats(struct net_device *dev) | 233 | static struct net_device_stats *ep93xx_get_stats(struct net_device *dev) |
191 | { | 234 | { |
@@ -217,14 +260,11 @@ static int ep93xx_rx(struct net_device *dev, int processed, int budget) | |||
217 | rstat->rstat1 = 0; | 260 | rstat->rstat1 = 0; |
218 | 261 | ||
219 | if (!(rstat0 & RSTAT0_EOF)) | 262 | if (!(rstat0 & RSTAT0_EOF)) |
220 | printk(KERN_CRIT "ep93xx_rx: not end-of-frame " | 263 | pr_crit("not end-of-frame %.8x %.8x\n", rstat0, rstat1); |
221 | " %.8x %.8x\n", rstat0, rstat1); | ||
222 | if (!(rstat0 & RSTAT0_EOB)) | 264 | if (!(rstat0 & RSTAT0_EOB)) |
223 | printk(KERN_CRIT "ep93xx_rx: not end-of-buffer " | 265 | pr_crit("not end-of-buffer %.8x %.8x\n", rstat0, rstat1); |
224 | " %.8x %.8x\n", rstat0, rstat1); | ||
225 | if ((rstat1 & RSTAT1_BUFFER_INDEX) >> 16 != entry) | 266 | if ((rstat1 & RSTAT1_BUFFER_INDEX) >> 16 != entry) |
226 | printk(KERN_CRIT "ep93xx_rx: entry mismatch " | 267 | pr_crit("entry mismatch %.8x %.8x\n", rstat0, rstat1); |
227 | " %.8x %.8x\n", rstat0, rstat1); | ||
228 | 268 | ||
229 | if (!(rstat0 & RSTAT0_RWE)) { | 269 | if (!(rstat0 & RSTAT0_RWE)) { |
230 | ep->stats.rx_errors++; | 270 | ep->stats.rx_errors++; |
@@ -241,8 +281,7 @@ static int ep93xx_rx(struct net_device *dev, int processed, int budget) | |||
241 | 281 | ||
242 | length = rstat1 & RSTAT1_FRAME_LENGTH; | 282 | length = rstat1 & RSTAT1_FRAME_LENGTH; |
243 | if (length > MAX_PKT_SIZE) { | 283 | if (length > MAX_PKT_SIZE) { |
244 | printk(KERN_NOTICE "ep93xx_rx: invalid length " | 284 | pr_notice("invalid length %.8x %.8x\n", rstat0, rstat1); |
245 | " %.8x %.8x\n", rstat0, rstat1); | ||
246 | goto err; | 285 | goto err; |
247 | } | 286 | } |
248 | 287 | ||
@@ -272,11 +311,6 @@ err: | |||
272 | processed++; | 311 | processed++; |
273 | } | 312 | } |
274 | 313 | ||
275 | if (processed) { | ||
276 | wrw(ep, REG_RXDENQ, processed); | ||
277 | wrw(ep, REG_RXSTSENQ, processed); | ||
278 | } | ||
279 | |||
280 | return processed; | 314 | return processed; |
281 | } | 315 | } |
282 | 316 | ||
@@ -311,6 +345,11 @@ poll_some_more: | |||
311 | goto poll_some_more; | 345 | goto poll_some_more; |
312 | } | 346 | } |
313 | 347 | ||
348 | if (rx) { | ||
349 | wrw(ep, REG_RXDENQ, rx); | ||
350 | wrw(ep, REG_RXSTSENQ, rx); | ||
351 | } | ||
352 | |||
314 | return rx; | 353 | return rx; |
315 | } | 354 | } |
316 | 355 | ||
@@ -371,11 +410,9 @@ static void ep93xx_tx_complete(struct net_device *dev) | |||
371 | tstat->tstat0 = 0; | 410 | tstat->tstat0 = 0; |
372 | 411 | ||
373 | if (tstat0 & TSTAT0_FA) | 412 | if (tstat0 & TSTAT0_FA) |
374 | printk(KERN_CRIT "ep93xx_tx_complete: frame aborted " | 413 | pr_crit("frame aborted %.8x\n", tstat0); |
375 | " %.8x\n", tstat0); | ||
376 | if ((tstat0 & TSTAT0_BUFFER_INDEX) != entry) | 414 | if ((tstat0 & TSTAT0_BUFFER_INDEX) != entry) |
377 | printk(KERN_CRIT "ep93xx_tx_complete: entry mismatch " | 415 | pr_crit("entry mismatch %.8x\n", tstat0); |
378 | " %.8x\n", tstat0); | ||
379 | 416 | ||
380 | if (tstat0 & TSTAT0_TXWE) { | 417 | if (tstat0 & TSTAT0_TXWE) { |
381 | int length = ep->descs->tdesc[entry].tdesc1 & 0xfff; | 418 | int length = ep->descs->tdesc[entry].tdesc1 & 0xfff; |
@@ -536,7 +573,7 @@ static int ep93xx_start_hw(struct net_device *dev) | |||
536 | } | 573 | } |
537 | 574 | ||
538 | if (i == 10) { | 575 | if (i == 10) { |
539 | printk(KERN_CRIT DRV_MODULE_NAME ": hw failed to reset\n"); | 576 | pr_crit("hw failed to reset\n"); |
540 | return 1; | 577 | return 1; |
541 | } | 578 | } |
542 | 579 | ||
@@ -581,7 +618,7 @@ static int ep93xx_start_hw(struct net_device *dev) | |||
581 | } | 618 | } |
582 | 619 | ||
583 | if (i == 10) { | 620 | if (i == 10) { |
584 | printk(KERN_CRIT DRV_MODULE_NAME ": hw failed to start\n"); | 621 | pr_crit("hw failed to start\n"); |
585 | return 1; | 622 | return 1; |
586 | } | 623 | } |
587 | 624 | ||
@@ -617,7 +654,7 @@ static void ep93xx_stop_hw(struct net_device *dev) | |||
617 | } | 654 | } |
618 | 655 | ||
619 | if (i == 10) | 656 | if (i == 10) |
620 | printk(KERN_CRIT DRV_MODULE_NAME ": hw failed to reset\n"); | 657 | pr_crit("hw failed to reset\n"); |
621 | } | 658 | } |
622 | 659 | ||
623 | static int ep93xx_open(struct net_device *dev) | 660 | static int ep93xx_open(struct net_device *dev) |
@@ -681,48 +718,6 @@ static int ep93xx_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
681 | return generic_mii_ioctl(&ep->mii, data, cmd, NULL); | 718 | return generic_mii_ioctl(&ep->mii, data, cmd, NULL); |
682 | } | 719 | } |
683 | 720 | ||
684 | static int ep93xx_mdio_read(struct net_device *dev, int phy_id, int reg) | ||
685 | { | ||
686 | struct ep93xx_priv *ep = netdev_priv(dev); | ||
687 | int data; | ||
688 | int i; | ||
689 | |||
690 | wrl(ep, REG_MIICMD, REG_MIICMD_READ | (phy_id << 5) | reg); | ||
691 | |||
692 | for (i = 0; i < 10; i++) { | ||
693 | if ((rdl(ep, REG_MIISTS) & REG_MIISTS_BUSY) == 0) | ||
694 | break; | ||
695 | msleep(1); | ||
696 | } | ||
697 | |||
698 | if (i == 10) { | ||
699 | printk(KERN_INFO DRV_MODULE_NAME ": mdio read timed out\n"); | ||
700 | data = 0xffff; | ||
701 | } else { | ||
702 | data = rdl(ep, REG_MIIDATA); | ||
703 | } | ||
704 | |||
705 | return data; | ||
706 | } | ||
707 | |||
708 | static void ep93xx_mdio_write(struct net_device *dev, int phy_id, int reg, int data) | ||
709 | { | ||
710 | struct ep93xx_priv *ep = netdev_priv(dev); | ||
711 | int i; | ||
712 | |||
713 | wrl(ep, REG_MIIDATA, data); | ||
714 | wrl(ep, REG_MIICMD, REG_MIICMD_WRITE | (phy_id << 5) | reg); | ||
715 | |||
716 | for (i = 0; i < 10; i++) { | ||
717 | if ((rdl(ep, REG_MIISTS) & REG_MIISTS_BUSY) == 0) | ||
718 | break; | ||
719 | msleep(1); | ||
720 | } | ||
721 | |||
722 | if (i == 10) | ||
723 | printk(KERN_INFO DRV_MODULE_NAME ": mdio write timed out\n"); | ||
724 | } | ||
725 | |||
726 | static void ep93xx_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) | 721 | static void ep93xx_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) |
727 | { | 722 | { |
728 | strcpy(info->driver, DRV_MODULE_NAME); | 723 | strcpy(info->driver, DRV_MODULE_NAME); |
@@ -825,12 +820,19 @@ static int ep93xx_eth_probe(struct platform_device *pdev) | |||
825 | struct ep93xx_eth_data *data; | 820 | struct ep93xx_eth_data *data; |
826 | struct net_device *dev; | 821 | struct net_device *dev; |
827 | struct ep93xx_priv *ep; | 822 | struct ep93xx_priv *ep; |
823 | struct resource *mem; | ||
824 | int irq; | ||
828 | int err; | 825 | int err; |
829 | 826 | ||
830 | if (pdev == NULL) | 827 | if (pdev == NULL) |
831 | return -ENODEV; | 828 | return -ENODEV; |
832 | data = pdev->dev.platform_data; | 829 | data = pdev->dev.platform_data; |
833 | 830 | ||
831 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
832 | irq = platform_get_irq(pdev, 0); | ||
833 | if (!mem || irq < 0) | ||
834 | return -ENXIO; | ||
835 | |||
834 | dev = ep93xx_dev_alloc(data); | 836 | dev = ep93xx_dev_alloc(data); |
835 | if (dev == NULL) { | 837 | if (dev == NULL) { |
836 | err = -ENOMEM; | 838 | err = -ENOMEM; |
@@ -842,23 +844,21 @@ static int ep93xx_eth_probe(struct platform_device *pdev) | |||
842 | 844 | ||
843 | platform_set_drvdata(pdev, dev); | 845 | platform_set_drvdata(pdev, dev); |
844 | 846 | ||
845 | ep->res = request_mem_region(pdev->resource[0].start, | 847 | ep->res = request_mem_region(mem->start, resource_size(mem), |
846 | pdev->resource[0].end - pdev->resource[0].start + 1, | 848 | dev_name(&pdev->dev)); |
847 | dev_name(&pdev->dev)); | ||
848 | if (ep->res == NULL) { | 849 | if (ep->res == NULL) { |
849 | dev_err(&pdev->dev, "Could not reserve memory region\n"); | 850 | dev_err(&pdev->dev, "Could not reserve memory region\n"); |
850 | err = -ENOMEM; | 851 | err = -ENOMEM; |
851 | goto err_out; | 852 | goto err_out; |
852 | } | 853 | } |
853 | 854 | ||
854 | ep->base_addr = ioremap(pdev->resource[0].start, | 855 | ep->base_addr = ioremap(mem->start, resource_size(mem)); |
855 | pdev->resource[0].end - pdev->resource[0].start); | ||
856 | if (ep->base_addr == NULL) { | 856 | if (ep->base_addr == NULL) { |
857 | dev_err(&pdev->dev, "Failed to ioremap ethernet registers\n"); | 857 | dev_err(&pdev->dev, "Failed to ioremap ethernet registers\n"); |
858 | err = -EIO; | 858 | err = -EIO; |
859 | goto err_out; | 859 | goto err_out; |
860 | } | 860 | } |
861 | ep->irq = pdev->resource[1].start; | 861 | ep->irq = irq; |
862 | 862 | ||
863 | ep->mii.phy_id = data->phy_id; | 863 | ep->mii.phy_id = data->phy_id; |
864 | ep->mii.phy_id_mask = 0x1f; | 864 | ep->mii.phy_id_mask = 0x1f; |
@@ -877,11 +877,8 @@ static int ep93xx_eth_probe(struct platform_device *pdev) | |||
877 | goto err_out; | 877 | goto err_out; |
878 | } | 878 | } |
879 | 879 | ||
880 | printk(KERN_INFO "%s: ep93xx on-chip ethernet, IRQ %d, " | 880 | printk(KERN_INFO "%s: ep93xx on-chip ethernet, IRQ %d, %pM\n", |
881 | "%.2x:%.2x:%.2x:%.2x:%.2x:%.2x.\n", dev->name, | 881 | dev->name, ep->irq, dev->dev_addr); |
882 | ep->irq, data->dev_addr[0], data->dev_addr[1], | ||
883 | data->dev_addr[2], data->dev_addr[3], | ||
884 | data->dev_addr[4], data->dev_addr[5]); | ||
885 | 882 | ||
886 | return 0; | 883 | return 0; |
887 | 884 | ||
diff --git a/drivers/net/arm/ether3.c b/drivers/net/arm/ether3.c index 1f7a69c929a6..d9de9bce2395 100644 --- a/drivers/net/arm/ether3.c +++ b/drivers/net/arm/ether3.c | |||
@@ -463,7 +463,7 @@ static void ether3_setmulticastlist(struct net_device *dev) | |||
463 | if (dev->flags & IFF_PROMISC) { | 463 | if (dev->flags & IFF_PROMISC) { |
464 | /* promiscuous mode */ | 464 | /* promiscuous mode */ |
465 | priv(dev)->regs.config1 |= CFG1_RECVPROMISC; | 465 | priv(dev)->regs.config1 |= CFG1_RECVPROMISC; |
466 | } else if (dev->flags & IFF_ALLMULTI || dev->mc_count) { | 466 | } else if (dev->flags & IFF_ALLMULTI || !netdev_mc_empty(dev)) { |
467 | priv(dev)->regs.config1 |= CFG1_RECVSPECBRMULTI; | 467 | priv(dev)->regs.config1 |= CFG1_RECVSPECBRMULTI; |
468 | } else | 468 | } else |
469 | priv(dev)->regs.config1 |= CFG1_RECVSPECBROAD; | 469 | priv(dev)->regs.config1 |= CFG1_RECVSPECBROAD; |
diff --git a/drivers/net/arm/etherh.c b/drivers/net/arm/etherh.c index f52f668c49bf..4af235d41fda 100644 --- a/drivers/net/arm/etherh.c +++ b/drivers/net/arm/etherh.c | |||
@@ -33,7 +33,6 @@ | |||
33 | #include <linux/interrupt.h> | 33 | #include <linux/interrupt.h> |
34 | #include <linux/ioport.h> | 34 | #include <linux/ioport.h> |
35 | #include <linux/in.h> | 35 | #include <linux/in.h> |
36 | #include <linux/slab.h> | ||
37 | #include <linux/string.h> | 36 | #include <linux/string.h> |
38 | #include <linux/errno.h> | 37 | #include <linux/errno.h> |
39 | #include <linux/netdevice.h> | 38 | #include <linux/netdevice.h> |
diff --git a/drivers/net/arm/ixp4xx_eth.c b/drivers/net/arm/ixp4xx_eth.c index 691b81eb0f46..6be8b098b8b4 100644 --- a/drivers/net/arm/ixp4xx_eth.c +++ b/drivers/net/arm/ixp4xx_eth.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/kernel.h> | 32 | #include <linux/kernel.h> |
33 | #include <linux/phy.h> | 33 | #include <linux/phy.h> |
34 | #include <linux/platform_device.h> | 34 | #include <linux/platform_device.h> |
35 | #include <linux/slab.h> | ||
35 | #include <mach/npe.h> | 36 | #include <mach/npe.h> |
36 | #include <mach/qmgr.h> | 37 | #include <mach/qmgr.h> |
37 | 38 | ||
@@ -322,7 +323,7 @@ static int ixp4xx_mdio_write(struct mii_bus *bus, int phy_id, int location, | |||
322 | ret = ixp4xx_mdio_cmd(bus, phy_id, location, 1, val); | 323 | ret = ixp4xx_mdio_cmd(bus, phy_id, location, 1, val); |
323 | spin_unlock_irqrestore(&mdio_lock, flags); | 324 | spin_unlock_irqrestore(&mdio_lock, flags); |
324 | #if DEBUG_MDIO | 325 | #if DEBUG_MDIO |
325 | printk(KERN_DEBUG "%s #%i: MII read [%i] <- 0x%X, err = %i\n", | 326 | printk(KERN_DEBUG "%s #%i: MII write [%i] <- 0x%X, err = %i\n", |
326 | bus->name, phy_id, location, val, ret); | 327 | bus->name, phy_id, location, val, ret); |
327 | #endif | 328 | #endif |
328 | return ret; | 329 | return ret; |
@@ -735,22 +736,25 @@ static int eth_xmit(struct sk_buff *skb, struct net_device *dev) | |||
735 | static void eth_set_mcast_list(struct net_device *dev) | 736 | static void eth_set_mcast_list(struct net_device *dev) |
736 | { | 737 | { |
737 | struct port *port = netdev_priv(dev); | 738 | struct port *port = netdev_priv(dev); |
738 | struct dev_mc_list *mclist = dev->mc_list; | 739 | struct dev_mc_list *mclist; |
739 | u8 diffs[ETH_ALEN], *addr; | 740 | u8 diffs[ETH_ALEN], *addr; |
740 | int cnt = dev->mc_count, i; | 741 | int i; |
741 | 742 | ||
742 | if ((dev->flags & IFF_PROMISC) || !mclist || !cnt) { | 743 | if ((dev->flags & IFF_PROMISC) || netdev_mc_empty(dev)) { |
743 | __raw_writel(DEFAULT_RX_CNTRL0 & ~RX_CNTRL0_ADDR_FLTR_EN, | 744 | __raw_writel(DEFAULT_RX_CNTRL0 & ~RX_CNTRL0_ADDR_FLTR_EN, |
744 | &port->regs->rx_control[0]); | 745 | &port->regs->rx_control[0]); |
745 | return; | 746 | return; |
746 | } | 747 | } |
747 | 748 | ||
748 | memset(diffs, 0, ETH_ALEN); | 749 | memset(diffs, 0, ETH_ALEN); |
749 | addr = mclist->dmi_addr; /* first MAC address */ | ||
750 | 750 | ||
751 | while (--cnt && (mclist = mclist->next)) | 751 | addr = NULL; |
752 | netdev_for_each_mc_addr(mclist, dev) { | ||
753 | if (!addr) | ||
754 | addr = mclist->dmi_addr; /* first MAC address */ | ||
752 | for (i = 0; i < ETH_ALEN; i++) | 755 | for (i = 0; i < ETH_ALEN; i++) |
753 | diffs[i] |= addr[i] ^ mclist->dmi_addr[i]; | 756 | diffs[i] |= addr[i] ^ mclist->dmi_addr[i]; |
757 | } | ||
754 | 758 | ||
755 | for (i = 0; i < ETH_ALEN; i++) { | 759 | for (i = 0; i < ETH_ALEN; i++) { |
756 | __raw_writel(addr[i], &port->regs->mcast_addr[i]); | 760 | __raw_writel(addr[i], &port->regs->mcast_addr[i]); |
diff --git a/drivers/net/arm/ks8695net.c b/drivers/net/arm/ks8695net.c index 2a7b7745cc55..84f8a8f73802 100644 --- a/drivers/net/arm/ks8695net.c +++ b/drivers/net/arm/ks8695net.c | |||
@@ -30,16 +30,19 @@ | |||
30 | #include <linux/platform_device.h> | 30 | #include <linux/platform_device.h> |
31 | #include <linux/irq.h> | 31 | #include <linux/irq.h> |
32 | #include <linux/io.h> | 32 | #include <linux/io.h> |
33 | #include <linux/slab.h> | ||
33 | 34 | ||
34 | #include <asm/irq.h> | 35 | #include <asm/irq.h> |
35 | 36 | ||
36 | #include <mach/regs-switch.h> | 37 | #include <mach/regs-switch.h> |
37 | #include <mach/regs-misc.h> | 38 | #include <mach/regs-misc.h> |
39 | #include <asm/mach/irq.h> | ||
40 | #include <mach/regs-irq.h> | ||
38 | 41 | ||
39 | #include "ks8695net.h" | 42 | #include "ks8695net.h" |
40 | 43 | ||
41 | #define MODULENAME "ks8695_ether" | 44 | #define MODULENAME "ks8695_ether" |
42 | #define MODULEVERSION "1.01" | 45 | #define MODULEVERSION "1.02" |
43 | 46 | ||
44 | /* | 47 | /* |
45 | * Transmit and device reset timeout, default 5 seconds. | 48 | * Transmit and device reset timeout, default 5 seconds. |
@@ -95,6 +98,9 @@ struct ks8695_skbuff { | |||
95 | #define MAX_RX_DESC 16 | 98 | #define MAX_RX_DESC 16 |
96 | #define MAX_RX_DESC_MASK 0xf | 99 | #define MAX_RX_DESC_MASK 0xf |
97 | 100 | ||
101 | /*napi_weight have better more than rx DMA buffers*/ | ||
102 | #define NAPI_WEIGHT 64 | ||
103 | |||
98 | #define MAX_RXBUF_SIZE 0x700 | 104 | #define MAX_RXBUF_SIZE 0x700 |
99 | 105 | ||
100 | #define TX_RING_DMA_SIZE (sizeof(struct tx_ring_desc) * MAX_TX_DESC) | 106 | #define TX_RING_DMA_SIZE (sizeof(struct tx_ring_desc) * MAX_TX_DESC) |
@@ -120,6 +126,7 @@ enum ks8695_dtype { | |||
120 | * @dev: The platform device object for this interface | 126 | * @dev: The platform device object for this interface |
121 | * @dtype: The type of this device | 127 | * @dtype: The type of this device |
122 | * @io_regs: The ioremapped registers for this interface | 128 | * @io_regs: The ioremapped registers for this interface |
129 | * @napi : Add support NAPI for Rx | ||
123 | * @rx_irq_name: The textual name of the RX IRQ from the platform data | 130 | * @rx_irq_name: The textual name of the RX IRQ from the platform data |
124 | * @tx_irq_name: The textual name of the TX IRQ from the platform data | 131 | * @tx_irq_name: The textual name of the TX IRQ from the platform data |
125 | * @link_irq_name: The textual name of the link IRQ from the | 132 | * @link_irq_name: The textual name of the link IRQ from the |
@@ -143,6 +150,7 @@ enum ks8695_dtype { | |||
143 | * @rx_ring_dma: The DMA mapped equivalent of rx_ring | 150 | * @rx_ring_dma: The DMA mapped equivalent of rx_ring |
144 | * @rx_buffers: The sk_buff mappings for the RX ring | 151 | * @rx_buffers: The sk_buff mappings for the RX ring |
145 | * @next_rx_desc_read: The next RX descriptor to read from on IRQ | 152 | * @next_rx_desc_read: The next RX descriptor to read from on IRQ |
153 | * @rx_lock: A lock to protect Rx irq function | ||
146 | * @msg_enable: The flags for which messages to emit | 154 | * @msg_enable: The flags for which messages to emit |
147 | */ | 155 | */ |
148 | struct ks8695_priv { | 156 | struct ks8695_priv { |
@@ -152,6 +160,8 @@ struct ks8695_priv { | |||
152 | enum ks8695_dtype dtype; | 160 | enum ks8695_dtype dtype; |
153 | void __iomem *io_regs; | 161 | void __iomem *io_regs; |
154 | 162 | ||
163 | struct napi_struct napi; | ||
164 | |||
155 | const char *rx_irq_name, *tx_irq_name, *link_irq_name; | 165 | const char *rx_irq_name, *tx_irq_name, *link_irq_name; |
156 | int rx_irq, tx_irq, link_irq; | 166 | int rx_irq, tx_irq, link_irq; |
157 | 167 | ||
@@ -172,6 +182,7 @@ struct ks8695_priv { | |||
172 | dma_addr_t rx_ring_dma; | 182 | dma_addr_t rx_ring_dma; |
173 | struct ks8695_skbuff rx_buffers[MAX_RX_DESC]; | 183 | struct ks8695_skbuff rx_buffers[MAX_RX_DESC]; |
174 | int next_rx_desc_read; | 184 | int next_rx_desc_read; |
185 | spinlock_t rx_lock; | ||
175 | 186 | ||
176 | int msg_enable; | 187 | int msg_enable; |
177 | }; | 188 | }; |
@@ -317,25 +328,24 @@ ks8695_refill_rxbuffers(struct ks8695_priv *ksp) | |||
317 | */ | 328 | */ |
318 | static void | 329 | static void |
319 | ks8695_init_partial_multicast(struct ks8695_priv *ksp, | 330 | ks8695_init_partial_multicast(struct ks8695_priv *ksp, |
320 | struct dev_mc_list *addr, | 331 | struct net_device *ndev) |
321 | int nr_addr) | ||
322 | { | 332 | { |
323 | u32 low, high; | 333 | u32 low, high; |
324 | int i; | 334 | int i; |
335 | struct dev_mc_list *dmi; | ||
325 | 336 | ||
326 | for (i = 0; i < nr_addr; i++, addr = addr->next) { | 337 | i = 0; |
327 | /* Ran out of addresses? */ | 338 | netdev_for_each_mc_addr(dmi, ndev) { |
328 | if (!addr) | ||
329 | break; | ||
330 | /* Ran out of space in chip? */ | 339 | /* Ran out of space in chip? */ |
331 | BUG_ON(i == KS8695_NR_ADDRESSES); | 340 | BUG_ON(i == KS8695_NR_ADDRESSES); |
332 | 341 | ||
333 | low = (addr->dmi_addr[2] << 24) | (addr->dmi_addr[3] << 16) | | 342 | low = (dmi->dmi_addr[2] << 24) | (dmi->dmi_addr[3] << 16) | |
334 | (addr->dmi_addr[4] << 8) | (addr->dmi_addr[5]); | 343 | (dmi->dmi_addr[4] << 8) | (dmi->dmi_addr[5]); |
335 | high = (addr->dmi_addr[0] << 8) | (addr->dmi_addr[1]); | 344 | high = (dmi->dmi_addr[0] << 8) | (dmi->dmi_addr[1]); |
336 | 345 | ||
337 | ks8695_writereg(ksp, KS8695_AAL_(i), low); | 346 | ks8695_writereg(ksp, KS8695_AAL_(i), low); |
338 | ks8695_writereg(ksp, KS8695_AAH_(i), AAH_E | high); | 347 | ks8695_writereg(ksp, KS8695_AAH_(i), AAH_E | high); |
348 | i++; | ||
339 | } | 349 | } |
340 | 350 | ||
341 | /* Clear the remaining Additional Station Addresses */ | 351 | /* Clear the remaining Additional Station Addresses */ |
@@ -392,31 +402,75 @@ ks8695_tx_irq(int irq, void *dev_id) | |||
392 | } | 402 | } |
393 | 403 | ||
394 | /** | 404 | /** |
405 | * ks8695_get_rx_enable_bit - Get rx interrupt enable/status bit | ||
406 | * @ksp: Private data for the KS8695 Ethernet | ||
407 | * | ||
408 | * For KS8695 document: | ||
409 | * Interrupt Enable Register (offset 0xE204) | ||
410 | * Bit29 : WAN MAC Receive Interrupt Enable | ||
411 | * Bit16 : LAN MAC Receive Interrupt Enable | ||
412 | * Interrupt Status Register (Offset 0xF208) | ||
413 | * Bit29: WAN MAC Receive Status | ||
414 | * Bit16: LAN MAC Receive Status | ||
415 | * So, this Rx interrrupt enable/status bit number is equal | ||
416 | * as Rx IRQ number. | ||
417 | */ | ||
418 | static inline u32 ks8695_get_rx_enable_bit(struct ks8695_priv *ksp) | ||
419 | { | ||
420 | return ksp->rx_irq; | ||
421 | } | ||
422 | |||
423 | /** | ||
395 | * ks8695_rx_irq - Receive IRQ handler | 424 | * ks8695_rx_irq - Receive IRQ handler |
396 | * @irq: The IRQ which went off (ignored) | 425 | * @irq: The IRQ which went off (ignored) |
397 | * @dev_id: The net_device for the interrupt | 426 | * @dev_id: The net_device for the interrupt |
398 | * | 427 | * |
399 | * Process the RX ring, passing any received packets up to the | 428 | * Inform NAPI that packet reception needs to be scheduled |
400 | * host. If we received anything other than errors, we then | ||
401 | * refill the ring. | ||
402 | */ | 429 | */ |
430 | |||
403 | static irqreturn_t | 431 | static irqreturn_t |
404 | ks8695_rx_irq(int irq, void *dev_id) | 432 | ks8695_rx_irq(int irq, void *dev_id) |
405 | { | 433 | { |
406 | struct net_device *ndev = (struct net_device *)dev_id; | 434 | struct net_device *ndev = (struct net_device *)dev_id; |
407 | struct ks8695_priv *ksp = netdev_priv(ndev); | 435 | struct ks8695_priv *ksp = netdev_priv(ndev); |
436 | |||
437 | spin_lock(&ksp->rx_lock); | ||
438 | |||
439 | if (napi_schedule_prep(&ksp->napi)) { | ||
440 | unsigned long status = readl(KS8695_IRQ_VA + KS8695_INTEN); | ||
441 | unsigned long mask_bit = 1 << ks8695_get_rx_enable_bit(ksp); | ||
442 | /*disable rx interrupt*/ | ||
443 | status &= ~mask_bit; | ||
444 | writel(status , KS8695_IRQ_VA + KS8695_INTEN); | ||
445 | __napi_schedule(&ksp->napi); | ||
446 | } | ||
447 | |||
448 | spin_unlock(&ksp->rx_lock); | ||
449 | return IRQ_HANDLED; | ||
450 | } | ||
451 | |||
452 | /** | ||
453 | * ks8695_rx - Receive packets called by NAPI poll method | ||
454 | * @ksp: Private data for the KS8695 Ethernet | ||
455 | * @budget: Number of packets allowed to process | ||
456 | */ | ||
457 | static int ks8695_rx(struct ks8695_priv *ksp, int budget) | ||
458 | { | ||
459 | struct net_device *ndev = ksp->ndev; | ||
408 | struct sk_buff *skb; | 460 | struct sk_buff *skb; |
409 | int buff_n; | 461 | int buff_n; |
410 | u32 flags; | 462 | u32 flags; |
411 | int pktlen; | 463 | int pktlen; |
412 | int last_rx_processed = -1; | 464 | int received = 0; |
413 | 465 | ||
414 | buff_n = ksp->next_rx_desc_read; | 466 | buff_n = ksp->next_rx_desc_read; |
415 | do { | 467 | while (received < budget |
416 | if (ksp->rx_buffers[buff_n].skb && | 468 | && ksp->rx_buffers[buff_n].skb |
417 | !(ksp->rx_ring[buff_n].status & cpu_to_le32(RDES_OWN))) { | 469 | && (!(ksp->rx_ring[buff_n].status & |
470 | cpu_to_le32(RDES_OWN)))) { | ||
418 | rmb(); | 471 | rmb(); |
419 | flags = le32_to_cpu(ksp->rx_ring[buff_n].status); | 472 | flags = le32_to_cpu(ksp->rx_ring[buff_n].status); |
473 | |||
420 | /* Found an SKB which we own, this means we | 474 | /* Found an SKB which we own, this means we |
421 | * received a packet | 475 | * received a packet |
422 | */ | 476 | */ |
@@ -464,7 +518,7 @@ ks8695_rx_irq(int irq, void *dev_id) | |||
464 | /* Relinquish the SKB to the network layer */ | 518 | /* Relinquish the SKB to the network layer */ |
465 | skb_put(skb, pktlen); | 519 | skb_put(skb, pktlen); |
466 | skb->protocol = eth_type_trans(skb, ndev); | 520 | skb->protocol = eth_type_trans(skb, ndev); |
467 | netif_rx(skb); | 521 | netif_receive_skb(skb); |
468 | 522 | ||
469 | /* Record stats */ | 523 | /* Record stats */ |
470 | ndev->stats.rx_packets++; | 524 | ndev->stats.rx_packets++; |
@@ -478,21 +532,12 @@ rx_failure: | |||
478 | /* Give the ring entry back to the hardware */ | 532 | /* Give the ring entry back to the hardware */ |
479 | ksp->rx_ring[buff_n].status = cpu_to_le32(RDES_OWN); | 533 | ksp->rx_ring[buff_n].status = cpu_to_le32(RDES_OWN); |
480 | rx_finished: | 534 | rx_finished: |
481 | /* And note this as processed so we can start | 535 | received++; |
482 | * from here next time | 536 | buff_n = (buff_n + 1) & MAX_RX_DESC_MASK; |
483 | */ | 537 | } |
484 | last_rx_processed = buff_n; | ||
485 | } else { | ||
486 | /* Ran out of things to process, stop now */ | ||
487 | break; | ||
488 | } | ||
489 | buff_n = (buff_n + 1) & MAX_RX_DESC_MASK; | ||
490 | } while (buff_n != ksp->next_rx_desc_read); | ||
491 | 538 | ||
492 | /* And note which RX descriptor we last did anything with */ | 539 | /* And note which RX descriptor we last did */ |
493 | if (likely(last_rx_processed != -1)) | 540 | ksp->next_rx_desc_read = buff_n; |
494 | ksp->next_rx_desc_read = | ||
495 | (last_rx_processed + 1) & MAX_RX_DESC_MASK; | ||
496 | 541 | ||
497 | /* And refill the buffers */ | 542 | /* And refill the buffers */ |
498 | ks8695_refill_rxbuffers(ksp); | 543 | ks8695_refill_rxbuffers(ksp); |
@@ -500,7 +545,37 @@ rx_finished: | |||
500 | /* Kick the RX DMA engine, in case it became suspended */ | 545 | /* Kick the RX DMA engine, in case it became suspended */ |
501 | ks8695_writereg(ksp, KS8695_DRSC, 0); | 546 | ks8695_writereg(ksp, KS8695_DRSC, 0); |
502 | 547 | ||
503 | return IRQ_HANDLED; | 548 | return received; |
549 | } | ||
550 | |||
551 | |||
552 | /** | ||
553 | * ks8695_poll - Receive packet by NAPI poll method | ||
554 | * @ksp: Private data for the KS8695 Ethernet | ||
555 | * @budget: The remaining number packets for network subsystem | ||
556 | * | ||
557 | * Invoked by the network core when it requests for new | ||
558 | * packets from the driver | ||
559 | */ | ||
560 | static int ks8695_poll(struct napi_struct *napi, int budget) | ||
561 | { | ||
562 | struct ks8695_priv *ksp = container_of(napi, struct ks8695_priv, napi); | ||
563 | unsigned long work_done; | ||
564 | |||
565 | unsigned long isr = readl(KS8695_IRQ_VA + KS8695_INTEN); | ||
566 | unsigned long mask_bit = 1 << ks8695_get_rx_enable_bit(ksp); | ||
567 | |||
568 | work_done = ks8695_rx(ksp, budget); | ||
569 | |||
570 | if (work_done < budget) { | ||
571 | unsigned long flags; | ||
572 | spin_lock_irqsave(&ksp->rx_lock, flags); | ||
573 | __napi_complete(napi); | ||
574 | /*enable rx interrupt*/ | ||
575 | writel(isr | mask_bit, KS8695_IRQ_VA + KS8695_INTEN); | ||
576 | spin_unlock_irqrestore(&ksp->rx_lock, flags); | ||
577 | } | ||
578 | return work_done; | ||
504 | } | 579 | } |
505 | 580 | ||
506 | /** | 581 | /** |
@@ -1126,7 +1201,7 @@ ks8695_set_multicast(struct net_device *ndev) | |||
1126 | if (ndev->flags & IFF_ALLMULTI) { | 1201 | if (ndev->flags & IFF_ALLMULTI) { |
1127 | /* enable all multicast mode */ | 1202 | /* enable all multicast mode */ |
1128 | ctrl |= DRXC_RM; | 1203 | ctrl |= DRXC_RM; |
1129 | } else if (ndev->mc_count > KS8695_NR_ADDRESSES) { | 1204 | } else if (netdev_mc_count(ndev) > KS8695_NR_ADDRESSES) { |
1130 | /* more specific multicast addresses than can be | 1205 | /* more specific multicast addresses than can be |
1131 | * handled in hardware | 1206 | * handled in hardware |
1132 | */ | 1207 | */ |
@@ -1134,8 +1209,7 @@ ks8695_set_multicast(struct net_device *ndev) | |||
1134 | } else { | 1209 | } else { |
1135 | /* enable specific multicasts */ | 1210 | /* enable specific multicasts */ |
1136 | ctrl &= ~DRXC_RM; | 1211 | ctrl &= ~DRXC_RM; |
1137 | ks8695_init_partial_multicast(ksp, ndev->mc_list, | 1212 | ks8695_init_partial_multicast(ksp, ndev); |
1138 | ndev->mc_count); | ||
1139 | } | 1213 | } |
1140 | 1214 | ||
1141 | ks8695_writereg(ksp, KS8695_DRXC, ctrl); | 1215 | ks8695_writereg(ksp, KS8695_DRXC, ctrl); |
@@ -1253,7 +1327,7 @@ ks8695_stop(struct net_device *ndev) | |||
1253 | struct ks8695_priv *ksp = netdev_priv(ndev); | 1327 | struct ks8695_priv *ksp = netdev_priv(ndev); |
1254 | 1328 | ||
1255 | netif_stop_queue(ndev); | 1329 | netif_stop_queue(ndev); |
1256 | netif_carrier_off(ndev); | 1330 | napi_disable(&ksp->napi); |
1257 | 1331 | ||
1258 | ks8695_shutdown(ksp); | 1332 | ks8695_shutdown(ksp); |
1259 | 1333 | ||
@@ -1287,6 +1361,7 @@ ks8695_open(struct net_device *ndev) | |||
1287 | return ret; | 1361 | return ret; |
1288 | } | 1362 | } |
1289 | 1363 | ||
1364 | napi_enable(&ksp->napi); | ||
1290 | netif_start_queue(ndev); | 1365 | netif_start_queue(ndev); |
1291 | 1366 | ||
1292 | return 0; | 1367 | return 0; |
@@ -1472,6 +1547,8 @@ ks8695_probe(struct platform_device *pdev) | |||
1472 | SET_ETHTOOL_OPS(ndev, &ks8695_ethtool_ops); | 1547 | SET_ETHTOOL_OPS(ndev, &ks8695_ethtool_ops); |
1473 | ndev->watchdog_timeo = msecs_to_jiffies(watchdog); | 1548 | ndev->watchdog_timeo = msecs_to_jiffies(watchdog); |
1474 | 1549 | ||
1550 | netif_napi_add(ndev, &ksp->napi, ks8695_poll, NAPI_WEIGHT); | ||
1551 | |||
1475 | /* Retrieve the default MAC addr from the chip. */ | 1552 | /* Retrieve the default MAC addr from the chip. */ |
1476 | /* The bootloader should have left it in there for us. */ | 1553 | /* The bootloader should have left it in there for us. */ |
1477 | 1554 | ||
@@ -1505,6 +1582,7 @@ ks8695_probe(struct platform_device *pdev) | |||
1505 | 1582 | ||
1506 | /* And initialise the queue's lock */ | 1583 | /* And initialise the queue's lock */ |
1507 | spin_lock_init(&ksp->txq_lock); | 1584 | spin_lock_init(&ksp->txq_lock); |
1585 | spin_lock_init(&ksp->rx_lock); | ||
1508 | 1586 | ||
1509 | /* Specify the RX DMA ring buffer */ | 1587 | /* Specify the RX DMA ring buffer */ |
1510 | ksp->rx_ring = ksp->ring_base + TX_RING_DMA_SIZE; | 1588 | ksp->rx_ring = ksp->ring_base + TX_RING_DMA_SIZE; |
@@ -1626,6 +1704,7 @@ ks8695_drv_remove(struct platform_device *pdev) | |||
1626 | struct ks8695_priv *ksp = netdev_priv(ndev); | 1704 | struct ks8695_priv *ksp = netdev_priv(ndev); |
1627 | 1705 | ||
1628 | platform_set_drvdata(pdev, NULL); | 1706 | platform_set_drvdata(pdev, NULL); |
1707 | netif_napi_del(&ksp->napi); | ||
1629 | 1708 | ||
1630 | unregister_netdev(ndev); | 1709 | unregister_netdev(ndev); |
1631 | ks8695_release_device(ksp); | 1710 | ks8695_release_device(ksp); |
diff --git a/drivers/net/arm/w90p910_ether.c b/drivers/net/arm/w90p910_ether.c index 25e2627eb118..f7c9ca1dfb17 100644 --- a/drivers/net/arm/w90p910_ether.c +++ b/drivers/net/arm/w90p910_ether.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/ethtool.h> | 18 | #include <linux/ethtool.h> |
19 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
20 | #include <linux/clk.h> | 20 | #include <linux/clk.h> |
21 | #include <linux/gfp.h> | ||
21 | 22 | ||
22 | #define DRV_MODULE_NAME "w90p910-emc" | 23 | #define DRV_MODULE_NAME "w90p910-emc" |
23 | #define DRV_MODULE_VERSION "0.1" | 24 | #define DRV_MODULE_VERSION "0.1" |
@@ -160,8 +161,8 @@ struct w90p910_ether { | |||
160 | struct mii_if_info mii; | 161 | struct mii_if_info mii; |
161 | struct timer_list check_timer; | 162 | struct timer_list check_timer; |
162 | void __iomem *reg; | 163 | void __iomem *reg; |
163 | unsigned int rxirq; | 164 | int rxirq; |
164 | unsigned int txirq; | 165 | int txirq; |
165 | unsigned int cur_tx; | 166 | unsigned int cur_tx; |
166 | unsigned int cur_rx; | 167 | unsigned int cur_rx; |
167 | unsigned int finish_tx; | 168 | unsigned int finish_tx; |
@@ -858,10 +859,10 @@ static void w90p910_ether_set_multicast_list(struct net_device *dev) | |||
858 | 859 | ||
859 | if (dev->flags & IFF_PROMISC) | 860 | if (dev->flags & IFF_PROMISC) |
860 | rx_mode = CAMCMR_AUP | CAMCMR_AMP | CAMCMR_ABP | CAMCMR_ECMP; | 861 | rx_mode = CAMCMR_AUP | CAMCMR_AMP | CAMCMR_ABP | CAMCMR_ECMP; |
861 | else if ((dev->flags & IFF_ALLMULTI) || dev->mc_list) | 862 | else if ((dev->flags & IFF_ALLMULTI) || !netdev_mc_empty(dev)) |
862 | rx_mode = CAMCMR_AMP | CAMCMR_ABP | CAMCMR_ECMP; | 863 | rx_mode = CAMCMR_AMP | CAMCMR_ABP | CAMCMR_ECMP; |
863 | else | 864 | else |
864 | rx_mode = CAMCMR_ECMP | CAMCMR_ABP; | 865 | rx_mode = CAMCMR_ECMP | CAMCMR_ABP; |
865 | __raw_writel(rx_mode, ether->reg + REG_CAMCMR); | 866 | __raw_writel(rx_mode, ether->reg + REG_CAMCMR); |
866 | } | 867 | } |
867 | 868 | ||