diff options
Diffstat (limited to 'include/linux/spi')
-rw-r--r-- | include/linux/spi/ds1305.h | 35 | ||||
-rw-r--r-- | include/linux/spi/max7301.h | 9 | ||||
-rw-r--r-- | include/linux/spi/mcp23s08.h | 25 | ||||
-rw-r--r-- | include/linux/spi/mmc_spi.h | 11 | ||||
-rw-r--r-- | include/linux/spi/spi.h | 16 |
5 files changed, 85 insertions, 11 deletions
diff --git a/include/linux/spi/ds1305.h b/include/linux/spi/ds1305.h new file mode 100644 index 000000000000..287ec830eab7 --- /dev/null +++ b/include/linux/spi/ds1305.h | |||
@@ -0,0 +1,35 @@ | |||
1 | #ifndef __LINUX_SPI_DS1305_H | ||
2 | #define __LINUX_SPI_DS1305_H | ||
3 | |||
4 | /* | ||
5 | * One-time configuration for ds1305 and ds1306 RTC chips. | ||
6 | * | ||
7 | * Put a pointer to this in spi_board_info.platform_data if you want to | ||
8 | * be sure that Linux (re)initializes this as needed ... after losing | ||
9 | * backup power, and potentially on the first boot. | ||
10 | */ | ||
11 | struct ds1305_platform_data { | ||
12 | |||
13 | /* Trickle charge configuration: it's OK to leave out the MAGIC | ||
14 | * bitmask; mask in either DS1 or DS2, and then one of 2K/4k/8K. | ||
15 | */ | ||
16 | #define DS1305_TRICKLE_MAGIC 0xa0 | ||
17 | #define DS1305_TRICKLE_DS2 0x08 /* two diodes */ | ||
18 | #define DS1305_TRICKLE_DS1 0x04 /* one diode */ | ||
19 | #define DS1305_TRICKLE_2K 0x01 /* 2 KOhm resistance */ | ||
20 | #define DS1305_TRICKLE_4K 0x02 /* 4 KOhm resistance */ | ||
21 | #define DS1305_TRICKLE_8K 0x03 /* 8 KOhm resistance */ | ||
22 | u8 trickle; | ||
23 | |||
24 | /* set only on ds1306 parts */ | ||
25 | bool is_ds1306; | ||
26 | |||
27 | /* ds1306 only: enable 1 Hz output */ | ||
28 | bool en_1hz; | ||
29 | |||
30 | /* REVISIT: the driver currently expects nINT0 to be wired | ||
31 | * as the alarm IRQ. ALM1 may also need to be set up ... | ||
32 | */ | ||
33 | }; | ||
34 | |||
35 | #endif /* __LINUX_SPI_DS1305_H */ | ||
diff --git a/include/linux/spi/max7301.h b/include/linux/spi/max7301.h new file mode 100644 index 000000000000..6dfd83f19b4b --- /dev/null +++ b/include/linux/spi/max7301.h | |||
@@ -0,0 +1,9 @@ | |||
1 | #ifndef LINUX_SPI_MAX7301_H | ||
2 | #define LINUX_SPI_MAX7301_H | ||
3 | |||
4 | struct max7301_platform_data { | ||
5 | /* number assigned to the first GPIO */ | ||
6 | unsigned base; | ||
7 | }; | ||
8 | |||
9 | #endif | ||
diff --git a/include/linux/spi/mcp23s08.h b/include/linux/spi/mcp23s08.h index 835ddf47d45c..22ef107d7704 100644 --- a/include/linux/spi/mcp23s08.h +++ b/include/linux/spi/mcp23s08.h | |||
@@ -1,18 +1,25 @@ | |||
1 | 1 | ||
2 | /* FIXME driver should be able to handle all four slaves that | 2 | /* FIXME driver should be able to handle IRQs... */ |
3 | * can be hooked up to each chipselect, as well as IRQs... | 3 | |
4 | */ | 4 | struct mcp23s08_chip_info { |
5 | bool is_present; /* true iff populated */ | ||
6 | u8 pullups; /* BIT(x) means enable pullup x */ | ||
7 | }; | ||
5 | 8 | ||
6 | struct mcp23s08_platform_data { | 9 | struct mcp23s08_platform_data { |
7 | /* four slaves can share one SPI chipselect */ | 10 | /* Four slaves (numbered 0..3) can share one SPI chipselect, and |
8 | u8 slave; | 11 | * will provide 8..32 GPIOs using 1..4 gpio_chip instances. |
12 | */ | ||
13 | struct mcp23s08_chip_info chip[4]; | ||
9 | 14 | ||
10 | /* number assigned to the first GPIO */ | 15 | /* "base" is the number of the first GPIO. Dynamic assignment is |
16 | * not currently supported, and even if there are gaps in chip | ||
17 | * addressing the GPIO numbers are sequential .. so for example | ||
18 | * if only slaves 0 and 3 are present, their GPIOs range from | ||
19 | * base to base+15. | ||
20 | */ | ||
11 | unsigned base; | 21 | unsigned base; |
12 | 22 | ||
13 | /* pins with pullups */ | ||
14 | u8 pullups; | ||
15 | |||
16 | void *context; /* param to setup/teardown */ | 23 | void *context; /* param to setup/teardown */ |
17 | 24 | ||
18 | int (*setup)(struct spi_device *spi, | 25 | int (*setup)(struct spi_device *spi, |
diff --git a/include/linux/spi/mmc_spi.h b/include/linux/spi/mmc_spi.h index e9bbe3ebd721..a3626aedaec9 100644 --- a/include/linux/spi/mmc_spi.h +++ b/include/linux/spi/mmc_spi.h | |||
@@ -1,6 +1,8 @@ | |||
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/interrupt.h> | ||
5 | |||
4 | struct device; | 6 | struct device; |
5 | struct mmc_host; | 7 | struct mmc_host; |
6 | 8 | ||
@@ -21,6 +23,15 @@ struct mmc_spi_platform_data { | |||
21 | /* sense switch on sd cards */ | 23 | /* sense switch on sd cards */ |
22 | int (*get_ro)(struct device *); | 24 | int (*get_ro)(struct device *); |
23 | 25 | ||
26 | /* | ||
27 | * If board does not use CD interrupts, driver can optimize polling | ||
28 | * using this function. | ||
29 | */ | ||
30 | int (*get_cd)(struct device *); | ||
31 | |||
32 | /* Capabilities to pass into mmc core (e.g. MMC_CAP_NEEDS_POLL). */ | ||
33 | unsigned long caps; | ||
34 | |||
24 | /* how long to debounce card detect, in msecs */ | 35 | /* how long to debounce card detect, in msecs */ |
25 | u16 detect_delay; | 36 | u16 detect_delay; |
26 | 37 | ||
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 387e428f1cdf..4be01bb44377 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h | |||
@@ -82,7 +82,7 @@ struct spi_device { | |||
82 | int irq; | 82 | int irq; |
83 | void *controller_state; | 83 | void *controller_state; |
84 | void *controller_data; | 84 | void *controller_data; |
85 | const char *modalias; | 85 | char modalias[32]; |
86 | 86 | ||
87 | /* | 87 | /* |
88 | * likely need more hooks for more protocol options affecting how | 88 | * likely need more hooks for more protocol options affecting how |
@@ -733,7 +733,7 @@ struct spi_board_info { | |||
733 | * controller_data goes to spi_device.controller_data, | 733 | * controller_data goes to spi_device.controller_data, |
734 | * irq is copied too | 734 | * irq is copied too |
735 | */ | 735 | */ |
736 | char modalias[KOBJ_NAME_LEN]; | 736 | char modalias[32]; |
737 | const void *platform_data; | 737 | const void *platform_data; |
738 | void *controller_data; | 738 | void *controller_data; |
739 | int irq; | 739 | int irq; |
@@ -778,8 +778,20 @@ spi_register_board_info(struct spi_board_info const *info, unsigned n) | |||
778 | * use spi_new_device() to describe each device. You can also call | 778 | * use spi_new_device() to describe each device. You can also call |
779 | * spi_unregister_device() to start making that device vanish, but | 779 | * spi_unregister_device() to start making that device vanish, but |
780 | * normally that would be handled by spi_unregister_master(). | 780 | * normally that would be handled by spi_unregister_master(). |
781 | * | ||
782 | * You can also use spi_alloc_device() and spi_add_device() to use a two | ||
783 | * stage registration sequence for each spi_device. This gives the caller | ||
784 | * some more control over the spi_device structure before it is registered, | ||
785 | * but requires that caller to initialize fields that would otherwise | ||
786 | * be defined using the board info. | ||
781 | */ | 787 | */ |
782 | extern struct spi_device * | 788 | extern struct spi_device * |
789 | spi_alloc_device(struct spi_master *master); | ||
790 | |||
791 | extern int | ||
792 | spi_add_device(struct spi_device *spi); | ||
793 | |||
794 | extern struct spi_device * | ||
783 | spi_new_device(struct spi_master *, struct spi_board_info *); | 795 | spi_new_device(struct spi_master *, struct spi_board_info *); |
784 | 796 | ||
785 | static inline void | 797 | static inline void |