Skip to contentSkip to conversation

arm: ls102xa: Add SD boot support for LS1021ATWR board

PATCH Superseded Alison Wang 1 participant 1 message Oct 17, 2014

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 7/8 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.

---
Change log:
v3: Update MAINTAINERS file.
Update PBI and RCW for SD boot.
v2: Use generic u-boot-spl.lds.

 board/freescale/ls1021atwr/MAINTAINERS        |  1 +
 board/freescale/ls1021atwr/ls1021atwr.c       | 30 ++++++++++++++++
 board/freescale/ls1021atwr/ls102xa_pbi.cfg    | 12 +++++++
 board/freescale/ls1021atwr/ls102xa_rcw_sd.cfg | 14 ++++++++
 configs/ls1021atwr_sdcard_defconfig           |  4 +++
 include/configs/ls1021atwr.h                  | 51 +++++++++++++++++++++++++++
 6 files changed, 112 insertions(+)
 create mode 100644 board/freescale/ls1021atwr/ls102xa_pbi.cfg
 create mode 100644 board/freescale/ls1021atwr/ls102xa_rcw_sd.cfg
 create mode 100644 configs/ls1021atwr_sdcard_defconfig
board/freescale/ls1021atwr/MAINTAINERS +1 -0
index 4e5bc15..651d43e 100644
@@ -4,3 +4,4 @@ S:	Maintained
 F:	board/freescale/ls1021atwr/
 F:	include/configs/ls1021atwr.h
 F:	configs/ls1021atwr_nor_defconfig
+F:	configs/ls1021atwr_sdcard_defconfig
board/freescale/ls1021atwr/ls1021atwr.c +30 -0
index ff7130e..d82602d 100644
@@ -16,6 +16,7 @@
 #include <netdev.h>
 #include <fsl_mdio.h>
 #include <tsec.h>
+#include <spl.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -65,6 +66,7 @@ struct cpld_data {
 	u8 rev2;		/* Reserved */
 };
 
+#if !defined(CONFIG_SD_BOOT) && !defined(CONFIG_QSPI_BOOT)
 static void convert_serdes_mux(int type, int need_reset);
 
 void cpld_show(void)
@@ -100,11 +102,14 @@ void cpld_show(void)
 	       in_8(&cpld_data->serdes_mux));
 #endif
 }
+#endif
 
 int checkboard(void)
 {
 	puts("Board: LS1021ATWR\n");
+#if !defined(CONFIG_SD_BOOT) && !defined(CONFIG_QSPI_BOOT)
 	cpld_show();
+#endif
 
 	return 0;
 }
@@ -213,6 +218,7 @@ int board_eth_init(bd_t *bis)
 }
 #endif
 
+#if !defined(CONFIG_SD_BOOT) && !defined(CONFIG_QSPI_BOOT)
 int config_serdes_mux(void)
 {
 	struct ccsr_gur __iomem *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR);
@@ -244,6 +250,7 @@ int config_serdes_mux(void)
 
 	return 0;
 }
+#endif
 
 int board_early_init_f(void)
 {
@@ -265,6 +272,25 @@ int board_early_init_f(void)
 	return 0;
 }
 
+#ifdef CONFIG_SPL_BUILD
+void board_init_f(ulong dummy)
+{
+	/* Set global data pointer */
+	gd = &gdata;
+
+	/* Clear the BSS */
+	memset(__bss_start, 0, __bss_end - __bss_start);
+
+	get_clocks();
+
+	preloader_console_init();
+
+	dram_init();
+
+	board_init_r(NULL, 0);
+}
+#endif
+
 int board_init(void)
 {
 	struct ccsr_cci400 *cci = (struct ccsr_cci400 *)CONFIG_SYS_CCI400_ADDR;
@@ -279,8 +305,10 @@ int board_init(void)
 
 #ifndef CONFIG_SYS_FSL_NO_SERDES
 	fsl_serdes_init();
+#if !defined(CONFIG_SD_BOOT) && !defined(CONFIG_QSPI_BOOT)
 	config_serdes_mux();
 #endif
+#endif
 
 	return 0;
 }
@@ -309,6 +337,7 @@ u16 flash_read16(void *addr)
 	return (((val) >> 8) & 0x00ff) | (((val) << 8) & 0xff00);
 }
 
+#if !defined(CONFIG_SD_BOOT) && !defined(CONFIG_QSPI_BOOT)
 static void convert_flash_bank(char bank)
 {
 	struct cpld_data *cpld_data = (void *)(CONFIG_SYS_CPLD_BASE);
@@ -491,3 +520,4 @@ U_BOOT_CMD(
 	"	-change lane C & lane D to PCIeX2\n"
 	"\nWARNING: If you aren't familiar with the setting of serdes, don't try to change anything!\n"
 );
+#endif
board/freescale/ls1021atwr/ls102xa_pbi.cfg new file +12 -0
new file mode 100644
index 0000000..f1a1b63
@@ -0,0 +1,12 @@
+#PBI commands
+
+09570200 ffffffff
+09570158 00000300
+8940007c 21f47300
+
+#Configure Scratch register
+09ee0200 10000000
+#Configure alternate space
+09570158 00001000
+#Flush PBL data
+096100c0 000FFFFF
board/freescale/ls1021atwr/ls102xa_rcw_sd.cfg new file +14 -0
new file mode 100644
index 0000000..911489b
@@ -0,0 +1,14 @@
+#PBL preamble and RCW header
+aa55aa55 01ee0100
+
+#enable IFC, disable QSPI and DSPI
+#0608000a 00000000 00000000 00000000
+#20000000 00404000 60025a00 21042000
+#00200000 00000000 00000000 01038000
+#00000000 001b1200 00000000 00000000
+
+#disable IFC, enable QSPI and DSPI
+0608000a 00000000 00000000 00000000
+20000000 00407900 60025a00 21046000
+00000000 00000000 00000000 00038000
+20024800 881b7540 00000000 00000000
configs/ls1021atwr_sdcard_defconfig new file +4 -0
new file mode 100644
index 0000000..0eb556a
@@ -0,0 +1,4 @@
+CONFIG_SPL=y
+CONFIG_SYS_EXTRA_OPTIONS="RAMBOOT_PBL,SPL_FSL_PBL,SD_BOOT"
++S:CONFIG_ARM=y
++S:CONFIG_TARGET_LS1021ATWR=y
include/configs/ls1021atwr.h +51 -0

93 lines not on this page · raw message

Signature · 1 line
2.1.0.27.g96db324