Message ID | 20240328123440.1387823-2-tudor.ambarus@linaro.org (mailing list archive) |
---|---|
State | Under Review |
Headers | show |
Series | clk: samsung: introduce nMUX to reparent MUX clocks | expand |
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>
diff --git a/drivers/clk/samsung/clk.h b/drivers/clk/samsung/clk.h index a70bd7cce39f..fb06caa71f0a 100644 --- a/drivers/clk/samsung/clk.h +++ b/drivers/clk/samsung/clk.h @@ -133,7 +133,7 @@ struct samsung_mux_clock { .name = cname, \ .parent_names = pnames, \ .num_parents = ARRAY_SIZE(pnames), \ - .flags = (f) | CLK_SET_RATE_NO_REPARENT, \ + .flags = f, \ .offset = o, \ .shift = s, \ .width = w, \ @@ -141,9 +141,16 @@ struct samsung_mux_clock { } #define MUX(_id, cname, pnames, o, s, w) \ - __MUX(_id, cname, pnames, o, s, w, 0, 0) + __MUX(_id, cname, pnames, o, s, w, CLK_SET_RATE_NO_REPARENT, 0) #define MUX_F(_id, cname, pnames, o, s, w, f, mf) \ + __MUX(_id, cname, pnames, o, s, w, (f) | CLK_SET_RATE_NO_REPARENT, mf) + +/* Used by MUX clocks where reparenting on clock rate change is allowed. */ +#define nMUX(_id, cname, pnames, o, s, w) \ + __MUX(_id, cname, pnames, o, s, w, 0, 0) + +#define nMUX_F(_id, cname, pnames, o, s, w, f, mf) \ __MUX(_id, cname, pnames, o, s, w, f, mf) /**
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> --- drivers/clk/samsung/clk.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)