Commit 5a1bea2a authored by Rajendra Nayak's avatar Rajendra Nayak Committed by Greg Kroah-Hartman

nvmem: qfprom: Add support for fuse blowing on sc7280

Handle the differences across LDO voltage needed for blowing fuses,
and the blow timer value, identified using a minor version of 15
on sc7280.
Signed-off-by: default avatarRajendra Nayak <rnayak@codeaurora.org>
Signed-off-by: default avatarRavi Kumar Bokka <rbokka@codeaurora.org>
Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20210330111241.19401-11-srinivas.kandagatla@linaro.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b1f20fd0
...@@ -45,11 +45,13 @@ MODULE_PARM_DESC(read_raw_data, "Read raw instead of corrected data"); ...@@ -45,11 +45,13 @@ MODULE_PARM_DESC(read_raw_data, "Read raw instead of corrected data");
* @qfprom_blow_timer_value: The timer value of qfprom when doing efuse blow. * @qfprom_blow_timer_value: The timer value of qfprom when doing efuse blow.
* @qfprom_blow_set_freq: The frequency required to set when we start the * @qfprom_blow_set_freq: The frequency required to set when we start the
* fuse blowing. * fuse blowing.
* @qfprom_blow_uV: LDO voltage to be set when doing efuse blow
*/ */
struct qfprom_soc_data { struct qfprom_soc_data {
u32 accel_value; u32 accel_value;
u32 qfprom_blow_timer_value; u32 qfprom_blow_timer_value;
u32 qfprom_blow_set_freq; u32 qfprom_blow_set_freq;
int qfprom_blow_uV;
}; };
/** /**
...@@ -111,6 +113,15 @@ static const struct qfprom_soc_compatible_data sc7180_qfprom = { ...@@ -111,6 +113,15 @@ static const struct qfprom_soc_compatible_data sc7180_qfprom = {
.nkeepout = ARRAY_SIZE(sc7180_qfprom_keepout) .nkeepout = ARRAY_SIZE(sc7180_qfprom_keepout)
}; };
static const struct nvmem_keepout sc7280_qfprom_keepout[] = {
{.start = 0x128, .end = 0x148},
{.start = 0x238, .end = 0x248}
};
static const struct qfprom_soc_compatible_data sc7280_qfprom = {
.keepout = sc7280_qfprom_keepout,
.nkeepout = ARRAY_SIZE(sc7280_qfprom_keepout)
};
/** /**
* qfprom_disable_fuse_blowing() - Undo enabling of fuse blowing. * qfprom_disable_fuse_blowing() - Undo enabling of fuse blowing.
* @priv: Our driver data. * @priv: Our driver data.
...@@ -168,6 +179,7 @@ static int qfprom_enable_fuse_blowing(const struct qfprom_priv *priv, ...@@ -168,6 +179,7 @@ static int qfprom_enable_fuse_blowing(const struct qfprom_priv *priv,
struct qfprom_touched_values *old) struct qfprom_touched_values *old)
{ {
int ret; int ret;
int qfprom_blow_uV = priv->soc_data->qfprom_blow_uV;
ret = clk_prepare_enable(priv->secclk); ret = clk_prepare_enable(priv->secclk);
if (ret) { if (ret) {
...@@ -187,9 +199,9 @@ static int qfprom_enable_fuse_blowing(const struct qfprom_priv *priv, ...@@ -187,9 +199,9 @@ static int qfprom_enable_fuse_blowing(const struct qfprom_priv *priv,
* a rail shared do don't specify a max--regulator constraints * a rail shared do don't specify a max--regulator constraints
* will handle. * will handle.
*/ */
ret = regulator_set_voltage(priv->vcc, 1800000, INT_MAX); ret = regulator_set_voltage(priv->vcc, qfprom_blow_uV, INT_MAX);
if (ret) { if (ret) {
dev_err(priv->dev, "Failed to set 1.8 voltage\n"); dev_err(priv->dev, "Failed to set %duV\n", qfprom_blow_uV);
goto err_clk_rate_set; goto err_clk_rate_set;
} }
...@@ -311,6 +323,14 @@ static const struct qfprom_soc_data qfprom_7_8_data = { ...@@ -311,6 +323,14 @@ static const struct qfprom_soc_data qfprom_7_8_data = {
.accel_value = 0xD10, .accel_value = 0xD10,
.qfprom_blow_timer_value = 25, .qfprom_blow_timer_value = 25,
.qfprom_blow_set_freq = 4800000, .qfprom_blow_set_freq = 4800000,
.qfprom_blow_uV = 1800000,
};
static const struct qfprom_soc_data qfprom_7_15_data = {
.accel_value = 0xD08,
.qfprom_blow_timer_value = 24,
.qfprom_blow_set_freq = 4800000,
.qfprom_blow_uV = 1900000,
}; };
static int qfprom_probe(struct platform_device *pdev) static int qfprom_probe(struct platform_device *pdev)
...@@ -379,6 +399,8 @@ static int qfprom_probe(struct platform_device *pdev) ...@@ -379,6 +399,8 @@ static int qfprom_probe(struct platform_device *pdev)
if (major_version == 7 && minor_version == 8) if (major_version == 7 && minor_version == 8)
priv->soc_data = &qfprom_7_8_data; priv->soc_data = &qfprom_7_8_data;
if (major_version == 7 && minor_version == 15)
priv->soc_data = &qfprom_7_15_data;
priv->vcc = devm_regulator_get(&pdev->dev, "vcc"); priv->vcc = devm_regulator_get(&pdev->dev, "vcc");
if (IS_ERR(priv->vcc)) if (IS_ERR(priv->vcc))
...@@ -405,6 +427,7 @@ static int qfprom_probe(struct platform_device *pdev) ...@@ -405,6 +427,7 @@ static int qfprom_probe(struct platform_device *pdev)
static const struct of_device_id qfprom_of_match[] = { static const struct of_device_id qfprom_of_match[] = {
{ .compatible = "qcom,qfprom",}, { .compatible = "qcom,qfprom",},
{ .compatible = "qcom,sc7180-qfprom", .data = &sc7180_qfprom}, { .compatible = "qcom,sc7180-qfprom", .data = &sc7180_qfprom},
{ .compatible = "qcom,sc7280-qfprom", .data = &sc7280_qfprom},
{/* sentinel */}, {/* sentinel */},
}; };
MODULE_DEVICE_TABLE(of, qfprom_of_match); MODULE_DEVICE_TABLE(of, qfprom_of_match);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment