summaryrefslogtreecommitdiffstats
path: root/drivers/mtd
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'for-next/streaming-dma'Sascha Hauer2015-03-091-3/+4
|\ | | | | | | | | Conflicts: drivers/mci/dw_mmc.c
| * ARM: move DMA alloc functions to dma.hLucas Stach2015-03-061-1/+1
| | | | | | | | | | | | | | | | | | | | This better separates the DMA from the MMU functionality. Also move all drivers that only depends on asm/mmu.h for the alloc functions over to the common header. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * ARM: change dma_alloc/free_coherent to match other architecturesLucas Stach2015-03-061-2/+3
| | | | | | | | | | | | | | | | | | As a lot drivers currently rely on the 1:1 virt->phys mapping on ARM we define DMA_ADDRESS_BROKEN to mark them. In order to use them on other architectures with a different mapping they need proper fixing. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/mtd-partitions'Sascha Hauer2015-03-063-9/+234
|\ \
| * | mtd: fixup device tree partitionsSascha Hauer2015-02-121-0/+64
| | | | | | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | mtd: Add a partitions parameter to mtd devicesSascha Hauer2015-02-121-1/+96
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The partitions parameter allows to partition a mtd device using a standard cmdline partition description string. This way the partitions of a mtd device can be changed at once. The output of the string can be used to be passed to the kernel as cmdline partition string. The partitions can also still be changed with addpart/delpart, the partitions parameter will be updated accordingly. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | mtd: Use flags parameter in mtd_add_partitionSascha Hauer2015-02-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | mtd_add_partition is passed a flag parameter. This has been unused so the DEVFS_PARTITION_FIXED and DEVFS_PARTITION_READONLY were ignored. Fix this. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | mtd: forbid conflicting mtd partitionsSascha Hauer2015-02-121-3/+30
| | | | | | | | | | | | | | | | | | | | | | | | mtd partitions should not conflict with each other, so forbid this. Also add the partitions to the partitions list sorted, so that they can be easier translated into a cmdline partition string. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | mtd: nand: remove automatically created bb devicesSascha Hauer2015-02-122-4/+14
| | | | | | | | | | | | | | | | | | | | | | | | the bb devices which are created in add_mtd_device() must be removed in del_mtd_device(). Also remove deletion of the bb devices in the mtdparts-add environment file. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | mtd: Add partitions to listSascha Hauer2015-02-121-0/+8
| | | | | | | | | | | | | | | | | | | | | So that we can iterate over the existing partitions from the master mtd device. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | mtd: partitions: Add error checkSascha Hauer2015-02-121-1/+10
| | | | | | | | | | | | | | | | | | add_mtd_device can fail. Add an error check and bail out properly. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | mtd: partitions: Use xstrdupSascha Hauer2015-02-121-1/+1
| | | | | | | | | | | | | | | | | | The return value of strdup is not checked. Use xstrdup instead. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | mtd: core: add error checksSascha Hauer2015-02-121-2/+13
| |/ | | | | | | | | | | register_device and devfs_create can fail. Add error checks for these. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mtd: nand-imx: don't copy more bytes than read from hardwareUwe Kleine-König2015-02-111-1/+5
| | | | | | | | | | | | | | | | | | The NFC command used for reading the result of a READID command to the NAND chip reads 6 bytes (in x8 mode) or 6 words (in x16 mode with the upper bytes all being 0). So there is no need to safe 16 bytes for later consumption. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mtd: nand: cleanup ONFI printed errors, warningsBrian Norris2015-02-111-9/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | This corresponds to commit c7f23a70635895b5125aeb5593aaf8cb44d3a088 in the Linux kernel. One notable difference is however that ONFI detection is allowed here even in 16-bit mode. This is proved to work fine on an i.MX25 based machine with a x16 NAND. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mtd: nand-imx: fix byte reading in x16 modeUwe Kleine-König2015-02-111-18/+15
|/ | | | | | | | | | | | | | | | | | | | There are a few NAND commands that make the chip only respond on I/O lines 0 to 7 even for x16 devices. READID (90h) is one such command which was already handled fine in the driver (at least for NFC v1 and v2). Other commands (like PARAM (ECh) to read out ONFI parameters) however were not handled properly. Instead of adding another callback make the read_byte callback handle the holes added by the NFC and depend on the nand-base support to call read_byte when necessary instead of read_buf. This fixes reading the ONFI parameter page on an i.MX25 with an x16 NAND and probably[1] also the result of READID on i.MX51/i.MX53 with x16 NAND. [1] untested because no matching machine available Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: nand-bb: Also print raw position in debug messagesSascha Hauer2015-02-101-2/+4
| | | | | | | When debugging the nand-bb devices also the raw position on the device is interesting, print it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: nand-bb: Fix test for bad block when readingSascha Hauer2015-02-101-1/+1
| | | | | | | | in nand_bb_read() 'offset' contains the virtual position on the device, but we have to test for a bad block on the raw physical position, so use bb->offset instead of offset Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: nand-bb: fix erasing bb devices with bad blocksSascha Hauer2015-02-101-3/+21
| | | | | | | mtd_erase does not skip bad blocks, we must skip them in nand_bb_erase instead. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: nand-bb: Fix accesses beyond deviceSascha Hauer2015-02-101-0/+16
| | | | | | | | | When a block is marked bad after the bb device has been created the real size of the bb device is smaller than the calculated size on creation. In this case we can't rely on the upper layers anymore that they won't pass read/write sizes in that fit into the device. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: Fix allowing to erase bad blocks on partitionsSascha Hauer2015-02-101-3/+3
| | | | | | | | | Partitions are mtd devices themselves, but the 'erasebad' parameter is only set to the master mtd device. To allow to erase bad blocks on partitions test the master device instead of the partition devices. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: nand: omap: Fix OMAP_ECC_BCH8_CODE_HW ecc modeSascha Hauer2015-02-101-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This is broken since: | commit 00f119a29387cfb1b188fcc4daa4aa94186ac7a9 | Author: Sascha Hauer <s.hauer@pengutronix.de> | Date: Fri Aug 1 14:09:48 2014 +0200 | | mtd: omap gpmc: fix ecc bytes/size | | The ecc bytes / size are per subpage, not per page. | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> The ecc code in omap_correct_data() expects to correct a whole page at once, so we must tell the nand layer that we have 4 * 13 bytes of ecc bytes and 4 * 512 bytes of ecc size. Otherwise the NAND layer will iterate over 512 byte steps over a page and call the .correct callback each time. This only works for 2k pagesize and needs revisit once other page sizes shall be supported. It would be better to tell the nand layer the real ecc bytes (13) and ecc size (512) instead and drop the iteration in omap_correct_bch(). However, this needs better testing so it isn't done here now. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/pxa'Sascha Hauer2015-02-043-0/+1028
|\
| * mtd: nand: add mrvl-nand driverRobert Jarzmik2015-01-193-0/+1028
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The driver is taken from the Linux kernel, with the following changes : - all DMA removed - all asynchronous handling removed, including the interrupt handler, and the asynchronous state handling - pxa armada support removed Most the kernel structure was kept, to ease up future fixes integration from the kernel driver. The driver is tested on a pxa3xx system development board (aka. zylonite), and reading, writing, erasing, and bad block management were tested. Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2015-02-041-1/+1
|\ \
| * | trivial: s/flasg/flash/Uwe Kleine-König2015-01-271-1/+1
| |/ | | | | | | | | Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / ARM: i.MX6: use generic calculation in nand bbu handlerStefan Christ2015-01-291-3/+4
|/ | | | | | | | | | | The parameters ECC Strength, BadBlockMarkerByte and BadBlockMarkerStartBit in the FCB structure depends on the nand chip's pagesize and oobsize. Instead of hardcoding these values into the imx6 bbu handler calculate these values on the fly. Therefore we export the necessary functions from the nand_mxs driver to use them in the bbu handler. Signed-off-by: Stefan Christ <s.christ@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* sizes.h: move include/sizes.h to include/linux/sizes.hMasahiro Yamada2015-01-081-1/+1
| | | | | | | | | | | | | | This file originates in Linux. Linux has it under include/linux/ directory since commit dccd2304cc90. Let's move it to the same place as well in barebox. This commit was generated by the following commands: find -name '*.[chS]' | xargs sed -i -e 's:<sizes.h>:<linux/sizes.h>:' git mv include/sizes.h include/linux/ Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: Fix typo collumn -> columnSascha Hauer2014-12-111-3/+3
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/imx'Sascha Hauer2014-12-081-0/+1
|\
| * imx6: clk: Gate off ENFC clock before setting clock rateDmitry Lavnikevich2014-11-261-0/+1
| | | | | | | | | | | | | | | | | | This fixes NAND initialization issue which appears occasionally on some i.MX6 SoCs (particulary was observed on phyCARD-i.MX6 with i.MX6Solo). Signed-off-by: Dmitry Lavnikevich <d.lavnikevich@sam-solutions.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mtd: ubi: get_bad_peb_limit from mtd masterJan Weitzel2014-11-201-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | Like mentioned in the coment we need the size of the entire flash chip. Check if a master exists and take his size. Otherwise the limit will be too small and kernel prints: UBI warning: print_rsvd_warning: cannot reserve enough PEBs for \ bad PEB handling, reserved 19, need 20 Signed-off-by: Jan Weitzel <j.weitzel@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mtd: nand_orion: remove unused goto labelUwe Kleine-König2014-11-101-1/+1
|/ | | | | | | | | | | This fixes the following warning: drivers/mtd/nand/nand_orion.c: In function ‘orion_nand_probe’: drivers/mtd/nand/nand_orion.c:145:1: warning: label ‘no_res’ defined but not used [-Wunused-label] Fixes: 1a215f5 ("nand: Add Marvell Orion NAND driver") Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/ubi'Sascha Hauer2014-10-025-42/+40
|\
| * UBI: bugfix in ubi_wl_flush()Richard Weinberger2014-09-111-2/+2
| | | | | | | | | | | | | | | | Use the _safe variant because we're iterating over a list where items get deleted and freed. Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
| * UBI: init_volumes: Ignore volumes with no LEBsRichard Weinberger2014-09-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | UBI assumes that ubi_attach_info will only contain ubi_ainf_volume structures for volumes with at least one LEB. In scanning mode this is true because UBI can nicely create a ubi_ainf_volume on demand while creating the EBA table. For fastmap this is not true, the fastmap on-flash structure has a list of all volumes, the ubi_ainf_volume structures are created from this list. So it can happen that an empty volume ends up in init_volumes(). We can easely deal with that by looking into ->leb_count too. Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
| * UBI: fastmap: do not miss bit-flipsBrian Norris2014-09-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The return value from 'ubi_io_read_ec_hdr()' was stored in 'err', not in 'ret'. This fix makes sure Fastmap-enabled UBI does not miss bit-flip while reading EC headers, events and scrubs the affected PEBs. This issue was reported by Coverity Scan. Artem: improved the commit message. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Acked-by: Richard Weinberger <richard@nod.at> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
| * UBI: fix the volumes tree sorting criteriaHeiko Schocher2014-09-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Commig "604b592 UBI: fix rb_tree node comparison in add_map" broke fastmap backward compatibility and older fastmap images cannot be mounted anymore. The reason is that it changes the volumes RB-tree sorting criteria. This patch fixes the problem. Artem: re-write the commit message Signed-off-by: Heiko Schocher <hs@denx.de> Acked-by: Richard Weinberger <richard@nod.at> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
| * UBI: fix rb_tree node comparison in add_mapMike Snitzer2014-09-111-2/+2
| | | | | | | | | | | | | | | | | | The comparisons used in add_vol() shouldn't be identical. Pretty sure the following is correct but it is completely untested. Signed-off-by: Mike Snitzer <snitzer@redhat.com> Acked-by: Richard Weinberger <richard@nod.at> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
| * UBI: fix ubi free PEBs count calculationTanya Brokhman2014-09-111-0/+3
| | | | | | | | | | | | | | | | | | | | The ubi->free_count should be updated with every insert/remove to/from the ubi->free list. Signed-off-by: Tanya Brokhman <tlinder@codeaurora.org> Reviewed-by: Dolev Raviv <draviv@codeaurora.org> Acked-by: Richard Weinberger <richard@nod.at> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
| * UBI: fix error path in __wl_get_pebTanya Brokhman2014-09-111-0/+3
| | | | | | | | | | | | | | | | | | | | | | In case of an error (if there are not free PEB's for example), __wl_get_peb will return a negative value. In order to prevent access violation we need to test the returned value prior to using it later on. Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org> Reviewed-by: Dolev Raviv <draviv@codeaurora.org> Acked-by: Richard Weinberger <richard@nod.at> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
| * UBI: fix some use after free bugsDan Carpenter2014-09-111-4/+4
| | | | | | | | | | | | | | Move the kmem_cache_free() calls down a couple lines. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
| * UBI: avoid program operation on NOR flash after erasure interruptedQi Wang 王起 (qiwang)2014-09-111-32/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | nor_erase_prepare() will be called before erase a NOR flash, it will program '0' into a block to mark this block. But program data into a erasure interrupted block can cause program timtout(several minutes at most) error, could impact other operation on NOR flash. So UBIFS can read this block first to avoid unneeded program operation. This patch try to put read operation at head of write operation in nor_erase_prepare(), read out the data. If the data is already corrupt, then no need to program any data into this block, just go to erase this block. This patch is validated on Micron NOR flash, part number is:JS28F512M29EWHA Signed-off-by: Qi Wang <qiwang@micron.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
| * UBI: fix error return codeJulia Lawall2014-09-111-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Set the return variable to an error code as done elsewhere in the function. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> ( if@p1 (\(ret < 0\|ret != 0\)) { ... return ret; } | ret@p1 = 0 ) ... when != ret = e1 when != &ret *if(...) { ... when != ret = e2 when forall return ret; } // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Reviewed-by: Richard Weinberger <richard@nod.at>
* | Merge branch 'for-next/resource-err-ptr'Sascha Hauer2014-10-025-2/+21
|\ \
| * | resource: Let dev_request_mem_region return an error pointerSascha Hauer2014-09-164-2/+14
| | | | | | | | | | | | | | | | | | For all users fix or add the error check. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | resource: Let dev_request_mem_region_by_name return an error pointerSascha Hauer2014-09-161-0/+7
| | | | | | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/mtd'Sascha Hauer2014-10-023-0/+128
|\ \ \
| * | | mtd: add mtdram device (which build mtd over ram area - useful for FRAM oder ↵Sebastian Block2014-09-093-0/+128
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MRAM) Change since v1 (Sascha, thanks for review): * use xzalloc instead of kzalloc and control check * correct help and names * fix coding style issue * remove verbose and unneeded messages This adds support for MTD in RAM devices (like FRAM or MRAM). Signed-off-by: Sebastian Block <basti@linux-source.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/misc'Sascha Hauer2014-10-022-3/+3
|\ \ \