2 * Copyright 2010-2011 Freescale Semiconductor, Inc.
3 * Author: Dipen Dudhat <dipen.dudhat@freescale.com>
5 * SPDX-License-Identifier: GPL-2.0+
9 #include <asm/fsl_ifc.h>
11 void print_ifc_regs(void)
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),
20 for (j = 0; j < 4; j++)
21 printf("IFC_FTIM%d:0x%08X\n", j, get_ifc_ftim(i, j));
25 void init_early_memctl_regs(void)
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);
33 #ifndef CONFIG_A003399_NOR_WORKAROUND
34 #ifdef CONFIG_SYS_CSPR0_EXT
35 set_ifc_cspr_ext(IFC_CS0, CONFIG_SYS_CSPR0_EXT);
37 set_ifc_cspr(IFC_CS0, CONFIG_SYS_CSPR0);
38 set_ifc_amask(IFC_CS0, CONFIG_SYS_AMASK0);
39 set_ifc_csor(IFC_CS0, CONFIG_SYS_CSOR0);
43 #ifdef CONFIG_SYS_CSPR1_EXT
44 set_ifc_cspr_ext(IFC_CS1, CONFIG_SYS_CSPR1_EXT);
46 #if defined(CONFIG_SYS_CSPR1) && defined(CONFIG_SYS_CSOR1)
47 set_ifc_ftim(IFC_CS1, IFC_FTIM0, CONFIG_SYS_CS1_FTIM0);
48 set_ifc_ftim(IFC_CS1, IFC_FTIM1, CONFIG_SYS_CS1_FTIM1);
49 set_ifc_ftim(IFC_CS1, IFC_FTIM2, CONFIG_SYS_CS1_FTIM2);
50 set_ifc_ftim(IFC_CS1, IFC_FTIM3, CONFIG_SYS_CS1_FTIM3);
52 set_ifc_csor(IFC_CS1, CONFIG_SYS_CSOR1);
53 set_ifc_amask(IFC_CS1, CONFIG_SYS_AMASK1);
54 set_ifc_cspr(IFC_CS1, CONFIG_SYS_CSPR1);
57 #ifdef CONFIG_SYS_CSPR2_EXT
58 set_ifc_cspr_ext(IFC_CS2, CONFIG_SYS_CSPR2_EXT);
60 #if defined(CONFIG_SYS_CSPR2) && defined(CONFIG_SYS_CSOR2)
61 set_ifc_ftim(IFC_CS2, IFC_FTIM0, CONFIG_SYS_CS2_FTIM0);
62 set_ifc_ftim(IFC_CS2, IFC_FTIM1, CONFIG_SYS_CS2_FTIM1);
63 set_ifc_ftim(IFC_CS2, IFC_FTIM2, CONFIG_SYS_CS2_FTIM2);
64 set_ifc_ftim(IFC_CS2, IFC_FTIM3, CONFIG_SYS_CS2_FTIM3);
66 set_ifc_csor(IFC_CS2, CONFIG_SYS_CSOR2);
67 set_ifc_amask(IFC_CS2, CONFIG_SYS_AMASK2);
68 set_ifc_cspr(IFC_CS2, CONFIG_SYS_CSPR2);
71 #ifdef CONFIG_SYS_CSPR3_EXT
72 set_ifc_cspr_ext(IFC_CS3, CONFIG_SYS_CSPR3_EXT);
74 #if defined(CONFIG_SYS_CSPR3) && defined(CONFIG_SYS_CSOR3)
75 set_ifc_ftim(IFC_CS3, IFC_FTIM0, CONFIG_SYS_CS3_FTIM0);
76 set_ifc_ftim(IFC_CS3, IFC_FTIM1, CONFIG_SYS_CS3_FTIM1);
77 set_ifc_ftim(IFC_CS3, IFC_FTIM2, CONFIG_SYS_CS3_FTIM2);
78 set_ifc_ftim(IFC_CS3, IFC_FTIM3, CONFIG_SYS_CS3_FTIM3);
80 set_ifc_cspr(IFC_CS3, CONFIG_SYS_CSPR3);
81 set_ifc_amask(IFC_CS3, CONFIG_SYS_AMASK3);
82 set_ifc_csor(IFC_CS3, CONFIG_SYS_CSOR3);
85 #ifdef CONFIG_SYS_CSPR4_EXT
86 set_ifc_cspr_ext(IFC_CS4, CONFIG_SYS_CSPR4_EXT);
88 #if defined(CONFIG_SYS_CSPR4) && defined(CONFIG_SYS_CSOR4)
89 set_ifc_ftim(IFC_CS4, IFC_FTIM0, CONFIG_SYS_CS4_FTIM0);
90 set_ifc_ftim(IFC_CS4, IFC_FTIM1, CONFIG_SYS_CS4_FTIM1);
91 set_ifc_ftim(IFC_CS4, IFC_FTIM2, CONFIG_SYS_CS4_FTIM2);
92 set_ifc_ftim(IFC_CS4, IFC_FTIM3, CONFIG_SYS_CS4_FTIM3);
94 set_ifc_cspr(IFC_CS4, CONFIG_SYS_CSPR4);
95 set_ifc_amask(IFC_CS4, CONFIG_SYS_AMASK4);
96 set_ifc_csor(IFC_CS4, CONFIG_SYS_CSOR4);
99 #ifdef CONFIG_SYS_CSPR5_EXT
100 set_ifc_cspr_ext(IFC_CS5, CONFIG_SYS_CSPR5_EXT);
102 #if defined(CONFIG_SYS_CSPR5) && defined(CONFIG_SYS_CSOR5)
103 set_ifc_ftim(IFC_CS5, IFC_FTIM0, CONFIG_SYS_CS5_FTIM0);
104 set_ifc_ftim(IFC_CS5, IFC_FTIM1, CONFIG_SYS_CS5_FTIM1);
105 set_ifc_ftim(IFC_CS5, IFC_FTIM2, CONFIG_SYS_CS5_FTIM2);
106 set_ifc_ftim(IFC_CS5, IFC_FTIM3, CONFIG_SYS_CS5_FTIM3);
108 set_ifc_cspr(IFC_CS5, CONFIG_SYS_CSPR5);
109 set_ifc_amask(IFC_CS5, CONFIG_SYS_AMASK5);
110 set_ifc_csor(IFC_CS5, CONFIG_SYS_CSOR5);
113 #ifdef CONFIG_SYS_CSPR6_EXT
114 set_ifc_cspr_ext(IFC_CS6, CONFIG_SYS_CSPR6_EXT);
116 #if defined(CONFIG_SYS_CSPR6) && defined(CONFIG_SYS_CSOR6)
117 set_ifc_ftim(IFC_CS6, IFC_FTIM0, CONFIG_SYS_CS6_FTIM0);
118 set_ifc_ftim(IFC_CS6, IFC_FTIM1, CONFIG_SYS_CS6_FTIM1);
119 set_ifc_ftim(IFC_CS6, IFC_FTIM2, CONFIG_SYS_CS6_FTIM2);
120 set_ifc_ftim(IFC_CS6, IFC_FTIM3, CONFIG_SYS_CS6_FTIM3);
122 set_ifc_cspr(IFC_CS6, CONFIG_SYS_CSPR6);
123 set_ifc_amask(IFC_CS6, CONFIG_SYS_AMASK6);
124 set_ifc_csor(IFC_CS6, CONFIG_SYS_CSOR6);
127 #ifdef CONFIG_SYS_CSPR7_EXT
128 set_ifc_cspr_ext(IFC_CS7, CONFIG_SYS_CSPR7_EXT);
130 #if defined(CONFIG_SYS_CSPR7) && defined(CONFIG_SYS_CSOR7)
131 set_ifc_ftim(IFC_CS7, IFC_FTIM0, CONFIG_SYS_CS7_FTIM0);
132 set_ifc_ftim(IFC_CS7, IFC_FTIM1, CONFIG_SYS_CS7_FTIM1);
133 set_ifc_ftim(IFC_CS7, IFC_FTIM2, CONFIG_SYS_CS7_FTIM2);
134 set_ifc_ftim(IFC_CS7, IFC_FTIM3, CONFIG_SYS_CS7_FTIM3);
136 set_ifc_cspr(IFC_CS7, CONFIG_SYS_CSPR7);
137 set_ifc_amask(IFC_CS7, CONFIG_SYS_AMASK7);
138 set_ifc_csor(IFC_CS7, CONFIG_SYS_CSOR7);