Commit 3104a6ff authored by Anton Vorontsov's avatar Anton Vorontsov Committed by David S. Miller

ucc_geth: Revive fixed link support

Since commit 0b9da337 ("Rework
ucc_geth driver to use of_mdio infrastructure") the fixed-link
support is broken.

This patch fixes the support by removing !ug_info->phy_node check,
and adds a call to of_phy_connect_fixed_link() if a phy is not attached
to the MAC.

Also, remove an old fixed-link code that we don't use any longer.
Signed-off-by: default avatarAnton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: default avatarGrant Likely <grant.likely@secretlab.ca>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1db780f8
...@@ -1590,13 +1590,13 @@ static int init_phy(struct net_device *dev) ...@@ -1590,13 +1590,13 @@ static int init_phy(struct net_device *dev)
priv->oldspeed = 0; priv->oldspeed = 0;
priv->oldduplex = -1; priv->oldduplex = -1;
if (!ug_info->phy_node)
return 0;
phydev = of_phy_connect(dev, ug_info->phy_node, &adjust_link, 0, phydev = of_phy_connect(dev, ug_info->phy_node, &adjust_link, 0,
priv->phy_interface); priv->phy_interface);
if (!phydev)
phydev = of_phy_connect_fixed_link(dev, &adjust_link,
priv->phy_interface);
if (!phydev) { if (!phydev) {
printk("%s: Could not attach to PHY\n", dev->name); dev_err(&dev->dev, "Could not attach to PHY\n");
return -ENODEV; return -ENODEV;
} }
...@@ -3608,9 +3608,7 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma ...@@ -3608,9 +3608,7 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
struct ucc_geth_private *ugeth = NULL; struct ucc_geth_private *ugeth = NULL;
struct ucc_geth_info *ug_info; struct ucc_geth_info *ug_info;
struct resource res; struct resource res;
struct device_node *phy;
int err, ucc_num, max_speed = 0; int err, ucc_num, max_speed = 0;
const u32 *fixed_link;
const unsigned int *prop; const unsigned int *prop;
const char *sprop; const char *sprop;
const void *mac_addr; const void *mac_addr;
...@@ -3708,15 +3706,8 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma ...@@ -3708,15 +3706,8 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
ug_info->uf_info.regs = res.start; ug_info->uf_info.regs = res.start;
ug_info->uf_info.irq = irq_of_parse_and_map(np, 0); ug_info->uf_info.irq = irq_of_parse_and_map(np, 0);
fixed_link = of_get_property(np, "fixed-link", NULL);
if (fixed_link) { ug_info->phy_node = of_parse_phandle(np, "phy-handle", 0);
phy = NULL;
} else {
phy = of_parse_phandle(np, "phy-handle", 0);
if (phy == NULL)
return -ENODEV;
}
ug_info->phy_node = phy;
/* Find the TBI PHY node. If it's not there, we don't support SGMII */ /* Find the TBI PHY node. If it's not there, we don't support SGMII */
ug_info->tbi_node = of_parse_phandle(np, "tbi-handle", 0); ug_info->tbi_node = of_parse_phandle(np, "tbi-handle", 0);
...@@ -3725,7 +3716,7 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma ...@@ -3725,7 +3716,7 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
prop = of_get_property(np, "phy-connection-type", NULL); prop = of_get_property(np, "phy-connection-type", NULL);
if (!prop) { if (!prop) {
/* handle interface property present in old trees */ /* handle interface property present in old trees */
prop = of_get_property(phy, "interface", NULL); prop = of_get_property(ug_info->phy_node, "interface", NULL);
if (prop != NULL) { if (prop != NULL) {
phy_interface = enet_to_phy_interface[*prop]; phy_interface = enet_to_phy_interface[*prop];
max_speed = enet_to_speed[*prop]; max_speed = enet_to_speed[*prop];
......
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