Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'for-linus-20140716' of git://git.infradead.org/linux-mtd

Pull MTD fixes from Brian Norris:

- Fix ELM suspend/resume

- Reduce warnings if NAND ECC is too weak

- Add CFI support for Sharp LH28F640BF NOR

The last fix is coming in because other commits in the 3.16 cycle
depended on this support.

* tag 'for-linus-20140716' of git://git.infradead.org/linux-mtd:
mtd: cfi_cmdset_0001.c: add support for Sharp LH28F640BF NOR
mtd: nand: reduce the warning noise when the ECC is too weak
mtd: devices: elm: fix elm_context_save() and elm_context_restore() functions

+49 -2
+43
drivers/mtd/chips/cfi_cmdset_0001.c
··· 52 52 /* Atmel chips */ 53 53 #define AT49BV640D 0x02de 54 54 #define AT49BV640DT 0x02db 55 + /* Sharp chips */ 56 + #define LH28F640BFHE_PTTL90 0x00b0 57 + #define LH28F640BFHE_PBTL90 0x00b1 58 + #define LH28F640BFHE_PTTL70A 0x00b2 59 + #define LH28F640BFHE_PBTL70A 0x00b3 55 60 56 61 static int cfi_intelext_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *); 57 62 static int cfi_intelext_write_words(struct mtd_info *, loff_t, size_t, size_t *, const u_char *); ··· 263 258 (cfi->cfiq->EraseRegionInfo[1] & 0xffff0000) | 0x3e; 264 259 }; 265 260 261 + static int is_LH28F640BF(struct cfi_private *cfi) 262 + { 263 + /* Sharp LH28F640BF Family */ 264 + if (cfi->mfr == CFI_MFR_SHARP && ( 265 + cfi->id == LH28F640BFHE_PTTL90 || cfi->id == LH28F640BFHE_PBTL90 || 266 + cfi->id == LH28F640BFHE_PTTL70A || cfi->id == LH28F640BFHE_PBTL70A)) 267 + return 1; 268 + return 0; 269 + } 270 + 271 + static void fixup_LH28F640BF(struct mtd_info *mtd) 272 + { 273 + struct map_info *map = mtd->priv; 274 + struct cfi_private *cfi = map->fldrv_priv; 275 + struct cfi_pri_intelext *extp = cfi->cmdset_priv; 276 + 277 + /* Reset the Partition Configuration Register on LH28F640BF 278 + * to a single partition (PCR = 0x000): PCR is embedded into A0-A15. */ 279 + if (is_LH28F640BF(cfi)) { 280 + printk(KERN_INFO "Reset Partition Config. Register: 1 Partition of 4 planes\n"); 281 + map_write(map, CMD(0x60), 0); 282 + map_write(map, CMD(0x04), 0); 283 + 284 + /* We have set one single partition thus 285 + * Simultaneous Operations are not allowed */ 286 + printk(KERN_INFO "cfi_cmdset_0001: Simultaneous Operations disabled\n"); 287 + extp->FeatureSupport &= ~512; 288 + } 289 + } 290 + 266 291 static void fixup_use_point(struct mtd_info *mtd) 267 292 { 268 293 struct map_info *map = mtd->priv; ··· 344 309 { CFI_MFR_ST, 0x00ba, /* M28W320CT */ fixup_st_m28w320ct }, 345 310 { CFI_MFR_ST, 0x00bb, /* M28W320CB */ fixup_st_m28w320cb }, 346 311 { CFI_MFR_INTEL, CFI_ID_ANY, fixup_unlock_powerup_lock }, 312 + { CFI_MFR_SHARP, CFI_ID_ANY, fixup_unlock_powerup_lock }, 313 + { CFI_MFR_SHARP, CFI_ID_ANY, fixup_LH28F640BF }, 347 314 { 0, 0, NULL } 348 315 }; 349 316 ··· 1685 1648 adr += chip->start; 1686 1649 initial_adr = adr; 1687 1650 cmd_adr = adr & ~(wbufsize-1); 1651 + 1652 + /* Sharp LH28F640BF chips need the first address for the 1653 + * Page Buffer Program command. See Table 5 of 1654 + * LH28F320BF, LH28F640BF, LH28F128BF Series (Appendix FUM00701) */ 1655 + if (is_LH28F640BF(cfi)) 1656 + cmd_adr = adr; 1688 1657 1689 1658 /* Let's determine this according to the interleave only once */ 1690 1659 write_cmd = (cfi->cfiq->P_ID != P_ID_INTEL_PERFORMANCE) ? CMD(0xe8) : CMD(0xe9);
+2
drivers/mtd/devices/elm.c
··· 475 475 ELM_SYNDROME_FRAGMENT_1 + offset); 476 476 regs->elm_syndrome_fragment_0[i] = elm_read_reg(info, 477 477 ELM_SYNDROME_FRAGMENT_0 + offset); 478 + break; 478 479 default: 479 480 return -EINVAL; 480 481 } ··· 521 520 regs->elm_syndrome_fragment_1[i]); 522 521 elm_write_reg(info, ELM_SYNDROME_FRAGMENT_0 + offset, 523 522 regs->elm_syndrome_fragment_0[i]); 523 + break; 524 524 default: 525 525 return -EINVAL; 526 526 }
+4 -2
drivers/mtd/nand/nand_base.c
··· 4047 4047 ecc->layout->oobavail += ecc->layout->oobfree[i].length; 4048 4048 mtd->oobavail = ecc->layout->oobavail; 4049 4049 4050 - /* ECC sanity check: warn noisily if it's too weak */ 4051 - WARN_ON(!nand_ecc_strength_good(mtd)); 4050 + /* ECC sanity check: warn if it's too weak */ 4051 + if (!nand_ecc_strength_good(mtd)) 4052 + pr_warn("WARNING: %s: the ECC used on your system is too weak compared to the one required by the NAND chip\n", 4053 + mtd->name); 4052 4054 4053 4055 /* 4054 4056 * Set the number of read / write steps for one page depending on ECC