diff options
Diffstat (limited to 'drivers/mtd/nand/nandsim.c')
-rw-r--r-- | drivers/mtd/nand/nandsim.c | 28 |
1 files changed, 3 insertions, 25 deletions
diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c index 261f478f8cc3..6cc8fbfabb8e 100644 --- a/drivers/mtd/nand/nandsim.c +++ b/drivers/mtd/nand/nandsim.c | |||
@@ -268,7 +268,6 @@ MODULE_PARM_DESC(bch, "Enable BCH ecc and set how many bits should " | |||
268 | #define OPT_PAGE512 0x00000002 /* 512-byte page chips */ | 268 | #define OPT_PAGE512 0x00000002 /* 512-byte page chips */ |
269 | #define OPT_PAGE2048 0x00000008 /* 2048-byte page chips */ | 269 | #define OPT_PAGE2048 0x00000008 /* 2048-byte page chips */ |
270 | #define OPT_SMARTMEDIA 0x00000010 /* SmartMedia technology chips */ | 270 | #define OPT_SMARTMEDIA 0x00000010 /* SmartMedia technology chips */ |
271 | #define OPT_AUTOINCR 0x00000020 /* page number auto incrementation is possible */ | ||
272 | #define OPT_PAGE512_8BIT 0x00000040 /* 512-byte page chips with 8-bit bus width */ | 271 | #define OPT_PAGE512_8BIT 0x00000040 /* 512-byte page chips with 8-bit bus width */ |
273 | #define OPT_PAGE4096 0x00000080 /* 4096-byte page chips */ | 272 | #define OPT_PAGE4096 0x00000080 /* 4096-byte page chips */ |
274 | #define OPT_LARGEPAGE (OPT_PAGE2048 | OPT_PAGE4096) /* 2048 & 4096-byte page chips */ | 273 | #define OPT_LARGEPAGE (OPT_PAGE2048 | OPT_PAGE4096) /* 2048 & 4096-byte page chips */ |
@@ -594,7 +593,7 @@ static int init_nandsim(struct mtd_info *mtd) | |||
594 | ns->options |= OPT_PAGE256; | 593 | ns->options |= OPT_PAGE256; |
595 | } | 594 | } |
596 | else if (ns->geom.pgsz == 512) { | 595 | else if (ns->geom.pgsz == 512) { |
597 | ns->options |= (OPT_PAGE512 | OPT_AUTOINCR); | 596 | ns->options |= OPT_PAGE512; |
598 | if (ns->busw == 8) | 597 | if (ns->busw == 8) |
599 | ns->options |= OPT_PAGE512_8BIT; | 598 | ns->options |= OPT_PAGE512_8BIT; |
600 | } else if (ns->geom.pgsz == 2048) { | 599 | } else if (ns->geom.pgsz == 2048) { |
@@ -663,8 +662,6 @@ static int init_nandsim(struct mtd_info *mtd) | |||
663 | for (i = 0; nand_flash_ids[i].name != NULL; i++) { | 662 | for (i = 0; nand_flash_ids[i].name != NULL; i++) { |
664 | if (second_id_byte != nand_flash_ids[i].id) | 663 | if (second_id_byte != nand_flash_ids[i].id) |
665 | continue; | 664 | continue; |
666 | if (!(nand_flash_ids[i].options & NAND_NO_AUTOINCR)) | ||
667 | ns->options |= OPT_AUTOINCR; | ||
668 | } | 665 | } |
669 | 666 | ||
670 | if (ns->busw == 16) | 667 | if (ns->busw == 16) |
@@ -1936,20 +1933,8 @@ static u_char ns_nand_read_byte(struct mtd_info *mtd) | |||
1936 | if (ns->regs.count == ns->regs.num) { | 1933 | if (ns->regs.count == ns->regs.num) { |
1937 | NS_DBG("read_byte: all bytes were read\n"); | 1934 | NS_DBG("read_byte: all bytes were read\n"); |
1938 | 1935 | ||
1939 | /* | 1936 | if (NS_STATE(ns->nxstate) == STATE_READY) |
1940 | * The OPT_AUTOINCR allows to read next consecutive pages without | ||
1941 | * new read operation cycle. | ||
1942 | */ | ||
1943 | if ((ns->options & OPT_AUTOINCR) && NS_STATE(ns->state) == STATE_DATAOUT) { | ||
1944 | ns->regs.count = 0; | ||
1945 | if (ns->regs.row + 1 < ns->geom.pgnum) | ||
1946 | ns->regs.row += 1; | ||
1947 | NS_DBG("read_byte: switch to the next page (%#x)\n", ns->regs.row); | ||
1948 | do_state_action(ns, ACTION_CPY); | ||
1949 | } | ||
1950 | else if (NS_STATE(ns->nxstate) == STATE_READY) | ||
1951 | switch_state(ns); | 1937 | switch_state(ns); |
1952 | |||
1953 | } | 1938 | } |
1954 | 1939 | ||
1955 | return outb; | 1940 | return outb; |
@@ -2203,14 +2188,7 @@ static void ns_nand_read_buf(struct mtd_info *mtd, u_char *buf, int len) | |||
2203 | ns->regs.count += len; | 2188 | ns->regs.count += len; |
2204 | 2189 | ||
2205 | if (ns->regs.count == ns->regs.num) { | 2190 | if (ns->regs.count == ns->regs.num) { |
2206 | if ((ns->options & OPT_AUTOINCR) && NS_STATE(ns->state) == STATE_DATAOUT) { | 2191 | if (NS_STATE(ns->nxstate) == STATE_READY) |
2207 | ns->regs.count = 0; | ||
2208 | if (ns->regs.row + 1 < ns->geom.pgnum) | ||
2209 | ns->regs.row += 1; | ||
2210 | NS_DBG("read_buf: switch to the next page (%#x)\n", ns->regs.row); | ||
2211 | do_state_action(ns, ACTION_CPY); | ||
2212 | } | ||
2213 | else if (NS_STATE(ns->nxstate) == STATE_READY) | ||
2214 | switch_state(ns); | 2192 | switch_state(ns); |
2215 | } | 2193 | } |
2216 | 2194 | ||