From patchwork Tue Jul 14 13:35:44 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [MTD, CHIPS] cfi_cmdset_0001.c: put chip into read-array mode after unlocking Date: Tue, 14 Jul 2009 03:35:44 -0000 From: Mike Frysinger X-Patchwork-Id: 29766 Message-Id: <1247578544-6950-1-git-send-email-vapier@gentoo.org> To: linux-mtd@lists.infradead.org Cc: Graf Yang From: Graf Yang We should try and keep the flash in the default read-array mode when possible so that we are much more likely to properly recover from unexpected reboot events (such as watchdog expiring). If we only unlock the flash, it can stay in that state for a while, so put it into read-array mode after successful unlocking. URL: http://blackfin.uclinux.org/gf/tracker/4887 Signed-off-by: Graf Yang Signed-off-by: Mike Frysinger --- drivers/mtd/chips/cfi_cmdset_0001.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c index c240454..d96cc99 100644 --- a/drivers/mtd/chips/cfi_cmdset_0001.c +++ b/drivers/mtd/chips/cfi_cmdset_0001.c @@ -2056,6 +2056,11 @@ static int __xipram do_xxlock_oneblock(struct map_info *map, struct flchip *chip goto out; } + if (chip->state == FL_STATUS) { + /* it goes ok, put chip into array mode */ + map_write(map, CMD(0xff), adr); + chip->state = FL_READY; + } xip_enable(map, chip, adr); out: put_chip(map, chip, adr); spin_unlock(chip->mutex);