summaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-s3c64xx.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* spi: s3c64xx: Let spi core handle validating transfer lengthAxel Lin2014-02-251-7/+0
| | | | | | | | | spi core will handle validating transfer length since commit 4d94bd21b333 "spi: core: Validate length of the transfers in message". So remove the same checking in this driver. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* spi/s3c64xx: Remove code no longer needed as a result of S3C_DMA removalMark Brown2014-02-071-37/+2
| | | | | | | | Remove functions that only had an effect when using S3C_DMA and inline dmaengine_terminate_all() since it's pointless to have a function which expands to a single function call. Signed-off-by: Mark Brown <broonie@linaro.org>
* spi/s3c64xx: Remove S3C_DMA supportMark Brown2014-02-071-191/+0
| | | | | | | | All the platforms which use the old S3C_DMA API have now been converted to dmaengine so we can remove the legacy code from the driver, simplifying maintenance. Signed-off-by: Mark Brown <broonie@linaro.org>
* spi/s3c64xx: Use core DMA mapping code with dmaengineMark Brown2014-02-071-75/+103
| | | | | | | | When using dmaengine allow the core to do the DMA mapping. We still need local mapping code for the non-dmaengine case so this doesn't save us anything for now. Signed-off-by: Mark Brown <broonie@linaro.org>
* spi: Make core DMA mapping functions generate scatterlistsMark Brown2014-02-041-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We cannot unconditionally use dma_map_single() to map data for use with SPI since transfers may exceed a page and virtual addresses may not be provided with physically contiguous pages. Further, addresses allocated using vmalloc() need to be mapped differently to other addresses. Currently only the MXS driver handles all this, a few drivers do handle the possibility that buffers may not be physically contiguous which is the main potential problem but many don't even do that. Factoring this out into the core will make it easier for drivers to do a good job so if the driver is using the core DMA code then generate a scatterlist instead of mapping to a single address so do that. This code is mainly based on a combination of the existing code in the MXS and PXA2xx drivers. In future we should be able to extend it to allow the core to concatenate adjacent transfers if they are compatible, improving performance. Currently for simplicity clients are not allowed to use the scatterlist when they do DMA mapping, in the future the existing single address mappings will be replaced with use of the scatterlist most likely as part of pre-verifying transfers. This change makes it mandatory to use scatterlists when using the core DMA mapping so update the s3c64xx driver to do this when used with dmaengine. Doing so makes the code more ugly but it is expected that the old s3c-dma code can be removed very soon. Signed-off-by: Mark Brown <broonie@linaro.org>
* spi/s3c64xx: Split wait_for_xfer() into PIO and DMA versionsMark Brown2014-02-041-77/+89
| | | | | | | | | | | There is no meaningful code sharing between the PIO and DMA variants (just the timeout calculation) so in order to make the code easier to work with split the two cases. Looking at the code it is not clear how the PIO version works for large transmits, greater than FIFO size is only handled for RX. Signed-off-by: Mark Brown <broonie@linaro.org>
* spi/s3c64xx: Remove unused /CS GPIO managementMark Brown2014-02-041-29/+0
| | | | | | | | The GPIO enable and disable is done in the core so does not need to be replicated in the driver, delete the unneeded code. enable_cs() was not referenced at all. Signed-off-by: Mark Brown <broonie@linaro.org>
* spi/s3c64xx: Correct indentationGeert Uytterhoeven2014-01-131-1/+1
| | | | | Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org> Signed-off-by: Mark Brown <broonie@linaro.org>
* spi: s3c64xx: Remove duplicate code to clear S3C64XX_SPI_SLAVE_SEL registerAxel Lin2014-01-021-3/+0
| | | | | Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* tree-wide: use reinit_completion instead of INIT_COMPLETIONWolfram Sang2013-11-151-1/+1
| | | | | | | | | | | | Use this new function to make code more comprehensible, since we are reinitialzing the completion, not initializing. [akpm@linux-foundation.org: linux-next resyncs] Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Acked-by: Linus Walleij <linus.walleij@linaro.org> (personally at LCE13) Cc: Ingo Molnar <mingo@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* Merge remote-tracking branch 'spi/topic/s3c64xx' into spi-nextMark Brown2013-10-251-10/+12
|\
| * spi/s3c64xx: Fix doubled clock disable on suspendKrzysztof Kozlowski2013-10-221-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix doubled clock disable and unprepare during PM suspend which triggered the warnings: WARNING: at drivers/clk/clk.c:800 clk_disable+0x18/0x24() Modules linked in: CPU: 0 PID: 1745 Comm: sh Not tainted 3.10.14-01211-ge2549bb-dirty #62 [<c0015980>] (unwind_backtrace+0x0/0x138) from [<c0012a44>] (show_stack+0x10/0x14) [<c0012a44>] (show_stack+0x10/0x14) from [<c0022818>] (warn_slowpath_common+0x4c/0x68) [<c0022818>] (warn_slowpath_common+0x4c/0x68) from [<c0022850>] (warn_slowpath_null+0x1c/0x24) [<c0022850>] (warn_slowpath_null+0x1c/0x24) from [<c036e274>] (clk_disable+0x18/0x24) [<c036e274>] (clk_disable+0x18/0x24) from [<c02d5f78>] (s3c64xx_spi_suspend+0x28/0x54) [<c02d5f78>] (s3c64xx_spi_suspend+0x28/0x54) from [<c02b3a54>] (platform_pm_suspend+0x2c/0x5c) [<c02b3a54>] (platform_pm_suspend+0x2c/0x5c) from [<c02b8a30>] (dpm_run_callback+0x44/0x7c) [<c02b8a30>] (dpm_run_callback+0x44/0x7c) from [<c02b8b70>] (__device_suspend+0x108/0x300) [<c02b8b70>] (__device_suspend+0x108/0x300) from [<c02ba4e0>] (dpm_suspend+0x54/0x208) [<c02ba4e0>] (dpm_suspend+0x54/0x208) from [<c0066bcc>] (suspend_devices_and_enter+0x98/0x458) [<c0066bcc>] (suspend_devices_and_enter+0x98/0x458) from [<c0067150>] (pm_suspend+0x1c4/0x25c) [<c0067150>] (pm_suspend+0x1c4/0x25c) from [<c0066044>] (state_store+0x6c/0xbc) [<c0066044>] (state_store+0x6c/0xbc) from [<c0203290>] (kobj_attr_store+0x14/0x20) [<c0203290>] (kobj_attr_store+0x14/0x20) from [<c0157530>] (sysfs_write_file+0xfc/0x164) [<c0157530>] (sysfs_write_file+0xfc/0x164) from [<c00fd6b0>] (vfs_write+0xbc/0x1bc) [<c00fd6b0>] (vfs_write+0xbc/0x1bc) from [<c00fdaf0>] (SyS_write+0x40/0x68) [<c00fdaf0>] (SyS_write+0x40/0x68) from [<c000ea80>] (ret_fast_syscall+0x0/0x3c) The clocks may be already disabled before suspending. Check PM runtime suspend status and disable clocks only if device is not suspended. During resume do not enable the clocks if device is runtime suspended. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mark Brown <broonie@linaro.org>
| * spi/s3c64xx: Do not ignore return value of spi_master_resume/suspendKrzysztof Kozlowski2013-10-221-4/+4
| | | | | | | | | | | | | | | | | | | | During PM resume and suspend do not ignore the return value of spi_master_suspend() or spi_master_resume(). Instead pass it further. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* | Merge remote-tracking branch 'spi/topic/loop' into spi-nextMark Brown2013-10-251-124/+112
|\ \
| * | spi/s3c64xx: Use core message handlingMark Brown2013-10-111-96/+56
| | | | | | | | | | | | Signed-off-by: Mark Brown <broonie@linaro.org>
| * | Merge remote-tracking branch 'spi/topic/s3c64xx' into spi-loopMark Brown2013-10-111-49/+57
| |\|
| | * spi/s3c64xx: Factor transfer start out of enable/disable_cs()Mark Brown2013-10-071-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | The hardware level /CS handling is tied to the start of the data path so is rolled into the same function as we use to manipulate GPIO /CS. In order to support factoring out the /CS handling into the core separate the two and explicitly start transfers separately to the /CS handling. Signed-off-by: Mark Brown <broonie@linaro.org>
| | * spi/s3c64xx: Enable GPIO /CS prior to starting hardwareMark Brown2013-09-301-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | To help with bisection of future refactoring to share more of the code for handling a spi_message pull the enabling of GPIO based /CS prior to all the hardware setup for starting a transfer. Signed-off-by: Mark Brown <broonie@linaro.org>
| | * spi/s3c64xx: Factor transfer start out of enable/disable_cs()Mark Brown2013-09-301-8/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | The hardware level /CS handling is tied to the start of the data path so is rolled into the same function as we use to manipulate GPIO /CS. In order to support factoring out the /CS handling into the core separate the two and explicitly start transfers separately to the /CS handling. Signed-off-by: Mark Brown <broonie@linaro.org>
| | * spi/s3c64xx: Use core cs_gpio fieldMark Brown2013-09-301-14/+10
| | | | | | | | | | | | | | | | | | | | | | | | Rather than using the driver custom platform data to store the chip select GPIO use the cs_gpio field provided by the SPI core, supporting future refectoring. Signed-off-by: Mark Brown <broonie@linaro.org>
| | * spi/s3c64xx: Remove unused gpios field from driver dataMark Brown2013-09-301-1/+0
| | | | | | | | | | | | Signed-off-by: Mark Brown <broonie@linaro.org>
| | * spi/s3c64xx: Check that clock enables succeed on runtime resumeMark Brown2013-09-301-2/+10
| | | | | | | | | | | | Signed-off-by: Mark Brown <broonie@linaro.org>
| | * spi/s3c64xx: Flush FIFOs prior to cleaning up transferMark Brown2013-09-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Ensure that the FIFOs are fully drained before we deassert /CS or do any delays that have been requested in order to ensure that the behaviour visible on the bus matches that which was requested by the caller. Signed-off-by: Mark Brown <broonie@linaro.org>
| | * Merge remote-tracking branch 'spi/fix/s3c64xx' into spi-s3c64xxMark Brown2013-09-271-2/+2
| | |\ | | | | | | | | | | | | | | | | Conflicts: drivers/spi/spi-s3c64xx.c
| | * | spi: s3c64xx: Add missing compatiblesMateusz Krawczuk2013-09-231-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add compatibles for s3c6410, s5pc100 and s5pc110/s5pv210 boards. Signed-off-by: Mateusz Krawczuk <m.krawczuk@partner.samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mark Brown <broonie@linaro.org>
| | * | spi/s3c64xx: Use managed registrationMark Brown2013-09-181-7/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Also improve the error reporting on failure and remove a duplicate put. This provides a small code saving. Signed-off-by: Mark Brown <broonie@linaro.org>
| | * | spi: spi-s3c64xx: Use module_platform_driver()Lukasz Czerwinski2013-09-171-11/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | subsys_init_call() initializes driver too early. It's preventing to move DMA channel allocation at the begining (driver probe). This patch reduces and simplifies initalization code by using module_platform_driver() macro. It's also efficiently delaying driver startup. Signed-off-by: Lukasz Czerwinski <l.czerwinski@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mark Brown <broonie@linaro.org>
| * | | spi/s3c64xx: Use prepare_message() and unprepare_message()Mark Brown2013-10-111-8/+28
| |/ / | | | | | | | | | | | | | | | | | | This is of very little value in itself but will be useful once the loop iterating over the transfers is also factored out into the core. Signed-off-by: Mark Brown <broonie@linaro.org>
* | | spi/s3c64xx: Add missing pm_runtime_put on setup failKrzysztof Kozlowski2013-10-181-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | pm_runtime_put() wasn't called if clock rate could not be set up in s3c64xx_spi_setup() leading to invalid count of device pm_runtime usage. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* | | spi/s3c64xx: Add missing pm_runtime_set_active() call in probe()Krzysztof Kozlowski2013-10-181-0/+1
| |/ |/| | | | | | | | | | | | | | | | | | | | | Mark device as PM runtime active during initialization to reflect actual device power/clocks state. This reduces the enable count for SPI bus controller gate clock so it can be disabled when the bus controller is not used. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* | spi/s3c64xx: Ensure runtime PM is enabled prior to registrationMark Brown2013-09-271-2/+2
|/ | | | | | | | | | | Otherwise we may try to start transfers immediately and then fail to runtime resume the device causing us not to have clocks enabled. Signed-off-by: Mark Brown <broonie@linaro.org> Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Conflicts: drivers/spi/spi-s3c64xx.c
* Merge remote-tracking branch 'spi/topic/s3c64xx' into spi-nextMark Brown2013-09-011-69/+43
|\
| * spi/s3c64xx: Take runtime PM reference even if DMA is not supportedMark Brown2013-08-141-20/+19
| | | | | | | | | | | | | | We always need the device to be runtime PM enabled to use it so just skip the DMA initialisation not the entire prepare when polling. Signed-off-by: Mark Brown <broonie@linaro.org>
| * spi: s3c64xx: Use dmaengine_prep_slave_single() to prepare DMA transfersTomasz Figa2013-08-111-9/+2
| | | | | | | | | | | | | | | | | | | | | | | | Since the driver supports only contiguous buffers, there is no need to manually construct a scatterlist with just a single entry, when there is a dedicated helper for this purpose. This patch modifies prepare_dma() function to use available helper instead of manually creating a scatterlist. Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com> Signed-off-by: Mark Brown <broonie@linaro.org>
| * spi: s3c64xx: Do not request CS GPIO on subsequent calls to .setup()Tomasz Figa2013-08-111-11/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | Comments in linux/spi/spi.h and observed behavior show that .setup() callback can be called multiple times without corresponding calls to .cleanup(), what was incorrectly assumed by spi-s3c64xx driver, leading to failures trying to request CS GPIO multiple times. This patch modifies the behavior of spi-s3c64xx driver to request CS GPIO only on first call to .setup() after last .cleanup(). Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com> Signed-off-by: Mark Brown <broonie@linaro.org>
| * spi: s3c64xx: Zero dma_slave_config struct in prepare_dma()Tomasz Figa2013-08-111-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | Not all fields of dma_slave_config struct are being initialized by prepare_dma() function, leaving those which are not in undefined state, which can confuse DMA drivers using them. This patch adds call to memset() to zero the struct before initializing a subset of its fields. Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com> Signed-off-by: Mark Brown <broonie@linaro.org>
| * spi: s3c64xx: fix casting warningJingoo Han2013-07-241-4/+4
| | | | | | | | | | | | | | | | | | | | sdd->ops->request is unsigned int, not unsigned long. Also, sdd->rx_dma.ch is a 'struct dma_chan *'. Thus, (void *) is converted to (struct dma_chan *)(unsigned long), in order to fix possible sparse warnings. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Mark Brown <broonie@linaro.org>
| * spi: s3c64xx: fix printk warningsJingoo Han2013-07-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix the following build warnings when LPAE is enabled: drivers/spi/spi-s3c64xx.c:1466:2: warning: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'resource_size_t' [-Wformat] drivers/spi/spi-s3c64xx.c:1466:2: warning: format '%x' expects argument of type 'unsigned int', but argument 5 has type 'resource_size_t' [-Wformat] Use vsprintf extension %pR to format resource. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Mark Brown <broonie@linaro.org>
| * spi: s3c64xx: fix checkpatch error and warningsJingoo Han2013-07-241-8/+8
| | | | | | | | | | | | | | | | | | | | | | Fix the following checkpatch error and warnings: ERROR: "(foo*)" should be "(foo *)" WARNING: line over 80 characters WARNING: quoted string split across lines Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Mark Brown <broonie@linaro.org>
| * spi/s3c64xx: Remove unused message queueMark Brown2013-07-241-21/+0
| | | | | | | | | | | | | | | | | | | | Since the driver has been converted to use the core message pump code the only use of the messsage queue in the driver is a check to see if it is empty which will always succeed since nothing ever adds to the queue. Just remove the queue. Signed-off-by: Mark Brown <broonie@linaro.org> Acked-by: Kukjin Kim <kgene.kim@samsung.com>
| * spi: s3c64xx: add missing check for polling modeGirish K S2013-07-151-0/+3
| | | | | | | | | | | | | | | | | | Due to changes in mainline prior to submission the spi device detection in polling mode breaks. This revealed the missing check for polling during dma prepare. This patch adds the missing check. Signed-off-by: Girish K S <ks.giri@samsung.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* | Merge remote-tracking branch 'spi/topic/qspi' into spi-nextMark Brown2013-09-011-3/+1
|\ \
| * | spi/s3c64xx: Use core for runtime PMMark Brown2013-07-291-3/+1
| | | | | | | | | | | | Signed-off-by: Mark Brown <broonie@linaro.org>
* | | Merge remote-tracking branch 'spi/topic/rspi' into spi-pdataMark Brown2013-08-291-0/+3
|\| | | | | | | | | | | | | | Conflicts: drivers/spi/spi-rspi.c
| * | spi: s3c64xx: add missing check for polling modeGirish K S2013-07-021-0/+3
| |/ | | | | | | | | | | | | | | | | | | | | After the patch "spi/s3c64xx: Fix non-dmaengine usage" with commit id 563b444e33810f3120838620c990480304e24e63 submitted by Mark Brown, the spi device detection in polling mode breaks. This revealed the missing check for polling during dma prepare. This patch adds the missing check. Signed-off-by: Girish K S <ks.giri@samsung.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* / spi: use dev_get_platdata()Jingoo Han2013-08-291-2/+2
|/ | | | | | | | Use the wrapper function for retrieving the platform data instead of accessing dev->platform_data directly. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* Merge remote-tracking branch 'spi/topic/s3c64xx' into spi-nextMark Brown2013-06-261-59/+143
|\
| * spi/s3c64xx: Rely on the compiler eliminating the OF ID tableMark Brown2013-06-261-2/+0
| | | | | | | | | | | | | | | | This should work with modern compilers, isn't that much of an issue if it goes wrong and it ensures that the DT-only hardware variants don't leave unreferenced parameters structures lying around. Signed-off-by: Mark Brown <broonie@linaro.org>
| * spi: s3c64xx: Added support for exynos5440 spiGirish K S2013-06-251-0/+12
| | | | | | | | | | | | | | | | | | | | This patch adds support for the exynos5440 spi controller. The integration of the spi IP in exynos5440 is different from other SoC's. The I/O pins are no more configured via gpio, they have dedicated pins. Signed-off-by: Girish K S <ks.giri@samsung.com> Signed-off-by: Mark Brown <broonie@linaro.org>
| * spi: s3c64xx: Added provision for dedicated cs pinGirish K S2013-06-251-8/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The existing driver supports gpio based /cs signal. For controller's that have one device per controller, the slave device's /cs signal might be internally controlled by the chip select bit of slave select register. They are not externally asserted/deasserted using gpio pin. This patch adds support for controllers with dedicated /cs pin. if "cs-gpio" property doesnt exist in a spi dts node, the controller would treat the /cs pin as dedicated. Signed-off-by: Girish K S <ks.giri@samsung.com> Signed-off-by: Mark Brown <broonie@linaro.org>