diff options
author | Kumar Gala <galak@kernel.crashing.org> | 2008-06-12 09:32:13 -0400 |
---|---|---|
committer | Kumar Gala <galak@kernel.crashing.org> | 2008-07-16 18:57:49 -0400 |
commit | b219108cbacee5f2eaeca63cba013688eeba3bd4 (patch) | |
tree | 656039a1d7a4db0605562c5290056a21d98865be /drivers/net/fs_enet/fs_enet-main.c | |
parent | 00262986ceeb5c3358b70491aa898906503a0fe7 (diff) |
fs_enet: Remove !CONFIG_PPC_CPM_NEW_BINDING code
Now that arch/ppc is gone we always define CONFIG_PPC_CPM_NEW_BINDING so
we can remove all the code associated with !CONFIG_PPC_CPM_NEW_BINDING.
Also fixed some asm/of_platform.h to linux/of_platform.h (and of_device.h)
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'drivers/net/fs_enet/fs_enet-main.c')
-rw-r--r-- | drivers/net/fs_enet/fs_enet-main.c | 310 |
1 files changed, 1 insertions, 309 deletions
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) |