From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F3A13C4363C for ; Fri, 2 Oct 2020 15:55:17 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9F45E206C9 for ; Fri, 2 Oct 2020 15:55:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="w9fZ+5H/"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="Dm1/hFMw" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9F45E206C9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=lSZ6z3KeUShKYgdf8Jdm6jtocla2aE65LbyNVtHjdJw=; b=w9fZ+5H/VdG0V2hARCUS7iPFd Bvu/7TvGSqMrGdf5hDY20+4hFOdpm57qJkTfV/WfwXvTdPb6FUx9Z+JL0Guyrfu2yQboY1/sOUYrM QVcZ6E4/sPbqooLieKwJayHZkvq3JzBiZDnLoDqLt+k3D4IuVIeyMJ9hep10gxqJ0clGjga5JjBOG ZU+4RJpvN6sb57v8zQuCOTEPZgrcigGiHI29Hm9TITUGGNV15BRe1w0HqOGmz5kGWv74Tbscsh0VS Wp89AG6/J43c4P+oADnY5ZuK+KODKdGnWDHTDy/iCJFxM0BJswxKbaC7ST1knaEa+4hvefWPJqIyz ixxQaaFZw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kONNV-0006To-GB; Fri, 02 Oct 2020 15:53:49 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kONNS-0006IE-AS for linux-arm-kernel@lists.infradead.org; Fri, 02 Oct 2020 15:53:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To: Content-Transfer-Encoding:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=UDJ9ZnphREbFp8lsT7TG//XHyzzzNtLf4BzsnN3c9BY=; b=Dm1/hFMwhGWjG4E1yyJFVPwdg pQoENUNGWivGykN6Gi8lbiXNrXFE+JD9vf4TEeuarCGelU3bX4b59fzBh+VJDVbkM7aYRcqzfbcbf U9zIuEAl702PSpAkuzm1bKrOlvquwUGlSo4A9U+nkr0BjYOEdoTAUaiSrB4T37YAKDFnT5Ru8o/HS p5B8o/zg6COn93bXxh2XgQEiyMmGXRTAas6PL5SyYHbT3KVnBRz+ZFhR2HrET+6ArS2n5dpNCgjGf 6OoEw+XLW8agE2QllPVy6hAasuLecGAmMX+0TnuvHbKobej1UB1x29bz4WIHxJBYfCjOEGff/ScyL xK2OCg1PQ==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:41056) by pandora.armlinux.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kONKJ-0006G2-UD; Fri, 02 Oct 2020 16:50:31 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1kONKE-0004Fi-HE; Fri, 02 Oct 2020 16:50:26 +0100 Date: Fri, 2 Oct 2020 16:50:26 +0100 From: Russell King - ARM Linux admin To: Florian Fainelli Subject: Re: [net-next PATCH v1 3/7] net: phy: Introduce fwnode_get_phy_id() Message-ID: <20201002155026.GG1551@shell.armlinux.org.uk> References: <20200930160430.7908-1-calvin.johnson@oss.nxp.com> <20200930160430.7908-4-calvin.johnson@oss.nxp.com> <11e6b553-675f-8f3d-f9d5-316dae381457@arm.com> <679fab8f-d33a-9ce8-1982-788d5f90185e@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <679fab8f-d33a-9ce8-1982-788d5f90185e@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201002_115346_368473_4F8E7472 X-CRM114-Status: GOOD ( 31.87 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Lunn , Heikki Krogerus , "Rafael J . Wysocki" , Grant Likely , Calvin Johnson , Ioana Ciornei , Diana Madalina Craciun , linux-acpi@vger.kernel.org, Andy Shevchenko , Jakub Kicinski , Florin Laurentiu Chiculita , Madalin Bucur , nd , linux-arm-kernel@lists.infradead.org, Laurentiu Tudor , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jeremy Linton , Cristi Sovaiala , linux.cj@gmail.com, "David S. Miller" , Heiner Kallweit Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Oct 02, 2020 at 08:14:07AM -0700, Florian Fainelli wrote: > On 10/2/2020 4:05 AM, Grant Likely wrote: > > On 30/09/2020 17:04, 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 > > > --- > > > = > > > =A0 drivers/net/phy/phy_device.c | 32 +++++++++++++++++++++++++++++++- > > > =A0 include/linux/phy.h=A0=A0=A0=A0=A0=A0=A0=A0=A0 |=A0 5 +++++ > > > =A0 2 files changed, 36 insertions(+), 1 deletion(-) > > > = > > > diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_devic= e.c > > > index c4aec56d0a95..162abde6223d 100644 > > > --- a/drivers/net/phy/phy_device.c > > > +++ b/drivers/net/phy/phy_device.c > > > @@ -9,6 +9,7 @@ > > > =A0 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt > > > +#include > > > =A0 #include > > > =A0 #include > > > =A0 #include > > > @@ -845,6 +846,27 @@ static int get_phy_c22_id(struct mii_bus *bus, > > > int addr, u32 *phy_id) > > > =A0=A0=A0=A0=A0 return 0; > > > =A0 } > > > +/* 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) > > > +{ > > > +=A0=A0=A0 unsigned int upper, lower; > > > +=A0=A0=A0 const char *cp; > > > +=A0=A0=A0 int ret; > > > + > > > +=A0=A0=A0 ret =3D fwnode_property_read_string(fwnode, "compatible", = &cp); > > > +=A0=A0=A0 if (ret) > > > +=A0=A0=A0=A0=A0=A0=A0 return ret; > > > + > > > +=A0=A0=A0 if (sscanf(cp, "ethernet-phy-id%4x.%4x", &upper, &lower) = =3D=3D 2) { > > > +=A0=A0=A0=A0=A0=A0=A0 *phy_id =3D ((upper & 0xFFFF) << 16) | (lower = & 0xFFFF); > > > +=A0=A0=A0=A0=A0=A0=A0 return 0; > > > +=A0=A0=A0 } > > > +=A0=A0=A0 return -EINVAL; > > > +} > > > +EXPORT_SYMBOL(fwnode_get_phy_id); > > = > > This block, and the changes in patch 4 duplicate functions from > > drivers/of/of_mdio.c, but it doesn't refactor anything in > > drivers/of/of_mdio.c to use the new path. Is your intent to bring all of > > the parsing in these functions of "compatible" into the ACPI code path? > > = > > If so, then the existing code path needs to be refactored to work with > > fwnode_handle instead of device_node. > > = > > If not, then the DT path in these functions should call out to of_mdio, > > while the ACPI path only does what is necessary. > = > Rob has been asking before to have drivers/of/of_mdio.c be merged or at > least relocated within drivers/net/phy where it would naturally belong. A= s a > preliminary step towards ACPI support that would seem reasonable to do. I think even I have commented on specific functions while reviewing patches from NXP that the DT/ACPI code should use common bases... I have been planning that if that doesn't get done, then I'd do it, but really NXP should do it being the ones adding this infrastructure; they should do the job properly and not take advantage of volunteers in the community cleaning up their resulting submissions. -- = RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last! _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel