···1717- cs-gpios: chipselects (internal cs not supported)1818- atmel,usart-mode : Must be <AT91_USART_MODE_SPI> (found in dt-bindings/mfd/at91-usart.h)19192020+Optional properties in serial and SPI mode:2121+- dma bindings for dma transfer:2222+ - dmas: DMA specifier, consisting of a phandle to DMA controller node,2323+ memory peripheral interface and USART DMA channel ID, FIFO configuration.2424+ The order of DMA channels is fixed. The first DMA channel must be TX2525+ associated channel and the second one must be RX associated channel.2626+ Refer to dma.txt and atmel-dma.txt for details.2727+ - dma-names: "tx" for TX channel.2828+ "rx" for RX channel.2929+ The order of dma-names is also fixed. The first name must be "tx"3030+ and the second one must be "rx" as in the examples below.3131+2032Optional properties in serial mode:2133- atmel,use-dma-rx: use of PDC or DMA for receiving data2234- atmel,use-dma-tx: use of PDC or DMA for transmitting data2335- {rts,cts,dtr,dsr,rng,dcd}-gpios: specify a GPIO for RTS/CTS/DTR/DSR/RI/DCD line respectively.2436 It will use specified PIO instead of the peripheral function pin for the USART feature.2537 If unsure, don't specify this property.2626-- add dma bindings for dma transfer:2727- - dmas: DMA specifier, consisting of a phandle to DMA controller node,2828- memory peripheral interface and USART DMA channel ID, FIFO configuration.2929- Refer to dma.txt and atmel-dma.txt for details.3030- - dma-names: "rx" for RX channel, "tx" for TX channel.3138- atmel,fifo-size: maximum number of data the RX and TX FIFOs can store for FIFO3239 capable USARTs.3340- rs485-rts-delay, rs485-rx-during-tx, linux,rs485-enabled-at-boot-time: see rs485.txt···8881 interrupts = <12 IRQ_TYPE_LEVEL_HIGH 5>;8982 clocks = <&usart0_clk>;9083 clock-names = "usart";8484+ dmas = <&dma0 2 AT91_DMA_CFG_PER_ID(3)>,8585+ <&dma0 2 (AT91_DMA_CFG_PER_ID(4) | AT91_DMA_CFG_FIFOCFG_ASAP)>;8686+ dma-names = "tx", "rx";9187 cs-gpios = <&pioB 3 0>;9288 };
···11-SPI (Serial Peripheral Interface) busses22-33-SPI busses can be described with a node for the SPI controller device44-and a set of child nodes for each SPI slave on the bus. The system's SPI55-controller may be described for use in SPI master mode or in SPI slave mode,66-but not for both at the same time.77-88-The SPI controller node requires the following properties:99-- compatible - Name of SPI bus controller following generic names1010- recommended practice.1111-1212-In master mode, the SPI controller node requires the following additional1313-properties:1414-- #address-cells - number of cells required to define a chip select1515- address on the SPI bus.1616-- #size-cells - should be zero.1717-1818-In slave mode, the SPI controller node requires one additional property:1919-- spi-slave - Empty property.2020-2121-No other properties are required in the SPI bus node. It is assumed2222-that a driver for an SPI bus device will understand that it is an SPI bus.2323-However, the binding does not attempt to define the specific method for2424-assigning chip select numbers. Since SPI chip select configuration is2525-flexible and non-standardized, it is left out of this binding with the2626-assumption that board specific platform code will be used to manage2727-chip selects. Individual drivers can define additional properties to2828-support describing the chip select layout.2929-3030-Optional properties (master mode only):3131-- cs-gpios - gpios chip select.3232-- num-cs - total number of chipselects.3333-3434-If cs-gpios is used the number of chip selects will be increased automatically3535-with max(cs-gpios > hw cs).3636-3737-So if for example the controller has 2 CS lines, and the cs-gpios3838-property looks like this:3939-4040-cs-gpios = <&gpio1 0 0>, <0>, <&gpio1 1 0>, <&gpio1 2 0>;4141-4242-Then it should be configured so that num_chipselect = 4 with the4343-following mapping:4444-4545-cs0 : &gpio1 0 04646-cs1 : native4747-cs2 : &gpio1 1 04848-cs3 : &gpio1 2 04949-5050-5151-SPI slave nodes must be children of the SPI controller node.5252-5353-In master mode, one or more slave nodes (up to the number of chip selects) can5454-be present. Required properties are:5555-- compatible - Name of SPI device following generic names recommended5656- practice.5757-- reg - Chip select address of device.5858-- spi-max-frequency - Maximum SPI clocking speed of device in Hz.5959-6060-In slave mode, the (single) slave node is optional.6161-If present, it must be called "slave". Required properties are:6262-- compatible - Name of SPI device following generic names recommended6363- practice.6464-6565-All slave nodes can contain the following optional properties:6666-- spi-cpol - Empty property indicating device requires inverse clock6767- polarity (CPOL) mode.6868-- spi-cpha - Empty property indicating device requires shifted clock6969- phase (CPHA) mode.7070-- spi-cs-high - Empty property indicating device requires chip select7171- active high.7272-- spi-3wire - Empty property indicating device requires 3-wire mode.7373-- spi-lsb-first - Empty property indicating device requires LSB first mode.7474-- spi-tx-bus-width - The bus width (number of data wires) that is used for MOSI.7575- Defaults to 1 if not present.7676-- spi-rx-bus-width - The bus width (number of data wires) that is used for MISO.7777- Defaults to 1 if not present.7878-- spi-rx-delay-us - Microsecond delay after a read transfer.7979-- spi-tx-delay-us - Microsecond delay after a write transfer.8080-8181-Some SPI controllers and devices support Dual and Quad SPI transfer mode.8282-It allows data in the SPI system to be transferred using 2 wires (DUAL) or 48383-wires (QUAD).8484-Now the value that spi-tx-bus-width and spi-rx-bus-width can receive is8585-only 1 (SINGLE), 2 (DUAL) and 4 (QUAD).8686-Dual/Quad mode is not allowed when 3-wire mode is used.8787-8888-If a gpio chipselect is used for the SPI slave the gpio number will be passed8989-via the SPI master node cs-gpios property.9090-9191-SPI example for an MPC5200 SPI bus:9292- spi@f00 {9393- #address-cells = <1>;9494- #size-cells = <0>;9595- compatible = "fsl,mpc5200b-spi","fsl,mpc5200-spi";9696- reg = <0xf00 0x20>;9797- interrupts = <2 13 0 2 14 0>;9898- interrupt-parent = <&mpc5200_pic>;9999-100100- ethernet-switch@0 {101101- compatible = "micrel,ks8995m";102102- spi-max-frequency = <1000000>;103103- reg = <0>;104104- };105105-106106- codec@1 {107107- compatible = "ti,tlv320aic26";108108- spi-max-frequency = <100000>;109109- reg = <1>;110110- };111111- };11+This file has moved to spi-controller.yaml.
···11+# SPDX-License-Identifier: GPL-2.022+%YAML 1.233+---44+$id: http://devicetree.org/schemas/spi/spi-controller.yaml#55+$schema: http://devicetree.org/meta-schemas/core.yaml#66+77+title: SPI Controller Generic Binding88+99+maintainers:1010+ - Mark Brown <broonie@kernel.org>1111+1212+description: |1313+ SPI busses can be described with a node for the SPI controller device1414+ and a set of child nodes for each SPI slave on the bus. The system SPI1515+ controller may be described for use in SPI master mode or in SPI slave mode,1616+ but not for both at the same time.1717+1818+properties:1919+ $nodename:2020+ pattern: "^spi(@.*|-[0-9a-f])*$"2121+2222+ "#address-cells":2323+ const: 12424+2525+ "#size-cells":2626+ const: 02727+2828+ cs-gpios:2929+ description: |3030+ GPIOs used as chip selects.3131+ If that property is used, the number of chip selects will be3232+ increased automatically with max(cs-gpios, hardware chip selects).3333+3434+ So if, for example, the controller has 2 CS lines, and the3535+ cs-gpios looks like this3636+ cs-gpios = <&gpio1 0 0>, <0>, <&gpio1 1 0>, <&gpio1 2 0>;3737+3838+ Then it should be configured so that num_chipselect = 4, with3939+ the following mapping4040+ cs0 : &gpio1 0 04141+ cs1 : native4242+ cs2 : &gpio1 1 04343+ cs3 : &gpio1 2 04444+4545+ num-cs:4646+ $ref: /schemas/types.yaml#/definitions/uint324747+ description:4848+ Total number of chip selects.4949+5050+ spi-slave:5151+ $ref: /schemas/types.yaml#/definitions/flag5252+ description:5353+ The SPI controller acts as a slave, instead of a master.5454+5555+patternProperties:5656+ "^slave$":5757+ type: object5858+5959+ properties:6060+ compatible:6161+ description:6262+ Compatible of the SPI device.6363+6464+ required:6565+ - compatible6666+6767+ "^.*@[0-9a-f]+$":6868+ type: object6969+7070+ properties:7171+ compatible:7272+ description:7373+ Compatible of the SPI device.7474+7575+ reg:7676+ maxItems: 17777+ minimum: 07878+ maximum: 2567979+ description:8080+ Chip select used by the device.8181+8282+ spi-3wire:8383+ $ref: /schemas/types.yaml#/definitions/flag8484+ description:8585+ The device requires 3-wire mode.8686+8787+ spi-cpha:8888+ $ref: /schemas/types.yaml#/definitions/flag8989+ description:9090+ The device requires shifted clock phase (CPHA) mode.9191+9292+ spi-cpol:9393+ $ref: /schemas/types.yaml#/definitions/flag9494+ description:9595+ The device requires inverse clock polarity (CPOL) mode.9696+9797+ spi-cs-high:9898+ $ref: /schemas/types.yaml#/definitions/flag9999+ description:100100+ The device requires the chip select active high.101101+102102+ spi-lsb-first:103103+ $ref: /schemas/types.yaml#/definitions/flag104104+ description:105105+ The device requires the LSB first mode.106106+107107+ spi-max-frequency:108108+ $ref: /schemas/types.yaml#/definitions/uint32109109+ description:110110+ Maximum SPI clocking speed of the device in Hz.111111+112112+ spi-rx-bus-width:113113+ allOf:114114+ - $ref: /schemas/types.yaml#/definitions/uint32115115+ - enum: [ 1, 2, 4 ]116116+ - default: 1117117+ description:118118+ Bus width to the SPI bus used for MISO.119119+120120+ spi-rx-delay-us:121121+ description:122122+ Delay, in microseconds, after a read transfer.123123+124124+ spi-tx-bus-width:125125+ allOf:126126+ - $ref: /schemas/types.yaml#/definitions/uint32127127+ - enum: [ 1, 2, 4 ]128128+ - default: 1129129+ description:130130+ Bus width to the SPI bus used for MOSI.131131+132132+ spi-tx-delay-us:133133+ description:134134+ Delay, in microseconds, after a write transfer.135135+136136+ required:137137+ - compatible138138+ - reg139139+140140+examples:141141+ - |142142+ spi@f00 {143143+ #address-cells = <1>;144144+ #size-cells = <0>;145145+ compatible = "fsl,mpc5200b-spi","fsl,mpc5200-spi";146146+ reg = <0xf00 0x20>;147147+ interrupts = <2 13 0 2 14 0>;148148+ interrupt-parent = <&mpc5200_pic>;149149+150150+ ethernet-switch@0 {151151+ compatible = "micrel,ks8995m";152152+ spi-max-frequency = <1000000>;153153+ reg = <0>;154154+ };155155+156156+ codec@1 {157157+ compatible = "ti,tlv320aic26";158158+ spi-max-frequency = <100000>;159159+ reg = <1>;160160+ };161161+ };
···11-SPI-GPIO devicetree bindings22-33-This represents a group of 3-n GPIO lines used for bit-banged SPI on dedicated44-GPIO lines.55-66-Required properties:77-88- - compatible: should be set to "spi-gpio"99- - #address-cells: should be set to <0x1>1010- - ranges1111- - sck-gpios: GPIO spec for the SCK line to use1212- - miso-gpios: GPIO spec for the MISO line to use1313- - mosi-gpios: GPIO spec for the MOSI line to use1414- - cs-gpios: GPIOs to use for chipselect lines.1515- Not needed if num-chipselects = <0>.1616- - num-chipselects: Number of chipselect lines. Should be <0> if a single device1717- with no chip select is connected.1818-1919-Deprecated bindings:2020-2121-These legacy GPIO line bindings can alternatively be used to define the2222-GPIO lines used, they should not be used in new device trees.2323-2424- - gpio-sck: GPIO spec for the SCK line to use2525- - gpio-miso: GPIO spec for the MISO line to use2626- - gpio-mosi: GPIO spec for the MOSI line to use2727-2828-Example:2929-3030- spi {3131- compatible = "spi-gpio";3232- #address-cells = <0x1>;3333- ranges;3434-3535- sck-gpios = <&gpio 95 0>;3636- miso-gpios = <&gpio 98 0>;3737- mosi-gpios = <&gpio 97 0>;3838- cs-gpios = <&gpio 125 0>;3939- num-chipselects = <1>;4040-4141- /* clients */4242- };4343-
···11+# SPDX-License-Identifier: GPL-2.022+%YAML 1.233+---44+$id: http://devicetree.org/schemas/spi/spi-gpio.yaml#55+$schema: http://devicetree.org/meta-schemas/core.yaml#66+77+title: SPI-GPIO devicetree bindings88+99+maintainers:1010+ - Rob Herring <robh@kernel.org>1111+1212+description:1313+ This represents a group of 3-n GPIO lines used for bit-banged SPI on1414+ dedicated GPIO lines.1515+1616+allOf:1717+ - $ref: "/schemas/spi/spi-controller.yaml#"1818+1919+properties:2020+ compatible:2121+ const: spi-gpio2222+2323+ sck-gpios:2424+ description: GPIO spec for the SCK line to use2525+ maxItems: 12626+2727+ miso-gpios:2828+ description: GPIO spec for the MISO line to use2929+ maxItems: 13030+3131+ mosi-gpios:3232+ description: GPIO spec for the MOSI line to use3333+ maxItems: 13434+3535+ cs-gpios:3636+ description: GPIOs to use for chipselect lines.3737+ Not needed if num-chipselects = <0>.3838+ minItems: 13939+ maxItems: 10244040+4141+ num-chipselects:4242+ description: Number of chipselect lines. Should be <0> if a single device4343+ with no chip select is connected.4444+ $ref: "/schemas/types.yaml#/definitions/uint32"4545+4646+ # Deprecated properties4747+ gpio-sck: false4848+ gpio-miso: false4949+ gpio-mosi: false5050+5151+required:5252+ - compatible5353+ - num-chipselects5454+ - sck-gpios5555+5656+examples:5757+ - |5858+ spi {5959+ compatible = "spi-gpio";6060+ #address-cells = <0x1>;6161+ #size-cells = <0x0>;6262+6363+ sck-gpios = <&gpio 95 0>;6464+ miso-gpios = <&gpio 98 0>;6565+ mosi-gpios = <&gpio 97 0>;6666+ cs-gpios = <&gpio 125 0>;6767+ num-chipselects = <1>;6868+6969+ /* clients */7070+ };7171+7272+...
···1919- reg: chip-Select number (QSPI controller may connect 2 flashes)2020- spi-max-frequency: max frequency of spi bus21212222-Optional property:2222+Optional properties:2323- spi-rx-bus-width: see ./spi-bus.txt for the description2424+- dmas: DMA specifiers for tx and rx dma. See the DMA client binding,2525+Documentation/devicetree/bindings/dma/dma.txt.2626+- dma-names: DMA request names should include "tx" and "rx" if present.24272528Example:2629
···11+* Socionext Synquacer HS-SPI bindings22+33+Required Properties:44+- compatible: should be "socionext,synquacer-spi"55+- reg: physical base address of the controller and length of memory mapped66+ region.77+- interrupts: should contain the "spi_rx", "spi_tx" and "spi_fault" interrupts.88+- clocks: core clock iHCLK. Optional rate clock iPCLK (default is iHCLK)99+- clock-names: Shall be "iHCLK" and "iPCLK" respectively1010+1111+Optional Properties:1212+- socionext,use-rtm: boolean, if required to use "retimed clock" for RX1313+- socionext,set-aces: boolean, if same active clock edges field to be set.1414+1515+Example:1616+1717+ spi0: spi@ff110000 {1818+ compatible = "socionext,synquacer-spi";1919+ reg = <0xff110000 0x1000>;2020+ interrupts = <GIC_SPI 160 IRQ_TYPE_LEVEL_HIGH>,2121+ <GIC_SPI 161 IRQ_TYPE_LEVEL_HIGH>,2222+ <GIC_SPI 162 IRQ_TYPE_LEVEL_HIGH>;2323+ clocks = <&clk_hsspi>;2424+ clock-names = "iHCLK";2525+ socionext,use-rtm;2626+ socionext,set-aces;2727+ };
···11-ARM PL022 SPI controller22-33-Required properties:44-- compatible : "arm,pl022", "arm,primecell"55-- reg : Offset and length of the register set for the device66-- interrupts : Should contain SPI controller interrupt77-- num-cs : total number of chipselects88-99-Optional properties:1010-- cs-gpios : should specify GPIOs used for chipselects.1111- The gpios will be referred to as reg = <index> in the SPI child nodes.1212- If unspecified, a single SPI device without a chip select can be used.1313-- pl022,autosuspend-delay : delay in ms following transfer completion before1414- the runtime power management system suspends the1515- device. A setting of 0 indicates no delay and the1616- device will be suspended immediately1717-- pl022,rt : indicates the controller should run the message pump with realtime1818- priority to minimise the transfer latency on the bus (boolean)1919-- dmas : Two or more DMA channel specifiers following the convention outlined2020- in bindings/dma/dma.txt2121-- dma-names: Names for the dma channels, if present. There must be at2222- least one channel named "tx" for transmit and named "rx" for2323- receive.2424-2525-2626-SPI slave nodes must be children of the SPI master node and can2727-contain the following properties.2828-2929-- pl022,interface : interface type:3030- 0: SPI3131- 1: Texas Instruments Synchronous Serial Frame Format3232- 2: Microwire (Half Duplex)3333-- pl022,com-mode : specifies the transfer mode:3434- 0: interrupt mode3535- 1: polling mode (default mode if property not present)3636- 2: DMA mode3737-- pl022,rx-level-trig : Rx FIFO watermark level3838-- pl022,tx-level-trig : Tx FIFO watermark level3939-- pl022,ctrl-len : Microwire interface: Control length4040-- pl022,wait-state : Microwire interface: Wait state4141-- pl022,duplex : Microwire interface: Full/Half duplex4242-4343-4444-Example:4545-4646- spi@e0100000 {4747- compatible = "arm,pl022", "arm,primecell";4848- reg = <0xe0100000 0x1000>;4949- #address-cells = <1>;5050- #size-cells = <0>;5151- interrupts = <0 31 0x4>;5252- dmas = <&dma-controller 23 1>,5353- <&dma-controller 24 0>;5454- dma-names = "rx", "tx";5555-5656- m25p80@1 {5757- compatible = "st,m25p80";5858- reg = <1>;5959- spi-max-frequency = <12000000>;6060- spi-cpol;6161- spi-cpha;6262- pl022,interface = <0>;6363- pl022,com-mode = <0x2>;6464- pl022,rx-level-trig = <0>;6565- pl022,tx-level-trig = <0>;6666- pl022,ctrl-len = <0x11>;6767- pl022,wait-state = <0>;6868- pl022,duplex = <0>;6969- };7070- };
+8
MAINTAINERS
···1463014630F: drivers/net/ethernet/socionext/netsec.c1463114631F: Documentation/devicetree/bindings/net/socionext-netsec.txt14632146321463314633+SOCIONEXT (SNI) Synquacer SPI DRIVER1463414634+M: Masahisa Kojima <masahisa.kojima@linaro.org>1463514635+M: Jassi Brar <jaswinder.singh@linaro.org>1463614636+L: linux-spi@vger.kernel.org1463714637+S: Maintained1463814638+F: drivers/spi/spi-synquacer.c1463914639+F: Documentation/devicetree/bindings/spi/spi-synquacer.txt1464014640+1463314641SOLIDRUN CLEARFOG SUPPORT1463414642M: Russell King <linux@armlinux.org.uk>1463514643S: Maintained
+12-2
drivers/spi/Kconfig
···120120config SPI_BCM2835121121 tristate "BCM2835 SPI controller"122122 depends on GPIOLIB123123- depends on ARCH_BCM2835 || COMPILE_TEST123123+ depends on ARCH_BCM2835 || ARCH_BRCMSTB || COMPILE_TEST124124 help125125 This selects a driver for the Broadcom BCM2835 SPI master.126126···131131132132config SPI_BCM2835AUX133133 tristate "BCM2835 SPI auxiliary controller"134134- depends on (ARCH_BCM2835 && GPIOLIB) || COMPILE_TEST134134+ depends on ((ARCH_BCM2835 || ARCH_BRCMSTB) && GPIOLIB) || COMPILE_TEST135135 help136136 This selects a driver for the Broadcom BCM2835 SPI aux master.137137···732732 depends on RESET_CONTROLLER733733 help734734 This enables using the SPI controller on the Allwinner A31 SoCs.735735+736736+config SPI_SYNQUACER737737+ tristate "Socionext's SynQuacer HighSpeed SPI controller"738738+ depends on ARCH_SYNQUACER || COMPILE_TEST739739+ help740740+ SPI driver for Socionext's High speed SPI controller which provides741741+ various operating modes for interfacing to serial peripheral devices742742+ that use the de-facto standard SPI protocol.743743+744744+ It also supports the new dual-bit and quad-bit SPI protocol.735745736746config SPI_MXIC737747 tristate "Macronix MX25F0A SPI controller"
···735735 * @bits_per_word: select a bits_per_word other than the device default736736 * for this transfer. If 0 the default (from @spi_device) is used.737737 * @cs_change: affects chipselect after this transfer completes738738+ * @cs_change_delay: delay between cs deassert and assert when739739+ * @cs_change is set and @spi_transfer is not the last in @spi_message740740+ * @cs_change_delay_unit: unit of cs_change_delay738741 * @delay_usecs: microseconds to delay after this transfer before739742 * (optionally) changing the chipselect status, then starting740743 * the next transfer or completing this @spi_message.···745742 * (set by bits_per_word) transmission.746743 * @word_delay: clock cycles to inter word delay after each word size747744 * (set by bits_per_word) transmission.745745+ * @effective_speed_hz: the effective SCK-speed that was used to746746+ * transfer this transfer. Set to 0 if the spi bus driver does747747+ * not support it.748748 * @transfer_list: transfers are sequenced through @spi_message.transfers749749 * @tx_sg: Scatterlist for transmit, currently not for client use750750 * @rx_sg: Scatterlist for receive, currently not for client use···830824 u8 bits_per_word;831825 u8 word_delay_usecs;832826 u16 delay_usecs;827827+ u16 cs_change_delay;828828+ u8 cs_change_delay_unit;829829+#define SPI_DELAY_UNIT_USECS 0830830+#define SPI_DELAY_UNIT_NSECS 1831831+#define SPI_DELAY_UNIT_SCK 2833832 u32 speed_hz;834833 u16 word_delay;834834+835835+ u32 effective_speed_hz;835836836837 struct list_head transfer_list;837838};···980967 kfree(m);981968}982969970970+extern void spi_set_cs_timing(struct spi_device *spi, u8 setup, u8 hold, u8 inactive_dly);971971+983972extern int spi_setup(struct spi_device *spi);984973extern int spi_async(struct spi_device *spi, struct spi_message *message);985974extern int spi_async_locked(struct spi_device *spi,···10109951011996 /* transfer size limit must not be greater than messsage size limit */1012997 return min(tr_max, msg_max);998998+}999999+10001000+/**10011001+ * spi_is_bpw_supported - Check if bits per word is supported10021002+ * @spi: SPI device10031003+ * @bpw: Bits per word10041004+ *10051005+ * This function checks to see if the SPI controller supports @bpw.10061006+ *10071007+ * Returns:10081008+ * True if @bpw is supported, false otherwise.10091009+ */10101010+static inline bool spi_is_bpw_supported(struct spi_device *spi, u32 bpw)10111011+{10121012+ u32 bpw_mask = spi->master->bits_per_word_mask;10131013+10141014+ if (bpw == 8 || (bpw <= 32 && bpw_mask & SPI_BPW_MASK(bpw)))10151015+ return true;10161016+10171017+ return false;10131018}1014101910151020/*---------------------------------------------------------------------------*/