summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/parsers
Commit message (Collapse)AuthorAgeFilesLines
* mtd: parsers: bcm47xxpart: make read-only array possible_nvram_sizes static ↵Colin Ian King2024-08-231-1/+1
| | | | | | | | | | | const Don't populate the read-only array possible_nvram_sizes on the stack at run time, instead make it static const. Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20240822164632.638171-1-colin.i.king@gmail.com
* mtd: Use of_property_read_bool()Rob Herring (Arm)2024-08-231-2/+2
| | | | | | | | | | | | Use of_property_read_bool() to read boolean properties rather than of_get_property(). This is part of a larger effort to remove callers of of_get_property() and similar functions. of_get_property() leaks the DT property data pointer which is a problem for dynamically allocated nodes which may be freed. Signed-off-by: Rob Herring (Arm) <robh@kernel.org> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20240731191312.1710417-22-robh@kernel.org
* mtd: cmdlinepart: Replace `dbg()` macro with `pr_debug()`Csókás, Bence2024-07-011-13/+5
| | | | | | | | | | | This macro was left over from the dawn of Git history. For some reason it was defined in such a way that you needed double brackets around it. Replace it with the now-standard `pr_debug()`. Signed-off-by: Csókás, Bence <csokas.bence@prolan.hu> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20240625093148.3579660-1-csokas.bence@prolan.hu
* mtd: add missing MODULE_DESCRIPTION() macrosJeff Johnson2024-07-012-0/+2
| | | | | | | | | | | | | | | | With ARCH=x86, make allmodconfig && make W=1 C=1 reports: WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/mtd/parsers/brcm_u-boot.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/mtd/parsers/tplink_safeloader.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/mtd/chips/cfi_util.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/mtd/chips/cfi_cmdset_0020.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/mtd/maps/map_funcs.o Add the missing invocations of the MODULE_DESCRIPTION() macro. Signed-off-by: Jeff Johnson <quic_jjohnson@quicinc.com> Acked-by: Vignesh Raghavendra <vigneshr@ti.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20240610-md-drivers-mtd-v1-1-0f59183e4005@quicinc.com
* mtd: partitions: redboot: Added conversion of operands to a larger typeDenis Arefev2024-03-251-1/+1
| | | | | | | | | | | | The value of an arithmetic expression directory * master->erasesize is subject to overflow due to a failure to cast operands to a larger data type before perfroming arithmetic Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Denis Arefev <arefev@swemel.ru> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20240315093758.20790-1-arefev@swemel.ru
* mtd: parsers: ar7: remove supportWolfram Sang2023-10-193-135/+0
| | | | | | | | | | AR7 is going to be removed from the Kernel, so remove its support for MTD. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Acked-by: Florian Fainelli <f.fainelli@gmail.com> Acked-by: Miquel Raynal <miquel.raynal@bootlin.com> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
* Merge tag 'nand/for-6.4' into mtd/nextMiquel Raynal2023-04-191-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Raw NAND core changes: * Convert to platform remove callback returning void * Fix spelling mistake waifunc() -> waitfunc() Raw NAND controller driver changes: * imx: Remove unused is_imx51_nfc and imx53_nfc functions * omap2: Drop obsolete dependency on COMPILE_TEST * orion: Use devm_platform_ioremap_resource() * qcom: - Use of_property_present() for testing DT property presence - Use devm_platform_get_and_ioremap_resource() * stm32_fmc2: Depends on ARCH_STM32 instead of MACH_STM32MP157 * tmio: Remove reference to config MTD_NAND_TMIO in the parsers Raw NAND manufacturer driver changes: * hynix: Fix up bit 0 of sdr_timing_mode SPI-NAND changes: * Add support for ESMT F50x1G41LB Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
| * mtd: parsers: remove reference to config MTD_NAND_TMIOLukas Bulwahn2023-03-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Commit 568494db6809 ("mtd: remove tmio_nand driver") removes the config MTD_NAND_TMIO and its corresponding driver. Remove the reference in MTD_SHARPSL_PARTS to that removed config. Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20230307074038.17391-1-lukas.bulwahn@gmail.com
* | mtd: bcm63xxpart: remove MODULE_LICENSE in non-modulesNick Alcock2023-03-081-1/+0
|/ | | | | | | | | | | | | | | | | | | | | | | | | Since commit 8b41fc4454e ("kbuild: create modules.builtin without Makefile.modbuiltin or tristate.conf"), MODULE_LICENSE declarations are used to identify modules. As a consequence, uses of the macro in non-modules will cause modprobe to misidentify their containing object file as a module when it is not (false positives), and modprobe might succeed rather than failing with a suitable error message. So remove it in the files in this commit, none of which can be built as modules. Signed-off-by: Nick Alcock <nick.alcock@oracle.com> Suggested-by: Luis Chamberlain <mcgrof@kernel.org> Cc: Luis Chamberlain <mcgrof@kernel.org> Cc: linux-modules@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: Hitomi Hasegawa <hasegawa-hitomi@fujitsu.com> Cc: Miquel Raynal <miquel.raynal@bootlin.com> Cc: Richard Weinberger <richard@nod.at> Cc: Vignesh Raghavendra <vigneshr@ti.com> Cc: linux-mtd@lists.infradead.org Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20230224150811.80316-19-nick.alcock@oracle.com
* Merge tag 'spi-nor/for-6.3' into mtd/nextMiquel Raynal2023-02-232-2/+4
|\ | | | | | | | | SPI NOR changes: * small fixes on core and spansion driver.
| * mtd: parsers: scpart: fix __udivdi3 undefined on mipsMikhail Zhilkin2023-01-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes the following compile error on mips architecture with clang version 16.0.0 reported by the 0-DAY CI Kernel Test Service: ld.lld: error: undefined symbol: __udivdi3 referenced by scpart.c mtd/parsers/scpart.o:(scpart_parse) in archive drivers/built-in.a As a workaround this makes 'offs' a 32-bit type. This is enough, because the mtd containing partition table practically does not exceed 1 MB. We can revert this when the [Link] has been resolved. Link: https://github.com/ClangBuiltLinux/linux/issues/1635 Fixes: 9b78ef0c7997 ("mtd: parsers: add support for Sercomm partitions") Reported-by: kernel test robot <lkp@intel.com> Suggested-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/805fe58e-690f-6a3f-5ebf-2f6f6e6e4599@gmail.com
| * mtd: parsers: Fix potential memory leak in mtd_parser_tplink_safeloader_parse()Yuan Can2023-01-021-1/+3
| | | | | | | | | | | | | | | | | | | | | | The parts needs to be freed with all its elements, otherwise it will be leaked. Fixes: 00a3588084be ("mtd: parsers: add TP-Link SafeLoader partitions table parser") Signed-off-by: Yuan Can <yuancan@huawei.com> Reviewed-by: Dan Carpenter <error27@gmail.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20221208113620.78855-1-yuancan@huawei.com
* | mtd: parsers: ofpart: add workaround for #size-cells 0Francesco Dolcini2023-02-061-0/+19
|/ | | | | | | | | | | | | | | | | | | | Add a mechanism to handle the case in which partitions are present as direct child of the nand controller node and #size-cells is set to <0>. This could happen if the nand-controller node in the DTS is supposed to have #size-cells set to 0, but for some historical reason/bug it was set to 1 in the past, and the firmware (e.g. U-Boot) is adding the partition as direct children of the nand-controller defaulting to #size-cells being to 1. This prevents a real boot failure on colibri-imx7 that happened during v6.1 development cycles. Link: https://lore.kernel.org/all/Y4dgBTGNWpM6SQXI@francesco-nb.int.toradex.com/ Link: https://lore.kernel.org/all/20221202071900.1143950-1-francesco@dolcini.it/ Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20230124104444.330913-1-francesco@dolcini.it
* mtd: parsers: refer to ARCH_BCMBCA instead of ARCH_BCM4908Lukas Bulwahn2022-11-171-1/+1
| | | | | | | | | | | | | | | | | | | Commit dd5c672d7ca9 ("arm64: bcmbca: Merge ARCH_BCM4908 to ARCH_BCMBCA") removes config ARCH_BCM4908 as config ARCH_BCMBCA has the same intent. Probably due to concurrent development, commit 002181f5b150 ("mtd: parsers: add Broadcom's U-Boot parser") introduces 'Broadcom's U-Boot partition parser' that depends on ARCH_BCM4908, but this use was not visible during the config refactoring from the commit above. Hence, these two changes create a reference to a non-existing config symbol. Adjust the MTD_BRCM_U_BOOT definition to refer to ARCH_BCMBCA instead of ARCH_BCM4908 to remove the reference to the non-existing config symbol ARCH_BCM4908. Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20221116124932.4748-1-lukas.bulwahn@gmail.com
* dt-bindings: mtd: Remove useless file about partitionsMiquel Raynal2022-11-171-1/+1
| | | | | | | | | | | | | There is already a real partitions.yaml file, so assuming everybody knows hot to read yaml schema now, this text file is no longer needed, so drop it. Depending on the situation, the lines referring to this file are either dropped or edited to point to mtd.yaml which includes partition{,s}.yaml. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/linux-mtd/20221114090315.848208-3-miquel.raynal@bootlin.com
* mtd: parsers: tplink_safeloader: fix uninitialized variable bugDan Carpenter2022-11-071-3/+3
| | | | | | | | | | | | On 64 bit systems, the highest 32 bits of the "offset" variable are not initialized. Also the existing code is not endian safe (it will fail on big endian systems). Change the type of "offset" to a u32. Fixes: aec4d5f5ffd0 ("mtd: parsers: add TP-Link SafeLoader partitions table parser") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Rafał Miłecki <rafal@milecki.pl> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/Y1gCALFWXYYwqV1P@kili
* mtd: parsers: add TP-Link SafeLoader partitions table parserRafał Miłecki2022-11-073-0/+166
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This parser deals with most TP-Link home routers. It reads info about partitions and registers them in the MTD subsystem. Example from TP-Link Archer C5 V2: spi-nor spi0.0: s25fl128s1 (16384 Kbytes) 15 tplink-safeloader partitions found on MTD device spi0.0 Creating 15 MTD partitions on "spi0.0": 0x000000000000-0x000000040000 : "fs-uboot" 0x000000040000-0x000000440000 : "os-image" 0x000000440000-0x000000e40000 : "rootfs" 0x000000e40000-0x000000e40200 : "default-mac" 0x000000e40200-0x000000e40400 : "pin" 0x000000e40400-0x000000e40600 : "product-info" 0x000000e50000-0x000000e60000 : "partition-table" 0x000000e60000-0x000000e60200 : "soft-version" 0x000000e61000-0x000000e70000 : "support-list" 0x000000e70000-0x000000e80000 : "profile" 0x000000e80000-0x000000e90000 : "default-config" 0x000000e90000-0x000000ee0000 : "user-config" 0x000000ee0000-0x000000fe0000 : "log" 0x000000fe0000-0x000000ff0000 : "radio_bk" 0x000000ff0000-0x000001000000 : "radio" Signed-off-by: Rafał Miłecki <rafal@milecki.pl> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20221015092950.27467-2-zajec5@gmail.com
* mtd: parsers: bcm47xxpart: Fix halfblock readsLinus Walleij2022-10-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | There is some code in the parser that tries to read 0x8000 bytes into a block to "read in the middle" of the block. Well that only works if the block is also 0x10000 bytes all the time, else we get these parse errors as we reach the end of the flash: spi-nor spi0.0: mx25l1606e (2048 Kbytes) mtd_read error while parsing (offset: 0x200000): -22 mtd_read error while parsing (offset: 0x201000): -22 (...) Fix the code to do what I think was intended. Cc: stable@vger.kernel.org Fixes: f0501e81fbaa ("mtd: bcm47xxpart: alternative MAGIC for board_data partition") Cc: Rafał Miłecki <zajec5@gmail.com> Cc: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20221018091129.280026-1-linus.walleij@linaro.org
* Merge tag 'mtd/for-6.1' of ↵Linus Torvalds2022-10-074-2/+97
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux Pull MTD updates from Miquel Raynal: "Core MTD changes: - mtdchar: add MEMREAD ioctl - Add ECC error accounting for each read request - always initialize 'stats' in struct mtd_oob_ops - Track maximum number of bitflips for each read request - Fix repeated word in comment - Move from strlcpy with unused retval to strscpy - Fix a typo in a comment - Add binding for U-Boot bootloader partitions MTD device drivers changes: - FTL: use container_of() rather than cast - docg3: - Use correct function names in comment blocks - Check the return value of devm_ioremap() in the probe - physmap-core: Fix NULL pointer dereferencing in of_select_probe_type() - parsers: add Broadcom's U-Boot parser Raw NAND core changes: - Replace of_gpio_named_count() by gpiod_count() - Remove misguided comment of nand_get_device() - bbt: Use the bitmap API to allocate bitmaps Raw NAND controller drivers changes: - Meson: - Stop supporting legacy clocks - Refine resource getting in probe - Convert bindings to yaml - Fix clock handling and update the bindings accordingly - Fix bit map use in meson_nfc_ecc_correct() - bcm47xx: - Fix spelling typo in comment - STM32 FMC2: - Switch to using devm_fwnode_gpiod_get() - Fix dma_map_sg error check - Cadence: - Remove an unneeded result variable - Marvell: - Fix error handle regarding dma_map_sg - Orion: - Use devm_clk_get_optional() - Cafe: - Use correct function name in comment block - Atmel: - Unmap streaming DMA mappings - Arasan: - Stop using 0 as NULL pointer - GPMI: - Fix typo 'the the' in comment - BRCM: - Add individual glue driver selection - Move Kconfig to driver folder - FSL: Fix none ECC mode - Intel: - Use devm_platform_ioremap_resource_byname() - Remove unused clk_rate member from struct ebu_nand - Remove unused nand_pa member from ebu_nand_cs - Don't re-define NAND_DATA_IFACE_CHECK_ONLY - Remove undocumented compatible string - Fix compatible string in the bindings - Read the chip-select line from the correct OF node - Fix maximum chip select value in the bindings" * tag 'mtd/for-6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux: (43 commits) mtd: rawnand: meson: stop supporting legacy clocks dt-bindings: nand: meson: convert txt to yaml mtd: rawnand: meson: refine resource getting in probe mtd: rawnand: meson: fix the clock dt-bindings: nand: meson: fix meson nfc clock mtd: rawnand: bcm47xx: fix spelling typo in comment mtd: rawnand: stm32_fmc2: switch to using devm_fwnode_gpiod_get() mtd: rawnand: cadence: Remove an unneeded result variable mtd: rawnand: Replace of_gpio_named_count() by gpiod_count() mtd: rawnand: marvell: Fix error handle regarding dma_map_sg mtd: rawnand: stm32_fmc2: Fix dma_map_sg error check mtd: rawnand: remove misguided comment of nand_get_device() mtd: rawnand: orion: Use devm_clk_get_optional() mtd: rawnand: cafe: Use correct function name in comment block mtd: rawnand: atmel: Unmap streaming DMA mappings mtd: rawnand: meson: fix bit map use in meson_nfc_ecc_correct() mtd: rawnand: arasan: stop using 0 as NULL pointer mtd: rawnand: gpmi: Fix typo 'the the' in comment mtd: rawnand: brcmnand: Add individual glue driver selection mtd: rawnand: brcmnand: Move Kconfig to driver folder ...
| * mtd: move from strlcpy with unused retval to strscpyWolfram Sang2022-09-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | Follow the advice of the below link and prefer 'strscpy' in this subsystem. Conversion is 1:1 because the return value is not used. Generated by a coccinelle script. Link: https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/ Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20220818210033.7084-1-wsa+renesas@sang-engineering.com
| * mtd: parsers: add Broadcom's U-Boot parserRafał Miłecki2022-09-193-0/+95
| | | | | | | | | | | | | | | | | | Broadcom stores environment variables blocks inside U-Boot partition itself. This driver finds & registers them. Signed-off-by: Rafał Miłecki <rafal@milecki.pl> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20220711153041.6036-2-zajec5@gmail.com
* | arm64: bcmbca: Make BCM4908 drivers depend on ARCH_BCMBCAWilliam Zhang2022-08-151-3/+3
|/ | | | | | | | | | | | | | With Broadcom Broadband arch ARCH_BCMBCA supported in the kernel, this patch series migrate the ARCH_BCM4908 symbol to ARCH_BCMBCA. Hence replace ARCH_BCM4908 with ARCH_BCMBCA in subsystem Kconfig files. Signed-off-by: William Zhang <william.zhang@broadcom.com> Acked-by: Guenter Roeck <linux@roeck-us.net> (for watchdog) Acked-by: Bjorn Helgaas <bhelgaas@google.com> (for drivers/pci) Acked-by: Wolfram Sang <wsa@kernel.org> (for i2c) Acked-by: Philipp Zabel <p.zabel@pengutronix.de> (for reset) Link: https://lore.kernel.org/r/20220803175455.47638-7-william.zhang@broadcom.com Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
* mtd: parsers: scpart: add missing of_node_put() in scpart_parse()Yang Yingliang2022-06-171-0/+1
| | | | | | | | | | | of_get_child_by_name() will increase the refcount of 'ofpart_node', so add of_node_put() after using it to avoid refcount leak. Fixes: 9b78ef0c7997 ("mtd: parsers: add support for Sercomm partitions") Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20220617014008.851583-1-yangyingliang@huawei.com
* mtd: parsers: ofpart: Fix refcount leak in bcm4908_partitions_fw_offsetMiaoqian Lin2022-06-091-0/+3
| | | | | | | | | | | of_find_node_by_path() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: bb17230c61a6 ("mtd: parsers: ofpart: support BCM4908 fixed partitions") Signed-off-by: Miaoqian Lin <linmq006@gmail.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20220605070726.5979-1-linmq006@gmail.com
* mtd: parsers: add support for Sercomm partitionsMikhail Zhilkin2022-06-093-0/+258
| | | | | | | | | | | | | | | | | This adds an MTD partition parser for the Sercomm partition table that is used in some Beeline, Netgear and Sercomm routers. The Sercomm partition map table contains real partition offsets, which may differ from device to device depending on the number and location of bad blocks on NAND. Original patch (proposed by NOGUCHI Hiroshi): Link: https://github.com/openwrt/openwrt/pull/1318#issuecomment-420607394 Signed-off-by: NOGUCHI Hiroshi <drvlabo@gmail.com> Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20220529110714.189732-1-csharper2005@gmail.com
* mtd: partitions: Fix refcount leak in parse_redboot_ofMiaoqian Lin2022-06-091-0/+1
| | | | | | | | | | | | of_get_child_by_name() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: 237960880960 ("mtd: partitions: redboot: seek fis-index-block in the right node") Signed-off-by: Miaoqian Lin <linmq006@gmail.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20220526110652.64849-1-linmq006@gmail.com
* mtd: parsers: bcm47xxpart: print correct offset on read errorRafał Miłecki2022-04-041-1/+1
| | | | | | | | | mtd_read() gets called with offset + 0x8000 as argument so use the same value in pr_err(). Signed-off-by: Rafał Miłecki <rafal@milecki.pl> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20220317114316.29827-1-zajec5@gmail.com
* Merge tag 'spi-nor/for-5.18' into mtd/nextMiquel Raynal2022-03-181-13/+23
|\ | | | | | | | | | | | | | | | | | | | | SPI NOR core changes: - move vendor specific code out of the core into vendor drivers. - unify all function and object names in the vendor modules. - make setup() callback optional to improve readability. - skip erase logic when the SPI_NOR_NO_ERASE flag is set at flash declaration. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
| * mtd: parsers: qcom: Fix missing free for pparts in cleanupAnsuel Smith2022-01-251-0/+2
| | | | | | | | | | | | | | | | | | | | | | Mtdpart doesn't free pparts when a cleanup function is declared. Add missing free for pparts in cleanup function for smem to fix the leak. Fixes: 10f3b4d79958 ("mtd: parsers: qcom: Fix leaking of partition name") Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20220116032211.9728-2-ansuelsmth@gmail.com
| * mtd: parsers: qcom: Fix kernel panic on skipped partitionAnsuel Smith2022-01-251-12/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the event of a skipped partition (case when the entry name is empty) the kernel panics in the cleanup function as the name entry is NULL. Rework the parser logic by first checking the real partition number and then allocate the space and set the data for the valid partitions. The logic was also fundamentally wrong as with a skipped partition, the parts number returned was incorrect by not decreasing it for the skipped partitions. Fixes: 803eb124e1a6 ("mtd: parsers: Add Qcom SMEM parser") Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20220116032211.9728-1-ansuelsmth@gmail.com
| * mtd: parsers: qcom: Don't print error message on -EPROBE_DEFERBryan O'Donoghue2022-01-251-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Its possible for the main smem driver to not be loaded by the time we come along to parse the smem partition description but, this is a perfectly normal thing. No need to print out an error message in this case. Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Reviewed-by: Manivannan Sadhasivam <mani@kernel.org> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20220103030316.58301-3-bryan.odonoghue@linaro.org
* | mtd: parsers: trx: allow to use on MediaTek MIPS SoCsINAGAKI Hiroshi2022-02-181-1/+1
|/ | | | | | | | | | | | | | | | Buffalo sells some router devices which have trx-formatted firmware, based on MediaTek MIPS SoCs. To use parser_trx on those devices, add "RALINK" to dependency and allow to compile for MediaTek MIPS SoCs. examples: - WCR-1166DS (MT7628) - WSR-1166DHP (MT7621) - WSR-2533DHP (MT7621) Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20220213064045.1781-1-musashino.open@gmail.com
* Merge tag 'mtd/for-5.14' of ↵Linus Torvalds2021-07-054-38/+59
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux Pull MTD updates from Richard Weinberger: "MTD core changes: - Convert list_for_each to entry variant - Use MTD_DEVICE_ATTR_RO/RW() helper macros - Remove unnecessary OOM messages - Potential NULL dereference in mtd_otp_size() - Fix freeing of otp_info buffer - Create partname and partid debug files for child MTDs - tests: - Remove redundant assignment to err - Fix error return code in mtd_oobtest_init() - Add OTP NVMEM provider support - Allow specifying of_node - Convert sysfs sprintf/snprintf family to sysfs_emit Bindings changes: - Convert ti,am654-hbmc.txt to YAML schema - spi-nor: add otp property - Add OTP bindings - add YAML schema for the generic MTD bindings - Add brcm,trx-magic MTD device drivers changes: - Add support for microchip 48l640 EERAM - Remove superfluous "break" - sm_ftl: - Fix alignment of block comment - nftl: - Return -ENOMEM when kmalloc failed - nftlcore: - Remove set but rewrite variables - phram: - Fix error return code in phram_setup() - plat-ram: - Remove redundant dev_err call in platram_probe() MTD parsers changes: - Qcom: - Fix leaking of partition name - Redboot: - Fix style issues - Seek fis-index-block in the right node - trx: - Allow to use TRX parser on Mediatek SoCs - Allow to specify brcm, trx-magic in DT Raw NAND core: - Allow SDR timings to be nacked - Bring support for NV-DDR timings which involved a number of small preparation changes to bring new helpers, properly introduce NV-DDR structures, fill them, differenciate them and pick the best timing set. - Add the necessary infrastructure to parse the new gpio-cs property which aims at enlarging the number of available CS when a hardware controller is too constrained. - Update dead URL - Silence static checker warning in nand_setup_interface() - BBT: - Fix corner case in bad block table handling - onfi: - Use more recent ONFI specification wording - Use the BIT() macro when possible Raw NAND controller drivers: - Atmel: - Ensure the data interface is supported. - Arasan: - Finer grain NV-DDR configuration - Rename the data interface register - Use the right DMA mask - Leverage additional GPIO CS - Ensure proper configuration for the asserted target - Add support for the NV-DDR interface - Fix a macro parameter - brcmnand: - Convert bindings to json-schema - OMAP: - Various fixes and style improvements - Add larger page NAND chips support - PL35X: - New driver - QCOM: - Avoid writing to obsolete register - Delete an unneeded bool conversion - Allow override of partition parser - Marvell: - Minor documentation correction - Add missing clk_disable_unprepare() on error in marvell_nfc_resume() - R852: - Use DEVICE_ATTR_RO() helper macro - MTK: - Remove redundant dev_err call in mtk_ecc_probe() - HISI504: - Remove redundant dev_err call in probe SPI-NAND core: - Light reorganisation for the introduction of a core resume handler - Fix double counting of ECC stats SPI-NAND manufacturer drivers: - Macronix: - Add support for serial NAND flash SPI NOR core changes: - Ability to dump SFDP tables via sysfs - Support for erasing OTP regions on Winbond and similar flashes - Few API doc updates and fixes - Locking support for MX25L12805D SPI NOR controller drivers changes: - Use SPI_MODE_X_MASK in nxp-spifi - Intel Alder Lake-M SPI serial flash support" * tag 'mtd/for-5.14' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux: (125 commits) mtd: spi-nor: remove redundant continue statement mtd: rawnand: omap: Add larger page NAND chips support mtd: rawnand: omap: Various style fixes mtd: rawnand: omap: Check return values mtd: rawnand: omap: Rename a macro mtd: rawnand: omap: Aggregate the HW configuration of the ELM mtd: rawnand: pl353: Add support for the ARM PL353 SMC NAND controller dt-bindings: mtd: pl353-nand: Describe this hardware controller MAINTAINERS: Add PL353 NAND controller entry mtd: rawnand: qcom: avoid writing to obsolete register mtd: rawnand: marvell: Minor documentation correction mtd: rawnand: r852: use DEVICE_ATTR_RO() helper macro mtd: spinand: add SPI-NAND MTD resume handler mtd: spinand: Add spinand_init_flash() helper mtd: spinand: add spinand_read_cfg() helper mtd: rawnand: marvell: add missing clk_disable_unprepare() on error in marvell_nfc_resume() mtd: rawnand: arasan: Finer grain NV-DDR configuration mtd: rawnand: arasan: Rename the data interface register mtd: rawnand: onfi: Fix endianness when reading NV-DDR values mtd: rawnand: arasan: Use the right DMA mask ...
| * mtd: parsers: qcom: Fix leaking of partition nameAnsuel Smith2021-05-261-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add cleanup function as the name variable for the partition name was allocaed but never freed after the use as the add mtd function duplicate the name and free the pparts struct as the partition name is assumed to be static. The leak was found using kmemleak. Fixes: 803eb124e1a6 ("mtd: parsers: Add Qcom SMEM parser") Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210525230931.30013-1-ansuelsmth@gmail.com
| * mtd: partitions: redboot: fix style issuesCorentin Labbe2021-05-261-35/+34
| | | | | | | | | | | | | | | | | | This patch fixes easy checkpatch issues. Signed-off-by: Corentin Labbe <clabbe@baylibre.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210520114851.1274609-2-clabbe@baylibre.com
| * mtd: partitions: redboot: seek fis-index-block in the right nodeCorentin Labbe2021-05-261-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | fis-index-block is seeked in the master node and not in the partitions node. For following binding and current usage, the driver need to check the partitions subnode. Fixes: c0e118c8a1a3 ("mtd: partitions: Add OF support to RedBoot partitions") Signed-off-by: Corentin Labbe <clabbe@baylibre.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210520114851.1274609-1-clabbe@baylibre.com
| * mtd: parsers: trx: Allow to use TRX parser on Mediatek SoCsHauke Mehrtens2021-05-101-1/+1
| | | | | | | | | | | | | | | | Buffalo uses the TRX partition format also on Mediatek MT7622 SoCs. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210418214616.239574-4-hauke@hauke-m.de
| * mtd: parsers: trx: Allow to specify brcm, trx-magic in DTHauke Mehrtens2021-05-101-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | Buffalo uses a different TRX magic for every device, to be able to use this trx parser, make it possible to specify the TRX magic in device tree. If no TRX magic is specified in device tree, the standard value will be used. This value should only be specified if a vendor chooses to use a non standard TRX magic. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210418214616.239574-3-hauke@hauke-m.de
* | mtd: parsers: ofpart: fix parsing subpartitionsRafał Miłecki2021-05-101-12/+14
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ofpart was recently patched to not scan random partition nodes as subpartitions. That change unfortunately broke scanning valid subpartitions like: partitions { compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; partition@0 { compatible = "fixed-partitions"; label = "bootloader"; reg = <0x0 0x100000>; partition@0 { label = "config"; reg = <0x80000 0x80000>; }; }; }; Fix that regression by adding 1 more code path. We actually need 3 conditional blocks to support 3 possible cases. This change also makes code easier to understand & follow. Reported-by: David Bauer <mail@david-bauer.net> Fixes: 2d751203aacf ("mtd: parsers: ofpart: limit parsing of deprecated DT syntax Signed-off-by: Rafał Miłecki <rafal@milecki.pl> Tested-by: Andrew Cameron <apcameron@softhome.net> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210508173214.28365-1-zajec5@gmail.com
* mtd: parsers: ofpart: support Linksys Northstar partitionsRafał Miłecki2021-03-285-0/+85
| | | | | | | | | This allows extending ofpart parser with support for Linksys Northstar devices. That support uses recently added quirks mechanism. Signed-off-by: Rafał Miłecki <rafal@milecki.pl> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210312134919.7767-2-zajec5@gmail.com
* mtd: parsers: ofpart: make symbol 'bcm4908_partitions_quirks' staticWei Yongjun2021-03-111-1/+1
| | | | | | | | | | | | | | | | The sparse tool complains as follows: drivers/mtd/parsers/ofpart_core.c:25:32: warning: symbol 'bcm4908_partitions_quirks' was not declared. Should it be static? This symbol is not used outside of ofpart_core.c, so this commit marks it static. Fixes: 457da931b608 ("mtd: parsers: ofpart: support BCM4908 fixed partitions") Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210304064600.3279138-1-weiyongjun1@huawei.com
* mtd: parsers: qcom: incompatible with spi-nor 4k sectorsBaruch Siach2021-03-111-0/+7
| | | | | | | | | | | | Partition size and offset value are in block size units, which is the same as 'erasesize'. But when 4K sectors are enabled erasesize is set to 4K. Bail out in that case. Fixes: 803eb124e1a64 ("mtd: parsers: Add Qcom SMEM parser") Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by: Baruch Siach <baruch@tkos.co.il> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/0a2611f885b894274436ded3ca78bc0440fca74a.1614790096.git.baruch@tkos.co.il
* mtd: parsers: qcom: Fix error conditionMiquel Raynal2021-03-111-1/+1
| | | | | | | | | | | | | | | | | qcom_smem_get() does not return NULL, and even if it did, the NULL condition is usually not an error but a success condition and should not trigger an error trace. Let's replace IS_ERR_OR_NULL() by IS_ERR(). This fixes the following smatch warning: drivers/mtd/parsers/qcomsmempart.c:109 parse_qcomsmem_part() warn: passing zero to 'PTR_ERR' Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Fixes: 803eb124e1a6 ("mtd: parsers: Add Qcom SMEM parser") Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210303084634.12796-1-miquel.raynal@bootlin.com
* mtd: parsers: ofpart: limit parsing of deprecated DT syntaxRafał Miłecki2021-03-111-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For backward compatibility ofpart still supports the old syntax like: spi-flash@0 { compatible = "jedec,spi-nor"; reg = <0x0>; partition@0 { label = "bootloader"; reg = <0x0 0x100000>; }; }; (without "partitions" subnode). There is no reason however to support nested partitions without a clear "compatible" string like: partitions { compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; partition@0 { label = "bootloader"; reg = <0x0 0x100000>; partition@0 { label = "config"; reg = <0x80000 0x80000>; }; }; }; (we never officially supported or documented that). Make sure ofpart doesn't attempt to parse above. Cc: Ansuel Smith <ansuelsmth@gmail.com> Signed-off-by: Rafał Miłecki <rafal@milecki.pl> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210302190012.1255-1-zajec5@gmail.com
* mtd: parsers: ofpart: support BCM4908 fixed partitionsRafał Miłecki2021-03-115-2/+116
| | | | | | | | | | | | | | | | | | Some devices use fixed partitioning with some partitions requiring some extra logic. E.g. BCM4908 may have multiple firmware partitions but detecting currently used one requires checking bootloader parameters. To support such cases without duplicating a lot of code (without copying most of the ofpart.c code) support for post-parsing callback was added. BCM4908 support in ofpart can be enabled using config option and results in compiling & executing a specific callback. It simply reads offset of currently used firmware partition from the DT. Bootloader specifies it using the "brcm_blparms" property. Signed-off-by: Rafał Miłecki <rafal@milecki.pl> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210301105823.31032-1-zajec5@gmail.com
* mtd: parsers: extend Qcom SMEM parser to SPI flashBaruch Siach2021-03-111-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Qcom MIBIB partition might be stored on SPI flash devices, and the parser works in this case just as well: [ 1.404229] spi_qup 78b5000.spi: IN:block:16, fifo:64, OUT:block:16, fifo:64 [ 1.408078] spi-nor spi0.0: found mx25u6435f, expected n25q128a11 [ 1.415016] spi-nor spi0.0: mx25u6435f (8192 Kbytes) [ 1.420756] 12 qcomsmem partitions found on MTD device spi0.0 [ 1.425739] Creating 12 MTD partitions on "spi0.0": [ 1.431381] 0x000000000000-0x00000000c000 : "0:sbl1" [ 1.437058] 0x00000000c000-0x00000000d000 : "0:mibib" [ 1.442143] 0x00000000d000-0x000000027000 : "0:qsee" [ 1.447057] 0x000000027000-0x000000028000 : "0:devcfg" [ 1.452088] 0x000000028000-0x00000002a000 : "0:rpm" [ 1.457065] 0x00000002a000-0x00000002b000 : "0:cdt" [ 1.461832] 0x00000002b000-0x00000002c000 : "0:appsblenv" [ 1.466736] 0x00000002c000-0x000000036000 : "0:appsbl" [ 1.472248] 0x000000036000-0x00000003a000 : "0:art" [ 1.477297] 0x00000003a000-0x00000003e000 : "config" [ 1.482047] 0x00000003e000-0x00000004e000 : "data" [ 1.487257] 0x00000004e000-0x000000200000 : "0:hlos" Remove dependency on MTD_NAND_QCOM. Update the Kconfig prompt and help text accordingly. Cc: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by: Baruch Siach <baruch@tkos.co.il> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/7f558e888a41c5b1fd4ca0427b3976531c51a876.1614080824.git.baruch@tkos.co.il
* Merge tag 'nand/for-5.12' of ↵Richard Weinberger2021-02-103-0/+179
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux into mtd/next Raw NAND controller drivers: * Intel: Fix an error handling path in 'ebu_dma_start()' * Tango: Remove the driver * Marvell: Convert comma to semicolon * MXC: Convert comma to semicolon * Qcom: Add support for Qcom SMEM parser Related MTD changes: * parsers: Add Qcom SMEM parser
| * mtd: parsers: Add Qcom SMEM parserManivannan Sadhasivam2021-01-043-0/+179
| | | | | | | | | | | | | | | | | | | | NAND based Qualcomm platforms have the partition table populated in the Shared Memory (SMEM). Hence, add a parser for parsing the partitions from it. Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210104041137.113075-3-manivannan.sadhasivam@linaro.org
* | mtd: parsers: afs: Fix freeing the part name memory in failureManivannan Sadhasivam2021-02-011-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In the case of failure while parsing the partitions, the iterator should be pre decremented by one before starting to free the memory allocated by kstrdup(). Because in the failure case, kstrdup() will not succeed and thus no memory will be allocated for the current iteration. Fixes: 1fca1f6abb38 ("mtd: afs: simplify partition parsing") Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Cc: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210104041137.113075-5-manivannan.sadhasivam@linaro.org
* | mtd: parser: imagetag: fix error codes in bcm963xx_parse_imagetag_partitions()Dan Carpenter2021-01-281-0/+4
|/ | | | | | | | | | If the kstrtouint() calls fail, then this should return a negative error code but it currently returns success. Fixes: dd84cb022b31 ("mtd: bcm63xxpart: move imagetag parsing to its own parser") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/YBKFtNaFHGYBj+u4@mwanda