[<prev] [next>] [day] [month] [year] [list]
Message-ID: <1576662086-10569-1-git-send-email-peng.fan@nxp.com>
Date: Wed, 18 Dec 2019 09:44:20 +0000
From: Peng Fan <peng.fan@....com>
To: "sboyd@...nel.org" <sboyd@...nel.org>
CC: "linux-clk@...r.kernel.org" <linux-clk@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Peng Fan <peng.fan@....com>
Subject: [PATCH] clk: mux: check mux value after set
From: Peng Fan <peng.fan@....com>
check mux value after set to see whether it failed or not.
To some platforms, it might failed to set the mux value because
of the hardware not allow the change, let's catch such case and report,
then it will be easy for us the catch issue.
Signed-off-by: Peng Fan <peng.fan@....com>
---
drivers/clk/clk-mux.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/clk/clk-mux.c b/drivers/clk/clk-mux.c
index 570b6e5b603b..3e78ec65bffb 100644
--- a/drivers/clk/clk-mux.c
+++ b/drivers/clk/clk-mux.c
@@ -101,6 +101,7 @@ static int clk_mux_set_parent(struct clk_hw *hw, u8 index)
u32 val = clk_mux_index_to_val(mux->table, mux->flags, index);
unsigned long flags = 0;
u32 reg;
+ int ret = 0;
if (mux->lock)
spin_lock_irqsave(mux->lock, flags);
@@ -117,12 +118,15 @@ static int clk_mux_set_parent(struct clk_hw *hw, u8 index)
reg |= val;
clk_mux_writel(mux, reg);
+ if (clk_mux_get_parent(hw) != index)
+ ret = -EPERM;
+
if (mux->lock)
spin_unlock_irqrestore(mux->lock, flags);
else
__release(mux->lock);
- return 0;
+ return ret;
}
static int clk_mux_determine_rate(struct clk_hw *hw,
--
2.16.4
Powered by blists - more mailing lists