2011-04-08 23:28:33     Problem on configuration for flash M29W800DB

Document created by Aaronwu Employee on Sep 25, 2013
Version 1Show Document
  • View in full screen mode

2011-04-08 23:28:33     Problem on configuration for flash M29W800DB

Jianxi Fu (UNITED STATES)

Message: 99708   

 

Hi all,

 

I have a new board (BF536-3A, 16Mbytes SDram, 1Mbytes Flash: M29W800DB)

 

I followed the instruction of wiki document to port U-boot(2010R1-RC2) to my custom Blackfin board.

 

There is a problem on setting for flash,

 

============================================================

 

bfin> flinfo

 

Bank # 1: CFI conformant FLASH (16 x 16)  Size: 1 MB in 19 Sectors

  AMD Standard command set, Manufacturer ID: 0x20, Device ID: 0x22D7

  Erase timeout: 8192 ms, write timeout: 1 ms

 

  Sector Start Addresses:

  20000000        20004000        20006000        20008000        20010000

  20020000        20030000        20040000        20050000        20060000

  20070000        20080000        20090000        200A0000        200B0000

  200C0000        200D0000        200E0000        200F0000

 

============================================================

 

The sectors information is wrong. It looks like the U-boot just take the first 19 sectors information of M29W320DT (default flash for BF537-STAMP)

 

I just used the setting following:

 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 

/* Memory Settings */

#define CONFIG_EBIU_AMGCTL_VAL 0xF3

#define CONFIG_EBIU_AMBCTL0_VAL 0x7BB07BB0

#define CONFIG_EBIU_AMBCTL1_VAL 0x7BB07BB0

 

 

/* Board independent required settings */

#define CONFIG_SYS_FLASH_CFI                 /* Flash is CFI compliant */

#define CONFIG_FLASH_CFI_DRIVER              /* Use the common CFI flash driver */

 

/* Board dependent required settings */

#define CONFIGS_SYS_FLASH_BASE       0x20000000   /* Address flash is mapped */

/* Max number of banks -- can be greater than available, but cannot be smaller */

#define CONFIG_SYS_MAX_FLASH_BANKS   1

/* Max number of sectors -- can be greater than available, but cannot be smaller */

#define CONFIG_SYS_MAX_FLASH_SECT    19

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 

I think I have missed somthing. Does common CFI flash driver can work?

 

And I found (\include\flash.h) does have M29W800DB

 

Could someone give me some help?

 

M29W320DT and M29W800DB have some commands. Only differences are the memory size and the block addresses.

 

With Best

 

Jianxi

QuoteReplyEditDelete

 

 

2011-04-09 04:12:53     Re: Problem on configuration for flash M29W800DB

Jianxi Fu (UNITED STATES)

Message: 99711   

 

Sorry, I made a mistake, My flash should be M29W800DT "top boot sector" types!

 

The correct adresses should be

 

0     0x00000     0x0FFFF     64K

1     0x10000     0x1FFFF     64K

2     0x20000     0x2FFFF     64K

3     0x30000     0x3FFFF     64K

4     0x40000     0x4FFFF     64K

5     0x50000     0x5FFFF     64K

6     0x60000     0x6FFFF     64K

7     0x70000     0x7FFFF     64K

8     0x80000     0x8FFFF     64K

9     0x90000     0x9FFFF     64K

10     0xA0000     0xAFFFF     64K

11     0xB0000     0xBFFFF     64K

12     0xC0000     0xCFFFF     64K

13     0xD0000     0xDFFFF     64K

14     0xE0000     0xEFFFF     64K

15     0xF0000     0xF7FFF     32K

16     0xF8000     0xF9FFF     8K

17     0xFA000     0xFBFFF     8K

18     0xFC000     0xFFFFF     16K

QuoteReplyEditDelete

 

 

2011-04-09 09:16:38     Re: Problem on configuration for flash M29W800DB

Mike Frysinger (UNITED STATES)

Message: 99712   

 

no sector info is hardcoded in u-boot.  it all comes from querying the flash with CFI.

QuoteReplyEditDelete

 

 

2011-04-09 11:10:11     Re: Problem on configuration for flash M29W800DB

Jianxi Fu (UNITED STATES)

Message: 99714   

 

Mike,

 

Yes, you are right.

However, could you give me some more detail?

 

I have checked the source code \drivers\mtd\cfi_flash.c (Is it right?)

And I have that there is function: unsigned long flash_init (void)

 

From the Wiki, Iknow that

 

 

=================================

 

U-Boot initializes remaining services: lib_blackfin/board.c:board_init_r()

 

    Initialize malloc subsystem

    Initialize parallel flash (if enabled)

    Initialize SPI flash (if enabled)

    Initialize NAND flash (if enabled)

 

=================================

 

There are the questions:

(1) Does the parallel flash already be Initialized automatically?

(2)  The result looks that flash_init() get a wrong return?

QuoteReplyEditDelete

 

 

2011-04-09 13:54:26     Re: Problem on configuration for flash M29W800DB

Mike Frysinger (UNITED STATES)

Message: 99718   

 

the CFI code queries the flash at boot and uses the information the flash gives it to construct the table.  you can step through the code in cfi_flash.c to see why things are not going the way you expect.

QuoteReplyEditDelete

 

 

2011-04-09 14:58:13     Re: Problem on configuration for flash M29W800DB

Jianxi Fu (UNITED STATES)

Message: 99719   

 

Mike,

 

I found the reason in the cfi_flash.c

 

I just add my device ID: 0x22D7, and let the flash map reverse.

 

The problem has been fixed.

 

Thank you very much~

 

Jianxi

 

===================================================

 

static void flash_fixup_stm(flash_info_t *info, struct cfi_qry *qry)

{

/* check if flash geometry needs reversal */

if (qry->num_erase_regions > 1) {

  /* reverse geometry if top boot part */

  if (info->cfi_version < 0x3131) {

   /* CFI < 1.1, guess by device id (M29W320{DT,ET} only) */

   if (info->device_id == 0x22CA ||

       info->device_id == 0x22D7) {

    cfi_reverse_geometry(qry);

   }

  }

}

}

 

 

====================================================

QuoteReplyEditDelete

 

 

2011-04-12 02:43:36     Re: Problem on configuration for flash M29W800DB

Mike Frysinger (UNITED STATES)

Message: 99773   

 

ive committed a patch to the latest git trunk if you want to verify it fixes things for you

QuoteReplyEditDelete

Attachments

    Outcomes