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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 573CCC433F5 for ; Wed, 8 Dec 2021 01:00:36 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C34AF80FD5; Wed, 8 Dec 2021 02:00:33 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 1B87280820; Wed, 8 Dec 2021 02:00:31 +0100 (CET) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id F0FD680820 for ; Wed, 8 Dec 2021 02:00:26 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=andre.przywara@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1AE1A101E; Tue, 7 Dec 2021 17:00:26 -0800 (PST) Received: from slackpad.fritz.box (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 208CD3F73B; Tue, 7 Dec 2021 17:00:25 -0800 (PST) Date: Wed, 8 Dec 2021 00:58:35 +0000 From: Andre Przywara To: Jagan Teki Cc: Manuel Dipolt , u-boot@lists.denx.de, Jernej =?UTF-8?B?xaBrcmFiZWM=?= , Samuel Holland Subject: Re: [PATCH v3] sunxi: h3: enable clock support for r_pio gpios Message-ID: <20211208005835.6a7104bb@slackpad.fritz.box> In-Reply-To: References: <20211028095640.12070-1-manuel.dipolt@robart.cc> Organization: Arm Ltd. X-Mailer: Claws Mail 3.17.1 (GTK+ 2.24.31; x86_64-slackware-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.38 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean On Tue, 7 Dec 2021 12:01:56 +0530 Jagan Teki wrote: Hi, > On Thu, Oct 28, 2021 at 3:27 PM Manuel Dipolt > wrote: > > > > This patch enables clock for the r_pio gpios for the h3 > > r_pio is required to access gpios from port L > > > > readout or setting of gpio PL10 (for example to control a led): > > > > => gpio input PL10 > > gpio: pin PL10 (gpio 298) value is 0 > > => gpio set PL10 > > gpio: pin PL10 (gpio 298) value is 1 > > > > before: > > > > => gpio input PL10 > > gpio: pin PL10 (gpio 298) value is 0 > > => gpio set PL10 > > gpio: pin PL10 (gpio 298) value is 1 > > Warning: value of pin is still 0 So indeed, the patch is fixing this issue. I think on the other SoCs (A64, for instance) we enable the R_PIO clock already, probably in sun8i_rsb.c, that's why not many people noticed. But when applying this, I get multiple: sunxi_set_gate: (CLK#54) unhandled messages, plus one: sunxi_set_gate: (CLK#9) unhandled The first one is easy to fix (just adding the CLK_BUS_PIO gate description to the H3 clock driver), but the latter one is more tricky: This is the pll-periph clock from the r_ccu node, because the clock driver just enables *all parent* clocks. Providing some dummy "enable" handler for the PLL6 sounds at least dodgy. I wonder if we actually need to enable *any* of the parent clocks: certainly "hosc" does not need to be enabled, the RTC clocks have a dummy enable, and the PLL_PERIPH is already enabled via the platform setup, so we wouldn't miss out in our simple clock driver. So what are people's opinion on this: Shall we drop the parent clock enable call in the clock drivers altogether, or provide the enable/disable bits for PLL_PERIPH? > > > > > > Signed-off-by: Manuel Dipolt > > --- > > drivers/gpio/sunxi_gpio.c | 8 ++++++++ > > 1 file changed, 8 insertions(+) > > > > diff --git a/drivers/gpio/sunxi_gpio.c b/drivers/gpio/sunxi_gpio.c > > index cdbc40d48f..0185eda70d 100644 > > --- a/drivers/gpio/sunxi_gpio.c > > +++ b/drivers/gpio/sunxi_gpio.c > > @@ -14,6 +14,7 @@ > > #include > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -245,6 +246,13 @@ static int gpio_sunxi_probe(struct udevice > > *dev) { > > struct sunxi_gpio_plat *plat = dev_get_plat(dev); > > struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); > > + struct clk gate_clk; > > + int ret; > > + > > + ret = clk_get_by_name(dev, "apb", &gate_clk); > > + > > + if (!ret) > > + clk_enable(&gate_clk); > > I'm wondering any of the sunxi driver or coding using this apb clock > via CLK framework, if yes would you pointed it out. Not sure what you are after here, exactly, but this "apb" clock is CLK_BUS_PIO and CLK_APB0_PIO (for PIO and R_PIO, respectively). We already describe the latter in the U-Boot clock driver, but nor the former (see above). Not enabling the PRCM PIO clock prevents the PortL GPIO controller from working, hence the error message Manuel posted above. Cheers, Andre