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/moduleparam.h>
16 #include <linux/kernel.h>
17 #include <linux/mtd/mtd.h>
18 #include <linux/mtd/partitions.h>
19 #include <linux/mtd/physmap.h>
20 #include <linux/platform_device.h>
21 #include <linux/regulator/machine.h>
22 #include <linux/ucb1400.h>
24 #include <asm/mach/arch.h>
25 #include <asm/mach/flash.h>
26 #include <asm/mach-types.h>
27 #include <asm/sizes.h>
29 #include <mach/audio.h>
36 /******************************************************************************
37 * Evaluation board MFP
38 ******************************************************************************/
39 #ifdef CONFIG_MACH_COLIBRI_EVALBOARD
40 static mfp_cfg_t colibri_pxa270_evalboard_pin_config[] __initdata = {
48 GPIO0_GPIO, /* SD detect */
71 GPIO53_GPIO, /* RESET */
72 GPIO83_GPIO, /* BVD1 */
73 GPIO82_GPIO, /* BVD2 */
74 GPIO1_GPIO, /* READY */
75 GPIO84_GPIO, /* DETECT */
76 GPIO107_GPIO, /* PPEN */
83 static mfp_cfg_t colibri_pxa270_evalboard_pin_config[] __initdata = {};
86 #ifdef CONFIG_MACH_COLIBRI_PXA270_INCOME
87 static mfp_cfg_t income_pin_config[] __initdata = {
95 GPIO0_GPIO, /* SD detect */
96 GPIO1_GPIO, /* SD read-only */
116 GPIOxx_LCD_TFT_16BPP,
126 GPIO54_GPIO, /* LED A */
127 GPIO55_GPIO, /* LED B */
130 static mfp_cfg_t income_pin_config[] __initdata = {};
133 /******************************************************************************
135 ******************************************************************************/
136 static mfp_cfg_t colibri_pxa270_pin_config[] __initdata = {
138 GPIO78_nCS_2, /* Ethernet CS */
139 GPIO114_GPIO, /* Ethernet IRQ */
143 GPIO29_AC97_SDATA_IN_0,
144 GPIO30_AC97_SDATA_OUT,
148 GPIO113_GPIO, /* Touchscreen IRQ */
151 /******************************************************************************
153 ******************************************************************************/
154 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
155 static struct mtd_partition colibri_partitions[] = {
157 .name = "Bootloader",
158 .offset = 0x00000000,
160 .mask_flags = MTD_WRITEABLE /* force read-only */
163 .offset = 0x00040000,
168 .offset = 0x00440000,
169 .size = MTDPART_SIZ_FULL,
174 static struct physmap_flash_data colibri_flash_data[] = {
176 .width = 4, /* bankwidth in bytes */
177 .parts = colibri_partitions,
178 .nr_parts = ARRAY_SIZE(colibri_partitions)
182 static struct resource colibri_pxa270_flash_resource = {
183 .start = PXA_CS0_PHYS,
184 .end = PXA_CS0_PHYS + SZ_32M - 1,
185 .flags = IORESOURCE_MEM,
188 static struct platform_device colibri_pxa270_flash_device = {
189 .name = "physmap-flash",
192 .platform_data = colibri_flash_data,
194 .resource = &colibri_pxa270_flash_resource,
198 static void __init colibri_pxa270_nor_init(void)
200 platform_device_register(&colibri_pxa270_flash_device);
203 static inline void colibri_pxa270_nor_init(void) {}
206 /******************************************************************************
208 ******************************************************************************/
209 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
210 static struct resource colibri_pxa270_dm9000_resources[] = {
212 .start = PXA_CS2_PHYS,
213 .end = PXA_CS2_PHYS + 3,
214 .flags = IORESOURCE_MEM,
217 .start = PXA_CS2_PHYS + 4,
218 .end = PXA_CS2_PHYS + 4 + 500,
219 .flags = IORESOURCE_MEM,
222 .start = PXA_GPIO_TO_IRQ(GPIO114_COLIBRI_PXA270_ETH_IRQ),
223 .end = PXA_GPIO_TO_IRQ(GPIO114_COLIBRI_PXA270_ETH_IRQ),
224 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING,
228 static struct platform_device colibri_pxa270_dm9000_device = {
231 .num_resources = ARRAY_SIZE(colibri_pxa270_dm9000_resources),
232 .resource = colibri_pxa270_dm9000_resources,
235 static void __init colibri_pxa270_eth_init(void)
237 platform_device_register(&colibri_pxa270_dm9000_device);
240 static inline void colibri_pxa270_eth_init(void) {}
243 /******************************************************************************
244 * Audio and Touchscreen
245 ******************************************************************************/
246 #if defined(CONFIG_TOUCHSCREEN_UCB1400) || \
247 defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE)
248 static pxa2xx_audio_ops_t colibri_pxa270_ac97_pdata = {
252 static struct ucb1400_pdata colibri_pxa270_ucb1400_pdata = {
253 .irq = PXA_GPIO_TO_IRQ(GPIO113_COLIBRI_PXA270_TS_IRQ),
256 static struct platform_device colibri_pxa270_ucb1400_device = {
257 .name = "ucb1400_core",
260 .platform_data = &colibri_pxa270_ucb1400_pdata,
264 static void __init colibri_pxa270_tsc_init(void)
266 pxa_set_ac97_info(&colibri_pxa270_ac97_pdata);
267 platform_device_register(&colibri_pxa270_ucb1400_device);
270 static inline void colibri_pxa270_tsc_init(void) {}
273 static int colibri_pxa270_baseboard;
274 core_param(colibri_pxa270_baseboard, colibri_pxa270_baseboard, int, 0444);
276 static void __init colibri_pxa270_init(void)
278 pxa2xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa270_pin_config));
280 colibri_pxa270_nor_init();
281 colibri_pxa270_eth_init();
282 colibri_pxa270_tsc_init();
284 switch (colibri_pxa270_baseboard) {
285 case COLIBRI_EVALBOARD:
286 pxa2xx_mfp_config(ARRAY_AND_SIZE(
287 colibri_pxa270_evalboard_pin_config));
288 colibri_evalboard_init();
290 case COLIBRI_PXA270_INCOME:
291 pxa2xx_mfp_config(ARRAY_AND_SIZE(income_pin_config));
292 colibri_pxa270_income_boardinit();
295 printk(KERN_ERR "Illegal colibri_pxa270_baseboard type %d\n",
296 colibri_pxa270_baseboard);
299 regulator_has_full_constraints();
302 /* The "Income s.r.o. SH-Dmaster PXA270 SBC" board can be booted either
303 * with the INCOME mach type or with COLIBRI and the kernel parameter
304 * "colibri_pxa270_baseboard=1"
306 static void __init colibri_pxa270_income_init(void)
308 colibri_pxa270_baseboard = COLIBRI_PXA270_INCOME;
309 colibri_pxa270_init();
312 MACHINE_START(COLIBRI, "Toradex Colibri PXA270")
313 .atag_offset = 0x100,
314 .init_machine = colibri_pxa270_init,
315 .map_io = pxa27x_map_io,
316 .nr_irqs = PXA_NR_IRQS,
317 .init_irq = pxa27x_init_irq,
318 .handle_irq = pxa27x_handle_irq,
319 .init_time = pxa_timer_init,
320 .restart = pxa_restart,
323 MACHINE_START(INCOME, "Income s.r.o. SH-Dmaster PXA270 SBC")
324 .atag_offset = 0x100,
325 .init_machine = colibri_pxa270_income_init,
326 .map_io = pxa27x_map_io,
327 .nr_irqs = PXA_NR_IRQS,
328 .init_irq = pxa27x_init_irq,
329 .handle_irq = pxa27x_handle_irq,
330 .init_time = pxa_timer_init,
331 .restart = pxa_restart,