The generic mux clock code for CCF requires reading the clock multiplexer
value from HW registers. As sandbox by design has readl() as no-op it was
necessary to provide this value in the other way.
The new field in the mux structure (accessible only when sandbox is run)
has been introduced for this purpose.
Signed-off-by: Lukasz Majewski <lukma@denx.de>
struct clk_mux *mux = to_clk_mux(clk);
u32 val;
- val = readl(mux->reg) >> mux->shift;
+#if CONFIG_IS_ENABLED(SANDBOX_CLK_CCF)
+ val = mux->io_mux_val;
+#else
+ val = readl(mux->reg);
+#endif
+ val >>= mux->shift;
val &= mux->mask;
return clk_mux_val_to_index(clk, mux->table, mux->flags, val);
mux->mask = mask;
mux->flags = clk_mux_flags;
mux->table = table;
+#if CONFIG_IS_ENABLED(SANDBOX_CLK_CCF)
+ mux->io_mux_val = *(u32 *)reg;
+#endif
clk = &mux->clk;
*/
const char * const *parent_names;
u8 num_parents;
+#if CONFIG_IS_ENABLED(SANDBOX_CLK_CCF)
+ u32 io_mux_val;
+#endif
+
};
#define to_clk_mux(_clk) container_of(_clk, struct clk_mux, clk)