summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/spi-nor/cadence-quadspi.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: spi-nor: cadence: fix csqpi corruption in cqspi_set_protocolIan Abbott2020-09-181-1/+5
| | | | | | | | | | | | cqspi_set_protocol() sets `inst_width`, `addr_width` and `data_width` for the previous chip-select in `cqspi->current_cs`, but that is initially set to -1, leading to corruption of other `cqspi->` members. Change it to set `inst_width`, `addr_width` and `data_width` for the chip-select associated with the `nor` parameter. Fixes: 5085d2ef3fbf ("mtd: spi-nor: cadence: add cqspi_set_protocol") Signed-off-by: Ian Abbott <abbotti@mev.co.uk> 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-56/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | 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: spi-nor: cadence: add cqspi_set_protocolSteffen Trumtrar2019-05-081-63/+113
| | | | | | | | | | | | | Sync up the driver with the original linux v4.7 driver version. As only Quad-SPI mode is/was supported, the function was not ported in the initial move to barebox. To make future synchronizations with the kernel driver easier, add this function and reorder the functions in the driver accordingly. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* drivers: Introduce dev_set_name()Andrey Smirnov2018-10-181-1/+1
| | | | | | | | Introduce dev_set_name() in order to hide implementation details of setting device's name so it'd be easier to change it. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: spi-nor: cadence: change devicetree bindings to upstreamSteffen Trumtrar2017-04-191-9/+6
| | | | | | | | | Upstream devicetree bindings where changed to use "cdns,is-decoded-cs" instead of "external-decoder". Use it. Also, get rid of the clock-names "qspi_clk" dependency. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* driver: replace dev_request_mem_region with dev_request_mem_resourceSascha Hauer2016-03-071-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* mtd: m25p80: make it possible to use large blocks if desiredSascha Hauer2015-08-261-1/+1
| | | | | | | | | | 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: spi-nor: add cadence quadspi driverSteffen Trumtrar2015-05-291-0/+1211
Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>