Skip to contentSkip to conversation

MPC850, read FLASH manufacturer ID, Mxu Board

U-Boot-Users Gerhard Butscher 2 participants 2 messages Feb 26, 2003

lore
Share & tools
lore
#0 lore raw

Hello,

We have an Infineon Switch Evaluation Board (MXU rev.B, MPC850), a Lauterbach Emulator. We started with the tqm850L configuration (u-boot 0.2.0).

- Reading manufacturer ID of FLASH doesn't work.

Using the VxWorks boot prompt commands it works to write the command sequence and then read the ID. We now managed to read the ID also with issuing FLASH writes/reads from Emulator.

The VxWorks boot prompt command uses "sth" assembler command to write to flash and the u-boot flash_get_size() command uses "stw" assembler code.

- Could someone explain why "sth" works and "stw" doesn't work in our case?

Thanks,
Gerhard

I saw while stepping in assembler, the u-boot code uses following commands to write the command sequence (first using original long, then using short which works!):

         short i;
         ulong value;
         ulong base = (ulong)addr;
801F0008            lwz       r0,0x8(r31)    ; r0,8(r31
901F0018            stw       r0,0x18(r31)   ; r0,24(r31
     unsigned short *flash_addr = (unsigned short *)addr
801F0008            lwz       r0,0x8(r31)    ; r0,8(r31
901F001C            stw       r0,0x1C(r31)   ; r0,28(r31
         /* Write auto select command: read Manufacturer ID */
         addr[0x0] = 0xAAAAAAAA
813F0008            lwz       r9,0x8(r31)    ; r9,8(r31
3C00AAAA            lis       r0,-0x5556     ; r0,-21846
6000AAAA            ori       r0,r0,0xAAAA   ; r0,r0,43690
90090000            stw       r0,0x0(r9)     ; r0,0(r9)
         addr[0x0] = 0x55555555;
813F0008            lwz       r9,0x8(r31)    ; r9,8(r31)
3C005555            lis       r0,0x5555      ; r0,2184
60005555            ori       r0,r0,0x5555   ; r0,r0,21845
90090000            stw       r0,0x0(r9)     ; r0,0(r9)
         addr[0x0] = 0x90909090;
813F0008            lwz       r9,0x8(r31)    ; r9,8(r31)
3C009090            lis       r0,-0x6F70     ; r0,-28528
60009090            ori       r0,r0,0x9090   ; r0,r0,37008
90090000            stw       r0,0x0(r9)     ; r0,0(r9
         value = addr[0];
813F0008            lwz       r9,0x8(r31)    ; r9,8(r31)
80090000            lwz       r0,0x0(r9)     ; r0,0(r9
901F0014            stw       r0,0x14(r31)   ; r0,20(r31
         /* Write auto select command: read Manufacturer ID */
         flash_addr[0x0] = 0xAAAA;
813F001C            lwz       r9,0x1C(r31)   ; r9,28(r31
3800AAAA            li        r0,-0x5556     ; r0,-2184
B0090000            sth       r0,0x0(r9)     ; r0,0(r9)
         flash_addr[0x0] = 0x5555;
813F001C            lwz       r9,0x1C(r31)   ; r9,28(r31)
38005555            li        r0,0x5555      ; r0,21845
B0090000            sth       r0,0x0(r9)     ; r0,0(r9)
         flash_addr[0x0] = 0x9090;
813F001C            lwz       r9,0x1C(r31)   ; r9,28(r31)
38009090            li        r0,-0x6F70     ; r0,-28528
B0090000            sth       r0,0x0(r9)     ; r0,0(r9)
         value = addr[0];
813F0008            lwz       r9,0x8(r31)    ; r9,8(r31)
80090000            lwz       r0,0x0(r9)     ; r0,0(r9)
901F0014            stw       r0,0x14(r31)   ; r0,20(r31)
#1 lore raw
Quoted 7 lines · In message <[email protected]> you wrote:

The VxWorks boot prompt command uses "sth" assembler command to write to flash and the u-boot flash_get_size() command uses "stw" assembler code.

- Could someone explain why "sth" works and "stw" doesn't work in our case?

You have to adjust the flash driver to your hardware. It depends on bus width (8, 16, 32 bit?), number of flash chips / flash width per bank.

Comon configurations are:

8 bit bus - 1 flash chip 8 bit
16 bit bus - 2 flash chips 8 bit
- 1 flash chip 16 bits
32 bit bus - 4 flash chips 8 bit
- 2 flash chips 16 bits

The TQM8xxL which you took as model uses a 32 bit bus with 2 flash chips at 16 bit. It uses word accesses to write to both flash chips at the same time.

You seem to have a different configuration, probably using a 16 bit bus with either 1 flash chip (16 bit) or 2 flash chips (2 x 8).

This is something you have to find out, and understand, yourself. Or hire someone to do it for you. But it's impossible for me here on the list to guess what your hardware looks like.

It is dangerous to copy code without thinking what it does.

Best regards,

Wolfgang Denk

Signature · 5 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd at denx.de
No, I'm not going to explain it. If you  can't  figure  it  out,  you
didn't want to know anyway... :-)
                   - Larry Wall in <[email protected]>