From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Chou Date: Thu, 06 Jan 2011 10:36:27 +0800 Subject: [U-Boot] [PATCH] nios2: reset cfi flash before reading env In-Reply-To: <20110105081529.C430ED31214@gemini.denx.de> References: <1294211855-18584-1-git-send-email-thomas@wytron.com.tw> <20110105081529.C430ED31214@gemini.denx.de> Message-ID: <4D252AAB.6040308@wytron.com.tw> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 01/05/2011 04:15 PM, Wolfgang Denk wrote: > Instead of making fixed assumptions about flash type and it's > properties here you should use generic routines from the CFI driver to > do the reset. > Dear Wolfgang, env_init() goes before flash_init() in board.c. So we don't know the flash type and cannot use those generic cfi routines based on flash_info. I followed this in cfi_flash.c void __flash_cmd_reset(flash_info_t *info) { /* * We do not yet know what kind of commandset to use, so we issue * the reset command in both Intel and AMD variants, in the hope * that AMD flash roms ignore the Intel command. */ flash_write_cmd(info, 0, 0, AMD_CMD_RESET); flash_write_cmd(info, 0, 0, FLASH_CMD_RESET); } I am not sure if this thing should be added to generic code, because I found powerpc skiped flash_init when board_flash_wp_on in board.c. Best regards, Thomas