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>
34 /******************************************************************************
35 * Evaluation board MFP
36 ******************************************************************************/
37 #ifdef CONFIG_MACH_COLIBRI_EVALBOARD
38 static mfp_cfg_t colibri_pxa270_evalboard_pin_config[] __initdata = {
46 GPIO0_GPIO, /* SD detect */
69 GPIO53_GPIO, /* RESET */
70 GPIO83_GPIO, /* BVD1 */
71 GPIO82_GPIO, /* BVD2 */
72 GPIO1_GPIO, /* READY */
73 GPIO84_GPIO, /* DETECT */
74 GPIO107_GPIO, /* PPEN */
81 static mfp_cfg_t colibri_pxa270_evalboard_pin_config[] __initdata = {};
84 #ifdef CONFIG_MACH_COLIBRI_PXA270_INCOME
85 static mfp_cfg_t income_pin_config[] __initdata = {
93 GPIO0_GPIO, /* SD detect */
94 GPIO1_GPIO, /* SD read-only */
114 GPIOxx_LCD_TFT_16BPP,
124 GPIO54_GPIO, /* LED A */
125 GPIO55_GPIO, /* LED B */
128 static mfp_cfg_t income_pin_config[] __initdata = {};
131 /******************************************************************************
133 ******************************************************************************/
134 static mfp_cfg_t colibri_pxa270_pin_config[] __initdata = {
136 GPIO78_nCS_2, /* Ethernet CS */
137 GPIO114_GPIO, /* Ethernet IRQ */
141 GPIO29_AC97_SDATA_IN_0,
142 GPIO30_AC97_SDATA_OUT,
146 GPIO113_GPIO, /* Touchscreen IRQ */
149 /******************************************************************************
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,
158 .mask_flags = MTD_WRITEABLE /* force read-only */
161 .offset = 0x00040000,
166 .offset = 0x00440000,
167 .size = MTDPART_SIZ_FULL,
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",
190 .platform_data = colibri_flash_data,
192 .resource = &colibri_pxa270_flash_resource,
196 static void __init colibri_pxa270_nor_init(void)
198 platform_device_register(&colibri_pxa270_flash_device);
201 static inline void colibri_pxa270_nor_init(void) {}
204 /******************************************************************************
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 = {
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);
238 static inline void colibri_pxa270_eth_init(void) {}
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 = {
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",
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);
268 static inline void colibri_pxa270_tsc_init(void) {}
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();
288 case COLIBRI_PXA270_INCOME:
289 pxa2xx_mfp_config(ARRAY_AND_SIZE(income_pin_config));
290 colibri_pxa270_income_boardinit();
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 .boot_params = COLIBRI_SDRAM_BASE + 0x100,
310 .init_machine = colibri_pxa270_init,
311 .map_io = pxa27x_map_io,
312 .init_irq = pxa27x_init_irq,
316 MACHINE_START(INCOME, "Income s.r.o. SH-Dmaster PXA270 SBC")
317 .boot_params = 0xa0000100,
318 .init_machine = colibri_pxa270_income_init,
319 .map_io = pxa27x_map_io,
320 .init_irq = pxa27x_init_irq,