From patchwork Mon Feb 8 15:12:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Calvin Johnson X-Patchwork-Id: 12075831 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=-17.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 5ED3DC433E9 for ; Mon, 8 Feb 2021 15:15:15 +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 D0F1F64F1D for ; Mon, 8 Feb 2021 15:15:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D0F1F64F1D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com 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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Wu18tr+wm3YiTJPEb82RkEC2s7VBttYVTIxWtwO07ao=; b=k31HxNCClMOxN16PwwNTC92bh XG1mlx0affcE1LSVxAw+km2BAWk6cAmdhfWqaLajlSuGZy0bKdygQoBUr5FC9aSF6Ji1NESZZWSMn rmnZLPrfin6IRLz1hPHI5dy2w7qG4oF9bFUI2U6Y5S2UwfoxB45OjLb5qB1lJA/ZDzFL9jvFELXCh ALtm6T2xg6lTSyMHhfVV7122VLoGvDTrmbFnEXEeOGs5PVV78lvqIA3gBVxd4RvS9dwXOwRHHlVtu d2TCkgjNJOBR1mCeGHJsxHP9ZRHiKJGYyiCtcs69OLeGpJGyRGdfMwKshsk5catk8c3wC6pXAeX+S sUwfwmqYg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l98EI-00051Y-Ar; Mon, 08 Feb 2021 15:13:34 +0000 Received: from mail-db8eur05on2074.outbound.protection.outlook.com ([40.107.20.74] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l98EA-0004vN-DS for linux-arm-kernel@lists.infradead.org; Mon, 08 Feb 2021 15:13:28 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bvAtlLPJaStBIu7tiLdPnNr7kBHWb9n39Hp/1xr4NHvJMBeddgHUpXFMLhhJEHmuozrd3RvlV+8II23sJbgwPMgqREFo8CNXIy3RochIBvwWMzURnlHSHmx7+wAhY11ORR3OdlL8kR0WiOAcg0cdIfsZVT2+g4+i8Pp4K6hj6rA5OhkQio/OaI2lioL+jV2F/yheHkLqndy9i//byICMIspgs68GNR5j3jB5JDj5KMcRPa2HQ7L9F+8cG7YcPOQXVWZcr2I5KxZCp3xS/RsS528Fd7TR73n6vHu5IoBmyedYdCA+m7jv20f1wQvBHTxpDy9UUGrvOOXSi61Pi6Q0vA== 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=0IofeNANEMuA5JQzSXHIjLaUvM8hwnXoA6MxcQwUcyo=; b=E4bgfvJBy2aBWzYt2aujE6iBD27YNVYbYF0U8JOox9Pld7VqctDPuHwMNj4JysgRLm3+ZqyM9WiHRFsYM9FoQxHqw43VStHxuDTPQ9/keBzDfseyveo+dQhRgUj+OjTPvOt/ShcGCR1slCpkJAbHvv2VDcn25rD+8V0yx4U3S1Gs+cqJFecmW/F5r/LgP+hWQbFH5XssCtLrARl7MwdKK6/DVcunoMQ+PPHAZ2RTthqmINxB7CxMiUPvTPJ3OZFdlJ8M89UOV2g2/4lNp9GsVqACYRjFa1ZTem977K3497/JzDa+mxCGMK+oB8KsYTzlzZG5RALlEX6LV4r38a9NxQ== 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=0IofeNANEMuA5JQzSXHIjLaUvM8hwnXoA6MxcQwUcyo=; b=f2lAkuVwylJcuNgli1eAzwmFvpjxEQj4ZrMUpEcmgyujLaWSR0jzDtlx15cfqKa16N6LSdbuCsOEs/sgF5n8/YjzH2OZyQHZSgIz6+oOFZy4BaHLLyQgPGEWKeKeCR6fUsyUcn8jiIzLYgQHrsyS1TkDFNkFUqjfNw0m4G0n88A= 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:13:25 +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:13:24 +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 Subject: [net-next PATCH v5 01/15] Documentation: ACPI: DSD: Document MDIO PHY Date: Mon, 8 Feb 2021 20:42:30 +0530 Message-Id: <20210208151244.16338-2-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> 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:13:18 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: a38f8677-5475-468a-e48b-08d8cc441473 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:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8MK9Z3T+11WlLdxKJVmSUBl5lDodLlezKXFKu3qM9gZqlDU3ZNk1mgvYZ6+dk/phspN6SbebUz92uaw0WD84edTRM2Z73sR2r+ExjAI+ppSGQb9ELnwXsmCwxMviBRJI9wetEN2KHy5QRbRktwUEXqV3UkFjsjpTITb/IBiDpP0XCi0znZiUvYnQX7RGqXP489+docat+E1PLvYvVruSzdoI+cNIr6+cym7JXPYzvTTom5979rDOSDVcLiw6BjnO0kHuPX9nEMbPPlTa5+tHs8RFPB0LVWekGDZD01iF5tB4smPT5cakbzBz0IOjgQAth+DZA50cwUCCCsi98ckIphK3c3asA+GOlD2RFE6R97IPmEDBQejRq5nOS7IGa6mVJZUMH7jgDeEINr/BVaAwTIAIzmIk1ZdoZiVS9ysyTGT/4t9pcQWjKPiKgOuc9/9tUN57kTQZU0TRe0UUvSBRuu6XADvKpSVedu4qdBxj/6bUUCBNvmLw96/iXmYmCx3vn6pu+ZExKHN4C7w9DETPf0TSfHEXmSiAuzme6D2BJ0/I/nM45lm0t8KVytQGP4nVgRl13Ve8pSrJyCsmCvWU/feIOWrID/JajnmT0n82zkIRDr9w7OZYXUiE8FWjHmIipWqeQkxaSnoJ/purfdwsQVKQQIitsJOPaavxRYRGHnI= 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)(366004)(39860400002)(136003)(376002)(346002)(396003)(8936002)(54906003)(7416002)(52116002)(110136005)(186003)(16526019)(316002)(55236004)(956004)(6486002)(6666004)(1006002)(4326008)(2906002)(478600001)(6512007)(1076003)(6506007)(5660300002)(921005)(44832011)(83380400001)(86362001)(66556008)(26005)(2616005)(66476007)(966005)(66946007)(8676002)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: NGz/uCZvNVCeHR+/GFZjC4VYF4tOzasKlFFQ5rDFnpw5W8F2qAQBCYB0URiY+FLn9cFWew+t9aFxSItv3f+QEFPaiChSoyP00dZmTb14P0/JAEsuS76l+lCaiZCyUEQle/ugM6Vh7uLK1Y/ceODlyj9PLeXKePPTCwNNaeBDWN90FZLzep5psZBVcsImmtdCzmAItLVJeDJgcejkYAbNDEwBOxxDsQdKkAIBB7MZtpwtg9vC2/+2y5uS8odQm3jPcDHoMgzAEKdZ9fqusTh/7f6xkLaV3/P+uslLDj7yURyD+8tpSkxSTLjmTO0IGmkYfMuUdqV5kIXfez4kkydHeLch65wpgjZqi8+hvbP4VcnXPi54J+F5Ap0Wud54qKdHyrvQgginkAAguhe5Hj3ef54xz2dnqP1INOoKKfBSwC+u6nCeEYN2dL7NFiVlWSPm5AsTL6tB9fevrW4fz8yVyVuxpGsSRuvcmBd8LrDu1dylO4VKQz3OA+YyAQdU26swRfCZqMsLA/exhDHu1w87kLPbSyyZMiaKsJUPcg/4C6bUip1gAt8Ony24GUJjuDDAJvXBw/GV+86GLgYa2tjRxu1yiQAxY8LQqR4Q6z2W8SzGNzgtAYfgk9CQEKA2WsH8oGXebw8aJUWBCj42DqEZ1Lp7H6ZqalpMgls7So8WV+YmvJRmsXgtBbW72yOtFG+88Dfr+EG7ZYXZvbBhWxDAo9joWPdQygJbPebAydoBL8gIDKPZHrpKgyjqUrLaoRALoY5MXbGIN/ZDRIMzpmsj9KYBqblVzD/lbPmyxV0Y1SqI3kDRqxk3lEY114kMYt3QuNJiVbwQFpf5xX3Y/0/E5aUgOXZ1+5f6pKKsFxZ+v8Tz+Xbx3slVre7k/FFn1m8O3m8J4H1croOIIufL9HVivbUi3b/zzZtVdFh2VqMBIIWJGa4899VdSj4r4hG/Cm+JduaH4UOlq1cM6tAaTQvIyz9KH77gvp3LOHq5G4FZWVTzkjvyYMxaSP0hUHC9dd53jPBvjX4xWvVQ4RZhtd7Pku5VAVMncC763NOZu4A2aLiAd4gJ1/ZtgrQQW4pbiBOoFY7nkCqjbB9BUhNJil+TuLp6zTg4e/b1M09SZJl6z9NpbKUnmHWheXTrpW2ITZSjILrd7vNz2riJMaapwjvzTZeqZ36rinXhiE6nZBFMt2Pq8XSWJjSTdHEfC3/9rZQQPy+EGiZXHQQo3TqKzifTf+0KAx1cOdSGAgCDmwqAWc9Y/i9czgx0JoMCEhaEoFe1nz8eQEdyOu6Njh8uf9zfzMQd2ln16FNgcuWlCtg0n2h8mBKKAskhK1RacW/UN/d9PmGkCtiXQ9+srJo3vbHLkA== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a38f8677-5475-468a-e48b-08d8cc441473 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:13:24.8495 (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: o24i5qrsXzQVp8oeZqMsw3HbnoKyQAn7NnBc8Tcx5yJHDPwlZan9d0pOE60cv9/6k73TIzEbHdBtZ/+cxLTjtA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6435 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210208_101326_559690_E10F74F5 X-CRM114-Status: GOOD ( 18.12 ) 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: netdev@vger.kernel.org, "Rafael J. Wysocki" , linux-kernel@vger.kernel.org, Calvin Johnson , Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux.cj@gmail.com, Len Brown , linux-arm-kernel@lists.infradead.org, Laurentiu Tudor Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Introduce ACPI mechanism to get PHYs registered on a MDIO bus and provide them to be connected to MAC. Describe properties "phy-handle" and "phy-mode". Signed-off-by: Calvin Johnson --- Changes in v5: - More cleanup Changes in v4: - More cleanup Changes in v3: None Changes in v2: - Updated with more description in document Documentation/firmware-guide/acpi/dsd/phy.rst | 133 ++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 Documentation/firmware-guide/acpi/dsd/phy.rst diff --git a/Documentation/firmware-guide/acpi/dsd/phy.rst b/Documentation/firmware-guide/acpi/dsd/phy.rst new file mode 100644 index 000000000000..e1e99cae5eb2 --- /dev/null +++ b/Documentation/firmware-guide/acpi/dsd/phy.rst @@ -0,0 +1,133 @@ +.. SPDX-License-Identifier: GPL-2.0 + +========================= +MDIO bus and PHYs in ACPI +========================= + +The PHYs on an MDIO bus [1] are probed and registered using +fwnode_mdiobus_register_phy(). + +Later, for connecting these PHYs to MAC, the PHYs registered on the +MDIO bus have to be referenced. + +This document introduces two _DSD properties that are to be used +for connecting PHYs on the MDIO bus [3] to the MAC layer. + +These properties are defined in accordance with the "Device +Properties UUID For _DSD" [2] document and the +daffd814-6eba-4d8c-8a91-bc9bbf4aa301 UUID must be used in the Device +Data Descriptors containing them. + +phy-handle +---------- +For each MAC node, a device property "phy-handle" is used to reference +the PHY that is registered on an MDIO bus. This is mandatory for +network interfaces that have PHYs connected to MAC via MDIO bus. + +During the MDIO bus driver initialization, PHYs on this bus are probed +using the _ADR object as shown below and are registered on the MDIO bus. + +:: + Scope(\_SB.MDI0) + { + Device(PHY1) { + Name (_ADR, 0x1) + } // end of PHY1 + + Device(PHY2) { + Name (_ADR, 0x2) + } // end of PHY2 + } + +Later, during the MAC driver initialization, the registered PHY devices +have to be retrieved from the MDIO bus. For this, the MAC driver need +references to the previously registered PHYs which are provided +as device object references (e.g. \_SB.MDI0.PHY1). + +phy-mode +-------- +The "phy-mode" _DSD property is used to describe the connection to +the PHY. The valid values for "phy-mode" are defined in [4]. + +The following ASL example illustrates the usage of these properties. + +DSDT entry for MDIO node +------------------------ + +The MDIO bus has an SoC component (MDIO controller) and a platform +component (PHYs on the MDIO bus). + +a) Silicon Component +This node describes the MDIO controller, MDI0 +--------------------------------------------- +:: + Scope(_SB) + { + Device(MDI0) { + Name(_HID, "NXP0006") + Name(_CCA, 1) + Name(_UID, 0) + Name(_CRS, ResourceTemplate() { + Memory32Fixed(ReadWrite, MDI0_BASE, MDI_LEN) + Interrupt(ResourceConsumer, Level, ActiveHigh, Shared) + { + MDI0_IT + } + }) // end of _CRS for MDI0 + } // end of MDI0 + } + +b) Platform Component +The PHY1 and PHY2 nodes represent the PHYs connected to MDIO bus MDI0 +--------------------------------------------------------------------- +:: + Scope(\_SB.MDI0) + { + Device(PHY1) { + Name (_ADR, 0x1) + } // end of PHY1 + + Device(PHY2) { + Name (_ADR, 0x2) + } // end of PHY2 + } + +DSDT entries representing MAC nodes +----------------------------------- + +Below are the MAC nodes where PHY nodes are referenced. +phy-mode and phy-handle are used as explained earlier. +------------------------------------------------------ +:: + Scope(\_SB.MCE0.PR17) + { + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) {"phy-mode", "rgmii-id"}, + Package (2) {"phy-handle", \_SB.MDI0.PHY1} + } + }) + } + + Scope(\_SB.MCE0.PR18) + { + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) {"phy-mode", "rgmii-id"}, + Package (2) {"phy-handle", \_SB.MDI0.PHY2}} + } + }) + } + +References +========== + +[1] Documentation/networking/phy.rst + +[2] https://www.uefi.org/sites/default/files/resources/_DSD-device-properties-UUID.pdf + +[3] Documentation/firmware-guide/acpi/DSD-properties-rules.rst + +[4] Documentation/devicetree/bindings/net/ethernet-controller.yaml From patchwork Mon Feb 8 15:12:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Calvin Johnson X-Patchwork-Id: 12075837 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=-17.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 AE78EC433E6 for ; Mon, 8 Feb 2021 15:15:31 +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 5B2E164F1D for ; Mon, 8 Feb 2021 15:15:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5B2E164F1D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com 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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=NmwV1q83iiZ6yhgPNt9EjB4G3gZDKPNGVI4ISY939E0=; b=U1KKXAagTNsQG0hVfc6v0S7Vp lKlTp3veTE18ceMtWhKrRwxgU0ocEBeO7m2389Dn0fFrCWcgQpm4rNKfp3LRwupX+t5MQwPAIrzC3 cS+P/ID4SAwLhZBA3LcUjB5S+ZN26BLj2UgFjuH9ud3mRY7IkRF5P7MVwAuGp3y5xkrBFzY1yjMEL kox0DJ4dgoUfC7ggp7pFlxL2ziXnSnUmmDnAIBNbTyRL+6+XPJpRvwkTcxNrcFunj10Qzf1maChWl Xz1/DFa/w1A7h/Zv3lg0ztADCX7S2aQVa4TQZ60kWXs8tgYv0HtM8xJauYBFia4h8+oD/A47K5/8s xmMpDE51Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l98EV-00056T-Cg; Mon, 08 Feb 2021 15:13:47 +0000 Received: from mail-db8eur05on2061.outbound.protection.outlook.com ([40.107.20.61] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l98EN-00051q-AU for linux-arm-kernel@lists.infradead.org; Mon, 08 Feb 2021 15:13:40 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TtepjvLnH6jtwLyMFAXaSNy2V2AfcRhAYQmFvdoNKFDS4nHhePEFL9CXVnobuJ71ybEdLXvlme3YlHLg+Lnp/XUPgBU6X4nxb+gNzt2lo2/XtK/1IWmADhDYKMiSxePrdnGli1fZ5/TxM/SHMZiLRzszhAZiksDRKBhlC0n57xMmrtCFJYw0cKFi55wlgnXw0XQdPXedNJxG1LAKr/T5VlxDss6d0R+byZAZxR9VR8LBPOP1/xQnrGu+dhTqKH9gsbB0+eIagiFJxCOx7U13EUpIF3ghMNQN7s2s2JPNBSAwqJS/8skiNBGT8twRu7h04gf+HNVZAr85Qe6ilUm2pQ== 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=UZ/gH5MpDExS/V5Jml4xSI44t2ZxUavt+yfu94WPViQ=; b=CvG0jrmUn5aM1kikcorjLl20M0rPB0XlolIkKlFL90RhlYdRnGDUkN7K9mRa1kQj4jx4Xs4XsCsbXli050YvmPWUh/Pr7gRTIL4THeNzmSiP6ut+eCsIGSgZLPzTtlbkn7mxKqQGjxUzTkbyJuxnD6MzH2aVEku6bZs8VwMrQrzZUi8SXC8pVOVqriY8FyzOfunXhzlgWNQc+/yY9toPcEmin/vZrpS+xOSParvzDGesdkfMSIWs32vMvBN/hMXbURz5vHpD0hY57hkkWAfNd9lc3Y4RY+sZDuzpD8Iwwi3kB6pmF/X68vBsv6AZUxdw0XoVvE7qwkJ/OeSuYi+H+A== 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=UZ/gH5MpDExS/V5Jml4xSI44t2ZxUavt+yfu94WPViQ=; b=geTM3QI4+FaGkOaVIONo381+hbvpYjTjws/SBjiaiQIPB8I6nWDZtB0/k9rjUNXnAMKbs2xv9Ug2gxllCQxEM5YBOocVuEhwILbV6qtU5NnZ8UX744WZC69+SUsXGgBueu3IQ6E9Tz6/v1DSBicYQyZZHR9vaMEtUexjLybHhNw= 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:13:31 +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:13:31 +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 Subject: [net-next PATCH v5 02/15] net: phy: Introduce fwnode_mdio_find_device() Date: Mon, 8 Feb 2021 20:42:31 +0530 Message-Id: <20210208151244.16338-3-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> 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:13:25 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: cc86f187-1312-40fd-dff2-08d8cc44187b 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:5797; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GFBnEMKX2foI/nNq3PjWQ2nxKM/Ufs9bXFo7DeTzpH5Y/m3T3nkEJb2/54Oc+i/pnDkxsOwcdoSy2PqA/UCOGyi3Sk2FVs/LSkBvPSadmlHiMKL2dMa9ZIYD2gELRGr2CwN5m6IHpGJq44fUHdQMVIGnP/1kUVmPY11UGSWxpA+PByHOqrhfZU5tAMkOr3EEzrCWKFUbhC7OpGoGR5vvJcWdaI3HQwV02bkPxYbM6IOlpZxquzkAcDaeYB8rWTvWQRx92A+5rD3dm8r9BolkQD9+imrAKfA1lXqyuFipt0BGAVM7DyWLWzqiHmmtGZLdROnJGl0xq1SONJBbYupxvyg/ygnU0yZjCJXml6lHScYGA5y1hlM5OosZIwGSOl7a6vjxgjCZ/ruAg0BZhvC6w8GPrzhV8QlEV8WrwjhOOOv/63r2k4z7cXsR0Qb7FOAH+W+TACCW1sb1Ts5/ykNJS5cMfQSe7tXi931tDItk1ooUYjF+z91vjCldu53UolB/tpxcyn+tc8Y0eIP9ugT0PgoOKe3l7nqWrh2aMHkeaO39vWVdR26IhwFIgNlYpV7nBgcshM76vItho2FdHc5ViREBkxzk9uPtDz2PVWLPL6I= 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)(366004)(39860400002)(136003)(376002)(346002)(396003)(8936002)(54906003)(7416002)(52116002)(110136005)(186003)(16526019)(316002)(55236004)(956004)(6486002)(6666004)(1006002)(4326008)(2906002)(478600001)(6512007)(1076003)(6506007)(5660300002)(921005)(44832011)(83380400001)(86362001)(66556008)(26005)(2616005)(66476007)(66946007)(8676002)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: eyOsrh9O5Y5Dkg1ZQUy8gHs7MyJZtdjM0KI7+Gno4o8LVbKWysjktlQfkhOuhBlFTbbWxRgAZMk1+2KKmTGs7Zn+LhDP0OaULLu5JJcpPmu+ZMni8yBpXevTlfGY32PzXKI6VeRxAn0tSrdRw5o/hbrUPAFnB1fnRD2ZkeD6F+CYIqG6u5OK4CZWaMD9GYGkn69Gym7wFwpuWgXtOs5npN4nAVlvwu9f9IWBd53feAvkup+9cTEaImbavzzTsalnXt08mt3pldp26KULZn8WEXWx0dsf1Lujrp33FoeHFUcxAiCmjYTsOeu6QZ0MrdgWi1F/Zl2FbdlFclWrM51v3dFdpbB9qdiZFqcKBz0p/dLOD/W5OctF6L8D3h/l/p7RqV8sUR7UaXPk+D64aRP8orRqxjrqVbmwGu4fPxuNpbFfFd2OeCEQPb25Gs5/LVcvvWBppWx66OfsoDDExdLANweVpS1bS/HKPYhAyRr+PXlo6ilKHcnGGGJHBScDltIFYT1Ci5OhHmVFstvbDFMPZZHQulgoMZEp6sGKegstpX3G15S2GTG2aIECz9SfXkDltTcBPWP2OHR3g3BV/QpzsPN7NUDXwRZEyDfIOR7LQ2pFAbj87k4fFzGrmpJpsAitB6ftNFB0OlnurWQ6Tt0HerJ5MclWPg98Re1BdvLeM1KXufbQGd4JyLPoFJdy7BpVgXVDTFmcuAFKB04Zn5dNA2ns9tjSRRIf2A0GLatqHLLiNxWLfgaGj0WAduxTGP74X/3XLI0Xh/LCzYC3gOrkIPoVfXLaFKUe4qPHGy7zgwGU9J+8yp/cAmEYH5M5T0Dcy6bGosEZ+oRUhgwU2Qqween3voWViOTXo3C+aIvzNAUFBW41lLn9iJKeJH8GHZ9HFhmfRSuFN5fvciM+C9sowI3sWjmlB0MgWBxy4C0wifNgYsSyiDHHtyMPKzHywHg7uOy7PP2xFadmDrbSgMMMfSgwQuCKawcjd46ivRSsHsEN17uvXNrUGmC167um6gjdNqP3dyqfDHgQ42UkclgHE2T0dlIucXVjzZwqAbKOnKuRwJSkEKEM43Z2aD6ufMbSoLxehDgzM1voZlNZsA0ENS6usolhhSSpTTfb/Xza9OlRec47odQNKpTqm9kyHS9xqv7ZJIcMG6QVKrG0+YwRyc5YsGV5XN1MiR69ekqIAojRhKEzCfp8uCKZDwRnXwOpplvxZlg7dLuVyYAbX6tkuYn+bx6l/v1O283b1BOKp6oTt51cyMz5orndoCgzzfSolF6rlWDU+Qf3neTiZyUeNLLJWGb7C5l4eXmJoZT9bBJqmz1DK9QKNTc3L4zygd5aZlYeYg/iFAfvZ86aeVQi/w== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: cc86f187-1312-40fd-dff2-08d8cc44187b 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:13:31.6827 (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: SWzSnfYyT+ZRTcqRbjrSESXHl+u+XA8MLcEHtxxpuToVlznycBdhUEgasR0XGVeTnXaN4NDAfecUBrOAvzYrdw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6435 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210208_101339_425800_D478FD15 X-CRM114-Status: GOOD ( 16.91 ) 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: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Calvin Johnson , Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux.cj@gmail.com, Jakub Kicinski , Heiner Kallweit , "David S. Miller" , linux-arm-kernel@lists.infradead.org, Laurentiu Tudor Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Define fwnode_mdio_find_device() to get a pointer to the mdio_device from fwnode passed to the function. Refactor of_mdio_find_device() to use fwnode_mdio_find_device(). Signed-off-by: Calvin Johnson --- Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None drivers/net/mdio/of_mdio.c | 11 +---------- drivers/net/phy/phy_device.c | 23 +++++++++++++++++++++++ include/linux/phy.h | 6 ++++++ 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/drivers/net/mdio/of_mdio.c b/drivers/net/mdio/of_mdio.c index 4daf94bb56a5..7bd33b930116 100644 --- a/drivers/net/mdio/of_mdio.c +++ b/drivers/net/mdio/of_mdio.c @@ -347,16 +347,7 @@ EXPORT_SYMBOL(of_mdiobus_register); */ struct mdio_device *of_mdio_find_device(struct device_node *np) { - struct device *d; - - if (!np) - return NULL; - - d = bus_find_device_by_of_node(&mdio_bus_type, np); - if (!d) - return NULL; - - return to_mdio_device(d); + return fwnode_mdio_find_device(of_fwnode_handle(np)); } EXPORT_SYMBOL(of_mdio_find_device); diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 8447e56ba572..06e0ddcca8c9 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -2829,6 +2829,29 @@ static bool phy_drv_supports_irq(struct phy_driver *phydrv) return phydrv->config_intr && phydrv->handle_interrupt; } +/** + * fwnode_mdio_find_device - Given a fwnode, find the mdio_device + * @np: pointer to the mdio_device's fwnode + * + * If successful, returns a pointer to the mdio_device with the embedded + * struct device refcount incremented by one, or NULL on failure. + * The caller should call put_device() on the mdio_device after its use + */ +struct mdio_device *fwnode_mdio_find_device(struct fwnode_handle *fwnode) +{ + struct device *d; + + if (!fwnode) + return NULL; + + d = bus_find_device_by_fwnode(&mdio_bus_type, fwnode); + if (!d) + return NULL; + + return to_mdio_device(d); +} +EXPORT_SYMBOL(fwnode_mdio_find_device); + /** * phy_probe - probe and init a PHY device * @dev: device to probe and init diff --git a/include/linux/phy.h b/include/linux/phy.h index bc323fbdd21e..8314051d384a 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -1349,11 +1349,17 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, u32 phy_id, bool is_c45, struct phy_c45_device_ids *c45_ids); #if IS_ENABLED(CONFIG_PHYLIB) +struct mdio_device *fwnode_mdio_find_device(struct fwnode_handle *fwnode); struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45); int phy_device_register(struct phy_device *phy); void phy_device_free(struct phy_device *phydev); #else static inline +struct mdio_device *fwnode_mdio_find_device(struct fwnode_handle *fwnode) +{ + return 0; +} +static inline struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45) { return NULL; From patchwork Mon Feb 8 15:12:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Calvin Johnson X-Patchwork-Id: 12075839 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=-17.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 4BD3EC433E0 for ; Mon, 8 Feb 2021 15:15:43 +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 D7E7464F1F for ; Mon, 8 Feb 2021 15:15:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D7E7464F1F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com 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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ou9nISc7598ACGBO2Q4sS5SXLmexgLLvOa5wbMmG6ik=; b=VhdFjOTboAa8i7RB6tkT516Zg R+X2pzJNKU7J9n/fh6JDTZy/Pl7plwsdWZQPUiHVXVmeppmqFmyIvfP0RrxZenJFoAPeQMbfZMubS MwFn5hQsf5s7AuoIJBBMkeugG9IZemAErqFm1cs7WwGJ3TkllotpW0CNuMlkD2t5DQfg2K48YoFyH dsgf77uiV+V25VH5BIv0YE8upja3MM88UdYUCKHCkEhLcp+AagPmPQiBic8588bK1Wy3m6vCJTgwM N00QZ/j8Ny84jBlxg9kBplQR25MDMSQC/CmVkEo4vmk3mj65zwjGFg+nywyqDb5kLj0I3A3eFc7zZ n6KfDcaTA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l98En-0005H4-N2; Mon, 08 Feb 2021 15:14:05 +0000 Received: from mail-db8eur05on2057.outbound.protection.outlook.com ([40.107.20.57] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l98EZ-00058A-Hq for linux-arm-kernel@lists.infradead.org; Mon, 08 Feb 2021 15:13:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=huCRt6RRNW96v3gl4gvsLxnvKfEinuMKAUU6EkIuN3jP1NbVO1ELDceD8yPeiKUYNvZCI60b9UvLQP0uEADemcjiHtYulHPeRoGOwfGxWKM1zFQgIMubqbOM14Bzr7vPwtsm2PTdUpkan6aXXWG3/vOagDu8NnGshFCRlaCSQoLGKE64Lq9qU+y+lBjrCmagaq4vf0WxB2A/ClY/rxbIpF5mKHsgiK3THskmUHsYNWpuV7XJAbFwjdhlQx4VEs8Lc/yORflKg6hvWPaSYzd6QwjV+zVKW21QeTd5L+/hhl/678G1Lf1wTYogTvJ3u+QPLe3flfi5fuEKipobhc7XhA== 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=YRvgSQHKAJvU9aFJfRrrx4h4veKkWYBtZnfpXrLrwQ8=; b=CYugh7Kq/wrLhmURdOFZx3p0QQdXBSN4nZOpBevXteD5gqHxcnmMhnDa1aDkoAQDN1Stnrun+2rYkig+73KBFOSP7kuaSzQhuwgMbn2XvwzVz5g2Q7ujaxy9B8D+ovyuz7321GckbRoOL69ADrz1DObIbDTJAa/fSZumTxPxgfRc6PQKx/xO2cF5CVX1GeEBZgqTVCGMBmyKgrHikVEkI4BZFOHbdTvV8gi13ccbBTHV9tYx3S+sQgWY4yTAP4SHVauYE3Eh55W6eaX+IcMyqF91z6zBZj7HLcTuTcL+R4d+NAzrDBmApewF0UZjlc73dDSng7Ae5DfXNHCOReGhaA== 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=YRvgSQHKAJvU9aFJfRrrx4h4veKkWYBtZnfpXrLrwQ8=; b=HSuOAWKQjnbJoV8G474zTb5ZLHykgJcjPVHAruDCO80zmkOoQ7hph6Azf0m07bH/T4jOi/TL8yQagQnhi/bqniw6oLOGnSewKcrGPeKt53w/TtGqs69VbYEnC1ovzjU0znmou173riJrb4+8EmoF6P6ZwPZgGLhpsU2f136DBj8= 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:13:38 +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:13:38 +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 Subject: [net-next PATCH v5 03/15] net: phy: Introduce phy related fwnode functions Date: Mon, 8 Feb 2021 20:42:32 +0530 Message-Id: <20210208151244.16338-4-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> 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:13:32 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 598d6afb-5e6c-4712-5cb7-08d8cc441c90 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:2000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Dz/Zh7fZSvwdZCF9ReltYRrT+yuHj5P63wenw63BqmENPiwTHEpxxbvgSf6dSgghYY6xEWbpacBZSuYJs48ltuN8rg+2BSu/Hexqrlfn7ePdm80iYEMpmrMaZLwr++yaiB6ouGxmAEKiTtK8bSqTs62/aNKoqZhjgR+BEzoadUuxwfLOyE4ffuhXtKp8rIKF7Ka8SKwW0tRM6D4Z6aKpTx0Ez6zk4IzhDj4U46vr2LEqbZVEWlUnbeY2gBuUPmY5UoBOPjE9j0BPunnzwDsAdGRvrCgAcHCSZnNbki+cRfBuaHaMv/NR7ip4YXlkkJWoM9WQajOMsDwnu6Z/3oWO1YupIpNSxBfg/YNMlU8qE6csrr95UjG9yhEOmRUc0qtDXn13xcDvnhZTJDQtwZWBr2830BaW7aotUtUWe5BCkHSvHsLayZQG9lx1fLxakZhKq8uuBDzZQiZbXALbPoAUTp9YnqphmZH3h6He9WJdNnmX9f5ZoGL8QRdJ1nW++WJLhLrdDxdW9yfWCv5Cfi2vvjLG2gOCQeWXVm3ltbjOr0A2p48BF+BRuLUzUG8vbhtoeGyWN4JRGQkjHBZUXnwmaH8PM97p1MnPfqglLtQeCkg= 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)(366004)(39860400002)(136003)(376002)(346002)(396003)(8936002)(54906003)(7416002)(52116002)(110136005)(186003)(16526019)(316002)(55236004)(956004)(6486002)(1006002)(4326008)(2906002)(478600001)(6512007)(1076003)(6506007)(5660300002)(921005)(44832011)(83380400001)(86362001)(66556008)(26005)(2616005)(66476007)(66946007)(8676002)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: x7AvCnidtJZTOTrk7hv7xr8aFJOO3x5K08yAYdk62m3SfOzhNOP/TUPrU9dO/pLlZ7kXJVTj7CHHGkgNCH6CPe6AdsOgK77tRyjWWZn5cYbcK7jOKaI0gkVXTF6fMIyRKvI9O3iOve69n1wF15AllTZvKpqqPM03QQ1gY+b3aWKIxDxWNHpltTiy7JYpmnBtxHQ/tPhNA4Brk6u50A+PEfTvLjIO56WSuRT5Q//IQgIBpxUWcNvx00SjVW3/iWG5psWdpZ6pQCujYYk2gS+8jH5IqH/H7a8VLLvdr3jFgCKDAKBs3d3mH5D1GmYR6cHTbW904h+QQlFr+RAZK93lcKClqbjAEn17hSt+VC4fVvzVO6+5JEqymyW8A8eUD9XX+usk9nPFh67Na3s/oT1dQjLSfIWzCWtqJSSnr51kF73MxFK4gKtnC4bzq9uYplQWMucr0543UTcmQSI+tglbNlHJ24dvyNP9FVteStMdtfJ8rclfL0eWG9IxUJjAwkSBSPSfOJgjCBSPG5sD5Wgj/9ohON82+h80h1y1q2LdWaI5xuccB2QfIH5v7/WTOUd+BqNV+NibPltgCXd1UBXufrzVegxAD5av6UJV+FE5Cn1csNxjWRAxK+Ro82VrvMZBoTipbBiO7AbjJQD9F0y4hAf3yAp0wr4JSCkGM0Ms13uxFXxSUdzirpLImPJrk6gRosY0POKiuOvj+HnbB0WimUy/FdEQTUM1WXmY8KyICq3rfd3D0iPcIBSqnnJvgc5AWuhbcGafV3E+jWzzEl/yovygTw4xVIL2iGrCILk7cFwcy0mYOoTzFR+D41yxtel1E3Li1s9+loHTNWTnM0vwP347amOHEimlFi4NcnGeTdE9koSmHWwZ+QakE/F0nVKSEjM3YkbKM0+W/do/ZcqQGRT3dsOwf9J5mORtxx003BM/0OFQC8VHpfDYW0PH2xSgmj3va9253nhVEOHt7rl0bIYuxqcgtqacCcP5tr+EUfdoC7dSQjKLWmtBPzlRTDOz7+oU+FKYN71ua3DCwhCBcjhbwsFUCoRi0UEsR3FRwMLfoEU4ohvcHm/4DMjEF7n+Jc6wCyMQour1WtneE6bzotvuawgCQ8uZMzrvHDAQwQPBZnyWPTjyF7Aw45bUo0F8l9KiDB78o0rzwcgvDIkwz66m9kFPDmgAOhv6FND6YRy/NxorVthxrraJy29iSAAeh8cAxzlFJpgbQc/bZuxk3sykPT90/dfz5DhW66Q6JpkK9++uOSSlyx5yCd+6E4Lde1u2hca1entTHIe5ddAT7TdvPl73x3oepg8tsIL0lAoyRMUhrJFa+aLl9R1EDg8d3YWnoO3PVr9nwpOpZs3WJw== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 598d6afb-5e6c-4712-5cb7-08d8cc441c90 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:13:38.3989 (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: T3EyRO8O3PVZdLsshk2f1PoOd5v6XfqYOVRfeJp5GFrotO5AgrnDnaAOrV8dUFxZlW6bw6XUFv560tufP2J1/g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6435 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210208_101351_634435_6AB8140E X-CRM114-Status: GOOD ( 20.08 ) 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: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Calvin Johnson , Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux.cj@gmail.com, Jakub Kicinski , Heiner Kallweit , "David S. Miller" , linux-arm-kernel@lists.infradead.org, Laurentiu Tudor Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Define fwnode_phy_find_device() to iterate an mdiobus and find the phy device of the provided phy fwnode. Additionally define device_phy_find_device() to find phy device of provided device. Define fwnode_get_phy_node() to get phy_node using named reference. Signed-off-by: Calvin Johnson --- Changes in v5: None Changes in v4: None Changes in v3: - Add more info on legacy DT properties "phy" and "phy-device" - Redefine fwnode_phy_find_device() to follow of_phy_find_device() Changes in v2: - use reverse christmas tree ordering for local variables drivers/net/phy/phy_device.c | 62 ++++++++++++++++++++++++++++++++++++ include/linux/phy.h | 20 ++++++++++++ 2 files changed, 82 insertions(+) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 06e0ddcca8c9..66e779cd905a 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 @@ -2852,6 +2853,67 @@ struct mdio_device *fwnode_mdio_find_device(struct fwnode_handle *fwnode) } EXPORT_SYMBOL(fwnode_mdio_find_device); +/** + * fwnode_phy_find_device - For provided phy_fwnode, find phy_device. + * + * @phy_fwnode: Pointer to the phy's fwnode. + * + * If successful, returns a pointer to the phy_device with the embedded + * struct device refcount incremented by one, or NULL on failure. + */ +struct phy_device *fwnode_phy_find_device(struct fwnode_handle *phy_fwnode) +{ + struct mdio_device *mdiodev; + + mdiodev = fwnode_mdio_find_device(phy_fwnode); + if (!mdiodev) + return NULL; + + if (mdiodev->flags & MDIO_DEVICE_FLAG_PHY) + return to_phy_device(&mdiodev->dev); + + put_device(&mdiodev->dev); + + return NULL; +} +EXPORT_SYMBOL(fwnode_phy_find_device); + +/** + * device_phy_find_device - For the given device, get the phy_device + * @dev: Pointer to the given device + * + * Refer return conditions of fwnode_phy_find_device(). + */ +struct phy_device *device_phy_find_device(struct device *dev) +{ + return fwnode_phy_find_device(dev_fwnode(dev)); +} +EXPORT_SYMBOL_GPL(device_phy_find_device); + +/** + * fwnode_get_phy_node - Get the phy_node using the named reference. + * @fwnode: Pointer to fwnode from which phy_node has to be obtained. + * + * Refer return conditions of fwnode_find_reference(). + * For ACPI, only "phy-handle" is supported. Legacy DT properties "phy" + * and "phy-device" are not supported in ACPI. DT supports all the three + * named references to the phy node. + */ +struct fwnode_handle *fwnode_get_phy_node(struct fwnode_handle *fwnode) +{ + struct fwnode_handle *phy_node; + + /* Only phy-handle is used for ACPI */ + phy_node = fwnode_find_reference(fwnode, "phy-handle", 0); + if (is_acpi_node(fwnode) || !IS_ERR(phy_node)) + return phy_node; + phy_node = fwnode_find_reference(fwnode, "phy", 0); + if (IS_ERR(phy_node)) + phy_node = fwnode_find_reference(fwnode, "phy-device", 0); + return phy_node; +} +EXPORT_SYMBOL_GPL(fwnode_get_phy_node); + /** * phy_probe - probe and init a PHY device * @dev: device to probe and init diff --git a/include/linux/phy.h b/include/linux/phy.h index 8314051d384a..dee7064ea4eb 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -1350,6 +1350,9 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, u32 phy_id, struct phy_c45_device_ids *c45_ids); #if IS_ENABLED(CONFIG_PHYLIB) struct mdio_device *fwnode_mdio_find_device(struct fwnode_handle *fwnode); +struct phy_device *fwnode_phy_find_device(struct fwnode_handle *phy_fwnode); +struct phy_device *device_phy_find_device(struct device *dev); +struct fwnode_handle *fwnode_get_phy_node(struct fwnode_handle *fwnode); struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45); int phy_device_register(struct phy_device *phy); void phy_device_free(struct phy_device *phydev); @@ -1359,6 +1362,23 @@ struct mdio_device *fwnode_mdio_find_device(struct fwnode_handle *fwnode) { return 0; } +static inline +struct phy_device *fwnode_phy_find_device(struct fwnode_handle *phy_fwnode) +{ + return NULL; +} + +static inline struct phy_device *device_phy_find_device(struct device *dev) +{ + return NULL; +} + +static inline +struct fwnode_handle *fwnode_get_phy_node(struct fwnode_handle *fwnode) +{ + return NULL; +} + static inline struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45) { From patchwork Mon Feb 8 15:12:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Calvin Johnson X-Patchwork-Id: 12075835 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=-17.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 D5174C433E0 for ; Mon, 8 Feb 2021 15:15:27 +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 7A2DA64F1F for ; Mon, 8 Feb 2021 15:15:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7A2DA64F1F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com 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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=fO0VrakwwiF0BGfs6kl2tHPLRH80Wjg3DZAV+lzvX0k=; b=ob1wjK4IZmlww+JgfIgijyKZQ 2groQOByJwgghi5tzaaW4GOqjaNIJ420cGLEk4I8kQCVOomrN6B9k/S8Av8YyE5p46aEwHVugI6WK 8OT9yIXdFIFv0HxXhRInyx9jubLS8u1VKVsxv7ufnWi2wtCGHrYKO38WHOP1aQtwEjN9ST334Ie5R dssToPi4DMTDP6T3wUFc7lK0hsLgB197GIzPtuFy05idrGPXSCAMJbl+SJe3PYdDTf33y0FilWyDQ iOrnhguBXmZ/1ZC3fO/YG+r0VZmOjgdG+SPkEkWfMON3cBXlv5+TZT3fiQQt7oVnX9/GE8CT+C45n S19+OvVfQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l98Ed-0005CF-S9; Mon, 08 Feb 2021 15:13:55 +0000 Received: from mail-db8eur05on2057.outbound.protection.outlook.com ([40.107.20.57] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l98EX-00058A-TX for linux-arm-kernel@lists.infradead.org; Mon, 08 Feb 2021 15:13:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DV1Yh8ZG68Ekn4hpcxorHNZXt02peaVBFXTr2azD/9RyWRsHZCQflR8h8aAd8+xSQkbYAsBtG5KknIyyYgmFWhEYhMqRGms0dBqsRA+2jDxqkyWaA68dUBR1ARRm3DVD/5bS1egARHxdi9N85iwYsSOFX+45jb8YIVSu+rSudoDw/Eja87F6dsxsTV2vVhFxJLRERWNI25Pbte3eIow7q4Ixblz7m/uNa3WWbwEC9yfW/AfuacDmuIGvXfNBVf3vFNPdNSJWdOZMHOtE/OmATs4gxk/hPoMZZAdOm8nAnPrDvoOH0sTHHZdf3yAmViDhU/7aG/Ui8dbnRTq3/B7p+A== 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=2V6s6XI0TYXSfjZLeXu1sqJNvc4lJnjwdeZllJubzK4=; b=ENoh1q66JpB3T3rLykSECCrAzNdjWlh+Hhec7TMtzsvTnBmzexIbUQ2xy8ncQbwz0uN5eoOR8URlrrfvcHedqetcVBq3f0Pati+4D9Nqmxi2hMZ3UItCRBa0GmUHnYRt3QRuZnS3ZVrWKsHbhrKAWOmvXFIEocwt0QD+lcvRjvzU/u7jykrJ8Bcspz0RJqI54LYahuV2n+sthLbhxpMiCzLp/KabPk3bLsorZfCnibU7XVbaqzJiIBrfmrhBY+p9+T4JlybQHdNOnI7giB1hlFZ8zfFM1t7Y6rz/kqXXrcgaG1ojGPFuzLr5AIl5coiGgliQBaRuxOWcdSH/QkPALQ== 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=2V6s6XI0TYXSfjZLeXu1sqJNvc4lJnjwdeZllJubzK4=; b=MTzoqcKZXOtZk3x3Un0eJnPPMmtf1acn+n48rdXtYhrzD9TFxlheZftDrGCfvcVoXwAygroq+6barliEOqKoujSHJyva5OwUQbKjZrAwVjts1uoBKUoAw1tqM3FsFHp5wUzJXBX48P97DNidcBUOZqXscU34B+6kFBI/tgohBcg= 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:13:45 +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:13:45 +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 Subject: [net-next PATCH v5 04/15] of: mdio: Refactor of_phy_find_device() Date: Mon, 8 Feb 2021 20:42:33 +0530 Message-Id: <20210208151244.16338-5-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> 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:13:38 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 0fcb7ab8-64d2-45b7-a301-08d8cc442088 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:2449; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: G8GyFoA4nP5CbwD/8d2G8jHeutTLH75D60er6Vioqet5ns7yLCI1YqDvfZjsfKztNu+387saheRi7mKL0fUAVApPtFuOHu4P8WEvJJuUIhepMAxHi7hed2EP4ixHXyYqWbKhFJS9flmsJaedtvu+Yr2LG5bQAEyHVjukoBh6DjQWk1PGodk3jg+WNIlI3kr/GfLkuGRRUeh11CBz6sAeRZC0DnuzMUZCx5n+LxInns3+maz21UtwB6kAwaEzL10/CuyZayXva9H6Uu7k9MAiveQOenYRk7mNuCRoyCQ9v+CTnzu1COBGH4sRzilVhKFw0RU9iP/DiOvT0vyZAJfka5BVKAt3lmLcEMR1r+w1oK8KKroaxYjNuy5K54gLdRhgohCuOxuh7AcEbFC+kgvOEGjhmcemk5Zl6dzWx4KWqTauiweH3prRV2J7fUdUo5Tik6f2dTkhiQAqevdLwOM1YVX8a5YxUj+GE25jNaswxFw9WJeT7xJyEDPXmkKcA0Qttzm3UUsnR4IwagiOu08NytnUoevEWfOMY1m2cnWhqAY2WEsEAFY3c8Y8Yy2bzE+lXCMlZ5w+YVlee1OcF29Iow== 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)(366004)(39860400002)(136003)(376002)(346002)(396003)(8936002)(54906003)(7416002)(52116002)(110136005)(186003)(16526019)(316002)(55236004)(956004)(6486002)(6666004)(1006002)(4326008)(2906002)(478600001)(6512007)(1076003)(4744005)(6506007)(5660300002)(921005)(44832011)(83380400001)(86362001)(66556008)(26005)(2616005)(66476007)(66946007)(8676002)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: uaf8iccntK9P968IgHiY5LnC7D1zxdFj5jsOS0OzJaAUSfwzq1KzNwBdxMhVNG8Fqm9HsQChcToma4UvSpcJulB56UH8TuJwzKDs4GBPQPp9036sdL8D++aJfqbdhSQIAjZSd0UKKQtU+18IPbFFuHir2SE8xXuledQQ+lsk5l4tklJpprpJVzclMFh1wuL1BMASnfHAgGg4V7kjTpRDn0T3Q924NvT5qTHAwbX0X+Ao1ukHLivK0+KOs6HPbMabbBZppFuLJqXZBwWZGFXYVSo37bjLlM5BsFTII1+T4eMawP6KqaPCnkAFyGRP1gc6os9j/PwXWx6st87wi/JHjXryDVQmgoOyPnSBNQIJAdw5vWGGyFU8VFGDDw2XarObI5QB9QcBXElh6DlpPPtj+vgKMEym3+fwUuC24FhGssu6pKeGuKYTlMPMtCgfnAfeloQIEkorGHepTgjx6sA/kzR5zneivszQQ2QXWGCdOj+szwiRICb81zQNMAQWE74AgKhwYiyWiZqvzk1Cxdq3VNzW8Zz9rEkrECDw09GFMNOdjOoFMHuSd6sH4TbsrnlUPDypRSwhtn5BVnFGQH3ti6KMH64nC8dlMMu8bvB5WmLOochMutYp0aPMpVAPbG6tooSWoZyOH/YaY2oKmteRnbg7rP+VfzLBvUQ6uTurSJK2Ek3Q5AVdGHDYs4yVPtbBOSCaMgALCxg+VtuF0R+NlWG7E+N6gHXwVMv15TEzzqAyZ+I+JWNa07nU0CQufJ9IIFKmSSBnC4njFVQHa7ZsOvJWfOEmfm5h/51xGEE9dioskAeE7vOGQlHlDsi6AFbMRBXLcpq+rsom2YKV+yTS87ZRrj+9kfI6qJV3jZtsumDnmq3BYsn7a2uYZ0xO16/jNKSICOwfgoEFG3ErVfFA84BKfVFdBusaiv41uRD4HvfYN4MZhzFrFFkk3a4wtazsXJ9BY1JrNupqDjbY+TJIz2HDSZ+Zg57U9H3H8Jtbv6fVYVwkaE7fLTgOKolCUCWQjdC/oCoqo8WFO/pZ7DE4Pro9+0Owk3hxQCzJ54gq2OV7/1sIhWAGv656/jIDwR40IpUp8DB27bssiyJ4zdgIqFfPTKx28mse3rtNwOxV2evDqXIRM7wp1WWx6iL5Awn+WlUiMw4DOGiff3jvz9dC9FvCLOst12bi1GjrUotRBRniGXpIiDPSaVNmLt/dfEN1p4L2RrSbEJWR11Y7v5fRIK5Y2xxTL930JIbRBRa5i0lkiAMhYA9S/mYKsKuw9JjfnTXihHdL7vfIV5HqCe8YUguZgHo+z60S8YPX2veq0nwj3iUZigd7UiVUfg6KKT6T X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0fcb7ab8-64d2-45b7-a301-08d8cc442088 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:13:45.6748 (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: ppwNg/04Bbi1ZwA7jVMesayP0vnmYH+c/08+8NKzCIMQ5FbWcrfLdd6iuAfQLoy4ja2NKrL06DO/mPSCex3HYQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6435 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210208_101350_013043_BE2B5E1A X-CRM114-Status: GOOD ( 13.43 ) 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: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Calvin Johnson , Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux.cj@gmail.com, Jakub Kicinski , Heiner Kallweit , "David S. Miller" , linux-arm-kernel@lists.infradead.org, Laurentiu Tudor Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Refactor of_phy_find_device() to use fwnode_phy_find_device(). Signed-off-by: Calvin Johnson --- Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None drivers/net/mdio/of_mdio.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/drivers/net/mdio/of_mdio.c b/drivers/net/mdio/of_mdio.c index 7bd33b930116..94ec421dd91b 100644 --- a/drivers/net/mdio/of_mdio.c +++ b/drivers/net/mdio/of_mdio.c @@ -360,18 +360,7 @@ EXPORT_SYMBOL(of_mdio_find_device); */ struct phy_device *of_phy_find_device(struct device_node *phy_np) { - struct mdio_device *mdiodev; - - mdiodev = of_mdio_find_device(phy_np); - if (!mdiodev) - return NULL; - - if (mdiodev->flags & MDIO_DEVICE_FLAG_PHY) - return to_phy_device(&mdiodev->dev); - - put_device(&mdiodev->dev); - - return NULL; + return fwnode_phy_find_device(of_fwnode_handle(phy_np)); } EXPORT_SYMBOL(of_phy_find_device); From patchwork Mon Feb 8 15:12:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Calvin Johnson X-Patchwork-Id: 12075841 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=-17.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 24DFBC433E0 for ; Mon, 8 Feb 2021 15:16:03 +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 CB33D64F24 for ; Mon, 8 Feb 2021 15:16:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CB33D64F24 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com 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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=2tqB5A1WVOG96ND+Li+z1H78s9K1cPP5eTF9YAnr2Ug=; b=rDUHvv5XMX6wsTshzLyOWfukR ItPO7go7ibgktP30E9ZTO4jXhXYGYfHHGvm2Ml1m0MvTQiIHH4wprhtJ+PmTTMFVQUFYCMzuxLwum yOodJglNcPqU1inLhQZ45Y1+10G6l32+rxZhFsdsG/2feoQZ1V4PBZSS3DHdBAL2WCq8LSAln/+Ds tW2pa7n5rGXNUIBNWSBmF7LsZ9StrPrGrtNW+TxIHlAA+pAPXMosLWmPPqDxNCofFrHl6L0SAJFIG ei5OQIaXuEtZ/2dYRi6qZ/ZBqFZ+PQAS1NUKJW3v1ukAf0K8qU8G+YKCTvFAY0k0J0GKA92vyqX6R ar8dttgnw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l98Ez-0005K6-AY; Mon, 08 Feb 2021 15:14:17 +0000 Received: from mail-eopbgr70074.outbound.protection.outlook.com ([40.107.7.74] helo=EUR04-HE1-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l98Ee-0005Bs-M2 for linux-arm-kernel@lists.infradead.org; Mon, 08 Feb 2021 15:13:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E92o0PFFR5dW/w7TWHYo9An4no9035feBSbycOdXgfTyRiUreUej7/124Ck0TzVyWd7lpWXFyf9tdfM+suhq4FmLblJ+dSFbcK5rkPTwA9xANZbUxg8SQJX3IwHk5+/aDIobm8nGx9BqLrJvGzxdkb+SePEsl9dzZwb93psJ/43ucrTNnotJCX+AQjlc+nXYJtU2TiwDh8lyOIkHIydj0Baa+ti08CDiCZd3tRzT2mvj/KNea155obdBetcTv62g4RliZ9XUsPjJscdxbnxVn01BgtpwgoRHEXKhU4ZYx6E8AhQAlUX7BZBx5pHjaCGbZ3U11KAwq0PvOO9iFL5zZg== 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=Scqk5oB3H+Ndj6AYV19BYuhlvsger2Q+cn2c3nKQqmc=; b=ndP8nqIv4VSNkal4qIB3v7B4wi0cPef3A4+nTa6pqwWZGCcWaPlQh0IICx/esjHDeIzhDt9gwTCi/AMwvl4uPKcyzcqbwA9Qzcd996MFuZNxuqINMgGPPhG2jVodDjq5FrGkr6gUEaEMSNE0yLuczQ5sYHiL6/VbKxK6PgxeH7Wh5Wls30QVN9gdg42GiMDiXN5pc/8nx/oDDARwBPVUmUic2vGBGrAXWx1Vq1fuFI+65Tj8AL2FHwQ1kKjtazK/iKV9CRr17R1PRE1iDp2kt1UMzksnS1LePn08tg25k3XmzSdOJ6ivQ/ZZdcBBzaQQVO472d83yqAvVJr8LLzr+w== 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=Scqk5oB3H+Ndj6AYV19BYuhlvsger2Q+cn2c3nKQqmc=; b=hdTavwkW5Zdl48PbKVRHR2tJqBx/t7uQ9o+lMx2tkxHuXdliC5ie/MLrRPt/ri3iWWzL9eG4DrsrxjxdzVF8JBDvA6jemEuI18TkB1F+HHrnMTeg2mdQNwvaYdCbIwPpm082DBOHk9oS+QexXOZQQR0sfTFObNePDAZYFw2fOHI= 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 AM0PR04MB4772.eurprd04.prod.outlook.com (2603:10a6:208:c2::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.30; Mon, 8 Feb 2021 15:13:52 +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:13:52 +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 Subject: [net-next PATCH v5 05/15] net: phy: Introduce fwnode_get_phy_id() Date: Mon, 8 Feb 2021 20:42:34 +0530 Message-Id: <20210208151244.16338-6-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> 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:13:46 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: ac400af8-1298-4085-867e-08d8cc4424f2 X-MS-TrafficTypeDiagnostic: AM0PR04MB4772: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4714; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: M5cBnrng8ez3zUY3lTmi6lNSmN7VbOSOB+VbK++YmV1Q/Cb1NeYxrhr31QjQi3FHYzvYZ7pR0cY2mvxVgWc9sVZG5Nh1VYETp8BVN2oUq2aN5YUefRyL89ER5FJJ9XlQhaQrra5e3AUV9JZ5pgfnjdNimTEE0r+qfHfU6KDWtJf7mCtK2sSnttPTcGv7EnrhsJpWRDUsu49ZhheRgV8CLJ+/pg7r5dT1tISMIDtUbojW6eBSYenez/UEz0L6hUZiVOGADGLP00Azv4c1+qLJhBmscs2tQ6vcodeWLQ+PGuVvkcnmtSI8wYEtEQxLH3YJTNedSsatnhqjs3HoDNtHeSos6RsSPLsS0WWq/7t7BZJHMcVEg4DoePWQTJOfv6qrgbJyDAXLgvw4TvGH78cfbrnOdafraEShUxD0IT33k06fPDKTrjTnQRfwk/XyJIoY4FQtWmR9UZe67xwMBScC56k1GDiXtiEIwUADLr82UFYjYCBdPk69ugXKKKOMgtlRbViFBELTLIkhi6ed/tIV2eCPb3yuBS7jTrUJ//VkJR8FigJly6WAgpuhcPJNpZk7W38jACBIfVdMTQFBBAJLqGmRMHQX+qY1JbSxHYoXgx0= 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)(136003)(396003)(366004)(346002)(39860400002)(376002)(86362001)(8936002)(6486002)(7416002)(16526019)(2906002)(6506007)(478600001)(8676002)(26005)(52116002)(44832011)(2616005)(55236004)(66556008)(66476007)(5660300002)(66946007)(1006002)(316002)(110136005)(6666004)(1076003)(921005)(956004)(6512007)(4326008)(186003)(54906003)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: EEmpsQ4IGfV6iZH3WzeUnigqPFe6T3AMMKMmOCCc1y8SOI5nVoixu9oFbGYp0t0tRstqMYiK+S3CJe7cAL+I6CY4xQUtGX6cecRQ0mXiTEzffo9plXd44Xwaw4kaeOL8dcNIhY/BMxSUa5i3JQPOeCFDtrttrMOGxNJCw9jgPWhj2UZwAqD83yJ1c76NYlv1THnoKdPBXKvrNhhDV+uZ499Sua1V7upv7QEhznE50EE82yrNoUOZKvFZ52ZO2dENLZKcRSpmtXVmEHwkpi8DmEqYJb7HMKPmEY0IzbPrNr1BIfqhgqT7dmooX9jhiy3jLFeiJdynpmN2kp6wMspvwu+VFgXgqJLWEkOqU4LmM1mprO/uFl4AGaJoE3+P5w2cHkOw0JjFakvb3IdESfacVMJK6qB210r/s0zAFItKHbKhGq+PudZRsUOOuQsReAkBc/Iz1nVkZRJPkbG4L183wtcRRxbqAscIqabnCD0FGLt0gBhfz9Kb8jqI4wJS0isSZcbs4SpZHFAJpblHQwhC/KEu/vKPwyp3Jj0K5ltyF2lBBv626hmTygnCCnjDRfU1oX/5ijgSAjmF16KrcCOzSA80UwGlSr470R5sILEJ47OKgDGQ3NFx8qKGMj4PPWYUr/fjDNWDNcnkoyIfOU4gEmCQj5Fy8OdiACEfBBKxObv1V6V0KE9jsfmQJQwivdXs8dpv2XUPoCieGrhGh+2EYyN0yfC7Wj+sxrzeGM3sSnDI34+3tMyxKvn3k2l+mwFP4x0QKOonzIY6vT0Qv9ESWHGVE+LaDLcRg2I6kv27Bj984twGWlCfDOS2A+E0UgEJW3PF5H9PIkCGNn7QOpMJn7PsbXbZuAZ2UoGb0nmnKSiOqMd3XzX+aJZ5NVwq8BgV7PLPfD4JEPOTxfyukrhGLHZ1we8uSk64UlaF+fYxW5LbVoDlBiZTsdAXbR8Vw7aJ+D1ZqWZFv5GLgQhHV7QNvlCu9anuVnsljf+9fKZyFkoI6fMuOEHhmf+84GEkcprDHjcFEbcpFBqTA5V3rf/lMUdUqymL5dqHx4yAe3D+Zd55SSXswLgeSp4a2A1McbHr2tAtcO7qkBznlVInP2gofy20V6MxptPvssLldtHw2w0q7Y0IK6un3PlHSO2w9pqzJ01mGnBQx8FIfSvXLdl4LokYln7W75xgJC1QLxtkodyeivO+Vl/4iyi5OGwBCd1sK2rdWqe8PBwIWWZVAj6sx2N6vZ2Nc8+EEjJsqtHpgHUHAQm27iFNS1zLV3hHkRjRREtuOh4Ce4TAUmMAH2OdAscaxHqS0VEPwiMe66wYNQ4SiaYtUf66RuM8cF2brM0T X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ac400af8-1298-4085-867e-08d8cc4424f2 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:13:52.5050 (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: HQOeN34nkY45fQ4897HgZBVhwexqU1D996/goALsl2D0K8d2YV7couYlcJT0eLmz/FT/mLAAY0BPp1OCmt1WOg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB4772 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210208_101358_057572_9D6D07A0 X-CRM114-Status: GOOD ( 16.57 ) 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: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Calvin Johnson , Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux.cj@gmail.com, Jakub Kicinski , Heiner Kallweit , "David S. Miller" , linux-arm-kernel@lists.infradead.org, Laurentiu Tudor Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 --- Changes in v5: None Changes in v4: None Changes in v3: - Use traditional comparison pattern - Use GENMASK 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 66e779cd905a..6ebb67a19e69 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -846,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) + return -EINVAL; + + *phy_id = ((upper & GENMASK(15, 0)) << 16) | (lower & GENMASK(15, 0)); + return 0; +} +EXPORT_SYMBOL(fwnode_get_phy_id); + /** * get_phy_device - reads the specified PHY device and returns its @phy_device * struct diff --git a/include/linux/phy.h b/include/linux/phy.h index dee7064ea4eb..957ce3c9b058 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -1349,6 +1349,7 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, u32 phy_id, bool is_c45, struct phy_c45_device_ids *c45_ids); #if IS_ENABLED(CONFIG_PHYLIB) +int fwnode_get_phy_id(struct fwnode_handle *fwnode, u32 *phy_id); struct mdio_device *fwnode_mdio_find_device(struct fwnode_handle *fwnode); struct phy_device *fwnode_phy_find_device(struct fwnode_handle *phy_fwnode); struct phy_device *device_phy_find_device(struct device *dev); @@ -1357,6 +1358,10 @@ struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45); int phy_device_register(struct phy_device *phy); void phy_device_free(struct phy_device *phydev); #else +static inline int fwnode_get_phy_id(struct fwnode_handle *fwnode, u32 *phy_id) +{ + return 0; +} static inline struct mdio_device *fwnode_mdio_find_device(struct fwnode_handle *fwnode) { From patchwork Mon Feb 8 15:12:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Calvin Johnson X-Patchwork-Id: 12075845 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=-17.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 DA3BAC433E0 for ; Mon, 8 Feb 2021 15:16:30 +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 9941164F26 for ; Mon, 8 Feb 2021 15:16:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9941164F26 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com 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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=BwfDSWwKHFmk+SAb50PoqWJ6O3xZbTjVFytT10UlOJg=; b=b3y14i9+6RS12oQK3LS7iuso4 LweZJg8g+bh13gjHaEaDgkkp9FqTeBb4wbTJ3uDEOS2nPF+Hvq7iIeoVd4y72EO2VMmYSdn1m4shE JCqhe91GFFJ0N+65UAZuaC+4VqoATEgRc/9Gxk/oqiDFd7bZNKQTs8TgfGBD8LurZjpROUKygmeVm OQPMlSpaf7BoSMlkqpKGOGAaEOQmZb7vSo9C+eFKwTFZm78V6BaaGam9TxcD2vJwA0TO58LlIlP8B P1vCgevbFIaYaxE4tzqcHS2dE3JusybWxEJPtSpORgZsI6Zs1A0wEZj1KKkBSOBGU11qMwA/0ppWS OzIGo6WDA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l98Fb-0005jl-Cr; Mon, 08 Feb 2021 15:14:55 +0000 Received: from mail-he1eur04on0613.outbound.protection.outlook.com ([2a01:111:f400:fe0d::613] helo=EUR04-HE1-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l98Ey-0005NL-II for linux-arm-kernel@lists.infradead.org; Mon, 08 Feb 2021 15:14:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EGR8i2qnpYBYsBpwlhgEqiM8BMdNJG9Odlil5YYq8JqQaZIGVj8sE+O8dcTMfCyZ3dRKTtvSzY6FQBL4mmKZDL0uGcwC1R2UDT6qNyweoDSPGStxQ2oo3ZcJFfOpjyEl0M4JCm7K4RL9+ggZsqJNROx9gnFsaZYCgQmr7pBQGDuchR+xUUxTn5DNIa0ONgEid8i+KgZIPHYHQNeUhassyFbo6fQjbPtxNz1fCBS7kBqYaFcQJRgv3mzMTwsmKmkIDTv3nJUbZsOslw2UcCu4LW/1LR//2DcReCGh2mYpN4SQlx7psrwqsC+EyskuJnuSUhduhCjGcMl22V3ISwhyGQ== 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=Mr0qwQO9Qn/2Fvqmt6x3cOBdgVvKHvDjHxHWCZw6rXU=; b=TBXa2L2xrmQeas0LZf0mEJndKbEQjVl6jQwT0iRbrUUwVl2DvkbY7LqEhF7KmE4JHRghhTWR233crIjsNQwYo6eMG2fQUR/qY2x/FlhM9ceYBsSVoheLcfnfu+h2URKxkEGvBldbZ1DsFoRTabL16m1h9IWrb3EY2E211Ea+0PyZUDdUf3Pr5kGMzEAvKd95Q0ueHVxaeESFGsPlxlWiQ/patELNIPV4Pyq5znVBd2o/ddSgGTrlMGX15jp3NTFxCrhCmIPh0gLgpOCAXNW9CTvXPu11xGBysS0WArp2fAtrqIFY4aXgORHML6CoX3fnqRjGClR/EncfHhzKNFFMZA== 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=Mr0qwQO9Qn/2Fvqmt6x3cOBdgVvKHvDjHxHWCZw6rXU=; b=JPk0fqbXla8HdzjnuLOQW2NmSmHIRWqnhmYnAMw87VYX86YKSBVreoJwE5usCzP5PFDXwQDHR3M30DO9cX90AvUXSgXlb8m620DeZn+f/JrBj5W+esTKM31q02KCwtEnLrdddMD/a1pplTzHRyMnJXLonsmjD2ws2Xa3bmSnzoo= 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 AM0PR04MB4772.eurprd04.prod.outlook.com (2603:10a6:208:c2::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.30; Mon, 8 Feb 2021 15:13:59 +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:13:59 +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 Subject: [net-next PATCH v5 06/15] of: mdio: Refactor of_get_phy_id() Date: Mon, 8 Feb 2021 20:42:35 +0530 Message-Id: <20210208151244.16338-7-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> 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:13:53 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 9a041cb5-baf2-4ab5-3cc1-08d8cc4428f6 X-MS-TrafficTypeDiagnostic: AM0PR04MB4772: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4502; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yWx8N6o0QkVFm6ajY5+ycsOzNjT9gSgXGv0hVdJ50wr6AwmrmESlnUYc9XCT0kf0WWtdQnMABs1eFAlunZ/W/wlklleRtFOCB2wOV1esJDPi5XRZ4PVhbWrFy6EJYJ2e/KuDjcZcz7xlEZ1ClqD39V6a0ouYM3GkN5xnwa4Ho65NlLKYuttgVgQo653weazZ9s7NegtV4uULk0xg3wQ1Wpi96BTwrjrrLV1hB9UkSBB9oQF7v3pzSCm9aTUexcxP+Qfx9u8R+RuHFPq2BlwHwwyDm1FkcKDnJBnaO9iJ1Ys8XLRg+a6cNP1Ey+VEVI5jy8bYcmvvruWrbshHcPUSJ7biqmb60KfrH42lipr885TU74q8orDD0n3HRStZqimyB0NNvaBmHbWjAH3qEy+SXS5XCWqiW+ihKwjXnX4099RcteLiirhw2CjJ1yJthG9jiti0wYzJMg6ulXHNeGAUdM5UBwSljQs3eNvwIN4nPL+EBaw8NNQGpLAJZYBdnxOyqz8tBbrzvoEzELsbF/m+DxdWhHz0M65/NoPozxOnb+sD6sfzMv19E2Pfmt+ST5JECqTN83fHLftuRUzyWXQjpA== 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)(136003)(396003)(366004)(346002)(39860400002)(376002)(86362001)(8936002)(6486002)(7416002)(16526019)(83380400001)(2906002)(6506007)(478600001)(8676002)(26005)(52116002)(44832011)(2616005)(55236004)(66556008)(66476007)(5660300002)(66946007)(1006002)(316002)(110136005)(6666004)(1076003)(921005)(956004)(6512007)(4326008)(186003)(54906003)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: yFtUSHz9l/T9Z4LJRVl/umaKO9XsRqcM20ivkQTUsIFWoxAUR7SMnCDoH10W+1QiPQncofV3T088oJYJVr3I/7roHzt/yHW+S4i5C8ppQipMfZsVTwY/YmaL+zi3vHgnMTzep257oDjvL3lrX+vXgpFZEQpio6rg1DpIfydkwYUfMCG2Fh8/V3zPbczZzAmNvzbiJHy8sbQz/ReB+fBPXei8M4LibbSNAiy0Izji2McpvItyqdQuroYDLLMcha+bKek6MQhRBqPYR8YtuH8JdyzIG4h20+oEPmUSiqIN0E+a35QjwncYQE/2EfHaoSFCPI/srhStqwx+Y1hQFgUPnVMoX7jyd0iEIGnOrotdQ4fUvYqSDRRYpEzm0Ldbw7J3lwUcj9Umn6AbTRC1ltTGiqPH/eRYQfuKtD5h1coef4EqrnD4Ye+AqUzZJHR08aNWXuYOmaR6n0UwKZWA+VH1C9p4YWyXULHP9ACq67UssZaMiKiDWqo3PHdRTdnlDOfHVX1zg3m6NfGfRDoPntrd1yPLLLEWG09uRCQ0easa6DQ5WwxEuyoI2z3Ni+XfhNeW4MJf+dcBJuJgoFkR4484ClUR+Q23cx5wmvHv1Pm8c3OGwD6syRYHy4/kfjXp18nXnKFnzozHk5YSLyQVJJBq+5YYCHBH9NEQUDnij557AWObWMv473BPwvOicMggeg4Xq8Vki55bkzBR2NJpjJGUXkh2WufXrkk+RD9ks7A1VIKPZsmWTGiQDZ5ziFAu25wdNaJBtKgEMbFR6xkL1+U8obz2UilooZrzWGKU11+osCE+R5P9pQB942k/T3fzycBtpKlSjJyrwq0rbW1S4j5WMkeYa97vxNREcXHRz7jJ8Km/i2wHRxB1tBwhTMFKK62iJ9h99j1SeI0SM1QtYe9eBzzoO839kGelIFSvMYSy6AvrHzlmZjiowXfAYUa2ujf7BtW4ov2zA/o++aANohG7gCQaSNyskIaCB110OvIhXdEYd4aajC9g+t9xzcqEnbi5eT3fmNKubD1RunR6z5lo1Mu/WcvOn7KRM4BJ8SFbMUlIQ7YSuctWqV5PkcAMxRqiSTgssfUG6bsajrMjVDQTVysq5nxNAPRUVDknc56OgwxoWd7L2pl6kB1uSIfNGVJTUZCLcB+66LWPHxGw45v3qElkSGO2fS96W6BJT0JBV64NB89uio4yE6yth/2IRNyaxcjx++hM/w63YCDnhZXV2V6fNoRYbDTmJqxqWwbuePFaR4waj4CX+DqqYWBlX12bOlJtuhyJlHauVazYPzoZIf0A7KVAAX3+pwEYKWl+4zVRDRweUrtNuTGycBY5p7vt X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9a041cb5-baf2-4ab5-3cc1-08d8cc4428f6 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:13:59.3761 (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: xRckg273teGyb1yPMg0oUxHekXv2hFjwoB8HVwhzTxifhlUGGL6S4VgDX6h2Nm9YPHBBzovcTr8HzDBjkQTTMQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB4772 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210208_101416_653732_DECB988E X-CRM114-Status: GOOD ( 13.84 ) 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: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Calvin Johnson , Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux.cj@gmail.com, Jakub Kicinski , Heiner Kallweit , "David S. Miller" , linux-arm-kernel@lists.infradead.org, Laurentiu Tudor Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org With the introduction of fwnode_get_phy_id(), refactor of_get_phy_id() to use fwnode equivalent. Signed-off-by: Calvin Johnson --- Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None drivers/net/mdio/of_mdio.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/net/mdio/of_mdio.c b/drivers/net/mdio/of_mdio.c index 94ec421dd91b..d4cc293358f7 100644 --- a/drivers/net/mdio/of_mdio.c +++ b/drivers/net/mdio/of_mdio.c @@ -29,17 +29,7 @@ MODULE_LICENSE("GPL"); * ethernet-phy-idAAAA.BBBB */ static int of_get_phy_id(struct device_node *device, u32 *phy_id) { - struct property *prop; - const char *cp; - unsigned int upper, lower; - - of_property_for_each_string(device, "compatible", prop, cp) { - if (sscanf(cp, "ethernet-phy-id%4x.%4x", &upper, &lower) == 2) { - *phy_id = ((upper & 0xFFFF) << 16) | (lower & 0xFFFF); - return 0; - } - } - return -EINVAL; + return fwnode_get_phy_id(of_fwnode_handle(device), phy_id); } static struct mii_timestamper *of_find_mii_timestamper(struct device_node *node) From patchwork Mon Feb 8 15:12:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Calvin Johnson X-Patchwork-Id: 12075843 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=-17.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 3D3C4C433DB for ; Mon, 8 Feb 2021 15:16:18 +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 C083464F28 for ; Mon, 8 Feb 2021 15:16:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C083464F28 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com 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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=fnsEoKU96jNUXkKAndGZXSBL+IQXDXZRJMPd+ozL14Q=; b=OhSN4uSsEbQ0R2T9Gmc/5WLDw Ac0NuNJGbb5KXO9+7iHL8u3N0N8pySDvoH2wpSFfCNmCojrRXJ0GyxUl0xfY2Jg2Yf5lGy0K08c+V uN+ijOGa6zqKEw6/+fLAKn8hiSQPu1l8FVcnFvkKULzMSgNou6clfZ09rcC+5Vmfm14Kitm0G9JQm FI8Ulc0BHKUP9GCDL9sk9v3EU276zElsVvOxMy4GHyNuz8Z3k6RG3XBhE8BbtZD75ofGKxEm19mWM 3sNSAIrRDYxGLxc0P1JVltFbeJvisVYRrXL9hXwRCBu23OELKrHJr7wDWExL+fYG4rH8ZIIrwXEJI 4IwkhK1Eg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l98FI-0005Va-J0; Mon, 08 Feb 2021 15:14:36 +0000 Received: from mail-am6eur05on2075.outbound.protection.outlook.com ([40.107.22.75] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l98Es-0005Jf-PT for linux-arm-kernel@lists.infradead.org; Mon, 08 Feb 2021 15:14:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MXy3Kkou4PQuj2kzBrWIOVziepuChiHZ6vf/hZcpZPcUkIwpAW3vmuPnF/xm68z1MMze5A9K7izv+zgOm1fOwOBbrg09etBokUNzRkpAxvGd14NF5q2GiUnMn7+3pfkkp2/901zNE8qkWlyqnFWCCB/m7fkHYVO5l2WXyp7le3T3yDGQfUP5gm7PRuRTZJnS9/ilmpnLgt8uqYhVFoaToTnCwxjv1RavtXf7MY+J7Cb7fcuwSrV5fqLGuQkQoev1SaUOy25lfFqqeqXGK2k2a0/1GWr1UEMrDgk79KBkfwwcngYJjtOnlNKVOYkaIDPrpFW4097KAR94NzD/wn5srQ== 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=Y0DzNknCy4kzCZIErFlhvXWI3OW6q80jHOib1InfJkc=; b=YttKUHFAm+MWt6wtEM+DxLqE3ap8oj2fVqJOZVLEDR4V+CJe8h6TsP5qh9r14SggfGTbF2AVwB+hn1xdn8DyFdZ31G2TU6ehipa0YT02nEtdQstry/ERRrVxFW+U7rNGVP3RwJs4r7iPfZ6u4A1vEyTA0TkfcjhOxCSvXvlOBv5qma793SeeVISDjQQKDSBq10fo0nXrcsybPPBsGwd7/4TiJtrqkqI/bhSXYTRY9u/N1fVjv8fixUnLpA0D+XyIkEqkbPunHDJOT5/WW+vx6BOe/+7DzWBxKeMU3qoQd03Pv/z00res2buF0Y5dPL239AYwdPa6XG4UqPGpzlrElg== 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=Y0DzNknCy4kzCZIErFlhvXWI3OW6q80jHOib1InfJkc=; b=iLs/K6sXi/sbsHfteHm3j7LyYiX+fT5UmVPlGrCykzqKTCNKeKoG7qXeOqJ1YfuOX2MYNzDIJbDfbUbTEAYFB9i50HkOO5dtMgBOAfjNvtCNcbv1K7QNwGTRMr7t45SFcCrT9Fu9RGLmY173gBSTtUP1CrrlPnmclltlfo7HcC0= 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:06 +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:06 +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 Subject: [net-next PATCH v5 07/15] net: mdiobus: Introduce fwnode_mdiobus_register_phy() Date: Mon, 8 Feb 2021 20:42:36 +0530 Message-Id: <20210208151244.16338-8-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> 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:13:59 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: d5066c55-cc12-4f3b-2c6e-08d8cc442d6c 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:6108; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xxFO64Iw854qoHKNhib3XTKQ0FJayLUL8re4vQ5K/hLQ+dX9BpER/D3JYIVDHRfPPl+WbALfY7syAId0i2PZaDct1Y9hi/tTkxmE0NG78qxTY9+kOMwIpFboyvsWbO6kdLImTOgfe35mzsz8eRJ3SuSC8l8XQwN1P+EbG7/s2E00aBawHqWbaYqUMFu6fEEc7Rqg9LOREULK86whl6Weapcx6ooimldR/YN2FPCWMe9FcH9DxjcIF/i290oxT4J50M1fJGdnTMxMXFj6pnn/tza1ZSgqI8AJvn62xZPDDBe4i6kkKPu3ZgbFdXMYNWBh2V4Z2M7/wAT0rooJKior9pyU4NaoNrYvtPryzKRQFk1i59o0u9hLiN4wdXjKMmQ033US4ef5Yw5lzlHzRB82a6i+X++GMpmyvAxky21RVvA6gFu7DU2BIMVAuu4idiWXIbpkZTZ62QirQ7UFs8bQnPIDI0gRv8/I3NI9u14avR89aOukwk6ScAN9OQ3fXChnOykqqG0ty7eOy+cX7atXsXmAQLUkPJyp6tebRCQqs43sO7Gw058Hw/OGxT42pvIvK4jcgJd0HVsd6ThMgEfI6v53R8NNB3GYlBbYXim9Qa0= 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)(366004)(39860400002)(136003)(376002)(346002)(396003)(8936002)(54906003)(7416002)(52116002)(110136005)(186003)(16526019)(316002)(55236004)(956004)(6486002)(6666004)(1006002)(4326008)(2906002)(478600001)(6512007)(1076003)(6506007)(5660300002)(921005)(44832011)(83380400001)(86362001)(66556008)(26005)(2616005)(66476007)(66946007)(8676002)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: SPgJGsEyzfzpX4OWPXX2ODre98s32sJLjo31Ds9yYz1ereONuDMywJ2f751OGVIxzQo1pom9wG+u2tsreSxfLZz7+NblyJwJstY/u/vk+jA0QpRQDIbaTkwFoQPdfBiZsxZgqp2QHC0A7ZhDcRTBSKSStUXTvlhiCVBRpW/y6GUgi4tvXyTZtMqIjRDBwVl6Fc+Wd8+z72BtMX8eJfSlO6m0mPgLuyNe0Nky9izU35HdJE3K/mNavuOEtZoxFbnWbY5myMlYRFywoEXuEyp6oSSziY115kKCghDAsAETHLzenm8f5xVZunc1ikckjeoTgWFeaWeX0sbxr1kKpvqtqjFEZ4XXFR3uwS4TcbUa3tlHHeVM6ytMu+wpKjRSmxWkK/5uTq5Qdv7OlmLo4W3ldXXifxKsS6oh24N/toxRlk3h/1+SB1i6yVHGZk3eYDH7j7ZRWighncP+d5vCFteOhWi5a2idMM+6aEG/sh6GKYFm0/UK01mXjsCZFjBOD580r5HSAWxc7Ekhn5lETTvA/bG22lQDhoLk19sXp34r+E925XcU2YWVSDM0Cr5SKKriLX2fZNlQUT9219FFEp1T6zRVSID7yzHZumyx0jdRevZsNR2j5DIbPsLuflw8NMV+7GbvFZ2zwU6P+weLfMbNUf1tyKbD/ZQa1jWrT4OgJ2euk6bPJ+etRds8ds207NLIW1L6B7KYr7LtGjGu3M0kG5U2MAFOOwu9kAvGsXftc9vPqrguu6JhjflzlIeEyyfkZgtORytH58kT9XM5TSVZ0oKkWufTi3ys7/ASQilMvg0Yy6MVAEp5g7V7n8jGDP+gaCeJVxzyaA5sKNO/VKSMwQcAUmDCe8EVjRhXuYvVp9X/wj6nlHbWxBxyfkJLVMpg+G7DkBhuFv0nWyJzpWcDhPN0KaY9iNf5HoinFOUOO78/CSoJtnccPj+a/OMVPiJF7T2d7PReksNgtmKe3gn8WE2yilG+g4a5a776Owyr+ISZg1rVpzCJZ2btYfO9yEXTQKMFjeQ0yazFWBjHo0dYWdk/JbnGQDT5srBxhTzy9NfugywGVzAVGXJnf9v23E4smIoZwutjYQbw0/DLwEWxyUjVSZVM2pm9C1G5XeCk6pccLttvp7vV+as6ggvopzHUnF/b5fL8n1MRvX78WwvdorXR6KnuPqI5fm3swK7iZAHfemrzfkTqAY6G+hsOOShyjSabJmRR9zm2couwue+f94Anf4WfshbCaYRP/xcQrngOEYSX3TSJh9p28gJuMXXpiDs318Cno0etGqxd7rs4yU6JOk8VKZ07DaNf+kPfiVWIxIyX8oAvzSYBS177DX3m X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d5066c55-cc12-4f3b-2c6e-08d8cc442d6c 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:06.7050 (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: VYJ4kYwE9npldhRdWMKwei0A0+GUWjLv2oD2UreAfTox+tqujMGBiymB1rNGbHLh1KqsU1f4dtI3aybXMc+G7g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6435 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210208_101410_891567_C3DB505E X-CRM114-Status: GOOD ( 22.46 ) 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: devicetree@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Calvin Johnson , Diana Madalina Craciun , linux-acpi@vger.kernel.org, Rob Herring , linux.cj@gmail.com, Jakub Kicinski , Heiner Kallweit , Frank Rowand , "David S. Miller" , linux-arm-kernel@lists.infradead.org, Laurentiu Tudor Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Introduce fwnode_mdiobus_register_phy() to register PHYs on the mdiobus. From the compatible string, identify whether the PHY is c45 and based on this create a PHY device instance which is registered on the mdiobus. Signed-off-by: Calvin Johnson --- Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None drivers/net/mdio/of_mdio.c | 3 +- drivers/net/phy/mdio_bus.c | 65 ++++++++++++++++++++++++++++++++++++++ include/linux/mdio.h | 2 ++ include/linux/of_mdio.h | 6 +++- 4 files changed, 74 insertions(+), 2 deletions(-) diff --git a/drivers/net/mdio/of_mdio.c b/drivers/net/mdio/of_mdio.c index d4cc293358f7..cd7da38ae763 100644 --- a/drivers/net/mdio/of_mdio.c +++ b/drivers/net/mdio/of_mdio.c @@ -32,7 +32,7 @@ static int of_get_phy_id(struct device_node *device, u32 *phy_id) return fwnode_get_phy_id(of_fwnode_handle(device), phy_id); } -static struct mii_timestamper *of_find_mii_timestamper(struct device_node *node) +struct mii_timestamper *of_find_mii_timestamper(struct device_node *node) { struct of_phandle_args arg; int err; @@ -49,6 +49,7 @@ static struct mii_timestamper *of_find_mii_timestamper(struct device_node *node) return register_mii_timestamper(arg.np, arg.args[0]); } +EXPORT_SYMBOL(of_find_mii_timestamper); int of_mdiobus_phy_device_register(struct mii_bus *mdio, struct phy_device *phy, struct device_node *child, u32 addr) diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index 823518554079..33d1667fdeca 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c @@ -8,6 +8,7 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +#include #include #include #include @@ -106,6 +107,70 @@ int mdiobus_unregister_device(struct mdio_device *mdiodev) } EXPORT_SYMBOL(mdiobus_unregister_device); +int fwnode_mdiobus_register_phy(struct mii_bus *bus, + struct fwnode_handle *child, u32 addr) +{ + struct mii_timestamper *mii_ts; + struct phy_device *phy; + bool is_c45 = false; + u32 phy_id; + int rc; + + if (is_of_node(child)) { + mii_ts = of_find_mii_timestamper(to_of_node(child)); + if (IS_ERR(mii_ts)) + return PTR_ERR(mii_ts); + } + + rc = fwnode_property_match_string(child, "compatible", "ethernet-phy-ieee802.3-c45"); + if (rc >= 0) + is_c45 = true; + + if (is_c45 || fwnode_get_phy_id(child, &phy_id)) + phy = get_phy_device(bus, addr, is_c45); + else + phy = phy_device_create(bus, addr, phy_id, 0, NULL); + if (IS_ERR(phy)) { + if (mii_ts && is_of_node(child)) + unregister_mii_timestamper(mii_ts); + return PTR_ERR(phy); + } + + if (is_acpi_node(child)) { + phy->irq = bus->irq[addr]; + + /* Associate the fwnode with the device structure so it + * can be looked up later. + */ + phy->mdio.dev.fwnode = child; + + /* All data is now stored in the phy struct, so register it */ + rc = phy_device_register(phy); + if (rc) { + phy_device_free(phy); + fwnode_handle_put(phy->mdio.dev.fwnode); + return rc; + } + } else if (is_of_node(child)) { + rc = of_mdiobus_phy_device_register(bus, phy, to_of_node(child), addr); + if (rc) { + if (mii_ts) + unregister_mii_timestamper(mii_ts); + phy_device_free(phy); + return rc; + } + + /* phy->mii_ts may already be defined by the PHY driver. A + * mii_timestamper probed via the device tree will still have + * precedence. + */ + if (mii_ts) + phy->mii_ts = mii_ts; + } + return 0; +} +EXPORT_SYMBOL(fwnode_mdiobus_register_phy); + struct phy_device *mdiobus_get_phy(struct mii_bus *bus, int addr) { struct mdio_device *mdiodev = bus->mdio_map[addr]; diff --git a/include/linux/mdio.h b/include/linux/mdio.h index ffb787d5ebde..7f4215c069fe 100644 --- a/include/linux/mdio.h +++ b/include/linux/mdio.h @@ -381,6 +381,8 @@ int mdiobus_register_device(struct mdio_device *mdiodev); int mdiobus_unregister_device(struct mdio_device *mdiodev); bool mdiobus_is_registered_device(struct mii_bus *bus, int addr); struct phy_device *mdiobus_get_phy(struct mii_bus *bus, int addr); +int fwnode_mdiobus_register_phy(struct mii_bus *bus, + struct fwnode_handle *child, u32 addr); /** * mdio_module_driver() - Helper macro for registering mdio drivers diff --git a/include/linux/of_mdio.h b/include/linux/of_mdio.h index cfe8c607a628..3b66016f18aa 100644 --- a/include/linux/of_mdio.h +++ b/include/linux/of_mdio.h @@ -34,6 +34,7 @@ struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np); int of_phy_register_fixed_link(struct device_node *np); void of_phy_deregister_fixed_link(struct device_node *np); bool of_phy_is_fixed_link(struct device_node *np); +struct mii_timestamper *of_find_mii_timestamper(struct device_node *np); int of_mdiobus_phy_device_register(struct mii_bus *mdio, struct phy_device *phy, struct device_node *child, u32 addr); @@ -128,7 +129,10 @@ static inline bool of_phy_is_fixed_link(struct device_node *np) { return false; } - +static inline struct mii_timestamper *of_find_mii_timestamper(struct device_node *np) +{ + return NULL; +} static inline int of_mdiobus_phy_device_register(struct mii_bus *mdio, struct phy_device *phy, struct device_node *child, u32 addr) From patchwork Mon Feb 8 15:12:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Calvin Johnson X-Patchwork-Id: 12075847 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=-17.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 D75ACC433DB for ; Mon, 8 Feb 2021 15:16:53 +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 6228F64ECF for ; Mon, 8 Feb 2021 15:16:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6228F64ECF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com 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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=PPyDOz08f7xga3KMekAPypJy2Hb6BHHKG9IyF39Q87k=; b=acgdbmLow+8geYODR/CnJzkLe 8cCGacF4Za1IzwpDyAQ5G86EB8k310JHqdaajzjpViJUNCs26wevNBrQOh4Cq26jqGggLK7Q2fiFv 4GWY83CPywRRV4QYo/0d72YJIEDf2x7EIAF3JUkzMfsbIgbELL8x/TARYa58wcNBVuSuO05RyaE5Q ZUctHK2I+8Bag6iKYuu7u47gDJcrS8eDxdmgogdJLuvFNxGL7GhGy3Z/nrghdOQoPEJ2gj4odBSvN fgZiuyWWhXfmZWrmWlWKbq9937RZKslVsfI8whw+/7TDa1knlLKDuw9OxMI6Ho9dmeWuQ5FDLbq8n EqH+XVM8g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l98Fw-0005w7-B0; Mon, 08 Feb 2021 15:15:16 +0000 Received: from mail-db8eur05on2045.outbound.protection.outlook.com ([40.107.20.45] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l98Ez-0005OD-EC for linux-arm-kernel@lists.infradead.org; Mon, 08 Feb 2021 15:14:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TKU0Dkr2OAwzcSJxYoQEedSvAurNqRMgmhJ9zGEuqOyHUrwoK8BpXINv8uCdR/o8wP3WmWeJIGmHA0lsJYGnnW16DYmPqvSXDJC5jpked/Bv+p2VZrIGiisxi42eSDVvRFyLQ2qmSrA/slLyzTyMtsc4Eb4IR4E/XezfSPml2sbISPvXAV6oAtvUlgrDsm0Gf/4qj4lzq7YN4QHT5rpSjl9liDHSTCxoj2a3LXMl+Z3u9Zd4jCnbdV1EBCvt1PcLgnC3hDdZH4Qxycw4eQdQNUNoFa7bANl0CkOmDnNP/s0dnUdfLmSRE1T2RGbpVle42UMRsLFoBGM0VEKpPchk8Q== 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=ETB8+V+4Gpm18tAYRLC3Fvpu7R7EaJlh09wSYLgAhZQ=; b=EjuIEBr92PJGzaNeotFt5aZtgDfbN2nTU8T9QPW4Hmkgqzry9RW3vefzPmcpgEWKiYEyauBvi/r0j7Na0CEK2o0E+COP7kav+NnHixVzeTudaYZcPNL/T2P56qbQRmqPGWUKbyjxTSPCPiCAa8JlvIH0roTu3Cmx1/3UcPkgKc6jqgNuo34v4IaximiuhrwWSrOVkUce1xT7/ErvVbBSH+mDv/xvWXPll1MRUgvBINpWutmwucaM6tpb6aRCzWcgom0U43g6t5xCla0FiRHh+Q7ncRFB/MVoEq0aGM4R5rionXqVkjU5f4IL3lWXQ96uDAgAbVaalsrVnKfDwTFNcw== 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=ETB8+V+4Gpm18tAYRLC3Fvpu7R7EaJlh09wSYLgAhZQ=; b=PZnAJW8rU+xiBTuxJAZ3HTHQuKBqoCxeMQpfAdYIkh3oTrP9dGqfUaudObic+LGZuDWYsuQ29Wh1upO6IwAjCmeBwaCfpUezmGQoxHtjfcwNKmBwSm6/hm1wtatLOngAdn033Y7OGROUkknfqn8Im71TK08VAHQhzQ8lbqZwQgg= 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:13 +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:13 +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 Subject: [net-next PATCH v5 08/15] of: mdio: Refactor of_mdiobus_register_phy() Date: Mon, 8 Feb 2021 20:42:37 +0530 Message-Id: <20210208151244.16338-9-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> 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:07 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: e0547086-c34c-4da5-7179-08d8cc443176 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:4125; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZPD3075oLNeDzu7MTCCs77+aW1RpbKo/RzpgZ/74VMIYwfVBaIefeYqjw64ZCyIQ372sXKfoLJLxlvKAFZot1F1E0vHadCScCDxMbeGDcteTxuBzq9r6WZEK+4dZ8ozN1ZkpXLXtBlAxpt7v+bkn9GK6EWOH+8xraCCxZKjfZOwHWCV0pHn8hVzf3ypakXqozDy4F/BIGcahuV7d+bVZXAce1VFI3XoOoZGpoWKHs5IH8U4Xm8SOKANT/4DTJxl74VlbAR4KPYVdDE2fs+SXsh9E59zi3oBqlFiIfhDcGgmNJKM02NuKBqT+eBbeRhoQYbuu5RzlnmbGQ9TMo9rDooCxj+muq8KGiRG/39PEuMS8yEGWjqvA6QgPiyTcuvvtbjPpBeSteKkOnNcDWwIpKD7/MIscThxjFMuCDx4KOkF0gaDE4mkCKjUW3AQoOXuZb6CBIXLh2cNCdC6tNJW6j7RWvOVHSVQUczYBqRV2Fnjjc0ModZPNIaYT1gazCjhamjEdGVkTHMbunnT+Z7deo/FFaDCdvi6J7uvqAN1roJtdBwH47dH78R0BdiJxDsdbKayeHv8RfKY5f/8SKo6k/g== 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)(366004)(39860400002)(136003)(376002)(346002)(396003)(8936002)(54906003)(7416002)(52116002)(110136005)(186003)(16526019)(316002)(55236004)(956004)(6486002)(6666004)(1006002)(4326008)(2906002)(478600001)(6512007)(1076003)(6506007)(5660300002)(921005)(44832011)(83380400001)(86362001)(66556008)(26005)(2616005)(66476007)(66946007)(8676002)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Xf2AchzxsG+mG8VofkFSrfW0Ix4/KY7MU5zb3CTA1a8Sfhy2R0v0e16g3qEKu34eutcJ98mTZ04lCvg63Rwhv+HrCVuf/IQE+97GG3UDB4tciu4dW+S7hPlyCun2CZaG8U8LmVS/sLx0GJLd+XfDb+vYvY3ne+9MWCI3ZUwA0u5G3ynrrLqKPY+9CgZJ3qhB02G4FSZ8+EAEsH/jXN5mOS8Jxyo5mGa9p5uowYMftnlAIUCweMtMS/V3/quPTFKiuoos6rjc/L5qCvvJDnmCUIh81Hg8su6IPV4LyyKuBKIaSs8dBDi5MdzzfRqEsK0lmGTY4oIDj0dyCn2RAFi2THBDfOWiVzqvG2owqePfL107Om8jYwAsT8E0Rr1hnJ+FvzBiqzcKH+Z3KwGuqCbop+SlyScfXcUCdhhBXuplbtH+tSeDzEgk4VtKG2MG7pdX2o5oW2M/J8EFYy686rvkGha4fbuNC754PPeNSIPHgfPkPEGSFhwi/yvYunJhi2u4LKmnVMqKT2Awdj49XZc8TAUKbEqdKlHa8qqfgyK7FXUha2ibhQaXGDwhaaxsF1UHEZ6vRA0sbMs5TyV6CWz8rtUwtPN7aw7xFE2ycXarmSgDDYhggcE002SjDSbmhycpIqaf9IYg0PibLW2GifblHrw7yPtKGLwSYREEUVPcAbyn8Hhkd5WFU2Bci9zGwc+Z0E5eUYdHLdYA9lDIv+9q+J8NyPNX4CVmFeqa0hCGIg2GlNtZCky6Y6t2uxr6sZAXXrAzZc7UxMjl6NLLlsjjTe97mTcOBLCo2ikJrKEPvDyS8PiC2mmuKCWn/JFVL87cSbE2f0WlMwH7ogmIxtl5PQQVEQP5dAKSikwhZwgZF7A454/I0/RZ9CdGAeqdsoBo1NYpdHNePTyxzBqhaCW3wLmarQ8JP55PXtlndy5n+RDdNk/Z2zKjCxOEew9hCGrxwfEWW2872pJQUw5IdwJLmKhJqybJJVmE1B9FwB+CyCLEJL0s7Ho0uFhEGH0YaQM9iTEekD8OS4uw7Kcg3R00AkYHe7W8JMHNg86vu5Wl4w9InHFNCrRBwbAxXwsQ4VgiklV8uRXfIdaWfSVJUb1j4pJi24nJIQaNmfIDTIBOO7snh2xYjN/4ZnPBH0RAkmJkq/F5X4MQiM11gGl+tWwD6tDQSojjRg0sD/X5Mr5u92Xem17VT/gRNFw2t9VZE/vmiEbRjPOSYimxpjXnEQ/qdKZRgmXz7TUMZxKMGE6C4/1cnlecfS5Lc3nKDUw8MUTBex+wVejDyNpGhyZNxP06J2KbLXv9OHjqph0UK0eGUluxukI+r6t3J2pXTZfIXIN7 X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e0547086-c34c-4da5-7179-08d8cc443176 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:13.4582 (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: plm7j+3BeUXT6bJG891A8UA7nRj8060EqkJruFpOfhgxl5bkZvnenLu1cKz2Bkoq6EyF+hW3BNM1VWzTevPo/A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6435 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210208_101417_550705_7F344DA9 X-CRM114-Status: GOOD ( 15.18 ) 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: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Calvin Johnson , Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux.cj@gmail.com, Jakub Kicinski , Heiner Kallweit , "David S. Miller" , linux-arm-kernel@lists.infradead.org, Laurentiu Tudor Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Refactor of_mdiobus_register_phy() to use fwnode_mdiobus_register_phy(). Signed-off-by: Calvin Johnson --- Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None drivers/net/mdio/of_mdio.c | 40 +------------------------------------- 1 file changed, 1 insertion(+), 39 deletions(-) diff --git a/drivers/net/mdio/of_mdio.c b/drivers/net/mdio/of_mdio.c index cd7da38ae763..1b561849269e 100644 --- a/drivers/net/mdio/of_mdio.c +++ b/drivers/net/mdio/of_mdio.c @@ -98,45 +98,7 @@ EXPORT_SYMBOL(of_mdiobus_phy_device_register); static int of_mdiobus_register_phy(struct mii_bus *mdio, struct device_node *child, u32 addr) { - struct mii_timestamper *mii_ts; - struct phy_device *phy; - bool is_c45; - int rc; - u32 phy_id; - - mii_ts = of_find_mii_timestamper(child); - if (IS_ERR(mii_ts)) - return PTR_ERR(mii_ts); - - is_c45 = of_device_is_compatible(child, - "ethernet-phy-ieee802.3-c45"); - - if (!is_c45 && !of_get_phy_id(child, &phy_id)) - phy = phy_device_create(mdio, addr, phy_id, 0, NULL); - else - phy = get_phy_device(mdio, addr, is_c45); - if (IS_ERR(phy)) { - if (mii_ts) - unregister_mii_timestamper(mii_ts); - return PTR_ERR(phy); - } - - rc = of_mdiobus_phy_device_register(mdio, phy, child, addr); - if (rc) { - if (mii_ts) - unregister_mii_timestamper(mii_ts); - phy_device_free(phy); - return rc; - } - - /* phy->mii_ts may already be defined by the PHY driver. A - * mii_timestamper probed via the device tree will still have - * precedence. - */ - if (mii_ts) - phy->mii_ts = mii_ts; - - return 0; + return fwnode_mdiobus_register_phy(mdio, of_fwnode_handle(child), addr); } static int of_mdiobus_register_device(struct mii_bus *mdio, From patchwork Mon Feb 8 15:12:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Calvin Johnson X-Patchwork-Id: 12075849 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=-17.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 839B6C433E0 for ; Mon, 8 Feb 2021 15:16:54 +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 3386464E15 for ; Mon, 8 Feb 2021 15:16:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3386464E15 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com 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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=nJB+xasEjr1KZY32oQtL+x46NL3Qfu5rLd3atdi7UoY=; b=jHK+wHJqj0fVM9FKbAGgkuOPX b25HCbd80jHmmTZMe2E12QWg+12/EbanM1uVli4xes5s0rT+zsFFklwOHXrD0t4S5pH8FxpLRH6mk pUlPAkVSg1ckPULxuyiBMjBZbRbhKO9TkNODnqXl1eGTzjtf4PO2n1GZqRAQ3WZz2Dm7Ek3GssF9f ZXKqnCeloNHEIsfJHQGa/4VJvahUJqF2p4BttZS28rF6k7QeOBK7r8OU9zHYDpKKPWQtmqVUC07Fj A9RlZYx4IkYKIDWfh3sypmV+SyI54UNvfbHcKzxqv2dU7F7wJsJgV1PeI7PybebWRTSHaFi0ACSvo r5u0AkjnA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l98G7-00064O-Tq; Mon, 08 Feb 2021 15:15:27 +0000 Received: from mail-db8eur05on2062.outbound.protection.outlook.com ([40.107.20.62] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l98F5-0005Rx-TA for linux-arm-kernel@lists.infradead.org; Mon, 08 Feb 2021 15:14:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TtCkWlsBK/dkbnf9Vq6JdOLzEEvdd1UDf5pJLkv3xFgi+oQclnb3bGyuKBnXgSgea2b4on/GPffxnBsecFYwgr/s0cIRRI+eK0SrOwYRbbj5uD24i0X3ZzUH4CgvxuTqhQxX1ggyFG9OCjf8HG10NQbztZeFM+xyLVsUGWYx1uX4J+zbbwDDmj6hX026of9lACzTv+Kz8a6lrAhvhTx8R++xWX5LXcHIZSGLitPwt1Bo4l75AHmT4X0xfuxCxi1hIxZ43GrURsBh+0e2biIbcSAINqtjFvvUSVxOvwaDHzApvxVNZ7WmksOi4EBUAkzMk7qJdErf6PDb735HYpPGWQ== 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=tL0qBZPAdiA2FFpa8M03X3CM7yKo4+kkGIejxoTd1uk=; b=FadVCjCvY1Vdzm34ln7E/+MvEMkb8TeuxjVmCr6iIrR1PwIcTb3+6oJbp+mzSJF8qSY/oLixPhF45Ekv/sau9cPeHd5OZjwLgZmaDEFYPMhmsY1iBFxKOYPNdScLM28kWoMmUVuOde3kIyWItAYRk4RwqQZIFk6SqxLKhQjGS8mg2CmNKoB5o89W+CrUY9wJaNsBEV1RXXUVieeL2qiiayg1RHEAbrtjUxzSDKUFbII0dveKDAD5mRmhZXHWiknNOQ1ley+DAIurX2/UTIE6gzwTFBwARX1pGu52XunGxqN27t/ZYQXi5q+FUDRFfGYq+INiIZ0tCbwvQKDMHkQjSQ== 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=tL0qBZPAdiA2FFpa8M03X3CM7yKo4+kkGIejxoTd1uk=; b=JjSGfFaA7OFbkqEbha0Hrz0eSmjIIB11X6A48HZaRYBuyt8WTNLV7pUPxub3++1KTH3GHNP6qvIyCCCGckKYxJXi3lOaFUExh3WoBJul0FAmKlGG6YmVEdf22tsQJFHuMZnjc3XgbQVeA9RiEKNMxgH1Z4eeBkysjfr9qIBgK54= 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:20 +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:20 +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 Subject: [net-next PATCH v5 09/15] ACPI: utils: Introduce acpi_get_local_address() Date: Mon, 8 Feb 2021 20:42:38 +0530 Message-Id: <20210208151244.16338-10-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> 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:14 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 8bd6d8fe-2214-40b9-66f6-08d8cc443555 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:5516; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NdYfx0wIbD67ZPd5CGgToNiPmqtR5Uy4PFvtESaGarJR6Ys4GHel7s4DYoVnnizJ4eESoQ2R8vZWYjlZx4t5yPiF9yf9FCKHp4IUz/16YqD4/kNYpJtpmnOmL7yY5NZyInFVesM4Oh2jWiTL2/HzgGNNwoH87B+9xAR+DLj1/ByO6/4Z68ORESyT+WPibO7HmWCyur7mPMJCWqlEUQgVgNiJPpEhZj/Q9Mx+5eyNf0OsiHFD2ZH8FIYyxF7scCgNjr1i+KG9la8zcTFBmJp5f3mSFIg3VTE+MWHm9fPr4gmphQLA5IYZwpqKnb12bMXMvNh9pqqThjGd8xgr3w8hhGwSjuvE2X9sknAAqayARdgTLMCYsNc79bc76r3QkT6JqjKfcv8Gt3ILEbBfuR/TCBNe7OQAS2Bkw79slPw9MYuQ+aHmHxVRkvpCxkpcg4raEMv8atPvptfbc7r7aGL6+wveKwkzf8W5gFmElc0E0Bhf0whH2ao6MZNPm32Z2SAewFqhzVl6A3ybp1QvYyC6hPF5DSsod1M8nIivWEUa7lEdoPIkZJ8Xo2BTRq7S9QYZLpt9+7drWDFnzT0yPOqNbg== 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)(366004)(39860400002)(136003)(376002)(346002)(396003)(8936002)(54906003)(7416002)(52116002)(110136005)(186003)(16526019)(316002)(55236004)(956004)(6486002)(6666004)(1006002)(4326008)(2906002)(478600001)(6512007)(1076003)(6506007)(5660300002)(921005)(44832011)(83380400001)(86362001)(66556008)(26005)(2616005)(66476007)(66946007)(8676002)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: dsmiHnJByy+QqX1b3Qj7ZlstgurKIHbJ/JGoVDahH9zUK5OijF6gnTdYpa8GwCnut4smwfM+BuMFfuy5N8+pSxuTgEaWyFMkQVjCyebXFQI//W2yaBRgfLQHTi3mX2GTfhPQ3T9R3mLHsOprmcpKpxohs64kx2Bu4naqfhBCphk65JExQV5qv3kJrpNC/Zmv+/WS6p+/aHEdAwztHrj2qZ0dm8xd7Y1/wlhqZjxP8Rn+kvocfww84p6VSy8Pe2ZMkJlNMErXzsqrB0YTb8Svcerg7YND9o9gp7iuRud5/jrEnMi8oZmYSMkB7pjxSZnSL+PUV5/PBAPI7J4gHjKdCcJSCgHvyknsgZS8nNsmoy53E9HlyOVPzriLLKxQq/IeJIN7UtbUI334SgEpG3jXaltDXaF6/yGFKdiOV0TYd6RDAdttiqv50BZV8NeZKA358I+OFMeVIEe4OXSWxLVYIcuZ9LpU30CzZ/jxu2t6YZOS80+WgaxDalTuNhT7e98wGs0JxeOE0Kn3mWxRcK6Ey1vDrCZJkyzaGQC31IgKI+TS2sP/3qCWEl7VZFxTMATltGrQRQFmx0A3cvtEpycGlyc/JO5aVTF7i1WbJQwTt8LF+CcGDTOppBZuvSODzcyF0QKoiT7SlFBIs4i3gtJW69jYKnWFtr83uqp1iyY0yyhX6wCqxsALP9LDvjvIx4NNhxZ+ZVXPkCTiK+BFe50Fv70pzdnkHILZyzyYJVqZrdwi9yGSS6nOLeZ/j+FaEws5/AuSwkNAkDPJ2crDdx+XdidhjQtO4/MNboSzSoUvw4TDqhlA76Es0yAiuJ8YOxHRYvDRSkc/6FRy173Wp0Nx4fbvng4Ras8lzjpcqqB7Cz0fY70V8e+KSDX+QGolQ7GGzmY6cUlprXkdQlzK0VFfXFjjLCeRiVFSbGibDGks8BVyJqyoQB9k1Fv4EMAetih6RWalHoWNTiJd/GGpRukmm7RlfD8WuCIJn9Cnsb1ij2iQlINzV0rkFO/iLSWh/nid/8jLHRo8nnchySXbfoRvVkxJTSNYCILbylEIM/cBWiIhwcHTC85s25+OHykQxNC7n3d+xH51rM3HORfC9pl0gqezc863o7T9vGsVFM1LyhXi/w0yiKSH+phbAm5uWR6duNcMm04u9nsjbqD1asHyc5IDsNKysNbTLm+o+6p/qw4GX8ZydR0ceOZ0uPn86XUyLRBdlt25ZSXwAJ9qiBjpylGWaVUSiLAFWBZeM52FFc7+u26dgtHBnMv4nKvnLx7M9ezTztwMp7TNNLbhZ1Ui92p8BbGlsQRDWo6q1AHvWg4TbdgBqXWY0QFvjpooNcbG X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8bd6d8fe-2214-40b9-66f6-08d8cc443555 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:19.9985 (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: 5skC722HaIAA6MF4royhG78ERK118GjrONnFEuXLMevBNdlORAGYq9EFDbTP8FTpa7HC3MgaYVmwlkv7+dkFhw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6435 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210208_101424_018058_FE6FDC6D X-CRM114-Status: GOOD ( 14.60 ) 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: netdev@vger.kernel.org, "Rafael J. Wysocki" , linux-kernel@vger.kernel.org, Calvin Johnson , Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux.cj@gmail.com, Len Brown , linux-arm-kernel@lists.infradead.org, Laurentiu Tudor Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Introduce a wrapper around the _ADR evaluation. Signed-off-by: Calvin Johnson --- Changes in v5: - Replace fwnode_get_id() with acpi_get_local_address() Changes in v4: - Improve code structure to handle all cases Changes in v3: - Modified to retrieve reg property value for ACPI as well - Resolved compilation issue with CONFIG_ACPI = n - Added more info into documentation Changes in v2: None drivers/acpi/utils.c | 14 ++++++++++++++ include/linux/acpi.h | 7 +++++++ 2 files changed, 21 insertions(+) diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index d5411a166685..0d3a2b111c0f 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c @@ -296,6 +296,20 @@ acpi_evaluate_integer(acpi_handle handle, EXPORT_SYMBOL(acpi_evaluate_integer); +int acpi_get_local_address(acpi_handle handle, u32 *addr) +{ + unsigned long long adr; + acpi_status status; + + status = acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL, &adr); + if (ACPI_FAILURE(status)) + return -ENODATA; + + *addr = (u32)adr; + return 0; +} +EXPORT_SYMBOL(acpi_get_local_address); + acpi_status acpi_evaluate_reference(acpi_handle handle, acpi_string pathname, diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 053bf05fb1f7..4e5ce2b4a69d 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -699,6 +699,8 @@ static inline u64 acpi_arch_get_root_pointer(void) } #endif +int acpi_get_local_address(acpi_handle handle, u32 *addr); + #else /* !CONFIG_ACPI */ #define acpi_disabled 1 @@ -946,6 +948,11 @@ static inline struct acpi_device *acpi_resource_consumer(struct resource *res) return NULL; } +static inline int acpi_get_local_address(acpi_handle handle, u32 *addr) +{ + return -ENODEV; +} + #endif /* !CONFIG_ACPI */ #ifdef CONFIG_ACPI_HOTPLUG_IOAPIC From patchwork Mon Feb 8 15:12:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Calvin Johnson X-Patchwork-Id: 12075861 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=-17.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 89354C433DB for ; Mon, 8 Feb 2021 15:17:28 +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 2902464F35 for ; Mon, 8 Feb 2021 15:17:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2902464F35 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com 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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=W9S7tL8lBff660WcI/sXWQcS76EPGrQOZDQZ9R2Tx4o=; b=FhJgpqZTwqIrapsOHAOCJYkrC ZEoodLfl4gDVL3nhtixfSOT7AuEE4DAPMK2XKqt8TJoXTJW757Dri7YR1Npu5k29GV9PMf7fQGcxc Db7tyjatRX72AU5sas0cdGSDCMwGyvx+q0aBlwSaMUmaHwamWLtKAzqVkBelz59QnOgjTMRpAPDoA cY2laCBbxoxKuTDJ3w2YJseS+f0elmydQtdsh/vTMYUAaesmAIvk3eTW1ycoLwYRvBR+0q4OeAMSu l6YFWKvyz8g1Fb8x9qW76rc/cawBlhQWtaa0qXfwRn2TutABQsECN1ozbStxe7t5/Sf/wkPon8UXg lzg5HglbA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l98GJ-0006DC-Sl; Mon, 08 Feb 2021 15:15:39 +0000 Received: from mail-db8eur05on2047.outbound.protection.outlook.com ([40.107.20.47] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l98FB-0005Vo-8i for linux-arm-kernel@lists.infradead.org; Mon, 08 Feb 2021 15:14:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mjSM+f1jipgZovyyaWtWv02jIgp515sWqmCrh2mL5WKiri95KOe8D5x+fqwPEQ8oCCZQ/oC8sCGrDHVl5Wbf3QDwpFnuCxYyC2lq97HYOP2Isvy0AXGpxCsUZaeCL8KsRuqz7nO9J4RGsLyRDzYiqcLyYg+nybVNiezDkHNb/uIYcxzgXbInOF3RwfUuV/2c0shixTdKeoXzgLQeZI46rqAHrFjbKmYcQ7pIDrGjkJKwYR/+XzeBpoOpG2R/A3hjuLsJUj0ZQZB/RbocfvI9touxeuTuiUDT6Uu3oFcy8gD9KA4Dkd04sCNMjvMcqXgv0bRyxmc6qRIdWhu53IWhUw== 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=2vpzyNxHB/NCP2AZQ1pbojSLm6PLIJQLvUGjRDw7+rY=; b=C5rFEyDPFmpLVbBYe33NKTtd17NjKam8VjHfzPwT2ugY8xcACSIMrEvc5nbLcqIyetbtYXY6qvZEQW343hJ8TZ23wSgxobbkGAnuyndWeTwsOwSqBxjw9rQforQ1Hoer2d6Qs/kQaWBGaJuHRqYu2GWRk3EdDEsJC59VRuHS3Cx+0VEaTdvI7ZAdX1oggPpCP68jeb8noHjoG0wYjW/I5fQ+knIJ5qyhZH+QqtPuE8sjNt83GDymZQanbzCYooh8BOYzyyj/QiVdT9UM7DbYNJOYHzU4KqzTkK9TjIfcRLcbi73Kxyal2EzNZ1iUaEFvqZl5s4a29DMdDFsaZcuv2w== 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=2vpzyNxHB/NCP2AZQ1pbojSLm6PLIJQLvUGjRDw7+rY=; b=YadZdt7NDL+WC0i9DmhQR8iTlPUnrBmA/ePbUtng9GGhxZJk1lrmcBSRTad/zGHs5NnEo1sGNZH98mNcm3nHR/2slu9jYN8wI+xCNv5IXvyFWjUGm4duS4f4NN7YBJkmArEbleNpfNCBKU8/YMUdYnR9V1p0kYqAcC91cz0Ok/k= 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:26 +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:26 +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 Subject: [net-next PATCH v5 10/15] net: mdio: Add ACPI support code for mdio Date: Mon, 8 Feb 2021 20:42:39 +0530 Message-Id: <20210208151244.16338-11-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> 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:20 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: ce6f506d-85b6-41ce-18c2-08d8cc44395b 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:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +lKIpCDDZLYnJwfOKIvRT3oIV63IZeUCdS0un2TV/Mhv3ZtfGPDtuxa8h8wLbRUjgRP9SFXHj5X5xYwRj52Yt8KIJLetEfZsnDyJYxB3yzRocoRcXxOV5bRzbCKVT5tIZxWUjj2VJ7FfmihgmkVw7Hc/mfrQaeFr0f0iEu10dDp44pk4CMc3T5N2V0oeCz6s2sFR7Sp55EiocNC1Wc96FpCcm6sHrOe2zmnHiBxGCpMcd96E7IPFjtt6jbcCntBVMGnd+UxYSxg8yMjozyM9FhTBhyW20/HOOJnxwS4DbQ0DITP8NmPpWSpwBuwX1DEzRu0pynpWJS7An16COPBJHLSFqYVr8XUUC8M6QZWTyURl4sWzk+UZ2dPYRQa3ol5byjoCjk6KwfQ7YRmOpQ+HoiU84b/twWHwFxMck7cRoy10URj1luxDx9uMgPqHIB7VNDFdIwhPUpo1HGAEYNJrPbj+4wzhbNfp9FDdrcJt9kp0q7jtHKgPaMv3TGe+zg9aCekVyoNXJVofq5a/BfDSpe22ylbSP0+G41KIJ9CUPyQuehUNMPiEJHU+frmjgvclcgrrclKWepJ/sMFXM8WJxQ== 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)(83380400001)(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: CAxmBoiVBuv/ZRdNMV2JsQ2Szcbw3fqYx8zuWsRcnRKI7p9EIEGH5++slB9iEQqxHcPbmjO3gh2GcihORlv8zLftUzhr3SHZ+Ng/9lV3f4kxMjfW+yuMuWZC6WShthC583hD817ROHxbotcw2gk/HWTt+yKw4u7XFM1uMNiMKPyXSA/f6ACiRK+cw+xAVJpJm8eutz5XiLdY0XeTWDmCxjbNuUR25pMQKeNJNUMb5eB/CVoIxYSbhEeDtD4xBR6Wp+laKE991vv7P5EyuYp5KLebeQwwVqL1aFLCDBIpe2fdJaoInWJe738xpoPX2ivxqwh9lalMThfGoglI6yaknXujGUF3pTlMuxdlcutqfRpIwinv7Qaaciy1wuaYbH51JUQBKTJatRgqU9eJQEfgaL3agQ3Nm4QqD1WJ9y7lMb1bAAA8kNTw9tFyfTq4NbD0Q5gs0W1+0Yh5POnJ/tCgUbV1d4O+S2IBsjvx8AeZQvGThKiBqpOLs9hLkY8yotgxnd6hw9GVWkvqOb8d75DV6/Cf9OSCjT+1jRndPP6PZ70zjR0af2aXohlAW1lkF3azuf5ZUfgBW6tHSb0dwVmA0+IrY0jvO5BeBa/+ZMjgkgEC24B7Bv9aMTBg8ZMH29Rs1PTR5KG3QwKVvWEa6Pe/DFKLZ0olJprFSsXN6F2Fj3XhguHabSZ0xtMaxgcynptPC7mPMFCPi527uwru3VqEdlBPycOPxT3Osp2bqzvGRkS/9U9Htk7L0SN+3Zh4NJ6aHq4WUv7qNtmAm4+kUQF8QIpxbPVQm4pUtvDClAfqh+ZWrw2dRaVXIWwZajkbJyG1l/3VAmRB2oR8TzeATu5sMYW/rwbxJWc9mZkameG2uTYAajgyhBWi7klQVVO18SU0GUeL+fJg/s9HrLIYwUjRlALoJb9TYzp/DbVzUU4CehFVne5Kuz5TYEiyqOYoFNF7IyS1VQMDBUPPe4z60prkbGrOCAL4yNjb9yN6oR0NcPDTtQEzH1+8NF/53FceEsy/cBOeEt8pxQ3IofAJ55rPPwcnxb+vkuuXXiCuI6UUwPMOu49F9iMU5fegUhRr5aeypFTaNo+1XlomlZRIO9cwQ2x4QOC5oO+Sg21/pH+epshgmA8zx2M4HHwZWGfRtCoEe4fCJAHpf3+dwamu+CYC9ESkPMlz+Entp6h4oCjd3p31JDzc1SAiIgj86VKmMx7nj/y94rlL1Jl/JLSG6RXoD69xid9YTsRRYm6t+LJ0CWiI6vvJ5yie9lAiDSzqgFtDx/JhVGACStLVLkAKelf2C/BdfdRucYsJHjZ6DY1PImuTrD0WwjclME9+s1PYG3VA X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ce6f506d-85b6-41ce-18c2-08d8cc44395b 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:26.7917 (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: GOQP6vGh6qwSBXPhRvOX5/U/R/XEoo7x2SQLlIK3A1QIEopBEDghUVP+R8tQQt/qGrd67GYI8uQy+DWgFNh6dA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6435 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210208_101429_496914_7A05D34B X-CRM114-Status: GOOD ( 25.28 ) 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: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Calvin Johnson , Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux.cj@gmail.com, Jakub Kicinski , Heiner Kallweit , "David S. Miller" , linux-arm-kernel@lists.infradead.org, Laurentiu Tudor Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Define acpi_mdiobus_register() to Register mii_bus and create PHYs for each ACPI child node. Signed-off-by: Calvin Johnson --- Changes in v5: - add missing MODULE_LICENSE() - replace fwnode_get_id() with OF and ACPI function calls Changes in v4: None Changes in v3: None Changes in v2: None MAINTAINERS | 1 + drivers/net/mdio/Kconfig | 7 +++++ drivers/net/mdio/Makefile | 1 + drivers/net/mdio/acpi_mdio.c | 51 ++++++++++++++++++++++++++++++++++++ include/linux/acpi_mdio.h | 27 +++++++++++++++++++ 5 files changed, 87 insertions(+) create mode 100644 drivers/net/mdio/acpi_mdio.c create mode 100644 include/linux/acpi_mdio.h diff --git a/MAINTAINERS b/MAINTAINERS index 47a5e683ebfe..ead71f60607d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -6669,6 +6669,7 @@ F: Documentation/devicetree/bindings/net/mdio* F: Documentation/devicetree/bindings/net/qca,ar803x.yaml F: Documentation/networking/phy.rst F: drivers/net/mdio/ +F: drivers/net/mdio/acpi_mdio.c F: drivers/net/mdio/of_mdio.c F: drivers/net/pcs/ F: drivers/net/phy/ diff --git a/drivers/net/mdio/Kconfig b/drivers/net/mdio/Kconfig index a10cc460d7cf..df6bb7837d6a 100644 --- a/drivers/net/mdio/Kconfig +++ b/drivers/net/mdio/Kconfig @@ -27,6 +27,13 @@ config OF_MDIO help OpenFirmware MDIO bus (Ethernet PHY) accessors +config ACPI_MDIO + def_tristate PHYLIB + depends on ACPI + depends on PHYLIB + help + ACPI MDIO bus (Ethernet PHY) accessors + if MDIO_BUS config MDIO_DEVRES diff --git a/drivers/net/mdio/Makefile b/drivers/net/mdio/Makefile index 5c498dde463f..2373ade8af13 100644 --- a/drivers/net/mdio/Makefile +++ b/drivers/net/mdio/Makefile @@ -2,6 +2,7 @@ # Makefile for Linux MDIO bus drivers obj-$(CONFIG_OF_MDIO) += of_mdio.o +obj-$(CONFIG_ACPI_MDIO) += acpi_mdio.o obj-$(CONFIG_MDIO_ASPEED) += mdio-aspeed.o obj-$(CONFIG_MDIO_BCM_IPROC) += mdio-bcm-iproc.o diff --git a/drivers/net/mdio/acpi_mdio.c b/drivers/net/mdio/acpi_mdio.c new file mode 100644 index 000000000000..7859f2f3352b --- /dev/null +++ b/drivers/net/mdio/acpi_mdio.c @@ -0,0 +1,51 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * ACPI helpers for the MDIO (Ethernet PHY) API + * + * This file provides helper functions for extracting PHY device information + * out of the ACPI ASL and using it to populate an mii_bus. + */ + +#include +#include + +MODULE_AUTHOR("Calvin Johnson "); +MODULE_LICENSE("GPL"); + +/** + * acpi_mdiobus_register - Register mii_bus and create PHYs from the ACPI ASL. + * + * @mdio: pointer to mii_bus structure + * @fwnode: pointer to fwnode of MDIO bus. + * + * This function registers the mii_bus structure and registers a phy_device + * for each child node of @fwnode. + */ +int acpi_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode) +{ + struct fwnode_handle *child; + u32 addr; + int ret; + + /* Mask out all PHYs from auto probing. */ + mdio->phy_mask = ~0; + ret = mdiobus_register(mdio); + if (ret) + return ret; + + mdio->dev.fwnode = fwnode; +/* Loop over the child nodes and register a phy_device for each PHY */ + fwnode_for_each_child_node(fwnode, child) { + ret = acpi_get_local_address(ACPI_HANDLE_FWNODE(child), &addr); + if ((ret) || addr >= PHY_MAX_ADDR) + continue; + + ret = fwnode_mdiobus_register_phy(mdio, child, addr); + if (ret == -ENODEV) + dev_err(&mdio->dev, + "MDIO device at address %d is missing.\n", + addr); + } + return 0; +} +EXPORT_SYMBOL(acpi_mdiobus_register); diff --git a/include/linux/acpi_mdio.h b/include/linux/acpi_mdio.h new file mode 100644 index 000000000000..9be6f63cde8f --- /dev/null +++ b/include/linux/acpi_mdio.h @@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * ACPI helpers for the MDIO (Ethernet PHY) API + * + */ + +#ifndef __LINUX_ACPI_MDIO_H +#define __LINUX_ACPI_MDIO_H + +#include +#include + +#if IS_ENABLED(CONFIG_ACPI_MDIO) +int acpi_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode); +#else /* CONFIG_ACPI_MDIO */ +static inline int acpi_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode) +{ + /* + * Fall back to mdiobus_register() function to register a bus. + * This way, we don't have to keep compat bits around in drivers. + */ + + return mdiobus_register(mdio); +} +#endif + +#endif /* __LINUX_ACPI_MDIO_H */ From patchwork Mon Feb 8 15:12:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Calvin Johnson X-Patchwork-Id: 12075863 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=-17.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 C4CF2C433E6 for ; Mon, 8 Feb 2021 15:17:33 +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 646E064F38 for ; Mon, 8 Feb 2021 15:17:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 646E064F38 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com 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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=tWlWNMdMpLzQGhPdGcqOtuhFKETg1Ji4WjGyA/oTjeE=; b=BNDMVOhepDmmZjB8LL+jMQmcp hc/CFlMGRJxrJai9dlqVXlv9EehNfwmrTuyXkkAUIEMNEANERFhm+YDsCp27XMiQQ+32pJLj/0uq7 8RxkWf9T4VgJphoIFfdDHzMIgstU2+E5zGMJrLUqB+mpvvGSVXdZnF8Y8+Fg/6/zwVaKDt7nLnXh6 avt+7uJ+R7XlFB7LofBva+O2Jz7u3uh4t/8Nux8UWhjU35lhR0U+DDMhZzk2hmumpGrXypFxT6W/A V6NtiOdH8h97Xkctj74vSPplyYqFSLlgYhUdIwFfMC5r9k+tj7CJYUn0cK74wpdkuo4s0+gJV99/8 ABxr//6Hg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l98GU-0006Id-3y; Mon, 08 Feb 2021 15:15:51 +0000 Received: from mail-db8eur05on2063.outbound.protection.outlook.com ([40.107.20.63] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l98FJ-0005as-TZ for linux-arm-kernel@lists.infradead.org; Mon, 08 Feb 2021 15:14:39 +0000 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 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> 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: B2YN6gbW2ACF0+QA/iPC/UFcFeI/9YG83DNDcerVgAaKN0FGXXZheDlR2CdJog4Hk2BRMf3kNfkSnoT6l+2otu/Pm1cZT3ZZlKf4WMvWjS6cq0Hvw+lRMyn+ySRSZULALhyD5Y0tO/TNhhukbEtYcANWV2NlY+Ydkei0jxMVkqphFv4F/hEH5jANE+0Kx4xivbdygppX3jJDnX7WgcRaefiZGuarcqobCgJq6dtSMc8tS4SiFtyrCJcT+B+6RX58Ya3BbS2e1BZBO2B/8AB2MxoSQ0iKQ7kL0486fBMDHCQUBxFcocVOSqDltKrrcSYb/7vpvjOzx1GmdPbxhIEo3XqEo6gEgXhhEWM2AVNRaxNpQeNZOgbC9K9RBhgYrqtWcZR5x9PzEx/gFXdl4AZhd6zFZPOaEPF7THltwNYGnMXC3y5rj/XgEjiEkaPYdkz/encUlPsDQm5PHpzZJFfitCPPZlJUHo6xXc1ZRQPU4k/F/irT7WXk5PwQU8MWfdqogKtCZr4hLQrQB82GxIfL2la1PbWbgLEFV7DrzxK7zkTz9Y8y4w6K2HuWweo8TQASICAoU3ritVW9NOk675w+Ha8xteYYUFslndMSP/NHlnn5P3aS22lGt6/obzxZ2VUdjTMSb6Dxx1KePVs+K4a/HjKIUdcm54xA3NiqHgSHv3L4dH6f+T9kuy+zzRM3IGHiHIR5Z51j9mM5ZvbpntOA82fDbo6aB5dYaLBqYKYWUhFAMHpelrmu40msjMfYoZLuGZ/zFEuHfwo1+PivUmyCjH76UDxG0f25eF73okJmC1NN4Zk7rwvFr97N8mTbVAREr0XcYLB55vxDINpJx1I5IPtnOBj/Adtep03fjZ7UonC4MoTopAN0mA2fZc8ZbQ43yFhEmcUCUr1ciLdyLV0MwUlUF1x/LlAzbs6szXv5THC+4frcm2Zru7N8x1sEPyw1yeAGmQKPtScDntr0OgvfV6QUFr7qUdBx6HyiuvoOv1bNwJ6XijcIgU/TrjTf6CdUrlmr9KnrcFRPdVPz6X2NqZg7DrHmcHdViH+lRzAF8z35N0ZOIkP1NRqhzYhU+aFTvmFlopniMlhXYnwZn59iKAREy7R/JTwoHn8MPjviadGtEmpATdFRQVYMZQGfnXvmj+F3NcBu4HkKXjGkDanGNFaEloQD3UApOi7gf34YQSHVLzfRv726N3KOI8G6q78z0RD05HuW6RW5V0ZMojZtaInDcftlVYBc15jzcUjLt+0dqE+zUHEBIEYLxJwpHzq24lvRs7WleDn2ZDXmwjLaJ69OPdqjY1uLnoUiT9MKyFTvxgUVqCIK+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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210208_101438_498865_25246E9B X-CRM114-Status: GOOD ( 17.37 ) 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: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Calvin Johnson , Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux.cj@gmail.com, Jakub Kicinski , Heiner Kallweit , "David S. Miller" , linux-arm-kernel@lists.infradead.org, Laurentiu Tudor Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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); From patchwork Mon Feb 8 15:12:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Calvin Johnson X-Patchwork-Id: 12075865 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=-17.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 A7E15C433E9 for ; Mon, 8 Feb 2021 15:17:41 +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 5157064F3F for ; Mon, 8 Feb 2021 15:17:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5157064F3F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com 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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=215U4g68+VP0S1IvJwZ2hW7pAvmG05SpzuCj5QNe+uY=; b=qgy/bHhlzHKrbx7+kYtnpDM0s CujOv2eiF9xxsUEa0luhTH+P+uwsJtZw50oODVllH3W8vVRmZlyLcdKwo5pyjyFcb8ddfYjDXD4ns kb1FOqbP7K3NRbi2nsxnGxos2iwRPHO7EwTKDEHZuC4mm9UiidHS9VyyXQjNO2tNSTCZw/V9us2dt L1IHn9nxXFQHggpdlhp8j25uRjjTO9OQCMvNnv5ywZHphJxaCjLBuYW7Ng9LUvtitNz4jqKub1Lb7 5C9OB+8rjLfBxdwAav58Ae8fdtKKXDhGcxbRN4FHB6uGMttvUR/CcS6TFypTraG8j9HuU9+ZMLm1o n3c9ZW0Tg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l98Ge-0006Qk-IE; Mon, 08 Feb 2021 15:16:00 +0000 Received: from mail-eopbgr70045.outbound.protection.outlook.com ([40.107.7.45] helo=EUR04-HE1-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l98FQ-0005ds-52 for linux-arm-kernel@lists.infradead.org; Mon, 08 Feb 2021 15:14:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dCUwBus1Q+xDPKi/hflCDR8+UmK7v7lC6rxBZJQ40ZLnay/sey3fKoWC+RMhZpIEchVwvREei5xTapOOQMKLKPNNWu+AhVW8Cl9TZjsJo/z7pBqUdka3u5xYW5DRLYOaDKd7jGgjYn7tydKoTf6yQPQLo+ipxE7Wn99IaMRyFCS7lpb++C3byQswflwj7nRhc/bHWvPo0IfktucOB+wRraW3UScR4xPHVthaEQ4TemCbEw2M8fJuPGm1Bum03izFgSxczDlwIt7iSMso5Ke6FO6e7Nnja0M7ulxm1FhkW5KfaurZCtHr/hBb9gkyhSJ+ROA0DdvGTVZidvx1ubrRoQ== 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=gCBp8rO7dBQKpbM34w0p7sIq38kfFwlkSd9Lunk4aSk=; b=RmWgLaWUlCfdzW8gvLfUl2u+xWKCAsEqzIY3KugdsRH+DBmmyPJFuWFdskQg1uRr0r42BV/L/oYM0Z7qUEKF+euqPlFOVSlzYDyb2S5KyM9W6ahBk2Zq6HuBqi8sFXcE44CLl5lRyohcYIx2FwekQ0oSkKUByzeXbxUZY3nPQPDt4ot/7RqRoK6AZ4nSMIekk18aZ3scUydK30EDj1G0XmnXCb+3Uqa9wYuc+MZ5HG8eXMQ4SUrIyAVh/ZldXKViI8h7BHGqX6YLZcyBBjMRDmcZhMGpx60AVLjYbDvm0o/YGJqHSTMYKsYiWOjaRkGjnLMWPgLyMgkYbngDvgdHFw== 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=gCBp8rO7dBQKpbM34w0p7sIq38kfFwlkSd9Lunk4aSk=; b=N+GPvRrknzarMoN48Lp8Kku3rZ3/jLQ6vuAnpdQUJESNj13LMdatD26Ywu2quVOFm/O/duJpaMXEo67/R+0Kw6t4ZZTdf04t4y22mbwsnzMhFgTgzcIsN2PIZ0vi0ENUcStnJ2WRjVri1OH7GYwnC4EEbkKTCqbbAO3n1yz3ePY= 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 AM0PR04MB4772.eurprd04.prod.outlook.com (2603:10a6:208:c2::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.30; Mon, 8 Feb 2021 15:14:40 +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:40 +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 Subject: [net-next PATCH v5 12/15] net/fsl: Use fwnode_mdiobus_register() Date: Mon, 8 Feb 2021 20:42:41 +0530 Message-Id: <20210208151244.16338-13-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> 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:34 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: b9069278-ce64-413c-7d31-08d8cc44419a X-MS-TrafficTypeDiagnostic: AM0PR04MB4772: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rhQ2RGc46JOkTBaJOywjIl4YQW8THVmLYg//QQtXVnNSUzB34KuETSs65iLtZaY3aiUmf1nxXiwKZ2CTBmTmhDEkx0Q3xFMgMbSVjfYQqPhnVA29BY3prs56zUbg+m5YRV5dyJUsJtcaRa6S6tmzuuFtXicSQP4iNgp/W4yFMK1LbUHQ9g4PvCgyckS9koDRZ2Jik2r+AQtmpIl2979VV1JEmMy2KFzpi5LXkLublUyv9Ta56QZMfd2OlS7G2FBefAb2nrjHZvlaWtWdu3K0YoWSNvVwPKhIXuCVK18FSrUNWk+naB1sMsAm64QbgQXzBDIBYwhIBHe/dK3GVeJOZCLmOZbnw39o8zJMFO+KgcuIE5wSRz1X0NGhp8WmWKlpGxy+1YAoRG/SEgIBttMTfLzvSlU3QEgiddnqh6ctw748AbCBjgh6xdUkRi6BsXKcvTfJHZJSEOUYVQtIsn0O3lCvydEhMFSMQu6k4EOgH6h3ZbXMVyhtiq/AcvVeyYvRPTJ/QkTIrVZdeSGBQva9+l/bpETYfdqx8GGv9OPEIZocrRi/AroHBb9xy3LUI5ekaVVKKDLKFP4D3vVaFetkW2TuXw3963wFGSPqXcR7n/Q= 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)(136003)(396003)(366004)(346002)(39860400002)(376002)(86362001)(8936002)(6486002)(7416002)(16526019)(83380400001)(2906002)(6506007)(478600001)(8676002)(26005)(52116002)(44832011)(2616005)(55236004)(66556008)(66476007)(5660300002)(66946007)(1006002)(316002)(110136005)(6666004)(1076003)(921005)(956004)(6512007)(4326008)(186003)(54906003)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: daNmY1baiC+dsPvUCA/t8+PibzCsHL2OcbF7hwJKa2hCURlOa+Oqg3V5XpH91DmRDtZvQ0It8aoZra1DklFOQdTFCU63ehd2/w7pH7jG4e1pkCy+MbAqyU4vfcfaerNnI4CZ3YvppE19cA/hseyKG8zxDA0Ny+XXp36zwLpRXDfRBkTTzc3pGxmYZWJOh06Zc8aewixrHnsiFPx8Ckxfla4xY/01YI1pQ27wqikoPOr9WjfbBa2UnwKfs0cjsoAej3fHCnhe5mbDNsAFbVBKUThLZXoDZqT+8CXJVnkAGxGTnowkAPtl1ZOtLD2He2W0+h7UE/2Akrhtn/3aTZQBNQf4TFQP+Ne5Q1txvVy3iDjiHhnU2lYjJKvwHUGqg3dWRjFFqmc/wvXGZTbruRSH5kK2wDSlPmPSJDvhrZGQN88p8S37jt01VkAz5C3P0ToyWeC62YrTnGlTBRf+8RMKtDZoLHdpxLqpVoBy6GAPe60R684YqiCvDzugCgsEbHf26FPnDYqGEmDG48H2t5qYKxWY0d8xO2ClhjZC6dEkM7wsvjKz2A9K3gkMlBeyqIF/NiTAPGXdV2V+7XQ/4iE+hrco8uzd/FdEDZTrz/CRH6Can+UuwvqunZSjgf4fzWqBa5X3faXyUxtZ9On11OiCOWVoOiNNJvUqeBJHvA2qe5HcNsgzFIoOBtXTR8uC9a+FAj6yhGCCtiYsVBr3uiqA8OUlwOABTpi9uowktqKm5izAPGT1andR4lnJyl8ymn3Aq45R38B59hReDjO+EfXiazM7ojH0JvOpqs92kxFWqKZOyGpbQunCk/tn2L9FgfCCjGMLa45dxMYIyffViMj54UaCycWHqKifr1Ok3WN+BNNSz5JWQf2dzgiK0/ZbpWIf4/JclzTy2pE0XJWBVrwJPndneu69u/VE6u0i/KIIsQx+A5uI66QGZxa8wTW3smZhYjYidVc/08FNq/6i4nHNxPHOSVkIzsfs+AxGiKabWq8uev2k5Eaj9rf0dkDBa/SZylD2BnWlcSrm3xlT0vI8927KQ3ePWwb4xjBcp+hJe3Zn0gn8LkiXIP33nGYpghNYoQikamRDoGtKTB7uz7jxAFGFvLEVMzhhR+P2e8ocUWBGNY6mJ936bGS90oE88B4l36IhGsVY3UFWWYp9yGebr6XrealbSlC9/ON4GPb62AdaWMRN+npwKM2alAEBGjn4aT0/kNQaASd3z7/N+xgknuNwBzpwTn4JV10nsWWqzo2dSpXoxf4gP/IWqZObsfZ1B6e4BrkSWO8bkCecAuKwkI6Jduqt0TX+Oe7aMTWbNoY+G+llBMZrfxkjTeQHgX1r X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b9069278-ce64-413c-7d31-08d8cc44419a 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:40.5899 (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: eioS9w52HoSpF7INOtb20ZoqR59UhtYlVnNeVyqTow9C/vtd5G4BN70pRzuLbPzNragtmdheCOa1+qmwj+gDJA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB4772 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210208_101444_488962_E47EF5C0 X-CRM114-Status: GOOD ( 15.75 ) 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: netdev@vger.kernel.org, Jamie Iles , linux-kernel@vger.kernel.org, Calvin Johnson , Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux.cj@gmail.com, Jakub Kicinski , "David S. Miller" , linux-arm-kernel@lists.infradead.org, Laurentiu Tudor Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org fwnode_mdiobus_register() internally takes care of both DT and ACPI cases to register mdiobus. Replace existing of_mdiobus_register() with fwnode_mdiobus_register(). Note: For both ACPI and DT cases, endianness of MDIO controller need to be specified using "little-endian" property. Signed-off-by: Calvin Johnson --- Changes in v5: None Changes in v4: - Cleanup xgmac_mdio_probe() Changes in v3: - Avoid unnecessary line removal - Remove unused inclusion of acpi.h Changes in v2: None drivers/net/ethernet/freescale/xgmac_mdio.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/freescale/xgmac_mdio.c b/drivers/net/ethernet/freescale/xgmac_mdio.c index bfa2826c5545..dca5305e7185 100644 --- a/drivers/net/ethernet/freescale/xgmac_mdio.c +++ b/drivers/net/ethernet/freescale/xgmac_mdio.c @@ -2,6 +2,7 @@ * QorIQ 10G MDIO Controller * * Copyright 2012 Freescale Semiconductor, Inc. + * Copyright 2021 NXP * * Authors: Andy Fleming * Timur Tabi @@ -243,10 +244,9 @@ static int xgmac_mdio_read(struct mii_bus *bus, int phy_id, int regnum) static int xgmac_mdio_probe(struct platform_device *pdev) { - struct device_node *np = pdev->dev.of_node; - struct mii_bus *bus; - struct resource *res; struct mdio_fsl_priv *priv; + struct resource *res; + struct mii_bus *bus; int ret; /* In DPAA-1, MDIO is one of the many FMan sub-devices. The FMan @@ -279,13 +279,16 @@ static int xgmac_mdio_probe(struct platform_device *pdev) goto err_ioremap; } + /* For both ACPI and DT cases, endianness of MDIO controller + * needs to be specified using "little-endian" property. + */ priv->is_little_endian = device_property_read_bool(&pdev->dev, "little-endian"); priv->has_a011043 = device_property_read_bool(&pdev->dev, "fsl,erratum-a011043"); - ret = of_mdiobus_register(bus, np); + ret = fwnode_mdiobus_register(bus, pdev->dev.fwnode); if (ret) { dev_err(&pdev->dev, "cannot register MDIO bus\n"); goto err_registration; From patchwork Mon Feb 8 15:12:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Calvin Johnson X-Patchwork-Id: 12075867 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=-17.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 1D83EC433E0 for ; Mon, 8 Feb 2021 15:17:48 +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 9624164F41 for ; Mon, 8 Feb 2021 15:17:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9624164F41 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com 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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=CIKwa83zLFxr7xcQgBrI96OlToMABq39eCFW7ZNktvY=; b=FQ+PAEgA05NTid+651BNnMb/n fgpmOruwsaUQ0um/SioAmz2FPwgHo38MxT1cUfYfoUWYzhQbc+Yyk76wMqZl5SWRFckYMoxC7ctin k+0ek+mPqw62dmXNMT77wLgmNGmm/2ehUUY+etBwmA61WyDWuhol8Pds7SS/IcR8WIKnwzI6IBe6u /KSWNqm3cXLJoy4acxxE5mkSoET1SgQW0qd2hLurUYvU9uFITayR6OtgqBrCbxv/uaWUfO8vFROJS uTBp0njHDlz26pS7fgsOE+uoLt20aqep8U8toX8UYrE+9m+OL6HdVICfhIoXxdzh8zdp1tIn8Dik+ OjQWPEnNg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l98Gm-0006Wq-Eq; Mon, 08 Feb 2021 15:16:08 +0000 Received: from mail-db8eur05on2061.outbound.protection.outlook.com ([40.107.20.61] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l98FX-0005jt-HF for linux-arm-kernel@lists.infradead.org; Mon, 08 Feb 2021 15:14:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Np0LpqZQEu9z1PZ+DPpFRmy0jTTEZdvJnouDp+tnDAQiq9C+z6Ed8xtfxi0gCZ6hSTa1Tqe5xVD++wM5SeSNPbxKyrphZZRQk/66OG3+2y2n1g+uuA2DjTwlA3MGQBpRbEvf742r6MJeUZpq/MxwCBB3R1/1SoIzARGIloYIrExgQiQlxg6NxHqCgRLJXGA9X/oG7smKomllZWOlPYTTQAJRRpdxCQOPNxPkb1ymGverv4soh2etgqSSVUxAEOh8nHsnhH6ih47uV7AbLVgSmJsyaEbug4zgVlQBvbIZzh15bjN19SvcNHMtNx1MHUZDUeSzxG81XUukPQhSkX8SfA== 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=lI2dC3Ci7hjN7hVgsGnbhR+T48h87xYPGO9Ze1xFjHY=; b=HwHqqQ28kbese6YO37CykEBA3AuYTapIRoeGyMsRxfSDsy9gGAoyJAI3362ZleGAfMyOFQ7ClPerF8gqsuypaucS7OcSAP80Mh39R63+tyUH2K0bWOUVnRrpqydoEdvf1DIRiPpGcQSWo3VxgIl7zDtvkMRFkrGX/Be53OLhKuJbyHbyWhZ/iOUuq1HSRxsSfdQdEuzIyKQ3cjg3sh0YQvwfxNBeQacX8q5yjmyrXZQopX5ANTfgDmhYyy7HJnHttG8qDTpXzmH9U1qJqKQHkxkBeyItS6VD7aCzm4DmeFuHeNL/LUaVBuk/FQIaR14/GgwyIOfEuAb93vXtVi8jag== 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=lI2dC3Ci7hjN7hVgsGnbhR+T48h87xYPGO9Ze1xFjHY=; b=PGBDWcfDGi6eVkwsaIyy/eKdTj2ChyBBW77h0W5lVarPsgMqk6I5OsjnTN+rO0Y/+KRhNL/bMfk0S1bwWV6tBjByb7HYkRaVTOBkDahztMujR9jxMEbYxWKfN55tKPI3bjmh8PUJYIGHRqpgnyV0HDGlfI7lFz7b9g9T2+TQbK8= 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:47 +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:47 +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 Subject: [net-next PATCH v5 13/15] phylink: introduce phylink_fwnode_phy_connect() Date: Mon, 8 Feb 2021 20:42:42 +0530 Message-Id: <20210208151244.16338-14-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> 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:41 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 0b2bdebc-4c2a-479b-90fd-08d8cc4445ba 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:2399; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eXAYbbHR8w+hBBCb18aofoti3GlM/4kqCrQHnF++vnBNVGe+17msOdjCmzZj0167K8h+MUw3BPVmBDV6b26J6ngivnpcpItw9wJe5QZYhqXZAYnzfaVUBLaMDT83UxqX5tnpeFSZ/qsLav/N8acKmSMVcpZLyhk2Lt9thrgar4aHNiXlU++Kba6l7ONyE4D1+GWjXz/w3g+MALzNrAiBSHiSSwS/60ACFmr1w5EI/mKmDEEidrr7R/Z8rPr5WWiPwCroaW9WW+FDUt180P640Sk6PXkJrQ5LYzCW1pdcMEDp+CDEMDXpGuQ7sMEM4DxtjT7GREcVo6l7M6vR5J6naNL1AlW0huVvg8RzYJjJOjkoX/ggGYtxIie1GglrlLCXGSGmFoGRYRgVwRD70lGAygNESG7W3KRo6vRyMh7LUjrznLuaNkEhNXqEdkIByxfrGh/9myiKDztLA6TlbyXz2z4CGJyQQ6UYwHSJGlJBkF/oIlsnYxqBQuLVH5s387wy3flkwa1VpUbTqpmlU3uWAR4yIP3P4VBwKeD2HCJby1Axizw8yCggVlo2UM1dVe4+/ji9JqPzF93QtMiHTevzqIGNSsNO1ov/73utew3WOgY= 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)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 5iDCgS0PzpQMD73c48f64I7HVRFwaKzbHwFHsepiyJtYAJF7hTm9ngngkGNOs5zani7uR+rkryBAtS7OFALVtxzkLlI57YyBF1CvLIb32FIVfXuOlKFJE0PpAxUgb9V88aoSVYN+Sa7a+riufeLOsdPVkNWUZYpa/iwTEM+pinZaPLShZHE8C3r3wbYDOXlK94A1r+H7wbdtPD69xd4Jxs2YkFgpfWgNQDIWGTaQPSl+LOVG12hASByeSziCIthgVAdm47/A329HCCejk8FLHBJ9639eAdk6J9p7i7sj5ENvbizE0d+SGsU/MbYf1HBiNPjOWMNarnKAhvakfrxRUvftP3b8nRlcCcgVEnNhQbWCdjdPzuEDmMM0ORCEl0OJiSvvmQgnGcK4FcbRc1msRksIdiVyVQmxJpFnDWtGOTm7XgI55MJsjMsar3FUYP8WW6gAOEtOF7UcR4LD+lOygAes+ZYhjASqzBjLD2aqdxEnqDaDpw4Ss36FaBxl1daOwgRUNKHujrCP21/1OcUp7Hz/ygQbMyRDzPrl8zs6f1rwajn6Xv16dyus24tqkGBwSyBBTYxBkIkBUPqSvNQn2PMJ1GRuhuBpFUozZU8Tyjs+0fqDeb4Ui59xaVrhMWurb2icbR4q2BumA9roy/q8h0lRGlCPPEhaw4tDWzSwc+4IwKb3I+Zvv1KJIK3RMiYJyrisSlvbUXbu0ST5YnZ6lO5aVCqDxB4HnUXYQELeGjYv5O/Eq0lD+dUUFPsD2FVx4g6hTjzPTrcKCELerRIhsxtqDh1OlcKlbahtygj8+nRwmwbQdtQZb/3YQW7cTJNteQf1G1m484lje0AzDXUHUsMTw92eM1ZUgIh8qeEeWoUYWDSg1AM57CCYssFRI4nkGvTxBNQf9JPoVuvKrw+FXY9CE+xitcC4lClG8pJhyuQPmVoCVPMM77/X0Te3X4/reWxd/gKh2jiadlhA46/TXz2B6v/4bLvM7VtIUiNAtjQiWZviz05WEaMmTgJrrYZa/WgUsFIaPz1O5ZrspC+fv9hvD0VyparVhyiKwwj/etuSWTqrZaSxr72v4EPsDP4RBFol7WfMNPWGdLN1w5aFgxjU4GKDbQ7bvcNhdLmFSku0jjPXKcT/Eem8p0LlcVVa7bEVVBDeelTs335LHkdzdr5a8hyl2wCuFILuMIwLYnwBDDh0fKsLIjSGf2n2S+7jOdrFsFSWQN525uNDw4w2rNKVlOp1u9wJPtcKhW5LBAKJu8u68Y/X1xEa/D1pYejAX/we0MLk6DNEIGECxPY9Q8n6fKTYnZ9PrRf3euwZUjJsss/Ky/mCs0SZisWVHDHN X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0b2bdebc-4c2a-479b-90fd-08d8cc4445ba 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:47.6560 (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: 8b2G1Krwp2tvpzMz9e5QswEBX70ExZehhp8azLchr71le77Hj7XvLKLxrK/+uqg0jhKxRrJ1ftwWkI7Zkv4XcQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6435 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210208_101451_618441_8A8FB81B X-CRM114-Status: GOOD ( 18.69 ) 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: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Calvin Johnson , Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux.cj@gmail.com, Jakub Kicinski , Heiner Kallweit , "David S. Miller" , linux-arm-kernel@lists.infradead.org, Laurentiu Tudor Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Define phylink_fwnode_phy_connect() to connect phy specified by a fwnode to a phylink instance. Signed-off-by: Calvin Johnson --- Changes in v5: None Changes in v4: - call phy_device_free() before returning Changes in v3: None Changes in v2: None drivers/net/phy/phylink.c | 56 +++++++++++++++++++++++++++++++++++++++ include/linux/phylink.h | 3 +++ 2 files changed, 59 insertions(+) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 84f6e197f965..5466e1e6272a 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -5,6 +5,7 @@ * * Copyright (C) 2015 Russell King */ +#include #include #include #include @@ -1120,6 +1121,61 @@ int phylink_of_phy_connect(struct phylink *pl, struct device_node *dn, } EXPORT_SYMBOL_GPL(phylink_of_phy_connect); +/** + * phylink_fwnode_phy_connect() - connect the PHY specified in the fwnode. + * @pl: a pointer to a &struct phylink returned from phylink_create() + * @fwnode: a pointer to a &struct fwnode_handle. + * @flags: PHY-specific flags to communicate to the PHY device driver + * + * Connect the phy specified @fwnode to the phylink instance specified + * by @pl. + * + * Returns 0 on success or a negative errno. + */ +int phylink_fwnode_phy_connect(struct phylink *pl, + struct fwnode_handle *fwnode, + u32 flags) +{ + struct fwnode_handle *phy_fwnode; + struct phy_device *phy_dev; + int ret; + + if (is_of_node(fwnode)) { + /* Fixed links and 802.3z are handled without needing a PHY */ + if (pl->cfg_link_an_mode == MLO_AN_FIXED || + (pl->cfg_link_an_mode == MLO_AN_INBAND && + phy_interface_mode_is_8023z(pl->link_interface))) + return 0; + } + + phy_fwnode = fwnode_get_phy_node(fwnode); + if (IS_ERR(phy_fwnode)) { + if (pl->cfg_link_an_mode == MLO_AN_PHY) + return -ENODEV; + return 0; + } + + phy_dev = fwnode_phy_find_device(phy_fwnode); + /* We're done with the phy_node handle */ + fwnode_handle_put(phy_fwnode); + if (!phy_dev) + return -ENODEV; + + ret = phy_attach_direct(pl->netdev, phy_dev, flags, + pl->link_interface); + if (ret) { + phy_device_free(phy_dev); + return ret; + } + + ret = phylink_bringup_phy(pl, phy_dev, pl->link_config.interface); + if (ret) + phy_detach(phy_dev); + + return ret; +} +EXPORT_SYMBOL_GPL(phylink_fwnode_phy_connect); + /** * phylink_disconnect_phy() - disconnect any PHY attached to the phylink * instance. diff --git a/include/linux/phylink.h b/include/linux/phylink.h index d81a714cfbbd..75d4f99090fd 100644 --- a/include/linux/phylink.h +++ b/include/linux/phylink.h @@ -439,6 +439,9 @@ void phylink_destroy(struct phylink *); int phylink_connect_phy(struct phylink *, struct phy_device *); int phylink_of_phy_connect(struct phylink *, struct device_node *, u32 flags); +int phylink_fwnode_phy_connect(struct phylink *pl, + struct fwnode_handle *fwnode, + u32 flags); void phylink_disconnect_phy(struct phylink *); void phylink_mac_change(struct phylink *, bool up); From patchwork Mon Feb 8 15:12:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Calvin Johnson X-Patchwork-Id: 12075869 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=-17.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 AD853C433E0 for ; Mon, 8 Feb 2021 15:17:50 +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 4FFD164F3C for ; Mon, 8 Feb 2021 15:17:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4FFD164F3C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com 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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=753ETcRAgAWO3VaVbh/78jVm5ybJHET74NcIcMkuG3o=; b=dhJbICWIv5LaL8C02BaiA0at6 ZZYcw7hD97TULVvEYRI0TgKJ19wzCjeTZtJeTb+Vjw3YjpKeBIsl93wvXKozFNcD1zFAkg2RHP/wP YUIIqk+kj/STcod0zrrxJlHP3yzOYfzFItVgHk+t7jYFbNmLOiOtX4Bm58n6uUz9BYg4W/T6Xn2fN ghq+x2YpvQgudugbifgWy9WInYjh6VT2UZXWVy138gLWym51yGZu7olJQutYlW7+5oBIRSA42L8kY 3Bln9W/psS1ZJA8ySMrNH8J1MuIMovWo4/NVhIeJaDJ32VAjHSQ3sf48SMn3dN5LUHyDgdmyL7MJH IYbW8Y/hw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l98Gv-0006be-E1; Mon, 08 Feb 2021 15:16:17 +0000 Received: from mail-db8eur05on2082.outbound.protection.outlook.com ([40.107.20.82] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l98Fe-0005nj-By for linux-arm-kernel@lists.infradead.org; Mon, 08 Feb 2021 15:15:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LZ9OiMKVzkCuDsA6U21UDCp39Kyg6EOnqHI2ksWryDWd/0PI/kaQ+Zgeap/tyFEAnwqFwTdyVkOR2iEhZNz5ActGvk3y5CY9I5Rm2MaYVSVhElINmKSZwFsLiPzHcHPgt6gRxNhbzpU6cNy33jVxM8Z+qidaNYjAjHQQg4IeG53whVGjQDdKXGMtdlFSPWzUIlf6JoXF63Km3WmCF5Iys65lzCNDoKGdlMBjcvhFb7cc6jw71/goM5EyiP448PP70I1TEv3+R0fYlcSj6wyNch3Lphj+Qo5VezyOYrB26h+ffTtdGvM5LpqTTh35kFx/xmvFUdscdXm3DB5aBnrH8Q== 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=aZ96Hd2ZfTaA4os9q6G6MW/XA9I0btG2XfLGGuywU6o=; b=ZOuf+KkE2AqrUkzYCkdj4fkyvi7H7YB8H5CLwW0lBN6QGJpTyX95QUO/lZX1TMY3mMx0y76D2hdH9jrnQqs2Eb1AGCWsudNtPtAVH3WbU00T1ieklSPrDi2AsP9WaKgVT26bUT8yFnFXWYoUM2qSeber7yewZne59Q9vrj2GpxZj9c1ZPyCPoyTWzch2Ix6+GgK277LUr8rfgWl/IfLl89ZO/l4l9jHuyQqz67H94TmrJkS/l8C8HyyjgdKQiFuBAxxMimJijfLSWBE5wEBiXK+pEtAHhiTAi9JD6zYZSttJyriBH+TSKdJo4S9UxEluR+VWxs4ekazaoggAosovUQ== 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=aZ96Hd2ZfTaA4os9q6G6MW/XA9I0btG2XfLGGuywU6o=; b=EWglQ7v8TKdcr/JBtqV7mchf7/SX92bo3Ta8mmbIAwtygai4cXsdVlX8zuWdrL/iEBfzzZO0VWR/CBTZuDWGPVpD/cIQvrpR6MJ4eUubrFy8xccvLDNt8FS5cm6rFVdZyXYeRBVelG+g2EsP229NUD8M1Bnqu+N52GwI6xAfAjE= 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:54 +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:54 +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 Subject: [net-next PATCH v5 14/15] net: phylink: Refactor phylink_of_phy_connect() Date: Mon, 8 Feb 2021 20:42:43 +0530 Message-Id: <20210208151244.16338-15-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> 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:48 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 0237ae97-942f-47ca-9bd2-08d8cc4449de 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:3276; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ADCgCacO/cv8tbHnydBHZF0r7/oKo+fj6rCzuRZVqix+w9bf/FOuVJKSv5Vtjy3CFcij5ABxNRJ3KhiOfCP4RlM6KNKz/nhEgtSMihy7K+Jzn+lx4Das7Fa1pDxjG1JcjbHkRryk/hPqmrHVbJFhJYZql3BKYwjBmNhhblZvEESxcIVwoKgNGdYX199fm0zjnuMq2kSDaAyH90FbiwLeBOdwgmUahGWZvlR2q6OxrxugYIvBYr1phZIEEII+fTLsbOA8VL8p0W0kFZl7hA+ykB2klgoiPWlTEs3P/W2eu82uO9AJPCqmzAX+Z+JFOuVi+ZApJAzIyXJ3l/6GdyfBjRfpvDl0LrspnShV96GKfx/RqPMKzrcbZk5uTobqtgM9fMlfaCc7HnySr5klnjlIc4xzIYvXtTjcVqEWi2soLWJW2XwoUhlfVVA4WI/dYtWVsb62AyMVY9G+KGXP/WPCmXt3tS+ygfIktI6aJkSoLsC0hJyjNpU3YqkXR5P4PkQVB635zfG4dyzh8ffGf0daSAUMuXGRtKcuq/Zp3fu5+4CqUNsNBUv3u+XnlBACoAtLD7eIxz4qsVkljjBLyaeLPQ== 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)(83380400001)(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: tcfNCyMFCMO2D5yHbWq8p5pvgDfA2CU/4gBWPFjNfLAAQ+oNQkHiRYkTgU+Wt05cNS7ncxkSYkr5qrKJEfs/YhqZobXapBDGHAzrVsSAlusulTKPpqDvot70oRHmHhKOZT/9Xi10NQusdvABKsOK6rUjLiDBG5RYlQNvvg9XP4ozqqpYW94BHjVIACtL3L+nJcUX7GaEi9SeTVEQ+NgBZPcR2Hxov4OLdkuaoIgN8q7eq1m8FOaP2mIZqWf9NT6MslVwKduAoK0ZfL9aZl5TViTxf0WTatSrKZv7kUlas2q1Crjlc5abopHD64N2AUKyN0uuN294VEnIcXLaT8lzMsXszsPXJ24dcRaYbwgkGieY/G5s+7Wcl0YhBh6WYxdk4GIltIkRyZ1Vmazwpnb0OaSu5Jj5o3i0u/kdqjRkjOWPApEzKf2i9iLZs+7l3ywc6I3CQKX5RWkh+xLPXMkCkn3KAq4CLSwicUcCmHzXlA59Wi2FtPQkKmae2Dooyl31p2v1UnQ8j5ZMBFokCmhvWDvWS48ILj2h6SVWNwT+L8PJlQ1iubrTCbKVbTwrhN5BHgBPkXiu5qp7HKjr2LyqyYcR+L/dAdJkh5ZBX+IFdj9TDZKERfiww2ZpiNRXtnjkntolm86yIcV78XOAf7EVzLEIMHnlkJSM1Zp2kJDtFD7Un9gh7LchiV8pQAk5bTc+v5vG2AChla2ggE4o7UaGyIYmG3FIPjyti0HnontpFzDEFT7PeU8MA0SQKbJgf0rxKAD4r7SIKxqDeireCntKEIbuS9bhhTh0TfLPqjDreGJYYMOUs5RxXuvl5De9bTwLprfNq9S9+Q+ecZx2ONMnUn/ibCOgoSWhwO8UTLolwiqXclja29ma0IcAVXItgsy8j0GCqoikq8qhQe3uD4FXarjpj1kqMydhekKhkgySr2b3hDJi2ukk2ZPn8ZqCAVOBQTWbMgTxGgSxZM5pN4k7BN8QO1kenFV8fTf96HhsthfrVyxj985PTgIB//FryfyDqQ64zaS2QZ3OtdRm3pu83OI2NMoRK8U8H3A3IyFyMUXlDZcTjYV+j8uSdwveM4JTgA9zdN011i16cteJbLNcJwtwr320d0B85dLZzDVTpVftx18GMpxefiQsUmLda+pPy1ThD3UYaf871E/68GM9vmFbSLuBbeeze0M+VHGmUAAgfzoRuQncRGj4N8UFzuoQHzN9nUL/Gh2Q3jL55C4lom/EPqAgKgj+aHtba2egkGXsx2gCkNhQpbC7zbffjfvXd81MrtSOcNI8EwR8N4T/BZU80ok/w4Mt2h7BXSYS6RDKKPw765wl2FWSn3YEHZ40 X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0237ae97-942f-47ca-9bd2-08d8cc4449de 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:54.4212 (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: Ik6IBrcEIgIH2FQYKUMRhRcv5XuMhF34Wds1k39p+aGJMj2KgizpRcpiEdLuv13GsxzwHjlPFTNhDXOerP/7Ww== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6435 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210208_101458_514707_6F5CBAB5 X-CRM114-Status: GOOD ( 15.38 ) 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: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Calvin Johnson , Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux.cj@gmail.com, Jakub Kicinski , Heiner Kallweit , "David S. Miller" , linux-arm-kernel@lists.infradead.org, Laurentiu Tudor Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Refactor phylink_of_phy_connect() to use phylink_fwnode_phy_connect(). Signed-off-by: Calvin Johnson --- Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None drivers/net/phy/phylink.c | 39 +-------------------------------------- 1 file changed, 1 insertion(+), 38 deletions(-) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 5466e1e6272a..3d0dc53fd4f3 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -1080,44 +1080,7 @@ EXPORT_SYMBOL_GPL(phylink_connect_phy); int phylink_of_phy_connect(struct phylink *pl, struct device_node *dn, u32 flags) { - struct device_node *phy_node; - struct phy_device *phy_dev; - int ret; - - /* Fixed links and 802.3z are handled without needing a PHY */ - if (pl->cfg_link_an_mode == MLO_AN_FIXED || - (pl->cfg_link_an_mode == MLO_AN_INBAND && - phy_interface_mode_is_8023z(pl->link_interface))) - return 0; - - phy_node = of_parse_phandle(dn, "phy-handle", 0); - if (!phy_node) - phy_node = of_parse_phandle(dn, "phy", 0); - if (!phy_node) - phy_node = of_parse_phandle(dn, "phy-device", 0); - - if (!phy_node) { - if (pl->cfg_link_an_mode == MLO_AN_PHY) - return -ENODEV; - return 0; - } - - phy_dev = of_phy_find_device(phy_node); - /* We're done with the phy_node handle */ - of_node_put(phy_node); - if (!phy_dev) - return -ENODEV; - - ret = phy_attach_direct(pl->netdev, phy_dev, flags, - pl->link_interface); - if (ret) - return ret; - - ret = phylink_bringup_phy(pl, phy_dev, pl->link_config.interface); - if (ret) - phy_detach(phy_dev); - - return ret; + return phylink_fwnode_phy_connect(pl, of_fwnode_handle(dn), flags); } EXPORT_SYMBOL_GPL(phylink_of_phy_connect); From patchwork Mon Feb 8 15:12:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Calvin Johnson X-Patchwork-Id: 12075871 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=-17.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 DB53BC433E0 for ; Mon, 8 Feb 2021 15:18:08 +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 86DC664E8C for ; Mon, 8 Feb 2021 15:18:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 86DC664E8C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com 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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=bpkyvpOm7UvAQnvi5wseC4y/FbBk9CbTzYd/do+i40I=; b=nVK1pacpAX98qIKvRvS3/GNip 4+bfJqV0nuoR8/XMT6dcM4aqvGlv1GdiJ6iIhkMWHoR+cxgJf1cRxl2WGFCGYVeqh0Itr08O14STS 0INjTbmfJu52ukA4FkC+zo2K39KZWc0DExt/pl1z0w5qAjOOiqkRoAXvk8yD4tUs2mXPMLUFgGuNr S3ARtJ7jBxq7wQ0P+fnRuM7dRIvS2friA5Na6e8xoKhgT9Jq2JYwH16Zbrij7VpxVi1bjicfqZgx+ b8T8UkBNHwqFn3k92N2Xyz0EPcnLimbCJ/5eeRzQ9dg2yRET2iXzeM5mit0CsGvgD1xCGKJ7JA7N1 2YR9lOAzQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l98H8-0006j1-KJ; Mon, 08 Feb 2021 15:16:30 +0000 Received: from mail-db8eur05on2058.outbound.protection.outlook.com ([40.107.20.58] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l98Fk-0005rd-Oy for linux-arm-kernel@lists.infradead.org; Mon, 08 Feb 2021 15:15:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BfZJatA9n/ymG1uiZk4iyeA4qlrXfHcEYnUBLd59/QcDFSdPCkGX081vvi3Jl80PKMo0gpTKr0diMq/41Ofj31bjE9+RjG8v4vkQxwiMAIcHXRFlEl2ji7aBQnfdPJ70FjHWnH8j1wn3okfzjKNpWY/57clDxczQV3g6kEpfmmDiSljbnNjyNpkZucYcD9JV3AMj3/IHZ9f/tzaMp8BsxwDs7Zwxj4rO24KY4YY6Vse/edbbRuZc55mtwn1Gzqh/jWATk6PX81jR1bWKNO1lRhxid2MXrf5oDf/wwGf0GCsdnOJSBW+pHyhD7FNZe/9gWz3JiwYAMG3A17lb2fusZw== 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=0B+DlhlE59a/1w9sbZBwFS89F1rr8gVsTRD25iw1Ts8=; b=hae3kOxYEBUSq266ijuMMkAt+IhwmdL66ET50Ktacq0VRCYD2Kxt169P08ue3CCdCa+1EpzbbdmyJo0VHAHJA/xX6DELRg5EWULelPosBo7Q7LIp+BqZDmh33JbGW92OauSbZ7J8TK/EmU7KtsdmL65/aqZdlcI4BDCOZkWfRoMkSQdt4KqJpLRziih5siR6b3WeA1CCJuNtjWRNTIDcDtZgDetksvdBoiNWQfh0/wlNuARgq8NFf9KZNSwkeBjhTYUgbTbvvL0EgMumis+gD7P6CIuZJFJI2w/IbPcYX6Pd258qO1T1jGVxNWtXmnfCYzatpk/gaH04RL8hAbX+VQ== 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=0B+DlhlE59a/1w9sbZBwFS89F1rr8gVsTRD25iw1Ts8=; b=Iu2n85NyGkDQ9S4RLVIVZ/L/3w+H90PJSLqKRjVEUAMdCb+NgiX3cioTuqilpCTJ8ASVmjLEYquTrYFf/OPiTaG+fadUnxrYHO9zJaEmLu2R7qWzc4lLklHxkCX2ekdVs27cj4b4Q/+Zzz/m0Ldboc5B6NH1vOlkgd6GMKdKkrA= 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:15:01 +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:15:01 +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 Subject: [net-next PATCH v5 15/15] net: dpaa2-mac: Add ACPI support for DPAA2 MAC driver Date: Mon, 8 Feb 2021 20:42:44 +0530 Message-Id: <20210208151244.16338-16-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> 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:55 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 49ddb2cf-dbcf-4f42-b551-08d8cc444dea 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:5236; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wPdVAbz5+KP1gdMxCU1n03Ak9PvqkwKmjm5dJiGyyD9/UsEz0r2q8fF1ru75hc2yVHGwJZGh5Xn1awULVn1Q5qzIHZntm/0xBmtAEe6mrMTCNiPQ2M6/ro5EhUs3+VUdlJKU8J2N3P+OaKrh6ouJSAybHC41g60gmj41LEwc0GGw+8/FTL+/EFbUH8TcdLFgsYSNVW8xQEuLNXB24JDB65llYkSi1gB6j8/DYi4JKxurquRcdpSuX2PfvrsqyIv+A16oQLAMV2q+nIz9eGY4ShaMPvjOFg8w7BBE1Pw8ei5t9JUcfPvu18EKfjST9FbocVimjzAQ5sPpspP5zXCV/zM6XPO/lk/s12e41weUC/+AZTeYvINOWw55BRlRQq2fcf4gPAg/yhHOko1891FVAZ19AvLfZnwfxBqkuy+zifd86Kq4EfEndNy9RJViiottsABXD2qzOiYcT4qzbGTjq8TON7pBFsqOEPTnEFEsjQpnVdqJLv8bEK1wsp/mTqLaRpFPI/pBS8Crvonql3fRl7cU6LWnaObhMAEUD38CERcO7Naoyb55JzzhBz10tBLLeIDyTH+5a2WwQ2k0q+/rSLJonbA22kwBY740HYnd7K0= 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)(83380400001)(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: eMKOiRyCmNYtaHqSwnnm4cvHJUPLRgE9a/xBOhGWoooj/t5K0FSMJAZAgWI01Vz73JU+vr5sLe/ne9i+uQ9qVK9a9lZP1rUUHB1FN9whxeDXOzVOgwziqG1CgAtrT+5jSagV7QMPBAIikcK7zRO5N7HcdABZqM19LN4Z9nvz0WezKBpFexBtwDixFL52eNB3v4F6UHnIGeBxifWKU0FzJ9ADw++sRJzRh2/dCAZK9CnYz8Hb+hKyIUVis8Pg2kQQFAxl2kHjS5eWUYfYWCnu1WRVYf7r4UZTTDzsnevsQLF8F0oAcVpBbRGBmlkAIq1lL1KKEFwlrbEdpTHOdvYI2Y+q8g+zEHJwFvqM3rjjo1UR6VveX187dVXY1T8XBxJ4bOWNw+uPYYmbOAf7GgudMzbEgc31utzcYamHW3lrpiAC2kkEeknjXy8e4DYJYtgNPDjMqIZDlmPdblcU5dhCeFUrqncUzaGbYufzyJQKB1vnCCn8ZycWPZ5uFuInG5zfxRjAdX8HJzMhDM6an/5dyIuKxbUneZVrtDQTLe6AvNMnkN+QPQnV0WVAWIu4Lx/4bm75YfLMGvMn/jEEttBOJILQh2ifWOmMkgv1NfiXc0ppX5phUCXDrS16blXoa7mysKP0vtGdNYKAXYMiqsNcxTOT+YayjlWAAU+m0NvQq9IuPaOzdMkSH2iVWqOn1C+vgsw9C2sAOmE6T6GVr3IKSQGYXhr6oPJzc2RDUiEaaLipJuMuWvJWbBX4vxjVT4jDbLAXjOBBzCyqCMp37n9PwDCKPP+cdulGhf0O3I0RQBDNtxR2i6JBtccCTqil/vizMgHn2pjKW+IAAhHxKBpLryMIFWtMK7RyokZy07usVwnfW2AJoToDcBJ+zPOwbYugVEXj2X9NDY4bZv8tEhwEPPmFR4URqomuMkGckxK5b1wpgi7O/0/PBgxBEYxLhMnlaHDYIXKDai+xHRN7Vvbu1VOFvsQbF1cgwukqeoXifmq7aRnQ8kTm22xKev3+Wj2GvyujVm2Tw8eOrLKkihWlpWxFfaTl8p3PT+r5/P+eFiaLpm8mptjjqTiGFYTVGng90oEeQu8Vx+Cn7cvYDUYj/bfGwQ0EUUqFo9rdUBpOvBcvrN4iLosHcfwVMHt2tZRZm/qzMbnesr4Z03hh6J4oEkyaKcTfH+rMbgk7Nsx6af9MM5unqBgDnxoXQb+WDZMqFyS5SmNKJ1XelaqVvYyy/7s9DMgXHOS2iUxrSdaMoaZ0ODwmBKAZLH+FV/hhMxpws7EqfMNmd6hrl9c6eDBjLD6UYUmeV2ITfilLpK9WWaJtPOsBMDTj/qlNrStKGyaN X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 49ddb2cf-dbcf-4f42-b551-08d8cc444dea 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:15:01.6241 (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: 1E08kT14ZET/DH1+DoN6PLKtAo/MjFyefT8GORbJHqo5U+aBOkqXyMpM10PfSHY4WC+YZXO6x45IkGYsloOb6w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6435 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210208_101505_043745_7033B6FE X-CRM114-Status: GOOD ( 22.73 ) 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: Ioana Radulescu , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Calvin Johnson , Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux.cj@gmail.com, Jakub Kicinski , "David S. Miller" , linux-arm-kernel@lists.infradead.org, Laurentiu Tudor Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Modify dpaa2_mac_connect() to support ACPI along with DT. Modify dpaa2_mac_get_node() to get the dpmac fwnode from either DT or ACPI. Replace of_get_phy_mode with fwnode_get_phy_mode to get phy-mode for a dpmac_node. Use helper function phylink_fwnode_phy_connect() to find phy_dev and connect to mac->phylink. Signed-off-by: Calvin Johnson --- Changes in v5: - replace fwnode_get_id() with OF and ACPI function calls Changes in v4: None Changes in v3: None Changes in v2: - Refactor OF functions to use fwnode functions .../net/ethernet/freescale/dpaa2/dpaa2-mac.c | 91 +++++++++++-------- 1 file changed, 54 insertions(+), 37 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c index ccaf7e35abeb..87bb49722611 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c @@ -1,6 +1,9 @@ // SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) /* Copyright 2019 NXP */ +#include +#include + #include "dpaa2-eth.h" #include "dpaa2-mac.h" @@ -34,39 +37,51 @@ static int phy_mode(enum dpmac_eth_if eth_if, phy_interface_t *if_mode) return 0; } -/* Caller must call of_node_put on the returned value */ -static struct device_node *dpaa2_mac_get_node(u16 dpmac_id) +static struct fwnode_handle *dpaa2_mac_get_node(struct device *dev, + u16 dpmac_id) { - struct device_node *dpmacs, *dpmac = NULL; - u32 id; + struct fwnode_handle *parent, *child = NULL; + struct device_node *dpmacs = NULL; int err; + u32 id; - dpmacs = of_find_node_by_name(NULL, "dpmacs"); - if (!dpmacs) - return NULL; + if (is_of_node(dev->parent->fwnode)) { + dpmacs = of_find_node_by_name(NULL, "dpmacs"); + if (!dpmacs) + return NULL; + parent = of_fwnode_handle(dpmacs); + } else if (is_acpi_node(dev->parent->fwnode)) { + parent = dev->parent->fwnode; + } - while ((dpmac = of_get_next_child(dpmacs, dpmac)) != NULL) { - err = of_property_read_u32(dpmac, "reg", &id); - if (err) + fwnode_for_each_child_node(parent, child) { + err = -EINVAL; + if (is_acpi_device_node(child)) + err = acpi_get_local_address(ACPI_HANDLE_FWNODE(child), &id); + else if (is_of_node(child)) + err = of_property_read_u32(to_of_node(child), "reg", &id); + if (err) { continue; - if (id == dpmac_id) - break; + } else if (id == dpmac_id) { + if (is_of_node(dev->parent->fwnode)) + of_node_put(dpmacs); + return child; + } } - - of_node_put(dpmacs); - - return dpmac; + if (is_of_node(dev->parent->fwnode)) + of_node_put(dpmacs); + return NULL; } -static int dpaa2_mac_get_if_mode(struct device_node *node, +static int dpaa2_mac_get_if_mode(struct fwnode_handle *dpmac_node, struct dpmac_attr attr) { phy_interface_t if_mode; int err; - err = of_get_phy_mode(node, &if_mode); - if (!err) - return if_mode; + err = fwnode_get_phy_mode(dpmac_node); + if (err > 0) + return err; err = phy_mode(attr.eth_if, &if_mode); if (!err) @@ -235,26 +250,27 @@ static const struct phylink_mac_ops dpaa2_mac_phylink_ops = { }; static int dpaa2_pcs_create(struct dpaa2_mac *mac, - struct device_node *dpmac_node, int id) + struct fwnode_handle *dpmac_node, + int id) { struct mdio_device *mdiodev; - struct device_node *node; + struct fwnode_handle *node; - node = of_parse_phandle(dpmac_node, "pcs-handle", 0); - if (!node) { + node = fwnode_find_reference(dpmac_node, "pcs-handle", 0); + if (IS_ERR(node)) { /* do not error out on old DTS files */ netdev_warn(mac->net_dev, "pcs-handle node not found\n"); return 0; } - if (!of_device_is_available(node)) { + if (!of_device_is_available(to_of_node(node))) { netdev_err(mac->net_dev, "pcs-handle node not available\n"); - of_node_put(node); + of_node_put(to_of_node(node)); return -ENODEV; } - mdiodev = of_mdio_find_device(node); - of_node_put(node); + mdiodev = fwnode_mdio_find_device(node); + fwnode_handle_put(node); if (!mdiodev) return -EPROBE_DEFER; @@ -283,13 +299,12 @@ static void dpaa2_pcs_destroy(struct dpaa2_mac *mac) int dpaa2_mac_connect(struct dpaa2_mac *mac) { struct net_device *net_dev = mac->net_dev; - struct device_node *dpmac_node; + struct fwnode_handle *dpmac_node = NULL; struct phylink *phylink; int err; mac->if_link_type = mac->attr.link_type; - - dpmac_node = dpaa2_mac_get_node(mac->attr.id); + dpmac_node = dpaa2_mac_get_node(&mac->mc_dev->dev, mac->attr.id); if (!dpmac_node) { netdev_err(net_dev, "No dpmac@%d node found.\n", mac->attr.id); return -ENODEV; @@ -306,7 +321,7 @@ int dpaa2_mac_connect(struct dpaa2_mac *mac) * error out if the interface mode requests them and there is no PHY * to act upon them */ - if (of_phy_is_fixed_link(dpmac_node) && + if (of_phy_is_fixed_link(to_of_node(dpmac_node)) && (mac->if_mode == PHY_INTERFACE_MODE_RGMII_ID || mac->if_mode == PHY_INTERFACE_MODE_RGMII_RXID || mac->if_mode == PHY_INTERFACE_MODE_RGMII_TXID)) { @@ -327,7 +342,7 @@ int dpaa2_mac_connect(struct dpaa2_mac *mac) mac->phylink_config.type = PHYLINK_NETDEV; phylink = phylink_create(&mac->phylink_config, - of_fwnode_handle(dpmac_node), mac->if_mode, + dpmac_node, mac->if_mode, &dpaa2_mac_phylink_ops); if (IS_ERR(phylink)) { err = PTR_ERR(phylink); @@ -338,13 +353,14 @@ int dpaa2_mac_connect(struct dpaa2_mac *mac) if (mac->pcs) phylink_set_pcs(mac->phylink, &mac->pcs->pcs); - err = phylink_of_phy_connect(mac->phylink, dpmac_node, 0); + err = phylink_fwnode_phy_connect(mac->phylink, dpmac_node, 0); if (err) { - netdev_err(net_dev, "phylink_of_phy_connect() = %d\n", err); + netdev_err(net_dev, "phylink_fwnode_phy_connect() = %d\n", err); goto err_phylink_destroy; } - of_node_put(dpmac_node); + if (is_of_node(dpmac_node)) + fwnode_handle_put(dpmac_node); return 0; @@ -353,7 +369,8 @@ int dpaa2_mac_connect(struct dpaa2_mac *mac) err_pcs_destroy: dpaa2_pcs_destroy(mac); err_put_node: - of_node_put(dpmac_node); + if (is_of_node(dpmac_node)) + fwnode_handle_put(dpmac_node); return err; }