aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/spi
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2007-10-12 21:27:47 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2007-10-12 21:27:47 -0400
commitb981d8b3f5e008ff10d993be633ad00564fc22cd (patch)
treee292dc07b22308912cf6a58354a608b9e5e8e1fd /include/linux/spi
parentb11d2127c4893a7315d1e16273bc8560049fa3ca (diff)
parent2b9e0aae1d50e880c58d46788e5e3ebd89d75d62 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts: drivers/macintosh/adbhid.c
Diffstat (limited to 'include/linux/spi')
-rw-r--r--include/linux/spi/mmc_spi.h33
-rw-r--r--include/linux/spi/spi.h59
-rw-r--r--include/linux/spi/spidev.h4
3 files changed, 95 insertions, 1 deletions
diff --git a/include/linux/spi/mmc_spi.h b/include/linux/spi/mmc_spi.h
new file mode 100644
index 000000000000..e9bbe3ebd721
--- /dev/null
+++ b/include/linux/spi/mmc_spi.h
@@ -0,0 +1,33 @@
1#ifndef __LINUX_SPI_MMC_SPI_H
2#define __LINUX_SPI_MMC_SPI_H
3
4struct device;
5struct mmc_host;
6
7/* Put this in platform_data of a device being used to manage an MMC/SD
8 * card slot. (Modeled after PXA mmc glue; see that for usage examples.)
9 *
10 * REVISIT This is not a spi-specific notion. Any card slot should be
11 * able to handle it. If the MMC core doesn't adopt this kind of notion,
12 * switch the "struct device *" parameters over to "struct spi_device *".
13 */
14struct mmc_spi_platform_data {
15 /* driver activation and (optional) card detect irq hookup */
16 int (*init)(struct device *,
17 irqreturn_t (*)(int, void *),
18 void *);
19 void (*exit)(struct device *, void *);
20
21 /* sense switch on sd cards */
22 int (*get_ro)(struct device *);
23
24 /* how long to debounce card detect, in msecs */
25 u16 detect_delay;
26
27 /* power management */
28 u16 powerup_msecs; /* delay of up to 250 msec */
29 u32 ocr_mask; /* available voltages */
30 void (*setpower)(struct device *, unsigned int maskval);
31};
32
33#endif /* __LINUX_SPI_MMC_SPI_H */
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 302b81d1d117..002a3cddbdd5 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -77,6 +77,7 @@ struct spi_device {
77#define SPI_CS_HIGH 0x04 /* chipselect active high? */ 77#define SPI_CS_HIGH 0x04 /* chipselect active high? */
78#define SPI_LSB_FIRST 0x08 /* per-word bits-on-wire */ 78#define SPI_LSB_FIRST 0x08 /* per-word bits-on-wire */
79#define SPI_3WIRE 0x10 /* SI/SO signals shared */ 79#define SPI_3WIRE 0x10 /* SI/SO signals shared */
80#define SPI_LOOP 0x20 /* loopback mode */
80 u8 bits_per_word; 81 u8 bits_per_word;
81 int irq; 82 int irq;
82 void *controller_state; 83 void *controller_state;
@@ -138,6 +139,32 @@ struct spi_message;
138 139
139 140
140 141
142/**
143 * struct spi_driver - Host side "protocol" driver
144 * @probe: Binds this driver to the spi device. Drivers can verify
145 * that the device is actually present, and may need to configure
146 * characteristics (such as bits_per_word) which weren't needed for
147 * the initial configuration done during system setup.
148 * @remove: Unbinds this driver from the spi device
149 * @shutdown: Standard shutdown callback used during system state
150 * transitions such as powerdown/halt and kexec
151 * @suspend: Standard suspend callback used during system state transitions
152 * @resume: Standard resume callback used during system state transitions
153 * @driver: SPI device drivers should initialize the name and owner
154 * field of this structure.
155 *
156 * This represents the kind of device driver that uses SPI messages to
157 * interact with the hardware at the other end of a SPI link. It's called
158 * a "protocol" driver because it works through messages rather than talking
159 * directly to SPI hardware (which is what the underlying SPI controller
160 * driver does to pass those messages). These protocols are defined in the
161 * specification for the device(s) supported by the driver.
162 *
163 * As a rule, those device protocols represent the lowest level interface
164 * supported by a driver, and it will support upper level interfaces too.
165 * Examples of such upper levels include frameworks like MTD, networking,
166 * MMC, RTC, filesystem character device nodes, and hardware monitoring.
167 */
141struct spi_driver { 168struct spi_driver {
142 int (*probe)(struct spi_device *spi); 169 int (*probe)(struct spi_device *spi);
143 int (*remove)(struct spi_device *spi); 170 int (*remove)(struct spi_device *spi);
@@ -667,7 +694,37 @@ static inline ssize_t spi_w8r16(struct spi_device *spi, u8 cmd)
667 * parport adapters, or microcontrollers acting as USB-to-SPI bridges. 694 * parport adapters, or microcontrollers acting as USB-to-SPI bridges.
668 */ 695 */
669 696
670/* board-specific information about each SPI device */ 697/**
698 * struct spi_board_info - board-specific template for a SPI device
699 * @modalias: Initializes spi_device.modalias; identifies the driver.
700 * @platform_data: Initializes spi_device.platform_data; the particular
701 * data stored there is driver-specific.
702 * @controller_data: Initializes spi_device.controller_data; some
703 * controllers need hints about hardware setup, e.g. for DMA.
704 * @irq: Initializes spi_device.irq; depends on how the board is wired.
705 * @max_speed_hz: Initializes spi_device.max_speed_hz; based on limits
706 * from the chip datasheet and board-specific signal quality issues.
707 * @bus_num: Identifies which spi_master parents the spi_device; unused
708 * by spi_new_device(), and otherwise depends on board wiring.
709 * @chip_select: Initializes spi_device.chip_select; depends on how
710 * the board is wired.
711 * @mode: Initializes spi_device.mode; based on the chip datasheet, board
712 * wiring (some devices support both 3WIRE and standard modes), and
713 * possibly presence of an inverter in the chipselect path.
714 *
715 * When adding new SPI devices to the device tree, these structures serve
716 * as a partial device template. They hold information which can't always
717 * be determined by drivers. Information that probe() can establish (such
718 * as the default transfer wordsize) is not included here.
719 *
720 * These structures are used in two places. Their primary role is to
721 * be stored in tables of board-specific device descriptors, which are
722 * declared early in board initialization and then used (much later) to
723 * populate a controller's device tree after the that controller's driver
724 * initializes. A secondary (and atypical) role is as a parameter to
725 * spi_new_device() call, which happens after those controller drivers
726 * are active in some dynamic board configuration models.
727 */
671struct spi_board_info { 728struct spi_board_info {
672 /* the device name and module name are coupled, like platform_bus; 729 /* the device name and module name are coupled, like platform_bus;
673 * "modalias" is normally the driver name. 730 * "modalias" is normally the driver name.
diff --git a/include/linux/spi/spidev.h b/include/linux/spi/spidev.h
index 7d700be57490..c93ef9d42a01 100644
--- a/include/linux/spi/spidev.h
+++ b/include/linux/spi/spidev.h
@@ -35,6 +35,10 @@
35#define SPI_MODE_2 (SPI_CPOL|0) 35#define SPI_MODE_2 (SPI_CPOL|0)
36#define SPI_MODE_3 (SPI_CPOL|SPI_CPHA) 36#define SPI_MODE_3 (SPI_CPOL|SPI_CPHA)
37 37
38#define SPI_CS_HIGH 0x04
39#define SPI_LSB_FIRST 0x08
40#define SPI_3WIRE 0x10
41#define SPI_LOOP 0x20
38 42
39/*---------------------------------------------------------------------------*/ 43/*---------------------------------------------------------------------------*/
40 44