[ARM] pxa: add support for Voipac PXA270 PCMCIA
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / arm / mach-pxa / vpac270.c
blobf1b073707f0342d3933e980e3eb1d420aefcabd8
1 /*
2 * Hardware definitions for Voipac PXA270
4 * Copyright (C) 2010
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/mtd/mtd.h>
21 #include <linux/mtd/partitions.h>
22 #include <linux/mtd/physmap.h>
24 #include <asm/mach-types.h>
25 #include <asm/mach/arch.h>
27 #include <mach/pxa27x.h>
28 #include <mach/vpac270.h>
29 #include <mach/mmc.h>
30 #include <mach/pxafb.h>
32 #include "generic.h"
33 #include "devices.h"
35 /******************************************************************************
36 * Pin configuration
37 ******************************************************************************/
38 static unsigned long vpac270_pin_config[] __initdata = {
39 /* MMC */
40 GPIO32_MMC_CLK,
41 GPIO92_MMC_DAT_0,
42 GPIO109_MMC_DAT_1,
43 GPIO110_MMC_DAT_2,
44 GPIO111_MMC_DAT_3,
45 GPIO112_MMC_CMD,
46 GPIO53_GPIO, /* SD detect */
47 GPIO52_GPIO, /* SD r/o switch */
49 /* GPIO KEYS */
50 GPIO1_GPIO, /* USER BTN */
52 /* LEDs */
53 GPIO15_GPIO, /* orange led */
55 /* FFUART */
56 GPIO34_FFUART_RXD,
57 GPIO39_FFUART_TXD,
58 GPIO27_FFUART_RTS,
59 GPIO100_FFUART_CTS,
60 GPIO33_FFUART_DSR,
61 GPIO40_FFUART_DTR,
62 GPIO10_FFUART_DCD,
63 GPIO38_FFUART_RI,
65 /* LCD */
66 GPIO58_LCD_LDD_0,
67 GPIO59_LCD_LDD_1,
68 GPIO60_LCD_LDD_2,
69 GPIO61_LCD_LDD_3,
70 GPIO62_LCD_LDD_4,
71 GPIO63_LCD_LDD_5,
72 GPIO64_LCD_LDD_6,
73 GPIO65_LCD_LDD_7,
74 GPIO66_LCD_LDD_8,
75 GPIO67_LCD_LDD_9,
76 GPIO68_LCD_LDD_10,
77 GPIO69_LCD_LDD_11,
78 GPIO70_LCD_LDD_12,
79 GPIO71_LCD_LDD_13,
80 GPIO72_LCD_LDD_14,
81 GPIO73_LCD_LDD_15,
82 GPIO86_LCD_LDD_16,
83 GPIO87_LCD_LDD_17,
84 GPIO74_LCD_FCLK,
85 GPIO75_LCD_LCLK,
86 GPIO76_LCD_PCLK,
87 GPIO77_LCD_BIAS,
89 /* PCMCIA */
90 GPIO48_nPOE,
91 GPIO49_nPWE,
92 GPIO50_nPIOR,
93 GPIO51_nPIOW,
94 GPIO85_nPCE_1,
95 GPIO54_nPCE_2,
96 GPIO55_nPREG,
97 GPIO57_nIOIS16,
98 GPIO56_nPWAIT,
99 GPIO104_PSKTSEL,
100 GPIO84_GPIO, /* PCMCIA CD */
101 GPIO35_GPIO, /* PCMCIA RDY */
102 GPIO107_GPIO, /* PCMCIA PPEN */
103 GPIO11_GPIO, /* PCMCIA RESET */
104 GPIO17_GPIO, /* CF CD */
105 GPIO12_GPIO, /* CF RDY */
106 GPIO16_GPIO, /* CF RESET */
110 /******************************************************************************
111 * NOR Flash
112 ******************************************************************************/
113 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
114 static struct mtd_partition vpac270_partitions[] = {
116 .name = "Flash",
117 .offset = 0x00000000,
118 .size = MTDPART_SIZ_FULL,
122 static struct physmap_flash_data vpac270_flash_data[] = {
124 .width = 2, /* bankwidth in bytes */
125 .parts = vpac270_partitions,
126 .nr_parts = ARRAY_SIZE(vpac270_partitions)
130 static struct resource vpac270_flash_resource = {
131 .start = PXA_CS0_PHYS,
132 .end = PXA_CS0_PHYS + SZ_64M - 1,
133 .flags = IORESOURCE_MEM,
136 static struct platform_device vpac270_flash = {
137 .name = "physmap-flash",
138 .id = 0,
139 .resource = &vpac270_flash_resource,
140 .num_resources = 1,
141 .dev = {
142 .platform_data = vpac270_flash_data,
145 static void __init vpac270_nor_init(void)
147 platform_device_register(&vpac270_flash);
149 #else
150 static inline void vpac270_nor_init(void) {}
151 #endif
153 /******************************************************************************
154 * SD/MMC card controller
155 ******************************************************************************/
156 #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
157 static struct pxamci_platform_data vpac270_mci_platform_data = {
158 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
159 .gpio_card_detect = GPIO53_VPAC270_SD_DETECT_N,
160 .gpio_card_ro = GPIO52_VPAC270_SD_READONLY,
161 .detect_delay = 20,
164 static void __init vpac270_mmc_init(void)
166 pxa_set_mci_info(&vpac270_mci_platform_data);
168 #else
169 static inline void vpac270_mmc_init(void) {}
170 #endif
172 /******************************************************************************
173 * GPIO keys
174 ******************************************************************************/
175 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
176 static struct gpio_keys_button vpac270_pxa_buttons[] = {
177 {KEY_POWER, GPIO1_VPAC270_USER_BTN, 0, "USER BTN"},
180 static struct gpio_keys_platform_data vpac270_pxa_keys_data = {
181 .buttons = vpac270_pxa_buttons,
182 .nbuttons = ARRAY_SIZE(vpac270_pxa_buttons),
185 static struct platform_device vpac270_pxa_keys = {
186 .name = "gpio-keys",
187 .id = -1,
188 .dev = {
189 .platform_data = &vpac270_pxa_keys_data,
193 static void __init vpac270_keys_init(void)
195 platform_device_register(&vpac270_pxa_keys);
197 #else
198 static inline void vpac270_keys_init(void) {}
199 #endif
201 /******************************************************************************
202 * LED
203 ******************************************************************************/
204 #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
205 struct gpio_led vpac270_gpio_leds[] = {
207 .name = "vpac270:orange:user",
208 .default_trigger = "none",
209 .gpio = GPIO15_VPAC270_LED_ORANGE,
210 .active_low = 1,
214 static struct gpio_led_platform_data vpac270_gpio_led_info = {
215 .leds = vpac270_gpio_leds,
216 .num_leds = ARRAY_SIZE(vpac270_gpio_leds),
219 static struct platform_device vpac270_leds = {
220 .name = "leds-gpio",
221 .id = -1,
222 .dev = {
223 .platform_data = &vpac270_gpio_led_info,
227 static void __init vpac270_leds_init(void)
229 platform_device_register(&vpac270_leds);
231 #else
232 static inline void vpac270_leds_init(void) {}
233 #endif
235 /******************************************************************************
236 * Framebuffer
237 ******************************************************************************/
238 #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
239 static struct pxafb_mode_info vpac270_lcd_modes[] = {
241 .pixclock = 57692,
242 .xres = 640,
243 .yres = 480,
244 .bpp = 32,
245 .depth = 18,
247 .left_margin = 144,
248 .right_margin = 32,
249 .upper_margin = 13,
250 .lower_margin = 30,
252 .hsync_len = 32,
253 .vsync_len = 2,
255 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
259 static struct pxafb_mach_info vpac270_lcd_screen = {
260 .modes = vpac270_lcd_modes,
261 .num_modes = ARRAY_SIZE(vpac270_lcd_modes),
262 .lcd_conn = LCD_COLOR_TFT_18BPP,
265 static void vpac270_lcd_power(int on, struct fb_var_screeninfo *info)
267 gpio_set_value(GPIO81_VPAC270_BKL_ON, on);
270 static void __init vpac270_lcd_init(void)
272 int ret;
274 ret = gpio_request(GPIO81_VPAC270_BKL_ON, "BKL-ON");
275 if (ret) {
276 pr_err("Requesting BKL-ON GPIO failed!\n");
277 goto err;
280 ret = gpio_direction_output(GPIO81_VPAC270_BKL_ON, 1);
281 if (ret) {
282 pr_err("Setting BKL-ON GPIO direction failed!\n");
283 goto err2;
286 vpac270_lcd_screen.pxafb_lcd_power = vpac270_lcd_power;
287 set_pxa_fb_info(&vpac270_lcd_screen);
288 return;
290 err2:
291 gpio_free(GPIO81_VPAC270_BKL_ON);
292 err:
293 return;
295 #else
296 static inline void vpac270_lcd_init(void) {}
297 #endif
299 /******************************************************************************
300 * Machine init
301 ******************************************************************************/
302 static void __init vpac270_init(void)
304 pxa2xx_mfp_config(ARRAY_AND_SIZE(vpac270_pin_config));
306 pxa_set_ffuart_info(NULL);
307 pxa_set_btuart_info(NULL);
308 pxa_set_stuart_info(NULL);
310 vpac270_lcd_init();
311 vpac270_mmc_init();
312 vpac270_nor_init();
313 vpac270_leds_init();
314 vpac270_keys_init();
317 MACHINE_START(VPAC270, "Voipac PXA270")
318 .phys_io = 0x40000000,
319 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
320 .boot_params = 0xa0000100,
321 .map_io = pxa_map_io,
322 .init_irq = pxa27x_init_irq,
323 .timer = &pxa_timer,
324 .init_machine = vpac270_init
325 MACHINE_END