regs-clk.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * Copyright (c) 2011 Zhang, Keguang <keguang.zhang@gmail.com>
  3. *
  4. * Loongson 1 Clock Register Definitions.
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License as published by the
  8. * Free Software Foundation; either version 2 of the License, or (at your
  9. * option) any later version.
  10. */
  11. #ifndef __ASM_MACH_LOONGSON32_REGS_CLK_H
  12. #define __ASM_MACH_LOONGSON32_REGS_CLK_H
  13. #define LS1X_CLK_REG(x) \
  14. ((void __iomem *)KSEG1ADDR(LS1X_CLK_BASE + (x)))
  15. #define LS1X_CLK_PLL_FREQ LS1X_CLK_REG(0x0)
  16. #define LS1X_CLK_PLL_DIV LS1X_CLK_REG(0x4)
  17. #if defined(CONFIG_LOONGSON1_LS1B)
  18. /* Clock PLL Divisor Register Bits */
  19. #define DIV_DC_EN BIT(31)
  20. #define DIV_DC_RST BIT(30)
  21. #define DIV_CPU_EN BIT(25)
  22. #define DIV_CPU_RST BIT(24)
  23. #define DIV_DDR_EN BIT(19)
  24. #define DIV_DDR_RST BIT(18)
  25. #define RST_DC_EN BIT(5)
  26. #define RST_DC BIT(4)
  27. #define RST_DDR_EN BIT(3)
  28. #define RST_DDR BIT(2)
  29. #define RST_CPU_EN BIT(1)
  30. #define RST_CPU BIT(0)
  31. #define DIV_DC_SHIFT 26
  32. #define DIV_CPU_SHIFT 20
  33. #define DIV_DDR_SHIFT 14
  34. #define DIV_DC_WIDTH 4
  35. #define DIV_CPU_WIDTH 4
  36. #define DIV_DDR_WIDTH 4
  37. #define BYPASS_DC_SHIFT 12
  38. #define BYPASS_DDR_SHIFT 10
  39. #define BYPASS_CPU_SHIFT 8
  40. #define BYPASS_DC_WIDTH 1
  41. #define BYPASS_DDR_WIDTH 1
  42. #define BYPASS_CPU_WIDTH 1
  43. #elif defined(CONFIG_LOONGSON1_LS1C)
  44. /* PLL/SDRAM Frequency configuration register Bits */
  45. #define PLL_VALID BIT(31)
  46. #define FRAC_N GENMASK(23, 16)
  47. #define RST_TIME GENMASK(3, 2)
  48. #define SDRAM_DIV GENMASK(1, 0)
  49. /* CPU/CAMERA/DC Frequency configuration register Bits */
  50. #define DIV_DC_EN BIT(31)
  51. #define DIV_DC GENMASK(30, 24)
  52. #define DIV_CAM_EN BIT(23)
  53. #define DIV_CAM GENMASK(22, 16)
  54. #define DIV_CPU_EN BIT(15)
  55. #define DIV_CPU GENMASK(14, 8)
  56. #define DIV_DC_SEL_EN BIT(5)
  57. #define DIV_DC_SEL BIT(4)
  58. #define DIV_CAM_SEL_EN BIT(3)
  59. #define DIV_CAM_SEL BIT(2)
  60. #define DIV_CPU_SEL_EN BIT(1)
  61. #define DIV_CPU_SEL BIT(0)
  62. #define DIV_DC_SHIFT 24
  63. #define DIV_CAM_SHIFT 16
  64. #define DIV_CPU_SHIFT 8
  65. #define DIV_DDR_SHIFT 0
  66. #define DIV_DC_WIDTH 7
  67. #define DIV_CAM_WIDTH 7
  68. #define DIV_CPU_WIDTH 7
  69. #define DIV_DDR_WIDTH 2
  70. #endif
  71. #endif /* __ASM_MACH_LOONGSON32_REGS_CLK_H */