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.
6 Basic boot on BBG2 board.
8 Signed-off-by: r65388 <r65388@freescale.com>
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(-)
21 diff --git a/Makefile b/Makefile
22 index a445f14..5eac5fb 100644
25 @@ -3238,6 +3238,9 @@ Mx31_3stack_config : unconfig
26 mx35_3stack_config : unconfig
27 @$(MKCONFIG) $(@:_config=) arm arm1136 mx35_3stack freescale mx35
29 +imx51_config : unconfig
30 + @$(MKCONFIG) $(@:_config=) arm arm_cortexa8 imx51 freescale mx51
32 mx51_3stack_config : unconfig
33 @$(MKCONFIG) $(@:_config=) arm arm_cortexa8 mx51_3stack freescale mx51
35 diff --git a/board/freescale/imx51/Makefile b/board/freescale/imx51/Makefile
37 index 0000000..fbd40f2
39 +++ b/board/freescale/imx51/Makefile
42 +# Copyright (C) 2007, Guennadi Liakhovetski <lg@denx.de>
44 +# (C) Copyright 2009 Freescale Semiconductor, Inc.
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.
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.
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,
62 +include $(TOPDIR)/config.mk
64 +LIB = $(obj)lib$(BOARD).a
67 +SOBJS := lowlevel_init.o flash_header.o
69 +SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
70 +OBJS := $(addprefix $(obj),$(COBJS))
71 +SOBJS := $(addprefix $(obj),$(SOBJS))
73 +$(LIB): $(obj).depend $(OBJS) $(SOBJS)
74 + $(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS)
77 + rm -f $(SOBJS) $(OBJS)
80 + rm -f $(LIB) core *.bak .depend
82 +#########################################################################
84 +# defines $(obj).depend target
85 +include $(SRCTREE)/rules.mk
87 +sinclude $(obj).depend
89 +#########################################################################
90 diff --git a/board/freescale/imx51/board-imx51.h b/board/freescale/imx51/board-imx51.h
92 index 0000000..7a2cae0
94 +++ b/board/freescale/imx51/board-imx51.h
97 + * Copyright 2009 Freescale Semiconductor, Inc. All Rights Reserved.
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:
105 + * http://www.opensource.org/licenses/gpl-license.html
106 + * http://www.gnu.org/copyleft/gpl.html
109 +#ifndef __BOARD_FREESCALE_BOARD_IMX51_H__
110 +#define __BOARD_FREESCALE_BOARD_IMX51_H__
113 + * @defgroup BRDCFG_MX51 Board Configuration Options
114 + * @ingroup MSL_MX51
118 + * @file mx51_3stack/board-imx51.h
120 + * @brief This file contains all the board level configuration options.
122 + * It currently hold the options defined for MX51 3Stack Platform.
124 + * @ingroup BRDCFG_IMX51
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)
140 +#define LED_SWITCH_REG 0x00
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
159 +#endif /* __BOARD_FREESCALE_BOARD_IMX51_H__ */
160 diff --git a/board/freescale/imx51/config.mk b/board/freescale/imx51/config.mk
162 index 0000000..ce7369d
164 +++ b/board/freescale/imx51/config.mk
166 +TEXT_BASE = 0x97800000
167 diff --git a/board/freescale/imx51/flash_header.S b/board/freescale/imx51/flash_header.S
169 index 0000000..6790679
171 +++ b/board/freescale/imx51/flash_header.S
174 + * Copyright 2009 Freescale Semiconductor, Inc.
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.
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.
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
193 +#include <asm/arch/mx51.h>
194 +#include "board-imx51.h"
196 +#ifdef CONFIG_FLASH_HEADER
197 +#ifndef CONFIG_FLASH_HEADER_OFFSET
198 +# error "Must define the offset of flash header"
200 +#define MXC_DCD_ITEM(i, type, addr, val) \
206 +.section ".text.flasheader", "x"
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
217 +magic: .word 0xB17219E9
218 +dcd_array_size: .word dcd_data_end - dcd_array_start - 8
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 */
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)
283 +image_len: .word 0x100000
284 +//image_len: .word _end - _start
286 diff --git a/board/freescale/imx51/imx51.c b/board/freescale/imx51/imx51.c
288 index 0000000..c8fe23b
290 +++ b/board/freescale/imx51/imx51.c
293 + * Copyright (C) 2007, Guennadi Liakhovetski <lg@denx.de>
295 + * (C) Copyright 2009 Freescale Semiconductor, Inc.
297 + * See file CREDITS for list of people who contributed to this
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.
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.
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
318 +#include <asm/errno.h>
319 +#include <asm/arch/mx51.h>
320 +#include <asm/arch/mx51_pins.h>
321 +#include <asm/arch/iomux.h>
323 +#include "board-imx51.h"
325 +DECLARE_GLOBAL_DATA_PTR;
327 +static u32 system_rev;
328 +u32 mx51_io_base_addr;
329 +volatile u32 *esdhc_base_pointer;
331 +u32 get_board_rev(void)
336 +static inline void setup_soc_rev(void)
339 + reg = __REG(ROM_SI_REV);
342 + system_rev = 0x51000 | CHIP_REV_1_1;
345 + system_rev = 0x51000 | CHIP_REV_2_0;
348 + system_rev = 0x51000 | CHIP_REV_1_0;
352 +static inline void set_board_rev(int rev)
354 + system_rev |= (rev & 0xF) << 8;
357 +inline int is_soc_rev(int rev)
359 + return (system_rev & 0xFF) - rev;
364 + gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
365 + gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
369 +static void setup_uart(void)
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);
383 +void setup_nfc(void)
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);
396 +static void setup_expio(void)
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);
406 + writel(0x00000000, WEIM_BASE_ADDR + 0x78 + CSRCR2);
407 + /* WAL=0, WBED=1, WWSC=50, WADVA=2, WADVN=6, WEA=0, WEN=0,
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)
420 + writel(0x0, CCM_BASE_ADDR + CLKCTL_CCDR);
422 + mx51_io_base_addr = CS5_BASE_ADDR;
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);
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
434 + writel(0x72080F00, WEIM_BASE_ADDR + 0x18 + CSWCR1);
435 + mx51_io_base_addr = CS1_BASE_ADDR;
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);
443 + /* Reset the XUART and Ethernet controllers */
444 + reg = readw(mx51_io_base_addr + PBC_SW_RESET);
446 + writew(reg, mx51_io_base_addr + PBC_SW_RESET);
448 + writew(reg, mx51_io_base_addr + PBC_SW_RESET);
451 +int board_init(void)
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;
466 +#ifdef BOARD_LATE_INIT
467 +int board_late_init(void)
473 +int checkboard(void)
475 + printf("Board: MX51 3STACK [");
476 + switch (__REG(SRC_BASE_ADDR + 0x8)) {
494 +#ifdef CONFIG_NET_MULTI
495 +int board_eth_init(bd_t *bis)
498 +#if defined(CONFIG_DRIVER_SMC911X)
499 + rc = smc911x_initialize(bis);
505 +#ifdef CONFIG_FSL_MMC
509 + u32 interface_esdhc = 0;
513 + interface_esdhc = (readl(SRC_BASE_ADDR + 0x4) & (0x00180000)) >> 19;
515 + switch (interface_esdhc) {
518 + esdhc_base_pointer = (volatile u32 *)MMC_SDHC1_BASE_ADDR;
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);
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 |
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 |
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 |
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 |
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 |
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 |
562 + PAD_CTL_PKE_ENABLE | PAD_CTL_SRE_FAST);
582 diff --git a/board/freescale/imx51/lowlevel_init.S b/board/freescale/imx51/lowlevel_init.S
584 index 0000000..4fff3e5
586 +++ b/board/freescale/imx51/lowlevel_init.S
589 + * Copyright (C) 2007, Guennadi Liakhovetski <lg@denx.de>
591 + * (C) Copyright 2009 Freescale Semiconductor, Inc.
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.
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.
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
610 +#include <asm/arch/mx51.h>
611 +#include "board-imx51.h"
614 + * return soc version
619 +.macro check_soc_version ret, tmp
623 + * L2CC Cache setup/invalidation/disable
626 + /* reconfigure L2 cache aux control reg */
627 + ldr r0, =0x03C000C4
628 + mcr p15, 1, r0, c9, c0, 2
629 +.endm /* init_l2cc */
631 +/* AIPS setup - Only setup MPROTx registers.
632 + * The PACR default values are good.*/
635 + * Set all MPROTx to be non-bufferable, trusted for R/W,
636 + * not forced to user-mode.
638 + ldr r0, =AIPS1_BASE_ADDR
639 + ldr r1, =0x77777777
642 + ldr r0, =AIPS2_BASE_ADDR
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
650 +.endm /* init_aips */
652 +/* MAX (Multi-Layer AHB Crossbar Switch) setup */
654 +.endm /* init_max */
658 + /* VPU and IPU given higher priority (0x4)
659 + * IPU accesses with ID=0x1 given highest priority (=0xA)
661 + ldr r0, =M4IF_BASE_ADDR
663 + ldr r1, =0x00000203
664 + str r1, [r0, #0x40]
667 + str r1, [r0, #0x44]
669 + ldr r1, =0x00120125
670 + str r1, [r0, #0x9C]
672 + ldr r1, =0x001901A3
673 + str r1, [r0, #0x48]
676 + ldr r1, =0x00000a01
677 + str r1, [r0, #0x48]
678 + ldr r1, =0x00000404
679 + str r1, [r0, #0x40]
681 +.endm /* init_m4if */
683 +/* To support 133MHz DDR */
684 +.macro init_drive_strength
685 +.endm /* init_drive_strength */
687 +/* CPLD on CS5 setup */
688 +.macro init_debug_board
689 +.endm /* init_debug_board */
691 +.macro setup_pll pll, freq
693 + ldr r1, =0x00001232
694 + str r1, [r2, #PLL_DP_CTL] /* Set DPLL ON (set UPEN bit): BRMO=1 */
696 + str r1, [r2, #PLL_DP_CONFIG] /* Enable auto-restart AREN bit */
698 + str r3, [r2, #PLL_DP_OP]
699 + str r3, [r2, #PLL_DP_HFS_OP]
701 + str r4, [r2, #PLL_DP_MFD]
702 + str r4, [r2, #PLL_DP_HFS_MFD]
704 + str r5, [r2, #PLL_DP_MFN]
705 + str r5, [r2, #PLL_DP_HFS_MFN]
707 + ldr r1, =0x00001232
708 + str r1, [r2, #PLL_DP_CTL]
709 +1: ldr r1, [r2, #PLL_DP_CTL]
715 + ldr r0, =CCM_BASE_ADDR
716 + mov r1, #0x00060000
717 + str r1, [r0, #CLKCTL_CCDR]
719 + /* Switch ARM to step clock */
721 + str r1, [r0, #CLKCTL_CCSR]
724 + mov r4, #DP_MFD_800
725 + mov r5, #DP_MFN_800
726 + setup_pll PLL1_BASE_ADDR
728 + mov r4, #DP_MFD_665
729 + mov r5, #DP_MFN_665
730 + setup_pll PLL3_BASE_ADDR
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]
738 + mov r4, #DP_MFD_665
739 + mov r5, #DP_MFN_665
740 + setup_pll PLL2_BASE_ADDR
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]
749 + mov r4, #DP_MFD_216
750 + mov r5, #DP_MFN_216
751 + setup_pll PLL3_BASE_ADDR
753 + /* Set the platform clock dividers */
754 + ldr r2, =ARM_BASE_ADDR
755 + ldr r1, =0x00000725
756 + str r1, [r2, #0x14]
758 + /* Switch ARM back to PLL 1 */
760 + str r1, [r0, #CLKCTL_CCSR]
761 + str r1, [r0, #CLKCTL_CACRR]
763 + /* Use lp_apm (24MHz) source for perclk */
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]
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]
782 + /* make sure divider effective */
783 +1: ldr r1, [r0, #CLKCTL_CDHIPR]
788 + str r1, [r0, #CLKCTL_CCDR]
792 + ldr r0, =WDOG1_BASE_ADDR
797 +.section ".text.init", "x"
799 +.globl lowlevel_init
801 + /* Platform CHIP level init*/
802 + ldr r0, =GPIO1_BASE_ADDR
804 + orr r1, r1, #(1 << 23)
807 + orr r1, r1, #(1 << 23)
810 +#ifdef TURN_OFF_IMPRECISE_ABORT
816 + mrc 15, 0, r1, c1, c0, 0
818 +#ifndef BRANCH_PREDICTION_ENABLE
819 + mrc 15, 0, r0, c1, c0, 1
821 + mcr 15, 0, r0, c1, c0, 1
823 + mrc 15, 0, r0, c1, c0, 1
825 + mcr 15, 0, r0, c1, c0, 1
826 + orr r1, r1, #(1<<11)
829 +#ifdef UNALIGNED_ACCESS_ENABLE
830 + orr r1, r1, #(1<<22)
833 +#ifdef LOW_INT_LATENCY_ENABLE
834 + orr r1, r1, #(1<<21)
836 + mcr 15, 0, r1, c1, c0, 0
839 +#ifdef BRANCH_PREDICTION_ENABLE
840 + mcr 15, 0, r0, c15, c2, 4
842 + mcr 15, 0, r0, c7, c10, 4 /* Drain the write buffer */
854 + init_drive_strength
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
866 + /* return from mxc_nand_load */
867 + /* r12 saved upper lr*/
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
879 index 0000000..15d50ab
881 +++ b/board/freescale/imx51/u-boot.lds
884 + * January 2004 - Changed to support H4 device
885 + * Copyright (c) 2004 Texas Instruments
887 + * (C) Copyright 2002
888 + * Gary Jennejohn, DENX Software Engineering, <gj@denx.de>
890 + * (C) Copyright 2009 Freescale Semiconductor, Inc.
892 + * See file CREDITS for list of people who contributed to this
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.
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.
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
911 +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
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)
931 + . = DEFINED(env_offset) ? env_offset : .;
932 + common/env_embedded.o(.text)
938 + .rodata : { *(.rodata) }
941 + .data : { *(.data) }
947 + __u_boot_cmd_start = .;
948 + .u_boot_cmd : { *(.u_boot_cmd) }
949 + __u_boot_cmd_end = .;
956 diff --git a/include/configs/imx51.h b/include/configs/imx51.h
958 index 0000000..4ab1acb
960 +++ b/include/configs/imx51.h
963 + * Copyright (C) 2007, Guennadi Liakhovetski <lg@denx.de>
965 + * (C) Copyright 2009 Freescale Semiconductor, Inc.
967 + * Configuration settings for the MX51-3Stack Freescale board.
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.
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.
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
988 +#include <asm/arch/mx51.h>
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
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
1001 +#define CONFIG_SKIP_RELOCATE_UBOOT
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
1008 +#define BOARD_LATE_INIT
1010 + * Disabled for now due to build problems under Debian and a significant
1011 + * increase in the final file size: 144260 vs. 109536 Bytes.
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
1020 + * Size of malloc() pool
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
1027 + * Hardware drivers
1029 +#define CONFIG_MX51_UART 1
1030 +#define CONFIG_MX51_UART1 1
1033 +/* #define CONFIG_CMD_SPI */
1036 +#define CONFIG_FSL_MMC 1
1037 +#define CONFIG_DOS_PARTITION 1
1038 +#define CONFIG_CMD_FAT 1
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}
1047 +#define CONFIG_MMC_BASE 0x0
1049 +/***********************************************************
1050 + * Command definition
1051 + ***********************************************************/
1053 +#include <config_cmd_default.h>
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 */
1061 +#undef CONFIG_CMD_IMLS
1063 +#define CONFIG_BOOTDELAY 3
1065 +#define CONFIG_LOADADDR 0x90800000 /* loadaddr env var */
1067 +#define CONFIG_EXTRA_ENV_SETTINGS \
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"
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
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.
1101 +#define CONFIG_ARP_TIMEOUT 200UL
1104 + * Miscellaneous configurable options
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 */
1114 +#define CONFIG_SYS_MEMTEST_START 0 /* memtest works on */
1115 +#define CONFIG_SYS_MEMTEST_END 0x10000
1117 +#undef CONFIG_SYS_CLKS_IN_HZ /* everything, incl board info, in Hz */
1119 +#define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR
1121 +#define CONFIG_SYS_HZ CONFIG_MX51_CLK32/* use 32kHz clock as source */
1123 +#define CONFIG_CMDLINE_EDITING 1
1125 +/*-----------------------------------------------------------------------
1128 + * The stack sizes are set up in start.S using the settings below
1130 +#define CONFIG_STACKSIZE (128 * 1024) /* regular stack */
1132 +/*-----------------------------------------------------------------------
1133 + * Physical Memory Map
1135 +#define CONFIG_NR_DRAM_BANKS 1
1136 +#define PHYS_SDRAM_1 CSD0_BASE_ADDR
1138 +/* #define PHYS_SDRAM_1_SIZE (128 * 1024 * 1024) */
1139 +#define PHYS_SDRAM_1_SIZE (512 * 1024 * 1024)
1141 +/*-----------------------------------------------------------------------
1142 + * FLASH and environment organization
1144 +#define CONFIG_SYS_NO_FLASH
1146 +/*-----------------------------------------------------------------------
1147 + * NAND FLASH driver setup
1149 +#define NAND_MAX_CHIPS 8
1150 +#define CONFIG_SYS_MAX_NAND_DEVICE 1
1151 +#define CONFIG_SYS_NAND_BASE 0x40000000
1153 +/* Monitor at beginning of flash */
1154 +#if defined(CONFIG_FSL_MMC)
1155 + #define CONFIG_MMC 1
1156 + #define CONFIG_CMD_MMC
1158 + #define CONFIG_FSL_ENV_IN_MMC
1160 +#elif defined(CONFIG_CMD_NAND)
1161 + #define CONFIG_FSL_ENV_IN_NAND
1164 +#define CONFIG_ENV_SECT_SIZE (128 * 1024)
1165 +#define CONFIG_ENV_SIZE CONFIG_ENV_SECT_SIZE
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)
1174 + #define CONFIG_ENV_IS_NOWHERE 1
1177 + * JFFS2 partitions
1179 +#undef CONFIG_JFFS2_CMDLINE
1180 +#define CONFIG_JFFS2_DEV "nand0"
1182 +#endif /* __CONFIG_H */