[BUG] pxa3xx: wait time out when scanning for bb
Greg Cook
greg at morpheus.ws
Mon Dec 11 23:17:55 PST 2017
On 12 December 2017 at 14:50, Ezequiel Garcia
<ezequiel at vanguardiasur.com.ar> wrote:
> On 12 December 2017 at 03:36, Sean Nyekjær <sean.nyekjaer at prevas.dk> wrote:
>> Hi Greg
>>>
>>>
>>> I am not completely up-to-date on this, but everything in your traces
>>> reads like the same issue I was having on bringup for Armada 385 nand (under
>>> 4.9). I've been stuck on another project, so I haven't had time to follow up
>>> further, but I just diffed against linux-stable v4.12 pxa3xx_nand.c and it
>>> looks like the problem is still there.
>>>
>>> As far as I can see, the driver is broken for OOB reads when BCH is
>>> enabled because the setup in prepare_set_command() results in drain_fifo()
>>> not reading enough words from the read fifo in the nfc2 IP block.
>>>
>>> The patch we are using is below. I have the following in my DTS.
>>> nand-keep-config is commented out because I was having some issues with
>>> u-boot at the time and it may no longer be relevant:
>>> flash at d0000 {
>>> status = "okay";
>>> num-cs = <1>;
>>> //marvell,nand-keep-config;
>>> marvell,nand-enable-arbiter;
>>> nand-on-flash-bbt;
>>> nand-ecc-strength = <4>;
>>> nand-ecc-step-size = <512>;
>>> };
>>>
>>> --- /home/user/build/linux-stable/drivers/mtd/nand/pxa3xx_nand.c
>>> +++
>>> /home/user/build/beam/openwrt/build_dir/target-arm_cortex-a9+vfpv3_musl_eabi/linux-mvebu/linux-4.9.34/drivers/mtd/nand/pxa3xx_nand.c
>>> @@ -668,7 +669,7 @@
>>> static void drain_fifo(struct pxa3xx_nand_info *info, void *data, int
>>> len)
>>> {
>>> -if (info->ecc_bch) {
>>> +if (info->use_ecc && info->ecc_bch) {
>>> u32 val;
>>> int ret;
>>> @@ -1012,7 +1014,11 @@
>>> if (info->cur_chunk < info->nfullchunks) {
>>> info->step_chunk_size = info->chunk_size;
>>> -info->step_spare_size = info->spare_size;
>>> +if (info->use_ecc) {
>>> +info->step_spare_size = info->spare_size;
>>> +} else {
>>> +info->step_spare_size = info->spare_size + info->ecc_size;
>>> +}
>>> } else {
>>> info->step_chunk_size = info->last_chunk_size;
>>> info->step_spare_size = info->last_spare_size;
>>>
>>> Regards,
>>> Greg
>>>
>> This patch does indeed fix our issues :-)
>> I'm able to run the nanddump command without any timeouts and
>> run without bbt (not that i would prefer that).
>>
>> root at output-module:~# nanddump -oa /dev/mtd1
>> ECC failed: 0
>> ECC corrected: 0
>> Number of bad blocks: 0
>> Number of bbt blocks: 8
>> Block size 131072, page size 2048, OOB size 64
>> Dumping data starting at 0x00000000 and ending at 0x0ff00000...
>> UBIXS
>>
>> Please submit a patch.
>>
>
> Greg,
>
> If you prefer, I can re-submit your patch with your author and signed-off-by.
> If you want to submit yourself, that's of course better.
>
> Once we have a proper patch, we can start tests an
> discuss merging (or not) in its own thread.
Ezequiel,
I'm *relatively* new to this, but recognise I should learn. Is this
link a good place to start, or is there something newer?
https://www.kernel.org/doc/html/v4.12/process/submitting-patches.html
More information about the linux-mtd
mailing list