diff options
author | Cyril Chemparathy <cyril@ti.com> | 2011-01-18 14:21:41 -0500 |
---|---|---|
committer | Kevin Hilman <khilman@ti.com> | 2011-03-15 11:17:22 -0400 |
commit | f6e5306ecf269cac52cb06a2f356431f63640595 (patch) | |
tree | e22c54c7ecf7a3e034dbeb7db8084a6327b5f8fe /arch/arm/mach-davinci/board-tnetv107x-evm.c | |
parent | 08e0e1d5aec4d02153654eb7e54ba621b71d9c5a (diff) |
davinci: add spi devices on tnetv107x evm
This patch adds definitions for spi devices on the tnetv107x evm platform.
Signed-off-by: Cyril Chemparathy <cyril@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Kevin Hilman <khilman@ti.com>
Diffstat (limited to 'arch/arm/mach-davinci/board-tnetv107x-evm.c')
-rw-r--r-- | arch/arm/mach-davinci/board-tnetv107x-evm.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/arch/arm/mach-davinci/board-tnetv107x-evm.c b/arch/arm/mach-davinci/board-tnetv107x-evm.c index ef526b184eaf..1a656e882262 100644 --- a/arch/arm/mach-davinci/board-tnetv107x-evm.c +++ b/arch/arm/mach-davinci/board-tnetv107x-evm.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/mtd/partitions.h> | 25 | #include <linux/mtd/partitions.h> |
26 | #include <linux/input.h> | 26 | #include <linux/input.h> |
27 | #include <linux/input/matrix_keypad.h> | 27 | #include <linux/input/matrix_keypad.h> |
28 | #include <linux/spi/spi.h> | ||
28 | 29 | ||
29 | #include <asm/mach/arch.h> | 30 | #include <asm/mach/arch.h> |
30 | #include <asm/mach-types.h> | 31 | #include <asm/mach-types.h> |
@@ -37,6 +38,7 @@ | |||
37 | 38 | ||
38 | #define EVM_MMC_WP_GPIO 21 | 39 | #define EVM_MMC_WP_GPIO 21 |
39 | #define EVM_MMC_CD_GPIO 24 | 40 | #define EVM_MMC_CD_GPIO 24 |
41 | #define EVM_SPI_CS_GPIO 54 | ||
40 | 42 | ||
41 | static int initialize_gpio(int gpio, char *desc) | 43 | static int initialize_gpio(int gpio, char *desc) |
42 | { | 44 | { |
@@ -202,9 +204,45 @@ static struct matrix_keypad_platform_data keypad_config = { | |||
202 | .no_autorepeat = 0, | 204 | .no_autorepeat = 0, |
203 | }; | 205 | }; |
204 | 206 | ||
207 | static void spi_select_device(int cs) | ||
208 | { | ||
209 | static int gpio; | ||
210 | |||
211 | if (!gpio) { | ||
212 | int ret; | ||
213 | ret = gpio_request(EVM_SPI_CS_GPIO, "spi chipsel"); | ||
214 | if (ret < 0) { | ||
215 | pr_err("cannot open spi chipsel gpio\n"); | ||
216 | gpio = -ENOSYS; | ||
217 | return; | ||
218 | } else { | ||
219 | gpio = EVM_SPI_CS_GPIO; | ||
220 | gpio_direction_output(gpio, 0); | ||
221 | } | ||
222 | } | ||
223 | |||
224 | if (gpio < 0) | ||
225 | return; | ||
226 | |||
227 | return gpio_set_value(gpio, cs ? 1 : 0); | ||
228 | } | ||
229 | |||
230 | static struct ti_ssp_spi_data spi_master_data = { | ||
231 | .num_cs = 2, | ||
232 | .select = spi_select_device, | ||
233 | .iosel = SSP_PIN_SEL(0, SSP_CLOCK) | SSP_PIN_SEL(1, SSP_DATA) | | ||
234 | SSP_PIN_SEL(2, SSP_CHIPSEL) | SSP_PIN_SEL(3, SSP_IN) | | ||
235 | SSP_INPUT_SEL(3), | ||
236 | }; | ||
237 | |||
205 | static struct ti_ssp_data ssp_config = { | 238 | static struct ti_ssp_data ssp_config = { |
206 | .out_clock = 250 * 1000, | 239 | .out_clock = 250 * 1000, |
207 | .dev_data = { | 240 | .dev_data = { |
241 | [1] = { | ||
242 | .dev_name = "ti-ssp-spi", | ||
243 | .pdata = &spi_master_data, | ||
244 | .pdata_size = sizeof(spi_master_data), | ||
245 | }, | ||
208 | }, | 246 | }, |
209 | }; | 247 | }; |
210 | 248 | ||
@@ -216,6 +254,9 @@ static struct tnetv107x_device_info evm_device_info __initconst = { | |||
216 | .ssp_config = &ssp_config, | 254 | .ssp_config = &ssp_config, |
217 | }; | 255 | }; |
218 | 256 | ||
257 | static struct spi_board_info spi_info[] __initconst = { | ||
258 | }; | ||
259 | |||
219 | static __init void tnetv107x_evm_board_init(void) | 260 | static __init void tnetv107x_evm_board_init(void) |
220 | { | 261 | { |
221 | davinci_cfg_reg_list(sdio1_pins); | 262 | davinci_cfg_reg_list(sdio1_pins); |
@@ -223,6 +264,8 @@ static __init void tnetv107x_evm_board_init(void) | |||
223 | davinci_cfg_reg_list(ssp_pins); | 264 | davinci_cfg_reg_list(ssp_pins); |
224 | 265 | ||
225 | tnetv107x_devices_init(&evm_device_info); | 266 | tnetv107x_devices_init(&evm_device_info); |
267 | |||
268 | spi_register_board_info(spi_info, ARRAY_SIZE(spi_info)); | ||
226 | } | 269 | } |
227 | 270 | ||
228 | #ifdef CONFIG_SERIAL_8250_CONSOLE | 271 | #ifdef CONFIG_SERIAL_8250_CONSOLE |