[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VdhuPsx0Kz8=NHxf6KtC0ff9oJWkSMEdNsLeMznEGLnqQ@mail.gmail.com>
Date: Wed, 1 Jul 2020 13:23:28 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Calvin Johnson <calvin.johnson@....nxp.com>
Cc: Jeremy Linton <jeremy.linton@....com>,
Russell King - ARM Linux admin <linux@...linux.org.uk>,
Jon <jon@...id-run.com>,
Cristi Sovaiala <cristian.sovaiala@....com>,
Ioana Ciornei <ioana.ciornei@....com>,
Andrew Lunn <andrew@...n.ch>,
Florian Fainelli <f.fainelli@...il.com>,
Madalin Bucur <madalin.bucur@....nxp.com>,
netdev <netdev@...r.kernel.org>,
ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
linux.cj@...il.com, "David S. Miller" <davem@...emloft.net>,
Heiner Kallweit <hkallweit1@...il.com>,
Jakub Kicinski <kuba@...nel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [net-next PATCH v2 1/3] net: phy: introduce find_phy_device()
On Wed, Jul 1, 2020 at 9:13 AM Calvin Johnson
<calvin.johnson@....nxp.com> wrote:
>
> The PHYs on a mdiobus are probed and registered using mdiobus_register().
> Later, for connecting these PHYs to MAC, the PHYs registered on the
> mdiobus have to be referenced.
>
> For each MAC node, a property "mdio-handle" is used to reference the
> MDIO bus on which the PHYs are registered. On getting hold of the MDIO
> bus, use find_phy_device() to get the PHY connected to the MAC.
...
> + struct platform_device *pdev;
This...
> + fwnode_mdio = fwnode_find_reference(fwnode, "mdio-handle", 0);
> + dev = bus_find_device_by_fwnode(&platform_bus_type, fwnode_mdio);
> + if (IS_ERR_OR_NULL(dev))
IS_ERR()?!
> + return NULL;
> + pdev = to_platform_device(dev);
> + mdio = platform_get_drvdata(pdev);
...and this can be simple:
mdio = dev_get_drvdata(dev);
> + err = fwnode_property_read_u32(fwnode, "phy-channel", &addr);
> + if (err < 0 || addr < 0 || addr >= PHY_MAX_ADDR)
> + return NULL;
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists