summaryrefslogtreecommitdiffstats
path: root/include/linux/mtd
Commit message (Collapse)AuthorAgeFilesLines
* nand command: Print OOB informationSascha Hauer2020-11-101-0/+2
| | | | | | | | NAND mtd devices carry information how the OOB area is used. So far there is no way to visualize it, so print it along with other NAND informations. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: nand: Update to Linux-5.9Sascha Hauer2020-11-109-766/+2592
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This updates the barebox NAND layer and parts of the mtd layer to Linux-5.9. This patch is huge, but the barebox NAND layer is so far away from the Linux NAND layer that a step by step update would have taken ages. Unlike Linux barebox has functions to mark a block as good. This feature has been preserved. Also barebox used to make NAND write support optional, this feature is lost during the update for the sake of better compatibility to the Linux NAND layer. This patch has been tested: - GPMI aka nand_mxs on i.MX6 - nand_imx on i.MX25 - nand_omap_gpmc on AM335x - atmel_nand on Atmel sama5d3 - nand_denali on SoCFPGA Currently untested: - nand_orion - nand_mrvl_nfc - nand_s3c24xx The nand_denali driver is tested with the update of that driver to Linux-5.9 following in the next patch. I could only test the drivers with the NAND chips found on my boards, so there's still enough room for regressions, especially given that the NAND drivers themselves are mostly not updated. With the NAND layer being up-to-date with Linux it should hopefully be easy to update drivers to their Linux counterpart as well if necessary. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: Add ecc_step_sizeSascha Hauer2020-11-091-0/+3
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: nand: move function hooks to struct nand_legacySascha Hauer2020-11-091-43/+53
| | | | | | | Linux had moved the traditional nand function hooks to an extra struct nand_legacy. Do the same in barebox for compatibility. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: rename master to parentSascha Hauer2020-11-091-1/+7
| | | | | | | In Linux mtd->parent is what in barebox is mtd->master. Rename this to get closer to the Linux mtd layer. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: rename class_dev to devSascha Hauer2020-11-091-1/+1
| | | | | | | | The mtds own device is named 'dev' in the Kernel whereas it's named 'class_dev' in barebox. Rename it to 'dev' for better compatilibility to the Kernel. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: Use classdev->parentSascha Hauer2020-11-091-1/+0
| | | | | | | | | | Instead of mtd->parent we can use mtd->classdev.parent which points to the same device. With this we can remove the 'parent' member of struct mtd_info. This member exists in the Linux kernel as well, but is of type struct mtd_info, so this is done as preparation to re-add mtd->parent with the same type as in Linux. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: Add underscore prefix to mtd hooksSascha Hauer2020-11-061-23/+23
| | | | | | | In the Kernel the mtd function hooks begin with an underscore. Do the same in barebox to be better comparable to the Kernel. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: nand: Pass struct nand_chip aroundSascha Hauer2020-11-063-58/+59
| | | | | | | | | Traditionally Linux passed a struct mtd_info * around as context between the different functions. This has been changed to a struct nand_chip *. Do the same for barebox as well as another step towards updating the NAND layer to current Linux. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: nand: drop unused errstat hookSascha Hauer2020-11-061-5/+0
| | | | | | chip->errstat is never set by any driver, so remove it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: nand: drop unused erase_cmd hookSascha Hauer2020-11-061-3/+0
| | | | | | chip->erase_cmd is never used, so remove this hook. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: Drop asynchronous erase supportSascha Hauer2020-11-061-25/+0
| | | | | | | asynchronous erase support is unused and also dropped from the Kernel, so remove it from barebox. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: s/filed/field/Sascha Hauer2020-08-241-1/+1
| | | | | | Fix typos. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: spi-nor: fix wrong value for CR_QUAD_EN_SPANClement Leger2019-12-091-1/+1
| | | | | | | Durign a previous patch, 0x2 was mistakenly converted to BIT(2) whereas it should be BIT(1). Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: nand: Fix retrieving nand_chip from mtd_infoSascha Hauer2019-09-121-1/+1
| | | | | | | | With 76b6f74c53 we begin embedding a struct mtd_info into struct nand_chip. With this mtd_to_nand() must be changed accordingly. Fixes: 76b6f74c53 ("mtd: nand: Embed struct mtd_info into struct nand_chip") Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/omap'Sascha Hauer2019-09-121-1/+1
|\
| * mtd: nand: gpmc: Add BCH16 supportSascha Hauer2019-08-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds support for BCH16 ECC encoding. The support is mostly taken from Linux-5.3-rc6. One major change is the different wrap mode used. The Kernel uses wrapmode 1, which means "pass all data through the BCH engine". Still the Kernel has to skip the OOB marker which is done by reading all user data, then use NAND_CMD_RNDOUT to position right behind the OOB marker and then read the ECC data. Instead of doing this we use wrap mode 4 which allows us to bypass the OOB marker from the BCH engine automatically. This explains bch_wrapmode = 1, eccsize0 = 0, eccsize1 = 52 vs. bch_wrapmode = 4, eccsize0 = 4, eccsize1 = 52 Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/mtd'Sascha Hauer2019-09-121-0/+7
|\ \
| * | mtd: nand: Embed struct mtd_info into struct nand_chipSascha Hauer2019-08-261-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Similar to what is done in the Kernel. In the Kernel we have a struct nand_device embedded into struct nand_chip and the nand_device has an mtd_info embedded into it. Until we have struct nand_device we embed mtd_info directly into the nand_chip. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | mtd: nand: Add and use static inline wrapper for getting nand_chip from mtdSascha Hauer2019-08-261-0/+5
| |/ | | | | | | | | | | | | | | | | All drivers in tree use mtd->priv for the nand_chip. Add and use a static inline wrapper mtd_to_nand() which we already have in the kernel for getting the nand_chip from the mtd_info struct. Next step would be to embed a struct mtd_info into struct nand_chip. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / mtd: spi-nor: add UNLOCK_GLOBAL_BLOCK supportOleksij Rempel2019-08-211-0/+1
|/ | | | | | | | Ported from linux-4.19-at91 linux4sam_6.1 and needed for SAMA5D27 SOM1 EK. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: nand: Add function to parse device tree propertiesSascha Hauer2019-08-061-0/+2
| | | | | | | This adds nand_of_parse_node() which can be used to parse generic NAND device properties. Not very complete yet, but it's a start. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: nand-mxs: change API between NAND driver and fcb codeSascha Hauer2019-08-061-6/+1
| | | | | | | | | | | | The imx-bbu-nand-fcb update handler code calls into the NAND driver to get the ecc strength and bad block marker position. Change the API so that only a single function is necessary and not three functions. Also in future the ecc strength will be configurable via device tree. This means static parameters like page size / oob size are no longer enough to calculate the ecc strength and so we store a pointer to our mtd_info struct in a static global variable. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: spi-nor: provide default erase_sector implementationSteffen Trumtrar2019-05-081-1/+2
| | | | | | | | | | | | | | | | | | | | | | | Based on the Linux v4.4 patch commit c67cbb839da9cc2757eabfa128556db6a2baf160 Author: Brian Norris <computersforpeace@gmail.com> AuthorDate: Tue Nov 10 12:15:27 2015 -0800 Commit: Brian Norris <computersforpeace@gmail.com> CommitDate: Thu Nov 19 13:34:44 2015 -0800 mtd: spi-nor: provide default erase_sector implementation Some spi-nor drivers perform sector erase by duplicating their write_reg() command. Let's not require that the driver fill this out, and provide a default instead. Tested on m25p80.c and Medatek's MT8173 SPI NOR flash driver. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: spi-nor: introduce SPI 1-2-2 and SPI 1-4-4 protocolsSteffen Trumtrar2019-05-081-26/+168
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sync the driver with Linux v4.12 and apply the patch commit cfc5604c488ccd17936b69008af0c9ae050f4a08 Author: Cyrille Pitchen <cyrille.pitchen@atmel.com> AuthorDate: Tue Apr 25 22:08:46 2017 +0200 Commit: Cyrille Pitchen <cyrille.pitchen@wedev4u.fr> CommitDate: Mon May 15 21:56:17 2017 +0200 mtd: spi-nor: introduce SPI 1-2-2 and SPI 1-4-4 protocols This patch changes the prototype of spi_nor_scan(): its 3rd parameter is replaced by a 'struct spi_nor_hwcaps' pointer, which tells the spi-nor framework about the actual hardware capabilities supported by the SPI controller and its driver. Besides, this patch also introduces a new 'struct spi_nor_flash_parameter' telling the spi-nor framework about the hardware capabilities supported by the SPI flash memory and the associated settings required to use those hardware caps. Then, to improve the readability of spi_nor_scan(), the discovery of the memory settings and the memory initialization are now split into two dedicated functions. 1 - spi_nor_init_params() The spi_nor_init_params() function is responsible for initializing the 'struct spi_nor_flash_parameter'. Currently this structure is filled with legacy values but further patches will allow to override some parameter values dynamically, for instance by reading the JESD216 Serial Flash Discoverable Parameter (SFDP) tables from the SPI memory. The spi_nor_init_params() function only deals with the hardware capabilities of the SPI flash memory: especially it doesn't care about the hardware capabilities supported by the SPI controller. 2 - spi_nor_setup() The second function is called once the 'struct spi_nor_flash_parameter' has been initialized by spi_nor_init_params(). With both 'struct spi_nor_flash_parameter' and 'struct spi_nor_hwcaps', the new argument of spi_nor_scan(), spi_nor_setup() computes the best match between hardware caps supported by both the (Q)SPI memory and controller hence selecting the relevant settings for (Fast) Read and Page Program operations. Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com> Reviewed-by: Marek Vasut <marek.vasut@gmail.com> Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: spi-nor: remove unused read_xfer/write_xfer hooksSteffen Trumtrar2019-05-081-32/+0
| | | | | | | | | | | | | | | | | | | | | | Based on the Linux v4.3 patch: commit 79c452adb159dc9abc507ea13faec8d115a78758 Author: Cyrille Pitchen <cyrille.pitchen@atmel.com> AuthorDate: Fri Sep 18 17:49:25 2015 +0200 Commit: Brian Norris <computersforpeace@gmail.com> CommitDate: Mon Sep 21 16:49:52 2015 -0700 mtd: spi-nor: remove unused read_xfer/write_xfer hooks struct spi_nor_xfer_cfg and read_xfer/write_xfer hooks were never used by any driver. Do some cleanup by removing them. Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com> Reviewed-by: Marek Vasut <marex@denx.de> Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: spi-nor: remove unused write_enable from write_regSteffen Trumtrar2019-05-081-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | Based on the Linux v4.2 commit: commit f9f3ce835ddce3c669eee869253105f88819888b Author: Jagan Teki <jteki@openedev.com> AuthorDate: Wed Aug 19 15:26:44 2015 +0530 Commit: Brian Norris <computersforpeace@gmail.com> CommitDate: Fri Sep 11 16:04:55 2015 -0700 mtd: spi-nor: Zap unneeded write_enable from write_reg The 'write_enable' argument is unused and unneeded, so remove it from the API. Signed-off-by: Jagan Teki <jteki@openedev.com> Cc: David Woodhouse <dwmw2@infradead.org> Cc: Han Xu <han.xu@freescale.com> [Brian: fixed for nxp-spifi.c] Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Revert "mtd: nand: Kill the chip->scan_bbt() hook"Sascha Hauer2019-01-211-1/+4
| | | | This reverts commit 95ce69795506293eae28d6e64055d2c7ae27f164.
* mtd: nand: Kill cellinfoLadislav Michl2018-12-171-2/+1
| | | | | | | | | The only information used from cellinfo field is whenever flash is SLC or MLC, therefore eliminate it completely. This patch is based on Linux commit 7db906b79f69. Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: nand: Kill the chip->scan_bbt() hookLadislav Michl2018-12-171-4/+1
| | | | | | | | | | | Linux commit e80eba758151 adapted for Barebox: None of the existing drivers are overloading the ->scan_bbt() method, let's get rid of it and replace calls to ->scan_bbt() by nand_create_bbt() ones. Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: nand_bbt: make nand_scan_bbt() staticLadislav Michl2018-12-141-1/+0
| | | | | | | | | Linux commit 17799359e7b adapted for Barebox: This implementation detail is no longer needed outside of nand_bbt.c. Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: nand_bbt: kill NAND_BBT_SCANALLPAGESLadislav Michl2018-12-141-2/+0
| | | | | | | | | | Linux commit 5961ad2cb4dd adapted for Barebox: Now that the last user of NAND_BBT_SCANALLPAGES has been removed, let's kill this peculiar BBT feature flag. Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: nand: simplify nand_bch_init() usageLadislav Michl2018-12-141-6/+2
| | | | | | | | | | | | | | Linux commit a8c65d504e0b modified for Barebox: nand_bch_init() requires several arguments which could directly be deduced from the mtd device. Get rid of those useless parameters. nand_bch_init() is also requiring the caller to provide a proper eccbytes value, while this value could be deduced from the ecc.size and ecc.strength value. Fallback to eccbytes calculation when it is set to 0. Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: nand: remove NAND_BBT_SCANEMPTYLadislav Michl2018-12-141-2/+0
| | | | | | | | | | | | | | | | | | Relevant part of Linux commit dad2256269cb: NAND_BBT_SCANEMPTY is a strange, badly-supported option with omap as its single remaining user. NAND_BBT_SCANEMPTY was likely used by accident in omap2[1]. And anyway, omap2 doesn't scan the chip for bad blocks (courtesy of NAND_SKIP_BBTSCAN), and so its use of this option is irrelevant. This patch drops the NAND_BBT_SCANEMPTY option. [1] http://lists.infradead.org/pipermail/linux-mtd/2012-July/042902.html Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: nand: hide in-memory BBT implementation detailsLadislav Michl2018-12-141-2/+2
| | | | | | | | | | | | | | | | | Linux commit b32843b772db adapted for Barebox: nand_base.c shouldn't have to know the implementation details of nand_bbt's in-memory BBT. Specifically, nand_base shouldn't perform the bit masking and shifting to isolate a BBT entry. Instead, just move some of the BBT code into a new nand_markbad_bbt() interface. This interface allows external users (i.e., nand_base) to mark a single block as bad in the BBT. Then nand_bbt will take care of modifying the in-memory BBT and updating the flash-based BBT (if applicable). Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: nand: Add Winbond manufacturer IDStefan Riedmueller2018-03-221-0/+1
| | | | | | | | Add Winbond 0xef manufacturer ID for NAND flashes to support Winbond as an additional manufacturer. Signed-off-by: Stefan Riedmueller <s.riedmueller@phytec.de> Signed-off-by: Christian Hemp <c.hemp@phytec.de>
* mtd: nand: Only call ONFI get/set features on supported chipsSascha Hauer2017-09-061-0/+3
| | | | | | | Older versions of the ONFI spec do not support get/set features, so do not call these commands when they are not available. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: use dev_add_param_stringSascha Hauer2017-04-111-0/+1
| | | | | | | dev_add_param_string allows to pass a priv * so that the device_d * argument is not needed and can be removed later. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: nand: use dev_add_param_enumSascha Hauer2017-04-111-0/+1
| | | | | | | dev_add_param_enum allows to pass a priv * so that the device_d * argument is not needed and can be removed later. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: of: Make used partition binding configurableSascha Hauer2017-03-301-0/+1
| | | | | | | | | | | | | | So far we used the legacy partition binding when fixing up the mtd partition nodes. Change this to default to the new binding with a "partitions" submode. Make this behaviour configurable though: This creates a new of_binding device variable for mtd devices. This can be set to: - "new": Use the new partition binding (default) - "legacy": Use the old partition binding - "donttouch": Do not touch the partition node Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: ubi: add API call to rename volumes.Giorgio Dal Molin2016-09-271-0/+1
| | | | | Signed-off-by: Giorgio Dal Molin <iw3gtf@arcor.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: ubi: Add API calls to create/remove volumesSascha Hauer2016-09-221-0/+3
| | | | | | | | | | Currently we use a ioctl API to create/remove ubi volumes. This means we always have to carry all function code for ubi volume manipulation when the ioctl is compiled in. This adds a function API to create/remove volumes so that the linker can throw the unused code away later. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: nand: add ONFI timing mode to nand_timings converterSascha Hauer2016-08-181-0/+3
| | | | | | | | | | | Ported from Linux commit 974647e: | Add a converter to retrieve NAND timings from an ONFI NAND timing mode. | At the moment, only SDR NAND timings are supported. | | Signed-off-by: Boris BREZILLON <boris.brezillon@free-electrons.com> | Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: nand: define struct nand_timingsSascha Hauer2016-08-181-0/+49
| | | | | | | | | | | | Ported from Linux commit bb5fd0b6da: | Define a struct containing the standard NAND timings as described in NAND | datasheets. | | Signed-off-by: Boris BREZILLON <boris.brezillon@free-electrons.com> | Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: nand: Enable subpage readsSascha Hauer2016-05-101-1/+1
| | | | | | | | Until now we did not support subpage reads for smaller binary sizes. Scanning UBI volumes on large page NANDs can be painfully slow, subpage reads can speed this up significantly, so enable subpage reads. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: nand: Pass page argument to read_subpage hookSascha Hauer2016-05-101-1/+1
| | | | | | | Similar to what the kernel does in e004debda (mtd: nand: add "page" argument for read_subpage hook). Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/mtd-imx-nand'Sascha Hauer2016-04-081-19/+0
|\
| * mtd: remove unused debug definesSascha Hauer2016-03-171-19/+0
| | | | | | | | | | | | | | MTD_DEBUG was only used by the i.MX Nand driver and is now unused. Remove the mtd specific debug defines. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mtd: nand: export nand_check_erased_bufSascha Hauer2016-04-081-0/+1
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mtd: Introduce mtd_check_patternSascha Hauer2016-03-151-0/+1
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>