0e75d4c93d7b79d8cb3212f246fd4e9ae7c80749
[openwrt/staging/mans0n.git] /
1 From 5a1bea2a2572ce5eb4bdcf432a6929681ee381f2 Mon Sep 17 00:00:00 2001
2 From: Rajendra Nayak <rnayak@codeaurora.org>
3 Date: Tue, 30 Mar 2021 12:12:41 +0100
4 Subject: [PATCH] nvmem: qfprom: Add support for fuse blowing on sc7280
5
6 Handle the differences across LDO voltage needed for blowing fuses,
7 and the blow timer value, identified using a minor version of 15
8 on sc7280.
9
10 Signed-off-by: Rajendra Nayak <rnayak@codeaurora.org>
11 Signed-off-by: Ravi Kumar Bokka <rbokka@codeaurora.org>
12 Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
13 Link: https://lore.kernel.org/r/20210330111241.19401-11-srinivas.kandagatla@linaro.org
14 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
15 ---
16 drivers/nvmem/qfprom.c | 27 +++++++++++++++++++++++++--
17 1 file changed, 25 insertions(+), 2 deletions(-)
18
19 --- a/drivers/nvmem/qfprom.c
20 +++ b/drivers/nvmem/qfprom.c
21 @@ -45,11 +45,13 @@ MODULE_PARM_DESC(read_raw_data, "Read ra
22 * @qfprom_blow_timer_value: The timer value of qfprom when doing efuse blow.
23 * @qfprom_blow_set_freq: The frequency required to set when we start the
24 * fuse blowing.
25 + * @qfprom_blow_uV: LDO voltage to be set when doing efuse blow
26 */
27 struct qfprom_soc_data {
28 u32 accel_value;
29 u32 qfprom_blow_timer_value;
30 u32 qfprom_blow_set_freq;
31 + int qfprom_blow_uV;
32 };
33
34 /**
35 @@ -111,6 +113,15 @@ static const struct qfprom_soc_compatibl
36 .nkeepout = ARRAY_SIZE(sc7180_qfprom_keepout)
37 };
38
39 +static const struct nvmem_keepout sc7280_qfprom_keepout[] = {
40 + {.start = 0x128, .end = 0x148},
41 + {.start = 0x238, .end = 0x248}
42 +};
43 +
44 +static const struct qfprom_soc_compatible_data sc7280_qfprom = {
45 + .keepout = sc7280_qfprom_keepout,
46 + .nkeepout = ARRAY_SIZE(sc7280_qfprom_keepout)
47 +};
48 /**
49 * qfprom_disable_fuse_blowing() - Undo enabling of fuse blowing.
50 * @priv: Our driver data.
51 @@ -168,6 +179,7 @@ static int qfprom_enable_fuse_blowing(co
52 struct qfprom_touched_values *old)
53 {
54 int ret;
55 + int qfprom_blow_uV = priv->soc_data->qfprom_blow_uV;
56
57 ret = clk_prepare_enable(priv->secclk);
58 if (ret) {
59 @@ -187,9 +199,9 @@ static int qfprom_enable_fuse_blowing(co
60 * a rail shared do don't specify a max--regulator constraints
61 * will handle.
62 */
63 - ret = regulator_set_voltage(priv->vcc, 1800000, INT_MAX);
64 + ret = regulator_set_voltage(priv->vcc, qfprom_blow_uV, INT_MAX);
65 if (ret) {
66 - dev_err(priv->dev, "Failed to set 1.8 voltage\n");
67 + dev_err(priv->dev, "Failed to set %duV\n", qfprom_blow_uV);
68 goto err_clk_rate_set;
69 }
70
71 @@ -311,6 +323,14 @@ static const struct qfprom_soc_data qfpr
72 .accel_value = 0xD10,
73 .qfprom_blow_timer_value = 25,
74 .qfprom_blow_set_freq = 4800000,
75 + .qfprom_blow_uV = 1800000,
76 +};
77 +
78 +static const struct qfprom_soc_data qfprom_7_15_data = {
79 + .accel_value = 0xD08,
80 + .qfprom_blow_timer_value = 24,
81 + .qfprom_blow_set_freq = 4800000,
82 + .qfprom_blow_uV = 1900000,
83 };
84
85 static int qfprom_probe(struct platform_device *pdev)
86 @@ -379,6 +399,8 @@ static int qfprom_probe(struct platform_
87
88 if (major_version == 7 && minor_version == 8)
89 priv->soc_data = &qfprom_7_8_data;
90 + if (major_version == 7 && minor_version == 15)
91 + priv->soc_data = &qfprom_7_15_data;
92
93 priv->vcc = devm_regulator_get(&pdev->dev, "vcc");
94 if (IS_ERR(priv->vcc))
95 @@ -405,6 +427,7 @@ static int qfprom_probe(struct platform_
96 static const struct of_device_id qfprom_of_match[] = {
97 { .compatible = "qcom,qfprom",},
98 { .compatible = "qcom,sc7180-qfprom", .data = &sc7180_qfprom},
99 + { .compatible = "qcom,sc7280-qfprom", .data = &sc7280_qfprom},
100 {/* sentinel */},
101 };
102 MODULE_DEVICE_TABLE(of, qfprom_of_match);