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 57453C433F5 for ; Thu, 14 Oct 2021 00:12:14 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 7502D60BD3 for ; Thu, 14 Oct 2021 00:12:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 7502D60BD3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3BF9583619; Thu, 14 Oct 2021 02:12:10 +0200 (CEST) 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 BA0BA83619; Thu, 14 Oct 2021 02:12:07 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id 24D368360A for ; Thu, 14 Oct 2021 02:12:04 +0200 (CEST) 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 76F771063; Wed, 13 Oct 2021 17:12:03 -0700 (PDT) Received: from slackpad.fritz.box (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9BBAE3F694; Wed, 13 Oct 2021 17:12:02 -0700 (PDT) Date: Thu, 14 Oct 2021 01:10:44 +0100 From: Andre Przywara To: Manuel Dipolt Cc: u-boot@lists.denx.de, jagan@amarulasolutions.com, Samuel Holland Subject: Re: [PATCH v2] sunxi: h3: enable clock support for r_pio gpios Message-ID: <20211014011044.3a7d8c5f@slackpad.fritz.box> In-Reply-To: <20211005155820.8315-1-manuel.dipolt@robart.cc> References: <20211005155820.8315-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.34 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, 5 Oct 2021 17:58:20 +0200 Manuel Dipolt wrote: Hi Manuel, > This patch enables clock for the r_pio gpios for the h3 > r_pio is required to access gpios from port L Better, but it would be good to know what this actually allows (LEDs)? And while some of the whitespace issues are fixed, they are still plenty left, in drivers/clk/sunxi/clk_h3-r.c. But anyway, it seems like Samuel beat you to it, and support for the clock is now merged, in drivers/clk/sunxi/clk_a31_r.c. Check the latest master. But this still does not enable the clock for the GPIO driver, it seems. Can you check this again, and then re-send just the missing part? Thanks, Andre > > Signed-off-by: Manuel Dipolt > --- > drivers/clk/sunxi/Makefile | 1 + > drivers/clk/sunxi/clk_h3-r.c | 51 ++++++++++++++++++++++++++++++++++++ > drivers/gpio/sunxi_gpio.c | 8 ++++++ > 3 files changed, 60 insertions(+) > create mode 100644 drivers/clk/sunxi/clk_h3-r.c > > diff --git a/drivers/clk/sunxi/Makefile b/drivers/clk/sunxi/Makefile > index 4f9282a8b9..92414c8217 100644 > --- a/drivers/clk/sunxi/Makefile > +++ b/drivers/clk/sunxi/Makefile > @@ -17,6 +17,7 @@ obj-$(CONFIG_CLK_SUN8I_R40) += clk_r40.o > obj-$(CONFIG_CLK_SUN8I_V3S) += clk_v3s.o > obj-$(CONFIG_CLK_SUN9I_A80) += clk_a80.o > obj-$(CONFIG_CLK_SUN8I_H3) += clk_h3.o > +obj-$(CONFIG_CLK_SUN8I_H3) += clk_h3-r.o > obj-$(CONFIG_CLK_SUN50I_H6) += clk_h6.o > obj-$(CONFIG_CLK_SUN50I_H616) += clk_h616.o > obj-$(CONFIG_CLK_SUN50I_A64) += clk_a64.o > diff --git a/drivers/clk/sunxi/clk_h3-r.c b/drivers/clk/sunxi/clk_h3-r.c > new file mode 100644 > index 0000000000..aed35149bf > --- /dev/null > +++ b/drivers/clk/sunxi/clk_h3-r.c > @@ -0,0 +1,51 @@ > +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) > +/* > + * Copyright (C) 2021 RobArt GmbH > + * Author: Manuel Dipolt > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +static struct ccu_clk_gate h3_r_gates[] = { > + [CLK_APB0_PIO] = GATE(0x28, BIT(0)), > +}; > + > +static struct ccu_reset h3_r_resets[] = { > + [RST_APB0_IR] = RESET(0x0b0, BIT(2)), > + [RST_APB0_TIMER] = RESET(0x0b0, BIT(3)), > + [RST_APB0_UART] = RESET(0x0b0, BIT(4)), > + [RST_APB0_I2C] = RESET(0x0b0, BIT(6)), > +}; > + > +static const struct ccu_desc h3_r_ccu_desc = { > + .gates = h3_r_gates, > + .resets = h3_r_resets, > +}; > + > +static int h3_r_clk_bind(struct udevice *dev) > +{ > + return sunxi_reset_bind(dev, ARRAY_SIZE(h3_r_resets)); > +} > + > +static const struct udevice_id h3_r_ccu_ids[] = { > + { .compatible = "allwinner,sun8i-h3-r-ccu", > + .data = (ulong)&h3_r_ccu_desc }, > + { } > +}; > + > +U_BOOT_DRIVER(clk_sun8i_h3_r) = { > + .name = "sun8i_h3-r_ccu", > + .id = UCLASS_CLK, > + .of_match = h3_r_ccu_ids, > + .priv_auto = sizeof(struct ccu_priv), > + .ops = &sunxi_clk_ops, > + .probe = sunxi_clk_probe, > + .bind = h3_r_clk_bind, > +}; > + > diff --git a/drivers/gpio/sunxi_gpio.c b/drivers/gpio/sunxi_gpio.c > index 24cb604e3e..884955368f 100644 > --- a/drivers/gpio/sunxi_gpio.c > +++ b/drivers/gpio/sunxi_gpio.c > @@ -14,6 +14,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -262,6 +263,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); > > /* Tell the uclass how many GPIOs we have */ > if (plat) {