Three last MTD fixes for v4.4. These are all fixes for regressions and bugs
reported mid cycle. Unfortunately, some of them took a bit long to get proper testing and feedback. * Assign the default MTD name earlier in the registration process, so partition parsers (like cmdlinepart) see the right name. Without this, some systems may come up with unpartitioned flash. This was a v4.4-rc1 regression. * Revert some new Winbond SPI NOR flash unlocking/locking support; new code in v4.4 caused regressions on some Spansion flash. * Fix mis-typed parameter ordering in SPI NOR unlock function; this bug was introduced in v4.4-rc1. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJWjc+bAAoJEFySrpd9RFgt0vcP/ilmoZGwbKhOY9eYK00N6kzK qzNWWZtinlS/T+H8GAHK1+K/+KroREiQ7EY9pob1QpJMZ6UBTNslVKCTEieMIXFV KoVlOj9rVAD4Aaldh+oWDQ2hggUxNMIrtDvR6D2PJIpCfMeQkB4ZgVeSeQbBFTif /tIvv06Pdnngrv6Zq/xpWCqEMjrrI/rsZG0yGhlw96want+vF8Lxs16dVdn8U4cW x3b6K9WhFEW0s4kQzoHRjmNZK36TRVBa/AZrzNXdbDjSF5Sbc3WqUw6OTDD14Pke Pmy6oflRe5Zt+gajnTuqi8BANaXbXuzXg69hFZSrTW3BRxZaaw0/EHNtkloQqQfG /IQWUeO5UywJ8UZavhGCzzZYrcUTz7nARy9GBtXq9ke1CMRUzPKTPw8qD6sGleFw ruMkybKojvm4Jl95u1/Uxeiy/UC7Dy+DxL1btLrjz8dJrp5gZ74mYeueR73NGJQm 2nShsIP3OHoZs/VOD7bpwqjchIqtO0RCYgNefP0stOWL1Zmgq78Ss8+U8nSdwwbh lgBxV76g1EC2UUkm15dAtTSsJuoHAHJPZ5EoYy4JPa8deKi44DHDTYyKzirpA/ib QyCA3MjCCfpPw82UHAhOsmxXpEaoAlAtQIztowePew7iiJBSJr40KkCz8ibbV+n0 9dRGZoee9/MSTnHGPpnR =xE25 -----END PGP SIGNATURE----- Merge tag 'for-linus-20160106' of git://git.infradead.org/linux-mtd Pull MTD fixes from Brian Norris: "Three last MTD fixes for v4.4. These are all fixes for regressions and bugs reported mid cycle. Unfortunately, some of them took a bit long to get proper testing and feedback. - Assign the default MTD name earlier in the registration process, so partition parsers (like cmdlinepart) see the right name. Without this, some systems may come up with unpartitioned flash. This was a v4.4-rc1 regression. - Revert some new Winbond SPI NOR flash unlocking/locking support; new code in v4.4 caused regressions on some Spansion flash. - Fix mis-typed parameter ordering in SPI NOR unlock function; this bug was introduced in v4.4-rc1" * tag 'for-linus-20160106' of git://git.infradead.org/linux-mtd: mtd: spi-nor: fix stm_is_locked_sr() parameters mtd: spi-nor: fix Spansion regressions (aliased with Winbond) mtd: fix cmdlinepart parser, early naming for auto-filled MTD
This commit is contained in:
commit
b06f3a168c
|
@ -426,15 +426,6 @@ int add_mtd_device(struct mtd_info *mtd)
|
||||||
mtd->erasesize_mask = (1 << mtd->erasesize_shift) - 1;
|
mtd->erasesize_mask = (1 << mtd->erasesize_shift) - 1;
|
||||||
mtd->writesize_mask = (1 << mtd->writesize_shift) - 1;
|
mtd->writesize_mask = (1 << mtd->writesize_shift) - 1;
|
||||||
|
|
||||||
if (mtd->dev.parent) {
|
|
||||||
if (!mtd->owner && mtd->dev.parent->driver)
|
|
||||||
mtd->owner = mtd->dev.parent->driver->owner;
|
|
||||||
if (!mtd->name)
|
|
||||||
mtd->name = dev_name(mtd->dev.parent);
|
|
||||||
} else {
|
|
||||||
pr_debug("mtd device won't show a device symlink in sysfs\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Some chips always power up locked. Unlock them now */
|
/* Some chips always power up locked. Unlock them now */
|
||||||
if ((mtd->flags & MTD_WRITEABLE) && (mtd->flags & MTD_POWERUP_LOCK)) {
|
if ((mtd->flags & MTD_WRITEABLE) && (mtd->flags & MTD_POWERUP_LOCK)) {
|
||||||
error = mtd_unlock(mtd, 0, mtd->size);
|
error = mtd_unlock(mtd, 0, mtd->size);
|
||||||
|
@ -549,6 +540,21 @@ static int mtd_add_device_partitions(struct mtd_info *mtd,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set a few defaults based on the parent devices, if not provided by the
|
||||||
|
* driver
|
||||||
|
*/
|
||||||
|
static void mtd_set_dev_defaults(struct mtd_info *mtd)
|
||||||
|
{
|
||||||
|
if (mtd->dev.parent) {
|
||||||
|
if (!mtd->owner && mtd->dev.parent->driver)
|
||||||
|
mtd->owner = mtd->dev.parent->driver->owner;
|
||||||
|
if (!mtd->name)
|
||||||
|
mtd->name = dev_name(mtd->dev.parent);
|
||||||
|
} else {
|
||||||
|
pr_debug("mtd device won't show a device symlink in sysfs\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* mtd_device_parse_register - parse partitions and register an MTD device.
|
* mtd_device_parse_register - parse partitions and register an MTD device.
|
||||||
|
@ -587,6 +593,8 @@ int mtd_device_parse_register(struct mtd_info *mtd, const char * const *types,
|
||||||
int ret;
|
int ret;
|
||||||
struct mtd_partition *real_parts = NULL;
|
struct mtd_partition *real_parts = NULL;
|
||||||
|
|
||||||
|
mtd_set_dev_defaults(mtd);
|
||||||
|
|
||||||
ret = parse_mtd_partitions(mtd, types, &real_parts, parser_data);
|
ret = parse_mtd_partitions(mtd, types, &real_parts, parser_data);
|
||||||
if (ret <= 0 && nr_parts && parts) {
|
if (ret <= 0 && nr_parts && parts) {
|
||||||
real_parts = kmemdup(parts, sizeof(*parts) * nr_parts,
|
real_parts = kmemdup(parts, sizeof(*parts) * nr_parts,
|
||||||
|
|
|
@ -516,8 +516,8 @@ static int stm_unlock(struct spi_nor *nor, loff_t ofs, uint64_t len)
|
||||||
status_old = read_sr(nor);
|
status_old = read_sr(nor);
|
||||||
|
|
||||||
/* Cannot unlock; would unlock larger region than requested */
|
/* Cannot unlock; would unlock larger region than requested */
|
||||||
if (stm_is_locked_sr(nor, status_old, ofs - mtd->erasesize,
|
if (stm_is_locked_sr(nor, ofs - mtd->erasesize, mtd->erasesize,
|
||||||
mtd->erasesize))
|
status_old))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1200,8 +1200,7 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode)
|
||||||
|
|
||||||
if (JEDEC_MFR(info) == SNOR_MFR_ATMEL ||
|
if (JEDEC_MFR(info) == SNOR_MFR_ATMEL ||
|
||||||
JEDEC_MFR(info) == SNOR_MFR_INTEL ||
|
JEDEC_MFR(info) == SNOR_MFR_INTEL ||
|
||||||
JEDEC_MFR(info) == SNOR_MFR_SST ||
|
JEDEC_MFR(info) == SNOR_MFR_SST) {
|
||||||
JEDEC_MFR(info) == SNOR_MFR_WINBOND) {
|
|
||||||
write_enable(nor);
|
write_enable(nor);
|
||||||
write_sr(nor, 0);
|
write_sr(nor, 0);
|
||||||
}
|
}
|
||||||
|
@ -1217,8 +1216,7 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode)
|
||||||
mtd->_read = spi_nor_read;
|
mtd->_read = spi_nor_read;
|
||||||
|
|
||||||
/* NOR protection support for STmicro/Micron chips and similar */
|
/* NOR protection support for STmicro/Micron chips and similar */
|
||||||
if (JEDEC_MFR(info) == SNOR_MFR_MICRON ||
|
if (JEDEC_MFR(info) == SNOR_MFR_MICRON) {
|
||||||
JEDEC_MFR(info) == SNOR_MFR_WINBOND) {
|
|
||||||
nor->flash_lock = stm_lock;
|
nor->flash_lock = stm_lock;
|
||||||
nor->flash_unlock = stm_unlock;
|
nor->flash_unlock = stm_unlock;
|
||||||
nor->flash_is_locked = stm_is_locked;
|
nor->flash_is_locked = stm_is_locked;
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
#define SNOR_MFR_MACRONIX CFI_MFR_MACRONIX
|
#define SNOR_MFR_MACRONIX CFI_MFR_MACRONIX
|
||||||
#define SNOR_MFR_SPANSION CFI_MFR_AMD
|
#define SNOR_MFR_SPANSION CFI_MFR_AMD
|
||||||
#define SNOR_MFR_SST CFI_MFR_SST
|
#define SNOR_MFR_SST CFI_MFR_SST
|
||||||
#define SNOR_MFR_WINBOND 0xef
|
#define SNOR_MFR_WINBOND 0xef /* Also used by some Spansion */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Note on opcode nomenclature: some opcodes have a format like
|
* Note on opcode nomenclature: some opcodes have a format like
|
||||||
|
|
Loading…
Reference in a new issue