Advertisement
Guest User

revision1

a guest
Apr 3rd, 2013
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.15 KB | None | 0 0
  1. From 1320fe9f83c69ae3676d6411ddd724a6ffebbeac Mon Sep 17 00:00:00 2001
  2. From: Nishanth Menon <nm@ti.com>
  3. Date: Fri, 15 Mar 2013 12:03:30 -0500
  4. Subject: [PATCH] ARM: OMAP3+: use cpu0-cpufreq driver in device tree
  5. supported boot
  6.  
  7. With OMAP3+ and AM33xx supported SoC having defined CPU device tree
  8. entries with operating-points defined, we can now use the SoC
  9. generic cpufreq-cpu0 driver by registering appropriate device.
  10.  
  11. OMAP clock nodes are not represented by device tree nodes yet.
  12. Once the OMAP device tree conversion is complete, we should
  13. have been able to do:
  14. clocks = <&dpll_mpu_ck>; or the SoC specific equivalent.
  15.  
  16. However, since we are unable to do the same, use "cpufreq_ck"
  17. as an generic clock alias to point at the representative
  18. clock required for controlling CPU clock.
  19.  
  20. As part of this change modify AM33xx clock data file to
  21. have cpufreq_ck clock to be generic. This way both omap-cpufreq
  22. and cpufreq-cpu0 drivers (based on device tree enabled boot support)
  23. will use the same clock alias.
  24.  
  25. For platforms which get clock nodes converted into DT, they need to
  26. make a cpufreq_ck clock available.
  27. Once complete DT conversion is complete, cpufreq_ck DT clock nodes
  28. can be deleted with corresponding change in code.
  29.  
  30. Inspired by patch: https://patchwork.kernel.org/patch/2067841/
  31. now made generic.
  32.  
  33. Nyet-signed-off-by: Nishanth Menon <nm@ti.com>
  34. ---
  35. arch/arm/mach-omap2/board-generic.c | 37 +++++++++++++++++++++++++++++++++
  36. arch/arm/mach-omap2/cclock33xx_data.c | 2 +-
  37. 2 files changed, 38 insertions(+), 1 deletion(-)
  38.  
  39. diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
  40. index afa509a..b32dd55 100644
  41. --- a/arch/arm/mach-omap2/board-generic.c
  42. +++ b/arch/arm/mach-omap2/board-generic.c
  43. @@ -11,6 +11,7 @@
  44. * it under the terms of the GNU General Public License version 2 as
  45. * published by the Free Software Foundation.
  46. */
  47. +#include <linux/clk.h>
  48. #include <linux/io.h>
  49. #include <linux/of_irq.h>
  50. #include <linux/of_platform.h>
  51. @@ -35,6 +36,40 @@ static struct of_device_id omap_dt_match_table[] __initdata = {
  52. { }
  53. };
  54.  
  55. +static void omap_generic_cpufreq_init(void)
  56. +{
  57. + struct platform_device *pdev;
  58. + struct platform_device_info devinfo = { .name = "cpufreq-cpu0", };
  59. + char cpufreq_ck_name[] = "cpufreq_ck";
  60. + int r;
  61. +
  62. + if (!IS_ENABLED(CONFIG_GENERIC_CPUFREQ_CPU0))
  63. + return;
  64. +
  65. + pdev = platform_device_register_full(&devinfo);
  66. + if (IS_ERR(pdev)) {
  67. + pr_err("%s: failed to register %s device\n", __func__,
  68. + devinfo.name);
  69. + return;
  70. + }
  71. +
  72. + /*
  73. + * XXX: FIXME:
  74. + * OMAP clock nodes are still based off data files. When they get
  75. + * converted to DT entries, cpu node should have a clock node associated
  76. + * with it.
  77. + * We expect cpufreq to continue to work seamlessly when that takes
  78. + * place. When that takes place, remove the following code:
  79. + */
  80. + r = clk_add_alias(NULL, dev_name(&pdev->dev), cpufreq_ck_name,
  81. + &pdev->dev);
  82. + if (r) {
  83. + dev_err(&pdev->dev, "%s: clk add alias '%s' failed(%d)\n",
  84. + __func__, cpufreq_ck_name, r);
  85. + platform_device_unregister(pdev);
  86. + }
  87. +}
  88. +
  89. static void __init omap_generic_init(void)
  90. {
  91. omap_sdrc_init(NULL, NULL);
  92. @@ -49,6 +84,8 @@ static void __init omap_generic_init(void)
  93. omap4_panda_display_init_of();
  94. else if (of_machine_is_compatible("ti,omap4-sdp"))
  95. omap_4430sdp_display_init_of();
  96. +
  97. + omap_generic_cpufreq_init();
  98. }
  99.  
  100. #ifdef CONFIG_SOC_OMAP2420
  101. diff --git a/arch/arm/mach-omap2/cclock33xx_data.c b/arch/arm/mach-omap2/cclock33xx_data.c
  102. index 476b820..262cee3 100644
  103. --- a/arch/arm/mach-omap2/cclock33xx_data.c
  104. +++ b/arch/arm/mach-omap2/cclock33xx_data.c
  105. @@ -852,7 +852,7 @@ static struct omap_clk am33xx_clks[] = {
  106. CLK(NULL, "dpll_core_m5_ck", &dpll_core_m5_ck, CK_AM33XX),
  107. CLK(NULL, "dpll_core_m6_ck", &dpll_core_m6_ck, CK_AM33XX),
  108. CLK(NULL, "dpll_mpu_ck", &dpll_mpu_ck, CK_AM33XX),
  109. - CLK("cpu0", NULL, &dpll_mpu_ck, CK_AM33XX),
  110. + CLK(NULL, "cpufreq_ck", &dpll_mpu_ck, CK_AM33XX),
  111. CLK(NULL, "dpll_mpu_m2_ck", &dpll_mpu_m2_ck, CK_AM33XX),
  112. CLK(NULL, "dpll_ddr_ck", &dpll_ddr_ck, CK_AM33XX),
  113. CLK(NULL, "dpll_ddr_m2_ck", &dpll_ddr_m2_ck, CK_AM33XX),
  114. --
  115. 1.7.9.5
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement