* [PATCH] clk: npcm7xx: Mark the dividers read-only
@ 2026-11-30 9:08 William A. Kennington III
2026-11-30 10:10 ` Jerome Brunet
0 siblings, 1 reply; 3+ messages in thread
From: William A. Kennington III @ 2026-11-30 9:08 UTC (permalink / raw)
To: Stephen Boyd, Brian Masney, Jerome Brunet, Tomer Maimon,
Andrew Jeffery, Avi Fishman, Tali Perry
Cc: Patrick Venture, Nancy Yuen, Benjamin Fair, linux-clk, openbmc,
linux-kernel, William A. Kennington III
From: Tomer Maimon <tmaimon77@gmail.com>
The NPCM7xx clock dividers are programmed by the boot firmware. The
driver registers them as ordinary dividers, so a consumer that calls
clk_set_rate() reprograms them.
Register the dividers with CLK_DIVIDER_READ_ONLY, so that the kernel
keeps what the firmware has set up. clk-npcm8xx already registers most
of its dividers this way. The SPI3 divider stays writable.
The one in-tree consumer that sets the rate of these clocks is
spi-npcm-fiu, which asks for the maximum frequency of the flash on each
transfer. FIU0 and FIUX are clocked from the SPI0 and SPIX dividers, so
they now stay at the rate the firmware chose and clk_set_rate() on them
succeeds without changing anything. FIU3 is clocked from the SPI3
divider and is not affected.
Signed-off-by: Tomer Maimon <tmaimon77@gmail.com>
[william@wkennington.com: add the flag in place, rewrite the commit message]
Signed-off-by: William A. Kennington III <william@wkennington.com>
---
drivers/clk/clk-npcm7xx.c | 38 +++++++++++++++++++-------------------
1 file changed, 19 insertions(+), 19 deletions(-)
diff --git a/drivers/clk/clk-npcm7xx.c b/drivers/clk/clk-npcm7xx.c
index 562d2d406d7a..cb206d22e0f7 100644
--- a/drivers/clk/clk-npcm7xx.c
+++ b/drivers/clk/clk-npcm7xx.c
@@ -335,66 +335,66 @@ static const struct npcm7xx_clk_mux_data npcm7xx_muxes[] __initconst = {
/* configurable dividers: */
static const struct npcm7xx_clk_div_data npcm7xx_divs[] __initconst = {
{NPCM7XX_CLKDIV1, 28, 3, NPCM7XX_CLK_S_ADC,
- NPCM7XX_CLK_S_TIMER, CLK_DIVIDER_POWER_OF_TWO, 0, NPC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Y, 0, NPCM7XX_CLK_PCI},
/*5-2 PCICKDIV*/
{NPCM7XX_CLKDIV1, 0, 1, NPCM7XX_CLK_S_AXI,
- NPCM7XX_CLK_S_CPU_MUX, CLK_DIVIDER_POWER_OF_TWO, CLK_IS_CRITICAL,
+ NPCM7XX_CLK_S_CPU_MUX, CLK_DIVIDER_READ_ONLY | CLK_DIVIDER_POWER_OF_TWO, CLK_IS_CRITICAL,
NPCM7XX_CLK_AXI},/*0 CLK2DIV*/
{NPCM7XX_CLKDIV2, 30, 2, NPCM7XX_CLK_S_APB4,
- NPCM7XX_CLK_S_AHB, CLK_DIVIDER_POWER_OF_TWO, 0, NPCM7XX_CLK_APB4},
+ NPCM7XX_CLK_S_AHB, CLK_DIVIDER_READ_ONLY | CLK_DIVIDER_POWER_OF_TWO, 0, NPCM7XX_CLK_APB4},
/*31-30 APB4CKDIV*/
{NPCM7XX_CLKDIV2, 28, 2, NPCM7XX_CLK_S_APB3,
- NPCM7XX_CLK_S_AHB, CLK_DIVIDER_POWER_OF_TWO, 0, NPCM7XX_CLK_APB3},
+ NPCM7XX_CLK_S_AHB, CLK_DIVIDER_READ_ONLY | CLK_DIVIDER_POWER_OF_TWO, 0, NPCM7XX_CLK_APB3},
/*29-28 APB3CKDIV*/
{NPCM7XX_CLKDIV2, 26, 2, NPCM7XX_CLK_S_APB2,
- NPCM7XX_CLK_S_AHB, CLK_DIVIDER_POWER_OF_TWO, 0, NPCM7XX_CLK_APB2},
+ NPCM7XX_CLK_S_AHB, CLK_DIVIDER_READ_ONLY | CLK_DIVIDER_POWER_OF_TWO, 0, NPCM7XX_CLK_APB2},
/*27-26 APB2CKDIV*/
{NPCM7XX_CLKDIV2, 24, 2, NPCM7XX_CLK_S_APB1,
- NPCM7XX_CLK_S_AHB, CLK_DIVIDER_POWER_OF_TWO, 0, NPCM7XX_CLK_APB1},
+ NPCM7XX_CLK_S_AHB, CLK_DIVIDER_READ_ONLY | CLK_DIVIDER_POWER_OF_TWO, 0, NPCM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S_SD_MUX, CLK_DIVIDER_READ_ONLY, 0, NPCM7XX_CLK_SDHC}
,/*3-0 SD1CKDIV*/
{NPCM7XX_CLKDIV3, 6, 5, NPCM7XX_CLK_S_SPI0,
- NPCM7XX_CLK_S_AHB, 0, 0, NPCM7XX_CLK_SPI0},
+ NPCM7XX_CLK_S_AHB, CLK_DIVIDER_READ_ONLY, 0, NPCM7XX_CLK_SPI0},
/*10-6 SPI0CKDV*/
{NPCM7XX_CLKDIV3, 1, 5, NPCM7XX_CLK_S_SPIX,
- NPCM7XX_CLK_S_AHB, 0, 0, NPCM7XX_CLK_SPIX},
+ NPCM7XX_CLK_S_AHB, CLK_DIVIDER_READ_ONLY, 0, NPCM7XX_CLK_SPIX},
/*5-1 SPIXCKDV*/
};
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] clk: npcm7xx: Mark the dividers read-only
2026-11-30 9:08 [PATCH] clk: npcm7xx: Mark the dividers read-only William A. Kennington III
@ 2026-11-30 10:10 ` Jerome Brunet
2026-11-30 21:46 ` William A. Kennington III
0 siblings, 1 reply; 3+ messages in thread
From: Jerome Brunet @ 2026-11-30 10:10 UTC (permalink / raw)
To: William A. Kennington III
Cc: Stephen Boyd, Brian Masney, Jerome Brunet, Tomer Maimon,
Andrew Jeffery, Avi Fishman, Tali Perry, Patrick Venture,
Nancy Yuen, Benjamin Fair, linux-clk, openbmc, linux-kernel,
Jerome Brunet
On 2026-11-30 09:08 +0000, William A. Kennington III wrote:
> From: Tomer Maimon <tmaimon77@gmail.com>
>
> The NPCM7xx clock dividers are programmed by the boot firmware. The
> driver registers them as ordinary dividers, so a consumer that calls
> clk_set_rate() reprograms them.
>
> Register the dividers with CLK_DIVIDER_READ_ONLY, so that the kernel
> keeps what the firmware has set up. clk-npcm8xx already registers most
> of its dividers this way. The SPI3 divider stays writable.
You are explaining what you are doing, not really why you are doing it.
You've got a boot firmware that gives an initial state. This is fairly
usual and we don't lock all the clock controllers down based ont that.
Why should the kernel be unable to to touch these clocks now ?
--
Jerome
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] clk: npcm7xx: Mark the dividers read-only
2026-11-30 10:10 ` Jerome Brunet
@ 2026-11-30 21:46 ` William A. Kennington III
0 siblings, 0 replies; 3+ messages in thread
From: William A. Kennington III @ 2026-11-30 21:46 UTC (permalink / raw)
To: Jerome Brunet
Cc: Stephen Boyd, Brian Masney, Jerome Brunet, Tomer Maimon,
Andrew Jeffery, Avi Fishman, Tali Perry, Patrick Venture,
Nancy Yuen, Benjamin Fair, linux-clk, openbmc, linux-kernel
On Mon, Nov 30, 2026 at 11:10:44AM +0100, Jerome Brunet wrote:
> You are explaining what you are doing, not really why you are doing it.
> You've got a boot firmware that gives an initial state. This is fairly
> usual and we don't lock all the clock controllers down based ont that.
>
> Why should the kernel be unable to to touch these clocks now ?
My bad, we have been carrying this a while and when I first glanced at it
I thought it would be a good idea to just send as-is. You are right, I
don't see a good reason to keep it.
Unless Tomer knows of a hardware constraint I missed, let's drop this
patch. Thanks for the review.
William
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-30 21:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-30 9:08 [PATCH] clk: npcm7xx: Mark the dividers read-only William A. Kennington III
2026-11-30 10:10 ` Jerome Brunet
2026-11-30 21:46 ` William A. Kennington III
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox