cpufreq: qcom-nvmem: add support for ipq806x
Subsystems (5)
v7 cover cpufreq: qcom-nvmem: add support for ipq806x
This series originally added support also for ipq807x. This part was split and is now merged.
This patch was originally dependent of [1] but was later reverted due to compilation problem. [1] had some changes that weren't related to the compilation problem and were just a fixup.
This series include these 2 required patches from [1] that are just cleanup and won't cause any problem.
These 2 patch were already checked and accepted by maintainers.
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.
[1] https://lore.kernel.org/linux-pm/20231010063235.rj2ehxugtjr5x2xr@vireshk-i7/T/#t
Christian Marangi (2):
cpufreq: qcom-nvmem: add support for IPQ8064
ARM: dts: qcom: ipq8064: Add CPU OPP table
Dmitry Baryshkov (2):
cpufreq: qcom-nvmem: drop pvs_ver for format a fuses
cpufreq: qcom-nvmem: also accept operating-points-v2-krait-cpu
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 | 75 ++++++++++++++++++++++-- 4 files changed, 232 insertions(+), 5 deletions(-)
Signature · 1 line
2.40.1
PATCH v7 1/4 cpufreq: qcom-nvmem: drop pvs_ver for format a fuses
From: Dmitry Baryshkov <[email protected]>
The fuses used on msm8960 / apq8064 / ipq806x families of devices do not have the pvs version. Drop this argument from parsing function.
---
Changes v7:
* Add this patch from reverted other series
--- drivers/cpufreq/qcom-cpufreq-nvmem.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/cpufreq/qcom-cpufreq-nvmem.c +2 -3
@@ -78,7 +78,7 @@ static int qcom_cpufreq_simple_get_version(struct device *cpu_dev, }static void get_krait_bin_format_a (struct device *cpu_dev, -int *speed,int *pvs,int *pvs_ver, +int *speed,int *pvs,u8 *buf) {u32 pte_efuse;
@@ -209,8 +209,7 @@ static int qcom_cpufreq_krait_name_version(struct device *cpu_dev,switch (len) {case 4 : -get_krait_bin_format_a (cpu_dev, &speed, &pvs, &pvs_ver, - speedbin); +get_krait_bin_format_a (cpu_dev, &speed, &pvs, speedbin);break ;case 8 : get_krait_bin_format_b(cpu_dev, &speed, &pvs, &pvs_ver,
Signature · 1 line
2.40.1
PATCH v7 2/4 cpufreq: qcom-nvmem: also accept operating-points-v2-krait-cpu
In reply to Christian MarangiFrom: Dmitry Baryshkov <[email protected]>
the qcom-cpufreq-nvmem driver attempts to support both Qualcomm Kryo (newer 64-bit ARMv8 cores) and Krait (older 32-bit ARMv7 cores). It makes no sense to use 'operating-points-v2-kryo-cpu' compatibility node for the Krait cores. Add support for 'operating-points-v2-krait-cpu' compatibility string.
---
Changes v7:
* Add this patch from reverted other series
--- drivers/cpufreq/qcom-cpufreq-nvmem.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/cpufreq/qcom-cpufreq-nvmem.c +2 -1
@@ -369,7 +369,8 @@ static int qcom_cpufreq_probe(struct platform_device *pdev)if (!np)return -ENOENT ; - ret =of_device_is_compatible (np,"operating-points-v2-kryo-cpu" ); + ret =of_device_is_compatible (np,"operating-points-v2-kryo-cpu" ) || +of_device_is_compatible (np,"operating-points-v2-krait-cpu" );if (!ret) {of_node_put (np);return -ENOENT ;
Signature · 1 line
2.40.1
PATCH v7 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 v7:
* Rebase on top of vireshk cpufreq/arm/linux-next
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
@@ -35,6 +35,12 @@ enum ipq8074_versions { IPQ8074_ACORN_VERSION, }; +enum ipq806x_versions { +IPQ8062_VERSION =0 , +IPQ8064_VERSION , +IPQ8065_VERSION , +}; +#define IPQ6000_VERSION BIT(2)struct qcom_cpufreq_drv ;
@@ -231,6 +237,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_ipq8074_name_version(struct device *cpu_dev, struct nvmem_cell *speedbin_nvmem, char **pvs_name,
@@ -345,6 +406,10 @@ static const struct qcom_cpufreq_match_data match_data_ipq6018 = { .get_version = qcom_cpufreq_ipq6018_name_version, }; +static const struct qcom_cpufreq_match_data match_data_ipq8064 = { + .get_version = qcom_cpufreq_ipq8064_name_version, +}; +static const struct qcom_cpufreq_match_data match_data_ipq8074 = { .get_version = qcom_cpufreq_ipq8074_name_version, };
@@ -477,7 +542,7 @@ static const struct of_device_id qcom_cpufreq_match_list[] __initconst = { { .compatible = "qcom,msm8996", .data = &match_data_kryo }, { .compatible = "qcom,qcs404", .data = &match_data_qcs404 }, { .compatible = "qcom,ipq6018", .data = &match_data_ipq6018 }, - { .compatible = "qcom,ipq8064", .data = &match_data_krait }, + { .compatible = "qcom,ipq8064", .data = &match_data_ipq8064 }, { .compatible = "qcom,ipq8074", .data = &match_data_ipq8074 }, { .compatible = "qcom,apq8064", .data = &match_data_krait }, { .compatible = "qcom,msm8974", .data = &match_data_krait },
Signature · 1 line
2.40.1
PATCH v7 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 v7 4/4] ARM: dts: qcom: ipq8064: Add CPU OPP table
Quoted 8 lines · Christian Marangi
Add 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.
Signed-off-by Christian Marangi <[email protected]>---
I didn't actually check the values against downstream, maybe we can prettyplease ask Dmitry as he's done that before with msm8960-class SoCs..
[...]
arch/arm/boot/dts/qcom/qcom-ipq8064.dtsi L2: l2-cache { · line 56
Quoted 3 lines
arch/arm/boot/dts/qcom/qcom-ipq8064.dtsi +3
-0+ opp_table_cpu: opp-table-cpu { + compatible = "operating-points-v2-krait-cpu"; + nvmem-cells = <&speedbin_efuse>;
Shouldn't this be opp-shared?
Konrad
Viresh Kumar
maintainerQuoted 11 lines · Christian Marangi
This series originally added support also for ipq807x. This part was split and is now merged.
This patch was originally dependent of [1] but was later reverted due to compilation problem. [1] had some changes that weren't related to the compilation problem and were just a fixup.
This series include these 2 required patches from [1] that are just cleanup and won't cause any problem.
These 2 patch were already checked and accepted by maintainers.
Quoted 5 lines
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.
[1] https://lore.kernel.org/linux-pm/20231010063235.rj2ehxugtjr5x2xr@vireshk-i7/T/#t
Applied [1-3]/4. Thanks.
Signature · 1 line
viresh