All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leo <leo.costa77@gmail.com>
To: linux-mtd@lists.infradead.org
Subject: Numonyx NOR bug
Date: Tue, 12 Apr 2011 23:18:34 +0200	[thread overview]
Message-ID: <4DA4C1AA.3030907@gmail.com> (raw)

I found a little problem with mtd drivers running on a LTIB linux 
distribution on a custom board equipped with a Freescale Coldfire and a 
Numonyx NOR Axcell M29EW flash memory. The do_erase_oneblock() function 
sometimes fails because the chip_good() functions returns zero reading a 
data word different from 0xffff. I spent some time debugging and finally 
I solved the problem adding a new chip state "FL_ERASE_STARTING" and 
setting it after the erase block command sequence as follows :

   cfi_send_gen_cmd(0xAA, cfi->addr_unlock1, chip->start, map, cfi, 
cfi->device_type, NULL);
   cfi_send_gen_cmd(0x55, cfi->addr_unlock2, chip->start, map, cfi, 
cfi->device_type, NULL);
   cfi_send_gen_cmd(0x80, cfi->addr_unlock1, chip->start, map, cfi, 
cfi->device_type, NULL);
   cfi_send_gen_cmd(0xAA, cfi->addr_unlock1, chip->start, map, cfi, 
cfi->device_type, NULL);
   cfi_send_gen_cmd(0x55, cfi->addr_unlock2, chip->start, map, cfi, 
cfi->device_type, NULL);
   map_write(map, CMD(0x30), adr);

   chip->state = FL_ERASE_STARTING;

   INVALIDATE_CACHE_UDELAY(map, chip,
                        adr, len,
                        chip->erase_time);

   chip->state = FL_ERASING;
   chip->erase_suspended = 0;
   chip->in_progress_block_addr = adr;

   timeo = jiffies + (HZ*20);

   for (;;) {

This works because the Numonyx chip probably does not accept the erase 
suspend command during the erase block time-out (the 50 us after the 
command sequence has been sent and before the erase starts). In fact the 
INVALIDATE_CACHE_UDELAY() macro unlocks the mutex and lets 
reading/writing functions to suspend the erasing too soon calling the 
get_chip(). With the FL_ERASE_STARTING state get_chip() does not give 
the access to reading/writing functions during the 
INVALIDATE_CACHE_UDELAY() sleeping period (chip->erase_time).
Anyone into the same problem?

Thanks for reading!
Leonardo

             reply	other threads:[~2011-04-12 21:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-12 21:18 Leo [this message]
2011-04-12 22:56 ` Numonyx NOR bug Joakim Tjernlund
2011-04-13  6:26 ` Markus Niebel
2011-04-14 19:42   ` Leo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4DA4C1AA.3030907@gmail.com \
    --to=leo.costa77@gmail.com \
    --cc=linux-mtd@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.