blob: be619736674dc42bb198b1e61ef7cce8d73c3e8b [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001/*
2 * Copyright 2010-2011 Freescale Semiconductor, Inc.
3 * Author: Dipen Dudhat <dipen.dudhat@freescale.com>
4 *
5 * SPDX-License-Identifier: GPL-2.0+
6 */
7
8#include <common.h>
9#include <fsl_ifc.h>
10
11void print_ifc_regs(void)
12{
13 int i, j;
14
15 printf("IFC Controller Registers\n");
16 for (i = 0; i < CONFIG_SYS_FSL_IFC_BANK_COUNT; i++) {
17 printf("CSPR%d:0x%08X\tAMASK%d:0x%08X\tCSOR%d:0x%08X\n",
18 i, get_ifc_cspr(i), i, get_ifc_amask(i),
19 i, get_ifc_csor(i));
20 for (j = 0; j < 4; j++)
21 printf("IFC_FTIM%d:0x%08X\n", j, get_ifc_ftim(i, j));
22 }
23}
24
25void init_early_memctl_regs(void)
26{
27#if defined(CONFIG_SYS_CSPR0) && defined(CONFIG_SYS_CSOR0)
28 set_ifc_ftim(IFC_CS0, IFC_FTIM0, CONFIG_SYS_CS0_FTIM0);
29 set_ifc_ftim(IFC_CS0, IFC_FTIM1, CONFIG_SYS_CS0_FTIM1);
30 set_ifc_ftim(IFC_CS0, IFC_FTIM2, CONFIG_SYS_CS0_FTIM2);
31 set_ifc_ftim(IFC_CS0, IFC_FTIM3, CONFIG_SYS_CS0_FTIM3);
32
33#ifndef CONFIG_A003399_NOR_WORKAROUND
34#ifdef CONFIG_SYS_CSPR0_EXT
35 set_ifc_cspr_ext(IFC_CS0, CONFIG_SYS_CSPR0_EXT);
36#endif
37#ifdef CONFIG_SYS_CSOR0_EXT
38 set_ifc_csor_ext(IFC_CS0, CONFIG_SYS_CSOR0_EXT);
39#endif
40 set_ifc_cspr(IFC_CS0, CONFIG_SYS_CSPR0);
41 set_ifc_amask(IFC_CS0, CONFIG_SYS_AMASK0);
42 set_ifc_csor(IFC_CS0, CONFIG_SYS_CSOR0);
43#endif
44#endif
45
46#ifdef CONFIG_SYS_CSPR1_EXT
47 set_ifc_cspr_ext(IFC_CS1, CONFIG_SYS_CSPR1_EXT);
48#endif
49#ifdef CONFIG_SYS_CSOR1_EXT
50 set_ifc_csor_ext(IFC_CS1, CONFIG_SYS_CSOR1_EXT);
51#endif
52#if defined(CONFIG_SYS_CSPR1) && defined(CONFIG_SYS_CSOR1)
53 set_ifc_ftim(IFC_CS1, IFC_FTIM0, CONFIG_SYS_CS1_FTIM0);
54 set_ifc_ftim(IFC_CS1, IFC_FTIM1, CONFIG_SYS_CS1_FTIM1);
55 set_ifc_ftim(IFC_CS1, IFC_FTIM2, CONFIG_SYS_CS1_FTIM2);
56 set_ifc_ftim(IFC_CS1, IFC_FTIM3, CONFIG_SYS_CS1_FTIM3);
57
58 set_ifc_csor(IFC_CS1, CONFIG_SYS_CSOR1);
59 set_ifc_amask(IFC_CS1, CONFIG_SYS_AMASK1);
60 set_ifc_cspr(IFC_CS1, CONFIG_SYS_CSPR1);
61#endif
62
63#ifdef CONFIG_SYS_CSPR2_EXT
64 set_ifc_cspr_ext(IFC_CS2, CONFIG_SYS_CSPR2_EXT);
65#endif
66#ifdef CONFIG_SYS_CSOR2_EXT
67 set_ifc_csor_ext(IFC_CS2, CONFIG_SYS_CSOR2_EXT);
68#endif
69#if defined(CONFIG_SYS_CSPR2) && defined(CONFIG_SYS_CSOR2)
70 set_ifc_ftim(IFC_CS2, IFC_FTIM0, CONFIG_SYS_CS2_FTIM0);
71 set_ifc_ftim(IFC_CS2, IFC_FTIM1, CONFIG_SYS_CS2_FTIM1);
72 set_ifc_ftim(IFC_CS2, IFC_FTIM2, CONFIG_SYS_CS2_FTIM2);
73 set_ifc_ftim(IFC_CS2, IFC_FTIM3, CONFIG_SYS_CS2_FTIM3);
74
75 set_ifc_csor(IFC_CS2, CONFIG_SYS_CSOR2);
76 set_ifc_amask(IFC_CS2, CONFIG_SYS_AMASK2);
77 set_ifc_cspr(IFC_CS2, CONFIG_SYS_CSPR2);
78#endif
79
80#ifdef CONFIG_SYS_CSPR3_EXT
81 set_ifc_cspr_ext(IFC_CS3, CONFIG_SYS_CSPR3_EXT);
82#endif
83#ifdef CONFIG_SYS_CSOR3_EXT
84 set_ifc_csor_ext(IFC_CS3, CONFIG_SYS_CSOR3_EXT);
85#endif
86#if defined(CONFIG_SYS_CSPR3) && defined(CONFIG_SYS_CSOR3)
87 set_ifc_ftim(IFC_CS3, IFC_FTIM0, CONFIG_SYS_CS3_FTIM0);
88 set_ifc_ftim(IFC_CS3, IFC_FTIM1, CONFIG_SYS_CS3_FTIM1);
89 set_ifc_ftim(IFC_CS3, IFC_FTIM2, CONFIG_SYS_CS3_FTIM2);
90 set_ifc_ftim(IFC_CS3, IFC_FTIM3, CONFIG_SYS_CS3_FTIM3);
91
92 set_ifc_cspr(IFC_CS3, CONFIG_SYS_CSPR3);
93 set_ifc_amask(IFC_CS3, CONFIG_SYS_AMASK3);
94 set_ifc_csor(IFC_CS3, CONFIG_SYS_CSOR3);
95#endif
96
97#ifdef CONFIG_SYS_CSPR4_EXT
98 set_ifc_cspr_ext(IFC_CS4, CONFIG_SYS_CSPR4_EXT);
99#endif
100#ifdef CONFIG_SYS_CSOR4_EXT
101 set_ifc_csor_ext(IFC_CS4, CONFIG_SYS_CSOR4_EXT);
102#endif
103#if defined(CONFIG_SYS_CSPR4) && defined(CONFIG_SYS_CSOR4)
104 set_ifc_ftim(IFC_CS4, IFC_FTIM0, CONFIG_SYS_CS4_FTIM0);
105 set_ifc_ftim(IFC_CS4, IFC_FTIM1, CONFIG_SYS_CS4_FTIM1);
106 set_ifc_ftim(IFC_CS4, IFC_FTIM2, CONFIG_SYS_CS4_FTIM2);
107 set_ifc_ftim(IFC_CS4, IFC_FTIM3, CONFIG_SYS_CS4_FTIM3);
108
109 set_ifc_cspr(IFC_CS4, CONFIG_SYS_CSPR4);
110 set_ifc_amask(IFC_CS4, CONFIG_SYS_AMASK4);
111 set_ifc_csor(IFC_CS4, CONFIG_SYS_CSOR4);
112#endif
113
114#ifdef CONFIG_SYS_CSPR5_EXT
115 set_ifc_cspr_ext(IFC_CS5, CONFIG_SYS_CSPR5_EXT);
116#endif
117#ifdef CONFIG_SYS_CSOR5_EXT
118 set_ifc_csor_ext(IFC_CS5, CONFIG_SYS_CSOR5_EXT);
119#endif
120#if defined(CONFIG_SYS_CSPR5) && defined(CONFIG_SYS_CSOR5)
121 set_ifc_ftim(IFC_CS5, IFC_FTIM0, CONFIG_SYS_CS5_FTIM0);
122 set_ifc_ftim(IFC_CS5, IFC_FTIM1, CONFIG_SYS_CS5_FTIM1);
123 set_ifc_ftim(IFC_CS5, IFC_FTIM2, CONFIG_SYS_CS5_FTIM2);
124 set_ifc_ftim(IFC_CS5, IFC_FTIM3, CONFIG_SYS_CS5_FTIM3);
125
126 set_ifc_cspr(IFC_CS5, CONFIG_SYS_CSPR5);
127 set_ifc_amask(IFC_CS5, CONFIG_SYS_AMASK5);
128 set_ifc_csor(IFC_CS5, CONFIG_SYS_CSOR5);
129#endif
130
131#ifdef CONFIG_SYS_CSPR6_EXT
132 set_ifc_cspr_ext(IFC_CS6, CONFIG_SYS_CSPR6_EXT);
133#endif
134#ifdef CONFIG_SYS_CSOR6_EXT
135 set_ifc_csor_ext(IFC_CS6, CONFIG_SYS_CSOR6_EXT);
136#endif
137#if defined(CONFIG_SYS_CSPR6) && defined(CONFIG_SYS_CSOR6)
138 set_ifc_ftim(IFC_CS6, IFC_FTIM0, CONFIG_SYS_CS6_FTIM0);
139 set_ifc_ftim(IFC_CS6, IFC_FTIM1, CONFIG_SYS_CS6_FTIM1);
140 set_ifc_ftim(IFC_CS6, IFC_FTIM2, CONFIG_SYS_CS6_FTIM2);
141 set_ifc_ftim(IFC_CS6, IFC_FTIM3, CONFIG_SYS_CS6_FTIM3);
142
143 set_ifc_cspr(IFC_CS6, CONFIG_SYS_CSPR6);
144 set_ifc_amask(IFC_CS6, CONFIG_SYS_AMASK6);
145 set_ifc_csor(IFC_CS6, CONFIG_SYS_CSOR6);
146#endif
147
148#ifdef CONFIG_SYS_CSPR7_EXT
149 set_ifc_cspr_ext(IFC_CS7, CONFIG_SYS_CSPR7_EXT);
150#endif
151#ifdef CONFIG_SYS_CSOR7_EXT
152 set_ifc_csor_ext(IFC_CS7, CONFIG_SYS_CSOR7_EXT);
153#endif
154#if defined(CONFIG_SYS_CSPR7) && defined(CONFIG_SYS_CSOR7)
155 set_ifc_ftim(IFC_CS7, IFC_FTIM0, CONFIG_SYS_CS7_FTIM0);
156 set_ifc_ftim(IFC_CS7, IFC_FTIM1, CONFIG_SYS_CS7_FTIM1);
157 set_ifc_ftim(IFC_CS7, IFC_FTIM2, CONFIG_SYS_CS7_FTIM2);
158 set_ifc_ftim(IFC_CS7, IFC_FTIM3, CONFIG_SYS_CS7_FTIM3);
159
160 set_ifc_cspr(IFC_CS7, CONFIG_SYS_CSPR7);
161 set_ifc_amask(IFC_CS7, CONFIG_SYS_AMASK7);
162 set_ifc_csor(IFC_CS7, CONFIG_SYS_CSOR7);
163#endif
164}