All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] Problem in writing downloaded image to NAND device
Date: Tue, 27 Nov 2007 10:23:58 +0100	[thread overview]
Message-ID: <200711271023.59251.sr@denx.de> (raw)
In-Reply-To: <596799.22980.qm@web94812.mail.in2.yahoo.com>

On Tuesday 27 November 2007, Dharmosoth Seetharam wrote:
> I have a problem in writing to NAND device.
>
> U-Boot 1.2.0 (Nov 27 2007 - 13:18:12)

Please try to upgrade to a recent version of U-Boot. 1.3.0 was released just a 
few days ago. Generally it is always recommended to use the most recent 
U-Boot version.

> Board - atmel
> cpu   - arm926ejs
> fs    - cramfs
> Os    - Linux, ARM based OS
>
> 64MB SDRAM and 256 MB NAND device.
>
> What i am trying to achieve is:
>   To copy the downloaded kernel image and fs image
>   to NAND device.
>
> What I have done is:
>    1) Downloaded the kernel image and fs image
>       using tftp download command at U-Boot.
>
>      *) tftp 0x22200000 kernel.img
>
>    ## Checking Image at 22200000 ...
>    Image Name:   Linux 2.6.22
>    Image Type:   ARM Linux Kernel Image (uncompressed)
>    Data Size:    1872572 Bytes =  1.8 MB
>    Load Address: 20008000
>    Entry Point:  20008000
>    Verifying Checksum ... OK
>    U-Boot>
>
>   kernel image is downloaded to SDRAM.
>
>   Now want to write this kernel image to NAND device.
>   U-Boot> nand device
>   Device 0: NAND 256MiB 3,3V 8-bit
>
>   U-Boot> nand write 0x22200000 0x0 0x200000
>   NAND write: device 0 offset 0x0, size 0x200000
>   2097152 bytes written: OK

Just try to read the image back into SDRAM and compare it to the original 
version:

=> nand read 22400000 0 200000
=> cmp.b 22200000 22400000 200000

Does this match? But again it is not worth the effort to debug such a problem 
in this older U-Boot version. Please upgrade. A lot changes in the NAND 
driver too.

>   U-Boot> nboot 0x22200000 0
>   Loading from NAND 256MiB 3,3V 8-bit, offset 0x0
>   Magic Number : 0x0 , required : 0x27051956
>   Image Name:
>   Image Type:   Invalid CPU Invalid OS Invalid Image
> (uncompressed)
>    Data Size:    0 Bytes =  0 kB
>    Load Address: 00000000
>    Entry Point:  00000000
>    U-Boot>
>
>
>  I have looked @ the code for NAND write
>
>  nand_write() --> nand_write_ecc() -->
>  nand_write_page() --> nand_write_buf() --> writeb()
>
>  in nand_write_buf() :
>
>  for (i=0; i<len; i++) {
>       writeb(buf[i], this->IO_ADDR_W);
>
> << writeb is defined as
>    (*(volatile unsigned char *)(a) = (v)) >>
>
>  As per the above for loop every character (ie.
> buf[i])
> going to written @ the address this->IO_ADDR_W (??).
>
> But, What we need is, start address and len to
> write into the NAND device.
>
>
> Can you please look at this and help me in this
> regard.
>
> My main goal here is to write to NAND device.
>
> I wrote my own function to write to NAND device, but
> somehow they are getting modified once the command
> finishes the execution.

Don't write "own functions". Use the existing ones and fix them if necessary.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================

  reply	other threads:[~2007-11-27  9:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-27  9:04 [U-Boot-Users] Problem in writing downloaded image to NAND device Dharmosoth Seetharam
2007-11-27  9:23 ` Stefan Roese [this message]
2007-11-27 15:40   ` Dharmosoth Seetharam
2007-11-27 18:31     ` Stefan Roese
2007-11-27 22:08     ` Wolfgang Denk
2007-11-28 10:45       ` Dharmosoth Seetharam
2007-11-28 11:00         ` Stefan Roese
2007-11-29 11:04           ` Dharmosoth Seetharam
2007-11-29 11:21             ` Stefan Roese

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200711271023.59251.sr@denx.de \
    --to=sr@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.