aboutsummaryrefslogtreecommitdiff
path: root/drivers/spi
AgeCommit message (Collapse)AuthorFilesLines
2016-09-12spi: dw: round up result of calculation for clock dividerMatthias Seidel1-1/+1
Avoid ending up with a higher frequency than requested Signed-off-by: Matthias Seidel <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-12spi: fsl-espi: merge fsl_espi_bufs and fsl_espi_cpu_bufsHeiner Kallweit1-19/+8
fsl_espi_bufs and fsl_espi_cpu_bufs are very small that we can merge them. Signed-off-by: Heiner Kallweit <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-12spi: fsl-espi: improve return value handling in fsl_espi_bufsHeiner Kallweit1-4/+1
Return a proper status code from fsl_espi_bufs instead of returning the number of remaining words and let the caller evaluate it. Signed-off-by: Heiner Kallweit <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-12spi: fsl-espi: merge fsl_espi_cmd_trans and fsl_espi_rw_transHeiner Kallweit1-27/+6
fsl_espi_cmd_trans and fsl_espi_rw_trans share most of the code so we can merge them. Signed-off-by: Heiner Kallweit <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-12spi: fsl-espi: eliminate struct fsl_espi_transferHeiner Kallweit1-36/+20
The remaining elements of struct fsl_espi_transfer are part of struct spi_transfer anyway. So we can get rid of struct fsl_espi_transfer and use a struct spi_transfer only. Signed-off-by: Heiner Kallweit <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-12spi: fsl-espi: remove element actual_length from struct fsl_espi_transHeiner Kallweit1-6/+2
If an error occurs during processing the message, then we don't have to populate the actual_length element of struct message. So we can get rid of element actual_length in struct fsl_espi_transfer. Signed-off-by: Heiner Kallweit <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-12spi: fsl-espi: fix status handling in fsl_espi_do_one_msgHeiner Kallweit1-2/+5
If an error occurred during message handling return this error instead of always returning 0 and align the code with the generic implementation in spi_transfer_one_message. Signed-off-by: Heiner Kallweit <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-12spi: fsl-espi: remove element status from struct fsl_espi_transferHeiner Kallweit1-21/+26
Use the return values of the functions in the call chain to transport status information instead of using an element in struct fsl_espi_transfer for this. This is more in line with the general approach how to handle status information and is one step further to eventually get rid of struct fsl_espi_transfer completely. Signed-off-by: Heiner Kallweit <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-12spi: fsl-espi: factor out filling the local bufferHeiner Kallweit1-22/+24
Better structure the code by factoring out filling the local buffer. In addition don't initialize the complete local buffer at the beginning of fsl_espi_do_one_msg. Instead move initialization of those parts of the local buffer to be used for transfers w/o tx_buf to fsl_espi_copy_to_buf. Signed-off-by: Heiner Kallweit <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-12spi: fsl-espi: pre-allocate message bufferHeiner Kallweit2-23/+19
Currently the driver allocates a 64kb buffer for each single message. On systems with little and fragmented memory this can result in memory allocation errors. Solve this by pre-allocating a buffer. This patch was developed in OpenWRT long ago, however it never made it upstream. I slightly modified the original patch to re-initialize the buffer at the beginning of each transfer. Signed-off-by: Gabor Juhos <[email protected]> Signed-off-by: Felix Fietkau <[email protected]> Signed-off-by: Heiner Kallweit <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-06Merge remote-tracking branches 'spi/fix/lock', 'spi/fix/maintainers', ↵Mark Brown6-6/+12
'spi/fix/put', 'spi/fix/pxa2xx', 'spi/fix/sh-msiof' and 'spi/fix/timeout' into spi-linus
2016-09-06spi: fsl-espi: remove unneeded check in fsl_espi_do_transHeiner Kallweit1-2/+1
SPI core takes care that both values are always populated. Signed-off-by: Heiner Kallweit <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-06spi: fsl-espi: simplify fsl_espi_setup_transferHeiner Kallweit1-3/+1
Simplify fsl_espi_setup_transfer a little. Signed-off-by: Heiner Kallweit <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-06spi: fsl-espi: remove unused elements n_rx and n_tx in struct fsl_espi_transferHeiner Kallweit1-11/+1
Both elements are not used, so remove them. Signed-off-by: Heiner Kallweit <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-06spi: dw: fix multiple slaves with different baudratesMatthias Seidel2-8/+8
Add current master clock to dws struct and compare it against the requestedtransfer speed. Update clock divider only if necessary. Signed-off-by: Matthias Seidel <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-03spi: Prevent unexpected SPI time out due to arithmetic overflowSien Wu1-2/+6
When reading SPI flash as MTD device, the transfer length is directly passed to the spi driver. If the requested data size exceeds 512KB, it will cause the time out calculation to overflow since transfer length is 32-bit unsigned integer. This issue is resolved by using 64-bit unsigned integer to perform the arithmetic. Signed-off-by: Sien Wu <[email protected]> Acked-by: Brad Keryan <[email protected]> Acked-by: Gratian Crisan <[email protected]> Acked-by: Brad Mouring <[email protected]> Natinst-ReviewBoard-ID 150232 Signed-off-by: Mark Brown <[email protected]>
2016-09-01spi: qup: skip clk_disable_unprepare if the device is already runtime suspendedSudeep Holla1-2/+4
If the spi device is already runtime suspended, if spi_qup_suspend is executed during suspend-to-idle or suspend-to-ram it will result in the a splat from unpreparing a non-prepared clock. This patch fixes the issue by executing clk_disable_unprepare conditionally in spi_qup_suspend. [Reworded commit message to remove irrelevant backtrace -- broonie] Signed-off-by: Sudeep Holla <[email protected]> Tested-by: Andy Gross <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-01spi: fsl-espi: remove unneeded variable in fsl_espi_do_transHeiner Kallweit1-15/+8
Creating a message, adding one transfer, and then iterating over all transfers in the message doesn't make sense. We can simply use the original transfer directly. Signed-off-by: Heiner Kallweit <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-01spi: fsl-espi: add missing static declaration to fsl_espi_cpu_irqHeiner Kallweit1-1/+1
Add missing static declaration to fsl_espi_cpu_irq. Signed-off-by: Heiner Kallweit <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-01spi: fsl-espi: change return type of fsl_espi_cpu_bufs to voidHeiner Kallweit1-6/+2
fsl_espi_cpu_bufs always returns 0, so change the return type to void. Signed-off-by: Heiner Kallweit <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-01spi: fsl-espi: change return type of fsl_espi_setup_transfer to voidHeiner Kallweit1-15/+4
fsl_espi_setup_transfer always returns 0, so change the return type to void. Signed-off-by: Heiner Kallweit <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-01spi: fsl-espi: dont include irq.hHeiner Kallweit1-1/+0
irq.h isn't needed and it even shouldn't be included, see comment at the beginning of this header file. Signed-off-by: Heiner Kallweit <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-01spi: loopback-test: mark rx_ranges_cmp() staticBaoyou Xie1-1/+1
We get 1 warning when building kernel with W=1: drivers/spi/spi-loopback-test.c:408:5: warning: no previous prototype for 'rx_ranges_cmp' [-Wmissing-prototypes] In fact, this function is only used in the file in which it is declared and don't need a declaration, but can be made static. So this patch marks it 'static'. Signed-off-by: Baoyou Xie <[email protected]> Acked-by: Arnd Bergmann <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-01spi: sh-msiof: Use ARCH_SHMOBILE instead of SUPERHGeert Uytterhoeven1-1/+1
"spi_sh_msiof" is used on sh7723 and sh7724 only. As all of the above select ARCH_SHMOBILE, restrict its driver dependencies from SUPERH to ARCH_SHMOBILE. Signed-off-by: Geert Uytterhoeven <[email protected]> Reviewed-by: Simon Horman <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-01spi: sc18is602: Add reset control via gpio pin.Phil Reid1-0/+9
This sc18is602 has a reset pin that may need to be deasserted. Add optional binding to specifiy the reset pin via a gpio and deassert during probe. Signed-off-by: Phil Reid <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-08-24spi: spi-cavium-thunderx: Add missing clk_disable_unprepare()Wei Yongjun1-0/+2
Add the missing clk_disable_unprepare() before return in the probe error handling case and remove. Signed-off-by: Wei Yongjun <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-08-24spi: pxa2xx-pci: fix ACPI-based enumeration of SPI devicesAndy Shevchenko1-0/+1
Slave devices are not enumerated by ACPI data because the ACPI handle for the core driver is NULL if it was enumerated by PCI. Propagate firmware node handle of the PCI device to the platform device. Suggested-by: Mika Westerberg <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-08-22spi: spi-fsl-dspi: Drop extra spi_master_put in device remove functionWei Yongjun1-1/+0
The call sequence spi_alloc_master/spi_register_master/spi_unregister_master is complete; it reduces the device reference count to zero, which and results in device memory being freed. The subsequent call to spi_master_put is unnecessary and results in an access to free memory. Drop it. Fixes: 9298bc727385 ("spi: spi-fsl-dspi: Remove spi-bitbang") Signed-off-by: Wei Yongjun <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-08-22spi: spi-fsl-dspi: Check clk_prepare_enable() errorFabio Estevam1-2/+7
clk_prepare_enable() may fail, so we should better check its return value and propagate it in the case of failure. Signed-off-by: Fabio Estevam <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-08-19spi: octeon: Add ThunderX driverJan Glauber4-0/+130
Add ThunderX SPI driver using the shared part from the Octeon driver. The main difference of the ThunderX driver is that it is a PCI device so probing is different. The system clock settings can be specified in device tree. Signed-off-by: Jan Glauber <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-08-18spi: spi-txx9: Add missing clock (un)prepare calls for CCFGeert Uytterhoeven1-3/+3
While the custom minimal TXx9 clock implementation doesn't need or use clock (un)prepare calls (they are dummies if !CONFIG_HAVE_CLK_PREPARE), they are mandatory when using the Common Clock Framework. Hence add them, to prepare for the advent of CCF. Signed-off-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-08-18spi: fsl-espi: eliminate spi nor flash read loopHeiner Kallweit1-70/+21
The fsl-espi driver contains a read loop that implicitely assumes that the device to read from is a m25p80 SPI NOR flash (bytes 2 - 4 of the first write transfer are interpreted as 3 byte flash address). Now that we have such a read loop in the spi-nor driver and are able to correctly indicate the message size limit of the controller, the read loop can be removed from the fsl-espi driver. Signed-off-by: Heiner Kallweit <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-08-17spi: spi-ti-qspi: Add DMA support for QSPI mmap readVignesh R1-17/+122
Use mem-to-mem DMA to read from flash when reading in mmap mode. This gives improved read performance and reduces CPU load. With this patch the raw-read throughput is ~16MB/s on DRA74 EVM. And CPU load is <20%. UBIFS read throughput ~13 MB/s. Signed-off-by: Vignesh R <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-08-17spi: Add support to handle kmap'd buffers in spi_map_buf()Vignesh R1-3/+14
JFFS2 FS might sometime provide kmap'd buffers as destination buffers to read data from flash. Update spi_map_buf() function to generate sg_list for such buffers, so that SPI controllers drivers can use DMA to read data into such buffers. Signed-off-by: Vignesh R <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-08-16spi: spi-fsl-dspi: fix a possible NULL dereferenceLABBE Corentin1-3/+1
of_match_device could return NULL, and so cause a NULL pointer dereference later. For fixing this problem, we use of_device_get_match_data(), this will simplify the code a little by using a standard function for getting the match data. Reported-by: coverity (CID 1324129) Signed-off-by: LABBE Corentin <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-08-16spi: spi-fsl-dspi: constify devtype_dataLABBE Corentin1-2/+2
of_id->data is const, so instead of casting the pointer to drop its const status, this patch constify the devtype_data pointer. Signed-off-by: LABBE Corentin <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-08-09spi: Drop io_mutex in error pathsMark Brown1-0/+2
A couple of error paths were missing drops of io_mutex. Reported-by: Julia Lawall <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-08-09spi: xlp: Add ACPI support for Vulcan SPI controllerKamlakant Patel1-1/+12
Add ACPI support for SPI controller on Broadcom Vulcan ARM64. Signed-off-by: Kamlakant Patel <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-08-09spi: jcore: remove unnecessary platform_set_drvdata()Wei Yongjun1-1/+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: Wei Yongjun <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-08-08spi: rspi: Increase accuracy of bit rate for RZChris Brandt1-2/+12
When you leave the clock divider at 0, 130kHz is the lowest you can go. Also, by adjusting the clock divider you can get more accurate resolutions for clock speeds lower than 16MHz. This patch uses the clock divider as part of the bit rate setup. Signed-off-by: Chris Brandt <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-08-08spi: pic32-sqi: use list_move_tail and list_moveWei Yongjun1-4/+2
Using list_move_tail() and list_move() to simplify the code. Signed-off-by: Wei Yongjun <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-08-08spi: add driver for J-Core SPI controllerRich Felker3-0/+240
The J-Core "spi2" device is a PIO-based SPI master controller. It differs from "bitbang" devices in that that it's clocked in hardware rather than via soft clock modulation over gpio, and performs byte-at-a-time transfers between the cpu and SPI controller. This driver will be extended to support future versions of the J-Core SPI controller with DMA transfers when they become available. Signed-off-by: Rich Felker <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-08-05spi: sh-msiof: Avoid invalid clock generator parametersGeert Uytterhoeven1-0/+3
The conversion from a look-up table to a calculation for clock generator parameters forgot to take into account that BRDV x 1/1 is valid only if BRPS is x 1/1 or x 1/2, leading to undefined behavior (e.g. arbitrary clock rates). This limitation is documented for the MSIOF module in all supported SH/R-Mobile and R-Car Gen2/Gen3 ARM SoCs. Tested on r8a7791/koelsch and r8a7795/salvator-x. Fixes: 65d5665bb260b034 ("spi: sh-msiof: Update calculation of frequency dividing") Signed-off-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-08-01Merge tag 'armsoc-dt' of ↵Linus Torvalds1-31/+5
git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc Pull ARM DT updates from Olof Johansson: "Device tree contents continue to be the largest branches we submit. This time around, some of the contents worth pointing out is: New SoC platforms: - Freescale i.MX 7Solo - Broadcom BCM23550 - Cirrus Logic EP7209 and EP7211 (clps711x platforms)_ - Hisilicon HI3519 - Renesas R8A7792 Some of the other delta that is sticking out, line-count wise: - Exynos moves of IP blocks under an SoC bus, which causes a large delta due to indentation changes - a new Tegra K1 board: Apalis - a bunch of small updates to many Allwinner platforms; new hardware support, some cleanup, etc" * tag 'armsoc-dt' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (426 commits) ARM: dts: sun8i: Add dts file for inet86dz board ARM: dts: sun8i: Add dts file for Polaroid MID2407PXE03 tablet ARM: dts: sun8i: Use sun8i-reference-design-tablet for ga10h dts ARM: dts: sun8i: Use sun8i-reference-design-tablet for polaroid mid2809pxe04 ARM: dts: sun8i: reference-design-tablet: Add drivevbus-supply ARM: dts: Copy sun8i-q8-common.dtsi sun8i-reference-design-tablet.dtsi ARM: dts: sun5i: Use sun5i-reference-design-tablet.dtsi for utoo p66 dts ARM: dts: sun5i: Use sun5i-reference-design-tablet.dtsi for dit4350 dts ARM: dts: sun5i: reference-design-tablet: Remove mention of q8 ARM: dts: sun5i: reference-design-tablet: Set lradc vref to avcc ARM: dts: sun5i: Rename sun5i-q8-common.dtsi sun5i-reference-design-tablet.dtsi ARM: dts: sun5i: Move q8 display bits to sun5i-a13-q8-tablet.dts ARM: dts: sunxi: Rename sunxi-q8-common.dtsi sunxi-reference-design-tablet.dtsi ARM: dts: at91: Don't build unnecessary dtbs ARM: dts: at91: sama5d3x: separate motherboard gmac and emac definitions ARM: dts: at91: at91sam9g25ek: fix isi endpoint node ARM: dts: at91: move isi definition to at91sam9g25ek ARM: dts: at91: fix i2c-gpio node name ARM: dts: at91: vinco: fix regulator name ARM: dts: at91: ariag25 : fix onewire node ...
2016-07-27Merge tag 'spi-v4.8' of ↵Linus Torvalds32-883/+1303
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi Pull spi updates from Mark Brown: "Quite a lot of cleanup and maintainence work going on this release in various drivers, and also a fix for a nasty locking issue in the core: - A fix for locking issues when external drivers explicitly locked the bus with spi_bus_lock() - we were using the same lock to both control access to the physical bus in multi-threaded I/O operations and exclude multiple callers. Confusion between these two caused us to have scenarios where we were dropping locks. These are fixed by splitting into two separate locks like should have been done originally, making everything much clearer and correct. - Support for DMA in spi_flash_read(). - Support for instantiating spidev on ACPI systems, including some test devices used in Windows validation. - Use of the core DMA mapping functionality in the McSPI driver. - Start of support for ThunderX SPI controllers, involving a very big set of changes to the Cavium driver. - Support for Braswell, Exynos 5433, Kaby Lake, Merrifield, RK3036, RK3228, RK3368 controllers" * tag 'spi-v4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: (64 commits) spi: Split bus and I/O locking spi: octeon: Split driver into Octeon specific and common parts spi: octeon: Move include file from arch/mips to drivers/spi spi: octeon: Put register offsets into a struct spi: octeon: Store system clock freqency in struct octeon_spi spi: octeon: Convert driver to use readq()/writeq() functions spi: pic32-sqi: fixup wait_for_completion_timeout return handling spi: pic32: fixup wait_for_completion_timeout return handling spi: rockchip: limit transfers to (64K - 1) bytes spi: xilinx: Return IRQ_NONE if no interrupts were detected spi: xilinx: Handle errors from platform_get_irq() spi: s3c64xx: restore removed comments spi: s3c64xx: add Exynos5433 compatible for ioclk handling spi: s3c64xx: use error code from clk_prepare_enable() spi: s3c64xx: rename goto labels to meaningful names spi: s3c64xx: document the clocks and the clock-name property spi: s3c64xx: add exynos5433 spi compatible spi: s3c64xx: fix reference leak to master in s3c64xx_spi_remove() spi: spi-sh: Remove deprecated create_singlethread_workqueue spi: spi-topcliff-pch: Remove deprecated create_singlethread_workqueue ...
2016-07-27spi: img-spfi: Remove spi_master_put in img_spfi_remove()Wei Yongjun1-2/+0
The call to spi_master_put() in img_spfi_remove() is redundant since the master is registered using devm_spi_register_master() and no reference hold by using spi_master_get() in img_spfi_remove(). This is detected by Coccinelle semantic patch. Signed-off-by: Wei Yongjun <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-07-27spi: mediatek: remove spi_master_put in mtk_spi_remove()Wei Yongjun1-1/+0
The call to spi_master_put() in mtk_spi_remove() is redundant since the master is registered using devm_spi_register_master() and no reference hold by using spi_master_get() in mtk_spi_remove(). This is detected by Coccinelle semantic patch. Signed-off-by: Wei Yongjun <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-07-27spi: qup: Remove spi_master_put in spi_qup_remove()Wei Yongjun1-1/+0
The call to spi_master_put() in spi_qup_remove() is redundant since the master is registered using devm_spi_register_master() and no reference hold by using spi_master_get() in spi_qup_remove(). This is detected by Coccinelle semantic patch. Signed-off-by: Wei Yongjun <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-07-25Merge branch 'acpi-tables'Rafael J. Wysocki1-7/+93
* acpi-tables: ACPI: Rename configfs.c to acpi_configfs.c to prevent link error ACPI: add support for loading SSDTs via configfs ACPI: add support for configfs efi / ACPI: load SSTDs from EFI variables spi / ACPI: add support for ACPI reconfigure notifications i2c / ACPI: add support for ACPI reconfigure notifications ACPI: add support for ACPI reconfiguration notifiers ACPI / scan: fix enumeration (visited) flags for bus rescans ACPI / documentation: add SSDT overlays documentation ACPI: ARM64: support for ACPI_TABLE_UPGRADE ACPI / tables: introduce ARCH_HAS_ACPI_TABLE_UPGRADE ACPI / tables: move arch-specific symbol to asm/acpi.h ACPI / tables: table upgrade: refactor function definitions ACPI / tables: table upgrade: use cacheable map for tables Conflicts: arch/arm64/include/asm/acpi.h
2016-07-25Merge remote-tracking branch 'spi/fix/locking' into spi-nextMark Brown1-20/+18