Skip to contentSkip to conversation

Add SD boot support for LS1021AQDS/TWR board

PATCH Superseded Alison Wang 4 participants 32 messages Sep 18, 2014 – Oct 15, 2014 1 message not in the archive

Subsystems (2)

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

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.

----------------------------------------------------------------
Alison Wang (7):
spl: pbl: Add new SPL image for pblimage tool
ls102xa: pblimage: Add pblimage tool support for LS102xA
spl: Use u-boot.img instead of u-boot.bin when CONFIG_SPL_PBL_PAD is enabled
ls102xa: qixis: Add CONFIG_QIXIS_I2C_ACCESS macro
common: spl: Add interactive DDR debugger support for SPL
arm: ls102xa: Add SD boot support for LS1021AQDS board
arm: ls102xa: Add SD boot support for LS1021ATWR board

 Makefile                                      | 21 +++++++++++++++++++--
 arch/arm/cpu/armv7/ls102xa/Makefile           |  1 +
 arch/arm/cpu/armv7/ls102xa/spl.c              | 35 +++++++++++++++++++++++++++++++++++
 arch/arm/cpu/armv7/ls102xa/u-boot-spl.lds     | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 arch/arm/include/asm/arch-ls102xa/spl.h       | 20 ++++++++++++++++++++
 board/freescale/common/qixis.h                |  7 +++++++
 board/freescale/ls1021aqds/MAINTAINERS        |  1 +
 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/MAINTAINERS        |  1 +
 board/freescale/ls1021atwr/ls1021atwr.c       | 31 ++++++++++++++++++++++++++++++-
 board/freescale/ls1021atwr/ls102xa_pbi.cfg    | 13 +++++++++++++
 board/freescale/ls1021atwr/ls102xa_rcw_sd.cfg | 14 ++++++++++++++
 common/Makefile                               | 19 ++++++++++---------
 configs/ls1021aqds_sdcard_defconfig           |  4 ++++
 configs/ls1021atwr_sdcard_defconfig           |  4 ++++
 include/configs/ls1021aqds.h                  | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 include/configs/ls1021atwr.h                  | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 tools/pblimage.c                              | 20 ++++++++++++++++----
 21 files changed, 440 insertions(+), 17 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
 create mode 100644 configs/ls1021aqds_sdcard_defconfig
 create mode 100644 configs/ls1021atwr_sdcard_defconfig
#1 lore raw

PATCH 1/7 spl: pbl: Add new SPL image for pblimage tool

For the pblimage tool, the SPL image is splitted into 64 byte chunks, and PBL needs a command for each piece. In current pblimage structure, the size of the SPL image should be a fixed value. Well, for LS102xA and some other ARM platforms, the size of the SPL image is changeable. So a new image spl/u-boot-spl-pbl-pad.bin is built, and the size of it is a fixed value "CONFIG_SPL_MAX_SIZE". Use it instead of spl/u-boot-spl.bin for LS102xA.

CONFIG_SPL_PBL_PAD is used to enable this function.

---
 Makefile | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
Makefile +16 -1
index 1fccd0b..6af424e 100644
@@ -730,6 +730,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
@@ -774,6 +775,8 @@ cmd_cat = cat $(filter-out $(PHONY), $^) > $@
 
 append = cat $(filter-out $< $(PHONY), $^) >> $@
 
+cmd_pad = $(cmd_objcopy)
+
 quiet_cmd_pad_cat = CAT     $@
 cmd_pad_cat = $(cmd_objcopy) && $(append) || rm -f $@
 
@@ -962,15 +965,27 @@ endif
 u-boot-img.bin: spl/u-boot-spl.bin u-boot.img FORCE
 	$(call if_changed,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-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)
+
 OBJCOPYFLAGS_u-boot-with-spl-pbl.bin = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO) \
 			  --gap-fill=0xff
 
Signature · 1 line
1.8.0
#2 lore raw

PATCH 1/7 spl: pbl: Add new SPL image for pblimage tool

Hi Alison,

Quoted 8 lines · Alison Wang

For the pblimage tool, the SPL image is splitted into 64 byte chunks, and PBL needs a command for each piece. In current pblimage structure, the size of the SPL image should be a fixed value. Well, for LS102xA and some other ARM platforms, the size of the SPL image is changeable. So a new image spl/u-boot-spl-pbl-pad.bin is built, and the size of it is a fixed value "CONFIG_SPL_MAX_SIZE". Use it instead of spl/u-boot-spl.bin for LS102xA.

Quoted 4 lines

CONFIG_SPL_PBL_PAD is used to enable this function.

---

There is already a CONFIG_SPL_PAD_TO (see ./README). Can you not use this?

Amicalement,

Signature · 1 line
Albert.
#3 lore raw

PATCH 1/7 spl: pbl: Add new SPL image for pblimage tool

Hi, Albert,

Quoted 12 lines
Quoted 5 lines · Alison Wang

For the pblimage tool, the SPL image is splitted into 64 byte chunks, and PBL needs a command for each piece. In current pblimage structure, the size of the SPL image should be a fixed value. Well, for LS102xA and some other ARM platforms, the size of the SPL image is changeable. So a new image spl/u-boot-spl-pbl-pad.bin is built, and the size of

it

Quoted 3 lines

is a fixed value "CONFIG_SPL_MAX_SIZE". Use it instead of spl/u-boot-spl.bin for LS102xA.

Quoted 8 lines
Quoted 4 lines

CONFIG_SPL_PBL_PAD is used to enable this function.

---

There is already a CONFIG_SPL_PAD_TO (see ./README). Can you not use this?

[Alison Wang] I have already used CONFIG_SPL_PAD_TO to determine the offset to which u-boot-spl.pbl should be padded when generating u-boot-with-spl-pbl.bin. Well, I used CONFIG_SPL_MAX_SIZE to determine the size of u-boot-spl-pbl-pad.bin. u-boot-spl-pbl-pad.bin is generated by padding u-boot-spl.bin to CONFIG_SPL_MAX_SIZE.

Best Regards,
Alison Wang

#4 lore raw

PATCH 1/7 spl: pbl: Add new SPL image for pblimage tool

Hi Huan,

Quoted 21 lines · Huan Wang

Hi, Albert,

Quoted 19 lines
Quoted 5 lines · Alison Wang

For the pblimage tool, the SPL image is splitted into 64 byte chunks, and PBL needs a command for each piece. In current pblimage structure, the size of the SPL image should be a fixed value. Well, for LS102xA and some other ARM platforms, the size of the SPL image is changeable. So a new image spl/u-boot-spl-pbl-pad.bin is built, and the size of

it

Quoted 7 lines

is a fixed value "CONFIG_SPL_MAX_SIZE". Use it instead of spl/u-boot-spl.bin for LS102xA.

CONFIG_SPL_PBL_PAD is used to enable this function.

---

There is already a CONFIG_SPL_PAD_TO (see ./README). Can you not use this?

(BTW, thanks for fixing the way your mailer quotes. That's much more readable to me.)

Quoted 1 line

[Alison Wang] I have already used CONFIG_SPL_PAD_TO to determine the offset to which u-boot-spl.pbl should be padded when generating u-boot-with-spl-pbl.bin. Well, I used CONFIG_SPL_MAX_SIZE to determine the size of u-boot-spl-pbl-pad.bin. u-boot-spl-pbl-pad.bin is generated by padding u-boot-spl.bin to CONFIG_SPL_MAX_SIZE.

I'm still lost. Can you summarize the sequence of operations performed, starting from the u-boot SPL elf file, and on each step indicate which file is produced and which config option(s) from CONFIG_SPL_[PBL_]{PAD_TO,MAX_SIZE} is(are) involved and why?

Also, in any case, if CONFIG_SPL_PBL_PAD is needed then it must be added to README with its description.

Quoted 2 lines

Best Regards,
Alison Wang

Amicalement,

Signature · 1 line
Albert.
#5 lore raw

PATCH 1/7 spl: pbl: Add new SPL image for pblimage tool

Hi, Albert,

Quoted 20 lines
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines · Alison Wang

For the pblimage tool, the SPL image is splitted into 64 byte chunks, and PBL needs a command for each piece. In current pblimage structure, the size of the SPL image should be a fixed value. Well, for LS102xA and some other ARM platforms, the size

of the SPL image is changeable.

Quoted 11 lines
Quoted 11 lines
Quoted 2 lines

So a new image spl/u-boot-spl-pbl-pad.bin is built, and the size of

it

Quoted 7 lines

is a fixed value "CONFIG_SPL_MAX_SIZE". Use it instead of spl/u-boot-spl.bin for LS102xA.

CONFIG_SPL_PBL_PAD is used to enable this function.

---

Quoted 6 lines
Quoted 1 line
Quoted 1 line

There is already a CONFIG_SPL_PAD_TO (see ./README). Can you not

use

Quoted 1 line
Quoted 1 line

this?

(BTW, thanks for fixing the way your mailer quotes. That's much more readable to me.)

[Alison Wang] You are welcome. :)

Quoted 11 lines
Quoted 2 lines

[Alison Wang] I have already used CONFIG_SPL_PAD_TO to determine the

offset to which u-boot-spl.pbl should be padded when generating u-boot- with-spl-pbl.bin. Well, I used CONFIG_SPL_MAX_SIZE to determine the size of u-boot-spl-pbl-pad.bin. u-boot-spl-pbl-pad.bin is generated by padding u-boot-spl.bin to CONFIG_SPL_MAX_SIZE.

I'm still lost. Can you summarize the sequence of operations performed, starting from the u-boot SPL elf file, and on each step indicate which file is produced and which config option(s) from CONFIG_SPL_[PBL_]{PAD_TO,MAX_SIZE} is(are) involved and why?

[Alison Wang] Let me explain the sequence.

1. u-boot-spl.bin is produced. The size of it is not a fixed value.

2. u-boot-spl-pbl-pad.bin is produced. The size of it is defined by CONFIG_SPL_MAX_SIZE. For detail, u-boot-spl-pbl-pad.bin is generated by padding u-boot-spl.bin to the size of CONFIG_SPL_MAX_SIZE.

The following is the reason for using u-boot-spl-pbl-pad.bin.

First of all, the SPL part need to be reorganized for the recognition of PBL through the pblimage tool.

For the pblimage tool, the SPL image is splitted into 64 byte chunks, and PBL needs a command for each piece. In current pblimage tool, the size of the SPL image(u-boot-spl.bin) should be a fixed value like PowerPC. Well, for LS102xA and some other ARM platforms, the size of the SPL image (u-boot-spl.bin) is changeable. So a new image spl/u-boot-spl-pbl-pad.bin is produced, and the size of it is a fixed value "CONFIG_SPL_MAX_SIZE". Then use u-boot-spl-pbl-pad.bin instead of spl/u-boot-spl.bin to generate spl/u-boot-spl.pbl.

3. spl/u-boot-spl.pbl is produced through pblimage tool. As CONFIG_SPL_PBL_PAD is enabled, spl/u-boot-spl-pbl-pad.bin is used as the source file instead of spl/u-boot-spl.bin.

4. u-boot-with-spl-pbl.bin is produced. For detail, u-boot-with-spl-pbl.bin is generated by padding spl/u-boot-spl.pbl to the offset of CONFIG_SPL_PAD_TO and adding u-boot.img.

As the size of spl/u-boot-spl.pbl is not a fixed value, we pad it to the offset of CONFIG_SPL_PAD_TO. So it is convenient for us to determine the location of u-boot.img in SD card.

Quoted 4 lines

Also, in any case, if CONFIG_SPL_PBL_PAD is needed then it must be added to README with its description.

[Alison Wang] Yes, I will add it in v2.

Thanks.

Best Regards,
Alison Wang

#6 lore raw

PATCH 1/7 spl: pbl: Add new SPL image for pblimage tool

Quoted 27 lines · On 09/21/2014 11:17 PM, Wang Huan-B18965 wrote:

[Alison Wang] Let me explain the sequence.

1. u-boot-spl.bin is produced. The size of it is not a fixed value.

2. u-boot-spl-pbl-pad.bin is produced. The size of it is defined by CONFIG_SPL_MAX_SIZE. For detail, u-boot-spl-pbl-pad.bin is generated by padding u-boot-spl.bin to the size of CONFIG_SPL_MAX_SIZE.

The following is the reason for using u-boot-spl-pbl-pad.bin.

First of all, the SPL part need to be reorganized for the recognition of PBL through the pblimage tool.

For the pblimage tool, the SPL image is splitted into 64 byte chunks, and PBL needs a command for each piece. In current pblimage tool, the size of the SPL image(u-boot-spl.bin) should be a fixed value like PowerPC. Well, for LS102xA and some other ARM platforms, the size of the SPL image (u-boot-spl.bin) is changeable. So a new image spl/u-boot-spl-pbl-pad.bin is produced, and the size of it is a fixed value "CONFIG_SPL_MAX_SIZE". Then use u-boot-spl-pbl-pad.bin instead of spl/u-boot-spl.bin to generate spl/u-boot-spl.pbl.

3. spl/u-boot-spl.pbl is produced through pblimage tool. As CONFIG_SPL_PBL_PAD is enabled, spl/u-boot-spl-pbl-pad.bin is used as the source file instead of spl/u-boot-spl.bin.

Quoted 8 lines

4. u-boot-with-spl-pbl.bin is produced. For detail, u-boot-with-spl-pbl.bin is generated by padding spl/u-boot-spl.pbl to the offset of CONFIG_SPL_PAD_TO and adding u-boot.img.

As the size of spl/u-boot-spl.pbl is not a fixed value, we pad it to the offset of CONFIG_SPL_PAD_TO. So it is convenient for us to determine the location of u-boot.img in SD card.

Sorry for the late respond. I was away for an urgent project.

If I understand you correctly, you define a CONFIG_SPL_MAX_SIZE and pad the final binary file to this size. How do you determine the size? I understand PBL loading mechanism. Would it be possible to pad to 64 byte boundary (or any practical size since it is adjustable) and avoid the definition of CONFIG_SPL_MAX_SIZE?

York

#7 lore raw

PATCH 1/7 spl: pbl: Add new SPL image for pblimage tool

Hi, York,

Quoted 37 lines · On 09/21/2014 11:17 PM, Wang Huan-B18965 wrote:
Quoted 27 lines

[Alison Wang] Let me explain the sequence.

1. u-boot-spl.bin is produced. The size of it is not a fixed value.

2. u-boot-spl-pbl-pad.bin is produced. The size of it is defined by CONFIG_SPL_MAX_SIZE. For detail, u-boot-spl-pbl-pad.bin is generated by padding u-boot-spl.bin to the size of CONFIG_SPL_MAX_SIZE.

The following is the reason for using u-boot-spl-pbl-pad.bin.

First of all, the SPL part need to be reorganized for the recognition of PBL through the pblimage tool.

For the pblimage tool, the SPL image is splitted into 64 byte chunks, and PBL needs a command for each piece. In current pblimage tool, the size of the SPL image(u-boot-spl.bin) should be a fixed value like PowerPC. Well, for LS102xA and some other ARM platforms, the size of the SPL image (u-boot-spl.bin) is changeable. So a new image spl/u-boot-spl-pbl-pad.bin is produced, and the size of it is a fixed value "CONFIG_SPL_MAX_SIZE". Then use u-boot-spl-pbl-pad.bin instead of spl/u-boot-spl.bin to generate spl/u-boot-spl.pbl.

3. spl/u-boot-spl.pbl is produced through pblimage tool. As CONFIG_SPL_PBL_PAD is enabled, spl/u-boot-spl-pbl-pad.bin is used as the source file instead of spl/u-boot-spl.bin.

Quoted 8 lines

4. u-boot-with-spl-pbl.bin is produced. For detail, u-boot-with-spl-pbl.bin is generated by padding spl/u-boot-spl.pbl to the offset of CONFIG_SPL_PAD_TO and adding u-boot.img.

As the size of spl/u-boot-spl.pbl is not a fixed value, we pad it to the offset of CONFIG_SPL_PAD_TO. So it is convenient for us to determine the location of u-boot.img in SD card.

Quoted 7 lines

Sorry for the late respond. I was away for an urgent project.

If I understand you correctly, you define a CONFIG_SPL_MAX_SIZE and pad the final binary file to this size. How do you determine the size? I understand PBL loading mechanism. Would it be possible to pad to 64 byte boundary (or any practical size since it is adjustable) and avoid the definition of CONFIG_SPL_MAX_SIZE?

[Alison Wang] I checked the size of spl/u-boot-spl.bin, then determined CONFIG_SPL_MAX_SIZE which is larger than the size of spl/u-boot-spl.bin. For Pblimage tool, the size of SPL image need to be a fixed value. For example, for PowerPC, no matter how the SPL code is changed, the size of spl/u-boot-spl.bin is always 0x28000 (so the "pbl_cmd_initaddr" is always 0x82000000). But for LS1, the size of spl/u-boot-spl.bin is not a fixed size. When the SPL code is changed, the size of spl/u-boot-spl.bin is changed, so "pbl_cmd_initaddr" is changed too. It's unacceptable for pblimage tool("pbl_cmd_initaddr" need to be a fixed value). To fix this issue, I use CONFIG_SPL_MAX_SIZE.

Do you mean there is some approach to pad spl/u-boot-spl.bin to any practical size and avoid the definition of CONFIG_SPL_MAX_SIZE?

Best Regards,
Alison Wang

#8 lore raw

PATCH 1/7 spl: pbl: Add new SPL image for pblimage tool

Alison,

Quoted 60 lines · On 9/22/14 7:43 PM, "Wang Huan-B18965" <[email protected]> wrote:

Hi, York,

Quoted 37 lines · On 09/21/2014 11:17 PM, Wang Huan-B18965 wrote:
Quoted 27 lines

[Alison Wang] Let me explain the sequence.

1. u-boot-spl.bin is produced. The size of it is not a fixed value.

2. u-boot-spl-pbl-pad.bin is produced. The size of it is defined by CONFIG_SPL_MAX_SIZE. For detail, u-boot-spl-pbl-pad.bin is generated by padding u-boot-spl.bin to the size of CONFIG_SPL_MAX_SIZE.

The following is the reason for using u-boot-spl-pbl-pad.bin.

First of all, the SPL part need to be reorganized for the recognition of PBL through the pblimage tool.

For the pblimage tool, the SPL image is splitted into 64 byte chunks, and PBL needs a command for each piece. In current pblimage tool, the size of the SPL image(u-boot-spl.bin) should be a fixed value like PowerPC. Well, for LS102xA and some other ARM platforms, the size of the SPL image (u-boot-spl.bin) is changeable. So a new image spl/u-boot-spl-pbl-pad.bin is produced, and the size of it is a fixed value "CONFIG_SPL_MAX_SIZE". Then use u-boot-spl-pbl-pad.bin instead of spl/u-boot-spl.bin to generate spl/u-boot-spl.pbl.

3. spl/u-boot-spl.pbl is produced through pblimage tool. As CONFIG_SPL_PBL_PAD is enabled, spl/u-boot-spl-pbl-pad.bin is used as the source file instead of spl/u-boot-spl.bin.

Quoted 8 lines

4. u-boot-with-spl-pbl.bin is produced. For detail, u-boot-with-spl-pbl.bin is generated by padding spl/u-boot-spl.pbl to the offset of CONFIG_SPL_PAD_TO and adding u-boot.img.

As the size of spl/u-boot-spl.pbl is not a fixed value, we pad it to the offset of CONFIG_SPL_PAD_TO. So it is convenient for us to determine the location of u-boot.img in SD card.

Quoted 7 lines

Sorry for the late respond. I was away for an urgent project.

If I understand you correctly, you define a CONFIG_SPL_MAX_SIZE and pad the final binary file to this size. How do you determine the size? I understand PBL loading mechanism. Would it be possible to pad to 64 byte boundary (or any practical size since it is adjustable) and avoid the definition of CONFIG_SPL_MAX_SIZE?

[Alison Wang] I checked the size of spl/u-boot-spl.bin, then determined CONFIG_SPL_MAX_SIZE which is larger than the size of spl/u-boot-spl.bin. For Pblimage tool, the size of SPL image need to be a fixed value. For example, for PowerPC, no matter how the SPL code is changed, the size of spl/u-boot-spl.bin is always 0x28000 (so the "pbl_cmd_initaddr" is always 0x82000000). But for LS1, the size of spl/u-boot-spl.bin is not a fixed size. When the SPL code is changed, the size of spl/u-boot-spl.bin is changed, so "pbl_cmd_initaddr" is changed too. It's unacceptable for pblimage
tool("pbl_cmd_initaddr" need to be a fixed value). To fix this issue, I use
CONFIG_SPL_MAX_SIZE.

Quoted 2 lines

Do you mean there is some approach to pad spl/u-boot-spl.bin to any practical size and avoid the definition of CONFIG_SPL_MAX_SIZE?

PBL image is created this way

A) Create the RCW header
B) Determine u-boot image size
C) Subtract the size from top of 24-bit space, that's what you see 0x82000000-size. The magic number 0x82000000 is used to make the result as 0x81xxxxxx. The highest of 0x8 is ACS=1, the lowest bit of 0x81 is CONTINUE=1, the xxxxxx is the 24-bit offset. By changing the offset, you can load the data into memory, up to 64 byte a time. By making a lot of 0x81xxxxxx, you make a sequence of commands to load 64 byte a time, until all image is loaded.

Given the above mechanism, do you still think the image has to be a fixed size? I think you need to adjust pblimage.c to deal with the variable size, and pad the last chunk to be aligned with 2^n byte.

York

#9 lore raw

PATCH 1/7 spl: pbl: Add new SPL image for pblimage tool

Hi, York,

Quoted 85 lines
Quoted 9 lines · On 9/22/14 7:43 PM, "Wang Huan-B18965" <[email protected]> wrote:

Hi, York,

Quoted 7 lines · On 09/21/2014 11:17 PM, Wang Huan-B18965 wrote:
Quoted 6 lines

[Alison Wang] Let me explain the sequence.

1. u-boot-spl.bin is produced. The size of it is not a fixed value.

2. u-boot-spl-pbl-pad.bin is produced. The size of it is defined

by

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

CONFIG_SPL_MAX_SIZE. For detail, u-boot-spl-pbl-pad.bin is generated by padding u-boot-spl.bin to the size of

CONFIG_SPL_MAX_SIZE.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

The following is the reason for using u-boot-spl-pbl-pad.bin.

First of all, the SPL part need to be reorganized for the recognition of PBL through the pblimage tool.

For the pblimage tool, the SPL image is splitted into 64 byte chunks, and PBL needs a command for each piece. In current

pblimage

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

tool, the size of the SPL image(u-boot-spl.bin) should be a fixed value like PowerPC. Well, for LS102xA and some other ARM platforms, the size of the SPL image (u-boot-spl.bin) is changeable. So a new image spl/u-boot-spl-pbl-pad.bin is produced, and the size of it

is

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

a fixed value "CONFIG_SPL_MAX_SIZE". Then use u-boot-spl-pbl-pad.bin instead of spl/u-boot-spl.bin to generate

spl/u-boot-spl.pbl.

Quoted 14 lines
Quoted 14 lines
Quoted 13 lines

3. spl/u-boot-spl.pbl is produced through pblimage tool. As CONFIG_SPL_PBL_PAD is enabled, spl/u-boot-spl-pbl-pad.bin is used as the source file instead of spl/u-boot-spl.bin.

4. u-boot-with-spl-pbl.bin is produced. For detail, u-boot-with-spl-pbl.bin is generated by padding spl/u-boot-spl.pbl to the offset of CONFIG_SPL_PAD_TO and adding u-boot.img.

As the size of spl/u-boot-spl.pbl is not a fixed value, we pad it to the offset of CONFIG_SPL_PAD_TO. So it is convenient for us to determine the location of u-boot.img in SD card.

Quoted 5 lines
Quoted 5 lines

Sorry for the late respond. I was away for an urgent project.

If I understand you correctly, you define a CONFIG_SPL_MAX_SIZE and pad the final binary file to this size. How do you determine the size? I understand PBL loading mechanism. Would it be possible to

pad

Quoted 4 lines
Quoted 2 lines

to 64 byte boundary (or any practical size since it is adjustable) and avoid the definition of CONFIG_SPL_MAX_SIZE?

[Alison Wang] I checked the size of spl/u-boot-spl.bin, then

determined

Quoted 1 line

CONFIG_SPL_MAX_SIZE which is larger than the size of spl/u-boot-

spl.bin.

Quoted 3 lines

For Pblimage tool, the size of SPL image need to be a fixed value. For example, for PowerPC, no matter how the SPL code is changed, the size of spl/u-boot-spl.bin is always 0x28000 (so the

"pbl_cmd_initaddr"

Quoted 8 lines

is always 0x82000000). But for LS1, the size of spl/u-boot-spl.bin is not a fixed size. When the SPL code is changed, the size of spl/u-boot-spl.bin is changed, so "pbl_cmd_initaddr" is changed too. It's unacceptable for pblimage tool("pbl_cmd_initaddr" need to be a fixed value). To fix this issue, I use CONFIG_SPL_MAX_SIZE.

Do you mean there is some approach to pad spl/u-boot-spl.bin to any practical size and avoid the definition of CONFIG_SPL_MAX_SIZE?

PBL image is created this way

A) Create the RCW header
B) Determine u-boot image size
C) Subtract the size from top of 24-bit space, that's what you see 0x82000000-size. The magic number 0x82000000 is used to make the result as 0x81xxxxxx. The highest of 0x8 is ACS=1, the lowest bit of 0x81 is CONTINUE=1, the xxxxxx is the 24-bit offset. By changing the offset, you can load the data into memory, up to 64 byte a time. By making a lot of 0x81xxxxxx, you make a sequence of commands to load 64 byte a time, until all image is loaded.

Quoted 4 lines

Given the above mechanism, do you still think the image has to be a fixed size? I think you need to adjust pblimage.c to deal with the variable size, and pad the last chunk to be aligned with 2^n byte.

[Alison Wang] Yes, you are right. I will adjust pblimage.c to deal with the variable size in v2. The old approach to make it as a fixed size is not a good one.

Thanks.

Best Regards,
Alison Wang

#10 lore raw

PATCH 2/7 ls102xa: pblimage: Add pblimage tool support for LS102xA

In reply to Alison Wang

For LS102xA, the initialized next_pbl_cmd should be the sum of 0x81000000, the lower 24 bits of CONFIG_SPL_TEXT_BASE and CONFIG_SPL_MAX_SIZE(0x1a000). The sum is different from PowerPC. The PBI CRC command is different from PowerPC too.
In pblimage tool, add the support for the above two issues.

---
 tools/pblimage.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)
tools/pblimage.c +16 -4
index 6e6e801..152678b 100644
@@ -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 = 0x8101a000;
+		pbl_cmd_initaddr = 0x8101a000;
+		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
#11 lore raw

PATCH 2/7 ls102xa: pblimage: Add pblimage tool support for LS102xA

Hi Alison,

Quoted 45 lines · Alison Wang

For LS102xA, the initialized next_pbl_cmd should be the sum of 0x81000000, the lower 24 bits of CONFIG_SPL_TEXT_BASE and CONFIG_SPL_MAX_SIZE(0x1a000). The sum is different from PowerPC. The PBI CRC command is different from PowerPC too.
In pblimage tool, add the support for the above two issues.

---
 tools/pblimage.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)
tools/pblimage.c +6 -2
index 6e6e801..152678b 100644
@@ -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);
 	}

tools/pblimage.c static void pbl_parser(char *name) · line 124

Quoted 10 lines
tools/pblimage.c +7 -0
@@ -111,6 +115,14 @@ static void pbl_parser(char *name)
 	size_t len = 0;
 
 	fname = name;
+
+	if (strstr(fname, "ls102xa")) {
+		next_pbl_cmd = 0x8101a000;
+		pbl_cmd_initaddr = 0x8101a000;
+		pbi_crc_cmd1 = 0x61;
+		pbi_crc_cmd2 = 0;
+	}

Basing the tool's behaviour on the file name is not a good approach IMO. Can't we add some command line option to the tool to select the right set of values?

Quoted 4 lines
tools/pblimage.c +0 -0
 	fd = fopen(name, "r");
 	if (fd == NULL) {
 		printf("Error:%s - Can't open\n", fname);

tools/pblimage.c static void add_end_cmd(void) · line 191

Quoted 10 lines
tools/pblimage.c +2 -2
@@ -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;
 

Amicalement,

Signature · 1 line
Albert.
#12 lore raw

PATCH 2/7 ls102xa: pblimage: Add pblimage tool support for LS102xA

Hi, Albert,

Quoted 6 lines
Quoted 3 lines · Alison Wang
(quoted diff) +0 -0
@@ -111,6 +115,14 @@ static void pbl_parser(char *name)
 	size_t len = 0;
 
Quoted 12 lines

Review static void pbl_parser(char *name) · line 124

Quoted 8 lines
(quoted diff) +7 -0
 	fname = name;
+
+	if (strstr(fname, "ls102xa")) {
+		next_pbl_cmd = 0x8101a000;
+		pbl_cmd_initaddr = 0x8101a000;
+		pbi_crc_cmd1 = 0x61;
+		pbi_crc_cmd2 = 0;
+	}

Basing the tool's behaviour on the file name is not a good approach IMO. Can't we add some command line option to the tool to select the right set of values?

[Alison Wang] Yes, it is really not a good approach. How about this command line approach?

Makefile +6 -0
index d4a3899..db38112 100644
@@ -976,8 +976,14 @@ 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.
+ifdef CONFIG_SPL_PBL_PAD
+MKIMAGEFLAGS_u-boot-spl.pbl = -n $(srctree)/$(CONFIG_SYS_FSL_PBL_RCW:"%"=%) \
+               -R $(srctree)/$(CONFIG_SYS_FSL_PBL_PBI:"%"=%) -T pblimage \
+               -A $(ARCH) -a $(CONFIG_SPL_PBL_CMD_ADDR)
+else
 MKIMAGEFLAGS_u-boot-spl.pbl = -n $(srctree)/$(CONFIG_SYS_FSL_PBL_RCW:"%"=%) \
                -R $(srctree)/$(CONFIG_SYS_FSL_PBL_PBI:"%"=%) -T pblimage
+endif
 
include/configs/ls1021atwr.h +1 -0
index 191caef..4fd25ab 100644
@@ -60,6 +60,7 @@
 #define CONFIG_SPL_STACK               0x1001d000
 #define CONFIG_SPL_PAD_TO              0x1c000
 #define CONFIG_SYS_TEXT_BASE           0x82000000
+#define CONFIG_SPL_PBL_CMD_ADDR        0x8101a000
 
tools/pblimage.c+int pblimage_check_params(struct image_tool_params *params) renamed from tools/pblimage.c +0 -0
index 152678b..9eae0e4 100644

+{
+ if (!params)
+ return EXIT_FAILURE;
+
+ if (params->arch == IH_ARCH_ARM) {

+               pbi_crc_cmd1 = 0x61;
+               pbi_crc_cmd2 = 0;
+               pbl_cmd_initaddr = params->addr;
+               next_pbl_cmd = pbl_cmd_initaddr;

+ }
+
+ return 0;
+};
+
/* pblimage parameters */
static struct image_type_params pblimage_params = {

        .name           = "Freescale PBL Boot Image support",
        .header_size    = sizeof(struct pbl_header),
        .hdr            = (void *)&pblimage_header,

.check_image_type = pblimage_check_image_types,
+ .check_params = pblimage_check_params,
.verify_header = pblimage_verify_header,

Best Regards,
Alison Wang

#13 lore raw

[U-Boot] [OT] Re: [PATCH 2/7] ls102xa: pblimage: Add pblimage tool support for LS102xA

Hi Huan,

Quoted 21 lines · Huan Wang

Hi, Albert,

Quoted 6 lines
Quoted 3 lines · Alison Wang
(quoted diff) +0 -0
@@ -111,6 +115,14 @@ static void pbl_parser(char *name)
 	size_t len = 0;
 
Quoted 12 lines

Review static void pbl_parser(char *name) · line 124

Quoted 8 lines
(quoted diff) +7 -0
 	fname = name;
+
+	if (strstr(fname, "ls102xa")) {
+		next_pbl_cmd = 0x8101a000;
+		pbl_cmd_initaddr = 0x8101a000;
+		pbi_crc_cmd1 = 0x61;
+		pbi_crc_cmd2 = 0;
+	}

Basing the tool's behaviour on the file name is not a good approach IMO. Can't we add some command line option to the tool to select the right set of values?

Quoted 3 lines

[Alison Wang] Yes, it is really not a good approach. How about this command line approach?

[copy-paste of a diff follows]

Please do not paste entire diffs in mails to the U-Boot Mailing list unless you are actually submitting them as a patch. When Patchwork sees a diff in a mail, it creates a new patch entry. Here, your diff made Patchwork create a second entry for patch 2/7 at

	<http://patchwork.ozlabs.org/patch/391796/>

I have manually marked it as "Not Applicable".

Amicalement,

Signature · 1 line
Albert.
#14 lore raw

[U-Boot] [OT] Re: [PATCH 2/7] ls102xa: pblimage: Add pblimage tool support for LS102xA

Hi, Albert,

Quoted 31 lines
Quoted 19 lines · Huan Wang

Hi, Albert,

Quoted 17 lines

Review static void pbl_parser(char *name) · line 124

Quoted 11 lines · Alison Wang
(quoted diff) +7 -0
@@ -111,6 +115,14 @@ static void pbl_parser(char *name)
 	size_t len = 0;
 
 	fname = name;
+
+	if (strstr(fname, "ls102xa")) {
+		next_pbl_cmd = 0x8101a000;
+		pbl_cmd_initaddr = 0x8101a000;
+		pbi_crc_cmd1 = 0x61;
+		pbi_crc_cmd2 = 0;
+	}

Basing the tool's behaviour on the file name is not a good approach

IMO.

Quoted 4 lines
Quoted 2 lines

Can't we add some command line option to the tool to select the right set of values?

[Alison Wang] Yes, it is really not a good approach. How about this

command line approach?

Quoted 2 lines

[copy-paste of a diff follows]

Quoted 9 lines

Please do not paste entire diffs in mails to the U-Boot Mailing list unless you are actually submitting them as a patch. When Patchwork sees a diff in a mail, it creates a new patch entry. Here, your diff made Patchwork create a second entry for patch 2/7 at

	<http://patchwork.ozlabs.org/patch/391796/>

I have manually marked it as "Not Applicable".

[Alison Wang] Sorry. Thanks for the reminder.

Best Regards,
Alison Wang

#15 lore raw

PATCH 3/7 spl: Use u-boot.img instead of u-boot.bin when CONFIG_SPL_PBL_PAD is enabled

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 building u-boot-with-spl-pbl.bin.

---
 Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Makefile +3 -1
index 6af424e..d4a3899 100644
@@ -967,8 +967,10 @@ u-boot-img.bin: spl/u-boot-spl.bin u-boot.img FORCE
 
 ifdef CONFIG_SPL_PBL_PAD
 SPLPBL_BINLOAD := spl/u-boot-spl-pbl-pad.bin
+UBOOT_BINLOAD := u-boot.img
 else
 SPLPBL_BINLOAD := spl/u-boot-spl.bin
+UBOOT_BINLOAD := u-boot.bin
 endif
 
 #Add a target to create boot binary having SPL binary in PBI format
@@ -989,7 +991,7 @@ spl/u-boot-spl-pbl-pad.bin: spl/u-boot-spl.bin FORCE
 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
1.8.0
#16 lore raw

PATCH 4/7 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.

---
 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
1.8.0
#17 lore raw

PATCH 5/7 common: spl: Add interactive DDR debugger support for SPL

In reply to Alison Wang

For LS102xA, interactive DDR debugger is still needed in SPL part. So build the needed files in SPL image too.

---
 common/Makefile | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)
common/Makefile +10 -9
index aca0f7f..5f7bf49 100644
@@ -15,15 +15,6 @@ 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
@@ -264,4 +255,14 @@ obj-$(CONFIG_IO_TRACE) += iotrace.o
 obj-y += memsize.o
 obj-y += stdio.o
 
+# 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
1.8.0
#18 lore raw

PATCH 6/7 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.

---
 arch/arm/cpu/armv7/ls102xa/Makefile           |  1 +
 arch/arm/cpu/armv7/ls102xa/spl.c              | 35 +++++++++++
 arch/arm/cpu/armv7/ls102xa/u-boot-spl.lds     | 89 +++++++++++++++++++++++++++
 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    |  8 +++
 board/freescale/ls1021aqds/ls102xa_rcw_sd.cfg | 14 +++++
 configs/ls1021aqds_sdcard_defconfig           |  4 ++
 include/configs/ls1021aqds.h                  | 67 ++++++++++++++++++++
 11 files changed, 274 insertions(+), 1 deletion(-)
 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 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 +35 -0
new file mode 100644
index 0000000..77ea1ee
@@ -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 +89 -0

89 lines not on this page · raw message

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 021d82b..9244057 100644
@@ -4,3 +4,4 @@ S:	Maintained
 F:	board/freescale/ls1021aqds/
 F:	include/configs/ls1021aqds.h
 F:	configs/ls1021aqds_nor_defconfig
+F:	configs/ls1021aqds_sdcard_defconfig
board/freescale/ls1021aqds/ddr.c +4 -1
index 679c654..369088e 100644
@@ -146,9 +146,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 12e83f7..85a53c9 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));
@@ -155,6 +160,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 +8 -0
new file mode 100644
index 0000000..edf9f94
@@ -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
new file mode 100644
index 0000000..e05ec16
@@ -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
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 +67 -0

111 lines not on this page · raw message

Signature · 1 line
1.8.0
#19 lore raw

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

Hi Alison,

Quoted 112 lines · 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.

---
 arch/arm/cpu/armv7/ls102xa/Makefile           |  1 +
 arch/arm/cpu/armv7/ls102xa/spl.c              | 35 +++++++++++
 arch/arm/cpu/armv7/ls102xa/u-boot-spl.lds     | 89 +++++++++++++++++++++++++++
 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    |  8 +++
 board/freescale/ls1021aqds/ls102xa_rcw_sd.cfg | 14 +++++
 configs/ls1021aqds_sdcard_defconfig           |  4 ++
 include/configs/ls1021aqds.h                  | 67 ++++++++++++++++++++
 11 files changed, 274 insertions(+), 1 deletion(-)
 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 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 +35 -0
new file mode 100644
index 0000000..77ea1ee
@@ -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 +29 -0
new file mode 100644
index 0000000..10671e7
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2004-2008 Texas Instruments
+ *
+ * (C) Copyright 2002
+ * Gary Jennejohn, DENX Software Engineering, <[email protected]>
+ *
+ * Copyright 2014 Freescale Semiconductor, Inc.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
+OUTPUT_ARCH(arm)
+ENTRY(_start)
+SECTIONS
+{
+	. = 0x00000000;
+
+	. = ALIGN(4);
+	.text :
+	{
+		__image_copy_start = .;
+		*(.vectors)
+		CPUDIR/start.o (.text*)
+		*(.text*)
+	}
+
+	. = ALIGN(4);
+	.rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) }

arch/arm/cpu/armv7/ls102xa/u-boot-spl.lds line 39

Quoted 10 lines
arch/arm/cpu/armv7/ls102xa/u-boot-spl.lds new file +10 -0
+
+	. = ALIGN(4);
+	.data : {
+		*(.data*)
+	}
+
+	. = ALIGN(4);
+	.u_boot_list : {
+		KEEP(*(SORT(.u_boot_list*_i2c_*)));
+	}

IS this required? And if it is, could it not be added to the arch/arm/cpu/u-boot-spl.lds file? This way you would not need an .lds file at all.

Quoted 323 lines
arch/arm/cpu/armv7/ls102xa/u-boot-spl.lds new file +49 -0
+	. = .;
+
+	__image_copy_end = .;
+
+	.rel.dyn : {
+		__rel_dyn_start = .;
+		*(.rel*)
+		__rel_dyn_end = .;
+	}
+
+	.end :
+	{
+		*(.__end)
+	}
+
+	_image_binary_end = .;
+
+	.bss __rel_dyn_start (OVERLAY) : {
+		__bss_start = .;
+		*(.bss*)
+		 . = ALIGN(4);
+		__bss_end = .;
+	}
+
+	.dynsym _image_binary_end : { *(.dynsym) }
+	.dynbss : { *(.dynbss) }
+	.dynstr : { *(.dynstr*) }
+	.dynamic : { *(.dynamic*) }
+	.hash : { *(.hash*) }
+	.plt : { *(.plt*) }
+	.interp : { *(.interp*) }
+	.gnu : { *(.gnu*) }
+	.ARM.exidx : { *(.ARM.exidx*) }
+}
+
+#if defined(CONFIG_SPL_MAX_SIZE)
+ASSERT(__image_copy_end - __image_copy_start < (CONFIG_SPL_MAX_SIZE), \
+	"SPL image too big");
+#endif
+
+#if defined(CONFIG_SPL_BSS_MAX_SIZE)
+ASSERT(__bss_end - __bss_start < (CONFIG_SPL_BSS_MAX_SIZE), \
+	"SPL image BSS too big");
+#endif
+
+#if defined(CONFIG_SPL_MAX_FOOTPRINT)
+ASSERT(__bss_end - _start < (CONFIG_SPL_MAX_FOOTPRINT), \
+	"SPL image plus BSS too big");
+#endif
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 021d82b..9244057 100644
@@ -4,3 +4,4 @@ S:	Maintained
 F:	board/freescale/ls1021aqds/
 F:	include/configs/ls1021aqds.h
 F:	configs/ls1021aqds_nor_defconfig
+F:	configs/ls1021aqds_sdcard_defconfig
board/freescale/ls1021aqds/ddr.c +4 -1
index 679c654..369088e 100644
@@ -146,9 +146,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 12e83f7..85a53c9 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));
@@ -155,6 +160,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 +8 -0
new file mode 100644
index 0000000..edf9f94
@@ -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
new file mode 100644
index 0000000..e05ec16
@@ -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
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 +64 -0
index 657e3b6..440c118 100644
@@ -37,8 +37,48 @@ unsigned long get_board_sys_clk(void);
 unsigned long get_board_ddr_clk(void);
 #endif
 
+#if defined(CONFIG_SD_BOOT) || defined(CONFIG_QSPI_BOOT)
+#define CONFIG_SYS_CLK_FREQ            100000000
+#define CONFIG_DDR_CLK_FREQ            100000000
+#define CONFIG_QIXIS_I2C_ACCESS
+#else
 #define CONFIG_SYS_CLK_FREQ		get_board_sys_clk()
 #define CONFIG_DDR_CLK_FREQ		get_board_ddr_clk()
+#endif
+
+#ifdef CONFIG_RAMBOOT_PBL
+#define CONFIG_SYS_FSL_PBL_PBI	board/freescale/ls1021aqds/ls102xa_pbi.cfg
+#endif
+
+#ifdef CONFIG_SD_BOOT
+#define CONFIG_SYS_FSL_PBL_RCW	board/freescale/ls1021aqds/ls102xa_rcw_sd.cfg
+#define CONFIG_SPL_PBL_PAD
+#define CONFIG_SPL_FRAMEWORK
+#define CONFIG_SPL_LDSCRIPT	"arch/arm/cpu/armv7/ls102xa/u-boot-spl.lds"
+#define CONFIG_SPL_LIBCOMMON_SUPPORT
+#define CONFIG_SPL_LIBGENERIC_SUPPORT
+#define CONFIG_SPL_ENV_SUPPORT
+#define CONFIG_SPL_MPC8XXX_INIT_DDR_SUPPORT
+#define CONFIG_SPL_I2C_SUPPORT
+#define CONFIG_SPL_WATCHDOG_SUPPORT
+#define CONFIG_SPL_SERIAL_SUPPORT
+#define CONFIG_SPL_MMC_SUPPORT
+#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR		0xe8
+#define CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS		0x400
+
+#define CONFIG_SPL_TEXT_BASE		0x10000000
+#define CONFIG_SPL_MAX_SIZE		0x1a000
+#define CONFIG_SPL_STACK		0x1001d000
+#define CONFIG_SPL_PAD_TO		0x1c000
+#define CONFIG_SYS_TEXT_BASE		0x82000000
+
+#define CONFIG_SYS_SPL_MALLOC_START	0x80200000
+#define CONFIG_SYS_SPL_MALLOC_SIZE	0x100000
+#define CONFIG_SPL_BSS_START_ADDR	0x80100000
+#define CONFIG_SPL_BSS_MAX_SIZE		0x80000
+#define CONFIG_SYS_MONITOR_LEN		0x80000
+#define CONFIG_SYS_NO_FLASH
+#endif
 
 #ifndef CONFIG_SYS_TEXT_BASE
 #define CONFIG_SYS_TEXT_BASE		0x67f80000
@@ -70,6 +110,7 @@ unsigned long get_board_ddr_clk(void);
 /*
  * IFC Definitions
  */
+#if !defined(CONFIG_SD_BOOT) && !defined(CONFIG_QSPI_BOOT)
 #define CONFIG_FSL_IFC
 #define CONFIG_SYS_FLASH_BASE		0x60000000
 #define CONFIG_SYS_FLASH_BASE_PHYS	CONFIG_SYS_FLASH_BASE
@@ -161,6 +202,7 @@ unsigned long get_board_ddr_clk(void);
 #define CONFIG_CMD_NAND
 
 #define CONFIG_SYS_NAND_BLOCK_SIZE	(128 * 1024)
+#endif
 
 /*
  * QIXIS Definitions
@@ -322,7 +364,12 @@ unsigned long get_board_ddr_clk(void);
 
 #define CONFIG_CMDLINE_TAG
 #define CONFIG_CMDLINE_EDITING
+
+#if !defined(CONFIG_SD_BOOT) && !defined(CONFIG_QSPI_BOOT)
 #define CONFIG_CMD_IMLS
+#else
+#undef CONFIG_CMD_IMLS
+#endif
 
 #define CONFIG_HWCONFIG
 #define HWCONFIG_BUFFER_SIZE		128
@@ -370,17 +417,37 @@ unsigned long get_board_ddr_clk(void);
 #define CONFIG_SYS_INIT_SP_ADDR \
 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
 
+#ifdef CONFIG_SPL_BUILD
+#define CONFIG_SYS_MONITOR_BASE CONFIG_SPL_TEXT_BASE
+#else
 #define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE    /* start of monitor */
+#endif
 
 /*
  * Environment
  */
 #define CONFIG_ENV_OVERWRITE
 
+#if defined(CONFIG_SD_BOOT)
+#define CONFIG_ENV_OFFSET		(1024 * 1024)
+#define CONFIG_ENV_IS_IN_MMC
+#define CONFIG_SYS_MMC_ENV_DEV		0
+#define CONFIG_ENV_SIZE			0x2000
+#elif defined(CONFIG_NAND_BOOT)
+#define CONFIG_ENV_IS_IN_NAND
+#define CONFIG_ENV_SIZE			0x2000
+#define CONFIG_ENV_OFFSET		(10 * CONFIG_SYS_NAND_BLOCK_SIZE)
+#elif defined(CONFIG_QSPI_BOOT)
+#define CONFIG_ENV_IS_IN_SPI_FLASH
+#define CONFIG_ENV_SIZE			0x2000          /* 8KB */
+#define CONFIG_ENV_OFFSET		0x100000        /* 1MB */

include/configs/ls1021aqds.h unsigned long get_board_ddr_clk(void); · line 453

Quoted 10 lines
include/configs/ls1021aqds.h +3 -0
+#define CONFIG_ENV_SECT_SIZE		0x10000
+#else
 #define CONFIG_ENV_IS_IN_FLASH
 #define CONFIG_ENV_ADDR		(CONFIG_SYS_MONITOR_BASE - CONFIG_ENV_SECT_SIZE)
 #define CONFIG_ENV_SIZE			0x2000
 #define CONFIG_ENV_SECT_SIZE		0x20000 /* 128K (one sector) */
+#endif
 
 #define CONFIG_OF_LIBFDT
 #define CONFIG_OF_BOARD_SETUP

Amicalement,

Signature · 1 line
Albert.
#20 lore raw

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

Hi, Albert,

arch/arm/cpu/armv7/ls102xa/u-boot-spl.lds line 39

Quoted 5 lines · Alison Wang
arch/arm/cpu/armv7/ls102xa/u-boot-spl.lds new file +5 -0
+
+     . = ALIGN(4);
+     .u_boot_list : {
+             KEEP(*(SORT(.u_boot_list*_i2c_*)));
+     }

IS this required? And if it is, could it not be added to the arch/arm/cpu/u-boot-spl.lds file? This way you would not need an .lds file at all.

[Alison Wang] Yes, it is required. I would like to add it in arch/arm/cpu/u-boot-spl.lds. I was not sure adding it in arch/arm/cpu/u-boot-spl.lds is acceptable or not.

Alison

--
View this message in context: http://u-boot.10912.n7.nabble.com/PATCH-0-7-Add-SD-boot-support-for-LS1021AQDS-TWR-board-tp189678p189759.html
Sent from the U-Boot mailing list archive at Nabble.com.

#21 lore raw

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

In reply to Albert ARIBAUD

Hi, Albert,

Quoted 8 lines
Quoted 8 lines
arch/arm/cpu/armv7/ls102xa/u-boot-spl.lds new file +8 -0
+	. = ALIGN(4);
+	.rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) }
+
+	. = ALIGN(4);
+	.data : {
+		*(.data*)
+	}
+
Quoted 9 lines

arch/arm/cpu/armv7/ls102xa/u-boot-spl.lds line 39

Quoted 4 lines
arch/arm/cpu/armv7/ls102xa/u-boot-spl.lds new file +4 -0
+	. = ALIGN(4);
+	.u_boot_list : {
+		KEEP(*(SORT(.u_boot_list*_i2c_*)));
+	}

IS this required? And if it is, could it not be added to the arch/arm/cpu/u-boot-spl.lds file? This way you would not need an .lds file at all.

[Alison Wang] Yes, it is required. I would like to add it in arch/arm/cpu/u-boot-spl.lds. I was not sure adding it in arch/arm/cpu/u-boot-spl.lds is acceptable or not.

Best Regards,
Alison Wang

A message that is not in the archive (sent off-list or not yet received): [email protected]

#23 lore raw

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

Hi Huan,

Quoted 11 lines · Huan Wang

Hi, Albert,

arch/arm/cpu/armv7/ls102xa/u-boot-spl.lds line 39

Quoted 5 lines · Alison Wang
arch/arm/cpu/armv7/ls102xa/u-boot-spl.lds new file +5 -0
+
+     . = ALIGN(4);
+     .u_boot_list : {
+             KEEP(*(SORT(.u_boot_list*_i2c_*)));
+     }
Quoted 5 lines

IS this required? And if it is, could it not be added to the arch/arm/cpu/u-boot-spl.lds file? This way you would not need an .lds file at all.

[Alison Wang] Yes, it is required.

Ok -- what for? :)

Quoted 2 lines

I would like to add it in arch/arm/cpu/u-boot-spl.lds. I was not sure adding it in arch/arm/cpu/u-boot-spl.lds is acceptable or not.

(assuming the reason why it is needed is valid) If it causes no change to boards which do not use it right now (and I mean 'no change' ad 'binary identical') then this is acceptable. Make sure you check the binary invariance and that you mention it in the commit.

Quoted 2 lines

Best Regards,
Alison Wang

Amicalement,

Signature · 1 line
Albert.
#24 lore raw

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

Hi, Albert,

Quoted 9 lines
Quoted 9 lines
Quoted 5 lines · Alison Wang
arch/arm/cpu/armv7/ls102xa/u-boot-spl.lds new file +5 -0
+
+     . = ALIGN(4);
+     .u_boot_list : {
+             KEEP(*(SORT(.u_boot_list*_i2c_*)));
+     }
Quoted 7 lines
Quoted 5 lines

IS this required? And if it is, could it not be added to the arch/arm/cpu/u-boot-spl.lds file? This way you would not need an .lds file at all.

[Alison Wang] Yes, it is required.

Ok -- what for? :)

[Alison Wang] In SPL part, DDR is initialized by reading SPD through I2C interface. 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 I need to add this to make I2C work in SPL.

Quoted 9 lines
Quoted 3 lines

I would like to add it in arch/arm/cpu/u-boot-spl.lds. I was not sure adding it in arch/arm/cpu/u-boot-spl.lds is acceptable or not.

(assuming the reason why it is needed is valid) If it causes no change to boards which do not use it right now (and I mean 'no change' ad 'binary identical') then this is acceptable. Make sure you check the binary invariance and that you mention it in the commit.

[Alison Wang] It will cause the binary is not identical for other board. I think it may be not good to add in arch/arm/cpu/u-boot-spl.lds. What's your opinion about it?

Best Regards,
Alison Wang

#25 lore raw

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

Hi Huan,

Quoted 15 lines · Huan Wang

Hi, Albert,

Quoted 13 lines
Quoted 13 lines

arch/arm/cpu/armv7/ls102xa/u-boot-spl.lds line 39

Quoted 5 lines · Alison Wang
arch/arm/cpu/armv7/ls102xa/u-boot-spl.lds new file +5 -0
+
+     . = ALIGN(4);
+     .u_boot_list : {
+             KEEP(*(SORT(.u_boot_list*_i2c_*)));
+     }

IS this required? And if it is, could it not be added to the arch/arm/cpu/u-boot-spl.lds file? This way you would not need an .lds file at all.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

[Alison Wang] Yes, it is required.

Ok -- what for? :)

[Alison Wang] In SPL part, DDR is initialized by reading SPD through I2C interface. 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 I need to add this to make I2C work in SPL.

Understood. So your SPL code uses I2C, and for I2C, you need a linker list. But then:

Quoted 9 lines
Quoted 8 lines
Quoted 2 lines

I would like to add it in arch/arm/cpu/u-boot-spl.lds. I was not sure adding it in arch/arm/cpu/u-boot-spl.lds is acceptable or not.

(assuming the reason why it is needed is valid) If it causes no change to boards which do not use it right now (and I mean 'no change' ad 'binary identical') then this is acceptable. Make sure you check the binary invariance and that you mention it in the commit.

[Alison Wang] It will cause the binary is not identical for other board.

Is this a prediction or an actual observation of compared builds with and without the I2C linker liste addition to the generic SPL .lds?

Quoted 2 lines

I think
it may be not good to add in arch/arm/cpu/u-boot-spl.lds. What's your opinion about it?

If there are SPLs which use I2C linker lists *and* the generic .lds and build without an error, then this should be fixed, because it means the build process should complain when an input section is not mapped to an output section.

(and that should be fixed even though in this case, adding the I2C linker lists in the .lds would 'fix' the build, but they would actually paper over the real issue of sections being mapped without control)

Quoted 2 lines

Best Regards,
Alison Wang

Amicalement,

Signature · 1 line
Albert.
#26 lore raw

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

Hi, Albert,

Quoted 40 lines
Quoted 12 lines · Huan Wang

Hi, Albert,

Quoted 10 lines
Quoted 10 lines
Quoted 5 lines · Alison Wang
arch/arm/cpu/armv7/ls102xa/u-boot-spl.lds new file +5 -0
+
+     . = ALIGN(4);
+     .u_boot_list : {
+             KEEP(*(SORT(.u_boot_list*_i2c_*)));
+     }
Quoted 8 lines
Quoted 7 lines
Quoted 5 lines

IS this required? And if it is, could it not be added to the arch/arm/cpu/u-boot-spl.lds file? This way you would not need an .lds file at all.

[Alison Wang] Yes, it is required.

Ok -- what for? :)

[Alison Wang] In SPL part, DDR is initialized by reading SPD through

I2C interface.

Quoted 3 lines

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 I need to add

this to make I2C work in SPL.

Understood. So your SPL code uses I2C, and for I2C, you need a linker list. But then:

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

I would like to add it in arch/arm/cpu/u-boot-spl.lds. I was not sure adding it in arch/arm/cpu/u-boot-spl.lds is acceptable or

not.

Quoted 5 lines
Quoted 5 lines

(assuming the reason why it is needed is valid) If it causes no change to boards which do not use it right now (and I mean 'no change' ad 'binary identical') then this is acceptable. Make sure you check the binary invariance and that you mention it in the

Quoted 7 lines

commit.

Quoted 2 lines
Quoted 1 line

[Alison Wang] It will cause the binary is not identical for other

board.

Is this a prediction or an actual observation of compared builds with and without the I2C linker liste addition to the generic SPL .lds?

[Alison Wang] I use mx31pdk as example. I compared the binaries with and Without the I2C linker list in arch/arm/cpu/u-boot-spl.lds. The binaries are not identical.

Quoted 5 lines
Quoted 3 lines

I think
it may be not good to add in arch/arm/cpu/u-boot-spl.lds. What's your

opinion about it?

Quoted 9 lines

If there are SPLs which use I2C linker lists *and* the generic .lds and build without an error, then this should be fixed, because it means the build process should complain when an input section is not mapped to an output section.

(and that should be fixed even though in this case, adding the I2C linker lists in the .lds would 'fix' the build, but they would actually paper over the real issue of sections being mapped without control)

Best Regards,
Alison Wang

#27 lore raw

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

Hi Huan,

Quoted 45 lines · Huan Wang

Hi, Albert,

Quoted 43 lines
Quoted 12 lines · Huan Wang

Hi, Albert,

Quoted 10 lines
Quoted 10 lines
Quoted 5 lines · Alison Wang
(quoted diff) +5 -0
+
+     . = ALIGN(4);
+     .u_boot_list : {
+             KEEP(*(SORT(.u_boot_list*_i2c_*)));
+     }
Quoted 8 lines
Quoted 7 lines
Quoted 5 lines

IS this required? And if it is, could it not be added to the arch/arm/cpu/u-boot-spl.lds file? This way you would not need an .lds file at all.

[Alison Wang] Yes, it is required.

Ok -- what for? :)

[Alison Wang] In SPL part, DDR is initialized by reading SPD through

I2C interface.

Quoted 3 lines

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 I need to add

this to make I2C work in SPL.

Understood. So your SPL code uses I2C, and for I2C, you need a linker list. But then:

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

I would like to add it in arch/arm/cpu/u-boot-spl.lds. I was not sure adding it in arch/arm/cpu/u-boot-spl.lds is acceptable or

not.

Quoted 5 lines
Quoted 5 lines

(assuming the reason why it is needed is valid) If it causes no change to boards which do not use it right now (and I mean 'no change' ad 'binary identical') then this is acceptable. Make sure you check the binary invariance and that you mention it in the

commit.

Quoted 2 lines
Quoted 1 line

[Alison Wang] It will cause the binary is not identical for other

Quoted 8 lines
Quoted 4 lines

board.

Is this a prediction or an actual observation of compared builds with and without the I2C linker liste addition to the generic SPL .lds?

[Alison Wang] I use mx31pdk as example. I compared the binaries with and Without the I2C linker list in arch/arm/cpu/u-boot-spl.lds. The binaries are not identical.

I have just checked mx31pdk: the u-boot binaries (u-boot, u-boot.bin, u-boot-with-spl.bin, u-boot.map, u-boot.srec) are indeed different, but that's just normal considering the repository state and build date and time are included in the binaries [1].

OTOH, I see that the u-boot-spl.bin files are identical.

The only change I made between the two builds was inserting

	>         . = ALIGN(4);
	> +       .u_boot_list : {
	> +               KEEP(*(SORT(.u_boot_list*_i2c_*)));
	> +       }  

in arch/arm/cpu/u-boot-spl.lds at line 34.

Can you re-check?

Quoted 2 lines

Best Regards,
Alison Wang

[1] BTW, how do you folks out here proceed when trying to compare u-boot.bin files from different builds of the same target without the repo state or build date and time affecting the comparison? I use a patch to Makefile that fakes the commit and repo state, and I also use fakelib to force timestamps, but there might be a simpler way.

Amicalement,

Signature · 1 line
Albert.
#28 lore raw

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

Hi, Albert,

Quoted 71 lines
Quoted 30 lines · Huan Wang

Hi, Albert,

Quoted 28 lines
Quoted 16 lines · Huan Wang

Hi, Albert,

Quoted 14 lines
Quoted 14 lines

Review

Quoted 5 lines · Alison Wang
(quoted diff) +5 -0
+
+     . = ALIGN(4);
+     .u_boot_list : {
+             KEEP(*(SORT(.u_boot_list*_i2c_*)));
+     }

IS this required? And if it is, could it not be added to the arch/arm/cpu/u-boot-spl.lds file? This way you would not need an .lds file at all.

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

[Alison Wang] Yes, it is required.

Ok -- what for? :)

[Alison Wang] In SPL part, DDR is initialized by reading SPD through

I2C interface.

Quoted 3 lines

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 I need to

add

Quoted 15 lines
Quoted 15 lines

this to make I2C work in SPL.

Understood. So your SPL code uses I2C, and for I2C, you need a linker list. But then:

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

I would like to add it in arch/arm/cpu/u-boot-spl.lds. I was not sure adding it in arch/arm/cpu/u-boot-spl.lds is acceptable or

not.

Quoted 6 lines
Quoted 6 lines

(assuming the reason why it is needed is valid) If it causes no change to boards which do not use it right now (and I mean 'no change' ad 'binary identical') then this is acceptable. Make sure you check the binary invariance and that you mention it in the

Quoted 7 lines
Quoted 7 lines

commit.

Quoted 2 lines
Quoted 1 line

[Alison Wang] It will cause the binary is not identical for other

board.

Is this a prediction or an actual observation of compared builds with and without the I2C linker liste addition to the generic

SPL .lds?

Quoted 4 lines

[Alison Wang] I use mx31pdk as example. I compared the binaries with and Without the I2C linker list in arch/arm/cpu/u-boot-spl.lds. The binaries are not identical.

I have just checked mx31pdk: the u-boot binaries (u-boot, u-boot.bin, u-boot-with-spl.bin, u-boot.map, u-boot.srec) are indeed different, but that's just normal considering the repository state and build date and time are included in the binaries [1].

OTOH, I see that the u-boot-spl.bin files are identical.

The only change I made between the two builds was inserting

Quoted 8 lines
	>         . = ALIGN(4);
	> +       .u_boot_list : {
	> +               KEEP(*(SORT(.u_boot_list*_i2c_*)));
	> +       }

in arch/arm/cpu/u-boot-spl.lds at line 34.

Can you re-check?

[Alison Wang] Yes, you are right. u-boot-spl.bin files are identical. The u-boot binaries (u-boot, u-boot.bin, u-boot-with-spl.bin, u-boot.map, u-boot.srec) are different only in build date and time.

Quoted 7 lines

[1] BTW, how do you folks out here proceed when trying to compare u- boot.bin files from different builds of the same target without the repo state or build date and time affecting the comparison? I use a patch to Makefile that fakes the commit and repo state, and I also use fakelib to force timestamps, but there might be a simpler way.

[Alison Wang] Oh, your way is very good. I just used vimdiff.

Best Regards,
Alison Wang

#29 lore raw

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

Hi Huan,

Quoted 85 lines · Huan Wang

Hi, Albert,

Quoted 71 lines
Quoted 30 lines · Huan Wang

Hi, Albert,

Quoted 28 lines
Quoted 16 lines · Huan Wang

Hi, Albert,

Quoted 14 lines
Quoted 14 lines

Review

Quoted 5 lines · Alison Wang
(quoted diff) +5 -0
+
+     . = ALIGN(4);
+     .u_boot_list : {
+             KEEP(*(SORT(.u_boot_list*_i2c_*)));
+     }

IS this required? And if it is, could it not be added to the arch/arm/cpu/u-boot-spl.lds file? This way you would not need an .lds file at all.

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

[Alison Wang] Yes, it is required.

Ok -- what for? :)

[Alison Wang] In SPL part, DDR is initialized by reading SPD through

I2C interface.

Quoted 3 lines

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 I need to

add

Quoted 15 lines
Quoted 15 lines

this to make I2C work in SPL.

Understood. So your SPL code uses I2C, and for I2C, you need a linker list. But then:

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

I would like to add it in arch/arm/cpu/u-boot-spl.lds. I was not sure adding it in arch/arm/cpu/u-boot-spl.lds is acceptable or

not.

Quoted 6 lines
Quoted 6 lines

(assuming the reason why it is needed is valid) If it causes no change to boards which do not use it right now (and I mean 'no change' ad 'binary identical') then this is acceptable. Make sure you check the binary invariance and that you mention it in the

Quoted 7 lines
Quoted 7 lines

commit.

Quoted 2 lines
Quoted 1 line

[Alison Wang] It will cause the binary is not identical for other

board.

Is this a prediction or an actual observation of compared builds with and without the I2C linker liste addition to the generic

SPL .lds?

Quoted 4 lines

[Alison Wang] I use mx31pdk as example. I compared the binaries with and Without the I2C linker list in arch/arm/cpu/u-boot-spl.lds. The binaries are not identical.

I have just checked mx31pdk: the u-boot binaries (u-boot, u-boot.bin, u-boot-with-spl.bin, u-boot.map, u-boot.srec) are indeed different, but that's just normal considering the repository state and build date and time are included in the binaries [1].

OTOH, I see that the u-boot-spl.bin files are identical.

The only change I made between the two builds was inserting

Quoted 8 lines
	>         . = ALIGN(4);
	> +       .u_boot_list : {
	> +               KEEP(*(SORT(.u_boot_list*_i2c_*)));
	> +       }

in arch/arm/cpu/u-boot-spl.lds at line 34.

Can you re-check?

[Alison Wang] Yes, you are right. u-boot-spl.bin files are identical. The u-boot binaries (u-boot, u-boot.bin, u-boot-with-spl.bin, u-boot.map, u-boot.srec) are different only in build date and time.

Quoted 1 line
Quoted 7 lines
Quoted 6 lines

[1] BTW, how do you folks out here proceed when trying to compare u- boot.bin files from different builds of the same target without the repo state or build date and time affecting the comparison? I use a patch to Makefile that fakes the commit and repo state, and I also use fakelib to force timestamps, but there might be a simpler way.

[Alison Wang] Oh, your way is very good. I just used vimdiff.

I'll run a larger-scale check today, to see which SPLs are affected by adding u-boot_list*, not just u_boot_list*_i2c_*, i.e., maybe we can make this identical in u-boot.lds and u-boot-spl.lds for ARM.

Quoted 2 lines

Best Regards,
Alison Wang

Amicalement,

Signature · 1 line
Albert.
#30 lore raw

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

Hi, Albert,

Quoted 104 lines
Quoted 33 lines · Huan Wang

Hi, Albert,

Quoted 31 lines
Quoted 28 lines · Huan Wang

Hi, Albert,

Quoted 26 lines
Quoted 16 lines · Huan Wang

Hi, Albert,

Quoted 14 lines
Quoted 14 lines

Review

Quoted 5 lines · Alison Wang
(quoted diff) +5 -0
+
+     . = ALIGN(4);
+     .u_boot_list : {
+             KEEP(*(SORT(.u_boot_list*_i2c_*)));
+     }

IS this required? And if it is, could it not be added to the arch/arm/cpu/u-boot-spl.lds file? This way you would not need an .lds file at all.

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

[Alison Wang] Yes, it is required.

Ok -- what for? :)

[Alison Wang] In SPL part, DDR is initialized by reading SPD through

I2C interface.

Quoted 1 line

For I2C, ll_entry_count() is called, and it returns the

number

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

of elements of a linker-generated array placed into

subsection

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

of .u_boot_list section specified by _list argument. So I

need

Quoted 7 lines
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

to

add

Quoted 5 lines
Quoted 5 lines

this to make I2C work in SPL.

Understood. So your SPL code uses I2C, and for I2C, you need a linker list. But then:

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

I would like to add it in arch/arm/cpu/u-boot-spl.lds. I was not sure adding it in arch/arm/cpu/u-boot-spl.lds is acceptable or

not.

Quoted 2 lines
Quoted 2 lines

(assuming the reason why it is needed is valid) If it

causes

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 4 lines
Quoted 4 lines

no change to boards which do not use it right now (and I mean 'no change' ad 'binary identical') then this is acceptable. Make sure you check the binary invariance and that you mention it in the

commit.

Quoted 3 lines
Quoted 1 line

[Alison Wang] It will cause the binary is not identical for other

board.

Is this a prediction or an actual observation of compared

builds

Quoted 9 lines
Quoted 9 lines
Quoted 1 line
Quoted 1 line

with and without the I2C linker liste addition to the generic

SPL .lds?

Quoted 4 lines

[Alison Wang] I use mx31pdk as example. I compared the binaries with and Without the I2C linker list in arch/arm/cpu/u-boot-spl.lds. The binaries are not identical.

I have just checked mx31pdk: the u-boot binaries (u-boot, u-boot.bin, u-boot-with-spl.bin, u-boot.map, u-boot.srec) are

indeed

Quoted 12 lines
Quoted 12 lines

different, but that's just normal considering the repository state and build date and time are included in the binaries [1].

OTOH, I see that the u-boot-spl.bin files are identical.

The only change I made between the two builds was inserting

	>         . = ALIGN(4);
	> +       .u_boot_list : {
	> +               KEEP(*(SORT(.u_boot_list*_i2c_*)));
	> +       }
Quoted 6 lines
Quoted 3 lines

in arch/arm/cpu/u-boot-spl.lds at line 34.

Can you re-check?

[Alison Wang] Yes, you are right. u-boot-spl.bin files are identical. The u-boot binaries (u-boot, u-boot.bin, u-boot-with-spl.bin, u-

boot.map, u-boot.srec) are different only in build date and time.

Quoted 2 lines
Quoted 2 lines

[1] BTW, how do you folks out here proceed when trying to compare

u-

Quoted 5 lines
Quoted 5 lines

boot.bin files from different builds of the same target without the repo state or build date and time affecting the comparison? I use a patch to Makefile that fakes the commit and repo state, and I also use fakelib to force timestamps, but there might be a simpler way.

Quoted 6 lines
Quoted 1 line

[Alison Wang] Oh, your way is very good. I just used vimdiff.

I'll run a larger-scale check today, to see which SPLs are affected by adding u-boot_list*, not just u_boot_list*_i2c_*, i.e., maybe we can make this identical in u-boot.lds and u-boot-spl.lds for ARM.

[Alison Wang] I can't agree with you more on making this identical in u-boot.lds and u-boot-spl.lds for ARM. Anyway, I need to confirm it through your larger-scale check result.

Best Regards,
Alison Wang

#31 lore raw

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

Hi Huan,

Quoted 108 lines · Huan Wang

Hi, Albert,

Quoted 106 lines
Quoted 33 lines · Huan Wang

Hi, Albert,

Quoted 31 lines
Quoted 28 lines · Huan Wang

Hi, Albert,

Quoted 26 lines
Quoted 16 lines · Huan Wang

Hi, Albert,

Quoted 14 lines
Quoted 14 lines

Review

Quoted 5 lines · Alison Wang
(quoted diff) +5 -0
+
+     . = ALIGN(4);
+     .u_boot_list : {
+             KEEP(*(SORT(.u_boot_list*_i2c_*)));
+     }

IS this required? And if it is, could it not be added to the arch/arm/cpu/u-boot-spl.lds file? This way you would not need an .lds file at all.

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

[Alison Wang] Yes, it is required.

Ok -- what for? :)

[Alison Wang] In SPL part, DDR is initialized by reading SPD through

I2C interface.

Quoted 1 line

For I2C, ll_entry_count() is called, and it returns the

number

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

of elements of a linker-generated array placed into

subsection

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

of .u_boot_list section specified by _list argument. So I

need

Quoted 7 lines
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

to

add

Quoted 5 lines
Quoted 5 lines

this to make I2C work in SPL.

Understood. So your SPL code uses I2C, and for I2C, you need a linker list. But then:

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

I would like to add it in arch/arm/cpu/u-boot-spl.lds. I was not sure adding it in arch/arm/cpu/u-boot-spl.lds is acceptable or

not.

Quoted 2 lines
Quoted 2 lines

(assuming the reason why it is needed is valid) If it

causes

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 4 lines
Quoted 4 lines

no change to boards which do not use it right now (and I mean 'no change' ad 'binary identical') then this is acceptable. Make sure you check the binary invariance and that you mention it in the

commit.

Quoted 3 lines
Quoted 1 line

[Alison Wang] It will cause the binary is not identical for other

board.

Is this a prediction or an actual observation of compared

builds

Quoted 9 lines
Quoted 9 lines
Quoted 1 line
Quoted 1 line

with and without the I2C linker liste addition to the generic

SPL .lds?

Quoted 4 lines

[Alison Wang] I use mx31pdk as example. I compared the binaries with and Without the I2C linker list in arch/arm/cpu/u-boot-spl.lds. The binaries are not identical.

I have just checked mx31pdk: the u-boot binaries (u-boot, u-boot.bin, u-boot-with-spl.bin, u-boot.map, u-boot.srec) are

indeed

Quoted 12 lines
Quoted 12 lines

different, but that's just normal considering the repository state and build date and time are included in the binaries [1].

OTOH, I see that the u-boot-spl.bin files are identical.

The only change I made between the two builds was inserting

	>         . = ALIGN(4);
	> +       .u_boot_list : {
	> +               KEEP(*(SORT(.u_boot_list*_i2c_*)));
	> +       }
Quoted 6 lines
Quoted 3 lines

in arch/arm/cpu/u-boot-spl.lds at line 34.

Can you re-check?

[Alison Wang] Yes, you are right. u-boot-spl.bin files are identical. The u-boot binaries (u-boot, u-boot.bin, u-boot-with-spl.bin, u-

boot.map, u-boot.srec) are different only in build date and time.

Quoted 2 lines
Quoted 2 lines

[1] BTW, how do you folks out here proceed when trying to compare

u-

Quoted 6 lines
Quoted 5 lines

boot.bin files from different builds of the same target without the repo state or build date and time affecting the comparison? I use a patch to Makefile that fakes the commit and repo state, and I also use fakelib to force timestamps, but there might be a simpler way.

[Alison Wang] Oh, your way is very good. I just used vimdiff.

Quoted 7 lines
Quoted 4 lines

I'll run a larger-scale check today, to see which SPLs are affected by adding u-boot_list*, not just u_boot_list*_i2c_*, i.e., maybe we can make this identical in u-boot.lds and u-boot-spl.lds for ARM.

[Alison Wang] I can't agree with you more on making this identical in u-boot.lds and u-boot-spl.lds for ARM. Anyway, I need to confirm it through your larger-scale check result.

I have been slightly side-tracked on this, but I'll run the test in a few hours and publish the results in this thread.

Quoted 2 lines

Best Regards,
Alison Wang

Amicalement,

Signature · 1 line
Albert.
#32 lore raw

PATCH 7/7 arm: ls102xa: Add SD boot support for LS1021ATWR board

In reply to Alison Wang

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.

---
 board/freescale/ls1021atwr/MAINTAINERS        |  1 +
 board/freescale/ls1021atwr/ls1021atwr.c       | 31 +++++++++++++++-
 board/freescale/ls1021atwr/ls102xa_pbi.cfg    | 13 +++++++
 board/freescale/ls1021atwr/ls102xa_rcw_sd.cfg | 14 ++++++++
 configs/ls1021atwr_sdcard_defconfig           |  4 +++
 include/configs/ls1021atwr.h                  | 52 +++++++++++++++++++++++++++
 6 files changed, 114 insertions(+), 1 deletion(-)
 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 -1
index b522ff2..7c0654a 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)
 {
@@ -270,13 +277,33 @@ 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)
 {
 #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;
 }
 
@@ -304,6 +331,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);
@@ -486,3 +514,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 +13 -0
new file mode 100644
index 0000000..76373ce
@@ -0,0 +1,13 @@
+#PBI commands
+
+09570200 ffffffff
+09570158 00000300
+09570200 00000000
+8940007c 21f47300
+
+#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
new file mode 100644
index 0000000..6c83e3b
@@ -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 01038000
+20024800 881b1540 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 +52 -0

94 lines not on this page · raw message

Signature · 1 line
1.8.0