Netdev Archive on lore.kernel.org help / color / mirror / Atom feed
From: Helmut Grohne <helmut.grohne@intenta.de> To: David Miller <davem@davemloft.net> Cc: <nicolas.ferre@microchip.com>, <alexandre.belloni@bootlin.com>, <ludovic.desroches@microchip.com>, <woojung.huh@microchip.com>, <UNGLinuxDriver@microchip.com>, <andrew@lunn.ch>, <vivien.didelot@gmail.com>, <f.fainelli@gmail.com>, <kuba@kernel.org>, <robh+dt@kernel.org>, <devicetree@vger.kernel.org>, <netdev@vger.kernel.org> Subject: [PATCH] net: dsa: microchip: really look for phy-mode in port nodes Date: Thu, 24 Sep 2020 10:37:47 +0200 [thread overview] Message-ID: <20200924083746.GA9410@laureti-dev> (raw) In-Reply-To: <20200910.123257.1333858679864684014.davem@davemloft.net> The previous implementation failed to account for the "ports" node. The actual port nodes are not child nodes of the switch node, but a "ports" node sits in between. Fixes: edecfa98f602 ("net: dsa: microchip: look for phy-mode in port nodes") Signed-off-by: Helmut Grohne <helmut.grohne@intenta.de> --- drivers/net/dsa/microchip/ksz_common.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) I am very sorry that I need to send a fixup. It turned out that my testing methodology was flawed. When I reintegrated Linus' master branch, I noticed that it didn't work. It turned out that our hardware now correctly implements hardware reset. As a consequence, the correct setting of the phy-mode now became essential to operating the device. I'm also looking forward to see "net: dsa: microchip: Improve phy mode message" (from net-next) being merged. That would have helped me spot this earlier. Helmut diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c index 8e755b50c9c1..c796d42730ba 100644 --- a/drivers/net/dsa/microchip/ksz_common.c +++ b/drivers/net/dsa/microchip/ksz_common.c @@ -387,8 +387,8 @@ EXPORT_SYMBOL(ksz_switch_alloc); int ksz_switch_register(struct ksz_device *dev, const struct ksz_dev_ops *ops) { + struct device_node *port, *ports; phy_interface_t interface; - struct device_node *port; unsigned int port_num; int ret; @@ -429,13 +429,17 @@ int ksz_switch_register(struct ksz_device *dev, ret = of_get_phy_mode(dev->dev->of_node, &interface); if (ret == 0) 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); - } + ports = of_get_child_by_name(dev->dev->of_node, "ports"); + if (ports) + for_each_available_child_of_node(ports, 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"); } -- 2.20.1
next prev parent reply other threads:[~2020-09-24 8:43 UTC|newest] Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-06-17 8:22 net/dsa/microchip: correct placement of dt property phy-mode? Helmut Grohne 2020-06-17 21:18 ` Andrew Lunn 2020-07-14 12:08 ` [PATCH] net: dsa: microchip: look for phy-mode in port nodes Helmut Grohne 2020-07-14 22:27 ` Andrew Lunn 2020-07-15 7:31 ` Helmut Grohne 2020-07-15 13:00 ` Andrew Lunn 2020-07-16 7:00 ` Helmut Grohne 2020-07-16 10:07 ` Helmut Grohne 2020-08-20 6:03 ` [RESEND PATCH] " Helmut Grohne 2020-08-24 22:37 ` David Miller 2020-09-04 8:14 ` [PATCH v2] " Helmut Grohne 2020-09-04 12:59 ` Alexandre Belloni 2020-09-04 13:52 ` Andrew Lunn 2020-09-07 6:15 ` Helmut Grohne 2020-09-07 12:55 ` Andrew Lunn 2020-09-08 8:01 ` [PATCH v3] " Helmut Grohne 2020-09-10 19:32 ` David Miller 2020-09-24 8:37 ` Helmut Grohne [this message] 2020-09-25 3:10 ` [PATCH] net: dsa: microchip: really " David Miller
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200924083746.GA9410@laureti-dev \ --to=helmut.grohne@intenta.de \ --cc=UNGLinuxDriver@microchip.com \ --cc=alexandre.belloni@bootlin.com \ --cc=andrew@lunn.ch \ --cc=davem@davemloft.net \ --cc=devicetree@vger.kernel.org \ --cc=f.fainelli@gmail.com \ --cc=kuba@kernel.org \ --cc=ludovic.desroches@microchip.com \ --cc=netdev@vger.kernel.org \ --cc=nicolas.ferre@microchip.com \ --cc=robh+dt@kernel.org \ --cc=vivien.didelot@gmail.com \ --cc=woojung.huh@microchip.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).