aboutsummaryrefslogtreecommitdiff
path: root/drivers/spi
AgeCommit message (Collapse)AuthorFilesLines
2016-10-24spi: imx: support DMA for imx35Martin Kaiser1-3/+18
Support DMA transfers on imx35 and compatible chipsets (imx31, imx25). If DMA can be used, set the start mode control (SMC) bit to start the SPI burst as soon as data is written into the tx fifo. Configure DMA requests when the fifo is half empty during tx or half full during rx. Signed-off-by: Martin Kaiser <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-10-24spi: omap2-mcspi: Remove redundant return value check of platform_get_resource()Wei Yongjun1-5/+0
Remove unneeded error handling on the result of a call to platform_get_resource() when the value is passed to devm_ioremap_resource(). Signed-off-by: Wei Yongjun <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-10-21spi: spidev: Add device to spidev device tree compatibility listFabien Lahoudere1-0/+1
Entries are needed in the spidev ID list to configure configure it from a device tree. Add entry for the following device: - "ge,achc" : GE Healthcare USB Management Controller The USB Management Controller does not expose USB to the host, but acts as an offload engine, communicating with specific USB based data acquisition devices which are connected to it, extracting the required data and providing it to the host via other methods. SPI is used as an out-of-band configuration channel. Signed-off-by: Fabien Lahoudere <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-10-21spi: omap2-mcspi: Fix modifying platform resource dataVikram N1-4/+2
currently during probe the resource data gets modified and device physical address remains valid only during first load. If the module is unloaded and loaded again, the ioremp will be done on a incorrect address as the resource was modified during previous module load. This patch fixes this issue. Signed-off-by: Vikram N <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-10-21spi: fsl-espi: fix handling of word sizes other than 8 bitHeiner Kallweit1-48/+36
The code in fsl_espi_tx_buf_lsb and parts of fsl_espi_setup_transfer look very weird and don't reflect the ESPI spec. ESPI stores values with <= 8 bit word size right justified as 8 bit value and values with > 8 bit word size right justified as 16 bit value. Therefore no such shifting is needed. Only case MSB-first with 8 bit word size is correctly handled, and most likely nobody ever used this driver with a different config. On ESPI only the case LSB-first with word size > 8 bit needs a special handling. In this case a little endian 16 bit value has to be written to the TX FIFO what requires a byte swap as the host system is big endian. The same applies to reading from the RX FIFO. Signed-off-by: Heiner Kallweit <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-10-21spi: fsl-espi: reject MSB-first transfers with word sizes other than 8 or 16Heiner Kallweit1-0/+10
According to the ESPI spec MSB-first transfers are supported for word size 8 and 16 only. Check for this and reject MSB-first transfers with other word sizes. Signed-off-by: Heiner Kallweit <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-10-21spi: fsl-espi: replace of_get_property with of_property_read_u32Heiner Kallweit1-21/+20
of_property_read_u32 is better here than generic of_get_property: - implicit endianness conversion if needed - implicit checking of size of property Signed-off-by: Heiner Kallweit <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-10-21spi: Add Flag to Enable Slave Select with GPIO Chip Select.Thor Thayer1-2/+7
Some SPI masters require slave selection before the transfer can begin [1]. The SPI framework currently selects the chip using either 1) the internal CS mechanism or 2) the GPIO CS, but not both. This patch adds a new master->flags define to indicate both the GPIO CS and the internal chip select mechanism should be used. Tested On: Altera CycloneV development kit Compile tested for build errors on x86_64 (allyesconfigs) [1] DesignWare dw_apb_ssi Databook, Version 3.20a (page 39) Signed-off-by: Thor Thayer <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-10-11kthread: kthread worker API cleanupPetr Mladek1-9/+9
A good practice is to prefix the names of functions by the name of the subsystem. The kthread worker API is a mix of classic kthreads and workqueues. Each worker has a dedicated kthread. It runs a generic function that process queued works. It is implemented as part of the kthread subsystem. This patch renames the existing kthread worker API to use the corresponding name from the workqueues API prefixed by kthread_: __init_kthread_worker() -> __kthread_init_worker() init_kthread_worker() -> kthread_init_worker() init_kthread_work() -> kthread_init_work() insert_kthread_work() -> kthread_insert_work() queue_kthread_work() -> kthread_queue_work() flush_kthread_work() -> kthread_flush_work() flush_kthread_worker() -> kthread_flush_worker() Note that the names of DEFINE_KTHREAD_WORK*() macros stay as they are. It is common that the "DEFINE_" prefix has precedence over the subsystem names. Note that INIT() macros and init() functions use different naming scheme. There is no good solution. There are several reasons for this solution: + "init" in the function names stands for the verb "initialize" aka "initialize worker". While "INIT" in the macro names stands for the noun "INITIALIZER" aka "worker initializer". + INIT() macros are used only in DEFINE() macros + init() functions are used close to the other kthread() functions. It looks much better if all the functions use the same scheme. + There will be also kthread_destroy_worker() that will be used close to kthread_cancel_work(). It is related to the init() function. Again it looks better if all functions use the same naming scheme. + there are several precedents for such init() function names, e.g. amd_iommu_init_device(), free_area_init_node(), jump_label_init_type(), regmap_init_mmio_clk(), + It is not an argument but it was inconsistent even before. [[email protected]: fix linux-next merge conflict] Link: http://lkml.kernel.org/r/[email protected] Link: http://lkml.kernel.org/r/[email protected] Suggested-by: Andrew Morton <[email protected]> Signed-off-by: Petr Mladek <[email protected]> Cc: Oleg Nesterov <[email protected]> Cc: Tejun Heo <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Steven Rostedt <[email protected]> Cc: "Paul E. McKenney" <[email protected]> Cc: Josh Triplett <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Jiri Kosina <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Vlastimil Babka <[email protected]> Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2016-10-11spi: dw: Set GPIO_SS flag to toggle Slave Select on GPIO CSThor Thayer1-0/+1
The Designware SPI master requires slave selection before the transfer can begin [1]. This patch uses the new master flag to indicate both the GPIO CS and the internal chip select should be used. Tested On: Altera CycloneV development kit Compile tested for build errors on x86_64 (allyesconfigs) [1] DesignWare dw_apb_ssi Databook, Version 3.20a (page 39) Signed-off-by: Thor Thayer <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-10-11spi: Add Flag to Enable Slave Select with GPIO Chip Select.Thor Thayer1-2/+7
Some SPI masters require slave selection before the transfer can begin [1]. The SPI framework currently selects the chip using either 1) the internal CS mechanism or 2) the GPIO CS, but not both. This patch adds a new master->flags define to indicate both the GPIO CS and the internal chip select mechanism should be used. Tested On: Altera CycloneV development kit Compile tested for build errors on x86_64 (allyesconfigs) [1] DesignWare dw_apb_ssi Databook, Version 3.20a (page 39) Signed-off-by: Thor Thayer <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-30Merge remote-tracking branches 'spi/topic/ti-qspi', 'spi/topic/tools', ↵Mark Brown3-21/+137
'spi/topic/txx9' and 'spi/topic/xlp' into spi-next
2016-09-30Merge remote-tracking branches 'spi/topic/rspi', 'spi/topic/sc18is602', ↵Mark Brown4-11/+33
'spi/topic/sh-msiof', 'spi/topic/spidev-test' and 'spi/topic/st-ssc4' into spi-next
2016-09-30Merge remote-tracking branches 'spi/topic/octeon', 'spi/topic/pic32-sqi', ↵Mark Brown9-55/+273
'spi/topic/pxa2xx' and 'spi/topic/qup' into spi-next
2016-09-30Merge remote-tracking branches 'spi/topic/fsl-espi', 'spi/topic/imx', ↵Mark Brown8-382/+505
'spi/topic/jcore', 'spi/topic/loopback' and 'spi/topic/meson' into spi-next
2016-09-30Merge remote-tracking branches 'spi/topic/bcm', 'spi/topic/dw' and ↵Mark Brown9-15/+1756
'spi/topic/fsl-dspi' into spi-next
2016-09-30Merge remote-tracking branch 'spi/topic/dma' into spi-nextMark Brown1-3/+14
2016-09-29spi: sc18is602: Change gpiod_set_value to gpiod_set_value_cansleepPhil Reid1-1/+1
To avoid warning when using i2c gpio expander change call to the cansleep variant. There should be no issue with sleeping in the drivers probe function. Signed-off-by: Phil Reid <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-29spi: pxa2xx: Fix build error because of missing headerMika Westerberg1-0/+1
Kbuild test robot reports: drivers/spi/spi-pxa2xx.c: In function ‘setup_cs’: drivers/spi/spi-pxa2xx.c:1190:20: error: implicit declaration of function ‘desc_to_gpio’ ... Reason for this is the fact that those functions are declared in linux/gpio/consumer.h which is not included in the driver. Fix this by including it. Reported-by: kbuild test robot <[email protected]> Signed-off-by: Mika Westerberg <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-28spi: imx: fix error return code in spi_imx_probe()Wei Yongjun1-0/+1
Fix to return error code -EINVAL if no CS GPIOs available instead of 0, as done elsewhere in this function. Fixes: f13d4e189d20 ("spi: imx: Gracefully handle NULL master->cs_gpios") Signed-off-by: Wei Yongjun <[email protected]> Acked-by: Marek Vasut <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-26spi: pxa2xx: Add support for GPIO descriptor chip selectsMika Westerberg2-3/+57
The driver uses custom chip_info coming from platform data for chip selects implemented as GPIOs. If the system lacks board files setting up the platform data, it is not possible to use GPIOs as chip selects. This adds support for GPIO descriptors so that regardless of the underlying firmware interface (DT, ACPI or platform data) the driver can request GPIOs used as chip selects and configure them accordingly. The custom chip_info GPIO support is still left there to make sure the existing systems keep working as expected. Signed-off-by: Mika Westerberg <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-26spi: imx: Gracefully handle NULL master->cs_gpiosMarek Vasut1-0/+5
It is possible that master->cs_gpios is NULL after spi_bitbang_start(), this happens if the master has no CS GPIOs specified in DT. Check for this case after spi_bitbang_start() to prevent NULL pointer dereference in the subsequent for loop, which accesses the master->cs_gpios field. Signed-off-by: Marek Vasut <[email protected]> Cc: Martin Kaiser <[email protected]> Cc: Mark Brown <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-24spi: iproc-qspi: Add Broadcom iProc SoCs supportKamal Dasu4-5/+291
This spi driver uses the common spi-bcm-qspi driver and implements iProc SoCs specific interrupt controller. The common driver now calls the SoC handlers when present. Adding support for both muxed l1 and unmuxed interrupt sources. Signed-off-by: Kamal Dasu <[email protected]> Signed-off-by: Yendapally Reddy Dhananjaya Reddy <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-24spi: fsl-espi: improve return value handling in fsl_espi_probeHeiner Kallweit1-16/+8
The return value of fsl_espi_probe (currently struct spi_master *) is just used for checking whether an error occurred. Change the return value type to int and simplify the code. Signed-off-by: Heiner Kallweit <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-24spi: fsl-espi: simplify of_fsl_espi_probeHeiner Kallweit1-14/+7
Simplify of_fsl_espi_probe. Signed-off-by: Heiner Kallweit <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-24spi: fsl-espi: remove unused variable in fsl_espi_setupHeiner Kallweit1-2/+0
Remove an unused variable. Signed-off-by: Heiner Kallweit <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-16spi: bcm-qspi: Fix error return code in bcm_qspi_probe()Wei Yongjun1-0/+2
Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function. Fixes: fa236a7ef240 ("spi: bcm-qspi: Add Broadcom MSPI driver") Signed-off-by: Wei Yongjun <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-16spi: bcm-qspi: Fix return value check in bcm_qspi_probe()Wei Yongjun1-2/+2
In case of error, the function kcalloc() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test. Fixes: fa236a7ef240 ("spi: bcm-qspi: Add Broadcom MSPI driver") Signed-off-by: Wei Yongjun <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-16spi: bcm-qspi: fix suspend/resume #ifdefArnd Bergmann1-8/+4
The two power management functions are define inside of an #ifdef but referenced unconditionally, which is obviously broken when CONFIG_PM_SLEEP is not set: drivers/spi/spi-bcm-qspi.c:1300:13: error: 'bcm_qspi_suspend' undeclared here (not in a function) drivers/spi/spi-bcm-qspi.c:1301:13: error: 'bcm_qspi_resume' undeclared here (not in a function) This replaces the #ifdef with a __maybe_unused annotation that lets the compiler figure out whether to drop the functions itself, and uses SIMPLE_DEV_PM_OPS() to refer to the functions. This will also fill the freeze/thaw/poweroff/restore callback pointers in addition to suspend/resume, but as far as I can tell, this is what we want. Signed-off-by: Arnd Bergmann <[email protected]> Fixes: fa236a7ef240 ("spi: bcm-qspi: Add Broadcom MSPI driver") Signed-off-by: Mark Brown <[email protected]>
2016-09-16spi: bcm-qspi: don't include linux/mtd/cfi.hArnd Bergmann1-1/+0
The header isn't actually needed here, but including it leads to a build warning when CONFIG_MTD is disabled: include/linux/mtd/cfi.h:76:2: #warning No CONFIG_MTD_CFI_Ix selected. No NOR chip support can work. [-Werror=cpp] Fixes: fa236a7ef240 (spi: bcm-qspi: Add Broadcom MSPI driver) Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-14spi: fsl-espi: improve and extend register bit definitionsHeiner Kallweit1-19/+33
Add definition of further register bits for use in upcoming driver extensions and improve current bit definitions: - use BIT macro - use bit names as in the chip spec Signed-off-by: Heiner Kallweit <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-14spi: fsl-espi: align register access with other driversHeiner Kallweit2-64/+73
Change register access to the method used in other drivers too. - use register names as in the chip spec for constants - avoid hard to read statements like __be32 __iomem *espi_mode = &reg_base->mode - get rid of old powerpc-specific functions like in_8 In addition annotate reg_base in struct mpc8xxx_spi as __iomem. Signed-off-by: Heiner Kallweit <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-14spi: fsl-espi: improve and simplify interrupt handlerHeiner Kallweit1-10/+6
Simplify the interrupt handler a little. In addition don't call fsl_espi_cpu_irq() if no event bit is set. Signed-off-by: Heiner Kallweit <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-14spi: fsl-espi: simplify fsl_espi_setup_transferHeiner Kallweit1-14/+2
If t is not null then the SPI core takes care that bits_per_word and speed_hz are populated. This allows to simplify fsl_espi_setup_transfer. Signed-off-by: Heiner Kallweit <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-14spi: imx: support loopback mode on imx35Martin Kaiser1-1/+11
imx35 and compatible chipsets support loopback mode by setting a loopback control bit in the test register. Make this setting available for data transfers, similar to what we do for imx51. Signed-off-by: Martin Kaiser <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-14spi: imx: set spi_bus_clk for mx1, mx31 and mx35Martin Kaiser1-5/+12
Modify spi_imx_clkdiv_2() to return the resulting bus clock frequency when the selected clock divider is applied. Set spi_imx->spi_bus_clk to this frequency. If spi_bus_clk is unset, spi_imx_calculate_timeout() causes a division by 0. Signed-off-by: Martin Kaiser <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-14spi: bcm-qspi: Add BSPI spi-nor flash controller driverKamal Dasu2-3/+620
This change implements BSPI driver for Broadcom BRCMSTB, NS2, NSP SoCs works in combination with the MSPI controller driver and implements flash read acceleration and implements the spi_flash_read() method. Both MSPI and BSPI controllers are needed to access spi-nor flash. Signed-off-by: Kamal Dasu <[email protected]> Signed-off-by: Yendapally Reddy Dhananjaya Reddy <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-14spi: brcmstb-qspi: Broadcom settop platform driverKamal Dasu2-1/+54
Adding the settop SoC platfrom driver, this driver is compatible with the settop MSPI+BSPI and MSPI only blocks implemented on the SoCs. Driver calls the spi-bcm-qspi probe(), remove() and pm_ops. Signed-off-by: Kamal Dasu <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-14spi: bcm-qspi: Add Broadcom MSPI driverKamal Dasu4-0/+786
Master SPI driver for Broadcom settop, iProc SoCs. The driver is used for devices that use SPI protocol on BRCMSTB, NSP, NS2 SoCs. SoC platform driver call exported porbe(), remove() and suspend/resume pm_ops implemented in this common driver. Signed-off-by: Kamal Dasu <[email protected]> Signed-off-by: Yendapally Reddy Dhananjaya Reddy Signed-off-by: Mark Brown <[email protected]>
2016-09-14spi: st-ssc4: Fix misuse of devm_gpio_request/devm_gpio_free APIsAxel Lin1-8/+11
devm_* API is supposed to be used only in probe function call. The resource is allocated at 'probe' and free automatically at 'remove'. Usage of devm_* functions outside probe sometimes leads to resource leak. Thus avoid using devm_* APIs in .setup/.cleanup callbacks. Signed-off-by: Axel Lin <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-12spi: meson: Add GXBB compatibleNeil Armstrong1-0/+1
Signed-off-by: Neil Armstrong <[email protected]> Acked-by: Kevin Hilman <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-12spi: fsl-espi: merge fsl_espi_trans and fsl_espi_do_transHeiner Kallweit1-14/+4
Merge both functions to reduce source code size and improve readability. Signed-off-by: Heiner Kallweit <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-12spi: fsl-espi: improve message length handlingHeiner Kallweit1-7/+5
Move checking for a zero-length message up in the call chain and use m->frame_length instead of re-calculating the overall length of all transfers in the message. Signed-off-by: Heiner Kallweit <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-12spi: fsl-espi: factor out handling of read dataHeiner Kallweit1-20/+21
Factor out copying read data to the read buffers in the original message to a new function fsl_espi_copy_from_buf. This also allows to simplify fsl_espi_copy_to_buf. Signed-off-by: Heiner Kallweit <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-12spi: fsl-espi: centralize populating struct spi_transferHeiner Kallweit1-12/+12
Better structure the code by population all elements of struct spi_transfer in one place. Signed-off-by: Heiner Kallweit <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-12spi: fsl-espi: factor out initial message checkingHeiner Kallweit1-14/+29
Checking the message is currently done at diffrent places in the driver. Factor it out to fsl_espi_check_message. Signed-off-by: Heiner Kallweit <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-12spi: pxa2xx: Default thresholds to PXA configurationAndy Shevchenko1-5/+42
Most of the devices in the supported list have PXA configuration of FIFO. In particularly Intel Medfield and Merrifield have bigger FIFO, than it's defined for CE4100. Split CE4100 in the similar way how it was done for Intel Quark, i.e. prefix definitions by CE4100 and append necessary pieces of code to switch case conditions. We are on safe side since those bits are ignored on all LPSS IPs. Signed-off-by: Andy Shevchenko <[email protected]> Reviewed-by: Jarkko Nikula <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-12spi: pxa2xx: Remove pointer to chip data from driver dataJarkko Nikula3-17/+15
Transfer state machine in this driver does not need to set/unset pointer to chip data between queueing and finalizing message as it is not actually used as a state info itself but just pointer passing. Since this per SPI device specific chip data is already carried in ctldata use that and remove pointer to chip data from driver data. While at it, group initialized variables before uninitialized variables in pump_transfers(). Signed-off-by: Jarkko Nikula <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-12spi: pxa2xx: Remove pointer to current SPI message from driver dataJarkko Nikula3-16/+12
There is no need to carry pointer to current SPI message in driver data because cur_msg in struct spi_master holds it already when driver is using the message queueing infrastructure from the SPI core. Signed-off-by: Jarkko Nikula <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2016-09-12spi: pxa2xx: Do not needlessly initialize stack variablesJarkko Nikula2-11/+11
All of these variables are unconditionally set before their use. Signed-off-by: Jarkko Nikula <[email protected]> Signed-off-by: Mark Brown <[email protected]>