From patchwork Fri Jan 22 15:42:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Calvin Johnson X-Patchwork-Id: 12039739 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=-16.9 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 DF8C8C433DB for ; Fri, 22 Jan 2021 15:45:48 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7DAFA20702 for ; Fri, 22 Jan 2021 15:45:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7DAFA20702 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=1Om+iunM5HHPHaxDH7yg6P8GZ87N/AYBMqCWBmpo+6g=; b=jGN4mdutYIFOvHXU+wBm0Dgfd O62Fy+vnrBv/AYEUZHJsKQczRiHjvXUlB5buPurSdP0Iy9dJTwo0I731kVPBX5TXMDaoLdeXHcEfO +/wIZ8S9DBYHVXfO6ocUBoUr1dcZD1oyZ7zHS7XZLC6K29wHmA/auhN90Q/91oIKKnR5OsUVHLXMA LJkXt6mcQgjE3Rnp7dF56w663dUkh+6nQd5NzKyXdhW3tR9MFN49rD+BSAAXqUbVEA/wLSv7OJ2xS 89itz/e5DaFrn+cQJRhLZgARxbbrmAb/emg11XECwb1yxEBb6Qog373sERyF8Abqfk+iN/AE8sYbk ybm3HBCng==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2ybL-0005OT-KD; Fri, 22 Jan 2021 15:43:55 +0000 Received: from mail-db8eur05on2069.outbound.protection.outlook.com ([40.107.20.69] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2ybG-0005Mx-Sq for linux-arm-kernel@lists.infradead.org; Fri, 22 Jan 2021 15:43:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UY+7c/NjaQLNQ8k3Rpm1NMBDR2JAFIBuZbfXUYoZB2fh/UNk7jxaKii9RkfONXvmQ2UDSWiAgHWO/ZzX/K/hryI2H0AVBjRToU+BjPhutsJddZ0cwLxK11JQWdAJy1ruZkZ11lk99l29fo5uk9fCUGhY/3KnXNeWM2GmybYF2Fv7n08e+pbgIZ0x07CETYVte4GpsMFaGoGqihLFXIAMWQtqxbHA5AG8/3jN/Q0nWyT59s+/TbXscfwj1zvwLaG2jx0lc/ttiOwg7JZdPidPXYQZO4yH4k4mtkq0ZsouM2QKwhabJMDQi403ByxWGJEPWqtN3lFGVuhY06VlB6W+aw== 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=QJAZc1k9hiCNT4jIbpi0ax6tyq+zZ7HxsGISpBv5t60=; b=T47pe2ZPWfr1Aj0/gk+c7UE9ZrAiqszIPVt9ApnpG5OvmE9Uww3K2B6SKmkNSs0i4dIuelkxbYXD8Cg4WJICcy4r/ipC3uXe/VgPzjbZ2Aw1iFO6zdNYjnCck88caLKFE7gj7xefYKnko4YVjoiky0FcTROzdTCxbRgOOS0Shx6qCVQfCZ+DOCl1esHrxbJGW/4HdV+SVECmiaoYAp7YjvOz31B2pLOdF7FLkVZS4BDp6r2uR75By6TznkJuO1zWQOpL9MhI6cAegIQwMA7Yv43Vh3nFgCcQthYm6xQ4rxHwrIbx0r+KTMMq/K4CHii2vEKj4hGeATL+aJiF+GV/6w== 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=QJAZc1k9hiCNT4jIbpi0ax6tyq+zZ7HxsGISpBv5t60=; b=QbAQ9k1/7+uAHHdV7l7WBK7IeCb6U6ZyatVlNju5MPuvgzaaHGboCwH47G6Ni2LgygtAb4Z8ZNlchk/xg6GQii3DbC+sYV324DYZ9ASOXx5cepkEmv/oaPhxYf1fwZKv21Uxfq4B0nD4l2YOB5WVfbKGpcgVOZoSmTTFqLO984c= 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 AM0PR0402MB3764.eurprd04.prod.outlook.com (2603:10a6:208:9::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12; Fri, 22 Jan 2021 15:43:48 +0000 Received: from AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::e90e:b1d6:18a2:2d42]) by AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::e90e:b1d6:18a2:2d42%5]) with mapi id 15.20.3784.015; Fri, 22 Jan 2021 15:43:48 +0000 From: Calvin Johnson To: Grant Likely , "Rafael J . Wysocki" , Jeremy Linton , Andrew Lunn , Andy Shevchenko , Florian Fainelli , Russell King - ARM Linux admin , Cristi Sovaiala , Florin Laurentiu Chiculita , Ioana Ciornei , Madalin Bucur , Heikki Krogerus , Marcin Wojtas , Pieter Jansen Van Vuuren , Jon , Saravana Kannan , Randy Dunlap Subject: [net-next PATCH v4 01/15] Documentation: ACPI: DSD: Document MDIO PHY Date: Fri, 22 Jan 2021 21:12:46 +0530 Message-Id: <20210122154300.7628-2-calvin.johnson@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210122154300.7628-1-calvin.johnson@oss.nxp.com> References: <20210122154300.7628-1-calvin.johnson@oss.nxp.com> X-Originating-IP: [14.142.151.118] X-ClientProxiedBy: SG2PR06CA0117.apcprd06.prod.outlook.com (2603:1096:1:1d::19) 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 SG2PR06CA0117.apcprd06.prod.outlook.com (2603:1096:1:1d::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12 via Frontend Transport; Fri, 22 Jan 2021 15:43:41 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 08f2a040-6eb0-41a9-0d43-08d8beec8218 X-MS-TrafficTypeDiagnostic: AM0PR0402MB3764: 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: MkL7vE0xB6QFxMsnYSblF4uenHUxZmUMsfE00Fkq3bDWafTuZVyV9EpMkIEgL5GTk5MfRKSYy1SgOHOc+mNAx77K2+moL4qvJXcVlaQSSEz5HBFRrvQXo3TwCP9zd7E6zdbdxS2xZz9OJkQGEplw19EMuxqZQcVdqhrRnqBMahV3z5f/mYwyETaQLcRKsx3JXrIZb+xhI5j+FPeJBvIxq9nj23EfKGBX4Uo+JWMF/IYft0fPqYz5bJUN6sKcMzPQaXyG0hWvYCAjB1NoMRGk/SWJa3Wo7TuVRxdv7rgthNYEc4iBDF6tKIwVrre56wcP6Hj27LKdMMB7RmT/+7usNjKNZv15/q4EF/807aUEnC55rWt4S+WPceUYDOCbxxpdc317RYRQK/WHhX2EFeuf7ZQqn12H0EPP015hhxUfJ6V5mZwqFkYnJ87brGtR38+h+RKIlaPcInN6IFUKKHSN/DfFe3oAf1a7P6pI6tJkDWkhphBoMSvjpXDIBlFm9SrX4ov3fJrSYSDBloPmBR5b5pZhVlCOc02JvUYC/+bvqFNf5VqHILrUIphYD9+r/kq3Q5ZS3poRDt3KA8PHWcEpLfR1OgAQx6sP/gDJlJNG2ZrAfgp9PFUjjny7fqRFc6jHtTUcw2TdFt3jB4/yGhGih3VljTz3vdL8UfRLD5lgeXI= 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)(396003)(136003)(366004)(39850400004)(346002)(376002)(54906003)(956004)(66946007)(66556008)(1076003)(6486002)(83380400001)(66476007)(8936002)(8676002)(4326008)(55236004)(7416002)(26005)(110136005)(2616005)(86362001)(44832011)(1006002)(478600001)(16526019)(6512007)(316002)(921005)(6506007)(2906002)(52116002)(966005)(186003)(5660300002)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: y4NVImIxhIYVdyHUIOeZMhYK293hlWazqZBEpG8qHircDigVx5h4koOdlyK2pg6sr+hvTKCnqGkvyl3R8dpU2ZVkDnEZNdTKoV/sRWIq7O0lSrexdtuoQuf6to7mbBnR7BSfmrXhpvCGGDqH2+MohtU3pQkC75vntiS+qAdDRki69aqfCpxjZWEO5AhXy3Mcy6mxrDkhDgFhWfiqGSWhcvsKO14HY39tgOOjoxUVHMoS7xDKQ3lDu5G6cUPF5PQMCdJ8b8/Eb+whkl6q7fbDqLZDTbKT60uxY8cCFbpgXqGE/5RTgqf77qn0syznE6rMd4VYKdt7qwHPsm2YwpUb2DlOP8cQK3HsM8+stFw3ie9SKgdPtxSUll04CiU79a3qtUEBlonkVFA27iwRHI+bM3Ua4AJQ4ObCWUchgHkpm87YAztd4Z40yLVeTPICP7k22uVU6jGwmlEt435TWzavsqhd3yXO4iODMUUTpU9cWWpVhjkTMm1j9fREExk7H3uEUCSwN7nH6ksMo4ITvJJ33UMrDyKOnk6EDVrE83GEIb7hlomWvgBXXoqd7zGbXVJW65N2JSa3zTf7AWnmyaJ9XlYkjKaZDL5TGXOCfFDNxIwhruJiWc7A1cPFbJyqe5orqwwJvgBIQq654jw1Mf7uRYboN43tJviCf3SPYKH7RJI+kGtM9/nr8FJtSQE7iDFgFBM1HXj22QPkWvv0JODD+WFcVvJ/MU2OvzNxybkoyIxlovJei11WPB07N/EUMxd+vMTEDEigvx82VaRu/7mN09nrzKDIrUC0XOEnIfl9R58fmWt2svxT2mIBPJm7gse1wuYEO69vrmaKSgSY57HbKw8a/1S6a4SU7lC4givz9W8p168Py/7jBw0c5uO16CRSHsUaOBx0BR4KWBdrF5WR/4JRBXKuTtc6ryGlVB9X2jJ+C8PLV5dMEcQfTleR0iQeX8ufC7WoZGLGirpf2lC3Uj5EON8PTeiRGa3pTXgYhzGg8bX921nTGFRCQNmxvxqb98n6TDWvK2OY4T2/+qUggIOX4yakOPi9udQ+yvsUOqAsDiLW4r1r6GHIbC3/7i9h X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 08f2a040-6eb0-41a9-0d43-08d8beec8218 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5636.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2021 15:43:48.0666 (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: gusnySP2iVfQRIVsoqpK3TnEAhHAo1m+PQ5g7aAq6UYMRcPKyRy4sbJTXuRVjKiGp34GpMzXX4CIS3YWLNM08A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0402MB3764 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210122_104350_988799_1618E71D X-CRM114-Status: GOOD ( 19.14 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, "Rafael J. Wysocki" , linux-kernel@vger.kernel.org, Calvin Johnson , Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux.cj@gmail.com, Len Brown , linux-arm-kernel@lists.infradead.org, Laurentiu Tudor Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Introduce ACPI mechanism to get PHYs registered on a MDIO bus and provide them to be connected to MAC. Describe properties "phy-handle" and "phy-mode". Signed-off-by: Calvin Johnson --- Changes in v4: - More cleanup Changes in v3: None Changes in v2: - Updated with more description in document Documentation/firmware-guide/acpi/dsd/phy.rst | 129 ++++++++++++++++++ 1 file changed, 129 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..76fca994bc99 --- /dev/null +++ b/Documentation/firmware-guide/acpi/dsd/phy.rst @@ -0,0 +1,129 @@ +.. SPDX-License-Identifier: GPL-2.0 + +========================= +MDIO bus and PHYs in ACPI +========================= + +The PHYs on an MDIO bus [1] are probed and registered using +fwnode_mdiobus_register_phy(). +Later, for connecting these PHYs to MAC, the PHYs registered on the +MDIO bus have to be referenced. + +The UUID given below should be used as mentioned in the "Device Properties +UUID For _DSD" [2] document. + - UUID: daffd814-6eba-4d8c-8a91-bc9bbf4aa301 + +This document introduces two _DSD properties that are to be used +for PHYs on the MDIO bus.[3] + +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, MAC driver needs +reference to the previously registered PHYs which are provided +using reference to the device as {\_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]. + + +An ASL example of this is shown below. + +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 +This node defines the PHYs that are connected to the MDIO bus, MDI0 +------------------------------------------------------------------- +:: + Scope(\_SB.MDI0) + { + Device(PHY1) { + Name (_ADR, 0x1) + } // end of PHY1 + + Device(PHY2) { + Name (_ADR, 0x2) + } // end of PHY2 + } + + +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 Fri Jan 22 15:42:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Calvin Johnson X-Patchwork-Id: 12039741 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=-16.9 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 00FC3C433DB for ; Fri, 22 Jan 2021 15:46:01 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0078C21D81 for ; Fri, 22 Jan 2021 15:45:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0078C21D81 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=U0yuqdybVVdW2hXrzMSfcZDxf0sBjylhSEnIUT8ppjQ=; b=0s92XquYS4G1aMq5WYLzQ6dYJ s+rTGwh2igvNIwQeDRcj+iwDo8SoE2bM3AB7TWdBUiVmb0rbY6nf67go3OHL3lX9dPHoM29m4pAeb okfMKfrX5FLjyOLXqSqkR8/DV1/Q+Ma/zvXNB0NZpHnPheYNY+MO1qw9//suqauLzxo59rXtGJsIn OmdURaOM9HXC3Lkth6KBmoQUG8msrxDarhbP5jqq+pCdeJYbQgF48kMKwalzBlLB5kMHizJr7VRKh cZuLNixx0D9+8mN79sqY57/z6V5/TezDe3GJOGHB+08cM34sOvADWiDnR6fBZEDJA8r4+NtEd4RRI 3LPER9kVA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2ybS-0005Ps-1n; Fri, 22 Jan 2021 15:44:02 +0000 Received: from mail-eopbgr70040.outbound.protection.outlook.com ([40.107.7.40] helo=EUR04-HE1-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2ybO-0005On-Mb for linux-arm-kernel@lists.infradead.org; Fri, 22 Jan 2021 15:43:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nMx0ddB3IiCP0JVCvjW/Wk2yEtt7jWgLuwNEULsrup1wczRpFpdzPoXZnoHYh3VrpdgbVBsiHjvls30fi0i8hKjSTIN3XTpv7pRl/iKiqGmmdKNTCwQ9EjLDcRaojGyyFPPexbFdAmOYSWZgEBdSe4XvjAAuIiSzTTEPklq/oIMvs9uzrb3BgPu60t67TzUxBE7g4DyNlZn7d14UgxIwGSDcr9E/gpaptinXr5r6o9THZAE7vjQylEh6ZIesHA7Png8zmGbJeLndSbgVsmDCcqyVTIKihapmXoE233clE6LDZTWnebaTXaT8UfBZXMvrie+7Vy8MWBGsaIyDqewOwQ== 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=W7tfLxUdi6KJH3b07Jdvt+VxOekfG6MptStdiZcuLv4=; b=acvfSue/wS4wbRb802jApNH8si5kUclbapyqRVMDBdhTG1JpURbof8Lsp6em+HPTCreooAlDSuYYGROZGUsku9jmZUXbfiaBtog2ku5NLQmjV2Z+l+ClRnw3zmrEQpNFslLWIFnt1N21ocvQI0KZQemcvvCYTFLmwKUYI91IvwiLG+DcovYMRPYTrxq64RHP7E0iSKtmg9pltnT7Jgohp6NNvg5GYO0YNdf/ibvN5R65xCkYHSgNV5qrmXR+eqO9vJSSfaNE7heC+9L861vBQcjw+jSedmDsnhfxnR4tsqEA6uy9HxclwdMIoLuWEIO+pRIn4K3eNDeR+ZM5QeecjQ== 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=W7tfLxUdi6KJH3b07Jdvt+VxOekfG6MptStdiZcuLv4=; b=LHARkbHRi4OE0lPifltqOU4dfb3rSqJr9IAeiLF0ZwoVJT4imr9byAN0X2OAQAOYi9CJWrlZzzjO7lqOesq3Mxv3OCSAFpgj3oKP0ZHpFL8kCkmVjemjMqKOB60MLgxnrhuFCmYfpcUE7JHHoju1sw7h318L53n6itkJZ5Yc79A= 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 AM0PR0402MB3443.eurprd04.prod.outlook.com (2603:10a6:208:1b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12; Fri, 22 Jan 2021 15:43:55 +0000 Received: from AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::e90e:b1d6:18a2:2d42]) by AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::e90e:b1d6:18a2:2d42%5]) with mapi id 15.20.3784.015; Fri, 22 Jan 2021 15:43:55 +0000 From: Calvin Johnson To: Grant Likely , "Rafael J . Wysocki" , Jeremy Linton , Andrew Lunn , Andy Shevchenko , Florian Fainelli , Russell King - ARM Linux admin , Cristi Sovaiala , Florin Laurentiu Chiculita , Ioana Ciornei , Madalin Bucur , Heikki Krogerus , Marcin Wojtas , Pieter Jansen Van Vuuren , Jon , Saravana Kannan , Randy Dunlap Subject: [net-next PATCH v4 02/15] net: phy: Introduce fwnode_mdio_find_device() Date: Fri, 22 Jan 2021 21:12:47 +0530 Message-Id: <20210122154300.7628-3-calvin.johnson@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210122154300.7628-1-calvin.johnson@oss.nxp.com> References: <20210122154300.7628-1-calvin.johnson@oss.nxp.com> X-Originating-IP: [14.142.151.118] X-ClientProxiedBy: SG2PR06CA0117.apcprd06.prod.outlook.com (2603:1096:1:1d::19) 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 SG2PR06CA0117.apcprd06.prod.outlook.com (2603:1096:1:1d::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12 via Frontend Transport; Fri, 22 Jan 2021 15:43:48 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 7f4dec28-bd52-4202-00f7-08d8beec864f X-MS-TrafficTypeDiagnostic: AM0PR0402MB3443: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5797; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QaoeTDlIZzB7ZmVehbuEMNVX+rwwKmYSUTpgJtKvMWjkTJcYlfygHgI6Bvzy/IQRig4cu9eaWiAfbHQdut2nae6ews+xT8Mhve7cRun0aK4t9UrMrEhn/EnzUJJF1dEInJ9RQ1BOPWNrH5HsgqfABpIRO1CM7yq+Uvri/FkmhLT6MGGnvObCdqx51EHDr4JtVT1eNEc6LFtRBgur/a3MH2bjiq2qHXOt1YkZDgpGAMmiDhLY16J3tnNjIDW+Gunh9vufjk8wNGy8Z3a7XVVU7jPdcd9rWo31JG99DMCj5sVsx+W0FwLFNTWswQ/b45jSRm7FIBkWSBynh46fjfF4r13m62iaOXSYUwuu/JDTO6tv7VtA+G+6iANB9oJkqMKbM7jIJ0r6OxRi2Fr1OwLyU46TeQrCdQiTWBWyiAZbLIV4OTLFx3dVk1OQ8Rmb5iZa5Tj9/I3hQz8rUNuB+Rw0HA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR04MB5636.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(376002)(346002)(136003)(396003)(39850400004)(366004)(2906002)(6506007)(921005)(6512007)(186003)(5660300002)(1006002)(16526019)(52116002)(54906003)(956004)(55236004)(8676002)(66556008)(8936002)(83380400001)(66476007)(2616005)(66946007)(1076003)(478600001)(26005)(110136005)(86362001)(316002)(7416002)(4326008)(6486002)(44832011)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 89gigSkZ84tJVYv4HphGfLUX1MvGmCUy+G+g6MlB/iCtqfElzHuGZdeC1kGOtnvzl4hyE8HeG5wyeYbHnVQt+RIZsgIeZjfSPMHtzRZwffoM+Mqstdfe9KKrt8c7X5IFQcYxmHWXfWgeS2+qUdrMFWk0UMfj9IXuDvK8DAn5QtYMAqTH5pAyUsR/7K82JE//Vk3zL5Ym6ql0nHEgP33dzBHgJKnsJtjb3wtt1jOQ6M3R8uE1Ax/XuHQuTNfUK8lt7L5TFw2IsZUanDOkOtgFja9p2Cr3rlN46Ge3XHC4F6sXsBIyG4XX99/BTEydXEnm6qwOFkCXW1IlwMuiLE/iKkqfa5zR9I1doRFw+tpmaqj9T1JSSt31L5ZRDJ8J5ASaeZtxemKNFRFx+OHc3tXsycVVZ7S72zlNcqeDu0FJ32+1lS1F5FAoMdOsfYX8jeW1r+wDRxNKiZh8XRnAyTfNP08U6Pc0Pu3+K4NDV7a6ugDZRb7J3twjFo1bqpvLXE5vkGXzih1knezlDKq4tqVvhwgLMiPyoC2HKRsl0y8mcq9nr/YOj/99K6GYSGagzXKt8AQebTTH3ZncFQGxMAszOdlsYUKVvjnpgPch1O59tTTYNpkIsUdLx5BmDLPYB5+oVenC3WDwcdHMiw5mA/w4l/W5y8h5Eiu2n1xLpOOxSDw6KIgXk8Tn9NCOksboJSeGaWq/j3qIpYPHeKl334vcv0dzUVC4DJOUb70vUe9xi+rWZzbMRXNCWbEAidffWXQIzye1D0UQFAsLuhPPYtcQKtnmtM8W3Loj5KRqRAMTZBAGdY7wI/1tG5UWm4QSIeMQ35N98wVMIX+lsDEziJ7pFdkXCp/ek69yPF6/aeJeOxkYQgKx1bpeGtzTMQbR56FtGRukRvH6ToYbMPExwy7KX8ue1cXQvKugatf+vgZlVywB+mfwmqIeYOvX38SmTKAlljPsTdVIwHo994OeQ+MEEw6YvbbhvGGh7EINGVo31CYSq4ZXs7iEXQje2hgSodmP2NYEU6dLSpuywI5mzXFE754biyQ7k/uZ60WEUTQxhtyvOml8R5bycE4EXasFVJPP X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7f4dec28-bd52-4202-00f7-08d8beec864f X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5636.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2021 15:43:55.0407 (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: lcWCNaInnj2TlefX7zb1OOrYEn5/N7f/VCPwF5I6ctjhV9UqYNo/4a+LywcXRzCW76yCGIbF7y5ClX6pj1O0aA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0402MB3443 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210122_104358_810324_5BC269DF X-CRM114-Status: GOOD ( 17.55 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Calvin Johnson , Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux.cj@gmail.com, Jakub Kicinski , Heiner Kallweit , "David S. Miller" , linux-arm-kernel@lists.infradead.org, Laurentiu Tudor Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Define fwnode_mdio_find_device() to get a pointer to the mdio_device from fwnode passed to the function. Signed-off-by: Calvin Johnson --- Changes in v4: None Changes in v3: None Changes in v2: None drivers/net/mdio/of_mdio.c | 11 +---------- drivers/net/phy/phy_device.c | 23 +++++++++++++++++++++++ include/linux/phy.h | 6 ++++++ 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/drivers/net/mdio/of_mdio.c b/drivers/net/mdio/of_mdio.c index 4daf94bb56a5..7bd33b930116 100644 --- a/drivers/net/mdio/of_mdio.c +++ b/drivers/net/mdio/of_mdio.c @@ -347,16 +347,7 @@ EXPORT_SYMBOL(of_mdiobus_register); */ struct mdio_device *of_mdio_find_device(struct device_node *np) { - struct device *d; - - if (!np) - return NULL; - - d = bus_find_device_by_of_node(&mdio_bus_type, np); - if (!d) - return NULL; - - return to_mdio_device(d); + return fwnode_mdio_find_device(of_fwnode_handle(np)); } EXPORT_SYMBOL(of_mdio_find_device); diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 8447e56ba572..06e0ddcca8c9 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -2829,6 +2829,29 @@ static bool phy_drv_supports_irq(struct phy_driver *phydrv) return phydrv->config_intr && phydrv->handle_interrupt; } +/** + * fwnode_mdio_find_device - Given a fwnode, find the mdio_device + * @np: pointer to the mdio_device's fwnode + * + * If successful, returns a pointer to the mdio_device with the embedded + * struct device refcount incremented by one, or NULL on failure. + * The caller should call put_device() on the mdio_device after its use + */ +struct mdio_device *fwnode_mdio_find_device(struct fwnode_handle *fwnode) +{ + struct device *d; + + if (!fwnode) + return NULL; + + d = bus_find_device_by_fwnode(&mdio_bus_type, fwnode); + if (!d) + return NULL; + + return to_mdio_device(d); +} +EXPORT_SYMBOL(fwnode_mdio_find_device); + /** * phy_probe - probe and init a PHY device * @dev: device to probe and init diff --git a/include/linux/phy.h b/include/linux/phy.h index bc323fbdd21e..8314051d384a 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -1349,11 +1349,17 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, u32 phy_id, bool is_c45, struct phy_c45_device_ids *c45_ids); #if IS_ENABLED(CONFIG_PHYLIB) +struct mdio_device *fwnode_mdio_find_device(struct fwnode_handle *fwnode); struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45); int phy_device_register(struct phy_device *phy); void phy_device_free(struct phy_device *phydev); #else static inline +struct mdio_device *fwnode_mdio_find_device(struct fwnode_handle *fwnode) +{ + return 0; +} +static inline struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45) { return NULL; From patchwork Fri Jan 22 15:42:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Calvin Johnson X-Patchwork-Id: 12039743 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=-16.9 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 C99D3C433E0 for ; Fri, 22 Jan 2021 15:46:12 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5457C20702 for ; Fri, 22 Jan 2021 15:46:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5457C20702 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=rrpO6KpSYJ4qUhgi0y9VbTphBjLULAxdOJsP9SWZJsw=; b=YuOvLo2o/E4+ETAdnVv9rYrsL MRTnp36zSvlgsBHBTkdU6X17j/f5/Hz0Spd6+heGg4tHWAVipQL6lHGKfbZxSbgc+s/k7S1jm3zWT rU7c29G9zH8+4Hda4sqshlEumWrl8sfMu3XESRjLwd/eTmUYZ6Y/WAIpyzqZRd4RWBc09r9kCMy0v e6u01S6YWe+TfonJWaE6/lpRSsrOAQJhdVS+C1nxXtPm6WnpTxM2UBrQzOauW8yf7ST+QjdJcRLZC TnWbBeZg8q0r3WmdIzp2r97t264HrhrvqAns3PxlEMrdsJATPfSjkbc/aHquCRxwss47P1H1hnC4B 7w70YKl0w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2ybc-0005Tq-Rj; Fri, 22 Jan 2021 15:44:12 +0000 Received: from mail-db8eur05on2084.outbound.protection.outlook.com ([40.107.20.84] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2ybV-0005Qq-7G for linux-arm-kernel@lists.infradead.org; Fri, 22 Jan 2021 15:44:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TZJ0zfBJCVIAdjJCH0bktexdad8HDOcbju4Cggqy6o/q1R9pdy6NCe/5n+p+TFztDgeR/sn6gPzvkCvXEQQVMga1rH2iFosWTh9EphuzOfW0Aln1XKt1dDd7JGP2V55JzqdzZhIHsVMesbZ0hywqVX0PsCed3xdYYJrprs0bMMBOh3LZCKLvp6vG9ziCs9XyLNE7cW0t7F4wqMZhSJV8sBtiHb9uC4NYvksDY4dCNbKFLTkhpfX0YvZTUBFJYjeLBbV9hHOq3br35EGblYygYBJq0gCogimoXvc44wJ1gcTFyqD0kM/O7myqVASjX2sQbeInOqACn/rZWlPrcVE6UA== 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=WjHnZe53MLeFhWs1Y7NOqOkwKmM3NEIis5YVorKWN7E=; b=ayvh6IEEKqQEsKfMkl8rZ+muu87/dq9K1fZ3WhSVNuRlgjbVBqy3ZWLs0In9sYiaH8WjmtSMRgpoQ2aPcnoZ5kG9NoJDSB0V3qv9Jng+wl4b0kMGGo9o6HxQkRIuJzoP9vhbmt5X8rHXBLvO47rdkrwYKae/q1hL5kQo5vGAIluoW+rh10RwGjuh5vMqfRXDonx6qsLwnEypj5VUE9nT/lLK1R125iK1fo5W1+ehUPgEDv5OfZrZixWixJ8DFWxlVeVsMq4Aai2CDliOQZod3vBh5V6AnXvMI57zDgjpIPikDRBq1cnf3IpD35BBxCDkKDtFCBZS2LcBoyH/nJd9Fw== 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=WjHnZe53MLeFhWs1Y7NOqOkwKmM3NEIis5YVorKWN7E=; b=AwPyryP0OkhQW8MBe5Nyw2x8zEXNyDl2XmVo/PsiTSNcfmNqZNQ6/7c+QblX1IToAVl5P7SWDd0bpRYOFjg2TIX6+miwLASXuiurEb6Hpho7VQFpwAgeOhIOQ7M4Jnb8gkTAQzUb3Aa1+coQ7LnMkqkl3IK4Aj9bZKpeCCRCqpQ= 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 AM0PR0402MB3764.eurprd04.prod.outlook.com (2603:10a6:208:9::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12; Fri, 22 Jan 2021 15:44:02 +0000 Received: from AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::e90e:b1d6:18a2:2d42]) by AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::e90e:b1d6:18a2:2d42%5]) with mapi id 15.20.3784.015; Fri, 22 Jan 2021 15:44:02 +0000 From: Calvin Johnson To: Grant Likely , "Rafael J . Wysocki" , Jeremy Linton , Andrew Lunn , Andy Shevchenko , Florian Fainelli , Russell King - ARM Linux admin , Cristi Sovaiala , Florin Laurentiu Chiculita , Ioana Ciornei , Madalin Bucur , Heikki Krogerus , Marcin Wojtas , Pieter Jansen Van Vuuren , Jon , Saravana Kannan , Randy Dunlap Subject: [net-next PATCH v4 03/15] net: phy: Introduce phy related fwnode functions Date: Fri, 22 Jan 2021 21:12:48 +0530 Message-Id: <20210122154300.7628-4-calvin.johnson@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210122154300.7628-1-calvin.johnson@oss.nxp.com> References: <20210122154300.7628-1-calvin.johnson@oss.nxp.com> X-Originating-IP: [14.142.151.118] X-ClientProxiedBy: SG2PR06CA0117.apcprd06.prod.outlook.com (2603:1096:1:1d::19) 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 SG2PR06CA0117.apcprd06.prod.outlook.com (2603:1096:1:1d::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12 via Frontend Transport; Fri, 22 Jan 2021 15:43:55 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: bab25f88-8baa-4df3-1c4b-08d8beec8a7d X-MS-TrafficTypeDiagnostic: AM0PR0402MB3764: 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: zMgcPNfXlJh6ppWx3xoaisogg8KeD8qKL4PcPC02XrObFt3L5MDW7Kuqf4YR2QhrbCZjKFzbf+/h74l9ui/TAx7D5gM117InxW50z85k7sbruiQDgGH5+XypsHUx4+6VwiYgQSqMkKKATuoUboABU/sulZBkvS64CloH1cVuqfQv3qOdtV0e6iiMyHcpa9xMcfv/jvHQXRyueM4FOGQtCMWtQmos2reVb19V/MMS4mPyLwqsb3g54mhNMlKp9q+QOSRsezm4SbvjfExpw3fE1ac+lFkShNfCuXknPqf0y6gewHHnxpyvEN1qfG6M/pn52pWd60x5AbBgPOyt6SSVOvje5vpoSu6XYG3QtThwALHzRTfE6DvTC2+QB0QwG/sfhIqSeAtbNMxd2SevyVQ6B007XbwV2sS5eZw+mal141etfD4Rv7d6jvj4SzUXRGumh4TOUhje7ozW2BPzhdR9eAelHWt0vBmz5ouKCXktkKVklSPbiThsxyaNivaJC8gzASYHGVyrdSPti+z8MsMZ0RRD/cRnPynoAq7Ta7Y/1uAExtWoRIkhWRZFm2JX5XWsK+4nxUoAVZexW3PS15rNCbA2rCSUc6l0OdqQxqO/JpU= 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)(396003)(136003)(366004)(39850400004)(346002)(376002)(54906003)(956004)(66946007)(66556008)(1076003)(6486002)(83380400001)(66476007)(8936002)(8676002)(4326008)(55236004)(7416002)(26005)(110136005)(2616005)(86362001)(44832011)(1006002)(478600001)(16526019)(6512007)(316002)(921005)(6506007)(6666004)(2906002)(52116002)(186003)(5660300002)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 0ez0/SFhqo/zUhB365rOOFqW0Fgs3dGE0sBVs+apuWlQDb9uZLa0S9XhG7d0VkzuZhUpzm5drFAd9bmeNoLt6Sf7cjb21kutCeMV1qpxuE//h4loLiLJE6t2dBefisdfVY803/iGVGDH9TVeRxIyakUhzcXlnGNYy+D/T3brqGpWS47Xsbo6pTAfwYkQDqaErUvlui+uJHvgAOYqhnHo2kT5cdUrc1Y1M3WTi5suniVMmql00SPM/u3GNAcKJAmW3hZQtx2hG9tYcyqez0N3Af8fCMzh3sRsCDd9o52Ha4fx9RO6T0SV0sO0E6fGB3kpmhl6ynOoemu2QEHCROICZ9sOnN/6hj56J7wP8/T0PCLN13nv8TIjq7yGeFbdTqfv/ZE0CodhNbMWiYgbMMgDdChrqW4OK04aQuu+IYdunE3IDZCrDxjokxkWcznsBLSrsg6EkiqGadkXr9iyNDofWNgdWRPgKysaBgufTDMMwhm5G+NoBIQxP6YZUFNS/cp0S89sunga5gUj8eMpVq78P9kU6O99e7yZfzt6csPW8ivRs7xX4IFUqeBz+5PV87hCO89rm/rZurJEbOuRuplHmF3rujPTYUW9WxvAyFZ8muSv/zjajgYzUprbi4Ps8DgZY0RiR4htLyeqcecTDttg6FuS7Ks+lHxdjPa7fowzzET6cYA7E9oB9fIPLLikzljHI3Ir1Ikf1DJfE/VtB4XVc2c1cr+5S376JHnJSkKpV+DeWm3dsdlFOxDXOVtzt6eLUQ2B50HASdLOS44XT+coW07N+4AzdakXIRyECc0KUK8NhePAOckqoWahF/GJvpZBIEBshwxatSttIZjAFVE9noz9zJX8XHvEoV0T1D4nzEDvc+Uz2kLedxkvl9Axk5nGLIgh8J4ovgfFkpK/DdyDbUDM3Oc9SeAAmKJI/mYu4fs8ssvqOo+FLj0OglZNfkWoFi6SxH68FL9u589UEUXUO0sTL9oIQ9eNcXnvkbDuJ9+gHWRl4CePmo19slnN4lx2ASaKFBXN3vonWEMSaY/K+GwlPRLpnSictcWzr6k4YxcSfz7x0p/8QNXEVZoRxRsW X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: bab25f88-8baa-4df3-1c4b-08d8beec8a7d X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5636.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2021 15:44:02.3726 (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: 0lBb2j95I838kKIl5N7cxN3JiqLolmhrNmEU9o1eyxhZx+a1K628zpfcSkKI5UmsafKP4ISls394DhOx/Kf4Lg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0402MB3764 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210122_104405_352899_BAA78372 X-CRM114-Status: GOOD ( 20.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Calvin Johnson , Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux.cj@gmail.com, Jakub Kicinski , Heiner Kallweit , "David S. Miller" , linux-arm-kernel@lists.infradead.org, Laurentiu Tudor Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Define fwnode_phy_find_device() to iterate an mdiobus and find the phy device of the provided phy fwnode. Additionally define device_phy_find_device() to find phy device of provided device. Define fwnode_get_phy_node() to get phy_node using named reference. Signed-off-by: Calvin Johnson --- Changes in v4: None Changes in v3: - Add more info on legacy DT properties "phy" and "phy-device" - Redefine fwnode_phy_find_device() to follow of_phy_find_device() Changes in v2: - use reverse christmas tree ordering for local variables drivers/net/phy/phy_device.c | 62 ++++++++++++++++++++++++++++++++++++ include/linux/phy.h | 20 ++++++++++++ 2 files changed, 82 insertions(+) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 06e0ddcca8c9..66e779cd905a 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -9,6 +9,7 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +#include #include #include #include @@ -2852,6 +2853,67 @@ struct mdio_device *fwnode_mdio_find_device(struct fwnode_handle *fwnode) } EXPORT_SYMBOL(fwnode_mdio_find_device); +/** + * fwnode_phy_find_device - For provided phy_fwnode, find phy_device. + * + * @phy_fwnode: Pointer to the phy's fwnode. + * + * If successful, returns a pointer to the phy_device with the embedded + * struct device refcount incremented by one, or NULL on failure. + */ +struct phy_device *fwnode_phy_find_device(struct fwnode_handle *phy_fwnode) +{ + struct mdio_device *mdiodev; + + mdiodev = fwnode_mdio_find_device(phy_fwnode); + if (!mdiodev) + return NULL; + + if (mdiodev->flags & MDIO_DEVICE_FLAG_PHY) + return to_phy_device(&mdiodev->dev); + + put_device(&mdiodev->dev); + + return NULL; +} +EXPORT_SYMBOL(fwnode_phy_find_device); + +/** + * device_phy_find_device - For the given device, get the phy_device + * @dev: Pointer to the given device + * + * Refer return conditions of fwnode_phy_find_device(). + */ +struct phy_device *device_phy_find_device(struct device *dev) +{ + return fwnode_phy_find_device(dev_fwnode(dev)); +} +EXPORT_SYMBOL_GPL(device_phy_find_device); + +/** + * fwnode_get_phy_node - Get the phy_node using the named reference. + * @fwnode: Pointer to fwnode from which phy_node has to be obtained. + * + * Refer return conditions of fwnode_find_reference(). + * For ACPI, only "phy-handle" is supported. Legacy DT properties "phy" + * and "phy-device" are not supported in ACPI. DT supports all the three + * named references to the phy node. + */ +struct fwnode_handle *fwnode_get_phy_node(struct fwnode_handle *fwnode) +{ + struct fwnode_handle *phy_node; + + /* Only phy-handle is used for ACPI */ + phy_node = fwnode_find_reference(fwnode, "phy-handle", 0); + if (is_acpi_node(fwnode) || !IS_ERR(phy_node)) + return phy_node; + phy_node = fwnode_find_reference(fwnode, "phy", 0); + if (IS_ERR(phy_node)) + phy_node = fwnode_find_reference(fwnode, "phy-device", 0); + return phy_node; +} +EXPORT_SYMBOL_GPL(fwnode_get_phy_node); + /** * phy_probe - probe and init a PHY device * @dev: device to probe and init diff --git a/include/linux/phy.h b/include/linux/phy.h index 8314051d384a..dee7064ea4eb 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -1350,6 +1350,9 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, u32 phy_id, struct phy_c45_device_ids *c45_ids); #if IS_ENABLED(CONFIG_PHYLIB) struct mdio_device *fwnode_mdio_find_device(struct fwnode_handle *fwnode); +struct phy_device *fwnode_phy_find_device(struct fwnode_handle *phy_fwnode); +struct phy_device *device_phy_find_device(struct device *dev); +struct fwnode_handle *fwnode_get_phy_node(struct fwnode_handle *fwnode); struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45); int phy_device_register(struct phy_device *phy); void phy_device_free(struct phy_device *phydev); @@ -1359,6 +1362,23 @@ struct mdio_device *fwnode_mdio_find_device(struct fwnode_handle *fwnode) { return 0; } +static inline +struct phy_device *fwnode_phy_find_device(struct fwnode_handle *phy_fwnode) +{ + return NULL; +} + +static inline struct phy_device *device_phy_find_device(struct device *dev) +{ + return NULL; +} + +static inline +struct fwnode_handle *fwnode_get_phy_node(struct fwnode_handle *fwnode) +{ + return NULL; +} + static inline struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45) { From patchwork Fri Jan 22 15:42:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Calvin Johnson X-Patchwork-Id: 12039745 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=-16.9 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 22BE5C433DB for ; Fri, 22 Jan 2021 15:46:13 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B94A321D81 for ; Fri, 22 Jan 2021 15:46:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B94A321D81 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=3NWZXk1t0t46lueZ46bBESydo+p/6HfI/UC6qmrkdXA=; b=ee4gTXL4/Ho4vKgwroOF5NZ5I spN+WkYl7u4xhnB0kfKsyLTgu0vzntn4+SaX/g+XPu/4r/gCO8FekP2rxTd/Hf/aEt2RDWSO4+BQ0 9RLrYtFC7YY9F/7yqTJvWBIG/i7uVvJHiU9/mxOwiVZ2bmczbnHGjHctRHnP+LDjx3eWfB4X9Qol8 bQ8y3QAKnzKZbrlau1fK4W9cK9WHrBT7Y9BlSZQ+NdoCLpNqjTnY1LHxM09s2YwOG5UpnmnQcdOmL k5HA9i7HLJNGPSHZ0WE3DEty8i09x+ibbzkH85lPzhPJWDjFR/iXxM34Qy3+x5fQjUEbGXR4q+OH3 37WUJZTHg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2ybj-0005WT-Ip; Fri, 22 Jan 2021 15:44:19 +0000 Received: from mail-db8eur05on2089.outbound.protection.outlook.com ([40.107.20.89] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2ybc-0005TM-NZ for linux-arm-kernel@lists.infradead.org; Fri, 22 Jan 2021 15:44:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FK1PS+a1UHHCz676YH3bS6tpNvIn1O+/dIpCl2mR+N4ImINeUTRtPPo/EDIaPi9rT9FUU6OmDoT487MeKWnR62RrYT0z+OjL0oBnl52bG4niKtPIXFY6PbS8Z4I5BSkQF/399tEvZqj0G29xKX23luYwS+2pj1FzXW3OTcVXDZXyFZdPHU/paOsIM5d+TVCV1GciWNO0sDOQfcacJhCB1W1oQK3iYUFdT9r9fGRnBSu0duE3f+kx4VJoTh1vSkzFePPLyNJMUoHw3RkB6wgeYJV904fatQNpkFm/QT2sPSepWvbCk61N5FNXR85cz0swg1n/zUYdzuuPGKPGapvkBg== 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=RNj2O1W+lf7nF6T5f4VaSWcc5VbW7vCtB92IYJ+Yepo=; b=Uq2OM1XMwLCM1HiTEiMNPX1nt39MqEp8YSpjAMMFPxPs4bh9AbAGPAdqg+0fmejS20zQTR2APbRpKjzugrgDk0vovF71cqNKHQU8BtUKEe9S7FB7wzF8S5pUY4R7I+Sl8VGIHMkCml1hzCGgrXb5I97/+7xuGrdxkK4qmmJAev0fxWxoBwhlO459oMcPRVV2dQgQdMRbdJfzkoy7NLmqSKCBl7KDzerXSchWX50QIo5JgnYWoq/F/Q53UX4y7yrif6GMKPfs0MlS9gf5vVVCvVN4aOyOz6p9hA2R8XLCHDggf012IsABKTGL7kyjN92/oowzjbCdMqI1QCpbCN5zlg== 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=RNj2O1W+lf7nF6T5f4VaSWcc5VbW7vCtB92IYJ+Yepo=; b=CE+67sdzptw9hr88bbnj3GbZzEeYCbN8VBvInfhT5ZOnubF4hkJAtqX5JWF8PunIz9lfVmos/gVUYjG5w73qXxkiwn8JctTQNoef0bLzDxlpB6ez6toVrgkwNnuxePIFgclW+2jQw86Xkvu3QWg73ajSXfIrnU4hbYqj2K36bJA= 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 AM0PR0402MB3764.eurprd04.prod.outlook.com (2603:10a6:208:9::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12; Fri, 22 Jan 2021 15:44:09 +0000 Received: from AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::e90e:b1d6:18a2:2d42]) by AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::e90e:b1d6:18a2:2d42%5]) with mapi id 15.20.3784.015; Fri, 22 Jan 2021 15:44:09 +0000 From: Calvin Johnson To: Grant Likely , "Rafael J . Wysocki" , Jeremy Linton , Andrew Lunn , Andy Shevchenko , Florian Fainelli , Russell King - ARM Linux admin , Cristi Sovaiala , Florin Laurentiu Chiculita , Ioana Ciornei , Madalin Bucur , Heikki Krogerus , Marcin Wojtas , Pieter Jansen Van Vuuren , Jon , Saravana Kannan , Randy Dunlap Subject: [net-next PATCH v4 04/15] of: mdio: Refactor of_phy_find_device() Date: Fri, 22 Jan 2021 21:12:49 +0530 Message-Id: <20210122154300.7628-5-calvin.johnson@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210122154300.7628-1-calvin.johnson@oss.nxp.com> References: <20210122154300.7628-1-calvin.johnson@oss.nxp.com> X-Originating-IP: [14.142.151.118] X-ClientProxiedBy: SG2PR06CA0117.apcprd06.prod.outlook.com (2603:1096:1:1d::19) 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 SG2PR06CA0117.apcprd06.prod.outlook.com (2603:1096:1:1d::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12 via Frontend Transport; Fri, 22 Jan 2021 15:44:03 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 6353df2e-7484-46c6-b0cb-08d8beec8eef X-MS-TrafficTypeDiagnostic: AM0PR0402MB3764: 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: rkLr3khN13OmZIdfMVVRrgwhxmbJz03aAo2LGimMBVtTki4A/R1upHn+vhmdtUjm9ptnoXqmWVIAkoKCRBcURspONP/+v3tnAAEt7gyLnd2R+Gp5p5AbqxWpjRlprthaZydukkhVnROKPVHkqqYdTvInOvFkSCD0eYMZN19O1cMlpEzj3KSrfJ69KW4xN33PWnmUTsOnrYW3KydjoW8gMaoUDVi/5d2tl2qfDPZu9fWSRp3vgjWGR5olGf5snNZm4UOjuOaeCi6UdWsx6EZXHdbXBAukFJPjV7FOE0mCE6iN3WYxwq2g6VayV5liTZi76yZSzGhW9ZJKEwt6RGBsIYci7XP64npOjBLzhW+lKm36uIIJG1xV4+uY2kBuNniKj0+jKP0ygK3nkVEcaX+xh9iV2WXq/IGmgcM6BpOFxVWsxU3QTUKFavDi60YlVLvI/Y8j9EwBRRMxzoFGInwdx1zG8ikl3wyAKEGroK4iJLjC7xJGLMCuUa8eHNlVyvhIaq3SNNCN6fQZt3BsGaJvhjAdX6SMkfwoBaMWCu2zU9BATCyBddkRl48cI7VC+fpqI7ot9zbr9AoMHH8MpPX/mw== 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)(396003)(136003)(366004)(39850400004)(346002)(376002)(54906003)(956004)(66946007)(66556008)(1076003)(6486002)(83380400001)(66476007)(4744005)(8936002)(8676002)(4326008)(55236004)(7416002)(26005)(110136005)(2616005)(86362001)(44832011)(1006002)(478600001)(16526019)(6512007)(316002)(921005)(6506007)(6666004)(2906002)(52116002)(186003)(5660300002)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: DLpBfYelbykA+rQMEQjMjmMl3aW3AHKbI4ibKoPERWIwE0rwc+2JwBcnS3Sf+DO4wSJ9vqE8qEL2YpJ5YMUMkA3KIy3sYSiw1q0yo59EnAWwaqgpccRaVm7WUuAqJ/265wmjwCTB46LxaTqLPPWkTnb8XOK0B3+s1z2uCXZeJdZVuVdpcSdwsN0DzKn51nbBOGNHZpummwiEXeex3ExnX6aXdcYAehHJBf7xeHOzCom23l0wRXLBW6HLEh4XQKqfLXsHg75YfigAUnYgzg4oEvxQLEIXFDYmQ2cm3rDkivO7pgdZ6JaphEmk5VQSZTkhXlcKhpFuG6C/ww2L0pbD3X9tvXwRQTCohvQoo6S8abVtKgdmbG8pIABKZccI5VZe2wTRs9xrtOgdxm5I+q/evCDNEged5S51wom1VvtjIJkfee+sfjBPkvJNqYTo3YS3cp7op1dqNW+dDuxudtuYXrPuf44hHGtnRfu9u4GqtURYzz6txHCcBBbT8KwFqo8pG9yUfzCfQAjzwmi45fFlDox5jh4g+2yp07ZYDRPNviYUCIvm1fYIB1gF45wmnTtqHKjGXAnKO3v1vGPoObn8KMo5EchQMGZAN3ZS6BQvHMK3amLQVmkvZo8FS94mb46kEsO6cg5jbU02wYr8JwjTbzU0GpdKoLpXFjG1TQsOzU9Ex8NZTE2cjD/wJWRC8DJSnRP7/sWqf0tXr0e2lWSBMFpC4HL7oDb9S2eq8JYRJS+13zyof+xCzqwSPrKYAmPgvzTE6CAvYkBBVqp/j56NC+xcwwyEKw+wzd+Q6xKZHvjwzX3GEuWWPRiLCM9up8sSikxhNszJjwOYjAUhuY0dVpa8QljAFPFQPHVLUGEBiyKlCeyXE05g67BcAxagqlGLmhWVOzoYoIu9jYs0FR8+CJxsjHKoM1W+TnxSBNVmzLVGzDPselI0D3KUjH1iSiJSTGizjKmIhupUgaMyVfv/+oZfOxFjrv/C2RxV7kBO02p50XgVC2p9BRKmSGnrtZPoFe4vfADrieCBrt7JccDrR3x8MEZWZXijD6GGBSVt6sgFWJmeR/hw5Luxth+0ZnpW X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6353df2e-7484-46c6-b0cb-08d8beec8eef X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5636.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2021 15:44:09.7284 (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: W/g/cUxIxM7LVqtSLbMpeFkQ2d20eQSNFA1yLPsPaaNTiFR1uN3BD8wV69afHxMjbJ0Modr9i20hcT3W9Ixnng== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0402MB3764 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210122_104412_858871_AD15A643 X-CRM114-Status: GOOD ( 14.13 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Calvin Johnson , Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux.cj@gmail.com, Jakub Kicinski , Heiner Kallweit , "David S. Miller" , linux-arm-kernel@lists.infradead.org, Laurentiu Tudor Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Refactor of_phy_find_device() to use fwnode_phy_find_device(). Signed-off-by: Calvin Johnson --- Changes in v4: None Changes in v3: None Changes in v2: None drivers/net/mdio/of_mdio.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/drivers/net/mdio/of_mdio.c b/drivers/net/mdio/of_mdio.c index 7bd33b930116..94ec421dd91b 100644 --- a/drivers/net/mdio/of_mdio.c +++ b/drivers/net/mdio/of_mdio.c @@ -360,18 +360,7 @@ EXPORT_SYMBOL(of_mdio_find_device); */ struct phy_device *of_phy_find_device(struct device_node *phy_np) { - struct mdio_device *mdiodev; - - mdiodev = of_mdio_find_device(phy_np); - if (!mdiodev) - return NULL; - - if (mdiodev->flags & MDIO_DEVICE_FLAG_PHY) - return to_phy_device(&mdiodev->dev); - - put_device(&mdiodev->dev); - - return NULL; + return fwnode_phy_find_device(of_fwnode_handle(phy_np)); } EXPORT_SYMBOL(of_phy_find_device); From patchwork Fri Jan 22 15:42:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Calvin Johnson X-Patchwork-Id: 12039749 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=-16.9 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 4EFDCC433DB for ; Fri, 22 Jan 2021 15:46:36 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0299D20702 for ; Fri, 22 Jan 2021 15:46:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0299D20702 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=vPTI9TUM5595CEcWph74Dlvn0yyZglAC9FyRa1lSzyk=; b=loZ1vqd4Av/E/iP2gLzFJJ5C3 5ha5gYnSn96LO9V856CwTZjHcSh0+WzdhXQS07UQSNBtumFJOjV32JcuIO7pwPyxqMkFro9Uht5p8 IdnmEi4u4heCk+/bexD0q/fREto9ppFLh2JNKKsEVB0Z2sOSAgnZvRhjADbq8wSt5y1yfS1QJ9AHx ENa26YdSriLf7MHvlTMcmIaZWT6nfBGF5LHo8hjWI8ff52w5o3OOzIqxjm8HXQTdqo0aEe1ui8owg bZBOflEHXZ1QOdJGFpCqL+ZK2mJB4E+OoFcdYXFzeCTpx12kfkz+cBvpUJsomq+dpLKJZDvkvHSc3 VDC2geERw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2yc2-0005cg-89; Fri, 22 Jan 2021 15:44:38 +0000 Received: from mail-he1eur04on061e.outbound.protection.outlook.com ([2a01:111:f400:fe0d::61e] helo=EUR04-HE1-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2ybx-0005ab-7F for linux-arm-kernel@lists.infradead.org; Fri, 22 Jan 2021 15:44:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VbRoIfNeim54e4fyb/qfpwxTkNZ3+VRpsiEjgJvSGdG4P0MSPwkA47xZDTpmPSJaTMC8m6F/yQhjh84LrYSk5gRSpmzbpBOv9PEW2ksP6dkNI16dpeiyetMGr3oUmQRKAh05jBzJnRkp706tmiAJYpziFXQFWqTrGmpp2zprkFu2bf5qhsoRbiQ9gsKJswzu/AZDewDn9iEOD3CI/k6yU/Nl9Z3g4rH1NBHTs75YzH6CZwF2HMAYtqi/lPi7WnD/7NKMm17hutj818TMZHxjn3r62+WgewbIXSPDZ2VLkwqoNETxZ9aZYvYlCY3PBRlRrGXGF6Z11nOfNw3FCjjtuw== 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=iJ2smfaUneArAo4LdK1zXMSBOITFv94TpLE+4NmDJgE=; b=Tr4ogXHhef/4jaVR9pzRIlOuR5KChajh6JtXNxUkkIDLqYBDohbCALnJGd6LTkJrzZKXU3AaOT1k9of4JK4VdLQvKVDQjqZtOIO5o0nnMGVmxzYFb2LazvUSO/8bQAtez8OD7g811ZXVNr0h1MgKOGiZjungMxWJEWFwS/iskiUhUTVEQ1CFVuCBNMKzkn65VZ9VJAwZxhQcRhBkkoM6SGuLNL5Hn8AotsImg/iv2ZfVDg6w631CGa/VO4jn8MmIUBwENTORd80xkSqWgmv08ZhTw/ErokLNBrQgbbJvLBaOgQ1QpRWMq9PQab2k4AnADstbfr4oDMAIdRRYPSjtdA== 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=iJ2smfaUneArAo4LdK1zXMSBOITFv94TpLE+4NmDJgE=; b=MopWTBgRkl5yCsc2o/1byESl5EAOLwjFP3Keuw6lrpnbcJ21ye0Wu+K03FE92DWYVWOVfqPG73qBXvz3WZikpac2iB7f1oPsa8UiROmOp2tW20TAZhrfPnOpzstRlL2tt1ZL3+q43TvqpBsx1VGVCVj9uopSySblhmSgcvMxONs= 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 AM0PR0402MB3443.eurprd04.prod.outlook.com (2603:10a6:208:1b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12; Fri, 22 Jan 2021 15:44:16 +0000 Received: from AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::e90e:b1d6:18a2:2d42]) by AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::e90e:b1d6:18a2:2d42%5]) with mapi id 15.20.3784.015; Fri, 22 Jan 2021 15:44:16 +0000 From: Calvin Johnson To: Grant Likely , "Rafael J . Wysocki" , Jeremy Linton , Andrew Lunn , Andy Shevchenko , Florian Fainelli , Russell King - ARM Linux admin , Cristi Sovaiala , Florin Laurentiu Chiculita , Ioana Ciornei , Madalin Bucur , Heikki Krogerus , Marcin Wojtas , Pieter Jansen Van Vuuren , Jon , Saravana Kannan , Randy Dunlap Subject: [net-next PATCH v4 05/15] net: phy: Introduce fwnode_get_phy_id() Date: Fri, 22 Jan 2021 21:12:50 +0530 Message-Id: <20210122154300.7628-6-calvin.johnson@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210122154300.7628-1-calvin.johnson@oss.nxp.com> References: <20210122154300.7628-1-calvin.johnson@oss.nxp.com> X-Originating-IP: [14.142.151.118] X-ClientProxiedBy: SG2PR06CA0117.apcprd06.prod.outlook.com (2603:1096:1:1d::19) 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 SG2PR06CA0117.apcprd06.prod.outlook.com (2603:1096:1:1d::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12 via Frontend Transport; Fri, 22 Jan 2021 15:44:10 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 4e049d92-9a23-47e9-413b-08d8beec931e X-MS-TrafficTypeDiagnostic: AM0PR0402MB3443: 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: uGhNar0+3+Hu9OA5+J0K25Ax4xRXdjOcylSjpNEH59l+ElY9jSGcXHrS3/qlA5q5wDtovyM91LRWIRenvf66dRh29QMs3y3TrUJjcuYUNLqbEdaRaxMmmvYmn49QQ5vC3gihs1FhIctXW5hRvw0jMrCXiwKM0axDpwuohznJ+tGjl9kK4yy+5uiHd9aKRXJpaLrRuPZRKaR0/CuBJC0qxjfMWMLiNOVq4P++o/WbbjLwBVejV6vBDKcXUYAg8oq73dVpeMClHUb6QWnbTTRPU8yPt3KR1wbkUecDC++PhYni0E8Y+4IK6Wg+dSJ9Efgb5hwYqoheC8xipmfcAuptPFD4af9jYnXN34nXrWE1NWvspo8m/UtLjGHtrJpqwIsKS7vOsQYdBQa3CfGs2KX7XH9M4aHagIM2Zq5eLqlOIVdUdawLglHe3Ca8FdnC4E4CepaRK7i0a5jTFYy91fhnxg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR04MB5636.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(376002)(346002)(136003)(396003)(39850400004)(366004)(2906002)(6506007)(921005)(6512007)(6666004)(186003)(5660300002)(1006002)(16526019)(52116002)(54906003)(956004)(55236004)(8676002)(66556008)(8936002)(66476007)(2616005)(66946007)(1076003)(478600001)(26005)(110136005)(86362001)(316002)(7416002)(4326008)(6486002)(44832011)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: +6P6wZqMBeZIe9KWsOi0Muxreb/tWPy7zXa/K9yNyxh6EoIi9mo0FTzhY/XlvGnTL1enYQUxMv80Q8y5qyNwrHBij2urqMpaZ7cykOc/+fzlz1gHIzjFe3OsMGlgS9pROHMkaqEK9j7/qUNX2xUWoJojQjnMHWtRFM7kVWpJea+oiy96JFQCUOxUoII4J2D5p5haMA/rhm1S2CL54dQAzM4eGRMkAiNpL5M95NvKVV615w8tLCEIn4seuWrrJ1bcXc9+ayCIzL0WvwiVfH8Po+ZEdMV8VUdPkYHKG1Sv+zRNhVyLz+OmjBrrYjAUj2R3dL+8Ol5+zKkzDE/aDwcJjpTMpcT5vncGRSD8vgS9VrF38nSxgJFIUlHPgoYx6M+7JSQOJbT4a7s0rR1Lh0w5tTPU3DQGspCEpf97U7bdPsxbYF0DcjE5175EvSZ4Gukq4y8CxotW3j5ISjfw+pIs23j4Mk4PGwccYn29F6Gf9MxriXj+E3UZjA5rD8zVhzJLSSCND4mXhyptBT02gZmViuKuD8jW9LJEY64hSny0bc/VjTfMjnnVJbaOtlLCL1dCnxxqJ9CwwRR1ITrnDXk311U/lK8pRGABGBZ1YXtjdwO5wKoJsvr0H/eUQVyT+NJMXUVAguFnwFoTYlmHFhUc3MdyoglD9bj+tQti0GqZbrJvyxIsTi4ICO/Ys2nlNP6tVey+wBVJvDzNASEQP+q5MJn/8rXrI8JrJp9vNIHtSbZnPdsOqaRSEohNzbsKOmGz/2rNvbpyyI/WYI8fnmf0h2fv5xQjvMRJ/3jTjST8s8j88c1UMjf3hZ3TKPKGXeJslvTPdyXR9Bxb3EQnswhAOVxVNmzO8J92q+sU2fDPksJGxvy1oXcGQkRCV6BhmFUPPzCdSie/wdBCkWIMifojC2b0aMqWV0BIiLP+ZYKBH+4GEMtPXTSq60fV/4S5b7L7WaVrhU3nTajPpsTsn5scvqufqUbJ0YCiHUnJT1xKxURB8sYDiPLpJFX9MQRMJFBuTSeeXEqZnpq2GX+DpnOuOyF6IFiFDZfi4Heyysc5FN0nkKBiiBbIpFOOrvFvn7ZH X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4e049d92-9a23-47e9-413b-08d8beec931e X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5636.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2021 15:44:16.5676 (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: kpSzEIF3cCBE/r/V7i4Y4sivPpIw1S6oy+YHLVrjbwIIzvc+ikG721OpNtVugzb0eFIVF2gX+NWJ+vvCO/dydQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0402MB3443 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210122_104433_293094_CFA16154 X-CRM114-Status: GOOD ( 17.27 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Calvin Johnson , Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux.cj@gmail.com, Jakub Kicinski , Heiner Kallweit , "David S. Miller" , linux-arm-kernel@lists.infradead.org, Laurentiu Tudor Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Extract phy_id from compatible string. This will be used by fwnode_mdiobus_register_phy() to create phy device using the phy_id. Signed-off-by: Calvin Johnson --- Changes in v4: None Changes in v3: - Use traditional comparison pattern - Use GENMASK Changes in v2: None drivers/net/phy/phy_device.c | 21 +++++++++++++++++++++ include/linux/phy.h | 5 +++++ 2 files changed, 26 insertions(+) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 66e779cd905a..6ebb67a19e69 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -846,6 +846,27 @@ static int get_phy_c22_id(struct mii_bus *bus, int addr, u32 *phy_id) return 0; } +/* Extract the phy ID from the compatible string of the form + * ethernet-phy-idAAAA.BBBB. + */ +int fwnode_get_phy_id(struct fwnode_handle *fwnode, u32 *phy_id) +{ + unsigned int upper, lower; + const char *cp; + int ret; + + ret = fwnode_property_read_string(fwnode, "compatible", &cp); + if (ret) + return ret; + + if (sscanf(cp, "ethernet-phy-id%4x.%4x", &upper, &lower) != 2) + return -EINVAL; + + *phy_id = ((upper & GENMASK(15, 0)) << 16) | (lower & GENMASK(15, 0)); + return 0; +} +EXPORT_SYMBOL(fwnode_get_phy_id); + /** * get_phy_device - reads the specified PHY device and returns its @phy_device * struct diff --git a/include/linux/phy.h b/include/linux/phy.h index dee7064ea4eb..957ce3c9b058 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -1349,6 +1349,7 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, u32 phy_id, bool is_c45, struct phy_c45_device_ids *c45_ids); #if IS_ENABLED(CONFIG_PHYLIB) +int fwnode_get_phy_id(struct fwnode_handle *fwnode, u32 *phy_id); struct mdio_device *fwnode_mdio_find_device(struct fwnode_handle *fwnode); struct phy_device *fwnode_phy_find_device(struct fwnode_handle *phy_fwnode); struct phy_device *device_phy_find_device(struct device *dev); @@ -1357,6 +1358,10 @@ struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45); int phy_device_register(struct phy_device *phy); void phy_device_free(struct phy_device *phydev); #else +static inline int fwnode_get_phy_id(struct fwnode_handle *fwnode, u32 *phy_id) +{ + return 0; +} static inline struct mdio_device *fwnode_mdio_find_device(struct fwnode_handle *fwnode) { From patchwork Fri Jan 22 15:42:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Calvin Johnson X-Patchwork-Id: 12039747 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=-16.9 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 08C54C433E0 for ; Fri, 22 Jan 2021 15:46:35 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BC47D20702 for ; Fri, 22 Jan 2021 15:46:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BC47D20702 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=dfcDmQSMnPzVFyGZaiNE8zGSN/AMWUSFh1yfu3y8jFs=; b=PTKZsTzf2iZulcVi3SIq+95pf igDlpyh5pXbYZBa6zgqN5WIPG0SXj8vlPPylThx1QHqqcM7qKUEd6cknOQW1sQhWADNoITMFbBNo6 zoX48/FxBb1eRCP5tykJ0fRH/ZwMB5xsn/rVSMbt8PerfrsL0i2qnJprPYUmkS+eS6El1y+7h6BVi rPG8UbF9lR4l8pea2qPflHpHexOYrZ/mKKHVA9Yu8lZ1w9MtEYKpXUr8+YvsUtRJMhbgSP82cm47R BFPXq/5PTHC/YS+dLiZ/DdzDM7AwDigLqrPikCcG5QcAGSlRNhbyzKkSIjec8/rEHOD2aK9iWokJT PJJKQnWUw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2yc7-0005fl-Pp; Fri, 22 Jan 2021 15:44:43 +0000 Received: from mail-he1eur04on061e.outbound.protection.outlook.com ([2a01:111:f400:fe0d::61e] helo=EUR04-HE1-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2yby-0005ab-M8 for linux-arm-kernel@lists.infradead.org; Fri, 22 Jan 2021 15:44:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HkOhaRzFP7UnooryvegT2FioHU+6mExs+U/S5WE5vxKJV93kOzPQXM1Og43ySaAJ4LrlOBuk6HDU1Sjv+Yv9AX0htNm9V4gZmcBWnAdtghXJQcfFB7Kcq3VOB3x5UK5wyMnGKEp2CmlidGOHPQp0oTdxqKBIPm5cSe3jiJPG3L/KcC4FMss9qxORuUkAYwoeDlRKCILVgz7/9WPh8Sf2rqkr8+V4q2K09gjNo6HzwaFZCQ4dI3/y2HOKLvLr7RaKGpgyOxV/VEqo/TT3ZOwyAMPUuLVARPHvCE46p0lHvO2JBan4oh+FsOibhUCz3BMK5q+H1Uhh5r3IoKNJblMqdg== 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=EWihxsSG68im8fYDBPXbGyUw7gtTYotk1PRlSVJCg8w=; b=WLCZOX5dPWuTIL8LRlov+VTXwCTgTqGuiZZgqKm1+9f6rUarV1pwGwxiKcz3iwvbFbuFRc4igt+QVQIshwxFJMFOc3by2VhwCPnrxARl9axMSb6Lu1OCi6p6dRkvcZpkIhn8eklDGjxSyMcOJWuCxL/BrBDf0gF0590AWqij3v+h1tWvzWKR5aZ3yjDtu2ZPxh7FN9LF2oM8mrj9x2QH/4xurxKQnn+SE0vWuM5O7eHGaYNTQttQoAYdd4ofutCZV0kh2XbyHB98EM17PiKu9uV/aKwQF3OS1RO+zf5CHho8bLM1qtwroAujxxp8lw+GkBhCaXIvJOe25mEmCGGogw== 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=EWihxsSG68im8fYDBPXbGyUw7gtTYotk1PRlSVJCg8w=; b=g4BXIBPCA6PJuxVQA0APZgx1cD44zef8wcnGLU60etidaqwTexUMsG4dntRNLxZeXJAL5dSzab+xv+pMDulmyoh7NwTkqujm/5nNu3EQamf7scvOmne6oBZGVOk8DIYVNU9HYGlgrIskYUIWd2FEQGeMqhzW2HzIhhg8LcUPx1c= 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 AM0PR0402MB3443.eurprd04.prod.outlook.com (2603:10a6:208:1b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12; Fri, 22 Jan 2021 15:44:24 +0000 Received: from AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::e90e:b1d6:18a2:2d42]) by AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::e90e:b1d6:18a2:2d42%5]) with mapi id 15.20.3784.015; Fri, 22 Jan 2021 15:44:24 +0000 From: Calvin Johnson To: Grant Likely , "Rafael J . Wysocki" , Jeremy Linton , Andrew Lunn , Andy Shevchenko , Florian Fainelli , Russell King - ARM Linux admin , Cristi Sovaiala , Florin Laurentiu Chiculita , Ioana Ciornei , Madalin Bucur , Heikki Krogerus , Marcin Wojtas , Pieter Jansen Van Vuuren , Jon , Saravana Kannan , Randy Dunlap Subject: [net-next PATCH v4 06/15] of: mdio: Refactor of_get_phy_id() Date: Fri, 22 Jan 2021 21:12:51 +0530 Message-Id: <20210122154300.7628-7-calvin.johnson@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210122154300.7628-1-calvin.johnson@oss.nxp.com> References: <20210122154300.7628-1-calvin.johnson@oss.nxp.com> X-Originating-IP: [14.142.151.118] X-ClientProxiedBy: SG2PR06CA0117.apcprd06.prod.outlook.com (2603:1096:1:1d::19) 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 SG2PR06CA0117.apcprd06.prod.outlook.com (2603:1096:1:1d::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12 via Frontend Transport; Fri, 22 Jan 2021 15:44:17 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: d0f34664-4015-4456-7c9f-08d8beec9772 X-MS-TrafficTypeDiagnostic: AM0PR0402MB3443: 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: RhZZ+ZW0Xxv+Qq/0TcmwfdlsF4pI5qp2h2eNz+GCQFEHUMGJOFEBiGkT6+g81cFjp5l6yFmIIx5AttxLRMBGNRsT3ZwsAiYXwhzJXE2IlapCVsE2BPUJS0q/XahGGLgigUrnzuBAjMrtyQcLAVyRgi1KjxIlyx++0LSAolV0TG5qVbZi9JJyWe8XV8905NXkdTWokn9o0p7vUYcXtoNSUVJ3q4y2A3EKIY9Ha2yJgMLNfwNaf1J+yZS9iID9nlwx6ULfsu5iu81CABmgdbai30H2RlmOWmZQb3/+DR4kXcon1fWFGi1B8HbxsWZcGV93RcH4t95/N2Wwp20B+1/QQ2j4HRFkA2KTDFazmM2nRzT5FYOE1ULApoUN0Aov6iK3YeZKvClilEpDUx4sdMBwceP6lgWSONgDXdKRzy3RisBirk7HD12nApXtbQKpBAq4ezxFUo+QqUgD0xTm5ecS8A== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR04MB5636.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(376002)(346002)(136003)(396003)(39850400004)(366004)(2906002)(6506007)(921005)(6512007)(6666004)(186003)(5660300002)(1006002)(16526019)(52116002)(54906003)(956004)(55236004)(8676002)(66556008)(8936002)(83380400001)(66476007)(2616005)(66946007)(1076003)(478600001)(26005)(110136005)(86362001)(316002)(7416002)(4326008)(6486002)(44832011)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: eZLixcoVJENL4yJgNSq25sir1V7Q8iJ/nk2oNNAeOLhq1X3dmVVn4qIK6Ku4lHEfhy7EKCxMzATme9PnGkXPU5ZoJnCY5XGBBJ/DgOjq5oKJoi3ZoYTRBBVziRB/DYyk8+z/t0x/961G9Ps7PxXhnscIoduClvY7+O6bCJFXqJKGTwmZtIiT6Qdp48GcZ34c72vyBSabJNl9e3XrpFNUdS2QSt6XmEf0dwsoGH1gKOpQfPnHbz5IBVq6Gkr5bulx+lJjr2pKwbmWpuKxWF06eblmV891R8t4BzwpI07LdAUF2BhMJGZASMQYjdZhv6nqNLo20tmdEJxxUtUaun/aDkrz5puOiiV+s4Sg/fYpH2QLzw4t8HAG4XtU5E9en8wTetTWSKW8AdFxm5WYaGWf4FlF8i9tXRRJAPSLGoq3LOF9gzwlJTbPeHmJo7i5fmrCZNKDm1NZwkXCnJb7ayq/uAvExKUw7hxosaNwIrbG8cwAJM8e/1ui04gntOEwv3YUwwB5cdmWOjIbshuHrnYRoPabF5leOajrStZM7gVZq890fC+XcwzBNnyDmHQm/LpOFc6yKkLV5ihEsDRBQtFSkqCEQG0ZajsvR3Re5EyZcwIwxfFN74b+uBhtf9VcP++qRO5yKhWSwQYlIcKquzLKxtOwDOKWF8c50qSd8tzBoeQ9Tk6O8LX+HqYDyrZFv3DVZKn9lYkRj3gybf16c+nfC5bYloV6uJGaJoqodHiT1eLO4/GxpjKAYaMpVeHKr7BLv9ge6GZuSpo7Z6GWKdwPDrnXOhaxOxaxurFD9e30MpJKwMc6RDKEdYo6yi4kS1ZN8orIQ+z9LpIa1VbdwWg+Fp2pQtyYB47u0/XtLANyrd6QtKa6wKkxUmf9vaKt0xEyD7+m8eR/qFgmTE5jkCzFcDaJwZjDU+qsFcv0Php4IJtf48ctF1N5vLu4GC1fXTXDkbyaVwW6FCJD8Dp0SDED1DJi6p+kzkBBYO7WrE4hzqUS8PWwYJJpNsDNn/M4LbopK/kRXP8Yj4KsGgM7i+Nhu/Y5J+1OYi5OZcKQHp6Xj53TMhlHk48JmzcOgHeV3F6y X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d0f34664-4015-4456-7c9f-08d8beec9772 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5636.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2021 15:44:24.3652 (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: mT70GdF3NNuUjltCOpR3Kht8FiaJXZt05aUNEXaRxCCd0QAs9qb3XZP9/NUNC4cxQm1k1K+VDEWfSllH3qmCuQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0402MB3443 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210122_104434_752116_C77872DD X-CRM114-Status: GOOD ( 14.54 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Calvin Johnson , Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux.cj@gmail.com, Jakub Kicinski , Heiner Kallweit , "David S. Miller" , linux-arm-kernel@lists.infradead.org, Laurentiu Tudor Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org With the introduction of fwnode_get_phy_id(), refactor of_get_phy_id() to use fwnode equivalent. Signed-off-by: Calvin Johnson --- Changes in v4: None Changes in v3: None Changes in v2: None drivers/net/mdio/of_mdio.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/net/mdio/of_mdio.c b/drivers/net/mdio/of_mdio.c index 94ec421dd91b..d4cc293358f7 100644 --- a/drivers/net/mdio/of_mdio.c +++ b/drivers/net/mdio/of_mdio.c @@ -29,17 +29,7 @@ MODULE_LICENSE("GPL"); * ethernet-phy-idAAAA.BBBB */ static int of_get_phy_id(struct device_node *device, u32 *phy_id) { - struct property *prop; - const char *cp; - unsigned int upper, lower; - - of_property_for_each_string(device, "compatible", prop, cp) { - if (sscanf(cp, "ethernet-phy-id%4x.%4x", &upper, &lower) == 2) { - *phy_id = ((upper & 0xFFFF) << 16) | (lower & 0xFFFF); - return 0; - } - } - return -EINVAL; + return fwnode_get_phy_id(of_fwnode_handle(device), phy_id); } static struct mii_timestamper *of_find_mii_timestamper(struct device_node *node) From patchwork Fri Jan 22 15:42:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Calvin Johnson X-Patchwork-Id: 12039773 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=-16.9 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 E4D8FC433E0 for ; Fri, 22 Jan 2021 15:46:56 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5480421D81 for ; Fri, 22 Jan 2021 15:46:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5480421D81 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=HKzBfUsVdgxmR233SWXLmqdgxs0IiffqgwMPNt5Hg1A=; b=w1EXWgR/satMNhR6av+G4uuMu +C3HitP5nJ6wSNIxM93+7Ca1ESMjPbjQj/5AW5yqdKmnoiSmBROg+7aJDOemjaeitd9LApJTuGRx4 HR2ovLSVQLF41C4WpU7KxdP3qlY79DmqqMMd/XjVNbt9MXAkRsCmTnMuYu860L5qJZDP63GI0LqnL j/9aXXVljfUZQUFw/1NuBuIuL6mhd5yFeXP9/GHS9V3IDA0OrKK+hYcR4mb+GkHkwSbCZzylHTk8d xAviWcIDglxEAL6vbCk3JBzfzKudaVYnBte9z7eM8NIY7gXb9k78HwEraRtVzd9QTbRrwXoi3GT4X dafj2I1Ng==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2ycJ-0005kp-Vv; Fri, 22 Jan 2021 15:44:56 +0000 Received: from mail-he1eur04on061e.outbound.protection.outlook.com ([2a01:111:f400:fe0d::61e] helo=EUR04-HE1-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2yc0-0005ab-5I for linux-arm-kernel@lists.infradead.org; Fri, 22 Jan 2021 15:44:38 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aF0HO/T+/KguzoVbfn8uBxcqVkQY+edFadAIe4KXpqkdsBKvWnuqiEgu86PLDbrQYBn2j4j7nvU35IX+c3zpWNYe8MwPbUlx+eJx2knudy5IVm2qQaaNY5pOTeVZcd8goxH1RkrLd75zOLSDjSQwV1/f0wRTrf3SGwvNZus7HUKdqVrU7XgnoCokKT/KIodvB8EuNDx1nS51f4DGhx6FTdhy+eSbdt9mJFzGMswOtwjobPpx81TOyeGSuUSHuExH+yJBaZdw0Qq3T7OLMVGVNk6QOlP86SbO9ZWnKJ5s18fvhuUrYVcrhpS46WUFwgg8MfAQc+4jKpaGN/uoatB99Q== 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=aW6r0cI8jRG/e0VimEQv7mMN1od2J255b/xafb/Bfy0=; b=CiW3epCBz8Bkv7ycpiHhnNgyC3eFtt1yVAODflFyI/ENTIHTcVerH08FFz2X/VXcmQHNL7xnQ+VLIZtC+YRjlhKXtT0IOCmJWccqvCFugBNKakh76Y7a6Q9LDim9UpbSfgSWtZPTpYaBbcQtDystbEf+/YZRnuqhRwZtlUM3C3DfvvWJtZxUHID1oeitG1hd08qPrFePoGcvLJVnm+Pmt8kOzscj2QJv85xb5ypqysODGggcgNeaXuyR73ahnGbjwZCcGmkMkn4/WBPmoY/s6DDFJ/91f3PkjN/80hEEjdFQur0WAscXImbVl03DpxZmsvCOI9Ly0XYNwiJ5vCKmrA== 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=aW6r0cI8jRG/e0VimEQv7mMN1od2J255b/xafb/Bfy0=; b=lDMdWo7S3xXpgmOayfcVZ4tFJMuKM6tF25yZQj8+BfuWQk15SVTdXEFdZ5VftyQ0OFwHCUu0jpvnF9+i8yDd+nR4oERg+3kaU5+SSjMRTj5cyg3m791UfZHa2srlEAgcfbvPvCxxbIcL6xHahwskNki8aPBWnaMHd6nSXpAOyJ8= 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 AM0PR0402MB3443.eurprd04.prod.outlook.com (2603:10a6:208:1b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12; Fri, 22 Jan 2021 15:44:33 +0000 Received: from AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::e90e:b1d6:18a2:2d42]) by AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::e90e:b1d6:18a2:2d42%5]) with mapi id 15.20.3784.015; Fri, 22 Jan 2021 15:44:33 +0000 From: Calvin Johnson To: Grant Likely , "Rafael J . Wysocki" , Jeremy Linton , Andrew Lunn , Andy Shevchenko , Florian Fainelli , Russell King - ARM Linux admin , Cristi Sovaiala , Florin Laurentiu Chiculita , Ioana Ciornei , Madalin Bucur , Heikki Krogerus , Marcin Wojtas , Pieter Jansen Van Vuuren , Jon , Saravana Kannan , Randy Dunlap Subject: [net-next PATCH v4 07/15] net: mdiobus: Introduce fwnode_mdiobus_register_phy() Date: Fri, 22 Jan 2021 21:12:52 +0530 Message-Id: <20210122154300.7628-8-calvin.johnson@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210122154300.7628-1-calvin.johnson@oss.nxp.com> References: <20210122154300.7628-1-calvin.johnson@oss.nxp.com> X-Originating-IP: [14.142.151.118] X-ClientProxiedBy: SG2PR06CA0117.apcprd06.prod.outlook.com (2603:1096:1:1d::19) 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 SG2PR06CA0117.apcprd06.prod.outlook.com (2603:1096:1:1d::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12 via Frontend Transport; Fri, 22 Jan 2021 15:44:25 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: f9b65e87-3b05-4fd0-d926-08d8beec9d1d X-MS-TrafficTypeDiagnostic: AM0PR0402MB3443: 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: EAR6VcB6ExOa1VUq7FZm3eOCsWJfS5nxjjJJpu2pHEhUlsHIehS6dDse1TPgHVOFDK7VjULI9gDteTXoMRpL7tGVe8JRV8IzPnWT0iiXPBWwfazdoMspsn2vB0wWapDyrPHfu+XeGfb+59eMvs5qnP4SUZixItRYzeGS31p07Q33VYF9inbDsAYiN4R1nbpOUbKNRCJOQ3Km7nEx78tTwilH5IQTYTU7nFcZd/gPtQv2Qw5qzSNHiUFNejRIbkn02Dq1BEA6Cf/flhXtLAwm0A7sHJznVJp50IP6D+SuBm04tuEux3lch9GRUL9WzBwSFboWsDOgLOjuHY1d5LzEdDPK1bN7sI0pm1WR9DyunRH1tv+fMkVz57pWDCUrqvJ1QtNe/MfWPOAo0jHFWPpt+P3PSRjKfcZ+skz/aAxn0etX+5VmN5ytPnY3Br/ToxOTloe4paSWXHVKnOdKuCcBQA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR04MB5636.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(376002)(346002)(136003)(396003)(39850400004)(366004)(2906002)(6506007)(921005)(6512007)(6666004)(186003)(5660300002)(1006002)(16526019)(52116002)(54906003)(956004)(55236004)(8676002)(66556008)(8936002)(83380400001)(66476007)(2616005)(66946007)(1076003)(478600001)(26005)(110136005)(86362001)(316002)(7416002)(4326008)(6486002)(44832011)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: qLQcL3iyOyd2MPeMOzSxJQtNEAXBrdPbvPreNrQ0LH1Rz+Pt9zrstIaBG+j0X6C7VYqszikGs5Xm5D07XQY2bk37raS7Mkf1WPFrD+09hfbVFTafFI/9zL2261KewBmDvS+e0Jl/r+3REBcLxuh3xrdAYTqahkJpx/VNas+jjemqfHI+SfK47lk9pFTCKNQ50eMYxjrDnrtkwTrPsJ7J//A0hj4UoWEsnLJEAwe9/haOWjGZqpdC2yqADiwYcjgBFJV2b+Fg67w/lJfkole6gmZTgUr3bKIL44B0SmfHhuYDcBjAyjnh+ZwQssjf8USGJyRjFSqWBjOCbpzjOSNjicz2YGCaYLRyKg7t3Nbb6w4YTALuH0MA1c6AC4OgCXOcKfMr9F7K1sWX/O6DNZvWq3jTQOFdykVz7p46Ojmh9fGnfPCb8mKXuw3mO+qzF+e0a8QDlStxhWxL/8qxFTqacesq69us6zStOkQ7CB48XH1D2dZ/vC3bSJknKTc2pn3oinUQEGu25l5gCgT+iLKGKs20DM37VuTRmx6Xmuy5l44lFSIau6/0F8Ozq26E70sanezebznSJJbon9imCd7f3uUbOQojCHV4I2VD+K+5KvBv+lufZG9nK/pSiMU65/P1VgkB0f3wl066eEHGHOR7Hry39muE1NJ5AHXleDAOnyAUuLSdcs9bYpuhzW9VN1WnUDSsFrqAUKVGBP95rXPd5MBxMtI6wEYtB3UMsXSOEwpmPc0elZcT9WCRX1PfZAlBnydvMSOSxAeArjJsZVfMvNQd15Oh3Jowp1JFy1jQ7H9no4X3h0lkXcUCIlG2j1gl85VaLVGOMyJAAAmh8rOd4VUMRF56jvE1jEu0HIqKlCgaorIWlJbIjUWrKyMSkFT9U5tP0viCEWciDsaB9mSf8m6a548VW5K8CEyCoDRmRUP1aERr8/xzVmRELgcEw83VizWYQXydn2JknFFHsKfyiTtfMv8d1L4Z/lQBFmeJGXTMgaFQLWX2iVuhtEPHaoL7VECdar4Bj8zqiRZ8NAMcMY/4/oZSOcWwqkNPi30oVaPhudOCkZdBRRoBd63Df/lZ X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f9b65e87-3b05-4fd0-d926-08d8beec9d1d X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5636.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2021 15:44:33.4221 (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: OWfe4OZk5RSwOdcn+0+v12lhuGSH+L9XkI5KgMUVenD1cR61dpIimtbNRr+Bd55S3OlFbhKeoxeZq/BwwUE4mQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0402MB3443 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210122_104436_257854_EDF33A25 X-CRM114-Status: GOOD ( 22.92 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Calvin Johnson , Diana Madalina Craciun , linux-acpi@vger.kernel.org, Rob Herring , linux.cj@gmail.com, Jakub Kicinski , Heiner Kallweit , Frank Rowand , "David S. Miller" , linux-arm-kernel@lists.infradead.org, Laurentiu Tudor Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Introduce fwnode_mdiobus_register_phy() to register PHYs on the mdiobus. From the compatible string, identify whether the PHY is c45 and based on this create a PHY device instance which is registered on the mdiobus. Signed-off-by: Calvin Johnson --- Changes in v4: None Changes in v3: None Changes in v2: None drivers/net/mdio/of_mdio.c | 3 +- drivers/net/phy/mdio_bus.c | 67 ++++++++++++++++++++++++++++++++++++++ include/linux/mdio.h | 2 ++ include/linux/of_mdio.h | 6 +++- 4 files changed, 76 insertions(+), 2 deletions(-) diff --git a/drivers/net/mdio/of_mdio.c b/drivers/net/mdio/of_mdio.c index d4cc293358f7..cd7da38ae763 100644 --- a/drivers/net/mdio/of_mdio.c +++ b/drivers/net/mdio/of_mdio.c @@ -32,7 +32,7 @@ static int of_get_phy_id(struct device_node *device, u32 *phy_id) return fwnode_get_phy_id(of_fwnode_handle(device), phy_id); } -static struct mii_timestamper *of_find_mii_timestamper(struct device_node *node) +struct mii_timestamper *of_find_mii_timestamper(struct device_node *node) { struct of_phandle_args arg; int err; @@ -49,6 +49,7 @@ static struct mii_timestamper *of_find_mii_timestamper(struct device_node *node) return register_mii_timestamper(arg.np, arg.args[0]); } +EXPORT_SYMBOL(of_find_mii_timestamper); int of_mdiobus_phy_device_register(struct mii_bus *mdio, struct phy_device *phy, struct device_node *child, u32 addr) diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index 040509b81f02..44ddfb0ba99f 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c @@ -8,6 +8,7 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +#include #include #include #include @@ -106,6 +107,72 @@ int mdiobus_unregister_device(struct mdio_device *mdiodev) } EXPORT_SYMBOL(mdiobus_unregister_device); +int fwnode_mdiobus_register_phy(struct mii_bus *bus, + struct fwnode_handle *child, u32 addr) +{ + struct mii_timestamper *mii_ts; + struct phy_device *phy; + bool is_c45 = false; + u32 phy_id; + int rc; + + if (is_of_node(child)) { + mii_ts = of_find_mii_timestamper(to_of_node(child)); + if (IS_ERR(mii_ts)) + return PTR_ERR(mii_ts); + } + + rc = fwnode_property_match_string(child, "compatible", "ethernet-phy-ieee802.3-c45"); + if (rc >= 0) + is_c45 = true; + + if (is_c45 || fwnode_get_phy_id(child, &phy_id)) + phy = get_phy_device(bus, addr, is_c45); + else + phy = phy_device_create(bus, addr, phy_id, 0, NULL); + if (IS_ERR(phy)) { + if (mii_ts && is_of_node(child)) + unregister_mii_timestamper(mii_ts); + return PTR_ERR(phy); + } + + if (is_acpi_node(child)) { + phy->irq = bus->irq[addr]; + + /* Associate the fwnode with the device structure so it + * can be looked up later. + */ + phy->mdio.dev.fwnode = child; + + /* All data is now stored in the phy struct, so register it */ + rc = phy_device_register(phy); + if (rc) { + phy_device_free(phy); + fwnode_handle_put(phy->mdio.dev.fwnode); + return rc; + } + + dev_dbg(&bus->dev, "registered phy at address %i\n", addr); + } else if (is_of_node(child)) { + rc = of_mdiobus_phy_device_register(bus, phy, to_of_node(child), addr); + if (rc) { + if (mii_ts) + unregister_mii_timestamper(mii_ts); + phy_device_free(phy); + return rc; + } + + /* phy->mii_ts may already be defined by the PHY driver. A + * mii_timestamper probed via the device tree will still have + * precedence. + */ + if (mii_ts) + phy->mii_ts = mii_ts; + } + return 0; +} +EXPORT_SYMBOL(fwnode_mdiobus_register_phy); + struct phy_device *mdiobus_get_phy(struct mii_bus *bus, int addr) { struct mdio_device *mdiodev = bus->mdio_map[addr]; diff --git a/include/linux/mdio.h b/include/linux/mdio.h index ffb787d5ebde..7f4215c069fe 100644 --- a/include/linux/mdio.h +++ b/include/linux/mdio.h @@ -381,6 +381,8 @@ int mdiobus_register_device(struct mdio_device *mdiodev); int mdiobus_unregister_device(struct mdio_device *mdiodev); bool mdiobus_is_registered_device(struct mii_bus *bus, int addr); struct phy_device *mdiobus_get_phy(struct mii_bus *bus, int addr); +int fwnode_mdiobus_register_phy(struct mii_bus *bus, + struct fwnode_handle *child, u32 addr); /** * mdio_module_driver() - Helper macro for registering mdio drivers diff --git a/include/linux/of_mdio.h b/include/linux/of_mdio.h index cfe8c607a628..3b66016f18aa 100644 --- a/include/linux/of_mdio.h +++ b/include/linux/of_mdio.h @@ -34,6 +34,7 @@ struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np); int of_phy_register_fixed_link(struct device_node *np); void of_phy_deregister_fixed_link(struct device_node *np); bool of_phy_is_fixed_link(struct device_node *np); +struct mii_timestamper *of_find_mii_timestamper(struct device_node *np); int of_mdiobus_phy_device_register(struct mii_bus *mdio, struct phy_device *phy, struct device_node *child, u32 addr); @@ -128,7 +129,10 @@ static inline bool of_phy_is_fixed_link(struct device_node *np) { return false; } - +static inline struct mii_timestamper *of_find_mii_timestamper(struct device_node *np) +{ + return NULL; +} static inline int of_mdiobus_phy_device_register(struct mii_bus *mdio, struct phy_device *phy, struct device_node *child, u32 addr) From patchwork Fri Jan 22 15:42:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Calvin Johnson X-Patchwork-Id: 12039771 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=-16.9 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 E5F28C433E6 for ; Fri, 22 Jan 2021 15:46:56 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6CF7822248 for ; Fri, 22 Jan 2021 15:46:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6CF7822248 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ZoqGZgR+hMHfKQOrMoAvLpeATuByD0b1FpmuQngsmb0=; b=3Y7tpXLYOPB+gzAf4bQ9Uyq8/ LCAUoY6o0PvjOxJKeY64FOTRoujW5zNdNyy/0Z2XvP736KpOBhRD9mWVo4APFIre30HWe34mS4Gx1 sU290GRx6aOBFyI8K79IPPv314FPqP0+BDuJbR9yQUDv7Ur/zjCU4eD0YrJCHYYqFf/tuVCdVLgZU H3bf1cWsQ4H/uwQ01a34cYSfxIJ5heI96Ok4niY7lrCLd4Qxcy6hIjeK/PCEVLaf3FMGeZmUXYwAi FY4CeTdtt6QTgHuHabnVrJ6KKvw9EsxHFshLL7aR+gin1oQ3sLoFdlhXP3pRjhm/1jPcoSn0j1kap etyBHMawA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2ycX-0005qV-6M; Fri, 22 Jan 2021 15:45:09 +0000 Received: from mail-eopbgr70041.outbound.protection.outlook.com ([40.107.7.41] helo=EUR04-HE1-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2yc8-0005fN-16 for linux-arm-kernel@lists.infradead.org; Fri, 22 Jan 2021 15:44:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IDTFYO2GpD846UnwQQf4fYAOaF9jAbMekRSNNoZjqPb13F7zGwlMM8znY9ImB1H/sgDTLe0AQSydbtuz9ZEdBC72MqPWF46ibNDQNyZqpxqBAm39J4e9eslaVWQlal3AvR/SC8saA4IWwhslpCUhwBbeldOHFn2jdbvzuHsBBrZowkD6gpXtuYoGhGst+SPKj+f87lGcp4z+9JC/WhGQM0AFnYJC5jZVFEJi0uPlViKVla4w0dmHzVSIzdXytDrJ9WhzRQ5YFIPeUGUVxz0tO8kjkxSb+Gvk2YeKyeRHmDaFfpk1KAYAOLHan9Y5F49n2dz9XWuxEeT7c+H0j+YYtg== 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=j9C8G8B5Ed9uYFdvaM57toXy/mJJruRLcg/M4CTnTGg=; b=ls5+cbRKIcq5OmTuVof/9QZFNNdActiLaQGt04/AZMeahh8jcXlpjkp09ZW4OXirn2sLVPVX9MLCmyvVhKRXSP1q4yJCiVMTSPOa46ID9d0QFt6p8kuw1iC1ts2zYeCTW3Et3S/Nr2AVtACPbntGj9czDWHfqlfY50KCQ5lKaF1Na4+BmtuE6foZiayf1eGiNk1OV5DgcHJXFRTKbAyQkk+1ZEkbeAA8GZV9Br88ARzcY87YbgQKuXITHgljkrnTUIZd7D5Bw43GJxy/bzxjdvM28FjUfSUllinYxkkdj3e42Ut+FjUVKA4KBBf9p+wcIK9EZWJ7vjA6l9FAVRIHaA== 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=j9C8G8B5Ed9uYFdvaM57toXy/mJJruRLcg/M4CTnTGg=; b=TXwFqa/Z2VjOuh37YaCGd/8SfOcUhbYssTiFIngIpjxYk9C/cphTpg527yznsGfRLvrPwJlL9UeIFUULYrXJ+7S22nPibJKi/n+N2PJaxnglRUuRANObQIVoeSlIBqliYdkQsZxKTNEtSfSiWnMJ6Pj7oC9Tfv3sQ/GCCdbTPcw= 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 AM0PR0402MB3443.eurprd04.prod.outlook.com (2603:10a6:208:1b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12; Fri, 22 Jan 2021 15:44:41 +0000 Received: from AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::e90e:b1d6:18a2:2d42]) by AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::e90e:b1d6:18a2:2d42%5]) with mapi id 15.20.3784.015; Fri, 22 Jan 2021 15:44:41 +0000 From: Calvin Johnson To: Grant Likely , "Rafael J . Wysocki" , Jeremy Linton , Andrew Lunn , Andy Shevchenko , Florian Fainelli , Russell King - ARM Linux admin , Cristi Sovaiala , Florin Laurentiu Chiculita , Ioana Ciornei , Madalin Bucur , Heikki Krogerus , Marcin Wojtas , Pieter Jansen Van Vuuren , Jon , Saravana Kannan , Randy Dunlap Subject: [net-next PATCH v4 08/15] of: mdio: Refactor of_mdiobus_register_phy() Date: Fri, 22 Jan 2021 21:12:53 +0530 Message-Id: <20210122154300.7628-9-calvin.johnson@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210122154300.7628-1-calvin.johnson@oss.nxp.com> References: <20210122154300.7628-1-calvin.johnson@oss.nxp.com> X-Originating-IP: [14.142.151.118] X-ClientProxiedBy: SG2PR06CA0117.apcprd06.prod.outlook.com (2603:1096:1:1d::19) 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 SG2PR06CA0117.apcprd06.prod.outlook.com (2603:1096:1:1d::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12 via Frontend Transport; Fri, 22 Jan 2021 15:44:34 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: e6ae2fac-2a85-4df8-37df-08d8beeca1a8 X-MS-TrafficTypeDiagnostic: AM0PR0402MB3443: 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: f8S4dLha1njSMGtOdeO+G1XyiIlSTG98GTzU8vMk4rRFyuZaoR9HyhSRJiHb8yHj0+W8kKUYHiRMe0AsCunvye4CKx8NohEmAcl7f14uQmOEXxe5vd6pwOX5Z2Bs44a6IuVvUzCQZV4FztOieH2uAXH+ix9L7xpgWIrresyFeLzUDyYhbiav6n37M2GA7oD23SQZsqh/1ELdW0ZX/HybS+YTRWJd9eq1lTosM6O3Ux+s491dBaFKzzMc492GnmcPSY/GNKe7ibA/IRxiuraGE0C+gVR0ScQ/I6+33c1ynYQE6g4Q/msAoNO+lQKVhN0ubBE6OzdxxwyaA3U48HqA984F0WKjqNLTDnKSUf3tgcIsqEs3eIhVimZKtZdv1YFncwWGPwFsvomP9qWuuyUlZcSSxX6vSa3oaZHvvMvdB7C1eU+ikpVktmteJ0pBjWTNKA/61qIACc0xQVOeq5nLgg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR04MB5636.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(376002)(346002)(136003)(396003)(39850400004)(366004)(2906002)(6506007)(921005)(6512007)(6666004)(186003)(5660300002)(1006002)(16526019)(52116002)(54906003)(956004)(55236004)(8676002)(66556008)(8936002)(83380400001)(66476007)(2616005)(66946007)(1076003)(478600001)(26005)(110136005)(86362001)(316002)(7416002)(4326008)(6486002)(44832011)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Kj7G+aLVWvDcJwk9hT9kOf6OAEVJsOWBNkyR4J4HGZXCNkfvpqNS6IVom7LQG8vGBdGZuQXCaeD1LiICsnN74s4vdNGrO9HPtsDb1r6Bf5ahGZUZeflohf3WUfnanECPzCr3xN/Vc+29tILUq/NlUbAFviSiUx+c73SavxN56jZN7reeQAObzwd4YUymZlReOyr1HDeL+XHbQDAJaMBy6Nk0xCCv88cwUWyt5R3S7PARXULk7EnURNp5lnI6gjTwZ7mo5a4RePjTCil7hGkQgx1P3pcgO2GhiQHCUT13amNq04kDr4ZBfrgE8oY3l+Mx4ceaJiF3mjcxmG/AHVJAU9RbIORLwZTOdtf8ma4jZJAFMkSK5yoh1l2rZMjRXb+tQ7MJWsG89r6R/Zcs4sDUV/KfbSySMHhwYXIo7EPtZXD6QTFdvj+n1kQIr+oP6I8lg88ZK1olGUChjjnpDVSM8CjQNZGTV55mWGqNbEqXoiJnlrGzAcXtIlR+E7Zld11z3hUMt1OcU1C47kjvujTkO4mOJQcmYJHw2YyibPv3ZXSiBLdDffJApEr488b9H4GNA52/tt/N0NcJP5MsOG8Yf3KtP367HsNVS8256Z4pQS7HErMW6Iu8RuLZmGcgNojpQ1Ck1JIyl5FpEI6I4d2+eR82Q1MnLtN0AuF8dw56qLYEX/RXo+6k7dbxelezUPVbw/L5jkDj68j/q5TRtjL3xtj46+PRLBnrRpUCIVT0XX9vmKr3mJw0jixu5EvsBtWvMxz0SiEPwf08TC7FoMPVT2l2qaRxkg84JCHzRaB7XsrENIS94tTyrVb7YxZVgwVTucFdTtWGH5DlKSm52VTT528o/hiV8gYFey9SdjATT0846//IXiUjUV1/lAi4YC5Pzkuz+31XKxyiT4wq/Prv2oti9K115bYaWQdvndoOX1DUPFL5zT0lLHD37eGee/f2hfbIq0ttNBq1DnbOGSj4cTTD4WchWFyykhN4B0ORo3SQIiNyhksV29NBdVVmXEI0N2892WQ8VaaA5S+futddbdX3LUTjLsIw6zmnoO6DrCGtjMajn7qa0cg85zjSy9U8 X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e6ae2fac-2a85-4df8-37df-08d8beeca1a8 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5636.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2021 15:44:40.9089 (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: 2oTXDnCJSRNTAWRdzLdzuKuWkYmgiIFisSKNuan/T585MIlClWKJJAhSZpbHLfjPjd4GvHdiGMaTG8D89P8ZEw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0402MB3443 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210122_104444_116846_076DD087 X-CRM114-Status: GOOD ( 15.88 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Calvin Johnson , Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux.cj@gmail.com, Jakub Kicinski , Heiner Kallweit , "David S. Miller" , linux-arm-kernel@lists.infradead.org, Laurentiu Tudor Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Refactor of_mdiobus_register_phy() to use fwnode_mdiobus_register_phy(). Signed-off-by: Calvin Johnson --- Changes in v4: None Changes in v3: None Changes in v2: None drivers/net/mdio/of_mdio.c | 40 +------------------------------------- 1 file changed, 1 insertion(+), 39 deletions(-) diff --git a/drivers/net/mdio/of_mdio.c b/drivers/net/mdio/of_mdio.c index cd7da38ae763..1b561849269e 100644 --- a/drivers/net/mdio/of_mdio.c +++ b/drivers/net/mdio/of_mdio.c @@ -98,45 +98,7 @@ EXPORT_SYMBOL(of_mdiobus_phy_device_register); static int of_mdiobus_register_phy(struct mii_bus *mdio, struct device_node *child, u32 addr) { - struct mii_timestamper *mii_ts; - struct phy_device *phy; - bool is_c45; - int rc; - u32 phy_id; - - mii_ts = of_find_mii_timestamper(child); - if (IS_ERR(mii_ts)) - return PTR_ERR(mii_ts); - - is_c45 = of_device_is_compatible(child, - "ethernet-phy-ieee802.3-c45"); - - if (!is_c45 && !of_get_phy_id(child, &phy_id)) - phy = phy_device_create(mdio, addr, phy_id, 0, NULL); - else - phy = get_phy_device(mdio, addr, is_c45); - if (IS_ERR(phy)) { - if (mii_ts) - unregister_mii_timestamper(mii_ts); - return PTR_ERR(phy); - } - - rc = of_mdiobus_phy_device_register(mdio, phy, child, addr); - if (rc) { - if (mii_ts) - unregister_mii_timestamper(mii_ts); - phy_device_free(phy); - return rc; - } - - /* phy->mii_ts may already be defined by the PHY driver. A - * mii_timestamper probed via the device tree will still have - * precedence. - */ - if (mii_ts) - phy->mii_ts = mii_ts; - - return 0; + return fwnode_mdiobus_register_phy(mdio, of_fwnode_handle(child), addr); } static int of_mdiobus_register_device(struct mii_bus *mdio, From patchwork Fri Jan 22 15:42:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Calvin Johnson X-Patchwork-Id: 12039775 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=-16.9 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 458D8C433E0 for ; Fri, 22 Jan 2021 15:47:23 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CAE8E21D81 for ; Fri, 22 Jan 2021 15:47:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CAE8E21D81 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=bdD+oa9FK8j4Q1a1YQScUN2ah36ECnAiYJ5al0DOMt8=; b=WM+XRnu2GpThLoqKoljn2dTKA 5A5fHAnnZP5bIEFtAYfsto07GhobQSxtMGvdLco7a65MGAjhwrwwyp2sCPnB6B7NIcnz/k8YzLL4N 4FcuT5qh1+0n5xyhjChwAialajrBeM70sKjcExq/MWhQRROw+A586HcbbGkXqv7YRoT4I9QJmEM2V SE+GisfbUU41qPfDGLmYXabyfbFuUOVNKING+JCw4+0Sz/e0aLB0AMNL93iwLHUfHjVJkRjHQ+R4N PqZJzTi7eMLvrpF69WvpVD1RMHUrFQNHmZ6KvLYaHOz99lGWn2RO/4E27ZzGHAUZTNW5VFbiXfGOw 0j3bN4vfg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2ycw-00060G-Vi; Fri, 22 Jan 2021 15:45:35 +0000 Received: from mail-eopbgr150084.outbound.protection.outlook.com ([40.107.15.84] helo=EUR01-DB5-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2ycF-0005iZ-4b for linux-arm-kernel@lists.infradead.org; Fri, 22 Jan 2021 15:44:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ac12epOOdEHMg+dpLOUBNhWVZ0QqdE8/r6s1g7itrUZTWRxWHqyES4Xf6expjV1hPXW4oODH8AojC5GjkYTb/XtecbIhg7B9QpXnsMH9YCztrjq2iA/k48zUHm6HTnYLpzyhVnrP/gkPaz9MP1xSKmBeBfu9QY4o0TxAhpVZ+16DDETYvpeUWP2llfF0n31vrg02nxp1TRnBB4XWXSN/nCR90kGCmcM1izy1JeOmlvNGRtwLWMfZ/ut045uJxBnCzWLHFxPDM57LZOB7QUGwt1qJjSXPuFwkBtzKqPF4Sb5WqHmIa9ULNBT887MyqtLlVRMgOT9sKlXUUcRXLJaRzQ== 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=W7/kAEER/OsTllnLifBkVu7Njodnkbk6ftA91/uO56w=; b=JihrcUcVKfCmp8IHFxYEH7YYrXXEu0pDRiYTdpdv+eqJOh4zch/jJnGkE9vXVNWp7JHTYRiiIE9l8DEGuP/la5ip7v0MPFyY3Oyj/cm11JSj0ZhbVrz5ntaWZDY2a2Nh8QhzNChnkGFSxIoMVNYsVaFCOnhn+8JdckLCtH4a9jNHNqLd0yOOPEw/bL8Ud/VQCIyE7N5ygBHcYGzxrQCOThZvUbF5SipwxOQgp/qRDcgBKNYYXnTwqXTSIqCyZMwcZHP9vQLPU+x6as5AVkv6e0LAh3MdSqH7Ae7PJMOLCVl+RGQKDeEG3jGM9nluSzvxEvUq8Mr3He2ciPUClihmiA== 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=W7/kAEER/OsTllnLifBkVu7Njodnkbk6ftA91/uO56w=; b=MRx7jmOplbhLKzoZL96T8pTg72SloWOmgc+FvnAj08DriQtUMKKYADvim8c7HY5owXE5dhuvGTS0+htSugL6jgYTfpPNUmFZUTV5jSClV/NStpz3BBmX3+h/sGtSOhDe+IG7mZ5ktjV1uKZQjOdIwbmB3n82YfDF4E+7ZD99kT4= 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 AM0PR0402MB3443.eurprd04.prod.outlook.com (2603:10a6:208:1b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12; Fri, 22 Jan 2021 15:44:48 +0000 Received: from AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::e90e:b1d6:18a2:2d42]) by AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::e90e:b1d6:18a2:2d42%5]) with mapi id 15.20.3784.015; Fri, 22 Jan 2021 15:44:48 +0000 From: Calvin Johnson To: Grant Likely , "Rafael J . Wysocki" , Jeremy Linton , Andrew Lunn , Andy Shevchenko , Florian Fainelli , Russell King - ARM Linux admin , Cristi Sovaiala , Florin Laurentiu Chiculita , Ioana Ciornei , Madalin Bucur , Heikki Krogerus , Marcin Wojtas , Pieter Jansen Van Vuuren , Jon , Saravana Kannan , Randy Dunlap Subject: [net-next PATCH v4 09/15] device property: Introduce fwnode_get_id() Date: Fri, 22 Jan 2021 21:12:54 +0530 Message-Id: <20210122154300.7628-10-calvin.johnson@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210122154300.7628-1-calvin.johnson@oss.nxp.com> References: <20210122154300.7628-1-calvin.johnson@oss.nxp.com> X-Originating-IP: [14.142.151.118] X-ClientProxiedBy: SG2PR06CA0117.apcprd06.prod.outlook.com (2603:1096:1:1d::19) 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 SG2PR06CA0117.apcprd06.prod.outlook.com (2603:1096:1:1d::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12 via Frontend Transport; Fri, 22 Jan 2021 15:44:41 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: d5985425-b386-43c3-27cc-08d8beeca615 X-MS-TrafficTypeDiagnostic: AM0PR0402MB3443: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3383; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PMUznJIFRA5WjWLJevdcDTkp/jtUJ6s7eYxdy+R2oxNuiR+/bfzWEqwcL/5bsBplEIiEs4uPwGBaTUHAo5J8Ylz529rW6dNVowxB/gzAjpza61RaHUsa4NVZaPtt8l7L1qehXTpCsLLkU9Y8HouC9hSlKplpKCTp7SRJBa4K0yu52qvqfGD3mfl9+gF3MUpzVK5ZhLwRhOnrYPPbvC+E8I68i0qwQl4bKmxxGusus+VJZshhKBk7j/pOj7aaJOuzVrleltgDFTR1gmYPKJgjMCKOIlubBp8zQEMrFemRcy8bJrL+ftHpS/FOgqLj9/nvxjoyiVkJvNK+s87uO2KtbGMbUfM4lPKQcYgInEzHyLY/8aLak34TBlRiV0XhouIIYmx9OevXtDfa4D8MZiiZa9Oht7cHfqB29Mp2nyFMmCUPdvM0HUZnccJjw66bjFgCBMu3SB6Okx2jLw/MiKopYw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR04MB5636.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(376002)(346002)(136003)(396003)(39850400004)(366004)(2906002)(6506007)(921005)(6512007)(6666004)(186003)(5660300002)(1006002)(16526019)(52116002)(54906003)(956004)(55236004)(8676002)(66556008)(8936002)(83380400001)(66476007)(2616005)(66946007)(1076003)(478600001)(26005)(110136005)(86362001)(316002)(7416002)(4326008)(6486002)(44832011)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 5QCtMUEU7fL7FpzvJ3skWekZujaSzmzbJy1UJqZE++/bhvFmU4nlwHXV0iOaJI64W/tR35FEDglz8curUJhkn4FUjhQihGG9osrmkstkmMXaR8OzwJxC//EeqxGTh0CayVW2geWjWBH/ELHuPrIS+q12AqVELsSj7fGJKiB8AxAfZUwFH3dsVUqK2SccxnGWU+Z0UEHihQDlsiZP/l2HAGguHYNxV5RKM1cWVpMYp2T4UG+2qeos/lJO9cPCdRGZe4d2nSd3D1dOASIO0zBSjG9D304sUbs4zZhjcLu0FabJBjtewRKSkZFIp0PGpgBUpvdynv9lLqLknBc4X0CIpn0BY5F/8P5HTyEfFRXU/KnmiOk3wUv5bFNoAn2ZWqxG66i4K8tsllCZul5y6hHnnRu9DhHPU8u70GpDcQahXK4Kx+1+tqTXuXQ/RPAOunWCcVnsmFSHzX71NPdQIsFARJnSCaCYicG+OKZzOcKLeBJSTg7ooDjIPmaeHOQVpdhxl6YsI1ujWuGIFICxT50l+D3ze9/yULBVVPXi+9gLL7RzveaE3J0Gpb8/G+zDamv9qL/n7RD7inWinaecGLWncy0qIrLoJKz2U8FiKRM034f1P284MFCOtd+21E4eI/nbYmn5Z6oDS3UxC7r+n2d3qwWkHW7U6f+0JkMypVzmKqk1e58xPtTxz7ev3KG3YitZEYlQdi20EeeroVq/WokD8rJGDgvrUi+EfVhhCjSRVCheeMKFCLiI/toxLQplGaO7btg344OhItjgA8Vmrcv42hyxo5pBu6TmiC+6WfgXn5uJHdFdmwS9xwpUYo0Av12RqLrnMt5m+bhc5YHxZjYgDpwhMyG6DCra8b5V55liCDOVEAClDfxSONcQ9KSLTtEKwThpoTIdeH2bUwIP188hKlKRqiwnEGNzlvpGqzFGNy5C1wJadnLA7AaUlZbsz5an6DGZ5ySploc46tMmKN0+ZaknDJ7piamIu1ShcL+KgZRcKWEUt9/xWGq1EbvVAozvUA6nf6rTuJsPn2Nh9EZB91TrIpIRwvYiA67TalBHrulWi/v3y6S0pq/WC5tXjs/U X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d5985425-b386-43c3-27cc-08d8beeca615 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5636.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2021 15:44:48.4896 (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: zcEUeSpQNK+NVWnc0b+1hspfDQ9sB7e6ai/LhdIoJJbxncLGERK8dsMqQWTErvdaKnK9+uIVqW/tzFR8ygHTjA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0402MB3443 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210122_104451_847146_B13F685D X-CRM114-Status: GOOD ( 17.15 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Pinchart , Bartosz Golaszewski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Calvin Johnson , Diana Madalina Craciun , linux-acpi@vger.kernel.org, Kieran Bingham , linux.cj@gmail.com, Greg Kroah-Hartman , Andy Shevchenko , linux-arm-kernel@lists.infradead.org, Laurentiu Tudor Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Using fwnode_get_id(), get the reg property value for DT node or get the _ADR object value for ACPI node. Signed-off-by: Calvin Johnson --- 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/base/property.c | 34 ++++++++++++++++++++++++++++++++++ include/linux/property.h | 1 + 2 files changed, 35 insertions(+) diff --git a/drivers/base/property.c b/drivers/base/property.c index 35b95c6ac0c6..f0581bbf7a4b 100644 --- a/drivers/base/property.c +++ b/drivers/base/property.c @@ -580,6 +580,40 @@ const char *fwnode_get_name_prefix(const struct fwnode_handle *fwnode) return fwnode_call_ptr_op(fwnode, get_name_prefix); } +/** + * fwnode_get_id - Get the id of a fwnode. + * @fwnode: firmware node + * @id: id of the fwnode + * + * This function provides the id of a fwnode which can be either + * DT or ACPI node. For ACPI, "reg" property value, if present will + * be provided or else _ADR value will be provided. + * Returns 0 on success or a negative errno. + */ +int fwnode_get_id(struct fwnode_handle *fwnode, u32 *id) +{ +#ifdef CONFIG_ACPI + unsigned long long adr; + acpi_status status; +#endif + int ret; + + ret = fwnode_property_read_u32(fwnode, "reg", id); + if (ret) { +#ifdef CONFIG_ACPI + status = acpi_evaluate_integer(ACPI_HANDLE_FWNODE(fwnode), + METHOD_NAME__ADR, NULL, &adr); + if (ACPI_FAILURE(status)) + return -EINVAL; + *id = (u32)adr; +#else + return ret; +#endif + } + return 0; +} +EXPORT_SYMBOL_GPL(fwnode_get_id); + /** * fwnode_get_parent - Return parent firwmare node * @fwnode: Firmware whose parent is retrieved diff --git a/include/linux/property.h b/include/linux/property.h index 0a9001fe7aea..3f41475f010b 100644 --- a/include/linux/property.h +++ b/include/linux/property.h @@ -82,6 +82,7 @@ struct fwnode_handle *fwnode_find_reference(const struct fwnode_handle *fwnode, const char *fwnode_get_name(const struct fwnode_handle *fwnode); const char *fwnode_get_name_prefix(const struct fwnode_handle *fwnode); +int fwnode_get_id(struct fwnode_handle *fwnode, u32 *id); struct fwnode_handle *fwnode_get_parent(const struct fwnode_handle *fwnode); struct fwnode_handle *fwnode_get_next_parent( struct fwnode_handle *fwnode); From patchwork Fri Jan 22 15:42:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Calvin Johnson X-Patchwork-Id: 12039777 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=-16.9 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 484A0C433DB for ; Fri, 22 Jan 2021 15:47:54 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D3D95221FF for ; Fri, 22 Jan 2021 15:47:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D3D95221FF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=/817hMLpsA8nxRGQhdGyCjjW9+WDDKLhnMDoPzN2Pko=; b=au4g3n0M7Mbph4z8agLj5xoa4 PA1oxvRBNP8BEQpGpBtOZtcEiMHBfeMqxPjP8MYB1inhD1DoinjMpI1uteKatl08eWQpG9pnBfTmn xvyeQSsgwaq1URaBZN2Pzsp7F4Kp7Y/5aceGLlqxtTw+KU6v16viONa4x4KqlVJdceLZaAZcJHG3x ee/0J9aXKwnck2bJ1I4DTbZ7DdNh9WnPJJ3seTlOTFtrHlqyez6dmKdvlie/c94rAciJr9G3SfpRM NbM7ISW0tUCiLkRJh2bYgfGWycYkbpw9zwo9L+fJhoo5g8IMNlvR4p5OAQ6oyS8beLU/kSDjMHh38 m0DtRvNtw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2ydD-0006Cn-6d; Fri, 22 Jan 2021 15:45:51 +0000 Received: from mail-eopbgr150045.outbound.protection.outlook.com ([40.107.15.45] helo=EUR01-DB5-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2ycM-0005lt-JR for linux-arm-kernel@lists.infradead.org; Fri, 22 Jan 2021 15:45:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Q0NvJbMluUzV+kzEkw0M15Pdk7tkZacX8uBx3TxKqVRAie8s9uHxNoZyo2UDVh6x4MoofwXOjOFfnA7MkGEjpzR0lzTylbk4q/6Z6CCelfU3KI5WXPVvOoaamp0yI59qu1hnIod22JsBQgH8LfWhdBK78r9xtF+EsYk6Pi0w7A8XKfwubMEaBJ0g4aQff0dD9ZJudd/dxS3Et7pP2Q78HEMH2HAbe34J/w0pVDhr7VU3uHbyNyZuqrkPVk/iJyCQJ0jN6640LaVq5L+XVvjLiE2ojYiy4AkcNx/2iDOHnCSJatUqNIZAY3qj8QI3/nNPoIoXFG0sKwj/dvpTRBPz2A== 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=OBHmkTm5PwVsPz8pnjCbkqkwCF097d71rRO6haXYo5Q=; b=ErmRQZJ7tCUCvoBWLhL7ukmJEdqShuDc5+DXXFN1wHqpVb0bsrvgmhqdqRX4B16QlS7kKuiY7MUEE1hUL95OuMhaJnCl+ZpmuyOVjx0PgDEp/BP6x4hOL5TTjPyw3G4ijV8MwwMcDm5uGegCVVu8ihrs62eF9yxAP9GoAW1vfEC6q4Wn1xpSKGxXk20bCme3O+bRZNcIhMqHiB5pST4UmXgCpOXVZ3p7XEgO1FzqEMNfrsxnmrqe08Uxvu0+OoFtcwX5w8Pie3Q3FB92Hhvvxfw1znUI2atbBYohVyuJGFC7UgisCwvr89SGO3NqYEfDfpg8BV7Lz/uxgtGHIwlgSw== 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=OBHmkTm5PwVsPz8pnjCbkqkwCF097d71rRO6haXYo5Q=; b=BNwvJw7p/DiiDXlWFKG1mjV+f+vChsp2nvgEQbtIdeaHNzCoGAonZWnS5Fawr4aSxMDa1anC535E9ekMP9YHPl7JMC6MwoRyC7ZAsBPPMzQIcUZX06UWRmPjhT+XWapCPL03VKZUMFQ410DdFPVmNsII1Awn6HkQo14+6WWjHa0= 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 AM0PR0402MB3443.eurprd04.prod.outlook.com (2603:10a6:208:1b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12; Fri, 22 Jan 2021 15:44:56 +0000 Received: from AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::e90e:b1d6:18a2:2d42]) by AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::e90e:b1d6:18a2:2d42%5]) with mapi id 15.20.3784.015; Fri, 22 Jan 2021 15:44: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 Subject: [net-next PATCH v4 10/15] net: mdio: Add ACPI support code for mdio Date: Fri, 22 Jan 2021 21:12:55 +0530 Message-Id: <20210122154300.7628-11-calvin.johnson@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210122154300.7628-1-calvin.johnson@oss.nxp.com> References: <20210122154300.7628-1-calvin.johnson@oss.nxp.com> X-Originating-IP: [14.142.151.118] X-ClientProxiedBy: SG2PR06CA0117.apcprd06.prod.outlook.com (2603:1096:1:1d::19) 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 SG2PR06CA0117.apcprd06.prod.outlook.com (2603:1096:1:1d::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12 via Frontend Transport; Fri, 22 Jan 2021 15:44:49 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: f8c97cf2-09ff-48cf-fce3-08d8beecaa8d X-MS-TrafficTypeDiagnostic: AM0PR0402MB3443: 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: wR2EHPeGL+ZXGtxwHDAKdJncik0w+a+U904gzO2kofEwEuU0iDlOUq+ChJs5uVyqz9PEG160KDVl61VX1VFduc3+IKWzU+ag9kS6TddEgGTLz8SIEFDU77fnziLRonW82ZBZgEDLIOyhKvN2Qf/5BeEJ9AsJ4JyDL9rRfgEO8Gov+EaJXSsLPHsqDKC8GGS6glRb0oEE4ji+lqDD+h0xQGAqFUyX0jj6cg6wQ5BAqQSQX/jYX3mK+SnNovCAbHNXkgKwIAf9Lm1CzlCjuxEfZZJT0IFMKzRiEXjvkRxjoT5dHZs86eXS9B5FyF70Y4BoC3IAnTsWgVcUrfGhdNdCWEZOroGy9t/0oj+aNgrntjO6L0CtjpInIPS7DV/TO9zO+qrAMArkK59fDViIkxImNas0IE4idB03JsyUZuI9zP7PNfXVAigQ8Q+2bgAx3214GnmxNLOzJ8QY67Ng8AJk+Q== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR04MB5636.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(376002)(346002)(136003)(396003)(39850400004)(366004)(2906002)(6506007)(921005)(6512007)(6666004)(186003)(5660300002)(1006002)(16526019)(52116002)(54906003)(956004)(55236004)(8676002)(66556008)(8936002)(83380400001)(66476007)(2616005)(66946007)(1076003)(478600001)(26005)(110136005)(86362001)(316002)(7416002)(4326008)(6486002)(44832011)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: YhOwwXW/ghE3zvj7MT/BL8P2S4VTZngHcFZ7RYe3WcJn6vT1oXBWVsDYBy/2wvpqkI5+wkXxMQpAybHtDN6UNjl7z9JsYldMWeprUf78py4oOGa1+nVNcknXIMt92ezkU4s8c8g0yU1qHL3k0s9GvTwezYUMangjJ6UpIto+fl4Kg72Jvsc9ukdeMj9VAVDOClQwX05G7caOCXDshzTd/tTL3qaRZxFKR+8R7M6OEqrYiQWJKsRaitw9rL26cP1Xqay9ZsB8prb07yvG+1yv8YU7jHJ/QOUa8zcn96iAemEm7Gspb4R+x6Dml9R1OGflcg25zL61uTxuaQjrrawtCBOfxHsBxD3qZJ7VEZyhxxZOtRzoZ+X4BGHJU2m3lB+N9g2OMDjcS3PgUnVK5cOUKve8G1nTLocWTg2BJch3dfvxn7Y3d+bjIHhNoUSVvHqkj8CsVE7OkKZmazUdgDC94K5gGkaSu5rwa0MmdpS638mpeXUqY6KYNpIsr1puSxW3oucW+d0jjvk6E3jpUvyAAvXb0jiHtgfZKxaEOnfrZl3CUBOAMPEi3sSE5SsqFwdnLrbVzmwu93kYJxRtN3vqGu2srWd2lsYbGLeG4w0soXm2ApR6kYxXSUSqwl30gNwDkcTYLJ5kzd8VcZ6rtwEg4byu5BR0pkKmJkUfMTugr7qXEJFTQSFyvgt1pOa9+ifqnNYhC+oxhZ2XFoNd/X1Ouwoqf/J/wnErTnIgjWjQcfFgxNLdr2OzKS/S4al166MQQ0G1DzgWPGNRXwip0BCXQsTz6yBoGMYxhylav+k91+17WZwaId3zi41eAPjAqXnQlYATWG0Wihgh/wF5hzRxulNJGMLusAXvAWI3DNEafLpHrGPOXzbbDJu6vzNtUN9qhTqCTZpQ8kSrJacvFdv8KlGAxjZPjQwfbV41PgSgVKhb2LgAzRi0IkpsnFF8zXhxXo6iLE4aIt/HwX6wVImEkkfUwy1LGaDHscDRJ0rZXV+AedlMzgUJCoWuvwAEEEIu0+WqoxlXbNUN8COG/vPyL2kK+hQpPdQw/TijQdqIO6zTnyjIJx6Bqvso4IwS9sxu X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f8c97cf2-09ff-48cf-fce3-08d8beecaa8d X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5636.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2021 15:44:55.9664 (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: 4uy6na7/oX7cML0p9tFBrioCMAD50ZOADrlKLJqQC3qkdaXIhboM3I+iFwwutrbyEM1JxDtfZTBjeK9wtXPQ5A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0402MB3443 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210122_104458_747308_3BCFF89D X-CRM114-Status: GOOD ( 25.27 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Calvin Johnson , Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux.cj@gmail.com, Jakub Kicinski , Heiner Kallweit , "David S. Miller" , linux-arm-kernel@lists.infradead.org, Laurentiu Tudor Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Define acpi_mdiobus_register() to Register mii_bus and create PHYs for each ACPI child node. Signed-off-by: Calvin Johnson --- Changes in 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 | 49 ++++++++++++++++++++++++++++++++++++ include/linux/acpi_mdio.h | 27 ++++++++++++++++++++ 5 files changed, 85 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 a444cd9d7d7f..fdf5231373f7 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -6666,6 +6666,7 @@ F: Documentation/devicetree/bindings/net/mdio* F: Documentation/devicetree/bindings/net/qca,ar803x.yaml F: Documentation/networking/phy.rst F: drivers/net/mdio/ +F: drivers/net/mdio/acpi_mdio.c F: drivers/net/mdio/of_mdio.c F: drivers/net/pcs/ F: drivers/net/phy/ diff --git a/drivers/net/mdio/Kconfig b/drivers/net/mdio/Kconfig index a10cc460d7cf..df6bb7837d6a 100644 --- a/drivers/net/mdio/Kconfig +++ b/drivers/net/mdio/Kconfig @@ -27,6 +27,13 @@ config OF_MDIO help OpenFirmware MDIO bus (Ethernet PHY) accessors +config ACPI_MDIO + def_tristate PHYLIB + depends on ACPI + depends on PHYLIB + help + ACPI MDIO bus (Ethernet PHY) accessors + if MDIO_BUS config MDIO_DEVRES diff --git a/drivers/net/mdio/Makefile b/drivers/net/mdio/Makefile index 5c498dde463f..2373ade8af13 100644 --- a/drivers/net/mdio/Makefile +++ b/drivers/net/mdio/Makefile @@ -2,6 +2,7 @@ # Makefile for Linux MDIO bus drivers obj-$(CONFIG_OF_MDIO) += of_mdio.o +obj-$(CONFIG_ACPI_MDIO) += acpi_mdio.o obj-$(CONFIG_MDIO_ASPEED) += mdio-aspeed.o obj-$(CONFIG_MDIO_BCM_IPROC) += mdio-bcm-iproc.o diff --git a/drivers/net/mdio/acpi_mdio.c b/drivers/net/mdio/acpi_mdio.c new file mode 100644 index 000000000000..adab5dc9d911 --- /dev/null +++ b/drivers/net/mdio/acpi_mdio.c @@ -0,0 +1,49 @@ +// 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 + +/** + * acpi_mdiobus_register - Register mii_bus and create PHYs from the ACPI ASL. + * + * @mdio: pointer to mii_bus structure + * @fwnode: pointer to fwnode of MDIO bus. + * + * This function registers the mii_bus structure and registers a phy_device + * for each child node of @fwnode. + */ +int acpi_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode) +{ + struct fwnode_handle *child; + u32 addr; + int ret; + + /* Mask out all PHYs from auto probing. */ + mdio->phy_mask = ~0; + ret = mdiobus_register(mdio); + if (ret) + return ret; + + mdio->dev.fwnode = fwnode; +/* Loop over the child nodes and register a phy_device for each PHY */ + fwnode_for_each_child_node(fwnode, child) { + ret = fwnode_get_id(child, &addr); + + if (addr >= PHY_MAX_ADDR) + continue; + + ret = fwnode_mdiobus_register_phy(mdio, child, addr); + if (ret == -ENODEV) + dev_err(&mdio->dev, + "MDIO device at address %d is missing.\n", + addr); + } + return 0; +} +EXPORT_SYMBOL(acpi_mdiobus_register); diff --git a/include/linux/acpi_mdio.h b/include/linux/acpi_mdio.h new file mode 100644 index 000000000000..9be6f63cde8f --- /dev/null +++ b/include/linux/acpi_mdio.h @@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * ACPI helpers for the MDIO (Ethernet PHY) API + * + */ + +#ifndef __LINUX_ACPI_MDIO_H +#define __LINUX_ACPI_MDIO_H + +#include +#include + +#if IS_ENABLED(CONFIG_ACPI_MDIO) +int acpi_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode); +#else /* CONFIG_ACPI_MDIO */ +static inline int acpi_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode) +{ + /* + * Fall back to mdiobus_register() function to register a bus. + * This way, we don't have to keep compat bits around in drivers. + */ + + return mdiobus_register(mdio); +} +#endif + +#endif /* __LINUX_ACPI_MDIO_H */ From patchwork Fri Jan 22 15:42: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: 12039779 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=-16.9 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 D7871C433E0 for ; Fri, 22 Jan 2021 15:47:57 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8652021D81 for ; Fri, 22 Jan 2021 15:47:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8652021D81 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=WthxxKdQ1lEVWDKIde07CpxvvyJmW7zohhhNYty8o0s=; b=lpsJpQj01amvHm9JtTSAig29W 6uXihTV9YJ7pfR+oosaNEIDa6JIpqqZEsUKqyvn1P6n5YbboFtBgg16AkI75GW59pnc2Opq1aS+fF lYRFi6fVM2EQ/lqvNSD7vtpIKvAX6Yn4XjPGvUlwZBfOWLED/CBxPsye71LLSC00tJJAVqImPnvi8 HsYaSHaFkdgoiVVm/hJmJhcX4mlTiJ900CvHeTYhOQLwbP9gpALp7ackUxh0/75qnac4xpOYZFdFV bXAKWGTg3PRQb8acXjEJ/XPt+cVmUfZvIJTT18vQaXWpbIbxit/cFRFSN848lqfX6+f52OpYGOWkq NADEsjpew==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2ydY-0006MF-Iy; Fri, 22 Jan 2021 15:46:13 +0000 Received: from mail-eopbgr150075.outbound.protection.outlook.com ([40.107.15.75] helo=EUR01-DB5-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2ycT-0005ou-F3 for linux-arm-kernel@lists.infradead.org; Fri, 22 Jan 2021 15:45:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cCmkPMSu9OMkkSSx2ppXstXhYEVrKj9uWDiLUC9Mm+KVoWcHQ8IC1LXod6Q/kGe+fEG82RRub+uFiKYAph7orrRDrJQ0WFIwI3LEHQUEStKDIvY5oIidumtYA2TUylV1nKjZz59WQ/fW5mETE3A6BP1h2Q7y6X9OFH2Z+L+zeQC9oGCPVP5hTMSlnYDEYJTdmOPiZBV4clgKjOpeRUsMK+qqp2t5Co1bCQkFpWh2xDrh2DCriB6J0Ot6yIaYPZR5Yv34Dcel2ZPMVuAAitaR3bETyT9qMDv9QITAqggAtHrA166lcASJ+XIhUz0W5/ObBTMD/EcP2QGY7eqnzYOb0w== 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=RXr0sTUw6cD7f1/N3YABnD3ONUkreuF7dIe4nUA9uEY=; b=JSiek0PXfWNmvixOmHOt62c52+o9CDgKGw+b65FN8rb6IRgJWUfPqAlmwHkabdrk1mLMyBQd0M6H7Dei9aljBaAn4KT5p5t4LXy9cRqlVVg/5ghv4iJur1suIUUMXiNhfSSP6QhxVsoLnWU5vehjpCvfR+C/J5uvXy4nPikWiyHfw25gZJI9o1HWmtEm5siL+p7mHwqFtr3zt8ufBZmePAbKsgJiqvlZey9iDlsvcz5JybxmcQI5JU+Mxcx4NstdYvJQ/UySDUv+BoTn4ebGy6/mRFKs4lQaYfI5mGmNy/X6lO6+l+cSaR5FNuortFiav6DYHEIdjLNNc670s9DmTg== 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=RXr0sTUw6cD7f1/N3YABnD3ONUkreuF7dIe4nUA9uEY=; b=dbL3+hLET9ri+G8kPobVz9hc9uu3aJcTGsZgP+prVOmjzfZW3SjohpzDSwSqbx9ATSiQdOp+ec33bzg/O+m+hMhAeWckAQFZ2yDMh8ieTVVmPrmGWwR1eWcM5h4PMGvHYnqIreT3lK0XWPl49PNZAsjZGsJd0MrORLwtiT8IzQ0= 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 AM0PR0402MB3443.eurprd04.prod.outlook.com (2603:10a6:208:1b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12; Fri, 22 Jan 2021 15:45:02 +0000 Received: from AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::e90e:b1d6:18a2:2d42]) by AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::e90e:b1d6:18a2:2d42%5]) with mapi id 15.20.3784.015; Fri, 22 Jan 2021 15:45:02 +0000 From: Calvin Johnson To: Grant Likely , "Rafael J . Wysocki" , Jeremy Linton , Andrew Lunn , Andy Shevchenko , Florian Fainelli , Russell King - ARM Linux admin , Cristi Sovaiala , Florin Laurentiu Chiculita , Ioana Ciornei , Madalin Bucur , Heikki Krogerus , Marcin Wojtas , Pieter Jansen Van Vuuren , Jon , Saravana Kannan , Randy Dunlap Subject: [net-next PATCH v4 11/15] net: mdiobus: Introduce fwnode_mdiobus_register() Date: Fri, 22 Jan 2021 21:12:56 +0530 Message-Id: <20210122154300.7628-12-calvin.johnson@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210122154300.7628-1-calvin.johnson@oss.nxp.com> References: <20210122154300.7628-1-calvin.johnson@oss.nxp.com> X-Originating-IP: [14.142.151.118] X-ClientProxiedBy: SG2PR06CA0117.apcprd06.prod.outlook.com (2603:1096:1:1d::19) 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 SG2PR06CA0117.apcprd06.prod.outlook.com (2603:1096:1:1d::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12 via Frontend Transport; Fri, 22 Jan 2021 15:44:56 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 9d0033f9-b158-4fb5-0fb9-08d8beecaeb7 X-MS-TrafficTypeDiagnostic: AM0PR0402MB3443: 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: tyq5vs8gwa8tFGCTqdW4OevcWwA9EIXKFLyEUJk233oem+0ydFU2mAiL7SnnFtn1/UbkQFV8qZ/klJ3YnVKsZ8E5vdHzxaGKrGGzFqhAUV2tDBYBW7gtfVSN0D8Y2YVIpIv88HCn/6U2eB0tnT+Nhf3yazFGHwY47Ek785WKJqMQkRuF9j34xx3qglaMAqtbj/HhzvMUpH+9ulEWvISnPcdz9U3TsXbRqiZWxOSrytw1Rnl5PlEt0l0+5Cc+V3jpBJBVbMSzH+CNNGomqn7bf3KKNe3gGnY+zcgREn05O41HOWoKQH7EMs0sn2b8hpWoqTMyTe57dKTXeS1UBNOJk8/xMaZEoJyVXIrT3d9AjOaTJDZCmhm87/5uS/+iS8UJNjihfo7Zlaw9qCmFlPA3FxqmS9EZ48bnDkYCAdIHmejI/w2rqGJuyziL+9VFfsvTMvOMnbuiC+pXnH1hDHAKBA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR04MB5636.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(376002)(346002)(136003)(396003)(39850400004)(366004)(2906002)(6506007)(921005)(6512007)(186003)(5660300002)(1006002)(16526019)(52116002)(54906003)(956004)(55236004)(8676002)(66556008)(8936002)(66476007)(2616005)(66946007)(1076003)(478600001)(26005)(110136005)(86362001)(316002)(7416002)(4326008)(6486002)(44832011)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: QwnU5+aJv6z9jj2qq67ZCCKXBuOuRU/JDiHcEJWz5h0w1Mls/C896Enmm16VSHIO1MlU68FbNRWmx0L5RxU3PWA1x5CL1ZuXFhekSw9yI6YslpvqIJQzXpErd/hmphKrvdFzeoQrl9396iBVVvYSwTkooy9HZtCU4DmOFkIbeBsqCcI5KaDcm/LmO9GxqLmzuLtBZ/4W/Nz9pGl8tNSdLb7dZ4y4EXQd3qlmj5aCtf1dVdj2uKDs95awmrDUhaLCEdSvXriL1LDxZUVRps1yu3IyXoVaci/TVbJEmMwvfYJrO0lMU+alKzHkYtLlEup9VdoW7xXOGFd821M9FOU+8kUecXcEjwg+IUVJkblqJJyh4RLFbXgP1nOz93i+ARRvjHGTFwA5pamcxFR3MnTuPjoLIckkaGoYR6wUReU6VdPBoOWoCnb7FeMk3LLskwIPzdv3elKnrE3+oRfj7WTNQaNFg9DDlZnH+d5nfszi+oyO/1ZzD7rmUXQobD1uSTTxvtEGbJ44DMNyRaPZShBWMhEkr0Hx5Bi7ngyhrwbrMUfddCjVFpnTIW46naGaaxiBhIoEIm2llJJbUP8sbsUH3zUchCdAfDKTs4JpHd1oC4WxjiLSxZl8E5Gou7BfXc/s6AU4rjKEa/sIKOSDL8/BOUljBJ9R4C0jiWxxHizxM7xhQEqGevVTgb2YKXUB7BGHrtbeiiZz0DXhGIUcKXRemQmSYfp/spMJlKQwwqeqIQ+GoEOLUPZ0vBf3F9xldO9BDFFXgKSDxmyyL710lKndsTEyHsaJbbithYAtoye7lZQARmdYu0INu9D7sjbQeTu5hjongai4FjTEKqwUD29FXzfofsdNz8KerVS9fdSbhU79NKaaG7xg6Ukq6ifn9FIe1nYXVByJ+zx0Og9dcUbhEmBU1oRRXQ1HN/LDs6u8UE6nN+L0+hrQqeZLFNmfH3bthih25uL0IzqgEuC8ilDMc7q99D50huTYr6wJAdo21GN9Z/TRAYhpKE93FXNybOuvfUB9UquRWOC19+tB0dBbw5ZOuub8OwQkXhuURr+sDJEXIdg0acSGEjwsK6DclfbX X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9d0033f9-b158-4fb5-0fb9-08d8beecaeb7 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5636.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2021 15:45:02.7756 (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: UnDDkIoZLZh/QPzNSMOIyz0aSYa+90gIyUUue5W1BA3XIUWNwHvlkVASup4emJiDxeB3kEJHi+wVNjJ0ln9fHA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0402MB3443 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210122_104505_565392_0E25EA45 X-CRM114-Status: GOOD ( 18.09 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Calvin Johnson , Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux.cj@gmail.com, Jakub Kicinski , Heiner Kallweit , "David S. Miller" , linux-arm-kernel@lists.infradead.org, Laurentiu Tudor Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Introduce fwnode_mdiobus_register() to register PHYs on the mdiobus. If the fwnode is DT node, then call of_mdiobus_register(). If it is an ACPI node, then call acpi_mdiobus_register(). Signed-off-by: Calvin Johnson --- Changes in v4: - Remove redundant else from fwnode_mdiobus_register() Changes in v3: - Use acpi_mdiobus_register() Changes in v2: None drivers/net/phy/mdio_bus.c | 21 +++++++++++++++++++++ include/linux/phy.h | 1 + 2 files changed, 22 insertions(+) diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index 44ddfb0ba99f..362e12853f30 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c @@ -9,6 +9,7 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include +#include #include #include #include @@ -568,6 +569,26 @@ static int mdiobus_create_device(struct mii_bus *bus, return ret; } +/** + * fwnode_mdiobus_register - Register mii_bus and create PHYs from fwnode + * @mdio: pointer to mii_bus structure + * @fwnode: pointer to fwnode of MDIO bus. + * + * This function returns of_mdiobus_register() for DT and + * acpi_mdiobus_register() for ACPI. + */ +int fwnode_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode) +{ + if (is_of_node(fwnode)) + return of_mdiobus_register(mdio, to_of_node(fwnode)); + + if (is_acpi_node(fwnode)) + return acpi_mdiobus_register(mdio, fwnode); + + return -EINVAL; +} +EXPORT_SYMBOL(fwnode_mdiobus_register); + /** * __mdiobus_register - bring up all the PHYs on a given bus and attach them to bus * @bus: target mii_bus diff --git a/include/linux/phy.h b/include/linux/phy.h index 957ce3c9b058..765e1844cfdb 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -387,6 +387,7 @@ static inline struct mii_bus *mdiobus_alloc(void) return mdiobus_alloc_size(0); } +int fwnode_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode); int __mdiobus_register(struct mii_bus *bus, struct module *owner); int __devm_mdiobus_register(struct device *dev, struct mii_bus *bus, struct module *owner); From patchwork Fri Jan 22 15:42: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: 12039781 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=-16.9 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 AC0F4C433E0 for ; Fri, 22 Jan 2021 15:48:07 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6071921D81 for ; Fri, 22 Jan 2021 15:48:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6071921D81 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=wfrin7gMsC49kmrF0UbRGtTdSAqwrl7arJ6bnSmSBt4=; b=Ca35h1KMJhfKSjsRTxoitkDUo 3zVrnwOf9FCBn5ezndhUU8vLa6CCFeKjo+7moFBCP273etf7pJpIq5veyanKWT4vUXCsrjKOh4ST4 1Mv+t6Izj3P60Vay8kn1mRh7t9n06R4bqTg5smY1TfzoTgMFxgcEL67LHZRoh08vDq5LwgLoAw5Xp 2WJolppolMBPmHgcg/1GOi7J6YMvjmc3HJ6BMfyWLDD86XY8IBrlwqI3FRB8nHBmzJnek+TXshGoX irR/GQ/GFCoq5Hyv9Up7GZEkKMkWzICOROZwOSh9DNf32G7av7BNX2Em3Im/F2bvH4trP/cbC0gW8 pOHKTa7MQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2ydo-0006TH-Gz; Fri, 22 Jan 2021 15:46:28 +0000 Received: from mail-eopbgr150040.outbound.protection.outlook.com ([40.107.15.40] helo=EUR01-DB5-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2ycc-0005tR-QD for linux-arm-kernel@lists.infradead.org; Fri, 22 Jan 2021 15:45:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NYQ/2BxO0VGi73x69n7iwrMW7qmgZqoIPVpccpM2R5lGxvFLf6yztxIIpMwAH1vcBvIloNp4pznbUo+GnNBnrB5cei3V9fIJkKyizXH4HUdqrlznTKz9SgYidvRKUN+McngO/kM2OQnrU4iVBexyPxicIQkH5h2qCYiFcpSeIw/+h+YhL3WUgGj1QwhVENoL09J3PiiQZtl9QsnayuhPLkX/59zg4JpLcHFF0I8wscUTZOIJtpryMIBLAYmq6iXMesceo8Sc9oS+bS9J7Uzenta+XV0NKHd0ktQfPLlDJ5brOTjc2g+tkFr4i5qgndAewqygG3dqWYrxLRcsiC+dYg== 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=aZ+Sad1o+bp70pULx46qnPf6XZSF2p+QFZE/XTBIWEY=; b=SnwyQmDkfY53CUtGyD/PuUT6VRQeKfWQPIq2UW4t0NhqN2ALa9DZzL7UrjwH3wWAFcK7WjjZA7oqtoO0JT88Hl2qtKUihgm4hcRdrOsbzCgH+y59OqHJk9nK3/+hyVUkgjvZz9qih6iPTKQ30CJrp+iAgw/3nWsQRysP6nADCusxKpam9MwfXbksALW6f7Wlxsuy0uefRa5P1ZsJOktIXaQZDyQDBmntx6N+H+QjXedzUhChHfSJSsvoiUyzRk19uSXRiKzRIoVPIV5RWBaenOJqlfj0mZ/a0eFJVt+RrM4VltGIMmq27kRAg6UfEHnc5xrbUBkj+Ofl/vC9cE4cqg== 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=aZ+Sad1o+bp70pULx46qnPf6XZSF2p+QFZE/XTBIWEY=; b=ULvxd5KbJACzbmVfs6iRgx38l7et3EuX37bT0j5vs2hmrJyUg0MGN3aKOLdPqQMSdhtKYAxGhIEo9gi/irovRQjEHSfvTp87D/9b41dM6XVANYQOfgXN+/hjj8B8LvvsZsn4bl6FGjtPFA4nIjzODiOrZAtSlP6FukiQnGwrIak= 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 AM0PR0402MB3443.eurprd04.prod.outlook.com (2603:10a6:208:1b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12; Fri, 22 Jan 2021 15:45:11 +0000 Received: from AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::e90e:b1d6:18a2:2d42]) by AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::e90e:b1d6:18a2:2d42%5]) with mapi id 15.20.3784.015; Fri, 22 Jan 2021 15:45:11 +0000 From: Calvin Johnson To: Grant Likely , "Rafael J . Wysocki" , Jeremy Linton , Andrew Lunn , Andy Shevchenko , Florian Fainelli , Russell King - ARM Linux admin , Cristi Sovaiala , Florin Laurentiu Chiculita , Ioana Ciornei , Madalin Bucur , Heikki Krogerus , Marcin Wojtas , Pieter Jansen Van Vuuren , Jon , Saravana Kannan , Randy Dunlap Subject: [net-next PATCH v4 12/15] net/fsl: Use fwnode_mdiobus_register() Date: Fri, 22 Jan 2021 21:12:57 +0530 Message-Id: <20210122154300.7628-13-calvin.johnson@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210122154300.7628-1-calvin.johnson@oss.nxp.com> References: <20210122154300.7628-1-calvin.johnson@oss.nxp.com> X-Originating-IP: [14.142.151.118] X-ClientProxiedBy: SG2PR06CA0117.apcprd06.prod.outlook.com (2603:1096:1:1d::19) 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 SG2PR06CA0117.apcprd06.prod.outlook.com (2603:1096:1:1d::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12 via Frontend Transport; Fri, 22 Jan 2021 15:45:03 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: d5902739-eef6-497a-bc4e-08d8beecb3c4 X-MS-TrafficTypeDiagnostic: AM0PR0402MB3443: 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: s8VAnlRbeHU4lPKniS5J7lC1UZzx2tXkyHR2amF7edvYedn6w1NiW444p3pka358cTm7+0pKBWg1otBYfrnZuuthL2LKeO0WOXIWDdARrHHuPNLpvj4uBupMfG9TZAenh9NRDxbfUEeqY94j0NZmmeCjYDY70fdNgu6KCQrmu479OLTKh/l889PcBb6eFuyCPU4mFaOygbeFtmbSeZsB//t+g+IlJisbTNcqco66YE8uyyvIJ7/IiRnrmrQa9bpO2Ys0u/a7AkwZ5GtwFQ5Y/skaktMQtJvLCmmP2BIhcF/g5o37sADmSiBOCIxuSWXA71XXPDshQDKyoBnu8xo5w14HTPPXZKLh5Bdn7oF7CkJWHxHT5ma8+jE2ewSF1yfHD4CTeOAp0LUM9157F6YDU9s0Aytbu2z0OUpOq/MwJ0VCXia6oIHivicVKaNxbJlBr30nH946dGTSWiyWYuIqSg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR04MB5636.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(376002)(346002)(136003)(396003)(39850400004)(366004)(2906002)(6506007)(921005)(6512007)(6666004)(186003)(5660300002)(1006002)(16526019)(52116002)(54906003)(956004)(55236004)(8676002)(66556008)(8936002)(83380400001)(66476007)(2616005)(66946007)(1076003)(478600001)(26005)(110136005)(86362001)(316002)(7416002)(4326008)(6486002)(44832011)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: YjyAqa2QzSKiXUwRyBuLVD4mfSPjPZsYGT7qx0qCYGKm73OoRi7R5RMbLGsFH/QSwcKwaxeyp4BJBv1FlbicXGQPd18gzwn5OoeUSV99qCXQCAW6nxKjwHdSOhG384g8xuuUvwKSktT9IiZjkpP2EdLmFWXNwrexbc63N18z2MN5XQ17OXoXE58IRYKKkSk0hXKWsQt5/RQB7bDPpWQfQY5FniW6zRpjcP79MmW+aqUuQG+fd/jy97ghb/34rDZHQPgEt+wtq6AyBSNTIYOLz8Ex7hBOzEGUzT6osla8LM3c1ZZKIP4josRzjPVjUJBSV4tv0isK0w+yThRf5uV1XeCNU1VmoOqk6yCsD21EX1MsYGWkgtMvTl0OY72MpsdHYDydtJPif6HaWB0kUosgeil/suaJ4DBDf1V5qJPu1+Fpd4BtKNVVH7Z9oeMogbh721q5xTFOQvifC3UXqb+JFmgBCDAXKjbHulj1PFdj9IFYQNH8GwEFo6EDH9Zth2zaPq53udeIbqGFA29Qe8rdhSuLI0GEv8n5dUiZ+qZ1N2TwNgG8eeI6y8bWaYTLGXV6H1pgUGeVchakqDyxWCy8NrUdrs2rSuszZfX6Oja+bkbao8toGBtb9sj4iKlE22WOrVqnGNRlZhAeMwOMuZZ7QDu9Xi4mowS+yLJpQwL5ySfDg3Uzj2hItBTenTHlj+KxSqfk5t8B+MG6vBSXanZNJuYivR+ZwMvDGs1w2UmS/TNer2etOIbZ3yvZ+oSE/gooEO12IR4nqe4kkZyyGoTLzYqBrv1E6k5/q1C7JDAywRZuznITIlCdFeQMRPrivweG1l6KDnseBlg7cVGr78eSIaJ9QfpANXgAz30vqyHYc1zRhzSyTScib7zKQcIya5cgyOUQJEgbPgtOPL6+47J1fTqPWCkV2yeWAt1zPx2iTnZMYpc7SYOtcaz+5Z3BIhfB526/NwD9GVcW1Mbo7ExQBULEQVQSdK0phiIc1XDTLzaacJU7cSxOfSkymjbeDjNXRdazVxX8bkRt3Goj+O+U8wx7XSu63nfP1JBwqc/BYna0XVjM6odd9BTVVzcuXSCU X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d5902739-eef6-497a-bc4e-08d8beecb3c4 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5636.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2021 15:45:11.6026 (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: 0nH6n/AP0t7794E5S1ndCJ6c3NkS+lvU7Nwh6LydWfDWylCKEKs4bLnWDNIua6Q0l+CqmsB45r6Fs0bAAnM/vQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0402MB3443 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210122_104514_920406_2DBEC138 X-CRM114-Status: GOOD ( 16.48 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, Jamie Iles , linux-kernel@vger.kernel.org, Calvin Johnson , Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux.cj@gmail.com, Jakub Kicinski , "David S. Miller" , linux-arm-kernel@lists.infradead.org, Laurentiu Tudor Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org fwnode_mdiobus_register() internally takes care of both DT and ACPI cases to register mdiobus. Replace existing of_mdiobus_register() with fwnode_mdiobus_register(). Note: For both ACPI and DT cases, endianness of MDIO controller need to be specified using "little-endian" property. Signed-off-by: Calvin Johnson --- Changes in v4: - Cleanup xgmac_mdio_probe() Changes in v3: - Avoid unnecessary line removal - Remove unused inclusion of acpi.h Changes in v2: None drivers/net/ethernet/freescale/xgmac_mdio.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/freescale/xgmac_mdio.c b/drivers/net/ethernet/freescale/xgmac_mdio.c index bfa2826c5545..dca5305e7185 100644 --- a/drivers/net/ethernet/freescale/xgmac_mdio.c +++ b/drivers/net/ethernet/freescale/xgmac_mdio.c @@ -2,6 +2,7 @@ * QorIQ 10G MDIO Controller * * Copyright 2012 Freescale Semiconductor, Inc. + * Copyright 2021 NXP * * Authors: Andy Fleming * Timur Tabi @@ -243,10 +244,9 @@ static int xgmac_mdio_read(struct mii_bus *bus, int phy_id, int regnum) static int xgmac_mdio_probe(struct platform_device *pdev) { - struct device_node *np = pdev->dev.of_node; - struct mii_bus *bus; - struct resource *res; struct mdio_fsl_priv *priv; + struct resource *res; + struct mii_bus *bus; int ret; /* In DPAA-1, MDIO is one of the many FMan sub-devices. The FMan @@ -279,13 +279,16 @@ static int xgmac_mdio_probe(struct platform_device *pdev) goto err_ioremap; } + /* For both ACPI and DT cases, endianness of MDIO controller + * needs to be specified using "little-endian" property. + */ priv->is_little_endian = device_property_read_bool(&pdev->dev, "little-endian"); priv->has_a011043 = device_property_read_bool(&pdev->dev, "fsl,erratum-a011043"); - ret = of_mdiobus_register(bus, np); + ret = fwnode_mdiobus_register(bus, pdev->dev.fwnode); if (ret) { dev_err(&pdev->dev, "cannot register MDIO bus\n"); goto err_registration; From patchwork Fri Jan 22 15:42: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: 12039783 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=-16.9 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 C599EC433E0 for ; Fri, 22 Jan 2021 15:48:16 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7977221D81 for ; Fri, 22 Jan 2021 15:48:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7977221D81 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=vHB979CJWp3Z3DdnNoyWuYHEWZr1CU80DT8o9B2l3Cs=; b=f3SNUyYw61Skx7d4of4IzPi3d CJBYXI9KtSxlqM6//EScre3Oe4ACBAKrC95fuT1Hmu4v8blbVuE9cIP1qMWeqfgMzSKrsMbPS61f0 ERBsRKV08D6D045hFYbrLEmCiyGEUcZ6CJQ/ESCxf5jDQptD5E13BDMGm5Fb15IyYoAGRerZREz6u 57AkMokYrjN4uF5M1dGdcHxQSAVhUg1PR3DQij7xocvTzESq0NWjdlX6PlSw3vRDPE1IxmuSpc3RM z707EsLCuMT8KMVVMSyCuFXyzQhy8sWwMqAlgWOWF6yAKnFiN3x2PJyC2oa/1MvnYDWiCTTxQx4Rr sJQOJEm8w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2ydv-0006Y8-Ne; Fri, 22 Jan 2021 15:46:35 +0000 Received: from mail-eopbgr150053.outbound.protection.outlook.com ([40.107.15.53] helo=EUR01-DB5-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2yck-0005xi-A3 for linux-arm-kernel@lists.infradead.org; Fri, 22 Jan 2021 15:45:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Lnk7AyG2GsIg4IUO+AgDuHb+iTAjJnK0igXwLghKT7g2h43/BPGd5+J5ehtM0pSvHTHbek20/6KXC6wob/P5EF3P/zEwhK74rSXhUUZhdNGl0hH9C1ibt12vy6ervMILEoouJyYFUW4fzN981MwqUT4pfVvzorQ2jQ4oNKCzW4QTHNgm0JUvV0jK1RRObdAREVgpxVkr2QAdPA7CL6vUwah5k3gZFTypyL1gbdP7p4I0oJje+oi7B0ew/FBboAXhbrCb7z2bZ7B1mVQCdHfQpy8sDd+k1K/NnUz4WC7bBRalykeF7id3a1VyeDgmvd4WEAsngKIxOddrBt0UzN7r5g== 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=hPXicAkotzmCd19tN3aKAQTf20oFbPpqck2oZy6QbN8=; b=AX5qJ031uW0Ezk5t/ve6D/eZi9Y6Xzu+t474qRz42vuxhHSb6NptqlzAuGEx5fTEvQ/febaIor4kds5qGc+9dP4YTBhKkFuDcwy3q/pUPB2M/IXFZXJ4sm9tAC8Ac5szzOh56UOwlmhjhFpp14hBbUBI5e87dMAlrF4MAH9dtUerawGm9M0QJuqSfimGKoSc7sdKRJnQRRICdYYOLfD9AAI1V80dP94PqHZQ6ELlUn8NSizNOgD9J0Kf7l8mN433H2yBg7ri2h5qCJwV78Nrl/O17dadlhtnjPW524uKKk+Stayk+EdmULQkKp/LOgN6hg8SyVaWYXWPvSSkVKK+kQ== 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=hPXicAkotzmCd19tN3aKAQTf20oFbPpqck2oZy6QbN8=; b=jYw+5x4CJNTWXcABb3YodAelIU3YAW45/DejnlNS0cqomyDF3QYI1wdSrQfbNOhLf9XaJ1jPCXx0gXvZygP3CzVMzvy4/sBrzr1uwbX9Mpz9w6dt+rfprcqvfk2+tEm9Tdzde+qm6f4bqQAtIV+/U2CW8fTQkyYj8n7I0FyAwHI= 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 AM0PR0402MB3443.eurprd04.prod.outlook.com (2603:10a6:208:1b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12; Fri, 22 Jan 2021 15:45:19 +0000 Received: from AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::e90e:b1d6:18a2:2d42]) by AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::e90e:b1d6:18a2:2d42%5]) with mapi id 15.20.3784.015; Fri, 22 Jan 2021 15:45: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 Subject: [net-next PATCH v4 13/15] phylink: introduce phylink_fwnode_phy_connect() Date: Fri, 22 Jan 2021 21:12:58 +0530 Message-Id: <20210122154300.7628-14-calvin.johnson@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210122154300.7628-1-calvin.johnson@oss.nxp.com> References: <20210122154300.7628-1-calvin.johnson@oss.nxp.com> X-Originating-IP: [14.142.151.118] X-ClientProxiedBy: SG2PR06CA0117.apcprd06.prod.outlook.com (2603:1096:1:1d::19) 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 SG2PR06CA0117.apcprd06.prod.outlook.com (2603:1096:1:1d::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12 via Frontend Transport; Fri, 22 Jan 2021 15:45:12 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: a2892d52-168c-4999-693c-08d8beecb88c X-MS-TrafficTypeDiagnostic: AM0PR0402MB3443: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2399; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /aH43FXRUxlfFhq0XKZsv6A5Ukve3GFRPuahM95uGk7jzQm/n/G6NaqpJWCl8ZAALhAd28hf7TYk3y4nQjkNnT9xIH2tjtJ/UoDl6H3koXwTIIAbyd9MzINvSoAdf5Gm8tESYQSzpbOjPyNiR6N2dr2BqbPF7NhC32IGCqw77BkHcnzbn4L/sBYyBCK0R6u3yPhSHrNKzSKRP/gOkIBJYq6XNGzaq43cVwkO7GQVyCvQLaxPFBemQLGyygLoWG5SAWu2Fk5X1+S+k33lBWyvLwPyDODy+zf5Syau9xCoLh3Ipvc+NXlDpNzsxx2te4TSXhWmF8uVBnPCRRttM+4f12PP/QJUoAS72Zti777hMyNGaAf06qxN2LeUBLBGgQGq/v4eGcMDmqN+fk4c8oN9pjtA10igojo5u9+RCjrCiW+pkCcfk7HdzzRzgNObdW+jeAqoXizKu1X9Fu/hL2FNmQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR04MB5636.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(376002)(346002)(136003)(396003)(39850400004)(366004)(2906002)(6506007)(921005)(6512007)(6666004)(186003)(5660300002)(1006002)(16526019)(52116002)(54906003)(956004)(55236004)(8676002)(66556008)(8936002)(66476007)(2616005)(66946007)(1076003)(478600001)(26005)(110136005)(86362001)(316002)(7416002)(4326008)(6486002)(44832011)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: AdmRGScw0y1uYSVYP9vPbzmCP98C4LZo039VeCc5HAZvHS6qRUCDT1AXnyv9bm3akotAvjg5s23ZdNJUUYYnX99tkznMheH1jRKIjljzreVLlrzU1JLloKyqTaIhUzK5J58MTA2n1hH34fTlXlUc+RkrkXJOOoOO133PdNvJQFenOMyYV6bj6o3yyQ7gMJr3F8/GoEmZ8Kny0FrSMdTq+xNFvpuKliZ8ZxeW2JHUiW7foM1w5xNKL8resUymjVfQgC/aS6ij706K0vkf+FOrVj/3nvd8S0MQwDQQQcr623GY517GpSRGrn0QoPaCHfVULMbHMbZM1t6x56voJIHO6JdICPHpVpTNosKX13r5i8sgIzQVedqTEPUNLcUDn67Tr3VvSc0qq4rJ0ODsNYaIJFvKGSSQc1KteXVIvGCUwYzoxfspoh/9iD/5fU+J2umMRiIzjTSlxbij1NSJoShEMaqgZaWdjQi0Guwk2JoD234mL0S+Ev/xaN7Q3LSb3EJku3gNSicKMD1aHjbRdsMiAn+HQx6PqI4nPDEWaWpq+pAn6JtUIpu2Yvke6u17AuCQFvCsYMNDri/3I2BDUtjzd3wUp7Fe/RYpuBrGmK/id7gIMjxWWVaTAIQFES7ErtxaUdR51vr+4FRCKm7LnWpeBUGFzdkP5JRR3CIxpFijFc13ReTtMCdWCf5SaFZ5oc7MxWZPBaPVUgXXQdGyOc8RaTOZfkoRircBc0yjGemy+5gNOC9DEeg2A289GuS2pnfs8S6unyGey/n1+8uYVY4LOOqajzZVsA7Aldqnz0QglkKNM0l1gpzgv7rPgjLxgJyJght17/ZLohCgNApYEzb/M56gwnpbe+iizlJH3y68jrWz/craH30pGT56Dbj7I5ZWXqGf+nr9heb6KZYs6wc95F1fdV8wcvPjHrLOsvCnkJBZ9Ym3NNB76zEH9kXh7otDyHIJk9D0ksIiDUqarf/eAPWVcG9Gl/jsgmILFXoqFkmxcPfEle65BNJF3D+DllPG3Dn9tPtezmFBx4smnwt5md9s2+O4jIt770RPw3UPoFgOwMfxyvoZiXExflrg0IBj X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a2892d52-168c-4999-693c-08d8beecb88c X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5636.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2021 15:45:19.2793 (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: 0U0c4BNBRYsnTk+rg8gilpyGc2NlFcrMimylsC2qawCTRIRkHbZOlsmItDwNLUyEbA8zZVsPvArh6WfJEcHN+A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0402MB3443 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210122_104522_396101_755E6132 X-CRM114-Status: GOOD ( 19.39 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Calvin Johnson , Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux.cj@gmail.com, Jakub Kicinski , Heiner Kallweit , "David S. Miller" , linux-arm-kernel@lists.infradead.org, Laurentiu Tudor Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Define phylink_fwnode_phy_connect() to connect phy specified by a fwnode to a phylink instance. Signed-off-by: Calvin Johnson --- Changes in v4: - call phy_device_free() before returning Changes in v3: None Changes in v2: None drivers/net/phy/phylink.c | 56 +++++++++++++++++++++++++++++++++++++++ include/linux/phylink.h | 3 +++ 2 files changed, 59 insertions(+) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 84f6e197f965..5466e1e6272a 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -5,6 +5,7 @@ * * Copyright (C) 2015 Russell King */ +#include #include #include #include @@ -1120,6 +1121,61 @@ int phylink_of_phy_connect(struct phylink *pl, struct device_node *dn, } EXPORT_SYMBOL_GPL(phylink_of_phy_connect); +/** + * phylink_fwnode_phy_connect() - connect the PHY specified in the fwnode. + * @pl: a pointer to a &struct phylink returned from phylink_create() + * @fwnode: a pointer to a &struct fwnode_handle. + * @flags: PHY-specific flags to communicate to the PHY device driver + * + * Connect the phy specified @fwnode to the phylink instance specified + * by @pl. + * + * Returns 0 on success or a negative errno. + */ +int phylink_fwnode_phy_connect(struct phylink *pl, + struct fwnode_handle *fwnode, + u32 flags) +{ + struct fwnode_handle *phy_fwnode; + struct phy_device *phy_dev; + int ret; + + if (is_of_node(fwnode)) { + /* Fixed links and 802.3z are handled without needing a PHY */ + if (pl->cfg_link_an_mode == MLO_AN_FIXED || + (pl->cfg_link_an_mode == MLO_AN_INBAND && + phy_interface_mode_is_8023z(pl->link_interface))) + return 0; + } + + phy_fwnode = fwnode_get_phy_node(fwnode); + if (IS_ERR(phy_fwnode)) { + if (pl->cfg_link_an_mode == MLO_AN_PHY) + return -ENODEV; + return 0; + } + + phy_dev = fwnode_phy_find_device(phy_fwnode); + /* We're done with the phy_node handle */ + fwnode_handle_put(phy_fwnode); + if (!phy_dev) + return -ENODEV; + + ret = phy_attach_direct(pl->netdev, phy_dev, flags, + pl->link_interface); + if (ret) { + phy_device_free(phy_dev); + return ret; + } + + ret = phylink_bringup_phy(pl, phy_dev, pl->link_config.interface); + if (ret) + phy_detach(phy_dev); + + return ret; +} +EXPORT_SYMBOL_GPL(phylink_fwnode_phy_connect); + /** * phylink_disconnect_phy() - disconnect any PHY attached to the phylink * instance. diff --git a/include/linux/phylink.h b/include/linux/phylink.h index d81a714cfbbd..75d4f99090fd 100644 --- a/include/linux/phylink.h +++ b/include/linux/phylink.h @@ -439,6 +439,9 @@ void phylink_destroy(struct phylink *); int phylink_connect_phy(struct phylink *, struct phy_device *); int phylink_of_phy_connect(struct phylink *, struct device_node *, u32 flags); +int phylink_fwnode_phy_connect(struct phylink *pl, + struct fwnode_handle *fwnode, + u32 flags); void phylink_disconnect_phy(struct phylink *); void phylink_mac_change(struct phylink *, bool up); From patchwork Fri Jan 22 15:42: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: 12039785 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=-16.9 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 2ED84C433DB for ; Fri, 22 Jan 2021 15:48:28 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CDFDD21D81 for ; Fri, 22 Jan 2021 15:48:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CDFDD21D81 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=USiLmBpg1UyoJEiayRCU5lprtLjeZIN2j5J9tJDbbeY=; b=JFwbbnvlBSssHQiHdAjsT3VDt RCTAhWapis1aGV2c1MCuiMBZEn6sLNPACMsJkMWrUDXn0w76bVCPtbN7An6q3i3K4NdRIntiX32lH uDuNB4mbYp122lp1cEjpWg2IPGXR1YDAPB4269gAB6RSyiz8it880JrwoQ+pVoXNeGl1WTljSsnvE Xy+eNyxQTvy3k6GXc9/p9Kjzx+woYX2ko7aV8Apo2sEFj9bSlbFRG8XheK5iipPImP4FjCxwmxLjU qWIce6HgJR0YXIjPFvS1/VrZs7lf/ezA+jo9R8zpzZbQhQi29+AKPR5FYM9QOiOkUwJ+eisDqHbMf 4+s7uySsw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2ye7-0006dK-Ly; Fri, 22 Jan 2021 15:46:47 +0000 Received: from mail-he1eur04on062e.outbound.protection.outlook.com ([2a01:111:f400:fe0d::62e] helo=EUR04-HE1-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2yd7-000681-8Z for linux-arm-kernel@lists.infradead.org; Fri, 22 Jan 2021 15:45:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=huw7ZQKxFg2LSfvTD7BFhXP1LEL4W5t5C1oF+li6ySqTpXH2fXA+MpYXzPZU5qkUta/9hptUZ8qkD8Lxx1dc4olwMDMWhXy3+AYU+RaTFeTpV6BJca1EpBdvBLcHQUJtQRZdLlvPMxTGnQH8ZBjvgia2fCTCrNBBtYKWU67mgXBUo7Fuqj3pxvUt/imGO+4Ib+fUiaaq6Gqzlr6iaL5N0T1JsOJh7x64O5oemFcXB0RAbpQE+CxmUz7fxhQ8bcsdwQhkf6kvdJDRZcrCQEteE7JjxjoCAhfdXLoTrgmloyk93Eoc16pVek6apRgNmuGYNb1U75BsGabteB/VQ0v1WA== 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=XIZPm8Wbzo4S6GjGjJBsBmsy6E/bcbfutSud+kaCcRI=; b=evMFKyYqrFkehgHH8kxCGYkLEq+zfR0ur7FI7+9L/ejN6ZpPXpLLTsy7uqn7Oq6md9wy01qNSPxYlgpbYowQPrQI58shsmnDVjzn7N1yP17leD4hXUwE5rYy69iFGnIOLRscgpNlhVHPZ+AC0Fm4Zj/FRoDUOiTAp0odirS2NiJzBja2Z/L2ZwkJ3e81mMfV8YGcUL78AkkD2dCaEuv98ARL61L6TMZmdwpreTAOVeGdIVSTEqDjEbaicMyKYIpIrDPohjAdNZszw52t1H6gQWHUI1EUiFbPF7Dak2kl83Y8kxtQWJDm8PbMZNvEpgXQzE2a4WZ1WQ0C+K76TNZzeQ== 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=XIZPm8Wbzo4S6GjGjJBsBmsy6E/bcbfutSud+kaCcRI=; b=Ch/ThyxkXl4Q/sFJwV8OcAmgAwQgE6GrO2KsP5GmastP76XaITdMV0ii5HbUNqxRQHuo+WtD8RHzqWGaavWGk0NsLIsx9HY7PYinGePfbkIlnObcV11624IwRFVQbRaBj3Ubm4pDvOod++AkDn4SJQc0Q702JtKCBCKo+NBEdU4= 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 AM0PR0402MB3443.eurprd04.prod.outlook.com (2603:10a6:208:1b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12; Fri, 22 Jan 2021 15:45:28 +0000 Received: from AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::e90e:b1d6:18a2:2d42]) by AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::e90e:b1d6:18a2:2d42%5]) with mapi id 15.20.3784.015; Fri, 22 Jan 2021 15:45: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 Subject: [net-next PATCH v4 14/15] net: phylink: Refactor phylink_of_phy_connect() Date: Fri, 22 Jan 2021 21:12:59 +0530 Message-Id: <20210122154300.7628-15-calvin.johnson@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210122154300.7628-1-calvin.johnson@oss.nxp.com> References: <20210122154300.7628-1-calvin.johnson@oss.nxp.com> X-Originating-IP: [14.142.151.118] X-ClientProxiedBy: SG2PR06CA0117.apcprd06.prod.outlook.com (2603:1096:1:1d::19) 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 SG2PR06CA0117.apcprd06.prod.outlook.com (2603:1096:1:1d::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12 via Frontend Transport; Fri, 22 Jan 2021 15:45:20 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 52418a10-41d8-4849-41e4-08d8beecbd8f X-MS-TrafficTypeDiagnostic: AM0PR0402MB3443: 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: XZRA5Pmk7p3GzY3hFndeMQXC4W+Jh4piEOlzU4eYvI9fCbvu0DzaawWd8hBJXNu5WSEdSngxaSJQ/1qPC8BqVwPpwq7XtnlIvoeX2ZmCYiQ5cN2LqKyVe7YENBXEWpqAEnVhffX2IXTGco4p7M2waygj4pNlCUukBbn+7ty8ZgE1/+fkxkNDZvB1v+RktkwbhbRxUQ3DnkgD0w/sh+yuZ9DDpjSBufS8k+tKBqGVzbk2qwbU8lF6ZL1sebJkf7i3B3uA0Iw5ZfTnRLgAE4vR0P1GOs5P9y4zp+aPdcr+U8salI2q8+aZjvc6y9yhr2P+fU138HmBl2cl/S+nZyu0Znl87nzpzO6HlxNU4DOZyTDJFaR1y5d3FjHnWYUXeShU7XhB6r4kJuKxo0SVjhemfxsaluT2Dfq6WsUhRGHuTWYrGjVepbXoq+wIuw4I2dOKTcuGw06UShgUR6UfHHSF5Q== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR04MB5636.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(376002)(346002)(136003)(396003)(39850400004)(366004)(2906002)(6506007)(921005)(6512007)(6666004)(186003)(5660300002)(1006002)(16526019)(52116002)(54906003)(956004)(55236004)(8676002)(66556008)(8936002)(83380400001)(66476007)(2616005)(66946007)(1076003)(478600001)(26005)(110136005)(86362001)(316002)(7416002)(4326008)(6486002)(44832011)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: AEKqyFQqFCaPC+LYH3wLekyKNAK9bgmpotbwpHKuJTr6CHsVAKcIHiQLdAkt4X139E8SlxdHGW57AXzyn+We2aJ3HgtB72unRUEtcOEiH3f4e9tuNxs4InfkFKnPbLymaKGvA/pOIPKJCP+DPeNLh+2dNUeJlWrpIMhuFcFPj4sZ9Nq9YQlifZfAK8QSqUyYoh3Nv1KMfqdoKWa4NQ2ra3WZsc2aEdQMMcqVcL5pNJ9VThgCez3cnFmABsmGXKiOQsrmsCQfgMsNvdRPvdth9Jh7/7ktBJLc3Vzp20TDYX/IqQBKEwP9zLedwuuKdk8JOGVrHIIJ26N5bxor4evLBKSGZw0MIhEXkCr55ZFWuZlQYHUX82DrT5/E91lQ/J4ayTgBQVce76JgNXv8r+hoTFAVCC0xqBjBCFaRcdVPiCTz1d2lEWlZfnqmwVRfgI6DgMq3qjaJVKFvAs4wrdmwmRNHaMRbYqyGpYf3h42dRfX4sS2HpoBGSjvznrZ+O+Amjhvgj2P2ciPr3LDNX4SO4SURVvZOivg5VsOj4uWAGjgA062S3/9OUKb7KNx04rjtfIdprfmTFcGiwzHnvTdj40A7wEHOrP5qx30wxYzBIki2kME3wG6XvmVwfx8cDpED+RkrVn5Dr0hdlLlx6xWC0OTIC4c0YpmMnFIb1ocAe/f7ldW4s5j9Dnnt54UpkUSptf4Dc1jKYotMJgPn9graUJ7S5lYJtaHaZiebndBDo2eUMFiCrW+1WZ0Cek5YQgkYWCOVWagWAS/cuI9Pdr9B/Z7pcQe03HZg3N81xUErskqRvln1nW3gEknCBH5esL/DThBz4BJ96AxYPo2M9gsDIRKnH0Mv3ntdybtvwYQysEMi29m0UrNNHeBKJiblCC9C87S90OSl3x+YOal07+RmF0KVGA7PEwTZMwhJIPRBCDh0IZgY1KkJSfbRyjCX3BgpUqG4xdL4AnmYexVmAgpE0LzMDV03KCO4KF0xI5EjsMyFOwKFm+U8ZfTkDWrEh48qCsWBub/VPmYw3xogvmoxruuJkOuEt4iwjLw07EinoWc4ACEvrWhgok4AMgvTmVdo X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 52418a10-41d8-4849-41e4-08d8beecbd8f X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5636.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2021 15:45:27.8774 (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: kCFAIV73rlT+G8sLsPpbQCXWiTu2HMobqYxmhboTkCBK6OgNpnXREoZX27rwk28KPicaG66yCWe9FIVgISIqIg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0402MB3443 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210122_104545_340006_805220EB X-CRM114-Status: GOOD ( 16.08 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Calvin Johnson , Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux.cj@gmail.com, Jakub Kicinski , Heiner Kallweit , "David S. Miller" , linux-arm-kernel@lists.infradead.org, Laurentiu Tudor Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Refactor phylink_of_phy_connect() to use phylink_fwnode_phy_connect(). Signed-off-by: Calvin Johnson --- Changes in v4: None Changes in v3: None Changes in v2: None drivers/net/phy/phylink.c | 39 +-------------------------------------- 1 file changed, 1 insertion(+), 38 deletions(-) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 5466e1e6272a..3d0dc53fd4f3 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -1080,44 +1080,7 @@ EXPORT_SYMBOL_GPL(phylink_connect_phy); int phylink_of_phy_connect(struct phylink *pl, struct device_node *dn, u32 flags) { - struct device_node *phy_node; - struct phy_device *phy_dev; - int ret; - - /* Fixed links and 802.3z are handled without needing a PHY */ - if (pl->cfg_link_an_mode == MLO_AN_FIXED || - (pl->cfg_link_an_mode == MLO_AN_INBAND && - phy_interface_mode_is_8023z(pl->link_interface))) - return 0; - - phy_node = of_parse_phandle(dn, "phy-handle", 0); - if (!phy_node) - phy_node = of_parse_phandle(dn, "phy", 0); - if (!phy_node) - phy_node = of_parse_phandle(dn, "phy-device", 0); - - if (!phy_node) { - if (pl->cfg_link_an_mode == MLO_AN_PHY) - return -ENODEV; - return 0; - } - - phy_dev = of_phy_find_device(phy_node); - /* We're done with the phy_node handle */ - of_node_put(phy_node); - if (!phy_dev) - return -ENODEV; - - ret = phy_attach_direct(pl->netdev, phy_dev, flags, - pl->link_interface); - if (ret) - return ret; - - ret = phylink_bringup_phy(pl, phy_dev, pl->link_config.interface); - if (ret) - phy_detach(phy_dev); - - return ret; + return phylink_fwnode_phy_connect(pl, of_fwnode_handle(dn), flags); } EXPORT_SYMBOL_GPL(phylink_of_phy_connect); From patchwork Fri Jan 22 15:43: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: 12039787 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=-16.9 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 8532DC433E0 for ; Fri, 22 Jan 2021 15:48:55 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 306E921D81 for ; Fri, 22 Jan 2021 15:48:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 306E921D81 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=fwUt9MfOpeEn83Pbg7L8lMXZhDqbx2IZzQxUe23woRY=; b=rlnCjGzAuMflDBOHm5PfzNKFC YEJtpkH91w5lFP1qFfsbr+QD4k2I1iXtl3qoHYBS+EpwnnLUId0XBGIULgzC0iaBZ2Y4S4hmZVOKR qmTVu1ZW0kdLW9pNGsM81+eAMCZG9kYla4a3gVFKlhuFWfEh6bFqn7yELRT5yDdlyE1Gqmhr5BaP+ JbjsWTPL7Vh9qmCUak+GcYVLVAqDgIb/oSITTNUzNQQoxYXtgAyHXVZOcOPSOgn/PNB2s5sw8g+oE LpQQa1b6uq/hC7gJvJ8kV0tQydJfy69lr/Nu3TjgbOhMZaZ/ZysoF7Be4xWzfRGMs4FA7Svphddfc qhALzFJMg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2yeU-0006r4-GX; Fri, 22 Jan 2021 15:47:10 +0000 Received: from mail-he1eur04on062e.outbound.protection.outlook.com ([2a01:111:f400:fe0d::62e] helo=EUR04-HE1-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2yd8-000681-SB for linux-arm-kernel@lists.infradead.org; Fri, 22 Jan 2021 15:45:48 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RCjcrvefY+4hBz3uVOJWyfaeSbhF6c0vXe77hqBeJRqJC6MV5OVY1qc9u6XkBfdxRtLEhjlZpUbf3g5t2sBFULmdZqUBSGi1+r/0i30Zjnppcr7vQQK1eeG+7D1o7Khg8ubhUDcNODgVsPUZ9Ez7jIwqcU2IqeGzhNXATOqafDnRKHxc8IJT+nRc8etGb/cMdaGoaie11gZAPqaS+GeCveZ9dqOnp4mHkY7jJqJT3ORY6xHBzruykvPhGV6Tj45oE/+2uFqYGCCzoycFdKNYwXyn2ryWI0cmtJoAf46ExvxBIUQco/32RD7//YJWW/tdEWcou/jfTwhXVtWSWX2w4Q== 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=nkyyugcVZXBAnF29aC5M48+TcLFQfMp0V5THskW2dLI=; b=h1SvUNerlifnUSt/mEzlidb1ngA3xQGXrXhBVNdImCV53B97nuA7ZirotZolTZjPNarO4UDOxfBf6yYtyi35DBdVnEQAjky1/oEhrB6WICO/IcC1wG53qRtwwOlidiDnmQeLlcfsQZc7vXIE4Ul+FqNwt+XaZtesUplmhftejx9JRVL/leYqxjoJzojG4hGVQ+OMy3XpaSx5hAUqOz6n8EcFsLCIywvUK5ghEVs5osj0I15jTY9j7LyIlM3tBfohWTW10si2KZArNZy0bw1ER/u0vOz1SrvLKAUmoEw8HKjJo2rWvzYN0v6simFA0T4opk/lNXhrXBpsE9w6oypgGQ== 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=nkyyugcVZXBAnF29aC5M48+TcLFQfMp0V5THskW2dLI=; b=BzGmYIh1mIvX5eKtRLs5tU29ahmiKo5tYRCzEPSKkiTYWNFE1b6NvEdRZQLCo2lDZ+ANBZWvgOz1zfI8Kx3ZF1u0ghfoFYsUIciwPCYLjkG3ud2GVP0bAI2LJ7HawxElw04lvosL5hVEHdOZiJUSrVtN7x+aa7OzBLSPuY+EPjA= 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 AM0PR0402MB3443.eurprd04.prod.outlook.com (2603:10a6:208:1b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12; Fri, 22 Jan 2021 15:45:34 +0000 Received: from AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::e90e:b1d6:18a2:2d42]) by AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::e90e:b1d6:18a2:2d42%5]) with mapi id 15.20.3784.015; Fri, 22 Jan 2021 15:45:34 +0000 From: Calvin Johnson To: Grant Likely , "Rafael J . Wysocki" , Jeremy Linton , Andrew Lunn , Andy Shevchenko , Florian Fainelli , Russell King - ARM Linux admin , Cristi Sovaiala , Florin Laurentiu Chiculita , Ioana Ciornei , Madalin Bucur , Heikki Krogerus , Marcin Wojtas , Pieter Jansen Van Vuuren , Jon , Saravana Kannan , Randy Dunlap Subject: [net-next PATCH v4 15/15] net: dpaa2-mac: Add ACPI support for DPAA2 MAC driver Date: Fri, 22 Jan 2021 21:13:00 +0530 Message-Id: <20210122154300.7628-16-calvin.johnson@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210122154300.7628-1-calvin.johnson@oss.nxp.com> References: <20210122154300.7628-1-calvin.johnson@oss.nxp.com> X-Originating-IP: [14.142.151.118] X-ClientProxiedBy: SG2PR06CA0117.apcprd06.prod.outlook.com (2603:1096:1:1d::19) 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 SG2PR06CA0117.apcprd06.prod.outlook.com (2603:1096:1:1d::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12 via Frontend Transport; Fri, 22 Jan 2021 15:45:28 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 1f71c28b-2762-49b9-7e64-08d8beecc1d1 X-MS-TrafficTypeDiagnostic: AM0PR0402MB3443: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5236; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pa5EvtOHNN5yyIyozXxlROzERWvGkHv3Qes0l4eRtU33tGtrzmRaT5btJYgqUC3K04NidCzG6jdq/KCE8Xnz61MAlPl6fHy4JZnIYNOmNYIEq91/vAaDUpmTyt4RnYNOoP6fdR+8EdKgRqz6SCDHVVePqBn88uoNezrPvuzvj5VVAq0djj8MitdPv0hGW2GhUWsRSYNuzBnApnJbsYuXzg27Q/Jk5IhpvN1gaUAKwzY7DjevJejQ7/uN8wNc0q4kB/5vWjn6d1NqDt2doyJld52xi4hw7Ijz49VG+ESlz9TzUeRLFuslzA0MlCLVg6nFRW9FvTBz2QzuOKIhEDMiqMvvYxDjs4FoNJyYQf7JODTSY18UAqVuRChZPqkzQ4xImsF9WOR/amRJiom11MZJW7SCnk3vDEdhDL9/xmwsR7rUbkGsdyZrYMYFD0taXQJzqYsOX6EF0W2cEDuME+u7xQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR04MB5636.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(376002)(346002)(39860400002)(136003)(396003)(366004)(2906002)(6506007)(921005)(6512007)(6666004)(186003)(5660300002)(1006002)(16526019)(52116002)(54906003)(956004)(55236004)(8676002)(66556008)(8936002)(83380400001)(66476007)(2616005)(66946007)(1076003)(478600001)(26005)(110136005)(86362001)(316002)(7416002)(4326008)(6486002)(44832011)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: mtR6z84gFR0/V2r8fNATkd6IszqDxg76HYhMIqvACqdPjvx48qFsXJyFwoNOGV20biliVSx7KJK2UXBqRgZSZ9NIi8YvQVSS9U6ENTWkFU8laZeRSiDnMs+GEemuocma6ZVKuWIximgR4SLzIVz+r49ZOPhaGMSpqN0XNnDhGKYXjNvZMWL0Uye+G6VGy7NFv+5j9HdXz/itOgDDJl+vBtDf7spZN41k0AP5W/uTd2tCJ+F0lu4ONex2ce5xtMBV5ChKB+lkuTqR5E+DJh+eIRuSM30f68J+ObLo3VbLIBQIyxCb0fDiE9Suf+XV5tmycbZ1ohUbExAglaYj+TIZ0JhMCDDwCrZ+xFucwMiKWYcqFl24UT4LCLO7Y5ue30MiGhmYBAGBbhhJgfTLKVsNketvqkA/Waj7I51bTS6PTj90BpmZ87aZnJoxhyjveJvXeeFxcK5CdI104rHPPd5EWW79BTz5aa84P9ydUuBjIjOK4TbsntjoYtcgcGyqFw42LFMy+Ig5iq81tcn8p5T4MyjHIqh0yF0c8VHtrnenMe/CkgJYrHsION5zwDmEwyhamOaNDCrVqJzZPhw5KJhL014fH10/5LxlS1TJlnNvdG6CsjLHC/nesP9SU5Rad0Snqh9glxc100do1IpF9lPO4VqsG3sCsiRxWfC63zyXE/INECpDTcpZ62/luoJP7mdtcvXlu8PV2d5/8WP9ul7Gl7PHqJYiau26mIPqlzQ0LsSqoRTwooj2/18guF+Zs+wFyRqFo/q30zHwY13eYqDXODUQs/u7w0iuIlAZ2wzefF3G9+iVA/bpbfespl027wg7iCDmox1pDmKvur2gJ58Nxz1WSAodFX+wWcrZ0z8uRqdxMW8R1mE4dw6fx6SZf3neLoAB2X+u6XUnlKHyvwsoVzZ3Qk/9NKf0Lxpd7j31npQ7uiKTI/XeCWmn8DVcKrQZJ4r+YtlM/ekXHIYsTd4rP027GoCzITDf1pIaInPKzkrpB1TvjKpO0muGqeE/xGu7+zKlC8pjEpsDHD2d0SFGfr4G5GD6J0ei6zvTI3Xw835WYXypWCih9stewhlfd43+ X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1f71c28b-2762-49b9-7e64-08d8beecc1d1 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5636.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2021 15:45:34.8455 (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: bigSAEZifMey8zoRTP9gEYJX8cGr/1nu8sAP1KuCkPqTqmxhV9DjsT7YHC9jKYzj2it+DNC0Q7ZbZRP/neAjUQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0402MB3443 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210122_104546_983875_A498299C X-CRM114-Status: GOOD ( 22.87 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ioana Radulescu , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Calvin Johnson , Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux.cj@gmail.com, Jakub Kicinski , "David S. Miller" , linux-arm-kernel@lists.infradead.org, Laurentiu Tudor Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Modify dpaa2_mac_connect() to support ACPI along with DT. Modify dpaa2_mac_get_node() to get the dpmac fwnode from either DT or ACPI. Replace of_get_phy_mode with fwnode_get_phy_mode to get phy-mode for a dpmac_node. Use helper function phylink_fwnode_phy_connect() to find phy_dev and connect to mac->phylink. Signed-off-by: Calvin Johnson --- Changes in v4: None Changes in v3: None Changes in v2: - Refactor OF functions to use fwnode functions .../net/ethernet/freescale/dpaa2/dpaa2-mac.c | 87 +++++++++++-------- 1 file changed, 50 insertions(+), 37 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c index 69ad869446cf..2aa320fd84ce 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,47 @@ 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 device_node *dpmacs = NULL; + struct fwnode_handle *parent, *child = NULL; int err; + u32 id; - dpmacs = of_find_node_by_name(NULL, "dpmacs"); - if (!dpmacs) - return NULL; + if (is_of_node(dev->parent->fwnode)) { + dpmacs = of_find_node_by_name(NULL, "dpmacs"); + if (!dpmacs) + return NULL; + parent = of_fwnode_handle(dpmacs); + } else if (is_acpi_node(dev->parent->fwnode)) { + parent = dev->parent->fwnode; + } - while ((dpmac = of_get_next_child(dpmacs, dpmac)) != NULL) { - err = of_property_read_u32(dpmac, "reg", &id); - if (err) + fwnode_for_each_child_node(parent, child) { + err = fwnode_get_id(child, &id); + if (err) { continue; - if (id == dpmac_id) - break; + } else if (id == dpmac_id) { + if (is_of_node(dev->parent->fwnode)) + of_node_put(dpmacs); + return child; + } } - - of_node_put(dpmacs); - - return dpmac; + if (is_of_node(dev->parent->fwnode)) + of_node_put(dpmacs); + return NULL; } -static int dpaa2_mac_get_if_mode(struct device_node *node, +static int dpaa2_mac_get_if_mode(struct fwnode_handle *dpmac_node, struct dpmac_attr attr) { phy_interface_t if_mode; int err; - err = of_get_phy_mode(node, &if_mode); - if (!err) - return if_mode; + err = fwnode_get_phy_mode(dpmac_node); + if (err > 0) + return err; err = phy_mode(attr.eth_if, &if_mode); if (!err) @@ -221,26 +232,27 @@ static const struct phylink_mac_ops dpaa2_mac_phylink_ops = { }; static int dpaa2_pcs_create(struct dpaa2_mac *mac, - struct device_node *dpmac_node, int id) + struct fwnode_handle *dpmac_node, + int id) { struct mdio_device *mdiodev; - struct device_node *node; + struct fwnode_handle *node; - node = of_parse_phandle(dpmac_node, "pcs-handle", 0); - if (!node) { + node = fwnode_find_reference(dpmac_node, "pcs-handle", 0); + if (IS_ERR(node)) { /* do not error out on old DTS files */ netdev_warn(mac->net_dev, "pcs-handle node not found\n"); return 0; } - if (!of_device_is_available(node)) { + if (!of_device_is_available(to_of_node(node))) { netdev_err(mac->net_dev, "pcs-handle node not available\n"); - of_node_put(node); + of_node_put(to_of_node(node)); return -ENODEV; } - mdiodev = of_mdio_find_device(node); - of_node_put(node); + mdiodev = fwnode_mdio_find_device(node); + fwnode_handle_put(node); if (!mdiodev) return -EPROBE_DEFER; @@ -269,13 +281,12 @@ static void dpaa2_pcs_destroy(struct dpaa2_mac *mac) int dpaa2_mac_connect(struct dpaa2_mac *mac) { struct net_device *net_dev = mac->net_dev; - struct device_node *dpmac_node; + struct fwnode_handle *dpmac_node = NULL; struct phylink *phylink; int err; mac->if_link_type = mac->attr.link_type; - - dpmac_node = dpaa2_mac_get_node(mac->attr.id); + dpmac_node = dpaa2_mac_get_node(&mac->mc_dev->dev, mac->attr.id); if (!dpmac_node) { netdev_err(net_dev, "No dpmac@%d node found.\n", mac->attr.id); return -ENODEV; @@ -292,7 +303,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)) { @@ -312,7 +323,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); @@ -323,13 +334,14 @@ int dpaa2_mac_connect(struct dpaa2_mac *mac) if (mac->pcs) phylink_set_pcs(mac->phylink, &mac->pcs->pcs); - err = phylink_of_phy_connect(mac->phylink, dpmac_node, 0); + err = phylink_fwnode_phy_connect(mac->phylink, dpmac_node, 0); if (err) { - netdev_err(net_dev, "phylink_of_phy_connect() = %d\n", err); + netdev_err(net_dev, "phylink_fwnode_phy_connect() = %d\n", err); goto err_phylink_destroy; } - of_node_put(dpmac_node); + if (is_of_node(dpmac_node)) + fwnode_handle_put(dpmac_node); return 0; @@ -338,7 +350,8 @@ int dpaa2_mac_connect(struct dpaa2_mac *mac) err_pcs_destroy: dpaa2_pcs_destroy(mac); err_put_node: - of_node_put(dpmac_node); + if (is_of_node(dpmac_node)) + fwnode_handle_put(dpmac_node); return err; }