Re: [U-Boot] Query: Does Uboot support CFI flash driver for M29W128GH

Hi All,
I am using a flash memory chip M29W128GH. As per datasheet this memory chip is CFI compliant and so I should use the common CFI flash driver for this chip.
But I have seen some review comments on internet saying that UBoot have some error while resetting the M29W128GH flash chip. But in Uboot source code I am not seeing any instances of M29W128GH.
Does UBoot support the flash driver for Flash memory chip M29W128GH? If yes then which flash driver I should use? Will it be from /common folder or specific board folder?
Thanks & regards, Prakash Bedge

Hi Prakash,
There is a CFI flash driver as you have found it in drivers/. The command set will be same for all the CFI complaint flash chips.
So the cfi_driver.c file will work for you.
-Sreedhar
-----Original Message----- From: u-boot-bounces@lists.denx.de [mailto:u-boot-bounces@lists.denx.de] On Behalf Of prakash bedge Sent: Tuesday, October 27, 2009 2:40 PM To: u-boot@lists.denx.de Subject: Re: [U-Boot] Query: Does Uboot support CFI flash driver forM29W128GH
Hi All,
I am using a flash memory chip M29W128GH. As per datasheet this memory chip is CFI compliant and so I should use the common CFI flash driver for this chip.
But I have seen some review comments on internet saying that UBoot have some error while resetting the M29W128GH flash chip. But in Uboot source code I am not seeing any instances of M29W128GH.
Does UBoot support the flash driver for Flash memory chip M29W128GH? If yes then which flash driver I should use? Will it be from /common folder or specific board folder?
Thanks & regards, Prakash Bedge

Hi Sreedhar,
Are there some unknwon issues that I should take care of while using this driver for M29W128GH?
M29W128GH is following AMD cmdset. Do I need to add the structure for M29W128GH in jedec_flash.c or there is some chip compatible to this chip is already present in Uboot and I only have to use as it is.
Regards, Prakash
On Tue, Oct 27, 2009 at 3:51 PM, Sreedhar.a sreedhar.a@jasmin-infotech.comwrote:
Hi Prakash,
There is a CFI flash driver as you have found it in drivers/. The command set will be same for all the CFI complaint flash chips.
So the cfi_driver.c file will work for you.
-Sreedhar
-----Original Message----- From: u-boot-bounces@lists.denx.de [mailto:u-boot-bounces@lists.denx.de] On Behalf Of prakash bedge Sent: Tuesday, October 27, 2009 2:40 PM To: u-boot@lists.denx.de Subject: Re: [U-Boot] Query: Does Uboot support CFI flash driver forM29W128GH
Hi All,
I am using a flash memory chip M29W128GH. As per datasheet this memory chip is CFI compliant and so I should use
the
common CFI flash driver for this chip.
But I have seen some review comments on internet saying that UBoot have some error while resetting the M29W128GH flash chip. But in Uboot source code I am not seeing any instances of M29W128GH.
Does UBoot support the flash driver for Flash memory chip M29W128GH? If yes then which flash driver I should use? Will it be from /common folder or specific board folder?
Thanks & regards, Prakash Bedge

On Tuesday 27 October 2009 14:13:05 prakash bedge wrote:
Are there some unknwon issues that I should take care of while using this driver for M29W128GH?
Searching the mailing list, you will notice one thread [Question about M29W128G CFI QRY bug] which reports of a problem with the current version of the common CFI driver and this chip. I just sent out a patch that should fix this issue.
M29W128GH is following AMD cmdset. Do I need to add the structure for M29W128GH in jedec_flash.c or there is some chip compatible to this chip is already present in Uboot and I only have to use as it is.
No, this chip should be CFI compatible. So you don't need to add any code to jedec_flash.c. This is only for legacy JEDEC NOR chips.
Cheers, 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@denx.de

Hi Stefan,
Thanks. I have seen that patch work and I will try it and hope it will work for M29W128GH (ST make).
But why I am not seeing the chip name and any instance of M29W128GH in Uboot source code? Is it because the chip is CFI compliant? How I can crosscheck that present Uboot V2009.08 works for M29W128GH? Which folder I should check for that? I believe the Patch sent by you will work in this version.
Thanks & regards, Prakash
On Tue, Oct 27, 2009 at 8:04 PM, Stefan Roese sr@denx.de wrote:
On Tuesday 27 October 2009 14:13:05 prakash bedge wrote:
Are there some unknwon issues that I should take care of while using this driver for M29W128GH?
Searching the mailing list, you will notice one thread [Question about M29W128G CFI QRY bug] which reports of a problem with the current version of the common CFI driver and this chip. I just sent out a patch that should fix this issue.
M29W128GH is following AMD cmdset. Do I need to add the structure for M29W128GH in jedec_flash.c or there
is
some chip compatible to this chip is already present in Uboot and I only have to use as it is.
No, this chip should be CFI compatible. So you don't need to add any code to jedec_flash.c. This is only for legacy JEDEC NOR chips.
Cheers, 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@denx.de

Hi Prakash,
On Wednesday 28 October 2009 07:23:31 prakash bedge wrote:
Thanks. I have seen that patch work and I will try it and hope it will work for M29W128GH (ST make).
But why I am not seeing the chip name and any instance of M29W128GH in Uboot source code? Is it because the chip is CFI compliant?
Yes. For CFI compliant chips features like sector count, sector sizes etc are autodetected. No need to define the chip with it's ID anywhere.
How I can crosscheck that present Uboot V2009.08 works for M29W128GH? Which folder I should check for that? I believe the Patch sent by you will work in this version.
You should test it with the latest version of mainline U-Boot:
http://git.denx.de/?p=u-boot.git;a=summary
Please note that you need to add a board specific flash_cmd_reset() function for this chip to work correctly. Something like this should work (untested):
void flash_cmd_reset(flash_info_t *info) { flash_write_cmd(info, 0, 0, AMD_CMD_RESET); }
Cheers, 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@denx.de

Hi Stefan,
Thanks for information.
Can you please send me the patch details to fixup the CFI query related bug for M29W128GH?
In the code for each header file there is a macro named CONFIG_FLASH_CFI_DRIVER defined in each board specific header file in folder /include/configs. But I am not seeing any #ifdef for this macro in code. Where this macro is being checked in the code?
Is there any documentation giving details on how the CFI flash driver executes in U-Boot? Please share the document if you have.
Thanks & Regards, Prakash
On Wed, Oct 28, 2009 at 1:38 PM, Stefan Roese sr@denx.de wrote:
Hi Prakash,
On Wednesday 28 October 2009 07:23:31 prakash bedge wrote:
Thanks. I have seen that patch work and I will try it and hope it will
work
for M29W128GH (ST make).
But why I am not seeing the chip name and any instance of M29W128GH in Uboot source code? Is it because the chip is CFI compliant?
Yes. For CFI compliant chips features like sector count, sector sizes etc are autodetected. No need to define the chip with it's ID anywhere.
How I can crosscheck that present Uboot V2009.08 works for M29W128GH?
Which
folder I should check for that? I believe the Patch sent by you will work in this version.
You should test it with the latest version of mainline U-Boot:
http://git.denx.de/?p=u-boot.git;a=summary
Please note that you need to add a board specific flash_cmd_reset() function for this chip to work correctly. Something like this should work (untested):
void flash_cmd_reset(flash_info_t *info) { flash_write_cmd(info, 0, 0, AMD_CMD_RESET); }
Cheers, 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@denx.de

Hi Prakash,
On Thursday 29 October 2009 07:24:25 prakash bedge wrote:
Can you please send me the patch details to fixup the CFI query related bug for M29W128GH?
I did send you the patch in my last mail. You just need to add this code to a board specific file, e.g. board/board_name/board_name.c.
In the code for each header file there is a macro named CONFIG_FLASH_CFI_DRIVER defined in each board specific header file in folder /include/configs. But I am not seeing any #ifdef for this macro in code. Where this macro is being checked in the code?
It's in the makefile (drivers/mdt/Makefile).
Is there any documentation giving details on how the CFI flash driver executes in U-Boot?
It's really simple, just copy the config options and change some values like CONFIG_SYS_FLASH_BANKS_LIST, CONFIG_SYS_MAX_FLASH_BANKS according to your hardware specs. Take a look at zeus for example:
#define CONFIG_SYS_FLASH_CFI /* The flash is CFI compatible */ #define CONFIG_FLASH_CFI_DRIVER /* Use common CFI driver */
#define CONFIG_SYS_FLASH_BANKS_LIST { CONFIG_SYS_FLASH_BASE }
#define CONFIG_SYS_MAX_FLASH_BANKS 1 /* max number of memory banks */ #define CONFIG_SYS_MAX_FLASH_SECT 512 /* max number of sectors on one chip */
#define CONFIG_SYS_FLASH_ERASE_TOUT 120000 /* Timeout for Flash Erase (in ms) */ #define CONFIG_SYS_FLASH_WRITE_TOUT 500 /* Timeout for Flash Write (in ms) */
#define CONFIG_SYS_FLASH_USE_BUFFER_WRITE 1 /* use buffered writes (20x faster) */ #define CONFIG_SYS_FLASH_PROTECTION 1 /* use hardware flash protection */
#define CONFIG_SYS_FLASH_EMPTY_INFO /* print 'E' for empty sector on flinfo */ #define CONFIG_SYS_FLASH_QUIET_TEST 1 /* don't warn upon unknown flash */
This shouldn't be too hard.
Cheers, 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@denx.de

Hi Stefan,
I have did the same. Thanks for all infomation given so far.
Regards, Prakash On Thu, Oct 29, 2009 at 12:51 PM, Stefan Roese sr@denx.de wrote:
Hi Prakash,
On Thursday 29 October 2009 07:24:25 prakash bedge wrote:
Can you please send me the patch details to fixup the CFI query related
bug
for M29W128GH?
I did send you the patch in my last mail. You just need to add this code to a board specific file, e.g. board/board_name/board_name.c.
In the code for each header file there is a macro named CONFIG_FLASH_CFI_DRIVER defined in each board specific header file in folder /include/configs. But I am not seeing any #ifdef for this macro
in
code. Where this macro is being checked in the code?
It's in the makefile (drivers/mdt/Makefile).
Is there any documentation giving details on how the CFI flash driver executes in U-Boot?
It's really simple, just copy the config options and change some values like CONFIG_SYS_FLASH_BANKS_LIST, CONFIG_SYS_MAX_FLASH_BANKS according to your hardware specs. Take a look at zeus for example:
#define CONFIG_SYS_FLASH_CFI /* The flash is CFI compatible */ #define CONFIG_FLASH_CFI_DRIVER /* Use common CFI driver */
#define CONFIG_SYS_FLASH_BANKS_LIST { CONFIG_SYS_FLASH_BASE }
#define CONFIG_SYS_MAX_FLASH_BANKS 1 /* max number of memory banks */ #define CONFIG_SYS_MAX_FLASH_SECT 512 /* max number of sectors on one chip */
#define CONFIG_SYS_FLASH_ERASE_TOUT 120000 /* Timeout for Flash Erase (in ms) */ #define CONFIG_SYS_FLASH_WRITE_TOUT 500 /* Timeout for Flash Write (in ms) */
#define CONFIG_SYS_FLASH_USE_BUFFER_WRITE 1 /* use buffered writes (20x faster) */ #define CONFIG_SYS_FLASH_PROTECTION 1 /* use hardware flash protection */
#define CONFIG_SYS_FLASH_EMPTY_INFO /* print 'E' for empty sector on flinfo */ #define CONFIG_SYS_FLASH_QUIET_TEST 1 /* don't warn upon unknown flash */
This shouldn't be too hard.
Cheers, 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@denx.de
participants (3)
-
prakash bedge
-
Sreedhar.a
-
Stefan Roese