9
0
Fork 0
Commit Graph

393 Commits

Author SHA1 Message Date
Wolfram Sang 300c2d3fb3 mtd: nand: mxs: check for errors when resetting ip core
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-10-31 08:36:51 +01:00
Jean-Christophe PLAGNIOL-VILLARD 345299e94c nomadik_nand: switch to named resource
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-10-30 10:24:12 +01:00
Sascha Hauer 0b15ebf165 mtd nand i.MX: fix compilation for unsupported SoC
Add a default case when all if(nfc_is_*) else if()
return false to prevent a compiler warning.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-10-26 08:56:56 +02:00
Sascha Hauer f2513cb8b1 mtd mxs nand: select NAND_BBT
The driver won't compile without it, so select it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-10-26 08:56:48 +02:00
Sascha Hauer bb05186004 mtd: fix mtdraw_write/mtdraw_erase arguments
For the !CONFIG_MTD_WRITE case they still have ulong as offset
argument.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-10-26 08:55:43 +02:00
Wolfram Sang c9a0beb195 mtd: ubi: fix typos in comment of build.c
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-10-25 17:43:11 +02:00
Wolfram Sang aafca5fbd0 mtd: ubi: cdev: fix build warning for 64-bit
Got this when compiling sandbox on a 64-bit system:

drivers/mtd/ubi/cdev.c: In function ‘ubi_volume_cdev_read’:
drivers/mtd/ubi/cdev.c:26:2: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-10-23 09:06:19 +02:00
Jean-Christophe PLAGNIOL-VILLARD 70ecd92d05 nand: atmel add pmecc support
This patch is from linux 3.7-rc1 and adapt to Barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-10-21 10:33:48 +02:00
Sascha Hauer b1b76f6027 ARM i.MX: get rid of imx-regs.h
- remove now unused __REG definitions
- include individual SoC register files instead of imx-regs.h
- move IMX_GPIO_NR to generic.h
- finally remove imx-regs.h

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-10-17 20:22:02 +02:00
Sascha Hauer aaad5cbad7 Merge branch 'for-next/clk' into for-next/imx
Conflicts:
	drivers/net/fec_imx.c
2012-10-17 20:21:46 +02:00
Jean-Christophe PLAGNIOL-VILLARD 006538e7c2 mtd: add parent support
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-10-17 20:16:58 +02:00
Jean-Christophe PLAGNIOL-VILLARD 28d294de70 mtd: register device a pure device
as we do not need to probe them and they have no driver or bus attached

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-10-16 22:46:56 +02:00
Jean-Christophe PLAGNIOL-VILLARD 44a293471a mtd: add dataflash support
from linux 3.6

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-10-15 19:53:43 +02:00
Alexander Aring 461e7d7aef mtd-core: add writesize in MEMGETINFO ioctl
Add writesize in MEMGETINFO ioctl.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-10-13 14:30:50 +02:00
Sascha Hauer a4c8692240 ARM i.MX: Enable clocks in common place
On i.MX we enable all necessary clocks during startup of the clock
controller driver, so we do not need the register hacking in the drivers
anymore.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-10-10 09:47:51 +02:00
Jean-Christophe PLAGNIOL-VILLARD 3c5327e660 switch all platform_bus device/driver registering to platform_driver/device_register
now register_driver and register_device are for bus only usage.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-10-04 15:19:12 +02:00
Sascha Hauer d1e65d2a7b Merge branch 'for-next/remove-fsf-address'
Conflicts:
	drivers/net/miidev.c
	include/miidev.h
2012-10-03 21:12:48 +02:00
Sascha Hauer a3cd9a7ebe Merge branch 'for-next/mtd' 2012-10-03 21:11:06 +02:00
Sascha Hauer bf3b7c6a8f mtd mtdraw: fix fixing partial page read
toread is unitialized. We have to use count instead.

| commit 992c291e95
| Author: Sascha Hauer <s.hauer@pengutronix.de>
| Date:   Sat Sep 15 16:54:47 2012 +0200
|
|    mtd mtdraw: Fix partial page read
|
|    When reading parts of a page we have to limit the maximum bytes copied
|    to the remaining bytes of a page.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-09-20 09:01:03 +02:00
Sascha Hauer 77322aa896 Treewide: remove address of the Free Software Foundation
The FSF address has changed in the past. Instead of updating it
each time the address changes, just drop it completely treewide.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-09-17 10:57:41 +02:00
Sascha Hauer 992c291e95 mtd mtdraw: Fix partial page read
When reading parts of a page we have to limit the maximum bytes copied
to the remaining bytes of a page.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>
2012-09-16 22:09:36 +02:00
Marcus Folkesson 7d4d295d4e mtd: nand: extend NAND flash detection to new MLC chips
Some of the newer MLC devices have a 6-byte ID sequence in which
several field definitions differ from older chips in a manner that is
not backward compatible.

This method is already used in the Linux Kernel.

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-09-16 09:55:58 +02:00
Jan Luebbe 0223c3a149 mtd/mtdraw: fix format specifier for ssize_t
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-09-07 12:23:41 +02:00
Jan Luebbe d17aed1a07 mtd: use correct format specifier
For the size_t type the format specifier %zu or %zx must be used.
See Documentation/printk-formats.txt in the kernel for details.

Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-09-07 12:23:26 +02:00
Sascha Hauer bed1a6ffab Merge branch 'for-next/pbl' 2012-09-05 12:59:29 +02:00
Sascha Hauer b40aeb00d3 Merge branch 'for-next/omap' 2012-09-05 12:59:29 +02:00
Alexander Aring 83f311a9bb mtd: add private data to mtddev-hook
The mtdoob and mtdraw device don't clean up correctly.
Added a private data element to hold allocated memory.
Fix remove of mtdoob and mtdraw device.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-09-03 11:06:01 +02:00
Alexander Aring 06e5a6a5ca mtd: fix compiler warnings
Fix some compiler warnings.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-09-03 11:06:01 +02:00
Sascha Hauer 95423f8af2 ARM boards: Make boards pbl safe
With pbl support enabled most boards need a pbl-y for their lowlevel
stuff.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-08-12 22:23:22 +02:00
Sascha Hauer 6478566b2d ARM s3c boards: Do not hardcode image sizes
The existing nand_boot functions all do the same, so move it to
a common place. To be flexible enough for future boards the real
image size is used instead of hardcoded 256k.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Juergen Beisert <jbe@pengutronix.de>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-08-12 22:23:12 +02:00
Sascha Hauer cf63079a2b mtd OMAP NAND: implement buswidth autodetection support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-08-03 19:32:07 +02:00
Sascha Hauer 85f4fe32cf mtd nand: implement buswidth detection
This introduces a new NAND_BUSWIDTH_AUTO flag which can be used
to automatically detect the nand buswidth. The id is always read
in 8bit mode. An additional callback is needed to switch the nand
controller into 16bit mode.
This currently depends on a safe read_byte (always) and read_buf
(for onfi-only flashes) callback. It has been tested on OMAP, but
is not something that generally works. For this reason the existence
of the set_buswidth callback is used to determine whether we are
able to do autodetection or not.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-08-03 19:32:07 +02:00
Sascha Hauer 5a693051df mtd OMAP NAND: Use prefetch engine
Use the prefetch engine to improve NAND performance. The howto
is derived from the Kernel. Unlike the kernel we do not make
the access mode configurable.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-08-03 19:32:07 +02:00
Sascha Hauer ee5a0fcded mtd OMAP NAND: Fix dev_ready handling
- dev_ready is supposed to return whether the device is ready or
  not, not to poll until the device is ready.
- dev_ready should return true for ready and false for not ready
- waitpin polarity is not needed (at least the kernel does not have it)
- wait_mon_mask must be 32bit.

The code was unused since no board specified a wait pin, so no breakage
included. This also removes the now unused timeout variable from
platformdata.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-08-02 12:00:51 +02:00
Sascha Hauer eebc8e41a0 Merge branch 'for-next/ubi' 2012-08-01 17:50:22 +02:00
Sascha Hauer 88107f6e12 Merge branch 'for-next/randconfig' 2012-08-01 17:49:27 +02:00
Sascha Hauer b1a4e722c3 Merge branch 'for-next/onfi' 2012-08-01 17:49:27 +02:00
Sascha Hauer bdb8494e85 ubi: align ubi writes to LEB size
Otherwise incomplete LEBs are not written.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-07-31 21:44:19 +02:00
Sascha Hauer 44ca597927 ubi: cdev->write has to return the bytes read, not 0
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-07-31 21:44:12 +02:00
Sascha Hauer babb73da91 UBI: select crc32 support
UBI needs this.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-07-25 09:27:28 +02:00
Sascha Hauer ea0dc13e8f mtd: scan_write_bbt is only needed with mtd write support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-07-25 09:27:28 +02:00
Sascha Hauer 2f1d3b49d1 mtd omap: add prefix to omap specific decode_bch function
So that it does not collide with our generic decode_bch function.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-07-25 09:27:28 +02:00
Sascha Hauer 1145c2fb1e mtd: remove dead disk-on-chip support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-07-25 09:27:28 +02:00
Sascha Hauer 8e06d575ed mtd nand: Fix compilation without bbt support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-07-25 09:27:27 +02:00
Juergen Beisert b47220d7f7 NAND/Samsung: remove a leftover from architeture clean ups
Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
2012-07-20 08:41:35 +02:00
Jan Luebbe c410817f19 mtd: fix 'write: Invalid argument' while writing to nand-bb devices
The 'off_t cur_ofs' variable was missed during the 64 bit conversion.
For the MEMGETBADBLOCK ioctl, a pointer to a loff_t is needed.

Also adjust the debug format strings.

Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-07-16 11:08:47 +02:00
Sascha Hauer 4987f61ee2 mtd: fix bad block ioctls
Since this commit we interpret the argument to the bad block ioctls
as a pointer to a 64bit number:

|commit e71c343668
|Author: Sascha Hauer <s.hauer@pengutronix.de>
|Date:   Fri Oct 14 11:57:55 2011 +0200
|
|    mtd: fix arguments to bad block ioctls
|
|    In the Kernel the mtd ioctls expect a pointer to the offset, whereas
|    barebox interprets the pointer itself as an offset. Since we want
|    to add 64bit support for file sizes a pointer may not be sufficient,
|    so align with the kernel and convert it to a pointer to the offset.
|
|    Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>

This missed some places, fix them aswell.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-07-10 19:07:33 +02:00
Eric Bénard 632c457950 nand_imx: update to support onfi & 4k flashs
- add CMD_PARAM and read_param to get the ONFI structure
- fix OOB size for flash with 224 OOB on i.MX51/3
- add the same ecc layout as the one in the kernel for
  4k page flashs

Tested on an i.MX53.

Signed-off-by: Eric Bénard <eric@eukrea.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-07-05 20:58:54 +02:00
Eric Bénard 4b23222c4d nand_base: add ONFI flash detection
the code is taken from linux & u-boot implementations
Validated on an i.MX53 which gives the following log :
ONFI flash detected ... ONFI param page 0 valid
NAND device: Manufacturer ID: 0x2c, Chip ID: 0x38 (Micron MT29F8G08ABABAWP), page size: 4096, OOB size: 224

Signed-off-by: Eric Bénard <eric@eukrea.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-07-05 20:58:54 +02:00
Sascha Hauer d04ce5dfe7 Merge branch 'for-next/mxs-nand'
Conflicts:
	arch/arm/mach-mxs/Kconfig
	arch/arm/mach-mxs/Makefile
	drivers/Makefile
2012-07-02 11:08:03 +02:00
Sascha Hauer f22d4e2778 Merge branch 'for-next/sparse' 2012-07-02 10:59:37 +02:00
Sascha Hauer 27c5d37ecc define __user empty
There is no seperate user address space, so do not generate sparse
warnings for this.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-06-30 22:34:54 +02:00
Sascha Hauer 3e503822c7 use loff_t for file offsets
This is a first step for 64bit file support: Make the file sizes/offsets
64bit.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-06-30 16:53:24 +02:00
Sascha Hauer e71c343668 mtd: fix arguments to bad block ioctls
In the Kernel the mtd ioctls expect a pointer to the offset, whereas
barebox interprets the pointer itself as an offset. Since we want
to add 64bit support for file sizes a pointer may not be sufficient,
so align with the kernel and convert it to a pointer to the offset.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-06-30 16:53:16 +02:00
Wolfram Sang eb76c8e827 mtd nand: add mxs-nand driver
Based on the U-Boot version. Changed to kernel style register layout, added
MX23 support (WIP!), made MMU aware and adapted to barebox.

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2012-06-30 12:53:36 +02:00
Alexey Galakhov 5ef3ecd922 Make S3C24xx config options available for all S3Cs
Signed-off-by: Alexey Galakhov <agalakhov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-05-21 21:58:26 +02:00
Antony Pavlov f9b932fed9 fix typo funtion -> function
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-05-13 22:00:54 +02:00
Sascha Hauer 3170433558 Merge branch 'master' into next 2012-04-17 22:05:37 +02:00
Robert Jarzmik 1d79f322f7 mtd: docg3 fixes backport from Linux kernel
Backport 2 fixes back from Linux kernel (title verbatim from
Linux kernel log) :
 - docg3 fix in-middle of blocks reads
 - docg3 reduce read alignment burden

These 2 enable partial reads from the MTD (ie. read only the
111 first bytes), which enable linux kernel booting or UBIFS
from barebox.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-04-17 22:02:54 +02:00
Sascha Hauer abe4560c8a Use DEVICE_ID_DYNAMIC where applicable
We now have DEVICE_ID_DYNAMIC for dynamic allocation of device ids,
Use it where applicable.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-04-16 09:43:02 +02:00
Sascha Hauer 2a6460cbb6 Merge branch 'next' 2012-04-05 11:09:58 +02:00
Sascha Hauer 6838fedc76 mtd: fix compiler warning
Fixes:

drivers/mtd/core.c: In function 'mtd_ioctl':
drivers/mtd/core.c:122:24: warning: unused variable 'ecc' [-Wunused-variable]

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-04-05 08:48:13 +02:00
Jean-Christophe PLAGNIOL-VILLARD b5b7ae246d atmel_nand: add on_flash_btt option to enable bbt option
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-04-02 10:31:23 +02:00
Robert Jarzmik 65acd3391d drivers/mtd: improve docg3 write speed
When programming or erasing a page, don't wait
systematically for 3s, but finish the operation as soon as
the hardware has finished, and timeout if 3 seconds have
passed.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-03-13 13:25:07 +01:00
Sascha Hauer 33d1cc4bf2 commands: remove struct command pointer from commands
This is unused in all commands and thus can be removed.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-02-27 20:28:07 +01:00
Sascha Hauer 037cf6e80b Merge branch 'next' 2012-02-07 13:54:14 +01:00
Robert Jarzmik c3a992fdc7 drivers/mtd: fix docg3 write support
Fix typo error in MTD_WRITE defines.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-01-27 12:24:04 +01:00
Robert Jarzmik 93125fda04 drivers/mtd: fix mtdraw write support
When unaligned writes are used, typically doing a cp file /dev/mtdraw0.foo,
the alignement correction code was incorrectly handling such cases, and
didn't return the expected number of written bytes.

This was tested on a 528 block size.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-01-27 12:24:04 +01:00
Jean-Christophe PLAGNIOL-VILLARD 2c9bc534ce Revert "mtd omap nand: fix driver without CONFIG_PARAMETER"
This reverts commit 7762f9627a.

already applied by d002818ae3

    fix gpmc_nand_probe without param support

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-01-19 09:44:50 +01:00
Sascha Hauer 7762f9627a mtd omap nand: fix driver without CONFIG_PARAMETER
With CONFIG_PARAMETER unset the driver never calls omap_gpmc_eccmode.
Fix it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-01-17 18:51:04 +01:00
Jean-Christophe PLAGNIOL-VILLARD 2610b2a987 atmel_nand: disable hardware ecc if not enable
allow to save 1360 bytes

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-01-17 18:48:40 +01:00
Jan Weitzel d002818ae3 fix gpmc_nand_probe without param support
commit 30de24d79fc6e659d0070f6e863ae0e53567ba0e param: add config to disable it
removes param support for xloader configurations. Set param eccmode calls
omap_gpmc_eccmode and so nand_scan_tail. So nand fails without param support

Call omap_gpmc_eccmode directly if CONFIG_PARAMETER is not enabled
to fix that.

Signed-off-by: Jan Weitzel <j.weitzel@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-01-16 11:33:22 +01:00
Sascha Hauer 8742816771 Merge branch 'pu/jean-codesize' into next 2012-01-13 09:33:36 +01:00
Jean-Christophe PLAGNIOL-VILLARD 971d164f62 param: add config to disable it
this will allow to save 992 Bytes for TI xlaoder or AT91 bootstrap

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-01-11 21:22:34 +08:00
Alexander Aring 364c3aadfd ioctl: add support for ECCGETSTATS and MEMGETREGIONINFO
Support added for ioctl of ECCGETSTATS and MEMGETREGIONINFO.

Fix default handling in core.c to return -EINVAL, if request
was unknown.

Signed-off-by: Alexander Aring <a.aring@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-01-06 09:49:37 +01:00
Alexander Aring 7017838be5 nand_omap_gpmc: fix return value
Fix return value, to notify if ecc
correction appeared.

Signed-off-by: Alexander Aring <a.aring@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-01-05 10:31:24 +01:00
Sascha Hauer 0d22025084 Merge branch 'next' 2012-01-05 10:25:17 +01:00
Juergen Beisert f012c5297e MTD/NAND/S3C: re-add change due to API change
Commit 88ce7ef769 has changed the API and commit
b29b8f43d5 has moved the S3C24xx NAND driver
file. With the move the API change in the S3C24xx NAND driver was lost.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-01-03 10:13:13 +01:00
Juergen Beisert 6bee6defaa MTD/NAND/DOC: add forgotten change due to API change
Commit 88ce7ef769 introduces an additional
parameter to the function add_mtd_device(). It seems one of the callers was
left.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-01-03 10:13:13 +01:00
Sascha Hauer e448b8fc5e mtd Kconfig: only select NAND_READ_OOB when NAND is enabled
To get rid of:

(MTD_OOB_DEVICE && MTD_RAW_DEVICE) selects NAND_READ_OOB which has unmet direct dependencies (MTD && NAND)

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-01-02 14:53:17 +01:00
Juergen Beisert b29b8f43d5 MACH SAMSUNG/S3C: Use the correct CPU family name to reflect NAND driver's usage
The aready existing NAND controller driver in Barebox is for the S3C24XX family
only. Change the name of the file to reflect this fact (and free the way to add
more recent Samsung NAND controllers)

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-01-02 13:32:13 +01:00
Juergen Beisert cbc08bfb42 MACH SAMSUNG/S3C: Make it more generic for future updates
Start with renaming files to share them in the S3C CPU family,

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-01-02 13:32:13 +01:00
Steve Schefter 28f0de6e5f nand_omap_bch_decoder: Fix up error detection
Bit errors in the ECC itself are not beeing taken into account.
In this cases the number of detected errors != number of corrected errors and
chien search returns an error.
This patch adds detection of bit errors in the ECC.

Signed-off-by: Steve Schefter <steve@scheftech.com>
Signed-off-by: Teresa Gámez <t.gamez@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-01-02 12:44:55 +01:00
Robert Jarzmik 6bef2778f1 drivers/mtd: add docg3 chip
Add the MSystem disk-on-chip G3 support, taken from the
linux kernel with few amendments to bring it into barebox.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-01-02 12:34:58 +01:00
Jean-Christophe PLAGNIOL-VILLARD 5524cd966b atmel_nand: drop dead code
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-01-02 12:08:24 +01:00
Jean-Christophe PLAGNIOL-VILLARD 809f0f6327 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: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-01-02 12:08:24 +01:00
Jean-Christophe PLAGNIOL-VILLARD 7caf8009cc mtd/core.c: fix MTDPGALG
introduced in commit f76ad819e4
drivers/mtd: cosmetic changes

it's supposed to the invert of the writesize - 1

Cc: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-01-02 11:47:49 +01:00
Robert Jarzmik fb44dd696e drivers/mtd: add the mtdraw device (data+oob)
Add a device to read and write to MTD data and oob
(/dev/mtdraw<N>).

The device is constrained in a separate source file, so that
further improvement of commands (such as nandwrite) could
make it useless, and easy to remove.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-12-22 10:11:11 +01:00
Robert Jarzmik 6473b28065 drivers/mtd: split mtd mtdoob devices
Split /dev/mtd and /dev/mtdoob devices.
Remove from mtd structure the mtdoob character device.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-12-22 10:11:11 +01:00
Robert Jarzmik c6c880ecdb drivers/mtd: add mtd core hooks
Add hooks for spinoff MTD drivers (mtdoob, mtdraw, ...).

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-12-22 10:11:11 +01:00
Robert Jarzmik d29b112f68 drivers/mtd: fix core multiple MTD registrations
If multiple MTD devices were registered, an exception
occured, as they all wanted id 0. Let the driver code choose
the device number dynamically.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-12-22 10:11:11 +01:00
Robert Jarzmik 88ce7ef769 drivers/mtd: transfer NAND notions to MTD core
Change NAND_WRITE into MTD_WRITE.
Change "page_shift" references in the core, which are purely
NAND, into mtd->writesize which is MTD generic.
Rename all "info" (struct mtd_info) into "mtd".

Also provide a parameter to add_mtd_device() so that legacy
nand devices still appear as nand<N>.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-12-22 10:11:11 +01:00
Robert Jarzmik f76ad819e4 drivers/mtd: cosmetic changes
Fix whitespace, replace all debug() by dev_dbg(), and fix
line length to 80 characters.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-12-22 10:11:11 +01:00
Robert Jarzmik 8ccde79470 drivers/mtd: move nand.c into core.c
Move nand core into the global MTD core.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-12-22 10:11:11 +01:00
Sascha Hauer 1528db0314 Merge branch 'master' into next 2011-12-19 12:06:55 +01:00
Sascha Hauer 790266c24d mtd nand: fix oob compile time option
The NAND_READ_OOB Kconfig option is used to

a) creating a cdev for reading OOB data
b) compiling in mtd->read_oob support

The former was intended and that's also what the Kconfig help
says. The latter though was implicit and wrong. mtd->read_oob
is also used by the bbt code which resulted in a NULL pointer
deref when compiled with BBT but without NAND_READ_OOB.
To fix this, split the option into two. The now invisible
option NAND_OOB_DEVICE is only responsible for b) and gets
selected when necessary.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-12-19 12:06:49 +01:00
Sascha Hauer 597ce4cc1c nand-bb: implement lseek in readonly mode
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Reviewed-by: Robert Jarzmik <robert.jarzmik@free.fr>
2011-12-15 19:55:11 +01:00
Sascha Hauer 4ecd0003ac cdev: pass flags to open function
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-12-15 11:46:50 +01:00
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
Sascha Hauer 82aa50a413 nand: remove unneeded nand_[get|release]_device functions
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-04-04 16:40:22 +02:00
Sascha Hauer 2e6a9440b9 nand: remove unused suspend/resume functions
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-04-04 16:40:16 +02:00
Sascha Hauer 6e7eba2c61 mtd nand omap: Add BCH ecc support
This patch adds BCH ecc support to the omap nand driver. The BCH
error correction allows for up to 8 bit error correction. It is
also needed for booting from nand on omap4.

This is based on code from Sukumar Ghorai <s-ghorai@ti.com>:

[PATCH] omap3: nand: bch ecc support added

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-04-04 15:28:49 +02:00
Sascha Hauer 694363574e mtd nand omap: make ecc mode runtime configurable
On omap we use different ecc modes for different purposes. The initial
boot code has to be written with hardware ecc whereas Linux usually uses
software ecc. To be able to write in both modes with a sinlge barebox
image introduce a eccmode device parameter.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-04-04 15:28:49 +02:00
Sascha Hauer 2a1db7330a mtd nand omap: Pass ecc mode from platform
As we will get more ecc modes pass through the exact mode from
the platform, not only a flag.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-04-04 15:28:49 +02:00
Sascha Hauer 819f416b86 omap: rename GPMC Kconfig entry to OMAP_GPMC
Give this omap specific entry an omap namespace. Also, remove
unnecessary dependency to omap2/3 in nand Kconfig.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-04-04 15:10:16 +02:00
Sascha Hauer 691dd27f7a Merge branch 'next' 2011-04-04 14:53:08 +02:00
Baruch Siach 79c78016c1 mtd/nand_imx: fix read past buffer end
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-03-18 08:30:05 +01:00
Baruch Siach 4b4958dbb7 mtd/nand_imx: add support for page size of 4k
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-03-18 08:29:31 +01:00
Juergen Beisert ef552262ab S3C24xx/NFC: Add OOB/ECC handling documentation for different NANDs
Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-03-14 12:11:19 +01:00
Juergen Beisert b31dd110aa S3C24xx/NFC: Setup ECC handling in accordance to the kernel
Do the same ECC handling and ECC size in barebox than the kernel does.
Currently its done for S3C2440 based systems only, as I have no idea how to
manage it on a S3C2410 based system.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-03-14 12:11:19 +01:00
Juergen Beisert e0965c4d56 S3C24xx/NFC: Consider correct NAND page size for boot.
When booting from NAND, its important to know the correct page size. When
the NAND is used as the boot source, four dedicated pins are used to configure
the correct page size and address cycles. These pins can be read back in one
of the NFC registers to parametrize the load function.

This patch also extends the read routine to support more than four address
cycles on demand.

BTW: At least some mini2440s are misconfigured to use five address cycles for
a NAND device that is known to need only four address cycles. In this case the
vendor is at our side: This NAND simply ignores any additional address cycles
than required.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-03-14 12:11:19 +01:00
Juergen Beisert a1dd9be4d1 S3C24xx/NFC: Remove double function setup
Three lines above this setting is already done.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-03-14 12:11:19 +01:00
Juergen Beisert e9b3179177 S3C24xx/NFC: Remove dead code
Something was to be done here. But I do not remember what. As it works also
without it, remove this dead code.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-03-14 12:11:19 +01:00
Juergen Beisert 1b1eca6b06 S3C24xx/NFC: Re-enable the controller after NAND boot test
After running the 'nand_boot_test' command, any usage of the NAND fails with
a IO error. This happens due to the load routine disables the NAND controller
after loading the image.

This patch re-enables the NAND controller again after running the test.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-03-14 12:11:19 +01:00
Sascha Hauer 5fb8333d34 ARM i.MX: cleanup boot modes
The i.MX Processors support two different boot modes, the internal
boot mode and the external boot mode. Traditionally the external
NAND boot mode is handled in drivers/mtd/nand and the internal
boot mode is handled in arch/arm/mach-imx. This patch consolidates
the handling of both boot modes in arch/arm/mach-imx so that
the user does not have to look in the mtd kconfig section for
booting from NAND. Also, selecting between internal and external
boot mode now is a clear choice.
The external NAND boot mode has been independent of the mtd nand
driver, but as the code was contained in the NAND driver it was
not possible to support booting from NAND without a mtd nand driver.
This is changed with this patch.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-03-03 16:15:57 +01:00
Juergen Beisert e5902f61fc MACH-S3C2440: Speed up NAND controller for this CPU
The S3C2440 provides 32 bit access to the NAND's data. Add specific read
routines to speed up data reading and writing.

These routines are stolen from the Linux kernel.

Signed-off-by: Juergen Beisert <juergen@kreuzholzen.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-03-03 16:15:53 +01:00
Juergen Beisert c3f4e1d6cb MACH-S3C2440: Fix NAND controller for this CPU
There are a few but important differences in S3C2410 and S3C2440. This patch
fixes them for the S3C2440 CPU.

Signed-off-by: Juergen Beisert <juergen@kreuzholzen.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-03-03 16:15:53 +01:00
Juergen Beisert 073f39c95e MACH-S3C24XX: Add support for flash based BBT
The default configuration of the current 2.6.37 kernel uses a flash based BBT.
So, barebox must also use one, to be in sync with the kernel about bad blocks
in the flash.

Due to the used OOB layout, the generic BBT description coming with the
framework can be used.

Signed-off-by: Juergen Beisert <juergen@kreuzholzen.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-03-03 16:15:52 +01:00
Sascha Hauer 2a23cedfe1 cdev: fix printf compiler warnings
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-01-07 10:38:03 +01:00
Sanjeev Premi d4b8e67fcd nand: Fix warnings due to incompatible format strings
This patch fixes warnings due to incompatible format strings
specified in the printf().

Signed-off-by: Sanjeev Premi <premi@ti.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-01-07 10:34:27 +01:00
Marek Belisko 5c495ce5e5 nand_s3c2410: Fix sparse warnings.
Patch fix following sparse warnings:
drivers/mtd/nand/nand_s3c2410.c:125:9:
warning: incorrect type in argument 1 (different base types)
	expected void const volatile [noderef] <asn:2>*<noident>
	got unsigned long

Signed-off-by: Marek Belisko <marek.belisko@open-nandra.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-11-19 09:35:09 +01:00
Sascha Hauer ce15c024c1 imx nand: Add v3 (i.MX51) support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-11-12 08:08:02 +01:00
Sascha Hauer 691bff0062 imx nand: introduce overwritable check_int function
needed for v3 support later.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-11-12 08:08:02 +01:00
Sascha Hauer 5fcca46544 imx nand: move initialization to preset function
This has two purposes. First we need to factor out initialization
to be able to do something different on v3 type controllers,
second with this patch we are independent of preinitialized register
values.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-11-12 08:08:02 +01:00
Sascha Hauer da1ad19c4c mxc_nand: fix correct_data function
The v2 controller has a totally different mechanism to check
whether the data we read had ecc errors or not. Implement this.
The mechanism in the v2 controller happens to be identical to
the v3 controller.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-11-12 08:08:02 +01:00
Sascha Hauer 87ccd2d109 imx nand: add V1_V2 namespace to registers
This prepares the driver for v3 support. The v3 controller
has a completely different register layout, so add a V1_V2_
namespace to the register defines to avoid confusion with
the v3 regs.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-11-12 08:08:02 +01:00
Sascha Hauer 22180f96b1 imx nand: do not read-modify-write SPAS register
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-11-12 08:08:01 +01:00
Sascha Hauer a0fc5252a7 imx_nand: make some internally used functions overwriteable
This patch prepares the driver to add v3 controller support
later. The v3 controller is basically the same controller as v1
and v2, but with a completely different register layout.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-11-12 08:08:01 +01:00
Sascha Hauer 2cb2a68b92 imx nand: remove unnecessary register write
NFC_SP_EN is cleared in probe and never set again, so we do not
need to clear it in other functions again.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-11-12 08:08:01 +01:00
Sascha Hauer bb81ff75d4 imx_nand: rework get_dev_status
We save/restore the value in the buffer anyway, so it makes
no difference whether we use main_area0 or main_area1. So,
we can use main_area0 and remove main_area1 from the driver
which is otherwise unused. Also, clean up the comments in
get_dev_status.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-11-12 08:08:01 +01:00
Sascha Hauer dd62a0c2d1 imx_nand: remove 0xe00 offset from registers
Add the offset to the register base instead. This is done
in preparation for v3 controller support.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-11-12 08:08:01 +01:00
Sascha Hauer 31ecd16695 NAND: reset chips before usage like the kernel does
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-11-12 08:08:01 +01:00
Sascha Hauer fe02628658 i.MX nand: optimize nand boot code for size
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-10-22 19:30:25 +02:00
Jean-Christophe PLAGNIOL-VILLARD eaa223e795 module: move EXPORT_SYMBOL_GPL define to module.h
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-08-30 14:36:09 +02:00
Michael Grzeschik 0d8d93d7c6 omap: nand remove unnecessary condition
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-08-18 08:43:57 +02:00
Michael Grzeschik 6937c91935 omap nand: bugfix configure ecc order
This repairs a bug which came with patch "0cb00c1 omap nand: cleanup"
We first have to set ecc.layout before we can use it and should
do the nand_scan_tail after we set the ecc.mode.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-08-06 19:18:59 +02:00
Jean-Christophe PLAGNIOL-VILLARD 7192259daa nand: driver for Nomadik 8815 SoC
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: Andrea GALLO <andrea.gallo@stericsson.com>
Cc: Gael SALLES <gael.salles@stericsson.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-08-06 19:09:39 +02:00
Sascha Hauer 139ec08127 Merge branch 'next' 2010-08-03 09:31:38 +02:00
Sascha Hauer b8063f72f0 atmel_nand: fix comment where this code is derived from
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-07-23 08:37:47 +02:00
Sascha Hauer 6ffe2ec8cd Merge remote branch 'origin/omap' into next 2010-07-12 08:22:03 +02:00
Sascha Hauer e0677920d6 barebox ubi changes
This adds the layer between barebox and UBI.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-07-05 15:07:14 +02:00
Sascha Hauer 8dbed40da9 add ubi support from u-boot. Just enough to compile and scan
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-07-05 15:07:14 +02:00
Sascha Hauer acc46ca4f0 add partition mtd support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-07-05 13:00:02 +02:00
Sascha Hauer b332d8565d move drivers/nand to drivers/mtd/nand
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-07-05 13:00:01 +02:00