aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/freescale
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ethernet/freescale')
-rw-r--r--drivers/net/ethernet/freescale/Kconfig6
-rw-r--r--drivers/net/ethernet/freescale/fec.c68
-rw-r--r--drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c15
-rw-r--r--drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c13
-rw-r--r--drivers/net/ethernet/freescale/fs_enet/mii-fec.c13
-rw-r--r--drivers/net/ethernet/freescale/fsl_pq_mdio.c16
-rw-r--r--drivers/net/ethernet/freescale/gianfar.c28
-rw-r--r--drivers/net/ethernet/freescale/gianfar.h7
-rw-r--r--drivers/net/ethernet/freescale/gianfar_ethtool.c12
-rw-r--r--drivers/net/ethernet/freescale/gianfar_ptp.c16
-rw-r--r--drivers/net/ethernet/freescale/ucc_geth.c2
-rw-r--r--drivers/net/ethernet/freescale/ucc_geth.h6
12 files changed, 76 insertions, 126 deletions
diff --git a/drivers/net/ethernet/freescale/Kconfig b/drivers/net/ethernet/freescale/Kconfig
index 5272f9d4dda9..3574e1499dfc 100644
--- a/drivers/net/ethernet/freescale/Kconfig
+++ b/drivers/net/ethernet/freescale/Kconfig
@@ -21,10 +21,10 @@ config NET_VENDOR_FREESCALE
21if NET_VENDOR_FREESCALE 21if NET_VENDOR_FREESCALE
22 22
23config FEC 23config FEC
24 bool "FEC ethernet controller (of ColdFire and some i.MX CPUs)" 24 tristate "FEC ethernet controller (of ColdFire and some i.MX CPUs)"
25 depends on (M523x || M527x || M5272 || M528x || M520x || M532x || \ 25 depends on (M523x || M527x || M5272 || M528x || M520x || M532x || \
26 ARCH_MXC || ARCH_MXS) 26 ARCH_MXC || SOC_IMX28)
27 default ARCH_MXC || ARCH_MXS if ARM 27 default ARCH_MXC || SOC_IMX28 if ARM
28 select PHYLIB 28 select PHYLIB
29 ---help--- 29 ---help---
30 Say Y here if you want to use the built-in 10/100 Fast ethernet 30 Say Y here if you want to use the built-in 10/100 Fast ethernet
diff --git a/drivers/net/ethernet/freescale/fec.c b/drivers/net/ethernet/freescale/fec.c
index 112af9b056dc..ddcbbb34d1b9 100644
--- a/drivers/net/ethernet/freescale/fec.c
+++ b/drivers/net/ethernet/freescale/fec.c
@@ -99,7 +99,7 @@ static struct platform_device_id fec_devtype[] = {
99MODULE_DEVICE_TABLE(platform, fec_devtype); 99MODULE_DEVICE_TABLE(platform, fec_devtype);
100 100
101enum imx_fec_type { 101enum imx_fec_type {
102 IMX25_FEC = 1, /* runs on i.mx25/50/53 */ 102 IMX25_FEC = 1, /* runs on i.mx25/50/53 */
103 IMX27_FEC, /* runs on i.mx27/35/51 */ 103 IMX27_FEC, /* runs on i.mx27/35/51 */
104 IMX28_FEC, 104 IMX28_FEC,
105 IMX6Q_FEC, 105 IMX6Q_FEC,
@@ -132,7 +132,7 @@ MODULE_PARM_DESC(macaddr, "FEC Ethernet MAC address");
132#elif defined (CONFIG_M5272C3) 132#elif defined (CONFIG_M5272C3)
133#define FEC_FLASHMAC (0xffe04000 + 4) 133#define FEC_FLASHMAC (0xffe04000 + 4)
134#elif defined(CONFIG_MOD5272) 134#elif defined(CONFIG_MOD5272)
135#define FEC_FLASHMAC 0xffc0406b 135#define FEC_FLASHMAC 0xffc0406b
136#else 136#else
137#define FEC_FLASHMAC 0 137#define FEC_FLASHMAC 0
138#endif 138#endif
@@ -255,11 +255,13 @@ struct fec_enet_private {
255#define FEC_MMFR_TA (2 << 16) 255#define FEC_MMFR_TA (2 << 16)
256#define FEC_MMFR_DATA(v) (v & 0xffff) 256#define FEC_MMFR_DATA(v) (v & 0xffff)
257 257
258#define FEC_MII_TIMEOUT 1000 /* us */ 258#define FEC_MII_TIMEOUT 30000 /* us */
259 259
260/* Transmitter timeout */ 260/* Transmitter timeout */
261#define TX_TIMEOUT (2 * HZ) 261#define TX_TIMEOUT (2 * HZ)
262 262
263static int mii_cnt;
264
263static void *swap_buffer(void *bufaddr, int len) 265static void *swap_buffer(void *bufaddr, int len)
264{ 266{
265 int i; 267 int i;
@@ -516,6 +518,7 @@ fec_stop(struct net_device *ndev)
516 struct fec_enet_private *fep = netdev_priv(ndev); 518 struct fec_enet_private *fep = netdev_priv(ndev);
517 const struct platform_device_id *id_entry = 519 const struct platform_device_id *id_entry =
518 platform_get_device_id(fep->pdev); 520 platform_get_device_id(fep->pdev);
521 u32 rmii_mode = readl(fep->hwp + FEC_R_CNTRL) & (1 << 8);
519 522
520 /* We cannot expect a graceful transmit stop without link !!! */ 523 /* We cannot expect a graceful transmit stop without link !!! */
521 if (fep->link) { 524 if (fep->link) {
@@ -532,8 +535,10 @@ fec_stop(struct net_device *ndev)
532 writel(FEC_DEFAULT_IMASK, fep->hwp + FEC_IMASK); 535 writel(FEC_DEFAULT_IMASK, fep->hwp + FEC_IMASK);
533 536
534 /* We have to keep ENET enabled to have MII interrupt stay working */ 537 /* We have to keep ENET enabled to have MII interrupt stay working */
535 if (id_entry->driver_data & FEC_QUIRK_ENET_MAC) 538 if (id_entry->driver_data & FEC_QUIRK_ENET_MAC) {
536 writel(2, fep->hwp + FEC_ECNTRL); 539 writel(2, fep->hwp + FEC_ECNTRL);
540 writel(rmii_mode, fep->hwp + FEC_R_CNTRL);
541 }
537} 542}
538 543
539 544
@@ -819,7 +824,7 @@ static void __inline__ fec_get_mac(struct net_device *ndev)
819 iap = (unsigned char *)FEC_FLASHMAC; 824 iap = (unsigned char *)FEC_FLASHMAC;
820#else 825#else
821 if (pdata) 826 if (pdata)
822 memcpy(iap, pdata->mac, ETH_ALEN); 827 iap = (unsigned char *)&pdata->mac;
823#endif 828#endif
824 } 829 }
825 830
@@ -866,6 +871,8 @@ static void fec_enet_adjust_link(struct net_device *ndev)
866 if (phy_dev->link) { 871 if (phy_dev->link) {
867 if (fep->full_duplex != phy_dev->duplex) { 872 if (fep->full_duplex != phy_dev->duplex) {
868 fec_restart(ndev, phy_dev->duplex); 873 fec_restart(ndev, phy_dev->duplex);
874 /* prevent unnecessary second fec_restart() below */
875 fep->link = phy_dev->link;
869 status_change = 1; 876 status_change = 1;
870 } 877 }
871 } 878 }
@@ -973,8 +980,9 @@ static int fec_enet_mii_probe(struct net_device *ndev)
973 } 980 }
974 981
975 if (phy_id >= PHY_MAX_ADDR) { 982 if (phy_id >= PHY_MAX_ADDR) {
976 printk(KERN_INFO "%s: no PHY, assuming direct connection " 983 printk(KERN_INFO
977 "to switch\n", ndev->name); 984 "%s: no PHY, assuming direct connection to switch\n",
985 ndev->name);
978 strncpy(mdio_bus_id, "0", MII_BUS_ID_SIZE); 986 strncpy(mdio_bus_id, "0", MII_BUS_ID_SIZE);
979 phy_id = 0; 987 phy_id = 0;
980 } 988 }
@@ -999,8 +1007,9 @@ static int fec_enet_mii_probe(struct net_device *ndev)
999 fep->link = 0; 1007 fep->link = 0;
1000 fep->full_duplex = 0; 1008 fep->full_duplex = 0;
1001 1009
1002 printk(KERN_INFO "%s: Freescale FEC PHY driver [%s] " 1010 printk(KERN_INFO
1003 "(mii_bus:phy_addr=%s, irq=%d)\n", ndev->name, 1011 "%s: Freescale FEC PHY driver [%s] (mii_bus:phy_addr=%s, irq=%d)\n",
1012 ndev->name,
1004 fep->phy_dev->drv->name, dev_name(&fep->phy_dev->dev), 1013 fep->phy_dev->drv->name, dev_name(&fep->phy_dev->dev),
1005 fep->phy_dev->irq); 1014 fep->phy_dev->irq);
1006 1015
@@ -1034,8 +1043,12 @@ static int fec_enet_mii_init(struct platform_device *pdev)
1034 */ 1043 */
1035 if ((id_entry->driver_data & FEC_QUIRK_ENET_MAC) && fep->dev_id > 0) { 1044 if ((id_entry->driver_data & FEC_QUIRK_ENET_MAC) && fep->dev_id > 0) {
1036 /* fec1 uses fec0 mii_bus */ 1045 /* fec1 uses fec0 mii_bus */
1037 fep->mii_bus = fec0_mii_bus; 1046 if (mii_cnt && fec0_mii_bus) {
1038 return 0; 1047 fep->mii_bus = fec0_mii_bus;
1048 mii_cnt++;
1049 return 0;
1050 }
1051 return -ENOENT;
1039 } 1052 }
1040 1053
1041 fep->mii_timeout = 0; 1054 fep->mii_timeout = 0;
@@ -1080,6 +1093,8 @@ static int fec_enet_mii_init(struct platform_device *pdev)
1080 if (mdiobus_register(fep->mii_bus)) 1093 if (mdiobus_register(fep->mii_bus))
1081 goto err_out_free_mdio_irq; 1094 goto err_out_free_mdio_irq;
1082 1095
1096 mii_cnt++;
1097
1083 /* save fec0 mii_bus */ 1098 /* save fec0 mii_bus */
1084 if (id_entry->driver_data & FEC_QUIRK_ENET_MAC) 1099 if (id_entry->driver_data & FEC_QUIRK_ENET_MAC)
1085 fec0_mii_bus = fep->mii_bus; 1100 fec0_mii_bus = fep->mii_bus;
@@ -1096,11 +1111,11 @@ err_out:
1096 1111
1097static void fec_enet_mii_remove(struct fec_enet_private *fep) 1112static void fec_enet_mii_remove(struct fec_enet_private *fep)
1098{ 1113{
1099 if (fep->phy_dev) 1114 if (--mii_cnt == 0) {
1100 phy_disconnect(fep->phy_dev); 1115 mdiobus_unregister(fep->mii_bus);
1101 mdiobus_unregister(fep->mii_bus); 1116 kfree(fep->mii_bus->irq);
1102 kfree(fep->mii_bus->irq); 1117 mdiobus_free(fep->mii_bus);
1103 mdiobus_free(fep->mii_bus); 1118 }
1104} 1119}
1105 1120
1106static int fec_enet_get_settings(struct net_device *ndev, 1121static int fec_enet_get_settings(struct net_device *ndev,
@@ -1137,7 +1152,7 @@ static void fec_enet_get_drvinfo(struct net_device *ndev,
1137 strcpy(info->bus_info, dev_name(&ndev->dev)); 1152 strcpy(info->bus_info, dev_name(&ndev->dev));
1138} 1153}
1139 1154
1140static struct ethtool_ops fec_enet_ethtool_ops = { 1155static const struct ethtool_ops fec_enet_ethtool_ops = {
1141 .get_settings = fec_enet_get_settings, 1156 .get_settings = fec_enet_get_settings,
1142 .set_settings = fec_enet_set_settings, 1157 .set_settings = fec_enet_set_settings,
1143 .get_drvinfo = fec_enet_get_drvinfo, 1158 .get_drvinfo = fec_enet_get_drvinfo,
@@ -1574,8 +1589,12 @@ fec_probe(struct platform_device *pdev)
1574 1589
1575 for (i = 0; i < FEC_IRQ_NUM; i++) { 1590 for (i = 0; i < FEC_IRQ_NUM; i++) {
1576 irq = platform_get_irq(pdev, i); 1591 irq = platform_get_irq(pdev, i);
1577 if (i && irq < 0) 1592 if (irq < 0) {
1578 break; 1593 if (i)
1594 break;
1595 ret = irq;
1596 goto failed_irq;
1597 }
1579 ret = request_irq(irq, fec_enet_interrupt, IRQF_DISABLED, pdev->name, ndev); 1598 ret = request_irq(irq, fec_enet_interrupt, IRQF_DISABLED, pdev->name, ndev);
1580 if (ret) { 1599 if (ret) {
1581 while (--i >= 0) { 1600 while (--i >= 0) {
@@ -1586,7 +1605,7 @@ fec_probe(struct platform_device *pdev)
1586 } 1605 }
1587 } 1606 }
1588 1607
1589 fep->clk = clk_get(&pdev->dev, "fec_clk"); 1608 fep->clk = clk_get(&pdev->dev, NULL);
1590 if (IS_ERR(fep->clk)) { 1609 if (IS_ERR(fep->clk)) {
1591 ret = PTR_ERR(fep->clk); 1610 ret = PTR_ERR(fep->clk);
1592 goto failed_clk; 1611 goto failed_clk;
@@ -1638,13 +1657,18 @@ fec_drv_remove(struct platform_device *pdev)
1638 struct net_device *ndev = platform_get_drvdata(pdev); 1657 struct net_device *ndev = platform_get_drvdata(pdev);
1639 struct fec_enet_private *fep = netdev_priv(ndev); 1658 struct fec_enet_private *fep = netdev_priv(ndev);
1640 struct resource *r; 1659 struct resource *r;
1660 int i;
1641 1661
1642 fec_stop(ndev); 1662 unregister_netdev(ndev);
1643 fec_enet_mii_remove(fep); 1663 fec_enet_mii_remove(fep);
1664 for (i = 0; i < FEC_IRQ_NUM; i++) {
1665 int irq = platform_get_irq(pdev, i);
1666 if (irq > 0)
1667 free_irq(irq, ndev);
1668 }
1644 clk_disable_unprepare(fep->clk); 1669 clk_disable_unprepare(fep->clk);
1645 clk_put(fep->clk); 1670 clk_put(fep->clk);
1646 iounmap(fep->hwp); 1671 iounmap(fep->hwp);
1647 unregister_netdev(ndev);
1648 free_netdev(ndev); 1672 free_netdev(ndev);
1649 1673
1650 r = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1674 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
diff --git a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
index 5bf5471f06ff..910a8e18a9ae 100644
--- a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
+++ b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
@@ -1171,16 +1171,6 @@ static struct platform_driver fs_enet_driver = {
1171 .remove = fs_enet_remove, 1171 .remove = fs_enet_remove,
1172}; 1172};
1173 1173
1174static int __init fs_init(void)
1175{
1176 return platform_driver_register(&fs_enet_driver);
1177}
1178
1179static void __exit fs_cleanup(void)
1180{
1181 platform_driver_unregister(&fs_enet_driver);
1182}
1183
1184#ifdef CONFIG_NET_POLL_CONTROLLER 1174#ifdef CONFIG_NET_POLL_CONTROLLER
1185static void fs_enet_netpoll(struct net_device *dev) 1175static void fs_enet_netpoll(struct net_device *dev)
1186{ 1176{
@@ -1190,7 +1180,4 @@ static void fs_enet_netpoll(struct net_device *dev)
1190} 1180}
1191#endif 1181#endif
1192 1182
1193/**************************************************************************************/ 1183module_platform_driver(fs_enet_driver);
1194
1195module_init(fs_init);
1196module_exit(fs_cleanup);
diff --git a/drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c b/drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c
index b09270b5d0a5..0f2d1a710909 100644
--- a/drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c
+++ b/drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c
@@ -232,15 +232,4 @@ static struct platform_driver fs_enet_bb_mdio_driver = {
232 .remove = fs_enet_mdio_remove, 232 .remove = fs_enet_mdio_remove,
233}; 233};
234 234
235static int fs_enet_mdio_bb_init(void) 235module_platform_driver(fs_enet_bb_mdio_driver);
236{
237 return platform_driver_register(&fs_enet_bb_mdio_driver);
238}
239
240static void fs_enet_mdio_bb_exit(void)
241{
242 platform_driver_unregister(&fs_enet_bb_mdio_driver);
243}
244
245module_init(fs_enet_mdio_bb_init);
246module_exit(fs_enet_mdio_bb_exit);
diff --git a/drivers/net/ethernet/freescale/fs_enet/mii-fec.c b/drivers/net/ethernet/freescale/fs_enet/mii-fec.c
index e0e9d6c35d83..55bb867258e6 100644
--- a/drivers/net/ethernet/freescale/fs_enet/mii-fec.c
+++ b/drivers/net/ethernet/freescale/fs_enet/mii-fec.c
@@ -237,15 +237,4 @@ static struct platform_driver fs_enet_fec_mdio_driver = {
237 .remove = fs_enet_mdio_remove, 237 .remove = fs_enet_mdio_remove,
238}; 238};
239 239
240static int fs_enet_mdio_fec_init(void) 240module_platform_driver(fs_enet_fec_mdio_driver);
241{
242 return platform_driver_register(&fs_enet_fec_mdio_driver);
243}
244
245static void fs_enet_mdio_fec_exit(void)
246{
247 platform_driver_unregister(&fs_enet_fec_mdio_driver);
248}
249
250module_init(fs_enet_mdio_fec_init);
251module_exit(fs_enet_mdio_fec_exit);
diff --git a/drivers/net/ethernet/freescale/fsl_pq_mdio.c b/drivers/net/ethernet/freescale/fsl_pq_mdio.c
index 4d9f84b8ab97..9eb815941df5 100644
--- a/drivers/net/ethernet/freescale/fsl_pq_mdio.c
+++ b/drivers/net/ethernet/freescale/fsl_pq_mdio.c
@@ -360,12 +360,11 @@ static int fsl_pq_mdio_probe(struct platform_device *ofdev)
360 360
361 if (tbiaddr == -1) { 361 if (tbiaddr == -1) {
362 err = -EBUSY; 362 err = -EBUSY;
363
364 goto err_free_irqs; 363 goto err_free_irqs;
364 } else {
365 out_be32(tbipa, tbiaddr);
365 } 366 }
366 367
367 out_be32(tbipa, tbiaddr);
368
369 err = of_mdiobus_register(new_bus, np); 368 err = of_mdiobus_register(new_bus, np);
370 if (err) { 369 if (err) {
371 printk (KERN_ERR "%s: Cannot register as MDIO bus\n", 370 printk (KERN_ERR "%s: Cannot register as MDIO bus\n",
@@ -443,15 +442,6 @@ static struct platform_driver fsl_pq_mdio_driver = {
443 .remove = fsl_pq_mdio_remove, 442 .remove = fsl_pq_mdio_remove,
444}; 443};
445 444
446int __init fsl_pq_mdio_init(void) 445module_platform_driver(fsl_pq_mdio_driver);
447{
448 return platform_driver_register(&fsl_pq_mdio_driver);
449}
450module_init(fsl_pq_mdio_init);
451 446
452void fsl_pq_mdio_exit(void)
453{
454 platform_driver_unregister(&fsl_pq_mdio_driver);
455}
456module_exit(fsl_pq_mdio_exit);
457MODULE_LICENSE("GPL"); 447MODULE_LICENSE("GPL");
diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c
index 83199fd0d62b..e01cdaa722a9 100644
--- a/drivers/net/ethernet/freescale/gianfar.c
+++ b/drivers/net/ethernet/freescale/gianfar.c
@@ -734,7 +734,7 @@ static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev)
734 734
735 mac_addr = of_get_mac_address(np); 735 mac_addr = of_get_mac_address(np);
736 if (mac_addr) 736 if (mac_addr)
737 memcpy(dev->dev_addr, mac_addr, MAC_ADDR_LEN); 737 memcpy(dev->dev_addr, mac_addr, ETH_ALEN);
738 738
739 if (model && !strcasecmp(model, "TSEC")) 739 if (model && !strcasecmp(model, "TSEC"))
740 priv->device_flags = 740 priv->device_flags =
@@ -2306,7 +2306,7 @@ void gfar_check_rx_parser_mode(struct gfar_private *priv)
2306} 2306}
2307 2307
2308/* Enables and disables VLAN insertion/extraction */ 2308/* Enables and disables VLAN insertion/extraction */
2309void gfar_vlan_mode(struct net_device *dev, u32 features) 2309void gfar_vlan_mode(struct net_device *dev, netdev_features_t features)
2310{ 2310{
2311 struct gfar_private *priv = netdev_priv(dev); 2311 struct gfar_private *priv = netdev_priv(dev);
2312 struct gfar __iomem *regs = NULL; 2312 struct gfar __iomem *regs = NULL;
@@ -3114,7 +3114,7 @@ static void gfar_set_multi(struct net_device *dev)
3114static void gfar_clear_exact_match(struct net_device *dev) 3114static void gfar_clear_exact_match(struct net_device *dev)
3115{ 3115{
3116 int idx; 3116 int idx;
3117 static const u8 zero_arr[MAC_ADDR_LEN] = {0, 0, 0, 0, 0, 0}; 3117 static const u8 zero_arr[ETH_ALEN] = {0, 0, 0, 0, 0, 0};
3118 3118
3119 for(idx = 1;idx < GFAR_EM_NUM + 1;idx++) 3119 for(idx = 1;idx < GFAR_EM_NUM + 1;idx++)
3120 gfar_set_mac_for_addr(dev, idx, zero_arr); 3120 gfar_set_mac_for_addr(dev, idx, zero_arr);
@@ -3137,7 +3137,7 @@ static void gfar_set_hash_for_addr(struct net_device *dev, u8 *addr)
3137{ 3137{
3138 u32 tempval; 3138 u32 tempval;
3139 struct gfar_private *priv = netdev_priv(dev); 3139 struct gfar_private *priv = netdev_priv(dev);
3140 u32 result = ether_crc(MAC_ADDR_LEN, addr); 3140 u32 result = ether_crc(ETH_ALEN, addr);
3141 int width = priv->hash_width; 3141 int width = priv->hash_width;
3142 u8 whichbit = (result >> (32 - width)) & 0x1f; 3142 u8 whichbit = (result >> (32 - width)) & 0x1f;
3143 u8 whichreg = result >> (32 - width + 5); 3143 u8 whichreg = result >> (32 - width + 5);
@@ -3158,7 +3158,7 @@ static void gfar_set_mac_for_addr(struct net_device *dev, int num,
3158 struct gfar_private *priv = netdev_priv(dev); 3158 struct gfar_private *priv = netdev_priv(dev);
3159 struct gfar __iomem *regs = priv->gfargrp[0].regs; 3159 struct gfar __iomem *regs = priv->gfargrp[0].regs;
3160 int idx; 3160 int idx;
3161 char tmpbuf[MAC_ADDR_LEN]; 3161 char tmpbuf[ETH_ALEN];
3162 u32 tempval; 3162 u32 tempval;
3163 u32 __iomem *macptr = &regs->macstnaddr1; 3163 u32 __iomem *macptr = &regs->macstnaddr1;
3164 3164
@@ -3166,8 +3166,8 @@ static void gfar_set_mac_for_addr(struct net_device *dev, int num,
3166 3166
3167 /* Now copy it into the mac registers backwards, cuz */ 3167 /* Now copy it into the mac registers backwards, cuz */
3168 /* little endian is silly */ 3168 /* little endian is silly */
3169 for (idx = 0; idx < MAC_ADDR_LEN; idx++) 3169 for (idx = 0; idx < ETH_ALEN; idx++)
3170 tmpbuf[MAC_ADDR_LEN - 1 - idx] = addr[idx]; 3170 tmpbuf[ETH_ALEN - 1 - idx] = addr[idx];
3171 3171
3172 gfar_write(macptr, *((u32 *) (tmpbuf))); 3172 gfar_write(macptr, *((u32 *) (tmpbuf)));
3173 3173
@@ -3281,16 +3281,4 @@ static struct platform_driver gfar_driver = {
3281 .remove = gfar_remove, 3281 .remove = gfar_remove,
3282}; 3282};
3283 3283
3284static int __init gfar_init(void) 3284module_platform_driver(gfar_driver);
3285{
3286 return platform_driver_register(&gfar_driver);
3287}
3288
3289static void __exit gfar_exit(void)
3290{
3291 platform_driver_unregister(&gfar_driver);
3292}
3293
3294module_init(gfar_init);
3295module_exit(gfar_exit);
3296
diff --git a/drivers/net/ethernet/freescale/gianfar.h b/drivers/net/ethernet/freescale/gianfar.h
index 9aa43773e8e3..fe7ac3a83194 100644
--- a/drivers/net/ethernet/freescale/gianfar.h
+++ b/drivers/net/ethernet/freescale/gianfar.h
@@ -74,9 +74,6 @@ struct ethtool_rx_list {
74 * will be the next highest multiple of 512 bytes. */ 74 * will be the next highest multiple of 512 bytes. */
75#define INCREMENTAL_BUFFER_SIZE 512 75#define INCREMENTAL_BUFFER_SIZE 512
76 76
77
78#define MAC_ADDR_LEN 6
79
80#define PHY_INIT_TIMEOUT 100000 77#define PHY_INIT_TIMEOUT 100000
81#define GFAR_PHY_CHANGE_TIME 2 78#define GFAR_PHY_CHANGE_TIME 2
82 79
@@ -1179,9 +1176,9 @@ extern void gfar_phy_test(struct mii_bus *bus, struct phy_device *phydev,
1179extern void gfar_configure_coalescing(struct gfar_private *priv, 1176extern void gfar_configure_coalescing(struct gfar_private *priv,
1180 unsigned long tx_mask, unsigned long rx_mask); 1177 unsigned long tx_mask, unsigned long rx_mask);
1181void gfar_init_sysfs(struct net_device *dev); 1178void gfar_init_sysfs(struct net_device *dev);
1182int gfar_set_features(struct net_device *dev, u32 features); 1179int gfar_set_features(struct net_device *dev, netdev_features_t features);
1183extern void gfar_check_rx_parser_mode(struct gfar_private *priv); 1180extern void gfar_check_rx_parser_mode(struct gfar_private *priv);
1184extern void gfar_vlan_mode(struct net_device *dev, u32 features); 1181extern void gfar_vlan_mode(struct net_device *dev, netdev_features_t features);
1185 1182
1186extern const struct ethtool_ops gfar_ethtool_ops; 1183extern const struct ethtool_ops gfar_ethtool_ops;
1187 1184
diff --git a/drivers/net/ethernet/freescale/gianfar_ethtool.c b/drivers/net/ethernet/freescale/gianfar_ethtool.c
index 212736bab6bb..5a3b2e5b2880 100644
--- a/drivers/net/ethernet/freescale/gianfar_ethtool.c
+++ b/drivers/net/ethernet/freescale/gianfar_ethtool.c
@@ -519,12 +519,12 @@ static int gfar_sringparam(struct net_device *dev, struct ethtool_ringparam *rva
519 return err; 519 return err;
520} 520}
521 521
522int gfar_set_features(struct net_device *dev, u32 features) 522int gfar_set_features(struct net_device *dev, netdev_features_t features)
523{ 523{
524 struct gfar_private *priv = netdev_priv(dev); 524 struct gfar_private *priv = netdev_priv(dev);
525 unsigned long flags; 525 unsigned long flags;
526 int err = 0, i = 0; 526 int err = 0, i = 0;
527 u32 changed = dev->features ^ features; 527 netdev_features_t changed = dev->features ^ features;
528 528
529 if (changed & (NETIF_F_HW_VLAN_TX|NETIF_F_HW_VLAN_RX)) 529 if (changed & (NETIF_F_HW_VLAN_TX|NETIF_F_HW_VLAN_RX))
530 gfar_vlan_mode(dev, features); 530 gfar_vlan_mode(dev, features);
@@ -1410,10 +1410,9 @@ static int gfar_optimize_filer_masks(struct filer_table *tab)
1410 1410
1411 /* We need a copy of the filer table because 1411 /* We need a copy of the filer table because
1412 * we want to change its order */ 1412 * we want to change its order */
1413 temp_table = kmalloc(sizeof(*temp_table), GFP_KERNEL); 1413 temp_table = kmemdup(tab, sizeof(*temp_table), GFP_KERNEL);
1414 if (temp_table == NULL) 1414 if (temp_table == NULL)
1415 return -ENOMEM; 1415 return -ENOMEM;
1416 memcpy(temp_table, tab, sizeof(*temp_table));
1417 1416
1418 mask_table = kcalloc(MAX_FILER_CACHE_IDX / 2 + 1, 1417 mask_table = kcalloc(MAX_FILER_CACHE_IDX / 2 + 1,
1419 sizeof(struct gfar_mask_entry), GFP_KERNEL); 1418 sizeof(struct gfar_mask_entry), GFP_KERNEL);
@@ -1693,8 +1692,9 @@ static int gfar_set_nfc(struct net_device *dev, struct ethtool_rxnfc *cmd)
1693 ret = gfar_set_hash_opts(priv, cmd); 1692 ret = gfar_set_hash_opts(priv, cmd);
1694 break; 1693 break;
1695 case ETHTOOL_SRXCLSRLINS: 1694 case ETHTOOL_SRXCLSRLINS:
1696 if (cmd->fs.ring_cookie != RX_CLS_FLOW_DISC && 1695 if ((cmd->fs.ring_cookie != RX_CLS_FLOW_DISC &&
1697 cmd->fs.ring_cookie >= priv->num_rx_queues) { 1696 cmd->fs.ring_cookie >= priv->num_rx_queues) ||
1697 cmd->fs.location >= MAX_FILER_IDX) {
1698 ret = -EINVAL; 1698 ret = -EINVAL;
1699 break; 1699 break;
1700 } 1700 }
diff --git a/drivers/net/ethernet/freescale/gianfar_ptp.c b/drivers/net/ethernet/freescale/gianfar_ptp.c
index f67b8aebc89c..83e0ed757e33 100644
--- a/drivers/net/ethernet/freescale/gianfar_ptp.c
+++ b/drivers/net/ethernet/freescale/gianfar_ptp.c
@@ -562,21 +562,7 @@ static struct platform_driver gianfar_ptp_driver = {
562 .remove = gianfar_ptp_remove, 562 .remove = gianfar_ptp_remove,
563}; 563};
564 564
565/* module operations */ 565module_platform_driver(gianfar_ptp_driver);
566
567static int __init ptp_gianfar_init(void)
568{
569 return platform_driver_register(&gianfar_ptp_driver);
570}
571
572module_init(ptp_gianfar_init);
573
574static void __exit ptp_gianfar_exit(void)
575{
576 platform_driver_unregister(&gianfar_ptp_driver);
577}
578
579module_exit(ptp_gianfar_exit);
580 566
581MODULE_AUTHOR("Richard Cochran <richard.cochran@omicron.at>"); 567MODULE_AUTHOR("Richard Cochran <richard.cochran@omicron.at>");
582MODULE_DESCRIPTION("PTP clock using the eTSEC"); 568MODULE_DESCRIPTION("PTP clock using the eTSEC");
diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c
index b5dc0273a1d1..ba2dc083bfc0 100644
--- a/drivers/net/ethernet/freescale/ucc_geth.c
+++ b/drivers/net/ethernet/freescale/ucc_geth.c
@@ -443,7 +443,7 @@ static void hw_add_addr_in_hash(struct ucc_geth_private *ugeth,
443 443
444static inline int compare_addr(u8 **addr1, u8 **addr2) 444static inline int compare_addr(u8 **addr1, u8 **addr2)
445{ 445{
446 return memcmp(addr1, addr2, ENET_NUM_OCTETS_PER_ADDRESS); 446 return memcmp(addr1, addr2, ETH_ALEN);
447} 447}
448 448
449#ifdef DEBUG 449#ifdef DEBUG
diff --git a/drivers/net/ethernet/freescale/ucc_geth.h b/drivers/net/ethernet/freescale/ucc_geth.h
index d12fcad145e9..2e395a2566b8 100644
--- a/drivers/net/ethernet/freescale/ucc_geth.h
+++ b/drivers/net/ethernet/freescale/ucc_geth.h
@@ -20,6 +20,7 @@
20 20
21#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <linux/list.h> 22#include <linux/list.h>
23#include <linux/if_ether.h>
23 24
24#include <asm/immap_qe.h> 25#include <asm/immap_qe.h>
25#include <asm/qe.h> 26#include <asm/qe.h>
@@ -881,7 +882,6 @@ struct ucc_geth_hardware_statistics {
881#define TX_RING_MOD_MASK(size) (size-1) 882#define TX_RING_MOD_MASK(size) (size-1)
882#define RX_RING_MOD_MASK(size) (size-1) 883#define RX_RING_MOD_MASK(size) (size-1)
883 884
884#define ENET_NUM_OCTETS_PER_ADDRESS 6
885#define ENET_GROUP_ADDR 0x01 /* Group address mask 885#define ENET_GROUP_ADDR 0x01 /* Group address mask
886 for ethernet 886 for ethernet
887 addresses */ 887 addresses */
@@ -1051,7 +1051,7 @@ enum ucc_geth_num_of_station_addresses {
1051 1051
1052/* UCC GETH 82xx Ethernet Address Container */ 1052/* UCC GETH 82xx Ethernet Address Container */
1053struct enet_addr_container { 1053struct enet_addr_container {
1054 u8 address[ENET_NUM_OCTETS_PER_ADDRESS]; /* ethernet address */ 1054 u8 address[ETH_ALEN]; /* ethernet address */
1055 enum ucc_geth_enet_address_recognition_location location; /* location in 1055 enum ucc_geth_enet_address_recognition_location location; /* location in
1056 82xx address 1056 82xx address
1057 recognition 1057 recognition
@@ -1194,7 +1194,7 @@ struct ucc_geth_private {
1194 u16 cpucount[NUM_TX_QUEUES]; 1194 u16 cpucount[NUM_TX_QUEUES];
1195 u16 __iomem *p_cpucount[NUM_TX_QUEUES]; 1195 u16 __iomem *p_cpucount[NUM_TX_QUEUES];
1196 int indAddrRegUsed[NUM_OF_PADDRS]; 1196 int indAddrRegUsed[NUM_OF_PADDRS];
1197 u8 paddr[NUM_OF_PADDRS][ENET_NUM_OCTETS_PER_ADDRESS]; /* ethernet address */ 1197 u8 paddr[NUM_OF_PADDRS][ETH_ALEN]; /* ethernet address */
1198 u8 numGroupAddrInHash; 1198 u8 numGroupAddrInHash;
1199 u8 numIndAddrInHash; 1199 u8 numIndAddrInHash;
1200 u8 numIndAddrInReg; 1200 u8 numIndAddrInReg;