diff options
Diffstat (limited to 'drivers/mtd')
83 files changed, 257 insertions, 86 deletions
| diff --git a/drivers/mtd/altera_qspi.c b/drivers/mtd/altera_qspi.c index d31391f36a4..c26615821c8 100644 --- a/drivers/mtd/altera_qspi.c +++ b/drivers/mtd/altera_qspi.c @@ -3,7 +3,6 @@   * Copyright (C) 2015 Thomas Chou <thomas@wytron.com.tw>   */ -#include <common.h>  #include <console.h>  #include <dm.h>  #include <errno.h> diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 8ade7949a68..a7826e81c17 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -16,7 +16,7 @@  /* The DEBUG define must be before common to enable debugging */  /* #define DEBUG	*/ -#include <common.h> +#include <config.h>  #include <console.h>  #include <dm.h>  #include <env.h> @@ -26,6 +26,7 @@  #include <init.h>  #include <irq_func.h>  #include <log.h> +#include <time.h>  #include <asm/global_data.h>  #include <asm/processor.h>  #include <asm/io.h> diff --git a/drivers/mtd/cfi_mtd.c b/drivers/mtd/cfi_mtd.c index bf4473ba9e8..b14d4773931 100644 --- a/drivers/mtd/cfi_mtd.c +++ b/drivers/mtd/cfi_mtd.c @@ -5,7 +5,6 @@   * Written by: Piotr Ziecik <kosmo@semihalf.com>   */ -#include <common.h>  #include <dma.h>  #include <flash.h>  #include <malloc.h> diff --git a/drivers/mtd/hbmc-am654.c b/drivers/mtd/hbmc-am654.c index 8161087b50c..599beda30d5 100644 --- a/drivers/mtd/hbmc-am654.c +++ b/drivers/mtd/hbmc-am654.c @@ -3,7 +3,6 @@  // Copyright (C) 2019 Texas Instruments Incorporated - https://www.ti.com/  // Author: Vignesh Raghavendra <vigneshr@ti.com> -#include <common.h>  #include <asm/io.h>  #include <dm.h>  #include <regmap.h> diff --git a/drivers/mtd/jedec_flash.c b/drivers/mtd/jedec_flash.c index 859c7fd4ec2..a832f348f22 100644 --- a/drivers/mtd/jedec_flash.c +++ b/drivers/mtd/jedec_flash.c @@ -11,7 +11,6 @@  /* The DEBUG define must be before common to enable debugging */  /*#define DEBUG*/ -#include <common.h>  #include <flash.h>  #include <log.h>  #include <asm/processor.h> diff --git a/drivers/mtd/mtd-uclass.c b/drivers/mtd/mtd-uclass.c index 0743fe7af9f..720bd824c4d 100644 --- a/drivers/mtd/mtd-uclass.c +++ b/drivers/mtd/mtd-uclass.c @@ -5,7 +5,6 @@  #define LOG_CATEGORY UCLASS_MTD -#include <common.h>  #include <dm.h>  #include <dm/device-internal.h>  #include <errno.h> diff --git a/drivers/mtd/mtd_uboot.c b/drivers/mtd/mtd_uboot.c index 14ce726b10d..69cb3b51f92 100644 --- a/drivers/mtd/mtd_uboot.c +++ b/drivers/mtd/mtd_uboot.c @@ -3,7 +3,6 @@   * (C) Copyright 2014   * Heiko Schocher, DENX Software Engineering, hs@denx.de.   */ -#include <common.h>  #include <env.h>  #include <log.h>  #include <malloc.h> diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c index 4886392a1cf..be1d19b4ffa 100644 --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c @@ -19,7 +19,6 @@  #include <linux/kmod.h>  #endif -#include <common.h>  #include <malloc.h>  #include <linux/bug.h>  #include <linux/errno.h> diff --git a/drivers/mtd/nand/bbt.c b/drivers/mtd/nand/bbt.c index 972aec6e266..4ff0999f62a 100644 --- a/drivers/mtd/nand/bbt.c +++ b/drivers/mtd/nand/bbt.c @@ -9,7 +9,6 @@  #define pr_fmt(fmt)	"nand-bbt: " fmt -#include <common.h>  #include <dm/devres.h>  #include <linux/bitops.h>  #include <linux/mtd/nand.h> diff --git a/drivers/mtd/nand/core.c b/drivers/mtd/nand/core.c index f6d9c584f78..472ad0bdefb 100644 --- a/drivers/mtd/nand/core.c +++ b/drivers/mtd/nand/core.c @@ -9,7 +9,6 @@  #define pr_fmt(fmt)	"nand: " fmt -#include <common.h>  #include <watchdog.h>  #ifndef __UBOOT__  #include <linux/compat.h> diff --git a/drivers/mtd/nand/raw/am335x_spl_bch.c b/drivers/mtd/nand/raw/am335x_spl_bch.c index 6831af98b73..64d8ce0965a 100644 --- a/drivers/mtd/nand/raw/am335x_spl_bch.c +++ b/drivers/mtd/nand/raw/am335x_spl_bch.c @@ -9,7 +9,7 @@   * Stefan Roese, DENX Software Engineering, sr@denx.de.   */ -#include <common.h> +#include <config.h>  #include <nand.h>  #include <system-constants.h>  #include <asm/io.h> diff --git a/drivers/mtd/nand/raw/arasan_nfc.c b/drivers/mtd/nand/raw/arasan_nfc.c index ffcd963b3da..4f013efafb3 100644 --- a/drivers/mtd/nand/raw/arasan_nfc.c +++ b/drivers/mtd/nand/raw/arasan_nfc.c @@ -5,7 +5,6 @@   * Copyright (C) 2014 - 2015 Xilinx, Inc.   */ -#include <common.h>  #include <malloc.h>  #include <asm/io.h>  #include <linux/delay.h> diff --git a/drivers/mtd/nand/raw/atmel_nand.c b/drivers/mtd/nand/raw/atmel_nand.c index 6d94e7af38e..4dbf7b47135 100644 --- a/drivers/mtd/nand/raw/atmel_nand.c +++ b/drivers/mtd/nand/raw/atmel_nand.c @@ -10,7 +10,7 @@   *     (C) Copyright 2012 ATMEL, Hong Xu   */ -#include <common.h> +#include <config.h>  #include <log.h>  #include <system-constants.h>  #include <asm/gpio.h> diff --git a/drivers/mtd/nand/raw/brcmnand/bcm63158_nand.c b/drivers/mtd/nand/raw/brcmnand/bcm63158_nand.c index 4e6d99fd3ca..3f59fbbbb8f 100644 --- a/drivers/mtd/nand/raw/brcmnand/bcm63158_nand.c +++ b/drivers/mtd/nand/raw/brcmnand/bcm63158_nand.c @@ -1,6 +1,5 @@  // SPDX-License-Identifier: GPL-2.0+ -#include <common.h>  #include <asm/io.h>  #include <memalign.h>  #include <nand.h> diff --git a/drivers/mtd/nand/raw/brcmnand/bcm6368_nand.c b/drivers/mtd/nand/raw/brcmnand/bcm6368_nand.c index 6164989b937..d54de0b3ecc 100644 --- a/drivers/mtd/nand/raw/brcmnand/bcm6368_nand.c +++ b/drivers/mtd/nand/raw/brcmnand/bcm6368_nand.c @@ -1,6 +1,5 @@  // SPDX-License-Identifier: GPL-2.0+ -#include <common.h>  #include <asm/io.h>  #include <memalign.h>  #include <nand.h> diff --git a/drivers/mtd/nand/raw/brcmnand/bcm6753_nand.c b/drivers/mtd/nand/raw/brcmnand/bcm6753_nand.c index feae66ef25a..a101222a28f 100644 --- a/drivers/mtd/nand/raw/brcmnand/bcm6753_nand.c +++ b/drivers/mtd/nand/raw/brcmnand/bcm6753_nand.c @@ -1,6 +1,5 @@  // SPDX-License-Identifier: GPL-2.0+ -#include <common.h>  #include <asm/io.h>  #include <memalign.h>  #include <nand.h> diff --git a/drivers/mtd/nand/raw/brcmnand/bcm68360_nand.c b/drivers/mtd/nand/raw/brcmnand/bcm68360_nand.c index dbd85af7079..385642d0c09 100644 --- a/drivers/mtd/nand/raw/brcmnand/bcm68360_nand.c +++ b/drivers/mtd/nand/raw/brcmnand/bcm68360_nand.c @@ -1,6 +1,5 @@  // SPDX-License-Identifier: GPL-2.0+ -#include <common.h>  #include <asm/io.h>  #include <memalign.h>  #include <nand.h> diff --git a/drivers/mtd/nand/raw/brcmnand/bcm6838_nand.c b/drivers/mtd/nand/raw/brcmnand/bcm6838_nand.c index ef3649688c6..407898ddae6 100644 --- a/drivers/mtd/nand/raw/brcmnand/bcm6838_nand.c +++ b/drivers/mtd/nand/raw/brcmnand/bcm6838_nand.c @@ -1,6 +1,5 @@  // SPDX-License-Identifier: GPL-2.0+ -#include <common.h>  #include <asm/io.h>  #include <memalign.h>  #include <nand.h> diff --git a/drivers/mtd/nand/raw/brcmnand/bcm6858_nand.c b/drivers/mtd/nand/raw/brcmnand/bcm6858_nand.c index 027fdd37da3..564c678c9ef 100644 --- a/drivers/mtd/nand/raw/brcmnand/bcm6858_nand.c +++ b/drivers/mtd/nand/raw/brcmnand/bcm6858_nand.c @@ -1,6 +1,5 @@  // SPDX-License-Identifier: GPL-2.0+ -#include <common.h>  #include <asm/io.h>  #include <memalign.h>  #include <nand.h> diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c index efbf9a3120a..b7bf7cc0893 100644 --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c @@ -12,7 +12,6 @@   * GNU General Public License for more details.   */ -#include <common.h>  #include <asm/io.h>  #include <memalign.h>  #include <nand.h> diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand_compat.c b/drivers/mtd/nand/raw/brcmnand/brcmnand_compat.c index a6acf556bcc..b3b3df5c042 100644 --- a/drivers/mtd/nand/raw/brcmnand/brcmnand_compat.c +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand_compat.c @@ -1,6 +1,5 @@  // SPDX-License-Identifier: GPL-2.0+ -#include <common.h>  #include <dm.h>  #include <malloc.h>  #include <dm/devres.h> diff --git a/drivers/mtd/nand/raw/brcmnand/iproc_nand.c b/drivers/mtd/nand/raw/brcmnand/iproc_nand.c index 69711d98ce1..430d6c93853 100644 --- a/drivers/mtd/nand/raw/brcmnand/iproc_nand.c +++ b/drivers/mtd/nand/raw/brcmnand/iproc_nand.c @@ -4,7 +4,6 @@   * Copyright (C) 2015 Broadcom Corporation   */ -#include <common.h>  #include <asm/io.h>  #include <memalign.h>  #include <nand.h> diff --git a/drivers/mtd/nand/raw/cortina_nand.c b/drivers/mtd/nand/raw/cortina_nand.c index b7be6602f7c..06918a46e93 100644 --- a/drivers/mtd/nand/raw/cortina_nand.c +++ b/drivers/mtd/nand/raw/cortina_nand.c @@ -3,7 +3,6 @@   * Copyright (c) 2020, Cortina Access Inc..   */ -#include <common.h>  #include <linux/delay.h>  #include <linux/bitops.h>  #include <linux/sizes.h> diff --git a/drivers/mtd/nand/raw/davinci_nand.c b/drivers/mtd/nand/raw/davinci_nand.c index 71bbb8231bf..d4daf06b8de 100644 --- a/drivers/mtd/nand/raw/davinci_nand.c +++ b/drivers/mtd/nand/raw/davinci_nand.c @@ -28,7 +28,7 @@   -   */ -#include <common.h> +#include <config.h>  #include <log.h>  #include <linux/mtd/rawnand.h>  #include <asm/io.h> diff --git a/drivers/mtd/nand/raw/denali.c b/drivers/mtd/nand/raw/denali.c index c827f80281c..b2401116689 100644 --- a/drivers/mtd/nand/raw/denali.c +++ b/drivers/mtd/nand/raw/denali.c @@ -5,7 +5,6 @@   * Copyright (C) 2009-2010, Intel Corporation and its suppliers.   */ -#include <common.h>  #include <dm.h>  #include <malloc.h>  #include <nand.h> diff --git a/drivers/mtd/nand/raw/denali_spl.c b/drivers/mtd/nand/raw/denali_spl.c index 165a23312cb..b1e2c9d8161 100644 --- a/drivers/mtd/nand/raw/denali_spl.c +++ b/drivers/mtd/nand/raw/denali_spl.c @@ -4,7 +4,7 @@   * Copyright (C) 2014-2015  Masahiro Yamada <yamada.masahiro@socionext.com>   */ -#include <common.h> +#include <config.h>  #include <log.h>  #include <asm/io.h>  #include <asm/unaligned.h> diff --git a/drivers/mtd/nand/raw/fsl_elbc_nand.c b/drivers/mtd/nand/raw/fsl_elbc_nand.c index 7853c3f74e2..157330cb287 100644 --- a/drivers/mtd/nand/raw/fsl_elbc_nand.c +++ b/drivers/mtd/nand/raw/fsl_elbc_nand.c @@ -7,7 +7,7 @@   *          Scott Wood <scottwood@freescale.com>   */ -#include <common.h> +#include <config.h>  #include <command.h>  #include <malloc.h>  #include <nand.h> diff --git a/drivers/mtd/nand/raw/fsl_elbc_spl.c b/drivers/mtd/nand/raw/fsl_elbc_spl.c index 26aaab08e89..17b8ef7ff4b 100644 --- a/drivers/mtd/nand/raw/fsl_elbc_spl.c +++ b/drivers/mtd/nand/raw/fsl_elbc_spl.c @@ -9,7 +9,7 @@   * Author: Scott Wood <scottwood@freescale.com>   */ -#include <common.h> +#include <config.h>  #include <cpu_func.h>  #include <linux/mtd/rawnand.h>  #include <asm/io.h> diff --git a/drivers/mtd/nand/raw/fsl_ifc_nand.c b/drivers/mtd/nand/raw/fsl_ifc_nand.c index 1d7c1fddd3f..857d50ef9b0 100644 --- a/drivers/mtd/nand/raw/fsl_ifc_nand.c +++ b/drivers/mtd/nand/raw/fsl_ifc_nand.c @@ -6,7 +6,7 @@   * Authors: Dipen Dudhat <Dipen.Dudhat@freescale.com>   */ -#include <common.h> +#include <config.h>  #include <command.h>  #include <malloc.h>  #include <nand.h> diff --git a/drivers/mtd/nand/raw/fsl_ifc_spl.c b/drivers/mtd/nand/raw/fsl_ifc_spl.c index 69d26f1f79a..c2ebee94870 100644 --- a/drivers/mtd/nand/raw/fsl_ifc_spl.c +++ b/drivers/mtd/nand/raw/fsl_ifc_spl.c @@ -6,7 +6,7 @@   * Author: Dipen Dudhat <dipen.dudhat@freescale.com>   */ -#include <common.h> +#include <config.h>  #include <cpu_func.h>  #include <asm/io.h>  #include <fsl_ifc.h> diff --git a/drivers/mtd/nand/raw/kirkwood_nand.c b/drivers/mtd/nand/raw/kirkwood_nand.c index 621d2d232c8..cd182be268d 100644 --- a/drivers/mtd/nand/raw/kirkwood_nand.c +++ b/drivers/mtd/nand/raw/kirkwood_nand.c @@ -5,7 +5,6 @@   * Written-by: Prafulla Wadaskar <prafulla@marvell.com>   */ -#include <common.h>  #include <linux/mtd/rawnand.h>  #include <asm/io.h>  #include <asm/arch/soc.h> diff --git a/drivers/mtd/nand/raw/kmeter1_nand.c b/drivers/mtd/nand/raw/kmeter1_nand.c index dfe73d64e46..e9398eb4093 100644 --- a/drivers/mtd/nand/raw/kmeter1_nand.c +++ b/drivers/mtd/nand/raw/kmeter1_nand.c @@ -4,7 +4,7 @@   * Heiko Schocher, DENX Software Engineering, hs@denx.de   */ -#include <common.h> +#include <config.h>  #include <nand.h>  #include <asm/io.h>  #include <linux/delay.h> diff --git a/drivers/mtd/nand/raw/lpc32xx_nand_mlc.c b/drivers/mtd/nand/raw/lpc32xx_nand_mlc.c index f8ae216d56c..c89661badbf 100644 --- a/drivers/mtd/nand/raw/lpc32xx_nand_mlc.c +++ b/drivers/mtd/nand/raw/lpc32xx_nand_mlc.c @@ -19,7 +19,7 @@   * should not rely on the ECC validity.   */ -#include <common.h> +#include <config.h>  #include <nand.h>  #include <linux/delay.h>  #include <linux/errno.h> diff --git a/drivers/mtd/nand/raw/lpc32xx_nand_slc.c b/drivers/mtd/nand/raw/lpc32xx_nand_slc.c index b21a0b9d293..4d643bc64bc 100644 --- a/drivers/mtd/nand/raw/lpc32xx_nand_slc.c +++ b/drivers/mtd/nand/raw/lpc32xx_nand_slc.c @@ -10,7 +10,7 @@   * Author: Kevin Wells   */ -#include <common.h> +#include <config.h>  #include <log.h>  #include <nand.h>  #include <linux/bug.h> diff --git a/drivers/mtd/nand/raw/mxc_nand.c b/drivers/mtd/nand/raw/mxc_nand.c index dbdc5b0bca1..0750b38f708 100644 --- a/drivers/mtd/nand/raw/mxc_nand.c +++ b/drivers/mtd/nand/raw/mxc_nand.c @@ -5,7 +5,7 @@   * Copyright 2009 Ilya Yanok, <yanok@emcraft.com>   */ -#include <common.h> +#include <config.h>  #include <log.h>  #include <nand.h>  #include <linux/delay.h> diff --git a/drivers/mtd/nand/raw/mxc_nand_spl.c b/drivers/mtd/nand/raw/mxc_nand_spl.c index a855c9987f8..c5872848954 100644 --- a/drivers/mtd/nand/raw/mxc_nand_spl.c +++ b/drivers/mtd/nand/raw/mxc_nand_spl.c @@ -10,7 +10,7 @@   * Stefan Roese, DENX Software Engineering, sr at denx.de.   */ -#include <common.h> +#include <config.h>  #include <hang.h>  #include <nand.h>  #include <system-constants.h> diff --git a/drivers/mtd/nand/raw/mxic_nand.c b/drivers/mtd/nand/raw/mxic_nand.c index 6abdc24bd30..0e54b5f6938 100644 --- a/drivers/mtd/nand/raw/mxic_nand.c +++ b/drivers/mtd/nand/raw/mxic_nand.c @@ -6,7 +6,6 @@   *	Zhengxun Li <zhengxunli@mxic.com.tw>   */ -#include <common.h>  #include <clk.h>  #include <dm.h>  #include <malloc.h> diff --git a/drivers/mtd/nand/raw/mxs_nand.c b/drivers/mtd/nand/raw/mxs_nand.c index fd65772af80..11b0247b284 100644 --- a/drivers/mtd/nand/raw/mxs_nand.c +++ b/drivers/mtd/nand/raw/mxs_nand.c @@ -13,7 +13,6 @@   * Copyright 2017-2019 NXP   */ -#include <common.h>  #include <clk.h>  #include <cpu_func.h>  #include <dm.h> diff --git a/drivers/mtd/nand/raw/mxs_nand_spl.c b/drivers/mtd/nand/raw/mxs_nand_spl.c index f7d3f02f85a..c8e064347ad 100644 --- a/drivers/mtd/nand/raw/mxs_nand_spl.c +++ b/drivers/mtd/nand/raw/mxs_nand_spl.c @@ -4,7 +4,6 @@   * Copyright 2019 NXP   * Author: Tim Harvey <tharvey@gateworks.com>   */ -#include <common.h>  #include <log.h>  #include <nand.h>  #include <malloc.h> diff --git a/drivers/mtd/nand/raw/nand.c b/drivers/mtd/nand/raw/nand.c index b591170346d..36054492e18 100644 --- a/drivers/mtd/nand/raw/nand.c +++ b/drivers/mtd/nand/raw/nand.c @@ -5,7 +5,7 @@   * Ladislav Michl <michl@2n.cz>   */ -#include <common.h> +#include <config.h>  #include <nand.h>  #include <errno.h>  #include <linux/mtd/concat.h> diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c index 688d17ba3c2..18b95caffef 100644 --- a/drivers/mtd/nand/raw/nand_base.c +++ b/drivers/mtd/nand/raw/nand_base.c @@ -28,7 +28,6 @@   */  #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt -#include <common.h>  #include <log.h>  #include <malloc.h>  #include <watchdog.h> diff --git a/drivers/mtd/nand/raw/nand_bbt.c b/drivers/mtd/nand/raw/nand_bbt.c index cd451870a6f..1fb8535ab05 100644 --- a/drivers/mtd/nand/raw/nand_bbt.c +++ b/drivers/mtd/nand/raw/nand_bbt.c @@ -57,7 +57,6 @@   *   */ -#include <common.h>  #include <log.h>  #include <malloc.h>  #include <dm/devres.h> diff --git a/drivers/mtd/nand/raw/nand_bch.c b/drivers/mtd/nand/raw/nand_bch.c index bb48ebbb96c..f317cc26c90 100644 --- a/drivers/mtd/nand/raw/nand_bch.c +++ b/drivers/mtd/nand/raw/nand_bch.c @@ -7,7 +7,6 @@   *   */ -#include <common.h>  #include <log.h>  #include <dm/devres.h>  #include <linux/printk.h> diff --git a/drivers/mtd/nand/raw/nand_ecc.c b/drivers/mtd/nand/raw/nand_ecc.c index 2bc329be1a3..0530ccb0722 100644 --- a/drivers/mtd/nand/raw/nand_ecc.c +++ b/drivers/mtd/nand/raw/nand_ecc.c @@ -22,7 +22,6 @@   * this file might be covered by the GNU General Public License.   */ -#include <common.h>  #include <linux/errno.h>  #include <linux/mtd/mtd.h> diff --git a/drivers/mtd/nand/raw/nand_ids.c b/drivers/mtd/nand/raw/nand_ids.c index be60d6d9d99..4f46378ffe1 100644 --- a/drivers/mtd/nand/raw/nand_ids.c +++ b/drivers/mtd/nand/raw/nand_ids.c @@ -6,7 +6,6 @@   * published by the Free Software Foundation.   *   */ -#include <common.h>  #include <linux/mtd/rawnand.h>  #include <linux/sizes.h> diff --git a/drivers/mtd/nand/raw/nand_macronix.c b/drivers/mtd/nand/raw/nand_macronix.c index dc972e59092..4c6ddd92331 100644 --- a/drivers/mtd/nand/raw/nand_macronix.c +++ b/drivers/mtd/nand/raw/nand_macronix.c @@ -16,13 +16,183 @@   * GNU General Public License for more details.   */ +#include <dm/device_compat.h>  #include <linux/mtd/rawnand.h> +#define ONFI_FEATURE_ADDR_30LFXG18AC_OTP	0x90 +#define MACRONIX_30LFXG18AC_OTP_START_PAGE	2 +#define MACRONIX_30LFXG18AC_OTP_PAGES		30 +#define MACRONIX_30LFXG18AC_OTP_PAGE_SIZE	2112 +#define MACRONIX_30LFXG18AC_OTP_SIZE_BYTES	\ +	(MACRONIX_30LFXG18AC_OTP_PAGES *	\ +	 MACRONIX_30LFXG18AC_OTP_PAGE_SIZE) + +#define MACRONIX_30LFXG18AC_OTP_EN		BIT(0) + +static int macronix_30lfxg18ac_get_otp_info(struct mtd_info *mtd, size_t len, +					    size_t *retlen, +					    struct otp_info *buf) +{ +	if (len < sizeof(*buf)) +		return -EINVAL; + +	/* Always report that OTP is unlocked. Reason is that this +	 * type of flash chip doesn't provide way to check that OTP +	 * is locked or not: subfeature parameter is implemented as +	 * volatile register. Technically OTP region could be locked +	 * and become readonly, but as there is no way to check it, +	 * don't allow to lock it ('_lock_user_prot_reg' callback +	 * always returns -EOPNOTSUPP) and thus we report that OTP +	 * is unlocked. +	 */ +	buf->locked = 0; +	buf->start = 0; +	buf->length = MACRONIX_30LFXG18AC_OTP_SIZE_BYTES; + +	*retlen = sizeof(*buf); + +	return 0; +} + +static int macronix_30lfxg18ac_otp_enable(struct nand_chip *nand) +{ +	u8 feature_buf[ONFI_SUBFEATURE_PARAM_LEN] = { 0 }; +	struct mtd_info *mtd; + +	mtd = nand_to_mtd(nand); +	feature_buf[0] = MACRONIX_30LFXG18AC_OTP_EN; + +	return nand->onfi_set_features(mtd, nand, ONFI_FEATURE_ADDR_30LFXG18AC_OTP, feature_buf); +} + +static int macronix_30lfxg18ac_otp_disable(struct nand_chip *nand) +{ +	u8 feature_buf[ONFI_SUBFEATURE_PARAM_LEN] = { 0 }; +	struct mtd_info *mtd; + +	mtd = nand_to_mtd(nand); +	return nand->onfi_set_features(mtd, nand, ONFI_FEATURE_ADDR_30LFXG18AC_OTP, feature_buf); +} + +static int __macronix_30lfxg18ac_rw_otp(struct mtd_info *mtd, +					loff_t offs_in_flash, +					size_t len, size_t *retlen, +					u_char *buf, bool write) +{ +	struct nand_chip *nand; +	size_t bytes_handled; +	off_t offs_in_page; +	u64 page; +	int ret; + +	nand = mtd_to_nand(mtd); +	nand->select_chip(mtd, 0); + +	ret = macronix_30lfxg18ac_otp_enable(nand); +	if (ret) +		goto out_otp; + +	page = offs_in_flash; +	/* 'page' will be result of division. */ +	offs_in_page = do_div(page, MACRONIX_30LFXG18AC_OTP_PAGE_SIZE); +	bytes_handled = 0; + +	while (bytes_handled < len && +	       page < MACRONIX_30LFXG18AC_OTP_PAGES) { +		size_t bytes_to_handle; +		u64 phys_page = page + MACRONIX_30LFXG18AC_OTP_START_PAGE; + +		bytes_to_handle = min_t(size_t, len - bytes_handled, +					MACRONIX_30LFXG18AC_OTP_PAGE_SIZE - +					offs_in_page); + +		if (write) +			ret = nand_prog_page_op(nand, phys_page, offs_in_page, +						&buf[bytes_handled], bytes_to_handle); +		else +			ret = nand_read_page_op(nand, phys_page, offs_in_page, +						&buf[bytes_handled], bytes_to_handle); +		if (ret) +			goto out_otp; + +		bytes_handled += bytes_to_handle; +		offs_in_page = 0; +		page++; +	} + +	*retlen = bytes_handled; + +out_otp: +	if (ret) +		dev_err(mtd->dev, "failed to perform OTP IO: %i\n", ret); + +	ret = macronix_30lfxg18ac_otp_disable(nand); +	if (ret) +		dev_err(mtd->dev, "failed to leave OTP mode after %s\n", +			write ? "write" : "read"); + +	nand->select_chip(mtd, -1); + +	return ret; +} + +static int macronix_30lfxg18ac_write_otp(struct mtd_info *mtd, loff_t to, +					 size_t len, size_t *rlen, +					 u_char *buf) +{ +	return __macronix_30lfxg18ac_rw_otp(mtd, to, len, rlen, (u_char *)buf, +					    true); +} + +static int macronix_30lfxg18ac_read_otp(struct mtd_info *mtd, loff_t from, +					size_t len, size_t *rlen, +					u_char *buf) +{ +	return __macronix_30lfxg18ac_rw_otp(mtd, from, len, rlen, buf, false); +} + +static int macronix_30lfxg18ac_lock_otp(struct mtd_info *mtd, loff_t from, +					size_t len) +{ +	/* See comment in 'macronix_30lfxg18ac_get_otp_info()'. */ +	return -EOPNOTSUPP; +} + +static void macronix_nand_setup_otp(struct nand_chip *chip) +{ +	static const char * const supported_otp_models[] = { +		"MX30LF1G18AC", +		"MX30LF2G18AC", +		"MX30LF4G18AC", +	}; +	int i; + +	if (!chip->onfi_version || +	    !(le16_to_cpu(chip->onfi_params.opt_cmd) +	      & ONFI_OPT_CMD_SET_GET_FEATURES)) +		return; + +	for (i = 0; i < ARRAY_SIZE(supported_otp_models); i++) { +		if (!strcmp(chip->onfi_params.model, supported_otp_models[i])) { +			struct mtd_info *mtd; + +			mtd = nand_to_mtd(chip); +			mtd->_get_user_prot_info = macronix_30lfxg18ac_get_otp_info; +			mtd->_read_user_prot_reg = macronix_30lfxg18ac_read_otp; +			mtd->_write_user_prot_reg = macronix_30lfxg18ac_write_otp; +			mtd->_lock_user_prot_reg = macronix_30lfxg18ac_lock_otp; +			return; +		} +	} +} +  static int macronix_nand_init(struct nand_chip *chip)  {  	if (nand_is_slc(chip))  		chip->bbt_options |= NAND_BBT_SCAN2NDPAGE; +	macronix_nand_setup_otp(chip); +  	return 0;  } diff --git a/drivers/mtd/nand/raw/nand_spl_load.c b/drivers/mtd/nand/raw/nand_spl_load.c index 7ac9bf4d120..87af675c139 100644 --- a/drivers/mtd/nand/raw/nand_spl_load.c +++ b/drivers/mtd/nand/raw/nand_spl_load.c @@ -4,7 +4,7 @@   * Heiko Schocher, DENX Software Engineering, hs@denx.de.   */ -#include <common.h> +#include <config.h>  #include <nand.h>  /* diff --git a/drivers/mtd/nand/raw/nand_spl_simple.c b/drivers/mtd/nand/raw/nand_spl_simple.c index 80d6e0e1e4e..c0956ab0e49 100644 --- a/drivers/mtd/nand/raw/nand_spl_simple.c +++ b/drivers/mtd/nand/raw/nand_spl_simple.c @@ -4,7 +4,7 @@   * Stefan Roese, DENX Software Engineering, sr@denx.de.   */ -#include <common.h> +#include <config.h>  #include <nand.h>  #include <system-constants.h>  #include <asm/io.h> diff --git a/drivers/mtd/nand/raw/nand_timings.c b/drivers/mtd/nand/raw/nand_timings.c index e6aa7903913..c1bac1d01cc 100644 --- a/drivers/mtd/nand/raw/nand_timings.c +++ b/drivers/mtd/nand/raw/nand_timings.c @@ -8,7 +8,6 @@   * published by the Free Software Foundation.   *   */ -#include <common.h>  #include <linux/err.h>  #include <linux/kernel.h>  #include <linux/mtd/rawnand.h> diff --git a/drivers/mtd/nand/raw/nand_util.c b/drivers/mtd/nand/raw/nand_util.c index 72cc24f4037..fda4239fa79 100644 --- a/drivers/mtd/nand/raw/nand_util.c +++ b/drivers/mtd/nand/raw/nand_util.c @@ -18,7 +18,6 @@   * Copyright 2010 Freescale Semiconductor   */ -#include <common.h>  #include <command.h>  #include <log.h>  #include <watchdog.h> diff --git a/drivers/mtd/nand/raw/omap_elm.c b/drivers/mtd/nand/raw/omap_elm.c index 015ec9bc2de..61751b9ae2d 100644 --- a/drivers/mtd/nand/raw/omap_elm.c +++ b/drivers/mtd/nand/raw/omap_elm.c @@ -12,7 +12,6 @@   *    sets in uboot   */ -#include <common.h>  #include <asm/io.h>  #include <linux/errno.h>  #include <asm/arch/hardware.h> diff --git a/drivers/mtd/nand/raw/omap_gpmc.c b/drivers/mtd/nand/raw/omap_gpmc.c index 2f8fa7d73d2..92a92ad63a0 100644 --- a/drivers/mtd/nand/raw/omap_gpmc.c +++ b/drivers/mtd/nand/raw/omap_gpmc.c @@ -4,7 +4,7 @@   * Rohit Choraria <rohitkc@ti.com>   */ -#include <common.h> +#include <config.h>  #include <log.h>  #include <system-constants.h>  #include <asm/io.h> diff --git a/drivers/mtd/nand/raw/pxa3xx_nand.c b/drivers/mtd/nand/raw/pxa3xx_nand.c index 1d9a6d107b1..b78b4e60238 100644 --- a/drivers/mtd/nand/raw/pxa3xx_nand.c +++ b/drivers/mtd/nand/raw/pxa3xx_nand.c @@ -6,7 +6,6 @@   * Copyright © 2006 Marvell International Ltd.   */ -#include <common.h>  #include <malloc.h>  #include <fdtdec.h>  #include <nand.h> @@ -800,6 +799,11 @@ static void prepare_start_command(struct pxa3xx_nand_info *info, int command)  	info->ecc_err_cnt	= 0;  	info->ndcb3		= 0;  	info->need_wait		= 0; +	/* +	 * Reset max_bitflips to zero. Once command is complete, +	 * max_bitflips for this READ is returned in ecc.read_page() +	 */ +	info->max_bitflips	= 0;  	switch (command) {  	case NAND_CMD_READ0: diff --git a/drivers/mtd/nand/raw/rockchip_nfc.c b/drivers/mtd/nand/raw/rockchip_nfc.c index 088cc7fead2..f730e15d041 100644 --- a/drivers/mtd/nand/raw/rockchip_nfc.c +++ b/drivers/mtd/nand/raw/rockchip_nfc.c @@ -5,7 +5,6 @@   * Author: Yifeng Zhao <yifeng.zhao@rock-chips.com>   */ -#include <common.h>  #include <asm/io.h>  #include <clk.h>  #include <dm.h> diff --git a/drivers/mtd/nand/raw/stm32_fmc2_nand.c b/drivers/mtd/nand/raw/stm32_fmc2_nand.c index d284b8cbb12..083ea4c5a74 100644 --- a/drivers/mtd/nand/raw/stm32_fmc2_nand.c +++ b/drivers/mtd/nand/raw/stm32_fmc2_nand.c @@ -6,7 +6,6 @@  #define LOG_CATEGORY UCLASS_MTD -#include <common.h>  #include <clk.h>  #include <dm.h>  #include <log.h> diff --git a/drivers/mtd/nand/raw/sunxi_nand.c b/drivers/mtd/nand/raw/sunxi_nand.c index 0b5b74dc242..34197bb09a1 100644 --- a/drivers/mtd/nand/raw/sunxi_nand.c +++ b/drivers/mtd/nand/raw/sunxi_nand.c @@ -25,7 +25,6 @@   */  #include <clk.h> -#include <common.h>  #include <dm.h>  #include <malloc.h>  #include <memalign.h> diff --git a/drivers/mtd/nand/raw/sunxi_nand_spl.c b/drivers/mtd/nand/raw/sunxi_nand_spl.c index c9b8c78ed75..040138e2559 100644 --- a/drivers/mtd/nand/raw/sunxi_nand_spl.c +++ b/drivers/mtd/nand/raw/sunxi_nand_spl.c @@ -6,7 +6,6 @@  #include <asm/arch/clock.h>  #include <asm/io.h> -#include <common.h>  #include <config.h>  #include <nand.h>  #include <linux/bitops.h> diff --git a/drivers/mtd/nand/raw/tegra_nand.c b/drivers/mtd/nand/raw/tegra_nand.c index 6086ecdfa3d..8285f87359e 100644 --- a/drivers/mtd/nand/raw/tegra_nand.c +++ b/drivers/mtd/nand/raw/tegra_nand.c @@ -6,7 +6,6 @@   * (C) Copyright 2006 DENX Software Engineering   */ -#include <common.h>  #include <log.h>  #include <asm/global_data.h>  #include <asm/io.h> diff --git a/drivers/mtd/nand/raw/vf610_nfc.c b/drivers/mtd/nand/raw/vf610_nfc.c index d2363a0662e..10265950368 100644 --- a/drivers/mtd/nand/raw/vf610_nfc.c +++ b/drivers/mtd/nand/raw/vf610_nfc.c @@ -21,7 +21,7 @@   * - HW ECC: Only 24 and 32-bit error correction implemented.   */ -#include <common.h> +#include <config.h>  #include <malloc.h>  #include <dm/device_compat.h>  #include <linux/printk.h> diff --git a/drivers/mtd/nand/raw/zynq_nand.c b/drivers/mtd/nand/raw/zynq_nand.c index bacaf13c570..5f90171a6fe 100644 --- a/drivers/mtd/nand/raw/zynq_nand.c +++ b/drivers/mtd/nand/raw/zynq_nand.c @@ -6,7 +6,6 @@   * This driver is based on plat_nand.c and mxc_nand.c drivers   */ -#include <common.h>  #include <log.h>  #include <malloc.h>  #include <asm/io.h> diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c index 62c28aa422d..ef50237f10e 100644 --- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c @@ -21,7 +21,6 @@  #include <linux/spi/spi.h>  #include <linux/spi/spi-mem.h>  #else -#include <common.h>  #include <errno.h>  #include <watchdog.h>  #include <spi.h> diff --git a/drivers/mtd/nvmxip/nvmxip-uclass.c b/drivers/mtd/nvmxip/nvmxip-uclass.c index 9a316d1de39..95dfa58def1 100644 --- a/drivers/mtd/nvmxip/nvmxip-uclass.c +++ b/drivers/mtd/nvmxip/nvmxip-uclass.c @@ -6,7 +6,6 @@   *   Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>   */ -#include <common.h>  #include <dm.h>  #include <log.h>  #if CONFIG_IS_ENABLED(SANDBOX64) diff --git a/drivers/mtd/nvmxip/nvmxip.c b/drivers/mtd/nvmxip/nvmxip.c index 0bd98d64275..229938db380 100644 --- a/drivers/mtd/nvmxip/nvmxip.c +++ b/drivers/mtd/nvmxip/nvmxip.c @@ -6,7 +6,6 @@   *   Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>   */ -#include <common.h>  #include <dm.h>  #include <log.h>  #include <mapmem.h> diff --git a/drivers/mtd/nvmxip/nvmxip_qspi.c b/drivers/mtd/nvmxip/nvmxip_qspi.c index 4d7471118a4..460887c7da3 100644 --- a/drivers/mtd/nvmxip/nvmxip_qspi.c +++ b/drivers/mtd/nvmxip/nvmxip_qspi.c @@ -6,7 +6,6 @@   *   Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>   */ -#include <common.h>  #include <dm.h>  #include <fdt_support.h>  #include <linux/errno.h> diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c index 762b01c1b0f..edecb841338 100644 --- a/drivers/mtd/onenand/onenand_base.c +++ b/drivers/mtd/onenand/onenand_base.c @@ -19,7 +19,6 @@   * published by the Free Software Foundation.   */ -#include <common.h>  #include <log.h>  #include <watchdog.h>  #include <dm/devres.h> diff --git a/drivers/mtd/onenand/onenand_bbt.c b/drivers/mtd/onenand/onenand_bbt.c index cc1e449f4a7..6af1cb2ec19 100644 --- a/drivers/mtd/onenand/onenand_bbt.c +++ b/drivers/mtd/onenand/onenand_bbt.c @@ -14,7 +14,6 @@   * published by the Free Software Foundation.   */ -#include <common.h>  #include <log.h>  #include <linux/compat.h>  #include <linux/mtd/mtd.h> diff --git a/drivers/mtd/onenand/onenand_spl.c b/drivers/mtd/onenand/onenand_spl.c index 2699958a5de..a9d54a243ad 100644 --- a/drivers/mtd/onenand/onenand_spl.c +++ b/drivers/mtd/onenand/onenand_spl.c @@ -7,9 +7,10 @@   *	Kyungmin Park <kyungmin.park@samsung.com>   */ -#include <common.h> +#include <config.h>  #include <asm/io.h>  #include <linux/bitops.h> +#include <linux/string.h>  #include <linux/mtd/onenand_regs.h>  #include <onenand_uboot.h> diff --git a/drivers/mtd/onenand/onenand_uboot.c b/drivers/mtd/onenand/onenand_uboot.c index ecacabefadc..db0ac6c1fb8 100644 --- a/drivers/mtd/onenand/onenand_uboot.c +++ b/drivers/mtd/onenand/onenand_uboot.c @@ -13,7 +13,7 @@   * OneNAND initialization at U-Boot   */ -#include <common.h> +#include <config.h>  #include <display_options.h>  #include <linux/compat.h>  #include <linux/mtd/mtd.h> diff --git a/drivers/mtd/onenand/samsung.c b/drivers/mtd/onenand/samsung.c index c415e5149a0..ccfdad4913e 100644 --- a/drivers/mtd/onenand/samsung.c +++ b/drivers/mtd/onenand/samsung.c @@ -9,7 +9,6 @@   *	Emulate the pseudo BufferRAM   */ -#include <common.h>  #include <malloc.h>  #include <linux/compat.h>  #include <linux/mtd/mtd.h> diff --git a/drivers/mtd/renesas_rpc_hf.c b/drivers/mtd/renesas_rpc_hf.c index 979b64d4a2f..8dcffde9aa3 100644 --- a/drivers/mtd/renesas_rpc_hf.c +++ b/drivers/mtd/renesas_rpc_hf.c @@ -7,7 +7,6 @@   * Copyright (C) 2017 Marek Vasut <marek.vasut@gmail.com>   */ -#include <common.h>  #include <malloc.h>  #include <asm/io.h>  #include <clk.h> diff --git a/drivers/mtd/spi/fsl_espi_spl.c b/drivers/mtd/spi/fsl_espi_spl.c index cdbdbd6ea58..73eea922c33 100644 --- a/drivers/mtd/spi/fsl_espi_spl.c +++ b/drivers/mtd/spi/fsl_espi_spl.c @@ -3,7 +3,7 @@   * Copyright 2013 Freescale Semiconductor, Inc.   */ -#include <common.h> +#include <config.h>  #include <cpu_func.h>  #include <hang.h>  #include <spi_flash.h> diff --git a/drivers/mtd/spi/sandbox.c b/drivers/mtd/spi/sandbox.c index 4fe547171a5..2d5a16bf6a2 100644 --- a/drivers/mtd/spi/sandbox.c +++ b/drivers/mtd/spi/sandbox.c @@ -10,7 +10,6 @@  #define LOG_CATEGORY UCLASS_SPI_FLASH -#include <common.h>  #include <dm.h>  #include <log.h>  #include <malloc.h> diff --git a/drivers/mtd/spi/sf-uclass.c b/drivers/mtd/spi/sf-uclass.c index 2da0cf0dcf9..a4d15bd64aa 100644 --- a/drivers/mtd/spi/sf-uclass.c +++ b/drivers/mtd/spi/sf-uclass.c @@ -5,7 +5,6 @@  #define LOG_CATEGORY UCLASS_SPI_FLASH -#include <common.h>  #include <bootdev.h>  #include <dm.h>  #include <log.h> diff --git a/drivers/mtd/spi/sf_bootdev.c b/drivers/mtd/spi/sf_bootdev.c index d6b47b11ce4..017a74a3016 100644 --- a/drivers/mtd/spi/sf_bootdev.c +++ b/drivers/mtd/spi/sf_bootdev.c @@ -5,7 +5,6 @@   * Copyright 2022 Google LLC   */ -#include <common.h>  #include <bootdev.h>  #include <bootflow.h>  #include <bootmeth.h> diff --git a/drivers/mtd/spi/sf_dataflash.c b/drivers/mtd/spi/sf_dataflash.c index 6a0d953a729..6db24189c8e 100644 --- a/drivers/mtd/spi/sf_dataflash.c +++ b/drivers/mtd/spi/sf_dataflash.c @@ -6,7 +6,6 @@   * Haikun Wang (haikun.wang@freescale.com)   */ -#include <common.h>  #include <display_options.h>  #include <dm.h>  #include <errno.h> diff --git a/drivers/mtd/spi/sf_mtd.c b/drivers/mtd/spi/sf_mtd.c index 071b25ac67f..7342f26d88e 100644 --- a/drivers/mtd/spi/sf_mtd.c +++ b/drivers/mtd/spi/sf_mtd.c @@ -3,7 +3,6 @@   * Copyright (C) 2012-2014 Daniel Schwierzeck, daniel.schwierzeck@gmail.com   */ -#include <common.h>  #include <malloc.h>  #include <linux/errno.h>  #include <linux/mtd/mtd.h> diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c index de6516f1065..7100b64bf22 100644 --- a/drivers/mtd/spi/sf_probe.c +++ b/drivers/mtd/spi/sf_probe.c @@ -7,7 +7,6 @@   * Copyright (C) 2013 Jagannadha Sutradharudu Teki, Xilinx Inc.   */ -#include <common.h>  #include <dm.h>  #include <errno.h>  #include <linux/mtd/spi-nor.h> diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c index f86003ca8c0..aea611fef52 100644 --- a/drivers/mtd/spi/spi-nor-core.c +++ b/drivers/mtd/spi/spi-nor-core.c @@ -9,7 +9,6 @@   * Synced from Linux v4.19   */ -#include <common.h>  #include <display_options.h>  #include <log.h>  #include <watchdog.h> @@ -1805,11 +1804,62 @@ static int spi_nor_write(struct mtd_info *mtd, loff_t to, size_t len,  		if (ret < 0)  			return ret;  #endif +  		write_enable(nor); -		ret = nor->write(nor, addr, page_remain, buf + i); -		if (ret < 0) -			goto write_err; -		written = ret; + +		/* +		 * On DTR capable flashes like Micron Xcella the writes cannot +		 * start or end at an odd address in DTR mode. So we need to +		 * append or prepend extra 0xff bytes to make sure the start +		 * address and end address are even. +		 */ +		if (spi_nor_protocol_is_dtr(nor->write_proto) && +		    ((addr | page_remain) & 1)) { +			u_char *tmp; +			size_t extra_bytes = 0; + +			tmp = kmalloc(nor->page_size, 0); +			if (!tmp) { +				ret = -ENOMEM; +				goto write_err; +			} + +			/* Prepend a 0xff byte if the start address is odd. */ +			if (addr & 1) { +				tmp[0] = 0xff; +				memcpy(tmp + 1, buf + i, page_remain); +				addr--; +				page_remain++; +				extra_bytes++; +			} else { +				memcpy(tmp, buf + i, page_remain); +			} + +			/* Append a 0xff byte if the end address is odd. */ +			if ((addr + page_remain) & 1) { +				tmp[page_remain + extra_bytes] = 0xff; +				extra_bytes++; +				page_remain++; +			} + +			ret = nor->write(nor, addr, page_remain, tmp); + +			kfree(tmp); + +			if (ret < 0) +				goto write_err; + +			/* +			 * We write extra bytes but they are not part of the +			 * original write. +			 */ +			written = ret - extra_bytes; +		} else { +			ret = nor->write(nor, addr, page_remain, buf + i); +			if (ret < 0) +				goto write_err; +			written = ret; +		}  		ret = spi_nor_wait_till_ready(nor);  		if (ret) diff --git a/drivers/mtd/spi/spi-nor-ids.c b/drivers/mtd/spi/spi-nor-ids.c index 4e83b8c94c9..2206d734810 100644 --- a/drivers/mtd/spi/spi-nor-ids.c +++ b/drivers/mtd/spi/spi-nor-ids.c @@ -6,7 +6,6 @@   * Copyright (C) 2018 Texas Instruments Incorporated - https://www.ti.com/   */ -#include <common.h>  #include <spi.h>  #include <spi_flash.h> @@ -275,7 +274,7 @@ const struct flash_info spi_nor_ids[] = {  	{ INFO("mx66l2g45g",  0xc2201c, 0, 64 * 1024, 4096, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) },  	{ INFO("mx25l1633e", 0xc22415, 0, 64 * 1024,   32, SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES | SECT_4K) },  	{ INFO("mx25r6435f", 0xc22817, 0, 64 * 1024,   128,  SECT_4K) }, -	{ INFO("mx66uw2g345gx0", 0xc2943c, 0, 64 * 1024, 4096, SECT_4K | SPI_NOR_OCTAL_DTR_READ | SPI_NOR_4B_OPCODES) }, +	{ INFO("mx66uw2g345gx0", 0xc2943c, 0, 64 * 1024, 4096, SECT_4K | SPI_NOR_OCTAL_DTR_READ | SPI_NOR_4B_OPCODES | SPI_NOR_OCTAL_READ) },  	{ INFO("mx66lm1g45g",    0xc2853b, 0, 64 * 1024, 2048, SECT_4K | SPI_NOR_OCTAL_DTR_READ | SPI_NOR_4B_OPCODES) },  	{ INFO("mx25lm51245g",   0xc2853a, 0, 64 * 1024, 1024, SECT_4K | SPI_NOR_OCTAL_DTR_READ | SPI_NOR_4B_OPCODES) },  	{ INFO("mx25lw51245g",   0xc2863a, 0, 64 * 1024, 1024, SECT_4K | SPI_NOR_OCTAL_DTR_READ | SPI_NOR_4B_OPCODES) }, diff --git a/drivers/mtd/spi/spi-nor-tiny.c b/drivers/mtd/spi/spi-nor-tiny.c index 0719fe845ca..5755c5eed29 100644 --- a/drivers/mtd/spi/spi-nor-tiny.c +++ b/drivers/mtd/spi/spi-nor-tiny.c @@ -9,7 +9,6 @@   * Synced from Linux v4.19   */ -#include <common.h>  #include <log.h>  #include <dm/device_compat.h>  #include <linux/err.h> diff --git a/drivers/mtd/stm32_flash.c b/drivers/mtd/stm32_flash.c index 4523344ba6b..ec83be6b51f 100644 --- a/drivers/mtd/stm32_flash.c +++ b/drivers/mtd/stm32_flash.c @@ -4,7 +4,7 @@   * Kamil Lulko, <kamil.lulko@gmail.com>   */ -#include <common.h> +#include <config.h>  #include <flash.h>  #include <asm/io.h>  #include <asm/arch/stm32.h> diff --git a/drivers/mtd/ubi/Kconfig b/drivers/mtd/ubi/Kconfig index 5783d36c048..fd446d6efb3 100644 --- a/drivers/mtd/ubi/Kconfig +++ b/drivers/mtd/ubi/Kconfig @@ -9,6 +9,7 @@ config UBI_SILENCE_MSG  config MTD_UBI  	bool "Enable UBI - Unsorted block images" +	depends on MTD  	select RBTREE  	select MTD_PARTITIONS  	help diff --git a/drivers/mtd/ubispl/ubispl.c b/drivers/mtd/ubispl/ubispl.c index b58d8e8d565..90a7c4c6f9e 100644 --- a/drivers/mtd/ubispl/ubispl.c +++ b/drivers/mtd/ubispl/ubispl.c @@ -7,7 +7,6 @@   * Copyright (c) International Business Machines Corp., 2006   */ -#include <common.h>  #include <errno.h>  #include <linux/bug.h>  #include <u-boot/crc.h> | 
