diff options
Diffstat (limited to 'drivers/mtd/chips')
-rw-r--r-- | drivers/mtd/chips/amd_flash.c | 3 | ||||
-rw-r--r-- | drivers/mtd/chips/cfi_cmdset_0001.c | 5 | ||||
-rw-r--r-- | drivers/mtd/chips/cfi_cmdset_0002.c | 11 | ||||
-rw-r--r-- | drivers/mtd/chips/cfi_cmdset_0020.c | 3 | ||||
-rw-r--r-- | drivers/mtd/chips/gen_probe.c | 5 | ||||
-rw-r--r-- | drivers/mtd/chips/jedec.c | 3 | ||||
-rw-r--r-- | drivers/mtd/chips/jedec_probe.c | 17 | ||||
-rw-r--r-- | drivers/mtd/chips/map_absent.c | 4 | ||||
-rw-r--r-- | drivers/mtd/chips/map_ram.c | 4 | ||||
-rw-r--r-- | drivers/mtd/chips/map_rom.c | 4 | ||||
-rw-r--r-- | drivers/mtd/chips/sharp.c | 7 |
11 files changed, 36 insertions, 30 deletions
diff --git a/drivers/mtd/chips/amd_flash.c b/drivers/mtd/chips/amd_flash.c index 16eaca69fb5a..e7999f15d85a 100644 --- a/drivers/mtd/chips/amd_flash.c +++ b/drivers/mtd/chips/amd_flash.c | |||
@@ -643,13 +643,12 @@ static struct mtd_info *amd_flash_probe(struct map_info *map) | |||
643 | int reg_idx; | 643 | int reg_idx; |
644 | int offset; | 644 | int offset; |
645 | 645 | ||
646 | mtd = (struct mtd_info*)kmalloc(sizeof(*mtd), GFP_KERNEL); | 646 | mtd = kzalloc(sizeof(*mtd), GFP_KERNEL); |
647 | if (!mtd) { | 647 | if (!mtd) { |
648 | printk(KERN_WARNING | 648 | printk(KERN_WARNING |
649 | "%s: kmalloc failed for info structure\n", map->name); | 649 | "%s: kmalloc failed for info structure\n", map->name); |
650 | return NULL; | 650 | return NULL; |
651 | } | 651 | } |
652 | memset(mtd, 0, sizeof(*mtd)); | ||
653 | mtd->priv = map; | 652 | mtd->priv = map; |
654 | 653 | ||
655 | memset(&temp, 0, sizeof(temp)); | 654 | memset(&temp, 0, sizeof(temp)); |
diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c index 296159ec5189..f69184a92eb2 100644 --- a/drivers/mtd/chips/cfi_cmdset_0001.c +++ b/drivers/mtd/chips/cfi_cmdset_0001.c | |||
@@ -337,12 +337,11 @@ struct mtd_info *cfi_cmdset_0001(struct map_info *map, int primary) | |||
337 | struct mtd_info *mtd; | 337 | struct mtd_info *mtd; |
338 | int i; | 338 | int i; |
339 | 339 | ||
340 | mtd = kmalloc(sizeof(*mtd), GFP_KERNEL); | 340 | mtd = kzalloc(sizeof(*mtd), GFP_KERNEL); |
341 | if (!mtd) { | 341 | if (!mtd) { |
342 | printk(KERN_ERR "Failed to allocate memory for MTD device\n"); | 342 | printk(KERN_ERR "Failed to allocate memory for MTD device\n"); |
343 | return NULL; | 343 | return NULL; |
344 | } | 344 | } |
345 | memset(mtd, 0, sizeof(*mtd)); | ||
346 | mtd->priv = map; | 345 | mtd->priv = map; |
347 | mtd->type = MTD_NORFLASH; | 346 | mtd->type = MTD_NORFLASH; |
348 | 347 | ||
@@ -2224,6 +2223,8 @@ static int cfi_intelext_suspend(struct mtd_info *mtd) | |||
2224 | case FL_CFI_QUERY: | 2223 | case FL_CFI_QUERY: |
2225 | case FL_JEDEC_QUERY: | 2224 | case FL_JEDEC_QUERY: |
2226 | if (chip->oldstate == FL_READY) { | 2225 | if (chip->oldstate == FL_READY) { |
2226 | /* place the chip in a known state before suspend */ | ||
2227 | map_write(map, CMD(0xFF), cfi->chips[i].start); | ||
2227 | chip->oldstate = chip->state; | 2228 | chip->oldstate = chip->state; |
2228 | chip->state = FL_PM_SUSPENDED; | 2229 | chip->state = FL_PM_SUSPENDED; |
2229 | /* No need to wake_up() on this state change - | 2230 | /* No need to wake_up() on this state change - |
diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c index 702ae4cd8691..e3acd398fb37 100644 --- a/drivers/mtd/chips/cfi_cmdset_0002.c +++ b/drivers/mtd/chips/cfi_cmdset_0002.c | |||
@@ -48,6 +48,7 @@ | |||
48 | #define MANUFACTURER_ATMEL 0x001F | 48 | #define MANUFACTURER_ATMEL 0x001F |
49 | #define MANUFACTURER_SST 0x00BF | 49 | #define MANUFACTURER_SST 0x00BF |
50 | #define SST49LF004B 0x0060 | 50 | #define SST49LF004B 0x0060 |
51 | #define SST49LF040B 0x0050 | ||
51 | #define SST49LF008A 0x005a | 52 | #define SST49LF008A 0x005a |
52 | #define AT49BV6416 0x00d6 | 53 | #define AT49BV6416 0x00d6 |
53 | 54 | ||
@@ -233,6 +234,7 @@ static struct cfi_fixup cfi_fixup_table[] = { | |||
233 | }; | 234 | }; |
234 | static struct cfi_fixup jedec_fixup_table[] = { | 235 | static struct cfi_fixup jedec_fixup_table[] = { |
235 | { MANUFACTURER_SST, SST49LF004B, fixup_use_fwh_lock, NULL, }, | 236 | { MANUFACTURER_SST, SST49LF004B, fixup_use_fwh_lock, NULL, }, |
237 | { MANUFACTURER_SST, SST49LF040B, fixup_use_fwh_lock, NULL, }, | ||
236 | { MANUFACTURER_SST, SST49LF008A, fixup_use_fwh_lock, NULL, }, | 238 | { MANUFACTURER_SST, SST49LF008A, fixup_use_fwh_lock, NULL, }, |
237 | { 0, 0, NULL, NULL } | 239 | { 0, 0, NULL, NULL } |
238 | }; | 240 | }; |
@@ -255,12 +257,11 @@ struct mtd_info *cfi_cmdset_0002(struct map_info *map, int primary) | |||
255 | struct mtd_info *mtd; | 257 | struct mtd_info *mtd; |
256 | int i; | 258 | int i; |
257 | 259 | ||
258 | mtd = kmalloc(sizeof(*mtd), GFP_KERNEL); | 260 | mtd = kzalloc(sizeof(*mtd), GFP_KERNEL); |
259 | if (!mtd) { | 261 | if (!mtd) { |
260 | printk(KERN_WARNING "Failed to allocate memory for MTD device\n"); | 262 | printk(KERN_WARNING "Failed to allocate memory for MTD device\n"); |
261 | return NULL; | 263 | return NULL; |
262 | } | 264 | } |
263 | memset(mtd, 0, sizeof(*mtd)); | ||
264 | mtd->priv = map; | 265 | mtd->priv = map; |
265 | mtd->type = MTD_NORFLASH; | 266 | mtd->type = MTD_NORFLASH; |
266 | 267 | ||
@@ -519,10 +520,12 @@ static int get_chip(struct map_info *map, struct flchip *chip, unsigned long adr | |||
519 | if (mode == FL_WRITING) /* FIXME: Erase-suspend-program appears broken. */ | 520 | if (mode == FL_WRITING) /* FIXME: Erase-suspend-program appears broken. */ |
520 | goto sleep; | 521 | goto sleep; |
521 | 522 | ||
522 | if (!(mode == FL_READY || mode == FL_POINT | 523 | if (!( mode == FL_READY |
524 | || mode == FL_POINT | ||
523 | || !cfip | 525 | || !cfip |
524 | || (mode == FL_WRITING && (cfip->EraseSuspend & 0x2)) | 526 | || (mode == FL_WRITING && (cfip->EraseSuspend & 0x2)) |
525 | || (mode == FL_WRITING && (cfip->EraseSuspend & 0x1)))) | 527 | || (mode == FL_WRITING && (cfip->EraseSuspend & 0x1) |
528 | ))) | ||
526 | goto sleep; | 529 | goto sleep; |
527 | 530 | ||
528 | /* We could check to see if we're trying to access the sector | 531 | /* We could check to see if we're trying to access the sector |
diff --git a/drivers/mtd/chips/cfi_cmdset_0020.c b/drivers/mtd/chips/cfi_cmdset_0020.c index fae70a5db540..d56849f5f107 100644 --- a/drivers/mtd/chips/cfi_cmdset_0020.c +++ b/drivers/mtd/chips/cfi_cmdset_0020.c | |||
@@ -172,7 +172,7 @@ static struct mtd_info *cfi_staa_setup(struct map_info *map) | |||
172 | int i,j; | 172 | int i,j; |
173 | unsigned long devsize = (1<<cfi->cfiq->DevSize) * cfi->interleave; | 173 | unsigned long devsize = (1<<cfi->cfiq->DevSize) * cfi->interleave; |
174 | 174 | ||
175 | mtd = kmalloc(sizeof(*mtd), GFP_KERNEL); | 175 | mtd = kzalloc(sizeof(*mtd), GFP_KERNEL); |
176 | //printk(KERN_DEBUG "number of CFI chips: %d\n", cfi->numchips); | 176 | //printk(KERN_DEBUG "number of CFI chips: %d\n", cfi->numchips); |
177 | 177 | ||
178 | if (!mtd) { | 178 | if (!mtd) { |
@@ -181,7 +181,6 @@ static struct mtd_info *cfi_staa_setup(struct map_info *map) | |||
181 | return NULL; | 181 | return NULL; |
182 | } | 182 | } |
183 | 183 | ||
184 | memset(mtd, 0, sizeof(*mtd)); | ||
185 | mtd->priv = map; | 184 | mtd->priv = map; |
186 | mtd->type = MTD_NORFLASH; | 185 | mtd->type = MTD_NORFLASH; |
187 | mtd->size = devsize * cfi->numchips; | 186 | mtd->size = devsize * cfi->numchips; |
diff --git a/drivers/mtd/chips/gen_probe.c b/drivers/mtd/chips/gen_probe.c index cdb0f590b40c..2eb696d7b97b 100644 --- a/drivers/mtd/chips/gen_probe.c +++ b/drivers/mtd/chips/gen_probe.c | |||
@@ -40,7 +40,7 @@ struct mtd_info *mtd_do_chip_probe(struct map_info *map, struct chip_probe *cp) | |||
40 | if (mtd) { | 40 | if (mtd) { |
41 | if (mtd->size > map->size) { | 41 | if (mtd->size > map->size) { |
42 | printk(KERN_WARNING "Reducing visibility of %ldKiB chip to %ldKiB\n", | 42 | printk(KERN_WARNING "Reducing visibility of %ldKiB chip to %ldKiB\n", |
43 | (unsigned long)mtd->size >> 10, | 43 | (unsigned long)mtd->size >> 10, |
44 | (unsigned long)map->size >> 10); | 44 | (unsigned long)map->size >> 10); |
45 | mtd->size = map->size; | 45 | mtd->size = map->size; |
46 | } | 46 | } |
@@ -113,13 +113,12 @@ static struct cfi_private *genprobe_ident_chips(struct map_info *map, struct chi | |||
113 | } | 113 | } |
114 | 114 | ||
115 | mapsize = (max_chips + BITS_PER_LONG-1) / BITS_PER_LONG; | 115 | mapsize = (max_chips + BITS_PER_LONG-1) / BITS_PER_LONG; |
116 | chip_map = kmalloc(mapsize, GFP_KERNEL); | 116 | chip_map = kzalloc(mapsize, GFP_KERNEL); |
117 | if (!chip_map) { | 117 | if (!chip_map) { |
118 | printk(KERN_WARNING "%s: kmalloc failed for CFI chip map\n", map->name); | 118 | printk(KERN_WARNING "%s: kmalloc failed for CFI chip map\n", map->name); |
119 | kfree(cfi.cfiq); | 119 | kfree(cfi.cfiq); |
120 | return NULL; | 120 | return NULL; |
121 | } | 121 | } |
122 | memset (chip_map, 0, mapsize); | ||
123 | 122 | ||
124 | set_bit(0, chip_map); /* Mark first chip valid */ | 123 | set_bit(0, chip_map); /* Mark first chip valid */ |
125 | 124 | ||
diff --git a/drivers/mtd/chips/jedec.c b/drivers/mtd/chips/jedec.c index 2c3f019197c1..14e57b2bf842 100644 --- a/drivers/mtd/chips/jedec.c +++ b/drivers/mtd/chips/jedec.c | |||
@@ -116,11 +116,10 @@ static struct mtd_info *jedec_probe(struct map_info *map) | |||
116 | char Part[200]; | 116 | char Part[200]; |
117 | memset(&priv,0,sizeof(priv)); | 117 | memset(&priv,0,sizeof(priv)); |
118 | 118 | ||
119 | MTD = kmalloc(sizeof(struct mtd_info) + sizeof(struct jedec_private), GFP_KERNEL); | 119 | MTD = kzalloc(sizeof(struct mtd_info) + sizeof(struct jedec_private), GFP_KERNEL); |
120 | if (!MTD) | 120 | if (!MTD) |
121 | return NULL; | 121 | return NULL; |
122 | 122 | ||
123 | memset(MTD, 0, sizeof(struct mtd_info) + sizeof(struct jedec_private)); | ||
124 | priv = (struct jedec_private *)&MTD[1]; | 123 | priv = (struct jedec_private *)&MTD[1]; |
125 | 124 | ||
126 | my_bank_size = map->size; | 125 | my_bank_size = map->size; |
diff --git a/drivers/mtd/chips/jedec_probe.c b/drivers/mtd/chips/jedec_probe.c index 1154dac715aa..58e561e87699 100644 --- a/drivers/mtd/chips/jedec_probe.c +++ b/drivers/mtd/chips/jedec_probe.c | |||
@@ -154,6 +154,7 @@ | |||
154 | #define SST39SF010A 0x00B5 | 154 | #define SST39SF010A 0x00B5 |
155 | #define SST39SF020A 0x00B6 | 155 | #define SST39SF020A 0x00B6 |
156 | #define SST49LF004B 0x0060 | 156 | #define SST49LF004B 0x0060 |
157 | #define SST49LF040B 0x0050 | ||
157 | #define SST49LF008A 0x005a | 158 | #define SST49LF008A 0x005a |
158 | #define SST49LF030A 0x001C | 159 | #define SST49LF030A 0x001C |
159 | #define SST49LF040A 0x0051 | 160 | #define SST49LF040A 0x0051 |
@@ -1401,6 +1402,20 @@ static const struct amd_flash_info jedec_table[] = { | |||
1401 | } | 1402 | } |
1402 | }, { | 1403 | }, { |
1403 | .mfr_id = MANUFACTURER_SST, | 1404 | .mfr_id = MANUFACTURER_SST, |
1405 | .dev_id = SST49LF040B, | ||
1406 | .name = "SST 49LF040B", | ||
1407 | .uaddr = { | ||
1408 | [0] = MTD_UADDR_0x5555_0x2AAA /* x8 */ | ||
1409 | }, | ||
1410 | .DevSize = SIZE_512KiB, | ||
1411 | .CmdSet = P_ID_AMD_STD, | ||
1412 | .NumEraseRegions= 1, | ||
1413 | .regions = { | ||
1414 | ERASEINFO(0x01000,128), | ||
1415 | } | ||
1416 | }, { | ||
1417 | |||
1418 | .mfr_id = MANUFACTURER_SST, | ||
1404 | .dev_id = SST49LF004B, | 1419 | .dev_id = SST49LF004B, |
1405 | .name = "SST 49LF004B", | 1420 | .name = "SST 49LF004B", |
1406 | .uaddr = { | 1421 | .uaddr = { |
@@ -1874,7 +1889,7 @@ static int cfi_jedec_setup(struct cfi_private *p_cfi, int index) | |||
1874 | 1889 | ||
1875 | 1890 | ||
1876 | /* | 1891 | /* |
1877 | * There is a BIG problem properly ID'ing the JEDEC devic and guaranteeing | 1892 | * There is a BIG problem properly ID'ing the JEDEC device and guaranteeing |
1878 | * the mapped address, unlock addresses, and proper chip ID. This function | 1893 | * the mapped address, unlock addresses, and proper chip ID. This function |
1879 | * attempts to minimize errors. It is doubtfull that this probe will ever | 1894 | * attempts to minimize errors. It is doubtfull that this probe will ever |
1880 | * be perfect - consequently there should be some module parameters that | 1895 | * be perfect - consequently there should be some module parameters that |
diff --git a/drivers/mtd/chips/map_absent.c b/drivers/mtd/chips/map_absent.c index ac01a949b687..fc478c0f93f5 100644 --- a/drivers/mtd/chips/map_absent.c +++ b/drivers/mtd/chips/map_absent.c | |||
@@ -47,13 +47,11 @@ static struct mtd_info *map_absent_probe(struct map_info *map) | |||
47 | { | 47 | { |
48 | struct mtd_info *mtd; | 48 | struct mtd_info *mtd; |
49 | 49 | ||
50 | mtd = kmalloc(sizeof(*mtd), GFP_KERNEL); | 50 | mtd = kzalloc(sizeof(*mtd), GFP_KERNEL); |
51 | if (!mtd) { | 51 | if (!mtd) { |
52 | return NULL; | 52 | return NULL; |
53 | } | 53 | } |
54 | 54 | ||
55 | memset(mtd, 0, sizeof(*mtd)); | ||
56 | |||
57 | map->fldrv = &map_absent_chipdrv; | 55 | map->fldrv = &map_absent_chipdrv; |
58 | mtd->priv = map; | 56 | mtd->priv = map; |
59 | mtd->name = map->name; | 57 | mtd->name = map->name; |
diff --git a/drivers/mtd/chips/map_ram.c b/drivers/mtd/chips/map_ram.c index 3a66680abfd0..5cb6d5263661 100644 --- a/drivers/mtd/chips/map_ram.c +++ b/drivers/mtd/chips/map_ram.c | |||
@@ -55,12 +55,10 @@ static struct mtd_info *map_ram_probe(struct map_info *map) | |||
55 | #endif | 55 | #endif |
56 | /* OK. It seems to be RAM. */ | 56 | /* OK. It seems to be RAM. */ |
57 | 57 | ||
58 | mtd = kmalloc(sizeof(*mtd), GFP_KERNEL); | 58 | mtd = kzalloc(sizeof(*mtd), GFP_KERNEL); |
59 | if (!mtd) | 59 | if (!mtd) |
60 | return NULL; | 60 | return NULL; |
61 | 61 | ||
62 | memset(mtd, 0, sizeof(*mtd)); | ||
63 | |||
64 | map->fldrv = &mapram_chipdrv; | 62 | map->fldrv = &mapram_chipdrv; |
65 | mtd->priv = map; | 63 | mtd->priv = map; |
66 | mtd->name = map->name; | 64 | mtd->name = map->name; |
diff --git a/drivers/mtd/chips/map_rom.c b/drivers/mtd/chips/map_rom.c index 1b328b1378fd..cb27f855074c 100644 --- a/drivers/mtd/chips/map_rom.c +++ b/drivers/mtd/chips/map_rom.c | |||
@@ -31,12 +31,10 @@ static struct mtd_info *map_rom_probe(struct map_info *map) | |||
31 | { | 31 | { |
32 | struct mtd_info *mtd; | 32 | struct mtd_info *mtd; |
33 | 33 | ||
34 | mtd = kmalloc(sizeof(*mtd), GFP_KERNEL); | 34 | mtd = kzalloc(sizeof(*mtd), GFP_KERNEL); |
35 | if (!mtd) | 35 | if (!mtd) |
36 | return NULL; | 36 | return NULL; |
37 | 37 | ||
38 | memset(mtd, 0, sizeof(*mtd)); | ||
39 | |||
40 | map->fldrv = &maprom_chipdrv; | 38 | map->fldrv = &maprom_chipdrv; |
41 | mtd->priv = map; | 39 | mtd->priv = map; |
42 | mtd->name = map->name; | 40 | mtd->name = map->name; |
diff --git a/drivers/mtd/chips/sharp.c b/drivers/mtd/chips/sharp.c index 967abbecdff9..c9cd3d21ccfa 100644 --- a/drivers/mtd/chips/sharp.c +++ b/drivers/mtd/chips/sharp.c | |||
@@ -112,18 +112,16 @@ static struct mtd_info *sharp_probe(struct map_info *map) | |||
112 | struct sharp_info *sharp = NULL; | 112 | struct sharp_info *sharp = NULL; |
113 | int width; | 113 | int width; |
114 | 114 | ||
115 | mtd = kmalloc(sizeof(*mtd), GFP_KERNEL); | 115 | mtd = kzalloc(sizeof(*mtd), GFP_KERNEL); |
116 | if(!mtd) | 116 | if(!mtd) |
117 | return NULL; | 117 | return NULL; |
118 | 118 | ||
119 | sharp = kmalloc(sizeof(*sharp), GFP_KERNEL); | 119 | sharp = kzalloc(sizeof(*sharp), GFP_KERNEL); |
120 | if(!sharp) { | 120 | if(!sharp) { |
121 | kfree(mtd); | 121 | kfree(mtd); |
122 | return NULL; | 122 | return NULL; |
123 | } | 123 | } |
124 | 124 | ||
125 | memset(mtd, 0, sizeof(*mtd)); | ||
126 | |||
127 | width = sharp_probe_map(map,mtd); | 125 | width = sharp_probe_map(map,mtd); |
128 | if(!width){ | 126 | if(!width){ |
129 | kfree(mtd); | 127 | kfree(mtd); |
@@ -143,7 +141,6 @@ static struct mtd_info *sharp_probe(struct map_info *map) | |||
143 | mtd->writesize = 1; | 141 | mtd->writesize = 1; |
144 | mtd->name = map->name; | 142 | mtd->name = map->name; |
145 | 143 | ||
146 | memset(sharp, 0, sizeof(*sharp)); | ||
147 | sharp->chipshift = 23; | 144 | sharp->chipshift = 23; |
148 | sharp->numchips = 1; | 145 | sharp->numchips = 1; |
149 | sharp->chips[0].start = 0; | 146 | sharp->chips[0].start = 0; |