Add SD boot support for LS1021AQDS/TWR board
Subsystems (2)
cover Add SD boot support for LS1021AQDS/TWR board
This series contain SD boot support for LS1021AQDS/TWR 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.
The patches are based on the former LS1021AQDS/TWR board basic support patches.
----------------------------------------------------------------
Alison Wang (2):
arm: ls102xa: Add SD boot support for LS1021AQDS board
arm: ls102xa: Add SD boot support for LS1021ATWR board
Makefile | 15 ++++++++- arch/arm/cpu/armv7/ls102xa/Makefile | 1 + arch/arm/cpu/armv7/ls102xa/spl.c | 35 +++++++++++++++++++++ arch/arm/cpu/armv7/ls102xa/u-boot-spl.lds | 83 +++++++++++++++++++++++++++++++++++++++++++++++++ arch/arm/include/asm/arch-ls102xa/spl.h | 20 ++++++++++++ board/freescale/common/qixis.h | 7 +++++ board/freescale/ls1021aqds/ddr.c | 5 ++- board/freescale/ls1021aqds/ls1021aqds.c | 31 ++++++++++++++++++ board/freescale/ls1021aqds/ls102xa_pbi.cfg | 8 +++++ board/freescale/ls1021aqds/ls102xa_rcw_sd.cfg | 14 +++++++++ board/freescale/ls1021atwr/ls1021atwr.c | 31 +++++++++++++++++- board/freescale/ls1021atwr/ls102xa_pbi.cfg | 8 +++++ board/freescale/ls1021atwr/ls102xa_rcw_sd.cfg | 14 +++++++++ boards.cfg | 2 ++ common/spl/spl_mmc.c | 2 ++ include/configs/ls1021aqds.h | 64 ++++++++++++++++++++++++++++++++++++++ include/configs/ls1021atwr.h | 49 +++++++++++++++++++++++++++++ tools/pblimage.c | 20 +++++++++--- 18 files changed, 402 insertions(+), 7 deletions(-) create mode 100644 arch/arm/cpu/armv7/ls102xa/spl.c create mode 100644 arch/arm/cpu/armv7/ls102xa/u-boot-spl.lds create mode 100644 arch/arm/include/asm/arch-ls102xa/spl.h create mode 100644 board/freescale/ls1021aqds/ls102xa_pbi.cfg create mode 100644 board/freescale/ls1021aqds/ls102xa_rcw_sd.cfg create mode 100644 board/freescale/ls1021atwr/ls102xa_pbi.cfg create mode 100644 board/freescale/ls1021atwr/ls102xa_rcw_sd.cfg
PATCH 1/2 arm: ls102xa: Add SD boot support for LS1021AQDS board
This patch adds SD boot support for LS1021AQDS 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.
--- Makefile | 15 ++++- arch/arm/cpu/armv7/ls102xa/Makefile | 1 + arch/arm/cpu/armv7/ls102xa/spl.c | 35 +++++++++++ arch/arm/cpu/armv7/ls102xa/u-boot-spl.lds | 83 +++++++++++++++++++++++++++ arch/arm/include/asm/arch-ls102xa/spl.h | 20 +++++++ board/freescale/common/qixis.h | 7 +++ board/freescale/ls1021aqds/ddr.c | 5 +- board/freescale/ls1021aqds/ls1021aqds.c | 31 ++++++++++ board/freescale/ls1021aqds/ls102xa_pbi.cfg | 8 +++ board/freescale/ls1021aqds/ls102xa_rcw_sd.cfg | 14 +++++ boards.cfg | 1 + common/spl/spl_mmc.c | 2 + include/configs/ls1021aqds.h | 64 +++++++++++++++++++++ tools/pblimage.c | 20 +++++-- 14 files changed, 300 insertions(+), 6 deletions(-) create mode 100644 arch/arm/cpu/armv7/ls102xa/spl.c create mode 100644 arch/arm/cpu/armv7/ls102xa/u-boot-spl.lds create mode 100644 arch/arm/include/asm/arch-ls102xa/spl.h create mode 100644 board/freescale/ls1021aqds/ls102xa_pbi.cfg create mode 100644 board/freescale/ls1021aqds/ls102xa_rcw_sd.cfg
Makefile +14 -1
@@ -711,6 +711,7 @@ ALL-y += u-boot.srec u-boot.bin System.map binary_size_check ALL-$(CONFIG_ONENAND_U_BOOT) += u-boot-onenand.bin ifeq ($(CONFIG_SPL_FSL_PBL),y) ALL-$(CONFIG_RAMBOOT_PBL) += u-boot-with-spl-pbl.bin +ALL-$(CONFIG_SPL_PBL_PAD) += spl/u-boot-spl-pbl-pad.bin else ALL-$(CONFIG_RAMBOOT_PBL) += u-boot.pbl endif
@@ -936,13 +937,25 @@ endif u-boot-img.bin: spl/u-boot-spl.bin u-boot.img FORCE $(call if_changed,cat) +OBJCOPYFLAGS_u-boot-spl-pbl-pad.bin = -I binary -O binary --pad-to=$(CONFIG_SPL_MAX_SIZE) \ + --gap-fill=0xff + +spl/u-boot-spl-pbl-pad.bin: spl/u-boot-spl.bin FORCE + $(call if_changed,pad_cat) + +ifdef CONFIG_SPL_PBL_PAD +SPLPBL_BINLOAD := spl/u-boot-spl-pbl-pad.bin +else +SPLPBL_BINLOAD := spl/u-boot-spl.bin +endif + #Add a target to create boot binary having SPL binary in PBI format #concatenated with u-boot binary. It is need by PowerPC SoC having #internal SRAM <= 512KB. MKIMAGEFLAGS_u-boot-spl.pbl = -n $(srctree)/$(CONFIG_SYS_FSL_PBL_RCW:"%"=%) \ -R $(srctree)/$(CONFIG_SYS_FSL_PBL_PBI:"%"=%) -T pblimage -spl/u-boot-spl.pbl: spl/u-boot-spl.bin FORCE +spl/u-boot-spl.pbl: $(SPLPBL_BINLOAD) FORCE $(call if_changed,mkimage) OBJCOPYFLAGS_u-boot-with-spl-pbl.bin = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO) \
arch/arm/cpu/armv7/ls102xa/Makefile +1 -0
@@ -10,3 +10,4 @@ obj-y += timer.o obj-$(CONFIG_OF_LIBFDT) += fdt.o obj-$(CONFIG_SYS_HAS_SERDES) += fsl_ls1_serdes.o ls102xa_serdes.o +obj-$(CONFIG_SPL) += spl.o
arch/arm/cpu/armv7/ls102xa/spl.c new file +35 -0
@@ -0,0 +1,35 @@ +/* +* Copyright 2014 Freescale Semiconductor, Inc. +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <spl.h> + +u32 spl_boot_device (void ) +{ +#ifdef CONFIG_SPL_MMC_SUPPORT +return BOOT_DEVICE_MMC1 ; +#endif +return BOOT_DEVICE_NAND ; +} + +u32 spl_boot_mode (void ) +{ +switch (spl_boot_device ()) { +case BOOT_DEVICE_MMC1 : +#ifdef CONFIG_SPL_FAT_SUPPORT +return MMCSD_MODE_FAT ; +#else +return MMCSD_MODE_RAW ; +#endif +break ; +case BOOT_DEVICE_NAND : +return 0 ; +break ; +default : +puts ("spl: error: unsupported device\n" ); +hang (); + } +}
arch/arm/cpu/armv7/ls102xa/u-boot-spl.lds new file +83 -0
83 lines not on this page · raw message
arch/arm/include/asm/arch-ls102xa/spl.h new file +20 -0
@@ -0,0 +1,20 @@ +/* +* Copyright 2014 Freescale Semiconductor, Inc. +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef __ASM_ARCH_SPL_H__ +#define __ASM_ARCH_SPL_H__ + +#define BOOT_DEVICE_NONE 0 +#define BOOT_DEVICE_XIP 1 +#define BOOT_DEVICE_XIPWAIT 2 +#define BOOT_DEVICE_NAND 3 +#define BOOT_DEVICE_ONENAND 4 +#define BOOT_DEVICE_MMC1 5 +#define BOOT_DEVICE_MMC2 6 +#define BOOT_DEVICE_MMC2_2 7 +#define BOOT_DEVICE_SPI 10 + +#endif /* __ASM_ARCH_SPL_H__ */
board/freescale/common/qixis.h +7 -0
@@ -100,8 +100,15 @@ u8 qixis_read_i2c(unsigned int reg);void qixis_write_i2c (unsigned int reg,u8 value);#endif +#if defined(CONFIG_QIXIS_I2C_ACCESS ) && defined(CONFIG_SYS_I2C_FPGA_ADDR ) +#define QIXIS_READ (reg) qixis_read_i2c(offsetof(struct qixis, reg)) +#define QIXIS_WRITE (reg, value) \ + qixis_write_i2c(offsetof(struct qixis, reg), value) +#else #define QIXIS_READ (reg) qixis_read(offsetof(struct qixis, reg))#define QIXIS_WRITE (reg, value) qixis_write(offsetof(struct qixis, reg), value) +#endif +#ifdef CONFIG_SYS_I2C_FPGA_ADDR #define QIXIS_READ_I2C (reg) qixis_read_i2c(offsetof(struct qixis, reg))#define QIXIS_WRITE_I2C (reg, value) \
board/freescale/ls1021aqds/ddr.c +4 -1
@@ -156,9 +156,12 @@ phys_size_t initdram(int board_type) {phys_size_t dram_size; +#if defined(CONFIG_SPL_BUILD ) || !defined(CONFIG_SPL )puts ("Initializing DDR....using SPD\n" ); dram_size =fsl_ddr_sdram (); - +#else + dram_size =fsl_ddr_sdram_size (); +#endif return dram_size; }
board/freescale/ls1021aqds/ls1021aqds.c +31 -0
@@ -13,6 +13,7 @@#include <mmc.h> #include <fsl_esdhc.h> #include <fsl_ifc.h> +#include <spl.h> #include "../common/qixis.h" #include "ls1021aqds_qixis.h"
@@ -29,10 +30,13 @@ enum {int checkboard (void ) {char buf[64 ]; +#if !defined(CONFIG_SD_BOOT ) && !defined(CONFIG_QSPI_BOOT )u8 sw; +#endif puts ("Board: LS1021AQDS\n" ); +#if !defined(CONFIG_SD_BOOT ) && !defined(CONFIG_QSPI_BOOT ) sw =QIXIS_READ (brdcfg[0 ]); sw = (sw &QIXIS_LBMAP_MASK ) >>QIXIS_LBMAP_SHIFT ;
@@ -46,6 +50,7 @@ int checkboard(void)printf ("IFCCard\n" ); else printf("invalid setting of SW%u\n", QIXIS_LBMAP_SWITCH); +#endif printf ("Sys ID:0x%02x, Sys Ver: 0x%02x\n" ,QIXIS_READ (id),QIXIS_READ (arch));
@@ -148,6 +153,32 @@ int board_early_init_f(void)return 0 ; } +#ifdef CONFIG_SPL_BUILD +void board_init_f (ulong dummy) +{ +struct ccsr_cci400 *cci = (struct ccsr_cci400 *)CONFIG_SYS_CCI400_ADDR ; + +/* Set global data pointer */ + gd = &gdata; + +/* Clear the BSS */ +memset (__bss_start,0 , __bss_end - __bss_start); + +get_clocks (); + +preloader_console_init (); + +#ifdef CONFIG_SPL_I2C_SUPPORT +i2c_init_all (); +#endif +out_le32 (&cci->ctrl_ord,0x00000008 ); + +dram_init (); + +board_init_r (NULL ,0 ); +} +#endif +int config_board_mux (int ctrl_type) {u8 reg12;
board/freescale/ls1021aqds/ls102xa_pbi.cfg new file +8 -0
@@ -0,0 +1,8 @@ +#PBI commands + +#Configure Scratch register +09ee0200 10000000 +#Configure alternate space +09570158 00080000 +#Flush PBL data +096100c0 000FFFFF
board/freescale/ls1021aqds/ls102xa_rcw_sd.cfg new file +14 -0
@@ -0,0 +1,14 @@ +#PBL preamble and RCW header +aa55aa55 01ee0100 + +#enable IFC, disable QSPI and DSPI +#0608000a 00000000 00000000 00000000 +#00000000 00404000 60025a00 21042000 +#00200000 00000000 00000000 01038000 +#00000000 001b1200 00000000 00000000 + +#disable IFC, enable QSPI and DSPI +0608000a 00000000 00000000 00000000 +60000000 00407900 e0025a00 21046000 +00000000 00000000 00000000 00038000 +20024800 001b7200 00000000 00000000
boards.cfg +1 -0
@@ -302,6 +302,7 @@ Active arm armv7 exynos samsung universal_c210 Active arm armv7 highbank - highbank highbank - Rob Herring <[email protected]> Active arm armv7 keystone ti k2hk_evm k2hk_evm - Vitaly Andrianov <[email protected]> Active arm armv7 ls102xa freescale ls1021aqds ls1021aqds_nor ls1021aqds Alison Wang <[email protected]> +Active arm armv7 ls102xa freescale ls1021aqds ls1021aqds_sdcard ls1021aqds:RAMBOOT_PBL,SPL_FSL_PBL,SD_BOOT Alison Wang <[email protected]> Active arm armv7 ls102xa freescale ls1021atwr ls1021atwr_nor ls1021atwr Alison Wang <[email protected]> Active arm armv7 mx5 denx m53evk m53evk m53evk:IMX_CONFIG=board/denx/m53evk/imximage.cfg Marek Vasut <[email protected]> Active arm armv7 mx5 esg ima3-mx53 ima3-mx53 ima3-mx53:IMX_CONFIG=board/esg/ima3-mx53/imximage.cfg -
common/spl/spl_mmc.c +2 -0
@@ -29,8 +29,10 @@ static int mmc_load_image_raw(struct mmc *mmc, unsigned long sector)if (err ==0 ) goto end; +#ifndef CONFIG_SYS_SPL_ASSUME_UBOOT_NIH if (image_get_magic (header) !=IH_MAGIC )return -1 ; +#endif spl_parse_image_header (header);
include/configs/ls1021aqds.h +64 -0
101 lines not on this page · raw message
tools/pblimage.c +16 -4
@@ -12,6 +12,10 @@* Initialize to an invalid value. */ static uint32_t next_pbl_cmd =0x82000000 ; +static uint32_t pbl_cmd_initaddr =0x82000000 ; +static uint32_t pbi_crc_cmd1 =0x13 ; +static uint32_t pbi_crc_cmd2 =0x80 ; +/* * need to store all bytes in memory for calculating crc32, then write the * bytes to image file for PBL boot.
@@ -49,7 +53,7 @@ static void init_next_pbl_cmd(FILE *fp_uboot)exit (EXIT_FAILURE ); } - next_pbl_cmd =0x82000000 - st.st_size; + next_pbl_cmd = pbl_cmd_initaddr - st.st_size; }static void generate_pbl_cmd (void )
@@ -81,7 +85,7 @@ static void pbl_fget(size_t size, FILE *stream)static void load_uboot (FILE *fp_uboot) {init_next_pbl_cmd (fp_uboot); -while (next_pbl_cmd <0x82000000 ) { +while (next_pbl_cmd < pbl_cmd_initaddr) {generate_pbl_cmd ();pbl_fget (64 , fp_uboot); }
@@ -111,6 +115,14 @@ static void pbl_parser(char *name)size_t len =0 ; fname = name; + +if (strstr (fname,"ls102xa" )) { + next_pbl_cmd =0x8100d000 ; + pbl_cmd_initaddr =0x8100d000 ; + pbi_crc_cmd1 =0x61 ; + pbi_crc_cmd2 =0 ; + } + fd =fopen (name,"r" );if (fd ==NULL ) {printf ("Error:%s - Can't open\n" , fname);
@@ -172,8 +184,8 @@ static void add_end_cmd(void)/* Add PBI CRC command. */ *pmem_buf++ =0x08 ; - *pmem_buf++ =0x13 ; - *pmem_buf++ =0x80 ; + *pmem_buf++ = pbi_crc_cmd1; + *pmem_buf++ = pbi_crc_cmd2; *pmem_buf++ =0x40 ; pbl_size +=4 ;
Signature · 1 line
1.8.0
PATCH 2/2 arm: ls102xa: Add SD boot support for LS1021ATWR board
In reply to Alison WangThis 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.
--- board/freescale/ls1021atwr/ls1021atwr.c | 31 ++++++++++++++++- board/freescale/ls1021atwr/ls102xa_pbi.cfg | 8 +++++ board/freescale/ls1021atwr/ls102xa_rcw_sd.cfg | 14 ++++++++ boards.cfg | 1 + include/configs/ls1021atwr.h | 49 +++++++++++++++++++++++++++ 5 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 board/freescale/ls1021atwr/ls102xa_pbi.cfg create mode 100644 board/freescale/ls1021atwr/ls102xa_rcw_sd.cfg
board/freescale/ls1021atwr/ls1021atwr.c +30 -1
@@ -16,6 +16,7 @@#include <netdev.h> #include <fsl_mdio.h> #include <tsec.h> +#include <spl.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -66,6 +67,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 )
@@ -103,11 +105,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 ; }
@@ -218,6 +223,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 );
@@ -249,6 +255,7 @@ int config_serdes_mux(void) return 0; } +#endif int board_early_init_f (void ) {
@@ -273,6 +280,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 ;
@@ -284,9 +310,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 ; }
@@ -312,6 +339,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 );
@@ -497,3 +525,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 +8 -0
@@ -0,0 +1,8 @@ +#PBI commands + +#Configure Scratch register +09ee0200 10000000 +#Configure alternate space +09570158 00080000 +#Flush PBL data +096100c0 000FFFFF
board/freescale/ls1021atwr/ls102xa_rcw_sd.cfg new file +14 -0
@@ -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 00404000 60025a00 21042000 +00000000 00000000 00000000 01038000 +20024800 001b1200 00000000 00000000
boards.cfg +1 -0
@@ -304,6 +304,7 @@ Active arm armv7 keystone ti k2hk_evm Active arm armv7 ls102xa freescale ls1021aqds ls1021aqds_nor ls1021aqds Alison Wang <[email protected]> Active arm armv7 ls102xa freescale ls1021aqds ls1021aqds_sdcard ls1021aqds:RAMBOOT_PBL,SPL_FSL_PBL,SD_BOOT Alison Wang <[email protected]> Active arm armv7 ls102xa freescale ls1021atwr ls1021atwr_nor ls1021atwr Alison Wang <[email protected]> +Active arm armv7 ls102xa freescale ls1021atwr ls1021atwr_sdcard ls1021atwr:RAMBOOT_PBL,SPL_FSL_PBL,SD_BOOT Alison Wang <[email protected]> Active arm armv7 mx5 denx m53evk m53evk m53evk:IMX_CONFIG=board/denx/m53evk/imximage.cfg Marek Vasut <[email protected]> Active arm armv7 mx5 esg ima3-mx53 ima3-mx53 ima3-mx53:IMX_CONFIG=board/esg/ima3-mx53/imximage.cfg - Active arm armv7 mx5 freescale mx51evk mx51evk mx51evk:IMX_CONFIG=board/freescale/mx51evk/imximage.cfg Stefano Babic <[email protected]>
include/configs/ls1021atwr.h +49 -0
84 lines not on this page · raw message
Signature · 1 line
1.8.0