blob: 957ecf18745a1a9b9ed16704f0156d0749bffe33 [file] [log] [blame]
Pritesh Raithatha9eb5db52017-01-02 19:42:31 +05301/*
2 * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved.
3 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Pritesh Raithatha9eb5db52017-01-02 19:42:31 +05305 */
6
7#include <bl_common.h>
8#include <memctrl_v2.h>
9
10/*******************************************************************************
11 * Array to hold stream_id override config register offsets
12 ******************************************************************************/
13const static uint32_t tegra186_streamid_override_regs[] = {
14 MC_STREAMID_OVERRIDE_CFG_PTCR,
15 MC_STREAMID_OVERRIDE_CFG_AFIR,
16 MC_STREAMID_OVERRIDE_CFG_HDAR,
17 MC_STREAMID_OVERRIDE_CFG_HOST1XDMAR,
18 MC_STREAMID_OVERRIDE_CFG_NVENCSRD,
19 MC_STREAMID_OVERRIDE_CFG_SATAR,
20 MC_STREAMID_OVERRIDE_CFG_MPCORER,
21 MC_STREAMID_OVERRIDE_CFG_NVENCSWR,
22 MC_STREAMID_OVERRIDE_CFG_AFIW,
23 MC_STREAMID_OVERRIDE_CFG_HDAW,
24 MC_STREAMID_OVERRIDE_CFG_MPCOREW,
25 MC_STREAMID_OVERRIDE_CFG_SATAW,
26 MC_STREAMID_OVERRIDE_CFG_ISPRA,
27 MC_STREAMID_OVERRIDE_CFG_ISPWA,
28 MC_STREAMID_OVERRIDE_CFG_ISPWB,
29 MC_STREAMID_OVERRIDE_CFG_XUSB_HOSTR,
30 MC_STREAMID_OVERRIDE_CFG_XUSB_HOSTW,
31 MC_STREAMID_OVERRIDE_CFG_XUSB_DEVR,
32 MC_STREAMID_OVERRIDE_CFG_XUSB_DEVW,
33 MC_STREAMID_OVERRIDE_CFG_TSECSRD,
34 MC_STREAMID_OVERRIDE_CFG_TSECSWR,
35 MC_STREAMID_OVERRIDE_CFG_GPUSRD,
36 MC_STREAMID_OVERRIDE_CFG_GPUSWR,
37 MC_STREAMID_OVERRIDE_CFG_SDMMCRA,
38 MC_STREAMID_OVERRIDE_CFG_SDMMCRAA,
39 MC_STREAMID_OVERRIDE_CFG_SDMMCR,
40 MC_STREAMID_OVERRIDE_CFG_SDMMCRAB,
41 MC_STREAMID_OVERRIDE_CFG_SDMMCWA,
42 MC_STREAMID_OVERRIDE_CFG_SDMMCWAA,
43 MC_STREAMID_OVERRIDE_CFG_SDMMCW,
44 MC_STREAMID_OVERRIDE_CFG_SDMMCWAB,
45 MC_STREAMID_OVERRIDE_CFG_VICSRD,
46 MC_STREAMID_OVERRIDE_CFG_VICSWR,
47 MC_STREAMID_OVERRIDE_CFG_VIW,
48 MC_STREAMID_OVERRIDE_CFG_NVDECSRD,
49 MC_STREAMID_OVERRIDE_CFG_NVDECSWR,
50 MC_STREAMID_OVERRIDE_CFG_APER,
51 MC_STREAMID_OVERRIDE_CFG_APEW,
52 MC_STREAMID_OVERRIDE_CFG_NVJPGSRD,
53 MC_STREAMID_OVERRIDE_CFG_NVJPGSWR,
54 MC_STREAMID_OVERRIDE_CFG_SESRD,
55 MC_STREAMID_OVERRIDE_CFG_SESWR,
56 MC_STREAMID_OVERRIDE_CFG_ETRR,
57 MC_STREAMID_OVERRIDE_CFG_ETRW,
58 MC_STREAMID_OVERRIDE_CFG_TSECSRDB,
59 MC_STREAMID_OVERRIDE_CFG_TSECSWRB,
60 MC_STREAMID_OVERRIDE_CFG_GPUSRD2,
61 MC_STREAMID_OVERRIDE_CFG_GPUSWR2,
62 MC_STREAMID_OVERRIDE_CFG_AXISR,
63 MC_STREAMID_OVERRIDE_CFG_AXISW,
64 MC_STREAMID_OVERRIDE_CFG_EQOSR,
65 MC_STREAMID_OVERRIDE_CFG_EQOSW,
66 MC_STREAMID_OVERRIDE_CFG_UFSHCR,
67 MC_STREAMID_OVERRIDE_CFG_UFSHCW,
68 MC_STREAMID_OVERRIDE_CFG_NVDISPLAYR,
69 MC_STREAMID_OVERRIDE_CFG_BPMPR,
70 MC_STREAMID_OVERRIDE_CFG_BPMPW,
71 MC_STREAMID_OVERRIDE_CFG_BPMPDMAR,
72 MC_STREAMID_OVERRIDE_CFG_BPMPDMAW,
73 MC_STREAMID_OVERRIDE_CFG_AONR,
74 MC_STREAMID_OVERRIDE_CFG_AONW,
75 MC_STREAMID_OVERRIDE_CFG_AONDMAR,
76 MC_STREAMID_OVERRIDE_CFG_AONDMAW,
77 MC_STREAMID_OVERRIDE_CFG_SCER,
78 MC_STREAMID_OVERRIDE_CFG_SCEW,
79 MC_STREAMID_OVERRIDE_CFG_SCEDMAR,
80 MC_STREAMID_OVERRIDE_CFG_SCEDMAW,
81 MC_STREAMID_OVERRIDE_CFG_APEDMAR,
82 MC_STREAMID_OVERRIDE_CFG_APEDMAW,
83 MC_STREAMID_OVERRIDE_CFG_NVDISPLAYR1,
84 MC_STREAMID_OVERRIDE_CFG_VICSRD1,
85 MC_STREAMID_OVERRIDE_CFG_NVDECSRD1
86};
87
88/*******************************************************************************
89 * Array to hold the security configs for stream IDs
90 ******************************************************************************/
91const static mc_streamid_security_cfg_t tegra186_streamid_sec_cfgs[] = {
92 mc_make_sec_cfg(SCEW, NON_SECURE, NO_OVERRIDE, ENABLE),
93 mc_make_sec_cfg(AFIR, NON_SECURE, OVERRIDE, ENABLE),
94 mc_make_sec_cfg(AFIW, NON_SECURE, OVERRIDE, ENABLE),
95 mc_make_sec_cfg(NVDISPLAYR1, NON_SECURE, OVERRIDE, ENABLE),
96 mc_make_sec_cfg(XUSB_DEVR, NON_SECURE, OVERRIDE, ENABLE),
97 mc_make_sec_cfg(VICSRD1, NON_SECURE, NO_OVERRIDE, ENABLE),
98 mc_make_sec_cfg(NVENCSWR, NON_SECURE, NO_OVERRIDE, ENABLE),
99 mc_make_sec_cfg(TSECSRDB, NON_SECURE, NO_OVERRIDE, ENABLE),
100 mc_make_sec_cfg(AXISW, SECURE, NO_OVERRIDE, DISABLE),
101 mc_make_sec_cfg(SDMMCWAB, NON_SECURE, OVERRIDE, ENABLE),
102 mc_make_sec_cfg(AONDMAW, NON_SECURE, NO_OVERRIDE, ENABLE),
103 mc_make_sec_cfg(GPUSWR2, SECURE, NO_OVERRIDE, DISABLE),
104 mc_make_sec_cfg(SATAW, NON_SECURE, OVERRIDE, ENABLE),
105 mc_make_sec_cfg(UFSHCW, NON_SECURE, OVERRIDE, ENABLE),
106 mc_make_sec_cfg(SDMMCR, NON_SECURE, OVERRIDE, ENABLE),
107 mc_make_sec_cfg(SCEDMAW, NON_SECURE, NO_OVERRIDE, ENABLE),
108 mc_make_sec_cfg(UFSHCR, NON_SECURE, OVERRIDE, ENABLE),
109 mc_make_sec_cfg(SDMMCWAA, NON_SECURE, OVERRIDE, ENABLE),
110 mc_make_sec_cfg(SESWR, NON_SECURE, NO_OVERRIDE, ENABLE),
111 mc_make_sec_cfg(MPCORER, NON_SECURE, OVERRIDE, ENABLE),
112 mc_make_sec_cfg(PTCR, NON_SECURE, OVERRIDE, ENABLE),
113 mc_make_sec_cfg(BPMPW, NON_SECURE, NO_OVERRIDE, ENABLE),
114 mc_make_sec_cfg(ETRW, NON_SECURE, OVERRIDE, ENABLE),
115 mc_make_sec_cfg(GPUSRD, SECURE, NO_OVERRIDE, DISABLE),
116 mc_make_sec_cfg(VICSWR, NON_SECURE, NO_OVERRIDE, ENABLE),
117 mc_make_sec_cfg(SCEDMAR, NON_SECURE, NO_OVERRIDE, ENABLE),
118 mc_make_sec_cfg(HDAW, NON_SECURE, OVERRIDE, ENABLE),
119 mc_make_sec_cfg(ISPWA, NON_SECURE, OVERRIDE, ENABLE),
120 mc_make_sec_cfg(EQOSW, NON_SECURE, OVERRIDE, ENABLE),
121 mc_make_sec_cfg(XUSB_HOSTW, NON_SECURE, OVERRIDE, ENABLE),
122 mc_make_sec_cfg(TSECSWR, NON_SECURE, NO_OVERRIDE, ENABLE),
123 mc_make_sec_cfg(SDMMCRAA, NON_SECURE, OVERRIDE, ENABLE),
124 mc_make_sec_cfg(VIW, NON_SECURE, OVERRIDE, ENABLE),
125 mc_make_sec_cfg(AXISR, SECURE, NO_OVERRIDE, DISABLE),
126 mc_make_sec_cfg(SDMMCW, NON_SECURE, OVERRIDE, ENABLE),
127 mc_make_sec_cfg(BPMPDMAW, NON_SECURE, NO_OVERRIDE, ENABLE),
128 mc_make_sec_cfg(ISPRA, NON_SECURE, OVERRIDE, ENABLE),
129 mc_make_sec_cfg(NVDECSWR, NON_SECURE, NO_OVERRIDE, ENABLE),
130 mc_make_sec_cfg(XUSB_DEVW, NON_SECURE, OVERRIDE, ENABLE),
131 mc_make_sec_cfg(NVDECSRD, NON_SECURE, NO_OVERRIDE, ENABLE),
132 mc_make_sec_cfg(MPCOREW, NON_SECURE, OVERRIDE, ENABLE),
133 mc_make_sec_cfg(NVDISPLAYR, NON_SECURE, OVERRIDE, ENABLE),
134 mc_make_sec_cfg(BPMPDMAR, NON_SECURE, NO_OVERRIDE, ENABLE),
135 mc_make_sec_cfg(NVJPGSWR, NON_SECURE, NO_OVERRIDE, ENABLE),
136 mc_make_sec_cfg(NVDECSRD1, NON_SECURE, NO_OVERRIDE, ENABLE),
137 mc_make_sec_cfg(TSECSRD, NON_SECURE, NO_OVERRIDE, ENABLE),
138 mc_make_sec_cfg(NVJPGSRD, NON_SECURE, NO_OVERRIDE, ENABLE),
139 mc_make_sec_cfg(SDMMCWA, NON_SECURE, OVERRIDE, ENABLE),
140 mc_make_sec_cfg(SCER, NON_SECURE, NO_OVERRIDE, ENABLE),
141 mc_make_sec_cfg(XUSB_HOSTR, NON_SECURE, OVERRIDE, ENABLE),
142 mc_make_sec_cfg(VICSRD, NON_SECURE, NO_OVERRIDE, ENABLE),
143 mc_make_sec_cfg(AONDMAR, NON_SECURE, NO_OVERRIDE, ENABLE),
144 mc_make_sec_cfg(AONW, NON_SECURE, NO_OVERRIDE, ENABLE),
145 mc_make_sec_cfg(SDMMCRA, NON_SECURE, OVERRIDE, ENABLE),
146 mc_make_sec_cfg(HOST1XDMAR, NON_SECURE, NO_OVERRIDE, ENABLE),
147 mc_make_sec_cfg(EQOSR, NON_SECURE, OVERRIDE, ENABLE),
148 mc_make_sec_cfg(SATAR, NON_SECURE, OVERRIDE, ENABLE),
149 mc_make_sec_cfg(BPMPR, NON_SECURE, NO_OVERRIDE, ENABLE),
150 mc_make_sec_cfg(HDAR, NON_SECURE, OVERRIDE, ENABLE),
151 mc_make_sec_cfg(SDMMCRAB, NON_SECURE, OVERRIDE, ENABLE),
152 mc_make_sec_cfg(ETRR, NON_SECURE, OVERRIDE, ENABLE),
153 mc_make_sec_cfg(AONR, NON_SECURE, NO_OVERRIDE, ENABLE),
154 mc_make_sec_cfg(SESRD, NON_SECURE, NO_OVERRIDE, ENABLE),
155 mc_make_sec_cfg(NVENCSRD, NON_SECURE, NO_OVERRIDE, ENABLE),
156 mc_make_sec_cfg(GPUSWR, SECURE, NO_OVERRIDE, DISABLE),
157 mc_make_sec_cfg(TSECSWRB, NON_SECURE, NO_OVERRIDE, ENABLE),
158 mc_make_sec_cfg(ISPWB, NON_SECURE, OVERRIDE, ENABLE),
159 mc_make_sec_cfg(GPUSRD2, SECURE, NO_OVERRIDE, DISABLE),
160 mc_make_sec_cfg(APEDMAW, NON_SECURE, NO_OVERRIDE, ENABLE),
161 mc_make_sec_cfg(APER, NON_SECURE, NO_OVERRIDE, ENABLE),
162 mc_make_sec_cfg(APEW, NON_SECURE, NO_OVERRIDE, ENABLE),
163 mc_make_sec_cfg(APEDMAR, NON_SECURE, NO_OVERRIDE, ENABLE),
164};
165
166/*******************************************************************************
167 * Array to hold the transaction override configs
168 ******************************************************************************/
169const static mc_txn_override_cfg_t tegra186_txn_override_cfgs[] = {
170 mc_make_txn_override_cfg(BPMPW, CGID_TAG_ADR),
171 mc_make_txn_override_cfg(EQOSW, CGID_TAG_ADR),
172 mc_make_txn_override_cfg(NVJPGSWR, CGID_TAG_ADR),
173 mc_make_txn_override_cfg(SDMMCWAA, CGID_TAG_ADR),
174 mc_make_txn_override_cfg(MPCOREW, CGID_TAG_ADR),
175 mc_make_txn_override_cfg(SCEDMAW, CGID_TAG_ADR),
176 mc_make_txn_override_cfg(SDMMCW, CGID_TAG_ADR),
177 mc_make_txn_override_cfg(AXISW, CGID_TAG_ADR),
178 mc_make_txn_override_cfg(TSECSWR, CGID_TAG_ADR),
179 mc_make_txn_override_cfg(GPUSWR, CGID_TAG_ADR),
180 mc_make_txn_override_cfg(XUSB_HOSTW, CGID_TAG_ADR),
181 mc_make_txn_override_cfg(TSECSWRB, CGID_TAG_ADR),
182 mc_make_txn_override_cfg(GPUSWR2, CGID_TAG_ADR),
183 mc_make_txn_override_cfg(AONDMAW, CGID_TAG_ADR),
184 mc_make_txn_override_cfg(AONW, CGID_TAG_ADR),
185 mc_make_txn_override_cfg(SESWR, CGID_TAG_ADR),
186 mc_make_txn_override_cfg(BPMPDMAW, CGID_TAG_ADR),
187 mc_make_txn_override_cfg(SDMMCWA, CGID_TAG_ADR),
188 mc_make_txn_override_cfg(HDAW, CGID_TAG_ADR),
189 mc_make_txn_override_cfg(NVDECSWR, CGID_TAG_ADR),
190 mc_make_txn_override_cfg(UFSHCW, CGID_TAG_ADR),
191 mc_make_txn_override_cfg(SATAW, CGID_TAG_ADR),
192 mc_make_txn_override_cfg(ETRW, CGID_TAG_ADR),
193 mc_make_txn_override_cfg(VICSWR, CGID_TAG_ADR),
194 mc_make_txn_override_cfg(NVENCSWR, CGID_TAG_ADR),
195 mc_make_txn_override_cfg(SDMMCWAB, CGID_TAG_ADR),
196 mc_make_txn_override_cfg(ISPWB, CGID_TAG_ADR),
197 mc_make_txn_override_cfg(APEW, CGID_TAG_ADR),
198 mc_make_txn_override_cfg(XUSB_DEVW, CGID_TAG_ADR),
199 mc_make_txn_override_cfg(AFIW, CGID_TAG_ADR),
200 mc_make_txn_override_cfg(SCEW, CGID_TAG_ADR),
201};
202
203/*******************************************************************************
204 * Struct to hold the memory controller settings
205 ******************************************************************************/
206static tegra_mc_settings_t tegra186_mc_settings = {
207 .streamid_override_cfg = tegra186_streamid_override_regs,
208 .num_streamid_override_cfgs = ARRAY_SIZE(tegra186_streamid_override_regs),
209 .streamid_security_cfg = tegra186_streamid_sec_cfgs,
210 .num_streamid_security_cfgs = ARRAY_SIZE(tegra186_streamid_sec_cfgs),
211 .txn_override_cfg = tegra186_txn_override_cfgs,
212 .num_txn_override_cfgs = ARRAY_SIZE(tegra186_txn_override_cfgs)
213};
214
215/*******************************************************************************
216 * Handler to return the pointer to the memory controller's settings struct
217 ******************************************************************************/
218tegra_mc_settings_t *tegra_get_mc_settings(void)
219{
220 return &tegra186_mc_settings;
221}