blob: 7d66c3cf765ffa5a67a8cd0fc838929e53622b72 [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>
Dipen Dudhatd789b5f2011-01-20 16:29:35 +05309
10void print_ifc_regs(void)
11{
12 int i, j;
13
14 printf("IFC Controller Registers\n");
Mingkai Hu362ee042013-05-16 10:18:13 +080015 for (i = 0; i < CONFIG_SYS_FSL_IFC_BANK_COUNT; i++) {
Dipen Dudhatd789b5f2011-01-20 16:29:35 +053016 printf("CSPR%d:0x%08X\tAMASK%d:0x%08X\tCSOR%d:0x%08X\n",
17 i, get_ifc_cspr(i), i, get_ifc_amask(i),
18 i, get_ifc_csor(i));
19 for (j = 0; j < 4; j++)
20 printf("IFC_FTIM%d:0x%08X\n", j, get_ifc_ftim(i, j));
21 }
22}
23
24void init_early_memctl_regs(void)
25{
26#if defined(CONFIG_SYS_CSPR0) && defined(CONFIG_SYS_CSOR0)
Dipen Dudhatd789b5f2011-01-20 16:29:35 +053027 set_ifc_ftim(IFC_CS0, IFC_FTIM0, CONFIG_SYS_CS0_FTIM0);
28 set_ifc_ftim(IFC_CS0, IFC_FTIM1, CONFIG_SYS_CS0_FTIM1);
29 set_ifc_ftim(IFC_CS0, IFC_FTIM2, CONFIG_SYS_CS0_FTIM2);
30 set_ifc_ftim(IFC_CS0, IFC_FTIM3, CONFIG_SYS_CS0_FTIM3);
Dipen Dudhatd7da1482011-04-08 16:04:51 +053031
Prabhakar Kushwaha74fa22e2013-04-16 13:27:44 +053032#ifndef CONFIG_A003399_NOR_WORKAROUND
Kumar Galaffdf8892012-08-17 08:20:25 +000033#ifdef CONFIG_SYS_CSPR0_EXT
34 set_ifc_cspr_ext(IFC_CS0, CONFIG_SYS_CSPR0_EXT);
35#endif
Prabhakar Kushwaha71220f82013-10-04 10:05:36 +053036#ifdef CONFIG_SYS_CSOR0_EXT
37 set_ifc_csor_ext(IFC_CS0, CONFIG_SYS_CSOR0_EXT);
38#endif
Dipen Dudhatd7da1482011-04-08 16:04:51 +053039 set_ifc_cspr(IFC_CS0, CONFIG_SYS_CSPR0);
40 set_ifc_amask(IFC_CS0, CONFIG_SYS_AMASK0);
41 set_ifc_csor(IFC_CS0, CONFIG_SYS_CSOR0);
Dipen Dudhatd789b5f2011-01-20 16:29:35 +053042#endif
Poonam Aggrwalbc6bbd62011-07-07 20:36:47 +053043#endif
Dipen Dudhatd789b5f2011-01-20 16:29:35 +053044
Kumar Galaffdf8892012-08-17 08:20:25 +000045#ifdef CONFIG_SYS_CSPR1_EXT
46 set_ifc_cspr_ext(IFC_CS1, CONFIG_SYS_CSPR1_EXT);
47#endif
Prabhakar Kushwaha71220f82013-10-04 10:05:36 +053048#ifdef CONFIG_SYS_CSOR1_EXT
49 set_ifc_csor_ext(IFC_CS1, CONFIG_SYS_CSOR1_EXT);
50#endif
Dipen Dudhatd789b5f2011-01-20 16:29:35 +053051#if defined(CONFIG_SYS_CSPR1) && defined(CONFIG_SYS_CSOR1)
Dipen Dudhatd789b5f2011-01-20 16:29:35 +053052 set_ifc_ftim(IFC_CS1, IFC_FTIM0, CONFIG_SYS_CS1_FTIM0);
53 set_ifc_ftim(IFC_CS1, IFC_FTIM1, CONFIG_SYS_CS1_FTIM1);
54 set_ifc_ftim(IFC_CS1, IFC_FTIM2, CONFIG_SYS_CS1_FTIM2);
55 set_ifc_ftim(IFC_CS1, IFC_FTIM3, CONFIG_SYS_CS1_FTIM3);
Dipen Dudhatd7da1482011-04-08 16:04:51 +053056
57 set_ifc_csor(IFC_CS1, CONFIG_SYS_CSOR1);
58 set_ifc_amask(IFC_CS1, CONFIG_SYS_AMASK1);
59 set_ifc_cspr(IFC_CS1, CONFIG_SYS_CSPR1);
Dipen Dudhatd789b5f2011-01-20 16:29:35 +053060#endif
61
Kumar Galaffdf8892012-08-17 08:20:25 +000062#ifdef CONFIG_SYS_CSPR2_EXT
63 set_ifc_cspr_ext(IFC_CS2, CONFIG_SYS_CSPR2_EXT);
64#endif
Prabhakar Kushwaha71220f82013-10-04 10:05:36 +053065#ifdef CONFIG_SYS_CSOR2_EXT
66 set_ifc_csor_ext(IFC_CS2, CONFIG_SYS_CSOR2_EXT);
67#endif
Dipen Dudhatd789b5f2011-01-20 16:29:35 +053068#if defined(CONFIG_SYS_CSPR2) && defined(CONFIG_SYS_CSOR2)
Dipen Dudhatd789b5f2011-01-20 16:29:35 +053069 set_ifc_ftim(IFC_CS2, IFC_FTIM0, CONFIG_SYS_CS2_FTIM0);
70 set_ifc_ftim(IFC_CS2, IFC_FTIM1, CONFIG_SYS_CS2_FTIM1);
71 set_ifc_ftim(IFC_CS2, IFC_FTIM2, CONFIG_SYS_CS2_FTIM2);
72 set_ifc_ftim(IFC_CS2, IFC_FTIM3, CONFIG_SYS_CS2_FTIM3);
73
Dipen Dudhatd7da1482011-04-08 16:04:51 +053074 set_ifc_csor(IFC_CS2, CONFIG_SYS_CSOR2);
75 set_ifc_amask(IFC_CS2, CONFIG_SYS_AMASK2);
76 set_ifc_cspr(IFC_CS2, CONFIG_SYS_CSPR2);
Dipen Dudhatd789b5f2011-01-20 16:29:35 +053077#endif
78
Kumar Galaffdf8892012-08-17 08:20:25 +000079#ifdef CONFIG_SYS_CSPR3_EXT
80 set_ifc_cspr_ext(IFC_CS3, CONFIG_SYS_CSPR3_EXT);
81#endif
Prabhakar Kushwaha71220f82013-10-04 10:05:36 +053082#ifdef CONFIG_SYS_CSOR3_EXT
83 set_ifc_csor_ext(IFC_CS3, CONFIG_SYS_CSOR3_EXT);
84#endif
Dipen Dudhatd789b5f2011-01-20 16:29:35 +053085#if defined(CONFIG_SYS_CSPR3) && defined(CONFIG_SYS_CSOR3)
Dipen Dudhatd789b5f2011-01-20 16:29:35 +053086 set_ifc_ftim(IFC_CS3, IFC_FTIM0, CONFIG_SYS_CS3_FTIM0);
87 set_ifc_ftim(IFC_CS3, IFC_FTIM1, CONFIG_SYS_CS3_FTIM1);
88 set_ifc_ftim(IFC_CS3, IFC_FTIM2, CONFIG_SYS_CS3_FTIM2);
89 set_ifc_ftim(IFC_CS3, IFC_FTIM3, CONFIG_SYS_CS3_FTIM3);
Dipen Dudhatd7da1482011-04-08 16:04:51 +053090
91 set_ifc_cspr(IFC_CS3, CONFIG_SYS_CSPR3);
92 set_ifc_amask(IFC_CS3, CONFIG_SYS_AMASK3);
93 set_ifc_csor(IFC_CS3, CONFIG_SYS_CSOR3);
Dipen Dudhatd789b5f2011-01-20 16:29:35 +053094#endif
Mingkai Hu362ee042013-05-16 10:18:13 +080095
96#ifdef CONFIG_SYS_CSPR4_EXT
97 set_ifc_cspr_ext(IFC_CS4, CONFIG_SYS_CSPR4_EXT);
98#endif
Prabhakar Kushwaha71220f82013-10-04 10:05:36 +053099#ifdef CONFIG_SYS_CSOR4_EXT
100 set_ifc_csor_ext(IFC_CS4, CONFIG_SYS_CSOR4_EXT);
101#endif
Mingkai Hu362ee042013-05-16 10:18:13 +0800102#if defined(CONFIG_SYS_CSPR4) && defined(CONFIG_SYS_CSOR4)
103 set_ifc_ftim(IFC_CS4, IFC_FTIM0, CONFIG_SYS_CS4_FTIM0);
104 set_ifc_ftim(IFC_CS4, IFC_FTIM1, CONFIG_SYS_CS4_FTIM1);
105 set_ifc_ftim(IFC_CS4, IFC_FTIM2, CONFIG_SYS_CS4_FTIM2);
106 set_ifc_ftim(IFC_CS4, IFC_FTIM3, CONFIG_SYS_CS4_FTIM3);
107
108 set_ifc_cspr(IFC_CS4, CONFIG_SYS_CSPR4);
109 set_ifc_amask(IFC_CS4, CONFIG_SYS_AMASK4);
110 set_ifc_csor(IFC_CS4, CONFIG_SYS_CSOR4);
111#endif
112
113#ifdef CONFIG_SYS_CSPR5_EXT
114 set_ifc_cspr_ext(IFC_CS5, CONFIG_SYS_CSPR5_EXT);
115#endif
Prabhakar Kushwaha71220f82013-10-04 10:05:36 +0530116#ifdef CONFIG_SYS_CSOR5_EXT
117 set_ifc_csor_ext(IFC_CS5, CONFIG_SYS_CSOR5_EXT);
118#endif
Mingkai Hu362ee042013-05-16 10:18:13 +0800119#if defined(CONFIG_SYS_CSPR5) && defined(CONFIG_SYS_CSOR5)
120 set_ifc_ftim(IFC_CS5, IFC_FTIM0, CONFIG_SYS_CS5_FTIM0);
121 set_ifc_ftim(IFC_CS5, IFC_FTIM1, CONFIG_SYS_CS5_FTIM1);
122 set_ifc_ftim(IFC_CS5, IFC_FTIM2, CONFIG_SYS_CS5_FTIM2);
123 set_ifc_ftim(IFC_CS5, IFC_FTIM3, CONFIG_SYS_CS5_FTIM3);
124
125 set_ifc_cspr(IFC_CS5, CONFIG_SYS_CSPR5);
126 set_ifc_amask(IFC_CS5, CONFIG_SYS_AMASK5);
127 set_ifc_csor(IFC_CS5, CONFIG_SYS_CSOR5);
128#endif
129
130#ifdef CONFIG_SYS_CSPR6_EXT
131 set_ifc_cspr_ext(IFC_CS6, CONFIG_SYS_CSPR6_EXT);
132#endif
Prabhakar Kushwaha71220f82013-10-04 10:05:36 +0530133#ifdef CONFIG_SYS_CSOR6_EXT
134 set_ifc_csor_ext(IFC_CS6, CONFIG_SYS_CSOR6_EXT);
135#endif
Mingkai Hu362ee042013-05-16 10:18:13 +0800136#if defined(CONFIG_SYS_CSPR6) && defined(CONFIG_SYS_CSOR6)
137 set_ifc_ftim(IFC_CS6, IFC_FTIM0, CONFIG_SYS_CS6_FTIM0);
138 set_ifc_ftim(IFC_CS6, IFC_FTIM1, CONFIG_SYS_CS6_FTIM1);
139 set_ifc_ftim(IFC_CS6, IFC_FTIM2, CONFIG_SYS_CS6_FTIM2);
140 set_ifc_ftim(IFC_CS6, IFC_FTIM3, CONFIG_SYS_CS6_FTIM3);
141
142 set_ifc_cspr(IFC_CS6, CONFIG_SYS_CSPR6);
143 set_ifc_amask(IFC_CS6, CONFIG_SYS_AMASK6);
144 set_ifc_csor(IFC_CS6, CONFIG_SYS_CSOR6);
145#endif
146
147#ifdef CONFIG_SYS_CSPR7_EXT
148 set_ifc_cspr_ext(IFC_CS7, CONFIG_SYS_CSPR7_EXT);
149#endif
Prabhakar Kushwaha71220f82013-10-04 10:05:36 +0530150#ifdef CONFIG_SYS_CSOR7_EXT
151 set_ifc_csor_ext(IFC_CS7, CONFIG_SYS_CSOR7_EXT);
152#endif
Mingkai Hu362ee042013-05-16 10:18:13 +0800153#if defined(CONFIG_SYS_CSPR7) && defined(CONFIG_SYS_CSOR7)
154 set_ifc_ftim(IFC_CS7, IFC_FTIM0, CONFIG_SYS_CS7_FTIM0);
155 set_ifc_ftim(IFC_CS7, IFC_FTIM1, CONFIG_SYS_CS7_FTIM1);
156 set_ifc_ftim(IFC_CS7, IFC_FTIM2, CONFIG_SYS_CS7_FTIM2);
157 set_ifc_ftim(IFC_CS7, IFC_FTIM3, CONFIG_SYS_CS7_FTIM3);
158
159 set_ifc_cspr(IFC_CS7, CONFIG_SYS_CSPR7);
160 set_ifc_amask(IFC_CS7, CONFIG_SYS_AMASK7);
161 set_ifc_csor(IFC_CS7, CONFIG_SYS_CSOR7);
162#endif
Dipen Dudhatd789b5f2011-01-20 16:29:35 +0530163}
York Sune77224e2014-03-19 13:52:34 -0700164
165void init_final_memctl_regs(void)
166{
167#ifdef CONFIG_SYS_CSPR0_FINAL
168 set_ifc_cspr(IFC_CS0, CONFIG_SYS_CSPR0_FINAL);
169#endif
Scott Woodb2d5ac52015-03-24 13:25:02 -0700170#ifdef CONFIG_SYS_AMASK0_FINAL
171 set_ifc_amask(IFC_CS0, CONFIG_SYS_AMASK0);
172#endif
Prabhakar Kushwaha45bc6fd2015-03-19 09:20:48 -0700173#ifdef CONFIG_SYS_CSPR1_FINAL
174 set_ifc_cspr(IFC_CS1, CONFIG_SYS_CSPR1_FINAL);
175#endif
176#ifdef CONFIG_SYS_AMASK1_FINAL
177 set_ifc_amask(IFC_CS1, CONFIG_SYS_AMASK1_FINAL);
178#endif
Scott Woodb2d5ac52015-03-24 13:25:02 -0700179#ifdef CONFIG_SYS_CSPR2_FINAL
180 set_ifc_cspr(IFC_CS2, CONFIG_SYS_CSPR2_FINAL);
181#endif
182#ifdef CONFIG_SYS_AMASK2_FINAL
183 set_ifc_amask(IFC_CS2, CONFIG_SYS_AMASK2);
184#endif
Prabhakar Kushwaha45bc6fd2015-03-19 09:20:48 -0700185#ifdef CONFIG_SYS_CSPR3_FINAL
186 set_ifc_cspr(IFC_CS3, CONFIG_SYS_CSPR3_FINAL);
187#endif
Scott Woodb2d5ac52015-03-24 13:25:02 -0700188#ifdef CONFIG_SYS_AMASK3_FINAL
189 set_ifc_amask(IFC_CS3, CONFIG_SYS_AMASK3);
190#endif
York Sune77224e2014-03-19 13:52:34 -0700191}