000-cpufreq-armada-8k-add-ap807-support.patch 2.1 KB

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