Skip to contentSkip to conversation

cpufreq: mediatek-hw: Add support for Mediatek cpufreq HW driver

PATCH Superseded Hector Yuan 4 participants 11 messages Oct 26, 2020 – Nov 20, 2020

Subsystems (3)

v8 of 15 Superseded Latest is v15 →

lore
Share & tools
lore
#0 lore raw

PATCH v8 1/1 cpufreq: mediatek-hw: Add support for Mediatek cpufreq HW driver

The CPUfreq HW present in some Mediatek chipsets offloads the steps necessary for changing the frequency of CPUs. The driver implements the cpufreq driver interface for this hardware engine.
This patch depends on MT6779 DTS patch[1] submitted by Hanks Chen.

From v7 to v8, there are three more patches based on patchset[2].
This patchset is about to register power table to Energy model for EAS and thermal usage.
1. EM CPU power table
- Register energy model table for EAS and thermal cooling device usage.
- Read the coresponding LUT for power table.
2. SVS initialization
- The SVS(Smart Voltage Scaling) engine is a hardware which is
used to calculate optimized voltage values for CPU power domain.
DVFS driver could apply those optimized voltage values to reduce power consumption.
- Driver will polling if HW engine is done for SVS initialization.
After that, driver will read power table and register it to EAS.
- CPUs must be in power on state when doing SVS. Use pm_qos to block cpu-idle state for SVS initializing.
3. Cooling device flag
- Add cooling device flag for thermal

[1] https://lkml.org/lkml/2020/8/4/1094
[2] https://lkml.org/lkml/2020/9/23/384

Hector.Yuan (3):
cpufreq: mediatek-hw: Add support for CPUFREQ HW
dt-bindings: arm: cpus: Document 'mediatek,freq-domain' property
dt-bindings: cpufreq: add bindings for MediaTek cpufreq HW

 Documentation/devicetree/bindings/arm/cpus.yaml    |    6 +
 .../bindings/cpufreq/cpufreq-mediatek-hw.yaml      |  113 +++++++
 drivers/cpufreq/Kconfig.arm                        |   12 +
 drivers/cpufreq/Makefile                           |    1 +
 drivers/cpufreq/mediatek-cpufreq-hw.c              |  343 ++++++++++++++++++++
 5 files changed, 475 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/cpufreq/cpufreq-mediatek-hw.yaml
 create mode 100644 drivers/cpufreq/mediatek-cpufreq-hw.c
#1 lore raw

PATCH v8 1/3 cpufreq: mediatek-hw: Add support for CPUFREQ HW

From: "Hector.Yuan" <[email protected]>

Add cpufreq HW support.

---
 drivers/cpufreq/Kconfig.arm           |   12 ++
 drivers/cpufreq/Makefile              |    1 +
 drivers/cpufreq/mediatek-cpufreq-hw.c |  343 +++++++++++++++++++++++++++++++++
 3 files changed, 356 insertions(+)
 create mode 100644 drivers/cpufreq/mediatek-cpufreq-hw.c
drivers/cpufreq/Kconfig.arm +12 -0
index cb72fb5..b9d17c5 100644
@@ -123,6 +123,18 @@ config ARM_MEDIATEK_CPUFREQ
 	help
 	  This adds the CPUFreq driver support for MediaTek SoCs.
 
+config ARM_MEDIATEK_CPUFREQ_HW
+	tristate "MediaTek CPUFreq HW driver"
+	depends on ARCH_MEDIATEK || COMPILE_TEST
+	default m
+	help
+	  Support for the CPUFreq HW driver.
+	  Some MediaTek chipsets have a HW engine to offload the steps
+	  necessary for changing the frequency of the CPUs. Firmware loaded
+	  in this engine exposes a programming interface to the OS.
+	  The driver implements the cpufreq interface for this HW engine.
+	  Say Y if you want to support CPUFreq HW.
+
 config ARM_OMAP2PLUS_CPUFREQ
 	bool "TI OMAP2+"
 	depends on ARCH_OMAP2PLUS
drivers/cpufreq/Makefile +1 -0
index f1b7e3d..ffc61cd 100644
@@ -57,6 +57,7 @@ obj-$(CONFIG_ARM_IMX6Q_CPUFREQ)		+= imx6q-cpufreq.o
 obj-$(CONFIG_ARM_IMX_CPUFREQ_DT)	+= imx-cpufreq-dt.o
 obj-$(CONFIG_ARM_KIRKWOOD_CPUFREQ)	+= kirkwood-cpufreq.o
 obj-$(CONFIG_ARM_MEDIATEK_CPUFREQ)	+= mediatek-cpufreq.o
+obj-$(CONFIG_ARM_MEDIATEK_CPUFREQ_HW)	+= mediatek-cpufreq-hw.o
 obj-$(CONFIG_MACH_MVEBU_V7)		+= mvebu-cpufreq.o
 obj-$(CONFIG_ARM_OMAP2PLUS_CPUFREQ)	+= omap-cpufreq.o
 obj-$(CONFIG_ARM_PXA2xx_CPUFREQ)	+= pxa2xx-cpufreq.o
drivers/cpufreq/mediatek-cpufreq-hw.c new file +343 -0

343 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#2 lore raw

Re: [PATCH v8 1/3] cpufreq: mediatek-hw: Add support for CPUFREQ HW

Hi Hector,

Quoted 5 lines · Hector Yuan

From: "Hector.Yuan" <[email protected]>

Add cpufreq HW support.

[snip]

Quoted 19 lines
drivers/cpufreq/mediatek-cpufreq-hw.c new file +19 -0
+
+static int mtk_cpufreq_hw_cpu_init(struct cpufreq_policy *policy)
+{
+	struct cpufreq_mtk *c;
+	struct device *cpu_dev;
+	struct em_data_callback em_cb = EM_DATA_CB(mtk_cpufreq_get_cpu_power);
+	struct pm_qos_request *qos_request;
+	int sig, pwr_hw = CPUFREQ_HW_STATUS | SVS_HW_STATUS;
+
+	qos_request = kzalloc(sizeof(*qos_request), GFP_KERNEL);
+	if (!qos_request)
+		return -ENOMEM;
+
+	cpu_dev = get_cpu_device(policy->cpu);
+	if (!cpu_dev) {
+		pr_err("failed to get cpu%d device\n", policy->cpu);
+		return -ENODEV;
+	}
+

drivers/cpufreq/mediatek-cpufreq-hw.c line 122

Quoted 10 lines
drivers/cpufreq/mediatek-cpufreq-hw.c new file +10 -0
+	c = mtk_freq_domain_map[policy->cpu];
+	if (!c) {
+		pr_err("No scaling support for CPU%d\n", policy->cpu);
+		return -ENODEV;
+	}
+
+	cpumask_copy(policy->cpus, &c->related_cpus);
+
+	policy->freq_table = c->table;
+	policy->driver_data = c;

To control frequency transition rate in schedutil, you might be interested in setting:

policy->cpuinfo.transition_latency = <mtk_value_here>;

Example, when this latency value comes from FW [1]

Quoted 10 lines
drivers/cpufreq/mediatek-cpufreq-hw.c new file +10 -0
+
+	/* Let CPUs leave idle-off state for SVS CPU initializing */
+	cpu_latency_qos_add_request(qos_request, 0);
+
+	/* HW should be in enabled state to proceed now */
+	writel_relaxed(0x1, c->reg_bases[REG_FREQ_ENABLE]);
+
+	if (readl_poll_timeout(c->reg_bases[REG_FREQ_HW_STATE], sig,
+			       (sig & pwr_hw) == pwr_hw, POLL_USEC,
+			       TIMEOUT_USEC)) {

drivers/cpufreq/mediatek-cpufreq-hw.c line 142

Quoted 10 lines
drivers/cpufreq/mediatek-cpufreq-hw.c new file +10 -0
+		if (!(sig & CPUFREQ_HW_STATUS)) {
+			pr_info("cpufreq hardware of CPU%d is not enabled\n",
+				policy->cpu);
+			return -ENODEV;
+		}
+
+		pr_info("SVS of CPU%d is not enabled\n", policy->cpu);
+	}
+
+	em_dev_register_perf_domain(cpu_dev, c->nr_opp, &em_cb, policy->cpus);

Please keep in mind that this is going to be changed soon with a new
argument: 'milliwatts'. It's queued in pm/linux-next [2].

Regards,
Lukasz

[1] https://elixir.bootlin.com/linux/latest/source/drivers/cpufreq/scmi-cpufreq.c#L194
[2] https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git/commit/?h=linux-next&id=c250d50fe2ce627ca9805d9c8ac11cbbf922a4a6

_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek

#3 lore raw

Re: [PATCH v8 1/3] cpufreq: mediatek-hw: Add support for CPUFREQ HW

Quoted 44 lines · Lukasz Luba

Hi Hector,

Quoted 5 lines · Hector Yuan

From: "Hector.Yuan" <[email protected]>

Add cpufreq HW support.

[snip]

Quoted 19 lines
drivers/cpufreq/mediatek-cpufreq-hw.c new file +19 -0
+
+static int mtk_cpufreq_hw_cpu_init(struct cpufreq_policy *policy)
+{
+	struct cpufreq_mtk *c;
+	struct device *cpu_dev;
+	struct em_data_callback em_cb = EM_DATA_CB(mtk_cpufreq_get_cpu_power);
+	struct pm_qos_request *qos_request;
+	int sig, pwr_hw = CPUFREQ_HW_STATUS | SVS_HW_STATUS;
+
+	qos_request = kzalloc(sizeof(*qos_request), GFP_KERNEL);
+	if (!qos_request)
+		return -ENOMEM;
+
+	cpu_dev = get_cpu_device(policy->cpu);
+	if (!cpu_dev) {
+		pr_err("failed to get cpu%d device\n", policy->cpu);
+		return -ENODEV;
+	}
+

drivers/cpufreq/mediatek-cpufreq-hw.c line 122

Quoted 10 lines
drivers/cpufreq/mediatek-cpufreq-hw.c new file +10 -0
+	c = mtk_freq_domain_map[policy->cpu];
+	if (!c) {
+		pr_err("No scaling support for CPU%d\n", policy->cpu);
+		return -ENODEV;
+	}
+
+	cpumask_copy(policy->cpus, &c->related_cpus);
+
+	policy->freq_table = c->table;
+	policy->driver_data = c;

To control frequency transition rate in schedutil, you might be interested in setting:

Quoted 4 lines

policy->cpuinfo.transition_latency = <mtk_value_here>;

Example, when this latency value comes from FW [1]

OK, I will add it in v9.

Quoted 15 lines
Quoted 15 lines
drivers/cpufreq/mediatek-cpufreq-hw.c new file +15 -0
+
+	/* Let CPUs leave idle-off state for SVS CPU initializing */
+	cpu_latency_qos_add_request(qos_request, 0);
+
+	/* HW should be in enabled state to proceed now */
+	writel_relaxed(0x1, c->reg_bases[REG_FREQ_ENABLE]);
+
+	if (readl_poll_timeout(c->reg_bases[REG_FREQ_HW_STATE], sig,
+			       (sig & pwr_hw) == pwr_hw, POLL_USEC,
+			       TIMEOUT_USEC)) {
+		if (!(sig & CPUFREQ_HW_STATUS)) {
+			pr_info("cpufreq hardware of CPU%d is not enabled\n",
+				policy->cpu);
+			return -ENODEV;
+		}
Quoted 9 lines

drivers/cpufreq/mediatek-cpufreq-hw.c line 142

Quoted 5 lines
drivers/cpufreq/mediatek-cpufreq-hw.c new file +5 -0
+
+		pr_info("SVS of CPU%d is not enabled\n", policy->cpu);
+	}
+
+	em_dev_register_perf_domain(cpu_dev, c->nr_opp, &em_cb, policy->cpus);

Please keep in mind that this is going to be changed soon with a new
argument: 'milliwatts'. It's queued in pm/linux-next [2].

OK, thanks for the remind.

Quoted 8 lines

Regards,
Lukasz

[1]
https://elixir.bootlin.com/linux/latest/source/drivers/cpufreq/scmi-cpufreq.c#L194
[2]
https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git/commit/?h=linux-next&id=c250d50fe2ce627ca9805d9c8ac11cbbf922a4a6

#4 lore raw

Re: [PATCH v8 1/3] cpufreq: mediatek-hw: Add support for CPUFREQ HW

Quoted 74 lines · Hector Yuan
Quoted 44 lines · Lukasz Luba

Hi Hector,

Quoted 5 lines · Hector Yuan

From: "Hector.Yuan" <[email protected]>

Add cpufreq HW support.

[snip]

Quoted 19 lines
drivers/cpufreq/mediatek-cpufreq-hw.c new file +19 -0
+
+static int mtk_cpufreq_hw_cpu_init(struct cpufreq_policy *policy)
+{
+	struct cpufreq_mtk *c;
+	struct device *cpu_dev;
+	struct em_data_callback em_cb = EM_DATA_CB(mtk_cpufreq_get_cpu_power);
+	struct pm_qos_request *qos_request;
+	int sig, pwr_hw = CPUFREQ_HW_STATUS | SVS_HW_STATUS;
+
+	qos_request = kzalloc(sizeof(*qos_request), GFP_KERNEL);
+	if (!qos_request)
+		return -ENOMEM;
+
+	cpu_dev = get_cpu_device(policy->cpu);
+	if (!cpu_dev) {
+		pr_err("failed to get cpu%d device\n", policy->cpu);
+		return -ENODEV;
+	}
+

drivers/cpufreq/mediatek-cpufreq-hw.c line 122

Quoted 10 lines
drivers/cpufreq/mediatek-cpufreq-hw.c new file +10 -0
+	c = mtk_freq_domain_map[policy->cpu];
+	if (!c) {
+		pr_err("No scaling support for CPU%d\n", policy->cpu);
+		return -ENODEV;
+	}
+
+	cpumask_copy(policy->cpus, &c->related_cpus);
+
+	policy->freq_table = c->table;
+	policy->driver_data = c;

To control frequency transition rate in schedutil, you might be interested in setting:

Quoted 4 lines

policy->cpuinfo.transition_latency = <mtk_value_here>;

Example, when this latency value comes from FW [1]

OK, I will add it in v9.

Quoted 15 lines
Quoted 15 lines
drivers/cpufreq/mediatek-cpufreq-hw.c new file +15 -0
+
+	/* Let CPUs leave idle-off state for SVS CPU initializing */
+	cpu_latency_qos_add_request(qos_request, 0);
+
+	/* HW should be in enabled state to proceed now */
+	writel_relaxed(0x1, c->reg_bases[REG_FREQ_ENABLE]);
+
+	if (readl_poll_timeout(c->reg_bases[REG_FREQ_HW_STATE], sig,
+			       (sig & pwr_hw) == pwr_hw, POLL_USEC,
+			       TIMEOUT_USEC)) {
+		if (!(sig & CPUFREQ_HW_STATUS)) {
+			pr_info("cpufreq hardware of CPU%d is not enabled\n",
+				policy->cpu);
+			return -ENODEV;
+		}
Quoted 9 lines

drivers/cpufreq/mediatek-cpufreq-hw.c line 142

Quoted 5 lines
drivers/cpufreq/mediatek-cpufreq-hw.c new file +5 -0
+
+		pr_info("SVS of CPU%d is not enabled\n", policy->cpu);
+	}
+
+	em_dev_register_perf_domain(cpu_dev, c->nr_opp, &em_cb, policy->cpus);

Please keep in mind that this is going to be changed soon with a new
argument: 'milliwatts'. It's queued in pm/linux-next [2].

Quoted 10 lines

OK, thanks for the remind.

Quoted 8 lines

Regards,
Lukasz

[1]
https://elixir.bootlin.com/linux/latest/source/drivers/cpufreq/scmi-cpufreq.c#L194
[2]
https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git/commit/?h=linux-next&id=c250d50fe2ce627ca9805d9c8ac11cbbf922a4a6

Also, based on function mtk_cpufreq_hw_target_index(), which looks really simple, you might consider to have fast_switch enabled.

It will allow SchedUtil governor to change frequency directly and not create a dedicated deadline thread for it. It pays off.

You have to experiment with something like:

policy->fast_switch_possible = true;

static struct cpufreq_driver cpufreq_mtk_hw_driver = {
...
.fast_switch = mtk_cpufreq_hw_fast_switch
...
}

Again, scmi-cpufreq.c would be a good pattern to follow.

_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek

#5 lore raw

PATCH v8 2/3 dt-bindings: arm: cpus: Document 'mediatek,freq-domain' property

In reply to Hector Yuan

From: "Hector.Yuan" <[email protected]>

Add devicetree documentation for 'mediatek,freq-domain' property specific to Mediatek CPUs. This property is used to reference the CPUFREQ node along with the domain id.

---
 Documentation/devicetree/bindings/arm/cpus.yaml |    6 ++++++
 1 file changed, 6 insertions(+)
Documentation/devicetree/bindings/arm/cpus.yaml +6 -0
index 1222bf1..e995b26 100644
@@ -255,6 +255,12 @@ properties:
 
       where voltage is in V, frequency is in MHz.
 
+  mediatek,freq-domain:
+    $ref: '/schemas/types.yaml#/definitions/phandle-array'
+    description:
+      CPUs supporting freq-domain must set their "mediatek,freq-domain" property
+      with phandle to a cpufreq_hw node followed by the domain id.
+
   power-domains:
     $ref: '/schemas/types.yaml#/definitions/phandle-array'
     description:
Signature · 1 line
1.7.9.5
maintainer
#6 lore raw

Re: [PATCH v8 2/3] dt-bindings: arm: cpus: Document 'mediatek,freq-domain' property

Quoted 16 lines · Hector Yuan

From: "Hector.Yuan" <[email protected]>

Add devicetree documentation for 'mediatek,freq-domain' property specific to Mediatek CPUs. This property is used to reference the CPUFREQ node along with the domain id.

---
 Documentation/devicetree/bindings/arm/cpus.yaml |    6 ++++++
 1 file changed, 6 insertions(+)
Documentation/devicetree/bindings/arm/cpus.yaml +0 -0
index 1222bf1..e995b26 100644

Documentation/devicetree/bindings/arm/cpus.yaml properties: · line 262

Quoted 8 lines
Documentation/devicetree/bindings/arm/cpus.yaml +5 -0
@@ -255,6 +255,12 @@ properties:
 
       where voltage is in V, frequency is in MHz.
 
+  mediatek,freq-domain:
+    $ref: '/schemas/types.yaml#/definitions/phandle-array'
+    description:
+      CPUs supporting freq-domain must set their "mediatek,freq-domain" property
+      with phandle to a cpufreq_hw node followed by the domain id.

This needs to be a common binding shared with SCMI domains.

Quoted 6 lines
Documentation/devicetree/bindings/arm/cpus.yaml +1 -0
+
   power-domains:
     $ref: '/schemas/types.yaml#/definitions/phandle-array'
     description:
Signature · 1 line
1.7.9.5

_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek

#7 lore raw

Re: [PATCH v8 2/3] dt-bindings: arm: cpus: Document 'mediatek,freq-domain' property

Quoted 20 lines · Rob Herring
Quoted 19 lines · Hector Yuan

From: "Hector.Yuan" <[email protected]>

Add devicetree documentation for 'mediatek,freq-domain' property specific to Mediatek CPUs. This property is used to reference the CPUFREQ node along with the domain id.

---
  Documentation/devicetree/bindings/arm/cpus.yaml |    6 ++++++
  1 file changed, 6 insertions(+)
Documentation/devicetree/bindings/arm/cpus.yaml +0 -0
index 1222bf1..e995b26 100644
@@ -255,6 +255,12 @@ properties:
 
        where voltage is in V, frequency is in MHz.
 
Quoted 7 lines

Documentation/devicetree/bindings/arm/cpus.yaml properties: · line 262

Quoted 5 lines
Documentation/devicetree/bindings/arm/cpus.yaml +5 -0
+  mediatek,freq-domain:
+    $ref: '/schemas/types.yaml#/definitions/phandle-array'
+    description:
+      CPUs supporting freq-domain must set their "mediatek,freq-domain" property
+      with phandle to a cpufreq_hw node followed by the domain id.

This needs to be a common binding shared with SCMI domains.

Would it be accurate to create a new binding file:
Documentation/devicetree/bindings/cpufreq/cpufreq-mediatek-hw.txt ?

There is already cpufreq-qcom-hw.txt with 'qcom,freq-domain' and analogous purpose.

Regards,
Lukasz

#8 lore raw

Re: [PATCH v8 2/3] dt-bindings: arm: cpus: Document 'mediatek,freq-domain' property

Quoted 29 lines · Lukasz Luba
Quoted 12 lines · Rob Herring
Quoted 11 lines · Hector Yuan

From: "Hector.Yuan" <[email protected]>

Add devicetree documentation for 'mediatek,freq-domain' property specific to Mediatek CPUs. This property is used to reference the CPUFREQ node along with the domain id.

---
  Documentation/devicetree/bindings/arm/cpus.yaml |    6 ++++++
  1 file changed, 6 insertions(+)
Quoted 13 lines

Documentation/devicetree/bindings/arm/cpus.yaml properties: · line 260

Quoted 11 lines
Documentation/devicetree/bindings/arm/cpus.yaml +5 -0
index 1222bf1..e995b26 100644
@@ -255,6 +255,12 @@ properties:
        where voltage is in V, frequency is in MHz.
+  mediatek,freq-domain:
+    $ref: '/schemas/types.yaml#/definitions/phandle-array'
+    description:
+      CPUs supporting freq-domain must set their "mediatek,freq-domain" property
+      with phandle to a cpufreq_hw node followed by the domain id.

This needs to be a common binding shared with SCMI domains.

Quoted 4 lines

Would it be accurate to create a new binding file:
Documentation/devicetree/bindings/cpufreq/cpufreq-mediatek-hw.txt ?

Nope, Rob already asked to unify all such bindings and generalise it. Here is my attempt[1] and this must just use it or help to enhance that in order to make use of that binding.

Signature · 4 lines
Regards,
Sudeep

[1] https://lore.kernel.org/lkml/[email protected]
#9 lore raw

Re: [PATCH v8 2/3] dt-bindings: arm: cpus: Document 'mediatek,freq-domain' property

Quoted 30 lines · Sudeep Holla
Quoted 29 lines · Lukasz Luba
Quoted 25 lines · Rob Herring
Quoted 16 lines · Hector Yuan

From: "Hector.Yuan" <[email protected]>

Add devicetree documentation for 'mediatek,freq-domain' property specific to Mediatek CPUs. This property is used to reference the CPUFREQ node along with the domain id.

---
   Documentation/devicetree/bindings/arm/cpus.yaml |    6 ++++++
   1 file changed, 6 insertions(+)
Documentation/devicetree/bindings/arm/cpus.yaml +0 -0
index 1222bf1..e995b26 100644

Documentation/devicetree/bindings/arm/cpus.yaml properties: · line 260

Quoted 6 lines
Documentation/devicetree/bindings/arm/cpus.yaml +5 -0
@@ -255,6 +255,12 @@ properties:
         where voltage is in V, frequency is in MHz.
+  mediatek,freq-domain:
+    $ref: '/schemas/types.yaml#/definitions/phandle-array'
+    description:
+      CPUs supporting freq-domain must set their "mediatek,freq-domain" property
+      with phandle to a cpufreq_hw node followed by the domain id.

This needs to be a common binding shared with SCMI domains.

Quoted 9 lines
Quoted 4 lines

Would it be accurate to create a new binding file:
Documentation/devicetree/bindings/cpufreq/cpufreq-mediatek-hw.txt ?

Nope, Rob already asked to unify all such bindings and generalise it. Here is my attempt[1] and this must just use it or help to enhance that in order to make use of that binding.

That's great. Thank you for the information.

Regards,
Lukasz

#10 lore raw

PATCH v8 3/3 dt-bindings: cpufreq: add bindings for MediaTek cpufreq HW

In reply to Hector Yuan

From: "Hector.Yuan" <[email protected]>

Add devicetree bindings for MediaTek HW driver.

---
 .../bindings/cpufreq/cpufreq-mediatek-hw.yaml      |  113 ++++++++++++++++++++
 1 file changed, 113 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/cpufreq/cpufreq-mediatek-hw.yaml
Documentation/devicetree/bindings/cpufreq/cpufreq-mediatek-hw.yaml new file +113 -0
new file mode 100644
index 0000000..32d2ad4
@@ -0,0 +1,113 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/cpufreq/cpufreq-mediatek-hw.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MediaTek's CPUFREQ Bindings
+
+maintainers:
+  - Hector Yuan <[email protected]>
+
+description:
+  CPUFREQ HW is a hardware engine used by MediaTek
+  SoCs to manage frequency in hardware. It is capable of controlling frequency
+  for multiple clusters.
+
+properties:
+  compatible:
+    const: mediatek,cpufreq-hw
+
+  reg:
+    minItems: 1
+    maxItems: 2
+    description: |
+      Addresses and sizes for the memory of the HW bases in each frequency domain.
+
+required:
+  - compatible
+  - reg
+
+examples:
+  - |
+    cpus {
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            cpu0: cpu@0 {
+                device_type = "cpu";
+                compatible = "arm,cortex-a55";
+                enable-method = "psci";
+                mediatek,freq-domain = <&cpufreq_hw 0>;
+                reg = <0x000>;
+            };
+
+            cpu1: cpu@100 {
+                device_type = "cpu";
+                compatible = "arm,cortex-a55";
+                enable-method = "psci";
+                mediatek,freq-domain = <&cpufreq_hw 0>;
+                reg = <0x100>;
+            };
+
+            cpu2: cpu@200 {
+                device_type = "cpu";
+                compatible = "arm,cortex-a55";
+                enable-method = "psci";
+                mediatek,freq-domain = <&cpufreq_hw 0>;
+                reg = <0x200>;
+            };
+
+            cpu3: cpu@300 {
+                device_type = "cpu";
+                compatible = "arm,cortex-a55";
+                enable-method = "psci";
+                mediatek,freq-domain = <&cpufreq_hw 0>;
+                reg = <0x300>;
+            };
+
+            cpu4: cpu@400 {
+                device_type = "cpu";
+                compatible = "arm,cortex-a55";
+                enable-method = "psci";
+                mediatek,freq-domain = <&cpufreq_hw 1>;
+                reg = <0x400>;
+            };
+
+            cpu5: cpu@500 {
+                device_type = "cpu";
+                compatible = "arm,cortex-a55";
+                enable-method = "psci";
+                mediatek,freq-domain = <&cpufreq_hw 1>;
+                reg = <0x500>;
+            };
+
+            cpu6: cpu@600 {
+                device_type = "cpu";
+                compatible = "arm,cortex-a75";
+                enable-method = "psci";
+                mediatek,freq-domain = <&cpufreq_hw 1>;
+                reg = <0x600>;
+            };
+
+            cpu7: cpu@700 {
+                device_type = "cpu";
+                compatible = "arm,cortex-a75";
+                enable-method = "psci";
+                mediatek,freq-domain = <&cpufreq_hw 1>;
+                reg = <0x700>;
+            };
+    };
+
+    /* ... */
+
+    soc {
+        #address-cells = <2>;
+        #size-cells = <2>;
+
+        cpufreq_hw: cpufreq@11bc00 {
+            compatible = "mediatek,cpufreq-hw";
+            reg = <0 0x11bc10 0 0x8c>,
+               <0 0x11bca0 0 0x8c>;
+        };
+    };
Signature · 1 line
1.7.9.5