summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2011-09-11mtd: rename MTD_OOB_* to MTD_OPS_*Brian Norris
These modes are not necessarily for OOB only. Particularly, MTD_OOB_RAW affected operations on in-band page data as well. To clarify these options and to emphasize that their effect is applied per-operation, we change the primary prefix to MTD_OPS_. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
2011-09-11mtd: move mtd_oob_mode_t to shared kernel/user spaceBrian Norris
We will want to use the MTD_OOB_{PLACE,AUTO,RAW} modes in user-space applications through the introduction of new ioctls, so we should make this enum a shared type. This enum is now anonymous. Artem: tweaked the patch. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
2011-09-11mtd: support reading OOB without ECCBrian Norris
This fixes issues with `nanddump -n' and the MEMREADOOB[64] ioctls on hardware that performs error correction when reading only OOB data. A driver for such hardware needs to know when we're doing a RAW vs. a normal write, but mtd_do_read_oob does not pass such information to the lower layers (e.g., NAND). We should pass MTD_OOB_RAW or MTD_OOB_PLACE based on the MTD file mode. For now, most drivers can get away with just setting: chip->ecc.read_oob_raw = chip->ecc.read_oob This is done by default; but for systems that behave as described above, you must supply your own replacement function. This was tested with nandsim as well as on actual SLC NAND. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Cc: Jim Quinlan <jim2101024@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
2011-09-11mtd: nand: document nand_chip.oob_poiBrian Norris
Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
2011-09-11mtd: support writing OOB without ECCBrian Norris
This fixes issues with `nandwrite -n -o' and the MEMWRITEOOB[64] ioctls on hardware that writes ECC when writing OOB. The problem arises as follows: `nandwrite -n' can write page data to flash without applying ECC, but when used with the `-o' option, ECC is applied (incorrectly), contrary to the `--noecc' option. I found that this is the case because my hardware computes and writes ECC data to flash upon either OOB write or page write. Thus, to support a proper "no ECC" write, my driver must know when we're performing a raw OOB write vs. a normal ECC OOB write. However, MTD does not pass any raw mode information to the write_oob functions. This patch addresses the problems by: 1) Passing MTD_OOB_RAW down to lower layers, instead of just defaulting to MTD_OOB_PLACE 2) Handling MTD_OOB_RAW within the NAND layer's `nand_do_write_oob' 3) Adding a new (replaceable) function pointer in struct ecc_ctrl; this function should support writing OOB without ECC data. Current hardware often can use the same OOB write function when writing either with or without ECC This was tested with nandsim as well as on actual SLC NAND. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Cc: Jim Quinlan <jim2101024@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
2011-09-11mtd: add the common code for GPMI-NAND controller driverHuang Shijie
These files contain the common code for the GPMI-NAND driver. Signed-off-by: Huang Shijie <b32955@freescale.com> Acked-by: Marek Vasut <marek.vasut@gmail.com> Tested-by: Koen Beel <koen.beel@barco.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
2011-09-11mtd: add GPMI-NAND driver in the config and MakefileHuang Shijie
add the GPMI-NAND driver in the relevant Kconfig and Makefile in the MTD. Signed-off-by: Huang Shijie <b32955@freescale.com> Acked-by: Marek Vasut <marek.vasut@gmail.com> Tested-by: Koen Beel <koen.beel@barco.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
2011-09-11mtd: add helper functions library and header files for GPMI NAND driverHuang Shijie
bch-regs.h : registers file for BCH module gpmi-regs.h: registers file for GPMI module gpmi-lib.c: helper functions library. Signed-off-by: Huang Shijie <b32955@freescale.com> Acked-by: Marek Vasut <marek.vasut@gmail.com> Tested-by: Koen Beel <koen.beel@barco.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
2011-09-11mtd: check parts pointer before using itJason Liu
The code has the check for parts but it called after kmemdup, kmemdup(parts, sizeof(*parts) * nr_parts,...) if (!parts) return -ENOMEM In fact, we need check parts before safely using it. and we also need check the real_parts to make sure kmemdup allocation sucessfully. Signed-off-by: Jason Liu <jason.hui@linaro.org> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
2011-09-11mtd: style fixups in multi-line comment, indentationBrian Norris
Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
2011-09-11mtd: nand: fix spelling error (date => data)Brian Norris
Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
2011-09-11mtd: remove MEMSETOOBSEL macro definitionBrian Norris
MEMSETOOBSEL is completely unused and useless. Remove the definition. Note: it's probably best not to use this ioctl number in the future for MTD, since that may cause conflicts between old kernels and new user software (or new kernels and old user software). Artem: leave a comment about MEMSETOOBSEL. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
2011-09-11mtd: doc: remove mention of MEMSETOOBSELBrian Norris
It's been gone for a while. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
2011-09-11mtd: do not assume oobsize is power of 2Brian Norris
Previous generations of MTDs all used OOB sizes that were powers of 2, (e.g., 64, 128). However, newer generations of flash, especially NAND, use irregular OOB sizes that are not powers of 2 (e.g., 218, 224, 448). This means we cannot use masks like "mtd->oobsize - 1" to assume that we will get a proper bitmask for OOB operations. These masks are really only intended to hide the "page" portion of the offset, leaving any OOB offset intact, so a masking with the writesize (which *is* always a power of 2) is valid and makes more sense. This has been tested for read/write of NAND devices (nanddump/nandwrite) using nandsim and actual NAND flash. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
2011-09-11mtd: mxc_nand: add mx53 NFC driver supportJason Liu
This has already been tested with Samsung NAND: K9LAG08U0M on MX53EVK board, ubi/ubifs has already been tested OK too. Signed-off-by: Jason Liu <jason.hui@linaro.org> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
2011-09-11mtd: bcm_umi_nand: clean up error handling codeJulia Lawall
Convert error handling code to use gotos. At the same time, this adds calls to kfree and iounmap in a few cases where they were overlooked. Signed-off-by: Julia Lawall <julia@diku.dk> Acked-by: Jiandong Zheng <jdzheng@broadcom.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
2011-09-11mtd: eLBC NAND: update ecc_stats.corrected when lteccr availableMichael Hench
Signed-off-by: Michael Hench <MichaelHench@gmail.com> Acked-by: Scott Wood <scottwood@freescale.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
2011-09-11mtd: s3c2410 nand: Remove uncessary null checkJonghwan Choi
clk_get() return a pointer to the struct clk or an ERR_PTR(). Signed-off-by: Jonghwan Choi <jhbird.choi@samsung.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
2011-09-11mtd: spelling fixesBrian Norris
Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
2011-09-11mtd: use MTD_NAND_OMAP2 for OMAP4Jan Weitzel
use MTD_NAND_OMAP2 also for OMAP4 arch. testes with omap4430 Signed-off-by: Jan Weitzel <j.weitzel@phytec.de> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
2011-09-11mtd: Kbuild: remove reference to MTD_PARTITIONSBrian Norris
Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
2011-09-11mtd: cleanup last uses of MTD_DEBUG config macrosBrian Norris
Some messages that were tied to CONFIG_MTD_DEBUG_VERBOSE can now simply be enabled using dynamic debugging features, if necessary. There's no need for special debugging functions here. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
2011-09-11mtd: remove CONFIG_MTD_DEBUGBrian Norris
Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
2011-09-11mtd: pcmciamtd: remove custom DEBUG() functionBrian Norris
We don't need a custom DEBUG() macro here. Just use the built-in kernel code with dynamic debugging features. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
2011-09-11mtd: cleanup style on pr_debug messagesBrian Norris
Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
2011-09-11mtd: replace DEBUG() with pr_debug()Brian Norris
Start moving away from the MTD_DEBUG_LEVEL messages. The dynamic debugging feature is a generic kernel feature that provides more flexibility. (See Documentation/dynamic-debug-howto.txt) Also fix some punctuation, indentation, and capitalization that went along with the affected lines. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
2011-09-11mtd: nand: style fixups in pr_* messagesBrian Norris
This is a cleanup of some punctuation, indentation, and capitalization on the lines affected affected by the last patch. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
2011-09-11mtd: nand: convert printk() to pr_*()Brian Norris
Instead of directly calling printk, it's simpler to use the built-in pr_* functions. This shortens code and allows easy customization through the definition of a pr_fmt() macro (not used currently). Ideally, we could implement much of this with dev_* functions, but the MTD subsystem does not necessarily register all its master `mtd_info.dev` device, so we cannot use dev_* consistently. See: http://lists.infradead.org/pipermail/linux-mtd/2011-July/036950.html Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
2011-09-11mtd: nand: change KERN_DEBUG to KERN_INFOBrian Norris
Soon we will change many printk statements into pr_* statements, i.e., 'printk(KERN_INFO, ...)' becomes 'pr_info(...)'. However, this means that KERN_DEBUG messages will become pr_debug() statements and therefore will not be activated by default - they must be enabled using dynamic debug. So, for important DEBUG messages, we will simply upgrade these to INFO so that they appear by default. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
2011-09-11mtd: dataflash: add device tree probe supportShawn Guo
It adds device tree probe support for mtd_dataflash driver. Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
2011-09-11mtd: pxa3xx_nand: enable multiple chip select supportLei Wen
Current pxa3xx_nand controller has two chip select which both be workable. This patch enable this feature. Update platform driver to support this feature. Another notice should be taken that: When you want to use this feature, you should not enable the keep configuration feature, for two chip select could be attached with different nand chip. The different page size and timing requirement make the keep configuration impossible. Signed-off-by: Lei Wen <leiwen@marvell.com>
2011-09-11mtd: pxa3xx_nand: sperate each chip individual infoLei Wen
For support two chip select, we seperate chip specific info in this patch. Signed-off-by: Lei Wen <leiwen@marvell.com>
2011-09-11mtd: pxa3xx_nand: convert all printk into dev_*Lei Wen
Also add missed warning message. Signed-off-by: Lei Wen <leiwen@marvell.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
2011-09-11mtd: pxa3xx_nand: enhance suspend and resume routineLei Wen
This patch add protection on the suspend&resume path to prevent some unexpected behavior, like interrupt occur at the very second of resume back and it don't follow normal command path, which lead to bug. Signed-off-by: Lei Wen <leiwen@marvell.com>
2011-09-11mtd: eLBC NAND: remove elbc_fcm_ctrl->oob_poiMike Hench
The eLBC NAND driver currently follows up each program/write operation with a read-back of the page, in order to [ostensibly] fill in ECC data for the caller. However, the page address used for this read is always -1, so the read will never work correctly. Remove this useless (and potentially problematic) block of code. Signed-off-by: Matthew L. Creech <mlcreech@gmail.com> Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
2011-09-11mtd: atmel_nand: optimize read/write buffer functionsNicolas Ferre
For PIO NAND access functions, we use the features of the SMC: - no need to take into account the NAND bus width: SMC will deal with this - use of an IO memcpy on the NAND chip-select space is able to generate proper SMC behavior. Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
2011-09-11mtd: nand: don't free the global data too earlyLiu Shuo
The global data fsl_lbc_ctrl_dev->nand don't have to be freed in fsl_elbc_chip_remove(). The right place to do that is in fsl_elbc_nand_remove() if elbc_fcm_ctrl->counter is zero. Signed-off-by: Liu Shuo <b35362@freescale.com> Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
2011-09-11mtd: plat-nand: Fixup kerneldoc for struct platform_nand_chipTobias Klauser
The set_parts and priv members of struct platform_nand_chip where removed in commit c36a6ef3845262ade529afb9f458738b1f196f83 but the kerneldoc wasn't updated. Signed-off-by: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
2011-09-11mtd: fsl_upm: fix a memory leak in fun_chip_init error pathAxel Lin
Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
2011-09-11mtd: atmel_nand: fix wrong use of 0 as NULLNicolas Ferre
Fixing this error: atmel_nand.c:718:20: warning: Using plain integer as NULL pointer Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
2011-09-11mtd: nand_flash_detect_onfi propagate busw infoMatthieu CASTET
there is a bug in nand_flash_detect_onfi, busw need to be passed by pointer to return it. Signed-off-by: Matthieu CASTET <matthieu.castet@parrot.com> Acked-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
2011-09-11mtd: edit NAND-related commentBrian Norris
This comment was unclear regarding which NAND functions do and do not support ECC on the spare area. This update should reflect the current status of the NAND system but can be updated if changes are made in the standard functions. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
2011-09-11mtd: tests: ignore corrected bitflips in OOB on mtd_readtestBrian Norris
read_oob may now return ECC error codes. If the code is -EUCLEAN, then we can safely ignore the error as a corrected bitflip. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
2011-09-11mtd: nand: ignore ECC errors for simple BBM scansBrian Norris
Now that nand_do_readoob() may return -EUCLEAN or -EBADMSG on ECC errors, we need to handle the return value specially in some cases. When scanning for simple bad block markers, reacting to an ECC error is not very useful, as we assume that the relevant markers are still non-0xFF for true bad blocks. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
2011-09-11jffs2: use mutex_is_locked() in __jffs2_flush_wbuf()Alexey Khoroshilov
Use a helper to test if a mutex is held instead of a hack with mutex_trylock(). Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru> Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
2011-09-11mtd: ofpart: add ofoldpart aliasDmitry Eremin-Solenikov
ofpart.ko also provides ofoldpart MTD parser. Add respective MODULE_ALIAS("ofoldpart"); declaration. Artem: improve the comment Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
2011-09-11mtd: nand: handle ECC errors in OOBBrian Norris
While the standard NAND OOB functions do not do ECC on the spare area, it is possible for a driver to supply its own OOB ECC functions (e.g., HW ECC). nand_do_read_oob should act like nand_do_read_ops in checking the ECC stats and returning -EBADMSG or -EUCLEAN on uncorrectable errors or correctable bitflips, respectively. These error codes could be used in flash-based BBT code or in YAFFS, for example. Doing this, however, messes with the behavior of mtd_do_readoob. Now, mtd_do_readoob should check whether we had -EUCLEAN or -EBADMSG errors and discard those as "non-fatal" so that the ioctls can still succeed with (possibly uncorrected) data. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-09-11mtd: make ofpart buildable as a separate moduleDmitry Eremin-Solenikov
As ofpart now uses a standard mtd partitions parser interface, make it buildable as a separate module. Also provide MODULE_DESCRIPTION and MODULE_AUTHOR for this module. Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> Acked-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
2011-09-11mtd: spelling, capitalization, uniformityBrian Norris
Therefor -> Therefore [Intern], [Internal] -> [INTERN] [REPLACABLE] -> [REPLACEABLE] syndrom, syndom -> syndrome ecc -> ECC buswith -> buswidth endianess -> endianness dont -> don't occures -> occurs independend -> independent wihin -> within erease -> erase blockes -> blocks ... Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-09-11mtd: drop mtd_device_registerDmitry Eremin-Solenikov
mtd_device_register() is a limited version of mtd_device_parse_register. Replace it with macro calling mtd_device_parse_register(). Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>