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