mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-16 00:34:20 +08:00
of: mdio: Support fixed links in of_phy_get_and_connect()
By a simple extension of of_phy_get_and_connect() drivers that have a fixed link on e.g. RGMII can support also fixed links, so in addition to: ethernet-port { phy-mode = "rgmii"; phy-handle = <&foo>; }; This setup with a fixed-link node and no phy-handle will now also work just fine: ethernet-port { phy-mode = "rgmii"; fixed-link { speed = <1000>; full-duplex; pause; }; }; This is very helpful for connecting random ethernet ports to e.g. DSA switches that typically reside on fixed links. The phy-mode is still there as the fixes link in this case is still an RGMII link. Tested on the Cortina Gemini driver with the Vitesse DSA router chip on a fixed 1Gbit link. Suggested-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
01683a1469
commit
6eb9c9dafd
@ -367,14 +367,23 @@ struct phy_device *of_phy_get_and_connect(struct net_device *dev,
|
|||||||
phy_interface_t iface;
|
phy_interface_t iface;
|
||||||
struct device_node *phy_np;
|
struct device_node *phy_np;
|
||||||
struct phy_device *phy;
|
struct phy_device *phy;
|
||||||
|
int ret;
|
||||||
|
|
||||||
iface = of_get_phy_mode(np);
|
iface = of_get_phy_mode(np);
|
||||||
if (iface < 0)
|
if (iface < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
if (of_phy_is_fixed_link(np)) {
|
||||||
phy_np = of_parse_phandle(np, "phy-handle", 0);
|
ret = of_phy_register_fixed_link(np);
|
||||||
if (!phy_np)
|
if (ret < 0) {
|
||||||
return NULL;
|
netdev_err(dev, "broken fixed-link specification\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
phy_np = of_node_get(np);
|
||||||
|
} else {
|
||||||
|
phy_np = of_parse_phandle(np, "phy-handle", 0);
|
||||||
|
if (!phy_np)
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
phy = of_phy_connect(dev, phy_np, hndlr, 0, iface);
|
phy = of_phy_connect(dev, phy_np, hndlr, 0, iface);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user