Commit d8b35fac authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Jeff Garzik

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: default avatarLaurent Pinchart <laurentp@cse-semaphore.com>
Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
parent a5edeccb
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#include <asm/uaccess.h> #include <asm/uaccess.h>
#ifdef CONFIG_PPC_CPM_NEW_BINDING #ifdef CONFIG_PPC_CPM_NEW_BINDING
#include <linux/of_gpio.h>
#include <asm/of_platform.h> #include <asm/of_platform.h>
#endif #endif
...@@ -1172,8 +1173,7 @@ static int __devinit find_phy(struct device_node *np, ...@@ -1172,8 +1173,7 @@ static int __devinit find_phy(struct device_node *np,
struct fs_platform_info *fpi) struct fs_platform_info *fpi)
{ {
struct device_node *phynode, *mdionode; struct device_node *phynode, *mdionode;
struct resource res; int ret = 0, len, bus_id;
int ret = 0, len;
const u32 *data; const u32 *data;
data = of_get_property(np, "fixed-link", NULL); data = of_get_property(np, "fixed-link", NULL);
...@@ -1190,19 +1190,28 @@ static int __devinit find_phy(struct device_node *np, ...@@ -1190,19 +1190,28 @@ static int __devinit find_phy(struct device_node *np,
if (!phynode) if (!phynode)
return -EINVAL; return -EINVAL;
data = of_get_property(phynode, "reg", &len);
if (!data || len != 4) {
ret = -EINVAL;
goto out_put_phy;
}
mdionode = of_get_parent(phynode); mdionode = of_get_parent(phynode);
if (!mdionode) if (!mdionode) {
ret = -EINVAL;
goto out_put_phy; goto out_put_phy;
}
bus_id = of_get_gpio(mdionode, 0);
if (bus_id < 0) {
struct resource res;
ret = of_address_to_resource(mdionode, 0, &res); ret = of_address_to_resource(mdionode, 0, &res);
if (ret) if (ret)
goto out_put_mdio; goto out_put_mdio;
bus_id = res.start;
}
data = of_get_property(phynode, "reg", &len); snprintf(fpi->bus_id, 16, "%x:%02x", bus_id, *data);
if (!data || len != 4)
goto out_put_mdio;
snprintf(fpi->bus_id, 16, "%x:%02x", res.start, *data);
out_put_mdio: out_put_mdio:
of_node_put(mdionode); of_node_put(mdionode);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment