summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2019-03-11 09:44:15 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2019-03-11 10:02:36 +0100
commitc7cc27d006ccca5951b8fecb596d546998181f7c (patch)
tree9a1e3c45d41eb66c0b799e3d619553cbaea26fb2 /drivers
parenta2fbc210ade163ea3e746f49269b698bd8e5b7ed (diff)
downloadbarebox-c7cc27d006ccca5951b8fecb596d546998181f7c.tar.gz
clk: mux: Support CLK_MUX_READ_ONLY flag
Support readonly dividers using the CLK_MUX_READ_ONLY flag. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/clk/clk-mux.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/clk/clk-mux.c b/drivers/clk/clk-mux.c
index ebf736b..e9cb614 100644
--- a/drivers/clk/clk-mux.c
+++ b/drivers/clk/clk-mux.c
@@ -33,6 +33,13 @@ static int clk_mux_set_parent(struct clk *clk, u8 idx)
struct clk_mux *m = container_of(clk, struct clk_mux, clk);
u32 val;
+ if (m->flags & CLK_MUX_READ_ONLY) {
+ if (clk_mux_get_parent(clk) != idx)
+ return -EPERM;
+ else
+ return 0;
+ }
+
val = readl(m->reg);
val &= ~(((1 << m->width) - 1) << m->shift);
val |= idx << m->shift;