platform/kernel/linux-rpi.git
8 years agomtd: nand: remove unused and buggy get_platform_nandchip() helper function
Boris BREZILLON [Mon, 14 Dec 2015 15:13:31 +0000 (16:13 +0100)]
mtd: nand: remove unused and buggy get_platform_nandchip() helper function

Nobody uses the get_platform_nandchip() helper function which is supposed
to return a pointer to a platform_nand_chip struct from an mtd_info
pointer.
Moreover, this function is buggy since the introduction of the plat_nand
layer (chip->priv is now storing a pointer to an intermediate
plat_nand_data structure allocated in plat_nand_probe(), and we have no
way to retrieve a pointer to the provided platform_nand_chip struct from
this plat_nand_data pointer).

While we are at it, remove the useless (and buggy, since it's pointing to
something stored on the stack) data->chip.priv assignment.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Fixes: 711fdf627ce1 ("[MTD] [NAND] platform NAND driver: add driver")
Cc: Vitaly Wool <vitalywool@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: kill the chip->flash_node field
Boris BREZILLON [Thu, 10 Dec 2015 08:00:38 +0000 (09:00 +0100)]
mtd: nand: kill the chip->flash_node field

Now that the nand_chip struct directly embeds an mtd_info struct we can
get rid of the ->flash_node field and forward set/get_flash_node requests
to the MTD layer.

As a side effect, we no longer need the mtd_set_of_node() call done in
nand_dt_init().

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: simplify nand_dt_init() usage
Boris BREZILLON [Thu, 10 Dec 2015 08:00:37 +0000 (09:00 +0100)]
mtd: nand: simplify nand_dt_init() usage

nand_dt_init() function requires 3 arguments where it actually needs one
(dn and mtd can both be retrieved from chip). Drop these parameters.

Testing for dn != NULL inside nand_dt_init() also helps simplifying the
caller code.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agostaging: mt29f_spinand: remove useless mtd->priv = chip assignment
Boris BREZILLON [Thu, 10 Dec 2015 08:00:36 +0000 (09:00 +0100)]
staging: mt29f_spinand: remove useless mtd->priv = chip assignment

mtd_to_nand() now uses the container_of() approach to transform an
mtd_info pointer into a nand_chip one. Drop useless mtd->priv
assignments from NAND controller drivers.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agocris: nand: remove useless mtd->priv = chip assignments
Boris BREZILLON [Thu, 10 Dec 2015 08:00:35 +0000 (09:00 +0100)]
cris: nand: remove useless mtd->priv = chip assignments

mtd_to_nand() now uses the container_of() approach to transform an
mtd_info pointer into a nand_chip one. Drop useless mtd->priv
assignments from NAND controller drivers.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: Jesper Nilsson <jesper.nilsson@axis.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: remove useless mtd->priv = chip assignments
Boris BREZILLON [Thu, 10 Dec 2015 08:00:34 +0000 (09:00 +0100)]
mtd: nand: remove useless mtd->priv = chip assignments

mtd_to_nand() now uses the container_of() approach to transform an
mtd_info pointer into a nand_chip one. Drop useless mtd->priv
assignments from NAND controller drivers.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: update mtd_to_nand()
Boris BREZILLON [Thu, 10 Dec 2015 08:00:33 +0000 (09:00 +0100)]
mtd: nand: update mtd_to_nand()

Now that all drivers are using the mtd instance embedded in the nand_chip
struct we can safely update the mtd_to_nand() implementation to use
the container_of macro instead of returning the content of mtd->priv.
This will allow us to remove mtd->priv = chip assignments done in all
NAND controller drivers.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: denali: use the mtd instance embedded in struct nand_chip
Boris BREZILLON [Fri, 11 Dec 2015 14:06:00 +0000 (15:06 +0100)]
mtd: nand: denali: use the mtd instance embedded in struct nand_chip

struct nand_chip now embeds an mtd device. Make use of this mtd instance.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: socrates: use the mtd instance embedded in struct nand_chip
Boris BREZILLON [Fri, 11 Dec 2015 14:04:06 +0000 (15:04 +0100)]
mtd: nand: socrates: use the mtd instance embedded in struct nand_chip

struct nand_chip now embeds an mtd device. Make use of this mtd instance.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: bcm47xx: use the mtd instance embedded in struct nand_chip
Boris BREZILLON [Thu, 10 Dec 2015 07:59:52 +0000 (08:59 +0100)]
mtd: nand: bcm47xx: use the mtd instance embedded in struct nand_chip

struct nand_chip now embeds an mtd device. Make use of this mtd instance.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agocris: nand: use the mtd instance embedded in struct nand_chip
Boris BREZILLON [Thu, 10 Dec 2015 08:00:32 +0000 (09:00 +0100)]
cris: nand: use the mtd instance embedded in struct nand_chip

struct nand_chip now embeds an mtd device. Patch all drivers to make use
of this mtd instance instead of using the instance embedded in their
private struct or dynamically allocated.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: Jesper Nilsson <jesper.nilsson@axis.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agostaging: mt29f_spinand: use the mtd instance embedded in struct nand_chip
Boris BREZILLON [Thu, 10 Dec 2015 08:00:31 +0000 (09:00 +0100)]
staging: mt29f_spinand: use the mtd instance embedded in struct nand_chip

struct nand_chip now embeds an mtd device, use it instead of allocating
a new one.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: docg4: simplify error case
Brian Norris [Fri, 18 Dec 2015 19:39:53 +0000 (11:39 -0800)]
mtd: nand: docg4: simplify error case

Other refactorings have left the 'fail' label much simpler, so it
shouldn't have to handle the failed allocation case.

This also fixes a -Wshadow warning.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: s3c2410: use the mtd instance embedded in struct nand_chip
Boris BREZILLON [Thu, 10 Dec 2015 08:00:22 +0000 (09:00 +0100)]
mtd: nand: s3c2410: use the mtd instance embedded in struct nand_chip

struct nand_chip now embeds an mtd device. Make use of this mtd instance.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: update the documentation to reflect framework changes
Boris BREZILLON [Thu, 10 Dec 2015 08:00:30 +0000 (09:00 +0100)]
mtd: nand: update the documentation to reflect framework changes

The MTD device is now directly embedded in the nand_chip struct. Update the
mtdnand documentation to mention this aspect and fix the different
examples.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: vf610: use the mtd instance embedded in struct nand_chip
Boris BREZILLON [Thu, 10 Dec 2015 08:00:29 +0000 (09:00 +0100)]
mtd: nand: vf610: use the mtd instance embedded in struct nand_chip

struct nand_chip now embeds an mtd device. Make use of this mtd instance.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: txx9ndfmc: use the mtd instance embedded in struct nand_chip
Boris BREZILLON [Thu, 10 Dec 2015 08:00:28 +0000 (09:00 +0100)]
mtd: nand: txx9ndfmc: use the mtd instance embedded in struct nand_chip

struct nand_chip now embeds an mtd device. Make use of this mtd instance.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: tmio: use the mtd instance embedded in struct nand_chip
Boris BREZILLON [Thu, 10 Dec 2015 08:00:27 +0000 (09:00 +0100)]
mtd: nand: tmio: use the mtd instance embedded in struct nand_chip

struct nand_chip now embeds an mtd device. Make use of this mtd instance.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: sunxi: use the mtd instance embedded in struct nand_chip
Boris BREZILLON [Thu, 10 Dec 2015 08:00:26 +0000 (09:00 +0100)]
mtd: nand: sunxi: use the mtd instance embedded in struct nand_chip

struct nand_chip now embeds an mtd device. Make use of this mtd instance.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: sharpsl: use the mtd instance embedded in struct nand_chip
Boris BREZILLON [Thu, 10 Dec 2015 08:00:24 +0000 (09:00 +0100)]
mtd: nand: sharpsl: use the mtd instance embedded in struct nand_chip

struct nand_chip now embeds an mtd device. Make use of this mtd instance.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: sh_flctl: use the mtd instance embedded in struct nand_chip
Boris BREZILLON [Thu, 10 Dec 2015 08:00:23 +0000 (09:00 +0100)]
mtd: nand: sh_flctl: use the mtd instance embedded in struct nand_chip

struct nand_chip now embeds an mtd device. Make use of this mtd instance.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: r852: use the mtd instance embedded in struct nand_chip
Boris BREZILLON [Thu, 10 Dec 2015 08:00:21 +0000 (09:00 +0100)]
mtd: nand: r852: use the mtd instance embedded in struct nand_chip

struct nand_chip now embeds an mtd device. Make use of this mtd instance.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: pxa3xx: use the mtd instance embedded in struct nand_chip
Boris BREZILLON [Thu, 10 Dec 2015 08:00:20 +0000 (09:00 +0100)]
mtd: nand: pxa3xx: use the mtd instance embedded in struct nand_chip

struct nand_chip now embeds an mtd device. Make use of this mtd instance.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: plat: use the mtd instance embedded in struct nand_chip
Boris BREZILLON [Thu, 10 Dec 2015 08:00:19 +0000 (09:00 +0100)]
mtd: nand: plat: use the mtd instance embedded in struct nand_chip

struct nand_chip now embeds an mtd device. Make use of this mtd instance.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: pasemi: use the mtd instance embedded in struct nand_chip
Boris BREZILLON [Thu, 10 Dec 2015 08:00:18 +0000 (09:00 +0100)]
mtd: nand: pasemi: use the mtd instance embedded in struct nand_chip

struct nand_chip now embeds an mtd device. Make use of this mtd instance.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: orion: use the mtd instance embedded in struct nand_chip
Boris BREZILLON [Thu, 10 Dec 2015 08:00:17 +0000 (09:00 +0100)]
mtd: nand: orion: use the mtd instance embedded in struct nand_chip

struct nand_chip now embeds an mtd device. Make use of this mtd instance.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: omap2: use the mtd instance embedded in struct nand_chip
Boris BREZILLON [Thu, 10 Dec 2015 08:00:16 +0000 (09:00 +0100)]
mtd: nand: omap2: use the mtd instance embedded in struct nand_chip

struct nand_chip now embeds an mtd device. Make use of this mtd instance.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: nuc900: use the mtd instance embedded in struct nand_chip
Boris BREZILLON [Thu, 10 Dec 2015 08:00:15 +0000 (09:00 +0100)]
mtd: nand: nuc900: use the mtd instance embedded in struct nand_chip

struct nand_chip now embeds an mtd device. Make use of this mtd instance.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: ndfc: use the mtd instance embedded in struct nand_chip
Boris BREZILLON [Thu, 10 Dec 2015 08:00:14 +0000 (09:00 +0100)]
mtd: nand: ndfc: use the mtd instance embedded in struct nand_chip

struct nand_chip now embeds an mtd device. Make use of this mtd instance.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: nandsim: use the mtd instance embedded in struct nand_chip
Boris BREZILLON [Thu, 10 Dec 2015 08:00:13 +0000 (09:00 +0100)]
mtd: nand: nandsim: use the mtd instance embedded in struct nand_chip

struct nand_chip now embeds an mtd device. Make use of this mtd instance.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: mxc: use the mtd instance embedded in struct nand_chip
Boris BREZILLON [Thu, 10 Dec 2015 08:00:12 +0000 (09:00 +0100)]
mtd: nand: mxc: use the mtd instance embedded in struct nand_chip

struct nand_chip now embeds an mtd device. Make use of this mtd instance.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: mpc5121: use the mtd instance embedded in struct nand_chip
Boris BREZILLON [Thu, 10 Dec 2015 08:00:11 +0000 (09:00 +0100)]
mtd: nand: mpc5121: use the mtd instance embedded in struct nand_chip

struct nand_chip now embeds an mtd device. Make use of this mtd instance.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: lpc32xx: use the mtd instance embedded in struct nand_chip
Boris BREZILLON [Thu, 10 Dec 2015 08:00:10 +0000 (09:00 +0100)]
mtd: nand: lpc32xx: use the mtd instance embedded in struct nand_chip

struct nand_chip now embeds an mtd device. Make use of this mtd instance.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: jz4740: use the mtd instance embedded in struct nand_chip
Boris BREZILLON [Thu, 10 Dec 2015 08:00:09 +0000 (09:00 +0100)]
mtd: nand: jz4740: use the mtd instance embedded in struct nand_chip

struct nand_chip now embeds an mtd device. Make use of this mtd instance.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: hisi504: use the mtd instance embedded in struct nand_chip
Boris BREZILLON [Thu, 10 Dec 2015 08:00:08 +0000 (09:00 +0100)]
mtd: nand: hisi504: use the mtd instance embedded in struct nand_chip

struct nand_chip now embeds an mtd device. Make use of this mtd instance.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: gpmi: use the mtd instance embedded in struct nand_chip
Boris BREZILLON [Thu, 10 Dec 2015 08:00:07 +0000 (09:00 +0100)]
mtd: nand: gpmi: use the mtd instance embedded in struct nand_chip

struct nand_chip now embeds an mtd device. Make use of this mtd instance.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: gpio: use the mtd instance embedded in struct nand_chip
Boris BREZILLON [Thu, 10 Dec 2015 08:00:06 +0000 (09:00 +0100)]
mtd: nand: gpio: use the mtd instance embedded in struct nand_chip

struct nand_chip now embeds an mtd device. Make use of this mtd instance.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: fsmc: use the mtd instance embedded in struct nand_chip
Boris BREZILLON [Thu, 10 Dec 2015 08:00:05 +0000 (09:00 +0100)]
mtd: nand: fsmc: use the mtd instance embedded in struct nand_chip

struct nand_chip now embeds an mtd device. Make use of this mtd instance.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: fsl_upm: use the mtd instance embedded in struct nand_chip
Boris BREZILLON [Thu, 10 Dec 2015 08:00:04 +0000 (09:00 +0100)]
mtd: nand: fsl_upm: use the mtd instance embedded in struct nand_chip

struct nand_chip now embeds an mtd device. Make use of this mtd instance.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: fsl_ifc: use the mtd instance embedded in struct nand_chip
Boris BREZILLON [Thu, 10 Dec 2015 08:00:03 +0000 (09:00 +0100)]
mtd: nand: fsl_ifc: use the mtd instance embedded in struct nand_chip

struct nand_chip now embeds an mtd device. Make use of this mtd instance.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: fsl_elbc: use the mtd instance embedded in struct nand_chip
Boris BREZILLON [Thu, 10 Dec 2015 08:00:02 +0000 (09:00 +0100)]
mtd: nand: fsl_elbc: use the mtd instance embedded in struct nand_chip

struct nand_chip now embeds an mtd device. Make use of this mtd instance.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: docg4: use the mtd instance embedded in struct nand_chip
Boris BREZILLON [Thu, 10 Dec 2015 08:00:01 +0000 (09:00 +0100)]
mtd: nand: docg4: use the mtd instance embedded in struct nand_chip

struct nand_chip now embeds an mtd device. Make use of this mtd instance.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: diskonchip: use the mtd instance embedded in struct nand_chip
Boris BREZILLON [Thu, 10 Dec 2015 08:00:00 +0000 (09:00 +0100)]
mtd: nand: diskonchip: use the mtd instance embedded in struct nand_chip

struct nand_chip now embeds an mtd device. Make use of this mtd instance.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: davinci: use the mtd instance embedded in struct nand_chip
Boris BREZILLON [Thu, 10 Dec 2015 07:59:58 +0000 (08:59 +0100)]
mtd: nand: davinci: use the mtd instance embedded in struct nand_chip

struct nand_chip now embeds an mtd device. Make use of this mtd instance.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: cmx270: use the mtd instance embedded in struct nand_chip
Boris BREZILLON [Thu, 10 Dec 2015 07:59:56 +0000 (08:59 +0100)]
mtd: nand: cmx270: use the mtd instance embedded in struct nand_chip

struct nand_chip now embeds an mtd device. Make use of this mtd instance.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
[Brian: dropped a defunct comment]
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: cs553x: use the mtd instance embedded in struct nand_chip
Boris BREZILLON [Thu, 10 Dec 2015 07:59:57 +0000 (08:59 +0100)]
mtd: nand: cs553x: use the mtd instance embedded in struct nand_chip

struct nand_chip now embeds an mtd device. Make use of this mtd instance.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: cafe: use the mtd instance embedded in struct nand_chip
Boris BREZILLON [Thu, 10 Dec 2015 07:59:55 +0000 (08:59 +0100)]
mtd: nand: cafe: use the mtd instance embedded in struct nand_chip

struct nand_chip now embeds an mtd device. Make use of this mtd instance.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: brcm: use the mtd instance embedded in struct nand_chip
Boris BREZILLON [Thu, 10 Dec 2015 07:59:54 +0000 (08:59 +0100)]
mtd: nand: brcm: use the mtd instance embedded in struct nand_chip

struct nand_chip now embeds an mtd device. Make use of this mtd instance.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: bf5xx: use the mtd instance embedded in struct nand_chip
Boris BREZILLON [Thu, 10 Dec 2015 07:59:53 +0000 (08:59 +0100)]
mtd: nand: bf5xx: use the mtd instance embedded in struct nand_chip

struct nand_chip now embeds an mtd device. Make use of this mtd instance.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: au1550nd: use the mtd instance embedded in struct nand_chip
Boris BREZILLON [Thu, 10 Dec 2015 07:59:51 +0000 (08:59 +0100)]
mtd: nand: au1550nd: use the mtd instance embedded in struct nand_chip

struct nand_chip now embeds an mtd device. Make use of this mtd instance.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: atmel: use the mtd instance embedded in struct nand_chip
Boris BREZILLON [Thu, 10 Dec 2015 07:59:50 +0000 (08:59 +0100)]
mtd: nand: atmel: use the mtd instance embedded in struct nand_chip

struct nand_chip now embeds an mtd device. Make use of this mtd instance.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: ams-delta: use the mtd instance embedded in struct nand_chip
Boris BREZILLON [Thu, 10 Dec 2015 07:59:49 +0000 (08:59 +0100)]
mtd: nand: ams-delta: use the mtd instance embedded in struct nand_chip

struct nand_chip now embeds an mtd device. Make use of this mtd instance
instead of allocating our own.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: omap2: create and use mtd_to_omap()
Boris BREZILLON [Thu, 10 Dec 2015 07:59:48 +0000 (08:59 +0100)]
mtd: nand: omap2: create and use mtd_to_omap()

Define and use mtd_to_omap() instead of container_of();

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: nuc900: create and use mtd_to_nuc900()
Boris BREZILLON [Thu, 10 Dec 2015 07:59:47 +0000 (08:59 +0100)]
mtd: nand: nuc900: create and use mtd_to_nuc900()

Create and use mtd_to_nuc900() instead of direct container_of() calls.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: fsmc: create and use mtd_to_fsmc()
Boris BREZILLON [Thu, 10 Dec 2015 07:59:46 +0000 (08:59 +0100)]
mtd: nand: fsmc: create and use mtd_to_fsmc()

Create and use mtd_to_fsmc() to avoid duplication of
container_of(mtd, struct fsmc_nand_data, mtd) calls.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: omap_elm: print interrupt resource using %pr
Arnd Bergmann [Fri, 18 Dec 2015 13:15:17 +0000 (14:15 +0100)]
mtd: omap_elm: print interrupt resource using %pr

When CONFIG_LPAE is set on ARM, resource_size_t is 64-bit wide
and we get a warning about an incorrect format string for printing
the interrupt number in elm_probe:

drivers/mtd/nand/omap_elm.c: In function 'elm_probe':
drivers/mtd/nand/omap_elm.c:417:23: warning: format '%i' expects argument of type 'int', but argument 3 has type 'resource_size_t {aka long long unsigned int}' [-Wformat=]

This patch avoids the type mismatch by printing the interrupt as
a resource using the %pr format string.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: bcm47xxnflash: really unregister NAND on device removal
Brian Norris [Wed, 9 Dec 2015 01:04:59 +0000 (17:04 -0800)]
mtd: bcm47xxnflash: really unregister NAND on device removal

The field bcma_nflash::mtd is never set to be non-zero anywhere, but we
test for it in the removal path. So the MTD is never unregistered.

Also, we should use nand_release(), not mtd_device_unregister().

Finally, we don't need to use the 'platdata' for stashing/retrieving our
*driver* data -- that's what *_{get,set}_drvdata() are for.

So, kill off bcm_nflash::mtd, and stash the struct bcm47xxnflash in
drvdata instead. Also move the forward declaration of mtd_info up a bit,
since struct bcma_sflash should be using it.

Caught while inspecting other changes being made to this driver. Compile
tested only.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Cc: "Rafał Miłecki" <zajec5@gmail.com>
Cc: linux-wireless@vger.kernel.org
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: denali: add missing nand_release() call in denali_remove()
Boris BREZILLON [Fri, 11 Dec 2015 14:02:34 +0000 (15:02 +0100)]
mtd: nand: denali: add missing nand_release() call in denali_remove()

Unregister the NAND device from the NAND subsystem when removing a denali
NAND controller, otherwise the MTD attached to the NAND device is still
exposed by the MTD layer, and accesses to this device will likely crash
the system.

Fixes: 2a0a288ec258 ("mtd: denali: split the generic driver and PCI layer")
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: Dinh Nguyen <dinguyen@opensource.altera.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: brcmnand: defer to devm_ioremap_resource() for error checking
Brian Norris [Thu, 10 Dec 2015 02:33:17 +0000 (18:33 -0800)]
mtd: brcmnand: defer to devm_ioremap_resource() for error checking

devm_ioremap_resource() does error checking on the 'res' argument, so
drop the error check in bcm6368_nand.c.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Tested-by: Simon Arlott <simon@fire.lp0.eu>
8 years agomtd: brcmnand: Add support for the BCM6368
Simon Arlott [Wed, 9 Dec 2015 20:43:54 +0000 (20:43 +0000)]
mtd: brcmnand: Add support for the BCM6368

The BCM6368 has a NAND interrupt register with combined status and enable
registers.

As the BCM6328, BCM6362 and BCM6368 all use v2.1 controllers, the first
variant that will work with this driver is the BCM63268 using a v4.0
controller.

Set up the device by disabling and acking all interrupts, then handle
the CTRL_READY interrupt.

Signed-off-by: Simon Arlott <simon@fire.lp0.eu>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: brcmnand: Request and enable the clock if present
Simon Arlott [Wed, 9 Dec 2015 20:42:25 +0000 (20:42 +0000)]
mtd: brcmnand: Request and enable the clock if present

Attempt to enable a clock named "nand" as some SoCs have a clock for the
controller that needs to be enabled.

Signed-off-by: Simon Arlott <simon@fire.lp0.eu>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agodoc: dt: mtd: brcmnand: Add brcm,bcm6368-nand device tree binding
Simon Arlott [Wed, 9 Dec 2015 20:40:58 +0000 (20:40 +0000)]
doc: dt: mtd: brcmnand: Add brcm,bcm6368-nand device tree binding

Add device tree binding for NAND on the BCM6368.

The BCM6368 has a NAND interrupt register with combined status and enable
registers. It also requires a clock, so add an optional clock to the
common brcmnand binding.

Signed-off-by: Simon Arlott <simon@fire.lp0.eu>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: Confine MTD_NAND_SH_FLCTL to SUPERH
Geert Uytterhoeven [Tue, 8 Dec 2015 17:40:59 +0000 (18:40 +0100)]
mtd: nand: Confine MTD_NAND_SH_FLCTL to SUPERH

As of commit a521422ea4ae6128 ("ARM: shmobile: mackerel: Remove Legacy C
board code"), the Renesas SuperH FLCTL driver is no longer used on ARM
SH-Mobile SoCs. Restrict the dependencies, unless compile-testing.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: spi-nor: Check the return value from read_sr()
Fabio Estevam [Fri, 20 Nov 2015 18:26:11 +0000 (16:26 -0200)]
mtd: spi-nor: Check the return value from read_sr()

We should better check the return value from read_sr() and
propagate it in the case of error.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: partitions: support a cleanup callback for parsers
Brian Norris [Wed, 9 Dec 2015 18:24:03 +0000 (10:24 -0800)]
mtd: partitions: support a cleanup callback for parsers

If partition parsers need to clean up their resources, we shouldn't
assume that all memory will fit in a single kmalloc() that the caller
can kfree(). We should allow the parser to provide a proper cleanup
routine.

Note that this means we need to keep a hold on the parser's module for a
bit longer, and release it later with mtd_part_parser_put().

Alongside this, define a default callback that we'll automatically use
if the parser doesn't provide one, so we can still retain the old
behavior.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: partitions: pass around 'mtd_partitions' wrapper struct
Brian Norris [Fri, 4 Dec 2015 23:25:17 +0000 (15:25 -0800)]
mtd: partitions: pass around 'mtd_partitions' wrapper struct

For some of the core partitioning code, it helps to keep info about the
parsed partition (and who parsed them) together in one place.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: partitions: remove kmemdup()
Brian Norris [Fri, 4 Dec 2015 23:25:16 +0000 (15:25 -0800)]
mtd: partitions: remove kmemdup()

The use of kmemdup() complicates the error handling a bit. We don't
actually need to allocate new memory, since this reference is treated as
const, and it is copied into new memory by the partition registration
code anyway. So remove it.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: partitions: rename MTD parser get/put
Brian Norris [Fri, 4 Dec 2015 23:25:15 +0000 (15:25 -0800)]
mtd: partitions: rename MTD parser get/put

We're going to reuse put_partition_parser(), so let's fix up the prefix
naming a bit, to hopefully be more consistent. Also make convert to a
true C function instead of a macro.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: partitions: make parsers return 'const' partition arrays
Brian Norris [Fri, 4 Dec 2015 23:25:14 +0000 (15:25 -0800)]
mtd: partitions: make parsers return 'const' partition arrays

We only want to modify these arrays inside the parser "drivers", so the
drivers should construct them however they like, then return them as
immutable arrays.

This will make other refactorings easier.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: ofpart: assign return argument exactly once
Brian Norris [Fri, 4 Dec 2015 23:25:13 +0000 (15:25 -0800)]
mtd: ofpart: assign return argument exactly once

It's easier to refactor these parsers if the return value gets assigned
only once, just like every other MTD partition parser.

This prepares for making the second arg to the parse_fn() const. This is
OK if we construct the partitions completely first, and assign them to
the return pointer only after we're done modifying them.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: merge for-4.4 development into -next development
Brian Norris [Wed, 9 Dec 2015 17:59:45 +0000 (09:59 -0800)]
mtd: merge for-4.4 development into -next development

A few MAINTAINERS updates, and some DT binding/documentation fixups.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agodoc: dt: mtd: partitions: add compatible property to "partitions" node
Brian Norris [Thu, 3 Dec 2015 22:47:32 +0000 (14:47 -0800)]
doc: dt: mtd: partitions: add compatible property to "partitions" node

As noted here [1], there are potentially future conflicts if we try to
use MTD's "partitions" subnode to describe anything besides just the
fixed-in-the-device-tree partitions currently described in this
document. Particularly, there was a proposal to use this node for the
AFS parser too.

It can pose a (small) problem to try to differentiate the following
nodes:

// using binding as currently specified
partitions {
#address-cells = <x>;
#size-cells = <y>;
partition@0 {
...;
};
};

and

// proposed future binding
partitions {
compatible = "arm,arm-flash-structure";
};

It's especially difficult if other uses of this node start having
subnodes.

So, since the "partitions" node is new in v4.4, let's fixup the binding
before release so that it requires a compatible property, so it's much
clearer to distinguish. e.g.:

// proposed
partitions {
compatible = "fixed-partitions";
#address-cells = <x>;
#size-cells = <y>;
partition@0 {
...;
};
};

[1] Subject: "mtd: create a partition type device tree binding"
    http://lkml.kernel.org/g/20151113220039.GA74382@google.com
    http://lists.infradead.org/pipermail/linux-mtd/2015-November/063355.html
    http://lists.infradead.org/pipermail/linux-mtd/2015-November/063364.html

Cc: Michal Suchanek <hramrach@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Rob Herring <robh@kernel.org>
8 years agoMerge arch/{arm,blackfin,cris,mips}/ refactoring patches into MTD dev
Brian Norris [Tue, 8 Dec 2015 21:04:31 +0000 (13:04 -0800)]
Merge arch/{arm,blackfin,cris,mips}/ refactoring patches into MTD dev

These patches may also get merged by other arch/ maintainers, so I've
based them on 4.4-rc1 instead of the latest MTD development. Bring them
in now.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomips: nand: make use of mtd_to_nand() where appropriate
Boris BREZILLON [Tue, 1 Dec 2015 11:03:01 +0000 (12:03 +0100)]
mips: nand: make use of mtd_to_nand() where appropriate

mtd_to_nand() was recently introduced to avoid direct accesses to the
mtd->priv field. Update all MIPS specific implementations to use this
helper.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agoblackfin: nand: make use of mtd_to_nand() where appropriate
Boris BREZILLON [Tue, 1 Dec 2015 11:02:59 +0000 (12:02 +0100)]
blackfin: nand: make use of mtd_to_nand() where appropriate

mtd_to_nand() was recently introduced to avoid direct accesses to the
mtd->priv field. Update all blackfin specific implementations to use
this helper.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agocris: nand: make use of mtd_to_nand() where appropriate
Boris BREZILLON [Tue, 1 Dec 2015 11:03:00 +0000 (12:03 +0100)]
cris: nand: make use of mtd_to_nand() where appropriate

mtd_to_nand() was recently introduced to avoid direct accesses to the
mtd->priv field. Update all CRIS specific implementations to use this
helper.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Jesper Nilsson <jesper.nilsson@axis.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: add nand_to_mtd() helper
Boris BREZILLON [Tue, 1 Dec 2015 11:03:07 +0000 (12:03 +0100)]
mtd: nand: add nand_to_mtd() helper

Add a new helper to retrieve the MTD device attached to a NAND chip.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: embed an mtd_info structure into nand_chip
Boris BREZILLON [Tue, 1 Dec 2015 11:03:06 +0000 (12:03 +0100)]
mtd: nand: embed an mtd_info structure into nand_chip

Currently all NAND controller drivers are providing both the mtd_info and
nand_chip struct and then let the NAND subsystem to initialize a few
things before registering the mtd instance to the MTD layer.
Embed an mtd_info field into nand_chip to add some consistency to all NAND
controller drivers.
This change will also help factorizing boilerplate code copied in all NAND
drivers.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: make use of mtd_to_nand() in NAND drivers
Boris BREZILLON [Tue, 1 Dec 2015 11:03:04 +0000 (12:03 +0100)]
mtd: nand: make use of mtd_to_nand() in NAND drivers

mtd_to_nand() was recently introduced to avoid direct accesses to the
mtd->priv field. Update all NAND drivers to use it.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agostaging: mt29f_spinand: make use of mtd_to_nand()
Boris BREZILLON [Tue, 1 Dec 2015 11:03:05 +0000 (12:03 +0100)]
staging: mt29f_spinand: make use of mtd_to_nand()

mtd_to_nand() was recently introduced to avoid direct accesses to the
mtd->priv field. Use it where appropriate.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: make use of mtd_to_nand() in NAND core code
Boris BREZILLON [Tue, 1 Dec 2015 11:03:03 +0000 (12:03 +0100)]
mtd: nand: make use of mtd_to_nand() in NAND core code

mtd_to_nand() was recently introduced to avoid direct access to the
mtd->priv field. Update core code to use mtd_to_nand().

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agosh: nand: make use of mtd_to_nand() where appropriate
Boris BREZILLON [Tue, 1 Dec 2015 11:03:02 +0000 (12:03 +0100)]
sh: nand: make use of mtd_to_nand() where appropriate

mtd_to_nand() was recently introduced to avoid direct accesses to the
mtd->priv field. Update all SH specific implementations to use this
helper.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agoARM: nand: make use of mtd_to_nand() where appropriate
Boris BREZILLON [Tue, 1 Dec 2015 11:02:58 +0000 (12:02 +0100)]
ARM: nand: make use of mtd_to_nand() where appropriate

mtd_to_nand() was recently introduced to avoid direct accesses to the
mtd->priv field. Update all ARM specific implementations to use this
helper.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: r852: Remove unnecessary synchronize_irq() before free_irq()
Lars-Peter Clausen [Sat, 21 Nov 2015 11:14:44 +0000 (12:14 +0100)]
mtd: nand: r852: Remove unnecessary synchronize_irq() before free_irq()

Calling synchronize_irq() right before free_irq() is quite useless. On one
hand the IRQ can easily fire again before free_irq() is entered, on the
other hand free_irq() itself calls synchronize_irq() internally (in a race
condition free way), before any state associated with the IRQ is freed.

Patch was generated using the following semantic patch:
// <smpl>
@@
expression irq;
@@
-synchronize_irq(irq);
 free_irq(irq, ...);
// </smpl>

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: spi-nor: fix error handling in spi_nor_erase
Heiner Kallweit [Tue, 17 Nov 2015 19:18:54 +0000 (20:18 +0100)]
mtd: spi-nor: fix error handling in spi_nor_erase

The documenting comment of mtd_erase in mtdcore.c states:
Device drivers are supposed to call instr->callback() whenever
the operation completes, even if it completes with a failure.

Currently the callback isn't called in case of failure. Fix this.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: mtk-quadspi: drop unnecessary .owner assignment
Brian Norris [Sat, 21 Nov 2015 01:38:33 +0000 (17:38 -0800)]
mtd: mtk-quadspi: drop unnecessary .owner assignment

As of commit 807f16d4db95 ("mtd: core: set some defaults when
dev.parent is set"), the MTD core will set this for us.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Cc: Bayi Cheng <bayi.cheng@mediatek.com>
8 years agomtd: partitions: turn PART() macro into inline function
Brian Norris [Fri, 20 Nov 2015 03:28:39 +0000 (19:28 -0800)]
mtd: partitions: turn PART() macro into inline function

We can guard against reorganization of struct mtd_part by using
container_of(). We can also make sure we're using the right pointer
types by making this a static inline function instead of a macro.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: ofpart: don't complain about missing 'partitions' node too loudly
Brian Norris [Thu, 3 Dec 2015 22:26:52 +0000 (14:26 -0800)]
mtd: ofpart: don't complain about missing 'partitions' node too loudly

The ofpart partition parser might be run on DT-enabled systems that
don't have any "ofpart" partition subnodes at all, since "ofpart" is in
the default parser list. So don't complain loudly on every boot.

Example: using m25p80.c with no intent to use ofpart:

&spi2 {
status = "okay";

flash@0 {
compatible = "jedec,spi-nor";
reg = <0>;
};
};

I see this warning:

[    0.588471] m25p80 spi2.0: gd25q32 (4096 Kbytes)
[    0.593091] spi2.0: 'partitions' subnode not found on /spi@ff130000/flash@0. Trying to parse direct subnodes as partitions.

Cc: Michal Suchanek <hramrach@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: brcmnand: drop brcmnand_host::of_node field
Brian Norris [Tue, 1 Dec 2015 02:01:27 +0000 (18:01 -0800)]
mtd: brcmnand: drop brcmnand_host::of_node field

We don't actually need to stash a copy of this device_node indefinitely;
we only need it in brcmnand_init_cs().

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Cc: <bcm-kernel-feedback-list@broadcom.com>
Cc: Kamal Dasu <kdasu.kdev@gmail.com>
Acked-by: Scott Branden <sbranden@broadcom.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: fix typo (t_ald -> t_adl)
Brian Norris [Tue, 1 Dec 2015 19:08:32 +0000 (11:08 -0800)]
mtd: nand: fix typo (t_ald -> t_adl)

It's "ADL" ("ALE to data loading" time) not "ALD".

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: fix ONFI parameter page layout
Boris BREZILLON [Mon, 23 Nov 2015 10:23:07 +0000 (11:23 +0100)]
mtd: nand: fix ONFI parameter page layout

src_ssync_features field is only 1 byte large, and the 4th reserved area
is actually 8 bytes large.

Fixes: d1e1f4e42b5 ("mtd: nand: add support for reading ONFI parameters from NAND device")
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: spi-nor: Fix error message with unrecognized JEDEC
Ricardo Ribalda [Mon, 30 Nov 2015 19:41:17 +0000 (20:41 +0100)]
mtd: spi-nor: Fix error message with unrecognized JEDEC

The error message was:

m25p80 spi32766.0: unrecognized JEDEC id bytes: 00,  0,  0

The new error message:

m25p80 spi32766.0: unrecognized JEDEC id bytes: 00, 00, 00

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: sunxi: add missing of_node_put
Julia Lawall [Wed, 18 Nov 2015 22:04:12 +0000 (23:04 +0100)]
mtd: nand: sunxi: add missing of_node_put

for_each_child_of_node performs an of_node_get on each iteration, so
a break out of the loop requires an of_node_put.

A simplified version of the semantic patch that fixes this problem is as
follows (http://coccinelle.lip6.fr):

// <smpl>
@@
expression root,e;
local idexpression child;
@@

 for_each_child_of_node(root, child) {
   ... when != of_node_put(child)
       when != e = child
(
   return child;
|
+  of_node_put(child);
?  return ...;
)
   ...
 }
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Acked-by: Chen-Yu Tsai <wens@csie.org>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: brcmnand: improve memory management
Julia Lawall [Thu, 19 Nov 2015 21:32:15 +0000 (22:32 +0100)]
mtd: brcmnand: improve memory management

This patch addresses two related memory management issues in the probe
function:

1. for_each_available_child_of_node performs an of_node_get on each
iteration, so a break out of the loop requires an of_node_put.

A simplified version of the semantic patch that fixes this problem is as
follows (http://coccinelle.lip6.fr):

// <smpl>
@@
expression root,e;
local idexpression child;
@@

 for_each_available_child_of_node(root, child) {
   ... when != of_node_put(child)
       when != e = child
(
   return child;
|
+  of_node_put(child);
?  return ...;
)
   ...
 }
// </smpl>

2. The devm_kzalloc'd data is not used if brcmnand_init_cs fails.  Free it
immediately, using devm_kfree in this case, instead of waiting for the
remove function.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agobrcmnand: Clear EXT_ADDR error registers in PIO mode
Simon Arlott [Mon, 16 Nov 2015 22:05:39 +0000 (22:05 +0000)]
brcmnand: Clear EXT_ADDR error registers in PIO mode

If an error occurs in flash above 4GB in PIO mode then the EXT_ADDR
registers will be set to the location of the error and never cleared.

Reset them to 0 before reading.

Signed-off-by: Simon Arlott <simon@fire.lp0.eu>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: cfi: don't warn about broken geometry for !CONFIG_MTD
Arnd Bergmann [Tue, 24 Nov 2015 22:09:02 +0000 (23:09 +0100)]
mtd: cfi: don't warn about broken geometry for !CONFIG_MTD

The linux/mtd/map.h header file is included by a couple of
platform specific files that are built even when CONFIG_MTD
is disabled, and we always get

 warning "No CONFIG_MTD_MAP_BANK_WIDTH_xx selected. No NOR chip support can work"

in that case. This adds an #ifdef around the pointless warning,
as everything is really fine when we don't build the drivers
anyway.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: cfi: enforce valid geometry configuration
Arnd Bergmann [Mon, 23 Nov 2015 13:39:33 +0000 (14:39 +0100)]
mtd: cfi: enforce valid geometry configuration

MTD allows compile-time configuration of the possible CFI geometry
settings that are allowed by the kernel, but that includes a couple of
invalid configurations, where no bank width or no interleave setting
is allowed. These are then caught with a compile-time warning:

include/linux/mtd/cfi.h:76:2: warning: #warning No CONFIG_MTD_CFI_Ix selected. No NOR chip support can work.
include/linux/mtd/map.h:145:2: warning: #warning "No CONFIG_MTD_MAP_BANK_WIDTH_xx selected. No NOR chip support can work"

This is a bit annoying for randconfig tests, and can be avoided if
we change the Kconfig logic to always select the simplest configuration
when no other one is enabled.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: spi-nor: include mtd.h header for struct mtd_info definition
Rafał Miłecki [Thu, 26 Nov 2015 08:05:04 +0000 (09:05 +0100)]
mtd: spi-nor: include mtd.h header for struct mtd_info definition

So far struct spi_nor was using just a pointer to struct mtd_info so it
wasn't needed to have it fully defined there. After recent change we
embed whole struct so we need to include a proper header.

Fixes: 1976367173a4 ("mtd: spi-nor: embed struct mtd_info within struct spi_nor")
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: mtk-nor: new Mediatek serial flash controller driver
Bayi Cheng [Wed, 18 Nov 2015 03:30:02 +0000 (11:30 +0800)]
mtd: mtk-nor: new Mediatek serial flash controller driver

Add spi nor flash driver for mediatek controller

Signed-off-by: Bayi Cheng <bayi.cheng@mediatek.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: atmel_nand: constify atmel_nand_caps structures
LABBE Corentin [Fri, 20 Nov 2015 07:45:16 +0000 (08:45 +0100)]
mtd: nand: atmel_nand: constify atmel_nand_caps structures

All atmel_nand_caps are never modified, consitify them.

Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
Acked-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>