aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/fs_enet/mii-bitbang.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-06-15 12:40:05 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-06-15 12:40:05 -0400
commit2ed0e21b30b53d3a94e204196e523e6c8f732b56 (patch)
treede2635426477d86338a9469ce09ba0626052288f /drivers/net/fs_enet/mii-bitbang.c
parent0fa213310cd8fa7a51071cdcf130e26fa56e9549 (diff)
parent9cbc1cb8cd46ce1f7645b9de249b2ce8460129bb (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/mii-bitbang.c')
-rw-r--r--drivers/net/fs_enet/mii-bitbang.c29
1 files changed, 2 insertions, 27 deletions
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
152static 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
169static int __devinit fs_enet_mdio_probe(struct of_device *ofdev, 153static 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