diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-22 16:16:01 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-22 16:16:01 -0400 |
commit | 06b8147c5dbd385b5b97ca74e19f6f3951ebc1cb (patch) | |
tree | 6ed9de7ca0ab3a65af6a189a89deb0a36ab35f6b /drivers | |
parent | 53baaaa9682c230410a057263d1ce2922f43ddc4 (diff) | |
parent | 8725f25acc656c1522d48a6746055099efdaca4c (diff) |
Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc
* 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc: (49 commits)
powerpc: Fix build bug with binutils < 2.18 and GCC < 4.2
powerpc/eeh: Don't panic when EEH_MAX_FAILS is exceeded
fbdev: Teaches offb about palette on radeon r5xx/r6xx
powerpc/cell/edac: Log a syndrome code in case of correctable error
powerpc/cell: Add DMA_ATTR_WEAK_ORDERING dma attribute and use in Cell IOMMU code
powerpc: Indicate which oprofile counters to use while in compat mode
powerpc/boot: Change spaces to tabs
powerpc: Remove duplicate 6xx option in Kconfig
powerpc: Use PPC_LONG and PPC_LONG_ALIGN in lib/string.S
powerpc: Use PPC_LONG_ALIGN in uaccess.h
powerpc: Add a #define for aligning to a long-sized boundary
powerpc: Fix OF parsing of 64 bits PCI addresses
powerpc: Use WARN_ON(1) instead of __WARN()
powerpc: Fix support for latencytop
powerpc/ps3: Update ps3_defconfig
powerpc/ps3: Add a sub-match id to ps3_system_bus
powerpc: Add a 6xx defconfig
powerpc/dma: Use the struct dma_attrs in iommu code
powerpc/cell: Add support for power button of future IBM cell blades
powerpc/cell: Cleanup sysreset_hack for IBM cell blades
...
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/edac/cell_edac.c | 5 | ||||
-rw-r--r-- | drivers/net/fs_enet/Makefile | 5 | ||||
-rw-r--r-- | drivers/net/fs_enet/fs_enet-main.c | 312 | ||||
-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-- | drivers/net/gianfar.c | 122 | ||||
-rw-r--r-- | drivers/net/gianfar.h | 12 | ||||
-rw-r--r-- | drivers/net/gianfar_ethtool.c | 41 | ||||
-rw-r--r-- | drivers/video/offb.c | 192 | ||||
-rw-r--r-- | drivers/video/ps3fb.c | 1 |
14 files changed, 321 insertions, 751 deletions
diff --git a/drivers/edac/cell_edac.c b/drivers/edac/cell_edac.c index b54112ffd282..0e024fe2d8c4 100644 --- a/drivers/edac/cell_edac.c +++ b/drivers/edac/cell_edac.c | |||
@@ -33,7 +33,7 @@ static void cell_edac_count_ce(struct mem_ctl_info *mci, int chan, u64 ar) | |||
33 | { | 33 | { |
34 | struct cell_edac_priv *priv = mci->pvt_info; | 34 | struct cell_edac_priv *priv = mci->pvt_info; |
35 | struct csrow_info *csrow = &mci->csrows[0]; | 35 | struct csrow_info *csrow = &mci->csrows[0]; |
36 | unsigned long address, pfn, offset; | 36 | unsigned long address, pfn, offset, syndrome; |
37 | 37 | ||
38 | dev_dbg(mci->dev, "ECC CE err on node %d, channel %d, ar = 0x%016lx\n", | 38 | dev_dbg(mci->dev, "ECC CE err on node %d, channel %d, ar = 0x%016lx\n", |
39 | priv->node, chan, ar); | 39 | priv->node, chan, ar); |
@@ -44,10 +44,11 @@ static void cell_edac_count_ce(struct mem_ctl_info *mci, int chan, u64 ar) | |||
44 | address = (address << 1) | chan; | 44 | address = (address << 1) | chan; |
45 | pfn = address >> PAGE_SHIFT; | 45 | pfn = address >> PAGE_SHIFT; |
46 | offset = address & ~PAGE_MASK; | 46 | offset = address & ~PAGE_MASK; |
47 | syndrome = (ar & 0x000000001fe00000ul) >> 21; | ||
47 | 48 | ||
48 | /* TODO: Decoding of the error addresss */ | 49 | /* TODO: Decoding of the error addresss */ |
49 | edac_mc_handle_ce(mci, csrow->first_page + pfn, offset, | 50 | edac_mc_handle_ce(mci, csrow->first_page + pfn, offset, |
50 | 0, 0, chan, ""); | 51 | syndrome, 0, chan, ""); |
51 | } | 52 | } |
52 | 53 | ||
53 | static void cell_edac_count_ue(struct mem_ctl_info *mci, int chan, u64 ar) | 54 | static void cell_edac_count_ue(struct mem_ctl_info *mci, int chan, u64 ar) |
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 445763e5648e..92591384afa5 100644 --- a/drivers/net/fs_enet/fs_enet-main.c +++ b/drivers/net/fs_enet/fs_enet-main.c | |||
@@ -36,26 +36,18 @@ | |||
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> | ||
40 | #include <linux/of_gpio.h> | ||
39 | 41 | ||
40 | #include <linux/vmalloc.h> | 42 | #include <linux/vmalloc.h> |
41 | #include <asm/pgtable.h> | 43 | #include <asm/pgtable.h> |
42 | #include <asm/irq.h> | 44 | #include <asm/irq.h> |
43 | #include <asm/uaccess.h> | 45 | #include <asm/uaccess.h> |
44 | 46 | ||
45 | #ifdef CONFIG_PPC_CPM_NEW_BINDING | ||
46 | #include <linux/of_gpio.h> | ||
47 | #include <linux/of_platform.h> | ||
48 | #endif | ||
49 | |||
50 | #include "fs_enet.h" | 47 | #include "fs_enet.h" |
51 | 48 | ||
52 | /*************************************************/ | 49 | /*************************************************/ |
53 | 50 | ||
54 | #ifndef CONFIG_PPC_CPM_NEW_BINDING | ||
55 | static char version[] __devinitdata = | ||
56 | DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")" "\n"; | ||
57 | #endif | ||
58 | |||
59 | MODULE_AUTHOR("Pantelis Antoniou <panto@intracom.gr>"); | 51 | MODULE_AUTHOR("Pantelis Antoniou <panto@intracom.gr>"); |
60 | MODULE_DESCRIPTION("Freescale Ethernet Driver"); | 52 | MODULE_DESCRIPTION("Freescale Ethernet Driver"); |
61 | MODULE_LICENSE("GPL"); | 53 | MODULE_LICENSE("GPL"); |
@@ -958,190 +950,6 @@ static int fs_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | |||
958 | extern int fs_mii_connect(struct net_device *dev); | 950 | extern int fs_mii_connect(struct net_device *dev); |
959 | extern void fs_mii_disconnect(struct net_device *dev); | 951 | extern void fs_mii_disconnect(struct net_device *dev); |
960 | 952 | ||
961 | #ifndef CONFIG_PPC_CPM_NEW_BINDING | ||
962 | static struct net_device *fs_init_instance(struct device *dev, | ||
963 | struct fs_platform_info *fpi) | ||
964 | { | ||
965 | struct net_device *ndev = NULL; | ||
966 | struct fs_enet_private *fep = NULL; | ||
967 | int privsize, i, r, err = 0, registered = 0; | ||
968 | |||
969 | fpi->fs_no = fs_get_id(fpi); | ||
970 | /* guard */ | ||
971 | if ((unsigned int)fpi->fs_no >= FS_MAX_INDEX) | ||
972 | return ERR_PTR(-EINVAL); | ||
973 | |||
974 | privsize = sizeof(*fep) + (sizeof(struct sk_buff **) * | ||
975 | (fpi->rx_ring + fpi->tx_ring)); | ||
976 | |||
977 | ndev = alloc_etherdev(privsize); | ||
978 | if (!ndev) { | ||
979 | err = -ENOMEM; | ||
980 | goto err; | ||
981 | } | ||
982 | |||
983 | fep = netdev_priv(ndev); | ||
984 | |||
985 | fep->dev = dev; | ||
986 | dev_set_drvdata(dev, ndev); | ||
987 | fep->fpi = fpi; | ||
988 | if (fpi->init_ioports) | ||
989 | fpi->init_ioports((struct fs_platform_info *)fpi); | ||
990 | |||
991 | #ifdef CONFIG_FS_ENET_HAS_FEC | ||
992 | if (fs_get_fec_index(fpi->fs_no) >= 0) | ||
993 | fep->ops = &fs_fec_ops; | ||
994 | #endif | ||
995 | |||
996 | #ifdef CONFIG_FS_ENET_HAS_SCC | ||
997 | if (fs_get_scc_index(fpi->fs_no) >=0) | ||
998 | fep->ops = &fs_scc_ops; | ||
999 | #endif | ||
1000 | |||
1001 | #ifdef CONFIG_FS_ENET_HAS_FCC | ||
1002 | if (fs_get_fcc_index(fpi->fs_no) >= 0) | ||
1003 | fep->ops = &fs_fcc_ops; | ||
1004 | #endif | ||
1005 | |||
1006 | if (fep->ops == NULL) { | ||
1007 | printk(KERN_ERR DRV_MODULE_NAME | ||
1008 | ": %s No matching ops found (%d).\n", | ||
1009 | ndev->name, fpi->fs_no); | ||
1010 | err = -EINVAL; | ||
1011 | goto err; | ||
1012 | } | ||
1013 | |||
1014 | r = (*fep->ops->setup_data)(ndev); | ||
1015 | if (r != 0) { | ||
1016 | printk(KERN_ERR DRV_MODULE_NAME | ||
1017 | ": %s setup_data failed\n", | ||
1018 | ndev->name); | ||
1019 | err = r; | ||
1020 | goto err; | ||
1021 | } | ||
1022 | |||
1023 | /* point rx_skbuff, tx_skbuff */ | ||
1024 | fep->rx_skbuff = (struct sk_buff **)&fep[1]; | ||
1025 | fep->tx_skbuff = fep->rx_skbuff + fpi->rx_ring; | ||
1026 | |||
1027 | /* init locks */ | ||
1028 | spin_lock_init(&fep->lock); | ||
1029 | spin_lock_init(&fep->tx_lock); | ||
1030 | |||
1031 | /* | ||
1032 | * Set the Ethernet address. | ||
1033 | */ | ||
1034 | for (i = 0; i < 6; i++) | ||
1035 | ndev->dev_addr[i] = fpi->macaddr[i]; | ||
1036 | |||
1037 | r = (*fep->ops->allocate_bd)(ndev); | ||
1038 | |||
1039 | if (fep->ring_base == NULL) { | ||
1040 | printk(KERN_ERR DRV_MODULE_NAME | ||
1041 | ": %s buffer descriptor alloc failed (%d).\n", ndev->name, r); | ||
1042 | err = r; | ||
1043 | goto err; | ||
1044 | } | ||
1045 | |||
1046 | /* | ||
1047 | * Set receive and transmit descriptor base. | ||
1048 | */ | ||
1049 | fep->rx_bd_base = fep->ring_base; | ||
1050 | fep->tx_bd_base = fep->rx_bd_base + fpi->rx_ring; | ||
1051 | |||
1052 | /* initialize ring size variables */ | ||
1053 | fep->tx_ring = fpi->tx_ring; | ||
1054 | fep->rx_ring = fpi->rx_ring; | ||
1055 | |||
1056 | /* | ||
1057 | * The FEC Ethernet specific entries in the device structure. | ||
1058 | */ | ||
1059 | ndev->open = fs_enet_open; | ||
1060 | ndev->hard_start_xmit = fs_enet_start_xmit; | ||
1061 | ndev->tx_timeout = fs_timeout; | ||
1062 | ndev->watchdog_timeo = 2 * HZ; | ||
1063 | ndev->stop = fs_enet_close; | ||
1064 | ndev->get_stats = fs_enet_get_stats; | ||
1065 | ndev->set_multicast_list = fs_set_multicast_list; | ||
1066 | |||
1067 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
1068 | ndev->poll_controller = fs_enet_netpoll; | ||
1069 | #endif | ||
1070 | |||
1071 | netif_napi_add(ndev, &fep->napi, | ||
1072 | fs_enet_rx_napi, fpi->napi_weight); | ||
1073 | |||
1074 | ndev->ethtool_ops = &fs_ethtool_ops; | ||
1075 | ndev->do_ioctl = fs_ioctl; | ||
1076 | |||
1077 | init_timer(&fep->phy_timer_list); | ||
1078 | |||
1079 | netif_carrier_off(ndev); | ||
1080 | |||
1081 | err = register_netdev(ndev); | ||
1082 | if (err != 0) { | ||
1083 | printk(KERN_ERR DRV_MODULE_NAME | ||
1084 | ": %s register_netdev failed.\n", ndev->name); | ||
1085 | goto err; | ||
1086 | } | ||
1087 | registered = 1; | ||
1088 | |||
1089 | |||
1090 | return ndev; | ||
1091 | |||
1092 | err: | ||
1093 | if (ndev != NULL) { | ||
1094 | if (registered) | ||
1095 | unregister_netdev(ndev); | ||
1096 | |||
1097 | if (fep && fep->ops) { | ||
1098 | (*fep->ops->free_bd)(ndev); | ||
1099 | (*fep->ops->cleanup_data)(ndev); | ||
1100 | } | ||
1101 | |||
1102 | free_netdev(ndev); | ||
1103 | } | ||
1104 | |||
1105 | dev_set_drvdata(dev, NULL); | ||
1106 | |||
1107 | return ERR_PTR(err); | ||
1108 | } | ||
1109 | |||
1110 | static int fs_cleanup_instance(struct net_device *ndev) | ||
1111 | { | ||
1112 | struct fs_enet_private *fep; | ||
1113 | const struct fs_platform_info *fpi; | ||
1114 | struct device *dev; | ||
1115 | |||
1116 | if (ndev == NULL) | ||
1117 | return -EINVAL; | ||
1118 | |||
1119 | fep = netdev_priv(ndev); | ||
1120 | if (fep == NULL) | ||
1121 | return -EINVAL; | ||
1122 | |||
1123 | fpi = fep->fpi; | ||
1124 | |||
1125 | unregister_netdev(ndev); | ||
1126 | |||
1127 | dma_free_coherent(fep->dev, (fpi->tx_ring + fpi->rx_ring) * sizeof(cbd_t), | ||
1128 | (void __force *)fep->ring_base, fep->ring_mem_addr); | ||
1129 | |||
1130 | /* reset it */ | ||
1131 | (*fep->ops->cleanup_data)(ndev); | ||
1132 | |||
1133 | dev = fep->dev; | ||
1134 | if (dev != NULL) { | ||
1135 | dev_set_drvdata(dev, NULL); | ||
1136 | fep->dev = NULL; | ||
1137 | } | ||
1138 | |||
1139 | free_netdev(ndev); | ||
1140 | |||
1141 | return 0; | ||
1142 | } | ||
1143 | #endif | ||
1144 | |||
1145 | /**************************************************************************************/ | 953 | /**************************************************************************************/ |
1146 | 954 | ||
1147 | /* handy pointer to the immap */ | 955 | /* handy pointer to the immap */ |
@@ -1168,7 +976,6 @@ static void cleanup_immap(void) | |||
1168 | 976 | ||
1169 | /**************************************************************************************/ | 977 | /**************************************************************************************/ |
1170 | 978 | ||
1171 | #ifdef CONFIG_PPC_CPM_NEW_BINDING | ||
1172 | static int __devinit find_phy(struct device_node *np, | 979 | static int __devinit find_phy(struct device_node *np, |
1173 | struct fs_platform_info *fpi) | 980 | struct fs_platform_info *fpi) |
1174 | { | 981 | { |
@@ -1408,121 +1215,6 @@ static void __exit fs_cleanup(void) | |||
1408 | of_unregister_platform_driver(&fs_enet_driver); | 1215 | of_unregister_platform_driver(&fs_enet_driver); |
1409 | cleanup_immap(); | 1216 | cleanup_immap(); |
1410 | } | 1217 | } |
1411 | #else | ||
1412 | static int __devinit fs_enet_probe(struct device *dev) | ||
1413 | { | ||
1414 | struct net_device *ndev; | ||
1415 | |||
1416 | /* no fixup - no device */ | ||
1417 | if (dev->platform_data == NULL) { | ||
1418 | printk(KERN_INFO "fs_enet: " | ||
1419 | "probe called with no platform data; " | ||
1420 | "remove unused devices\n"); | ||
1421 | return -ENODEV; | ||
1422 | } | ||
1423 | |||
1424 | ndev = fs_init_instance(dev, dev->platform_data); | ||
1425 | if (IS_ERR(ndev)) | ||
1426 | return PTR_ERR(ndev); | ||
1427 | return 0; | ||
1428 | } | ||
1429 | |||
1430 | static int fs_enet_remove(struct device *dev) | ||
1431 | { | ||
1432 | return fs_cleanup_instance(dev_get_drvdata(dev)); | ||
1433 | } | ||
1434 | |||
1435 | static struct device_driver fs_enet_fec_driver = { | ||
1436 | .name = "fsl-cpm-fec", | ||
1437 | .bus = &platform_bus_type, | ||
1438 | .probe = fs_enet_probe, | ||
1439 | .remove = fs_enet_remove, | ||
1440 | #ifdef CONFIG_PM | ||
1441 | /* .suspend = fs_enet_suspend, TODO */ | ||
1442 | /* .resume = fs_enet_resume, TODO */ | ||
1443 | #endif | ||
1444 | }; | ||
1445 | |||
1446 | static struct device_driver fs_enet_scc_driver = { | ||
1447 | .name = "fsl-cpm-scc", | ||
1448 | .bus = &platform_bus_type, | ||
1449 | .probe = fs_enet_probe, | ||
1450 | .remove = fs_enet_remove, | ||
1451 | #ifdef CONFIG_PM | ||
1452 | /* .suspend = fs_enet_suspend, TODO */ | ||
1453 | /* .resume = fs_enet_resume, TODO */ | ||
1454 | #endif | ||
1455 | }; | ||
1456 | |||
1457 | static struct device_driver fs_enet_fcc_driver = { | ||
1458 | .name = "fsl-cpm-fcc", | ||
1459 | .bus = &platform_bus_type, | ||
1460 | .probe = fs_enet_probe, | ||
1461 | .remove = fs_enet_remove, | ||
1462 | #ifdef CONFIG_PM | ||
1463 | /* .suspend = fs_enet_suspend, TODO */ | ||
1464 | /* .resume = fs_enet_resume, TODO */ | ||
1465 | #endif | ||
1466 | }; | ||
1467 | |||
1468 | static int __init fs_init(void) | ||
1469 | { | ||
1470 | int r; | ||
1471 | |||
1472 | printk(KERN_INFO | ||
1473 | "%s", version); | ||
1474 | |||
1475 | r = setup_immap(); | ||
1476 | if (r != 0) | ||
1477 | return r; | ||
1478 | |||
1479 | #ifdef CONFIG_FS_ENET_HAS_FCC | ||
1480 | /* let's insert mii stuff */ | ||
1481 | r = fs_enet_mdio_bb_init(); | ||
1482 | |||
1483 | if (r != 0) { | ||
1484 | printk(KERN_ERR DRV_MODULE_NAME | ||
1485 | "BB PHY init failed.\n"); | ||
1486 | return r; | ||
1487 | } | ||
1488 | r = driver_register(&fs_enet_fcc_driver); | ||
1489 | if (r != 0) | ||
1490 | goto err; | ||
1491 | #endif | ||
1492 | |||
1493 | #ifdef CONFIG_FS_ENET_HAS_FEC | ||
1494 | r = fs_enet_mdio_fec_init(); | ||
1495 | if (r != 0) { | ||
1496 | printk(KERN_ERR DRV_MODULE_NAME | ||
1497 | "FEC PHY init failed.\n"); | ||
1498 | return r; | ||
1499 | } | ||
1500 | |||
1501 | r = driver_register(&fs_enet_fec_driver); | ||
1502 | if (r != 0) | ||
1503 | goto err; | ||
1504 | #endif | ||
1505 | |||
1506 | #ifdef CONFIG_FS_ENET_HAS_SCC | ||
1507 | r = driver_register(&fs_enet_scc_driver); | ||
1508 | if (r != 0) | ||
1509 | goto err; | ||
1510 | #endif | ||
1511 | |||
1512 | return 0; | ||
1513 | err: | ||
1514 | cleanup_immap(); | ||
1515 | return r; | ||
1516 | } | ||
1517 | |||
1518 | static void __exit fs_cleanup(void) | ||
1519 | { | ||
1520 | driver_unregister(&fs_enet_fec_driver); | ||
1521 | driver_unregister(&fs_enet_fcc_driver); | ||
1522 | driver_unregister(&fs_enet_scc_driver); | ||
1523 | cleanup_immap(); | ||
1524 | } | ||
1525 | #endif | ||
1526 | 1218 | ||
1527 | #ifdef CONFIG_NET_POLL_CONTROLLER | 1219 | #ifdef CONFIG_NET_POLL_CONTROLLER |
1528 | static void fs_enet_netpoll(struct net_device *dev) | 1220 | 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/drivers/net/gianfar.c b/drivers/net/gianfar.c index 39b45e901be6..b8394cf134e8 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c | |||
@@ -134,6 +134,9 @@ static int gfar_process_frame(struct net_device *dev, struct sk_buff *skb, int l | |||
134 | static void gfar_vlan_rx_register(struct net_device *netdev, | 134 | static void gfar_vlan_rx_register(struct net_device *netdev, |
135 | struct vlan_group *grp); | 135 | struct vlan_group *grp); |
136 | void gfar_halt(struct net_device *dev); | 136 | void gfar_halt(struct net_device *dev); |
137 | #ifdef CONFIG_PM | ||
138 | static void gfar_halt_nodisable(struct net_device *dev); | ||
139 | #endif | ||
137 | void gfar_start(struct net_device *dev); | 140 | void gfar_start(struct net_device *dev); |
138 | static void gfar_clear_exact_match(struct net_device *dev); | 141 | static void gfar_clear_exact_match(struct net_device *dev); |
139 | static void gfar_set_mac_for_addr(struct net_device *dev, int num, u8 *addr); | 142 | static void gfar_set_mac_for_addr(struct net_device *dev, int num, u8 *addr); |
@@ -207,6 +210,7 @@ static int gfar_probe(struct platform_device *pdev) | |||
207 | 210 | ||
208 | spin_lock_init(&priv->txlock); | 211 | spin_lock_init(&priv->txlock); |
209 | spin_lock_init(&priv->rxlock); | 212 | spin_lock_init(&priv->rxlock); |
213 | spin_lock_init(&priv->bflock); | ||
210 | 214 | ||
211 | platform_set_drvdata(pdev, dev); | 215 | platform_set_drvdata(pdev, dev); |
212 | 216 | ||
@@ -378,6 +382,103 @@ static int gfar_remove(struct platform_device *pdev) | |||
378 | return 0; | 382 | return 0; |
379 | } | 383 | } |
380 | 384 | ||
385 | #ifdef CONFIG_PM | ||
386 | static int gfar_suspend(struct platform_device *pdev, pm_message_t state) | ||
387 | { | ||
388 | struct net_device *dev = platform_get_drvdata(pdev); | ||
389 | struct gfar_private *priv = netdev_priv(dev); | ||
390 | unsigned long flags; | ||
391 | u32 tempval; | ||
392 | |||
393 | int magic_packet = priv->wol_en && | ||
394 | (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_MAGIC_PACKET); | ||
395 | |||
396 | netif_device_detach(dev); | ||
397 | |||
398 | if (netif_running(dev)) { | ||
399 | spin_lock_irqsave(&priv->txlock, flags); | ||
400 | spin_lock(&priv->rxlock); | ||
401 | |||
402 | gfar_halt_nodisable(dev); | ||
403 | |||
404 | /* Disable Tx, and Rx if wake-on-LAN is disabled. */ | ||
405 | tempval = gfar_read(&priv->regs->maccfg1); | ||
406 | |||
407 | tempval &= ~MACCFG1_TX_EN; | ||
408 | |||
409 | if (!magic_packet) | ||
410 | tempval &= ~MACCFG1_RX_EN; | ||
411 | |||
412 | gfar_write(&priv->regs->maccfg1, tempval); | ||
413 | |||
414 | spin_unlock(&priv->rxlock); | ||
415 | spin_unlock_irqrestore(&priv->txlock, flags); | ||
416 | |||
417 | #ifdef CONFIG_GFAR_NAPI | ||
418 | napi_disable(&priv->napi); | ||
419 | #endif | ||
420 | |||
421 | if (magic_packet) { | ||
422 | /* Enable interrupt on Magic Packet */ | ||
423 | gfar_write(&priv->regs->imask, IMASK_MAG); | ||
424 | |||
425 | /* Enable Magic Packet mode */ | ||
426 | tempval = gfar_read(&priv->regs->maccfg2); | ||
427 | tempval |= MACCFG2_MPEN; | ||
428 | gfar_write(&priv->regs->maccfg2, tempval); | ||
429 | } else { | ||
430 | phy_stop(priv->phydev); | ||
431 | } | ||
432 | } | ||
433 | |||
434 | return 0; | ||
435 | } | ||
436 | |||
437 | static int gfar_resume(struct platform_device *pdev) | ||
438 | { | ||
439 | struct net_device *dev = platform_get_drvdata(pdev); | ||
440 | struct gfar_private *priv = netdev_priv(dev); | ||
441 | unsigned long flags; | ||
442 | u32 tempval; | ||
443 | int magic_packet = priv->wol_en && | ||
444 | (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_MAGIC_PACKET); | ||
445 | |||
446 | if (!netif_running(dev)) { | ||
447 | netif_device_attach(dev); | ||
448 | return 0; | ||
449 | } | ||
450 | |||
451 | if (!magic_packet && priv->phydev) | ||
452 | phy_start(priv->phydev); | ||
453 | |||
454 | /* Disable Magic Packet mode, in case something | ||
455 | * else woke us up. | ||
456 | */ | ||
457 | |||
458 | spin_lock_irqsave(&priv->txlock, flags); | ||
459 | spin_lock(&priv->rxlock); | ||
460 | |||
461 | tempval = gfar_read(&priv->regs->maccfg2); | ||
462 | tempval &= ~MACCFG2_MPEN; | ||
463 | gfar_write(&priv->regs->maccfg2, tempval); | ||
464 | |||
465 | gfar_start(dev); | ||
466 | |||
467 | spin_unlock(&priv->rxlock); | ||
468 | spin_unlock_irqrestore(&priv->txlock, flags); | ||
469 | |||
470 | netif_device_attach(dev); | ||
471 | |||
472 | #ifdef CONFIG_GFAR_NAPI | ||
473 | napi_enable(&priv->napi); | ||
474 | #endif | ||
475 | |||
476 | return 0; | ||
477 | } | ||
478 | #else | ||
479 | #define gfar_suspend NULL | ||
480 | #define gfar_resume NULL | ||
481 | #endif | ||
381 | 482 | ||
382 | /* Reads the controller's registers to determine what interface | 483 | /* Reads the controller's registers to determine what interface |
383 | * connects it to the PHY. | 484 | * connects it to the PHY. |
@@ -534,8 +635,9 @@ static void init_registers(struct net_device *dev) | |||
534 | } | 635 | } |
535 | 636 | ||
536 | 637 | ||
638 | #ifdef CONFIG_PM | ||
537 | /* Halt the receive and transmit queues */ | 639 | /* Halt the receive and transmit queues */ |
538 | void gfar_halt(struct net_device *dev) | 640 | static void gfar_halt_nodisable(struct net_device *dev) |
539 | { | 641 | { |
540 | struct gfar_private *priv = netdev_priv(dev); | 642 | struct gfar_private *priv = netdev_priv(dev); |
541 | struct gfar __iomem *regs = priv->regs; | 643 | struct gfar __iomem *regs = priv->regs; |
@@ -558,6 +660,15 @@ void gfar_halt(struct net_device *dev) | |||
558 | (IEVENT_GRSC | IEVENT_GTSC))) | 660 | (IEVENT_GRSC | IEVENT_GTSC))) |
559 | cpu_relax(); | 661 | cpu_relax(); |
560 | } | 662 | } |
663 | } | ||
664 | #endif | ||
665 | |||
666 | /* Halt the receive and transmit queues */ | ||
667 | void gfar_halt(struct net_device *dev) | ||
668 | { | ||
669 | struct gfar_private *priv = netdev_priv(dev); | ||
670 | struct gfar __iomem *regs = priv->regs; | ||
671 | u32 tempval; | ||
561 | 672 | ||
562 | /* Disable Rx and Tx */ | 673 | /* Disable Rx and Tx */ |
563 | tempval = gfar_read(®s->maccfg1); | 674 | tempval = gfar_read(®s->maccfg1); |
@@ -1909,7 +2020,12 @@ static irqreturn_t gfar_error(int irq, void *dev_id) | |||
1909 | u32 events = gfar_read(&priv->regs->ievent); | 2020 | u32 events = gfar_read(&priv->regs->ievent); |
1910 | 2021 | ||
1911 | /* Clear IEVENT */ | 2022 | /* Clear IEVENT */ |
1912 | gfar_write(&priv->regs->ievent, IEVENT_ERR_MASK); | 2023 | gfar_write(&priv->regs->ievent, events & IEVENT_ERR_MASK); |
2024 | |||
2025 | /* Magic Packet is not an error. */ | ||
2026 | if ((priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_MAGIC_PACKET) && | ||
2027 | (events & IEVENT_MAG)) | ||
2028 | events &= ~IEVENT_MAG; | ||
1913 | 2029 | ||
1914 | /* Hmm... */ | 2030 | /* Hmm... */ |
1915 | if (netif_msg_rx_err(priv) || netif_msg_tx_err(priv)) | 2031 | if (netif_msg_rx_err(priv) || netif_msg_tx_err(priv)) |
@@ -1977,6 +2093,8 @@ MODULE_ALIAS("platform:fsl-gianfar"); | |||
1977 | static struct platform_driver gfar_driver = { | 2093 | static struct platform_driver gfar_driver = { |
1978 | .probe = gfar_probe, | 2094 | .probe = gfar_probe, |
1979 | .remove = gfar_remove, | 2095 | .remove = gfar_remove, |
2096 | .suspend = gfar_suspend, | ||
2097 | .resume = gfar_resume, | ||
1980 | .driver = { | 2098 | .driver = { |
1981 | .name = "fsl-gianfar", | 2099 | .name = "fsl-gianfar", |
1982 | .owner = THIS_MODULE, | 2100 | .owner = THIS_MODULE, |
diff --git a/drivers/net/gianfar.h b/drivers/net/gianfar.h index bead71cb2b16..d59df98bd636 100644 --- a/drivers/net/gianfar.h +++ b/drivers/net/gianfar.h | |||
@@ -157,6 +157,7 @@ extern const char gfar_driver_version[]; | |||
157 | #define MACCFG2_GMII 0x00000200 | 157 | #define MACCFG2_GMII 0x00000200 |
158 | #define MACCFG2_HUGEFRAME 0x00000020 | 158 | #define MACCFG2_HUGEFRAME 0x00000020 |
159 | #define MACCFG2_LENGTHCHECK 0x00000010 | 159 | #define MACCFG2_LENGTHCHECK 0x00000010 |
160 | #define MACCFG2_MPEN 0x00000008 | ||
160 | 161 | ||
161 | #define ECNTRL_INIT_SETTINGS 0x00001000 | 162 | #define ECNTRL_INIT_SETTINGS 0x00001000 |
162 | #define ECNTRL_TBI_MODE 0x00000020 | 163 | #define ECNTRL_TBI_MODE 0x00000020 |
@@ -229,6 +230,7 @@ extern const char gfar_driver_version[]; | |||
229 | #define IEVENT_CRL 0x00020000 | 230 | #define IEVENT_CRL 0x00020000 |
230 | #define IEVENT_XFUN 0x00010000 | 231 | #define IEVENT_XFUN 0x00010000 |
231 | #define IEVENT_RXB0 0x00008000 | 232 | #define IEVENT_RXB0 0x00008000 |
233 | #define IEVENT_MAG 0x00000800 | ||
232 | #define IEVENT_GRSC 0x00000100 | 234 | #define IEVENT_GRSC 0x00000100 |
233 | #define IEVENT_RXF0 0x00000080 | 235 | #define IEVENT_RXF0 0x00000080 |
234 | #define IEVENT_FIR 0x00000008 | 236 | #define IEVENT_FIR 0x00000008 |
@@ -241,7 +243,8 @@ extern const char gfar_driver_version[]; | |||
241 | #define IEVENT_ERR_MASK \ | 243 | #define IEVENT_ERR_MASK \ |
242 | (IEVENT_RXC | IEVENT_BSY | IEVENT_EBERR | IEVENT_MSRO | \ | 244 | (IEVENT_RXC | IEVENT_BSY | IEVENT_EBERR | IEVENT_MSRO | \ |
243 | IEVENT_BABT | IEVENT_TXC | IEVENT_TXE | IEVENT_LC \ | 245 | IEVENT_BABT | IEVENT_TXC | IEVENT_TXE | IEVENT_LC \ |
244 | | IEVENT_CRL | IEVENT_XFUN | IEVENT_DPE | IEVENT_PERR) | 246 | | IEVENT_CRL | IEVENT_XFUN | IEVENT_DPE | IEVENT_PERR \ |
247 | | IEVENT_MAG) | ||
245 | 248 | ||
246 | #define IMASK_INIT_CLEAR 0x00000000 | 249 | #define IMASK_INIT_CLEAR 0x00000000 |
247 | #define IMASK_BABR 0x80000000 | 250 | #define IMASK_BABR 0x80000000 |
@@ -259,6 +262,7 @@ extern const char gfar_driver_version[]; | |||
259 | #define IMASK_CRL 0x00020000 | 262 | #define IMASK_CRL 0x00020000 |
260 | #define IMASK_XFUN 0x00010000 | 263 | #define IMASK_XFUN 0x00010000 |
261 | #define IMASK_RXB0 0x00008000 | 264 | #define IMASK_RXB0 0x00008000 |
265 | #define IMASK_MAG 0x00000800 | ||
262 | #define IMASK_GTSC 0x00000100 | 266 | #define IMASK_GTSC 0x00000100 |
263 | #define IMASK_RXFEN0 0x00000080 | 267 | #define IMASK_RXFEN0 0x00000080 |
264 | #define IMASK_FIR 0x00000008 | 268 | #define IMASK_FIR 0x00000008 |
@@ -726,10 +730,14 @@ struct gfar_private { | |||
726 | unsigned int fifo_starve; | 730 | unsigned int fifo_starve; |
727 | unsigned int fifo_starve_off; | 731 | unsigned int fifo_starve_off; |
728 | 732 | ||
733 | /* Bitfield update lock */ | ||
734 | spinlock_t bflock; | ||
735 | |||
729 | unsigned char vlan_enable:1, | 736 | unsigned char vlan_enable:1, |
730 | rx_csum_enable:1, | 737 | rx_csum_enable:1, |
731 | extended_hash:1, | 738 | extended_hash:1, |
732 | bd_stash_en:1; | 739 | bd_stash_en:1, |
740 | wol_en:1; /* Wake-on-LAN enabled */ | ||
733 | unsigned short padding; | 741 | unsigned short padding; |
734 | 742 | ||
735 | unsigned int interruptTransmit; | 743 | unsigned int interruptTransmit; |
diff --git a/drivers/net/gianfar_ethtool.c b/drivers/net/gianfar_ethtool.c index 6007147cc1e9..fb7d3ccc0fdc 100644 --- a/drivers/net/gianfar_ethtool.c +++ b/drivers/net/gianfar_ethtool.c | |||
@@ -479,14 +479,13 @@ static int gfar_sringparam(struct net_device *dev, struct ethtool_ringparam *rva | |||
479 | static int gfar_set_rx_csum(struct net_device *dev, uint32_t data) | 479 | static int gfar_set_rx_csum(struct net_device *dev, uint32_t data) |
480 | { | 480 | { |
481 | struct gfar_private *priv = netdev_priv(dev); | 481 | struct gfar_private *priv = netdev_priv(dev); |
482 | unsigned long flags; | ||
482 | int err = 0; | 483 | int err = 0; |
483 | 484 | ||
484 | if (!(priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_CSUM)) | 485 | if (!(priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_CSUM)) |
485 | return -EOPNOTSUPP; | 486 | return -EOPNOTSUPP; |
486 | 487 | ||
487 | if (dev->flags & IFF_UP) { | 488 | if (dev->flags & IFF_UP) { |
488 | unsigned long flags; | ||
489 | |||
490 | /* Halt TX and RX, and process the frames which | 489 | /* Halt TX and RX, and process the frames which |
491 | * have already been received */ | 490 | * have already been received */ |
492 | spin_lock_irqsave(&priv->txlock, flags); | 491 | spin_lock_irqsave(&priv->txlock, flags); |
@@ -502,7 +501,9 @@ static int gfar_set_rx_csum(struct net_device *dev, uint32_t data) | |||
502 | stop_gfar(dev); | 501 | stop_gfar(dev); |
503 | } | 502 | } |
504 | 503 | ||
504 | spin_lock_irqsave(&priv->bflock, flags); | ||
505 | priv->rx_csum_enable = data; | 505 | priv->rx_csum_enable = data; |
506 | spin_unlock_irqrestore(&priv->bflock, flags); | ||
506 | 507 | ||
507 | if (dev->flags & IFF_UP) | 508 | if (dev->flags & IFF_UP) |
508 | err = startup_gfar(dev); | 509 | err = startup_gfar(dev); |
@@ -564,6 +565,38 @@ static void gfar_set_msglevel(struct net_device *dev, uint32_t data) | |||
564 | priv->msg_enable = data; | 565 | priv->msg_enable = data; |
565 | } | 566 | } |
566 | 567 | ||
568 | #ifdef CONFIG_PM | ||
569 | static void gfar_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | ||
570 | { | ||
571 | struct gfar_private *priv = netdev_priv(dev); | ||
572 | |||
573 | if (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_MAGIC_PACKET) { | ||
574 | wol->supported = WAKE_MAGIC; | ||
575 | wol->wolopts = priv->wol_en ? WAKE_MAGIC : 0; | ||
576 | } else { | ||
577 | wol->supported = wol->wolopts = 0; | ||
578 | } | ||
579 | } | ||
580 | |||
581 | static int gfar_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | ||
582 | { | ||
583 | struct gfar_private *priv = netdev_priv(dev); | ||
584 | unsigned long flags; | ||
585 | |||
586 | if (!(priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_MAGIC_PACKET) && | ||
587 | wol->wolopts != 0) | ||
588 | return -EINVAL; | ||
589 | |||
590 | if (wol->wolopts & ~WAKE_MAGIC) | ||
591 | return -EINVAL; | ||
592 | |||
593 | spin_lock_irqsave(&priv->bflock, flags); | ||
594 | priv->wol_en = wol->wolopts & WAKE_MAGIC ? 1 : 0; | ||
595 | spin_unlock_irqrestore(&priv->bflock, flags); | ||
596 | |||
597 | return 0; | ||
598 | } | ||
599 | #endif | ||
567 | 600 | ||
568 | const struct ethtool_ops gfar_ethtool_ops = { | 601 | const struct ethtool_ops gfar_ethtool_ops = { |
569 | .get_settings = gfar_gsettings, | 602 | .get_settings = gfar_gsettings, |
@@ -585,4 +618,8 @@ const struct ethtool_ops gfar_ethtool_ops = { | |||
585 | .set_tx_csum = gfar_set_tx_csum, | 618 | .set_tx_csum = gfar_set_tx_csum, |
586 | .get_msglevel = gfar_get_msglevel, | 619 | .get_msglevel = gfar_get_msglevel, |
587 | .set_msglevel = gfar_set_msglevel, | 620 | .set_msglevel = gfar_set_msglevel, |
621 | #ifdef CONFIG_PM | ||
622 | .get_wol = gfar_get_wol, | ||
623 | .set_wol = gfar_set_wol, | ||
624 | #endif | ||
588 | }; | 625 | }; |
diff --git a/drivers/video/offb.c b/drivers/video/offb.c index d7b3dcc0dc43..e1d9eeb1aeaf 100644 --- a/drivers/video/offb.c +++ b/drivers/video/offb.c | |||
@@ -47,6 +47,7 @@ enum { | |||
47 | cmap_M3B, /* ATI Rage Mobility M3 Head B */ | 47 | cmap_M3B, /* ATI Rage Mobility M3 Head B */ |
48 | cmap_radeon, /* ATI Radeon */ | 48 | cmap_radeon, /* ATI Radeon */ |
49 | cmap_gxt2000, /* IBM GXT2000 */ | 49 | cmap_gxt2000, /* IBM GXT2000 */ |
50 | cmap_avivo, /* ATI R5xx */ | ||
50 | }; | 51 | }; |
51 | 52 | ||
52 | struct offb_par { | 53 | struct offb_par { |
@@ -58,26 +59,36 @@ struct offb_par { | |||
58 | 59 | ||
59 | struct offb_par default_par; | 60 | struct offb_par default_par; |
60 | 61 | ||
61 | /* | ||
62 | * Interface used by the world | ||
63 | */ | ||
64 | |||
65 | static int offb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, | ||
66 | u_int transp, struct fb_info *info); | ||
67 | static int offb_blank(int blank, struct fb_info *info); | ||
68 | |||
69 | #ifdef CONFIG_PPC32 | 62 | #ifdef CONFIG_PPC32 |
70 | extern boot_infos_t *boot_infos; | 63 | extern boot_infos_t *boot_infos; |
71 | #endif | 64 | #endif |
72 | 65 | ||
73 | static struct fb_ops offb_ops = { | 66 | /* Definitions used by the Avivo palette hack */ |
74 | .owner = THIS_MODULE, | 67 | #define AVIVO_DC_LUT_RW_SELECT 0x6480 |
75 | .fb_setcolreg = offb_setcolreg, | 68 | #define AVIVO_DC_LUT_RW_MODE 0x6484 |
76 | .fb_blank = offb_blank, | 69 | #define AVIVO_DC_LUT_RW_INDEX 0x6488 |
77 | .fb_fillrect = cfb_fillrect, | 70 | #define AVIVO_DC_LUT_SEQ_COLOR 0x648c |
78 | .fb_copyarea = cfb_copyarea, | 71 | #define AVIVO_DC_LUT_PWL_DATA 0x6490 |
79 | .fb_imageblit = cfb_imageblit, | 72 | #define AVIVO_DC_LUT_30_COLOR 0x6494 |
80 | }; | 73 | #define AVIVO_DC_LUT_READ_PIPE_SELECT 0x6498 |
74 | #define AVIVO_DC_LUT_WRITE_EN_MASK 0x649c | ||
75 | #define AVIVO_DC_LUT_AUTOFILL 0x64a0 | ||
76 | |||
77 | #define AVIVO_DC_LUTA_CONTROL 0x64c0 | ||
78 | #define AVIVO_DC_LUTA_BLACK_OFFSET_BLUE 0x64c4 | ||
79 | #define AVIVO_DC_LUTA_BLACK_OFFSET_GREEN 0x64c8 | ||
80 | #define AVIVO_DC_LUTA_BLACK_OFFSET_RED 0x64cc | ||
81 | #define AVIVO_DC_LUTA_WHITE_OFFSET_BLUE 0x64d0 | ||
82 | #define AVIVO_DC_LUTA_WHITE_OFFSET_GREEN 0x64d4 | ||
83 | #define AVIVO_DC_LUTA_WHITE_OFFSET_RED 0x64d8 | ||
84 | |||
85 | #define AVIVO_DC_LUTB_CONTROL 0x6cc0 | ||
86 | #define AVIVO_DC_LUTB_BLACK_OFFSET_BLUE 0x6cc4 | ||
87 | #define AVIVO_DC_LUTB_BLACK_OFFSET_GREEN 0x6cc8 | ||
88 | #define AVIVO_DC_LUTB_BLACK_OFFSET_RED 0x6ccc | ||
89 | #define AVIVO_DC_LUTB_WHITE_OFFSET_BLUE 0x6cd0 | ||
90 | #define AVIVO_DC_LUTB_WHITE_OFFSET_GREEN 0x6cd4 | ||
91 | #define AVIVO_DC_LUTB_WHITE_OFFSET_RED 0x6cd8 | ||
81 | 92 | ||
82 | /* | 93 | /* |
83 | * Set a single color register. The values supplied are already | 94 | * Set a single color register. The values supplied are already |
@@ -160,6 +171,17 @@ static int offb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, | |||
160 | out_le32(((unsigned __iomem *) par->cmap_adr) + regno, | 171 | out_le32(((unsigned __iomem *) par->cmap_adr) + regno, |
161 | (red << 16 | green << 8 | blue)); | 172 | (red << 16 | green << 8 | blue)); |
162 | break; | 173 | break; |
174 | case cmap_avivo: | ||
175 | /* Write to both LUTs for now */ | ||
176 | writel(1, par->cmap_adr + AVIVO_DC_LUT_RW_SELECT); | ||
177 | writeb(regno, par->cmap_adr + AVIVO_DC_LUT_RW_INDEX); | ||
178 | writel(((red) << 22) | ((green) << 12) | ((blue) << 2), | ||
179 | par->cmap_adr + AVIVO_DC_LUT_30_COLOR); | ||
180 | writel(0, par->cmap_adr + AVIVO_DC_LUT_RW_SELECT); | ||
181 | writeb(regno, par->cmap_adr + AVIVO_DC_LUT_RW_INDEX); | ||
182 | writel(((red) << 22) | ((green) << 12) | ((blue) << 2), | ||
183 | par->cmap_adr + AVIVO_DC_LUT_30_COLOR); | ||
184 | break; | ||
163 | } | 185 | } |
164 | 186 | ||
165 | return 0; | 187 | return 0; |
@@ -216,12 +238,59 @@ static int offb_blank(int blank, struct fb_info *info) | |||
216 | out_le32(((unsigned __iomem *) par->cmap_adr) + i, | 238 | out_le32(((unsigned __iomem *) par->cmap_adr) + i, |
217 | 0); | 239 | 0); |
218 | break; | 240 | break; |
241 | case cmap_avivo: | ||
242 | writel(1, par->cmap_adr + AVIVO_DC_LUT_RW_SELECT); | ||
243 | writeb(i, par->cmap_adr + AVIVO_DC_LUT_RW_INDEX); | ||
244 | writel(0, par->cmap_adr + AVIVO_DC_LUT_30_COLOR); | ||
245 | writel(0, par->cmap_adr + AVIVO_DC_LUT_RW_SELECT); | ||
246 | writeb(i, par->cmap_adr + AVIVO_DC_LUT_RW_INDEX); | ||
247 | writel(0, par->cmap_adr + AVIVO_DC_LUT_30_COLOR); | ||
248 | break; | ||
219 | } | 249 | } |
220 | } else | 250 | } else |
221 | fb_set_cmap(&info->cmap, info); | 251 | fb_set_cmap(&info->cmap, info); |
222 | return 0; | 252 | return 0; |
223 | } | 253 | } |
224 | 254 | ||
255 | static int offb_set_par(struct fb_info *info) | ||
256 | { | ||
257 | struct offb_par *par = (struct offb_par *) info->par; | ||
258 | |||
259 | /* On avivo, initialize palette control */ | ||
260 | if (par->cmap_type == cmap_avivo) { | ||
261 | writel(0, par->cmap_adr + AVIVO_DC_LUTA_CONTROL); | ||
262 | writel(0, par->cmap_adr + AVIVO_DC_LUTA_BLACK_OFFSET_BLUE); | ||
263 | writel(0, par->cmap_adr + AVIVO_DC_LUTA_BLACK_OFFSET_GREEN); | ||
264 | writel(0, par->cmap_adr + AVIVO_DC_LUTA_BLACK_OFFSET_RED); | ||
265 | writel(0x0000ffff, par->cmap_adr + AVIVO_DC_LUTA_WHITE_OFFSET_BLUE); | ||
266 | writel(0x0000ffff, par->cmap_adr + AVIVO_DC_LUTA_WHITE_OFFSET_GREEN); | ||
267 | writel(0x0000ffff, par->cmap_adr + AVIVO_DC_LUTA_WHITE_OFFSET_RED); | ||
268 | writel(0, par->cmap_adr + AVIVO_DC_LUTB_CONTROL); | ||
269 | writel(0, par->cmap_adr + AVIVO_DC_LUTB_BLACK_OFFSET_BLUE); | ||
270 | writel(0, par->cmap_adr + AVIVO_DC_LUTB_BLACK_OFFSET_GREEN); | ||
271 | writel(0, par->cmap_adr + AVIVO_DC_LUTB_BLACK_OFFSET_RED); | ||
272 | writel(0x0000ffff, par->cmap_adr + AVIVO_DC_LUTB_WHITE_OFFSET_BLUE); | ||
273 | writel(0x0000ffff, par->cmap_adr + AVIVO_DC_LUTB_WHITE_OFFSET_GREEN); | ||
274 | writel(0x0000ffff, par->cmap_adr + AVIVO_DC_LUTB_WHITE_OFFSET_RED); | ||
275 | writel(1, par->cmap_adr + AVIVO_DC_LUT_RW_SELECT); | ||
276 | writel(0, par->cmap_adr + AVIVO_DC_LUT_RW_MODE); | ||
277 | writel(0x0000003f, par->cmap_adr + AVIVO_DC_LUT_WRITE_EN_MASK); | ||
278 | writel(0, par->cmap_adr + AVIVO_DC_LUT_RW_SELECT); | ||
279 | writel(0, par->cmap_adr + AVIVO_DC_LUT_RW_MODE); | ||
280 | writel(0x0000003f, par->cmap_adr + AVIVO_DC_LUT_WRITE_EN_MASK); | ||
281 | } | ||
282 | return 0; | ||
283 | } | ||
284 | |||
285 | static struct fb_ops offb_ops = { | ||
286 | .owner = THIS_MODULE, | ||
287 | .fb_setcolreg = offb_setcolreg, | ||
288 | .fb_set_par = offb_set_par, | ||
289 | .fb_blank = offb_blank, | ||
290 | .fb_fillrect = cfb_fillrect, | ||
291 | .fb_copyarea = cfb_copyarea, | ||
292 | .fb_imageblit = cfb_imageblit, | ||
293 | }; | ||
225 | 294 | ||
226 | static void __iomem *offb_map_reg(struct device_node *np, int index, | 295 | static void __iomem *offb_map_reg(struct device_node *np, int index, |
227 | unsigned long offset, unsigned long size) | 296 | unsigned long offset, unsigned long size) |
@@ -245,6 +314,59 @@ static void __iomem *offb_map_reg(struct device_node *np, int index, | |||
245 | return ioremap(taddr + offset, size); | 314 | return ioremap(taddr + offset, size); |
246 | } | 315 | } |
247 | 316 | ||
317 | static void offb_init_palette_hacks(struct fb_info *info, struct device_node *dp, | ||
318 | const char *name, unsigned long address) | ||
319 | { | ||
320 | struct offb_par *par = (struct offb_par *) info->par; | ||
321 | |||
322 | if (dp && !strncmp(name, "ATY,Rage128", 11)) { | ||
323 | par->cmap_adr = offb_map_reg(dp, 2, 0, 0x1fff); | ||
324 | if (par->cmap_adr) | ||
325 | par->cmap_type = cmap_r128; | ||
326 | } else if (dp && (!strncmp(name, "ATY,RageM3pA", 12) | ||
327 | || !strncmp(name, "ATY,RageM3p12A", 14))) { | ||
328 | par->cmap_adr = offb_map_reg(dp, 2, 0, 0x1fff); | ||
329 | if (par->cmap_adr) | ||
330 | par->cmap_type = cmap_M3A; | ||
331 | } else if (dp && !strncmp(name, "ATY,RageM3pB", 12)) { | ||
332 | par->cmap_adr = offb_map_reg(dp, 2, 0, 0x1fff); | ||
333 | if (par->cmap_adr) | ||
334 | par->cmap_type = cmap_M3B; | ||
335 | } else if (dp && !strncmp(name, "ATY,Rage6", 9)) { | ||
336 | par->cmap_adr = offb_map_reg(dp, 1, 0, 0x1fff); | ||
337 | if (par->cmap_adr) | ||
338 | par->cmap_type = cmap_radeon; | ||
339 | } else if (!strncmp(name, "ATY,", 4)) { | ||
340 | unsigned long base = address & 0xff000000UL; | ||
341 | par->cmap_adr = | ||
342 | ioremap(base + 0x7ff000, 0x1000) + 0xcc0; | ||
343 | par->cmap_data = par->cmap_adr + 1; | ||
344 | par->cmap_type = cmap_m64; | ||
345 | } else if (dp && (of_device_is_compatible(dp, "pci1014,b7") || | ||
346 | of_device_is_compatible(dp, "pci1014,21c"))) { | ||
347 | par->cmap_adr = offb_map_reg(dp, 0, 0x6000, 0x1000); | ||
348 | if (par->cmap_adr) | ||
349 | par->cmap_type = cmap_gxt2000; | ||
350 | } else if (dp && !strncmp(name, "vga,Display-", 12)) { | ||
351 | /* Look for AVIVO initialized by SLOF */ | ||
352 | struct device_node *pciparent = of_get_parent(dp); | ||
353 | const u32 *vid, *did; | ||
354 | vid = of_get_property(pciparent, "vendor-id", NULL); | ||
355 | did = of_get_property(pciparent, "device-id", NULL); | ||
356 | /* This will match most R5xx */ | ||
357 | if (vid && did && *vid == 0x1002 && | ||
358 | ((*did >= 0x7100 && *did < 0x7800) || | ||
359 | (*did >= 0x9400))) { | ||
360 | par->cmap_adr = offb_map_reg(pciparent, 2, 0, 0x10000); | ||
361 | if (par->cmap_adr) | ||
362 | par->cmap_type = cmap_avivo; | ||
363 | } | ||
364 | of_node_put(pciparent); | ||
365 | } | ||
366 | info->fix.visual = (par->cmap_type != cmap_unknown) ? | ||
367 | FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_STATIC_PSEUDOCOLOR; | ||
368 | } | ||
369 | |||
248 | static void __init offb_init_fb(const char *name, const char *full_name, | 370 | static void __init offb_init_fb(const char *name, const char *full_name, |
249 | int width, int height, int depth, | 371 | int width, int height, int depth, |
250 | int pitch, unsigned long address, | 372 | int pitch, unsigned long address, |
@@ -283,6 +405,7 @@ static void __init offb_init_fb(const char *name, const char *full_name, | |||
283 | 405 | ||
284 | fix = &info->fix; | 406 | fix = &info->fix; |
285 | var = &info->var; | 407 | var = &info->var; |
408 | info->par = par; | ||
286 | 409 | ||
287 | strcpy(fix->id, "OFfb "); | 410 | strcpy(fix->id, "OFfb "); |
288 | strncat(fix->id, name, sizeof(fix->id) - sizeof("OFfb ")); | 411 | strncat(fix->id, name, sizeof(fix->id) - sizeof("OFfb ")); |
@@ -298,39 +421,9 @@ static void __init offb_init_fb(const char *name, const char *full_name, | |||
298 | fix->type_aux = 0; | 421 | fix->type_aux = 0; |
299 | 422 | ||
300 | par->cmap_type = cmap_unknown; | 423 | par->cmap_type = cmap_unknown; |
301 | if (depth == 8) { | 424 | if (depth == 8) |
302 | if (dp && !strncmp(name, "ATY,Rage128", 11)) { | 425 | offb_init_palette_hacks(info, dp, name, address); |
303 | par->cmap_adr = offb_map_reg(dp, 2, 0, 0x1fff); | 426 | else |
304 | if (par->cmap_adr) | ||
305 | par->cmap_type = cmap_r128; | ||
306 | } else if (dp && (!strncmp(name, "ATY,RageM3pA", 12) | ||
307 | || !strncmp(name, "ATY,RageM3p12A", 14))) { | ||
308 | par->cmap_adr = offb_map_reg(dp, 2, 0, 0x1fff); | ||
309 | if (par->cmap_adr) | ||
310 | par->cmap_type = cmap_M3A; | ||
311 | } else if (dp && !strncmp(name, "ATY,RageM3pB", 12)) { | ||
312 | par->cmap_adr = offb_map_reg(dp, 2, 0, 0x1fff); | ||
313 | if (par->cmap_adr) | ||
314 | par->cmap_type = cmap_M3B; | ||
315 | } else if (dp && !strncmp(name, "ATY,Rage6", 9)) { | ||
316 | par->cmap_adr = offb_map_reg(dp, 1, 0, 0x1fff); | ||
317 | if (par->cmap_adr) | ||
318 | par->cmap_type = cmap_radeon; | ||
319 | } else if (!strncmp(name, "ATY,", 4)) { | ||
320 | unsigned long base = address & 0xff000000UL; | ||
321 | par->cmap_adr = | ||
322 | ioremap(base + 0x7ff000, 0x1000) + 0xcc0; | ||
323 | par->cmap_data = par->cmap_adr + 1; | ||
324 | par->cmap_type = cmap_m64; | ||
325 | } else if (dp && (of_device_is_compatible(dp, "pci1014,b7") || | ||
326 | of_device_is_compatible(dp, "pci1014,21c"))) { | ||
327 | par->cmap_adr = offb_map_reg(dp, 0, 0x6000, 0x1000); | ||
328 | if (par->cmap_adr) | ||
329 | par->cmap_type = cmap_gxt2000; | ||
330 | } | ||
331 | fix->visual = (par->cmap_type != cmap_unknown) ? | ||
332 | FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_STATIC_PSEUDOCOLOR; | ||
333 | } else | ||
334 | fix->visual = FB_VISUAL_TRUECOLOR; | 427 | fix->visual = FB_VISUAL_TRUECOLOR; |
335 | 428 | ||
336 | var->xoffset = var->yoffset = 0; | 429 | var->xoffset = var->yoffset = 0; |
@@ -395,7 +488,6 @@ static void __init offb_init_fb(const char *name, const char *full_name, | |||
395 | 488 | ||
396 | info->fbops = &offb_ops; | 489 | info->fbops = &offb_ops; |
397 | info->screen_base = ioremap(address, fix->smem_len); | 490 | info->screen_base = ioremap(address, fix->smem_len); |
398 | info->par = par; | ||
399 | info->pseudo_palette = (void *) (info + 1); | 491 | info->pseudo_palette = (void *) (info + 1); |
400 | info->flags = FBINFO_DEFAULT | foreign_endian; | 492 | info->flags = FBINFO_DEFAULT | foreign_endian; |
401 | 493 | ||
diff --git a/drivers/video/ps3fb.c b/drivers/video/ps3fb.c index dc3af1c78c56..4b5d80771904 100644 --- a/drivers/video/ps3fb.c +++ b/drivers/video/ps3fb.c | |||
@@ -1297,6 +1297,7 @@ static int ps3fb_shutdown(struct ps3_system_bus_device *dev) | |||
1297 | 1297 | ||
1298 | static struct ps3_system_bus_driver ps3fb_driver = { | 1298 | static struct ps3_system_bus_driver ps3fb_driver = { |
1299 | .match_id = PS3_MATCH_ID_GRAPHICS, | 1299 | .match_id = PS3_MATCH_ID_GRAPHICS, |
1300 | .match_sub_id = PS3_MATCH_SUB_ID_FB, | ||
1300 | .core.name = DEVICE_NAME, | 1301 | .core.name = DEVICE_NAME, |
1301 | .core.owner = THIS_MODULE, | 1302 | .core.owner = THIS_MODULE, |
1302 | .probe = ps3fb_probe, | 1303 | .probe = ps3fb_probe, |