summaryrefslogtreecommitdiffstats
path: root/drivers/mtd
Commit message (Collapse)AuthorAgeFilesLines
* Merge tag 'for-linus-20150216' of git://git.infradead.org/linux-mtdLinus Torvalds2015-02-1823-203/+1301
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pull MTD updates from Brian Norris: "NAND: - Add new Hisilicon NAND driver for Hip04 - Add default reboot handler, to ensure all outstanding erase transactions complete in time - jz4740: convert to use GPIO descriptor API - Atmel: add support for sama5d4 - Change default bitflip threshold to 75% of correction strength - Miscellaneous cleanups and bugfixes SPI NOR: - Freescale QuadSPI: - Fix a few probe() and remove() issues - Add a MAINTAINERS entry for this driver - Tweak transfer size to increase read performance - Add suspend/resume support - Add Micron quad I/O support - ST FSM SPI: miscellaneous fixes JFFS2: - gracefully handle corrupted 'offset' field found on flash Other: - bcm47xxpart: add tweaks for a few new devices - mtdconcat: set return lengths properly for mtd_write_oob() - map_ram: enable use with mtdoops - maps: support fallback to ROM/UBI for write-protected NOR flash" * tag 'for-linus-20150216' of git://git.infradead.org/linux-mtd: (46 commits) mtd: hisilicon: && vs & typo jffs2: fix handling of corrupted summary length mtd: hisilicon: add device tree binding documentation mtd: hisilicon: add a new NAND controller driver for hisilicon hip04 Soc mtd: avoid registering reboot notifier twice mtd: concat: set the return lengths properly mtd: kconfig: replace PPC_OF with PPC mtd: denali: remove unnecessary stubs mtd: nand: remove redundant local variable MAINTAINERS: add maintainer entry for FREESCALE QUAD SPI driver mtd: fsl-quadspi: improve read performance by increase AHB transfer size mtd: fsl-quadspi: Remove unnecessary 'map_failed' label mtd: fsl-quadspi: Remove unneeded success/error messages mtd: fsl-quadspi: Fix the error paths mtd: nand: omap: drop condition with no effect mtd: nand: jz4740: Convert to GPIO descriptor API mtd: nand: Request strength instead of bytes for soft BCH mtd: nand: default bitflip-reporting threshold to 75% of correction strength mtd: atmel_nand: introduce a new compatible string for sama5d4 chip mtd: atmel_nand: return max bitflips in all sectors in pmecc_correction() ...
| * mtd: hisilicon: && vs & typoDan Carpenter2015-02-151-1/+1
| | | | | | | | | | | | | | | | The intent was to mask away some bits here, not to test true or false. Fix: 54f531f6e332 ('mtd: hisilicon: add a new NAND controller driver for hisilicon hip04 Soc') Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
| * mtd: hisilicon: add a new NAND controller driver for hisilicon hip04 SocZhou Wang2015-02-083-0/+897
| | | | | | | | | | | | | | | | This patch adds the support for hisilicon 504 NAND controller which is now used by Hisilicon Soc Hip04. Signed-off-by: Zhou Wang <wangzhou1@hisilicon.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
| * mtd: avoid registering reboot notifier twiceNiklas Cassel2015-02-071-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | Calling mtd_device_parse_register with the same mtd_info (e.g. registering several partitions on a single device) would add the same reboot notifier twice, causing an infinte loop in notifier_chain_register during boot up. Signed-off-by: Niklas Cassel <nks@flawful.org> [Brian: add FIXME comments] Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
| * mtd: concat: set the return lengths properlyNiklas Cassel2015-02-051-1/+2
| | | | | | | | | | | | | | | | In concat_read_oob both retlen and oobretlen should be updated. concat_write_oob previously only (improperly) updated retlen. Signed-off-by: Niklas Cassel <niklass@axis.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
| * mtd: kconfig: replace PPC_OF with PPCKevin Hao2015-02-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | The PPC_OF is a ppc specific option which is used to mean that the firmware device tree access functions are available. Since all the ppc platforms have a device tree, it is aways set to 'y' for ppc. So it makes no sense to keep a such option in the current kernel. Replace it with PPC. Signed-off-by: Kevin Hao <haokexin@gmail.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
| * mtd: denali: remove unnecessary stubsMasahiro Yamada2015-02-051-38/+0
| | | | | | | | | | | | | | | | | | This driver uses NAND_ECC_HW_SYNDROME mode. The nand_scan_tail() function would not complain about missing ecc->calculate, ecc->correct, ecc->hwctl handlers. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
| * mtd: nand: remove redundant local variableBaruch Siach2015-02-051-2/+1
| | | | | | | | | | Signed-off-by: Baruch Siach <baruch@tkos.co.il> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
| * mtd: fsl-quadspi: improve read performance by increase AHB transfer sizeAllen Xu2015-02-051-4/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Set AHB transfer size to 1K which improved the read performance. Add ahb_buf_size field in fsl_qspi_devtype_data to denote the size for different SoC. Before: root@imx6qdlsolo:~# dd if=/dev/mtd1 of=/dev/null bs=1M count=16 16+0 records in 16+0 records out 16777216 bytes (17 MB) copied, 0.472183 s, 25.1 MB/s After: root@imx6qdlsolo:~# dd if=/dev/mtd1 of=/dev/null bs=1M count=16 16+0 records in 16+0 records out 16777216 bytes (17 MB) copied, 0.369439 s, 29.5 MB/s Signed-off-by: Allen Xu <b45815@freescale.com> Signed-off-by: Huang Shijie <shijie8@gmail.com> Signed-off-by: Frank Li <Frank.Li@freescale.com> Acked-by: Huang Shijie <shijie.huang@intel.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
| * mtd: fsl-quadspi: Remove unnecessary 'map_failed' labelFabio Estevam2015-02-051-18/+10
| | | | | | | | | | | | | | | | | | There is no need to keep the 'map_failed' label. We can simply return the error code directly and let the code shorter and cleaner. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Acked-by: Han Xu <han.xu@freescale.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
| * mtd: fsl-quadspi: Remove unneeded success/error messagesFabio Estevam2015-02-051-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the driver successfully probe we already have messages like: [ 1.140989] fsl-quadspi 21e4000.qspi: s25fl128s (16384 Kbytes) [ 1.150902] fsl-quadspi 21e4000.qspi: s25fl128s (16384 Kbytes) Or in case of error: [ 1.175920] fsl-quadspi: probe of 21e4000.qspi failed with error -12 , so remove the unneeded success/error messages. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Acked-by: Han Xu <han.xu@freescale.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
| * mtd: fsl-quadspi: Fix the error pathsFabio Estevam2015-02-051-4/+4
| | | | | | | | | | | | | | | | | | | | | | Jumping to 'map_failed' label is not correct at these points, as it misses to disable the clocks that were previously enabled. Jump to 'irq_failed' label instead that will correctly disable the clocks. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Acked-by: Han Xu <han.xu@freescale.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
| * mtd: nand: omap: drop condition with no effectNicholas Mc Guire2015-02-051-22/+9
| | | | | | | | | | | | | | | | | | | | | | | | The if and the else branch code are identical - so the condition has no effect on the effective code. This patch removes the condition and the duplicated code and updates the documentation as suggested by Roger Quadros <rogerq@ti.com>. Acked-by: Roger Quadros <rogerq@ti.com> Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org> Reviewed-by: Pekon Gupta <pekon@pek-sem.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
| * mtd: nand: jz4740: Convert to GPIO descriptor APILars-Peter Clausen2015-02-021-19/+10
| | | | | | | | | | | | | | | | | | | | | | | | Use the GPIO descriptor API instead of the deprecated legacy GPIO API to manage the busy GPIO. The patch updates both the jz4740 nand driver and the only user of the driver the qi-lb60 board driver. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
| * mtd: nand: Request strength instead of bytes for soft BCHAaron Sierra2015-02-013-8/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, we requested that drivers pass ecc.size and ecc.bytes when using NAND_ECC_SOFT_BCH. However, a driver is likely to only know the ECC strength required for its NAND, so each driver would need to perform a strength-to-bytes calculation. Avoid duplicating this calculation in each driver by asking drivers to pass ecc.size and ecc.strength so that the strength-to-bytes calculation need only be implemented once. This reverts/generalizes this commit: mtd: nand: Base BCH ECC bytes on required strength Signed-off-by: Aaron Sierra <asierra@xes-inc.com> Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
| * mtd: nand: default bitflip-reporting threshold to 75% of correction strengthBrian Norris2015-01-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The MTD API reports -EUCLEAN only if the maximum number of bitflips found in any ECC block exceeds a certain threshold. This is done to avoid excessive -EUCLEAN reports to MTD users, which may induce additional scrubbing of data, even when the ECC algorithm in use is perfectly capable of handling the bitflips. This threshold can be controlled by user-space (via sysfs), to allow users to determine what they are willing to tolerate in their application. But it still helps to have sane defaults. In recent discussion [1], it was pointed out that our default threshold is equal to the correction strength. That means that we won't actually report any -EUCLEAN (i.e., "bitflips were corrected") errors until there are almost too many to handle. It was determined that 3/4 of the correction strength is probably a better default. [1] http://lists.infradead.org/pipermail/linux-mtd/2015-January/057259.html Signed-off-by: Brian Norris <computersforpeace@gmail.com> Acked-by: Huang Shijie <shijie.huang@intel.com>
| * mtd: atmel_nand: introduce a new compatible string for sama5d4 chipWu, Josh2015-01-201-1/+24
| | | | | | | | | | | | | | | | | | | | | | | | Since in SAMA5D4 chip, the PMECC can correct bit flips in erased page. So we add a DT property to indicate this hardware character. If the PMECC support correct bitflip erased page (all data are 0xff). Then we can use the PMECC correct the page and skip the erased page check. Signed-off-by: Josh Wu <josh.wu@atmel.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
| * mtd: atmel_nand: return max bitflips in all sectors in pmecc_correction()Wu, Josh2015-01-201-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | atmel_nand_pmecc_read_page() will return the total bitflips in this page. This is incorrect. As one nand page includes multiple ecc sectors, that will cause the returned total bitflips exceed ecc capablity. So this patch will make pmecc_correct() return the max bitflips of all sectors in the page. That also makes atmel_nand_pmecc_read_page() return the max bitflips. Signed-off-by: Josh Wu <josh.wu@atmel.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
| * mtd: fsl-quadspi: Fix module unboundFabio Estevam2015-01-201-6/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When removing the fsl-quadspi module and running 'cat /proc/mtd' afterwards, we see garbage data like: $ rmmod fsl-quadspi $ cat /proc/mtd dev: size erasesize name mtd0: 00000000 00000000 "(null)" mtd0: 00000000 00000000 "(null)" mtd0: 00000000 00000000 "(null)" ... mtd0: a22296c6c756e28 00000000 "(null)" mtd0: a22296c6c756e28 3064746d "(null)" If we continue doing multiple module load/unload operations, then it will also lead to a kernel crash. The reason for this is due to the wrong mtd index used in mtd_device_unregister() in the remove function. We need to keep the mtd unregister index aligned with the one used in the probe function, which means we need to take into account the 'has_second_chip' property. By doing so we can guarantee that the mtd index is the same in the registration and unregistration functions. With this patch applied we can load/unload the fsl-quadspi driver several times and it will result in no crash. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Acked-by: Huang Shijie <shijie.huang@intel.com> Tested-by: Frank Li <Frank.Li@freescale.com> Acked-by: Allen Xu <han.xu@freescale.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
| * mtd: spi-nor: support for (GigaDevice) GD25Q128BRafał Miłecki2015-01-201-0/+1
| | | | | | | | | | Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
| * nandsim: remove unused STATE_DATAOUT_STATUS_M and OPT_SMARTMEDIAAkinobu Mita2015-01-151-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is no path to switch to STATE_DATAOUT_STATUS_M state, and OPT_SMARTMEDIA is unused. This is leftover from commit 0be718e5525a73557e76ea1c05b8001dde507049 ("mtd: nand: remove a bunch of unused commands"). Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Cc: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Cc: David Woodhouse <dwmw2@infradead.org> Cc: Brian Norris <computersforpeace@gmail.com> Cc: linux-mtd@lists.infradead.org Signed-off-by: Brian Norris <computersforpeace@gmail.com>
| * mtd: nand: ams-delta: fix overwritten mtd_info->owner in initializationAkinobu Mita2015-01-151-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | In initialization routine, mtd_info->owner is overwritten by memset() just after being initialized. This can be fixed by moving memset() calls to just before setting mtd_info->owner. But the memory region is allocated by kmalloc, so we can fix it by using kzalloc instead of kmalloc. Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Cc: Jonathan McDowell <noodles@earth.li> Cc: David Woodhouse <dwmw2@infradead.org> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
| * mtd: spi-nor: fsl-qspi: support deep sleep mode for imx6 sx chipAllen Xu2015-01-151-0/+18
| | | | | | | | | | | | | | | | | | | | | | i.mx6 sx support turn off fastmix and megamix power. qpsi controller can be turned off and all status lost when suspend/resume. add suspend/resume functions and reset qspi controller when resume. Signed-off-by: Allen Xu <b45815@freescale.com> Signed-off-by: Frank Li <Frank.Li@freescale.com> Acked-by: Huang Shijie <shijie.huang@intel.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
| * mtd: denali: fix incorrect bitmask error in denali_setup_dmaGraham Moore2015-01-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | commit 3157d1ed2309 ("mtd: denali: remove unnecessary casts") introduced an error by using a wrong bitmask. A uint16_t cast was replaced with & 0xff, should be & 0xffff. Signed-off-by: Graham Moore <grmoore@opensource.altera.com> Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
| * mtd: st_spi_fsm: Fix [-Wsign-compare] build warningLee Jones2015-01-121-1/+1
| | | | | | | | | | | | | | | | drivers/mtd/devices/st_spi_fsm.c:1647:17: warning: comparison between signed and unsigned integer expressions Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
| * mtd: st_spi_fsm: Obtain and use EMI clockLee Jones2015-01-121-2/+38
| | | | | | | | | | | | | | | | | | ST's Common Clk Framework is now available. This patch ensures the FSM makes use of it by obtaining and enabling the EMI clock. If system fails to provide the EMI clock, we bomb out. Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
| * mtd: st_spi_fsm: Extend fsm_clear_fifo to handle unwanted bytesLee Jones2015-01-121-16/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Under certain conditions, the SPI-FSM Controller can be left in a state where the data FIFO is not entirely empty. This can lead to problems where subsequent data transfers appear to have been shifted by a number of unidentified bytes. One simple example would be an errant FSM sequence which loaded more data to the FIFO than was read by the host. Another more interesting case results from an obscure artefact in the FSM Controller. When switching from data transfers in x4 or x2 mode to data transfers in x1 mode, extraneous bytes will appear in the FIFO, unless the previous data transfer was a multiple of 32 cycles (i.e. 8 bytes for x2, and 16 bytes for x4). This applies equally whether FSM is being operated directly by a S/W driver, or by the SPI boot-controller in FSM-Boot mode. Furthermore, data in the FIFO not only survive a transition between FSM-Boot and FSM, but also a S/W reset of IP block [1]. By taking certain precautions, it is possible to prevent the driver from causing this type of problem (e.g. ensuring that the host and programmed sequence agree on the transfer size, and restricting transfer sizes to multiples of 32-cycles [2]). However, at the point the driver is loaded, no assumptions can be made regarding the state of the FIFO. Even if previous S/W drivers have behaved correctly, it is impossible to control the number of transactions serviced by the controller operating in FSM-Boot. To address this problem, we ensure the FIFO is cleared during initialisation, before performing any FSM operations. Previously, the fsm_clear_fifo() code was capable of detecting and clearing any unwanted 32-bit words from the FIFO. This patch extends the capability to handle an arbitrary number of bytes present in the FIFO [3]. Now that the issue is better understood, we also remove the calls to fsm_clear_fifo() following the fsm_read() and fsm_write() operations. The process of actually clearing the FIFO deserves a mention. While the FIFO may contain any number of bytes, the SPI_FAST_SEQ_STA register only reports the number of complete 32-bit words present. Furthermore, data can only be drained from the FIFO by reading complete 32-bit words. With this in mind, a two stage process is used to the clear the FIFO: 1. Read any complete 32-bit words from the FIFO, as reported by the SPI_FAST_SEQ_STA register. 2. Mop up any remaining bytes. At this point, it is not known if there are 0, 1, 2, or 3 bytes in the FIFO. To handle all cases, a dummy FSM sequence is used to load one byte at a time, until a complete 32-bit word is formed; at most, 4 bytes will need to be loaded. [1] Although this issue has existed since early versions of the SPI-FSM controller, its full extent only emerged recently as a consequence of the targetpacks starting to use FSM-Boot(x4) as the default configuration. [2] The requirement to restrict transfers to multiples of 32 cycles was found empirically back when DUAL and QUAD mode support was added. The current analysis now gives a satisfactory explanation for this requirement. [3] Theoretically, it is possible for the FIFO to contain an arbitrary number of bits. However, since there are no known use-cases that leave incomplete bytes in the FIFO, only words and bytes are considered here. Signed-off-by: Angus Clark <angus.clark@st.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
| * mtd: map_rom: Support UBI on ROMAaron Sierra2015-01-091-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | UBI needs to know the physical erase block size, even on read-only devices, since it defines the on-device layout. Use a device-tree provided value to support previously written UBI on read-only NOR. UBI also needs a non-zero writebufsize, so we set it to one. Note: This was implemented because hardware write-protected CFI NOR cannot be probed for the physical erase block size. Signed-off-by: Joe Schultz <jschultz@xes-inc.ccom> Signed-off-by: Aaron Sierra <asierra@xes-inc.ccom> [Brian: removed unneeded #ifdef, note 'optional' erase-size property] Signed-off-by: Brian Norris <computersforpeace@gmail.com>
| * mtd: physmap_of: Add read-only fallbackJoe Schultz2015-01-091-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, when probing a CFI chip which was write-protected at the hardware level, the probe would fail due to the fact it could not put the chip into QUERY mode. This would result in no MTD devices being created. Add a fallback to probe using the map_rom driver if the user-selected probe fails. Signed-off-by: Joe Schultz <jschultz@xes-inc.com> Signed-off-by: Aaron Sierra <asierra@xes-inc.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
| * mtd: map_ram: Enable mtdoopsAlessio Igor Bogani2015-01-091-0/+1
| | | | | | | | | | Signed-off-by: Alessio Igor Bogani <alessio.bogani@elettra.eu> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
| * mtd: nftl: reorganize operations in condition checkAndy Shevchenko2015-01-091-7/+11
| | | | | | | | | | | | | | | | | | | | | | | | We need to compare ret variable for negative value. The current code assigns the boolean to the ret and prints it wrongly in the warning message. Reported-by: Andrey Karpov <karpov@viva64.com> Cc: Giel van Schijndel <me@mortis.eu> Cc: Dimitri Gorokhovik <dimitri.gorokhovik@free.fr> Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
| * mtd: nand: remove duplicate comment lineBaruch Siach2015-01-091-1/+0
| | | | | | | | | | | | | | | | | | | | | | Commit 7854d3f7495b1 ("mtd: spelling, capitalization, uniformity") added a correctly spelled line, but failed to remove the wrongly spelled one. Commit 064a7694b534 ("mtd: Fix typo mtd/tests") then fixed the spelling again, but left the duplication. Fixes: 7854d3f7495b1 ("mtd: spelling, capitalization, uniformity") Signed-off-by: Baruch Siach <baruch@tkos.co.il> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
| * mtd: nand: added nand_shutdownScott Branden2015-01-071-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add nand_shutdown to wait for current nand operations to finish and prevent further operations by changing the nand flash state to FL_SHUTDOWN. This is addressing a problem observed during reboot tests using UBIFS root file system: NAND erase operations that are in progress during system reboot/shutdown are causing partial erased blocks. Although UBI should be able to detect and recover from this error, this change will avoid the creation of partial erased blocks on reboot in the middle of a NAND erase operation. Signed-off-by: Scott Branden <sbranden@broadcom.com> Tested-by: Scott Branden <sbranden@broadcom.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
| * mtd: implement common reboot notifier boilerplateBrian Norris2015-01-071-0/+20
| | | | | | | | | | | | | | | | cfi_cmdset_000{1,2}.c already implement their own reboot notifiers, and we're going to add one for NAND. Let's put the boilerplate in one place. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Tested-by: Scott Branden <sbranden@broadcom.com>
| * mtd: mtdblock: remove the needless mtdblks_lockGu Zheng2015-01-071-10/+0
| | | | | | | | | | | | | | | | | | | | The global lock mtdblks_lock was used to protect the original mtdblks array to avoid race conditions. As the mtdblks array was already gone, but the mtdblks_lock is left, and it causes latency when open/release dev. So we need to remove it here. Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
| * mtd: bcm47xxpart: support SquashFS with an original magicRafał Miłecki2015-01-071-2/+5
| | | | | | | | | | | | | | | | | | SquashFS is supposed to use magic defined as SQUASHFS_MAGIC. What we were supporting so far (SQSH_MAGIC) is something ZTE specific. This patch adds support for Xiaomi R1D. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
| * mtd: bcm47xxpart: lower minimal blocksize to 4Ki (from 64Ki)Rafał Miłecki2015-01-071-2/+6
| | | | | | | | | | | | | | | | Some devices like Netgear WNR1000v3 or WGR614v10 have partitions aligned to 0x1000. Using bigger blocksize stopped us from detecting some parts. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
| * mtd: bcm47xxpart: support TRX data partition being UBIRafał Miłecki2015-01-071-2/+26
| | | | | | | | | | Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
| * mtd: spi-nor: Add quad I/O support for Micron SPI NORBean Huo 霍斌斌 (beanhuo)2015-01-071-8/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds code which enables Quad I/O mode on Micron SPI NOR flashes. For Micron SPI NOR flash, enabling or disabling quad I/O protocol can be done By two methods, which are to use EVCR (Enhanced Volatile Configuration Register) and the ENTER QUAD I/O MODE command. There is no difference between these two methods. Unfortunately, for some Micron SPI NOR flashes, there no ENTER Quad I/O command (35h), such as n25q064. But for all current Micron SPI NOR, if it support quad I/O mode, using EVCR definitely be supported. It is a recommended method to enable Quad I/O mode by EVCR, Quad I/O protocol bit 7. When EVCR bit 7 is reset to 0, the SPI NOR flash will operate in quad I/O mode. This patch has been tested on N25Q512A and MT25TL256BAA1ESF. Micron SPI NOR of spi_nor_ids[] table all support this method. Signed-off-by: Bean Huo <beanhuo@micron.com> Acked-by: Marek Vasut <marex@denx.de> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
| * mtd: nand: gpmi: remove deprecated commentBoris BREZILLON2014-12-221-8/+0
| | | | | | | | | | | | | | | | | | Now that we have raw functions properly implemented we can remove this FIXME. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Acked-by: Huang Shijie <shijie.huang@intel.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
| * mtd: gpmi: Remove noisy error messageFabio Estevam2014-12-221-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | mx28evk board has a socket for NAND flash that comes with no NAND flash populated, and then we get this message on every boot: [ 1.657603] gpmi-nand 8000c000.gpmi-nand: driver registration failed: -19 which is not very helpful, so get rid of this error message. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
* | Merge branch 'for-linus-v3.20' of git://git.infradead.org/linux-ubifsLinus Torvalds2015-02-1511-173/+319
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pull UBI and UBIFS updates from Richard Weinberger: - cleanups and bug fixes all over UBI and UBIFS - block-mq support for UBI Block - UBI volumes can now be renamed while they are in use - security.* XATTR support for UBIFS - a maintainer update * 'for-linus-v3.20' of git://git.infradead.org/linux-ubifs: UBI: block: Fix checking for NULL instead of IS_ERR() UBI: block: Continue creating ubiblocks after an initialization error UBIFS: return -EINVAL if log head is empty UBI: Block: Explain usage of blk_rq_map_sg() UBI: fix soft lockup in ubi_check_volume() UBI: Fastmap: Care about the protection queue UBIFS: add a couple of extra asserts UBI: do propagate positive error codes up UBI: clean-up printing helpers UBI: extend UBI layer debug/messaging capabilities - cosmetics UBIFS: add ubifs_err() to print error reason UBIFS: Add security.* XATTR support for the UBIFS UBIFS: Add xattr support for symlinks UBI: Block: Add blk-mq support UBI: Add initial support for scatter gather UBI: rename_volumes: Use UBI_METAONLY UBI: Implement UBI_METAONLY Add myself as UBI co-maintainer
| * | UBI: block: Fix checking for NULL instead of IS_ERR()Dan Carpenter2015-02-121-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We recently switched from allocating ->rq using blk_init_queue() to use blk_mq_init_queue() so we need to update the error handling to check for IS_ERR() instead of NULL. Fixes: ff1f48ee3bb3 ('UBI: Block: Add blk-mq support') Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Richard Weinberger <richard@nod.at>
| * | UBI: block: Continue creating ubiblocks after an initialization errorDan Ehrenberg2015-02-121-15/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If one ubi volume is corrupted but another is not, it should be possible to initialize that ubiblock from a kernel commandline which includes both of them. This patch changes the error handling behavior in initializing ubiblock to ensure that all parameters are attempted even if one fails. If there is a failure, it is logged on dmesg. It also makes error messages more descriptive by including the name of the UBI volume that failed. Tested: Formatted ubi volume /dev/ubi5_0 in a corrupt way and dev/ubi3_0 properly and included "ubi.block=5,0 ubi.block=3,0" on the kernel command line. At boot, I see the following in the console: [ 21.082420] UBI error: ubiblock_create_from_param: block: can't open volume on ubi5_0, err=-19 [ 21.084268] UBI: ubiblock3_0 created from ubi3:0(rootfs) Signed-off-by: Dan Ehrenberg <dehrenberg@chromium.org> Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Signed-off-by: Richard Weinberger <richard@nod.at>
| * | UBI: Block: Explain usage of blk_rq_map_sg()Richard Weinberger2015-01-281-0/+6
| | | | | | | | | | | | Signed-off-by: Richard Weinberger <richard@nod.at>
| * | UBI: fix soft lockup in ubi_check_volume()hujianyang2015-01-281-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Running mtd-utils/tests/ubi-tests/io_basic.c could cause soft lockup or watchdog reset. It is because *updatevol* will perform ubi_check_volume() after updating finish and this function will full scan the updated lebs if the volume is initialized as STATIC_VOLUME. This patch adds *cond_resched()* in the loop of lebs scan to avoid soft lockup. Helped by Richard Weinberger <richard@nod.at> [ 2158.067096] INFO: rcu_sched self-detected stall on CPU { 1} (t=2101 jiffies g=1606 c=1605 q=56) [ 2158.172867] CPU: 1 PID: 2073 Comm: io_basic Tainted: G O 3.10.53 #21 [ 2158.172898] [<c000f624>] (unwind_backtrace+0x0/0x120) from [<c000c294>] (show_stack+0x10/0x14) [ 2158.172918] [<c000c294>] (show_stack+0x10/0x14) from [<c008ac3c>] (rcu_check_callbacks+0x1c0/0x660) [ 2158.172936] [<c008ac3c>] (rcu_check_callbacks+0x1c0/0x660) from [<c002b480>] (update_process_times+0x38/0x64) [ 2158.172953] [<c002b480>] (update_process_times+0x38/0x64) from [<c005ff38>] (tick_sched_handle+0x54/0x60) [ 2158.172966] [<c005ff38>] (tick_sched_handle+0x54/0x60) from [<c00601ac>] (tick_sched_timer+0x44/0x74) [ 2158.172978] [<c00601ac>] (tick_sched_timer+0x44/0x74) from [<c003f348>] (__run_hrtimer+0xc8/0x1b8) [ 2158.172992] [<c003f348>] (__run_hrtimer+0xc8/0x1b8) from [<c003fd9c>] (hrtimer_interrupt+0x128/0x2a4) [ 2158.173007] [<c003fd9c>] (hrtimer_interrupt+0x128/0x2a4) from [<c0246f1c>] (arch_timer_handler_virt+0x28/0x30) [ 2158.173022] [<c0246f1c>] (arch_timer_handler_virt+0x28/0x30) from [<c0086214>] (handle_percpu_devid_irq+0x9c/0x124) [ 2158.173036] [<c0086214>] (handle_percpu_devid_irq+0x9c/0x124) from [<c0082bd8>] (generic_handle_irq+0x20/0x30) [ 2158.173049] [<c0082bd8>] (generic_handle_irq+0x20/0x30) from [<c000969c>] (handle_IRQ+0x64/0x8c) [ 2158.173060] [<c000969c>] (handle_IRQ+0x64/0x8c) from [<c0008544>] (gic_handle_irq+0x3c/0x60) [ 2158.173074] [<c0008544>] (gic_handle_irq+0x3c/0x60) from [<c02f0f80>] (__irq_svc+0x40/0x50) [ 2158.173083] Exception stack(0xc4043c98 to 0xc4043ce0) [ 2158.173092] 3c80: c4043ce4 00000019 [ 2158.173102] 3ca0: 1f8a865f c050ad10 1f8a864c 00000031 c04b5970 0003ebce 00000000 f3550000 [ 2158.173113] 3cc0: bf00bc68 00000800 0003ebce c4043ce0 c0186d14 c0186cb8 80000013 ffffffff [ 2158.173130] [<c02f0f80>] (__irq_svc+0x40/0x50) from [<c0186cb8>] (read_current_timer+0x4/0x38) [ 2158.173145] [<c0186cb8>] (read_current_timer+0x4/0x38) from [<1f8a865f>] (0x1f8a865f) [ 2183.927097] BUG: soft lockup - CPU#1 stuck for 22s! [io_basic:2073] [ 2184.002229] Modules linked in: nandflash(O) [last unloaded: nandflash] Signed-off-by: Wang Kai <morgan.wang@huawei.com> Signed-off-by: hujianyang <hujianyang@huawei.com> Signed-off-by: Richard Weinberger <richard@nod.at>
| * | UBI: Fastmap: Care about the protection queueRichard Weinberger2015-01-281-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | Fastmap can miss a PEB if it is in the protection queue and not jet in the used tree. Treat every protected PEB as used. Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
| * | UBI: do propagate positive error codes upArtem Bityutskiy2015-01-281-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | UBI uses positive function return codes internally, and should not propagate them up, except in the place this path fixes. Here is the original bug report from Dan Carpenter: The problem is really in ubi_eba_read_leb(). drivers/mtd/ubi/eba.c 412 err = ubi_io_read_vid_hdr(ubi, pnum, vid_hdr, 1); 413 if (err && err != UBI_IO_BITFLIPS) { 414 if (err > 0) { 415 /* 416 * The header is either absent or corrupted. 417 * The former case means there is a bug - 418 * switch to read-only mode just in case. 419 * The latter case means a real corruption - we 420 * may try to recover data. FIXME: but this is 421 * not implemented. 422 */ 423 if (err == UBI_IO_BAD_HDR_EBADMSG || 424 err == UBI_IO_BAD_HDR) { 425 ubi_warn("corrupted VID header at PEB %d, LEB %d:%d", 426 pnum, vol_id, lnum); 427 err = -EBADMSG; 428 } else 429 ubi_ro_mode(ubi); On this path we return UBI_IO_FF and UBI_IO_FF_BITFLIPS and it eventually gets passed to ERR_PTR(). We probably dereference the bad pointer and oops. At that point we've gone read only so it was already a bad situation... 430 } 431 goto out_free; 432 } else if (err == UBI_IO_BITFLIPS) 433 scrub = 1; 434 Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
| * | UBI: clean-up printing helpersArtem Bityutskiy2015-01-281-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Let's prefix UBI messages with 'ubiX' instead of 'UBI-X' - this is more consistent with the way we name UBI devices. Also, commit "32608703 UBI: Extend UBI layer debug/messaging capabilities" added the function name print to 'ubi_msg()' - lets revert this change, since these messages are supposed to be just informative messages, and not debugging messages. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
| * | UBI: extend UBI layer debug/messaging capabilities - cosmeticsTanya Brokhman2015-01-285-22/+13
| | | | | | | | | | | | | | | | | | | | | | | | Some cosmetic fixes to the patch "UBI: Extend UBI layer debug/messaging capabilities". Signed-off-by: Tanya Brokhman <tlinder@codeaurora.org> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
OpenPOWER on IntegriCloud