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/pxa3xx-regs.h>
27 #include <mach/mfp-pxa320.h>
28 #include <mach/colibri.h>
29 #include <mach/pxafb.h>
30 #include <mach/ohci.h>
31 #include <mach/audio.h>
32 #include <mach/pxa27x-udc.h>
38 #ifdef CONFIG_MACH_COLIBRI_EVALBOARD
39 static mfp_cfg_t colibri_pxa320_evalboard_pin_config
[] __initdata
= {
47 GPIO28_GPIO
, /* SD detect */
49 /* UART 1 configuration (may be set by bootloader) */
59 /* UART 2 configuration */
65 /* UART 3 configuration */
78 MFP_CFG(GPIO59
, AF7
), /* PRST ; AF7 to tristate */
79 MFP_CFG(GPIO61
, AF7
), /* PCE1 ; AF7 to tristate */
80 MFP_CFG(GPIO60
, AF7
), /* PCE2 ; AF7 to tristate */
81 MFP_CFG(GPIO62
, AF7
), /* PCD ; AF7 to tristate */
82 MFP_CFG(GPIO56
, AF7
), /* PSKTSEL ; AF7 to tristate */
83 GPIO27_GPIO
, /* RDnWR ; input/tristate */
84 GPIO50_GPIO
, /* PREG ; input/tristate */
90 GPIO29_GPIO
, /* PRDY (READY GPIO) */
91 GPIO57_GPIO
, /* PPEN (POWER GPIO) */
92 GPIO81_GPIO
, /* PCD (DETECT GPIO) */
93 GPIO77_GPIO
, /* PRST (RESET GPIO) */
94 GPIO53_GPIO
, /* PBVD1 */
95 GPIO79_GPIO
, /* PBVD2 */
96 GPIO54_GPIO
, /* POE */
99 static mfp_cfg_t colibri_pxa320_evalboard_pin_config
[] __initdata
= {};
102 #if defined(CONFIG_AX88796)
103 #define COLIBRI_ETH_IRQ_GPIO mfp_to_gpio(GPIO36_GPIO)
105 * Asix AX88796 Ethernet
107 static struct ax_plat_data colibri_asix_platdata
= {
108 .flags
= 0, /* defined later */
112 static struct resource colibri_asix_resource
[] = {
114 .start
= PXA3xx_CS2_PHYS
,
115 .end
= PXA3xx_CS2_PHYS
+ (0x20 * 2) - 1,
116 .flags
= IORESOURCE_MEM
,
119 .start
= gpio_to_irq(COLIBRI_ETH_IRQ_GPIO
),
120 .end
= gpio_to_irq(COLIBRI_ETH_IRQ_GPIO
),
121 .flags
= IORESOURCE_IRQ
| IRQF_TRIGGER_FALLING
,
125 static struct platform_device asix_device
= {
128 .num_resources
= ARRAY_SIZE(colibri_asix_resource
),
129 .resource
= colibri_asix_resource
,
131 .platform_data
= &colibri_asix_platdata
135 static mfp_cfg_t colibri_pxa320_eth_pin_config
[] __initdata
= {
136 GPIO3_nCS2
, /* AX88796 chip select */
137 GPIO36_GPIO
| MFP_PULL_HIGH
/* AX88796 IRQ */
140 static void __init
colibri_pxa320_init_eth(void)
142 colibri_pxa3xx_init_eth(&colibri_asix_platdata
);
143 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_eth_pin_config
));
144 platform_device_register(&asix_device
);
147 static inline void __init
colibri_pxa320_init_eth(void) {}
148 #endif /* CONFIG_AX88796 */
150 #if defined(CONFIG_USB_PXA27X)||defined(CONFIG_USB_PXA27X_MODULE)
151 static struct gpio_vbus_mach_info colibri_pxa320_gpio_vbus_info
= {
152 .gpio_vbus
= mfp_to_gpio(MFP_PIN_GPIO96
),
156 static struct platform_device colibri_pxa320_gpio_vbus
= {
160 .platform_data
= &colibri_pxa320_gpio_vbus_info
,
164 static void colibri_pxa320_udc_command(int cmd
)
166 if (cmd
== PXA2XX_UDC_CMD_CONNECT
)
167 UP2OCR
= UP2OCR_HXOE
| UP2OCR_DPPUE
;
168 else if (cmd
== PXA2XX_UDC_CMD_DISCONNECT
)
169 UP2OCR
= UP2OCR_HXOE
;
172 static struct pxa2xx_udc_mach_info colibri_pxa320_udc_info __initdata
= {
173 .udc_command
= colibri_pxa320_udc_command
,
177 static void __init
colibri_pxa320_init_udc(void)
179 pxa_set_udc_info(&colibri_pxa320_udc_info
);
180 platform_device_register(&colibri_pxa320_gpio_vbus
);
183 static inline void colibri_pxa320_init_udc(void) {}
186 #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
187 static mfp_cfg_t colibri_pxa320_lcd_pin_config
[] __initdata
= {
214 static void __init
colibri_pxa320_init_lcd(void)
216 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_lcd_pin_config
));
219 static inline void colibri_pxa320_init_lcd(void) {}
222 #if defined(CONFIG_SND_AC97_CODEC) || \
223 defined(CONFIG_SND_AC97_CODEC_MODULE)
224 static mfp_cfg_t colibri_pxa320_ac97_pin_config
[] __initdata
= {
226 GPIO35_AC97_SDATA_IN_0
,
227 GPIO37_AC97_SDATA_OUT
,
233 static inline void __init
colibri_pxa320_init_ac97(void)
235 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_ac97_pin_config
));
236 pxa_set_ac97_info(NULL
);
239 static inline void colibri_pxa320_init_ac97(void) {}
242 void __init
colibri_pxa320_init(void)
244 colibri_pxa320_init_eth();
245 colibri_pxa3xx_init_nand();
246 colibri_pxa320_init_lcd();
247 colibri_pxa3xx_init_lcd(mfp_to_gpio(GPIO49_GPIO
));
248 colibri_pxa320_init_ac97();
249 colibri_pxa320_init_udc();
252 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_evalboard_pin_config
));
253 colibri_evalboard_init();
256 MACHINE_START(COLIBRI320
, "Toradex Colibri PXA320")
257 .boot_params
= COLIBRI_SDRAM_BASE
+ 0x100,
258 .init_machine
= colibri_pxa320_init
,
259 .map_io
= pxa3xx_map_io
,
260 .init_irq
= pxa3xx_init_irq
,