[U-Boot] i.MX6: NAND boot with SPL
Stefano Babic
sbabic at denx.de
Tue Sep 27 08:57:19 CEST 2016
Hi Jagan,
On 26/09/2016 17:35, Jagan Teki wrote:
> Hi Fabio/Peng/Stefano/Any,
>
> Did anyone tried or used nand boot with SPL and
> u-boot.img(u-boot-dtb.img)? was it supported by imx6?
>
Yes, I did sometime ago, and the combination SPL + u-boot.img worked. I
think I tried with 2016.05 or 2016.07, I do not test it recently.
> So booted with MMC and trying to write the images from 1MB since I
> read 0x0 on the flash shows FCB.
I do not understand: do you copy SPL into the NAND ?
The use case is having SPL and u-boot.img both in NAND. You can use two
different devices, too, but you have to provide your list of spl_devices.
>
> Code:
> ------
> diff --git a/arch/arm/imx-common/spl.c b/arch/arm/imx-common/spl.c
> index bdcda7d..72f870e 100644
> --- a/arch/arm/imx-common/spl.c
> +++ b/arch/arm/imx-common/spl.c
> @@ -84,6 +84,8 @@ u32 spl_boot_mode(const u32 boot_device)
> return MMCSD_MODE_RAW;
> #endif
> break;
> + case BOOT_DEVICE_NAND:
> + break;
> default:
> puts("spl: ERROR: unsupported device\n");
> hang();
> diff --git a/arch/arm/imx-common/spl_nand.cfg b/arch/arm/imx-common/spl_nand.cfg
> new file mode 100644
> index 0000000..e918c0d
> --- /dev/null
> +++ b/arch/arm/imx-common/spl_nand.cfg
> @@ -0,0 +1,2 @@
> +IMAGE_VERSION 2
> +BOOT_FROM nand
>
> NAND write:
>
> U-Boot > tftpboot ${loadaddr} SPL
> Using FEC device
> TFTP from server 192.168.2.68; our IP address is 192.168.2.67
> Filename 'SPL'.
> Load address: 0x12000000
> Loading: #######
> 1.4 MiB/s
> done
> Bytes transferred = 31744 (7c00 hex)
> U-Boot > nand erase 0x100000 0x100000
>
> NAND erase: device 0 offset 0x100000, size 0x100000
> Erasing at 0x1c0000 -- 100% complete.
> OK
> U-Boot > nand write ${loadaddr} 0x100000 0x7c00
I do not understand: SPL is not loaded from NAND from address 0x100000.
The SOC expects to have a right FCB from address 0.
>
> NAND write: device 0 offset 0x100000, size 0x100000
> 1048576 bytes written: OK
>
> U-Boot > tftpboot ${loadaddr} u-boot-dtb.img
I have not tried with -dtb, I cannot say anything.
> Using FEC device
> TFTP from server 192.168.2.68; our IP address is 192.168.2.67
> Filename 'u-boot-dtb.img'.
> Load address: 0x12000000
> Loading: ########################################################
> 1.7 MiB/s
> done
> Bytes transferred = 282470 (44f66 hex)
> U-Boot > nand erase 0x200000 0x100000
>
> NAND erase: device 0 offset 0x200000, size 0x100000
> Erasing at 0x2c0000 -- 100% complete.
> OK
> U-Boot > nand write ${loadaddr} 0x200000 0x44f66
>
> NAND write: device 0 offset 0x200000, size 0x100000
> 1048576 bytes written: OK
>
> Boot Log:
> -----------
> U-Boot SPL 2016.07-ge1e54c7-dirty (Sep 26 2016 - 16:07:01)
> Trying to boot from unknown boot device
> SPL: Unsupported Boot Device!
> SPL: failed to boot from all boot devices
> ### ERROR ### Please RESET the board ###
This is just because the boot device from the src register is not as
expected. I think it does not try at all to load from NAND.
>
> When I add prints on SPL to find whether it is nand bootmode or not?
> and then did a same nand operations I ended up getting the same SPL
> log always.
>
./arch/arm/imx-common/spl.c:
spl_boot_device()
/* NAND Flash: 8.5.2 */
case 0x8 ... 0xf:
return BOOT_DEVICE_NAND;
Best regards,
Stefano
--
=====================================================================
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
More information about the U-Boot
mailing list