pnx833x.h 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. /*
  2. * pnx833x.h: Register mappings for PNX833X.
  3. *
  4. * Copyright 2008 NXP Semiconductors
  5. * Chris Steel <chris.steel@nxp.com>
  6. * Daniel Laird <daniel.j.laird@nxp.com>
  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 as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21. */
  22. #ifndef __ASM_MIPS_MACH_PNX833X_PNX833X_H
  23. #define __ASM_MIPS_MACH_PNX833X_PNX833X_H
  24. /* All regs are accessed in KSEG1 */
  25. #define PNX833X_BASE (0xa0000000ul + 0x17E00000ul)
  26. #define PNX833X_REG(offs) (*((volatile unsigned long *)(PNX833X_BASE + offs)))
  27. /* Registers are named exactly as in PNX833X docs, just with PNX833X_ prefix */
  28. /* Read access to multibit fields */
  29. #define PNX833X_BIT(val, reg, field) ((val) & PNX833X_##reg##_##field)
  30. #define PNX833X_REGBIT(reg, field) PNX833X_BIT(PNX833X_##reg, reg, field)
  31. /* Use PNX833X_FIELD to extract a field from val */
  32. #define PNX_FIELD(cpu, val, reg, field) \
  33. (((val) & PNX##cpu##_##reg##_##field##_MASK) >> \
  34. PNX##cpu##_##reg##_##field##_SHIFT)
  35. #define PNX833X_FIELD(val, reg, field) PNX_FIELD(833X, val, reg, field)
  36. #define PNX8330_FIELD(val, reg, field) PNX_FIELD(8330, val, reg, field)
  37. #define PNX8335_FIELD(val, reg, field) PNX_FIELD(8335, val, reg, field)
  38. /* Use PNX833X_REGFIELD to extract a field from a register */
  39. #define PNX833X_REGFIELD(reg, field) PNX833X_FIELD(PNX833X_##reg, reg, field)
  40. #define PNX8330_REGFIELD(reg, field) PNX8330_FIELD(PNX8330_##reg, reg, field)
  41. #define PNX8335_REGFIELD(reg, field) PNX8335_FIELD(PNX8335_##reg, reg, field)
  42. #define PNX_WRITEFIELD(cpu, val, reg, field) \
  43. (PNX##cpu##_##reg = (PNX##cpu##_##reg & ~(PNX##cpu##_##reg##_##field##_MASK)) | \
  44. ((val) << PNX##cpu##_##reg##_##field##_SHIFT))
  45. #define PNX833X_WRITEFIELD(val, reg, field) \
  46. PNX_WRITEFIELD(833X, val, reg, field)
  47. #define PNX8330_WRITEFIELD(val, reg, field) \
  48. PNX_WRITEFIELD(8330, val, reg, field)
  49. #define PNX8335_WRITEFIELD(val, reg, field) \
  50. PNX_WRITEFIELD(8335, val, reg, field)
  51. /* Macros to detect CPU type */
  52. #define PNX833X_CONFIG_MODULE_ID PNX833X_REG(0x7FFC)
  53. #define PNX833X_CONFIG_MODULE_ID_MAJREV_MASK 0x0000f000
  54. #define PNX833X_CONFIG_MODULE_ID_MAJREV_SHIFT 12
  55. #define PNX8330_CONFIG_MODULE_MAJREV 4
  56. #define PNX8335_CONFIG_MODULE_MAJREV 5
  57. #define CPU_IS_PNX8330 (PNX833X_REGFIELD(CONFIG_MODULE_ID, MAJREV) == \
  58. PNX8330_CONFIG_MODULE_MAJREV)
  59. #define CPU_IS_PNX8335 (PNX833X_REGFIELD(CONFIG_MODULE_ID, MAJREV) == \
  60. PNX8335_CONFIG_MODULE_MAJREV)
  61. #define PNX833X_RESET_CONTROL PNX833X_REG(0x8004)
  62. #define PNX833X_RESET_CONTROL_2 PNX833X_REG(0x8014)
  63. #define PNX833X_PIC_REG(offs) PNX833X_REG(0x01000 + (offs))
  64. #define PNX833X_PIC_INT_PRIORITY PNX833X_PIC_REG(0x0)
  65. #define PNX833X_PIC_INT_SRC PNX833X_PIC_REG(0x4)
  66. #define PNX833X_PIC_INT_SRC_INT_SRC_MASK 0x00000FF8ul /* bits 11:3 */
  67. #define PNX833X_PIC_INT_SRC_INT_SRC_SHIFT 3
  68. #define PNX833X_PIC_INT_REG(irq) PNX833X_PIC_REG(0x10 + 4*(irq))
  69. #define PNX833X_CLOCK_CPUCP_CTL PNX833X_REG(0x9228)
  70. #define PNX833X_CLOCK_CPUCP_CTL_EXIT_RESET 0x00000002ul /* bit 1 */
  71. #define PNX833X_CLOCK_CPUCP_CTL_DIV_CLOCK_MASK 0x00000018ul /* bits 4:3 */
  72. #define PNX833X_CLOCK_CPUCP_CTL_DIV_CLOCK_SHIFT 3
  73. #define PNX8335_CLOCK_PLL_CPU_CTL PNX833X_REG(0x9020)
  74. #define PNX8335_CLOCK_PLL_CPU_CTL_FREQ_MASK 0x1f
  75. #define PNX8335_CLOCK_PLL_CPU_CTL_FREQ_SHIFT 0
  76. #define PNX833X_CONFIG_MUX PNX833X_REG(0x7004)
  77. #define PNX833X_CONFIG_MUX_IDE_MUX 0x00000080 /* bit 7 */
  78. #define PNX8330_CONFIG_POLYFUSE_7 PNX833X_REG(0x7040)
  79. #define PNX8330_CONFIG_POLYFUSE_7_BOOT_MODE_MASK 0x00180000
  80. #define PNX8330_CONFIG_POLYFUSE_7_BOOT_MODE_SHIFT 19
  81. #define PNX833X_PIO_IN PNX833X_REG(0xF000)
  82. #define PNX833X_PIO_OUT PNX833X_REG(0xF004)
  83. #define PNX833X_PIO_DIR PNX833X_REG(0xF008)
  84. #define PNX833X_PIO_SEL PNX833X_REG(0xF014)
  85. #define PNX833X_PIO_INT_EDGE PNX833X_REG(0xF020)
  86. #define PNX833X_PIO_INT_HI PNX833X_REG(0xF024)
  87. #define PNX833X_PIO_INT_LO PNX833X_REG(0xF028)
  88. #define PNX833X_PIO_INT_STATUS PNX833X_REG(0xFFE0)
  89. #define PNX833X_PIO_INT_ENABLE PNX833X_REG(0xFFE4)
  90. #define PNX833X_PIO_INT_CLEAR PNX833X_REG(0xFFE8)
  91. #define PNX833X_PIO_IN2 PNX833X_REG(0xF05C)
  92. #define PNX833X_PIO_OUT2 PNX833X_REG(0xF060)
  93. #define PNX833X_PIO_DIR2 PNX833X_REG(0xF064)
  94. #define PNX833X_PIO_SEL2 PNX833X_REG(0xF068)
  95. #define PNX833X_UART0_PORTS_START (PNX833X_BASE + 0xB000)
  96. #define PNX833X_UART0_PORTS_END (PNX833X_BASE + 0xBFFF)
  97. #define PNX833X_UART1_PORTS_START (PNX833X_BASE + 0xC000)
  98. #define PNX833X_UART1_PORTS_END (PNX833X_BASE + 0xCFFF)
  99. #define PNX833X_USB_PORTS_START (PNX833X_BASE + 0x19000)
  100. #define PNX833X_USB_PORTS_END (PNX833X_BASE + 0x19FFF)
  101. #define PNX833X_CONFIG_USB PNX833X_REG(0x7008)
  102. #define PNX833X_I2C0_PORTS_START (PNX833X_BASE + 0xD000)
  103. #define PNX833X_I2C0_PORTS_END (PNX833X_BASE + 0xDFFF)
  104. #define PNX833X_I2C1_PORTS_START (PNX833X_BASE + 0xE000)
  105. #define PNX833X_I2C1_PORTS_END (PNX833X_BASE + 0xEFFF)
  106. #define PNX833X_IDE_PORTS_START (PNX833X_BASE + 0x1A000)
  107. #define PNX833X_IDE_PORTS_END (PNX833X_BASE + 0x1AFFF)
  108. #define PNX833X_IDE_MODULE_ID PNX833X_REG(0x1AFFC)
  109. #define PNX833X_IDE_MODULE_ID_MODULE_ID_MASK 0xFFFF0000
  110. #define PNX833X_IDE_MODULE_ID_MODULE_ID_SHIFT 16
  111. #define PNX833X_IDE_MODULE_ID_VALUE 0xA009
  112. #define PNX833X_MIU_SEL0 PNX833X_REG(0x2004)
  113. #define PNX833X_MIU_SEL0_TIMING PNX833X_REG(0x2008)
  114. #define PNX833X_MIU_SEL1 PNX833X_REG(0x200C)
  115. #define PNX833X_MIU_SEL1_TIMING PNX833X_REG(0x2010)
  116. #define PNX833X_MIU_SEL2 PNX833X_REG(0x2014)
  117. #define PNX833X_MIU_SEL2_TIMING PNX833X_REG(0x2018)
  118. #define PNX833X_MIU_SEL3 PNX833X_REG(0x201C)
  119. #define PNX833X_MIU_SEL3_TIMING PNX833X_REG(0x2020)
  120. #define PNX833X_MIU_SEL0_SPI_MODE_ENABLE_MASK (1 << 14)
  121. #define PNX833X_MIU_SEL0_SPI_MODE_ENABLE_SHIFT 14
  122. #define PNX833X_MIU_SEL0_BURST_MODE_ENABLE_MASK (1 << 7)
  123. #define PNX833X_MIU_SEL0_BURST_MODE_ENABLE_SHIFT 7
  124. #define PNX833X_MIU_SEL0_BURST_PAGE_LEN_MASK (0xF << 9)
  125. #define PNX833X_MIU_SEL0_BURST_PAGE_LEN_SHIFT 9
  126. #define PNX833X_MIU_CONFIG_SPI PNX833X_REG(0x2000)
  127. #define PNX833X_MIU_CONFIG_SPI_OPCODE_MASK (0xFF << 3)
  128. #define PNX833X_MIU_CONFIG_SPI_OPCODE_SHIFT 3
  129. #define PNX833X_MIU_CONFIG_SPI_DATA_ENABLE_MASK (1 << 2)
  130. #define PNX833X_MIU_CONFIG_SPI_DATA_ENABLE_SHIFT 2
  131. #define PNX833X_MIU_CONFIG_SPI_ADDR_ENABLE_MASK (1 << 1)
  132. #define PNX833X_MIU_CONFIG_SPI_ADDR_ENABLE_SHIFT 1
  133. #define PNX833X_MIU_CONFIG_SPI_SYNC_MASK (1 << 0)
  134. #define PNX833X_MIU_CONFIG_SPI_SYNC_SHIFT 0
  135. #define PNX833X_WRITE_CONFIG_SPI(opcode, data_enable, addr_enable, sync) \
  136. (PNX833X_MIU_CONFIG_SPI = \
  137. ((opcode) << PNX833X_MIU_CONFIG_SPI_OPCODE_SHIFT) | \
  138. ((data_enable) << PNX833X_MIU_CONFIG_SPI_DATA_ENABLE_SHIFT) | \
  139. ((addr_enable) << PNX833X_MIU_CONFIG_SPI_ADDR_ENABLE_SHIFT) | \
  140. ((sync) << PNX833X_MIU_CONFIG_SPI_SYNC_SHIFT))
  141. #define PNX8335_IP3902_PORTS_START (PNX833X_BASE + 0x2F000)
  142. #define PNX8335_IP3902_PORTS_END (PNX833X_BASE + 0x2FFFF)
  143. #define PNX8335_IP3902_MODULE_ID PNX833X_REG(0x2FFFC)
  144. #define PNX8335_IP3902_MODULE_ID_MODULE_ID_MASK 0xFFFF0000
  145. #define PNX8335_IP3902_MODULE_ID_MODULE_ID_SHIFT 16
  146. #define PNX8335_IP3902_MODULE_ID_VALUE 0x3902
  147. /* I/O location(gets remapped)*/
  148. #define PNX8335_NAND_BASE 0x18000000
  149. /* I/O location with CLE high */
  150. #define PNX8335_NAND_CLE_MASK 0x00100000
  151. /* I/O location with ALE high */
  152. #define PNX8335_NAND_ALE_MASK 0x00010000
  153. #define PNX8335_SATA_PORTS_START (PNX833X_BASE + 0x2E000)
  154. #define PNX8335_SATA_PORTS_END (PNX833X_BASE + 0x2EFFF)
  155. #define PNX8335_SATA_MODULE_ID PNX833X_REG(0x2EFFC)
  156. #define PNX8335_SATA_MODULE_ID_MODULE_ID_MASK 0xFFFF0000
  157. #define PNX8335_SATA_MODULE_ID_MODULE_ID_SHIFT 16
  158. #define PNX8335_SATA_MODULE_ID_VALUE 0xA099
  159. #endif