memoryCall.c 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /*
  2. * linux/arch/arm/mach-omap1/clock_data.c
  3. *
  4. * Copyright (C) 2004 - 2005, 2009-2010 Nokia Corporation
  5. * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com>
  6. * Based on clocks.h by Tony Lindgren, Gordon McNutt and RidgeRun, Inc
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. *
  12. * To do:
  13. * - Clocks that are only available on some chips should be marked with the
  14. * chips that they are present on.
  15. */
  16. #include <linux/kernel.h>
  17. #include <linux/io.h>
  18. #include <linux/clk.h>
  19. #include <linux/cpufreq.h>
  20. #include <linux/delay.h>
  21. #include <asm/mach-types.h> /* for machine_is_* */
  22. #include "soc.h"
  23. #include <mach/hardware.h>
  24. #include <mach/usb.h> /* for OTG_BASE */
  25. #include "iomap.h"
  26. #include "clock.h"
  27. #include "sram.h"
  28. /* Some ARM_IDLECT1 bit shifts - used in struct arm_idlect1_clk */
  29. #define IDL_CLKOUT_ARM_SHIFT 12
  30. #define IDLTIM_ARM_SHIFT 9
  31. #define IDLAPI_ARM_SHIFT 8
  32. #define IDLIF_ARM_SHIFT 6
  33. #define IDLLB_ARM_SHIFT 4 /* undocumented? */
  34. #define OMAP1510_IDLLCD_ARM_SHIFT 3 /* undocumented? */
  35. #define IDLPER_ARM_SHIFT 2
  36. #define IDLXORP_ARM_SHIFT 1
  37. #define IDLWDT_ARM_SHIFT 0
  38. /* Some MOD_CONF_CTRL_0 bit shifts - used in struct clk.enable_bit */
  39. #define CONF_MOD_UART3_CLK_MODE_R 31
  40. #define CONF_MOD_UART2_CLK_MODE_R 30
  41. #define CONF_MOD_UART1_CLK_MODE_R 29
  42. #define CONF_MOD_MMC_SD_CLK_REQ_R 23
  43. #define CONF_MOD_MCBSP3_AUXON 20
  44. /* Some MOD_CONF_CTRL_1 bit shifts - used in struct clk.enable_bit */
  45. #define CONF_MOD_SOSSI_CLK_EN_R 16
  46. /* Some OTG_SYSCON_2-specific bit fields */
  47. #define OTG_SYSCON_2_UHOST_EN_SHIFT 8
  48. /* Some SOFT_REQ_REG bit fields - used in struct clk.enable_bit */
  49. #define SOFT_MMC2_DPLL_REQ_SHIFT 13
  50. #define SOFT_MMC_DPLL_REQ_SHIFT 12
  51. #define SOFT_UART3_DPLL_REQ_SHIFT 11
  52. #define SOFT_UART2_DPLL_REQ_SHIFT 10
  53. #define SOFT_UART1_DPLL_REQ_SHIFT 9
  54. #define SOFT_USB_OTG_DPLL_REQ_SHIFT 8
  55. #define SOFT_CAM_DPLL_REQ_SHIFT 7
  56. #define SOFT_COM_MCKO_REQ_SHIFT 6
  57. #define SOFT_PERIPH_REQ_SHIFT 5 /* sys_ck gate for UART2 ? */
  58. #define USB_REQ_EN_SHIFT 4
  59. #define SOFT_USB_REQ_SHIFT 3 /* sys_ck gate for USB host? */
  60. #define SOFT_SDW_REQ_SHIFT 2 /* sys_ck gate for Bluetooth? */
  61. #define SOFT_COM_REQ_SHIFT 1 /* sys_ck gate for com proc? */
  62. #define SOFT_DPLL_REQ_SHIFT 0
  63. /*
  64. * Omap1 clocks
  65. */
  66. static struct clk ck_ref = {
  67. .name = "ck_ref",
  68. .ops = &clkops_null,
  69. .rate = 12000000,
  70. };
  71. static struct clk ck_dpll1 = {
  72. .name = "ck_dpll1",
  73. .ops = &clkops_null,
  74. .parent = &ck_ref,
  75. };
  76. /*
  77. * FIXME: This clock seems to be necessary but no-one has asked for its
  78. * activation. [ FIX: SoSSI, SSR ]
  79. */
  80. static struct arm_idlect1_clk ck_dpll1out = {
  81. .clk = {
  82. .name = "ck_dpll1out",
  83. .ops = &clkops_generic,
  84. .parent = &ck_dpll1,
  85. .flags = CLOCK_IDLE_CONTROL | ENABLE_REG_32BIT |
  86. ENABLE_ON_INIT,
  87. .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2),
  88. .enable_bit = EN_CKOUT_ARM,
  89. .recalc = &followparent_recalc,
  90. },
  91. .idlect_shift = IDL_CLKOUT_ARM_SHIFT,
  92. };
  93. static struct clk sossi_ck = {
  94. .name = "ck_sossi",
  95. .ops = &clkops_generic,
  96. .parent = &ck_dpll1out.clk,
  97. .flags = CLOCK_NO_IDLE_PARENT | ENABLE_REG_32BIT,
  98. .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_1),
  99. .enable_bit = CONF_MOD_SOSSI_CLK_EN_R,
  100. .recalc = &omap1_sossi_recalc,
  101. .set_rate = &omap1_set_sossi_rate,
  102. };
  103. static struct clk arm_ck = {
  104. .name = "arm_ck",
  105. .ops = &clkops_null,
  106. .parent = &ck_dpll1,
  107. .rate_offset = CKCTL_ARMDIV_OFFSET,
  108. .recalc = &omap1_ckctl_recalc,
  109. .round_rate = omap1_clk_round_rate_ckctl_arm,
  110. .set_rate = omap1_clk_set_rate_ckctl_arm,
  111. };