On Fri, Jun 5, 2020 at 1:07 PM Álvaro Fernández Rojas noltari@gmail.com wrote:
Both brcmand_write_oob_raw() and brcmnand_write_oob() use brcmnand_write() that uses PROGRAM_PAGE cmd, means also programs data areas and ECC when enabled is always calculated on DATA+OOB. since in both cases we only want to modify OOB, data is always assumed to be 0xffs (means erased state). So as far as this api always is used on the erased page it should be good. Are the sub-pages/oob areas read by jffs2 also read without ecc enabled?. Just want to be sure that it does not break any other utilities like nandwrite.
Hi Kamal,
Are you sure about that? I think that HW ECC is only calculated for DATA, not for OOB. The fact that we’re not writing any DATA seems to be the problem that is changing all ECC bytes to 0x00.
No, sub-pages/oob areas read by JFFS2 with ECC enabled. I don’t think this breaks anything at all, since I tested nandwrite with OOB enabled and everything was written perfectly.
BTW, I tried another approach that forced MTD_OPS_AUTO_OOB to be written as raw OOB, but it was rejected: http://patchwork.ozlabs.org/project/linux-mtd/patch/20200504094253.2741109-1... https://lkml.org/lkml/2020/5/4/215
Best regards, Álvaro.
Alvaro,
On Sat, Jun 13, 2020 at 5:01 AM Álvaro Fernández Rojas noltari@gmail.com wrote:
Only true for 1-bit hamming code on early controller versions. For BCH algorithms both data+oob are covered. And the controller driver intentionally does not implement a spare area program cmd, even for OOB writes. Also BRCMNAND_ACC_CONTROL_PARTIAL_PAGE=0 (when present) does not allow for spare areas only writes.
Going by the commit message you are assuming 1-bit hamming code, that is the only exception on early version controllers where only data was covered for ecc calculations when enabled. Which version of the controller are you using ?. Did you test with BCH-4 or any BCH ?.
Are there any other use cases other than jffs2 where only oob needs to be modified ?. But surely intentionally disabling ecc instead of forcing it is the way, but I am not sure it will still work for other BCH algorithms though where both data and oob are covered.
Hi Kamal,
All my devices use hamming ECC, even the ones with controller version v4.0 (BCM63268), which should also support BCH. Therefore I need to stick with hamming ECC if I want the bootloader to be able to boot the kernel.
However, I should get a new device with BCH in a few days. I’ll do more tests once I get it, but if BCH also covers OOB, then we could conditionally force write_oob to RAW only if hamming is configured.
I’ll test this and report back once I get my new device.
dri-devel@lists.freedesktop.org