Commit | Line | Data |
---|---|---|
0dd28f1d RP |
1 | /* |
2 | * Support for Sharp SL-Cxx00 Series of PDAs | |
3 | * Models: SL-C3000 (Spitz), SL-C1000 (Akita) and SL-C3100 (Borzoi) | |
4 | * | |
5 | * Copyright (c) 2005 Richard Purdie | |
6 | * | |
7 | * Based on Sharp's 2.4 kernel patches/lubbock.c | |
8 | * | |
9 | * This program is free software; you can redistribute it and/or modify | |
10 | * it under the terms of the GNU General Public License version 2 as | |
11 | * published by the Free Software Foundation. | |
12 | * | |
13 | */ | |
14 | ||
15 | #include <linux/kernel.h> | |
16 | #include <linux/init.h> | |
d052d1be | 17 | #include <linux/platform_device.h> |
0dd28f1d RP |
18 | #include <linux/delay.h> |
19 | #include <linux/major.h> | |
20 | #include <linux/fs.h> | |
21 | #include <linux/interrupt.h> | |
22 | #include <linux/mmc/host.h> | |
74617fb6 | 23 | #include <linux/pm.h> |
c3f8f650 | 24 | #include <linux/backlight.h> |
0dd28f1d RP |
25 | |
26 | #include <asm/setup.h> | |
27 | #include <asm/memory.h> | |
28 | #include <asm/mach-types.h> | |
a09e64fb | 29 | #include <mach/hardware.h> |
0dd28f1d RP |
30 | #include <asm/irq.h> |
31 | #include <asm/io.h> | |
74617fb6 | 32 | #include <asm/system.h> |
0dd28f1d RP |
33 | |
34 | #include <asm/mach/arch.h> | |
35 | #include <asm/mach/map.h> | |
36 | #include <asm/mach/irq.h> | |
37 | ||
a09e64fb RK |
38 | #include <mach/pxa-regs.h> |
39 | #include <mach/pxa2xx-regs.h> | |
40 | #include <mach/pxa2xx-gpio.h> | |
41 | #include <mach/pxa27x-udc.h> | |
afd2fc02 | 42 | #include <mach/reset.h> |
a09e64fb RK |
43 | #include <mach/irda.h> |
44 | #include <mach/mmc.h> | |
45 | #include <mach/ohci.h> | |
46 | #include <mach/udc.h> | |
47 | #include <mach/pxafb.h> | |
48 | #include <mach/akita.h> | |
49 | #include <mach/spitz.h> | |
50 | #include <mach/sharpsl.h> | |
0dd28f1d RP |
51 | |
52 | #include <asm/mach/sharpsl_param.h> | |
53 | #include <asm/hardware/scoop.h> | |
54 | ||
55 | #include "generic.h" | |
46c41e62 | 56 | #include "devices.h" |
0dd28f1d RP |
57 | #include "sharpsl.h" |
58 | ||
59 | /* | |
60 | * Spitz SCOOP Device #1 | |
61 | */ | |
62 | static struct resource spitz_scoop_resources[] = { | |
63 | [0] = { | |
64 | .start = 0x10800000, | |
65 | .end = 0x10800fff, | |
66 | .flags = IORESOURCE_MEM, | |
67 | }, | |
68 | }; | |
69 | ||
70 | static struct scoop_config spitz_scoop_setup = { | |
71 | .io_dir = SPITZ_SCP_IO_DIR, | |
72 | .io_out = SPITZ_SCP_IO_OUT, | |
73 | .suspend_clr = SPITZ_SCP_SUS_CLR, | |
74 | .suspend_set = SPITZ_SCP_SUS_SET, | |
75 | }; | |
76 | ||
77 | struct platform_device spitzscoop_device = { | |
78 | .name = "sharp-scoop", | |
79 | .id = 0, | |
80 | .dev = { | |
81 | .platform_data = &spitz_scoop_setup, | |
82 | }, | |
83 | .num_resources = ARRAY_SIZE(spitz_scoop_resources), | |
84 | .resource = spitz_scoop_resources, | |
85 | }; | |
86 | ||
87 | /* | |
88 | * Spitz SCOOP Device #2 | |
89 | */ | |
90 | static struct resource spitz_scoop2_resources[] = { | |
91 | [0] = { | |
92 | .start = 0x08800040, | |
93 | .end = 0x08800fff, | |
94 | .flags = IORESOURCE_MEM, | |
95 | }, | |
96 | }; | |
97 | ||
98 | static struct scoop_config spitz_scoop2_setup = { | |
99 | .io_dir = SPITZ_SCP2_IO_DIR, | |
100 | .io_out = SPITZ_SCP2_IO_OUT, | |
101 | .suspend_clr = SPITZ_SCP2_SUS_CLR, | |
102 | .suspend_set = SPITZ_SCP2_SUS_SET, | |
103 | }; | |
104 | ||
105 | struct platform_device spitzscoop2_device = { | |
106 | .name = "sharp-scoop", | |
107 | .id = 1, | |
108 | .dev = { | |
109 | .platform_data = &spitz_scoop2_setup, | |
110 | }, | |
111 | .num_resources = ARRAY_SIZE(spitz_scoop2_resources), | |
112 | .resource = spitz_scoop2_resources, | |
113 | }; | |
114 | ||
a63ae442 RP |
115 | #define SPITZ_PWR_SD 0x01 |
116 | #define SPITZ_PWR_CF 0x02 | |
117 | ||
118 | /* Power control is shared with between one of the CF slots and SD */ | |
119 | static void spitz_card_pwr_ctrl(int device, unsigned short new_cpr) | |
120 | { | |
121 | unsigned short cpr = read_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR); | |
122 | ||
123 | if (new_cpr & 0x0007) { | |
124 | set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_CF_POWER); | |
125 | if (!(cpr & 0x0002) && !(cpr & 0x0004)) | |
126 | mdelay(5); | |
127 | if (device == SPITZ_PWR_CF) | |
128 | cpr |= 0x0002; | |
129 | if (device == SPITZ_PWR_SD) | |
130 | cpr |= 0x0004; | |
131 | write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, cpr | new_cpr); | |
132 | } else { | |
133 | if (device == SPITZ_PWR_CF) | |
134 | cpr &= ~0x0002; | |
135 | if (device == SPITZ_PWR_SD) | |
136 | cpr &= ~0x0004; | |
a63ae442 | 137 | if (!(cpr & 0x0002) && !(cpr & 0x0004)) { |
945b9579 | 138 | write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, 0x0000); |
a63ae442 RP |
139 | mdelay(1); |
140 | reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_CF_POWER); | |
945b9579 RP |
141 | } else { |
142 | write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, cpr | new_cpr); | |
a63ae442 RP |
143 | } |
144 | } | |
145 | } | |
146 | ||
147 | static void spitz_pcmcia_init(void) | |
148 | { | |
149 | /* Setup default state of GPIO outputs | |
150 | before we enable them as outputs. */ | |
151 | GPSR(GPIO48_nPOE) = GPIO_bit(GPIO48_nPOE) | | |
152 | GPIO_bit(GPIO49_nPWE) | GPIO_bit(GPIO50_nPIOR) | | |
153 | GPIO_bit(GPIO51_nPIOW) | GPIO_bit(GPIO54_nPCE_2); | |
154 | GPSR(GPIO85_nPCE_1) = GPIO_bit(GPIO85_nPCE_1); | |
155 | ||
156 | pxa_gpio_mode(GPIO48_nPOE_MD); | |
157 | pxa_gpio_mode(GPIO49_nPWE_MD); | |
158 | pxa_gpio_mode(GPIO50_nPIOR_MD); | |
159 | pxa_gpio_mode(GPIO51_nPIOW_MD); | |
160 | pxa_gpio_mode(GPIO55_nPREG_MD); | |
161 | pxa_gpio_mode(GPIO56_nPWAIT_MD); | |
162 | pxa_gpio_mode(GPIO57_nIOIS16_MD); | |
163 | pxa_gpio_mode(GPIO85_nPCE_1_MD); | |
164 | pxa_gpio_mode(GPIO54_nPCE_2_MD); | |
165 | pxa_gpio_mode(GPIO104_pSKTSEL_MD); | |
166 | } | |
167 | ||
168 | static void spitz_pcmcia_pwr(struct device *scoop, unsigned short cpr, int nr) | |
169 | { | |
170 | /* Only need to override behaviour for slot 0 */ | |
171 | if (nr == 0) | |
172 | spitz_card_pwr_ctrl(SPITZ_PWR_CF, cpr); | |
173 | else | |
174 | write_scoop_reg(scoop, SCOOP_CPR, cpr); | |
175 | } | |
176 | ||
0dd28f1d RP |
177 | static struct scoop_pcmcia_dev spitz_pcmcia_scoop[] = { |
178 | { | |
179 | .dev = &spitzscoop_device.dev, | |
180 | .irq = SPITZ_IRQ_GPIO_CF_IRQ, | |
181 | .cd_irq = SPITZ_IRQ_GPIO_CF_CD, | |
182 | .cd_irq_str = "PCMCIA0 CD", | |
183 | },{ | |
184 | .dev = &spitzscoop2_device.dev, | |
185 | .irq = SPITZ_IRQ_GPIO_CF2_IRQ, | |
186 | .cd_irq = -1, | |
187 | }, | |
188 | }; | |
189 | ||
a63ae442 RP |
190 | static struct scoop_pcmcia_config spitz_pcmcia_config = { |
191 | .devs = &spitz_pcmcia_scoop[0], | |
192 | .num_devs = 2, | |
193 | .pcmcia_init = spitz_pcmcia_init, | |
194 | .power_ctrl = spitz_pcmcia_pwr, | |
195 | }; | |
196 | ||
197 | EXPORT_SYMBOL(spitzscoop_device); | |
198 | EXPORT_SYMBOL(spitzscoop2_device); | |
199 | ||
0dd28f1d RP |
200 | |
201 | /* | |
202 | * Spitz SSP Device | |
203 | * | |
204 | * Set the parent as the scoop device because a lot of SSP devices | |
205 | * also use scoop functions and this makes the power up/down order | |
206 | * work correctly. | |
207 | */ | |
208 | struct platform_device spitzssp_device = { | |
209 | .name = "corgi-ssp", | |
210 | .dev = { | |
211 | .parent = &spitzscoop_device.dev, | |
212 | }, | |
213 | .id = -1, | |
214 | }; | |
215 | ||
216 | struct corgissp_machinfo spitz_ssp_machinfo = { | |
217 | .port = 2, | |
218 | .cs_lcdcon = SPITZ_GPIO_LCDCON_CS, | |
219 | .cs_ads7846 = SPITZ_GPIO_ADS7846_CS, | |
220 | .cs_max1111 = SPITZ_GPIO_MAX1111_CS, | |
221 | .clk_lcdcon = 520, | |
222 | .clk_ads7846 = 14, | |
223 | .clk_max1111 = 56, | |
224 | }; | |
225 | ||
226 | ||
227 | /* | |
228 | * Spitz Backlight Device | |
229 | */ | |
c3f8f650 RP |
230 | static void spitz_bl_kick_battery(void) |
231 | { | |
232 | void (*kick_batt)(void); | |
233 | ||
234 | kick_batt = symbol_get(sharpsl_battery_kick); | |
235 | if (kick_batt) { | |
236 | kick_batt(); | |
237 | symbol_put(sharpsl_battery_kick); | |
238 | } | |
239 | } | |
240 | ||
241 | static struct generic_bl_info spitz_bl_machinfo = { | |
242 | .name = "corgi-bl", | |
2c0f5fb0 RP |
243 | .default_intensity = 0x1f, |
244 | .limit_mask = 0x0b, | |
0dd28f1d | 245 | .max_intensity = 0x2f, |
c3f8f650 | 246 | .kick_battery = spitz_bl_kick_battery, |
0dd28f1d RP |
247 | }; |
248 | ||
249 | static struct platform_device spitzbl_device = { | |
c3f8f650 | 250 | .name = "generic-bl", |
0dd28f1d RP |
251 | .dev = { |
252 | .platform_data = &spitz_bl_machinfo, | |
253 | }, | |
254 | .id = -1, | |
255 | }; | |
256 | ||
257 | ||
258 | /* | |
259 | * Spitz Keyboard Device | |
260 | */ | |
261 | static struct platform_device spitzkbd_device = { | |
262 | .name = "spitz-keyboard", | |
263 | .id = -1, | |
264 | }; | |
265 | ||
266 | ||
3179108d RP |
267 | /* |
268 | * Spitz LEDs | |
269 | */ | |
270 | static struct platform_device spitzled_device = { | |
271 | .name = "spitz-led", | |
272 | .id = -1, | |
273 | }; | |
274 | ||
0dd28f1d RP |
275 | /* |
276 | * Spitz Touch Screen Device | |
277 | */ | |
ca4d6cfc RP |
278 | |
279 | static unsigned long (*get_hsync_invperiod)(struct device *dev); | |
280 | ||
281 | static void inline sharpsl_wait_sync(int gpio) | |
282 | { | |
283 | while((GPLR(gpio) & GPIO_bit(gpio)) == 0); | |
284 | while((GPLR(gpio) & GPIO_bit(gpio)) != 0); | |
285 | } | |
286 | ||
287 | static struct device *spitz_pxafb_dev; | |
288 | ||
289 | static int is_pxafb_device(struct device * dev, void * data) | |
290 | { | |
291 | struct platform_device *pdev = container_of(dev, struct platform_device, dev); | |
292 | ||
293 | return (strncmp(pdev->name, "pxa2xx-fb", 9) == 0); | |
294 | } | |
295 | ||
296 | static unsigned long spitz_get_hsync_invperiod(void) | |
297 | { | |
298 | #ifdef CONFIG_FB_PXA | |
299 | if (!spitz_pxafb_dev) { | |
300 | spitz_pxafb_dev = bus_find_device(&platform_bus_type, NULL, NULL, is_pxafb_device); | |
301 | if (!spitz_pxafb_dev) | |
302 | return 0; | |
303 | } | |
304 | if (!get_hsync_invperiod) | |
305 | get_hsync_invperiod = symbol_get(pxafb_get_hsync_time); | |
306 | if (!get_hsync_invperiod) | |
307 | #endif | |
308 | return 0; | |
309 | ||
310 | return get_hsync_invperiod(spitz_pxafb_dev); | |
311 | } | |
312 | ||
313 | static void spitz_put_hsync(void) | |
314 | { | |
315 | put_device(spitz_pxafb_dev); | |
316 | if (get_hsync_invperiod) | |
317 | symbol_put(pxafb_get_hsync_time); | |
318 | spitz_pxafb_dev = NULL; | |
319 | get_hsync_invperiod = NULL; | |
320 | } | |
321 | ||
322 | static void spitz_wait_hsync(void) | |
323 | { | |
324 | sharpsl_wait_sync(SPITZ_GPIO_HSYNC); | |
325 | } | |
326 | ||
0dd28f1d RP |
327 | static struct resource spitzts_resources[] = { |
328 | [0] = { | |
329 | .start = SPITZ_IRQ_GPIO_TP_INT, | |
330 | .end = SPITZ_IRQ_GPIO_TP_INT, | |
331 | .flags = IORESOURCE_IRQ, | |
332 | }, | |
333 | }; | |
334 | ||
335 | static struct corgits_machinfo spitz_ts_machinfo = { | |
ca4d6cfc RP |
336 | .get_hsync_invperiod = spitz_get_hsync_invperiod, |
337 | .put_hsync = spitz_put_hsync, | |
338 | .wait_hsync = spitz_wait_hsync, | |
0dd28f1d RP |
339 | }; |
340 | ||
341 | static struct platform_device spitzts_device = { | |
342 | .name = "corgi-ts", | |
343 | .dev = { | |
344 | .parent = &spitzssp_device.dev, | |
345 | .platform_data = &spitz_ts_machinfo, | |
346 | }, | |
347 | .id = -1, | |
348 | .num_resources = ARRAY_SIZE(spitzts_resources), | |
349 | .resource = spitzts_resources, | |
350 | }; | |
351 | ||
352 | ||
353 | /* | |
354 | * MMC/SD Device | |
355 | * | |
356 | * The card detect interrupt isn't debounced so we delay it by 250ms | |
357 | * to give the card a chance to fully insert/eject. | |
358 | */ | |
359 | ||
360 | static struct pxamci_platform_data spitz_mci_platform_data; | |
361 | ||
40220c1a | 362 | static int spitz_mci_init(struct device *dev, irq_handler_t spitz_detect_int, void *data) |
0dd28f1d RP |
363 | { |
364 | int err; | |
365 | ||
366 | /* setup GPIO for PXA27x MMC controller */ | |
367 | pxa_gpio_mode(GPIO32_MMCCLK_MD); | |
368 | pxa_gpio_mode(GPIO112_MMCCMD_MD); | |
369 | pxa_gpio_mode(GPIO92_MMCDAT0_MD); | |
370 | pxa_gpio_mode(GPIO109_MMCDAT1_MD); | |
371 | pxa_gpio_mode(GPIO110_MMCDAT2_MD); | |
372 | pxa_gpio_mode(GPIO111_MMCDAT3_MD); | |
373 | pxa_gpio_mode(SPITZ_GPIO_nSD_DETECT | GPIO_IN); | |
374 | pxa_gpio_mode(SPITZ_GPIO_nSD_WP | GPIO_IN); | |
375 | ||
376 | spitz_mci_platform_data.detect_delay = msecs_to_jiffies(250); | |
377 | ||
9ded96f2 | 378 | err = request_irq(SPITZ_IRQ_GPIO_nSD_DETECT, spitz_detect_int, |
52e405ea | 379 | IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, |
9ded96f2 | 380 | "MMC card detect", data); |
2687bd38 | 381 | if (err) |
0dd28f1d | 382 | printk(KERN_ERR "spitz_mci_init: MMC/SD: can't request MMC card detect IRQ\n"); |
0dd28f1d | 383 | |
2687bd38 | 384 | return err; |
0dd28f1d RP |
385 | } |
386 | ||
0dd28f1d RP |
387 | static void spitz_mci_setpower(struct device *dev, unsigned int vdd) |
388 | { | |
389 | struct pxamci_platform_data* p_d = dev->platform_data; | |
390 | ||
a63ae442 RP |
391 | if (( 1 << vdd) & p_d->ocr_mask) |
392 | spitz_card_pwr_ctrl(SPITZ_PWR_SD, 0x0004); | |
393 | else | |
394 | spitz_card_pwr_ctrl(SPITZ_PWR_SD, 0x0000); | |
0dd28f1d RP |
395 | } |
396 | ||
397 | static int spitz_mci_get_ro(struct device *dev) | |
398 | { | |
399 | return GPLR(SPITZ_GPIO_nSD_WP) & GPIO_bit(SPITZ_GPIO_nSD_WP); | |
400 | } | |
401 | ||
402 | static void spitz_mci_exit(struct device *dev, void *data) | |
403 | { | |
404 | free_irq(SPITZ_IRQ_GPIO_nSD_DETECT, data); | |
405 | } | |
406 | ||
407 | static struct pxamci_platform_data spitz_mci_platform_data = { | |
408 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, | |
409 | .init = spitz_mci_init, | |
410 | .get_ro = spitz_mci_get_ro, | |
411 | .setpower = spitz_mci_setpower, | |
412 | .exit = spitz_mci_exit, | |
413 | }; | |
414 | ||
415 | ||
3125c68d RP |
416 | /* |
417 | * USB Host (OHCI) | |
418 | */ | |
419 | static int spitz_ohci_init(struct device *dev) | |
420 | { | |
421 | /* Only Port 2 is connected */ | |
422 | pxa_gpio_mode(SPITZ_GPIO_USB_CONNECT | GPIO_IN); | |
423 | pxa_gpio_mode(SPITZ_GPIO_USB_HOST | GPIO_OUT); | |
424 | pxa_gpio_mode(SPITZ_GPIO_USB_DEVICE | GPIO_IN); | |
425 | ||
426 | /* Setup USB Port 2 Output Control Register */ | |
427 | UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE; | |
428 | ||
429 | GPSR(SPITZ_GPIO_USB_HOST) = GPIO_bit(SPITZ_GPIO_USB_HOST); | |
430 | ||
431 | UHCHR = (UHCHR) & | |
432 | ~(UHCHR_SSEP1 | UHCHR_SSEP2 | UHCHR_SSEP3 | UHCHR_SSE); | |
433 | ||
434 | UHCRHDA |= UHCRHDA_NOCP; | |
435 | ||
436 | return 0; | |
437 | } | |
438 | ||
439 | static struct pxaohci_platform_data spitz_ohci_platform_data = { | |
440 | .port_mode = PMM_NPS_MODE, | |
441 | .init = spitz_ohci_init, | |
0c27c5d5 | 442 | .power_budget = 150, |
3125c68d RP |
443 | }; |
444 | ||
445 | ||
dc07845d RP |
446 | /* |
447 | * Irda | |
448 | */ | |
449 | static void spitz_irda_transceiver_mode(struct device *dev, int mode) | |
450 | { | |
451 | if (mode & IR_OFF) | |
452 | set_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_IR_ON); | |
453 | else | |
454 | reset_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_IR_ON); | |
0fc3ff31 | 455 | pxa2xx_transceiver_mode(dev, mode); |
dc07845d RP |
456 | } |
457 | ||
94cabd00 RP |
458 | #ifdef CONFIG_MACH_AKITA |
459 | static void akita_irda_transceiver_mode(struct device *dev, int mode) | |
460 | { | |
461 | if (mode & IR_OFF) | |
462 | akita_set_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_IR_ON); | |
463 | else | |
464 | akita_reset_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_IR_ON); | |
0fc3ff31 | 465 | pxa2xx_transceiver_mode(dev, mode); |
94cabd00 RP |
466 | } |
467 | #endif | |
468 | ||
dc07845d RP |
469 | static struct pxaficp_platform_data spitz_ficp_platform_data = { |
470 | .transceiver_cap = IR_SIRMODE | IR_OFF, | |
471 | .transceiver_mode = spitz_irda_transceiver_mode, | |
472 | }; | |
473 | ||
474 | ||
0dd28f1d RP |
475 | /* |
476 | * Spitz PXA Framebuffer | |
477 | */ | |
d14b272b | 478 | |
ca4d6cfc RP |
479 | static void spitz_lcd_power(int on, struct fb_var_screeninfo *var) |
480 | { | |
481 | if (on) | |
482 | corgi_lcdtg_hw_init(var->xres); | |
483 | else | |
484 | corgi_lcdtg_suspend(); | |
485 | } | |
486 | ||
d14b272b RP |
487 | static struct pxafb_mode_info spitz_pxafb_modes[] = { |
488 | { | |
489 | .pixclock = 19231, | |
490 | .xres = 480, | |
491 | .yres = 640, | |
492 | .bpp = 16, | |
493 | .hsync_len = 40, | |
494 | .left_margin = 46, | |
495 | .right_margin = 125, | |
496 | .vsync_len = 3, | |
497 | .upper_margin = 1, | |
498 | .lower_margin = 0, | |
499 | .sync = 0, | |
500 | },{ | |
501 | .pixclock = 134617, | |
502 | .xres = 240, | |
503 | .yres = 320, | |
504 | .bpp = 16, | |
505 | .hsync_len = 20, | |
506 | .left_margin = 20, | |
507 | .right_margin = 46, | |
508 | .vsync_len = 2, | |
509 | .upper_margin = 1, | |
510 | .lower_margin = 0, | |
511 | .sync = 0, | |
512 | }, | |
513 | }; | |
514 | ||
515 | static struct pxafb_mach_info spitz_pxafb_info = { | |
516 | .modes = &spitz_pxafb_modes[0], | |
517 | .num_modes = 2, | |
518 | .fixed_modes = 1, | |
519 | .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act | LCCR0_LDDALT | LCCR0_OUC | LCCR0_CMDIM | LCCR0_RDSTM, | |
520 | .lccr3 = LCCR3_PixRsEdg | LCCR3_OutEnH, | |
521 | .pxafb_lcd_power = spitz_lcd_power, | |
0dd28f1d RP |
522 | }; |
523 | ||
524 | ||
525 | static struct platform_device *devices[] __initdata = { | |
526 | &spitzscoop_device, | |
527 | &spitzssp_device, | |
528 | &spitzkbd_device, | |
529 | &spitzts_device, | |
530 | &spitzbl_device, | |
3179108d | 531 | &spitzled_device, |
0dd28f1d RP |
532 | }; |
533 | ||
74617fb6 RP |
534 | static void spitz_poweroff(void) |
535 | { | |
86159a98 | 536 | arm_machine_restart('g'); |
74617fb6 RP |
537 | } |
538 | ||
539 | static void spitz_restart(char mode) | |
540 | { | |
541 | /* Bootloader magic for a reboot */ | |
542 | if((MSC0 & 0xffff0000) == 0x7ff00000) | |
543 | MSC0 = (MSC0 & 0xffff) | 0x7ee00000; | |
544 | ||
545 | spitz_poweroff(); | |
546 | } | |
547 | ||
0dd28f1d RP |
548 | static void __init common_init(void) |
549 | { | |
86159a98 | 550 | init_gpio_reset(SPITZ_GPIO_ON_RESET); |
74617fb6 RP |
551 | pm_power_off = spitz_poweroff; |
552 | arm_pm_restart = spitz_restart; | |
553 | ||
0dd28f1d RP |
554 | PMCR = 0x00; |
555 | ||
556 | /* setup sleep mode values */ | |
557 | PWER = 0x00000002; | |
558 | PFER = 0x00000000; | |
559 | PRER = 0x00000002; | |
560 | PGSR0 = 0x0158C000; | |
561 | PGSR1 = 0x00FF0080; | |
562 | PGSR2 = 0x0001C004; | |
563 | ||
564 | /* Stop 3.6MHz and drive HIGH to PCMCIA and CS */ | |
565 | PCFR |= PCFR_OPDE; | |
566 | ||
567 | corgi_ssp_set_machinfo(&spitz_ssp_machinfo); | |
568 | ||
569 | pxa_gpio_mode(SPITZ_GPIO_HSYNC | GPIO_IN); | |
570 | ||
571 | platform_add_devices(devices, ARRAY_SIZE(devices)); | |
572 | pxa_set_mci_info(&spitz_mci_platform_data); | |
3125c68d | 573 | pxa_set_ohci_info(&spitz_ohci_platform_data); |
dc07845d | 574 | pxa_set_ficp_info(&spitz_ficp_platform_data); |
cb38c569 | 575 | set_pxa_fb_parent(&spitzssp_device.dev); |
0dd28f1d RP |
576 | set_pxa_fb_info(&spitz_pxafb_info); |
577 | } | |
578 | ||
ca4d6cfc RP |
579 | #if defined(CONFIG_MACH_SPITZ) || defined(CONFIG_MACH_BORZOI) |
580 | static void spitz_bl_set_intensity(int intensity) | |
581 | { | |
582 | if (intensity > 0x10) | |
583 | intensity += 0x10; | |
584 | ||
585 | /* Bits 0-4 are accessed via the SSP interface */ | |
586 | corgi_ssp_blduty_set(intensity & 0x1f); | |
587 | ||
588 | /* Bit 5 is via SCOOP */ | |
589 | if (intensity & 0x0020) | |
590 | reset_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_BACKLIGHT_CONT); | |
591 | else | |
592 | set_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_BACKLIGHT_CONT); | |
593 | ||
594 | if (intensity) | |
595 | set_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_BACKLIGHT_ON); | |
596 | else | |
597 | reset_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_BACKLIGHT_ON); | |
598 | } | |
599 | ||
0dd28f1d RP |
600 | static void __init spitz_init(void) |
601 | { | |
a63ae442 RP |
602 | platform_scoop_config = &spitz_pcmcia_config; |
603 | ||
0dd28f1d RP |
604 | spitz_bl_machinfo.set_bl_intensity = spitz_bl_set_intensity; |
605 | ||
606 | common_init(); | |
607 | ||
608 | platform_device_register(&spitzscoop2_device); | |
609 | } | |
ca4d6cfc | 610 | #endif |
0dd28f1d | 611 | |
94cabd00 RP |
612 | #ifdef CONFIG_MACH_AKITA |
613 | /* | |
614 | * Akita IO Expander | |
615 | */ | |
616 | struct platform_device akitaioexp_device = { | |
617 | .name = "akita-ioexp", | |
618 | .id = -1, | |
619 | }; | |
620 | ||
bd8f103e RP |
621 | EXPORT_SYMBOL_GPL(akitaioexp_device); |
622 | ||
ca4d6cfc RP |
623 | static void akita_bl_set_intensity(int intensity) |
624 | { | |
625 | if (intensity > 0x10) | |
626 | intensity += 0x10; | |
627 | ||
628 | /* Bits 0-4 are accessed via the SSP interface */ | |
629 | corgi_ssp_blduty_set(intensity & 0x1f); | |
630 | ||
631 | /* Bit 5 is via IO-Expander */ | |
632 | if (intensity & 0x0020) | |
633 | akita_reset_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_BACKLIGHT_CONT); | |
634 | else | |
635 | akita_set_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_BACKLIGHT_CONT); | |
636 | ||
637 | if (intensity) | |
638 | akita_set_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_BACKLIGHT_ON); | |
639 | else | |
640 | akita_reset_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_BACKLIGHT_ON); | |
641 | } | |
642 | ||
94cabd00 RP |
643 | static void __init akita_init(void) |
644 | { | |
645 | spitz_ficp_platform_data.transceiver_mode = akita_irda_transceiver_mode; | |
646 | ||
647 | /* We just pretend the second element of the array doesn't exist */ | |
648 | spitz_pcmcia_config.num_devs = 1; | |
649 | platform_scoop_config = &spitz_pcmcia_config; | |
650 | spitz_bl_machinfo.set_bl_intensity = akita_bl_set_intensity; | |
651 | ||
652 | platform_device_register(&akitaioexp_device); | |
653 | ||
654 | spitzscoop_device.dev.parent = &akitaioexp_device.dev; | |
655 | common_init(); | |
656 | } | |
657 | #endif | |
658 | ||
0dd28f1d RP |
659 | static void __init fixup_spitz(struct machine_desc *desc, |
660 | struct tag *tags, char **cmdline, struct meminfo *mi) | |
661 | { | |
662 | sharpsl_save_param(); | |
663 | mi->nr_banks = 1; | |
664 | mi->bank[0].start = 0xa0000000; | |
665 | mi->bank[0].node = 0; | |
666 | mi->bank[0].size = (64*1024*1024); | |
667 | } | |
668 | ||
669 | #ifdef CONFIG_MACH_SPITZ | |
670 | MACHINE_START(SPITZ, "SHARP Spitz") | |
0dd28f1d RP |
671 | .phys_io = 0x40000000, |
672 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, | |
673 | .fixup = fixup_spitz, | |
674 | .map_io = pxa_map_io, | |
cd49104d | 675 | .init_irq = pxa27x_init_irq, |
0dd28f1d RP |
676 | .init_machine = spitz_init, |
677 | .timer = &pxa_timer, | |
678 | MACHINE_END | |
679 | #endif | |
680 | ||
681 | #ifdef CONFIG_MACH_BORZOI | |
682 | MACHINE_START(BORZOI, "SHARP Borzoi") | |
0dd28f1d RP |
683 | .phys_io = 0x40000000, |
684 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, | |
685 | .fixup = fixup_spitz, | |
686 | .map_io = pxa_map_io, | |
cd49104d | 687 | .init_irq = pxa27x_init_irq, |
0dd28f1d RP |
688 | .init_machine = spitz_init, |
689 | .timer = &pxa_timer, | |
690 | MACHINE_END | |
691 | #endif | |
94cabd00 RP |
692 | |
693 | #ifdef CONFIG_MACH_AKITA | |
694 | MACHINE_START(AKITA, "SHARP Akita") | |
94cabd00 RP |
695 | .phys_io = 0x40000000, |
696 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, | |
697 | .fixup = fixup_spitz, | |
698 | .map_io = pxa_map_io, | |
cd49104d | 699 | .init_irq = pxa27x_init_irq, |
94cabd00 RP |
700 | .init_machine = akita_init, |
701 | .timer = &pxa_timer, | |
702 | MACHINE_END | |
703 | #endif |