diff options
-rw-r--r-- | drivers/net/fs_enet/Makefile | 5 | ||||
-rw-r--r-- | drivers/net/fs_enet/fs_enet-main.c | 310 | ||||
-rw-r--r-- | drivers/net/fs_enet/fs_enet.h | 4 | ||||
-rw-r--r-- | drivers/net/fs_enet/mac-fcc.c | 67 | ||||
-rw-r--r-- | drivers/net/fs_enet/mac-fec.c | 23 | ||||
-rw-r--r-- | drivers/net/fs_enet/mac-scc.c | 37 | ||||
-rw-r--r-- | drivers/net/fs_enet/mii-bitbang.c | 107 | ||||
-rw-r--r-- | drivers/net/fs_enet/mii-fec.c | 144 | ||||
-rw-r--r-- | include/linux/fs_enet_pd.h | 4 |
9 files changed, 5 insertions, 696 deletions
diff --git a/drivers/net/fs_enet/Makefile b/drivers/net/fs_enet/Makefile index 1ffbe0756a0c..d4a305ee3455 100644 --- a/drivers/net/fs_enet/Makefile +++ b/drivers/net/fs_enet/Makefile | |||
@@ -8,12 +8,7 @@ fs_enet-$(CONFIG_FS_ENET_HAS_SCC) += mac-scc.o | |||
8 | fs_enet-$(CONFIG_FS_ENET_HAS_FEC) += mac-fec.o | 8 | fs_enet-$(CONFIG_FS_ENET_HAS_FEC) += mac-fec.o |
9 | fs_enet-$(CONFIG_FS_ENET_HAS_FCC) += mac-fcc.o | 9 | fs_enet-$(CONFIG_FS_ENET_HAS_FCC) += mac-fcc.o |
10 | 10 | ||
11 | ifeq ($(CONFIG_PPC_CPM_NEW_BINDING),y) | ||
12 | obj-$(CONFIG_FS_ENET_MDIO_FEC) += mii-fec.o | 11 | obj-$(CONFIG_FS_ENET_MDIO_FEC) += mii-fec.o |
13 | obj-$(CONFIG_FS_ENET_MDIO_FCC) += mii-bitbang.o | 12 | obj-$(CONFIG_FS_ENET_MDIO_FCC) += mii-bitbang.o |
14 | else | ||
15 | fs_enet-$(CONFIG_FS_ENET_MDIO_FEC) += mii-fec.o | ||
16 | fs_enet-$(CONFIG_FS_ENET_MDIO_FCC) += mii-bitbang.o | ||
17 | endif | ||
18 | 13 | ||
19 | fs_enet-objs := fs_enet-main.o $(fs_enet-m) | 14 | fs_enet-objs := fs_enet-main.o $(fs_enet-m) |
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c index 352574a3f056..ac2c48741d04 100644 --- a/drivers/net/fs_enet/fs_enet-main.c +++ b/drivers/net/fs_enet/fs_enet-main.c | |||
@@ -36,25 +36,17 @@ | |||
36 | #include <linux/fs.h> | 36 | #include <linux/fs.h> |
37 | #include <linux/platform_device.h> | 37 | #include <linux/platform_device.h> |
38 | #include <linux/phy.h> | 38 | #include <linux/phy.h> |
39 | #include <linux/of_platform.h> | ||
39 | 40 | ||
40 | #include <linux/vmalloc.h> | 41 | #include <linux/vmalloc.h> |
41 | #include <asm/pgtable.h> | 42 | #include <asm/pgtable.h> |
42 | #include <asm/irq.h> | 43 | #include <asm/irq.h> |
43 | #include <asm/uaccess.h> | 44 | #include <asm/uaccess.h> |
44 | 45 | ||
45 | #ifdef CONFIG_PPC_CPM_NEW_BINDING | ||
46 | #include <linux/of_platform.h> | ||
47 | #endif | ||
48 | |||
49 | #include "fs_enet.h" | 46 | #include "fs_enet.h" |
50 | 47 | ||
51 | /*************************************************/ | 48 | /*************************************************/ |
52 | 49 | ||
53 | #ifndef CONFIG_PPC_CPM_NEW_BINDING | ||
54 | static char version[] __devinitdata = | ||
55 | DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")" "\n"; | ||
56 | #endif | ||
57 | |||
58 | MODULE_AUTHOR("Pantelis Antoniou <panto@intracom.gr>"); | 50 | MODULE_AUTHOR("Pantelis Antoniou <panto@intracom.gr>"); |
59 | MODULE_DESCRIPTION("Freescale Ethernet Driver"); | 51 | MODULE_DESCRIPTION("Freescale Ethernet Driver"); |
60 | MODULE_LICENSE("GPL"); | 52 | MODULE_LICENSE("GPL"); |
@@ -957,190 +949,6 @@ static int fs_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | |||
957 | extern int fs_mii_connect(struct net_device *dev); | 949 | extern int fs_mii_connect(struct net_device *dev); |
958 | extern void fs_mii_disconnect(struct net_device *dev); | 950 | extern void fs_mii_disconnect(struct net_device *dev); |
959 | 951 | ||
960 | #ifndef CONFIG_PPC_CPM_NEW_BINDING | ||
961 | static struct net_device *fs_init_instance(struct device *dev, | ||
962 | struct fs_platform_info *fpi) | ||
963 | { | ||
964 | struct net_device *ndev = NULL; | ||
965 | struct fs_enet_private *fep = NULL; | ||
966 | int privsize, i, r, err = 0, registered = 0; | ||
967 | |||
968 | fpi->fs_no = fs_get_id(fpi); | ||
969 | /* guard */ | ||
970 | if ((unsigned int)fpi->fs_no >= FS_MAX_INDEX) | ||
971 | return ERR_PTR(-EINVAL); | ||
972 | |||
973 | privsize = sizeof(*fep) + (sizeof(struct sk_buff **) * | ||
974 | (fpi->rx_ring + fpi->tx_ring)); | ||
975 | |||
976 | ndev = alloc_etherdev(privsize); | ||
977 | if (!ndev) { | ||
978 | err = -ENOMEM; | ||
979 | goto err; | ||
980 | } | ||
981 | |||
982 | fep = netdev_priv(ndev); | ||
983 | |||
984 | fep->dev = dev; | ||
985 | dev_set_drvdata(dev, ndev); | ||
986 | fep->fpi = fpi; | ||
987 | if (fpi->init_ioports) | ||
988 | fpi->init_ioports((struct fs_platform_info *)fpi); | ||
989 | |||
990 | #ifdef CONFIG_FS_ENET_HAS_FEC | ||
991 | if (fs_get_fec_index(fpi->fs_no) >= 0) | ||
992 | fep->ops = &fs_fec_ops; | ||
993 | #endif | ||
994 | |||
995 | #ifdef CONFIG_FS_ENET_HAS_SCC | ||
996 | if (fs_get_scc_index(fpi->fs_no) >=0) | ||
997 | fep->ops = &fs_scc_ops; | ||
998 | #endif | ||
999 | |||
1000 | #ifdef CONFIG_FS_ENET_HAS_FCC | ||
1001 | if (fs_get_fcc_index(fpi->fs_no) >= 0) | ||
1002 | fep->ops = &fs_fcc_ops; | ||
1003 | #endif | ||
1004 | |||
1005 | if (fep->ops == NULL) { | ||
1006 | printk(KERN_ERR DRV_MODULE_NAME | ||
1007 | ": %s No matching ops found (%d).\n", | ||
1008 | ndev->name, fpi->fs_no); | ||
1009 | err = -EINVAL; | ||
1010 | goto err; | ||
1011 | } | ||
1012 | |||
1013 | r = (*fep->ops->setup_data)(ndev); | ||
1014 | if (r != 0) { | ||
1015 | printk(KERN_ERR DRV_MODULE_NAME | ||
1016 | ": %s setup_data failed\n", | ||
1017 | ndev->name); | ||
1018 | err = r; | ||
1019 | goto err; | ||
1020 | } | ||
1021 | |||
1022 | /* point rx_skbuff, tx_skbuff */ | ||
1023 | fep->rx_skbuff = (struct sk_buff **)&fep[1]; | ||
1024 | fep->tx_skbuff = fep->rx_skbuff + fpi->rx_ring; | ||
1025 | |||
1026 | /* init locks */ | ||
1027 | spin_lock_init(&fep->lock); | ||
1028 | spin_lock_init(&fep->tx_lock); | ||
1029 | |||
1030 | /* | ||
1031 | * Set the Ethernet address. | ||
1032 | */ | ||
1033 | for (i = 0; i < 6; i++) | ||
1034 | ndev->dev_addr[i] = fpi->macaddr[i]; | ||
1035 | |||
1036 | r = (*fep->ops->allocate_bd)(ndev); | ||
1037 | |||
1038 | if (fep->ring_base == NULL) { | ||
1039 | printk(KERN_ERR DRV_MODULE_NAME | ||
1040 | ": %s buffer descriptor alloc failed (%d).\n", ndev->name, r); | ||
1041 | err = r; | ||
1042 | goto err; | ||
1043 | } | ||
1044 | |||
1045 | /* | ||
1046 | * Set receive and transmit descriptor base. | ||
1047 | */ | ||
1048 | fep->rx_bd_base = fep->ring_base; | ||
1049 | fep->tx_bd_base = fep->rx_bd_base + fpi->rx_ring; | ||
1050 | |||
1051 | /* initialize ring size variables */ | ||
1052 | fep->tx_ring = fpi->tx_ring; | ||
1053 | fep->rx_ring = fpi->rx_ring; | ||
1054 | |||
1055 | /* | ||
1056 | * The FEC Ethernet specific entries in the device structure. | ||
1057 | */ | ||
1058 | ndev->open = fs_enet_open; | ||
1059 | ndev->hard_start_xmit = fs_enet_start_xmit; | ||
1060 | ndev->tx_timeout = fs_timeout; | ||
1061 | ndev->watchdog_timeo = 2 * HZ; | ||
1062 | ndev->stop = fs_enet_close; | ||
1063 | ndev->get_stats = fs_enet_get_stats; | ||
1064 | ndev->set_multicast_list = fs_set_multicast_list; | ||
1065 | |||
1066 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
1067 | ndev->poll_controller = fs_enet_netpoll; | ||
1068 | #endif | ||
1069 | |||
1070 | netif_napi_add(ndev, &fep->napi, | ||
1071 | fs_enet_rx_napi, fpi->napi_weight); | ||
1072 | |||
1073 | ndev->ethtool_ops = &fs_ethtool_ops; | ||
1074 | ndev->do_ioctl = fs_ioctl; | ||
1075 | |||
1076 | init_timer(&fep->phy_timer_list); | ||
1077 | |||
1078 | netif_carrier_off(ndev); | ||
1079 | |||
1080 | err = register_netdev(ndev); | ||
1081 | if (err != 0) { | ||
1082 | printk(KERN_ERR DRV_MODULE_NAME | ||
1083 | ": %s register_netdev failed.\n", ndev->name); | ||
1084 | goto err; | ||
1085 | } | ||
1086 | registered = 1; | ||
1087 | |||
1088 | |||
1089 | return ndev; | ||
1090 | |||
1091 | err: | ||
1092 | if (ndev != NULL) { | ||
1093 | if (registered) | ||
1094 | unregister_netdev(ndev); | ||
1095 | |||
1096 | if (fep && fep->ops) { | ||
1097 | (*fep->ops->free_bd)(ndev); | ||
1098 | (*fep->ops->cleanup_data)(ndev); | ||
1099 | } | ||
1100 | |||
1101 | free_netdev(ndev); | ||
1102 | } | ||
1103 | |||
1104 | dev_set_drvdata(dev, NULL); | ||
1105 | |||
1106 | return ERR_PTR(err); | ||
1107 | } | ||
1108 | |||
1109 | static int fs_cleanup_instance(struct net_device *ndev) | ||
1110 | { | ||
1111 | struct fs_enet_private *fep; | ||
1112 | const struct fs_platform_info *fpi; | ||
1113 | struct device *dev; | ||
1114 | |||
1115 | if (ndev == NULL) | ||
1116 | return -EINVAL; | ||
1117 | |||
1118 | fep = netdev_priv(ndev); | ||
1119 | if (fep == NULL) | ||
1120 | return -EINVAL; | ||
1121 | |||
1122 | fpi = fep->fpi; | ||
1123 | |||
1124 | unregister_netdev(ndev); | ||
1125 | |||
1126 | dma_free_coherent(fep->dev, (fpi->tx_ring + fpi->rx_ring) * sizeof(cbd_t), | ||
1127 | (void __force *)fep->ring_base, fep->ring_mem_addr); | ||
1128 | |||
1129 | /* reset it */ | ||
1130 | (*fep->ops->cleanup_data)(ndev); | ||
1131 | |||
1132 | dev = fep->dev; | ||
1133 | if (dev != NULL) { | ||
1134 | dev_set_drvdata(dev, NULL); | ||
1135 | fep->dev = NULL; | ||
1136 | } | ||
1137 | |||
1138 | free_netdev(ndev); | ||
1139 | |||
1140 | return 0; | ||
1141 | } | ||
1142 | #endif | ||
1143 | |||
1144 | /**************************************************************************************/ | 952 | /**************************************************************************************/ |
1145 | 953 | ||
1146 | /* handy pointer to the immap */ | 954 | /* handy pointer to the immap */ |
@@ -1167,7 +975,6 @@ static void cleanup_immap(void) | |||
1167 | 975 | ||
1168 | /**************************************************************************************/ | 976 | /**************************************************************************************/ |
1169 | 977 | ||
1170 | #ifdef CONFIG_PPC_CPM_NEW_BINDING | ||
1171 | static int __devinit find_phy(struct device_node *np, | 978 | static int __devinit find_phy(struct device_node *np, |
1172 | struct fs_platform_info *fpi) | 979 | struct fs_platform_info *fpi) |
1173 | { | 980 | { |
@@ -1399,121 +1206,6 @@ static void __exit fs_cleanup(void) | |||
1399 | of_unregister_platform_driver(&fs_enet_driver); | 1206 | of_unregister_platform_driver(&fs_enet_driver); |
1400 | cleanup_immap(); | 1207 | cleanup_immap(); |
1401 | } | 1208 | } |
1402 | #else | ||
1403 | static int __devinit fs_enet_probe(struct device *dev) | ||
1404 | { | ||
1405 | struct net_device *ndev; | ||
1406 | |||
1407 | /* no fixup - no device */ | ||
1408 | if (dev->platform_data == NULL) { | ||
1409 | printk(KERN_INFO "fs_enet: " | ||
1410 | "probe called with no platform data; " | ||
1411 | "remove unused devices\n"); | ||
1412 | return -ENODEV; | ||
1413 | } | ||
1414 | |||
1415 | ndev = fs_init_instance(dev, dev->platform_data); | ||
1416 | if (IS_ERR(ndev)) | ||
1417 | return PTR_ERR(ndev); | ||
1418 | return 0; | ||
1419 | } | ||
1420 | |||
1421 | static int fs_enet_remove(struct device *dev) | ||
1422 | { | ||
1423 | return fs_cleanup_instance(dev_get_drvdata(dev)); | ||
1424 | } | ||
1425 | |||
1426 | static struct device_driver fs_enet_fec_driver = { | ||
1427 | .name = "fsl-cpm-fec", | ||
1428 | .bus = &platform_bus_type, | ||
1429 | .probe = fs_enet_probe, | ||
1430 | .remove = fs_enet_remove, | ||
1431 | #ifdef CONFIG_PM | ||
1432 | /* .suspend = fs_enet_suspend, TODO */ | ||
1433 | /* .resume = fs_enet_resume, TODO */ | ||
1434 | #endif | ||
1435 | }; | ||
1436 | |||
1437 | static struct device_driver fs_enet_scc_driver = { | ||
1438 | .name = "fsl-cpm-scc", | ||
1439 | .bus = &platform_bus_type, | ||
1440 | .probe = fs_enet_probe, | ||
1441 | .remove = fs_enet_remove, | ||
1442 | #ifdef CONFIG_PM | ||
1443 | /* .suspend = fs_enet_suspend, TODO */ | ||
1444 | /* .resume = fs_enet_resume, TODO */ | ||
1445 | #endif | ||
1446 | }; | ||
1447 | |||
1448 | static struct device_driver fs_enet_fcc_driver = { | ||
1449 | .name = "fsl-cpm-fcc", | ||
1450 | .bus = &platform_bus_type, | ||
1451 | .probe = fs_enet_probe, | ||
1452 | .remove = fs_enet_remove, | ||
1453 | #ifdef CONFIG_PM | ||
1454 | /* .suspend = fs_enet_suspend, TODO */ | ||
1455 | /* .resume = fs_enet_resume, TODO */ | ||
1456 | #endif | ||
1457 | }; | ||
1458 | |||
1459 | static int __init fs_init(void) | ||
1460 | { | ||
1461 | int r; | ||
1462 | |||
1463 | printk(KERN_INFO | ||
1464 | "%s", version); | ||
1465 | |||
1466 | r = setup_immap(); | ||
1467 | if (r != 0) | ||
1468 | return r; | ||
1469 | |||
1470 | #ifdef CONFIG_FS_ENET_HAS_FCC | ||
1471 | /* let's insert mii stuff */ | ||
1472 | r = fs_enet_mdio_bb_init(); | ||
1473 | |||
1474 | if (r != 0) { | ||
1475 | printk(KERN_ERR DRV_MODULE_NAME | ||
1476 | "BB PHY init failed.\n"); | ||
1477 | return r; | ||
1478 | } | ||
1479 | r = driver_register(&fs_enet_fcc_driver); | ||
1480 | if (r != 0) | ||
1481 | goto err; | ||
1482 | #endif | ||
1483 | |||
1484 | #ifdef CONFIG_FS_ENET_HAS_FEC | ||
1485 | r = fs_enet_mdio_fec_init(); | ||
1486 | if (r != 0) { | ||
1487 | printk(KERN_ERR DRV_MODULE_NAME | ||
1488 | "FEC PHY init failed.\n"); | ||
1489 | return r; | ||
1490 | } | ||
1491 | |||
1492 | r = driver_register(&fs_enet_fec_driver); | ||
1493 | if (r != 0) | ||
1494 | goto err; | ||
1495 | #endif | ||
1496 | |||
1497 | #ifdef CONFIG_FS_ENET_HAS_SCC | ||
1498 | r = driver_register(&fs_enet_scc_driver); | ||
1499 | if (r != 0) | ||
1500 | goto err; | ||
1501 | #endif | ||
1502 | |||
1503 | return 0; | ||
1504 | err: | ||
1505 | cleanup_immap(); | ||
1506 | return r; | ||
1507 | } | ||
1508 | |||
1509 | static void __exit fs_cleanup(void) | ||
1510 | { | ||
1511 | driver_unregister(&fs_enet_fec_driver); | ||
1512 | driver_unregister(&fs_enet_fcc_driver); | ||
1513 | driver_unregister(&fs_enet_scc_driver); | ||
1514 | cleanup_immap(); | ||
1515 | } | ||
1516 | #endif | ||
1517 | 1209 | ||
1518 | #ifdef CONFIG_NET_POLL_CONTROLLER | 1210 | #ifdef CONFIG_NET_POLL_CONTROLLER |
1519 | static void fs_enet_netpoll(struct net_device *dev) | 1211 | static void fs_enet_netpoll(struct net_device *dev) |
diff --git a/drivers/net/fs_enet/fs_enet.h b/drivers/net/fs_enet/fs_enet.h index e05389c49bbb..db46d2e72329 100644 --- a/drivers/net/fs_enet/fs_enet.h +++ b/drivers/net/fs_enet/fs_enet.h | |||
@@ -138,10 +138,6 @@ struct fs_enet_private { | |||
138 | }; | 138 | }; |
139 | 139 | ||
140 | /***************************************************************************/ | 140 | /***************************************************************************/ |
141 | #ifndef CONFIG_PPC_CPM_NEW_BINDING | ||
142 | int fs_enet_mdio_bb_init(void); | ||
143 | int fs_enet_mdio_fec_init(void); | ||
144 | #endif | ||
145 | 141 | ||
146 | void fs_init_bds(struct net_device *dev); | 142 | void fs_init_bds(struct net_device *dev); |
147 | void fs_cleanup_bds(struct net_device *dev); | 143 | void fs_cleanup_bds(struct net_device *dev); |
diff --git a/drivers/net/fs_enet/mac-fcc.c b/drivers/net/fs_enet/mac-fcc.c index 8268b3535b30..0a97fc2d97ec 100644 --- a/drivers/net/fs_enet/mac-fcc.c +++ b/drivers/net/fs_enet/mac-fcc.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/fs.h> | 33 | #include <linux/fs.h> |
34 | #include <linux/platform_device.h> | 34 | #include <linux/platform_device.h> |
35 | #include <linux/phy.h> | 35 | #include <linux/phy.h> |
36 | #include <linux/of_device.h> | ||
36 | 37 | ||
37 | #include <asm/immap_cpm2.h> | 38 | #include <asm/immap_cpm2.h> |
38 | #include <asm/mpc8260.h> | 39 | #include <asm/mpc8260.h> |
@@ -42,10 +43,6 @@ | |||
42 | #include <asm/irq.h> | 43 | #include <asm/irq.h> |
43 | #include <asm/uaccess.h> | 44 | #include <asm/uaccess.h> |
44 | 45 | ||
45 | #ifdef CONFIG_PPC_CPM_NEW_BINDING | ||
46 | #include <asm/of_device.h> | ||
47 | #endif | ||
48 | |||
49 | #include "fs_enet.h" | 46 | #include "fs_enet.h" |
50 | 47 | ||
51 | /*************************************************/ | 48 | /*************************************************/ |
@@ -87,7 +84,6 @@ static inline int fcc_cr_cmd(struct fs_enet_private *fep, u32 op) | |||
87 | 84 | ||
88 | static int do_pd_setup(struct fs_enet_private *fep) | 85 | static int do_pd_setup(struct fs_enet_private *fep) |
89 | { | 86 | { |
90 | #ifdef CONFIG_PPC_CPM_NEW_BINDING | ||
91 | struct of_device *ofdev = to_of_device(fep->dev); | 87 | struct of_device *ofdev = to_of_device(fep->dev); |
92 | struct fs_platform_info *fpi = fep->fpi; | 88 | struct fs_platform_info *fpi = fep->fpi; |
93 | int ret = -EINVAL; | 89 | int ret = -EINVAL; |
@@ -125,44 +121,6 @@ out_fccp: | |||
125 | iounmap(fep->fcc.fccp); | 121 | iounmap(fep->fcc.fccp); |
126 | out: | 122 | out: |
127 | return ret; | 123 | return ret; |
128 | #else | ||
129 | struct platform_device *pdev = to_platform_device(fep->dev); | ||
130 | struct resource *r; | ||
131 | |||
132 | /* Fill out IRQ field */ | ||
133 | fep->interrupt = platform_get_irq(pdev, 0); | ||
134 | if (fep->interrupt < 0) | ||
135 | return -EINVAL; | ||
136 | |||
137 | /* Attach the memory for the FCC Parameter RAM */ | ||
138 | r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "fcc_pram"); | ||
139 | fep->fcc.ep = ioremap(r->start, r->end - r->start + 1); | ||
140 | if (fep->fcc.ep == NULL) | ||
141 | return -EINVAL; | ||
142 | |||
143 | r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "fcc_regs"); | ||
144 | fep->fcc.fccp = ioremap(r->start, r->end - r->start + 1); | ||
145 | if (fep->fcc.fccp == NULL) | ||
146 | return -EINVAL; | ||
147 | |||
148 | if (fep->fpi->fcc_regs_c) { | ||
149 | fep->fcc.fcccp = (void __iomem *)fep->fpi->fcc_regs_c; | ||
150 | } else { | ||
151 | r = platform_get_resource_byname(pdev, IORESOURCE_MEM, | ||
152 | "fcc_regs_c"); | ||
153 | fep->fcc.fcccp = ioremap(r->start, | ||
154 | r->end - r->start + 1); | ||
155 | } | ||
156 | |||
157 | if (fep->fcc.fcccp == NULL) | ||
158 | return -EINVAL; | ||
159 | |||
160 | fep->fcc.mem = (void __iomem *)fep->fpi->mem_offset; | ||
161 | if (fep->fcc.mem == NULL) | ||
162 | return -EINVAL; | ||
163 | |||
164 | return 0; | ||
165 | #endif | ||
166 | } | 124 | } |
167 | 125 | ||
168 | #define FCC_NAPI_RX_EVENT_MSK (FCC_ENET_RXF | FCC_ENET_RXB) | 126 | #define FCC_NAPI_RX_EVENT_MSK (FCC_ENET_RXF | FCC_ENET_RXB) |
@@ -173,17 +131,6 @@ out: | |||
173 | static int setup_data(struct net_device *dev) | 131 | static int setup_data(struct net_device *dev) |
174 | { | 132 | { |
175 | struct fs_enet_private *fep = netdev_priv(dev); | 133 | struct fs_enet_private *fep = netdev_priv(dev); |
176 | #ifndef CONFIG_PPC_CPM_NEW_BINDING | ||
177 | struct fs_platform_info *fpi = fep->fpi; | ||
178 | |||
179 | fpi->cp_command = (fpi->cp_page << 26) | | ||
180 | (fpi->cp_block << 21) | | ||
181 | (12 << 6); | ||
182 | |||
183 | fep->fcc.idx = fs_get_fcc_index(fpi->fs_no); | ||
184 | if ((unsigned int)fep->fcc.idx >= 3) /* max 3 FCCs */ | ||
185 | return -EINVAL; | ||
186 | #endif | ||
187 | 134 | ||
188 | if (do_pd_setup(fep) != 0) | 135 | if (do_pd_setup(fep) != 0) |
189 | return -EINVAL; | 136 | return -EINVAL; |
@@ -304,9 +251,6 @@ static void restart(struct net_device *dev) | |||
304 | fcc_enet_t __iomem *ep = fep->fcc.ep; | 251 | fcc_enet_t __iomem *ep = fep->fcc.ep; |
305 | dma_addr_t rx_bd_base_phys, tx_bd_base_phys; | 252 | dma_addr_t rx_bd_base_phys, tx_bd_base_phys; |
306 | u16 paddrh, paddrm, paddrl; | 253 | u16 paddrh, paddrm, paddrl; |
307 | #ifndef CONFIG_PPC_CPM_NEW_BINDING | ||
308 | u16 mem_addr; | ||
309 | #endif | ||
310 | const unsigned char *mac; | 254 | const unsigned char *mac; |
311 | int i; | 255 | int i; |
312 | 256 | ||
@@ -338,19 +282,10 @@ static void restart(struct net_device *dev) | |||
338 | * this area. | 282 | * this area. |
339 | */ | 283 | */ |
340 | 284 | ||
341 | #ifdef CONFIG_PPC_CPM_NEW_BINDING | ||
342 | W16(ep, fen_genfcc.fcc_riptr, fpi->dpram_offset); | 285 | W16(ep, fen_genfcc.fcc_riptr, fpi->dpram_offset); |
343 | W16(ep, fen_genfcc.fcc_tiptr, fpi->dpram_offset + 32); | 286 | W16(ep, fen_genfcc.fcc_tiptr, fpi->dpram_offset + 32); |
344 | 287 | ||
345 | W16(ep, fen_padptr, fpi->dpram_offset + 64); | 288 | W16(ep, fen_padptr, fpi->dpram_offset + 64); |
346 | #else | ||
347 | mem_addr = (u32) fep->fcc.mem; /* de-fixup dpram offset */ | ||
348 | |||
349 | W16(ep, fen_genfcc.fcc_riptr, (mem_addr & 0xffff)); | ||
350 | W16(ep, fen_genfcc.fcc_tiptr, ((mem_addr + 32) & 0xffff)); | ||
351 | |||
352 | W16(ep, fen_padptr, mem_addr + 64); | ||
353 | #endif | ||
354 | 289 | ||
355 | /* fill with special symbol... */ | 290 | /* fill with special symbol... */ |
356 | memset_io(fep->fcc.mem + fpi->dpram_offset + 64, 0x88, 32); | 291 | memset_io(fep->fcc.mem + fpi->dpram_offset + 64, 0x88, 32); |
diff --git a/drivers/net/fs_enet/mac-fec.c b/drivers/net/fs_enet/mac-fec.c index 8a311d1e435b..0a7d1c5c6524 100644 --- a/drivers/net/fs_enet/mac-fec.c +++ b/drivers/net/fs_enet/mac-fec.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/bitops.h> | 32 | #include <linux/bitops.h> |
33 | #include <linux/fs.h> | 33 | #include <linux/fs.h> |
34 | #include <linux/platform_device.h> | 34 | #include <linux/platform_device.h> |
35 | #include <linux/of_device.h> | ||
35 | 36 | ||
36 | #include <asm/irq.h> | 37 | #include <asm/irq.h> |
37 | #include <asm/uaccess.h> | 38 | #include <asm/uaccess.h> |
@@ -43,10 +44,6 @@ | |||
43 | #include <asm/cpm1.h> | 44 | #include <asm/cpm1.h> |
44 | #endif | 45 | #endif |
45 | 46 | ||
46 | #ifdef CONFIG_PPC_CPM_NEW_BINDING | ||
47 | #include <asm/of_device.h> | ||
48 | #endif | ||
49 | |||
50 | #include "fs_enet.h" | 47 | #include "fs_enet.h" |
51 | #include "fec.h" | 48 | #include "fec.h" |
52 | 49 | ||
@@ -99,7 +96,6 @@ static int whack_reset(fec_t __iomem *fecp) | |||
99 | 96 | ||
100 | static int do_pd_setup(struct fs_enet_private *fep) | 97 | static int do_pd_setup(struct fs_enet_private *fep) |
101 | { | 98 | { |
102 | #ifdef CONFIG_PPC_CPM_NEW_BINDING | ||
103 | struct of_device *ofdev = to_of_device(fep->dev); | 99 | struct of_device *ofdev = to_of_device(fep->dev); |
104 | 100 | ||
105 | fep->interrupt = of_irq_to_resource(ofdev->node, 0, NULL); | 101 | fep->interrupt = of_irq_to_resource(ofdev->node, 0, NULL); |
@@ -111,23 +107,6 @@ static int do_pd_setup(struct fs_enet_private *fep) | |||
111 | return -EINVAL; | 107 | return -EINVAL; |
112 | 108 | ||
113 | return 0; | 109 | return 0; |
114 | #else | ||
115 | struct platform_device *pdev = to_platform_device(fep->dev); | ||
116 | struct resource *r; | ||
117 | |||
118 | /* Fill out IRQ field */ | ||
119 | fep->interrupt = platform_get_irq_byname(pdev,"interrupt"); | ||
120 | if (fep->interrupt < 0) | ||
121 | return -EINVAL; | ||
122 | |||
123 | r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs"); | ||
124 | fep->fec.fecp = ioremap(r->start, r->end - r->start + 1); | ||
125 | |||
126 | if(fep->fec.fecp == NULL) | ||
127 | return -EINVAL; | ||
128 | |||
129 | return 0; | ||
130 | #endif | ||
131 | } | 110 | } |
132 | 111 | ||
133 | #define FEC_NAPI_RX_EVENT_MSK (FEC_ENET_RXF | FEC_ENET_RXB) | 112 | #define FEC_NAPI_RX_EVENT_MSK (FEC_ENET_RXF | FEC_ENET_RXB) |
diff --git a/drivers/net/fs_enet/mac-scc.c b/drivers/net/fs_enet/mac-scc.c index e3557eca7b6d..029b3c7ef29c 100644 --- a/drivers/net/fs_enet/mac-scc.c +++ b/drivers/net/fs_enet/mac-scc.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/bitops.h> | 32 | #include <linux/bitops.h> |
33 | #include <linux/fs.h> | 33 | #include <linux/fs.h> |
34 | #include <linux/platform_device.h> | 34 | #include <linux/platform_device.h> |
35 | #include <linux/of_platform.h> | ||
35 | 36 | ||
36 | #include <asm/irq.h> | 37 | #include <asm/irq.h> |
37 | #include <asm/uaccess.h> | 38 | #include <asm/uaccess.h> |
@@ -43,10 +44,6 @@ | |||
43 | #include <asm/cpm1.h> | 44 | #include <asm/cpm1.h> |
44 | #endif | 45 | #endif |
45 | 46 | ||
46 | #ifdef CONFIG_PPC_CPM_NEW_BINDING | ||
47 | #include <linux/of_platform.h> | ||
48 | #endif | ||
49 | |||
50 | #include "fs_enet.h" | 47 | #include "fs_enet.h" |
51 | 48 | ||
52 | /*************************************************/ | 49 | /*************************************************/ |
@@ -99,7 +96,6 @@ static inline int scc_cr_cmd(struct fs_enet_private *fep, u32 op) | |||
99 | 96 | ||
100 | static int do_pd_setup(struct fs_enet_private *fep) | 97 | static int do_pd_setup(struct fs_enet_private *fep) |
101 | { | 98 | { |
102 | #ifdef CONFIG_PPC_CPM_NEW_BINDING | ||
103 | struct of_device *ofdev = to_of_device(fep->dev); | 99 | struct of_device *ofdev = to_of_device(fep->dev); |
104 | 100 | ||
105 | fep->interrupt = of_irq_to_resource(ofdev->node, 0, NULL); | 101 | fep->interrupt = of_irq_to_resource(ofdev->node, 0, NULL); |
@@ -115,27 +111,6 @@ static int do_pd_setup(struct fs_enet_private *fep) | |||
115 | iounmap(fep->scc.sccp); | 111 | iounmap(fep->scc.sccp); |
116 | return -EINVAL; | 112 | return -EINVAL; |
117 | } | 113 | } |
118 | #else | ||
119 | struct platform_device *pdev = to_platform_device(fep->dev); | ||
120 | struct resource *r; | ||
121 | |||
122 | /* Fill out IRQ field */ | ||
123 | fep->interrupt = platform_get_irq_byname(pdev, "interrupt"); | ||
124 | if (fep->interrupt < 0) | ||
125 | return -EINVAL; | ||
126 | |||
127 | r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs"); | ||
128 | fep->scc.sccp = ioremap(r->start, r->end - r->start + 1); | ||
129 | |||
130 | if (fep->scc.sccp == NULL) | ||
131 | return -EINVAL; | ||
132 | |||
133 | r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pram"); | ||
134 | fep->scc.ep = ioremap(r->start, r->end - r->start + 1); | ||
135 | |||
136 | if (fep->scc.ep == NULL) | ||
137 | return -EINVAL; | ||
138 | #endif | ||
139 | 114 | ||
140 | return 0; | 115 | return 0; |
141 | } | 116 | } |
@@ -149,16 +124,6 @@ static int setup_data(struct net_device *dev) | |||
149 | { | 124 | { |
150 | struct fs_enet_private *fep = netdev_priv(dev); | 125 | struct fs_enet_private *fep = netdev_priv(dev); |
151 | 126 | ||
152 | #ifndef CONFIG_PPC_CPM_NEW_BINDING | ||
153 | struct fs_platform_info *fpi = fep->fpi; | ||
154 | |||
155 | fep->scc.idx = fs_get_scc_index(fpi->fs_no); | ||
156 | if ((unsigned int)fep->fcc.idx >= 4) /* max 4 SCCs */ | ||
157 | return -EINVAL; | ||
158 | |||
159 | fpi->cp_command = fep->fcc.idx << 6; | ||
160 | #endif | ||
161 | |||
162 | do_pd_setup(fep); | 127 | do_pd_setup(fep); |
163 | 128 | ||
164 | fep->scc.hthi = 0; | 129 | fep->scc.hthi = 0; |
diff --git a/drivers/net/fs_enet/mii-bitbang.c b/drivers/net/fs_enet/mii-bitbang.c index 1620030cd33c..be4b72f4f49a 100644 --- a/drivers/net/fs_enet/mii-bitbang.c +++ b/drivers/net/fs_enet/mii-bitbang.c | |||
@@ -22,10 +22,7 @@ | |||
22 | #include <linux/mii.h> | 22 | #include <linux/mii.h> |
23 | #include <linux/platform_device.h> | 23 | #include <linux/platform_device.h> |
24 | #include <linux/mdio-bitbang.h> | 24 | #include <linux/mdio-bitbang.h> |
25 | |||
26 | #ifdef CONFIG_PPC_CPM_NEW_BINDING | ||
27 | #include <linux/of_platform.h> | 25 | #include <linux/of_platform.h> |
28 | #endif | ||
29 | 26 | ||
30 | #include "fs_enet.h" | 27 | #include "fs_enet.h" |
31 | 28 | ||
@@ -110,7 +107,6 @@ static struct mdiobb_ops bb_ops = { | |||
110 | .get_mdio_data = mdio_read, | 107 | .get_mdio_data = mdio_read, |
111 | }; | 108 | }; |
112 | 109 | ||
113 | #ifdef CONFIG_PPC_CPM_NEW_BINDING | ||
114 | static int __devinit fs_mii_bitbang_init(struct mii_bus *bus, | 110 | static int __devinit fs_mii_bitbang_init(struct mii_bus *bus, |
115 | struct device_node *np) | 111 | struct device_node *np) |
116 | { | 112 | { |
@@ -271,106 +267,3 @@ static void fs_enet_mdio_bb_exit(void) | |||
271 | 267 | ||
272 | module_init(fs_enet_mdio_bb_init); | 268 | module_init(fs_enet_mdio_bb_init); |
273 | module_exit(fs_enet_mdio_bb_exit); | 269 | module_exit(fs_enet_mdio_bb_exit); |
274 | #else | ||
275 | static int __devinit fs_mii_bitbang_init(struct bb_info *bitbang, | ||
276 | struct fs_mii_bb_platform_info *fmpi) | ||
277 | { | ||
278 | bitbang->dir = (u32 __iomem *)fmpi->mdio_dir.offset; | ||
279 | bitbang->dat = (u32 __iomem *)fmpi->mdio_dat.offset; | ||
280 | bitbang->mdio_msk = 1U << (31 - fmpi->mdio_dat.bit); | ||
281 | bitbang->mdc_msk = 1U << (31 - fmpi->mdc_dat.bit); | ||
282 | |||
283 | return 0; | ||
284 | } | ||
285 | |||
286 | static int __devinit fs_enet_mdio_probe(struct device *dev) | ||
287 | { | ||
288 | struct platform_device *pdev = to_platform_device(dev); | ||
289 | struct fs_mii_bb_platform_info *pdata; | ||
290 | struct mii_bus *new_bus; | ||
291 | struct bb_info *bitbang; | ||
292 | int err = 0; | ||
293 | |||
294 | if (NULL == dev) | ||
295 | return -EINVAL; | ||
296 | |||
297 | bitbang = kzalloc(sizeof(struct bb_info), GFP_KERNEL); | ||
298 | |||
299 | if (NULL == bitbang) | ||
300 | return -ENOMEM; | ||
301 | |||
302 | bitbang->ctrl.ops = &bb_ops; | ||
303 | |||
304 | new_bus = alloc_mdio_bitbang(&bitbang->ctrl); | ||
305 | |||
306 | if (NULL == new_bus) | ||
307 | return -ENOMEM; | ||
308 | |||
309 | new_bus->name = "BB MII Bus", | ||
310 | snprintf(new_bus->id, MII_BUS_ID_SIZE, "%x", pdev->id); | ||
311 | |||
312 | new_bus->phy_mask = ~0x9; | ||
313 | pdata = (struct fs_mii_bb_platform_info *)pdev->dev.platform_data; | ||
314 | |||
315 | if (NULL == pdata) { | ||
316 | printk(KERN_ERR "gfar mdio %d: Missing platform data!\n", pdev->id); | ||
317 | return -ENODEV; | ||
318 | } | ||
319 | |||
320 | /*set up workspace*/ | ||
321 | fs_mii_bitbang_init(bitbang, pdata); | ||
322 | |||
323 | new_bus->priv = bitbang; | ||
324 | |||
325 | new_bus->irq = pdata->irq; | ||
326 | |||
327 | new_bus->dev = dev; | ||
328 | dev_set_drvdata(dev, new_bus); | ||
329 | |||
330 | err = mdiobus_register(new_bus); | ||
331 | |||
332 | if (0 != err) { | ||
333 | printk (KERN_ERR "%s: Cannot register as MDIO bus\n", | ||
334 | new_bus->name); | ||
335 | goto bus_register_fail; | ||
336 | } | ||
337 | |||
338 | return 0; | ||
339 | |||
340 | bus_register_fail: | ||
341 | free_mdio_bitbang(new_bus); | ||
342 | kfree(bitbang); | ||
343 | |||
344 | return err; | ||
345 | } | ||
346 | |||
347 | static int fs_enet_mdio_remove(struct device *dev) | ||
348 | { | ||
349 | struct mii_bus *bus = dev_get_drvdata(dev); | ||
350 | |||
351 | mdiobus_unregister(bus); | ||
352 | |||
353 | dev_set_drvdata(dev, NULL); | ||
354 | |||
355 | free_mdio_bitbang(bus); | ||
356 | |||
357 | return 0; | ||
358 | } | ||
359 | |||
360 | static struct device_driver fs_enet_bb_mdio_driver = { | ||
361 | .name = "fsl-bb-mdio", | ||
362 | .bus = &platform_bus_type, | ||
363 | .probe = fs_enet_mdio_probe, | ||
364 | .remove = fs_enet_mdio_remove, | ||
365 | }; | ||
366 | |||
367 | int fs_enet_mdio_bb_init(void) | ||
368 | { | ||
369 | return driver_register(&fs_enet_bb_mdio_driver); | ||
370 | } | ||
371 | |||
372 | void fs_enet_mdio_bb_exit(void) | ||
373 | { | ||
374 | driver_unregister(&fs_enet_bb_mdio_driver); | ||
375 | } | ||
376 | #endif | ||
diff --git a/drivers/net/fs_enet/mii-fec.c b/drivers/net/fs_enet/mii-fec.c index 8f6a43b0e0ff..695f74cc4398 100644 --- a/drivers/net/fs_enet/mii-fec.c +++ b/drivers/net/fs_enet/mii-fec.c | |||
@@ -31,15 +31,12 @@ | |||
31 | #include <linux/ethtool.h> | 31 | #include <linux/ethtool.h> |
32 | #include <linux/bitops.h> | 32 | #include <linux/bitops.h> |
33 | #include <linux/platform_device.h> | 33 | #include <linux/platform_device.h> |
34 | #include <linux/of_platform.h> | ||
34 | 35 | ||
35 | #include <asm/pgtable.h> | 36 | #include <asm/pgtable.h> |
36 | #include <asm/irq.h> | 37 | #include <asm/irq.h> |
37 | #include <asm/uaccess.h> | 38 | #include <asm/uaccess.h> |
38 | 39 | ||
39 | #ifdef CONFIG_PPC_CPM_NEW_BINDING | ||
40 | #include <linux/of_platform.h> | ||
41 | #endif | ||
42 | |||
43 | #include "fs_enet.h" | 40 | #include "fs_enet.h" |
44 | #include "fec.h" | 41 | #include "fec.h" |
45 | 42 | ||
@@ -51,52 +48,6 @@ | |||
51 | 48 | ||
52 | #define FEC_MII_LOOPS 10000 | 49 | #define FEC_MII_LOOPS 10000 |
53 | 50 | ||
54 | #ifndef CONFIG_PPC_CPM_NEW_BINDING | ||
55 | static int match_has_phy (struct device *dev, void* data) | ||
56 | { | ||
57 | struct platform_device* pdev = container_of(dev, struct platform_device, dev); | ||
58 | struct fs_platform_info* fpi; | ||
59 | if(strcmp(pdev->name, (char*)data)) | ||
60 | { | ||
61 | return 0; | ||
62 | } | ||
63 | |||
64 | fpi = pdev->dev.platform_data; | ||
65 | if((fpi)&&(fpi->has_phy)) | ||
66 | return 1; | ||
67 | return 0; | ||
68 | } | ||
69 | |||
70 | static int fs_mii_fec_init(struct fec_info* fec, struct fs_mii_fec_platform_info *fmpi) | ||
71 | { | ||
72 | struct resource *r; | ||
73 | fec_t __iomem *fecp; | ||
74 | char* name = "fsl-cpm-fec"; | ||
75 | |||
76 | /* we need fec in order to be useful */ | ||
77 | struct platform_device *fec_pdev = | ||
78 | container_of(bus_find_device(&platform_bus_type, NULL, name, match_has_phy), | ||
79 | struct platform_device, dev); | ||
80 | |||
81 | if(fec_pdev == NULL) { | ||
82 | printk(KERN_ERR"Unable to find PHY for %s", name); | ||
83 | return -ENODEV; | ||
84 | } | ||
85 | |||
86 | r = platform_get_resource_byname(fec_pdev, IORESOURCE_MEM, "regs"); | ||
87 | |||
88 | fec->fecp = fecp = ioremap(r->start,sizeof(fec_t)); | ||
89 | fec->mii_speed = fmpi->mii_speed; | ||
90 | |||
91 | setbits32(&fecp->fec_r_cntrl, FEC_RCNTRL_MII_MODE); /* MII enable */ | ||
92 | setbits32(&fecp->fec_ecntrl, FEC_ECNTRL_PINMUX | FEC_ECNTRL_ETHER_EN); | ||
93 | out_be32(&fecp->fec_ievent, FEC_ENET_MII); | ||
94 | out_be32(&fecp->fec_mii_speed, fec->mii_speed); | ||
95 | |||
96 | return 0; | ||
97 | } | ||
98 | #endif | ||
99 | |||
100 | static int fs_enet_fec_mii_read(struct mii_bus *bus , int phy_id, int location) | 51 | static int fs_enet_fec_mii_read(struct mii_bus *bus , int phy_id, int location) |
101 | { | 52 | { |
102 | struct fec_info* fec = bus->priv; | 53 | struct fec_info* fec = bus->priv; |
@@ -151,7 +102,6 @@ static int fs_enet_fec_mii_reset(struct mii_bus *bus) | |||
151 | return 0; | 102 | return 0; |
152 | } | 103 | } |
153 | 104 | ||
154 | #ifdef CONFIG_PPC_CPM_NEW_BINDING | ||
155 | static void __devinit add_phy(struct mii_bus *bus, struct device_node *np) | 105 | static void __devinit add_phy(struct mii_bus *bus, struct device_node *np) |
156 | { | 106 | { |
157 | const u32 *data; | 107 | const u32 *data; |
@@ -286,95 +236,3 @@ static void fs_enet_mdio_fec_exit(void) | |||
286 | 236 | ||
287 | module_init(fs_enet_mdio_fec_init); | 237 | module_init(fs_enet_mdio_fec_init); |
288 | module_exit(fs_enet_mdio_fec_exit); | 238 | module_exit(fs_enet_mdio_fec_exit); |
289 | #else | ||
290 | static int __devinit fs_enet_fec_mdio_probe(struct device *dev) | ||
291 | { | ||
292 | struct platform_device *pdev = to_platform_device(dev); | ||
293 | struct fs_mii_fec_platform_info *pdata; | ||
294 | struct mii_bus *new_bus; | ||
295 | struct fec_info *fec; | ||
296 | int err = 0; | ||
297 | if (NULL == dev) | ||
298 | return -EINVAL; | ||
299 | new_bus = kzalloc(sizeof(struct mii_bus), GFP_KERNEL); | ||
300 | |||
301 | if (NULL == new_bus) | ||
302 | return -ENOMEM; | ||
303 | |||
304 | fec = kzalloc(sizeof(struct fec_info), GFP_KERNEL); | ||
305 | |||
306 | if (NULL == fec) | ||
307 | return -ENOMEM; | ||
308 | |||
309 | new_bus->name = "FEC MII Bus", | ||
310 | new_bus->read = &fs_enet_fec_mii_read, | ||
311 | new_bus->write = &fs_enet_fec_mii_write, | ||
312 | new_bus->reset = &fs_enet_fec_mii_reset, | ||
313 | snprintf(new_bus->id, MII_BUS_ID_SIZE, "%x", pdev->id); | ||
314 | |||
315 | pdata = (struct fs_mii_fec_platform_info *)pdev->dev.platform_data; | ||
316 | |||
317 | if (NULL == pdata) { | ||
318 | printk(KERN_ERR "fs_enet FEC mdio %d: Missing platform data!\n", pdev->id); | ||
319 | return -ENODEV; | ||
320 | } | ||
321 | |||
322 | /*set up workspace*/ | ||
323 | |||
324 | fs_mii_fec_init(fec, pdata); | ||
325 | new_bus->priv = fec; | ||
326 | |||
327 | new_bus->irq = pdata->irq; | ||
328 | |||
329 | new_bus->dev = dev; | ||
330 | dev_set_drvdata(dev, new_bus); | ||
331 | |||
332 | err = mdiobus_register(new_bus); | ||
333 | |||
334 | if (0 != err) { | ||
335 | printk (KERN_ERR "%s: Cannot register as MDIO bus\n", | ||
336 | new_bus->name); | ||
337 | goto bus_register_fail; | ||
338 | } | ||
339 | |||
340 | return 0; | ||
341 | |||
342 | bus_register_fail: | ||
343 | kfree(new_bus); | ||
344 | |||
345 | return err; | ||
346 | } | ||
347 | |||
348 | |||
349 | static int fs_enet_fec_mdio_remove(struct device *dev) | ||
350 | { | ||
351 | struct mii_bus *bus = dev_get_drvdata(dev); | ||
352 | |||
353 | mdiobus_unregister(bus); | ||
354 | |||
355 | dev_set_drvdata(dev, NULL); | ||
356 | kfree(bus->priv); | ||
357 | |||
358 | bus->priv = NULL; | ||
359 | kfree(bus); | ||
360 | |||
361 | return 0; | ||
362 | } | ||
363 | |||
364 | static struct device_driver fs_enet_fec_mdio_driver = { | ||
365 | .name = "fsl-cpm-fec-mdio", | ||
366 | .bus = &platform_bus_type, | ||
367 | .probe = fs_enet_fec_mdio_probe, | ||
368 | .remove = fs_enet_fec_mdio_remove, | ||
369 | }; | ||
370 | |||
371 | int fs_enet_mdio_fec_init(void) | ||
372 | { | ||
373 | return driver_register(&fs_enet_fec_mdio_driver); | ||
374 | } | ||
375 | |||
376 | void fs_enet_mdio_fec_exit(void) | ||
377 | { | ||
378 | driver_unregister(&fs_enet_fec_mdio_driver); | ||
379 | } | ||
380 | #endif | ||
diff --git a/include/linux/fs_enet_pd.h b/include/linux/fs_enet_pd.h index 9bc045b8c478..0ba21ee0f58c 100644 --- a/include/linux/fs_enet_pd.h +++ b/include/linux/fs_enet_pd.h | |||
@@ -135,11 +135,7 @@ struct fs_platform_info { | |||
135 | u32 device_flags; | 135 | u32 device_flags; |
136 | 136 | ||
137 | int phy_addr; /* the phy address (-1 no phy) */ | 137 | int phy_addr; /* the phy address (-1 no phy) */ |
138 | #ifdef CONFIG_PPC_CPM_NEW_BINDING | ||
139 | char bus_id[16]; | 138 | char bus_id[16]; |
140 | #else | ||
141 | const char* bus_id; | ||
142 | #endif | ||
143 | int phy_irq; /* the phy irq (if it exists) */ | 139 | int phy_irq; /* the phy irq (if it exists) */ |
144 | 140 | ||
145 | const struct fs_mii_bus_info *bus_info; | 141 | const struct fs_mii_bus_info *bus_info; |