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 <net/ax88796.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)
36 * Asix AX88796 Ethernet
38 static struct ax_plat_data colibri_asix_platdata = {
39 .flags = AXFLG_MAC_FROMDEV,
43 static struct resource colibri_asix_resource[] = {
45 .start = PXA3xx_CS2_PHYS,
46 .end = PXA3xx_CS2_PHYS + (0x20 * 2) - 1,
47 .flags = IORESOURCE_MEM,
50 .start = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO),
51 .end = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO),
52 .flags = IORESOURCE_IRQ
56 static struct platform_device asix_device = {
59 .num_resources = ARRAY_SIZE(colibri_asix_resource),
60 .resource = colibri_asix_resource,
62 .platform_data = &colibri_asix_platdata
66 static mfp_cfg_t colibri_pxa300_eth_pin_config[] __initdata = {
67 GPIO1_nCS2, /* AX88796 chip select */
68 GPIO26_GPIO | MFP_PULL_HIGH /* AX88796 IRQ */
71 static void __init colibri_pxa300_init_eth(void)
73 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_eth_pin_config));
74 set_irq_type(gpio_to_irq(COLIBRI_ETH_IRQ_GPIO), IRQ_TYPE_EDGE_FALLING);
75 platform_device_register(&asix_device);
78 static inline void __init colibri_pxa300_init_eth(void) {}
79 #endif /* CONFIG_AX88796 */
81 #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
82 static mfp_cfg_t colibri_pxa300_usb_pin_config[] __initdata = {
87 static struct pxaohci_platform_data colibri_pxa300_ohci_info = {
88 .port_mode = PMM_GLOBAL_MODE,
89 .flags = ENABLE_PORT1 | POWER_CONTROL_LOW | POWER_SENSE_LOW,
92 void __init colibri_pxa300_init_ohci(void)
94 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_usb_pin_config));
95 pxa_set_ohci_info(&colibri_pxa300_ohci_info);
98 static inline void colibri_pxa300_init_ohci(void) {}
99 #endif /* CONFIG_USB_OHCI_HCD || CONFIG_USB_OHCI_HCD_MODULE */
101 static mfp_cfg_t colibri_pxa300_mmc_pin_config[] __initdata = {
110 #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
111 static mfp_cfg_t colibri_pxa300_lcd_pin_config[] __initdata = {
138 static void __init colibri_pxa300_init_lcd(void)
140 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_lcd_pin_config));
144 static inline void colibri_pxa300_init_lcd(void) {}
145 #endif /* CONFIG_FB_PXA || CONFIG_FB_PXA_MODULE */
147 #if defined(SND_AC97_CODEC) || defined(SND_AC97_CODEC_MODULE)
148 static mfp_cfg_t colibri_pxa310_ac97_pin_config[] __initdata = {
150 GPIO23_AC97_nACRESET,
151 GPIO25_AC97_SDATA_IN_0,
152 GPIO27_AC97_SDATA_OUT,
157 static inline void __init colibri_pxa310_init_ac97(void)
159 /* no AC97 codec on Colibri PXA300 */
160 if (!cpu_is_pxa310())
163 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa310_ac97_pin_config));
164 pxa_set_ac97_info(NULL);
167 static inline void colibri_pxa310_init_ac97(void) {}
170 void __init colibri_pxa300_init(void)
172 colibri_pxa300_init_eth();
173 colibri_pxa300_init_ohci();
174 colibri_pxa300_init_lcd();
175 colibri_pxa3xx_init_lcd(mfp_to_gpio(GPIO39_GPIO));
176 colibri_pxa310_init_ac97();
177 colibri_pxa3xx_init_mmc(ARRAY_AND_SIZE(colibri_pxa300_mmc_pin_config),
178 mfp_to_gpio(MFP_PIN_GPIO13));
181 MACHINE_START(COLIBRI300, "Toradex Colibri PXA300")
182 .phys_io = 0x40000000,
183 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
184 .boot_params = COLIBRI_SDRAM_BASE + 0x100,
185 .init_machine = colibri_pxa300_init,
186 .map_io = pxa_map_io,
187 .init_irq = pxa3xx_init_irq,