]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - patches/0015-ENGR00112298-BBG2-Basic-boot.patch
imported Ka-Ro specific additions to U-Boot 2009.08 for TX28
[karo-tx-uboot.git] / patches / 0015-ENGR00112298-BBG2-Basic-boot.patch
1 From 31594f542d3c7b1db6b8404e608e452a604bd6d8 Mon Sep 17 00:00:00 2001
2 From: r65388 <r65388@freescale.com>
3 Date: Wed, 13 May 2009 16:32:51 +0800
4 Subject: [PATCH] ENGR00112298 BBG2: Basic boot.
5
6 Basic boot on BBG2 board.
7
8 Signed-off-by: r65388 <r65388@freescale.com>
9 ---
10  Makefile                              |    3 +
11  board/freescale/imx51/Makefile        |   49 ++++++
12  board/freescale/imx51/board-imx51.h   |   64 +++++++
13  board/freescale/imx51/config.mk       |    1 +
14  board/freescale/imx51/flash_header.S  |  113 +++++++++++++
15  board/freescale/imx51/imx51.c         |  290 +++++++++++++++++++++++++++++++++
16  board/freescale/imx51/lowlevel_init.S |  289 ++++++++++++++++++++++++++++++++
17  board/freescale/imx51/u-boot.lds      |   73 ++++++++
18  include/configs/imx51.h               |  221 +++++++++++++++++++++++++
19  9 files changed, 1103 insertions(+), 0 deletions(-)
20
21 diff --git a/Makefile b/Makefile
22 index a445f14..5eac5fb 100644
23 --- a/Makefile
24 +++ b/Makefile
25 @@ -3238,6 +3238,9 @@ Mx31_3stack_config        : unconfig
26  mx35_3stack_config     : unconfig
27         @$(MKCONFIG) $(@:_config=) arm arm1136 mx35_3stack freescale mx35
28  
29 +imx51_config           : unconfig
30 +       @$(MKCONFIG) $(@:_config=) arm arm_cortexa8 imx51 freescale mx51
31 +
32  mx51_3stack_config     : unconfig
33         @$(MKCONFIG) $(@:_config=) arm arm_cortexa8 mx51_3stack freescale mx51
34  
35 diff --git a/board/freescale/imx51/Makefile b/board/freescale/imx51/Makefile
36 new file mode 100644
37 index 0000000..fbd40f2
38 --- /dev/null
39 +++ b/board/freescale/imx51/Makefile
40 @@ -0,0 +1,49 @@
41 +#
42 +# Copyright (C) 2007, Guennadi Liakhovetski <lg@denx.de>
43 +#
44 +# (C) Copyright 2009 Freescale Semiconductor, Inc.
45 +#
46 +# This program is free software; you can redistribute it and/or
47 +# modify it under the terms of the GNU General Public License as
48 +# published by the Free Software Foundation; either version 2 of
49 +# the License, or (at your option) any later version.
50 +#
51 +# This program is distributed in the hope that it will be useful,
52 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
53 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
54 +# GNU General Public License for more details.
55 +#
56 +# You should have received a copy of the GNU General Public License
57 +# along with this program; if not, write to the Free Software
58 +# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
59 +# MA 02111-1307 USA
60 +#
61 +
62 +include $(TOPDIR)/config.mk
63 +
64 +LIB    = $(obj)lib$(BOARD).a
65 +
66 +COBJS  := imx51.o
67 +SOBJS  := lowlevel_init.o flash_header.o
68 +
69 +SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
70 +OBJS   := $(addprefix $(obj),$(COBJS))
71 +SOBJS  := $(addprefix $(obj),$(SOBJS))
72 +
73 +$(LIB):        $(obj).depend $(OBJS) $(SOBJS)
74 +       $(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS)
75 +
76 +clean:
77 +       rm -f $(SOBJS) $(OBJS)
78 +
79 +distclean:     clean
80 +       rm -f $(LIB) core *.bak .depend
81 +
82 +#########################################################################
83 +
84 +# defines $(obj).depend target
85 +include $(SRCTREE)/rules.mk
86 +
87 +sinclude $(obj).depend
88 +
89 +#########################################################################
90 diff --git a/board/freescale/imx51/board-imx51.h b/board/freescale/imx51/board-imx51.h
91 new file mode 100644
92 index 0000000..7a2cae0
93 --- /dev/null
94 +++ b/board/freescale/imx51/board-imx51.h
95 @@ -0,0 +1,64 @@
96 +/*
97 + * Copyright 2009 Freescale Semiconductor, Inc. All Rights Reserved.
98 + */
99 +
100 +/*
101 + * The code contained herein is licensed under the GNU General Public
102 + * License. You may obtain a copy of the GNU General Public License
103 + * Version 2 or later at the following locations:
104 + *
105 + * http://www.opensource.org/licenses/gpl-license.html
106 + * http://www.gnu.org/copyleft/gpl.html
107 + */
108 +
109 +#ifndef __BOARD_FREESCALE_BOARD_IMX51_H__
110 +#define __BOARD_FREESCALE_BOARD_IMX51_H__
111 +
112 +/*!
113 + * @defgroup BRDCFG_MX51 Board Configuration Options
114 + * @ingroup MSL_MX51
115 + */
116 +
117 +/*!
118 + * @file mx51_3stack/board-imx51.h
119 + *
120 + * @brief This file contains all the board level configuration options.
121 + *
122 + * It currently hold the options defined for MX51 3Stack Platform.
123 + *
124 + * @ingroup BRDCFG_IMX51
125 + */
126 +
127 +/* CPLD offsets */
128 +#define PBC_LED_CTRL           (0x20000)
129 +#define PBC_SB_STAT            (0x20008)
130 +#define PBC_ID_AAAA            (0x20040)
131 +#define PBC_ID_5555            (0x20048)
132 +#define PBC_VERSION            (0x20050)
133 +#define PBC_ID_CAFE            (0x20058)
134 +#define PBC_INT_STAT           (0x20010)
135 +#define PBC_INT_MASK           (0x20038)
136 +#define PBC_INT_REST           (0x20020)
137 +#define PBC_SW_RESET           (0x20060)
138 +
139 +/* LED switchs */
140 +#define LED_SWITCH_REG         0x00
141 +/* buttons */
142 +#define SWITCH_BUTTONS_REG     0x08
143 +/* status, interrupt */
144 +#define INTR_STATUS_REG        0x10
145 +#define INTR_MASK_REG          0x38
146 +#define INTR_RESET_REG         0x20
147 +/* magic word for debug CPLD */
148 +#define MAGIC_NUMBER1_REG      0x40
149 +#define MAGIC_NUMBER2_REG      0x48
150 +/* CPLD code version */
151 +#define CPLD_CODE_VER_REG      0x50
152 +/* magic word for debug CPLD */
153 +#define MAGIC_NUMBER3_REG      0x58
154 +/* module reset register*/
155 +#define MODULE_RESET_REG       0x60
156 +/* CPU ID and Personality ID */
157 +#define MCU_BOARD_ID_REG       0x68
158 +
159 +#endif                         /* __BOARD_FREESCALE_BOARD_IMX51_H__ */
160 diff --git a/board/freescale/imx51/config.mk b/board/freescale/imx51/config.mk
161 new file mode 100644
162 index 0000000..ce7369d
163 --- /dev/null
164 +++ b/board/freescale/imx51/config.mk
165 @@ -0,0 +1 @@
166 +TEXT_BASE = 0x97800000
167 diff --git a/board/freescale/imx51/flash_header.S b/board/freescale/imx51/flash_header.S
168 new file mode 100644
169 index 0000000..6790679
170 --- /dev/null
171 +++ b/board/freescale/imx51/flash_header.S
172 @@ -0,0 +1,113 @@
173 +/*
174 + * Copyright 2009 Freescale Semiconductor, Inc.
175 + *
176 + * This program is free software; you can redistribute it and/or
177 + * modify it under the terms of the GNU General Public License as
178 + * published by the Free Software Foundation; either version 2 of
179 + * the License, or (at your option) any later version.
180 + *
181 + * This program is distributed in the hope that it will be useful,
182 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
183 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
184 + * GNU General Public License for more details.
185 + *
186 + * You should have received a copy of the GNU General Public License
187 + * along with this program; if not, write to the Free Software
188 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
189 + * MA 02111-1307 USA
190 + */
191 +
192 +#include <config.h>
193 +#include <asm/arch/mx51.h>
194 +#include "board-imx51.h"
195 +
196 +#ifdef CONFIG_FLASH_HEADER
197 +#ifndef CONFIG_FLASH_HEADER_OFFSET
198 +# error "Must define the offset of flash header"
199 +#endif
200 +#define MXC_DCD_ITEM(i, type, addr, val)       \
201 +dcd_node_##i:                                  \
202 +       .word type                      ;       \
203 +       .word addr                      ;       \
204 +       .word val                       ;       \
205 +
206 +.section ".text.flasheader", "x"
207 +       b       _start
208 +       .org    CONFIG_FLASH_HEADER_OFFSET
209 +app_code_jump_v:       .word   _start
210 +app_code_code_barker:  .word   CONFIG_FLASH_HEADER_BARKER
211 +app_code_csf:          .word   0
212 +dcd_ptr_ptr:           .word   dcd_ptr
213 +super_root_key:                .word   0
214 +dcd_ptr:               .word   dcd_array_start
215 +app_dest_ptr:          .word   TEXT_BASE
216 +dcd_array_start:
217 +magic:                 .word   0xB17219E9
218 +dcd_array_size:                .word   dcd_data_end - dcd_array_start - 8
219 +/* DCD */
220 +/* DDR2 IOMUX configuration */
221 +MXC_DCD_ITEM(1, 4, IOMUXC_BASE_ADDR + 0x8a0, 0x200)
222 +MXC_DCD_ITEM(2, 4, IOMUXC_BASE_ADDR + 0x50c, 0x20c5)
223 +MXC_DCD_ITEM(3, 4, IOMUXC_BASE_ADDR + 0x510, 0x20c5)
224 +MXC_DCD_ITEM(4, 4, IOMUXC_BASE_ADDR + 0x83c, 0x2)
225 +MXC_DCD_ITEM(5, 4, IOMUXC_BASE_ADDR + 0x848, 0x2)
226 +MXC_DCD_ITEM(6, 4, IOMUXC_BASE_ADDR + 0x4b8, 0xe7)
227 +MXC_DCD_ITEM(7, 4, IOMUXC_BASE_ADDR + 0x4bc, 0x45)
228 +MXC_DCD_ITEM(8, 4, IOMUXC_BASE_ADDR + 0x4c0, 0x45)
229 +MXC_DCD_ITEM(9, 4, IOMUXC_BASE_ADDR + 0x4c4, 0x45)
230 +MXC_DCD_ITEM(10, 4, IOMUXC_BASE_ADDR + 0x4c8, 0x45)
231 +MXC_DCD_ITEM(11, 4, IOMUXC_BASE_ADDR + 0x820, 0x0)
232 +MXC_DCD_ITEM(12, 4, IOMUXC_BASE_ADDR + 0x4a4, 0x3)
233 +MXC_DCD_ITEM(13, 4, IOMUXC_BASE_ADDR + 0x4a8, 0x3)
234 +MXC_DCD_ITEM(14, 4, IOMUXC_BASE_ADDR + 0x4ac, 0xe3)
235 +MXC_DCD_ITEM(15, 4, IOMUXC_BASE_ADDR + 0x4b0, 0xe3)
236 +MXC_DCD_ITEM(16, 4, IOMUXC_BASE_ADDR + 0x4b4, 0xe3)
237 +MXC_DCD_ITEM(17, 4, IOMUXC_BASE_ADDR + 0x4cc, 0xe3)
238 +MXC_DCD_ITEM(18, 4, IOMUXC_BASE_ADDR + 0x4d0, 0xe2)
239 +/* Set drive strength to MAX */
240 +MXC_DCD_ITEM(19, 4, IOMUXC_BASE_ADDR + 0x82c, 0x6)
241 +MXC_DCD_ITEM(20, 4, IOMUXC_BASE_ADDR + 0x8a4, 0x6)
242 +MXC_DCD_ITEM(21, 4, IOMUXC_BASE_ADDR + 0x8ac, 0x6)
243 +MXC_DCD_ITEM(22, 4, IOMUXC_BASE_ADDR + 0x8b8, 0x6)
244 +/* 13 ROW, 10 COL, 32Bit, SREF=4 Micron Model */
245 +/* CAS=3,  BL=4 */
246 +MXC_DCD_ITEM(23, 4, ESDCTL_BASE_ADDR + ESDCTL_ESDCTL0, 0x82a20000)
247 +MXC_DCD_ITEM(24, 4, ESDCTL_BASE_ADDR + ESDCTL_ESDCTL1, 0x82a20000)
248 +MXC_DCD_ITEM(25, 4, ESDCTL_BASE_ADDR + ESDCTL_ESDMISC, 0x000ad0d0)
249 +MXC_DCD_ITEM(26, 4, ESDCTL_BASE_ADDR + ESDCTL_ESDCFG0, 0x333574aa)
250 +MXC_DCD_ITEM(27, 4, ESDCTL_BASE_ADDR + ESDCTL_ESDCFG1, 0x333574aa)
251 +/* Init DRAM on CS0 */
252 +MXC_DCD_ITEM(28, 4, ESDCTL_BASE_ADDR + ESDCTL_ESDSCR, 0x04008008)
253 +MXC_DCD_ITEM(29, 4, ESDCTL_BASE_ADDR + ESDCTL_ESDSCR, 0x0000801a)
254 +MXC_DCD_ITEM(30, 4, ESDCTL_BASE_ADDR + ESDCTL_ESDSCR, 0x0000801b)
255 +MXC_DCD_ITEM(31, 4, ESDCTL_BASE_ADDR + ESDCTL_ESDSCR, 0x00448019)
256 +MXC_DCD_ITEM(32, 4, ESDCTL_BASE_ADDR + ESDCTL_ESDSCR, 0x07328018)
257 +MXC_DCD_ITEM(33, 4, ESDCTL_BASE_ADDR + ESDCTL_ESDSCR, 0x04008008)
258 +MXC_DCD_ITEM(34, 4, ESDCTL_BASE_ADDR + ESDCTL_ESDSCR, 0x00008010)
259 +MXC_DCD_ITEM(35, 4, ESDCTL_BASE_ADDR + ESDCTL_ESDSCR, 0x00008010)
260 +MXC_DCD_ITEM(36, 4, ESDCTL_BASE_ADDR + ESDCTL_ESDSCR, 0x06328018)
261 +MXC_DCD_ITEM(37, 4, ESDCTL_BASE_ADDR + ESDCTL_ESDSCR, 0x03808019)
262 +MXC_DCD_ITEM(38, 4, ESDCTL_BASE_ADDR + ESDCTL_ESDSCR, 0x00408019)
263 +MXC_DCD_ITEM(39, 4, ESDCTL_BASE_ADDR + ESDCTL_ESDSCR, 0x00008000)
264 +/* Init DRAM on CS1 */
265 +MXC_DCD_ITEM(40, 4, ESDCTL_BASE_ADDR + ESDCTL_ESDSCR, 0x0400800c)
266 +MXC_DCD_ITEM(41, 4, ESDCTL_BASE_ADDR + ESDCTL_ESDSCR, 0x0000801e)
267 +MXC_DCD_ITEM(42, 4, ESDCTL_BASE_ADDR + ESDCTL_ESDSCR, 0x0000801f)
268 +MXC_DCD_ITEM(43, 4, ESDCTL_BASE_ADDR + ESDCTL_ESDSCR, 0x0000801d)
269 +MXC_DCD_ITEM(44, 4, ESDCTL_BASE_ADDR + ESDCTL_ESDSCR, 0x0732801c)
270 +MXC_DCD_ITEM(45, 4, ESDCTL_BASE_ADDR + ESDCTL_ESDSCR, 0x0400800c)
271 +MXC_DCD_ITEM(46, 4, ESDCTL_BASE_ADDR + ESDCTL_ESDSCR, 0x00008014)
272 +MXC_DCD_ITEM(47, 4, ESDCTL_BASE_ADDR + ESDCTL_ESDSCR, 0x00008014)
273 +MXC_DCD_ITEM(48, 4, ESDCTL_BASE_ADDR + ESDCTL_ESDSCR, 0x0632801c)
274 +MXC_DCD_ITEM(49, 4, ESDCTL_BASE_ADDR + ESDCTL_ESDSCR, 0x0380801d)
275 +MXC_DCD_ITEM(50, 4, ESDCTL_BASE_ADDR + ESDCTL_ESDSCR, 0x0040801d)
276 +MXC_DCD_ITEM(51, 4, ESDCTL_BASE_ADDR + ESDCTL_ESDSCR, 0x00008004)
277 +MXC_DCD_ITEM(52, 4, ESDCTL_BASE_ADDR + ESDCTL_ESDCTL0, 0xb2a20000)
278 +MXC_DCD_ITEM(53, 4, ESDCTL_BASE_ADDR + ESDCTL_ESDCTL1, 0xb2a20000)
279 +MXC_DCD_ITEM(54, 4, ESDCTL_BASE_ADDR + ESDCTL_ESDMISC, 0x000ad6d0)
280 +MXC_DCD_ITEM(55, 4, ESDCTL_BASE_ADDR + ESDCTL_ESDCDLYGD, 0x90000000)
281 +MXC_DCD_ITEM(56, 4, ESDCTL_BASE_ADDR + ESDCTL_ESDSCR, 0x00000000)
282 +dcd_data_end:
283 +image_len:             .word   0x100000
284 +//image_len:           .word   _end - _start
285 +#endif
286 diff --git a/board/freescale/imx51/imx51.c b/board/freescale/imx51/imx51.c
287 new file mode 100644
288 index 0000000..c8fe23b
289 --- /dev/null
290 +++ b/board/freescale/imx51/imx51.c
291 @@ -0,0 +1,290 @@
292 +/*
293 + * Copyright (C) 2007, Guennadi Liakhovetski <lg@denx.de>
294 + *
295 + * (C) Copyright 2009 Freescale Semiconductor, Inc.
296 + *
297 + * See file CREDITS for list of people who contributed to this
298 + * project.
299 + *
300 + * This program is free software; you can redistribute it and/or
301 + * modify it under the terms of the GNU General Public License as
302 + * published by the Free Software Foundation; either version 2 of
303 + * the License, or (at your option) any later version.
304 + *
305 + * This program is distributed in the hope that it will be useful,
306 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
307 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
308 + * GNU General Public License for more details.
309 + *
310 + * You should have received a copy of the GNU General Public License
311 + * along with this program; if not, write to the Free Software
312 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
313 + * MA 02111-1307 USA
314 + */
315 +
316 +#include <common.h>
317 +#include <asm/io.h>
318 +#include <asm/errno.h>
319 +#include <asm/arch/mx51.h>
320 +#include <asm/arch/mx51_pins.h>
321 +#include <asm/arch/iomux.h>
322 +#include <i2c.h>
323 +#include "board-imx51.h"
324 +
325 +DECLARE_GLOBAL_DATA_PTR;
326 +
327 +static u32 system_rev;
328 +u32    mx51_io_base_addr;
329 +volatile u32 *esdhc_base_pointer;
330 +
331 +u32 get_board_rev(void)
332 +{
333 +       return system_rev;
334 +}
335 +
336 +static inline void setup_soc_rev(void)
337 +{
338 +       int reg;
339 +       reg = __REG(ROM_SI_REV);
340 +       switch (reg) {
341 +       case 0x02:
342 +               system_rev = 0x51000 | CHIP_REV_1_1;
343 +               break;
344 +       case 0x10:
345 +               system_rev = 0x51000 | CHIP_REV_2_0;
346 +               break;
347 +       default:
348 +               system_rev = 0x51000 | CHIP_REV_1_0;
349 +       }
350 +}
351 +
352 +static inline void set_board_rev(int rev)
353 +{
354 +       system_rev |= (rev & 0xF) << 8;
355 +}
356 +
357 +inline int is_soc_rev(int rev)
358 +{
359 +       return (system_rev & 0xFF) - rev;
360 +}
361 +
362 +int dram_init(void)
363 +{
364 +       gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
365 +       gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
366 +       return 0;
367 +}
368 +
369 +static void setup_uart(void)
370 +{
371 +       unsigned int pad = PAD_CTL_HYS_ENABLE | PAD_CTL_PKE_ENABLE |
372 +                        PAD_CTL_PUE_PULL | PAD_CTL_DRV_HIGH;
373 +       mxc_request_iomux(MX51_PIN_UART1_RXD, IOMUX_CONFIG_ALT0);
374 +       mxc_iomux_set_pad(MX51_PIN_UART1_RXD, pad | PAD_CTL_SRE_FAST);
375 +       mxc_request_iomux(MX51_PIN_UART1_TXD, IOMUX_CONFIG_ALT0);
376 +       mxc_iomux_set_pad(MX51_PIN_UART1_TXD, pad | PAD_CTL_SRE_FAST);
377 +       mxc_request_iomux(MX51_PIN_UART1_RTS, IOMUX_CONFIG_ALT0);
378 +       mxc_iomux_set_pad(MX51_PIN_UART1_RTS, pad);
379 +       mxc_request_iomux(MX51_PIN_UART1_CTS, IOMUX_CONFIG_ALT0);
380 +       mxc_iomux_set_pad(MX51_PIN_UART1_CTS, pad);
381 +}
382 +
383 +void setup_nfc(void)
384 +{
385 +       /* Enable NFC IOMUX */
386 +       mxc_request_iomux(MX51_PIN_NANDF_CS0, IOMUX_CONFIG_ALT0);
387 +       mxc_request_iomux(MX51_PIN_NANDF_CS1, IOMUX_CONFIG_ALT0);
388 +       mxc_request_iomux(MX51_PIN_NANDF_CS2, IOMUX_CONFIG_ALT0);
389 +       mxc_request_iomux(MX51_PIN_NANDF_CS3, IOMUX_CONFIG_ALT0);
390 +       mxc_request_iomux(MX51_PIN_NANDF_CS4, IOMUX_CONFIG_ALT0);
391 +       mxc_request_iomux(MX51_PIN_NANDF_CS5, IOMUX_CONFIG_ALT0);
392 +       mxc_request_iomux(MX51_PIN_NANDF_CS6, IOMUX_CONFIG_ALT0);
393 +       mxc_request_iomux(MX51_PIN_NANDF_CS7, IOMUX_CONFIG_ALT0);
394 +}
395 +
396 +static void setup_expio(void)
397 +{
398 +       u32 reg;
399 +       /* CS5 setup */
400 +       mxc_request_iomux(MX51_PIN_EIM_CS5, IOMUX_CONFIG_ALT0);
401 +       writel(0x00410089, WEIM_BASE_ADDR + 0x78 + CSGCR1);
402 +       writel(0x00000002, WEIM_BASE_ADDR + 0x78 + CSGCR2);
403 +       /* RWSC=50, RADVA=2, RADVN=6, OEA=0, OEN=0, RCSA=0, RCSN=0 */
404 +       writel(0x32260000, WEIM_BASE_ADDR + 0x78 + CSRCR1);
405 +       /* APR = 0 */
406 +       writel(0x00000000, WEIM_BASE_ADDR + 0x78 + CSRCR2);
407 +       /* WAL=0, WBED=1, WWSC=50, WADVA=2, WADVN=6, WEA=0, WEN=0,
408 +        * WCSA=0, WCSN=0
409 +        */
410 +       writel(0x72080F00, WEIM_BASE_ADDR + 0x78 + CSWCR1);
411 +       if ((readw(CS5_BASE_ADDR + PBC_ID_AAAA) == 0xAAAA) &&
412 +           (readw(CS5_BASE_ADDR + PBC_ID_5555) == 0x5555)) {
413 +               if (is_soc_rev(CHIP_REV_2_0) < 0) {
414 +                       reg = readl(CCM_BASE_ADDR + CLKCTL_CBCDR);
415 +                       reg = (reg & (~0x70000)) | 0x30000;
416 +                       writel(reg, CCM_BASE_ADDR + CLKCTL_CBCDR);
417 +                       /* make sure divider effective */
418 +                       while (readl(CCM_BASE_ADDR + CLKCTL_CDHIPR) != 0)
419 +                               ;
420 +                       writel(0x0, CCM_BASE_ADDR + CLKCTL_CCDR);
421 +               }
422 +               mx51_io_base_addr = CS5_BASE_ADDR;
423 +       } else {
424 +               /* CS1 */
425 +               writel(0x00410089, WEIM_BASE_ADDR + 0x18 + CSGCR1);
426 +               writel(0x00000002, WEIM_BASE_ADDR + 0x18 + CSGCR2);
427 +               /*  RWSC=50, RADVA=2, RADVN=6, OEA=0, OEN=0, RCSA=0, RCSN=0 */
428 +               writel(0x32260000, WEIM_BASE_ADDR + 0x18 + CSRCR1);
429 +               /* APR=0 */
430 +               writel(0x00000000, WEIM_BASE_ADDR + 0x18 + CSRCR2);
431 +               /* WAL=0, WBED=1, WWSC=50, WADVA=2, WADVN=6, WEA=0,
432 +                * WEN=0, WCSA=0, WCSN=0
433 +                */
434 +               writel(0x72080F00, WEIM_BASE_ADDR + 0x18 + CSWCR1);
435 +               mx51_io_base_addr = CS1_BASE_ADDR;
436 +       }
437 +
438 +       /* Reset interrupt status reg */
439 +       writew(0x1F, mx51_io_base_addr + PBC_INT_REST);
440 +       writew(0x00, mx51_io_base_addr + PBC_INT_REST);
441 +       writew(0xFFFF, mx51_io_base_addr + PBC_INT_MASK);
442 +
443 +       /* Reset the XUART and Ethernet controllers */
444 +       reg = readw(mx51_io_base_addr + PBC_SW_RESET);
445 +       reg |= 0x9;
446 +       writew(reg, mx51_io_base_addr + PBC_SW_RESET);
447 +       reg &= ~0x9;
448 +       writew(reg, mx51_io_base_addr + PBC_SW_RESET);
449 +}
450 +
451 +int board_init(void)
452 +{
453 +       int pad;
454 +       setup_soc_rev();
455 +
456 +       gd->bd->bi_arch_number = MACH_TYPE_MX51_3DS;    /* board id for linux */
457 +       /* address of boot parameters */
458 +       gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
459 +
460 +       setup_uart();
461 +       setup_nfc();
462 +       setup_expio();
463 +       return 0;
464 +}
465 +
466 +#ifdef BOARD_LATE_INIT
467 +int board_late_init(void)
468 +{
469 +       return 0;
470 +}
471 +#endif
472 +
473 +int checkboard(void)
474 +{
475 +       printf("Board: MX51 3STACK [");
476 +       switch (__REG(SRC_BASE_ADDR + 0x8)) {
477 +       case 0x0001:
478 +               printf("POR");
479 +               break;
480 +       case 0x0009:
481 +               printf("RST");
482 +               break;
483 +       case 0x0010:
484 +       case 0x0011:
485 +               printf("WDOG");
486 +               break;
487 +       default:
488 +               printf("unknown");
489 +       }
490 +       printf("]\n");
491 +       return 0;
492 +}
493 +
494 +#ifdef CONFIG_NET_MULTI
495 +int board_eth_init(bd_t *bis)
496 +{
497 +       int rc = -ENODEV;
498 +#if defined(CONFIG_DRIVER_SMC911X)
499 +        rc = smc911x_initialize(bis);
500 +#endif
501 +       return rc;
502 +}
503 +#endif
504 +
505 +#ifdef CONFIG_FSL_MMC
506 +
507 +int sdhc_init(void)
508 +{
509 +       u32 interface_esdhc = 0;
510 +       u32 pad_val = 0;
511 +       s32 status = 0;
512 +
513 +       interface_esdhc = (readl(SRC_BASE_ADDR + 0x4) & (0x00180000)) >> 19;
514 +
515 +       switch (interface_esdhc) {
516 +       case 0:
517 +
518 +               esdhc_base_pointer = (volatile u32 *)MMC_SDHC1_BASE_ADDR;
519 +
520 +               mxc_request_iomux(MX51_PIN_SD1_CMD,
521 +                         IOMUX_CONFIG_ALT0 | IOMUX_CONFIG_SION);
522 +               mxc_request_iomux(MX51_PIN_SD1_CLK,
523 +                         IOMUX_CONFIG_ALT0 | IOMUX_CONFIG_SION);
524 +
525 +               mxc_request_iomux(MX51_PIN_SD1_DATA0,
526 +                               IOMUX_CONFIG_ALT0 | IOMUX_CONFIG_SION);
527 +               mxc_request_iomux(MX51_PIN_SD1_DATA1,
528 +                               IOMUX_CONFIG_ALT0 | IOMUX_CONFIG_SION);
529 +               mxc_request_iomux(MX51_PIN_SD1_DATA2,
530 +                               IOMUX_CONFIG_ALT0 | IOMUX_CONFIG_SION);
531 +               mxc_request_iomux(MX51_PIN_SD1_DATA3,
532 +                               IOMUX_CONFIG_ALT0 | IOMUX_CONFIG_SION);
533 +               mxc_iomux_set_pad(MX51_PIN_SD1_CMD,
534 +                               PAD_CTL_DRV_MAX | PAD_CTL_DRV_VOT_HIGH |
535 +                               PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU |
536 +                               PAD_CTL_PUE_PULL |
537 +                               PAD_CTL_PKE_ENABLE | PAD_CTL_SRE_FAST);
538 +               mxc_iomux_set_pad(MX51_PIN_SD1_CLK,
539 +                               PAD_CTL_DRV_MAX | PAD_CTL_DRV_VOT_HIGH |
540 +                               PAD_CTL_HYS_NONE | PAD_CTL_47K_PU |
541 +                               PAD_CTL_PUE_PULL |
542 +                               PAD_CTL_PKE_ENABLE | PAD_CTL_SRE_FAST);
543 +               mxc_iomux_set_pad(MX51_PIN_SD1_DATA0,
544 +                               PAD_CTL_DRV_MAX | PAD_CTL_DRV_VOT_HIGH |
545 +                               PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU |
546 +                               PAD_CTL_PUE_PULL |
547 +                               PAD_CTL_PKE_ENABLE | PAD_CTL_SRE_FAST);
548 +               mxc_iomux_set_pad(MX51_PIN_SD1_DATA1,
549 +                               PAD_CTL_DRV_MAX | PAD_CTL_DRV_VOT_HIGH |
550 +                               PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU |
551 +                               PAD_CTL_PUE_PULL |
552 +                               PAD_CTL_PKE_ENABLE | PAD_CTL_SRE_FAST);
553 +               mxc_iomux_set_pad(MX51_PIN_SD1_DATA2,
554 +                               PAD_CTL_DRV_MAX | PAD_CTL_DRV_VOT_HIGH |
555 +                               PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU |
556 +                               PAD_CTL_PUE_PULL |
557 +                               PAD_CTL_PKE_ENABLE | PAD_CTL_SRE_FAST);
558 +               mxc_iomux_set_pad(MX51_PIN_SD1_DATA3,
559 +                               PAD_CTL_DRV_MAX | PAD_CTL_DRV_VOT_HIGH |
560 +                               PAD_CTL_HYS_ENABLE | PAD_CTL_100K_PD |
561 +                               PAD_CTL_PUE_PULL |
562 +                               PAD_CTL_PKE_ENABLE | PAD_CTL_SRE_FAST);
563 +               break;
564 +       case 1:
565 +               status = 1;
566 +               break;
567 +       case 2:
568 +               status = 1;
569 +               break;
570 +       case 3:
571 +               status = 1;
572 +               break;
573 +       default:
574 +               status = 1;
575 +               break;
576 +       }
577 +
578 +       return status = 1;
579 +}
580 +
581 +#endif
582 diff --git a/board/freescale/imx51/lowlevel_init.S b/board/freescale/imx51/lowlevel_init.S
583 new file mode 100644
584 index 0000000..4fff3e5
585 --- /dev/null
586 +++ b/board/freescale/imx51/lowlevel_init.S
587 @@ -0,0 +1,289 @@
588 +/*
589 + * Copyright (C) 2007, Guennadi Liakhovetski <lg@denx.de>
590 + *
591 + * (C) Copyright 2009 Freescale Semiconductor, Inc.
592 + *
593 + * This program is free software; you can redistribute it and/or
594 + * modify it under the terms of the GNU General Public License as
595 + * published by the Free Software Foundation; either version 2 of
596 + * the License, or (at your option) any later version.
597 + *
598 + * This program is distributed in the hope that it will be useful,
599 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
600 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
601 + * GNU General Public License for more details.
602 + *
603 + * You should have received a copy of the GNU General Public License
604 + * along with this program; if not, write to the Free Software
605 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
606 + * MA 02111-1307 USA
607 + */
608 +
609 +#include <config.h>
610 +#include <asm/arch/mx51.h>
611 +#include "board-imx51.h"
612 +
613 +/*
614 + * return soc version
615 + *     0x10:  TO1
616 + *     0x20:  TO2
617 + *     0x30:  TO3
618 + */
619 +.macro check_soc_version ret, tmp
620 +.endm
621 +
622 +/*
623 + * L2CC Cache setup/invalidation/disable
624 + */
625 +.macro init_l2cc
626 +       /* reconfigure L2 cache aux control reg */
627 +       ldr r0, =0x03C000C4
628 +       mcr p15, 1, r0, c9, c0, 2
629 +.endm /* init_l2cc */
630 +
631 +/* AIPS setup - Only setup MPROTx registers.
632 + * The PACR default values are good.*/
633 +.macro init_aips
634 +       /*
635 +        * Set all MPROTx to be non-bufferable, trusted for R/W,
636 +        * not forced to user-mode.
637 +        */
638 +       ldr r0, =AIPS1_BASE_ADDR
639 +       ldr r1, =0x77777777
640 +       str r1, [r0, #0x0]
641 +       str r1, [r0, #0x4]
642 +       ldr r0, =AIPS2_BASE_ADDR
643 +       str r1, [r0, #0x0]
644 +       str r1, [r0, #0x4]
645 +       /*
646 +        * Clear the on and off peripheral modules Supervisor Protect bit
647 +        * for SDMA to access them. Did not change the AIPS control registers
648 +        * (offset 0x20) access type
649 +        */
650 +.endm /* init_aips */
651 +
652 +/* MAX (Multi-Layer AHB Crossbar Switch) setup */
653 +.macro init_max
654 +.endm /* init_max */
655 +
656 +/* M4IF setup */
657 +.macro init_m4if
658 +       /* VPU and IPU given higher priority (0x4)
659 +        * IPU accesses with ID=0x1 given highest priority (=0xA)
660 +        */
661 +       ldr r0, =M4IF_BASE_ADDR
662 +
663 +       ldr r1, =0x00000203
664 +       str r1, [r0, #0x40]
665 +
666 +       ldr r1, =0x0
667 +       str r1, [r0, #0x44]
668 +
669 +       ldr r1, =0x00120125
670 +       str r1, [r0, #0x9C]
671 +
672 +       ldr r1, =0x001901A3
673 +       str r1, [r0, #0x48]
674 +
675 +/*
676 +       ldr r1, =0x00000a01
677 +       str r1, [r0, #0x48]
678 +       ldr r1, =0x00000404
679 +       str r1, [r0, #0x40]
680 +*/
681 +.endm /* init_m4if */
682 +
683 +/* To support 133MHz DDR */
684 +.macro  init_drive_strength
685 +.endm /* init_drive_strength */
686 +
687 +/* CPLD on CS5 setup */
688 +.macro init_debug_board
689 +.endm /* init_debug_board */
690 +
691 +.macro setup_pll pll, freq
692 +       ldr r2, =\pll
693 +       ldr r1, =0x00001232
694 +       str r1, [r2, #PLL_DP_CTL] /* Set DPLL ON (set UPEN bit): BRMO=1 */
695 +       mov r1, #0x2
696 +       str r1, [r2, #PLL_DP_CONFIG] /* Enable auto-restart AREN bit */
697 +
698 +       str r3, [r2, #PLL_DP_OP]
699 +       str r3, [r2, #PLL_DP_HFS_OP]
700 +
701 +       str r4, [r2, #PLL_DP_MFD]
702 +       str r4, [r2, #PLL_DP_HFS_MFD]
703 +
704 +       str r5, [r2, #PLL_DP_MFN]
705 +       str r5, [r2, #PLL_DP_HFS_MFN]
706 +
707 +       ldr r1, =0x00001232
708 +       str r1, [r2, #PLL_DP_CTL]
709 +1:     ldr r1, [r2, #PLL_DP_CTL]
710 +       ands r1, r1, #0x1
711 +       beq 1b
712 +.endm
713 +
714 +.macro init_clock
715 +       ldr r0, =CCM_BASE_ADDR
716 +       mov r1, #0x00060000
717 +       str r1, [r0, #CLKCTL_CCDR]
718 +
719 +       /* Switch ARM to step clock */
720 +       mov r1, #0x4
721 +       str r1, [r0, #CLKCTL_CCSR]
722 +
723 +       mov r3, #DP_OP_800
724 +       mov r4, #DP_MFD_800
725 +       mov r5, #DP_MFN_800
726 +       setup_pll PLL1_BASE_ADDR
727 +       mov r3, #DP_OP_665
728 +       mov r4, #DP_MFD_665
729 +       mov r5, #DP_MFN_665
730 +       setup_pll PLL3_BASE_ADDR
731 +
732 +       /* Switch peripheral to PLL 3 */
733 +       ldr r1, =0x0000D3C0
734 +       str r1, [r0, #CLKCTL_CBCMR]
735 +       ldr r1, =0x033B9145
736 +       str r1, [r0, #CLKCTL_CBCDR]
737 +       mov r3, #DP_OP_665
738 +       mov r4, #DP_MFD_665
739 +       mov r5, #DP_MFN_665
740 +       setup_pll PLL2_BASE_ADDR
741 +
742 +       /* Switch peripheral to PLL2 */
743 +       ldr r1, =0x013B9145
744 +       str r1, [r0, #CLKCTL_CBCDR]
745 +       ldr r1, =0x0000E3C0
746 +       str r1, [r0, #CLKCTL_CBCMR]
747 +
748 +       mov r3, #DP_OP_216
749 +       mov r4, #DP_MFD_216
750 +       mov r5, #DP_MFN_216
751 +       setup_pll PLL3_BASE_ADDR
752 +
753 +       /* Set the platform clock dividers */
754 +       ldr r2, =ARM_BASE_ADDR
755 +       ldr r1, =0x00000725
756 +       str r1, [r2, #0x14]
757 +
758 +       /* Switch ARM back to PLL 1 */
759 +       mov r1, #0
760 +       str r1, [r0,  #CLKCTL_CCSR]
761 +       str r1, [r0,  #CLKCTL_CACRR]
762 +
763 +       /* Use lp_apm (24MHz) source for perclk */
764 +       mov r2, #0x48
765 +       ldr r2, [r0]
766 +       cmp r2, #0x10
767 +       ldrhs r1, =0x000020C2
768 +       ldrlo r1, =0x0000E3C2
769 +       str r1, [r0, #CLKCTL_CBCMR]
770 +       /* TO1.x emi = ahb, all perclk dividers are 1 since using 24MHz */
771 +       /* TO2.x ddr from PLL1, all perclk dividers are 1 since using 24MHz */
772 +       ldrhs r1, =0x59239100
773 +       ldrlo r1, =0x013D9100
774 +       strlo r1, [r0, #CLKCTL_CBCDR]
775 +
776 +       /* use PLL2 for UART source, get 66.5MHz */
777 +       ldr r1, =0xA5A2A020
778 +       str r1, [r0, #CLKCTL_CSCMR1]
779 +       ldr r1, =0x00C30321
780 +       str r1, [r0, #CLKCTL_CSCDR1]
781 +
782 +       /* make sure divider effective */
783 +1:     ldr r1, [r0, #CLKCTL_CDHIPR]
784 +       cmp r1, #0
785 +       bne 1b
786 +
787 +       mov r1, #0x0
788 +       str r1, [r0, #CLKCTL_CCDR]
789 +.endm
790 +
791 +.macro setup_wdog
792 +       ldr r0, =WDOG1_BASE_ADDR
793 +       mov r1, #0x30
794 +       strh r1, [r0]
795 +.endm
796 +
797 +.section ".text.init", "x"
798 +
799 +.globl lowlevel_init
800 +lowlevel_init:
801 +       /* Platform CHIP level init*/
802 +       ldr r0, =GPIO1_BASE_ADDR
803 +    ldr r1, [r0, #0x0]
804 +    orr r1, r1, #(1 << 23)
805 +    str r1, [r0, #0x0]
806 +    ldr r1, [r0, #0x4]
807 +    orr r1, r1, #(1 << 23)
808 +    str r1, [r0, #0x4]
809 +
810 +#ifdef TURN_OFF_IMPRECISE_ABORT
811 +       mrs r0, cpsr
812 +       bic r0, r0, #0x100
813 +       msr cpsr, r0
814 +#endif
815 +
816 +       mrc 15, 0, r1, c1, c0, 0
817 +
818 +#ifndef BRANCH_PREDICTION_ENABLE
819 +       mrc 15, 0, r0, c1, c0, 1
820 +       bic r0, r0, #7
821 +       mcr 15, 0, r0, c1, c0, 1
822 +#else
823 +       mrc 15, 0, r0, c1, c0, 1
824 +       orr r0, r0, #7
825 +       mcr 15, 0, r0, c1, c0, 1
826 +       orr r1, r1, #(1<<11)
827 +#endif
828 +
829 +#ifdef UNALIGNED_ACCESS_ENABLE
830 +       orr r1, r1, #(1<<22)
831 +#endif
832 +
833 +#ifdef LOW_INT_LATENCY_ENABLE
834 +       orr r1, r1, #(1<<21)
835 +#endif
836 +       mcr 15, 0, r1, c1, c0, 0
837 +
838 +       mov r0, #0
839 +#ifdef BRANCH_PREDICTION_ENABLE
840 +       mcr 15, 0, r0, c15, c2, 4
841 +#endif
842 +       mcr 15, 0, r0, c7, c10, 4       /* Drain the write buffer */
843 +
844 +       init_l2cc
845 +
846 +       init_aips
847 +
848 +       setup_wdog
849 +
850 +       init_max
851 +
852 +       init_m4if
853 +
854 +       init_drive_strength
855 +
856 +       cmp pc, #PHYS_SDRAM_1
857 +       blo init_clock_start
858 +       cmp pc, #(PHYS_SDRAM_1 + PHYS_SDRAM_1_SIZE)
859 +       blo init_clock_start
860 +
861 +init_clock_start:
862 +       init_clock
863 +       init_debug_board
864 +       /*init_sdram*/
865 +
866 +       /* return from mxc_nand_load */
867 +       /* r12 saved upper lr*/
868 +       b mxc_nand_load
869 +
870 +/* Board level setting value */
871 +DDR_PERCHARGE_CMD:     .word 0x04008008
872 +DDR_REFRESH_CMD:       .word 0x00008010
873 +DDR_LMR1_W:            .word 0x00338018
874 +DDR_LMR_CMD:           .word 0xB2220000
875 +DDR_TIMING_W:          .word 0xB02567A9
876 +DDR_MISC_W:            .word 0x000A0104
877 diff --git a/board/freescale/imx51/u-boot.lds b/board/freescale/imx51/u-boot.lds
878 new file mode 100644
879 index 0000000..15d50ab
880 --- /dev/null
881 +++ b/board/freescale/imx51/u-boot.lds
882 @@ -0,0 +1,73 @@
883 +/*
884 + * January 2004 - Changed to support H4 device
885 + * Copyright (c) 2004 Texas Instruments
886 + *
887 + * (C) Copyright 2002
888 + * Gary Jennejohn, DENX Software Engineering, <gj@denx.de>
889 + *
890 + * (C) Copyright 2009 Freescale Semiconductor, Inc.
891 + *
892 + * See file CREDITS for list of people who contributed to this
893 + * project.
894 + *
895 + * This program is free software; you can redistribute it and/or
896 + * modify it under the terms of the GNU General Public License as
897 + * published by the Free Software Foundation; either version 2 of
898 + * the License, or (at your option) any later version.
899 + *
900 + * This program is distributed in the hope that it will be useful,
901 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
902 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the
903 + * GNU General Public License for more details.
904 + *
905 + * You should have received a copy of the GNU General Public License
906 + * along with this program; if not, write to the Free Software
907 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
908 + * MA 02111-1307 USA
909 + */
910 +
911 +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
912 +OUTPUT_ARCH(arm)
913 +ENTRY(_start)
914 +SECTIONS
915 +{
916 +       . = 0x00000000;
917 +
918 +       . = ALIGN(4);
919 +       .text      :
920 +       {
921 +         /* WARNING - the following is hand-optimized to fit within    */
922 +         /* the sector layout of our flash chips!      XXX FIXME XXX   */
923 +         board/freescale/imx51/flash_header.o  (.text.flasheader)
924 +         cpu/arm_cortexa8/start.o
925 +         board/freescale/imx51/libimx51.a      (.text)
926 +         lib_arm/libarm.a              (.text)
927 +         net/libnet.a                  (.text)
928 +         drivers/mtd/libmtd.a          (.text)
929 +         drivers/mmc/libmmc.a          (.text)
930 +
931 +         . = DEFINED(env_offset) ? env_offset : .;
932 +         common/env_embedded.o(.text)
933 +
934 +         *(.text)
935 +       }
936 +
937 +       . = ALIGN(4);
938 +       .rodata : { *(.rodata) }
939 +
940 +       . = ALIGN(4);
941 +       .data : { *(.data) }
942 +
943 +       . = ALIGN(4);
944 +       .got : { *(.got) }
945 +
946 +       . = .;
947 +       __u_boot_cmd_start = .;
948 +       .u_boot_cmd : { *(.u_boot_cmd) }
949 +       __u_boot_cmd_end = .;
950 +
951 +       . = ALIGN(4);
952 +       __bss_start = .;
953 +       .bss : { *(.bss) }
954 +       _end = .;
955 +}
956 diff --git a/include/configs/imx51.h b/include/configs/imx51.h
957 new file mode 100644
958 index 0000000..4ab1acb
959 --- /dev/null
960 +++ b/include/configs/imx51.h
961 @@ -0,0 +1,221 @@
962 +/*
963 + * Copyright (C) 2007, Guennadi Liakhovetski <lg@denx.de>
964 + *
965 + * (C) Copyright 2009 Freescale Semiconductor, Inc.
966 + *
967 + * Configuration settings for the MX51-3Stack Freescale board.
968 + *
969 + * This program is free software; you can redistribute it and/or
970 + * modify it under the terms of the GNU General Public License as
971 + * published by the Free Software Foundation; either version 2 of
972 + * the License, or (at your option) any later version.
973 + *
974 + * This program is distributed in the hope that it will be useful,
975 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
976 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the
977 + * GNU General Public License for more details.
978 + *
979 + * You should have received a copy of the GNU General Public License
980 + * along with this program; if not, write to the Free Software
981 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
982 + * MA 02111-1307 USA
983 + */
984 +
985 +#ifndef __CONFIG_H
986 +#define __CONFIG_H
987 +
988 +#include <asm/arch/mx51.h>
989 +
990 + /* High Level Configuration Options */
991 +#define CONFIG_ARMV7           1       /* This is armv7 Cortex-A8 CPU core */
992 +#define CONFIG_SYS_APCS_GNU
993 +#define CONFIG_L2_OFF
994 +
995 +#define CONFIG_MXC             1
996 +#define CONFIG_MX51            1       /* in a mx51 */
997 +#define CONFIG_FLASH_HEADER    1
998 +#define CONFIG_FLASH_HEADER_OFFSET 0x400
999 +#define CONFIG_FLASH_HEADER_BARKER 0xB1
1000 +
1001 +#define CONFIG_SKIP_RELOCATE_UBOOT
1002 +
1003 +#define CONFIG_MX51_HCLK_FREQ  24000000        /* RedBoot says 26MHz */
1004 +#define CONFIG_MX51_CLK32      32768
1005 +#define CONFIG_DISPLAY_CPUINFO
1006 +#define CONFIG_DISPLAY_BOARDINFO
1007 +
1008 +#define BOARD_LATE_INIT
1009 +/*
1010 + * Disabled for now due to build problems under Debian and a significant
1011 + * increase in the final file size: 144260 vs. 109536 Bytes.
1012 + */
1013 +
1014 +#define CONFIG_CMDLINE_TAG             1       /* enable passing of ATAGs */
1015 +#define CONFIG_REVISION_TAG            1
1016 +#define CONFIG_SETUP_MEMORY_TAGS       1
1017 +#define CONFIG_INITRD_TAG              1
1018 +
1019 +/*
1020 + * Size of malloc() pool
1021 + */
1022 +#define CONFIG_SYS_MALLOC_LEN          (CONFIG_ENV_SIZE + 2 * 1024 * 1024)
1023 +/* size in bytes reserved for initial data */
1024 +#define CONFIG_SYS_GBL_DATA_SIZE       128
1025 +
1026 +/*
1027 + * Hardware drivers
1028 + */
1029 +#define CONFIG_MX51_UART       1
1030 +#define CONFIG_MX51_UART1      1
1031 +
1032 +
1033 +/* #define CONFIG_CMD_SPI */
1034 +
1035 +/*
1036 +#define CONFIG_FSL_MMC         1
1037 +#define CONFIG_DOS_PARTITION   1
1038 +#define CONFIG_CMD_FAT         1
1039 +*/
1040 +
1041 +/* allow to overwrite serial and ethaddr */
1042 +#define CONFIG_ENV_OVERWRITE
1043 +#define CONFIG_CONS_INDEX      1
1044 +#define CONFIG_BAUDRATE                115200
1045 +#define CONFIG_SYS_BAUDRATE_TABLE      {9600, 19200, 38400, 57600, 115200}
1046 +
1047 +#define CONFIG_MMC_BASE                0x0
1048 +
1049 +/***********************************************************
1050 + * Command definition
1051 + ***********************************************************/
1052 +
1053 +#include <config_cmd_default.h>
1054 +
1055 +#define CONFIG_CMD_PING
1056 +#define CONFIG_CMD_DHCP
1057 +/* Enable below configure when supporting nand */
1058 +/* #define CONFIG_CMD_NAND */
1059 +/* #define CONFIG_CMD_ENV */
1060 +
1061 +#undef CONFIG_CMD_IMLS
1062 +
1063 +#define CONFIG_BOOTDELAY       3
1064 +
1065 +#define CONFIG_LOADADDR                0x90800000      /* loadaddr env var */
1066 +
1067 +#define        CONFIG_EXTRA_ENV_SETTINGS                                       \
1068 +               "netdev=eth0\0"                                         \
1069 +               "ethprime=smc911x\0"                                    \
1070 +               "uboot_addr=0xa0000000\0"                               \
1071 +               "uboot=u-boot.bin\0"                    \
1072 +               "kernel=uImage\0"                               \
1073 +               "nfsroot=/opt/eldk/arm\0"                               \
1074 +               "bootargs_base=setenv bootargs console=ttymxc0,115200\0"\
1075 +               "bootargs_nfs=setenv bootargs ${bootargs} root=/dev/nfs "\
1076 +                       "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0"\
1077 +               "bootcmd=run bootcmd_net\0"                             \
1078 +               "bootcmd_net=run bootargs_base bootargs_nfs; "          \
1079 +                       "tftpboot ${loadaddr} ${kernel}; bootm\0"       \
1080 +               "prg_uboot=tftpboot ${loadaddr} ${uboot}; "             \
1081 +                       "protect off ${uboot_addr} 0xa003ffff; "        \
1082 +                       "erase ${uboot_addr} 0xa003ffff; "              \
1083 +                       "cp.b ${loadaddr} ${uboot_addr} ${filesize}; "  \
1084 +                       "setenv filesize; saveenv\0"
1085 +
1086 +/*Support LAN9217*/
1087 +#define CONFIG_DRIVER_SMC911X  1
1088 +#define CONFIG_DRIVER_SMC911X_16_BIT 1
1089 +#define CONFIG_DRIVER_SMC911X_BASE_VARIABLE mx51_io_base_addr
1090 +
1091 +/*
1092 + * The MX51 3stack board seems to have a hardware "peculiarity" confirmed under
1093 + * U-Boot, RedBoot and Linux: the ethernet Rx signal is reaching the CS8900A
1094 + * controller inverted. The controller is capable of detecting and correcting
1095 + * this, but it needs 4 network packets for that. Which means, at startup, you
1096 + * will not receive answers to the first 4 packest, unless there have been some
1097 + * broadcasts on the network, or your board is on a hub. Reducing the ARP
1098 + * timeout from default 5 seconds to 200ms we speed up the initial TFTP
1099 + * transfer, should the user wish one, significantly.
1100 + */
1101 +#define CONFIG_ARP_TIMEOUT     200UL
1102 +
1103 +/*
1104 + * Miscellaneous configurable options
1105 + */
1106 +#define CONFIG_SYS_LONGHELP            /* undef to save memory */
1107 +#define CONFIG_SYS_PROMPT              "=> "
1108 +#define CONFIG_SYS_CBSIZE              256     /* Console I/O Buffer Size */
1109 +/* Print Buffer Size */
1110 +#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
1111 +#define CONFIG_SYS_MAXARGS     16      /* max number of command args */
1112 +#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE /* Boot Argument Buffer Size */
1113 +
1114 +#define CONFIG_SYS_MEMTEST_START       0       /* memtest works on */
1115 +#define CONFIG_SYS_MEMTEST_END         0x10000
1116 +
1117 +#undef CONFIG_SYS_CLKS_IN_HZ           /* everything, incl board info, in Hz */
1118 +
1119 +#define CONFIG_SYS_LOAD_ADDR           CONFIG_LOADADDR
1120 +
1121 +#define CONFIG_SYS_HZ  CONFIG_MX51_CLK32/* use 32kHz clock as source */
1122 +
1123 +#define CONFIG_CMDLINE_EDITING 1
1124 +
1125 +/*-----------------------------------------------------------------------
1126 + * Stack sizes
1127 + *
1128 + * The stack sizes are set up in start.S using the settings below
1129 + */
1130 +#define CONFIG_STACKSIZE       (128 * 1024)    /* regular stack */
1131 +
1132 +/*-----------------------------------------------------------------------
1133 + * Physical Memory Map
1134 + */
1135 +#define CONFIG_NR_DRAM_BANKS   1
1136 +#define PHYS_SDRAM_1           CSD0_BASE_ADDR
1137 +/* TO1 boards */
1138 +/* #define PHYS_SDRAM_1_SIZE   (128 * 1024 * 1024) */
1139 +#define PHYS_SDRAM_1_SIZE      (512 * 1024 * 1024)
1140 +
1141 +/*-----------------------------------------------------------------------
1142 + * FLASH and environment organization
1143 + */
1144 +#define CONFIG_SYS_NO_FLASH
1145 +
1146 +/*-----------------------------------------------------------------------
1147 + * NAND FLASH driver setup
1148 + */
1149 +#define NAND_MAX_CHIPS         8
1150 +#define CONFIG_SYS_MAX_NAND_DEVICE    1
1151 +#define CONFIG_SYS_NAND_BASE          0x40000000
1152 +
1153 +/* Monitor at beginning of flash */
1154 +#if defined(CONFIG_FSL_MMC)
1155 +       #define CONFIG_MMC              1
1156 +       #define CONFIG_CMD_MMC
1157 +/*
1158 +       #define CONFIG_FSL_ENV_IN_MMC
1159 +*/
1160 +#elif defined(CONFIG_CMD_NAND)
1161 +       #define CONFIG_FSL_ENV_IN_NAND
1162 +#endif
1163 +
1164 +#define CONFIG_ENV_SECT_SIZE    (128 * 1024)
1165 +#define CONFIG_ENV_SIZE         CONFIG_ENV_SECT_SIZE
1166 +
1167 +#if defined(CONFIG_FSL_ENV_IN_NAND)
1168 +       #define CONFIG_ENV_IS_IN_NAND 1
1169 +       #define CONFIG_ENV_OFFSET       0x100000
1170 +#elif defined(CONFIG_FSL_ENV_IN_MMC)
1171 +       #define CONFIG_ENV_IS_IN_MMC    1
1172 +       #define CONFIG_ENV_OFFSET       (1024 * 1024)
1173 +#else
1174 +       #define CONFIG_ENV_IS_NOWHERE   1
1175 +#endif
1176 +/*
1177 + * JFFS2 partitions
1178 + */
1179 +#undef CONFIG_JFFS2_CMDLINE
1180 +#define CONFIG_JFFS2_DEV       "nand0"
1181 +
1182 +#endif                         /* __CONFIG_H */
1183 -- 
1184 1.5.4.4
1185