diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2008-10-09 16:33:02 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-10-09 16:33:02 -0400 |
commit | 3f30a09a612bac2b531a206c2a58a292dd7ff182 (patch) | |
tree | 62741c2f78aeb3009c66dbcf014ebff2e034e597 /arch/arm/mach-pxa/corgi.c | |
parent | 9e165acf1b9e37af7c0fa39399b43d0bd8600039 (diff) | |
parent | fda50a1c49ad7483eaa29a268d560422c413933f (diff) |
Merge branch 'pxa-all' into devel
Conflicts:
arch/arm/mach-pxa/Kconfig
arch/arm/mach-pxa/corgi.c
arch/arm/mach-pxa/include/mach/hardware.h
arch/arm/mach-pxa/spitz.c
Diffstat (limited to 'arch/arm/mach-pxa/corgi.c')
-rw-r--r-- | arch/arm/mach-pxa/corgi.c | 476 |
1 files changed, 262 insertions, 214 deletions
diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c index 4cbf08bd546b..65558d6aa220 100644 --- a/arch/arm/mach-pxa/corgi.c +++ b/arch/arm/mach-pxa/corgi.c | |||
@@ -20,8 +20,12 @@ | |||
20 | #include <linux/interrupt.h> | 20 | #include <linux/interrupt.h> |
21 | #include <linux/mmc/host.h> | 21 | #include <linux/mmc/host.h> |
22 | #include <linux/pm.h> | 22 | #include <linux/pm.h> |
23 | #include <linux/gpio.h> | ||
23 | #include <linux/backlight.h> | 24 | #include <linux/backlight.h> |
24 | #include <linux/io.h> | 25 | #include <linux/io.h> |
26 | #include <linux/spi/spi.h> | ||
27 | #include <linux/spi/ads7846.h> | ||
28 | #include <linux/spi/corgi_lcd.h> | ||
25 | #include <video/w100fb.h> | 29 | #include <video/w100fb.h> |
26 | 30 | ||
27 | #include <asm/setup.h> | 31 | #include <asm/setup.h> |
@@ -37,11 +41,12 @@ | |||
37 | 41 | ||
38 | #include <mach/pxa-regs.h> | 42 | #include <mach/pxa-regs.h> |
39 | #include <mach/pxa2xx-regs.h> | 43 | #include <mach/pxa2xx-regs.h> |
40 | #include <mach/pxa2xx-gpio.h> | 44 | #include <mach/mfp-pxa25x.h> |
41 | #include <mach/i2c.h> | 45 | #include <mach/i2c.h> |
42 | #include <mach/irda.h> | 46 | #include <mach/irda.h> |
43 | #include <mach/mmc.h> | 47 | #include <mach/mmc.h> |
44 | #include <mach/udc.h> | 48 | #include <mach/udc.h> |
49 | #include <mach/pxa2xx_spi.h> | ||
45 | #include <mach/corgi.h> | 50 | #include <mach/corgi.h> |
46 | #include <mach/sharpsl.h> | 51 | #include <mach/sharpsl.h> |
47 | 52 | ||
@@ -52,6 +57,61 @@ | |||
52 | #include "devices.h" | 57 | #include "devices.h" |
53 | #include "sharpsl.h" | 58 | #include "sharpsl.h" |
54 | 59 | ||
60 | static unsigned long corgi_pin_config[] __initdata = { | ||
61 | /* Static Memory I/O */ | ||
62 | GPIO78_nCS_2, /* w100fb */ | ||
63 | GPIO80_nCS_4, /* scoop */ | ||
64 | |||
65 | /* SSP1 */ | ||
66 | GPIO23_SSP1_SCLK, | ||
67 | GPIO25_SSP1_TXD, | ||
68 | GPIO26_SSP1_RXD, | ||
69 | GPIO24_GPIO, /* CORGI_GPIO_ADS7846_CS - SFRM as chip select */ | ||
70 | |||
71 | /* I2S */ | ||
72 | GPIO28_I2S_BITCLK_OUT, | ||
73 | GPIO29_I2S_SDATA_IN, | ||
74 | GPIO30_I2S_SDATA_OUT, | ||
75 | GPIO31_I2S_SYNC, | ||
76 | GPIO32_I2S_SYSCLK, | ||
77 | |||
78 | /* Infra-Red */ | ||
79 | GPIO47_FICP_TXD, | ||
80 | GPIO46_FICP_RXD, | ||
81 | |||
82 | /* FFUART */ | ||
83 | GPIO40_FFUART_DTR, | ||
84 | GPIO41_FFUART_RTS, | ||
85 | GPIO39_FFUART_TXD, | ||
86 | GPIO37_FFUART_DSR, | ||
87 | GPIO34_FFUART_RXD, | ||
88 | GPIO35_FFUART_CTS, | ||
89 | |||
90 | /* PC Card */ | ||
91 | GPIO48_nPOE, | ||
92 | GPIO49_nPWE, | ||
93 | GPIO50_nPIOR, | ||
94 | GPIO51_nPIOW, | ||
95 | GPIO52_nPCE_1, | ||
96 | GPIO53_nPCE_2, | ||
97 | GPIO54_nPSKTSEL, | ||
98 | GPIO55_nPREG, | ||
99 | GPIO56_nPWAIT, | ||
100 | GPIO57_nIOIS16, | ||
101 | |||
102 | /* MMC */ | ||
103 | GPIO6_MMC_CLK, | ||
104 | GPIO8_MMC_CS0, | ||
105 | |||
106 | /* GPIO */ | ||
107 | GPIO9_GPIO, /* CORGI_GPIO_nSD_DETECT */ | ||
108 | GPIO7_GPIO, /* CORGI_GPIO_nSD_WP */ | ||
109 | GPIO33_GPIO, /* CORGI_GPIO_SD_PWR */ | ||
110 | GPIO22_GPIO, /* CORGI_GPIO_IR_ON */ | ||
111 | GPIO44_GPIO, /* CORGI_GPIO_HSYNC */ | ||
112 | |||
113 | GPIO1_GPIO | WAKEUP_ON_EDGE_RISE, | ||
114 | }; | ||
55 | 115 | ||
56 | /* | 116 | /* |
57 | * Corgi SCOOP Device | 117 | * Corgi SCOOP Device |
@@ -67,6 +127,7 @@ static struct resource corgi_scoop_resources[] = { | |||
67 | static struct scoop_config corgi_scoop_setup = { | 127 | static struct scoop_config corgi_scoop_setup = { |
68 | .io_dir = CORGI_SCOOP_IO_DIR, | 128 | .io_dir = CORGI_SCOOP_IO_DIR, |
69 | .io_out = CORGI_SCOOP_IO_OUT, | 129 | .io_out = CORGI_SCOOP_IO_OUT, |
130 | .gpio_base = CORGI_SCOOP_GPIO_BASE, | ||
70 | }; | 131 | }; |
71 | 132 | ||
72 | struct platform_device corgiscoop_device = { | 133 | struct platform_device corgiscoop_device = { |
@@ -79,27 +140,6 @@ struct platform_device corgiscoop_device = { | |||
79 | .resource = corgi_scoop_resources, | 140 | .resource = corgi_scoop_resources, |
80 | }; | 141 | }; |
81 | 142 | ||
82 | static void corgi_pcmcia_init(void) | ||
83 | { | ||
84 | /* Setup default state of GPIO outputs | ||
85 | before we enable them as outputs. */ | ||
86 | GPSR(GPIO48_nPOE) = GPIO_bit(GPIO48_nPOE) | | ||
87 | GPIO_bit(GPIO49_nPWE) | GPIO_bit(GPIO50_nPIOR) | | ||
88 | GPIO_bit(GPIO51_nPIOW) | GPIO_bit(GPIO52_nPCE_1) | | ||
89 | GPIO_bit(GPIO53_nPCE_2); | ||
90 | |||
91 | pxa_gpio_mode(GPIO48_nPOE_MD); | ||
92 | pxa_gpio_mode(GPIO49_nPWE_MD); | ||
93 | pxa_gpio_mode(GPIO50_nPIOR_MD); | ||
94 | pxa_gpio_mode(GPIO51_nPIOW_MD); | ||
95 | pxa_gpio_mode(GPIO55_nPREG_MD); | ||
96 | pxa_gpio_mode(GPIO56_nPWAIT_MD); | ||
97 | pxa_gpio_mode(GPIO57_nIOIS16_MD); | ||
98 | pxa_gpio_mode(GPIO52_nPCE_1_MD); | ||
99 | pxa_gpio_mode(GPIO53_nPCE_2_MD); | ||
100 | pxa_gpio_mode(GPIO54_pSKTSEL_MD); | ||
101 | } | ||
102 | |||
103 | static struct scoop_pcmcia_dev corgi_pcmcia_scoop[] = { | 143 | static struct scoop_pcmcia_dev corgi_pcmcia_scoop[] = { |
104 | { | 144 | { |
105 | .dev = &corgiscoop_device.dev, | 145 | .dev = &corgiscoop_device.dev, |
@@ -112,58 +152,10 @@ static struct scoop_pcmcia_dev corgi_pcmcia_scoop[] = { | |||
112 | static struct scoop_pcmcia_config corgi_pcmcia_config = { | 152 | static struct scoop_pcmcia_config corgi_pcmcia_config = { |
113 | .devs = &corgi_pcmcia_scoop[0], | 153 | .devs = &corgi_pcmcia_scoop[0], |
114 | .num_devs = 1, | 154 | .num_devs = 1, |
115 | .pcmcia_init = corgi_pcmcia_init, | ||
116 | }; | 155 | }; |
117 | 156 | ||
118 | EXPORT_SYMBOL(corgiscoop_device); | 157 | EXPORT_SYMBOL(corgiscoop_device); |
119 | 158 | ||
120 | |||
121 | /* | ||
122 | * Corgi SSP Device | ||
123 | * | ||
124 | * Set the parent as the scoop device because a lot of SSP devices | ||
125 | * also use scoop functions and this makes the power up/down order | ||
126 | * work correctly. | ||
127 | */ | ||
128 | struct platform_device corgissp_device = { | ||
129 | .name = "corgi-ssp", | ||
130 | .dev = { | ||
131 | .parent = &corgiscoop_device.dev, | ||
132 | }, | ||
133 | .id = -1, | ||
134 | }; | ||
135 | |||
136 | struct corgissp_machinfo corgi_ssp_machinfo = { | ||
137 | .port = 1, | ||
138 | .cs_lcdcon = CORGI_GPIO_LCDCON_CS, | ||
139 | .cs_ads7846 = CORGI_GPIO_ADS7846_CS, | ||
140 | .cs_max1111 = CORGI_GPIO_MAX1111_CS, | ||
141 | .clk_lcdcon = 76, | ||
142 | .clk_ads7846 = 2, | ||
143 | .clk_max1111 = 8, | ||
144 | }; | ||
145 | |||
146 | |||
147 | /* | ||
148 | * LCD/Framebuffer | ||
149 | */ | ||
150 | static void w100_lcdtg_suspend(struct w100fb_par *par) | ||
151 | { | ||
152 | corgi_lcdtg_suspend(); | ||
153 | } | ||
154 | |||
155 | static void w100_lcdtg_init(struct w100fb_par *par) | ||
156 | { | ||
157 | corgi_lcdtg_hw_init(par->xres); | ||
158 | } | ||
159 | |||
160 | |||
161 | static struct w100_tg_info corgi_lcdtg_info = { | ||
162 | .change = w100_lcdtg_init, | ||
163 | .suspend = w100_lcdtg_suspend, | ||
164 | .resume = w100_lcdtg_init, | ||
165 | }; | ||
166 | |||
167 | static struct w100_mem_info corgi_fb_mem = { | 159 | static struct w100_mem_info corgi_fb_mem = { |
168 | .ext_cntl = 0x00040003, | 160 | .ext_cntl = 0x00040003, |
169 | .sdram_mode_reg = 0x00650021, | 161 | .sdram_mode_reg = 0x00650021, |
@@ -242,7 +234,6 @@ static struct w100_mode corgi_fb_modes[] = { | |||
242 | }; | 234 | }; |
243 | 235 | ||
244 | static struct w100fb_mach_info corgi_fb_info = { | 236 | static struct w100fb_mach_info corgi_fb_info = { |
245 | .tg = &corgi_lcdtg_info, | ||
246 | .init_mode = INIT_MODE_ROTATED, | 237 | .init_mode = INIT_MODE_ROTATED, |
247 | .mem = &corgi_fb_mem, | 238 | .mem = &corgi_fb_mem, |
248 | .regs = &corgi_fb_regs, | 239 | .regs = &corgi_fb_regs, |
@@ -268,60 +259,10 @@ static struct platform_device corgifb_device = { | |||
268 | .resource = corgi_fb_resources, | 259 | .resource = corgi_fb_resources, |
269 | .dev = { | 260 | .dev = { |
270 | .platform_data = &corgi_fb_info, | 261 | .platform_data = &corgi_fb_info, |
271 | .parent = &corgissp_device.dev, | ||
272 | }, | 262 | }, |
273 | 263 | ||
274 | }; | 264 | }; |
275 | 265 | ||
276 | |||
277 | /* | ||
278 | * Corgi Backlight Device | ||
279 | */ | ||
280 | static void corgi_bl_kick_battery(void) | ||
281 | { | ||
282 | void (*kick_batt)(void); | ||
283 | |||
284 | kick_batt = symbol_get(sharpsl_battery_kick); | ||
285 | if (kick_batt) { | ||
286 | kick_batt(); | ||
287 | symbol_put(sharpsl_battery_kick); | ||
288 | } | ||
289 | } | ||
290 | |||
291 | static void corgi_bl_set_intensity(int intensity) | ||
292 | { | ||
293 | if (intensity > 0x10) | ||
294 | intensity += 0x10; | ||
295 | |||
296 | /* Bits 0-4 are accessed via the SSP interface */ | ||
297 | corgi_ssp_blduty_set(intensity & 0x1f); | ||
298 | |||
299 | /* Bit 5 is via SCOOP */ | ||
300 | if (intensity & 0x0020) | ||
301 | set_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_BACKLIGHT_CONT); | ||
302 | else | ||
303 | reset_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_BACKLIGHT_CONT); | ||
304 | } | ||
305 | |||
306 | static struct generic_bl_info corgi_bl_machinfo = { | ||
307 | .name = "corgi-bl", | ||
308 | .max_intensity = 0x2f, | ||
309 | .default_intensity = 0x1f, | ||
310 | .limit_mask = 0x0b, | ||
311 | .set_bl_intensity = corgi_bl_set_intensity, | ||
312 | .kick_battery = corgi_bl_kick_battery, | ||
313 | }; | ||
314 | |||
315 | static struct platform_device corgibl_device = { | ||
316 | .name = "generic-bl", | ||
317 | .dev = { | ||
318 | .parent = &corgifb_device.dev, | ||
319 | .platform_data = &corgi_bl_machinfo, | ||
320 | }, | ||
321 | .id = -1, | ||
322 | }; | ||
323 | |||
324 | |||
325 | /* | 266 | /* |
326 | * Corgi Keyboard Device | 267 | * Corgi Keyboard Device |
327 | */ | 268 | */ |
@@ -330,75 +271,35 @@ static struct platform_device corgikbd_device = { | |||
330 | .id = -1, | 271 | .id = -1, |
331 | }; | 272 | }; |
332 | 273 | ||
333 | |||
334 | /* | 274 | /* |
335 | * Corgi LEDs | 275 | * Corgi LEDs |
336 | */ | 276 | */ |
337 | static struct platform_device corgiled_device = { | 277 | static struct gpio_led corgi_gpio_leds[] = { |
338 | .name = "corgi-led", | 278 | { |
339 | .id = -1, | 279 | .name = "corgi:amber:charge", |
340 | }; | 280 | .default_trigger = "sharpsl-charge", |
341 | 281 | .gpio = CORGI_GPIO_LED_ORANGE, | |
342 | 282 | }, | |
343 | /* | 283 | { |
344 | * Corgi Touch Screen Device | 284 | .name = "corgi:green:mail", |
345 | */ | 285 | .default_trigger = "nand-disk", |
346 | static unsigned long (*get_hsync_invperiod)(struct device *dev); | 286 | .gpio = CORGI_GPIO_LED_GREEN, |
347 | |||
348 | static void inline sharpsl_wait_sync(int gpio) | ||
349 | { | ||
350 | while((GPLR(gpio) & GPIO_bit(gpio)) == 0); | ||
351 | while((GPLR(gpio) & GPIO_bit(gpio)) != 0); | ||
352 | } | ||
353 | |||
354 | static unsigned long corgi_get_hsync_invperiod(void) | ||
355 | { | ||
356 | if (!get_hsync_invperiod) | ||
357 | get_hsync_invperiod = symbol_get(w100fb_get_hsynclen); | ||
358 | if (!get_hsync_invperiod) | ||
359 | return 0; | ||
360 | |||
361 | return get_hsync_invperiod(&corgifb_device.dev); | ||
362 | } | ||
363 | |||
364 | static void corgi_put_hsync(void) | ||
365 | { | ||
366 | if (get_hsync_invperiod) | ||
367 | symbol_put(w100fb_get_hsynclen); | ||
368 | get_hsync_invperiod = NULL; | ||
369 | } | ||
370 | |||
371 | static void corgi_wait_hsync(void) | ||
372 | { | ||
373 | sharpsl_wait_sync(CORGI_GPIO_HSYNC); | ||
374 | } | ||
375 | |||
376 | static struct resource corgits_resources[] = { | ||
377 | [0] = { | ||
378 | .start = CORGI_IRQ_GPIO_TP_INT, | ||
379 | .end = CORGI_IRQ_GPIO_TP_INT, | ||
380 | .flags = IORESOURCE_IRQ, | ||
381 | }, | 287 | }, |
382 | }; | 288 | }; |
383 | 289 | ||
384 | static struct corgits_machinfo corgi_ts_machinfo = { | 290 | static struct gpio_led_platform_data corgi_gpio_leds_info = { |
385 | .get_hsync_invperiod = corgi_get_hsync_invperiod, | 291 | .leds = corgi_gpio_leds, |
386 | .put_hsync = corgi_put_hsync, | 292 | .num_leds = ARRAY_SIZE(corgi_gpio_leds), |
387 | .wait_hsync = corgi_wait_hsync, | ||
388 | }; | 293 | }; |
389 | 294 | ||
390 | static struct platform_device corgits_device = { | 295 | static struct platform_device corgiled_device = { |
391 | .name = "corgi-ts", | 296 | .name = "leds-gpio", |
297 | .id = -1, | ||
392 | .dev = { | 298 | .dev = { |
393 | .parent = &corgissp_device.dev, | 299 | .platform_data = &corgi_gpio_leds_info, |
394 | .platform_data = &corgi_ts_machinfo, | ||
395 | }, | 300 | }, |
396 | .id = -1, | ||
397 | .num_resources = ARRAY_SIZE(corgits_resources), | ||
398 | .resource = corgits_resources, | ||
399 | }; | 301 | }; |
400 | 302 | ||
401 | |||
402 | /* | 303 | /* |
403 | * MMC/SD Device | 304 | * MMC/SD Device |
404 | * | 305 | * |
@@ -411,20 +312,42 @@ static int corgi_mci_init(struct device *dev, irq_handler_t corgi_detect_int, vo | |||
411 | { | 312 | { |
412 | int err; | 313 | int err; |
413 | 314 | ||
414 | /* setup GPIO for PXA25x MMC controller */ | 315 | err = gpio_request(CORGI_GPIO_nSD_DETECT, "nSD_DETECT"); |
415 | pxa_gpio_mode(GPIO6_MMCCLK_MD); | 316 | if (err) |
416 | pxa_gpio_mode(GPIO8_MMCCS0_MD); | 317 | goto err_out; |
417 | pxa_gpio_mode(CORGI_GPIO_nSD_DETECT | GPIO_IN); | ||
418 | pxa_gpio_mode(CORGI_GPIO_SD_PWR | GPIO_OUT); | ||
419 | 318 | ||
420 | corgi_mci_platform_data.detect_delay = msecs_to_jiffies(250); | 319 | err = gpio_request(CORGI_GPIO_nSD_WP, "nSD_WP"); |
320 | if (err) | ||
321 | goto err_free_1; | ||
421 | 322 | ||
422 | err = request_irq(CORGI_IRQ_GPIO_nSD_DETECT, corgi_detect_int, | 323 | err = gpio_request(CORGI_GPIO_SD_PWR, "SD_PWR"); |
423 | IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, | ||
424 | "MMC card detect", data); | ||
425 | if (err) | 324 | if (err) |
426 | printk(KERN_ERR "corgi_mci_init: MMC/SD: can't request MMC card detect IRQ\n"); | 325 | goto err_free_2; |
427 | 326 | ||
327 | gpio_direction_input(CORGI_GPIO_nSD_DETECT); | ||
328 | gpio_direction_input(CORGI_GPIO_nSD_WP); | ||
329 | gpio_direction_output(CORGI_GPIO_SD_PWR, 0); | ||
330 | |||
331 | corgi_mci_platform_data.detect_delay = msecs_to_jiffies(250); | ||
332 | |||
333 | err = request_irq(CORGI_IRQ_GPIO_nSD_DETECT, corgi_detect_int, | ||
334 | IRQF_DISABLED | IRQF_TRIGGER_RISING | | ||
335 | IRQF_TRIGGER_FALLING, | ||
336 | "MMC card detect", data); | ||
337 | if (err) { | ||
338 | pr_err("%s: MMC/SD: can't request MMC card detect IRQ\n", | ||
339 | __func__); | ||
340 | goto err_free_3; | ||
341 | } | ||
342 | return 0; | ||
343 | |||
344 | err_free_3: | ||
345 | gpio_free(CORGI_GPIO_SD_PWR); | ||
346 | err_free_2: | ||
347 | gpio_free(CORGI_GPIO_nSD_WP); | ||
348 | err_free_1: | ||
349 | gpio_free(CORGI_GPIO_nSD_DETECT); | ||
350 | err_out: | ||
428 | return err; | 351 | return err; |
429 | } | 352 | } |
430 | 353 | ||
@@ -432,20 +355,20 @@ static void corgi_mci_setpower(struct device *dev, unsigned int vdd) | |||
432 | { | 355 | { |
433 | struct pxamci_platform_data* p_d = dev->platform_data; | 356 | struct pxamci_platform_data* p_d = dev->platform_data; |
434 | 357 | ||
435 | if (( 1 << vdd) & p_d->ocr_mask) | 358 | gpio_set_value(CORGI_GPIO_SD_PWR, ((1 << vdd) & p_d->ocr_mask)); |
436 | GPSR1 = GPIO_bit(CORGI_GPIO_SD_PWR); | ||
437 | else | ||
438 | GPCR1 = GPIO_bit(CORGI_GPIO_SD_PWR); | ||
439 | } | 359 | } |
440 | 360 | ||
441 | static int corgi_mci_get_ro(struct device *dev) | 361 | static int corgi_mci_get_ro(struct device *dev) |
442 | { | 362 | { |
443 | return GPLR(CORGI_GPIO_nSD_WP) & GPIO_bit(CORGI_GPIO_nSD_WP); | 363 | return gpio_get_value(CORGI_GPIO_nSD_WP); |
444 | } | 364 | } |
445 | 365 | ||
446 | static void corgi_mci_exit(struct device *dev, void *data) | 366 | static void corgi_mci_exit(struct device *dev, void *data) |
447 | { | 367 | { |
448 | free_irq(CORGI_IRQ_GPIO_nSD_DETECT, data); | 368 | free_irq(CORGI_IRQ_GPIO_nSD_DETECT, data); |
369 | gpio_free(CORGI_GPIO_SD_PWR); | ||
370 | gpio_free(CORGI_GPIO_nSD_WP); | ||
371 | gpio_free(CORGI_GPIO_nSD_DETECT); | ||
449 | } | 372 | } |
450 | 373 | ||
451 | static struct pxamci_platform_data corgi_mci_platform_data = { | 374 | static struct pxamci_platform_data corgi_mci_platform_data = { |
@@ -462,16 +385,32 @@ static struct pxamci_platform_data corgi_mci_platform_data = { | |||
462 | */ | 385 | */ |
463 | static void corgi_irda_transceiver_mode(struct device *dev, int mode) | 386 | static void corgi_irda_transceiver_mode(struct device *dev, int mode) |
464 | { | 387 | { |
465 | if (mode & IR_OFF) | 388 | gpio_set_value(CORGI_GPIO_IR_ON, mode & IR_OFF); |
466 | GPSR(CORGI_GPIO_IR_ON) = GPIO_bit(CORGI_GPIO_IR_ON); | ||
467 | else | ||
468 | GPCR(CORGI_GPIO_IR_ON) = GPIO_bit(CORGI_GPIO_IR_ON); | ||
469 | pxa2xx_transceiver_mode(dev, mode); | 389 | pxa2xx_transceiver_mode(dev, mode); |
470 | } | 390 | } |
471 | 391 | ||
392 | static int corgi_irda_startup(struct device *dev) | ||
393 | { | ||
394 | int err; | ||
395 | |||
396 | err = gpio_request(CORGI_GPIO_IR_ON, "IR_ON"); | ||
397 | if (err) | ||
398 | return err; | ||
399 | |||
400 | gpio_direction_output(CORGI_GPIO_IR_ON, 1); | ||
401 | return 0; | ||
402 | } | ||
403 | |||
404 | static void corgi_irda_shutdown(struct device *dev) | ||
405 | { | ||
406 | gpio_free(CORGI_GPIO_IR_ON); | ||
407 | } | ||
408 | |||
472 | static struct pxaficp_platform_data corgi_ficp_platform_data = { | 409 | static struct pxaficp_platform_data corgi_ficp_platform_data = { |
473 | .transceiver_cap = IR_SIRMODE | IR_OFF, | 410 | .transceiver_cap = IR_SIRMODE | IR_OFF, |
474 | .transceiver_mode = corgi_irda_transceiver_mode, | 411 | .transceiver_mode = corgi_irda_transceiver_mode, |
412 | .startup = corgi_irda_startup, | ||
413 | .shutdown = corgi_irda_shutdown, | ||
475 | }; | 414 | }; |
476 | 415 | ||
477 | 416 | ||
@@ -483,14 +422,129 @@ static struct pxa2xx_udc_mach_info udc_info __initdata = { | |||
483 | .gpio_pullup = CORGI_GPIO_USB_PULLUP, | 422 | .gpio_pullup = CORGI_GPIO_USB_PULLUP, |
484 | }; | 423 | }; |
485 | 424 | ||
425 | #if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MASTER) | ||
426 | static struct pxa2xx_spi_master corgi_spi_info = { | ||
427 | .num_chipselect = 3, | ||
428 | }; | ||
429 | |||
430 | static struct ads7846_platform_data corgi_ads7846_info = { | ||
431 | .model = 7846, | ||
432 | .vref_delay_usecs = 100, | ||
433 | .x_plate_ohms = 419, | ||
434 | .y_plate_ohms = 486, | ||
435 | .gpio_pendown = CORGI_GPIO_TP_INT, | ||
436 | }; | ||
437 | |||
438 | static void corgi_ads7846_cs(u32 command) | ||
439 | { | ||
440 | gpio_set_value(CORGI_GPIO_ADS7846_CS, !(command == PXA2XX_CS_ASSERT)); | ||
441 | } | ||
442 | |||
443 | static struct pxa2xx_spi_chip corgi_ads7846_chip = { | ||
444 | .cs_control = corgi_ads7846_cs, | ||
445 | }; | ||
446 | |||
447 | static void corgi_bl_kick_battery(void) | ||
448 | { | ||
449 | void (*kick_batt)(void); | ||
450 | |||
451 | kick_batt = symbol_get(sharpsl_battery_kick); | ||
452 | if (kick_batt) { | ||
453 | kick_batt(); | ||
454 | symbol_put(sharpsl_battery_kick); | ||
455 | } | ||
456 | } | ||
457 | |||
458 | static struct corgi_lcd_platform_data corgi_lcdcon_info = { | ||
459 | .init_mode = CORGI_LCD_MODE_VGA, | ||
460 | .max_intensity = 0x2f, | ||
461 | .default_intensity = 0x1f, | ||
462 | .limit_mask = 0x0b, | ||
463 | .gpio_backlight_cont = CORGI_GPIO_BACKLIGHT_CONT, | ||
464 | .gpio_backlight_on = -1, | ||
465 | .kick_battery = corgi_bl_kick_battery, | ||
466 | }; | ||
467 | |||
468 | static void corgi_lcdcon_cs(u32 command) | ||
469 | { | ||
470 | gpio_set_value(CORGI_GPIO_LCDCON_CS, !(command == PXA2XX_CS_ASSERT)); | ||
471 | } | ||
472 | |||
473 | static struct pxa2xx_spi_chip corgi_lcdcon_chip = { | ||
474 | .cs_control = corgi_lcdcon_cs, | ||
475 | }; | ||
476 | |||
477 | static void corgi_max1111_cs(u32 command) | ||
478 | { | ||
479 | gpio_set_value(CORGI_GPIO_MAX1111_CS, !(command == PXA2XX_CS_ASSERT)); | ||
480 | } | ||
481 | |||
482 | static struct pxa2xx_spi_chip corgi_max1111_chip = { | ||
483 | .cs_control = corgi_max1111_cs, | ||
484 | }; | ||
485 | |||
486 | static struct spi_board_info corgi_spi_devices[] = { | ||
487 | { | ||
488 | .modalias = "ads7846", | ||
489 | .max_speed_hz = 1200000, | ||
490 | .bus_num = 1, | ||
491 | .chip_select = 0, | ||
492 | .platform_data = &corgi_ads7846_info, | ||
493 | .controller_data= &corgi_ads7846_chip, | ||
494 | .irq = gpio_to_irq(CORGI_GPIO_TP_INT), | ||
495 | }, { | ||
496 | .modalias = "corgi-lcd", | ||
497 | .max_speed_hz = 50000, | ||
498 | .bus_num = 1, | ||
499 | .chip_select = 1, | ||
500 | .platform_data = &corgi_lcdcon_info, | ||
501 | .controller_data= &corgi_lcdcon_chip, | ||
502 | }, { | ||
503 | .modalias = "max1111", | ||
504 | .max_speed_hz = 450000, | ||
505 | .bus_num = 1, | ||
506 | .chip_select = 2, | ||
507 | .controller_data= &corgi_max1111_chip, | ||
508 | }, | ||
509 | }; | ||
510 | |||
511 | static void __init corgi_init_spi(void) | ||
512 | { | ||
513 | int err; | ||
514 | |||
515 | err = gpio_request(CORGI_GPIO_ADS7846_CS, "ADS7846_CS"); | ||
516 | if (err) | ||
517 | return; | ||
518 | |||
519 | err = gpio_request(CORGI_GPIO_LCDCON_CS, "LCDCON_CS"); | ||
520 | if (err) | ||
521 | goto err_free_1; | ||
522 | |||
523 | err = gpio_request(CORGI_GPIO_MAX1111_CS, "MAX1111_CS"); | ||
524 | if (err) | ||
525 | goto err_free_2; | ||
526 | |||
527 | gpio_direction_output(CORGI_GPIO_ADS7846_CS, 1); | ||
528 | gpio_direction_output(CORGI_GPIO_LCDCON_CS, 1); | ||
529 | gpio_direction_output(CORGI_GPIO_MAX1111_CS, 1); | ||
530 | |||
531 | pxa2xx_set_spi_info(1, &corgi_spi_info); | ||
532 | spi_register_board_info(ARRAY_AND_SIZE(corgi_spi_devices)); | ||
533 | return; | ||
534 | |||
535 | err_free_2: | ||
536 | gpio_free(CORGI_GPIO_LCDCON_CS); | ||
537 | err_free_1: | ||
538 | gpio_free(CORGI_GPIO_ADS7846_CS); | ||
539 | } | ||
540 | #else | ||
541 | static inline void corgi_init_spi(void) {} | ||
542 | #endif | ||
486 | 543 | ||
487 | static struct platform_device *devices[] __initdata = { | 544 | static struct platform_device *devices[] __initdata = { |
488 | &corgiscoop_device, | 545 | &corgiscoop_device, |
489 | &corgissp_device, | ||
490 | &corgifb_device, | 546 | &corgifb_device, |
491 | &corgikbd_device, | 547 | &corgikbd_device, |
492 | &corgibl_device, | ||
493 | &corgits_device, | ||
494 | &corgiled_device, | 548 | &corgiled_device, |
495 | }; | 549 | }; |
496 | 550 | ||
@@ -498,7 +552,8 @@ static void corgi_poweroff(void) | |||
498 | { | 552 | { |
499 | if (!machine_is_corgi()) | 553 | if (!machine_is_corgi()) |
500 | /* Green LED off tells the bootloader to halt */ | 554 | /* Green LED off tells the bootloader to halt */ |
501 | reset_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_LED_GREEN); | 555 | gpio_set_value(CORGI_GPIO_LED_GREEN, 0); |
556 | |||
502 | arm_machine_restart('h'); | 557 | arm_machine_restart('h'); |
503 | } | 558 | } |
504 | 559 | ||
@@ -506,7 +561,8 @@ static void corgi_restart(char mode) | |||
506 | { | 561 | { |
507 | if (!machine_is_corgi()) | 562 | if (!machine_is_corgi()) |
508 | /* Green LED on tells the bootloader to reboot */ | 563 | /* Green LED on tells the bootloader to reboot */ |
509 | set_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_LED_GREEN); | 564 | gpio_set_value(CORGI_GPIO_LED_GREEN, 1); |
565 | |||
510 | arm_machine_restart('h'); | 566 | arm_machine_restart('h'); |
511 | } | 567 | } |
512 | 568 | ||
@@ -515,20 +571,12 @@ static void __init corgi_init(void) | |||
515 | pm_power_off = corgi_poweroff; | 571 | pm_power_off = corgi_poweroff; |
516 | arm_pm_restart = corgi_restart; | 572 | arm_pm_restart = corgi_restart; |
517 | 573 | ||
518 | /* setup sleep mode values */ | ||
519 | PWER = 0x00000002; | ||
520 | PFER = 0x00000000; | ||
521 | PRER = 0x00000002; | ||
522 | PGSR0 = 0x0158C000; | ||
523 | PGSR1 = 0x00FF0080; | ||
524 | PGSR2 = 0x0001C004; | ||
525 | /* Stop 3.6MHz and drive HIGH to PCMCIA and CS */ | 574 | /* Stop 3.6MHz and drive HIGH to PCMCIA and CS */ |
526 | PCFR |= PCFR_OPDE; | 575 | PCFR |= PCFR_OPDE; |
527 | 576 | ||
528 | corgi_ssp_set_machinfo(&corgi_ssp_machinfo); | 577 | pxa2xx_mfp_config(ARRAY_AND_SIZE(corgi_pin_config)); |
529 | 578 | ||
530 | pxa_gpio_mode(CORGI_GPIO_IR_ON | GPIO_OUT); | 579 | corgi_init_spi(); |
531 | pxa_gpio_mode(CORGI_GPIO_HSYNC | GPIO_IN); | ||
532 | 580 | ||
533 | pxa_set_udc_info(&udc_info); | 581 | pxa_set_udc_info(&udc_info); |
534 | pxa_set_mci_info(&corgi_mci_platform_data); | 582 | pxa_set_mci_info(&corgi_mci_platform_data); |