summaryrefslogtreecommitdiffstats
path: root/drivers/spi
AgeCommit message (Collapse)AuthorFilesLines
2016-01-13Merge tag 'spi-v4.5' of ↵Linus Torvalds23-177/+1387
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi Pull spi updates from Mark Brown: "A quiet release for SPI, not even many driver updates: - Add a dummy loopback driver for use in exercising framework features during development. - Move the test utilities to tools/ and add support for transferring data to and from a file instead of stdin and stdout to spidev_test. - Support for Mediatek MT2701 and Renesas AG5 deices" * tag 'spi-v4.5' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: (69 commits) spi: loopback: fix typo in MODULE_PARM_DESC spi: sun4i: Prevent chip-select from being activated twice before a transfer spi: loopback-test: spi_check_rx_ranges can get always done spi: loopback-test: rename method spi_test_fill_tx to spi_test_fill_pattern spi: loopback-test: write rx pattern also when running without tx_buf spi: fsl-espi: expose maximum transfer size limit spi: expose master transfer size limitation. spi: zynq: use to_platform_device() spi: cadence: use to_platform_device() spi: mediatek: Add spi support for mt2701 IC spi: mediatek: merge all identical compat to mtk_common_compat spi: mtk: Add bindings for mediatek MT2701 soc platform spi: mediatek: Prevent overflows in FIFO transfers spi: s3c64xx: Remove unused platform_device_id entries spi: use to_spi_device spi: dw: Use SPI_TMOD_TR rather than magic const 0 to set tmode spi: imx: defer spi initialization, if DMA engine is spi: imx: return error from dma channel request spi: imx: enable loopback only for ECSPI controller family spi: imx: fix loopback mode setup after controller reset ...
2016-01-11Merge remote-tracking branches 'spi/topic/sun4i', 'spi/topic/topcliff-pch' ↵Mark Brown4-15/+11
and 'spi/topic/zynq' into spi-next
2016-01-11Merge remote-tracking branches 'spi/topic/overlay', 'spi/topic/pxa2xx', ↵Mark Brown4-30/+37
'spi/topic/s3c64xx', 'spi/topic/sh-msiof' and 'spi/topic/spidev' into spi-next
2016-01-11Merge remote-tracking branches 'spi/topic/lm70llp', 'spi/topic/loopback', ↵Mark Brown7-45/+1216
'spi/topic/mtk' and 'spi/topic/omap2-mcspi' into spi-next
2016-01-11Merge remote-tracking branches 'spi/topic/dw', 'spi/topic/dw-mid', ↵Mark Brown5-37/+76
'spi/topic/fsl-espi' and 'spi/topic/imx' into spi-next
2016-01-11Merge remote-tracking branches 'spi/topic/bcm63xx', 'spi/topic/butterfly', ↵Mark Brown4-35/+25
'spi/topic/cadence' and 'spi/topic/davinci' into spi-next
2016-01-11Merge remote-tracking branch 'spi/topic/sunxi' into spi-nextMark Brown1-3/+3
2016-01-11Merge remote-tracking branch 'spi/topic/core' into spi-nextMark Brown1-2/+1
2016-01-11Merge remote-tracking branch 'spi/fix/mtk' into spi-linusMark Brown1-10/+18
2016-01-08spi: loopback: fix typo in MODULE_PARM_DESCDan Carpenter1-1/+1
There should be an 's' on "dump_message" so it matches the module_param. Fixes: 84e0c4e5e2c4 ('spi: add loopback test driver to allow for spi_master regression tests') Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-01-07spi: sun4i: Prevent chip-select from being activated twice before a transferMarcus Weseloh1-3/+3
The SPI core calls set_cs before a transfer, but the SUN4I_CTL_CS_MANUAL flag is only set in transfer_one. This leads to the following pattern on the chip-select line (with runtime power-management on every transfer, without it only on the first one): activate, deactivate, activate, transfer, deactivate Moving the configuration of the SUN4I_CTL_CS_MANUAL flag from transfer_one to set_cs removes the double activation. Signed-off-by: Marcus Weseloh <mweseloh42@gmail.com> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-01-05spi: loopback-test: spi_check_rx_ranges can get always doneMartin Sperl1-5/+14
The spi_check_rx_ranges can always get executed independent of if we have a real loopback situation. Signed-off-by: Martin Sperl <kernel@martin.sperl.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-01-05spi: loopback-test: rename method spi_test_fill_tx to spi_test_fill_patternMartin Sperl1-3/+4
Rename method spi_test_fill_tx to spi_test_fill_pattern to better describe what it does. Signed-off-by: Martin Sperl <kernel@martin.sperl.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-01-05spi: loopback-test: write rx pattern also when running without tx_bufMartin Sperl1-4/+4
Currently the rx_buf does not get set with the SPI_TEST_PATTERN_UNWRITTEN when tx_buf == NULL in the transfer. Reorder code so that it gets done also under this specific condition. Signed-off-by: Martin Sperl <kernel@martin.sperl.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-01-05spi: fsl-espi: expose maximum transfer size limitMichal Suchanek1-0/+6
The fsl-espi hardware can trasfer at most 64K data so report teh limitation. Based on patch by Heiner Kallweit <hkallweit1@gmail.com> CC: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Michal Suchanek <hramrach@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-01-05spi: zynq: use to_platform_device()Geliang Tang1-6/+2
Use to_platform_device() instead of open-coding it. Signed-off-by: Geliang Tang <geliangtang@163.com> Reviewed-by: Moritz Fischer <moritz.fischer@ettus.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-01-05spi: cadence: use to_platform_device()Geliang Tang1-4/+2
Use to_platform_device() instead of open-coding it. Signed-off-by: Geliang Tang <geliangtang@163.com> Reviewed-by: Moritz Fischer <moritz.fischer@ettus.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-01-01ACPI / spi: attach GPIO IRQ from ACPI description to SPI deviceChristophe RICARD1-0/+3
spi->irq was ignoring GpioInt property setting it to -1. acpi_dev_gpio_irq_get returns and configure the slave IRQ according to the ACPI slave node description. It is now inline with devicetree behavior. Acked-by: Mark Brown <broonie@kernel.org> Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-12-31spi: mediatek: Add spi support for mt2701 ICLeilk Liu1-0/+3
This patch adds spi support for mt2701 IC. Signed-off-by: Leilk Liu <leilk.liu@mediatek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-31spi: mediatek: merge all identical compat to mtk_common_compatLeilk Liu1-5/+10
This patch merge all identical compat into on mtk_common_compat and used for all compatible soc. Signed-off-by: Leilk Liu <leilk.liu@mediatek.com> Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-30spi: mediatek: Prevent overflows in FIFO transfersNicolas Boichat1-10/+18
In the case where transfer length is not a multiple of 4, KASAN reports 2 out-of-bounds memory accesses: - mtk_spi_interrupt: ioread32_rep writes past the end of trans->rx_buf. - mtk_spi_fifo_transfer: iowrite32_rep reads past the end of xfer->tx_buf. Fix this by using memcpy on the remainder of the bytes. Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-30spi: s3c64xx: Remove unused platform_device_id entriesSylwester Nawrocki1-6/+0
s5pv210 and exynos4 are now DT only platforms hence these entries can now be safely removed from the match table. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-23spi: use to_spi_deviceGeliang Tang1-2/+1
Use to_spi_device() instead of open-coding it. Signed-off-by: Geliang Tang <geliangtang@163.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-23spi: dw: Use SPI_TMOD_TR rather than magic const 0 to set tmodeJisheng Zhang1-1/+1
The TMODE available value is well defined and documented in the header file. Use it and remove the comment. Signed-off-by: Jisheng Zhang <jszhang@marvell.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-16Merge remote-tracking branches 'spi/fix/dspi' and 'spi/fix/spidev' into ↵Mark Brown2-7/+7
spi-linus
2015-12-16Merge remote-tracking branch 'spi/fix/core' into spi-linusMark Brown1-1/+1
2015-12-16spi: fix parent-device reference leakJohan Hovold1-1/+1
Fix parent-device reference leak due to SPI-core taking an unnecessary reference to the parent when allocating the master structure, a reference that was never released. Note that driver core takes its own reference to the parent when the master device is registered. Fixes: 49dce689ad4e ("spi doesn't need class_device") Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org
2015-12-16spi: spidev: Hold spi_lock over all defererences of spi in release()Mark Brown1-1/+1
We use the spi_lock spinlock to protect against races between the device being removed and file operations on the spidev. This means that in the removal path all references to the device need to be done under lock as in removal we dropping references to the device. Reported-by: Vegard Nossum <vegard.nossum@oracle.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-15spi: imx: defer spi initialization, if DMA engine isAnton Bondarenko1-0/+3
If SPI device supports DMA mode, but DMA controller is not yet available due to e.g. a delay in the corresponding kernel module initialization, retry to initialize SPI driver later on instead of falling back into PIO only mode. Signed-off-by: Anton Bondarenko <anton.bondarenko.sama@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-15spi: imx: return error from dma channel requestAnton Bondarenko1-11/+16
On SDMA initialization return exactly the same error, which is reported by dma_request_slave_channel_reason(), it is a preceding change to defer SPI DMA initialization, if SDMA module is not yet available. Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com> Signed-off-by: Anton Bondarenko <anton.bondarenko.sama@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-15spi: imx: enable loopback only for ECSPI controller familyAnton Bondarenko1-5/+6
Limit SPI_LOOP mode to ECSPI controller (iMX.51, iMX53 and i.MX6) only since there is no support in other families specific code for now. Signed-off-by: Anton Bondarenko <anton.bondarenko.sama@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-15spi: imx: fix loopback mode setup after controller resetAnton Bondarenko1-1/+3
If controller hold in reset it's not possible to write any register except CTRL. So all other registers must be updated only after controller bring out from reset. Signed-off-by: Anton Bondarenko <anton.bondarenko.sama@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-13spi: loopback: added additional non-power of 2 transfer lengthesMartin Sperl1-3/+4
Added additional transfer length to test that are not a power of 2. Signed-off-by: Martin Sperl <kernel@martin.sperl.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-13spi: loopback: match configuration of test to descriptionMartin Sperl1-1/+1
The test "two tx+rx transfers - alter second" actually modifies the first not the second transfer, which - in conjunction with testing the read data - results also in overwriting data read earlier. Signed-off-by: Martin Sperl <kernel@martin.sperl.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-13spi: loopback: fix printk format issues with size_tMartin Sperl1-3/+3
Fixes the reported printk format issues reported by kbuild-test-robot. Signed-off-by: Martin Sperl <kernel@martin.sperl.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-12spi: add spi-loopback-test to build frameworkMartin Sperl2-0/+10
adding the spi-loopback-test module to Kconfig and Makefile Signed-off-by: Martin Sperl <kernel@martin.sperl.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-12spi: add loopback test driver to allow for spi_master regression testsMartin Sperl2-0/+1130
This driver is submitting lots of distinct spi-messages messages with all kinds of alignments and length pattern. Also distinct kinds of transfer pattern tests are implemented (rx, tx, rx/tx, tx+tx, tx+rx,...) Right now on a raspberry pi 752 distinct spi_messages are executed in 13 different scenarios. Configuration of additional test-pattern is easy, so that when new bugs in drivers get detected the relevant transfer pattern can also get added to the test framework, so that such situations are detected in other drivers as well. The idea behind this driver is to make it possible to also detect regressions in spi_master implementations when changes occur. Potentially these tests could get executed automatically in a test-server-farm. Signed-off-by: Martin Sperl <kernel@martin.sperl.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-12spi: davinci: use dev_err() for error reportingSekhar Nori1-7/+7
Use dev_err() for reporting errors rather than dev_dbg(). Signed-off-by: Sekhar Nori <nsekhar@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-12spi: davinci: fix spurious i/o errorSekhar Nori1-1/+2
davinci_spi_bufs() uses wait_for_completion_interruptible() without bothering to handle -ERESTARTSYS. Due to this, sometime, it returns prematurely when a signal is received. Since the return value is never checked, userspace eventually receives a spurious -EIO. To fix this, use un-interruptible wait_for_completion_timeout(). Signed-off-by: Sekhar Nori <nsekhar@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-12spi-fsl-dspi: Fix CTAR Register accessBhuvanchandra DV1-6/+6
DSPI instances in Vybrid have a different amount of chip selects and CTARs (Clock and transfer Attributes Register). In case of DSPI1 we only have 2 CTAR registers and 4 CS. In present driver implementation CTAR offset is derived from CS instance which will lead to out of bound access if chip select instance is greater than CTAR register instance, hence use single CTAR0 register for all CS instances. Since we write the CTAR register anyway before each access, there is no value in using the additional CTAR registers. Also one should not program a value in CTAS for a CTAR register that is not present, hence configure CTAS to use CTAR0. Signed-off-by: Bhuvanchandra DV <bhuvanchandra.dv@toradex.com> Acked-by: Stefan Agner <stefan@agner.ch> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-07spi: lm70llp: remove printkSudip Mukherjee1-4/+4
Using pr_* macros are more prefferable than using printk. Start using pr_* family of macros and define pr_fmt to be used with it. While at it remove DRVNAME from an existing pr_info() as the name is now being printed by pr_fmt. Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-07spi: lm70llp: use dev_warnSudip Mukherjee1-4/+3
As we have a struct device available it is better to use dev_warn() instead of printk. Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-07spi: imx: add function to check for IMX51 family controllerAnton Bondarenko1-3/+8
Similar to other controller type checks add check function for IMX51. It includes IMX53 and IMX6. Signed-off-by: Anton Bondarenko <anton.bondarenko.sama@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-07spi: imx: replace multiple watermarks with single for RX, TX and RXTAnton Bondarenko1-16/+13
There is no need to have different watermarks levels since they are the same. Merge them into one WML parameter. Signed-off-by: Anton Bondarenko <anton.bondarenko.sama@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-07spi: imx: reorder HW operations enable order to avoid possible RX data lossAnton Bondarenko1-2/+10
The overflow may happen due to rescheduling for another task and/or interrupt if we enable SPI HW before starting RX DMA. So RX DMA enabled first to make sure data would be read out from FIFO ASAP. TX DMA enabled next to start filling TX FIFO with new data. And finaly SPI HW enabled to start actual data transfer. The risk rise in case of heavy system load and high SPI clock. Signed-off-by: Anton Bondarenko <anton.bondarenko.sama@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-07spi: imx: terminate RX DMA transaction in case of TX DMA timeoutAnton Bondarenko1-0/+1
Not only TX DMA should be terminated, but RX DMA also. It's required to avoid accidential DMA memory writes from RX DMA channel and properly terminate transaction. Signed-off-by: Anton Bondarenko <anton.bondarenko.sama@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-04spi: lm70llp: use new parport device modelSudip Mukherjee1-4/+8
Modify spi-lm70llp driver to use the new parallel port device model. Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-04spi: lm70llp: remove spaceSudip Mukherjee1-1/+1
checkpatch complains about space before closing brace. Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-04spi: lm70llp: correct alignmentSudip Mukherjee1-3/+3
checkpatch complains about the allignment with open parenthesis. Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-04spi: lm70llp: remove cast to voidSudip Mukherjee1-2/+2
checkpatch was complaining about space after cast. But the cast to void is not required at that place. Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Signed-off-by: Mark Brown <broonie@kernel.org>