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 5212DC433EF for ; Tue, 5 Oct 2021 15:58:40 +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 F1E0F6120A for ; Tue, 5 Oct 2021 15:58:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org F1E0F6120A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=robart.cc 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 0947A807CD; Tue, 5 Oct 2021 17:58:37 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=robart.cc Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=robart.cc header.i=@robart.cc header.b="TY3SmOWd"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 17B0681468; Tue, 5 Oct 2021 17:58:35 +0200 (CEST) Received: from srv-mta-01.robart.cc (mail.robart.cc [81.10.172.252]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 453A78029E for ; Tue, 5 Oct 2021 17:58:32 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=robart.cc Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=manuel.dipolt@robart.cc Received: from localhost (localhost [127.0.0.1]) by srv-mta-01.robart.cc (Postfix) with ESMTP id A53011C051B; Tue, 5 Oct 2021 17:58:31 +0200 (CEST) Received: from srv-mta-01.robart.cc ([127.0.0.1]) by localhost (srv-mta-01.robart.cc [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 12Mm7YUC5_2p; Tue, 5 Oct 2021 17:58:31 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by srv-mta-01.robart.cc (Postfix) with ESMTP id 596DB1C052C; Tue, 5 Oct 2021 17:58:31 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.10.3 srv-mta-01.robart.cc 596DB1C052C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=robart.cc; s=B016B336-104E-11EA-8E2D-E36DD02BB770; t=1633449511; bh=j5bR1mQtzm0aPSLClcsuZ2XsfgW1I+uLPK3UgYM2ATE=; h=From:To:Date:Message-Id:MIME-Version; b=TY3SmOWdSio0ca10iPoiXwq3M2yV4JCK50HuLeXeNcW8P4JRkcioQOE/Dm7+k7vJM YJf82X8r1baJip9Q6TQ9AChgvayUJQqS5oyu0dZXEH/EEfGt/hxxj8QwG0EN6Pu5Vv agPE0aQiYkU9NUr4gtNBqvxVubX2WkcH3l85JJQCIFYQ2xA0jnCyU9uslab8Re4SbZ T7UGp5JRM2oGrg5Z4I1Re63PIus5oCrEs6h4X8nLIy9EsN6vGiufT4d1hlxAu3oM5/ U1Qkgorfqvq3GTQUIoPNUYkr6alWY6GsynZ5hLLBz1/bfibPxdDGtPuS7OgjvVgnQM 46eypKJo7/Lkw== Received: from srv-mta-01.robart.cc ([127.0.0.1]) by localhost (srv-mta-01.robart.cc [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id AvnWBJLZQx9J; Tue, 5 Oct 2021 17:58:31 +0200 (CEST) Received: from workbot40.intern.robart.cc (workbot40.intern.robart.cc [10.0.20.40]) by srv-mta-01.robart.cc (Postfix) with ESMTPSA id 28CC81C051B; Tue, 5 Oct 2021 17:58:31 +0200 (CEST) From: Manuel Dipolt To: andre.przywara@arm.com Cc: u-boot@lists.denx.de, jagan@amarulasolutions.com, Manuel Dipolt Subject: [PATCH v2] sunxi: h3: enable clock support for r_pio gpios Date: Tue, 5 Oct 2021 17:58:20 +0200 Message-Id: <20211005155820.8315-1-manuel.dipolt@robart.cc> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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 This patch enables clock for the r_pio gpios for the h3 r_pio is required to access gpios from port L 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) +=3D clk_r40.o obj-$(CONFIG_CLK_SUN8I_V3S) +=3D clk_v3s.o obj-$(CONFIG_CLK_SUN9I_A80) +=3D clk_a80.o obj-$(CONFIG_CLK_SUN8I_H3) +=3D clk_h3.o +obj-$(CONFIG_CLK_SUN8I_H3) +=3D clk_h3-r.o obj-$(CONFIG_CLK_SUN50I_H6) +=3D clk_h6.o obj-$(CONFIG_CLK_SUN50I_H616) +=3D clk_h616.o obj-$(CONFIG_CLK_SUN50I_A64) +=3D 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[] =3D { + [CLK_APB0_PIO] =3D GATE(0x28, BIT(0)), +}; + +static struct ccu_reset h3_r_resets[] =3D { + [RST_APB0_IR] =3D RESET(0x0b0, BIT(2)), + [RST_APB0_TIMER] =3D RESET(0x0b0, BIT(3)), + [RST_APB0_UART] =3D RESET(0x0b0, BIT(4)), + [RST_APB0_I2C] =3D RESET(0x0b0, BIT(6)), +}; + +static const struct ccu_desc h3_r_ccu_desc =3D { + .gates =3D h3_r_gates, + .resets =3D 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[] =3D { + { .compatible =3D "allwinner,sun8i-h3-r-ccu", + .data =3D (ulong)&h3_r_ccu_desc }, + { } +}; + +U_BOOT_DRIVER(clk_sun8i_h3_r) =3D { + .name =3D "sun8i_h3-r_ccu", + .id =3D UCLASS_CLK, + .of_match =3D h3_r_ccu_ids, + .priv_auto =3D sizeof(struct ccu_priv), + .ops =3D &sunxi_clk_ops, + .probe =3D sunxi_clk_probe, + .bind =3D 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 =3D dev_get_plat(dev); struct gpio_dev_priv *uc_priv =3D dev_get_uclass_priv(dev); + struct clk gate_clk; + int ret; + + ret =3D clk_get_by_name(dev, "apb", &gate_clk); + + if (!ret) + clk_enable(&gate_clk); =20 /* Tell the uclass how many GPIOs we have */ if (plat) { --=20 2.20.1