aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ipq807x
diff options
context:
space:
mode:
authorRobert Marko <robimarko@gmail.com>2023-06-07 13:12:26 +0200
committerRobert Marko <robimarko@gmail.com>2023-06-07 13:16:13 +0200
commitd442790bbffa019cd68dd84c180bcb8d3f185097 (patch)
treeba62a1e002e805e0d683869e18e2886315926700 /target/linux/ipq807x
parent598e058080b990cf59ff84d3d50b639f44f11614 (diff)
downloadupstream-d442790bbffa019cd68dd84c180bcb8d3f185097.tar.gz
upstream-d442790bbffa019cd68dd84c180bcb8d3f185097.tar.bz2
upstream-d442790bbffa019cd68dd84c180bcb8d3f185097.zip
generic: 6.1: backport Qualcomm CPUFreq NVMEM changes
Currently, IPQ807x is using CPUFreq NVMEM for dealing with different SoC SKU-s having different frequency limits, and we are keeping the patches for it in ipq807x target. However, we managed to upstream a big cleanup of the driver in order to make it possible for other SMEM based targets to be added to CPUFreq NVMEM. IPQ806x will be using CPUFreq NVMEM and depends on these changes as well, so lets put them in generic backport to avoid code duplication. This replaces the older patches in ipq807x. Signed-off-by: Robert Marko <robimarko@gmail.com>
Diffstat (limited to 'target/linux/ipq807x')
-rw-r--r--target/linux/ipq807x/patches-6.1/0124-soc-qcom-socinfo-move-SMEM-item-struct-and-defines-t.patch168
-rw-r--r--target/linux/ipq807x/patches-6.1/0126-cpufreq-qcom-nvmem-use-SoC-ID-s-from-bindings.patch46
-rw-r--r--target/linux/ipq807x/patches-6.1/0127-cpufreq-qcom-nvmem-make-qcom_cpufreq_get_msm_id-retu.patch106
3 files changed, 0 insertions, 320 deletions
diff --git a/target/linux/ipq807x/patches-6.1/0124-soc-qcom-socinfo-move-SMEM-item-struct-and-defines-t.patch b/target/linux/ipq807x/patches-6.1/0124-soc-qcom-socinfo-move-SMEM-item-struct-and-defines-t.patch
deleted file mode 100644
index 4a744490cfe..00000000000
--- a/target/linux/ipq807x/patches-6.1/0124-soc-qcom-socinfo-move-SMEM-item-struct-and-defines-t.patch
+++ /dev/null
@@ -1,168 +0,0 @@
-From 97505f4c049fa2e8c86a53411a9e599033898533 Mon Sep 17 00:00:00 2001
-From: Robert Marko <robimarko@gmail.com>
-Date: Sat, 31 Dec 2022 00:27:42 +0100
-Subject: [PATCH] soc: qcom: socinfo: move SMEM item struct and defines to a
- header
-
-Move SMEM item struct and related defines to a header in order to be able
-to reuse them in the Qualcomm NVMEM CPUFreq driver instead of duplicating
-them.
-
-Signed-off-by: Robert Marko <robimarko@gmail.com>
----
- drivers/soc/qcom/socinfo.c | 58 +--------------------------
- include/linux/soc/qcom/socinfo.h | 67 ++++++++++++++++++++++++++++++++
- 2 files changed, 68 insertions(+), 57 deletions(-)
- create mode 100644 include/linux/soc/qcom/socinfo.h
-
---- a/drivers/soc/qcom/socinfo.c
-+++ b/drivers/soc/qcom/socinfo.c
-@@ -11,6 +11,7 @@
- #include <linux/random.h>
- #include <linux/slab.h>
- #include <linux/soc/qcom/smem.h>
-+#include <linux/soc/qcom/socinfo.h>
- #include <linux/string.h>
- #include <linux/sys_soc.h>
- #include <linux/types.h>
-@@ -25,15 +26,6 @@
- #define SOCINFO_MINOR(ver) ((ver) & 0xffff)
- #define SOCINFO_VERSION(maj, min) ((((maj) & 0xffff) << 16)|((min) & 0xffff))
-
--#define SMEM_SOCINFO_BUILD_ID_LENGTH 32
--#define SMEM_SOCINFO_CHIP_ID_LENGTH 32
--
--/*
-- * SMEM item id, used to acquire handles to respective
-- * SMEM region.
-- */
--#define SMEM_HW_SW_BUILD_ID 137
--
- #ifdef CONFIG_DEBUG_FS
- #define SMEM_IMAGE_VERSION_BLOCKS_COUNT 32
- #define SMEM_IMAGE_VERSION_SIZE 4096
-@@ -116,54 +108,6 @@ static const char *const pmic_models[] =
- };
- #endif /* CONFIG_DEBUG_FS */
-
--/* Socinfo SMEM item structure */
--struct socinfo {
-- __le32 fmt;
-- __le32 id;
-- __le32 ver;
-- char build_id[SMEM_SOCINFO_BUILD_ID_LENGTH];
-- /* Version 2 */
-- __le32 raw_id;
-- __le32 raw_ver;
-- /* Version 3 */
-- __le32 hw_plat;
-- /* Version 4 */
-- __le32 plat_ver;
-- /* Version 5 */
-- __le32 accessory_chip;
-- /* Version 6 */
-- __le32 hw_plat_subtype;
-- /* Version 7 */
-- __le32 pmic_model;
-- __le32 pmic_die_rev;
-- /* Version 8 */
-- __le32 pmic_model_1;
-- __le32 pmic_die_rev_1;
-- __le32 pmic_model_2;
-- __le32 pmic_die_rev_2;
-- /* Version 9 */
-- __le32 foundry_id;
-- /* Version 10 */
-- __le32 serial_num;
-- /* Version 11 */
-- __le32 num_pmics;
-- __le32 pmic_array_offset;
-- /* Version 12 */
-- __le32 chip_family;
-- __le32 raw_device_family;
-- __le32 raw_device_num;
-- /* Version 13 */
-- __le32 nproduct_id;
-- char chip_id[SMEM_SOCINFO_CHIP_ID_LENGTH];
-- /* Version 14 */
-- __le32 num_clusters;
-- __le32 ncluster_array_offset;
-- __le32 num_defective_parts;
-- __le32 ndefective_parts_array_offset;
-- /* Version 15 */
-- __le32 nmodem_supported;
--};
--
- #ifdef CONFIG_DEBUG_FS
- struct socinfo_params {
- u32 raw_device_family;
---- /dev/null
-+++ b/include/linux/soc/qcom/socinfo.h
-@@ -0,0 +1,67 @@
-+// SPDX-License-Identifier: GPL-2.0
-+/*
-+ * Copyright (c) 2009-2017, The Linux Foundation. All rights reserved.
-+ * Copyright (c) 2017-2019, Linaro Ltd.
-+ */
-+
-+#ifndef __QCOM_SOCINFO_H__
-+#define __QCOM_SOCINFO_H__
-+
-+/*
-+ * SMEM item id, used to acquire handles to respective
-+ * SMEM region.
-+ */
-+#define SMEM_HW_SW_BUILD_ID 137
-+
-+#define SMEM_SOCINFO_BUILD_ID_LENGTH 32
-+#define SMEM_SOCINFO_CHIP_ID_LENGTH 32
-+
-+/* Socinfo SMEM item structure */
-+struct socinfo {
-+ __le32 fmt;
-+ __le32 id;
-+ __le32 ver;
-+ char build_id[SMEM_SOCINFO_BUILD_ID_LENGTH];
-+ /* Version 2 */
-+ __le32 raw_id;
-+ __le32 raw_ver;
-+ /* Version 3 */
-+ __le32 hw_plat;
-+ /* Version 4 */
-+ __le32 plat_ver;
-+ /* Version 5 */
-+ __le32 accessory_chip;
-+ /* Version 6 */
-+ __le32 hw_plat_subtype;
-+ /* Version 7 */
-+ __le32 pmic_model;
-+ __le32 pmic_die_rev;
-+ /* Version 8 */
-+ __le32 pmic_model_1;
-+ __le32 pmic_die_rev_1;
-+ __le32 pmic_model_2;
-+ __le32 pmic_die_rev_2;
-+ /* Version 9 */
-+ __le32 foundry_id;
-+ /* Version 10 */
-+ __le32 serial_num;
-+ /* Version 11 */
-+ __le32 num_pmics;
-+ __le32 pmic_array_offset;
-+ /* Version 12 */
-+ __le32 chip_family;
-+ __le32 raw_device_family;
-+ __le32 raw_device_num;
-+ /* Version 13 */
-+ __le32 nproduct_id;
-+ char chip_id[SMEM_SOCINFO_CHIP_ID_LENGTH];
-+ /* Version 14 */
-+ __le32 num_clusters;
-+ __le32 ncluster_array_offset;
-+ __le32 num_defective_parts;
-+ __le32 ndefective_parts_array_offset;
-+ /* Version 15 */
-+ __le32 nmodem_supported;
-+};
-+
-+#endif
diff --git a/target/linux/ipq807x/patches-6.1/0126-cpufreq-qcom-nvmem-use-SoC-ID-s-from-bindings.patch b/target/linux/ipq807x/patches-6.1/0126-cpufreq-qcom-nvmem-use-SoC-ID-s-from-bindings.patch
deleted file mode 100644
index bdac41a0281..00000000000
--- a/target/linux/ipq807x/patches-6.1/0126-cpufreq-qcom-nvmem-use-SoC-ID-s-from-bindings.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-From 132b2f15b8ae3f848b3e6f2962f409cfab0ca759 Mon Sep 17 00:00:00 2001
-From: Robert Marko <robimarko@gmail.com>
-Date: Fri, 30 Dec 2022 23:33:47 +0100
-Subject: [PATCH] cpufreq: qcom-nvmem: use SoC ID-s from bindings
-
-SMEM SoC ID-s are now stored in DT bindings so lets use those instead of
-defining them in the driver again.
-
-Signed-off-by: Robert Marko <robimarko@gmail.com>
----
- drivers/cpufreq/qcom-cpufreq-nvmem.c | 15 +++++----------
- 1 file changed, 5 insertions(+), 10 deletions(-)
-
---- a/drivers/cpufreq/qcom-cpufreq-nvmem.c
-+++ b/drivers/cpufreq/qcom-cpufreq-nvmem.c
-@@ -30,12 +30,7 @@
- #include <linux/soc/qcom/smem.h>
- #include <linux/soc/qcom/socinfo.h>
-
--enum _msm_id {
-- MSM8996V3 = 0xF6ul,
-- APQ8096V3 = 0x123ul,
-- MSM8996SG = 0x131ul,
-- APQ8096SG = 0x138ul,
--};
-+#include <dt-bindings/arm/qcom,ids.h>
-
- enum _msm8996_version {
- MSM8996_V3,
-@@ -150,12 +145,12 @@ static enum _msm8996_version qcom_cpufre
- return NUM_OF_MSM8996_VERSIONS;
-
- switch (info->id) {
-- case MSM8996V3:
-- case APQ8096V3:
-+ case QCOM_ID_MSM8996:
-+ case QCOM_ID_APQ8096:
- version = MSM8996_V3;
- break;
-- case MSM8996SG:
-- case APQ8096SG:
-+ case QCOM_ID_MSM8996SG:
-+ case QCOM_ID_APQ8096SG:
- version = MSM8996_SG;
- break;
- default:
diff --git a/target/linux/ipq807x/patches-6.1/0127-cpufreq-qcom-nvmem-make-qcom_cpufreq_get_msm_id-retu.patch b/target/linux/ipq807x/patches-6.1/0127-cpufreq-qcom-nvmem-make-qcom_cpufreq_get_msm_id-retu.patch
deleted file mode 100644
index 0a33c5c66d9..00000000000
--- a/target/linux/ipq807x/patches-6.1/0127-cpufreq-qcom-nvmem-make-qcom_cpufreq_get_msm_id-retu.patch
+++ /dev/null
@@ -1,106 +0,0 @@
-From 85bf71b130ab0e939f53ec9cf1131d67d148bc9a Mon Sep 17 00:00:00 2001
-From: Robert Marko <robimarko@gmail.com>
-Date: Sat, 31 Dec 2022 12:45:31 +0100
-Subject: [PATCH] cpufreq: qcom-nvmem: make qcom_cpufreq_get_msm_id() return
- the SoC ID
-
-Currently, qcom_cpufreq_get_msm_id() does not simply return the SoC ID
-after getting it via SMEM call but instead uses an enum to encode the
-matched SMEM ID to 2 variants of MSM8996 which are then used in
-qcom_cpufreq_kryo_name_version() to set the supported version.
-
-This prevents qcom_cpufreq_get_msm_id() from being universal and its doing
-more than its name suggests, so lets make it just return the SoC ID
-directly which allows matching directly on the SoC ID and removes the need
-for msm8996_version enum which simplifies the driver.
-It also allows reusing the qcom_cpufreq_get_msm_id() for new SoC-s.
-
-Signed-off-by: Robert Marko <robimarko@gmail.com>
----
- drivers/cpufreq/qcom-cpufreq-nvmem.c | 44 ++++++++--------------------
- 1 file changed, 12 insertions(+), 32 deletions(-)
-
---- a/drivers/cpufreq/qcom-cpufreq-nvmem.c
-+++ b/drivers/cpufreq/qcom-cpufreq-nvmem.c
-@@ -32,12 +32,6 @@
-
- #include <dt-bindings/arm/qcom,ids.h>
-
--enum _msm8996_version {
-- MSM8996_V3,
-- MSM8996_SG,
-- NUM_OF_MSM8996_VERSIONS,
--};
--
- struct qcom_cpufreq_drv;
-
- struct qcom_cpufreq_match_data {
-@@ -134,30 +128,16 @@ static void get_krait_bin_format_b(struc
- dev_dbg(cpu_dev, "PVS version: %d\n", *pvs_ver);
- }
-
--static enum _msm8996_version qcom_cpufreq_get_msm_id(void)
-+static int qcom_cpufreq_get_msm_id(void)
- {
- size_t len;
- struct socinfo *info;
-- enum _msm8996_version version;
-
- info = qcom_smem_get(QCOM_SMEM_HOST_ANY, SMEM_HW_SW_BUILD_ID, &len);
- if (IS_ERR(info))
-- return NUM_OF_MSM8996_VERSIONS;
--
-- switch (info->id) {
-- case QCOM_ID_MSM8996:
-- case QCOM_ID_APQ8096:
-- version = MSM8996_V3;
-- break;
-- case QCOM_ID_MSM8996SG:
-- case QCOM_ID_APQ8096SG:
-- version = MSM8996_SG;
-- break;
-- default:
-- version = NUM_OF_MSM8996_VERSIONS;
-- }
-+ return PTR_ERR(info);
-
-- return version;
-+ return info->id;
- }
-
- static int qcom_cpufreq_kryo_name_version(struct device *cpu_dev,
-@@ -166,25 +146,25 @@ static int qcom_cpufreq_kryo_name_versio
- struct qcom_cpufreq_drv *drv)
- {
- size_t len;
-+ int msm_id;
- u8 *speedbin;
-- enum _msm8996_version msm8996_version;
- *pvs_name = NULL;
-
-- msm8996_version = qcom_cpufreq_get_msm_id();
-- if (NUM_OF_MSM8996_VERSIONS == msm8996_version) {
-- dev_err(cpu_dev, "Not Snapdragon 820/821!");
-- return -ENODEV;
-- }
-+ msm_id = qcom_cpufreq_get_msm_id();
-+ if (msm_id < 0)
-+ return msm_id;
-
- speedbin = nvmem_cell_read(speedbin_nvmem, &len);
- if (IS_ERR(speedbin))
- return PTR_ERR(speedbin);
-
-- switch (msm8996_version) {
-- case MSM8996_V3:
-+ switch (msm_id) {
-+ case QCOM_ID_MSM8996:
-+ case QCOM_ID_APQ8096:
- drv->versions = 1 << (unsigned int)(*speedbin);
- break;
-- case MSM8996_SG:
-+ case QCOM_ID_MSM8996SG:
-+ case QCOM_ID_APQ8096SG:
- drv->versions = 1 << ((unsigned int)(*speedbin) + 4);
- break;
- default: