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.0 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable 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 20ED5C47095 for ; Fri, 2 Oct 2020 15:50:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E138320795 for ; Fri, 2 Oct 2020 15:50:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="Dm1/hFMw" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388039AbgJBPuy (ORCPT ); Fri, 2 Oct 2020 11:50:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726386AbgJBPux (ORCPT ); Fri, 2 Oct 2020 11:50:53 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22864C0613D0; Fri, 2 Oct 2020 08:50:53 -0700 (PDT) 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 Cc: Grant Likely , Calvin Johnson , "Rafael J . Wysocki" , Jeremy Linton , Andrew Lunn , Andy Shevchenko , Cristi Sovaiala , Florin Laurentiu Chiculita , Ioana Ciornei , Madalin Bucur , Heikki Krogerus , linux-kernel@vger.kernel.org, linux.cj@gmail.com, netdev@vger.kernel.org, linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Diana Madalina Craciun , Laurentiu Tudor , "David S. Miller" , Heiner Kallweit , Jakub Kicinski , nd 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-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <679fab8f-d33a-9ce8-1982-788d5f90185e@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: Russell King - ARM Linux admin Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.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 > > > --- > > > > > >   drivers/net/phy/phy_device.c | 32 +++++++++++++++++++++++++++++++- > > >   include/linux/phy.h          |  5 +++++ > > >   2 files changed, 36 insertions(+), 1 deletion(-) > > > > > > diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c > > > index c4aec56d0a95..162abde6223d 100644 > > > --- a/drivers/net/phy/phy_device.c > > > +++ b/drivers/net/phy/phy_device.c > > > @@ -9,6 +9,7 @@ > > >   #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt > > > +#include > > >   #include > > >   #include > > >   #include > > > @@ -845,6 +846,27 @@ static int get_phy_c22_id(struct mii_bus *bus, > > > int addr, u32 *phy_id) > > >       return 0; > > >   } > > > +/* 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) > > > +{ > > > +    unsigned int upper, lower; > > > +    const char *cp; > > > +    int ret; > > > + > > > +    ret = fwnode_property_read_string(fwnode, "compatible", &cp); > > > +    if (ret) > > > +        return ret; > > > + > > > +    if (sscanf(cp, "ethernet-phy-id%4x.%4x", &upper, &lower) == 2) { > > > +        *phy_id = ((upper & 0xFFFF) << 16) | (lower & 0xFFFF); > > > +        return 0; > > > +    } > > > +    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. As 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!