aboutsummaryrefslogtreecommitdiff
path: root/drivers/mtd/nand/raw
AgeCommit message (Collapse)AuthorFilesLines
2018-08-09Merge branch 'asoc-4.19' into asoc-nextMark Brown1-16/+1
2018-08-01mtd: rawnand: allocate dynamically ONFI parameters during detectionMiquel Raynal3-29/+44
Now that it is possible to do dynamic allocations during the identification phase, convert the onfi_params structure (which is only needed with ONFI compliant chips) into a pointer that will be allocated only if needed. Signed-off-by: Miquel Raynal <[email protected]> Reviewed-by: Boris Brezillon <[email protected]>
2018-07-31mtd: rawnand: allocate model parameter dynamicallyMiquel Raynal1-11/+41
Thanks to the migration of all drivers to use nand_scan() and the related nand_controller_ops, we can now allocate data during the detection phase. Let's do it first for the NAND model parameter which is allocated in nand_detect(). Signed-off-by: Miquel Raynal <[email protected]> Reviewed-by: Boris Brezillon <[email protected]>
2018-07-31mtd: rawnand: do not export nand_scan_[ident|tail]() anymoreMiquel Raynal1-7/+9
Both nand_scan_ident() and nand_scan_tail() helpers used to be called directly from controller drivers that needed to tweak some ECC-related parameters before nand_scan_tail(). This separation prevented dynamic allocations during the phase of NAND identification, which was inconvenient. All controller drivers have been moved to use nand_scan(), in conjunction with the chip->ecc.[attach|detach]_chip() hooks that actually do the required tweaking sequence between both ident/tail calls, allowing programmers to use dynamic allocation as they need all across the scanning sequence. Declare nand_scan_[ident|tail]() statically now. Signed-off-by: Miquel Raynal <[email protected]> Reviewed-by: Boris Brezillon <[email protected]>
2018-07-31mtd: rawnand: txx9ndfmc: convert driver to nand_scan()Miquel Raynal1-17/+17
Two helpers have been added to the core to do all kind of controller side configuration/initialization between the detection phase and the final NAND scan. Implement these hooks so that we can convert the driver to just use nand_scan() instead of the nand_scan_ident() + nand_scan_tail() pair. Signed-off-by: Miquel Raynal <[email protected]> Reviewed-by: Boris Brezillon <[email protected]>
2018-07-31mtd: rawnand: txx9ndfmc: clarify ECC parameters assignationMiquel Raynal1-4/+4
A comment in the probe declares that values are assigned to ecc.size and ecc.bytes, but these values will be overwritten. This is not entirely right as they are overwritten only if mtd->writesize >= 512. Let's clarify this by moving these assignations to txx9ndfmc_nand_scan(). Signed-off-by: Miquel Raynal <[email protected]> Reviewed-by: Boris Brezillon <[email protected]>
2018-07-31mtd: rawnand: tegra: convert driver to nand_scan()Miquel Raynal1-74/+88
Two helpers have been added to the core to do all kind of controller side configuration/initialization between the detection phase and the final NAND scan. Implement these hooks so that we can convert the driver to just use nand_scan() instead of the nand_scan_ident() + nand_scan_tail() pair. Signed-off-by: Miquel Raynal <[email protected]> Reviewed-by: Boris Brezillon <[email protected]>
2018-07-31mtd: rawnand: jz4740: convert driver to nand_scan()Miquel Raynal1-12/+20
Two helpers have been added to the core to do all kind of controller side configuration/initialization between the detection phase and the final NAND scan. Implement these hooks so that we can convert the driver to just use nand_scan() instead of the nand_scan_ident() + nand_scan_tail() pair. Signed-off-by: Miquel Raynal <[email protected]> Reviewed-by: Boris Brezillon <[email protected]>
2018-07-31mtd: rawnand: jz4740: group nand_scan_{ident, tail} callsMiquel Raynal1-12/+11
Prepare the migration to nand_scan() by moving both calls to nand_scan_ident() and nand_scan_tail() in a single spot. Signed-off-by: Miquel Raynal <[email protected]> Reviewed-by: Boris Brezillon <[email protected]>
2018-07-31mtd: rawnand: jz4740: fix probe function error pathMiquel Raynal1-3/+3
An error after nand_scan_tail() should trigger a nand_cleanup(), not a nand_release() as mtd_device_register() (or one of its variants) has not been called and there is no need to deregister any MTD device yet. Signed-off-by: Miquel Raynal <[email protected]> Reviewed-by: Boris Brezillon <[email protected]>
2018-07-31mtd: rawnand: docg4: convert driver to nand_scan()Miquel Raynal1-26/+45
Two helpers have been added to the core to do all kind of controller side configuration/initialization between the detection phase and the final NAND scan. Implement these hooks so that we can convert the driver to just use nand_scan() instead of the nand_scan_ident() + nand_scan_tail() pair. Signed-off-by: Miquel Raynal <[email protected]> Reviewed-by: Boris Brezillon <[email protected]> Signed-off-by: Miquel Raynal <[email protected]>
2018-07-31mtd: rawnand: do not execute nand_scan_ident() if maxchips is zeroMiquel Raynal1-4/+8
Some driver (eg. docg4) will need to handle themselves the identification phase. As part of the migration to use nand_scan() everywhere (which will unconditionnaly call nand_scan_ident()), we add a condition at the start of nand_scan_with_ids() to jump over nand_scan_ident() if the maxchips parameters is zero, meaning that the driver does not want the core to handle this phase. Signed-off-by: Miquel Raynal <[email protected]> Reviewed-by: Boris Brezillon <[email protected]>
2018-07-31mtd: rawnand: atmel: convert driver to nand_scan()Miquel Raynal1-59/+54
Two helpers have been added to the core to do all kind of controller side configuration/initialization between the detection phase and the final NAND scan. Implement these hooks so that we can convert the driver to just use nand_scan() instead of the nand_scan_ident() + nand_scan_tail() pair. Signed-off-by: Miquel Raynal <[email protected]> Reviewed-by: Boris Brezillon <[email protected]>
2018-07-31mtd: rawnand: atmel: clarify NAND addition/removal pathsMiquel Raynal1-57/+45
No need for an atmel_nand_register() function, let's move the code in it directly where the function was called: in atmel_nand_controller_add_nand(). To make things consistent, also rename atmel_nand_unregister() into atmel_nand_controller_remove_nand(). Signed-off-by: Miquel Raynal <[email protected]> Reviewed-by: Boris Brezillon <[email protected]>
2018-07-31mtd: rawnand: omap2: convert driver to nand_scan()Miquel Raynal1-233/+230
Two helpers have been added to the core to do all kind of controller side configuration/initialization between the detection phase and the final NAND scan. Implement these hooks so that we can convert the driver to just use nand_scan() instead of the nand_scan_ident() + nand_scan_tail() pair. Signed-off-by: Miquel Raynal <[email protected]> Reviewed-by: Boris Brezillon <[email protected]>
2018-07-31mtd: rawnand: lpc32xx_mlc: convert driver to nand_scan()Miquel Raynal1-28/+33
Two helpers have been added to the core to do all kind of controller side configuration/initialization between the detection phase and the final NAND scan. Implement these hooks so that we can convert the driver to just use nand_scan() instead of the nand_scan_ident() + nand_scan_tail() pair. Signed-off-by: Miquel Raynal <[email protected]> Reviewed-by: Boris Brezillon <[email protected]>
2018-07-31mtd: rawnand: cafe: convert driver to nand_scan()Miquel Raynal1-57/+78
Two helpers have been added to the core to do all kind of controller side configuration/initialization between the detection phase and the final NAND scan. Implement these hooks so that we can convert the driver to just use nand_scan() instead of the nand_scan_ident() + nand_scan_tail() pair. Signed-off-by: Miquel Raynal <[email protected]> Reviewed-by: Boris Brezillon <[email protected]>
2018-07-31mtd: rawnand: brcmnand: convert driver to nand_scan()Miquel Raynal1-27/+36
Two helpers have been added to the core to do all kind of controller side configuration/initialization between the detection phase and the final NAND scan. Implement these hooks so that we can convert the driver to just use nand_scan() instead of the nand_scan_ident() + nand_scan_tail() pair. Signed-off-by: Miquel Raynal <[email protected]> Reviewed-by: Boris Brezillon <[email protected]>
2018-07-31mtd: rawnand: qcom: convert driver to nand_scan()Miquel Raynal1-47/+24
Two helpers have been added to the core to do all kind of controller side configuration/initialization between the detection phase and the final NAND scan. Implement these hooks so that we can convert the driver to just use nand_scan() instead of the nand_scan_ident() + nand_scan_tail() pair. Signed-off-by: Miquel Raynal <[email protected]> Reviewed-by: Boris Brezillon <[email protected]>
2018-07-31mtd: rawnand: sm_common: convert driver to nand_scan_with_ids()Miquel Raynal1-13/+20
Two helpers have been added to the core to do all kind of controller side configuration/initialization between the detection phase and the final NAND scan. Implement these hooks so that we can convert the driver to just use nand_scan_with_ids() (alternative to nand_scan() for passing a flash IDs table) instead of the nand_scan_ident() + nand_scan_tail() pair. Signed-off-by: Miquel Raynal <[email protected]> Reviewed-by: Boris Brezillon <[email protected]>
2018-07-31mtd: rawnand: sm_common: fix the probe function error pathMiquel Raynal1-1/+5
nand_cleanup() should be called upon error after a successful nand_scan_tail(). Rework the error path to follow this rule . Signed-off-by: Miquel Raynal <[email protected]>
2018-07-31mtd: rawnand: vf610: convert driver to nand_scan()Miquel Raynal1-61/+66
Two helpers have been added to the core to do all kind of controller side configuration/initialization between the detection phase and the final NAND scan. Implement these hooks so that we can convert the driver to just use nand_scan() instead of the nand_scan_ident() + nand_scan_tail() pair. Signed-off-by: Miquel Raynal <[email protected]> Reviewed-by: Boris Brezillon <[email protected]> Reviewed-by: Stefan Agner <[email protected]>
2018-07-31mtd: rawnand: txx9ndfmc: rename nand controller internal structureMiquel Raynal1-3/+3
As already done in the core, calling a struct nand_controller 'hw_control' is misleading. Use the same name as in nand_base.c: 'controller'. Signed-off-by: Miquel Raynal <[email protected]> Reviewed-by: Boris Brezillon <[email protected]> Signed-off-by: Miquel Raynal <[email protected]>
2018-07-31mtd: rawnand: tango: convert driver to nand_scan()Miquel Raynal1-16/+24
Two helpers have been added to the core to do all kind of controller side configuration/initialization between the detection phase and the final NAND scan. Implement these hooks so that we can convert the driver to just use nand_scan() instead of the nand_scan_ident() + nand_scan_tail() pair. Signed-off-by: Miquel Raynal <[email protected]> Reviewed-by: Boris Brezillon <[email protected]>
2018-07-31mtd: rawnand: sunxi: convert driver to nand_scan()Miquel Raynal1-24/+19
Two helpers have been added to the core to do all kind of controller side configuration/initialization between the detection phase and the final NAND scan. Implement these hooks so that we can convert the driver to just use nand_scan() instead of the nand_scan_ident() + nand_scan_tail() pair. Signed-off-by: Miquel Raynal <[email protected]> Reviewed-by: Boris Brezillon <[email protected]>
2018-07-31mtd: rawnand: sh_flctl: convert driver to nand_scan()Miquel Raynal1-21/+15
Two helpers have been added to the core to do all kind of controller side configuration/initialization between the detection phase and the final NAND scan. Implement these hooks so that we can convert the driver to just use nand_scan() instead of the nand_scan_ident() + nand_scan_tail() pair. Signed-off-by: Miquel Raynal <[email protected]> Reviewed-by: Boris Brezillon <[email protected]>
2018-07-31mtd: rawnand: s3c2410: convert driver to nand_scan()Miquel Raynal1-17/+13
Two helpers have been added to the core to do all kind of controller side configuration/initialization between the detection phase and the final NAND scan. Implement these hooks so that we can convert the driver to just use nand_scan() instead of the nand_scan_ident() + nand_scan_tail() pair. Signed-off-by: Miquel Raynal <[email protected]> Reviewed-by: Boris Brezillon <[email protected]>
2018-07-31mtd: rawnand: nandsim: convert driver to nand_scan()Miquel Raynal1-37/+45
Two helpers have been added to the core to do all kind of controller side configuration/initialization between the detection phase and the final NAND scan. Implement these hooks so that we can convert the driver to just use nand_scan() instead of the nand_scan_ident() + nand_scan_tail() pair. Signed-off-by: Miquel Raynal <[email protected]> Reviewed-by: Boris Brezillon <[email protected]>
2018-07-31mtd: rawnand: mxc: convert driver to nand_scan()Miquel Raynal1-65/+71
Two helpers have been added to the core to do all kind of controller side configuration/initialization between the detection phase and the final NAND scan. Implement these hooks so that we can convert the driver to just use nand_scan() instead of the nand_scan_ident() + nand_scan_tail() pair. Signed-off-by: Miquel Raynal <[email protected]> Reviewed-by: Boris Brezillon <[email protected]>
2018-07-31mtd: rawnand: mtk: convert driver to nand_scan()Miquel Raynal1-31/+44
Two helpers have been added to the core to do all kind of controller side configuration/initialization between the detection phase and the final NAND scan. Implement these hooks so that we can convert the driver to just use nand_scan() instead of the nand_scan_ident() + nand_scan_tail() pair. Signed-off-by: Miquel Raynal <[email protected]> Reviewed-by: Boris Brezillon <[email protected]> Acked-by: Xiaolei Li <[email protected]>
2018-07-31mtd: rawnand: marvell: convert driver to nand_scan()Miquel Raynal1-97/+108
Two helpers have been added to the core to do all kind of controller side configuration/initialization between the detection phase and the final NAND scan. Implement these hooks so that we can convert the driver to just use nand_scan() instead of the nand_scan_ident() + nand_scan_tail() pair. Signed-off-by: Miquel Raynal <[email protected]> Reviewed-by: Boris Brezillon <[email protected]>
2018-07-31mtd: rawnand: lpc32xx_slc: convert driver to nand_scan()Miquel Raynal1-35/+42
Two helpers have been added to the core to do all kind of controller side configuration/initialization between the detection phase and the final NAND scan. Implement these hooks so that we can convert the driver to just use nand_scan() instead of the nand_scan_ident() + nand_scan_tail() pair. Signed-off-by: Miquel Raynal <[email protected]> Reviewed-by: Boris Brezillon <[email protected]>
2018-07-31mtd: rawnand: jz4780: convert driver to nand_scan()Miquel Raynal1-18/+16
Two helpers have been added to the core to do all kind of controller side configuration/initialization between the detection phase and the final NAND scan. Implement these hooks so that we can convert the driver to just use nand_scan() instead of the nand_scan_ident() + nand_scan_tail() pair. Signed-off-by: Miquel Raynal <[email protected]> Acked-by: Harvey Hunt <[email protected]> Reviewed-by: Boris Brezillon <[email protected]>
2018-07-31mtd: rawnand: hisi504: convert driver to nand_scan()Miquel Raynal1-34/+44
Two helpers have been added to the core to do all kind of controller side configuration/initialization between the detection phase and the final NAND scan. Implement these hooks so that we can convert the driver to just use nand_scan() instead of the nand_scan_ident() + nand_scan_tail() pair. Signed-off-by: Miquel Raynal <[email protected]> Reviewed-by: Boris Brezillon <[email protected]>
2018-07-31mtd: rawnand: gpmi: convert driver to nand_scan()Miquel Raynal1-23/+33
Two helpers have been added to the core to do all kind of controller side configuration/initialization between the detection phase and the final NAND scan. Implement these hooks so that we can convert the driver to just use nand_scan() instead of the nand_scan_ident() + nand_scan_tail() pair. Signed-off-by: Miquel Raynal <[email protected]> Reviewed-by: Boris Brezillon <[email protected]>
2018-07-31mtd: rawnand: fsmc: convert driver to nand_scan()Miquel Raynal1-70/+78
Two helpers have been added to the core to do all kind of controller side configuration/initialization between the detection phase and the final NAND scan. Implement these hooks so that we can convert the driver to just use nand_scan() instead of the nand_scan_ident() + nand_scan_tail() pair. Signed-off-by: Miquel Raynal <[email protected]> Reviewed-by: Boris Brezillon <[email protected]>
2018-07-31mtd: rawnand: fsl_ifc: convert driver to nand_scan()Miquel Raynal1-11/+8
Two helpers have been added to the core to do all kind of controller side configuration/initialization between the detection phase and the final NAND scan. Implement these hooks so that we can convert the driver to just use nand_scan() instead of the nand_scan_ident() + nand_scan_tail() pair. Signed-off-by: Miquel Raynal <[email protected]> Reviewed-by: Boris Brezillon <[email protected]>
2018-07-31mtd: rawnand: fsl_elbc: convert driver to nand_scan()Miquel Raynal1-11/+8
Two helpers have been added to the core to do all kind of controller side configuration/initialization between the detection phase and the final NAND scan. Implement these hooks so that we can convert the driver to just use nand_scan() instead of the nand_scan_ident() + nand_scan_tail() pair. Signed-off-by: Miquel Raynal <[email protected]> Reviewed-by: Boris Brezillon <[email protected]> Notes: "pw 947037"
2018-07-31mtd: rawnand: fsl_elbc: return meaningful valuesMiquel Raynal1-1/+1
Return -ENOTSUPP instead of -1 from ->chip_init_tail() before migrating this driver to use nand_scan() and transform this function to be a callback run by the core. Signed-off-by: Miquel Raynal <[email protected]>
2018-07-31mtd: rawnand: denali: convert to nand_scan()Miquel Raynal1-62/+77
Two helpers have been added to the core to do all kind of controller side configuration/initialization between the detection phase and the final NAND scan. Implement these hooks so that we can convert the driver to just use nand_scan() instead of the nand_scan_ident() + nand_scan_tail() pair. Signed-off-by: Miquel Raynal <[email protected]> Reviewed-by: Boris Brezillon <[email protected]> Acked-by: Masahiro Yamada <[email protected]>
2018-07-31mtd: rawnand: davinci: convert driver to nand_scan()Miquel Raynal1-93/+102
Two helpers have been added to the core to do all kind of controller side configuration/initialization between the detection phase and the final NAND scan. Implement these hooks so that we can convert the driver to just use nand_scan() instead of the nand_scan_ident() + nand_scan_tail() pair. Also change the unused "struct device *dev" parameter of the driver structure into a platform device to reuse it in the ->attach_chip() hook. Signed-off-by: Miquel Raynal <[email protected]> Reviewed-by: Boris Brezillon <[email protected]>
2018-07-31mtd: rawnand: au1550nd: Remove unneeded gpio.h inclusionBoris Brezillon1-1/+0
We don't use the GPIO API in this driver, let's just remove the <linux/gpio.h> inclusion. Signed-off-by: Boris Brezillon <[email protected]> Signed-off-by: Miquel Raynal <[email protected]>
2018-07-31mtd: rawnand: atmel: Stop including gpio.hBoris Brezillon1-1/+0
gpio/consumer.h defines everything we need, and it's clearly stated in gpio.h that GPIO consumers should directly stop including gpio.h if they can. Signed-off-by: Boris Brezillon <[email protected]> Signed-off-by: Miquel Raynal <[email protected]>
2018-07-31mtd: rawnand: sunxi: Remove gpio.h and of_gpio.h inclusionsBoris Brezillon1-2/+0
Commit ddd5ed3a90e7 ("mtd: rawnand: sunxi: Remove support for GPIO-based Ready/Busy polling") removed GPIO-based RB polling. We no longer need to include gpio headers. Signed-off-by: Boris Brezillon <[email protected]> Signed-off-by: Miquel Raynal <[email protected]>
2018-07-31mtd: rawnand: jz4740: Include gpio/consumer.h instead of gpio.hBoris Brezillon1-1/+2
GPIO consumers should no longer include <linux/gpio.h>, and instead include <linux/gpio/consumer.h>. Also, explicitly include <include/io.h> since it seems to be missing after switching to <linux/gpio/consumer.h>. This fixes a build error when selecting the driver without selecting GPIOLIB, which can happen when COMPILE_TEST=y. Fixes: 6968e07e8169 ("mtd: rawnand: jz4740: Allow selection of this driver when COMPILE_TEST=y") Reported-by: Miquel Raynal <[email protected]> Signed-off-by: Boris Brezillon <[email protected]> Signed-off-by: Miquel Raynal <[email protected]>
2018-07-31mtd: rawnand: add hooks that may be called during nand_scan()Miquel Raynal1-2/+30
In order to remove the limitation that forbids dynamic allocation in nand_scan_ident(), we must create a path that will be the same for all controller drivers. The idea is to use nand_scan() instead of the widely used nand_scan_ident()/nand_scan_tail() couple. In order to achieve this, controller drivers will need to adjust some parameters between these two functions depending on the NAND chip wired on them. This takes the form of two new hooks (->{attach,detach}_chip()) that are placed in a new nand_controller_ops structure, which is then attached to the nand_controller object at driver initialization time. ->attach_chip() is called between nand_scan_ident() and nand_scan_tail(), and ->detach_chip() is called in the error path of nand_scan() and in nand_cleanup(). Note that some NAND controller drivers don't have a dedicated nand_controller object and instead rely on the default/dummy one embedded in nand_chip. If you're in this case and still want to initialize the controller ops, you'll have to manipulate chip->dummy_controller directly. Last but not least, it's worth mentioning that we plan to move some of the controller related hooks placed in nand_chip into nand_controller_ops to make the separation between NAND chip and NAND controller methods clearer. Signed-off-by: Miquel Raynal <[email protected]> Acked-by: Boris Brezillon <[email protected]>
2018-07-31mtd: rawnand: better name for the controller structureMiquel Raynal18-41/+42
In the raw NAND core, a NAND chip is described by a nand_chip structure, while a NAND controller is described with a nand_hw_control structure which is not very meaningful. Rename this structure nand_controller. As the structure gets renamed, it is logical to also rename the core function initializing it from nand_hw_control_init() to nand_controller_init(). Lastly, the 'hwcontrol' entry of the nand_chip structure is not meaningful neither while it has the role of fallback when no controller structure is provided by the driver (the controller driver is dumb and can only control a single chip). Thus, it is renamed dummy_controller. Signed-off-by: Miquel Raynal <[email protected]> Acked-by: Boris Brezillon <[email protected]>
2018-07-31mtd: rawnand: Remove unused caller_is_module() definitionBoris Brezillon1-12/+0
Commit 260e89a6e0d6 ("mtd: core: tone down suggestion that dev.parent should be set") removed the only user of caller_is_module() but forgot to remove the definition itself. Let's remove it now. Signed-off-by: Boris Brezillon <[email protected]> Signed-off-by: Miquel Raynal <[email protected]>
2018-07-31mtd: rawnand: s3c2410: Error out when ->nrsets < 0 or ->sets == NULLBoris Brezillon1-6/+8
All of the code in the probe path assumes ->sets != NULL and ->nrsets > 0. Error out if that's not the case to avoid dereferencing a NULL pointer. Reported-by: Dan Carpenter <[email protected]> Signed-off-by: Boris Brezillon <[email protected]> Signed-off-by: Miquel Raynal <[email protected]>
2018-07-31mtd: rawnand: make subop helpers return unsigned valuesMiquel Raynal1-22/+22
A report from Colin Ian King pointed a CoverityScan issue where error values on these helpers where not checked in the drivers. These helpers can error out only in case of a software bug in driver code, not because of a runtime/hardware error. Hence, let's WARN_ON() in this case and return 0 which is harmless anyway. Fixes: 8878b126df76 ("mtd: nand: add ->exec_op() implementation") Signed-off-by: Miquel Raynal <[email protected]> Reviewed-by: Boris Brezillon <[email protected]> Signed-off-by: Miquel Raynal <[email protected]>