All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot]  i.MX6: NAND boot with SPL
@ 2016-09-26 15:35 Jagan Teki
  2016-09-26 16:00 ` Fabio Estevam
  2016-09-27  6:57 ` Stefano Babic
  0 siblings, 2 replies; 6+ messages in thread
From: Jagan Teki @ 2016-09-26 15:35 UTC (permalink / raw)
  To: u-boot

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?

So booted with MMC and trying to write the images from 1MB since I
read 0x0 on the flash shows FCB.

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

NAND write: device 0 offset 0x100000, size 0x100000
 1048576 bytes written: OK

U-Boot > tftpboot ${loadaddr} u-boot-dtb.img
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 ###

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.

Any help?

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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [U-Boot] i.MX6: NAND boot with SPL
  2016-09-26 15:35 [U-Boot] i.MX6: NAND boot with SPL Jagan Teki
@ 2016-09-26 16:00 ` Fabio Estevam
  2016-09-27  6:57 ` Stefano Babic
  1 sibling, 0 replies; 6+ messages in thread
From: Fabio Estevam @ 2016-09-26 16:00 UTC (permalink / raw)
  To: u-boot

Hi Jagan,

On Mon, Sep 26, 2016 at 12:35 PM, Jagan Teki <jagannadh.teki@gmail.com> 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?

I haven't tried it myself, but board/gateworks/gw_ventana/README says
it is supported.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] i.MX6: NAND boot with SPL
  2016-09-26 15:35 [U-Boot] i.MX6: NAND boot with SPL Jagan Teki
  2016-09-26 16:00 ` Fabio Estevam
@ 2016-09-27  6:57 ` Stefano Babic
  2016-09-28 14:40   ` Jagan Teki
  1 sibling, 1 reply; 6+ messages in thread
From: Stefano Babic @ 2016-09-27  6:57 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] i.MX6: NAND boot with SPL
  2016-09-27  6:57 ` Stefano Babic
@ 2016-09-28 14:40   ` Jagan Teki
  2016-09-28 14:51     ` Stefano Babic
  0 siblings, 1 reply; 6+ messages in thread
From: Jagan Teki @ 2016-09-28 14:40 UTC (permalink / raw)
  To: u-boot

Hi Stefano,

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] i.MX6: NAND boot with SPL
  2016-09-28 14:40   ` Jagan Teki
@ 2016-09-28 14:51     ` Stefano Babic
  2016-09-28 16:01       ` Jagan Teki
  0 siblings, 1 reply; 6+ messages in thread
From: Stefano Babic @ 2016-09-28 14:51 UTC (permalink / raw)
  To: u-boot

Hi Jagan,

On 28/09/2016 16:40, Jagan Teki wrote:

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

mmhh...I understand what is happening. You boot from MMC, and reading
the src registers, this is the boot device. NAND is not selected, then.

I would say this is a strange configuration: you boot from MMC (and
then, SPL and u-boot.img are on the MMC), or you boot from NAND, and bot
SPL + u-boot.img are on NAND. In the last case, you have to write SPL
according to the manual.

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

Best regards,
Stefano Babic

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] i.MX6: NAND boot with SPL
  2016-09-28 14:51     ` Stefano Babic
@ 2016-09-28 16:01       ` Jagan Teki
  0 siblings, 0 replies; 6+ messages in thread
From: Jagan Teki @ 2016-09-28 16:01 UTC (permalink / raw)
  To: u-boot

Hi Stefano,

On Wed, Sep 28, 2016 at 8:21 PM, Stefano Babic <sbabic@denx.de> wrote:
> Hi Jagan,
>
> On 28/09/2016 16:40, Jagan Teki wrote:
>
>>>
>>> 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.
>
> mmhh...I understand what is happening. You boot from MMC, and reading
> the src registers, this is the boot device. NAND is not selected, then.
>
> I would say this is a strange configuration: you boot from MMC (and
> then, SPL and u-boot.img are on the MMC), or you boot from NAND, and bot
> SPL + u-boot.img are on NAND. In the last case, you have to write SPL
> according to the manual.

1) _mmc_defconfig - I've enabled SPL for MMC and add NAND support to
that, so-that I can able to boot from MMC and trying to write on to
NAND.
2) *_nand_defconfig - I've enabled SPL for NAND one.

Once I booted with MMC as 1) I am trying to write NAND SPL which is
created as 2)

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-09-28 16:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-26 15:35 [U-Boot] i.MX6: NAND boot with SPL Jagan Teki
2016-09-26 16:00 ` Fabio Estevam
2016-09-27  6:57 ` Stefano Babic
2016-09-28 14:40   ` Jagan Teki
2016-09-28 14:51     ` Stefano Babic
2016-09-28 16:01       ` Jagan Teki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.