platform/kernel/linux-starfive.git
13 years agomtd: dataflash: add device tree probe support
Shawn Guo [Fri, 15 Jul 2011 08:38:56 +0000 (16:38 +0800)]
mtd: dataflash: add device tree probe support

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>
13 years agomtd: pxa3xx_nand: enable multiple chip select support
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.

Signed-off-by: Lei Wen <leiwen@marvell.com>
13 years agomtd: pxa3xx_nand: sperate each chip individual info
Lei Wen [Fri, 15 Jul 2011 03:44:32 +0000 (20:44 -0700)]
mtd: pxa3xx_nand: sperate each chip individual info

For support two chip select, we seperate chip specific info in this
patch.

Signed-off-by: Lei Wen <leiwen@marvell.com>
13 years agomtd: pxa3xx_nand: convert all printk into dev_*
Lei Wen [Fri, 15 Jul 2011 03:44:31 +0000 (20:44 -0700)]
mtd: pxa3xx_nand: convert all printk into dev_*

Also add missed warning message.

Signed-off-by: Lei Wen <leiwen@marvell.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
13 years agomtd: pxa3xx_nand: enhance suspend and resume routine
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.

Signed-off-by: Lei Wen <leiwen@marvell.com>
13 years agomtd: eLBC NAND: remove elbc_fcm_ctrl->oob_poi
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>
13 years agomtd: atmel_nand: optimize read/write buffer functions
Nicolas Ferre [Mon, 4 Jul 2011 14:17:53 +0000 (16:17 +0200)]
mtd: atmel_nand: optimize read/write buffer functions

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>
13 years agomtd: nand: don't free the global data too early
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>
13 years agomtd: plat-nand: Fixup kerneldoc for struct platform_nand_chip
Tobias Klauser [Fri, 1 Jul 2011 11:51:15 +0000 (13:51 +0200)]
mtd: plat-nand: Fixup kerneldoc for struct platform_nand_chip

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>
13 years agomtd: fsl_upm: fix a memory leak in fun_chip_init error path
Axel Lin [Thu, 30 Jun 2011 11:53:09 +0000 (19:53 +0800)]
mtd: fsl_upm: fix a memory leak in fun_chip_init error path

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
13 years agomtd: atmel_nand: fix wrong use of 0 as NULL
Nicolas Ferre [Wed, 29 Jun 2011 16:41:16 +0000 (18:41 +0200)]
mtd: atmel_nand: fix wrong use of 0 as NULL

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>
13 years agomtd: nand_flash_detect_onfi propagate busw info
Matthieu CASTET [Sun, 26 Jun 2011 16:26:55 +0000 (18:26 +0200)]
mtd: nand_flash_detect_onfi propagate busw info

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>
13 years agomtd: edit NAND-related comment
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>
13 years agomtd: tests: ignore corrected bitflips in OOB on mtd_readtest
Brian Norris [Tue, 28 Jun 2011 23:28:59 +0000 (16:28 -0700)]
mtd: tests: ignore corrected bitflips in OOB on mtd_readtest

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>
13 years agomtd: nand: ignore ECC errors for simple BBM scans
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>
13 years agojffs2: use mutex_is_locked() in __jffs2_flush_wbuf()
Alexey Khoroshilov [Mon, 27 Jun 2011 20:21:30 +0000 (00:21 +0400)]
jffs2: use mutex_is_locked() in __jffs2_flush_wbuf()

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>
13 years agomtd: ofpart: add ofoldpart alias
Dmitry Eremin-Solenikov [Mon, 27 Jun 2011 12:34:46 +0000 (16:34 +0400)]
mtd: ofpart: add ofoldpart alias

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>
13 years agomtd: nand: handle ECC errors in OOB
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>
13 years agomtd: make ofpart buildable as a separate module
Dmitry Eremin-Solenikov [Sun, 26 Jun 2011 21:02:59 +0000 (01:02 +0400)]
mtd: make ofpart buildable as a separate module

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>
13 years agomtd: spelling, capitalization, uniformity
Brian Norris [Thu, 23 Jun 2011 21:12:08 +0000 (14:12 -0700)]
mtd: spelling, capitalization, uniformity

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>
13 years agomtd: drop mtd_device_register
Dmitry Eremin-Solenikov [Thu, 23 Jun 2011 11:33:15 +0000 (15:33 +0400)]
mtd: drop mtd_device_register

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>
13 years agomtd: remove put_partition_parser() from public header
Dmitry Eremin-Solenikov [Thu, 23 Jun 2011 11:26:14 +0000 (15:26 +0400)]
mtd: remove put_partition_parser() from public header

There is no need to pollute public header with a definition private
to mtdpart.c. Move it from mtd/partitions.h to mtdpart.c

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: hide parse_mtd_partitions
Dmitry Eremin-Solenikov [Thu, 23 Jun 2011 11:23:08 +0000 (15:23 +0400)]
mtd: hide parse_mtd_partitions

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.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: nand: drop edb7312 support
Dmitry Eremin-Solenikov [Thu, 23 Jun 2011 08:33:52 +0000 (12:33 +0400)]
mtd: nand: drop edb7312 support

EDB7312 isn't supported by mainline kernel, so drop it now.
If the board support will ever be submitted to mainline,
one can revert this commit.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: maps: drop edb7312 support
Dmitry Eremin-Solenikov [Thu, 23 Jun 2011 08:33:52 +0000 (12:33 +0400)]
mtd: maps: drop edb7312 support

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.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: OneNAND: Detect the correct NOP when 4KiB pagesize
Kyungmin Park [Wed, 22 Jun 2011 05:16:49 +0000 (14:16 +0900)]
mtd: OneNAND: Detect the correct NOP when 4KiB pagesize

There are two different 4KiB pagesize chips
KFM4G16Q4M series have NOP 4 with version ID 0x0131
But KFM4G16Q5M has NOP 1 with versoin ID 0x013e

Note that Q5M means that it has NOP 1.

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: socrates_nand.c: use mtd_device_parse_register
Dmitry Eremin-Solenikov [Thu, 2 Jun 2011 14:01:07 +0000 (18:01 +0400)]
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.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
13 years agomtd: ndfc.c: use mtd_device_parse_register
Dmitry Eremin-Solenikov [Thu, 2 Jun 2011 14:00:51 +0000 (18:00 +0400)]
mtd: ndfc.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.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
13 years agomtd: mpc5121_nfc.c: use mtd_device_parse_register
Dmitry Eremin-Solenikov [Thu, 2 Jun 2011 14:00:42 +0000 (18:00 +0400)]
mtd: mpc5121_nfc.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.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
13 years agomtd: fsl_upm.c: use mtd_device_parse_register
Dmitry Eremin-Solenikov [Thu, 2 Jun 2011 14:00:37 +0000 (18:00 +0400)]
mtd: fsl_upm.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.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
13 years agomtd: fsl_elbc_nand.c: use mtd_device_parse_register
Dmitry Eremin-Solenikov [Thu, 2 Jun 2011 14:00:36 +0000 (18:00 +0400)]
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.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
13 years agomtd: m25p80.c: use mtd_device_parse_register
Dmitry Eremin-Solenikov [Thu, 2 Jun 2011 13:59:16 +0000 (17:59 +0400)]
mtd: m25p80.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.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
13 years agomtd: physmap_of.c: use mtd_device_parse_register
Dmitry Eremin-Solenikov [Thu, 2 Jun 2011 13:59:59 +0000 (17:59 +0400)]
mtd: physmap_of.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.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
13 years agomtd: physmap_of: move parse_obsolete_partitions to become separate parser
Dmitry Eremin-Solenikov [Sun, 29 May 2011 21:26:17 +0000 (01:26 +0400)]
mtd: physmap_of: move parse_obsolete_partitions to become separate parser

Move parse_obsolete_partitions() to ofpart.c and register it as an
ofoldpart partitions parser.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
13 years agomtd: drop of_mtd_parse_partitions()
Dmitry Eremin-Solenikov [Sun, 29 May 2011 21:05:33 +0000 (01:05 +0400)]
mtd: drop of_mtd_parse_partitions()

All users have been converted to call of_mtd_parse_partitions through
parse_mtd_partitions() multiplexer. Drop obsolete API.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
13 years agomtd: socrates_nand: use ofpart through generic parsing
Dmitry Eremin-Solenikov [Sun, 29 May 2011 21:02:26 +0000 (01:02 +0400)]
mtd: socrates_nand: use ofpart through generic parsing

Convert the driver to use ofpart partitions parsing through the generic
parse_mtd_partitions().

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
13 years agomtd: ndfc: use ofpart through generic parsing
Dmitry Eremin-Solenikov [Sun, 29 May 2011 21:02:25 +0000 (01:02 +0400)]
mtd: ndfc: use ofpart through generic parsing

Convert the driver to use ofpart partitions parsing through the generic
parse_mtd_partitions().

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
13 years agomtd: mpc5121_nfc: use ofpart through generic parsing
Dmitry Eremin-Solenikov [Sun, 29 May 2011 21:02:24 +0000 (01:02 +0400)]
mtd: mpc5121_nfc: use ofpart through generic parsing

Convert the driver to use ofpart partitions parsing through the generic
parse_mtd_partitions().

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
13 years agomtd: fsl_upm: use ofpart through generic parsing
Dmitry Eremin-Solenikov [Sun, 29 May 2011 21:02:23 +0000 (01:02 +0400)]
mtd: fsl_upm: use ofpart through generic parsing

Convert the driver to use ofpart partitions parsing through the generic
parse_mtd_partitions().

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
13 years agomtd: fsl_elbc_nand: use ofpart through generic parsing
Dmitry Eremin-Solenikov [Sun, 29 May 2011 21:02:22 +0000 (01:02 +0400)]
mtd: fsl_elbc_nand: use ofpart through generic parsing

Convert the driver to use ofpart partitions parsing through the generic
parse_mtd_partitions().

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
13 years agomtd: m25p80: use ofpart through generic parsing
Dmitry Eremin-Solenikov [Sun, 29 May 2011 21:02:20 +0000 (01:02 +0400)]
mtd: m25p80: use ofpart through generic parsing

Convert the driver to use ofpart partitions parsing through the generic
parse_mtd_partitions().

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
13 years agomtd: physmap_of: use ofpart through generic parsing
Dmitry Eremin-Solenikov [Sun, 29 May 2011 21:02:21 +0000 (01:02 +0400)]
mtd: physmap_of: use ofpart through generic parsing

Convert the driver to use ofpart partitions parsing through the generic
parse_mtd_partitions().

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
13 years agomtd: prepare to convert of_mtd_parse_partitions to partition parser
Dmitry Eremin-Solenikov [Sun, 29 May 2011 17:32:33 +0000 (21:32 +0400)]
mtd: prepare to convert of_mtd_parse_partitions to partition parser

Prepare to convert of_mtd_parse_partitions() to usual partitions parser:
1) Register ofpart parser
2) Internally don't use passed device for error printing
3) Add device_node to mtd_part_parser_data struct
4) Move of_mtd_parse_partitions from __devinit to common text section
5) add ofpart to the default list of partition parsers

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
13 years agomtd: abstract last MTD partition parser argument
Dmitry Eremin-Solenikov [Fri, 10 Jun 2011 14:18:28 +0000 (18:18 +0400)]
mtd: abstract last MTD partition parser argument

Encapsulate last MTD partition parser argument into a separate
structure. Currently it holds only 'origin' field for RedBoot parser,
but will be extended in future to contain at least device_node for OF
devices.

Amended commentary to make kerneldoc happy

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
13 years agomtd: nand_base: always initialise oob_poi before writing OOB data
THOMSON, Adam (Adam) [Tue, 14 Jun 2011 14:52:38 +0000 (16:52 +0200)]
mtd: nand_base: always initialise oob_poi before writing OOB data

In nand_do_write_ops() code it is possible for a caller to provide
ops.oobbuf populated and ops.mode == MTD_OOB_AUTO, which currently
means that the chip->oob_poi buffer isn't initialised to all 0xFF.
The nand_fill_oob() method then carries out the task of copying
the provided OOB data to oob_poi, but with MTD_OOB_AUTO it skips
areas marked as unavailable by the layout struct, including the
bad block marker bytes.

An example of this causing issues is when the last OOB data read
was from the start of a bad block where the markers are not 0xFF,
and the caller wishes to write new OOB data at the beginning of
another block. In this scenario the caller would provide OOB data,
but nand_fill_oob() would skip the bad block marker bytes in
oob_poi before copying the OOB data provided by the caller.
This means that when the OOB data is written back to NAND,
the block is inadvertently marked as bad without the caller knowing.
This has been witnessed when using YAFFS2 where tags are stored
in the OOB.

To avoid this oob_poi is always initialised to 0xFF to make sure
no left over data is inadvertently written back to the OOB area.

Credits to Brian Norris <computersforpeace@gmail.com> for fixing this
patch.

Signed-off-by: Adam Thomson <adam.thomson@alcatel-lucent.com>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
Cc: stable@kernel.org [2.6.20+]
13 years agojffs2: Avoid unneeded 'if' before kfree
Jesper Juhl [Mon, 13 Jun 2011 20:16:44 +0000 (22:16 +0200)]
jffs2: Avoid unneeded 'if' before kfree

kfree() deals gracefully with NULL pointers, so it's pointless to test for
one prior to calling it.
This removes such a test from jffs2_scan_medium().

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
13 years agomtd: onenand: remove redundant mtd_device_unregister before onenand_release
Axel Lin [Fri, 17 Jun 2011 11:06:33 +0000 (19:06 +0800)]
mtd: onenand: remove redundant mtd_device_unregister before onenand_release

onenand_release() will call mtd_device_unregister(), thus remove the redundant
mtd_device_unregister() call before onenand_release().

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
13 years agomtd: edb7312: correctly pass MTD name to parsers
Dmitry Eremin-Solenikov [Thu, 9 Jun 2011 10:54:41 +0000 (14:54 +0400)]
mtd: edb7312: correctly pass MTD name to parsers

cmdline partitions parser expects MTD name at mtd->name, instead of
origin, while edb7312 passes MTDID as origin. Fix that.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: mtd_dataflash.c: use mtd_device_parse_register
Dmitry Eremin-Solenikov [Thu, 2 Jun 2011 13:59:18 +0000 (17:59 +0400)]
mtd: mtd_dataflash.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.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: onenand/samsung.c: use mtd_device_parse_register
Dmitry Eremin-Solenikov [Thu, 2 Jun 2011 14:01:16 +0000 (18:01 +0400)]
mtd: onenand/samsung.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.

Axel Lin <axel.lin@gmail.com>: fixed build error.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: onenand/omap2.c: use mtd_device_parse_register
Dmitry Eremin-Solenikov [Thu, 2 Jun 2011 14:01:11 +0000 (18:01 +0400)]
mtd: onenand/omap2.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.

Axel Lin <axel.lin@gmail.com>: fixed build breakage

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: onenand/generic.c: use mtd_device_parse_register
Dmitry Eremin-Solenikov [Thu, 2 Jun 2011 14:01:10 +0000 (18:01 +0400)]
mtd: onenand/generic.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.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: txx9ndfmc.c: use mtd_device_parse_register
Dmitry Eremin-Solenikov [Thu, 2 Jun 2011 14:01:09 +0000 (18:01 +0400)]
mtd: txx9ndfmc.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.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: tmio_nand.c: use mtd_device_parse_register
Dmitry Eremin-Solenikov [Thu, 2 Jun 2011 14:01:09 +0000 (18:01 +0400)]
mtd: tmio_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.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: sharpsl.c: use mtd_device_parse_register
Dmitry Eremin-Solenikov [Thu, 2 Jun 2011 14:01:03 +0000 (18:01 +0400)]
mtd: sharpsl.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.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: s3c2410.c: use mtd_device_parse_register
Dmitry Eremin-Solenikov [Thu, 2 Jun 2011 14:01:02 +0000 (18:01 +0400)]
mtd: s3c2410.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.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: pxa3xx_nand.c: use mtd_device_parse_register
Dmitry Eremin-Solenikov [Thu, 2 Jun 2011 14:00:59 +0000 (18:00 +0400)]
mtd: pxa3xx_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.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: ppchameleonevb.c: use mtd_device_parse_register
Dmitry Eremin-Solenikov [Thu, 2 Jun 2011 14:00:58 +0000 (18:00 +0400)]
mtd: ppchameleonevb.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.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: plat_nand.c: use mtd_device_parse_register
Dmitry Eremin-Solenikov [Thu, 2 Jun 2011 14:00:57 +0000 (18:00 +0400)]
mtd: plat_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.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: orion_nand.c: use mtd_device_parse_register
Dmitry Eremin-Solenikov [Thu, 2 Jun 2011 14:00:55 +0000 (18:00 +0400)]
mtd: orion_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.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: omap2.c: use mtd_device_parse_register
Dmitry Eremin-Solenikov [Thu, 2 Jun 2011 14:00:55 +0000 (18:00 +0400)]
mtd: omap2.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.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: mxc_nand.c: use mtd_device_parse_register
Dmitry Eremin-Solenikov [Thu, 2 Jun 2011 14:00:43 +0000 (18:00 +0400)]
mtd: mxc_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.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: jz4740_nand.c: use mtd_device_parse_register
Dmitry Eremin-Solenikov [Thu, 2 Jun 2011 14:00:41 +0000 (18:00 +0400)]
mtd: jz4740_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.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: h1910.c: use mtd_device_parse_register
Dmitry Eremin-Solenikov [Thu, 2 Jun 2011 14:00:40 +0000 (18:00 +0400)]
mtd: h1910.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.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: fsmc_nand.c: use mtd_device_parse_register
Dmitry Eremin-Solenikov [Thu, 2 Jun 2011 14:00:38 +0000 (18:00 +0400)]
mtd: fsmc_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.

Linus Walleij: fixed compilation breakage

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: edb7312.c: use mtd_device_parse_register
Dmitry Eremin-Solenikov [Thu, 2 Jun 2011 14:00:35 +0000 (18:00 +0400)]
mtd: edb7312.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.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: davinci_nand.c: use mtd_device_parse_register
Dmitry Eremin-Solenikov [Thu, 2 Jun 2011 14:00:32 +0000 (18:00 +0400)]
mtd: davinci_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.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: cs553x_nand.c: use mtd_device_parse_register
Dmitry Eremin-Solenikov [Thu, 2 Jun 2011 14:00:31 +0000 (18:00 +0400)]
mtd: cs553x_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.

Artem: tewaked the patch

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: cmx270_nand.c: use mtd_device_parse_register
Dmitry Eremin-Solenikov [Thu, 2 Jun 2011 14:00:30 +0000 (18:00 +0400)]
mtd: cmx270_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.

Artem: tweaked the patch

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: cafe_nand.c: use mtd_device_parse_register
Dmitry Eremin-Solenikov [Thu, 2 Jun 2011 14:00:29 +0000 (18:00 +0400)]
mtd: cafe_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.

Fixed by Brian Norris <computersforpeace@gmail.com>

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: bcm_umi_nand.c: use mtd_device_parse_register
Dmitry Eremin-Solenikov [Thu, 2 Jun 2011 14:00:27 +0000 (18:00 +0400)]
mtd: bcm_umi_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.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: atmel_nand.c: use mtd_device_parse_register
Dmitry Eremin-Solenikov [Thu, 2 Jun 2011 14:00:23 +0000 (18:00 +0400)]
mtd: atmel_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.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: wr_sbc82xx_flash.c: use mtd_device_parse_register
Dmitry Eremin-Solenikov [Thu, 2 Jun 2011 14:00:20 +0000 (18:00 +0400)]
mtd: wr_sbc82xx_flash.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.

Artem: some tweaks, split one very long line while on it.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: solutionengine.c: use mtd_device_parse_register
Dmitry Eremin-Solenikov [Thu, 2 Jun 2011 14:00:12 +0000 (18:00 +0400)]
mtd: solutionengine.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.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: sa1100-flash.c: use mtd_device_parse_register
Dmitry Eremin-Solenikov [Thu, 2 Jun 2011 14:00:06 +0000 (18:00 +0400)]
mtd: sa1100-flash.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.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: rbtx4939-flash.c: use mtd_device_parse_register
Dmitry Eremin-Solenikov [Thu, 2 Jun 2011 14:00:04 +0000 (18:00 +0400)]
mtd: rbtx4939-flash.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.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: pxa2xx-flash.c: use mtd_device_parse_register
Dmitry Eremin-Solenikov [Thu, 2 Jun 2011 14:00:03 +0000 (18:00 +0400)]
mtd: pxa2xx-flash.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.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: plat-ram.c: use mtd_device_parse_register
Dmitry Eremin-Solenikov [Thu, 2 Jun 2011 14:00:01 +0000 (18:00 +0400)]
mtd: plat-ram.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.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: physmap.c: use mtd_device_parse_register
Dmitry Eremin-Solenikov [Thu, 2 Jun 2011 13:59:58 +0000 (17:59 +0400)]
mtd: physmap.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.

Artem: tweaked the patch

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: latch-addr-flash.c: use mtd_device_parse_register
Dmitry Eremin-Solenikov [Thu, 2 Jun 2011 13:59:50 +0000 (17:59 +0400)]
mtd: latch-addr-flash.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.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: lantiq-flash.c: use mtd_device_parse_register
Dmitry Eremin-Solenikov [Thu, 2 Jun 2011 13:59:49 +0000 (17:59 +0400)]
mtd: lantiq-flash.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.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: ixp4xx.c: use mtd_device_parse_register
Dmitry Eremin-Solenikov [Thu, 2 Jun 2011 13:59:47 +0000 (17:59 +0400)]
mtd: ixp4xx.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.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: ixp2000.c: use mtd_device_parse_register
Dmitry Eremin-Solenikov [Thu, 2 Jun 2011 13:59:46 +0000 (17:59 +0400)]
mtd: ixp2000.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.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: intel_vr_nor.c: use mtd_device_parse_register
Dmitry Eremin-Solenikov [Thu, 2 Jun 2011 13:59:45 +0000 (17:59 +0400)]
mtd: intel_vr_nor.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.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: impa7.c: use mtd_device_parse_register
Dmitry Eremin-Solenikov [Thu, 2 Jun 2011 13:59:44 +0000 (17:59 +0400)]
mtd: impa7.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.

Artem: rename static_partitions to make lines shorter and align the way
       this driver prefers.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: h720x-flash.c: use mtd_device_parse_register
Dmitry Eremin-Solenikov [Thu, 2 Jun 2011 13:59:42 +0000 (17:59 +0400)]
mtd: h720x-flash.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.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: gpio-addr-flash.c: use mtd_device_parse_register
Dmitry Eremin-Solenikov [Thu, 2 Jun 2011 13:59:41 +0000 (17:59 +0400)]
mtd: gpio-addr-flash.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.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: dc21285.c: use mtd_device_parse_register
Dmitry Eremin-Solenikov [Thu, 2 Jun 2011 13:59:35 +0000 (17:59 +0400)]
mtd: dc21285.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.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: bfin-async-flash.c: use mtd_device_parse_register
Dmitry Eremin-Solenikov [Thu, 2 Jun 2011 13:59:30 +0000 (17:59 +0400)]
mtd: bfin-async-flash.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.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: sst25l.c: use mtd_device_parse_register
Dmitry Eremin-Solenikov [Thu, 2 Jun 2011 13:59:23 +0000 (17:59 +0400)]
mtd: sst25l.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.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: add new API for handling MTD registration
Dmitry Eremin-Solenikov [Fri, 25 Mar 2011 19:26:25 +0000 (22:26 +0300)]
mtd: add new API for handling MTD registration

Lots (nearly all) mtd drivers contain nearly the similar code that
calls parse_mtd_partitions, provides some platform-default values, if
parsing fails, and registers  mtd device.

This is an aim to provide single implementation of this scenario:
mtd_device_parse_register() which will handle all this parsing and
defaults.

Artem: amended comments

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: lart: cleanup: drop HAVE_PARTITIONS
Dmitry Eremin-Solenikov [Wed, 8 Jun 2011 15:59:49 +0000 (19:59 +0400)]
mtd: lart: cleanup: drop HAVE_PARTITIONS

Consolidate knowledge about partitions in drivers/mtd/devices/lart.c.
Drop all HAVE_PARTITIONS conditionals. Always use partitioning.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: davinci_nand: remove redundant mtd_device_unregister
Axel Lin [Wed, 8 Jun 2011 13:01:37 +0000 (21:01 +0800)]
mtd: davinci_nand: remove redundant mtd_device_unregister

mtd_device_unregister is done in nand_release(),
thus no need to call it in nand_davinci_remove().

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: remove printk's for [kv][mz]alloc failures
Brian Norris [Tue, 7 Jun 2011 23:01:54 +0000 (16:01 -0700)]
mtd: remove printk's for [kv][mz]alloc failures

When a memory allocation fails, the kernel will print out a backtrace
automatically. These print statements are unnecessary.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: ndfc: fix a memory leak in ndfc_remove
Axel Lin [Tue, 7 Jun 2011 14:55:21 +0000 (22:55 +0800)]
mtd: ndfc: fix a memory leak in ndfc_remove

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: document parse_mtd_partitions
Artem Bityutskiy [Wed, 8 Jun 2011 08:42:27 +0000 (11:42 +0300)]
mtd: document parse_mtd_partitions

Add a kerneldoc comment for the 'parse_mtd_partitions()' function - its
behavior has changed recently so it is good idea to have it documented.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: pxa3xx_nand: Fix blank page ECC mismatch
Daniel Mack [Tue, 7 Jun 2011 10:01:07 +0000 (03:01 -0700)]
mtd: pxa3xx_nand: Fix blank page ECC mismatch

This bug was introduced in f8155a40 ("mtd: pxa3xx_nand: rework irq
logic") and causes the PXA3xx NAND controller fail to operate with NAND
flash that has empty pages. According to the comment in this block, the
hardware controller will report a double-bit error for empty pages,
which can and must be ignored.

This patch restores the original behaviour of the driver.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Acked-by: Lei Wen <leiwen@marvell.com>
Cc: Haojian Zhuang <haojian.zhuang@marvell.com>
Cc: David Woodhouse <David.Woodhouse@intel.com>
Cc: stable@kernel.org [2.6.38+]
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: pxa3xx_nand: fix nand detection issue
Lei Wen [Tue, 7 Jun 2011 10:01:06 +0000 (03:01 -0700)]
mtd: pxa3xx_nand: fix nand detection issue

When keep_config is set, the detection would goes different routine.
That the driver would read out the setting which is set previously
by bootloader. While most bootloader keep the irq mask as off, and
current driver need all irq default open, keep_config behavior would
lead to no irq at all.

Signed-off-by: Lei Wen <leiwen@marvell.com>
Tested-by: Daniel Mack <zonque@gmail.com>
Cc: stable@kernel.org [2.6.38+]
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: denali: detect the number of banks before resetting NAND
Jamie Iles [Mon, 6 Jun 2011 16:11:34 +0000 (17:11 +0100)]
mtd: denali: detect the number of banks before resetting NAND

Commit c89eeda810f0ec4f0eee0206ebb79e476df9f83e (mtd: denali: detect the
number of banks) introduced runtime detection of the number of banks.

However, denali_nand_reset() uses uses denanli_nand_info::max_banks so
we need to detect the maximum number of banks before doing the reset.

Signed-off-by: Jamie Iles <jamie@jamieiles.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agomtd: plat-nand: drop unused fields from platform_nand_data
Dmitry Eremin-Solenikov [Mon, 6 Jun 2011 14:04:16 +0000 (18:04 +0400)]
mtd: plat-nand: drop unused fields from platform_nand_data

Drop now unused set_parts from struct platform_nand_data. Also, while we are
at it, drop long unused priv field from platform_nand_data.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>