summaryrefslogtreecommitdiff
path: root/drivers/spi/spi-s3c64xx.c
AgeCommit message (Collapse)Author
2014-04-07Rewind v3.13-rc3+ (78fd82238d0e5716) to v3.12Scott Wood
2013-11-15tree-wide: use reinit_completion instead of INIT_COMPLETIONWolfram Sang
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>
2013-10-25Merge remote-tracking branch 'spi/topic/s3c64xx' into spi-nextMark Brown
2013-10-25Merge remote-tracking branch 'spi/topic/loop' into spi-nextMark Brown
2013-10-22spi/s3c64xx: Fix doubled clock disable on suspendKrzysztof Kozlowski
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>
2013-10-22spi/s3c64xx: Do not ignore return value of spi_master_resume/suspendKrzysztof Kozlowski
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>
2013-10-17spi/s3c64xx: Add missing pm_runtime_put on setup failKrzysztof Kozlowski
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>
2013-10-17spi/s3c64xx: Add missing pm_runtime_set_active() call in probe()Krzysztof Kozlowski
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>
2013-10-11spi/s3c64xx: Use core message handlingMark Brown
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-10-11Merge remote-tracking branch 'spi/topic/s3c64xx' into spi-loopMark Brown
2013-10-11spi/s3c64xx: Use prepare_message() and unprepare_message()Mark Brown
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>
2013-10-07spi/s3c64xx: Factor transfer start out of enable/disable_cs()Mark Brown
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>
2013-09-30spi/s3c64xx: Enable GPIO /CS prior to starting hardwareMark Brown
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>
2013-09-30spi/s3c64xx: Factor transfer start out of enable/disable_cs()Mark Brown
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>
2013-09-30spi/s3c64xx: Use core cs_gpio fieldMark Brown
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>
2013-09-30spi/s3c64xx: Remove unused gpios field from driver dataMark Brown
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-30spi/s3c64xx: Check that clock enables succeed on runtime resumeMark Brown
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-30spi/s3c64xx: Flush FIFOs prior to cleaning up transferMark Brown
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>
2013-09-27Merge remote-tracking branch 'spi/fix/s3c64xx' into spi-s3c64xxMark Brown
Conflicts: drivers/spi/spi-s3c64xx.c
2013-09-27spi/s3c64xx: Ensure runtime PM is enabled prior to registrationMark Brown
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
2013-09-23spi: s3c64xx: Add missing compatiblesMateusz Krawczuk
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>
2013-09-18spi/s3c64xx: Use managed registrationMark Brown
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>
2013-09-16spi: spi-s3c64xx: Use module_platform_driver()Lukasz Czerwinski
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>
2013-09-01Merge remote-tracking branch 'spi/topic/s3c64xx' into spi-nextMark Brown
2013-09-01Merge remote-tracking branch 'spi/topic/qspi' into spi-nextMark Brown
2013-08-29Merge remote-tracking branch 'spi/topic/rspi' into spi-pdataMark Brown
Conflicts: drivers/spi/spi-rspi.c
2013-08-29spi: use dev_get_platdata()Jingoo Han
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>
2013-08-14spi/s3c64xx: Take runtime PM reference even if DMA is not supportedMark Brown
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>
2013-08-11spi: s3c64xx: Use dmaengine_prep_slave_single() to prepare DMA transfersTomasz Figa
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>
2013-08-11spi: s3c64xx: Do not request CS GPIO on subsequent calls to .setup()Tomasz Figa
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>
2013-08-11spi: s3c64xx: Zero dma_slave_config struct in prepare_dma()Tomasz Figa
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>
2013-07-29spi/s3c64xx: Use core for runtime PMMark Brown
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-24spi: s3c64xx: fix casting warningJingoo Han
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>
2013-07-24spi: s3c64xx: fix printk warningsJingoo Han
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>
2013-07-24spi: s3c64xx: fix checkpatch error and warningsJingoo Han
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>
2013-07-24spi/s3c64xx: Remove unused message queueMark Brown
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>
2013-07-15spi: s3c64xx: add missing check for polling modeGirish K S
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>
2013-07-02spi: s3c64xx: add missing check for polling modeGirish K S
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>
2013-06-26Merge remote-tracking branch 'spi/topic/s3c64xx' into spi-nextMark Brown
2013-06-26Merge remote-tracking branch 'spi/topic/core' into spi-nextMark Brown
2013-06-26Merge remote-tracking branch 'spi/topic/bpw' into spi-nextMark Brown
2013-06-26spi/s3c64xx: Rely on the compiler eliminating the OF ID tableMark Brown
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>
2013-06-25spi: s3c64xx: Added support for exynos5440 spiGirish K S
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>
2013-06-25spi: s3c64xx: Added provision for dedicated cs pinGirish K S
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>
2013-06-19spi/s3c64xx: Make wait_for_timeout() function name less genericMark Brown
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-06-19spi: s3c64xx: added support for polling modeGirish K S
The 64xx spi driver supports partial polling mode. Only the last chunk of the transfer length is transferred or recieved in polling mode. Some SoC's that adopt this controller might not have have dma interface. This patch adds support for complete polling mode and gives flexibity for the user to select poll/dma mode. Signed-off-by: Girish K S <ks.giri@samsung.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2013-06-10spi: s3c64xx: Fix pm_runtime_get_sync() return value checkSylwester Nawrocki
If the device is already in a runtime PM enabled state pm_runtime_get_sync() will return 1, so a test for negative value should be used to check for errors. Without this patch there are seen errors like: [ 8.540000] s3c64xx-spi 13930000.spi: Failed to enable device: 1 [ 8.545000] spi_master spi1: failed to prepare transfer hardware Likely because the driver uses synchronous API to runtime enable the device and asynchronous one to disable it. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mark Brown <broonielinaro.org> Cc: stable@vger.kernel.org
2013-05-29spi: convert drivers to use bits_per_word_maskStephen Warren
Fill in the recently added spi_master.bits_per_word_mask field in as many drivers as possible. Make related cleanups, such as removing any redundant error-checking, or empty setup callbacks. Signed-off-by: Stephen Warren <swarren@wwwdotorg.org> Acked-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-05-13spi: remove unnecessary platform_set_drvdata()Jingoo Han
The driver core clears the driver data to NULL after device_release or on probe failure, since commit 0998d0631001288a5974afc0b2a5f568bcdecb4d (device-core: Ensure drvdata = NULL when no driver is bound). Thus, it is not needed to manually clear the device driver data to NULL. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Acked-by: Grant Likely <grant.likely@linaro.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-18spi/s3c64xx: Check for errors in dmaengine prepare_transfer()Mark Brown
Don't silently ignore errors, report them. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>