9
0
Fork 0
Commit Graph

95 Commits

Author SHA1 Message Date
Wolfram Sang e88417b5ef nand: base: Improve error reporting if reading NAND-ID fails
- use KERN_ERR for messages when NAND-ID detection fails
- report the IDs also if not found
- print the errno if nand_scan failed

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-11-29 22:15:25 +01:00
Sascha Hauer 03f18f3115 mtd nand omap: use NAND_OWN_BUFFERS option
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-11-08 13:17:44 +01:00
Sascha Hauer 624a44a618 mtd nand omap: add read function for the OMAP4 romcode ecc mode
The OMAP4 romcode expects some unusual ecc layout which we could
write but not read. This patch adds a function which uses the
manual mode to read a page written with this ecc layout.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-11-08 13:17:08 +01:00
Sascha Hauer ecbc8a32ce mtd nand omap: factor out an internal __omap_calculate_ecc function
We can't use the ECC_RESULTx_0 register set for manual mode which
we'll need in the next patch. So factor out an internal function
which makes the register set to use configurable.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-11-08 11:13:11 +01:00
Sascha Hauer 01bedb6772 mtd nand omap: make debugging output more useful
- add missing '\n' at line ends
- fix wrong argument type warnings
- remove too noisy debug in omap_hwcontrol
- add function names to debug printfs
- add 0x prefixes to hex values

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-11-08 11:13:11 +01:00
Sascha Hauer 5b959a3e85 mtd nand omap: use register defines for ecc registers
We need this register bits later in another function, so
use register bit defines now.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-11-08 11:13:11 +01:00
Sascha Hauer 02fa86e9bc mtd nand omap: fail on bch decode failure
The driver used to print an error when bch decoing failed, but
did not actually throw an error. Fix this.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-11-08 11:13:10 +01:00
Sascha Hauer 4cb1b120bf mtd nand omap: call ecc calculate function outside omap_correct_bch
Move omap_calculate_ecc outside omap_correct_bch. When implementing
the romcode bch read page we have to call omap_calculate_ecc with
different arguments than in the standard case.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-11-08 11:11:34 +01:00
Sascha Hauer af01926739 mtd nand omap: factor out hamming correct function
To be consistent also factor out the hamming correct function
and also safe an indention level.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-11-08 11:08:07 +01:00
Sascha Hauer 1b79fee4f3 mtd nand omap: factor out bch correct function
We need the bch correct algorithm in the next patches, so
factor out a seperate function for this and also safe an
indention level.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-11-08 11:06:53 +01:00
Sascha Hauer 4a0a5df356 mtd nand omap: use blocknum calculation to where it's used
Just some refactoring to make the next patches better readable.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-11-08 11:05:43 +01:00
Sascha Hauer 4c6ac74566 nand: export some useful information about flashes to device variables
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-10-18 12:56:08 +02:00
Sascha Hauer c3a1bd4fe1 mtd nand i.MX: depend on ARCH_IMX instead of individual SoCs
This hardware is present on nearly all i.MX SoCs so do not
extend this list even further.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-10-13 17:27:19 +02:00
Sascha Hauer 64c1007a69 mtd nand i.MX: Add i.MX53 support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-10-13 17:27:19 +02:00
Sascha Hauer 3ee7877a48 introduce io.h
To allow for some generic io accessors introduce io.h and use
this instead of asm/io.h throughout the tree.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-09-22 19:03:05 +02:00
Sascha Hauer 0972e837c3 i.MX NAND: pass second base address as resource
The nand controller on i.MX51/53 uses two base addresses. Instead
of hardcode the second address use the new shiny resources two specify
it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-09-21 09:59:36 +02:00
Jean-Christophe PLAGNIOL-VILLARD afdfa915ce at91: nand switch ecc base to resource
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-09-20 21:12:46 +02:00
Jean-Christophe PLAGNIOL-VILLARD d4d8705636 nand: convert to struct resource
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2011-07-23 13:52:19 +08:00
Jean-Christophe PLAGNIOL-VILLARD 9157cbc256 nomadik/nand: switch to dev_request_mem_region
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-07-20 08:25:44 +02:00
Jean-Christophe PLAGNIOL-VILLARD 358ab3eb84 atmel/drivers: switch to dev_request_mem_region
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-07-20 08:25:43 +02:00
Sascha Hauer 8c53235dd0 nand i.MX: convert to struct resource
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-07-19 00:12:49 +08:00
Jean-Christophe PLAGNIOL-VILLARD 7ca122a091 nomadik_nand: use "struct resource" instead of platform_data
drop data_va, cmd_va and addr_va in favor of resources

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2011-07-18 07:57:51 +08:00
Jean-Christophe PLAGNIOL-VILLARD 3230114800 atmel_nand: switch to "struct resource"
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2011-07-18 07:57:50 +08:00
Juergen Kilb 42207a9cbb Improved gpmc_nand driver to show the current eccmode.
Now a 'devinfo gpmc_nand0' shows the current used eccmode
instead of <NULL>.

The function omap_gpmc_eccmode is now called by dev_set_param.

Signed-off-by: Juergen Kilb <J.Kilb@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-06-10 08:58:39 +02:00
Juergen Beisert 46e72ec533 Always initialize oob_poi before writing OOB data
The following patch came across the mtd mailing list today. I thinks its also
valid for barebox (it handles a special corner case, but maybe it can hit us,
too):

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.

This patch changes the code so that oob_poi is always initialised
to 0xFF to make sure no left over data is inadvertently written
back to OOB data.

The comment above is for the linux kernel, but the same is valid for barebox
and CPUs writing the OOB date controlled in software (like the Samsung
S3C2440 does).

Signed-off-by: Adam Thomson <adam.thomson@alcatel-lucent.com>
Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-05-25 21:16:49 +02:00
Jan Weitzel c318b0fad4 ARM: omap4: fix dev_width for omap_enable_hwecc
NAND_BUSWIDTH_16 should result in dev_width = 1 according to the kernel driver
omap_enable_hwecc: dev_width = (chip->options & NAND_BUSWIDTH_16) ? 1 : 0;

Signed-off-by: Jan Weitzel <j.weitzel@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-04-20 08:59:42 +02:00
Sascha Hauer 3ab2b35477 nand omap: handle erased pages correctly in hamming ecc mode
do not throw ecc errors on erased pages.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-04-12 09:54:56 +02:00
Sascha Hauer 4b9544013e nand omap: use xzalloc instead of calloc
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-04-12 09:54:56 +02:00
Sascha Hauer 3bad67dd60 nand omap: use standard debug functions
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-04-12 09:54:56 +02:00
Sascha Hauer f880d7bc87 nand bb: add proper bb remove function
The old way happily removed cdev entries which were no bb dev
at all. Fix this by checking if the given device actually is
a bb device.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-04-12 09:54:56 +02:00
Sascha Hauer e7c06800ee nand bb: switch to cdev operations
The cdev operations are available without the complete file API,
so they are more suitable for internal usage.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-04-12 09:54:56 +02:00
Sascha Hauer 027db60302 nand: move bb handling code to drivers/mtd/nand
It's good to seperate the code which others can use from commands.
This way other users do not depend on the command being compiled in.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-04-12 09:54:56 +02:00
Sascha Hauer 5386d6d77c nand: nand_block_markbad is only used with nand write support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-04-12 09:54:55 +02:00
Sascha Hauer a7cbbaf19a nand omap: turn debug messages into dev_dbg
The information from the probe function is useful for developers
only, so turn them into dev_dbg to safe binary space.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-04-12 09:54:55 +02:00
Sascha Hauer 2053e35f20 nand omap: fix hamming romcode ecc code
This got broken in commit:

6943635 mtd nand omap: make ecc mode runtime configurable

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-04-12 09:54:55 +02:00
Sascha Hauer f800f73cb8 nand: make reading oob optional
The nand oob functions occupy quite some binary space. If not needed,
we can save this space by making this configurable.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-04-11 15:58:22 +02:00
Sascha Hauer 09da8d4bab nand: remove unused nand_util file
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-04-11 12:36:08 +02:00
Sascha Hauer 3efa8f7bed devfs: remove unused struct filep* argument from open/close
the cdev layer is under the file layer, so it should not use
struct filep*.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-04-11 12:36:07 +02:00
Sascha Hauer 62604e6304 ubi: do not use filep
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-04-11 12:36:07 +02:00
Sascha Hauer 8dfebf96d7 Merge branch 'nand-pu' into next 2011-04-06 09:21:56 +02:00
Sascha Hauer 9ba8f95724 Merge branch 'omap-drivers' into next 2011-04-06 09:20:21 +02:00
Sascha Hauer b672f87cc0 nand: make bbt support optional
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-04-04 16:42:19 +02:00
Sascha Hauer a1e9c15260 nand: make vendor/type printout optional
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-04-04 16:42:06 +02:00
Sascha Hauer 8f5b0e497a nand: Make different ecc modes optional
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-04-04 16:41:38 +02:00
Sascha Hauer eb133335e6 nand: Make write support optional
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-04-04 16:41:32 +02:00
Sascha Hauer 779ea89baf nand: factor out nand write support
In order to make it optional later.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-04-04 16:41:17 +02:00
Sascha Hauer c8e395def8 nand: factor out syndrome support to seperate file
In order to make it optional later.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-04-04 16:41:10 +02:00
Sascha Hauer f6647d3c02 nand: factor out software ecc support to seperate file
in order to make it optional later.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-04-04 16:41:00 +02:00
Sascha Hauer 535d444788 nand: Factor out hw ecc support to seperate file
In order make hwecc support optional later.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-04-04 16:40:32 +02:00
Sascha Hauer c27545dda5 nand: do not fall through in nand_scan_tail()
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-04-04 16:40:27 +02:00