net: dsa: microchip: look for phy-mode in port nodes
Documentation/devicetree/bindings/net/dsa/dsa.txt says that the phy-mode property should be specified on port nodes. However, the microchip drivers read it from the switch node. Let the driver use the per-port property and fall back to the old location with a warning. Fix in-tree users. Signed-off-by: Helmut Grohne <helmut.grohne@intenta.de> Link: https://lore.kernel.org/netdev/20200617082235.GA1523@laureti-dev/ Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
f612eb76f3
commit
edecfa98f6
@ -388,6 +388,8 @@ int ksz_switch_register(struct ksz_device *dev,
|
||||
const struct ksz_dev_ops *ops)
|
||||
{
|
||||
phy_interface_t interface;
|
||||
struct device_node *port;
|
||||
unsigned int port_num;
|
||||
int ret;
|
||||
|
||||
if (dev->pdata)
|
||||
@ -421,10 +423,19 @@ int ksz_switch_register(struct ksz_device *dev,
|
||||
/* Host port interface will be self detected, or specifically set in
|
||||
* device tree.
|
||||
*/
|
||||
for (port_num = 0; port_num < dev->port_cnt; ++port_num)
|
||||
dev->ports[port_num].interface = PHY_INTERFACE_MODE_NA;
|
||||
if (dev->dev->of_node) {
|
||||
ret = of_get_phy_mode(dev->dev->of_node, &interface);
|
||||
if (ret == 0)
|
||||
dev->interface = interface;
|
||||
dev->compat_interface = interface;
|
||||
for_each_available_child_of_node(dev->dev->of_node, port) {
|
||||
if (of_property_read_u32(port, "reg", &port_num))
|
||||
continue;
|
||||
if (port_num >= dev->port_cnt)
|
||||
return -EINVAL;
|
||||
of_get_phy_mode(port, &dev->ports[port_num].interface);
|
||||
}
|
||||
dev->synclko_125 = of_property_read_bool(dev->dev->of_node,
|
||||
"microchip,synclko-125");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user