From patchwork Thu Mar 31 09:25:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 12796918 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63BC6C4332F for ; Thu, 31 Mar 2022 09:27:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233871AbiCaJ2x (ORCPT ); Thu, 31 Mar 2022 05:28:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233872AbiCaJ2w (ORCPT ); Thu, 31 Mar 2022 05:28:52 -0400 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 868211FDFF0; Thu, 31 Mar 2022 02:27:03 -0700 (PDT) Received: (Authenticated sender: clement.leger@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id EB727E0004; Thu, 31 Mar 2022 09:27:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1648718822; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nRN8rAoSulvBgbxXwy3jJyKItub0BlzV5SCreqaglg8=; b=TGBtJqjSaZbGSLLF2cTEmZtPnb7adUzM9yyG3Ii/aztqT7y3//d3bRp2fW/a5MKW1gWvJ/ Pses9BikYicUPSwkDbCnZwyLeHO1tfKYGqya+6k7XXt40o45v07CtkEQSbqi6Z6G9ryUix b2w/2SFiqosscTMMN1/SxXorQMKHCT4/LaiOJHmree1JDzkK4hOybnpDX9f56bxeqC3d8/ ucrukzyKPXH66AaNd2xr15TnpQDnXIp9gEJo2pn+ZBIr8HviGv7fxxmLcDrPeGLxpF0er8 o84mpRscTF032uKwQG2U7iza0CbuUQ5pj2YL0nWSVj/3uX1C9Ls5O0/hQ84zwQ== From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: Andrew Lunn , Heiner Kallweit , Russell King , "David S . Miller" , Jakub Kicinski , Paolo Abeni Cc: Horatiu Vultur , Thomas Petazzoni , Alexandre Belloni , Allan Nielsen , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= Subject: [RFC PATCH net-next v2 01/11] net: mdio: fwnode: import of_mdiobus_register() and needed functions Date: Thu, 31 Mar 2022 11:25:23 +0200 Message-Id: <20220331092533.348626-2-clement.leger@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220331092533.348626-1-clement.leger@bootlin.com> References: <20220331092533.348626-1-clement.leger@bootlin.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Import of_mdiobus_register and needed functions to allow visualizing a pretty diff of the modifications that are going to be done for fwnode support. While importing, did a few modifications to ensure it compiles correctly: - Renamed of_mdiobus_register() to fwnode_mdiobus_register() - Renamed of_mdiobus_child_is_phy() to fwnode_mdiobus_child_is_phy() - Call fwnode_get_phy_id() instead of of_get_phy_id() which is already a wrapper ended up calling fwnode_get_phy_id(). Signed-off-by: Clément Léger --- drivers/net/mdio/fwnode_mdio.c | 195 +++++++++++++++++++++++++++++++++ 1 file changed, 195 insertions(+) diff --git a/drivers/net/mdio/fwnode_mdio.c b/drivers/net/mdio/fwnode_mdio.c index 1becb1a731f6..a5a6fd9ebd94 100644 --- a/drivers/net/mdio/fwnode_mdio.c +++ b/drivers/net/mdio/fwnode_mdio.c @@ -9,8 +9,11 @@ #include #include #include +#include #include +#define DEFAULT_GPIO_RESET_DELAY 10 /* in microseconds */ + MODULE_AUTHOR("Calvin Johnson "); MODULE_LICENSE("GPL"); @@ -142,3 +145,195 @@ int fwnode_mdiobus_register_phy(struct mii_bus *bus, return 0; } EXPORT_SYMBOL(fwnode_mdiobus_register_phy); + +static int of_mdiobus_register_device(struct mii_bus *mdio, + struct device_node *child, u32 addr) +{ + struct fwnode_handle *fwnode = of_fwnode_handle(child); + struct mdio_device *mdiodev; + int rc; + + mdiodev = mdio_device_create(mdio, addr); + if (IS_ERR(mdiodev)) + return PTR_ERR(mdiodev); + + /* Associate the OF node with the device structure so it + * can be looked up later. + */ + fwnode_handle_get(fwnode); + device_set_node(&mdiodev->dev, fwnode); + + /* All data is now stored in the mdiodev struct; register it. */ + rc = mdio_device_register(mdiodev); + if (rc) { + mdio_device_free(mdiodev); + of_node_put(child); + return rc; + } + + dev_dbg(&mdio->dev, "registered mdio device %pOFn at address %i\n", + child, addr); + return 0; +} + +/* The following is a list of PHY compatible strings which appear in + * some DTBs. The compatible string is never matched against a PHY + * driver, so is pointless. We only expect devices which are not PHYs + * to have a compatible string, so they can be matched to an MDIO + * driver. Encourage users to upgrade their DT blobs to remove these. + */ +static const struct of_device_id whitelist_phys[] = { + { .compatible = "brcm,40nm-ephy" }, + { .compatible = "broadcom,bcm5241" }, + { .compatible = "marvell,88E1111", }, + { .compatible = "marvell,88e1116", }, + { .compatible = "marvell,88e1118", }, + { .compatible = "marvell,88e1145", }, + { .compatible = "marvell,88e1149r", }, + { .compatible = "marvell,88e1310", }, + { .compatible = "marvell,88E1510", }, + { .compatible = "marvell,88E1514", }, + { .compatible = "moxa,moxart-rtl8201cp", }, + {} +}; + +/* + * Return true if the child node is for a phy. It must either: + * o Compatible string of "ethernet-phy-idX.X" + * o Compatible string of "ethernet-phy-ieee802.3-c45" + * o Compatible string of "ethernet-phy-ieee802.3-c22" + * o In the white list above (and issue a warning) + * o No compatibility string + * + * A device which is not a phy is expected to have a compatible string + * indicating what sort of device it is. + */ +bool fwnode_mdiobus_child_is_phy(struct device_node *child) +{ + u32 phy_id; + + if (of_get_phy_id(child, &phy_id) != -EINVAL) + return true; + + if (of_device_is_compatible(child, "ethernet-phy-ieee802.3-c45")) + return true; + + if (of_device_is_compatible(child, "ethernet-phy-ieee802.3-c22")) + return true; + + if (of_match_node(whitelist_phys, child)) { + pr_warn(FW_WARN + "%pOF: Whitelisted compatible string. Please remove\n", + child); + return true; + } + + if (!of_find_property(child, "compatible", NULL)) + return true; + + return false; +} +EXPORT_SYMBOL(fwnode_mdiobus_child_is_phy); + +/** + * of_mdiobus_register - Register mii_bus and create PHYs from the device tree + * @mdio: pointer to mii_bus structure + * @np: pointer to device_node of MDIO bus. + * + * This function registers the mii_bus structure and registers a phy_device + * for each child node of @np. + */ +int fwnode_mdiobus_register(struct mii_bus *mdio, struct device_node *np) +{ + struct device_node *child; + bool scanphys = false; + int addr, rc; + + if (!np) + return mdiobus_register(mdio); + + /* Do not continue if the node is disabled */ + if (!of_device_is_available(np)) + return -ENODEV; + + /* Mask out all PHYs from auto probing. Instead the PHYs listed in + * the device tree are populated after the bus has been registered */ + mdio->phy_mask = ~0; + + device_set_node(&mdio->dev, of_fwnode_handle(np)); + + /* Get bus level PHY reset GPIO details */ + mdio->reset_delay_us = DEFAULT_GPIO_RESET_DELAY; + of_property_read_u32(np, "reset-delay-us", &mdio->reset_delay_us); + mdio->reset_post_delay_us = 0; + of_property_read_u32(np, "reset-post-delay-us", &mdio->reset_post_delay_us); + + /* Register the MDIO bus */ + rc = mdiobus_register(mdio); + if (rc) + return rc; + + /* Loop over the child nodes and register a phy_device for each phy */ + for_each_available_child_of_node(np, child) { + addr = of_mdio_parse_addr(&mdio->dev, child); + if (addr < 0) { + scanphys = true; + continue; + } + + if (of_mdiobus_child_is_phy(child)) + rc = fwnode_mdiobus_register_phy(mdio, + of_fwnode_handle(child), + addr); + else + rc = of_mdiobus_register_device(mdio, child, addr); + + if (rc == -ENODEV) + dev_err(&mdio->dev, + "MDIO device at address %d is missing.\n", + addr); + else if (rc) + goto unregister; + } + + if (!scanphys) + return 0; + + /* auto scan for PHYs with empty reg property */ + for_each_available_child_of_node(np, child) { + /* Skip PHYs with reg property set */ + if (of_find_property(child, "reg", NULL)) + continue; + + for (addr = 0; addr < PHY_MAX_ADDR; addr++) { + /* skip already registered PHYs */ + if (mdiobus_is_registered_device(mdio, addr)) + continue; + + /* be noisy to encourage people to set reg property */ + dev_info(&mdio->dev, "scan phy %pOFn at address %i\n", + child, addr); + + if (of_mdiobus_child_is_phy(child)) { + /* -ENODEV is the return code that PHYLIB has + * standardized on to indicate that bus + * scanning should continue. + */ + rc = fwnode_mdiobus_register_phy(mdio, + of_fwnode_handle(child), + addr); + if (!rc) + break; + if (rc != -ENODEV) + goto unregister; + } + } + } + + return 0; + +unregister: + mdiobus_unregister(mdio); + return rc; +} +EXPORT_SYMBOL(fwnode_mdiobus_register); From patchwork Thu Mar 31 09:25:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 12796919 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9CB19C43217 for ; Thu, 31 Mar 2022 09:27:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233881AbiCaJ2y (ORCPT ); Thu, 31 Mar 2022 05:28:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233874AbiCaJ2w (ORCPT ); Thu, 31 Mar 2022 05:28:52 -0400 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFBD21FDFFF; Thu, 31 Mar 2022 02:27:04 -0700 (PDT) Received: (Authenticated sender: clement.leger@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 3EABFE000A; Thu, 31 Mar 2022 09:27:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1648718823; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=T2SAnDYRLKVywNOeBXc/6UH8ACkBgPoznG9i7b/FYe8=; b=KA9NzZ4AxKHzsT8w4D5p/XfRp+qbxvC4Z5E4LZjJj2at4otRL2rG39ivBs9vvte+62lhhT v+C5ucCgtDvdqH8fZI7IM+P+SMIe490JBke9c++lumBISF8Chw9IFlFevbhPHllS7Oq4rY aD08QthH9ldkb0yaj7/ZEUMCJcGelr4YA8xWqf91n1JIXXKA2tu6wIvLuG0vbWHFHGFhwA 8w9MesAbeKbmItJDHPqZ6j9rZ+armNuQBp+Sz/EM6HvQeHge7FwwMJ6k82aTokbHkA1n3f YxOh/y8hdNrfR5P3W+rDaGr9Tl7HhKdvv2aW66c/tmekJVsJIbEhIrh8q3qcDA== From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: Andrew Lunn , Heiner Kallweit , Russell King , "David S . Miller" , Jakub Kicinski , Paolo Abeni Cc: Horatiu Vultur , Thomas Petazzoni , Alexandre Belloni , Allan Nielsen , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= Subject: [RFC PATCH net-next v2 02/11] net: mdio: fwnode: remove legacy compatible checking for phy child Date: Thu, 31 Mar 2022 11:25:24 +0200 Message-Id: <20220331092533.348626-3-clement.leger@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220331092533.348626-1-clement.leger@bootlin.com> References: <20220331092533.348626-1-clement.leger@bootlin.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Remove legacy checking for specific phy compatibles. Signed-off-by: Clément Léger --- drivers/net/mdio/fwnode_mdio.c | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/drivers/net/mdio/fwnode_mdio.c b/drivers/net/mdio/fwnode_mdio.c index a5a6fd9ebd94..17585c5b34bb 100644 --- a/drivers/net/mdio/fwnode_mdio.c +++ b/drivers/net/mdio/fwnode_mdio.c @@ -176,33 +176,11 @@ static int of_mdiobus_register_device(struct mii_bus *mdio, return 0; } -/* The following is a list of PHY compatible strings which appear in - * some DTBs. The compatible string is never matched against a PHY - * driver, so is pointless. We only expect devices which are not PHYs - * to have a compatible string, so they can be matched to an MDIO - * driver. Encourage users to upgrade their DT blobs to remove these. - */ -static const struct of_device_id whitelist_phys[] = { - { .compatible = "brcm,40nm-ephy" }, - { .compatible = "broadcom,bcm5241" }, - { .compatible = "marvell,88E1111", }, - { .compatible = "marvell,88e1116", }, - { .compatible = "marvell,88e1118", }, - { .compatible = "marvell,88e1145", }, - { .compatible = "marvell,88e1149r", }, - { .compatible = "marvell,88e1310", }, - { .compatible = "marvell,88E1510", }, - { .compatible = "marvell,88E1514", }, - { .compatible = "moxa,moxart-rtl8201cp", }, - {} -}; - /* * Return true if the child node is for a phy. It must either: * o Compatible string of "ethernet-phy-idX.X" * o Compatible string of "ethernet-phy-ieee802.3-c45" * o Compatible string of "ethernet-phy-ieee802.3-c22" - * o In the white list above (and issue a warning) * o No compatibility string * * A device which is not a phy is expected to have a compatible string @@ -221,13 +199,6 @@ bool fwnode_mdiobus_child_is_phy(struct device_node *child) if (of_device_is_compatible(child, "ethernet-phy-ieee802.3-c22")) return true; - if (of_match_node(whitelist_phys, child)) { - pr_warn(FW_WARN - "%pOF: Whitelisted compatible string. Please remove\n", - child); - return true; - } - if (!of_find_property(child, "compatible", NULL)) return true; From patchwork Thu Mar 31 09:25:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 12796921 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7C6EC433EF for ; Thu, 31 Mar 2022 09:27:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233895AbiCaJ27 (ORCPT ); Thu, 31 Mar 2022 05:28:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233879AbiCaJ2y (ORCPT ); Thu, 31 Mar 2022 05:28:54 -0400 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C41811FDFF5; Thu, 31 Mar 2022 02:27:05 -0700 (PDT) Received: (Authenticated sender: clement.leger@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 7ECE2E000F; Thu, 31 Mar 2022 09:27:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1648718824; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GPSyndh1tTrFYZd2ommChHstRrAw7UFBSUMhhD8Cfhk=; b=nmi9SS0ACqmwBMQWOjv1cnd0gcBFi3hcogsH29t4nMKKyTJIZU4Jhjy4e629RQNL5dnzb9 qa4hSmKnpyWzV+XanyAAkXoz4pumAhkA+yI1/EMrhj4c//MpgFoi98ISc5FRyv24qe5GrD oX2kzntEeZkZ64J0Me6LNqx8AWPtBpXn/gXKIEfDeqXyKMxtyy2SGroHQh+u40MPEzyLiY nSnUQmtfiYGOs2aF0aakMe1bAXwVTEyV5I/jV2GXVcHUqQQgYM6Hwnng+JxyYnLywQ3DuW VkaCje+UIJglSTbDtoGmudJcC/h+bijKgyJG4L1zI5o4lpzaMK+FeWKsAN/edw== From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: Andrew Lunn , Heiner Kallweit , Russell King , "David S . Miller" , Jakub Kicinski , Paolo Abeni Cc: Horatiu Vultur , Thomas Petazzoni , Alexandre Belloni , Allan Nielsen , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= Subject: [RFC PATCH net-next v2 03/11] net: mdio: fwnode: remove legacy phy scanning Date: Thu, 31 Mar 2022 11:25:25 +0200 Message-Id: <20220331092533.348626-4-clement.leger@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220331092533.348626-1-clement.leger@bootlin.com> References: <20220331092533.348626-1-clement.leger@bootlin.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC When 'reg' property is missing from child MDIO nodes, an automatic scan is done to find phy devices that are present on the bus. Since the 'reg' property is marked as required in the mdio.yaml bindings, remove this legacy scan mechanism. Signed-off-by: Clément Léger --- drivers/net/mdio/fwnode_mdio.c | 39 +--------------------------------- 1 file changed, 1 insertion(+), 38 deletions(-) diff --git a/drivers/net/mdio/fwnode_mdio.c b/drivers/net/mdio/fwnode_mdio.c index 17585c5b34bb..38c873c49ecf 100644 --- a/drivers/net/mdio/fwnode_mdio.c +++ b/drivers/net/mdio/fwnode_mdio.c @@ -217,7 +217,6 @@ EXPORT_SYMBOL(fwnode_mdiobus_child_is_phy); int fwnode_mdiobus_register(struct mii_bus *mdio, struct device_node *np) { struct device_node *child; - bool scanphys = false; int addr, rc; if (!np) @@ -247,10 +246,8 @@ int fwnode_mdiobus_register(struct mii_bus *mdio, struct device_node *np) /* Loop over the child nodes and register a phy_device for each phy */ for_each_available_child_of_node(np, child) { addr = of_mdio_parse_addr(&mdio->dev, child); - if (addr < 0) { - scanphys = true; + if (addr < 0) continue; - } if (of_mdiobus_child_is_phy(child)) rc = fwnode_mdiobus_register_phy(mdio, @@ -267,40 +264,6 @@ int fwnode_mdiobus_register(struct mii_bus *mdio, struct device_node *np) goto unregister; } - if (!scanphys) - return 0; - - /* auto scan for PHYs with empty reg property */ - for_each_available_child_of_node(np, child) { - /* Skip PHYs with reg property set */ - if (of_find_property(child, "reg", NULL)) - continue; - - for (addr = 0; addr < PHY_MAX_ADDR; addr++) { - /* skip already registered PHYs */ - if (mdiobus_is_registered_device(mdio, addr)) - continue; - - /* be noisy to encourage people to set reg property */ - dev_info(&mdio->dev, "scan phy %pOFn at address %i\n", - child, addr); - - if (of_mdiobus_child_is_phy(child)) { - /* -ENODEV is the return code that PHYLIB has - * standardized on to indicate that bus - * scanning should continue. - */ - rc = fwnode_mdiobus_register_phy(mdio, - of_fwnode_handle(child), - addr); - if (!rc) - break; - if (rc != -ENODEV) - goto unregister; - } - } - } - return 0; unregister: From patchwork Thu Mar 31 09:25:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 12796924 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0D488C433EF for ; Thu, 31 Mar 2022 09:27:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233936AbiCaJ3E (ORCPT ); Thu, 31 Mar 2022 05:29:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233905AbiCaJ25 (ORCPT ); Thu, 31 Mar 2022 05:28:57 -0400 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::224]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DDDE1FDFF0; Thu, 31 Mar 2022 02:27:07 -0700 (PDT) Received: (Authenticated sender: clement.leger@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 9D65DE0017; Thu, 31 Mar 2022 09:27:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1648718825; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZAsAunOpLPkQ8b/B+a3+vq5yr3haPngqm0snsGYNZBo=; b=MexrRSnmes7h6ade/vOQF08VQCEFR/SfObvSIqwl9bTwkrLvpWAqzzBBZscKnPeA3o5PPi Y5B+gDOO5a2zTymOjnImEdScoc1H7hBTxI+eGO4Auo3gIi0Gk9y4Tnn8f1inVvehpCbSRW uQ9YA+5iuHqILIu8bCZk5YTDSbJZJ6W2u7kVWIacFpsuBGCzllLlF7oIuL/6fEeyU7m50j p6y7uc0hzqf3SPPHrRKMATsUM0PJYjjRvk4ZLllwruYvGUQfHA4uNv7CxZsbY77PQoLyVJ 7o3GUmiOpCUSro0QPwtnlFQYKpLMG2XpMT4TC2aRF1FCgsyBX3ucPXDWCBZHFw== From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: Andrew Lunn , Heiner Kallweit , Russell King , "David S . Miller" , Jakub Kicinski , Paolo Abeni Cc: Horatiu Vultur , Thomas Petazzoni , Alexandre Belloni , Allan Nielsen , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= Subject: [RFC PATCH net-next v2 04/11] net: mdio: fwnode: convert fwnode_mdiobus_register() for fwnode Date: Thu, 31 Mar 2022 11:25:26 +0200 Message-Id: <20220331092533.348626-5-clement.leger@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220331092533.348626-1-clement.leger@bootlin.com> References: <20220331092533.348626-1-clement.leger@bootlin.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC First version was added as a simple copy of of_mdiobus_register() to allow compiling and being able to see the diff of modifications that are going to be done. This commits convert the code that was imported to handle a fwnode_handle properly. Signed-off-by: Clément Léger --- drivers/net/mdio/fwnode_mdio.c | 76 ++++++++++++++++++++++------------ 1 file changed, 50 insertions(+), 26 deletions(-) diff --git a/drivers/net/mdio/fwnode_mdio.c b/drivers/net/mdio/fwnode_mdio.c index 38c873c49ecf..319cccd0edeb 100644 --- a/drivers/net/mdio/fwnode_mdio.c +++ b/drivers/net/mdio/fwnode_mdio.c @@ -146,10 +146,9 @@ int fwnode_mdiobus_register_phy(struct mii_bus *bus, } EXPORT_SYMBOL(fwnode_mdiobus_register_phy); -static int of_mdiobus_register_device(struct mii_bus *mdio, - struct device_node *child, u32 addr) +static int fwnode_mdiobus_register_device(struct mii_bus *mdio, + struct fwnode_handle *child, u32 addr) { - struct fwnode_handle *fwnode = of_fwnode_handle(child); struct mdio_device *mdiodev; int rc; @@ -160,18 +159,18 @@ static int of_mdiobus_register_device(struct mii_bus *mdio, /* Associate the OF node with the device structure so it * can be looked up later. */ - fwnode_handle_get(fwnode); - device_set_node(&mdiodev->dev, fwnode); + fwnode_handle_get(child); + device_set_node(&mdiodev->dev, child); /* All data is now stored in the mdiodev struct; register it. */ rc = mdio_device_register(mdiodev); if (rc) { mdio_device_free(mdiodev); - of_node_put(child); + fwnode_handle_put(child); return rc; } - dev_dbg(&mdio->dev, "registered mdio device %pOFn at address %i\n", + dev_dbg(&mdio->dev, "registered mdio device %pfwP at address %i\n", child, addr); return 0; } @@ -186,26 +185,51 @@ static int of_mdiobus_register_device(struct mii_bus *mdio, * A device which is not a phy is expected to have a compatible string * indicating what sort of device it is. */ -bool fwnode_mdiobus_child_is_phy(struct device_node *child) +bool fwnode_mdiobus_child_is_phy(struct fwnode_handle *child) { u32 phy_id; - if (of_get_phy_id(child, &phy_id) != -EINVAL) + if (fwnode_get_phy_id(child, &phy_id) != -EINVAL) return true; - if (of_device_is_compatible(child, "ethernet-phy-ieee802.3-c45")) + if (fwnode_property_match_string(child, "compatible", + "ethernet-phy-ieee802.3-c45") >= 0) return true; - if (of_device_is_compatible(child, "ethernet-phy-ieee802.3-c22")) + if (fwnode_property_match_string(child, "compatible", + "ethernet-phy-ieee802.3-c22") >= 0) return true; - if (!of_find_property(child, "compatible", NULL)) + if (!fwnode_property_present(child, "compatible")) return true; return false; } EXPORT_SYMBOL(fwnode_mdiobus_child_is_phy); +int fwnode_mdio_parse_addr(struct device *dev, + const struct fwnode_handle *fwnode) +{ + u32 addr; + int ret; + + ret = fwnode_property_read_u32(fwnode, "reg", &addr); + if (ret < 0) { + dev_err(dev, "%pfwP has invalid PHY address\n", fwnode); + return ret; + } + + /* A PHY must have a reg property in the range [0-31] */ + if (addr >= PHY_MAX_ADDR) { + dev_err(dev, "%pfwP PHY address %i is too large\n", + fwnode, addr); + return -EINVAL; + } + + return addr; +} +EXPORT_SYMBOL(fwnode_mdio_parse_addr); + /** * of_mdiobus_register - Register mii_bus and create PHYs from the device tree * @mdio: pointer to mii_bus structure @@ -214,29 +238,31 @@ EXPORT_SYMBOL(fwnode_mdiobus_child_is_phy); * This function registers the mii_bus structure and registers a phy_device * for each child node of @np. */ -int fwnode_mdiobus_register(struct mii_bus *mdio, struct device_node *np) +int fwnode_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode) { - struct device_node *child; + struct fwnode_handle *child; int addr, rc; - if (!np) + if (!fwnode) return mdiobus_register(mdio); /* Do not continue if the node is disabled */ - if (!of_device_is_available(np)) + if (!fwnode_device_is_available(fwnode)) return -ENODEV; /* Mask out all PHYs from auto probing. Instead the PHYs listed in * the device tree are populated after the bus has been registered */ mdio->phy_mask = ~0; - device_set_node(&mdio->dev, of_fwnode_handle(np)); + device_set_node(&mdio->dev, fwnode); /* Get bus level PHY reset GPIO details */ mdio->reset_delay_us = DEFAULT_GPIO_RESET_DELAY; - of_property_read_u32(np, "reset-delay-us", &mdio->reset_delay_us); + fwnode_property_read_u32(fwnode, "reset-delay-us", + &mdio->reset_delay_us); mdio->reset_post_delay_us = 0; - of_property_read_u32(np, "reset-post-delay-us", &mdio->reset_post_delay_us); + fwnode_property_read_u32(fwnode, "reset-post-delay-us", + &mdio->reset_post_delay_us); /* Register the MDIO bus */ rc = mdiobus_register(mdio); @@ -244,17 +270,15 @@ int fwnode_mdiobus_register(struct mii_bus *mdio, struct device_node *np) return rc; /* Loop over the child nodes and register a phy_device for each phy */ - for_each_available_child_of_node(np, child) { - addr = of_mdio_parse_addr(&mdio->dev, child); + fwnode_for_each_available_child_node(fwnode, child) { + addr = fwnode_mdio_parse_addr(&mdio->dev, child); if (addr < 0) continue; - if (of_mdiobus_child_is_phy(child)) - rc = fwnode_mdiobus_register_phy(mdio, - of_fwnode_handle(child), - addr); + if (fwnode_mdiobus_child_is_phy(child)) + rc = fwnode_mdiobus_register_phy(mdio, child, addr); else - rc = of_mdiobus_register_device(mdio, child, addr); + rc = fwnode_mdiobus_register_device(mdio, child, addr); if (rc == -ENODEV) dev_err(&mdio->dev, From patchwork Thu Mar 31 09:25:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 12796923 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B222DC433F5 for ; Thu, 31 Mar 2022 09:27:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233928AbiCaJ3C (ORCPT ); Thu, 31 Mar 2022 05:29:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233903AbiCaJ25 (ORCPT ); Thu, 31 Mar 2022 05:28:57 -0400 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::224]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DA621FDFEC; Thu, 31 Mar 2022 02:27:08 -0700 (PDT) Received: (Authenticated sender: clement.leger@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 05909E001B; Thu, 31 Mar 2022 09:27:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1648718826; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mAGZigtkZzL3mxPDdsEnCyO5sPgES6vv2TqNmxRAREg=; b=UzE5Z7JCUE/E3r0ifA8zH7H+aQnHw9ve95hqnKOgLXHMkNpe2gzQCdcNqi6ed0YeTw4llH Mb6TNjnh7qfna9hDfMuyJ0toEk5Uz47z5W7G/QTHI2abB77Jk3xpoB+nGA5ZIY7Kk/V+Av vGVrDtAdKfOvfi1nrFEmumLHNGr/2qCsM3EITT3eq+NX7NmDkqYNL6z7ufXzdrRspdyEAg wUNwN8xU8QvsMnnv5KWRWDY8XLZANPCWwG9igmF3P4S98ZpzqaU40AEligOiAiax72SGFW vqgVW9vbqHvuqtIEthh7xf5xRgxoxTIrVYSDBXTc4cKXN3wGemPT8CVAyKFlCg== From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: Andrew Lunn , Heiner Kallweit , Russell King , "David S . Miller" , Jakub Kicinski , Paolo Abeni Cc: Horatiu Vultur , Thomas Petazzoni , Alexandre Belloni , Allan Nielsen , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= Subject: [RFC PATCH net-next v2 05/11] net: mdio: fwnode: add fwnode_mdiobus_register() Date: Thu, 31 Mar 2022 11:25:27 +0200 Message-Id: <20220331092533.348626-6-clement.leger@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220331092533.348626-1-clement.leger@bootlin.com> References: <20220331092533.348626-1-clement.leger@bootlin.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC In order to support software node description transparently, add fwnode support with fwnode_mdiobus_register(). This function behaves exactly like of_mdiobus_register() function but using the fwnode node agnostic API. This support might also be used to merge ACPI mdiobus support which is quite similar to the fwnode one. Some part such as the whitelist matching are kept exclusively for OF nodes since it uses an of_device_id struct and seems tightly coupled with OF. Other parts are generic and will allow to move the existing OF support on top of this fwnode version. Signed-off-by: Clément Léger --- include/linux/fwnode_mdio.h | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/include/linux/fwnode_mdio.h b/include/linux/fwnode_mdio.h index faf603c48c86..cc50a0833a43 100644 --- a/include/linux/fwnode_mdio.h +++ b/include/linux/fwnode_mdio.h @@ -9,6 +9,9 @@ #include #if IS_ENABLED(CONFIG_FWNODE_MDIO) +int fwnode_mdio_parse_addr(struct device *dev, + const struct fwnode_handle *fwnode); +bool fwnode_mdiobus_child_is_phy(struct fwnode_handle *child); int fwnode_mdiobus_phy_device_register(struct mii_bus *mdio, struct phy_device *phy, struct fwnode_handle *child, u32 addr); @@ -16,10 +19,23 @@ int fwnode_mdiobus_phy_device_register(struct mii_bus *mdio, int fwnode_mdiobus_register_phy(struct mii_bus *bus, struct fwnode_handle *child, u32 addr); +int fwnode_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode); #else /* CONFIG_FWNODE_MDIO */ -int fwnode_mdiobus_phy_device_register(struct mii_bus *mdio, - struct phy_device *phy, - struct fwnode_handle *child, u32 addr) + +static inline int fwnode_mdio_parse_addr(struct device *dev, + const struct fwnode_handle *fwnode) +{ + return -EINVAL; +} + +static inline bool fwnode_mdiobus_child_is_phy(struct fwnode_handle *child) +{ + return false; +} + +static inline int +fwnode_mdiobus_phy_device_register(struct mii_bus *mdio, struct phy_device *phy, + struct fwnode_handle *child, u32 addr) { return -EINVAL; } @@ -30,6 +46,12 @@ static inline int fwnode_mdiobus_register_phy(struct mii_bus *bus, { return -EINVAL; } + +static inline int fwnode_mdiobus_register(struct mii_bus *mdio, + struct fwnode_handle *fwnode) +{ + return -EINVAL; +} #endif #endif /* __LINUX_FWNODE_MDIO_H */ From patchwork Thu Mar 31 09:25:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 12796922 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76334C433FE for ; Thu, 31 Mar 2022 09:27:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233921AbiCaJ3B (ORCPT ); Thu, 31 Mar 2022 05:29:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233894AbiCaJ25 (ORCPT ); Thu, 31 Mar 2022 05:28:57 -0400 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::224]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F09331FDFFA; Thu, 31 Mar 2022 02:27:09 -0700 (PDT) Received: (Authenticated sender: clement.leger@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 19EC3E0004; Thu, 31 Mar 2022 09:27:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1648718828; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/U4ywy2HHlrXB5mkjwH0y2BuGQP4lKAiCmY1p7B8gk4=; b=j2twj0+ThaBbKyaGJJifzdDEBKrLwMnTa+omXGQgZVfvZ8LkJjvJdA59TAZq+6ILjxzwCS FzIEh0/OMQxHOiQxwt9/wumisvXwivDklpWIsnKuHaa7Z6MmDVNxSJHbtcvcTSO3nk4dna sl30G5tEee4jV5Ev1Y0fiCcTpZjR45ZB2zWgGRayy+D/kaLch/odoSKVGnl9skBVivyMZ8 HMQQBsTlJVoQvBHnaJxlQnhyuJEzZ7DQQ4Icv+2y/cOzk9YzuHtJqIt0iT1WowD36V+QKm MS6ikvXkZJFpOm1HRRYBBvsbfsVMSfKSl3i0Mgljy8oEuL/RhQjKpLzrCrJ7SQ== From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: Andrew Lunn , Heiner Kallweit , Russell King , "David S . Miller" , Jakub Kicinski , Paolo Abeni Cc: Horatiu Vultur , Thomas Petazzoni , Alexandre Belloni , Allan Nielsen , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= Subject: [RFC PATCH net-next v2 06/11] net: mdio: of: wrap fwnode_mdio_parse_addr() in of_mdio_parse_addr() Date: Thu, 31 Mar 2022 11:25:28 +0200 Message-Id: <20220331092533.348626-7-clement.leger@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220331092533.348626-1-clement.leger@bootlin.com> References: <20220331092533.348626-1-clement.leger@bootlin.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Since function fwnode_mdio_parse_addr() returns the same value that is done by of_mdio_parse_addr() and has the same behavior, wrap the first one. The function was switched as non static in of_mdio.c to avoid including fwnode_mdio.h in of_mdio.h. Signed-off-by: Clément Léger --- drivers/net/mdio/of_mdio.c | 6 ++++++ include/linux/of_mdio.h | 23 +---------------------- 2 files changed, 7 insertions(+), 22 deletions(-) diff --git a/drivers/net/mdio/of_mdio.c b/drivers/net/mdio/of_mdio.c index 9e3c815a070f..b8fc1245048e 100644 --- a/drivers/net/mdio/of_mdio.c +++ b/drivers/net/mdio/of_mdio.c @@ -26,6 +26,12 @@ MODULE_AUTHOR("Grant Likely "); MODULE_LICENSE("GPL"); +int of_mdio_parse_addr(struct device *dev, const struct device_node *np) +{ + return fwnode_mdio_parse_addr(dev, of_fwnode_handle(np)); +} +EXPORT_SYMBOL(of_mdio_parse_addr); + /* Extract the clause 22 phy ID from the compatible string of the form * ethernet-phy-idAAAA.BBBB */ static int of_get_phy_id(struct device_node *device, u32 *phy_id) diff --git a/include/linux/of_mdio.h b/include/linux/of_mdio.h index da633d34ab86..1de67a1e5cd7 100644 --- a/include/linux/of_mdio.h +++ b/include/linux/of_mdio.h @@ -33,28 +33,7 @@ void of_phy_deregister_fixed_link(struct device_node *np); bool of_phy_is_fixed_link(struct device_node *np); int of_mdiobus_phy_device_register(struct mii_bus *mdio, struct phy_device *phy, struct device_node *child, u32 addr); - -static inline int of_mdio_parse_addr(struct device *dev, - const struct device_node *np) -{ - u32 addr; - int ret; - - ret = of_property_read_u32(np, "reg", &addr); - if (ret < 0) { - dev_err(dev, "%s has invalid PHY address\n", np->full_name); - return ret; - } - - /* A PHY must have a reg property in the range [0-31] */ - if (addr >= PHY_MAX_ADDR) { - dev_err(dev, "%s PHY address %i is too large\n", - np->full_name, addr); - return -EINVAL; - } - - return addr; -} +int of_mdio_parse_addr(struct device *dev, const struct device_node *np); #else /* CONFIG_OF_MDIO */ static inline bool of_mdiobus_child_is_phy(struct device_node *child) From patchwork Thu Mar 31 09:25:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 12796925 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 12F90C433F5 for ; Thu, 31 Mar 2022 09:27:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233915AbiCaJ3K (ORCPT ); Thu, 31 Mar 2022 05:29:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233912AbiCaJ26 (ORCPT ); Thu, 31 Mar 2022 05:28:58 -0400 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::224]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 644C71FE54A; Thu, 31 Mar 2022 02:27:11 -0700 (PDT) Received: (Authenticated sender: clement.leger@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id AC3EAE000F; Thu, 31 Mar 2022 09:27:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1648718829; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BuDSDO88o7atqIGVoL9C6aHASrXbNomtgMOGVQ4YA10=; b=mMLR39R09x84Dw/csEYTSKv3YuLZaAyi0yFRHTEWxtBobiMdoNEJ04YeiDEIL4Tutvd39P hiRVP6TM0TYZ/N3616CQ2tTSI/4Y/UhtozuuYnuDd0gYQQI6DGsROc6t+WjijCq8a8bmpv g4WbtFNVsDWd0Xit8n/pYwozGOWyLMI+kq7dn9Prm2E4IXScwG0ZJVYB0d6Z8gynh/kymV 6sG5HBxb5rhR1RKEXpQpKK30Qmh8dFlgFeuQYWAbDUf2SdZeRx/pN+OIxJzOQgAhicLYzF c1bpd5CRqhuc+XuEVBDfBIjwS14URCZzWe/EAjPyd8ux6W73fXQJVru4xFY4Mg== From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: Andrew Lunn , Heiner Kallweit , Russell King , "David S . Miller" , Jakub Kicinski , Paolo Abeni Cc: Horatiu Vultur , Thomas Petazzoni , Alexandre Belloni , Allan Nielsen , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= Subject: [RFC PATCH net-next v2 07/11] net: mdio: fwnode: avoid calling of_* functions with non OF nodes Date: Thu, 31 Mar 2022 11:25:29 +0200 Message-Id: <20220331092533.348626-8-clement.leger@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220331092533.348626-1-clement.leger@bootlin.com> References: <20220331092533.348626-1-clement.leger@bootlin.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Without this check, of_parse_phandle_with_fixed_args() will be called with whatever the type of the node. Use !is_of_node() which will work for all node types supported by the fwnode API (ACPI, software nodes). Signed-off-by: Clément Léger --- drivers/net/mdio/fwnode_mdio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/mdio/fwnode_mdio.c b/drivers/net/mdio/fwnode_mdio.c index 319cccd0edeb..26aeb248e3b9 100644 --- a/drivers/net/mdio/fwnode_mdio.c +++ b/drivers/net/mdio/fwnode_mdio.c @@ -23,7 +23,7 @@ fwnode_find_mii_timestamper(struct fwnode_handle *fwnode) struct of_phandle_args arg; int err; - if (is_acpi_node(fwnode)) + if (!is_of_node(fwnode)) return NULL; err = of_parse_phandle_with_fixed_args(to_of_node(fwnode), From patchwork Thu Mar 31 09:25:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 12796926 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53E29C433F5 for ; Thu, 31 Mar 2022 09:27:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233994AbiCaJ3Y (ORCPT ); Thu, 31 Mar 2022 05:29:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233867AbiCaJ27 (ORCPT ); Thu, 31 Mar 2022 05:28:59 -0400 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 712DF1FD2DB; Thu, 31 Mar 2022 02:27:12 -0700 (PDT) Received: (Authenticated sender: clement.leger@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 1E212E001A; Thu, 31 Mar 2022 09:27:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1648718831; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SuDs+4vm0hGLpYE7vR9fD1uE2I+kfm+ItNZWNP+AIFM=; b=gTqBYSYJcAzspdtKr8G33BSeqHeP89ljEdumg34xI3dyDS/qQgncWyrtKse+NryWWbk4XP uZ6e06HwirwjZneoE53cdfKsbyjzDMsWDTMlygdWVQsQEgm6Do+D/8L1fpn/YMJepwL67D EK3dauZWeZF//HBkccGzm3+FDPCl5NYefIUWfrf2r3kZuGzuqPAxHYN/Lrg/4p4hQxv6ip H6xsfyvD5RIDh0wue+6ZHD4Wx9IW0uRWfV5POqPttzAQyn7glEpE9PkdQH0YMMFaRWGXxX pGaVPRRNfenJ8ceTxizNOmj3/m6HBi3Ui410Y5uAxNAd4i63qfav415sL0+5ww== From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: Andrew Lunn , Heiner Kallweit , Russell King , "David S . Miller" , Jakub Kicinski , Paolo Abeni Cc: Horatiu Vultur , Thomas Petazzoni , Alexandre Belloni , Allan Nielsen , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= Subject: [RFC PATCH net-next v2 08/11] net: mdio: fwnode: allow phy device registration with non OF nodes Date: Thu, 31 Mar 2022 11:25:30 +0200 Message-Id: <20220331092533.348626-9-clement.leger@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220331092533.348626-1-clement.leger@bootlin.com> References: <20220331092533.348626-1-clement.leger@bootlin.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC When using a software node, we also want to call fwnode_mdiobus_phy_device_register() which support all nodes type. Remove the is_of_node() check to allow that. Signed-off-by: Clément Léger --- drivers/net/mdio/fwnode_mdio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/mdio/fwnode_mdio.c b/drivers/net/mdio/fwnode_mdio.c index 26aeb248e3b9..3aa599890e29 100644 --- a/drivers/net/mdio/fwnode_mdio.c +++ b/drivers/net/mdio/fwnode_mdio.c @@ -127,7 +127,7 @@ int fwnode_mdiobus_register_phy(struct mii_bus *bus, fwnode_handle_put(phy->mdio.dev.fwnode); return rc; } - } else if (is_of_node(child)) { + } else { rc = fwnode_mdiobus_phy_device_register(bus, phy, child, addr); if (rc) { unregister_mii_timestamper(mii_ts); From patchwork Thu Mar 31 09:25:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 12796927 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB3CDC433FE for ; Thu, 31 Mar 2022 09:27:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234010AbiCaJ30 (ORCPT ); Thu, 31 Mar 2022 05:29:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233938AbiCaJ3H (ORCPT ); Thu, 31 Mar 2022 05:29:07 -0400 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::224]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D54FE1FE542; Thu, 31 Mar 2022 02:27:13 -0700 (PDT) Received: (Authenticated sender: clement.leger@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 55D90E0011; Thu, 31 Mar 2022 09:27:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1648718832; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Gl1iH0q2B0anl+aCK0/ljXsI9xlWsyssFxKF0grQmb4=; b=mouSqiOtzXTm7l+zTduxYuOFFzez059fBlSaf0kCcXS5lk6PkrtiVi8nnAc28ExeLbxlu/ tBNESuQjkVlIIawn7GEhKVzOTBaQ89pclfJ0vIwJZ717wkT3f7E9c4PNoRA2kx2BxZMcYz sg0zWs/IVKaLrxp3r3hrXtzX9cODK7EGxhmEshpoNa+fHp5LLuGWDQdM12Lwo6TVSUw6Ta DEngwFQFWHnXremY3pjxZKhtEkW2xxlFzOG3qgGtuvuUXMZ5HN5CjtKNGVPqhAXZWd8qZZ GGBuXVwe1rCJfMMz7bd1O5gVGCWok80GKFuG0WogLDtBVCou5mEq/RZY0BrSEg== From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: Andrew Lunn , Heiner Kallweit , Russell King , "David S . Miller" , Jakub Kicinski , Paolo Abeni Cc: Horatiu Vultur , Thomas Petazzoni , Alexandre Belloni , Allan Nielsen , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= Subject: [RFC PATCH net-next v2 09/11] net: mdio: of: use fwnode_mdiobus_child_is_phy() Date: Thu, 31 Mar 2022 11:25:31 +0200 Message-Id: <20220331092533.348626-10-clement.leger@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220331092533.348626-1-clement.leger@bootlin.com> References: <20220331092533.348626-1-clement.leger@bootlin.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Since fwnode_mdiobus_child_is_phy() does almost the same filtering than done by of_mdiobus_child_is_phy() except the legacy OF compatible list checking, modify the later one to use the fwnode variant. However, keep the legacy compatible list checking for legacy purpose. Signed-off-by: Clément Léger --- drivers/net/mdio/of_mdio.c | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/drivers/net/mdio/of_mdio.c b/drivers/net/mdio/of_mdio.c index b8fc1245048e..9c3cd8d3d1f6 100644 --- a/drivers/net/mdio/of_mdio.c +++ b/drivers/net/mdio/of_mdio.c @@ -32,13 +32,6 @@ int of_mdio_parse_addr(struct device *dev, const struct device_node *np) } EXPORT_SYMBOL(of_mdio_parse_addr); -/* Extract the clause 22 phy ID from the compatible string of the form - * ethernet-phy-idAAAA.BBBB */ -static int of_get_phy_id(struct device_node *device, u32 *phy_id) -{ - return fwnode_get_phy_id(of_fwnode_handle(device), phy_id); -} - int of_mdiobus_phy_device_register(struct mii_bus *mdio, struct phy_device *phy, struct device_node *child, u32 addr) { @@ -118,17 +111,6 @@ static const struct of_device_id whitelist_phys[] = { */ bool of_mdiobus_child_is_phy(struct device_node *child) { - u32 phy_id; - - if (of_get_phy_id(child, &phy_id) != -EINVAL) - return true; - - if (of_device_is_compatible(child, "ethernet-phy-ieee802.3-c45")) - return true; - - if (of_device_is_compatible(child, "ethernet-phy-ieee802.3-c22")) - return true; - if (of_match_node(whitelist_phys, child)) { pr_warn(FW_WARN "%pOF: Whitelisted compatible string. Please remove\n", @@ -136,10 +118,7 @@ bool of_mdiobus_child_is_phy(struct device_node *child) return true; } - if (!of_find_property(child, "compatible", NULL)) - return true; - - return false; + return fwnode_mdiobus_child_is_phy(of_fwnode_handle(child)); } EXPORT_SYMBOL(of_mdiobus_child_is_phy); From patchwork Thu Mar 31 09:25:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 12796933 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8AED9C433F5 for ; Thu, 31 Mar 2022 09:27:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234028AbiCaJ3f (ORCPT ); Thu, 31 Mar 2022 05:29:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233948AbiCaJ3I (ORCPT ); Thu, 31 Mar 2022 05:29:08 -0400 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11A8A1FE55E; Thu, 31 Mar 2022 02:27:14 -0700 (PDT) Received: (Authenticated sender: clement.leger@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id A00B5E001C; Thu, 31 Mar 2022 09:27:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1648718833; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Pjh1w4KsWjwbxRE8gzfuyRP+hgAL8kEMAJVXPRugr/0=; b=LfHoCHRWQKU+kWPmYEjxgCwvaMz+Vhtk392+KxdWo5M0jpaykc8TIQ4wqQiknqIXAPY1eg uELUZrVLIJHjXj/SqrVXtE5aMoY0kn+QlN5RyZfP8f7tOi0D358bZlGAbNCjd8N/qtpK9c QMD20fFsmNinM11Twx3w/iS3a9L3q4aOsXKhs6EythL+UOPlynXiP3gaPbkYJrev7y0g2a KxzbHf+ZjzRFIJtSU2vST/hpkZHkyipqYpsh0+d5Rve2zAx39SkD18S8ZFoh5Yq3AS3sdu 8Ajr+kU4jWoDCd6QnWV6mBEoOVLRn+uDXpIlExtqgDSmC20DnzDHxB4C7HINWQ== From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: Andrew Lunn , Heiner Kallweit , Russell King , "David S . Miller" , Jakub Kicinski , Paolo Abeni Cc: Horatiu Vultur , Thomas Petazzoni , Alexandre Belloni , Allan Nielsen , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= Subject: [RFC PATCH net-next v2 10/11] net: mdio: of: use fwnode_mdiobus_register() in of_mdiobus_register() Date: Thu, 31 Mar 2022 11:25:32 +0200 Message-Id: <20220331092533.348626-11-clement.leger@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220331092533.348626-1-clement.leger@bootlin.com> References: <20220331092533.348626-1-clement.leger@bootlin.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Now that fwnode_mdiobus_register() also handle phy registration, modify of_mdiobus_register() to use this one but keep ilegacy scanning of nodes that don't have a "reg" property. The behavior is a bit different since the scanning loop will always be executed even if all nodes have a "reg" property. However, since the "reg" property is checked in that loop, the final outcome will be the same (ie scan only the node that don't have a "reg" property). Since of_mdiobus_register_device() is not used anymore, remove it. Signed-off-by: Clément Léger --- drivers/net/mdio/of_mdio.c | 77 +------------------------------------- 1 file changed, 1 insertion(+), 76 deletions(-) diff --git a/drivers/net/mdio/of_mdio.c b/drivers/net/mdio/of_mdio.c index 9c3cd8d3d1f6..4a7ad6704feb 100644 --- a/drivers/net/mdio/of_mdio.c +++ b/drivers/net/mdio/of_mdio.c @@ -47,36 +47,6 @@ static int of_mdiobus_register_phy(struct mii_bus *mdio, return fwnode_mdiobus_register_phy(mdio, of_fwnode_handle(child), addr); } -static int of_mdiobus_register_device(struct mii_bus *mdio, - struct device_node *child, u32 addr) -{ - struct fwnode_handle *fwnode = of_fwnode_handle(child); - struct mdio_device *mdiodev; - int rc; - - mdiodev = mdio_device_create(mdio, addr); - if (IS_ERR(mdiodev)) - return PTR_ERR(mdiodev); - - /* Associate the OF node with the device structure so it - * can be looked up later. - */ - fwnode_handle_get(fwnode); - device_set_node(&mdiodev->dev, fwnode); - - /* All data is now stored in the mdiodev struct; register it. */ - rc = mdio_device_register(mdiodev); - if (rc) { - mdio_device_free(mdiodev); - of_node_put(child); - return rc; - } - - dev_dbg(&mdio->dev, "registered mdio device %pOFn at address %i\n", - child, addr); - return 0; -} - /* The following is a list of PHY compatible strings which appear in * some DTBs. The compatible string is never matched against a PHY * driver, so is pointless. We only expect devices which are not PHYs @@ -133,57 +103,12 @@ EXPORT_SYMBOL(of_mdiobus_child_is_phy); int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) { struct device_node *child; - bool scanphys = false; int addr, rc; - if (!np) - return mdiobus_register(mdio); - - /* Do not continue if the node is disabled */ - if (!of_device_is_available(np)) - return -ENODEV; - - /* Mask out all PHYs from auto probing. Instead the PHYs listed in - * the device tree are populated after the bus has been registered */ - mdio->phy_mask = ~0; - - device_set_node(&mdio->dev, of_fwnode_handle(np)); - - /* Get bus level PHY reset GPIO details */ - mdio->reset_delay_us = DEFAULT_GPIO_RESET_DELAY; - of_property_read_u32(np, "reset-delay-us", &mdio->reset_delay_us); - mdio->reset_post_delay_us = 0; - of_property_read_u32(np, "reset-post-delay-us", &mdio->reset_post_delay_us); - - /* Register the MDIO bus */ - rc = mdiobus_register(mdio); + rc = fwnode_mdiobus_register(mdio, of_fwnode_handle(np)); if (rc) return rc; - /* Loop over the child nodes and register a phy_device for each phy */ - for_each_available_child_of_node(np, child) { - addr = of_mdio_parse_addr(&mdio->dev, child); - if (addr < 0) { - scanphys = true; - continue; - } - - if (of_mdiobus_child_is_phy(child)) - rc = of_mdiobus_register_phy(mdio, child, addr); - else - rc = of_mdiobus_register_device(mdio, child, addr); - - if (rc == -ENODEV) - dev_err(&mdio->dev, - "MDIO device at address %d is missing.\n", - addr); - else if (rc) - goto unregister; - } - - if (!scanphys) - return 0; - /* auto scan for PHYs with empty reg property */ for_each_available_child_of_node(np, child) { /* Skip PHYs with reg property set */ From patchwork Thu Mar 31 09:25:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 12796934 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9C1EC433F5 for ; Thu, 31 Mar 2022 09:28:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234065AbiCaJaI (ORCPT ); Thu, 31 Mar 2022 05:30:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232580AbiCaJ3X (ORCPT ); Thu, 31 Mar 2022 05:29:23 -0400 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::224]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D9D51FF205; Thu, 31 Mar 2022 02:27:16 -0700 (PDT) Received: (Authenticated sender: clement.leger@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id CB1E7E000F; Thu, 31 Mar 2022 09:27:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1648718834; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kVAzqr5qEkiVW+zEGfSJDKuaqlr/tvNfR2dtI854pn4=; b=EVi6FWuzBV7PFfbMzBkBpd7Ebu7+qVF5BInbfb9Pm1pgsRpcyFDoiS/fjEo7BCC/iWjsnJ h+4wbf2OsPzKyELKwpOg0vDG2gzVQ3gQKv037dgLxpqCmSLpb1/lowCn9ZhiM315IrTb3Y J9gVGxIcnKeQnaH1LqoIb4xzSoWZeQHJWXKgkmiT57t78sY30m8vhBwNxxQsyJXFvS46GD NNV3flj69eYotlUQJ523MAYZrM8chMYQ5Q5HknOdBCSwrs4iW7TTZFnMKsQeC7+M6RmpQ1 q2TvNoP1EycW4K5B+IqF4uWT5c2/LklpG1PO0chw1iPHpovv/6nXgB+ypubCLw== From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: Andrew Lunn , Heiner Kallweit , Russell King , "David S . Miller" , Jakub Kicinski , Paolo Abeni Cc: Horatiu Vultur , Thomas Petazzoni , Alexandre Belloni , Allan Nielsen , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= Subject: [RFC PATCH net-next v2 11/11] net: mdio: mscc-miim: use fwnode_mdiobus_register() Date: Thu, 31 Mar 2022 11:25:33 +0200 Message-Id: <20220331092533.348626-12-clement.leger@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220331092533.348626-1-clement.leger@bootlin.com> References: <20220331092533.348626-1-clement.leger@bootlin.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Use fwnode_mdiobus_register() to be compatible with devices described with device-tree and software nodes. Signed-off-by: Clément Léger --- drivers/net/mdio/mdio-mscc-miim.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/mdio/mdio-mscc-miim.c b/drivers/net/mdio/mdio-mscc-miim.c index c483ba67c21f..ea79421fcfd4 100644 --- a/drivers/net/mdio/mdio-mscc-miim.c +++ b/drivers/net/mdio/mdio-mscc-miim.c @@ -7,12 +7,12 @@ */ #include +#include #include #include #include #include #include -#include #include #include #include @@ -288,7 +288,7 @@ static int mscc_miim_probe(struct platform_device *pdev) if (!miim->info) return -EINVAL; - ret = of_mdiobus_register(bus, pdev->dev.of_node); + ret = fwnode_mdiobus_register(bus, dev_fwnode(&pdev->dev)); if (ret < 0) { dev_err(&pdev->dev, "Cannot register MDIO bus (%d)\n", ret); return ret;