Commit Graph

5829 Commits

Author SHA1 Message Date
Vladimir Zapolskiy cf9e1672a6 mtd: nand: lpc32xx: fix invalid error handling of a requested irq
Semantics of NR_IRQS is different on machines with SPARSE_IRQ option
disabled or enabled, in the latter case IRQs are allocated starting
at least from the value specified by NR_IRQS and going upwards, so
the check of (irq >= NR_IRQ) to decide about an error code returned by
platform_get_irq() is completely invalid, don't attempt to overrule
irq subsystem in the driver.

The change fixes LPC32xx NAND MLC driver initialization on boot.

Fixes: 8cb17b5ed0 ("irqchip: Add LPC32xx interrupt controller driver")
Cc: stable@kernel.org # v4.7+
Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Acked-by: Sylvain Lemieux <slemieux.tyco@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
2017-01-04 20:50:18 +01:00
Marc Gonzalez 8043d25b3c mtd: nand: tango: Reset pbus to raw mode in probe
Linux should not expect the boot loader to properly configure the
peripheral bus "pad mode", so reset PBUS_PAD_MODE to raw.

Signed-off-by: Marc Gonzalez <marc_gonzalez@sigmadesigns.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
2017-01-03 11:58:35 +01:00
Marc Gonzalez 7165b8ad36 mtd: nand: tango: Update DT binding description
Visually separate register ranges (address/size pairs) in reg prop.
Change DMA channel name, for consistency with other drivers.

Signed-off-by: Marc Gonzalez <marc_gonzalez@sigmadesigns.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
2017-01-03 09:51:13 +01:00
Randy Dunlap f0fcdc506b mtd: nand: oxnas_nand: fix build errors on arch/um, require HAS_IOMEM
Fix build errors on arch/um, which does not support HAS_IOMEM,
while the oxnas_nand.c driver uses interfaces that are
supplied by HAS_IOMEM.

(loadable module build:)
ERROR: "devm_ioremap_resource" [drivers/mtd/nand/oxnas_nand.ko] undefined!
or (built-in build:)
drivers/built-in.o: In function `oxnas_nand_probe':
drivers/mtd/nand/oxnas_nand.c:102: undefined reference to `devm_ioremap_resource'

Fixes: 6685924924 ("mtd: nand: Add OX820 NAND Support")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Acked-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
2017-01-02 09:56:57 +01:00
Hauke Mehrtens a272466349 mtd: nand: xway: fix build because of module functions
Remove the usage of modules functions to make this driver compile
again. Otherwise an include of linux/modules.h would be needed.

Fixes: 024366750c ("mtd: nand: xway: convert to normal platform driver")
Cc: <stable@vger.kernel.org>
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
2017-01-02 09:44:21 +01:00
Hauke Mehrtens 73529c872a mtd: nand: xway: disable module support
The xway_nand driver accesses the ltq_ebu_membase symbol which is not
exported. This also should not get exported and we should handle the
EBU interface in a better way later. This quick fix just deactivated
support for building as module.

Fixes: 99f2b10792 ("mtd: lantiq: Add NAND support on Lantiq XWAY SoC.")
Cc: <stable@vger.kernel.org>
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
2017-01-02 09:43:57 +01:00
Linus Torvalds 7c0f6ba682 Replace <asm/uaccess.h> with <linux/uaccess.h> globally
This was entirely automated, using the script by Al:

  PATT='^[[:blank:]]*#[[:blank:]]*include[[:blank:]]*<asm/uaccess.h>'
  sed -i -e "s!$PATT!#include <linux/uaccess.h>!" \
        $(git grep -l "$PATT"|grep -v ^include/linux/uaccess.h)

to do the replacement at the end of the merge window.

Requested-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-12-24 11:46:01 -08:00
Linus Torvalds c07dee7348 MTD updates for v4.10-rc1:
Core:
 
   * dynamic BDI object allocation (resolves some problems when built as a
     module)
   * cleanups in the ooblayout handling
 
 NAND:
 
   * new tango NAND controller driver
   * new ox820 NAND controller driver
   * addition of a new full-ID entry in the nand_ids table
   * rework of the s3c240 driver to support DT
   * extension of the nand_sdr_timings to expose tCCS, tPROG and tR
   * addition of a new flag to ask the core to wait for tCCS when sending
     a RNDIN/RNDOUT command
   * addition of a new flag to ask the core to let the controller driver
     send the READ/PROGPAGE command
 
   Minor fixes/cleanup/cosmetic changes:
   * properly support 512 ECC step size in the sunxi driver
   * improve the error messages in the PXA probe path
   * fix module autoload in the omap2 driver
   * cleanup of several nand drivers to return nand_scan{_tail}() error
     code instead of returning -EIO
   * various cleanups in the denali driver
   * fix an error check in nandsim
 
 SPI NOR:
 
   * new flash IDs
   * wait for Spansion flash to be ready after quad-enable
   * error handling fixes for Candence QSPI
   * constify some structures in Freescale QSPI driver
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJYVEDMAAoJEFySrpd9RFgtHfoP/33L6OgHn0kzonYhB3/BKFol
 WFEAdu2Z2cT9sQE0GpZFAcySasVisQMONoL0RBmvxZTeW2YtiN6NEJkr98JropzJ
 HowNDxuVuDiJ2clmTkE5J1i9WMUV0t6TqWzdbXSme9s68P6p1q9RLH6rmq06JITj
 zc56HrHgtYLCyFn5MtHPat4/jOPhqPHXfVnadtNAJ28FazhnsurkJe/ChUvGS1xJ
 2xSfueERHuPcNrpMEbNcyS4OOJpFqI1Ds3+7vJxz4kpWomAJEQ4l7Jw7e+GaKI5q
 2DsEUbvIPCMZMH1cqyWgVsWaDO820KFcJ4MwHT7nsNSvrjOEUivZCPpk/L2Wa7sd
 x6A4YvRPrKMoaE8CFgjz7K7UXDLU6Xa+ZwyIqn4YsnuunzhspjJI7BdrhApTRMwn
 Nhwr2bNmK1Hf4nfUnddH9/+0X06wOnEgzCx8I3t3VjvzbPIVozcfNVXFhLURxICR
 WRRAgbNA2ES88DFtLF2pnwIi8z+WLYRhe0tWsjb8h3/Xr8BQGS2hEy0N+MLolglj
 GlH1SMOddHHOAyG53YUNdhb3T7MbBEIcBmQH6ihJgkDqHcVrgCcaUtR2fSJII0Ln
 fpmlSBeut/KC2wIrf0+UACv2kUWpfgOQLCoKMZLjJMGytolNl63+Q/Jmrng5LjXv
 lx7sMp3dE9kBRORPeaw0
 =H2FS
 -----END PGP SIGNATURE-----

Merge tag 'for-linus-20161216' of git://git.infradead.org/linux-mtd

Pull MTD updates from Brian Norris:
 "Nothing enormous here, though notably we have some of the first work
  of a few new maintainers. I think for now I'll still be sending pull
  requests, but that's open to change in the future. Summary:

  Core:

   - dynamic BDI object allocation (resolves some problems when built as
     a module)
   - cleanups in the ooblayout handling

  NAND:

   - new tango NAND controller driver
   - new ox820 NAND controller driver
   - addition of a new full-ID entry in the nand_ids table
   - rework of the s3c240 driver to support DT
   - extension of the nand_sdr_timings to expose tCCS, tPROG and tR
   - addition of a new flag to ask the core to wait for tCCS when
     sending a RNDIN/RNDOUT command
   - addition of a new flag to ask the core to let the controller driver
     send the READ/PROGPAGE command

  Minor fixes/cleanup/cosmetic changes:

   - properly support 512 ECC step size in the sunxi driver
   - improve the error messages in the PXA probe path
   - fix module autoload in the omap2 driver
   - cleanup of several nand drivers to return nand_scan{_tail}() error
     code instead of returning -EIO
   - various cleanups in the denali driver
   - fix an error check in nandsim

  SPI NOR:

   - new flash IDs
   - wait for Spansion flash to be ready after quad-enable
   - error handling fixes for Candence QSPI
   - constify some structures in Freescale QSPI driver"

* tag 'for-linus-20161216' of git://git.infradead.org/linux-mtd: (71 commits)
  mtd: Allocate bdi objects dynamically
  mtd: nand: tango: Add standard legalese header
  mtd: maps: add missing iounmap() in error path
  mtd: spi-nor: constify fsl_qspi_devtype_data
  mtd: spi-nor: Add support for mr25h40
  mtd: spi-nor: Add support for N25Q016A
  mtd: spi-nor: Add at25df321 spi-nor flash support
  mtd: spi-nor: Fix some error codes in cqspi_setup_flash()
  mtd: spi-nor: Off by one in cqspi_setup_flash()
  mtd: spi-nor: add support for s25fl208k
  mtd: spi-nor: fix flags for s25fl128s
  mtd: spi-nor: fix spansion quad enable
  mtd: spi-nor: add Macronix mx25u25635f to list of known devices.
  mtd: mtdswap: fix spelling mistake "erassure" -> "erasure"
  mtd: bcm47xxpart: fix parsing first block after aligned TRX
  mtd: nand: tango: Use nand_to_mtd() instead of directly accessing chip->mtd
  mtd: remove unneeded initializer in mtd_ooblayout_count_bytes()
  mtd: use min_t() to refactor mtd_ooblayout_{get, set}_bytes()
  mtd: remove unneeded initializer in mtd_ooblayout_{get, set}_bytes()
  mtd: nand: nandsim: fix error check
  ...
2016-12-17 16:41:10 -08:00
Steve Longerbeam 445caaa20c mtd: Allocate bdi objects dynamically
The MTD backing dev info objects mtd_bdi was statically allocated.
So when MTD is built as a loadable module, this object fall in the
vmalloc address space.

The problem with that, is that the BDI APIs use wake_up_bit(), which calls
virt_to_page() to retrieve the memory zone of the page containing the
wait_queue to wake up, and virt_to_page() is not valid for vmalloc or
highmem addresses.

Fix this by allocating the BDI objects dynamically with kmalloc. The
objects now fall in the logical address space so that BDI APIs will
work in all cases (mtd builtin or module).

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Jim Baxter <jim_baxter@mentor.com>
Signed-off-by: Sandeep Jain <Sandeep_Jain@mentor.com>
Reviewed-by: Richard Weinberger <richard@nod.at>
Reviewed-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2016-12-01 10:03:17 -08:00
Marc Gonzalez 59dbc86cdc mtd: nand: tango: Add standard legalese header
Provide proper copyright notice and license information.

Signed-off-by: Marc Gonzalez <marc_gonzalez@sigmadesigns.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2016-12-01 09:46:31 -08:00
Luis Henriques 3502fbcc25 mtd: maps: add missing iounmap() in error path
This patch was triggered by the following Coccinelle error:

./drivers/mtd/maps/sc520cdp.c:246:3-9: \
	ERROR: missing iounmap; ioremap on line 242 \
	and execution via conditional on line 244

Since do_map_probe() is also invoked in this loop, it is also necessary to
map_destroy() any initialised struct mtd_info.

Signed-off-by: Luis Henriques <henrix@camandro.org>
Reviewed-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2016-11-30 18:30:24 -08:00
Brian Norris 5fed67df87 This pull request contains the following notable changes:
- add support to new memory parts.
 - fix of spansion_quad_enable().
 - fix of the Candence QSPI driver.
 - constify some structure instances of the Freescale QSPI driver.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJYPBLJAAoJEOfg6AsdGklyuiwQAK+8obDq8ZV2Xt0d1uEuEiWY
 Trqc3hl6oIuroUuUkaVBjSAvL3kj3u0TdHyZPXiRqikvJjVgPC8Ef9gGvauiL3Bk
 F1wBiixXAAfoZsEUxkaEjQ9HxAosmf/5vtM6xSKq6T2SbYrbSL/LNP9YvnbKHn6I
 gupjwEEEb2oLE9MRbNBttq/rTnLZD0xMPmN9qBfVWgXQ6E+rRSjqpmjM1BRPHSt8
 v019vv5jKhZWKI/xvTPnDtxp1h9mCk9uxAqHHVaiiNrNP3mdaRE7sSec5Ja+he2S
 JIpDeM9Dd7UBsPFz49u3ZoLpES5dQg3AL5zugYCWje24xV+hbqdtynKPi+oWCwLH
 b8bzoanV07A3b732ClOvWSS4fuV1bYvLUs8usAU4qGz4yL2+pexWvwEmnsTy8SOJ
 l903Lk+FD1vSwTCyqb8Oj/WhlOyChVCD/KirpBhr41W6DDwr2lcur31AufxNfkIS
 T5+JKRb9+SvOsjNE1WwlJkGbYSr86hnl7gfGY0Co6372xRYM/pFTtGr5gjWMgqpg
 9jB8g2afsu4I2rhXVX+Ncj+Ptbdr69u5ErM055PWWOm+VaJb9D56b7ZJxifPAYXL
 iST3oC3QT47qH3nukRZuGRc6v1gkYSpOVol19QumgB+hneytCeAXDq1p+lAIR15l
 ekMyjUdZuK/8ywKTn7Oi
 =jyez
 -----END PGP SIGNATURE-----

Merge tag 'spi-nor/for-4.10' of git://github.com/spi-nor/linux

From Cyrille Pitchen:

"""
This pull request contains the following notable changes:
- add support to new memory parts.
- fix of spansion_quad_enable().
- fix of the Candence QSPI driver.
- constify some structure instances of the Freescale QSPI driver.
"""
2016-11-29 18:31:14 -08:00
Brian Norris 0989b0909c This pull request contains the following notable changes:
- new tango NAND controller driver
 - new ox820 NAND controller driver
 - addition of a new full-ID entry in the nand_ids table
 - rework of the s3c240 driver to support DT
 - extension of the nand_sdr_timings to expose tCCS, tPROG and tR
 - addition of a new flag to ask the core to wait for tCCS when sending
   a RNDIN/RNDOUT command
 - addition of a new flag to ask the core to let the controller driver
   send the READ/PROGPAGE command
 
 This pull request also contains minor fixes/cleanup/cosmetic changes:
 - properly support 512 ECC step size in the sunxi driver
 - improve the error messages in the pxa probe path
 - fix module autoload in the omap2 driver
 - cleanup of several nand drivers to return nand_scan{_tail}() error
   code instead of returning -EIO
 - various cleanups in the denali driver
 - cleanups in the ooblayout handling (MTD core)
 - fix an error check in nandsim
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJYOu/YAAoJEGXtNgF+CLcAVZ4P/0Vi50SSLZ2EUOQqAbiQcUPV
 iO/20OPkTAXz6+Mi/csKZEnPGqpy2srn8MOgJx0gVO7b7hrhli6aBQJDxHLhGHVl
 N1hpTkZewZisLC1ewc9SA2SF/6zs93Bfk9cw0i4YxgE2gKPvZWT89Y9aZ/m/OWyW
 su0kis5YhMcAz2Oqq6oaCfRmbcMR62KkcjfB4U17FgXK56C5ziO7MoLjeAyYpi+f
 vHGzWFoDKHLfo4ISFq5inqB8pk6nQtkaERhx+y4WCwOcvMoOjOU9gWN1yyLyLsdp
 jimqdJegRlC63RkLoO5KNJqa3AlSTIpccIJaL2p8yHf/dtJQmhHXOl/gKgiO217n
 LMmeVJhMqUA652BJeXnyqg4VScTQFhwITccUFFauMEiRCzJWM6W1uzJZiGoWsrLG
 aKBYlWv+Z1dPGILf5AQobz16FuEsdVc60Fc4M02sL4QiH9TO2mg103licgiYdPIw
 0YcJ23t7KDf66uyGKvZwcDJSkJEKPkf5YEDi7VOFZF4CuaYKMqMo7oCb8PTKNMBP
 tMQpQ9cjaVBGv/vXHneBsyin/1wsKN0tAnbuh/cUT1sGa+JiEjGdeCm9o30G3334
 9YUZrPCwcN6mw5rOrD7Ts33OYONDAqCHJoP5IZovD8pbguEYAYZ2KFyHgu2KRQa3
 kMVq7QE0jvn956SVw1uD
 =og/Y
 -----END PGP SIGNATURE-----

Merge tag 'nand/for-4.10' of github.com:linux-nand/linux

From Boris Brezillon:

"""
This pull request contains the following notable changes:
- new tango NAND controller driver
- new ox820 NAND controller driver
- addition of a new full-ID entry in the nand_ids table
- rework of the s3c240 driver to support DT
- extension of the nand_sdr_timings to expose tCCS, tPROG and tR
- addition of a new flag to ask the core to wait for tCCS when sending
  a RNDIN/RNDOUT command
- addition of a new flag to ask the core to let the controller driver
  send the READ/PROGPAGE command

This pull request also contains minor fixes/cleanup/cosmetic changes:
- properly support 512 ECC step size in the sunxi driver
- improve the error messages in the pxa probe path
- fix module autoload in the omap2 driver
- cleanup of several nand drivers to return nand_scan{_tail}() error
  code instead of returning -EIO
- various cleanups in the denali driver
- cleanups in the ooblayout handling (MTD core)
- fix an error check in nandsim
"""
2016-11-29 18:28:30 -08:00
LABBE Corentin dfce0cd943 mtd: spi-nor: constify fsl_qspi_devtype_data
All fsl_qspi_devtype_data structures are never modified.
This patch constify them.

Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
Acked-by: Han Xu <han.xu@nxp.com>
Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com>
2016-11-26 17:45:06 +01:00
IWAMOTO Masahiko edd0c8f493 mtd: spi-nor: Add support for mr25h40
Add Everspin mr25h40 512KB MRAM to the list of supported chips.

Signed-off-by: Masahiko Iwamoto <iwamoto@allied-telesis.co.jp>
Reviewed-by: Jagan Teki <jagan@openedev.com>
Acked-by: Marek Vasut <marex@denx.de>
Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com>
2016-11-26 17:31:02 +01:00
Moritz Fischer 61e4611864 mtd: spi-nor: Add support for N25Q016A
This commit adds support in the spi-nor driver for the
N25Q016A, a 16Mbit SPI NOR flash from Micron.

Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Brian Norris <computersforpeace@gmail.com>
Cc: Jagan Teki <jteki@openedev.com>

Signed-off-by: Moritz Fischer <moritz.fischer@ettus.com>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com>
2016-11-26 17:06:11 +01:00
Jagan Teki b08618c929 mtd: spi-nor: Add at25df321 spi-nor flash support
Add Atmel at25df321 spi-nor flash to the list of spi_nor_ids.

Cc: Brian Norris <computersforpeace@gmail.com>
Cc: Wenyou Yang <wenyou.yang@atmel.com>
Signed-off-by: Jagan Teki <jteki@openedev.com>
Acked-by: Wenyou Yang <wenyou.yang@atmel.com>
Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com>
2016-11-26 17:01:42 +01:00
Dan Carpenter 10ad1d754a mtd: spi-nor: Fix some error codes in cqspi_setup_flash()
We return success or possibly uninitialized values on these error paths
instead of proper error codes.

Fixes: 1406234105 ("mtd: spi-nor: Add driver for Cadence Quad SPI Flash Controller")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Reviewed-by: Moritz Fischer <moritz.fischer@ettus.com>
Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com>
2016-11-26 16:50:13 +01:00
Dan Carpenter 193e87143c mtd: spi-nor: Off by one in cqspi_setup_flash()
There are CQSPI_MAX_CHIPSELECT elements in the ->f_pdata array so the >
should be >=.

Fixes: 1406234105 ('mtd: spi-nor: Add driver for Cadence Quad SPI Flash Controller')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com>
2016-11-26 16:50:03 +01:00
Sean Nyekjaer 022a400f90 mtd: spi-nor: add support for s25fl208k
Signed-off-by: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
Reviewed-by: Jagan Teki <jagan@openedev.com>
Acked-by: Marek Vasut <marex@denx.de>
Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com>
2016-11-26 16:43:57 +01:00
Heiner Kallweit 4287916d7b mtd: spi-nor: fix flags for s25fl128s
The Spansion S25FL128S also supports dual read mode.
In addition remove flag SECT_4K. 4K erases are supported,
but not uniformly.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Acked-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com>
2016-11-26 15:38:53 +01:00
Joël Esponde 807c162533 mtd: spi-nor: fix spansion quad enable
With the S25FL127S nor flash part, each writing to the configuration
register takes hundreds of ms. During that  time, no more accesses to
the flash should be done (even reads).

This commit adds a wait loop after the register writing until the flash
finishes its work.

This issue could make rootfs mounting fail when the latter was done too
much closely to this quad enable bit setting step. And in this case, a
driver as UBIFS may try to recover the filesystem and may broke it
completely.

Signed-off-by: Joël Esponde <joel.esponde@honeywell.com>
Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com>
2016-11-23 15:29:20 +01:00
Ash Benz 355445b86f mtd: spi-nor: add Macronix mx25u25635f to list of known devices.
Signed-off-by: Ash Benz <ash.benz@bk.ru>
Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com>
2016-11-23 14:52:56 +01:00
Colin Ian King b2c4ba5cf7 mtd: mtdswap: fix spelling mistake "erassure" -> "erasure"
Trivial fix to spelling mistake in dev_err message

Signed-off-by: Colin Ian King <colin.king@canonical.com>
[Brian: add EOL newline]
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2016-11-22 11:43:52 -08:00
Rafał Miłecki bd5d213101 mtd: bcm47xxpart: fix parsing first block after aligned TRX
After parsing TRX we should skip to the first block placed behind it.
Our code was working only with TRX with length not aligned to the
blocksize. In other cases (length aligned) it was missing the block
places right after TRX.

This fixes calculation and simplifies the comment.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2016-11-22 11:09:48 -08:00
Boris Brezillon 8fcfba0724 mtd: nand: tango: Use nand_to_mtd() instead of directly accessing chip->mtd
The nand_to_mtd() helper is here to hide internal mtd_info <-> nand_chip
association and ease future refactors.

Make use of this helper instead of directly accessing chip->mtd.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: Marc Gonzalez <marc_gonzalez@sigmadesigns.com>
2016-11-21 11:55:59 +01:00
Masahiro Yamada 4d6aecfb7e mtd: remove unneeded initializer in mtd_ooblayout_count_bytes()
There is no need to initialize oobregion since it will be filled by
the iterator.

This function is called with mtd_ooblayout_free or mtd_ooblayout_ecc
for the iterator; both of them calls memset() to clear the oobregion.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
2016-11-19 19:31:34 +01:00
Masahiro Yamada 7c295ef964 mtd: use min_t() to refactor mtd_ooblayout_{get, set}_bytes()
I hope this will make the code a little more readable.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
2016-11-19 19:31:32 +01:00
Masahiro Yamada 8e8fd4d1e8 mtd: remove unneeded initializer in mtd_ooblayout_{get, set}_bytes()
There is no need to initialize oobregion and section since they will
be filled by mtd_ooblayout_find_region().

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
2016-11-19 19:31:29 +01:00
Sudip Mukherjee 442168273e mtd: nand: nandsim: fix error check
debugfs_create_dir() and debugfs_create_file() returns NULL on error or
a pointer on success. They do not return the error value with ERR_PTR.
So we should not check the return with IS_ERR_OR_NULL, instead we
should just check for NULL.

Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
2016-11-19 09:43:15 +01:00
Marc Gonzalez 37871abdd5 mtd: nand: tango: Cleanup raw_write and raw_read
Drop raw_write return value (no longer used).
Drop raw_read  return value (for symmetry).

Signed-off-by: Marc Gonzalez <marc_gonzalez@sigmadesigns.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
2016-11-19 09:43:12 +01:00
Marc Gonzalez ff9e9eae0f mtd: nand: tango: Enable custom page accessors
Enable NAND_ECC_CUSTOM_PAGE_ACCESS in the tango NFC driver.
Fixup the "raw" page accessors to send the proper NAND commands.

Signed-off-by: Marc Gonzalez <marc_gonzalez@sigmadesigns.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
2016-11-19 09:43:10 +01:00
Marc Gonzalez 3371d663bb mtd: nand: Support controllers with custom page
If your controller already sends the required NAND commands when
reading or writing a page, then the framework is not supposed to
send READ0 and SEQIN/PAGEPROG respectively.

Signed-off-by: Marc Gonzalez <marc_gonzalez@sigmadesigns.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
2016-11-19 09:43:07 +01:00
Masahiro Yamada fc80f21a11 mtd: nand: denali: remove debug lines of __FILE__, __LINE__, __func__
Such debug lines might be useful when debugging the driver first,
but should be deleted from the upstream code.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
2016-11-19 09:40:42 +01:00
Masahiro Yamada 01a1d524eb mtd: nand: denali: remove unneeded parentheses
Remove parentheses surrounding the whole right side of an assignment.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
2016-11-19 09:40:41 +01:00
Masahiro Yamada a227d4e4c3 mtd: nand: denali: return error code from nand_scan_ident/tail on error
The nand_scan_ident/tail() returns an appropriate error value when
it fails.  Use it instead of the fixed -ENXIO.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
2016-11-19 09:40:41 +01:00
Masahiro Yamada 7ebb8d0678 mtd: nand: denali: return error code from devm_request_irq() on error
The devm_request_irq() returns an appropriate error value when it
fails.  Use it instead of the fixed -ENODEV.

While we are here, reword the comment to make it fit in a single
line, fixing the misspelling of "initialization".

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
2016-11-19 09:40:08 +01:00
Masahiro Yamada c1d0df192c mtd: nand: denali: use managed devm_irq_request()
Use the managed variant instead of request_irq() and free_irq().

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
2016-11-19 09:38:59 +01:00
Masahiro Yamada 376563917c mtd: nand: denali: remove unused struct member totalblks, blksperchip
The denali->blksperchip is set, but not referenced any more.  The
denali->totalblks is used only for calculating denali->blksperchip.
Both of them are unneeded.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
2016-11-19 09:38:59 +01:00
Masahiro Yamada 789ccf1775 mtd: nand: denali: remove "Spectra:" prefix from printk strings
As far as I understood from the Kconfig menu deleted by commit
be7f39c5ec ("Staging: delete spectra driver"), the "Spectra" is
specific to Intel Moorestown Platform.

The Denali NAND controller IP is used for various SoCs such as
Altera SOCFPGA, Socionext UniPhier, etc.  The platform specific
strings are not preferred in this driver.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
2016-11-19 09:38:49 +01:00
Masahiro Yamada c9e0258432 mtd: nand: denali: remove detect_partition_feature()
The denali->fwblks is set by detect_partition_feature(), but it is
not referenced from anywhere.  That means the struct member fwblks
and the whole of detect_partition_feature() are unneeded.

The comment block implies this function is only for Intel platforms.
I found drivers/staging/spectra used to exist, but it was deleted by
commit be7f39c5ec ("Staging: delete spectra driver") 5 years ago.

So, I guess nobody would need this function any more.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
2016-11-19 09:31:02 +01:00
Masahiro Yamada 50d5f2a00a mtd: nand: denali: remove bogus comment about interrupt handler setup
The interrupt handler is setup in denali_init(), not in
denali_drv_init().  This comment is false.

Such a comment adds no value, so just delete it instead of move.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
2016-11-19 09:30:59 +01:00
Masahiro Yamada c4ae0977f5 mtd: nand: denali: remove unused struct member denali_nand_info::idx
The struct member "idx" was used as an index for debug_array long
ago, but the DEBUG_DENALI feature was removed by commit 7cfffac06c
("nand/denali: use dev_xx debug function to replace nand_dbg_print
and some printk").  Since then, this has been only initialized, but
never referenced.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
2016-11-19 09:30:57 +01:00
Masahiro Yamada ef5327dc25 mtd: nand: denali: remove unneeded <linux/slab.h> includes
The driver calls devm_kzalloc()/devm_kfree() to allocate/free memory.
They are declared in <linux/device.h>, not in <linux/slab.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
2016-11-19 09:30:55 +01:00
Rafał Miłecki 64ad46379f mtd: bcm47xxsflash: use uncached MMIO access for BCM53573
BCM53573 is a new series of Broadcom's SoCs. It's based on ARM and uses
this old ChipCommon-based flash access. Early tests resulted in flash
corruptions that were tracked down to using cached MMIO for flash read
access. Switch to ioremap_nocache conditionally to support BCM53573 and
don't break performance on old MIPS devices.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2016-11-07 18:17:37 -08:00
Masahiro Yamada 83f48f80de mtd: nand: socrates: use nand_scan() for nand_scan_ident/tail() combo
For this driver, there is nothing between nand_scan_ident() and
nand_scan_tail().  They can be merged into nand_scan().

Also, nand_scan() returns an appropriate error value when it fails.
Use it instead of the fixed error code -ENXIO.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
2016-11-07 14:48:53 +01:00
Masahiro Yamada c75183020f mtd: nand: nandsim: remove unneeded checks for nand_scan_ident/tail()
The nand_scan_ident/tail() never returns a positive value when it
fails.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
2016-11-07 14:48:52 +01:00
Masahiro Yamada 133fe8fa61 mtd: nand: pxa3xx: return error code of nand_scan_ident() on error
The nand_scan_ident() returns an appropriate error value when it
fails.  Use it instead of the fixed error code -ENODEV.
(This driver is already doing so for nand_scan_tail().)

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
2016-11-07 14:48:52 +01:00
Masahiro Yamada c8cae35572 mtd: nand: hisi504: return error code of nand_scan_ident() on error
The nand_scan_ident() returns an appropriate error value when it
fails.  Use it instead of the fixed error code -ENODEV.
(This driver is already doing so for nand_scan_tail().)

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
2016-11-07 14:48:51 +01:00
Masahiro Yamada 72480e4e95 mtd: nand: cafe: return error code of nand_scan_ident() on error
The nand_scan_ident() returns an appropriate error value when it
fails.  Use it instead of the fixed error code -ENXIO.
(This driver is already doing so for nand_scan_tail().)

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
2016-11-07 14:48:51 +01:00