OMAP4: first cut at support for OMAP4 and Panda
[pandora-x-loader.git] / include / asm / arch-omap4 / mem.h
1 /*
2  * (C) Copyright 2006-2009
3  * Texas Instruments, <www.ti.com>
4  * Richard Woodruff <r-woodruff2@ti.com>
5  *
6  * See file CREDITS for list of people who contributed to this
7  * project.
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * version 2 as published by the Free Software Foundation.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21  * MA 02111-1307 USA
22  */
23
24 #ifndef _OMAP44XX_MEM_H_
25 #define _OMAP44XX_MEM_H_
26
27 #ifndef __ASSEMBLY__
28
29 typedef enum {
30         STACKED         = 0,
31         IP_DDR          = 1,
32         COMBO_DDR       = 2,
33         IP_SDR          = 3,
34 } mem_t;
35
36 /* Memory that can be connected to GPMC */
37 #define GPMC_NOR            0
38 #define GPMC_NAND           1
39 #define GPMC_MDOC           2
40 #define GPMC_ONENAND        3
41 #define MMC_NAND            4
42 #define MMC_ONENAND         5
43 #define GPMC_NONE           6
44 #define GPMC_ONENAND_TRY    7
45
46 #endif
47
48
49 /* New and compatability speed defines */
50 #if defined(PRCM_CLK_CFG2_200MHZ) || defined(PRCM_CONFIG_II)\
51                 || defined(PRCM_CONFIG_5B)
52 # define L3_100MHZ   /* Use with <= 100MHz SDRAM */
53 #elif defined(PRCM_CLK_CFG2_266MHZ) || defined(PRCM_CONFIG_III)\
54                 || defined(PRCM_CONFIG_5A)
55 # define L3_133MHZ    /* Use with <= 133MHz SDRAM*/
56 #elif defined(PRCM_CLK_CFG2_332MHZ) || defined(PRCM_CONFIG_I) \
57                 || defined(PRCM_CONFIG_2)
58 # define L3_165MHZ    /* Use with <= 165MHz SDRAM (L3=166 on 4430) */
59 #endif
60
61 /*
62  * GPMC settings -
63  * Definitions is as per the following format
64  * # define <PART>_GPMC_CONFIG<x> <value>
65  * Where:
66  * PART is the part name e.g. STNOR - Intel Strata Flash
67  * x is GPMC config registers from 1 to 6 (there will be 6 macros)
68  * Value is corresponding value
69  *
70  * For every valid PRCM configuration there should be only one definition of
71  * the same. if values are independent of the board, this definition will be
72  * present in this file if values are dependent on the board, then this should
73  * go into corresponding mem-boardName.h file
74  *
75  * Currently valid part Names are (PART):
76  * STNOR - Intel Strata Flash
77  * SMNAND - Samsung NAND
78  * M_NAND - Micron Large page x16 NAND
79  * MPDB - H4 MPDB board
80  * SBNOR - Sibley NOR
81  * ONNAND - Samsung One NAND
82  *
83  * include/configs/file.h contains the defn - for all CS we are interested
84  * #define OMAP44XX_GPMC_CSx PART
85  * #define OMAP44XX_GPMC_CSx_SIZE Size
86  * #define OMAP44XX_GPMC_CSx_MAP Map
87  * Where:
88  * x - CS number
89  * PART - Part Name as defined above
90  * SIZE - how big is the mapping to be
91  *   GPMC_SIZE_128M - 0x8
92  *   GPMC_SIZE_64M  - 0xC
93  *   GPMC_SIZE_32M  - 0xE
94  *   GPMC_SIZE_16M  - 0xF
95  * MAP  - Map this CS to which address(GPMC address space)- Absolute address
96  *   >>24 before being used.
97  */
98 #define GPMC_SIZE_128M  0x8
99 #define GPMC_SIZE_64M   0xC
100 #define GPMC_SIZE_32M   0xE
101 #define GPMC_SIZE_16M   0xF
102
103 #if defined(L3_100MHZ)
104 # define SMNAND_GPMC_CONFIG1 0x0
105 # define SMNAND_GPMC_CONFIG2 0x00141400
106 # define SMNAND_GPMC_CONFIG3 0x00141400
107 # define SMNAND_GPMC_CONFIG4 0x0F010F01
108 # define SMNAND_GPMC_CONFIG5 0x010C1414
109 # define SMNAND_GPMC_CONFIG6 0x00000A80
110
111 # define M_NAND_GPMC_CONFIG1 0x00001800
112 # define M_NAND_GPMC_CONFIG2 0x00141400
113 # define M_NAND_GPMC_CONFIG3 0x00141400
114 # define M_NAND_GPMC_CONFIG4 0x0F010F01
115 # define M_NAND_GPMC_CONFIG5 0x010C1414
116 # define M_NAND_GPMC_CONFIG6 0x1f0f0A80
117
118 # define STNOR_GPMC_CONFIG1  0x3
119 # define STNOR_GPMC_CONFIG2  0x000f0f01
120 # define STNOR_GPMC_CONFIG3  0x00050502
121 # define STNOR_GPMC_CONFIG4  0x0C060C06
122 # define STNOR_GPMC_CONFIG5  0x01131F1F
123 # define STNOR_GPMC_CONFIG6  0x1F0F0000
124
125 # define MPDB_GPMC_CONFIG1   0x00011000
126 # define MPDB_GPMC_CONFIG2   0x001F1F00
127 # define MPDB_GPMC_CONFIG3   0x00080802
128 # define MPDB_GPMC_CONFIG4   0x1C091C09
129 # define MPDB_GPMC_CONFIG5   0x031A1F1F
130 # define MPDB_GPMC_CONFIG6   0x000003C2
131 #endif
132
133 #if defined(L3_133MHZ)
134 # define SMNAND_GPMC_CONFIG1 0x00000800
135 # define SMNAND_GPMC_CONFIG2 0x00141400
136 # define SMNAND_GPMC_CONFIG3 0x00141400
137 # define SMNAND_GPMC_CONFIG4 0x0F010F01
138 # define SMNAND_GPMC_CONFIG5 0x010C1414
139 # define SMNAND_GPMC_CONFIG6 0x1F0F0A80
140 # define SMNAND_GPMC_CONFIG7 0x00000C44
141
142 # define M_NAND_GPMC_CONFIG1 0x00001800 /* might reuse smnand, with |= 1000 */
143 # define M_NAND_GPMC_CONFIG2 0x00141400
144 # define M_NAND_GPMC_CONFIG3 0x00141400
145 # define M_NAND_GPMC_CONFIG4 0x0F010F01
146 # define M_NAND_GPMC_CONFIG5 0x010C1414
147 # define M_NAND_GPMC_CONFIG6 0x1F0F0A80
148 # define M_NAND_GPMC_CONFIG7 0x00000C44
149
150 # define STNOR_GPMC_CONFIG1  0x1203
151 # define STNOR_GPMC_CONFIG2  0x00151501
152 # define STNOR_GPMC_CONFIG3  0x00060602
153 # define STNOR_GPMC_CONFIG4  0x10081008
154 # define STNOR_GPMC_CONFIG5  0x01131F1F
155 # define STNOR_GPMC_CONFIG6  0x1F0F04c4
156
157 # define SIBNOR_GPMC_CONFIG1  0x1200
158 # define SIBNOR_GPMC_CONFIG2  0x001f1f00
159 # define SIBNOR_GPMC_CONFIG3  0x00080802
160 # define SIBNOR_GPMC_CONFIG4  0x1C091C09
161 # define SIBNOR_GPMC_CONFIG5  0x01131F1F
162 # define SIBNOR_GPMC_CONFIG6  0x1F0F03C2
163
164 /* ES1 SDP and ES1 chip Debug FPGA */
165 # define MPDB_GPMC_CONFIG1  0x00011000
166 # define MPDB_GPMC_CONFIG2  0x001f1f01
167 # define MPDB_GPMC_CONFIG3  0x00080803
168 # define MPDB_GPMC_CONFIG4  0x1C091C09
169 # define MPDB_GPMC_CONFIG5  0x041f1F1F
170 # define MPDB_GPMC_CONFIG6  0x000004C4
171
172 /* ES2 SDP and ES2 chip Debug FPGA */
173 # define SDPV2_MPDB_GPMC_CONFIG1  0x00611200
174 # define SDPV2_MPDB_GPMC_CONFIG2  0x001F1F01
175 # define SDPV2_MPDB_GPMC_CONFIG3  0x00080803
176 # define SDPV2_MPDB_GPMC_CONFIG4  0x1D091D09
177 # define SDPV2_MPDB_GPMC_CONFIG5  0x041D1F1F
178 # define SDPV2_MPDB_GPMC_CONFIG6  0x1D0904C4
179
180 # define P2_GPMC_CONFIG1  0x0
181 # define P2_GPMC_CONFIG2  0x0
182 # define P2_GPMC_CONFIG3  0x0
183 # define P2_GPMC_CONFIG4  0x0
184 # define P2_GPMC_CONFIG5  0x0
185 # define P2_GPMC_CONFIG6  0x0
186
187 # define ONENAND_GPMC_CONFIG1 0x00001200
188 # define ONENAND_GPMC_CONFIG2 0x000c0c01
189 # define ONENAND_GPMC_CONFIG3 0x00030301
190 # define ONENAND_GPMC_CONFIG4 0x0c040c04
191 # define ONENAND_GPMC_CONFIG5 0x010C1010
192 # define ONENAND_GPMC_CONFIG6 0x1F060000
193
194 #endif /* endif L3_133MHZ */
195
196 #if defined(L3_165MHZ)
197 # define SMNAND_GPMC_CONFIG1 0x00000800
198 # define SMNAND_GPMC_CONFIG2 0x00060600
199 # define SMNAND_GPMC_CONFIG3 0x00060401
200 # define SMNAND_GPMC_CONFIG4 0x05010801
201 # define SMNAND_GPMC_CONFIG5 0x00090B0B
202 # define SMNAND_GPMC_CONFIG6 0x050001C0
203 # define SMNAND_GPMC_CONFIG7 0x00000C44
204
205 # define M_NAND_GPMC_CONFIG1 0x00001800
206 # define M_NAND_GPMC_CONFIG2 0x00141400
207 # define M_NAND_GPMC_CONFIG3 0x00141400
208 # define M_NAND_GPMC_CONFIG4 0x0F010F01
209 # define M_NAND_GPMC_CONFIG5 0x010C1414
210 # define M_NAND_GPMC_CONFIG6 0x1F0F0A80
211 # define M_NAND_GPMC_CONFIG7 0x00000C44
212
213 # define STNOR_GPMC_CONFIG1  0x3
214 # define STNOR_GPMC_CONFIG2  0x00151501
215 # define STNOR_GPMC_CONFIG3  0x00060602
216 # define STNOR_GPMC_CONFIG4  0x11091109
217 # define STNOR_GPMC_CONFIG5  0x01141F1F
218 # define STNOR_GPMC_CONFIG6  0x1F0F04c4
219
220 # define SIBNOR_GPMC_CONFIG1  0x1200
221 # define SIBNOR_GPMC_CONFIG2  0x001f1f00
222 # define SIBNOR_GPMC_CONFIG3  0x00080802
223 # define SIBNOR_GPMC_CONFIG4  0x1C091C09
224 # define SIBNOR_GPMC_CONFIG5  0x01131F1F
225 # define SIBNOR_GPMC_CONFIG6  0x1F0F03C2
226
227 # define SDPV2_MPDB_GPMC_CONFIG1  0x00611200
228 # define SDPV2_MPDB_GPMC_CONFIG2  0x001F1F01
229 # define SDPV2_MPDB_GPMC_CONFIG3  0x00080803
230 # define SDPV2_MPDB_GPMC_CONFIG4  0x1D091D09
231 # define SDPV2_MPDB_GPMC_CONFIG5  0x041D1F1F
232 # define SDPV2_MPDB_GPMC_CONFIG6  0x1D0904C4
233
234 # define MPDB_GPMC_CONFIG1  0x00011000
235 # define MPDB_GPMC_CONFIG2  0x001f1f01
236 # define MPDB_GPMC_CONFIG3  0x00080803
237 # define MPDB_GPMC_CONFIG4  0x1c0b1c0a
238 # define MPDB_GPMC_CONFIG5  0x041f1F1F
239 # define MPDB_GPMC_CONFIG6  0x1F0F04C4
240
241 # define LAB_ENET_GPMC_CONFIG1  0x00611000
242 # define LAB_ENET_GPMC_CONFIG2  0x001F1F01
243 # define LAB_ENET_GPMC_CONFIG3  0x00080803
244 # define LAB_ENET_GPMC_CONFIG4  0x1D091D09
245 # define LAB_ENET_GPMC_CONFIG5  0x041D1F1F
246 # define LAB_ENET_GPMC_CONFIG6  0x1D0904C4
247
248 # define P2_GPMC_CONFIG1  0x0
249 # define P2_GPMC_CONFIG2  0x0
250 # define P2_GPMC_CONFIG3  0x0
251 # define P2_GPMC_CONFIG4  0x0
252 # define P2_GPMC_CONFIG5  0x0
253 # define P2_GPMC_CONFIG6  0x0
254
255 # define ONENAND_GPMC_CONFIG1 0x00001200
256 # define ONENAND_GPMC_CONFIG2 0x000F0F01
257 # define ONENAND_GPMC_CONFIG3 0x00030301
258 # define ONENAND_GPMC_CONFIG4 0x0F040F04
259 # define ONENAND_GPMC_CONFIG5 0x010F1010
260 # define ONENAND_GPMC_CONFIG6 0x1F060000
261
262 #endif
263
264 /* max number of GPMC Chip Selects */
265 #define GPMC_MAX_CS     8
266 /* max number of GPMC regs */
267 #define GPMC_MAX_REG    7
268
269 #define PISMO1_NOR      1
270 #define PISMO1_NAND     2
271 #define PISMO2_CS0      3
272 #define PISMO2_CS1      4
273 #define PISMO1_ONENAND  5
274 #define DBG_MPDB        6
275 #define PISMO2_NAND_CS0 7
276 #define PISMO2_NAND_CS1 8
277
278 /* make it readable for the gpmc_init */
279 #define PISMO1_NOR_BASE         FLASH_BASE
280 #define PISMO1_NAND_BASE        NAND_BASE
281 #define PISMO2_CS0_BASE         PISMO2_MAP1
282 #define PISMO1_ONEN_BASE        ONENAND_MAP
283 #define DBG_MPDB_BASE           DEBUG_BASE
284
285 #endif /* endif _OMAP44XX_MEM_H_ */