summaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-s3c64xx.c
AgeCommit message (Collapse)AuthorFilesLines
2017-02-19Merge remote-tracking branches 'spi/topic/rockchip', 'spi/topic/rspi', ↵Mark Brown1-43/+31
'spi/topic/s3c64xx', 'spi/topic/sh-msiof' and 'spi/topic/slave' into spi-next
2017-02-13spi: s3c64xx: fix inconsistency between binding and driverAndi Shyti1-1/+1
Commit a92e7c3d82a1 ("spi: s3c64xx: consider the case when the CS line is not connected") introduced an inconsistency between the binding, where the disconnected CS line was marked as 'no-cs-readback', and the driver. The driver is erroneously checking for that attribute with property name of 'broken-cs'. Check for 'no-cs-readback' in the driver as well. Fixes: a92e7c3d82a1 ("spi: s3c64xx: consider the case when the CS line is not connected") Signed-off-by: Andi Shyti <andi.shyti@samsung.com> Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org
2017-01-17spi: s3c64xx: potential oops on probe errorDan Carpenter1-4/+4
We accidentally mixed up freeing the rx and tx channels which would a leak and an oops. Fixes: 3d63a47a380a ("spi: s3c64xx: Don't request/release DMA channels for each SPI transfer") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Marek Szyprowski <m.szyprowski@samsung.com> Acked-by: Andi Shyti <andi.shyti@samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-01-09spi: s3c64xx: Don't request/release DMA channels for each SPI transferMarek Szyprowski1-28/+29
Requesting a DMA channel might be a time consuming operation, so there is no need to acquire and release DMA channel for each SPI transfer. DMA channels can be requested during driver probe and kept all the time, also because there are no shared nor dynamically allocated channels on Samsung S3C/S5P/Exynos platforms. While moving dma_requrest_slave_channel calls, lets switch to dma_request_slave_channel_reason(), which returns error codes on failure, which can be properly propagated to the caller (this for example defers SPI probe when DMA controller is not yet available). Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Reviewed-by: Andi Shyti <andi.shyti@samsung.com> Tested-by: Andi Shyti <andi.shyti@samsung.com> Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-17spi: s3c64xx: Do not use platform_data for DMA parametersSylwester Nawrocki1-17/+4
All related platforms use either devicetree or the DMA slave map API for mapping DMA channels to DMA slaves so we can now stop using platform_data for passing DMA details. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Tested-by: Andi Shyti <andi.shyti@samsung.com> Tested-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Acked-by: Mark Brown <broonie@kernel.org> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
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 <s.nawrocki@samsung.com> Signed-off-by: Andi Shyti <andi.shyti@samsung.com> Reviewed-by: Michael Turquette <mturquette@baylibre.com> Signed-off-by: Mark Brown <broonie@kernel.org>
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 <andi.shyti@samsung.com> Reviewed-by: Michael Turquette <mturquette@baylibre.com> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
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 <k.kozlowski@samsung.com> Signed-off-by: Andi Shyti <andi.shyti@samsung.com> Reviewed-by: Michael Turquette <mturquette@baylibre.com> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
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 <andi.shyti@samsung.com> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Reviewed-by: Michael Turquette <mturquette@baylibre.com> Signed-off-by: Mark Brown <broonie@kernel.org>
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 <yongjun_wei@trendmicro.com.cn> Reviewed-by: Andi Shyti <andi.shyti@samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
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 <s.nawrocki@samsung.com> Signed-off-by: Andi Shyti <andi.shyti@samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
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 <dan.carpenter@oracle.com> Signed-off-by: Mark Brown <broonie@kernel.org>
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 <andi.shyti@samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
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 <andi.shyti@samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
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 <andi.shyti@samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
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 <andi.shyti@samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-30spi: s3c64xx: Remove unused platform_device_id entriesSylwester Nawrocki1-6/+0
s5pv210 and exynos4 are now DT only platforms hence these entries can now be safely removed from the match table. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-11-18spi: s3c64xx: pass DMA arguments in platform dataArnd Bergmann1-20/+7
The s3c64xx platform data already contains a pointer to the DMA filter function, but not to the associated data. This simplifies the code and makes it more generic by passing the data along with the filter function like we do for other drivers. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-09-16spi: s3c64xx: Use transfer speed unconditionallyJarkko Nikula1-1/+1
SPI core validates the transfer speed and defaults to spi->max_speed_hz in case the transfer speed is not set. Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-09-14spi: s3c64xx: replace clock disabling with runtime PM suspend call in remove ↵Heiner Kallweit1-1/+5
function Simplify s3c64xx_spi_remove by replacing the clock disabling with calling runtime PM suspend which does the same. Waking up the device if it was suspended wouldn't be strictly needed for this driver but using pm_runtime_get_sync is cleaner and makes s3c64xx_spi_remove more consistent with the runtime PM handling in s3c64xx_spi_setup. pm_runtime_force_suspend does most of the work for us: disabling the clocks, disabling runtime PM and setting it to "suspended" state. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-09-14spi: s3c64xx: simplify suspend / resume handlersHeiner Kallweit1-8/+7
The runtime PM suspend / resume handlers take care of the enabling/ disabling the clocks already. Therefore replace the duplicated clock handling with pm_runtime_force_suspend/resume. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-09-14spi: s3c64xx: extend driver to make full use of runtime PM autosuspendHeiner Kallweit1-8/+18
Extend the driver to make full use of runtime PM autosuspend. Before only the SPI core was instructed to use autosuspend by setting master->auto_runtime_pm. Nevertheless due to the missing pm_runtime_use_autosuspend call autosuspend wasn't active. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-09-14spi: s3c64xx: clean up runtime PM if driver registration failsHeiner Kallweit1-1/+4
Fix missing runtime PM cleanup if driver registration fails. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-28spi: s3c64xx: print fifo size on probe.Michal Suchanek1-2/+2
Printing the FIFO depth does not add much noise in the log and can be useful for debugging transfer issues. Signed-off-by: Michal Suchanek <hramrach@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-05-01spi: s3c64xx: Constify platform_device_idKrzysztof Kozlowski1-1/+1
The platform_device_id is not modified by the driver and core uses it as const. Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-02-24spi: s3c64xx: fix compiler warning in spi-s3c64xxAndre Przywara1-2/+2
The Exynos 7 arm64 support now allows the S3C64xx SPI driver to be compiled into an ARM64 kernel, so the cast from the [rt]x_dmach int variable to a void* in this driver now triggers a warning. Add a long cast to silence the compiler. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-12-22spi: Remove FSF mailing addressesJarkko Nikula1-4/+0
Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-12-18Merge tag 'pm+acpi-3.19-rc1-2' of ↵Linus Torvalds1-2/+2
git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm Pull more ACPI and power management updates from Rafael Wysocki: "These are regression fixes (leds-gpio, ACPI backlight driver, operating performance points library, ACPI device enumeration messages, cpupower tool), other bug fixes (ACPI EC driver, ACPI device PM), some cleanups in the operating performance points (OPP) framework, continuation of CONFIG_PM_RUNTIME elimination, a couple of minor intel_pstate driver changes, a new MAINTAINERS entry for it and an ACPI fan driver change needed for better support of thermal management in user space. Specifics: - Fix a regression in leds-gpio introduced by a recent commit that inadvertently changed the name of one of the properties used by the driver (Fabio Estevam). - Fix a regression in the ACPI backlight driver introduced by a recent fix that missed one special case that had to be taken into account (Aaron Lu). - Drop the level of some new kernel messages from the ACPI core introduced by a recent commit to KERN_DEBUG which they should have used from the start and drop some other unuseful KERN_ERR messages printed by ACPI (Rafael J Wysocki). - Revert an incorrect commit modifying the cpupower tool (Prarit Bhargava). - Fix two regressions introduced by recent commits in the OPP library and clean up some existing minor issues in that code (Viresh Kumar). - Continue to replace CONFIG_PM_RUNTIME with CONFIG_PM throughout the tree (or drop it where that can be done) in order to make it possible to eliminate CONFIG_PM_RUNTIME (Rafael J Wysocki, Ulf Hansson, Ludovic Desroches). There will be one more "CONFIG_PM_RUNTIME removal" batch after this one, because some new uses of it have been introduced during the current merge window, but that should be sufficient to finally get rid of it. - Make the ACPI EC driver more robust against race conditions related to GPE handler installation failures (Lv Zheng). - Prevent the ACPI device PM core code from attempting to disable GPEs that it has not enabled which confuses ACPICA and makes it report errors unnecessarily (Rafael J Wysocki). - Add a "force" command line switch to the intel_pstate driver to make it possible to override the blacklisting of some systems in that driver if needed (Ethan Zhao). - Improve intel_pstate code documentation and add a MAINTAINERS entry for it (Kristen Carlson Accardi). - Make the ACPI fan driver create cooling device interfaces witn names that reflect the IDs of the ACPI device objects they are associated with, except for "generic" ACPI fans (PNP ID "PNP0C0B"). That's necessary for user space thermal management tools to be able to connect the fans with the parts of the system they are supposed to be cooling properly. From Srinivas Pandruvada" * tag 'pm+acpi-3.19-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (32 commits) MAINTAINERS: add entry for intel_pstate ACPI / video: update the skip case for acpi_video_device_in_dod() power / PM: Eliminate CONFIG_PM_RUNTIME NFC / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM SCSI / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM ACPI / EC: Fix unexpected ec_remove_handlers() invocations Revert "tools: cpupower: fix return checks for sysfs_get_idlestate_count()" tracing / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM x86 / PM: Replace CONFIG_PM_RUNTIME in io_apic.c PM: Remove the SET_PM_RUNTIME_PM_OPS() macro mmc: atmel-mci: use SET_RUNTIME_PM_OPS() macro PM / Kconfig: Replace PM_RUNTIME with PM in dependencies ARM / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM sound / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM phy / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM video / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM tty / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM spi: Replace CONFIG_PM_RUNTIME with CONFIG_PM ACPI / PM: Do not disable wakeup GPEs that have not been enabled ACPI / utils: Drop error messages from acpi_evaluate_reference() ...
2014-12-14Merge tag 'driver-core-3.19-rc1' of ↵Linus Torvalds1-1/+0
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core Pull driver core update from Greg KH: "Here's the set of driver core patches for 3.19-rc1. They are dominated by the removal of the .owner field in platform drivers. They touch a lot of files, but they are "simple" changes, just removing a line in a structure. Other than that, a few minor driver core and debugfs changes. There are some ath9k patches coming in through this tree that have been acked by the wireless maintainers as they relied on the debugfs changes. Everything has been in linux-next for a while" * tag 'driver-core-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (324 commits) Revert "ath: ath9k: use debugfs_create_devm_seqfile() helper for seq_file entries" fs: debugfs: add forward declaration for struct device type firmware class: Deletion of an unnecessary check before the function call "vunmap" firmware loader: fix hung task warning dump devcoredump: provide a one-way disable function device: Add dev_<level>_once variants ath: ath9k: use debugfs_create_devm_seqfile() helper for seq_file entries ath: use seq_file api for ath9k debugfs files debugfs: add helper function to create device related seq_file drivers/base: cacheinfo: remove noisy error boot message Revert "core: platform: add warning if driver has no owner" drivers: base: support cpu cache information interface to userspace via sysfs drivers: base: add cpu_device_create to support per-cpu devices topology: replace custom attribute macros with standard DEVICE_ATTR* cpumask: factor out show_cpumap into separate helper function driver core: Fix unbalanced device reference in drivers_probe driver core: fix race with userland in device_add() sysfs/kernfs: make read requests on pre-alloc files use the buffer. sysfs/kernfs: allow attributes to request write buffer be pre-allocated. fs: sysfs: return EGBIG on write if offset is larger than file size ...
2014-12-13spi: Replace CONFIG_PM_RUNTIME with CONFIG_PMRafael J. Wysocki1-2/+2
After commit b2b49ccbdd54 (PM: Kconfig: Set PM_RUNTIME if PM_SLEEP is selected) PM_RUNTIME is always set if PM is set, so #ifdef blocks depending on CONFIG_PM_RUNTIME may now be changed to depend on CONFIG_PM. Replace CONFIG_PM_RUNTIME with CONFIG_PM everywhere under drivers/spi/. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Mark Brown <broonie@kernel.org>
2014-12-07spi/s3c64xx: Remove redundant runtime PM managementMark Brown1-9/+0
The device already asks the core to hold a runtime PM reference while it is active so it is redundant to open code that in the driver itself. Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-26spi: s3c64xx: add support for exynos7 SPI controllerPadmavathi Venna1-5/+27
Exynos7 SPI controller supports only the auto Selection of CS toggle mode and Exynos7 SoC includes six SPI controllers. Add support for these changes in Exynos7 SPI controller driver. Signed-off-by: Padmavathi Venna <padma.v@samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-10-20spi: drop owner assignment from platform_driversWolfram Sang1-1/+0
A platform_driver does not need to set an owner, it will be populated by the driver core. Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-08-08Merge tag 'cleanup-for-3.17' of ↵Linus Torvalds1-22/+0
git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc Pull ARM SoC cleanups from Olof Johansson: "This merge window brings a good size of cleanups on various platforms. Among the bigger ones: - Removal of Samsung s5pc100 and s5p64xx platforms. Both of these have lacked active support for quite a while, and after asking around nobody showed interest in keeping them around. If needed, they could be resurrected in the future but it's more likely that we would prefer reintroduction of them as DT and multiplatform-enabled platforms instead. - OMAP4 controller code register define diet. They defined a lot of registers that were never actually used, etc. - Move of some of the Tegra platform code (PMC, APBIO, fuse, powergate) to drivers/soc so it can be shared with 64-bit code. This also converts them over to traditional driver models where possible. - Removal of legacy gpio-samsung driver, since the last users have been removed (moved to pinctrl) Plus a bunch of smaller changes for various platforms that sort of dissapear in the diffstat for the above. clps711x cleanups, shmobile header file refactoring/moves for multiplatform friendliness, some misc cleanups, etc" * tag 'cleanup-for-3.17' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (117 commits) drivers: CCI: Correct use of ! and & video: clcd-versatile: Depend on ARM video: fix up versatile CLCD helper move MAINTAINERS: Add sdhci-st file to ARCH/STI architecture ARM: EXYNOS: Fix build breakge with PM_SLEEP=n MAINTAINERS: Remove Kirkwood ARM: tegra: Convert PMC to a driver soc/tegra: fuse: Set up in early initcall ARM: tegra: Always lock the CPU reset vector ARM: tegra: Setup CPU hotplug in a pure initcall soc/tegra: Implement runtime check for Tegra SoCs soc/tegra: fuse: fix dummy functions soc/tegra: fuse: move APB DMA into Tegra20 fuse driver soc/tegra: Add efuse and apbmisc bindings soc/tegra: Add efuse driver for Tegra ARM: tegra: move fuse exports to soc/tegra/fuse.h ARM: tegra: export apb dma readl/writel ARM: tegra: Use a function to get the chip ID ARM: tegra: Sort includes alphabetically ARM: tegra: Move includes to include/soc/tegra ...
2014-07-17spi: s3c64xx: use the generic SPI "cs-gpios" propertyNaveen Krishna Chatradhi1-20/+29
The s3c64xx SPI driver uses a custom DT binding to specify the GPIO used to drive the chip select (CS) line instead of using the generic "cs-gpios" property already defined in: Documentation/devicetree/bindings/spi/spi-bus.txt. It's unfortunate that drivers are not using standard bindings and creating custom ones instead but in most cases this can't be changed without breaking Device Tree backward compatibility. But in the case of this driver, its DT binding has been broken for more than a year. Since after commit (dated June, 21 2013): 3146bee ("spi: s3c64xx: Added provision for dedicated cs pin") DT backward compatibility was broken and nobody noticed until now when the commit was reverted. So it seems to be safe to change the binding to use the standard SPI "cs-gpios" property instead of using a custom one just for this driver. This patch also allows boards that don't use a GPIO pin for the CS to work with the driver since the SPI core will take care of setting spi->cs_gpio to -ENOENT if a board wants to use the built in CS instead of a GPIO as explained in the SPI bus DT binding: Documentation/devicetree/bindings/spi/spi-bus.txt. For non-DT platforms, spi->cs_gpio will be set to -ENOENT as well unless they specify a GPIO pin in their platform data. So both native and GPIO chip select is also supported for legacy boards. The above use case was what motivated commit 3146bee which broke the DT binding backward compatibility in the first place. Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com> [javier.martinez@collabora.co.uk: split changes and improve commit message] Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Reviewed-by: Tomasz Figa <t.figa@samsung.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-17spi: s3c64xx: Revert "spi: s3c64xx: Added provision for dedicated cs pin"Javier Martinez Canillas1-26/+11
This reverts commit 3146beec21b64f4551fcf0ac148381d54dc41b1b. This commit resulted in a DT backward compatibility breakage. Some devices use the native chip select (CS) instead of a GPIO pin to drive the CS line. But the SPI driver made it mandatory to specify a GPIO pin in the SPI device node controller-data. So, using the built-in CS was not possible with the driver. Commit 3146bee tried to fix that by adding a "cs-gpio" property which could be defined in the SPI device node to make the driver request the GPIO from the controller-data node. Unfortunately that changed the old DT binding semantics since now it's mandatory to have the "cs-gpio" property defined in the SPI device node in order to use a GPIO pin to drive the CS. As an example, a SPI device was defined before the commit with: spi@12d20000 { slave-node@0 { controller-data { cs-gpio = <&gpb1 2 0>; } } } and after the commit, the following DTS snippet must be used: spi@12d20000 { cs-gpio; slave-node@0 { controller-data { cs-gpio = <&gpb1 2 0>; } } } So, after commit 3146bee the driver does not look for the GPIO by default and it only looks for it if the top level "cs-gpio" property is defined while the default used to be the opposite. To always request the GPIO defined in the controller-data node. This means that old FDT that of course didn't have this added "cs-gpio" DT property in the SPI node broke after this change. The offending commit can't be reverted cleanly since more than a year have passed and other changes were made in the meantime but this patch partially reverts the driver to it's original state so old FDT can work again. This patch will break Device Trees that were relying on the new behavior of course but the patch should be reverted because: a) There aren't DTS in mainline that use this new property. b) They were relying on a behavior that broke DT compatibility. c) The new binding is awkard, needing two properties with the same name (cs-gpio) on different nodes is confusing at least. d) The new property was not added to the DT binding doc: Documentation/devicetree/bindings/spi/spi-samsung.txt Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Reviewed-by: Tomasz Figa <t.figa@samsung.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-13spi: s3c64xx: remove s5pc100 related spi codesKukjin Kim1-13/+0
This patch removes sp5c100 related spi because of no more support s5pc100 SoC. Cc: Mark Brown <broonie@linaro.org> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
2014-07-08spi: s3c64xx: remove s5p64x0 related spi codesKukjin Kim1-9/+0
This patch removes s5p64x0 related spi because of no more support for s5p64x0 SoCs. Meanwhile, cleanup SPI DT bindings for s5p6440-spi, it should be s5p64x0-spi instead. Cc: Mark Brown <broonie@linaro.org> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
2014-06-02Merge remote-tracking branch 'spi/topic/workqueue' into spi-nextMark Brown1-1/+0
2014-04-29spi: s3c64xx: remove unnecessary OOM messagesJingoo Han1-4/+1
The site-specific OOM messages are unnecessary, because they duplicate the MM subsystem generic OOM message. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-14spi: Remove unneeded include of linux/workqueue.hAxel Lin1-1/+0
Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-25spi: s3c64xx: Let spi core handle validating transfer lengthAxel Lin1-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>
2014-02-07spi/s3c64xx: Remove code no longer needed as a result of S3C_DMA removalMark Brown1-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>
2014-02-07spi/s3c64xx: Remove S3C_DMA supportMark Brown1-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>
2014-02-07spi/s3c64xx: Use core DMA mapping code with dmaengineMark Brown1-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>
2014-02-04spi: Make core DMA mapping functions generate scatterlistsMark Brown1-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>
2014-02-04spi/s3c64xx: Split wait_for_xfer() into PIO and DMA versionsMark Brown1-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>
2014-02-04spi/s3c64xx: Remove unused /CS GPIO managementMark Brown1-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>
2014-01-13spi/s3c64xx: Correct indentationGeert Uytterhoeven1-1/+1
Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-02spi: s3c64xx: Remove duplicate code to clear S3C64XX_SPI_SLAVE_SEL registerAxel Lin1-3/+0
Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@linaro.org>