Add cpufreq driver for Tegra194
v5 cover Add cpufreq driver for Tegra194
Hi Viresh,
The patch series adds cpufreq driver for Tegra194 SOC. Incorporated the feedback on previous version of patchset. Please consider this patch series for merging in 5.9.
Hi Rob,
Can you please review/ack DT patches (1-2).
v4[4] -> v5
- Don't call destroy_workqueue() if alloc_workqueue() fails[Viresh]
- Move CONFIG_ARM_TEGRA194_CPUFREQ enabling to soc/tegra/Kconfig[Viresh]
- Add dependency of 'nvidia,bpmp' on 'compatible' in yaml file[Michal]
- Fix typo in description causing dt_binding_check bot failure[Rob]
v3[3] -> v4
- Open code LOOP_FOR_EACH_CPU_OF_CLUSTER macro[Viresh]
- Delete unused funciton map_freq_to_ndiv[Viresh, kernel test bot]
- Remove flush_workqueue from free_resources[Viresh]
v2[2] -> v3
- Set same policy for all cpus in a cluster[Viresh].
- Add compatible string for CPU Complex under cpus node[Thierry].
- Add reference to bpmp node under cpus node[Thierry].
- Bind cpufreq driver to CPU Complex compatible string[Thierry].
- Remove patch to get bpmp data as now using cpus node to get that[Thierry].
v1[1] -> v2:
- Remove cpufreq_lock mutex from tegra194_cpufreq_set_target [Viresh].
- Remove CPUFREQ_ASYNC_NOTIFICATION flag [Viresh].
- Remove redundant _begin|end() call from tegra194_cpufreq_set_target.
- Rename opp_table to freq_table [Viresh].
Sumit Gupta (4):
dt-bindings: arm: Add t194 ccplex compatible and bpmp property
arm64: tegra: Add t194 ccplex compatible and bpmp property
cpufreq: Add Tegra194 cpufreq driver
soc/tegra: cpufreq: select cpufreq for Tegra194
Documentation/devicetree/bindings/arm/cpus.yaml | 11 + arch/arm64/boot/dts/nvidia/tegra194.dtsi | 2 + drivers/cpufreq/Kconfig.arm | 6 + drivers/cpufreq/Makefile | 1 + drivers/cpufreq/tegra194-cpufreq.c | 397 ++++++++++++++++++++++++ drivers/soc/tegra/Kconfig | 1 + 6 files changed, 418 insertions(+) create mode 100644 drivers/cpufreq/tegra194-cpufreq.c
[1] https://marc.info/?t=157539452300001&r=1&w=2
[2] https://marc.info/?l=linux-tegra&m=158602857106213&w=2
[3] https://marc.info/?l=linux-pm&m=159283376010084&w=2
[4] https://marc.info/?l=linux-tegra&m=159318640622917&w=2
Signature · 1 line
2.7.4
PATCH v5 1/4 dt-bindings: arm: Add t194 ccplex compatible and bpmp property
To do frequency scaling on all CPUs within T194 CPU Complex, we need to query BPMP for data on valid operating points. Document a compatible string under 'cpus' node to represent the CPU Complex for binding drivers like cpufreq which don't have their node or CPU Complex node to bind to. Also, document a property to point to the BPMP device that can be queried for all CPUs.
--- Documentation/devicetree/bindings/arm/cpus.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+)
Documentation/devicetree/bindings/arm/cpus.yaml +11 -0
@@ -162,6 +162,7 @@ properties: - nvidia,tegra132-denver - nvidia,tegra186-denver - nvidia,tegra194-carmel + - nvidia,tegra194-ccplex - qcom,krait - qcom,kryo - qcom,kryo260
@@ -255,6 +256,15 @@ properties: where voltage is in V, frequency is in MHz. + nvidia,bpmp: + $ref: '/schemas/types.yaml#/definitions/phandle' + description: | + Specifies the bpmp node that needs to be queried to get + operating point data for all CPUs. + + Optional for systems that have a "compatible" + property value of "nvidia,tegra194-ccplex". + power-domains: $ref: '/schemas/types.yaml#/definitions/phandle-array' description:
@@ -340,6 +350,7 @@ required: dependencies: rockchip,pmu: [enable-method] + nvidia,bpmp: [compatible] examples: - |
Signature · 1 line
2.7.4
Rob Herring
maintainerRe: [TEGRA194_CPUFREQ PATCH v5 1/4] dt-bindings: arm: Add t194 ccplex compatible and bpmp property
Quoted 6 lines · Sumit Gupta
To do frequency scaling on all CPUs within T194 CPU Complex, we need to query BPMP for data on valid operating points. Document a compatible string under 'cpus' node to represent the CPU Complex for binding drivers like cpufreq which don't have their node or CPU Complex node to bind to. Also, document a property to point to the BPMP device that can be queried for all CPUs.
The cpus.yaml binding documents what's in 'cpu' nodes, not 'cpus' node. AIUI, the latter is what you want. You should do your own schema file here.
Quoted 11 lines
Signed-off-by Sumit Gupta <[email protected]>--- Documentation/devicetree/bindings/arm/cpus.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+)Documentation/devicetree/bindings/arm/cpus.yaml +0
-0
Documentation/devicetree/bindings/arm/cpus.yaml properties: · line 165
Quoted 4 lines
Documentation/devicetree/bindings/arm/cpus.yaml +1
-0@@ -162,6 +162,7 @@ properties: - nvidia,tegra132-denver - nvidia,tegra186-denver - nvidia,tegra194-carmel + - nvidia,tegra194-ccplex
Tegra194 has 2 different CPUs?
Quoted 30 lines
Documentation/devicetree/bindings/arm/cpus.yaml +10
-0- qcom,krait - qcom,kryo - qcom,kryo260@@ -255,6 +256,15 @@ properties: where voltage is in V, frequency is in MHz. + nvidia,bpmp: + $ref: '/schemas/types.yaml#/definitions/phandle' + description: | + Specifies the bpmp node that needs to be queried to get + operating point data for all CPUs. + + Optional for systems that have a "compatible" + property value of "nvidia,tegra194-ccplex". + power-domains: $ref: '/schemas/types.yaml#/definitions/phandle-array' description:@@ -340,6 +350,7 @@ required: dependencies: rockchip,pmu: [enable-method] + nvidia,bpmp: [compatible] examples: - |Signature · 1 line
2.7.4
Re: [TEGRA194_CPUFREQ PATCH v5 1/4] dt-bindings: arm: Add t194 ccplex compatible and bpmp property
Quoted 10 lines · Sumit Gupta
Quoted 6 lines
To do frequency scaling on all CPUs within T194 CPU Complex, we need to query BPMP for data on valid operating points. Document a compatible string under 'cpus' node to represent the CPU Complex for binding drivers like cpufreq which don't have their node or CPU Complex node to bind to. Also, document a property to point to the BPMP device that can be queried for all CPUs.
Quoted 4 lines
The
cpus.yamlbinding documents what's in 'cpu' nodes, not 'cpus' node. AIUI, the latter is what you want. You should do your own schema file here.
Do you mean to change existing file name from 'cpus.yaml' to 'cpu.yaml' and create new 'cpus.yaml' file?
I think it's better to incorporate the change in existing 'cpus.yaml' file to keep both cpu@X and cpus node details together. Please suggest.
Quoted 6 lines
Quoted 6 lines
Signed-off-by Sumit Gupta <[email protected]>--- Documentation/devicetree/bindings/arm/cpus.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+)
Quoted 12 lines
Documentation/devicetree/bindings/arm/cpus.yaml properties: · line 165
Quoted 9 lines
Documentation/devicetree/bindings/arm/cpus.yaml +1
-0@@ -162,6 +162,7 @@ properties: - nvidia,tegra132-denver - nvidia,tegra186-denver - nvidia,tegra194-carmel + - nvidia,tegra194-ccplexTegra194 has 2 different CPUs?
No, T194 SOC has homogeneous architecture with four clusters where each cluster has two symmetric cores. 'nvidia,tegra194-carmel' compatible string represents each cpu. 'nvidia,tegra194-ccplex' string represents the CPU Complex to bind cpufreq driver. The change was done as per discussion [1]
Quoted 25 lines
Quoted 25 lines
Documentation/devicetree/bindings/arm/cpus.yaml +10
-0- qcom,krait - qcom,kryo - qcom,kryo260@@ -255,6 +256,15 @@ properties: where voltage is in V, frequency is in MHz. + nvidia,bpmp: + $ref: '/schemas/types.yaml#/definitions/phandle' + description: | + Specifies the bpmp node that needs to be queried to get + operating point data for all CPUs. + + Optional for systems that have a "compatible" + property value of "nvidia,tegra194-ccplex". + power-domains: $ref: '/schemas/types.yaml#/definitions/phandle-array' description:@@ -340,6 +350,7 @@ required: dependencies: rockchip,pmu: [enable-method] + nvidia,bpmp: [compatible]
Quoted 5 lines
Quoted 5 lines
Documentation/devicetree/bindings/arm/cpus.yaml +0
-1examples: - | --2.7.4
[1] https://marc.info/?l=linux-arm-kernel&m=158999171528418&w=2
Rob Herring
maintainerRe: [TEGRA194_CPUFREQ PATCH v5 1/4] dt-bindings: arm: Add t194 ccplex compatible and bpmp property
Quoted 11 lines · Sumit Gupta
Quoted 11 lines · Sumit Gupta
Quoted 6 lines
To do frequency scaling on all CPUs within T194 CPU Complex, we need to query BPMP for data on valid operating points. Document a compatible string under 'cpus' node to represent the CPU Complex for binding drivers like cpufreq which don't have their node or CPU Complex node to bind to. Also, document a property to point to the BPMP device that can be queried for all CPUs.
Quoted 8 lines
Quoted 4 lines
The
cpus.yamlbinding documents what's in 'cpu' nodes, not 'cpus' node. AIUI, the latter is what you want. You should do your own schema file here.Do you mean to change existing file name from '
cpus.yaml' to 'cpu.yaml' and create new 'cpus.yaml' file?
I think it's better to incorporate the change in existing 'cpus.yaml' file to keep both cpu@X and cpus node details together. Please suggest.
No, I'm suggesting you create nvidia,tegra194-ccplex.yaml.
Quoted 17 lines
Quoted 5 lines
Quoted 5 lines
Signed-off-by Sumit Gupta <[email protected]>--- Documentation/devicetree/bindings/arm/cpus.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+)Quoted 12 lines
Documentation/devicetree/bindings/arm/cpus.yaml properties: · line 165
Quoted 9 lines
Documentation/devicetree/bindings/arm/cpus.yaml +1
-0@@ -162,6 +162,7 @@ properties: - nvidia,tegra132-denver - nvidia,tegra186-denver - nvidia,tegra194-carmel + - nvidia,tegra194-ccplexTegra194 has 2 different CPUs?
Quoted 5 lines
No, T194 SOC has homogeneous architecture with four clusters where each cluster has two symmetric cores. 'nvidia,tegra194-carmel' compatible string represents each cpu. 'nvidia,tegra194-ccplex' string represents the CPU Complex to bind cpufreq driver. The change was done as per discussion [1]
You are adding the compatible string to the cpu@N node compatible.
Quoted 33 lines
Quoted 26 lines
Quoted 26 lines
Documentation/devicetree/bindings/arm/cpus.yaml +10
-0- qcom,krait - qcom,kryo - qcom,kryo260@@ -255,6 +256,15 @@ properties: where voltage is in V, frequency is in MHz. + nvidia,bpmp: + $ref: '/schemas/types.yaml#/definitions/phandle' + description: | + Specifies the bpmp node that needs to be queried to get + operating point data for all CPUs. + + Optional for systems that have a "compatible" + property value of "nvidia,tegra194-ccplex". + power-domains: $ref: '/schemas/types.yaml#/definitions/phandle-array' description:@@ -340,6 +350,7 @@ required: dependencies: rockchip,pmu: [enable-method] + nvidia,bpmp: [compatible]Quoted 5 lines
Quoted 5 lines
Documentation/devicetree/bindings/arm/cpus.yaml +0
-1examples: - | --2.7.4
[1] https://marc.info/?l=linux-arm-kernel&m=158999171528418&w=2
PATCH v6 1/4 dt-bindings: arm: Add NVIDIA Tegra194 CPU Complex binding
Add device-tree binding documentation to represent Tegra194 CPU Complex with compatible string under 'cpus' node. This can be used by drivers like cpufreq which don't have their node or CPU Complex node to bind to. Also, documenting 'nvidia,bpmp' property which points to BPMP device.
--- .../bindings/arm/nvidia,tegra194-ccplex.yaml | 106 +++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 Documentation/devicetree/bindings/arm/nvidia,tegra194-ccplex.yaml
Documentation/devicetree/bindings/arm/nvidia,tegra194-ccplex.yaml new file +106 -0
@@ -0,0 +1,106 @@ +# SPDX-License-Identifier: GPL-2.0 +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/arm/nvidia,tegra194-ccplex.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: NVIDIA Tegra194 CPU Complex device tree bindings + +maintainers: + - Thierry Reding <[email protected]> + - Jonathan Hunter <[email protected]> + - Sumit Gupta <[email protected]> + +description: |+ + Tegra194 SOC has homogeneous architecture where each cluster has two + symmetric cores. Compatible string in "cpus" node represents the CPU + Complex having all clusters. + +properties: + compatible: + enum: + - nvidia,tegra194-ccplex + + nvidia,bpmp: + $ref: '/schemas/types.yaml#/definitions/phandle' + description: | + Specifies the bpmp node that needs to be queried to get + operating point data for all CPUs. + + Optional for systems that have a "compatible" + property value of "nvidia,tegra194-ccplex". + + "#address-cells": + const: 1 + + "#size-cells": + const: 0 + +dependencies: + nvidia,bpmp: [compatible] + +examples: + - | + cpus { + compatible = "nvidia,tegra194-ccplex"; + nvidia,bpmp = <&bpmp>; + #address-cells = <1>; + #size-cells = <0>; + + cpu0_0: cpu@0 { + compatible = "nvidia,tegra194-carmel"; + device_type = "cpu"; + reg = <0x0>; + enable-method = "psci"; + }; + + cpu0_1: cpu@1 { + compatible = "nvidia,tegra194-carmel"; + device_type = "cpu"; + reg = <0x001>; + enable-method = "psci"; + }; + + cpu1_0: cpu@100 { + compatible = "nvidia,tegra194-carmel"; + device_type = "cpu"; + reg = <0x100>; + enable-method = "psci"; + }; + + cpu1_1: cpu@101 { + compatible = "nvidia,tegra194-carmel"; + device_type = "cpu"; + reg = <0x101>; + enable-method = "psci"; + }; + + cpu2_0: cpu@200 { + compatible = "nvidia,tegra194-carmel"; + device_type = "cpu"; + reg = <0x200>; + enable-method = "psci"; + }; + + cpu2_1: cpu@201 { + compatible = "nvidia,tegra194-carmel"; + device_type = "cpu"; + reg = <0x201>; + enable-method = "psci"; + }; + + cpu3_0: cpu@300 { + compatible = "nvidia,tegra194-carmel"; + device_type = "cpu"; + reg = <0x300>; + enable-method = "psci"; + }; + + cpu3_1: cpu@301 { + compatible = "nvidia,tegra194-carmel"; + device_type = "cpu"; + reg = <0x301>; + enable-method = "psci"; + }; + }; +...
Signature · 1 line
2.7.4
Rob Herring
maintainerRe: [TEGRA194_CPUFREQ PATCH v6 1/4] dt-bindings: arm: Add NVIDIA Tegra194 CPU Complex binding
Quoted 18 lines · Sumit Gupta
Add device-tree binding documentation to represent Tegra194 CPU Complex with compatible string under 'cpus' node. This can be used by drivers like cpufreq which don't have their node or CPU Complex node to bind to. Also, documenting 'nvidia,bpmp' property which points to BPMP device.
Signed-off-by Sumit Gupta <[email protected]>--- .../bindings/arm/nvidia,tegra194-ccplex.yaml | 106 +++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 Documentation/devicetree/bindings/arm/nvidia,tegra194-ccplex.yamlDocumentation/devicetree/bindings/arm/nvidia,tegra194-ccplex.yaml new file +0
-0
Documentation/devicetree/bindings/arm/nvidia,tegra194-ccplex.yaml line 1
Quoted 1 line
Documentation/devicetree/bindings/arm/nvidia,tegra194-ccplex.yaml new file +1
-0@@ -0,0 +1,106 @@ +# SPDX-License-Identifier: GPL-2.0
Dual license please.
Quoted 8 lines
Documentation/devicetree/bindings/arm/nvidia,tegra194-ccplex.yaml new file +8
-0+%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/arm/nvidia,tegra194-ccplex.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: NVIDIA Tegra194 CPU Complex device tree bindings + +maintainers:
Documentation/devicetree/bindings/arm/nvidia,tegra194-ccplex.yaml line 19
Quoted 10 lines
Documentation/devicetree/bindings/arm/nvidia,tegra194-ccplex.yaml new file +10
-0+ - Thierry Reding <[email protected]> + - Jonathan Hunter <[email protected]> + - Sumit Gupta <[email protected]> + +description: |+ + Tegra194 SOC has homogeneous architecture where each cluster has two + symmetric cores. Compatible string in "cpus" node represents the CPU + Complex having all clusters. + +properties:
$nodename:
const: cpus
Documentation/devicetree/bindings/arm/nvidia,tegra194-ccplex.yaml line 31
Quoted 12 lines
Documentation/devicetree/bindings/arm/nvidia,tegra194-ccplex.yaml new file +12
-0+ compatible: + enum: + - nvidia,tegra194-ccplex + + nvidia,bpmp: + $ref: '/schemas/types.yaml#/definitions/phandle' + description: | + Specifies the bpmp node that needs to be queried to get + operating point data for all CPUs. + + Optional for systems that have a "compatible" + property value of "nvidia,tegra194-ccplex".
The schema says this already.
Documentation/devicetree/bindings/arm/nvidia,tegra194-ccplex.yaml line 34
Quoted 3 lines
Documentation/devicetree/bindings/arm/nvidia,tegra194-ccplex.yaml new file +3
-0+ + "#address-cells": + const: 1
This is wrong. The binding says it's 2 cells on aarch64 cpus though we don't enforce that.
Documentation/devicetree/bindings/arm/nvidia,tegra194-ccplex.yaml line 40
Quoted 6 lines
Documentation/devicetree/bindings/arm/nvidia,tegra194-ccplex.yaml new file +6
-0+ + "#size-cells": + const: 0 + +dependencies: + nvidia,bpmp: [compatible]
This is kind of redundant as 'compatible' is required in order to apply the schema.
Quoted 54 lines
Documentation/devicetree/bindings/arm/nvidia,tegra194-ccplex.yaml new file +54
-0+ +examples: + - | + cpus { + compatible = "nvidia,tegra194-ccplex"; + nvidia,bpmp = <&bpmp>; + #address-cells = <1>; + #size-cells = <0>; + + cpu0_0: cpu@0 { + compatible = "nvidia,tegra194-carmel"; + device_type = "cpu"; + reg = <0x0>; + enable-method = "psci"; + }; + + cpu0_1: cpu@1 { + compatible = "nvidia,tegra194-carmel"; + device_type = "cpu"; + reg = <0x001>; + enable-method = "psci"; + }; + + cpu1_0: cpu@100 { + compatible = "nvidia,tegra194-carmel"; + device_type = "cpu"; + reg = <0x100>; + enable-method = "psci"; + }; + + cpu1_1: cpu@101 { + compatible = "nvidia,tegra194-carmel"; + device_type = "cpu"; + reg = <0x101>; + enable-method = "psci"; + }; + + cpu2_0: cpu@200 { + compatible = "nvidia,tegra194-carmel"; + device_type = "cpu"; + reg = <0x200>; + enable-method = "psci"; + }; + + cpu2_1: cpu@201 { + compatible = "nvidia,tegra194-carmel"; + device_type = "cpu"; + reg = <0x201>; + enable-method = "psci"; + }; + + cpu3_0: cpu@300 { + compatible = "nvidia,tegra194-carmel"; + device_type = "cpu";
Documentation/devicetree/bindings/arm/nvidia,tegra194-ccplex.yaml line 104
Quoted 10 lines
Documentation/devicetree/bindings/arm/nvidia,tegra194-ccplex.yaml new file +10
-0+ reg = <0x300>; + enable-method = "psci"; + }; + + cpu3_1: cpu@301 { + compatible = "nvidia,tegra194-carmel"; + device_type = "cpu"; + reg = <0x301>; + enable-method = "psci"; + };
Not really that useful describing all these cpus.
Quoted 5 lines
Documentation/devicetree/bindings/arm/nvidia,tegra194-ccplex.yaml new file +2
-0+ }; +...Signature · 1 line
2.7.4
Re: [TEGRA194_CPUFREQ PATCH v6 1/4] dt-bindings: arm: Add NVIDIA Tegra194 CPU Complex binding
Thank you for the review.
Quoted 12 lines
Quoted 12 lines
Add device-tree binding documentation to represent Tegra194 CPU Complex with compatible string under 'cpus' node. This can be used by drivers like cpufreq which don't have their node or CPU Complex node to bind to. Also, documenting 'nvidia,bpmp' property which points to BPMP device.
Signed-off-by Sumit Gupta <[email protected]>--- .../bindings/arm/nvidia,tegra194-ccplex.yaml | 106 +++++++++++++++++++++ 1 file changed, 106 insertions(+)create mode 100644
Documentation/devicetree/bindings/arm/nvidia,tegra194-ccplex.yaml
Quoted 10 lines
Documentation/devicetree/bindings/arm/nvidia,tegra194-ccplex.yaml line 1
Quoted 7 lines
Documentation/devicetree/bindings/arm/nvidia,tegra194-ccplex.yaml new file +1
-0@@ -0,0 +1,106 @@ +# SPDX-License-Identifier: GPL-2.0Dual license please.
Ok.
Quoted 13 lines
Quoted 13 lines
Documentation/devicetree/bindings/arm/nvidia,tegra194-ccplex.yaml new file +13
-0+%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/arm/nvidia,tegra194-ccplex.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: NVIDIA Tegra194 CPU Complex device tree bindings + +maintainers: + - Thierry Reding <[email protected]> + - Jonathan Hunter <[email protected]> + - Sumit Gupta <[email protected]> + +description: |+
Quoted 9 lines
Documentation/devicetree/bindings/arm/nvidia,tegra194-ccplex.yaml line 19
Quoted 5 lines
Documentation/devicetree/bindings/arm/nvidia,tegra194-ccplex.yaml new file +5
-0+ Tegra194 SOC has homogeneous architecture where each cluster has two + symmetric cores. Compatible string in "cpus" node represents the CPU + Complex having all clusters. + +properties:$nodename:
const: cpus
Ok.
Quoted 6 lines
Quoted 6 lines
Documentation/devicetree/bindings/arm/nvidia,tegra194-ccplex.yaml new file +6
-0+ compatible: + enum: + - nvidia,tegra194-ccplex + + nvidia,bpmp: + $ref: '/schemas/types.yaml#/definitions/phandle'
Quoted 9 lines
Documentation/devicetree/bindings/arm/nvidia,tegra194-ccplex.yaml line 31
Quoted 6 lines
Documentation/devicetree/bindings/arm/nvidia,tegra194-ccplex.yaml new file +6
-0+ description: | + Specifies the bpmp node that needs to be queried to get + operating point data for all CPUs. + + Optional for systems that have a "compatible" + property value of "nvidia,tegra194-ccplex".The schema says this already.
Removed this text from here.
Quoted 8 lines
Documentation/devicetree/bindings/arm/nvidia,tegra194-ccplex.yaml line 34
Quoted 3 lines
Documentation/devicetree/bindings/arm/nvidia,tegra194-ccplex.yaml new file +3
-0+ + "#address-cells": + const: 1This is wrong. The binding says it's 2 cells on aarch64 cpus though we don't enforce that.
Removed.
Quoted 10 lines
Documentation/devicetree/bindings/arm/nvidia,tegra194-ccplex.yaml line 40
Quoted 6 lines
Documentation/devicetree/bindings/arm/nvidia,tegra194-ccplex.yaml new file +6
-0+ + "#size-cells": + const: 0 + +dependencies: + nvidia,bpmp: [compatible]This is kind of redundant as 'compatible' is required in order to apply the schema.
Removed this as well.
Quoted 58 lines
Quoted 58 lines
Documentation/devicetree/bindings/arm/nvidia,tegra194-ccplex.yaml new file +58
-0+ +examples: + - | + cpus { + compatible = "nvidia,tegra194-ccplex"; + nvidia,bpmp = <&bpmp>; + #address-cells = <1>; + #size-cells = <0>; + + cpu0_0: cpu@0 { + compatible = "nvidia,tegra194-carmel"; + device_type = "cpu"; + reg = <0x0>; + enable-method = "psci"; + }; + + cpu0_1: cpu@1 { + compatible = "nvidia,tegra194-carmel"; + device_type = "cpu"; + reg = <0x001>; + enable-method = "psci"; + }; + + cpu1_0: cpu@100 { + compatible = "nvidia,tegra194-carmel"; + device_type = "cpu"; + reg = <0x100>; + enable-method = "psci"; + }; + + cpu1_1: cpu@101 { + compatible = "nvidia,tegra194-carmel"; + device_type = "cpu"; + reg = <0x101>; + enable-method = "psci"; + }; + + cpu2_0: cpu@200 { + compatible = "nvidia,tegra194-carmel"; + device_type = "cpu"; + reg = <0x200>; + enable-method = "psci"; + }; + + cpu2_1: cpu@201 { + compatible = "nvidia,tegra194-carmel"; + device_type = "cpu"; + reg = <0x201>; + enable-method = "psci"; + }; + + cpu3_0: cpu@300 { + compatible = "nvidia,tegra194-carmel"; + device_type = "cpu"; + reg = <0x300>; + enable-method = "psci"; + }; +
Quoted 9 lines
Documentation/devicetree/bindings/arm/nvidia,tegra194-ccplex.yaml line 104
Quoted 6 lines
Documentation/devicetree/bindings/arm/nvidia,tegra194-ccplex.yaml new file +6
-0+ cpu3_1: cpu@301 { + compatible = "nvidia,tegra194-carmel"; + device_type = "cpu"; + reg = <0x301>; + enable-method = "psci"; + };Not really that useful describing all these cpus.
Ok. Kept first four cpu nodes only.
Quoted 5 lines
Quoted 5 lines
Documentation/devicetree/bindings/arm/nvidia,tegra194-ccplex.yaml new file +2
-1+ }; +... --2.7.4
Re: [TEGRA194_CPUFREQ PATCH v5 1/4] dt-bindings: arm: Add t194 ccplex compatible and bpmp property
In reply to Rob HerringQuoted 6 lines
Quoted 6 lines
Quoted 6 lines
The
cpus.yamlbinding documents what's in 'cpu' nodes, not 'cpus' node. AIUI, the latter is what you want. You should do your own schema file here.
Quoted 7 lines
Quoted 4 lines
Do you mean to change existing file name from '
cpus.yaml' to 'cpu.yaml' and create new 'cpus.yaml' file?
I think it's better to incorporate the change in existing 'cpus.yaml' file to keep both cpu@X and cpus node details together. Please suggest.No, I'm suggesting you create nvidia,tegra194-ccplex.yaml.
Have posted new version of only this patch with new schema file. Please review.
Thanks,
Sumit
PATCH v5 2/4 arm64: tegra: Add t194 ccplex compatible and bpmp property
In reply to Sumit GuptaOn Tegra194, data on valid operating points for the CPUs needs to be queried from BPMP. In T194, there is no node representing CPU complex. So, add compatible string to the 'cpus' node instead of using dummy node to bind cpufreq driver. Also, add reference to the BPMP instance for the CPU complex.
--- arch/arm64/boot/dts/nvidia/tegra194.dtsi | 2 ++ 1 file changed, 2 insertions(+)
arch/arm64/boot/dts/nvidia/tegra194.dtsi +2 -0
@@ -1764,6 +1764,8 @@ }; cpus { + compatible = "nvidia,tegra194-ccplex"; + nvidia,bpmp = <&bpmp>; #address-cells = <1>; #size-cells = <0>;
Signature · 1 line
2.7.4
PATCH v5 3/4 cpufreq: Add Tegra194 cpufreq driver
In reply to Sumit GuptaAdd support for CPU frequency scaling on Tegra194. The frequency of each core can be adjusted by writing a clock divisor value to a MSR on the core. The range of valid divisors is queried from the BPMP.
--- drivers/cpufreq/Kconfig.arm | 6 + drivers/cpufreq/Makefile | 1 + drivers/cpufreq/tegra194-cpufreq.c | 397 +++++++++++++++++++++++++++++++++++++ 3 files changed, 404 insertions(+) create mode 100644 drivers/cpufreq/tegra194-cpufreq.c
drivers/cpufreq/Kconfig.arm +6 -0
@@ -314,6 +314,12 @@ config ARM_TEGRA186_CPUFREQ help This adds the CPUFreq driver support for Tegra186 SOCs. +config ARM_TEGRA194_CPUFREQ + tristate "Tegra194 CPUFreq support" + depends on ARCH_TEGRA && TEGRA_BPMP + help + This adds CPU frequency driver support for Tegra194 SOCs. + config ARM_TI_CPUFREQ bool "Texas Instruments CPUFreq support" depends on ARCH_OMAP2PLUS
drivers/cpufreq/Makefile +1 -0
@@ -83,6 +83,7 @@ obj-$(CONFIG_ARM_TANGO_CPUFREQ) += tango-cpufreq.o obj-$(CONFIG_ARM_TEGRA20_CPUFREQ) += tegra20-cpufreq.o obj-$(CONFIG_ARM_TEGRA124_CPUFREQ) += tegra124-cpufreq.o obj-$(CONFIG_ARM_TEGRA186_CPUFREQ) += tegra186-cpufreq.o +obj-$(CONFIG_ARM_TEGRA194_CPUFREQ) += tegra194-cpufreq.o obj-$(CONFIG_ARM_TI_CPUFREQ) += ti-cpufreq.o obj-$(CONFIG_ARM_VEXPRESS_SPC_CPUFREQ) += vexpress-spc-cpufreq.o
drivers/cpufreq/tegra194-cpufreq.c new file +397 -0
397 lines not on this page · raw message
Signature · 1 line
2.7.4
Viresh Kumar
maintainerRe: [TEGRA194_CPUFREQ PATCH v5 3/4] cpufreq: Add Tegra194 cpufreq driver
Quoted 19 lines · Sumit Gupta
Add support for CPU frequency scaling on Tegra194. The frequency of each core can be adjusted by writing a clock divisor value to a MSR on the core. The range of valid divisors is queried from the BPMP.
Signed-off-by Mikko Perttunen <[email protected]>Signed-off-by Sumit Gupta <[email protected]>--- drivers/cpufreq/Kconfig.arm | 6 + drivers/cpufreq/Makefile | 1 + drivers/cpufreq/tegra194-cpufreq.c | 397 +++++++++++++++++++++++++++++++++++++ 3 files changed, 404 insertions(+) create mode 100644 drivers/cpufreq/tegra194-cpufreq.cdrivers/cpufreq/Kconfig.arm +0
-0
drivers/cpufreq/Kconfig.arm config ARM_TEGRA186_CPUFREQ · line 319
Quoted 6 lines
drivers/cpufreq/Kconfig.arm +3
-0@@ -314,6 +314,12 @@ config ARM_TEGRA186_CPUFREQ help This adds the CPUFreq driver support for Tegra186 SOCs. +config ARM_TEGRA194_CPUFREQ + tristate "Tegra194 CPUFreq support" + depends on ARCH_TEGRA && TEGRA_BPMP
Shouldn't this depend on ARCH_TEGRA_194_SOC instead ? And I asked you to add a default y here itself instead of patch 4/4.
Quoted 52 lines
drivers/cpufreq/Kconfig.arm +3
-0+ help + This adds CPU frequency driver support for Tegra194 SOCs. + config ARM_TI_CPUFREQ bool "Texas Instruments CPUFreq support" depends on ARCH_OMAP2PLUSdrivers/cpufreq/Makefile +1
-0@@ -83,6 +83,7 @@ obj-$(CONFIG_ARM_TANGO_CPUFREQ) += tango-cpufreq.o obj-$(CONFIG_ARM_TEGRA20_CPUFREQ) += tegra20-cpufreq.o obj-$(CONFIG_ARM_TEGRA124_CPUFREQ) += tegra124-cpufreq.o obj-$(CONFIG_ARM_TEGRA186_CPUFREQ) += tegra186-cpufreq.o +obj-$(CONFIG_ARM_TEGRA194_CPUFREQ) += tegra194-cpufreq.o obj-$(CONFIG_ARM_TI_CPUFREQ) += ti-cpufreq.o obj-$(CONFIG_ARM_VEXPRESS_SPC_CPUFREQ) += vexpress-spc-cpufreq.odrivers/cpufreq/tegra194-cpufreq.c +33
-0+static struct cpufreq_frequency_table * +init_freq_table (struct platform_device *pdev,struct tegra_bpmp *bpmp, +unsigned int cluster_id) +{ +struct cpufreq_frequency_table *freq_table; +struct mrq_cpu_ndiv_limits_response resp; +unsigned int num_freqs, ndiv, delta_ndiv; +struct mrq_cpu_ndiv_limits_request req; +struct tegra_bpmp_message msg; +u16 freq_table_step_size; +int err, index; + +memset (&req,0 ,sizeof (req)); + req.cluster_id = cluster_id; + +memset (&msg,0 ,sizeof (msg)); + msg.mrq =MRQ_CPU_NDIV_LIMITS ; + msg.tx.data = &req; + msg.tx.size =sizeof (req); + msg.rx.data = &resp; + msg.rx.size =sizeof (resp); + + err =tegra_bpmp_transfer (bpmp, &msg); +if (err) +return ERR_PTR (err); + +/* +* Make sure frequency table step is a multiple of mdiv to match +* vhint table granularity. +*/ + freq_table_step_size = resp.mdiv * +DIV_ROUND_UP (CPUFREQ_TBL_STEP_HZ , resp.ref_clk_hz); +
drivers/cpufreq/tegra194-cpufreq.c line 293
Quoted 10 lines
drivers/cpufreq/tegra194-cpufreq.c +10
-0+dev_dbg (&pdev->dev,"cluster %d: frequency table step size: %d\n" , + cluster_id, freq_table_step_size); + + delta_ndiv = resp.ndiv_max - resp.ndiv_min; + +if (unlikely (delta_ndiv ==0 )) + num_freqs =1 ; +else +/* We store both ndiv_min and ndiv_max hence the +1 */ + num_freqs = delta_ndiv / freq_table_step_size +1 ;
You need {} in the if else blocks here because of the comment here.
Quoted 58 lines
drivers/cpufreq/tegra194-cpufreq.c +58
-0+ + num_freqs += (delta_ndiv % freq_table_step_size) ?1 :0 ; + + freq_table =devm_kcalloc (&pdev->dev, num_freqs +1 , +sizeof (*freq_table),GFP_KERNEL ); +if (!freq_table) +return ERR_PTR (-ENOMEM ); + +for (index =0 , ndiv = resp.ndiv_min; + ndiv < resp.ndiv_max; + index++, ndiv += freq_table_step_size) { + freq_table[index].driver_data = ndiv; + freq_table[index].frequency =map_ndiv_to_freq (&resp, ndiv); + } + + freq_table[index].driver_data = resp.ndiv_max; + freq_table[index++].frequency =map_ndiv_to_freq (&resp, resp.ndiv_max); + freq_table[index].frequency =CPUFREQ_TABLE_END ; + +return freq_table; +} + +static int tegra194_cpufreq_probe (struct platform_device *pdev) +{ +struct tegra194_cpufreq_data *data; +struct tegra_bpmp *bpmp; +int err, i; + + data =devm_kzalloc (&pdev->dev,sizeof (*data),GFP_KERNEL ); +if (!data) +return -ENOMEM ; + + data->num_clusters =MAX_CLUSTERS ; + data->tables =devm_kcalloc (&pdev->dev, data->num_clusters, +sizeof (*data->tables),GFP_KERNEL ); +if (!data->tables) +return -ENOMEM ; + +platform_set_drvdata (pdev, data); + + bpmp =tegra_bpmp_get (&pdev->dev); +if (IS_ERR (bpmp)) +return PTR_ERR (bpmp); + + read_counters_wq =alloc_workqueue ("read_counters_wq" , __WQ_LEGACY,1 ); +if (!read_counters_wq) { +dev_err (&pdev->dev,"fail to create_workqueue\n" ); + err = -EINVAL ; + goto put_bpmp; + } + +for (i =0 ; i < data->num_clusters; i++) { + data->tables[i] =init_freq_table (pdev, bpmp, i); +if (IS_ERR (data->tables[i])) { + err =PTR_ERR (data->tables[i]); + goto err_free_res; + } + }
drivers/cpufreq/tegra194-cpufreq.c line 361
Quoted 10 lines
drivers/cpufreq/tegra194-cpufreq.c +10
-0+ + tegra194_cpufreq_driver.driver_data = data; + + err =cpufreq_register_driver (&tegra194_cpufreq_driver); +if (err) + goto err_free_res; + +tegra_bpmp_put (bpmp); + +return err;
rather just do:
if (!err)
goto put_bpmp;
Quoted 7 lines
drivers/cpufreq/tegra194-cpufreq.c +7
-0+ +err_free_res: +tegra194_cpufreq_free_resources (); +put_bpmp: +tegra_bpmp_put (bpmp); +return err; +}
Signature · 1 line
viresh
Re: [TEGRA194_CPUFREQ PATCH v5 3/4] cpufreq: Add Tegra194 cpufreq driver
Thank you for the review,
Quoted 22 lines
Quoted 22 lines
Add support for CPU frequency scaling on Tegra194. The frequency of each core can be adjusted by writing a clock divisor value to a MSR on the core. The range of valid divisors is queried from the BPMP.
Signed-off-by Mikko Perttunen <[email protected]>Signed-off-by Sumit Gupta <[email protected]>--- drivers/cpufreq/Kconfig.arm | 6 + drivers/cpufreq/Makefile | 1 + drivers/cpufreq/tegra194-cpufreq.c | 397 +++++++++++++++++++++++++++++++++++++ 3 files changed, 404 insertions(+)create mode 100644
drivers/cpufreq/tegra194-cpufreq.cdrivers/cpufreq/Kconfig.arm +0
-0@@ -314,6 +314,12 @@ config ARM_TEGRA186_CPUFREQ help This adds the CPUFreq driver support for Tegra186 SOCs.
Quoted 7 lines
drivers/cpufreq/Kconfig.arm config ARM_TEGRA186_CPUFREQ · line 319
Quoted 3 lines
drivers/cpufreq/Kconfig.arm +3
-0+config ARM_TEGRA194_CPUFREQ + tristate "Tegra194 CPUFreq support" + depends on ARCH_TEGRA && TEGRA_BPMPShouldn't this depend on
ARCH_TEGRA_194_SOCinstead ? And I asked you to add a default y here itself instead of patch 4/4.
Ok.
Quoted 56 lines
Quoted 56 lines
drivers/cpufreq/Kconfig.arm +3
-0+ help + This adds CPU frequency driver support for Tegra194 SOCs. + config ARM_TI_CPUFREQ bool "Texas Instruments CPUFreq support" depends on ARCH_OMAP2PLUSdrivers/cpufreq/Makefile +1
-0@@ -83,6 +83,7 @@ obj-$(CONFIG_ARM_TANGO_CPUFREQ) += tango-cpufreq.o obj-$(CONFIG_ARM_TEGRA20_CPUFREQ) += tegra20-cpufreq.o obj-$(CONFIG_ARM_TEGRA124_CPUFREQ) += tegra124-cpufreq.o obj-$(CONFIG_ARM_TEGRA186_CPUFREQ) += tegra186-cpufreq.o +obj-$(CONFIG_ARM_TEGRA194_CPUFREQ) += tegra194-cpufreq.o obj-$(CONFIG_ARM_TI_CPUFREQ) += ti-cpufreq.o obj-$(CONFIG_ARM_VEXPRESS_SPC_CPUFREQ) += vexpress-spc-cpufreq.odrivers/cpufreq/tegra194-cpufreq.c +37
-0+static struct cpufreq_frequency_table * +init_freq_table (struct platform_device *pdev,struct tegra_bpmp *bpmp, +unsigned int cluster_id) +{ +struct cpufreq_frequency_table *freq_table; +struct mrq_cpu_ndiv_limits_response resp; +unsigned int num_freqs, ndiv, delta_ndiv; +struct mrq_cpu_ndiv_limits_request req; +struct tegra_bpmp_message msg; +u16 freq_table_step_size; +int err, index; + +memset (&req,0 ,sizeof (req)); + req.cluster_id = cluster_id; + +memset (&msg,0 ,sizeof (msg)); + msg.mrq =MRQ_CPU_NDIV_LIMITS ; + msg.tx.data = &req; + msg.tx.size =sizeof (req); + msg.rx.data = &resp; + msg.rx.size =sizeof (resp); + + err =tegra_bpmp_transfer (bpmp, &msg); +if (err) +return ERR_PTR (err); + +/* +* Make sure frequency table step is a multiple of mdiv to match +* vhint table granularity. +*/ + freq_table_step_size = resp.mdiv * +DIV_ROUND_UP (CPUFREQ_TBL_STEP_HZ , resp.ref_clk_hz); + +dev_dbg (&pdev->dev,"cluster %d: frequency table step size: %d\n" , + cluster_id, freq_table_step_size); + + delta_ndiv = resp.ndiv_max - resp.ndiv_min;
Quoted 9 lines
drivers/cpufreq/tegra194-cpufreq.c line 293
Quoted 6 lines
drivers/cpufreq/tegra194-cpufreq.c +6
-0+ +if (unlikely (delta_ndiv ==0 )) + num_freqs =1 ; +else +/* We store both ndiv_min and ndiv_max hence the +1 */ + num_freqs = delta_ndiv / freq_table_step_size +1 ;You need {} in the if else blocks here because of the comment here.
Ok.
Quoted 71 lines
Quoted 58 lines
drivers/cpufreq/tegra194-cpufreq.c +58
-0+ + num_freqs += (delta_ndiv % freq_table_step_size) ?1 :0 ; + + freq_table =devm_kcalloc (&pdev->dev, num_freqs +1 , +sizeof (*freq_table),GFP_KERNEL ); +if (!freq_table) +return ERR_PTR (-ENOMEM ); + +for (index =0 , ndiv = resp.ndiv_min; + ndiv < resp.ndiv_max; + index++, ndiv += freq_table_step_size) { + freq_table[index].driver_data = ndiv; + freq_table[index].frequency =map_ndiv_to_freq (&resp, ndiv); + } + + freq_table[index].driver_data = resp.ndiv_max; + freq_table[index++].frequency =map_ndiv_to_freq (&resp, resp.ndiv_max); + freq_table[index].frequency =CPUFREQ_TABLE_END ; + +return freq_table; +} + +static int tegra194_cpufreq_probe (struct platform_device *pdev) +{ +struct tegra194_cpufreq_data *data; +struct tegra_bpmp *bpmp; +int err, i; + + data =devm_kzalloc (&pdev->dev,sizeof (*data),GFP_KERNEL ); +if (!data) +return -ENOMEM ; + + data->num_clusters =MAX_CLUSTERS ; + data->tables =devm_kcalloc (&pdev->dev, data->num_clusters, +sizeof (*data->tables),GFP_KERNEL ); +if (!data->tables) +return -ENOMEM ; + +platform_set_drvdata (pdev, data); + + bpmp =tegra_bpmp_get (&pdev->dev); +if (IS_ERR (bpmp)) +return PTR_ERR (bpmp); + + read_counters_wq =alloc_workqueue ("read_counters_wq" , __WQ_LEGACY,1 ); +if (!read_counters_wq) { +dev_err (&pdev->dev,"fail to create_workqueue\n" ); + err = -EINVAL ; + goto put_bpmp; + } + +for (i =0 ; i < data->num_clusters; i++) { + data->tables[i] =init_freq_table (pdev, bpmp, i); +if (IS_ERR (data->tables[i])) { + err =PTR_ERR (data->tables[i]); + goto err_free_res; + } + }drivers/cpufreq/tegra194-cpufreq.c line 361
Quoted 10 lines
drivers/cpufreq/tegra194-cpufreq.c +10
-0+ + tegra194_cpufreq_driver.driver_data = data; + + err =cpufreq_register_driver (&tegra194_cpufreq_driver); +if (err) + goto err_free_res; + +tegra_bpmp_put (bpmp); + +return err;rather just do:
Quoted 3 lines
if (!err)
goto put_bpmp;
Sure, will add in next version.
Quoted 10 lines
drivers/cpufreq/tegra194-cpufreq.c line 368
Quoted 7 lines
drivers/cpufreq/tegra194-cpufreq.c +7
-0+ +err_free_res: +tegra194_cpufreq_free_resources (); +put_bpmp: +tegra_bpmp_put (bpmp); +return err; +}--
viresh
PATCH v5 4/4 soc/tegra: cpufreq: select cpufreq for Tegra194
In reply to Sumit GuptaSelect ARM_TEGRA194_CPUFREQ by default to enable CPU frequency scaling support for Tegra194 SOC.
--- drivers/soc/tegra/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/soc/tegra/Kconfig +1 -0
@@ -117,6 +117,7 @@ config ARCH_TEGRA_194_SOC select TEGRA_HSP_MBOX select TEGRA_IVC select SOC_TEGRA_PMC + select ARM_TEGRA194_CPUFREQ help Enable support for the NVIDIA Tegra194 SoC.
Signature · 1 line
2.7.4