kernel: 6.1: backport Marvell Armada 8k AP807 cpufreq support
[openwrt/staging/mans0n.git] / target / linux / mvebu / patches-6.1 / 000-cpufreq-armada-8k-add-ap807-support.patch
1 From 8eec6e740b564ec5e1da59ab7070b89aa23c9973 Mon Sep 17 00:00:00 2001
2 From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
3 Date: Fri, 16 Jun 2023 12:41:30 +0100
4 Subject: [PATCH] cpufreq: armada-8k: add ap807 support
5
6 Add support for the Armada AP807 die to armada-8k. This uses a
7 different compatible for the CPU clock which needs to be added to
8 the cpufreq driver.
9
10 This commit takes a different approach to the WindRiver patch
11 "cpufreq: armada: enable ap807-cpu-clk" in that rather than calling
12 of_find_compatible_node() for each compatible, we use a table of
13 IDs instead.
14
15 Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
16 Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
17 ---
18 drivers/cpufreq/armada-8k-cpufreq.c | 16 +++++++++-------
19 1 file changed, 9 insertions(+), 7 deletions(-)
20
21 diff --git a/drivers/cpufreq/armada-8k-cpufreq.c b/drivers/cpufreq/armada-8k-cpufreq.c
22 index b0fc5e84f857..8afefdea4d80 100644
23 --- a/drivers/cpufreq/armada-8k-cpufreq.c
24 +++ b/drivers/cpufreq/armada-8k-cpufreq.c
25 @@ -21,6 +21,13 @@
26 #include <linux/pm_opp.h>
27 #include <linux/slab.h>
28
29 +static const struct of_device_id __maybe_unused armada_8k_cpufreq_of_match[] = {
30 + { .compatible = "marvell,ap806-cpu-clock" },
31 + { .compatible = "marvell,ap807-cpu-clock" },
32 + { },
33 +};
34 +MODULE_DEVICE_TABLE(of, armada_8k_cpufreq_of_match);
35 +
36 /*
37 * Setup the opps list with the divider for the max frequency, that
38 * will be filled at runtime.
39 @@ -127,7 +134,8 @@ static int __init armada_8k_cpufreq_init(void)
40 struct device_node *node;
41 struct cpumask cpus;
42
43 - node = of_find_compatible_node(NULL, NULL, "marvell,ap806-cpu-clock");
44 + node = of_find_matching_node_and_match(NULL, armada_8k_cpufreq_of_match,
45 + NULL);
46 if (!node || !of_device_is_available(node)) {
47 of_node_put(node);
48 return -ENODEV;
49 @@ -204,12 +212,6 @@ static void __exit armada_8k_cpufreq_exit(void)
50 }
51 module_exit(armada_8k_cpufreq_exit);
52
53 -static const struct of_device_id __maybe_unused armada_8k_cpufreq_of_match[] = {
54 - { .compatible = "marvell,ap806-cpu-clock" },
55 - { },
56 -};
57 -MODULE_DEVICE_TABLE(of, armada_8k_cpufreq_of_match);
58 -
59 MODULE_AUTHOR("Gregory Clement <gregory.clement@bootlin.com>");
60 MODULE_DESCRIPTION("Armada 8K cpufreq driver");
61 MODULE_LICENSE("GPL");
62 --
63 2.43.2
64