01 Feb, 2020
1 commit
-
[ Upstream commit 19b61392c5a852b4e8a0bf35aecb969983c5932d ]
dw_spi_irq() and dw_spi_transfer_one concurrent calls.
I find a panic in dw_writer(): txw = *(u8 *)(dws->tx), when dw->tx==null,
dw->len==4, and dw->tx_end==1.When tpm driver's message overtime dw_spi_irq() and dw_spi_transfer_one
may concurrent visit dw_spi, so I think dw_spi structure lack of protection.Otherwise dw_spi_transfer_one set dw rx/tx buffer and then open irq,
store dw rx/tx instructions and other cores handle irq load dw rx/tx
instructions may out of order.[ 1025.321302] Call trace:
...
[ 1025.321319] __crash_kexec+0x98/0x148
[ 1025.321323] panic+0x17c/0x314
[ 1025.321329] die+0x29c/0x2e8
[ 1025.321334] die_kernel_fault+0x68/0x78
[ 1025.321337] __do_kernel_fault+0x90/0xb0
[ 1025.321346] do_page_fault+0x88/0x500
[ 1025.321347] do_translation_fault+0xa8/0xb8
[ 1025.321349] do_mem_abort+0x68/0x118
[ 1025.321351] el1_da+0x20/0x8c
[ 1025.321362] dw_writer+0xc8/0xd0
[ 1025.321364] interrupt_transfer+0x60/0x110
[ 1025.321365] dw_spi_irq+0x48/0x70
...Signed-off-by: wuxu.wu
Link: https://lore.kernel.org/r/1577849981-31489-1-git-send-email-wuxu.wu@huawei.com
Signed-off-by: Mark Brown
Signed-off-by: Sasha Levin
11 Oct, 2018
1 commit
-
Add support for a new devicetree compatible string called
'amazon,alpine-apb-ssi', which is necessary for the Amazon Alpine spi
controller. 'amazon,alpine-dw-apb-ssi' is used in the dw spi driver if
specified in the devicetree. Otherwise, fall back to driver default
behavior, i.e. original dw IP hw driver behavior.Signed-off-by: Talel Shenhar
Signed-off-by: David Woodhouse
Signed-off-by: Mark Brown
30 Jul, 2018
1 commit
-
Export dw_spi_set_cs so it can be used from the various IP integration
modules.Signed-off-by: Alexandre Belloni
Reviewed-by: Andy Shevchenko
Signed-off-by: Mark Brown
18 Jul, 2018
1 commit
-
Allow platform specific drivers to provide their own set_cs callback when
the IP integration requires it.Signed-off-by: Alexandre Belloni
Signed-off-by: Mark Brown
12 Feb, 2018
1 commit
-
Convert to generalized SPI controller API introduced by the
commit 8caab75fd2c2 ("spi: Generalize SPI "master" to "controller"").
Inside driver variable name "master" is still used to indicate the driver
is master only.Signed-off-by: Jarkko Nikula
Signed-off-by: Mark Brown
02 Nov, 2017
1 commit
-
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
09 Jan, 2017
1 commit
-
Instead of using device name it was suggested that bus number was more
appropriate to differentiate debugfs names. Also reduce buffer size to
more realistic 32 bytes instead of 128.When request_irq is called the bus number may not be assigned. Therefore
the irq name was not unique when dynamic bus number was being used.
As per most of the spi drivers use the device name instead. No other
use of dws->name could be found so it was removed.Signed-off-by: Phil Reid
Signed-off-by: Mark Brown
06 Sep, 2016
1 commit
-
Add current master clock to dws struct and compare it against the
requestedtransfer speed. Update clock divider only if necessary.Signed-off-by: Matthias Seidel
Signed-off-by: Mark Brown
30 Nov, 2015
1 commit
-
The dw_spi_dma_ops structure is never modified, so declare it as const.
Done with the help of Coccinelle.
Signed-off-by: Julia Lawall
Acked-by: Andy Shevchenko
Signed-off-by: Mark Brown
20 Oct, 2015
1 commit
-
This helper disables SPI controller and sets clock to 0.
Signed-off-by: Andy Shevchenko
Signed-off-by: Mark Brown
22 Aug, 2015
1 commit
-
The commit dd11444327ce ("spi: dw-spi: Convert 16bit accesses to 32bit
accesses") changed all 16bit accesses in the DW_apb_ssi driver to 32bit.
This, unfortunately, breaks data register access on picoXcell, where the
DW IP needs data register accesses to be word accesses (all other
accesses appear to be OK).This change introduces a new master variable to allow interface drivers
to specify that 16bit data transfer I/O is required. This change also
introduces the ability to set this variable via device tree bindings in
the MMIO interface driver. Both the core and the MMIO interface driver
default to the current 32bit behaviour.Before this change, on a picoXcell pc3x3:
spi_master spi32766: interrupt_transfer: fifo overrun/underrun
m25p80 spi32766.0: error -5 reading 9f
m25p80: probe of spi32766.0 failed with error -5After this change:
m25p80 spi32766.0: m25p40 (512 Kbytes)Fixes: dd11444327ce ("spi: dw-spi: Convert 16bit accesses to 32bit accesses")
Signed-off-by: Michael van der Westhuizen
Reviewed-by: Andy Shevchenko
Signed-off-by: Mark Brown
17 Mar, 2015
1 commit
-
Altera's Arria10 SoC interconnect requires a 32-bit write for APB
peripherals. The current spi-dw driver uses 16-bit accesses in
some locations. This patch converts all the 16-bit reads and
writes to 32-bit reads and writes.Additional Documentation to Support this Change:
The DW_apb_ssi databook states:
"All registers in the DW_apb_ssi are addressed at 32-bit boundaries
to remain consistent with the AHB bus. Where the physical size of
any register is less than 32-bits wide, the upper unused bits of
the 32-bit boundary are reserved. Writing to these bits has no
effect; reading from these bits returns 0." [1][1] Section 6.1 of dw_apb_ssi.pdf (version 3.22a)
Request for test with platforms using the DesignWare SPI IP.
Tested On:
Altera CycloneV development kit
Altera Arria10 development kit
Compile tested for build errors on x86_64 (allyesconfigs)Signed-off-by: Thor Thayer
Reviewed-and-tested-by: Andy Shevchenko
Signed-off-by: Mark Brown
10 Mar, 2015
4 commits
-
intel_mid_dma seems to be unmaintained for a long time. Moreover, the IP block
of DMA itself is the same in both dw_dmac and intel_mid_dma. This patch moves
spi-dw-midpci to use dw_dmac driver.Signed-off-by: Andy Shevchenko
Signed-off-by: Mark Brown -
SPI core has a comprehensive function set to map and unmap a message when it's
needed. This patch converts driver to use that advantage.Signed-off-by: Andy Shevchenko
Signed-off-by: Mark Brown -
This patch shuts up any ongoing DMA transfer in case of error.
Signed-off-by: Andy Shevchenko
Signed-off-by: Mark Brown -
The patch splits DMA preparatory code to dma_setup() callback. The change also
converts transfer_one() to program DMA whenever the transfer is DMA mapped. The
change is a follow up of the converion to use SPI core transfer_one_message().
Since the DMA mapped transfers can be interleaved with PIO ones the DMA related
configuration should respect that.Signed-off-by: Andy Shevchenko
Signed-off-by: Mark Brown
07 Mar, 2015
2 commits
-
This patch removes a lot of duplicate code since SPI core provides a nice
message handling.Signed-off-by: Andy Shevchenko
Signed-off-by: Mark Brown -
The error handling is partially broken since the controller is disabled on
error and is not re-enabled until condition occurs, i.e. mode (poll, PIO/DMA),
chip (cs_change), or speed (clk_div) is changed. In the result of these changes
we will have a predictable state of the SPi controller independently on how
successfull was a previous transfer.The patch disables interrupts and re-enables the SPI controller wherever it
needs to be done. Thus most of the time the SPI controller is kept enabled. The
runtime PM, when it will be implemented, must take care of the controller
disabling and re-enabling.Signed-off-by: Andy Shevchenko
Signed-off-by: Mark Brown
29 Oct, 2014
1 commit
-
Currently driver wouldn't work properly if user asked for simplex transfer. The
patch separates DMA rx and tx callbacks and finishes transfer correctly in any
case.Signed-off-by: Andy Shevchenko
Signed-off-by: Mark Brown
03 Oct, 2014
1 commit
-
Instead of using magic numbers in the code we create a bit map definition of
the DMACR register and use it.There is no functional change.
Signed-off-by: Andy Shevchenko
Signed-off-by: Mark Brown
14 Sep, 2014
2 commits
-
Instead of using that member we prefer to use dma_dev which represents actual
struct device of the DMA device.Signed-off-by: Andy Shevchenko
Signed-off-by: Mark Brown -
There is no need to keep FSF address in the head of the file. While here, fix
few typos in the header.There is no functional change.
Signed-off-by: Andy Shevchenko
Signed-off-by: Mark Brown
25 Apr, 2014
2 commits
-
Also, use this opportunity to let spi_chip_sel() handle chip-select
deactivation as well.Signed-off-by: Baruch Siach
Signed-off-by: Mark Brown -
Signed-off-by: Baruch Siach
Signed-off-by: Mark Brown
31 Dec, 2013
1 commit
-
Migrate mmio code and core driver to managed resources to reduce boilerplate
error handling code. Also, handle clk_enable() failure while at it, and drop
unused dw_spi iolen field.Signed-off-by: Baruch Siach
Signed-off-by: Mark Brown
30 Dec, 2013
1 commit
-
Signed-off-by: Baruch Siach
Signed-off-by: Mark Brown
21 Sep, 2011
1 commit
-
The dw_{read,write}[lw] macros produce sparse warnings everytime they
are used. The "read" ones cause:warning: cast removes address space of expression
warning: incorrect type in argument 1 (different address spaces)
expected void const volatile [noderef] *addr
got unsigned int *And the "write" ones:
warning: cast removes address space of expression
warning: incorrect type in argument 2 (different address spaces)
expected void volatile [noderef] *addr
got unsigned int *Fix this by removing struct dw_spi_reg and converting all the register
offsets to #defines. Then convert the macros into inlined functions so
that proper type checking can occur.While here, also fix the three sparse warnings in spi-dw-mid.c due to
the return value of ioremap_nocache being stored in a u32 * not a
void __iomem *.With these changes the spi-dw* files all build with no sparse warnings.
Signed-off-by: H Hartley Sweeten
Acked-by: Feng Tang
Signed-off-by: Grant Likely
09 Jul, 2011
1 commit
-
Signed-off-by: ShuoX Liu
Signed-off-by: Grant Likely
06 Jun, 2011
1 commit
-
Sort the SPI makefile and enforce the naming convention spi_*.c for
spi drivers.This change also rolls the contents of atmel_spi.h into the .c file
since there is only one user of that particular include file.v2: - Use 'spi-' prefix instead of 'spi_' to match what seems to be
be the predominant pattern for subsystem prefixes.
- Clean up filenames in Kconfig and header comment blocksSigned-off-by: Grant Likely
Acked-by: Wolfram Sang
Acked-by: Linus Walleij