1 // SPDX-License-Identifier: GPL-2.0-only
3 * arch/arm/mach-pxa/colibri-pxa300.c
5 * Support for Toradex PXA300/310 based Colibri module
7 * Daniel Mack <daniel@caiaq.de>
8 * Matthias Meier <matthias.j.meier@gmx.net>
11 #include <linux/init.h>
12 #include <linux/kernel.h>
13 #include <linux/platform_device.h>
14 #include <linux/gpio.h>
15 #include <linux/interrupt.h>
17 #include <asm/mach-types.h>
18 #include <linux/sizes.h>
19 #include <asm/mach/arch.h>
20 #include <asm/mach/irq.h>
24 #include <linux/platform_data/usb-ohci-pxa27x.h>
25 #include <linux/platform_data/video-pxafb.h>
26 #include <mach/audio.h>
32 #ifdef CONFIG_MACH_COLIBRI_EVALBOARD
33 static mfp_cfg_t colibri_pxa300_evalboard_pin_config[] __initdata = {
41 GPIO13_GPIO, /* GPIO13_COLIBRI_PXA300_SD_DETECT */
58 static mfp_cfg_t colibri_pxa300_evalboard_pin_config[] __initdata = {};
61 #if defined(CONFIG_AX88796)
62 #define COLIBRI_ETH_IRQ_GPIO mfp_to_gpio(GPIO26_GPIO)
64 * Asix AX88796 Ethernet
66 static struct ax_plat_data colibri_asix_platdata = {
67 .flags = 0, /* defined later */
71 static struct resource colibri_asix_resource[] = {
73 .start = PXA3xx_CS2_PHYS,
74 .end = PXA3xx_CS2_PHYS + (0x20 * 2) - 1,
75 .flags = IORESOURCE_MEM,
78 .start = PXA_GPIO_TO_IRQ(COLIBRI_ETH_IRQ_GPIO),
79 .end = PXA_GPIO_TO_IRQ(COLIBRI_ETH_IRQ_GPIO),
80 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_FALLING,
84 static struct platform_device asix_device = {
87 .num_resources = ARRAY_SIZE(colibri_asix_resource),
88 .resource = colibri_asix_resource,
90 .platform_data = &colibri_asix_platdata
94 static mfp_cfg_t colibri_pxa300_eth_pin_config[] __initdata = {
95 GPIO1_nCS2, /* AX88796 chip select */
96 GPIO26_GPIO | MFP_PULL_HIGH /* AX88796 IRQ */
99 static void __init colibri_pxa300_init_eth(void)
101 colibri_pxa3xx_init_eth(&colibri_asix_platdata);
102 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_eth_pin_config));
103 platform_device_register(&asix_device);
106 static inline void __init colibri_pxa300_init_eth(void) {}
107 #endif /* CONFIG_AX88796 */
109 #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
110 static mfp_cfg_t colibri_pxa300_lcd_pin_config[] __initdata = {
137 static void __init colibri_pxa300_init_lcd(void)
139 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_lcd_pin_config));
143 static inline void colibri_pxa300_init_lcd(void) {}
144 #endif /* CONFIG_FB_PXA || CONFIG_FB_PXA_MODULE */
146 #if defined(CONFIG_SND_AC97_CODEC) || defined(CONFIG_SND_AC97_CODEC_MODULE)
147 static mfp_cfg_t colibri_pxa310_ac97_pin_config[] __initdata = {
149 GPIO23_AC97_nACRESET,
150 GPIO25_AC97_SDATA_IN_0,
151 GPIO27_AC97_SDATA_OUT,
156 static inline void __init colibri_pxa310_init_ac97(void)
158 /* no AC97 codec on Colibri PXA300 */
159 if (!cpu_is_pxa310())
162 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa310_ac97_pin_config));
163 pxa_set_ac97_info(NULL);
166 static inline void colibri_pxa310_init_ac97(void) {}
169 void __init colibri_pxa300_init(void)
171 colibri_pxa300_init_eth();
172 colibri_pxa3xx_init_nand();
173 colibri_pxa300_init_lcd();
174 colibri_pxa3xx_init_lcd(mfp_to_gpio(GPIO39_GPIO));
175 colibri_pxa310_init_ac97();
178 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_evalboard_pin_config));
179 colibri_evalboard_init();
182 MACHINE_START(COLIBRI300, "Toradex Colibri PXA300")
183 .atag_offset = 0x100,
184 .init_machine = colibri_pxa300_init,
185 .map_io = pxa3xx_map_io,
186 .nr_irqs = PXA_NR_IRQS,
187 .init_irq = pxa3xx_init_irq,
188 .handle_irq = pxa3xx_handle_irq,
189 .init_time = pxa_timer_init,
190 .restart = pxa_restart,