* [PATCH v5 0/2] clk: spacemit: fix sspax_clk
@ 2025-08-11 13:40 Troy Mitchell
2025-08-11 13:40 ` [PATCH v5 1/2] dt-bindings: clock: spacemit: CLK_SSPA_I2S_BCLK for SSPA Troy Mitchell
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Troy Mitchell @ 2025-08-11 13:40 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd, Yixun Lan, Alex Elder,
Haylen Chu, Inochi Amaoto, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: linux-clk, linux-riscv, spacemit, linux-kernel, devicetree,
Troy Mitchell, Yao Zi
In the SpacemiT public document, when the FNCLKSEL field of
the APBC_SSPAX_CLK_RST register is 7 (3'b111),
which is a reserved value. And BIT3 of the same register is
a reserved bit.
But the documentation is incorrect. In reality, the value 7 (3'b111)
of FNCLKSEL is not reserved. Instead, it indicates that i2s_bclk is
selected as the parent clock. Similarly, bit 3 is not reserved either.
When FNCLKSEL is set to 7, bit 3 determines whether i2s_bclk is actually
enabled as the parent clock.
In all other cases (i.e., when FNCLKSEL is not 7), bit 3 has no effect.
Importantly, whenever FNCLKSEL is set to 7, bit 3 must also be set to 1,
otherwise the selection of i2s_bclk becomes invalid.
Signed-off-by: Troy Mitchell <troy.mitchell@linux.spacemit.com>
---
btw, the public documentation for the k1 clock has been updated.
---
Changes in v5:
- move fixes tag from cover-letter to patch1/2 and patch2/2
- modify commit messages
- Link to v3: https://lore.kernel.org/r/20250731-k1-clk-i2s-v3-0-2f655ddb0c6f@linux.spacemit.com
Changes in v4:
- add comments
- add tags
- Link to v3: https://lore.kernel.org/r/20250731-k1-clk-i2s-v3-0-2f655ddb0c6f@linux.spacemit.com
Changes in v3:
- Fixing ABI-breaking behavior
- Modify commit msgs
- Link to v2: https://lore.kernel.org/r/20250722-k1-clk-i2s-v2-0-2f8edfe3dab4@linux.spacemit.com
Changes in v2:
- Use virtual gate instead of new function for sspa
- Add Suggested-by tag: Yao Zi
- Add Fixes tag
- Link to v1: https://lore.kernel.org/all/20250718-k1-clk-i2s-v1-1-e92c10fd0f60@linux.spacemit.com/
---
Troy Mitchell (2):
dt-bindings: clock: spacemit: CLK_SSPA_I2S_BCLK for SSPA
clk: spacemit: fix sspax_clk
drivers/clk/spacemit/ccu-k1.c | 29 ++++++++++++++++++++++----
include/dt-bindings/clock/spacemit,k1-syscon.h | 2 ++
2 files changed, 27 insertions(+), 4 deletions(-)
---
base-commit: 8f5ae30d69d7543eee0d70083daf4de8fe15d585
change-id: 20250717-k1-clk-i2s-e4272f1f915b
Best regards,
--
Troy Mitchell <troy.mitchell@linux.spacemit.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v5 1/2] dt-bindings: clock: spacemit: CLK_SSPA_I2S_BCLK for SSPA
2025-08-11 13:40 [PATCH v5 0/2] clk: spacemit: fix sspax_clk Troy Mitchell
@ 2025-08-11 13:40 ` Troy Mitchell
2025-08-11 13:40 ` [PATCH v5 2/2] clk: spacemit: fix sspax_clk Troy Mitchell
2025-08-25 22:05 ` [PATCH v5 0/2] " Yixun Lan
2 siblings, 0 replies; 4+ messages in thread
From: Troy Mitchell @ 2025-08-11 13:40 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd, Yixun Lan, Alex Elder,
Haylen Chu, Inochi Amaoto, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: linux-clk, linux-riscv, spacemit, linux-kernel, devicetree,
Troy Mitchell
In order to use the virtual clock SSPAx_I2S_BCLK in the device tree and
register it in the driver, this patch introduces the macro definition.
Fixes: 1b72c59db0add ("clk: spacemit: Add clock support for SpacemiT K1 SoC")
Acked-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Troy Mitchell <troy.mitchell@linux.spacemit.com>
---
include/dt-bindings/clock/spacemit,k1-syscon.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/dt-bindings/clock/spacemit,k1-syscon.h b/include/dt-bindings/clock/spacemit,k1-syscon.h
index 2714c3fe66cd5b49e12c8b20689f5b01da36b774..505205453d7f19ad478b3b741d83f4498fcb8c0d 100644
--- a/include/dt-bindings/clock/spacemit,k1-syscon.h
+++ b/include/dt-bindings/clock/spacemit,k1-syscon.h
@@ -182,6 +182,8 @@
#define CLK_SSPA1_BUS 97
#define CLK_TSEN_BUS 98
#define CLK_IPC_AP2AUD_BUS 99
+#define CLK_SSPA0_I2S_BCLK 100
+#define CLK_SSPA1_I2S_BCLK 101
/* APBC resets */
#define RESET_UART0 0
--
2.50.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v5 2/2] clk: spacemit: fix sspax_clk
2025-08-11 13:40 [PATCH v5 0/2] clk: spacemit: fix sspax_clk Troy Mitchell
2025-08-11 13:40 ` [PATCH v5 1/2] dt-bindings: clock: spacemit: CLK_SSPA_I2S_BCLK for SSPA Troy Mitchell
@ 2025-08-11 13:40 ` Troy Mitchell
2025-08-25 22:05 ` [PATCH v5 0/2] " Yixun Lan
2 siblings, 0 replies; 4+ messages in thread
From: Troy Mitchell @ 2025-08-11 13:40 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd, Yixun Lan, Alex Elder,
Haylen Chu, Inochi Amaoto, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: linux-clk, linux-riscv, spacemit, linux-kernel, devicetree,
Troy Mitchell, Yao Zi
Hardware Requirement:
BIT[3] of this register must be set if need to select i2s_bclk as
SSPA parent clock, to solve this, introduces a new SSPAx_I2S_BCLK
clock as the virtual gate clock.
Fixes: 1b72c59db0add ("clk: spacemit: Add clock support for SpacemiT K1 SoC")
Suggested-by: Yao Zi <ziyao@disroot.org>
Reviewed-by: Haylen Chu <heylenay@4d2.org>
Signed-off-by: Troy Mitchell <troy.mitchell@linux.spacemit.com>
---
drivers/clk/spacemit/ccu-k1.c | 29 +++++++++++++++++++++++++----
1 file changed, 25 insertions(+), 4 deletions(-)
diff --git a/drivers/clk/spacemit/ccu-k1.c b/drivers/clk/spacemit/ccu-k1.c
index 65e6de030717afa60eefab7bda88f9a13b857650..62cdba516a29f960e15e04642470f55e3d85bfad 100644
--- a/drivers/clk/spacemit/ccu-k1.c
+++ b/drivers/clk/spacemit/ccu-k1.c
@@ -247,7 +247,14 @@ CCU_GATE_DEFINE(aib_clk, CCU_PARENT_NAME(vctcxo_24m), APBC_AIB_CLK_RST, BIT(1),
CCU_GATE_DEFINE(onewire_clk, CCU_PARENT_NAME(vctcxo_24m), APBC_ONEWIRE_CLK_RST, BIT(1), 0);
-static const struct clk_parent_data sspa_parents[] = {
+/*
+ * When i2s_bclk is selected as the parent clock of sspa,
+ * the hardware requires bit3 to be set
+ */
+CCU_GATE_DEFINE(sspa0_i2s_bclk, CCU_PARENT_HW(i2s_bclk), APBC_SSPA0_CLK_RST, BIT(3), 0);
+CCU_GATE_DEFINE(sspa1_i2s_bclk, CCU_PARENT_HW(i2s_bclk), APBC_SSPA1_CLK_RST, BIT(3), 0);
+
+static const struct clk_parent_data sspa0_parents[] = {
CCU_PARENT_HW(pll1_d384_6p4),
CCU_PARENT_HW(pll1_d192_12p8),
CCU_PARENT_HW(pll1_d96_25p6),
@@ -255,10 +262,22 @@ static const struct clk_parent_data sspa_parents[] = {
CCU_PARENT_HW(pll1_d768_3p2),
CCU_PARENT_HW(pll1_d1536_1p6),
CCU_PARENT_HW(pll1_d3072_0p8),
- CCU_PARENT_HW(i2s_bclk),
+ CCU_PARENT_HW(sspa0_i2s_bclk),
};
-CCU_MUX_GATE_DEFINE(sspa0_clk, sspa_parents, APBC_SSPA0_CLK_RST, 4, 3, BIT(1), 0);
-CCU_MUX_GATE_DEFINE(sspa1_clk, sspa_parents, APBC_SSPA1_CLK_RST, 4, 3, BIT(1), 0);
+CCU_MUX_GATE_DEFINE(sspa0_clk, sspa0_parents, APBC_SSPA0_CLK_RST, 4, 3, BIT(1), 0);
+
+static const struct clk_parent_data sspa1_parents[] = {
+ CCU_PARENT_HW(pll1_d384_6p4),
+ CCU_PARENT_HW(pll1_d192_12p8),
+ CCU_PARENT_HW(pll1_d96_25p6),
+ CCU_PARENT_HW(pll1_d48_51p2),
+ CCU_PARENT_HW(pll1_d768_3p2),
+ CCU_PARENT_HW(pll1_d1536_1p6),
+ CCU_PARENT_HW(pll1_d3072_0p8),
+ CCU_PARENT_HW(sspa1_i2s_bclk),
+};
+CCU_MUX_GATE_DEFINE(sspa1_clk, sspa1_parents, APBC_SSPA1_CLK_RST, 4, 3, BIT(1), 0);
+
CCU_GATE_DEFINE(dro_clk, CCU_PARENT_HW(apb_clk), APBC_DRO_CLK_RST, BIT(1), 0);
CCU_GATE_DEFINE(ir_clk, CCU_PARENT_HW(apb_clk), APBC_IR_CLK_RST, BIT(1), 0);
CCU_GATE_DEFINE(tsen_clk, CCU_PARENT_HW(apb_clk), APBC_TSEN_CLK_RST, BIT(1), 0);
@@ -865,6 +884,8 @@ static struct clk_hw *k1_ccu_apbc_hws[] = {
[CLK_SSPA1_BUS] = &sspa1_bus_clk.common.hw,
[CLK_TSEN_BUS] = &tsen_bus_clk.common.hw,
[CLK_IPC_AP2AUD_BUS] = &ipc_ap2aud_bus_clk.common.hw,
+ [CLK_SSPA0_I2S_BCLK] = &sspa0_i2s_bclk.common.hw,
+ [CLK_SSPA1_I2S_BCLK] = &sspa1_i2s_bclk.common.hw,
};
static const struct spacemit_ccu_data k1_ccu_apbc_data = {
--
2.50.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v5 0/2] clk: spacemit: fix sspax_clk
2025-08-11 13:40 [PATCH v5 0/2] clk: spacemit: fix sspax_clk Troy Mitchell
2025-08-11 13:40 ` [PATCH v5 1/2] dt-bindings: clock: spacemit: CLK_SSPA_I2S_BCLK for SSPA Troy Mitchell
2025-08-11 13:40 ` [PATCH v5 2/2] clk: spacemit: fix sspax_clk Troy Mitchell
@ 2025-08-25 22:05 ` Yixun Lan
2 siblings, 0 replies; 4+ messages in thread
From: Yixun Lan @ 2025-08-25 22:05 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd, Alex Elder, Haylen Chu,
Inochi Amaoto, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Troy Mitchell
Cc: Yixun Lan, linux-clk, linux-riscv, spacemit, linux-kernel,
devicetree, Yao Zi
From: Yixun Lan <dlan@gentoo.org>
On Mon, 11 Aug 2025 21:40:32 +0800, Troy Mitchell wrote:
> In the SpacemiT public document, when the FNCLKSEL field of
> the APBC_SSPAX_CLK_RST register is 7 (3'b111),
> which is a reserved value. And BIT3 of the same register is
> a reserved bit.
>
> But the documentation is incorrect. In reality, the value 7 (3'b111)
> of FNCLKSEL is not reserved. Instead, it indicates that i2s_bclk is
> selected as the parent clock. Similarly, bit 3 is not reserved either.
> When FNCLKSEL is set to 7, bit 3 determines whether i2s_bclk is actually
> enabled as the parent clock.
>
> [...]
Thanks, Applied to SpacemiT's SoC tree at "k1/clk-for-6.18" branch
[1/2] dt-bindings: clock: spacemit: CLK_SSPA_I2S_BCLK for SSPA
https://github.com/spacemit-com/linux/commit/7d50d9bf1cd00d6bab0abf3b01d5d261aa6a2b04
[2/2] clk: spacemit: fix sspax_clk
https://github.com/spacemit-com/linux/commit/c536e00d58dc8db3e1e430a8e6830bc22d2a38e3
Best regards,
--
Yixun Lan
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-08-25 22:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-11 13:40 [PATCH v5 0/2] clk: spacemit: fix sspax_clk Troy Mitchell
2025-08-11 13:40 ` [PATCH v5 1/2] dt-bindings: clock: spacemit: CLK_SSPA_I2S_BCLK for SSPA Troy Mitchell
2025-08-11 13:40 ` [PATCH v5 2/2] clk: spacemit: fix sspax_clk Troy Mitchell
2025-08-25 22:05 ` [PATCH v5 0/2] " Yixun Lan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).