ipq807x: use updated CPUFreq NVMEM support
authorRobert Marko <robimarko@gmail.com>
Wed, 7 Jun 2023 11:16:32 +0000 (13:16 +0200)
committerRobert Marko <robimarko@gmail.com>
Wed, 7 Jun 2023 11:16:32 +0000 (13:16 +0200)
Most of the CPUFreq NVMEM patches have been upstreamed in an improved way.
IPQ8074 support itself is being reviewed upstream currently.

Upstreamed patches have been moved to generic backports so that ipq806x can
use them as well, so lets just use the latest version of IPQ8074 support
that is being reviewed upstream.

Runtime tested on Qnap 301W (IPQ8072A) and Xiaomi AX3600 (IPQ8071A).

Signed-off-by: Robert Marko <robimarko@gmail.com>
target/linux/ipq807x/patches-6.1/0125-cpufreq-qcom-nvmem-reuse-socinfo-SMEM-item-struct.patch [deleted file]
target/linux/ipq807x/patches-6.1/0128-cpufreq-qcom-nvmem-add-support-for-IPQ8074.patch

diff --git a/target/linux/ipq807x/patches-6.1/0125-cpufreq-qcom-nvmem-reuse-socinfo-SMEM-item-struct.patch b/target/linux/ipq807x/patches-6.1/0125-cpufreq-qcom-nvmem-reuse-socinfo-SMEM-item-struct.patch
deleted file mode 100644 (file)
index 5776614..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-From b7b7ea3a0cab42d4f1d4c9ae9eb7c7a3d03e7982 Mon Sep 17 00:00:00 2001
-From: Robert Marko <robimarko@gmail.com>
-Date: Fri, 30 Dec 2022 22:51:47 +0100
-Subject: [PATCH] cpufreq: qcom-nvmem: reuse socinfo SMEM item struct
-
-Now that socinfo SMEM item struct and defines have been moved to a header
-so we can utilize that instead.
-
-Now the SMEM value can be accesed directly, there is no need for defining
-the ID for the SMEM request as well.
-
-Signed-off-by: Robert Marko <robimarko@gmail.com>
----
- drivers/cpufreq/qcom-cpufreq-nvmem.c | 14 +++++---------
- 1 file changed, 5 insertions(+), 9 deletions(-)
-
---- a/drivers/cpufreq/qcom-cpufreq-nvmem.c
-+++ b/drivers/cpufreq/qcom-cpufreq-nvmem.c
-@@ -28,8 +28,7 @@
- #include <linux/pm_opp.h>
- #include <linux/slab.h>
- #include <linux/soc/qcom/smem.h>
--
--#define MSM_ID_SMEM   137
-+#include <linux/soc/qcom/socinfo.h>
- enum _msm_id {
-       MSM8996V3 = 0xF6ul,
-@@ -143,17 +142,14 @@ static void get_krait_bin_format_b(struc
- static enum _msm8996_version qcom_cpufreq_get_msm_id(void)
- {
-       size_t len;
--      u32 *msm_id;
-+      struct socinfo *info;
-       enum _msm8996_version version;
--      msm_id = qcom_smem_get(QCOM_SMEM_HOST_ANY, MSM_ID_SMEM, &len);
--      if (IS_ERR(msm_id))
-+      info = qcom_smem_get(QCOM_SMEM_HOST_ANY, SMEM_HW_SW_BUILD_ID, &len);
-+      if (IS_ERR(info))
-               return NUM_OF_MSM8996_VERSIONS;
--      /* The first 4 bytes are format, next to them is the actual msm-id */
--      msm_id++;
--
--      switch ((enum _msm_id)*msm_id) {
-+      switch (info->id) {
-       case MSM8996V3:
-       case APQ8096V3:
-               version = MSM8996_V3;
index d2653e52d67f60db37e082fcdbacea1f83ced755..09abbfa2e59d69e135537779e818b71c05645ed0 100644 (file)
@@ -1,4 +1,4 @@
-From 813f2b5ad002e691b92154037f154b4444eedd54 Mon Sep 17 00:00:00 2001
+From 11592aa862e67f4477dee7e94d5c8244d893de1b Mon Sep 17 00:00:00 2001
 From: Robert Marko <robimarko@gmail.com>
 Date: Sat, 31 Dec 2022 13:03:41 +0100
 Subject: [PATCH] cpufreq: qcom-nvmem: add support for IPQ8074
@@ -14,10 +14,14 @@ IPQ8074 compatible is blacklisted from DT platdev as the cpufreq device
 will get created by NVMEM CPUFreq driver.
 
 Signed-off-by: Robert Marko <robimarko@gmail.com>
+---
+Changes in v2:
+* Print an error if SMEM ID is not part of the IPQ8074 family
+and restrict the speed to Acorn variant (1.4GHz)
 ---
  drivers/cpufreq/cpufreq-dt-platdev.c |  1 +
- drivers/cpufreq/qcom-cpufreq-nvmem.c | 39 ++++++++++++++++++++++++++++
- 2 files changed, 40 insertions(+)
+ drivers/cpufreq/qcom-cpufreq-nvmem.c | 43 ++++++++++++++++++++++++++++
+ 2 files changed, 44 insertions(+)
 
 --- a/drivers/cpufreq/cpufreq-dt-platdev.c
 +++ b/drivers/cpufreq/cpufreq-dt-platdev.c
@@ -31,7 +35,7 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
        { .compatible = "qcom,msm8960", },
 --- a/drivers/cpufreq/qcom-cpufreq-nvmem.c
 +++ b/drivers/cpufreq/qcom-cpufreq-nvmem.c
-@@ -32,6 +32,9 @@
+@@ -31,6 +31,9 @@
  
  #include <dt-bindings/arm/qcom,ids.h>
  
@@ -41,7 +45,7 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
  struct qcom_cpufreq_drv;
  
  struct qcom_cpufreq_match_data {
-@@ -216,6 +219,37 @@ len_error:
+@@ -204,6 +207,41 @@ len_error:
        return ret;
  }
  
@@ -50,12 +54,13 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
 +                                           char **pvs_name,
 +                                           struct qcom_cpufreq_drv *drv)
 +{
-+      int msm_id;
++      u32 msm_id;
++      int ret;
 +      *pvs_name = NULL;
 +
-+      msm_id = qcom_cpufreq_get_msm_id();
-+      if (msm_id < 0)
-+              return msm_id;
++      ret = qcom_smem_get_soc_id(&msm_id);
++      if (ret)
++              return ret;
 +
 +      switch (msm_id) {
 +      case QCOM_ID_IPQ8070A:
@@ -69,7 +74,10 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
 +              drv->versions = IPQ8074_HAWKEYE_VERSION;
 +              break;
 +      default:
-+              BUG();
++              dev_err(cpu_dev,
++                      "SoC ID %u is not part of IPQ8074 family, limiting to 1.4GHz!\n",
++                      msm_id);
++              drv->versions = IPQ8074_ACORN_VERSION;
 +              break;
 +      }
 +
@@ -79,7 +87,7 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
  static const struct qcom_cpufreq_match_data match_data_kryo = {
        .get_version = qcom_cpufreq_kryo_name_version,
  };
-@@ -230,6 +264,10 @@ static const struct qcom_cpufreq_match_d
+@@ -218,6 +256,10 @@ static const struct qcom_cpufreq_match_d
        .genpd_names = qcs404_genpd_names,
  };
  
@@ -90,7 +98,7 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
  static int qcom_cpufreq_probe(struct platform_device *pdev)
  {
        struct qcom_cpufreq_drv *drv;
-@@ -375,6 +413,7 @@ static const struct of_device_id qcom_cp
+@@ -363,6 +405,7 @@ static const struct of_device_id qcom_cp
        { .compatible = "qcom,msm8996", .data = &match_data_kryo },
        { .compatible = "qcom,qcs404", .data = &match_data_qcs404 },
        { .compatible = "qcom,ipq8064", .data = &match_data_krait },