[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <67e263cf-5cd7-98d1-56ff-ebd9ac2265b6@arm.com>
Date: Thu, 7 May 2020 08:26:38 -0500
From: Jeremy Linton <jeremy.linton@....com>
To: Calvin Johnson <calvin.johnson@....nxp.com>,
"Rafael J . Wysocki" <rafael@...nel.org>,
Russell King - ARM Linux admin <linux@...linux.org.uk>,
linux.cj@...il.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>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Heikki Krogerus <heikki.krogerus@...ux.intel.com>
Cc: Varun Sethi <V.Sethi@....com>,
"Rajesh V . Bikkina" <rajesh.bikkina@....com>,
linux-acpi@...r.kernel.org, linux-kernel@...r.kernel.org,
Diana Madalina Craciun <diana.craciun@....com>,
netdev@...r.kernel.org, Marcin Wojtas <mw@...ihalf.com>,
Laurentiu Tudor <laurentiu.tudor@....com>,
Makarand Pawagi <makarand.pawagi@....com>,
linux-arm-kernel@...ts.infradead.org,
Pankaj Bansal <pankaj.bansal@....com>,
"David S. Miller" <davem@...emloft.net>,
Heiner Kallweit <hkallweit1@...il.com>
Subject: Re: [net-next PATCH v3 4/5] net: phy: Introduce fwnode_get_phy_id()
Hi,
On 5/5/20 8:29 AM, Calvin Johnson wrote:
> Extract phy_id from compatible string. This will be used by
> fwnode_mdiobus_register_phy() to create phy device using the
> phy_id.
>
> Signed-off-by: Calvin Johnson <calvin.johnson@....nxp.com>
> ---
>
> Changes in v3: None
> Changes in v2: None
>
> drivers/net/phy/phy_device.c | 21 +++++++++++++++++++++
> include/linux/phy.h | 5 +++++
> 2 files changed, 26 insertions(+)
>
> diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
> index 4204d49586cd..f4ad47f73f8d 100644
> --- a/drivers/net/phy/phy_device.c
> +++ b/drivers/net/phy/phy_device.c
> @@ -662,6 +662,27 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, u32 phy_id,
> }
> EXPORT_SYMBOL(phy_device_create);
>
> +/* Extract the phy ID from the compatible string of the form
> + * ethernet-phy-idAAAA.BBBB.
> + */
> +int fwnode_get_phy_id(struct fwnode_handle *fwnode, u32 *phy_id)
> +{
> + const char *cp;
> + unsigned int upper, lower;
> + int ret;
> +
> + ret = fwnode_property_read_string(fwnode, "compatible", &cp);
> + if (!ret) {
> + if (sscanf(cp, "ethernet-phy-id%4x.%4x",
> + &upper, &lower) == 2) {
> + *phy_id = ((upper & 0xFFFF) << 16) | (lower & 0xFFFF);
> + return 0;
> + }
Isn't the ACPI _CID() conceptually similar to the DT compatible
property? It even appears to be getting used in a similar way to
identify particular phy drivers in this case.
Thanks,
Powered by blists - more mailing lists