Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp317053imn; Wed, 3 Aug 2022 05:11:47 -0700 (PDT) X-Google-Smtp-Source: AA6agR4bZQUZprT6tPrJhgxotrLiwpfgicM6aX+LJnZbhD1XqOZhWSdQr1YnwVKnalQN+qWTTXfg X-Received: by 2002:a05:6402:5190:b0:43d:da02:566a with SMTP id q16-20020a056402519000b0043dda02566amr10428116edd.187.1659528707005; Wed, 03 Aug 2022 05:11:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659528706; cv=none; d=google.com; s=arc-20160816; b=BGo6BUAN/FhZYCs1z4Ubtw1AB8azhGggahrgTzdMxVqBvKD4ljNNJvpb9t+n4WYPRL THQn6q2mZdLe+dB2MIok7cXHPWiXKKX80jDj07Wk29+QWSr4VLNzq4U02XBi9gUrKDkW jwrzIJnO5NlplmkjKvyBvJGNrymW6MdhaQhMSrz2m+BQ3awM7FH52EgXKk/m1mpFMnqH FUrfrJDdHCZIMuAGmGyuAaOhTkPfaC0OJ97M+dUBT5yzQ3TQEj963i2BlWeXOO99pjqo n1PdjDYsbfxDBx5KiYngLoYuIMPgVwZrqMgiv+JlB/48sWKcQX6exjp1WNtNgy+uaiZa zPRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=ffgpxlJKI4KloBx4T0gCdNQddFQjpgif6BFX6azbkS4=; b=k7ezZSxHUxiY1T55XLdtpQfM6TeBDrmt1DWL6iG9qZQeoe90svaHVESdvykHbIayea q+VhtHowvNfBSZZfjqdchXkJlM+9t0KVx1n7zF5S8TUXQodB/aPMXlWuieWOL2+TQAYD DoWFbaS1kPNQDCsu/ndCMPG2F6xroCGDZDX0wT8Dt93NEXls7oNu3v6satmNteeUhg0o mg8RxFw8HqWdxcl43+UUkDNni3O6mA7Bbz38iGKYSMkK0Y0ZXc8Z+Z8zNVgjWAKgIAjU f757UYUeCk+NlRkq3NDS5duFsfNDuZ5YfXZ4hulcQTp5y1OQr8eSh9OTtcQAtryI8BvV k7Zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=X+Ec2mVm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hg5-20020a1709072cc500b00730947a0198si6708062ejc.357.2022.08.03.05.11.19; Wed, 03 Aug 2022 05:11:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=X+Ec2mVm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S237063AbiHCLcR (ORCPT + 99 others); Wed, 3 Aug 2022 07:32:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236312AbiHCLcP (ORCPT ); Wed, 3 Aug 2022 07:32:15 -0400 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 034B833E1F; Wed, 3 Aug 2022 04:32:14 -0700 (PDT) Received: by mail-ej1-x62f.google.com with SMTP id gb36so5352757ejc.10; Wed, 03 Aug 2022 04:32:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=ffgpxlJKI4KloBx4T0gCdNQddFQjpgif6BFX6azbkS4=; b=X+Ec2mVmfXxkLlVWHzSL4F2cf5p74isrOXQZzhTrwQhnAFI+u5Ok/4I1guInVFdFVV Pons1SmeZoPEGSyJtgqcSoXYvzVtZj1YpPa1LTcTH3x17gJfUoae1TmPq4n6nkX8tdWW KpZhifswDDNRkhsxz22h5VsUdT2ryRC2wOyOd8GiWbSVEcDI0lGBSVC6rx5Py/nye0DP PvlcwoCbXF0RzkLHW3Furxt9y+fdl0JscnJEwU7oAIuxboCQyWK4Q/qIesjtbUF7npSZ b7bI4GgD6O79lALs9SdlDCrbHNC46vw4VascZJ26jynnBEZ1NQqEe70LiYcl1nNb/aA+ EeMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=ffgpxlJKI4KloBx4T0gCdNQddFQjpgif6BFX6azbkS4=; b=6DrUQ7TLOS0GapLEnVJXyCSgSZXHsyAoIxL63sO/jN6N8DMsb0I0iSdAGscg8rASZa 2k3F8Of1lIAUuezKzWbD3JvUzwwPLRJYJaH8qHItQat6OC8MPW0CG3zeaG9ldCEUTf7X XCSU1QRZcQ1O+Oe+F0Q4OY3dXM00HNZx7jAFpMynhQp0+qg2hnI5VXpotEespaCjojQU 6f92baOqi7F4v5U+LMlgAJ+1fEU6eLab2f4+h27vMNXRHemCrP2tbgVl1RDSfymDhaIq cSj+EsRjkFJJtf79LektONxM/Ne3rR1B+so9Ir/zpRj9luS4aQyvz8EXKo4xADZY1h8A 0Pew== X-Gm-Message-State: AJIora9S8HyYQDoB74h/uxix/Px9DB5pcdj2sDZBagJs8Swn+cQIidON q2U/czcdbBIo5ICgDbYIEiELsEs3MTvoad31Mo0= X-Received: by 2002:a17:906:7950:b0:72f:d4a4:564d with SMTP id l16-20020a170906795000b0072fd4a4564dmr19722433ejo.479.1659526332466; Wed, 03 Aug 2022 04:32:12 -0700 (PDT) MIME-Version: 1.0 References: <20220803054728.1541104-1-colin.foster@in-advantage.com> <20220803054728.1541104-3-colin.foster@in-advantage.com> In-Reply-To: <20220803054728.1541104-3-colin.foster@in-advantage.com> From: Andy Shevchenko Date: Wed, 3 Aug 2022 13:31:35 +0200 Message-ID: Subject: Re: [PATCH v15 mfd 2/9] net: mdio: mscc-miim: add ability to be used in a non-mmio configuration To: Colin Foster Cc: linux-arm Mailing List , "open list:GPIO SUBSYSTEM" , netdev , Linux Kernel Mailing List , devicetree , Terry Bowman , Vladimir Oltean , Wolfram Sang , Microchip Linux Driver Support , Steen Hegelund , Lars Povlsen , Linus Walleij , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Russell King , Heiner Kallweit , Andrew Lunn , Krzysztof Kozlowski , Rob Herring , Lee Jones , katie.morris@in-advantage.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 3, 2022 at 7:47 AM Colin Foster wrote: > > There are a few Ocelot chips that contain the logic for this bus, but are > controlled externally. Specifically the VSC7511, 7512, 7513, and 7514. In > the externally controlled configurations these registers are not > memory-mapped. > > Add support for these non-memory-mapped configurations. FWIW, Reviewed-by: Andy Shevchenko > Signed-off-by: Colin Foster > Reviewed-by: Vladimir Oltean > Acked-by: Jakub Kicinski > --- > > (No changes since v14) > > v14 > * Add Reviewed and Acked tags > > --- > drivers/net/mdio/mdio-mscc-miim.c | 42 +++++++++---------------------- > 1 file changed, 12 insertions(+), 30 deletions(-) > > diff --git a/drivers/net/mdio/mdio-mscc-miim.c b/drivers/net/mdio/mdio-mscc-miim.c > index 08541007b18a..51f68daac152 100644 > --- a/drivers/net/mdio/mdio-mscc-miim.c > +++ b/drivers/net/mdio/mdio-mscc-miim.c > @@ -12,6 +12,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -270,44 +271,25 @@ static int mscc_miim_clk_set(struct mii_bus *bus) > > static int mscc_miim_probe(struct platform_device *pdev) > { > - struct regmap *mii_regmap, *phy_regmap = NULL; > struct device_node *np = pdev->dev.of_node; > + struct regmap *mii_regmap, *phy_regmap; > struct device *dev = &pdev->dev; > - void __iomem *regs, *phy_regs; > struct mscc_miim_dev *miim; > - struct resource *res; > struct mii_bus *bus; > int ret; > > - regs = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); > - if (IS_ERR(regs)) { > - dev_err(dev, "Unable to map MIIM registers\n"); > - return PTR_ERR(regs); > - } > - > - mii_regmap = devm_regmap_init_mmio(dev, regs, &mscc_miim_regmap_config); > - > - if (IS_ERR(mii_regmap)) { > - dev_err(dev, "Unable to create MIIM regmap\n"); > - return PTR_ERR(mii_regmap); > - } > + mii_regmap = ocelot_regmap_from_resource(pdev, 0, > + &mscc_miim_regmap_config); > + if (IS_ERR(mii_regmap)) > + return dev_err_probe(dev, PTR_ERR(mii_regmap), > + "Unable to create MIIM regmap\n"); > > /* This resource is optional */ > - res = platform_get_resource(pdev, IORESOURCE_MEM, 1); > - if (res) { > - phy_regs = devm_ioremap_resource(dev, res); > - if (IS_ERR(phy_regs)) { > - dev_err(dev, "Unable to map internal phy registers\n"); > - return PTR_ERR(phy_regs); > - } > - > - phy_regmap = devm_regmap_init_mmio(dev, phy_regs, > - &mscc_miim_phy_regmap_config); > - if (IS_ERR(phy_regmap)) { > - dev_err(dev, "Unable to create phy register regmap\n"); > - return PTR_ERR(phy_regmap); > - } > - } > + phy_regmap = ocelot_regmap_from_resource_optional(pdev, 1, > + &mscc_miim_phy_regmap_config); > + if (IS_ERR(phy_regmap)) > + return dev_err_probe(dev, PTR_ERR(phy_regmap), > + "Unable to create phy register regmap\n"); > > ret = mscc_miim_setup(dev, &bus, "mscc_miim", mii_regmap, 0); > if (ret < 0) { > -- > 2.25.1 > -- With Best Regards, Andy Shevchenko