Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
106dbe24
Commit
106dbe24
authored
Jul 04, 2019
by
Mark Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'spi-5.3' into spi-next
parents
2337ff45
8cc77204
Changes
33
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
33 changed files
with
2283 additions
and
540 deletions
+2283
-540
Documentation/devicetree/bindings/mfd/atmel-usart.txt
Documentation/devicetree/bindings/mfd/atmel-usart.txt
+15
-5
Documentation/devicetree/bindings/spi/allwinner,sun4i-a10-spi.yaml
...tion/devicetree/bindings/spi/allwinner,sun4i-a10-spi.yaml
+86
-0
Documentation/devicetree/bindings/spi/allwinner,sun6i-a31-spi.yaml
...tion/devicetree/bindings/spi/allwinner,sun6i-a31-spi.yaml
+106
-0
Documentation/devicetree/bindings/spi/spi-bus.txt
Documentation/devicetree/bindings/spi/spi-bus.txt
+1
-111
Documentation/devicetree/bindings/spi/spi-controller.yaml
Documentation/devicetree/bindings/spi/spi-controller.yaml
+161
-0
Documentation/devicetree/bindings/spi/spi-gpio.txt
Documentation/devicetree/bindings/spi/spi-gpio.txt
+0
-43
Documentation/devicetree/bindings/spi/spi-gpio.yaml
Documentation/devicetree/bindings/spi/spi-gpio.yaml
+72
-0
Documentation/devicetree/bindings/spi/spi-pl022.yaml
Documentation/devicetree/bindings/spi/spi-pl022.yaml
+165
-0
Documentation/devicetree/bindings/spi/spi-stm32-qspi.txt
Documentation/devicetree/bindings/spi/spi-stm32-qspi.txt
+4
-1
Documentation/devicetree/bindings/spi/spi-sun4i.txt
Documentation/devicetree/bindings/spi/spi-sun4i.txt
+0
-23
Documentation/devicetree/bindings/spi/spi-sun6i.txt
Documentation/devicetree/bindings/spi/spi-sun6i.txt
+0
-44
Documentation/devicetree/bindings/spi/spi-synquacer.txt
Documentation/devicetree/bindings/spi/spi-synquacer.txt
+27
-0
Documentation/devicetree/bindings/spi/spi_pl022.txt
Documentation/devicetree/bindings/spi/spi_pl022.txt
+0
-70
MAINTAINERS
MAINTAINERS
+8
-0
drivers/spi/Kconfig
drivers/spi/Kconfig
+12
-2
drivers/spi/Makefile
drivers/spi/Makefile
+1
-0
drivers/spi/atmel-quadspi.c
drivers/spi/atmel-quadspi.c
+11
-10
drivers/spi/spi-at91-usart.c
drivers/spi/spi-at91-usart.c
+219
-2
drivers/spi/spi-bcm2835.c
drivers/spi/spi-bcm2835.c
+204
-124
drivers/spi/spi-bcm2835aux.c
drivers/spi/spi-bcm2835aux.c
+1
-3
drivers/spi/spi-meson-spifc.c
drivers/spi/spi-meson-spifc.c
+6
-6
drivers/spi/spi-mt65xx.c
drivers/spi/spi-mt65xx.c
+6
-9
drivers/spi/spi-pxa2xx.c
drivers/spi/spi-pxa2xx.c
+14
-0
drivers/spi/spi-qup.c
drivers/spi/spi-qup.c
+0
-4
drivers/spi/spi-rockchip.c
drivers/spi/spi-rockchip.c
+2
-2
drivers/spi/spi-sh-msiof.c
drivers/spi/spi-sh-msiof.c
+1
-1
drivers/spi/spi-stm32-qspi.c
drivers/spi/spi-stm32-qspi.c
+3
-7
drivers/spi/spi-synquacer.c
drivers/spi/spi-synquacer.c
+828
-0
drivers/spi/spi-tegra114.c
drivers/spi/spi-tegra114.c
+154
-16
drivers/spi/spi.c
drivers/spi/spi.c
+139
-55
drivers/spi/spidev.c
drivers/spi/spidev.c
+2
-0
include/linux/platform_data/spi-mt65xx.h
include/linux/platform_data/spi-mt65xx.h
+0
-2
include/linux/spi/spi.h
include/linux/spi/spi.h
+35
-0
No files found.
Documentation/devicetree/bindings/mfd/atmel-usart.txt
View file @
106dbe24
...
@@ -17,17 +17,24 @@ Required properties for USART in SPI mode:
...
@@ -17,17 +17,24 @@ Required properties for USART in SPI mode:
- cs-gpios: chipselects (internal cs not supported)
- cs-gpios: chipselects (internal cs not supported)
- atmel,usart-mode : Must be <AT91_USART_MODE_SPI> (found in dt-bindings/mfd/at91-usart.h)
- atmel,usart-mode : Must be <AT91_USART_MODE_SPI> (found in dt-bindings/mfd/at91-usart.h)
Optional properties in serial and SPI mode:
- dma bindings for dma transfer:
- dmas: DMA specifier, consisting of a phandle to DMA controller node,
memory peripheral interface and USART DMA channel ID, FIFO configuration.
The order of DMA channels is fixed. The first DMA channel must be TX
associated channel and the second one must be RX associated channel.
Refer to dma.txt and atmel-dma.txt for details.
- dma-names: "tx" for TX channel.
"rx" for RX channel.
The order of dma-names is also fixed. The first name must be "tx"
and the second one must be "rx" as in the examples below.
Optional properties in serial mode:
Optional properties in serial mode:
- atmel,use-dma-rx: use of PDC or DMA for receiving data
- atmel,use-dma-rx: use of PDC or DMA for receiving data
- atmel,use-dma-tx: use of PDC or DMA for transmitting data
- atmel,use-dma-tx: use of PDC or DMA for transmitting data
- {rts,cts,dtr,dsr,rng,dcd}-gpios: specify a GPIO for RTS/CTS/DTR/DSR/RI/DCD line respectively.
- {rts,cts,dtr,dsr,rng,dcd}-gpios: specify a GPIO for RTS/CTS/DTR/DSR/RI/DCD line respectively.
It will use specified PIO instead of the peripheral function pin for the USART feature.
It will use specified PIO instead of the peripheral function pin for the USART feature.
If unsure, don't specify this property.
If unsure, don't specify this property.
- add dma bindings for dma transfer:
- dmas: DMA specifier, consisting of a phandle to DMA controller node,
memory peripheral interface and USART DMA channel ID, FIFO configuration.
Refer to dma.txt and atmel-dma.txt for details.
- dma-names: "rx" for RX channel, "tx" for TX channel.
- atmel,fifo-size: maximum number of data the RX and TX FIFOs can store for FIFO
- atmel,fifo-size: maximum number of data the RX and TX FIFOs can store for FIFO
capable USARTs.
capable USARTs.
- rs485-rts-delay, rs485-rx-during-tx, linux,rs485-enabled-at-boot-time: see rs485.txt
- rs485-rts-delay, rs485-rx-during-tx, linux,rs485-enabled-at-boot-time: see rs485.txt
...
@@ -81,5 +88,8 @@ Example:
...
@@ -81,5 +88,8 @@ Example:
interrupts = <12 IRQ_TYPE_LEVEL_HIGH 5>;
interrupts = <12 IRQ_TYPE_LEVEL_HIGH 5>;
clocks = <&usart0_clk>;
clocks = <&usart0_clk>;
clock-names = "usart";
clock-names = "usart";
dmas = <&dma0 2 AT91_DMA_CFG_PER_ID(3)>,
<&dma0 2 (AT91_DMA_CFG_PER_ID(4) | AT91_DMA_CFG_FIFOCFG_ASAP)>;
dma-names = "tx", "rx";
cs-gpios = <&pioB 3 0>;
cs-gpios = <&pioB 3 0>;
};
};
Documentation/devicetree/bindings/spi/allwinner,sun4i-a10-spi.yaml
0 → 100644
View file @
106dbe24
# SPDX-License-Identifier: GPL-2.0
%YAML
1.2
---
$id
:
http://devicetree.org/schemas/spi/allwinner,sun4i-a10-spi.yaml#
$schema
:
http://devicetree.org/meta-schemas/core.yaml#
title
:
Allwinner A10 SPI Controller Device Tree Bindings
allOf
:
-
$ref
:
"
spi-controller.yaml"
maintainers
:
-
Chen-Yu Tsai <wens@csie.org>
-
Maxime Ripard <maxime.ripard@bootlin.com>
properties
:
"
#address-cells"
:
true
"
#size-cells"
:
true
compatible
:
const
:
allwinner,sun4i-a10-spi
reg
:
maxItems
:
1
interrupts
:
maxItems
:
1
clocks
:
items
:
-
description
:
Bus Clock
-
description
:
Module Clock
clock-names
:
items
:
-
const
:
ahb
-
const
:
mod
dmas
:
items
:
-
description
:
RX DMA Channel
-
description
:
TX DMA Channel
dma-names
:
items
:
-
const
:
rx
-
const
:
tx
num-cs
:
true
patternProperties
:
"
^.*@[0-9a-f]+"
:
properties
:
reg
:
items
:
minimum
:
0
maximum
:
4
spi-rx-bus-width
:
const
:
1
spi-tx-bus-width
:
const
:
1
required
:
-
compatible
-
reg
-
interrupts
-
clocks
-
clock-names
additionalProperties
:
false
examples
:
-
|
spi1: spi@1c06000 {
compatible = "allwinner,sun4i-a10-spi";
reg = <0x01c06000 0x1000>;
interrupts = <11>;
clocks = <&ahb_gates 21>, <&spi1_clk>;
clock-names = "ahb", "mod";
#address-cells = <1>;
#size-cells = <0>;
};
...
Documentation/devicetree/bindings/spi/allwinner,sun6i-a31-spi.yaml
0 → 100644
View file @
106dbe24
# SPDX-License-Identifier: GPL-2.0
%YAML
1.2
---
$id
:
http://devicetree.org/schemas/spi/allwinner,sun6i-a31-spi.yaml#
$schema
:
http://devicetree.org/meta-schemas/core.yaml#
title
:
Allwinner A31 SPI Controller Device Tree Bindings
allOf
:
-
$ref
:
"
spi-controller.yaml"
maintainers
:
-
Chen-Yu Tsai <wens@csie.org>
-
Maxime Ripard <maxime.ripard@bootlin.com>
properties
:
"
#address-cells"
:
true
"
#size-cells"
:
true
compatible
:
enum
:
-
allwinner,sun6i-a31-spi
-
allwinner,sun8i-h3-spi
reg
:
maxItems
:
1
interrupts
:
maxItems
:
1
clocks
:
items
:
-
description
:
Bus Clock
-
description
:
Module Clock
clock-names
:
items
:
-
const
:
ahb
-
const
:
mod
resets
:
maxItems
:
1
dmas
:
items
:
-
description
:
RX DMA Channel
-
description
:
TX DMA Channel
dma-names
:
items
:
-
const
:
rx
-
const
:
tx
num-cs
:
true
patternProperties
:
"
^.*@[0-9a-f]+"
:
properties
:
reg
:
items
:
minimum
:
0
maximum
:
4
spi-rx-bus-width
:
const
:
1
spi-tx-bus-width
:
const
:
1
required
:
-
compatible
-
reg
-
interrupts
-
clocks
-
clock-names
additionalProperties
:
false
examples
:
-
|
spi1: spi@1c69000 {
compatible = "allwinner,sun6i-a31-spi";
reg = <0x01c69000 0x1000>;
interrupts = <0 66 4>;
clocks = <&ahb1_gates 21>, <&spi1_clk>;
clock-names = "ahb", "mod";
resets = <&ahb1_rst 21>;
#address-cells = <1>;
#size-cells = <0>;
};
-
|
spi0: spi@1c68000 {
compatible = "allwinner,sun8i-h3-spi";
reg = <0x01c68000 0x1000>;
interrupts = <0 65 4>;
clocks = <&ccu 30>, <&ccu 82>;
clock-names = "ahb", "mod";
dmas = <&dma 23>, <&dma 23>;
dma-names = "rx", "tx";
resets = <&ccu 15>;
#address-cells = <1>;
#size-cells = <0>;
};
...
Documentation/devicetree/bindings/spi/spi-bus.txt
View file @
106dbe24
SPI (Serial Peripheral Interface) busses
This file has moved to spi-controller.yaml.
SPI busses can be described with a node for the SPI controller device
and a set of child nodes for each SPI slave on the bus. The system's SPI
controller may be described for use in SPI master mode or in SPI slave mode,
but not for both at the same time.
The SPI controller node requires the following properties:
- compatible - Name of SPI bus controller following generic names
recommended practice.
In master mode, the SPI controller node requires the following additional
properties:
- #address-cells - number of cells required to define a chip select
address on the SPI bus.
- #size-cells - should be zero.
In slave mode, the SPI controller node requires one additional property:
- spi-slave - Empty property.
No other properties are required in the SPI bus node. It is assumed
that a driver for an SPI bus device will understand that it is an SPI bus.
However, the binding does not attempt to define the specific method for
assigning chip select numbers. Since SPI chip select configuration is
flexible and non-standardized, it is left out of this binding with the
assumption that board specific platform code will be used to manage
chip selects. Individual drivers can define additional properties to
support describing the chip select layout.
Optional properties (master mode only):
- cs-gpios - gpios chip select.
- num-cs - total number of chipselects.
If cs-gpios is used the number of chip selects will be increased automatically
with max(cs-gpios > hw cs).
So if for example the controller has 2 CS lines, and the cs-gpios
property looks like this:
cs-gpios = <&gpio1 0 0>, <0>, <&gpio1 1 0>, <&gpio1 2 0>;
Then it should be configured so that num_chipselect = 4 with the
following mapping:
cs0 : &gpio1 0 0
cs1 : native
cs2 : &gpio1 1 0
cs3 : &gpio1 2 0
SPI slave nodes must be children of the SPI controller node.
In master mode, one or more slave nodes (up to the number of chip selects) can
be present. Required properties are:
- compatible - Name of SPI device following generic names recommended
practice.
- reg - Chip select address of device.
- spi-max-frequency - Maximum SPI clocking speed of device in Hz.
In slave mode, the (single) slave node is optional.
If present, it must be called "slave". Required properties are:
- compatible - Name of SPI device following generic names recommended
practice.
All slave nodes can contain the following optional properties:
- spi-cpol - Empty property indicating device requires inverse clock
polarity (CPOL) mode.
- spi-cpha - Empty property indicating device requires shifted clock
phase (CPHA) mode.
- spi-cs-high - Empty property indicating device requires chip select
active high.
- spi-3wire - Empty property indicating device requires 3-wire mode.
- spi-lsb-first - Empty property indicating device requires LSB first mode.
- spi-tx-bus-width - The bus width (number of data wires) that is used for MOSI.
Defaults to 1 if not present.
- spi-rx-bus-width - The bus width (number of data wires) that is used for MISO.
Defaults to 1 if not present.
- spi-rx-delay-us - Microsecond delay after a read transfer.
- spi-tx-delay-us - Microsecond delay after a write transfer.
Some SPI controllers and devices support Dual and Quad SPI transfer mode.
It allows data in the SPI system to be transferred using 2 wires (DUAL) or 4
wires (QUAD).
Now the value that spi-tx-bus-width and spi-rx-bus-width can receive is
only 1 (SINGLE), 2 (DUAL) and 4 (QUAD).
Dual/Quad mode is not allowed when 3-wire mode is used.
If a gpio chipselect is used for the SPI slave the gpio number will be passed
via the SPI master node cs-gpios property.
SPI example for an MPC5200 SPI bus:
spi@f00 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "fsl,mpc5200b-spi","fsl,mpc5200-spi";
reg = <0xf00 0x20>;
interrupts = <2 13 0 2 14 0>;
interrupt-parent = <&mpc5200_pic>;
ethernet-switch@0 {
compatible = "micrel,ks8995m";
spi-max-frequency = <1000000>;
reg = <0>;
};
codec@1 {
compatible = "ti,tlv320aic26";
spi-max-frequency = <100000>;
reg = <1>;
};
};
Documentation/devicetree/bindings/spi/spi-controller.yaml
0 → 100644
View file @
106dbe24
# SPDX-License-Identifier: GPL-2.0
%YAML
1.2
---
$id
:
http://devicetree.org/schemas/spi/spi-controller.yaml#
$schema
:
http://devicetree.org/meta-schemas/core.yaml#
title
:
SPI Controller Generic Binding
maintainers
:
-
Mark Brown <broonie@kernel.org>
description
:
|
SPI busses can be described with a node for the SPI controller device
and a set of child nodes for each SPI slave on the bus. The system SPI
controller may be described for use in SPI master mode or in SPI slave mode,
but not for both at the same time.
properties
:
$nodename
:
pattern
:
"
^spi(@.*|-[0-9a-f])*$"
"
#address-cells"
:
const
:
1
"
#size-cells"
:
const
:
0
cs-gpios
:
description
:
|
GPIOs used as chip selects.
If that property is used, the number of chip selects will be
increased automatically with max(cs-gpios, hardware chip selects).
So if, for example, the controller has 2 CS lines, and the
cs-gpios looks like this
cs-gpios = <&gpio1 0 0>, <0>, <&gpio1 1 0>, <&gpio1 2 0>;
Then it should be configured so that num_chipselect = 4, with
the following mapping
cs0 : &gpio1 0 0
cs1 : native
cs2 : &gpio1 1 0
cs3 : &gpio1 2 0
num-cs
:
$ref
:
/schemas/types.yaml#/definitions/uint32
description
:
Total number of chip selects.
spi-slave
:
$ref
:
/schemas/types.yaml#/definitions/flag
description
:
The SPI controller acts as a slave, instead of a master.
patternProperties
:
"
^slave$"
:
type
:
object
properties
:
compatible
:
description
:
Compatible of the SPI device.
required
:
-
compatible
"
^.*@[0-9a-f]+$"
:
type
:
object
properties
:
compatible
:
description
:
Compatible of the SPI device.
reg
:
maxItems
:
1
minimum
:
0
maximum
:
256
description
:
Chip select used by the device.
spi-3wire
:
$ref
:
/schemas/types.yaml#/definitions/flag
description
:
The device requires 3-wire mode.
spi-cpha
:
$ref
:
/schemas/types.yaml#/definitions/flag
description
:
The device requires shifted clock phase (CPHA) mode.
spi-cpol
:
$ref
:
/schemas/types.yaml#/definitions/flag
description
:
The device requires inverse clock polarity (CPOL) mode.
spi-cs-high
:
$ref
:
/schemas/types.yaml#/definitions/flag
description
:
The device requires the chip select active high.
spi-lsb-first
:
$ref
:
/schemas/types.yaml#/definitions/flag
description
:
The device requires the LSB first mode.
spi-max-frequency
:
$ref
:
/schemas/types.yaml#/definitions/uint32
description
:
Maximum SPI clocking speed of the device in Hz.
spi-rx-bus-width
:
allOf
:
-
$ref
:
/schemas/types.yaml#/definitions/uint32
-
enum
:
[
1
,
2
,
4
]
-
default
:
1
description
:
Bus width to the SPI bus used for MISO.
spi-rx-delay-us
:
description
:
Delay, in microseconds, after a read transfer.
spi-tx-bus-width
:
allOf
:
-
$ref
:
/schemas/types.yaml#/definitions/uint32
-
enum
:
[
1
,
2
,
4
]
-
default
:
1
description
:
Bus width to the SPI bus used for MOSI.
spi-tx-delay-us
:
description
:
Delay, in microseconds, after a write transfer.
required
:
-
compatible
-
reg
examples
:
-
|
spi@f00 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "fsl,mpc5200b-spi","fsl,mpc5200-spi";
reg = <0xf00 0x20>;
interrupts = <2 13 0 2 14 0>;
interrupt-parent = <&mpc5200_pic>;
ethernet-switch@0 {
compatible = "micrel,ks8995m";
spi-max-frequency = <1000000>;
reg = <0>;
};
codec@1 {
compatible = "ti,tlv320aic26";
spi-max-frequency = <100000>;
reg = <1>;
};
};
Documentation/devicetree/bindings/spi/spi-gpio.txt
deleted
100644 → 0
View file @
2337ff45
SPI-GPIO devicetree bindings
This represents a group of 3-n GPIO lines used for bit-banged SPI on dedicated
GPIO lines.
Required properties:
- compatible: should be set to "spi-gpio"
- #address-cells: should be set to <0x1>
- ranges
- sck-gpios: GPIO spec for the SCK line to use
- miso-gpios: GPIO spec for the MISO line to use
- mosi-gpios: GPIO spec for the MOSI line to use
- cs-gpios: GPIOs to use for chipselect lines.
Not needed if num-chipselects = <0>.
- num-chipselects: Number of chipselect lines. Should be <0> if a single device
with no chip select is connected.
Deprecated bindings:
These legacy GPIO line bindings can alternatively be used to define the
GPIO lines used, they should not be used in new device trees.
- gpio-sck: GPIO spec for the SCK line to use
- gpio-miso: GPIO spec for the MISO line to use
- gpio-mosi: GPIO spec for the MOSI line to use
Example:
spi {
compatible = "spi-gpio";
#address-cells = <0x1>;
ranges;
sck-gpios = <&gpio 95 0>;
miso-gpios = <&gpio 98 0>;
mosi-gpios = <&gpio 97 0>;
cs-gpios = <&gpio 125 0>;
num-chipselects = <1>;
/* clients */
};
Documentation/devicetree/bindings/spi/spi-gpio.yaml
0 → 100644
View file @
106dbe24
# SPDX-License-Identifier: GPL-2.0
%YAML
1.2
---
$id
:
http://devicetree.org/schemas/spi/spi-gpio.yaml#
$schema
:
http://devicetree.org/meta-schemas/core.yaml#
title
:
SPI-GPIO devicetree bindings
maintainers
:
-
Rob Herring <robh@kernel.org>
description
:
This represents a group of 3-n GPIO lines used for bit-banged SPI on
dedicated GPIO lines.
allOf
:
-
$ref
:
"
/schemas/spi/spi-controller.yaml#"
properties
:
compatible
:
const
:
spi-gpio
sck-gpios
:
description
:
GPIO spec for the SCK line to use
maxItems
:
1
miso-gpios
:
description
:
GPIO spec for the MISO line to use
maxItems
:
1
mosi-gpios
:
description
:
GPIO spec for the MOSI line to use
maxItems
:
1
cs-gpios
:
description
:
GPIOs to use for chipselect lines.
Not needed if num-chipselects = <0>.
minItems
:
1
maxItems
:
1024
num-chipselects
:
description
:
Number of chipselect lines. Should be <0> if a single device
with no chip select is connected.
$ref
:
"
/schemas/types.yaml#/definitions/uint32"
# Deprecated properties
gpio-sck
:
false
gpio-miso
:
false
gpio-mosi
:
false
required
:
-
compatible
-
num-chipselects
-
sck-gpios
examples
:
-
|
spi {
compatible = "spi-gpio";
#address-cells = <0x1>;
#size-cells = <0x0>;
sck-gpios = <&gpio 95 0>;
miso-gpios = <&gpio 98 0>;
mosi-gpios = <&gpio 97 0>;
cs-gpios = <&gpio 125 0>;
num-chipselects = <1>;
/* clients */
};
...
Documentation/devicetree/bindings/spi/spi-pl022.yaml
0 → 100644
View file @
106dbe24
# SPDX-License-Identifier: GPL-2.0
%YAML
1.2
---
$id
:
http://devicetree.org/schemas/spi/spi-pl022.yaml#
$schema
:
http://devicetree.org/meta-schemas/core.yaml#
title
:
ARM PL022 SPI controller
maintainers
:
-
Linus Walleij <linus.walleij@linaro.org>
allOf
:
-
$ref
:
"
spi-controller.yaml#"
# We need a select here so we don't match all nodes with 'arm,primecell'
select
:
properties
:
compatible
:
contains
:
const
:
arm,pl022
required
:
-
compatible
properties
:
compatible
:
items
:
-
const
:
arm,pl022
-
const
:
arm,primecell
reg
:
maxItems
:
1
interrupts
:
maxItems
:
1
clocks
:
maxItems
:
2
clock-names
:
items
:
-
enum
:
-
SSPCLK
-
sspclk
-
const
:
apb_pclk
pl022,autosuspend-delay
:
description
:
delay in ms following transfer completion before the
runtime power management system suspends the device. A setting of
0
indicates no delay and the device will be suspended immediately.
$ref
:
"
/schemas/types.yaml#/definitions/uint32"
pl022,rt
:
description
:
indicates the controller should run the message pump with realtime
priority to minimise the transfer latency on the bus (boolean)
type
:
boolean
dmas
:
description
:
Two or more DMA channel specifiers following the convention outlined
in bindings/dma/dma.txt
minItems
:
2
maxItems
:
32
dma-names
:
description
:
There must be at least one channel named "tx" for transmit and named "rx"
for receive.
minItems
:
2
maxItems
:
32
additionalItems
:
true
items
:
-
const
:
rx
-
const
:
tx
patternProperties
:
"
^[a-zA-Z][a-zA-Z0-9,+
\\
-._]{0,63}@[0-9a-f]+$"
:
type
:
object
# SPI slave nodes must be children of the SPI master node and can
# contain the following properties.
properties
:
pl022,interface
:
description
:
SPI interface type
allOf
:
-
$ref
:
"
/schemas/types.yaml#/definitions/uint32"
-
enum
:
-
0
# SPI
-
1
# Texas Instruments Synchronous Serial Frame Format
-
2
# Microwire (Half Duplex)
pl022,com-mode
:
description
:
Specifies the transfer mode
allOf
:
-
$ref
:
"
/schemas/types.yaml#/definitions/uint32"
-
enum
:
-
0
# interrupt mode
-
1
# polling mode
-
2
# DMA mode
default
:
1
pl022,rx-level-trig
:
description
:
Rx FIFO watermark level
allOf
:
-
$ref
:
"
/schemas/types.yaml#/definitions/uint32"
-
minimum
:
0
maximum
:
4
pl022,tx-level-trig
:
description
:
Tx FIFO watermark level
allOf
:
-
$ref
:
"
/schemas/types.yaml#/definitions/uint32"
-
minimum
:
0
maximum
:
4
pl022,ctrl-len
:
description
:
Microwire interface - Control length
allOf
:
-
$ref
:
"
/schemas/types.yaml#/definitions/uint32"
-
minimum
:
0x03
maximum
:
0x1f
pl022,wait-state
:
description
:
Microwire interface - Wait state
allOf
:
-
$ref
:
"
/schemas/types.yaml#/definitions/uint32"
-
enum
:
[
0
,
1
]
pl022,duplex
:
description
:
Microwire interface - Full/Half duplex
allOf
:
-
$ref
:
"
/schemas/types.yaml#/definitions/uint32"
-
enum
:
[
0
,
1
]
required
:
-
compatible
-
reg
-
interrupts
examples
:
-
|
spi@e0100000 {
compatible = "arm,pl022", "arm,primecell";
reg = <0xe0100000 0x1000>;
#address-cells = <1>;
#size-cells = <0>;
interrupts = <0 31 0x4>;
dmas = <&dma_controller 23 1>,
<&dma_controller 24 0>;
dma-names = "rx", "tx";
m25p80@1 {
compatible = "st,m25p80";
reg = <1>;
spi-max-frequency = <12000000>;
spi-cpol;
spi-cpha;
pl022,interface = <0>;
pl022,com-mode = <0x2>;
pl022,rx-level-trig = <0>;
pl022,tx-level-trig = <0>;
pl022,ctrl-len = <0x11>;
pl022,wait-state = <0>;
pl022,duplex = <0>;
};
};
...
Documentation/devicetree/bindings/spi/spi-stm32-qspi.txt
View file @
106dbe24
...
@@ -19,8 +19,11 @@ Required properties:
...
@@ -19,8 +19,11 @@ Required properties:
- reg: chip-Select number (QSPI controller may connect 2 flashes)
- reg: chip-Select number (QSPI controller may connect 2 flashes)
- spi-max-frequency: max frequency of spi bus
- spi-max-frequency: max frequency of spi bus
Optional propert
y
:
Optional propert
ies
:
- spi-rx-bus-width: see ./spi-bus.txt for the description
- spi-rx-bus-width: see ./spi-bus.txt for the description
- dmas: DMA specifiers for tx and rx dma. See the DMA client binding,
Documentation/devicetree/bindings/dma/dma.txt.
- dma-names: DMA request names should include "tx" and "rx" if present.
Example:
Example:
...
...
Documentation/devicetree/bindings/spi/spi-sun4i.txt
deleted
100644 → 0
View file @
2337ff45
Allwinner A10 SPI controller
Required properties:
- compatible: Should be "allwinner,sun4-a10-spi".
- reg: Should contain register location and length.
- interrupts: Should contain interrupt.
- clocks: phandle to the clocks feeding the SPI controller. Two are
needed:
- "ahb": the gated AHB parent clock
- "mod": the parent module clock
- clock-names: Must contain the clock names described just above
Example:
spi1: spi@1c06000 {
compatible = "allwinner,sun4i-a10-spi";
reg = <0x01c06000 0x1000>;
interrupts = <11>;
clocks = <&ahb_gates 21>, <&spi1_clk>;
clock-names = "ahb", "mod";
#address-cells = <1>;
#size-cells = <0>;
};
Documentation/devicetree/bindings/spi/spi-sun6i.txt
deleted
100644 → 0
View file @
2337ff45
Allwinner A31/H3 SPI controller
Required properties:
- compatible: Should be "allwinner,sun6i-a31-spi" or "allwinner,sun8i-h3-spi".
- reg: Should contain register location and length.
- interrupts: Should contain interrupt.
- clocks: phandle to the clocks feeding the SPI controller. Two are
needed:
- "ahb": the gated AHB parent clock
- "mod": the parent module clock
- clock-names: Must contain the clock names described just above
- resets: phandle to the reset controller asserting this device in
reset
Optional properties:
- dmas: DMA specifiers for rx and tx dma. See the DMA client binding,
Documentation/devicetree/bindings/dma/dma.txt
- dma-names: DMA request names should include "rx" and "tx" if present.
Example:
spi1: spi@1c69000 {
compatible = "allwinner,sun6i-a31-spi";
reg = <0x01c69000 0x1000>;
interrupts = <0 66 4>;
clocks = <&ahb1_gates 21>, <&spi1_clk>;
clock-names = "ahb", "mod";
resets = <&ahb1_rst 21>;
};
spi0: spi@1c68000 {
compatible = "allwinner,sun8i-h3-spi";
reg = <0x01c68000 0x1000>;
interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&ccu CLK_BUS_SPI0>, <&ccu CLK_SPI0>;
clock-names = "ahb", "mod";
dmas = <&dma 23>, <&dma 23>;
dma-names = "rx", "tx";
pinctrl-names = "default";
pinctrl-0 = <&spi0_pins>;
resets = <&ccu RST_BUS_SPI0>;
#address-cells = <1>;
#size-cells = <0>;
};
Documentation/devicetree/bindings/spi/spi-synquacer.txt
0 → 100644
View file @
106dbe24
* Socionext Synquacer HS-SPI bindings
Required Properties:
- compatible: should be "socionext,synquacer-spi"
- reg: physical base address of the controller and length of memory mapped
region.
- interrupts: should contain the "spi_rx", "spi_tx" and "spi_fault" interrupts.
- clocks: core clock iHCLK. Optional rate clock iPCLK (default is iHCLK)
- clock-names: Shall be "iHCLK" and "iPCLK" respectively
Optional Properties:
- socionext,use-rtm: boolean, if required to use "retimed clock" for RX
- socionext,set-aces: boolean, if same active clock edges field to be set.
Example:
spi0: spi@ff110000 {
compatible = "socionext,synquacer-spi";
reg = <0xff110000 0x1000>;
interrupts = <GIC_SPI 160 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 161 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 162 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&clk_hsspi>;
clock-names = "iHCLK";
socionext,use-rtm;
socionext,set-aces;
};
Documentation/devicetree/bindings/spi/spi_pl022.txt
deleted
100644 → 0
View file @
2337ff45
ARM PL022 SPI controller
Required properties:
- compatible : "arm,pl022", "arm,primecell"
- reg : Offset and length of the register set for the device
- interrupts : Should contain SPI controller interrupt
- num-cs : total number of chipselects
Optional properties:
- cs-gpios : should specify GPIOs used for chipselects.
The gpios will be referred to as reg = <index> in the SPI child nodes.
If unspecified, a single SPI device without a chip select can be used.
- pl022,autosuspend-delay : delay in ms following transfer completion before
the runtime power management system suspends the
device. A setting of 0 indicates no delay and the
device will be suspended immediately
- pl022,rt : indicates the controller should run the message pump with realtime
priority to minimise the transfer latency on the bus (boolean)
- dmas : Two or more DMA channel specifiers following the convention outlined
in bindings/dma/dma.txt
- dma-names: Names for the dma channels, if present. There must be at
least one channel named "tx" for transmit and named "rx" for
receive.
SPI slave nodes must be children of the SPI master node and can
contain the following properties.
- pl022,interface : interface type:
0: SPI
1: Texas Instruments Synchronous Serial Frame Format
2: Microwire (Half Duplex)
- pl022,com-mode : specifies the transfer mode:
0: interrupt mode
1: polling mode (default mode if property not present)
2: DMA mode
- pl022,rx-level-trig : Rx FIFO watermark level
- pl022,tx-level-trig : Tx FIFO watermark level
- pl022,ctrl-len : Microwire interface: Control length
- pl022,wait-state : Microwire interface: Wait state
- pl022,duplex : Microwire interface: Full/Half duplex
Example:
spi@e0100000 {
compatible = "arm,pl022", "arm,primecell";
reg = <0xe0100000 0x1000>;
#address-cells = <1>;
#size-cells = <0>;
interrupts = <0 31 0x4>;
dmas = <&dma-controller 23 1>,
<&dma-controller 24 0>;
dma-names = "rx", "tx";
m25p80@1 {
compatible = "st,m25p80";
reg = <1>;
spi-max-frequency = <12000000>;
spi-cpol;
spi-cpha;
pl022,interface = <0>;
pl022,com-mode = <0x2>;
pl022,rx-level-trig = <0>;
pl022,tx-level-trig = <0>;
pl022,ctrl-len = <0x11>;
pl022,wait-state = <0>;
pl022,duplex = <0>;
};
};
MAINTAINERS
View file @
106dbe24
...
@@ -14630,6 +14630,14 @@ S: Maintained
...
@@ -14630,6 +14630,14 @@ S: Maintained
F: drivers/net/ethernet/socionext/netsec.c
F: drivers/net/ethernet/socionext/netsec.c
F: Documentation/devicetree/bindings/net/socionext-netsec.txt
F: Documentation/devicetree/bindings/net/socionext-netsec.txt
SOCIONEXT (SNI) Synquacer SPI DRIVER
M: Masahisa Kojima <masahisa.kojima@linaro.org>
M: Jassi Brar <jaswinder.singh@linaro.org>
L: linux-spi@vger.kernel.org
S: Maintained
F: drivers/spi/spi-synquacer.c
F: Documentation/devicetree/bindings/spi/spi-synquacer.txt
SOLIDRUN CLEARFOG SUPPORT
SOLIDRUN CLEARFOG SUPPORT
M: Russell King <linux@armlinux.org.uk>
M: Russell King <linux@armlinux.org.uk>
S: Maintained
S: Maintained
...
...
drivers/spi/Kconfig
View file @
106dbe24
...
@@ -120,7 +120,7 @@ config SPI_AXI_SPI_ENGINE
...
@@ -120,7 +120,7 @@ config SPI_AXI_SPI_ENGINE
config SPI_BCM2835
config SPI_BCM2835
tristate "BCM2835 SPI controller"
tristate "BCM2835 SPI controller"
depends on GPIOLIB
depends on GPIOLIB
depends on ARCH_BCM2835 || COMPILE_TEST
depends on ARCH_BCM2835 ||
ARCH_BRCMSTB ||
COMPILE_TEST
help
help
This selects a driver for the Broadcom BCM2835 SPI master.
This selects a driver for the Broadcom BCM2835 SPI master.
...
@@ -131,7 +131,7 @@ config SPI_BCM2835
...
@@ -131,7 +131,7 @@ config SPI_BCM2835
config SPI_BCM2835AUX
config SPI_BCM2835AUX
tristate "BCM2835 SPI auxiliary controller"
tristate "BCM2835 SPI auxiliary controller"
depends on (
ARCH_BCM2835
&& GPIOLIB) || COMPILE_TEST
depends on (
(ARCH_BCM2835 || ARCH_BRCMSTB)
&& GPIOLIB) || COMPILE_TEST
help
help
This selects a driver for the Broadcom BCM2835 SPI aux master.
This selects a driver for the Broadcom BCM2835 SPI aux master.
...
@@ -733,6 +733,16 @@ config SPI_SUN6I
...
@@ -733,6 +733,16 @@ config SPI_SUN6I
help
help
This enables using the SPI controller on the Allwinner A31 SoCs.
This enables using the SPI controller on the Allwinner A31 SoCs.
config SPI_SYNQUACER
tristate "Socionext's SynQuacer HighSpeed SPI controller"
depends on ARCH_SYNQUACER || COMPILE_TEST
help
SPI driver for Socionext's High speed SPI controller which provides
various operating modes for interfacing to serial peripheral devices
that use the de-facto standard SPI protocol.
It also supports the new dual-bit and quad-bit SPI protocol.
config SPI_MXIC
config SPI_MXIC
tristate "Macronix MX25F0A SPI controller"
tristate "Macronix MX25F0A SPI controller"
depends on SPI_MASTER
depends on SPI_MASTER
...
...
drivers/spi/Makefile
View file @
106dbe24
...
@@ -106,6 +106,7 @@ obj-$(CONFIG_SPI_STM32_QSPI) += spi-stm32-qspi.o
...
@@ -106,6 +106,7 @@ obj-$(CONFIG_SPI_STM32_QSPI) += spi-stm32-qspi.o
obj-$(CONFIG_SPI_ST_SSC4)
+=
spi-st-ssc4.o
obj-$(CONFIG_SPI_ST_SSC4)
+=
spi-st-ssc4.o
obj-$(CONFIG_SPI_SUN4I)
+=
spi-sun4i.o
obj-$(CONFIG_SPI_SUN4I)
+=
spi-sun4i.o
obj-$(CONFIG_SPI_SUN6I)
+=
spi-sun6i.o
obj-$(CONFIG_SPI_SUN6I)
+=
spi-sun6i.o
obj-$(CONFIG_SPI_SYNQUACER)
+=
spi-synquacer.o
obj-$(CONFIG_SPI_TEGRA114)
+=
spi-tegra114.o
obj-$(CONFIG_SPI_TEGRA114)
+=
spi-tegra114.o
obj-$(CONFIG_SPI_TEGRA20_SFLASH)
+=
spi-tegra20-sflash.o
obj-$(CONFIG_SPI_TEGRA20_SFLASH)
+=
spi-tegra20-sflash.o
obj-$(CONFIG_SPI_TEGRA20_SLINK)
+=
spi-tegra20-slink.o
obj-$(CONFIG_SPI_TEGRA20_SLINK)
+=
spi-tegra20-slink.o
...
...
drivers/spi/atmel-quadspi.c
View file @
106dbe24
...
@@ -151,6 +151,7 @@ struct atmel_qspi {
...
@@ -151,6 +151,7 @@ struct atmel_qspi {
const
struct
atmel_qspi_caps
*
caps
;
const
struct
atmel_qspi_caps
*
caps
;
u32
pending
;
u32
pending
;
u32
mr
;
u32
mr
;
u32
scr
;
struct
completion
cmd_completion
;
struct
completion
cmd_completion
;
};
};
...
@@ -382,7 +383,7 @@ static int atmel_qspi_setup(struct spi_device *spi)
...
@@ -382,7 +383,7 @@ static int atmel_qspi_setup(struct spi_device *spi)
struct
spi_controller
*
ctrl
=
spi
->
master
;
struct
spi_controller
*
ctrl
=
spi
->
master
;
struct
atmel_qspi
*
aq
=
spi_controller_get_devdata
(
ctrl
);
struct
atmel_qspi
*
aq
=
spi_controller_get_devdata
(
ctrl
);
unsigned
long
src_rate
;
unsigned
long
src_rate
;
u32
sc
r
,
sc
br
;
u32
scbr
;
if
(
ctrl
->
busy
)
if
(
ctrl
->
busy
)
return
-
EBUSY
;
return
-
EBUSY
;
...
@@ -399,13 +400,13 @@ static int atmel_qspi_setup(struct spi_device *spi)
...
@@ -399,13 +400,13 @@ static int atmel_qspi_setup(struct spi_device *spi)
if
(
scbr
>
0
)
if
(
scbr
>
0
)
scbr
--
;
scbr
--
;
scr
=
QSPI_SCR_SCBR
(
scbr
);
aq
->
scr
=
QSPI_SCR_SCBR
(
scbr
);
writel_relaxed
(
scr
,
aq
->
regs
+
QSPI_SCR
);
writel_relaxed
(
aq
->
scr
,
aq
->
regs
+
QSPI_SCR
);
return
0
;
return
0
;
}
}
static
int
atmel_qspi_init
(
struct
atmel_qspi
*
aq
)
static
void
atmel_qspi_init
(
struct
atmel_qspi
*
aq
)
{
{
/* Reset the QSPI controller */
/* Reset the QSPI controller */
writel_relaxed
(
QSPI_CR_SWRST
,
aq
->
regs
+
QSPI_CR
);
writel_relaxed
(
QSPI_CR_SWRST
,
aq
->
regs
+
QSPI_CR
);
...
@@ -416,8 +417,6 @@ static int atmel_qspi_init(struct atmel_qspi *aq)
...
@@ -416,8 +417,6 @@ static int atmel_qspi_init(struct atmel_qspi *aq)
/* Enable the QSPI controller */
/* Enable the QSPI controller */
writel_relaxed
(
QSPI_CR_QSPIEN
,
aq
->
regs
+
QSPI_CR
);
writel_relaxed
(
QSPI_CR_QSPIEN
,
aq
->
regs
+
QSPI_CR
);
return
0
;
}
}
static
irqreturn_t
atmel_qspi_interrupt
(
int
irq
,
void
*
dev_id
)
static
irqreturn_t
atmel_qspi_interrupt
(
int
irq
,
void
*
dev_id
)
...
@@ -536,9 +535,7 @@ static int atmel_qspi_probe(struct platform_device *pdev)
...
@@ -536,9 +535,7 @@ static int atmel_qspi_probe(struct platform_device *pdev)
if
(
err
)
if
(
err
)
goto
disable_qspick
;
goto
disable_qspick
;
err
=
atmel_qspi_init
(
aq
);
atmel_qspi_init
(
aq
);
if
(
err
)
goto
disable_qspick
;
err
=
spi_register_controller
(
ctrl
);
err
=
spi_register_controller
(
ctrl
);
if
(
err
)
if
(
err
)
...
@@ -587,7 +584,11 @@ static int __maybe_unused atmel_qspi_resume(struct device *dev)
...
@@ -587,7 +584,11 @@ static int __maybe_unused atmel_qspi_resume(struct device *dev)
clk_prepare_enable
(
aq
->
pclk
);
clk_prepare_enable
(
aq
->
pclk
);
clk_prepare_enable
(
aq
->
qspick
);
clk_prepare_enable
(
aq
->
qspick
);
return
atmel_qspi_init
(
aq
);
atmel_qspi_init
(
aq
);
writel_relaxed
(
aq
->
scr
,
aq
->
regs
+
QSPI_SCR
);
return
0
;
}
}
static
SIMPLE_DEV_PM_OPS
(
atmel_qspi_pm_ops
,
atmel_qspi_suspend
,
static
SIMPLE_DEV_PM_OPS
(
atmel_qspi_pm_ops
,
atmel_qspi_suspend
,
...
...
drivers/spi/spi-at91-usart.c
View file @
106dbe24
...
@@ -8,9 +8,12 @@
...
@@ -8,9 +8,12 @@
#include <linux/clk.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/delay.h>
#include <linux/dmaengine.h>
#include <linux/dma-direction.h>
#include <linux/interrupt.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/module.h>
#include <linux/of_platform.h>
#include <linux/of_gpio.h>
#include <linux/of_gpio.h>
#include <linux/pinctrl/consumer.h>
#include <linux/pinctrl/consumer.h>
#include <linux/platform_device.h>
#include <linux/platform_device.h>
...
@@ -59,6 +62,8 @@
...
@@ -59,6 +62,8 @@
#define US_INIT \
#define US_INIT \
(US_MR_SPI_MASTER | US_MR_CHRL | US_MR_CLKO | US_MR_WRDBT)
(US_MR_SPI_MASTER | US_MR_CHRL | US_MR_CLKO | US_MR_WRDBT)
#define US_DMA_MIN_BYTES 16
#define US_DMA_TIMEOUT (msecs_to_jiffies(1000))
/* Register access macros */
/* Register access macros */
#define at91_usart_spi_readl(port, reg) \
#define at91_usart_spi_readl(port, reg) \
...
@@ -72,14 +77,19 @@
...
@@ -72,14 +77,19 @@
writeb_relaxed((value), (port)->regs + US_##reg)
writeb_relaxed((value), (port)->regs + US_##reg)
struct
at91_usart_spi
{
struct
at91_usart_spi
{
struct
platform_device
*
mpdev
;
struct
spi_transfer
*
current_transfer
;
struct
spi_transfer
*
current_transfer
;
void
__iomem
*
regs
;
void
__iomem
*
regs
;
struct
device
*
dev
;
struct
device
*
dev
;
struct
clk
*
clk
;
struct
clk
*
clk
;
struct
completion
xfer_completion
;
/*used in interrupt to protect data reading*/
/*used in interrupt to protect data reading*/
spinlock_t
lock
;
spinlock_t
lock
;
phys_addr_t
phybase
;
int
irq
;
int
irq
;
unsigned
int
current_tx_remaining_bytes
;
unsigned
int
current_tx_remaining_bytes
;
unsigned
int
current_rx_remaining_bytes
;
unsigned
int
current_rx_remaining_bytes
;
...
@@ -88,8 +98,182 @@ struct at91_usart_spi {
...
@@ -88,8 +98,182 @@ struct at91_usart_spi {
u32
status
;
u32
status
;
bool
xfer_failed
;
bool
xfer_failed
;
bool
use_dma
;
};
};
static
void
dma_callback
(
void
*
data
)
{
struct
spi_controller
*
ctlr
=
data
;
struct
at91_usart_spi
*
aus
=
spi_master_get_devdata
(
ctlr
);
at91_usart_spi_writel
(
aus
,
IER
,
US_IR_RXRDY
);
aus
->
current_rx_remaining_bytes
=
0
;
complete
(
&
aus
->
xfer_completion
);
}
static
bool
at91_usart_spi_can_dma
(
struct
spi_controller
*
ctrl
,
struct
spi_device
*
spi
,
struct
spi_transfer
*
xfer
)
{
struct
at91_usart_spi
*
aus
=
spi_master_get_devdata
(
ctrl
);
return
aus
->
use_dma
&&
xfer
->
len
>=
US_DMA_MIN_BYTES
;
}
static
int
at91_usart_spi_configure_dma
(
struct
spi_controller
*
ctlr
,
struct
at91_usart_spi
*
aus
)
{
struct
dma_slave_config
slave_config
;
struct
device
*
dev
=
&
aus
->
mpdev
->
dev
;
phys_addr_t
phybase
=
aus
->
phybase
;
dma_cap_mask_t
mask
;
int
err
=
0
;
dma_cap_zero
(
mask
);
dma_cap_set
(
DMA_SLAVE
,
mask
);
ctlr
->
dma_tx
=
dma_request_slave_channel_reason
(
dev
,
"tx"
);
if
(
IS_ERR_OR_NULL
(
ctlr
->
dma_tx
))
{
if
(
IS_ERR
(
ctlr
->
dma_tx
))
{
err
=
PTR_ERR
(
ctlr
->
dma_tx
);
goto
at91_usart_spi_error_clear
;
}
dev_dbg
(
dev
,
"DMA TX channel not available, SPI unable to use DMA
\n
"
);
err
=
-
EBUSY
;
goto
at91_usart_spi_error_clear
;
}
ctlr
->
dma_rx
=
dma_request_slave_channel_reason
(
dev
,
"rx"
);
if
(
IS_ERR_OR_NULL
(
ctlr
->
dma_rx
))
{
if
(
IS_ERR
(
ctlr
->
dma_rx
))
{
err
=
PTR_ERR
(
ctlr
->
dma_rx
);
goto
at91_usart_spi_error
;
}
dev_dbg
(
dev
,
"DMA RX channel not available, SPI unable to use DMA
\n
"
);
err
=
-
EBUSY
;
goto
at91_usart_spi_error
;
}
slave_config
.
dst_addr_width
=
DMA_SLAVE_BUSWIDTH_1_BYTE
;
slave_config
.
src_addr_width
=
DMA_SLAVE_BUSWIDTH_1_BYTE
;
slave_config
.
dst_addr
=
(
dma_addr_t
)
phybase
+
US_THR
;
slave_config
.
src_addr
=
(
dma_addr_t
)
phybase
+
US_RHR
;
slave_config
.
src_maxburst
=
1
;
slave_config
.
dst_maxburst
=
1
;
slave_config
.
device_fc
=
false
;
slave_config
.
direction
=
DMA_DEV_TO_MEM
;
if
(
dmaengine_slave_config
(
ctlr
->
dma_rx
,
&
slave_config
))
{
dev_err
(
&
ctlr
->
dev
,
"failed to configure rx dma channel
\n
"
);
err
=
-
EINVAL
;
goto
at91_usart_spi_error
;
}
slave_config
.
direction
=
DMA_MEM_TO_DEV
;
if
(
dmaengine_slave_config
(
ctlr
->
dma_tx
,
&
slave_config
))
{
dev_err
(
&
ctlr
->
dev
,
"failed to configure tx dma channel
\n
"
);
err
=
-
EINVAL
;
goto
at91_usart_spi_error
;
}
aus
->
use_dma
=
true
;
return
0
;
at91_usart_spi_error:
if
(
!
IS_ERR_OR_NULL
(
ctlr
->
dma_tx
))
dma_release_channel
(
ctlr
->
dma_tx
);
if
(
!
IS_ERR_OR_NULL
(
ctlr
->
dma_rx
))
dma_release_channel
(
ctlr
->
dma_rx
);
ctlr
->
dma_tx
=
NULL
;
ctlr
->
dma_rx
=
NULL
;
at91_usart_spi_error_clear:
return
err
;
}
static
void
at91_usart_spi_release_dma
(
struct
spi_controller
*
ctlr
)
{
if
(
ctlr
->
dma_rx
)
dma_release_channel
(
ctlr
->
dma_rx
);
if
(
ctlr
->
dma_tx
)
dma_release_channel
(
ctlr
->
dma_tx
);
}
static
void
at91_usart_spi_stop_dma
(
struct
spi_controller
*
ctlr
)
{
if
(
ctlr
->
dma_rx
)
dmaengine_terminate_all
(
ctlr
->
dma_rx
);
if
(
ctlr
->
dma_tx
)
dmaengine_terminate_all
(
ctlr
->
dma_tx
);
}
static
int
at91_usart_spi_dma_transfer
(
struct
spi_controller
*
ctlr
,
struct
spi_transfer
*
xfer
)
{
struct
at91_usart_spi
*
aus
=
spi_master_get_devdata
(
ctlr
);
struct
dma_chan
*
rxchan
=
ctlr
->
dma_rx
;
struct
dma_chan
*
txchan
=
ctlr
->
dma_tx
;
struct
dma_async_tx_descriptor
*
rxdesc
;
struct
dma_async_tx_descriptor
*
txdesc
;
dma_cookie_t
cookie
;
/* Disable RX interrupt */
at91_usart_spi_writel
(
aus
,
IDR
,
US_IR_RXRDY
);
rxdesc
=
dmaengine_prep_slave_sg
(
rxchan
,
xfer
->
rx_sg
.
sgl
,
xfer
->
rx_sg
.
nents
,
DMA_DEV_TO_MEM
,
DMA_PREP_INTERRUPT
|
DMA_CTRL_ACK
);
if
(
!
rxdesc
)
goto
at91_usart_spi_err_dma
;
txdesc
=
dmaengine_prep_slave_sg
(
txchan
,
xfer
->
tx_sg
.
sgl
,
xfer
->
tx_sg
.
nents
,
DMA_MEM_TO_DEV
,
DMA_PREP_INTERRUPT
|
DMA_CTRL_ACK
);
if
(
!
txdesc
)
goto
at91_usart_spi_err_dma
;
rxdesc
->
callback
=
dma_callback
;
rxdesc
->
callback_param
=
ctlr
;
cookie
=
rxdesc
->
tx_submit
(
rxdesc
);
if
(
dma_submit_error
(
cookie
))
goto
at91_usart_spi_err_dma
;
cookie
=
txdesc
->
tx_submit
(
txdesc
);
if
(
dma_submit_error
(
cookie
))
goto
at91_usart_spi_err_dma
;
rxchan
->
device
->
device_issue_pending
(
rxchan
);
txchan
->
device
->
device_issue_pending
(
txchan
);
return
0
;
at91_usart_spi_err_dma:
/* Enable RX interrupt if something fails and fallback to PIO */
at91_usart_spi_writel
(
aus
,
IER
,
US_IR_RXRDY
);
at91_usart_spi_stop_dma
(
ctlr
);
return
-
ENOMEM
;
}
static
unsigned
long
at91_usart_spi_dma_timeout
(
struct
at91_usart_spi
*
aus
)
{
return
wait_for_completion_timeout
(
&
aus
->
xfer_completion
,
US_DMA_TIMEOUT
);
}
static
inline
u32
at91_usart_spi_tx_ready
(
struct
at91_usart_spi
*
aus
)
static
inline
u32
at91_usart_spi_tx_ready
(
struct
at91_usart_spi
*
aus
)
{
{
return
aus
->
status
&
US_IR_TXRDY
;
return
aus
->
status
&
US_IR_TXRDY
;
...
@@ -216,6 +400,8 @@ static int at91_usart_spi_transfer_one(struct spi_controller *ctlr,
...
@@ -216,6 +400,8 @@ static int at91_usart_spi_transfer_one(struct spi_controller *ctlr,
struct
spi_transfer
*
xfer
)
struct
spi_transfer
*
xfer
)
{
{
struct
at91_usart_spi
*
aus
=
spi_master_get_devdata
(
ctlr
);
struct
at91_usart_spi
*
aus
=
spi_master_get_devdata
(
ctlr
);
unsigned
long
dma_timeout
=
0
;
int
ret
=
0
;
at91_usart_spi_set_xfer_speed
(
aus
,
xfer
);
at91_usart_spi_set_xfer_speed
(
aus
,
xfer
);
aus
->
xfer_failed
=
false
;
aus
->
xfer_failed
=
false
;
...
@@ -225,8 +411,25 @@ static int at91_usart_spi_transfer_one(struct spi_controller *ctlr,
...
@@ -225,8 +411,25 @@ static int at91_usart_spi_transfer_one(struct spi_controller *ctlr,
while
((
aus
->
current_tx_remaining_bytes
||
while
((
aus
->
current_tx_remaining_bytes
||
aus
->
current_rx_remaining_bytes
)
&&
!
aus
->
xfer_failed
)
{
aus
->
current_rx_remaining_bytes
)
&&
!
aus
->
xfer_failed
)
{
reinit_completion
(
&
aus
->
xfer_completion
);
if
(
at91_usart_spi_can_dma
(
ctlr
,
spi
,
xfer
)
&&
!
ret
)
{
ret
=
at91_usart_spi_dma_transfer
(
ctlr
,
xfer
);
if
(
ret
)
continue
;
dma_timeout
=
at91_usart_spi_dma_timeout
(
aus
);
if
(
WARN_ON
(
dma_timeout
==
0
))
{
dev_err
(
&
spi
->
dev
,
"DMA transfer timeout
\n
"
);
return
-
EIO
;
}
aus
->
current_tx_remaining_bytes
=
0
;
}
else
{
at91_usart_spi_read_status
(
aus
);
at91_usart_spi_read_status
(
aus
);
at91_usart_spi_tx
(
aus
);
at91_usart_spi_tx
(
aus
);
}
cpu_relax
();
cpu_relax
();
}
}
...
@@ -345,6 +548,7 @@ static int at91_usart_spi_probe(struct platform_device *pdev)
...
@@ -345,6 +548,7 @@ static int at91_usart_spi_probe(struct platform_device *pdev)
controller
->
transfer_one
=
at91_usart_spi_transfer_one
;
controller
->
transfer_one
=
at91_usart_spi_transfer_one
;
controller
->
prepare_message
=
at91_usart_spi_prepare_message
;
controller
->
prepare_message
=
at91_usart_spi_prepare_message
;
controller
->
unprepare_message
=
at91_usart_spi_unprepare_message
;
controller
->
unprepare_message
=
at91_usart_spi_unprepare_message
;
controller
->
can_dma
=
at91_usart_spi_can_dma
;
controller
->
cleanup
=
at91_usart_spi_cleanup
;
controller
->
cleanup
=
at91_usart_spi_cleanup
;
controller
->
max_speed_hz
=
DIV_ROUND_UP
(
clk_get_rate
(
clk
),
controller
->
max_speed_hz
=
DIV_ROUND_UP
(
clk_get_rate
(
clk
),
US_MIN_CLK_DIV
);
US_MIN_CLK_DIV
);
...
@@ -376,7 +580,17 @@ static int at91_usart_spi_probe(struct platform_device *pdev)
...
@@ -376,7 +580,17 @@ static int at91_usart_spi_probe(struct platform_device *pdev)
aus
->
spi_clk
=
clk_get_rate
(
clk
);
aus
->
spi_clk
=
clk_get_rate
(
clk
);
at91_usart_spi_init
(
aus
);
at91_usart_spi_init
(
aus
);
aus
->
phybase
=
regs
->
start
;
aus
->
mpdev
=
to_platform_device
(
pdev
->
dev
.
parent
);
ret
=
at91_usart_spi_configure_dma
(
controller
,
aus
);
if
(
ret
)
goto
at91_usart_fail_dma
;
spin_lock_init
(
&
aus
->
lock
);
spin_lock_init
(
&
aus
->
lock
);
init_completion
(
&
aus
->
xfer_completion
);
ret
=
devm_spi_register_master
(
&
pdev
->
dev
,
controller
);
ret
=
devm_spi_register_master
(
&
pdev
->
dev
,
controller
);
if
(
ret
)
if
(
ret
)
goto
at91_usart_fail_register_master
;
goto
at91_usart_fail_register_master
;
...
@@ -389,6 +603,8 @@ static int at91_usart_spi_probe(struct platform_device *pdev)
...
@@ -389,6 +603,8 @@ static int at91_usart_spi_probe(struct platform_device *pdev)
return
0
;
return
0
;
at91_usart_fail_register_master:
at91_usart_fail_register_master:
at91_usart_spi_release_dma
(
controller
);
at91_usart_fail_dma:
clk_disable_unprepare
(
clk
);
clk_disable_unprepare
(
clk
);
at91_usart_spi_probe_fail:
at91_usart_spi_probe_fail:
spi_master_put
(
controller
);
spi_master_put
(
controller
);
...
@@ -453,6 +669,7 @@ static int at91_usart_spi_remove(struct platform_device *pdev)
...
@@ -453,6 +669,7 @@ static int at91_usart_spi_remove(struct platform_device *pdev)
struct
spi_controller
*
ctlr
=
platform_get_drvdata
(
pdev
);
struct
spi_controller
*
ctlr
=
platform_get_drvdata
(
pdev
);
struct
at91_usart_spi
*
aus
=
spi_master_get_devdata
(
ctlr
);
struct
at91_usart_spi
*
aus
=
spi_master_get_devdata
(
ctlr
);
at91_usart_spi_release_dma
(
ctlr
);
clk_disable_unprepare
(
aus
->
clk
);
clk_disable_unprepare
(
aus
->
clk
);
return
0
;
return
0
;
...
...
drivers/spi/spi-bcm2835.c
View file @
106dbe24
This diff is collapsed.
Click to expand it.
drivers/spi/spi-bcm2835aux.c
View file @
106dbe24
...
@@ -496,10 +496,8 @@ static int bcm2835aux_spi_probe(struct platform_device *pdev)
...
@@ -496,10 +496,8 @@ static int bcm2835aux_spi_probe(struct platform_device *pdev)
int
err
;
int
err
;
master
=
spi_alloc_master
(
&
pdev
->
dev
,
sizeof
(
*
bs
));
master
=
spi_alloc_master
(
&
pdev
->
dev
,
sizeof
(
*
bs
));
if
(
!
master
)
{
if
(
!
master
)
dev_err
(
&
pdev
->
dev
,
"spi_alloc_master() failed
\n
"
);
return
-
ENOMEM
;
return
-
ENOMEM
;
}
platform_set_drvdata
(
pdev
,
master
);
platform_set_drvdata
(
pdev
,
master
);
master
->
mode_bits
=
(
SPI_CPOL
|
SPI_CS_HIGH
|
SPI_NO_CS
);
master
->
mode_bits
=
(
SPI_CPOL
|
SPI_CS_HIGH
|
SPI_NO_CS
);
...
...
drivers/spi/spi-meson-spifc.c
View file @
106dbe24
// SPDX-License-Identifier: GPL-2.0
-only
// SPDX-License-Identifier: GPL-2.0
+
/
*
/
/
*
Driver for Amlogic Meson SPI flash controller (SPIFC)
//
Driver for Amlogic Meson SPI flash controller (SPIFC)
*
//
*
Copyright (C) 2014 Beniamino Galvani <b.galvani@gmail.com>
//
Copyright (C) 2014 Beniamino Galvani <b.galvani@gmail.com>
*
/
/
/
#include <linux/clk.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/delay.h>
...
...
drivers/spi/spi-mt65xx.c
View file @
106dbe24
...
@@ -123,8 +123,6 @@ static const struct mtk_spi_compatible mt8183_compat = {
...
@@ -123,8 +123,6 @@ static const struct mtk_spi_compatible mt8183_compat = {
* supplies it.
* supplies it.
*/
*/
static
const
struct
mtk_chip_config
mtk_default_chip_info
=
{
static
const
struct
mtk_chip_config
mtk_default_chip_info
=
{
.
rx_mlsb
=
1
,
.
tx_mlsb
=
1
,
.
cs_pol
=
0
,
.
cs_pol
=
0
,
.
sample_sel
=
0
,
.
sample_sel
=
0
,
};
};
...
@@ -195,14 +193,13 @@ static int mtk_spi_prepare_message(struct spi_master *master,
...
@@ -195,14 +193,13 @@ static int mtk_spi_prepare_message(struct spi_master *master,
reg_val
&=
~
SPI_CMD_CPOL
;
reg_val
&=
~
SPI_CMD_CPOL
;
/* set the mlsbx and mlsbtx */
/* set the mlsbx and mlsbtx */
if
(
chip_config
->
tx_mlsb
)
if
(
spi
->
mode
&
SPI_LSB_FIRST
)
{
reg_val
|=
SPI_CMD_TXMSBF
;
else
reg_val
&=
~
SPI_CMD_TXMSBF
;
reg_val
&=
~
SPI_CMD_TXMSBF
;
if
(
chip_config
->
rx_mlsb
)
reg_val
|=
SPI_CMD_RXMSBF
;
else
reg_val
&=
~
SPI_CMD_RXMSBF
;
reg_val
&=
~
SPI_CMD_RXMSBF
;
}
else
{
reg_val
|=
SPI_CMD_TXMSBF
;
reg_val
|=
SPI_CMD_RXMSBF
;
}
/* set the tx/rx endian */
/* set the tx/rx endian */
#ifdef __LITTLE_ENDIAN
#ifdef __LITTLE_ENDIAN
...
@@ -599,7 +596,7 @@ static int mtk_spi_probe(struct platform_device *pdev)
...
@@ -599,7 +596,7 @@ static int mtk_spi_probe(struct platform_device *pdev)
master
->
auto_runtime_pm
=
true
;
master
->
auto_runtime_pm
=
true
;
master
->
dev
.
of_node
=
pdev
->
dev
.
of_node
;
master
->
dev
.
of_node
=
pdev
->
dev
.
of_node
;
master
->
mode_bits
=
SPI_CPOL
|
SPI_CPHA
;
master
->
mode_bits
=
SPI_CPOL
|
SPI_CPHA
|
SPI_LSB_FIRST
;
master
->
set_cs
=
mtk_spi_set_cs
;
master
->
set_cs
=
mtk_spi_set_cs
;
master
->
prepare_message
=
mtk_spi_prepare_message
;
master
->
prepare_message
=
mtk_spi_prepare_message
;
...
...
drivers/spi/spi-pxa2xx.c
View file @
106dbe24
...
@@ -1437,6 +1437,10 @@ static const struct pci_device_id pxa2xx_spi_pci_compound_match[] = {
...
@@ -1437,6 +1437,10 @@ static const struct pci_device_id pxa2xx_spi_pci_compound_match[] = {
{
PCI_VDEVICE
(
INTEL
,
0x34aa
),
LPSS_CNL_SSP
},
{
PCI_VDEVICE
(
INTEL
,
0x34aa
),
LPSS_CNL_SSP
},
{
PCI_VDEVICE
(
INTEL
,
0x34ab
),
LPSS_CNL_SSP
},
{
PCI_VDEVICE
(
INTEL
,
0x34ab
),
LPSS_CNL_SSP
},
{
PCI_VDEVICE
(
INTEL
,
0x34fb
),
LPSS_CNL_SSP
},
{
PCI_VDEVICE
(
INTEL
,
0x34fb
),
LPSS_CNL_SSP
},
/* EHL */
{
PCI_VDEVICE
(
INTEL
,
0x4b2a
),
LPSS_BXT_SSP
},
{
PCI_VDEVICE
(
INTEL
,
0x4b2b
),
LPSS_BXT_SSP
},
{
PCI_VDEVICE
(
INTEL
,
0x4b37
),
LPSS_BXT_SSP
},
/* APL */
/* APL */
{
PCI_VDEVICE
(
INTEL
,
0x5ac2
),
LPSS_BXT_SSP
},
{
PCI_VDEVICE
(
INTEL
,
0x5ac2
),
LPSS_BXT_SSP
},
{
PCI_VDEVICE
(
INTEL
,
0x5ac4
),
LPSS_BXT_SSP
},
{
PCI_VDEVICE
(
INTEL
,
0x5ac4
),
LPSS_BXT_SSP
},
...
@@ -1704,6 +1708,16 @@ static int pxa2xx_spi_probe(struct platform_device *pdev)
...
@@ -1704,6 +1708,16 @@ static int pxa2xx_spi_probe(struct platform_device *pdev)
goto
out_error_dma_irq_alloc
;
goto
out_error_dma_irq_alloc
;
controller
->
max_speed_hz
=
clk_get_rate
(
ssp
->
clk
);
controller
->
max_speed_hz
=
clk_get_rate
(
ssp
->
clk
);
/*
* Set minimum speed for all other platforms than Intel Quark which is
* able do under 1 Hz transfers.
*/
if
(
!
pxa25x_ssp_comp
(
drv_data
))
controller
->
min_speed_hz
=
DIV_ROUND_UP
(
controller
->
max_speed_hz
,
4096
);
else
if
(
!
is_quark_x1000_ssp
(
drv_data
))
controller
->
min_speed_hz
=
DIV_ROUND_UP
(
controller
->
max_speed_hz
,
512
);
/* Load default SSP configuration */
/* Load default SSP configuration */
pxa2xx_spi_write
(
drv_data
,
SSCR0
,
0
);
pxa2xx_spi_write
(
drv_data
,
SSCR0
,
0
);
...
...
drivers/spi/spi-qup.c
View file @
106dbe24
...
@@ -873,10 +873,6 @@ static int spi_qup_transfer_one(struct spi_master *master,
...
@@ -873,10 +873,6 @@ static int spi_qup_transfer_one(struct spi_master *master,
else
else
ret
=
spi_qup_do_pio
(
spi
,
xfer
,
timeout
);
ret
=
spi_qup_do_pio
(
spi
,
xfer
,
timeout
);
if
(
ret
)
goto
exit
;
exit:
spi_qup_set_state
(
controller
,
QUP_STATE_RESET
);
spi_qup_set_state
(
controller
,
QUP_STATE_RESET
);
spin_lock_irqsave
(
&
controller
->
lock
,
flags
);
spin_lock_irqsave
(
&
controller
->
lock
,
flags
);
if
(
!
ret
)
if
(
!
ret
)
...
...
drivers/spi/spi-rockchip.c
View file @
106dbe24
...
@@ -417,7 +417,7 @@ static int rockchip_spi_prepare_dma(struct rockchip_spi *rs,
...
@@ -417,7 +417,7 @@ static int rockchip_spi_prepare_dma(struct rockchip_spi *rs,
.
direction
=
DMA_MEM_TO_DEV
,
.
direction
=
DMA_MEM_TO_DEV
,
.
dst_addr
=
rs
->
dma_addr_tx
,
.
dst_addr
=
rs
->
dma_addr_tx
,
.
dst_addr_width
=
rs
->
n_bytes
,
.
dst_addr_width
=
rs
->
n_bytes
,
.
dst_maxburst
=
rs
->
fifo_len
/
2
,
.
dst_maxburst
=
rs
->
fifo_len
/
4
,
};
};
dmaengine_slave_config
(
master
->
dma_tx
,
&
txconf
);
dmaengine_slave_config
(
master
->
dma_tx
,
&
txconf
);
...
@@ -518,7 +518,7 @@ static void rockchip_spi_config(struct rockchip_spi *rs,
...
@@ -518,7 +518,7 @@ static void rockchip_spi_config(struct rockchip_spi *rs,
else
else
writel_relaxed
(
rs
->
fifo_len
/
2
-
1
,
rs
->
regs
+
ROCKCHIP_SPI_RXFTLR
);
writel_relaxed
(
rs
->
fifo_len
/
2
-
1
,
rs
->
regs
+
ROCKCHIP_SPI_RXFTLR
);
writel_relaxed
(
rs
->
fifo_len
/
2
-
1
,
rs
->
regs
+
ROCKCHIP_SPI_DMATDLR
);
writel_relaxed
(
rs
->
fifo_len
/
2
,
rs
->
regs
+
ROCKCHIP_SPI_DMATDLR
);
writel_relaxed
(
0
,
rs
->
regs
+
ROCKCHIP_SPI_DMARDLR
);
writel_relaxed
(
0
,
rs
->
regs
+
ROCKCHIP_SPI_DMARDLR
);
writel_relaxed
(
dmacr
,
rs
->
regs
+
ROCKCHIP_SPI_DMACR
);
writel_relaxed
(
dmacr
,
rs
->
regs
+
ROCKCHIP_SPI_DMACR
);
...
...
drivers/spi/spi-sh-msiof.c
View file @
106dbe24
...
@@ -229,7 +229,7 @@ static int sh_msiof_modify_ctr_wait(struct sh_msiof_spi_priv *p,
...
@@ -229,7 +229,7 @@ static int sh_msiof_modify_ctr_wait(struct sh_msiof_spi_priv *p,
sh_msiof_write
(
p
,
CTR
,
data
);
sh_msiof_write
(
p
,
CTR
,
data
);
return
readl_poll_timeout_atomic
(
p
->
mapbase
+
CTR
,
data
,
return
readl_poll_timeout_atomic
(
p
->
mapbase
+
CTR
,
data
,
(
data
&
mask
)
==
set
,
1
0
,
10
00
);
(
data
&
mask
)
==
set
,
1
,
1
00
);
}
}
static
irqreturn_t
sh_msiof_spi_irq
(
int
irq
,
void
*
data
)
static
irqreturn_t
sh_msiof_spi_irq
(
int
irq
,
void
*
data
)
...
...
drivers/spi/spi-stm32-qspi.c
View file @
106dbe24
...
@@ -245,14 +245,10 @@ static int stm32_qspi_tx_dma(struct stm32_qspi *qspi,
...
@@ -245,14 +245,10 @@ static int stm32_qspi_tx_dma(struct stm32_qspi *qspi,
writel_relaxed
(
cr
|
CR_DMAEN
,
qspi
->
io_base
+
QSPI_CR
);
writel_relaxed
(
cr
|
CR_DMAEN
,
qspi
->
io_base
+
QSPI_CR
);
t_out
=
sgt
.
nents
*
STM32_COMP_TIMEOUT_MS
;
t_out
=
sgt
.
nents
*
STM32_COMP_TIMEOUT_MS
;
if
(
!
wait_for_completion_
interruptible_
timeout
(
&
qspi
->
dma_completion
,
if
(
!
wait_for_completion_timeout
(
&
qspi
->
dma_completion
,
msecs_to_jiffies
(
t_out
)))
msecs_to_jiffies
(
t_out
)))
err
=
-
ETIMEDOUT
;
err
=
-
ETIMEDOUT
;
if
(
dma_async_is_tx_complete
(
dma_ch
,
cookie
,
NULL
,
NULL
)
!=
DMA_COMPLETE
)
err
=
-
ETIMEDOUT
;
if
(
err
)
if
(
err
)
dmaengine_terminate_all
(
dma_ch
);
dmaengine_terminate_all
(
dma_ch
);
...
@@ -304,7 +300,7 @@ static int stm32_qspi_wait_cmd(struct stm32_qspi *qspi,
...
@@ -304,7 +300,7 @@ static int stm32_qspi_wait_cmd(struct stm32_qspi *qspi,
cr
=
readl_relaxed
(
qspi
->
io_base
+
QSPI_CR
);
cr
=
readl_relaxed
(
qspi
->
io_base
+
QSPI_CR
);
writel_relaxed
(
cr
|
CR_TCIE
|
CR_TEIE
,
qspi
->
io_base
+
QSPI_CR
);
writel_relaxed
(
cr
|
CR_TCIE
|
CR_TEIE
,
qspi
->
io_base
+
QSPI_CR
);
if
(
!
wait_for_completion_
interruptible_
timeout
(
&
qspi
->
data_completion
,
if
(
!
wait_for_completion_timeout
(
&
qspi
->
data_completion
,
msecs_to_jiffies
(
STM32_COMP_TIMEOUT_MS
)))
{
msecs_to_jiffies
(
STM32_COMP_TIMEOUT_MS
)))
{
err
=
-
ETIMEDOUT
;
err
=
-
ETIMEDOUT
;
}
else
{
}
else
{
...
...
drivers/spi/spi-synquacer.c
0 → 100644
View file @
106dbe24
This diff is collapsed.
Click to expand it.
drivers/spi/spi-tegra114.c
View file @
106dbe24
...
@@ -84,8 +84,10 @@
...
@@ -84,8 +84,10 @@
(reg = (((val) & 0x1) << ((cs) * 8 + 5)) | \
(reg = (((val) & 0x1) << ((cs) * 8 + 5)) | \
((reg) & ~(1 << ((cs) * 8 + 5))))
((reg) & ~(1 << ((cs) * 8 + 5))))
#define SPI_SET_CYCLES_BETWEEN_PACKETS(reg, cs, val) \
#define SPI_SET_CYCLES_BETWEEN_PACKETS(reg, cs, val) \
(reg = (((val) & 0xF) << ((cs) * 8)) | \
(reg = (((val) & 0x1F) << ((cs) * 8)) | \
((reg) & ~(0xF << ((cs) * 8))))
((reg) & ~(0x1F << ((cs) * 8))))
#define MAX_SETUP_HOLD_CYCLES 16
#define MAX_INACTIVE_CYCLES 32
#define SPI_TRANS_STATUS 0x010
#define SPI_TRANS_STATUS 0x010
#define SPI_BLK_CNT(val) (((val) >> 0) & 0xFFFF)
#define SPI_BLK_CNT(val) (((val) >> 0) & 0xFFFF)
...
@@ -156,6 +158,11 @@ struct tegra_spi_soc_data {
...
@@ -156,6 +158,11 @@ struct tegra_spi_soc_data {
bool
has_intr_mask_reg
;
bool
has_intr_mask_reg
;
};
};
struct
tegra_spi_client_data
{
int
tx_clk_tap_delay
;
int
rx_clk_tap_delay
;
};
struct
tegra_spi_data
{
struct
tegra_spi_data
{
struct
device
*
dev
;
struct
device
*
dev
;
struct
spi_master
*
master
;
struct
spi_master
*
master
;
...
@@ -182,6 +189,7 @@ struct tegra_spi_data {
...
@@ -182,6 +189,7 @@ struct tegra_spi_data {
unsigned
dma_buf_size
;
unsigned
dma_buf_size
;
unsigned
max_buf_size
;
unsigned
max_buf_size
;
bool
is_curr_dma_xfer
;
bool
is_curr_dma_xfer
;
bool
use_hw_based_cs
;
struct
completion
rx_dma_complete
;
struct
completion
rx_dma_complete
;
struct
completion
tx_dma_complete
;
struct
completion
tx_dma_complete
;
...
@@ -194,6 +202,10 @@ struct tegra_spi_data {
...
@@ -194,6 +202,10 @@ struct tegra_spi_data {
u32
command1_reg
;
u32
command1_reg
;
u32
dma_control_reg
;
u32
dma_control_reg
;
u32
def_command1_reg
;
u32
def_command1_reg
;
u32
def_command2_reg
;
u32
spi_cs_timing1
;
u32
spi_cs_timing2
;
u8
last_used_cs
;
struct
completion
xfer_completion
;
struct
completion
xfer_completion
;
struct
spi_transfer
*
curr_xfer
;
struct
spi_transfer
*
curr_xfer
;
...
@@ -711,14 +723,55 @@ static void tegra_spi_deinit_dma_param(struct tegra_spi_data *tspi,
...
@@ -711,14 +723,55 @@ static void tegra_spi_deinit_dma_param(struct tegra_spi_data *tspi,
dma_release_channel
(
dma_chan
);
dma_release_channel
(
dma_chan
);
}
}
static
void
tegra_spi_set_hw_cs_timing
(
struct
spi_device
*
spi
,
u8
setup_dly
,
u8
hold_dly
,
u8
inactive_dly
)
{
struct
tegra_spi_data
*
tspi
=
spi_master_get_devdata
(
spi
->
master
);
u32
setup_hold
;
u32
spi_cs_timing
;
u32
inactive_cycles
;
u8
cs_state
;
setup_dly
=
min_t
(
u8
,
setup_dly
,
MAX_SETUP_HOLD_CYCLES
);
hold_dly
=
min_t
(
u8
,
hold_dly
,
MAX_SETUP_HOLD_CYCLES
);
if
(
setup_dly
&&
hold_dly
)
{
setup_hold
=
SPI_SETUP_HOLD
(
setup_dly
-
1
,
hold_dly
-
1
);
spi_cs_timing
=
SPI_CS_SETUP_HOLD
(
tspi
->
spi_cs_timing1
,
spi
->
chip_select
,
setup_hold
);
if
(
tspi
->
spi_cs_timing1
!=
spi_cs_timing
)
{
tspi
->
spi_cs_timing1
=
spi_cs_timing
;
tegra_spi_writel
(
tspi
,
spi_cs_timing
,
SPI_CS_TIMING1
);
}
}
inactive_cycles
=
min_t
(
u8
,
inactive_dly
,
MAX_INACTIVE_CYCLES
);
if
(
inactive_cycles
)
inactive_cycles
--
;
cs_state
=
inactive_cycles
?
0
:
1
;
spi_cs_timing
=
tspi
->
spi_cs_timing2
;
SPI_SET_CS_ACTIVE_BETWEEN_PACKETS
(
spi_cs_timing
,
spi
->
chip_select
,
cs_state
);
SPI_SET_CYCLES_BETWEEN_PACKETS
(
spi_cs_timing
,
spi
->
chip_select
,
inactive_cycles
);
if
(
tspi
->
spi_cs_timing2
!=
spi_cs_timing
)
{
tspi
->
spi_cs_timing2
=
spi_cs_timing
;
tegra_spi_writel
(
tspi
,
spi_cs_timing
,
SPI_CS_TIMING2
);
}
}
static
u32
tegra_spi_setup_transfer_one
(
struct
spi_device
*
spi
,
static
u32
tegra_spi_setup_transfer_one
(
struct
spi_device
*
spi
,
struct
spi_transfer
*
t
,
bool
is_first_of_msg
)
struct
spi_transfer
*
t
,
bool
is_first_of_msg
,
bool
is_single_xfer
)
{
{
struct
tegra_spi_data
*
tspi
=
spi_master_get_devdata
(
spi
->
master
);
struct
tegra_spi_data
*
tspi
=
spi_master_get_devdata
(
spi
->
master
);
struct
tegra_spi_client_data
*
cdata
=
spi
->
controller_data
;
u32
speed
=
t
->
speed_hz
;
u32
speed
=
t
->
speed_hz
;
u8
bits_per_word
=
t
->
bits_per_word
;
u8
bits_per_word
=
t
->
bits_per_word
;
u32
command1
;
u32
command1
,
command2
;
int
req_mode
;
int
req_mode
;
u32
tx_tap
=
0
,
rx_tap
=
0
;
if
(
speed
!=
tspi
->
cur_speed
)
{
if
(
speed
!=
tspi
->
cur_speed
)
{
clk_set_rate
(
tspi
->
clk
,
speed
);
clk_set_rate
(
tspi
->
clk
,
speed
);
...
@@ -765,13 +818,34 @@ static u32 tegra_spi_setup_transfer_one(struct spi_device *spi,
...
@@ -765,13 +818,34 @@ static u32 tegra_spi_setup_transfer_one(struct spi_device *spi,
}
else
}
else
tegra_spi_writel
(
tspi
,
command1
,
SPI_COMMAND1
);
tegra_spi_writel
(
tspi
,
command1
,
SPI_COMMAND1
);
/* GPIO based chip select control */
if
(
spi
->
cs_gpiod
)
gpiod_set_value
(
spi
->
cs_gpiod
,
1
);
if
(
is_single_xfer
&&
!
(
t
->
cs_change
))
{
tspi
->
use_hw_based_cs
=
true
;
command1
&=
~
(
SPI_CS_SW_HW
|
SPI_CS_SW_VAL
);
}
else
{
tspi
->
use_hw_based_cs
=
false
;
command1
|=
SPI_CS_SW_HW
;
command1
|=
SPI_CS_SW_HW
;
if
(
spi
->
mode
&
SPI_CS_HIGH
)
if
(
spi
->
mode
&
SPI_CS_HIGH
)
command1
|=
SPI_CS_SW_VAL
;
command1
|=
SPI_CS_SW_VAL
;
else
else
command1
&=
~
SPI_CS_SW_VAL
;
command1
&=
~
SPI_CS_SW_VAL
;
}
if
(
tspi
->
last_used_cs
!=
spi
->
chip_select
)
{
if
(
cdata
&&
cdata
->
tx_clk_tap_delay
)
tx_tap
=
cdata
->
tx_clk_tap_delay
;
if
(
cdata
&&
cdata
->
rx_clk_tap_delay
)
rx_tap
=
cdata
->
rx_clk_tap_delay
;
command2
=
SPI_TX_TAP_DELAY
(
tx_tap
)
|
SPI_RX_TAP_DELAY
(
rx_tap
);
if
(
command2
!=
tspi
->
def_command2_reg
)
tegra_spi_writel
(
tspi
,
command2
,
SPI_COMMAND2
);
tspi
->
last_used_cs
=
spi
->
chip_select
;
}
tegra_spi_writel
(
tspi
,
0
,
SPI_COMMAND2
);
}
else
{
}
else
{
command1
=
tspi
->
command1_reg
;
command1
=
tspi
->
command1_reg
;
command1
&=
~
SPI_BIT_LENGTH
(
~
0
);
command1
&=
~
SPI_BIT_LENGTH
(
~
0
);
...
@@ -827,9 +901,42 @@ static int tegra_spi_start_transfer_one(struct spi_device *spi,
...
@@ -827,9 +901,42 @@ static int tegra_spi_start_transfer_one(struct spi_device *spi,
return
ret
;
return
ret
;
}
}
static
struct
tegra_spi_client_data
*
tegra_spi_parse_cdata_dt
(
struct
spi_device
*
spi
)
{
struct
tegra_spi_client_data
*
cdata
;
struct
device_node
*
slave_np
;
slave_np
=
spi
->
dev
.
of_node
;
if
(
!
slave_np
)
{
dev_dbg
(
&
spi
->
dev
,
"device node not found
\n
"
);
return
NULL
;
}
cdata
=
kzalloc
(
sizeof
(
*
cdata
),
GFP_KERNEL
);
if
(
!
cdata
)
return
NULL
;
of_property_read_u32
(
slave_np
,
"nvidia,tx-clk-tap-delay"
,
&
cdata
->
tx_clk_tap_delay
);
of_property_read_u32
(
slave_np
,
"nvidia,rx-clk-tap-delay"
,
&
cdata
->
rx_clk_tap_delay
);
return
cdata
;
}
static
void
tegra_spi_cleanup
(
struct
spi_device
*
spi
)
{
struct
tegra_spi_client_data
*
cdata
=
spi
->
controller_data
;
spi
->
controller_data
=
NULL
;
if
(
spi
->
dev
.
of_node
)
kfree
(
cdata
);
}
static
int
tegra_spi_setup
(
struct
spi_device
*
spi
)
static
int
tegra_spi_setup
(
struct
spi_device
*
spi
)
{
{
struct
tegra_spi_data
*
tspi
=
spi_master_get_devdata
(
spi
->
master
);
struct
tegra_spi_data
*
tspi
=
spi_master_get_devdata
(
spi
->
master
);
struct
tegra_spi_client_data
*
cdata
=
spi
->
controller_data
;
u32
val
;
u32
val
;
unsigned
long
flags
;
unsigned
long
flags
;
int
ret
;
int
ret
;
...
@@ -840,9 +947,16 @@ static int tegra_spi_setup(struct spi_device *spi)
...
@@ -840,9 +947,16 @@ static int tegra_spi_setup(struct spi_device *spi)
spi
->
mode
&
SPI_CPHA
?
""
:
"~"
,
spi
->
mode
&
SPI_CPHA
?
""
:
"~"
,
spi
->
max_speed_hz
);
spi
->
max_speed_hz
);
if
(
!
cdata
)
{
cdata
=
tegra_spi_parse_cdata_dt
(
spi
);
spi
->
controller_data
=
cdata
;
}
ret
=
pm_runtime_get_sync
(
tspi
->
dev
);
ret
=
pm_runtime_get_sync
(
tspi
->
dev
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
dev_err
(
tspi
->
dev
,
"pm runtime failed, e = %d
\n
"
,
ret
);
dev_err
(
tspi
->
dev
,
"pm runtime failed, e = %d
\n
"
,
ret
);
if
(
cdata
)
tegra_spi_cleanup
(
spi
);
return
ret
;
return
ret
;
}
}
...
@@ -853,6 +967,10 @@ static int tegra_spi_setup(struct spi_device *spi)
...
@@ -853,6 +967,10 @@ static int tegra_spi_setup(struct spi_device *spi)
}
}
spin_lock_irqsave
(
&
tspi
->
lock
,
flags
);
spin_lock_irqsave
(
&
tspi
->
lock
,
flags
);
/* GPIO based chip select control */
if
(
spi
->
cs_gpiod
)
gpiod_set_value
(
spi
->
cs_gpiod
,
0
);
val
=
tspi
->
def_command1_reg
;
val
=
tspi
->
def_command1_reg
;
if
(
spi
->
mode
&
SPI_CS_HIGH
)
if
(
spi
->
mode
&
SPI_CS_HIGH
)
val
&=
~
SPI_CS_POL_INACTIVE
(
spi
->
chip_select
);
val
&=
~
SPI_CS_POL_INACTIVE
(
spi
->
chip_select
);
...
@@ -882,11 +1000,18 @@ static void tegra_spi_transfer_end(struct spi_device *spi)
...
@@ -882,11 +1000,18 @@ static void tegra_spi_transfer_end(struct spi_device *spi)
struct
tegra_spi_data
*
tspi
=
spi_master_get_devdata
(
spi
->
master
);
struct
tegra_spi_data
*
tspi
=
spi_master_get_devdata
(
spi
->
master
);
int
cs_val
=
(
spi
->
mode
&
SPI_CS_HIGH
)
?
0
:
1
;
int
cs_val
=
(
spi
->
mode
&
SPI_CS_HIGH
)
?
0
:
1
;
/* GPIO based chip select control */
if
(
spi
->
cs_gpiod
)
gpiod_set_value
(
spi
->
cs_gpiod
,
0
);
if
(
!
tspi
->
use_hw_based_cs
)
{
if
(
cs_val
)
if
(
cs_val
)
tspi
->
command1_reg
|=
SPI_CS_SW_VAL
;
tspi
->
command1_reg
|=
SPI_CS_SW_VAL
;
else
else
tspi
->
command1_reg
&=
~
SPI_CS_SW_VAL
;
tspi
->
command1_reg
&=
~
SPI_CS_SW_VAL
;
tegra_spi_writel
(
tspi
,
tspi
->
command1_reg
,
SPI_COMMAND1
);
tegra_spi_writel
(
tspi
,
tspi
->
command1_reg
,
SPI_COMMAND1
);
}
tegra_spi_writel
(
tspi
,
tspi
->
def_command1_reg
,
SPI_COMMAND1
);
tegra_spi_writel
(
tspi
,
tspi
->
def_command1_reg
,
SPI_COMMAND1
);
}
}
...
@@ -913,16 +1038,19 @@ static int tegra_spi_transfer_one_message(struct spi_master *master,
...
@@ -913,16 +1038,19 @@ static int tegra_spi_transfer_one_message(struct spi_master *master,
struct
spi_device
*
spi
=
msg
->
spi
;
struct
spi_device
*
spi
=
msg
->
spi
;
int
ret
;
int
ret
;
bool
skip
=
false
;
bool
skip
=
false
;
int
single_xfer
;
msg
->
status
=
0
;
msg
->
status
=
0
;
msg
->
actual_length
=
0
;
msg
->
actual_length
=
0
;
single_xfer
=
list_is_singular
(
&
msg
->
transfers
);
list_for_each_entry
(
xfer
,
&
msg
->
transfers
,
transfer_list
)
{
list_for_each_entry
(
xfer
,
&
msg
->
transfers
,
transfer_list
)
{
u32
cmd1
;
u32
cmd1
;
reinit_completion
(
&
tspi
->
xfer_completion
);
reinit_completion
(
&
tspi
->
xfer_completion
);
cmd1
=
tegra_spi_setup_transfer_one
(
spi
,
xfer
,
is_first_msg
);
cmd1
=
tegra_spi_setup_transfer_one
(
spi
,
xfer
,
is_first_msg
,
single_xfer
);
if
(
!
xfer
->
len
)
{
if
(
!
xfer
->
len
)
{
ret
=
0
;
ret
=
0
;
...
@@ -955,6 +1083,7 @@ static int tegra_spi_transfer_one_message(struct spi_master *master,
...
@@ -955,6 +1083,7 @@ static int tegra_spi_transfer_one_message(struct spi_master *master,
reset_control_assert
(
tspi
->
rst
);
reset_control_assert
(
tspi
->
rst
);
udelay
(
2
);
udelay
(
2
);
reset_control_deassert
(
tspi
->
rst
);
reset_control_deassert
(
tspi
->
rst
);
tspi
->
last_used_cs
=
master
->
num_chipselect
+
1
;
goto
complete_xfer
;
goto
complete_xfer
;
}
}
...
@@ -1188,11 +1317,14 @@ static int tegra_spi_probe(struct platform_device *pdev)
...
@@ -1188,11 +1317,14 @@ static int tegra_spi_probe(struct platform_device *pdev)
master
->
max_speed_hz
=
25000000
;
/* 25MHz */
master
->
max_speed_hz
=
25000000
;
/* 25MHz */
/* the spi->mode bits understood by this driver: */
/* the spi->mode bits understood by this driver: */
master
->
use_gpio_descriptors
=
true
;
master
->
mode_bits
=
SPI_CPOL
|
SPI_CPHA
|
SPI_CS_HIGH
|
SPI_LSB_FIRST
|
master
->
mode_bits
=
SPI_CPOL
|
SPI_CPHA
|
SPI_CS_HIGH
|
SPI_LSB_FIRST
|
SPI_TX_DUAL
|
SPI_RX_DUAL
|
SPI_3WIRE
;
SPI_TX_DUAL
|
SPI_RX_DUAL
|
SPI_3WIRE
;
master
->
bits_per_word_mask
=
SPI_BPW_RANGE_MASK
(
4
,
32
);
master
->
bits_per_word_mask
=
SPI_BPW_RANGE_MASK
(
4
,
32
);
master
->
setup
=
tegra_spi_setup
;
master
->
setup
=
tegra_spi_setup
;
master
->
cleanup
=
tegra_spi_cleanup
;
master
->
transfer_one_message
=
tegra_spi_transfer_one_message
;
master
->
transfer_one_message
=
tegra_spi_transfer_one_message
;
master
->
set_cs_timing
=
tegra_spi_set_hw_cs_timing
;
master
->
num_chipselect
=
MAX_CHIP_SELECT
;
master
->
num_chipselect
=
MAX_CHIP_SELECT
;
master
->
auto_runtime_pm
=
true
;
master
->
auto_runtime_pm
=
true
;
bus_num
=
of_alias_get_id
(
pdev
->
dev
.
of_node
,
"spi"
);
bus_num
=
of_alias_get_id
(
pdev
->
dev
.
of_node
,
"spi"
);
...
@@ -1268,6 +1400,10 @@ static int tegra_spi_probe(struct platform_device *pdev)
...
@@ -1268,6 +1400,10 @@ static int tegra_spi_probe(struct platform_device *pdev)
reset_control_deassert
(
tspi
->
rst
);
reset_control_deassert
(
tspi
->
rst
);
tspi
->
def_command1_reg
=
SPI_M_S
;
tspi
->
def_command1_reg
=
SPI_M_S
;
tegra_spi_writel
(
tspi
,
tspi
->
def_command1_reg
,
SPI_COMMAND1
);
tegra_spi_writel
(
tspi
,
tspi
->
def_command1_reg
,
SPI_COMMAND1
);
tspi
->
spi_cs_timing1
=
tegra_spi_readl
(
tspi
,
SPI_CS_TIMING1
);
tspi
->
spi_cs_timing2
=
tegra_spi_readl
(
tspi
,
SPI_CS_TIMING2
);
tspi
->
def_command2_reg
=
tegra_spi_readl
(
tspi
,
SPI_COMMAND2
);
tspi
->
last_used_cs
=
master
->
num_chipselect
+
1
;
pm_runtime_put
(
&
pdev
->
dev
);
pm_runtime_put
(
&
pdev
->
dev
);
ret
=
request_threaded_irq
(
tspi
->
irq
,
tegra_spi_isr
,
ret
=
request_threaded_irq
(
tspi
->
irq
,
tegra_spi_isr
,
tegra_spi_isr_thread
,
IRQF_ONESHOT
,
tegra_spi_isr_thread
,
IRQF_ONESHOT
,
...
@@ -1340,6 +1476,8 @@ static int tegra_spi_resume(struct device *dev)
...
@@ -1340,6 +1476,8 @@ static int tegra_spi_resume(struct device *dev)
return
ret
;
return
ret
;
}
}
tegra_spi_writel
(
tspi
,
tspi
->
command1_reg
,
SPI_COMMAND1
);
tegra_spi_writel
(
tspi
,
tspi
->
command1_reg
,
SPI_COMMAND1
);
tegra_spi_writel
(
tspi
,
tspi
->
def_command2_reg
,
SPI_COMMAND2
);
tspi
->
last_used_cs
=
master
->
num_chipselect
+
1
;
pm_runtime_put
(
dev
);
pm_runtime_put
(
dev
);
return
spi_master_resume
(
master
);
return
spi_master_resume
(
master
);
...
...
drivers/spi/spi.c
View file @
106dbe24
This diff is collapsed.
Click to expand it.
drivers/spi/spidev.c
View file @
106dbe24
...
@@ -663,6 +663,8 @@ static const struct of_device_id spidev_dt_ids[] = {
...
@@ -663,6 +663,8 @@ static const struct of_device_id spidev_dt_ids[] = {
{
.
compatible
=
"ge,achc"
},
{
.
compatible
=
"ge,achc"
},
{
.
compatible
=
"semtech,sx1301"
},
{
.
compatible
=
"semtech,sx1301"
},
{
.
compatible
=
"lwn,bk4"
},
{
.
compatible
=
"lwn,bk4"
},
{
.
compatible
=
"dh,dhcom-board"
},
{
.
compatible
=
"menlo,m53cpld"
},
{},
{},
};
};
MODULE_DEVICE_TABLE
(
of
,
spidev_dt_ids
);
MODULE_DEVICE_TABLE
(
of
,
spidev_dt_ids
);
...
...
include/linux/platform_data/spi-mt65xx.h
View file @
106dbe24
...
@@ -11,8 +11,6 @@
...
@@ -11,8 +11,6 @@
/* Board specific platform_data */
/* Board specific platform_data */
struct
mtk_chip_config
{
struct
mtk_chip_config
{
u32
tx_mlsb
;
u32
rx_mlsb
;
u32
cs_pol
;
u32
cs_pol
;
u32
sample_sel
;
u32
sample_sel
;
};
};
...
...
include/linux/spi/spi.h
View file @
106dbe24
...
@@ -735,6 +735,9 @@ extern void spi_res_release(struct spi_controller *ctlr,
...
@@ -735,6 +735,9 @@ extern void spi_res_release(struct spi_controller *ctlr,
* @bits_per_word: select a bits_per_word other than the device default
* @bits_per_word: select a bits_per_word other than the device default
* for this transfer. If 0 the default (from @spi_device) is used.
* for this transfer. If 0 the default (from @spi_device) is used.
* @cs_change: affects chipselect after this transfer completes
* @cs_change: affects chipselect after this transfer completes
* @cs_change_delay: delay between cs deassert and assert when
* @cs_change is set and @spi_transfer is not the last in @spi_message
* @cs_change_delay_unit: unit of cs_change_delay
* @delay_usecs: microseconds to delay after this transfer before
* @delay_usecs: microseconds to delay after this transfer before
* (optionally) changing the chipselect status, then starting
* (optionally) changing the chipselect status, then starting
* the next transfer or completing this @spi_message.
* the next transfer or completing this @spi_message.
...
@@ -742,6 +745,9 @@ extern void spi_res_release(struct spi_controller *ctlr,
...
@@ -742,6 +745,9 @@ extern void spi_res_release(struct spi_controller *ctlr,
* (set by bits_per_word) transmission.
* (set by bits_per_word) transmission.
* @word_delay: clock cycles to inter word delay after each word size
* @word_delay: clock cycles to inter word delay after each word size
* (set by bits_per_word) transmission.
* (set by bits_per_word) transmission.
* @effective_speed_hz: the effective SCK-speed that was used to
* transfer this transfer. Set to 0 if the spi bus driver does
* not support it.
* @transfer_list: transfers are sequenced through @spi_message.transfers
* @transfer_list: transfers are sequenced through @spi_message.transfers
* @tx_sg: Scatterlist for transmit, currently not for client use
* @tx_sg: Scatterlist for transmit, currently not for client use
* @rx_sg: Scatterlist for receive, currently not for client use
* @rx_sg: Scatterlist for receive, currently not for client use
...
@@ -824,9 +830,16 @@ struct spi_transfer {
...
@@ -824,9 +830,16 @@ struct spi_transfer {
u8
bits_per_word
;
u8
bits_per_word
;
u8
word_delay_usecs
;
u8
word_delay_usecs
;
u16
delay_usecs
;
u16
delay_usecs
;
u16
cs_change_delay
;
u8
cs_change_delay_unit
;
#define SPI_DELAY_UNIT_USECS 0
#define SPI_DELAY_UNIT_NSECS 1
#define SPI_DELAY_UNIT_SCK 2
u32
speed_hz
;
u32
speed_hz
;
u16
word_delay
;
u16
word_delay
;
u32
effective_speed_hz
;
struct
list_head
transfer_list
;
struct
list_head
transfer_list
;
};
};
...
@@ -967,6 +980,8 @@ static inline void spi_message_free(struct spi_message *m)
...
@@ -967,6 +980,8 @@ static inline void spi_message_free(struct spi_message *m)
kfree
(
m
);
kfree
(
m
);
}
}
extern
void
spi_set_cs_timing
(
struct
spi_device
*
spi
,
u8
setup
,
u8
hold
,
u8
inactive_dly
);
extern
int
spi_setup
(
struct
spi_device
*
spi
);
extern
int
spi_setup
(
struct
spi_device
*
spi
);
extern
int
spi_async
(
struct
spi_device
*
spi
,
struct
spi_message
*
message
);
extern
int
spi_async
(
struct
spi_device
*
spi
,
struct
spi_message
*
message
);
extern
int
spi_async_locked
(
struct
spi_device
*
spi
,
extern
int
spi_async_locked
(
struct
spi_device
*
spi
,
...
@@ -997,6 +1012,26 @@ spi_max_transfer_size(struct spi_device *spi)
...
@@ -997,6 +1012,26 @@ spi_max_transfer_size(struct spi_device *spi)
return
min
(
tr_max
,
msg_max
);
return
min
(
tr_max
,
msg_max
);
}
}
/**
* spi_is_bpw_supported - Check if bits per word is supported
* @spi: SPI device
* @bpw: Bits per word
*
* This function checks to see if the SPI controller supports @bpw.
*
* Returns:
* True if @bpw is supported, false otherwise.
*/
static
inline
bool
spi_is_bpw_supported
(
struct
spi_device
*
spi
,
u32
bpw
)
{
u32
bpw_mask
=
spi
->
master
->
bits_per_word_mask
;
if
(
bpw
==
8
||
(
bpw
<=
32
&&
bpw_mask
&
SPI_BPW_MASK
(
bpw
)))
return
true
;
return
false
;
}
/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
/* SPI transfer replacement methods which make use of spi_res */
/* SPI transfer replacement methods which make use of spi_res */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment