diff options
Diffstat (limited to 'arch/arm/mach-pxa/colibri-pxa300.c')
-rw-r--r-- | arch/arm/mach-pxa/colibri-pxa300.c | 190 |
1 files changed, 190 insertions, 0 deletions
diff --git a/arch/arm/mach-pxa/colibri-pxa300.c b/arch/arm/mach-pxa/colibri-pxa300.c new file mode 100644 index 000000000000..10c2eaf93230 --- /dev/null +++ b/arch/arm/mach-pxa/colibri-pxa300.c | |||
@@ -0,0 +1,190 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-pxa/colibri-pxa300.c | ||
3 | * | ||
4 | * Support for Toradex PXA300/310 based Colibri module | ||
5 | * | ||
6 | * Daniel Mack <daniel@caiaq.de> | ||
7 | * Matthias Meier <matthias.j.meier@gmx.net> | ||
8 | * | ||
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. | ||
12 | */ | ||
13 | |||
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> | ||
19 | |||
20 | #include <asm/mach-types.h> | ||
21 | #include <asm/sizes.h> | ||
22 | #include <asm/mach/arch.h> | ||
23 | #include <asm/mach/irq.h> | ||
24 | |||
25 | #include <mach/pxa300.h> | ||
26 | #include <mach/colibri.h> | ||
27 | #include <mach/ohci.h> | ||
28 | #include <mach/pxafb.h> | ||
29 | |||
30 | #include "generic.h" | ||
31 | #include "devices.h" | ||
32 | |||
33 | #if defined(CONFIG_AX88796) | ||
34 | #define COLIBRI_ETH_IRQ_GPIO mfp_to_gpio(GPIO26_GPIO) | ||
35 | /* | ||
36 | * Asix AX88796 Ethernet | ||
37 | */ | ||
38 | static struct ax_plat_data colibri_asix_platdata = { | ||
39 | .flags = AXFLG_MAC_FROMDEV, | ||
40 | .wordlength = 2 | ||
41 | }; | ||
42 | |||
43 | static struct resource colibri_asix_resource[] = { | ||
44 | [0] = { | ||
45 | .start = PXA3xx_CS2_PHYS, | ||
46 | .end = PXA3xx_CS2_PHYS + (0x20 * 2) - 1, | ||
47 | .flags = IORESOURCE_MEM, | ||
48 | }, | ||
49 | [1] = { | ||
50 | .start = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO), | ||
51 | .end = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO), | ||
52 | .flags = IORESOURCE_IRQ | ||
53 | } | ||
54 | }; | ||
55 | |||
56 | static struct platform_device asix_device = { | ||
57 | .name = "ax88796", | ||
58 | .id = 0, | ||
59 | .num_resources = ARRAY_SIZE(colibri_asix_resource), | ||
60 | .resource = colibri_asix_resource, | ||
61 | .dev = { | ||
62 | .platform_data = &colibri_asix_platdata | ||
63 | } | ||
64 | }; | ||
65 | |||
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 */ | ||
69 | }; | ||
70 | |||
71 | static void __init colibri_pxa300_init_eth(void) | ||
72 | { | ||
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); | ||
76 | } | ||
77 | #else | ||
78 | static inline void __init colibri_pxa300_init_eth(void) {} | ||
79 | #endif /* CONFIG_AX88796 */ | ||
80 | |||
81 | #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) | ||
82 | static mfp_cfg_t colibri_pxa300_usb_pin_config[] __initdata = { | ||
83 | GPIO0_2_USBH_PEN, | ||
84 | GPIO1_2_USBH_PWR, | ||
85 | }; | ||
86 | |||
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, | ||
90 | }; | ||
91 | |||
92 | void __init colibri_pxa300_init_ohci(void) | ||
93 | { | ||
94 | pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_usb_pin_config)); | ||
95 | pxa_set_ohci_info(&colibri_pxa300_ohci_info); | ||
96 | } | ||
97 | #else | ||
98 | static inline void colibri_pxa300_init_ohci(void) {} | ||
99 | #endif /* CONFIG_USB_OHCI_HCD || CONFIG_USB_OHCI_HCD_MODULE */ | ||
100 | |||
101 | static mfp_cfg_t colibri_pxa300_mmc_pin_config[] __initdata = { | ||
102 | GPIO7_MMC1_CLK, | ||
103 | GPIO14_MMC1_CMD, | ||
104 | GPIO3_MMC1_DAT0, | ||
105 | GPIO4_MMC1_DAT1, | ||
106 | GPIO5_MMC1_DAT2, | ||
107 | GPIO6_MMC1_DAT3, | ||
108 | }; | ||
109 | |||
110 | #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) | ||
111 | static mfp_cfg_t colibri_pxa300_lcd_pin_config[] __initdata = { | ||
112 | GPIO54_LCD_LDD_0, | ||
113 | GPIO55_LCD_LDD_1, | ||
114 | GPIO56_LCD_LDD_2, | ||
115 | GPIO57_LCD_LDD_3, | ||
116 | GPIO58_LCD_LDD_4, | ||
117 | GPIO59_LCD_LDD_5, | ||
118 | GPIO60_LCD_LDD_6, | ||
119 | GPIO61_LCD_LDD_7, | ||
120 | GPIO62_LCD_LDD_8, | ||
121 | GPIO63_LCD_LDD_9, | ||
122 | GPIO64_LCD_LDD_10, | ||
123 | GPIO65_LCD_LDD_11, | ||
124 | GPIO66_LCD_LDD_12, | ||
125 | GPIO67_LCD_LDD_13, | ||
126 | GPIO68_LCD_LDD_14, | ||
127 | GPIO69_LCD_LDD_15, | ||
128 | GPIO70_LCD_LDD_16, | ||
129 | GPIO71_LCD_LDD_17, | ||
130 | GPIO62_LCD_CS_N, | ||
131 | GPIO72_LCD_FCLK, | ||
132 | GPIO73_LCD_LCLK, | ||
133 | GPIO74_LCD_PCLK, | ||
134 | GPIO75_LCD_BIAS, | ||
135 | GPIO76_LCD_VSYNC, | ||
136 | }; | ||
137 | |||
138 | static void __init colibri_pxa300_init_lcd(void) | ||
139 | { | ||
140 | pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_lcd_pin_config)); | ||
141 | } | ||
142 | |||
143 | #else | ||
144 | static inline void colibri_pxa300_init_lcd(void) {} | ||
145 | #endif /* CONFIG_FB_PXA || CONFIG_FB_PXA_MODULE */ | ||
146 | |||
147 | #if defined(SND_AC97_CODEC) || defined(SND_AC97_CODEC_MODULE) | ||
148 | static mfp_cfg_t colibri_pxa310_ac97_pin_config[] __initdata = { | ||
149 | GPIO24_AC97_SYSCLK, | ||
150 | GPIO23_AC97_nACRESET, | ||
151 | GPIO25_AC97_SDATA_IN_0, | ||
152 | GPIO27_AC97_SDATA_OUT, | ||
153 | GPIO28_AC97_SYNC, | ||
154 | GPIO29_AC97_BITCLK | ||
155 | }; | ||
156 | |||
157 | static inline void __init colibri_pxa310_init_ac97(void) | ||
158 | { | ||
159 | /* no AC97 codec on Colibri PXA300 */ | ||
160 | if (!cpu_is_pxa310()) | ||
161 | return; | ||
162 | |||
163 | pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa310_ac97_pin_config)); | ||
164 | pxa_set_ac97_info(NULL); | ||
165 | } | ||
166 | #else | ||
167 | static inline void colibri_pxa310_init_ac97(void) {} | ||
168 | #endif | ||
169 | |||
170 | void __init colibri_pxa300_init(void) | ||
171 | { | ||
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)); | ||
179 | } | ||
180 | |||
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, | ||
188 | .timer = &pxa_timer, | ||
189 | MACHINE_END | ||
190 | |||