pmu.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /****************************************************************************/
  2. /*
  3. * arch/arm/mach-l7200/include/mach/pmu.h
  4. *
  5. * Registers and helper functions for the L7200 Link-Up Systems
  6. * Power Management Unit (PMU).
  7. *
  8. * (C) Copyright 2000, S A McConnell (samcconn@cotw.com)
  9. *
  10. * This file is subject to the terms and conditions of the GNU General Public
  11. * License. See the file COPYING in the main directory of this archive for
  12. * more details.
  13. */
  14. /****************************************************************************/
  15. #define PMU_OFF 0x00050000 /* Offset from IO_START to the PMU registers. */
  16. /* IO_START and IO_BASE are defined in hardware.h */
  17. #define PMU_START (IO_START + PMU_OFF) /* Physical addr. of the PMU reg. */
  18. #define PMU_BASE (IO_BASE + PMU_OFF) /* Virtual addr. of the PMU reg. */
  19. /* Define the PMU registers for use by device drivers and the kernel. */
  20. typedef struct {
  21. unsigned int CURRENT; /* Current configuration register */
  22. unsigned int NEXT; /* Next configuration register */
  23. unsigned int reserved;
  24. unsigned int RUN; /* Run configuration register */
  25. unsigned int COMM; /* Configuration command register */
  26. unsigned int SDRAM; /* SDRAM configuration bypass register */
  27. } pmu_interface;
  28. #define PMU ((volatile pmu_interface *)(PMU_BASE))
  29. /* Macro's for reading the common register fields. */
  30. #define GET_TRANSOP(reg) ((reg >> 25) & 0x03) /* Bits 26-25 */
  31. #define GET_OSCEN(reg) ((reg >> 16) & 0x01)
  32. #define GET_OSCMUX(reg) ((reg >> 15) & 0x01)
  33. #define GET_PLLMUL(reg) ((reg >> 9) & 0x3f) /* Bits 14-9 */
  34. #define GET_PLLEN(reg) ((reg >> 8) & 0x01)
  35. #define GET_PLLMUX(reg) ((reg >> 7) & 0x01)
  36. #define GET_BCLK_DIV(reg) ((reg >> 3) & 0x03) /* Bits 4-3 */
  37. #define GET_SDRB_SEL(reg) ((reg >> 2) & 0x01)
  38. #define GET_SDRF_SEL(reg) ((reg >> 1) & 0x01)
  39. #define GET_FASTBUS(reg) (reg & 0x1)
  40. /* CFG_NEXT register */
  41. #define CFG_NEXT_CLOCKRECOVERY ((PMU->NEXT >> 18) & 0x7f) /* Bits 24-18 */
  42. #define CFG_NEXT_INTRET ((PMU->NEXT >> 17) & 0x01)
  43. #define CFG_NEXT_SDR_STOP ((PMU->NEXT >> 6) & 0x01)
  44. #define CFG_NEXT_SYSCLKEN ((PMU->NEXT >> 5) & 0x01)
  45. /* Useful field values that can be used to construct the
  46. * CFG_NEXT and CFG_RUN registers.
  47. */
  48. #define TRANSOP_NOP 0<<25 /* NOCHANGE_NOSTALL */
  49. #define NOCHANGE_STALL 1<<25
  50. #define CHANGE_NOSTALL 2<<25
  51. #define CHANGE_STALL 3<<25
  52. #define INTRET 1<<17
  53. #define OSCEN 1<<16
  54. #define OSCMUX 1<<15
  55. /* PLL frequencies */
  56. #define PLLMUL_0 0<<9 /* 3.6864 MHz */
  57. #define PLLMUL_1 1<<9 /* ?????? MHz */
  58. #define PLLMUL_5 5<<9 /* 18.432 MHz */
  59. #define PLLMUL_10 10<<9 /* 36.864 MHz */
  60. #define PLLMUL_18 18<<9 /* ?????? MHz */
  61. #define PLLMUL_20 20<<9 /* 73.728 MHz */
  62. #define PLLMUL_32 32<<9 /* ?????? MHz */
  63. #define PLLMUL_35 35<<9 /* 129.024 MHz */
  64. #define PLLMUL_36 36<<9 /* ?????? MHz */
  65. #define PLLMUL_39 39<<9 /* ?????? MHz */
  66. #define PLLMUL_40 40<<9 /* 147.456 MHz */
  67. /* Clock recovery times */
  68. #define CRCLOCK_1 1<<18
  69. #define CRCLOCK_2 2<<18
  70. #define CRCLOCK_4 4<<18
  71. #define CRCLOCK_8 8<<18
  72. #define CRCLOCK_16 16<<18
  73. #define CRCLOCK_32 32<<18
  74. #define CRCLOCK_63 63<<18
  75. #define CRCLOCK_127 127<<18
  76. #define PLLEN 1<<8
  77. #define PLLMUX 1<<7
  78. #define SDR_STOP 1<<6
  79. #define SYSCLKEN 1<<5
  80. #define BCLK_DIV_4 2<<3
  81. #define BCLK_DIV_2 1<<3
  82. #define BCLK_DIV_1 0<<3
  83. #define SDRB_SEL 1<<2
  84. #define SDRF_SEL 1<<1
  85. #define FASTBUS 1<<0
  86. /* CFG_SDRAM */
  87. #define SDRREFFQ 1<<0 /* Only if SDRSTOPRQ is not set. */
  88. #define SDRREFACK 1<<1 /* Read-only */
  89. #define SDRSTOPRQ 1<<2 /* Only if SDRREFFQ is not set. */
  90. #define SDRSTOPACK 1<<3 /* Read-only */
  91. #define PICEN 1<<4 /* Enable Co-procesor */
  92. #define PICTEST 1<<5
  93. #define GET_SDRREFFQ ((PMU->SDRAM >> 0) & 0x01)
  94. #define GET_SDRREFACK ((PMU->SDRAM >> 1) & 0x01) /* Read-only */
  95. #define GET_SDRSTOPRQ ((PMU->SDRAM >> 2) & 0x01)
  96. #define GET_SDRSTOPACK ((PMU->SDRAM >> 3) & 0x01) /* Read-only */
  97. #define GET_PICEN ((PMU->SDRAM >> 4) & 0x01)
  98. #define GET_PICTEST ((PMU->SDRAM >> 5) & 0x01)