linux/drivers/spi
Greg Ungerer 602c8f4485 spi: imx: fix use of native chip-selects with devicetree
The commonly used mechanism of specifying the hardware or native
chip-select on an SPI device in devicetree (that is "cs-gpios = <0>")
does not result in the native chip-select being configured for use.
So external SPI devices that require use of the native chip-select
will not work.

You can successfully specify native chip-selects if using a platform
setup by specifying the cs-gpio as negative offset by 32. And that
works correctly. You cannot use the same method in devicetree.

The logic in the spi-imx.c driver during probe uses core spi function
of_spi_register_master() in spi.c to parse the "cs-gpios" devicetree tag.
For valid GPIO values that will be recorded for use, all other entries in
the cs_gpios list will be set to -ENOENT. So entries like "<0>" will be
set to -ENOENT in the cs_gpios list.

When the SPI device registers are setup the code will use the GPIO
listed in the cs_gpios list for the desired chip-select. If the cs_gpio
is less then 0 then it is intended to be for a native chip-select, and
its cs_gpio value is added to 32 to get the chipselect number to use.
Problem is that with devicetree this can only ever be -ENOENT (which
is -2), and that alone results in an invalid chip-select number. But also
doesn't allow selection of the native chip-select at all.

To fix, if the cs_gpio specified for this spi device is not a
valid GPIO then use the "chip_select" (that is the native chip-select
number) for hardware setup.

Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Tested-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-29 21:09:03 +01:00
..
Kconfig Merge remote-tracking branches 'spi/topic/spidev', 'spi/topic/st-ssc4' and 'spi/topic/stm32' into spi-next 2017-07-03 16:21:12 +01:00
Makefile Merge remote-tracking branches 'spi/topic/spidev', 'spi/topic/st-ssc4' and 'spi/topic/stm32' into spi-next 2017-07-03 16:21:12 +01:00
spi-adi-v3.c
spi-altera.c
spi-armada-3700.c Merge remote-tracking branches 'spi/topic/armada', 'spi/topic/ath79', 'spi/topic/bcm-qspi' and 'spi/topic/bcm53xx' into spi-next 2017-02-19 16:40:55 +00:00
spi-ath79.c spi: spi-ath79: use gpio_set_value_cansleep for GPIO chip select 2016-12-14 17:36:57 +00:00
spi-atmel.c Merge remote-tracking branches 'spi/topic/atmel', 'spi/topic/bcm63xx', 'spi/topic/davinci' and 'spi/topic/imx' into spi-next 2017-07-03 16:21:06 +01:00
spi-au1550.c
spi-axi-spi-engine.c spi: spi-axi: Free resources on error path 2017-01-09 11:20:46 +00:00
spi-bcm53xx.c spi: bcm53xx: (re)license code to the GPL v2 2017-01-06 18:21:50 +00:00
spi-bcm53xx.h
spi-bcm63xx-hsspi.c spi: bcm63xx-hsspi: Export OF device ID table as module aliases 2017-05-14 19:01:38 +09:00
spi-bcm63xx.c spi/bcm63xx: Fix checkpatch warnings 2017-06-21 12:14:54 +01:00
spi-bcm2835.c spi: bcm2835: Remove unnecessary workaround to call gpio_set_value 2016-02-15 20:43:39 +00:00
spi-bcm2835aux.c Merge remote-tracking branches 'spi/topic/acpi', 'spi/topic/axi-engine', 'spi/topic/bcm2835' and 'spi/topic/bcm2835aux' into spi-next 2016-03-11 14:28:25 +07:00
spi-bcm-qspi.c spi: Updates for v4.11 2017-02-20 17:26:11 -08:00
spi-bcm-qspi.h spi: iproc-qspi: Add Broadcom iProc SoCs support 2016-09-24 20:03:25 +01:00
spi-bfin5xx.c spi: spi-bfin5xx: Remove deprecated create_singlethread_workqueue 2016-07-03 14:14:31 +02:00
spi-bfin-sport.c spi: spi-bfin-sport: Remove deprecated create_singlethread_workqueue 2016-07-03 14:24:31 +02:00
spi-bitbang-txrx.h
spi-bitbang.c spi: bitbang: switch to the generic implementation of transfer_one_message 2015-10-05 14:55:56 +01:00
spi-brcmstb-qspi.c spi: brcmstb-qspi: Broadcom settop platform driver 2016-09-14 18:03:32 +01:00
spi-butterfly.c spi: butterfly: use new parport device model 2015-12-02 19:38:16 +00:00
spi-cadence.c spi: cadence: Allow for GPIO pins to be used as chipselects 2017-04-26 15:23:45 +01:00
spi-cavium-octeon.c spi: octeon: Split driver into Octeon specific and common parts 2016-07-24 21:54:29 +01:00
spi-cavium-thunderx.c spi: spi-cavium-thunderx: Add missing clk_disable_unprepare() 2016-08-24 12:37:43 +01:00
spi-cavium.c spi: octeon: Split driver into Octeon specific and common parts 2016-07-24 21:54:29 +01:00
spi-cavium.h spi: octeon: Add ThunderX driver 2016-08-19 16:24:39 +01:00
spi-clps711x.c spi: clps711x: Driver refactor 2016-07-07 11:44:43 +02:00
spi-coldfire-qspi.c spi: spi-coldfire-qspi: enable RuntimePM before registering to the core 2015-10-12 17:02:08 +01:00
spi-davinci.c spi: davinci: Handle return value of clk_prepare_enable 2017-06-06 19:36:45 +01:00
spi-dln2.c spi: Drop duplicate code to set master->dev.parent 2016-04-26 11:56:09 +01:00
spi-dw-mid.c spi: dw-mid: switch to new dmaengine_terminate_* API (part 2) 2017-01-04 12:27:00 +00:00
spi-dw-mmio.c spi: dw: Disable clock after unregistering the host 2017-04-18 19:16:49 +01:00
spi-dw-pci.c spi: dw-pci: Spelling s/paltforms/platforms/g 2016-05-11 18:26:19 +01:00
spi-dw.c spi: dw: Make debugfs use bus num and make irq name unique 2017-01-09 11:22:14 +00:00
spi-dw.h spi: dw: Make debugfs use bus num and make irq name unique 2017-01-09 11:22:14 +00:00
spi-efm32.c
spi-ep93xx.c spi: spi-ep93xx: simplify GPIO chip selects 2017-02-16 20:10:26 +00:00
spi-falcon.c
spi-fsl-cpm.c QE: Move QE from arch/powerpc to drivers/soc 2015-12-22 17:12:56 -06:00
spi-fsl-cpm.h
spi-fsl-dspi.c spi: spi-fsl-dspi: ensure non-zero return on error path 2017-05-22 16:14:22 +01:00
spi-fsl-espi.c spi: fsl-espi: fix ioread16/iowrite16 endianness 2016-12-01 18:50:59 +00:00
spi-fsl-lib.c
spi-fsl-lib.h spi: fsl-espi: separate fsl-espi from fsl-lib completely 2016-11-14 11:21:48 +00:00
spi-fsl-lpspi.c spi: fsl-lpspi: fix indentation error 2017-01-09 19:34:02 +00:00
spi-fsl-spi.c Merge remote-tracking branches 'spi/topic/devprop', 'spi/topic/fsl', 'spi/topic/fsl-dspi', 'spi/topic/imx' and 'spi/topic/lantiq' into spi-next 2017-04-26 15:58:04 +01:00
spi-fsl-spi.h
spi-gpio.c
spi-img-spfi.c spi: img-spfi: Remove spi_master_put in img_spfi_remove() 2016-07-27 19:00:16 +01:00
spi-imx.c spi: imx: fix use of native chip-selects with devicetree 2017-08-29 21:09:03 +01:00
spi-iproc-qspi.c spi: iproc-qspi: Add Broadcom iProc SoCs support 2016-09-24 20:03:25 +01:00
spi-jcore.c spi: jcore: Fix module autoload for OF registration 2016-11-23 16:42:20 +00:00
spi-lantiq-ssc.c Merge remote-tracking branches 'spi/topic/devprop', 'spi/topic/fsl', 'spi/topic/fsl-dspi', 'spi/topic/imx' and 'spi/topic/lantiq' into spi-next 2017-04-26 15:58:04 +01:00
spi-lm70llp.c spi: lm70llp: remove printk 2015-12-07 20:09:09 +00:00
spi-loopback-test.c spi: loopback-test: Fix kfree() NULL pointer error. 2017-06-28 20:16:41 +01:00
spi-lp8841-rtc.c spi: lp-8841: return correct error code from probe 2016-02-26 11:06:38 +09:00
spi-meson-spicc.c spi: Add Meson SPICC driver 2017-05-24 18:19:25 +01:00
spi-meson-spifc.c spi: meson: Add GXBB compatible 2016-09-12 20:11:39 +01:00
spi-mpc52xx-psc.c spi: spi-mpc52xx-psc: Remove deprecated create_singlethread_workqueue 2016-07-03 14:23:25 +02:00
spi-mpc52xx.c spi/mpc52xx: Combine substrings for two messages 2017-01-17 18:28:19 +00:00
spi-mpc512x-psc.c spi: mpc512x: Call mpc512x_psc_spi_transfer_setup() unconditionally 2015-09-17 12:33:31 +01:00
spi-mt65xx.c spi: mediatek: add spi support for mt2712 IC 2017-06-20 13:39:14 +01:00
spi-mxs.c
spi-nuc900.c
spi-oc-tiny.c
spi-omap2-mcspi.c spi: omap2-mcspi: remove redundant check for error status 2017-05-26 12:40:11 +01:00
spi-omap-100k.c spi: omap-100k: Rely on validations done by spi core 2015-09-17 12:34:20 +01:00
spi-omap-uwire.c spi: omap-uwire: Remove needless bits_per_word and speed_hz tests 2015-09-17 12:33:58 +01:00
spi-orion.c spi: orion: Handle GPIO chip-selects 2017-05-24 18:02:43 +01:00
spi-pic32-sqi.c spi: pic32-sqi: use list_move_tail and list_move 2016-08-08 11:56:40 +01:00
spi-pic32.c spi: pic32: fixup wait_for_completion_timeout return handling 2016-07-24 21:49:16 +01:00
spi-pl022.c spi: pl022: don't use uninitialized variable 2017-04-06 11:55:22 +01:00
spi-ppc4xx.c spi/ppc4xx: Use kcalloc() in spi_ppc4xx_of_probe() 2017-01-17 18:34:25 +00:00
spi-pxa2xx-dma.c spi: pxa2xx: Remove pointer to chip data from driver data 2016-09-12 20:01:27 +01:00
spi-pxa2xx-pci.c spi: pca2xx-pci: Allow MSI 2017-01-23 18:09:37 +00:00
spi-pxa2xx.c spi: pxa2xx: Add support for Intel Cannonlake 2017-06-06 20:01:15 +01:00
spi-pxa2xx.h spi: spi-pxa2xx: Remove unused macro 2016-11-14 13:52:04 +00:00
spi-qup.c Merge remote-tracking branches 'spi/topic/octeon', 'spi/topic/pic32-sqi', 'spi/topic/pxa2xx' and 'spi/topic/qup' into spi-next 2016-09-30 09:14:14 -07:00
spi-rb4xx.c
spi-rockchip.c spi: rockchip: Disable Runtime PM when chip select is asserted 2017-06-28 19:43:18 +01:00
spi-rspi.c Merge remote-tracking branches 'spi/topic/rockchip', 'spi/topic/rspi', 'spi/topic/s3c64xx', 'spi/topic/sh-msiof' and 'spi/topic/slave' into spi-next 2017-02-19 16:41:05 +00:00
spi-s3c24xx-fiq.h
spi-s3c24xx-fiq.S
spi-s3c24xx.c
spi-s3c64xx.c Merge remote-tracking branches 'spi/topic/rockchip', 'spi/topic/rspi', 'spi/topic/s3c64xx', 'spi/topic/sh-msiof' and 'spi/topic/slave' into spi-next 2017-02-19 16:41:05 +00:00
spi-sc18is602.c spi: sc18is602: Add OF device ID table 2017-02-22 10:50:09 -08:00
spi-sh-hspi.c
spi-sh-msiof.c spi: sh-msiof: Add slave mode support 2017-05-26 13:11:54 +01:00
spi-sh-sci.c
spi-sh.c spi: spi-sh: Remove deprecated create_singlethread_workqueue 2016-07-11 19:32:38 +01:00
spi-sirf.c spi: sirf: fix spelling mistake: "registerred" -> "registered" 2017-06-28 20:02:52 +01:00
spi-slave-system-control.c spi: slave: Add SPI slave handler controlling system state 2017-05-26 13:12:19 +01:00
spi-slave-time.c spi: slave: Add SPI slave handler reporting uptime at previous message 2017-05-26 13:12:04 +01:00
spi-st-ssc4.c spi: st-ssc4: whitespace cleanup 2017-05-26 12:41:07 +01:00
spi-stm32.c spi: stm32: fix potential dereference null return value 2017-06-28 20:00:55 +01:00
spi-sun4i.c spi: sun4i: Allow transfers larger than FIFO size 2016-10-29 12:11:30 -06:00
spi-sun6i.c spi: sun6i: update max transfer size reported 2017-03-20 15:38:51 +00:00
spi-tegra20-sflash.c spi: tegra: fix spelling mistake: "trasfer" -> "transfer" 2017-04-24 18:44:28 +01:00
spi-tegra20-slink.c spi: tegra: fix spelling mistake: "trasfer" -> "transfer" 2017-04-24 18:44:28 +01:00
spi-tegra114.c spi: tegra: fix spelling mistake: "trasfer" -> "transfer" 2017-04-24 18:44:28 +01:00
spi-test.h spi: loopback-test: add elapsed time check 2017-03-17 21:54:08 +00:00
spi-ti-qspi.c Merge remote-tracking branches 'spi/topic/ti-qspi' and 'spi/topic/xlp' into spi-next 2017-04-26 15:58:22 +01:00
spi-tle62x0.c spi: Drop owner assignment from spi_drivers 2015-10-28 10:30:17 +09:00
spi-topcliff-pch.c spi/topcliff-pch: Delete an error message for a failed memory allocation in pch_spi_set_tx() 2017-01-17 18:38:02 +00:00
spi-txx9.c spi: spi-txx9: Add missing clock (un)prepare calls for CCF 2016-08-18 19:10:39 +01:00
spi-xcomm.c
spi-xilinx.c spi: xilinx: Return IRQ_NONE if no interrupts were detected 2016-07-15 11:45:00 +01:00
spi-xlp.c spi: xlp: update for ARCH_VULCAN2 2017-03-13 16:48:40 +00:00
spi-xtensa-xtfpga.c spi: xtensa-xtfpga: fix register endianness 2015-09-22 09:30:10 -07:00
spi-zynqmp-gqspi.c spi: zynqmp: disable clocks in error paths 2016-05-04 14:21:03 +01:00
spi.c Merge remote-tracking branch 'spi/topic/core' into spi-next 2017-07-03 16:21:05 +01:00
spidev.c Merge branch 'for-spi' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2017-07-08 10:41:53 -07:00