diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-15 12:40:05 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-15 12:40:05 -0400 |
commit | 2ed0e21b30b53d3a94e204196e523e6c8f732b56 (patch) | |
tree | de2635426477d86338a9469ce09ba0626052288f /drivers/net/fs_enet | |
parent | 0fa213310cd8fa7a51071cdcf130e26fa56e9549 (diff) | |
parent | 9cbc1cb8cd46ce1f7645b9de249b2ce8460129bb (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6: (1244 commits)
pkt_sched: Rename PSCHED_US2NS and PSCHED_NS2US
ipv4: Fix fib_trie rebalancing
Bluetooth: Fix issue with uninitialized nsh.type in DTL-1 driver
Bluetooth: Fix Kconfig issue with RFKILL integration
PIM-SM: namespace changes
ipv4: update ARPD help text
net: use a deferred timer in rt_check_expire
ieee802154: fix kconfig bool/tristate muckup
bonding: initialization rework
bonding: use is_zero_ether_addr
bonding: network device names are case sensative
bonding: elminate bad refcount code
bonding: fix style issues
bonding: fix destructor
bonding: remove bonding read/write semaphore
bonding: initialize before registration
bonding: bond_create always called with default parameters
x_tables: Convert printk to pr_err
netfilter: conntrack: optional reliable conntrack event delivery
list_nulls: add hlist_nulls_add_head and hlist_nulls_del
...
Diffstat (limited to 'drivers/net/fs_enet')
-rw-r--r-- | drivers/net/fs_enet/fs_enet-main.c | 108 | ||||
-rw-r--r-- | drivers/net/fs_enet/fs_enet.h | 5 | ||||
-rw-r--r-- | drivers/net/fs_enet/mac-fec.c | 34 | ||||
-rw-r--r-- | drivers/net/fs_enet/mii-bitbang.c | 29 | ||||
-rw-r--r-- | drivers/net/fs_enet/mii-fec.c | 32 |
5 files changed, 17 insertions, 191 deletions
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c index a9cbc3191a2a..b892c3ad9a74 100644 --- a/drivers/net/fs_enet/fs_enet-main.c +++ b/drivers/net/fs_enet/fs_enet-main.c | |||
@@ -36,6 +36,8 @@ | |||
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.h> | ||
40 | #include <linux/of_mdio.h> | ||
39 | #include <linux/of_platform.h> | 41 | #include <linux/of_platform.h> |
40 | #include <linux/of_gpio.h> | 42 | #include <linux/of_gpio.h> |
41 | 43 | ||
@@ -752,9 +754,10 @@ static int fs_init_phy(struct net_device *dev) | |||
752 | fep->oldlink = 0; | 754 | fep->oldlink = 0; |
753 | fep->oldspeed = 0; | 755 | fep->oldspeed = 0; |
754 | fep->oldduplex = -1; | 756 | fep->oldduplex = -1; |
755 | if(fep->fpi->bus_id) | 757 | if(fep->fpi->phy_node) |
756 | phydev = phy_connect(dev, fep->fpi->bus_id, &fs_adjust_link, 0, | 758 | phydev = of_phy_connect(dev, fep->fpi->phy_node, |
757 | PHY_INTERFACE_MODE_MII); | 759 | &fs_adjust_link, 0, |
760 | PHY_INTERFACE_MODE_MII); | ||
758 | else { | 761 | else { |
759 | printk("No phy bus ID specified in BSP code\n"); | 762 | printk("No phy bus ID specified in BSP code\n"); |
760 | return -EINVAL; | 763 | return -EINVAL; |
@@ -938,81 +941,6 @@ extern void fs_mii_disconnect(struct net_device *dev); | |||
938 | 941 | ||
939 | /**************************************************************************************/ | 942 | /**************************************************************************************/ |
940 | 943 | ||
941 | /* handy pointer to the immap */ | ||
942 | void __iomem *fs_enet_immap = NULL; | ||
943 | |||
944 | static int setup_immap(void) | ||
945 | { | ||
946 | #ifdef CONFIG_CPM1 | ||
947 | fs_enet_immap = ioremap(IMAP_ADDR, 0x4000); | ||
948 | WARN_ON(!fs_enet_immap); | ||
949 | #elif defined(CONFIG_CPM2) | ||
950 | fs_enet_immap = cpm2_immr; | ||
951 | #endif | ||
952 | |||
953 | return 0; | ||
954 | } | ||
955 | |||
956 | static void cleanup_immap(void) | ||
957 | { | ||
958 | #if defined(CONFIG_CPM1) | ||
959 | iounmap(fs_enet_immap); | ||
960 | #endif | ||
961 | } | ||
962 | |||
963 | /**************************************************************************************/ | ||
964 | |||
965 | static int __devinit find_phy(struct device_node *np, | ||
966 | struct fs_platform_info *fpi) | ||
967 | { | ||
968 | struct device_node *phynode, *mdionode; | ||
969 | int ret = 0, len, bus_id; | ||
970 | const u32 *data; | ||
971 | |||
972 | data = of_get_property(np, "fixed-link", NULL); | ||
973 | if (data) { | ||
974 | snprintf(fpi->bus_id, 16, "%x:%02x", 0, *data); | ||
975 | return 0; | ||
976 | } | ||
977 | |||
978 | data = of_get_property(np, "phy-handle", &len); | ||
979 | if (!data || len != 4) | ||
980 | return -EINVAL; | ||
981 | |||
982 | phynode = of_find_node_by_phandle(*data); | ||
983 | if (!phynode) | ||
984 | return -EINVAL; | ||
985 | |||
986 | data = of_get_property(phynode, "reg", &len); | ||
987 | if (!data || len != 4) { | ||
988 | ret = -EINVAL; | ||
989 | goto out_put_phy; | ||
990 | } | ||
991 | |||
992 | mdionode = of_get_parent(phynode); | ||
993 | if (!mdionode) { | ||
994 | ret = -EINVAL; | ||
995 | goto out_put_phy; | ||
996 | } | ||
997 | |||
998 | bus_id = of_get_gpio(mdionode, 0); | ||
999 | if (bus_id < 0) { | ||
1000 | struct resource res; | ||
1001 | ret = of_address_to_resource(mdionode, 0, &res); | ||
1002 | if (ret) | ||
1003 | goto out_put_mdio; | ||
1004 | bus_id = res.start; | ||
1005 | } | ||
1006 | |||
1007 | snprintf(fpi->bus_id, 16, "%x:%02x", bus_id, *data); | ||
1008 | |||
1009 | out_put_mdio: | ||
1010 | of_node_put(mdionode); | ||
1011 | out_put_phy: | ||
1012 | of_node_put(phynode); | ||
1013 | return ret; | ||
1014 | } | ||
1015 | |||
1016 | #ifdef CONFIG_FS_ENET_HAS_FEC | 944 | #ifdef CONFIG_FS_ENET_HAS_FEC |
1017 | #define IS_FEC(match) ((match)->data == &fs_fec_ops) | 945 | #define IS_FEC(match) ((match)->data == &fs_fec_ops) |
1018 | #else | 946 | #else |
@@ -1062,9 +990,9 @@ static int __devinit fs_enet_probe(struct of_device *ofdev, | |||
1062 | fpi->rx_copybreak = 240; | 990 | fpi->rx_copybreak = 240; |
1063 | fpi->use_napi = 1; | 991 | fpi->use_napi = 1; |
1064 | fpi->napi_weight = 17; | 992 | fpi->napi_weight = 17; |
1065 | 993 | fpi->phy_node = of_parse_phandle(ofdev->node, "phy-handle", 0); | |
1066 | ret = find_phy(ofdev->node, fpi); | 994 | if ((!fpi->phy_node) && (!of_get_property(ofdev->node, "fixed-link", |
1067 | if (ret) | 995 | NULL))) |
1068 | goto out_free_fpi; | 996 | goto out_free_fpi; |
1069 | 997 | ||
1070 | privsize = sizeof(*fep) + | 998 | privsize = sizeof(*fep) + |
@@ -1136,6 +1064,7 @@ out_cleanup_data: | |||
1136 | out_free_dev: | 1064 | out_free_dev: |
1137 | free_netdev(ndev); | 1065 | free_netdev(ndev); |
1138 | dev_set_drvdata(&ofdev->dev, NULL); | 1066 | dev_set_drvdata(&ofdev->dev, NULL); |
1067 | of_node_put(fpi->phy_node); | ||
1139 | out_free_fpi: | 1068 | out_free_fpi: |
1140 | kfree(fpi); | 1069 | kfree(fpi); |
1141 | return ret; | 1070 | return ret; |
@@ -1151,7 +1080,7 @@ static int fs_enet_remove(struct of_device *ofdev) | |||
1151 | fep->ops->free_bd(ndev); | 1080 | fep->ops->free_bd(ndev); |
1152 | fep->ops->cleanup_data(ndev); | 1081 | fep->ops->cleanup_data(ndev); |
1153 | dev_set_drvdata(fep->dev, NULL); | 1082 | dev_set_drvdata(fep->dev, NULL); |
1154 | 1083 | of_node_put(fep->fpi->phy_node); | |
1155 | free_netdev(ndev); | 1084 | free_netdev(ndev); |
1156 | return 0; | 1085 | return 0; |
1157 | } | 1086 | } |
@@ -1191,25 +1120,12 @@ static struct of_platform_driver fs_enet_driver = { | |||
1191 | 1120 | ||
1192 | static int __init fs_init(void) | 1121 | static int __init fs_init(void) |
1193 | { | 1122 | { |
1194 | int r = setup_immap(); | 1123 | return of_register_platform_driver(&fs_enet_driver); |
1195 | if (r != 0) | ||
1196 | return r; | ||
1197 | |||
1198 | r = of_register_platform_driver(&fs_enet_driver); | ||
1199 | if (r != 0) | ||
1200 | goto out; | ||
1201 | |||
1202 | return 0; | ||
1203 | |||
1204 | out: | ||
1205 | cleanup_immap(); | ||
1206 | return r; | ||
1207 | } | 1124 | } |
1208 | 1125 | ||
1209 | static void __exit fs_cleanup(void) | 1126 | static void __exit fs_cleanup(void) |
1210 | { | 1127 | { |
1211 | of_unregister_platform_driver(&fs_enet_driver); | 1128 | of_unregister_platform_driver(&fs_enet_driver); |
1212 | cleanup_immap(); | ||
1213 | } | 1129 | } |
1214 | 1130 | ||
1215 | #ifdef CONFIG_NET_POLL_CONTROLLER | 1131 | #ifdef CONFIG_NET_POLL_CONTROLLER |
diff --git a/drivers/net/fs_enet/fs_enet.h b/drivers/net/fs_enet/fs_enet.h index 85a4bab7f630..ef01e09781a5 100644 --- a/drivers/net/fs_enet/fs_enet.h +++ b/drivers/net/fs_enet/fs_enet.h | |||
@@ -194,9 +194,4 @@ extern const struct fs_ops fs_scc_ops; | |||
194 | 194 | ||
195 | /*******************************************************************/ | 195 | /*******************************************************************/ |
196 | 196 | ||
197 | /* handy pointer to the immap */ | ||
198 | extern void __iomem *fs_enet_immap; | ||
199 | |||
200 | /*******************************************************************/ | ||
201 | |||
202 | #endif | 197 | #endif |
diff --git a/drivers/net/fs_enet/mac-fec.c b/drivers/net/fs_enet/mac-fec.c index 14e575313c89..ca7bcb8ab3a1 100644 --- a/drivers/net/fs_enet/mac-fec.c +++ b/drivers/net/fs_enet/mac-fec.c | |||
@@ -245,10 +245,6 @@ static void set_multicast_list(struct net_device *dev) | |||
245 | 245 | ||
246 | static void restart(struct net_device *dev) | 246 | static void restart(struct net_device *dev) |
247 | { | 247 | { |
248 | #ifdef CONFIG_DUET | ||
249 | immap_t *immap = fs_enet_immap; | ||
250 | u32 cptr; | ||
251 | #endif | ||
252 | struct fs_enet_private *fep = netdev_priv(dev); | 248 | struct fs_enet_private *fep = netdev_priv(dev); |
253 | fec_t __iomem *fecp = fep->fec.fecp; | 249 | fec_t __iomem *fecp = fep->fec.fecp; |
254 | const struct fs_platform_info *fpi = fep->fpi; | 250 | const struct fs_platform_info *fpi = fep->fpi; |
@@ -315,36 +311,6 @@ static void restart(struct net_device *dev) | |||
315 | FW(fecp, ievent, 0xffc0); | 311 | FW(fecp, ievent, 0xffc0); |
316 | FW(fecp, ivec, (virq_to_hw(fep->interrupt) / 2) << 29); | 312 | FW(fecp, ivec, (virq_to_hw(fep->interrupt) / 2) << 29); |
317 | 313 | ||
318 | /* | ||
319 | * adjust to speed (only for DUET & RMII) | ||
320 | */ | ||
321 | #ifdef CONFIG_DUET | ||
322 | if (fpi->use_rmii) { | ||
323 | cptr = in_be32(&immap->im_cpm.cp_cptr); | ||
324 | switch (fs_get_fec_index(fpi->fs_no)) { | ||
325 | case 0: | ||
326 | cptr |= 0x100; | ||
327 | if (fep->speed == 10) | ||
328 | cptr |= 0x0000010; | ||
329 | else if (fep->speed == 100) | ||
330 | cptr &= ~0x0000010; | ||
331 | break; | ||
332 | case 1: | ||
333 | cptr |= 0x80; | ||
334 | if (fep->speed == 10) | ||
335 | cptr |= 0x0000008; | ||
336 | else if (fep->speed == 100) | ||
337 | cptr &= ~0x0000008; | ||
338 | break; | ||
339 | default: | ||
340 | BUG(); /* should never happen */ | ||
341 | break; | ||
342 | } | ||
343 | out_be32(&immap->im_cpm.cp_cptr, cptr); | ||
344 | } | ||
345 | #endif | ||
346 | |||
347 | |||
348 | FW(fecp, r_cntrl, FEC_RCNTRL_MII_MODE); /* MII enable */ | 314 | FW(fecp, r_cntrl, FEC_RCNTRL_MII_MODE); /* MII enable */ |
349 | /* | 315 | /* |
350 | * adjust to duplex mode | 316 | * adjust to duplex mode |
diff --git a/drivers/net/fs_enet/mii-bitbang.c b/drivers/net/fs_enet/mii-bitbang.c index 49b6645d7e0c..93b481b0e3c7 100644 --- a/drivers/net/fs_enet/mii-bitbang.c +++ b/drivers/net/fs_enet/mii-bitbang.c | |||
@@ -22,6 +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 | #include <linux/of_mdio.h> | ||
25 | #include <linux/of_platform.h> | 26 | #include <linux/of_platform.h> |
26 | 27 | ||
27 | #include "fs_enet.h" | 28 | #include "fs_enet.h" |
@@ -149,31 +150,12 @@ static int __devinit fs_mii_bitbang_init(struct mii_bus *bus, | |||
149 | return 0; | 150 | return 0; |
150 | } | 151 | } |
151 | 152 | ||
152 | static void __devinit add_phy(struct mii_bus *bus, struct device_node *np) | ||
153 | { | ||
154 | const u32 *data; | ||
155 | int len, id, irq; | ||
156 | |||
157 | data = of_get_property(np, "reg", &len); | ||
158 | if (!data || len != 4) | ||
159 | return; | ||
160 | |||
161 | id = *data; | ||
162 | bus->phy_mask &= ~(1 << id); | ||
163 | |||
164 | irq = of_irq_to_resource(np, 0, NULL); | ||
165 | if (irq != NO_IRQ) | ||
166 | bus->irq[id] = irq; | ||
167 | } | ||
168 | |||
169 | static int __devinit fs_enet_mdio_probe(struct of_device *ofdev, | 153 | static int __devinit fs_enet_mdio_probe(struct of_device *ofdev, |
170 | const struct of_device_id *match) | 154 | const struct of_device_id *match) |
171 | { | 155 | { |
172 | struct device_node *np = NULL; | ||
173 | struct mii_bus *new_bus; | 156 | struct mii_bus *new_bus; |
174 | struct bb_info *bitbang; | 157 | struct bb_info *bitbang; |
175 | int ret = -ENOMEM; | 158 | int ret = -ENOMEM; |
176 | int i; | ||
177 | 159 | ||
178 | bitbang = kzalloc(sizeof(struct bb_info), GFP_KERNEL); | 160 | bitbang = kzalloc(sizeof(struct bb_info), GFP_KERNEL); |
179 | if (!bitbang) | 161 | if (!bitbang) |
@@ -196,17 +178,10 @@ static int __devinit fs_enet_mdio_probe(struct of_device *ofdev, | |||
196 | if (!new_bus->irq) | 178 | if (!new_bus->irq) |
197 | goto out_unmap_regs; | 179 | goto out_unmap_regs; |
198 | 180 | ||
199 | for (i = 0; i < PHY_MAX_ADDR; i++) | ||
200 | new_bus->irq[i] = -1; | ||
201 | |||
202 | while ((np = of_get_next_child(ofdev->node, np))) | ||
203 | if (!strcmp(np->type, "ethernet-phy")) | ||
204 | add_phy(new_bus, np); | ||
205 | |||
206 | new_bus->parent = &ofdev->dev; | 181 | new_bus->parent = &ofdev->dev; |
207 | dev_set_drvdata(&ofdev->dev, new_bus); | 182 | dev_set_drvdata(&ofdev->dev, new_bus); |
208 | 183 | ||
209 | ret = mdiobus_register(new_bus); | 184 | ret = of_mdiobus_register(new_bus, ofdev->node); |
210 | if (ret) | 185 | if (ret) |
211 | goto out_free_irqs; | 186 | goto out_free_irqs; |
212 | 187 | ||
diff --git a/drivers/net/fs_enet/mii-fec.c b/drivers/net/fs_enet/mii-fec.c index 28077cc1b949..75a09994d665 100644 --- a/drivers/net/fs_enet/mii-fec.c +++ b/drivers/net/fs_enet/mii-fec.c | |||
@@ -54,8 +54,7 @@ static int fs_enet_fec_mii_read(struct mii_bus *bus , int phy_id, int location) | |||
54 | fec_t __iomem *fecp = fec->fecp; | 54 | fec_t __iomem *fecp = fec->fecp; |
55 | int i, ret = -1; | 55 | int i, ret = -1; |
56 | 56 | ||
57 | if ((in_be32(&fecp->fec_r_cntrl) & FEC_RCNTRL_MII_MODE) == 0) | 57 | BUG_ON((in_be32(&fecp->fec_r_cntrl) & FEC_RCNTRL_MII_MODE) == 0); |
58 | BUG(); | ||
59 | 58 | ||
60 | /* Add PHY address to register command. */ | 59 | /* Add PHY address to register command. */ |
61 | out_be32(&fecp->fec_mii_data, (phy_id << 23) | mk_mii_read(location)); | 60 | out_be32(&fecp->fec_mii_data, (phy_id << 23) | mk_mii_read(location)); |
@@ -79,8 +78,7 @@ static int fs_enet_fec_mii_write(struct mii_bus *bus, int phy_id, int location, | |||
79 | int i; | 78 | int i; |
80 | 79 | ||
81 | /* this must never happen */ | 80 | /* this must never happen */ |
82 | if ((in_be32(&fecp->fec_r_cntrl) & FEC_RCNTRL_MII_MODE) == 0) | 81 | BUG_ON((in_be32(&fecp->fec_r_cntrl) & FEC_RCNTRL_MII_MODE) == 0); |
83 | BUG(); | ||
84 | 82 | ||
85 | /* Add PHY address to register command. */ | 83 | /* Add PHY address to register command. */ |
86 | out_be32(&fecp->fec_mii_data, (phy_id << 23) | mk_mii_write(location, val)); | 84 | out_be32(&fecp->fec_mii_data, (phy_id << 23) | mk_mii_write(location, val)); |
@@ -102,23 +100,6 @@ static int fs_enet_fec_mii_reset(struct mii_bus *bus) | |||
102 | return 0; | 100 | return 0; |
103 | } | 101 | } |
104 | 102 | ||
105 | static void __devinit add_phy(struct mii_bus *bus, struct device_node *np) | ||
106 | { | ||
107 | const u32 *data; | ||
108 | int len, id, irq; | ||
109 | |||
110 | data = of_get_property(np, "reg", &len); | ||
111 | if (!data || len != 4) | ||
112 | return; | ||
113 | |||
114 | id = *data; | ||
115 | bus->phy_mask &= ~(1 << id); | ||
116 | |||
117 | irq = of_irq_to_resource(np, 0, NULL); | ||
118 | if (irq != NO_IRQ) | ||
119 | bus->irq[id] = irq; | ||
120 | } | ||
121 | |||
122 | static int __devinit fs_enet_mdio_probe(struct of_device *ofdev, | 103 | static int __devinit fs_enet_mdio_probe(struct of_device *ofdev, |
123 | const struct of_device_id *match) | 104 | const struct of_device_id *match) |
124 | { | 105 | { |
@@ -165,17 +146,10 @@ static int __devinit fs_enet_mdio_probe(struct of_device *ofdev, | |||
165 | if (!new_bus->irq) | 146 | if (!new_bus->irq) |
166 | goto out_unmap_regs; | 147 | goto out_unmap_regs; |
167 | 148 | ||
168 | for (i = 0; i < PHY_MAX_ADDR; i++) | ||
169 | new_bus->irq[i] = -1; | ||
170 | |||
171 | while ((np = of_get_next_child(ofdev->node, np))) | ||
172 | if (!strcmp(np->type, "ethernet-phy")) | ||
173 | add_phy(new_bus, np); | ||
174 | |||
175 | new_bus->parent = &ofdev->dev; | 149 | new_bus->parent = &ofdev->dev; |
176 | dev_set_drvdata(&ofdev->dev, new_bus); | 150 | dev_set_drvdata(&ofdev->dev, new_bus); |
177 | 151 | ||
178 | ret = mdiobus_register(new_bus); | 152 | ret = of_mdiobus_register(new_bus, ofdev->node); |
179 | if (ret) | 153 | if (ret) |
180 | goto out_free_irqs; | 154 | goto out_free_irqs; |
181 | 155 | ||