summaryrefslogtreecommitdiff
path: root/drivers/spi
AgeCommit message (Collapse)AuthorFilesLines
2016-05-24Merge tag 'spi-v4.7' of ↵Linus Torvalds23-285/+1975
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi Pull spi updates from Mark Brown: "Another quiet release for SPI, almost entirely driver specific changes with the diffstat dominated by two new drivers which are about two thirds of it in terms of lines of code: - new drivers for PIC32 standard and SQI controllers - the Cadence driver has had runtime PM support added and quite a few fixes and cleanups - flash-specific accelerated path support now has a feature query interface - the pxa2xx driver has been moved to use the core DMA mapping support" * tag 'spi-v4.7' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: (48 commits) spi: pic32-sqi: Fix linker error, undefined reference to `bad_dma_ops' spi: dw-pci: Spelling s/paltforms/platforms/g spi: pic32-sqi: Remove pic32_sqi_setup and pic32_sqi_cleanup spi: Fix simple typo s/impelment/implement spi: rockchip: potential NULL dereference on error spi: zynqmp: disable clocks in error paths spi: Drop unnecessary dependencies on relaxed I/O accessors spi: qup: Add spi_master_put in remove function spi: qup: Handle clocks in pm_runtime suspend and resume spi: st-ssc4: Fix missing spi_master_put in spi_st_probe error paths spi: st-ssc4: Allow compile test build spi: omap2-mcspi: Use dma_request_chan() for requesting DMA channel spi: davinci: Use dma_request_chan() for requesting DMA channel spi: pic32: Fix checking return value of devm_ioremap_resource spi: spi-fsl-dspi: Update DT binding documentation spi: Drop duplicate code to set master->dev.parent spi: pic32: Set proper bits_per_word_mask spi: return error if kmap'd buffers passed to spi_map_buf() spi: core: add hook flash_read_supported to spi_master spi: pic32-sqi: silence array overflow warning ...
2016-05-23Merge remote-tracking branch 'spi/topic/zynqmp' into spi-nextMark Brown1-1/+2
2016-05-23Merge remote-tracking branches 'spi/topic/pxa2xx', 'spi/topic/qup', ↵Mark Brown8-35/+50
'spi/topic/rockchip', 'spi/topic/st-ssc4' and 'spi/topic/xlp' into spi-next
2016-05-23Merge remote-tracking branches 'spi/topic/octeon', 'spi/topic/omap2-mcspi', ↵Mark Brown6-77/+1645
'spi/topic/orion', 'spi/topic/pic32' and 'spi/topic/pic32-qspi' into spi-next
2016-05-23Merge remote-tracking branches 'spi/topic/dw', 'spi/topic/flash-read', ↵Mark Brown4-8/+33
'spi/topic/fsl-dspi', 'spi/topic/fsl-espi' and 'spi/topic/kconfig' into spi-next
2016-05-23Merge remote-tracking branches 'spi/topic/bcm53xx', 'spi/topic/cadence', ↵Mark Brown6-162/+240
'spi/topic/davinci' and 'spi/topic/dln2' into spi-next
2016-05-23Merge remote-tracking branch 'spi/topic/core' into spi-nextMark Brown1-2/+5
2016-05-19Merge tag 'dmaengine-4.7-rc1' of git://git.infradead.org/users/vkoul/slave-dmaLinus Torvalds1-4/+4
Pull dmaengine updates from Vinod Koul: "This time round the update brings in following changes: - new tegra driver for ADMA device - support for Xilinx AXI Direct Memory Access Engine and Xilinx AXI Central Direct Memory Access Engine and few updates to this driver - new cyclic capability to sun6i and few updates - slave-sg support in bcm2835 - updates to many drivers like designware, hsu, mv_xor, pxa, edma, qcom_hidma & bam" * tag 'dmaengine-4.7-rc1' of git://git.infradead.org/users/vkoul/slave-dma: (84 commits) dmaengine: ioatdma: disable relaxed ordering for ioatdma dmaengine: of_dma: approximate an average distribution dmaengine: core: Use IS_ENABLED() instead of checking for built-in or module dmaengine: edma: Re-evaluate errors when ccerr is triggered w/o error event dmaengine: qcom_hidma: add support for object hierarchy dmaengine: qcom_hidma: add debugfs hooks dmaengine: qcom_hidma: implement lower level hardware interface dmaengine: vdma: Add clock support Documentation: DT: vdma: Add clock support for dmas dmaengine: vdma: Add config structure to differentiate dmas MAINTAINERS: Update Tegra DMA maintainers dmaengine: tegra-adma: Add support for Tegra210 ADMA Documentation: DT: Add binding documentation for NVIDIA ADMA dmaengine: vdma: Add Support for Xilinx AXI Central Direct Memory Access Engine Documentation: DT: vdma: update binding doc for AXI CDMA dmaengine: vdma: Add Support for Xilinx AXI Direct Memory Access Engine Documentation: DT: vdma: update binding doc for AXI DMA dmaengine: vdma: Rename xilinx_vdma_ prefix to xilinx_dma dmaengine: slave means at least one of DMA_SLAVE, DMA_CYCLIC dmaengine: mv_xor: Allow selecting mv_xor for mvebu only compatible SoC ...
2016-05-13spi: pic32-sqi: Fix linker error, undefined reference to `bad_dma_ops'.Purna Chandra Mandal1-0/+1
Even if DMA support is disabled code using DMA mapping APIs compiles fine, but fails in linking. ------- drivers/built-in.o: In function `ring_desc_ring_free': spi-pic32-sqi.c:(.text+0x2cfbe0): undefined reference to `bad_dma_ops' spi-pic32-sqi.c:(.text+0x2cfbe4): undefined reference to `bad_dma_ops' drivers/built-in.o: In function `pic32_sqi_probe': spi-pic32-sqi.c:(.text+0x2cfe48): undefined reference to `bad_dma_ops' spi-pic32-sqi.c:(.text+0x2cfeb0): undefined reference to `bad_dma_ops' spi-pic32-sqi.c:(.text+0x2cff38): undefined reference to `bad_dma_ops' -------- Correct dependency by adding 'depends on HAS_DMA' in Kconfig. Signed-off-by: Purna Chandra Mandal <purna.mandal@microchip.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-05-11spi: dw-pci: Spelling s/paltforms/platforms/gGeert Uytterhoeven1-1/+1
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-05-06Merge remote-tracking branches 'spi/fix/fsl-dspi', 'spi/fix/omap2-mcspi', ↵Mark Brown4-37/+76
'spi/fix/pxa2xx' and 'spi/fix/ti-qspi' into spi-linus
2016-05-06spi: pic32-sqi: Remove pic32_sqi_setup and pic32_sqi_cleanupAxel Lin1-41/+0
Current code does not use ctldata at all, so remove spi_set_ctldata call. spi_setup() will set spi->bits_per_word = 8 if it was not set, so remove !spi->max_speed_hz checking. The spi core allows absent of spi->max_speed_hz setting, if it was not set spi_setup() assigns spi->master->max_speed_hz to it. spi core allows spi->max_speed_hz > spi->master->max_speed_hz, in this case spi core will limit the transfer speed to ensure xfer->speed_hz won't greater than spi->master->max_speed_hz so remove checking if spi->max_speed_hz is higher than spi->master->max_speed_hz. As a result, both pic32_sqi_setup() and pic32_sqi_cleanup() can be removed. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-05-04spi: Fix simple typo s/impelment/implementMoritz Fischer1-1/+1
This fixes a simple typo in one of the comments. Signed-off-by: Moritz Fischer <moritz.fischer@ettus.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-05-04spi: rockchip: potential NULL dereference on errorDan Carpenter1-5/+4
We were calling dma_release_channel(rs->dma_tx.ch) when "rs->dma_tx.ch" is potentially NULL. There is actually a call to that in the unwind code at the bottom of the function so we can just re-arrange this a bit and remove the call. Also there is no need to set rs->dma_tx.ch to NULL on this error path. Fixes: e4c0e06f949b ('spi: rockchip: fix probe deferral handling') Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-05-04spi: zynqmp: disable clocks in error pathsShubhrajyoti Datta1-1/+2
The if pclk enable fails the refclk is not disabled. Fix the same. Signed-off-by: Shubhrajyoti Datta <shubhraj@xilinx.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-05-02spi: Drop unnecessary dependencies on relaxed I/O accessorsAxel Lin1-2/+0
The relaxed I/O accessors are available on all architectures now. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-05-02spi: qup: Add spi_master_put in remove functionPramod Gurav1-0/+2
Release memory allocated for spi master by calling spi_master_put in .remove function. Signed-off-by: Pramod Gurav <pramod.gurav@linaro.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-05-02spi: qup: Handle clocks in pm_runtime suspend and resumePramod Gurav1-0/+13
Clocks must ne disabled in pm_runtime to achieve some power saving. Enable the clocks when the device is runtime resumed during a transfer. Signed-off-by: Pramod Gurav <pramod.gurav@linaro.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-04-29spi: st-ssc4: Fix missing spi_master_put in spi_st_probe error pathsAxel Lin1-3/+5
Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-04-29spi: st-ssc4: Allow compile test buildAxel Lin1-1/+1
There is no build dependency for this driver, so enable COMPILE_TEST to get better build coverage. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-04-29spi: omap2-mcspi: Use dma_request_chan() for requesting DMA channelPeter Ujfalusi1-65/+18
With the new dma_request_chan() the client driver does not need to look for the DMA resource and it does not need to pass filter_fn anymore. By switching to the new API the driver can now support deferred probing against DMA. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-04-29spi: davinci: Use dma_request_chan() for requesting DMA channelPeter Ujfalusi1-52/+24
With the new dma_request_chan() the client driver does not need to look for the DMA resource and it does not need to pass filter_fn anymore. By switching to the new API the driver can now support deferred probing against DMA. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-04-29spi: pic32: Fix checking return value of devm_ioremap_resourceAxel Lin1-4/+3
devm_ioremap_resource() returns ERR_PTR on error. Also remove the redundant dev_err message, the implementation of devm_ioremap_resource() already print error messages on error paths. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-04-26spi: Drop duplicate code to set master->dev.parentAxel Lin3-3/+0
It's done by spi_alloc_master(). Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-04-26spi: pic32: Set proper bits_per_word_maskAxel Lin1-11/+2
This driver only supports 8/16/32 bits_per_word, so set master->bits_per_word_mask accordingly. With this change, we can remove the spi->bits_per_word checking in pic32_spi_setup as it's done by spi core. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-04-26spi: pxa2xx: Do not detect number of enabled chip selects on Intel SPTJarkko Nikula1-1/+1
Certain Intel Sunrisepoint PCH variants report zero chip selects in SPI capabilities register even they have one per port. Detection in pxa2xx_spi_probe() sets master->num_chipselect to 0 leading to -EINVAL from spi_register_master() where chip select count is validated. Fix this by not using SPI capabilities register on Sunrisepoint. They don't have more than one chip select so use the default value 1 instead of detection. Fixes: 8b136baa5892 ("spi: pxa2xx: Detect number of enabled Intel LPSS SPI chip select signals") Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org
2016-04-25spi: return error if kmap'd buffers passed to spi_map_buf()Vignesh R1-1/+3
Current spi_map_buf() implementation supports creates sg_table for vmalloc'd and kmalloc'd buffers. Therefore return error if kmap'd buffer (or any other buffer) is passed to spi_map_buf(). Signed-off-by: Vignesh R <vigneshr@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-04-22spi: pic32-sqi: silence array overflow warningDan Carpenter1-1/+1
We read one element beyond the end of the array when we access "rdesc[i + 1]" so it causes a static checker warning. It's harmless because we write over it again on the next line. But let's just silence the warning. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Purna Chandra Mandal <purna.mandal@microchip.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-04-22spi: spi-orion: enable the driver on ARCH_MVEBU platformsThomas Petazzoni1-1/+1
The SPI controller managed by the spi-orion is used on the new ARM64 Marvell Armada 7K/8K SoCs. In order to allow this driver to be built for this platform, we allow it to be selected for ARCH_MVEBU=y configurations. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-04-20spi: spi-pxa2xx: Remove CLK_IS_ROOTStephen Boyd1-2/+2
This flag is a no-op now (see commit 47b0eeb3dc8a "clk: Deprecate CLK_IS_ROOT", 2016-02-02) so remove it. Cc: Daniel Mack <daniel@zonque.org> Cc: Haojian Zhuang <haojian.zhuang@gmail.com> Cc: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-04-18spi: pic32-sqi: add SPI driver for PIC32 SQI controller.Purna Chandra Mandal3-0/+775
This driver implements SPI master interface for Quad SPI controller, specifically for accessing quad SPI flash. It uses descriptor-based DMA transfer mode and supports half-duplex communication for single, dual and quad SPI transactions. Signed-off-by: Purna Chandra Mandal <purna.mandal@microchip.com> Cc: Mark Brown <broonie@kernel.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-04-18spi: bcm53xx: add spi_flash_read callback for MMIO-based readsRafał Miłecki1-2/+76
This implements more efficient reads of SPI-attached flash content. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-04-18spi: cadence: mark pm functions __maybe_unusedArnd Bergmann1-2/+2
The newly added runtime PM support for the cadence spi driver causes harmless warnings when PM is disabled: drivers/spi/spi-cadence.c:681:12: warning: 'cnds_runtime_suspend' defined but not used drivers/spi/spi-cadence.c:652:12: warning: 'cnds_runtime_resume' defined but not used This adds __maybe_unused annotations to the respective functions to shut up the warnings, while leaving the code in place for compile testing and avoiding ugly #ifdefs. Fixes: d36ccd9f7ea4 ("spi: cadence: Runtime pm adaptation") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Shubhrajyoti Datta <shubhraj@xilinx.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-04-15spi: dln2: Pass of_node to spi masterCrestez Dan Leonard1-0/+3
This allows defining SPI devices connected to a DLN2 using devicetree. This already works for i2c because of a similar patch: 3b10db23: i2c: dln2: set the device tree node of the adapter Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com> Acked-by: Laurentiu Palcu <laurentiu.palcu@intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-04-13dmaengine: dw: rename masters to reflect actual topologyAndy Shevchenko1-4/+4
The source and destination masters are reflecting buses or their layers to where the different devices can be connected. The patch changes the master names to reflect which one is related to which independently on the transfer direction. The outcome of the change is that the memory data width is now always limited by a data width of the master which is dedicated to communicate to memory. The patch will not break anything since all current users have the same data width for all masters. Though it would be nice to revisit avr32 platforms to check what is the actual hardware topology in use there. It seems that it has one bus and two masters on it as stated by Table 8-2, that's why everything works independently on the master in use. The purpose of the sequential patch is to fix the driver for configuration of more than one bus. The change is done in the assumption that src_master and dst_master are reflecting a connection to the memory and peripheral correspondently on avr32 and otherwise on the rest. Acked-by: Hans-Christian Egtvedt <egtvedt@samfundet.no> Acked-by: Mark Brown <broonie@kernel.org> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2016-04-13spi: spi-ti-qspi: Handle truncated frames properlyBen Hutchings1-12/+20
We clamp frame_len_words to a maximum of 4096, but do not actually limit the number of words written or read through the DATA registers or the length added to spi_message::actual_length. This results in silent data corruption for commands longer than this maximum. Recalculate the length of each transfer, taking frame_len_words into account. Use this length in qspi_{read,write}_msg(), and to increment spi_message::actual_length. Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org
2016-04-13spi: spi-ti-qspi: Fix FLEN and WLEN settings if bits_per_word is overriddenBen Hutchings1-6/+9
Each transfer can specify 8, 16 or 32 bits per word independently of the default for the device being addressed. However, currently we calculate the number of words in the frame assuming that the word size is the device default. If multiple transfers in the same message have differing bits_per_word, we bitwise-or the different values in the WLEN register field. Fix both of these. Also rename 'frame_length' to 'frame_len_words' to make clear that it's not a byte count like spi_message::frame_length. Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org
2016-04-12spi: let SPI masters ignore their children for PMLinus Walleij1-0/+1
Let all SPI masters ignore their children: when it comes to power management: SPI children have no business doing keeping their parents awake: they are completely autonomous devices that just use their parent to talk, and the latter usecase must be power managed by the host itself on a per-message basis. Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-04-12spi: omap2-mcspi: Undo broken fix for dma transfer of vmalloced bufferAkinobu Mita1-17/+45
This reverts commit 3525e0aac91c4de5d20b1f22a6c6e2b39db3cc96. The DMA transfer for RX buffer was not handled correctly in this change. The actual transfer length for DMA RX can be less than xfer->len in the specific condition and the last words will be filled after the DMA completion, but the commit doesn't consider it and the dmaengine is started with rx_sg mapped by spi core. The solution for this at least requires more lines than this commit has inserted. So revert it for now. Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-04-06spi: cadence: Fix some checkpatch warningsShubhrajyoti Datta1-2/+4
No functional change. Fixing some style related issues CHECK: multiple assignments should be avoided + new_ctrl_reg = ctrl_reg = cdns_spi_read(xspi, CDNS_SPI_CR); CHECK: Alignment should match open parenthesis +static void cdns_spi_config_clock_freq(struct spi_device *spi, + struct spi_transfer *transfer) CHECK: Please use a blank line after function/struct/union/enum declarations +} +static int cdns_prepare_message(struct spi_master *master, Signed-off-by: Shubhrajyoti Datta <shubhraj@xilinx.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-04-05spi: spi-fsl-dspi: Fix cs_change handling in message transferAndrey Vostrikov1-2/+2
There are use cases when chip select should be triggered between transfers in single SPI message. Current implementation does this only on last transfer in message ignoring cs_change value provided in current transfer. Signed-off-by: Andrey Vostrikov <andrey.vostrikov@cogentembedded.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-04-05spi: cadence: Return the error code for cdns_spi_suspend and cdns_spi_resumeShubhrajyoti Datta1-7/+3
Return the error code for cdns_spi_suspend and cdns_spi_resume. Also fixes a comment where which claims that the error code is returned. Signed-off-by: Shubhrajyoti Datta <shubhraj@xilinx.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-04-05spi: cadence: Remove the clock enable and disable from suspend and resumeShubhrajyoti Datta1-19/+0
Now that the clocks are enabled and disabled per transaction , remove the clock enable and disable from resume and suspend hooks. Signed-off-by: Shubhrajyoti Datta <shubhraj@xilinx.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-04-05spi: cadence: Runtime pm adaptationShubhrajyoti Datta1-2/+68
Currently the clocks are enabled at probe and disabled at remove. This patch moves the clock enable to the start of transaction and disables at the end. Signed-off-by: Shubhrajyoti Datta <shubhraj@xilinx.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-04-05spi: cadance: Fix the DocumentationShubhrajyoti Datta1-1/+1
cdns_spi_chipselect has parameter is_high however the comment describes it as is_on. Also fixes the below warning. drivers/spi/spi-cadence.c:182: warning: No description found for parameter 'is_high' drivers/spi/spi-cadence.c:182: warning: Excess function parameter 'is_on' description in 'cdns_spi_chipselect' Signed-off-by: Shubhrajyoti Datta <shubhraj@xilinx.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-04-05spi: cadence: Fix probe error handlingShubhrajyoti Datta1-2/+2
The clock disabling is missed out in some error cases at probe. Fix the same. Signed-off-by: Shubhrajyoti Datta <shubhraj@xilinx.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-04-05spi: cadence: Remove _MASK and _OFFSET suffixShubhrajyoti Datta1-87/+74
Remove the _MASK and _OFFSET from the macros. It improves readability, removes some checkpatch error for exceeding 80 chars and also prevents some linebreaks. Signed-off-by: Shubhrajyoti Datta <shubhraj@xilinx.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-04-05spi: cadence: Fix a check patch warningShubhrajyoti Datta1-1/+1
CHECK: Comparison to NULL could be written "!master" + if (master == NULL) Signed-off-by: Shubhrajyoti Datta <shubhraj@xilinx.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-04-04Merge remote-tracking branches 'spi/fix/omap2' and 'spi/fix/rockchip' into ↵Mark Brown2-51/+27
spi-linus
2016-04-04Merge remote-tracking branch 'spi/fix/imx' into spi-linusMark Brown1-2/+14