cpu.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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. * Default Device Address MAP BAR values
  69. */
  70. #define ORION5X_DEFADR_PCIE_MEM 0x90000000
  71. #define ORION5X_DEFADR_PCIE_MEM_REMAP_LO 0x90000000
  72. #define ORION5X_DEFADR_PCIE_MEM_REMAP_HI 0
  73. #define ORION5X_DEFSZ_PCIE_MEM (128*1024*1024)
  74. #define ORION5X_DEFADR_PCIE_IO 0xf0000000
  75. #define ORION5X_DEFADR_PCIE_IO_REMAP_LO 0x90000000
  76. #define ORION5X_DEFADR_PCIE_IO_REMAP_HI 0
  77. #define ORION5X_DEFSZ_PCIE_IO (64*1024)
  78. #define ORION5X_DEFADR_PCI_MEM 0x98000000
  79. #define ORION5X_DEFSZ_PCI_MEM (128*1024*1024)
  80. #define ORION5X_DEFADR_PCI_IO 0xf0100000
  81. #define ORION5X_DEFSZ_PCI_IO (64*1024)
  82. #define ORION5X_DEFADR_DEV_CS0 0xfa000000
  83. #define ORION5X_DEFSZ_DEV_CS0 (2*1024*1024)
  84. #define ORION5X_DEFADR_DEV_CS1 0xf8000000
  85. #define ORION5X_DEFSZ_DEV_CS1 (32*1024*1024)
  86. #define ORION5X_DEFADR_DEV_CS2 0xfa800000
  87. #define ORION5X_DEFSZ_DEV_CS2 (1*1024*1024)
  88. #define ORION5X_DEFADR_BOOTROM 0xFFF80000
  89. #define ORION5X_DEFSZ_BOOTROM (512*1024)
  90. /*
  91. * PCIE registers are used for SoC device ID and revision
  92. */
  93. #define PCIE_DEV_ID_OFF (ORION5X_REG_PCIE_BASE + 0x0000)
  94. #define PCIE_DEV_REV_OFF (ORION5X_REG_PCIE_BASE + 0x0008)
  95. /*
  96. * The following definitions are intended for identifying
  97. * the real device and revision on which u-boot is running
  98. * even if it was compiled only for a specific one. Thus,
  99. * these constants must not be considered chip-specific.
  100. */
  101. /* Orion-1 (88F5181) and Orion-VoIP (88F5181L) */
  102. #define MV88F5181_DEV_ID 0x5181
  103. #define MV88F5181_REV_B1 3
  104. #define MV88F5181L_REV_A0 8
  105. #define MV88F5181L_REV_A1 9
  106. /* Orion-NAS (88F5182) */
  107. #define MV88F5182_DEV_ID 0x5182
  108. #define MV88F5182_REV_A2 2
  109. /* Orion-2 (88F5281) */
  110. #define MV88F5281_DEV_ID 0x5281
  111. #define MV88F5281_REV_D0 4
  112. #define MV88F5281_REV_D1 5
  113. #define MV88F5281_REV_D2 6
  114. /* Orion-1-90 (88F6183) */
  115. #define MV88F6183_DEV_ID 0x6183
  116. #define MV88F6183_REV_B0 3
  117. /*
  118. * read feroceon core extra feature register
  119. * using co-proc instruction
  120. */
  121. static inline unsigned int readfr_extra_feature_reg(void)
  122. {
  123. unsigned int val;
  124. asm volatile ("mrc p15, 1, %0, c15, c1, 0 @ readfr exfr" : "=r"
  125. (val) : : "cc");
  126. return val;
  127. }
  128. /*
  129. * write feroceon core extra feature register
  130. * using co-proc instruction
  131. */
  132. static inline void writefr_extra_feature_reg(unsigned int val)
  133. {
  134. asm volatile ("mcr p15, 1, %0, c15, c1, 0 @ writefr exfr" : : "r"
  135. (val) : "cc");
  136. isb();
  137. }
  138. /*
  139. * AHB to Mbus Bridge Registers
  140. * Source: 88F5182 User Manual, Appendix A, section A.4
  141. * Note: only windows 0 and 1 have remap capability.
  142. */
  143. struct orion5x_win_registers {
  144. u32 ctrl;
  145. u32 base;
  146. u32 remap_lo;
  147. u32 remap_hi;
  148. };
  149. /*
  150. * CPU control and status Registers
  151. * Source: 88F5182 User Manual, Appendix A, section A.4
  152. */
  153. struct orion5x_cpu_registers {
  154. u32 config; /*0x20100 */
  155. u32 ctrl_stat; /*0x20104 */
  156. u32 rstoutn_mask; /* 0x20108 */
  157. u32 sys_soft_rst; /* 0x2010C */
  158. u32 ahb_mbus_cause_irq; /* 0x20110 */
  159. u32 ahb_mbus_mask_irq; /* 0x20114 */
  160. };
  161. /*
  162. * DDR SDRAM Controller Address Decode Registers
  163. * Source: 88F5182 User Manual, Appendix A, section A.5.1
  164. */
  165. struct orion5x_ddr_addr_decode_registers {
  166. u32 base;
  167. u32 size;
  168. };
  169. /*
  170. * functions
  171. */
  172. void reset_cpu(unsigned long ignored);
  173. u32 orion5x_device_id(void);
  174. u32 orion5x_device_rev(void);
  175. unsigned int orion5x_winctrl_calcsize(unsigned int sizeval);
  176. #endif /* __ASSEMBLY__ */
  177. #endif /* _ORION5X_CPU_H */