2 * BCM47XX Sonics SiliconBackplane embedded ram core
4 * Copyright (C) 1999-2011, Broadcom Corporation
6 * Unless you and Broadcom execute a separate written software license
7 * agreement governing use of this software, this software is licensed to you
8 * under the terms of the GNU General Public License version 2 (the "GPL"),
9 * available at http://www.broadcom.com/licenses/GPLv2.php, with the
10 * following added to such license:
12 * As a special exception, the copyright holders of this software give you
13 * permission to link this software with independent modules, and to copy and
14 * distribute the resulting executable under terms of your choice, provided that
15 * you also meet, for each linked independent module, the terms and conditions of
16 * the license of that module. An independent module is a module which is not
17 * derived from this software. The special exception does not apply to any
18 * modifications of the software.
20 * Notwithstanding the above, under no circumstances may you combine this
21 * software in any way with any other Broadcom software provided under a license
22 * other than the GPL, without Broadcom's express prior written consent.
24 * $Id: sbsocram.h,v 13.15 2009-10-02 16:55:44 $
30 #ifndef _LANGUAGE_ASSEMBLY
32 /* cpp contortions to concatenate w/arg prescan */
34 #define _PADLINE(line) pad ## line
35 #define _XSTR(line) _PADLINE(line)
36 #define PAD _XSTR(__LINE__)
39 /* Memcsocram core registers */
40 typedef volatile struct sbsocramregs {
48 uint32 errlogstatus; /* rev 6 */
49 uint32 errlogaddr; /* rev 6 */
50 /* used for patching rev 3 & 5 */
52 uint32 cambankstandbyctrl;
53 uint32 cambankpatchctrl;
54 uint32 cambankpatchtblbaseaddr;
56 uint32 cambankdatareg;
57 uint32 cambankmaskreg;
59 uint32 bankinfo; /* corev 8 */
62 uint32 extmemparitycsr;
63 uint32 extmemparityerrdata;
64 uint32 extmemparityerrcnt;
65 uint32 extmemwrctrlandsize;
68 uint32 pwrctl; /* corerev >= 2 */
71 #endif /* _LANGUAGE_ASSEMBLY */
73 /* Register offsets */
74 #define SR_COREINFO 0x00
75 #define SR_BWALLOC 0x04
76 #define SR_BISTSTAT 0x0c
77 #define SR_BANKINDEX 0x10
78 #define SR_BANKSTBYCTL 0x14
79 #define SR_PWRCTL 0x1e8
81 /* Coreinfo register */
82 #define SRCI_PT_MASK 0x00070000 /* corerev >= 6; port type[18:16] */
83 #define SRCI_PT_SHIFT 16
84 /* port types : SRCI_PT_<processorPT>_<backplanePT> */
85 #define SRCI_PT_OCP_OCP 0
86 #define SRCI_PT_AXI_OCP 1
87 #define SRCI_PT_ARM7AHB_OCP 2
88 #define SRCI_PT_CM3AHB_OCP 3
89 #define SRCI_PT_AXI_AXI 4
90 #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
97 /* In corerev 0, the memory size is 2 to the power of the
98 * base plus 16 plus to the contents of the memsize field plus 1.
100 #define SRCI_MS0_MASK 0xf
101 #define SR_MS0_BASE 16
104 * In corerev 1 the bank size is 2 ^ the bank size field plus 14,
105 * the memory size is number of banks times bank size.
106 * The same applies to rom size.
108 #define SRCI_ROMNB_MASK 0xf000
109 #define SRCI_ROMNB_SHIFT 12
110 #define SRCI_ROMBSZ_MASK 0xf00
111 #define SRCI_ROMBSZ_SHIFT 8
112 #define SRCI_SRNB_MASK 0xf0
113 #define SRCI_SRNB_SHIFT 4
114 #define SRCI_SRBSZ_MASK 0xf
115 #define SRCI_SRBSZ_SHIFT 0
117 #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
127 /* Power control register */
128 #define SRPC_PMU_STBYDIS_MASK 0x00000010 /* rev >= 3 */
129 #define SRPC_PMU_STBYDIS_SHIFT 4
130 #define SRPC_STBYOVRVAL_MASK 0x00000008
131 #define SRPC_STBYOVRVAL_SHIFT 3
132 #define SRPC_STBYOVR_MASK 0x00000007
133 #define SRPC_STBYOVR_SHIFT 0
135 /* Extra core capability register */
136 #define SRECC_NUM_BANKS_MASK 0x000000F0
137 #define SRECC_NUM_BANKS_SHIFT 4
138 #define SRECC_BANKSIZE_MASK 0x0000000F
139 #define SRECC_BANKSIZE_SHIFT 0
141 #define SRECC_BANKSIZE(value) (1 << (value))
143 /* CAM bank patch control */
144 #define SRCBPC_PATCHENABLE 0x80000000
146 #define SRP_ADDRESS 0x0001FFFC
147 #define SRP_VALID 0x8000
149 /* CAM bank command reg */
150 #define SRCMD_WRITE 0x00020000
151 #define SRCMD_READ 0x00010000
152 #define SRCMD_DONE 0x80000000
154 #define SRCMD_DONE_DLY 1000
156 /* bankidx and bankinfo reg defines corerev >= 8 */
157 #define SOCRAM_BANKINFO_SZMASK 0x3f
158 #define SOCRAM_BANKIDX_ROM_MASK 0x100
160 #define SOCRAM_BANKIDX_MEMTYPE_SHIFT 8
161 /* socram bankinfo memtype */
162 #define SOCRAM_MEMTYPE_RAM 0
163 #define SOCRAM_MEMTYPE_R0M 1
164 #define SOCRAM_MEMTYPE_DEVRAM 2
166 #define SOCRAM_BANKINFO_REG 0x40
167 #define SOCRAM_BANKIDX_REG 0x10
168 #define SOCRAM_BANKINFO_STDBY_MASK 0x400
169 #define SOCRAM_BANKINFO_STDBY_TIMER 0x800
171 /* bankinfo rev >= 10 */
172 #define SOCRAM_BANKINFO_DEVRAMSEL_SHIFT 13
173 #define SOCRAM_BANKINFO_DEVRAMSEL_MASK 0x2000
174 #define SOCRAM_BANKINFO_DEVRAMPRO_SHIFT 14
175 #define SOCRAM_BANKINFO_DEVRAMPRO_MASK 0x4000
177 /* extracoreinfo register */
178 #define SOCRAM_DEVRAMBANK_MASK 0xF000
179 #define SOCRAM_DEVRAMBANK_SHIFT 12
181 /* bank info to calculate bank size */
182 #define SOCRAM_BANKINFO_SZBASE 8192
183 #define SOCRAM_BANKSIZE_SHIFT 13 /* SOCRAM_BANKINFO_SZBASE */
186 #endif /* _SBSOCRAM_H */