cablePowerDataOperation.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /*
  2. * OMAP2430 clock data
  3. *
  4. * Copyright (C) 2005-2009, 2012 Texas Instruments, Inc.
  5. * Copyright (C) 2004-2011 Nokia Corporation
  6. *
  7. * Contacts:
  8. * Richard Woodruff <r-woodruff2@ti.com>
  9. * Paul Walmsley
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License version 2 as
  13. * published by the Free Software Foundation.
  14. */
  15. #include <linux/kernel.h>
  16. #include <linux/clk.h>
  17. #include <linux/clk-private.h>
  18. #include <linux/list.h>
  19. #include "soc.h"
  20. #include "iomap.h"
  21. #include "clock.h"
  22. #include "clock2xxx.h"
  23. #include "opp2xxx.h"
  24. #include "cm2xxx.h"
  25. #include "prm2xxx.h"
  26. #include "prm-regbits-24xx.h"
  27. #include "cm-regbits-24xx.h"
  28. #include "sdrc.h"
  29. #include "control.h"
  30. #define OMAP_CM_REGADDR OMAP2430_CM_REGADDR
  31. /*
  32. * 2430 clock tree.
  33. *
  34. * NOTE:In many cases here we are assigning a 'default' parent. In
  35. * many cases the parent is selectable. The set parent calls will
  36. * also switch sources.
  37. *
  38. * Several sources are given initial rates which may be wrong, this will
  39. * be fixed up in the init func.
  40. *
  41. * Things are broadly separated below by clock domains. It is
  42. * noteworthy that most peripherals have dependencies on multiple clock
  43. * domains. Many get their interface clocks from the L4 domain, but get
  44. * functional clocks from fixed sources or other core domain derived
  45. * clocks.
  46. */
  47. DEFINE_CLK_FIXED_RATE(alt_ck, CLK_IS_ROOT, 54000000, 0x0);
  48. DEFINE_CLK_FIXED_RATE(func_32k_ck, CLK_IS_ROOT, 32768, 0x0);
  49. DEFINE_CLK_FIXED_RATE(mcbsp_clks, CLK_IS_ROOT, 0x0, 0x0);
  50. static struct clk osc_ck;
  51. static const struct clk_ops osc_ck_ops = {
  52. .enable = &omap2_enable_osc_ck,
  53. .disable = omap2_disable_osc_ck,
  54. .recalc_rate = &omap2_osc_clk_recalc,
  55. };
  56. static struct clk_hw_omap osc_ck_hw = {
  57. .hw = {
  58. .clk = &osc_ck,
  59. },
  60. };
  61. static struct clk osc_ck = {
  62. .name = "osc_ck",
  63. .ops = &osc_ck_ops,
  64. .hw = &osc_ck_hw.hw,
  65. .flags = CLK_IS_ROOT,
  66. };
  67. DEFINE_CLK_FIXED_RATE(secure_32k_ck, CLK_IS_ROOT, 32768, 0x0);
  68. static struct clk sys_ck;
  69. static const char *sys_ck_parent_names[] = {
  70. "osc_ck",
  71. };
  72. static const struct clk_ops sys_ck_ops = {
  73. .init = &omap2_init_clk_clkdm,
  74. .recalc_rate = &omap2xxx_sys_clk_recalc,
  75. };
  76. DEFINE_STRUCT_CLK_HW_OMAP(sys_ck, "wkup_clkdm");
  77. DEFINE_STRUCT_CLK(sys_ck, sys_ck_parent_names, sys_ck_ops);
  78. static struct dpll_data dpll_dd = {
  79. .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
  80. .mult_mask = OMAP24XX_DPLL_MULT_MASK,
  81. .div1_mask = OMAP24XX_DPLL_DIV_MASK,
  82. .clk_bypass = &sys_ck,
  83. .clk_ref = &sys_ck,
  84. .control_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
  85. .enable_mask = OMAP24XX_EN_DPLL_MASK,
  86. .max_multiplier = 1023,
  87. .min_divider = 1,
  88. .max_divider = 16,
  89. };
  90. static struct clk dpll_ck;
  91. static const char *dpll_ck_parent_names[] = {
  92. "sys_ck",
  93. };
  94. static const struct clk_ops dpll_ck_ops = {
  95. .init = &omap2_init_clk_clkdm,
  96. .get_parent = &omap2_init_dpll_parent,
  97. .recalc_rate = &omap2_dpllcore_recalc,
  98. .round_rate = &omap2_dpll_round_rate,
  99. .set_rate = &omap2_reprogram_dpllcore,
  100. };
  101. static struct clk_hw_omap dpll_ck_hw = {
  102. .hw = {
  103. .clk = &dpll_ck,
  104. },
  105. .ops = &clkhwops_omap2xxx_dpll,
  106. .dpll_data = &dpll_dd,
  107. .clkdm_name = "wkup_clkdm",
  108. };
  109. DEFINE_STRUCT_CLK(dpll_ck, dpll_ck_parent_names, dpll_ck_ops);
  110. static struct clk core_ck;
  111. static const char *core_ck_parent_names[] = {
  112. "dpll_ck",
  113. };
  114. static const struct clk_ops core_ck_ops = {
  115. .init = &omap2_init_clk_clkdm,
  116. };
  117. DEFINE_STRUCT_CLK_HW_OMAP(core_ck, "wkup_clkdm");
  118. DEFINE_STRUCT_CLK(core_ck, core_ck_parent_names, core_ck_ops);