blob: 494572825c7da49bf3a665adaf1b8574b9dbe9ef [file] [log] [blame]
Daniel Mackbac07ec2009-03-23 02:04:18 +01001/*
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>
Daniel Mack8a28b102009-04-02 08:33:15 +020018#include <linux/interrupt.h>
Daniel Mackbac07ec2009-03-23 02:04:18 +010019
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>
Daniel Mack91fcfb92009-03-23 02:04:19 +010028#include <mach/pxafb.h>
Daniel Mackbac07ec2009-03-23 02:04:18 +010029#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 */
40static struct ax_plat_data colibri_asix_platdata = {
Daniel Mack22a02002009-04-02 08:33:14 +020041 .flags = 0, /* defined later */
42 .wordlength = 2,
Daniel Mackbac07ec2009-03-23 02:04:18 +010043};
44
45static 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),
Daniel Mack8a28b102009-04-02 08:33:15 +020054 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_FALLING,
Daniel Mackbac07ec2009-03-23 02:04:18 +010055 }
56};
57
58static 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
68static 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
73static void __init colibri_pxa320_init_eth(void)
74{
Daniel Mack22a02002009-04-02 08:33:14 +020075 colibri_pxa3xx_init_eth(&colibri_asix_platdata);
Daniel Mackbac07ec2009-03-23 02:04:18 +010076 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_eth_pin_config));
Daniel Mackbac07ec2009-03-23 02:04:18 +010077 platform_device_register(&asix_device);
78}
79#else
80static 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)
84static mfp_cfg_t colibri_pxa320_usb_pin_config[] __initdata = {
85 GPIO2_2_USBH_PEN,
86 GPIO3_2_USBH_PWR,
87};
88
89static 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
94void __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
100static inline void colibri_pxa320_init_ohci(void) {}
101#endif /* CONFIG_USB_OHCI_HCD || CONFIG_USB_OHCI_HCD_MODULE */
102
103static 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
Daniel Mack91fcfb92009-03-23 02:04:19 +0100112#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
113static 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
140static void __init colibri_pxa320_init_lcd(void)
141{
142 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_lcd_pin_config));
143}
144#else
145static inline void colibri_pxa320_init_lcd(void) {}
146#endif
147
Daniel Macke2bb5be2009-03-23 02:04:20 +0100148#if defined(SND_AC97_CODEC) || defined(SND_AC97_CODEC_MODULE)
149static 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
158static 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
164static inline void colibri_pxa320_init_ac97(void) {}
165#endif
166
Alex Romanecc85e12009-07-03 14:58:59 +0800167/*
168 * The following configuration is verified to work with the Toradex Orchid
169 * carrier board
170 */
171static mfp_cfg_t colibri_pxa320_uart_pin_config[] __initdata = {
172 /* UART 1 configuration (may be set by bootloader) */
173 GPIO99_UART1_CTS,
174 GPIO104_UART1_RTS,
175 GPIO97_UART1_RXD,
176 GPIO98_UART1_TXD,
177 GPIO101_UART1_DTR,
178 GPIO103_UART1_DSR,
179 GPIO100_UART1_DCD,
180 GPIO102_UART1_RI,
181
182 /* UART 2 configuration */
183 GPIO109_UART2_CTS,
184 GPIO112_UART2_RTS,
185 GPIO110_UART2_RXD,
186 GPIO111_UART2_TXD,
187
188 /* UART 3 configuration */
189 GPIO30_UART3_RXD,
190 GPIO31_UART3_TXD,
191};
192
193static void __init colibri_pxa320_init_uart(void)
194{
195 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_uart_pin_config));
196}
197
Daniel Mackbac07ec2009-03-23 02:04:18 +0100198void __init colibri_pxa320_init(void)
199{
200 colibri_pxa320_init_eth();
201 colibri_pxa320_init_ohci();
Daniel Mack53740df2009-06-17 10:32:54 +0200202 colibri_pxa3xx_init_nand();
Daniel Mack91fcfb92009-03-23 02:04:19 +0100203 colibri_pxa320_init_lcd();
Daniel Mackc9b78182009-03-27 22:00:09 +0100204 colibri_pxa3xx_init_lcd(mfp_to_gpio(GPIO49_GPIO));
Daniel Macke2bb5be2009-03-23 02:04:20 +0100205 colibri_pxa320_init_ac97();
Daniel Mackbac07ec2009-03-23 02:04:18 +0100206 colibri_pxa3xx_init_mmc(ARRAY_AND_SIZE(colibri_pxa320_mmc_pin_config),
207 mfp_to_gpio(MFP_PIN_GPIO28));
Alex Romanecc85e12009-07-03 14:58:59 +0800208 colibri_pxa320_init_uart();
Daniel Mackbac07ec2009-03-23 02:04:18 +0100209}
210
211MACHINE_START(COLIBRI320, "Toradex Colibri PXA320")
212 .phys_io = 0x40000000,
213 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
214 .boot_params = COLIBRI_SDRAM_BASE + 0x100,
215 .init_machine = colibri_pxa320_init,
216 .map_io = pxa_map_io,
217 .init_irq = pxa3xx_init_irq,
218 .timer = &pxa_timer,
219MACHINE_END
220