2 * arch/arm/mach-pxa/colibri-pxa300.c
4 * Support for Toradex PXA300/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/pxa300.h>
26 #include <mach/colibri.h>
27 #include <mach/ohci.h>
28 #include <mach/pxafb.h>
33 #if defined(CONFIG_AX88796)
34 #define COLIBRI_ETH_IRQ_GPIO mfp_to_gpio(GPIO26_GPIO)
37 * Asix AX88796 Ethernet
39 static struct ax_plat_data colibri_asix_platdata = {
40 .flags = 0, /* defined later */
44 static struct resource colibri_asix_resource[] = {
46 .start = PXA3xx_CS2_PHYS,
47 .end = PXA3xx_CS2_PHYS + (0x20 * 2) - 1,
48 .flags = IORESOURCE_MEM,
51 .start = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO),
52 .end = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO),
53 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_FALLING,
57 static struct platform_device asix_device = {
60 .num_resources = ARRAY_SIZE(colibri_asix_resource),
61 .resource = colibri_asix_resource,
63 .platform_data = &colibri_asix_platdata
67 static mfp_cfg_t colibri_pxa300_eth_pin_config[] __initdata = {
68 GPIO1_nCS2, /* AX88796 chip select */
69 GPIO26_GPIO | MFP_PULL_HIGH /* AX88796 IRQ */
72 static void __init colibri_pxa300_init_eth(void)
74 colibri_pxa3xx_init_eth(&colibri_asix_platdata);
75 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_eth_pin_config));
76 platform_device_register(&asix_device);
79 static inline void __init colibri_pxa300_init_eth(void) {}
80 #endif /* CONFIG_AX88796 */
82 #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
83 static mfp_cfg_t colibri_pxa300_usb_pin_config[] __initdata = {
88 static struct pxaohci_platform_data colibri_pxa300_ohci_info = {
89 .port_mode = PMM_GLOBAL_MODE,
90 .flags = ENABLE_PORT1 | POWER_CONTROL_LOW | POWER_SENSE_LOW,
93 void __init colibri_pxa300_init_ohci(void)
95 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_usb_pin_config));
96 pxa_set_ohci_info(&colibri_pxa300_ohci_info);
99 static inline void colibri_pxa300_init_ohci(void) {}
100 #endif /* CONFIG_USB_OHCI_HCD || CONFIG_USB_OHCI_HCD_MODULE */
102 static mfp_cfg_t colibri_pxa300_mmc_pin_config[] __initdata = {
111 #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
112 static mfp_cfg_t colibri_pxa300_lcd_pin_config[] __initdata = {
139 static void __init colibri_pxa300_init_lcd(void)
141 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_lcd_pin_config));
145 static inline void colibri_pxa300_init_lcd(void) {}
146 #endif /* CONFIG_FB_PXA || CONFIG_FB_PXA_MODULE */
148 #if defined(SND_AC97_CODEC) || defined(SND_AC97_CODEC_MODULE)
149 static mfp_cfg_t colibri_pxa310_ac97_pin_config[] __initdata = {
151 GPIO23_AC97_nACRESET,
152 GPIO25_AC97_SDATA_IN_0,
153 GPIO27_AC97_SDATA_OUT,
158 static inline void __init colibri_pxa310_init_ac97(void)
160 /* no AC97 codec on Colibri PXA300 */
161 if (!cpu_is_pxa310())
164 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa310_ac97_pin_config));
165 pxa_set_ac97_info(NULL);
168 static inline void colibri_pxa310_init_ac97(void) {}
171 void __init colibri_pxa300_init(void)
173 colibri_pxa300_init_eth();
174 colibri_pxa300_init_ohci();
175 colibri_pxa300_init_lcd();
176 colibri_pxa3xx_init_lcd(mfp_to_gpio(GPIO39_GPIO));
177 colibri_pxa310_init_ac97();
178 colibri_pxa3xx_init_mmc(ARRAY_AND_SIZE(colibri_pxa300_mmc_pin_config),
179 mfp_to_gpio(MFP_PIN_GPIO13));
182 MACHINE_START(COLIBRI300, "Toradex Colibri PXA300")
183 .phys_io = 0x40000000,
184 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
185 .boot_params = COLIBRI_SDRAM_BASE + 0x100,
186 .init_machine = colibri_pxa300_init,
187 .map_io = pxa_map_io,
188 .init_irq = pxa3xx_init_irq,