2 * arch/arm/mach-pxa/colibri-pxa320.c
4 * Support for Toradex PXA320/310 based Colibri module
6 * Daniel Mack <daniel@caiaq.de>
7 * Matthias Meier <matthias.j.meier@gmx.net>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
14 #include <linux/init.h>
15 #include <linux/kernel.h>
16 #include <linux/platform_device.h>
17 #include <linux/gpio.h>
18 #include <linux/interrupt.h>
19 #include <linux/usb/gpio_vbus.h>
21 #include <asm/mach-types.h>
22 #include <asm/sizes.h>
23 #include <asm/mach/arch.h>
24 #include <asm/mach/irq.h>
26 #include <mach/pxa320.h>
27 #include <mach/colibri.h>
28 #include <linux/platform_data/video-pxafb.h>
29 #include <linux/platform_data/usb-ohci-pxa27x.h>
30 #include <mach/audio.h>
31 #include <mach/pxa27x-udc.h>
37 #ifdef CONFIG_MACH_COLIBRI_EVALBOARD
38 static mfp_cfg_t colibri_pxa320_evalboard_pin_config
[] __initdata
= {
46 GPIO28_GPIO
, /* SD detect */
48 /* UART 1 configuration (may be set by bootloader) */
58 /* UART 2 configuration */
64 /* UART 3 configuration */
77 MFP_CFG(GPIO59
, AF7
), /* PRST ; AF7 to tristate */
78 MFP_CFG(GPIO61
, AF7
), /* PCE1 ; AF7 to tristate */
79 MFP_CFG(GPIO60
, AF7
), /* PCE2 ; AF7 to tristate */
80 MFP_CFG(GPIO62
, AF7
), /* PCD ; AF7 to tristate */
81 MFP_CFG(GPIO56
, AF7
), /* PSKTSEL ; AF7 to tristate */
82 GPIO27_GPIO
, /* RDnWR ; input/tristate */
83 GPIO50_GPIO
, /* PREG ; input/tristate */
89 GPIO29_GPIO
, /* PRDY (READY GPIO) */
90 GPIO57_GPIO
, /* PPEN (POWER GPIO) */
91 GPIO81_GPIO
, /* PCD (DETECT GPIO) */
92 GPIO77_GPIO
, /* PRST (RESET GPIO) */
93 GPIO53_GPIO
, /* PBVD1 */
94 GPIO79_GPIO
, /* PBVD2 */
95 GPIO54_GPIO
, /* POE */
98 static mfp_cfg_t colibri_pxa320_evalboard_pin_config
[] __initdata
= {};
101 #if defined(CONFIG_AX88796)
102 #define COLIBRI_ETH_IRQ_GPIO mfp_to_gpio(GPIO36_GPIO)
104 * Asix AX88796 Ethernet
106 static struct ax_plat_data colibri_asix_platdata
= {
107 .flags
= 0, /* defined later */
111 static struct resource colibri_asix_resource
[] = {
113 .start
= PXA3xx_CS2_PHYS
,
114 .end
= PXA3xx_CS2_PHYS
+ (0x20 * 2) - 1,
115 .flags
= IORESOURCE_MEM
,
118 .start
= PXA_GPIO_TO_IRQ(COLIBRI_ETH_IRQ_GPIO
),
119 .end
= PXA_GPIO_TO_IRQ(COLIBRI_ETH_IRQ_GPIO
),
120 .flags
= IORESOURCE_IRQ
| IRQF_TRIGGER_FALLING
,
124 static struct platform_device asix_device
= {
127 .num_resources
= ARRAY_SIZE(colibri_asix_resource
),
128 .resource
= colibri_asix_resource
,
130 .platform_data
= &colibri_asix_platdata
134 static mfp_cfg_t colibri_pxa320_eth_pin_config
[] __initdata
= {
135 GPIO3_nCS2
, /* AX88796 chip select */
136 GPIO36_GPIO
| MFP_PULL_HIGH
/* AX88796 IRQ */
139 static void __init
colibri_pxa320_init_eth(void)
141 colibri_pxa3xx_init_eth(&colibri_asix_platdata
);
142 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_eth_pin_config
));
143 platform_device_register(&asix_device
);
146 static inline void __init
colibri_pxa320_init_eth(void) {}
147 #endif /* CONFIG_AX88796 */
149 #if defined(CONFIG_USB_PXA27X)||defined(CONFIG_USB_PXA27X_MODULE)
150 static struct gpio_vbus_mach_info colibri_pxa320_gpio_vbus_info
= {
151 .gpio_vbus
= mfp_to_gpio(MFP_PIN_GPIO96
),
155 static struct platform_device colibri_pxa320_gpio_vbus
= {
159 .platform_data
= &colibri_pxa320_gpio_vbus_info
,
163 static void colibri_pxa320_udc_command(int cmd
)
165 if (cmd
== PXA2XX_UDC_CMD_CONNECT
)
166 UP2OCR
= UP2OCR_HXOE
| UP2OCR_DPPUE
;
167 else if (cmd
== PXA2XX_UDC_CMD_DISCONNECT
)
168 UP2OCR
= UP2OCR_HXOE
;
171 static struct pxa2xx_udc_mach_info colibri_pxa320_udc_info __initdata
= {
172 .udc_command
= colibri_pxa320_udc_command
,
176 static void __init
colibri_pxa320_init_udc(void)
178 pxa_set_udc_info(&colibri_pxa320_udc_info
);
179 platform_device_register(&colibri_pxa320_gpio_vbus
);
182 static inline void colibri_pxa320_init_udc(void) {}
185 #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
186 static mfp_cfg_t colibri_pxa320_lcd_pin_config
[] __initdata
= {
213 static void __init
colibri_pxa320_init_lcd(void)
215 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_lcd_pin_config
));
218 static inline void colibri_pxa320_init_lcd(void) {}
221 #if defined(CONFIG_SND_AC97_CODEC) || \
222 defined(CONFIG_SND_AC97_CODEC_MODULE)
223 static mfp_cfg_t colibri_pxa320_ac97_pin_config
[] __initdata
= {
225 GPIO35_AC97_SDATA_IN_0
,
226 GPIO37_AC97_SDATA_OUT
,
232 static inline void __init
colibri_pxa320_init_ac97(void)
234 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_ac97_pin_config
));
235 pxa_set_ac97_info(NULL
);
238 static inline void colibri_pxa320_init_ac97(void) {}
241 void __init
colibri_pxa320_init(void)
243 colibri_pxa320_init_eth();
244 colibri_pxa3xx_init_nand();
245 colibri_pxa320_init_lcd();
246 colibri_pxa3xx_init_lcd(mfp_to_gpio(GPIO49_GPIO
));
247 colibri_pxa320_init_ac97();
248 colibri_pxa320_init_udc();
251 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_evalboard_pin_config
));
252 colibri_evalboard_init();
255 MACHINE_START(COLIBRI320
, "Toradex Colibri PXA320")
256 .atag_offset
= 0x100,
257 .init_machine
= colibri_pxa320_init
,
258 .map_io
= pxa3xx_map_io
,
259 .nr_irqs
= PXA_NR_IRQS
,
260 .init_irq
= pxa3xx_init_irq
,
261 .handle_irq
= pxa3xx_handle_irq
,
262 .init_time
= pxa_timer_init
,
263 .restart
= pxa_restart
,