From patchwork Thu Mar 11 06:19:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Calvin Johnson X-Patchwork-Id: 12130355 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.0 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=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3B142C433E6 for ; Thu, 11 Mar 2021 06:23:16 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 105C064F34 for ; Thu, 11 Mar 2021 06:23:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 105C064F34 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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=baFjM6OxYBL26sNAajWWfEB0t6vyuV6EOcNQ6NxXywE=; b=k1j3Gfofot4DBDPWnzP09ZK25 lfxXdmyVTiSP+dPWZxFvnS7kDXdBC4WbYWVmZ+aZ2bnowyjS+xPoNHWpmOqUyrwSzkKreD/0pQF1Q 71BZabqkbmcsWEFm5KSQ3YUrSEnFopeIWG09WdUgHSQ2ily5dLUx74FZ5imlTZTrltiUYG8qhMnAo /HwjIP3OGDR9KGrYASHkEtuhz3lmYcWYCSZXSFHMWNWbL0ngtasktS5Xjz6CE0+yWzCiRULqfljux IaOVFdIaWeli1HFniyrdqbO8vBFhZBmMha1I3phafwZEQRFH4gPbDDidaxaFh7SHTW7uO84qjzpDR LmuP4L4+g==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lKEgz-008SJD-Ss; Thu, 11 Mar 2021 06:21:06 +0000 Received: from mail-eopbgr80078.outbound.protection.outlook.com ([40.107.8.78] helo=EUR04-VI1-obe.outbound.protection.outlook.com) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lKEgr-008SHy-Iv for linux-arm-kernel@lists.infradead.org; Thu, 11 Mar 2021 06:21:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z308nNrkKMnyrS+ObIg5OTPsMS7lFcgNt/c/JdyFTcBySNpoZGo7oQzSCCTA55H3uNR/PFxL/yrMzhmLiVgxLuMU9z/a74SIs/eZjffM2kekeoGiA9PoNtYGYbYXddAJaZmzYvzBLcSMCGfeX+qgMwvut+p6sDpMx5OA4Ie7+Du8V6SPDIcHemyIbiwyY5v8zraaXxXeUKz6Cjg9wKoCMHXz4lLO2s5kQS9QrV91ycbX9eETqnk+TUH8+VJ9QwC3VaOPfU3sK6Y0R0UWYprgkuPCSHOsKM/X+Xn3RfOUPS7msxkEEEmy1WB6FrB/ovPKsxuSvxUF0GKrljS+WsDOwA== 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=ywfRFD+alcZoBdD7gV1eSqnbgfkHyn/q3/vr1iPftP0=; b=Pja1W8z1GmmmthVTdBwlkh9+7tKtBS91vUMHHuJk70WgflETaStrmp9gaVolgoAX52E6bE+g/kwdNxPyAP4wYde8UQHeJchtLsaaG2CCw4mzJzXvae0RLZXW9SC/yeteKl+bTcaH+eC5SwUnZRMKwurMwP6E5dyQl6cTVZQ/vBsVKJgq90dliDZQbxFgZldgJBGrxnWZhlsdvK22MYoJBcu6hmP9Q/4QLyd2oVKv8oLuOg+Ez4H3J+RE0Bx5P+pO116A0Lf2zMdNPNW04uM1Ybu7BTT7fYo4WPs4X3XAGJ4YcnpqSDnpBSJ27CB3bX9IT0QoHqSIMBndzfplrafI3w== 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=ywfRFD+alcZoBdD7gV1eSqnbgfkHyn/q3/vr1iPftP0=; b=LRRkBZjVtsWhR5K46QGjOUvFxf3cSiMtzpp/jlXFAmzpYmCyYoPaltDaRq98z0iv17E7m5RiMZq1m2hh3VZkIC07Rd7swwhmbNgyn8rtDgLQmkoFosxld4sqRoobocBGhzplKwGshoRE5eZM2FCbRRAyKV38+moz38v+5/DA1dw= 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 AM0PR0402MB3442.eurprd04.prod.outlook.com (2603:10a6:208:21::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.27; Thu, 11 Mar 2021 06:20:52 +0000 Received: from AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::1cd:7101:5570:cd79]) by AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::1cd:7101:5570:cd79%7]) with mapi id 15.20.3912.027; Thu, 11 Mar 2021 06:20: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 Cc: linux-arm-kernel@lists.infradead.org, Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux.cj@gmail.com, netdev@vger.kernel.org, Laurentiu Tudor , Calvin Johnson , Len Brown , "Rafael J. Wysocki" Subject: [net-next PATCH v7 01/16] Documentation: ACPI: DSD: Document MDIO PHY Date: Thu, 11 Mar 2021 11:49:56 +0530 Message-Id: <20210311062011.8054-2-calvin.johnson@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210311062011.8054-1-calvin.johnson@oss.nxp.com> References: <20210311062011.8054-1-calvin.johnson@oss.nxp.com> X-Originating-IP: [14.142.151.118] X-ClientProxiedBy: HKAPR03CA0026.apcprd03.prod.outlook.com (2603:1096:203:c9::13) 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 HKAPR03CA0026.apcprd03.prod.outlook.com (2603:1096:203:c9::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.9 via Frontend Transport; Thu, 11 Mar 2021 06:20:43 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 10f97422-76a9-4771-695c-08d8e455d1b5 X-MS-TrafficTypeDiagnostic: AM0PR0402MB3442: 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: 6y7mOLvW/pUyNn6c3Bh/Cg4wilYBZLqmhX2k+sAOnJW1LyBtSnchsqiowHop5idRlHBok47u7AoTLg63r0INR1fgqlX22cE6XhrMDIq7VLGX1cDfJo6OiSnOQCVED8wbgEHZP7+ZhdNXJg/NhjAt8RfPXR93ubGulSnRTY6nJZgoLianKTDk6eFFTrsjhmN1mdon3XtLS3fDR/43BFaqWY0byaLu0V8+ybgoICN40ZU2zgzWaBVJ6atuYCUHnvFszqeC3UqC0BLdbULOuIjhQP9ON3lp5um1tYAEJNv5+fR3PPrIdIlnK4lfjBkS4UysIiiyD65IMNyIGJrZwt9zuAK1WsQP7+ZITkJIIx0uJlA9IeXpLVpOgDiIeMC/GuAofWTRU8MFYtsjGyW/XGRNVdw/1DLoa1cZIn7dWtPUTnN9RZQSSlQf6bEFyKXUrAxUFfBDZr+qTLIs/vao72Whpq4NyZsFj8xyjxTBPkupA8w3aFhI9u5WzIgOhMTSu5MlRS5ItYTPk5ZTdhSZairwg1WLd7l5soVKkV8hHc0nc1aA/fHrF6l7A1DIwVuu7YKuqCp9qGUsjGpJmosApkbT++r4WwH1h1ZKam6xIJ98UmMlbi61NkLuPMvL1UBnWdoPc4qKXkRmYRb4PHee2KVxSTtg8kRWp6gzrl7Jh1s5af0= 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)(39860400002)(366004)(376002)(136003)(346002)(396003)(6512007)(2906002)(7416002)(8676002)(6486002)(2616005)(186003)(6506007)(86362001)(26005)(921005)(83380400001)(110136005)(16526019)(956004)(55236004)(316002)(66556008)(44832011)(66476007)(8936002)(1006002)(966005)(4326008)(1076003)(6666004)(66946007)(478600001)(52116002)(54906003)(5660300002)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: dlW7zb1zQLAzXhQKMrgL5yG6DlaABx7athdeydei9fgzjyMprafzUn3b0a9SJvYCCpANLxFZcJIHtV3MP2bBi/oiuV664HwcczcV001cMG8+4HEyJQABs4YKSzODT03DyjxNOnfVPTOh4DlbI9F7BSZv/KQZmnKAW95Fk4KRM7tv4lgfsLP2ZmM0DnDUkPPjscOUfkM6jNuCfYjOhdYcpzd9bv5gOptMI8brZE1llOy26/YTSWOmEmkqKL43Vd/9cSG4REUJatt2TrO8Sfk+09uplW7ZJuRgNWx/t3CN6io7SkNI2mVP4aLILPb/H8Yc5NJeTJOKEqAW9mzuQEFeDS9E5YtSMhqGoBfS1Gk2GW6TIt+tatYM1ijOzcIe7wXQ/CCyOdNRRfA6hfL4Vpbq7hwEExi0UjGHVOX/gfRAhDJ1siFGabqSzLN1bE7mpyFch82w/nfPWGdpQTIGSK9JN+IytNfHqLPV1Zmthji/FUVDI6wpmtJc4GX3Iw8xjLNfMShgoJtEol7DndlTaawNn+3/ggGi0DN8hZCH9OwKf7cIURyDLZ4STu2unR4Te9qF8kM01RnZdUcI0gdJstrhvKDG2K1tuQqU4ePUmev1zlSvfngAY9NYY9pXnJUq6pNAl+36FXCAuLWKO11+GJKez5/P4y8PwWWC0b8lAw544UyVCQch4STzH8ij0uyrNztInDidb3dfimiT988DARG+EVkNgFai8snIpV5C3tJVa3mF7OnS1K3jNGGHk6pkUSG8ZFMgkNBbTGE2o/pheC9PSGGSBZ43DaCDLm4qGnmuEE+yJxJ3Owah40kfswZAQwauvV+EtHDWZAXngIf1JLc7E/UoGC9sTHr+eq5X/Ftql1quntMx9rboHd77CXMElUWPlJhLa9HnQIQiPCNBeLOD2vt6QwMhsXRiTjalY60lmaa29Oz70p78E4WiiwtW3b6rJmy09QiSB2NDjEZK4uNa3bszkSOlxkWw2ci/NWQyq7W/THCRQmDpaJorcurT7GNsEHN3Owsi+DVCNKLeazZZ8Bd7FkUA3/f5OWk1L/dcvYtjni2KUcOUVh9gYVdS7rAsPCmVj5qmSknpdFXHhULRPC5hWfE88aOuh6iCGrdZ1QSpJ6lFlNRY4z3yj/cGvy5Ovnpe0S3Ieod3Mj2YjShpp4TKM9f6LnJQdAd79QOgLB42tjxF/cu2bXsAv0a/dUwReUI6zZtA4tzIYtf3yEYUNJiepa1dkW1U+F/BlFSU+WVNyMv+Mk3ygah/dKE4Pc3XT05skj2orI6huf+3dUnErGWxfNBgWggqLShOHvKg/WsAAjACf60WPN7gvNDfewuk X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 10f97422-76a9-4771-695c-08d8e455d1b5 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5636.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2021 06:20:51.8733 (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: cLMZZFdwEHYy9pGJdNyFOmqORSXI6oFGCpDYFJBNX0dpTM9ymE3VdgSBg2Zj+44M1YhYX9Rg/on7z0rDTA7fqQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0402MB3442 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210311_062057_740383_0FE2B988 X-CRM114-Status: GOOD ( 17.87 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 v7: None Changes in v6: - Minor cleanup 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..7d01ae8b3cc6 --- /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 their respective MACs, 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 needs +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 Thu Mar 11 06:19:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Calvin Johnson X-Patchwork-Id: 12130357 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.0 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=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD7DAC433E0 for ; Thu, 11 Mar 2021 06:23:40 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 7030164FCE for ; Thu, 11 Mar 2021 06:23:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7030164FCE 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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=s9i3peHuZE5NgK+bQSfuduB0/Wt2b8fal0tLdKaGwy0=; b=GVY7wHBhHGerRVvpIENLd292T 3XSbfukevV5HygRvQUTXaRGgYUGM7J4GoLBEUX1ja9MkTVuV4McApv6y7eMyZU/aAmFdbxXuc9BQ6 RMkCQGcs8UAaI6lbgVb49tuWodyphvD5Wnlpi1X8oSpkqN2YQ105dtFzJ26ai7lMQNF5oSP7l0lzl Ju+e+kUIjPGQY/SPEWFowvf0sEYZvqoGJOHzZQM1lVeub6gdx87AgSXPBQL3OvQtzXx1xiAoDYYR0 AC8QbymOJWsQqqOezvQHoXIDRl9t0GTxdbdnMvPJnj/S3GoL8AfYwNENS5D+ppiigc5jhctFQe1GE vy2pNMX8A==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lKEhG-008SN4-2V; Thu, 11 Mar 2021 06:21:22 +0000 Received: from mail-eopbgr70044.outbound.protection.outlook.com ([40.107.7.44] helo=EUR04-HE1-obe.outbound.protection.outlook.com) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lKEgx-008SJK-KI for linux-arm-kernel@lists.infradead.org; Thu, 11 Mar 2021 06:21:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VL0NoYC8NpHMHPztvwwSh3wEqIj82A/1tTXzor+MkQZ+vIbqz4DtWnc5mqP9l4PqCNVv0wJiIML0ZOeqdi+Bs51b6adEZ48TIeOpfj/GeM9pXw8GzjW1DW8EYB37RG5PEWaOaX8Wv8uckw6nY0R3EdypF0uzFbSxhiWVUS3KCY0n8xo3W03iRtYI3ArzDJ24fF6A9W8hrC/KM4lTy0qnWmch7WFHHLPviEx/8Bgef09x9m5DCzO5jHyGFC0e8lvn7DuvXYkEClVLAB1zx6bWNEjExmHRzulIq5upRXVPX/6XKUCFykMgH0jXlV28I+xrcBNGGmQIDGOPu/EIp+24nQ== 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=AyDtI2Azne/VIEWFO+kBwKlpm+Ru9nL1MKRh6DMTeRM=; b=enxw2uwwvJx2gW5M0+ad1WGr0nrmTyF6JonY2jQt0sFEZrJUgnv3n/00L+UrQJQ+OTK8gDUR1DFw4HgMchSsExMb3QgSKvZpGDoIuzfmrLj1wuNEAm5x8gMOC5o5ITRfcIKPO9gr/1Y6lJ3dhR0+9dwmLi1q73wo0yxrgfH5vThDB3GII+cKwBYm5mMO0DWryBOQCCq11jmYFZc72OZiq09OmcG0glPhb6SB+B1NlyV6Tc6KqVeBjSwKsfch7VrYrAgsccp7T7hcwZ9snd5MLQC/klIwBvqrpFsOoivgTIxh7zJ9yDp7lnO9ZnWGeCXxq8yvbfN/0neP5wpNetML5A== 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=AyDtI2Azne/VIEWFO+kBwKlpm+Ru9nL1MKRh6DMTeRM=; b=AchWl3IWXJa38DL4pqjBTPaMAJhCQ8DVAEkfOECyHcK5JRC445gPBHc2Dx2Ox8i7k6AoohN68EDmg8lfGgD1gpjFPDBSGxWF0rtjk+X4FgyiGw62xcYa584fWL8W8Zmyzbzs99m7QX8MkasYa1B9c5b1weEKfvRgl94uEdLU6qA= 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 AM0PR04MB5473.eurprd04.prod.outlook.com (2603:10a6:208:112::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.26; Thu, 11 Mar 2021 06:21:01 +0000 Received: from AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::1cd:7101:5570:cd79]) by AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::1cd:7101:5570:cd79%7]) with mapi id 15.20.3912.027; Thu, 11 Mar 2021 06:21: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 Cc: linux-arm-kernel@lists.infradead.org, Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux.cj@gmail.com, netdev@vger.kernel.org, Laurentiu Tudor , Calvin Johnson , "David S. Miller" , Heiner Kallweit , Jakub Kicinski Subject: [net-next PATCH v7 02/16] net: phy: Introduce fwnode_mdio_find_device() Date: Thu, 11 Mar 2021 11:49:57 +0530 Message-Id: <20210311062011.8054-3-calvin.johnson@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210311062011.8054-1-calvin.johnson@oss.nxp.com> References: <20210311062011.8054-1-calvin.johnson@oss.nxp.com> X-Originating-IP: [14.142.151.118] X-ClientProxiedBy: HKAPR03CA0026.apcprd03.prod.outlook.com (2603:1096:203:c9::13) 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 HKAPR03CA0026.apcprd03.prod.outlook.com (2603:1096:203:c9::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.9 via Frontend Transport; Thu, 11 Mar 2021 06:20:52 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 50792285-bfa6-4eeb-d6da-08d8e455d72d X-MS-TrafficTypeDiagnostic: AM0PR04MB5473: 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: y3s9U3HySg7RzM0ulEKr32CZaqOVyH9eRG2XzHXDlO48UuqHoCQyq4iHN+XudnmwzJUy8bATATrkkfwxGN5ddUwMnXzvnH5jHnetpObspEJQsKhdWsloFKOyB8jtm6+STemPWiqIUg5MyplchFHJXPkWflHyqHBWXjlGi665MuoYTM3LQNVZXlCc/CqOZYEJHUcRdzaqYV1wGAnH0dlJcuhDb/Scq+8XW9DFyo/frize27Uh53IeZMhw+B7Hd3TFJWqka5HEIBpaUnw6rZhzCTD7Q4MCHWxjojgLLuEc1SJFtQdBxS/GnV9D+w/Hujk7xFmNSRD99bz6dvQSR/OspVG8qs75QYd/RQ4Et1+lalpmX7BnyFejknLsIIgcXhrOh3HEPpogx1jaqLZVJW47S4/fM2iAusplJc2ZRGeAc/+myo24lQ4bSVpfrzaPZrlo4tFJ7jYB366hmLClsc6l4El+0qEEHt9WEA8VSQLH9aH5y7g1V9eHleg2ST71hzpXu18K7RyoI+dsRJerfii/0pytq3uDTkMEmcoEuDF2nK6wzdnDAVnKSRezTEd+3Ly2bRAJXOnmupT9ahR/JMPiYsLHLPEgKHiEYuemF8ivZ1o= 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)(346002)(376002)(396003)(44832011)(186003)(54906003)(66476007)(52116002)(5660300002)(110136005)(1076003)(66946007)(2906002)(316002)(16526019)(6486002)(921005)(4326008)(478600001)(83380400001)(6506007)(26005)(2616005)(6512007)(8936002)(7416002)(55236004)(1006002)(8676002)(86362001)(66556008)(956004)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: ezc+YpJFGzofJlgUOc7ts/z0za7LarbF6jDYXJfbQwiUWruyfH9pX+mxa5cAGMVgrJDkaYq5M5XzJWrVGEjfx8FV5SjpuvNNJPugRrmpOTK5qxRk81mUAPjRp9NxMR+uqi2yY5Gk4A8HOkKM2figjX4cnlM5UTrsqx9oABqz0FtQ0xIE8m2C8xiui6oMZxGnKbg4Q5WtaUVUWxxmsNWq6i7Ko34OXs8iziD5Vl/sBYvRmoogDwCtyrqpGK4drbu09CMQGnW8IqDihFAi3gMGDWdwg8hM8ZCcACc/LOB6KwTBKfLvtu+iIGIG/etsbsgkjz5Z8qmbwNmnTfbHuVwIVP6JNE/onpsGsRhqMdGNoZSthd0tuQ+T/AEPutmro4BlFJxKsN/m3XbLPwtjpGd+4ZfsRwksd4KoZBt3MhjsuN1VgP3xIDXKhZBYijGqXMrFFUS5xyY6i8/1/abxsBvXjcNlvjm3ph7mB7eZ915qP3i7cQmP1WqA+IgpGzaFZqk6UwxHgBvmXOT+p537biSV4qe3rKCRV6O/FpH80pro8uL3JYoSj0dM28+5qQiGRBFqgOfqCZeASqYmO8gVlfFj+YcZW0Gh1xsGR1VV4xgvXHjIbda5iTd275AbCQf9LtpUvNQPGfkLI0s2T74c1S9/aEu/qnKv5xkH3GnbPGc9KYFEGRob2hpO6x5YMRIs6A2J9O34yPbbHEDZFymGSetmJ5rGFigcYtJsrO9nBE6Mp6EHEde1tSL6fNhxIUjlMAPeztJQzRJp6mP/+aWTpdlZye78GTSc0sx5hp7GqOYMBo3lN5CJQxUrggKBUx+951Dh2nRCMnF5yGzMK7p792/u1QfWNafN+DonrtCpoxQJaWDVMtraTklkJbp0jF6d8j/KTSVOTxfYwmZ9vclS0WYpBID84jhOw9w3PgxMG/O1aeL0BCDGXBtSnyWxOv3ykYkABfxvRj9iX3gjxeyMnwBbVhyyhhbUs19NTXjiYRq6+ZcEL25U3Lu+y0FJ2l5tAGd4ZVfiwUQTlhWU7LejXVGKV6H1Msju54MaC+kZLk4FNnrJrt9tiEjBZgfcz49AKtu8gEQF+qdNy4hCqWA09PMlt+a3EwQ2mhK2Q4k+z0G5Jrv3DxT7DnOhGccHgwQ1SpRITvibpS9OP29qiY2dxVBaTt5tckF4M4A950Pn0G0rRJUTL6dLJY92y+2SgwOAYQSywBV5O76mfSdlAVIQPhoaatKU6QELfwNHXIzZJf0gV1IFUXPnjLfp1uYiPWCRIy7Mn5gS5CypcZUMtTZPXaz/ssW8J12HMFNh/cDBo3v9MPRpa84kWNXpTM/C5UtrFpkq X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 50792285-bfa6-4eeb-d6da-08d8e455d72d X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5636.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2021 06:21:01.0811 (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: mWJ5ttTKy5vxg426gV+anJzMJllF+AQjYSgQ4iLcAenVKwJxMMIqaOsvQEdsvrFE5EWgw9hRBMtix6HDJ076Rg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB5473 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210311_062105_458763_A63D3A7E X-CRM114-Status: GOOD ( 16.12 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 v7: - correct fwnode_mdio_find_device() description Changes in v6: - fix warning for function parameter of fwnode_mdio_find_device() 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 ea9d5855fb52..d5e0970b2561 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 cc38e326405a..daabb17bba00 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -2819,6 +2819,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 + * @fwnode: 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 1a12e4436b5b..f5eb1e3981a1 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -1366,11 +1366,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 Thu Mar 11 06:19:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Calvin Johnson X-Patchwork-Id: 12130359 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.0 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=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ABACCC433E0 for ; Thu, 11 Mar 2021 06:23:43 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 6D67064D9E for ; Thu, 11 Mar 2021 06:23:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6D67064D9E 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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=BCOSxSlOzL/JPjLcTSIkk72Vhkaqu32FrLFk8ol7HxM=; b=PKGId/exC4CbzofUaw8piiJnv DwvRdSqXDfY8xosg6tJD78Kir3QBALbHU46ACrK8W4OimP+f96myzx6zyCRbnJq+/qD2Xs7KF65Wn W+rIJGd4/gaLwyytFaX7DLXX/lfUC9fDzYKMdBQ/nYmfTAo7NVEIsPalEAPPpQbfURN4il5HfSVE8 A7pFPUGSqbOaIx9E6R/KOMvenia2M8F10jqmKWqTtlBHx/BLui+3WHOJ7Q9vP8j3zxy3QVIBy+M22 tqbL+caoa6xbcU34w3qHc2JykrPFm0KYCOaMj0CvItn6NOjdQYtFmZ5j5wtkpnEJQ+ZJNJxxXePBw WAqi/+10w==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lKEhN-008SOh-Rk; Thu, 11 Mar 2021 06:21:30 +0000 Received: from mail-db8eur05on2077.outbound.protection.outlook.com ([40.107.20.77] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lKEh6-008SLN-DS for linux-arm-kernel@lists.infradead.org; Thu, 11 Mar 2021 06:21:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LQqqjhju7fKa9s+p7pHULV2ZcEuXVRtUMJ/DU52hv/S8vnyBOUtSGGPmQeHAzvhr6LD4t0SeaUkPZZnYodVkL0/hKbtsTh+ukI5/NuSIU22YxAwZVxuSVebE1HBI4BzpE2kFEWq4rucil4Fzn3ndewK4hThuKTxkKwoKZIWtv+nDKnH8CIq72gRWfsg620ToOG/2V2vkIMhCOK1XIAMdtE5DfEe2PEisKpLjN/RnmwGCMzOyM5/WMHGYGjIeLuYGzAahXYeQ2aFeG8eLsOWLrhEg+lxbXNi/CkQIT6D0x8zdz905Rd1FLHsv/IzLPujTdldng0XwYwIlrnoYsBwFQQ== 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=mA9n+CzKw760mthl8WNU1R68T0UjsjxA9RAup/kG3oA=; b=dhMPNEo+3JsGML04p1gD0kr+qZiJQ6+gHJIW4rmxm2g7GMyaPT5eWx41tKpVIZYfk+tAGBkbbPjWYydk0XHy+B2m4YuJZUmSsq4/LWivnQdqZTd8xiKL/sLCfl1U1vke6KHedhJWZhzNwmf8jgj8RhB1Z5CVdDJlDMKuNiqMBPMBxMwucEiwB/7NkyfXgblUUF/2lDGZN1aYM4cysNxi9/51ityYf/XuvhLHdoN84S2K/UBvwCubshm2mHA4ocZ09IX537GGVzF91nAVioPWiy642JF5ydkshlKBRkvfR8ygszK3e9oKrjhEj3RJhD/nPk39oDF0lBEyCvnKbsrG4Q== 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=mA9n+CzKw760mthl8WNU1R68T0UjsjxA9RAup/kG3oA=; b=ajtF3AfERgli5ZT2zcRHRFo7IfQEUILqRz1+oHLWw6zePht3H0ycptJLhdiZWzDSMy57wCupfEeMCxcPBaIUdJt16NvoEDXgtqf4gUZwNLxwlnA7JPYmZD6KwaX2HS3tTMEcBezMGqSgxdi/TFNuOkJoz5c8/+Rkkq5g8lDvg/A= 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 AM0PR04MB5473.eurprd04.prod.outlook.com (2603:10a6:208:112::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.26; Thu, 11 Mar 2021 06:21:10 +0000 Received: from AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::1cd:7101:5570:cd79]) by AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::1cd:7101:5570:cd79%7]) with mapi id 15.20.3912.027; Thu, 11 Mar 2021 06:21:10 +0000 From: Calvin Johnson To: Grant Likely , "Rafael J . Wysocki" , Jeremy Linton , Andrew Lunn , Andy Shevchenko , Florian Fainelli , Russell King - ARM Linux admin , Cristi Sovaiala , Florin Laurentiu Chiculita , Ioana Ciornei , Madalin Bucur , Heikki Krogerus , Marcin Wojtas , Pieter Jansen Van Vuuren , Jon , Saravana Kannan , Randy Dunlap Cc: linux-arm-kernel@lists.infradead.org, Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux.cj@gmail.com, netdev@vger.kernel.org, Laurentiu Tudor , Calvin Johnson , "David S. Miller" , Heiner Kallweit , Jakub Kicinski Subject: [net-next PATCH v7 03/16] net: phy: Introduce phy related fwnode functions Date: Thu, 11 Mar 2021 11:49:58 +0530 Message-Id: <20210311062011.8054-4-calvin.johnson@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210311062011.8054-1-calvin.johnson@oss.nxp.com> References: <20210311062011.8054-1-calvin.johnson@oss.nxp.com> X-Originating-IP: [14.142.151.118] X-ClientProxiedBy: HKAPR03CA0026.apcprd03.prod.outlook.com (2603:1096:203:c9::13) 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 HKAPR03CA0026.apcprd03.prod.outlook.com (2603:1096:203:c9::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.9 via Frontend Transport; Thu, 11 Mar 2021 06:21:01 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 68579370-079b-4f20-0954-08d8e455dc8c X-MS-TrafficTypeDiagnostic: AM0PR04MB5473: 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: KusriLlBx09LknlqRkefMSzLNTqiFdsFCahkdpC1RT9sF/Jb4GVliZsgFlKjM5kXXxvB0pCbcu6uhPfzRDeDQZ+/2jHpa9Q2c+OFX2psdn4PjbM3Xaj2K1pKxoKOKsikHWRJOSROoShCfW2HPD4/oqFZ19ORvh/SD2X+yLZYnPeZYK1/VcjvQtN31vHWFb3wi+ld0U84WtiQ0t5+hgOBl8nsxcWUG67o7yC+/z+CEhX6MVZyMHX0q8FUWvb8mpbff46tbu0k2ymxh7m9x3Q//Fa2GMC7jECDruiPZMLpCwtg31VW23uwn/1okNJM0qVoaVZwUqqW9GfRjwdzhW96P/tuasczhMsm5bxG6XsV0sKhZ7tyKxZ9jRlFiCqBoX+F3WOfVDP3jrEmgxdJ2fK7pXDmTrb7G92GNkqSNYjBCBmbaAwlUwcZNnHBKOd3rY9Kdh3/5UhMgjbywZ4r7yAIC5lveDk8I0AbdMzrEGHUo2A5etMbstXSMspYG2tWX3lsMKYJfGU8a1JiHlhAAFQt+yfRPlQXbZ1l2tmo6/1roz0pAQ/kHAsFYhwd/s4SU8WjccjcA726GZqrMy3+LT0QSGopYVevEXyH1hlInxMA70o= 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)(346002)(376002)(396003)(44832011)(186003)(54906003)(66476007)(52116002)(5660300002)(110136005)(1076003)(66946007)(2906002)(316002)(16526019)(6666004)(6486002)(921005)(4326008)(478600001)(83380400001)(6506007)(26005)(2616005)(6512007)(8936002)(7416002)(55236004)(1006002)(8676002)(86362001)(66556008)(956004)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 6slTvZb6krx/5RrFzdiiPnkwGXLieDRoUZuLUYRciKp5PiOKAKPAvgZdph2qtMG8NmF2Q5JxW+5Ry1jf8gnB3HbdopiZmUwGdGtQ6BRO8rpBBGEZVf+tHWonkQ8uqQq47Vcd1gxm3ufqKftX34NAW8tdHESL3amzO1MLppQG9G4SCHnUgTOPU3x/qbLTqmkVFGmFp/QtyXcrlpm3lctBk5XcUb04GjeJJQ8iRTu6lvMUGXYGtCPGPzKweK58POUo+U/RPtKvh3jgOp0nNRJ3xz10rr5L6juo64muCq7ntKS7AdgMbQTjZY+tz78jgC50h2muNBLDvW2tPLxv2bli8kTvCzI9mJI6zFYlY0qJWQe2A1dS6YS4RDuT3nt6b8nmOqzBbAVxOVN4KnzjJK6gV0GiTVzkLqyd0evbyTTn84JJvcHw5iKx3uVIYJOdQWTHn7LFI1VJwACNL94n5N1ZayRPP60pC0bdpvtD3GTKrdop8XfHS7N/KVNeDJXXDoxETbo4Jsr9NQIqgTUWg+PzcorYrqjxN1Dv5ziHwROprxXCiLnvIhJg8AZ4/dorkH33jvp/cky3lpeKq5F1KHGvRjYZd7dyanmG6Z9HnEHgqihAPb0GgsrTYtDZwzLN9uhAatizGVyA/PQH1CaxnRWSIWrDffy8ELHmRp7WfxoggJtdk/qVMAiio3TN8MXzzdmvMu57MyhB4YV3nUkJdKXtZEl9Z8JFNWvtsnkM2LX/FLo4vpMHd8kZB6jHMoNAi+8aiBvO6ZgRSczB/JBG8BaTp88MeJYYDH5AREwshdva3Y3PYwpwhvqwLDD2znIMtGcENYPp8H0JDDrIhp4oZP7aDftwHxujGq9aleag3ckPz/RP2yvviQuVhR4970tcd/MqOsnt7FslSh8FCsurNI6Fw6577cfvkEospdRVy4GrS0HoM75/tbRZ/7hMc/L8fDuq9do+Jl7hOHWnNkVpILeSDiH30aIC5pKor1gOz0+718bCej1PwD7ojKql8fNSTMGPAl7ACA+RbiersL9V/2KlQHxAVClrDb2zcBXLRCjdIQ4m/vp2hI5k/NEVxpc2qlTQeL/z2f7RwxuNLDKVyh/11jLIS3SMNxsXje/06e7YoWPk3LYJ64DGkmgdpUDMoXfUvhauNkorjL2JlYRBpA03zcPwBdhFCCoeqZ4JunUVfbFvo5//ZGzrDCQLfU80wyyMDfGu9y2O7m6mS+yVokAgafD7fbcE7SF9LvpWjjTuZRhLlHx0Sjl5q+wZLrhu3ZWlpNyrXBJyJkbDV4dng8quub0sh5ajFlZVi+z5KULSgBZlRr4IFTTcTbj0Ej4gN3IN X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 68579370-079b-4f20-0954-08d8e455dc8c X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5636.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2021 06:21:09.9231 (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: zl9HWstuk+OKCkViod3XtmZsQieqBojqwxM5VKQSTYUNaXKbfVQPm5eLWndDNYy6xGEynrZgquHPuCq8lXuyqw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB5473 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210311_062112_498415_2EF7AB85 X-CRM114-Status: GOOD ( 18.17 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 v7: None Changes in v6: None 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 daabb17bba00..aec8dadf5d8b 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 @@ -2842,6 +2843,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 f5eb1e3981a1..720a2a8cf355 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -1367,6 +1367,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); @@ -1376,6 +1379,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 Thu Mar 11 06:19:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Calvin Johnson X-Patchwork-Id: 12130361 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.0 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 DAF69C433E0 for ; Thu, 11 Mar 2021 06:25:05 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 704A564F34 for ; Thu, 11 Mar 2021 06:25:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 704A564F34 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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=4NFZq/PPxMYgZ44tzLfNs59iaMd+Kq9IfA2SapaYPyI=; b=qvPcxF6HhAw99uvSMODg9LGYc q7NEKkEeKkG8Ke7+khbIkxI0STAGT9ru3rWn7ReLxbVs7ApLD42hEbhivRy0sMUvd/1Dyx6fF2Kl/ q1RgluwYeAksaR/d2F/0hZfHYCyy7N5qNcTwQ3fkai+/6CRDVPaTPzs81lGPRa33WXZ66izDn2pgf k3JSLFapDTzRQWEJfUtsF65on7Yt/FSDOHaJcrkXlOh90nENTRACBPmF0DFrVH2j4sW0S40NR3MKl kEWc4aR4QrzT7uSrQf98k/qyiAvdUKffDoD3EnkTor09KPM6DB5jj+NcElR+FsXwJBdv1pE71DOhP t2fZuLbqQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lKEhb-008SSi-Ex; Thu, 11 Mar 2021 06:21:43 +0000 Received: from mail-eopbgr70080.outbound.protection.outlook.com ([40.107.7.80] helo=EUR04-HE1-obe.outbound.protection.outlook.com) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lKEhF-008SMw-ES for linux-arm-kernel@lists.infradead.org; Thu, 11 Mar 2021 06:21:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SHH76PMkc+Qzg8xmpJNY3EwGJEKALSDvycd+YdvvJrqbSFlJMgTyzMwh+Ni5lSl6LCBDgly8H4ETT65UztfGjtNtx9B9B3AcAOJ735V5gFSqSQQCRTtGjvNsxDp6ukAiXhxjwCi66Lfb2SElwie5zkukFaLCJhSiOeQ+CjVI7LTCMpYr8DslQ2kQAjop+uIckV4ABU/zpdkE3RviKWPjjt4uuXP4lteQT9xMOeiP+2yyPuIFb3qHP7BnQmzj4b6BlNxjV866PZgSbrVOT68NzAg2jWgnDKcn3jA0Sr/HoWYSWihl6ZFCSMvXpunD+PnN8o/TRwOiD55bH7afGaVMDw== 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=yUCcUeOixe4seIGhSVfibievgonYYsJIkqsL6FMhwA4=; b=DEGMfxbsOKr+nEOWp04WvIcPnRx8yiLHwEm5SsLz3n8n0vwbA+ohF9VPf5uUZOk4Yfy6QxheVjyWd6pMkyElxYuXQLw9GkJk7us8E2WgpE9pN6mbEcSXXE0VT4/veqbjgO0+1zzvTUaND9ykMohn0Vyqs7tyOmit4c5QAN8Iw8jsM8FIPiBJ4uu7n4oK+HOogDzc6ddObuXXRuxVYPbaEdzALWUENXilNybgkAE1Z3BdpKiqWCrLYRF02zEHVNQPFDFNjdMEPgo+4Hfj3RPLUm781/Q4pTeqaDpnM4cPbRuwJ/tmcOpWFLk7Yt4SpKtIjbRCZdeLbGmcMed1t1mv1Q== 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=yUCcUeOixe4seIGhSVfibievgonYYsJIkqsL6FMhwA4=; b=IBdfwMz7mKpOK7ryGdt2jrBqUeY2bzFM4DeCO+pYylyPmlgxQSconDHPlckYCfRjkaLhNsfVrgOYYemoPJ6CtaSZ6+3gmnjTXL7ztsVxGAbaf1iKWFibyB+uxhZQItzutYJBFljHo0kjb0EcAE5CdKZbMxVAf7fJ09DdZWyw6IQ= 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 AM0PR04MB5473.eurprd04.prod.outlook.com (2603:10a6:208:112::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.26; Thu, 11 Mar 2021 06:21:19 +0000 Received: from AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::1cd:7101:5570:cd79]) by AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::1cd:7101:5570:cd79%7]) with mapi id 15.20.3912.027; Thu, 11 Mar 2021 06:21:19 +0000 From: Calvin Johnson To: Grant Likely , "Rafael J . Wysocki" , Jeremy Linton , Andrew Lunn , Andy Shevchenko , Florian Fainelli , Russell King - ARM Linux admin , Cristi Sovaiala , Florin Laurentiu Chiculita , Ioana Ciornei , Madalin Bucur , Heikki Krogerus , Marcin Wojtas , Pieter Jansen Van Vuuren , Jon , Saravana Kannan , Randy Dunlap Cc: linux-arm-kernel@lists.infradead.org, Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux.cj@gmail.com, netdev@vger.kernel.org, Laurentiu Tudor , Calvin Johnson , "David S. Miller" , Heiner Kallweit , Jakub Kicinski Subject: [net-next PATCH v7 04/16] of: mdio: Refactor of_phy_find_device() Date: Thu, 11 Mar 2021 11:49:59 +0530 Message-Id: <20210311062011.8054-5-calvin.johnson@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210311062011.8054-1-calvin.johnson@oss.nxp.com> References: <20210311062011.8054-1-calvin.johnson@oss.nxp.com> X-Originating-IP: [14.142.151.118] X-ClientProxiedBy: HKAPR03CA0026.apcprd03.prod.outlook.com (2603:1096:203:c9::13) 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 HKAPR03CA0026.apcprd03.prod.outlook.com (2603:1096:203:c9::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.9 via Frontend Transport; Thu, 11 Mar 2021 06:21:10 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 1706caf9-587f-4099-7561-08d8e455e1d9 X-MS-TrafficTypeDiagnostic: AM0PR04MB5473: 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: kiB6ILo7oDMvY2v4bzrKvgJLTYZzUBgUV5vAEYk7giRgp5X40cvs6YBz0iZYt+RzeXArVsCmWoergwAp7rs5HyZNTNmSYQ7Z36dByLpG2frCtr3+Ytj7vQ3h3VJwUZFgbdeTll94ko1K01Ig5YejdusMrxlwOPSE5RNB3nVqmPRnIgyikPIJWl1FrAxmwpHr9CLuGyr6/5xTROHQDsoSdT3OSe3ZQBbaIbJjnxpi0nlB6bPcWkd1t9g0eZNr6tWoJshfrAYhylEWNZO3uXWlcCVpwl3w2Db7Rq005nSTg8lRIW3nLSsG9T45VkVRK1GnM68qCXgncIjeY7949B3MIF6riWa9ywFZKrpMkJgMd8J6tRZwDwu9NNrBHa6/sHL6Mp4Ggc2NncStlhitW0EhMXEq5NN4vFlr79W+eG6wCheddB85gq5AOW7M9MNR0oTTrO/Jvv4p/A7tqqcTcmBhWANVdQCyAV+YVpjhlKTlrPRqYVpF97T25FoYFEv5ePwWYBntICtUJeF3UCh136GBu/q2PN2pAB4/zCYHFCdvTHI9YsuZWzqvfu15m0QoU+aOCRqn/RBavybhcfZ0OmsodA== 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)(346002)(376002)(396003)(44832011)(186003)(54906003)(66476007)(52116002)(5660300002)(110136005)(1076003)(66946007)(2906002)(316002)(16526019)(4744005)(6666004)(6486002)(921005)(4326008)(478600001)(83380400001)(6506007)(26005)(2616005)(6512007)(8936002)(7416002)(55236004)(1006002)(8676002)(86362001)(66556008)(956004)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: FLyl+bbrwW7vuW8JwVJ1CxGRs54jHIW0ao9ZjoDknC2Wf0thdnFJ9Lp/z2TZVztILA+9TzIsbs9iVi4QTFUuByLJ4g4ZoJ0iFZiPYNSvopyg9ess7szd16HXa2/skxl8ZC3Zz7DvetaPNJWF3Q+YkQBVWQl4u/JWopb7cYeKbJa21cnNDCCZwSfZt5Dwrqa9tXFUp+SmuF8qZnGupLbAJmo2fPAMEd0Z/9VgKvxOkQ0c4Ex0E5PCYSbGsIq2qZG8xQMCQyHThvqoA/FOnMORc4rZEyCI2tUTFfttBj21x6dBV22cvh6bD2ZszGAa1qG1zQvh5jL7lA9j+Pge7cXlGKybuxtzLTPvx3kFiaQTsPVEoncdeJH2xNFveGl9ngD5/mHtzx7AkypSztEI8esOFjGNIkhzirH3E3UW9zOwZyuJRSdQsORzqyhP6POBO/15FfYBmcaqr2W7gk5n1TJdlzab4LBrg2zTftw/LbQDWx3cUhB4a5QQbf5RndsNOivZpOXzu97GwjxGyLEGtGzKeVQUMcbQ0OVkz3Ie14ha5fquYE9pe+gN2dLsObWt5NjKGqWhAKKkUdc1Fp4MSmFtsitCF85SOyyruosRKg3UWQDreHAlwspW9eC/D4Z73K4F8agwST9CDs2utojsTw/w9/aP9PHacy4pakYtSjIaMMn+PhH5PbdG2KPFCzB4brFzoU3rnHnHeP+pxIwPclqrwRJk1WLq3IVohpOn2uw9Hf04ur1yVaER5gUP+en8AW4AdxU8OyHF7KsgVTTJGm01Q5JPt8W+AUa0zSV1WFQEN0vn+c1WRcWKVTiKe60ud9rGUIUD7lczooIwYDPgNK2/gbSgHc719BrupH31Pq78qxYEVdI31/8lmJ80Z1upKmOSntvsG0HRFkEXbIjWpkWHqlz2dCzEuut20WAkEHapeX19r9NqSnTCUZwWEWEBMRx3H4gmbIpRqOZ6or1P9oe8fUeQ88dDEEXlZrfhnURufgTM54CBs6qmwrtPjhvtFHoM/KKiCRIj7xkoCvGWM0ioRxxG7uechzDa4qp0jPVYVn7CPL4wfIvkYX/OrbS5nBipnBX3kv2XfEeuRE4b9q/whcSWkKNAPcuZcSGRaqGpB9uxSqgWqtjhPVCAHzoUH1j4mDvwxpecL6YmVUrnHL9A4OJwJT46r7KEEsPsq1Vpmh77/jUE/9Woeq02GD8BaEoKveAsNmpon5qCSigdXaJgSn5vN1jMAt00CBCvcb5u0owFFxHNainVWpt4xtimpvp5MiFATzPkOaiI6vZUf+B6hOhBJhr0h9tq6u49CurX0e2hQLxGo3tU7AUxn+GPvCXZ X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1706caf9-587f-4099-7561-08d8e455e1d9 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5636.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2021 06:21:18.9261 (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: ZXeiM2EEw+rf9OjwOPVGOhPWV40SE1//TI/6nPZYAnK2KC5yTasoZJvH9a5xxAi4edB/UdTX88TdhX5NDSRDXA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB5473 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210311_062121_643250_846D8CB6 X-CRM114-Status: GOOD ( 11.84 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 v7: None Changes in v6: None 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 d5e0970b2561..b5e0b5b22f1a 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 Thu Mar 11 06:20:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Calvin Johnson X-Patchwork-Id: 12130363 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.0 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=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A952C433DB for ; Thu, 11 Mar 2021 06:25:37 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 9A77661583 for ; Thu, 11 Mar 2021 06:25:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9A77661583 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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=tfKXb8FVvo8l1oEfXbwcDMjVKIShYWIPq4wHZ0G7M2k=; b=pHt1f4W0hL7IP0Jby8iEtAH0o NGzHKZ5T+aIfj/V7y1b8pzJPkgaeCr4tWAlJy92XRsB5piWEcxrpy3LzG0UApWdujpZgLJyW2uR+U Dl/ZS+k/smpeBWywWRu3dq9R9GZ9TcPIyk/0JybBl1LQPXlW5WVs6da6DMrImw1V+ojjVLVC81jfF DedxYMPsE6z6mJP2mJJ7cuokBUgHEzb/mFUhdAI3/N1mWlVxkJzCNRH/0teSBr0utykd2YU5TdNBI JHucaf8L6mFm/SxinHbYs9Q/NEaIKt9oGxmN8nsUMn+l9bTPtUSx4UUAN528K38MArmUl17qYImvu /0f972+tw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lKEhr-008SYd-W4; Thu, 11 Mar 2021 06:22:00 +0000 Received: from mail-eopbgr50063.outbound.protection.outlook.com ([40.107.5.63] helo=EUR03-VE1-obe.outbound.protection.outlook.com) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lKEhO-008SOp-HB for linux-arm-kernel@lists.infradead.org; Thu, 11 Mar 2021 06:21:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fxwmEyvZn4xfoIzKr86eTES8d06eeKFExu1+B2+iSVFxTOhJP7AxbKrEnuZSEk9bFW7mssdvp8LG3moRv9rh+//clbPJrzSy4dAzzz/xz7YlSQWwitUunnRB+kJ9eoicK7AUiIdKW2rYGTTn396mEM4A/z+VJRGnwqvNGBqqsGyc4idkEWrApuik/IlJt7r1z7TH+o0P/4n5VEWHH8radWlzUXAv6d9KgQSjIA8L4ZWzY7DsBwiazEltR27rYh7DtMA0/5M2wCKqEJjY8AcrN68z1TzfqmMZGQK8m6LIoKqa3/ZBEY8S1MeWZAAfmST70JLwAIFhU44RuFYU1pCEug== 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=un4R9JdbKhqc6uwju51tCK1kzB2hi4fAlPAvZdr+0KU=; b=XuF55AHuulYJDuYRcaBS2LqE9nDQUuXApbd7ZqL+nHIhRnI2GHevDbVlFjyttwV3nYZhyYhrnaQqRw6wC1/5RdPX7Vnvo08bv+/phTfwt31Bfz1CAXCggS76Hi3bGyPFDamiSEakdde3KKF79YnoH/L5GKuUZPGE80bjS8KGZBSCWvjmGKIMbNnBICrbIRQRVSOlgUTsWcA1gEOeyG94FRM/ErGszeHJYKh1MDhK77X5VI4ucE2kRe4rs4OA266RtVOd2cJY7/q5N3K//D6qnMn0r1VJYucewLz1R79p21UnTtmcY2vhBdYZE0dKlsw5kIDZqkTq/HAPCjheeHllyQ== 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=un4R9JdbKhqc6uwju51tCK1kzB2hi4fAlPAvZdr+0KU=; b=IxWVW6y0sxWXuCumzjb9kH3LVBtcgki+MEpMHjyUXeapclCDmHP5zXuyJtLWp8QImnh+OyAezLaInB5TcfKgu0lW/jXIcqDIE9S/EZiRtIaWW5p2+3SvBmr6phos6ocvAY43T4kqRqtIkJTT2Do0yr652kLOJQ8/oU+v+QP4a10= 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 AM0PR0402MB3442.eurprd04.prod.outlook.com (2603:10a6:208:21::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.27; Thu, 11 Mar 2021 06:21:28 +0000 Received: from AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::1cd:7101:5570:cd79]) by AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::1cd:7101:5570:cd79%7]) with mapi id 15.20.3912.027; Thu, 11 Mar 2021 06:21:28 +0000 From: Calvin Johnson To: Grant Likely , "Rafael J . Wysocki" , Jeremy Linton , Andrew Lunn , Andy Shevchenko , Florian Fainelli , Russell King - ARM Linux admin , Cristi Sovaiala , Florin Laurentiu Chiculita , Ioana Ciornei , Madalin Bucur , Heikki Krogerus , Marcin Wojtas , Pieter Jansen Van Vuuren , Jon , Saravana Kannan , Randy Dunlap Cc: linux-arm-kernel@lists.infradead.org, Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux.cj@gmail.com, netdev@vger.kernel.org, Laurentiu Tudor , Calvin Johnson , "David S. Miller" , Heiner Kallweit , Jakub Kicinski Subject: [net-next PATCH v7 05/16] net: phy: Introduce fwnode_get_phy_id() Date: Thu, 11 Mar 2021 11:50:00 +0530 Message-Id: <20210311062011.8054-6-calvin.johnson@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210311062011.8054-1-calvin.johnson@oss.nxp.com> References: <20210311062011.8054-1-calvin.johnson@oss.nxp.com> X-Originating-IP: [14.142.151.118] X-ClientProxiedBy: HKAPR03CA0026.apcprd03.prod.outlook.com (2603:1096:203:c9::13) 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 HKAPR03CA0026.apcprd03.prod.outlook.com (2603:1096:203:c9::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.9 via Frontend Transport; Thu, 11 Mar 2021 06:21:19 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: a4502523-694c-4fc9-0197-08d8e455e74d X-MS-TrafficTypeDiagnostic: AM0PR0402MB3442: 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: NJp02gUTeriC1VC8D6YOhP1i28rNkheiM2aq+PYLdAakJbUdCCEccnyv9SpiCWapgelCbkXGwhAKxLPoLeew5MVcHuET8PSA/CtGTMaOtkNSWTZefJEKbd7ADqXDiBY4Y+RsaGwrZ9iiWxO3bi1CZmlLXbba5ZHickJSseaokh+yuHzrEXmwlynVlFwfrxvHoCV2UY0huDoZCR1XzQvWyQWSgWfTxIbNOh5BQ7+QZMnwfxbQxnTabhBfeo6wevv5txUI4Kv19VpmPgZ2w5lTpslZadayeJlEC0/AP0ahDXzLKzeU6c4IfwfXT6H4b8KaTkLsu3N8tVNLR770KzmlTXygLlfUVp0ITijTOg3kr7sSgksra1SuFOkVyYKHbfBaIkOnfIt8LxfxA2wJNQCKw65cNB3DXgmZVFh0ajIchG537lwrVxmas+Y8zj7VHPbwdi3yoZs0/ygMQup6SS3MCMF6rLkc8c5SV0qgrBrhqs55TsFrNwQgX6wwUAxyUiknmVDcE/obrTjmlUWm0y2049r4trcGf88M7HJvsudUFRKYE14kqHQSbYVHW/JCOCSuvKRAYPG7j9b+Yq1EbTo75wRkGgPhtFbR9Egp3ziJ52Q= 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)(39860400002)(366004)(376002)(136003)(346002)(396003)(6512007)(2906002)(7416002)(8676002)(6486002)(2616005)(186003)(6506007)(86362001)(26005)(921005)(110136005)(16526019)(956004)(55236004)(316002)(66556008)(44832011)(66476007)(8936002)(1006002)(4326008)(1076003)(6666004)(66946007)(478600001)(52116002)(54906003)(5660300002)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: nzvWrD8+qVI99h7iEomCvmYK/qXqMOamALkKu6beXYxvkKpCDhaDtXOy5p1qiJynGKPKQ5ZdOuTP68TI8gtDB6YlGHg8NvGwQv3BpZfDjYIB9BOf0eN6rQ4C+97kqkpWM60drC1VhQWcU+026vibImSvRl7o0JUt3c1yGR0y5rmfXjzkYp1ForN2MTYkGN9xKO/UuuYNRmTaCDvVsy/jz8sh80GrpRI31JMabCl/jdGzvWWvI7S3Ma+EK5H+BFCsMvfoju5HHg781ueKRIl6QkfLkzR0i/gMkvRPtANQ40JJCqFF/Dnm+NTg7gcODdGY3UdiYLBQLwImKiVg1vA8pJGJfZD5AKAii9sxwkB6eDnSz9/jEAIICVfPwzCrUpWl+fLc/PV3oo77O/51IvUdp9W7x1nTzHa2Y7e3SYRspDesYdE5jsFRsL78E9O5NKy6BLVte2PnTagAr2zYdIs6pagNKZZPwG3KXeLFGQl+T9J+HOWY9LDigu0AchKBfONil3yXIPxwoToU7SfkDjagXXy8NhAbKY3f+blYgzbRYZSLXgE7KcihQbiJpCydPnL3gPqg83zbxoncbZUWmznj7JWUivxzmtUHT9hBzPbb2z+QhwmoiWDXw7ouz0jK6IDLIC5aWOloIEf1OHN6EbBX4jwtDP69hPT85uX+bOTLXW7jUK6Bk2dGK+zDjOdXV+0A35sDTpn5CKTD57i4ITDFetZpU2HegCqa5fida9URkk7w0GisH87d+zh2Tov/GGxeCnyehsw3O2Hp7fHuW1JHSAHmdIPoj8T7BbbPkAUFAfs8Z9/sktJivMI2cAYORwT33Z21ayluVX9EAbvQW7V2SCx1xWVhTjtqJsTyVRbITMwvlsXy9hGA0G33vsIEym5r4VUK2216HlRn9QLk66StmdtnqsyOya2ljzsDxYkIzC6Dlo6lSh6bilfEPQDOUX4VLK4WB/zIGF38cwOCeE6A4TBnIPi9+/R1/vR2CZEsh/jTrQ82j33bW0weqorifKlRWcq0BAopZwgbQuKEl1TSc6paZF9NbXvabRskjYBdntlI1LDrAGiCkDgT3hJHE4RaZZ2zsA/ca22jJjSN7l6cXxgbf7qYKedbtpKNN9ZzEC3ZhzpXexQNAo3JcIvAvMBQPwoyCh0jidnpiLqFk0ljlaPQzUb8aHJJoeecqgPTaVuExawP4vIeJxMXbyVpQ/aNBtQgnbR9C+ZAv1tJINcH0KALz+0syTwifbTp93Oq5WRHOBnKjsjef1ucQgtv2eDEMfN+T2LnIt7KHLmgbTog7zY2QoBiw5/Opd4k20kZJpttXkod4vALs7Kcwml8zmGs X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a4502523-694c-4fc9-0197-08d8e455e74d X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5636.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2021 06:21:28.0519 (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: y+rX6NmPlXrrqKfY8A+yg9EyX6QjKU3ySYfafqJyT5KBjhY4voMX4dIvhPXFRJj5DWzQdctpKOYx/TInnB3K8g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0402MB3442 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210311_062130_694855_FF2ACE7C X-CRM114-Status: GOOD ( 14.52 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 v7: None Changes in v6: None 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 aec8dadf5d8b..f875efe7b4d1 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -817,6 +817,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 720a2a8cf355..4b004a65762e 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -1366,6 +1366,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); @@ -1374,6 +1375,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 Thu Mar 11 06:20:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Calvin Johnson X-Patchwork-Id: 12130365 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.0 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 68029C433DB for ; Thu, 11 Mar 2021 06:25:49 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 BE09261583 for ; Thu, 11 Mar 2021 06:25:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BE09261583 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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=0Oq+3ZqhtzExty6UomMfhJdkEIxWUqmeWhIoTLDsiy4=; b=G+Z1ZiorOMO/frbpfU7AK2e6f Ki9FB8Lp6aUQGuYQPg7t+2R/WIGjav93SAuDsDoNCWv57tGh+tel0E2tZOeK7DU52d+k6zDEi7Sum mSsNOUhgLY7b3Rk3iGGOST0jpeN47jw59wssWQNk8fetXzR9thgmZcYPdUZahj9ti18+cyitLvCVZ VVmhzRPLIr7iqdH5LLTdS4JFHDInzzwWDW46gF1tnt6Hzd3VfdklE5qUla4ncGQB2NCVt4WSYoxw3 GLlBZXEMDDkK3faC0E8B3Ms1mH74jJxMcDciSKwrxwXEo9yFNvrpRcdr1tRX1KE5255aY7DcHmFRm am5woKt9Q==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lKEi6-008Sdj-TF; Thu, 11 Mar 2021 06:22:15 +0000 Received: from mail-eopbgr20088.outbound.protection.outlook.com ([40.107.2.88] helo=EUR02-VE1-obe.outbound.protection.outlook.com) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lKEhX-008SR3-Je for linux-arm-kernel@lists.infradead.org; Thu, 11 Mar 2021 06:21:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=d0HM++Priq53qKfKx5egXjGPwuAW3H6ZFfcjkiZwTZMS39Esue26sF09WYZqcFr0htnLmfojI2+hK/gsvIq77oF1kAGjU0jq0ZDHw+6MOXbyjRK75joWFARNR2wtAZsLScxjY3QxEJ0AvbymGtTyIHsrdD5IuktYCcj7qMVP4VIax5/RCOwsjB6Rpfzodha6OAJrgX2+fw6KMit1mT6Z0k21UQJ2whgv8kugPEoz891ozdUn3JMimFay4cchAVO/Gh7DLcMkp4DIeL9ksGksL035FGbuURPY/eyKxVARKYXEVh8b//7cFA+CljPkDsUZoEY1YEV6gHDv1WmtZTO3IA== 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=W0KWhdwt0sthDqdeYS6b4CVL/hdN8E9qrYOFcNUqUXI=; b=iPhF/bCKlAQIbmo5PJbIkHYzzHknDO1lVkNKjZrX7yYP9OMjKz3OIIBXj9WVmWFJuQdGsB4c/OgBmtv1mz0N8FztbtD7pRLq81tn1esyjuQiAHFCtLpOSVE9KK515J3ysU09eF2Ob7KVblkkp52CkhlERthbz777TwtlazPBoeoQjjUrhaaQzO7TNx2s4SyGsYuyJ6R7NePO/Qt5QCv/WB/lKEHp3mVrHgw0sMfcY+mkjc3ibExcq2sl3cgZD56AC/skT8zXI6SaDOcmf0y/8AiIbQRZpOiKPoss58Pj+3pO9L3IuTSf8dqgxSIUJr9wRTO8SMChtA9QF3+65moAQg== 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=W0KWhdwt0sthDqdeYS6b4CVL/hdN8E9qrYOFcNUqUXI=; b=FVEkRcHoCqTkTgX6GQOc6f0s6ygU0k9ZVQowNHjraa4OCGTb8u8vVeYre6+0nTZ0J1Z5tUKbFvsrzQkDSMesFS2b+NcGTcFMnOW7Jrp0kQEwTKRD55sRvh2nTdCV6hnUZ3Cxklrnm5CPPocCqgh+8cnu13Ex4M+B/Z5inwtj9f4= 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 AM0PR04MB6611.eurprd04.prod.outlook.com (2603:10a6:208:176::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17; Thu, 11 Mar 2021 06:21:37 +0000 Received: from AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::1cd:7101:5570:cd79]) by AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::1cd:7101:5570:cd79%7]) with mapi id 15.20.3912.027; Thu, 11 Mar 2021 06:21:37 +0000 From: Calvin Johnson To: Grant Likely , "Rafael J . Wysocki" , Jeremy Linton , Andrew Lunn , Andy Shevchenko , Florian Fainelli , Russell King - ARM Linux admin , Cristi Sovaiala , Florin Laurentiu Chiculita , Ioana Ciornei , Madalin Bucur , Heikki Krogerus , Marcin Wojtas , Pieter Jansen Van Vuuren , Jon , Saravana Kannan , Randy Dunlap Cc: linux-arm-kernel@lists.infradead.org, Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux.cj@gmail.com, netdev@vger.kernel.org, Laurentiu Tudor , Calvin Johnson , "David S. Miller" , Heiner Kallweit , Jakub Kicinski Subject: [net-next PATCH v7 06/16] of: mdio: Refactor of_get_phy_id() Date: Thu, 11 Mar 2021 11:50:01 +0530 Message-Id: <20210311062011.8054-7-calvin.johnson@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210311062011.8054-1-calvin.johnson@oss.nxp.com> References: <20210311062011.8054-1-calvin.johnson@oss.nxp.com> X-Originating-IP: [14.142.151.118] X-ClientProxiedBy: HKAPR03CA0026.apcprd03.prod.outlook.com (2603:1096:203:c9::13) 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 HKAPR03CA0026.apcprd03.prod.outlook.com (2603:1096:203:c9::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.9 via Frontend Transport; Thu, 11 Mar 2021 06:21:28 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: ee156e07-81ec-4e28-f7e9-08d8e455eca2 X-MS-TrafficTypeDiagnostic: AM0PR04MB6611: 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: rqUskRW6r+LgN3wsSyCuBrK4SQSdAP3pZQlMXdTWfX1V9us4b8dFBtYKaIHvAauTMpqSOhaMpN8DBNW+rOKJmWrk/1weyTjeId8SEc1ozJ3zWIN2L/3JpESiYak6oNkC23V27wSXvB3XpmSg00yssssu0HjvQEusuJz2PAqduypTTYZ3kREgzKA7dz5H1Oh4qPU+JcTzmN8pGv801+HqpEXmXEeYjpzEY6q7jIVbSkqw6a+IQKP/0Nkm7r0WRTfL1OTLbqqkOp66xLdaul4VNNM4bxM39DOoGMyzwBzkMyDFpmaxRiqZqGAIqZ+HNNy2XQrH8Otc7O6TBfZrU8cQ4+0K48VH0XrnsvImvhxKFFNb46s//gMBwrsbYT9a1258w8OtxoKtnflk2+dY1eEA5Vn9rtr5QalDeAsm2nEO/hnGtqpXeV5kgiMQj3e1Z0UB+qrCSbRlnXOp0LvzI/HTPKCjDcvAw9Im45CuK0JWM+glc1Yz1jLMiGTiDqVAu43DDP6brmTPpDEd2sYcYCu98i890Q12YIIow8ZFIMY5lrWayP9/Y7/jipfNJNDN9u7lg0mJ59cgkL/9K+hpTU5ciw== 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)(39860400002)(396003)(376002)(366004)(346002)(2906002)(921005)(16526019)(26005)(186003)(83380400001)(6486002)(8936002)(6506007)(66556008)(66946007)(55236004)(66476007)(44832011)(478600001)(6512007)(2616005)(316002)(54906003)(5660300002)(956004)(1006002)(52116002)(8676002)(6666004)(110136005)(86362001)(4326008)(7416002)(1076003)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: /HydlZAAdanJKqHkuBKTsk3CpJ0Y2ojF7AxXeV2rpBfoZAKNTbk8m/3KUXuYUMff+JqTadQRHtx4c+7U+mUX56pbFFEJkDbUtRUMvfrzBa7nMRMQAnSkPl/nWSlmvePJfLXAm/DCa4IcYHB4NNKrXjb9BLTqJZHkJ0IhA97DunhumjDbDkk9EcM/RLWdVBoZhLZyH0fANpCKU1lHhP0Nzxrq1/iSNg6k3qs5uPu520PgVOKBJvS5128gSs3GxE0jSl/s0XgH4lX9BStkZKZ3ekv4BxioUcNGaDhaHS0XJ2/M7wnvvrpPs17ulJqOZNUEjo7ym7f5Ai6syaUACVj8ynTnCiMV61nZc1nYfdqrCzgxUSOBOdATOaDvqFTokSt4fZT0ZQIevmIdGf8LsQiD8mVbhwVUZgprFl1hXxprW3cq2VLfkxZJ/pQHyCOPOs8m74oNBjYhyVOXB6ksb6q/1sP81a+Zg4NFLOEVMYn8lHTqdQHIoVrscnon2RVaZcaLIo1yaBCabPmAjbkYbe7PH8a8UHu3mnKoz6kIjNOR/uFpstyoa9nz081o3d5m1w4mdeV4uXbpwrm2MItL2SgppOKQ5UO8iWQlax5XqLds53WemCECtjtgKpK4TsceBTf6rGjazQTmD+310HwEr7iYgTzFBk9/hSJhWv91lG09NadO/wWRXVTZCpxgGw0ObAOPxgubYGxz8a7Id/fmzOsW6aL1bourDmalNPMo0MVV/qhwef4UWdMFUZmUneOjnFNC6EuTnCbS6NLO4BO1fUJ5hYNSl1fQLUZzMXMwwBTm1K9yxJU7U/WMNUGH65ZKOKGR4yCVOMUWYWeN+8iO4S1satjjexbmRhmBZ/0gskuQLciyBE5QICN9qSJRGpUcVl96qpgE1/9nyzuTGHtCBqMfkScQ3Vl6HcLqsUFB027ZTyQVc+uhtwI491/n4J5Bi8mzi74u9qvHTYLb43dIUMvQeccHN7w9L/zZ6c2IrW/xq1/BYgry2u/Mrg4cvnIzQOCzZ5YfY8g6KrRf49MOvztO1DJy8P1jKhXyG+xfaJrYb3+viIQKdqFChK5FJ16NItCVlO1FIkYXFauumCwAfcUyss8JBnC35rEO5TxUFS9Qf9b1yrjZBXZW/j1/J0lohtU+IzW5iIESI98GGEENAabAa1OiRrmHMpSpIkWbfsXlmO7QYXvmF4mJ/TzqsUzGkESpRdYwWL3LdxT4McYNEcZ/2MERaYfy0vRB+7ea2/0b1AT7VWvwC/8BEszeNt+cGKT1bltdf062GpqNBI03ZKlM9P6QguFdf4lHmPvQj/Odwt8rXG7HFs1blADDTmieB411 X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ee156e07-81ec-4e28-f7e9-08d8e455eca2 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5636.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2021 06:21:37.0129 (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: VmNE6TNf6fwt27heJwareYRU2IBsX2YhAhaINgBlZhuucADF0l2Dy468o3bJ5+disWWuJGYyifTavOhkH6uF6w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6611 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210311_062140_009443_59B1B7B1 X-CRM114-Status: GOOD ( 12.24 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 v7: None Changes in v6: None 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 b5e0b5b22f1a..612a37970f14 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 Thu Mar 11 06:20:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Calvin Johnson X-Patchwork-Id: 12130367 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.0 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=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8E39DC433E0 for ; Thu, 11 Mar 2021 06:26:33 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 CC37861583 for ; Thu, 11 Mar 2021 06:26:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CC37861583 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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=0w8WixeaMhJeLJrQeSouG4GLUOy77luWmhymWQffiGU=; b=jG9B6eaWggR8WCjSKOEOgCv8b Evebs9YiiB51S44ZxUbSlrI7smZexL0tL+keB2YkfisaVkqR2H0FzMTP4N05ZMDuPL0OQcqX0bFMC 3AR1h2koSNb2kKbBvCJY9JiFNB/+t73sp/BA3O5U/gsIa9Eygp3hAv2dnoJi8mEM5fTgaFH4Xt5Rc h9aXIIhrQN9G2oBJsTb3gXRXvsmREBzyOjdLpkGn3KfqP6+SWh4Vm+3yzyTn1V8S4W6vZNpFvDFcp x26jPLexds4+LpXo0srgM2fPKOM3TdeqyvE3t3TpR1pLrZn4X46+laa1XXr9uVKgrGrsIY3hgHfYo LaPlxPBrw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lKEif-008Ssw-Bf; Thu, 11 Mar 2021 06:22:49 +0000 Received: from mail-eopbgr20040.outbound.protection.outlook.com ([40.107.2.40] helo=EUR02-VE1-obe.outbound.protection.outlook.com) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lKEhg-008SUg-51 for linux-arm-kernel@lists.infradead.org; Thu, 11 Mar 2021 06:21:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jK2NXiEmbBbc943eAgOt+mOFt6E7dWqqkck3+vzd/pzlpZzZrMHwOF2WA2IBepty1Z18EdWBXwu086WqqmL5EAJQcwGMAss0pVxSV8XHeUDjWCmHCfJikMP87l/7jInol6QaFLN9Wd9Xiq20Q2voAylpWw/2SVzDeH+2lIc1SZ3izBNt6ATwwxlsPpBdeteeEN5M4z7IPAMxtX+E+pjmS5ON9r1gIhYcif2IOWPH4aTQJN+qEWefLz29gsRphj+caZ+OmgLAFak/kOrP/qQyAyDaQUv4sDYBw9boQjiT70lPFql9GQ7nr8mEnYbmP8usJAU9OO7sZQxgl0QTcw++5g== 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=a+8NwrK/szoll8K5Y2CAeAVgyQAQMY4RtCeOpAOwO38=; b=Lrnux/8FMJcEy/abXpw29RgTtFBH9X+D1Pqu93ID0TZ7W6y0hrKHen6lmLJektWZdAosqfP5+VVidsfoov5v4p8m5SjtRrz6S4umD7qGfeMRDgeJpDwYWC14lb8RDL50ZOcplc4Tmf94o3+ud4lSjLuNcVT6RVlmXODBYk7i3SrGWaO6HIcwlIlJubS1WNVS6E6zqQjJtgV3f5Nj4YLvuxsReHip0tyAWiCVsBehiyGhHwa20haKAcWJGEncxDBeLTQEixjWa6BeAme5ZXY7jqwiXypPw/X5qwFgRnrUr0U5sh8DBMujO5k5awHWB4MgMywwm26VJbALZwhJShD85A== 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=a+8NwrK/szoll8K5Y2CAeAVgyQAQMY4RtCeOpAOwO38=; b=Orrst5+z7qo3AKiqkZFa3OMl6S7hPOPY5lIlpf6wczqpz6IB+HsVqH83g+DY9vHPl+Sobo6oHhABBpGJTPsJNHbpDKiPBTGr8nvqQ6J06rit65AmSrXvtyMVnHkXbpk81u4YZ+qN2U1mpxySwZw2TQ7AUf3263zeM3b1kN5hMdg= 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 AM0PR04MB6611.eurprd04.prod.outlook.com (2603:10a6:208:176::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17; Thu, 11 Mar 2021 06:21:46 +0000 Received: from AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::1cd:7101:5570:cd79]) by AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::1cd:7101:5570:cd79%7]) with mapi id 15.20.3912.027; Thu, 11 Mar 2021 06:21:46 +0000 From: Calvin Johnson To: Grant Likely , "Rafael J . Wysocki" , Jeremy Linton , Andrew Lunn , Andy Shevchenko , Florian Fainelli , Russell King - ARM Linux admin , Cristi Sovaiala , Florin Laurentiu Chiculita , Ioana Ciornei , Madalin Bucur , Heikki Krogerus , Marcin Wojtas , Pieter Jansen Van Vuuren , Jon , Saravana Kannan , Randy Dunlap Cc: linux-arm-kernel@lists.infradead.org, Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux.cj@gmail.com, netdev@vger.kernel.org, Laurentiu Tudor , Calvin Johnson , "David S. Miller" , Heiner Kallweit , Jakub Kicinski Subject: [net-next PATCH v7 07/16] net: mii_timestamper: check NULL in unregister_mii_timestamper() Date: Thu, 11 Mar 2021 11:50:02 +0530 Message-Id: <20210311062011.8054-8-calvin.johnson@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210311062011.8054-1-calvin.johnson@oss.nxp.com> References: <20210311062011.8054-1-calvin.johnson@oss.nxp.com> X-Originating-IP: [14.142.151.118] X-ClientProxiedBy: HKAPR03CA0026.apcprd03.prod.outlook.com (2603:1096:203:c9::13) 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 HKAPR03CA0026.apcprd03.prod.outlook.com (2603:1096:203:c9::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.9 via Frontend Transport; Thu, 11 Mar 2021 06:21:37 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 5cde01ac-0ce0-4067-1026-08d8e455f204 X-MS-TrafficTypeDiagnostic: AM0PR04MB6611: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1091; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NfG0GbLAYsIXaATvTuYwEdEflNXYT+F0p875XSu0yTHJLe6ekRvnF9UCv+guFd2h3k37Rm/8tq8gK/885dENxJnChoXo4lQtFuZ7VJlulCBeD7jn8VMxAqbTWoUUyo11K5EqqENg9Xp1a/8hf+EaCMAhpJiTY1wyPH5nDdB5lAxsI3oNAxGpwZOZ8GUwBilx0x1qmmu9WuzAU3uQr/jVvhohj+s9khZm2V35SEUc2STSEDiiXEDqnUiMPTKfb6Z/rv2Pc4UD33wmQxFcmHb3jlZaIa/7OUNPMw+r6mePR+OrsDjkBHO1SHc646FfMBOD3y63yHnmYzxPtSpmwr+O/XL169HUnaCmGnqsADFbqmXZjy/BiRJ8L2fv5iz1/PENWq/PF2cJc83Y9tMcewtFzluY+cte1fhGfQdG+MOZ/tE+PTGIeHAnEhHM42C4Lqq6OsU6bG3y/8FEBFZL+evofWyiYZTc40jBrcRqPk22SZC3vRJq7I2apk9eFkbU9A4I2j1Mcv1Cdaid6ogwXjIw5moiK8mpkC4frARtMckeDfSkQTisITo/vuAJ1uVBsl2Ider4jXEIRat9Kilgi822MQ== 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)(39860400002)(396003)(376002)(366004)(346002)(2906002)(921005)(16526019)(26005)(186003)(83380400001)(6486002)(8936002)(6506007)(66556008)(66946007)(55236004)(66476007)(44832011)(478600001)(6512007)(2616005)(316002)(54906003)(5660300002)(956004)(1006002)(52116002)(8676002)(6666004)(110136005)(86362001)(4326008)(7416002)(1076003)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 4YrwtBzItUaS3Eq1SfR1FmY4L9NVjh7xRAxd/RZTUBli2CCiK2rvrkTm6EVskOc6xpfUB1/B9wKbsTabKlAQBV56zP0189Hd8ZUj0x6DH47Sj3Wyb5UbrE9owyJiPNXCgfriY7MlIS0v+Q9Ed7xifbVylKdjAG6yo9TLEergFuOsu/C1TcGhBwuy9o0BF89RWIELPMGMvZR9vgPWBsi5c/kRZBXYlo8SG/9m68KUDH2yg1P7+rRpayG2CjtcEp57BspEO98E/3DbuI26Ck8NICJPDFuBnB5Qgs8HCHdUb1UV9Rgenw1ZqGXvqYVDhfC0VAzvIlXwc17h+HGxKOInMc9haAwNL/TSwwEh064VnXzOOWl6keG6EIke904qF6jylmG8oCUuV/oPR+k9DtDIsswDwuCIF/e0cLqGi33M7R7EanQAvshq+Bi2hsLLUzlFiaCXx25B/EHl4UeonlUe9Rory/LNu0tBF2fX/YreoxPkjCQ4qPHFgn8XXUDvdjdJlYQuQp+3DSrh484IP2I7hkVInqNpcyN97CHsG/yhNhCuhdObdx1nRMBv+Gj2q6TrqDnYGvgnmFoDY+0U2yS4m6rtU+OdvzsOtjYgnQQXk3D9i2Ne8F6B66fiuY/K0cUbYZ6TfpY90+g6MuvX5Mi0O+ANwTnG7BcL/ztmZTN3qsFCb5CnZn2Jhna72PIvHcyLaitdUqnD/zyIsRsJTVfhlDHfhm6FDszarKrn3w+ivs8wMgl9NB0NT0D4l/wrLk/VM7rTt2V1pFOtiLzPsNVgS8Av3qRf4t2PryoNNrfhPBEviJRW0oEbVD66YH9sD5/LBQfuuOZTNHgVsk17OA6+ObSv6ZID/o+pjRgs1qoP6fhnNek0skDS+41Ar00pXAZwBi+q4rKYd+tM+r9Tho/R5VAbRJs0s+rAK6Dg3Q/rPOr9azy5W35hiyJVbR4/94wDod8AI81nxAc1UnLxT83k6+Jcqcga8B7xSRvtjUlGvnJCHw2nHwa35GWXnWF04J4rdPzz2Nk3+GhOzplJ597KOdRnwKAY++q7uLKHSUDYOhJIro4I1tzQs3gN+OWrL+O8Vakk8KaHjpGa90Xc4vFolBNKNk1CpvOnZQRJimB6x4LkUgs4UD4hjbKRMoycpx/S9+VjpU72sUIj8HjluOgSVWGW3QDj6sKhha7EabRacLNKo09sFz89V0IIdJl5xurAf8gE5N3qm3/YdJMHVcUflI8JNxhWdqwcH82JErvzUgDQU8Wg2MSdp9kl2XWt8gNywwU+hQdLFJlV98VHZJWX6yLo8Q5SuGbcOd8NB6x7mBmUNI0n2tHg/7fFixmRPNFM X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5cde01ac-0ce0-4067-1026-08d8e455f204 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5636.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2021 06:21:45.9139 (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: fXhT/Eb8aafcKs9FBrF2a72Uyq+1shazAfqgEYqA2WKE5bH9e9G0do94hTe8j1cx4o50JMd+0WhsuwwCdKreXw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6611 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210311_062148_377202_C5E0BF53 X-CRM114-Status: GOOD ( 14.97 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Callers of unregister_mii_timestamper() currently check for NULL value of mii_ts before calling it. Place the NULL check inside unregister_mii_timestamper() and update the callers accordingly. Signed-off-by: Calvin Johnson Reviewed-by: Andy Shevchenko --- Changes in v7: - check NULL in unregister_mii_timestamper() Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None drivers/net/mdio/of_mdio.c | 6 ++---- drivers/net/phy/mii_timestamper.c | 3 +++ drivers/net/phy/phy_device.c | 3 +-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/mdio/of_mdio.c b/drivers/net/mdio/of_mdio.c index 612a37970f14..48b6b8458c17 100644 --- a/drivers/net/mdio/of_mdio.c +++ b/drivers/net/mdio/of_mdio.c @@ -115,15 +115,13 @@ static int of_mdiobus_register_phy(struct mii_bus *mdio, else phy = get_phy_device(mdio, addr, is_c45); if (IS_ERR(phy)) { - if (mii_ts) - unregister_mii_timestamper(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); + unregister_mii_timestamper(mii_ts); phy_device_free(phy); return rc; } diff --git a/drivers/net/phy/mii_timestamper.c b/drivers/net/phy/mii_timestamper.c index b71b7456462d..51ae0593a04f 100644 --- a/drivers/net/phy/mii_timestamper.c +++ b/drivers/net/phy/mii_timestamper.c @@ -111,6 +111,9 @@ void unregister_mii_timestamper(struct mii_timestamper *mii_ts) struct mii_timestamping_desc *desc; struct list_head *this; + if (!mii_ts) + return; + /* mii_timestamper statically registered by the PHY driver won't use the * register_mii_timestamper() and thus don't have ->device set. Don't * try to unregister these. diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index f875efe7b4d1..9c5127405d91 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -928,8 +928,7 @@ EXPORT_SYMBOL(phy_device_register); */ void phy_device_remove(struct phy_device *phydev) { - if (phydev->mii_ts) - unregister_mii_timestamper(phydev->mii_ts); + unregister_mii_timestamper(phydev->mii_ts); device_del(&phydev->mdio.dev); From patchwork Thu Mar 11 06:20:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Calvin Johnson X-Patchwork-Id: 12130443 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.0 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=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 980C8C433DB for ; Thu, 11 Mar 2021 06:27:07 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 EA20064F47 for ; Thu, 11 Mar 2021 06:27:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EA20064F47 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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=AjTiu8O/sOtaNhaEt/o7/DMxUb82Bp+BemHkpW5bBmc=; b=QJ3eMhCyfvqPRq9na3G+BQ6xy UhuVzZym3HSHXMghTrvH2Awwih5bc6sngLAiX0b5pl25w1yN8WEktWmfrPJHM8cwn6TtQBQsx8dnt +mj945xqRGcI7bk81tRCqVEnWGb8coaMM+Mg+0tPXVrY3bzDPuIYF44WiBaoSarNKTAgFmn0czVOS Zv5NiNr628B90Qfdsoi7H7zSO/VFHA7A1e1iK75obf+hjooCxJ3I4QqowMiW2IjgGqeAVsHzhQjOb B/GWpcJ8wM7mwEeOPmnmsMBmpyE3l10vmGZVl1rcl0bqHnTv4ADJbYeVVDSf7KXKcyEGTBNYpzbNA 0yq4zbp0Q==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lKEj5-008T7D-Ut; Thu, 11 Mar 2021 06:23:16 +0000 Received: from mail-eopbgr20046.outbound.protection.outlook.com ([40.107.2.46] helo=EUR02-VE1-obe.outbound.protection.outlook.com) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lKEhq-008SYL-8B for linux-arm-kernel@lists.infradead.org; Thu, 11 Mar 2021 06:22:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nR4FCE8hqKtm4mvO+vXAywoS8yxrMA6bVblDnhegRVtZ3ZuaBL+1/QL4k2wCb/YZxD4wXULb9J4Wrj19D4AVca0LNfCUqm3nwohfK/Z1EyODGJj3Xg7SPViM026Foeog41dO6Yqd5kK0qCloPV+/hDIKAFS40wXBvFMC6fVo1xxCKYMdqtBQuVHlG4WtvWDKB9cFGnNm1lQ3ksBGtWoEc/9wg7/xuk2i/GRpSJ8SZHhZka1mz11Dx/YhU3+ATIPmWMyTlfgBQO9RWTPPZnuq2csApUaluuii/hZq6Vu3gHIz/pTlLlQtj95IArXJ6RVusosAfanSdlUhbj1ENZj7zw== 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=gHgD1m43jOEfkZjcvOtBymrbTr+Wedda505cNjBA9y0=; b=F/jywN9SFdwZzgS3FHkSXL+EKCVcwc4aC7t9g3iYS6jnSiISuNwUWQ0Xfu4y5BXaoGfTtUU8SB8kQ34bleW/4Ph2dxQjg6o+KM7t7bvmQ17Zy0hJUMzVJpCmHG9PHV7XMxG+S03as1bhmaFAHRp7zybTgHRXRLcAPYBwz+8sx5N68WAwWqkPfNDztH1KlTLi/2PmfgzjoXO70m3X+aPxCBAVHAMaBrPORCHfJXzBhDmuEVGGybW9ij1pXatqWPtc8utohHzHgA9eHO3/JSYvaqPfjnaC7Dkh7FjZ/enIkyyDXkj4maGB6Mt9D3g9Op5bb0o+q+DyA4YDlwb3aeZJag== 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=gHgD1m43jOEfkZjcvOtBymrbTr+Wedda505cNjBA9y0=; b=HQrYYVhZYU4fqPDwR/EjpGViMgWarwoFoiwdEaEl1meiLbMHEOVDGhfBK3vJhBVRLRfXJH68RNM6HvhX5S1XcF1e173BOsxbqUuGy3OA+Xv86/S+tuF7E8fOrErsJPJ56xXsY1ofgsnn8Ec7E788EA6nWSAlCTjlGrWN99nEuDc= 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 AM0PR04MB6611.eurprd04.prod.outlook.com (2603:10a6:208:176::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17; Thu, 11 Mar 2021 06:21:56 +0000 Received: from AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::1cd:7101:5570:cd79]) by AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::1cd:7101:5570:cd79%7]) with mapi id 15.20.3912.027; Thu, 11 Mar 2021 06:21:56 +0000 From: Calvin Johnson To: Grant Likely , "Rafael J . Wysocki" , Jeremy Linton , Andrew Lunn , Andy Shevchenko , Florian Fainelli , Russell King - ARM Linux admin , Cristi Sovaiala , Florin Laurentiu Chiculita , Ioana Ciornei , Madalin Bucur , Heikki Krogerus , Marcin Wojtas , Pieter Jansen Van Vuuren , Jon , Saravana Kannan , Randy Dunlap Cc: linux-arm-kernel@lists.infradead.org, Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux.cj@gmail.com, netdev@vger.kernel.org, Laurentiu Tudor , Calvin Johnson , "David S. Miller" , Frank Rowand , Heiner Kallweit , Jakub Kicinski , Rob Herring , devicetree@vger.kernel.org Subject: [net-next PATCH v7 08/16] net: mdiobus: Introduce fwnode_mdiobus_register_phy() Date: Thu, 11 Mar 2021 11:50:03 +0530 Message-Id: <20210311062011.8054-9-calvin.johnson@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210311062011.8054-1-calvin.johnson@oss.nxp.com> References: <20210311062011.8054-1-calvin.johnson@oss.nxp.com> X-Originating-IP: [14.142.151.118] X-ClientProxiedBy: HKAPR03CA0026.apcprd03.prod.outlook.com (2603:1096:203:c9::13) 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 HKAPR03CA0026.apcprd03.prod.outlook.com (2603:1096:203:c9::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.9 via Frontend Transport; Thu, 11 Mar 2021 06:21:46 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 94a2f53b-81b3-42af-0fe1-08d8e455f7d0 X-MS-TrafficTypeDiagnostic: AM0PR04MB6611: 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: NbCm5wlsuA/IESLj4Eldm2denT02hyCJyk9vhOeNF/TVEWi0555We7iTk3q+K+1ADLg717/9ZjMyqRb9tuwm8/4u6tW/DPD8mign0OWX2I07BkEB+6D3zp+LF7wucDhmAAzAZ3btF62DEY+4aZGP1HyGQ0FtE2m+0iHRvg/ObJ9YswTgM8TNJxQjtzmiSEZIdSsPUup0kPa+KyxocicBdmsDhcm6xrkFZLAnbHDJyBNqQddEPlm5tLYqz1Zh4fdj3aswTY2WsbA8q5/WArw2CFR03gOsBkoeO97LNYwemKrtFhqlqtT2B65R++BhoBzlG+csxoxLoMy9YFC+AcN1uIREc3DK2SRXzUytx9aUJ85WhK0e6dDPRCrsEwDuDR3sJ8sQOGk3M0EWpfMocdXCWMeWgNFFfTvnBBlp26zoMPzDr/DhGQd3YOxtL+//XUAiNwrfRRUbgOuoIx8/hPU0curQabWk6e6kQUm+DQuyF4JSX17SCoHVWx0aPBJkYlxcvFG4Ylv3GTXDR9WCltrNrOfvKZcVLVf6C6vO6r1CkhVJyTGSdHXfUIwzuJR9qZ3ot78N4sdKYk3PaPh+WmbOA3rUKiWR4DhrdAP5lwhikkM= 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)(39860400002)(396003)(376002)(366004)(346002)(2906002)(921005)(16526019)(26005)(186003)(83380400001)(6486002)(8936002)(6506007)(66556008)(66946007)(55236004)(66476007)(44832011)(478600001)(6512007)(2616005)(316002)(54906003)(5660300002)(956004)(1006002)(52116002)(8676002)(6666004)(110136005)(86362001)(4326008)(7416002)(1076003)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Ig1F2BW9mcGoAGevIxcKIWdT9ZUjiwdyBgMF7d0+fw9zxM9Q4ZYeWmGn9H/iVe10jrfUcwt1dnWwTdwibWLMFhiasvDJrcMa7SWGgkBOHcRQZ55l0IS0lGGNUgBq9TVivSnK3Dj7xBkL8d3e7Bf9AI+i/W1KFDvDc53hYXBpPexVgxbjpXtyXzVnE0JH6TIiKIGNgHdus1T4BjVGhLS3mA8WOFc1MFmWi/X2N0taeGvP+xZxyC2K6Dy4MhCirHNMygyi08ov5GWk23xAuoo3MwEIi59UeLWXWAFLW1jPrzRKttWVmwjDwvEcKTWAE1HvS0ZLjNaxW5HmC5piNuHbJ6C6sQTaPds7lMdbWOWC0RzVHVuq2YikEjdVQiWTtt0p2vFah7wR1To5Ece+LzE7giCzYXpEvbtYBqCaoYms7Grr5CHZtJFDBbA32qp01MPlJeFAvrsah5q7kWi+xef+1ddGESqnLrhOBVwG/Qe0FTxjQLqwd3C4IEmKnYzNAVimD4Ixr9XQbVDbA6lbhO3KZ2DTihfBSvE3znOf+uXJwZ/wgytyJs8QJ9i3sYuryHvWGQP49uRYieW3b8mK0l4uSkKq8psE9Ut1FgkLT0G1NjsVyVZx5O8wk3UR3Xs574KgNOq6bYUg/D1EzLknHm7dJ0R/9XKGGrpyEp/uyWAi8vyR3nX+OLFNUqyl9o2uahpgPOXyBgHJ6Sgdo8mLKpuWX6JGxz42ZMpfUKETbj8PXSvlGaQhHdVqfuP34l2cfcojw8fzIIO/No6PwBiwNG8lNIel8NcbGpC/Ny+E9qcKtIznRcORoLyxjcF0rRdSUxxT3sFLYtvSs1yvsm59X4axqpMlLFM+FOldjnSuiCqMBpc58pCleypYsE/PaG32QMJO5bEobp0Gb6oSo7Z0KtIOqeS/C2GgZfXyrSIDdXVAkSQu/OH6mTkIR5LiP1VkQMxR0qOu8AQU7aTSjFTWSAOj0OIqYmvb7J8tagDlOwupDIngIMMbiEHJP+IbZGrIMtG4LqT+D2JlDXuZwO+mEKXevJySTNEcUyqOsMQsqB5tppb72d5DQ0AbjuXzJdFP+kESPPIFL865GEJE7hotoBgXYHv1+jizqJgtwMjwXZJ9qx+lAO7tRq9V638Gp0xTs82xFSAgB1xQ4oJvnQPpnMTn/WC67nvNO+r38EwWIFcYedZgB8K+HLvA7V2sYB+TxueWggsJR6TmVDUxuvsDeqtDhLatLFzG9y1Uq7se6UfdXNi07uTFc2cqHyGQQQ+FKVZlkVdZeBr1hWCjz1NWnOvRtH7tbDm2dywTpYKX4vKglomTWOS5rWekR/3qHvtLxmIG X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 94a2f53b-81b3-42af-0fe1-08d8e455f7d0 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5636.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2021 06:21:55.8043 (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: 7zT4o2yO3lMxahrhonsyA1Ey7eu0zhR2Cj8RCr7iDQ29N/vHCsE7kuB5BzwV51tYf82JEmOZ/LMfpFiyLbvufg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6611 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210311_062158_632863_5FAABA1A X-CRM114-Status: GOOD ( 28.18 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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. uninitialized symbol 'mii_ts' Reported-by: kernel test robot Reported-by: Dan Carpenter Signed-off-by: Calvin Johnson --- Changes in v7: - Call unregister_mii_timestamper() without NULL check - Create fwnode_mdio.c and move fwnode_mdiobus_register_phy() Changes in v6: - Initialize mii_ts to NULL Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None MAINTAINERS | 1 + drivers/net/mdio/Kconfig | 9 ++++ drivers/net/mdio/Makefile | 3 +- drivers/net/mdio/fwnode_mdio.c | 77 ++++++++++++++++++++++++++++++++++ drivers/net/mdio/of_mdio.c | 3 +- include/linux/fwnode_mdio.h | 24 +++++++++++ include/linux/of_mdio.h | 6 ++- 7 files changed, 120 insertions(+), 3 deletions(-) create mode 100644 drivers/net/mdio/fwnode_mdio.c create mode 100644 include/linux/fwnode_mdio.h diff --git a/MAINTAINERS b/MAINTAINERS index e1fa5ad9bb30..146de41d2656 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -6680,6 +6680,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/fwnode_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..2d5bf5ccffb5 100644 --- a/drivers/net/mdio/Kconfig +++ b/drivers/net/mdio/Kconfig @@ -19,6 +19,15 @@ config MDIO_BUS reflects whether the mdio_bus/mdio_device code is built as a loadable module or built-in. +config FWNODE_MDIO + def_tristate PHYLIB + depends on ACPI + depends on OF + depends on PHYLIB + select FIXED_PHY + help + FWNODE MDIO bus (Ethernet PHY) accessors + config OF_MDIO def_tristate PHYLIB depends on OF diff --git a/drivers/net/mdio/Makefile b/drivers/net/mdio/Makefile index 5c498dde463f..ea5390e2ef84 100644 --- a/drivers/net/mdio/Makefile +++ b/drivers/net/mdio/Makefile @@ -1,7 +1,8 @@ # SPDX-License-Identifier: GPL-2.0 # Makefile for Linux MDIO bus drivers -obj-$(CONFIG_OF_MDIO) += of_mdio.o +obj-$(CONFIG_FWNODE_MDIO) += fwnode_mdio.o +obj-$(CONFIG_OF_MDIO) += of_mdio.o obj-$(CONFIG_MDIO_ASPEED) += mdio-aspeed.o obj-$(CONFIG_MDIO_BCM_IPROC) += mdio-bcm-iproc.o diff --git a/drivers/net/mdio/fwnode_mdio.c b/drivers/net/mdio/fwnode_mdio.c new file mode 100644 index 000000000000..0982e816a6fb --- /dev/null +++ b/drivers/net/mdio/fwnode_mdio.c @@ -0,0 +1,77 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * fwnode helpers for the MDIO (Ethernet PHY) API + * + * This file provides helper functions for extracting PHY device information + * out of the fwnode and using it to populate an mii_bus. + */ + +#include +#include +#include +#include + +MODULE_AUTHOR("Calvin Johnson "); +MODULE_LICENSE("GPL"); + +int fwnode_mdiobus_register_phy(struct mii_bus *bus, + struct fwnode_handle *child, u32 addr) +{ + struct mii_timestamper *mii_ts = NULL; + 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)) { + 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) { + 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); diff --git a/drivers/net/mdio/of_mdio.c b/drivers/net/mdio/of_mdio.c index 48b6b8458c17..db293e0b8249 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/include/linux/fwnode_mdio.h b/include/linux/fwnode_mdio.h new file mode 100644 index 000000000000..8c0392845916 --- /dev/null +++ b/include/linux/fwnode_mdio.h @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * FWNODE helper for the MDIO (Ethernet PHY) API + */ + +#ifndef __LINUX_FWNODE_MDIO_H +#define __LINUX_FWNODE_MDIO_H + +#include + +#if IS_ENABLED(CONFIG_FWNODE_MDIO) +int fwnode_mdiobus_register_phy(struct mii_bus *bus, + struct fwnode_handle *child, u32 addr); + +#else /* CONFIG_FWNODE_MDIO */ +static inline int fwnode_mdiobus_register_phy(struct mii_bus *bus, + struct fwnode_handle *child, + u32 addr) +{ + return -EINVAL; +} +#endif + +#endif /* __LINUX_FWNODE_MDIO_H */ diff --git a/include/linux/of_mdio.h b/include/linux/of_mdio.h index 2b05e7f7c238..e4ee6c4d9431 100644 --- a/include/linux/of_mdio.h +++ b/include/linux/of_mdio.h @@ -31,6 +31,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); @@ -118,7 +119,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 Thu Mar 11 06:20:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Calvin Johnson X-Patchwork-Id: 12130445 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.0 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 D06C6C433DB for ; Thu, 11 Mar 2021 06:27:25 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 DAC7664F34 for ; Thu, 11 Mar 2021 06:27:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DAC7664F34 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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=SKdIv3mK8RIeolZdHRw/D7XiGxHfL62BhVR+nS9yTOE=; b=fQUnAH0MTITvW8tId+kWXILLd r9XcvmVPyRLXfytQpVN8BZS+Wv55yz1jMOWSmX1vVVI8hY9OD7E8lNiMbDpiedo81NmxhGXgvcrfL PG6EFGTp+l6xpriJjXPWlBe+FAyrFmp8V6odSHB9TM6gs4VIV+BgSZ0yVLppV9urOqEzP7231hN5R FxcgCs/FewIoC0nQvKou6HM3ukRN7gWIVrl/R3+zYsNLcT+s+TmizFm0iW8+no98wxo8jMft6n8ZL jDWqynQ/rUJAwcK3UKj2KxPSc7DDD0YhukXGGdgpXieBDQxMT28Rxo/YuRADodPo9vfh9T7UqMbWP AYjue3SHw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lKEjV-008TFf-5q; Thu, 11 Mar 2021 06:23:42 +0000 Received: from mail-eopbgr60078.outbound.protection.outlook.com ([40.107.6.78] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lKEhy-008SbZ-Vd for linux-arm-kernel@lists.infradead.org; Thu, 11 Mar 2021 06:22:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ehcJodcgysLkFIjF8dJrff3uwygR3nuaC3zLeemdzypL0cBipoEeFhPvjtsHOlDjdHZ6WDBOP/02Wr8lmIL39UPo7pNTgiGq9ctrEsC7q0EXoIsiC92s+H3VkVbArRRnvugGZNHK7TlI4g0vqFgNZrVi7S2pybrCYlAWX8xE63gMCIBMyp+AsgrQwFLYTCn+cSzpaH1+I4eQWFW5ZU/4wVcJ9DS5A/fEli2grKZnDzOr5cJCUikKLQ8Tba/fL2N8E/ENGJ1iiC/Bx8S2ZrCmGCnEF+GadCdHhYmc4KawC3ixmduez2WuT27PHLg9klp7BLx9URm13f+Wfsf7KTXwuw== 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=TCNvfizjWrO5Sn821EUj0HeifNRRaWcvF9O4nLZwNDU=; b=Ahlde0XKwFoiiP5PpxLYSUN+Syh79tyEh8xo2BFR3rsG6eLOeHhjZZgge60recn5FCM+VLPnrVyuH7jFYaSamHAMJvPx0TBiaOzwxJrKSCAU7tSljUgKR900UMLY50SacS43dueQtQ8ztqDbJeEpeifvbFcG19phv7EVmsWJqZjlBpGL7pHaw4crojNovxFFBvTrhN4JW5l0mPeZ5suz7sNT39y9T2ioikBTeKw2FeEMDMDrIZP9GF+Znd+xlzkPJc2t52gSRSGGPbRhaCg9yIfMRcHkmg1fGazR/fuloAnBqmhyJvsxptaX67m2b0rwpU2zfpBz2eEeBF6odE0vAQ== 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=TCNvfizjWrO5Sn821EUj0HeifNRRaWcvF9O4nLZwNDU=; b=GhVg4Uoi2sFscONMyz5FX3u7PK1ui530U4OTjSfLaj/modk7B9gqG0uN3y1WBpr6BALxfgI+Idm7e9lwR3+R9gxL86T3iXy2wjQ4i2r+dPLp8SlgfPQieRmYcb2SwgZ851xEVzbpq3XS3OleGaA90SU2Rxl6rHP8SZuovECpzbI= 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 AM0PR04MB6611.eurprd04.prod.outlook.com (2603:10a6:208:176::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17; Thu, 11 Mar 2021 06:22:05 +0000 Received: from AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::1cd:7101:5570:cd79]) by AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::1cd:7101:5570:cd79%7]) with mapi id 15.20.3912.027; Thu, 11 Mar 2021 06:22:05 +0000 From: Calvin Johnson To: Grant Likely , "Rafael J . Wysocki" , Jeremy Linton , Andrew Lunn , Andy Shevchenko , Florian Fainelli , Russell King - ARM Linux admin , Cristi Sovaiala , Florin Laurentiu Chiculita , Ioana Ciornei , Madalin Bucur , Heikki Krogerus , Marcin Wojtas , Pieter Jansen Van Vuuren , Jon , Saravana Kannan , Randy Dunlap Cc: linux-arm-kernel@lists.infradead.org, Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux.cj@gmail.com, netdev@vger.kernel.org, Laurentiu Tudor , Calvin Johnson , "David S. Miller" , Heiner Kallweit , Jakub Kicinski Subject: [net-next PATCH v7 09/16] of: mdio: Refactor of_mdiobus_register_phy() Date: Thu, 11 Mar 2021 11:50:04 +0530 Message-Id: <20210311062011.8054-10-calvin.johnson@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210311062011.8054-1-calvin.johnson@oss.nxp.com> References: <20210311062011.8054-1-calvin.johnson@oss.nxp.com> X-Originating-IP: [14.142.151.118] X-ClientProxiedBy: HKAPR03CA0026.apcprd03.prod.outlook.com (2603:1096:203:c9::13) 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 HKAPR03CA0026.apcprd03.prod.outlook.com (2603:1096:203:c9::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.9 via Frontend Transport; Thu, 11 Mar 2021 06:21:56 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 631dbef7-000a-47c9-cf4f-08d8e455fd4f X-MS-TrafficTypeDiagnostic: AM0PR04MB6611: 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: R5xX7DXyoBxPMBb7da6uwPP0yGXn56U/dhaCdLPfzIo4Nj7mooHkw9HCEezaSd2wlbnYEJjlSuxRMESgQR22RX82kwgsvYVxhNSL0ZNr4v2lJPbiC+XZYphRYJmLcZoZi8w3EXTXJ1AWvNy43PZ+XqWV1f34OOkwG5YJTQvcsXe6lH92sqSuZSQYzNmoooOXxTk+QCEg8SWoMysxMLgi66d3iuEKuSBAWrLkYp5sPiTkM2oTZ5tQGwDw+BkMqiSaPGtxDd2roSJCJ0NejWvnmuJRuC8gsqJv7AwuWGCkAMDe29Wr/03ExfyySnFSOzPURuSIAY+5U7Znv7LW1Msw9YD2X1+Snpf9e4lPnKLxi/tNTOqHAwbsLV+jOGJzUy90apwZn9IVpnB7PwU0e5sSzCoPh/dG9HeNwbt2MNWUXNLFB2q80d/pgfNKq5+SWNzjQDpZlZgLf4IptUdltmNmn7i5UaJfNGo+kJCS2Djuk6vP+3pHyTJ83GvBfimo6F4MIPRPIxxGVo0cu9Za7AIClkeL+9EkW3CrgqQmlqq4GbCPlSLqfDB0mAelXVZBQiFvjGaGbjupPylWlBHLiZttV+kp+2CHpdFapSvUq24v4jU= 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)(39860400002)(396003)(376002)(366004)(346002)(2906002)(921005)(16526019)(26005)(186003)(83380400001)(6486002)(8936002)(6506007)(66556008)(66946007)(55236004)(66476007)(44832011)(478600001)(6512007)(2616005)(316002)(54906003)(5660300002)(956004)(1006002)(52116002)(8676002)(6666004)(110136005)(86362001)(4326008)(7416002)(1076003)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 90h7gksaSkjnNbXPlC3glYRLurun7+jE5oYfmdoWCeF9FyaHnLz4MG80OK/ZKVkgtNxy0zxsLMjOyYuedQ2lNBFCX+jdwE1c94CbSzURfuhoYHV6cbfXigstWd3rFzXGgE6pJTj1G/zAEHovqCCDq7A7hAUeGYeF/ooBaHVm+vXF8CXoM7SGoV34JPULYgYrOk2Q3WerLUq8kK/sBBBg1k6r3O6WmNVCzlAWuBnJv+uu5X+QieavN2nRusnwkqHmQ9h5KPIk3u3jNV/KVFT+Wt6EKUgijcEV/qhtQE/4q6/7jwhTGdbF+FjkFeorSYuot3/sCkaS4baHfF1BqA3bCwTu+oj3wlh42fmIq5wVPqfrX2XVXx3Hqua7FIuCeaW+DOp29A5cB9OinatDXj+a0LVnqGkVx/PX7DIKIEu8c7SbThpF2egE0wAaiT5ToVGxrsnCoiQWtvfSB1WQOeIPzr/0rsdvPoLGrURMQL+H+7rjxaBg+1gKoC4WptQQAHTy9j1nOY4Lmw1roeeofsUVPf0C8iDQvhhaUW3LhWp/pcnr6cEEBRiXk8gAm0ny99lLqbxNJGz5W0bd04jnO8P5FCDsD+FJKyLhzmo/rHWJ+cVbTRk3vG92CIeMjvKFwQPjYO9QmJi4YfdcUvlEfz5Jz5XAbt7EK0xqXSrqXzb2pUJFYKBVI9bX09E6zB0K8cx+Dp111Xys8ILQWfGwvEaWqeDpbdtolJKqLgnr65vAOq7EwvGblRRolKwuEjSmdDGk6+6ECyH0bj3CtUe67SKXGPxAqDjroBhkQxKbHIS24kS7rIh7NP92slc7ORkV6qupKkYkbze2EvPSBHjjKM/5KlkPlJor5iExSh3sIKu9Y3tXZjvRZhXtKObVugtYnswJog2iW2tBMxM9dy5o6KXeCL6jv1aPRv8jTS5TGYCEEvxRQpxv4l1VXOT7Tm7Ts3wsJEBzy6uKGetv4we3U+CX0iwj8l2QwCKh/+ykO2fxJHbdVa6CMeUDsD0cJB8tsT5ghywJofVqQLELcNZJTffCfJhtpxYzSH07sYRfnEgO2eDNbnsHkP/3aTFXbuPw7sobDThtkyUlaumFeIdTK/wjn5pLkYN8S/ZxzsBnDzadqWUG5GexI2hh7ORiEISHGfPQvph8/OJ+6mSDoJOV3JyOT3q7dFHUR4ruNna1hdb1k6pCx1rCnL/JP/5Pui57K2aaMKxP2PIoKwc4xGRprj8cqsGoyERKBXcRjL97RiF2k2q/01jvQKkAyFcyG7OVnjIKrehUVLu9sm6nQ54x26U9WGZNg9UXO/Q0xp9QdcBJCarK0hjI49nFwT2jDmVrTwu+ X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 631dbef7-000a-47c9-cf4f-08d8e455fd4f X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5636.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2021 06:22:04.8433 (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: SKxgqg42Vpj7esG0mb8cAlYLAKBGCxic5D9eZmMTFE8hzQ+tQSqYbfih6NAXMNwSA7nW5HB/XU8/1MkafUYEWg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6611 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210311_062209_990712_8DA01748 X-CRM114-Status: GOOD ( 14.35 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 v7: - include fwnode_mdio.h Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None drivers/net/mdio/of_mdio.c | 39 ++------------------------------------ 1 file changed, 2 insertions(+), 37 deletions(-) diff --git a/drivers/net/mdio/of_mdio.c b/drivers/net/mdio/of_mdio.c index db293e0b8249..eebd4d9e1656 100644 --- a/drivers/net/mdio/of_mdio.c +++ b/drivers/net/mdio/of_mdio.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -98,43 +99,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)) { - unregister_mii_timestamper(mii_ts); - return PTR_ERR(phy); - } - - rc = of_mdiobus_phy_device_register(mdio, phy, child, addr); - if (rc) { - 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 Thu Mar 11 06:20:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Calvin Johnson X-Patchwork-Id: 12130447 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.0 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 F2E41C433E6 for ; Thu, 11 Mar 2021 06:28:00 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 74F5764F47 for ; Thu, 11 Mar 2021 06:27:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 74F5764F47 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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=jDo1qaXDbhFII++1MisTBwS/ZVG8wESSvLOwpa11DH0=; b=kvLYC5UkjS+QroZHwH90wiv5t 3wJNTq2CqMDbi8XlWKb/55jxkUany69r3xyV5jCng/85sYX5GWW7wFpLjrxp4vEK9H2EWXHr7quFa ic2N9dGTQSzY6OpsJjJ8y5z5nHPl17M9XNFb3MA3LnIc/7N6GAkb9HwtdHZZNYHH/XLmj8jkF/Wdf MAa7INXh1sMPiyT07rb1zKXnfQd1opVkmacvF5eKznTZ3aH4MxnVmizfkyb/McTNXDAV4m1aWGn0f /S2Y5QUWB3B8FKYR4Kh8rplQ5QTQaIvTTKucKzoRuxbYrvTjEXPj7oN+pwrLGtgTnmccwNPGHd/Cs sSl+R16Yw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lKEkS-008TbS-4f; Thu, 11 Mar 2021 06:24:40 +0000 Received: from mail-eopbgr20043.outbound.protection.outlook.com ([40.107.2.43] helo=EUR02-VE1-obe.outbound.protection.outlook.com) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lKEi7-008SeZ-F3 for linux-arm-kernel@lists.infradead.org; Thu, 11 Mar 2021 06:22:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FEyfsaXU79bMt4oRGr4cLlUfaqnQ3m7YPoIjRa8vQeTf6eVwqzgU5GHSeg5PdF/LkdEilRcT35Vm99HIFJ09sWXUkgUz8DbM697kePzxt4slEr5g7S9jfvv1rp52GU6FhE42Lq5k6JO5us4ei/zIvCiIZez7MqHAteXM0wHAfBtqpjt7/svtYxmD4XWBv+6HJNNg382q4GFhJ+1ZCTdpLwEBTwGA9nxIOuPU7lpSrJqAtRc+D7uwqw8uwnSenKDDZEAb7+JOCST7bHKM0tW/5tCLjHbGy5dW4ilHusovdvRmeP1ct6vMSHVKHhfcERMS+NP9vhqQq9VtGk3NKjVDPQ== 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=sGE+dQqB5Q0ju9wYpoV22UwnpMHoGA6jS7hGPYK8h1M=; b=fMO9gU3R7ZQcwvagJgeQ4zR4Ludu/kADEiZ2e4TKT6zMAwgUBKE1cnlxwiKcleMm5yAm3w7Gwf6bdLqJl4zUZ4dWEp8FCgc/a9rTBjz5XoaVZkviE7RuuTvqWMsnvC4RP8Bz+H++lgRVkAH8E2mV6Bllct7fO455B8W04AWfpNid4DaxkglzHwtlJDGxZTGUq3ayxW/TUJxnXSJ43erWqb7QmUTsQMZ4Ha1yJUAI6gwHVmlAjpWhdhp1UrTT3UEKLZ9xZ+VlFuZWpi0kr0uL1SmG7jmSuKAeoB67DeTR3EaROhOFwJ0Mzb1X0TQ9qJ+Gi91aDk6uL2XV7PiK3RD2LQ== 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=sGE+dQqB5Q0ju9wYpoV22UwnpMHoGA6jS7hGPYK8h1M=; b=IWcXQwGnbbwipfwfeFhL5mIeSPN0xGVSAGu6Snwv+jlCz3zDaKqzO05gzCsNuG+sHmCrL6BPmw8cVkMt4F8FFx19vnmjjpBcR+XJUz8wAjGf36lSAYsgEojc5FJrLjGrwWfSL1bxElKmt4V3roRYrSQ/kJY7zoRYD6eyNKgBHtI= 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 AM0PR04MB6611.eurprd04.prod.outlook.com (2603:10a6:208:176::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17; Thu, 11 Mar 2021 06:22:13 +0000 Received: from AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::1cd:7101:5570:cd79]) by AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::1cd:7101:5570:cd79%7]) with mapi id 15.20.3912.027; Thu, 11 Mar 2021 06:22: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 Cc: linux-arm-kernel@lists.infradead.org, Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux.cj@gmail.com, netdev@vger.kernel.org, Laurentiu Tudor , Calvin Johnson , Len Brown , "Rafael J. Wysocki" Subject: [net-next PATCH v7 10/16] ACPI: utils: Introduce acpi_get_local_address() Date: Thu, 11 Mar 2021 11:50:05 +0530 Message-Id: <20210311062011.8054-11-calvin.johnson@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210311062011.8054-1-calvin.johnson@oss.nxp.com> References: <20210311062011.8054-1-calvin.johnson@oss.nxp.com> X-Originating-IP: [14.142.151.118] X-ClientProxiedBy: HKAPR03CA0026.apcprd03.prod.outlook.com (2603:1096:203:c9::13) 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 HKAPR03CA0026.apcprd03.prod.outlook.com (2603:1096:203:c9::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.9 via Frontend Transport; Thu, 11 Mar 2021 06:22:05 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 1db04771-33ab-4492-b892-08d8e4560265 X-MS-TrafficTypeDiagnostic: AM0PR04MB6611: 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: ixRDScbMZyl6pE8Me1soFOWpT/YTOZbP0M9vObAQUD1NePmlLRceOb2Wz8jP+6y0bOjyfawFoy0oclpNkuBQ/IIrrx/cUzPH/mKfjDf4oR1JyDa9eZuSzUtHEOtvZ7VPELqv+uURT8HYux4nK5l3eyKcpUzv2v3eXqi1MV9abQg1va2+0T+SnzAzoJbgHbccM4/Nx7Ntz/JlXk+4VsKVZ9PZcOOZ5CffzKeMSWVOyfYi2+IdjHXXW3oMEVR9iyixfBoOOEjo0YLPP8vTv+DOT+FkNi7RzbJT+DxNlSVFan4nVARCpPqsbxKU8qsN7AbGXCMVYmYDVGE7Rl/w0FR6iKFlphvVuXJ8/T6q0r7uGuaJ18/30ukiDAmKee775aCVWHGareXPJXXTHdQm7dZ6WXLYZFghW7KgoY+UM/CP6H0EqjO4DyekYsWBESvMzn1xlDdSVoYFV4v9cTev9SIRROeORt5egx1RvzrRcuh/3OTNB+dP09OIowaW8J/dCaonxuMgDy7Qq8AmhXUG8E5JeMHnTxKITyAUvImYKdreRe4Puh+XExJLumDh+C6T1U9LO/PWN3WdiXo2sCJ39LcEGlyQHXws/XwlTjKnsy1HfNk= 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)(39860400002)(396003)(376002)(366004)(346002)(2906002)(921005)(16526019)(26005)(186003)(83380400001)(6486002)(8936002)(6506007)(66556008)(66946007)(55236004)(66476007)(44832011)(478600001)(6512007)(2616005)(316002)(54906003)(5660300002)(956004)(1006002)(52116002)(8676002)(110136005)(86362001)(4326008)(7416002)(1076003)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: zH/cVp4fgyENpxD5aKgbY7AEE2URUo4rxwwrjKlZiPNmyju+FSTcRnHqNvprstVM8xDI1ckDEAzLFyymP+NX9QXbQtkjn24+ZCAq8lcpmjd7ut98BsMNFiUYlkaRuR//qrQag5KNhluHU7/zg2QzlymNfbYAm+proeSuyPEeT+mZj6pvLK7A8SMAQt0MEJRaNiXDjsFLQxZNVdrwkzRtr4pSubtONV3vy8Z7OLyjnG1wuxbkKUJiQvHPG/5lx0xqdVXOl1ce1F49ckwEIVJsrFUgbpb4uZOmXvmKdTT0aMJk72TcUKPCQZdLW6Z8yHBQm+94KQ3hbYWn7aSPY90myBBsAgEGESCLC8GJNxscQwzZtrlqT9Qr79jMb1B2PFStikjGK9xGbrP0O/+heb2Drijz7Rrr9lHmljxclTA3l1OAbh7AZdtt2bPBKZaAHzuafDqJiDFs9v3HmUzlgboQo+Q71QWszHU9IOC8O2CcEF7IOi5OPbVS6rqdE5XP7QhQeKNOk3P401GYJxfYczlkHohHuLpJeO36aFYhMLS9MccBD6W+Tjxhjk6oG4sYBT+qdq6v1Zg8nVL69LMPsEH/qlrDbz+4dBuSqR4+KtA7ddtLNdnq8BlZNmvtjtj6Go34H3hfhzv8lF1X7wuIfVh1hMawcSeP7mUWzLfUMP6q6yayzMrEL8vRomIuLjoUQl4nq/lVDa6IzPA1shD6sCiNQNBFeX3VfCNnDF0BrZBSSut1NIVA4X9gCCFWTaxUAKTV0OQpeAszf0PMN/xj42rgklgZwDEFCIt5hfXIvU64qZ96aaN+U4iQoRCsgyt1OtETAG+qcv6Mi7br0Db+qJTvDrtUcwpArilA1oQl9RSaNWGdWHBpnS5gI0AWLc2vd0c2zlkY9qZMeZFx5tTLPepkwc8eNcdqBlH20BB156brxKdyQaju5yPqX5Z7J2BjLfwK3TU3yXzhfLpocL052v8AYGUdFaMzZcifziOMnajdFrBWA2962yaSdg5XUSLHYFHlf9N9iU302relaDQO+oCbXi50Ziwubg90t4nFsYZ7SHFXiOD+G6BXFu4SCXy/0ZLu9fkoJqUM8ao47mJYErpj95BgCJ0zAyj4ke7rx/srnfp/NU+PGJPBvzILLfEEvvYU/1lQyZTn45UrLrDnyK5ThRwr3c2Fh9Rq0KNNxvSzXmwTUAiXEPnTodGZojKjtkP/6M/9czykjDfQXKaPnSZwfIWTeZpKmtRy8rBlI4YrI9WtpXosJ6VQI2b8gyvqgrkO5jHxbyzWWbWiPBoOo8LCs9jDFCh+I9gMOz/1vK73lZ8XA6qHrwd0ZK50/e1cw+5p X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1db04771-33ab-4492-b892-08d8e4560265 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5636.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2021 06:22:13.4944 (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: B80SY+ffe7Ybdv6zvslsO9ODpRrsKM00aSuaz8uGnxj0Snkak7sH5vORe1zcdGhDedmyOk0CG6OGSFO2dsypQg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6611 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210311_062215_782667_0743F01D X-CRM114-Status: GOOD ( 12.53 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 Reviewed-by: Andy Shevchenko --- Changes in v7: None Changes in v6: None 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 682edd913b3b..41fe380a09a7 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c @@ -277,6 +277,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 fcdaab723916..700f9fc303ab 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -706,6 +706,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 @@ -953,6 +955,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 Thu Mar 11 06:20:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Calvin Johnson X-Patchwork-Id: 12130451 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.0 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=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0FEEC433E0 for ; Thu, 11 Mar 2021 06:28:21 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 8191361583 for ; Thu, 11 Mar 2021 06:28:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8191361583 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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=tfszHPgcxVEprKi6KRVKFTvZhhTQNIWy0lmR+zWbKxc=; b=gX8DaGqVnl4NlhNqDfGfnqSLy hJyy95XT3LxnF2QAwd0h/hIgmx+868iJgq6SpYIOPPVcUPKT3eEoa0TYyaWbjZ1XDeIBJp2qse3qi okGzzHHpCLJVgjAxo0NrH8PHys/o7e//G8ohZzN8S/GhtfKhIz7PbGVPlTthOqyd9KxJkIgl9txtn 63Ybpi3V+bW9oKhhbJG3ZMwQTT4n0/EAVn0YrSAFlnfmVDR0jD6VNVkPKx7Ex82mwpbNgFFfDkbOG Mi3Q1sf5CjEiSCoLPfscJ08EcWpIFMrdz0uhr04YdVpxwR52DvGw4Ty68iLdBWCwa5gFlMgCgkaFn kyWqdN+LQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lKEkw-008TlF-0y; Thu, 11 Mar 2021 06:25:11 +0000 Received: from mail-eopbgr20065.outbound.protection.outlook.com ([40.107.2.65] helo=EUR02-VE1-obe.outbound.protection.outlook.com) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lKEiH-008SiM-3p for linux-arm-kernel@lists.infradead.org; Thu, 11 Mar 2021 06:22:30 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AtgZaf2FOnT/iJAY2eT1+ociEJXpLQNnW95m4KnFg5eCSnu2Hn9p5CvI0Wv/9aSrY/mY+6vcDlLl0FTCyTjh2tL7yDpspa2+hYCt4/1oOKseeoEgv4aX3fwhrixfXXVLR5IHQ5qdw+1j70VZQZBB6mR/hWCpUqHYhCnuSmDq5H3BtHg4tl6AflGplPGUkY0hv3RYuHv+KGXcOqZNBqrC5NvUREG/Qyj9mCtXK1hsLtm9Hbw5iFPgjQXdMKoBCRU4YnNeYF9Oft/Rb1uDR8xdlhGs99dQWM1E7te1+PfbciiNfpfkkB5Tx8oaaCjtnwSMraCAmi/HdKCN9BKzZvnSDw== 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=Eov0g2e7j/5sx8TQSI4sQKd2+pqg96z/I7FWfHmchjE=; b=hXMKI/nA5plV1dXu8eBUlBcvnm0EMFJw7i9IEDGx/23OI+sJlt7lT+5zVX42yfcCwVsJBL/vkKWrmt8HrghZ2JYzXkEqXvm4qEPoGk3WsD25hlu3mvtti0UNJ9P61KEG2Anbmj/CHycR2AsWg2lxkufk9hNRZiEjEnw63R/SeGlltKuYPabxe4011e9qiiYoDZ+iq+lt60MwpFNbmjODV5IyAOLpG+dhYgHjfBFIjZxSt+6Q1jY66A3KofRDxfU1O1P9wSWDJBePuo8MjNt2aV5NWycKgzMy/8foBzE71sGwuKQTmkoQFZtUN+roJWb2orIYvwQoAWC2RddsgLn52w== 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=Eov0g2e7j/5sx8TQSI4sQKd2+pqg96z/I7FWfHmchjE=; b=lFSLvynRPML4HFzt7GFKc5N9QFgtgt0WbAtR3wuEgmel00r9OHHxoOfeMkGkzQgqPi89ixtqFdjx7Q88O8nl9pCtvcF5P88K5JrfMwljozbXQfhcMjVxB8M2DbfVj66ySdMYBo0wK7iBPhUZWthtu/kBvbij9PMX4is4FgNW7Fk= 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 AM0PR04MB6611.eurprd04.prod.outlook.com (2603:10a6:208:176::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17; Thu, 11 Mar 2021 06:22:22 +0000 Received: from AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::1cd:7101:5570:cd79]) by AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::1cd:7101:5570:cd79%7]) with mapi id 15.20.3912.027; Thu, 11 Mar 2021 06:22:22 +0000 From: Calvin Johnson To: Grant Likely , "Rafael J . Wysocki" , Jeremy Linton , Andrew Lunn , Andy Shevchenko , Florian Fainelli , Russell King - ARM Linux admin , Cristi Sovaiala , Florin Laurentiu Chiculita , Ioana Ciornei , Madalin Bucur , Heikki Krogerus , Marcin Wojtas , Pieter Jansen Van Vuuren , Jon , Saravana Kannan , Randy Dunlap Cc: linux-arm-kernel@lists.infradead.org, Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux.cj@gmail.com, netdev@vger.kernel.org, Laurentiu Tudor , Calvin Johnson , "David S. Miller" , Heiner Kallweit , Jakub Kicinski Subject: [net-next PATCH v7 11/16] net: mdio: Add ACPI support code for mdio Date: Thu, 11 Mar 2021 11:50:06 +0530 Message-Id: <20210311062011.8054-12-calvin.johnson@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210311062011.8054-1-calvin.johnson@oss.nxp.com> References: <20210311062011.8054-1-calvin.johnson@oss.nxp.com> X-Originating-IP: [14.142.151.118] X-ClientProxiedBy: HKAPR03CA0026.apcprd03.prod.outlook.com (2603:1096:203:c9::13) 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 HKAPR03CA0026.apcprd03.prod.outlook.com (2603:1096:203:c9::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.9 via Frontend Transport; Thu, 11 Mar 2021 06:22:14 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 73afef84-a474-43cf-7b15-08d8e45607b8 X-MS-TrafficTypeDiagnostic: AM0PR04MB6611: 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: NXvJMNi6BWcmRN/mbZVTFOSJFJ+VSRfnTvdH1e6BkiyoLuN6egGBq2g1+FAn7FVSf7K20C5WMUdMGVzGhdaxu+J4EWFAsef9GsDapCBQdM44ArDsNVCi5aOB4C6ypp0bZMdulHSMSH3cdlH4LyeQuOzsx58Aj0WVMOp/bkL9xUqLeAl7rWasB0F89d7ZYUU2ZZeltKi4LCXJ0cOtc3q7Fac1MU2REtdW1RPyA5XH539FzcqXcCUHS5rKtE3ZFL+AVj3MQDEAis3rBTbi/BHgn+wEqUUM/Palb/Xz7yWTrpvMladI6drXfiB4kW0utojitdfXpUxQZQITj1U6FsBjF6BsPotHckuEWfossogkmKYpSYe5jOQh+Wsnbnlebdc0K1dY5NUeV+mJgighspq6ffwkRt5ieoU8IyUlcFpXznJfXDoK6KZyrtmIEnOvTH0PJ8yoerAov4baofpwgC4ZIK84X/LbZ1aIcXMVUrN00VWYm85NhDjFk//xfnCwtz4jlrGE/8Sxa+cMcLkDfgytUaRJu+1a4FhaNGAEJYF61G71BDxtw3DiuXKlzyw81hnFbIYkj98umsISGAs3JZULJg== 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)(39860400002)(396003)(376002)(366004)(346002)(2906002)(921005)(16526019)(26005)(186003)(83380400001)(6486002)(8936002)(6506007)(66556008)(66946007)(55236004)(66476007)(44832011)(478600001)(6512007)(2616005)(316002)(54906003)(5660300002)(956004)(1006002)(52116002)(8676002)(6666004)(110136005)(86362001)(4326008)(7416002)(1076003)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: TUymOQX6cfkYRJKDr7r+2iD70/3n2TwgctW3oHKN19XXi12S+Whp71M/u1b3C+qstpfu+03OwztZehlsd6bFHGSr+rETZGfgydzFjFAX0XLH/G/D2h3ARzX76n39vCvk0Lj2Qh9XXgCVTNMWX8IWohPOxhHQAzSY9L0D4XaJyYXyph++jWVM05eIerjuh9UoZB1dBRIWqZxStaUUflTyp4S+JyWX6rNXooBR8GvYvPYG7ybn+XCR7znZlSBbxrQgd9qMxfPE5cr8aHj5zZDoD2w/GpkWu/txEXQRPJ+Zp7vWzke5T32e38QTw761D/VaE9wyq3Jqq3OetYgGUYutxzs1fBQf1lrsnRmfE/FE5iVGWa5V9IQc/H1rbNJNaX9SHj8I0MTuHQxgQwiF6yHad10RHsitMUuqYIXQEdmgGw59odkwkxY6gn26Ii/S+OAG+IEYpZhldeXWIuNWShmEI1fa12tF4BB/Cqy/Crqb7PWQ/tEHIjJ7qmZE78iVaGn0m0f+YzXXkr7OZQethACEPuLD5tedUMyk61IzucytUH/aauaA4nQC8nRBU0RdVqbJybHOVg4PVYPJSFi5h4iNfUPIGPwGTHO9yvhQTie46qPXpsxb0IqCowlInpfqhRkUBtbtlSQB007uTVYuvbE7ZywfF4y28hqVeuCiQgdKLP4Ya/sT11NLKYN7G/EYqRHs0Y9r+xE9nQ5aAGz81QTJe4lbgDGdx7KXb+IKOV8KSQJFACs8FhJ0vKvS7ekyjxeqtjyV1yYN7V+KKzoOqEC95xL7ovRc/FQ4aDGHXtcBGsxjufNuFApzQS8ogB3fxHQvNbUQW1w7m9jGWOLWegycd19iCeM+ihtcFO53yx2D0QRTF7fARHHLat/bSu+TlfMOZ+wHL7Et+cTQ+vRUNFyMoGrhuIwmmzfoze96KAYQdJAsw3JIzQnziJIh2y7DBgPbCN3lx5Z9HPb914GkzzlVhz0HbLFhk57aAcMQSHlovfCO2vfzkCFB+adsqdLxqBHcm2fPr0WegcS0c/L/yeeJGwryhVE0SC5FuYH6M/2wogInJ/aPRy/LpaTjn1XR4AIEzav3kn8bkDsxXDvz8d9kE7/6GYBK0qNHfRzT84BEJScOHbgH3K+6B+7ewKdrKJ2yiCIJnDc/da4StkqLbjF/lVqg9+jTFRpwiJJ+qk6Td1BNTcDuJuCFwzqnkdEAfPOSsyE7o3SGIVKReK3zHMwMsvSdJUJnva5ZueN10dMZ5u0PazUHUTIcX8OH/pxlL49rNijTXHXhaWN2DmoZX3VsML1ul2ahAFAdJ/dCqizSdGhq67T+0RZ7UYmmmdJlkmo3 X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 73afef84-a474-43cf-7b15-08d8e45607b8 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5636.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2021 06:22:22.3524 (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: 6MWSBTvH3QGa9W3hJIeFvkc05ImmU1GsAxj0qt8qhBXNDDR3530W2u/fseZ5BTEY6iMzaYFF6DxZudBYLfFnJQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6611 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210311_062225_698763_E06087F2 X-CRM114-Status: GOOD ( 23.91 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 v7: - Include headers directly used in acpi_mdio.c Changes in v6: - use GENMASK() and ACPI_COMPANION_SET() - some cleanup - remove unwanted header inclusion 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 | 56 ++++++++++++++++++++++++++++++++++++ include/linux/acpi_mdio.h | 25 ++++++++++++++++ 5 files changed, 90 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 146de41d2656..051377b7fa94 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -6680,6 +6680,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/fwnode_mdio.c F: drivers/net/mdio/of_mdio.c F: drivers/net/pcs/ diff --git a/drivers/net/mdio/Kconfig b/drivers/net/mdio/Kconfig index 2d5bf5ccffb5..fc8c787b448f 100644 --- a/drivers/net/mdio/Kconfig +++ b/drivers/net/mdio/Kconfig @@ -36,6 +36,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 ea5390e2ef84..e8b739a3df1c 100644 --- a/drivers/net/mdio/Makefile +++ b/drivers/net/mdio/Makefile @@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 # Makefile for Linux MDIO bus drivers +obj-$(CONFIG_ACPI_MDIO) += acpi_mdio.o obj-$(CONFIG_FWNODE_MDIO) += fwnode_mdio.o obj-$(CONFIG_OF_MDIO) += of_mdio.o diff --git a/drivers/net/mdio/acpi_mdio.c b/drivers/net/mdio/acpi_mdio.c new file mode 100644 index 000000000000..60a86e3fc246 --- /dev/null +++ b/drivers/net/mdio/acpi_mdio.c @@ -0,0 +1,56 @@ +// 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 +#include +#include +#include +#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 = GENMASK(31, 0); + ret = mdiobus_register(mdio); + if (ret) + return ret; + + ACPI_COMPANION_SET(&mdio->dev, to_acpi_device_node(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..748d261fe2f9 --- /dev/null +++ b/include/linux/acpi_mdio.h @@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * ACPI helper for the MDIO (Ethernet PHY) API + */ + +#ifndef __LINUX_ACPI_MDIO_H +#define __LINUX_ACPI_MDIO_H + +#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 Thu Mar 11 06:20:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Calvin Johnson X-Patchwork-Id: 12130449 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.0 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=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1352C433E0 for ; Thu, 11 Mar 2021 06:28:01 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 B7D9E61583 for ; Thu, 11 Mar 2021 06:28:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B7D9E61583 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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=C28VcaNR0o3+o4/nd8Of/HBf/DR5MMvWpJzucQ+qW24=; b=Dje0E3VK0NqC2A7pOLH5bc8J5 9RPbyc2TaWD+V+qUr3BU1QT+/pkQU/uFTjXIhIvqL3+2tqyyjgRW4IHCIlvi6SbkAiuxE4BCU8wqx DaGkJiHSXtuQWsOfRKV1H4mhy95ghzftE237Ffad41oxjMC1GihN8u5KKqeo56IFTSlZhIDDhAFsR JIPFu/hTnELrsv+N0mZvjiewyYL/vQl1xisdKtVLI1ex9ZODTMxne1E+21UDoxZk4Gwjivey+KrRB xIMLIEn43eV6kWmVmewNpHJKNTDIJaLgut/d99R8YnScSKkOK+VkXBXB2ABV8CV2q57unLccWBURa 3IszSbMyw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lKElW-008Tu7-Ah; Thu, 11 Mar 2021 06:25:47 +0000 Received: from mail-eopbgr60046.outbound.protection.outlook.com ([40.107.6.46] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lKEiP-008Sls-HC for linux-arm-kernel@lists.infradead.org; Thu, 11 Mar 2021 06:22:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G9JeHM1M6YqumzxQWyag2U6BXkTyIRF1OyMCD5i+SmGZPTySckGKfIrNFnLqoMScYGDWt5Yfjq3uqvNy8/i384d/H9T7k8AQ37KvRZtiQTAGd1cc2cfEIw+fLQ/f8IjL00Qma5dT95+9gQ1Y4RZWOfWNMyeSVDHMS1KSNgfdUEn6NjIzutsZltlId15F/011StdHvb3i6QL9s6kqQqB72/g3zQrHcrOc7kaamdoZ2EnEFgph2Aycr7GKOIq8m2zNAGkCN0CxrYZ42wk5JfOwLFxS9WhpodI9u3jw5e6NLJ44s/Rf5BY7zRfFfJupH4oItEqnzIcgcQscETxYvHsTTw== 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=FbeNqHN9xOSnqFb3oOZPxdTI8st23xm44ggrUr2CeK4=; b=M/kTxJ9HBqC2aelBy+6FTTDPOq5gutCViNvpsNDEtPEvu9lha0zcBWlDlayYetA9us2/Ros/+dri2sHFFz65n/P0TucVxpro0s0+Dr4erZtjp3WYSgRy8EtczFxWZvDc/bmaDs5BkviuZIDyLlMaudyU3xK9ZU6suxLwxiTro6fPccz2ww2UTTZKRcWsoaJmYNcjCTNmAaOOrf5smvLdvM6reOhPGLXVBPjoUfPqr1q1F2QbwtPUfhBz7zHmaf5BlRQWOFEHFgSMXvuPIsxvj3GNqRx2nYvOmKtF4HK1vEsliDXwV7HetoHK2DtW4/A9gqoseLGuJ0bjRMNRBgEQBw== 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=FbeNqHN9xOSnqFb3oOZPxdTI8st23xm44ggrUr2CeK4=; b=k5DipbjriJpySm82S1WYwOV4func9rI+CbglfCLxhO4Xf3bqvipeMsHcs1MXbnUne+hdSXvyAGh/vH6f832n/ej/1KaRGNe4y2pQFma+f36fW9moDqA1YwD+fNOXTZdk7Yw3W2HWF5N2lZ0k64V0Ka5lLYMY9yhrfMWEN4d/HiY= 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 AM0PR04MB6611.eurprd04.prod.outlook.com (2603:10a6:208:176::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17; Thu, 11 Mar 2021 06:22:31 +0000 Received: from AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::1cd:7101:5570:cd79]) by AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::1cd:7101:5570:cd79%7]) with mapi id 15.20.3912.027; Thu, 11 Mar 2021 06:22: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 Cc: linux-arm-kernel@lists.infradead.org, Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux.cj@gmail.com, netdev@vger.kernel.org, Laurentiu Tudor , Calvin Johnson , "David S. Miller" , Heiner Kallweit , Jakub Kicinski Subject: [net-next PATCH v7 12/16] net: mdiobus: Introduce fwnode_mdiobus_register() Date: Thu, 11 Mar 2021 11:50:07 +0530 Message-Id: <20210311062011.8054-13-calvin.johnson@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210311062011.8054-1-calvin.johnson@oss.nxp.com> References: <20210311062011.8054-1-calvin.johnson@oss.nxp.com> X-Originating-IP: [14.142.151.118] X-ClientProxiedBy: HKAPR03CA0026.apcprd03.prod.outlook.com (2603:1096:203:c9::13) 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 HKAPR03CA0026.apcprd03.prod.outlook.com (2603:1096:203:c9::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.9 via Frontend Transport; Thu, 11 Mar 2021 06:22:22 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 55f2d28c-f105-4e60-7ed7-08d8e4560d08 X-MS-TrafficTypeDiagnostic: AM0PR04MB6611: 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: AbKDB6n53heb4je9uikNKVJ2Z2UIWP1/GV+aAJa2/EfZUBjkfcbAUcCsiejNDxk87X8XTKbCCeJtXhVo5TGh5amvtAdj+yc8rMHsaUA3ykMwu5MLzBAPbo2f5XR6iFj3yjpGmqJgirjzu7ex7Xth1uN+z6Mu98VT7HiMeYY+SDzsZktDovEJnMK5fDRzyhtDtqGk8/5jgg+dXIc+6kBfUpMp3Lz9pjwM1Kig/CQCM2z4HyqKCrJakVrRjqUs8gBk1t0dHnOpjjokVbHf/luqwToeEDyOVcTTVaYcR6nU6RZLkfhHCHp2gXMP6eJxBYRpBUEaZgsEqeMTjSrMYgJncpkq6zcNOzEVni93uYGb+Adzn2mtHVFIU1CuoZ71+xgDYCVpKZ3Wyg/lNnYL23GcoHZmNTnyIop4tOjwcB1sWEyEIVkHZPIsJo7qGcUPfqXPw9UzVMExGVsEwNtq++SemPM5UFVZ6UyP8yqFNYsbvSe9AhcUoflfiC1AKTSBYK9LQoCYW5WYn7MJaPd8oguLHdHttAj4MSfAjMn8tsDK3tX1PGIjY4sU74fnwZKLtXjWskduekPh5GruwYgOgnCwy71jfcT0xES1ZeBuJJL7o4c= 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)(39860400002)(396003)(376002)(366004)(346002)(2906002)(921005)(16526019)(26005)(186003)(6486002)(8936002)(6506007)(66556008)(66946007)(55236004)(66476007)(44832011)(478600001)(6512007)(2616005)(316002)(54906003)(5660300002)(956004)(1006002)(52116002)(8676002)(6666004)(110136005)(86362001)(4326008)(7416002)(1076003)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: q0/WAhl1WFRKfhp0SdZdpCB4LgsD136TKY0EHxJexHs5BnD6E8b2osE4z0je17KLZvedzsSSuOhM4aATQBlhsfe7RN6D+86Lv5sT981R1MuT4TiuyfSutyDDxTkGHDudZ2IECb1aGGR02Azvlsu0rEQJVUZLah16PCuQuXOIEm2V8+mcoEsnCSksJFK2n8QFZCnQ2CijHIrZ6KhbpJ1blatjxQcOxF6xwmdwJFwNbVu8FVKz2sGFsMkN1TShY4JSec/OeoHORWVMac0ZBbBf2OB/Q0slxO01dxY6NEzgLQRbfKsjI4Rwx+yMpnOllZ+dEP1f3Btj9tS1fW6RZMuZvBQlGIfxFCOfvbpehIbtOQuiicwrbt3EMeFvMLvUcmVtxucCiSVgcpW1F2W3btZib5pETr7px0EGIM7hnnsjUMAeaszscx1lhU0rUw8UC2vktg4fuPEHFwxnobQYwiLCg7y4RMuEgdgTSpior/AT6Yd8O8QKDymEkU2Q+ZTSEfOgxZ/xdPbPyhzU6IFuB8Qp7kWP93vwJk6oYXurUv3l3gVKAiQpJ7VmV21W3NlwTwFtchq/nRMWmoe8XLIorEpRedBQOmuSXlzfrnvjQyntrODuukLJJUMV0xO94W8DyOGixVNvKGBez5jdx/Urv4Zp607yzF4DJeGPRbEyRztb9EoLU4OTGn17WHo/wXhPe9GzX5vXtVzfVkIy5xe6uNIqCFGkcJGb6+tQm1n3ATMgYUnNlLC+ho9rFwFdAbWli6bFaFLNwiqlnqZcD1Wy/ojhiFM0sWoXemBuESXpd+TZtmaG+R2jhkJ+lahWEJf7b2fCsGY7QO1DNiV9hv0DoWw3MAu/v60TEJur7ydfZe3ZXE1HP/hD3uVapYAABeMzc/lfsAUaKrHijX7pnF6XMo0a5S/woh/6gkzy4uqcvBDtSvl6Ycut/z5v0y46Gd6yEtlm89/Q6zyDAnBeoAUtGNm7MoO+ra5mBaWM/P7x9pLsaPP4kyWo55kCYIZuCrHa2q9sDi4a969V9ciBpvIUCTFrAxuDu3I0VMJpZv0b7pSJGCw4lCZbHkIR3xxXS73N3eNvrMKVieNJgRseHkO3+CXHVX9WSvbuWs+kTfw6Ktn9+95+5Olr906BChjyMroUS9P2fmaxrQ0nKpGc9TaU2xF10aSozbhF1oA+rROGE0ynZyuwWmfjbwV59G9KbRnHCTuwC0G0PPZtmYHpmh8INEBJ7AubsIVlOHffxGCAXhg08xrh06sG7bpj1VkKmCaqqhJgOb0Pvex1A2ONadaoOjZvv/xVZMNlHqCTH0XNwplbo5wVxLJArZIoFfTNHTznW9dG X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 55f2d28c-f105-4e60-7ed7-08d8e4560d08 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5636.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2021 06:22:31.3424 (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: icWiSvD9ukvZJtRGgOGwYMRQbfEw2wa3LJt+24OzKyVTwEH7kEN292fmt5cTIfpZzdNJ6R1U+ODiBgdulxM8yw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6611 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210311_062233_854048_AE7D5305 X-CRM114-Status: GOOD ( 14.74 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 v7: - Move fwnode_mdiobus_register() to fwnode_mdio.c Changes in v6: None 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/mdio/fwnode_mdio.c | 21 +++++++++++++++++++++ include/linux/fwnode_mdio.h | 5 +++++ 2 files changed, 26 insertions(+) diff --git a/drivers/net/mdio/fwnode_mdio.c b/drivers/net/mdio/fwnode_mdio.c index 0982e816a6fb..523c2778b287 100644 --- a/drivers/net/mdio/fwnode_mdio.c +++ b/drivers/net/mdio/fwnode_mdio.c @@ -7,6 +7,7 @@ */ #include +#include #include #include #include @@ -75,3 +76,23 @@ int fwnode_mdiobus_register_phy(struct mii_bus *bus, return 0; } EXPORT_SYMBOL(fwnode_mdiobus_register_phy); + +/** + * 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); diff --git a/include/linux/fwnode_mdio.h b/include/linux/fwnode_mdio.h index 8c0392845916..20f22211260b 100644 --- a/include/linux/fwnode_mdio.h +++ b/include/linux/fwnode_mdio.h @@ -12,6 +12,7 @@ int fwnode_mdiobus_register_phy(struct mii_bus *bus, struct fwnode_handle *child, u32 addr); +int fwnode_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode); #else /* CONFIG_FWNODE_MDIO */ static inline int fwnode_mdiobus_register_phy(struct mii_bus *bus, struct fwnode_handle *child, @@ -19,6 +20,10 @@ static inline int fwnode_mdiobus_register_phy(struct mii_bus *bus, { return -EINVAL; } +static int fwnode_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode) +{ + return -EINVAL; +} #endif #endif /* __LINUX_FWNODE_MDIO_H */ From patchwork Thu Mar 11 06:20:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Calvin Johnson X-Patchwork-Id: 12130453 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.0 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=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF7DDC433DB for ; Thu, 11 Mar 2021 06:28:48 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 B1C5864F34 for ; Thu, 11 Mar 2021 06:28:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B1C5864F34 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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=MjyuyFp3wfQ85HsJe6oMfF1kJOjPwwqOmGz9bglrx1Y=; b=C11RqdTjOAvR8bN/FX2DPnALe wXzQJEUfgy9ROhJmUVzR3tTQXR4byPhFLASU/Rl+AUIeTOuTxem0sQj0Xpq8AR/sHF0wSwC6VCJhR XNJ4M9WTopTKZFyVChOaCn/gvsgtUOvZ6kHjk5zCpvwe4qijSoTqkdsgTDxMoCT4NKmvrxjwiW21H UpT4EH+oDjXJPnLeCPtj3lSxbR9UrwKIirNYNbETUYRhpostVEhvx8K8tyAW5ZC4ysWVQG48eNZlE z9ef4azR1mM4h/oGRB31PnDQxtsWiRJh6L1moHF3i1dO3anyE8W8MrgxWnUThT8PbDODcOz0+5sIR gZz+iiX+g==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lKEm9-008U65-A2; Thu, 11 Mar 2021 06:26:25 +0000 Received: from mail-eopbgr20068.outbound.protection.outlook.com ([40.107.2.68] helo=EUR02-VE1-obe.outbound.protection.outlook.com) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lKEib-008SpP-HZ for linux-arm-kernel@lists.infradead.org; Thu, 11 Mar 2021 06:22:48 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cgzDD08YUw/XA/un7rfP9PXH55srMugWSSbcV5kTLM0CHxWqsg8pniGABnrlWK73askXjeKdR1sZ932V59kkKMUWBH66cK+AIB43B6MT4+iOsLQLB+ECb7EKdoZSIBs/ieQ034lchPENhuVyxP7nalnIIxoiTz+K9BGTHXqAZaNVrVJGbh8bY2O7XUq+gFk4jUluFUFJNjRhMcb14YQtl6ydASBNKRh70qDZ69y3vI/IeIuB6sl2TryHKeEZfDRV4VKczv1ezPuQj/rbPMCvO8lipD8GYETiRMdiZq1VQmcWnZwHdOF6vgd0DxdpXs+mF9VjOhadRfSMHhbKoML22w== 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=JRYSLoQWnWnrDWdjSSVe8XeC4AwOa3fG5xSoEWPqlQg=; b=jTgOP+6X0URNPlctdI6fd9sqnGsbVB0h5ICMcFTeKcCwPdWydzipAn2Gc1Tbf+YWSRWXH0Oix1TcG7pgaGRFnhuSBb+/X6Vall89fl0gPmEYOSPfRpD3XavGIej3DvOjTg5Cvqzst5TKwBx3FoVPi6vpLFf1Pf1f33SMk6nm6HA/imsCfwSWi0c6YWgQGJNUqSRHtaHStrJGS0ew3yBsscRrQoZbKJgC7Ij9CdILLYwAECV8CB+cSQWTX8ncAtUJbZ1Mrz4ws1Xh4Ol1qc6KNWTa+BQin2gRXldLGgKR/w8aoaM6o2LePcXuFDWeEBjN8ELbHWVnTwCARLoat1EIpw== 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=JRYSLoQWnWnrDWdjSSVe8XeC4AwOa3fG5xSoEWPqlQg=; b=lDFUu5ffTns/HCqFZLjuX8APwoPPH3eq90livlZ+qhZTys0u0u/OUacKWyBwtujkMKF8KdElVZV9+V6J7RTchESExe75MtUrabgRBQS+O3PAQ4uMK5Ij4Z0wM0dkYrDpW9jsNcpLfqveMyUwTj+dyblAmitVtU80rBQ9rwaxy+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 AM0PR04MB6611.eurprd04.prod.outlook.com (2603:10a6:208:176::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17; Thu, 11 Mar 2021 06:22:40 +0000 Received: from AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::1cd:7101:5570:cd79]) by AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::1cd:7101:5570:cd79%7]) with mapi id 15.20.3912.027; Thu, 11 Mar 2021 06:22: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 Cc: linux-arm-kernel@lists.infradead.org, Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux.cj@gmail.com, netdev@vger.kernel.org, Laurentiu Tudor , Calvin Johnson , "David S. Miller" , Jakub Kicinski , Jamie Iles Subject: [net-next PATCH v7 13/16] net/fsl: Use fwnode_mdiobus_register() Date: Thu, 11 Mar 2021 11:50:08 +0530 Message-Id: <20210311062011.8054-14-calvin.johnson@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210311062011.8054-1-calvin.johnson@oss.nxp.com> References: <20210311062011.8054-1-calvin.johnson@oss.nxp.com> X-Originating-IP: [14.142.151.118] X-ClientProxiedBy: HKAPR03CA0026.apcprd03.prod.outlook.com (2603:1096:203:c9::13) 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 HKAPR03CA0026.apcprd03.prod.outlook.com (2603:1096:203:c9::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.9 via Frontend Transport; Thu, 11 Mar 2021 06:22:31 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: b1fa9b67-3460-4608-1915-08d8e456126d X-MS-TrafficTypeDiagnostic: AM0PR04MB6611: 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: HsIT2ZIye23GnY3ng2SbI6UHGM2cHFoZxHfoykxzldi3h7ij47DauGUaBkdGvFl9qeLQE29OhMTb6H5lrKnNmjl/bVuOtAbBll0wWMPDXkvv9C3vMH4CRLXZEw/7Mp7+CLZQMsEiTVL7SLlWNt392s03olWYvBLZKBrydDrrqZEqT85y+HfvGKKcsfNqJO+nG/KMI51dCZyOi4T23KGJXSnYtcqLvpA80ZJeaNf2QC9glSgu6Yt1QRTf1b8kFYPTUN69pBcxTo6XwIUsRi/JO4MTOsFkgDqwqIPJXlkckTzZFF8dQyy+RUSnHJEYRVV+uIc6DqQNTB+VaPjysH671GavJTidWDADdjk89iSD+QOMpgSgAvYJipX/6JHuYCM9PXFCxFeQxgL1vUlOXuQ7/4BqT7K9tYuRx9WCXYpwyfRYd/epr+LjqrQpVyCF02vFog+Nzh4tTTx/QwyixxBCeh9rsysKW5i2axxglgL7DqEEP4WGD74GgUpP5PfAQxuiUD+iAtpsbmqQlpZvPwQOIc+pNb39/xEmkz7ULx1mRJpfDPfX/RRt07mYxB7nWYWyfRcrMy13QU91uwavtLXqJl5tQUJUOCkStnGwobPbEZY= 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)(39860400002)(396003)(376002)(366004)(346002)(2906002)(921005)(16526019)(26005)(186003)(83380400001)(6486002)(8936002)(6506007)(66556008)(66946007)(55236004)(66476007)(44832011)(478600001)(6512007)(2616005)(316002)(54906003)(5660300002)(956004)(1006002)(52116002)(8676002)(6666004)(110136005)(86362001)(4326008)(7416002)(1076003)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: ngjW4FxRFlk47LpVIUOYqRezdj5/51C396RCTkPTxA7TYnI1rduydHp1JPAIsmfsFlZgkp/sOAnDdT71iisIjeIxu5MAd7/IAmNgMbk562Yrs1FFjDyhM+3hZxGWBYjrn+62jfoRe/ZVKwqh0oqbMsjhoYJxnjNAetuGp/m8LzA0eS0alZr6EnV6IbnldzxWikRt9f8VTuGL68+j0E8lD1voRzUbh9sXe13BGcfmt3onp3smddG1fw9ZAQ3MO9Q7QyuQIGMlKxbZB4OqYgj0nH6t7nEtKJ3QHaFMigqCfDsQG8tKw7ZAZU+eMi/ylV+lrEsSm1mlDnGn9w5rAMf3mKtwZOEyWw3MQGSyCNq3OJp2EviRGQ3rZ5HSDDuyojVNPXYhIblqeM8e9hVy0NktSvve329HtKBPh9dbVULc7vcEKPhdhS+5EtjjTfbpH3tk/SC0cM5qGpQhT1nJ/jlIThT4kKmU2fQ+Jbu9mEnIhH00VIjMs9ZOUjos1h9byff0P8rSZRMssJxQBkUYDvlud1vOOQjPLX32Gw4fh2/r6ZDPLX/ZO5MIEz34ann9nGwE5AmWFrvzm2DI/pyNW2oe3n9NecwfbeUyGfyEqJbpt2oHjWnDAwe8p1xmHF7tIcd7UUWenKChdsFO2Qu2gr8o+W4T/Rh8ZTP7G/FDs/nhbf7ZTg9cxLLuA+mdxs8y27UKhlp7sW8p+WXJBx+PfaKa9LZq5yjijTqoh+QuaIeixvUpYVorgkB+23QiCkO7NrxxlK9PWOOXQO5bXiDfs/Y8r5Yn4Uop4OCSy2531kALl4uCtNbkEZb/3/61i1ar05tE7oxQB0Jp05a3YwaFx9n+g1NlbcCe9RFFxUVoToKN2AzKJrn+TZHDDW2IV8JT1Vr6KSVkI8t2DPg+gz3LH2OgxNupwdACCxR4/g+VZYPEDQEC9SZBT4SGcq4abMTvyUsva7wGkpqymp1d0SsEDjWrEp0oN1Xp+3zca1RglQvep786p0jKKtZ5X0iGLurAbXKLkSpp7YZuCMJHNFWwOFQm9MxJwrCOWAgrjqayZQ5J9dUXBV1n5Srrfs5ELAJ1OkRzhZYu/fIADRiDaBmtvGBK3EDw/63tVkTn8TdkS76AUDxe84ciE6EyZes7Kg/n+SRAPzZ2vKSO5KrzKmdOFIN2oVnoSpsCzO97KvxXRqDn55rrF+a6zqCXZUI9k8VwEf4Hi8lNpLtVWA9dH4rkzurumb0ku7ypt0myCicnTtSFf97bBSC0E7Kks7c2czRFA3SJFTK/AxpHumFa+D2FsISZ9DShfLTmJXKWH3SpbSReAYErTCfyQW3j5unIAdK1IRKu X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b1fa9b67-3460-4608-1915-08d8e456126d X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5636.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2021 06:22:40.2853 (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: FHiw9hl0zKFX+pSkvfT5evDoA7SNvRPK/IPzt+Cw9WwOuQlX2z4QjsANN4bp/7aYQwMJh+bwS9fjWBRbABEzAQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6611 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210311_062246_504161_C089CE5B X-CRM114-Status: GOOD ( 16.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 v7: - Include fwnode_mdio.h - Alphabetically sort header inclusions Changes in v6: None 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 | 22 ++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/freescale/xgmac_mdio.c b/drivers/net/ethernet/freescale/xgmac_mdio.c index bfa2826c5545..6daf1fb2e9ea 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 @@ -11,15 +12,16 @@ * kind, whether express or implied. */ -#include -#include +#include #include -#include -#include +#include #include +#include #include -#include #include +#include +#include +#include /* Number of microseconds to wait for a register to respond */ #define TIMEOUT 1000 @@ -243,10 +245,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 +280,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 Thu Mar 11 06:20:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Calvin Johnson X-Patchwork-Id: 12130455 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.0 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=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C402C433DB for ; Thu, 11 Mar 2021 06:29:08 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 5374064FAB for ; Thu, 11 Mar 2021 06:29:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5374064FAB 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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=1AmbxGzemv33kB/3/q8vv62ae8FPzfh3NzEoRc94h+A=; b=GfbC8xm4dYNj7RbIaHVsv+vy1 IOHfasZSxUom+08LgRZwymvTJRaFzcawcl0+Aiw38wlYaoNERpYtcytVwdqdq0fWrFWx6QvG59uwS DP7mbHQ0m99oFeZHy1FzaRzJ+yzUbzOeU7WEhJdJe4EWrIG8TrwuaQO/xVjGaWxQWA25/RNHqG+nw bn0mOm/El3fCTW4K4ILBA5LxS5nle0FtrT6lZ2WNIi6bgc4KYgPk9WDicy7ojPA6kBaqYqcrmg9F2 +jffE+LMFyv8mEctKchcbopNQCo+dn6YyV+WWrM/qTKm7fCSEKOtiPmW7UmnKWWxzMl9IO8KGfANM Ynizcrqfw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lKEmo-008UIV-UM; Thu, 11 Mar 2021 06:27:08 +0000 Received: from mail-am6eur05on2081.outbound.protection.outlook.com ([40.107.22.81] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lKEih-008Suf-L9 for linux-arm-kernel@lists.infradead.org; Thu, 11 Mar 2021 06:22:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NCve/NF/CZsq6cU+ddS/5IgnguJppb0XEiv77ePjVCY/p4gS3u3GDOlxbNxzGpRU3fZt5tLDYLkOcGNGPdFXpvkNvG7xByRrBSfUKqt350nAjS5cZa2bmfXnv+SAHxDW/VDUJeVADRbx5SzP7zItNh0xYs6hiontliXpvxXq9frTMHv7y5BCeBScht4PnWjp1CAsX0WbkS+uxunVCCKHB2pULeyybCnAgao1mUUsSQmQ1QDNSHhiNAxpukqdpzEjSqxHVmjW6mXZUAA7mbXrHaSI/mudhLYlxFbdObnCB7335eJvXHO/uLwQm5Nn1nCmqkcNQfJINlQuOZd3lRpO+w== 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=o5CCUYQ4PNOtdIpFWUnwN02iQqvVrzm5w1kWzIjVu5E=; b=i1Lo26b0eAWlj9oFvvOJWNFbhWDO5Eyo+owIa+XLHzsnT8kjG3GFH/DyHv8BFTjzmmcDBw0clku352yqwtvorGsnEWTPRWO6mniIdq0lucmkKfwVpO6g60Ihklk5zbOtg0i/4keRQbyVSMPDzq3GrwBdhzXfkVU8h0NprjUv1JANZRxHn1HCt/5NRBdBDbM2WxGLaVjkLwIOz7X1uItLl5XTfEGyww02pIL+yKYrznOcUsFHC8oBV+Q6pU+wxR8yscfaALsm5Xxgp3FCQi5hY+CfjsSCD7+kF3balOSvUXkRoqFFDfWtYtaDwtn86IoQYhJi3De9Md8H2e/eWrohTQ== 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=o5CCUYQ4PNOtdIpFWUnwN02iQqvVrzm5w1kWzIjVu5E=; b=TQx15zqRrAtpJbWPxMpF4PLeU8yUHxEkrD8MmF1kUJqu4A3W5qfheWshR8lfh7oWGg1oo3Eo+QOPWIa9DNvFRazkRCfbJ5aKBdOSF0/dQZYlSM175qC7MycXiAwzem3dztE8drPeLMY9gpHEsMZL+7akFQXbk8Jy5m1eQvWS/7E= 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 AM0PR04MB6611.eurprd04.prod.outlook.com (2603:10a6:208:176::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17; Thu, 11 Mar 2021 06:22:49 +0000 Received: from AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::1cd:7101:5570:cd79]) by AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::1cd:7101:5570:cd79%7]) with mapi id 15.20.3912.027; Thu, 11 Mar 2021 06:22:49 +0000 From: Calvin Johnson To: Grant Likely , "Rafael J . Wysocki" , Jeremy Linton , Andrew Lunn , Andy Shevchenko , Florian Fainelli , Russell King - ARM Linux admin , Cristi Sovaiala , Florin Laurentiu Chiculita , Ioana Ciornei , Madalin Bucur , Heikki Krogerus , Marcin Wojtas , Pieter Jansen Van Vuuren , Jon , Saravana Kannan , Randy Dunlap Cc: linux-arm-kernel@lists.infradead.org, Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux.cj@gmail.com, netdev@vger.kernel.org, Laurentiu Tudor , Calvin Johnson , "David S. Miller" , Heiner Kallweit , Jakub Kicinski Subject: [net-next PATCH v7 14/16] net: phylink: introduce phylink_fwnode_phy_connect() Date: Thu, 11 Mar 2021 11:50:09 +0530 Message-Id: <20210311062011.8054-15-calvin.johnson@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210311062011.8054-1-calvin.johnson@oss.nxp.com> References: <20210311062011.8054-1-calvin.johnson@oss.nxp.com> X-Originating-IP: [14.142.151.118] X-ClientProxiedBy: HKAPR03CA0026.apcprd03.prod.outlook.com (2603:1096:203:c9::13) 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 HKAPR03CA0026.apcprd03.prod.outlook.com (2603:1096:203:c9::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.9 via Frontend Transport; Thu, 11 Mar 2021 06:22:40 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 975bdc41-d9ed-4dbb-6aed-08d8e45617bd X-MS-TrafficTypeDiagnostic: AM0PR04MB6611: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2657; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4k/CzVPQsx0YtWAFnhlfcxa2pI357RncH0Csd1N5RaxTSSUHBIz5CJ/MLXASeYuV7lc4Ka9DHZfPkpgS3d9CQJfwWSt+W/ov5Or6jCtEvCaQV7F9EmQ0/zSRxY3EMX7BPVcOw1QTNyg4cI5AyYq5+fDLfWWXyF+aLlU0vrYt58a+r0wZNm+pgk5slc2fdbDrmo6aL/nXHHw8GqmWAKaP17M0wH4GVb4jgUVWJpXBe+pKqelRIMWib2aP+Vtes4W1DHD4LfMZkbTr/jxhP90t8VKagJyNLTXypfWN7PGloXlcfuAzCVf3FDZDmrFQMpBNSFpeSX7DmVElQVLPVpWBanpLLXNairq6BenU4LKUHRO5GvjbVR+2E+kBehuHvE3wRIgqpYQey2RT+FUbqglTa8ewCTETPeJdkuwFUffOgUEPfDgDKJqeA7c5YnPVfBY78/pXiaHobIJn/AwGB0wFyU7sHXd2vlvRGZnJdI0BqI0Iaqlj1EYwfCfNVydMbmp444m2VbrZf42Bb9d/9KT4vYEJjQr2FEQsFK6fdgsDjV3DyjMw44RBPheMc4I4iLHpRHTq2v2aUsJF4mO5UvN79SaiErE64rie9cA09MlmFJs= 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)(39860400002)(396003)(376002)(366004)(346002)(2906002)(921005)(16526019)(26005)(186003)(6486002)(8936002)(6506007)(66556008)(66946007)(55236004)(66476007)(44832011)(478600001)(6512007)(2616005)(316002)(54906003)(5660300002)(956004)(1006002)(52116002)(8676002)(6666004)(110136005)(86362001)(4326008)(7416002)(1076003)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: d/y2z8slzKSCxOh3yZ+BCH1yXd5lhhKEmfU0bBxe+eUUiO6QEal0XvNDahh49TZ6A6YeqwAnKS0l9AGtY3QgcbdjyzWrwAGjW6oZ21rVdXQYFfgDZx85hNXs8+0WjmXmQXN0lEjHO2hNMGwnwG+DLk8zwnD15kmCmlvZwKDz2HU07A/hpi+tMaVm+1VNZjjPWjxKp3YygMBLQRozyagpKVIBHWZBBrTXRg2BZTj/hpD8KQJt4cC6oNG7P93MjzPVROP4OjJTSxibXrcUn1DrZmnfV+rVn9+FcNv5+hHzbPN36x5utPm5TaWmJ9yQcYxldkZlI6EuzVyFkTvPBFxzh0KwDDNAPLVKJaROOMlMv/NrIqfzg7GjoXNiBQSFwUx+5T9++cXixk84YxiKcqo26J0suQ7+5culFSl38O3EY+0HY9RijoJnWw6U17heg81eqnXZqkgLC+1ZtvGQd+icsDDU/P2lPje/g25lO6BLl8XOrFHI2HIbuSsGT+iCnojmCaHgD666LgBsm0i/Z88wZa0gxuywmQIcALgwsLkt0nKVi/HZje0HY3Uq9x9WLRdUKs+N9wmTMSfKvPD2uI0INx4DYTzkMaOGELZp4YDCFrH9Iw+EGaQ+lN7Xn5e+Rieg3r4jgXMbjF+KwnWPd1BRCI0vL3xBtwUFvngE5VAb00vi/9FK3cDFHLCSEyD/UmiF2nHvlt8l1UJwSDSrC6vajkchfOkFzOpf+oJlaKMaOsx0RO59FMb8oyRmxcCtJ0t7QyDFbeU+eWe427Y2D0W/RawtiRNMDciiwAsVlGeGOhEFboPCnP4z7T5B1rU0/swP3BzINa3Cwb8GOFyGHItU1C5Vs92NHX1ZzSbS9JBRA8VwNf8hrWr1A8ZZe3GEB4iFvUorRRIYqKKZS/bMnI/g2IDLLgerFSah0iSO7eg9a7Z/f+KMPpAbwiCawu4LvsN2fMtPRA4CvLZ/G9jArlwKtFPaxmp1gkbNps8qP0NIWO08ge4tjcqfAY6VBhOGY/0/0Hhl498Te3vySirqcdIyLesb8gZBEJdKvBAHL36BvEZY+QJ90DaP+hIkQ60NywxY1JSU8SN9/GoOKM9N/kYwzBIan8VTMTPQGNZag/Eo8SwGXe+N2MTYHttmTq6Imm0oCNki7KMvwegLzc1a31sJOXq0754g2FitSnI8Me6bucawjIRTtnIGNmp4wIg+Ih4xU4N9h7cqoaXzdwrJeLd2ToKf74fIUDfqX3khQJXbp73XXjeyog5tv5kb/Hnzd5ZqIaGLfsqZnL7ng0OTf4IkAiHmwibLY7xG2ubgerN1U2Um9E5LsoRZeMl/uhw6YCht X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 975bdc41-d9ed-4dbb-6aed-08d8e45617bd X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5636.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2021 06:22:49.3153 (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: TegvOFwmObRKHH3PNyQLvQww8tTgB4lnJBZLUyrcRGMaJSstw2+RPJ20pVIzRUUXo9pyAHhF2XRPjeJ6eOLJsQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6611 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210311_062253_759266_06B2C4B0 X-CRM114-Status: GOOD ( 17.37 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 v7: None Changes in v6: - remove OF check for fixed-link 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 | 54 +++++++++++++++++++++++++++++++++++++++ include/linux/phylink.h | 3 +++ 2 files changed, 57 insertions(+) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 053c92e02cd8..23753f92e0a6 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 @@ -1124,6 +1125,59 @@ 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; + + /* 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 Thu Mar 11 06:20:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Calvin Johnson X-Patchwork-Id: 12130457 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.0 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 DBC85C433E0 for ; Thu, 11 Mar 2021 06:30:46 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 E341164FAF for ; Thu, 11 Mar 2021 06:30:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E341164FAF 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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=4CsO9Ur/ry8OW8EzIvhOyReAF2V3VUWcaBcrtwClZgc=; b=gcnx80/Vv559GfpHD3wG2HkkY SH+qK0IDDCah34pX0318uOCu887d0wSKpA7dDMWdulLoOJKDZ6qGajmWSfzPs25QBCjdFHcg0nnav XwPN92ZM2RKpr+Nlw/1W4L31DvI7Zbimai4DOJmzMv9bFHkhctwxBq6yspMUhkXd/dam5m++Sumzo 9zq5fjf2/5GR/Z3ur4ut/9JELC/Qzc4vuaf5YBp6n+WcFiXNhBxxPRRgSce4T4TnkgS3s8BHWvyeg 1TWZGy6Ac4jSwqQxwSsYcet5o5LyqBqdNY4RuFncy0a+e/ZEP7kkrDRwAD5QMvoibtCIMM2SSj0XP hRGDTEkGA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lKEo9-008UeX-GD; Thu, 11 Mar 2021 06:28:30 +0000 Received: from mail-eopbgr20051.outbound.protection.outlook.com ([40.107.2.51] helo=EUR02-VE1-obe.outbound.protection.outlook.com) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lKEiq-008Szy-PT for linux-arm-kernel@lists.infradead.org; Thu, 11 Mar 2021 06:23:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i54lwoEgzMD+1NVQ+cJso1uOa7ewEG45bjBTh4Sh5WoUSWZJctzfcu7Dao+TbUhcEi80qcV7b/09YHl7809YLwVqkt46N1AWWOlljrz4Apdun9uOdoJvmZp+YTvhTVEFVI4JZZCOvpq4tv9F593Fi8qaNejEwVDIrIYEU+/WPLWcs4Nf7/WlvRw8NZ9nE/3pvJiLmCyj0wTQ0yJWaNjBtVf/9dCnbPVhMvQMmCyIOj68XouwFxElGtgP+Ouq+PvvKsaL7tY0fuctVFJ1on9s2//Z8Qsok7TXE39qrpgphzDVo143U0P4/ht7r23Wlig544wONKQFYBdZe/WprpuuOg== 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=j7SN/BUqBAwlVBwCfUUBNaCGolKQ5r3lhz3ovvjZzX4=; b=jytBh1biAmfOYcuL16vTFtN+B6KnPyVUSmS7RTkb794Y1UjaSA1Xwe1shocGyvzG2QWMPjn/m2P9zQ5ZKb77DdGrdjx5CMpQLbkOELr+mxfXZeLSyJoebmIMuUZqFojow8FS8UhHYxQHAfngFawzpcTmE5PFb2fPYfNfZAwbaRwpdZLPn6Urq2X6FmKzu192zexsS0sPZbs9KRtGjNtJWyQ9YAcYF6igbOP5HZtsumWhHiUHX1NdRVTH3oi9HZeENzDA7N0+UmCVuqWiRXZKUrp4c26S/uNiecV6BUkxcGn8C+JHAMZXoGcAGKG9aMX5+8ilVrxo8ks1Ars3J+RBAg== 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=j7SN/BUqBAwlVBwCfUUBNaCGolKQ5r3lhz3ovvjZzX4=; b=lpEii64k19K/Yx4KKHY3U9HPganetcobnJGDqQnQjlwRKpMfN5uGYquOo1Vv/TdVYiiD/iWucyHLK6oeJpZ6onuBo4mXdqHEwmD+h/mUj6tKt4UIoRBYl7FVD94lxk2wndFwx22gQeSoIPfqj+L+hefSWr9ErbmM7IPd+odf3fM= 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 AM0PR04MB6611.eurprd04.prod.outlook.com (2603:10a6:208:176::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17; Thu, 11 Mar 2021 06:22:58 +0000 Received: from AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::1cd:7101:5570:cd79]) by AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::1cd:7101:5570:cd79%7]) with mapi id 15.20.3912.027; Thu, 11 Mar 2021 06:22:58 +0000 From: Calvin Johnson To: Grant Likely , "Rafael J . Wysocki" , Jeremy Linton , Andrew Lunn , Andy Shevchenko , Florian Fainelli , Russell King - ARM Linux admin , Cristi Sovaiala , Florin Laurentiu Chiculita , Ioana Ciornei , Madalin Bucur , Heikki Krogerus , Marcin Wojtas , Pieter Jansen Van Vuuren , Jon , Saravana Kannan , Randy Dunlap Cc: linux-arm-kernel@lists.infradead.org, Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux.cj@gmail.com, netdev@vger.kernel.org, Laurentiu Tudor , Calvin Johnson , "David S. Miller" , Heiner Kallweit , Jakub Kicinski Subject: [net-next PATCH v7 15/16] net: phylink: Refactor phylink_of_phy_connect() Date: Thu, 11 Mar 2021 11:50:10 +0530 Message-Id: <20210311062011.8054-16-calvin.johnson@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210311062011.8054-1-calvin.johnson@oss.nxp.com> References: <20210311062011.8054-1-calvin.johnson@oss.nxp.com> X-Originating-IP: [14.142.151.118] X-ClientProxiedBy: HKAPR03CA0026.apcprd03.prod.outlook.com (2603:1096:203:c9::13) 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 HKAPR03CA0026.apcprd03.prod.outlook.com (2603:1096:203:c9::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.9 via Frontend Transport; Thu, 11 Mar 2021 06:22:49 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 0dbe97bd-b4de-4518-17b2-08d8e4561d11 X-MS-TrafficTypeDiagnostic: AM0PR04MB6611: 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: bmqrx5P/bX8EvYENr7SB0hGx6pfRSwAxNmVXA1lbA6dfdDq2dIsA8TedGZ50mo2agj60sNSqrRbh/5rTK7ld4ZZRboVhY1YMBVFCuXC2jyTK7bWyHoDtfreAbTtEud6c/xt/U0Uyx471rcbs2k391Npy9A+FBmAY3kfo15Vqfb0KUg6J6zhPH5KcR3Ab1LVAwFYQ8FSVHxR2tOkaGKZCYsosklZloIHqVE/mmG7T5GKsEsUO3Llk7FKmRNID8snMfgm+iseHJXdl065dBmwy2geTDEzerFQD3obX2mFDj58xi+mY00ZECVRrW/JLOp4u3Kh7xktiJAMXZpuZCeQUBfm/nEerIj+dmJVbUsnkCkZQhzbl68vzMvQWOpydDnaqtypvFsH9VWToCYK8zFLm9i7bpSj08T9HZK8aq16gP1Mon7NQOW82Sxf28N51gKMjTvTknS6bPywdCLHFe0JWshhwmN6N4qFoUMHo++eKz/efrr8cc6aaGnBqinIn+KA9UepKLpJQLyN7mF5JzHAYF6x18Lxa0TuLzcsgXko87KgO8KeHiXKrJIjxf7wWRVj/WVahEfKHESuDMXLGVh//Dw== 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)(39860400002)(396003)(376002)(366004)(346002)(2906002)(921005)(16526019)(26005)(186003)(83380400001)(6486002)(8936002)(6506007)(66556008)(66946007)(55236004)(66476007)(44832011)(478600001)(6512007)(2616005)(316002)(54906003)(5660300002)(956004)(1006002)(52116002)(8676002)(6666004)(110136005)(86362001)(4326008)(7416002)(1076003)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: p47z3aLYbeTyC8gzslFz7KGpTaJ792nXyAXkPF1ljyMYxM3gR3Y95gUlROhRtPaC8EDvek1ZLYO5JNr1SVfVBQJMERM0TEUvYxtenFLFkYzaIw2F3GOCF57T81m+AMxdjg3WM5TfKSpxU3jOQcHxoNOhao1cyjsWELPVz79Pee7ubFr11e2LK6fCldOpiAxK/Ik3jez6pdSFY656iSGPpvkEEt5hOIFrC2lM4h6d74/JLUidD6PpfjwBFgosDHSlYQpuEOcrwM8unsK2DwWyn43p7UVWt9+p7z5S2/sH+hAoNdnBYG2a3gMjvZwUBG8bZh9sMg1ojU8QgG+r2a2i8jy+/C6+KmwpHxLhRFltMqNFtaC2wutpJgpYBg2gg7Eus+1Lk7UjQ2SBUWFzR/w48D4sXI04GmF3B2peFkpACmS0EWBCc5sTABbA/DsGVGKiab97+NYyrhr/EKH3wxjLTHNojTMjYug61myevaGrWpbm9Q9WAbrQGJN2NjZMVGg9MAFUTHgxXPFAiOA02V62Ybr5B/KOts4NbUbMllizjBB1th2O2wWSqw3+wb0zp4kXYfP3W0xORPG5XNuWWsl1fI2C4x3amGL3LTRoE+yIB2MRld6+PGRzgx4ajtm16/VfsyKFFpmLLh3FSJYciD/lNK+x8U6vsP2DSbdX+8ox2hDYjbKvrjnJ+RFBKISqLQCFyLqvwKnuf+acAG4JcM/uYRUkQxyLkyJPQ8/KrI6Sw50VPjmfPV7ldR6Y0uMMuSOgHMVDTMkkJRHv8EdmlFbZKeyvPYXLQ35QZJa2qY2Y1AVTlrkRLdLsb1LFM0MagTjm4xFyEKTNYbw6Nd+T1gvkQd1RJDEYhtTeVVOOHvAFynKjTS8OMiT7uZD9cfMRArNzXmYDWF+EQxtT3OhvnReq+2vkfZGPiNdLvP054ndlRW94dCN3QxE+DtAQwqb7AWqTKG0aorgBtNJ5lZnflB3vTTo69XMG1Mhbpx6skwxunYGdjQWKiOi6ojT9FkHCY1KqeLop8Y5tIi3sE6XMcwGnOP6fUl5ehVgaNxi1lNSmW73sv1OVKp6+7AmR6/oz+Z7K8NupekeQeWPppY+Ek68kKTlHEViEDTAk4iCUf63u/XqiKKuwQWP6qhxZNYycDUHec9LJy4edlHEkFjpphj/HOTYvts7/naKRbPwrqTJAl+deMf7CydMe1DwanE9XY/5Z8SoNWU95/rn9aalHBPKyTnIeqQJGrKtNgSgURPV3+a6lca3hs4vBJ8YzWGA8QgSuI0YJF7EPpZcezOwMakA3vorhGteeEVJE7vIFO1z3vljU1gtnYqk3PnaEE7Xp68IF X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0dbe97bd-b4de-4518-17b2-08d8e4561d11 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5636.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2021 06:22:58.1273 (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: odbnNfMVhlbFGoXuNZqM24PONPzfORyTA7AHfxgVcoDTve8tWcldaWvjEcu9xpuhUuNL2gQ3Ljp9wCBhqvqxmw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6611 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210311_062301_033780_830F20BB X-CRM114-Status: GOOD ( 12.94 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 v7: None Changes in v6: None 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 23753f92e0a6..ce7e918430c8 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -1084,44 +1084,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 Thu Mar 11 06:20:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Calvin Johnson X-Patchwork-Id: 12130459 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.0 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=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 14BD4C433DB for ; Thu, 11 Mar 2021 06:31:34 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 DB3CE64FAB for ; Thu, 11 Mar 2021 06:31:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DB3CE64FAB 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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=6PlLZRDFzf16xTHZUBBjpDvd5uVcRIitimeweZRg6xQ=; b=eqbUUXZZksDmihdKW7qBm72yK KUxY/MQxepKdYJ+C/vPUxNoa8Wop5CR2FuoMlQv7e8blzNQZ5MwI8rtV+Gnu//nNWSiULne1G7azr C1CiRHeGceiNp0DuRHJXVFd9zGAP4r5GnXz1wSHiAd2jzHbzeASabeyov4cHkrk322NonCOWM7Y6i XoizVK740hP9EeGXkNkhvMhj5qc+iutc8FDIYCTr7fQz9b6tGJKc2kpTrx9ZUeDzq2zvUgqzxE5yT Xj9tGMAhpWS9baNbcJEuQd35XdVmhyhGUa1QN9lzMZfkgpZrLsaFgq5NgjH11EwRGfPCteU57OeDO ajSgOacsA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lKEou-008Upk-9r; Thu, 11 Mar 2021 06:29:16 +0000 Received: from mail-eopbgr20042.outbound.protection.outlook.com ([40.107.2.42] helo=EUR02-VE1-obe.outbound.protection.outlook.com) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lKEj0-008T4l-Ag for linux-arm-kernel@lists.infradead.org; Thu, 11 Mar 2021 06:23:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dvrpa0KoSFW6w7li76k7BOgmDOpcvs0Xhd2HGA2CcC+VEGfcS9HjZ0lbBsgePtnMizIXmmzgvkhhok08DoF0+rUE7DCdlLyoaMhhOlEH413domAGu525PX/01UIt2tl3RVrGxE3lD8hez8UYuKQs5aOsPNM7EWlE7wUJz9bGXZw5JHctz3PqJN8ClD4+t5AwolENxKKteeyyRcRewiNrKSn92w5/yuFtWP2Yp54cl/QycXN9gwSmj8YHxNYTodhgU3DalQ4Y3c4PBziGJgjnX8XZCy83U2OPIVyl2ZNZuJbspLiZykONbnlwi9ankC5HRtVgiL9VDdePnc7qe0Invw== 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=5BB8oRWGf6ebgOGGFaRhtiriNkAtzWGJ/AKVABejizU=; b=oYSE+zC5MJpPsPfj9V+vWYBhJlnShXTif49XKXWd6/xIR/Keg3QsjcawyKz+0ZhqtslE7Lqyt+zlMypz6jFcSUnqEWDykl5dUazvqpRIC5LOW/X8NRmuzV+ei0yIpORQPGU4QgaOafnvz4SUb0hnoLhobhAbM3a+JLkpme9sGRghZGxTgjbujw4mC/LRmLhz3H38r/UY0yrKzkUqtb4rhp+6dIKnBCpyNsMhxEm2MRD0Dtfwz7iY54A6tYPMe+63GUkMbCWqcOmwvSF1BoI7DYJeEX33CNbdN6es4T4D4pa4sbduvRZY8vH+GAc5oZSIH1fbVa9CcqjwyZvhvMdQGQ== 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=5BB8oRWGf6ebgOGGFaRhtiriNkAtzWGJ/AKVABejizU=; b=UZVo1kVk0iE0NRA2EBKjooN9AE8FfK4FQY29aTe+1JahtYDi2GihHOyUdlBpafZWjMqvNDF65T/oxT4x7lUTuM7mxCQtfJyUhhTwmQX7B61OPaRZ0D0Q1OG6MsaQu2PbrNifxSw7SAouc6gB+TG8YdI8ZYZuQUMQxDt8pRVCbF4= 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 AM0PR04MB6611.eurprd04.prod.outlook.com (2603:10a6:208:176::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17; Thu, 11 Mar 2021 06:23:08 +0000 Received: from AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::1cd:7101:5570:cd79]) by AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::1cd:7101:5570:cd79%7]) with mapi id 15.20.3912.027; Thu, 11 Mar 2021 06:23:07 +0000 From: Calvin Johnson To: Grant Likely , "Rafael J . Wysocki" , Jeremy Linton , Andrew Lunn , Andy Shevchenko , Florian Fainelli , Russell King - ARM Linux admin , Cristi Sovaiala , Florin Laurentiu Chiculita , Ioana Ciornei , Madalin Bucur , Heikki Krogerus , Marcin Wojtas , Pieter Jansen Van Vuuren , Jon , Saravana Kannan , Randy Dunlap Cc: linux-arm-kernel@lists.infradead.org, Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux.cj@gmail.com, netdev@vger.kernel.org, Laurentiu Tudor , Calvin Johnson , "David S. Miller" , Ioana Radulescu , Jakub Kicinski Subject: [net-next PATCH v7 16/16] net: dpaa2-mac: Add ACPI support for DPAA2 MAC driver Date: Thu, 11 Mar 2021 11:50:11 +0530 Message-Id: <20210311062011.8054-17-calvin.johnson@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210311062011.8054-1-calvin.johnson@oss.nxp.com> References: <20210311062011.8054-1-calvin.johnson@oss.nxp.com> X-Originating-IP: [14.142.151.118] X-ClientProxiedBy: HKAPR03CA0026.apcprd03.prod.outlook.com (2603:1096:203:c9::13) 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 HKAPR03CA0026.apcprd03.prod.outlook.com (2603:1096:203:c9::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.9 via Frontend Transport; Thu, 11 Mar 2021 06:22:58 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 4065a34b-ffab-4422-549e-08d8e4562296 X-MS-TrafficTypeDiagnostic: AM0PR04MB6611: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:972; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tIWaEuJiSpryl1R8owVZuSCEZ+Bo1sfSktp8WBYLjre1bLaGFOT6GpjLmgVlc40dG8tbsCAVcPpn7ivUlN1BqRBx0d0QamrJx3ptiXQtJ63dT8E6WDZUTOZsf17IQJIDbkoS7jl5S3CuPVrW/QQSUYQiognQlXvX9tP2w0nLAddtFs3/axnmTELJLwxYzrgoA1ylWHCWBA6CPHbAL34C22rCjW2dgPJTBD9aF60MLqYLdbQSGo+FO1dKUIm6VOTAua02ErlR8N27tUijLF2h/zqvmWMllWcHEZts7kEtdWXpmyy7lTCpEaHHB86M1Wjxs+8NHSB9BWuIL7hbIkiGGmD7Hp5X0gQMbnOaeA9x0vwA+9Q/3YYW+x+Iw0yycyJQRfHFbNNOuvObqclnyuQYXUqmkaJPDO7mZYxRQjoRDc7KIaKyEeJp/mzquMYN/0KukTY/OrIBingFLUjF/PJi4wTcl4wzgwCw8EbqS8+WqT4sOa7Znw8s/3D1xSaCV7mHlSEMeewY+8unA9K9dfX8wPSw5Aay85Z87YwlrB1LT2V57nJglF9sopxeSGPXT+271mlxr+HlFlyMq84Azwe1fqObVQnpEhKhiMz8ck6iH6M= 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)(39860400002)(396003)(376002)(366004)(346002)(2906002)(921005)(16526019)(26005)(186003)(83380400001)(6486002)(8936002)(6506007)(66556008)(66946007)(55236004)(66476007)(44832011)(478600001)(6512007)(2616005)(316002)(54906003)(5660300002)(956004)(1006002)(52116002)(8676002)(6666004)(110136005)(86362001)(4326008)(7416002)(1076003)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: eI9HjoISiipJ4UtKVIsNtJ+qxC1vVGAXs4trxgKQov3/dyf2/2ZimDLHDLZcUoHdnFgJiXvizHEEww53rhBypq5ErO0QQYvi7flSQE3BzWmxGTv6ubyaFr7xa7rFpfdFOllNTWMNwHiLomGoRuZxA2AbN837J8JeOBeKaZSRpoCVre195BNMnZ0We3ioM6wm3eTZHgxz46GeMrRE5VHLZP6QneauQEJdYb7GlXmW0grdEfRsVO6xfu640aIedyCOv0IpZk94wPy0TLUHnz9Sd1iujC9l0IDFWVLb0YPC1H8rorfLzsWas9jvkJXNM48XIh6bCdnJdKhZo/HDBQD2f9+UDwBOcD7RrEr7jjdW1tqdrdfr1AyMCyBbSNCQeFkkE3+EpSMKNVabZF3OuwB2aRRH3F/im/GcC0OZ1BP5fPS11mpxc/d+69an9DH5k8EcO23CynvFcjuJbOqwLqxVzjk0TfqzN/JVyG/n6J7u+WWiBpDKPJtXflsfiAGL4IfoEbAWlTM2oSL/lNFpMFjfrTFhYs+5yUeLj/dzROWP7jABzBjeoR2knFQe0A6LvZOvSVVklrYCxjAphWU9XujJZdCu+6M5Q9UASj5/YxfwRo5j0hbj3Xh9VuWvE1866WiZoJja466ZJorRhgOKntTjh/EPKZTcZkIP9whDZJ/HOjhEQAeg1BbW/JN3OayXsP6yfXZEuahpUnZJgE7ISszRVBiP89EkmJKKUGbM+x59dGu8D958Jc0eGFnfuOabCa8ULydgp12wTe7SEPLlf5WAJwi3OMI//ywQGFjSrRBZEcR7o55KfU5AGtq0ktuVWLVm3n50Cqvy02EUGgfDKbTucA93bBwNYY/7Y8l6hrmG1h6WZ8OEQmHOe/prdz+NNmhrP7ZyGpt+ImtJOnnr/y7R46zp3qCYkh7m9p31Zux41UCyQFe2iAU6EzE1dGhRYyYx9wrwtbL0fvPA5/Ka5x9rE243/AkZc5XRQdFTbxZsxE1/yF1eVPT4vjCjHw8HfztVIbXk7D8a2wGZXT7heojAUQDxYP4YFucHLS1PvgOsVon7iVUnqjlrYYzgWCAVLtQ92VxdENvdb0w4ixxqqp3k+pAP/lgEJjgavyVSkxTsSu8lttSAIqkJaYKw2FuiYUSjoEF9LyCWtkXSfJ4l5o04eMHyHsbl4V1mDarmRqIxLzuzKgHHaAbWWCUoELIF1tD4LZiw0yvgZx4Ms7vPUQHGgYx3oBm+44p6mgNb2soIcA/vcsimSm54SzZUZL1jaIufhjse7/TXy0Uxz0obeXFZj+HORvLzfUbLAs4hoO4OZDgo4eb+0P+F3CBznWCme9U9 X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4065a34b-ffab-4422-549e-08d8e4562296 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5636.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2021 06:23:07.3132 (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: znQaxha961y8FALA7XDjIznOQuZaaXTdT8HOAPHA85wcZQ78jlbf1HAqm+A+5cO8Kod63q4XjFxEqBQzlmN3IA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6611 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210311_062310_593587_41470103 X-CRM114-Status: GOOD ( 22.36 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Modify dpaa2_mac_get_node() to get the dpmac fwnode from either DT or ACPI. Modify dpaa2_mac_get_if_mode() to get interface mode from dpmac_node which is a fwnode. Modify dpaa2_pcs_create() to create pcs from dpmac_node fwnode. Modify dpaa2_mac_connect() to support ACPI along with DT. Signed-off-by: Calvin Johnson --- Changes in v7: - remove unnecassary checks Changes in v6: - use dev_fwnode() - remove useless else - replace of_device_is_available() to fwnode_device_is_available() 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 | 84 +++++++++++-------- 1 file changed, 50 insertions(+), 34 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c index ccaf7e35abeb..0cb6760dce88 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 *fwnode, *parent, *child = NULL; + struct device_node *dpmacs = NULL; int err; + u32 id; - dpmacs = of_find_node_by_name(NULL, "dpmacs"); - if (!dpmacs) - return NULL; + fwnode = dev_fwnode(dev->parent); + if (is_of_node(fwnode)) { + dpmacs = of_find_node_by_name(NULL, "dpmacs"); + if (!dpmacs) + return NULL; + parent = of_fwnode_handle(dpmacs); + } else if (is_acpi_node(fwnode)) { + parent = fwnode; + } - while ((dpmac = of_get_next_child(dpmacs, dpmac)) != NULL) { - err = of_property_read_u32(dpmac, "reg", &id); + 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; - } + if (id == dpmac_id) { + of_node_put(dpmacs); + return child; + } + } of_node_put(dpmacs); - - return dpmac; + 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 (!fwnode_device_is_available(node)) { netdev_err(mac->net_dev, "pcs-handle node not available\n"); - of_node_put(node); + fwnode_handle_put(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,13 @@ 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 +322,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 +343,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 +354,13 @@ 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); + fwnode_handle_put(dpmac_node); return 0; @@ -353,7 +369,7 @@ int dpaa2_mac_connect(struct dpaa2_mac *mac) err_pcs_destroy: dpaa2_pcs_destroy(mac); err_put_node: - of_node_put(dpmac_node); + fwnode_handle_put(dpmac_node); return err; }