diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-03-01 06:47:58 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-03-01 06:47:58 -0500 |
commit | 55f2b78995826d549401bdf20abeac1832636bb6 (patch) | |
tree | 931b31f3b6e0879df0f9a1d58ffd040d9a652f2e /drivers/mtd | |
parent | f5c1aa1537be39d8b9bb5279b5881d81898fd3cd (diff) | |
parent | 92b9af9e4f144535c65aee673cfad309f25fa465 (diff) |
Merge branch 'x86/urgent' into x86/pat
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/chips/map_rom.c | 8 | ||||
-rw-r--r-- | drivers/mtd/devices/slram.c | 14 | ||||
-rw-r--r-- | drivers/mtd/lpddr/Kconfig | 1 | ||||
-rw-r--r-- | drivers/mtd/maps/Kconfig | 2 | ||||
-rw-r--r-- | drivers/mtd/maps/bfin-async-flash.c | 6 | ||||
-rw-r--r-- | drivers/mtd/maps/ck804xrom.c | 2 | ||||
-rw-r--r-- | drivers/mtd/maps/physmap.c | 38 |
7 files changed, 45 insertions, 26 deletions
diff --git a/drivers/mtd/chips/map_rom.c b/drivers/mtd/chips/map_rom.c index 821d0ed6bae3..c76d6e5f47ee 100644 --- a/drivers/mtd/chips/map_rom.c +++ b/drivers/mtd/chips/map_rom.c | |||
@@ -19,6 +19,7 @@ static int maprom_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *); | |||
19 | static int maprom_write (struct mtd_info *, loff_t, size_t, size_t *, const u_char *); | 19 | static int maprom_write (struct mtd_info *, loff_t, size_t, size_t *, const u_char *); |
20 | static void maprom_nop (struct mtd_info *); | 20 | static void maprom_nop (struct mtd_info *); |
21 | static struct mtd_info *map_rom_probe(struct map_info *map); | 21 | static struct mtd_info *map_rom_probe(struct map_info *map); |
22 | static int maprom_erase (struct mtd_info *mtd, struct erase_info *info); | ||
22 | 23 | ||
23 | static struct mtd_chip_driver maprom_chipdrv = { | 24 | static struct mtd_chip_driver maprom_chipdrv = { |
24 | .probe = map_rom_probe, | 25 | .probe = map_rom_probe, |
@@ -42,6 +43,7 @@ static struct mtd_info *map_rom_probe(struct map_info *map) | |||
42 | mtd->read = maprom_read; | 43 | mtd->read = maprom_read; |
43 | mtd->write = maprom_write; | 44 | mtd->write = maprom_write; |
44 | mtd->sync = maprom_nop; | 45 | mtd->sync = maprom_nop; |
46 | mtd->erase = maprom_erase; | ||
45 | mtd->flags = MTD_CAP_ROM; | 47 | mtd->flags = MTD_CAP_ROM; |
46 | mtd->erasesize = map->size; | 48 | mtd->erasesize = map->size; |
47 | mtd->writesize = 1; | 49 | mtd->writesize = 1; |
@@ -71,6 +73,12 @@ static int maprom_write (struct mtd_info *mtd, loff_t to, size_t len, size_t *re | |||
71 | return -EIO; | 73 | return -EIO; |
72 | } | 74 | } |
73 | 75 | ||
76 | static int maprom_erase (struct mtd_info *mtd, struct erase_info *info) | ||
77 | { | ||
78 | /* We do our best 8) */ | ||
79 | return -EROFS; | ||
80 | } | ||
81 | |||
74 | static int __init map_rom_init(void) | 82 | static int __init map_rom_init(void) |
75 | { | 83 | { |
76 | register_mtd_chip_driver(&maprom_chipdrv); | 84 | register_mtd_chip_driver(&maprom_chipdrv); |
diff --git a/drivers/mtd/devices/slram.c b/drivers/mtd/devices/slram.c index a425d09f35a0..00248e81ecd5 100644 --- a/drivers/mtd/devices/slram.c +++ b/drivers/mtd/devices/slram.c | |||
@@ -267,22 +267,28 @@ static int parse_cmdline(char *devname, char *szstart, char *szlength) | |||
267 | if (*(szlength) != '+') { | 267 | if (*(szlength) != '+') { |
268 | devlength = simple_strtoul(szlength, &buffer, 0); | 268 | devlength = simple_strtoul(szlength, &buffer, 0); |
269 | devlength = handle_unit(devlength, buffer) - devstart; | 269 | devlength = handle_unit(devlength, buffer) - devstart; |
270 | if (devlength < devstart) | ||
271 | goto err_out; | ||
272 | |||
273 | devlength -= devstart; | ||
270 | } else { | 274 | } else { |
271 | devlength = simple_strtoul(szlength + 1, &buffer, 0); | 275 | devlength = simple_strtoul(szlength + 1, &buffer, 0); |
272 | devlength = handle_unit(devlength, buffer); | 276 | devlength = handle_unit(devlength, buffer); |
273 | } | 277 | } |
274 | T("slram: devname=%s, devstart=0x%lx, devlength=0x%lx\n", | 278 | T("slram: devname=%s, devstart=0x%lx, devlength=0x%lx\n", |
275 | devname, devstart, devlength); | 279 | devname, devstart, devlength); |
276 | if ((devstart < 0) || (devlength < 0) || (devlength % SLRAM_BLK_SZ != 0)) { | 280 | if (devlength % SLRAM_BLK_SZ != 0) |
277 | E("slram: Illegal start / length parameter.\n"); | 281 | goto err_out; |
278 | return(-EINVAL); | ||
279 | } | ||
280 | 282 | ||
281 | if ((devstart = register_device(devname, devstart, devlength))){ | 283 | if ((devstart = register_device(devname, devstart, devlength))){ |
282 | unregister_devices(); | 284 | unregister_devices(); |
283 | return((int)devstart); | 285 | return((int)devstart); |
284 | } | 286 | } |
285 | return(0); | 287 | return(0); |
288 | |||
289 | err_out: | ||
290 | E("slram: Illegal length parameter.\n"); | ||
291 | return(-EINVAL); | ||
286 | } | 292 | } |
287 | 293 | ||
288 | #ifndef MODULE | 294 | #ifndef MODULE |
diff --git a/drivers/mtd/lpddr/Kconfig b/drivers/mtd/lpddr/Kconfig index acd4ea9b2278..5a401d8047ab 100644 --- a/drivers/mtd/lpddr/Kconfig +++ b/drivers/mtd/lpddr/Kconfig | |||
@@ -12,6 +12,7 @@ config MTD_LPDDR | |||
12 | DDR memories, intended for battery-operated systems. | 12 | DDR memories, intended for battery-operated systems. |
13 | 13 | ||
14 | config MTD_QINFO_PROBE | 14 | config MTD_QINFO_PROBE |
15 | depends on MTD_LPDDR | ||
15 | tristate "Detect flash chips by QINFO probe" | 16 | tristate "Detect flash chips by QINFO probe" |
16 | help | 17 | help |
17 | Device Information for LPDDR chips is offered through the Overlay | 18 | Device Information for LPDDR chips is offered through the Overlay |
diff --git a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig index 0225cbbf22de..043d50fb6ef6 100644 --- a/drivers/mtd/maps/Kconfig +++ b/drivers/mtd/maps/Kconfig | |||
@@ -491,7 +491,7 @@ config MTD_PCMCIA_ANONYMOUS | |||
491 | 491 | ||
492 | config MTD_BFIN_ASYNC | 492 | config MTD_BFIN_ASYNC |
493 | tristate "Blackfin BF533-STAMP Flash Chip Support" | 493 | tristate "Blackfin BF533-STAMP Flash Chip Support" |
494 | depends on BFIN533_STAMP && MTD_CFI | 494 | depends on BFIN533_STAMP && MTD_CFI && MTD_COMPLEX_MAPPINGS |
495 | select MTD_PARTITIONS | 495 | select MTD_PARTITIONS |
496 | default y | 496 | default y |
497 | help | 497 | help |
diff --git a/drivers/mtd/maps/bfin-async-flash.c b/drivers/mtd/maps/bfin-async-flash.c index 6fec86aaed7e..576611f605db 100644 --- a/drivers/mtd/maps/bfin-async-flash.c +++ b/drivers/mtd/maps/bfin-async-flash.c | |||
@@ -152,14 +152,18 @@ static int __devinit bfin_flash_probe(struct platform_device *pdev) | |||
152 | 152 | ||
153 | if (gpio_request(state->enet_flash_pin, DRIVER_NAME)) { | 153 | if (gpio_request(state->enet_flash_pin, DRIVER_NAME)) { |
154 | pr_devinit(KERN_ERR DRIVER_NAME ": Failed to request gpio %d\n", state->enet_flash_pin); | 154 | pr_devinit(KERN_ERR DRIVER_NAME ": Failed to request gpio %d\n", state->enet_flash_pin); |
155 | kfree(state); | ||
155 | return -EBUSY; | 156 | return -EBUSY; |
156 | } | 157 | } |
157 | gpio_direction_output(state->enet_flash_pin, 1); | 158 | gpio_direction_output(state->enet_flash_pin, 1); |
158 | 159 | ||
159 | pr_devinit(KERN_NOTICE DRIVER_NAME ": probing %d-bit flash bus\n", state->map.bankwidth * 8); | 160 | pr_devinit(KERN_NOTICE DRIVER_NAME ": probing %d-bit flash bus\n", state->map.bankwidth * 8); |
160 | state->mtd = do_map_probe(memory->name, &state->map); | 161 | state->mtd = do_map_probe(memory->name, &state->map); |
161 | if (!state->mtd) | 162 | if (!state->mtd) { |
163 | gpio_free(state->enet_flash_pin); | ||
164 | kfree(state); | ||
162 | return -ENXIO; | 165 | return -ENXIO; |
166 | } | ||
163 | 167 | ||
164 | #ifdef CONFIG_MTD_PARTITIONS | 168 | #ifdef CONFIG_MTD_PARTITIONS |
165 | ret = parse_mtd_partitions(state->mtd, part_probe_types, &pdata->parts, 0); | 169 | ret = parse_mtd_partitions(state->mtd, part_probe_types, &pdata->parts, 0); |
diff --git a/drivers/mtd/maps/ck804xrom.c b/drivers/mtd/maps/ck804xrom.c index 5f7a245ed132..424f17d6ffd1 100644 --- a/drivers/mtd/maps/ck804xrom.c +++ b/drivers/mtd/maps/ck804xrom.c | |||
@@ -342,9 +342,9 @@ static struct pci_device_id ck804xrom_pci_tbl[] = { | |||
342 | { 0, } | 342 | { 0, } |
343 | }; | 343 | }; |
344 | 344 | ||
345 | #if 0 | ||
345 | MODULE_DEVICE_TABLE(pci, ck804xrom_pci_tbl); | 346 | MODULE_DEVICE_TABLE(pci, ck804xrom_pci_tbl); |
346 | 347 | ||
347 | #if 0 | ||
348 | static struct pci_driver ck804xrom_driver = { | 348 | static struct pci_driver ck804xrom_driver = { |
349 | .name = MOD_NAME, | 349 | .name = MOD_NAME, |
350 | .id_table = ck804xrom_pci_tbl, | 350 | .id_table = ck804xrom_pci_tbl, |
diff --git a/drivers/mtd/maps/physmap.c b/drivers/mtd/maps/physmap.c index 87743661d48e..4b122e7ab4b3 100644 --- a/drivers/mtd/maps/physmap.c +++ b/drivers/mtd/maps/physmap.c | |||
@@ -29,6 +29,7 @@ struct physmap_flash_info { | |||
29 | struct map_info map[MAX_RESOURCES]; | 29 | struct map_info map[MAX_RESOURCES]; |
30 | #ifdef CONFIG_MTD_PARTITIONS | 30 | #ifdef CONFIG_MTD_PARTITIONS |
31 | int nr_parts; | 31 | int nr_parts; |
32 | struct mtd_partition *parts; | ||
32 | #endif | 33 | #endif |
33 | }; | 34 | }; |
34 | 35 | ||
@@ -45,25 +46,26 @@ static int physmap_flash_remove(struct platform_device *dev) | |||
45 | 46 | ||
46 | physmap_data = dev->dev.platform_data; | 47 | physmap_data = dev->dev.platform_data; |
47 | 48 | ||
48 | #ifdef CONFIG_MTD_CONCAT | 49 | #ifdef CONFIG_MTD_PARTITIONS |
49 | if (info->cmtd != info->mtd[0]) { | 50 | if (info->nr_parts) { |
51 | del_mtd_partitions(info->cmtd); | ||
52 | kfree(info->parts); | ||
53 | } else if (physmap_data->nr_parts) | ||
54 | del_mtd_partitions(info->cmtd); | ||
55 | else | ||
50 | del_mtd_device(info->cmtd); | 56 | del_mtd_device(info->cmtd); |
57 | #else | ||
58 | del_mtd_device(info->cmtd); | ||
59 | #endif | ||
60 | |||
61 | #ifdef CONFIG_MTD_CONCAT | ||
62 | if (info->cmtd != info->mtd[0]) | ||
51 | mtd_concat_destroy(info->cmtd); | 63 | mtd_concat_destroy(info->cmtd); |
52 | } | ||
53 | #endif | 64 | #endif |
54 | 65 | ||
55 | for (i = 0; i < MAX_RESOURCES; i++) { | 66 | for (i = 0; i < MAX_RESOURCES; i++) { |
56 | if (info->mtd[i] != NULL) { | 67 | if (info->mtd[i] != NULL) |
57 | #ifdef CONFIG_MTD_PARTITIONS | ||
58 | if (info->nr_parts || physmap_data->nr_parts) | ||
59 | del_mtd_partitions(info->mtd[i]); | ||
60 | else | ||
61 | del_mtd_device(info->mtd[i]); | ||
62 | #else | ||
63 | del_mtd_device(info->mtd[i]); | ||
64 | #endif | ||
65 | map_destroy(info->mtd[i]); | 68 | map_destroy(info->mtd[i]); |
66 | } | ||
67 | } | 69 | } |
68 | return 0; | 70 | return 0; |
69 | } | 71 | } |
@@ -86,9 +88,6 @@ static int physmap_flash_probe(struct platform_device *dev) | |||
86 | int err = 0; | 88 | int err = 0; |
87 | int i; | 89 | int i; |
88 | int devices_found = 0; | 90 | int devices_found = 0; |
89 | #ifdef CONFIG_MTD_PARTITIONS | ||
90 | struct mtd_partition *parts; | ||
91 | #endif | ||
92 | 91 | ||
93 | physmap_data = dev->dev.platform_data; | 92 | physmap_data = dev->dev.platform_data; |
94 | if (physmap_data == NULL) | 93 | if (physmap_data == NULL) |
@@ -167,10 +166,11 @@ static int physmap_flash_probe(struct platform_device *dev) | |||
167 | goto err_out; | 166 | goto err_out; |
168 | 167 | ||
169 | #ifdef CONFIG_MTD_PARTITIONS | 168 | #ifdef CONFIG_MTD_PARTITIONS |
170 | err = parse_mtd_partitions(info->cmtd, part_probe_types, &parts, 0); | 169 | err = parse_mtd_partitions(info->cmtd, part_probe_types, |
170 | &info->parts, 0); | ||
171 | if (err > 0) { | 171 | if (err > 0) { |
172 | add_mtd_partitions(info->cmtd, parts, err); | 172 | add_mtd_partitions(info->cmtd, info->parts, err); |
173 | kfree(parts); | 173 | info->nr_parts = err; |
174 | return 0; | 174 | return 0; |
175 | } | 175 | } |
176 | 176 | ||