blob: 8a742b779e059a65e6512a558c563c02d6001063 [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>
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>
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),
54 .flags = IORESOURCE_IRQ
55 }
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));
77 set_irq_type(gpio_to_irq(COLIBRI_ETH_IRQ_GPIO), IRQ_TYPE_EDGE_FALLING);
78 platform_device_register(&asix_device);
79}
80#else
81static inline void __init colibri_pxa320_init_eth(void) {}
82#endif /* CONFIG_AX88796 */
83
84#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
85static mfp_cfg_t colibri_pxa320_usb_pin_config[] __initdata = {
86 GPIO2_2_USBH_PEN,
87 GPIO3_2_USBH_PWR,
88};
89
90static struct pxaohci_platform_data colibri_pxa320_ohci_info = {
91 .port_mode = PMM_GLOBAL_MODE,
92 .flags = ENABLE_PORT1 | POWER_CONTROL_LOW | POWER_SENSE_LOW,
93};
94
95void __init colibri_pxa320_init_ohci(void)
96{
97 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_usb_pin_config));
98 pxa_set_ohci_info(&colibri_pxa320_ohci_info);
99}
100#else
101static inline void colibri_pxa320_init_ohci(void) {}
102#endif /* CONFIG_USB_OHCI_HCD || CONFIG_USB_OHCI_HCD_MODULE */
103
104static mfp_cfg_t colibri_pxa320_mmc_pin_config[] __initdata = {
105 GPIO22_MMC1_CLK,
106 GPIO23_MMC1_CMD,
107 GPIO18_MMC1_DAT0,
108 GPIO19_MMC1_DAT1,
109 GPIO20_MMC1_DAT2,
110 GPIO21_MMC1_DAT3
111};
112
Daniel Mack91fcfb92009-03-23 02:04:19 +0100113#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
114static mfp_cfg_t colibri_pxa320_lcd_pin_config[] __initdata = {
115 GPIO6_2_LCD_LDD_0,
116 GPIO7_2_LCD_LDD_1,
117 GPIO8_2_LCD_LDD_2,
118 GPIO9_2_LCD_LDD_3,
119 GPIO10_2_LCD_LDD_4,
120 GPIO11_2_LCD_LDD_5,
121 GPIO12_2_LCD_LDD_6,
122 GPIO13_2_LCD_LDD_7,
123 GPIO63_LCD_LDD_8,
124 GPIO64_LCD_LDD_9,
125 GPIO65_LCD_LDD_10,
126 GPIO66_LCD_LDD_11,
127 GPIO67_LCD_LDD_12,
128 GPIO68_LCD_LDD_13,
129 GPIO69_LCD_LDD_14,
130 GPIO70_LCD_LDD_15,
131 GPIO71_LCD_LDD_16,
132 GPIO72_LCD_LDD_17,
133 GPIO73_LCD_CS_N,
134 GPIO74_LCD_VSYNC,
135 GPIO14_2_LCD_FCLK,
136 GPIO15_2_LCD_LCLK,
137 GPIO16_2_LCD_PCLK,
138 GPIO17_2_LCD_BIAS,
139};
140
141static void __init colibri_pxa320_init_lcd(void)
142{
143 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_lcd_pin_config));
144}
145#else
146static inline void colibri_pxa320_init_lcd(void) {}
147#endif
148
Daniel Macke2bb5be2009-03-23 02:04:20 +0100149#if defined(SND_AC97_CODEC) || defined(SND_AC97_CODEC_MODULE)
150static mfp_cfg_t colibri_pxa320_ac97_pin_config[] __initdata = {
151 GPIO34_AC97_SYSCLK,
152 GPIO35_AC97_SDATA_IN_0,
153 GPIO37_AC97_SDATA_OUT,
154 GPIO38_AC97_SYNC,
155 GPIO39_AC97_BITCLK,
156 GPIO40_AC97_nACRESET
157};
158
159static inline void __init colibri_pxa320_init_ac97(void)
160{
161 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_ac97_pin_config));
162 pxa_set_ac97_info(NULL);
163}
164#else
165static inline void colibri_pxa320_init_ac97(void) {}
166#endif
167
Daniel Mackbac07ec2009-03-23 02:04:18 +0100168void __init colibri_pxa320_init(void)
169{
170 colibri_pxa320_init_eth();
171 colibri_pxa320_init_ohci();
Daniel Mack91fcfb92009-03-23 02:04:19 +0100172 colibri_pxa320_init_lcd();
Daniel Mackc9b78182009-03-27 22:00:09 +0100173 colibri_pxa3xx_init_lcd(mfp_to_gpio(GPIO49_GPIO));
Daniel Macke2bb5be2009-03-23 02:04:20 +0100174 colibri_pxa320_init_ac97();
Daniel Mackbac07ec2009-03-23 02:04:18 +0100175 colibri_pxa3xx_init_mmc(ARRAY_AND_SIZE(colibri_pxa320_mmc_pin_config),
176 mfp_to_gpio(MFP_PIN_GPIO28));
177}
178
179MACHINE_START(COLIBRI320, "Toradex Colibri PXA320")
180 .phys_io = 0x40000000,
181 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
182 .boot_params = COLIBRI_SDRAM_BASE + 0x100,
183 .init_machine = colibri_pxa320_init,
184 .map_io = pxa_map_io,
185 .init_irq = pxa3xx_init_irq,
186 .timer = &pxa_timer,
187MACHINE_END
188