Commit | Line | Data |
---|---|---|
543cd842 M |
1 | /* |
2 | * Hardware definitions for Voipac PXA270 | |
3 | * | |
4 | * Copyright (C) 2010 | |
5 | * Marek Vasut <marek.vasut@gmail.com> | |
6 | * | |
7 | * This program is free software; you can redistribute it and/or modify | |
8 | * it under the terms of the GNU General Public License version 2 as | |
9 | * published by the Free Software Foundation. | |
10 | * | |
11 | */ | |
12 | ||
13 | #include <linux/platform_device.h> | |
14 | #include <linux/delay.h> | |
15 | #include <linux/irq.h> | |
16 | #include <linux/gpio_keys.h> | |
17 | #include <linux/input.h> | |
18 | #include <linux/gpio.h> | |
3d98f881 | 19 | #include <linux/usb/gpio_vbus.h> |
543cd842 M |
20 | #include <linux/mtd/mtd.h> |
21 | #include <linux/mtd/partitions.h> | |
22 | #include <linux/mtd/physmap.h> | |
bcc399bb | 23 | #include <linux/mtd/onenand.h> |
947fb57e | 24 | #include <linux/dm9000.h> |
1a8fb70e | 25 | #include <linux/ucb1400.h> |
052345ae | 26 | #include <linux/ata_platform.h> |
a927ef89 | 27 | #include <linux/regulator/machine.h> |
54e70bff | 28 | #include <linux/regulator/max1586.h> |
b459396e | 29 | #include <linux/i2c/pxa-i2c.h> |
543cd842 M |
30 | |
31 | #include <asm/mach-types.h> | |
32 | #include <asm/mach/arch.h> | |
33 | ||
34 | #include <mach/pxa27x.h> | |
1a8fb70e | 35 | #include <mach/audio.h> |
543cd842 | 36 | #include <mach/vpac270.h> |
293b2da1 AB |
37 | #include <linux/platform_data/mmc-pxamci.h> |
38 | #include <linux/platform_data/video-pxafb.h> | |
39 | #include <linux/platform_data/usb-ohci-pxa27x.h> | |
3d98f881 MV |
40 | #include <mach/pxa27x-udc.h> |
41 | #include <mach/udc.h> | |
293b2da1 | 42 | #include <linux/platform_data/ata-pxa.h> |
543cd842 M |
43 | |
44 | #include "generic.h" | |
45 | #include "devices.h" | |
46 | ||
47 | /****************************************************************************** | |
48 | * Pin configuration | |
49 | ******************************************************************************/ | |
50 | static unsigned long vpac270_pin_config[] __initdata = { | |
51 | /* MMC */ | |
52 | GPIO32_MMC_CLK, | |
53 | GPIO92_MMC_DAT_0, | |
54 | GPIO109_MMC_DAT_1, | |
55 | GPIO110_MMC_DAT_2, | |
56 | GPIO111_MMC_DAT_3, | |
57 | GPIO112_MMC_CMD, | |
58 | GPIO53_GPIO, /* SD detect */ | |
59 | GPIO52_GPIO, /* SD r/o switch */ | |
60 | ||
61 | /* GPIO KEYS */ | |
62 | GPIO1_GPIO, /* USER BTN */ | |
63 | ||
64 | /* LEDs */ | |
65 | GPIO15_GPIO, /* orange led */ | |
66 | ||
67 | /* FFUART */ | |
68 | GPIO34_FFUART_RXD, | |
69 | GPIO39_FFUART_TXD, | |
70 | GPIO27_FFUART_RTS, | |
71 | GPIO100_FFUART_CTS, | |
72 | GPIO33_FFUART_DSR, | |
73 | GPIO40_FFUART_DTR, | |
74 | GPIO10_FFUART_DCD, | |
75 | GPIO38_FFUART_RI, | |
76 | ||
77 | /* LCD */ | |
78 | GPIO58_LCD_LDD_0, | |
79 | GPIO59_LCD_LDD_1, | |
80 | GPIO60_LCD_LDD_2, | |
81 | GPIO61_LCD_LDD_3, | |
82 | GPIO62_LCD_LDD_4, | |
83 | GPIO63_LCD_LDD_5, | |
84 | GPIO64_LCD_LDD_6, | |
85 | GPIO65_LCD_LDD_7, | |
86 | GPIO66_LCD_LDD_8, | |
87 | GPIO67_LCD_LDD_9, | |
88 | GPIO68_LCD_LDD_10, | |
89 | GPIO69_LCD_LDD_11, | |
90 | GPIO70_LCD_LDD_12, | |
91 | GPIO71_LCD_LDD_13, | |
92 | GPIO72_LCD_LDD_14, | |
93 | GPIO73_LCD_LDD_15, | |
94 | GPIO86_LCD_LDD_16, | |
95 | GPIO87_LCD_LDD_17, | |
96 | GPIO74_LCD_FCLK, | |
97 | GPIO75_LCD_LCLK, | |
98 | GPIO76_LCD_PCLK, | |
99 | GPIO77_LCD_BIAS, | |
addff0fa MV |
100 | |
101 | /* PCMCIA */ | |
102 | GPIO48_nPOE, | |
103 | GPIO49_nPWE, | |
104 | GPIO50_nPIOR, | |
105 | GPIO51_nPIOW, | |
106 | GPIO85_nPCE_1, | |
107 | GPIO54_nPCE_2, | |
108 | GPIO55_nPREG, | |
109 | GPIO57_nIOIS16, | |
110 | GPIO56_nPWAIT, | |
111 | GPIO104_PSKTSEL, | |
112 | GPIO84_GPIO, /* PCMCIA CD */ | |
113 | GPIO35_GPIO, /* PCMCIA RDY */ | |
114 | GPIO107_GPIO, /* PCMCIA PPEN */ | |
115 | GPIO11_GPIO, /* PCMCIA RESET */ | |
116 | GPIO17_GPIO, /* CF CD */ | |
117 | GPIO12_GPIO, /* CF RDY */ | |
118 | GPIO16_GPIO, /* CF RESET */ | |
119 | ||
3d98f881 MV |
120 | /* UHC */ |
121 | GPIO88_USBH1_PWR, | |
122 | GPIO89_USBH1_PEN, | |
123 | GPIO119_USBH2_PWR, | |
124 | GPIO120_USBH2_PEN, | |
125 | ||
126 | /* UDC */ | |
127 | GPIO41_GPIO, | |
947fb57e MV |
128 | |
129 | /* Ethernet */ | |
130 | GPIO114_GPIO, /* IRQ */ | |
1a8fb70e MV |
131 | |
132 | /* AC97 */ | |
133 | GPIO28_AC97_BITCLK, | |
134 | GPIO29_AC97_SDATA_IN_0, | |
135 | GPIO30_AC97_SDATA_OUT, | |
136 | GPIO31_AC97_SYNC, | |
137 | GPIO95_AC97_nRESET, | |
138 | GPIO98_AC97_SYSCLK, | |
139 | GPIO113_GPIO, /* TS IRQ */ | |
83a4a102 MV |
140 | |
141 | /* I2C */ | |
142 | GPIO117_I2C_SCL, | |
143 | GPIO118_I2C_SDA, | |
052345ae MV |
144 | |
145 | /* IDE */ | |
146 | GPIO36_GPIO, /* IDE IRQ */ | |
147 | GPIO80_DREQ_1, | |
543cd842 M |
148 | }; |
149 | ||
150 | /****************************************************************************** | |
151 | * NOR Flash | |
152 | ******************************************************************************/ | |
153 | #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) | |
bcc399bb | 154 | static struct mtd_partition vpac270_nor_partitions[] = { |
543cd842 M |
155 | { |
156 | .name = "Flash", | |
157 | .offset = 0x00000000, | |
158 | .size = MTDPART_SIZ_FULL, | |
159 | } | |
160 | }; | |
161 | ||
162 | static struct physmap_flash_data vpac270_flash_data[] = { | |
163 | { | |
164 | .width = 2, /* bankwidth in bytes */ | |
bcc399bb MV |
165 | .parts = vpac270_nor_partitions, |
166 | .nr_parts = ARRAY_SIZE(vpac270_nor_partitions) | |
543cd842 M |
167 | } |
168 | }; | |
169 | ||
170 | static struct resource vpac270_flash_resource = { | |
171 | .start = PXA_CS0_PHYS, | |
172 | .end = PXA_CS0_PHYS + SZ_64M - 1, | |
173 | .flags = IORESOURCE_MEM, | |
174 | }; | |
175 | ||
176 | static struct platform_device vpac270_flash = { | |
177 | .name = "physmap-flash", | |
178 | .id = 0, | |
179 | .resource = &vpac270_flash_resource, | |
180 | .num_resources = 1, | |
181 | .dev = { | |
182 | .platform_data = vpac270_flash_data, | |
183 | }, | |
184 | }; | |
185 | static void __init vpac270_nor_init(void) | |
186 | { | |
187 | platform_device_register(&vpac270_flash); | |
188 | } | |
189 | #else | |
190 | static inline void vpac270_nor_init(void) {} | |
191 | #endif | |
192 | ||
bcc399bb MV |
193 | /****************************************************************************** |
194 | * OneNAND Flash | |
195 | ******************************************************************************/ | |
196 | #if defined(CONFIG_MTD_ONENAND) || defined(CONFIG_MTD_ONENAND_MODULE) | |
197 | static struct mtd_partition vpac270_onenand_partitions[] = { | |
198 | { | |
199 | .name = "Flash", | |
200 | .offset = 0x00000000, | |
201 | .size = MTDPART_SIZ_FULL, | |
202 | } | |
203 | }; | |
204 | ||
205 | static struct onenand_platform_data vpac270_onenand_info = { | |
206 | .parts = vpac270_onenand_partitions, | |
207 | .nr_parts = ARRAY_SIZE(vpac270_onenand_partitions), | |
208 | }; | |
209 | ||
210 | static struct resource vpac270_onenand_resources[] = { | |
211 | [0] = { | |
212 | .start = PXA_CS0_PHYS, | |
213 | .end = PXA_CS0_PHYS + SZ_1M, | |
214 | .flags = IORESOURCE_MEM, | |
215 | }, | |
216 | }; | |
217 | ||
218 | static struct platform_device vpac270_onenand = { | |
219 | .name = "onenand-flash", | |
220 | .id = -1, | |
221 | .resource = vpac270_onenand_resources, | |
222 | .num_resources = ARRAY_SIZE(vpac270_onenand_resources), | |
223 | .dev = { | |
224 | .platform_data = &vpac270_onenand_info, | |
225 | }, | |
226 | }; | |
227 | ||
228 | static void __init vpac270_onenand_init(void) | |
229 | { | |
230 | platform_device_register(&vpac270_onenand); | |
231 | } | |
232 | #else | |
233 | static void __init vpac270_onenand_init(void) {} | |
234 | #endif | |
235 | ||
543cd842 M |
236 | /****************************************************************************** |
237 | * SD/MMC card controller | |
238 | ******************************************************************************/ | |
239 | #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE) | |
240 | static struct pxamci_platform_data vpac270_mci_platform_data = { | |
241 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, | |
979a281c | 242 | .gpio_power = -1, |
543cd842 M |
243 | .gpio_card_detect = GPIO53_VPAC270_SD_DETECT_N, |
244 | .gpio_card_ro = GPIO52_VPAC270_SD_READONLY, | |
f97cab28 | 245 | .detect_delay_ms = 200, |
543cd842 M |
246 | }; |
247 | ||
248 | static void __init vpac270_mmc_init(void) | |
249 | { | |
250 | pxa_set_mci_info(&vpac270_mci_platform_data); | |
251 | } | |
252 | #else | |
253 | static inline void vpac270_mmc_init(void) {} | |
254 | #endif | |
255 | ||
256 | /****************************************************************************** | |
257 | * GPIO keys | |
258 | ******************************************************************************/ | |
259 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) | |
260 | static struct gpio_keys_button vpac270_pxa_buttons[] = { | |
261 | {KEY_POWER, GPIO1_VPAC270_USER_BTN, 0, "USER BTN"}, | |
262 | }; | |
263 | ||
264 | static struct gpio_keys_platform_data vpac270_pxa_keys_data = { | |
265 | .buttons = vpac270_pxa_buttons, | |
266 | .nbuttons = ARRAY_SIZE(vpac270_pxa_buttons), | |
267 | }; | |
268 | ||
269 | static struct platform_device vpac270_pxa_keys = { | |
270 | .name = "gpio-keys", | |
271 | .id = -1, | |
272 | .dev = { | |
273 | .platform_data = &vpac270_pxa_keys_data, | |
274 | }, | |
275 | }; | |
276 | ||
277 | static void __init vpac270_keys_init(void) | |
278 | { | |
279 | platform_device_register(&vpac270_pxa_keys); | |
280 | } | |
281 | #else | |
282 | static inline void vpac270_keys_init(void) {} | |
283 | #endif | |
284 | ||
285 | /****************************************************************************** | |
286 | * LED | |
287 | ******************************************************************************/ | |
288 | #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) | |
289 | struct gpio_led vpac270_gpio_leds[] = { | |
290 | { | |
291 | .name = "vpac270:orange:user", | |
292 | .default_trigger = "none", | |
293 | .gpio = GPIO15_VPAC270_LED_ORANGE, | |
294 | .active_low = 1, | |
295 | } | |
296 | }; | |
297 | ||
298 | static struct gpio_led_platform_data vpac270_gpio_led_info = { | |
299 | .leds = vpac270_gpio_leds, | |
300 | .num_leds = ARRAY_SIZE(vpac270_gpio_leds), | |
301 | }; | |
302 | ||
303 | static struct platform_device vpac270_leds = { | |
304 | .name = "leds-gpio", | |
305 | .id = -1, | |
306 | .dev = { | |
307 | .platform_data = &vpac270_gpio_led_info, | |
308 | } | |
309 | }; | |
310 | ||
311 | static void __init vpac270_leds_init(void) | |
312 | { | |
313 | platform_device_register(&vpac270_leds); | |
314 | } | |
315 | #else | |
316 | static inline void vpac270_leds_init(void) {} | |
317 | #endif | |
318 | ||
3d98f881 MV |
319 | /****************************************************************************** |
320 | * USB Host | |
321 | ******************************************************************************/ | |
322 | #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) | |
323 | static int vpac270_ohci_init(struct device *dev) | |
324 | { | |
325 | UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE; | |
326 | return 0; | |
327 | } | |
328 | ||
329 | static struct pxaohci_platform_data vpac270_ohci_info = { | |
330 | .port_mode = PMM_PERPORT_MODE, | |
331 | .flags = ENABLE_PORT1 | ENABLE_PORT2 | | |
332 | POWER_CONTROL_LOW | POWER_SENSE_LOW, | |
333 | .init = vpac270_ohci_init, | |
334 | }; | |
335 | ||
336 | static void __init vpac270_uhc_init(void) | |
337 | { | |
338 | pxa_set_ohci_info(&vpac270_ohci_info); | |
339 | } | |
340 | #else | |
341 | static inline void vpac270_uhc_init(void) {} | |
342 | #endif | |
343 | ||
344 | /****************************************************************************** | |
345 | * USB Gadget | |
346 | ******************************************************************************/ | |
c0a39151 | 347 | #if defined(CONFIG_USB_PXA27X)||defined(CONFIG_USB_PXA27X_MODULE) |
3d98f881 MV |
348 | static struct gpio_vbus_mach_info vpac270_gpio_vbus_info = { |
349 | .gpio_vbus = GPIO41_VPAC270_UDC_DETECT, | |
350 | .gpio_pullup = -1, | |
351 | }; | |
352 | ||
353 | static struct platform_device vpac270_gpio_vbus = { | |
354 | .name = "gpio-vbus", | |
355 | .id = -1, | |
356 | .dev = { | |
357 | .platform_data = &vpac270_gpio_vbus_info, | |
358 | }, | |
359 | }; | |
360 | ||
361 | static void vpac270_udc_command(int cmd) | |
362 | { | |
363 | if (cmd == PXA2XX_UDC_CMD_CONNECT) | |
fb25cb33 | 364 | UP2OCR = UP2OCR_HXOE | UP2OCR_DPPUE; |
3d98f881 | 365 | else if (cmd == PXA2XX_UDC_CMD_DISCONNECT) |
fb25cb33 | 366 | UP2OCR = UP2OCR_HXOE; |
3d98f881 MV |
367 | } |
368 | ||
369 | static struct pxa2xx_udc_mach_info vpac270_udc_info __initdata = { | |
370 | .udc_command = vpac270_udc_command, | |
371 | .gpio_pullup = -1, | |
372 | }; | |
373 | ||
374 | static void __init vpac270_udc_init(void) | |
375 | { | |
376 | pxa_set_udc_info(&vpac270_udc_info); | |
377 | platform_device_register(&vpac270_gpio_vbus); | |
378 | } | |
379 | #else | |
380 | static inline void vpac270_udc_init(void) {} | |
381 | #endif | |
382 | ||
947fb57e MV |
383 | /****************************************************************************** |
384 | * Ethernet | |
385 | ******************************************************************************/ | |
386 | #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE) | |
387 | static struct resource vpac270_dm9000_resources[] = { | |
388 | [0] = { | |
389 | .start = PXA_CS2_PHYS + 0x300, | |
390 | .end = PXA_CS2_PHYS + 0x303, | |
391 | .flags = IORESOURCE_MEM, | |
392 | }, | |
393 | [1] = { | |
394 | .start = PXA_CS2_PHYS + 0x304, | |
395 | .end = PXA_CS2_PHYS + 0x343, | |
396 | .flags = IORESOURCE_MEM, | |
397 | }, | |
398 | [2] = { | |
6384fdad HZ |
399 | .start = PXA_GPIO_TO_IRQ(GPIO114_VPAC270_ETH_IRQ), |
400 | .end = PXA_GPIO_TO_IRQ(GPIO114_VPAC270_ETH_IRQ), | |
947fb57e MV |
401 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, |
402 | }, | |
403 | }; | |
404 | ||
405 | static struct dm9000_plat_data vpac270_dm9000_platdata = { | |
406 | .flags = DM9000_PLATF_32BITONLY, | |
407 | }; | |
408 | ||
409 | static struct platform_device vpac270_dm9000_device = { | |
410 | .name = "dm9000", | |
411 | .id = -1, | |
412 | .num_resources = ARRAY_SIZE(vpac270_dm9000_resources), | |
413 | .resource = vpac270_dm9000_resources, | |
414 | .dev = { | |
415 | .platform_data = &vpac270_dm9000_platdata, | |
416 | } | |
417 | }; | |
418 | ||
419 | static void __init vpac270_eth_init(void) | |
420 | { | |
421 | platform_device_register(&vpac270_dm9000_device); | |
422 | } | |
423 | #else | |
424 | static inline void vpac270_eth_init(void) {} | |
425 | #endif | |
426 | ||
1a8fb70e MV |
427 | /****************************************************************************** |
428 | * Audio and Touchscreen | |
429 | ******************************************************************************/ | |
430 | #if defined(CONFIG_TOUCHSCREEN_UCB1400) || \ | |
431 | defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE) | |
432 | static pxa2xx_audio_ops_t vpac270_ac97_pdata = { | |
433 | .reset_gpio = 95, | |
434 | }; | |
435 | ||
436 | static struct ucb1400_pdata vpac270_ucb1400_pdata = { | |
6384fdad | 437 | .irq = PXA_GPIO_TO_IRQ(GPIO113_VPAC270_TS_IRQ), |
1a8fb70e MV |
438 | }; |
439 | ||
440 | static struct platform_device vpac270_ucb1400_device = { | |
441 | .name = "ucb1400_core", | |
442 | .id = -1, | |
443 | .dev = { | |
444 | .platform_data = &vpac270_ucb1400_pdata, | |
445 | }, | |
446 | }; | |
447 | ||
448 | static void __init vpac270_ts_init(void) | |
449 | { | |
450 | pxa_set_ac97_info(&vpac270_ac97_pdata); | |
451 | platform_device_register(&vpac270_ucb1400_device); | |
452 | } | |
453 | #else | |
454 | static inline void vpac270_ts_init(void) {} | |
455 | #endif | |
456 | ||
83a4a102 MV |
457 | /****************************************************************************** |
458 | * RTC | |
459 | ******************************************************************************/ | |
460 | #if defined(CONFIG_RTC_DRV_DS1307) || defined(CONFIG_RTC_DRV_DS1307_MODULE) | |
461 | static struct i2c_board_info __initdata vpac270_i2c_devs[] = { | |
462 | { | |
463 | I2C_BOARD_INFO("ds1339", 0x68), | |
464 | }, | |
465 | }; | |
466 | ||
467 | static void __init vpac270_rtc_init(void) | |
468 | { | |
83a4a102 MV |
469 | i2c_register_board_info(0, ARRAY_AND_SIZE(vpac270_i2c_devs)); |
470 | } | |
471 | #else | |
472 | static inline void vpac270_rtc_init(void) {} | |
473 | #endif | |
474 | ||
543cd842 M |
475 | /****************************************************************************** |
476 | * Framebuffer | |
477 | ******************************************************************************/ | |
478 | #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) | |
479 | static struct pxafb_mode_info vpac270_lcd_modes[] = { | |
480 | { | |
481 | .pixclock = 57692, | |
482 | .xres = 640, | |
483 | .yres = 480, | |
484 | .bpp = 32, | |
485 | .depth = 18, | |
486 | ||
487 | .left_margin = 144, | |
488 | .right_margin = 32, | |
489 | .upper_margin = 13, | |
490 | .lower_margin = 30, | |
491 | ||
492 | .hsync_len = 32, | |
493 | .vsync_len = 2, | |
494 | ||
495 | .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, | |
97dbc516 MV |
496 | }, { /* CRT 640x480 */ |
497 | .pixclock = 35000, | |
498 | .xres = 640, | |
499 | .yres = 480, | |
500 | .bpp = 16, | |
501 | .depth = 16, | |
502 | ||
503 | .left_margin = 96, | |
504 | .right_margin = 48, | |
505 | .upper_margin = 33, | |
506 | .lower_margin = 10, | |
507 | ||
508 | .hsync_len = 48, | |
509 | .vsync_len = 1, | |
510 | ||
511 | .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, | |
512 | }, { /* CRT 800x600 H=30kHz V=48HZ */ | |
513 | .pixclock = 25000, | |
514 | .xres = 800, | |
515 | .yres = 600, | |
516 | .bpp = 16, | |
517 | .depth = 16, | |
518 | ||
519 | .left_margin = 50, | |
520 | .right_margin = 1, | |
521 | .upper_margin = 21, | |
522 | .lower_margin = 12, | |
523 | ||
524 | .hsync_len = 8, | |
525 | .vsync_len = 1, | |
526 | ||
527 | .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, | |
528 | }, { /* CRT 1024x768 H=40kHz V=50Hz */ | |
529 | .pixclock = 15000, | |
530 | .xres = 1024, | |
531 | .yres = 768, | |
532 | .bpp = 16, | |
533 | .depth = 16, | |
534 | ||
535 | .left_margin = 220, | |
536 | .right_margin = 8, | |
537 | .upper_margin = 33, | |
538 | .lower_margin = 2, | |
539 | ||
540 | .hsync_len = 48, | |
541 | .vsync_len = 1, | |
542 | ||
543 | .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, | |
544 | } | |
543cd842 M |
545 | }; |
546 | ||
547 | static struct pxafb_mach_info vpac270_lcd_screen = { | |
548 | .modes = vpac270_lcd_modes, | |
549 | .num_modes = ARRAY_SIZE(vpac270_lcd_modes), | |
550 | .lcd_conn = LCD_COLOR_TFT_18BPP, | |
551 | }; | |
552 | ||
553 | static void vpac270_lcd_power(int on, struct fb_var_screeninfo *info) | |
554 | { | |
555 | gpio_set_value(GPIO81_VPAC270_BKL_ON, on); | |
556 | } | |
557 | ||
558 | static void __init vpac270_lcd_init(void) | |
559 | { | |
560 | int ret; | |
561 | ||
562 | ret = gpio_request(GPIO81_VPAC270_BKL_ON, "BKL-ON"); | |
563 | if (ret) { | |
564 | pr_err("Requesting BKL-ON GPIO failed!\n"); | |
565 | goto err; | |
566 | } | |
567 | ||
568 | ret = gpio_direction_output(GPIO81_VPAC270_BKL_ON, 1); | |
569 | if (ret) { | |
570 | pr_err("Setting BKL-ON GPIO direction failed!\n"); | |
571 | goto err2; | |
572 | } | |
573 | ||
574 | vpac270_lcd_screen.pxafb_lcd_power = vpac270_lcd_power; | |
4321e1a1 | 575 | pxa_set_fb_info(NULL, &vpac270_lcd_screen); |
543cd842 M |
576 | return; |
577 | ||
578 | err2: | |
579 | gpio_free(GPIO81_VPAC270_BKL_ON); | |
580 | err: | |
581 | return; | |
582 | } | |
583 | #else | |
584 | static inline void vpac270_lcd_init(void) {} | |
585 | #endif | |
586 | ||
052345ae MV |
587 | /****************************************************************************** |
588 | * PATA IDE | |
589 | ******************************************************************************/ | |
9b2dbdc7 MV |
590 | #if defined(CONFIG_PATA_PXA) || defined(CONFIG_PATA_PXA_MODULE) |
591 | static struct pata_pxa_pdata vpac270_pata_pdata = { | |
592 | .reg_shift = 1, | |
593 | .dma_dreq = 1, | |
052345ae MV |
594 | .irq_flags = IRQF_TRIGGER_RISING, |
595 | }; | |
596 | ||
597 | static struct resource vpac270_ide_resources[] = { | |
598 | [0] = { /* I/O Base address */ | |
599 | .start = PXA_CS3_PHYS + 0x120, | |
600 | .end = PXA_CS3_PHYS + 0x13f, | |
601 | .flags = IORESOURCE_MEM | |
602 | }, | |
603 | [1] = { /* CTL Base address */ | |
604 | .start = PXA_CS3_PHYS + 0x15c, | |
605 | .end = PXA_CS3_PHYS + 0x15f, | |
606 | .flags = IORESOURCE_MEM | |
607 | }, | |
9b2dbdc7 MV |
608 | [2] = { /* DMA Base address */ |
609 | .start = PXA_CS3_PHYS + 0x20, | |
610 | .end = PXA_CS3_PHYS + 0x2f, | |
611 | .flags = IORESOURCE_DMA | |
612 | }, | |
613 | [3] = { /* IDE IRQ pin */ | |
4929f5a8 HZ |
614 | .start = PXA_GPIO_TO_IRQ(GPIO36_VPAC270_IDE_IRQ), |
615 | .end = PXA_GPIO_TO_IRQ(GPIO36_VPAC270_IDE_IRQ), | |
052345ae MV |
616 | .flags = IORESOURCE_IRQ |
617 | } | |
618 | }; | |
619 | ||
620 | static struct platform_device vpac270_ide_device = { | |
9b2dbdc7 | 621 | .name = "pata_pxa", |
052345ae MV |
622 | .num_resources = ARRAY_SIZE(vpac270_ide_resources), |
623 | .resource = vpac270_ide_resources, | |
624 | .dev = { | |
625 | .platform_data = &vpac270_pata_pdata, | |
9b2dbdc7 | 626 | .coherent_dma_mask = 0xffffffff, |
052345ae MV |
627 | } |
628 | }; | |
629 | ||
630 | static void __init vpac270_ide_init(void) | |
631 | { | |
632 | platform_device_register(&vpac270_ide_device); | |
633 | } | |
634 | #else | |
635 | static inline void vpac270_ide_init(void) {} | |
636 | #endif | |
637 | ||
54e70bff MV |
638 | /****************************************************************************** |
639 | * Core power regulator | |
640 | ******************************************************************************/ | |
641 | #if defined(CONFIG_REGULATOR_MAX1586) || \ | |
642 | defined(CONFIG_REGULATOR_MAX1586_MODULE) | |
643 | static struct regulator_consumer_supply vpac270_max1587a_consumers[] = { | |
0bf189ab | 644 | REGULATOR_SUPPLY("vcc_core", NULL), |
54e70bff MV |
645 | }; |
646 | ||
647 | static struct regulator_init_data vpac270_max1587a_v3_info = { | |
648 | .constraints = { | |
649 | .name = "vcc_core range", | |
650 | .min_uV = 900000, | |
651 | .max_uV = 1705000, | |
652 | .always_on = 1, | |
653 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, | |
654 | }, | |
655 | .consumer_supplies = vpac270_max1587a_consumers, | |
656 | .num_consumer_supplies = ARRAY_SIZE(vpac270_max1587a_consumers), | |
657 | }; | |
658 | ||
659 | static struct max1586_subdev_data vpac270_max1587a_subdevs[] = { | |
660 | { | |
661 | .name = "vcc_core", | |
662 | .id = MAX1586_V3, | |
663 | .platform_data = &vpac270_max1587a_v3_info, | |
664 | } | |
665 | }; | |
666 | ||
667 | static struct max1586_platform_data vpac270_max1587a_info = { | |
668 | .subdevs = vpac270_max1587a_subdevs, | |
669 | .num_subdevs = ARRAY_SIZE(vpac270_max1587a_subdevs), | |
670 | .v3_gain = MAX1586_GAIN_R24_3k32, /* 730..1550 mV */ | |
671 | }; | |
672 | ||
673 | static struct i2c_board_info __initdata vpac270_pi2c_board_info[] = { | |
674 | { | |
675 | I2C_BOARD_INFO("max1586", 0x14), | |
676 | .platform_data = &vpac270_max1587a_info, | |
677 | }, | |
678 | }; | |
679 | ||
680 | static void __init vpac270_pmic_init(void) | |
681 | { | |
682 | i2c_register_board_info(1, ARRAY_AND_SIZE(vpac270_pi2c_board_info)); | |
683 | } | |
684 | #else | |
685 | static inline void vpac270_pmic_init(void) {} | |
686 | #endif | |
687 | ||
688 | ||
543cd842 M |
689 | /****************************************************************************** |
690 | * Machine init | |
691 | ******************************************************************************/ | |
692 | static void __init vpac270_init(void) | |
693 | { | |
694 | pxa2xx_mfp_config(ARRAY_AND_SIZE(vpac270_pin_config)); | |
695 | ||
696 | pxa_set_ffuart_info(NULL); | |
697 | pxa_set_btuart_info(NULL); | |
698 | pxa_set_stuart_info(NULL); | |
54e70bff MV |
699 | pxa_set_i2c_info(NULL); |
700 | pxa27x_set_i2c_power_info(NULL); | |
543cd842 | 701 | |
54e70bff | 702 | vpac270_pmic_init(); |
543cd842 M |
703 | vpac270_lcd_init(); |
704 | vpac270_mmc_init(); | |
705 | vpac270_nor_init(); | |
bcc399bb | 706 | vpac270_onenand_init(); |
543cd842 M |
707 | vpac270_leds_init(); |
708 | vpac270_keys_init(); | |
3d98f881 MV |
709 | vpac270_uhc_init(); |
710 | vpac270_udc_init(); | |
947fb57e | 711 | vpac270_eth_init(); |
1a8fb70e | 712 | vpac270_ts_init(); |
83a4a102 | 713 | vpac270_rtc_init(); |
052345ae | 714 | vpac270_ide_init(); |
a927ef89 RJ |
715 | |
716 | regulator_has_full_constraints(); | |
543cd842 M |
717 | } |
718 | ||
719 | MACHINE_START(VPAC270, "Voipac PXA270") | |
7375aba6 | 720 | .atag_offset = 0x100, |
851982c1 | 721 | .map_io = pxa27x_map_io, |
4e611091 | 722 | .nr_irqs = PXA_NR_IRQS, |
543cd842 | 723 | .init_irq = pxa27x_init_irq, |
8a97ae2f | 724 | .handle_irq = pxa27x_handle_irq, |
6bb27d73 | 725 | .init_time = pxa_timer_init, |
271a74fc RK |
726 | .init_machine = vpac270_init, |
727 | .restart = pxa_restart, | |
543cd842 | 728 | MACHINE_END |