- 11 Sep, 2015 3 commits
-
-
Boris BREZILLON authored
nand_dt_init(), called from nand_scan_ident(), is already parsing the generic MTD/NAND DT properties, and initializing the nand_chip struct accordingly. Rely on this initialization instead of manually parsing those properties. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> [Brian: rename 'np' -> 'flash_node' to accomodate for prior rename patch] Signed-off-by: Brian Norris <computersforpeace@gmail.com>
-
Marek Vasut authored
Use a more descriptive name for the device_node element in struct nand_chip . This name matches the element name used for device_node property of a flash in the spi-nor framework. Signed-off-by: Marek Vasut <marex@denx.de> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
-
Marek Vasut authored
The problem this patch is trying to address is such, that SPI NOR flash devices attached to a dedicated SPI NOR controller cannot read their properties from the associated struct device_node. A couple of facts first: 1) Each SPI NOR flash has a struct spi_nor associated with it. 2) Each SPI NOR flash has certain device properties associated with it, for example the OF property 'm25p,fast-read' is a good pick. These properties are used by the SPI NOR core to select which opcodes are sent to such SPI NOR flash. These properties are coming from spi_nor .dev->of_node . The problem is, that for SPI NOR controllers, the struct spi_nor .dev element points to the struct device of the SPI NOR controller, not the SPI NOR flash. Therefore, the associated dev->of_node also is the one of the controller and therefore the SPI NOR core code is trying to parse the SPI NOR controller's properties, not the properties of the SPI NOR flash. Note: The m25p80 driver is not affected, because the controller and the flash are the same device, so the associated device_node of the controller and the flash are the same. This patch adjusts the SPI NOR core such that the device_node is not picked from spi_nor .dev directly, but from a new separate spi_nor .flash_node element. This let's the SPI NOR controller drivers set up a different spi_nor .flash_node element for each SPI NOR flash. This patch also fixes the controller drivers to be compatible with this modification and correctly set the spi_nor .flash_node element. This patch is inspired by 5844feea mtd: nand: add common DT init code Signed-off-by: Marek Vasut <marex@denx.de> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
-
- 09 Sep, 2015 2 commits
-
-
Brian Norris authored
-
Stefan Roese authored
nand_scan_ident() leaves the chip deselected. So just issuing some commands from the sunxi driver does not work. We need to select the chip before writing the commands to the NAND device. This patch takes care of this. Set the new timing on all dies implemented as suggested by Boris. This was detected on the in-circuit ICnova-A20 SoM equipped with the Micron MT29F32G08CBACAWP (4GiB) ONFI NAND device. Signed-off-by: Stefan Roese <sr@denx.de> Cc: Hans de Goede <hdegoede@redhat.com> Cc: Maxime Ripard <maxime.ripard@free-electrons.com> Cc: Roy Spliet <r.spliet@ultimaker.com> Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com> [Brian: fixup whitespace] Signed-off-by: Brian Norris <computersforpeace@gmail.com>
-
- 02 Sep, 2015 11 commits
-
-
Brian Norris authored
Commit 06bb6f5a ("mtd: spi-nor: stop (ab)using struct spi_device_id") converted an array into a pointer, which means that we should be checking if the pointer goes anywhere, not whether the C string is empty. To do the latter means we dereference a NULL pointer when we reach the terminating entry, for which 'name' is now NULL instead of an array { 0, 0, ... }. Sample crash: [ 1.101371] Unable to handle kernel NULL pointer dereference at virtual address 00000000 [ 1.109457] pgd = c0004000 [ 1.112157] [00000000] *pgd=00000000 [ 1.115736] Internal error: Oops: 5 [#1] SMP ARM [ 1.120345] Modules linked in: [ 1.123405] CPU: 3 PID: 1 Comm: swapper/0 Not tainted 4.2.0-next-20150902+ #61 [ 1.130611] Hardware name: Rockchip (Device Tree) [ 1.135306] task: ee0b8d40 ti: ee0ba000 task.ti: ee0ba000 [ 1.140697] PC is at spi_nor_scan+0x90/0x8c4 [ 1.144958] LR is at spi_nor_scan+0xa4/0x8c4 ... [ 1.504112] [<c03cc2e0>] (spi_nor_scan) from [<c03cb188>] (m25p_probe+0xc8/0x11c) [ 1.511583] [<c03cb188>] (m25p_probe) from [<c03cd9d8>] (spi_drv_probe+0x60/0x7c) [ 1.519055] [<c03cd9d8>] (spi_drv_probe) from [<c037faa0>] (driver_probe_device+0x1a0/0x444) [ 1.527478] [<c037faa0>] (driver_probe_device) from [<c037fec8>] (__device_attach_driver+0x94/0xa0) [ 1.536507] [<c037fec8>] (__device_attach_driver) from [<c037db3c>] (bus_for_each_drv+0x94/0xa4) [ 1.545277] [<c037db3c>] (bus_for_each_drv) from [<c037f7e4>] (__device_attach+0xa4/0x144) [ 1.553526] [<c037f7e4>] (__device_attach) from [<c0380058>] (device_initial_probe+0x1c/0x20) [ 1.562035] [<c0380058>] (device_initial_probe) from [<c037ec88>] (bus_probe_device+0x38/0x94) [ 1.570631] [<c037ec88>] (bus_probe_device) from [<c037ccf4>] (device_add+0x430/0x558) [ 1.578534] [<c037ccf4>] (device_add) from [<c03d0240>] (spi_add_device+0xe4/0x174) [ 1.586178] [<c03d0240>] (spi_add_device) from [<c03d0a24>] (spi_register_master+0x698/0x7d4) [ 1.594688] [<c03d0a24>] (spi_register_master) from [<c03d0ba0>] (devm_spi_register_master+0x40/0x7c) [ 1.603892] [<c03d0ba0>] (devm_spi_register_master) from [<c03d2fb4>] (rockchip_spi_probe+0x360/0x3f4) [ 1.613182] [<c03d2fb4>] (rockchip_spi_probe) from [<c0381e34>] (platform_drv_probe+0x58/0xa8) [ 1.621779] [<c0381e34>] (platform_drv_probe) from [<c037faa0>] (driver_probe_device+0x1a0/0x444) [ 1.630635] [<c037faa0>] (driver_probe_device) from [<c037fdc4>] (__driver_attach+0x80/0xa4) [ 1.639058] [<c037fdc4>] (__driver_attach) from [<c037e850>] (bus_for_each_dev+0x98/0xac) [ 1.647221] [<c037e850>] (bus_for_each_dev) from [<c037f448>] (driver_attach+0x28/0x30) [ 1.655210] [<c037f448>] (driver_attach) from [<c037ef74>] (bus_add_driver+0x128/0x250) [ 1.663200] [<c037ef74>] (bus_add_driver) from [<c0380c40>] (driver_register+0xac/0xf0) [ 1.671191] [<c0380c40>] (driver_register) from [<c0381d50>] (__platform_driver_register+0x58/0x6c) [ 1.680221] [<c0381d50>] (__platform_driver_register) from [<c0a467c8>] (rockchip_spi_driver_init+0x18/0x20) [ 1.690033] [<c0a467c8>] (rockchip_spi_driver_init) from [<c00098a4>] (do_one_initcall+0x124/0x1dc) [ 1.699063] [<c00098a4>] (do_one_initcall) from [<c0a19f84>] (kernel_init_freeable+0x218/0x2ec) [ 1.707748] [<c0a19f84>] (kernel_init_freeable) from [<c0719ed8>] (kernel_init+0x1c/0xf4) [ 1.715912] [<c0719ed8>] (kernel_init) from [<c000fe50>] (ret_from_fork+0x14/0x24) [ 1.723460] Code: e3510000 159f67c0 0a00000c e5961000 (e5d13000) [ 1.729564] ---[ end trace 95baa6b3b861ce25 ]--- Fixes: 06bb6f5a ("mtd: spi-nor: stop (ab)using struct spi_device_id") Signed-off-by: Brian Norris <computersforpeace@gmail.com> Cc: Rafał Miłecki <zajec5@gmail.com>
-
Ezequiel García authored
The driver supports board files specificating the flash device, by passing a pxa3xx_nand_flash struct (with flash parameters) in the platform data struct. Currently this support is not being used by any board file. Moreover, we'd like to deprecate such usage in favor of using the device table in nand_ids.c. So let's remove the ad-hoc flash specification. Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Acked-by: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
-
Brian Norris authored
We don't really need the flash information from the device tree here. Let's stick with autodetection here instead. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Acked-by: Han Xu <han.xu@freescale.com> Tested-by: Han Xu <han.xu@freescale.com>
-
Brian Norris authored
This reflects the proper layering, so let's do it. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Tested-by: Joachim Eastwood <manabian@gmail.com>
-
Brian Norris authored
This header can't actually stand alone, as it relies on the declaration (but not definition) of struct mtd_info. Let's fix that. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Tested-by: Joachim Eastwood <manabian@gmail.com>
-
Brian Norris authored
Layering suggests that the SPI NOR layer (not the hardware driver) should be initializing the MTD layer. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Tested-by: Joachim Eastwood <manabian@gmail.com>
-
Joachim Eastwood authored
This chip can be found on Hitex LPC4350 Evaluation Board. Signed-off-by: Joachim Eastwood <manabian@gmail.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
-
Jonas Gorski authored
According to the datasheet[1], both S25FL129P0 (256kB sectors) and S25FL129P1 (64kB sectors) support dual read, quad read, dual i/o read and quad i/o read. I have verified dual read to be working for S25FL129P1 on a dual capable spi controller. Quad as well as S25FL129P0 is untested, lacking hardware to verify. [1] http://www.spansion.com/Support/Datasheets/S25FL129P_00.pdfSigned-off-by: Jonas Gorski <jogo@openwrt.org> Reviewed-by: Marek Vasut <marex@denx.de> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
-
Roger Quadros authored
As both omap2 onenand and omap2 nand driver modules are named the same i.e. "omap2.ko", only one of them gets shipped during MODPOST if both are configured as loadable modules. To avoid this ambiguity let's ship the omap2 nand driver as "omap2_nand.ko" Reported by Pierre Neyron via github https://github.com/beagleboard/linux/issues/40 Cc: Robert Nelson <robertcnelson@gmail.com> Signed-off-by: Roger Quadros <rogerq@ti.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
-
Alexis Ballier authored
It is a 256KiB flash with 4 KiB erase sectors and 64KiB overlay blocks. This is the one available on Hardkernel's Odroid U3 shield. Signed-off-by: Alexis Ballier <aballier@gentoo.org> [Brian: seems like this does NOT require the usual SST_WRITE hacks] Signed-off-by: Brian Norris <computersforpeace@gmail.com>
-
Mika Westerberg authored
Add Micron (n25q064a) 8MB flash to the list of supported chips. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Reviewed-by: Jagan Teki <jteki@openedev.com> [Brian: fixup context] Signed-off-by: Brian Norris <computersforpeace@gmail.com>
-
- 27 Aug, 2015 1 commit
-
-
Roger Quadros authored
When vary_offset is set (e.g. test case 3), the offset is not always zero so memcmpshow() will show the wrong offset in the print message. To fix this we introduce a new function memcmpshowoffset() which takes offset as a parameter and displays the right offset and use it in the case where offset is non zero. The old memcmpshow() functionality is preserved by converting it into a macro with offset preset to 0. Signed-off-by: Roger Quadros <rogerq@ti.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
-
- 25 Aug, 2015 3 commits
-
-
Tomer Barletz authored
With gcc 5.1 I get: warning: switch condition has boolean value [-Wswitch-bool] Signed-off-by: Tomer Barletz <barletz@gmail.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
-
Rafał Miłecki authored
Using struct spi_device_id for storing list of flash devices comes from early SPI NOR framework days. Thanks to the commit 70f3ce05 ("mtd: spi-nor: make spi_nor_scan() take a chip type name, not spi_device_id") we can stop using spi_device_id and just switch to our own struct. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
-
Oleksij Rempel authored
Add the full description of the Toshiba TC58NVG0S3E NAND chip in the nand_ids table so that we can later use the NAND ECC info and ONFI timing mode in controller drivers. Tested with asm9260_nand driver. [Brian: driver still under review] Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
-
- 22 Aug, 2015 1 commit
-
-
Javier Martinez Canillas authored
The SPI core currently reports the MODALIAS uevent as "spi:<modalias>" even for SPI devices that were registered by OF. That means the OF module alias exported by MODULE_OF_TABLE(of,...) is currently not used and user-space has no way to autoload this module. But it is still a good practice to add the OF module alias information into the kernel module even when it currently is unused so once the SPI core is changed to report a correct OF modalias uevent, module autoloading will be working for this driver. Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
-
- 19 Aug, 2015 11 commits
-
-
Ezequiel García authored
The read ID count should be made as large as the maximum READ_ID size, so there's no need to have dynamic size. This commit sets the hardware maximum read ID count, which should be more than enough on all cases. Also, we get rid of the read_id_bytes, and use a macro instead. Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Acked-by: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
-
Robert Jarzmik authored
When 2 commands are submitted in a row, and the second is very quick, the completion of the second command might never come. This happens especially if the second command is quick, such as a status read after an erase. The issue is that in the interrupt handler, the status bits are cleared after the new command is issued. There is a small temporal window where this happens : - the previous command has set the command done bit - the ready for a command bit is set - the handler submits the next command - just then, the command completes, and the command done bit is still set - the handler clears the "previous" command done bit - the handler exits In this flow, the "command done" of the next command will never trigger a new interrupt to finish the status command, as it was cleared for both commands. Fix this by clearing the status bit before submitting a new command. Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr> Acked-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Tested-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
-
Robert Jarzmik authored
When the nand is first probe, and upon the first command start, the status bits should be cleared before the interrupts are unmasked. The bug is tricky : if the bootloader left a status bit set, the unmasking of interrupts does trigger the interrupt handler before the first command is issued, blocking the good behavior of the nand. The same would happen if in pxa3xx_nand code flow a status bit is left, and then a command is started. Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr> Acked-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Tested-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
-
Antoine Ténart authored
When keeping the configuration set by the bootloader (by using the marvell,nand-keep-config property), the pxa3xx_nand_detect_config() function is called and set the chunk size to 512 as a default value if NDCR_PAGE_SZ is not set. In the other case, when not keeping the bootloader configuration, no chunk size is set. Fix this by adding a default chunk size of 512. Fixes: 70ed8523 ("mtd: nand: pxa3xx: Introduce multiple page I/O support") Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com> Acked-by: Robert Jarzmik <robert.jarzmik@free> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
-
Axel Lin authored
Remove extra space after the "platform:" prefix and make the alias matches driver name. Signed-off-by: Axel Lin <axel.lin@ingics.com> Acked-by: Roger Quadros <rogerq@ti.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
-
Colin Ian King authored
static analysis by smatch caught the following error: drivers/mtd/maps/physmap_of.c:135 of_get_probes() error: potential null dereference 'res'. (kzalloc returns null) Check for failed kzalloc and return -ENOMEM in of_flash_probe if this occurs. Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
-
Alexey Khoroshilov authored
If mtd_device_register() fails in nettel_init(), iomap left mapped. The patch adds failure handling for mtd_device_register(). Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
-
Andy Shevchenko authored
It is better to have device name prefixed the actual error message. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
-
Andy Shevchenko authored
In recent kernels we have a lot of helper functions, including devres API, to make life of device driver developer easy. Convert the driver using devm_kzalloc() and pcim_enable_device(). Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
-
Andy Shevchenko authored
Let's use module_pci_driver() macro to reduce code base of the driver. There is no functional change. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
-
Andy Shevchenko authored
There is no need to user to see the core part of the driver. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
-
- 14 Aug, 2015 5 commits
-
-
Antony Pavlov authored
Spansion S25FL204K is a 4-Mbit 3.0V Serial Flash Memory with Uniform 4 kB Sectors. Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Acked-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
-
Fabio Estevam authored
The current "We only connect the NOR to this controller now." text is not very clear, so explain it better by saying that generic SPI is not supported by SPI_FSL_QUADSPI and only SPI NOR is. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
-
Joachim Eastwood authored
Add SPI-NOR driver for the SPI Flash Interface (SPIFI) controller that is found on newer NXP MCU devices. The controller supports serial SPI Flash devices with 1-, 2- and 4-bit width in either SPI mode 0 or 3. The controller can operate in either command or memory mode. In memory mode the Flash is exposed as normal memory and can be directly accessed by the CPU. Signed-off-by: Joachim Eastwood <manabian@gmail.com> Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
-
Joachim Eastwood authored
Add device tree binding documentation for the SPI Flash Interface (SPIFI) found on NXP LPC18xx and LPC43xx devies. Signed-off-by: Joachim Eastwood <manabian@gmail.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
-
Ezequiel Garcia authored
The initial buffer is used for the initial commands used to detect a flash device (STATUS, READID and PARAM). ONFI param page is 256 bytes, and there are three redundant copies to be read. JEDEC param page is 512 bytes, and there are also three redundant copies to be read. Hence this buffer should be at least 512 x 3. This commits rounds the buffer size to 2048. Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
-
- 07 Aug, 2015 1 commit
-
-
Axel Lin authored
While IS_ENABLED() is perfectly fine for CONFIG_* symbols, it is not for other symbols such as __BIG_ENDIAN that is provided directly by the compiler. Switch to use CONFIG_CPU_BIG_ENDIAN instead of __BIG_ENDIAN. Fixes: 27c5b17c ("mtd: nand: add NAND driver "library" for Broadcom STB NAND controller") Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
-
- 06 Aug, 2015 2 commits
-
-
Frank Li authored
Erase function will use cmd 0x20 (SPINOR_OP_BE_4K) if kenrel enable option CONFIG_MTD_SPI_NOR_USE_4K_SECTORS. This command is not in fsl-quadspi driver LUT. So driver continue report fsl-quadspi 21e0000.qspi: Unsupported cmd 0x20. This patch fix this issue. Signed-off-by: Frank Li <Frank.Li@freescale.com> Acked-by: Han Xu <Han.xu@freescale.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
-
Frank Li authored
The uboot may run the QuadSpi controler with command: #sf probe So we should reset the module in the probe. This patch also clear the pending interrupts which arised by the uboot code. Signed-off-by: Huang Shijie <shijie8@gmail.com> Signed-off-by: Frank Li <Frank.Li@freescale.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
-