blob: f165b8c36ba445cf01d53b41206c3b5247e3cbf3 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Dipen Dudhatd789b5f2011-01-20 16:29:35 +05302/*
3 * Copyright 2010-2011 Freescale Semiconductor, Inc.
4 * Author: Dipen Dudhat <dipen.dudhat@freescale.com>
Dipen Dudhatd789b5f2011-01-20 16:29:35 +05305 */
6
7#include <common.h>
York Sun0b665132013-10-22 12:39:02 -07008#include <fsl_ifc.h>
Simon Glasse6f6f9e2020-05-10 11:39:58 -06009#include <part.h>
Dipen Dudhatd789b5f2011-01-20 16:29:35 +053010
Rajesh Bhagatbf0f7912018-12-27 04:37:51 +000011#ifdef CONFIG_TFABOOT
Pankit Garg9bd5fe72018-11-05 18:01:33 +000012struct ifc_regs ifc_cfg_default_boot[CONFIG_SYS_FSL_IFC_BANK_COUNT] = {
13 {
14 "cs0",
Tom Rini65cc0e22022-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 Garg9bd5fe72018-11-05 18:01:33 +000019#else
20 0,
21#endif
Tom Rini65cc0e22022-11-16 13:10:41 -050022#ifdef CFG_SYS_AMASK0
23 CFG_SYS_AMASK0,
Pankit Garg9bd5fe72018-11-05 18:01:33 +000024#else
25 0,
26#endif
Tom Rini65cc0e22022-11-16 13:10:41 -050027 CFG_SYS_CSOR0,
Pankit Garg9bd5fe72018-11-05 18:01:33 +000028 {
Tom Rini65cc0e22022-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 Garg9bd5fe72018-11-05 18:01:33 +000033 },
Tom Rini65cc0e22022-11-16 13:10:41 -050034#ifdef CFG_SYS_CSOR0_EXT
35 CFG_SYS_CSOR0_EXT,
Pankit Garg9bd5fe72018-11-05 18:01:33 +000036#else
37 0,
38#endif
Tom Rini65cc0e22022-11-16 13:10:41 -050039#ifdef CFG_SYS_CSPR0_FINAL
40 CFG_SYS_CSPR0_FINAL,
Pankit Garg9bd5fe72018-11-05 18:01:33 +000041#else
42 0,
43#endif
Tom Rini65cc0e22022-11-16 13:10:41 -050044#ifdef CFG_SYS_AMASK0_FINAL
45 CFG_SYS_AMASK0_FINAL,
Pankit Garg9bd5fe72018-11-05 18:01:33 +000046#else
47 0,
48#endif
49#endif
50 },
51
52#if CONFIG_SYS_FSL_IFC_BANK_COUNT >= 2
53 {
54 "cs1",
Tom Rini65cc0e22022-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 Garg9bd5fe72018-11-05 18:01:33 +000059#else
60 0,
61#endif
Tom Rini65cc0e22022-11-16 13:10:41 -050062#ifdef CFG_SYS_AMASK1
63 CFG_SYS_AMASK1,
Pankit Garg9bd5fe72018-11-05 18:01:33 +000064#else
65 0,
66#endif
Tom Rini65cc0e22022-11-16 13:10:41 -050067 CFG_SYS_CSOR1,
Pankit Garg9bd5fe72018-11-05 18:01:33 +000068 {
Tom Rini65cc0e22022-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 Garg9bd5fe72018-11-05 18:01:33 +000073 },
Tom Rini65cc0e22022-11-16 13:10:41 -050074#ifdef CFG_SYS_CSOR1_EXT
75 CFG_SYS_CSOR1_EXT,
Pankit Garg9bd5fe72018-11-05 18:01:33 +000076#else
77 0,
78#endif
Tom Rini65cc0e22022-11-16 13:10:41 -050079#ifdef CFG_SYS_CSPR1_FINAL
80 CFG_SYS_CSPR1_FINAL,
Pankit Garg9bd5fe72018-11-05 18:01:33 +000081#else
82 0,
83#endif
Tom Rini65cc0e22022-11-16 13:10:41 -050084#ifdef CFG_SYS_AMASK1_FINAL
85 CFG_SYS_AMASK1_FINAL,
Pankit Garg9bd5fe72018-11-05 18:01:33 +000086#else
87 0,
88#endif
89#endif
90 },
91#endif
92
93#if CONFIG_SYS_FSL_IFC_BANK_COUNT >= 3
94 {
95 "cs2",
Tom Rini65cc0e22022-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 Garg9bd5fe72018-11-05 18:01:33 +0000100#else
101 0,
102#endif
Tom Rini65cc0e22022-11-16 13:10:41 -0500103#ifdef CFG_SYS_AMASK2
104 CFG_SYS_AMASK2,
Pankit Garg9bd5fe72018-11-05 18:01:33 +0000105#else
106 0,
107#endif
Tom Rini65cc0e22022-11-16 13:10:41 -0500108 CFG_SYS_CSOR2,
Pankit Garg9bd5fe72018-11-05 18:01:33 +0000109 {
Tom Rini65cc0e22022-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 Garg9bd5fe72018-11-05 18:01:33 +0000114 },
Tom Rini65cc0e22022-11-16 13:10:41 -0500115#ifdef CFG_SYS_CSOR2_EXT
116 CFG_SYS_CSOR2_EXT,
Pankit Garg9bd5fe72018-11-05 18:01:33 +0000117#else
118 0,
119#endif
Tom Rini65cc0e22022-11-16 13:10:41 -0500120#ifdef CFG_SYS_CSPR2_FINAL
121 CFG_SYS_CSPR2_FINAL,
Pankit Garg9bd5fe72018-11-05 18:01:33 +0000122#else
123 0,
124#endif
Tom Rini65cc0e22022-11-16 13:10:41 -0500125#ifdef CFG_SYS_AMASK2_FINAL
126 CFG_SYS_AMASK2_FINAL,
Pankit Garg9bd5fe72018-11-05 18:01:33 +0000127#else
128 0,
129#endif
130#endif
131 },
132#endif
133
134#if CONFIG_SYS_FSL_IFC_BANK_COUNT >= 4
135 {
136 "cs3",
Tom Rini65cc0e22022-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 Garg9bd5fe72018-11-05 18:01:33 +0000141#else
142 0,
143#endif
Tom Rini65cc0e22022-11-16 13:10:41 -0500144#ifdef CFG_SYS_AMASK3
145 CFG_SYS_AMASK3,
Pankit Garg9bd5fe72018-11-05 18:01:33 +0000146#else
147 0,
148#endif
Tom Rini65cc0e22022-11-16 13:10:41 -0500149 CFG_SYS_CSOR3,
Pankit Garg9bd5fe72018-11-05 18:01:33 +0000150 {
Tom Rini65cc0e22022-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 Garg9bd5fe72018-11-05 18:01:33 +0000155 },
Tom Rini65cc0e22022-11-16 13:10:41 -0500156#ifdef CFG_SYS_CSOR3_EXT
157 CFG_SYS_CSOR3_EXT,
Pankit Garg9bd5fe72018-11-05 18:01:33 +0000158#else
159 0,
160#endif
Tom Rini65cc0e22022-11-16 13:10:41 -0500161#ifdef CFG_SYS_CSPR3_FINAL
162 CFG_SYS_CSPR3_FINAL,
Pankit Garg9bd5fe72018-11-05 18:01:33 +0000163#else
164 0,
165#endif
Tom Rini65cc0e22022-11-16 13:10:41 -0500166#ifdef CFG_SYS_AMASK3_FINAL
167 CFG_SYS_AMASK3_FINAL,
Pankit Garg9bd5fe72018-11-05 18:01:33 +0000168#else
169 0,
170#endif
171#endif
172 },
173#endif
174
175#if CONFIG_SYS_FSL_IFC_BANK_COUNT >= 5
176 {
177 "cs4",
Tom Rini65cc0e22022-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 Garg9bd5fe72018-11-05 18:01:33 +0000182#else
183 0,
184#endif
Tom Rini65cc0e22022-11-16 13:10:41 -0500185#ifdef CFG_SYS_AMASK4
186 CFG_SYS_AMASK4,
Pankit Garg9bd5fe72018-11-05 18:01:33 +0000187#else
188 0,
189#endif
Tom Rini65cc0e22022-11-16 13:10:41 -0500190 CFG_SYS_CSOR4,
Pankit Garg9bd5fe72018-11-05 18:01:33 +0000191 {
Tom Rini65cc0e22022-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 Garg9bd5fe72018-11-05 18:01:33 +0000196 },
Tom Rini65cc0e22022-11-16 13:10:41 -0500197#ifdef CFG_SYS_CSOR4_EXT
198 CFG_SYS_CSOR4_EXT,
Pankit Garg9bd5fe72018-11-05 18:01:33 +0000199#else
200 0,
201#endif
Tom Rini65cc0e22022-11-16 13:10:41 -0500202#ifdef CFG_SYS_CSPR4_FINAL
203 CFG_SYS_CSPR4_FINAL,
Pankit Garg9bd5fe72018-11-05 18:01:33 +0000204#else
205 0,
206#endif
Tom Rini65cc0e22022-11-16 13:10:41 -0500207#ifdef CFG_SYS_AMASK4_FINAL
208 CFG_SYS_AMASK4_FINAL,
Pankit Garg9bd5fe72018-11-05 18:01:33 +0000209#else
210 0,
211#endif
212#endif
213 },
214#endif
215
216#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,
221#ifdef CONFIG_SYS_CSPR5_EXT
222 CONFIG_SYS_CSPR5_EXT,
223#else
224 0,
225#endif
226#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 },
238#ifdef CONFIG_SYS_CSOR5_EXT
239 CONFIG_SYS_CSOR5_EXT,
240#else
241 0,
242#endif
243#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 },
255#endif
256
257#if CONFIG_SYS_FSL_IFC_BANK_COUNT >= 7
258 {
259 "cs6",
Tom Rini65cc0e22022-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 Garg9bd5fe72018-11-05 18:01:33 +0000264#else
265 0,
266#endif
Tom Rini65cc0e22022-11-16 13:10:41 -0500267#ifdef CFG_SYS_AMASK6
268 CFG_SYS_AMASK6,
Pankit Garg9bd5fe72018-11-05 18:01:33 +0000269#else
270 0,
271#endif
Tom Rini65cc0e22022-11-16 13:10:41 -0500272 CFG_SYS_CSOR6,
Pankit Garg9bd5fe72018-11-05 18:01:33 +0000273 {
Tom Rini65cc0e22022-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 Garg9bd5fe72018-11-05 18:01:33 +0000278 },
Tom Rini65cc0e22022-11-16 13:10:41 -0500279#ifdef CFG_SYS_CSOR6_EXT
280 CFG_SYS_CSOR6_EXT,
Pankit Garg9bd5fe72018-11-05 18:01:33 +0000281#else
282 0,
283#endif
Tom Rini65cc0e22022-11-16 13:10:41 -0500284#ifdef CFG_SYS_CSPR6_FINAL
285 CFG_SYS_CSPR6_FINAL,
Pankit Garg9bd5fe72018-11-05 18:01:33 +0000286#else
287 0,
288#endif
Tom Rini65cc0e22022-11-16 13:10:41 -0500289#ifdef CFG_SYS_AMASK6_FINAL
290 CFG_SYS_AMASK6_FINAL,
Pankit Garg9bd5fe72018-11-05 18:01:33 +0000291#else
292 0,
293#endif
294#endif
295 },
296#endif
297
298#if CONFIG_SYS_FSL_IFC_BANK_COUNT >= 8
299 {
300 "cs7",
Tom Rini65cc0e22022-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 Garg9bd5fe72018-11-05 18:01:33 +0000305#else
306 0,
307#endif
Tom Rini65cc0e22022-11-16 13:10:41 -0500308#ifdef CFG_SYS_AMASK7
309 CFG_SYS_AMASK7,
Pankit Garg9bd5fe72018-11-05 18:01:33 +0000310#else
311 0,
312#endif
Tom Rini65cc0e22022-11-16 13:10:41 -0500313 CFG_SYS_CSOR7,
314#ifdef CFG_SYS_CSOR7_EXT
315 CFG_SYS_CSOR7_EXT,
Pankit Garg9bd5fe72018-11-05 18:01:33 +0000316#else
317 0,
318#endif
319 {
Tom Rini65cc0e22022-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 Garg9bd5fe72018-11-05 18:01:33 +0000324 },
Tom Rini65cc0e22022-11-16 13:10:41 -0500325#ifdef CFG_SYS_CSPR7_FINAL
326 CFG_SYS_CSPR7_FINAL,
Pankit Garg9bd5fe72018-11-05 18:01:33 +0000327#else
328 0,
329#endif
Tom Rini65cc0e22022-11-16 13:10:41 -0500330#ifdef CFG_SYS_AMASK7_FINAL
331 CFG_SYS_AMASK7_FINAL,
Pankit Garg9bd5fe72018-11-05 18:01:33 +0000332#else
333 0,
334#endif
335#endif
336 },
337#endif
338};
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 Bhagatbf0f7912018-12-27 04:37:51 +0000345#endif
Pankit Garg9bd5fe72018-11-05 18:01:33 +0000346
Dipen Dudhatd789b5f2011-01-20 16:29:35 +0530347void print_ifc_regs(void)
348{
349 int i, j;
350
351 printf("IFC Controller Registers\n");
Mingkai Hu362ee042013-05-16 10:18:13 +0800352 for (i = 0; i < CONFIG_SYS_FSL_IFC_BANK_COUNT; i++) {
Dipen Dudhatd789b5f2011-01-20 16:29:35 +0530353 printf("CSPR%d:0x%08X\tAMASK%d:0x%08X\tCSOR%d:0x%08X\n",
Pankit Garg9bd5fe72018-11-05 18:01:33 +0000354 i, get_ifc_cspr(i), i, get_ifc_amask(i),
355 i, get_ifc_csor(i));
Dipen Dudhatd789b5f2011-01-20 16:29:35 +0530356 for (j = 0; j < 4; j++)
357 printf("IFC_FTIM%d:0x%08X\n", j, get_ifc_ftim(i, j));
358 }
359}
360
Rajesh Bhagatbf0f7912018-12-27 04:37:51 +0000361#ifdef CONFIG_TFABOOT
Dipen Dudhatd789b5f2011-01-20 16:29:35 +0530362void init_early_memctl_regs(void)
363{
Pankit Garg9bd5fe72018-11-05 18:01:33 +0000364 int i, j;
365 struct ifc_regs *regs;
366 struct ifc_regs_info regs_info = {0};
Dipen Dudhatd7da1482011-04-08 16:04:51 +0530367
Pankit Garg9bd5fe72018-11-05 18:01:33 +0000368 ifc_cfg_boot_info(&regs_info);
369 regs = regs_info.regs;
Dipen Dudhatd789b5f2011-01-20 16:29:35 +0530370
Pankit Garg9bd5fe72018-11-05 18:01:33 +0000371 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 Glass684787e2023-02-05 15:36:08 -0700374 if (!(IS_ENABLED(CONFIG_A003399_NOR_WORKAROUND) &&
Pankit Garg9bd5fe72018-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 }
Dipen Dudhatd7da1482011-04-08 16:04:51 +0530382
Pankit Garg9bd5fe72018-11-05 18:01:33 +0000383 for (j = 0; j < ARRAY_SIZE(regs->ftim); j++)
384 set_ifc_ftim(i, j, regs[i].ftim[j]);
Dipen Dudhatd789b5f2011-01-20 16:29:35 +0530385
Pankit Garg9bd5fe72018-11-05 18:01:33 +0000386 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 }
Dipen Dudhatd789b5f2011-01-20 16:29:35 +0530391}
York Sune77224e2014-03-19 13:52:34 -0700392
393void init_final_memctl_regs(void)
394{
Pankit Garg9bd5fe72018-11-05 18:01:33 +0000395 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 Sune77224e2014-03-19 13:52:34 -0700411}
Rajesh Bhagatbf0f7912018-12-27 04:37:51 +0000412#else
413void init_early_memctl_regs(void)
414{
Tom Rini65cc0e22022-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 Bhagatbf0f7912018-12-27 04:37:51 +0000420
421#ifndef CONFIG_A003399_NOR_WORKAROUND
Tom Rini65cc0e22022-11-16 13:10:41 -0500422#ifdef CFG_SYS_CSPR0_EXT
423 set_ifc_cspr_ext(IFC_CS0, CFG_SYS_CSPR0_EXT);
Rajesh Bhagatbf0f7912018-12-27 04:37:51 +0000424#endif
Tom Rini65cc0e22022-11-16 13:10:41 -0500425#ifdef CFG_SYS_CSOR0_EXT
426 set_ifc_csor_ext(IFC_CS0, CFG_SYS_CSOR0_EXT);
Rajesh Bhagatbf0f7912018-12-27 04:37:51 +0000427#endif
Tom Rini65cc0e22022-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 Bhagatbf0f7912018-12-27 04:37:51 +0000431#endif
432#endif
433
Tom Rini65cc0e22022-11-16 13:10:41 -0500434#ifdef CFG_SYS_CSPR1_EXT
435 set_ifc_cspr_ext(IFC_CS1, CFG_SYS_CSPR1_EXT);
Rajesh Bhagatbf0f7912018-12-27 04:37:51 +0000436#endif
Tom Rini65cc0e22022-11-16 13:10:41 -0500437#ifdef CFG_SYS_CSOR1_EXT
438 set_ifc_csor_ext(IFC_CS1, CFG_SYS_CSOR1_EXT);
Rajesh Bhagatbf0f7912018-12-27 04:37:51 +0000439#endif
Tom Rini65cc0e22022-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 Bhagatbf0f7912018-12-27 04:37:51 +0000445
Tom Rini65cc0e22022-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 Bhagatbf0f7912018-12-27 04:37:51 +0000449#endif
450
Tom Rini65cc0e22022-11-16 13:10:41 -0500451#ifdef CFG_SYS_CSPR2_EXT
452 set_ifc_cspr_ext(IFC_CS2, CFG_SYS_CSPR2_EXT);
Rajesh Bhagatbf0f7912018-12-27 04:37:51 +0000453#endif
Tom Rini65cc0e22022-11-16 13:10:41 -0500454#ifdef CFG_SYS_CSOR2_EXT
455 set_ifc_csor_ext(IFC_CS2, CFG_SYS_CSOR2_EXT);
Rajesh Bhagatbf0f7912018-12-27 04:37:51 +0000456#endif
Tom Rini65cc0e22022-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 Bhagatbf0f7912018-12-27 04:37:51 +0000462
Tom Rini65cc0e22022-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 Bhagatbf0f7912018-12-27 04:37:51 +0000466#endif
467
Tom Rini65cc0e22022-11-16 13:10:41 -0500468#ifdef CFG_SYS_CSPR3_EXT
469 set_ifc_cspr_ext(IFC_CS3, CFG_SYS_CSPR3_EXT);
Rajesh Bhagatbf0f7912018-12-27 04:37:51 +0000470#endif
Tom Rini65cc0e22022-11-16 13:10:41 -0500471#ifdef CFG_SYS_CSOR3_EXT
472 set_ifc_csor_ext(IFC_CS3, CFG_SYS_CSOR3_EXT);
Rajesh Bhagatbf0f7912018-12-27 04:37:51 +0000473#endif
Tom Rini65cc0e22022-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 Bhagatbf0f7912018-12-27 04:37:51 +0000479
Tom Rini65cc0e22022-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 Bhagatbf0f7912018-12-27 04:37:51 +0000483#endif
484
Tom Rini65cc0e22022-11-16 13:10:41 -0500485#ifdef CFG_SYS_CSPR4_EXT
486 set_ifc_cspr_ext(IFC_CS4, CFG_SYS_CSPR4_EXT);
Rajesh Bhagatbf0f7912018-12-27 04:37:51 +0000487#endif
Tom Rini65cc0e22022-11-16 13:10:41 -0500488#ifdef CFG_SYS_CSOR4_EXT
489 set_ifc_csor_ext(IFC_CS4, CFG_SYS_CSOR4_EXT);
Rajesh Bhagatbf0f7912018-12-27 04:37:51 +0000490#endif
Tom Rini65cc0e22022-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 Bhagatbf0f7912018-12-27 04:37:51 +0000496
Tom Rini65cc0e22022-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 Bhagatbf0f7912018-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 Rini65cc0e22022-11-16 13:10:41 -0500519#ifdef CFG_SYS_CSPR6_EXT
520 set_ifc_cspr_ext(IFC_CS6, CFG_SYS_CSPR6_EXT);
Rajesh Bhagatbf0f7912018-12-27 04:37:51 +0000521#endif
Tom Rini65cc0e22022-11-16 13:10:41 -0500522#ifdef CFG_SYS_CSOR6_EXT
523 set_ifc_csor_ext(IFC_CS6, CFG_SYS_CSOR6_EXT);
Rajesh Bhagatbf0f7912018-12-27 04:37:51 +0000524#endif
Tom Rini65cc0e22022-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 Bhagatbf0f7912018-12-27 04:37:51 +0000530
Tom Rini65cc0e22022-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 Bhagatbf0f7912018-12-27 04:37:51 +0000534#endif
535
Tom Rini65cc0e22022-11-16 13:10:41 -0500536#ifdef CFG_SYS_CSPR7_EXT
537 set_ifc_cspr_ext(IFC_CS7, CFG_SYS_CSPR7_EXT);
Rajesh Bhagatbf0f7912018-12-27 04:37:51 +0000538#endif
Tom Rini65cc0e22022-11-16 13:10:41 -0500539#ifdef CFG_SYS_CSOR7_EXT
540 set_ifc_csor_ext(IFC_CS7, CFG_SYS_CSOR7_EXT);
Rajesh Bhagatbf0f7912018-12-27 04:37:51 +0000541#endif
Tom Rini65cc0e22022-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 Bhagatbf0f7912018-12-27 04:37:51 +0000547
Tom Rini65cc0e22022-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 Bhagatbf0f7912018-12-27 04:37:51 +0000551#endif
552}
553
554void init_final_memctl_regs(void)
555{
Tom Rini65cc0e22022-11-16 13:10:41 -0500556#ifdef CFG_SYS_CSPR0_FINAL
557 set_ifc_cspr(IFC_CS0, CFG_SYS_CSPR0_FINAL);
Rajesh Bhagatbf0f7912018-12-27 04:37:51 +0000558#endif
Tom Rini65cc0e22022-11-16 13:10:41 -0500559#ifdef CFG_SYS_AMASK0_FINAL
560 set_ifc_amask(IFC_CS0, CFG_SYS_AMASK0);
Rajesh Bhagatbf0f7912018-12-27 04:37:51 +0000561#endif
Tom Rini65cc0e22022-11-16 13:10:41 -0500562#ifdef CFG_SYS_CSPR1_FINAL
563 set_ifc_cspr(IFC_CS1, CFG_SYS_CSPR1_FINAL);
Rajesh Bhagatbf0f7912018-12-27 04:37:51 +0000564#endif
Tom Rini65cc0e22022-11-16 13:10:41 -0500565#ifdef CFG_SYS_AMASK1_FINAL
566 set_ifc_amask(IFC_CS1, CFG_SYS_AMASK1_FINAL);
Rajesh Bhagatbf0f7912018-12-27 04:37:51 +0000567#endif
Tom Rini65cc0e22022-11-16 13:10:41 -0500568#ifdef CFG_SYS_CSPR2_FINAL
569 set_ifc_cspr(IFC_CS2, CFG_SYS_CSPR2_FINAL);
Rajesh Bhagatbf0f7912018-12-27 04:37:51 +0000570#endif
Tom Rini65cc0e22022-11-16 13:10:41 -0500571#ifdef CFG_SYS_AMASK2_FINAL
572 set_ifc_amask(IFC_CS2, CFG_SYS_AMASK2);
Rajesh Bhagatbf0f7912018-12-27 04:37:51 +0000573#endif
Tom Rini65cc0e22022-11-16 13:10:41 -0500574#ifdef CFG_SYS_CSPR3_FINAL
575 set_ifc_cspr(IFC_CS3, CFG_SYS_CSPR3_FINAL);
Rajesh Bhagatbf0f7912018-12-27 04:37:51 +0000576#endif
Tom Rini65cc0e22022-11-16 13:10:41 -0500577#ifdef CFG_SYS_AMASK3_FINAL
578 set_ifc_amask(IFC_CS3, CFG_SYS_AMASK3);
Rajesh Bhagatbf0f7912018-12-27 04:37:51 +0000579#endif
580}
581#endif