Skip to contentSkip to conversation

Add SD/NAND boot support for LS1021AQDS/TWR board

PATCH Superseded Alison Wang 4 participants 15 messages Oct 17, 2014 – Dec 3, 2014

Subsystems (2)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v3 cover Add SD/NAND boot support for LS1021AQDS/TWR board

This series contain SD boot support for LS1021AQDS/TWR board and NAND 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 or NAND flash to DDR, finally SPL transfer control to u-boot.

The patches are based on the previous 5 patches,
[U-Boot,v2,5/5] arm: ls102xa: Select ge2_clk125 for eTSEC clock muxing [U-Boot,v2,4/5] arm: ls102xa: Add SystemID EEPROM support for LS1021ATWR board [U-Boot,v2,3/5] ls102xa: ifc: nor: fix the write issue when bytes unaligned [U-Boot,v2,2/5] arm: ls102xa: Remove bit reversing for SCFG registers [U-Boot,v2,1/5] arm: ls102xa: Add snoop disable for slave port 0, 1 and 2

Change log:
v3: Change the Copyright year.
Gave more explaination in the commit.
Update MAINTAINERS files.
Update PBI and RCW for SD boot.
v2: Remove the definition of CONFIG_SPL_MAX_SIZE.
Pad the variable u-boot size to 64 byte boundary in pblimage tool. Use pblimage_check_params() insteady of basing on the file name. Use generic u-boot-spl.lds.

----------------------------------------------------------------
Alison Wang (8):
ls102xa: pblimage: Add pblimage tool support for LS102xA
spl: Use u-boot.img instead of u-boot.bin
arm: spl: Add I2C linker list in generic .lds
common: spl: Add interactive DDR debugger support for SPL image
ls102xa: qixis: Add CONFIG_QIXIS_I2C_ACCESS macro
arm: ls102xa: Add SD boot support for LS1021AQDS board
arm: ls102xa: Add SD boot support for LS1021ATWR board
arm: ls102xa: Add NAND boot support for LS1021AQDS board

 Makefile                                          |  11 +++++-
 arch/arm/cpu/armv7/ls102xa/Makefile               |   1 +
 arch/arm/cpu/armv7/ls102xa/spl.c                  |  33 +++++++++++++++++
 arch/arm/cpu/u-boot-spl.lds                       |   3 ++
 arch/arm/include/asm/arch-ls102xa/config.h        |   1 +
 arch/arm/include/asm/arch-ls102xa/immap_ls102xa.h |   2 +
 arch/arm/include/asm/arch-ls102xa/spl.h           |  20 ++++++++++
 board/freescale/common/qixis.h                    |   7 ++++
 board/freescale/ls1021aqds/MAINTAINERS            |   2 +
 board/freescale/ls1021aqds/ddr.c                  |   5 ++-
 board/freescale/ls1021aqds/ls1021aqds.c           |  47 +++++++++++++++++++++++
 board/freescale/ls1021aqds/ls102xa_pbi.cfg        |  12 ++++++
 board/freescale/ls1021aqds/ls102xa_rcw_nand.cfg   |   7 ++++
 board/freescale/ls1021aqds/ls102xa_rcw_sd.cfg     |  14 +++++++
 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 +++++++
 common/Makefile                                   |  20 +++++-----
 configs/ls1021aqds_nand_defconfig                 |   4 ++
 configs/ls1021aqds_sdcard_defconfig               |   4 ++
 configs/ls1021atwr_sdcard_defconfig               |   4 ++
 drivers/mtd/nand/fsl_ifc_spl.c                    |   8 ++++
 include/configs/ls1021aqds.h                      | 134 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 include/configs/ls1021atwr.h                      |  51 +++++++++++++++++++++++++
 tools/pblimage.c                                  | 108 ++++++++++++++++++++++++++++++++++++-----------------
 26 files changed, 508 insertions(+), 47 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/ls102xa/spl.c
 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_nand.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
 create mode 100644 configs/ls1021aqds_nand_defconfig
 create mode 100644 configs/ls1021aqds_sdcard_defconfig
 create mode 100644 configs/ls1021atwr_sdcard_defconfig
#1 lore raw

PATCH v3 1/8 ls102xa: pblimage: Add pblimage tool support for LS102xA

For LS102xA, the size of spl/u-boot-spl.bin is variable. This patch adds the support to deal with the variable u-boot size in pblimage tool. It will be padded to 64 byte boundary.

Use pblimage_check_params() to add the specific operations for ARM, such as PBI CRC and END command and the calculation of pbl_cmd_initaddr.

---
Change log:
v3: Change the Copyright year.
v2: Remove the definition of CONFIG_SPL_MAX_SIZE.
Pad the variable u-boot size to 64 byte boundary in pblimage tool. Use pblimage_check_params() insteady of basing on the file name.

 Makefile         |   3 +-
 tools/pblimage.c | 108 +++++++++++++++++++++++++++++++++++++------------------
 2 files changed, 76 insertions(+), 35 deletions(-)
Makefile +2 -1
index 99097e1..164929e 100644
@@ -963,7 +963,8 @@ u-boot-img.bin: spl/u-boot-spl.bin u-boot.img FORCE
 #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
+		-R $(srctree)/$(CONFIG_SYS_FSL_PBL_PBI:"%"=%) -T pblimage \
+		-A $(ARCH) -a $(CONFIG_SPL_TEXT_BASE)
 
 spl/u-boot-spl.pbl: spl/u-boot-spl.bin FORCE
 	$(call if_changed,mkimage)
tools/pblimage.c +74 -34

172 lines not on this page · raw message

Signature · 1 line
2.1.0.27.g96db324
#2 lore raw

PATCH v3 2/8 spl: Use u-boot.img instead of u-boot.bin

In reply to Alison Wang

In SD boot, the magic number of u-boot image will be checked. For LS102xA, u-boot.bin doesn't have the magic number. So use u-boot.img which includes the magic number instead of u-boot.bin when producing u-boot-with-spl-pbl.bin.

---
Change log:
v3: No change.
v2: No change.

 Makefile | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
Makefile +7 -1
index 164929e..f22d767 100644
@@ -969,10 +969,16 @@ MKIMAGEFLAGS_u-boot-spl.pbl = -n $(srctree)/$(CONFIG_SYS_FSL_PBL_RCW:"%"=%) \
 spl/u-boot-spl.pbl: spl/u-boot-spl.bin FORCE
 	$(call if_changed,mkimage)
 
+ifeq ($(ARCH),arm)
+UBOOT_BINLOAD := u-boot.img
+else
+UBOOT_BINLOAD := u-boot.bin
+endif
+
 OBJCOPYFLAGS_u-boot-with-spl-pbl.bin = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO) \
 			  --gap-fill=0xff
 
-u-boot-with-spl-pbl.bin: spl/u-boot-spl.pbl u-boot.bin FORCE
+u-boot-with-spl-pbl.bin: spl/u-boot-spl.pbl $(UBOOT_BINLOAD) FORCE
 	$(call if_changed,pad_cat)
 
 # PPC4xx needs the SPL at the end of the image, since the reset vector
Signature · 1 line
2.1.0.27.g96db324
#3 lore raw

PATCH v3 3/8 arm: spl: Add I2C linker list in generic .lds

In reply to Alison Wang

On LS1, DDR is initialized by reading SPD through I2C interface in SPL code. For I2C, ll_entry_count() is called, and it returns the number of elements of a linker-generated array placed into subsection of .u_boot_list section specified by _list argument. So add I2C linker list in the generic .lds to fix the issue about using I2C in SPL.

---
Change log:
v3: No change.
v2: New file.

 arch/arm/cpu/u-boot-spl.lds | 3 +++
 1 file changed, 3 insertions(+)
arch/arm/cpu/u-boot-spl.lds +3 -0
index 4beddf0..bddef74 100644
@@ -32,6 +32,9 @@ SECTIONS
 	}
 
 	. = ALIGN(4);
+	.u_boot_list : {
+		KEEP(*(SORT(.u_boot_list*_i2c_*)));
+	}
 
 	. = .;
 
Signature · 1 line
2.1.0.27.g96db324
#4 lore raw

PATCH v3 4/8 common: spl: Add interactive DDR debugger support for SPL image

In reply to Alison Wang

To support interactive DDR debugger, cli_simple.o, cli.o, cli_readline.o, command.o, s_record.o, xyzModem.o and cmd_disk.o are all needed for drivers/ddr/fsl/interactive.c.

In current common/Makefile, the above .o files are only produced when CONFIG_SPL_BUILD is disabled.

For LS102xA, interactive DDR debugger is needed in SD/NAND boot too, and I enabled CONFIG_FSL_DDR_INTERACTIVE. But according to the current common/Makfile, all the above .o files are not produced in SPL part because CONFIG_SPL_BUILD is enabled in SPL part, the following error will be shown,

drivers/ddr/fsl/built-in.o: In function `fsl_ddr_interactive':
/home/wangh/layerscape/u-boot/drivers/ddr/fsl/interactive.c:1871:
undefined reference to `cli_readline_into_buffer' /home/wangh/layerscape/u-boot/drivers/ddr/fsl/interactive.c:1873:
undefined reference to `cli_simple_parse_line'
make[1]: *** [spl/u-boot-spl] Error 1
make: *** [spl/u-boot-spl] Error 2

So this patch fixed this issue and the above .o files will be produced no matter CONFIG_SPL_BUILD is enabled or disabled.

---
Change log:
v3: Gave more explaination in the commit.
v2: No change.

 common/Makefile | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
common/Makefile +10 -10
index b19d379..a166e4c 100644
@@ -8,22 +8,12 @@
 # core
 ifndef CONFIG_SPL_BUILD
 obj-y += main.o
-obj-y += command.o
 obj-y += exports.o
 obj-y += hash.o
 ifdef CONFIG_SYS_HUSH_PARSER
 obj-y += cli_hush.o
 endif
 
-# We always have this since drivers/ddr/fs/interactive.c needs it
-obj-y += cli_simple.o
-
-obj-y += cli.o
-obj-y += cli_readline.o
-obj-y += s_record.o
-obj-y += xyzModem.o
-obj-y += cmd_disk.o
-
 # This option is not just y/n - it can have a numeric value
 ifdef CONFIG_BOOTDELAY
 obj-y += autoboot.o
@@ -265,4 +255,14 @@ obj-y += aboot.o
 obj-y += fb_mmc.o
 endif
 
+# We always have this since drivers/ddr/fs/interactive.c needs it
+obj-y += cli_simple.o
+
+obj-y += cli.o
+obj-y += cli_readline.o
+obj-y += command.o
+obj-y += s_record.o
+obj-y += xyzModem.o
+obj-y += cmd_disk.o
+
 CFLAGS_env_embedded.o := -Wa,--no-warn -DENV_CRC=$(shell tools/envcrc 2>/dev/null)
Signature · 1 line
2.1.0.27.g96db324
#5 lore raw

PATCH v3 4/8 common: spl: Add interactive DDR debugger support for SPL image

Hello Alison,

Quoted 21 lines · Alison Wang

To support interactive DDR debugger, cli_simple.o, cli.o, cli_readline.o, command.o, s_record.o, xyzModem.o and cmd_disk.o are all needed for drivers/ddr/fsl/interactive.c.

In current common/Makefile, the above .o files are only produced when CONFIG_SPL_BUILD is disabled.

For LS102xA, interactive DDR debugger is needed in SD/NAND boot too, and I enabled CONFIG_FSL_DDR_INTERACTIVE. But according to the current common/Makfile, all the above .o files are not produced in SPL part because CONFIG_SPL_BUILD is enabled in SPL part, the following error will be shown,

drivers/ddr/fsl/built-in.o: In function `fsl_ddr_interactive':
/home/wangh/layerscape/u-boot/drivers/ddr/fsl/interactive.c:1871:
undefined reference to `cli_readline_into_buffer' /home/wangh/layerscape/u-boot/drivers/ddr/fsl/interactive.c:1873:
undefined reference to `cli_simple_parse_line'
make[1]: *** [spl/u-boot-spl] Error 1
make: *** [spl/u-boot-spl] Error 2

Quoted 8 lines

So this patch fixed this issue and the above .o files will be produced no matter CONFIG_SPL_BUILD is enabled or disabled.

---
Change log:
v3: Gave more explaination in the commit.
v2: No change.

This does not apply cleanly. Could you rebase and resubmit?

Amicalement,

Signature · 1 line
Albert.
#6 lore raw

PATCH v3 4/8 common: spl: Add interactive DDR debugger support for SPL image

Hello, Albert,

Quoted 28 lines
Quoted 9 lines · Alison Wang

To support interactive DDR debugger, cli_simple.o, cli.o, cli_readline.o, command.o, s_record.o, xyzModem.o and cmd_disk.o are all needed for drivers/ddr/fsl/interactive.c.

In current common/Makefile, the above .o files are only produced when CONFIG_SPL_BUILD is disabled.

For LS102xA, interactive DDR debugger is needed in SD/NAND boot too, and I enabled CONFIG_FSL_DDR_INTERACTIVE. But according to the

current

Quoted 12 lines

common/Makfile, all the above .o files are not produced in SPL part because CONFIG_SPL_BUILD is enabled in SPL part, the following error will be shown,

drivers/ddr/fsl/built-in.o: In function `fsl_ddr_interactive':
/home/wangh/layerscape/u-boot/drivers/ddr/fsl/interactive.c:1871:
undefined reference to `cli_readline_into_buffer' /home/wangh/layerscape/u-boot/drivers/ddr/fsl/interactive.c:1873:
undefined reference to `cli_simple_parse_line'
make[1]: *** [spl/u-boot-spl] Error 1
make: *** [spl/u-boot-spl] Error 2

Quoted 1 line

So this patch fixed this issue and the above .o files will be

produced

Quoted 2 lines

no matter CONFIG_SPL_BUILD is enabled or disabled.

Quoted 7 lines
Quoted 5 lines

---
Change log:
v3: Gave more explaination in the commit.
v2: No change.

This does not apply cleanly. Could you rebase and resubmit?

[Alison Wang] ok, I will rebase and resubmit the set. Thanks.

Best Regards,
Alison Wang

#7 lore raw

PATCH v3 4/8 common: spl: Add interactive DDR debugger support for SPL image

Quoted 2 lines · On 10/27/2014 06:48 PM, Wang Huan-B18965 wrote:

Hello, Albert,

<snip>

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

---
Change log:
v3: Gave more explaination in the commit.
v2: No change.

This does not apply cleanly. Could you rebase and resubmit?

[Alison Wang] ok, I will rebase and resubmit the set. Thanks.

Alison,

Where are we on this patch? If you haven't sent an update, I can take this one and resolve the conflict.

Albert,

This set primarily deals with FSL specific boards. I can take them in if you don't see any issue with the patches (except the conflicts).

York

#8 lore raw

PATCH v3 4/8 common: spl: Add interactive DDR debugger support for SPL image

Hello York,

Quoted 16 lines · York Sun
Quoted 2 lines · On 10/27/2014 06:48 PM, Wang Huan-B18965 wrote:

Hello, Albert,

<snip>

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

---
Change log:
v3: Gave more explaination in the commit.
v2: No change.

This does not apply cleanly. Could you rebase and resubmit?

[Alison Wang] ok, I will rebase and resubmit the set. Thanks.

Alison,

Quoted 7 lines

Where are we on this patch? If you haven't sent an update, I can take this one and resolve the conflict.

Albert,

This set primarily deals with FSL specific boards. I can take them in if you don't see any issue with the patches (except the conflicts).

Thanks York for the proposal, but I would prefer the patch to be rebased and resubmitted, as rebasing does require some changes which could be trivial, and thus be handled by the custodian, or not trivial, and thus require review; best, therefore, to rebase and repost.

Quoted 1 line

York

Amicalement,

Signature · 1 line
Albert.
#9 lore raw

PATCH v3 4/8 common: spl: Add interactive DDR debugger support for SPL image

Quoted 25 lines · Albert ARIBAUD

Hello York,

Quoted 21 lines · York Sun
Quoted 2 lines · On 10/27/2014 06:48 PM, Wang Huan-B18965 wrote:

Hello, Albert,

<snip>

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

---
Change log:
v3: Gave more explaination in the commit.
v2: No change.

This does not apply cleanly. Could you rebase and resubmit?

[Alison Wang] ok, I will rebase and resubmit the set. Thanks.

Alison,

Where are we on this patch? If you haven't sent an update, I can take this one and resolve the conflict.

Albert,

Quoted 8 lines
Quoted 2 lines

This set primarily deals with FSL specific boards. I can take them in if you don't see any issue with the patches (except the conflicts).

Thanks York for the proposal, but I would prefer the patch to be rebased and resubmitted, as rebasing does require some changes which could be trivial, and thus be handled by the custodian, or not trivial, and thus require review; best, therefore, to rebase and repost.

All right, then. Alison, please send a new set after you test it. I will mark this set "change requested".

York

#10 lore raw

PATCH v3 4/8 common: spl: Add interactive DDR debugger support for SPL image

Quoted 29 lines · York Sun
Quoted 28 lines · Albert ARIBAUD

Hello York,

Quoted 23 lines · York Sun
Quoted 2 lines · On 10/27/2014 06:48 PM, Wang Huan-B18965 wrote:

Hello, Albert,

<snip>

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

---
Change log:
v3: Gave more explaination in the commit.
v2: No change.

This does not apply cleanly. Could you rebase and resubmit?

[Alison Wang] ok, I will rebase and resubmit the set. Thanks.

Alison,

Where are we on this patch? If you haven't sent an update, I can take this one and resolve the conflict.

Albert,

This set primarily deals with FSL specific boards. I can take them in if you don't see any issue with the patches (except the conflicts).

Quoted 9 lines
Quoted 5 lines

Thanks York for the proposal, but I would prefer the patch to be rebased and resubmitted, as rebasing does require some changes which could be trivial, and thus be handled by the custodian, or not trivial, and thus require review; best, therefore, to rebase and repost.

All right, then. Alison, please send a new set after you test it. I will mark this set "change requested".

Albert,

I haven't seen a new version yet. I need this patch to apply other patches. I can fix the conflict in this patch. Do you mind if I take this v3 set? I think other patches in this set are OK.

York

#11 lore raw

PATCH v3 4/8 common: spl: Add interactive DDR debugger support for SPL image

In reply to York Sun

Hi, York,

Quoted 35 lines · Albert ARIBAUD
Quoted 21 lines

Hello York,

Quoted 17 lines · York Sun
Quoted 2 lines · On 10/27/2014 06:48 PM, Wang Huan-B18965 wrote:

Hello, Albert,

<snip>

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

---
Change log:
v3: Gave more explaination in the commit.
v2: No change.

This does not apply cleanly. Could you rebase and resubmit?

[Alison Wang] ok, I will rebase and resubmit the set. Thanks.

Alison,

Where are we on this patch? If you haven't sent an update, I can

take

Quoted 5 lines
Quoted 5 lines

this one and resolve the conflict.

Albert,

This set primarily deals with FSL specific boards. I can take them

in

Quoted 6 lines
Quoted 1 line

if you don't see any issue with the patches (except the conflicts).

Thanks York for the proposal, but I would prefer the patch to be rebased and resubmitted, as rebasing does require some changes which could be trivial, and thus be handled by the custodian, or not trivial, and thus require review; best, therefore, to rebase and

Quoted 5 lines

repost.

Quoted 1 line

All right, then. Alison, please send a new set after you test it. I will mark this set "change requested".

[Alison Wang] I rebased, tested and submitted the new set. Please help to review it. Thanks.

Best Regards,
Alison Wang

#12 lore raw

PATCH v3 4/8 common: spl: Add interactive DDR debugger support for SPL image

In reply to Albert ARIBAUD
Quoted 28 lines · Albert ARIBAUD

Hello Alison,

Quoted 24 lines · Alison Wang

To support interactive DDR debugger, cli_simple.o, cli.o, cli_readline.o, command.o, s_record.o, xyzModem.o and cmd_disk.o are all needed for drivers/ddr/fsl/interactive.c.

In current common/Makefile, the above .o files are only produced when CONFIG_SPL_BUILD is disabled.

For LS102xA, interactive DDR debugger is needed in SD/NAND boot too, and I enabled CONFIG_FSL_DDR_INTERACTIVE. But according to the current common/Makfile, all the above .o files are not produced in SPL part because CONFIG_SPL_BUILD is enabled in SPL part, the following error will be shown,

drivers/ddr/fsl/built-in.o: In function `fsl_ddr_interactive':
/home/wangh/layerscape/u-boot/drivers/ddr/fsl/interactive.c:1871:
undefined reference to `cli_readline_into_buffer' /home/wangh/layerscape/u-boot/drivers/ddr/fsl/interactive.c:1873:
undefined reference to `cli_simple_parse_line'
make[1]: *** [spl/u-boot-spl] Error 1
make: *** [spl/u-boot-spl] Error 2

So this patch fixed this issue and the above .o files will be produced no matter CONFIG_SPL_BUILD is enabled or disabled.

Quoted 8 lines
Quoted 5 lines

---
Change log:
v3: Gave more explaination in the commit.
v2: No change.

This does not apply cleanly. Could you rebase and resubmit?

Albert,

Are you trying to test/apply this patch?

York

#13 lore raw

PATCH v3 5/8 ls102xa: qixis: Add CONFIG_QIXIS_I2C_ACCESS macro

In reply to Alison Wang

Through adding CONFIG_QIXIS_I2C_ACCESS macro, QIXIS_READ(reg)/QIXIS_WRITE(reg, value) can be used for both i2c and ifc access to QIXIS FPGA. This is more convenient for coding.

---
Change log:
v3: No change.
v2: No change.

 board/freescale/common/qixis.h | 7 +++++++
 1 file changed, 7 insertions(+)
board/freescale/common/qixis.h +7 -0
index d8fed14..52d2021 100644
@@ -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) \
Signature · 1 line
2.1.0.27.g96db324
#14 lore raw

PATCH v3 6/8 arm: ls102xa: Add SD boot support for LS1021AQDS board

In reply to Alison Wang

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.

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

 arch/arm/cpu/armv7/ls102xa/Makefile           |  1 +
 arch/arm/cpu/armv7/ls102xa/spl.c              | 33 ++++++++++++++
 arch/arm/include/asm/arch-ls102xa/spl.h       | 20 ++++++++
 board/freescale/ls1021aqds/MAINTAINERS        |  1 +
 board/freescale/ls1021aqds/ddr.c              |  5 +-
 board/freescale/ls1021aqds/ls1021aqds.c       | 31 +++++++++++++
 board/freescale/ls1021aqds/ls102xa_pbi.cfg    | 12 +++++
 board/freescale/ls1021aqds/ls102xa_rcw_sd.cfg | 14 ++++++
 configs/ls1021aqds_sdcard_defconfig           |  4 ++
 include/configs/ls1021aqds.h                  | 66 +++++++++++++++++++++++++++
 10 files changed, 186 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/cpu/armv7/ls102xa/spl.c
 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 configs/ls1021aqds_sdcard_defconfig
arch/arm/cpu/armv7/ls102xa/Makefile +1 -0
index d82ce8d..56ef3a7 100644
@@ -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 +33 -0
new file mode 100644
index 0000000..1dfbf54
@@ -0,0 +1,33 @@
+/*
+ * 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
+	case BOOT_DEVICE_NAND:
+		return 0;
+	default:
+		puts("spl: error: unsupported device\n");
+		hang();
+	}
+}
arch/arm/include/asm/arch-ls102xa/spl.h new file +20 -0
new file mode 100644
index 0000000..26e4ea1
@@ -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/ls1021aqds/MAINTAINERS +1 -0
index ccf4513..de11203 100644
@@ -5,3 +5,4 @@ F:	board/freescale/ls1021aqds/
 F:	include/configs/ls1021aqds.h
 F:	configs/ls1021aqds_nor_defconfig
 F:	configs/ls1021aqds_ddr4_nor_defconfig
+F:	configs/ls1021aqds_sdcard_defconfig
board/freescale/ls1021aqds/ddr.c +4 -1
index 5898e33..a539ff9 100644
@@ -153,9 +153,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
index b744250..34f54ab 100644
@@ -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));
@@ -154,6 +159,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, CCI400_CTRLORD_TERM_BARRIER);
+
+	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 +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/ls1021aqds/ls102xa_rcw_sd.cfg new file +14 -0
new file mode 100644
index 0000000..4cdd2a5
@@ -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 60025a00 21046000
+00000000 00000000 00000000 00038000
+20024800 001b7200 00000000 00000000
configs/ls1021aqds_sdcard_defconfig new file +4 -0
new file mode 100644
index 0000000..e03c3b4
@@ -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_LS1021AQDS=y
include/configs/ls1021aqds.h +66 -0

110 lines not on this page · raw message

Signature · 1 line
2.1.0.27.g96db324