* [PATCH RESEND v3 0/2] clk: spacemit: fix sspax_clk
@ 2025-07-31 14:14 Troy Mitchell
2025-07-31 14:14 ` [PATCH RESEND v3 1/2] dt-bindings: clock: spacemit: CLK_SSPA_I2S_BCLK for SSPA Troy Mitchell
2025-07-31 14:14 ` [PATCH RESEND v3 2/2] clk: spacemit: fix sspax_clk Troy Mitchell
0 siblings, 2 replies; 5+ messages in thread
From: Troy Mitchell @ 2025-07-31 14:14 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.
Fixes: 1b72c59db0add ("clk: spacemit: Add clock support for SpacemiT K1 SoC")
Signed-off-by: Troy Mitchell <troy.mitchell@linux.spacemit.com>
---
I sent with a wrong email so resend.
---
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 | 25 +++++++++++++++++++++----
include/dt-bindings/clock/spacemit,k1-syscon.h | 2 ++
2 files changed, 23 insertions(+), 4 deletions(-)
---
base-commit: 733923397fd95405a48f165c9b1fbc8c4b0a4681
change-id: 20250717-k1-clk-i2s-e4272f1f915b
Best regards,
--
Troy Mitchell <troy.mitchell@linux.spacemit.com>
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH RESEND v3 1/2] dt-bindings: clock: spacemit: CLK_SSPA_I2S_BCLK for SSPA 2025-07-31 14:14 [PATCH RESEND v3 0/2] clk: spacemit: fix sspax_clk Troy Mitchell @ 2025-07-31 14:14 ` Troy Mitchell 2025-08-03 16:49 ` Rob Herring (Arm) 2025-07-31 14:14 ` [PATCH RESEND v3 2/2] clk: spacemit: fix sspax_clk Troy Mitchell 1 sibling, 1 reply; 5+ messages in thread From: Troy Mitchell @ 2025-07-31 14:14 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. 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 35968ae98246609c889eb4a7d08b4ff7360de53b..9be578953d71e79e93eb10eaa35b47b97812e826 100644 --- a/include/dt-bindings/clock/spacemit,k1-syscon.h +++ b/include/dt-bindings/clock/spacemit,k1-syscon.h @@ -179,6 +179,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 /* APMU clocks */ #define CLK_CCI550 0 -- 2.50.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH RESEND v3 1/2] dt-bindings: clock: spacemit: CLK_SSPA_I2S_BCLK for SSPA 2025-07-31 14:14 ` [PATCH RESEND v3 1/2] dt-bindings: clock: spacemit: CLK_SSPA_I2S_BCLK for SSPA Troy Mitchell @ 2025-08-03 16:49 ` Rob Herring (Arm) 0 siblings, 0 replies; 5+ messages in thread From: Rob Herring (Arm) @ 2025-08-03 16:49 UTC (permalink / raw) To: Troy Mitchell Cc: Alex Elder, Yixun Lan, devicetree, Conor Dooley, linux-riscv, Michael Turquette, spacemit, Inochi Amaoto, linux-kernel, Stephen Boyd, linux-clk, Haylen Chu, Krzysztof Kozlowski On Thu, 31 Jul 2025 22:14:06 +0800, Troy Mitchell wrote: > 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. > > Signed-off-by: Troy Mitchell <troy.mitchell@linux.spacemit.com> > --- > include/dt-bindings/clock/spacemit,k1-syscon.h | 2 ++ > 1 file changed, 2 insertions(+) > Acked-by: Rob Herring (Arm) <robh@kernel.org> ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH RESEND v3 2/2] clk: spacemit: fix sspax_clk 2025-07-31 14:14 [PATCH RESEND v3 0/2] clk: spacemit: fix sspax_clk Troy Mitchell 2025-07-31 14:14 ` [PATCH RESEND v3 1/2] dt-bindings: clock: spacemit: CLK_SSPA_I2S_BCLK for SSPA Troy Mitchell @ 2025-07-31 14:14 ` Troy Mitchell 2025-08-01 3:25 ` Haylen Chu 1 sibling, 1 reply; 5+ messages in thread From: Troy Mitchell @ 2025-07-31 14:14 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: When FNCLKSEL in APBC_SSPAX_CLK_RST is set to 7 (3'b111), BIT3 must be set to 1 for the SSPAx parent clock to be I2S_BCLK. This patch introduces SSPAx_I2S_BCLK as a virtual gate to enable BIT3. Signed-off-by: Troy Mitchell <troy.mitchell@linux.spacemit.com> Suggested-by: Yao Zi <ziyao@disroot.org> --- drivers/clk/spacemit/ccu-k1.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/drivers/clk/spacemit/ccu-k1.c b/drivers/clk/spacemit/ccu-k1.c index cdde37a0523537c2f436e481ae8d6ec5a581b87e..24a561499a7c11b6a661c026f0bd2fac28fe7b04 100644 --- a/drivers/clk/spacemit/ccu-k1.c +++ b/drivers/clk/spacemit/ccu-k1.c @@ -349,7 +349,10 @@ 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[] = { +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), @@ -357,10 +360,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); @@ -965,6 +980,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.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH RESEND v3 2/2] clk: spacemit: fix sspax_clk 2025-07-31 14:14 ` [PATCH RESEND v3 2/2] clk: spacemit: fix sspax_clk Troy Mitchell @ 2025-08-01 3:25 ` Haylen Chu 0 siblings, 0 replies; 5+ messages in thread From: Haylen Chu @ 2025-08-01 3:25 UTC (permalink / raw) To: Troy Mitchell, Michael Turquette, Stephen Boyd, Yixun Lan, Alex Elder, Inochi Amaoto, Rob Herring, Krzysztof Kozlowski, Conor Dooley Cc: linux-clk, linux-riscv, spacemit, linux-kernel, devicetree, Yao Zi On Thu, Jul 31, 2025 at 10:14:07PM +0800, Troy Mitchell wrote: > Hardware Requirement: > When FNCLKSEL in APBC_SSPAX_CLK_RST is set to 7 (3'b111), > BIT3 must be set to 1 for the SSPAx parent clock to be I2S_BCLK. The change itself looks good to me. But additionally, maybe it's helpful to have a comment explaining this, just like twsi8_clk's case. > This patch introduces SSPAx_I2S_BCLK as a virtual gate to enable BIT3. > > Signed-off-by: Troy Mitchell <troy.mitchell@linux.spacemit.com> > Suggested-by: Yao Zi <ziyao@disroot.org> > --- > drivers/clk/spacemit/ccu-k1.c | 25 +++++++++++++++++++++---- > 1 file changed, 21 insertions(+), 4 deletions(-) With a comment added, feel free to add my Reviewed-by: Haylen Chu <heylenay@4d2.org> Regards, Haylen Chu > diff --git a/drivers/clk/spacemit/ccu-k1.c b/drivers/clk/spacemit/ccu-k1.c > index cdde37a0523537c2f436e481ae8d6ec5a581b87e..24a561499a7c11b6a661c026f0bd2fac28fe7b04 100644 > --- a/drivers/clk/spacemit/ccu-k1.c > +++ b/drivers/clk/spacemit/ccu-k1.c > @@ -349,7 +349,10 @@ 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[] = { > +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), > @@ -357,10 +360,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); > @@ -965,6 +980,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.0 > ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-08-03 16:49 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-07-31 14:14 [PATCH RESEND v3 0/2] clk: spacemit: fix sspax_clk Troy Mitchell 2025-07-31 14:14 ` [PATCH RESEND v3 1/2] dt-bindings: clock: spacemit: CLK_SSPA_I2S_BCLK for SSPA Troy Mitchell 2025-08-03 16:49 ` Rob Herring (Arm) 2025-07-31 14:14 ` [PATCH RESEND v3 2/2] clk: spacemit: fix sspax_clk Troy Mitchell 2025-08-01 3:25 ` Haylen Chu
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox