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/ucb1400.h>
23 #include <asm/mach/arch.h>
24 #include <asm/mach/flash.h>
25 #include <asm/mach-types.h>
26 #include <asm/sizes.h>
28 #include <mach/audio.h>
29 #include <mach/colibri.h>
30 #include <mach/pxa27x.h>
35 /******************************************************************************
36 * Evaluation board MFP
37 ******************************************************************************/
38 #ifdef CONFIG_MACH_COLIBRI_EVALBOARD
39 static mfp_cfg_t colibri_pxa270_evalboard_pin_config
[] __initdata
= {
47 GPIO0_GPIO
, /* SD detect */
70 GPIO53_GPIO
, /* RESET */
71 GPIO83_GPIO
, /* BVD1 */
72 GPIO82_GPIO
, /* BVD2 */
73 GPIO1_GPIO
, /* READY */
74 GPIO84_GPIO
, /* DETECT */
75 GPIO107_GPIO
, /* PPEN */
82 static mfp_cfg_t colibri_pxa270_evalboard_pin_config
[] __initdata
= {};
85 #ifdef CONFIG_MACH_COLIBRI_PXA270_INCOME
86 static mfp_cfg_t income_pin_config
[] __initdata
= {
94 GPIO0_GPIO
, /* SD detect */
95 GPIO1_GPIO
, /* SD read-only */
115 GPIOxx_LCD_TFT_16BPP
,
125 GPIO54_GPIO
, /* LED A */
126 GPIO55_GPIO
, /* LED B */
129 static mfp_cfg_t income_pin_config
[] __initdata
= {};
132 /******************************************************************************
134 ******************************************************************************/
135 static mfp_cfg_t colibri_pxa270_pin_config
[] __initdata
= {
137 GPIO78_nCS_2
, /* Ethernet CS */
138 GPIO114_GPIO
, /* Ethernet IRQ */
142 GPIO29_AC97_SDATA_IN_0
,
143 GPIO30_AC97_SDATA_OUT
,
147 GPIO113_GPIO
, /* Touchscreen IRQ */
150 /******************************************************************************
152 ******************************************************************************/
153 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
154 static struct mtd_partition colibri_partitions
[] = {
156 .name
= "Bootloader",
157 .offset
= 0x00000000,
159 .mask_flags
= MTD_WRITEABLE
/* force read-only */
162 .offset
= 0x00040000,
167 .offset
= 0x00440000,
168 .size
= MTDPART_SIZ_FULL
,
173 static struct physmap_flash_data colibri_flash_data
[] = {
175 .width
= 4, /* bankwidth in bytes */
176 .parts
= colibri_partitions
,
177 .nr_parts
= ARRAY_SIZE(colibri_partitions
)
181 static struct resource colibri_pxa270_flash_resource
= {
182 .start
= PXA_CS0_PHYS
,
183 .end
= PXA_CS0_PHYS
+ SZ_32M
- 1,
184 .flags
= IORESOURCE_MEM
,
187 static struct platform_device colibri_pxa270_flash_device
= {
188 .name
= "physmap-flash",
191 .platform_data
= colibri_flash_data
,
193 .resource
= &colibri_pxa270_flash_resource
,
197 static void __init
colibri_pxa270_nor_init(void)
199 platform_device_register(&colibri_pxa270_flash_device
);
202 static inline void colibri_pxa270_nor_init(void) {}
205 /******************************************************************************
207 ******************************************************************************/
208 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
209 static struct resource colibri_pxa270_dm9000_resources
[] = {
211 .start
= PXA_CS2_PHYS
,
212 .end
= PXA_CS2_PHYS
+ 3,
213 .flags
= IORESOURCE_MEM
,
216 .start
= PXA_CS2_PHYS
+ 4,
217 .end
= PXA_CS2_PHYS
+ 4 + 500,
218 .flags
= IORESOURCE_MEM
,
221 .start
= PXA_GPIO_TO_IRQ(GPIO114_COLIBRI_PXA270_ETH_IRQ
),
222 .end
= PXA_GPIO_TO_IRQ(GPIO114_COLIBRI_PXA270_ETH_IRQ
),
223 .flags
= IORESOURCE_IRQ
| IRQF_TRIGGER_RISING
,
227 static struct platform_device colibri_pxa270_dm9000_device
= {
230 .num_resources
= ARRAY_SIZE(colibri_pxa270_dm9000_resources
),
231 .resource
= colibri_pxa270_dm9000_resources
,
234 static void __init
colibri_pxa270_eth_init(void)
236 platform_device_register(&colibri_pxa270_dm9000_device
);
239 static inline void colibri_pxa270_eth_init(void) {}
242 /******************************************************************************
243 * Audio and Touchscreen
244 ******************************************************************************/
245 #if defined(CONFIG_TOUCHSCREEN_UCB1400) || \
246 defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE)
247 static pxa2xx_audio_ops_t colibri_pxa270_ac97_pdata
= {
251 static struct ucb1400_pdata colibri_pxa270_ucb1400_pdata
= {
252 .irq
= PXA_GPIO_TO_IRQ(GPIO113_COLIBRI_PXA270_TS_IRQ
),
255 static struct platform_device colibri_pxa270_ucb1400_device
= {
256 .name
= "ucb1400_core",
259 .platform_data
= &colibri_pxa270_ucb1400_pdata
,
263 static void __init
colibri_pxa270_tsc_init(void)
265 pxa_set_ac97_info(&colibri_pxa270_ac97_pdata
);
266 platform_device_register(&colibri_pxa270_ucb1400_device
);
269 static inline void colibri_pxa270_tsc_init(void) {}
272 static int colibri_pxa270_baseboard
;
273 core_param(colibri_pxa270_baseboard
, colibri_pxa270_baseboard
, int, 0444);
275 static void __init
colibri_pxa270_init(void)
277 pxa2xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa270_pin_config
));
279 colibri_pxa270_nor_init();
280 colibri_pxa270_eth_init();
281 colibri_pxa270_tsc_init();
283 switch (colibri_pxa270_baseboard
) {
284 case COLIBRI_EVALBOARD
:
285 pxa2xx_mfp_config(ARRAY_AND_SIZE(
286 colibri_pxa270_evalboard_pin_config
));
287 colibri_evalboard_init();
289 case COLIBRI_PXA270_INCOME
:
290 pxa2xx_mfp_config(ARRAY_AND_SIZE(income_pin_config
));
291 colibri_pxa270_income_boardinit();
294 printk(KERN_ERR
"Illegal colibri_pxa270_baseboard type %d\n",
295 colibri_pxa270_baseboard
);
299 /* The "Income s.r.o. SH-Dmaster PXA270 SBC" board can be booted either
300 * with the INCOME mach type or with COLIBRI and the kernel parameter
301 * "colibri_pxa270_baseboard=1"
303 static void __init
colibri_pxa270_income_init(void)
305 colibri_pxa270_baseboard
= COLIBRI_PXA270_INCOME
;
306 colibri_pxa270_init();
309 MACHINE_START(COLIBRI
, "Toradex Colibri PXA270")
310 .atag_offset
= 0x100,
311 .init_machine
= colibri_pxa270_init
,
312 .map_io
= pxa27x_map_io
,
313 .init_irq
= pxa27x_init_irq
,
314 .handle_irq
= pxa27x_handle_irq
,
316 .restart
= pxa_restart
,
319 MACHINE_START(INCOME
, "Income s.r.o. SH-Dmaster PXA270 SBC")
320 .atag_offset
= 0x100,
321 .init_machine
= colibri_pxa270_income_init
,
322 .map_io
= pxa27x_map_io
,
323 .init_irq
= pxa27x_init_irq
,
324 .handle_irq
= pxa27x_handle_irq
,
326 .restart
= pxa_restart
,