Re: [U-Boot] [PATCH v6 1/2] armv8: ls1088ardb: Add SD boot support for ls1088

2017-11-17 Thread York Sun
On 11/05/2017 11:48 PM, Ashish Kumar wrote:
> Signed-off-by: Prabhakar Kushwaha 
> Signed-off-by: Ashish Kumar 
> Signed-off-by: Raghav Dogra 
> ---
> v6:
> Incorporation of review comments in README wrt to line wrap.
> Sorting defconfig with help make savedefconfig
> 

Applied to fsl-qoriq master. Thanks.

York

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v6 1/2] armv8: ls1088ardb: Add SD boot support for ls1088

2017-11-08 Thread Ashish Kumar


-Original Message-
From: York Sun 
Sent: Thursday, November 09, 2017 12:30 AM
To: Ashish Kumar ; u-boot@lists.denx.de
Cc: Prabhakar Kushwaha ; Raghav Dogra 

Subject: Re: [PATCH v6 1/2] armv8: ls1088ardb: Add SD boot support for ls1088

On 11/05/2017 11:48 PM, Ashish Kumar wrote:
> Signed-off-by: Prabhakar Kushwaha 
> Signed-off-by: Ashish Kumar 
> Signed-off-by: Raghav Dogra 
> ---
> v6:
> Incorporation of review comments in README wrt to line wrap.
> Sorting defconfig with help make savedefconfig
> 
>  arch/arm/Kconfig   |  1 +
>  arch/arm/cpu/armv8/fsl-layerscape/doc/README.lsch3 | 44 
> ++
>  board/freescale/ls1088a/MAINTAINERS|  1 +
>  board/freescale/ls1088a/ddr.c  |  5 ++-
>  configs/ls1088ardb_sdcard_qspi_defconfig   | 41 
>  include/configs/ls1088a_common.h   | 25 
>  include/configs/ls1088ardb.h   | 30 ++-
>  7 files changed, 144 insertions(+), 3 deletions(-)  create mode 
> 100644 configs/ls1088ardb_sdcard_qspi_defconfig
> 
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 
> 83b7aa5..5707111 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -938,6 +938,7 @@ config TARGET_LS1088ARDB
>   select ARMV8_MULTIENTRY
>   select ARCH_MISC_INIT
>   select BOARD_LATE_INIT
> + select SUPPORT_SPL
>   help
> Support for NXP LS1088ARDB platform.
> The LS1088A Reference design board (RDB) is a high-performance 
> diff --git a/arch/arm/cpu/armv8/fsl-layerscape/doc/README.lsch3 
> b/arch/arm/cpu/armv8/fsl-layerscape/doc/README.lsch3
> index 7867c37..522760b 100644
> --- a/arch/arm/cpu/armv8/fsl-layerscape/doc/README.lsch3
> +++ b/arch/arm/cpu/armv8/fsl-layerscape/doc/README.lsch3
> @@ -201,6 +201,50 @@ nand write  8  of u-boot image>  Notice the difference from QDS is SRC, SRC_ADDR and 
> the offset of u-boot image  to match board NAND device with 4KB/page, block 
> size 512KB.
>  
> +Booting from SD/eMMC
> +---
> +Booting from SD/eMMC requires two images, RCW and u-boot-with-spl.bin.
> +The difference between SD boot RCW image and QSPI-NOR boot image is 
> +the PBI command sequence. Below is one example for PBI commands for 
> +RDB and QDS which uses SD device with block size 512. Block location 
> +can be calculated by dividing offset with block size.
> +
> +1) Block Copy: SRC=0x0040, SRC_ADDR=0x0010, DEST_ADDR=0x1800a000,
> +BLOCK_SIZE=0x00016000
> +
> +This command copies u-boot image from SD device into OCRAM. The 
> +values need to adjust accordingly for SD/eMMC
> +
> +SRC  should match the cfg_rcw_src, the reset config pins.
> + The value for source(SRC) can be 0x0040 or 0x0041
> + depending upon SD or eMMC.
> +SRC_ADDR is the offset of u-boot-with-spl.bin image in SD device.
> + In the example above, 1MB. This is same as QSPI-NOR.
> +DEST_ADDRis configured at 0x1800a000, matching bootloc set above.
> +BLOCK_SIZE   is the size to be copied by PBI.
> +
> +2) CCSR 4-byte write to 0x01e00404, data=0x
> +3) CCSR 4-byte write to 0x01e00400, data=0x1800a000 The above two 
> +commands set bootloc register to 0x_1800a000 where the u-boot 
> +code will be running in OCRAM.
> +
> +
> +RCW image should be written at 8th block of device(SD/eMMC). Example 
> +of using u-boot command
> +
> +mmc erase 0x8 0x10
> +mmc write  0x8  +typical value=10>

It is not wrong to erase the sectors first. I think we don't need to erase the 
SD first. The write command should just work.
> It should work. To make is consistent with other boot types I have used this 
> command were write preceded by erase.

 On the other hand, the number of blocks to be erased seems too large The RCW 
is normally very small (less than 1 block). Would it be more appropriate to use 
a smaller number as the "typical" value, such as 1?
> 992256 bits are reserved for RCW as per the memory map. I just used safe 
> value, although 1 = 512bits which is the size of RCW

> +
> +To form the SD-Boot image, build u-boot with SD config, for example, 
> +ls1088ardb_sdcard_qspi_defconfig. The image needed is u-boot-with-spl.bin.
> +The u-boot image should be written to match SRC_ADDR, in above 
> +example offset 0x10 in other work it means block location 0x800

s/work/word

If you agree, I will fix them at the time of merging.
> I agree.

Regards
Ashish

York
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v6 1/2] armv8: ls1088ardb: Add SD boot support for ls1088

2017-11-08 Thread York Sun
On 11/05/2017 11:48 PM, Ashish Kumar wrote:
> Signed-off-by: Prabhakar Kushwaha 
> Signed-off-by: Ashish Kumar 
> Signed-off-by: Raghav Dogra 
> ---
> v6:
> Incorporation of review comments in README wrt to line wrap.
> Sorting defconfig with help make savedefconfig
> 
>  arch/arm/Kconfig   |  1 +
>  arch/arm/cpu/armv8/fsl-layerscape/doc/README.lsch3 | 44 
> ++
>  board/freescale/ls1088a/MAINTAINERS|  1 +
>  board/freescale/ls1088a/ddr.c  |  5 ++-
>  configs/ls1088ardb_sdcard_qspi_defconfig   | 41 
>  include/configs/ls1088a_common.h   | 25 
>  include/configs/ls1088ardb.h   | 30 ++-
>  7 files changed, 144 insertions(+), 3 deletions(-)
>  create mode 100644 configs/ls1088ardb_sdcard_qspi_defconfig
> 
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index 83b7aa5..5707111 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -938,6 +938,7 @@ config TARGET_LS1088ARDB
>   select ARMV8_MULTIENTRY
>   select ARCH_MISC_INIT
>   select BOARD_LATE_INIT
> + select SUPPORT_SPL
>   help
> Support for NXP LS1088ARDB platform.
> The LS1088A Reference design board (RDB) is a high-performance
> diff --git a/arch/arm/cpu/armv8/fsl-layerscape/doc/README.lsch3 
> b/arch/arm/cpu/armv8/fsl-layerscape/doc/README.lsch3
> index 7867c37..522760b 100644
> --- a/arch/arm/cpu/armv8/fsl-layerscape/doc/README.lsch3
> +++ b/arch/arm/cpu/armv8/fsl-layerscape/doc/README.lsch3
> @@ -201,6 +201,50 @@ nand write  8  u-boot image>
>  Notice the difference from QDS is SRC, SRC_ADDR and the offset of u-boot 
> image
>  to match board NAND device with 4KB/page, block size 512KB.
>  
> +Booting from SD/eMMC
> +---
> +Booting from SD/eMMC requires two images, RCW and u-boot-with-spl.bin.
> +The difference between SD boot RCW image and QSPI-NOR boot image is the
> +PBI command sequence. Below is one example for PBI commands for RDB
> +and QDS which uses SD device with block size 512. Block location can be
> +calculated by dividing offset with block size.
> +
> +1) Block Copy: SRC=0x0040, SRC_ADDR=0x0010, DEST_ADDR=0x1800a000,
> +BLOCK_SIZE=0x00016000
> +
> +This command copies u-boot image from SD device into OCRAM. The values
> +need to adjust accordingly for SD/eMMC
> +
> +SRC  should match the cfg_rcw_src, the reset config pins.
> + The value for source(SRC) can be 0x0040 or 0x0041
> + depending upon SD or eMMC.
> +SRC_ADDR is the offset of u-boot-with-spl.bin image in SD device.
> + In the example above, 1MB. This is same as QSPI-NOR.
> +DEST_ADDRis configured at 0x1800a000, matching bootloc set above.
> +BLOCK_SIZE   is the size to be copied by PBI.
> +
> +2) CCSR 4-byte write to 0x01e00404, data=0x
> +3) CCSR 4-byte write to 0x01e00400, data=0x1800a000
> +The above two commands set bootloc register to 0x_1800a000 where
> +the u-boot code will be running in OCRAM.
> +
> +
> +RCW image should be written at 8th block of device(SD/eMMC). Example of
> +using u-boot command
> +
> +mmc erase 0x8 0x10
> +mmc write  0x8  value=10>

It is not wrong to erase the sectors first. I think we don't need to
erase the SD first. The write command should just work. On the other
hand, the number of blocks to be erased seems too large The RCW is
normally very small (less than 1 block). Would it be more appropriate to
use a smaller number as the "typical" value, such as 1?

> +
> +To form the SD-Boot image, build u-boot with SD config, for example,
> +ls1088ardb_sdcard_qspi_defconfig. The image needed is u-boot-with-spl.bin.
> +The u-boot image should be written to match SRC_ADDR, in above example
> +offset 0x10 in other work it means block location 0x800

s/work/word

If you agree, I will fix them at the time of merging.

York
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v6 1/2] armv8: ls1088ardb: Add SD boot support for ls1088

2017-11-05 Thread Ashish Kumar
Signed-off-by: Prabhakar Kushwaha 
Signed-off-by: Ashish Kumar 
Signed-off-by: Raghav Dogra 
---
v6:
Incorporation of review comments in README wrt to line wrap.
Sorting defconfig with help make savedefconfig

 arch/arm/Kconfig   |  1 +
 arch/arm/cpu/armv8/fsl-layerscape/doc/README.lsch3 | 44 ++
 board/freescale/ls1088a/MAINTAINERS|  1 +
 board/freescale/ls1088a/ddr.c  |  5 ++-
 configs/ls1088ardb_sdcard_qspi_defconfig   | 41 
 include/configs/ls1088a_common.h   | 25 
 include/configs/ls1088ardb.h   | 30 ++-
 7 files changed, 144 insertions(+), 3 deletions(-)
 create mode 100644 configs/ls1088ardb_sdcard_qspi_defconfig

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 83b7aa5..5707111 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -938,6 +938,7 @@ config TARGET_LS1088ARDB
select ARMV8_MULTIENTRY
select ARCH_MISC_INIT
select BOARD_LATE_INIT
+   select SUPPORT_SPL
help
  Support for NXP LS1088ARDB platform.
  The LS1088A Reference design board (RDB) is a high-performance
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/doc/README.lsch3 
b/arch/arm/cpu/armv8/fsl-layerscape/doc/README.lsch3
index 7867c37..522760b 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/doc/README.lsch3
+++ b/arch/arm/cpu/armv8/fsl-layerscape/doc/README.lsch3
@@ -201,6 +201,50 @@ nand write  8 
 Notice the difference from QDS is SRC, SRC_ADDR and the offset of u-boot image
 to match board NAND device with 4KB/page, block size 512KB.
 
+Booting from SD/eMMC
+---
+Booting from SD/eMMC requires two images, RCW and u-boot-with-spl.bin.
+The difference between SD boot RCW image and QSPI-NOR boot image is the
+PBI command sequence. Below is one example for PBI commands for RDB
+and QDS which uses SD device with block size 512. Block location can be
+calculated by dividing offset with block size.
+
+1) Block Copy: SRC=0x0040, SRC_ADDR=0x0010, DEST_ADDR=0x1800a000,
+BLOCK_SIZE=0x00016000
+
+This command copies u-boot image from SD device into OCRAM. The values
+need to adjust accordingly for SD/eMMC
+
+SRCshould match the cfg_rcw_src, the reset config pins.
+   The value for source(SRC) can be 0x0040 or 0x0041
+   depending upon SD or eMMC.
+SRC_ADDR   is the offset of u-boot-with-spl.bin image in SD device.
+   In the example above, 1MB. This is same as QSPI-NOR.
+DEST_ADDR  is configured at 0x1800a000, matching bootloc set above.
+BLOCK_SIZE is the size to be copied by PBI.
+
+2) CCSR 4-byte write to 0x01e00404, data=0x
+3) CCSR 4-byte write to 0x01e00400, data=0x1800a000
+The above two commands set bootloc register to 0x_1800a000 where
+the u-boot code will be running in OCRAM.
+
+
+RCW image should be written at 8th block of device(SD/eMMC). Example of
+using u-boot command
+
+mmc erase 0x8 0x10
+mmc write  0x8 
+
+To form the SD-Boot image, build u-boot with SD config, for example,
+ls1088ardb_sdcard_qspi_defconfig. The image needed is u-boot-with-spl.bin.
+The u-boot image should be written to match SRC_ADDR, in above example
+offset 0x10 in other work it means block location 0x800
+
+mmc erase 0x800 0x1800
+mmc write  0x800 
+
+With these two images in SD/eMMC device, the board can boot from SD/eMMC.
+
 MMU Translation Tables
 ==
 
diff --git a/board/freescale/ls1088a/MAINTAINERS 
b/board/freescale/ls1088a/MAINTAINERS
index e1e6d4b..68f23d6 100644
--- a/board/freescale/ls1088a/MAINTAINERS
+++ b/board/freescale/ls1088a/MAINTAINERS
@@ -5,6 +5,7 @@ S:  Maintained
 F: board/freescale/ls1088a/
 F: include/configs/ls1088ardb.h
 F: configs/ls1088ardb_qspi_defconfig
+F: configs/ls1088ardb_sdcard_qspi_defconfig
 
 LS1088AQDS BOARD
 M: Prabhakar Kushwaha 
diff --git a/board/freescale/ls1088a/ddr.c b/board/freescale/ls1088a/ddr.c
index 0ecfd65..e24bfd5 100644
--- a/board/freescale/ls1088a/ddr.c
+++ b/board/freescale/ls1088a/ddr.c
@@ -96,7 +96,10 @@ int fsl_initdram(void)
 {
puts("Initializing DDRusing SPD\n");
 
+#if defined(CONFIG_SPL) && !defined(CONFIG_SPL_BUILD)
+   gd->ram_size = fsl_ddr_sdram_size();
+#else
gd->ram_size = fsl_ddr_sdram();
-
+#endif
return 0;
 }
diff --git a/configs/ls1088ardb_sdcard_qspi_defconfig 
b/configs/ls1088ardb_sdcard_qspi_defconfig
new file mode 100644
index 000..8abc313
--- /dev/null
+++ b/configs/ls1088ardb_sdcard_qspi_defconfig
@@ -0,0 +1,41 @@
+CONFIG_ARM=y
+CONFIG_TARGET_LS1088ARDB=y
+CONFIG_SPL_LIBCOMMON_SUPPORT=y
+CONFIG_SPL_LIBGENERIC_SUPPORT=y
+CONFIG_FSL_LS_PPA=y
+CONFIG_SPL_MMC_SUPPORT=y
+CONFIG_SPL_SERIAL_SUPPORT=y
+CONFIG_SPL_DRIVERS_MISC_SUPPORT=y