aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mtd/nand/nand_base.c8
-rw-r--r--include/linux/mtd/nand.h6
2 files changed, 13 insertions, 1 deletions
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 1c4823696be2..b9dc65c7253c 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -434,6 +434,11 @@ static int nand_default_block_markbad(struct mtd_info *mtd, loff_t ofs)
434static int nand_check_wp(struct mtd_info *mtd) 434static int nand_check_wp(struct mtd_info *mtd)
435{ 435{
436 struct nand_chip *chip = mtd->priv; 436 struct nand_chip *chip = mtd->priv;
437
438 /* broken xD cards report WP despite being writable */
439 if (chip->options & NAND_BROKEN_XD)
440 return 0;
441
437 /* Check the WP bit */ 442 /* Check the WP bit */
438 chip->cmdfunc(mtd, NAND_CMD_STATUS, -1, -1); 443 chip->cmdfunc(mtd, NAND_CMD_STATUS, -1, -1);
439 return (chip->read_byte(mtd) & NAND_STATUS_WP) ? 0 : 1; 444 return (chip->read_byte(mtd) & NAND_STATUS_WP) ? 0 : 1;
@@ -3175,7 +3180,8 @@ int nand_scan_tail(struct mtd_info *mtd)
3175 3180
3176 /* Fill in remaining MTD driver data */ 3181 /* Fill in remaining MTD driver data */
3177 mtd->type = MTD_NANDFLASH; 3182 mtd->type = MTD_NANDFLASH;
3178 mtd->flags = MTD_CAP_NANDFLASH; 3183 mtd->flags = (chip->options & NAND_ROM) ? MTD_CAP_ROM :
3184 MTD_CAP_NANDFLASH;
3179 mtd->erase = nand_erase; 3185 mtd->erase = nand_erase;
3180 mtd->point = NULL; 3186 mtd->point = NULL;
3181 mtd->unpoint = NULL; 3187 mtd->unpoint = NULL;
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index d152bdf9161f..8bdacb885f90 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -182,6 +182,12 @@ typedef enum {
182/* Chip does not allow subpage writes */ 182/* Chip does not allow subpage writes */
183#define NAND_NO_SUBPAGE_WRITE 0x00000200 183#define NAND_NO_SUBPAGE_WRITE 0x00000200
184 184
185/* Device is one of 'new' xD cards that expose fake nand command set */
186#define NAND_BROKEN_XD 0x00000400
187
188/* Device behaves just like nand, but is readonly */
189#define NAND_ROM 0x00000800
190
185/* Options valid for Samsung large page devices */ 191/* Options valid for Samsung large page devices */
186#define NAND_SAMSUNG_LP_OPTIONS \ 192#define NAND_SAMSUNG_LP_OPTIONS \
187 (NAND_NO_PADDING | NAND_CACHEPRG | NAND_COPYBACK) 193 (NAND_NO_PADDING | NAND_CACHEPRG | NAND_COPYBACK)