aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/nand_base.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-01-17 14:15:30 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2011-01-17 14:15:30 -0500
commitab2020f2f11fc7fb81e6c71298b0830d85412011 (patch)
treec9a6342063461dcf31278d65585bca73bdda4a84 /drivers/mtd/nand/nand_base.c
parent235646a486d10891bd86af28d8eac75d9f22bd2d (diff)
parent154bf89f5e3e3dc59666926f27ca4a0866f39157 (diff)
Merge git://git.infradead.org/mtd-2.6
* git://git.infradead.org/mtd-2.6: (59 commits) mtd: mtdpart: disallow reading OOB past the end of the partition mtd: pxa3xx_nand: NULL dereference in pxa3xx_nand_probe UBI: use mtd->writebufsize to set minimal I/O unit size mtd: initialize writebufsize in the MTD object of a partition mtd: onenand: add mtd->writebufsize initialization mtd: nand: add mtd->writebufsize initialization mtd: cfi: add writebufsize initialization mtd: add writebufsize field to mtd_info struct mtd: OneNAND: OMAP2/3: prevent regulator sleeping while OneNAND is in use mtd: OneNAND: add enable / disable methods to onenand_chip mtd: m25p80: Fix JEDEC ID for AT26DF321 mtd: txx9ndfmc: limit transfer bytes to 512 (ECC provides 6 bytes max) mtd: cfi_cmdset_0002: add support for Samsung K8D3x16UxC NOR chips mtd: cfi_cmdset_0002: add support for Samsung K8D6x16UxM NOR chips mtd: nand: ams-delta: drop omap_read/write, use ioremap mtd: m25p80: add debugging trace in sst_write mtd: nand: ams-delta: select for built-in by default mtd: OneNAND: lighten scary initial bad block messages mtd: OneNAND: OMAP2/3: add support for command line partitioning mtd: nand: rearrange ONFI revision checking, add ONFI 2.3 ... Fix up trivial conflict in drivers/mtd/Kconfig as per DavidW.
Diffstat (limited to 'drivers/mtd/nand/nand_base.c')
-rw-r--r--drivers/mtd/nand/nand_base.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 31bf376b82a0..a9c6ce745767 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -2865,20 +2865,24 @@ static int nand_flash_detect_onfi(struct mtd_info *mtd, struct nand_chip *chip,
2865 2865
2866 /* check version */ 2866 /* check version */
2867 val = le16_to_cpu(p->revision); 2867 val = le16_to_cpu(p->revision);
2868 if (val == 1 || val > (1 << 4)) { 2868 if (val & (1 << 5))
2869 printk(KERN_INFO "%s: unsupported ONFI version: %d\n", 2869 chip->onfi_version = 23;
2870 __func__, val); 2870 else if (val & (1 << 4))
2871 return 0;
2872 }
2873
2874 if (val & (1 << 4))
2875 chip->onfi_version = 22; 2871 chip->onfi_version = 22;
2876 else if (val & (1 << 3)) 2872 else if (val & (1 << 3))
2877 chip->onfi_version = 21; 2873 chip->onfi_version = 21;
2878 else if (val & (1 << 2)) 2874 else if (val & (1 << 2))
2879 chip->onfi_version = 20; 2875 chip->onfi_version = 20;
2880 else 2876 else if (val & (1 << 1))
2881 chip->onfi_version = 10; 2877 chip->onfi_version = 10;
2878 else
2879 chip->onfi_version = 0;
2880
2881 if (!chip->onfi_version) {
2882 printk(KERN_INFO "%s: unsupported ONFI version: %d\n",
2883 __func__, val);
2884 return 0;
2885 }
2882 2886
2883 sanitize_string(p->manufacturer, sizeof(p->manufacturer)); 2887 sanitize_string(p->manufacturer, sizeof(p->manufacturer));
2884 sanitize_string(p->model, sizeof(p->model)); 2888 sanitize_string(p->model, sizeof(p->model));
@@ -2887,7 +2891,7 @@ static int nand_flash_detect_onfi(struct mtd_info *mtd, struct nand_chip *chip,
2887 mtd->writesize = le32_to_cpu(p->byte_per_page); 2891 mtd->writesize = le32_to_cpu(p->byte_per_page);
2888 mtd->erasesize = le32_to_cpu(p->pages_per_block) * mtd->writesize; 2892 mtd->erasesize = le32_to_cpu(p->pages_per_block) * mtd->writesize;
2889 mtd->oobsize = le16_to_cpu(p->spare_bytes_per_page); 2893 mtd->oobsize = le16_to_cpu(p->spare_bytes_per_page);
2890 chip->chipsize = le32_to_cpu(p->blocks_per_lun) * mtd->erasesize; 2894 chip->chipsize = (uint64_t)le32_to_cpu(p->blocks_per_lun) * mtd->erasesize;
2891 busw = 0; 2895 busw = 0;
2892 if (le16_to_cpu(p->features) & 1) 2896 if (le16_to_cpu(p->features) & 1)
2893 busw = NAND_BUSWIDTH_16; 2897 busw = NAND_BUSWIDTH_16;
@@ -3157,7 +3161,7 @@ ident_done:
3157 printk(KERN_INFO "NAND device: Manufacturer ID:" 3161 printk(KERN_INFO "NAND device: Manufacturer ID:"
3158 " 0x%02x, Chip ID: 0x%02x (%s %s)\n", *maf_id, *dev_id, 3162 " 0x%02x, Chip ID: 0x%02x (%s %s)\n", *maf_id, *dev_id,
3159 nand_manuf_ids[maf_idx].name, 3163 nand_manuf_ids[maf_idx].name,
3160 chip->onfi_version ? type->name : chip->onfi_params.model); 3164 chip->onfi_version ? chip->onfi_params.model : type->name);
3161 3165
3162 return type; 3166 return type;
3163} 3167}
@@ -3435,6 +3439,7 @@ int nand_scan_tail(struct mtd_info *mtd)
3435 mtd->resume = nand_resume; 3439 mtd->resume = nand_resume;
3436 mtd->block_isbad = nand_block_isbad; 3440 mtd->block_isbad = nand_block_isbad;
3437 mtd->block_markbad = nand_block_markbad; 3441 mtd->block_markbad = nand_block_markbad;
3442 mtd->writebufsize = mtd->writesize;
3438 3443
3439 /* propagate ecc.layout to mtd_info */ 3444 /* propagate ecc.layout to mtd_info */
3440 mtd->ecclayout = chip->ecc.layout; 3445 mtd->ecclayout = chip->ecc.layout;