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