From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from co202.xi-lite.net ([149.6.83.202]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Sw71k-0001Vv-GE for linux-mtd@lists.infradead.org; Tue, 31 Jul 2012 07:38:00 +0000 Message-ID: <50178B55.1020005@parrot.com> Date: Tue, 31 Jul 2012 09:37:57 +0200 From: Matthieu CASTET MIME-Version: 1.0 To: =?GB2312?B?stzI2cjZ?= Subject: Re: question about write/read sub-page with BCH algorithm or disable sub-page operation when using ubifs References: In-Reply-To: Content-Type: text/plain; charset="GB2312" Content-Transfer-Encoding: 7bit Cc: "linux-mtd@lists.infradead.org" List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Hi, > Hello, > I have a question about sub-page when using ubifs, so ask help from here. > > Let me take a 2048-size page with 4 sub-page Nand as example. > > The documentation said, "To write a sub-page, the driver may actually > write whole NAND page, but put 0xFF bytes to the sub-pages which are > not relevant to this operation." > It's OK for some ECC algorithms such as Hamming algorithm, because the > ECC codes generated by Hamming algorithm for the 0xFF data are still > 0xFF'ed. However, if we use BCH algorithm, the generated ECC codes for > 0xFF data will be not 0xFF'ed, and they will overwrite the previous > OOB data, so error will be happened when reading next time. It depends of your ecc algorithm. The software BCH algo in kernel take care of generate code such as 0xFF data give 0xFF ecc. This can be done by XORing the ecc before writing/after reading. This may not possible on some controller that compute and send ecc without software intervention. > > I try to resolve this issue by disabling sub-page operation, so I add > NAND_NO_SUBPAGE_WRITE into chip->options, but chip->options will be > flushed in nand_get_flash_type() funtion (chip->options &= > ~NAND_CHIPOPTIONS_MSK). You may better define chip->ecc.steps == 1 Matthieu