aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/chips/Kconfig2
-rw-r--r--drivers/mtd/chips/cfi_cmdset_0001.c15
-rw-r--r--drivers/mtd/devices/mtd_dataflash.c2
-rw-r--r--drivers/mtd/maps/dc21285.c9
-rw-r--r--drivers/mtd/maps/tsunami_flash.c2
-rw-r--r--drivers/mtd/redboot.c28
6 files changed, 43 insertions, 15 deletions
diff --git a/drivers/mtd/chips/Kconfig b/drivers/mtd/chips/Kconfig
index effa0d7a73ac..205bb7083335 100644
--- a/drivers/mtd/chips/Kconfig
+++ b/drivers/mtd/chips/Kconfig
@@ -301,7 +301,7 @@ config MTD_JEDEC
301 301
302config MTD_XIP 302config MTD_XIP
303 bool "XIP aware MTD support" 303 bool "XIP aware MTD support"
304 depends on !SMP && (MTD_CFI_INTELEXT || MTD_CFI_AMDSTD) && EXPERIMENTAL && ARM 304 depends on !SMP && (MTD_CFI_INTELEXT || MTD_CFI_AMDSTD) && EXPERIMENTAL && ARCH_MTD_XIP
305 default y if XIP_KERNEL 305 default y if XIP_KERNEL
306 help 306 help
307 This allows MTD support to work with flash memory which is also 307 This allows MTD support to work with flash memory which is also
diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c
index 69c04945591f..1c074d63ff3a 100644
--- a/drivers/mtd/chips/cfi_cmdset_0001.c
+++ b/drivers/mtd/chips/cfi_cmdset_0001.c
@@ -408,6 +408,7 @@ struct mtd_info *cfi_cmdset_0001(struct map_info *map, int primary)
408 cfi->chips[i].buffer_write_time = 1<<cfi->cfiq->BufWriteTimeoutTyp; 408 cfi->chips[i].buffer_write_time = 1<<cfi->cfiq->BufWriteTimeoutTyp;
409 cfi->chips[i].erase_time = 1<<cfi->cfiq->BlockEraseTimeoutTyp; 409 cfi->chips[i].erase_time = 1<<cfi->cfiq->BlockEraseTimeoutTyp;
410 cfi->chips[i].ref_point_counter = 0; 410 cfi->chips[i].ref_point_counter = 0;
411 init_waitqueue_head(&(cfi->chips[i].wq));
411 } 412 }
412 413
413 map->fldrv = &cfi_intelext_chipdrv; 414 map->fldrv = &cfi_intelext_chipdrv;
@@ -1019,8 +1020,8 @@ static void __xipram xip_udelay(struct map_info *map, struct flchip *chip,
1019#define XIP_INVAL_CACHED_RANGE(map, from, size) \ 1020#define XIP_INVAL_CACHED_RANGE(map, from, size) \
1020 INVALIDATE_CACHED_RANGE(map, from, size) 1021 INVALIDATE_CACHED_RANGE(map, from, size)
1021 1022
1022#define INVALIDATE_CACHE_UDELAY(map, chip, adr, len, usec) \ 1023#define INVALIDATE_CACHE_UDELAY(map, chip, cmd_adr, adr, len, usec) \
1023 UDELAY(map, chip, adr, usec) 1024 UDELAY(map, chip, cmd_adr, usec)
1024 1025
1025/* 1026/*
1026 * Extra notes: 1027 * Extra notes:
@@ -1052,7 +1053,7 @@ do { \
1052 spin_lock(chip->mutex); \ 1053 spin_lock(chip->mutex); \
1053} while (0) 1054} while (0)
1054 1055
1055#define INVALIDATE_CACHE_UDELAY(map, chip, adr, len, usec) \ 1056#define INVALIDATE_CACHE_UDELAY(map, chip, cmd_adr, adr, len, usec) \
1056do { \ 1057do { \
1057 spin_unlock(chip->mutex); \ 1058 spin_unlock(chip->mutex); \
1058 INVALIDATE_CACHED_RANGE(map, adr, len); \ 1059 INVALIDATE_CACHED_RANGE(map, adr, len); \
@@ -1284,7 +1285,7 @@ static int __xipram do_write_oneword(struct map_info *map, struct flchip *chip,
1284 map_write(map, datum, adr); 1285 map_write(map, datum, adr);
1285 chip->state = mode; 1286 chip->state = mode;
1286 1287
1287 INVALIDATE_CACHE_UDELAY(map, chip, 1288 INVALIDATE_CACHE_UDELAY(map, chip, adr,
1288 adr, map_bankwidth(map), 1289 adr, map_bankwidth(map),
1289 chip->word_write_time); 1290 chip->word_write_time);
1290 1291
@@ -1572,8 +1573,8 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip,
1572 map_write(map, CMD(0xd0), cmd_adr); 1573 map_write(map, CMD(0xd0), cmd_adr);
1573 chip->state = FL_WRITING; 1574 chip->state = FL_WRITING;
1574 1575
1575 INVALIDATE_CACHE_UDELAY(map, chip, 1576 INVALIDATE_CACHE_UDELAY(map, chip, cmd_adr,
1576 cmd_adr, len, 1577 adr, len,
1577 chip->buffer_write_time); 1578 chip->buffer_write_time);
1578 1579
1579 timeo = jiffies + (HZ/2); 1580 timeo = jiffies + (HZ/2);
@@ -1744,7 +1745,7 @@ static int __xipram do_erase_oneblock(struct map_info *map, struct flchip *chip,
1744 chip->state = FL_ERASING; 1745 chip->state = FL_ERASING;
1745 chip->erase_suspended = 0; 1746 chip->erase_suspended = 0;
1746 1747
1747 INVALIDATE_CACHE_UDELAY(map, chip, 1748 INVALIDATE_CACHE_UDELAY(map, chip, adr,
1748 adr, len, 1749 adr, len,
1749 chip->erase_time*1000/2); 1750 chip->erase_time*1000/2);
1750 1751
diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c
index 155737e7483f..a19480d07888 100644
--- a/drivers/mtd/devices/mtd_dataflash.c
+++ b/drivers/mtd/devices/mtd_dataflash.c
@@ -178,7 +178,7 @@ static int dataflash_erase(struct mtd_info *mtd, struct erase_info *instr)
178 * we're at a block boundary and need to erase the whole block. 178 * we're at a block boundary and need to erase the whole block.
179 */ 179 */
180 pageaddr = instr->addr / priv->page_size; 180 pageaddr = instr->addr / priv->page_size;
181 do_block = (pageaddr & 0x7) == 0 && instr->len <= blocksize; 181 do_block = (pageaddr & 0x7) == 0 && instr->len >= blocksize;
182 pageaddr = pageaddr << priv->page_offset; 182 pageaddr = pageaddr << priv->page_offset;
183 183
184 command[0] = do_block ? OP_ERASE_BLOCK : OP_ERASE_PAGE; 184 command[0] = do_block ? OP_ERASE_BLOCK : OP_ERASE_PAGE;
diff --git a/drivers/mtd/maps/dc21285.c b/drivers/mtd/maps/dc21285.c
index 701620b6baed..8b3784e2de89 100644
--- a/drivers/mtd/maps/dc21285.c
+++ b/drivers/mtd/maps/dc21285.c
@@ -110,8 +110,9 @@ static void dc21285_copy_to_32(struct map_info *map, unsigned long to, const voi
110{ 110{
111 while (len > 0) { 111 while (len > 0) {
112 map_word d; 112 map_word d;
113 d.x[0] = *((uint32_t*)from)++; 113 d.x[0] = *((uint32_t*)from);
114 dc21285_write32(map, d, to); 114 dc21285_write32(map, d, to);
115 from += 4;
115 to += 4; 116 to += 4;
116 len -= 4; 117 len -= 4;
117 } 118 }
@@ -121,8 +122,9 @@ static void dc21285_copy_to_16(struct map_info *map, unsigned long to, const voi
121{ 122{
122 while (len > 0) { 123 while (len > 0) {
123 map_word d; 124 map_word d;
124 d.x[0] = *((uint16_t*)from)++; 125 d.x[0] = *((uint16_t*)from);
125 dc21285_write16(map, d, to); 126 dc21285_write16(map, d, to);
127 from += 2;
126 to += 2; 128 to += 2;
127 len -= 2; 129 len -= 2;
128 } 130 }
@@ -131,8 +133,9 @@ static void dc21285_copy_to_16(struct map_info *map, unsigned long to, const voi
131static void dc21285_copy_to_8(struct map_info *map, unsigned long to, const void *from, ssize_t len) 133static void dc21285_copy_to_8(struct map_info *map, unsigned long to, const void *from, ssize_t len)
132{ 134{
133 map_word d; 135 map_word d;
134 d.x[0] = *((uint8_t*)from)++; 136 d.x[0] = *((uint8_t*)from);
135 dc21285_write8(map, d, to); 137 dc21285_write8(map, d, to);
138 from++;
136 to++; 139 to++;
137 len--; 140 len--;
138} 141}
diff --git a/drivers/mtd/maps/tsunami_flash.c b/drivers/mtd/maps/tsunami_flash.c
index 9e21e6c02f80..0f915ac3102e 100644
--- a/drivers/mtd/maps/tsunami_flash.c
+++ b/drivers/mtd/maps/tsunami_flash.c
@@ -62,7 +62,7 @@ static void tsunami_flash_copy_to(
62static struct map_info tsunami_flash_map = { 62static struct map_info tsunami_flash_map = {
63 .name = "flash chip on the Tsunami TIG bus", 63 .name = "flash chip on the Tsunami TIG bus",
64 .size = MAX_TIG_FLASH_SIZE, 64 .size = MAX_TIG_FLASH_SIZE,
65 .phys = NO_XIP; 65 .phys = NO_XIP,
66 .bankwidth = 1, 66 .bankwidth = 1,
67 .read = tsunami_flash_read8, 67 .read = tsunami_flash_read8,
68 .copy_from = tsunami_flash_copy_from, 68 .copy_from = tsunami_flash_copy_from,
diff --git a/drivers/mtd/redboot.c b/drivers/mtd/redboot.c
index 7b7ca5ab5ae4..8815c8dbef2d 100644
--- a/drivers/mtd/redboot.c
+++ b/drivers/mtd/redboot.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: redboot.c,v 1.18 2005/11/07 11:14:21 gleixner Exp $ 2 * $Id: redboot.c,v 1.19 2005/12/01 10:03:51 dwmw2 Exp $
3 * 3 *
4 * Parse RedBoot-style Flash Image System (FIS) tables and 4 * Parse RedBoot-style Flash Image System (FIS) tables and
5 * produce a Linux partition array to match. 5 * produce a Linux partition array to match.
@@ -89,8 +89,32 @@ static int parse_redboot_partitions(struct mtd_info *master,
89 i = numslots; 89 i = numslots;
90 break; 90 break;
91 } 91 }
92 if (!memcmp(buf[i].name, "FIS directory", 14)) 92 if (!memcmp(buf[i].name, "FIS directory", 14)) {
93 /* This is apparently the FIS directory entry for the
94 * FIS directory itself. The FIS directory size is
95 * one erase block; if the buf[i].size field is
96 * swab32(erasesize) then we know we are looking at
97 * a byte swapped FIS directory - swap all the entries!
98 * (NOTE: this is 'size' not 'data_length'; size is
99 * the full size of the entry.)
100 */
101 if (swab32(buf[i].size) == master->erasesize) {
102 int j;
103 for (j = 0; j < numslots && buf[j].name[0] != 0xff; ++j) {
104 /* The unsigned long fields were written with the
105 * wrong byte sex, name and pad have no byte sex.
106 */
107 swab32s(&buf[j].flash_base);
108 swab32s(&buf[j].mem_base);
109 swab32s(&buf[j].size);
110 swab32s(&buf[j].entry_point);
111 swab32s(&buf[j].data_length);
112 swab32s(&buf[j].desc_cksum);
113 swab32s(&buf[j].file_cksum);
114 }
115 }
93 break; 116 break;
117 }
94 } 118 }
95 if (i == numslots) { 119 if (i == numslots) {
96 /* Didn't find it */ 120 /* Didn't find it */