aboutsummaryrefslogtreecommitdiff
path: root/drivers/spi
AgeCommit message (Collapse)AuthorFilesLines
2016-07-25spi: Split bus and I/O lockingMark Brown1-20/+18
The current SPI code attempts to use bus_lock_mutex for two purposes. One is to implement spi_bus_lock() which grants exclusive access to the bus. The other is to serialize access to the physical hardware. This duplicate purpose causes confusion which leads to cases where access is not locked when a caller holds the bus lock mutex. Fix this by splitting out the I/O functionality into a new io_mutex. This means taking both mutexes in the DMA path, replacing the existing mutex with the new I/O one in the message pump (the mutex now always being taken in the message pump) and taking the bus lock mutex in spi_sync(), allowing __spi_sync() to have no mutex handling. While we're at it hoist the mutex further up the message pump before we power up the device so that all power up/down of the block is covered by it and there are no races with in-line pumping of messages. Reported-by: Rich Felker <[email protected]> Tested-by: Rich Felker <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-07-24Merge remote-tracking branch 'spi/topic/xilinx' into spi-nextMark Brown1-2/+6
2016-07-24Merge remote-tracking branches 'spi/topic/spidev', 'spi/topic/sunxi', ↵Mark Brown6-33/+62
'spi/topic/ti-qspi', 'spi/topic/topcliff-pch' and 'spi/topic/txx9' into spi-next
2016-07-24Merge remote-tracking branches 'spi/topic/pxa2xx', 'spi/topic/rockchip', ↵Mark Brown8-314/+282
'spi/topic/s3c64xx', 'spi/topic/sh' and 'spi/topic/sh-msiof' into spi-next
2016-07-24Merge remote-tracking branches 'spi/topic/octeon', 'spi/topic/omap2-mcspi', ↵Mark Brown10-336/+750
'spi/topic/orion', 'spi/topic/pic32' and 'spi/topic/pic32-sqi' into spi-next
2016-07-24Merge remote-tracking branches 'spi/topic/flash-dma', 'spi/topic/imx', ↵Mark Brown4-112/+126
'spi/topic/loopback', 'spi/topic/maintainers' and 'spi/topic/mpc52xx-psc' into spi-next
2016-07-24Merge remote-tracking branches 'spi/topic/bfin-sport', 'spi/topic/bfin5xx', ↵Mark Brown3-65/+34
'spi/topic/clps711x', 'spi/topic/doc' and 'spi/topic/dt' into spi-next
2016-07-24Merge remote-tracking branches 'spi/fix/pax2xx' and 'spi/fix/rockchip' into ↵Mark Brown2-1/+25
spi-linus
2016-07-24spi: octeon: Split driver into Octeon specific and common partsJan Glauber4-118/+138
Separate driver probing from SPI transfer functions. Signed-off-by: Jan Glauber <[email protected]> Tested-by: Steven J. Hill <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-07-24spi: octeon: Move include file from arch/mips to drivers/spiJan Glauber2-1/+300
Move the register definitions to the drivers directory because they are only used there. Signed-off-by: Jan Glauber <[email protected]> Tested-by: Steven J. Hill <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-07-24spi: octeon: Put register offsets into a structJan Glauber1-14/+27
Instead of hard-coding the register offsets put them into a struct and set them in the probe function. Signed-off-by: Jan Glauber <[email protected]> Tested-by: Steven J. Hill <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-07-24spi: octeon: Store system clock freqency in struct octeon_spiJan Glauber1-4/+3
Storing the system clock frequency in struct octeon_spi avoids calling the MIPS specific octeon_get_io_clock_rate() for every transfer. Signed-off-by: Jan Glauber <[email protected]> Tested-by: Steven J. Hill <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-07-24spi: octeon: Convert driver to use readq()/writeq() functionsSteven J. Hill1-12/+11
Remove all calls to cvmx_read_csr()/cvmx_write_csr() and use the portable readq()/writeq() functions. Signed-off-by: Steven J. Hill <[email protected]> Signed-off-by: Jan Glauber <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-07-24spi: pic32-sqi: fixup wait_for_completion_timeout return handlingNicholas Mc Guire1-3/+4
wait_for_completion_timeout returns unsigned long not int so the check for <= 0 should be == 0 here, and the type unsigned long. The function return is set to -ETIMEDOUT to reflect the actual problem. Signed-off-by: Nicholas Mc Guire <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-07-24spi: pic32: fixup wait_for_completion_timeout return handlingNicholas Mc Guire1-2/+3
wait_for_completion_timeout returns unsigned long not int so the check for <= 0 should be == 0 here. Signed-off-by: Nicholas Mc Guire <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-07-20spi: rockchip: limit transfers to (64K - 1) bytesBrian Norris1-0/+17
The Rockchip SPI controller's length register only supports 16-bits, yielding a maximum length of 64KiB (the CTRLR1 register holds "length - 1"). Trying to transfer more than that (e.g., with a large SPI flash read) will cause the driver to hang. Now, it seems that while theoretically we should be able to program CTRLR1 with 0xffff, and get a 64KiB transfer, but that also seems to cause the core to choke, so stick with a maximum of 64K - 1 bytes -- i.e., 0xffff. Signed-off-by: Brian Norris <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-07-15spi: xilinx: Return IRQ_NONE if no interrupts were detectedLars-Peter Clausen1-1/+2
Return IRQ_NONE from the interrupt handler if the handler is running, but no interrupt was detected. This allows the system to recover in case of an interrupt storm due to an invalid interrupt configuration or faulty hardware. Signed-off-by: Lars-Peter Clausen <[email protected]> Acked-by: Ricardo Ribalda Delgado <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-07-15spi: xilinx: Handle errors from platform_get_irq()Lars-Peter Clausen1-1/+4
The Xilinx SPI driver can operate without an IRQ, but not every error returned by platform_get_irq() means that no IRQ was specified. It will also return an error if the IRQ specification is invalid or the IRQ provider is not yet available (EPROBE_DEFER). So instead of ignoring all errors only ignore ENXIO, which means no IRQ was specified, and propagate all other errors to device driver core. Signed-off-by: Lars-Peter Clausen <[email protected]> Acked-by: Ricardo Ribalda Delgado <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-07-14spi: s3c64xx: restore removed commentsAndi Shyti1-0/+1
Patch a9e93e8 has erroneously removed some comments which are important to understand why the bus frequency is multiplied by two during the spi transfer. Reword the previous comment to a more appropriate message. Suggested-by: Sylwester Nawrocki <[email protected]> Signed-off-by: Andi Shyti <[email protected]> Reviewed-by: Michael Turquette <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-07-14spi: s3c64xx: add Exynos5433 compatible for ioclk handlingAndi Shyti1-5/+52
The new compatible is related to the Samsung Exynos5433 SoC. The difference between the previous is that in the exynos5433 the SPI controller is driven by three clocks instead of only one. The new clock (ioclk) is controlling the input/output clock whenever the controller is slave or master. The presence of the clock line is detected from the compatibility structure (exynos5433_spi_port_config) as a boolean value. The probe function checks whether the ioclk is present and if so, it acquires. The runtime suspend and resume functions will handle the clock enabling and disabling as well. Signed-off-by: Andi Shyti <[email protected]> Reviewed-by: Michael Turquette <[email protected]> Reviewed-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-07-14spi: s3c64xx: use error code from clk_prepare_enable()Andi Shyti1-4/+4
If clk_prepare_enable() fails do not return -EBUSY but use the value provided by the function itself. Suggested-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Andi Shyti <[email protected]> Reviewed-by: Michael Turquette <[email protected]> Reviewed-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-07-14spi: s3c64xx: rename goto labels to meaningful namesAndi Shyti1-12/+12
The goto labels of the style of err4: err3: err2: err1: are complex to insert in between new errors without renaming all the goto statements. Replace the errX naming style to meaningful names in order to make it easier to insert new goto exit points. Signed-off-by: Andi Shyti <[email protected]> Reviewed-by: Krzysztof Kozlowski <[email protected]> Reviewed-by: Michael Turquette <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-07-14spi: s3c64xx: fix reference leak to master in s3c64xx_spi_remove()Wei Yongjun1-1/+1
Once a spi_master_get() call succeeds, we need an additional spi_master_put() call to free the memory, otherwise we will leak a reference to master. Fix by removing the unnecessary spi_master_get() call. Signed-off-by: Wei Yongjun <[email protected]> Reviewed-by: Andi Shyti <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-07-12spi: st-ssc4: Remove 'no clocking' hackLee Jones1-31/+5
Due to the newly upstreamed 'critical clocks' API we can now safely handle clocking in the SPI and I2C drivers without fear of catastrophically crippling the running platform. Signed-off-by: Lee Jones <[email protected]>
2016-07-11spi: spi-sh: Remove deprecated create_singlethread_workqueueBhaktipriya Shridhar1-13/+3
The workqueue has a single workitem(&ss->ws) and hence doesn't require ordering. Also, it is not being used on a memory reclaim path. Hence, the singlethreaded workqueue has been replaced with the use of system_wq. System workqueues have been able to handle high level of concurrency for a long time now and hence it's not required to have a singlethreaded workqueue just to gain concurrency. Unlike a dedicated per-cpu workqueue created with create_singlethread_workqueue(), system_wq allows multiple work items to overlap executions even on the same CPU; however, a per-cpu workqueue doesn't have any CPU locality or global ordering guarantee unless the target CPU is explicitly specified and thus the increase of local concurrency shouldn't make any difference. Work item has been flushed in spi_sh_remove() to ensure that there are no pending tasks while disconnecting the driver. Signed-off-by: Bhaktipriya Shridhar <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-07-11spi: spi-topcliff-pch: Remove deprecated create_singlethread_workqueueBhaktipriya Shridhar1-23/+3
The workqueue "wk" serves as a queue for carrying out execution of requests. It has a single work item(&drv_data->work) and hence doesn't require ordering. Also, it is not being used on a memory reclaim path. Hence, the singlethreaded workqueue has been replaced with the use of system_wq. System workqueues have been able to handle high level of concurrency for a long time now and hence it's not required to have a singlethreaded workqueue just to gain concurrency. Unlike a dedicated per-cpu workqueue created with create_singlethread_workqueue(), system_wq allows multiple work items to overlap executions even on the same CPU; however, a per-cpu workqueue doesn't have any CPU locality or global ordering guarantee unless the target CPU is explicitly specified and thus the increase of local concurrency shouldn't make any difference. Work item has been flushed in pch_spi_free_resources() to ensure that there are no pending tasks while disconnecting the driver. Also dropped the label 'err_return' since it's not being used anymore. Signed-off-by: Bhaktipriya Shridhar <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-07-08spi / ACPI: add support for ACPI reconfigure notificationsOctavian Purdila1-7/+93
This patch adds supports for SPI device enumeration and removal via ACPI reconfiguration notifications that are send as a result of an ACPI table load or unload operation. The code is very similar with the device tree reconfiguration code with only small differences in the way we test and set the enumerated state of the device: * the equivalent of device tree's OF_POPULATED flag is the flags.visited field in the ACPI device and the following wrappers are used to manipulate it: acpi_device_enumerated(), acpi_device_set_enumerated() and acpi_device_clear_enumerated() * the device tree code checks of status of the OF_POPULATED flag to avoid trying to create duplicate Linux devices in two places: once when the controller is probed, and once when the reconfigure event is received; in the ACPI code the check is performed only once when the ACPI namespace is searched because this code path is invoked in both of the two mentioned cases The rest of the enumeration handling is similar with device tree: when the Linux device is unregistered the ACPI device is marked as not enumerated; also, when a device remove notification is received we check that the device is in the enumerated state before continuing with the removal of the Linux device. Signed-off-by: Octavian Purdila <[email protected]> Reviewed-by: Mika Westerberg <[email protected]> Acked-by: Mark Brown <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
2016-07-08spi: omap2-mcspi: Use the SPI framework to handle DMA mappingFranklin S Cooper Jr1-76/+56
Currently, the driver handles mapping buffers to be used by the DMA. However, there are times that the current mapping implementation will fail for certain buffers. Fortunately, the SPI framework can detect and map buffers so its usable by the DMA. Update the driver to utilize the SPI framework for buffer mapping instead. Also incorporate hooks that the framework uses to determine if the DMA can or can not be used. This will result in the original omap2_mcspi_transfer_one function being deleted and omap2_mcspi_work_one being renamed to omap2_mcspi_transfer_one. Previously transfer_one was only responsible for mapping and work_one handled the transfer. But now only transferring needs to be handled by the driver. Signed-off-by: Franklin S Cooper Jr <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-07-08spi: omap2-mcspi: Select SPI_SPLITFranklin S Cooper Jr1-0/+1
The function sg_split will be used by spi-omap2-mcspi to handle a SoC workaround in the SPI driver. Therefore, select SG_SPLIT so this function is available to the driver. Signed-off-by: Franklin S Cooper Jr <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-07-07spi: pxa2xx-pci: Support both chipselects on BraswellAndy Shevchenko1-3/+3
The commit 30f3a6ab44d8 ("spi: pxa2xx: Add support for both chip selects on Intel Braswell") introduces a support of chipselects for Intel Braswell SPI host controller. Though it missed to convert the PCI part of the driver. Do conversion here which enables both chipselects on Intel Braswell when enumerated via PCI. We don't care about num_chipselect value since it is overrided inside core driver. Signed-off-by: Andy Shevchenko <[email protected]> Acked-by: Mika Westerberg <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-07-07spi: pxa2xx: Clear all RFT bits in reset_sccr1() on Intel QuarkAndy Shevchenko1-1/+8
It seems the commit e5262d0568dc ("spi: spi-pxa2xx: SPI support for Intel Quark X1000") misses one place to be adapted for Intel Quark, i.e. in reset_sccr1(). Clear all RFT bits when call reset_sccr1() on Intel Quark. Fixes: e5262d0568dc ("spi: spi-pxa2xx: SPI support for Intel Quark X1000") Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Mark Brown <[email protected]> Cc: [email protected]
2016-07-07spi: clps711x: Driver refactorAlexander Shiyan1-43/+26
This is a complex patch for refactoring CLPS711X SPI driver. This change adds devicetree support and removes board support. Signed-off-by: Alexander Shiyan <[email protected]> Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-07-07spi: s3c64xx: do not disable the clock while configuring the spiAndi Shyti1-7/+1
When the clock is coming from the cmu it is not required to be disabled and then re-enabled in order to change the rate. Besides, some exynos chipsets (e.g. exynos5433) do not deliver any to the SFR if one from the pclk ("spi" in this case) or sclk ("busclk") is disabled. Remove the clock disabling/enabling to avoid falling into this situation. Signed-off-by: Sylwester Nawrocki <[email protected]> Signed-off-by: Andi Shyti <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-07-05spi: omap2-mcspi: Add comments for RX only DMA buffer workaroundFranklin S Cooper Jr1-0/+13
OMAP35x and OMAP37x mentions in the McSPI End-of-Transfer Sequences section that if the McSPI is configured as a Master and only DMA RX is being performed then the DMA transfer size needs to be reduced by 1 or 2. This was originally implemented by: commit 57c5c28dbc83 ("spi: omap2_mcspi rxdma bugfix") This patch adds comments to clarify what is going on in the code since its not obvious what problem its addressing. Signed-off-by: Franklin S Cooper Jr <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-07-04spi: spidev: Add ACPI probing supportMika Westerberg1-0/+41
Some IoT and maker software stacks are using spidev to perform raw access to the SPI bus instead of relying existing drivers provided by the kernel. They then implement their own "drivers" in userspace on top of the spidev raw interface. This is far from being an ideal solution but we do not want to prevent using mainline Linux in these devices. Now, it turns out that Windows has similar SPI devices than spidev which allow raw access on the SPI bus to userspace programs as described in the link below: https://msdn.microsoft.com/windows/hardware/drivers/spb/spi-tests-in-mitt These SPI test devices are also meant to be used during development and testing. In order to allow usage of spidev for development and testing in Linux, add those same ACPI IDs to the spidev driver (which is Linux counterpart of the Windows SPI test devices), but complain loudly so that users know it is not good idea to use it in production systems. Instead they should be using proper drivers for peripherals connected to the SPI bus. Signed-off-by: Mika Westerberg <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-07-04spi: pxa2xx-pci: Sort header block alphabeticallyAndy Shevchenko1-6/+7
Simply sort header block alphabetically. While here, sort devices by PCI ID and add a copyright line for Intel. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-07-04spi: pxa2xx-pci: Remove unused codeAndy Shevchenko1-4/+0
pcim_iomap_table() can't fail when called after pcim_iomap_regions(). Moreover, we already dereference returned value and kernel will crash if it is not correct. Remove obvious leftover of commit 0202775bc3a2 ("spi/pxa2xx-pci: switch to use pcim_* interfaces"). Cc: Mika Westerberg <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-07-04spi: pxa2xx-pci: Enable SPI on Intel MerrifieldAndy Shevchenko1-0/+28
The SPI controllers used on Intel Merrifield are PXA2XX compatible. This patch enables them. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-07-04spi: pxa2xx-pci: Do a specific setup in a separate functionAndy Shevchenko1-33/+44
Move LPSS specific setup to a separate function. It makes ->probe() cleaner as well as allows extend the driver for different variation of hardware in the future, e.g. for Intel Merrifield. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-07-04spi: pxa2xx: Add support for Intel Kaby Lake PCH-HMika Westerberg1-0/+3
Kaby Lake PCH-H has the same SPI host controller as Skylake. Add these new PCI IDs to the list of supported devices. Signed-off-by: Mika Westerberg <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-07-04spi: s3c64xx: indent an if statementDan Carpenter1-2/+2
It generates a static checker warning if an if statement isn't indented. I think the code is fine except for the white space issue. Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-07-03spi: spi-bfin-sport: Remove deprecated create_singlethread_workqueueBhaktipriya Shridhar1-11/+4
The workqueue "workqueue" serves as a driver message queue. It has a single work item(&drv_data->pump_messages) and hence doesn't require ordering. Also, it is not being used on a memory reclaim path. Hence, the singlethreaded workqueue has been replaced with the use of system_wq. System workqueues have been able to handle high level of concurrency for a long time now and hence it's not required to have a singlethreaded workqueue just to gain concurrency. Unlike a dedicated per-cpu workqueue created with create_singlethread_workqueue(), system_wq allows multiple work items to overlap executions even on the same CPU; however, a per-cpu workqueue doesn't have any CPU locality or global ordering guarantee unless the target CPU is explicitly specified and thus the increase of local concurrency shouldn't make any difference. Work item has been flushed in bfin_sport_spi_destroy_queue() to ensure that there are no pending tasks while disconnecting the driver. Signed-off-by: Bhaktipriya Shridhar <[email protected]> Acked-by: Tejun Heo <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-07-03spi: spi-mpc52xx-psc: Remove deprecated create_singlethread_workqueueBhaktipriya Shridhar1-14/+3
The workqueue "workqueue" has a single work item(&mps->work) doesn't require ordering. Also, it is not being used on a memory reclaim path. Hence, the singlethreaded workqueue has been replaced with the use of system_wq. System workqueues have been able to handle high level of concurrency for a long time now and hence it's not required to have a singlethreaded workqueue just to gain concurrency. Unlike a dedicated per-cpu workqueue created with create_singlethread_workqueue(), system_wq allows multiple work items to overlap executions even on the same CPU; however, a per-cpu workqueue doesn't have any CPU locality or global ordering guarantee unless the target CPU is explicitly specified and thus the increase of local concurrency shouldn't make any difference. Work item has been flushed in mpc52xx_psc_spi_of_remove() to ensure that nothing is pending while disconnecting the driver. Signed-off-by: Bhaktipriya Shridhar <[email protected]> Acked-by: Tejun Heo <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-07-03spi: spi-txx9: Remove deprecated create_singlethread_workqueueBhaktipriya Shridhar1-9/+2
The workqueue "workqueue" has a single work item(&c->work) and hence doesn't require ordering. Also, it is not being used on a memory reclaim path. Hence, the singlethreaded workqueue has been replaced with the use of system_wq. System workqueues have been able to handle high level of concurrency for a long time now and hence it's not required to have a singlethreaded workqueue just to gain concurrency. Unlike a dedicated per-cpu workqueue created with create_singlethread_workqueue(), system_wq allows multiple work items to overlap executions even on the same CPU; however, a per-cpu workqueue doesn't have any CPU locality or global ordering guarantee unless the target CPU is explicitly specified and thus the increase of local concurrency shouldn't make any difference. Work item has been flushed in txx9spi_remove() to ensure that nothing is pending while disconnecting the driver. Signed-off-by: Bhaktipriya Shridhar <[email protected]> Acked-by: Tejun Heo <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-07-03spi: spi-bfin5xx: Remove deprecated create_singlethread_workqueueBhaktipriya Shridhar1-11/+4
The workqueue "workqueue" serves as a driver message queue. It has a single work item(&drv_data->pump_messages) and hence doesn't require ordering. Also, it is not being used on a memory reclaim path. Hence, the singlethreaded workqueue has been replaced with the use of system_wq. System workqueues have been able to handle high level of concurrency for a long time now and hence it's not required to have a singlethreaded workqueue just to gain concurrency. Unlike a dedicated per-cpu workqueue created with create_singlethread_workqueue(), system_wq allows multiple work items to overlap executions even on the same CPU; however, a per-cpu workqueue doesn't have any CPU locality or global ordering guarantee unless the target CPU is explicitly specified and thus the increase of local concurrency shouldn't make any difference. Work item has been flushed in bfin_spi_destroy_queue() to ensure that there are no pending tasks while disconnecting the driver. Signed-off-by: Bhaktipriya Shridhar <[email protected]> Acked-by: Tejun Heo <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-06-30Merge remote-tracking branches 'spi/fix/ep93xx', 'spi/fix/rockchip', ↵Mark Brown4-6/+38
'spi/fix/sunxi' and 'spi/fix/ti-qspi' into spi-linus
2016-06-29spi: s3c64xx: simplify if statement in prepare_transfer functionAndi Shyti1-28/+22
The whole function is inside an 'if' statement ("!is_polling(sdd)"). Check the opposite of that statement at the beginning and exit, this way we can have one level less of indentation. Remove the goto paths as they are redundant. Signed-off-by: Andi Shyti <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-06-29spi: s3c64xx: do not configure the device twiceAndi Shyti1-10/+1
At the start of the transfer, the spi_config function is called twice, the first time when the 3c64xx_spi_prepare_message is called and the second time with the s3c64xx_spi_transfer_one, both called from the spi framework. Remove the first call at the prepare message because in that point we don't have the imformation about "bit per word" and frequency. Signed-off-by: Andi Shyti <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-06-29spi: s3c64xx: consider the case when the CS line is not connectedAndi Shyti1-1/+8
When the CS line is not connected, it is not needed to enable or disable the chip selection functionality from the s3c64xx devices in order to perform a transfer. Set the CS controller logically always enabled already during initialization (by writing '0' in the S3C64XX_SPI_SLAVE_SEL register) and never disable it. Signed-off-by: Andi Shyti <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-06-29spi: s3c64xx: group the CS signalling writes in a single functionAndi Shyti1-10/+26
To enable/disable the CS line, the driver performs a writel in the S3C64XX_SPI_SLAVE_SEL registers. Group the register's configuration in a single function. Signed-off-by: Andi Shyti <[email protected]> Signed-off-by: Mark Brown <[email protected]>