Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp473191pxj; Fri, 11 Jun 2021 04:00:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx7VfD5fqMvrBq+w4L+wanEhwBPx+ePpUJ4PBk22m8YD4NRZtG9FzxJt/+OQuf8GxJ9xjj0 X-Received: by 2002:a05:6402:695:: with SMTP id f21mr2976217edy.96.1623409221612; Fri, 11 Jun 2021 04:00:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623409221; cv=none; d=google.com; s=arc-20160816; b=k1/K2N1cgBQH5uZikjq1PMj0MuTe2e30UK1ZGNfsJHfgHYnmVZp/qYn0sCO8Moto3R ToP6zBRfKjwqawM4RiVpknwGqqyi7gOmuRg6Cebg45UZbQH4ep7pMZANbEo6noBDQsmI Sm4b0OjvGbQshsxby6zSF+XIgTtBGB0g7EsHQxRrQwDOgC0I2KsWUOE9DCqvBg09/U09 VroOKbvZ0JvckVuWXN3/sm1mDGzaOq5cyBNL/5hbhpt3jP57FsP/cAusTuf0k7QdDKSQ gf7s1QNXQwpSikBAahP0yR0YMlj48DCTuQNO7nmDlzi5nT/NfcileoeQwHAPYOFNSocI 9xiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=YWiLBG3Lvh9inW6ZMOKYeM9OtMNgaNp+PKI7f1CZHVA=; b=rdOhWr7WawVEKktxnHQAmxjCjxoc+/34Roi1wDSOM5jbmznmn8W3Za7uZiojdRt0iV 45VJDTl3mpBj6iUF80+YFqVZp3oV+b/WvPsH3pM3vAh3H/1XB62Ne5Rk7K4mPa+uNBCo PFDZ1jOj0A2graaOEVVUp7/BO2tSOQlYgWu4RqbH0kfyjVUA4fDmwO0coBOEDUWXuDG+ 3E/z0aPgWT8ZlCbdIcXqtlwqvYoB1NEGymZA1TpOuQelPJByCB4xlI+nz4ifOpP7Rpo6 1DopkXSIzn6kZrnx3PDeSKfh1ncuW9GGIM4ukUDG4rY9XWwKNOyoAAQ2OeLsvkLiDPZX Mmwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=DeStVRl3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m25si4468511edr.588.2021.06.11.03.59.58; Fri, 11 Jun 2021 04:00:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=DeStVRl3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231944AbhFKK7Y (ORCPT + 99 others); Fri, 11 Jun 2021 06:59:24 -0400 Received: from mail-ed1-f48.google.com ([209.85.208.48]:43781 "EHLO mail-ed1-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231853AbhFKK62 (ORCPT ); Fri, 11 Jun 2021 06:58:28 -0400 Received: by mail-ed1-f48.google.com with SMTP id s6so36576171edu.10; Fri, 11 Jun 2021 03:56:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YWiLBG3Lvh9inW6ZMOKYeM9OtMNgaNp+PKI7f1CZHVA=; b=DeStVRl3SimU3xbI02C7tHUE3WZXORGnt6MX73Lomy0EVxmPD/d+l6RWX1ApdtVRr4 JULcJdh/dNrh1WCWLVKeq8zkUVJrMXxZmHmlRs5ETp59HQIF7uy0eHgXuNonoD0dyLNF UC5rRDha1Lx9tks1oaOpY02ZGReY19rUeIIGweZEEq3RdWrZ8f2hfKH/8fuJfIDT+Ln2 IopQtZWQqEhwJhlOGrl1qvnzrBFoVFzjKVAC6vSmLWtl4WtVboRD2x3wTOkJ7AdWPGKM 8VPWdbfSB1wCR2/Dv/eWuVGMP6Kp95DemTPKcoNjmJ/7KHHWqz6aLQc5zogmpNFFnhCE KwkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YWiLBG3Lvh9inW6ZMOKYeM9OtMNgaNp+PKI7f1CZHVA=; b=RG1BaT0qadmUEkrdj7KkSXcTS4mAShGiLC2tTXvHaAlL19uE4U4re6/SUVlY78VK6h JQ/A+qOeEphPX1paxMd3q12pdq2um5+OiszVJKqT3Iqm5saJSrXOGz+Xrk5NxmNjMEPk /T29ta4j92px1uG9vo1Js16oLhQh3mxW2F+qZGBo+Syy4ulFOSGY27Sol3Kafy5+iSdi npA5zLnMBtN2/sWBs4aGmYZf+ObU8LT9yeaHD25NqUWz4d1sKUU0X+SdgVnJO7o97w/L y77D19LtESX6KJ+/Ya5MkWsxTVC2hjzzAZT6AQIcIjth5k40VKeQqXmmiemZp8t9bL5M a+oA== X-Gm-Message-State: AOAM531rAQtHUHTA1L5dzYznEhoGkmHhZB28lPvZJuFl4dnnZXBINF7d fRdxdAO/a9Pw8YHXOhfSvBk= X-Received: by 2002:a05:6402:1a:: with SMTP id d26mr3068419edu.105.1623408918928; Fri, 11 Jun 2021 03:55:18 -0700 (PDT) Received: from yoga-910.localhost ([188.26.52.84]) by smtp.gmail.com with ESMTPSA id r19sm2492051eds.75.2021.06.11.03.55.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Jun 2021 03:55:18 -0700 (PDT) From: Ioana Ciornei To: davem@davemloft.net, kuba@kernel.org, hkallweit1@gmail.com, netdev@vger.kernel.org, Grant Likely , "Rafael J . Wysocki" , Jeremy Linton , Andrew Lunn , Andy Shevchenko , Florian Fainelli , Russell King - ARM Linux admin , Heikki Krogerus , Marcin Wojtas , Pieter Jansen Van Vuuren , Jon , Saravana Kannan , Randy Dunlap , calvin.johnson@oss.nxp.com Cc: Cristi Sovaiala , Florin Laurentiu Chiculita , Madalin Bucur , linux-arm-kernel@lists.infradead.org, Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux.cj@gmail.com, Laurentiu Tudor , Len Brown , "Rafael J . Wysocki" , Ioana Ciornei Subject: [PATCH net-next v9 12/15] net/fsl: Use [acpi|of]_mdiobus_register Date: Fri, 11 Jun 2021 13:53:58 +0300 Message-Id: <20210611105401.270673-13-ciorneiioana@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210611105401.270673-1-ciorneiioana@gmail.com> References: <20210611105401.270673-1-ciorneiioana@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Calvin Johnson Depending on the device node type, call the specific OF or ACPI mdiobus_register function. Note: For both ACPI and DT cases, endianness of MDIO controllers need to be specified using the "little-endian" property. Signed-off-by: Calvin Johnson Signed-off-by: Ioana Ciornei Acked-by: Grant Likely --- Changes in v9: none Changes in v8: - Directly call the OF or ACPI variants of registering the MDIO bus. This is needed because the fwnode_mdio.c module should only implement features which can be achieved without going back to the OF/ACPI variants. Without this restrictions we directly end up in a dependency cycle: of_mdio -> fwnode_mdio -> of_mdio. - Changed the commit title since the fwnode_mdiobus_register() is no longer available Changes in v7: - Include fwnode_mdio.h - Alphabetically sort header inclusions Changes in v6: None Changes in v5: None Changes in v4: - Cleanup xgmac_mdio_probe() Changes in v3: - Avoid unnecessary line removal - Remove unused inclusion of acpi.h Changes in v2: None drivers/net/ethernet/freescale/xgmac_mdio.c | 30 ++++++++++++++------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/freescale/xgmac_mdio.c b/drivers/net/ethernet/freescale/xgmac_mdio.c index bfa2826c5545..0b68852379da 100644 --- a/drivers/net/ethernet/freescale/xgmac_mdio.c +++ b/drivers/net/ethernet/freescale/xgmac_mdio.c @@ -2,6 +2,7 @@ * QorIQ 10G MDIO Controller * * Copyright 2012 Freescale Semiconductor, Inc. + * Copyright 2021 NXP * * Authors: Andy Fleming * Timur Tabi @@ -11,15 +12,17 @@ * kind, whether express or implied. */ -#include -#include +#include +#include #include -#include -#include +#include #include +#include #include -#include #include +#include +#include +#include /* Number of microseconds to wait for a register to respond */ #define TIMEOUT 1000 @@ -243,10 +246,10 @@ 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 fwnode_handle *fwnode; 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 +282,22 @@ 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); + fwnode = pdev->dev.fwnode; + if (is_of_node(fwnode)) + ret = of_mdiobus_register(bus, to_of_node(fwnode)); + else if (is_acpi_node(fwnode)) + ret = acpi_mdiobus_register(bus, fwnode); + else + ret = -EINVAL; if (ret) { dev_err(&pdev->dev, "cannot register MDIO bus\n"); goto err_registration; -- 2.31.1