summaryrefslogtreecommitdiffstats
path: root/drivers/mtd
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'for-next/qspi'Sascha Hauer2019-05-104-365/+725
|\
| * mtd: spi-nor: Add support for more Macronix devicesSascha Hauer2019-05-081-0/+3
| | | | | | | | | | | | Add support for the Macronix mx66u51235f, mx66l1g45g and mx66l1g55g. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mtd: devices: m25p80: use the spi_mem_xx() APISteffen Trumtrar2019-05-082-82/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the barebox adoption of the linux v4.16 patch 4120f8d158ef904fb305b27e4a4524649faf3096 Author: Boris Brezillon <bbrezillon@kernel.org> AuthorDate: Thu Apr 26 18:18:19 2018 +0200 Commit: Mark Brown <broonie@kernel.org> CommitDate: Fri May 11 11:33:51 2018 +0900 mtd: spi-nor: Use the spi_mem_xx() API The spi_mem_xxx() API has been introduced to replace the spi_flash_read() one. Make use of it so we can get rid of spi_flash_read(). Note that using spi_mem_xx() also simplifies the code because this API takes care of using the regular spi_sync() interface when the optimized ->mem_ops interface is not implemented by the controller. Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com> Reviewed-by: Frieder Schrempf <frieder.schrempf@exceet.de> Tested-by: Frieder Schrempf <frieder.schrempf@exceet.de> Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mtd: spi-nor: provide default erase_sector implementationSteffen Trumtrar2019-05-081-4/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-083-204/+511
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 write_enable from write_regSteffen Trumtrar2019-05-083-13/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * spi: Extend the core to ease integration of SPI memory controllersSteffen Trumtrar2019-05-081-23/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sync with Linux v5.1-rc1. This is the barebox adoption of the commit commit c36ff266dc82f4ae797a6f3513c6ffa344f7f1c7 Author: Boris Brezillon <boris.brezillon@bootlin.com> Date: Thu Apr 26 18:18:14 2018 +0200 spi: Extend the core to ease integration of SPI memory controllers Some controllers are exposing high-level interfaces to access various kind of SPI memories. Unfortunately they do not fit in the current spi_controller model and usually have drivers placed in drivers/mtd/spi-nor which are only supporting SPI NORs and not SPI memories in general. This is an attempt at defining a SPI memory interface which works for all kinds of SPI memories (NORs, NANDs, SRAMs). Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com> Reviewed-by: Frieder Schrempf <frieder.schrempf@exceet.de> Tested-by: Frieder Schrempf <frieder.schrempf@exceet.de> Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mtd: spi-nor: cadence: add cqspi_set_protocolSteffen Trumtrar2019-05-081-63/+113
| | | | | | | | | | | | | | | | | | | | | | | | | | Sync up the driver with the original linux v4.7 driver version. As only Quad-SPI mode is/was supported, the function was not ported in the initial move to barebox. To make future synchronizations with the kernel driver easier, add this function and reorder the functions in the driver accordingly. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2019-05-101-1/+0
|\ \
| * | UBI: remove Kconfig entry from includeJan Remmet2019-05-061-1/+0
| |/ | | | | | | | | | | | | | | CONFIG_MTD_UBI_WL_THRESHOLD can be set via Kconfig. default there is also 4096. So remove the leftover here. Signed-off-by: Jan Remmet <j.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / mtd: spi-nor: add Winbond W25Q40BWAlexander Kurz2019-04-231-0/+1
|/ | | | | | | This 4MBit SPI chip can be found in Kindle Voyage devices Signed-off-by: Alexander Kurz <akurz@blala.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2019-02-132-1/+29
|\
| * mtd: peb: Add function to skip bad blocksSascha Hauer2019-01-281-0/+27
| | | | | | | | | | | | | | | | This adds a function that given a pointer to a PEB number increases the number until the corresponding PEB is good. It also checks for the PEB number being inside the mtd device. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * ubi: prevent null pointer referenceRoland Hieber2019-01-221-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After flashing a bogus UBI image, e.g. when the UBI is bigger than the available flash size, it can happen that barebox hangs itself with a stacktrace when the board code or the environment does a ubi_attach() on boot: ERROR: ubi0 error: init_volumes: not enough PEBs, required 7478, available 4024 unable to handle NULL pointer dereference at address 0x00000204 pc : [<1fd1eaf2>] lr : [<1fd15aad>] sp : 1feefd30 ip : 0000000a fp : 1fd5d1d7 r10: 00001d34 r9 : 00000000 r8 : 1fd5d540 r7 : 14983148 r6 : 00000006 r5 : ffffffe4 r4 : 14983004 r3 : 1fd82bfc r2 : 021f0000 r1 : 0000000a r0 : 00000000 Flags: nzcv IRQs off FIQs off Mode SVC_32 [<1fd1eaf2>] (ubi_fastmap_destroy_checkmap+0x8/0xa) from [<1fd15aad>] (ubi_read_volume_table+0x4d9/0x71c) [<1fd15aad>] (ubi_read_volume_table+0x4d9/0x71c) from [<1fd1cbf7>] (ubi_attach+0x157/0x1f8) [<1fd1cbf7>] (ubi_attach+0x157/0x1f8) from [<1fd16ec3>] (ubi_attach_mtd_dev+0x4a3/0x954) [...] After this change, barebox at least boots to a prompt where the faulty flash can be repaired: ERROR: ubi0 error: init_volumes: not enough PEBs, required 7478, available 4024 ERROR: ubi0 error: ubi_attach_mtd_dev: failed to attach mtd0, error -28 [...] running /env/bin/init... barebox@boardname:/ Signed-off-by: Roland Hieber <rhi@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fs: devfs: Change .lseek callbacks to return 'int'Andrey Smirnov2019-02-042-6/+5
| | | | | | | | | | | | | | | | | | | | | | Returning requested offset from .lseek() callback doesn't really give us any new information while bringing unnecessary complications. Change all .lseek() types (both in struct struct cdev_operations and in struct fs_driver_d) to return 'int' and adjust the rest of the codebase accordingly. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | devfs: Drop dev_lseek_default()Andrey Smirnov2019-01-293-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Only the following cdevs do not declare an .lseek() operation: - Console devices in common/console.c - Firmware framework in common/firmware.c - JTAG driver in drivers/misc/jtag.c - UBI in drivers/mtd/ubi/barebox.c Of those four, first two are marked DEVFS_IS_CHARACTER_DEV and implement only .write() operation and the last two don't implement anything but .ioctl(). While there's probably no meaningful way to use lseek() against any of those devices, there doesn't seem to be any harm in allowing it either. Change devfs_lseek() to ignore absense of .lseek() callback and drop dev_lseek_default() and all references to it in the codebase. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Revert "mtd: nand: Kill the chip->scan_bbt() hook"Sascha Hauer2019-01-214-16/+29
|/ | | | This reverts commit 95ce69795506293eae28d6e64055d2c7ae27f164.
* Merge branch 'for-next/mtd'Sascha Hauer2019-01-157-315/+418
|\
| * mtd: core: Fix erase area alignment for non power of 2 erasesizeLadislav Michl2019-01-141-6/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | Devices as AT45DB161 DataFlash uses non power of two page size (528) while present alignment algorithm relies on erasesize being power of 2. Fix that by introducing helper functions rounding to any multiply. Note that logic is sligthly changed to be consistent as ending address is moved forward to include also last byte meant to be erased while previous implementation moved it backward. Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mtd: nand: nand_base: Fix compile warning if CONFIG_MTD_WRITE is not enabledTeresa Remmet2018-12-181-1/+1
| | | | | | | | | | | | | | | | | | | | drivers/mtd/nand/nand_base.c:337:12: warning: 'nand_default_block_markbad' defined but not used [-Wunused-function] Add __maybe_unused again to silence warning when CONFIG_MTD_WRITE is not enabled. Signed-off-by: Teresa Remmet <t.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mtd: nand: detect OOB size for Toshiba 24nm raw SLCLadislav Michl2018-12-171-0/+14
| | | | | | | | | | | | | | Linux commit 60c673824561. Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mtd: nand: Kill cellinfoLadislav Michl2018-12-171-9/+20
| | | | | | | | | | | | | | | | | | 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-174-29/+16
| | | | | | | | | | | | | | | | | | | | | | 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: scan for next free bbt block if writing bbt failsLadislav Michl2018-12-141-6/+45
| | | | | | | | | | | | | | | | | | | | | | | | Linux commit 10ffd570f117 adapted for Barebox: If erasing or writing the BBT fails, we should mark the current BBT block as bad and use the BBT descriptor to scan for the next available unused block in the BBT. We should only return a failure if there isn't any space left. Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mtd: nand_bbt: Move BBT block selection logic out of write_bbt()Ladislav Michl2018-12-141-36/+74
| | | | | | | | | | | | | | | | | | | | Linux commit c3baf278d3bf adapted for Barebox: This clarifies the write_bbt() function by removing the write label and simplifying the error/exit path. Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mtd: nand_bbt: unify/fix error handling in nand_scan_bbt()Ladislav Michl2018-12-141-7/+12
| | | | | | | | | | | | | | | | | | | | Linux commit 83c59542d0af adapted for Barebox: Don't leak this->bbt, and return early if check_create() fails. It helps to have a single error path to avoid these problems. 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/+1
| | | | | | | | | | | | | | | | | | 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: handle error case for nand_create_badblock_pattern()Ladislav Michl2018-12-141-2/+6
| | | | | | | | | | | | | | Linux commit abb9cf78e80a adapted for Barebox. 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-142-35/+3
| | | | | | | | | | | | | | | | | | | | 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-142-16/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: atmel_nand: Add per board ECC setupLadislav Michl2018-12-141-0/+3
| | | | | | | | | | Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mtd: nand: Request strength instead of bytes for soft BCHLadislav Michl2018-12-141-7/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Linux commits e0377cdebaf3 and 438320dd34a4 combined and adapted for Barebox: Previously, we requested that drivers pass ecc.size and ecc.bytes when using NAND_ECC_SOFT_BCH. However, a driver is likely to only know the ECC strength required for its NAND, so each driver would need to perform a strength-to-bytes calculation. Avoid duplicating this calculation in each driver by asking drivers to pass ecc.size and ecc.strength so that the strength-to-bytes calculation need only be implemented once. 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-142-29/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-142-64/+113
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: remove multiplied-by-2 block logicLadislav Michl2018-12-141-48/+35
| | | | | | | | | | | | | | | | | | | | | | Linux commit b4d20d601f1e adapted for Barebox This patch removes any points where the block number is doubled/halved/otherwise-shifted, instead representing the block number in its most natural form: as the actual block number. Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mtd: nand: refactor chip->block_markbad interfaceLadislav Michl2018-12-141-35/+52
| | | | | | | | | | | | | | | | | | | | | | | | Linux commit 5a0edb251ae9 adapted for Barebox: The chip->block_markbad pointer should really only be responsible for writing a bad block marker for new bad blocks. It should not take care of BBT-related functionality, nor should it handle bookkeeping of bad block stats. Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/imx'Sascha Hauer2019-01-151-6/+19
|\ \
| * | mtd: core: Fix erase area alignment for non power of 2 erasesizeLadislav Michl2019-01-151-6/+19
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On Thu, Jan 10, 2019 at 09:32:07AM +0100, Sascha Hauer wrote: > On Wed, Jan 09, 2019 at 12:28:14PM +0100, Ladislav Michl wrote: > > Devices as AT45DB161 DataFlash uses non power of two page size (528) > > while present alignment algorithm relies on erasesize being power > > of 2. > > Fix that by introducing helper functions rounding to any multiply. > > Note that logic is sligthly changed to be consistent as ending > > address is moved forward to include also last byte meant to be > > erased while previous implementation moved it backward. > > > > Signed-off-by: Ladislav Michl <ladis@linux-mips.org> > > --- > > drivers/mtd/core.c | 28 ++++++++++++++++++++++------ > > include/linux/kernel.h | 5 +++++ > > 2 files changed, 27 insertions(+), 6 deletions(-) > > Applied, thanks Hi Sascha, I was searching for paper bag, but was unable to find anything thick enouh to cover behind :-/ This version is buggy and I noticed right now when testing on another board. Corrected version follows, which is also 192 bytes shorter for my ARM target. It seems next branch at https://git.pengutronix.de/ is not yet updated, so perhaps my fault won't affect anyone. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mtd: nand: omap: unbreak BCH8 supportSascha Hauer2018-12-201-46/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We now tell the NAND layer that we have subpages with 512 bytes each. This means the calculate_ecc / correct hooks are also called for each subpage which means we cannot iterate over subpages in the calculate_ecc callback. Implement this correctly by removing the loop over subpages in the calculate_ecc callback and by implementing a read_page callback. With this the bch8_hw and bch8_hw_romcode were tested on AM335x, OMAP4 and AM3517. Number of bitflips is correctly reported as tested with the nand_bitflip tool. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> With fix from Teresa: Using BCH rom code mode we start calculating with GPMC_BCH_RESULTx_1. Fix offset for correct error correction. Signed-off-by: Teresa Remmet <t.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mtd: nand: omap: set eccbytes correctlySascha Hauer2018-12-141-0/+4
| | | | | | | | | | | | | | The total number of ecc bytes per page must be provided to the nand core. This patch fixes this for bch8_hw and bch8_hw_romcode. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mtd: nand: omap: fix bch8_hw_romcode ecc layoutSascha Hauer2018-12-141-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | The ecc layout we provide to the nand core is broken since 00f119a293. Before this commit ecc bytes/size were per page and now they are per subpage. The offset for the first ecc byte was calculated as oob_end - num_ecc_bytes which must now become oob_end - num_ecc_bytes * ecc_steps. Fixes: 00f119a293 ("mtd: omap gpmc: fix ecc bytes/size") Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mtd: nand: omap: remove unused function argumentSascha Hauer2018-12-141-5/+5
| | | | | | | | | | | | | | __omap_calculate_ecc doesn't use the provided buffer argument, so remove it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mtd: nand: omap: Disable subpage reads in hardware ecc modeSascha Hauer2018-12-141-0/+1
| | | | | | | | | | | | | | | | Once the driver has started in software ECC mode the NAND core will set the NAND_SUBPAGE_READ flag. We have to clear it explicitly when we change to another mode afterwards. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mtd: nand: omap: Fix hamming correct return valuesSascha Hauer2018-12-141-4/+3
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mtd: nand: omap: Use dev_dbg when a struct device * is availableSascha Hauer2018-12-141-2/+2
|/ | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/mtd'Sascha Hauer2018-12-074-1/+24
|\
| * mtd: spi-nor: Add support for sst25wf040bYao Yuan2018-12-051-0/+1
| | | | | | | | | | | | | | | | Signed-off-by: Yuan Yao <yao.yuan@freescale.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com> [Linux upstream commit: c887be71cc39] Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mtd: spi-nor: Add support for sst25wf020aAlexis Ballier2018-12-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | It is a 256KiB flash with 4 KiB erase sectors and 64KiB overlay blocks. This is the one available on Hardkernel's Odroid U3 shield. Signed-off-by: Alexis Ballier <aballier@gentoo.org> [Brian: seems like this does NOT require the usual SST_WRITE hacks] Signed-off-by: Brian Norris <computersforpeace@gmail.com> [Linux upstream commit: a1d97ef96e38] Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mtd: nand: denali: quiet down driverSteffen Trumtrar2018-11-291-1/+1
| | | | | | | | | | | | | | | | Instead of always printing the timing registers, make it a debug information only. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mtd: return EOPNOTSUPP when attempting to erase an MTD_NO_ERASE deviceMatthias Schiffer2018-11-261-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At least some MTD_NO_ERASE devices like MRAM do not specify a sensible erase block size; instead, erasesize is equal to the whole flash size. This leads to an EINVAL return from mtd_erase_align() whenever a partial erase is attempted. At least on the MRAM I tested, a full flash erase did not return an error, but it did not have any effect on the flash either. As erase seems to be entirely unsupported on this class of devices, and it is not necessary anyways, it's better to return early with EOPNOTSUPP. This fixes envfs_save() on a partitioned MRAM. Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>