Skip to contentSkip to conversation

Suggestion on flash init

U-Boot-Users Bastos Fernandez Alexandre 1 participant 1 message Jan 4, 2006

lore
Share & tools
lore
#0 lore raw

Iark,

Just for reference, some time ago I posted two patches which may be useful for you in this case. Those weren't accepted yet, but this worked for me.

First, x8 bit support for AMD.

http://sourceforge.net/mailarchive/message.php?msg_id=12799051
http://article.gmane.org/gmane.comp.boot-loaders.u-boot/18621

I also posted another one which allows buffer writing on Spansion flashes

http://sourceforge.net/mailarchive/message.php?msg_id=12797909
http://article.gmane.org/gmane.comp.boot-loaders.u-boot/18620

Patches are included on those messages.

Best regards,

Alex

Quoted 227 lines

5. Re: Suggestion on flash init (Wang Jian)
7. Re: Suggestion on flash init (Wolfgang Denk)
8. Re: Suggestion on flash init (Wang Jian)
9. Re: Suggestion on flash init (Wolfgang Denk)

Message: 5
Date: Tue, 03 Jan 2006 21:16:03 +0800
From: Wang Jian <[email protected]>
To: Wang Jian <[email protected]>

Subject: Re: [U-Boot-Users] Suggestion on flash init
Cc: u-boot-users at lists.sourceforge.net

Hi Denk,

Me again.

In my situation, S29AL016M works in x8 mode, which has different command sequence from in x16 mode.

The following are from datasheet.

Providing
vu_char *addr = (vu_char *) info->start[sect];

x16 mode sector erase
addr[0x555] = 0xAA;
addr[0x2AA] = 0x55;
addr[0x555] = 0x80;
addr[0x555] = 0xAA;
addr[0x2AA] = 0x55;
addr[0x000] = 0x30;
udelay(50); // at least 50 us before polling for status

x16 mode program
addr[0x555] = 0xAA;
addr[0x2AA] = 0x55;
addr[0x555] = 0xA0;
addr[offset] = data;

x8 mode sector erase
addr[0xAAA] = 0xAA;
addr[0x555] = 0x55;
addr[0xAAA] = 0x80;
addr[0xAAA] = 0xAA;
addr[0x555] = 0x55;
addr[0x000] = 0x30;
udelay(50); // at least 50 us before polling for status

x8 mode program
addr[0xAAA] = 0xAA;
addr[0x555] = 0x55;
addr[0xAAA] = 0xA0;
addr[offset] = data;

I have little knowledge about other flash chips, so it is not easy for me to write clean patch for cfi_flash.c, although I want to.

Regards

Quoted 9 lines · Wang Jian

Hi Wolfgang Denk,

Quoted 4 lines · Wolfgang Denk
Quoted 3 lines · In message <[email protected]> you wrote:

I have tested cfi_flash.c for a while. Unfortuanately, it fails for Spansion S29AL016M. The chip can be recognized, chip information is

all

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

correct, but the erase and write routines fail.

Then please (lets) fix the problem instead of inventing the wheel

again.

Quoted 2 lines

After a bad sleep, I read the manual again. This time, I find the

cfi_flash.c

Quoted 3 lines

DOES do as what manual says. I will set some debug information and find what happend. Stay tune.

Signature · 12 lines
  lark



--__--__--

Message: 7
To: Wang Jian <[email protected]>
cc: u-boot-users at lists.sourceforge.net
From: Wolfgang Denk <[email protected]>
Subject: Re: [U-Boot-Users] Suggestion on flash init 
Date: Tue, 03 Jan 2006 15:08:42 +0100
Quoted 2 lines · In message <[email protected]> you wrote:

=20
In my situation, S29AL016M works in x8 mode, which has different comman=

d

Quoted 1 line

sequence from in x16 mode.

If you look closer it is not so different at all.

Quoted 7 lines

x16 mode sector erase
addr[0x555] =3D 0xAA;
addr[0x2AA] =3D 0x55;
addr[0x555] =3D 0x80;
addr[0x555] =3D 0xAA;
addr[0x2AA] =3D 0x55;
addr[0x000] =3D 0x30;

...

Quoted 7 lines

x8 mode sector erase
addr[0xAAA] =3D 0xAA;
addr[0x555] =3D 0x55;
addr[0xAAA] =3D 0x80;
addr[0xAAA] =3D 0xAA;
addr[0x555] =3D 0x55;
addr[0x000] =3D 0x30;

0x555 =3D 0xAAA >> 1
0x2AA =3D 0x555 >> 1

Quoted 2 lines

I have little knowledge about other flash chips, so it is not easy for me to write clean patch for cfi_flash.c, although I want to.

The code is actually the very same, just taking into account the different addressing mode.

Best regards,

Wolfgang Denk

--=20
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Another Armenia, Belgium ... the weak innocents who always seem to be located on a natural invasion route.

	-- Kirk, "Errand of Mercy", stardate 3198.4

--__--__--

Message: 8
Date: Tue, 03 Jan 2006 23:34:51 +0800
From: Wang Jian <[email protected]>
To: Wolfgang Denk <[email protected]>
Subject: Re: [U-Boot-Users] Suggestion on flash init
Cc: u-boot-users at lists.sourceforge.net

Hi Wolfgang Denk,

Quoted 3 lines · Wolfgang Denk
Quoted 2 lines · In message <[email protected]> you wrote:

In my situation, S29AL016M works in x8 mode, which has different

command

Quoted 20 lines
Quoted 1 line

sequence from in x16 mode.

If you look closer it is not so different at all.

Quoted 7 lines

x16 mode sector erase
addr[0x555] = 0xAA;
addr[0x2AA] = 0x55;
addr[0x555] = 0x80;
addr[0x555] = 0xAA;
addr[0x2AA] = 0x55;
addr[0x000] = 0x30;

...

Quoted 7 lines

x8 mode sector erase
addr[0xAAA] = 0xAA;
addr[0x555] = 0x55;
addr[0xAAA] = 0x80;
addr[0xAAA] = 0xAA;
addr[0x555] = 0x55;
addr[0x000] = 0x30;

Quoted 9 lines

0x555 = 0xAAA >> 1
0x2AA = 0x555 >> 1

Quoted 2 lines

I have little knowledge about other flash chips, so it is not easy for me to write clean patch for cfi_flash.c, although I want to.

The code is actually the very same, just taking into account the different addressing mode.

I am not sure if other kind of AMD flash chips use such x8/x16 command sequence. I am afraid that I will fix one thing and break other things.

Signature · 12 lines
  lark



--__--__--

Message: 9
To: Wang Jian <[email protected]>
cc: u-boot-users at lists.sourceforge.net
From: Wolfgang Denk <[email protected]>
Subject: Re: [U-Boot-Users] Suggestion on flash init 
Date: Tue, 03 Jan 2006 16:44:04 +0100
Quoted 3 lines · In message <[email protected]> you wrote:

=20
I am not sure if other kind of AMD flash chips use such x8/x16 command sequence. I am afraid that I will fix one thing and break other things.

They all do. At least all I can remember.

Best regards,

Wolfgang Denk

--=20
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Peace was the way.
-- Kirk, "The City on the Edge of Forever", stardate unknown