[U-Boot] i.MX6: NAND boot with SPL

Jagan Teki jagannadh.teki at gmail.com
Wed Sep 28 16:40:14 CEST 2016


Hi Stefano,

On Tue, Sep 27, 2016 at 12:27 PM, Stefano Babic <sbabic at denx.de> wrote:
> 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 ?

I booted through MMC first since it's only possible way to boot. And
my plan is to write nand with MMC boot.

>
> 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.

Correct, I am planning to try this on Linux through kobs-ng, based on
the info from gw_ventana and let you know.

>
>>
>> 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.

I find it it is taking boot image from MMC even if I set the NAND
bootmode with MMC card pluged in. Anyway I cleared with this.

thanks!
-- 
Jagan Teki
Free Software Engineer | www.openedev.com
U-Boot, Linux | Upstream Maintainer
Hyderabad, India.


More information about the U-Boot mailing list