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>
20 #include <asm/mach-types.h>
21 #include <asm/sizes.h>
22 #include <asm/mach/arch.h>
23 #include <asm/mach/irq.h>
25 #include <mach/pxa3xx-regs.h>
26 #include <mach/mfp-pxa320.h>
27 #include <mach/colibri.h>
28 #include <mach/pxafb.h>
29 #include <mach/ohci.h>
30 #include <mach/audio.h>
35 #if defined(CONFIG_AX88796)
36 #define COLIBRI_ETH_IRQ_GPIO mfp_to_gpio(GPIO36_GPIO)
39 * Asix AX88796 Ethernet
41 static struct ax_plat_data colibri_asix_platdata = {
42 .flags = 0, /* defined later */
46 static struct resource colibri_asix_resource[] = {
48 .start = PXA3xx_CS2_PHYS,
49 .end = PXA3xx_CS2_PHYS + (0x20 * 2) - 1,
50 .flags = IORESOURCE_MEM,
53 .start = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO),
54 .end = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO),
55 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_FALLING,
59 static struct platform_device asix_device = {
62 .num_resources = ARRAY_SIZE(colibri_asix_resource),
63 .resource = colibri_asix_resource,
65 .platform_data = &colibri_asix_platdata
69 static mfp_cfg_t colibri_pxa320_eth_pin_config[] __initdata = {
70 GPIO3_nCS2, /* AX88796 chip select */
71 GPIO36_GPIO | MFP_PULL_HIGH /* AX88796 IRQ */
74 static void __init colibri_pxa320_init_eth(void)
76 colibri_pxa3xx_init_eth(&colibri_asix_platdata);
77 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_eth_pin_config));
78 platform_device_register(&asix_device);
81 static inline void __init colibri_pxa320_init_eth(void) {}
82 #endif /* CONFIG_AX88796 */
84 #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
85 static mfp_cfg_t colibri_pxa320_usb_pin_config[] __initdata = {
90 static struct pxaohci_platform_data colibri_pxa320_ohci_info = {
91 .port_mode = PMM_GLOBAL_MODE,
92 .flags = ENABLE_PORT1 | POWER_CONTROL_LOW | POWER_SENSE_LOW,
95 void __init colibri_pxa320_init_ohci(void)
97 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_usb_pin_config));
98 pxa_set_ohci_info(&colibri_pxa320_ohci_info);
101 static inline void colibri_pxa320_init_ohci(void) {}
102 #endif /* CONFIG_USB_OHCI_HCD || CONFIG_USB_OHCI_HCD_MODULE */
104 static mfp_cfg_t colibri_pxa320_mmc_pin_config[] __initdata = {
113 #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
114 static mfp_cfg_t colibri_pxa320_lcd_pin_config[] __initdata = {
141 static void __init colibri_pxa320_init_lcd(void)
143 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_lcd_pin_config));
146 static inline void colibri_pxa320_init_lcd(void) {}
149 #if defined(CONFIG_SND_AC97_CODEC) || \
150 defined(CONFIG_SND_AC97_CODEC_MODULE)
151 static mfp_cfg_t colibri_pxa320_ac97_pin_config[] __initdata = {
153 GPIO35_AC97_SDATA_IN_0,
154 GPIO37_AC97_SDATA_OUT,
160 static inline void __init colibri_pxa320_init_ac97(void)
162 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_ac97_pin_config));
163 pxa_set_ac97_info(NULL);
166 static inline void colibri_pxa320_init_ac97(void) {}
170 * The following configuration is verified to work with the Toradex Orchid
173 static mfp_cfg_t colibri_pxa320_uart_pin_config[] __initdata = {
174 /* UART 1 configuration (may be set by bootloader) */
184 /* UART 2 configuration */
190 /* UART 3 configuration */
195 static void __init colibri_pxa320_init_uart(void)
197 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_uart_pin_config));
200 void __init colibri_pxa320_init(void)
202 pxa_set_ffuart_info(NULL);
203 pxa_set_btuart_info(NULL);
204 pxa_set_stuart_info(NULL);
206 colibri_pxa320_init_eth();
207 colibri_pxa320_init_ohci();
208 colibri_pxa3xx_init_nand();
209 colibri_pxa320_init_lcd();
210 colibri_pxa3xx_init_lcd(mfp_to_gpio(GPIO49_GPIO));
211 colibri_pxa320_init_ac97();
212 colibri_pxa3xx_init_mmc(ARRAY_AND_SIZE(colibri_pxa320_mmc_pin_config),
213 mfp_to_gpio(MFP_PIN_GPIO28));
214 colibri_pxa320_init_uart();
217 MACHINE_START(COLIBRI320, "Toradex Colibri PXA320")
218 .phys_io = 0x40000000,
219 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
220 .boot_params = COLIBRI_SDRAM_BASE + 0x100,
221 .init_machine = colibri_pxa320_init,
222 .map_io = pxa_map_io,
223 .init_irq = pxa3xx_init_irq,