sbsocram.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. /*
  2. * BCM47XX Sonics SiliconBackplane embedded ram core
  3. *
  4. * Portions of this code are copyright (c) 2020 Cypress Semiconductor Corporation
  5. *
  6. * Copyright (C) 1999-2020, Broadcom Corporation
  7. *
  8. * Unless you and Broadcom execute a separate written software license
  9. * agreement governing use of this software, this software is licensed to you
  10. * under the terms of the GNU General Public License version 2 (the "GPL"),
  11. * available at http://www.broadcom.com/licenses/GPLv2.php, with the
  12. * following added to such license:
  13. *
  14. * As a special exception, the copyright holders of this software give you
  15. * permission to link this software with independent modules, and to copy and
  16. * distribute the resulting executable under terms of your choice, provided that
  17. * you also meet, for each linked independent module, the terms and conditions of
  18. * the license of that module. An independent module is a module which is not
  19. * derived from this software. The special exception does not apply to any
  20. * modifications of the software.
  21. *
  22. * Notwithstanding the above, under no circumstances may you combine this
  23. * software in any way with any other Broadcom software provided under a license
  24. * other than the GPL, without Broadcom's express prior written consent.
  25. *
  26. *
  27. * <<Broadcom-WL-IPTag/Open:>>
  28. *
  29. * $Id: sbsocram.h 619629 2016-02-17 18:37:56Z $
  30. */
  31. #ifndef _SBSOCRAM_H
  32. #define _SBSOCRAM_H
  33. #ifndef _LANGUAGE_ASSEMBLY
  34. /* cpp contortions to concatenate w/arg prescan */
  35. #ifndef PAD
  36. #define _PADLINE(line) pad ## line
  37. #define _XSTR(line) _PADLINE(line)
  38. #define PAD _XSTR(__LINE__)
  39. #endif /* PAD */
  40. /* Memcsocram core registers */
  41. typedef volatile struct sbsocramregs {
  42. uint32 coreinfo;
  43. uint32 bwalloc;
  44. uint32 extracoreinfo;
  45. uint32 biststat;
  46. uint32 bankidx;
  47. uint32 standbyctrl;
  48. uint32 errlogstatus; /* rev 6 */
  49. uint32 errlogaddr; /* rev 6 */
  50. /* used for patching rev 3 & 5 */
  51. uint32 cambankidx;
  52. uint32 cambankstandbyctrl;
  53. uint32 cambankpatchctrl;
  54. uint32 cambankpatchtblbaseaddr;
  55. uint32 cambankcmdreg;
  56. uint32 cambankdatareg;
  57. uint32 cambankmaskreg;
  58. uint32 PAD[1];
  59. uint32 bankinfo; /* corev 8 */
  60. uint32 bankpda;
  61. uint32 PAD[14];
  62. uint32 extmemconfig;
  63. uint32 extmemparitycsr;
  64. uint32 extmemparityerrdata;
  65. uint32 extmemparityerrcnt;
  66. uint32 extmemwrctrlandsize;
  67. uint32 PAD[84];
  68. uint32 workaround;
  69. uint32 pwrctl; /* corerev >= 2 */
  70. uint32 PAD[133];
  71. uint32 sr_control; /* corerev >= 15 */
  72. uint32 sr_status; /* corerev >= 15 */
  73. uint32 sr_address; /* corerev >= 15 */
  74. uint32 sr_data; /* corerev >= 15 */
  75. } sbsocramregs_t;
  76. #endif /* _LANGUAGE_ASSEMBLY */
  77. /* Register offsets */
  78. #define SR_COREINFO 0x00
  79. #define SR_BWALLOC 0x04
  80. #define SR_BISTSTAT 0x0c
  81. #define SR_BANKINDEX 0x10
  82. #define SR_BANKSTBYCTL 0x14
  83. #define SR_PWRCTL 0x1e8
  84. /* Coreinfo register */
  85. #define SRCI_PT_MASK 0x00070000 /* corerev >= 6; port type[18:16] */
  86. #define SRCI_PT_SHIFT 16
  87. /* port types : SRCI_PT_<processorPT>_<backplanePT> */
  88. #define SRCI_PT_OCP_OCP 0
  89. #define SRCI_PT_AXI_OCP 1
  90. #define SRCI_PT_ARM7AHB_OCP 2
  91. #define SRCI_PT_CM3AHB_OCP 3
  92. #define SRCI_PT_AXI_AXI 4
  93. #define SRCI_PT_AHB_AXI 5
  94. /* corerev >= 3 */
  95. #define SRCI_LSS_MASK 0x00f00000
  96. #define SRCI_LSS_SHIFT 20
  97. #define SRCI_LRS_MASK 0x0f000000
  98. #define SRCI_LRS_SHIFT 24
  99. /* In corerev 0, the memory size is 2 to the power of the
  100. * base plus 16 plus to the contents of the memsize field plus 1.
  101. */
  102. #define SRCI_MS0_MASK 0xf
  103. #define SR_MS0_BASE 16
  104. /*
  105. * In corerev 1 the bank size is 2 ^ the bank size field plus 14,
  106. * the memory size is number of banks times bank size.
  107. * The same applies to rom size.
  108. */
  109. #define SRCI_ROMNB_MASK 0xf000
  110. #define SRCI_ROMNB_SHIFT 12
  111. #define SRCI_ROMBSZ_MASK 0xf00
  112. #define SRCI_ROMBSZ_SHIFT 8
  113. #define SRCI_SRNB_MASK 0xf0
  114. #define SRCI_SRNB_SHIFT 4
  115. #define SRCI_SRBSZ_MASK 0xf
  116. #define SRCI_SRBSZ_SHIFT 0
  117. #define SRCI_SRNB_MASK_EXT 0x100
  118. #define SR_BSZ_BASE 14
  119. /* Standby control register */
  120. #define SRSC_SBYOVR_MASK 0x80000000
  121. #define SRSC_SBYOVR_SHIFT 31
  122. #define SRSC_SBYOVRVAL_MASK 0x60000000
  123. #define SRSC_SBYOVRVAL_SHIFT 29
  124. #define SRSC_SBYEN_MASK 0x01000000 /* rev >= 3 */
  125. #define SRSC_SBYEN_SHIFT 24
  126. /* Power control register */
  127. #define SRPC_PMU_STBYDIS_MASK 0x00000010 /* rev >= 3 */
  128. #define SRPC_PMU_STBYDIS_SHIFT 4
  129. #define SRPC_STBYOVRVAL_MASK 0x00000008
  130. #define SRPC_STBYOVRVAL_SHIFT 3
  131. #define SRPC_STBYOVR_MASK 0x00000007
  132. #define SRPC_STBYOVR_SHIFT 0
  133. /* Extra core capability register */
  134. #define SRECC_NUM_BANKS_MASK 0x000000F0
  135. #define SRECC_NUM_BANKS_SHIFT 4
  136. #define SRECC_BANKSIZE_MASK 0x0000000F
  137. #define SRECC_BANKSIZE_SHIFT 0
  138. #define SRECC_BANKSIZE(value) (1 << (value))
  139. /* CAM bank patch control */
  140. #define SRCBPC_PATCHENABLE 0x80000000
  141. #define SRP_ADDRESS 0x0001FFFC
  142. #define SRP_VALID 0x8000
  143. /* CAM bank command reg */
  144. #define SRCMD_WRITE 0x00020000
  145. #define SRCMD_READ 0x00010000
  146. #define SRCMD_DONE 0x80000000
  147. #define SRCMD_DONE_DLY 1000
  148. /* bankidx and bankinfo reg defines corerev >= 8 */
  149. #define SOCRAM_BANKINFO_SZMASK 0x7f
  150. #define SOCRAM_BANKIDX_ROM_MASK 0x100
  151. #define SOCRAM_BANKIDX_MEMTYPE_SHIFT 8
  152. /* socram bankinfo memtype */
  153. #define SOCRAM_MEMTYPE_RAM 0
  154. #define SOCRAM_MEMTYPE_ROM 1
  155. #define SOCRAM_MEMTYPE_DEVRAM 2
  156. #define SOCRAM_BANKINFO_REG 0x40
  157. #define SOCRAM_BANKIDX_REG 0x10
  158. #define SOCRAM_BANKINFO_STDBY_MASK 0x400
  159. #define SOCRAM_BANKINFO_STDBY_TIMER 0x800
  160. /* bankinfo rev >= 10 */
  161. #define SOCRAM_BANKINFO_DEVRAMSEL_SHIFT 13
  162. #define SOCRAM_BANKINFO_DEVRAMSEL_MASK 0x2000
  163. #define SOCRAM_BANKINFO_DEVRAMPRO_SHIFT 14
  164. #define SOCRAM_BANKINFO_DEVRAMPRO_MASK 0x4000
  165. #define SOCRAM_BANKINFO_SLPSUPP_SHIFT 15
  166. #define SOCRAM_BANKINFO_SLPSUPP_MASK 0x8000
  167. #define SOCRAM_BANKINFO_RETNTRAM_SHIFT 16
  168. #define SOCRAM_BANKINFO_RETNTRAM_MASK 0x00010000
  169. #define SOCRAM_BANKINFO_PDASZ_SHIFT 17
  170. #define SOCRAM_BANKINFO_PDASZ_MASK 0x003E0000
  171. #define SOCRAM_BANKINFO_DEVRAMREMAP_SHIFT 24
  172. #define SOCRAM_BANKINFO_DEVRAMREMAP_MASK 0x01000000
  173. /* extracoreinfo register */
  174. #define SOCRAM_DEVRAMBANK_MASK 0xF000
  175. #define SOCRAM_DEVRAMBANK_SHIFT 12
  176. /* bank info to calculate bank size */
  177. #define SOCRAM_BANKINFO_SZBASE 8192
  178. #define SOCRAM_BANKSIZE_SHIFT 13 /* SOCRAM_BANKINFO_SZBASE */
  179. #endif /* _SBSOCRAM_H */