blob: 0954c2433a984e7fbcd485e91aab0a1df216bbc7 [file] [log] [blame]
Marek543cd842010-03-09 04:04:12 +01001/*
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>
19#include <linux/sysdev.h>
Marek Vasut3d98f882010-03-10 05:24:27 +010020#include <linux/usb/gpio_vbus.h>
Marek543cd842010-03-09 04:04:12 +010021#include <linux/mtd/mtd.h>
22#include <linux/mtd/partitions.h>
23#include <linux/mtd/physmap.h>
Marek Vasutbcc399b2010-05-01 06:54:36 +020024#include <linux/mtd/onenand.h>
Marek Vasut947fb572010-03-10 05:38:54 +010025#include <linux/dm9000.h>
Marek Vasut1a8fb702010-03-26 04:45:54 +010026#include <linux/ucb1400.h>
Marek Vasut052345a2010-04-26 21:46:07 +020027#include <linux/ata_platform.h>
Marek543cd842010-03-09 04:04:12 +010028
29#include <asm/mach-types.h>
30#include <asm/mach/arch.h>
31
32#include <mach/pxa27x.h>
Marek Vasut1a8fb702010-03-26 04:45:54 +010033#include <mach/audio.h>
Marek543cd842010-03-09 04:04:12 +010034#include <mach/vpac270.h>
35#include <mach/mmc.h>
36#include <mach/pxafb.h>
Marek Vasut3d98f882010-03-10 05:24:27 +010037#include <mach/ohci.h>
38#include <mach/pxa27x-udc.h>
39#include <mach/udc.h>
Marek543cd842010-03-09 04:04:12 +010040
Marek Vasut83a4a102010-03-26 05:38:10 +010041#include <plat/i2c.h>
42
Marek543cd842010-03-09 04:04:12 +010043#include "generic.h"
44#include "devices.h"
45
46/******************************************************************************
47 * Pin configuration
48 ******************************************************************************/
49static unsigned long vpac270_pin_config[] __initdata = {
50 /* MMC */
51 GPIO32_MMC_CLK,
52 GPIO92_MMC_DAT_0,
53 GPIO109_MMC_DAT_1,
54 GPIO110_MMC_DAT_2,
55 GPIO111_MMC_DAT_3,
56 GPIO112_MMC_CMD,
57 GPIO53_GPIO, /* SD detect */
58 GPIO52_GPIO, /* SD r/o switch */
59
60 /* GPIO KEYS */
61 GPIO1_GPIO, /* USER BTN */
62
63 /* LEDs */
64 GPIO15_GPIO, /* orange led */
65
66 /* FFUART */
67 GPIO34_FFUART_RXD,
68 GPIO39_FFUART_TXD,
69 GPIO27_FFUART_RTS,
70 GPIO100_FFUART_CTS,
71 GPIO33_FFUART_DSR,
72 GPIO40_FFUART_DTR,
73 GPIO10_FFUART_DCD,
74 GPIO38_FFUART_RI,
75
76 /* LCD */
77 GPIO58_LCD_LDD_0,
78 GPIO59_LCD_LDD_1,
79 GPIO60_LCD_LDD_2,
80 GPIO61_LCD_LDD_3,
81 GPIO62_LCD_LDD_4,
82 GPIO63_LCD_LDD_5,
83 GPIO64_LCD_LDD_6,
84 GPIO65_LCD_LDD_7,
85 GPIO66_LCD_LDD_8,
86 GPIO67_LCD_LDD_9,
87 GPIO68_LCD_LDD_10,
88 GPIO69_LCD_LDD_11,
89 GPIO70_LCD_LDD_12,
90 GPIO71_LCD_LDD_13,
91 GPIO72_LCD_LDD_14,
92 GPIO73_LCD_LDD_15,
93 GPIO86_LCD_LDD_16,
94 GPIO87_LCD_LDD_17,
95 GPIO74_LCD_FCLK,
96 GPIO75_LCD_LCLK,
97 GPIO76_LCD_PCLK,
98 GPIO77_LCD_BIAS,
Marek Vasutaddff0f2010-03-10 04:16:28 +010099
100 /* PCMCIA */
101 GPIO48_nPOE,
102 GPIO49_nPWE,
103 GPIO50_nPIOR,
104 GPIO51_nPIOW,
105 GPIO85_nPCE_1,
106 GPIO54_nPCE_2,
107 GPIO55_nPREG,
108 GPIO57_nIOIS16,
109 GPIO56_nPWAIT,
110 GPIO104_PSKTSEL,
111 GPIO84_GPIO, /* PCMCIA CD */
112 GPIO35_GPIO, /* PCMCIA RDY */
113 GPIO107_GPIO, /* PCMCIA PPEN */
114 GPIO11_GPIO, /* PCMCIA RESET */
115 GPIO17_GPIO, /* CF CD */
116 GPIO12_GPIO, /* CF RDY */
117 GPIO16_GPIO, /* CF RESET */
118
Marek Vasut3d98f882010-03-10 05:24:27 +0100119 /* UHC */
120 GPIO88_USBH1_PWR,
121 GPIO89_USBH1_PEN,
122 GPIO119_USBH2_PWR,
123 GPIO120_USBH2_PEN,
124
125 /* UDC */
126 GPIO41_GPIO,
Marek Vasut947fb572010-03-10 05:38:54 +0100127
128 /* Ethernet */
129 GPIO114_GPIO, /* IRQ */
Marek Vasut1a8fb702010-03-26 04:45:54 +0100130
131 /* AC97 */
132 GPIO28_AC97_BITCLK,
133 GPIO29_AC97_SDATA_IN_0,
134 GPIO30_AC97_SDATA_OUT,
135 GPIO31_AC97_SYNC,
136 GPIO95_AC97_nRESET,
137 GPIO98_AC97_SYSCLK,
138 GPIO113_GPIO, /* TS IRQ */
Marek Vasut83a4a102010-03-26 05:38:10 +0100139
140 /* I2C */
141 GPIO117_I2C_SCL,
142 GPIO118_I2C_SDA,
Marek Vasut052345a2010-04-26 21:46:07 +0200143
144 /* IDE */
145 GPIO36_GPIO, /* IDE IRQ */
146 GPIO80_DREQ_1,
Marek543cd842010-03-09 04:04:12 +0100147};
148
149/******************************************************************************
150 * NOR Flash
151 ******************************************************************************/
152#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
Marek Vasutbcc399b2010-05-01 06:54:36 +0200153static struct mtd_partition vpac270_nor_partitions[] = {
Marek543cd842010-03-09 04:04:12 +0100154 {
155 .name = "Flash",
156 .offset = 0x00000000,
157 .size = MTDPART_SIZ_FULL,
158 }
159};
160
161static struct physmap_flash_data vpac270_flash_data[] = {
162 {
163 .width = 2, /* bankwidth in bytes */
Marek Vasutbcc399b2010-05-01 06:54:36 +0200164 .parts = vpac270_nor_partitions,
165 .nr_parts = ARRAY_SIZE(vpac270_nor_partitions)
Marek543cd842010-03-09 04:04:12 +0100166 }
167};
168
169static struct resource vpac270_flash_resource = {
170 .start = PXA_CS0_PHYS,
171 .end = PXA_CS0_PHYS + SZ_64M - 1,
172 .flags = IORESOURCE_MEM,
173};
174
175static struct platform_device vpac270_flash = {
176 .name = "physmap-flash",
177 .id = 0,
178 .resource = &vpac270_flash_resource,
179 .num_resources = 1,
180 .dev = {
181 .platform_data = vpac270_flash_data,
182 },
183};
184static void __init vpac270_nor_init(void)
185{
186 platform_device_register(&vpac270_flash);
187}
188#else
189static inline void vpac270_nor_init(void) {}
190#endif
191
192/******************************************************************************
Marek Vasutbcc399b2010-05-01 06:54:36 +0200193 * OneNAND Flash
194 ******************************************************************************/
195#if defined(CONFIG_MTD_ONENAND) || defined(CONFIG_MTD_ONENAND_MODULE)
196static struct mtd_partition vpac270_onenand_partitions[] = {
197 {
198 .name = "Flash",
199 .offset = 0x00000000,
200 .size = MTDPART_SIZ_FULL,
201 }
202};
203
204static struct onenand_platform_data vpac270_onenand_info = {
205 .parts = vpac270_onenand_partitions,
206 .nr_parts = ARRAY_SIZE(vpac270_onenand_partitions),
207};
208
209static struct resource vpac270_onenand_resources[] = {
210 [0] = {
211 .start = PXA_CS0_PHYS,
212 .end = PXA_CS0_PHYS + SZ_1M,
213 .flags = IORESOURCE_MEM,
214 },
215};
216
217static struct platform_device vpac270_onenand = {
218 .name = "onenand-flash",
219 .id = -1,
220 .resource = vpac270_onenand_resources,
221 .num_resources = ARRAY_SIZE(vpac270_onenand_resources),
222 .dev = {
223 .platform_data = &vpac270_onenand_info,
224 },
225};
226
227static void __init vpac270_onenand_init(void)
228{
229 platform_device_register(&vpac270_onenand);
230}
231#else
232static void __init vpac270_onenand_init(void) {}
233#endif
234
235/******************************************************************************
Marek543cd842010-03-09 04:04:12 +0100236 * SD/MMC card controller
237 ******************************************************************************/
238#if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
239static struct pxamci_platform_data vpac270_mci_platform_data = {
240 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
241 .gpio_card_detect = GPIO53_VPAC270_SD_DETECT_N,
242 .gpio_card_ro = GPIO52_VPAC270_SD_READONLY,
243 .detect_delay = 20,
244};
245
246static void __init vpac270_mmc_init(void)
247{
248 pxa_set_mci_info(&vpac270_mci_platform_data);
249}
250#else
251static inline void vpac270_mmc_init(void) {}
252#endif
253
254/******************************************************************************
255 * GPIO keys
256 ******************************************************************************/
257#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
258static struct gpio_keys_button vpac270_pxa_buttons[] = {
259 {KEY_POWER, GPIO1_VPAC270_USER_BTN, 0, "USER BTN"},
260};
261
262static struct gpio_keys_platform_data vpac270_pxa_keys_data = {
263 .buttons = vpac270_pxa_buttons,
264 .nbuttons = ARRAY_SIZE(vpac270_pxa_buttons),
265};
266
267static struct platform_device vpac270_pxa_keys = {
268 .name = "gpio-keys",
269 .id = -1,
270 .dev = {
271 .platform_data = &vpac270_pxa_keys_data,
272 },
273};
274
275static void __init vpac270_keys_init(void)
276{
277 platform_device_register(&vpac270_pxa_keys);
278}
279#else
280static inline void vpac270_keys_init(void) {}
281#endif
282
283/******************************************************************************
284 * LED
285 ******************************************************************************/
286#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
287struct gpio_led vpac270_gpio_leds[] = {
288{
289 .name = "vpac270:orange:user",
290 .default_trigger = "none",
291 .gpio = GPIO15_VPAC270_LED_ORANGE,
292 .active_low = 1,
293}
294};
295
296static struct gpio_led_platform_data vpac270_gpio_led_info = {
297 .leds = vpac270_gpio_leds,
298 .num_leds = ARRAY_SIZE(vpac270_gpio_leds),
299};
300
301static struct platform_device vpac270_leds = {
302 .name = "leds-gpio",
303 .id = -1,
304 .dev = {
305 .platform_data = &vpac270_gpio_led_info,
306 }
307};
308
309static void __init vpac270_leds_init(void)
310{
311 platform_device_register(&vpac270_leds);
312}
313#else
314static inline void vpac270_leds_init(void) {}
315#endif
316
317/******************************************************************************
Marek Vasut3d98f882010-03-10 05:24:27 +0100318 * USB Host
319 ******************************************************************************/
320#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
321static int vpac270_ohci_init(struct device *dev)
322{
323 UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE;
324 return 0;
325}
326
327static struct pxaohci_platform_data vpac270_ohci_info = {
328 .port_mode = PMM_PERPORT_MODE,
329 .flags = ENABLE_PORT1 | ENABLE_PORT2 |
330 POWER_CONTROL_LOW | POWER_SENSE_LOW,
331 .init = vpac270_ohci_init,
332};
333
334static void __init vpac270_uhc_init(void)
335{
336 pxa_set_ohci_info(&vpac270_ohci_info);
337}
338#else
339static inline void vpac270_uhc_init(void) {}
340#endif
341
342/******************************************************************************
343 * USB Gadget
344 ******************************************************************************/
345#if defined(CONFIG_USB_GADGET_PXA27X)||defined(CONFIG_USB_GADGET_PXA27X_MODULE)
346static struct gpio_vbus_mach_info vpac270_gpio_vbus_info = {
347 .gpio_vbus = GPIO41_VPAC270_UDC_DETECT,
348 .gpio_pullup = -1,
349};
350
351static struct platform_device vpac270_gpio_vbus = {
352 .name = "gpio-vbus",
353 .id = -1,
354 .dev = {
355 .platform_data = &vpac270_gpio_vbus_info,
356 },
357};
358
359static void vpac270_udc_command(int cmd)
360{
361 if (cmd == PXA2XX_UDC_CMD_CONNECT)
Marek Vasutfb25cb32010-05-02 06:10:25 +0200362 UP2OCR = UP2OCR_HXOE | UP2OCR_DPPUE;
Marek Vasut3d98f882010-03-10 05:24:27 +0100363 else if (cmd == PXA2XX_UDC_CMD_DISCONNECT)
Marek Vasutfb25cb32010-05-02 06:10:25 +0200364 UP2OCR = UP2OCR_HXOE;
Marek Vasut3d98f882010-03-10 05:24:27 +0100365}
366
367static struct pxa2xx_udc_mach_info vpac270_udc_info __initdata = {
368 .udc_command = vpac270_udc_command,
369 .gpio_pullup = -1,
370};
371
372static void __init vpac270_udc_init(void)
373{
374 pxa_set_udc_info(&vpac270_udc_info);
375 platform_device_register(&vpac270_gpio_vbus);
376}
377#else
378static inline void vpac270_udc_init(void) {}
379#endif
380
381/******************************************************************************
Marek Vasut947fb572010-03-10 05:38:54 +0100382 * Ethernet
383 ******************************************************************************/
384#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
385static struct resource vpac270_dm9000_resources[] = {
386 [0] = {
387 .start = PXA_CS2_PHYS + 0x300,
388 .end = PXA_CS2_PHYS + 0x303,
389 .flags = IORESOURCE_MEM,
390 },
391 [1] = {
392 .start = PXA_CS2_PHYS + 0x304,
393 .end = PXA_CS2_PHYS + 0x343,
394 .flags = IORESOURCE_MEM,
395 },
396 [2] = {
397 .start = IRQ_GPIO(GPIO114_VPAC270_ETH_IRQ),
398 .end = IRQ_GPIO(GPIO114_VPAC270_ETH_IRQ),
399 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
400 },
401};
402
403static struct dm9000_plat_data vpac270_dm9000_platdata = {
404 .flags = DM9000_PLATF_32BITONLY,
405};
406
407static struct platform_device vpac270_dm9000_device = {
408 .name = "dm9000",
409 .id = -1,
410 .num_resources = ARRAY_SIZE(vpac270_dm9000_resources),
411 .resource = vpac270_dm9000_resources,
412 .dev = {
413 .platform_data = &vpac270_dm9000_platdata,
414 }
415};
416
417static void __init vpac270_eth_init(void)
418{
419 platform_device_register(&vpac270_dm9000_device);
420}
421#else
422static inline void vpac270_eth_init(void) {}
423#endif
424
425/******************************************************************************
Marek Vasut1a8fb702010-03-26 04:45:54 +0100426 * Audio and Touchscreen
427 ******************************************************************************/
428#if defined(CONFIG_TOUCHSCREEN_UCB1400) || \
429 defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE)
430static pxa2xx_audio_ops_t vpac270_ac97_pdata = {
431 .reset_gpio = 95,
432};
433
434static struct ucb1400_pdata vpac270_ucb1400_pdata = {
Marek Vasutaeec1342010-04-26 23:23:48 +0200435 .irq = IRQ_GPIO(GPIO113_VPAC270_TS_IRQ),
Marek Vasut1a8fb702010-03-26 04:45:54 +0100436};
437
438static struct platform_device vpac270_ucb1400_device = {
439 .name = "ucb1400_core",
440 .id = -1,
441 .dev = {
442 .platform_data = &vpac270_ucb1400_pdata,
443 },
444};
445
446static void __init vpac270_ts_init(void)
447{
448 pxa_set_ac97_info(&vpac270_ac97_pdata);
449 platform_device_register(&vpac270_ucb1400_device);
450}
451#else
452static inline void vpac270_ts_init(void) {}
453#endif
454
455/******************************************************************************
Marek Vasut83a4a102010-03-26 05:38:10 +0100456 * RTC
457 ******************************************************************************/
458#if defined(CONFIG_RTC_DRV_DS1307) || defined(CONFIG_RTC_DRV_DS1307_MODULE)
459static struct i2c_board_info __initdata vpac270_i2c_devs[] = {
460 {
461 I2C_BOARD_INFO("ds1339", 0x68),
462 },
463};
464
465static void __init vpac270_rtc_init(void)
466{
467 pxa_set_i2c_info(NULL);
468 i2c_register_board_info(0, ARRAY_AND_SIZE(vpac270_i2c_devs));
469}
470#else
471static inline void vpac270_rtc_init(void) {}
472#endif
473
474/******************************************************************************
Marek543cd842010-03-09 04:04:12 +0100475 * Framebuffer
476 ******************************************************************************/
477#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
478static struct pxafb_mode_info vpac270_lcd_modes[] = {
479{
480 .pixclock = 57692,
481 .xres = 640,
482 .yres = 480,
483 .bpp = 32,
484 .depth = 18,
485
486 .left_margin = 144,
487 .right_margin = 32,
488 .upper_margin = 13,
489 .lower_margin = 30,
490
491 .hsync_len = 32,
492 .vsync_len = 2,
493
494 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
495},
496};
497
498static struct pxafb_mach_info vpac270_lcd_screen = {
499 .modes = vpac270_lcd_modes,
500 .num_modes = ARRAY_SIZE(vpac270_lcd_modes),
501 .lcd_conn = LCD_COLOR_TFT_18BPP,
502};
503
504static void vpac270_lcd_power(int on, struct fb_var_screeninfo *info)
505{
506 gpio_set_value(GPIO81_VPAC270_BKL_ON, on);
507}
508
509static void __init vpac270_lcd_init(void)
510{
511 int ret;
512
513 ret = gpio_request(GPIO81_VPAC270_BKL_ON, "BKL-ON");
514 if (ret) {
515 pr_err("Requesting BKL-ON GPIO failed!\n");
516 goto err;
517 }
518
519 ret = gpio_direction_output(GPIO81_VPAC270_BKL_ON, 1);
520 if (ret) {
521 pr_err("Setting BKL-ON GPIO direction failed!\n");
522 goto err2;
523 }
524
525 vpac270_lcd_screen.pxafb_lcd_power = vpac270_lcd_power;
526 set_pxa_fb_info(&vpac270_lcd_screen);
527 return;
528
529err2:
530 gpio_free(GPIO81_VPAC270_BKL_ON);
531err:
532 return;
533}
534#else
535static inline void vpac270_lcd_init(void) {}
536#endif
537
538/******************************************************************************
Marek Vasut052345a2010-04-26 21:46:07 +0200539 * PATA IDE
540 ******************************************************************************/
541#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
542static struct pata_platform_info vpac270_pata_pdata = {
543 .ioport_shift = 1,
544 .irq_flags = IRQF_TRIGGER_RISING,
545};
546
547static struct resource vpac270_ide_resources[] = {
548 [0] = { /* I/O Base address */
549 .start = PXA_CS3_PHYS + 0x120,
550 .end = PXA_CS3_PHYS + 0x13f,
551 .flags = IORESOURCE_MEM
552 },
553 [1] = { /* CTL Base address */
554 .start = PXA_CS3_PHYS + 0x15c,
555 .end = PXA_CS3_PHYS + 0x15f,
556 .flags = IORESOURCE_MEM
557 },
558 [2] = { /* IDE IRQ pin */
559 .start = gpio_to_irq(GPIO36_VPAC270_IDE_IRQ),
560 .end = gpio_to_irq(GPIO36_VPAC270_IDE_IRQ),
561 .flags = IORESOURCE_IRQ
562 }
563};
564
565static struct platform_device vpac270_ide_device = {
566 .name = "pata_platform",
567 .num_resources = ARRAY_SIZE(vpac270_ide_resources),
568 .resource = vpac270_ide_resources,
569 .dev = {
570 .platform_data = &vpac270_pata_pdata,
571 }
572};
573
574static void __init vpac270_ide_init(void)
575{
576 platform_device_register(&vpac270_ide_device);
577}
578#else
579static inline void vpac270_ide_init(void) {}
580#endif
581
582/******************************************************************************
Marek543cd842010-03-09 04:04:12 +0100583 * Machine init
584 ******************************************************************************/
585static void __init vpac270_init(void)
586{
587 pxa2xx_mfp_config(ARRAY_AND_SIZE(vpac270_pin_config));
588
589 pxa_set_ffuart_info(NULL);
590 pxa_set_btuart_info(NULL);
591 pxa_set_stuart_info(NULL);
592
593 vpac270_lcd_init();
594 vpac270_mmc_init();
595 vpac270_nor_init();
Marek Vasutbcc399b2010-05-01 06:54:36 +0200596 vpac270_onenand_init();
Marek543cd842010-03-09 04:04:12 +0100597 vpac270_leds_init();
598 vpac270_keys_init();
Marek Vasut3d98f882010-03-10 05:24:27 +0100599 vpac270_uhc_init();
600 vpac270_udc_init();
Marek Vasut947fb572010-03-10 05:38:54 +0100601 vpac270_eth_init();
Marek Vasut1a8fb702010-03-26 04:45:54 +0100602 vpac270_ts_init();
Marek Vasut83a4a102010-03-26 05:38:10 +0100603 vpac270_rtc_init();
Marek Vasut052345a2010-04-26 21:46:07 +0200604 vpac270_ide_init();
Marek543cd842010-03-09 04:04:12 +0100605}
606
607MACHINE_START(VPAC270, "Voipac PXA270")
608 .phys_io = 0x40000000,
609 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
610 .boot_params = 0xa0000100,
611 .map_io = pxa_map_io,
612 .init_irq = pxa27x_init_irq,
613 .timer = &pxa_timer,
614 .init_machine = vpac270_init
615MACHINE_END