firefly-linux-kernel-4.4.55.git
8 years agomtd: spi-nor: s25fl204k supports dual I/0
Sean Nyekjaer [Tue, 13 Oct 2015 06:51:14 +0000 (08:51 +0200)]
mtd: spi-nor: s25fl204k supports dual I/0

Signed-off-by: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: pass page number to ecc->write_xxx() methods
Boris BREZILLON [Tue, 13 Oct 2015 09:22:18 +0000 (11:22 +0200)]
mtd: nand: pass page number to ecc->write_xxx() methods

The ->read_xxx() methods are all passed the page number the NAND controller
is supposed to read, but ->write_xxx() do not have such a parameter.

This is a problem if we want to properly implement data
scrambling/randomization in order to mitigate MLC sensibility to repeated
pattern: to prevent bitflips in adjacent pages in the same block we need
to avoid repeating the same pattern at the same offset in those pages,
hence the randomizer/scrambler engine need to be passed the page value
in order to adapt its seed accordingly.

Moreover, adding the page parameter to the ->write_xxx() methods add some
consistency to the current API.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
CC: Josh Wu <josh.wu@atmel.com>
CC: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
CC: Maxime Ripard <maxime.ripard@free-electrons.com>
CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
CC: Huang Shijie <shijie.huang@arm.com>
CC: Stefan Agner <stefan@agner.ch>
CC: devel@driverdev.osuosl.org
CC: linux-arm-kernel@lists.infradead.org
CC: linux-kernel@vger.kernel.org
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: txx9ndfmc: show parent device in sysfs
Frans Klaver [Wed, 10 Jun 2015 20:39:09 +0000 (22:39 +0200)]
mtd: nand: txx9ndfmc: show parent device in sysfs

Fix a bug where parent device symlinks aren't shown in sysfs.

While at it, make use of the default owner value set by mtdcore.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: jz4740_nand: show parent device in sysfs
Frans Klaver [Wed, 10 Jun 2015 20:38:51 +0000 (22:38 +0200)]
mtd: nand: jz4740_nand: show parent device in sysfs

Fix a bug where parent device symlinks aren't shown in sysfs.

While at it, make use of the default owner value set by mtdcore.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: fsl_upm: show parent device in sysfs
Frans Klaver [Wed, 10 Jun 2015 20:38:46 +0000 (22:38 +0200)]
mtd: nand: fsl_upm: show parent device in sysfs

Fix a bug where parent device symlinks aren't shown in sysfs.

While at it, make use of the default owner set by mtdcore.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: socrates_nand: drop owner assignment
Frans Klaver [Wed, 10 Jun 2015 20:39:06 +0000 (22:39 +0200)]
mtd: nand: socrates_nand: drop owner assignment

Owner is automatically set by mtdcore. Make use of that.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: fsl_elbc_nand: show parent device in sysfs
Frans Klaver [Wed, 10 Jun 2015 20:38:44 +0000 (22:38 +0200)]
mtd: nand: fsl_elbc_nand: show parent device in sysfs

Fix a bug where mtd parent device symlinks aren't shown in sysfs.

While at it, make use of the default owner value set by mtdcore.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: pxa3xx_nand: show parent device in sysfs
Frans Klaver [Wed, 10 Jun 2015 20:39:01 +0000 (22:39 +0200)]
mtd: nand: pxa3xx_nand: show parent device in sysfs

Fix a bug where parent device symlinks aren't shown in sysfs.

While at it, make use of the default owner value set by mtdcore.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: gpio: show parent device in sysfs
Frans Klaver [Wed, 10 Jun 2015 20:38:48 +0000 (22:38 +0200)]
mtd: nand: gpio: show parent device in sysfs

Fix a bug where parent device symlinks aren't shown in sysfs.

While at it, make use of the default owner value set by mtdcore.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agostaging: mt29f_spinand: show parent device in sysfs
Frans Klaver [Wed, 10 Jun 2015 20:39:14 +0000 (22:39 +0200)]
staging: mt29f_spinand: show parent device in sysfs

Fix a bug where mtd parent device symlinks aren't shown in sysfs.

While at it, take advantage of the default owner and name values set by
mtdcore.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: onenand: omap2: drop owner and name assignment
Frans Klaver [Wed, 10 Jun 2015 20:39:11 +0000 (22:39 +0200)]
mtd: onenand: omap2: drop owner and name assignment

Owner and name are automatically set by mtdcore. Make use of that.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: s3c2410: show parent device in sysfs
Frans Klaver [Wed, 10 Jun 2015 20:39:03 +0000 (22:39 +0200)]
mtd: nand: s3c2410: show parent device in sysfs

Fix a bug where parent device symlinks aren't shown in sysfs.

While at it, make use of the default owner set by mtdcore.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: sharpsl: show parent device in sysfs
Frans Klaver [Wed, 10 Jun 2015 20:39:05 +0000 (22:39 +0200)]
mtd: nand: sharpsl: show parent device in sysfs

Fix a bug where parent device symlinks aren't shown in sysfs.

While at it, make use of the default owner value set by mtdcore.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: omap2: show parent device structure in sysfs
Frans Klaver [Wed, 10 Jun 2015 20:38:57 +0000 (22:38 +0200)]
mtd: nand: omap2: show parent device structure in sysfs

Make sure the device structure is properly shown in sysfs by properly
filling in dev.parent.

While at it, make use of the default owner and name values set by
mtdcore.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: onenand: samsung: drop owner assignment
Frans Klaver [Wed, 10 Jun 2015 20:39:12 +0000 (22:39 +0200)]
mtd: onenand: samsung: drop owner assignment

Owner is automatically set by mtdcore. Make use of that.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: lpc32xx_mlc: drop owner assignment
Frans Klaver [Wed, 10 Jun 2015 20:38:52 +0000 (22:38 +0200)]
mtd: nand: lpc32xx_mlc: drop owner assignment

Owner is automatically set by mtdcore. Make use of that.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: ndfc: show parent device in sysfs
Frans Klaver [Wed, 10 Jun 2015 20:38:55 +0000 (22:38 +0200)]
mtd: nand: ndfc: show parent device in sysfs

Fix a bug where parent device symlinks aren't shown in sysfs.

While at it, make use of the default owner set by mtdcore.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: pasemi_nand: show parent device in sysfs
Frans Klaver [Wed, 10 Jun 2015 20:38:59 +0000 (22:38 +0200)]
mtd: nand: pasemi_nand: show parent device in sysfs

Fix a bug where parent device symlinks aren't shown in sysfs.

While at it, make use of the default owner value set by mtdcore.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: mxc_nand: drop owner assignment
Frans Klaver [Wed, 10 Jun 2015 20:38:54 +0000 (22:38 +0200)]
mtd: nand: mxc_nand: drop owner assignment

Owner is automatically set by mtdcore. Make use of that.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: onenand: generic: show parent device in sysfs
Frans Klaver [Wed, 10 Jun 2015 20:39:10 +0000 (22:39 +0200)]
mtd: onenand: generic: show parent device in sysfs

Fix a bug where mtd parent device symlinks aren't shown in sysfs.

While at it, take advantage of the default owner and name values set by
mtdcore.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: tmio_nand: show parent device in sysfs
Frans Klaver [Wed, 10 Jun 2015 20:39:08 +0000 (22:39 +0200)]
mtd: nand: tmio_nand: show parent device in sysfs

Fix a bug where parent device symlinks aren't shown in sysfs.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: sunxi_nand: drop owner assignment
Frans Klaver [Wed, 10 Jun 2015 20:39:07 +0000 (22:39 +0200)]
mtd: nand: sunxi_nand: drop owner assignment

Owner is automatically set by mtdcore. Make use of that.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: sh_flctl: show parent device in sysfs
Frans Klaver [Wed, 10 Jun 2015 20:39:04 +0000 (22:39 +0200)]
mtd: nand: sh_flctl: show parent device in sysfs

Fix a bug where parent device symlinks aren't shown in sysfs.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: r852: drop owner assignment
Frans Klaver [Wed, 10 Jun 2015 20:39:02 +0000 (22:39 +0200)]
mtd: nand: r852: drop owner assignment

Owner is automatically set by mtdcore. Make use of that.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: plat_nand: show parent device in sysfs
Frans Klaver [Wed, 10 Jun 2015 20:39:00 +0000 (22:39 +0200)]
mtd: nand: plat_nand: show parent device in sysfs

Fix a bug where parent device symlinks aren't shown in sysfs.

While at it, make use of the default owner and name set by mtdcore.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: orion_nand: show parent device in sysfs
Frans Klaver [Wed, 10 Jun 2015 20:38:58 +0000 (22:38 +0200)]
mtd: nand: orion_nand: show parent device in sysfs

Fix a bug where parent device symlinks aren't shown in sysfs.

While at it, make use of the default owner value set by mtdcore.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: nuc900_nand: show parent device in sysfs
Frans Klaver [Wed, 10 Jun 2015 20:38:56 +0000 (22:38 +0200)]
mtd: nand: nuc900_nand: show parent device in sysfs

Fix a bug where parent device symlinks aren't shown in sysfs.

While at it, make use of the default owner value set by mtdcore.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: mpc5121_nfc: show parent device in sysfs
Frans Klaver [Wed, 10 Jun 2015 20:38:53 +0000 (22:38 +0200)]
mtd: nand: mpc5121_nfc: show parent device in sysfs

Fix a bug where parent device symlinks aren't shown in sysfs.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: hisi504_nand: drop owner assignment
Frans Klaver [Wed, 10 Jun 2015 20:38:50 +0000 (22:38 +0200)]
mtd: nand: hisi504_nand: drop owner assignment

Owner is automatically set by mtdcore. Make use of that.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: gpmi-nand: show parent device in sysfs
Frans Klaver [Wed, 10 Jun 2015 20:38:49 +0000 (22:38 +0200)]
mtd: nand: gpmi-nand: show parent device in sysfs

Fix a bug where parent device symlinks aren't shown in sysfs.

While at it, make use of the default owner set by mtdcore.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: fsmc_nand: show parent device in sysfs
Frans Klaver [Wed, 10 Jun 2015 20:38:47 +0000 (22:38 +0200)]
mtd: nand: fsmc_nand: show parent device in sysfs

Fix a bug where parent device symlinks aren't shown in sysfs.

While at it, make use of the default owner value set by mtdcore.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: fsl_ifc_nand: show parent device in sysfs
Frans Klaver [Wed, 10 Jun 2015 20:38:45 +0000 (22:38 +0200)]
mtd: nand: fsl_ifc_nand: show parent device in sysfs

Fix a bug where parent device symlinks aren't shown in sysfs.

While at it, make use of the default owner set by mtdcore.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: docg4: show parent device in sysfs
Frans Klaver [Wed, 10 Jun 2015 20:38:43 +0000 (22:38 +0200)]
mtd: nand: docg4: show parent device in sysfs

Fix a bug where parent device symlinks aren't shown in sysfs.

While at it, make use of the default owner value set by mtdcore.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: denali: drop owner assignment
Frans Klaver [Wed, 10 Jun 2015 20:38:42 +0000 (22:38 +0200)]
mtd: nand: denali: drop owner assignment

Owner is automatically set by mtdcore. Make use of that.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: davinci_nand: drop owner and name assignment
Frans Klaver [Wed, 10 Jun 2015 20:38:41 +0000 (22:38 +0200)]
mtd: nand: davinci_nand: drop owner and name assignment

Owner and name are automatically set by mtdcore. Make use of that.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: cafe_nand: drop owner assignment
Frans Klaver [Wed, 10 Jun 2015 20:38:40 +0000 (22:38 +0200)]
mtd: nand: cafe_nand: drop owner assignment

Owner is automatically set by mtdcore. Make use of that.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: bf5xx_nand: show parent device in sysfs
Frans Klaver [Wed, 10 Jun 2015 20:38:39 +0000 (22:38 +0200)]
mtd: nand: bf5xx_nand: show parent device in sysfs

Fix a bug where parent device symlinks aren't shown in sysfs.

While at it, make use of the default owner value set by mtdcore.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: bcm47xxnflash: show parent device in sysfs
Frans Klaver [Wed, 10 Jun 2015 20:38:38 +0000 (22:38 +0200)]
mtd: nand: bcm47xxnflash: show parent device in sysfs

Fix a bug where parent device symlinks aren't shown in sysfs.

While at it, make use of the default owner value set by mtdcore.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: au1550nd: show parent device in sysfs
Frans Klaver [Wed, 10 Jun 2015 20:38:37 +0000 (22:38 +0200)]
mtd: nand: au1550nd: show parent device in sysfs

Fix a bug where parent device symlinks aren't shown in sysfs.

While at it, make use of the default owner value set by mtdcore.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: atmel_nand: show parent device in sysfs
Frans Klaver [Wed, 10 Jun 2015 20:38:36 +0000 (22:38 +0200)]
mtd: nand: atmel_nand: show parent device in sysfs

Fix a bug where parent device symlinks aren't shown in sysfs.

While at it, make use of the default owner value set by mtdcore.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: maps: sa1100-flash: show parent device in sysfs
Frans Klaver [Wed, 10 Jun 2015 20:38:35 +0000 (22:38 +0200)]
mtd: maps: sa1100-flash: show parent device in sysfs

Fix a bug where mtd parent device symlinks aren't shown in sysfs.

While at it, make use of the default owner value set by mtdcore.
Incidentally, it seems the owner field in the concatenated mtds is not
actually used, so this shouldn't make much of a difference anyway.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: maps: rbtx4939-flash: show parent device in sysfs
Frans Klaver [Wed, 10 Jun 2015 20:38:34 +0000 (22:38 +0200)]
mtd: maps: rbtx4939-flash: show parent device in sysfs

Fix a bug where mtd parent device symlinks aren't shown in sysfs.

While at it, make use of the default owner value set by mtdcore.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: maps: pxa2xx-flash: show parent device in sysfs
Frans Klaver [Wed, 10 Jun 2015 20:38:33 +0000 (22:38 +0200)]
mtd: maps: pxa2xx-flash: show parent device in sysfs

Fix a bug where mtd parent device symlinks aren't shown in sysfs.

While at it, make use of the default owner value set by mtdcore.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: maps: plat_ram: drop owner assignment
Frans Klaver [Wed, 10 Jun 2015 20:38:32 +0000 (22:38 +0200)]
mtd: maps: plat_ram: drop owner assignment

Owner is automatically set by mtdcore. Make use of that.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: maps: physmap_of: drop owner assignment
Frans Klaver [Wed, 10 Jun 2015 20:38:31 +0000 (22:38 +0200)]
mtd: maps: physmap_of: drop owner assignment

Owner is automatically set by mtdcore. Make use of that.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: maps: physmap: drop owner assignment
Frans Klaver [Wed, 10 Jun 2015 20:38:30 +0000 (22:38 +0200)]
mtd: maps: physmap: drop owner assignment

Owner is automatically set by mtdcore. Make use of that.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: maps: latch-addr-flash: show parent device in sysfs
Frans Klaver [Wed, 10 Jun 2015 20:38:29 +0000 (22:38 +0200)]
mtd: maps: latch-addr-flash: show parent device in sysfs

Fix a bug where mtd parent device symlinks aren't shown in sysfs.

While at it, make use of the default owner value set by mtdcore.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: maps: lantiq-flash: show parent device in sysfs
Frans Klaver [Wed, 10 Jun 2015 20:38:28 +0000 (22:38 +0200)]
mtd: maps: lantiq-flash: show parent device in sysfs

Fix a bug where mtd parent device symlinks aren't shown in sysfs.

While at it, make use of the default owner value set by mtdcore.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: maps: ixp4xx: show parent device in sysfs
Frans Klaver [Wed, 10 Jun 2015 20:38:27 +0000 (22:38 +0200)]
mtd: maps: ixp4xx: show parent device in sysfs

Fix a bug where mtd parent device symlinks aren't shown in sysfs.

While at it, make use of the default owner value set by mtdcore.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: maps: intel_vr_nor: show parent device in sysfs
Frans Klaver [Wed, 10 Jun 2015 20:38:26 +0000 (22:38 +0200)]
mtd: maps: intel_vr_nor: show parent device in sysfs

Fix a bug where mtd parent device symlinks aren't shown in sysfs.

While at it, make use of the default owner value set by mtdcore.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: maps: gpio-addr-flash: show parent device in sysfs
Frans Klaver [Wed, 10 Jun 2015 20:38:25 +0000 (22:38 +0200)]
mtd: maps: gpio-addr-flash: show parent device in sysfs

Fix a bug where mtd parent device symlinks aren't shown in sysfs.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: lpddr: show parent device in sysfs
Frans Klaver [Wed, 10 Jun 2015 20:38:23 +0000 (22:38 +0200)]
mtd: lpddr: show parent device in sysfs

Fix a bug where mtd parent device symlinks aren't shown in sysfs.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: devices: sst251: show parent device in sysfs
Frans Klaver [Wed, 10 Jun 2015 20:38:22 +0000 (22:38 +0200)]
mtd: devices: sst251: show parent device in sysfs

Fix a bug where mtd parent device symlinks aren't shown in sysfs.

While at it, make use of the default owner value set by mtdcore.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: devices: spear_smi: show parent device in sysfs
Frans Klaver [Wed, 10 Jun 2015 20:38:21 +0000 (22:38 +0200)]
mtd: devices: spear_smi: show parent device in sysfs

Fix a bug where mtd parent device symlinks aren't shown in sysfs.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: devices: mtd_dataflash: drop owner assignment
Frans Klaver [Wed, 10 Jun 2015 20:38:20 +0000 (22:38 +0200)]
mtd: devices: mtd_dataflash: drop owner assignment

Owner is automatically set by mtdcore. Make use of that.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: devices: docg3: show parent device in sysfs
Frans Klaver [Wed, 10 Jun 2015 20:38:18 +0000 (22:38 +0200)]
mtd: devices: docg3: show parent device in sysfs

Fix a bug where mtd parent device symlinks aren't shown in sysfs.

While at it, make use of the default owner value set by mtdcore.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: devices: bcm47xxflash: show parent device in sysfs
Frans Klaver [Wed, 10 Jun 2015 20:38:17 +0000 (22:38 +0200)]
mtd: devices: bcm47xxflash: show parent device in sysfs

Fix a bug where mtd parent device symlinks aren't shown in sysfs.

While at it, make use of the default owner value set by mtdcore.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: core: set some defaults when dev.parent is set
Frans Klaver [Wed, 10 Jun 2015 20:38:16 +0000 (22:38 +0200)]
mtd: core: set some defaults when dev.parent is set

If a parent device is set, add_mtd_device() has enough knowledge to fill
in some sane default values for the module name and owner. Do so if they
aren't already set.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: core: tone down suggestion that dev.parent should be set
Frans Klaver [Wed, 10 Jun 2015 20:38:15 +0000 (22:38 +0200)]
mtd: core: tone down suggestion that dev.parent should be set

add_mtd_device() has a comment suggesting that the caller should have
set dev.parent. This is required to have the parent device symlink show
up in sysfs, but not for proper operation of the mtd device itself.
Currently we have five drivers registering mtd devices during module
initialization, so they don't actually provide a parent device to link
to. That means we cannot WARN_ON() here, as it would trigger false
positives.

Make the comment a bit less firm in its assertion that dev.parent should
be set.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: spi-nor: Add support for Micron n25q032a
Aurelien Chanot [Wed, 7 Oct 2015 19:10:08 +0000 (12:10 -0700)]
mtd: spi-nor: Add support for Micron n25q032a

The N25Q032A is identical to the N25Q032 except it has a different
supply voltage range. Therefore, it has a new JEDEC ID.

Signed-off-by: Aurelien Chanot <chanot.a@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: Allow MTD_NAND_BRCMNAND to be selected for ARM64
Anup Patel [Fri, 2 Oct 2015 17:56:43 +0000 (23:26 +0530)]
mtd: nand: Allow MTD_NAND_BRCMNAND to be selected for ARM64

The BRCM NAND driver can be re-used for Broadcom ARM64 SoCs hence
this patch updates Kconfig to allow selection of MTD_NAND_BRCMNAND
for ARM64.

Signed-off-by: Anup Patel <anup.patel@broadcom.com>
Reviewed-by: Vikram Prakash <vikramp@broadcom.com>
Reviewed-by: Ray Jui <rjui@broadcom.com>
Reviewed-by: Pramod KUMAR <pramodku@broadcom.com>
Reviewed-by: Scott Branden <sbranden@broadcom.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: brcmnand: Fix pointer type-cast in brcmnand_write()
Anup Patel [Fri, 2 Oct 2015 17:56:42 +0000 (23:26 +0530)]
mtd: brcmnand: Fix pointer type-cast in brcmnand_write()

We should always type-cast pointer to "long" or "unsigned long"
because size of pointer is same as machine word size. This will
avoid pointer type-cast issues on both 32bit and 64bit systems.

This patch fixes pointer type-cast issue in brcmnand_write()
as-per above info.

Signed-off-by: Anup Patel <anup.patel@broadcom.com>
Reviewed-by: Vikram Prakash <vikramp@broadcom.com>
Reviewed-by: Ray Jui <rjui@broadcom.com>
Reviewed-by: Scott Branden <sbranden@broadcom.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: pxa2xx-flash: switch from ioremap_cache to memremap
Dan Williams [Fri, 9 Oct 2015 22:16:51 +0000 (18:16 -0400)]
mtd: pxa2xx-flash: switch from ioremap_cache to memremap

In preparation for deprecating ioremap_cache() convert its usage in
pxa2xx-flash to memremap.

Cc: David Woodhouse <dwmw2@infradead.org>
[brian: also convert iounmap to memunmap]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand_bbt: set the smallest size of bbt table
Sheng Yong [Fri, 31 Jul 2015 01:12:44 +0000 (01:12 +0000)]
mtd: nand_bbt: set the smallest size of bbt table

When using nandsim to simulate a 128K block nand with `overridesize = 1',
the size of mtd device is too small (mtd_size = 4 * block_size) to get the
right length of bbt. Then when creating bbt, kzmalloc() will return
ZERO_SIZE_PTR. This causes a NULL pointer oops when scanning bbt.

[  952.156166] BUG: unable to handle kernel NULL pointer dereference at 0000000000000010
[  952.157064] IP: [<ffffffff8148ad4a>] nand_isreserved_bbt+0x2a/0x40
[  952.157064] PGD 0
[  952.157064] Oops: 0000 [#1] SMP
[  952.157064] Modules linked in: nandsim(+) [last unloaded: nandsim]
[  952.157064] CPU: 1 PID: 7103 Comm: modprobe Not tainted 4.2.0-rc3-next-20150724 #4
[  952.157064] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
[  952.157064] task: ffff88003e24b980 ti: ffff88003d274000 task.ti: ffff88003d274000
[  952.157064] RIP: 0010:[<ffffffff8148ad4a>]  [<ffffffff8148ad4a>] nand_isreserved_bbt+0x2a/0x40
[  952.157064] RSP: 0018:ffff88003d277b90  EFLAGS: 00010246
[  952.157064] RAX: 0000000000000010 RBX: ffff88003d5a1000 RCX: 0000000000000000
[  952.157064] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff88003d919000
[  952.157064] RBP: ffff88003d277b98 R08: 0000000000020000 R09: 0000000000000000
[  952.157064] R10: 0000000000000000 R11: 0000000000000195 R12: ffff88003d919000
[  952.157064] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
[  952.157064] FS:  00007fada4d07700(0000) GS:ffff88003fd00000(0000) knlGS:0000000000000000
[  952.157064] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[  952.157064] CR2: 0000000000000010 CR3: 0000000037924000 CR4: 00000000000006a0
[  952.157064] Stack:
[  952.157064]  ffffffff814851ec ffff88003d277ba8 ffffffff8147e35f ffff88003d277bf8
[  952.157064]  ffffffff814816f3 ffff88003d277c08 ffff88003d277bc8 0000000000000282
[  952.157064]  0000000000000001 0000000000000000 ffff88003d209540 0000000000000001
[  952.157064] Call Trace:
[  952.157064]  [<ffffffff814851ec>] ? nand_block_isreserved+0x1c/0x20
[  952.157064]  [<ffffffff8147e35f>] mtd_block_isreserved+0x1f/0x30
[  952.157064]  [<ffffffff814816f3>] allocate_partition+0x463/0x6a0
[  952.157064]  [<ffffffff81481b3b>] add_mtd_partitions+0x4b/0xe0
[  952.157064]  [<ffffffff8147f14c>] mtd_device_parse_register+0x4c/0xe0
[  952.157064]  [<ffffffffa0013daf>] ns_init_module+0xdaf/0xde4 [nandsim]
[  952.157064]  [<ffffffff8128d7c8>] ? kasprintf+0x38/0x40
[  952.157064]  [<ffffffffa0013000>] ? 0xffffffffa0013000
[  952.157064]  [<ffffffff810002c3>] do_one_initcall+0x83/0x1b0
[  952.157064]  [<ffffffff8113afab>] ? kmem_cache_alloc_trace+0x6b/0x120
[  952.157064]  [<ffffffff8160b503>] do_init_module+0x5c/0x1dd
[  952.157064]  [<ffffffff810aa4db>] load_module+0x1bbb/0x20b0
[  952.157064]  [<ffffffff810a6fc0>] ? __symbol_put+0x30/0x30
[  952.157064]  [<ffffffff810aaac9>] SyS_init_module+0xf9/0x110
[  952.157064]  [<ffffffff810aa9d1>] ? SyS_init_module+0x1/0x110
[  952.157064]  [<ffffffff81615f57>] entry_SYSCALL_64_fastpath+0x12/0x6a
[  952.157064] Code: 00 55 48 8b 87 80 01 00 00 48 89 e5 8b 88 cc 00 00 00 48 8b 80 f0 03 00 00 5d 48 d3 fe 89 f2 83 e6 03 c1 fa 02 8d 0c 36 48 63 d2 <0f> b6 04 10 d3 f8 83 e0 03 3c 02 0f 94 c0 0f b6 c0 c3 0f 1f 40
[  952.157064] RIP  [<ffffffff8148ad4a>] nand_isreserved_bbt+0x2a/0x40
[  952.157064]  RSP <ffff88003d277b90>
[  952.157064] CR2: 0000000000000010
[  952.204010] ---[ end trace 6ca2e1c041fdba36 ]---

This patch gives a smallest length to bbt, 1 byte, which is enough to
represent up to 4 blocks.

Signed-off-by: Sheng Yong <shengyong1@huawei.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: mtdpart: add debug prints to partition parser.
Michal Suchanek [Tue, 18 Aug 2015 15:34:07 +0000 (15:34 +0000)]
mtd: mtdpart: add debug prints to partition parser.

The probe of a mtd device can fail when a partition parser returns
error. The failure due to partition parsing can be quite mysterious when
multiple partitioning schemes are compiled in and any of them can fail
the probe.

Add debug prints which show what parsers were tried and what they
returned.

Signed-off-by: Michal Suchanek <hramrach@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agojffs2: fix a memleak in read_direntry()
Wei Fang [Tue, 29 Sep 2015 03:23:55 +0000 (11:23 +0800)]
jffs2: fix a memleak in read_direntry()

Need to free the memory allocated for 'fd' if failed to read all
of the remainder name.

Signed-off-by: Wei Fang <fangwei1@huawei.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: lpc32xx_slc: fix calculation of timing arcs from given values
Vladimir Zapolskiy [Wed, 30 Sep 2015 23:23:37 +0000 (02:23 +0300)]
mtd: nand: lpc32xx_slc: fix calculation of timing arcs from given values

According to LPC32xx User's Manual all values measured in clock cycles
are programmable from 1 to 16 clocks (4 bits) starting from 0 in
bitfield, the current version of calculated clock cycles is too
conservative.

Correctness of 0 bitfield value (i.e. programmed 1 clock
timing) is proven with actual NAND chip devices.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: lpc32xx_slc: fix potential overflow over 4 bits
Vladimir Zapolskiy [Wed, 30 Sep 2015 23:23:36 +0000 (02:23 +0300)]
mtd: nand: lpc32xx_slc: fix potential overflow over 4 bits

In case if quotient of controller clock rate to device clock rate does
not fit into 4 bit value, choose the maximum acceptable value 0xF, which
stands for 16 clocks.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: lpc32xx_slc: improve SLCTAC_*() macro definitions
Vladimir Zapolskiy [Wed, 30 Sep 2015 23:23:35 +0000 (02:23 +0300)]
mtd: nand: lpc32xx_slc: improve SLCTAC_*() macro definitions

No functional change, move bitfield calculations to macro
definitions with added clock rate argument, which are in turn defined
by new common SLCTAC_CLOCKS(c, n, s) macro definition.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: sunxi: fix bitflips in erased pages
Boris BREZILLON [Wed, 30 Sep 2015 21:45:29 +0000 (23:45 +0200)]
mtd: nand: sunxi: fix bitflips in erased pages

Use the nand_check_erased_ecc_chunk() function to test if the ECC error
was triggered by an erased page containing a few bitflips.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: sunxi: replace the NFC_BUF_TO_USER_DATA() macro by an inline function
Boris BREZILLON [Wed, 30 Sep 2015 21:45:28 +0000 (23:45 +0200)]
mtd: nand: sunxi: replace the NFC_BUF_TO_USER_DATA() macro by an inline function

sunxi_nfc_user_data_to_buf() is exposed as an inline function, replace the
NFC_BUF_TO_USER_DATA() macro by an inline function to be consistent.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: sunxi: retrieve corrected OOB bytes
Boris BREZILLON [Wed, 30 Sep 2015 21:45:27 +0000 (23:45 +0200)]
mtd: nand: sunxi: retrieve corrected OOB bytes

The ECC engine is protecting a few OOB bytes. Retrieve them from the
USER_DATA register instead of reading them in raw mode (ie without the ECC
protection).

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: sunxi: factorize extra OOB bytes handling
Boris BREZILLON [Wed, 30 Sep 2015 21:45:26 +0000 (23:45 +0200)]
mtd: nand: sunxi: factorize extra OOB bytes handling

Add helper functions to factorize the code dealing extra OOB bytes in the
normal and syndrome ECC implementations.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: sunxi: make use of sunxi_nfc_hw_ecc_read/write_chunk()
Boris BREZILLON [Wed, 30 Sep 2015 21:45:25 +0000 (23:45 +0200)]
mtd: nand: sunxi: make use of sunxi_nfc_hw_ecc_read/write_chunk()

The sunxi_nfc_hw_ecc_read/write_chunk() functions have been created to
factorize the code in the normal and syndrome ECC implementation.
Make use of them where appropriate.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: sunxi: introduce sunxi_nfc_hw_ecc_read/write_chunk()
Boris BREZILLON [Wed, 30 Sep 2015 21:45:24 +0000 (23:45 +0200)]
mtd: nand: sunxi: introduce sunxi_nfc_hw_ecc_read/write_chunk()

The logic behind normal and syndrome ECC handling is pretty much the same,
the only difference is the ECC bytes placement.
Create two functions to read/write ECC chunks. Those functions will later
be used by the sunxi_nfc_hw_ecc_read/write_page() and
sunxi_nfc_hw_syndrome_ecc_read/write_page() functions.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: sunxi: create sunxi_nfc_hw_ecc_enable()/disable() functions
Boris BREZILLON [Wed, 30 Sep 2015 21:45:23 +0000 (23:45 +0200)]
mtd: nand: sunxi: create sunxi_nfc_hw_ecc_enable()/disable() functions

The code used to enable/disable the hardware ECC engine is repeated in a
lot of places. Create two functions to avoid code duplication.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: fsmc: Remove BUG macros
Stefan Roese [Fri, 2 Oct 2015 10:40:21 +0000 (12:40 +0200)]
mtd: nand: fsmc: Remove BUG macros

Remove the BUG macros and return with error (if possible) instead.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: fsmc: Small whitespace cleanup
Stefan Roese [Fri, 2 Oct 2015 10:40:20 +0000 (12:40 +0200)]
mtd: nand: fsmc: Small whitespace cleanup

Remove tab in empty line.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: remove unused ->init_size() hook
Boris BREZILLON [Thu, 1 Oct 2015 14:58:27 +0000 (16:58 +0200)]
mtd: nand: remove unused ->init_size() hook

The ->init_size() hook was introduced to let NAND controller drivers
support NAND devices that could not be described in the nand_ids table.
Since then, the core has added support for extended-id parsing and
full-id description, thus allowing to describe pretty much all existing
NANDs.
Moreover, this hook is not used by any mainline driver, and should not be
used by new drivers, because detecting the NAND chip is not something
controller specific.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agosh: mach-rsk: remove unnecessary MTD partition probe specification
Brian Norris [Mon, 18 May 2015 23:24:30 +0000 (16:24 -0700)]
sh: mach-rsk: remove unnecessary MTD partition probe specification

The cmdlinepart parser is already supported in the default probe.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: brcmnand: remove unnecessary fields from brcmnand_soc
Brian Norris [Thu, 21 May 2015 00:05:06 +0000 (17:05 -0700)]
mtd: brcmnand: remove unnecessary fields from brcmnand_soc

These really aren't needed, especially now that we embed the soc struct
in our private struct, so we can stash things there if needed.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: brcmnand: refactor iProc SoC layering
Brian Norris [Thu, 21 May 2015 00:05:05 +0000 (17:05 -0700)]
mtd: brcmnand: refactor iProc SoC layering

Removes an unnecessary allocation and saves a little bit of pointer
chasing.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: brcmnand: refactor bcm63138 SoC layering
Brian Norris [Thu, 21 May 2015 00:05:04 +0000 (17:05 -0700)]
mtd: brcmnand: refactor bcm63138 SoC layering

Removes an unnecessary allocation and saves a little bit of pointer
chasing.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: sunxi: rework macros
Boris BREZILLON [Wed, 16 Sep 2015 07:46:36 +0000 (09:46 +0200)]
mtd: nand: sunxi: rework macros

Suffix mask macros with _MSK and add new helper macros to avoid manually
shifting values.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agoMerge MTD 4.3-rc updates into -next
Brian Norris [Wed, 30 Sep 2015 18:12:14 +0000 (11:12 -0700)]
Merge MTD 4.3-rc updates into -next

8 years agomtd: nand: vf610_nfc: include missing pincrl/consumer.h
Brian Norris [Wed, 30 Sep 2015 16:54:26 +0000 (09:54 -0700)]
mtd: nand: vf610_nfc: include missing pincrl/consumer.h

This must have been implicitly included on the builds I tested. Reported
by numerous test bots:

   drivers/mtd/nand/vf610_nfc.c: In function 'vf610_nfc_resume':
   drivers/mtd/nand/vf610_nfc.c:660:2: error: implicit declaration of function 'pinctrl_pm_select_default_state' [-Werror=implicit-function-declaration]
     pinctrl_pm_select_default_state(dev);
     ^

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Stefan Agner <stefan@agner.ch>
8 years agomtd: mtdpart: fix add_mtd_partitions error path
Boris BREZILLON [Thu, 30 Jul 2015 10:18:03 +0000 (12:18 +0200)]
mtd: mtdpart: fix add_mtd_partitions error path

If we fail to allocate a partition structure in the middle of the partition
creation process, the already allocated partitions are never removed, which
means they are still present in the partition list and their resources are
never freed.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Cc: stable@vger.kernel.org
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agoRevert "mtd: mtdram: check offs and len in mtdram->erase"
Brian Norris [Wed, 30 Sep 2015 00:28:44 +0000 (17:28 -0700)]
Revert "mtd: mtdram: check offs and len in mtdram->erase"

This reverts commit 7827e3acad2df1c6537e5fe7211d216dabc60399.

There are some 64-bit arithmetic issues on some architectures, so let's
wait until we get a better patch for this.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: mtdram: check offs and len in mtdram->erase
Dongsheng Yang [Tue, 21 Jul 2015 08:30:20 +0000 (16:30 +0800)]
mtd: mtdram: check offs and len in mtdram->erase

We should prevent user to erasing mtd device with
an unaligned offset or length.

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: vf610_nfc: add device tree bindings
Stefan Agner [Thu, 3 Sep 2015 01:06:35 +0000 (18:06 -0700)]
mtd: nand: vf610_nfc: add device tree bindings

Signed-off-by: Bill Pringlemeir <bpringlemeir@nbsps.com>
Acked-by: Shawn Guo <shawnguo@kernel.org>
Signed-off-by: Stefan Agner <stefan@agner.ch>
[Brian: fixup #size-cells in example]
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: vf610_nfc: add hardware BCH-ECC support
Stefan Agner [Thu, 3 Sep 2015 01:06:34 +0000 (18:06 -0700)]
mtd: nand: vf610_nfc: add hardware BCH-ECC support

This adds hardware ECC support using the BCH encoder in the NFC IP.
The ECC encoder supports up to 32-bit correction by using 60 error
correction bytes. There is no sub-page ECC step, ECC is calculated
always across the whole page (up to 2k pages).

Limitations:
- HW ECC: Only 2K page with 64+ OOB.
- HW ECC: Only 24 and 32-bit error correction implemented.

Raw writes have been tested using the generic nand_write_page_raw
implementation. However, raw reads are currently not possible
because the controller need to know whether we are going to use
the ECC mode already at NAND_CMD_READ0 command time. At this point
we do not have the information whether it is a raw read or a
regular read at driver level...

Signed-off-by: Bill Pringlemeir <bpringlemeir@nbsps.com>
Signed-off-by: Stefan Agner <stefan@agner.ch>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: vf610_nfc: Freescale NFC for VF610, MPC5125 and others
Stefan Agner [Thu, 3 Sep 2015 01:06:33 +0000 (18:06 -0700)]
mtd: nand: vf610_nfc: Freescale NFC for VF610, MPC5125 and others

This driver supports Freescale NFC (NAND flash controller) found on
Vybrid (VF610), MPC5125, MCF54418 and Kinetis K70. The driver has
been tested using 8-bit and 16-bit NAND interface on the ARM based
Vybrid SoC VF500 and VF610 platform.
parameter page reading.

Limitations:
- Untested on MPC5125 and M54418.
- DMA and pipelining not used.
- 2K pages or less.
- No chip select, one NAND chip per controller.
- No hardware ECC.

Some paths have been hand-optimized and evaluated by measurements
made using mtd_speedtest.ko on a 100MB MTD partition.

Colibri VF50
        eb write     %   eb read     %   page write      %   page read     %
rel/opt     5175           11537                4560             11039
opt         5164 -0.21     11420 -1.01          4737 +3.88       10918 -1.10
none        5113 -1.20     11352 -1.60          4490 -1.54       10865 -1.58

Colibri VF61
        eb write     %   eb read     %   page write      %   page read     %
rel/opt     5766           13096                5459             12846
opt         5883 +2.03     13064 -0.24          5561 +1.87       12802 -0.34
none        5701 -1.13     12980 -0.89          5488 +0.53       12735 -0.86

rel = using readl_relaxed/writel_relaxed in optimized paths
opt = hand-optimized by combining multiple accesses into one read/write

The measurements have not been statistically verfied, hence use them
with care. The author came to the conclusion that using the relaxed
variants of readl/writel are not worth the additional code.

Signed-off-by: Bill Pringlemeir <bpringlemeir@nbsps.com>
Tested-by: Albert ARIBAUD <albert.aribaud@3adev.fr>
Signed-off-by: Stefan Agner <stefan@agner.ch>
Reviewed-by: Alexey Klimov <klimov.linux@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: provide proper 32/64-bit compat_ioctl() support for BLKPG
Brian Norris [Mon, 21 Sep 2015 20:26:59 +0000 (13:26 -0700)]
mtd: provide proper 32/64-bit compat_ioctl() support for BLKPG

After a bit of poking around wondering why my 32-bit user-space can't
seem to send a proper ioctl(BLKPG) to an MTD on my 64-bit kernel
(ARM64), I noticed that struct blkpg_ioctl_arg is actually pretty
unsuitable for use in the ioctl() ABI, due to its use of raw pointers,
and its lack of alignment/packing restrictions (32-bit arch'es tend to
pack the 4 fields into 4 32-bit words, whereas 64-bit arch'es would add
padding after the third int, and make this 6 32-bit words).

Anyway, this means BLKPG deserves some special compat_ioctl handling. Do
the conversion in a small shim for MTD.

block/compat_ioctl.c already has compat support for the block subsystem,
but it does so by a re-marshalling data to/from user-space (see
compat_blkpg_ioctl()). Personally, I think this approach is cleaner.

Tested only on MTD, with an ARM32 user space on an ARM64 kernel.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: spi-nor: add support for w25q128fw
Brian Norris [Fri, 18 Sep 2015 22:08:14 +0000 (15:08 -0700)]
mtd: spi-nor: add support for w25q128fw

Tested only with single I/O, but the datasheet says it supports dual and
quad.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: spi-nor: scale up timeout for full-chip erase
Furquan Shaikh [Fri, 18 Sep 2015 21:59:17 +0000 (14:59 -0700)]
mtd: spi-nor: scale up timeout for full-chip erase

This patch fixes timeout issues seen on large NOR flash (e.g., 16MB
w25q128fw) when using ioctl(MEMERASE) with offset=0 and length=16M. The
input parameters matter because spi_nor_erase() uses a different code
path for full-chip erase, where we use the SPINOR_OP_CHIP_ERASE (0xc7)
opcode.

Fix: use a different timeout for full-chip erase than for other
commands.

While most operations can be expected to perform relatively similarly
across a variety of NOR flash types and sizes (and therefore might as
well use a similar timeout to keep things simple), full-chip erase is
unique, because the time it typically takes to complete:
(1) is much larger than most operations and
(2) scales with the size of the flash.

Let's base our timeout on the original comments stuck here -- that a 2MB
flash requires max 40s to erase.

Small survey of a few flash datasheets I have lying around:

  Chip         Size (MB)   Max chip erase (seconds)
  ----         --------    ------------------------
  w25q32fw     4           50
  w25q64cv     8           30
  w25q64fw     8           100
  w25q128fw    16          200
  s25fl128s    16          ~256
  s25fl256s    32          ~512

From this data, it seems plenty sufficient to say we need to wait for
40 seconds for each 2MB of flash.

After this change, it might make some sense to decrease the timeout for
everything else, as even the most extreme operations (single block
erase?) shouldn't take more than a handful of seconds. But for safety,
let's leave it as-is. It's only an error case, after all, so we don't
exactly need to optimize it.

Signed-off-by: Furquan Shaikh <furquan@google.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: spi-nor: Add support for sst25wf040b
Yao Yuan [Wed, 16 Sep 2015 09:59:45 +0000 (17:59 +0800)]
mtd: spi-nor: Add support for sst25wf040b

It is a 512KiB flash with 4 KiB erase sectors.

Signed-off-by: Yuan Yao <yao.yuan@freescale.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agopcmciamtd: Add id for PRETEC 4MB SRAM
Tom Englund [Fri, 18 Sep 2015 19:42:59 +0000 (21:42 +0200)]
pcmciamtd: Add id for PRETEC 4MB SRAM

The module pcmciamtd doesn't generate a mtd node for PRETEC 4MB SRAM
cards without the id and hash added to pcmciamtd.c

Tested on 3 different 4MB pretec sram cards.

Signed-off-by: Tom Englund <tomenglund26@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: denali: max_banks calculation changed in revision 5.1
Graham Moore [Tue, 21 Jul 2015 14:39:31 +0000 (09:39 -0500)]
mtd: nand: denali: max_banks calculation changed in revision 5.1

Read Denali hardware revision number and use it to
calculate max_banks,  The encoding of max_banks changed
in Denali revision 5.1.

Signed-off-by: Graham Moore <grmoore@opensource.altera.com>
[Brian: parentheses around macro arg]
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: denali: pass col argument to READID operation
Enrico Jorns [Fri, 18 Sep 2015 08:02:41 +0000 (10:02 +0200)]
mtd: nand: denali: pass col argument to READID operation

A read id operation followed by 0x00 reads the device ID while
a read id operation followed by 0x20 reads the possible ONFI identifier.

As the READID function did not propagate the second id parameter but had
a hard-coded call for 0x90 0x00, reading the ONFI identifier was not
possible and thus chips werde not detected (tested with
MT29F8G08ABABAWP)

Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agojffs2: remove unneeded kfree
fangwei [Tue, 7 Jul 2015 02:54:26 +0000 (10:54 +0800)]
jffs2: remove unneeded kfree

c->oobbuf hasn't been kmalloced in jffs2_dataflash_setup, so
there is no need to free it.

Signed-off-by: Wei Fang <fangwei1@huawei.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>