提交 4fb4cc87 编写于 作者: R Ravi Kumar Bokka 提交者: Zheng Zengkai

drivers: nvmem: Fix voltage settings for QTI qfprom-efuse

stable inclusion
from stable-5.10.37
commit 100a5c76e5d2f781395372790443ba30135da8a4
bugzilla: 51868
CVE: NA

--------------------------------

[ Upstream commit 9ec4f4b0 ]

QFPROM controller hardware requires 1.8V min for fuse blowing.
So, this change sets the voltage to 1.8V, required to blow the fuse
for qfprom-efuse controller.

To disable fuse blowing, we set the voltage to 0V since this may
be a shared rail and may be able to run at a lower rate when we're
not blowing fuses.

Fixes: 93b4e49f ("nvmem: qfprom: Add fuse blowing support")
Reported-by: NDouglas Anderson <dianders@chromium.org>
Suggested-by: NDouglas Anderson <dianders@chromium.org>
Reviewed-by: NDouglas Anderson <dianders@chromium.org>
Signed-off-by: NRavi Kumar Bokka <rbokka@codeaurora.org>
Signed-off-by: NSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20210330111241.19401-4-srinivas.kandagatla@linaro.orgSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: NWeilong Chen <chenweilong@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 c39577a2
...@@ -104,6 +104,16 @@ static void qfprom_disable_fuse_blowing(const struct qfprom_priv *priv, ...@@ -104,6 +104,16 @@ static void qfprom_disable_fuse_blowing(const struct qfprom_priv *priv,
{ {
int ret; int ret;
/*
* This may be a shared rail and may be able to run at a lower rate
* when we're not blowing fuses. At the moment, the regulator framework
* applies voltage constraints even on disabled rails, so remove our
* constraints and allow the rail to be adjusted by other users.
*/
ret = regulator_set_voltage(priv->vcc, 0, INT_MAX);
if (ret)
dev_warn(priv->dev, "Failed to set 0 voltage (ignoring)\n");
ret = regulator_disable(priv->vcc); ret = regulator_disable(priv->vcc);
if (ret) if (ret)
dev_warn(priv->dev, "Failed to disable regulator (ignoring)\n"); dev_warn(priv->dev, "Failed to disable regulator (ignoring)\n");
...@@ -149,6 +159,17 @@ static int qfprom_enable_fuse_blowing(const struct qfprom_priv *priv, ...@@ -149,6 +159,17 @@ static int qfprom_enable_fuse_blowing(const struct qfprom_priv *priv,
goto err_clk_prepared; goto err_clk_prepared;
} }
/*
* Hardware requires 1.8V min for fuse blowing; this may be
* a rail shared do don't specify a max--regulator constraints
* will handle.
*/
ret = regulator_set_voltage(priv->vcc, 1800000, INT_MAX);
if (ret) {
dev_err(priv->dev, "Failed to set 1.8 voltage\n");
goto err_clk_rate_set;
}
ret = regulator_enable(priv->vcc); ret = regulator_enable(priv->vcc);
if (ret) { if (ret) {
dev_err(priv->dev, "Failed to enable regulator\n"); dev_err(priv->dev, "Failed to enable regulator\n");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册