1STRUCT SPI_DEVICE(9)    Serial Peripheral Interface (S    STRUCT SPI_DEVICE(9)
2
3
4

NAME

6       struct_spi_device - Master side proxy for an SPI slave device
7

SYNOPSIS

9       struct spi_device {
10         struct device dev;
11         struct spi_master * master;
12         u32 max_speed_hz;
13         u8 chip_select;
14         u8 mode;
15       #define SPI_CPHA    0x01
16       #define SPI_CPOL    0x02
17       #define SPI_MODE_0  (0|0)
18       #define SPI_MODE_1  (0|SPI_CPHA)
19       #define SPI_MODE_2  (SPI_CPOL|0)
20       #define SPI_MODE_3  (SPI_CPOL|SPI_CPHA)
21       #define SPI_CS_HIGH 0x04
22       #define SPI_LSB_FIRST    0x08
23       #define SPI_3WIRE   0x10
24       #define SPI_LOOP    0x20
25       #define SPI_NO_CS   0x40
26       #define SPI_READY   0x80
27         u8 bits_per_word;
28         int irq;
29         void * controller_state;
30         void * controller_data;
31         char modalias[SPI_NAME_SIZE];
32       };
33

MEMBERS

35       dev
36           Driver model representation of the device.
37
38       master
39           SPI controller used with the device.
40
41       max_speed_hz
42           Maximum clock rate to be used with this chip (on this board); may
43           be changed by the device´s driver. The spi_transfer.speed_hz can
44           override this for each transfer.
45
46       chip_select
47           Chipselect, distinguishing chips handled by master.
48
49       mode
50           The spi mode defines how data is clocked out and in. This may be
51           changed by the device´s driver. The “active low” default for
52           chipselect mode can be overridden (by specifying SPI_CS_HIGH) as
53           can the “MSB first” default for each word in a transfer (by
54           specifying SPI_LSB_FIRST).
55
56       bits_per_word
57           Data transfers involve one or more words; word sizes like eight or
58           12 bits are common. In-memory wordsizes are powers of two bytes
59           (e.g. 20 bit samples use 32 bits). This may be changed by the
60           device´s driver, or left at the default (0) indicating protocol
61           words are eight bit bytes. The spi_transfer.bits_per_word can
62           override this for each transfer.
63
64       irq
65           Negative, or the number passed to request_irq to receive interrupts
66           from this device.
67
68       controller_state
69           Controller´s runtime state
70
71       controller_data
72           Board-specific definitions for controller, such as FIFO
73           initialization parameters; from board_info.controller_data
74
75       modalias[SPI_NAME_SIZE]
76           Name of the driver to use with this device, or an alias for that
77           name. This appears in the sysfs “modalias” attribute for driver
78           coldplugging, and in uevents used for hotplugging
79

DESCRIPTION

81       A spi_device is used to interchange data between an SPI slave (usually
82       a discrete chip) and CPU memory.
83
84       In dev, the platform_data is used to hold information about this device
85       that´s meaningful to the device´s protocol driver, but not to its
86       controller. One example might be an identifier for a chip variant with
87       slightly different functionality; another might be information about
88       how this particular board wires the chip´s pins.
89
91Kernel Hackers Manual 2.6.         June 2019              STRUCT SPI_DEVICE(9)
Impressum