9
0
Fork 0
Commit Graph

300 Commits

Author SHA1 Message Date
Sascha Hauer 50f75a1a0e UBI: reimport UBI from Linux v3.10
This is a fresh UBI import from Linux v3.10

This is done mainly to get fastmap support.

This was tested with the i.MX nand driver, the MXS nand driver and
on CFI NOR flash.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-25 10:24:16 +02:00
Sascha Hauer 10f7528afb UBI: remove old ubi support
To update to the latest UBI support from the Kernel first remove
the old UBI support. Without it the update will be even less reviewable.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-24 07:17:01 +02:00
Sascha Hauer 5e282091d6 mtd: nand: mxs-nand: Add on flash bbt support
For DT only at the moment.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-23 16:25:14 +02:00
Sascha Hauer 0f15dee78f mtd: nand: mxs-nand: Add i.MX6 support
The i.MX6 uses the same GPMI NAND controller as i.MX23/28 do. This adds
i.MX6 support to the driver.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-23 16:25:14 +02:00
Sascha Hauer a4f58f5665 mtd: nand: gpmi: cleanup includes
remove unused includes and use <io.h> instead of <asm/io.h>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-23 16:25:14 +02:00
Sascha Hauer 12d2062d5c mtd: nand: gpmi: replace MXS_BCH_BASE with driver resources
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-23 16:25:14 +02:00
Sascha Hauer 13968e43b7 mtd: nand: gpmi: use io_base instead of MXS_GPMI_BASE
we have io_base, so use it instead of hardcoded base
address.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-23 16:25:14 +02:00
Sascha Hauer 5cd4fd8fba dma: apbh: Turn into a driver
This converts the apbh driver into a real driver.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-23 16:25:14 +02:00
Sascha Hauer 3d75e777af dma: apbh-dma: move header file to common location
As the apbh dma engine is also found on i.MX6 move the header file
out of MXS specific directories.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-23 16:25:13 +02:00
Sascha Hauer ca13a84ac2 ARM: MXS: introduce stmp device support
MXS specific devices have some common infrastructure in the kernel
known as STMP devices. We have the same in barebox, but with a
mxs_ prefix instead of a stmp_ prefix. As some STMP devices are
also found on i.MX6 move the common infrastructure out of MXS
specific files and use the stmp_ prefix.

This is done in preparation for i.MX6 NAND support.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-23 16:25:13 +02:00
Sascha Hauer 66891566cc mtd: nand: update to v3.11-rc1
This updates the NAND stuff to Linux-3.11-rc1. It is synchronized
as best as we can get:

- locks removed
- The splitting in different files we had to better support different
  features has been dropped. Instead this is now done mostly with the
  use of __maybe_unused

Some barebox adjustments are forward ported, like:

- Allow partial page writes
- Optionally allow to erase bad blocks
- check for all_ff before writing a page

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-23 16:25:13 +02:00
Sascha Hauer 69f3d6c93b mtd: introduce mtd_read_oob and mtd_write_oob
Directly copied from the Kernel as of 3.11-rc1

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-22 16:14:16 +02:00
Sascha Hauer d155610821 mtd: introduce ecc strength
This introduces the ecc stength fields in the structures and fills
them in, but leaves them unused right now.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-22 16:14:08 +02:00
Sascha Hauer e3885851b7 mtd: rename mtd_read_oob
There is the same function name in the Kernel but with different
semantics. Rename to avoid naming conflicts when we update the
mtd support from the kernel.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-22 16:14:03 +02:00
Sascha Hauer 8dbf2821e9 mtd: rename MTD_OOB_* to MTD_OPS_*
To sync with the Linux kernel.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-22 16:13:49 +02:00
Sascha Hauer 278c16713a mtd: nand: write BBM to OOB even with flash-based BBT
This is based on Linux:

commit e2414f4c20bd4dc62186fbfd7bdec50bce6d2ead
Author: Brian Norris <computersforpeace@gmail.com>
Date:   Mon Feb 6 13:44:00 2012 -0800

Currently, the flash-based BBT implementation writes bad block data only
to its flash-based table and not to the OOB marker area. Then, as new bad
blocks are marked over time, the OOB markers become incomplete and the
flash-based table becomes the only source of current bad block
information. This becomes an obvious problem when, for example:

 * code accessing the flash cannot read the flash-based BBT format
 * BBT is corrupted and the flash must be rescanned for bad
   blocks; we want to remember bad blocks that were marked from Linux

So to keep the bad block markers in sync with the flash-based BBT, this
patch changes the default so that we write bad block markers to the proper
OOB area on each block in addition to flash-based BBT. Comments are
updated, expanded, and/or relocated as necessary.

The new flash-based BBT procedure for marking bad blocks:
 (1) erase the affected block, to allow OOB marker to be written cleanly
 (2) update in-memory BBT
 (3) write bad block marker to OOB area of affected block
 (4) update flash-based BBT
Note that we retain the first error encountered in (3) or (4), finish the
procedures, and dump the error in the end.

This should handle power cuts gracefully enough. (1) and (2) are mostly
harmless (note that (1) will not erase an already-recognized bad block).
The OOB and BBT may be "out of sync" if we experience power loss bewteen
(3) and (4), but we can reasonably expect that on next boot, subsequent
I/O operations will discover that the block should be marked bad again,
thus re-syncing the OOB and BBT.

Note that this is a change from the previous default flash-based BBT
behavior.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-22 16:13:44 +02:00
Sascha Hauer 4a98bf1a0b mtd: nand_imx: Add devicetree probe support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-19 08:59:47 +02:00
Jan Luebbe a1c79b1bd1 nand_base: add missing newline
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-09 19:49:41 +02:00
Sascha Hauer b83536bdb9 Merge branch 'for-next/mxs' 2013-07-01 10:14:40 +02:00
Sascha Hauer ae0589c5ef Merge branch 'for-next/mtd' 2013-07-01 09:37:38 +02:00
Sascha Hauer 85b427ffed Merge branch 'for-next/misc' 2013-07-01 09:37:37 +02:00
Jan Weitzel 0cbb215519 nand_base: fix chipsize for multi LUN nands
Chipsize didn't take number of LUNs into account. Sync chipsize calculation
to kernel commit 63795755
Tested with MT29F8G16ADBDAH4 on OMAP4

Signed-off-by: Jan Weitzel <j.weitzel@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-06-24 21:45:05 +02:00
Sascha Hauer 10357953f3 mtd: Fix size_t printf format specifier
use 0x%08zx for size_t instead of 0x%08x

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-06-21 08:12:58 +02:00
Sascha Hauer 779caca4e6 mtd: gpmi-nand: switch to clk support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-06-20 08:49:56 +02:00
Sascha Hauer d4d6de78fd mtd: Align erase_op to eraseblock boundaries
Our erase command used to align to eraseblocks when necessary.
This worked well until recently when the m25p80, mtd_dataflash
and cfi flash were added / converted to mtd. This patch aligns
the input to the erase fileoperation to eraseblock boundaries.
Also tested with non uniform flashes with multiple eraseregions.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-06-06 16:17:05 +02:00
Sascha Hauer 8f9044927d Merge branch 'for-next/mci'
Conflicts:
	include/driver.h
2013-06-02 16:28:21 +02:00
Sascha Hauer 064fdcec9f Merge branch 'for-next/imx-oftree'
Conflicts:
	arch/arm/boards/freescale-mx51-pdk/board.c
2013-06-02 12:36:38 +02:00
Sascha Hauer b5a0a65cb5 mtd: m25p80: add devicetree support
Until we have spi device_id support match to "m25p80" for now.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-31 08:33:37 +02:00
Sascha Hauer 73b0d228e5 driver: Attach info callback to device, not to driver
Since the info is device specific and not driver specific, attach
the callback to the device. This makes it possible to have a info
callback for a device which does not have a driver attached.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-30 12:18:27 +02:00
Sascha Hauer 0d7ac7c381 mtd: call mtd_erase with complete area if possible
If a device does not have bad blocks loop over the eraseblocks
in the driver instead of the core. This allows the mtd_dataflash
driver to erase blocks instead of pages to gain more speed during
erasing. Also the mtd_dataflash driver modifies the erase_info
struct which causes the outer loop in the core to never end.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-27 18:25:41 +02:00
Sascha Hauer ecceaac8e7 cfi: make hardware device parent of mtd device
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-27 18:25:03 +02:00
Sascha Hauer 736f711917 cfi: Add dev * to flash_info and switch to dev_*
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-27 18:24:59 +02:00
Sascha Hauer 6d7cd20442 cfi: remove unused field from struct flash_info
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-27 18:24:53 +02:00
Oleksij Rempel 24b9ea6e75 cfi_flash: size_ratio should not be 0
We will get size = 0 if size_ratio = 0

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-27 18:24:05 +02:00
Oleksij Rempel fbf9d87633 cfi_flash: add shift option for some cfi memory chips
Many cfi chips support 16 and 8 bit modes. Most important
difference is use of so called "Q15/A-1" pin. In 16bit mode this
pin is used for data IO. In 8bit mode, it is an address input
which add one more least significant bit (LSB). In this case
we should shift all adresses by one:
For example 0xaa << 1 = 0x154

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-27 18:23:55 +02:00
Sascha Hauer 4cbec978bc mtd: dataflash: Add devicetree probing support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-21 09:35:25 +02:00
Eric Bénard ae6f751117 nand_base: sync flash detection functions with linux 3.9's code
this fix the problems introduced when detecting non ONFI flashes in
commit 4c2bdc8728
"nand_base: detect more ONFI flash"

Signed-off-by: Eric Bénard <eric@eukrea.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-17 07:42:54 +02:00
Sascha Hauer c19efab886 Merge branch 'for-next/param'
Conflicts:
	drivers/mci/mci-core.c
2013-05-06 09:30:50 +02:00
Sascha Hauer 18ffa4da98 Merge branch 'for-next/mtd' 2013-05-06 09:30:28 +02:00
Sascha Hauer c8af035b41 Merge branch 'for-next/misc' 2013-05-06 09:30:28 +02:00
Alexander Shiyan 7c15fd1b09 NAND: imx: Fix memory leak
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-04-30 09:35:55 +02:00
Eric Bénard 59dbb4fe2c mtdraw: fix oob read and write
actually ops.ooboffs is not defaulted so when its value gets
added to chip->oob_poi in nand_fill_oob or nand_transfer_oob
the respective memcpy is using a wrong address.

With this patch, both md -s /dev/nandraw0 and cp xyz /dev/nandraw0.sb
are working fine on an i.MX28 target (instead of crashing the board).

Signed-off-by: Eric Bénard <eric@eukrea.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-04-12 19:26:47 +02:00
Sascha Hauer d8ee54fbbf mtd: Nand: Use dev_add_param_bool for erasebad parameter
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-04-11 11:48:36 +02:00
Sascha Hauer 7c6c61fe8e treewide: Use dev_add_param_int_ro where possible
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-04-11 11:48:35 +02:00
Jan Luebbe 973176d20b mtd: update NAND manufacturer names from the kernel
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-04-11 10:44:09 +02:00
Eric Bénard 4c2bdc8728 nand_base: detect more ONFI flash
if the flash has a known type, the ONFI detection won't occur
and thus we may not detect the right parameters.
By testing both namd and pagesize, as done in the kernel, we
can detect ONFI flash with know IDs.

As an example on an i.MX53 board :
- without the patch :
NAND device: Manufacturer ID: 0x2c, Chip ID: 0xd3
(Micron NAND 1GiB 3,3V 8-bit), page size: 4096, OOB size: 128

- with the patch :
ONFI flash detected ... ONFI param page 0 valid
NAND device: Manufacturer ID: 0x2c, Chip ID: 0xd3
(Micron MT29F8G08ABACAWP), page size: 4096, OOB size: 224

in the first case the OOB size is wrong.

Signed-off-by: Eric Bénard <eric@eukrea.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-04-11 10:43:34 +02:00
Sascha Hauer dd9f6d08a2 Merge branch 'for-next/relocate'
Conflicts:
	arch/arm/lib/barebox.lds.S
2013-04-04 14:20:42 +02:00
Sascha Hauer 70867916a7 Merge branch 'for-next/mtd' 2013-04-04 14:20:32 +02:00
Sascha Hauer 45b87922a6 Merge branch 'for-next/misc-arm' 2013-04-04 14:20:32 +02:00
Alexander Shiyan e4588cf311 Introduce device_spi_driver() macro and use it for SPI drivers
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-14 07:15:45 +01:00