clock.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #ifndef _NAS782X_CLOCK_H
  2. #define _NAS782X_CLOCK_H
  3. #include <asm/arch/sysctl.h>
  4. #include <asm/arch/cpu.h>
  5. /* bit numbers of clock control register */
  6. #define SYS_CTRL_CLK_COPRO 0
  7. #define SYS_CTRL_CLK_DMA 1
  8. #define SYS_CTRL_CLK_CIPHER 2
  9. #define SYS_CTRL_CLK_SD 3
  10. #define SYS_CTRL_CLK_SATA 4
  11. #define SYS_CTRL_CLK_I2S 5
  12. #define SYS_CTRL_CLK_USBHS 6
  13. #define SYS_CTRL_CLK_MACA 7
  14. #define SYS_CTRL_CLK_MAC SYS_CTRL_CLK_MACA
  15. #define SYS_CTRL_CLK_PCIEA 8
  16. #define SYS_CTRL_CLK_STATIC 9
  17. #define SYS_CTRL_CLK_MACB 10
  18. #define SYS_CTRL_CLK_PCIEB 11
  19. #define SYS_CTRL_CLK_REF600 12
  20. #define SYS_CTRL_CLK_USBDEV 13
  21. #define SYS_CTRL_CLK_DDR 14
  22. #define SYS_CTRL_CLK_DDRPHY 15
  23. #define SYS_CTRL_CLK_DDRCK 16
  24. /* bit numbers of reset control register */
  25. #define SYS_CTRL_RST_SCU 0
  26. #define SYS_CTRL_RST_COPRO 1
  27. #define SYS_CTRL_RST_ARM0 2
  28. #define SYS_CTRL_RST_ARM1 3
  29. #define SYS_CTRL_RST_USBHS 4
  30. #define SYS_CTRL_RST_USBHSPHYA 5
  31. #define SYS_CTRL_RST_MACA 6
  32. #define SYS_CTRL_RST_MAC SYS_CTRL_RST_MACA
  33. #define SYS_CTRL_RST_PCIEA 7
  34. #define SYS_CTRL_RST_SGDMA 8
  35. #define SYS_CTRL_RST_CIPHER 9
  36. #define SYS_CTRL_RST_DDR 10
  37. #define SYS_CTRL_RST_SATA 11
  38. #define SYS_CTRL_RST_SATA_LINK 12
  39. #define SYS_CTRL_RST_SATA_PHY 13
  40. #define SYS_CTRL_RST_PCIEPHY 14
  41. #define SYS_CTRL_RST_STATIC 15
  42. #define SYS_CTRL_RST_GPIO 16
  43. #define SYS_CTRL_RST_UART1 17
  44. #define SYS_CTRL_RST_UART2 18
  45. #define SYS_CTRL_RST_MISC 19
  46. #define SYS_CTRL_RST_I2S 20
  47. #define SYS_CTRL_RST_SD 21
  48. #define SYS_CTRL_RST_MACB 22
  49. #define SYS_CTRL_RST_PCIEB 23
  50. #define SYS_CTRL_RST_VIDEO 24
  51. #define SYS_CTRL_RST_DDR_PHY 25
  52. #define SYS_CTRL_RST_USBHSPHYB 26
  53. #define SYS_CTRL_RST_USBDEV 27
  54. #define SYS_CTRL_RST_ARMDBG 29
  55. #define SYS_CTRL_RST_PLLA 30
  56. #define SYS_CTRL_RST_PLLB 31
  57. static inline void reset_block(int block, int reset)
  58. {
  59. u32 reg;
  60. if (reset)
  61. reg = SYS_CTRL_RST_SET_CTRL;
  62. else
  63. reg = SYS_CTRL_RST_CLR_CTRL;
  64. writel(BIT(block), reg);
  65. }
  66. static inline void enable_clock(int block)
  67. {
  68. writel(BIT(block), SYS_CTRL_CLK_SET_CTRL);
  69. }
  70. static inline void disable_clock(int block)
  71. {
  72. writel(BIT(block), SYS_CTRL_CLK_CLR_CTRL);
  73. }
  74. int plla_set_config(int idx);
  75. #endif /* _NAS782X_CLOCK_H */