diff options
Diffstat (limited to 'arch/arm/mach-pxa/poodle.c')
-rw-r--r-- | arch/arm/mach-pxa/poodle.c | 90 |
1 files changed, 42 insertions, 48 deletions
diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c index 461af1c582bb..d39cbf3e9d28 100644 --- a/arch/arm/mach-pxa/poodle.c +++ b/arch/arm/mach-pxa/poodle.c | |||
@@ -21,6 +21,8 @@ | |||
21 | #include <linux/pm.h> | 21 | #include <linux/pm.h> |
22 | #include <linux/delay.h> | 22 | #include <linux/delay.h> |
23 | #include <linux/gpio.h> | 23 | #include <linux/gpio.h> |
24 | #include <linux/spi/spi.h> | ||
25 | #include <linux/spi/ads7846.h> | ||
24 | 26 | ||
25 | #include <mach/hardware.h> | 27 | #include <mach/hardware.h> |
26 | #include <asm/mach-types.h> | 28 | #include <asm/mach-types.h> |
@@ -43,6 +45,7 @@ | |||
43 | #include <mach/pxafb.h> | 45 | #include <mach/pxafb.h> |
44 | #include <mach/sharpsl.h> | 46 | #include <mach/sharpsl.h> |
45 | #include <mach/ssp.h> | 47 | #include <mach/ssp.h> |
48 | #include <mach/pxa2xx_spi.h> | ||
46 | 49 | ||
47 | #include <asm/hardware/scoop.h> | 50 | #include <asm/hardware/scoop.h> |
48 | #include <asm/hardware/locomo.h> | 51 | #include <asm/hardware/locomo.h> |
@@ -63,9 +66,9 @@ static unsigned long poodle_pin_config[] __initdata = { | |||
63 | 66 | ||
64 | /* SSP1 */ | 67 | /* SSP1 */ |
65 | GPIO23_SSP1_SCLK, | 68 | GPIO23_SSP1_SCLK, |
66 | GPIO24_SSP1_SFRM, | ||
67 | GPIO25_SSP1_TXD, | 69 | GPIO25_SSP1_TXD, |
68 | GPIO26_SSP1_RXD, | 70 | GPIO26_SSP1_RXD, |
71 | GPIO24_GPIO, /* POODLE_GPIO_TP_CS - SFRM as chip select */ | ||
69 | 72 | ||
70 | /* I2S */ | 73 | /* I2S */ |
71 | GPIO28_I2S_BITCLK_OUT, | 74 | GPIO28_I2S_BITCLK_OUT, |
@@ -197,62 +200,55 @@ struct platform_device poodle_locomo_device = { | |||
197 | 200 | ||
198 | EXPORT_SYMBOL(poodle_locomo_device); | 201 | EXPORT_SYMBOL(poodle_locomo_device); |
199 | 202 | ||
200 | /* | 203 | #if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MODULE) |
201 | * Poodle SSP Device | 204 | static struct pxa2xx_spi_master poodle_spi_info = { |
202 | */ | 205 | .num_chipselect = 1, |
203 | |||
204 | struct platform_device poodle_ssp_device = { | ||
205 | .name = "corgi-ssp", | ||
206 | .id = -1, | ||
207 | }; | 206 | }; |
208 | 207 | ||
209 | struct corgissp_machinfo poodle_ssp_machinfo = { | 208 | static struct ads7846_platform_data poodle_ads7846_info = { |
210 | .port = 1, | 209 | .model = 7846, |
211 | .cs_lcdcon = -1, | 210 | .vref_delay_usecs = 100, |
212 | .cs_ads7846 = -1, | 211 | .x_plate_ohms = 419, |
213 | .cs_max1111 = -1, | 212 | .y_plate_ohms = 486, |
214 | .clk_lcdcon = 2, | 213 | .gpio_pendown = POODLE_GPIO_TP_INT, |
215 | .clk_ads7846 = 36, | ||
216 | .clk_max1111 = 2, | ||
217 | }; | 214 | }; |
218 | 215 | ||
219 | 216 | static void ads7846_cs(u32 command) | |
220 | /* | ||
221 | * Poodle Touch Screen Device | ||
222 | */ | ||
223 | static struct resource poodlets_resources[] = { | ||
224 | [0] = { | ||
225 | .start = POODLE_IRQ_GPIO_TP_INT, | ||
226 | .end = POODLE_IRQ_GPIO_TP_INT, | ||
227 | .flags = IORESOURCE_IRQ, | ||
228 | }, | ||
229 | }; | ||
230 | |||
231 | static unsigned long poodle_get_hsync_invperiod(void) | ||
232 | { | 217 | { |
233 | return 0; | 218 | gpio_set_value(POODLE_GPIO_TP_CS, !(command == PXA2XX_CS_ASSERT)); |
234 | } | 219 | } |
235 | 220 | ||
236 | static void poodle_null_hsync(void) | 221 | static struct pxa2xx_spi_chip poodle_ads7846_chip = { |
237 | { | 222 | .cs_control = ads7846_cs, |
238 | } | ||
239 | |||
240 | static struct corgits_machinfo poodle_ts_machinfo = { | ||
241 | .get_hsync_invperiod = poodle_get_hsync_invperiod, | ||
242 | .put_hsync = poodle_null_hsync, | ||
243 | .wait_hsync = poodle_null_hsync, | ||
244 | }; | 223 | }; |
245 | 224 | ||
246 | static struct platform_device poodle_ts_device = { | 225 | static struct spi_board_info poodle_spi_devices[] = { |
247 | .name = "corgi-ts", | 226 | { |
248 | .dev = { | 227 | .modalias = "ads7846", |
249 | .platform_data = &poodle_ts_machinfo, | 228 | .max_speed_hz = 10000, |
229 | .bus_num = 1, | ||
230 | .platform_data = &poodle_ads7846_info, | ||
231 | .controller_data= &poodle_ads7846_chip, | ||
232 | .irq = gpio_to_irq(POODLE_GPIO_TP_INT), | ||
250 | }, | 233 | }, |
251 | .id = -1, | ||
252 | .num_resources = ARRAY_SIZE(poodlets_resources), | ||
253 | .resource = poodlets_resources, | ||
254 | }; | 234 | }; |
255 | 235 | ||
236 | static void __init poodle_init_spi(void) | ||
237 | { | ||
238 | int err; | ||
239 | |||
240 | err = gpio_request(POODLE_GPIO_TP_CS, "ADS7846_CS"); | ||
241 | if (err) | ||
242 | return; | ||
243 | |||
244 | gpio_direction_output(POODLE_GPIO_TP_CS, 1); | ||
245 | |||
246 | pxa2xx_set_spi_info(1, &poodle_spi_info); | ||
247 | spi_register_board_info(ARRAY_AND_SIZE(poodle_spi_devices)); | ||
248 | } | ||
249 | #else | ||
250 | static inline void poodle_init_spi(void) {} | ||
251 | #endif | ||
256 | 252 | ||
257 | /* | 253 | /* |
258 | * MMC/SD Device | 254 | * MMC/SD Device |
@@ -419,8 +415,6 @@ static struct pxafb_mach_info poodle_fb_info = { | |||
419 | static struct platform_device *devices[] __initdata = { | 415 | static struct platform_device *devices[] __initdata = { |
420 | &poodle_locomo_device, | 416 | &poodle_locomo_device, |
421 | &poodle_scoop_device, | 417 | &poodle_scoop_device, |
422 | &poodle_ssp_device, | ||
423 | &poodle_ts_device, | ||
424 | }; | 418 | }; |
425 | 419 | ||
426 | static void poodle_poweroff(void) | 420 | static void poodle_poweroff(void) |
@@ -445,7 +439,6 @@ static void __init poodle_init(void) | |||
445 | pxa2xx_mfp_config(ARRAY_AND_SIZE(poodle_pin_config)); | 439 | pxa2xx_mfp_config(ARRAY_AND_SIZE(poodle_pin_config)); |
446 | 440 | ||
447 | platform_scoop_config = &poodle_pcmcia_config; | 441 | platform_scoop_config = &poodle_pcmcia_config; |
448 | corgi_ssp_set_machinfo(&poodle_ssp_machinfo); | ||
449 | 442 | ||
450 | ret = platform_add_devices(devices, ARRAY_SIZE(devices)); | 443 | ret = platform_add_devices(devices, ARRAY_SIZE(devices)); |
451 | if (ret) | 444 | if (ret) |
@@ -457,6 +450,7 @@ static void __init poodle_init(void) | |||
457 | pxa_set_mci_info(&poodle_mci_platform_data); | 450 | pxa_set_mci_info(&poodle_mci_platform_data); |
458 | pxa_set_ficp_info(&poodle_ficp_platform_data); | 451 | pxa_set_ficp_info(&poodle_ficp_platform_data); |
459 | pxa_set_i2c_info(NULL); | 452 | pxa_set_i2c_info(NULL); |
453 | poodle_init_spi(); | ||
460 | } | 454 | } |
461 | 455 | ||
462 | static void __init fixup_poodle(struct machine_desc *desc, | 456 | static void __init fixup_poodle(struct machine_desc *desc, |