Commit Graph

2154 Commits

Author SHA1 Message Date
Richard Weinberger 641c7925b6 mtd: nandsim: Fix kasprintf() usage
kasprintf() used in get_partition_name() does a dynamic
memory allocation and can fail. We have to handle that case.

Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-06-16 18:58:47 -07:00
Richard Weinberger bc349da0a6 mtd: cs553x_nand: Fix kasprintf() usage
kasprintf() does a dynamic memory allocation and can fail.
We have to handle that case.

Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-06-16 18:58:47 -07:00
Richard Weinberger 905cce7f43 mtd: r852: Fix device_create_file() usage
device_create_file() can fail, therefore we have to
handle this case and abort.

Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-06-16 18:58:46 -07:00
Brian Norris 5e65d48b60 mtd: brcmnand: drop unnecessary initialization
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-06-16 18:50:51 -07:00
Brian Norris 6a7c7334fe mtd: diskonchip: remove two-phase partitioning / registration
It is a Bad Idea (TM) to call mtd_device_register() or
mtd_device_parse_register() twice on the same master MTD. Among other
things, it makes partition overrides (e.g., cmdlinepart) much more
difficult.

Since commit 727dc612c4 ("mtd: part: Create the master device node
when partitioned"), we now have a config option that accomplishes the
same purpose as the double-registration done in diskonchip.c -- it
forces the master MTD to *always* be registered, while partitions may
optionally show up in addition. Eventually, we might like to make
CONFIG_MTD_PARTITIONED_MASTER into the default, but this could be
disruptive to user-space expectations of MTD numbering, so we'll take
that slowly.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Cc: Richard Weinberger <richard@nod.at>
Cc: Alexander Shiyan <shc_work@mail.ru>
2015-06-16 18:46:09 -07:00
Brian Norris 8bf57b0dd4 mtd: plat_nand: use default partition probe
It's harmless to add 'ofpart' (the only different parser supported in
default mtdpart.c) to plat_nand. That let's us kill off one more custom
partition prober listing.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-05-27 12:34:35 -07:00
Brian Norris db5b09f6ed mtd: nand: correct indentation within conditional
We had an extra tab.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-05-22 10:57:47 -07:00
Brian Norris b74bdbe588 mtd: remove incorrect file name
This is an example of why it doesn't make much sense to put this
information here in the first place. I don't really know what purpose it
serves.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-05-22 10:57:46 -07:00
Baruch Siach 8eeb4c521a mtd: mxc_nand: generate nand_ecclayout for 8 bit ECC
Hardware 8 bit ECC requires a different nand_ecclayout. Instead of adding yet
another static struct nand_ecclayout, generate it in code.

Reviewed-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-05-20 21:32:18 -07:00
Geert Uytterhoeven f650ce24b3 mtd: Allow compile test of GPIO consumers if !GPIOLIB
The GPIO subsystem provides dummy GPIO consumer functions if GPIOLIB is
not enabled. Hence drivers that depend on GPIOLIB, but use GPIO consumer
functionality only, can still be compiled if GPIOLIB is not enabled.

Relax the dependency on GPIOLIB if COMPILE_TEST is enabled, where
appropriate.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: linux-mtd@lists.infradead.org
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-05-20 15:50:24 -07:00
Baruch Siach 0d17fc3e99 mtd: mxc_nand: fix truncate of unaligned oob copying
Copy to/from oob io area might not be aligned to 4 bytes. When 8 bit ECC is
used, the buffer size is 26. Add memcpy16_{to,from}io, and use them to avoid
truncating the buffer. Prefer memcpy32_{to,from}io when the buffer is properly
aligned for better performance.

Reviewed-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-05-20 15:29:53 -07:00
Baruch Siach 7e7e4730c1 mtd: mxc_nand: limit the size of used oob
For 4k pages the i.MX NFC hardware uses no more than 218 bytes for 8bit ECC
data. Larger oobsize confuses the logic of copy_spare(). Limit the size of used
oob size to avoid that.

Reviewed-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-05-20 15:29:53 -07:00
Uwe Kleine-König 35d5d20efa mtd: mxc_nand: cleanup copy_spare function
To give people without the reference manual at hand a chance to
understand how spare area is handled in the i.MX nand controller,
improve commenting, naming of variables and coding style.

No functional change intended.

Reviewed-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
[baruch: declare oob_chunk_size; update comments; reword commit log]
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-05-20 15:29:42 -07:00
Hauke Mehrtens bcb83a19d3 mtd: brcmnand: do not make local variable static
Remove static in front of ctrl. This variable should not be shared
between different instances of brcmnand_probe(), it should be local to
this function and stored on the stack.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-05-18 11:02:49 -07:00
Hauke Mehrtens 802041247a mtd: brcmnand: remove double new line from print
The caller already adds a new line and in the other cases there is no
new line added.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-05-18 11:01:58 -07:00
Brian Norris f628ece663 mtd: brcmnand: add BCM63138 support
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Tested-by: Florian Fainelli <f.fainelli@gmail.com>
2015-05-15 13:20:00 -07:00
Brian Norris ca22f040dd mtd: brcmnand: add support for Broadcom's IPROC family
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-05-15 13:20:00 -07:00
Brian Norris c26211d37f mtd: brcmnand: add extra SoC support to library
There are a few small hooks required for chips like BCM63138 and the
iProc family. Let's introduce those now.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Tested-by: Florian Fainelli <f.fainelli@gmail.com>
2015-05-15 13:19:59 -07:00
Brian Norris 303b4420ff mtd: brcmnand: add support for STB chips
BCM7xxx chips are supported entirely by the library code, since they use
generic irqchip interfaces and don't need any extra SoC-specific
configuration.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-05-15 13:16:44 -07:00
Brian Norris 27c5b17cd1 mtd: nand: add NAND driver "library" for Broadcom STB NAND controller
This core originated in Set-Top Box chips (BCM7xxx) but is used in a
variety of other Broadcom chips, including some BCM63xxx, BCM33xx, and
iProc/Cygnus. It's been used only on ARM and MIPS SoCs, so restrict it
to those architectures.

There are multiple revisions of this core throughout the years, and
almost every version broke register compatibility in some small way, but
with some effort, this driver is able to support v4.0, v5.0, v6.x, v7.0,
and v7.1. It's been tested on v5.0, v6.0, v6.1, v7.0, and v7.1 recently,
so there hopefully are no more lurking inconsistencies.

This patch adds just some library support, on which platform drivers can
be built.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Tested-by: Florian Fainelli <f.fainelli@gmail.com>
2015-05-15 13:15:58 -07:00
Brian Norris 5844feeaa4 mtd: nand: add common DT init code
These are already-documented common bindings for NAND chips. Let's
handle them in nand_base.

If NAND controller drivers need to act on this data before bringing up
the NAND chip (e.g., fill out ECC callback functions, change HW modes,
etc.), then they can do so between calling nand_scan_ident() and
nand_scan_tail().

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-05-11 16:22:29 -07:00
Krzysztof Kozlowski 0abe75d225 mtd: s3c2410: Constify platform_device_id
The platform_device_id is not modified by the driver and core uses it as
const.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-05-07 00:13:24 -07:00
Krzysztof Kozlowski 8d1e568d2d mtd: mxc-nand: Constify platform_device_id
The platform_device_id is not modified by the driver and core uses it as
const.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-05-07 00:13:23 -07:00
Rob Herring ce914e6b26 mtd: nand: pxa3xx: fix build on ARM64
In preparation to enable ARCH_MMP on ARM64, a couple of fixes are needed
to build the pxa3xx_nand driver:

Legacy DMA will only used on ARM, so also make it condtional on
CONFIG_ARM.
__raw_{read,write}sl are not available on ARM64 or generically, so use
the readsl/writesl variants instead. Somewhat inconsistently,
{read,write}sl are inherently non-swapping with the generic version
using __raw_{read,write}l.

Signed-off-by: Rob Herring <robh@kernel.org>
Acked-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: linux-mtd@lists.infradead.org
[Brian: added one more __raw_readsl -> readsl]
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-05-07 00:11:39 -07:00
Maxime Ripard afca11ec13 mtd: nand: pxa3xx: Switch FIFO draining to jiffies-based timeout
Now that the driver handles the FIFO draining in a threaded interrupt, we can
base our timeout on jiffies and sleeping, instead of using mdelay.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-05-07 00:04:27 -07:00
Nicholas Mc Guire 818a45b1d7 mtd: fsmc_nand: match wait_for_completion_timeout return type
return type of wait_for_completion_timeout is unsigned long not int. An
appropriately named unsigned long is added and the assignment fixed up.
This not only should help readability but also handles corner cases
properly.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-05-06 23:48:04 -07:00
Nicholas Mc Guire 0bda3e1944 mtd: fsmc_nand: fix handling of wait_for_completion_timeout return value
wait_for_completion_timeout does not return negative values so
result handling here does not need to check for negative return.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-05-06 23:47:31 -07:00
Richard Weinberger 0aec7ac997 mtd: nand: Remove in vain memset() in nand_onfi_get_features()
As all four bytes are written in any case the memset() is in vain.

Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-05-06 23:44:31 -07:00
Fabian Frederick 6661044365 mtd: constify of_device_id array
of_device_id is always used as const.
(See driver.of_match_table and open firmware functions)

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-05-06 23:44:07 -07:00
Brian Norris f5cd2ae1e4 mtd: nand_bbt: fix theoretical integer overflow in BBT write
This statement was written with a cast-to-loff_t to be sure to have a
full 64-bit mask. However, we don't account for the fact that
'1 << this->bbt_erase_shift' might already overflow.

This will not be a problem in practice, since eraseblocks should never
be anywhere near 4GiB. But we can do this for completeness, and quiet
Coverity in the meantime. CID #1226806.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-05-06 20:02:37 -07:00
Brian Norris 83c59542d0 mtd: nand_bbt: unify/fix error handling in nand_scan_bbt()
Don't leak this->bbt, and return early if check_create() fails. It helps
to have a single error path to avoid these problems.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-05-06 20:02:36 -07:00
Brian Norris 17799359e7 mtd: nand_bbt: make nand_scan_bbt() static
This implementation detail is no longer needed outside of nand_bbt.c.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-05-06 20:02:35 -07:00
Brian Norris d24fe0c3e8 mtd: diskonchip: don't call nand_scan_bbt() directly
The diskonchip driver almost uses the default nand_base hooks as-is,
except that it provides custom on-flash BBT descriptors and avoids using
factory-marked bad blockers.

So let's refactor the BBT initialization code into a private 'late_init'
hook which handles all the private details. Note the usage of
NAND_SKIP_BBTSCAN, which allows us to defer the BBT scan until we've
prepared everything.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-05-06 20:02:34 -07:00
Brian Norris a2281e821f mtd: nand_bbt: drop unnecessary header
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-05-06 20:02:33 -07:00
Linus Torvalds d6a4c0e5d3 Merge branch 'for-linus' of git://git.infradead.org/users/vkoul/slave-dma
Pull slave-dmaengine updates from Vinod Koul:

 - new drivers for:
        - Ingenic JZ4780 controller
        - APM X-Gene controller
        - Freescale RaidEngine device
        - Renesas USB Controller

  - remove device_alloc_chan_resources dummy handlers

  - sh driver cleanups for peri peri and related emmc and asoc patches
    as well

  - fixes and enhancements spread over the drivers

* 'for-linus' of git://git.infradead.org/users/vkoul/slave-dma: (59 commits)
  dmaengine: dw: don't prompt for DW_DMAC_CORE
  dmaengine: shdmac: avoid unused variable warnings
  dmaengine: fix platform_no_drv_owner.cocci warnings
  dmaengine: pch_dma: fix memory leak on failure path in pch_dma_probe()
  dmaengine: at_xdmac: unlock spin lock before return
  dmaengine: xgene: devm_ioremap() returns NULL on error
  dmaengine: xgene: buffer overflow in xgene_dma_init_channels()
  dmaengine: usb-dmac: Fix dereferencing freed memory 'desc'
  dmaengine: sa11x0: report slave capabilities to upper layers
  dmaengine: vdma: Fix compilation warnings
  dmaengine: fsl_raid: statify fsl_re_chan_probe
  dmaengine: Driver support for FSL RaidEngine device.
  dmaengine: xgene_dma_init_ring_mngr() can be static
  Documentation: dma: Add documentation for the APM X-Gene SoC DMA device DTS binding
  arm64: dts: Add APM X-Gene SoC DMA device and DMA clock DTS nodes
  dmaengine: Add support for APM X-Gene SoC DMA engine driver
  dmaengine: usb-dmac: Add Renesas USB DMA Controller (USB-DMAC) driver
  dmaengine: renesas,usb-dmac: Add device tree bindings documentation
  dmaengine: edma: fixed wrongly initialized data parameter to the edma callback
  dmaengine: ste_dma40: fix implicit conversion
  ...
2015-04-24 09:49:37 -07:00
Linus Torvalds a62d016cec Common MTD:
* Add Kconfig option for keeping both the 'master' and 'partition' MTDs
    registered as devices. This would really make a better default if we could
    do it over, as it allows a lot more flexibility in (1) determining the flash
    topology of the system from user-space and (2) adding temporary partitions
    at runtime (ioctl(BLKPG)). Unfortunately, this would possibly cause
    user-space breakage, as it will cause renumbering of the /dev/mtdX devices.
    We'll see if we can change this in the future, as there have already been a
    few people looking for this feature, and I know others have just been
    working around our current limitations instead of fixing them this way.
  * Along with the previous change, add some additional information to sysfs, so
    user-space can read the offset of each partition within its master device
 
 SPI NOR:
  * add new device tree compatible binding to represent the mostly-compatible
    class of SPI NOR flash which can be detected by their extended JEDEC ID
    bytes, cutting down the duplication of our ID tables
  * misc. new IDs
 
 Various other miscellaneous fixes and changes
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJVN9ypAAoJEFySrpd9RFgtaUQQAKmlCVMrxAKtF6U5jpzf07hA
 7ZrcMdUTSwS++dBIAgDl6JSuSGT5KRLrS1FOp60p+VAjbD9VFcRLUUQxahXW1tAh
 Dr8a3Akwd+lgIp77bZhWBY35dXmjIJ1GSzo7jdbJMDwAeDd3gBeSFTDoePsrCt6K
 0/NPOsQzCFDDr1lwuQh1LzkLLQfVAC3ImNCBm5smvyEfhxXqzC02HOLf8Z9VMGnY
 OxM9i0T6Ik3xeaaP/vH91sApmdn598gP5DB5cNr61YrZeVZmEoI4EWlOmagcYVC2
 Tef9Ng4YmHGXo65k7XcKRykAVWECYAGr4HKCDZ8tsbvpfdbQMS5wHEgxMsAdvb01
 aChcBNxf4w/Mh49fzjZppTlPN25FERRMnXt7CkUqQkqet9uDkD/5RNPl65ermeC7
 EKx2MoxnpXrfZ0EkSxqrfdzP0oQx0AqAkbCyLIN42Vbxl7ckFMN3WAPQ2NR2Aaoh
 SUiKwwaFFiK+C9qEytj0s+cmKPzsTzeQVYgp9NX64EfVQumqpsfbu6XIPV+FGy2i
 DvHvmTEvm4SpqMPSnhkmZ6DFSjuzvQdqzKtDyZmRppxHKgWUsXYdftGPMG0+ZbaG
 t4zysWfJG897TMVYLKY9pGqvouMuAVJ4kX1+iZbJc8dr4bwIzXIYuEGPLVv58gUO
 KjjlYk91/jFNmBW5anxC
 =aIsV
 -----END PGP SIGNATURE-----

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

Pull MTD updates from Brian Norris:
 "Common MTD:

   - Add Kconfig option for keeping both the 'master' and 'partition'
     MTDs registered as devices.  This would really make a better
     default if we could do it over, as it allows a lot more flexibility
     in (1) determining the flash topology of the system from user-space
     and (2) adding temporary partitions at runtime (ioctl(BLKPG)).

     Unfortunately, this would possibly cause user-space breakage, as it
     will cause renumbering of the /dev/mtdX devices.  We'll see if we
     can change this in the future, as there have already been a few
     people looking for this feature, and I know others have just been
     working around our current limitations instead of fixing them this
     way.

   - Along with the previous change, add some additional information to
     sysfs, so user-space can read the offset of each partition within
     its master device

  SPI NOR:

   - add new device tree compatible binding to represent the
     mostly-compatible class of SPI NOR flash which can be detected by
     their extended JEDEC ID bytes, cutting down the duplication of our
     ID tables

   - misc.  new IDs

  Various other miscellaneous fixes and changes"

* tag 'for-linus-20150422' of git://git.infradead.org/linux-mtd: (53 commits)
  mtd: spi-nor: Add support for Macronix mx25u6435f serial flash
  mtd: spi-nor: Add support for Winbond w25q64dw serial flash
  mtd: spi-nor: add support for the Winbond W25X05 flash
  mtd: spi-nor: support en25s64 device
  mtd: m25p80: bind to "nor-jedec" ID, for auto-detection
  Documentation: devicetree: m25p80: add "nor-jedec" binding
  mtd: Make MTD tests cancelable
  mtd: mtd_oobtest: Fix bitflip_limit usage in test case 3
  mtd: docg3: remove invalid __exit annotations
  mtd: fsl_ifc_nand: use msecs_to_jiffies for time conversion
  mtd: atmel_nand: don't map the ROM table if no pmecc table offset in DT
  mtd: atmel_nand: add a definition for the oob reserved bytes
  mtd: part: Remove partition overlap checks
  mtd: part: Add sysfs variable for offset of partition
  mtd: part: Create the master device node when partitioned
  mtd: ts5500_flash: Fix typo in MODULE_DESCRIPTION in ts5500_flash.c
  mtd: denali: Disable sub-page writes in Denali NAND driver
  mtd: pxa3xx_nand: cleanup wait_for_completion handling
  mtd: nand: gpmi: Check for scan_bbt() error
  mtd: nand: gpmi: fixup return type of wait_for_completion_timeout
  ...
2015-04-22 12:00:44 -07:00
Brian Norris 3e550d2396 Merge MTD fixes from 4.0 into -next 2015-04-22 10:29:19 -07:00
Linus Torvalds d0bbe0dd35 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial
Pull trivial tree from Jiri Kosina:
 "Usual trivial tree updates.  Nothing outstanding -- mostly printk()
  and comment fixes and unused identifier removals"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial:
  goldfish: goldfish_tty_probe() is not using 'i' any more
  powerpc: Fix comment in smu.h
  qla2xxx: Fix printks in ql_log message
  lib: correct link to the original source for div64_u64
  si2168, tda10071, m88ds3103: Fix firmware wording
  usb: storage: Fix printk in isd200_log_config()
  qla2xxx: Fix printk in qla25xx_setup_mode
  init/main: fix reset_device comment
  ipwireless: missing assignment
  goldfish: remove unreachable line of code
  coredump: Fix do_coredump() comment
  stacktrace.h: remove duplicate declaration task_struct
  smpboot.h: Remove unused function prototype
  treewide: Fix typo in printk messages
  treewide: Fix typo in printk messages
  mod_devicetable: fix comment for match_flags
2015-04-14 09:50:27 -07:00
Thomas Gleixner 462b69b1e4 Merge branch 'linus' into irq/core to get the GIC updates which
conflict with pending GIC changes.

Conflicts:
	drivers/usb/isp1760/isp1760-core.c
2015-04-08 23:26:21 +02:00
Nicholas Mc Guire 95d7066573 mtd: fsl_ifc_nand: use msecs_to_jiffies for time conversion
This is only an API consolidation and should make things more readable
it replaces var * HZ / 1000 by msecs_to_jiffies(var) which helps readability
and also handles all corner-cases properly.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-04-05 17:47:56 -07:00
Wu, Josh 41c7540d0c mtd: atmel_nand: don't map the ROM table if no pmecc table offset in DT
if atmel,pmecc-lookup-table-offset is not found in DT node, we don't
need to map the ROM table as we will build a runtime gf table anyway.

Reported-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Josh Wu <josh.wu@atmel.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-04-05 17:47:56 -07:00
Josh Wu 477478aedc mtd: atmel_nand: add a definition for the oob reserved bytes
It's better to use a macro instead of just a number.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-04-05 17:47:56 -07:00
Graham Moore d99d72829e mtd: denali: Disable sub-page writes in Denali NAND driver
The Denali Controller IP does not support sub-page writes.

Signed-off-by: Graham Moore <grmoore@opensource.altera.com>
Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-03-30 18:32:44 -07:00
Nicholas Mc Guire e5860c18e6 mtd: pxa3xx_nand: cleanup wait_for_completion handling
return type of wait_for_completion_timeout is unsigned long not int, this
patch uses the return value of wait_for_completion_timeout in the condition
directly rather than assigning it to an incorrect type variable.

The variable used for handling the return of wait_for_cmpletion_timeout
was int but should be unsigned long, where it was not in use for
anything else and the return value in case of completion (>0) is not
used it was removed and wait_for_completion_timeout() used directly in
the if condition.

To make the timeout values a bit simpler to read and also handle all of
the corner cases correctly the declarations are moved to
msecs_to_jiffies().

The timeout declaration cleanup is just for readability

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-03-30 18:30:30 -07:00
Fabio Estevam 899b834a46 mtd: nand: gpmi: Check for scan_bbt() error
In case of scan_bbt() failure, we should better propagate it.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Huang Shijie <shijie.huang@intel.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-03-30 18:27:47 -07:00
Nicholas Mc Guire 706d5b2899 mtd: nand: gpmi: fixup return type of wait_for_completion_timeout
return type of wait_for_completion_timeout is unsigned long not int. The
return variable is renamed to reflect its use and the type adjusted to
unsigned long.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: Huang Shijie <shijie.huang@intel.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-03-30 18:12:55 -07:00
Stefan Roese 62b57f4c14 mtd: fsmc_nand.c: Use default timings if none are provided in the dts
Without this patch the timings are all set to 0 if not specified in the dts.
With this patch the driver falls back to use the defaults that are already
present in the driver and are known to work okay for some (older) boards.

Tested on a custom SPEAr600 based board.

Signed-off-by: Stefan Roese <sr@denx.de>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Cc: Viresh Kumar <viresh.linux@gmail.com>
Cc: Mian Yousaf Kaukab <mian.yousaf.kaukab@stericsson.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-03-30 17:49:07 -07:00
Roger Quadros 60c70d66cd mtd: nand: Prevent possible kernel lockup in nand_command()
If a NAND device is not really present or pin muxes are not correctly
configured we can lock up the kernel waiting infinitely for NAND_STATUS
to be ready.

This can be easily reproduced on TI's DRA7-evm board by booting it
without NAND support in u-boot and disabling NAND pin muxes in the kernel.

Add timeout when waiting for NAND_CMD_RESET completion. As per ONFi v4.0
tRST can be upto 250ms for EZ-NAND and 5ms for raw NAND.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Tested-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-03-30 17:39:15 -07:00
Brian Norris 73c8aaf436 mtd: nand: fix spelling of REPLACEABLE
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-03-24 14:21:27 -07:00
Brian Norris 0ec56dc4a1 mtd: nand: fully initialize mtd_oob_ops
We're not initializing the ooblen field. Our users don't care, since
they check that oobbuf == NULL first, but it's good practice to zero
unused fields out.

We can drop the NULL initializations since we're memset()ing the whole
thing.

Noticed by Coverity, CID #200821, #200822

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-03-11 15:21:48 -07:00