clock.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /*
  2. * linux/arch/arm/plat-omap/clock.h
  3. *
  4. * Copyright (C) 2004 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. #ifndef __ARCH_ARM_OMAP_CLOCK_H
  13. #define __ARCH_ARM_OMAP_CLOCK_H
  14. struct module;
  15. struct clk {
  16. struct list_head node;
  17. struct module *owner;
  18. const char *name;
  19. struct clk *parent;
  20. unsigned long rate;
  21. __s8 usecount;
  22. __u16 flags;
  23. __u32 enable_reg;
  24. __u8 enable_bit;
  25. __u8 rate_offset;
  26. void (*recalc)(struct clk *);
  27. int (*set_rate)(struct clk *, unsigned long);
  28. long (*round_rate)(struct clk *, unsigned long);
  29. void (*init)(struct clk *);
  30. };
  31. struct mpu_rate {
  32. unsigned long rate;
  33. unsigned long xtal;
  34. unsigned long pll_rate;
  35. __u16 ckctl_val;
  36. __u16 dpllctl_val;
  37. };
  38. /* Clock flags */
  39. #define RATE_CKCTL 1
  40. #define RATE_FIXED 2
  41. #define RATE_PROPAGATES 4
  42. #define VIRTUAL_CLOCK 8
  43. #define ALWAYS_ENABLED 16
  44. #define ENABLE_REG_32BIT 32
  45. #define CLOCK_IN_OMAP16XX 64
  46. #define CLOCK_IN_OMAP1510 128
  47. #define CLOCK_IN_OMAP730 256
  48. #define DSP_DOMAIN_CLOCK 512
  49. #define VIRTUAL_IO_ADDRESS 1024
  50. /* ARM_CKCTL bit shifts */
  51. #define CKCTL_PERDIV_OFFSET 0
  52. #define CKCTL_LCDDIV_OFFSET 2
  53. #define CKCTL_ARMDIV_OFFSET 4
  54. #define CKCTL_DSPDIV_OFFSET 6
  55. #define CKCTL_TCDIV_OFFSET 8
  56. #define CKCTL_DSPMMUDIV_OFFSET 10
  57. /*#define ARM_TIMXO 12*/
  58. #define EN_DSPCK 13
  59. /*#define ARM_INTHCK_SEL 14*/ /* Divide-by-2 for mpu inth_ck */
  60. /* DSP_CKCTL bit shifts */
  61. #define CKCTL_DSPPERDIV_OFFSET 0
  62. /* ARM_IDLECT1 bit shifts */
  63. /*#define IDLWDT_ARM 0*/
  64. /*#define IDLXORP_ARM 1*/
  65. /*#define IDLPER_ARM 2*/
  66. /*#define IDLLCD_ARM 3*/
  67. /*#define IDLLB_ARM 4*/
  68. /*#define IDLHSAB_ARM 5*/
  69. /*#define IDLIF_ARM 6*/
  70. /*#define IDLDPLL_ARM 7*/
  71. /*#define IDLAPI_ARM 8*/
  72. /*#define IDLTIM_ARM 9*/
  73. /*#define SETARM_IDLE 11*/
  74. /* ARM_IDLECT2 bit shifts */
  75. #define EN_WDTCK 0
  76. #define EN_XORPCK 1
  77. #define EN_PERCK 2
  78. #define EN_LCDCK 3
  79. #define EN_LBCK 4 /* Not on 1610/1710 */
  80. /*#define EN_HSABCK 5*/
  81. #define EN_APICK 6
  82. #define EN_TIMCK 7
  83. #define DMACK_REQ 8
  84. #define EN_GPIOCK 9 /* Not on 1610/1710 */
  85. /*#define EN_LBFREECK 10*/
  86. #define EN_CKOUT_ARM 11
  87. /* ARM_IDLECT3 bit shifts */
  88. #define EN_OCPI_CK 0
  89. #define EN_TC1_CK 2
  90. #define EN_TC2_CK 4
  91. /* DSP_IDLECT2 bit shifts (0,1,2 are same as for ARM_IDLECT2) */
  92. #define EN_DSPTIMCK 5
  93. /* Various register defines for clock controls scattered around OMAP chip */
  94. #define USB_MCLK_EN_BIT 4 /* In ULPD_CLKC_CTRL */
  95. #define USB_HOST_HHC_UHOST_EN 9 /* In MOD_CONF_CTRL_0 */
  96. #define SWD_ULPD_PLL_CLK_REQ 1 /* In SWD_CLK_DIV_CTRL_SEL */
  97. #define COM_ULPD_PLL_CLK_REQ 1 /* In COM_CLK_DIV_CTRL_SEL */
  98. #define SWD_CLK_DIV_CTRL_SEL 0xfffe0874
  99. #define COM_CLK_DIV_CTRL_SEL 0xfffe0878
  100. #define SOFT_REQ_REG 0xfffe0834
  101. #define SOFT_REQ_REG2 0xfffe0880
  102. int clk_register(struct clk *clk);
  103. void clk_unregister(struct clk *clk);
  104. int clk_init(void);
  105. #endif