summaryrefslogtreecommitdiffstats
path: root/drivers/spi
AgeCommit message (Collapse)AuthorFilesLines
2015-11-04Merge remote-tracking branches 'spi/topic/s3c64xx', 'spi/topic/ti-qspi' and ↵Mark Brown3-80/+53
'spi/topic/txx9' into spi-next
2015-11-04Merge remote-tracking branches 'spi/topic/omap-100k', ↵Mark Brown8-138/+174
'spi/topic/omap-uwire', 'spi/topic/owner', 'spi/topic/pxa' and 'spi/topic/pxa2xx' into spi-next
2015-11-04Merge remote-tracking branches 'spi/topic/fsl-dspi', 'spi/topic/mpc512x', ↵Mark Brown6-65/+93
'spi/topic/mtk', 'spi/topic/oc-tiny' and 'spi/topic/octeon' into spi-next
2015-11-04Merge remote-tracking branches 'spi/topic/coldfire' and 'spi/topic/dw' into ↵Mark Brown5-100/+53
spi-next
2015-11-04Merge remote-tracking branches 'spi/topic/bcm53xx', 'spi/topic/bcm63xx', ↵Mark Brown8-159/+237
'spi/topic/bfin-sport', 'spi/topic/bfin5xx' and 'spi/topic/bitbang' into spi-next
2015-11-04Merge remote-tracking branches 'spi/topic/ath97', 'spi/topic/atmel', ↵Mark Brown7-36/+545
'spi/topic/au1550', 'spi/topic/bcm2835' and 'spi/topic/bcm2835aux' into spi-next
2015-11-04Merge remote-tracking branch 'spi/topic/doc' into spi-nextMark Brown1-9/+93
2015-11-04Merge remote-tracking branch 'spi/topic/davinci' into spi-nextMark Brown1-11/+4
2015-11-04Merge remote-tracking branch 'spi/topic/core' into spi-nextMark Brown1-8/+15
2015-11-04Merge remote-tracking branches 'spi/fix/atmel', 'spi/fix/imx', ↵Mark Brown5-17/+62
'spi/fix/omap2-mcspi', 'spi/fix/ti-qspi' and 'spi/fix/xilinx' into spi-linus
2015-11-04Merge remote-tracking branch 'spi/fix/core' into spi-linusMark Brown1-2/+2
2015-10-30spi: pxa2xx: Rework self-initiated platform data creation for non-ACPIJarkko Nikula1-12/+26
Extend the pxa2xx_spi_acpi_get_pdata() so that it can create platform data also on platforms that do not support ACPI or if CONFIG_ACPI is not set. Now it is expected that "pxa2xx-spi" platform device is either created with explicit platform data or has an ACPI companion device. However there is only little in pxa2xx_spi_acpi_get_pdata() that is really dependent on ACPI companion and it can be reworked to cover also cases where "pxa2xx-spi" device doesn't have ACPI companion and is created without platform data. Do this by renaming the pxa2xx_spi_acpi_get_pdata(), moving it outside of CONFIG_ACPI test and changing a few runtime tests there to support non-ACPI case. Only port/bus ID setting based on ACPI _UID is dependent on ACPI and is moved to own function inside CONFIG_ACPI. Purpose of this to support non-ACPI case for those PCI enumerated compound devices that integrate both LPSS SPI host controller and integrated DMA engine under the same PCI ID and which are registered in MFD layer instead of in spi-pxa2xx-pci.c. Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-30spi: pxa2xx: Add support for Intel BroxtonJarkko Nikula1-0/+20
LPSS SPI in Intel Broxton is otherwise the same than in Intel Sunrisepoint but it supports up to four chip selects per port and has different FIFO thresholds. Patch adds support for two Broxton SoC variants. Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-30spi: pxa2xx: Detect number of enabled Intel LPSS SPI chip select signalsJarkko Nikula1-1/+21
SPI capabilities register located in private registers space of newer Intel LPSS SPI host controllers tell in register bits 12:9 which chip select signals are enabled. Use that information for detecting the number of chip selects. For simplicity we assume chip selects are enabled one after another without disabled chip selects between. For instance CS0 | CS1 | CS2 but not CS0 | CS1 | CS3. Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-30spi: pxa2xx: Add output control for multiple Intel LPSS chip selectsJarkko Nikula1-3/+24
Intel LPSS SPI host controllers in upcoming Intel platforms can have up to 4 chip selects per port. Extend chip select control in lpss_ssp_cs_control() by adding a code that selects the active chip select output prior to changing the state. Detection for number of enabled chip select signals will be added by another patch. Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-30spi: pxa2xx: Use LPSS prefix for defines that are Intel LPSS specificJarkko Nikula1-8/+8
Rename a few defines that are specific to Intel LPSS SPI private registers with LPSS prefix. It makes easier to distinguish them from common defines. Suggested-by: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-30spi: Add DSPI support for layerscape familyYuan Yao1-1/+1
LS1043a and LS2080A in the Layerscape family also support DSPI, make DSPI selectable for these hardwares. Signed-off-by: Yuan Yao <yao.yuan@freescale.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-30spi: ti-qspi: improve ->remove() callbackFelipe Balbi1-10/+1
there's no need to call pm_runtime_get_sync() followed by pm_runtime_put(). We should, instead, just call pm_runtime_put_sync() and pm_runtime_disable(). Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-29spi/spi-xilinx: Fix race condition on last word readRicardo Ribalda Delgado1-14/+24
Some users have reported that in polled mode the driver fails randomly to read the last word of the transfer. The end condition used for the transmissions (in polled and irq mode) has been the TX_EMPTY flag. But Lars-Peter Clausen has identified a delay from the TX_EMPTY to the actual end of the data rx. I believe that this race condition has not been detected until now because of the latency added by the IRQ handler or the PCIe bridge. This bugs affects setups with low latency access to the spi core. This patch replaces the readout logic: For all the words, except the last one, the TX_EMPTY flag is used (and cached). If !TX_EMPY or is the last word. The status register is read and the RX_EMPTY flag is used. The performance is not affected: there is an extra read of the Status Register, but the readout can start as soon as there is a word in the buffer. Reported-by: Edward Kigwana <ekigwana@scires.com> Initial-fix-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org
2015-10-28spi: Drop owner assignment from spi_driversAndrew F. Davis2-2/+0
An spi_driver does not need to set an owner, it will be populated by the driver core. Signed-off-by: Andrew F. Davis <afd@ti.com> Acked-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-28spi: Add THIS_MODULE to spi_driver in SPI coreAndrew F. Davis1-3/+4
Add spi_register_driver helper macro that adds THIS_MODULE to spi_driver for the registering driver. We rename and modify the existing spi_register_driver to enable this. Signed-off-by: Andrew F. Davis <afd@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-28spi: Setup the master controller driver before setting the chipselectFranklin S Cooper Jr1-2/+2
SPI controllers may need to be properly setup before chip selects can be used. Therefore, wait until the spi controller has a chance to perform their setup procedure before trying to use the chip select. This also insures that the chip selects pins are in a good state before asseting them which otherwise may cause confusion. Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com> Tested-by: Grygorii Strashko <grygorii.strashko@ti.com> Tested-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-28spi: dw: replace magic constant by DW_SPI_DRAndy Shevchenko1-1/+1
The offset 0x60 is the offset of the data register defined as DW_SPI_DR in the header file. Use it. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-27spi: mediatek: mt8173 spi multiple devices supportLeilk Liu1-13/+52
mt8173 IC spi HW has 4 gpio group, it's possible to support max <= 4 slave devices, even mtk spi HW is not congruent to spi core. 1. When a device do a spi_message transfer, spi HW should know which pad-group this device is on, and then writes pad-select register. 2. Mtk pad-select register just selects which MISO pin HW will receive data. For example, pad-select=1(select spi1 pins), HW just receives data from spi1 MISO, but it still send waveform to all 4 group cs/clk/mosi. If cs pin in other groups is still spi mode, after spi1 is selected(by active cs pin), devices on other group will also be selected. Signed-off-by: Leilk Liu <leilk.liu@mediatek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-27spi: mediatek: handle controller_data in mtk_spi_setupLeilk Liu1-7/+12
controller_data is related with device, so move to master->setup function. Signed-off-by: Leilk Liu <leilk.liu@mediatek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-27spi: mediatek: remove mtk_spi_configLeilk Liu1-33/+26
mtk_spi_config() and mtk_spi_prepare_message() both initialize spi register, so remove mtk_spi_config() and init all register in mtk_spi_prepare_message(). Signed-off-by: Leilk Liu <leilk.liu@mediatek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-24spi: fix kernel-doc warnings about missing return desc in spi.cJavier Martinez Canillas1-9/+32
When building docs with make htmldocs, warnings about not having a description for the return value are reported, i.e: warning: No description found for return value of 'spi_register_driver' Fix these by following the kernel-doc conventions explained in Documentation/kernel-doc-nano-HOWTO.txt. Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-24Merge branches 'topic/core' and 'topic/stats' of ↵Mark Brown1-8/+76
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi into spi-doc
2015-10-23spi: pxa2xx: Align a few definesJarkko Nikula1-3/+3
Add more indentation to define lines for making them aligned with the longest one. They would look messy after adding more long defines. Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-23spi: pxa2xx: Save other reg_cs_ctrl bits when configuring chip selectJarkko Nikula1-1/+3
Upcoming Intel platforms use LPSS SPI_CS_CONTROL register bits 15:12 for configuring the chip select polarities. Touch only chip select SW mode and state bits when enabling the software chip select control in order to not clear any other bits in the register. Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-23spi: pxa2xx: Convert unique ID string of ACPI device as unsigned integerJarkko Nikula1-2/+3
Andy noticed numeric unique device ID is unsigned integer so convert it using kstrtouint(). Actually integer in ACPI 2.0 and later is 64 bits litte-endian unsigned integer but quite certainly having so big value here would mean something extra than just the SPI bus number so it won't hurt to assume only lower 32 bits carry the bus number for now. Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Cc: Mika Westerberg <mika.westerberg@linux.intel.com> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-23spi: pxa2xx: derive struct chip_data from struct drv_dataAndy Shevchenko1-2/+3
Since we call pxa2xx_ssp_get_clk_div() from pump_transfers() we may derive pointer to struct chip_data from struct drv_data like it's done in the rest of the functions. This will make it less errorprone. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-23spi: pxa2xx: move debug messages to pump_transfer()Andy Shevchenko1-17/+11
The speed can be changed from transfer to transfer, that's why the messages do not depict the actual values during ->setup(). Move debug messages from ->setup() to pump_transfers(). Get rid of leftovers as well. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-23spi: imx: fix ecspi mode setupAndrew Y. Kuksov1-0/+7
Fixed problem with setting spi mode 0 or 1 after setting mode 2 or 3 SPI_MODE_0 and SPI_MODE_1 requires clock low when inactive. SPI_MODE_2 and SPI_MODE_3 requires clk high when inactive. Currently driver can just set bits in fields SCLK_PHA (SPI Clock/Data Phase Control), SCLK_POL (SPI Clock Polarity Control), SCLK_CTL (controls the inactive state of SCLK) ans SS_POL (SPI SS Polarity Select) of ECSPIx_CONFIGREG register. This patch allows driver to clear corresponding bits in these fields. Signed-off-by: Andrew Y. Kuksov <qxovxp@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-23spi/bcm63xx: move register definitions into the driverJonas Gorski2-24/+175
Move all register definitions and structs into the driver. This allows us dropping the platform_data struct and drop any arch specific includes. Make use of different device names to identify the version of the block we have. Since we now have full control over the message width, we can drop the size check, which was broken anyway, since it never set ret to any error code. Also since we now have no arch depedendent resources, we can now allow compiling it for any arch, hidden behind COMPILE_TEST. Signed-off-by: Jonas Gorski <jogo@openwrt.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-23spi: atmel: Fix DMA-setup for transfers with more than 8 bits per wordDavid Mosberger-Tang1-1/+2
The DMA-slave configuration depends on the whether <= 8 or > 8 bits are transferred per word, so we need to call atmel_spi_dma_slave_config() with the correct value. Signed-off-by: David Mosberger <davidm@egauge.net> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org
2015-10-22spi: omap2-mcspi: disable other channels CHCONF_FORCE in prepare_messageNeil Armstrong1-0/+28
Since the "Switch driver to use transfer_one" change, the cs_change behavior has changed and a channel chip select can still be asserted when changing channel from a previous last transfer in a message having the cs_change attribute. Since there is no sense having multiple chip select being asserted at the same time, disable all the remaining forced chip selects in a the prepare_message called right before a spi_transfer_one_message call. It ignores the current channel configuration in order to keep the possibility to leave the chip select asserted between messages. It fixes this bug on a DM8168 SoC ES2.1 Soc and an OMAP4 ES2.1 SoC. It was hanging all the other channels transfers when a CHCONF_FORCE is present on the wrong channel. Fixes: b28cb9414db9 ("spi: omap2-mcspi: Switch driver to use transfer_one") Signed-off-by: Neil Armstrong <narmstrong@baylibre.com> Reviewed-by: Michael Welling <mwelling@ieee.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-21spi: core: use gpio_is_valid() helperAndy Shevchenko1-1/+1
Check if GPIO pin is valid by API helper function. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-20spi: dw: remove a NULL check when call ->remove()Andy Shevchenko1-2/+0
Currently all users aware about calling dw_spi_remove_host() with properly set parameter. Remove unneeded check. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-20spi: dw: explicitly free IRQ handler in dw_spi_remove_host()Andy Shevchenko1-2/+4
The following warning occurs when DW SPI is compiled as a module and it's a PCI device. On the removal stage pcibios_free_irq() is called earlier than free_irq() due to the latter is called at managed resources free strage. ------------[ cut here ]------------ WARNING: CPU: 1 PID: 1003 at /home/andy/prj/linux/fs/proc/generic.c:575 remove_proc_entry+0x118/0x150() remove_proc_entry: removing non-empty directory 'irq/38', leaking at least 'dw_spi1' Modules linked in: spi_dw_midpci(-) spi_dw [last unloaded: dw_dmac_core] CPU: 1 PID: 1003 Comm: modprobe Not tainted 4.3.0-rc5-next-20151013+ #32 00000000 00000000 f5535d70 c12dc220 f5535db0 f5535da0 c104e912 c198a6bc f5535dcc 000003eb c198a638 0000023f c11b4098 c11b4098 f54f1ec8 f54f1ea0 f642ba20 f5535db8 c104e96e 00000009 f5535db0 c198a6bc f5535dcc f5535df0 Call Trace: [<c12dc220>] dump_stack+0x41/0x61 [<c104e912>] warn_slowpath_common+0x82/0xb0 [<c11b4098>] ? remove_proc_entry+0x118/0x150 [<c11b4098>] ? remove_proc_entry+0x118/0x150 [<c104e96e>] warn_slowpath_fmt+0x2e/0x30 [<c11b4098>] remove_proc_entry+0x118/0x150 [<c109b96a>] unregister_irq_proc+0xaa/0xc0 [<c109575e>] free_desc+0x1e/0x60 [<c10957d2>] irq_free_descs+0x32/0x70 [<c109b1a0>] irq_domain_free_irqs+0x120/0x150 [<c1039e8c>] mp_unmap_irq+0x5c/0x60 [<c16277b0>] intel_mid_pci_irq_disable+0x20/0x40 [<c1627c7f>] pcibios_free_irq+0xf/0x20 [<c13189f2>] pci_device_remove+0x52/0xb0 [<c13f6367>] __device_release_driver+0x77/0x100 [<c13f6da7>] driver_detach+0x87/0x90 [<c13f5eaa>] bus_remove_driver+0x4a/0xc0 [<c128bf0d>] ? selinux_capable+0xd/0x10 [<c13f7483>] driver_unregister+0x23/0x60 [<c10bad8a>] ? find_module_all+0x5a/0x80 [<c1317413>] pci_unregister_driver+0x13/0x60 [<f80ac654>] dw_spi_driver_exit+0xd/0xf [spi_dw_midpci] [<c10bce9a>] SyS_delete_module+0x17a/0x210 Explicitly call free_irq() at removal stage of the DW SPI driver. Fixes: 04f421e7b0b1 (spi: dw: use managed resources) Cc: stable@vger.kernel.org Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-19spi: dw-mmio: convert to unified device property APIAndy Shevchenko1-4/+3
Convert the driver to use unfied device property API instead of OF one. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-19spi: dw-pci: remove unused pdev member from struct dw_spi_pciAndy Shevchenko1-20/+9
The pdev member is not used anywhere, thus remove it. Moreover struct dw_spi_pci becomes an equivalent of struct dw_spi and therefore remove entire struct dw_spi_pci. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-19spi: dw: introduce spi_shutdown_chip()Andy Shevchenko2-7/+12
This helper disables SPI controller and sets clock to 0. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-19spi: dw: eliminate unused threshold variablesAndy Shevchenko1-5/+0
The tx_threshold and rx_threshold variables are not used anywhere. Remove them. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-19spi: dw: eliminate speed variable in ->transfer_one()Andy Shevchenko1-8/+4
There is no point to have a separate variable for speed in ->transfer_one(). While here, remove !chip->clk_div from a condition since it is assigned simultaneously with chip->speed_hz. We can do this safely because a) transfer speed can't be higher than max_freq and therefore chip->clk_div can be 0 only when chip->speed_hz is 0, and b) transfer speed can't be 0, otherwise we will get division by zero exception. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-19spi: dw: remove bits_per_word member of struct chip_dataAndy Shevchenko1-14/+2
There is no need to carry over spi->bits_per_word and Co from ->setup() in struct chip_data since ->transfer_one() will anyway take the transfer parameters from struct spi_transfer. This is since SPI core validates both bits_per_word transfer parameter and defaults to spi->bits_per_word in case that per transfer parameter is not set. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-19spi: dw: remove unneeded cr0 member of struct chip_dataAndy Shevchenko1-12/+2
Since we recalculate cr0 each time we start a transfer the chip_data->cr0 becomes redundant. Remove it and related pieces. This is a follow up to commit 0ed36990a93b (spi: dw: Remove needless if statements). Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-19spi: dw: use plain struct device * at earlier ->probe()Andy Shevchenko1-1/+1
The name of the master device is set during registrationg which happens after we issue the error message. Change it to plain struct device * to see which device registration failed. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-16spi: davinci: use spi->cs_gpio directlyLuis de Bethencourt1-11/+4
Use spi->cs_gpio directly to remove the following build warning: drivers/spi/spi-davinci.c:219:6: warning: 'gpio' may be used uninitialized in this function Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com> Suggested-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-16spi: spi-ti-qspi: switch to polling mode for better r/w performanceVignesh R1-54/+20
Currently word completion interrupt is fired for transfer of every word(8bit to 128bit in size). This adds a lot of overhead, and decreases r/w throughput. It hardly takes 3us(@48MHz) for 128bit r/w to complete, hence its better to poll on word complete bit to be set in QSPI_SPI_STATUS_REG instead of using interrupts. This increases the throughput by 30% in both read and write case. So, switch to polling mode instead of interrupts to determine completion of word transfer. Signed-off-by: Vignesh R <vigneshr@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>