Merge tag 'nand/for-5.16' into mtd/next
authorMiquel Raynal <miquel.raynal@bootlin.com>
Sun, 7 Nov 2021 16:38:05 +0000 (17:38 +0100)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Sun, 7 Nov 2021 16:38:05 +0000 (17:38 +0100)
Core:
* Remove obsolete macros only used by the old nand_ecclayout struct
* MAINTAINERS: Add entry for Qualcomm NAND controller driver

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 driver:
* Samsung: Drop Exynos4 and describe driver in KConfig

Raw NAND chip drivers:
* Hynix: Add support for H27UCG8T2ETR-BC MLC NAND

MAINTAINERS
drivers/mtd/chips/Kconfig
drivers/mtd/devices/block2mtd.c
drivers/mtd/maps/Kconfig
drivers/mtd/mtdcore.c
drivers/mtd/mtdswap.c

index f4c590b..0c9fa0b 100644 (file)
@@ -8707,8 +8707,7 @@ S:        Supported
 Q:     http://patchwork.ozlabs.org/project/linux-mtd/list/
 C:     irc://irc.oftc.net/mtd
 T:     git git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git cfi/next
-F:     Documentation/devicetree/bindings/mtd/cypress,hyperflash.txt
-F:     Documentation/devicetree/bindings/mtd/ti,am654-hbmc.txt
+F:     Documentation/devicetree/bindings/mtd/ti,am654-hbmc.yaml
 F:     drivers/mtd/hyperbus/
 F:     include/linux/mtd/hyperbus.h
 
index aef1499..19726eb 100644 (file)
@@ -55,12 +55,14 @@ choice
          LITTLE_ENDIAN_BYTE, if the bytes are reversed.
 
 config MTD_CFI_NOSWAP
+       depends on !ARCH_IXP4XX || CPU_BIG_ENDIAN
        bool "NO"
 
 config MTD_CFI_BE_BYTE_SWAP
        bool "BIG_ENDIAN_BYTE"
 
 config MTD_CFI_LE_BYTE_SWAP
+       depends on !ARCH_IXP4XX
        bool "LITTLE_ENDIAN_BYTE"
 
 endchoice
index c08721b..40d7211 100644 (file)
@@ -31,6 +31,9 @@
 #include <linux/slab.h>
 #include <linux/major.h>
 
+/* Maximum number of comma-separated items in the 'block2mtd=' parameter */
+#define BLOCK2MTD_PARAM_MAX_COUNT 3
+
 /* Info for the block device */
 struct block2mtd_dev {
        struct list_head list;
@@ -214,7 +217,7 @@ static void block2mtd_free_device(struct block2mtd_dev *dev)
 
 
 static struct block2mtd_dev *add_device(char *devname, int erase_size,
-               int timeout)
+               char *label, int timeout)
 {
 #ifndef MODULE
        int i;
@@ -278,7 +281,10 @@ static struct block2mtd_dev *add_device(char *devname, int erase_size,
 
        /* Setup the MTD structure */
        /* make the name contain the block device in */
-       name = kasprintf(GFP_KERNEL, "block2mtd: %s", devname);
+       if (!label)
+               name = kasprintf(GFP_KERNEL, "block2mtd: %s", devname);
+       else
+               name = kstrdup(label, GFP_KERNEL);
        if (!name)
                goto err_destroy_mutex;
 
@@ -305,7 +311,7 @@ static struct block2mtd_dev *add_device(char *devname, int erase_size,
        list_add(&dev->list, &blkmtd_device_list);
        pr_info("mtd%d: [%s] erase_size = %dKiB [%d]\n",
                dev->mtd.index,
-               dev->mtd.name + strlen("block2mtd: "),
+               label ? label : dev->mtd.name + strlen("block2mtd: "),
                dev->mtd.erasesize >> 10, dev->mtd.erasesize);
        return dev;
 
@@ -381,8 +387,9 @@ static int block2mtd_setup2(const char *val)
        /* 80 for device, 12 for erase size, 80 for name, 8 for timeout */
        char buf[80 + 12 + 80 + 8];
        char *str = buf;
-       char *token[2];
+       char *token[BLOCK2MTD_PARAM_MAX_COUNT];
        char *name;
+       char *label = NULL;
        size_t erase_size = PAGE_SIZE;
        unsigned long timeout = MTD_DEFAULT_TIMEOUT;
        int i, ret;
@@ -395,7 +402,7 @@ static int block2mtd_setup2(const char *val)
        strcpy(str, val);
        kill_final_newline(str);
 
-       for (i = 0; i < 2; i++)
+       for (i = 0; i < BLOCK2MTD_PARAM_MAX_COUNT; i++)
                token[i] = strsep(&str, ",");
 
        if (str) {
@@ -414,7 +421,8 @@ static int block2mtd_setup2(const char *val)
                return 0;
        }
 
-       if (token[1]) {
+       /* Optional argument when custom label is used */
+       if (token[1] && strlen(token[1])) {
                ret = parse_num(&erase_size, token[1]);
                if (ret) {
                        pr_err("illegal erase size\n");
@@ -422,7 +430,12 @@ static int block2mtd_setup2(const char *val)
                }
        }
 
-       add_device(name, erase_size, timeout);
+       if (token[2]) {
+               label = token[2];
+               pr_info("Using custom MTD label '%s' for dev %s\n", label, name);
+       }
+
+       add_device(name, erase_size, label, timeout);
 
        return 0;
 }
@@ -456,7 +469,7 @@ static int block2mtd_setup(const char *val, const struct kernel_param *kp)
 
 
 module_param_call(block2mtd, block2mtd_setup, NULL, NULL, 0200);
-MODULE_PARM_DESC(block2mtd, "Device to use. \"block2mtd=<dev>[,<erasesize>]\"");
+MODULE_PARM_DESC(block2mtd, "Device to use. \"block2mtd=<dev>[,[<erasesize>][,<label>]]\"");
 
 static int __init block2mtd_init(void)
 {
index aaa164b..4945caa 100644 (file)
@@ -302,7 +302,7 @@ config MTD_DC21285
 
 config MTD_IXP4XX
        tristate "CFI Flash device mapped on Intel IXP4xx based systems"
-       depends on MTD_CFI && MTD_COMPLEX_MAPPINGS && ARCH_IXP4XX
+       depends on MTD_CFI && MTD_COMPLEX_MAPPINGS && ARCH_IXP4XX && MTD_CFI_ADV_OPTIONS
        help
          This enables MTD access to flash devices on platforms based
          on Intel's IXP4xx family of network processors such as the
index c8fd7f7..1532291 100644 (file)
@@ -724,8 +724,6 @@ int del_mtd_device(struct mtd_info *mtd)
 
        mutex_lock(&mtd_table_mutex);
 
-       debugfs_remove_recursive(mtd->dbg.dfs_dir);
-
        if (idr_find(&mtd_idr, mtd->index) != mtd) {
                ret = -ENODEV;
                goto out_error;
@@ -741,6 +739,8 @@ int del_mtd_device(struct mtd_info *mtd)
                       mtd->index, mtd->name, mtd->usecount);
                ret = -EBUSY;
        } else {
+               debugfs_remove_recursive(mtd->dbg.dfs_dir);
+
                /* Try to remove the NVMEM provider */
                if (mtd->nvmem)
                        nvmem_unregister(mtd->nvmem);
index 7e30927..e86b04b 100644 (file)
@@ -716,7 +716,6 @@ retry:
                return ret;
        }
 
-       eb = d->eb_data + *newblock / d->pages_per_eblk;
        d->page_data[page] = *newblock;
        d->revmap[oldblock] = PAGE_UNDEF;
        eb = d->eb_data + oldblock / d->pages_per_eblk;