U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Anand Moon <linux.amoon@gmail.com>
To: u-boot@lists.u-boot-project.org
Cc: Anand Moon <linux.amoon@gmail.com>,
	Junhui Liu <junhui.liu@pigmoral.tech>,
	Dave Klotz <DaveWK225@protonmail.com>,
	Eric Chung <eric.chung@riscstar.com>,
	Hung-Chun Tseng <alan.tseng.cs@gmail.com>,
	E Shattow <e@freeshell.de>, Yixun Lan <dlan@kernel.org>,
	Lukasz Majewski <lukma@nabladev.com>,
	Tom Rini <trini@konsulko.com>, Guodong Xu <guodong@riscstar.com>
Subject: [PATCH v3 04/13] clk: spacemit: k1: Add GPIO and AIB clock support in SPL
Date: Fri, 27 Nov 2026 10:30:03 +0000	[thread overview]
Message-ID: <20261127103030.4647-5-linux.amoon@gmail.com> (raw)
In-Reply-To: <20261127103030.4647-1-linux.amoon@gmail.com>

The SpacemiT K1 GPIO and pinctrl controllers require their functional
and bus clocks to be enabled before accessing the controller registers.

These clocks are currently only available in U-Boot proper, preventing
the GPIO and pinctrl drivers from enabling their clocks in SPL.

Move the GPIO and AIB clock definitions outside the SPL conditional
and register them in the SPL APBC clock table.

This allows both controllers to enable their required clocks during
early boot.

Cc: Dave Klotz <DaveWK225@protonmail.com>
Cc: Eric Chung <eric.chung@riscstar.com>
Cc: Hung-Chun Tseng <alan.tseng.cs@gmail.com>
Cc: E Shattow <e@freeshell.de>
Cc: Yixun Lan <dlan@kernel.org>
Suggested-by: Junhui Liu <junhui.liu@pigmoral.tech>
Signed-off-by: Anand Moon <linux.amoon@gmail.com>
---
 drivers/clk/spacemit/clk-k1.c | 29 +++++++++++++++++------------
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/drivers/clk/spacemit/clk-k1.c b/drivers/clk/spacemit/clk-k1.c
index 20b8595aa3c..646c81a2d60 100644
--- a/drivers/clk/spacemit/clk-k1.c
+++ b/drivers/clk/spacemit/clk-k1.c
@@ -379,9 +379,6 @@ CCU_MUX_GATE_DEFINE(CLK_UART9, uart9_clk, uart9_clk, uart_clk_parents,
 		    ARRAY_SIZE(uart_clk_parents), APBC_UART9_CLK_RST,
 		    4, 3, BIT(1) | BIT(0), 0);
 
-CCU_GATE_DEFINE(CLK_GPIO, gpio_clk, gpio_clk, "clock-24m", APBC_GPIO_CLK_RST,
-		BIT(1) | BIT(0), 0);
-
 static const char * const pwm_parents[] = {
 	"pll1_d192_12p8",
 	"clock-32k",
@@ -499,9 +496,6 @@ CCU_MUX_GATE_DEFINE(CLK_TIMERS2, timers2_clk, timers2_clk, timer_parents,
 		    ARRAY_SIZE(timer_parents), APBC_TIMERS2_CLK_RST, 4, 3,
 		    BIT(1) | BIT(0), 0);
 
-CCU_GATE_DEFINE(CLK_AIB, aib_clk, aib_clk, "clock-24m", APBC_AIB_CLK_RST,
-		BIT(1) | BIT(0), 0);
-
 CCU_GATE_DEFINE(CLK_ONEWIRE, onewire_clk, onewire_clk, "clock-24m",
 		APBC_ONEWIRE_CLK_RST, BIT(1) | BIT(0), 0);
 
@@ -584,9 +578,6 @@ CCU_GATE_DEFINE(CLK_UART8_BUS, uart8_bus_clk, uart8_bus_clk, "apb_clk",
 CCU_GATE_DEFINE(CLK_UART9_BUS, uart9_bus_clk, uart9_bus_clk, "apb_clk",
 		APBC_UART9_CLK_RST, BIT(0), 0);
 
-CCU_GATE_DEFINE(CLK_GPIO_BUS, gpio_bus_clk, gpio_bus_clk, "apb_clk",
-		APBC_GPIO_CLK_RST, BIT(0), 0);
-
 CCU_GATE_DEFINE(CLK_PWM0_BUS, pwm0_bus_clk, pwm0_bus_clk, "apb_clk",
 		APBC_PWM0_CLK_RST, BIT(0), 0);
 CCU_GATE_DEFINE(CLK_PWM1_BUS, pwm1_bus_clk, pwm1_bus_clk, "apb_clk",
@@ -655,9 +646,6 @@ CCU_GATE_DEFINE(CLK_TIMERS1_BUS, timers1_bus_clk, timers1_bus_clk, "apb_clk",
 CCU_GATE_DEFINE(CLK_TIMERS2_BUS, timers2_bus_clk, timers2_bus_clk, "apb_clk",
 		APBC_TIMERS2_CLK_RST, BIT(0), 0);
 
-CCU_GATE_DEFINE(CLK_AIB_BUS, aib_bus_clk, aib_bus_clk, "apb_clk",
-		APBC_AIB_CLK_RST, BIT(0), 0);
-
 CCU_GATE_DEFINE(CLK_ONEWIRE_BUS, onewire_bus_clk, onewire_bus_clk, "apb_clk",
 		APBC_ONEWIRE_CLK_RST, BIT(0), 0);
 
@@ -672,6 +660,19 @@ CCU_GATE_DEFINE(CLK_TSEN_BUS, tsen_bus_clk, tsen_bus_clk, "apb_clk",
 CCU_GATE_DEFINE(CLK_IPC_AP2AUD_BUS, ipc_ap2aud_bus_clk, ipc_ap2aud_bus_clk,
 		"apb_clk", APBC_IPC_AP2AUD_CLK_RST, BIT(0), 0);
 #endif
+
+CCU_GATE_DEFINE(CLK_GPIO, gpio_clk, gpio_clk, "clock-24m", APBC_GPIO_CLK_RST,
+		BIT(1) | BIT(0), 0);
+
+CCU_GATE_DEFINE(CLK_AIB, aib_clk, aib_clk, "clock-24m", APBC_AIB_CLK_RST,
+		BIT(1) | BIT(0), 0);
+
+CCU_GATE_DEFINE(CLK_GPIO_BUS, gpio_bus_clk, gpio_bus_clk, "apb_clk",
+		APBC_GPIO_CLK_RST, BIT(0), 0);
+
+CCU_GATE_DEFINE(CLK_AIB_BUS, aib_bus_clk, aib_bus_clk, "apb_clk",
+		APBC_AIB_CLK_RST, BIT(0), 0);
+
 /* APBC clocks end */
 
 /* APMU clocks start */
@@ -1309,10 +1310,14 @@ static const struct spacemit_ccu_data k1_ccu_mpmu_data = {
 #if IS_ENABLED(CONFIG_SPL_BUILD)
 static struct clk *k1_ccu_apbc_clks[] = {
 	&uart0_clk.common.clk,
+	&gpio_clk.common.clk,
 	&twsi2_clk.common.clk,
 	&twsi8_clk.common.clk,
+	&aib_clk.common.clk,
+	&gpio_bus_clk.common.clk,
 	&twsi2_bus_clk.common.clk,
 	&twsi8_bus_clk.common.clk,
+	&aib_bus_clk.common.clk,
 };
 #else
 static struct clk *k1_ccu_apbc_clks[] = {
-- 
2.56.1


  parent reply	other threads:[~2026-11-27 10:31 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-27 10:29 [PATCH v3 00/13] riscv: spacemit: Add GPIO and pinctrl support in SPL Anand Moon
2026-11-27 10:30 ` [PATCH v3 01/13] riscv: dts: spacemit: k1: Move common U-Boot nodes to shared DTSI Anand Moon
2026-11-27 10:55   ` E Shattow
2026-11-27 10:30 ` [PATCH v3 02/13] riscv: dts: spacemit: k1-musepi-pro: Drop redundant DT overrides Anand Moon
2026-11-27 10:59   ` E Shattow
2026-11-27 10:30 ` [PATCH v3 03/13] riscv: dts: spacemit: k1: Move common U-Boot properties to shared DTSI Anand Moon
2026-11-27 11:26   ` E Shattow
2026-11-28  8:09     ` Anand Moon
2026-11-27 10:30 ` Anand Moon [this message]
2026-11-27 11:36   ` [PATCH v3 04/13] clk: spacemit: k1: Add GPIO and AIB clock support in SPL E Shattow
2026-11-27 10:30 ` [PATCH v3 05/13] pinctrl: spacemit: Add SPL support for K1/K3 pinctrl driver Anand Moon
2026-11-27 11:42   ` E Shattow
2026-11-27 10:30 ` [PATCH v3 06/13] gpio: spacemit: Add SPL support for K1/K3 GPIO driver Anand Moon
2026-11-27 11:40   ` E Shattow
2026-11-27 10:30 ` [PATCH v3 07/13] mmc: spacemit_sdhci: Improve voltage switching diagnostics Anand Moon
2026-11-27 10:30 ` [PATCH v3 08/13] mmc: spacemit_sdhci: Select pinctrl state based on signal voltage Anand Moon
2026-11-27 10:30 ` [PATCH v3 09/13] riscv: spacemit: k1: Adjust SPL stack and malloc configuration Anand Moon
2026-11-27 10:30 ` [PATCH v3 10/13] riscv: dts: spacemit: k1: Retain GPIO and pinctrl nodes in SPL Anand Moon
2026-11-27 10:30 ` [PATCH v3 11/13] riscv: spacemit: k1: Enable GPIO, pinctrl and MMC UHS support Anand Moon
2026-11-27 10:30 ` [PATCH v3 12/13] riscv: spacemit: k1: Enable uncompressed multi-DTB FIT support in SPL Anand Moon
2026-11-27 10:30 ` [PATCH v3 13/13] riscv: dts: spacemit: k1: Support multi-DTB SPL images in Binman Anand Moon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261127103030.4647-5-linux.amoon@gmail.com \
    --to=linux.amoon@gmail.com \
    --cc=DaveWK225@protonmail.com \
    --cc=alan.tseng.cs@gmail.com \
    --cc=dlan@kernel.org \
    --cc=e@freeshell.de \
    --cc=eric.chung@riscstar.com \
    --cc=guodong@riscstar.com \
    --cc=junhui.liu@pigmoral.tech \
    --cc=lukma@nabladev.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.u-boot-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox