summaryrefslogtreecommitdiffstats
path: root/drivers/spi
AgeCommit message (Collapse)AuthorFilesLines
2013-04-05Merge tag 'spi-fix-v3.9-rc5' of ↵Linus Torvalds5-44/+42
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/misc Pull spi fixes from Mark Brown: "A bunch of small driver fixes plus a fix for error handling in the core - nothing too exciting overall." * tag 'spi-fix-v3.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/misc: spi/mpc512x-psc: optionally keep PSC SS asserted across xfer segmensts spi: Unlock a spinlock before calling into the controller driver. spi/s3c64xx: modified error interrupt handling and init spi/bcm63xx: don't disable non enabled clocks in probe error path spi/bcm63xx: Remove unused variable spi: slink-tegra20: move runtime pm calls to transfer_one_message
2013-04-04Merge tag 'pm+acpi-3.9-rc6' of ↵Linus Torvalds2-2/+1
git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm Pull ACPI and power management fixes from Rafael Wysocki: - Revert of a recent cpuidle change that caused Nehalem machines to hang on boot from Alex Shi. - USB power management fix addressing a crash in the port device object's release routine from Rafael J Wysocki. - Device PM QoS fix for a potential deadlock related to sysfs interface from Rafael J Wysocki. - Fix for a cpufreq crash when the /cpus Device Tree node is missing from Paolo Pisati. - Fix for a build issue on ia64 related to the Boot Graphics Resource Table (BGRT) from Tony Luck. - Two fixes for ACPI handles being set incorrectly for device objects that don't correspond to any ACPI namespace nodes in the I2C and SPI subsystems from Rafael J Wysocki. - Fix for compiler warnings related to CONFIG_PM_DEVFREQ being unset from Rajagopal Venkat. - Fix for a symbol definition typo in cpufreq_governor.h from Borislav Petkov. * tag 'pm+acpi-3.9-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: ACPI / BGRT: Don't let users configure BGRT on non X86 systems cpuidle / ACPI: recover percpu ACPI processor cstate ACPI / I2C: Use parent's ACPI_HANDLE() in acpi_i2c_register_devices() cpufreq: Correct header guards typo ACPI / SPI: Use parent's ACPI_HANDLE() in acpi_register_spi_devices() cpufreq: check OF node /cpus presence before dereferencing it PM / devfreq: Fix compiler warnings for CONFIG_PM_DEVFREQ unset PM / QoS: Avoid possible deadlock related to sysfs access USB / PM: Don't try to hide PM QoS flags from usb_port_device_release()
2013-04-02ACPI / SPI: Use parent's ACPI_HANDLE() in acpi_register_spi_devices()Rafael J. Wysocki2-2/+1
The ACPI handle of struct spi_master's dev member should not be set, because this causes that struct spi_master to be associated with the ACPI device node corresponding to its parent as the second "physical_device", which is incorrect (this happens during the registration of struct spi_master). Consequently, acpi_register_spi_devices() should use the ACPI handle of the parent of the struct spi_master it is called for rather than that struct spi_master's ACPI handle (which should be NULL). Make that happen and modify the spi-pxa2xx driver, which currently is the only driver for ACPI-enumerated SPI controller chips, not to set the ACPI handle for the struct spi_master it creates. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-01spi/mpc512x-psc: optionally keep PSC SS asserted across xfer segmenstsAnatolij Gustschin1-1/+1
Some SPI slave devices require asserted chip select signal across multiple transfer segments of an SPI message. Currently the driver always de-asserts the internal SS signal for every single transfer segment of the message and ignores the 'cs_change' flag of the transfer description. Disable the internal chip select (SS) only if this is needed and indicated by the 'cs_change' flag. Without this change, each partial transfer of a surrounding multi-part SPI transaction might erroneously change the SS signal, which might prevent slaves from answering the request that was sent in a previous transfer segment because the transaction could be considered aborted (SS was de-asserted before reading the response). Reported-by: Gerhard Sittig <gerhard.sittig@ifm.com> Signed-off-by: Anatolij Gustschin <agust@denx.de> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: stable@vger.kernel.org
2013-04-01spi: Unlock a spinlock before calling into the controller driver.Bryan Freed1-8/+7
spi_pump_messages() calls into a controller driver with unprepare_transfer_hardware() which is documented as "This may sleep". As in the prepare_transfer_hardware() call below, we should release the queue_lock spinlock before making the call. Rework the logic a bit to hold queue_lock to protect the 'busy' flag, then release it to call unprepare_transfer_hardware(). Signed-off-by: Bryan Freed <bfreed@chromium.org> Reviewed-by: Doug Anderson <dianders@chromium.org> Signed-off-by: Doug Anderson <dianders@chromium.org> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-01spi/s3c64xx: modified error interrupt handling and initGirish K S1-16/+25
The status of the interrupt is available in the status register, so reading the clear pending register and writing back the same value will not actually clear the pending interrupts. This patch modifies the interrupt handler to read the status register and clear the corresponding pending bit in the clear pending register. Modified the hwInit function to clear all the pending interrupts. Signed-off-by: Girish K S <ks.giri@samsung.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: stable@vger.kernel.org
2013-03-21drivers/Kconfig: add several missing GENERIC_HARDIRQS dependenciesHeiko Carstens1-1/+2
With this patch an allmodconfig finally builds on s390 again. Fixes these build errors: ERROR: "devm_request_threaded_irq" [drivers/spi/spi-altera.ko] undefined! ERROR: "devm_request_threaded_irq" [drivers/media/platform/sh_veu.ko] undefined! ERROR: "devm_request_threaded_irq" [drivers/dma/dw_dmac.ko] undefined! Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2013-03-12spi/bcm63xx: don't disable non enabled clocks in probe error pathJonas Gorski1-1/+1
When msg_ctl_width is set to an invalid value we try to disable the clock despite it never being enabled. Fix it by jumping to the correct label. Signed-off-by: Jonas Gorski <jogo@openwrt.org> Acked-by: Florian Fainelli <florian@openwrt.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-12spi/bcm63xx: Remove unused variableKevin Cernekee1-1/+0
This fixes the following warning: drivers/spi/spi-bcm63xx.c: In function 'bcm63xx_spi_setup': drivers/spi/spi-bcm63xx.c:157:6: warning: unused variable 'ret' Signed-off-by: Kevin Cernekee <cernekee@gmail.com> Acked-by: Florian Fainelli <florian@openwrt.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-12spi: slink-tegra20: move runtime pm calls to transfer_one_messageLaxman Dewangan1-17/+8
The prepare_transfer_hardware() is called in atomic context and calling synchronous runtime pm calls can create scheduling deadlock. Therefore, in place of calling runtime PM calls from prepare/unprepare message transfer, calling this in transfer_one_message(). Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Tested-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-02-21Merge tag 'soc' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-socLinus Torvalds2-4/+4
Pull ARM SoC-specific updates from Arnd Bergmann: "This is a larger set of new functionality for the existing SoC families, including: - vt8500 gains support for new CPU cores, notably the Cortex-A9 based wm8850 - prima2 gains support for the "marco" SoC family, its SMP based cousin - tegra gains support for the new Tegra4 (Tegra114) family - socfpga now supports a newer version of the hardware including SMP - i.mx31 and bcm2835 are now using DT probing for their clocks - lots of updates for sh-mobile - OMAP updates for clocks, power management and USB - i.mx6q and tegra now support cpuidle - kirkwood now supports PCIe hot plugging - tegra clock support is updated - tegra USB PHY probing gets implemented diffently" * tag 'soc' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (148 commits) ARM: prima2: remove duplicate v7_invalidate_l1 ARM: shmobile: r8a7779: Correct TMU clock support again ARM: prima2: fix __init section for cpu hotplug ARM: OMAP: Consolidate OMAP USB-HS platform data (part 3/3) ARM: OMAP: Consolidate OMAP USB-HS platform data (part 1/3) arm: socfpga: Add SMP support for actual socfpga harware arm: Add v7_invalidate_l1 to cache-v7.S arm: socfpga: Add entries to enable make dtbs socfpga arm: socfpga: Add new device tree source for actual socfpga HW ARM: tegra: sort Kconfig selects for Tegra114 ARM: tegra: enable ARCH_REQUIRE_GPIOLIB for Tegra114 ARM: tegra: Fix build error w/ ARCH_TEGRA_114_SOC w/o ARCH_TEGRA_3x_SOC ARM: tegra: Fix build error for gic update ARM: tegra: remove empty tegra_smp_init_cpus() ARM: shmobile: Register ARM architected timer ARM: MARCO: fix the build issue due to gic-vic-to-irqchip move ARM: shmobile: r8a7779: Correct TMU clock support ARM: mxs_defconfig: Select CONFIG_DEVTMPFS_MOUNT ARM: mxs: decrease mxs_clockevent_device.min_delta_ns to 2 clock cycles ARM: mxs: use apbx bus clock to drive the timers on timrotv2 ...
2013-02-21Merge tag 'driver-core-3.9-rc1' of ↵Linus Torvalds9-40/+31
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core Pull driver core patches from Greg Kroah-Hartman: "Here is the big driver core merge for 3.9-rc1 There are two major series here, both of which touch lots of drivers all over the kernel, and will cause you some merge conflicts: - add a new function called devm_ioremap_resource() to properly be able to check return values. - remove CONFIG_EXPERIMENTAL Other than those patches, there's not much here, some minor fixes and updates" Fix up trivial conflicts * tag 'driver-core-3.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (221 commits) base: memory: fix soft/hard_offline_page permissions drivercore: Fix ordering between deferred_probe and exiting initcalls backlight: fix class_find_device() arguments TTY: mark tty_get_device call with the proper const values driver-core: constify data for class_find_device() firmware: Ignore abort check when no user-helper is used firmware: Reduce ifdef CONFIG_FW_LOADER_USER_HELPER firmware: Make user-mode helper optional firmware: Refactoring for splitting user-mode helper code Driver core: treat unregistered bus_types as having no devices watchdog: Convert to devm_ioremap_resource() thermal: Convert to devm_ioremap_resource() spi: Convert to devm_ioremap_resource() power: Convert to devm_ioremap_resource() mtd: Convert to devm_ioremap_resource() mmc: Convert to devm_ioremap_resource() mfd: Convert to devm_ioremap_resource() media: Convert to devm_ioremap_resource() iommu: Convert to devm_ioremap_resource() drm: Convert to devm_ioremap_resource() ...
2013-02-21Merge tag 'sound-3.9' of ↵Linus Torvalds1-54/+23
git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound Pull sound updates from Takashi Iwai: "The biggest change in this update is the unification of HD-audio codec parsers. Now the HD-audio codec is parsed in a generic parser code which is invoked by each HD-audio codec driver. Some background information is found in David Henningsson's blog entry: http://voices.canonical.com/david.henningsson/2013/01/18/upcoming-changes-to-the-intel-hda-drivers/ Other than that, some random updates/fixes like USB-audio and a bunch of small AoC updates as usual. Highlights: - Unification of HD-audio parser code (aka generic parser) - Support of new Intel HD-audio controller, new IDT codecs - Fixes for HD-audio HDMI audio hotplug - Haswell HDMI audio fixup - Support of Creative CA0132 DSP code - A few fixes of HDSP driver - USB-audio fix for Roland A-PRO, M-Audio FT C600 - Support PM for aloop driver (and fixes Oops) - Compress API updates for gapless playback support For ASoC part: - Support for a wider range of hardware in the compressed stream code - The ability to mute capture streams as well as playback streams while inactive - DT support for AK4642, FSI, Samsung I2S and WM8962 - AC'97 support for Tegra - New driver for max98090, replacing the stub which was there - A new driver from Dialog Note that due to dependencies, DTification of DMA support for Samsung platforms (used only by the and I2S driver and SPI) is merged here as well." Fix up trivial conflict in drivers/spi/spi-s3c64xx.c due to removed code being changed. * tag 'sound-3.9' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (453 commits) ALSA: usb: Fix Processing Unit Descriptor parsers ALSA: hda - hdmi: Notify userspace when ELD control changes ALSA: hda - hdmi: Protect ELD buffer ALSA: hda - hdmi: Refactor hdmi_eld into parsed_hdmi_eld ALSA: hda - hdmi: Do not expose eld data when eld is invalid ALSA: hda - hdmi: ELD shouldn't be valid after unplug ALSA: hda - Fix the silent speaker output on Fujitsu S7020 laptop ALSA: hda - add quirks for mute LED on two HP machines ALSA: usb/quirks, fix out-of-bounds access ASoC: codecs: Add da7213 codec ALSA: au88x0 - Define channel map for au88x0 ALSA: compress: add support for gapless playback ALSA: hda - Remove speaker clicks on CX20549 ALSA: hda - Disable runtime PM for Intel 5 Series/3400 ALSA: hda - Increase badness for missing multi-io ASoC: arizona: Automatically manage input mutes ALSA: hda - Fix broken workaround for HDMI/SPDIF conflicts ALSA: hda/ca0132 - Add missing \n to debug prints ALSA: hda/ca0132 - Fix type of INVALID_CHIP_ADDRESS ALSA: hda - update documentation for no-primary-hp fixup ...
2013-02-20Merge tag 'dt-for-linus' of git://git.secretlab.ca/git/linuxLinus Torvalds4-11/+10
Pull device tree changes from Grant Likely: "All around device tree changes destined for v3.8. Aside from the documentation updates the highlights in this branch include: - Kbuild changes for using CPP with .dts files - locking fix from preempt_rt patchset - include DT alias names in device uevent - Selftest bugfixes and improvements - New function for counting phandles stanzas in a property - constify argument to of_node_full_name() - Various bug fixes This tree did also contain a commit to use platform_device_add instead of open-coding the device add code, but it caused problems with amba devices and needed to be reverted." * tag 'dt-for-linus' of git://git.secretlab.ca/git/linux: (23 commits) Revert "of: use platform_device_add" kbuild: limit dtc+cpp include path gpio: Make of_count_named_gpios() use new of_count_phandle_with_args() of: Create function for counting number of phandles in a property of/base: Clean up exit paths for of_parse_phandle_with_args() of/selftest: Use selftest() macro throughout of/selftest: Fix GPIOs selftest to cover the 7th case of: fix recursive locking in of_get_next_available_child() documentation/devicetree: Fix a typo in exynos-dw-mshc.txt OF: convert devtree lock from rw_lock to raw spinlock of/exynos_g2d: Add Bindings for exynos G2D driver kbuild: create a rule to run the pre-processor on *.dts files input: Extend matrix-keypad device tree binding devicetree: Move NS2 LEDs binding into LEDs directory of: use platform_device_add powerpc/5200: Fix size to request_mem_region() call documentation/devicetree: Fix typos of: add 'const' to of_node_full_name parameter of: Output devicetree alias names in uevent DT: add vendor prefixes for Renesas and Toshiba ...
2013-02-20Merge tag 'spi-for-linus' of git://git.secretlab.ca/git/linuxLinus Torvalds36-1137/+2027
Pull SPI changes from Grant Likely: "Changes to both core spi code and spi device drivers. The driver changes are the usual set of bug fixes and platform enablement. Core code changes include: - More intelligent assignment of SPI bus numbers when using DT - Common mechanism for using gpios as CS lines - Pull checks for bits_per_word and transfer speed out of drivers and into core code - Ensure temporary DMA buffers are DMA safe" * tag 'spi-for-linus' of git://git.secretlab.ca/git/linux: (50 commits) spi: Document cs_gpios and cs_gpio in kernel-doc spi/of: Fix initialization of cs_gpios array spi/pxa2xx: add support for Lynxpoint SPI controllers spi/pxa2xx: add support for Intel Low Power Subsystem SPI spi/pxa2xx: add support for SPI_LOOP spi/pxa2xx: add support for runtime PM spi/pxa2xx: add support for DMA engine spi/pxa2xx: break out the private DMA API usage into a separate file spi/ath79: add shutdown handler spi/mips-lantiq: set SPI_MASTER_HALF_DUPLEX flag spi/mips-lantiq: make use of spi_finalize_current_message spi/bcm63xx: work around inability to keep CS up spi/davinci: use request_threaded_irq() to fix deadlock spi/orion: Use module_platform_driver() spi/bcm63xx: reject transfers unable to transfer spi: Ensure memory used for spi_write_then_read() is DMA safe spi/spi-mpc512x-psc: init mode bits supported by the driver spi/mpc512x-psc: don't use obsolet cell-index property spi: Remove erroneous __init, __exit and __exit_p() references in drivers spi/s3c64xx: fix checkpatch warnings and error ...
2013-02-13gpio: Make of_count_named_gpios() use new of_count_phandle_with_args()Grant Likely4-11/+10
This patch replaces the horribly coded of_count_named_gpios() with a call to of_count_phandle_with_args() which is far more efficient. This also changes the return value of of_gpio_count() & of_gpio_named_count() from 'unsigned int' to 'int' so that it can return an error code. All the users of that function are fixed up to correctly handle a negative return value. v2: Split GPIO portion into a separate patch Tested-by: Andreas Larsson <andreas@gaisler.com> Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Cc: Linus Walleij <linus.walleij@linaro.org> Cc: Rob Herring <rob.herring@calxeda.com>
2013-02-10spi/of: Fix initialization of cs_gpios arrayAndreas Larsson1-1/+2
Using memset does not set an array of integers properly. Replace with a loop to set each element properly. Signed-off-by: Andreas Larsson <andreas@gaisler.com> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2013-02-09Merge branch spi-next from ↵Grant Likely6-578/+1451
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/misc.git Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2013-02-08spi/pxa2xx: add support for Lynxpoint SPI controllersMika Westerberg2-3/+109
Intel Lynxpoint PCH Low Power Subsystem has two general purpose SPI controllers that are LPSS_SSP compatible. These controllers are enumerated from ACPI namespace with ACPI IDs INT33C0 and INT33C1. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Tested-by: Lu Cao <lucao@marvell.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-02-08spi/pxa2xx: add support for Intel Low Power Subsystem SPIMika Westerberg2-4/+135
Intel LPSS SPI is pretty much the same as the PXA27xx SPI except that it has few additional features over the original: o FIFO depth is 256 entries o RX FIFO has one watermark o TX FIFO has two watermarks, low and high o chip select can be controlled by writing to a register The new FIFO registers follow immediately the PXA27xx registers but then there are some additional LPSS private registers at offset 1k or 2k from the base address. For these private registers we add new accessors that take advantage of drv_data->lpss_base once it is resolved. We add a new type LPSS_SSP that can be used to distinguish the LPSS devices from others. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Tested-by: Lu Cao <lucao@marvell.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-02-08spi/pxa2xx: add support for SPI_LOOPMika Westerberg1-1/+4
This is useful when testing the functionality of the controller from userspace and there aren't any real SPI slave devices connected to the bus. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Tested-by: Lu Cao <lucao@marvell.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-02-08spi/pxa2xx: add support for runtime PMMika Westerberg1-6/+67
Drivers should put the device into low power states proactively whenever the device is not in use. Thus implement support for runtime PM and use the autosuspend feature to make sure that we can still perform well in case we see lots of SPI traffic within short period of time. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Tested-by: Lu Cao <lucao@marvell.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-02-08spi/pxa2xx: add support for DMA engineMika Westerberg5-3/+431
To be able to use DMA with this driver on non-PXA platforms we implement support for the generic DMA engine API. This lets user to use different DMA engines with little or no modification to the driver. Request lines and channel numbers can be passed to the driver from the platform specific data. The DMA engine implementation will be selected by default even on PXA platform. User can select the legacy DMA API by enabling Kconfig option CONFIG_SPI_PXA2XX_PXADMA. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Tested-by: Lu Cao <lucao@marvell.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-02-08spi/pxa2xx: break out the private DMA API usage into a separate fileMika Westerberg5-568/+712
The PXA SPI driver uses PXA platform specific private DMA implementation which does not work on non-PXA platforms. In order to use this driver on other platforms we break out the private DMA implementation into a separate file that gets compiled only when CONFIG_SPI_PXA2XX_PXADMA is set. The DMA functions are stubbed out if there is no DMA implementation selected (i.e we are building on non-PXA platform). While we are there we can kill the dummy DMA bits in pxa2xx_spi.h as they are not needed anymore for CE4100. Once this is done we can add the generic DMA engine support to the driver that allows usage of any DMA controller that implements DMA engine API. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Tested-by: Lu Cao <lucao@marvell.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-02-07sched/rt: Move rt specific bits into new header fileClark Williams1-1/+1
Move rt scheduler definitions out of include/linux/sched.h into new file include/linux/sched/rt.h Signed-off-by: Clark Williams <williams@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Steven Rostedt <rostedt@goodmis.org> Link: http://lkml.kernel.org/r/20130207094707.7b9f825f@riff.lan Signed-off-by: Ingo Molnar <mingo@kernel.org>
2013-02-06driver-core: constify data for class_find_device()Michał Mirosław1-2/+2
All in-kernel users of class_find_device() don't really need mutable data for match callback. In two places (kernel/power/suspend_test.c, drivers/scsi/osd/osd_uld.c) this patch changes match callbacks to use const search data. The const is propagated to rtc_class_open() and power_supply_get_by_name() parameters. Note that there's a dev reference leak in suspend_test.c that's not touched in this patch. Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Acked-by: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-06spi/ath79: add shutdown handlerGabor Juhos1-0/+6
The SPI controller of the AR7xxx/AR9xxx SoCs have a special mode which allows the SoC to directly read data from SPI flash chips. In this mode, the content of the SPI flash chip can be accessed via a memory mapped region. During early init time, the kernel expects that the flash chip is accessible through that memory region because it reads board specific values (e.g. MAC address, WiFi calibration data) from the flash on various boards. This is working if the kernel is loaded directly by the bootloader because that leaves the SPI controller in the special mode. However it is not working in a kexec'd kernel because the SPI driver does not restore the special mode during shutdown. The patch adds a shutdown handler to fix this issue. Signed-off-by: Gabor Juhos <juhosg@openwrt.org> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2013-02-05spi/mips-lantiq: set SPI_MASTER_HALF_DUPLEX flagJohn Crispin1-0/+1
Due to hardware limitations of the spi/flash frontend of the EBU we need to set the SPI_MASTER_HALF_DUPLEX flag. Signed-off-by: Thomas Langer <thomas.langer@lantiq.com> Signed-off-by: John Crispin <blogic@openwrt.org> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2013-02-05spi/mips-lantiq: make use of spi_finalize_current_messageJohn Crispin1-1/+1
Rather than calling m->complete() directly we choose the sane way and call spi_finalize_current_message instead. Signed-off-by: Thomas Langer <thomas.langer@lantiq.com> Signed-off-by: John Crispin <blogic@openwrt.org> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2013-02-05spi/bcm63xx: work around inability to keep CS upJonas Gorski1-28/+106
This SPI controller does not support keeping CS asserted after sending a transfer. Since messages expected on this SPI controller are rather short, we can work around it for normal use cases by sending all transfers at once in a big full duplex stream. This means that we cannot change the speed between transfers if they require CS to be kept asserted, but these would have been rejected before anyway because of the inability of keeping CS asserted. Signed-off-by: Jonas Gorski <jogo@openwrt.org> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2013-02-05spi/davinci: use request_threaded_irq() to fix deadlockMurali Karicheri1-2/+15
With RT pre-empt patch applied to Linux kernel, the irq handler will be force converted to an irq thread. spi driver can get back to back messages from the slave device. In such cases, IRQ thread doesn't get a chance to run to read the slave data. Hence the irq handler must be run in hard irq context to read/write data from slave device. Otherwise, the kernel goes into a deadlock. This patch fixes this issue when PREEMPT_RT_FULL is enabled in the kernel. A dummy thread function is provided to satisfy the request_threaded_irq() API. Passing a NULL for function also causes the irq handler to be executed in the thread context. Signed-off-by: Murali Karicheri <m-karicheri2@ti.com> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2013-02-05spi/orion: Use module_platform_driver()Ezequiel Garcia1-11/+2
This patch reduces and simplifies initalization code by using module_platform_driver(). With this change it's necessary to remove the __init annotation to avoid section mismatch warnings. Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2013-02-05spi/bcm63xx: reject transfers unable to transferJonas Gorski1-49/+42
The hardware does not support keeping CS asserted after sending one FIFO buffer worth of data, so reject transfers requiring CS being kept asserted, either between transers or for a certain time after it, or exceeding the FIFO size. Signed-off-by: Jonas Gorski <jogo@openwrt.org> Acked-by: Florian Fainelli <florian@openwrt.org> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2013-02-05spi: Ensure memory used for spi_write_then_read() is DMA safeMark Brown1-1/+2
Use GFP_DMA in order to ensure that the memory we allocate for transfers in spi_write_then_read() can be DMAed. On most platforms this will have no effect. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2013-02-05spi/spi-mpc512x-psc: init mode bits supported by the driverAnatolij Gustschin1-0/+1
The driver should setup mode bits it supports, otherwise adding an SPI device might fail even if the driver supports the requested SPI mode. Signed-off-by: Anatolij Gustschin <agust@denx.de> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2013-02-05spi/mpc512x-psc: don't use obsolet cell-index propertyAnatolij Gustschin1-11/+5
Remove deprecated cell-index property and use spi alias to obtain the SPI PSC number used for SPI bus id. Signed-off-by: Anatolij Gustschin <agust@denx.de> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2013-02-05spi: Remove erroneous __init, __exit and __exit_p() references in driversGrant Likely9-23/+23
Some of the spi driver module remove hooks were annotated with __exit and referenced with __exit_p(). Presumably these were supposed to be __devinit, __devexit and __devexit_p() since __init/__exit for a probe/remove hook has never been correct. They also got missed during the big __devinit/__devexit purge since they didn't match the pattern. Remove then now to be rid of it. v2: purge __init also Reported-by: Arnd Bergmann <arnd@arndb.de> [Arnd set a patch cleaning up one, and then I found more] Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2013-02-05spi/s3c64xx: fix checkpatch warnings and errorJingoo Han1-20/+13
Fix checkpatch warnings and error as below: ERROR: "foo * bar" should be "foo *bar" WARNING: please, no space before tabs WARNING: quoted string split across lines WARNING: msleep < 20ms can sleep for up to 20ms; see Documentation/timers/timers-howto.txt Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2013-02-05spi/s3c64xx: Use devm_clk_get() and devm_request_irq()Jingoo Han1-26/+15
Use devm_clk_get() and devm_request_irq() rather than clk_get() and request_irq() to make cleanup paths more simple. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2013-02-05spi/imx: Add MODULE_ALIAS()Fabio Estevam1-0/+1
Add an entry for MODULE_ALIAS(). Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2013-02-05spi/tegra: remove checks for valid speedLaxman Dewangan2-6/+14
SPI core make sure that all transfer has proper speed set before calling low level spi transfer. Hence, it is not require to have check in spi driver. Remove the check for speed validity from transfer and use it directly. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2013-02-05spi: make sure all transfer has proper speed setLaxman Dewangan1-2/+4
When spi client does the spi transfer and if it does not set the speed for each transfer then set it as default of spi device in spi core before calling low level transfer. This will remove the extra check in low level driver for setting speed. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2013-02-05spi/ath79: avoid multiple initialization of the SPI controllerGabor Juhos1-17/+24
Currently we are initializing the SPI controller in the chip select line function, and that function is called once for each SPI device on the bus. If a board has multiple SPI devices, the controller will be initialized multiple times. Introduce ath79_spi_{en,dis}able helper functions, and call those from probe/response in order to avoid the mutliple initialization of the controller. Signed-off-by: Gabor Juhos <juhosg@openwrt.org> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2013-02-05spi/ath79: use gpio_request_oneGabor Juhos1-11/+11
Use gpio_request_one() instead of multiple gpiolib calls. Signed-off-by: Gabor Juhos <juhosg@openwrt.org> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2013-02-05spi/ath79: remove superfluous chip select codeGabor Juhos1-6/+0
The spi_bitbang driver calls the chipselect function of the driver from spi_bitbang_setup in order to deselect the given SPI chip, so we don't have to initialize the CS line here. Signed-off-by: Gabor Juhos <juhosg@openwrt.org> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2013-02-05spi/ath79: add missing HIGH->LOW SCK transitionGabor Juhos1-0/+2
The 'ath79_spi_txrx_mode0' function does not set the SCK signal to LOW at the end of a word transfer. This causes communications errors with certain devices (e.g. the PCF2123 RTC chip). The patch ensures that the SCK signal will be LOW. Signed-off-by: Gabor Juhos <juhosg@openwrt.org> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2013-02-05spi/ath79: add delay between SCK changesGabor Juhos1-1/+43
The driver uses the "as fast as it can" approach to drive the SCK signal. However this does not work with certain low speed SPI chips (e.g. the PCF2123 RTC chip). The patch adds per-bit slowdowns in order to be able to use the driver with such chips as well. Signed-off-by: Gabor Juhos <juhosg@openwrt.org> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2013-02-05mxs/spi: clear XFER_COUNT in ctrl0 field in DMA descriptorJuha Lumme1-1/+4
On MX23 the XFER_COUNT part in ctrl0 field in DMA descriptor was improperly OR'd during the construction of DMA descriptor chain, instead of being freshly set. Because of that too many bytes were being expected from SPI during the last DMA cycle. This caused a timeout (SSP_TIMEOUT) to happen in the processing of the last DMA descriptor, and thus reads and writes were failing. This is a fix for the problem, by clearing XFER_COUNT bytes in ctrl0 before setting the new XFER_COUNT for DMA descriptor. Signed-off-by: Juha Lumme <juha.lumme@gmail.com> Acked-by: Marek Vasut <marex@denx.de> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2013-02-05spi/sirf: add support for new SiRFmarco SMP SoCBarry Song1-0/+1
the driver is also compatible with SiRFmarco except SiRFprimaII, so simply add "sirf,marco-spi" to OF match table. Signed-off-by: Barry Song <Baohua.Song@csr.com> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2013-02-05spi/sirf: use clk_prepare_enable and clk_disable_unprepareBarry Song1-3/+3
Convert clk_enable/clk_disable to clk_prepare_enable/clk_disable_unprepare calls as required by common clock framework. Signed-off-by: Barry Song <Baohua.Song@csr.com> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>