diff options
Diffstat (limited to 'arch/arm/mach-pxa/colibri-pxa320.c')
-rw-r--r-- | arch/arm/mach-pxa/colibri-pxa320.c | 187 |
1 files changed, 187 insertions, 0 deletions
diff --git a/arch/arm/mach-pxa/colibri-pxa320.c b/arch/arm/mach-pxa/colibri-pxa320.c new file mode 100644 index 000000000000..573a9a1dd529 --- /dev/null +++ b/arch/arm/mach-pxa/colibri-pxa320.c | |||
@@ -0,0 +1,187 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-pxa/colibri-pxa320.c | ||
3 | * | ||
4 | * Support for Toradex PXA320/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/pxa3xx-regs.h> | ||
26 | #include <mach/mfp-pxa320.h> | ||
27 | #include <mach/colibri.h> | ||
28 | #include <mach/pxafb.h> | ||
29 | #include <mach/ohci.h> | ||
30 | |||
31 | #include "generic.h" | ||
32 | #include "devices.h" | ||
33 | |||
34 | #if defined(CONFIG_AX88796) | ||
35 | #define COLIBRI_ETH_IRQ_GPIO mfp_to_gpio(GPIO36_GPIO) | ||
36 | |||
37 | /* | ||
38 | * Asix AX88796 Ethernet | ||
39 | */ | ||
40 | static struct ax_plat_data colibri_asix_platdata = { | ||
41 | .flags = AXFLG_MAC_FROMDEV, | ||
42 | .wordlength = 2 | ||
43 | }; | ||
44 | |||
45 | static struct resource colibri_asix_resource[] = { | ||
46 | [0] = { | ||
47 | .start = PXA3xx_CS2_PHYS, | ||
48 | .end = PXA3xx_CS2_PHYS + (0x20 * 2) - 1, | ||
49 | .flags = IORESOURCE_MEM, | ||
50 | }, | ||
51 | [1] = { | ||
52 | .start = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO), | ||
53 | .end = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO), | ||
54 | .flags = IORESOURCE_IRQ | ||
55 | } | ||
56 | }; | ||
57 | |||
58 | static struct platform_device asix_device = { | ||
59 | .name = "ax88796", | ||
60 | .id = 0, | ||
61 | .num_resources = ARRAY_SIZE(colibri_asix_resource), | ||
62 | .resource = colibri_asix_resource, | ||
63 | .dev = { | ||
64 | .platform_data = &colibri_asix_platdata | ||
65 | } | ||
66 | }; | ||
67 | |||
68 | static mfp_cfg_t colibri_pxa320_eth_pin_config[] __initdata = { | ||
69 | GPIO3_nCS2, /* AX88796 chip select */ | ||
70 | GPIO36_GPIO | MFP_PULL_HIGH /* AX88796 IRQ */ | ||
71 | }; | ||
72 | |||
73 | static void __init colibri_pxa320_init_eth(void) | ||
74 | { | ||
75 | pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_eth_pin_config)); | ||
76 | set_irq_type(gpio_to_irq(COLIBRI_ETH_IRQ_GPIO), IRQ_TYPE_EDGE_FALLING); | ||
77 | platform_device_register(&asix_device); | ||
78 | } | ||
79 | #else | ||
80 | static inline void __init colibri_pxa320_init_eth(void) {} | ||
81 | #endif /* CONFIG_AX88796 */ | ||
82 | |||
83 | #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) | ||
84 | static mfp_cfg_t colibri_pxa320_usb_pin_config[] __initdata = { | ||
85 | GPIO2_2_USBH_PEN, | ||
86 | GPIO3_2_USBH_PWR, | ||
87 | }; | ||
88 | |||
89 | static struct pxaohci_platform_data colibri_pxa320_ohci_info = { | ||
90 | .port_mode = PMM_GLOBAL_MODE, | ||
91 | .flags = ENABLE_PORT1 | POWER_CONTROL_LOW | POWER_SENSE_LOW, | ||
92 | }; | ||
93 | |||
94 | void __init colibri_pxa320_init_ohci(void) | ||
95 | { | ||
96 | pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_usb_pin_config)); | ||
97 | pxa_set_ohci_info(&colibri_pxa320_ohci_info); | ||
98 | } | ||
99 | #else | ||
100 | static inline void colibri_pxa320_init_ohci(void) {} | ||
101 | #endif /* CONFIG_USB_OHCI_HCD || CONFIG_USB_OHCI_HCD_MODULE */ | ||
102 | |||
103 | static mfp_cfg_t colibri_pxa320_mmc_pin_config[] __initdata = { | ||
104 | GPIO22_MMC1_CLK, | ||
105 | GPIO23_MMC1_CMD, | ||
106 | GPIO18_MMC1_DAT0, | ||
107 | GPIO19_MMC1_DAT1, | ||
108 | GPIO20_MMC1_DAT2, | ||
109 | GPIO21_MMC1_DAT3 | ||
110 | }; | ||
111 | |||
112 | #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) | ||
113 | static mfp_cfg_t colibri_pxa320_lcd_pin_config[] __initdata = { | ||
114 | GPIO6_2_LCD_LDD_0, | ||
115 | GPIO7_2_LCD_LDD_1, | ||
116 | GPIO8_2_LCD_LDD_2, | ||
117 | GPIO9_2_LCD_LDD_3, | ||
118 | GPIO10_2_LCD_LDD_4, | ||
119 | GPIO11_2_LCD_LDD_5, | ||
120 | GPIO12_2_LCD_LDD_6, | ||
121 | GPIO13_2_LCD_LDD_7, | ||
122 | GPIO63_LCD_LDD_8, | ||
123 | GPIO64_LCD_LDD_9, | ||
124 | GPIO65_LCD_LDD_10, | ||
125 | GPIO66_LCD_LDD_11, | ||
126 | GPIO67_LCD_LDD_12, | ||
127 | GPIO68_LCD_LDD_13, | ||
128 | GPIO69_LCD_LDD_14, | ||
129 | GPIO70_LCD_LDD_15, | ||
130 | GPIO71_LCD_LDD_16, | ||
131 | GPIO72_LCD_LDD_17, | ||
132 | GPIO73_LCD_CS_N, | ||
133 | GPIO74_LCD_VSYNC, | ||
134 | GPIO14_2_LCD_FCLK, | ||
135 | GPIO15_2_LCD_LCLK, | ||
136 | GPIO16_2_LCD_PCLK, | ||
137 | GPIO17_2_LCD_BIAS, | ||
138 | }; | ||
139 | |||
140 | static void __init colibri_pxa320_init_lcd(void) | ||
141 | { | ||
142 | pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_lcd_pin_config)); | ||
143 | } | ||
144 | #else | ||
145 | static inline void colibri_pxa320_init_lcd(void) {} | ||
146 | #endif | ||
147 | |||
148 | #if defined(SND_AC97_CODEC) || defined(SND_AC97_CODEC_MODULE) | ||
149 | static mfp_cfg_t colibri_pxa320_ac97_pin_config[] __initdata = { | ||
150 | GPIO34_AC97_SYSCLK, | ||
151 | GPIO35_AC97_SDATA_IN_0, | ||
152 | GPIO37_AC97_SDATA_OUT, | ||
153 | GPIO38_AC97_SYNC, | ||
154 | GPIO39_AC97_BITCLK, | ||
155 | GPIO40_AC97_nACRESET | ||
156 | }; | ||
157 | |||
158 | static inline void __init colibri_pxa320_init_ac97(void) | ||
159 | { | ||
160 | pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_ac97_pin_config)); | ||
161 | pxa_set_ac97_info(NULL); | ||
162 | } | ||
163 | #else | ||
164 | static inline void colibri_pxa320_init_ac97(void) {} | ||
165 | #endif | ||
166 | |||
167 | void __init colibri_pxa320_init(void) | ||
168 | { | ||
169 | colibri_pxa320_init_eth(); | ||
170 | colibri_pxa320_init_ohci(); | ||
171 | colibri_pxa320_init_lcd(); | ||
172 | colibri_pxa3xx_init_lcd(mfp_to_gpio(GPIO39_GPIO)); | ||
173 | colibri_pxa320_init_ac97(); | ||
174 | colibri_pxa3xx_init_mmc(ARRAY_AND_SIZE(colibri_pxa320_mmc_pin_config), | ||
175 | mfp_to_gpio(MFP_PIN_GPIO28)); | ||
176 | } | ||
177 | |||
178 | MACHINE_START(COLIBRI320, "Toradex Colibri PXA320") | ||
179 | .phys_io = 0x40000000, | ||
180 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, | ||
181 | .boot_params = COLIBRI_SDRAM_BASE + 0x100, | ||
182 | .init_machine = colibri_pxa320_init, | ||
183 | .map_io = pxa_map_io, | ||
184 | .init_irq = pxa3xx_init_irq, | ||
185 | .timer = &pxa_timer, | ||
186 | MACHINE_END | ||
187 | |||