aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/sunxi_nand.c
Commit message (Collapse)AuthorAge
...
* mtd: nand: sunxi: introduce sunxi_nfc_hw_ecc_read/write_chunk()Boris BREZILLON2015-10-02
| | | | | | | | | | | The logic behind normal and syndrome ECC handling is pretty much the same, the only difference is the ECC bytes placement. Create two functions to read/write ECC chunks. Those functions will later be used by the sunxi_nfc_hw_ecc_read/write_page() and sunxi_nfc_hw_syndrome_ecc_read/write_page() functions. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
* mtd: nand: sunxi: create sunxi_nfc_hw_ecc_enable()/disable() functionsBoris BREZILLON2015-10-02
| | | | | | | | The code used to enable/disable the hardware ECC engine is repeated in a lot of places. Create two functions to avoid code duplication. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
* mtd: nand: sunxi: rework macrosBoris BREZILLON2015-09-30
| | | | | | | | Suffix mask macros with _MSK and add new helper macros to avoid manually shifting values. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
* Merge MTD 4.3-rc updates into -nextBrian Norris2015-09-30
|\
| * mtd: nand: sunxi: fix sunxi_nand_chips_cleanup()Boris BREZILLON2015-09-21
| | | | | | | | | | | | | | | | | | | | | | | | The sunxi_nand_chips_cleanup() function is missing a call to list_del() which generates a double free error. Reported-by: Priit Laes <plaes@plaes.org> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Cc: <stable@vger.kernel.org> # 3.19+ Fixes: 1fef62c1423b ("mtd: nand: add sunxi NAND flash controller support") Tested-by: Priit Laes <plaes@plaes.org> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
| * mtd: nand: sunxi: fix OOB handling in ->write_xxx() functionsBoris BREZILLON2015-09-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The USER_DATA register cannot be accessed using byte accessors on A13 SoCs, thus triggering a bug when using memcpy_toio on this register. Declare an helper macros to convert an OOB buffer into a suitable USER_DATA value and vice-versa. This patch also fixes an error in the oob_required logic (some OOB data are not written even if the user required it) by removing the oob_required condition, which is perfectly valid since the core already fill ->oob_poi with FFs when oob_required is false. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Cc: <stable@vger.kernel.org> # 3.19+ Fixes: 1fef62c1423b ("mtd: nand: add sunxi NAND flash controller support") Signed-off-by: Brian Norris <computersforpeace@gmail.com>
* | mtd: nand: sunxi: rely on nand_dt_init initializationBoris BREZILLON2015-09-11
| | | | | | | | | | | | | | | | | | | | | | nand_dt_init(), called from nand_scan_ident(), is already parsing the generic MTD/NAND DT properties, and initializing the nand_chip struct accordingly. Rely on this initialization instead of manually parsing those properties. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> [Brian: rename 'np' -> 'flash_node' to accomodate for prior rename patch] Signed-off-by: Brian Norris <computersforpeace@gmail.com>
* | mtd: sunxi_nand: Select the chip in sunxi_nand_chip_init_timings()Stefan Roese2015-09-09
|/ | | | | | | | | | | | | | | | | | | nand_scan_ident() leaves the chip deselected. So just issuing some commands from the sunxi driver does not work. We need to select the chip before writing the commands to the NAND device. This patch takes care of this. Set the new timing on all dies implemented as suggested by Boris. This was detected on the in-circuit ICnova-A20 SoM equipped with the Micron MT29F32G08CBACAWP (4GiB) ONFI NAND device. Signed-off-by: Stefan Roese <sr@denx.de> Cc: Hans de Goede <hdegoede@redhat.com> Cc: Maxime Ripard <maxime.ripard@free-electrons.com> Cc: Roy Spliet <r.spliet@ultimaker.com> Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com> [Brian: fixup whitespace] Signed-off-by: Brian Norris <computersforpeace@gmail.com>
* mtd: nand: sunxi: Set serial access mode correctlyRoy Spliet2015-07-20
| | | | | | | | | | Replaces the hard coded "always use EDO" policy with that prescribed by the ONFI 3.1 specification that EDO mode should always be used if tRC is below 30ns. Signed-off-by: Roy Spliet <r.spliet@ultimaker.com> Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
* mtd: nand: sunxi: Replace failsafe timing cfg with calculated valueRoy Spliet2015-07-20
| | | | | | | | | | | | | The TIMING_CFG register was previously statically set to a magic value (extracted from Allwinner's BSP) when initializing the NAND controller. Now that we have more details about the TIMING_CFG register layout (extracted from the A83 user manual) we can dynamically calculate the appropriate value for each NAND chip and set it when selecting the chip. Signed-off-by: Roy Spliet <r.spliet@ultimaker.com> Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
* mtd: nand: Request strength instead of bytes for soft BCHAaron Sierra2015-02-02
| | | | | | | | | | | | | | | | | | 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. This reverts/generalizes this commit: mtd: nand: Base BCH ECC bytes on required strength Signed-off-by: Aaron Sierra <asierra@xes-inc.com> Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
* mtd: nand: add sunxi NAND flash controller supportBoris BREZILLON2014-10-29
Add support for the sunxi NAND Flash Controller (NFC). Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> [Brian: tweaked to fix ecc->steps issue] Signed-off-by: Brian Norris <computersforpeace@gmail.com>