summaryrefslogtreecommitdiffstats
path: root/include/linux/mtd/nand.h
Commit message (Collapse)AuthorAgeFilesLines
* mtd: nand: Update to Linux-5.9Sascha Hauer2020-11-101-724/+630
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: 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: nand: Pass struct nand_chip aroundSascha Hauer2020-11-061-48/+49
| | | | | | | | | 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: 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>
* 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: 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>
* 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: 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: 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: 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>
* mtd: nand: export nand_check_erased_bufSascha Hauer2016-04-081-0/+1
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: Add support for marking blocks as goodSascha Hauer2016-03-151-0/+2
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: nand: Add erased page bitflip check helper functionsMarkus Pargmann2016-01-041-0/+5
| | | | | | | | | | This adds the bitflip check helper functions from the kernel. They are used to check for bitflips in erased pages and correct them in the buffer so that UBI can work with it. Unfortunately most nand controllers do not have ECC for erased pages and don't do this on their own. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd nand: added 'bits_per_cell' propertyEnrico Jorns2015-09-231-0/+12
| | | | | | | This one is available in the kernel and used by the denali driver Signed-off-by: Enrico Jorns <ejo@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: nand: disable subpage readsSascha Hauer2014-03-031-1/+2
| | | | | | | | | | | | | | The default nand_read_subpage implementation returns -ENOSUPP, so we have to make sure that barebox never uses this implementation. By setting the NAND_SUBPAGE_READ flag to 0x0 we ensure NAND_HAS_SUBPAGE_READ() never returns true and also give the compiler a chance to optimize away some unused code. subpage reads are a rather exotic feature even in Linux. It is only used on largepage NANDs with soft ecc. Even if we have this case it needs non page aligned reads to actually profit from this feature. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Cc: Hattink, Tjalling [FINT] <T.Hattink@fugro.nl>
* mtd: nand: update to v3.11-rc1Sascha Hauer2013-07-231-276/+369
| | | | | | | | | | | | | | | | | | This updates the NAND stuff to Linux-3.11-rc1. It is synchronized as best as we can get: - locks removed - The splitting in different files we had to better support different features has been dropped. Instead this is now done mostly with the use of __maybe_unused Some barebox adjustments are forward ported, like: - Allow partial page writes - Optionally allow to erase bad blocks - check for all_ff before writing a page Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: introduce ecc strengthSascha Hauer2013-07-221-0/+2
| | | | | | | This introduces the ecc stength fields in the structures and fills them in, but leaves them unused right now. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: update NAND manufacturer names from the kernelJan Luebbe2013-04-111-9/+11
| | | | | Signed-off-by: Jan Luebbe <jlu@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: nand: replace NAND_USE_FLASH_BBT with NAND_BBT_USE_FLASHSascha Hauer2013-03-041-3/+4
| | | | | | To sync with the kernel. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd nand: introduce bbm.hSascha Hauer2013-03-041-72/+5
| | | | | | | This file is present in current kernels. In order to get closer to current mtd support introduce it for barebox aswell. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: nand: register nand flashes with nand specific functionSascha Hauer2013-03-041-1/+1
| | | | | | | This allows us to have some NAND specific stuff during registration, like for example adding NAND specific device parameters. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd nand: implement buswidth detectionSascha Hauer2012-08-031-0/+3
| | | | | | | | | | | | | | This introduces a new NAND_BUSWIDTH_AUTO flag which can be used to automatically detect the nand buswidth. The id is always read in 8bit mode. An additional callback is needed to switch the nand controller into 16bit mode. This currently depends on a safe read_byte (always) and read_buf (for onfi-only flashes) callback. It has been tested on OMAP, but is not something that generally works. For this reason the existence of the set_buswidth callback is used to determine whether we are able to do autodetection or not. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* nand_base: add ONFI flash detectionEric Bénard2012-07-051-1/+73
| | | | | | | | | | the code is taken from linux & u-boot implementations Validated on an i.MX53 which gives the following log : ONFI flash detected ... ONFI param page 0 valid NAND device: Manufacturer ID: 0x2c, Chip ID: 0x38 (Micron MT29F8G08ABABAWP), page size: 4096, OOB size: 224 Signed-off-by: Eric Bénard <eric@eukrea.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fix typo funtion -> functionAntony Pavlov2012-05-131-1/+1
| | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd/nand: increase page and oob size limitsBaruch Siach2011-03-181-2/+2
| | | | | | | | Sync these limits with the Linux kernel. This allows support for NAND devices with page size of 4k. Signed-off-by: Baruch Siach <baruch@tkos.co.il> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* nand_s3c2410: Fix sparse warnings.Marek Belisko2010-11-191-1/+0
| | | | | | | | | | | Patch fix following sparse warnings: drivers/mtd/nand/nand_s3c2410.c:125:9: warning: incorrect type in argument 1 (different base types) expected void const volatile [noderef] <asn:2>*<noident> got unsigned long Signed-off-by: Marek Belisko <marek.belisko@open-nandra.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: Fix sparse warning.Marek Belisko2010-11-191-3/+4
| | | | | | | | | | | Patch fix following sparse warning: drivers/mtd/nand/nand_base.c:123:16: warning: incorrect type in argument 1 (different address spaces) expected void const volatile [noderef] <asn:2>*<noident> got void *IO_ADDR_R Signed-off-by: Marek Belisko <marek.belisko@open-nandra.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* documentation updatesJuergen Beisert2009-12-151-0/+4
| | | | | Signed-off-by: Juergen Beisert <jbe@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* NAND: Add updated NAND support from KernelSascha Hauer2008-08-131-201/+301
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* NAND support work in progresssascha2007-10-201-29/+91
|
* NAND WIPSascha Hauer2007-10-151-2/+2
|
* svn_rev_003Sascha Hauer2007-07-051-16/+0
| | | | remove all #if 0 and #if 1
* Code cleanupWolfgang Denk2006-07-211-37/+37
|
* Minor code cleanupWolfgang Denk2006-03-061-1/+0
|
* Re-factoring the legacy NAND code (legacy NAND now only in board-specificBartlomiej Sieka2006-03-051-119/+385
| | | | | | | code and in SoC code). Boards using the old way have CFG_NAND_LEGACY and BOARDLIBS = drivers/nand_legacy/libnand_legacy.a added. Build breakage for NETTA.ERR and NETTA_ISDN - will go away when the new NAND support is implemented for these boards.
* Merge with /home/wd/git/u-boot/testing-NAND/ to add new NAND handling.Bartlomiej Sieka2006-02-241-1/+4
|\
| * Update of new NAND codeWolfgang Denk2005-09-141-22/+22
| | | | | | | | Patch by Ladislav Michl, 13 Sep 2005
| * Rewrite of NAND code based on what is in 2.6.12 Linux kernelWolfgang Denk2005-08-171-116/+387
|/ | | | Patch by Ladislav Michl, 29 Jun 2005
* Patches by Josef Wagner, 29 Oct 2004:wdenk2005-04-031-0/+2
| | | | | - Add support for MicroSys CPU87 board - Add support for MicroSys PM854 board