diff options
Diffstat (limited to 'drivers/net/fs_enet')
-rw-r--r-- | drivers/net/fs_enet/Kconfig | 10 | ||||
-rw-r--r-- | drivers/net/fs_enet/fs_enet-main.c | 93 | ||||
-rw-r--r-- | drivers/net/fs_enet/fs_enet.h | 49 | ||||
-rw-r--r-- | drivers/net/fs_enet/mac-fcc.c | 11 | ||||
-rw-r--r-- | drivers/net/fs_enet/mac-fec.c | 64 | ||||
-rw-r--r-- | drivers/net/fs_enet/mac-scc.c | 14 | ||||
-rw-r--r-- | drivers/net/fs_enet/mii-fec.c | 4 |
7 files changed, 177 insertions, 68 deletions
diff --git a/drivers/net/fs_enet/Kconfig b/drivers/net/fs_enet/Kconfig index 562ea68ed99b..fc073b5a38c7 100644 --- a/drivers/net/fs_enet/Kconfig +++ b/drivers/net/fs_enet/Kconfig | |||
@@ -1,9 +1,13 @@ | |||
1 | config FS_ENET | 1 | config FS_ENET |
2 | tristate "Freescale Ethernet Driver" | 2 | tristate "Freescale Ethernet Driver" |
3 | depends on CPM1 || CPM2 | 3 | depends on CPM1 || CPM2 || PPC_MPC512x |
4 | select MII | 4 | select MII |
5 | select PHYLIB | 5 | select PHYLIB |
6 | 6 | ||
7 | config FS_ENET_MPC5121_FEC | ||
8 | def_bool y if (FS_ENET && PPC_MPC512x) | ||
9 | select FS_ENET_HAS_FEC | ||
10 | |||
7 | config FS_ENET_HAS_SCC | 11 | config FS_ENET_HAS_SCC |
8 | bool "Chip has an SCC usable for ethernet" | 12 | bool "Chip has an SCC usable for ethernet" |
9 | depends on FS_ENET && (CPM1 || CPM2) | 13 | depends on FS_ENET && (CPM1 || CPM2) |
@@ -16,13 +20,13 @@ config FS_ENET_HAS_FCC | |||
16 | 20 | ||
17 | config FS_ENET_HAS_FEC | 21 | config FS_ENET_HAS_FEC |
18 | bool "Chip has an FEC usable for ethernet" | 22 | bool "Chip has an FEC usable for ethernet" |
19 | depends on FS_ENET && CPM1 | 23 | depends on FS_ENET && (CPM1 || FS_ENET_MPC5121_FEC) |
20 | select FS_ENET_MDIO_FEC | 24 | select FS_ENET_MDIO_FEC |
21 | default y | 25 | default y |
22 | 26 | ||
23 | config FS_ENET_MDIO_FEC | 27 | config FS_ENET_MDIO_FEC |
24 | tristate "MDIO driver for FEC" | 28 | tristate "MDIO driver for FEC" |
25 | depends on FS_ENET && CPM1 | 29 | depends on FS_ENET && (CPM1 || FS_ENET_MPC5121_FEC) |
26 | 30 | ||
27 | config FS_ENET_MDIO_FCC | 31 | config FS_ENET_MDIO_FCC |
28 | tristate "MDIO driver for FCC" | 32 | tristate "MDIO driver for FCC" |
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c index ec2f5034457f..0770e2f6da6b 100644 --- a/drivers/net/fs_enet/fs_enet-main.c +++ b/drivers/net/fs_enet/fs_enet-main.c | |||
@@ -108,9 +108,7 @@ static int fs_enet_rx_napi(struct napi_struct *napi, int budget) | |||
108 | * the last indicator should be set. | 108 | * the last indicator should be set. |
109 | */ | 109 | */ |
110 | if ((sc & BD_ENET_RX_LAST) == 0) | 110 | if ((sc & BD_ENET_RX_LAST) == 0) |
111 | printk(KERN_WARNING DRV_MODULE_NAME | 111 | dev_warn(fep->dev, "rcv is not +last\n"); |
112 | ": %s rcv is not +last\n", | ||
113 | dev->name); | ||
114 | 112 | ||
115 | /* | 113 | /* |
116 | * Check for errors. | 114 | * Check for errors. |
@@ -178,9 +176,8 @@ static int fs_enet_rx_napi(struct napi_struct *napi, int budget) | |||
178 | received++; | 176 | received++; |
179 | netif_receive_skb(skb); | 177 | netif_receive_skb(skb); |
180 | } else { | 178 | } else { |
181 | printk(KERN_WARNING DRV_MODULE_NAME | 179 | dev_warn(fep->dev, |
182 | ": %s Memory squeeze, dropping packet.\n", | 180 | "Memory squeeze, dropping packet.\n"); |
183 | dev->name); | ||
184 | fep->stats.rx_dropped++; | 181 | fep->stats.rx_dropped++; |
185 | skbn = skb; | 182 | skbn = skb; |
186 | } | 183 | } |
@@ -242,9 +239,7 @@ static int fs_enet_rx_non_napi(struct net_device *dev) | |||
242 | * the last indicator should be set. | 239 | * the last indicator should be set. |
243 | */ | 240 | */ |
244 | if ((sc & BD_ENET_RX_LAST) == 0) | 241 | if ((sc & BD_ENET_RX_LAST) == 0) |
245 | printk(KERN_WARNING DRV_MODULE_NAME | 242 | dev_warn(fep->dev, "rcv is not +last\n"); |
246 | ": %s rcv is not +last\n", | ||
247 | dev->name); | ||
248 | 243 | ||
249 | /* | 244 | /* |
250 | * Check for errors. | 245 | * Check for errors. |
@@ -313,9 +308,8 @@ static int fs_enet_rx_non_napi(struct net_device *dev) | |||
313 | received++; | 308 | received++; |
314 | netif_rx(skb); | 309 | netif_rx(skb); |
315 | } else { | 310 | } else { |
316 | printk(KERN_WARNING DRV_MODULE_NAME | 311 | dev_warn(fep->dev, |
317 | ": %s Memory squeeze, dropping packet.\n", | 312 | "Memory squeeze, dropping packet.\n"); |
318 | dev->name); | ||
319 | fep->stats.rx_dropped++; | 313 | fep->stats.rx_dropped++; |
320 | skbn = skb; | 314 | skbn = skb; |
321 | } | 315 | } |
@@ -388,10 +382,10 @@ static void fs_enet_tx(struct net_device *dev) | |||
388 | } else | 382 | } else |
389 | fep->stats.tx_packets++; | 383 | fep->stats.tx_packets++; |
390 | 384 | ||
391 | if (sc & BD_ENET_TX_READY) | 385 | if (sc & BD_ENET_TX_READY) { |
392 | printk(KERN_WARNING DRV_MODULE_NAME | 386 | dev_warn(fep->dev, |
393 | ": %s HEY! Enet xmit interrupt and TX_READY.\n", | 387 | "HEY! Enet xmit interrupt and TX_READY.\n"); |
394 | dev->name); | 388 | } |
395 | 389 | ||
396 | /* | 390 | /* |
397 | * Deferred means some collisions occurred during transmit, | 391 | * Deferred means some collisions occurred during transmit, |
@@ -511,9 +505,8 @@ void fs_init_bds(struct net_device *dev) | |||
511 | for (i = 0, bdp = fep->rx_bd_base; i < fep->rx_ring; i++, bdp++) { | 505 | for (i = 0, bdp = fep->rx_bd_base; i < fep->rx_ring; i++, bdp++) { |
512 | skb = dev_alloc_skb(ENET_RX_FRSIZE); | 506 | skb = dev_alloc_skb(ENET_RX_FRSIZE); |
513 | if (skb == NULL) { | 507 | if (skb == NULL) { |
514 | printk(KERN_WARNING DRV_MODULE_NAME | 508 | dev_warn(fep->dev, |
515 | ": %s Memory squeeze, unable to allocate skb\n", | 509 | "Memory squeeze, unable to allocate skb\n"); |
516 | dev->name); | ||
517 | break; | 510 | break; |
518 | } | 511 | } |
519 | skb_align(skb, ENET_RX_ALIGN); | 512 | skb_align(skb, ENET_RX_ALIGN); |
@@ -587,6 +580,40 @@ void fs_cleanup_bds(struct net_device *dev) | |||
587 | 580 | ||
588 | /**********************************************************************************/ | 581 | /**********************************************************************************/ |
589 | 582 | ||
583 | #ifdef CONFIG_FS_ENET_MPC5121_FEC | ||
584 | /* | ||
585 | * MPC5121 FEC requeries 4-byte alignment for TX data buffer! | ||
586 | */ | ||
587 | static struct sk_buff *tx_skb_align_workaround(struct net_device *dev, | ||
588 | struct sk_buff *skb) | ||
589 | { | ||
590 | struct sk_buff *new_skb; | ||
591 | struct fs_enet_private *fep = netdev_priv(dev); | ||
592 | |||
593 | /* Alloc new skb */ | ||
594 | new_skb = dev_alloc_skb(skb->len + 4); | ||
595 | if (!new_skb) { | ||
596 | if (net_ratelimit()) { | ||
597 | dev_warn(fep->dev, | ||
598 | "Memory squeeze, dropping tx packet.\n"); | ||
599 | } | ||
600 | return NULL; | ||
601 | } | ||
602 | |||
603 | /* Make sure new skb is properly aligned */ | ||
604 | skb_align(new_skb, 4); | ||
605 | |||
606 | /* Copy data to new skb ... */ | ||
607 | skb_copy_from_linear_data(skb, new_skb->data, skb->len); | ||
608 | skb_put(new_skb, skb->len); | ||
609 | |||
610 | /* ... and free an old one */ | ||
611 | dev_kfree_skb_any(skb); | ||
612 | |||
613 | return new_skb; | ||
614 | } | ||
615 | #endif | ||
616 | |||
590 | static int fs_enet_start_xmit(struct sk_buff *skb, struct net_device *dev) | 617 | static int fs_enet_start_xmit(struct sk_buff *skb, struct net_device *dev) |
591 | { | 618 | { |
592 | struct fs_enet_private *fep = netdev_priv(dev); | 619 | struct fs_enet_private *fep = netdev_priv(dev); |
@@ -595,6 +622,19 @@ static int fs_enet_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
595 | u16 sc; | 622 | u16 sc; |
596 | unsigned long flags; | 623 | unsigned long flags; |
597 | 624 | ||
625 | #ifdef CONFIG_FS_ENET_MPC5121_FEC | ||
626 | if (((unsigned long)skb->data) & 0x3) { | ||
627 | skb = tx_skb_align_workaround(dev, skb); | ||
628 | if (!skb) { | ||
629 | /* | ||
630 | * We have lost packet due to memory allocation error | ||
631 | * in tx_skb_align_workaround(). Hopefully original | ||
632 | * skb is still valid, so try transmit it later. | ||
633 | */ | ||
634 | return NETDEV_TX_BUSY; | ||
635 | } | ||
636 | } | ||
637 | #endif | ||
598 | spin_lock_irqsave(&fep->tx_lock, flags); | 638 | spin_lock_irqsave(&fep->tx_lock, flags); |
599 | 639 | ||
600 | /* | 640 | /* |
@@ -610,8 +650,7 @@ static int fs_enet_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
610 | * Ooops. All transmit buffers are full. Bail out. | 650 | * Ooops. All transmit buffers are full. Bail out. |
611 | * This should not happen, since the tx queue should be stopped. | 651 | * This should not happen, since the tx queue should be stopped. |
612 | */ | 652 | */ |
613 | printk(KERN_WARNING DRV_MODULE_NAME | 653 | dev_warn(fep->dev, "tx queue full!.\n"); |
614 | ": %s tx queue full!.\n", dev->name); | ||
615 | return NETDEV_TX_BUSY; | 654 | return NETDEV_TX_BUSY; |
616 | } | 655 | } |
617 | 656 | ||
@@ -788,8 +827,7 @@ static int fs_enet_open(struct net_device *dev) | |||
788 | r = request_irq(fep->interrupt, fs_enet_interrupt, IRQF_SHARED, | 827 | r = request_irq(fep->interrupt, fs_enet_interrupt, IRQF_SHARED, |
789 | "fs_enet-mac", dev); | 828 | "fs_enet-mac", dev); |
790 | if (r != 0) { | 829 | if (r != 0) { |
791 | printk(KERN_ERR DRV_MODULE_NAME | 830 | dev_err(fep->dev, "Could not allocate FS_ENET IRQ!"); |
792 | ": %s Could not allocate FS_ENET IRQ!", dev->name); | ||
793 | if (fep->fpi->use_napi) | 831 | if (fep->fpi->use_napi) |
794 | napi_disable(&fep->napi); | 832 | napi_disable(&fep->napi); |
795 | return -EINVAL; | 833 | return -EINVAL; |
@@ -1053,7 +1091,7 @@ static int __devinit fs_enet_probe(struct of_device *ofdev, | |||
1053 | if (ret) | 1091 | if (ret) |
1054 | goto out_free_bd; | 1092 | goto out_free_bd; |
1055 | 1093 | ||
1056 | printk(KERN_INFO "%s: fs_enet: %pM\n", ndev->name, ndev->dev_addr); | 1094 | pr_info("%s: fs_enet: %pM\n", ndev->name, ndev->dev_addr); |
1057 | 1095 | ||
1058 | return 0; | 1096 | return 0; |
1059 | 1097 | ||
@@ -1103,11 +1141,18 @@ static struct of_device_id fs_enet_match[] = { | |||
1103 | }, | 1141 | }, |
1104 | #endif | 1142 | #endif |
1105 | #ifdef CONFIG_FS_ENET_HAS_FEC | 1143 | #ifdef CONFIG_FS_ENET_HAS_FEC |
1144 | #ifdef CONFIG_FS_ENET_MPC5121_FEC | ||
1145 | { | ||
1146 | .compatible = "fsl,mpc5121-fec", | ||
1147 | .data = (void *)&fs_fec_ops, | ||
1148 | }, | ||
1149 | #else | ||
1106 | { | 1150 | { |
1107 | .compatible = "fsl,pq1-fec-enet", | 1151 | .compatible = "fsl,pq1-fec-enet", |
1108 | .data = (void *)&fs_fec_ops, | 1152 | .data = (void *)&fs_fec_ops, |
1109 | }, | 1153 | }, |
1110 | #endif | 1154 | #endif |
1155 | #endif | ||
1111 | {} | 1156 | {} |
1112 | }; | 1157 | }; |
1113 | MODULE_DEVICE_TABLE(of, fs_enet_match); | 1158 | MODULE_DEVICE_TABLE(of, fs_enet_match); |
diff --git a/drivers/net/fs_enet/fs_enet.h b/drivers/net/fs_enet/fs_enet.h index ef01e09781a5..1ece4b1a689e 100644 --- a/drivers/net/fs_enet/fs_enet.h +++ b/drivers/net/fs_enet/fs_enet.h | |||
@@ -13,9 +13,56 @@ | |||
13 | 13 | ||
14 | #ifdef CONFIG_CPM1 | 14 | #ifdef CONFIG_CPM1 |
15 | #include <asm/cpm1.h> | 15 | #include <asm/cpm1.h> |
16 | #endif | ||
17 | |||
18 | #if defined(CONFIG_FS_ENET_HAS_FEC) | ||
19 | #include <asm/cpm.h> | ||
20 | |||
21 | #if defined(CONFIG_FS_ENET_MPC5121_FEC) | ||
22 | /* MPC5121 FEC has different register layout */ | ||
23 | struct fec { | ||
24 | u32 fec_reserved0; | ||
25 | u32 fec_ievent; /* Interrupt event reg */ | ||
26 | u32 fec_imask; /* Interrupt mask reg */ | ||
27 | u32 fec_reserved1; | ||
28 | u32 fec_r_des_active; /* Receive descriptor reg */ | ||
29 | u32 fec_x_des_active; /* Transmit descriptor reg */ | ||
30 | u32 fec_reserved2[3]; | ||
31 | u32 fec_ecntrl; /* Ethernet control reg */ | ||
32 | u32 fec_reserved3[6]; | ||
33 | u32 fec_mii_data; /* MII manage frame reg */ | ||
34 | u32 fec_mii_speed; /* MII speed control reg */ | ||
35 | u32 fec_reserved4[7]; | ||
36 | u32 fec_mib_ctrlstat; /* MIB control/status reg */ | ||
37 | u32 fec_reserved5[7]; | ||
38 | u32 fec_r_cntrl; /* Receive control reg */ | ||
39 | u32 fec_reserved6[15]; | ||
40 | u32 fec_x_cntrl; /* Transmit Control reg */ | ||
41 | u32 fec_reserved7[7]; | ||
42 | u32 fec_addr_low; /* Low 32bits MAC address */ | ||
43 | u32 fec_addr_high; /* High 16bits MAC address */ | ||
44 | u32 fec_opd; /* Opcode + Pause duration */ | ||
45 | u32 fec_reserved8[10]; | ||
46 | u32 fec_hash_table_high; /* High 32bits hash table */ | ||
47 | u32 fec_hash_table_low; /* Low 32bits hash table */ | ||
48 | u32 fec_grp_hash_table_high; /* High 32bits hash table */ | ||
49 | u32 fec_grp_hash_table_low; /* Low 32bits hash table */ | ||
50 | u32 fec_reserved9[7]; | ||
51 | u32 fec_x_wmrk; /* FIFO transmit water mark */ | ||
52 | u32 fec_reserved10; | ||
53 | u32 fec_r_bound; /* FIFO receive bound reg */ | ||
54 | u32 fec_r_fstart; /* FIFO receive start reg */ | ||
55 | u32 fec_reserved11[11]; | ||
56 | u32 fec_r_des_start; /* Receive descriptor ring */ | ||
57 | u32 fec_x_des_start; /* Transmit descriptor ring */ | ||
58 | u32 fec_r_buff_size; /* Maximum receive buff size */ | ||
59 | u32 fec_reserved12[26]; | ||
60 | u32 fec_dma_control; /* DMA Endian and other ctrl */ | ||
61 | }; | ||
62 | #endif | ||
16 | 63 | ||
17 | struct fec_info { | 64 | struct fec_info { |
18 | fec_t __iomem *fecp; | 65 | struct fec __iomem *fecp; |
19 | u32 mii_speed; | 66 | u32 mii_speed; |
20 | }; | 67 | }; |
21 | #endif | 68 | #endif |
diff --git a/drivers/net/fs_enet/mac-fcc.c b/drivers/net/fs_enet/mac-fcc.c index 22e5a847a588..0a973e71876b 100644 --- a/drivers/net/fs_enet/mac-fcc.c +++ b/drivers/net/fs_enet/mac-fcc.c | |||
@@ -19,7 +19,6 @@ | |||
19 | #include <linux/ptrace.h> | 19 | #include <linux/ptrace.h> |
20 | #include <linux/errno.h> | 20 | #include <linux/errno.h> |
21 | #include <linux/ioport.h> | 21 | #include <linux/ioport.h> |
22 | #include <linux/slab.h> | ||
23 | #include <linux/interrupt.h> | 22 | #include <linux/interrupt.h> |
24 | #include <linux/init.h> | 23 | #include <linux/init.h> |
25 | #include <linux/delay.h> | 24 | #include <linux/delay.h> |
@@ -34,6 +33,7 @@ | |||
34 | #include <linux/platform_device.h> | 33 | #include <linux/platform_device.h> |
35 | #include <linux/phy.h> | 34 | #include <linux/phy.h> |
36 | #include <linux/of_device.h> | 35 | #include <linux/of_device.h> |
36 | #include <linux/gfp.h> | ||
37 | 37 | ||
38 | #include <asm/immap_cpm2.h> | 38 | #include <asm/immap_cpm2.h> |
39 | #include <asm/mpc8260.h> | 39 | #include <asm/mpc8260.h> |
@@ -218,7 +218,7 @@ static void set_multicast_finish(struct net_device *dev) | |||
218 | 218 | ||
219 | /* if all multi or too many multicasts; just enable all */ | 219 | /* if all multi or too many multicasts; just enable all */ |
220 | if ((dev->flags & IFF_ALLMULTI) != 0 || | 220 | if ((dev->flags & IFF_ALLMULTI) != 0 || |
221 | dev->mc_count > FCC_MAX_MULTICAST_ADDRS) { | 221 | netdev_mc_count(dev) > FCC_MAX_MULTICAST_ADDRS) { |
222 | 222 | ||
223 | W32(ep, fen_gaddrh, 0xffffffff); | 223 | W32(ep, fen_gaddrh, 0xffffffff); |
224 | W32(ep, fen_gaddrl, 0xffffffff); | 224 | W32(ep, fen_gaddrl, 0xffffffff); |
@@ -235,7 +235,7 @@ static void set_multicast_list(struct net_device *dev) | |||
235 | 235 | ||
236 | if ((dev->flags & IFF_PROMISC) == 0) { | 236 | if ((dev->flags & IFF_PROMISC) == 0) { |
237 | set_multicast_start(dev); | 237 | set_multicast_start(dev); |
238 | for (pmc = dev->mc_list; pmc != NULL; pmc = pmc->next) | 238 | netdev_for_each_mc_addr(pmc, dev) |
239 | set_multicast_one(dev, pmc->dmi_addr); | 239 | set_multicast_one(dev, pmc->dmi_addr); |
240 | set_multicast_finish(dev); | 240 | set_multicast_finish(dev); |
241 | } else | 241 | } else |
@@ -476,8 +476,9 @@ static void clear_int_events(struct net_device *dev, u32 int_events) | |||
476 | 476 | ||
477 | static void ev_error(struct net_device *dev, u32 int_events) | 477 | static void ev_error(struct net_device *dev, u32 int_events) |
478 | { | 478 | { |
479 | printk(KERN_WARNING DRV_MODULE_NAME | 479 | struct fs_enet_private *fep = netdev_priv(dev); |
480 | ": %s FS_ENET ERROR(s) 0x%x\n", dev->name, int_events); | 480 | |
481 | dev_warn(fep->dev, "FS_ENET ERROR(s) 0x%x\n", int_events); | ||
481 | } | 482 | } |
482 | 483 | ||
483 | static int get_regs(struct net_device *dev, void *p, int *sizep) | 484 | static int get_regs(struct net_device *dev, void *p, int *sizep) |
diff --git a/drivers/net/fs_enet/mac-fec.c b/drivers/net/fs_enet/mac-fec.c index ca7bcb8ab3a1..ec81f50d5919 100644 --- a/drivers/net/fs_enet/mac-fec.c +++ b/drivers/net/fs_enet/mac-fec.c | |||
@@ -19,7 +19,6 @@ | |||
19 | #include <linux/ptrace.h> | 19 | #include <linux/ptrace.h> |
20 | #include <linux/errno.h> | 20 | #include <linux/errno.h> |
21 | #include <linux/ioport.h> | 21 | #include <linux/ioport.h> |
22 | #include <linux/slab.h> | ||
23 | #include <linux/interrupt.h> | 22 | #include <linux/interrupt.h> |
24 | #include <linux/init.h> | 23 | #include <linux/init.h> |
25 | #include <linux/delay.h> | 24 | #include <linux/delay.h> |
@@ -33,6 +32,7 @@ | |||
33 | #include <linux/fs.h> | 32 | #include <linux/fs.h> |
34 | #include <linux/platform_device.h> | 33 | #include <linux/platform_device.h> |
35 | #include <linux/of_device.h> | 34 | #include <linux/of_device.h> |
35 | #include <linux/gfp.h> | ||
36 | 36 | ||
37 | #include <asm/irq.h> | 37 | #include <asm/irq.h> |
38 | #include <asm/uaccess.h> | 38 | #include <asm/uaccess.h> |
@@ -80,7 +80,7 @@ | |||
80 | */ | 80 | */ |
81 | #define FEC_RESET_DELAY 50 | 81 | #define FEC_RESET_DELAY 50 |
82 | 82 | ||
83 | static int whack_reset(fec_t __iomem *fecp) | 83 | static int whack_reset(struct fec __iomem *fecp) |
84 | { | 84 | { |
85 | int i; | 85 | int i; |
86 | 86 | ||
@@ -168,7 +168,7 @@ static void cleanup_data(struct net_device *dev) | |||
168 | static void set_promiscuous_mode(struct net_device *dev) | 168 | static void set_promiscuous_mode(struct net_device *dev) |
169 | { | 169 | { |
170 | struct fs_enet_private *fep = netdev_priv(dev); | 170 | struct fs_enet_private *fep = netdev_priv(dev); |
171 | fec_t __iomem *fecp = fep->fec.fecp; | 171 | struct fec __iomem *fecp = fep->fec.fecp; |
172 | 172 | ||
173 | FS(fecp, r_cntrl, FEC_RCNTRL_PROM); | 173 | FS(fecp, r_cntrl, FEC_RCNTRL_PROM); |
174 | } | 174 | } |
@@ -216,11 +216,11 @@ static void set_multicast_one(struct net_device *dev, const u8 *mac) | |||
216 | static void set_multicast_finish(struct net_device *dev) | 216 | static void set_multicast_finish(struct net_device *dev) |
217 | { | 217 | { |
218 | struct fs_enet_private *fep = netdev_priv(dev); | 218 | struct fs_enet_private *fep = netdev_priv(dev); |
219 | fec_t __iomem *fecp = fep->fec.fecp; | 219 | struct fec __iomem *fecp = fep->fec.fecp; |
220 | 220 | ||
221 | /* if all multi or too many multicasts; just enable all */ | 221 | /* if all multi or too many multicasts; just enable all */ |
222 | if ((dev->flags & IFF_ALLMULTI) != 0 || | 222 | if ((dev->flags & IFF_ALLMULTI) != 0 || |
223 | dev->mc_count > FEC_MAX_MULTICAST_ADDRS) { | 223 | netdev_mc_count(dev) > FEC_MAX_MULTICAST_ADDRS) { |
224 | fep->fec.hthi = 0xffffffffU; | 224 | fep->fec.hthi = 0xffffffffU; |
225 | fep->fec.htlo = 0xffffffffU; | 225 | fep->fec.htlo = 0xffffffffU; |
226 | } | 226 | } |
@@ -236,7 +236,7 @@ static void set_multicast_list(struct net_device *dev) | |||
236 | 236 | ||
237 | if ((dev->flags & IFF_PROMISC) == 0) { | 237 | if ((dev->flags & IFF_PROMISC) == 0) { |
238 | set_multicast_start(dev); | 238 | set_multicast_start(dev); |
239 | for (pmc = dev->mc_list; pmc != NULL; pmc = pmc->next) | 239 | netdev_for_each_mc_addr(pmc, dev) |
240 | set_multicast_one(dev, pmc->dmi_addr); | 240 | set_multicast_one(dev, pmc->dmi_addr); |
241 | set_multicast_finish(dev); | 241 | set_multicast_finish(dev); |
242 | } else | 242 | } else |
@@ -246,7 +246,7 @@ static void set_multicast_list(struct net_device *dev) | |||
246 | static void restart(struct net_device *dev) | 246 | static void restart(struct net_device *dev) |
247 | { | 247 | { |
248 | struct fs_enet_private *fep = netdev_priv(dev); | 248 | struct fs_enet_private *fep = netdev_priv(dev); |
249 | fec_t __iomem *fecp = fep->fec.fecp; | 249 | struct fec __iomem *fecp = fep->fec.fecp; |
250 | const struct fs_platform_info *fpi = fep->fpi; | 250 | const struct fs_platform_info *fpi = fep->fpi; |
251 | dma_addr_t rx_bd_base_phys, tx_bd_base_phys; | 251 | dma_addr_t rx_bd_base_phys, tx_bd_base_phys; |
252 | int r; | 252 | int r; |
@@ -257,8 +257,7 @@ static void restart(struct net_device *dev) | |||
257 | 257 | ||
258 | r = whack_reset(fep->fec.fecp); | 258 | r = whack_reset(fep->fec.fecp); |
259 | if (r != 0) | 259 | if (r != 0) |
260 | printk(KERN_ERR DRV_MODULE_NAME | 260 | dev_err(fep->dev, "FEC Reset FAILED!\n"); |
261 | ": %s FEC Reset FAILED!\n", dev->name); | ||
262 | /* | 261 | /* |
263 | * Set station address. | 262 | * Set station address. |
264 | */ | 263 | */ |
@@ -281,7 +280,11 @@ static void restart(struct net_device *dev) | |||
281 | * Set maximum receive buffer size. | 280 | * Set maximum receive buffer size. |
282 | */ | 281 | */ |
283 | FW(fecp, r_buff_size, PKT_MAXBLR_SIZE); | 282 | FW(fecp, r_buff_size, PKT_MAXBLR_SIZE); |
283 | #ifdef CONFIG_FS_ENET_MPC5121_FEC | ||
284 | FW(fecp, r_cntrl, PKT_MAXBUF_SIZE << 16); | ||
285 | #else | ||
284 | FW(fecp, r_hash, PKT_MAXBUF_SIZE); | 286 | FW(fecp, r_hash, PKT_MAXBUF_SIZE); |
287 | #endif | ||
285 | 288 | ||
286 | /* get physical address */ | 289 | /* get physical address */ |
287 | rx_bd_base_phys = fep->ring_mem_addr; | 290 | rx_bd_base_phys = fep->ring_mem_addr; |
@@ -298,7 +301,11 @@ static void restart(struct net_device *dev) | |||
298 | /* | 301 | /* |
299 | * Enable big endian and don't care about SDMA FC. | 302 | * Enable big endian and don't care about SDMA FC. |
300 | */ | 303 | */ |
304 | #ifdef CONFIG_FS_ENET_MPC5121_FEC | ||
305 | FS(fecp, dma_control, 0xC0000000); | ||
306 | #else | ||
301 | FW(fecp, fun_code, 0x78000000); | 307 | FW(fecp, fun_code, 0x78000000); |
308 | #endif | ||
302 | 309 | ||
303 | /* | 310 | /* |
304 | * Set MII speed. | 311 | * Set MII speed. |
@@ -309,9 +316,17 @@ static void restart(struct net_device *dev) | |||
309 | * Clear any outstanding interrupt. | 316 | * Clear any outstanding interrupt. |
310 | */ | 317 | */ |
311 | FW(fecp, ievent, 0xffc0); | 318 | FW(fecp, ievent, 0xffc0); |
319 | #ifndef CONFIG_FS_ENET_MPC5121_FEC | ||
312 | FW(fecp, ivec, (virq_to_hw(fep->interrupt) / 2) << 29); | 320 | FW(fecp, ivec, (virq_to_hw(fep->interrupt) / 2) << 29); |
313 | 321 | ||
314 | FW(fecp, r_cntrl, FEC_RCNTRL_MII_MODE); /* MII enable */ | 322 | FW(fecp, r_cntrl, FEC_RCNTRL_MII_MODE); /* MII enable */ |
323 | #else | ||
324 | /* | ||
325 | * Only set MII mode - do not touch maximum frame length | ||
326 | * configured before. | ||
327 | */ | ||
328 | FS(fecp, r_cntrl, FEC_RCNTRL_MII_MODE); | ||
329 | #endif | ||
315 | /* | 330 | /* |
316 | * adjust to duplex mode | 331 | * adjust to duplex mode |
317 | */ | 332 | */ |
@@ -340,7 +355,7 @@ static void stop(struct net_device *dev) | |||
340 | { | 355 | { |
341 | struct fs_enet_private *fep = netdev_priv(dev); | 356 | struct fs_enet_private *fep = netdev_priv(dev); |
342 | const struct fs_platform_info *fpi = fep->fpi; | 357 | const struct fs_platform_info *fpi = fep->fpi; |
343 | fec_t __iomem *fecp = fep->fec.fecp; | 358 | struct fec __iomem *fecp = fep->fec.fecp; |
344 | 359 | ||
345 | struct fec_info* feci= fep->phydev->bus->priv; | 360 | struct fec_info* feci= fep->phydev->bus->priv; |
346 | 361 | ||
@@ -355,9 +370,7 @@ static void stop(struct net_device *dev) | |||
355 | udelay(1); | 370 | udelay(1); |
356 | 371 | ||
357 | if (i == FEC_RESET_DELAY) | 372 | if (i == FEC_RESET_DELAY) |
358 | printk(KERN_WARNING DRV_MODULE_NAME | 373 | dev_warn(fep->dev, "FEC timeout on graceful transmit stop\n"); |
359 | ": %s FEC timeout on graceful transmit stop\n", | ||
360 | dev->name); | ||
361 | /* | 374 | /* |
362 | * Disable FEC. Let only MII interrupts. | 375 | * Disable FEC. Let only MII interrupts. |
363 | */ | 376 | */ |
@@ -378,7 +391,7 @@ static void stop(struct net_device *dev) | |||
378 | static void napi_clear_rx_event(struct net_device *dev) | 391 | static void napi_clear_rx_event(struct net_device *dev) |
379 | { | 392 | { |
380 | struct fs_enet_private *fep = netdev_priv(dev); | 393 | struct fs_enet_private *fep = netdev_priv(dev); |
381 | fec_t __iomem *fecp = fep->fec.fecp; | 394 | struct fec __iomem *fecp = fep->fec.fecp; |
382 | 395 | ||
383 | FW(fecp, ievent, FEC_NAPI_RX_EVENT_MSK); | 396 | FW(fecp, ievent, FEC_NAPI_RX_EVENT_MSK); |
384 | } | 397 | } |
@@ -386,7 +399,7 @@ static void napi_clear_rx_event(struct net_device *dev) | |||
386 | static void napi_enable_rx(struct net_device *dev) | 399 | static void napi_enable_rx(struct net_device *dev) |
387 | { | 400 | { |
388 | struct fs_enet_private *fep = netdev_priv(dev); | 401 | struct fs_enet_private *fep = netdev_priv(dev); |
389 | fec_t __iomem *fecp = fep->fec.fecp; | 402 | struct fec __iomem *fecp = fep->fec.fecp; |
390 | 403 | ||
391 | FS(fecp, imask, FEC_NAPI_RX_EVENT_MSK); | 404 | FS(fecp, imask, FEC_NAPI_RX_EVENT_MSK); |
392 | } | 405 | } |
@@ -394,7 +407,7 @@ static void napi_enable_rx(struct net_device *dev) | |||
394 | static void napi_disable_rx(struct net_device *dev) | 407 | static void napi_disable_rx(struct net_device *dev) |
395 | { | 408 | { |
396 | struct fs_enet_private *fep = netdev_priv(dev); | 409 | struct fs_enet_private *fep = netdev_priv(dev); |
397 | fec_t __iomem *fecp = fep->fec.fecp; | 410 | struct fec __iomem *fecp = fep->fec.fecp; |
398 | 411 | ||
399 | FC(fecp, imask, FEC_NAPI_RX_EVENT_MSK); | 412 | FC(fecp, imask, FEC_NAPI_RX_EVENT_MSK); |
400 | } | 413 | } |
@@ -402,7 +415,7 @@ static void napi_disable_rx(struct net_device *dev) | |||
402 | static void rx_bd_done(struct net_device *dev) | 415 | static void rx_bd_done(struct net_device *dev) |
403 | { | 416 | { |
404 | struct fs_enet_private *fep = netdev_priv(dev); | 417 | struct fs_enet_private *fep = netdev_priv(dev); |
405 | fec_t __iomem *fecp = fep->fec.fecp; | 418 | struct fec __iomem *fecp = fep->fec.fecp; |
406 | 419 | ||
407 | FW(fecp, r_des_active, 0x01000000); | 420 | FW(fecp, r_des_active, 0x01000000); |
408 | } | 421 | } |
@@ -410,7 +423,7 @@ static void rx_bd_done(struct net_device *dev) | |||
410 | static void tx_kickstart(struct net_device *dev) | 423 | static void tx_kickstart(struct net_device *dev) |
411 | { | 424 | { |
412 | struct fs_enet_private *fep = netdev_priv(dev); | 425 | struct fs_enet_private *fep = netdev_priv(dev); |
413 | fec_t __iomem *fecp = fep->fec.fecp; | 426 | struct fec __iomem *fecp = fep->fec.fecp; |
414 | 427 | ||
415 | FW(fecp, x_des_active, 0x01000000); | 428 | FW(fecp, x_des_active, 0x01000000); |
416 | } | 429 | } |
@@ -418,7 +431,7 @@ static void tx_kickstart(struct net_device *dev) | |||
418 | static u32 get_int_events(struct net_device *dev) | 431 | static u32 get_int_events(struct net_device *dev) |
419 | { | 432 | { |
420 | struct fs_enet_private *fep = netdev_priv(dev); | 433 | struct fs_enet_private *fep = netdev_priv(dev); |
421 | fec_t __iomem *fecp = fep->fec.fecp; | 434 | struct fec __iomem *fecp = fep->fec.fecp; |
422 | 435 | ||
423 | return FR(fecp, ievent) & FR(fecp, imask); | 436 | return FR(fecp, ievent) & FR(fecp, imask); |
424 | } | 437 | } |
@@ -426,32 +439,33 @@ static u32 get_int_events(struct net_device *dev) | |||
426 | static void clear_int_events(struct net_device *dev, u32 int_events) | 439 | static void clear_int_events(struct net_device *dev, u32 int_events) |
427 | { | 440 | { |
428 | struct fs_enet_private *fep = netdev_priv(dev); | 441 | struct fs_enet_private *fep = netdev_priv(dev); |
429 | fec_t __iomem *fecp = fep->fec.fecp; | 442 | struct fec __iomem *fecp = fep->fec.fecp; |
430 | 443 | ||
431 | FW(fecp, ievent, int_events); | 444 | FW(fecp, ievent, int_events); |
432 | } | 445 | } |
433 | 446 | ||
434 | static void ev_error(struct net_device *dev, u32 int_events) | 447 | static void ev_error(struct net_device *dev, u32 int_events) |
435 | { | 448 | { |
436 | printk(KERN_WARNING DRV_MODULE_NAME | 449 | struct fs_enet_private *fep = netdev_priv(dev); |
437 | ": %s FEC ERROR(s) 0x%x\n", dev->name, int_events); | 450 | |
451 | dev_warn(fep->dev, "FEC ERROR(s) 0x%x\n", int_events); | ||
438 | } | 452 | } |
439 | 453 | ||
440 | static int get_regs(struct net_device *dev, void *p, int *sizep) | 454 | static int get_regs(struct net_device *dev, void *p, int *sizep) |
441 | { | 455 | { |
442 | struct fs_enet_private *fep = netdev_priv(dev); | 456 | struct fs_enet_private *fep = netdev_priv(dev); |
443 | 457 | ||
444 | if (*sizep < sizeof(fec_t)) | 458 | if (*sizep < sizeof(struct fec)) |
445 | return -EINVAL; | 459 | return -EINVAL; |
446 | 460 | ||
447 | memcpy_fromio(p, fep->fec.fecp, sizeof(fec_t)); | 461 | memcpy_fromio(p, fep->fec.fecp, sizeof(struct fec)); |
448 | 462 | ||
449 | return 0; | 463 | return 0; |
450 | } | 464 | } |
451 | 465 | ||
452 | static int get_regs_len(struct net_device *dev) | 466 | static int get_regs_len(struct net_device *dev) |
453 | { | 467 | { |
454 | return sizeof(fec_t); | 468 | return sizeof(struct fec); |
455 | } | 469 | } |
456 | 470 | ||
457 | static void tx_restart(struct net_device *dev) | 471 | static void tx_restart(struct net_device *dev) |
diff --git a/drivers/net/fs_enet/mac-scc.c b/drivers/net/fs_enet/mac-scc.c index 008cdd9cc536..34d3da751eb4 100644 --- a/drivers/net/fs_enet/mac-scc.c +++ b/drivers/net/fs_enet/mac-scc.c | |||
@@ -19,7 +19,6 @@ | |||
19 | #include <linux/ptrace.h> | 19 | #include <linux/ptrace.h> |
20 | #include <linux/errno.h> | 20 | #include <linux/errno.h> |
21 | #include <linux/ioport.h> | 21 | #include <linux/ioport.h> |
22 | #include <linux/slab.h> | ||
23 | #include <linux/interrupt.h> | 22 | #include <linux/interrupt.h> |
24 | #include <linux/init.h> | 23 | #include <linux/init.h> |
25 | #include <linux/delay.h> | 24 | #include <linux/delay.h> |
@@ -213,7 +212,7 @@ static void set_multicast_finish(struct net_device *dev) | |||
213 | 212 | ||
214 | /* if all multi or too many multicasts; just enable all */ | 213 | /* if all multi or too many multicasts; just enable all */ |
215 | if ((dev->flags & IFF_ALLMULTI) != 0 || | 214 | if ((dev->flags & IFF_ALLMULTI) != 0 || |
216 | dev->mc_count > SCC_MAX_MULTICAST_ADDRS) { | 215 | netdev_mc_count(dev) > SCC_MAX_MULTICAST_ADDRS) { |
217 | 216 | ||
218 | W16(ep, sen_gaddr1, 0xffff); | 217 | W16(ep, sen_gaddr1, 0xffff); |
219 | W16(ep, sen_gaddr2, 0xffff); | 218 | W16(ep, sen_gaddr2, 0xffff); |
@@ -228,7 +227,7 @@ static void set_multicast_list(struct net_device *dev) | |||
228 | 227 | ||
229 | if ((dev->flags & IFF_PROMISC) == 0) { | 228 | if ((dev->flags & IFF_PROMISC) == 0) { |
230 | set_multicast_start(dev); | 229 | set_multicast_start(dev); |
231 | for (pmc = dev->mc_list; pmc != NULL; pmc = pmc->next) | 230 | netdev_for_each_mc_addr(pmc, dev) |
232 | set_multicast_one(dev, pmc->dmi_addr); | 231 | set_multicast_one(dev, pmc->dmi_addr); |
233 | set_multicast_finish(dev); | 232 | set_multicast_finish(dev); |
234 | } else | 233 | } else |
@@ -367,9 +366,7 @@ static void stop(struct net_device *dev) | |||
367 | udelay(1); | 366 | udelay(1); |
368 | 367 | ||
369 | if (i == SCC_RESET_DELAY) | 368 | if (i == SCC_RESET_DELAY) |
370 | printk(KERN_WARNING DRV_MODULE_NAME | 369 | dev_warn(fep->dev, "SCC timeout on graceful transmit stop\n"); |
371 | ": %s SCC timeout on graceful transmit stop\n", | ||
372 | dev->name); | ||
373 | 370 | ||
374 | W16(sccp, scc_sccm, 0); | 371 | W16(sccp, scc_sccm, 0); |
375 | C32(sccp, scc_gsmrl, SCC_GSMRL_ENR | SCC_GSMRL_ENT); | 372 | C32(sccp, scc_gsmrl, SCC_GSMRL_ENR | SCC_GSMRL_ENT); |
@@ -429,8 +426,9 @@ static void clear_int_events(struct net_device *dev, u32 int_events) | |||
429 | 426 | ||
430 | static void ev_error(struct net_device *dev, u32 int_events) | 427 | static void ev_error(struct net_device *dev, u32 int_events) |
431 | { | 428 | { |
432 | printk(KERN_WARNING DRV_MODULE_NAME | 429 | struct fs_enet_private *fep = netdev_priv(dev); |
433 | ": %s SCC ERROR(s) 0x%x\n", dev->name, int_events); | 430 | |
431 | dev_warn(fep->dev, "SCC ERROR(s) 0x%x\n", int_events); | ||
434 | } | 432 | } |
435 | 433 | ||
436 | static int get_regs(struct net_device *dev, void *p, int *sizep) | 434 | static int get_regs(struct net_device *dev, void *p, int *sizep) |
diff --git a/drivers/net/fs_enet/mii-fec.c b/drivers/net/fs_enet/mii-fec.c index 96eba4280c5c..5944b65082cb 100644 --- a/drivers/net/fs_enet/mii-fec.c +++ b/drivers/net/fs_enet/mii-fec.c | |||
@@ -52,7 +52,7 @@ | |||
52 | static int fs_enet_fec_mii_read(struct mii_bus *bus , int phy_id, int location) | 52 | static int fs_enet_fec_mii_read(struct mii_bus *bus , int phy_id, int location) |
53 | { | 53 | { |
54 | struct fec_info* fec = bus->priv; | 54 | struct fec_info* fec = bus->priv; |
55 | fec_t __iomem *fecp = fec->fecp; | 55 | struct fec __iomem *fecp = fec->fecp; |
56 | int i, ret = -1; | 56 | int i, ret = -1; |
57 | 57 | ||
58 | BUG_ON((in_be32(&fecp->fec_r_cntrl) & FEC_RCNTRL_MII_MODE) == 0); | 58 | BUG_ON((in_be32(&fecp->fec_r_cntrl) & FEC_RCNTRL_MII_MODE) == 0); |
@@ -75,7 +75,7 @@ static int fs_enet_fec_mii_read(struct mii_bus *bus , int phy_id, int location) | |||
75 | static int fs_enet_fec_mii_write(struct mii_bus *bus, int phy_id, int location, u16 val) | 75 | static int fs_enet_fec_mii_write(struct mii_bus *bus, int phy_id, int location, u16 val) |
76 | { | 76 | { |
77 | struct fec_info* fec = bus->priv; | 77 | struct fec_info* fec = bus->priv; |
78 | fec_t __iomem *fecp = fec->fecp; | 78 | struct fec __iomem *fecp = fec->fecp; |
79 | int i; | 79 | int i; |
80 | 80 | ||
81 | /* this must never happen */ | 81 | /* this must never happen */ |