summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/devices
Commit message (Collapse)AuthorAgeFilesLines
* mtd: spi-nor: introduce SPI 1-2-2 and SPI 1-4-4 protocolsSteffen Trumtrar2019-05-081-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sync the driver with Linux v4.12 and apply the patch commit cfc5604c488ccd17936b69008af0c9ae050f4a08 Author: Cyrille Pitchen <cyrille.pitchen@atmel.com> AuthorDate: Tue Apr 25 22:08:46 2017 +0200 Commit: Cyrille Pitchen <cyrille.pitchen@wedev4u.fr> CommitDate: Mon May 15 21:56:17 2017 +0200 mtd: spi-nor: introduce SPI 1-2-2 and SPI 1-4-4 protocols This patch changes the prototype of spi_nor_scan(): its 3rd parameter is replaced by a 'struct spi_nor_hwcaps' pointer, which tells the spi-nor framework about the actual hardware capabilities supported by the SPI controller and its driver. Besides, this patch also introduces a new 'struct spi_nor_flash_parameter' telling the spi-nor framework about the hardware capabilities supported by the SPI flash memory and the associated settings required to use those hardware caps. Then, to improve the readability of spi_nor_scan(), the discovery of the memory settings and the memory initialization are now split into two dedicated functions. 1 - spi_nor_init_params() The spi_nor_init_params() function is responsible for initializing the 'struct spi_nor_flash_parameter'. Currently this structure is filled with legacy values but further patches will allow to override some parameter values dynamically, for instance by reading the JESD216 Serial Flash Discoverable Parameter (SFDP) tables from the SPI memory. The spi_nor_init_params() function only deals with the hardware capabilities of the SPI flash memory: especially it doesn't care about the hardware capabilities supported by the SPI controller. 2 - spi_nor_setup() The second function is called once the 'struct spi_nor_flash_parameter' has been initialized by spi_nor_init_params(). With both 'struct spi_nor_flash_parameter' and 'struct spi_nor_hwcaps', the new argument of spi_nor_scan(), spi_nor_setup() computes the best match between hardware caps supported by both the (Q)SPI memory and controller hence selecting the relevant settings for (Fast) Read and Page Program operations. Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com> Reviewed-by: Marek Vasut <marek.vasut@gmail.com> Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: spi-nor: remove unused write_enable from write_regSteffen Trumtrar2019-05-081-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | Based on the Linux v4.2 commit: commit f9f3ce835ddce3c669eee869253105f88819888b Author: Jagan Teki <jteki@openedev.com> AuthorDate: Wed Aug 19 15:26:44 2015 +0530 Commit: Brian Norris <computersforpeace@gmail.com> CommitDate: Fri Sep 11 16:04:55 2015 -0700 mtd: spi-nor: Zap unneeded write_enable from write_reg The 'write_enable' argument is unused and unneeded, so remove it from the API. Signed-off-by: Jagan Teki <jteki@openedev.com> Cc: David Woodhouse <dwmw2@infradead.org> Cc: Han Xu <han.xu@freescale.com> [Brian: fixed for nxp-spifi.c] Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: mtd_dataflash: Don't print bogus command values for READsAndrey Smirnov2018-07-021-3/+3
| | | | | | | | | | Call to dev_dbg in dataflash_read() is located to early, before command[] is initialize to correct values, so it end up printing values from previous invocation. Move it such that it prints current call's values. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: dataflash: Add flash_info for AT45DB641EAndrey Smirnov2017-06-201-0/+3
| | | | | | | | This is a backport of kernel commit 67e4145ebf2c161d7404770461b8404f00a6d3bf Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: dataflash: Make use of "extened device information"Andrey Smirnov2017-06-201-31/+58
| | | | | | | | | | | | | In anticipation of supporting chips that need it, extend the size of struct flash_info's 'jedec_id' field to make room 2 byte of extended device information as well as add code to fetch this data during jedec_probe(). This is a backport of kernel commit 1da8869a428317a6d3cd8d47184cf87feb34a98b Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: dataflash: Get rid of loop counter in jedec_probe()Andrey Smirnov2017-06-201-4/+4
| | | | | | | | | | | "For" loop in jedec_probe can be simplified to not need counter 'i'. Convert the code and get rid of the variable. This is a backport of kernel commit a296a1bc3eb54382d2a61d47529e71c9d3bc615e Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: dataflash: Replace pr_debug, printk with dev_* functionsAndrey Smirnov2017-06-201-42/+33
| | | | | | | | | | | | | | | | | | | | | Lion's share of calls to pr_debug in this driver follow the pattern of pr_debug("%s <message>", dev_name(<dev>), <arguments>), which should be semantically identical to dev_dbg(<dev>, "<message>", <arguments>), so replace such occurencies to simplify the code. Convert the small minority of pr_debug that do not follow pattern from above to use dev_dbg as well, for the sake of consistency. Convert similar patter of printk(KERN_ERR, "%s: ...", dev_name(...), ...) to use dev_err instead. No functional change intended. This is a backport of kernel commit 02f62864f6cebbbbff6bb611fddf78c1d05a9747 Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: dataflash: Improve coding style in jedec_probe()Andrey Smirnov2017-06-201-14/+17
| | | | | | | | | | | | | | | | | | | | | Change the following: - Replace indentation between type and name of local variable from tabs to spaces - Replace magic number 0x1F with CFI_MFR_ATMEL macro - Replace variable 'tmp' with 'ret' and 'i' where appropriate - Reformat multi-line comments and add newlines where appropriate No functional change intended. This is a backport of kernel commit 41c9c6621afa22c86fe74cf07536fd21c7719ca6 Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: dataflash: Replace C99 types with their kernel counterpartsAndrey Smirnov2017-06-201-20/+20
| | | | | | | | | | No functional change intended. This is a backport of kernel commit c41e43c6faf68a9b70afdb0dfee45d196c27031b Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: m25p80: add support for Everspin MR25H40Uwe Kleine-König2017-01-101-1/+1
| | | | | Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* string: Fix (v)asprintf prototypesSascha Hauer2016-04-151-2/+2
| | | | | | | | | | Our asprintf and vasprintf have different prototypes than the glibc functions. This causes trouble when we want to share barebox code with userspace code. Change the prototypes for (v)asprintf to match the glibc prototypes. Since the current (v)asprintf are convenient to use change the existing functions to b(v)asprintf. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: doc3: Fix wrong format specifierSascha Hauer2016-03-301-1/+1
| | | | | | Fixes: 1e009bf mtd: Make erase_info structs 64bit where necessary Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/mtd'Sascha Hauer2016-03-111-0/+2
|\
| * mtd: spi-nor: Match jedec,spi-norSascha Hauer2016-02-111-0/+2
| | | | | | | | | | | | | | | | It is recommended to use jedec,spi-nor instead of specifying the exact flash type (which is autodetected via Jedec ID anyway), so add the compatible entry to the driver. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | driver: replace dev_request_mem_region with dev_request_mem_resourceSascha Hauer2016-03-072-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dev_request_mem_region doesn't work properly one some SoCs on which PTR_ERR() values clash with valid return values from dev_request_mem_region. Replace them with dev_request_mem_resource where possible. This patch has been generated with the following semantic patch: // <smpl> @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); -if (IS_ERR(io)) { +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) { ... - return PTR_ERR(io); -} + return PTR_ERR(iores); +} +io = IOMEM(iores->start); ...+> } @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); -if (IS_ERR(io)) { +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) - return PTR_ERR(io); -} + return PTR_ERR(iores); +io = IOMEM(iores->start); ...+> } @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); -if (IS_ERR(io)) { - ret = PTR_ERR(io); +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) { + ret = PTR_ERR(iores); ... } +io = IOMEM(iores->start); ...+> } @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) + return PTR_ERR(iores); +io = IOMEM(iores->start); ...+> } @@ identifier func; @@ func(...) { <+... struct resource *iores; -struct resource *iores; ...+> } // </smpl> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | driver: Fix return check of dev_request_mem_regionSascha Hauer2016-02-231-2/+2
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dev_request_mem_region returns an ERR_PTR, fix places which check for a NULL pointer instead. This patch has been generated with this semantic patch, written by me and improved by Andrey Smirnov: // <smpl> @@ expression e; expression e1; @@ e = dev_request_mem_region(...); ... -if (!e) - return e1; +if (IS_ERR(e)) + return PTR_ERR(e); @ rule1 @ expression e; @@ e = dev_request_mem_region(...); @@ expression rule1.e; identifier ret, label; constant errno; @@ if (!e) { ... ( - ret = -errno; + ret = PTR_ERR(e); ... goto label; | - return -errno; + return PTR_ERR(e); ) } @depends on rule1@ expression rule1.e; @@ - if (e == NULL) + if (IS_ERR(e)) { ... } // </smpl> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
* mtd: m25p80: make it possible to use large blocks if desiredSascha Hauer2015-08-261-1/+5
| | | | | | | | | | Some SPI NOR flashes support 4K erase blocks. 4K erase blocks do not work with UBIFS which needs a minimum erase block size of 15360 bytes. Also bigger sectors are faster to erase. This patch adds a device tree option to use the bigger blocks instead of the default 4K blocks. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2015-07-031-18/+15
|\
| * mtd: m25p80: make flash_name constSascha Hauer2015-06-291-7/+4
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mtd: m25p80: Whitespace cleanupSascha Hauer2015-06-171-11/+11
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mtd: m25p80: Fix Kconfig dependenciesSascha Hauer2015-06-291-1/+2
|/ | | | | | | | | | The m25p80 driver now depends on MTD_SPI_NOR which is disabled in all defconfigs, so this effectively disables the m25p80 driver in all defconfigs. Fix this by selecting MTD_SPI_NOR which is library code without further dependencies. Also let m25p80 depend on SPI because it needs the SPI code and won't link without it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: m25p80: use the SPI nor frameworkSteffen Trumtrar2015-05-292-835/+166
| | | | | | | | | | | Use the spi-nor framework for the m25p80 driver to de-duplicate the code base and follow along with the linux kernel version, so bugfixes or features can be easier integrated. Based on the Linux v4.1-rc3 version of m25p80.c. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: m25p80: import ID for Winbond W25Q128FVSSI from linuxAntony Pavlov2015-04-141-0/+1
| | | | | | | | | | Winbond W25Q128FVSSI chip is used in Black Swift board, (see http://www.black-swift.com for details). Black Swift can run barebox for TP-LINK MR3020. Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* 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>
* mtd: m25p80: update Micron IDsSascha Hauer2014-05-151-2/+4
| | | | | | | Update Micron IDs from Linux-3.15-rc5. Skip n25q512a for now since it needs flag status polling. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: Update internal API to support 64-bit device sizeDmitry Lavnikevich2014-03-122-3/+4
| | | | | | | | | | | | | | | | | | | MTD internal API presently uses 32-bit values to represent device size. This patch updates them to 64-bits but leaves the external API unchanged. In general, changing from 32-bit to 64-bit values cause little or no changes to the majority of the code with the following exceptions: - printk message formats; - division and modulus of 64-bit values (mtd_div_by_wb, mtd_div_by_eb may be used in some of such cases). Was tested on phyFLEX i.MX6. Signed-off-by: Dmitry Lavnikevich <d.lavnikevich@sam-solutions.com> Signed-off-by: Grigory Milev <g.milev@sam-solutions.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: m25p80: set driver id_tableSascha Hauer2014-02-091-13/+15
| | | | | | | | This sets the id_table in the driver correctly so that the driver can match to the various types of flashes, not only "m25p80". Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
* treewide: Add missing includesSascha Hauer2013-11-082-0/+2
| | | | | | | | A lot of files rely on include/driver.h including include/of.h (and this including include/errno.h. include the files explicitly so we can eventually get rid of including of.h from driver.h Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: m25p80: Allow to specify devicename via devicetree aliasSascha Hauer2013-10-291-5/+16
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: Pass device_id to add_mtd_deviceSascha Hauer2013-10-293-5/+3
| | | | | | | | | Right now we do not support persistent names for mtd devices. The base name can be passed to add_mtd_device, but this is always appended with a dynamic number. With this patch add_mtd_device takes a device_id argument which can be used to create a mtd device with an exact name. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: rename MTD_OOB_* to MTD_OPS_*Sascha Hauer2013-07-221-13/+13
| | | | | | To sync with the Linux kernel. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: m25p80: add devicetree supportSascha Hauer2013-05-311-0/+9
| | | | | | Until we have spi device_id support match to "m25p80" for now. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: dataflash: Add devicetree probing supportSascha Hauer2013-05-211-0/+11
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Introduce device_spi_driver() macro and use it for SPI driversAlexander Shiyan2013-03-142-13/+2
| | | | | Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* SPI: Rename spi_register_driver() for using with register_driver_macro()Alexander Shiyan2013-03-142-2/+2
| | | | | Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Use new device_platform_driver() macro for driversAlexander Shiyan2013-02-131-7/+1
| | | | | Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/mtd'Sascha Hauer2013-02-041-0/+1
|\
| * mtd m25p80: Add support for w25q80blSascha Hauer2013-01-211-0/+1
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mtd m25p80: consistenly switch to dev_* messagesSascha Hauer2013-01-271-5/+6
|/ | | | | | Also, fix variable names in m25p80_write debug message. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Cleanup Kconfig filesAlexander Shiyan2012-12-081-4/+4
| | | | | | | | | This patch provides a global cleanup barebox Kconfig files. This includes replacing spaces to tabs, formatting in accordance format, removing extraneous lines and spaces. No functional changes. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* m25p80: sync flash support with the kernelJean-Christophe PLAGNIOL-VILLARD2012-11-201-9/+33
| | | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* m25p80: re-import it againt mtd_add_hostJean-Christophe PLAGNIOL-VILLARD2012-11-203-0/+965
| | | | | | | | | | | | so we now create the cdev via mtd This will also simplify sync with linux to avoid the m25p8000 or m25p00 the cdev is still named name m25p and the drivers m25p80 Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: dataflash: fix spi_transfer initJean-Christophe PLAGNIOL-VILLARD2012-11-021-0/+6
| | | | | | | | on some system as the spi_transfer is not set to 0 if the rx_buf or tx_buf are not used they are not set to NULL Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: add parent supportJean-Christophe PLAGNIOL-VILLARD2012-10-172-0/+3
| | | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: add dataflash supportJean-Christophe PLAGNIOL-VILLARD2012-10-153-0/+899
| | | | | | from linux 3.6 Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* switch all platform_bus device/driver registering to ↵Jean-Christophe PLAGNIOL-VILLARD2012-10-041-1/+1
| | | | | | | | platform_driver/device_register now register_driver and register_device are for bus only usage. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* mtd: docg3 fixes backport from Linux kernelRobert Jarzmik2012-04-171-13/+23
| | | | | | | | | | | | | | Backport 2 fixes back from Linux kernel (title verbatim from Linux kernel log) : - docg3 fix in-middle of blocks reads - docg3 reduce read alignment burden These 2 enable partial reads from the MTD (ie. read only the 111 first bytes), which enable linux kernel booting or UBIFS from barebox. Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* drivers/mtd: improve docg3 write speedRobert Jarzmik2012-03-131-2/+3
| | | | | | | | | | When programming or erasing a page, don't wait systematically for 3s, but finish the operation as soon as the hardware has finished, and timeout if 3 seconds have passed. Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* drivers/mtd: fix docg3 write supportRobert Jarzmik2012-01-271-2/+2
| | | | | | | Fix typo error in MTD_WRITE defines. Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* drivers/mtd: add docg3 chipRobert Jarzmik2012-01-024-0/+1500
Add the MSystem disk-on-chip G3 support, taken from the linux kernel with few amendments to bring it into barebox. Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>