diff options
author | Laurent Pinchart <laurentp@cse-semaphore.com> | 2008-05-26 05:53:45 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-05-30 22:18:33 -0400 |
commit | d8b35fac8c7e1b44d873c1afcc5f88bc5ef4b361 (patch) | |
tree | 9f506fb935596786a652274f7107f1d200d7a083 /drivers | |
parent | a5edeccb1a8432ae5d9fb9bccea5a4b64c565017 (diff) |
fs_enet: MDIO on GPIO support
Port the fs_enet driver to support the MDIO on GPIO driver for PHY access
in addition to the mii-bitbang driver.
Signed-off-by: Laurent Pinchart <laurentp@cse-semaphore.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/fs_enet/fs_enet-main.c | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c index a5baaf59ff66..fb7c47790bd6 100644 --- a/drivers/net/fs_enet/fs_enet-main.c +++ b/drivers/net/fs_enet/fs_enet-main.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #include <asm/uaccess.h> | 43 | #include <asm/uaccess.h> |
44 | 44 | ||
45 | #ifdef CONFIG_PPC_CPM_NEW_BINDING | 45 | #ifdef CONFIG_PPC_CPM_NEW_BINDING |
46 | #include <linux/of_gpio.h> | ||
46 | #include <asm/of_platform.h> | 47 | #include <asm/of_platform.h> |
47 | #endif | 48 | #endif |
48 | 49 | ||
@@ -1172,8 +1173,7 @@ static int __devinit find_phy(struct device_node *np, | |||
1172 | struct fs_platform_info *fpi) | 1173 | struct fs_platform_info *fpi) |
1173 | { | 1174 | { |
1174 | struct device_node *phynode, *mdionode; | 1175 | struct device_node *phynode, *mdionode; |
1175 | struct resource res; | 1176 | int ret = 0, len, bus_id; |
1176 | int ret = 0, len; | ||
1177 | const u32 *data; | 1177 | const u32 *data; |
1178 | 1178 | ||
1179 | data = of_get_property(np, "fixed-link", NULL); | 1179 | data = of_get_property(np, "fixed-link", NULL); |
@@ -1190,19 +1190,28 @@ static int __devinit find_phy(struct device_node *np, | |||
1190 | if (!phynode) | 1190 | if (!phynode) |
1191 | return -EINVAL; | 1191 | return -EINVAL; |
1192 | 1192 | ||
1193 | mdionode = of_get_parent(phynode); | 1193 | data = of_get_property(phynode, "reg", &len); |
1194 | if (!mdionode) | 1194 | if (!data || len != 4) { |
1195 | ret = -EINVAL; | ||
1195 | goto out_put_phy; | 1196 | goto out_put_phy; |
1197 | } | ||
1196 | 1198 | ||
1197 | ret = of_address_to_resource(mdionode, 0, &res); | 1199 | mdionode = of_get_parent(phynode); |
1198 | if (ret) | 1200 | if (!mdionode) { |
1199 | goto out_put_mdio; | 1201 | ret = -EINVAL; |
1202 | goto out_put_phy; | ||
1203 | } | ||
1200 | 1204 | ||
1201 | data = of_get_property(phynode, "reg", &len); | 1205 | bus_id = of_get_gpio(mdionode, 0); |
1202 | if (!data || len != 4) | 1206 | if (bus_id < 0) { |
1203 | goto out_put_mdio; | 1207 | struct resource res; |
1208 | ret = of_address_to_resource(mdionode, 0, &res); | ||
1209 | if (ret) | ||
1210 | goto out_put_mdio; | ||
1211 | bus_id = res.start; | ||
1212 | } | ||
1204 | 1213 | ||
1205 | snprintf(fpi->bus_id, 16, "%x:%02x", res.start, *data); | 1214 | snprintf(fpi->bus_id, 16, "%x:%02x", bus_id, *data); |
1206 | 1215 | ||
1207 | out_put_mdio: | 1216 | out_put_mdio: |
1208 | of_node_put(mdionode); | 1217 | of_node_put(mdionode); |