[U-Boot-Users] Can I write to flash using mw command
Jerry Van Baren
gerald.vanbaren at smiths-aerospace.com
Fri Oct 6 14:22:17 CEST 2006
bilahari akkiraju wrote:
> I did
>
> protect off all
>
>
> I have tried the following command sequences but didnt
> succeed in my objective of writing to and erasing
> first sector on flash.
>
> WRITE COMMAND SEQUENCE:
>
> mw ff000555 00AA00AA
> mw ff0002AA 00550055
> mw ff000555 00A000A0
> mw ff000000 12345678
>
>
> SECTOR ERASE COMMAND SEQUENCE:
>
> mw ff000555 00AA00AA
> mw ff0002AA 00550055
> mw ff000555 00800080
> mw ff000555 00AA00AA
> mw ff0002AA 00550055
> mw ff000000 00300030
>
> Note: I tried mw.b, mw.w, mw.l with appropriate data
> but didnt succeed.
>
> In first place is it possible to write to AMD flash
> manually like this or shud it be done only
> programatically. Any one has tried writing to flash
> this way before ( I could write to Intel strata flash
> this way).
>
> I walked through u-boot code for cfi_flash.c and
> flash_write() function that is called when cp (copy)
> command is invoked, the code does the same thing, the
> only extra thing it does is it polls on data register
> bits for a certain amount of time (flash erase, write
> timeout intervals) and also does a reset to bring back
> device to read array mode
>
> mw.w ff000000 00F0 ; reset cmd
>
>
> I have a ppc 8343 processor on board. I am wondering
> if U-boot that came with my target board has
> configuration that is preventing me to write to flash
> (but cp commands works fine with flash). Any one who
> has same spansion flash chip s29GL064M can try it, I
> cannot figure out the missing link in the chain, any
> advise, comments, suggestion will be of great help
>
> Thanks,
> Bilahari
You can write to flash by hand, if you do it right. It is a good way to
learn how to do it programatically.
I believe the addresses you are using are wrong because your example
shows two 16 bit chips to make up your 32 bits of data. This means that
the LSB address line becomes a chip select between the two chips
(logically, if not physically) and is not seen by the chips themselves.
The result is the chips see the addresses shifted right 1 bit.
Equivalently, you have shift your addresses left by 1 bit to compensate.
Chip address: xxx555 => 0101 0101 0101
Your address: xxxAAA => 101 0101 0101x (x is the dropped bit)
Or, regrouped: 1010 1010 101o
(filling in 'o' for the "unused" LSB)
Chip address: xxx2AA => 0010 1010 1010
Your address: xxx554 => 0001 0101 010x
Or, regrouped: 0001 0101 010o
(filling in 'o' for the "unused" LSB)
Try the following, I suspect it will work.
WRITE COMMAND SEQUENCE:
mw ff000AAA 00AA00AA
mw ff000554 00550055
mw ff000AAA 00A000A0
mw ff000000 12345678
The standard flash driver figures this all out for you and thus works.
gvb
More information about the U-Boot
mailing list