19 Dec, 2017
2 commits
-
… 'spi/fix/imx', 'spi/fix/rspi', 'spi/fix/sun4i' and 'spi/fix/xilinx' into spi-linus
-
The only part of atmel_spi_remove which needs to be atomic is hardware
reset.atmel_spi_stop_dma calls dma_terminate_all and this needs interrupts
enabled.
atmel_spi_release_dma calls dma_release_channel and dma_release_channel
locks a mutex inside of spin_lock.So the call of these functions can't be inside a spin_lock.
Reported-by: Jia-Ju Bai
Signed-off-by: Radu Pirea
Signed-off-by: Mark Brown
07 Dec, 2017
2 commits
-
mclk and hclk need to be disabled. Since pm_runtime_disable does
not disable the clocks, use pm_runtime_force_suspend instead.Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by: Takuo Koguchi
Acked-by: Maxime Ripard
Signed-off-by: Mark Brown -
The R-Car Gen2 Hardware User Manual Rev. 2.00 states:
If the master/slave mode select bit (MSTR) is modified while the SPI
function enable bit (SPE) is set to 1 (that is, this module is
enabled), the subsequent operation cannot be guaranteed.Hence do not set SPCR_SPE when setting SPCR_MSTR, just like the
.set_config_register() implementations for other RSPI variants do.Note that when booted from QSPI, the boot loader will have set SPCR_MSTR
already, hence usually the bit is never modified by the Linux driver.Reported-by: Yoshihiro Shimoda
Signed-off-by: Geert Uytterhoeven
Signed-off-by: Mark Brown
27 Nov, 2017
1 commit
-
The Armada 3700 SPI controller has 2 ranges of prescaler coefficients.
One ranging from 0 to 15 by steps of 1, and one ranging from 0 to 30 by
steps of 2.This commit fixes the prescaler coefficients that are over 15 so that it
uses the correct range of values. The prescaling coefficient is rounded
to the upper value if it is odd.This was tested on Espressobin with spidev and a locigal analyser.
Signed-off-by: Maxime Chevallier
Signed-off-by: Mark Brown
Cc: stable@vger.kernel.org
24 Nov, 2017
1 commit
-
When the core is configured in C_SPI_MODE > 0, it integrates a
lookup table that automatically configures the core in dual or quad mode
based on the command (first byte on the tx fifo).Unfortunately, that list mode_?_memoy_*.mif does not contain all the
supported commands by the flash.Since 4.14 spi-nor automatically tries to probe the flash using SFDP
(command 0x5a), and that command is not part of the list_mode table.Whit the right combination of C_SPI_MODE and C_SPI_MEMORY this leads
into a stall that can only be recovered with a soft rest.This patch detects this kind of stall and returns -EIO to the caller on
those commands. spi-nor can handle this error properly:m25p80 spi0.0: Detected stall. Check C_SPI_MODE and C_SPI_MEMORY. 0x21 0x2404
m25p80 spi0.0: SPI transfer failed: -5
spi_master spi0: failed to transfer one message from queue
m25p80 spi0.0: s25sl064p (8192 Kbytes)Signed-off-by: Ricardo Ribalda Delgado
Signed-off-by: Mark Brown
Cc: stable@vger.kernel.org
11 Nov, 2017
8 commits
-
…ic/spreadtrum' and 'spi/topic/tegra114' into spi-next
-
…n', 'spi/topic/rspi' and 'spi/topic/s3c64xx' into spi-next
-
…avinci' and 'spi/topic/fsl-dspi' into spi-next
-
If the array is not present, assume all chip selects are native. This
is the standard behavior for SPI masters configured via the device
tree and the behavior of this driver as well when it is configured via
device tree.This reduces platform data vs DT differences and allows most of the
platform data based boards to remove their chip select arrays.CC: Shawn Guo
CC: Sascha Hauer
CC: Fabio Estevam
CC: Mark Brown
Signed-off-by: Trent Piepho
Signed-off-by: Mark Brown -
If the code that requests any chip select GPIOs fails, the cleanup of
spi_bitbang_start() by calling spi_bitbang_stop() is not done. Add this
to the failure path.Note that spi_bitbang_start() has to be called before requesting GPIOs
because the GPIO data in the spi master is populated when the master is
registed, and that doesn't happen until spi_bitbang_start() is called.CC: Shawn Guo
CC: Sascha Hauer
CC: Fabio Estevam
CC: Mark Brown
CC: Oleksij Rempel
Signed-off-by: Trent Piepho
Signed-off-by: Mark Brown -
The driver will fail to load if no gpio chip selects are specified,
this patch changes this so that it no longer fails.It's possible to use all native chip selects, in which case there is
no reason to have a gpio chip select array. This is what happens if
the *optional* device tree property "cs-gpios" is omitted.The spi core already checks for the absence of gpio chip selects in
the master and assigns any slaves the gpio_cs value of -ENOENT.Also have the driver respect the standard SPI device tree property "num-cs"
to allow setting the number of chip selects without using cs-gpios.CC: Mark Brown
CC: Shawn Guo
CC: Sascha Hauer
CC: Fabio Estevam
CC: Oleksij Rempel
Signed-off-by: Trent Piepho
Signed-off-by: Mark Brown
04 Nov, 2017
2 commits
-
The pointer dev is assigned but never read, hence it is redundant
and can be removed. Cleans up clang warning:drivers/spi/spi-sh-msiof.c:1198:2: warning: Value stored to 'dev'
is never readSigned-off-by: Colin Ian King
Signed-off-by: Mark Brown -
The pointer sci is assigned but never read, hence it is redundant
and can be removed. Cleans up clang warning:drivers/spi/spi-s3c64xx.c:791:2: warning: Value stored to 'sci' is
never readSigned-off-by: Colin Ian King
Signed-off-by: Mark Brown
03 Nov, 2017
3 commits
-
Signed-off-by: Angelo Dureghello
Signed-off-by: Mark Brown -
On systems where some controllers get a dynamic ID assigned and some have
a fixed number from DT, the current implemention might run into an IDR
collision if the dynamic controllers gets probed first and get an IDR number,
which is later requested by the controller with the fixed numbering. When
this happens the fixed controller will fail to register with the SPI core.Fix this by skipping all known alias numbers when assigning the dynamic IDs.
Fixes: 9b61e302210e (spi: Pick spi bus number from Linux idr or spi alias)
Signed-off-by: Lucas Stach
Signed-off-by: Mark Brown -
…el/git/gregkh/driver-core
Pull initial SPDX identifiers from Greg KH:
"License cleanup: add SPDX license identifiers to some filesMany source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.By default all files without license information are under the default
license of the kernel, which is GPL version 2.Update the files which contain no license information with the
'GPL-2.0' SPDX license identifier. The SPDX identifier is a legally
binding shorthand, which can be used instead of the full boiler plate
text.This patch is based on work done by Thomas Gleixner and Kate Stewart
and Philippe Ombredanne.How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset
of the use cases:- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,
Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to
license had to be inferred by heuristics based on keywords.The analysis to determine which SPDX License Identifier to be applied
to a file was done in a spreadsheet of side by side results from of
the output of two independent scanners (ScanCode & Windriver)
producing SPDX tag:value files created by Philippe Ombredanne.
Philippe prepared the base worksheet, and did an initial spot review
of a few 1000 files.The 4.13 kernel was the starting point of the analysis with 60,537
files assessed. Kate Stewart did a file by file comparison of the
scanner results in the spreadsheet to determine which SPDX license
identifier(s) to be applied to the file. She confirmed any
determination that was not immediately clear with lawyers working with
the Linux Foundation.Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained
>5 lines of source- File already had some variant of a license header in it (even if <5
lines).All documentation files were explicitly excluded.
The following heuristics were used to determine which SPDX license
identifiers to apply.- when both scanners couldn't find any license traces, file was
considered to have no license information in it, and the top level
COPYING file license applied.For non */uapi/* files that summary was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 11139and resulted in the first patch in this series.
If that file was a */uapi/* path one, it was "GPL-2.0 WITH
Linux-syscall-note" otherwise it was "GPL-2.0". Results of that
was:SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 WITH Linux-syscall-note 930and resulted in the second patch in this series.
- if a file had some form of licensing information in it, and was one
of the */uapi/* ones, it was denoted with the Linux-syscall-note if
any GPL family license was found in the file or had no licensing in
it (per prior point). Results summary:SPDX license identifier # files
---------------------------------------------------|------
GPL-2.0 WITH Linux-syscall-note 270
GPL-2.0+ WITH Linux-syscall-note 169
((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
LGPL-2.1+ WITH Linux-syscall-note 15
GPL-1.0+ WITH Linux-syscall-note 14
((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
LGPL-2.0+ WITH Linux-syscall-note 4
LGPL-2.1 WITH Linux-syscall-note 3
((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1and that resulted in the third patch in this series.
- when the two scanners agreed on the detected license(s), that
became the concluded license(s).- when there was disagreement between the two scanners (one detected
a license but the other didn't, or they both detected different
licenses) a manual inspection of the file occurred.- In most cases a manual inspection of the information in the file
resulted in a clear resolution of the license that should apply
(and which scanner probably needed to revisit its heuristics).- When it was not immediately clear, the license identifier was
confirmed with lawyers working with the Linux Foundation.- If there was any question as to the appropriate license identifier,
the file was flagged for further research and to be revisited later
in time.In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases,
confirmation by lawyers working with the Linux Foundation.Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights.
The Windriver scanner is based on an older version of FOSSology in
part, so they are related.Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot
checks in about 15000 files.In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect
the correct identifier.Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial
patch version early this week with:- a full scancode scan run, collecting the matched texts, detected
license ids and scores- reviewing anything where there was a license detected (about 500+
files) to ensure that the applied SPDX license was correct- reviewing anything where there was no detection but the patch
license was not GPL-2.0 WITH Linux-syscall-note to ensure that the
applied SPDX license was correctThis produced a worksheet with 20 files needing minor correction. This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.These .csv files were then reviewed by Greg. Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected. This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.) Finally Greg ran the script using the .csv files to
generate the patches.Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>"* tag 'spdx_identifiers-4.14-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
License cleanup: add SPDX license identifier to uapi header files with a license
License cleanup: add SPDX license identifier to uapi header files with no license
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
02 Nov, 2017
3 commits
-
The assignment of status to zero is never read, status is either
updated in the next iteration of the of the loop or several
lines after the end of the loop. Remove it, cleans up clang warning:drivers/spi/spi-orion.c:674:4: warning: Value stored to 'status'
is never readSigned-off-by: Colin Ian King
Signed-off-by: Mark Brown -
DMA supports 32-bit words only,
even if BITLEN1 of SITMDR2 register is 16bit.Fixes: b0d0ce8b6b91 ("spi: sh-msiof: Add DMA support")
Signed-off-by: Hiromitsu Yamasaki
Signed-off-by: Simon Horman
Acked-by: Geert Uytterhoeven
Acked-by: Dirk Behme
Signed-off-by: Mark Brown -
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.By default all files without license information are under the default
license of the kernel, which is GPL version 2.Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if
Reviewed-by: Philippe Ombredanne
Reviewed-by: Thomas Gleixner
Signed-off-by: Greg Kroah-Hartman
31 Oct, 2017
4 commits
-
If the code that requests any chip select GPIOs fails, the cleanup of
spi_bitbang_start() by calling spi_bitbang_stop() is not done.Fix this by moving spi_bitbang_start() to after the code that requets
GPIOs. The GPIOs are dev managed and don't need explicit cleanup.
Since spi_bitbang_start() is now the last operation, it doesn't need
to be cleaned up in the failure path.CC: Shawn Guo
CC: Sascha Hauer
CC: Fabio Estevam
CC: Mark Brown
Reviewed-by: Oleksij Rempel
Signed-off-by: Trent Piepho
Signed-off-by: Mark Brown -
Take an extra reference to the controller before deregistering it to
prevent use-after-free in the interrupt handler in case an interrupt
fires before the line is disabled.Fixes: b1353d1c1d45 ("spi: Add Analog Devices AXI SPI Engine controller support")
Acked-by: Lars-Peter Clausen
Signed-off-by: Johan Hovold
Signed-off-by: Mark Brown -
Document the fact that a reference to the controller is dropped as part
of deregistration.This is an odd pattern as the reference is typically taken in
__spi_alloc_controller() rather than spi_register_controller(). Most
controller drivers gets it right these days and notably the
device-managed interface relies on this behaviour.Signed-off-by: Johan Hovold
Signed-off-by: Mark Brown -
The controller is typically freed as part of device_unregister() so
store the bus id before deregistration to avoid use-after-free when the
id is later released.Fixes: 9b61e302210e ("spi: Pick spi bus number from Linux idr or spi alias")
Signed-off-by: Johan Hovold
Signed-off-by: Mark Brown
Cc: stable
25 Oct, 2017
2 commits
-
…'spi/fix/stm32' and 'spi/fix/uapi' into spi-linus
-
When enabling the ADI hardware channels, if the channel id is 31,
then we will get one negative value -1 for BIT() macro, which will
write incorrect value to register.Fixes: 7e2903cb91df ("spi: Add ADI driver for Spreadtrum platform")
Reported-by: Dan Carpenter
Signed-off-by: Baolin Wang
Signed-off-by: Mark Brown
17 Oct, 2017
1 commit
-
On systems where some controllers get a dynamic ID assigned and some have
a fixed number from DT, the current implemention might run into an IDR
collision if the dynamic controllers gets probed first and get an IDR number,
which is later requested by the controller with the fixed numbering. When
this happens the fixed controller will fail to register with the SPI core.Fix this by skipping all known alias numbers when assigning the dynamic IDs.
Fixes: 9b61e302210e (spi: Pick spi bus number from Linux idr or spi alias)
Signed-off-by: Lucas Stach
Signed-off-by: Mark Brown
14 Oct, 2017
1 commit
-
drivers/spi/spi-sprd-adi.c:409:3-8: No need to set .owner here. The core will do it.
Remove .owner field if calls are used which set it automatically
Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci
Fixes: 7e2903cb91df ("spi: Add ADI driver for Spreadtrum platform")
Signed-off-by: Fengguang Wu
Signed-off-by: Mark Brown
12 Oct, 2017
1 commit
-
There was an inversion in how the error path in bcm_qspi_probe() is done
which would make us trip over a KASAN use-after-free report. Turns out
that qspi->dev_ids does not get allocated until later in the probe
process. Fix this by introducing a new lable: qspi_resource_err which
takes care of cleaning up the SPI master instance.Fixes: fa236a7ef240 ("spi: bcm-qspi: Add Broadcom MSPI driver")
Signed-off-by: Florian Fainelli
Signed-off-by: Mark Brown
Cc: stable@vger.kernel.org
10 Oct, 2017
2 commits
-
The spi device mode should be configured in the controller before the
chip-select is asserted, so that a clock polarity configuration change
is not interpreted as a clock tick by the device.This patch moves the mode setting to the 'prepare_message' function
instead of the 'transfer_one' function.By doing so, this patch also removes redundant code in
a3700_spi_clock_set.This was tested on EspressoBin board, with spidev.
Signed-off-by: Maxime Chevallier
Signed-off-by: Mark Brown -
When waiting for transfer completion, a3700_spi_wait_completion
returns a boolean indicating if a timeout occurred.The function was returning 'true' everytime, failing to detect any
timeout.This patch makes it return 'false' when a timeout is reached.
Signed-off-by: Maxime Chevallier
Signed-off-by: Mark Brown
Cc: stable@vger.kernel.org
09 Oct, 2017
1 commit
-
According to "Tegra K1 Processor Technical Reference Manual" (p. 2448),
bit 20 of SPI_COMMAND1 is called CS_SW_VAL and not CS_SS_VAL.Signed-off-by: Ralf Ramsauer
Signed-off-by: Mark Brown
06 Oct, 2017
1 commit
-
With CONFIG_HWSPINLOCK=m, the new driver fails to link as a built-in driver:
drivers/spi/spi-sprd-adi.o: In function `sprd_adi_remove':
spi-sprd-adi.c:(.text+0x18): undefined reference to `hwspin_lock_free'
drivers/spi/spi-sprd-adi.o: In function `sprd_adi_probe':
spi-sprd-adi.c:(.text+0xfc): undefined reference to `of_hwspin_lock_get_id'
spi-sprd-adi.c:(.text+0x108): undefined reference to `hwspin_lock_request_specific'
spi-sprd-adi.c:(.text+0x268): undefined reference to `hwspin_lock_free'This adds a hard Kconfig dependency on HWSPINLOCK for the !COMPILE_TEST
case, and allows compile-testing with HWSPINLOCK completely disabled,
which will then rely on the existing stub API.Fixes: 7e2903cb91df ("spi: Add ADI driver for Spreadtrum platform")
Signed-off-by: Arnd Bergmann
Signed-off-by: Mark Brown
04 Oct, 2017
2 commits
-
Use the of_device_get_match_data() helper instead of open coding.
Signed-off-by: Geert Uytterhoeven
Signed-off-by: Mark Brown -
Use the of_device_get_match_data() helper instead of open coding.
Signed-off-by: Geert Uytterhoeven
Signed-off-by: Mark Brown
28 Sep, 2017
1 commit
-
This is a straight forward addition of runtime and system sleep pm operations
that handle clk and pinctrl (for runtime pm) and spi_master_{suspend,resume}
(for system sleep).Signed-off-by: Uwe Kleine-König
Signed-off-by: Mark Brown
26 Sep, 2017
2 commits
-
Signed-off-by: Fabrizio Castro
Signed-off-by: Mark Brown -
If of_get_property() fails then "size" is uninitialized and it leads to
a static checker warning:drivers/spi/spi-sprd-adi.c:288 sprd_adi_hw_init()
error: uninitialized symbol 'size'.We can silence the warning by re-arranging the order of these checks.
It obviously doesn't affect runtime at all.Signed-off-by: Dan Carpenter
Signed-off-by: Mark Brown