Merge remote-tracking branch 'moduleh/module.h-split'
[linux-2.6/next.git] / arch / arm / mach-pxa / colibri-pxa270.c
blob7db66465716f5bc7be2376831bf34b52cf0fdef9
1 /*
2 * linux/arch/arm/mach-pxa/colibri-pxa270.c
4 * Support for Toradex PXA270 based Colibri module
5 * Daniel Mack <daniel@caiaq.de>
6 * Marek Vasut <marek.vasut@gmail.com>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
13 #include <linux/init.h>
14 #include <linux/interrupt.h>
15 #include <linux/kernel.h>
16 #include <linux/mtd/mtd.h>
17 #include <linux/mtd/partitions.h>
18 #include <linux/mtd/physmap.h>
19 #include <linux/platform_device.h>
20 #include <linux/ucb1400.h>
22 #include <asm/mach/arch.h>
23 #include <asm/mach/flash.h>
24 #include <asm/mach-types.h>
25 #include <asm/sizes.h>
27 #include <mach/audio.h>
28 #include <mach/colibri.h>
29 #include <mach/pxa27x.h>
31 #include "devices.h"
32 #include "generic.h"
34 /******************************************************************************
35 * Evaluation board MFP
36 ******************************************************************************/
37 #ifdef CONFIG_MACH_COLIBRI_EVALBOARD
38 static mfp_cfg_t colibri_pxa270_evalboard_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 GPIO0_GPIO, /* SD detect */
48 /* FFUART */
49 GPIO39_FFUART_TXD,
50 GPIO34_FFUART_RXD,
52 /* UHC */
53 GPIO88_USBH1_PWR,
54 GPIO89_USBH1_PEN,
55 GPIO119_USBH2_PWR,
56 GPIO120_USBH2_PEN,
58 /* PCMCIA */
59 GPIO85_nPCE_1,
60 GPIO54_nPCE_2,
61 GPIO55_nPREG,
62 GPIO50_nPIOR,
63 GPIO51_nPIOW,
64 GPIO49_nPWE,
65 GPIO48_nPOE,
66 GPIO57_nIOIS16,
67 GPIO56_nPWAIT,
68 GPIO104_PSKTSEL,
69 GPIO53_GPIO, /* RESET */
70 GPIO83_GPIO, /* BVD1 */
71 GPIO82_GPIO, /* BVD2 */
72 GPIO1_GPIO, /* READY */
73 GPIO84_GPIO, /* DETECT */
74 GPIO107_GPIO, /* PPEN */
76 /* I2C */
77 GPIO117_I2C_SCL,
78 GPIO118_I2C_SDA,
80 #else
81 static mfp_cfg_t colibri_pxa270_evalboard_pin_config[] __initdata = {};
82 #endif
84 #ifdef CONFIG_MACH_COLIBRI_PXA270_INCOME
85 static mfp_cfg_t income_pin_config[] __initdata = {
86 /* MMC */
87 GPIO32_MMC_CLK,
88 GPIO92_MMC_DAT_0,
89 GPIO109_MMC_DAT_1,
90 GPIO110_MMC_DAT_2,
91 GPIO111_MMC_DAT_3,
92 GPIO112_MMC_CMD,
93 GPIO0_GPIO, /* SD detect */
94 GPIO1_GPIO, /* SD read-only */
96 /* FFUART */
97 GPIO39_FFUART_TXD,
98 GPIO34_FFUART_RXD,
100 /* BFUART */
101 GPIO42_BTUART_RXD,
102 GPIO43_BTUART_TXD,
103 GPIO45_BTUART_RTS,
105 /* STUART */
106 GPIO46_STUART_RXD,
107 GPIO47_STUART_TXD,
109 /* UHC */
110 GPIO88_USBH1_PWR,
111 GPIO89_USBH1_PEN,
113 /* LCD */
114 GPIOxx_LCD_TFT_16BPP,
116 /* PWM */
117 GPIO16_PWM0_OUT,
119 /* I2C */
120 GPIO117_I2C_SCL,
121 GPIO118_I2C_SDA,
123 /* LED */
124 GPIO54_GPIO, /* LED A */
125 GPIO55_GPIO, /* LED B */
127 #else
128 static mfp_cfg_t income_pin_config[] __initdata = {};
129 #endif
131 /******************************************************************************
132 * Pin configuration
133 ******************************************************************************/
134 static mfp_cfg_t colibri_pxa270_pin_config[] __initdata = {
135 /* Ethernet */
136 GPIO78_nCS_2, /* Ethernet CS */
137 GPIO114_GPIO, /* Ethernet IRQ */
139 /* AC97 */
140 GPIO28_AC97_BITCLK,
141 GPIO29_AC97_SDATA_IN_0,
142 GPIO30_AC97_SDATA_OUT,
143 GPIO31_AC97_SYNC,
144 GPIO95_AC97_nRESET,
145 GPIO98_AC97_SYSCLK,
146 GPIO113_GPIO, /* Touchscreen IRQ */
149 /******************************************************************************
150 * NOR Flash
151 ******************************************************************************/
152 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
153 static struct mtd_partition colibri_partitions[] = {
155 .name = "Bootloader",
156 .offset = 0x00000000,
157 .size = 0x00040000,
158 .mask_flags = MTD_WRITEABLE /* force read-only */
159 }, {
160 .name = "Kernel",
161 .offset = 0x00040000,
162 .size = 0x00400000,
163 .mask_flags = 0
164 }, {
165 .name = "Rootfs",
166 .offset = 0x00440000,
167 .size = MTDPART_SIZ_FULL,
168 .mask_flags = 0
172 static struct physmap_flash_data colibri_flash_data[] = {
174 .width = 4, /* bankwidth in bytes */
175 .parts = colibri_partitions,
176 .nr_parts = ARRAY_SIZE(colibri_partitions)
180 static struct resource colibri_pxa270_flash_resource = {
181 .start = PXA_CS0_PHYS,
182 .end = PXA_CS0_PHYS + SZ_32M - 1,
183 .flags = IORESOURCE_MEM,
186 static struct platform_device colibri_pxa270_flash_device = {
187 .name = "physmap-flash",
188 .id = 0,
189 .dev = {
190 .platform_data = colibri_flash_data,
192 .resource = &colibri_pxa270_flash_resource,
193 .num_resources = 1,
196 static void __init colibri_pxa270_nor_init(void)
198 platform_device_register(&colibri_pxa270_flash_device);
200 #else
201 static inline void colibri_pxa270_nor_init(void) {}
202 #endif
204 /******************************************************************************
205 * Ethernet
206 ******************************************************************************/
207 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
208 static struct resource colibri_pxa270_dm9000_resources[] = {
210 .start = PXA_CS2_PHYS,
211 .end = PXA_CS2_PHYS + 3,
212 .flags = IORESOURCE_MEM,
215 .start = PXA_CS2_PHYS + 4,
216 .end = PXA_CS2_PHYS + 4 + 500,
217 .flags = IORESOURCE_MEM,
220 .start = gpio_to_irq(GPIO114_COLIBRI_PXA270_ETH_IRQ),
221 .end = gpio_to_irq(GPIO114_COLIBRI_PXA270_ETH_IRQ),
222 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING,
226 static struct platform_device colibri_pxa270_dm9000_device = {
227 .name = "dm9000",
228 .id = -1,
229 .num_resources = ARRAY_SIZE(colibri_pxa270_dm9000_resources),
230 .resource = colibri_pxa270_dm9000_resources,
233 static void __init colibri_pxa270_eth_init(void)
235 platform_device_register(&colibri_pxa270_dm9000_device);
237 #else
238 static inline void colibri_pxa270_eth_init(void) {}
239 #endif
241 /******************************************************************************
242 * Audio and Touchscreen
243 ******************************************************************************/
244 #if defined(CONFIG_TOUCHSCREEN_UCB1400) || \
245 defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE)
246 static pxa2xx_audio_ops_t colibri_pxa270_ac97_pdata = {
247 .reset_gpio = 95,
250 static struct ucb1400_pdata colibri_pxa270_ucb1400_pdata = {
251 .irq = gpio_to_irq(GPIO113_COLIBRI_PXA270_TS_IRQ),
254 static struct platform_device colibri_pxa270_ucb1400_device = {
255 .name = "ucb1400_core",
256 .id = -1,
257 .dev = {
258 .platform_data = &colibri_pxa270_ucb1400_pdata,
262 static void __init colibri_pxa270_tsc_init(void)
264 pxa_set_ac97_info(&colibri_pxa270_ac97_pdata);
265 platform_device_register(&colibri_pxa270_ucb1400_device);
267 #else
268 static inline void colibri_pxa270_tsc_init(void) {}
269 #endif
271 static int colibri_pxa270_baseboard;
272 core_param(colibri_pxa270_baseboard, colibri_pxa270_baseboard, int, 0444);
274 static void __init colibri_pxa270_init(void)
276 pxa2xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa270_pin_config));
278 colibri_pxa270_nor_init();
279 colibri_pxa270_eth_init();
280 colibri_pxa270_tsc_init();
282 switch (colibri_pxa270_baseboard) {
283 case COLIBRI_EVALBOARD:
284 pxa2xx_mfp_config(ARRAY_AND_SIZE(
285 colibri_pxa270_evalboard_pin_config));
286 colibri_evalboard_init();
287 break;
288 case COLIBRI_PXA270_INCOME:
289 pxa2xx_mfp_config(ARRAY_AND_SIZE(income_pin_config));
290 colibri_pxa270_income_boardinit();
291 break;
292 default:
293 printk(KERN_ERR "Illegal colibri_pxa270_baseboard type %d\n",
294 colibri_pxa270_baseboard);
298 /* The "Income s.r.o. SH-Dmaster PXA270 SBC" board can be booted either
299 * with the INCOME mach type or with COLIBRI and the kernel parameter
300 * "colibri_pxa270_baseboard=1"
302 static void __init colibri_pxa270_income_init(void)
304 colibri_pxa270_baseboard = COLIBRI_PXA270_INCOME;
305 colibri_pxa270_init();
308 MACHINE_START(COLIBRI, "Toradex Colibri PXA270")
309 .atag_offset = 0x100,
310 .init_machine = colibri_pxa270_init,
311 .map_io = pxa27x_map_io,
312 .init_irq = pxa27x_init_irq,
313 .handle_irq = pxa27x_handle_irq,
314 .timer = &pxa_timer,
315 MACHINE_END
317 MACHINE_START(INCOME, "Income s.r.o. SH-Dmaster PXA270 SBC")
318 .atag_offset = 0x100,
319 .init_machine = colibri_pxa270_income_init,
320 .map_io = pxa27x_map_io,
321 .init_irq = pxa27x_init_irq,
322 .handle_irq = pxa27x_handle_irq,
323 .timer = &pxa_timer,
324 MACHINE_END