Received: by 2002:a05:6a10:87d6:0:0:0:0 with SMTP id g22csp761861pxr; Mon, 11 Apr 2022 06:39:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPY9mxxN7SkGWT5rV736isUoV31asQvZPIGJkrpgFgnbK11XrcKx4+FGgh5LRQZg/rCdq7 X-Received: by 2002:a17:902:bf4a:b0:151:7d37:2943 with SMTP id u10-20020a170902bf4a00b001517d372943mr32104866pls.131.1649684367556; Mon, 11 Apr 2022 06:39:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649684367; cv=none; d=google.com; s=arc-20160816; b=n0ST7lnY/qKZGODmH2wy93+hrncdHFNtxK9emykBDRoPekuOhYgAZ1wZKSCq+zz6hW XvKvL22zYWYGRwYKb24QoM5ttPohVyGyLByWmnnA2PLmbqSXuC/9F0SmtB9e6yqWlGSt ZB0xaavxwVbC3beabifChVhEca4rgh692s2SIXIU1O6EJQCZhtuDUPHyggIkq0aZDQUx rLgFtzRvZJl/y1JI7UfRefL2NEMBzo3cCjm+Uh2kx9i+t/QFS5DW5IxvcVLzcHjaqn1A QxmR4lCSTKZ49TR4NZIXPfwv2tcu69P56yk1FYjdrBhvPzJWgePis1xIuvdTOR8Q65ma iYDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id; bh=vClO+EOhkTDg/syPPAaX8+OMGEeRkDY9942ZXzkV+RQ=; b=zGSRIjnD+iIahOpAFfrY4MOe7XKxfq/0WdUz/QK6zaOS9vfVE9c5h9PfENhe2M8Lat tniMlEhh6uKrwuEPAezmZWG08U1odmrUM5AsEQzYlbzH5FuOuEvFoJ/ZKLwILEEQm46r O3g3tZ7iMeFSNJXjtIwaxO7ICuUgJK2EfttdHEcoePfH9OE0D7jgABUsKE3oO6bywDp5 7icksXAuT4FdPlukWvMuUwx971dlpDEn7smjOMS8wOLcblJpyZVu+336MhlRdVVicCGh N/HhhCy2yXfsHhc9834z6o5GkCRY7WLT+Rx3b+kfsl+DvuzexgMcN24RfIM3cib+R/ya htbg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w9-20020a056a0014c900b004fa3a8dff56si9901544pfu.13.2022.04.11.06.39.11; Mon, 11 Apr 2022 06:39:27 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244724AbiDKJWY convert rfc822-to-8bit (ORCPT + 99 others); Mon, 11 Apr 2022 05:22:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235213AbiDKJWT (ORCPT ); Mon, 11 Apr 2022 05:22:19 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74D36326EA for ; Mon, 11 Apr 2022 02:20:06 -0700 (PDT) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ndqD4-0003hy-BW; Mon, 11 Apr 2022 11:19:46 +0200 Received: from [2a0a:edc0:0:900:1d::4e] (helo=lupine) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1ndqCz-002MLK-V5; Mon, 11 Apr 2022 11:19:40 +0200 Received: from pza by lupine with local (Exim 4.94.2) (envelope-from ) id 1ndqCx-00040Q-Qs; Mon, 11 Apr 2022 11:19:39 +0200 Message-ID: <8470f6029703a29bd7c384f489da0c7936c44cc7.camel@pengutronix.de> Subject: Re: [PATCH RESEND v3 2/3] net: mdio: add reset control for Aspeed MDIO From: Philipp Zabel To: Andrew Jeffery , Dylan Hung , Rob Herring , Joel Stanley , Andrew Lunn , Heiner Kallweit , Russell King , David Miller , Jakub Kicinski , pabeni@redhat.com, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org, netdev Cc: BMC-SW@aspeedtech.com Date: Mon, 11 Apr 2022 11:19:39 +0200 In-Reply-To: <667280e7-526d-4002-9dff-389f6b35ac2f@www.fastmail.com> References: <20220407075734.19644-1-dylan_hung@aspeedtech.com> <20220407075734.19644-3-dylan_hung@aspeedtech.com> <667280e7-526d-4002-9dff-389f6b35ac2f@www.fastmail.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT User-Agent: Evolution 3.38.3-1 MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 Mo, 2022-04-11 at 09:50 +0930, Andrew Jeffery wrote: > > On Thu, 7 Apr 2022, at 17:27, Dylan Hung wrote: > > Add reset assertion/deassertion for Aspeed MDIO. There are 4 MDIO > > controllers embedded in Aspeed AST2600 SOC and share one reset control > > register SCU50[3]. To work with old DT blobs which don't have the reset > > property, devm_reset_control_get_optional_shared is used in this change. > > > > Signed-off-by: Dylan Hung > > Reviewed-by: Philipp Zabel > > --- > >  drivers/net/mdio/mdio-aspeed.c | 15 ++++++++++++++- > >  1 file changed, 14 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/net/mdio/mdio-aspeed.c b/drivers/net/mdio/mdio-aspeed.c > > index e2273588c75b..1afb58ccc524 100644 > > --- a/drivers/net/mdio/mdio-aspeed.c > > +++ b/drivers/net/mdio/mdio-aspeed.c > > @@ -3,6 +3,7 @@ > > > >  #include > >  #include > > +#include > >  #include > >  #include > >  #include > > @@ -37,6 +38,7 @@ > > > >  struct aspeed_mdio { > >   void __iomem *base; > > + struct reset_control *reset; > >  }; > > > >  static int aspeed_mdio_read(struct mii_bus *bus, int addr, int regnum) > > @@ -120,6 +122,12 @@ static int aspeed_mdio_probe(struct platform_device *pdev) > >   if (IS_ERR(ctx->base)) > >   return PTR_ERR(ctx->base); > > > > + ctx->reset = devm_reset_control_get_optional_shared(&pdev->dev, NULL); > > + if (IS_ERR(ctx->reset)) > > + return PTR_ERR(ctx->reset); > > + > > + reset_control_deassert(ctx->reset); > > + > >   bus->name = DRV_NAME; > >   snprintf(bus->id, MII_BUS_ID_SIZE, "%s%d", pdev->name, pdev->id); > >   bus->parent = &pdev->dev; > > @@ -129,6 +137,7 @@ static int aspeed_mdio_probe(struct platform_device *pdev) > >   rc = of_mdiobus_register(bus, pdev->dev.of_node); > >   if (rc) { > >   dev_err(&pdev->dev, "Cannot register MDIO bus!\n"); > > + reset_control_assert(ctx->reset); > >   return rc; > >   } > > > > @@ -139,7 +148,11 @@ static int aspeed_mdio_probe(struct platform_device *pdev) > > > >  static int aspeed_mdio_remove(struct platform_device *pdev) > >  { > > - mdiobus_unregister(platform_get_drvdata(pdev)); > > + struct mii_bus *bus = (struct mii_bus *)platform_get_drvdata(pdev); > > + struct aspeed_mdio *ctx = bus->priv; > > + > > + reset_control_assert(ctx->reset); > > Isn't this unnecessary because you've used the devm_ variant to acquire > the reset? No, this is correct. deassert/assert needs to be balanced, and the reset_control_deassert() call in aspeed_mdio_probe() is not devres managed. regards Philipp