From mboxrd@z Thu Jan 1 00:00:00 1970 From: Steve Sakoman Date: Wed, 17 Nov 2010 14:48:59 -0800 Subject: [U-Boot] fw_setenv broken? In-Reply-To: <20101117160802.5bacf545@udp111988uds.am.freescale.net> References: <1290011424.2927.1123.camel@quadra> <4CE4092B.7090209@denx.de> <20101117173933.665FE14EA7E@gemini.denx.de> <20101117204722.E34FC14EA7E@gemini.denx.de> <20101117214049.52CA614EA7E@gemini.denx.de> <20101117160802.5bacf545@udp111988uds.am.freescale.net> Message-ID: <1290034139.2927.1192.camel@quadra> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Wed, 2010-11-17 at 16:08 -0600, Scott Wood wrote: > On Wed, 17 Nov 2010 22:40:49 +0100 > Wolfgang Denk wrote: > > > Dear Steve Sakoman, > > > > In message you wrote: > > > > > > readenv: offset = 240000 > > > readenv: nand_read failure = -117 > > > *** Warning - readenv() failed, using default environment > > > > > > I then immediately tried to use the nand read command to read the same > > > block, and it was successful! > > > > Hm... any chance that - for example - your timers are not working > > correctly before relocation (maybe because they try to write to the > > not yet available data segment) ? This could cause timeouts or delays > > to be too short, so the NAND driver is misbehaving? > > The NAND driver only works after relocation. > > It looks like the problem is that -EUCLEAN is a non-fatal error > (indicates a correctable ECC error). The code invoked by the "nand > read" command succeeds if nand_read() returns either 0 or -EUCLEAN, but > readenv() is missing this check. OK, we seem to be peeling back the layers of the onion now. I patched readenv to use the same nand_read_skip_bad function used in the command line "nand read" tool. I no longer get the -EUCLEAN errors when reading the environment after using fw_setenv to write from linux. Now I get: *** Warning - bad CRC, using default environment Checking the data with the "nand read" command line shows that the changes I made in linux are indeed there, so I suspect that there is also some mismatch in the CRC computation between the fw tools and the u-boot code (i.e. I'm pretty sure this error does *not* refer to the nand CRC) Steve