diff options
Diffstat (limited to 'include/linux/spi')
-rw-r--r-- | include/linux/spi/mmc_spi.h | 15 | ||||
-rw-r--r-- | include/linux/spi/spi.h | 6 | ||||
-rw-r--r-- | include/linux/spi/spi_gpio.h | 60 | ||||
-rw-r--r-- | include/linux/spi/tdo24m.h | 13 |
4 files changed, 91 insertions, 3 deletions
diff --git a/include/linux/spi/mmc_spi.h b/include/linux/spi/mmc_spi.h index a3626aedaec9..0f4eb165f254 100644 --- a/include/linux/spi/mmc_spi.h +++ b/include/linux/spi/mmc_spi.h | |||
@@ -1,9 +1,10 @@ | |||
1 | #ifndef __LINUX_SPI_MMC_SPI_H | 1 | #ifndef __LINUX_SPI_MMC_SPI_H |
2 | #define __LINUX_SPI_MMC_SPI_H | 2 | #define __LINUX_SPI_MMC_SPI_H |
3 | 3 | ||
4 | #include <linux/device.h> | ||
5 | #include <linux/spi/spi.h> | ||
4 | #include <linux/interrupt.h> | 6 | #include <linux/interrupt.h> |
5 | 7 | ||
6 | struct device; | ||
7 | struct mmc_host; | 8 | struct mmc_host; |
8 | 9 | ||
9 | /* Put this in platform_data of a device being used to manage an MMC/SD | 10 | /* Put this in platform_data of a device being used to manage an MMC/SD |
@@ -41,4 +42,16 @@ struct mmc_spi_platform_data { | |||
41 | void (*setpower)(struct device *, unsigned int maskval); | 42 | void (*setpower)(struct device *, unsigned int maskval); |
42 | }; | 43 | }; |
43 | 44 | ||
45 | #ifdef CONFIG_OF | ||
46 | extern struct mmc_spi_platform_data *mmc_spi_get_pdata(struct spi_device *spi); | ||
47 | extern void mmc_spi_put_pdata(struct spi_device *spi); | ||
48 | #else | ||
49 | static inline struct mmc_spi_platform_data * | ||
50 | mmc_spi_get_pdata(struct spi_device *spi) | ||
51 | { | ||
52 | return spi->dev.platform_data; | ||
53 | } | ||
54 | static inline void mmc_spi_put_pdata(struct spi_device *spi) {} | ||
55 | #endif /* CONFIG_OF */ | ||
56 | |||
44 | #endif /* __LINUX_SPI_MMC_SPI_H */ | 57 | #endif /* __LINUX_SPI_MMC_SPI_H */ |
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 4be01bb44377..68bb1c501d0d 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h | |||
@@ -19,6 +19,8 @@ | |||
19 | #ifndef __LINUX_SPI_H | 19 | #ifndef __LINUX_SPI_H |
20 | #define __LINUX_SPI_H | 20 | #define __LINUX_SPI_H |
21 | 21 | ||
22 | #include <linux/device.h> | ||
23 | |||
22 | /* | 24 | /* |
23 | * INTERFACES between SPI master-side drivers and SPI infrastructure. | 25 | * INTERFACES between SPI master-side drivers and SPI infrastructure. |
24 | * (There's no SPI slave support for Linux yet...) | 26 | * (There's no SPI slave support for Linux yet...) |
@@ -325,9 +327,9 @@ extern struct spi_master *spi_busnum_to_master(u16 busnum); | |||
325 | * @tx_dma: DMA address of tx_buf, if @spi_message.is_dma_mapped | 327 | * @tx_dma: DMA address of tx_buf, if @spi_message.is_dma_mapped |
326 | * @rx_dma: DMA address of rx_buf, if @spi_message.is_dma_mapped | 328 | * @rx_dma: DMA address of rx_buf, if @spi_message.is_dma_mapped |
327 | * @len: size of rx and tx buffers (in bytes) | 329 | * @len: size of rx and tx buffers (in bytes) |
328 | * @speed_hz: Select a speed other then the device default for this | 330 | * @speed_hz: Select a speed other than the device default for this |
329 | * transfer. If 0 the default (from @spi_device) is used. | 331 | * transfer. If 0 the default (from @spi_device) is used. |
330 | * @bits_per_word: select a bits_per_word other then the device default | 332 | * @bits_per_word: select a bits_per_word other than the device default |
331 | * for this transfer. If 0 the default (from @spi_device) is used. | 333 | * for this transfer. If 0 the default (from @spi_device) is used. |
332 | * @cs_change: affects chipselect after this transfer completes | 334 | * @cs_change: affects chipselect after this transfer completes |
333 | * @delay_usecs: microseconds to delay after this transfer before | 335 | * @delay_usecs: microseconds to delay after this transfer before |
diff --git a/include/linux/spi/spi_gpio.h b/include/linux/spi/spi_gpio.h new file mode 100644 index 000000000000..0f01a0f1f40c --- /dev/null +++ b/include/linux/spi/spi_gpio.h | |||
@@ -0,0 +1,60 @@ | |||
1 | #ifndef __LINUX_SPI_GPIO_H | ||
2 | #define __LINUX_SPI_GPIO_H | ||
3 | |||
4 | /* | ||
5 | * For each bitbanged SPI bus, set up a platform_device node with: | ||
6 | * - name "spi_gpio" | ||
7 | * - id the same as the SPI bus number it implements | ||
8 | * - dev.platform data pointing to a struct spi_gpio_platform_data | ||
9 | * | ||
10 | * Or, see the driver code for information about speedups that are | ||
11 | * possible on platforms that support inlined access for GPIOs (no | ||
12 | * spi_gpio_platform_data is used). | ||
13 | * | ||
14 | * Use spi_board_info with these busses in the usual way, being sure | ||
15 | * that the controller_data being the GPIO used for each device's | ||
16 | * chipselect: | ||
17 | * | ||
18 | * static struct spi_board_info ... [] = { | ||
19 | * ... | ||
20 | * // this slave uses GPIO 42 for its chipselect | ||
21 | * .controller_data = (void *) 42, | ||
22 | * ... | ||
23 | * // this one uses GPIO 86 for its chipselect | ||
24 | * .controller_data = (void *) 86, | ||
25 | * ... | ||
26 | * }; | ||
27 | * | ||
28 | * If the bitbanged bus is later switched to a "native" controller, | ||
29 | * that platform_device and controller_data should be removed. | ||
30 | */ | ||
31 | |||
32 | /** | ||
33 | * struct spi_gpio_platform_data - parameter for bitbanged SPI master | ||
34 | * @sck: number of the GPIO used for clock output | ||
35 | * @mosi: number of the GPIO used for Master Output, Slave In (MOSI) data | ||
36 | * @miso: number of the GPIO used for Master Input, Slave Output (MISO) data | ||
37 | * @num_chipselect: how many slaves to allow | ||
38 | * | ||
39 | * All GPIO signals used with the SPI bus managed through this driver | ||
40 | * (chipselects, MOSI, MISO, SCK) must be configured as GPIOs, instead | ||
41 | * of some alternate function. | ||
42 | * | ||
43 | * It can be convenient to use this driver with pins that have alternate | ||
44 | * functions associated with a "native" SPI controller if a driver for that | ||
45 | * controller is not available, or is missing important functionality. | ||
46 | * | ||
47 | * On platforms which can do so, configure MISO with a weak pullup unless | ||
48 | * there's an external pullup on that signal. That saves power by avoiding | ||
49 | * floating signals. (A weak pulldown would save power too, but many | ||
50 | * drivers expect to see all-ones data as the no slave "response".) | ||
51 | */ | ||
52 | struct spi_gpio_platform_data { | ||
53 | unsigned sck; | ||
54 | unsigned mosi; | ||
55 | unsigned miso; | ||
56 | |||
57 | u16 num_chipselect; | ||
58 | }; | ||
59 | |||
60 | #endif /* __LINUX_SPI_GPIO_H */ | ||
diff --git a/include/linux/spi/tdo24m.h b/include/linux/spi/tdo24m.h new file mode 100644 index 000000000000..7572d4e1fe76 --- /dev/null +++ b/include/linux/spi/tdo24m.h | |||
@@ -0,0 +1,13 @@ | |||
1 | #ifndef __TDO24M_H__ | ||
2 | #define __TDO24M_H__ | ||
3 | |||
4 | enum tdo24m_model { | ||
5 | TDO24M, | ||
6 | TDO35S, | ||
7 | }; | ||
8 | |||
9 | struct tdo24m_platform_data { | ||
10 | enum tdo24m_model model; | ||
11 | }; | ||
12 | |||
13 | #endif /* __TDO24M_H__ */ | ||