2 * Hardware definitions for Voipac PXA270
5 * Marek Vasut <marek.vasut@gmail.com>
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.
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>
20 #include <linux/usb/gpio_vbus.h>
21 #include <linux/mtd/mtd.h>
22 #include <linux/mtd/partitions.h>
23 #include <linux/mtd/physmap.h>
24 #include <linux/mtd/onenand.h>
25 #include <linux/dm9000.h>
26 #include <linux/ucb1400.h>
27 #include <linux/ata_platform.h>
29 #include <asm/mach-types.h>
30 #include <asm/mach/arch.h>
32 #include <mach/pxa27x.h>
33 #include <mach/audio.h>
34 #include <mach/vpac270.h>
36 #include <mach/pxafb.h>
37 #include <mach/ohci.h>
38 #include <mach/pxa27x-udc.h>
46 /******************************************************************************
48 ******************************************************************************/
49 static unsigned long vpac270_pin_config[] __initdata = {
57 GPIO53_GPIO, /* SD detect */
58 GPIO52_GPIO, /* SD r/o switch */
61 GPIO1_GPIO, /* USER BTN */
64 GPIO15_GPIO, /* orange led */
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 */
129 GPIO114_GPIO, /* IRQ */
133 GPIO29_AC97_SDATA_IN_0,
134 GPIO30_AC97_SDATA_OUT,
138 GPIO113_GPIO, /* TS IRQ */
145 GPIO36_GPIO, /* IDE IRQ */
149 /******************************************************************************
151 ******************************************************************************/
152 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
153 static struct mtd_partition vpac270_nor_partitions[] = {
156 .offset = 0x00000000,
157 .size = MTDPART_SIZ_FULL,
161 static struct physmap_flash_data vpac270_flash_data[] = {
163 .width = 2, /* bankwidth in bytes */
164 .parts = vpac270_nor_partitions,
165 .nr_parts = ARRAY_SIZE(vpac270_nor_partitions)
169 static struct resource vpac270_flash_resource = {
170 .start = PXA_CS0_PHYS,
171 .end = PXA_CS0_PHYS + SZ_64M - 1,
172 .flags = IORESOURCE_MEM,
175 static struct platform_device vpac270_flash = {
176 .name = "physmap-flash",
178 .resource = &vpac270_flash_resource,
181 .platform_data = vpac270_flash_data,
184 static void __init vpac270_nor_init(void)
186 platform_device_register(&vpac270_flash);
189 static inline void vpac270_nor_init(void) {}
192 /******************************************************************************
194 ******************************************************************************/
195 #if defined(CONFIG_MTD_ONENAND) || defined(CONFIG_MTD_ONENAND_MODULE)
196 static struct mtd_partition vpac270_onenand_partitions[] = {
199 .offset = 0x00000000,
200 .size = MTDPART_SIZ_FULL,
204 static struct onenand_platform_data vpac270_onenand_info = {
205 .parts = vpac270_onenand_partitions,
206 .nr_parts = ARRAY_SIZE(vpac270_onenand_partitions),
209 static struct resource vpac270_onenand_resources[] = {
211 .start = PXA_CS0_PHYS,
212 .end = PXA_CS0_PHYS + SZ_1M,
213 .flags = IORESOURCE_MEM,
217 static struct platform_device vpac270_onenand = {
218 .name = "onenand-flash",
220 .resource = vpac270_onenand_resources,
221 .num_resources = ARRAY_SIZE(vpac270_onenand_resources),
223 .platform_data = &vpac270_onenand_info,
227 static void __init vpac270_onenand_init(void)
229 platform_device_register(&vpac270_onenand);
232 static void __init vpac270_onenand_init(void) {}
235 /******************************************************************************
236 * SD/MMC card controller
237 ******************************************************************************/
238 #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
239 static 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_ms = 200,
246 static void __init vpac270_mmc_init(void)
248 pxa_set_mci_info(&vpac270_mci_platform_data);
251 static inline void vpac270_mmc_init(void) {}
254 /******************************************************************************
256 ******************************************************************************/
257 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
258 static struct gpio_keys_button vpac270_pxa_buttons[] = {
259 {KEY_POWER, GPIO1_VPAC270_USER_BTN, 0, "USER BTN"},
262 static struct gpio_keys_platform_data vpac270_pxa_keys_data = {
263 .buttons = vpac270_pxa_buttons,
264 .nbuttons = ARRAY_SIZE(vpac270_pxa_buttons),
267 static struct platform_device vpac270_pxa_keys = {
271 .platform_data = &vpac270_pxa_keys_data,
275 static void __init vpac270_keys_init(void)
277 platform_device_register(&vpac270_pxa_keys);
280 static inline void vpac270_keys_init(void) {}
283 /******************************************************************************
285 ******************************************************************************/
286 #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
287 struct gpio_led vpac270_gpio_leds[] = {
289 .name = "vpac270:orange:user",
290 .default_trigger = "none",
291 .gpio = GPIO15_VPAC270_LED_ORANGE,
296 static struct gpio_led_platform_data vpac270_gpio_led_info = {
297 .leds = vpac270_gpio_leds,
298 .num_leds = ARRAY_SIZE(vpac270_gpio_leds),
301 static struct platform_device vpac270_leds = {
305 .platform_data = &vpac270_gpio_led_info,
309 static void __init vpac270_leds_init(void)
311 platform_device_register(&vpac270_leds);
314 static inline void vpac270_leds_init(void) {}
317 /******************************************************************************
319 ******************************************************************************/
320 #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
321 static int vpac270_ohci_init(struct device *dev)
323 UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE;
327 static 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,
334 static void __init vpac270_uhc_init(void)
336 pxa_set_ohci_info(&vpac270_ohci_info);
339 static inline void vpac270_uhc_init(void) {}
342 /******************************************************************************
344 ******************************************************************************/
345 #if defined(CONFIG_USB_GADGET_PXA27X)||defined(CONFIG_USB_GADGET_PXA27X_MODULE)
346 static struct gpio_vbus_mach_info vpac270_gpio_vbus_info = {
347 .gpio_vbus = GPIO41_VPAC270_UDC_DETECT,
351 static struct platform_device vpac270_gpio_vbus = {
355 .platform_data = &vpac270_gpio_vbus_info,
359 static void vpac270_udc_command(int cmd)
361 if (cmd == PXA2XX_UDC_CMD_CONNECT)
362 UP2OCR = UP2OCR_HXOE | UP2OCR_DPPUE;
363 else if (cmd == PXA2XX_UDC_CMD_DISCONNECT)
364 UP2OCR = UP2OCR_HXOE;
367 static struct pxa2xx_udc_mach_info vpac270_udc_info __initdata = {
368 .udc_command = vpac270_udc_command,
372 static void __init vpac270_udc_init(void)
374 pxa_set_udc_info(&vpac270_udc_info);
375 platform_device_register(&vpac270_gpio_vbus);
378 static inline void vpac270_udc_init(void) {}
381 /******************************************************************************
383 ******************************************************************************/
384 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
385 static struct resource vpac270_dm9000_resources[] = {
387 .start = PXA_CS2_PHYS + 0x300,
388 .end = PXA_CS2_PHYS + 0x303,
389 .flags = IORESOURCE_MEM,
392 .start = PXA_CS2_PHYS + 0x304,
393 .end = PXA_CS2_PHYS + 0x343,
394 .flags = IORESOURCE_MEM,
397 .start = IRQ_GPIO(GPIO114_VPAC270_ETH_IRQ),
398 .end = IRQ_GPIO(GPIO114_VPAC270_ETH_IRQ),
399 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
403 static struct dm9000_plat_data vpac270_dm9000_platdata = {
404 .flags = DM9000_PLATF_32BITONLY,
407 static struct platform_device vpac270_dm9000_device = {
410 .num_resources = ARRAY_SIZE(vpac270_dm9000_resources),
411 .resource = vpac270_dm9000_resources,
413 .platform_data = &vpac270_dm9000_platdata,
417 static void __init vpac270_eth_init(void)
419 platform_device_register(&vpac270_dm9000_device);
422 static inline void vpac270_eth_init(void) {}
425 /******************************************************************************
426 * Audio and Touchscreen
427 ******************************************************************************/
428 #if defined(CONFIG_TOUCHSCREEN_UCB1400) || \
429 defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE)
430 static pxa2xx_audio_ops_t vpac270_ac97_pdata = {
434 static struct ucb1400_pdata vpac270_ucb1400_pdata = {
435 .irq = IRQ_GPIO(GPIO113_VPAC270_TS_IRQ),
438 static struct platform_device vpac270_ucb1400_device = {
439 .name = "ucb1400_core",
442 .platform_data = &vpac270_ucb1400_pdata,
446 static void __init vpac270_ts_init(void)
448 pxa_set_ac97_info(&vpac270_ac97_pdata);
449 platform_device_register(&vpac270_ucb1400_device);
452 static inline void vpac270_ts_init(void) {}
455 /******************************************************************************
457 ******************************************************************************/
458 #if defined(CONFIG_RTC_DRV_DS1307) || defined(CONFIG_RTC_DRV_DS1307_MODULE)
459 static struct i2c_board_info __initdata vpac270_i2c_devs[] = {
461 I2C_BOARD_INFO("ds1339", 0x68),
465 static void __init vpac270_rtc_init(void)
467 pxa_set_i2c_info(NULL);
468 i2c_register_board_info(0, ARRAY_AND_SIZE(vpac270_i2c_devs));
471 static inline void vpac270_rtc_init(void) {}
474 /******************************************************************************
476 ******************************************************************************/
477 #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
478 static struct pxafb_mode_info vpac270_lcd_modes[] = {
494 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
498 static 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,
504 static void vpac270_lcd_power(int on, struct fb_var_screeninfo *info)
506 gpio_set_value(GPIO81_VPAC270_BKL_ON, on);
509 static void __init vpac270_lcd_init(void)
513 ret = gpio_request(GPIO81_VPAC270_BKL_ON, "BKL-ON");
515 pr_err("Requesting BKL-ON GPIO failed!\n");
519 ret = gpio_direction_output(GPIO81_VPAC270_BKL_ON, 1);
521 pr_err("Setting BKL-ON GPIO direction failed!\n");
525 vpac270_lcd_screen.pxafb_lcd_power = vpac270_lcd_power;
526 set_pxa_fb_info(&vpac270_lcd_screen);
530 gpio_free(GPIO81_VPAC270_BKL_ON);
535 static inline void vpac270_lcd_init(void) {}
538 /******************************************************************************
540 ******************************************************************************/
541 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
542 static struct pata_platform_info vpac270_pata_pdata = {
544 .irq_flags = IRQF_TRIGGER_RISING,
547 static 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
553 [1] = { /* CTL Base address */
554 .start = PXA_CS3_PHYS + 0x15c,
555 .end = PXA_CS3_PHYS + 0x15f,
556 .flags = IORESOURCE_MEM
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
565 static struct platform_device vpac270_ide_device = {
566 .name = "pata_platform",
567 .num_resources = ARRAY_SIZE(vpac270_ide_resources),
568 .resource = vpac270_ide_resources,
570 .platform_data = &vpac270_pata_pdata,
574 static void __init vpac270_ide_init(void)
576 platform_device_register(&vpac270_ide_device);
579 static inline void vpac270_ide_init(void) {}
582 /******************************************************************************
584 ******************************************************************************/
585 static void __init vpac270_init(void)
587 pxa2xx_mfp_config(ARRAY_AND_SIZE(vpac270_pin_config));
589 pxa_set_ffuart_info(NULL);
590 pxa_set_btuart_info(NULL);
591 pxa_set_stuart_info(NULL);
596 vpac270_onenand_init();
607 MACHINE_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,
614 .init_machine = vpac270_init