[U-Boot,PATCHv2] da850: Add instructions to copy AIS image to NAND

Submitted by ahaslam@baylibre.com on March 17, 2017, 3:55 p.m.

Details

Message ID 20170317155523.25809-1-ahaslam@baylibre.com
State Accepted
Commit daa483debea9596f23f5869f7623cec1ef761718
Delegated to: Tom Rini
Headers show

Commit Message

ahaslam@baylibre.com March 17, 2017, 3:55 p.m.
Add instructions to write an AIS image to NAND
by using the u-boot nand tools.

Signed-off-by: Axel Haslam <ahaslam@baylibre.com>
---
Changes in V2:
- add erase command before write
- Add write info when MTD partitions are defined

 board/davinci/da8xxevm/README.da850 | 41 +++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

Comments

Sekhar Nori March 20, 2017, 5:36 a.m.
Hi Axel,

On Friday 17 March 2017 09:25 PM, Axel Haslam wrote:
> Add instructions to write an AIS image to NAND
> by using the u-boot nand tools.
> 
> Signed-off-by: Axel Haslam <ahaslam@baylibre.com>
> ---
> Changes in V2:
> - add erase command before write
> - Add write info when MTD partitions are defined
> 
>  board/davinci/da8xxevm/README.da850 | 41 +++++++++++++++++++++++++++++++++++++
>  1 file changed, 41 insertions(+)
> 
> diff --git a/board/davinci/da8xxevm/README.da850 b/board/davinci/da8xxevm/README.da850
> index 29cb4ec..519267e 100644
> --- a/board/davinci/da8xxevm/README.da850
> +++ b/board/davinci/da8xxevm/README.da850
> @@ -47,6 +47,47 @@ U-Boot > sf erase 0 +320000
>  U-Boot > tftp u-boot.ais
>  U-Boot > sf write c0700000 0 $filesize
>  
> +Flashing the images to NAND
> +===========================
> +The AIS image can be written to NAND using the u-boot "nand" commands.
> +
> +Example:
> +
> +OMAPL138_LCDK requires the AIS image to be written to the second block of
> +the NAND flash.
> +
> +From the "nand info" command we see that the second block would start at
> +offset 0x20000:
> +
> +  U-Boot > nand info
> +      sector size      128 KiB (0x20000)
> +      Page size       2048 b
> +
> +From the tftp command we see that we need to copy 0x74908 bytes from
> +memory address 0xc0700000 (0x75000 if we align a page of 2048):
> +
> +  U-Boot > tftp u-boot.ais
> +      Load address: 0xc0700000
> +      Bytes transferred = 477448 (74908 hex)
> +
> +The commands to write the image from memory to NAND would be:
> +
> +  U-Boot > nand erase 0x20000 0x75000
> +  U-Boot > nand write 0xc0700000 0x20000 0x75000
> +
> +Alternatively, MTD partitions may be defined. Using "mtdparts" to
> +conveniently have a bootloader partition starting at the second block
> +(offset 0x20000):
> +
> +  setenv mtdids nand0=davinci_nand.0
> +  setenv mtdparts mtdparts=davinci_nand.0:128k(bootenv),2m(bootloader)
> +
> +In this case the commands would be simplified to:
> +
> +  U-Boot > tftp u-boot.ais
> +  U-Boot > nand erase.part bootloader
> +  U-Boot > nand write 0xc0700000 bootloader

Looks good to me now.

Perhaps the mtdparts setting above can be part of the default
environment itself ? So the additional step of setting them up can be
avoided. But that will be a separate patch.

Thanks,
Sekhar
ahaslam@baylibre.com March 21, 2017, 12:54 p.m.
On Mon, Mar 20, 2017 at 6:36 AM, Sekhar Nori <nsekhar@ti.com> wrote:
> Hi Axel,
>
> On Friday 17 March 2017 09:25 PM, Axel Haslam wrote:
>> Add instructions to write an AIS image to NAND
>> by using the u-boot nand tools.
>>
>> Signed-off-by: Axel Haslam <ahaslam@baylibre.com>
>> ---
>> Changes in V2:
>> - add erase command before write
>> - Add write info when MTD partitions are defined
>>
>>  board/davinci/da8xxevm/README.da850 | 41 +++++++++++++++++++++++++++++++++++++
>>  1 file changed, 41 insertions(+)
>>
>> diff --git a/board/davinci/da8xxevm/README.da850 b/board/davinci/da8xxevm/README.da850
>> index 29cb4ec..519267e 100644
>> --- a/board/davinci/da8xxevm/README.da850
>> +++ b/board/davinci/da8xxevm/README.da850
>> @@ -47,6 +47,47 @@ U-Boot > sf erase 0 +320000
>>  U-Boot > tftp u-boot.ais
>>  U-Boot > sf write c0700000 0 $filesize
>>
>> +Flashing the images to NAND
>> +===========================
>> +The AIS image can be written to NAND using the u-boot "nand" commands.
>> +
>> +Example:
>> +
>> +OMAPL138_LCDK requires the AIS image to be written to the second block of
>> +the NAND flash.
>> +
>> +From the "nand info" command we see that the second block would start at
>> +offset 0x20000:
>> +
>> +  U-Boot > nand info
>> +      sector size      128 KiB (0x20000)
>> +      Page size       2048 b
>> +
>> +From the tftp command we see that we need to copy 0x74908 bytes from
>> +memory address 0xc0700000 (0x75000 if we align a page of 2048):
>> +
>> +  U-Boot > tftp u-boot.ais
>> +      Load address: 0xc0700000
>> +      Bytes transferred = 477448 (74908 hex)
>> +
>> +The commands to write the image from memory to NAND would be:
>> +
>> +  U-Boot > nand erase 0x20000 0x75000
>> +  U-Boot > nand write 0xc0700000 0x20000 0x75000
>> +
>> +Alternatively, MTD partitions may be defined. Using "mtdparts" to
>> +conveniently have a bootloader partition starting at the second block
>> +(offset 0x20000):
>> +
>> +  setenv mtdids nand0=davinci_nand.0
>> +  setenv mtdparts mtdparts=davinci_nand.0:128k(bootenv),2m(bootloader)
>> +
>> +In this case the commands would be simplified to:
>> +
>> +  U-Boot > tftp u-boot.ais
>> +  U-Boot > nand erase.part bootloader
>> +  U-Boot > nand write 0xc0700000 bootloader
>
> Looks good to me now.
>
> Perhaps the mtdparts setting above can be part of the default
> environment itself ? So the additional step of setting them up can be
> avoided. But that will be a separate patch.

Yes, agree. i will send a patch for that.
-Regards
Axel.


>
> Thanks,
> Sekhar
>
Tom Rini March 21, 2017, 6:09 p.m.
On Fri, Mar 17, 2017 at 04:55:23PM +0100, ahaslam@baylibre.com wrote:

> Add instructions to write an AIS image to NAND
> by using the u-boot nand tools.
> 
> Signed-off-by: Axel Haslam <ahaslam@baylibre.com>

Applied to u-boot/master, thanks!

Patch hide | download patch | download mbox

diff --git a/board/davinci/da8xxevm/README.da850 b/board/davinci/da8xxevm/README.da850
index 29cb4ec..519267e 100644
--- a/board/davinci/da8xxevm/README.da850
+++ b/board/davinci/da8xxevm/README.da850
@@ -47,6 +47,47 @@  U-Boot > sf erase 0 +320000
 U-Boot > tftp u-boot.ais
 U-Boot > sf write c0700000 0 $filesize
 
+Flashing the images to NAND
+===========================
+The AIS image can be written to NAND using the u-boot "nand" commands.
+
+Example:
+
+OMAPL138_LCDK requires the AIS image to be written to the second block of
+the NAND flash.
+
+From the "nand info" command we see that the second block would start at
+offset 0x20000:
+
+  U-Boot > nand info
+      sector size      128 KiB (0x20000)
+      Page size       2048 b
+
+From the tftp command we see that we need to copy 0x74908 bytes from
+memory address 0xc0700000 (0x75000 if we align a page of 2048):
+
+  U-Boot > tftp u-boot.ais
+      Load address: 0xc0700000
+      Bytes transferred = 477448 (74908 hex)
+
+The commands to write the image from memory to NAND would be:
+
+  U-Boot > nand erase 0x20000 0x75000
+  U-Boot > nand write 0xc0700000 0x20000 0x75000
+
+Alternatively, MTD partitions may be defined. Using "mtdparts" to
+conveniently have a bootloader partition starting at the second block
+(offset 0x20000):
+
+  setenv mtdids nand0=davinci_nand.0
+  setenv mtdparts mtdparts=davinci_nand.0:128k(bootenv),2m(bootloader)
+
+In this case the commands would be simplified to:
+
+  U-Boot > tftp u-boot.ais
+  U-Boot > nand erase.part bootloader
+  U-Boot > nand write 0xc0700000 bootloader
+
 Flashing the images to MMC
 ==========================
 If the boot pins are set to boot from mmc, the RBL will try to load the