aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2015-04-05mtd: mtd_oobtest: Fix bitflip_limit usage in test case 3Roger Quadros1-27/+35
In test case 3, we set vary_offset to write at different offsets and lengths in the OOB available area. We need to do the bitflip_limit check while checking for 0xff outside the OOB offset + length area that we didn't modify during write. Signed-off-by: Roger Quadros <[email protected]> [Brian: whitespace fixup] Signed-off-by: Brian Norris <[email protected]>
2015-04-05mtd: docg3: remove invalid __exit annotationsBrian Norris1-3/+3
The .remove callback may be used when detaching a device via sysfs, so we can't expect to free up this memory. Signed-off-by: Brian Norris <[email protected]> Acked-by: Robert Jarzmik <[email protected]>
2015-04-05mtd: fsl_ifc_nand: use msecs_to_jiffies for time conversionNicholas Mc Guire1-2/+2
This is only an API consolidation and should make things more readable it replaces var * HZ / 1000 by msecs_to_jiffies(var) which helps readability and also handles all corner-cases properly. Signed-off-by: Nicholas Mc Guire <[email protected]> Signed-off-by: Brian Norris <[email protected]>
2015-04-05mtd: atmel_nand: don't map the ROM table if no pmecc table offset in DTWu, Josh1-7/+7
if atmel,pmecc-lookup-table-offset is not found in DT node, we don't need to map the ROM table as we will build a runtime gf table anyway. Reported-by: Nicolas Ferre <[email protected]> Signed-off-by: Josh Wu <[email protected]> Acked-by: Nicolas Ferre <[email protected]> Signed-off-by: Brian Norris <[email protected]>
2015-04-05mtd: atmel_nand: add a definition for the oob reserved bytesJosh Wu2-2/+6
It's better to use a macro instead of just a number. Signed-off-by: Josh Wu <[email protected]> Signed-off-by: Brian Norris <[email protected]>
2015-04-05mtd: part: Remove partition overlap checksDan Ehrenberg1-20/+1
This patch makes MTD dynamic partitioning more flexible by removing overlap checks for dynamic partitions. I don't see any particular reason why overlapping dynamic partitions should be prohibited while static partitions are allowed to overlap freely. The checks previously had an off-by-one error, where 'end' should be one less than what it is currently set at, and adding partitions out of increasing order will fail. Disabling the checks resolves this issue. Signed-off-by: Dan Ehrenberg <[email protected]> Signed-off-by: Brian Norris <[email protected]>
2015-04-05mtd: part: Add sysfs variable for offset of partitionDan Ehrenberg2-0/+39
This patch makes a sysfs variable called 'offset' on each partition which contains the offset in bytes from the beginning of the master device that the partition starts. Signed-off-by: Dan Ehrenberg <[email protected]> Signed-off-by: Brian Norris <[email protected]>
2015-04-05mtd: part: Create the master device node when partitionedDan Ehrenberg3-21/+62
For many use cases, it helps to have a device node for the entire MTD device as well as device nodes for the individual partitions. For example, this allows querying the entire device's properties. A common idiom is to create an additional partition which spans over the whole device. This patch makes a config option, CONFIG_MTD_PARTITIONED_MASTER, which makes the master partition present even when the device is partitioned. This isn't turned on by default since it presents a backwards-incompatible device numbering. The patch also makes the parent of a partition device be the master, if the config flag is set, now that the master is a full device. Signed-off-by: Dan Ehrenberg <[email protected]> Signed-off-by: Brian Norris <[email protected]>
2015-03-30mtd: ts5500_flash: Fix typo in MODULE_DESCRIPTION in ts5500_flash.cMasanari Iida1-1/+1
This patch fixes a spelling typo in MODULE_DESCRIPTION in ts5500_flash.c. Signed-off-by: Masanari Iida <[email protected]> [ Brian: fixed grammar in a spelling patch :) ] Signed-off-by: Brian Norris <[email protected]>
2015-03-30mtd: denali: Disable sub-page writes in Denali NAND driverGraham Moore1-0/+3
The Denali Controller IP does not support sub-page writes. Signed-off-by: Graham Moore <[email protected]> Signed-off-by: Dinh Nguyen <[email protected]> Signed-off-by: Brian Norris <[email protected]>
2015-03-30mtd: pxa3xx_nand: cleanup wait_for_completion handlingNicholas Mc Guire1-14/+10
return type of wait_for_completion_timeout is unsigned long not int, this patch uses the return value of wait_for_completion_timeout in the condition directly rather than assigning it to an incorrect type variable. The variable used for handling the return of wait_for_cmpletion_timeout was int but should be unsigned long, where it was not in use for anything else and the return value in case of completion (>0) is not used it was removed and wait_for_completion_timeout() used directly in the if condition. To make the timeout values a bit simpler to read and also handle all of the corner cases correctly the declarations are moved to msecs_to_jiffies(). The timeout declaration cleanup is just for readability Signed-off-by: Nicholas Mc Guire <[email protected]> Signed-off-by: Brian Norris <[email protected]>
2015-03-30mtd: nand: gpmi: Check for scan_bbt() errorFabio Estevam1-1/+3
In case of scan_bbt() failure, we should better propagate it. Signed-off-by: Fabio Estevam <[email protected]> Acked-by: Huang Shijie <[email protected]> Signed-off-by: Brian Norris <[email protected]>
2015-03-30mtd: nand: gpmi: fixup return type of wait_for_completion_timeoutNicholas Mc Guire1-6/+6
return type of wait_for_completion_timeout is unsigned long not int. The return variable is renamed to reflect its use and the type adjusted to unsigned long. Signed-off-by: Nicholas Mc Guire <[email protected]> Reviewed-by: Boris Brezillon <[email protected]> Acked-by: Huang Shijie <[email protected]> Signed-off-by: Brian Norris <[email protected]>
2015-03-30mtd: fsl-quadspi: cleanup wait_for_completion return handlingNicholas Mc Guire1-2/+1
return type of wait_for_completion_timeout is unsigned long not int, this patch uses the return value of wait_for_completion_timeout in the condition directly rather than adding a additional appropriately typed variable. Signed-off-by: Nicholas Mc Guire <[email protected]> Acked-by: Han Xu <[email protected]> Signed-off-by: Brian Norris <[email protected]>
2015-03-30mtd: fsl-quadspi: Print the error valueFabio Estevam1-4/+4
When displaying dev_err() messages it is useful to print the error value. Signed-off-by: Fabio Estevam <[email protected]> Acked-by: Han Xu <[email protected]> [Brian: fix up "can not" at the same time] Signed-off-by: Brian Norris <[email protected]>
2015-03-30mtd: cfi: clean up some indentingDan Carpenter1-15/+15
These lines were all indented one tab more than they should be. Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Brian Norris <[email protected]>
2015-03-30mtd: maps: sa1100-flash: remove incorrect __exit markupsDmitry Torokhov1-2/+2
Even if bus is not hot-pluggable, the devices can be unbound from the driver via sysfs, so we should not be using __exit annotations on remove() methods. The only exception is drivers registered with platform_driver_probe() which specifically disables sysfs bind/unbind attributes. Signed-off-by: Dmitry Torokhov <[email protected]> Signed-off-by: Brian Norris <[email protected]>
2015-03-30mtd: replace CONFIG_8xx by CONFIG_PPC_8xxChristophe Leroy1-1/+1
Two config options exist to define powerpc MPC8xx: * CONFIG_PPC_8xx * CONFIG_8xx In addition, CONFIG_PPC_8xx also defines CONFIG_CPM1 as communication co-processor arch/powerpc/platforms/Kconfig.cputype has contained the following comment about CONFIG_8xx item for some years: "# this is temp to handle compat with arch=ppc" It looks like not many places still have that old CONFIG_8xx used, so it is likely to be a good time to get rid of it completely ? Signed-off-by: Christophe Leroy <[email protected]> Signed-off-by: Brian Norris <[email protected]>
2015-03-30mtd: fsmc_nand.c: Use default timings if none are provided in the dtsStefan Roese1-1/+6
Without this patch the timings are all set to 0 if not specified in the dts. With this patch the driver falls back to use the defaults that are already present in the driver and are known to work okay for some (older) boards. Tested on a custom SPEAr600 based board. Signed-off-by: Stefan Roese <[email protected]> Acked-by: Linus Walleij <[email protected]> Cc: Viresh Kumar <[email protected]> Cc: Mian Yousaf Kaukab <[email protected]> Signed-off-by: Brian Norris <[email protected]>
2015-03-30jffs2: remove an unneeded conditionDan Carpenter1-1/+0
We know "rc" is set so there is no need to check again. Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Brian Norris <[email protected]>
2015-03-30mtd: nand: Prevent possible kernel lockup in nand_command()Roger Quadros1-4/+23
If a NAND device is not really present or pin muxes are not correctly configured we can lock up the kernel waiting infinitely for NAND_STATUS to be ready. This can be easily reproduced on TI's DRA7-evm board by booting it without NAND support in u-boot and disabling NAND pin muxes in the kernel. Add timeout when waiting for NAND_CMD_RESET completion. As per ONFi v4.0 tRST can be upto 250ms for EZ-NAND and 5ms for raw NAND. Signed-off-by: Roger Quadros <[email protected]> Tested-by: Nishanth Menon <[email protected]> Signed-off-by: Brian Norris <[email protected]>
2015-03-27mtd: spi-nor: factor out replace-able flash_{lock,unlock}Brian Norris2-19/+43
Flash lock/unlock is a flash-specific operations. Factor out a callback for it to more readily support other vendors. Signed-off-by: Brian Norris <[email protected]> Tested-by: VIET NGA DAO <[email protected]>
2015-03-24mtd: nand: fix spelling of REPLACEABLEBrian Norris1-1/+1
Signed-off-by: Brian Norris <[email protected]>
2015-03-24Documentation: devicetree: fix spelling in pxa3xx-nand bindingBrian Norris1-1/+1
Signed-off-by: Brian Norris <[email protected]>
2015-03-11mtd: clean up whitespace in linux/mtd/map.hArnd Bergmann1-18/+24
As the only comments I got for the "mtd: cfi: reduce stack size" patch were about whitespace changes, it appears necessary to fix up the rest of the file as well, which contains the exact same mistakes. Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Brian Norris <[email protected]>
2015-03-11mtd: cfi: reduce stack sizeArnd Bergmann1-1/+11
The cfi_staa_write_buffers function uses a large amount of kernel stack whenever CONFIG_MTD_MAP_BANK_WIDTH_32 is set, and that results in a warning on ARM allmodconfig builds: drivers/mtd/chips/cfi_cmdset_0020.c: In function 'cfi_staa_write_buffers': drivers/mtd/chips/cfi_cmdset_0020.c:651:1: warning: the frame size of 1208 bytes is larger than 1024 bytes [-Wframe-larger-than=] It turns out that this is largely a result of a suboptimal implementation of map_word_andequal(). Replacing this function with a straightforward one reduces the stack size in this function by exactly 200 bytes, shrinks the .text segment for this file from 27648 bytes to 26608 bytes, and makes the warning go away. Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Brian Norris <[email protected]>
2015-03-11mtd: nand: fully initialize mtd_oob_opsBrian Norris1-4/+4
We're not initializing the ooblen field. Our users don't care, since they check that oobbuf == NULL first, but it's good practice to zero unused fields out. We can drop the NULL initializations since we're memset()ing the whole thing. Noticed by Coverity, CID #200821, #200822 Signed-off-by: Brian Norris <[email protected]>
2015-03-11mtd: blkdevs: remove dead codeBrian Norris1-3/+0
The only exit (break) from the preceding loop is nested within a condition which yields req == NULL. This code is dead. Coverity CID #752669 Signed-off-by: Brian Norris <[email protected]>
2015-03-11mtd: nand: denali: drop dead codeBrian Norris1-3/+0
TclsRising is always 1. Caught by Coverity. Signed-off-by: Brian Norris <[email protected]> Cc: Masahiro Yamada <[email protected]>
2015-03-11mtd: nand: fixup bounds checks for nand_{lock,unlock}()Brian Norris1-2/+2
Coverity noticed that these 'ret' assignments weren't being used. Let's use them. Note that nand_lock() and nand_unlock() are still not officially used by any drivers. Coverity CIDs #1227054 and #1227037 Signed-off-by: Brian Norris <[email protected]>
2015-03-11mtd: tests: fix more potential integer overflowsBrian Norris5-10/+10
Caught by Coverity (CID #200625 and others) Signed-off-by: Brian Norris <[email protected]> Cc: Akinobu Mita <[email protected]>
2015-03-11mtd: onenand: drop dead codeBrian Norris1-9/+3
'ret' is always zero, so this is all dead code. This should quiet Coverity CID #1226739. Signed-off-by: Brian Norris <[email protected]> Cc: Kyungmin Park <[email protected]>
2015-03-11mtd: docg3: drop dead codeBrian Norris1-4/+1
If no devices were found, we would already have skipped over this code. Detected by Coverity, CID #744270 Signed-off-by: Brian Norris <[email protected]> Acked-by: Robert Jarzmik <[email protected]>
2015-03-11mtd: mxc-nand: Warn on unimplemented commandsUwe Kleine-König1-0/+4
The PARAM command was long unimplemented and it probably wasn't noticed because chip probing using only the few bytes returned by the READID command are good enough in most cases to determine the chip in use. Still to notice such a shortcoming earlier in the future would be nice in case it's something more vital. Signed-off-by: Uwe Kleine-König <[email protected]> Signed-off-by: Brian Norris <[email protected]>
2015-03-11mtd: mxc-nand: Implement support for PARAM commandUwe Kleine-König1-0/+7
The mxc-nand driver never supported the PARAM command to read out the ONFI parameter page and so always relied on probing my manufacturer and device id (as provided by the READID command). This patch implements reading out the first parameter page copy at least which should be good enough in practise. This makes the boot log change from nand: device found, Manufacturer ID: 0x2c, Chip ID: 0xb1 nand: Micron NAND 128MiB 1,8V 16-bit to nand: device found, Manufacturer ID: 0x2c, Chip ID: 0xb1 nand: Micron MT29F1G16ABBDAH4 on my machine. Signed-off-by: Uwe Kleine-König <[email protected]> Signed-off-by: Brian Norris <[email protected]>
2015-03-11mtd: mxc-nand: Allow to use column addresses different from 0Uwe Kleine-König1-11/+29
The mxc-nand controller works pagewise and so usually only sends commands to the flash chip with column == 0. A request with column != 0 from the upper layer is then fulfilled by indexing appropriately into the device's RAM buffer. To be able to access the ONFI marker at offset 0x20 in reply to the READID command however it's invalid to read 32 bytes starting from column 0. So let the function used to send the address cycles send the column address actually passed instead of 0 and fix all callers to pass 0 instead appropriately. Also add some warnings in case this patch changes the drivers semantics. Signed-off-by: Uwe Kleine-König <[email protected]> Signed-off-by: Brian Norris <[email protected]>
2015-03-11mtd: mxc-nand: Do the word to byte mangling in the read_byte callbackUwe Kleine-König1-24/+10
When the hardware operates in 16 bit mode it always reads 16 bits even for operations that only have the lower 8 bits defined. So the upper bits must be discarded. Do this in the read_byte callback instead of when reading the NAND id to support reading byte wise more than 5 bytes and at other occations (like reading the ONFI parameter page). Signed-off-by: Uwe Kleine-König <[email protected]> Signed-off-by: Brian Norris <[email protected]>
2015-03-11mtd: mxc-nand: Only enable hardware checksumming for fully detected flashesUwe Kleine-König1-7/+7
At least on i.MX25 (i.e. NFCv2) preset_v2 is called with mtd->writesize == 0 that is before the connect flash chip is detected. It then configures for 8 bit ECC mode which needs 26 bytes of OOB per 512 bytes main section. For flashes with a smaller OOB area issuing a read page command makes the controller stuck with this config. Note that this currently doesn't hurt because the first read page command is issued only after detection is complete and preset is called once more. Signed-off-by: Uwe Kleine-König <[email protected]> Signed-off-by: Brian Norris <[email protected]>
2015-03-11mtd: mxc-nand: Add a timeout when waiting for interruptUwe Kleine-König1-11/+36
While extending the mxc-nand driver it happend to me a few times that the device was stuck and this made the machine hang during boot. So implement a timeout and print a stack trace the first time this happens to make it debuggable. The return type of the waiting function is also changed to int to be able to handle the timeout in the caller. Signed-off-by: Uwe Kleine-König <[email protected]> Signed-off-by: Brian Norris <[email protected]>
2015-03-11mtd: atmel_nand: check NFC busy flag by HSMC_SR instead of NFC cmd regsBoris Brezillon2-3/+3
Currently the driver read NFC command registers to get NFC busy flag. Actually this flag also can be get by reading HSMC_SR register. Use the read NFC command registers need mapping a huge memory region. To save the mapped memory region, we change to check NFC busy flag by reading HSMC_SR register. Signed-off-by: Boris Brezillon <[email protected]> Signed-off-by: Josh Wu <[email protected]> Signed-off-by: Brian Norris <[email protected]>
2015-03-02mtd: atmel_nand: fix typo in dev_err error messageColin Ian King1-1/+1
Fix typo, "Unkown" -> "Unknown" Signed-off-by: Colin Ian King <[email protected]> Acked-by: Josh Wu <[email protected]> Signed-off-by: Brian Norris <[email protected]>
2015-02-28mtd: s3c2410: drop useless / misspelled debug printsBrian Norris1-3/+0
s3c2410_nand_probe is not the name of the function. These prints have little utility, so let's just kill them. Reported-by: Julia Lawall <[email protected]> Signed-off-by: Brian Norris <[email protected]>
2015-02-28mtd: pxa3xx_nand: initialiaze pxa3xx_flash_ids to 0Antoine Ténart1-0/+2
pxa3xx_flash_ids wasn't initialized to 0, which in certain cases could end up containing corrupted values in its members. Fix this to avoid possible issues. Signed-off-by: Antoine Tenart <[email protected]> Signed-off-by: Brian Norris <[email protected]>
2015-02-28Merge MTD updates into -nextBrian Norris1-0/+2
2015-02-28mtd: pxa3xx_nand: fix driver when num_cs is 0Robert Jarzmik1-0/+2
As the devicetree binding doesn't require num_cs to exist or be strictly positive, and neither does the platform data case, a bug appear when num_cs is set to 0 and panics the kernel. The issue is that in alloc_nand_resource(), chip is dereferenced without having a value assigned when num_cs == 0. Fix this by returning ENODEV is num_cs == 0. The panic seen is : Unable to handle kernel NULL pointer dereference at virtual address 000002b8 pgd = c0004000 [000002b8] *pgd=00000000 Internal error: Oops: 5 [#1] PREEMPT ARM Modules linked in: Hardware name: Marvell PXA3xx (Device Tree Support) task: c3822aa0 ti: c3826000 task.ti: c3826000 PC is at alloc_nand_resource+0x180/0x4a8 LR is at alloc_nand_resource+0xa0/0x4a8 pc : [<c0275b90>] lr : [<c0275ab0>] psr: 68000013 sp : c3827d90 ip : 00000000 fp : 00000000 r10: c3862200 r9 : 0000005e r8 : 00000000 r7 : c3865610 r6 : c3862210 r5 : c3924210 r4 : c3862200 r3 : 00000000 r2 : 00000000 r1 : 00000000 r0 : 00000000 Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment kernel Control: 0000397f Table: 80004018 DAC: 00000035 Process swapper (pid: 1, stack limit = 0xc3826198) Stack: (0xc3827d90 to 0xc3828000) ...zip... [<c0275b90>] (alloc_nand_resource) from [<c0275ff8>] (pxa3xx_nand_probe+0x140/0x978) [<c0275ff8>] (pxa3xx_nand_probe) from [<c0258c40>] (platform_drv_probe+0x48/0xa4) [<c0258c40>] (platform_drv_probe) from [<c0257650>] (driver_probe_device+0x80/0x21c) [<c0257650>] (driver_probe_device) from [<c0257878>] (__driver_attach+0x8c/0x90) [<c0257878>] (__driver_attach) from [<c0255ec4>] (bus_for_each_dev+0x58/0x88) [<c0255ec4>] (bus_for_each_dev) from [<c0256ec8>] (bus_add_driver+0xd8/0x1d4) [<c0256ec8>] (bus_add_driver) from [<c0257f14>] (driver_register+0x78/0xf4) [<c0257f14>] (driver_register) from [<c00088a8>] (do_one_initcall+0x80/0x1e4) [<c00088a8>] (do_one_initcall) from [<c048ed08>] (kernel_init_freeable+0xec/0x1b4) [<c048ed08>] (kernel_init_freeable) from [<c0377d8c>] (kernel_init+0x8/0xe4) [<c0377d8c>] (kernel_init) from [<c00095f8>] (ret_from_fork+0x14/0x3c) Code: e503b234 e5953008 e1530001 caffffd1 (e59002b8) ---[ end trace a5770060c8441895 ]--- Signed-off-by: Robert Jarzmik <[email protected]> Acked-by: Ezequiel Garcia <[email protected]> Signed-off-by: Brian Norris <[email protected]>
2015-02-28mtd: pxa3xx-nand: handle PIO in threaded interruptRobert Jarzmik1-3/+19
Change the handling of the data stage in the driver : don't pump data in the top-half interrupt, but rather schedule a thread for non dma cases. This will enable latencies in the data pumping, especially if delays are required. Moreover platform shall be more reactive as other interrupts can be served while pumping data. No throughput degradation was observed, at least on the zylonite platform, while a slight degradation was being expected. Signed-off-by: Robert Jarzmik <[email protected]> Tested-by: Maxime Ripard <[email protected]> Signed-off-by: Brian Norris <[email protected]>
2015-02-28Merge MTD updates into -nextBrian Norris1-6/+42
2015-02-28mtd: nand: pxa3xx: Fix PIO FIFO drainingMaxime Ripard1-6/+42
The NDDB register holds the data that are needed by the read and write commands. However, during a read PIO access, the datasheet specifies that after each 32 bytes read in that register, when BCH is enabled, we have to make sure that the RDDREQ bit is set in the NDSR register. This fixes an issue that was seen on the Armada 385, and presumably other mvebu SoCs, when a read on a newly erased page would end up in the driver reporting a timeout from the NAND. Cc: <[email protected]> # v3.14 Signed-off-by: Maxime Ripard <[email protected]> Reviewed-by: Boris Brezillon <[email protected]> Acked-by: Ezequiel Garcia <[email protected]> Signed-off-by: Brian Norris <[email protected]>
2015-02-26mtd: nand: sunxi: fix generic nand binding referenceBaruch Siach1-1/+1
Signed-off-by: Baruch Siach <[email protected]> Acked-by: Boris Brezillon <[email protected]> Signed-off-by: Brian Norris <[email protected]>
2015-02-23mtd: block2mtd: wait until block devices are presentedFelix Fietkau1-15/+43
Ensures that block2mtd is triggered after the block devices are enumerated at boot time. This issue is seen on BCM2835 (Raspberry Pi) systems when mounting JFFS2 block2mtd filesystems, probably because of the delay on enumerating a USB MMC card reader. Signed-off-by: Felix Fietkau <[email protected]> Signed-off-by: Rodrigo Freire <[email protected]> Signed-off-by: Herton Krzesinski <[email protected]> Signed-off-by: Brian Norris <[email protected]>