cpu.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. /*
  2. * Copyright (C) 2010 Albert ARIBAUD <albert.aribaud@free.fr>
  3. *
  4. * Based on original Kirorion5x_ood support which is
  5. * (C) Copyright 2009
  6. * Marvell Semiconductor <www.marvell.com>
  7. * Written-by: Prafulla Wadaskar <prafulla@marvell.com>
  8. *
  9. * See file CREDITS for list of people who contributed to this
  10. * project.
  11. *
  12. * This program is free software; you can redistribute it and/or
  13. * modify it under the terms of the GNU General Public License as
  14. * published by the Free Software Foundation; either version 2 of
  15. * the License, or (at your option) any later version.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU General Public License
  23. * along with this program; if not, write to the Free Software
  24. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  25. * MA 02110-1301 USA
  26. */
  27. #ifndef _ORION5X_CPU_H
  28. #define _ORION5X_CPU_H
  29. #include <asm/system.h>
  30. #ifndef __ASSEMBLY__
  31. #define ORION5X_CPU_WIN_CTRL_DATA(size, target, attr, en) (en | (target << 4) \
  32. | (attr << 8) | (orion5x_winctrl_calcsize(size) << 16))
  33. #define ORION5XGBE_PORT_SERIAL_CONTROL1_REG(_x) \
  34. ((_x ? ORION5X_EGIGA0_BASE : ORION5X_EGIGA1_BASE) + 0x44c)
  35. enum memory_bank {
  36. BANK0,
  37. BANK1,
  38. BANK2,
  39. BANK3
  40. };
  41. enum orion5x_cpu_winen {
  42. ORION5X_WIN_DISABLE,
  43. ORION5X_WIN_ENABLE
  44. };
  45. enum orion5x_cpu_target {
  46. ORION5X_TARGET_DRAM = 0,
  47. ORION5X_TARGET_DEVICE = 1,
  48. ORION5X_TARGET_PCI = 3,
  49. ORION5X_TARGET_PCIE = 4,
  50. ORION5X_TARGET_SASRAM = 9
  51. };
  52. enum orion5x_cpu_attrib {
  53. ORION5X_ATTR_DRAM_CS0 = 0x0e,
  54. ORION5X_ATTR_DRAM_CS1 = 0x0d,
  55. ORION5X_ATTR_DRAM_CS2 = 0x0b,
  56. ORION5X_ATTR_DRAM_CS3 = 0x07,
  57. ORION5X_ATTR_PCI_MEM = 0x59,
  58. ORION5X_ATTR_PCI_IO = 0x51,
  59. ORION5X_ATTR_PCIE_MEM = 0x59,
  60. ORION5X_ATTR_PCIE_IO = 0x51,
  61. ORION5X_ATTR_SASRAM = 0x00,
  62. ORION5X_ATTR_DEV_CS0 = 0x1e,
  63. ORION5X_ATTR_DEV_CS1 = 0x1d,
  64. ORION5X_ATTR_DEV_CS2 = 0x1b,
  65. ORION5X_ATTR_BOOTROM = 0x0f
  66. };
  67. /*
  68. * Device Address MAP BAR values
  69. *
  70. * All addresses and sizes not defined by board code
  71. * will be given default values here.
  72. */
  73. #if !defined (ORION5X_ADR_PCIE_MEM)
  74. #define ORION5X_ADR_PCIE_MEM 0x90000000
  75. #endif
  76. #if !defined (ORION5X_ADR_PCIE_MEM_REMAP_LO)
  77. #define ORION5X_ADR_PCIE_MEM_REMAP_LO 0x90000000
  78. #endif
  79. #if !defined (ORION5X_ADR_PCIE_MEM_REMAP_HI)
  80. #define ORION5X_ADR_PCIE_MEM_REMAP_HI 0
  81. #endif
  82. #if !defined (ORION5X_SZ_PCIE_MEM)
  83. #define ORION5X_SZ_PCIE_MEM (128*1024*1024)
  84. #endif
  85. #if !defined (ORION5X_ADR_PCIE_IO)
  86. #define ORION5X_ADR_PCIE_IO 0xf0000000
  87. #endif
  88. #if !defined (ORION5X_ADR_PCIE_IO_REMAP_LO)
  89. #define ORION5X_ADR_PCIE_IO_REMAP_LO 0x90000000
  90. #endif
  91. #if !defined (ORION5X_ADR_PCIE_IO_REMAP_HI)
  92. #define ORION5X_ADR_PCIE_IO_REMAP_HI 0
  93. #endif
  94. #if !defined (ORION5X_SZ_PCIE_IO)
  95. #define ORION5X_SZ_PCIE_IO (64*1024)
  96. #endif
  97. #if !defined (ORION5X_ADR_PCI_MEM)
  98. #define ORION5X_ADR_PCI_MEM 0x98000000
  99. #endif
  100. #if !defined (ORION5X_SZ_PCI_MEM)
  101. #define ORION5X_SZ_PCI_MEM (128*1024*1024)
  102. #endif
  103. #if !defined (ORION5X_ADR_PCI_IO)
  104. #define ORION5X_ADR_PCI_IO 0xf0100000
  105. #endif
  106. #if !defined (ORION5X_SZ_PCI_IO)
  107. #define ORION5X_SZ_PCI_IO (64*1024)
  108. #endif
  109. #if !defined (ORION5X_ADR_DEV_CS0)
  110. #define ORION5X_ADR_DEV_CS0 0xfa000000
  111. #endif
  112. #if !defined (ORION5X_SZ_DEV_CS0)
  113. #define ORION5X_SZ_DEV_CS0 (2*1024*1024)
  114. #endif
  115. #if !defined (ORION5X_ADR_DEV_CS1)
  116. #define ORION5X_ADR_DEV_CS1 0xf8000000
  117. #endif
  118. #if !defined (ORION5X_SZ_DEV_CS1)
  119. #define ORION5X_SZ_DEV_CS1 (32*1024*1024)
  120. #endif
  121. #if !defined (ORION5X_ADR_DEV_CS2)
  122. #define ORION5X_ADR_DEV_CS2 0xfa800000
  123. #endif
  124. #if !defined (ORION5X_SZ_DEV_CS2)
  125. #define ORION5X_SZ_DEV_CS2 (1*1024*1024)
  126. #endif
  127. #if !defined (ORION5X_ADR_BOOTROM)
  128. #define ORION5X_ADR_BOOTROM 0xFFF80000
  129. #endif
  130. #if !defined (ORION5X_SZ_BOOTROM)
  131. #define ORION5X_SZ_BOOTROM (512*1024)
  132. #endif
  133. /*
  134. * PCIE registers are used for SoC device ID and revision
  135. */
  136. #define PCIE_DEV_ID_OFF (ORION5X_REG_PCIE_BASE + 0x0000)
  137. #define PCIE_DEV_REV_OFF (ORION5X_REG_PCIE_BASE + 0x0008)
  138. /*
  139. * The following definitions are intended for identifying
  140. * the real device and revision on which u-boot is running
  141. * even if it was compiled only for a specific one. Thus,
  142. * these constants must not be considered chip-specific.
  143. */
  144. /* Orion-1 (88F5181) and Orion-VoIP (88F5181L) */
  145. #define MV88F5181_DEV_ID 0x5181
  146. #define MV88F5181_REV_B1 3
  147. #define MV88F5181L_REV_A0 8
  148. #define MV88F5181L_REV_A1 9
  149. /* Orion-NAS (88F5182) */
  150. #define MV88F5182_DEV_ID 0x5182
  151. #define MV88F5182_REV_A2 2
  152. /* Orion-2 (88F5281) */
  153. #define MV88F5281_DEV_ID 0x5281
  154. #define MV88F5281_REV_D0 4
  155. #define MV88F5281_REV_D1 5
  156. #define MV88F5281_REV_D2 6
  157. /* Orion-1-90 (88F6183) */
  158. #define MV88F6183_DEV_ID 0x6183
  159. #define MV88F6183_REV_B0 3
  160. /*
  161. * read feroceon core extra feature register
  162. * using co-proc instruction
  163. */
  164. static inline unsigned int readfr_extra_feature_reg(void)
  165. {
  166. unsigned int val;
  167. asm volatile ("mrc p15, 1, %0, c15, c1, 0 @ readfr exfr" : "=r"
  168. (val) : : "cc");
  169. return val;
  170. }
  171. /*
  172. * write feroceon core extra feature register
  173. * using co-proc instruction
  174. */
  175. static inline void writefr_extra_feature_reg(unsigned int val)
  176. {
  177. asm volatile ("mcr p15, 1, %0, c15, c1, 0 @ writefr exfr" : : "r"
  178. (val) : "cc");
  179. isb();
  180. }
  181. /*
  182. * AHB to Mbus Bridge Registers
  183. * Source: 88F5182 User Manual, Appendix A, section A.4
  184. * Note: only windows 0 and 1 have remap capability.
  185. */
  186. struct orion5x_win_registers {
  187. u32 ctrl;
  188. u32 base;
  189. u32 remap_lo;
  190. u32 remap_hi;
  191. };
  192. /*
  193. * CPU control and status Registers
  194. * Source: 88F5182 User Manual, Appendix A, section A.4
  195. */
  196. struct orion5x_cpu_registers {
  197. u32 config; /*0x20100 */
  198. u32 ctrl_stat; /*0x20104 */
  199. u32 rstoutn_mask; /* 0x20108 */
  200. u32 sys_soft_rst; /* 0x2010C */
  201. u32 ahb_mbus_cause_irq; /* 0x20110 */
  202. u32 ahb_mbus_mask_irq; /* 0x20114 */
  203. };
  204. /*
  205. * DDR SDRAM Controller Address Decode Registers
  206. * Source: 88F5182 User Manual, Appendix A, section A.5.1
  207. */
  208. struct orion5x_ddr_addr_decode_registers {
  209. u32 base;
  210. u32 size;
  211. };
  212. /*
  213. * functions
  214. */
  215. void reset_cpu(unsigned long ignored);
  216. u32 orion5x_device_id(void);
  217. u32 orion5x_device_rev(void);
  218. unsigned int orion5x_winctrl_calcsize(unsigned int sizeval);
  219. void timer_init_r(void);
  220. #endif /* __ASSEMBLY__ */
  221. #endif /* _ORION5X_CPU_H */