[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210208162831.GM1463@shell.armlinux.org.uk>
Date: Mon, 8 Feb 2021 16:28:31 +0000
From: Russell King - ARM Linux admin <linux@...linux.org.uk>
To: Calvin Johnson <calvin.johnson@....nxp.com>
Cc: Grant Likely <grant.likely@....com>,
"Rafael J . Wysocki" <rafael@...nel.org>,
Jeremy Linton <jeremy.linton@....com>,
Andrew Lunn <andrew@...n.ch>,
Andy Shevchenko <andy.shevchenko@...il.com>,
Florian Fainelli <f.fainelli@...il.com>,
Cristi Sovaiala <cristian.sovaiala@....com>,
Florin Laurentiu Chiculita <florinlaurentiu.chiculita@....com>,
Ioana Ciornei <ioana.ciornei@....com>,
Madalin Bucur <madalin.bucur@....nxp.com>,
Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
Marcin Wojtas <mw@...ihalf.com>,
Pieter Jansen Van Vuuren <pieter.jansenvv@...boosystems.io>,
Jon <jon@...id-run.com>, Saravana Kannan <saravanak@...gle.com>,
Randy Dunlap <rdunlap@...radead.org>,
Laurentiu Tudor <laurentiu.tudor@....com>,
linux-kernel@...r.kernel.org, linux.cj@...il.com,
Diana Madalina Craciun <diana.craciun@....com>,
netdev@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-acpi@...r.kernel.org,
"David S. Miller" <davem@...emloft.net>,
Ioana Radulescu <ruxandra.radulescu@....com>,
Jakub Kicinski <kuba@...nel.org>
Subject: Re: [net-next PATCH v5 15/15] net: dpaa2-mac: Add ACPI support for
DPAA2 MAC driver
On Mon, Feb 08, 2021 at 08:42:44PM +0530, Calvin Johnson wrote:
> Modify dpaa2_mac_connect() to support ACPI along with DT.
> Modify dpaa2_mac_get_node() to get the dpmac fwnode from either
> DT or ACPI.
>
> Replace of_get_phy_mode with fwnode_get_phy_mode to get
> phy-mode for a dpmac_node.
>
> Use helper function phylink_fwnode_phy_connect() to find phy_dev and
> connect to mac->phylink.
>
> Signed-off-by: Calvin Johnson <calvin.johnson@....nxp.com>
I don't think this does the full job.
> static int dpaa2_pcs_create(struct dpaa2_mac *mac,
> - struct device_node *dpmac_node, int id)
> + struct fwnode_handle *dpmac_node,
> + int id)
> {
> struct mdio_device *mdiodev;
> - struct device_node *node;
> + struct fwnode_handle *node;
>
> - node = of_parse_phandle(dpmac_node, "pcs-handle", 0);
> - if (!node) {
> + node = fwnode_find_reference(dpmac_node, "pcs-handle", 0);
> + if (IS_ERR(node)) {
> /* do not error out on old DTS files */
> netdev_warn(mac->net_dev, "pcs-handle node not found\n");
> return 0;
> }
>
> - if (!of_device_is_available(node)) {
> + if (!of_device_is_available(to_of_node(node))) {
If "node" is an ACPI node, then to_of_node() returns NULL, and
of_device_is_available(NULL) is false. So, if we're using ACPI
and we enter this path, we will always hit the error below:
> netdev_err(mac->net_dev, "pcs-handle node not available\n");
> - of_node_put(node);
> + of_node_put(to_of_node(node));
> return -ENODEV;
> }
> @@ -306,7 +321,7 @@ int dpaa2_mac_connect(struct dpaa2_mac *mac)
> * error out if the interface mode requests them and there is no PHY
> * to act upon them
> */
> - if (of_phy_is_fixed_link(dpmac_node) &&
> + if (of_phy_is_fixed_link(to_of_node(dpmac_node)) &&
If "dpmac_node" is an ACPI node, to_of_node() will return NULL, and
of_phy_is_fixed_link() will oops.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
Powered by blists - more mailing lists