11 Sep, 2011
40 commits
-
These modes hold their state only for the life of their file descriptor,
and they overlap functionality with the MTD_OPS_* modes. Particularly,
MTD_MODE_RAW and MTD_OPS_RAW cover the same function: to provide raw
(i.e., without ECC) access to the flash. In fact, although it may not be
clear, MTD_MODE_RAW implied that operations should enable the
MTD_OPS_RAW mode.Thus, we should be specific on what each mode means. This is a start,
where MTD_FILE_MODE_* actually represents a "file mode," not necessarily
a true global MTD mode.Signed-off-by: Brian Norris
Signed-off-by: Artem Bityutskiy -
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
Signed-off-by: Artem Bityutskiy -
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
Signed-off-by: Artem Bityutskiy -
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
Cc: Jim Quinlan
Signed-off-by: Artem Bityutskiy -
Signed-off-by: Brian Norris
Signed-off-by: Artem Bityutskiy -
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 ECCThis was tested with nandsim as well as on actual SLC NAND.
Signed-off-by: Brian Norris
Cc: Jim Quinlan
Signed-off-by: Artem Bityutskiy -
These files contain the common code for the GPMI-NAND driver.
Signed-off-by: Huang Shijie
Acked-by: Marek Vasut
Tested-by: Koen Beel
Signed-off-by: Artem Bityutskiy -
add the GPMI-NAND driver in the relevant Kconfig and Makefile in the MTD.
Signed-off-by: Huang Shijie
Acked-by: Marek Vasut
Tested-by: Koen Beel
Signed-off-by: Artem Bityutskiy -
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
Acked-by: Marek Vasut
Tested-by: Koen Beel
Signed-off-by: Artem Bityutskiy -
The code has the check for parts but it called after kmemdup,
kmemdup(parts, sizeof(*parts) * nr_parts,...)
if (!parts)
return -ENOMEMIn 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
Signed-off-by: Artem Bityutskiy -
Signed-off-by: Brian Norris
Signed-off-by: Artem Bityutskiy -
Signed-off-by: Brian Norris
Signed-off-by: Artem Bityutskiy -
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
Signed-off-by: Artem Bityutskiy -
It's been gone for a while.
Signed-off-by: Brian Norris
Signed-off-by: Artem Bityutskiy -
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
Signed-off-by: Artem Bityutskiy -
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
Signed-off-by: Artem Bityutskiy -
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
Acked-by: Jiandong Zheng
Signed-off-by: Artem Bityutskiy -
Signed-off-by: Michael Hench
Acked-by: Scott Wood
Signed-off-by: Artem Bityutskiy -
clk_get() return a pointer to the struct clk or an ERR_PTR().
Signed-off-by: Jonghwan Choi
Signed-off-by: Artem Bityutskiy -
Signed-off-by: Brian Norris
Signed-off-by: Artem Bityutskiy -
use MTD_NAND_OMAP2 also for OMAP4 arch.
testes with omap4430Signed-off-by: Jan Weitzel
Signed-off-by: Artem Bityutskiy -
Signed-off-by: Brian Norris
Signed-off-by: Artem Bityutskiy -
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
Signed-off-by: Artem Bityutskiy -
Signed-off-by: Brian Norris
Signed-off-by: Artem Bityutskiy -
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
Signed-off-by: Artem Bityutskiy -
Signed-off-by: Brian Norris
Signed-off-by: Artem Bityutskiy -
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
Signed-off-by: Artem Bityutskiy -
This is a cleanup of some punctuation, indentation, and capitalization
on the lines affected affected by the last patch.Signed-off-by: Brian Norris
Signed-off-by: Artem Bityutskiy -
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.htmlSigned-off-by: Brian Norris
Signed-off-by: Artem Bityutskiy -
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
Signed-off-by: Artem Bityutskiy -
It adds device tree probe support for mtd_dataflash driver.
Signed-off-by: Shawn Guo
Signed-off-by: Artem Bityutskiy -
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
-
For support two chip select, we seperate chip specific info in this
patch.Signed-off-by: Lei Wen
-
Also add missed warning message.
Signed-off-by: Lei Wen
Signed-off-by: Artem Bityutskiy -
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
-
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
Signed-off-by: Artem Bityutskiy -
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
Signed-off-by: Artem Bityutskiy -
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
Signed-off-by: Artem Bityutskiy -
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
Signed-off-by: Artem Bityutskiy -
Signed-off-by: Axel Lin
Signed-off-by: Artem Bityutskiy