Skip to content

Commit 8415bb6

Browse files
Alison WangYork Sun
Alison Wang
authored and
York Sun
committed
arm: ls102xa: Add SD boot support for LS1021ATWR board
This patch adds SD boot support for LS1021ATWR board. SPL framework is used. PBL initialize the internal RAM and copy SPL to it, then SPL initialize DDR using SPD and copy u-boot from SD card to DDR, finally SPL transfer control to u-boot. Signed-off-by: Chen Lu <[email protected]> Signed-off-by: Alison Wang <[email protected]> Signed-off-by: Jason Jin <[email protected]> Reviewed-by: York Sun <[email protected]>
1 parent 86949c2 commit 8415bb6

File tree

6 files changed

+95
-0
lines changed

6 files changed

+95
-0
lines changed

board/freescale/ls1021atwr/MAINTAINERS

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ F: board/freescale/ls1021atwr/
55
F: include/configs/ls1021atwr.h
66
F: configs/ls1021atwr_nor_defconfig
77
F: configs/ls1021atwr_nor_SECURE_BOOT_defconfig
8+
F: configs/ls1021atwr_sdcard_defconfig

board/freescale/ls1021atwr/ls1021atwr.c

+20
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <fsl_mdio.h>
1919
#include <tsec.h>
2020
#include <fsl_sec.h>
21+
#include <spl.h>
2122
#ifdef CONFIG_U_QE
2223
#include "../../../drivers/qe/qe.h"
2324
#endif
@@ -271,6 +272,25 @@ int board_early_init_f(void)
271272
return 0;
272273
}
273274

275+
#ifdef CONFIG_SPL_BUILD
276+
void board_init_f(ulong dummy)
277+
{
278+
/* Set global data pointer */
279+
gd = &gdata;
280+
281+
/* Clear the BSS */
282+
memset(__bss_start, 0, __bss_end - __bss_start);
283+
284+
get_clocks();
285+
286+
preloader_console_init();
287+
288+
dram_init();
289+
290+
board_init_r(NULL, 0);
291+
}
292+
#endif
293+
274294
int board_init(void)
275295
{
276296
struct ccsr_cci400 *cci = (struct ccsr_cci400 *)CONFIG_SYS_CCI400_ADDR;
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#PBI commands
2+
3+
09570200 ffffffff
4+
09570158 00000300
5+
8940007c 21f47300
6+
7+
#Configure Scratch register
8+
09ee0200 10000000
9+
#Configure alternate space
10+
09570158 00001000
11+
#Flush PBL data
12+
096100c0 000FFFFF
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#PBL preamble and RCW header
2+
aa55aa55 01ee0100
3+
4+
#enable IFC, disable QSPI and DSPI
5+
0608000a 00000000 00000000 00000000
6+
20000000 00407900 60040a00 21046000
7+
00000000 00000000 00000000 00038000
8+
00080000 881b7340 00000000 00000000
9+
10+
#disable IFC, enable QSPI and DSPI
11+
#0608000a 00000000 00000000 00000000
12+
#20000000 00407900 60040a00 21046000
13+
#00000000 00000000 00000000 00038000
14+
#20084800 881b7340 00000000 00000000

configs/ls1021atwr_sdcard_defconfig

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
CONFIG_SPL=y
2+
CONFIG_SYS_EXTRA_OPTIONS="RAMBOOT_PBL,SPL_FSL_PBL,SD_BOOT"
3+
+S:CONFIG_ARM=y
4+
+S:CONFIG_TARGET_LS1021ATWR=y

include/configs/ls1021atwr.h

+44
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,38 @@
3535
#define CONFIG_SYS_CLK_FREQ 100000000
3636
#define CONFIG_DDR_CLK_FREQ 100000000
3737

38+
#ifdef CONFIG_RAMBOOT_PBL
39+
#define CONFIG_SYS_FSL_PBL_PBI board/freescale/ls1021atwr/ls102xa_pbi.cfg
40+
#endif
41+
42+
#ifdef CONFIG_SD_BOOT
43+
#define CONFIG_SYS_FSL_PBL_RCW board/freescale/ls1021atwr/ls102xa_rcw_sd.cfg
44+
#define CONFIG_SPL_FRAMEWORK
45+
#define CONFIG_SPL_LDSCRIPT "arch/$(ARCH)/cpu/u-boot-spl.lds"
46+
#define CONFIG_SPL_LIBCOMMON_SUPPORT
47+
#define CONFIG_SPL_LIBGENERIC_SUPPORT
48+
#define CONFIG_SPL_ENV_SUPPORT
49+
#define CONFIG_SPL_MPC8XXX_INIT_DDR_SUPPORT
50+
#define CONFIG_SPL_I2C_SUPPORT
51+
#define CONFIG_SPL_WATCHDOG_SUPPORT
52+
#define CONFIG_SPL_SERIAL_SUPPORT
53+
#define CONFIG_SPL_MMC_SUPPORT
54+
#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR 0xe8
55+
#define CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS 0x400
56+
57+
#define CONFIG_SPL_TEXT_BASE 0x10000000
58+
#define CONFIG_SPL_MAX_SIZE 0x1a000
59+
#define CONFIG_SPL_STACK 0x1001d000
60+
#define CONFIG_SPL_PAD_TO 0x1c000
61+
#define CONFIG_SYS_TEXT_BASE 0x82000000
62+
63+
#define CONFIG_SYS_SPL_MALLOC_START 0x80200000
64+
#define CONFIG_SYS_SPL_MALLOC_SIZE 0x100000
65+
#define CONFIG_SPL_BSS_START_ADDR 0x80100000
66+
#define CONFIG_SPL_BSS_MAX_SIZE 0x80000
67+
#define CONFIG_SYS_MONITOR_LEN 0x80000
68+
#endif
69+
3870
#ifndef CONFIG_SYS_TEXT_BASE
3971
#define CONFIG_SYS_TEXT_BASE 0x67f80000
4072
#endif
@@ -250,6 +282,7 @@
250282

251283
#define CONFIG_CMDLINE_TAG
252284
#define CONFIG_CMDLINE_EDITING
285+
253286
#define CONFIG_CMD_IMLS
254287

255288
#define CONFIG_HWCONFIG
@@ -295,7 +328,11 @@
295328
#define CONFIG_SYS_INIT_SP_ADDR \
296329
(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
297330

331+
#ifdef CONFIG_SPL_BUILD
332+
#define CONFIG_SYS_MONITOR_BASE CONFIG_SPL_TEXT_BASE
333+
#else
298334
#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE /* start of monitor */
335+
#endif
299336

300337
#define CONFIG_SYS_QE_FW_ADDR 0x67f40000
301338

@@ -304,10 +341,17 @@
304341
*/
305342
#define CONFIG_ENV_OVERWRITE
306343

344+
#if defined(CONFIG_SD_BOOT)
345+
#define CONFIG_ENV_OFFSET 0x100000
346+
#define CONFIG_ENV_IS_IN_MMC
347+
#define CONFIG_SYS_MMC_ENV_DEV 0
348+
#define CONFIG_ENV_SIZE 0x20000
349+
#else
307350
#define CONFIG_ENV_IS_IN_FLASH
308351
#define CONFIG_ENV_ADDR (CONFIG_SYS_MONITOR_BASE - CONFIG_ENV_SECT_SIZE)
309352
#define CONFIG_ENV_SIZE 0x20000
310353
#define CONFIG_ENV_SECT_SIZE 0x20000 /* 128K (one sector) */
354+
#endif
311355

312356
#define CONFIG_OF_LIBFDT
313357
#define CONFIG_OF_BOARD_SETUP

0 commit comments

Comments
 (0)