cpufreq: qcom-nvmem: add support for ipq806x
Subsystems (6)
v6 cover cpufreq: qcom-nvmem: add support for ipq806x
The first patch of this series was split to a separate series as it doesn't depend on [1] and can be applied right away,
[1] introduced some breaking change to function that ipq806x, ipq807x patch was dropped to permit an easier rebase and merge of both.
This small series adds support for ipq806x qcom-cpufreq-nvmem driver. Special function are required to make use of the opp-supported-hw binding by hardcoding custom bits based on the qcom SoC ID.
The qcom-cpufreq-nvmem driver had recent changes to also improve support for apq8064. Because of this, this series depends on a just merged series.
Depends on [1].
[1] https://lore.kernel.org/linux-pm/20231010063235.rj2ehxugtjr5x2xr@vireshk-i7/T/#t
Christian Marangi (4):
dt-bindings: cpufreq: qcom-cpufreq-nvmem: Document krait-cpu
dt-bindings: opp: opp-v2-kryo-cpu: Document named opp-microvolt
property
cpufreq: qcom-nvmem: add support for IPQ8064
ARM: dts: qcom: ipq8064: Add CPU OPP table
.../bindings/cpufreq/qcom-cpufreq-nvmem.yaml | 4 +- .../bindings/opp/opp-v2-kryo-cpu.yaml | 22 ++++++ arch/arm/boot/dts/qcom/qcom-ipq8062.dtsi | 30 +++++++++ arch/arm/boot/dts/qcom/qcom-ipq8064.dtsi | 67 +++++++++++++++++++ arch/arm/boot/dts/qcom/qcom-ipq8065.dtsi | 65 ++++++++++++++++++ drivers/cpufreq/qcom-cpufreq-nvmem.c | 67 ++++++++++++++++++- 6 files changed, 253 insertions(+), 2 deletions(-)
Signature · 1 line
2.40.1
PATCH v6 1/4 dt-bindings: cpufreq: qcom-cpufreq-nvmem: Document krait-cpu
Document newly introduced operating-points-v2-krait-cpu compatible to the list of accepted compatible for opp-v2-kryo-cpu nodes.
---
Changes v6:
* Add this patch
--- .../devicetree/bindings/cpufreq/qcom-cpufreq-nvmem.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/cpufreq/qcom-cpufreq-nvmem.yaml +3 -1
@@ -46,7 +46,9 @@ patternProperties: - if: properties: compatible: - const: operating-points-v2-kryo-cpu + enum: + - operating-points-v2-krait-cpu + - operating-points-v2-kryo-cpu then: $ref: /schemas/opp/opp-v2-kryo-cpu.yaml#
Signature · 1 line
2.40.1
PATCH v6 2/4 dt-bindings: opp: opp-v2-kryo-cpu: Document named opp-microvolt property
In reply to Christian MarangiDocument named opp-microvolt property for opp-v2-kryo-cpu schema. This property is used to declare multiple voltage ranges selected on the different values read from efuses. The selection is done based on the speed pvs values and the named opp-microvolt property is selected by the qcom-cpufreq-nvmem driver.
---
changes v6:
* Rebase on top of dependant series
* Fix example to use krait
Changes v5:
* Fix typo in opp items
Changes v4:
* Address comments from Rob (meaning of pvs, drop of driver specific info, drop of legacy single voltage OPP, better specify max regulators supported)
--- .../bindings/opp/opp-v2-kryo-cpu.yaml | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+)
Documentation/devicetree/bindings/opp/opp-v2-kryo-cpu.yaml +22 -0
@@ -68,6 +68,12 @@ patternProperties: 6: MSM8996SG, speedbin 2 7-31: unused + Bitmap for IPQ806x SoC: + 0: IPQ8062 + 1: IPQ8064/IPQ8066/IPQ8068 + 2: IPQ8065/IPQ8069 + 3-31: unused + Other platforms use bits directly corresponding to speedbin index. clock-latency-ns: true
@@ -262,6 +268,22 @@ examples: }; }; + /* Dummy opp table to give example for named opp-microvolt */ + opp-table-2 { + compatible = "operating-points-v2-krait-cpu"; + nvmem-cells = <&speedbin_efuse>; + + opp-384000000 { + opp-hz = /bits/ 64 <384000000>; + opp-microvolt-speed0-pvs0 = <1000000 950000 1050000>; + opp-microvolt-speed0-pvs1 = <925000 878750 971250>; + opp-microvolt-speed0-pvs2 = <875000 831250 918750>; + opp-microvolt-speed0-pvs3 = <800000 760000 840000>; + opp-supported-hw = <0x7>; + clock-latency-ns = <100000>; + }; + }; + smem { compatible = "qcom,smem"; memory-region = <&smem_mem>;
Signature · 1 line
2.40.1
PATCH v6 3/4 cpufreq: qcom-nvmem: add support for IPQ8064
In reply to Christian MarangiIPQ8064 comes in 3 families:
* IPQ8062 up to 1.0GHz
* IPQ8064/IPQ8066/IPQ8068 up to 1.4GHz
* IPQ8065/IPQ8069 up to 1.7Ghz
So, in order to be able to support one OPP table, add support for IPQ8064 family based of SMEM SoC ID-s and correctly set the version so opp-supported-hw can be correctly used.
Bit are set with the following logic:
* IPQ8062 BIT 0
* IPQ8064/IPQ8066/IPQ8068 BIT 1
* IPQ8065/IPQ8069 BIT 2
speed is never fused, only pvs values are fused.
IPQ806x SoC doesn't have pvs_version so we drop and we use the new pattern:
opp-microvolt-speed0-pvs<PSV_VALUE>
Example:
- for ipq8062 psv2
opp-microvolt-speed0-pvs2 = < 925000 878750 971250>
---
Changes v6:
* Rebase on top of dependant series
* Fix leaking speedbin nvmem
* Fix format_a function to follow new functions
* Improve snprintf as suggested from Konrad
Changes v5:
* Fix leaking speedbin nvmem
Changes in v3:
* Use enum for SoC version
* Dont evaluate speed as its not fused, only pvs
Changes in v2:
* Include IPQ8064 support
--- drivers/cpufreq/qcom-cpufreq-nvmem.c | 67 +++++++++++++++++++++++++++- 1 file changed, 66 insertions(+), 1 deletion(-)
drivers/cpufreq/qcom-cpufreq-nvmem.c +66 -1
@@ -32,6 +32,12 @@#include <dt-bindings/arm/qcom,ids.h> +enum ipq806x_versions { +IPQ8062_VERSION =0 , +IPQ8064_VERSION , +IPQ8065_VERSION , +}; +struct qcom_cpufreq_drv ;struct qcom_cpufreq_match_data {
@@ -205,6 +211,61 @@ static int qcom_cpufreq_krait_name_version(struct device *cpu_dev,return ret; } +static int qcom_cpufreq_ipq8064_name_version (struct device *cpu_dev, +struct nvmem_cell *speedbin_nvmem, +char **pvs_name, +struct qcom_cpufreq_drv *drv) +{ +int speed =0 , pvs =0 ; +int msm_id, ret =0 ; +u8 *speedbin; +size_t len; + + speedbin =nvmem_cell_read (speedbin_nvmem, &len); +if (IS_ERR (speedbin)) +return PTR_ERR (speedbin); + +if (len !=4 ) { +dev_err (cpu_dev,"Unable to read nvmem data. Defaulting to 0!\n" ); + ret = -ENODEV ; + goto exit; + } + +get_krait_bin_format_a (cpu_dev, &speed, &pvs, speedbin); + + ret =qcom_smem_get_soc_id (&msm_id); +if (ret) + goto exit; + +switch (msm_id) { +case QCOM_ID_IPQ8062 : + drv->versions =BIT (IPQ8062_VERSION ); +break ; +case QCOM_ID_IPQ8064 : +case QCOM_ID_IPQ8066 : +case QCOM_ID_IPQ8068 : + drv->versions =BIT (IPQ8064_VERSION ); +break ; +case QCOM_ID_IPQ8065 : +case QCOM_ID_IPQ8069 : + drv->versions =BIT (IPQ8065_VERSION ); +break ; +default : +dev_err (cpu_dev, +"SoC ID %u is not part of IPQ8064 family, limiting to 1.0GHz!\n" , + msm_id); + drv->versions =BIT (IPQ8062_VERSION ); +break ; + } + +/* IPQ8064 speed is never fused. Only pvs values are fused. */ +snprintf (*pvs_name,sizeof ("speed0-pvsXX" ),"speed0-pvs%d" , pvs); + +exit: +kfree (speedbin); +return ret; +} + static int qcom_cpufreq_apq8064_name_version(struct device *cpu_dev, struct nvmem_cell *speedbin_nvmem, char **pvs_name,
@@ -247,6 +308,10 @@ static const struct qcom_cpufreq_match_data match_data_qcs404 = { .genpd_names = qcs404_genpd_names, }; +static const struct qcom_cpufreq_match_data match_data_ipq8064 = { + .get_version = qcom_cpufreq_ipq8064_name_version, +}; +static const char * apq8064_regulator_names[] = {"vdd-core" ,NULL
@@ -405,7 +470,7 @@ static const struct of_device_id qcom_cpufreq_match_list[] __initconst = { { .compatible = "qcom,apq8096", .data = &match_data_kryo }, { .compatible = "qcom,msm8996", .data = &match_data_kryo }, { .compatible = "qcom,qcs404", .data = &match_data_qcs404 }, - { .compatible = "qcom,ipq8064", .data = &match_data_krait }, + { .compatible = "qcom,ipq8064", .data = &match_data_ipq8064 }, { .compatible = "qcom,apq8064", .data = &match_data_apq8064 }, { .compatible = "qcom,msm8974", .data = &match_data_krait }, { .compatible = "qcom,msm8960", .data = &match_data_apq8064 },
Signature · 1 line
2.40.1
PATCH v6 4/4 ARM: dts: qcom: ipq8064: Add CPU OPP table
In reply to Christian MarangiAdd CPU OPP table for IPQ8062, IPQ8064 and IPQ8065 SoC. Use opp-supported-hw binding to correctly enable and disable the frequency as IPQ8062 supports up to 1.0Ghz, IPQ8064 supports up to 1.4GHz with 1.2GHz as an additional frequency and IPQ8065 supports 1.7GHZ but doesn't have 1.2GHZ frequency and has to be disabled.
---
Changes v6:
* Use new krait compatible
Changes v4:
* Readd OPP patch for IPQ8064
--- arch/arm/boot/dts/qcom/qcom-ipq8062.dtsi | 30 +++++++++++ arch/arm/boot/dts/qcom/qcom-ipq8064.dtsi | 67 ++++++++++++++++++++++++ arch/arm/boot/dts/qcom/qcom-ipq8065.dtsi | 65 +++++++++++++++++++++++ 3 files changed, 162 insertions(+)
arch/arm/boot/dts/qcom/qcom-ipq8062.dtsi +30 -0
@@ -6,3 +6,33 @@ / { model = "Qualcomm Technologies, Inc. IPQ8062"; compatible = "qcom,ipq8062", "qcom,ipq8064"; }; + +&opp_table_cpu { + opp-384000000 { + opp-microvolt-speed0-pvs0 = <1000000 950000 1050000>; + opp-microvolt-speed0-pvs1 = <925000 878750 971250>; + opp-microvolt-speed0-pvs2 = <875000 831250 918750>; + opp-microvolt-speed0-pvs3 = <800000 760000 840000>; + }; + + opp-600000000 { + opp-microvolt-speed0-pvs0 = <1050000 997500 1102500>; + opp-microvolt-speed0-pvs1 = <975000 926250 1023750>; + opp-microvolt-speed0-pvs2 = <925000 878750 971250>; + opp-microvolt-speed0-pvs3 = <850000 807500 892500>; + }; + + opp-800000000 { + opp-microvolt-speed0-pvs0 = <1100000 1045000 1155000>; + opp-microvolt-speed0-pvs1 = <1025000 973750 1076250>; + opp-microvolt-speed0-pvs2 = <995000 945250 1044750>; + opp-microvolt-speed0-pvs3 = <900000 855000 945000>; + }; + + opp-1000000000 { + opp-microvolt-speed0-pvs0 = <1150000 1092500 1207500>; + opp-microvolt-speed0-pvs1 = <1075000 1021250 1128750>; + opp-microvolt-speed0-pvs2 = <1025000 973750 1076250>; + opp-microvolt-speed0-pvs3 = <950000 902500 997500>; + }; +};
arch/arm/boot/dts/qcom/qcom-ipq8064.dtsi +67 -0
85 lines not on this page · raw message
arch/arm/boot/dts/qcom/qcom-ipq8065.dtsi +65 -0
68 lines not on this page · raw message
Signature · 1 line
2.40.1
Re: [PATCH v6 1/4] dt-bindings: cpufreq: qcom-cpufreq-nvmem: Document krait-cpu
In reply to Christian MarangiQuoted 11 lines · Christian Marangi
Document newly introduced operating-points-v2-krait-cpu compatible to the list of accepted compatible for opp-v2-kryo-cpu nodes.
Signed-off-by Christian Marangi <[email protected]>---
Changes v6:
* Add this patch--- .../devicetree/bindings/cpufreq/qcom-cpufreq-nvmem.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Viresh Kumar
maintainerQuoted 13 lines · Christian Marangi
The first patch of this series was split to a separate series as it doesn't depend on [1] and can be applied right away,
[1] introduced some breaking change to function that ipq806x, ipq807x patch was dropped to permit an easier rebase and merge of both.This small series adds support for ipq806x qcom-cpufreq-nvmem driver. Special function are required to make use of the opp-supported-hw binding by hardcoding custom bits based on the qcom SoC ID.
The qcom-cpufreq-nvmem driver had recent changes to also improve support for apq8064. Because of this, this series depends on a just merged series.
Quoted 8 lines
Depends on [1].
[1] https://lore.kernel.org/linux-pm/20231010063235.rj2ehxugtjr5x2xr@vireshk-i7/T/#t
Christian Marangi (4):
dt-bindings: cpufreq: qcom-cpufreq-nvmem: Document krait-cpu
dt-bindings: opp: opp-v2-kryo-cpu: Document named opp-microvolt
property
Applied above two. Thanks.
Quoted 1 line
cpufreq: qcom-nvmem: add support for IPQ8064
This doesn't apply/build anymore.
Quoted 1 line
ARM: dts: qcom: ipq8064: Add CPU OPP table
Signature · 1 line
viresh
Quoted 23 lines · Viresh Kumar
Quoted 13 lines · Christian Marangi
The first patch of this series was split to a separate series as it doesn't depend on [1] and can be applied right away,
[1] introduced some breaking change to function that ipq806x, ipq807x patch was dropped to permit an easier rebase and merge of both.This small series adds support for ipq806x qcom-cpufreq-nvmem driver. Special function are required to make use of the opp-supported-hw binding by hardcoding custom bits based on the qcom SoC ID.
The qcom-cpufreq-nvmem driver had recent changes to also improve support for apq8064. Because of this, this series depends on a just merged series.
Quoted 8 lines
Depends on [1].
[1] https://lore.kernel.org/linux-pm/20231010063235.rj2ehxugtjr5x2xr@vireshk-i7/T/#t
Christian Marangi (4):
dt-bindings: cpufreq: qcom-cpufreq-nvmem: Document krait-cpu
dt-bindings: opp: opp-v2-kryo-cpu: Document named opp-microvolt
property
Quoted 6 lines
Applied above two. Thanks.
Quoted 1 line
cpufreq: qcom-nvmem: add support for IPQ8064
This doesn't apply/build anymore.
Hi, I sent v7 that fix the conflict problem. I dropped from the series the 2 applied patch and added the 2 dependent patch since it seems fixing the problem in the series might take longer times.
Can you check? Thanks a lot for the help in accepting this series.
Quoted 2 lines
Quoted 1 line
ARM: dts: qcom: ipq8064: Add CPU OPP table
Signature · 1 line
Ansuel
Re: [PATCH v6 3/4] cpufreq: qcom-nvmem: add support for IPQ8064
In reply to Christian MarangiQuoted 20 lines · Christian Marangi
IPQ8064 comes in 3 families:
* IPQ8062 up to 1.0GHz
* IPQ8064/IPQ8066/IPQ8068 up to 1.4GHz
* IPQ8065/IPQ8069 up to 1.7GhzSo, in order to be able to support one OPP table, add support for IPQ8064 family based of SMEM SoC ID-s and correctly set the version so opp-supported-hw can be correctly used.
Bit are set with the following logic:
* IPQ8062 BIT 0
* IPQ8064/IPQ8066/IPQ8068 BIT 1
* IPQ8065/IPQ8069 BIT 2speed is never fused, only pvs values are fused.
IPQ806x SoC doesn't have
pvs_versionso we drop and we use the new pattern:
opp-microvolt-speed0-pvs<PSV_VALUE>
Quoted 7 lines
Example:
- for ipq8062 psv2
opp-microvolt-speed0-pvs2 = < 925000 878750 971250>Fixes a8811ec764f9 ("cpufreq: qcom: Add support for krait based socs")Signed-off-by Christian Marangi <[email protected]>---
Konrad