diff options
Diffstat (limited to 'arch/arm/mach-pxa/vpac270.c')
-rw-r--r-- | arch/arm/mach-pxa/vpac270.c | 305 |
1 files changed, 305 insertions, 0 deletions
diff --git a/arch/arm/mach-pxa/vpac270.c b/arch/arm/mach-pxa/vpac270.c new file mode 100644 index 000000000000..710a17c80a14 --- /dev/null +++ b/arch/arm/mach-pxa/vpac270.c | |||
@@ -0,0 +1,305 @@ | |||
1 | /* | ||
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> | ||
20 | #include <linux/mtd/mtd.h> | ||
21 | #include <linux/mtd/partitions.h> | ||
22 | #include <linux/mtd/physmap.h> | ||
23 | |||
24 | #include <asm/mach-types.h> | ||
25 | #include <asm/mach/arch.h> | ||
26 | |||
27 | #include <mach/pxa27x.h> | ||
28 | #include <mach/vpac270.h> | ||
29 | #include <mach/mmc.h> | ||
30 | #include <mach/pxafb.h> | ||
31 | |||
32 | #include "generic.h" | ||
33 | #include "devices.h" | ||
34 | |||
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 */ | ||
48 | |||
49 | /* GPIO KEYS */ | ||
50 | GPIO1_GPIO, /* USER BTN */ | ||
51 | |||
52 | /* LEDs */ | ||
53 | GPIO15_GPIO, /* orange led */ | ||
54 | |||
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, | ||
64 | |||
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, | ||
88 | }; | ||
89 | |||
90 | /****************************************************************************** | ||
91 | * NOR Flash | ||
92 | ******************************************************************************/ | ||
93 | #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) | ||
94 | static struct mtd_partition vpac270_partitions[] = { | ||
95 | { | ||
96 | .name = "Flash", | ||
97 | .offset = 0x00000000, | ||
98 | .size = MTDPART_SIZ_FULL, | ||
99 | } | ||
100 | }; | ||
101 | |||
102 | static struct physmap_flash_data vpac270_flash_data[] = { | ||
103 | { | ||
104 | .width = 2, /* bankwidth in bytes */ | ||
105 | .parts = vpac270_partitions, | ||
106 | .nr_parts = ARRAY_SIZE(vpac270_partitions) | ||
107 | } | ||
108 | }; | ||
109 | |||
110 | static struct resource vpac270_flash_resource = { | ||
111 | .start = PXA_CS0_PHYS, | ||
112 | .end = PXA_CS0_PHYS + SZ_64M - 1, | ||
113 | .flags = IORESOURCE_MEM, | ||
114 | }; | ||
115 | |||
116 | static struct platform_device vpac270_flash = { | ||
117 | .name = "physmap-flash", | ||
118 | .id = 0, | ||
119 | .resource = &vpac270_flash_resource, | ||
120 | .num_resources = 1, | ||
121 | .dev = { | ||
122 | .platform_data = vpac270_flash_data, | ||
123 | }, | ||
124 | }; | ||
125 | static void __init vpac270_nor_init(void) | ||
126 | { | ||
127 | platform_device_register(&vpac270_flash); | ||
128 | } | ||
129 | #else | ||
130 | static inline void vpac270_nor_init(void) {} | ||
131 | #endif | ||
132 | |||
133 | /****************************************************************************** | ||
134 | * SD/MMC card controller | ||
135 | ******************************************************************************/ | ||
136 | #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE) | ||
137 | static struct pxamci_platform_data vpac270_mci_platform_data = { | ||
138 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, | ||
139 | .gpio_card_detect = GPIO53_VPAC270_SD_DETECT_N, | ||
140 | .gpio_card_ro = GPIO52_VPAC270_SD_READONLY, | ||
141 | .detect_delay = 20, | ||
142 | }; | ||
143 | |||
144 | static void __init vpac270_mmc_init(void) | ||
145 | { | ||
146 | pxa_set_mci_info(&vpac270_mci_platform_data); | ||
147 | } | ||
148 | #else | ||
149 | static inline void vpac270_mmc_init(void) {} | ||
150 | #endif | ||
151 | |||
152 | /****************************************************************************** | ||
153 | * GPIO keys | ||
154 | ******************************************************************************/ | ||
155 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) | ||
156 | static struct gpio_keys_button vpac270_pxa_buttons[] = { | ||
157 | {KEY_POWER, GPIO1_VPAC270_USER_BTN, 0, "USER BTN"}, | ||
158 | }; | ||
159 | |||
160 | static struct gpio_keys_platform_data vpac270_pxa_keys_data = { | ||
161 | .buttons = vpac270_pxa_buttons, | ||
162 | .nbuttons = ARRAY_SIZE(vpac270_pxa_buttons), | ||
163 | }; | ||
164 | |||
165 | static struct platform_device vpac270_pxa_keys = { | ||
166 | .name = "gpio-keys", | ||
167 | .id = -1, | ||
168 | .dev = { | ||
169 | .platform_data = &vpac270_pxa_keys_data, | ||
170 | }, | ||
171 | }; | ||
172 | |||
173 | static void __init vpac270_keys_init(void) | ||
174 | { | ||
175 | platform_device_register(&vpac270_pxa_keys); | ||
176 | } | ||
177 | #else | ||
178 | static inline void vpac270_keys_init(void) {} | ||
179 | #endif | ||
180 | |||
181 | /****************************************************************************** | ||
182 | * LED | ||
183 | ******************************************************************************/ | ||
184 | #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) | ||
185 | struct gpio_led vpac270_gpio_leds[] = { | ||
186 | { | ||
187 | .name = "vpac270:orange:user", | ||
188 | .default_trigger = "none", | ||
189 | .gpio = GPIO15_VPAC270_LED_ORANGE, | ||
190 | .active_low = 1, | ||
191 | } | ||
192 | }; | ||
193 | |||
194 | static struct gpio_led_platform_data vpac270_gpio_led_info = { | ||
195 | .leds = vpac270_gpio_leds, | ||
196 | .num_leds = ARRAY_SIZE(vpac270_gpio_leds), | ||
197 | }; | ||
198 | |||
199 | static struct platform_device vpac270_leds = { | ||
200 | .name = "leds-gpio", | ||
201 | .id = -1, | ||
202 | .dev = { | ||
203 | .platform_data = &vpac270_gpio_led_info, | ||
204 | } | ||
205 | }; | ||
206 | |||
207 | static void __init vpac270_leds_init(void) | ||
208 | { | ||
209 | platform_device_register(&vpac270_leds); | ||
210 | } | ||
211 | #else | ||
212 | static inline void vpac270_leds_init(void) {} | ||
213 | #endif | ||
214 | |||
215 | /****************************************************************************** | ||
216 | * Framebuffer | ||
217 | ******************************************************************************/ | ||
218 | #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) | ||
219 | static struct pxafb_mode_info vpac270_lcd_modes[] = { | ||
220 | { | ||
221 | .pixclock = 57692, | ||
222 | .xres = 640, | ||
223 | .yres = 480, | ||
224 | .bpp = 32, | ||
225 | .depth = 18, | ||
226 | |||
227 | .left_margin = 144, | ||
228 | .right_margin = 32, | ||
229 | .upper_margin = 13, | ||
230 | .lower_margin = 30, | ||
231 | |||
232 | .hsync_len = 32, | ||
233 | .vsync_len = 2, | ||
234 | |||
235 | .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, | ||
236 | }, | ||
237 | }; | ||
238 | |||
239 | static struct pxafb_mach_info vpac270_lcd_screen = { | ||
240 | .modes = vpac270_lcd_modes, | ||
241 | .num_modes = ARRAY_SIZE(vpac270_lcd_modes), | ||
242 | .lcd_conn = LCD_COLOR_TFT_18BPP, | ||
243 | }; | ||
244 | |||
245 | static void vpac270_lcd_power(int on, struct fb_var_screeninfo *info) | ||
246 | { | ||
247 | gpio_set_value(GPIO81_VPAC270_BKL_ON, on); | ||
248 | } | ||
249 | |||
250 | static void __init vpac270_lcd_init(void) | ||
251 | { | ||
252 | int ret; | ||
253 | |||
254 | ret = gpio_request(GPIO81_VPAC270_BKL_ON, "BKL-ON"); | ||
255 | if (ret) { | ||
256 | pr_err("Requesting BKL-ON GPIO failed!\n"); | ||
257 | goto err; | ||
258 | } | ||
259 | |||
260 | ret = gpio_direction_output(GPIO81_VPAC270_BKL_ON, 1); | ||
261 | if (ret) { | ||
262 | pr_err("Setting BKL-ON GPIO direction failed!\n"); | ||
263 | goto err2; | ||
264 | } | ||
265 | |||
266 | vpac270_lcd_screen.pxafb_lcd_power = vpac270_lcd_power; | ||
267 | set_pxa_fb_info(&vpac270_lcd_screen); | ||
268 | return; | ||
269 | |||
270 | err2: | ||
271 | gpio_free(GPIO81_VPAC270_BKL_ON); | ||
272 | err: | ||
273 | return; | ||
274 | } | ||
275 | #else | ||
276 | static inline void vpac270_lcd_init(void) {} | ||
277 | #endif | ||
278 | |||
279 | /****************************************************************************** | ||
280 | * Machine init | ||
281 | ******************************************************************************/ | ||
282 | static void __init vpac270_init(void) | ||
283 | { | ||
284 | pxa2xx_mfp_config(ARRAY_AND_SIZE(vpac270_pin_config)); | ||
285 | |||
286 | pxa_set_ffuart_info(NULL); | ||
287 | pxa_set_btuart_info(NULL); | ||
288 | pxa_set_stuart_info(NULL); | ||
289 | |||
290 | vpac270_lcd_init(); | ||
291 | vpac270_mmc_init(); | ||
292 | vpac270_nor_init(); | ||
293 | vpac270_leds_init(); | ||
294 | vpac270_keys_init(); | ||
295 | } | ||
296 | |||
297 | MACHINE_START(VPAC270, "Voipac PXA270") | ||
298 | .phys_io = 0x40000000, | ||
299 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, | ||
300 | .boot_params = 0xa0000100, | ||
301 | .map_io = pxa_map_io, | ||
302 | .init_irq = pxa27x_init_irq, | ||
303 | .timer = &pxa_timer, | ||
304 | .init_machine = vpac270_init | ||
305 | MACHINE_END | ||