aboutsummaryrefslogtreecommitdiff
path: root/drivers/spi
AgeCommit message (Collapse)AuthorFilesLines
2013-08-28spi: altera: Simplify altera_spi_txrx implementation for noirq caseAxel Lin1-11/+4
This patch simplifies the code and makes it better in readability. Now the logic in the while loop is simply "write to ALTERA_SPI_TXDATA then read from ALTERA_SPI_TXDATA". There is a slightly logic change because now we avoid a read-write cycle when hw->len is 0. Since the code in bitbang library will call bitbang->txrx_bufs() only when t->len is not 0, this is not a problem. Signed-off-by: Axel Lin <[email protected]> Acked-by: Thomas Chou <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2013-08-27spi: spi-rspi: fix inconsistent spin_lock_irqsaveShimoda, Yoshihiro1-4/+6
This patch fixes the following Smatch warning: CHECK drivers/spi/spi-rspi.c drivers/spi/spi-rspi.c:606 rspi_work() warn: inconsistent returns spin_lock:&rspi->lock: locked (602) unlocked (606) drivers/spi/spi-rspi.c:606 rspi_work() warn: inconsistent returns irqsave:flags: locked (602) unlocked (606) Reported-by: Dan Carpenter <[email protected]> Signed-off-by: Yoshihiro Shimoda <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2013-08-27spi/qspi: Add compatible string for am4372.Sourav Poddar1-0/+1
Add a compatible string for am4372. Signed-off-by: Sourav Poddar <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2013-08-27spi/qspi: Fix device table entrySourav Poddar1-1/+1
Fix module device table entry. Without this, there will be a build failure while trying to build qspi as a module. Signed-off-by: Sourav Poddar <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2013-08-26spi/sirf: fix the misunderstanding about len of spi_transferQipan Li1-23/+24
the unit of len of spi_transfer is in bytes, not in spi words. the old codes misunderstood that and thought the len is the amount of spi words. but it is actually how many bytes existing in the spi buffer. this patch fixes that and also rename left_tx_cnt and left_rx_cnt to left_tx_word and left_rx_word to highlight they are in words. Signed-off-by: Qipan Li <[email protected]> Signed-off-by: Barry Song <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2013-08-23spi/qspi: Add dual/quad spi read supportSourav Poddar1-1/+12
Support for multiple lines in SPI framework has been picked[1]. [1]: http://comments.gmane.org/gmane.linux.kernel.spi.devel/14420 Hence, adapting ti qspi driver to support multiple data lines for read. Signed-off-by: Sourav Poddar <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2013-08-23Merge remote-tracking branch 'spi/topic/quad' into spi-qspiMark Brown1-1/+118
2013-08-23spi: sirf: fix error return code in spi_sirfsoc_probe()Wei Yongjun1-1/+5
Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function. Signed-off-by: Wei Yongjun <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2013-08-22spi: bcm2835: Add spi_master_get() call to prevent use after freeAxel Lin1-1/+1
The call to spi_unregister_master results in device memory being freed, it must no longer be accessed afterwards. Thus call spi_master_get() to get an extra reference to the device and call spi_master_put() only after the last access to device data. Note, current code has an extra spi_master_put() call in bcm2835_spi_remove(). Thus this patch just adds an spi_master_get() to balance the reference count. Signed-off-by: Axel Lin <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2013-08-22spi: Remove a redundant test for master->running in spi_queued_transferAxel Lin1-1/+1
We have tested master->running immediately after grab the master->queue_lock. The status of master->running won't be changed until we release the lock. Thus remove a redundant test for master->running. Signed-off-by: Axel Lin <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2013-08-22spi: conditional checking of mode and transfer bits.Sourav Poddar1-26/+30
There is a bug in the following patch: http://comments.gmane.org/gmane.linux.kernel.spi.devel/14420 spi: DUAL and QUAD support fix the previous patch some mistake below: 1. DT in slave node, use "spi-tx-nbits = <1/2/4>" in place of using "spi-tx-dual, spi-tx-quad" directly, same to rx. So correct the previous way to get the property in @of_register_spi_devices(). 2. Change the value of transfer bit macro(SPI_NBITS_SINGLE, SPI_NBITS_DUAL SPI_NBITS_QUAD) to 0x01, 0x02 and 0x04 to match the actual wires. 3. Add the following check (1)keep the tx_nbits and rx_nbits in spi_transfer is not beyond the single, dual and quad. (2)keep tx_nbits and rx_nbits are contained by @spi_device->mode example: if @spi_device->mode = DUAL, then tx/rx_nbits can not be set to QUAD(SPI_NBITS_QUAD) (3)if "@spi_device->mode & SPI_3WIRE", then tx/rx_nbits should be in single(SPI_NBITS_SINGLE) Checking of the tx/rx transfer bits and mode bits should be done conditionally based on type of buffer filled else EINVAL condition will always get hit either for rx or tx. Signed-off-by: Sourav Poddar <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2013-08-22spi: DUAL and QUAD supportwangyuhang1-0/+96
fix the previous patch some mistake below: 1. DT in slave node, use "spi-tx-nbits = <1/2/4>" in place of using "spi-tx-dual, spi-tx-quad" directly, same to rx. So correct the previous way to get the property in @of_register_spi_devices(). 2. Change the value of transfer bit macro(SPI_NBITS_SINGLE, SPI_NBITS_DUAL SPI_NBITS_QUAD) to 0x01, 0x02 and 0x04 to match the actual wires. 3. Add the following check (1)keep the tx_nbits and rx_nbits in spi_transfer is not beyond the single, dual and quad. (2)keep tx_nbits and rx_nbits are contained by @spi_device->mode example: if @spi_device->mode = DUAL, then tx/rx_nbits can not be set to QUAD(SPI_NBITS_QUAD) (3)if "@spi_device->mode & SPI_3WIRE", then tx/rx_nbits should be in single(SPI_NBITS_SINGLE) Signed-off-by: wangyuhang <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2013-08-22spi/qspi: Add qspi flash controllerSourav Poddar3-0/+570
The patch add basic support for the quad spi controller. QSPI is a kind of spi module that allows single, dual and quad read access to external spi devices. The module has a memory mapped interface which provide direct interface for accessing data form external spi devices. The patch will configure controller clocks, device control register and for defining low level transfer apis which will be used by the spi framework to transfer data to the slave spi device(flash in this case). Test details: ------------- Tested this on dra7 board. Test1: Ran mtd_stesstest for 40000 iterations. - All iterations went through without failure. Test2: Use mtd utilities: - flash_erase to erase the flash device - mtd_debug read to read data back. - mtd_debug write to write to the data flash. diff between the write and read data shows zero. Acked-by: Felipe Balbi<[email protected]> Reviewed-by: Felipe Balbi<[email protected]> Signed-off-by: Sourav Poddar <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2013-08-22spi: spi-efm32: remove redundant dev_err call in efm32_spi_probe()Wei Yongjun1-1/+0
There is a error message within devm_ioremap_resource already, so remove the dev_err call to avoid redundant error message. Signed-off-by: Wei Yongjun <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2013-08-22spi:Add Freescale DSPI driver for Vybrid VF610 platformChao Fu3-0/+565
The serial peripheral interface (SPI) module implemented on Freescale Vybrid platform provides a synchronous serial bus for communication between Vybrid and the external peripheral device. The SPI supports full-duplex, three-wire synchronous transfer, has TX/RX FIFO with depth of four entries. This driver is the SPI master mode driver and has been tested on Vybrid VF610TWR board. Signed-off-by: Alison Wang <[email protected]> Signed-off-by: Chao Fu <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2013-08-22spi: mpc512x: cleanup clock API useGerhard Sittig1-18/+30
cleanup the MPC512x SoC's SPI master's use of the clock API - get, prepare, and enable the MCLK during probe; disable, unprepare and put the MCLK upon remove; hold a reference to the clock over the period of use - fetch MCLK rate (reference) once during probe and slightly reword BCLK (bitrate) determination to reduce redundancy as well as to not exceed the maximum text line length - stick with the PPC_CLOCK 'psc%d_mclk' name for clock lookup, only switch to a fixed string later after device tree based clock lookup will have become available Signed-off-by: Gerhard Sittig <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2013-08-22spi: bfin-v3: remove unnecessary platform_set_drvdata()Jingoo Han1-2/+0
The driver core clears the driver data to NULL after device_release or on probe failure. Thus, it is not needed to manually clear the device driver data to NULL. Signed-off-by: Jingoo Han <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2013-08-22spi: spi-pl022: Fix warning when CONFIG_ARM_LPAE=yFabio Estevam1-2/+2
When CONFIG_ARM_LPAE=y the following build warning is generated: drivers/spi/spi-pl022.c:2178:9: warning: format '%x' expects argument of type 'unsigned int', but argument 2 has type 'resource_size_t' [-Wformat] According to Documentation/printk-formats.txt '%pa' can be used to properly print 'resource_size_t'. Reported-by: Kevin Hilman <[email protected]> Signed-off-by: Fabio Estevam <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2013-08-20spi/bitbang: trivial: fix doubled word "use"Uwe Kleine-König1-1/+1
Signed-off-by: Uwe Kleine-König <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
2013-08-20drivers/spi/spi-tegra114.c clean use of devm_ioremap_resource()Laurent Navet1-6/+1
Check of 'r' and calls to dev_err are already done in devm_ioremap_resource, so no need to do them twice. Signed-off-by: Laurent Navet <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2013-08-20spi: octeon: Convert to use bits_per_word_maskAxel Lin1-27/+1
Since commit 543bb25 "spi: add ability to validate xfer->bits_per_word in SPI core", the driver can set bits_per_word_mask for the master then the SPI core will reject transfers that attempt to use an unsupported bits_per_word value. So we can remove octeon_spi_validate_bpw() and let SPI core handle the checking. Signed-off-by: Axel Lin <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2013-08-20spi: octeon: Remove unused bits_per_word variable in octeon_spi_do_transferAxel Lin1-4/+0
Signed-off-by: Axel Lin <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2013-08-20spi: octeon: Remove empty octeon_spi_nop_transfer_hardware functionAxel Lin1-7/+0
Both prepare_transfer_hardware and unprepare_transfer_hardware callbacks are optional, so we don't need to implement an empty function for them. Signed-off-by: Axel Lin <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2013-08-15spi: bitbang: Remove unused tmp variableAxel Lin1-2/+0
Signed-off-by: Axel Lin <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2013-08-14spi: limit default transfer speed to controller's max speedGabor Juhos1-1/+6
Since the 'spi: Support transfer speed checking in the core' change, the SPI core validates the desired speed of a given transfer against the minimum and maximum speeds supported by the controller. If the speed of a transfer is not specified, the core uses the maximum speed of the actual SPI device. However if the maximum speed of the actual device is greater than the maximum speed of the controller, the core will reject the transfer due to the aforementioned change. Change the code to use the maximum speed of the controller by default if that is below the device's maximum speed. Signed-off-by: Gabor Juhos <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2013-08-14spi/sirf: simplify use of devm_ioremap_resourceJulia Lawall1-6/+1
Remove unneeded error handling on the result of a call to platform_get_resource when the value is passed to devm_ioremap_resource. Move the call to platform_get_resource adjacent to the call to devm_ioremap_resource to make the connection between them more clear. A simplified version of the semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // <smpl> @@ expression pdev,res,n,e,e1; expression ret != 0; identifier l; @@ - res = platform_get_resource(pdev, IORESOURCE_MEM, n); ... when != res - if (res == NULL) { ... \(goto l;\|return ret;\) } ... when != res + res = platform_get_resource(pdev, IORESOURCE_MEM, n); e = devm_ioremap_resource(e1, res); // </smpl> Signed-off-by: Julia Lawall <[email protected]> Acked-by: Barry Song <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2013-08-14spi/spi-{bcm63xx.c,bfin-v3.c}: simplify use of devm_ioremap_resourceJulia Lawall2-14/+2
Remove unneeded error handling on the result of a call to platform_get_resource when the value is passed to devm_ioremap_resource. Move the call to platform_get_resource adjacent to the call to devm_ioremap_resource to make the connection between them more clear. A simplified version of the semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // <smpl> @@ expression pdev,res,n,e,e1; expression ret != 0; identifier l; @@ - res = platform_get_resource(pdev, IORESOURCE_MEM, n); ... when != res - if (res == NULL) { ... \(goto l;\|return ret;\) } ... when != res + res = platform_get_resource(pdev, IORESOURCE_MEM, n); e = devm_ioremap_resource(e1, res); // </smpl> Signed-off-by: Julia Lawall <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2013-08-14spi/s3c64xx: Take runtime PM reference even if DMA is not supportedMark Brown1-20/+19
We always need the device to be runtime PM enabled to use it so just skip the DMA initialisation not the entire prepare when polling. Signed-off-by: Mark Brown <[email protected]>
2013-08-14Merge tag 'v3.11-rc5' into spi-s3c64xxMark Brown4-1/+42
Linux 3.11-rc5
2013-08-13spi-topcliff-pch: Add MODULE_DEVICE_TABLEAlexander Stein1-0/+2
Signed-off-by: Alexander Stein <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2013-08-11spi: s3c64xx: Use dmaengine_prep_slave_single() to prepare DMA transfersTomasz Figa1-9/+2
Since the driver supports only contiguous buffers, there is no need to manually construct a scatterlist with just a single entry, when there is a dedicated helper for this purpose. This patch modifies prepare_dma() function to use available helper instead of manually creating a scatterlist. Signed-off-by: Tomasz Figa <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2013-08-11spi: s3c64xx: Do not request CS GPIO on subsequent calls to .setup()Tomasz Figa1-11/+12
Comments in linux/spi/spi.h and observed behavior show that .setup() callback can be called multiple times without corresponding calls to .cleanup(), what was incorrectly assumed by spi-s3c64xx driver, leading to failures trying to request CS GPIO multiple times. This patch modifies the behavior of spi-s3c64xx driver to request CS GPIO only on first call to .setup() after last .cleanup(). Signed-off-by: Tomasz Figa <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2013-08-11spi: s3c64xx: Zero dma_slave_config struct in prepare_dma()Tomasz Figa1-0/+2
Not all fields of dma_slave_config struct are being initialized by prepare_dma() function, leaving those which are not in undefined state, which can confuse DMA drivers using them. This patch adds call to memset() to zero the struct before initializing a subset of its fields. Signed-off-by: Tomasz Figa <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2013-08-09spi: new controller driver for efm32 SoCsUwe Kleine-König3-0/+525
Signed-off-by: Uwe Kleine-König <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2013-08-09spi/bitbang: Drop empty setup() functionsMark Brown3-41/+0
Now that the bitbang core does not require a setup() function we can drop the check in the altera, nuc900 and xilinx drivers. Signed-off-by: Mark Brown <[email protected]>
2013-08-09spi/bitbang: don't error out if there is no setup callback providedUwe Kleine-König1-2/+1
It's perfectly valid not to have a setup callback when the probe routine does all the needed things. So don't even check for this case and trust the caller. Signed-off-by: Uwe Kleine-König <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2013-08-09Merge tag 'v3.11-rc4' into spi-bitbangMark Brown4-0/+44
Linux 3.11-rc4
2013-08-06spi: spi-mxs: Remove unused bits_per_word variableAxel Lin1-5/+0
The bits_per_word variable is not used after commit 24778be20f8 "spi: convert drivers to use bits_per_word_mask". Signed-off-by: Axel Lin <[email protected]> Acked-by: Marek Vasut <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2013-08-06spi/build: Remove SPI_SIRF from compile testMark Brown1-1/+1
It now needs the architecture dependant DMA driver. Signed-off-by: Mark Brown <[email protected]>
2013-08-06spi/sirf: Depends on SIRF_DMAMark Brown1-1/+1
Now that DMA support has been added to the driver it needs the architecture DMA driver to be built in order to link. Signed-off-by: Mark Brown <[email protected]>
2013-08-06spi: sirf: use DMA if both buffer address and length are alignedBarry Song1-23/+157
this patch enables DMA support for SiRFSoC SPI driver, if both buffers and length are aligned with DMA controller's hardware limitation, use generic SiRF generic dmaengine driver. for PIO, SiRF SPI controller actually is using rx to trigger rx, that means if we write any word to tx fifo, we will get a word from rx fifo. for DMA, we use two different channel for tx and rx, and issue them both for every transfer. Signed-off-by: Barry Song <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2013-08-05spi: octeon: Remove my_master pointer from struct octeon_spiAxel Lin1-6/+4
Pass master to platform_set_drvdata() then we can remove my_master pointer. Signed-off-by: Axel Lin <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2013-08-05spi: bcm2835: Use SPI_BPW_MASK macro for bits_per_word_mask settingAxel Lin1-1/+1
We have a SPI_BPW_MASK macro defined in spi.h, use it instead of open-coded. Signed-off-by: Axel Lin <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2013-08-02spi: rspi: provide port addresses to dmaengine driver via slave configurationGuennadi Liakhovetski1-1/+6
Don't rely on shdma dhaengine driver getting DMA slave addresses from its slave configuration. Instead provide those addresses, using a dmaengine_slave_config() call. Signed-off-by: Guennadi Liakhovetski <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2013-07-31spi/ep93xx: Fix format specifier warningEmil Goode1-1/+1
This patch fixes the following sparse warning by changing the the format specifier for size_t to %zu. drivers/spi/spi-ep93xx.c:512:3: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat] Signed-off-by: Emil Goode <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2013-07-31spi/atmel: Fix format specifier warningsEmil Goode1-9/+11
This patch fixes the following sparse warnings. dma_addr_t can be either u32 or u64 so we should cast to the largest type and use the format specifier %llx. drivers/spi/spi-atmel.c: In function ‘atmel_spi_next_xfer_dma_submit’: drivers/spi/spi-atmel.c:631:2: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 7 has type ‘dma_addr_t’ [-Wformat] drivers/spi/spi-atmel.c:631:2: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 9 has type ‘dma_addr_t’ [-Wformat] drivers/spi/spi-atmel.c: In function ‘atmel_spi_pdc_next_xfer’: drivers/spi/spi-atmel.c:734:3: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 7 has type ‘dma_addr_t’ [-Wformat] drivers/spi/spi-atmel.c:734:3: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 9 has type ‘dma_addr_t’ [-Wformat] drivers/spi/spi-atmel.c:773:3: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 7 has type ‘dma_addr_t’ [-Wformat] drivers/spi/spi-atmel.c:773:3: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 9 has type ‘dma_addr_t’ [-Wformat] Signed-off-by: Emil Goode <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2013-07-30spi/txx9: Use linux/gpio.h not asm/gpio.hMark Brown1-1/+1
Signed-off-by: Mark Brown <[email protected]>
2013-07-29spi: spi-davinci: Fix direction in dma_map_single()Christian Eggers1-1/+1
Commit 048177ce3b3962852fd34a7e04938959271c7e70 (spi: spi-davinci: convert to DMA engine API) introduced a regression: dma_map_single() is called with direction DMA_FROM_DEVICE for rx and for tx. Signed-off-by: Christian Eggers <[email protected]> Acked-by: Matt Porter <[email protected]> Signed-off-by: Mark Brown <[email protected]> Cc: [email protected] # v3.7.x+
2013-07-29spi/tegra20-slink: Use core runtime PMMark Brown1-25/+1
Signed-off-by: Mark Brown <[email protected]> Reviewed-by: Stephen Warren <[email protected]>
2013-07-29spi/tegra20-sflash: Use core runtime PMMark Brown1-25/+1
Signed-off-by: Mark Brown <[email protected]> Reviewed-by: Stephen Warren <[email protected]>