diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2005-03-15 14:07:21 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@mtd.linutronix.de> | 2005-05-23 06:53:47 -0400 |
commit | 3a70025047f90de2133744a8918e90fcf5a93366 (patch) | |
tree | c92637dd52da4a8e5071d11eb032b55a6dd62d2f | |
parent | c927cd3a226bed5cf063cdf04de13cef51144cef (diff) |
[MTD] cfi_cmdset_0001: Fix the buggy status check.
The change makes the code endianess aware and replaces the bogus
nested loop to or the status flags together.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | drivers/mtd/chips/cfi_cmdset_0001.c | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c index f018ea162173..92074ff9dac6 100644 --- a/drivers/mtd/chips/cfi_cmdset_0001.c +++ b/drivers/mtd/chips/cfi_cmdset_0001.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * | 4 | * |
5 | * (C) 2000 Red Hat. GPL'd | 5 | * (C) 2000 Red Hat. GPL'd |
6 | * | 6 | * |
7 | * $Id: cfi_cmdset_0001.c,v 1.168 2005/02/17 20:34:59 nico Exp $ | 7 | * $Id: cfi_cmdset_0001.c,v 1.169 2005/03/15 19:07:18 gleixner Exp $ |
8 | * | 8 | * |
9 | * | 9 | * |
10 | * 10/10/2000 Nicolas Pitre <nico@cam.org> | 10 | * 10/10/2000 Nicolas Pitre <nico@cam.org> |
@@ -1697,24 +1697,14 @@ static int __xipram do_erase_oneblock(struct map_info *map, struct flchip *chip, | |||
1697 | 1697 | ||
1698 | /* check for lock bit */ | 1698 | /* check for lock bit */ |
1699 | if (map_word_bitsset(map, status, CMD(0x3a))) { | 1699 | if (map_word_bitsset(map, status, CMD(0x3a))) { |
1700 | unsigned char chipstatus; | 1700 | unsigned long chipstatus; |
1701 | 1701 | ||
1702 | /* Reset the error bits */ | 1702 | /* Reset the error bits */ |
1703 | map_write(map, CMD(0x50), adr); | 1703 | map_write(map, CMD(0x50), adr); |
1704 | map_write(map, CMD(0x70), adr); | 1704 | map_write(map, CMD(0x70), adr); |
1705 | xip_enable(map, chip, adr); | 1705 | xip_enable(map, chip, adr); |
1706 | 1706 | ||
1707 | chipstatus = status.x[0]; | 1707 | chipstatus = MERGESTATUS(status); |
1708 | if (!map_word_equal(map, status, CMD(chipstatus))) { | ||
1709 | int i, w; | ||
1710 | for (w=0; w<map_words(map); w++) { | ||
1711 | for (i = 0; i<cfi_interleave(cfi); i++) { | ||
1712 | chipstatus |= status.x[w] >> (cfi->device_type * 8); | ||
1713 | } | ||
1714 | } | ||
1715 | printk(KERN_WARNING "Status is not identical for all chips: 0x%lx. Merging to give 0x%02x\n", | ||
1716 | status.x[0], chipstatus); | ||
1717 | } | ||
1718 | 1708 | ||
1719 | if ((chipstatus & 0x30) == 0x30) { | 1709 | if ((chipstatus & 0x30) == 0x30) { |
1720 | printk(KERN_NOTICE "Chip reports improper command sequence: status 0x%x\n", chipstatus); | 1710 | printk(KERN_NOTICE "Chip reports improper command sequence: status 0x%x\n", chipstatus); |