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