summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/devices/m25p80.c
Commit message (Collapse)AuthorAgeFilesLines
* mtd: rename class_dev to devSascha Hauer2020-11-091-1/+1
| | | | | | | | The mtds own device is named 'dev' in the Kernel whereas it's named 'class_dev' in barebox. Rename it to 'dev' for better compatilibility to the Kernel. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: Use classdev->parentSascha Hauer2020-11-091-1/+1
| | | | | | | | | | Instead of mtd->parent we can use mtd->classdev.parent which points to the same device. With this we can remove the 'parent' member of struct mtd_info. This member exists in the Linux kernel as well, but is of type struct mtd_info, so this is done as preparation to re-add mtd->parent with the same type as in Linux. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: devices: m25p80: use the spi_mem_xx() APISteffen Trumtrar2019-05-081-82/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the barebox adoption of the linux v4.16 patch 4120f8d158ef904fb305b27e4a4524649faf3096 Author: Boris Brezillon <bbrezillon@kernel.org> AuthorDate: Thu Apr 26 18:18:19 2018 +0200 Commit: Mark Brown <broonie@kernel.org> CommitDate: Fri May 11 11:33:51 2018 +0900 mtd: spi-nor: Use the spi_mem_xx() API The spi_mem_xxx() API has been introduced to replace the spi_flash_read() one. Make use of it so we can get rid of spi_flash_read(). Note that using spi_mem_xx() also simplifies the code because this API takes care of using the regular spi_sync() interface when the optimized ->mem_ops interface is not implemented by the controller. Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com> Reviewed-by: Frieder Schrempf <frieder.schrempf@exceet.de> Tested-by: Frieder Schrempf <frieder.schrempf@exceet.de> Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* 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: 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>
* 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>
* 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>
* 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: use the SPI nor frameworkSteffen Trumtrar2015-05-291-834/+165
| | | | | | | | | | | 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: 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-121-2/+3
| | | | | | | | | | | | | | | | | | | 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-081-0/+1
| | | | | | | | 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-291-3/+1
| | | | | | | | | 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: 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>
* Introduce device_spi_driver() macro and use it for SPI driversAlexander Shiyan2013-03-141-6/+1
| | | | | 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-141-1/+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>
* 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-201-0/+937
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>