mbox series

[v3,0/3] clk: samsung: introduce nMUX to reparent MUX clocks

Message ID 20240328123440.1387823-1-tudor.ambarus@linaro.org
Headers show
Series clk: samsung: introduce nMUX to reparent MUX clocks | expand

Message

Tudor Ambarus March 28, 2024, 12:34 p.m. UTC
v3:
- update first patch:
  - remove __nMUX() as it duplicated __MUX() with an exception on flags.
  - update commit message
  - update comment and say that nMUX() shall be used where MUX reparenting
    on clock rate chage is allowed
- collect R-b, A-b tags

v2:
- reword commit messages
- drop exynos850 patch on Sam's request

v1: https://lore.kernel.org/linux-samsung-soc/20240229122021.1901785-1-tudor.ambarus@linaro.org/


All samsung MUX clocks that are defined with MUX() set the
CLK_SET_RATE_NO_REPARENT flag in __MUX(), which prevents MUXes to be
reparented during clk_set_rate().
    
Introduce nMUX() for MUX clocks that can be reparented. nMUX is used
in GS101 to reparent the USI MUX to OSCCLK on low SPI clock rates.

Each instance of the USI IP in GS101 has its own MUX_USI clock, thus
the reparenting of a MUX_USI clock corresponds to a single instance
of the USI IP. We allow the reparenting of the MUX_USIx clocks to
OSCCLK. The datasheet mentions OSCCLK just in the low-power mode
context, but the downstream driver reparents too the MUX_USI clocks
to OSCCLK. Follow the downstream driver and do the same.

Tested with USI6 and USI13 SPI.

Find discussion on MUX reparenting to OSCCLK at:
https://lore.kernel.org/linux-samsung-soc/d508dfc1-bc28-4470-92aa-cf71915966f4@linaro.org/

Tudor Ambarus (3):
  clk: samsung: introduce nMUX for MUX clks that can reparented
  clk: samsung: gs101: propagate PERIC1 USI SPI clock rate
  clk: samsung: gs101: propagate PERIC0 USI SPI clock rate

 drivers/clk/samsung/clk-gs101.c | 225 +++++++++++++++++---------------
 drivers/clk/samsung/clk.h       |  11 +-
 2 files changed, 129 insertions(+), 107 deletions(-)

Comments

André Draszik March 28, 2024, 12:44 p.m. UTC | #1
On Thu, 2024-03-28 at 12:34 +0000, Tudor Ambarus wrote:
> All samsung MUX clocks that are defined with MUX() set the
> CLK_SET_RATE_NO_REPARENT flag in __MUX(), which prevents MUXes to be
> reparented during clk_set_rate().
> 
> Introduce nMUX() for MUX clocks that can be reparented on clock rate
> change. "nMUX" comes from "n-to-1 selector", hopefully emphasising that
> the selector can change on clock rate changes. Ideally MUX/MUX_F()
> should change to not have the CLK_SET_RATE_NO_REPARENT flag set by
> default, and all their users to be updated to add the flag back
> (like in the case of DIV and GATE). But this is a very intrusive change
> and because for now only GS101 allows MUX reparenting on clock rate
> change, stick with nMUX().
> 
> One user of nMUX() will be GS101. GS101 defines MUX clocks that
> are dedicated for each instance of an IP (see MUX USI). The reparenting
> of these MUX clocks will not affect other instances of the same IP or
> different IPs altogether.
> 
> Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>

Reviewed-by: André Draszik <andre.draszik@linaro.org>
Krzysztof Kozlowski April 13, 2024, 8:47 a.m. UTC | #2
On 28/03/2024 13:34, Tudor Ambarus wrote:
> v3:
> - update first patch:
>   - remove __nMUX() as it duplicated __MUX() with an exception on flags.
>   - update commit message
>   - update comment and say that nMUX() shall be used where MUX reparenting
>     on clock rate chage is allowed
> - collect R-b, A-b tags
> 

Sorry for late response, somehow this end up deep in inbox. You
reference some non existing commits, so I think you do not work on
mainline trees.

Also Fixes must come before other patches, so probably first patch
should be squashed with second. Otherwise second patch is not a complete
fix.

Best regards,
Krzysztof
Tudor Ambarus April 15, 2024, 7:13 a.m. UTC | #3
On 4/13/24 09:47, Krzysztof Kozlowski wrote:
> On 28/03/2024 13:34, Tudor Ambarus wrote:
>> v3:
>> - update first patch:
>>   - remove __nMUX() as it duplicated __MUX() with an exception on flags.
>>   - update commit message
>>   - update comment and say that nMUX() shall be used where MUX reparenting
>>     on clock rate chage is allowed
>> - collect R-b, A-b tags
>>
> 
> Sorry for late response, somehow this end up deep in inbox. You

no worries!

> reference some non existing commits, so I think you do not work on
> mainline trees.

Ah, the horror, you're right, I messed up the fixes reference in commit
2. It's because I started working on this before that patch got
integrated. Would be good to extend checkpatch to catch such situations.

> 
> Also Fixes must come before other patches, so probably first patch
> should be squashed with second. Otherwise second patch is not a complete
> fix.

I don't mind squashing them. I noticed a tag that might help in this
situations: "Depends-on:". But I guess we can't use that in the same
patch set as when the maintainer applies the dependency and adds its
S-o-b tag, it will modify the sha1 of the commit. Will squash them.

Cheers,
ta