summaryrefslogtreecommitdiffstats
path: root/drivers/spi
Commit message (Collapse)AuthorAgeFilesLines
...
| | * | | spi: dw: remove bits_per_word member of struct chip_dataAndy Shevchenko2015-10-191-14/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is no need to carry over spi->bits_per_word and Co from ->setup() in struct chip_data since ->transfer_one() will anyway take the transfer parameters from struct spi_transfer. This is since SPI core validates both bits_per_word transfer parameter and defaults to spi->bits_per_word in case that per transfer parameter is not set. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
| | * | | spi: dw: remove unneeded cr0 member of struct chip_dataAndy Shevchenko2015-10-191-12/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since we recalculate cr0 each time we start a transfer the chip_data->cr0 becomes redundant. Remove it and related pieces. This is a follow up to commit 0ed36990a93b (spi: dw: Remove needless if statements). Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
| | * | | spi: dw: use plain struct device * at earlier ->probe()Andy Shevchenko2015-10-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The name of the master device is set during registrationg which happens after we issue the error message. Change it to plain struct device * to see which device registration failed. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
| | * | | spi: dw: Remove test for non-zero spi->max_speed_hzJarkko Nikula2015-09-171-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Test for non-zero spi->max_speed_hz in dw_spi_setup() looks needless as spi_setup() defaults to master->max_speed_hz in case it is not set. This drivers sets the master->max_speed_hz based on max_freq data passed to it via dw_spi_add_host() call. I suppose things have already fallen apart if dw_spi_mmio_probe() or spi_pci_probe() ever passes zero max_freq. Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
| | * | | spi: dw: Remove needless if statementsJarkko Nikula2015-09-171-23/+18
| | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SPI core validates both bits_per_word and speed_hz transfer parameters and defaults to spi->bits_per_word and spi->max_speed_hz in case these per transfer parameters are not set. This allows to remove related if statements as they evaluate always to true and reduce indentation. Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
| * | | spi: spi-coldfire-qspi: enable RuntimePM before registering to the coreWolfram Sang2015-10-121-1/+2
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | The core may register clients attached to this master which may use funtionality from the master. So, RuntimePM must be enabled before, otherwise this will fail. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Mark Brown <broonie@kernel.org>
| | |
| \ \
| \ \
| \ \
| \ \
| \ \
| \ \
| \ \
*-------. \ \ Merge remote-tracking branches 'spi/topic/bcm53xx', 'spi/topic/bcm63xx', ↵Mark Brown2015-11-048-159/+237
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | 'spi/topic/bfin-sport', 'spi/topic/bfin5xx' and 'spi/topic/bitbang' into spi-next
| | | | | * | | spi: bitbang: switch to the generic implementation of transfer_one_messageHeiner Kallweit2015-10-051-89/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change the bitbang driver to use the generic implementation of transfer_one_message. This simplifies the bitbang driver code and provides benefits like the statistics in the generic implementation. Successfully tested on a IMX6-based system (spi-imx) and on a MIPS-based router (OpenWRT with spi-ath79). Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
| | | | | * | | spi: bitbang: remove unneeded checkHeiner Kallweit2015-10-051-14/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove an unneeded check. The SPI core (__spi_validate) takes care that these fields are always populated. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
| | | | | * | | spi: bitbang: Replace spinlock by mutexNicolas Boichat2015-09-173-14/+11
| | | | | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | chipselect (in the case of spi-gpio: spi_gpio_chipselect, which calls gpiod_set_raw_value_cansleep) can sleep, so we should not hold a spinlock while calling it from spi_bitbang_setup. This issue was introduced by this commit, which converted spi-gpio to cansleep variants: d9dda5a191 "spi: spi-gpio: Use 'cansleep' variants to access GPIO" Replacing the lock variable by a mutex fixes the issue: This is safe as all instances where the lock is used are called from contexts that can sleep. Finally, update spi-ppc4xx and and spi-s3c24xx to use mutex functions, as they directly hold the lock for similar purpose. Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
| | | | * | | spi: spi-bfin5xx: Calculate transfer speed unconditionallyJarkko Nikula2015-09-161-5/+1
| | | | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SPI core validates the transfer speed and defaults to spi->max_speed_hz in case the transfer speed is not set so code here won't use the chip->baud value (which is derived from spi->max_speed_hz). Please note driver uses chip->baud at the beginning of message transmission by calling the bfin_spi_restore_state() but then programs per transfer speed in bfin_spi_pump_transfers(). I'm not familiar with the HW so I don't know would it be possible to remove chip->baud completely by either using constant value in bfin_spi_restore_state() or by removing the baud register write there. Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
| | | * | | spi: bfin-sport: Calculate transfer speed unconditionallyJarkko Nikula2015-09-161-4/+1
| | | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SPI core validates the transfer speed and defaults to spi->max_speed_hz in case the transfer speed is not set so code here won't use the chip->baud value (which is derived from spi->max_speed_hz). Please note driver uses chip->baud at the beginning of message transmission by calling the bfin_sport_spi_restore_state() but then programs per transfer speed in bfin_sport_spi_pump_transfers(). I'm not familiar with the HW so I don't know would it be possible to remove chip->baud completely by either using constant value in bfin_sport_spi_restore_state() or by removing the tclkdiv register write there. Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
| | * | | spi/bcm63xx: move register definitions into the driverJonas Gorski2015-10-232-24/+175
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move all register definitions and structs into the driver. This allows us dropping the platform_data struct and drop any arch specific includes. Make use of different device names to identify the version of the block we have. Since we now have full control over the message width, we can drop the size check, which was broken anyway, since it never set ret to any error code. Also since we now have no arch depedendent resources, we can now allow compiling it for any arch, hidden behind COMPILE_TEST. Signed-off-by: Jonas Gorski <jogo@openwrt.org> Signed-off-by: Mark Brown <broonie@kernel.org>
| | * | | spi/bcm63xx: move message control word description to register offsetsJonas Gorski2015-10-121-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make the message control word parameters part of the register offsets array so we have them all in one struct. Signed-off-by: Jonas Gorski <jogo@openwrt.org> Signed-off-by: Mark Brown <broonie@kernel.org>
| | * | | spi/bcm63xx: fix standard accessors and compile guardJonas Gorski2015-10-121-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use the correct guard CONFIG_CPU_BIG_ENDIAN and the *be accessors to follow native endianness on big endian systems. Signed-off-by: Jonas Gorski <jogo@openwrt.org> Signed-off-by: Mark Brown <broonie@kernel.org>
| | * | | spi/bcm63xx: replace custom io accessors with standard onesJonas Gorski2015-09-141-4/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace all bcm_read* with (io)read. Due to this block following system endianness, make sure we match that. Signed-off-by: Jonas Gorski <jogo@openwrt.org> Signed-off-by: Mark Brown <broonie@kernel.org>
| | * | | spi/bcm63xx: hardcode busnum to 0Jonas Gorski2015-09-141-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We always pass 0 as the spi bus number, so we might as well hard code it. Signed-off-by: Jonas Gorski <jogo@openwrt.org> Signed-off-by: Mark Brown <broonie@kernel.org>
| | * | | spi/bcm63xx: always use a fixed number of CSJonas Gorski2015-09-141-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We always pass 8 for the number of chip selects, so we can as well hardcode it to this number. Signed-off-by: Jonas Gorski <jogo@openwrt.org> Signed-off-by: Mark Brown <broonie@kernel.org>
| | * | | spi/bcm63xx: remove unused rx_tail variableJonas Gorski2015-09-141-1/+0
| | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes the following warning: drivers/spi/spi-bcm63xx.c:125:5: warning: unused variable 'rx_tail' [-Wunused-variable] u8 rx_tail; ^ Signed-off-by: Jonas Gorski <jogo@openwrt.org> Signed-off-by: Mark Brown <broonie@kernel.org>
| * | | spi: bcm53xx: Adjust devm usageVaishali Thakkar2015-09-161-11/+2
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove use of spi_unregister_master in remove function as devm_spi_register_master in probe function automatically handles it. To be compatible with the change, use direct return instead of goto and remove unnedded label out. Also, remove bcm53xxspi_bcma_remove as it is now redundant. Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
| | |
| \ \
| \ \
| \ \
| \ \
| \ \
| \ \
| \ \
*-------. \ \ Merge remote-tracking branches 'spi/topic/ath97', 'spi/topic/atmel', ↵Mark Brown2015-11-047-36/+545
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | 'spi/topic/au1550', 'spi/topic/bcm2835' and 'spi/topic/bcm2835aux' into spi-next
| | | | | * | | spi: bcm2835aux: change initialization order and switch to platform_get_irqMartin Sperl2015-10-161-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change the initialization order of the HW so that the interrupt is only requested after the HW is initialized Also the use of irq_of_parse_and_map is replaced by platform_get_irq. Signed-off-by: Martin Sperl <kernel@martin.sperl.org> Signed-off-by: Mark Brown <broonie@kernel.org>
| | | | | * | | spi: bcm2835aux: fixed bad data on longer transfersMartin Sperl2015-10-161-12/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are strange issues with the auxiliary spi device that result in "lost" data in the RX path if the fifo is filled by too much (even though the status register is checked if new data can get filled in). This has been observed primarily for the interrupt case. Polling works fine, probably because the RX fifo is pulled immediately when in the tight polling loop. For that reason we have to limit the pending bytes to less than 15 when filling the fifo in interrupt mode. There also was an issue returning the "wrong" last 1/2 bytes of a transfer when the transfer is not a multiple of 3 bytes. (this impacted polling and interrupt modes) Also fixed an overflow in the estimation of the transfer time used to decide if we run in interrupt or polling mode (found with the spi-bcm2835.c driver originally). Reported-by: Georgii Staroselskii <georgii.staroselskii@emlid.com> Signed-off-by: Martin Sperl <kernel@martin.sperl.org> Signed-off-by: Mark Brown <broonie@kernel.org>
| | | | | * | | spi: bcm2835aux: add bcm2835 auxiliary spi device driverMartin Sperl2015-10-073-0/+505
| | | | | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The bcm2835 has 2 auxiliary spi bus masters spi1 and spi2. This implements the driver to enable these devices. The driver does not implement native chip-selects but uses the aribtrary GPIO-chip-selects provided by the spi-chipselect. Note that this driver relies on the fact that the clock is implemented by the clk-bcm2835-aux driver, which enables/disables the HW block when requesting/releasing the clock. Signed-off-by: Martin Sperl <kernel@martin.sperl.org> Acked-by: Eric Anholt <eric@anholt.net> Signed-off-by: Mark Brown <broonie@kernel.org>
| | | | * | | spi: bcm2835: change initialization order and switch to platform_get_irqMartin Sperl2015-10-161-7/+7
| | | | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change the initialization order of the HW so that the interrupt is only requested after the HW is initialized Also the use of irq_of_parse_and_map is replaced by platform_get_irq. Signed-off-by: Martin Sperl <kernel@martin.sperl.org> Signed-off-by: Mark Brown <broonie@kernel.org>
| | | * | | spi: au1550: Simplify au1550_spi_setupxfer()Jarkko Nikula2015-09-161-6/+5
| | | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SPI core validates both bits_per_word and speed_hz transfer parameters and defaults to spi->bits_per_word and spi->max_speed_hz in case these per transfer parameters are not set. This can simplify a little the au1550_spi_setupxfer() as there is need to check only for valid "struct spi_transfer" pointer. Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
| | * | | spi: atmel: Remove needless bits_per_word and speed_hz testsJarkko Nikula2015-09-251-15/+6
| | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SPI core validates both bits_per_word and speed_hz transfer parameters and defaults to spi->bits_per_word and spi->max_speed_hz in case these per transfer parameters are not set. This makes possible to remove two if statements and remove one code block that is never executed. Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
| * | | spi: ath79: simplify iomem resource mappingHeiner Kallweit2015-09-301-8/+3
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | Simplify the code by switching from devm_ioremap to devm_ioremap_resource. Checking the result of platform_get_resource is not needed as devm_ioremap_resource checks the provided resource argument for NULL. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* | | Merge remote-tracking branch 'spi/topic/doc' into spi-nextMark Brown2015-11-041-9/+93
|\ \ \
| * | | spi: fix kernel-doc warnings about missing return desc in spi.cJavier Martinez Canillas2015-10-241-9/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When building docs with make htmldocs, warnings about not having a description for the return value are reported, i.e: warning: No description found for return value of 'spi_register_driver' Fix these by following the kernel-doc conventions explained in Documentation/kernel-doc-nano-HOWTO.txt. Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
| | | |
| | \ \
| *-. \ \ Merge branches 'topic/core' and 'topic/stats' of ↵Mark Brown2015-10-241-8/+76
| |\ \ \ \ | | |_|_|/ | |/| | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi into spi-doc
| | | * | spi: add transfer histogram statistics via sysfsMartin Sperl2015-09-191-0/+61
| | | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | report transfer sizes as a histogram via the following files: /sys/class/spi_master/spi*/statistics/transfer_bytes_histo_* /sys/class/spi_master/spi*/spi*.*/statistics/transfer_bytes_histo_* Signed-off-by: Martin Sperl <kernel@martin.sperl.org> Signed-off-by: Mark Brown <broonie@kernel.org>
* | | | Merge remote-tracking branch 'spi/topic/davinci' into spi-nextMark Brown2015-11-041-11/+4
|\ \ \ \
| * | | | spi: davinci: use spi->cs_gpio directlyLuis de Bethencourt2015-10-161-11/+4
| | |_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use spi->cs_gpio directly to remove the following build warning: drivers/spi/spi-davinci.c:219:6: warning: 'gpio' may be used uninitialized in this function Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com> Suggested-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Mark Brown <broonie@kernel.org>
* | | | Merge remote-tracking branch 'spi/topic/core' into spi-nextMark Brown2015-11-041-8/+15
|\ \ \ \ | | |_|/ | |/| |
| * | | spi: core: use gpio_is_valid() helperAndy Shevchenko2015-10-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Check if GPIO pin is valid by API helper function. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
| * | | spi: core: propagate return code of __spi_validate_bits_per_word()Andy Shevchenko2015-10-161-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Propagate the actual return code of __spi_validate_bits_per_word() in spi_setup(). Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
| * | | spi: Map SPI OF client IRQ at probe timeJon Hunter2015-10-121-4/+10
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently the IRQs for SPI client devices, registered via device-tree, are mapped when the client devices are registered. If the corresponding irq-chip has not been probed yet, then the probing of the client device will fail and will not be retried. Resolve this by mapping the IRQ at probe time and allow the probe to be deferred if the IRQ is not yet available. If of_irq_get() returns an error that is not -EPROBE_DEFER, then assume that the SPI client does not have an IRQ and set the IRQ number to zero (which is equivalent to irq_of_parse_and_map()). This is based on some inputs from Thierry Reding <treding@nvidia.com>. Cc: Thierry Reding <treding@nvidia.com> Cc: Tomeu Vizoso <tomeu.vizoso@collabora.com> Signed-off-by: Jon Hunter <jonathanh@nvidia.com> Signed-off-by: Mark Brown <broonie@kernel.org>
| | |
| \ \
| \ \
| \ \
| \ \
| \ \
| \ \
| \ \
*-------. \ \ Merge remote-tracking branches 'spi/fix/atmel', 'spi/fix/imx', ↵Mark Brown2015-11-045-17/+62
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | 'spi/fix/omap2-mcspi', 'spi/fix/ti-qspi' and 'spi/fix/xilinx' into spi-linus
| | | | | * | | spi/spi-xilinx: Fix race condition on last word readRicardo Ribalda Delgado2015-10-291-14/+24
| | | | | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some users have reported that in polled mode the driver fails randomly to read the last word of the transfer. The end condition used for the transmissions (in polled and irq mode) has been the TX_EMPTY flag. But Lars-Peter Clausen has identified a delay from the TX_EMPTY to the actual end of the data rx. I believe that this race condition has not been detected until now because of the latency added by the IRQ handler or the PCIe bridge. This bugs affects setups with low latency access to the spi core. This patch replaces the readout logic: For all the words, except the last one, the TX_EMPTY flag is used (and cached). If !TX_EMPY or is the last word. The status register is read and the RX_EMPTY flag is used. The performance is not affected: there is an extra read of the Status Register, but the readout can start as soon as there is a word in the buffer. Reported-by: Edward Kigwana <ekigwana@scires.com> Initial-fix-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org
| | | | * | | spi: ti-qspi: Fix data corruption seen on r/w stress testVignesh R2015-10-121-2/+1
| | | | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Writing invalid command to QSPI_SPI_CMD_REG will terminate current transfer and de-assert the chip select. This has to be done before calling spi_finalize_current_message(). Because spi_finalize_current_message() will mark the end of current message transfer and schedule the next transfer. If the chipselect is not de-asserted before calling spi_finalize_current_message() then the next transfer will overlap with the previous transfer leading to data corruption. __spi_pump_message() can be called either from kthread worker context or directly from the calling process's context. It is possible that these two calls can race against each other. But race is serialized by checking whether master->cur_msg == NULL (pointer to msg being handled by transfer_one() at present). The master->cur_msg is set to NULL when spi_finalize_current_message() is called on that message, which means calling spi_finalize_current_message() allows __spi_sync() to pump next message in calling process context. Now if spi-ti-qspi calls spi_finalize_current_message() before we terminate transfer at hardware side, if __spi_pump_message() is called from process context then the successive transactions can overlap. Fix this by moving writing invalid command to QSPI_SPI_CMD_REG to before calling spi_finalize_current_message() call. Cc: stable@vger.kernel.org # v3.12+ Signed-off-by: Vignesh R <vigneshr@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
| | | * | | spi: omap2-mcspi: disable other channels CHCONF_FORCE in prepare_messageNeil Armstrong2015-10-221-0/+28
| | | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since the "Switch driver to use transfer_one" change, the cs_change behavior has changed and a channel chip select can still be asserted when changing channel from a previous last transfer in a message having the cs_change attribute. Since there is no sense having multiple chip select being asserted at the same time, disable all the remaining forced chip selects in a the prepare_message called right before a spi_transfer_one_message call. It ignores the current channel configuration in order to keep the possibility to leave the chip select asserted between messages. It fixes this bug on a DM8168 SoC ES2.1 Soc and an OMAP4 ES2.1 SoC. It was hanging all the other channels transfers when a CHCONF_FORCE is present on the wrong channel. Fixes: b28cb9414db9 ("spi: omap2-mcspi: Switch driver to use transfer_one") Signed-off-by: Neil Armstrong <narmstrong@baylibre.com> Reviewed-by: Michael Welling <mwelling@ieee.org> Signed-off-by: Mark Brown <broonie@kernel.org>
| | * | | spi: imx: fix ecspi mode setupAndrew Y. Kuksov2015-10-231-0/+7
| | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed problem with setting spi mode 0 or 1 after setting mode 2 or 3 SPI_MODE_0 and SPI_MODE_1 requires clock low when inactive. SPI_MODE_2 and SPI_MODE_3 requires clk high when inactive. Currently driver can just set bits in fields SCLK_PHA (SPI Clock/Data Phase Control), SCLK_POL (SPI Clock Polarity Control), SCLK_CTL (controls the inactive state of SCLK) ans SS_POL (SPI SS Polarity Select) of ECSPIx_CONFIGREG register. This patch allows driver to clear corresponding bits in these fields. Signed-off-by: Andrew Y. Kuksov <qxovxp@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
| * | | spi: atmel: Fix DMA-setup for transfers with more than 8 bits per wordDavid Mosberger-Tang2015-10-231-1/+2
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The DMA-slave configuration depends on the whether <= 8 or > 8 bits are transferred per word, so we need to call atmel_spi_dma_slave_config() with the correct value. Signed-off-by: David Mosberger <davidm@egauge.net> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org
* | | Merge remote-tracking branch 'spi/fix/core' into spi-linusMark Brown2015-11-041-2/+2
|\ \ \ | |_|/ |/| |
| * | spi: Setup the master controller driver before setting the chipselectFranklin S Cooper Jr2015-10-281-2/+2
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | SPI controllers may need to be properly setup before chip selects can be used. Therefore, wait until the spi controller has a chance to perform their setup procedure before trying to use the chip select. This also insures that the chip selects pins are in a good state before asseting them which otherwise may cause confusion. Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com> Tested-by: Grygorii Strashko <grygorii.strashko@ti.com> Tested-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> Signed-off-by: Mark Brown <broonie@kernel.org>
| |
| \
*-. \ Merge remote-tracking branches 'spi/fix/davinci' and 'spi/fix/sh-msiof' into ↵Mark Brown2015-10-071-3/+4
|\ \ \ | | |/ | | | | | | spi-linus
| * | spi: davinci: fix handling platform_get_irq resultAndrzej Hajda2015-09-251-3/+4
| |/ | | | | | | | | | | | | | | | | | | | | | | The function can return negative value. The problem has been detected using proposed semantic patch scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1]. [1]: http://permalink.gmane.org/gmane.linux.kernel/2046107 Signed-off-by: Andrzej Hajda <a.hajda@samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
| |
| \
*-. \ Merge remote-tracking branches 'spi/fix/spidev' and 'spi/fix/xtfpga' into ↵Mark Brown2015-09-222-3/+4
|\ \ \ | | | | | | | | | | | | spi-linus
| | * | spi: xtensa-xtfpga: fix register endiannessMax Filippov2015-09-221-2/+2
| | |/ | | | | | | | | | | | | | | | | | | | | | | | | XTFPGA SPI controller has native endian registers. Fix register acessors so that they work in big-endian configurations. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org
OpenPOWER on IntegriCloud