devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] dt-bindings: cpufreq: qcom-cpufreq-nvmem: document IPQ8074
@ 2023-05-27  9:52 Robert Marko
  2023-05-27  9:52 ` [PATCH 2/2] cpufreq: qcom-nvmem: add support for IPQ8074 Robert Marko
  2023-05-27 10:30 ` [PATCH 1/2] dt-bindings: cpufreq: qcom-cpufreq-nvmem: document IPQ8074 Conor Dooley
  0 siblings, 2 replies; 5+ messages in thread
From: Robert Marko @ 2023-05-27  9:52 UTC (permalink / raw)
  To: ilia.lin, agross, andersson, konrad.dybcio, rafael, viresh.kumar,
	robh+dt, krzysztof.kozlowski+dt, conor+dt, linux-pm,
	linux-arm-msm, devicetree, linux-kernel
  Cc: ansuelsmth, Robert Marko

Document IPQ8074 compatible for Qcom NVMEM CPUFreq driver.

Signed-off-by: Robert Marko <robimarko@gmail.com>
---
 .../devicetree/bindings/cpufreq/qcom-cpufreq-nvmem.yaml          | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/cpufreq/qcom-cpufreq-nvmem.yaml b/Documentation/devicetree/bindings/cpufreq/qcom-cpufreq-nvmem.yaml
index 6f5e7904181f..7e1bb992ce90 100644
--- a/Documentation/devicetree/bindings/cpufreq/qcom-cpufreq-nvmem.yaml
+++ b/Documentation/devicetree/bindings/cpufreq/qcom-cpufreq-nvmem.yaml
@@ -28,6 +28,7 @@ select:
           - qcom,apq8064
           - qcom,apq8096
           - qcom,ipq8064
+          - qcom,ipq8074
           - qcom,msm8939
           - qcom,msm8960
           - qcom,msm8974
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] cpufreq: qcom-nvmem: add support for IPQ8074
  2023-05-27  9:52 [PATCH 1/2] dt-bindings: cpufreq: qcom-cpufreq-nvmem: document IPQ8074 Robert Marko
@ 2023-05-27  9:52 ` Robert Marko
  2023-05-27 15:56   ` Konrad Dybcio
  2023-05-27 10:30 ` [PATCH 1/2] dt-bindings: cpufreq: qcom-cpufreq-nvmem: document IPQ8074 Conor Dooley
  1 sibling, 1 reply; 5+ messages in thread
From: Robert Marko @ 2023-05-27  9:52 UTC (permalink / raw)
  To: ilia.lin, agross, andersson, konrad.dybcio, rafael, viresh.kumar,
	robh+dt, krzysztof.kozlowski+dt, conor+dt, linux-pm,
	linux-arm-msm, devicetree, linux-kernel
  Cc: ansuelsmth, Robert Marko

IPQ8074 comes in 2 families:
* IPQ8070A/IPQ8071A (Acorn) up to 1.4GHz
* IPQ8072A/IPQ8074A/IPQ8076A/IPQ8078A (Hawkeye) up to 2.2GHz

So, in order to be able to share one OPP table lets add support for IPQ8074
family based of SMEM SoC ID-s as speedbin fuse is always 0 on IPQ8074.

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>
---
 drivers/cpufreq/cpufreq-dt-platdev.c |  1 +
 drivers/cpufreq/qcom-cpufreq-nvmem.c | 40 ++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+)

diff --git a/drivers/cpufreq/cpufreq-dt-platdev.c b/drivers/cpufreq/cpufreq-dt-platdev.c
index 14aa8281c7f4..e4d6d128647d 100644
--- a/drivers/cpufreq/cpufreq-dt-platdev.c
+++ b/drivers/cpufreq/cpufreq-dt-platdev.c
@@ -169,6 +169,7 @@ static const struct of_device_id blocklist[] __initconst = {
 	{ .compatible = "ti,am625", },
 
 	{ .compatible = "qcom,ipq8064", },
+	{ .compatible = "qcom,ipq8074", },
 	{ .compatible = "qcom,apq8064", },
 	{ .compatible = "qcom,msm8974", },
 	{ .compatible = "qcom,msm8960", },
diff --git a/drivers/cpufreq/qcom-cpufreq-nvmem.c b/drivers/cpufreq/qcom-cpufreq-nvmem.c
index a88b6fe5db50..607fc0273e9c 100644
--- a/drivers/cpufreq/qcom-cpufreq-nvmem.c
+++ b/drivers/cpufreq/qcom-cpufreq-nvmem.c
@@ -31,6 +31,9 @@
 
 #include <dt-bindings/arm/qcom,ids.h>
 
+#define IPQ8074_HAWKEYE_VERSION		BIT(0)
+#define IPQ8074_ACORN_VERSION		BIT(1)
+
 struct qcom_cpufreq_drv;
 
 struct qcom_cpufreq_match_data {
@@ -204,6 +207,38 @@ static int qcom_cpufreq_krait_name_version(struct device *cpu_dev,
 	return ret;
 }
 
+static int qcom_cpufreq_ipq8074_name_version(struct device *cpu_dev,
+					     struct nvmem_cell *speedbin_nvmem,
+					     char **pvs_name,
+					     struct qcom_cpufreq_drv *drv)
+{
+	u32 msm_id;
+	int ret;
+	*pvs_name = NULL;
+
+	ret = qcom_smem_get_soc_id(&msm_id);
+	if (ret)
+		return ret;
+
+	switch (msm_id) {
+	case QCOM_ID_IPQ8070A:
+	case QCOM_ID_IPQ8071A:
+		drv->versions = IPQ8074_ACORN_VERSION;
+		break;
+	case QCOM_ID_IPQ8072A:
+	case QCOM_ID_IPQ8074A:
+	case QCOM_ID_IPQ8076A:
+	case QCOM_ID_IPQ8078A:
+		drv->versions = IPQ8074_HAWKEYE_VERSION;
+		break;
+	default:
+		BUG();
+		break;
+	}
+
+	return 0;
+}
+
 static const struct qcom_cpufreq_match_data match_data_kryo = {
 	.get_version = qcom_cpufreq_kryo_name_version,
 };
@@ -218,6 +253,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_ipq8074 = {
+	.get_version = qcom_cpufreq_ipq8074_name_version,
+};
+
 static int qcom_cpufreq_probe(struct platform_device *pdev)
 {
 	struct qcom_cpufreq_drv *drv;
@@ -363,6 +402,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,ipq8064", .data = &match_data_krait },
+	{ .compatible = "qcom,ipq8074", .data = &match_data_ipq8074 },
 	{ .compatible = "qcom,apq8064", .data = &match_data_krait },
 	{ .compatible = "qcom,msm8974", .data = &match_data_krait },
 	{ .compatible = "qcom,msm8960", .data = &match_data_krait },
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] dt-bindings: cpufreq: qcom-cpufreq-nvmem: document IPQ8074
  2023-05-27  9:52 [PATCH 1/2] dt-bindings: cpufreq: qcom-cpufreq-nvmem: document IPQ8074 Robert Marko
  2023-05-27  9:52 ` [PATCH 2/2] cpufreq: qcom-nvmem: add support for IPQ8074 Robert Marko
@ 2023-05-27 10:30 ` Conor Dooley
  2023-05-29  5:07   ` Viresh Kumar
  1 sibling, 1 reply; 5+ messages in thread
From: Conor Dooley @ 2023-05-27 10:30 UTC (permalink / raw)
  To: Robert Marko
  Cc: ilia.lin, agross, andersson, konrad.dybcio, rafael, viresh.kumar,
	robh+dt, krzysztof.kozlowski+dt, conor+dt, linux-pm,
	linux-arm-msm, devicetree, linux-kernel, ansuelsmth

[-- Attachment #1: Type: text/plain, Size: 256 bytes --]

On Sat, May 27, 2023 at 11:52:28AM +0200, Robert Marko wrote:
> Document IPQ8074 compatible for Qcom NVMEM CPUFreq driver.
> 
> Signed-off-by: Robert Marko <robimarko@gmail.com>

Acked-by: Conor Dooley <conor.dooley@microchip.com>

Thanks,
Conor.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] cpufreq: qcom-nvmem: add support for IPQ8074
  2023-05-27  9:52 ` [PATCH 2/2] cpufreq: qcom-nvmem: add support for IPQ8074 Robert Marko
@ 2023-05-27 15:56   ` Konrad Dybcio
  0 siblings, 0 replies; 5+ messages in thread
From: Konrad Dybcio @ 2023-05-27 15:56 UTC (permalink / raw)
  To: Robert Marko, ilia.lin, agross, andersson, rafael, viresh.kumar,
	robh+dt, krzysztof.kozlowski+dt, conor+dt, linux-pm,
	linux-arm-msm, devicetree, linux-kernel
  Cc: ansuelsmth



On 27.05.2023 11:52, Robert Marko wrote:
> IPQ8074 comes in 2 families:
> * IPQ8070A/IPQ8071A (Acorn) up to 1.4GHz
> * IPQ8072A/IPQ8074A/IPQ8076A/IPQ8078A (Hawkeye) up to 2.2GHz
> 
> So, in order to be able to share one OPP table lets add support for IPQ8074
> family based of SMEM SoC ID-s as speedbin fuse is always 0 on IPQ8074.
> 
> 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>
> ---
>  drivers/cpufreq/cpufreq-dt-platdev.c |  1 +
>  drivers/cpufreq/qcom-cpufreq-nvmem.c | 40 ++++++++++++++++++++++++++++
>  2 files changed, 41 insertions(+)
> 
> diff --git a/drivers/cpufreq/cpufreq-dt-platdev.c b/drivers/cpufreq/cpufreq-dt-platdev.c
> index 14aa8281c7f4..e4d6d128647d 100644
> --- a/drivers/cpufreq/cpufreq-dt-platdev.c
> +++ b/drivers/cpufreq/cpufreq-dt-platdev.c
> @@ -169,6 +169,7 @@ static const struct of_device_id blocklist[] __initconst = {
>  	{ .compatible = "ti,am625", },
>  
>  	{ .compatible = "qcom,ipq8064", },
> +	{ .compatible = "qcom,ipq8074", },
>  	{ .compatible = "qcom,apq8064", },
>  	{ .compatible = "qcom,msm8974", },
>  	{ .compatible = "qcom,msm8960", },
> diff --git a/drivers/cpufreq/qcom-cpufreq-nvmem.c b/drivers/cpufreq/qcom-cpufreq-nvmem.c
> index a88b6fe5db50..607fc0273e9c 100644
> --- a/drivers/cpufreq/qcom-cpufreq-nvmem.c
> +++ b/drivers/cpufreq/qcom-cpufreq-nvmem.c
> @@ -31,6 +31,9 @@
>  
>  #include <dt-bindings/arm/qcom,ids.h>
>  
> +#define IPQ8074_HAWKEYE_VERSION		BIT(0)
> +#define IPQ8074_ACORN_VERSION		BIT(1)
> +
>  struct qcom_cpufreq_drv;
>  
>  struct qcom_cpufreq_match_data {
> @@ -204,6 +207,38 @@ static int qcom_cpufreq_krait_name_version(struct device *cpu_dev,
>  	return ret;
>  }
>  
> +static int qcom_cpufreq_ipq8074_name_version(struct device *cpu_dev,
> +					     struct nvmem_cell *speedbin_nvmem,
> +					     char **pvs_name,
> +					     struct qcom_cpufreq_drv *drv)
> +{
> +	u32 msm_id;
> +	int ret;
> +	*pvs_name = NULL;
> +
> +	ret = qcom_smem_get_soc_id(&msm_id);
> +	if (ret)
> +		return ret;
> +
> +	switch (msm_id) {
> +	case QCOM_ID_IPQ8070A:
> +	case QCOM_ID_IPQ8071A:
> +		drv->versions = IPQ8074_ACORN_VERSION;
> +		break;
> +	case QCOM_ID_IPQ8072A:
> +	case QCOM_ID_IPQ8074A:
> +	case QCOM_ID_IPQ8076A:
> +	case QCOM_ID_IPQ8078A:
> +		drv->versions = IPQ8074_HAWKEYE_VERSION;
> +		break;
> +	default:
> +		BUG();
I'd say pr_err, or at least WARN() + setting the slowest bin would be
more desirable here, cpufreq probes early so people without uart etc.
will be unlikely to find out why their kernel dies.

Konrad
> +		break;
> +	}
> +
> +	return 0;
> +}
> +
>  static const struct qcom_cpufreq_match_data match_data_kryo = {
>  	.get_version = qcom_cpufreq_kryo_name_version,
>  };
> @@ -218,6 +253,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_ipq8074 = {
> +	.get_version = qcom_cpufreq_ipq8074_name_version,
> +};
> +
>  static int qcom_cpufreq_probe(struct platform_device *pdev)
>  {
>  	struct qcom_cpufreq_drv *drv;
> @@ -363,6 +402,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,ipq8064", .data = &match_data_krait },
> +	{ .compatible = "qcom,ipq8074", .data = &match_data_ipq8074 },
>  	{ .compatible = "qcom,apq8064", .data = &match_data_krait },
>  	{ .compatible = "qcom,msm8974", .data = &match_data_krait },
>  	{ .compatible = "qcom,msm8960", .data = &match_data_krait },

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] dt-bindings: cpufreq: qcom-cpufreq-nvmem: document IPQ8074
  2023-05-27 10:30 ` [PATCH 1/2] dt-bindings: cpufreq: qcom-cpufreq-nvmem: document IPQ8074 Conor Dooley
@ 2023-05-29  5:07   ` Viresh Kumar
  0 siblings, 0 replies; 5+ messages in thread
From: Viresh Kumar @ 2023-05-29  5:07 UTC (permalink / raw)
  To: Conor Dooley
  Cc: Robert Marko, ilia.lin, agross, andersson, konrad.dybcio, rafael,
	robh+dt, krzysztof.kozlowski+dt, conor+dt, linux-pm,
	linux-arm-msm, devicetree, linux-kernel, ansuelsmth

On 27-05-23, 11:30, Conor Dooley wrote:
> On Sat, May 27, 2023 at 11:52:28AM +0200, Robert Marko wrote:
> > Document IPQ8074 compatible for Qcom NVMEM CPUFreq driver.
> > 
> > Signed-off-by: Robert Marko <robimarko@gmail.com>
> 
> Acked-by: Conor Dooley <conor.dooley@microchip.com>

Applied. Thanks.

-- 
viresh

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-05-29  5:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-27  9:52 [PATCH 1/2] dt-bindings: cpufreq: qcom-cpufreq-nvmem: document IPQ8074 Robert Marko
2023-05-27  9:52 ` [PATCH 2/2] cpufreq: qcom-nvmem: add support for IPQ8074 Robert Marko
2023-05-27 15:56   ` Konrad Dybcio
2023-05-27 10:30 ` [PATCH 1/2] dt-bindings: cpufreq: qcom-cpufreq-nvmem: document IPQ8074 Conor Dooley
2023-05-29  5:07   ` Viresh Kumar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).