blob: f165b8c36ba445cf01d53b41206c3b5247e3cbf3 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Dipen Dudhat00c42942011-01-20 16:29:35 +05302/*
3 * Copyright 2010-2011 Freescale Semiconductor, Inc.
4 * Author: Dipen Dudhat <dipen.dudhat@freescale.com>
Dipen Dudhat00c42942011-01-20 16:29:35 +05305 */
6
7#include <common.h>
York Sun37562f62013-10-22 12:39:02 -07008#include <fsl_ifc.h>
Simon Glass655306c2020-05-10 11:39:58 -06009#include <part.h>
Dipen Dudhat00c42942011-01-20 16:29:35 +053010
Rajesh Bhagat76e1d472018-12-27 04:37:51 +000011#ifdef CONFIG_TFABOOT
Pankit Garg92d443b2018-11-05 18:01:33 +000012struct ifc_regs ifc_cfg_default_boot[CONFIG_SYS_FSL_IFC_BANK_COUNT] = {
13 {
14 "cs0",
Tom Rini6a5dccc2022-11-16 13:10:41 -050015#if defined(CFG_SYS_CSPR0) && defined(CFG_SYS_CSOR0)
16 CFG_SYS_CSPR0,
17#ifdef CFG_SYS_CSPR0_EXT
18 CFG_SYS_CSPR0_EXT,
Pankit Garg92d443b2018-11-05 18:01:33 +000019#else
20 0,
Kumar Gala7bc4f622012-08-17 08:20:25 +000021#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -050022#ifdef CFG_SYS_AMASK0
23 CFG_SYS_AMASK0,
Pankit Garg92d443b2018-11-05 18:01:33 +000024#else
25 0,
26#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -050027 CFG_SYS_CSOR0,
Pankit Garg92d443b2018-11-05 18:01:33 +000028 {
Tom Rini6a5dccc2022-11-16 13:10:41 -050029 CFG_SYS_CS0_FTIM0,
30 CFG_SYS_CS0_FTIM1,
31 CFG_SYS_CS0_FTIM2,
32 CFG_SYS_CS0_FTIM3,
Pankit Garg92d443b2018-11-05 18:01:33 +000033 },
Tom Rini6a5dccc2022-11-16 13:10:41 -050034#ifdef CFG_SYS_CSOR0_EXT
35 CFG_SYS_CSOR0_EXT,
Pankit Garg92d443b2018-11-05 18:01:33 +000036#else
37 0,
38#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -050039#ifdef CFG_SYS_CSPR0_FINAL
40 CFG_SYS_CSPR0_FINAL,
Pankit Garg92d443b2018-11-05 18:01:33 +000041#else
42 0,
Prabhakar Kushwahaa3aaf1d2013-10-04 10:05:36 +053043#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -050044#ifdef CFG_SYS_AMASK0_FINAL
45 CFG_SYS_AMASK0_FINAL,
Pankit Garg92d443b2018-11-05 18:01:33 +000046#else
47 0,
Dipen Dudhat00c42942011-01-20 16:29:35 +053048#endif
Poonam Aggrwal46b86ca2011-07-07 20:36:47 +053049#endif
Pankit Garg92d443b2018-11-05 18:01:33 +000050 },
Dipen Dudhat00c42942011-01-20 16:29:35 +053051
Pankit Garg92d443b2018-11-05 18:01:33 +000052#if CONFIG_SYS_FSL_IFC_BANK_COUNT >= 2
53 {
54 "cs1",
Tom Rini6a5dccc2022-11-16 13:10:41 -050055#if defined(CFG_SYS_CSPR1) && defined(CFG_SYS_CSOR1)
56 CFG_SYS_CSPR1,
57#ifdef CFG_SYS_CSPR1_EXT
58 CFG_SYS_CSPR1_EXT,
Pankit Garg92d443b2018-11-05 18:01:33 +000059#else
60 0,
Kumar Gala7bc4f622012-08-17 08:20:25 +000061#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -050062#ifdef CFG_SYS_AMASK1
63 CFG_SYS_AMASK1,
Pankit Garg92d443b2018-11-05 18:01:33 +000064#else
65 0,
66#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -050067 CFG_SYS_CSOR1,
Pankit Garg92d443b2018-11-05 18:01:33 +000068 {
Tom Rini6a5dccc2022-11-16 13:10:41 -050069 CFG_SYS_CS1_FTIM0,
70 CFG_SYS_CS1_FTIM1,
71 CFG_SYS_CS1_FTIM2,
72 CFG_SYS_CS1_FTIM3,
Pankit Garg92d443b2018-11-05 18:01:33 +000073 },
Tom Rini6a5dccc2022-11-16 13:10:41 -050074#ifdef CFG_SYS_CSOR1_EXT
75 CFG_SYS_CSOR1_EXT,
Pankit Garg92d443b2018-11-05 18:01:33 +000076#else
77 0,
Prabhakar Kushwahaa3aaf1d2013-10-04 10:05:36 +053078#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -050079#ifdef CFG_SYS_CSPR1_FINAL
80 CFG_SYS_CSPR1_FINAL,
Pankit Garg92d443b2018-11-05 18:01:33 +000081#else
82 0,
83#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -050084#ifdef CFG_SYS_AMASK1_FINAL
85 CFG_SYS_AMASK1_FINAL,
Pankit Garg92d443b2018-11-05 18:01:33 +000086#else
87 0,
88#endif
89#endif
90 },
Dipen Dudhat00c42942011-01-20 16:29:35 +053091#endif
92
Pankit Garg92d443b2018-11-05 18:01:33 +000093#if CONFIG_SYS_FSL_IFC_BANK_COUNT >= 3
94 {
95 "cs2",
Tom Rini6a5dccc2022-11-16 13:10:41 -050096#if defined(CFG_SYS_CSPR2) && defined(CFG_SYS_CSOR2)
97 CFG_SYS_CSPR2,
98#ifdef CFG_SYS_CSPR2_EXT
99 CFG_SYS_CSPR2_EXT,
Pankit Garg92d443b2018-11-05 18:01:33 +0000100#else
101 0,
Kumar Gala7bc4f622012-08-17 08:20:25 +0000102#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500103#ifdef CFG_SYS_AMASK2
104 CFG_SYS_AMASK2,
Pankit Garg92d443b2018-11-05 18:01:33 +0000105#else
106 0,
107#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500108 CFG_SYS_CSOR2,
Pankit Garg92d443b2018-11-05 18:01:33 +0000109 {
Tom Rini6a5dccc2022-11-16 13:10:41 -0500110 CFG_SYS_CS2_FTIM0,
111 CFG_SYS_CS2_FTIM1,
112 CFG_SYS_CS2_FTIM2,
113 CFG_SYS_CS2_FTIM3,
Pankit Garg92d443b2018-11-05 18:01:33 +0000114 },
Tom Rini6a5dccc2022-11-16 13:10:41 -0500115#ifdef CFG_SYS_CSOR2_EXT
116 CFG_SYS_CSOR2_EXT,
Pankit Garg92d443b2018-11-05 18:01:33 +0000117#else
118 0,
Prabhakar Kushwahaa3aaf1d2013-10-04 10:05:36 +0530119#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500120#ifdef CFG_SYS_CSPR2_FINAL
121 CFG_SYS_CSPR2_FINAL,
Pankit Garg92d443b2018-11-05 18:01:33 +0000122#else
123 0,
124#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500125#ifdef CFG_SYS_AMASK2_FINAL
126 CFG_SYS_AMASK2_FINAL,
Pankit Garg92d443b2018-11-05 18:01:33 +0000127#else
128 0,
129#endif
130#endif
131 },
Dipen Dudhat00c42942011-01-20 16:29:35 +0530132#endif
133
Pankit Garg92d443b2018-11-05 18:01:33 +0000134#if CONFIG_SYS_FSL_IFC_BANK_COUNT >= 4
135 {
136 "cs3",
Tom Rini6a5dccc2022-11-16 13:10:41 -0500137#if defined(CFG_SYS_CSPR3) && defined(CFG_SYS_CSOR3)
138 CFG_SYS_CSPR3,
139#ifdef CFG_SYS_CSPR3_EXT
140 CFG_SYS_CSPR3_EXT,
Pankit Garg92d443b2018-11-05 18:01:33 +0000141#else
142 0,
143#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500144#ifdef CFG_SYS_AMASK3
145 CFG_SYS_AMASK3,
Pankit Garg92d443b2018-11-05 18:01:33 +0000146#else
147 0,
Kumar Gala7bc4f622012-08-17 08:20:25 +0000148#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500149 CFG_SYS_CSOR3,
Pankit Garg92d443b2018-11-05 18:01:33 +0000150 {
Tom Rini6a5dccc2022-11-16 13:10:41 -0500151 CFG_SYS_CS3_FTIM0,
152 CFG_SYS_CS3_FTIM1,
153 CFG_SYS_CS3_FTIM2,
154 CFG_SYS_CS3_FTIM3,
Pankit Garg92d443b2018-11-05 18:01:33 +0000155 },
Tom Rini6a5dccc2022-11-16 13:10:41 -0500156#ifdef CFG_SYS_CSOR3_EXT
157 CFG_SYS_CSOR3_EXT,
Pankit Garg92d443b2018-11-05 18:01:33 +0000158#else
159 0,
Prabhakar Kushwahaa3aaf1d2013-10-04 10:05:36 +0530160#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500161#ifdef CFG_SYS_CSPR3_FINAL
162 CFG_SYS_CSPR3_FINAL,
Pankit Garg92d443b2018-11-05 18:01:33 +0000163#else
164 0,
165#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500166#ifdef CFG_SYS_AMASK3_FINAL
167 CFG_SYS_AMASK3_FINAL,
Pankit Garg92d443b2018-11-05 18:01:33 +0000168#else
169 0,
170#endif
171#endif
172 },
Dipen Dudhat00c42942011-01-20 16:29:35 +0530173#endif
Mingkai Hu6f024c92013-05-16 10:18:13 +0800174
Pankit Garg92d443b2018-11-05 18:01:33 +0000175#if CONFIG_SYS_FSL_IFC_BANK_COUNT >= 5
176 {
177 "cs4",
Tom Rini6a5dccc2022-11-16 13:10:41 -0500178#if defined(CFG_SYS_CSPR4) && defined(CFG_SYS_CSOR4)
179 CFG_SYS_CSPR4,
180#ifdef CFG_SYS_CSPR4_EXT
181 CFG_SYS_CSPR4_EXT,
Pankit Garg92d443b2018-11-05 18:01:33 +0000182#else
183 0,
Mingkai Hu6f024c92013-05-16 10:18:13 +0800184#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500185#ifdef CFG_SYS_AMASK4
186 CFG_SYS_AMASK4,
Pankit Garg92d443b2018-11-05 18:01:33 +0000187#else
188 0,
189#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500190 CFG_SYS_CSOR4,
Pankit Garg92d443b2018-11-05 18:01:33 +0000191 {
Tom Rini6a5dccc2022-11-16 13:10:41 -0500192 CFG_SYS_CS4_FTIM0,
193 CFG_SYS_CS4_FTIM1,
194 CFG_SYS_CS4_FTIM2,
195 CFG_SYS_CS4_FTIM3,
Pankit Garg92d443b2018-11-05 18:01:33 +0000196 },
Tom Rini6a5dccc2022-11-16 13:10:41 -0500197#ifdef CFG_SYS_CSOR4_EXT
198 CFG_SYS_CSOR4_EXT,
Pankit Garg92d443b2018-11-05 18:01:33 +0000199#else
200 0,
Prabhakar Kushwahaa3aaf1d2013-10-04 10:05:36 +0530201#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500202#ifdef CFG_SYS_CSPR4_FINAL
203 CFG_SYS_CSPR4_FINAL,
Pankit Garg92d443b2018-11-05 18:01:33 +0000204#else
205 0,
206#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500207#ifdef CFG_SYS_AMASK4_FINAL
208 CFG_SYS_AMASK4_FINAL,
Pankit Garg92d443b2018-11-05 18:01:33 +0000209#else
210 0,
211#endif
212#endif
213 },
Mingkai Hu6f024c92013-05-16 10:18:13 +0800214#endif
215
Pankit Garg92d443b2018-11-05 18:01:33 +0000216#if CONFIG_SYS_FSL_IFC_BANK_COUNT >= 6
217 {
218 "cs5",
219#if defined(CONFIG_SYS_CSPR5) && defined(CONFIG_SYS_CSOR5)
220 CONFIG_SYS_CSPR5,
Mingkai Hu6f024c92013-05-16 10:18:13 +0800221#ifdef CONFIG_SYS_CSPR5_EXT
Pankit Garg92d443b2018-11-05 18:01:33 +0000222 CONFIG_SYS_CSPR5_EXT,
223#else
224 0,
Mingkai Hu6f024c92013-05-16 10:18:13 +0800225#endif
Pankit Garg92d443b2018-11-05 18:01:33 +0000226#ifdef CONFIG_SYS_AMASK5
227 CONFIG_SYS_AMASK5,
228#else
229 0,
230#endif
231 CONFIG_SYS_CSOR5,
232 {
233 CONFIG_SYS_CS5_FTIM0,
234 CONFIG_SYS_CS5_FTIM1,
235 CONFIG_SYS_CS5_FTIM2,
236 CONFIG_SYS_CS5_FTIM3,
237 },
Prabhakar Kushwahaa3aaf1d2013-10-04 10:05:36 +0530238#ifdef CONFIG_SYS_CSOR5_EXT
Pankit Garg92d443b2018-11-05 18:01:33 +0000239 CONFIG_SYS_CSOR5_EXT,
240#else
241 0,
Prabhakar Kushwahaa3aaf1d2013-10-04 10:05:36 +0530242#endif
Pankit Garg92d443b2018-11-05 18:01:33 +0000243#ifdef CONFIG_SYS_CSPR5_FINAL
244 CONFIG_SYS_CSPR5_FINAL,
245#else
246 0,
247#endif
248#ifdef CONFIG_SYS_AMASK5_FINAL
249 CONFIG_SYS_AMASK5_FINAL,
250#else
251 0,
252#endif
253#endif
254 },
Mingkai Hu6f024c92013-05-16 10:18:13 +0800255#endif
256
Pankit Garg92d443b2018-11-05 18:01:33 +0000257#if CONFIG_SYS_FSL_IFC_BANK_COUNT >= 7
258 {
259 "cs6",
Tom Rini6a5dccc2022-11-16 13:10:41 -0500260#if defined(CFG_SYS_CSPR6) && defined(CFG_SYS_CSOR6)
261 CFG_SYS_CSPR6,
262#ifdef CFG_SYS_CSPR6_EXT
263 CFG_SYS_CSPR6_EXT,
Pankit Garg92d443b2018-11-05 18:01:33 +0000264#else
265 0,
266#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500267#ifdef CFG_SYS_AMASK6
268 CFG_SYS_AMASK6,
Pankit Garg92d443b2018-11-05 18:01:33 +0000269#else
270 0,
Mingkai Hu6f024c92013-05-16 10:18:13 +0800271#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500272 CFG_SYS_CSOR6,
Pankit Garg92d443b2018-11-05 18:01:33 +0000273 {
Tom Rini6a5dccc2022-11-16 13:10:41 -0500274 CFG_SYS_CS6_FTIM0,
275 CFG_SYS_CS6_FTIM1,
276 CFG_SYS_CS6_FTIM2,
277 CFG_SYS_CS6_FTIM3,
Pankit Garg92d443b2018-11-05 18:01:33 +0000278 },
Tom Rini6a5dccc2022-11-16 13:10:41 -0500279#ifdef CFG_SYS_CSOR6_EXT
280 CFG_SYS_CSOR6_EXT,
Pankit Garg92d443b2018-11-05 18:01:33 +0000281#else
282 0,
Prabhakar Kushwahaa3aaf1d2013-10-04 10:05:36 +0530283#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500284#ifdef CFG_SYS_CSPR6_FINAL
285 CFG_SYS_CSPR6_FINAL,
Pankit Garg92d443b2018-11-05 18:01:33 +0000286#else
287 0,
Mingkai Hu6f024c92013-05-16 10:18:13 +0800288#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500289#ifdef CFG_SYS_AMASK6_FINAL
290 CFG_SYS_AMASK6_FINAL,
Pankit Garg92d443b2018-11-05 18:01:33 +0000291#else
292 0,
Mingkai Hu6f024c92013-05-16 10:18:13 +0800293#endif
Prabhakar Kushwahaa3aaf1d2013-10-04 10:05:36 +0530294#endif
Pankit Garg92d443b2018-11-05 18:01:33 +0000295 },
Mingkai Hu6f024c92013-05-16 10:18:13 +0800296#endif
York Sund377b612014-03-19 13:52:34 -0700297
Pankit Garg92d443b2018-11-05 18:01:33 +0000298#if CONFIG_SYS_FSL_IFC_BANK_COUNT >= 8
299 {
300 "cs7",
Tom Rini6a5dccc2022-11-16 13:10:41 -0500301#if defined(CFG_SYS_CSPR7) && defined(CFG_SYS_CSOR7)
302 CFG_SYS_CSPR7,
303#ifdef CFG_SYS_CSPR7_EXT
304 CFG_SYS_CSPR7_EXT,
Pankit Garg92d443b2018-11-05 18:01:33 +0000305#else
306 0,
York Sund377b612014-03-19 13:52:34 -0700307#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500308#ifdef CFG_SYS_AMASK7
309 CFG_SYS_AMASK7,
Pankit Garg92d443b2018-11-05 18:01:33 +0000310#else
311 0,
Scott Wood8e728cd2015-03-24 13:25:02 -0700312#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500313 CFG_SYS_CSOR7,
314#ifdef CFG_SYS_CSOR7_EXT
315 CFG_SYS_CSOR7_EXT,
Pankit Garg92d443b2018-11-05 18:01:33 +0000316#else
317 0,
Prabhakar Kushwaha1c56fb22015-03-19 09:20:48 -0700318#endif
Pankit Garg92d443b2018-11-05 18:01:33 +0000319 {
Tom Rini6a5dccc2022-11-16 13:10:41 -0500320 CFG_SYS_CS7_FTIM0,
321 CFG_SYS_CS7_FTIM1,
322 CFG_SYS_CS7_FTIM2,
323 CFG_SYS_CS7_FTIM3,
Pankit Garg92d443b2018-11-05 18:01:33 +0000324 },
Tom Rini6a5dccc2022-11-16 13:10:41 -0500325#ifdef CFG_SYS_CSPR7_FINAL
326 CFG_SYS_CSPR7_FINAL,
Pankit Garg92d443b2018-11-05 18:01:33 +0000327#else
328 0,
Scott Wood8e728cd2015-03-24 13:25:02 -0700329#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500330#ifdef CFG_SYS_AMASK7_FINAL
331 CFG_SYS_AMASK7_FINAL,
Pankit Garg92d443b2018-11-05 18:01:33 +0000332#else
333 0,
Scott Wood8e728cd2015-03-24 13:25:02 -0700334#endif
Prabhakar Kushwaha1c56fb22015-03-19 09:20:48 -0700335#endif
Pankit Garg92d443b2018-11-05 18:01:33 +0000336 },
Scott Wood8e728cd2015-03-24 13:25:02 -0700337#endif
Pankit Garg92d443b2018-11-05 18:01:33 +0000338};
339
340__weak void ifc_cfg_boot_info(struct ifc_regs_info *regs_info)
341{
342 regs_info->regs = ifc_cfg_default_boot;
343 regs_info->cs_size = CONFIG_SYS_FSL_IFC_BANK_COUNT;
344}
Rajesh Bhagat76e1d472018-12-27 04:37:51 +0000345#endif
Pankit Garg92d443b2018-11-05 18:01:33 +0000346
347void print_ifc_regs(void)
348{
349 int i, j;
350
351 printf("IFC Controller Registers\n");
352 for (i = 0; i < CONFIG_SYS_FSL_IFC_BANK_COUNT; i++) {
353 printf("CSPR%d:0x%08X\tAMASK%d:0x%08X\tCSOR%d:0x%08X\n",
354 i, get_ifc_cspr(i), i, get_ifc_amask(i),
355 i, get_ifc_csor(i));
356 for (j = 0; j < 4; j++)
357 printf("IFC_FTIM%d:0x%08X\n", j, get_ifc_ftim(i, j));
358 }
359}
360
Rajesh Bhagat76e1d472018-12-27 04:37:51 +0000361#ifdef CONFIG_TFABOOT
Pankit Garg92d443b2018-11-05 18:01:33 +0000362void init_early_memctl_regs(void)
363{
364 int i, j;
365 struct ifc_regs *regs;
366 struct ifc_regs_info regs_info = {0};
367
368 ifc_cfg_boot_info(&regs_info);
369 regs = regs_info.regs;
370
371 for (i = 0 ; i < regs_info.cs_size; i++) {
372 if (regs[i].pr && (regs[i].pr & CSPR_V)) {
373 /* skip setting cspr/csor_ext in below condition */
Simon Glassa6b682d2023-02-05 15:36:08 -0700374 if (!(IS_ENABLED(CONFIG_A003399_NOR_WORKAROUND) &&
Pankit Garg92d443b2018-11-05 18:01:33 +0000375 i == 0 &&
376 ((regs[0].pr & CSPR_MSEL) == CSPR_MSEL_NOR))) {
377 if (regs[i].pr_ext)
378 set_ifc_cspr_ext(i, regs[i].pr_ext);
379 if (regs[i].or_ext)
380 set_ifc_csor_ext(i, regs[i].or_ext);
381 }
382
383 for (j = 0; j < ARRAY_SIZE(regs->ftim); j++)
384 set_ifc_ftim(i, j, regs[i].ftim[j]);
385
386 set_ifc_csor(i, regs[i].or);
387 set_ifc_amask(i, regs[i].amask);
388 set_ifc_cspr(i, regs[i].pr);
389 }
390 }
391}
392
393void init_final_memctl_regs(void)
394{
395 int i;
396 struct ifc_regs *regs;
397 struct ifc_regs_info regs_info;
398
399 ifc_cfg_boot_info(&regs_info);
400 regs = regs_info.regs;
401
402 for (i = 0 ; i < regs_info.cs_size && i < ARRAY_SIZE(regs->ftim); i++) {
403 if (!(regs[i].pr_final & CSPR_V))
404 continue;
405 if (regs[i].pr_final)
406 set_ifc_cspr(i, regs[i].pr_final);
407 if (regs[i].amask_final)
408 set_ifc_amask(i, (i == 1) ? regs[i].amask_final :
409 regs[i].amask);
410 }
York Sund377b612014-03-19 13:52:34 -0700411}
Rajesh Bhagat76e1d472018-12-27 04:37:51 +0000412#else
413void init_early_memctl_regs(void)
414{
Tom Rini6a5dccc2022-11-16 13:10:41 -0500415#if defined(CFG_SYS_CSPR0) && defined(CFG_SYS_CSOR0)
416 set_ifc_ftim(IFC_CS0, IFC_FTIM0, CFG_SYS_CS0_FTIM0);
417 set_ifc_ftim(IFC_CS0, IFC_FTIM1, CFG_SYS_CS0_FTIM1);
418 set_ifc_ftim(IFC_CS0, IFC_FTIM2, CFG_SYS_CS0_FTIM2);
419 set_ifc_ftim(IFC_CS0, IFC_FTIM3, CFG_SYS_CS0_FTIM3);
Rajesh Bhagat76e1d472018-12-27 04:37:51 +0000420
421#ifndef CONFIG_A003399_NOR_WORKAROUND
Tom Rini6a5dccc2022-11-16 13:10:41 -0500422#ifdef CFG_SYS_CSPR0_EXT
423 set_ifc_cspr_ext(IFC_CS0, CFG_SYS_CSPR0_EXT);
Rajesh Bhagat76e1d472018-12-27 04:37:51 +0000424#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500425#ifdef CFG_SYS_CSOR0_EXT
426 set_ifc_csor_ext(IFC_CS0, CFG_SYS_CSOR0_EXT);
Rajesh Bhagat76e1d472018-12-27 04:37:51 +0000427#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500428 set_ifc_cspr(IFC_CS0, CFG_SYS_CSPR0);
429 set_ifc_amask(IFC_CS0, CFG_SYS_AMASK0);
430 set_ifc_csor(IFC_CS0, CFG_SYS_CSOR0);
Rajesh Bhagat76e1d472018-12-27 04:37:51 +0000431#endif
432#endif
433
Tom Rini6a5dccc2022-11-16 13:10:41 -0500434#ifdef CFG_SYS_CSPR1_EXT
435 set_ifc_cspr_ext(IFC_CS1, CFG_SYS_CSPR1_EXT);
Rajesh Bhagat76e1d472018-12-27 04:37:51 +0000436#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500437#ifdef CFG_SYS_CSOR1_EXT
438 set_ifc_csor_ext(IFC_CS1, CFG_SYS_CSOR1_EXT);
Rajesh Bhagat76e1d472018-12-27 04:37:51 +0000439#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500440#if defined(CFG_SYS_CSPR1) && defined(CFG_SYS_CSOR1)
441 set_ifc_ftim(IFC_CS1, IFC_FTIM0, CFG_SYS_CS1_FTIM0);
442 set_ifc_ftim(IFC_CS1, IFC_FTIM1, CFG_SYS_CS1_FTIM1);
443 set_ifc_ftim(IFC_CS1, IFC_FTIM2, CFG_SYS_CS1_FTIM2);
444 set_ifc_ftim(IFC_CS1, IFC_FTIM3, CFG_SYS_CS1_FTIM3);
Rajesh Bhagat76e1d472018-12-27 04:37:51 +0000445
Tom Rini6a5dccc2022-11-16 13:10:41 -0500446 set_ifc_csor(IFC_CS1, CFG_SYS_CSOR1);
447 set_ifc_amask(IFC_CS1, CFG_SYS_AMASK1);
448 set_ifc_cspr(IFC_CS1, CFG_SYS_CSPR1);
Rajesh Bhagat76e1d472018-12-27 04:37:51 +0000449#endif
450
Tom Rini6a5dccc2022-11-16 13:10:41 -0500451#ifdef CFG_SYS_CSPR2_EXT
452 set_ifc_cspr_ext(IFC_CS2, CFG_SYS_CSPR2_EXT);
Rajesh Bhagat76e1d472018-12-27 04:37:51 +0000453#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500454#ifdef CFG_SYS_CSOR2_EXT
455 set_ifc_csor_ext(IFC_CS2, CFG_SYS_CSOR2_EXT);
Rajesh Bhagat76e1d472018-12-27 04:37:51 +0000456#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500457#if defined(CFG_SYS_CSPR2) && defined(CFG_SYS_CSOR2)
458 set_ifc_ftim(IFC_CS2, IFC_FTIM0, CFG_SYS_CS2_FTIM0);
459 set_ifc_ftim(IFC_CS2, IFC_FTIM1, CFG_SYS_CS2_FTIM1);
460 set_ifc_ftim(IFC_CS2, IFC_FTIM2, CFG_SYS_CS2_FTIM2);
461 set_ifc_ftim(IFC_CS2, IFC_FTIM3, CFG_SYS_CS2_FTIM3);
Rajesh Bhagat76e1d472018-12-27 04:37:51 +0000462
Tom Rini6a5dccc2022-11-16 13:10:41 -0500463 set_ifc_csor(IFC_CS2, CFG_SYS_CSOR2);
464 set_ifc_amask(IFC_CS2, CFG_SYS_AMASK2);
465 set_ifc_cspr(IFC_CS2, CFG_SYS_CSPR2);
Rajesh Bhagat76e1d472018-12-27 04:37:51 +0000466#endif
467
Tom Rini6a5dccc2022-11-16 13:10:41 -0500468#ifdef CFG_SYS_CSPR3_EXT
469 set_ifc_cspr_ext(IFC_CS3, CFG_SYS_CSPR3_EXT);
Rajesh Bhagat76e1d472018-12-27 04:37:51 +0000470#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500471#ifdef CFG_SYS_CSOR3_EXT
472 set_ifc_csor_ext(IFC_CS3, CFG_SYS_CSOR3_EXT);
Rajesh Bhagat76e1d472018-12-27 04:37:51 +0000473#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500474#if defined(CFG_SYS_CSPR3) && defined(CFG_SYS_CSOR3)
475 set_ifc_ftim(IFC_CS3, IFC_FTIM0, CFG_SYS_CS3_FTIM0);
476 set_ifc_ftim(IFC_CS3, IFC_FTIM1, CFG_SYS_CS3_FTIM1);
477 set_ifc_ftim(IFC_CS3, IFC_FTIM2, CFG_SYS_CS3_FTIM2);
478 set_ifc_ftim(IFC_CS3, IFC_FTIM3, CFG_SYS_CS3_FTIM3);
Rajesh Bhagat76e1d472018-12-27 04:37:51 +0000479
Tom Rini6a5dccc2022-11-16 13:10:41 -0500480 set_ifc_cspr(IFC_CS3, CFG_SYS_CSPR3);
481 set_ifc_amask(IFC_CS3, CFG_SYS_AMASK3);
482 set_ifc_csor(IFC_CS3, CFG_SYS_CSOR3);
Rajesh Bhagat76e1d472018-12-27 04:37:51 +0000483#endif
484
Tom Rini6a5dccc2022-11-16 13:10:41 -0500485#ifdef CFG_SYS_CSPR4_EXT
486 set_ifc_cspr_ext(IFC_CS4, CFG_SYS_CSPR4_EXT);
Rajesh Bhagat76e1d472018-12-27 04:37:51 +0000487#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500488#ifdef CFG_SYS_CSOR4_EXT
489 set_ifc_csor_ext(IFC_CS4, CFG_SYS_CSOR4_EXT);
Rajesh Bhagat76e1d472018-12-27 04:37:51 +0000490#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500491#if defined(CFG_SYS_CSPR4) && defined(CFG_SYS_CSOR4)
492 set_ifc_ftim(IFC_CS4, IFC_FTIM0, CFG_SYS_CS4_FTIM0);
493 set_ifc_ftim(IFC_CS4, IFC_FTIM1, CFG_SYS_CS4_FTIM1);
494 set_ifc_ftim(IFC_CS4, IFC_FTIM2, CFG_SYS_CS4_FTIM2);
495 set_ifc_ftim(IFC_CS4, IFC_FTIM3, CFG_SYS_CS4_FTIM3);
Rajesh Bhagat76e1d472018-12-27 04:37:51 +0000496
Tom Rini6a5dccc2022-11-16 13:10:41 -0500497 set_ifc_cspr(IFC_CS4, CFG_SYS_CSPR4);
498 set_ifc_amask(IFC_CS4, CFG_SYS_AMASK4);
499 set_ifc_csor(IFC_CS4, CFG_SYS_CSOR4);
Rajesh Bhagat76e1d472018-12-27 04:37:51 +0000500#endif
501
502#ifdef CONFIG_SYS_CSPR5_EXT
503 set_ifc_cspr_ext(IFC_CS5, CONFIG_SYS_CSPR5_EXT);
504#endif
505#ifdef CONFIG_SYS_CSOR5_EXT
506 set_ifc_csor_ext(IFC_CS5, CONFIG_SYS_CSOR5_EXT);
507#endif
508#if defined(CONFIG_SYS_CSPR5) && defined(CONFIG_SYS_CSOR5)
509 set_ifc_ftim(IFC_CS5, IFC_FTIM0, CONFIG_SYS_CS5_FTIM0);
510 set_ifc_ftim(IFC_CS5, IFC_FTIM1, CONFIG_SYS_CS5_FTIM1);
511 set_ifc_ftim(IFC_CS5, IFC_FTIM2, CONFIG_SYS_CS5_FTIM2);
512 set_ifc_ftim(IFC_CS5, IFC_FTIM3, CONFIG_SYS_CS5_FTIM3);
513
514 set_ifc_cspr(IFC_CS5, CONFIG_SYS_CSPR5);
515 set_ifc_amask(IFC_CS5, CONFIG_SYS_AMASK5);
516 set_ifc_csor(IFC_CS5, CONFIG_SYS_CSOR5);
517#endif
518
Tom Rini6a5dccc2022-11-16 13:10:41 -0500519#ifdef CFG_SYS_CSPR6_EXT
520 set_ifc_cspr_ext(IFC_CS6, CFG_SYS_CSPR6_EXT);
Rajesh Bhagat76e1d472018-12-27 04:37:51 +0000521#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500522#ifdef CFG_SYS_CSOR6_EXT
523 set_ifc_csor_ext(IFC_CS6, CFG_SYS_CSOR6_EXT);
Rajesh Bhagat76e1d472018-12-27 04:37:51 +0000524#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500525#if defined(CFG_SYS_CSPR6) && defined(CFG_SYS_CSOR6)
526 set_ifc_ftim(IFC_CS6, IFC_FTIM0, CFG_SYS_CS6_FTIM0);
527 set_ifc_ftim(IFC_CS6, IFC_FTIM1, CFG_SYS_CS6_FTIM1);
528 set_ifc_ftim(IFC_CS6, IFC_FTIM2, CFG_SYS_CS6_FTIM2);
529 set_ifc_ftim(IFC_CS6, IFC_FTIM3, CFG_SYS_CS6_FTIM3);
Rajesh Bhagat76e1d472018-12-27 04:37:51 +0000530
Tom Rini6a5dccc2022-11-16 13:10:41 -0500531 set_ifc_cspr(IFC_CS6, CFG_SYS_CSPR6);
532 set_ifc_amask(IFC_CS6, CFG_SYS_AMASK6);
533 set_ifc_csor(IFC_CS6, CFG_SYS_CSOR6);
Rajesh Bhagat76e1d472018-12-27 04:37:51 +0000534#endif
535
Tom Rini6a5dccc2022-11-16 13:10:41 -0500536#ifdef CFG_SYS_CSPR7_EXT
537 set_ifc_cspr_ext(IFC_CS7, CFG_SYS_CSPR7_EXT);
Rajesh Bhagat76e1d472018-12-27 04:37:51 +0000538#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500539#ifdef CFG_SYS_CSOR7_EXT
540 set_ifc_csor_ext(IFC_CS7, CFG_SYS_CSOR7_EXT);
Rajesh Bhagat76e1d472018-12-27 04:37:51 +0000541#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500542#if defined(CFG_SYS_CSPR7) && defined(CFG_SYS_CSOR7)
543 set_ifc_ftim(IFC_CS7, IFC_FTIM0, CFG_SYS_CS7_FTIM0);
544 set_ifc_ftim(IFC_CS7, IFC_FTIM1, CFG_SYS_CS7_FTIM1);
545 set_ifc_ftim(IFC_CS7, IFC_FTIM2, CFG_SYS_CS7_FTIM2);
546 set_ifc_ftim(IFC_CS7, IFC_FTIM3, CFG_SYS_CS7_FTIM3);
Rajesh Bhagat76e1d472018-12-27 04:37:51 +0000547
Tom Rini6a5dccc2022-11-16 13:10:41 -0500548 set_ifc_cspr(IFC_CS7, CFG_SYS_CSPR7);
549 set_ifc_amask(IFC_CS7, CFG_SYS_AMASK7);
550 set_ifc_csor(IFC_CS7, CFG_SYS_CSOR7);
Rajesh Bhagat76e1d472018-12-27 04:37:51 +0000551#endif
552}
553
554void init_final_memctl_regs(void)
555{
Tom Rini6a5dccc2022-11-16 13:10:41 -0500556#ifdef CFG_SYS_CSPR0_FINAL
557 set_ifc_cspr(IFC_CS0, CFG_SYS_CSPR0_FINAL);
Rajesh Bhagat76e1d472018-12-27 04:37:51 +0000558#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500559#ifdef CFG_SYS_AMASK0_FINAL
560 set_ifc_amask(IFC_CS0, CFG_SYS_AMASK0);
Rajesh Bhagat76e1d472018-12-27 04:37:51 +0000561#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500562#ifdef CFG_SYS_CSPR1_FINAL
563 set_ifc_cspr(IFC_CS1, CFG_SYS_CSPR1_FINAL);
Rajesh Bhagat76e1d472018-12-27 04:37:51 +0000564#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500565#ifdef CFG_SYS_AMASK1_FINAL
566 set_ifc_amask(IFC_CS1, CFG_SYS_AMASK1_FINAL);
Rajesh Bhagat76e1d472018-12-27 04:37:51 +0000567#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500568#ifdef CFG_SYS_CSPR2_FINAL
569 set_ifc_cspr(IFC_CS2, CFG_SYS_CSPR2_FINAL);
Rajesh Bhagat76e1d472018-12-27 04:37:51 +0000570#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500571#ifdef CFG_SYS_AMASK2_FINAL
572 set_ifc_amask(IFC_CS2, CFG_SYS_AMASK2);
Rajesh Bhagat76e1d472018-12-27 04:37:51 +0000573#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500574#ifdef CFG_SYS_CSPR3_FINAL
575 set_ifc_cspr(IFC_CS3, CFG_SYS_CSPR3_FINAL);
Rajesh Bhagat76e1d472018-12-27 04:37:51 +0000576#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500577#ifdef CFG_SYS_AMASK3_FINAL
578 set_ifc_amask(IFC_CS3, CFG_SYS_AMASK3);
Rajesh Bhagat76e1d472018-12-27 04:37:51 +0000579#endif
580}
581#endif