Skip to content

Commit 206825f

Browse files
committed
Merge tag 'mtd/for-5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux
Pull mtd updates from Miquel Raynal: "Core: - Remove obsolete macros only used by the old nand_ecclayout struct - Don't remove debugfs directory if device is in use - MAINTAINERS: - Add entry for Qualcomm NAND controller driver - Update the devicetree documentation path of hyperbus MTD devices: - block2mtd: - Add support for an optional custom MTD label - Minor refactor to avoid hard coded constant - mtdswap: Remove redundant assignment of pointer eb CFI: - Fixup CFI on ixp4xx Raw NAND controller drivers: - Arasan: - Prevent an unsupported configuration - Xway, Socrates: plat_nand, Pasemi, Orion, mpc5121, GPIO, Au1550nd, AMS-Delta: - Keep the driver compatible with on-die ECC engines - cs553x, lpc32xx_slc, ndfc, sharpsl, tmio, txx9ndfmc: - Revert the commits: "Fix external use of SW Hamming ECC helper" - And let callers use the bare Hamming helpers - Fsmc: Fix use of SM ORDER - Intel: - Fix potential buffer overflow in probe - xway, vf610, txx9ndfm, tegra, stm32, plat_nand, oxnas, omap, mtk, hisi504, gpmi, gpio, denali, bcm6368, atmel: - Make use of the helper function devm_platform_ioremap_resource{,byname}() Onenand drivers: - Samsung: Drop Exynos4 and describe driver in KConfig Raw NAND chip drivers: - Hynix: Add support for H27UCG8T2ETR-BC MLC NAND SPI NOR core: - Add spi-nor device tree binding under SPI NOR maintainers SPI NOR manufacturer drivers: - Enable locking for n25q128a13 SPI NOR controller drivers: - Use devm_platform_ioremap_resource_byname()" * tag 'mtd/for-5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux: (50 commits) mtd: core: don't remove debugfs directory if device is in use MAINTAINERS: Update the devicetree documentation path of hyperbus mtd: block2mtd: add support for an optional custom MTD label mtd: block2mtd: minor refactor to avoid hard coded constant mtd: fixup CFI on ixp4xx mtd: rawnand: arasan: Prevent an unsupported configuration MAINTAINERS: Add entry for Qualcomm NAND controller driver mtd: rawnand: hynix: Add support for H27UCG8T2ETR-BC MLC NAND mtd: rawnand: xway: Keep the driver compatible with on-die ECC engines mtd: rawnand: socrates: Keep the driver compatible with on-die ECC engines mtd: rawnand: plat_nand: Keep the driver compatible with on-die ECC engines mtd: rawnand: pasemi: Keep the driver compatible with on-die ECC engines mtd: rawnand: orion: Keep the driver compatible with on-die ECC engines mtd: rawnand: mpc5121: Keep the driver compatible with on-die ECC engines mtd: rawnand: gpio: Keep the driver compatible with on-die ECC engines mtd: rawnand: au1550nd: Keep the driver compatible with on-die ECC engines mtd: rawnand: ams-delta: Keep the driver compatible with on-die ECC engines Revert "mtd: rawnand: cs553x: Fix external use of SW Hamming ECC helper" Revert "mtd: rawnand: lpc32xx_slc: Fix external use of SW Hamming ECC helper" Revert "mtd: rawnand: ndfc: Fix external use of SW Hamming ECC helper" ...
2 parents 05b8cd3 + e269d7c commit 206825f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+204
-175
lines changed

MAINTAINERS

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8824,8 +8824,7 @@ S: Supported
88248824
Q: http://patchwork.ozlabs.org/project/linux-mtd/list/
88258825
C: irc://irc.oftc.net/mtd
88268826
T: git git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git cfi/next
8827-
F: Documentation/devicetree/bindings/mtd/cypress,hyperflash.txt
8828-
F: Documentation/devicetree/bindings/mtd/ti,am654-hbmc.txt
8827+
F: Documentation/devicetree/bindings/mtd/ti,am654-hbmc.yaml
88298828
F: drivers/mtd/hyperbus/
88308829
F: include/linux/mtd/hyperbus.h
88318830

@@ -15804,6 +15803,14 @@ S: Maintained
1580415803
F: Documentation/devicetree/bindings/regulator/vqmmc-ipq4019-regulator.yaml
1580515804
F: drivers/regulator/vqmmc-ipq4019-regulator.c
1580615805

15806+
QUALCOMM NAND CONTROLLER DRIVER
15807+
M: Manivannan Sadhasivam <[email protected]>
15808+
15809+
15810+
S: Maintained
15811+
F: Documentation/devicetree/bindings/mtd/qcom,nandc.yaml
15812+
F: drivers/mtd/nand/raw/qcom_nandc.c
15813+
1580715814
QUALCOMM RMNET DRIVER
1580815815
M: Subash Abhinov Kasiviswanathan <[email protected]>
1580915816
M: Sean Tranchetti <[email protected]>
@@ -17903,6 +17910,7 @@ W: http://www.linux-mtd.infradead.org/
1790317910
Q: http://patchwork.ozlabs.org/project/linux-mtd/list/
1790417911
C: irc://irc.oftc.net/mtd
1790517912
T: git git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git spi-nor/next
17913+
F: Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml
1790617914
F: drivers/mtd/spi-nor/
1790717915
F: include/linux/mtd/spi-nor.h
1790817916

drivers/mtd/chips/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,14 @@ choice
5555
LITTLE_ENDIAN_BYTE, if the bytes are reversed.
5656

5757
config MTD_CFI_NOSWAP
58+
depends on !ARCH_IXP4XX || CPU_BIG_ENDIAN
5859
bool "NO"
5960

6061
config MTD_CFI_BE_BYTE_SWAP
6162
bool "BIG_ENDIAN_BYTE"
6263

6364
config MTD_CFI_LE_BYTE_SWAP
65+
depends on !ARCH_IXP4XX
6466
bool "LITTLE_ENDIAN_BYTE"
6567

6668
endchoice

drivers/mtd/devices/block2mtd.c

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
#include <linux/slab.h>
3232
#include <linux/major.h>
3333

34+
/* Maximum number of comma-separated items in the 'block2mtd=' parameter */
35+
#define BLOCK2MTD_PARAM_MAX_COUNT 3
36+
3437
/* Info for the block device */
3538
struct block2mtd_dev {
3639
struct list_head list;
@@ -214,7 +217,7 @@ static void block2mtd_free_device(struct block2mtd_dev *dev)
214217

215218

216219
static struct block2mtd_dev *add_device(char *devname, int erase_size,
217-
int timeout)
220+
char *label, int timeout)
218221
{
219222
#ifndef MODULE
220223
int i;
@@ -278,7 +281,10 @@ static struct block2mtd_dev *add_device(char *devname, int erase_size,
278281

279282
/* Setup the MTD structure */
280283
/* make the name contain the block device in */
281-
name = kasprintf(GFP_KERNEL, "block2mtd: %s", devname);
284+
if (!label)
285+
name = kasprintf(GFP_KERNEL, "block2mtd: %s", devname);
286+
else
287+
name = kstrdup(label, GFP_KERNEL);
282288
if (!name)
283289
goto err_destroy_mutex;
284290

@@ -305,7 +311,7 @@ static struct block2mtd_dev *add_device(char *devname, int erase_size,
305311
list_add(&dev->list, &blkmtd_device_list);
306312
pr_info("mtd%d: [%s] erase_size = %dKiB [%d]\n",
307313
dev->mtd.index,
308-
dev->mtd.name + strlen("block2mtd: "),
314+
label ? label : dev->mtd.name + strlen("block2mtd: "),
309315
dev->mtd.erasesize >> 10, dev->mtd.erasesize);
310316
return dev;
311317

@@ -381,8 +387,9 @@ static int block2mtd_setup2(const char *val)
381387
/* 80 for device, 12 for erase size, 80 for name, 8 for timeout */
382388
char buf[80 + 12 + 80 + 8];
383389
char *str = buf;
384-
char *token[2];
390+
char *token[BLOCK2MTD_PARAM_MAX_COUNT];
385391
char *name;
392+
char *label = NULL;
386393
size_t erase_size = PAGE_SIZE;
387394
unsigned long timeout = MTD_DEFAULT_TIMEOUT;
388395
int i, ret;
@@ -395,7 +402,7 @@ static int block2mtd_setup2(const char *val)
395402
strcpy(str, val);
396403
kill_final_newline(str);
397404

398-
for (i = 0; i < 2; i++)
405+
for (i = 0; i < BLOCK2MTD_PARAM_MAX_COUNT; i++)
399406
token[i] = strsep(&str, ",");
400407

401408
if (str) {
@@ -414,15 +421,21 @@ static int block2mtd_setup2(const char *val)
414421
return 0;
415422
}
416423

417-
if (token[1]) {
424+
/* Optional argument when custom label is used */
425+
if (token[1] && strlen(token[1])) {
418426
ret = parse_num(&erase_size, token[1]);
419427
if (ret) {
420428
pr_err("illegal erase size\n");
421429
return 0;
422430
}
423431
}
424432

425-
add_device(name, erase_size, timeout);
433+
if (token[2]) {
434+
label = token[2];
435+
pr_info("Using custom MTD label '%s' for dev %s\n", label, name);
436+
}
437+
438+
add_device(name, erase_size, label, timeout);
426439

427440
return 0;
428441
}
@@ -456,7 +469,7 @@ static int block2mtd_setup(const char *val, const struct kernel_param *kp)
456469

457470

458471
module_param_call(block2mtd, block2mtd_setup, NULL, NULL, 0200);
459-
MODULE_PARM_DESC(block2mtd, "Device to use. \"block2mtd=<dev>[,<erasesize>]\"");
472+
MODULE_PARM_DESC(block2mtd, "Device to use. \"block2mtd=<dev>[,[<erasesize>][,<label>]]\"");
460473

461474
static int __init block2mtd_init(void)
462475
{

drivers/mtd/maps/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ config MTD_DC21285
302302

303303
config MTD_IXP4XX
304304
tristate "CFI Flash device mapped on Intel IXP4xx based systems"
305-
depends on MTD_CFI && MTD_COMPLEX_MAPPINGS && ARCH_IXP4XX
305+
depends on MTD_CFI && MTD_COMPLEX_MAPPINGS && ARCH_IXP4XX && MTD_CFI_ADV_OPTIONS
306306
help
307307
This enables MTD access to flash devices on platforms based
308308
on Intel's IXP4xx family of network processors such as the

drivers/mtd/mtdcore.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -724,8 +724,6 @@ int del_mtd_device(struct mtd_info *mtd)
724724

725725
mutex_lock(&mtd_table_mutex);
726726

727-
debugfs_remove_recursive(mtd->dbg.dfs_dir);
728-
729727
if (idr_find(&mtd_idr, mtd->index) != mtd) {
730728
ret = -ENODEV;
731729
goto out_error;
@@ -741,6 +739,8 @@ int del_mtd_device(struct mtd_info *mtd)
741739
mtd->index, mtd->name, mtd->usecount);
742740
ret = -EBUSY;
743741
} else {
742+
debugfs_remove_recursive(mtd->dbg.dfs_dir);
743+
744744
/* Try to remove the NVMEM provider */
745745
if (mtd->nvmem)
746746
nvmem_unregister(mtd->nvmem);

drivers/mtd/mtdswap.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,6 @@ static int mtdswap_move_block(struct mtdswap_dev *d, unsigned int oldblock,
716716
return ret;
717717
}
718718

719-
eb = d->eb_data + *newblock / d->pages_per_eblk;
720719
d->page_data[page] = *newblock;
721720
d->revmap[oldblock] = PAGE_UNDEF;
722721
eb = d->eb_data + oldblock / d->pages_per_eblk;

drivers/mtd/nand/ecc-sw-hamming.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -364,9 +364,9 @@ int nand_ecc_sw_hamming_calculate(struct nand_device *nand,
364364
{
365365
struct nand_ecc_sw_hamming_conf *engine_conf = nand->ecc.ctx.priv;
366366
unsigned int step_size = nand->ecc.ctx.conf.step_size;
367+
bool sm_order = engine_conf ? engine_conf->sm_order : false;
367368

368-
return ecc_sw_hamming_calculate(buf, step_size, code,
369-
engine_conf->sm_order);
369+
return ecc_sw_hamming_calculate(buf, step_size, code, sm_order);
370370
}
371371
EXPORT_SYMBOL(nand_ecc_sw_hamming_calculate);
372372

@@ -457,9 +457,10 @@ int nand_ecc_sw_hamming_correct(struct nand_device *nand, unsigned char *buf,
457457
{
458458
struct nand_ecc_sw_hamming_conf *engine_conf = nand->ecc.ctx.priv;
459459
unsigned int step_size = nand->ecc.ctx.conf.step_size;
460+
bool sm_order = engine_conf ? engine_conf->sm_order : false;
460461

461462
return ecc_sw_hamming_correct(buf, read_ecc, calc_ecc, step_size,
462-
engine_conf->sm_order);
463+
sm_order);
463464
}
464465
EXPORT_SYMBOL(nand_ecc_sw_hamming_correct);
465466

drivers/mtd/nand/onenand/Kconfig

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,12 @@ config MTD_ONENAND_OMAP2
3333

3434
config MTD_ONENAND_SAMSUNG
3535
tristate "OneNAND on Samsung SOC controller support"
36-
depends on ARCH_S3C64XX || ARCH_S5PV210 || ARCH_EXYNOS4 || COMPILE_TEST
36+
depends on ARCH_S3C64XX || ARCH_S5PV210 || COMPILE_TEST
3737
help
38-
Support for a OneNAND flash device connected to an Samsung SOC.
39-
S3C64XX uses command mapping method.
40-
S5PC110/S5PC210 use generic OneNAND method.
38+
Support for a OneNAND flash device connected to Samsung S3C64XX
39+
(using command mapping method) and S5PC110/S5PC210 (using generic
40+
OneNAND method) SoCs.
41+
Choose Y here only if you build for such Samsung SoC.
4142

4243
config MTD_ONENAND_OTP
4344
bool "OneNAND OTP Support"

drivers/mtd/nand/raw/ams-delta.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,8 @@ static int gpio_nand_setup_interface(struct nand_chip *this, int csline,
217217

218218
static int gpio_nand_attach_chip(struct nand_chip *chip)
219219
{
220-
chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_SOFT;
221-
222-
if (chip->ecc.algo == NAND_ECC_ALGO_UNKNOWN)
220+
if (chip->ecc.engine_type == NAND_ECC_ENGINE_TYPE_SOFT &&
221+
chip->ecc.algo == NAND_ECC_ALGO_UNKNOWN)
223222
chip->ecc.algo = NAND_ECC_ALGO_HAMMING;
224223

225224
return 0;
@@ -370,6 +369,13 @@ static int gpio_nand_probe(struct platform_device *pdev)
370369
/* Release write protection */
371370
gpiod_set_value(priv->gpiod_nwp, 0);
372371

372+
/*
373+
* This driver assumes that the default ECC engine should be TYPE_SOFT.
374+
* Set ->engine_type before registering the NAND devices in order to
375+
* provide a driver specific default value.
376+
*/
377+
this->ecc.engine_type = NAND_ECC_ENGINE_TYPE_SOFT;
378+
373379
/* Scan to find existence of the device */
374380
err = nand_scan(this, 1);
375381
if (err)

drivers/mtd/nand/raw/arasan-nand-controller.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -973,6 +973,21 @@ static int anfc_setup_interface(struct nand_chip *chip, int target,
973973
nvddr = nand_get_nvddr_timings(conf);
974974
if (IS_ERR(nvddr))
975975
return PTR_ERR(nvddr);
976+
977+
/*
978+
* The controller only supports data payload requests which are
979+
* a multiple of 4. In practice, most data accesses are 4-byte
980+
* aligned and this is not an issue. However, rounding up will
981+
* simply be refused by the controller if we reached the end of
982+
* the device *and* we are using the NV-DDR interface(!). In
983+
* this situation, unaligned data requests ending at the device
984+
* boundary will confuse the controller and cannot be performed.
985+
*
986+
* This is something that happens in nand_read_subpage() when
987+
* selecting software ECC support and must be avoided.
988+
*/
989+
if (chip->ecc.engine_type == NAND_ECC_ENGINE_TYPE_SOFT)
990+
return -ENOTSUPP;
976991
} else {
977992
sdr = nand_get_sdr_timings(conf);
978993
if (IS_ERR(sdr))

0 commit comments

Comments
 (0)