summaryrefslogtreecommitdiffstats
path: root/drivers/mtd
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'for-next/spdx'Sascha Hauer2021-11-1561-368/+65
|\
| * drivers: add missing SPDX-License-IdentifierAhmad Fatoum2021-11-0161-368/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds the suitable SPDX-License-Identifier to all files in drivers/ that previously lacked one. To aid manual inspection, following heuristics can be used: * No changes outside of comments/whitespace: git show -U0 HEAD | rg -v '^(@@|diff|index)|[-+]([-+]|//|#|[\s/]\*)' * -or-later come in pairs: git show --inter-hunk-context=19 HEAD | \ perl -0777 -F'/^@/gm' -ne 'for (@F) { @m = /later/g; print if @m & 1 }' Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20211030175632.2276077-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mtd: remove NULLness check for IOMEM()Ahmad Fatoum2021-11-012-18/+0
|/ | | | | | | | | While ioremap can fail, IOMEM() in our identity-mapped barebox can't. Thus remove the never entered error branches. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20211030175812.2276705-6-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2021-10-071-11/+11
|\
| * mtd: core: fix whitespacesAntony Pavlov2021-10-051-11/+11
| | | | | | | | | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Link: https://lore.barebox.org/20211004091550.42289-1-antonynpavlov@gmail.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | nand: add NXP IFC nand driverRenaud Barbier2021-08-234-0/+1162
|/ | | | | | | | | | | Add the NXP IFC nand driver support. This driver can be used with the NXP QorIQ cores. Originally, derived from U-boot commit cce573e (2015-10) Signed-off-by: Renaud Barbier <renaud.barbier@abaco.com> Link: https://lore.barebox.org/1628842608-17031-3-git-send-email-renaud.barbier@abaco.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: nand: provide helpful error message when trying disabled ecc modeEnrico Jorns2021-07-091-0/+1
| | | | | | | | | | | | We know the reason to return -ENOSYS, thus let the user know. This will give him a much better hint why his NAND is not working than only getting the generic | probe failed: Function not implemented Signed-off-by: Enrico Jorns <ejo@pengutronix.de> Link: https://lore.barebox.org/20210708112629.19243-1-ejo@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/imx'Sascha Hauer2021-06-161-2/+15
|\
| * mtd: nand: Add help text for i.MX NAND controllersTrent Piepho2021-05-311-2/+15
| | | | | | | | | | | | | | | | | | | | There are two different NAND drivers, used for different chips in the i.MX range. It's quite confusing as to which to use. Add some help text to clarify. Signed-off-by: Trent Piepho <tpiepho@gmail.com> Link: https://lore.barebox.org/20210527083741.789109-1-tpiepho@gmail.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/compiler-warnings'Sascha Hauer2021-06-161-1/+8
|\ \ | |/ |/|
| * mtd: cfi-flash: Fix compiler warningSascha Hauer2021-05-181-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | sector >= 0 is always true for the unsigned type flash_sect_t. This means the loop to find the sector will only behave correctly when we actually find the sector, but not in the error case. The error case is not expected though and will not happen when the code is correct, so just catch it with a BUG(). Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20210517185424.32145-7-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mtd: spi-nor: Add support for gd25q16Michael Olbrich2021-05-251-0/+1
|/ | | | | | | | | | | | The entry is imported from Linux v5.12. It can befound on new versions of the Boundary Devices i.MX6 Quad Nitrogen6x boards. Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de> Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210520154929.25131-1-m.olbrich@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/imx'Sascha Hauer2021-05-171-3/+1
|\
| * mtd: nand: mxs: Enable edo mode switching for i.MX28Sascha Hauer2021-05-041-3/+1
| | | | | | | | | | | | Without it we will never use the faster timing modes. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Revert "mtd: nand_bbt: Skip bad blocks when searching for the BBT in NAND"Sascha Hauer2021-05-071-4/+0
|/ | | | | | | | | | This reverts commit 94f2da7d81cfd83685af24967e89347e7aea2ccb. Patch is reverted in Linux because it caused a regression on i.MX27, see http://lists.infradead.org/pipermail/linux-mtd/2021-April/086124.html Do the same for barebox. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2021-04-155-5/+9
|\
| * mtd: nand_bbt: Skip bad blocks when searching for the BBT in NANDStefan Riedmueller2021-04-141-0/+4
| | | | | | | | | | | | | | | | | | The blocks containing the bad block table can become bad as well. So make sure to skip any blocks that are marked bad when searching for the bad block table. Signed-off-by: Stefan Riedmueller <s.riedmueller@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mtd: fix possible overflow during mtd size multiplicationAhmad Fatoum2021-03-254-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | LGTM[1] flags a couple of places where we write a 32-bit multiplication result into a 64-bit destination. While it might very well be that there are more places in need of fixing to support flashes bigger than 4G, fixing these issues is easy and reduces the noise. Do so. [1]: https://lgtm.com/projects/g/saschahauer/barebox/alerts/?mode=list Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mtd: nand: mxs-nand: set oob layout earlierSascha Hauer2021-04-121-2/+2
| | | | | | | | | | | | | | | | | | The mtd layout must be set before calling nand_scan_tail() because it would set a standard layout otherwise. This standard layout is always wrong and in some cases doesn't even exist in which case the nand support bails out with an error. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mtd: nand_msx: Implement ooblayout opsStefan Riedmueller2021-04-011-0/+29
|/ | | | | | | | | | | | The default ooblayout ops do not work on nand_mxs devices and can lead to an unresponsible system when doing a 'nand -i' on that device. Thus implement the ooblayout ops for the nand_mxs driver separately. Since writing the oob area is not supported simply return the whole oob area as ecc. Signed-off-by: Stefan Riedmueller <s.riedmueller@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2021-03-232-1/+8
|\
| * mtd: Notify user when erasure of a block failed during erase opStefan Riedmueller2021-03-171-1/+4
| | | | | | | | | | | | | | | | Give the user information about the faulty block when an erase operation fails with error. Signed-off-by: Stefan Riedmueller <s.riedmueller@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mtd: cfi-flash: fail gracefully instead of crashing on NULL pageAhmad Fatoum2021-03-011-0/+4
| | | | | | | | | | | | | | | | | | Until this is fixed, add a comment and have the driver return with an error instead of crashing on null pointer dereference if it's mapped to zero. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | nand: nand-mxs: Fix marking BBT blocks as badStefan Riedmueller2021-03-221-53/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently the nand-mxs driver uses a hook function to the mtd->_block_markbad function to allow write access to the OOB bytes only if it is to mark a block as bad. This hook is not called when a Bad Block Table block is marked bad since this routine directly calls nand_markbad_bbm. The chip->legacy.block_markbad hook gives a driver the ability to implement a custom block_markbad function. Since this is used by nand_markbad_bbm, if it exists, replace the mtd->_block_markbad hook by a chip->legacy.block_markbad function. The gpmi-nand Linux implementation of this driver uses the same mechanism. This fixes an issue where marking Bad Block Table blocks as bad fails with: NXS NAND: Writing OOB isn't supported Tested on PHYTEC phyCORE-i.MX 6Q. Signed-off-by: Stefan Riedmueller <s.riedmueller@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mtd: nand: fix hardware ECC support in atmel_nand driverEdoardo Scaglia2021-02-241-4/+2
|/ | | | | | | | | | | | | | | | | | | | | When using a NAND memory with hardware ECC enabled on a Atmel SoC probing fails during barebox boot with following error: nand_base: device found, Manufacturer ID: 0x2c, Chip ID: 0xdc nand_base: Micron MT29F4G08ABAEAWP nand_base: 512 MiB, SLC, erase size: 256 KiB, page size: 4096, OOB size: 224 WARNING: at drivers/mtd/nand/nand_base.c:5594/nand_scan_tail()! WARNING: No oob scheme defined for oobsize 224 atmel_nand atmel_nand0: probe failed: No such device or address The problem arises from commit b6bcd96de5a75bdc5d06a06f2efffc2d89e346ec which among several changes dropped CONFIG_NAND_ECC_HW symbol, however two references remained in atmel_nand driver causing the failure of NAND probing when hardware ECC is configured in a Atmel SoC. Fixes: b6bcd96de5 ("mtd: nand: Update to Linux-5.9") Signed-off-by: Edoardo Scaglia <scaglia@amelchem.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/mtd'Sascha Hauer2021-02-221-2/+4
|\
| * mtd: nand: Fix BBT update issueYoshio Furuyama2021-02-171-2/+4
| | | | | | | | | | | | | | | | | | | | | | Fixed issue of manages BBT (Bad Block Table). It didn't mark correctly when a specific block was bad block. This issue occurs when the bad block mark (3-bit chunk) is crosses over 32 bit (e.g. Block10, Block21...) unit. Signed-off-by: Yoshio Furuyama <ytc-mb-yfuruyama7@kioxia.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/asm-io'Sascha Hauer2021-02-221-5/+5
|\ \
| * | printk: port over Linux print_hex_dump_bytes/print_hex_dump_debugAhmad Fatoum2021-02-041-5/+5
| |/ | | | | | | | | | | | | | | | | print_hex_dump in barebox always prints a hex dump. Most users use it for debugging though, so import Linux helpers to do so to cut down on the #ifdef DEBUG. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | drivers: replaces references to <asm-generic/*.h>Ahmad Fatoum2021-02-191-1/+1
| | | | | | | | | | | | | | | | | | With <linux/math64.h> included for do_div instead of <asm-generic/div.h>, there remains only 3 references to asm-generic headers in drivers/. Fix them up. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | treewide: include <linux/math64.h> wrapper instead of <asm-generic/div64.h>Ahmad Fatoum2021-02-193-3/+3
|/ | | | | | | | | | | <asm-generic/div64.h> isn't meant for direct usage as <asm/div64.h> may override this on a per-architecture basis. We don't do that currently, but in the future we might. Include the <linux/math64.h> instead. No functional change. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: nand: omap_gpmc: Fix wrong length check for realSascha Hauer2021-01-251-1/+1
| | | | | | | | Check for length > 0 because otherwise len may become smaller than 0 in which case the loop never ends. Reported-by: Alexander Shiyan <eagle.alexander923@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: nand: fix NAND_ECC_HW modeSascha Hauer2021-01-141-17/+18
| | | | | | | | | | | 6748f466a3 made NAND_ECC_HW_SYNDROME mode optional by bailing out with -ENOSYS when the mode is not enabled in Kconfig. Unfortunately with NAND_ECC_HW mode the code falls through to this test, so with NAND_ECC_HW_SYNDROME support disabled NAND_ECC_HW stopped working as well. Fix this. fixes: 6748f466a3 ("mtd: nand: Make support for syndrome hardware ecc optional") Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd:nand_mxs: Add missing includeSascha Hauer2021-01-071-0/+2
| | | | | | | Add include missing in last commit. Fixes: 616d942c3e mtd:nand_mxs:update get/set features legacy function call Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd:nand_mxs:update get/set features legacy function calljameszxj2021-01-071-4/+2
| | | | | | | update get/set features legacy function call to avoid NULL pointer crash. Signed-off-by: zhengxiaojun <jameszxj at gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/mtd'Sascha Hauer2020-12-116-4/+118
|\
| * mtd: nand: Make software ECC support optionalSascha Hauer2020-12-112-0/+8
| | | | | | | | | | | | | | Most NAND controllers use hardware ECC, so make software ECC support optional to save some binary space. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mtd: nand: Make support for syndrome hardware ecc optionalSascha Hauer2020-12-112-0/+8
| | | | | | | | | | | | | | | | | | NAND_ECC_HW_SYNDROME is currently not needed by the drivers in barebox, so make support for it optional again. This has been optional before the last NAND layer update, just re-add the option. This time drop the "default y", as this option shouldn't be needed. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mtd: spi-nor: Make write support optionalSascha Hauer2020-12-111-0/+9
| | | | | | | | | | | | | | Write support is optional with the CONFIG_MTD_WRITE option. Bail out early in the write functions to save some binary space. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mtd: nand: omap: Bail out when omap_gpmc_eccmode() failsSascha Hauer2020-12-111-1/+3
| | | | | | | | | | | | | | The driver can't work when omap_gpmc_eccmode() fails, so do not ignore the error. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mtd: nand: omap: print error when ELM config failedSascha Hauer2020-12-111-1/+4
| | | | | | | | | | | | | | ELM config can fail when ELM support is disabled. Let the user know about it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mtd: nand: denali: cope with kernel device trees without chip subnodesSascha Hauer2020-11-251-0/+57
| | | | | | | | | | | | | | | | | | The Denali binding for the Kernel has evolved over time. Recent Kernels need NAND chip subnodes in the controller node which then hold the partition nodes. Older Kernels need the partition nodes directly under the controller node. Cope with both kernel types. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mtd: Add hook to fix up kernel partitionsSascha Hauer2020-11-251-1/+29
| | | | | | | | | | | | | | | | Some drivers have special requirements for fixing up the partition nodes for the kernel. This adds a hook to struct mtd_info that can be used by drivers to replace the generic fixup with a special one. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mtd: Remove set but not used of_pathSascha Hauer2020-11-251-1/+0
| | | | | | | | | | | | struct mtd_info member of_path is set but not used, remove it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mtd: nand: Make write support optionalSascha Hauer2020-12-112-4/+51
| | | | | | | | | | | | | | | | | | NAND write support used to be optional and the correspoding CONFIG_MTD_WRITE option still exists. Bail out early from the write functions when CONFIG_MTD_WRITE is disabled like we used to before the last NAND layer update. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | nand: omap: Fix BCH16 readSascha Hauer2020-12-111-4/+11
| | | | | | | | | | | | | | | | | | | | When reading in BCH16 mode the ECC for the first 512 byte fails. I am pretty sure this must have worked once and I can't see why it doesn't now. Change reading in BCH16 mode to the same way as the kernel driver does: Instead of using wrap mode 4 to skip ECC when reading the first OOB bytes, just use wrap mode 1 and skip reading the first OOB bytes. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mtd: nand: Allow non page aligned length writesSascha Hauer2020-12-111-1/+1
|/ | | | | | | | | When copying images to nand with plain cp it can happen that the length of the image is not page aligned. Allow misaligned image lengths as we used to before the last NAND layer update. Fixes: b6bcd96de5 ("mtd: nand: Update to Linux-5.9") Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: nand-imx: fix passing pointer of wrong type on NAND_CMD_READOOBAhmad Fatoum2020-11-131-1/+1
| | | | | | | | | | | | copy_spare used to take a mtd_info, but since 5f605dc6168c ("mtd: nand: Pass struct nand_chip around") it now takes a nand_chip. 3588d40c5385 ("mtd: nand-imx: repair reading the oob area") was drafted in parallel and still passes a mtd_info. Their merge did not adjust this, triggering a compiler warning and undefined behavior. Fix this. Fixes: 7b1d8b4b3561 ("Merge branch 'for-next/mtd-nand'") Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: nand: Fix dependeny on CONFIG_NAND_BBTSascha Hauer2020-11-112-2/+1
| | | | | | | CONFIG_NAND_BBT no longer exists, so remove the remaining occurences. Fixes: b6bcd96de5 ("mtd: nand: Update to Linux-5.9") Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/mtd-nand'Sascha Hauer2020-11-1048-5271/+11736
|\