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/dm9000.h>
25 #include <linux/ucb1400.h>
27 #include <asm/mach-types.h>
28 #include <asm/mach/arch.h>
30 #include <mach/pxa27x.h>
31 #include <mach/audio.h>
32 #include <mach/vpac270.h>
34 #include <mach/pxafb.h>
35 #include <mach/ohci.h>
36 #include <mach/pxa27x-udc.h>
44 /******************************************************************************
46 ******************************************************************************/
47 static unsigned long vpac270_pin_config[] __initdata = {
55 GPIO53_GPIO, /* SD detect */
56 GPIO52_GPIO, /* SD r/o switch */
59 GPIO1_GPIO, /* USER BTN */
62 GPIO15_GPIO, /* orange led */
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 */
127 GPIO114_GPIO, /* IRQ */
131 GPIO29_AC97_SDATA_IN_0,
132 GPIO30_AC97_SDATA_OUT,
136 GPIO113_GPIO, /* TS IRQ */
143 /******************************************************************************
145 ******************************************************************************/
146 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
147 static struct mtd_partition vpac270_partitions[] = {
150 .offset = 0x00000000,
151 .size = MTDPART_SIZ_FULL,
155 static struct physmap_flash_data vpac270_flash_data[] = {
157 .width = 2, /* bankwidth in bytes */
158 .parts = vpac270_partitions,
159 .nr_parts = ARRAY_SIZE(vpac270_partitions)
163 static struct resource vpac270_flash_resource = {
164 .start = PXA_CS0_PHYS,
165 .end = PXA_CS0_PHYS + SZ_64M - 1,
166 .flags = IORESOURCE_MEM,
169 static struct platform_device vpac270_flash = {
170 .name = "physmap-flash",
172 .resource = &vpac270_flash_resource,
175 .platform_data = vpac270_flash_data,
178 static void __init vpac270_nor_init(void)
180 platform_device_register(&vpac270_flash);
183 static inline void vpac270_nor_init(void) {}
186 /******************************************************************************
187 * SD/MMC card controller
188 ******************************************************************************/
189 #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
190 static struct pxamci_platform_data vpac270_mci_platform_data = {
191 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
192 .gpio_card_detect = GPIO53_VPAC270_SD_DETECT_N,
193 .gpio_card_ro = GPIO52_VPAC270_SD_READONLY,
197 static void __init vpac270_mmc_init(void)
199 pxa_set_mci_info(&vpac270_mci_platform_data);
202 static inline void vpac270_mmc_init(void) {}
205 /******************************************************************************
207 ******************************************************************************/
208 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
209 static struct gpio_keys_button vpac270_pxa_buttons[] = {
210 {KEY_POWER, GPIO1_VPAC270_USER_BTN, 0, "USER BTN"},
213 static struct gpio_keys_platform_data vpac270_pxa_keys_data = {
214 .buttons = vpac270_pxa_buttons,
215 .nbuttons = ARRAY_SIZE(vpac270_pxa_buttons),
218 static struct platform_device vpac270_pxa_keys = {
222 .platform_data = &vpac270_pxa_keys_data,
226 static void __init vpac270_keys_init(void)
228 platform_device_register(&vpac270_pxa_keys);
231 static inline void vpac270_keys_init(void) {}
234 /******************************************************************************
236 ******************************************************************************/
237 #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
238 struct gpio_led vpac270_gpio_leds[] = {
240 .name = "vpac270:orange:user",
241 .default_trigger = "none",
242 .gpio = GPIO15_VPAC270_LED_ORANGE,
247 static struct gpio_led_platform_data vpac270_gpio_led_info = {
248 .leds = vpac270_gpio_leds,
249 .num_leds = ARRAY_SIZE(vpac270_gpio_leds),
252 static struct platform_device vpac270_leds = {
256 .platform_data = &vpac270_gpio_led_info,
260 static void __init vpac270_leds_init(void)
262 platform_device_register(&vpac270_leds);
265 static inline void vpac270_leds_init(void) {}
268 /******************************************************************************
270 ******************************************************************************/
271 #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
272 static int vpac270_ohci_init(struct device *dev)
274 UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE;
278 static struct pxaohci_platform_data vpac270_ohci_info = {
279 .port_mode = PMM_PERPORT_MODE,
280 .flags = ENABLE_PORT1 | ENABLE_PORT2 |
281 POWER_CONTROL_LOW | POWER_SENSE_LOW,
282 .init = vpac270_ohci_init,
285 static void __init vpac270_uhc_init(void)
287 pxa_set_ohci_info(&vpac270_ohci_info);
290 static inline void vpac270_uhc_init(void) {}
293 /******************************************************************************
295 ******************************************************************************/
296 #if defined(CONFIG_USB_GADGET_PXA27X)||defined(CONFIG_USB_GADGET_PXA27X_MODULE)
297 static struct gpio_vbus_mach_info vpac270_gpio_vbus_info = {
298 .gpio_vbus = GPIO41_VPAC270_UDC_DETECT,
302 static struct platform_device vpac270_gpio_vbus = {
306 .platform_data = &vpac270_gpio_vbus_info,
310 static void vpac270_udc_command(int cmd)
312 if (cmd == PXA2XX_UDC_CMD_CONNECT)
313 UP2OCR |= UP2OCR_HXOE | UP2OCR_DPPUE | UP2OCR_DPPUBE;
314 else if (cmd == PXA2XX_UDC_CMD_DISCONNECT)
315 UP2OCR &= ~(UP2OCR_HXOE | UP2OCR_DPPUE | UP2OCR_DPPUBE);
318 static struct pxa2xx_udc_mach_info vpac270_udc_info __initdata = {
319 .udc_command = vpac270_udc_command,
323 static void __init vpac270_udc_init(void)
325 pxa_set_udc_info(&vpac270_udc_info);
326 platform_device_register(&vpac270_gpio_vbus);
329 static inline void vpac270_udc_init(void) {}
332 /******************************************************************************
334 ******************************************************************************/
335 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
336 static struct resource vpac270_dm9000_resources[] = {
338 .start = PXA_CS2_PHYS + 0x300,
339 .end = PXA_CS2_PHYS + 0x303,
340 .flags = IORESOURCE_MEM,
343 .start = PXA_CS2_PHYS + 0x304,
344 .end = PXA_CS2_PHYS + 0x343,
345 .flags = IORESOURCE_MEM,
348 .start = IRQ_GPIO(GPIO114_VPAC270_ETH_IRQ),
349 .end = IRQ_GPIO(GPIO114_VPAC270_ETH_IRQ),
350 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
354 static struct dm9000_plat_data vpac270_dm9000_platdata = {
355 .flags = DM9000_PLATF_32BITONLY,
358 static struct platform_device vpac270_dm9000_device = {
361 .num_resources = ARRAY_SIZE(vpac270_dm9000_resources),
362 .resource = vpac270_dm9000_resources,
364 .platform_data = &vpac270_dm9000_platdata,
368 static void __init vpac270_eth_init(void)
370 platform_device_register(&vpac270_dm9000_device);
373 static inline void vpac270_eth_init(void) {}
376 /******************************************************************************
377 * Audio and Touchscreen
378 ******************************************************************************/
379 #if defined(CONFIG_TOUCHSCREEN_UCB1400) || \
380 defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE)
381 static pxa2xx_audio_ops_t vpac270_ac97_pdata = {
385 static struct ucb1400_pdata vpac270_ucb1400_pdata = {
386 .irq = IRQ_GPIO(113),
389 static struct platform_device vpac270_ucb1400_device = {
390 .name = "ucb1400_core",
393 .platform_data = &vpac270_ucb1400_pdata,
397 static void __init vpac270_ts_init(void)
399 pxa_set_ac97_info(&vpac270_ac97_pdata);
400 platform_device_register(&vpac270_ucb1400_device);
403 static inline void vpac270_ts_init(void) {}
406 /******************************************************************************
408 ******************************************************************************/
409 #if defined(CONFIG_RTC_DRV_DS1307) || defined(CONFIG_RTC_DRV_DS1307_MODULE)
410 static struct i2c_board_info __initdata vpac270_i2c_devs[] = {
412 I2C_BOARD_INFO("ds1339", 0x68),
416 static void __init vpac270_rtc_init(void)
418 pxa_set_i2c_info(NULL);
419 i2c_register_board_info(0, ARRAY_AND_SIZE(vpac270_i2c_devs));
422 static inline void vpac270_rtc_init(void) {}
425 /******************************************************************************
427 ******************************************************************************/
428 #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
429 static struct pxafb_mode_info vpac270_lcd_modes[] = {
445 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
449 static struct pxafb_mach_info vpac270_lcd_screen = {
450 .modes = vpac270_lcd_modes,
451 .num_modes = ARRAY_SIZE(vpac270_lcd_modes),
452 .lcd_conn = LCD_COLOR_TFT_18BPP,
455 static void vpac270_lcd_power(int on, struct fb_var_screeninfo *info)
457 gpio_set_value(GPIO81_VPAC270_BKL_ON, on);
460 static void __init vpac270_lcd_init(void)
464 ret = gpio_request(GPIO81_VPAC270_BKL_ON, "BKL-ON");
466 pr_err("Requesting BKL-ON GPIO failed!\n");
470 ret = gpio_direction_output(GPIO81_VPAC270_BKL_ON, 1);
472 pr_err("Setting BKL-ON GPIO direction failed!\n");
476 vpac270_lcd_screen.pxafb_lcd_power = vpac270_lcd_power;
477 set_pxa_fb_info(&vpac270_lcd_screen);
481 gpio_free(GPIO81_VPAC270_BKL_ON);
486 static inline void vpac270_lcd_init(void) {}
489 /******************************************************************************
491 ******************************************************************************/
492 static void __init vpac270_init(void)
494 pxa2xx_mfp_config(ARRAY_AND_SIZE(vpac270_pin_config));
496 pxa_set_ffuart_info(NULL);
497 pxa_set_btuart_info(NULL);
498 pxa_set_stuart_info(NULL);
512 MACHINE_START(VPAC270, "Voipac PXA270")
513 .phys_io = 0x40000000,
514 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
515 .boot_params = 0xa0000100,
516 .map_io = pxa_map_io,
517 .init_irq = pxa27x_init_irq,
519 .init_machine = vpac270_init