summaryrefslogtreecommitdiff
path: root/drivers/mtd
AgeCommit message (Collapse)Author
14 daysMerge tag 'ubifs-for-linus-6.19-rc1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs Pull UBI and UBIFS updates from Richard Weinberger: "UBIFS: - Misc code cleanups such as removal of unnecessary variables UBI: - No longer program unused bit in UBI headers" * tag 'ubifs-for-linus-6.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs: ubifs: vmalloc(array_size()) -> vmalloc_array() ubi: fastmap: fix ubi->fm memory leak mtd: ubi: skip programming unused bits in ubi headers ubifs: Remove unnecessary variable assignments ubifs: Simplify the code using ubifs_crc_node ubifs: Remove unnecessary parameters '*c'
2025-12-04Merge tag 'mtd/for-6.19' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux Pull mtd updates from Miquel Raynal: "Core MTD changes: - We must ignore error -ENOENT from parsers on subpartitions which is a legitimate return value - PM support is added to the intel-dg driver Raw NAND changes: - The major change in this is the support for the Allwinner H616 NAND controller, which lead to numerous changes and cleanups in the driver. - Another notable change in this driver is the use of field_get() and field_prep(), but since the global support for this helpers is going to be merged in the same release as we start using these helpers, we undefine them in the first place to avoid warnings. - Marvell drivers layout handling changes have also landed, they fix previous definitions and abuses that have been made previously, which implied to relax the ECC parameters validation in the core a bit. - The Cadence NAND controller driver gets NV-DDR interface support. SPI NAND changes: - Support for FudanMicro FM25S01BI3 and ESMT F50L1G41LC is added. SPI NOR changes: - Fix SMPT parsing for S25FS-S flash family. They report variable dummy cycles for reads. This results in the default of 0 being used. This works for other Infineon chips, but not for the S25FS-S family. They need 8 dummy cycles. Add fixup hooks to specify that. Also add fixup hooks to fix incorrect map ID data in SFDP. - Add support for a bunch of Winbond flashes. Their block protection information is not discoverable, so they need to have an entry in the flash tables to describe that. - Some cleanups for Micron flash support. - Add support for Micron mt35xu01gbba. - Some SPI controllers like the Intel one on the PCI bus do not support the read CR opcode (0x35). Do not use the opcode if the controller does not support it. Aside from these main changes, there is the usual load of API updates, kdoc fixes, potential memory leaks fixes, etc" * tag 'mtd/for-6.19' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux: (51 commits) mtd: sm_ftl: Fix typo in comment in sm_read_lba mtd: sm_ftl: Replace deprecated strncpy with sysfs_emit in sm_attr_show mtd: lpddr_cmds: fix signed shifts in lpddr_cmds mtd: docg3: fix kernel-doc warnings mtd: spinand: add support for FudanMicro FM25S01BI3 mtd: rawnand: renesas: Handle devm_pm_runtime_enable() errors mtd: nand: realtek-ecc: Fix Kconfig dependencies mtd: rawnand: sunxi: #undef field_{get,prep}() before local definition mailmap: update Pratyush Yadav's email address mtd: spi-nor: core: Check read CR support mtd: spi-nor: micron-st: add TODO for fixing mt35xu02gcba mtd: spi-nor: micron-st: add mt35xu01gbba support mtd: spi-nor: micron-st: use SFDP of mt35xu512aba mtd: spi-nor: micron-st: move set_octal_dtr to late_init() mtd: spi-nor: micron-st: rename the die_late_init functions mtd: spinand: esmt: add support for F50L1G41LC mtd: rawnand: lpc32xx_slc: Convert to use devm_gpiod_get_optional() mtd: mtdpart: ignore error -ENOENT from parsers on subpartitions mtd: maps: pcmciamtd: fix potential memory leak in pcmciamtd_detach() mtd: spi-nor: spansion: SMPT fixups for S25FS-S ...
2025-11-29Merge tag 'nand/for-6.19' into mtd/nextMiquel Raynal
Raw NAND changes: * The major change in this MR will be the support for the Allwinner H616 NAND controller, which lead to numerous changes and cleanups in the driver. * Another notable change on this driver is the use of field_get()/field_prep(), but since the global support for this helpers is going to be merged in the same release as we start using these helpers, it implies undefining them in the first place to avoid warnings. Depending on the merging order (Yuri's bitmap branch or mtd/next), a temporary warning may arise. * Marvell drivers layout handling changes have also landed, they fix previous definitions and abuses that have been made previously, which implied to relax the ECC parameters validation in the core a bit. * The Cadence NAND controller driver gets NV-DDR interface support. SPI NAND changes: * Support for FudanMicro FM25S01BI3 and ESMT F50L1G41LC is added. Aside from these main changes, there is the usual load of fixes and API updates.
2025-11-29Merge tag 'spi-nor/for-6.19' of ↵Miquel Raynal
https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux into mtd/next SPI NOR changes for 6.19 Notable changes: - Fix SMPT parsing for S25FS-S flash family. They report variable dummy cycles for reads. This results in the default of 0 being used. This works for other Infineon chips, but not for the S25FS-S family. They need 8 dummy cycles. Add fixup hooks to specify that. Also add fixup hooks to fix incorrect map ID data in SFDP. - Add support for a bunch of Winbond flashes. Their block protection information is not discoverable, so they need to have an entry in the flash tables to describe that. - Some cleanups for Micron flash support. - Add support for Micron mt35xu01gbba. - Some SPI controllers like the Intel one on the PCI bus do not support the read CR opcode (0x35). Do not use the opcode if the controller does not support it. # -----BEGIN PGP SIGNATURE----- # # iHUEABYKAB0WIQQTlUWNzXGEo3bFmyIR4drqP028CQUCaSjP+QAKCRAR4drqP028 # CfGsAQC5Vj+FaeQHyY+yywqM5wxE+xj6mMCDNixd2FVYlf5b7wEA2/9bpiHjy3qi # 4MZmFJNcE+XsxReWDTBTZ6VbrjDlqg0= # =M+s4 # -----END PGP SIGNATURE----- # gpg: Signature made jeu. 27 nov. 2025 23:26:01 CET # gpg: using EDDSA key 1395458DCD7184A376C59B2211E1DAEA3F4DBC09 # gpg: Good signature from "Pratyush Yadav <p.yadav@ti.com>" [expired] # gpg: aka "Pratyush Yadav <me@yadavpratyush.com>" [expired] # gpg: p.yadav@ti.com: Verified 5 signatures in the past 3 years. Encrypted 0 messages. # gpg: me@yadavpratyush.com: Verified 5 signatures in the past 3 years. Encrypted # 0 messages. # gpg: Note: This key has expired! # Primary key fingerprint: 805C 3923 2FBE 108C 49E1 663C F650 3556 C11B 1CCD # Subkey fingerprint: 1395 458D CD71 84A3 76C5 9B22 11E1 DAEA 3F4D BC09
2025-11-29mtd: sm_ftl: Fix typo in comment in sm_read_lbaThorsten Blum
s/is/if/ Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
2025-11-29mtd: sm_ftl: Replace deprecated strncpy with sysfs_emit in sm_attr_showThorsten Blum
strncpy() is deprecated [1] for NUL-terminated destination buffers because it does not guarantee NUL termination. It also unnecessarily NUL-pads the destination buffer if the source is shorter. Replace it with sysfs_emit() using the "%.*s" format specifier and supply the length 'sm_attr->len' to improve sm_attr_show(). Return the number of characters actually written to 'buf' instead of 'sm_attr->len'. Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1] Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
2025-11-29mtd: lpddr_cmds: fix signed shifts in lpddr_cmdsIvan Stepchenko
There are several places where a value of type 'int' is shifted by lpddr->chipshift. lpddr->chipshift is derived from QINFO geometry and might reach 31 when QINFO reports a 2 GiB size - the maximum supported by LPDDR(1) compliant chips. This may cause unexpected sign-extensions when casting the integer value to the type of 'unsigned long'. Use '1UL << lpddr->chipshift' and cast 'j' to unsigned long before shifting so the computation is performed at the destination width. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: c68264711ca6 ("[MTD] LPDDR Command set driver") Signed-off-by: Ivan Stepchenko <sid@itb.spb.ru> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
2025-11-29mtd: docg3: fix kernel-doc warningsRandy Dunlap
Fix kernel-doc warnings in docg3.h to avoid build warnings: Warning: ../drivers/mtd/devices/docg3.h:276 bad line: Warning: drivers/mtd/devices/docg3.h:299 struct member 'max_block' not described in 'docg3' Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
2025-11-29mtd: spinand: add support for FudanMicro FM25S01BI3Mikhail Zhilkin
Add support for FudanMicro FM25S01BI3 SPI NAND. Link: https://www.fmsh.com/nvm/FM25S01BI3_ds_eng.pdf Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
2025-11-28ubi: fastmap: fix ubi->fm memory leakLiyuan Pang
The problem is that scan_fast() allocate memory for ubi->fm and ubi->fm->e[x], but if the following attach process fails in ubi_wl_init or ubi_read_volume_table, the whole attach process will fail without executing ubi_wl_close to free the memory under ubi->fm. Fix this by add a new ubi_free_fastmap function in fastmap.c to free the memory allocated for fm. If SLUB_DEBUG and KUNIT are enabled, the following warning messages will show: ubi0: detaching mtd0 ubi0: mtd0 is detached ubi0: default fastmap pool size: 200 ubi0: default fastmap WL pool size: 100 ubi0: attaching mtd0 ubi0: attached by fastmap ubi0: fastmap pool size: 200 ubi0: fastmap WL pool size: 100 ubi0 error: ubi_wl_init [ubi]: no enough physical eraseblocks (4, need 203) ubi0 error: ubi_attach_mtd_dev [ubi]: failed to attach mtd0, error -28 UBI error: cannot attach mtd0 ================================================================= BUG ubi_wl_entry_slab (Tainted: G B O L ): Objects remaining in ubi_wl_entry_slab on __kmem_cache_shutdown() ----------------------------------------------------------------------------- Slab 0xffff2fd23a40cd00 objects=22 used=1 fp=0xffff2fd1d0334fd8 flags=0x883fffc010200(slab|head|section=34|node=0|zone=1|lastcpupid=0x7fff) CPU: 0 PID: 5884 Comm: insmod Tainted: G B O L 5.10.0 #1 Hardware name: LS1043A RDB Board (DT) Call trace: dump_backtrace+0x0/0x198 show_stack+0x18/0x28 dump_stack+0xe8/0x15c slab_err+0x94/0xc0 __kmem_cache_shutdown+0x1fc/0x39c kmem_cache_destroy+0x48/0x138 ubi_init+0x1d4/0xf34 [ubi] do_one_initcall+0xb4/0x24c do_init_module+0x4c/0x1dc load_module+0x212c/0x2260 __se_sys_finit_module+0xb4/0xd8 __arm64_sys_finit_module+0x18/0x28 el0_svc_common.constprop.0+0x78/0x1a0 do_el0_svc+0x78/0x90 el0_svc+0x20/0x38 el0_sync_handler+0xf0/0x140 normal+0x3d8/0x400 Object 0xffff2fd1d0334e68 @offset=3688 Allocated in ubi_scan_fastmap+0xf04/0xf40 [ubi] age=80 cpu=0 pid=5884 __slab_alloc.isra.21+0x6c/0xb4 kmem_cache_alloc+0x1e4/0x80c ubi_scan_fastmap+0xf04/0xf40 [ubi] ubi_attach+0x1f0/0x3a8 [ubi] ubi_attach_mtd_dev+0x810/0xbc8 [ubi] ubi_init+0x238/0xf34 [ubi] do_one_initcall+0xb4/0x24c do_init_module+0x4c/0x1dc load_module+0x212c/0x2260 __se_sys_finit_module+0xb4/0xd8 __arm64_sys_finit_module+0x18/0x28 el0_svc_common.constprop.0+0x78/0x1a0 do_el0_svc+0x78/0x90 el0_svc+0x20/0x38 el0_sync_handler+0xf0/0x140 normal+0x3d8/0x400 Link: https://bugzilla.kernel.org/show_bug.cgi?id=220744 Signed-off-by: Liyuan Pang <pangliyuan1@huawei.com> Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com> Signed-off-by: Richard Weinberger <richard@nod.at>
2025-11-28mtd: ubi: skip programming unused bits in ubi headersCheng Ming Lin
This patch prevents unnecessary programming of bits in ec_hdr and vid_hdr that are not used or read during normal UBI operation. These unused bits are typcially already set to 1 in erased flash and do not need to be explicitly programmed to 0 if they are not used. Programming such unused areas offers no functional benefit and may result in unnecessary flash wear, reducing the overall lifetime of the device. By skipping these writes, we preserve the flash state as much as possible and minimize wear caused by redundant operations. This change ensures that only necessary fields are written when preparing UBI headers, improving flash efficiency without affecting functionality. Additionally, the Kioxia TC58NVG1S3HTA00 datasheet (page 63) also notes that continuous program/erase cycling with a high percentage of '0' bits in the data pattern can accelerate block endurance degradation. This further supports avoiding large 0x00 patterns. Link: https://europe.kioxia.com/content/dam/kioxia/newidr/productinfo/datasheet/201910/DST_TC58NVG1S3HTA00-TDE_EN_31442.pdf Signed-off-by: Cheng Ming Lin <chengminglin@mxic.com.tw> Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com> Signed-off-by: Richard Weinberger <richard@nod.at>
2025-11-28mtd: rawnand: renesas: Handle devm_pm_runtime_enable() errorsHaotian Zhang
devm_pm_runtime_enable() can fail due to memory allocation failures. The current code ignores its return value and proceeds with pm_runtime_resume_and_get(), which may operate on incorrectly initialized runtime PM state. Check the return value of devm_pm_runtime_enable() and return the error code if it fails. Fixes: 6a2277a0ebe7 ("mtd: rawnand: renesas: Use runtime PM instead of the raw clock API") Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
2025-11-27mtd: nand: realtek-ecc: Fix Kconfig dependenciesMiquel Raynal
The driver uses DMA but does not mark it as a prerequisite in Kconfig. As it is also defined with COMPILE_TEST, autobuilders complain about certain symbols not being available when linking on architectures without DMA support (?) like sh. Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202511071114.8WeW2GZK-lkp@intel.com Cc: Markus Stockhausen <markus.stockhausen@gmx.de> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
2025-11-27mtd: rawnand: sunxi: #undef field_{get,prep}() before local definitionGeert Uytterhoeven
Prepare for the advent of globally available common field_get() and field_prep() macros by undefining the symbols before defining local variants. This prevents redefinition warnings from the C preprocessor when introducing the common macros later. Suggested-by: Yury Norov <yury.norov@gmail.com> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
2025-11-18mtd: spi-nor: core: Check read CR supportJakub Czapiga
Some SPI controllers like Intel's one on the PCI bus do not support opcode 35h. This opcode is used to read the Configuration Register on SPI-NOR chips that have 16-bit Status Register configured regardless of the controller support for it. Adding a check call in the setup step allows disabling use of the 35h opcode and falling back to the manual Status Registers management. Before: openat(AT_FDCWD, "/dev/mtd0", O_RDWR) = 4 ioctl(4, MIXER_WRITE(6) or MEMUNLOCK, {start=0, length=0x2000000}) = -1 EOPNOTSUPP After: openat(AT_FDCWD, "/dev/mtd0", O_RDWR) = 4 ioctl(4, MIXER_WRITE(6) or MEMUNLOCK, {start=0, length=0x2000000}) = 0 ioctl(4, MIXER_WRITE(5) or MEMLOCK, {start=0x1800000, length=0x800000}) = 0 Suggested-by: Adeel Arshad <adeel.arshad@intel.com> Signed-off-by: Jakub Czapiga <czapiga@google.com> Reviewed-by: Pratyush Yadav <pratyush@kernel.org> Signed-off-by: Pratyush Yadav <pratyush@kernel.org>
2025-11-18mtd: spi-nor: micron-st: add TODO for fixing mt35xu02gcbaHaibo Chen
The MT35XU02GCBA flash device does not support chip erase, according to its datasheet. It supports die erase, which means the current driver implementation will likely need to be converted to use die erase. Furthermore, similar to the MT35XU01GBBA, the SPI_NOR_IO_MODE_EN_VOLATILE flag probably needs to be enabled. Currently no active contributor has access to this hardware so there is no way of testing the fixes. Add a TODO item on the flash entry so someone with the flash can test that the support is indeed broken and send the fixes. Link: https://datasheet.octopart.com/MT35XU02GCBA1G12-0AAT-Micron-datasheet-138896808.pdf Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org> Signed-off-by: Haibo Chen <haibo.chen@nxp.com> [pratyush@kernel.org: refactor the comment and commit message to make the purpose of the comment clearer] Signed-off-by: Pratyush Yadav <pratyush@kernel.org>
2025-11-18mtd: spi-nor: micron-st: add mt35xu01gbba supportHaibo Chen
mt35xu01gbba is similar with mt35xu512aba, but with two dies. mt35xu01gbba has SFDP and support 8D-8D-8D mode, but SFDP lack SNOR_F_IO_MODE_EN_VOLATILE, so add this fixup flags here. Besides, mt35xu01gbba do not support chip erase, but support die erase, so add that in late_init(). Link: https://datasheet.octopart.com/MT35XU02GCBA1G12-0AAT-Micron-datasheet-138896808.pdf Signed-off-by: Haibo Chen <haibo.chen@nxp.com> Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org> Signed-off-by: Pratyush Yadav <pratyush@kernel.org>
2025-11-18mtd: spi-nor: micron-st: use SFDP of mt35xu512abaHaibo Chen
mt35xu512aba has SFDP, already contain the necessary information, so remove size and some flags here. Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org> Signed-off-by: Haibo Chen <haibo.chen@nxp.com> Signed-off-by: Pratyush Yadav <pratyush@kernel.org>
2025-11-18mtd: spi-nor: micron-st: move set_octal_dtr to late_init()Haibo Chen
Move params->set_octal_dtr from flash_info->fixups->default_init() to spi_nor_manufacturer-> fixups-> late_init(), this can cover all Micorn and ST chips without repeat in each chip's flash_info. Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org> Signed-off-by: Haibo Chen <haibo.chen@nxp.com> Signed-off-by: Pratyush Yadav <pratyush@kernel.org>
2025-11-18mtd: spi-nor: micron-st: rename the die_late_init functionsHaibo Chen
st_nor_two/four_die_late_init() also suit for micron chips, so rename to micron_st_nor_two/four_die_late_init(), and move these functions up, then micron can use these function without declaration. Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org> Signed-off-by: Haibo Chen <haibo.chen@nxp.com> Signed-off-by: Pratyush Yadav <pratyush@kernel.org>
2025-11-17mtd: spinand: esmt: add support for F50L1G41LCDaniel Golle
This adds support for ESMT F50L1G41LC, which appears to be an updated version of the already supported F50L1G41LB. Add esmt_8c SPI_NAND manufacturer to account for the newly used vendor ID with support for the ESMT F50L1G41LC chip. Link: https://github.com/openwrt/openwrt/pull/15214#issuecomment-3514824435 Signed-off-by: Daniel Golle <daniel@makrotopia.org> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
2025-11-17mtd: rawnand: lpc32xx_slc: Convert to use devm_gpiod_get_optional()Haotian Zhang
The initial fix for a GPIO descriptor leak added manual gpiod_put() calls in the error path and remove function. This follow-up patch improves upon the fix by switching to the resource-managed devm_gpiod_get_optional() API. Suggested-by: Vladimir Zapolskiy <vz@mleia.com> Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn> Reviewed-by: Vladimir Zapolskiy <vz@mleia.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
2025-11-17mtd: mtdpart: ignore error -ENOENT from parsers on subpartitionsChristian Marangi
Commit 5c2f7727d437 ("mtd: mtdpart: check for subpartitions parsing result") introduced some kind of regression with parser on subpartitions where if a parser emits an error then the entire parsing process from the upper parser fails and partitions are deleted. Not checking for error in subpartitions was originally intended as special parser can emit error also in the case of the partition not correctly init (for example a wiped partition) or special case where the partition should be skipped due to some ENV variables externally provided (from bootloader for example) One example case is the TRX partition where, in the context of a wiped partition, returns a -ENOENT as the trx_magic is not found in the expected TRX header (as the partition is wiped) To better handle this and still keep some kind of error tracking (for example to catch -ENOMEM errors or -EINVAL errors), permit parser on subpartition to emit -ENOENT error, print a debug log and skip them accordingly. This results in giving better tracking of the status of the parser (instead of returning just 0, dropping any kind of signal that there is something wrong with the parser) and to some degree restore the original logic of the subpartitions parse. (worth to notice that some special partition might have all the special header present for the parser and declare 0 partition in it, this is why it would be wrong to simply return 0 in the case of a special partition that is NOT init for the scanning parser) Cc: stable@vger.kernel.org Fixes: 5c2f7727d437 ("mtd: mtdpart: check for subpartitions parsing result") Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
2025-11-17mtd: maps: pcmciamtd: fix potential memory leak in pcmciamtd_detach()Abdun Nihaal
The memory allocated for struct pcmciamtd_dev in pcmciamtd_probe() is not freed in the corresponding remove function pcmciamtd_detach(). Fix that by freeing it in the remove function. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
2025-11-10mtd: spi-nor: spansion: SMPT fixups for S25FS-STakahiro Kuwano
S25FS-S family supports SMPT that helps to detect sector layout settings in configuration registers, but some of parameters in the table are wrong or undetermined so the fixups below are required. Read Any Register op is used to read configuration registers that related to sector map. The op requires 8 cycles latency by default. Implement smpt_read_dummy() to set correct dummy cycles. Map ID is structured by combination of CR3NV[3], CR1NV[2], and CR3NV[1]. However, in S25FS512S, CR3NV[1] is RFU and always 0, while map IDs defined in the table assume it is always 1. Implement smpt_map_id() to fix map ID for S25FS512S. Other densities in S25FS-S family (256Mb and 128Mb) don't need this fix as CR3NV[1] in those chips is configurable and map IDs are correctly defined in SMPT. Co-developed-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org> Tested-by: Marek Vasut <marek.vasut+renesas@mailbox.org> # S25FS512S Signed-off-by: Takahiro Kuwano <Takahiro.Kuwano@infineon.com> Signed-off-by: Pratyush Yadav <pratyush@kernel.org>
2025-11-10mtd: spi-nor: sfdp: introduce smpt_map_id fixup hookTakahiro Kuwano
Certain chips have inconsistent Sector Map Parameter Table (SMPT) data, which leads to the wrong map ID being identified, causing failures to detect the correct sector map. To fix this, introduce smpt_map_id() into the struct spi_nor_fixups. This function will be called after the initial SMPT-based detection, allowing chip-specific logic to correct the map ID. Infineon S25FS512S needs this fixup as it has inconsistency between map ID definition and configuration register value actually obtained. Co-developed-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org> Tested-by: Marek Vasut <marek.vasut+renesas@mailbox.org> # S25FS512S Signed-off-by: Takahiro Kuwano <Takahiro.Kuwano@infineon.com> Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org>> Signed-off-by: Pratyush Yadav <pratyush@kernel.org>
2025-11-10mtd: spi-nor: sfdp: introduce smpt_read_dummy fixup hookTakahiro Kuwano
SMPT contains config detection info that describes opcode, address, and dummy cycles to read sector map config. The dummy cycles parameter can be SMPT_CMD_READ_DUMMY_IS_VARIABLE and in that case nor->read_dummy (initialized as 0) is used. In Infineon flash chips, Read Any Register command with variable dummy cycle is defined in SMPT. S25Hx/S28Hx flash has 0 dummy cycle by default to read volatile regiters and nor->read_dummy can work. S25FS-S flash has 8 dummy cycles so we need a hook that can fix dummy cycles with actually used value. Inroduce smpt_read_dummy() in struct spi_nor_fixups. It is called when the dummy cycle field in SMPT config detection is 'varialble'. Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org> Tested-by: Marek Vasut <marek.vasut+renesas@mailbox.org> # S25FS512S Signed-off-by: Takahiro Kuwano <Takahiro.Kuwano@infineon.com> Signed-off-by: Pratyush Yadav <pratyush@kernel.org>
2025-11-06mtd: spi-nor: winbond: Add support for W25H02NWxxAM chipsMiquel Raynal
These chips must be described as none of the block protection information are discoverable. This chip supports 4 bits plus the top/bottom addressing capability to identify the protected blocks. Cc: stable@vger.kernel.org Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Michael Walle <mwalle@kernel.org> Signed-off-by: Pratyush Yadav <pratyush@kernel.org>
2025-11-06mtd: spi-nor: winbond: Add support for W25H01NWxxAM chipsMiquel Raynal
These chips must be described as none of the block protection information are discoverable. This chip supports 4 bits plus the top/bottom addressing capability to identify the protected blocks. Cc: stable@vger.kernel.org Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Michael Walle <mwalle@kernel.org> Signed-off-by: Pratyush Yadav <pratyush@kernel.org>
2025-11-06mtd: spi-nor: winbond: Add support for W25H512NWxxAM chipsMiquel Raynal
These chips must be described as none of the block protection information are discoverable. This chip supports 4 bits plus the top/bottom addressing capability to identify the protected blocks. Cc: stable@vger.kernel.org Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Michael Walle <mwalle@kernel.org> Signed-off-by: Pratyush Yadav <pratyush@kernel.org>
2025-11-06mtd: spi-nor: winbond: Add support for W25Q02NWxxIM chipsMiquel Raynal
These chips must be described as none of the block protection information are discoverable. This chip supports 4 bits plus the top/bottom addressing capability to identify the protected blocks. Cc: stable@vger.kernel.org Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Michael Walle <mwalle@kernel.org> Signed-off-by: Pratyush Yadav <pratyush@kernel.org>
2025-11-06mtd: spi-nor: winbond: Add support for W25Q01NWxxIM chipsMiquel Raynal
These chips must be described as none of the block protection information are discoverable. This chip supports 4 bits plus the top/bottom addressing capability to identify the protected blocks. Cc: stable@vger.kernel.org Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Michael Walle <mwalle@kernel.org> Signed-off-by: Pratyush Yadav <pratyush@kernel.org>
2025-11-06mtd: spi-nor: winbond: Add support for W25Q01NWxxIQ chipsMiquel Raynal
This chip must be described as none of the block protection information are discoverable. This chip supports 4 bits plus the top/bottom addressing capability to identify the protected blocks. Cc: stable@vger.kernel.org Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Michael Walle <mwalle@kernel.org> Signed-off-by: Pratyush Yadav <pratyush@kernel.org>
2025-11-03mtd: onenand: Pass correct pointer to IRQ handlerDan Carpenter
This was supposed to pass "onenand" instead of "&onenand" with the ampersand. Passing a random stack address which will be gone when the function ends makes no sense. However the good thing is that the pointer is never used, so this doesn't cause a problem at run time. Fixes: e23abf4b7743 ("mtd: OneNAND: S5PC110: Implement DMA interrupt method") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
2025-11-03mtd: spinand: fmsh: remove QE bit for FM25S01A flashMikhail Kshevetskiy
According to datasheet (http://eng.fmsh.com/nvm/FM25S01A_ds_eng.pdf) there is no QE (Quad Enable) bit for FM25S01A flash, so remove it. Fixes: 5f284dc15ca86 ("mtd: spinand: add support for FudanMicro FM25S01A") Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu> Tested-by: Tianling Shen <cnsztl@gmail.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
2025-10-28mtd: intel-dg: wake card on operationsAlexander Usyskin
The Intel DG cards do not have separate power control for persistent memory. The memory is available when the whole card is awake. Enable runtime PM in mtd driver to notify parent graphics driver that whole card should be kept awake while nvm operations are performed through this driver. Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
2025-10-28mtd: rawnand: sunxi: Add support for H616 nand controllerRichard Genoud
The H616 nand controller has the same base as A10/A23, with some differences: - mdma is based on chained buffers - its ECC supports up to 80bit per 1024bytes - some registers layouts are a bit different, mainly due do the stronger ECC. - it uses USER_DATA_LEN registers along USER_DATA registers. - it needs a specific clock for ECC and MBUS. Introduce the basic support, with ECC and scrambling, but without DMA/MDMA. Tested on Whatsminer H616 board (with and without scrambling, ECC) Signed-off-by: Richard Genoud <richard.genoud@bootlin.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
2025-10-28mtd: rawnand: sunxi: introduce sram_size in sunxi_nfc_capsRichard Genoud
The H6/H616 the SRAM is bigger than the A10/A23 one, so move its size into sunxi_nfc_caps. No functional change Signed-off-by: Richard Genoud <richard.genoud@bootlin.com> Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
2025-10-28mtd: rawnand: sunxi: introduce ecc_err_mask in sunxi_nfc_capsRichard Genoud
The H6/H616 error mask register is bigger than the A10/A23 one, so move its mask into sunxi_nfc_caps. No functional change Signed-off-by: Richard Genoud <richard.genoud@bootlin.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
2025-10-28mtd: rawnand: sunxi: introduce reg_spare_area in sunxi_nfc_capsRichard Genoud
The H6/H616 spare area register is not at the same offset as the A10/A23 one, so move its offset into sunxi_nfc_caps. No functional change. Signed-off-by: Richard Genoud <richard.genoud@bootlin.com> Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
2025-10-28mtd: rawnand: sunxi: introduce reg_pat_id in sunxi_nfc_capsRichard Genoud
The H6/H616 pattern ID register is not at the same offset as the A10/A23 one, so move its offset into sunxi_nfc_caps. No functional change. Signed-off-by: Richard Genoud <richard.genoud@bootlin.com> Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
2025-10-28mtd: rawnand: sunxi: introduce random en/dir in sunxi_nfc_capsRichard Genoud
The H6/H616 RANDOM EN/DIRECTION masks are different from A10/A23. So move the masks into sunxi_nfc_caps. No functional change. Signed-off-by: Richard Genoud <richard.genoud@bootlin.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
2025-10-28mtd: rawnand: sunxi: introduce ecc_mode_mask in sunxi_nfc_capsRichard Genoud
The H6/H616 ECC_MODE field is not at the same offset, and has not the same size. So move the mask into sunxi_nfc_caps. Also, introduce a non compile-time field_prep() because FIELD_PREP() doesn't work with non compile-time constant. No functional change. Link: https://lore.kernel.org/all/cover.1761588465.git.geert+renesas@glider.be Signed-off-by: Richard Genoud <richard.genoud@bootlin.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
2025-10-28mtd: rawnand: sunxi: add has_ecc_block_512 capabilityRichard Genoud
The H616 controller can't handle 512 bytes ECC block size. The NFC_ECC_BLOCK_512 bit disappeared in H6, and NDFC_RANDOM_EN took its place. So, add has_ecc_block_512 capability to only set this bit on SoC having it. No functional change. Signed-off-by: Richard Genoud <richard.genoud@bootlin.com> Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
2025-10-28mtd: rawnand: sunxi: rework pattern found registersRichard Genoud
On H6/H616, the register ECC_PAT_FOUND is at its own address, and not part of ECC status register. So, introduce the pattern found register offset in sunxi_nfc_caps, along with its mask. Also, introduce a non compile-time field_get() because FIELD_GET() and u32_get_bits() don't work with non compile-time constant. No functional change. Link: https://lore.kernel.org/all/cover.1761588465.git.geert+renesas@glider.be Signed-off-by: Richard Genoud <richard.genoud@bootlin.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
2025-10-28mtd: rawnand: sunxi: introduce reg_user_data in sunxi_nfc_capsRichard Genoud
The H6/H616 USER_DATA register is not at the same offset as the A10/A23 one, so move its offset into sunxi_nfc_caps No functional change. Signed-off-by: Richard Genoud <richard.genoud@bootlin.com> Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
2025-10-28mtd: rawnand: sunxi: introduce reg_ecc_err_cnt in sunxi_nfc_capsRichard Genoud
The H6/H616 ECC_ERR_CNT register is not at the same offset as the A10/A23 one, so move its offset into sunxi_nfc_caps No functional change. Signed-off-by: Richard Genoud <richard.genoud@bootlin.com> Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
2025-10-28mtd: rawnand: sunxi: move ECC strenghts in sunxi_nfc_capsRichard Genoud
H6/H616 has more ECC strenghts than A10/A23. Move the ECC strenghts array to sunxi_nfc_caps to make it ready for H6/H616 support. No functional change. Reviewed-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Richard Genoud <richard.genoud@bootlin.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
2025-10-28mtd: rawnand: sunxi: Replace hard coded value by a defineRichard Genoud
The user data length (4) used all over the code hard coded. And sometimes, it's not that trivial to know that it's the user data length and not something else. Moreover, for the H6/H616 this value is no more fixed by hardware, but could be modified. Using a define here makes the code more readable. Suggested-by: Miquel Raynal <miquel.raynal@bootlin.com> Signed-off-by: Richard Genoud <richard.genoud@bootlin.com> Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
2025-10-28mtd: rawnand: sunxi: Remove superfluous register readingsRichard Genoud
The register NFC_REG_ECC_CTL was read twice and the result was not used, then a third time with a mask applied. Removing those calls didn't change the behavior. Tested on H616 SoC, scrambling enabled. Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com> Signed-off-by: Richard Genoud <richard.genoud@bootlin.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>