From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8D09C433F5 for ; Mon, 18 Oct 2021 10:37:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C23E4610A6 for ; Mon, 18 Oct 2021 10:37:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230013AbhJRKjo convert rfc822-to-8bit (ORCPT ); Mon, 18 Oct 2021 06:39:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229473AbhJRKjn (ORCPT ); Mon, 18 Oct 2021 06:39:43 -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 80960C06161C for ; Mon, 18 Oct 2021 03:37:32 -0700 (PDT) Received: from lupine.hi.pengutronix.de ([2001:67c:670:100:3ad5:47ff:feaf:1a17] helo=lupine) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mcQ1B-0002BW-0I; Mon, 18 Oct 2021 12:37:21 +0200 Received: from pza by lupine with local (Exim 4.92) (envelope-from ) id 1mcQ19-0005y0-Mz; Mon, 18 Oct 2021 12:37:19 +0200 Message-ID: <6f46c5ab7458e1368abfeb8dee6e24271f39d236.camel@pengutronix.de> Subject: Re: [PATCH v6 2/2] pinctrl: microchip sgpio: use reset driver From: Philipp Zabel To: Horatiu Vultur , linus.walleij@linaro.org, robh+dt@kernel.org, lars.povlsen@microchip.com, Steen.Hegelund@microchip.com, UNGLinuxDriver@microchip.com, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Date: Mon, 18 Oct 2021 12:37:19 +0200 In-Reply-To: <20211018085754.1066056-3-horatiu.vultur@microchip.com> References: <20211018085754.1066056-1-horatiu.vultur@microchip.com> <20211018085754.1066056-3-horatiu.vultur@microchip.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT User-Agent: Evolution 3.30.5-1.1 MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2001:67c:670:100:3ad5:47ff:feaf:1a17 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: devicetree@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Hi Horatiu, On Mon, 2021-10-18 at 10:57 +0200, Horatiu Vultur wrote: > On lan966x platform when the switch gets reseted then also the sgpio > gets reseted. The fix for this is to extend also the sgpio driver to > call the reset driver which will be reseted only once by the first > driver that is probed. > > Signed-off-by: Horatiu Vultur > --- > drivers/pinctrl/pinctrl-microchip-sgpio.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/drivers/pinctrl/pinctrl-microchip-sgpio.c b/drivers/pinctrl/pinctrl-microchip-sgpio.c > index 072bccdea2a5..78765faa245a 100644 > --- a/drivers/pinctrl/pinctrl-microchip-sgpio.c > +++ b/drivers/pinctrl/pinctrl-microchip-sgpio.c > @@ -17,6 +17,7 @@ > #include > #include > #include > +#include > > #include "core.h" > #include "pinconf.h" > @@ -803,6 +804,7 @@ static int microchip_sgpio_probe(struct platform_device *pdev) > int div_clock = 0, ret, port, i, nbanks; > struct device *dev = &pdev->dev; > struct fwnode_handle *fwnode; > + struct reset_control *reset; > struct sgpio_priv *priv; > struct clk *clk; > u32 val; > @@ -813,6 +815,11 @@ static int microchip_sgpio_probe(struct platform_device *pdev) > > priv->dev = dev; > > + reset = devm_reset_control_get_optional_shared(&pdev->dev, "switch"); This is the first GPIO driver that I am aware of that requests a named reset control, so I'm still not sure if this should be called "switch" instead of "gpio" or just "reset", just in case there is a future model where the GPIO controller reset is not shared with the switch reset. > + if (IS_ERR(reset)) > + return dev_err_probe(dev, PTR_ERR(reset), "Failed to get reset\n"); > + reset_control_reset(reset); > + > clk = devm_clk_get(dev, NULL); > if (IS_ERR(clk)) > return dev_err_probe(dev, PTR_ERR(clk), "Failed to get clock\n"); But whichever name you choose, the code is Reviewed-by: Philipp Zabel regards Philipp