Wolfram Sang [Sat, 29 Oct 2011 22:11:53 +0000 (00:11 +0200)]
mtd: tests: don't use mtd0 as a default
mtd tests may erase the mtd device, so force the user to specify which
mtd device to test by using the module parameter. Disable the default
(using mtd0) since this may destroy a vital part of the flash if the
module is inserted accidently or carelessly.
Reported-by: Roland Kletzing <devzero@web.de> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@intel.com>
Paul Bolle [Tue, 25 Oct 2011 09:00:07 +0000 (11:00 +0200)]
mtd: clean up usage of MTD_DOCPROBE_ADDRESS
Depending on whether MTD_DOCPROBE_ADVANCED is set or not,
MTD_DOCPROBE_ADDRESS will default to either 0x0000 or 0. That should
lead to (basically) identical code in docprobe.c. The current two
defaults should be merged.
And, while we're at it, if MTD_DOCPROBE is set MTD_DOCPROBE_ADDRESS will
always be set. (MTD_DOCPROBE_ADDRESS depends on MTD_DOCPROBE and it has
a default value.) So the check whether CONFIG_MTD_DOCPROBE_ADDRESS is
defined is unnecessary and should be dropped.
Signed-off-by: Paul Bolle <pebolle@tiscali.nl> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Andres Salomon [Mon, 17 Oct 2011 01:15:23 +0000 (18:15 -0700)]
jffs2: add compr=lzo and compr=zlib options
..to allow forcing of either compression scheme. This will override
compiled-in defaults. jffs2_compress is reworked a bit, as the lzo/zlib
override shares lots of code w/ the PRIORITY mode.
v2: update show_options accordingly.
Signed-off-by: Andres Salomon <dilinger@queued.net> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Andres Salomon [Mon, 17 Oct 2011 01:15:16 +0000 (18:15 -0700)]
jffs2: implement mount option parsing and compression overriding
Currently jffs2 has compile-time constants (and .config options)
controlling whether or not the various compression/decompression
drivers are built in and enabled. This is fine for embedded
systems, but it clashes with distribution kernels. Distro kernels
tend to turn on everything; this causes OpenFirmware to fall
over, as it understands ZLIB-compressed inodes. Booting a kernel
that has LZO compression enabled, writing to the boot partition,
and then rebooting causes OFW to fail to read the kernel from
the filesystem. This is because LZO compression has priority
when writing new data to jffs2, if LZO is enabled.
This patch adds mount option parsing, and a single supported
option ("compr=none"). This adds the flexibility of being
able to specify which compressor overrides on a per-superblock
basis. For now, we can simply disable compression;
additional flexibility coming soon.
v2: kill some printks, and implement show_options as suggested
by Artem Bityutskiy.
Signed-off-by: Andres Salomon <dilinger@queued.net> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Brian Norris [Sat, 15 Oct 2011 03:09:33 +0000 (20:09 -0700)]
mtd: nand: initialize ops.mode
Our `ops' information was converted to a local variable recently, and
apparently, old code relied on the fact that the global version was
often left in a valid mode. We can't make this assumption on local
structs, and we shouldn't be relying on a previous state anyway.
Instead, we initialize mode to 0 for don't-care situations (i.e., the
operation does not use OOB anyway) and MTD_OPS_PLACE_OOB when we want to
place OOB data.
This fixes a bug with nand_default_block_markbad(), where we catch on
the BUG() call in nand_fill_oob():
Andres Salomon [Fri, 14 Oct 2011 14:33:20 +0000 (07:33 -0700)]
mtd: provide an alias for the redboot module name
parse_mtd_partitions takes a list of partition types; if the driver
isn't loaded, it attempts to load it, and then it grabs the partition
parser. For redboot, the module name is "redboot.ko", while the parser
name is "RedBoot". Since modprobe is case-sensitive, attempting to
modprobe "RedBoot" will never work. I suspect the embedded systems that
make use of redboot just always manually loaded redboot prior to loading
their specific nand chip drivers (or statically compiled it in).
Signed-off-by: Andres Salomon <dilinger@queued.net> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Cc: stable@kernel.org
Shaohui Xie [Fri, 14 Oct 2011 07:49:00 +0000 (15:49 +0800)]
mtd: m25p80: don't probe device which has status of 'disabled'
On some platforms such as P3060QDS, has multiple spi flashes, but they are
not available at same time, so if their status is 'disabled', which is set
by u-boot, will not be probed.
Robert Jarzmik [Wed, 5 Oct 2011 13:22:34 +0000 (15:22 +0200)]
mtd: Add DiskOnChip G3 support
Add support for DiskOnChip G3 chips. The support is quite
limited yet :
- no flash writes/erases are implemented
- ECC fixes are not implemented
- powerdown is not implemented
- IPL handling is not yet done
On the brighter side, the chip reading does work.
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
mtd: mxc_nand: preset_v1_v2: unlock all NAND flash blocks
For NFC v1, the unlock end block address was 0x4000, which would only
unlock the first 32 blocks of the NAND flash. Change that value to
0xffff to unlock all available blocks, as is done for NFC v21 as well.
Signed-off-by: Michael Thalmeier <michael.thalmeier@hale.at> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Brian Norris [Wed, 7 Sep 2011 20:13:41 +0000 (13:13 -0700)]
mtd: nand: switch `check_pattern()' to standard `memcmp()'
A portion of the `check_pattern()' function is basically a `memcmp()'.
Since it's possible for `memcmp()' to be optimized for a particular
architecture, we should use it instead.
Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Brian Norris [Wed, 7 Sep 2011 20:13:40 +0000 (13:13 -0700)]
mtd: nand: invalidate cache on unaligned reads
In rare cases, we are given an unaligned parameter `from' in
`nand_do_read_ops()'. In such cases, we use the page cache
(chip->buffers->databuf) as an intermediate buffer before dumping to the
client buffer. However, there are also cases where this buffer is not
cleanly reusable. In those cases, we need to make sure that we
explicitly invalidate the cache.
This patch prevents accidental reusage of the page cache, and for me,
this solves some problems I come across when reading a corrupted BBT
from flash (NAND_BBT_USE_FLASH and NAND_BBT_NO_OOB).
Note: the rare "unaligned" case is a result of the extra BBT pattern +
version located in the data area instead of OOB.
Also, this patch disables caching on raw reads, since we are reading
without error correction. This is, obviously, prone to errors and should
not be cached.
Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Brian Norris [Wed, 21 Sep 2011 01:36:42 +0000 (18:36 -0700)]
mtd: nand: do not scan bad blocks with NAND_BBT_NO_OOB set
Updates to our default function for creating bad block patterns have
broken the "no OOB" feature. The NAND_BBT_NO_OOB option should not be
set while scanning for bad blocks, but we've been passing all BBT
options from nand_chip.bbt_options to the bad block scan. This causes us
to hit the:
BUG_ON(bd->options & NAND_BBT_NO_OOB);
in create_bbt() when we scan the flash for bad blocks.
Thus, while it can be legal to set NAND_BBT_NO_OOB in a custom badblock
pattern descriptor (presumably with NAND_BBT_CREATE disabled?), we
should not pass it through in our default function.
Also, to help clarify and emphasize that the function creates bad block
patterns only (not, for example, table descriptors for locating
flash-based BBT), I renamed `nand_create_default_bbt_descr' to
`nand_create_badblock_pattern'.
Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Brian Norris [Wed, 21 Sep 2011 01:35:57 +0000 (18:35 -0700)]
mtd: nand: wait to set BBT version
Because there are so many cases of checking, writing, and re-writing of
the bad block table(s), we might as well wait until the we've settled on
a valid, clean copy of the table. This also prevents us from falsely
incrementing the table version. For example, we may have the following:
Primary table, with version 0x02
Mirror table, with version 0x01
Primary table has uncorrectable ECC errors
If we don't have this fix applied, then we will:
Choose to read the primary table (higher version)
Set mirror table version to 0x02
Read back primary table
Invalidate table because of ECC errors
Retry readback operation with mirror table, now version 0x02
Mirrored table reads cleanly
Writeback BBT to primary table location (with "version 0x02")
However, the mirrored table shouldn't have a new version number.
Instead, we actually want:
Choose to read the primary table (higher version)
Read back primary table
Invalidate table because of ECC errors
Retry readback with mirror table (version 0x01)
Mirrored table reads cleanly
Set both tables to version 0x01
Writeback BBT to primary table location (version 0x01)
Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Brian Norris [Wed, 21 Sep 2011 01:35:34 +0000 (18:35 -0700)]
mtd: nand: scrub BBT on ECC errors
Now that `read_bbt()' returns ECC error codes properly, we handle those
codes when checking the integrity of our flash-based BBT.
The modifications can be described by this new policy:
*) On any uncorrected ECC error, we invalidate the corresponding table
and retry our version-checking integrity logic.
*) On corrected bitflips, we mark both tables for re-writing to flash
(a.k.a. scrubbing).
Current integrity checks (i.e., comparing version numbers, etc.) should
take care of all the cases that result in rescanning the device for bad
blocks or falling back to the BBT as found in the mirror descriptor.
Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Brian Norris [Wed, 21 Sep 2011 01:35:08 +0000 (18:35 -0700)]
mtd: nand: report ECC errors properly when reading BBT
Instead of just printing a warning when encountering ECC errors, we
should return a proper error status and print a more informative
warning. Later, we will handle these error messages in the upper layers
of the BBT scan.
Note that this patch makes our check for ECC error codes a little bit
more restrictive, leaving all unrecognized errors to the generic "else"
clause. This shouldn't cause problems and could even be a benefit.
This code is based on some findings reported by Matthieu Castet.
Brian Norris [Wed, 7 Sep 2011 20:13:35 +0000 (13:13 -0700)]
mtd: nand: remove gotos in `check_create()'
This is a second step in restructuring `check_create()'. When we don't
rely on goto statements for our main functionality, the code will become
a little easier to manipulate.
Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Brian Norris [Wed, 7 Sep 2011 20:13:34 +0000 (13:13 -0700)]
mtd: nand: begin restructuring check_create
We will begin restructuring the code for check_create so that we can
make some important changes. For now, we should just begin to get rid of
some goto statements to make things cleaner. This is the first step of a
few, which are separated to make them easier to follow.
This step should just be a code refactor.
Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Brian Norris [Wed, 7 Sep 2011 20:13:29 +0000 (13:13 -0700)]
mtd: nand: do not ignore all ECC errors
There are a few reasons not to ignore ECC errors here.
First, mtd->read_oob is being called in raw mode, so there should be no
error correction in the first place.
Second, if we change this such that there *is* error correction in this
function, then we will want to pass the error message upward.
In fact, the code I introduced to "ignore ECC errors" would have been
better if it had just placed this test down in `scan_block_full()' in
the first place. We would like to ignore ECC errors when we are simply
checking for bad block markers (e.g., factory marked), but we may not
want to ignore ECC errors when scanning OOB for a flash-based BBT
pattern (in `scan_read_raw()'; note that the return codes from
`scan_read_raw()' are not actually handled yet).
Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Brian Norris [Wed, 31 Aug 2011 01:45:46 +0000 (18:45 -0700)]
mtd: kill old field for `struct mtd_info_user'
The ecctype and eccsize fields have been obsolete for a while. Since they
don't have any users, we can kill them and leave padding in their place
for now.
Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Brian Norris [Wed, 31 Aug 2011 01:45:45 +0000 (18:45 -0700)]
mtd: nand: kill member `ops' of `struct nand_chip'
The nand_chip.ops field is a struct that is passed around globally with
no particular reason. Every time it is used, it could just as easily be
replaced with a local struct that is updated on each operation. So make
it local.
Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Brian Norris [Wed, 31 Aug 2011 01:45:44 +0000 (18:45 -0700)]
mtd: document ABI
We're missing a lot of important documentation in include/mtd/mtd-abi.h:
* add a simple description of each ioctl (feel free to expand!)
* give full explanations of recently added and modified operations
* explain the usage of "RAW" that appear in different modes and types of
operations
* fix some comment style along the way
Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Brian Norris [Fri, 9 Sep 2011 16:59:03 +0000 (09:59 -0700)]
mtd: add MEMWRITE ioctl
Implement a new ioctl for writing both page data and OOB to flash at the
same time. This ioctl is intended to be a generic interface that can
replace other ioctls (MEMWRITEOOB and MEMWRITEOOB64) and cover the
functionality of several other old ones, e.g., MEMWRITE can:
* write autoplaced OOB instead of using ECCGETLAYOUT (deprecated) and
working around the reserved areas
* write raw (no ECC) OOB instead of using MTDFILEMODE to set the
per-file-descriptor MTD_FILE_MODE_RAW
* write raw (no ECC) data instead of using MTDFILEMODE
(MTD_FILE_MODE_RAW) and using standard character device "write"
This ioctl is especially useful for MLC NAND, which cannot be written
twice (i.e., we cannot successfully write the page data and OOB in two
separate operations). Instead, MEMWRITE can write both in a single
operation.
Note that this ioctl is not affected by the MTD file mode (i.e.,
MTD_FILE_MODE_RAW vs. MTD_FILE_MODE_NORMAL), since it receives its write
mode as an input parameter.
Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Brian Norris [Wed, 31 Aug 2011 01:45:41 +0000 (18:45 -0700)]
mtd: rename MTD_MODE_* to MTD_FILE_MODE_*
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 <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Brian Norris [Wed, 31 Aug 2011 01:45:40 +0000 (18:45 -0700)]
mtd: rename MTD_OOB_* to MTD_OPS_*
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>
Brian Norris [Wed, 31 Aug 2011 01:45:39 +0000 (18:45 -0700)]
mtd: move mtd_oob_mode_t to shared kernel/user space
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>
Brian Norris [Wed, 31 Aug 2011 01:45:38 +0000 (18:45 -0700)]
mtd: support reading OOB without ECC
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>
Brian Norris [Wed, 31 Aug 2011 01:45:37 +0000 (18:45 -0700)]
mtd: support writing OOB without ECC
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>
Brian Norris [Wed, 24 Aug 2011 00:17:34 +0000 (17:17 -0700)]
mtd: remove MEMSETOOBSEL macro definition
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>
Brian Norris [Wed, 24 Aug 2011 00:17:32 +0000 (17:17 -0700)]
mtd: do not assume oobsize is power of 2
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>
Brian Norris [Tue, 19 Jul 2011 17:06:13 +0000 (10:06 -0700)]
mtd: cleanup last uses of MTD_DEBUG config macros
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>
Brian Norris [Tue, 19 Jul 2011 17:06:07 +0000 (10:06 -0700)]
mtd: nand: convert printk() to pr_*()
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>
Brian Norris [Tue, 19 Jul 2011 17:06:06 +0000 (10:06 -0700)]
mtd: nand: change KERN_DEBUG to KERN_INFO
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>
Lei Wen [Fri, 15 Jul 2011 03:44:33 +0000 (20:44 -0700)]
mtd: pxa3xx_nand: enable multiple chip select support
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.
Lei Wen [Fri, 15 Jul 2011 03:44:30 +0000 (20:44 -0700)]
mtd: pxa3xx_nand: enhance suspend and resume routine
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.
Mike Hench [Tue, 5 Jul 2011 23:14:48 +0000 (19:14 -0400)]
mtd: eLBC NAND: remove elbc_fcm_ctrl->oob_poi
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>
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>
Liu Shuo [Tue, 28 Jun 2011 01:50:51 +0000 (09:50 +0800)]
mtd: nand: don't free the global data too early
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>
Brian Norris [Tue, 28 Jun 2011 23:29:00 +0000 (16:29 -0700)]
mtd: edit NAND-related comment
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>
Brian Norris [Tue, 28 Jun 2011 23:28:58 +0000 (16:28 -0700)]
mtd: nand: ignore ECC errors for simple BBM scans
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>
Brian Norris [Thu, 23 Jun 2011 23:45:24 +0000 (16:45 -0700)]
mtd: nand: handle ECC errors in OOB
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>
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.
There is no need to export parse_mtd_partitions() now , as it's fully handled
by registration functions. So move the definition to private header and
remove respective EXPORT_SYMBOL_GPL.
EDB7312 isn't supported by mainline kernel, this driver wasn't working
before recent fixes, the same functionality can be achieved via physmap,
so drop it now. If the board support will ever be submitted to mainline,
one either can revert this commit, or use physmap mtd map driver.
mtd: socrates_nand.c: use mtd_device_parse_register
Replace custom invocations of parse_mtd_partitions and mtd_device_register
with common mtd_device_parse_register call. This would bring: standard
handling of all errors, fallback to default partitions, etc.
Replace custom invocations of parse_mtd_partitions and mtd_device_register
with common mtd_device_parse_register call. This would bring: standard
handling of all errors, fallback to default partitions, etc.
Replace custom invocations of parse_mtd_partitions and mtd_device_register
with common mtd_device_parse_register call. This would bring: standard
handling of all errors, fallback to default partitions, etc.
Replace custom invocations of parse_mtd_partitions and mtd_device_register
with common mtd_device_parse_register call. This would bring: standard
handling of all errors, fallback to default partitions, etc.
mtd: fsl_elbc_nand.c: use mtd_device_parse_register
Replace custom invocations of parse_mtd_partitions and mtd_device_register
with common mtd_device_parse_register call. This would bring: standard
handling of all errors, fallback to default partitions, etc.
Replace custom invocations of parse_mtd_partitions and mtd_device_register
with common mtd_device_parse_register call. This would bring: standard
handling of all errors, fallback to default partitions, etc.
Replace custom invocations of parse_mtd_partitions and mtd_device_register
with common mtd_device_parse_register call. This would bring: standard
handling of all errors, fallback to default partitions, etc.