blob: 4e8a4415f5c0f4b0c00c6d30b8f0e9f61c4833d8 [file] [log] [blame]
Dipen Dudhat00c42942011-01-20 16:29:35 +05301/*
2 * Copyright 2010-2011 Freescale Semiconductor, Inc.
3 * Author: Dipen Dudhat <dipen.dudhat@freescale.com>
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of
8 * the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
18 * MA 02111-1307 USA
19 */
20
21#include <common.h>
22#include <asm/fsl_ifc.h>
23
24void print_ifc_regs(void)
25{
26 int i, j;
27
28 printf("IFC Controller Registers\n");
Mingkai Hu6f024c92013-05-16 10:18:13 +080029 for (i = 0; i < CONFIG_SYS_FSL_IFC_BANK_COUNT; i++) {
Dipen Dudhat00c42942011-01-20 16:29:35 +053030 printf("CSPR%d:0x%08X\tAMASK%d:0x%08X\tCSOR%d:0x%08X\n",
31 i, get_ifc_cspr(i), i, get_ifc_amask(i),
32 i, get_ifc_csor(i));
33 for (j = 0; j < 4; j++)
34 printf("IFC_FTIM%d:0x%08X\n", j, get_ifc_ftim(i, j));
35 }
36}
37
38void init_early_memctl_regs(void)
39{
40#if defined(CONFIG_SYS_CSPR0) && defined(CONFIG_SYS_CSOR0)
Dipen Dudhat00c42942011-01-20 16:29:35 +053041 set_ifc_ftim(IFC_CS0, IFC_FTIM0, CONFIG_SYS_CS0_FTIM0);
42 set_ifc_ftim(IFC_CS0, IFC_FTIM1, CONFIG_SYS_CS0_FTIM1);
43 set_ifc_ftim(IFC_CS0, IFC_FTIM2, CONFIG_SYS_CS0_FTIM2);
44 set_ifc_ftim(IFC_CS0, IFC_FTIM3, CONFIG_SYS_CS0_FTIM3);
Dipen Dudhatf020e6c2011-04-08 16:04:51 +053045
Prabhakar Kushwahad324f472013-04-16 13:27:44 +053046#ifndef CONFIG_A003399_NOR_WORKAROUND
Kumar Gala7bc4f622012-08-17 08:20:25 +000047#ifdef CONFIG_SYS_CSPR0_EXT
48 set_ifc_cspr_ext(IFC_CS0, CONFIG_SYS_CSPR0_EXT);
49#endif
Dipen Dudhatf020e6c2011-04-08 16:04:51 +053050 set_ifc_cspr(IFC_CS0, CONFIG_SYS_CSPR0);
51 set_ifc_amask(IFC_CS0, CONFIG_SYS_AMASK0);
52 set_ifc_csor(IFC_CS0, CONFIG_SYS_CSOR0);
Dipen Dudhat00c42942011-01-20 16:29:35 +053053#endif
Poonam Aggrwal46b86ca2011-07-07 20:36:47 +053054#endif
Dipen Dudhat00c42942011-01-20 16:29:35 +053055
Kumar Gala7bc4f622012-08-17 08:20:25 +000056#ifdef CONFIG_SYS_CSPR1_EXT
57 set_ifc_cspr_ext(IFC_CS1, CONFIG_SYS_CSPR1_EXT);
58#endif
Dipen Dudhat00c42942011-01-20 16:29:35 +053059#if defined(CONFIG_SYS_CSPR1) && defined(CONFIG_SYS_CSOR1)
Dipen Dudhat00c42942011-01-20 16:29:35 +053060 set_ifc_ftim(IFC_CS1, IFC_FTIM0, CONFIG_SYS_CS1_FTIM0);
61 set_ifc_ftim(IFC_CS1, IFC_FTIM1, CONFIG_SYS_CS1_FTIM1);
62 set_ifc_ftim(IFC_CS1, IFC_FTIM2, CONFIG_SYS_CS1_FTIM2);
63 set_ifc_ftim(IFC_CS1, IFC_FTIM3, CONFIG_SYS_CS1_FTIM3);
Dipen Dudhatf020e6c2011-04-08 16:04:51 +053064
65 set_ifc_csor(IFC_CS1, CONFIG_SYS_CSOR1);
66 set_ifc_amask(IFC_CS1, CONFIG_SYS_AMASK1);
67 set_ifc_cspr(IFC_CS1, CONFIG_SYS_CSPR1);
Dipen Dudhat00c42942011-01-20 16:29:35 +053068#endif
69
Kumar Gala7bc4f622012-08-17 08:20:25 +000070#ifdef CONFIG_SYS_CSPR2_EXT
71 set_ifc_cspr_ext(IFC_CS2, CONFIG_SYS_CSPR2_EXT);
72#endif
Dipen Dudhat00c42942011-01-20 16:29:35 +053073#if defined(CONFIG_SYS_CSPR2) && defined(CONFIG_SYS_CSOR2)
Dipen Dudhat00c42942011-01-20 16:29:35 +053074 set_ifc_ftim(IFC_CS2, IFC_FTIM0, CONFIG_SYS_CS2_FTIM0);
75 set_ifc_ftim(IFC_CS2, IFC_FTIM1, CONFIG_SYS_CS2_FTIM1);
76 set_ifc_ftim(IFC_CS2, IFC_FTIM2, CONFIG_SYS_CS2_FTIM2);
77 set_ifc_ftim(IFC_CS2, IFC_FTIM3, CONFIG_SYS_CS2_FTIM3);
78
Dipen Dudhatf020e6c2011-04-08 16:04:51 +053079 set_ifc_csor(IFC_CS2, CONFIG_SYS_CSOR2);
80 set_ifc_amask(IFC_CS2, CONFIG_SYS_AMASK2);
81 set_ifc_cspr(IFC_CS2, CONFIG_SYS_CSPR2);
Dipen Dudhat00c42942011-01-20 16:29:35 +053082#endif
83
Kumar Gala7bc4f622012-08-17 08:20:25 +000084#ifdef CONFIG_SYS_CSPR3_EXT
85 set_ifc_cspr_ext(IFC_CS3, CONFIG_SYS_CSPR3_EXT);
86#endif
Dipen Dudhat00c42942011-01-20 16:29:35 +053087#if defined(CONFIG_SYS_CSPR3) && defined(CONFIG_SYS_CSOR3)
Dipen Dudhat00c42942011-01-20 16:29:35 +053088 set_ifc_ftim(IFC_CS3, IFC_FTIM0, CONFIG_SYS_CS3_FTIM0);
89 set_ifc_ftim(IFC_CS3, IFC_FTIM1, CONFIG_SYS_CS3_FTIM1);
90 set_ifc_ftim(IFC_CS3, IFC_FTIM2, CONFIG_SYS_CS3_FTIM2);
91 set_ifc_ftim(IFC_CS3, IFC_FTIM3, CONFIG_SYS_CS3_FTIM3);
Dipen Dudhatf020e6c2011-04-08 16:04:51 +053092
93 set_ifc_cspr(IFC_CS3, CONFIG_SYS_CSPR3);
94 set_ifc_amask(IFC_CS3, CONFIG_SYS_AMASK3);
95 set_ifc_csor(IFC_CS3, CONFIG_SYS_CSOR3);
Dipen Dudhat00c42942011-01-20 16:29:35 +053096#endif
Mingkai Hu6f024c92013-05-16 10:18:13 +080097
98#ifdef CONFIG_SYS_CSPR4_EXT
99 set_ifc_cspr_ext(IFC_CS4, CONFIG_SYS_CSPR4_EXT);
100#endif
101#if defined(CONFIG_SYS_CSPR4) && defined(CONFIG_SYS_CSOR4)
102 set_ifc_ftim(IFC_CS4, IFC_FTIM0, CONFIG_SYS_CS4_FTIM0);
103 set_ifc_ftim(IFC_CS4, IFC_FTIM1, CONFIG_SYS_CS4_FTIM1);
104 set_ifc_ftim(IFC_CS4, IFC_FTIM2, CONFIG_SYS_CS4_FTIM2);
105 set_ifc_ftim(IFC_CS4, IFC_FTIM3, CONFIG_SYS_CS4_FTIM3);
106
107 set_ifc_cspr(IFC_CS4, CONFIG_SYS_CSPR4);
108 set_ifc_amask(IFC_CS4, CONFIG_SYS_AMASK4);
109 set_ifc_csor(IFC_CS4, CONFIG_SYS_CSOR4);
110#endif
111
112#ifdef CONFIG_SYS_CSPR5_EXT
113 set_ifc_cspr_ext(IFC_CS5, CONFIG_SYS_CSPR5_EXT);
114#endif
115#if defined(CONFIG_SYS_CSPR5) && defined(CONFIG_SYS_CSOR5)
116 set_ifc_ftim(IFC_CS5, IFC_FTIM0, CONFIG_SYS_CS5_FTIM0);
117 set_ifc_ftim(IFC_CS5, IFC_FTIM1, CONFIG_SYS_CS5_FTIM1);
118 set_ifc_ftim(IFC_CS5, IFC_FTIM2, CONFIG_SYS_CS5_FTIM2);
119 set_ifc_ftim(IFC_CS5, IFC_FTIM3, CONFIG_SYS_CS5_FTIM3);
120
121 set_ifc_cspr(IFC_CS5, CONFIG_SYS_CSPR5);
122 set_ifc_amask(IFC_CS5, CONFIG_SYS_AMASK5);
123 set_ifc_csor(IFC_CS5, CONFIG_SYS_CSOR5);
124#endif
125
126#ifdef CONFIG_SYS_CSPR6_EXT
127 set_ifc_cspr_ext(IFC_CS6, CONFIG_SYS_CSPR6_EXT);
128#endif
129#if defined(CONFIG_SYS_CSPR6) && defined(CONFIG_SYS_CSOR6)
130 set_ifc_ftim(IFC_CS6, IFC_FTIM0, CONFIG_SYS_CS6_FTIM0);
131 set_ifc_ftim(IFC_CS6, IFC_FTIM1, CONFIG_SYS_CS6_FTIM1);
132 set_ifc_ftim(IFC_CS6, IFC_FTIM2, CONFIG_SYS_CS6_FTIM2);
133 set_ifc_ftim(IFC_CS6, IFC_FTIM3, CONFIG_SYS_CS6_FTIM3);
134
135 set_ifc_cspr(IFC_CS6, CONFIG_SYS_CSPR6);
136 set_ifc_amask(IFC_CS6, CONFIG_SYS_AMASK6);
137 set_ifc_csor(IFC_CS6, CONFIG_SYS_CSOR6);
138#endif
139
140#ifdef CONFIG_SYS_CSPR7_EXT
141 set_ifc_cspr_ext(IFC_CS7, CONFIG_SYS_CSPR7_EXT);
142#endif
143#if defined(CONFIG_SYS_CSPR7) && defined(CONFIG_SYS_CSOR7)
144 set_ifc_ftim(IFC_CS7, IFC_FTIM0, CONFIG_SYS_CS7_FTIM0);
145 set_ifc_ftim(IFC_CS7, IFC_FTIM1, CONFIG_SYS_CS7_FTIM1);
146 set_ifc_ftim(IFC_CS7, IFC_FTIM2, CONFIG_SYS_CS7_FTIM2);
147 set_ifc_ftim(IFC_CS7, IFC_FTIM3, CONFIG_SYS_CS7_FTIM3);
148
149 set_ifc_cspr(IFC_CS7, CONFIG_SYS_CSPR7);
150 set_ifc_amask(IFC_CS7, CONFIG_SYS_AMASK7);
151 set_ifc_csor(IFC_CS7, CONFIG_SYS_CSOR7);
152#endif
Dipen Dudhat00c42942011-01-20 16:29:35 +0530153}