[PATCH v2] mtd: gpmi: Deal with bitflips in erased regions regions

Elie De Brauwer eliedebrauwer at gmail.com
Mon Dec 16 08:14:03 EST 2013


On Mon, Dec 16, 2013 at 2:00 PM, Huang Shijie <shijie8 at gmail.com> wrote:
> On Mon, Dec 16, 2013 at 10:43:34AM +0100, Elie De Brauwer wrote:
>> On Mon, Dec 16, 2013 at 5:30 AM, Huang Shijie <b32955 at freescale.com> wrote:
>  >> +/* Returns 1 if the last transaction consisted only out of ones. */
>> >> +int gpmi_allones(struct gpmi_nand_data *this)
>> >> +{
>> >> +     struct resources *r = &this->resources;
>> >> +     uint32_t reg = readl(r->gpmi_regs + HW_BCH_STATUS0);
>> > please add a empty line here.
>> >> +     if (reg & BM_BCH_STATUS0_ALLONES_MASK)
>> >> +             return 1;
>> >> +     return 0;
>> > We can simplify the code to:
>> >         return reg & BM_BCH_STATUS0_ALLONES_MASK;
>> >
>>
>> I was doing some stress testing on this piece of code today, but I'm
>> afraid the ALLONES solution apparently does not work. If I look at the
>> BCH_STATUS0 register while doing some heavy flash access, the
>> (entire) register remains zero at all times, while I would at least expect the
> how do you do the stress test, and how do you know the register is zero?
>
> I can test it on my side too.

Well the stress test is simply dd if=/dev/mtdX of=/dev/null bs=1M (or nanddump).
And checking the state of the register.
To check whether or not the register is zero is simply (accumulative
to version 2
of my patch:

int gpmi_allones(struct gpmi_nand_data *this)
{
   struct resources *r = &this->resources;
   uint32_t reg = readl(r->gpmi_regs + HW_BCH_STATUS0);

   if (reg != 0)
      printk("%x\n", reg);
   return reg & BM_BCH_STATUS0_ALLONES_MASK;
}

And in gpmi_ecc_read_page() I added a call to it in the beginning of the loop:

   for (i = 0; i < nfc_geo->ecc_chunk_count; i++, status++) {
      gpmi_allones(this);
      if (*status == STATUS_GOOD)
         continue;

The printk() is never triggering, while I should at least expect it to
trigger when I'm
reading an erased block. (The boards I'm using for testing are 'cured'
from bitflips for now).
My tests are done on an i.mx283.


-- 
Elie De Brauwer



More information about the linux-mtd mailing list