Commit f8d56d8f authored by Stefan Roese's avatar Stefan Roese Committed by David S. Miller

net: eth: cpsw: Correctly attach to GPIO bitbang MDIO driver

When the GPIO bitbang MDIO driver is used instead of the Davinci MDIO driver
we need to configure the phy_id string differently. Otherwise this string
looks like this "gpio.6" instead of "gpio-0" and the PHY is not found when
phy_connect() is called.
Signed-off-by: default avatarStefan Roese <sr@denx.de>
Cc: Lukas Stockmann <lukas.stockmann@siemens.com>
Cc: Mugunthan V N <mugunthanvnm@ti.com>
Acked-by: default avatarMugunthan V N <mugunthanvnm@ti.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 53d8ab29
...@@ -1878,8 +1878,18 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data, ...@@ -1878,8 +1878,18 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data,
mdio_node = of_find_node_by_phandle(be32_to_cpup(parp)); mdio_node = of_find_node_by_phandle(be32_to_cpup(parp));
phyid = be32_to_cpup(parp+1); phyid = be32_to_cpup(parp+1);
mdio = of_find_device_by_node(mdio_node); mdio = of_find_device_by_node(mdio_node);
snprintf(slave_data->phy_id, sizeof(slave_data->phy_id),
PHY_ID_FMT, mdio->name, phyid); if (strncmp(mdio->name, "gpio", 4) == 0) {
/* GPIO bitbang MDIO driver attached */
struct mii_bus *bus = dev_get_drvdata(&mdio->dev);
snprintf(slave_data->phy_id, sizeof(slave_data->phy_id),
PHY_ID_FMT, bus->id, phyid);
} else {
/* davinci MDIO driver attached */
snprintf(slave_data->phy_id, sizeof(slave_data->phy_id),
PHY_ID_FMT, mdio->name, phyid);
}
mac_addr = of_get_mac_address(slave_node); mac_addr = of_get_mac_address(slave_node);
if (mac_addr) if (mac_addr)
......
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