sbsysmem.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. /*
  2. * SiliconBackplane System Memory 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: sbsysmem.h 563229 2015-06-12 04:50:06Z $
  30. */
  31. #ifndef _SBSYSMEM_H
  32. #define _SBSYSMEM_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. /* sysmem core registers */
  41. typedef volatile struct sysmemregs {
  42. uint32 coreinfo;
  43. uint32 bwalloc;
  44. uint32 extracoreinfo;
  45. uint32 biststat;
  46. uint32 bankidx;
  47. uint32 standbyctrl;
  48. uint32 errlogstatus;
  49. uint32 errlogaddr;
  50. uint32 cambankidx;
  51. uint32 cambankstandbyctrl;
  52. uint32 cambankpatchctrl;
  53. uint32 cambankpatchtblbaseaddr;
  54. uint32 cambankcmdreg;
  55. uint32 cambankdatareg;
  56. uint32 cambankmaskreg;
  57. uint32 PAD[1];
  58. uint32 bankinfo;
  59. uint32 PAD[15];
  60. uint32 extmemconfig;
  61. uint32 extmemparitycsr;
  62. uint32 extmemparityerrdata;
  63. uint32 extmemparityerrcnt;
  64. uint32 extmemwrctrlandsize;
  65. uint32 PAD[84];
  66. uint32 workaround;
  67. uint32 pwrctl;
  68. uint32 PAD[133];
  69. uint32 sr_control;
  70. uint32 sr_status;
  71. uint32 sr_address;
  72. uint32 sr_data;
  73. } sysmemregs_t;
  74. #endif /* _LANGUAGE_ASSEMBLY */
  75. /* Register offsets */
  76. #define SR_COREINFO 0x00
  77. #define SR_BWALLOC 0x04
  78. #define SR_BISTSTAT 0x0c
  79. #define SR_BANKINDEX 0x10
  80. #define SR_BANKSTBYCTL 0x14
  81. #define SR_PWRCTL 0x1e8
  82. /* Coreinfo register */
  83. #define SRCI_PT_MASK 0x00070000 /* port type[18:16] */
  84. #define SRCI_PT_SHIFT 16
  85. /* port types : SRCI_PT_<processorPT>_<backplanePT> */
  86. #define SRCI_PT_OCP_OCP 0
  87. #define SRCI_PT_AXI_OCP 1
  88. #define SRCI_PT_ARM7AHB_OCP 2
  89. #define SRCI_PT_CM3AHB_OCP 3
  90. #define SRCI_PT_AXI_AXI 4
  91. #define SRCI_PT_AHB_AXI 5
  92. #define SRCI_LSS_MASK 0x00f00000
  93. #define SRCI_LSS_SHIFT 20
  94. #define SRCI_LRS_MASK 0x0f000000
  95. #define SRCI_LRS_SHIFT 24
  96. /* In corerev 0, the memory size is 2 to the power of the
  97. * base plus 16 plus to the contents of the memsize field plus 1.
  98. */
  99. #define SRCI_MS0_MASK 0xf
  100. #define SR_MS0_BASE 16
  101. /*
  102. * In corerev 1 the bank size is 2 ^ the bank size field plus 14,
  103. * the memory size is number of banks times bank size.
  104. * The same applies to rom size.
  105. */
  106. #define SYSMEM_SRCI_ROMNB_MASK 0x3e0
  107. #define SYSMEM_SRCI_ROMNB_SHIFT 5
  108. #define SYSMEM_SRCI_SRNB_MASK 0x1f
  109. #define SYSMEM_SRCI_SRNB_SHIFT 0
  110. /* Standby control register */
  111. #define SRSC_SBYOVR_MASK 0x80000000
  112. #define SRSC_SBYOVR_SHIFT 31
  113. #define SRSC_SBYOVRVAL_MASK 0x60000000
  114. #define SRSC_SBYOVRVAL_SHIFT 29
  115. #define SRSC_SBYEN_MASK 0x01000000
  116. #define SRSC_SBYEN_SHIFT 24
  117. /* Power control register */
  118. #define SRPC_PMU_STBYDIS_MASK 0x00000010
  119. #define SRPC_PMU_STBYDIS_SHIFT 4
  120. #define SRPC_STBYOVRVAL_MASK 0x00000008
  121. #define SRPC_STBYOVRVAL_SHIFT 3
  122. #define SRPC_STBYOVR_MASK 0x00000007
  123. #define SRPC_STBYOVR_SHIFT 0
  124. /* Extra core capability register */
  125. #define SRECC_NUM_BANKS_MASK 0x000000F0
  126. #define SRECC_NUM_BANKS_SHIFT 4
  127. #define SRECC_BANKSIZE_MASK 0x0000000F
  128. #define SRECC_BANKSIZE_SHIFT 0
  129. #define SRECC_BANKSIZE(value) (1 << (value))
  130. /* CAM bank patch control */
  131. #define SRCBPC_PATCHENABLE 0x80000000
  132. #define SRP_ADDRESS 0x0001FFFC
  133. #define SRP_VALID 0x8000
  134. /* CAM bank command reg */
  135. #define SRCMD_WRITE 0x00020000
  136. #define SRCMD_READ 0x00010000
  137. #define SRCMD_DONE 0x80000000
  138. #define SRCMD_DONE_DLY 1000
  139. /* bankidx and bankinfo reg defines */
  140. #define SYSMEM_BANKINFO_SZMASK 0x7f
  141. #define SYSMEM_BANKIDX_ROM_MASK 0x80
  142. #define SYSMEM_BANKINFO_REG 0x40
  143. #define SYSMEM_BANKIDX_REG 0x10
  144. #define SYSMEM_BANKINFO_STDBY_MASK 0x200
  145. #define SYSMEM_BANKINFO_STDBY_TIMER 0x400
  146. #define SYSMEM_BANKINFO_SLPSUPP_SHIFT 14
  147. #define SYSMEM_BANKINFO_SLPSUPP_MASK 0x4000
  148. #define SYSMEM_BANKINFO_PDASZ_SHIFT 16
  149. #define SYSMEM_BANKINFO_PDASZ_MASK 0x001F0000
  150. /* extracoreinfo register */
  151. #define SYSMEM_DEVRAMBANK_MASK 0xF000
  152. #define SYSMEM_DEVRAMBANK_SHIFT 12
  153. /* bank info to calculate bank size */
  154. #define SYSMEM_BANKINFO_SZBASE 8192
  155. #define SYSMEM_BANKSIZE_SHIFT 13 /* SYSMEM_BANKINFO_SZBASE */
  156. #endif /* _SBSYSMEM_H */