summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* mtd: use mtd_set_ecclayout() where appropriateBoris Brezillon2016-04-192-2/+2
| | | | | | | Use the mtd_set_ecclayout() helper instead of directly assigning the mtd->ecclayout field. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
* mtd: add mtd_set_ecclayout() helper functionBoris Brezillon2016-04-191-0/+6
| | | | | | | | Add an mtd_set_ecclayout() helper function to avoid direct accesses to the mtd->ecclayout field. This will ease future reworks of ECC layout definition. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
* mtd: onenand: use mtd_ooblayout_xxx() helpers where appropriateBoris Brezillon2016-04-191-60/+15
| | | | | | | | | The mtd_ooblayout_xxx() helper functions have been added to avoid direct accesses to the ecclayout field, and thus ease for future reworks. Use these helpers in all places where the oobfree[] and eccpos[] arrays where directly accessed. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
* mtd: nand: qcom: use mtd_ooblayout_xxx() helpers where appropriateBoris Brezillon2016-04-191-5/+3
| | | | | | | | | | The mtd_ooblayout_xxx() helper functions have been added to avoid direct accesses to ecclayout fields, and thus ease for future reworks. Use these helpers in all places where the oobfree[] and eccpos[] arrays where directly accessed. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Tested-by: Archit Taneja <architt@codeaurora.org>
* mtd: nand: omap2: use mtd_ooblayout_xxx() helpers where appropriateBoris Brezillon2016-04-191-11/+14
| | | | | | | | | The mtd_ooblayout_xxx() helper functions have been added to avoid direct accesses to the ecclayout field, and thus ease for future reworks. Use these helpers in all places where the oobfree[] and eccpos[] arrays where directly accessed. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
* mtd: nand: lpc32xx: use mtd_ooblayout_xxx() helpers where appropriateBoris Brezillon2016-04-191-3/+14
| | | | | | | | | The mtd_ooblayout_xxx() helper functions have been added to avoid direct accesses to the ecclayout field, and thus ease for future reworks. Use these helpers in all places where the oobfree[] and eccpos[] arrays where directly accessed. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
* mtd: nand: gpmi: use mtd_ooblayout_xxx() helpers where appropriateBoris Brezillon2016-04-191-4/+5
| | | | | | | | | The mtd_ooblayout_xxx() helper functions have been added to avoid direct accesses to the ecclayout field, and thus ease for future reworks. Use these helpers in all places where the oobfree[] and eccpos[] arrays where directly accessed. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
* mtd: nand: fsl_ifc: use mtd_ooblayout_xxx() helpers where appropriateBoris Brezillon2016-04-191-5/+9
| | | | | | | | | The mtd_ooblayout_xxx() helper functions have been added to avoid direct accesses to the ecclayout field, and thus ease for future reworks. Use these helpers in all places where the oobfree[] and eccpos[] arrays where directly accessed. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
* mtd: nand: atmel: use mtd_ooblayout_xxx() helpers where appropriateBoris Brezillon2016-04-191-19/+31
| | | | | | | | | | The mtd_ooblayout_xxx() helper functions have been added to avoid direct accesses to the ecclayout field, and thus ease for future reworks. Use these helpers in all places where the oobfree[] and eccpos[] arrays where directly accessed. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Reviewed-by: Nicolas Ferre <nicolas.ferre@atmel.com>
* mtd: nand: core: use mtd_ooblayout_xxx() helpers where appropriateBoris Brezillon2016-04-192-113/+100
| | | | | | | | | The mtd_ooblayout_xxx() helper functions have been added to avoid direct accesses to the ecclayout field, and thus ease for future reworks. Use these helpers in all places where the oobfree[] and eccpos[] arrays where directly accessed. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
* mtd: use mtd_ooblayout_xxx() helpers where appropriateBoris Brezillon2016-04-191-19/+88
| | | | | | | | | The mtd_ooblayout_xxx() helper functions have been added to avoid direct accesses to the ecclayout field, and thus ease for future reworks. Use these helpers in all places where the oobfree[] and eccpos[] arrays where directly accessed. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
* mtd: add mtd_ooblayout_xxx() helper functionsBoris Brezillon2016-04-192-0/+433
| | | | | | | | | | In order to make the ecclayout definition completely dynamic we need to rework the way the OOB layout are defined and iterated. Create a few mtd_ooblayout_xxx() helpers to ease OOB bytes manipulation and hide ecclayout internals to their users. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
* mtd: nand: sunxi: make cur_off parameter optional in extra oob helpersBoris Brezillon2016-04-191-4/+6
| | | | | | | Allow for NULL cur_offs values when the caller does not know where the NAND page register pointer points to. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
* mtd: nand: sunxi: make OOB retrieval optionalBoris Brezillon2016-04-191-11/+16
| | | | | | | | | sunxi_nfc_hw_ecc_read_chunk() always retrieves the ECC and protected free bytes, no matter if the user really asked for it or not. This can take a non negligible amount of time, especially on NAND chips exposing large OOB areas (> 1KB). Make it optional. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
* mtd: nand: sunxi: move some ECC related operations to their own functionsBoris Brezillon2016-04-191-55/+108
| | | | | | | | In order to support DMA operations in a clean way we need to extract some of the logic coded in sunxi_nfc_hw_ecc_read/write_page() into their own function. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
* mtd: nand: sunxi: poll for events instead of using interruptsBoris Brezillon2016-04-191-14/+31
| | | | | | | | | | | | | | Some NAND operations are so fast that it doesn't make any sense to use interrupt based waits (the scheduling overhead is not worth it). Rename sunxi_nfc_wait_int() into sunxi_nfc_wait_events() and add a parameter to specify whether polling should be used or not. Note that all sunxi_nfc_wait_int() are moved to the polling approach now, but this should change as soon as we have more information about the approximate time we are about to wait (can be extracted from the NAND timings, and the type of operation). Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
* mtd: nand: sunxi: make use of readl_poll_timeout()Boris Brezillon2016-04-191-17/+17
| | | | | | Replace open coded polling loops by readl_poll_timeout() calls. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
* mtd: nand: sunxi: fix ->dev_ready() implementationBoris Brezillon2016-04-191-7/+0
| | | | | | | ->dev_ready() is not supposed to wait for busy to ready solution (this is the role of ->waitfunc()). Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
* mtd: nand: enable ECC pipeliningBoris Brezillon2016-04-191-1/+2
| | | | | | | When the NAND controller operates in DMA mode it can pipeline ECC operations which improves the throughput. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
* mtd: nand: sunxi: disable clks on device removalBoris Brezillon2016-04-191-0/+2
| | | | | | | mod and ahb clocks are not disabled when the NAND controller device is removed. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
* mtd: nand: sunxi: fix NFC_CTL settingBoris Brezillon2016-04-191-1/+1
| | | | | | | NFC_PAGE_SHIFT() already takes the real page_shift value and subtract 10 to it. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
* mtd: nand: sunxi: fix the NFC_ECC_ERR_CNT() macroBoris Brezillon2016-04-191-1/+1
| | | | | | | NFC_ECC_ERR_CNT() is not taking into account the case when the NAND chip contains more than 4 ECC blocks (NANDs with 4kB+ pages). Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
* mtd: nand: sunxi: let the NAND controller control the CE lineBoris Brezillon2016-04-191-10/+0
| | | | | | | | We don't need to manually toggle the CE line since the controller handles it for us. Moreover, keeping the CE line low when interacting with a DDR NAND can be problematic (data loss in some corner cases). Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
* mtd: nand: sunxi: improve ->cmd_ctrl() functionBoris Brezillon2016-04-191-8/+44
| | | | | | | | Try to pack address and command cycles into a single NAND controller command to avoid polling the status register for each single change on the NAND bus. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
* mtd: nand: sunxi: implement ->read_subpage()Boris Brezillon2016-04-191-0/+36
| | | | | | | | Being able to read subpages can greatly improve read performances if the MTD user is only interested in a small section of a NAND page. This is particularly true with large pages (>= 8k). Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
* mtd: nand: sunxi: implement ->read_oob()/->write_oob()Boris Brezillon2016-04-191-0/+40
| | | | | | | | | | | Allwinner's ECC engine is capable of protecting a few bytes of the OOB area. Implement specific OOB functions to benefit from this capability. Also, when in raw mode, the randomizer is disabled, which means you'll only be able to retrieve randomized data, which is not really useful for most applications. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
* mtd: nand: export default read/write oob functionsBoris Brezillon2016-04-192-8/+24
| | | | | | | | | | | | | | Export the default read/write oob functions (for the standard and syndrome scheme), so that drivers can use them for their raw implementation and implement their own functions for the normal oob operation. This is required if your ECC engine is capable of fixing some of the OOB data. In this case you have to overload the ->read_oob() and ->write_oob(), but if you don't specify the ->read/write_oob_raw() functions they are assigned to the ->read/write_oob() implementation, which is not what you want. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
* mtd: nand: sunxi: adapt clk_rate to tWB, tADL, tWHR and tRHW timingsBoris Brezillon2016-04-191-0/+12
| | | | | | | | Adapt the NAND controller clk rate to the tWB, tADL, tWHR and tRHW timings instead of returning an error when the maximum clk divisor is not big enough to provide an appropriate timing. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
* mtd: nand: sunxi: fix EDO mode selectionBoris Brezillon2016-04-191-7/+11
| | | | | | | | | | | The ONFI spec says that EDO should be enabled if the host drives tRC less than 30ns, but the code just tests for the tRC_min value extracted from the timings exposed by the NAND chip not the timings actually configured in the NAND controller. Fix that by first rounding down the requested clk_rate with clk_round_rate() and then checking if tRC is actually smaller than 30ns. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
* mtd: nand: sunxi: fix clk rate calculationBoris Brezillon2016-04-191-5/+5
| | | | | | | Unlike what is specified in the Allwinner datasheets, the NAND clock rate is not equal to 2/T but 1/T. Fix the clock rate selection accordingly. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
* mtd: nand: sunxi: fix call order in sunxi_nand_chip_init()Boris Brezillon2016-04-191-15/+15
| | | | | | | | | sunxi_nand_chip_set_timings() is extracting a pointer to the nfc from the nand->controller field, but this field is initialized after sunxi_nand_chip_set_timings() call. Reorder the calls to avoid any problem. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
* mtd: nand: pxa3xx: rely on generic DT parsing done in nand_scan_ident()Boris Brezillon2016-04-191-17/+11
| | | | | | | | | | The core now takes care of parsing generic DT properties in nand_scan_ident() when nand_set_flash_node() has been called. Rely on this initialization instead of calling of_get_nand_xxx() manually. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Acked-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
* mtd: nand: atmel: rely on generic DT parsing done in nand_scan_ident()Boris Brezillon2016-04-191-60/+73
| | | | | | | | | | | The core now takes care of parsing generic DT properties in nand_scan_ident() when nand_set_flash_node() has been called. Rely on this initialization instead of calling of_get_nand_xxx() manually. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Tested-by: Boris Brezillon <boris.brezillon@free-electrons.com> Reviewed-by: Nicolas Ferre <nicolas.ferre@atmel.com>
* mtd: nand: pasemi: switch to dev_* printing functionsRafał Miłecki2016-04-191-8/+7
| | | | | | | | | | It also contains some minor related changes: 1) Don't warn if kzalloc fails as it dumps stack on its own 2) Use %pR format for displaying whole resource to avoid invalid format warning Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
* mtd: nand: socrates: set ECC algorithm explicitlyRafał Miłecki2016-04-191-0/+1
| | | | | | | | This is part of process deprecating NAND_ECC_SOFT_BCH (and switching to enum nand_ecc_algo). Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
* mtd: nand: plat: set ECC algorithm explicitlyRafał Miłecki2016-04-191-0/+1
| | | | | | | | This is part of process deprecating NAND_ECC_SOFT_BCH (and switching to enum nand_ecc_algo). Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
* mtd: nand: pasemi: set ECC algorithm explicitlyRafał Miłecki2016-04-191-0/+1
| | | | | | | | This is part of process deprecating NAND_ECC_SOFT_BCH (and switching to enum nand_ecc_algo). Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
* mtd: nand: orion: set ECC algorithm explicitlyRafał Miłecki2016-04-191-0/+1
| | | | | | | | This is part of process deprecating NAND_ECC_SOFT_BCH (and switching to enum nand_ecc_algo). Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
* mtd: nand: nuc900: set ECC algorithm explicitlyRafał Miłecki2016-04-191-0/+1
| | | | | | | | This is part of process deprecating NAND_ECC_SOFT_BCH (and switching to enum nand_ecc_algo). Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
* mtd: nand: mxc: set ECC algorithm explicitlyRafał Miłecki2016-04-191-0/+1
| | | | | | | | This is part of process deprecating NAND_ECC_SOFT_BCH (and switching to enum nand_ecc_algo). Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
* mtd: nand: gpio: set ECC algorithm explicitlyRafał Miłecki2016-04-191-0/+1
| | | | | | | | This is part of process deprecating NAND_ECC_SOFT_BCH (and switching to enum nand_ecc_algo). Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
* mtd: nand: ams-delta: set ECC algorithm explicitlyRafał Miłecki2016-04-191-0/+1
| | | | | | | | This is part of process deprecating NAND_ECC_SOFT_BCH (and switching to enum nand_ecc_algo). Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
* mtd: nand: brcm: rely on generic DT parsing done in nand_scan_ident()Boris Brezillon2016-04-191-3/+2
| | | | | | | | | | The core now takes care of parsing generic DT properties in nand_scan_ident() when nand_set_flash_node() has been called. Rely on this initialization instead of calling of_get_nand_xxx() manually. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Acked-by: Brian Norris <computersforpeace@gmail.com>
* mtd: nand: omap2: rely on generic DT parsing done in nand_scan_ident()Boris Brezillon2016-04-192-13/+9
| | | | | | | | | | | The core now takes care of parsing generic DT properties in nand_scan_ident() when nand_set_flash_node() has been called. Rely on this initialization instead of calling of_get_nand_xxx() manually. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Acked-by: Roger Quadros <rogerq@ti.com> Tested-by: Franklin S Cooper Jr. <fcooper@ti.com>
* mtd: nand: remove unneeded of_mtd.h inclusionsBoris Brezillon2016-04-195-5/+0
| | | | | | | | Some drivers are including linux/of_mtd.h even if they don't use any of the of_get_nand_xxx() helpers. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Acked-by: Harvey Hunt <harvey.hunt@imgtec.com>
* mtd: nand: s3c2410: fix bug in s3c2410_nand_correct_data()Zhaoxiu Zeng2016-04-191-1/+2
| | | | | | | | | | If there is only one bit difference in the ECC, the function should return 1. The result of "diff0 & ~(1<<fls(diff0))" is equal to diff0, so the function actually returns -1. Signed-off-by: Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
* mtd/ifc: Add support for IFC controller version 2.0Raghav Dogra2016-04-193-66/+87
| | | | | | | | | | | | | | | The new IFC controller version 2.0 has a different memory map page. Upto IFC 1.4 PAGE size is 4 KB and from IFC2.0 PAGE size is 64KB. This patch segregates the IFC global and runtime registers to appropriate PAGE sizes. Signed-off-by: Jaiprakash Singh <b44839@freescale.com> Signed-off-by: Raghav Dogra <raghav@freescale.com> Acked-by: Li Yang <leoyang.li@nxp.com> Signed-off-by: Raghav Dogra <raghav.dogra@nxp.com> Acked-by: Scott Wood <oss@buserror.net> Acked-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
* mtd: nand: Remove BUG() abuse in nand_scan_tailEzequiel García2016-04-191-19/+33
| | | | | | | | | | | There's no reason to BUG() when parameters are being validated. Drivers can get things wrong, and it's much nicer to just throw a noisy warn and fail gracefully, than calling BUG() and throwing the whole system down the drain. Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Reviewed-by: Richard Weinberger <richard@nod.at> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
* mtd: gpmi: fix raw_buffer pointer double free issueHan Xu2016-04-191-0/+1
| | | | | | | | | | | | fix the raw_buffer pointer double free issue found by coverify. CID 18344 (#2 of 2): Double free (USE_AFTER_FREE) 3. double_free: Calling gpmi_alloc_dma_buffer frees pointer this->raw_buffer which has already been freed Signed-off-by: Han Xu <han.xu@nxp.com> Reviewed-by: Richard Weinberger <richard@nod.at> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
* mtd: brcmnand: Add support for v6.2 controllersFlorian Fainelli2016-04-192-1/+3
| | | | | | | | | | | | | Document and match the brcm,brcmnand-v6.2 compatible string, the controller has a register layout identical to the v6.0 version and supports prefetch. Update the command shift logic to account for v6.2 controller which are the first ones to use a shift of 0 (6.1 used a shift of 24). Signed-off-by: Kamal Dasu <kdasu.kdev@gmail.com> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Acked-by: Rob Herring <robh@kernel.org> Acked-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
OpenPOWER on IntegriCloud