Skip to contentSkip to conversation

Problem using cfi_flash driver for s29GL512N flashes

U-Boot-Users santigopal_mondal at mindtree.com 2 participants 4 messages Nov 27, 2007 – Nov 28, 2007

lore
Share & tools
lore
#0 lore raw

Hi folks,

Greetings everybody..I am using u-boot1.1.5 for at91rm9200ek type board(arm). The flash memory used here is s29GL512N(128k sectors).I am able to configure the board/config flle properly it seems. The driver also erases/writes properly it seems. The problem is when I am trying to save environment variables it is getting set but in some cases after a reset it is showing Bad CRC and getting to the default environment. The other thing is I am not able to boot the kernel image from the flash due to some bad checksum error. Everywhere the problem is related to crc. I am a bit confused why the CRC check fails everytime? Is it not writing properly and if it is not writing properly then how it is able to get the u-boot prompt..

The required configurations defined

#define CFG_ENV_ADDR (CFG_FLASH_BASE + 0x20000)
#define CFG_ENV_SIZE 0x2000
#define CFG_ENV_SECT_SIZE 0x20000
#define CFG_MALLOC_LEN (CFG_ENV_SIZE + 128*1024)
#define CONFIG_STACKSIZE (32 * 1024)

The TEXT_BASE in config.mk :

TEXT_BASE 0x21F00000

Please help as soon as possible...

Thanks in advance and cheers

#1 lore raw
Quoted 2 lines · santigopal_mondal at mindtree.com

Greetings everybody..I am using u-boot1.1.5 for at91rm9200ek type
board(arm).

U-Boot 1.1.5 is *old*. I suggest upgrading to the current version. Lot's of things got fixed here.

Quoted 19 lines

The flash memory used here is s29GL512N(128k sectors).I am able to configure the board/config flle properly it seems. The driver also erases/writes properly it seems. The problem is when I am trying to save environment variables it is getting set but in some cases after a reset it is showing Bad CRC and getting to the default environment. The other thing is I am not able to boot the kernel image from the flash due to some bad checksum error. Everywhere the problem is related to crc. I am a bit confused why the CRC check fails everytime? Is it not writing properly and if it is not writing properly then how it is able to get the u-boot prompt..

The required configurations defined

#define CFG_ENV_ADDR (CFG_FLASH_BASE + 0x20000)
#define CFG_ENV_SIZE 0x2000
#define CFG_ENV_SECT_SIZE 0x20000
#define CFG_MALLOC_LEN (CFG_ENV_SIZE + 128*1024)
#define CONFIG_STACKSIZE (32 * 1024)

Quoted 5 lines

The TEXT_BASE in config.mk :

TEXT_BASE 0x21F00000

Please help as soon as possible...

Debugging this problem in the old U-Boot version doesn't seem to make sense to me. Please try to upgrade.

Best regards,
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 at denx.de
=====================================================================

#2 lore raw

Hi Stephan ,
Thanks for your help. The same problem remains with the upgraded version
also.

Is it something to do with the TEXT_BASE. The probelm is the data for
environment is written to flash properly. But when it checks for crc in env_init() the crc32 function fails. the env_ptr->crc is correct.

The environment sector when allocated in malloc area in main memory seems to
get corrupted because the crc field does not seem to be correct.

the Ram is 32 MB
TEXT_BASE 21F00000
CFG_GBL_DATA_SIZE 128
CFG_ENV_ADDR (CFG_FLASH_BASE + 0x20000)
CFG_ENV_SIZE 0x2000
CFG_ENV_SECT_SIZE 0x20000
CONFIG_STACKSIZE (32 * 1024)
CFG_MALLOC_LEN (CFG_ENV_SIZE + 128*1024)

thanks & regards
santi gopal

Santi Gopal Mondal
Senior Engineer, R&D Services
Mindtree Consulting
Mobile: 09886325167

-----Original Message-----
From: Stefan Roese [mailto:sr at denx.de]
Sent: Tue 11/27/2007 11:41 AM
To: u-boot-users at lists.sourceforge.net
Cc: Santigopal Mondal
Subject: Re: [U-Boot-Users] Problem using cfi_flash driver for s29GL512N flashes

Quoted 2 lines · santigopal_mondal at mindtree.com

Greetings everybody..I am using u-boot1.1.5 for at91rm9200ek type
board(arm).

U-Boot 1.1.5 is *old*. I suggest upgrading to the current version. Lot's of things got fixed here.

Quoted 19 lines

The flash memory used here is s29GL512N(128k sectors).I am able to configure the board/config flle properly it seems. The driver also erases/writes properly it seems. The problem is when I am trying to save environment variables it is getting set but in some cases after a reset it is showing Bad CRC and getting to the default environment. The other thing is I am not able to boot the kernel image from the flash due to some bad checksum error. Everywhere the problem is related to crc. I am a bit confused why the CRC check fails everytime? Is it not writing properly and if it is not writing properly then how it is able to get the u-boot prompt..

The required configurations defined

#define CFG_ENV_ADDR (CFG_FLASH_BASE + 0x20000)
#define CFG_ENV_SIZE 0x2000
#define CFG_ENV_SECT_SIZE 0x20000
#define CFG_MALLOC_LEN (CFG_ENV_SIZE + 128*1024)
#define CONFIG_STACKSIZE (32 * 1024)

Quoted 5 lines

The TEXT_BASE in config.mk :

TEXT_BASE 0x21F00000

Please help as soon as possible...

Debugging this problem in the old U-Boot version doesn't seem to make sense to
me. Please try to upgrade.

Best regards,
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 at denx.de
=====================================================================

DISCLAIMER:
This message (including attachment if any) is confidential and may be privileged. If you have received this message by mistake please notify the sender by return e-mail and delete this message from your system. Any unauthorized use or dissemination of this message in whole or in part is strictly prohibited. E-mail may contain viruses. Before opening attachments please check them for viruses and defects. While MindTree Consulting Limited (MindTree) has put in place checks to minimize the risks, MindTree will not be responsible for any viruses or defects or any forwarded attachments emanating either from within MindTree or outside. Please note that e-mails are susceptible to change and MindTree shall not be liable for any improper, untimely or incomplete transmission.
MindTree reserves the right to monitor and review the content of all messages sent to or from MindTree e-mail address. Messages sent to or from this e-mail address may be stored on the MindTree e-mail system or else where.

#3 lore raw

Hi Santi Gopal,

Quoted 11 lines · Santigopal Mondal

Thanks for your help. The same problem remains with the upgraded version
also.

Is it something to do with the TEXT_BASE. The probelm is the data for
environment is written to flash properly. But when it checks for crc in env_init() the crc32 function fails. the env_ptr->crc is correct.

The environment sector when allocated in malloc area in main memory seems
to get corrupted because the crc field does not seem to be correct.

Quoted 8 lines

the Ram is 32 MB
TEXT_BASE 21F00000
CFG_GBL_DATA_SIZE 128
CFG_ENV_ADDR (CFG_FLASH_BASE + 0x20000)
CFG_ENV_SIZE 0x2000
CFG_ENV_SECT_SIZE 0x20000
CONFIG_STACKSIZE (32 * 1024)
CFG_MALLOC_LEN (CFG_ENV_SIZE + 128*1024)

Here the CFI settings I currently use on some AMCC eval boards like sequoia.h:

#define CFG_FLASH_BASE          0xfc000000      /* start of FLASH       */
#define CFG_MONITOR_LEN         (384 * 1024)    /* Reserve 384 kB for Monitor   */

/*-----------------------------------------------------------------------
* FLASH related *----------------------------------------------------------------------*/

#define CFG_FLASH_CFI                           /* The flash is CFI compatible  */
#define CFG_FLASH_CFI_DRIVER                    /* Use common CFI driver        */

#define CFG_FLASH_BANKS_LIST { CFG_FLASH_BASE }

#define CFG_MAX_FLASH_BANKS     1       /* max number of memory banks           */
#define CFG_MAX_FLASH_SECT      512     /* max number of sectors on one chip    */
#define CFG_FLASH_ERASE_TOUT    120000  /* Timeout for Flash Erase (in ms)      */
#define CFG_FLASH_WRITE_TOUT    500     /* Timeout for Flash Write (in ms)      */
#define CFG_FLASH_USE_BUFFER_WRITE 1    /* use buffered writes (20x faster)     */
#define CFG_FLASH_PROTECTION    1       /* use hardware flash protection        */

#define CFG_FLASH_EMPTY_INFO /* print 'E' for empty sector on flinfo */

#ifdef CFG_ENV_IS_IN_FLASH

#define CFG_ENV_SECT_SIZE       0x20000 /* size of one complete sector          */
#define CFG_ENV_ADDR            ((-CFG_MONITOR_LEN)-CFG_ENV_SECT_SIZE)
#define CFG_ENV_SIZE            0x2000  /* Total Size of Environment Sector     */

/* Address and size of Redundant Environment Sector */
#define CFG_ENV_ADDR_REDUND (CFG_ENV_ADDR-CFG_ENV_SECT_SIZE)
#define CFG_ENV_SIZE_REDUND (CFG_ENV_SIZE)
#endif

Please note that on these PPC4xx platforms, U-Boot is located at the *end* of the FLASH, since the reset vector has to be at 0xfffffffc. So with an U-Boot image size of 0x60000 the location is 0xfffa0000...0xffffffff.

Best regards,
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 at denx.de
=====================================================================