mtd: jedec_probe: initialise make sector erase command variable
authorAntony Pavlov <antony@niisi.msk.ru>
Fri, 11 Feb 2011 10:00:37 +0000 (13:00 +0300)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Fri, 11 Mar 2011 12:05:54 +0000 (12:05 +0000)
In the commit 08968041bef437ec363623cd3218c2b083537ada
 (mtd: cfi_cmdset_0002: make sector erase command variable)
introdused a field sector_erase_cmd. In the same commit initialisation
of cfi->sector_erase_cmd made in cfi_chip_setup()
(file drivers/mtd/chips/cfi_probe.c), so the CFI chip has no problem:

...
        cfi->cfi_mode = CFI_MODE_CFI;
        cfi->sector_erase_cmd = CMD(0x30);
...

But for the JEDEC chips this initialisation is not carried out,
so the JEDEC chips have sector_erase_cmd == 0.

This patch adds the missing initialisation.

Signed-off-by: Antony Pavlov <antony@niisi.msk.ru>
Acked-by: Guillaume LECERF <glecerf@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
CC: stable@kernel.org
drivers/mtd/chips/jedec_probe.c

index 7bedbb96604d37826d5e19dcaeb8f8673bb1c9c8..4e1be51cc122618d60b69297726b96dcb896a0ef 100644 (file)
@@ -1935,7 +1935,7 @@ static void jedec_reset(u32 base, struct map_info *map, struct cfi_private *cfi)
 }
 
 
-static int cfi_jedec_setup(struct cfi_private *cfi, int index)
+static int cfi_jedec_setup(struct map_info *map, struct cfi_private *cfi, int index)
 {
        int i,num_erase_regions;
        uint8_t uaddr;
@@ -1962,6 +1962,7 @@ static int cfi_jedec_setup(struct cfi_private *cfi, int index)
        cfi->cfiq->NumEraseRegions = jedec_table[index].nr_regions;
        cfi->cfiq->DevSize = jedec_table[index].dev_size;
        cfi->cfi_mode = CFI_MODE_JEDEC;
+       cfi->sector_erase_cmd = CMD(0x30);
 
        for (i=0; i<num_erase_regions; i++){
                cfi->cfiq->EraseRegionInfo[i] = jedec_table[index].regions[i];
@@ -2175,7 +2176,7 @@ static int jedec_probe_chip(struct map_info *map, __u32 base,
                                       "MTD %s(): matched device 0x%x,0x%x unlock_addrs: 0x%.4x 0x%.4x\n",
                                       __func__, cfi->mfr, cfi->id,
                                       cfi->addr_unlock1, cfi->addr_unlock2 );
-                               if (!cfi_jedec_setup(cfi, i))
+                               if (!cfi_jedec_setup(map, cfi, i))
                                        return 0;
                                goto ok_out;
                        }