From: Guennadi Liakhovetski Date: Tue, 5 Aug 2008 17:25:46 +0200 (CEST) Subject: [U-Boot-Users] [PATCH 2/7 v3] NAND_CMD_READOOB is not supported by all chips, read OOB with the page instead In-Reply-To: <20080805150110.GA6385@ld0162-tx32.am.freescale.net> References: <20080801122804.351E3248BF@gemini.denx.de> <20080804222808.GA29028@ld0162-tx32.am.freescale.net> <20080805150110.GA6385@ld0162-tx32.am.freescale.net> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Tue, 5 Aug 2008, Scott Wood wrote: > On Tue, Aug 05, 2008 at 03:08:04PM +0200, Guennadi Liakhovetski wrote: > > It's a large-page device. And, as far as I understand the datasheet, to > > read data at arbitrary offset in a page, you first have to issue a READ > > PAGE (READ0) for _the_ _whole_ page, then you can use RANDOM DATA READ to > > read arbitrary data within this page. Whereas, the driver attempts to use > > READ0 to read the bad-block marker directly, which doesn't work with this > > chip. At least this is my understanding. > > Are you saying that your NAND chip can't read the OOB by issuing READ0 > with the appropriate column address? Which chip is this, and where can I > find a manual? At least, this is how I understood it, I might be wrong though: http://download.micron.com/pdf/datasheets/flash/nand/2_4_8gb_nand_m49a.pdf pages 21, 22. > > > > @@ -150,8 +135,6 @@ static int nand_read_page(struct mtd_info *mtd, int block, int page, uchar *dst) > > > > u_char *ecc_code; > > > > u_char *oob_data; > > > > int i; > > > > - int eccsize = CFG_NAND_ECCSIZE; > > > > - int eccbytes = CFG_NAND_ECCBYTES; > > > > > > Any particular reason for this change? It's more readable as is, IMHO. > > > > Acually, it was to improve readability:-) First, this way you can easier > > grep. > > Grep will find the initialization. > > > Secondly, when I see an assignment to a _variable_, I expect, that this > > variable's value can indeed _vary_. So, it makes extra work looking > > through the code and verifying what other values this variable takes. > > Thus, at the very least I would add "const" to the definition. And, I > > do think using constants directly makes it clearer... > > It replaces a short lower-case name with a longer all-caps name that > forces line breaks. I'm fine with adding "const". Ok... Thanks Guennadi --- Guennadi Liakhovetski, Ph.D. 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