From patchwork Sat May 2 15:58:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 244808 List-Id: U-Boot discussion From: dariobin at libero.it (Dario Binacchi) Date: Sat, 2 May 2020 17:58:33 +0200 Subject: [PATCH 3/4] clk: ccf: mux: fix access to the sandbox register In-Reply-To: <20200502155834.27481-1-dariobin@libero.it> References: <20200502155834.27481-1-dariobin@libero.it> Message-ID: <20200502155834.27481-4-dariobin@libero.it> The tests developed for the mux clock are run on the sandbox. They don't call the clk_mux_set_parent routine and therefore they do not detect this error. Signed-off-by: Dario Binacchi --- drivers/clk/clk-mux.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/clk/clk-mux.c b/drivers/clk/clk-mux.c index 6264b63900..8f85e84ae9 100644 --- a/drivers/clk/clk-mux.c +++ b/drivers/clk/clk-mux.c @@ -134,12 +134,20 @@ static int clk_mux_set_parent(struct clk *clk, struct clk *parent) if (mux->flags & CLK_MUX_HIWORD_MASK) { reg = mux->mask << (mux->shift + 16); } else { +#if CONFIG_IS_ENABLED(SANDBOX_CLK_CCF) + reg = mux->io_mux_val; +#else reg = readl(mux->reg); +#endif reg &= ~(mux->mask << mux->shift); } val = val << mux->shift; reg |= val; +#if CONFIG_IS_ENABLED(SANDBOX_CLK_CCF) + mux->io_mux_val = reg; +#else writel(reg, mux->reg); +#endif return 0; }