From: Wolfgang Denk Date: Mon, 17 Jan 2011 22:02:20 +0100 Subject: [U-Boot] [PATCH] nios2: reset cfi flash before reading env In-Reply-To: <4D252AAB.6040308@wytron.com.tw> References: <1294211855-18584-1-git-send-email-thomas@wytron.com.tw> <20110105081529.C430ED31214@gemini.denx.de> <4D252AAB.6040308@wytron.com.tw> Message-ID: <20110117210220.CB2EDD1CAD5@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Thomas Chou, In message <4D252AAB.6040308@wytron.com.tw> you 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. ... > 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) I recommend you have a second, closer look. Notice that flash_cmd_reset() comes with __attribute__ weak, because it does not work as a general solution - it may work here, but other code may be needed on other flash chips. Your code does not provide such an option. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de God is real, unless declared integer.