Commit | Line | Data |
---|---|---|
d2912cb1 | 1 | // SPDX-License-Identifier: GPL-2.0-only |
5fc9f9a1 DM |
2 | /* |
3 | * arch/arm/mach-pxa/colibri-pxa300.c | |
4 | * | |
acb36559 DM |
5 | * Support for Toradex PXA300/310 based Colibri module |
6 | * | |
5fc9f9a1 | 7 | * Daniel Mack <daniel@caiaq.de> |
acb36559 | 8 | * Matthias Meier <matthias.j.meier@gmx.net> |
5fc9f9a1 DM |
9 | */ |
10 | ||
11 | #include <linux/init.h> | |
12 | #include <linux/kernel.h> | |
13 | #include <linux/platform_device.h> | |
14 | #include <linux/gpio.h> | |
8a28b10e | 15 | #include <linux/interrupt.h> |
5fc9f9a1 DM |
16 | |
17 | #include <asm/mach-types.h> | |
87dfb311 | 18 | #include <linux/sizes.h> |
5fc9f9a1 DM |
19 | #include <asm/mach/arch.h> |
20 | #include <asm/mach/irq.h> | |
21 | ||
4c25c5d2 AB |
22 | #include "pxa300.h" |
23 | #include "colibri.h" | |
293b2da1 AB |
24 | #include <linux/platform_data/usb-ohci-pxa27x.h> |
25 | #include <linux/platform_data/video-pxafb.h> | |
7fad6986 | 26 | #include <mach/audio.h> |
5fc9f9a1 DM |
27 | |
28 | #include "generic.h" | |
29 | #include "devices.h" | |
30 | ||
9b6956f4 | 31 | |
a3172e54 | 32 | #ifdef CONFIG_MACH_COLIBRI_EVALBOARD |
9b6956f4 MV |
33 | static mfp_cfg_t colibri_pxa300_evalboard_pin_config[] __initdata = { |
34 | /* MMC */ | |
35 | GPIO7_MMC1_CLK, | |
36 | GPIO14_MMC1_CMD, | |
37 | GPIO3_MMC1_DAT0, | |
38 | GPIO4_MMC1_DAT1, | |
39 | GPIO5_MMC1_DAT2, | |
40 | GPIO6_MMC1_DAT3, | |
57834a72 | 41 | GPIO13_GPIO, /* GPIO13_COLIBRI_PXA300_SD_DETECT */ |
9b6956f4 MV |
42 | |
43 | /* UHC */ | |
44 | GPIO0_2_USBH_PEN, | |
45 | GPIO1_2_USBH_PWR, | |
3534cccd BF |
46 | GPIO77_USB_P3_1, |
47 | GPIO78_USB_P3_2, | |
48 | GPIO79_USB_P3_3, | |
49 | GPIO80_USB_P3_4, | |
50 | GPIO81_USB_P3_5, | |
51 | GPIO82_USB_P3_6, | |
072e1ae7 MV |
52 | |
53 | /* I2C */ | |
54 | GPIO21_I2C_SCL, | |
55 | GPIO22_I2C_SDA, | |
9b6956f4 MV |
56 | }; |
57 | #else | |
58 | static mfp_cfg_t colibri_pxa300_evalboard_pin_config[] __initdata = {}; | |
59 | #endif | |
60 | ||
5fc9f9a1 | 61 | #if defined(CONFIG_AX88796) |
acb36559 | 62 | #define COLIBRI_ETH_IRQ_GPIO mfp_to_gpio(GPIO26_GPIO) |
5fc9f9a1 DM |
63 | /* |
64 | * Asix AX88796 Ethernet | |
65 | */ | |
66 | static struct ax_plat_data colibri_asix_platdata = { | |
22a0200b DM |
67 | .flags = 0, /* defined later */ |
68 | .wordlength = 2, | |
5fc9f9a1 DM |
69 | }; |
70 | ||
71 | static struct resource colibri_asix_resource[] = { | |
72 | [0] = { | |
73 | .start = PXA3xx_CS2_PHYS, | |
626806d9 | 74 | .end = PXA3xx_CS2_PHYS + (0x20 * 2) - 1, |
5fc9f9a1 DM |
75 | .flags = IORESOURCE_MEM, |
76 | }, | |
77 | [1] = { | |
4929f5a8 HZ |
78 | .start = PXA_GPIO_TO_IRQ(COLIBRI_ETH_IRQ_GPIO), |
79 | .end = PXA_GPIO_TO_IRQ(COLIBRI_ETH_IRQ_GPIO), | |
8a28b10e | 80 | .flags = IORESOURCE_IRQ | IRQF_TRIGGER_FALLING, |
5fc9f9a1 DM |
81 | } |
82 | }; | |
83 | ||
84 | static struct platform_device asix_device = { | |
85 | .name = "ax88796", | |
86 | .id = 0, | |
87 | .num_resources = ARRAY_SIZE(colibri_asix_resource), | |
88 | .resource = colibri_asix_resource, | |
89 | .dev = { | |
90 | .platform_data = &colibri_asix_platdata | |
91 | } | |
92 | }; | |
ebc046c2 | 93 | |
acb36559 DM |
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 */ | |
ebc046c2 DM |
97 | }; |
98 | ||
acb36559 | 99 | static void __init colibri_pxa300_init_eth(void) |
ebc046c2 | 100 | { |
22a0200b | 101 | colibri_pxa3xx_init_eth(&colibri_asix_platdata); |
acb36559 | 102 | pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_eth_pin_config)); |
acb36559 | 103 | platform_device_register(&asix_device); |
ebc046c2 | 104 | } |
ebc046c2 | 105 | #else |
acb36559 DM |
106 | static inline void __init colibri_pxa300_init_eth(void) {} |
107 | #endif /* CONFIG_AX88796 */ | |
ebc046c2 | 108 | |
91fcfb90 DM |
109 | #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) |
110 | static mfp_cfg_t colibri_pxa300_lcd_pin_config[] __initdata = { | |
111 | GPIO54_LCD_LDD_0, | |
112 | GPIO55_LCD_LDD_1, | |
113 | GPIO56_LCD_LDD_2, | |
114 | GPIO57_LCD_LDD_3, | |
115 | GPIO58_LCD_LDD_4, | |
116 | GPIO59_LCD_LDD_5, | |
117 | GPIO60_LCD_LDD_6, | |
118 | GPIO61_LCD_LDD_7, | |
119 | GPIO62_LCD_LDD_8, | |
120 | GPIO63_LCD_LDD_9, | |
121 | GPIO64_LCD_LDD_10, | |
122 | GPIO65_LCD_LDD_11, | |
123 | GPIO66_LCD_LDD_12, | |
124 | GPIO67_LCD_LDD_13, | |
125 | GPIO68_LCD_LDD_14, | |
126 | GPIO69_LCD_LDD_15, | |
127 | GPIO70_LCD_LDD_16, | |
128 | GPIO71_LCD_LDD_17, | |
129 | GPIO62_LCD_CS_N, | |
130 | GPIO72_LCD_FCLK, | |
131 | GPIO73_LCD_LCLK, | |
132 | GPIO74_LCD_PCLK, | |
133 | GPIO75_LCD_BIAS, | |
134 | GPIO76_LCD_VSYNC, | |
135 | }; | |
136 | ||
137 | static void __init colibri_pxa300_init_lcd(void) | |
138 | { | |
139 | pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_lcd_pin_config)); | |
140 | } | |
141 | ||
142 | #else | |
143 | static inline void colibri_pxa300_init_lcd(void) {} | |
144 | #endif /* CONFIG_FB_PXA || CONFIG_FB_PXA_MODULE */ | |
145 | ||
7fad6986 | 146 | #if defined(CONFIG_SND_AC97_CODEC) || defined(CONFIG_SND_AC97_CODEC_MODULE) |
e2bb5bef DM |
147 | static mfp_cfg_t colibri_pxa310_ac97_pin_config[] __initdata = { |
148 | GPIO24_AC97_SYSCLK, | |
149 | GPIO23_AC97_nACRESET, | |
150 | GPIO25_AC97_SDATA_IN_0, | |
151 | GPIO27_AC97_SDATA_OUT, | |
152 | GPIO28_AC97_SYNC, | |
153 | GPIO29_AC97_BITCLK | |
154 | }; | |
155 | ||
156 | static inline void __init colibri_pxa310_init_ac97(void) | |
157 | { | |
158 | /* no AC97 codec on Colibri PXA300 */ | |
159 | if (!cpu_is_pxa310()) | |
160 | return; | |
161 | ||
162 | pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa310_ac97_pin_config)); | |
163 | pxa_set_ac97_info(NULL); | |
164 | } | |
165 | #else | |
166 | static inline void colibri_pxa310_init_ac97(void) {} | |
167 | #endif | |
168 | ||
acb36559 | 169 | void __init colibri_pxa300_init(void) |
5fc9f9a1 | 170 | { |
acb36559 | 171 | colibri_pxa300_init_eth(); |
53740df1 | 172 | colibri_pxa3xx_init_nand(); |
91fcfb90 | 173 | colibri_pxa300_init_lcd(); |
c9b78189 | 174 | colibri_pxa3xx_init_lcd(mfp_to_gpio(GPIO39_GPIO)); |
e2bb5bef | 175 | colibri_pxa310_init_ac97(); |
9b6956f4 MV |
176 | |
177 | /* Evalboard init */ | |
178 | pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_evalboard_pin_config)); | |
a3172e54 | 179 | colibri_evalboard_init(); |
5fc9f9a1 DM |
180 | } |
181 | ||
182 | MACHINE_START(COLIBRI300, "Toradex Colibri PXA300") | |
7375aba6 | 183 | .atag_offset = 0x100, |
5fc9f9a1 | 184 | .init_machine = colibri_pxa300_init, |
851982c1 | 185 | .map_io = pxa3xx_map_io, |
4e611091 | 186 | .nr_irqs = PXA_NR_IRQS, |
5fc9f9a1 | 187 | .init_irq = pxa3xx_init_irq, |
8a97ae2f | 188 | .handle_irq = pxa3xx_handle_irq, |
6bb27d73 | 189 | .init_time = pxa_timer_init, |
271a74fc | 190 | .restart = pxa_restart, |
5fc9f9a1 DM |
191 | MACHINE_END |
192 |