Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4182156pxb; Mon, 8 Feb 2021 09:48:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJwWX0Z74o+8ju2prSXeL8lkAl9L0B4/B9+YOJGtATKUL/ja3PNlgrUnZQ4jnCcUqTkvKuh4 X-Received: by 2002:a17:906:fa98:: with SMTP id lt24mr17932402ejb.213.1612806529360; Mon, 08 Feb 2021 09:48:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1612806529; cv=pass; d=google.com; s=arc-20160816; b=S/rO+Q0L1beB5ceEMimzVlaMiVhpsAybybee0XQF3S7VWDgwPB59BGOyds5bQyAKbg sdvFm7I3bR+Ui2MY9Lof0uMKKryqi0CAJ8lk2exJYrh5FomkgS1GHktLYyTRRcne0D5l tsjfcRE4ibK1kDox1CEhLdqkEU3Uhwl15wvseQwbbcFZPxfIRnRxXqzIegrF1Cihpwuh mRLzYCiC7Qtfs3FFpG9pymv8grM+Cu7YmjgG7MDCjryATLm7aiqAmkd8kNrIv1+Gbrwq 9Lli9x+akrGANu9VAD00ZjhZbeYHj6NXxHP6H8mZ8mg6cFCIH6nFeeMksDeqMPxQQU5d iSPQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=FGUENR71cDvFAMcLpUQut8kDNaJm/+Wm7e7kJwuSAnY=; b=Cy3jPxQoHR6BE71Kxn0rAUWwxPKZB0BbH6ZzmeKApIxxDLRXsHFqfBt1ukTiY+cbpL xAyNJuoWh9dC6LHRnPAu55o8XW4ytT8O4zgdl9lMAK77Zi9CDljE6evnKjlD3YYYCkP1 SiI8Vyuqs3eKDjhgt0jA37NLrV1nyEc1z1JFjD13tq0Dz/Rb6ddTbgUEpizAlh65h6Hs 0cKKQGi5ruGP+rSYY9ok3qizsfkRlz6E+Yr1LHpRxWgrmWD8K9cJSM7pOPmSSGN9+Yeo fbgQLNhOoIbNu/EX3f2KheWlvL6HrE/zzpBQOOnRBL/zmop1Jy1yCkjbupr4qA7s0Usf A7jg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=LUgDfYqp; arc=pass (i=1 spf=pass spfdomain=oss.nxp.com dkim=pass dkdomain=oss.nxp.com dmarc=pass fromdomain=oss.nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id fx12si2692209ejb.286.2021.02.08.09.48.23; Mon, 08 Feb 2021 09:48:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=LUgDfYqp; arc=pass (i=1 spf=pass spfdomain=oss.nxp.com dkim=pass dkdomain=oss.nxp.com dmarc=pass fromdomain=oss.nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233727AbhBHRpK (ORCPT + 99 others); Mon, 8 Feb 2021 12:45:10 -0500 Received: from mail-db8eur05on2054.outbound.protection.outlook.com ([40.107.20.54]:24577 "EHLO EUR05-DB8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233613AbhBHPRr (ORCPT ); Mon, 8 Feb 2021 10:17:47 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NPIrCvoUFDTugwGtdmKsb5DL0Ighw8rAt02ySnxsDnzqrALzB5B6AcMRF7v5dMeo4yhj/vAb9kT5oHvqF5VIuqBTAOTjKCd73s1FsnIAIdXaDwt5i60cUOClHtnncFTqZqjH1Y7LsHb0SIaPhqcDt+zTKNoWVe5oWiCWUDoaZt8k+wkQUjwxViffotsdcH6jzMNtLzHMHojP1JKe1wJE61Mmg3aEQ0r4NDvjg3SKsWb1LXKqR7hXfRHMQSAJAtpT2TBucuYJ2dxuXbuEJUrEiC80cAhZdYwRJVTTHAHNEoJ09fbY21SAFtYyUt/unIsJLHhv67+pPp3MQMf0IzaEHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FGUENR71cDvFAMcLpUQut8kDNaJm/+Wm7e7kJwuSAnY=; b=cy/7RVfULdX8U4k/Ousy+OEP/EFVpcF6bDsaxZs/qCJUQf31v3ObYvS2GvVFfN+pAQQTxfMxCmP05pmxKdWPeJbHVLDydu6N9NkaP7NaTnPl8oRpk5zIuLhK8DCY+fvJpzDi7ajwmSmlGrCXK8E+pFSghPcasJp0w4tzzda37IDWuP0JQFpS8SdGwAXzjLfWLvm5cRhlHDEbWLi9c27vo9faodBFVhzPgqG8U2wk7LdO08piwmxnkeaxO54uxGY0wjDVcvN3oIJbwMY6XdxDPqfxU5YJ67cDgbJ9Gbc9ZX9G5XWOM5CZTlnZRgYzAcchgpXW00SafS05A5B3xLBquA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FGUENR71cDvFAMcLpUQut8kDNaJm/+Wm7e7kJwuSAnY=; b=LUgDfYqp8VQNyBkjcZiQNbdSprqsWPqWM2IUpwfZPuHbPi+opajzyBeFWaSs0XYLmy8znUDQf7BDyeRqiC4uAhmjWVZt/qYKbGLmKX3Dxvz7C5T3n/hS2zFNQAH3nA2s5qLpDOnqmpmr/fhbBUO253reBZQmehnUkQbCGqb49ag= Authentication-Results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=oss.nxp.com; Received: from AM0PR04MB5636.eurprd04.prod.outlook.com (2603:10a6:208:130::22) by AM0PR04MB6435.eurprd04.prod.outlook.com (2603:10a6:208:176::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.23; Mon, 8 Feb 2021 15:14:33 +0000 Received: from AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::e90e:b1d6:18a2:2d42]) by AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::e90e:b1d6:18a2:2d42%6]) with mapi id 15.20.3825.030; Mon, 8 Feb 2021 15:14:33 +0000 From: Calvin Johnson To: Grant Likely , "Rafael J . Wysocki" , Jeremy Linton , Andrew Lunn , Andy Shevchenko , Florian Fainelli , Russell King - ARM Linux admin , Cristi Sovaiala , Florin Laurentiu Chiculita , Ioana Ciornei , Madalin Bucur , Heikki Krogerus , Marcin Wojtas , Pieter Jansen Van Vuuren , Jon , Saravana Kannan , Randy Dunlap Cc: Laurentiu Tudor , linux-kernel@vger.kernel.org, linux.cj@gmail.com, Diana Madalina Craciun , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-acpi@vger.kernel.org, Calvin Johnson , "David S. Miller" , Heiner Kallweit , Jakub Kicinski Subject: [net-next PATCH v5 11/15] net: mdiobus: Introduce fwnode_mdiobus_register() Date: Mon, 8 Feb 2021 20:42:40 +0530 Message-Id: <20210208151244.16338-12-calvin.johnson@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210208151244.16338-1-calvin.johnson@oss.nxp.com> References: <20210208151244.16338-1-calvin.johnson@oss.nxp.com> Content-Type: text/plain X-Originating-IP: [14.142.151.118] X-ClientProxiedBy: SG2PR04CA0176.apcprd04.prod.outlook.com (2603:1096:4:14::14) To AM0PR04MB5636.eurprd04.prod.outlook.com (2603:10a6:208:130::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from lsv03152.swis.in-blr01.nxp.com (14.142.151.118) by SG2PR04CA0176.apcprd04.prod.outlook.com (2603:1096:4:14::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.19 via Frontend Transport; Mon, 8 Feb 2021 15:14:27 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 550ddd92-031d-4d24-e397-08d8cc443d6f X-MS-TrafficTypeDiagnostic: AM0PR04MB6435: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xN+SkmzWNRmtYFkzbkZDGh5aJz3Tx1GaTl5czwmtaRJwnhlDYs90i+Z3gaGJHFnpraa5FNKDIVFUD4dKBBesL9C/UzyEUkwbXtYhRw9kP26q2u+uFhog0eGTDGOsRhLRNnDqFMBLObzLs6/TnmU4/AJ1jmnHy1VOaa+zF4dWU2A0lQ5N85IjitCSxoFbinXh7uVlj9SixBaDC2H32+CyudAiygTXmNIiXvv8HNOVLaIdqRA9p1ymcXdoldsNdEhEuK6oG66i+MZKAIJcW34aAO97MhglzMEtXdV72DMgnhgk1Rcc/YpIOT7+5yHdDNEHIY0qPo8aEXUzwdIH7GXmNstWhMcid/xGeAbRt7GTgaPRPsvODABATlGbJFRK/a0qIcnCBm1m/QhMtUcj6XhEbJtXGWy36/wUACEBWuGDFm807WPLfaugduEoIZEsYpQkpPr0rxppb25FSfEoKAC1NKmu5Y3nGGHyjwhFHqrlIyJ1T8vXFcXaEqteu/htXKvWeeQk/1QSZ9Nwg/Dd00yN2mD3uHLkMNxDtEThhx75Zvz0YHw4IhCvAbEchSib9cAxogBx4X4OnwA7EPEYqCGRtmk2BlGpD2l87VTdsbGxntI= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR04MB5636.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(376002)(396003)(136003)(346002)(39860400002)(366004)(44832011)(86362001)(6506007)(5660300002)(921005)(8676002)(66946007)(2616005)(66556008)(26005)(66476007)(1076003)(52116002)(316002)(110136005)(186003)(16526019)(8936002)(54906003)(7416002)(55236004)(2906002)(4326008)(478600001)(6512007)(1006002)(956004)(6486002)(6666004)(110426009);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?B2YN6gbW2ACF0+QA/iPC/UFcFeI/9YG83DNDcerVgAaKN0FGXXZheDlR2CdJ?= =?us-ascii?Q?og4Hk2BRMf3kNfkSnoT6l+2otu/Pm1cZT3ZZlKf4WMvWjS6cq0Hvw+lRMyn+?= =?us-ascii?Q?ySRSZULALhyD5Y0tO/TNhhukbEtYcANWV2NlY+Ydkei0jxMVkqphFv4F/hEH?= =?us-ascii?Q?5jANE+0Kx4xivbdygppX3jJDnX7WgcRaefiZGuarcqobCgJq6dtSMc8tS4Si?= =?us-ascii?Q?FtyrCJcT+B+6RX58Ya3BbS2e1BZBO2B/8AB2MxoSQ0iKQ7kL0486fBMDHCQU?= =?us-ascii?Q?BxFcocVOSqDltKrrcSYb/7vpvjOzx1GmdPbxhIEo3XqEo6g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6RW5V0ZMojZtaInDcftlVYBc15jzcUjLt+0d?= =?us-ascii?Q?qE+zUHEBIEYLxJwpHzq24lvRs7WleDn2ZDXmwjLaJ69OPdqjY1uLnoUiT9MK?= =?us-ascii?Q?yFTvxgUVqCIK+pYMuWJxsM5j?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 550ddd92-031d-4d24-e397-08d8cc443d6f X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5636.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Feb 2021 15:14:33.5559 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: FWBPY+61eFuUKy0ZA98ry3kYBUpgqm5MhMKO/bB2EgBb0/JgaRuiKEbbCjZ58w8LpdNVbYiwyn4m3EQYHQO+SA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6435 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Introduce fwnode_mdiobus_register() to register PHYs on the mdiobus. If the fwnode is DT node, then call of_mdiobus_register(). If it is an ACPI node, then call acpi_mdiobus_register(). Signed-off-by: Calvin Johnson --- Changes in v5: None Changes in v4: - Remove redundant else from fwnode_mdiobus_register() Changes in v3: - Use acpi_mdiobus_register() Changes in v2: None drivers/net/phy/mdio_bus.c | 21 +++++++++++++++++++++ include/linux/phy.h | 1 + 2 files changed, 22 insertions(+) diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index 33d1667fdeca..c597dd41695d 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c @@ -9,6 +9,7 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include +#include #include #include #include @@ -566,6 +567,26 @@ static int mdiobus_create_device(struct mii_bus *bus, return ret; } +/** + * fwnode_mdiobus_register - Register mii_bus and create PHYs from fwnode + * @mdio: pointer to mii_bus structure + * @fwnode: pointer to fwnode of MDIO bus. + * + * This function returns of_mdiobus_register() for DT and + * acpi_mdiobus_register() for ACPI. + */ +int fwnode_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode) +{ + if (is_of_node(fwnode)) + return of_mdiobus_register(mdio, to_of_node(fwnode)); + + if (is_acpi_node(fwnode)) + return acpi_mdiobus_register(mdio, fwnode); + + return -EINVAL; +} +EXPORT_SYMBOL(fwnode_mdiobus_register); + /** * __mdiobus_register - bring up all the PHYs on a given bus and attach them to bus * @bus: target mii_bus diff --git a/include/linux/phy.h b/include/linux/phy.h index 957ce3c9b058..765e1844cfdb 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -387,6 +387,7 @@ static inline struct mii_bus *mdiobus_alloc(void) return mdiobus_alloc_size(0); } +int fwnode_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode); int __mdiobus_register(struct mii_bus *bus, struct module *owner); int __devm_mdiobus_register(struct device *dev, struct mii_bus *bus, struct module *owner); -- 2.17.1