blob: 9b8d72de294c7dd392976592db3e45beec97127f [file] [log] [blame]
Daniel Mack5fc9f9a2009-03-13 16:37:09 +01001/*
2 * arch/arm/mach-pxa/colibri-pxa300.c
3 *
Daniel Mackacb36552009-03-23 02:04:17 +01004 * Support for Toradex PXA300/310 based Colibri module
5 *
Daniel Mack5fc9f9a2009-03-13 16:37:09 +01006 * Daniel Mack <daniel@caiaq.de>
Daniel Mackacb36552009-03-23 02:04:17 +01007 * Matthias Meier <matthias.j.meier@gmx.net>
Daniel Mack5fc9f9a2009-03-13 16:37:09 +01008 *
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 Mack5fc9f9a2009-03-13 16:37:09 +010019
20#include <asm/mach-types.h>
Daniel Mackacb36552009-03-23 02:04:17 +010021#include <asm/sizes.h>
Daniel Mack5fc9f9a2009-03-13 16:37:09 +010022#include <asm/mach/arch.h>
23#include <asm/mach/irq.h>
24
25#include <mach/pxa300.h>
26#include <mach/colibri.h>
Daniel Mack42e07ad2009-03-13 16:37:11 +010027#include <mach/ohci.h>
Daniel Mack91fcfb92009-03-23 02:04:19 +010028#include <mach/pxafb.h>
pieterg7fad6982010-07-08 19:04:05 +020029#include <mach/audio.h>
Daniel Mack5fc9f9a2009-03-13 16:37:09 +010030
31#include "generic.h"
32#include "devices.h"
33
Marek Vasut9b6956f2010-08-12 01:18:38 +020034
35#ifdef CONFIG_MACH_COLIBRI_PXA270_EVALBOARD
36static mfp_cfg_t colibri_pxa300_evalboard_pin_config[] __initdata = {
37 /* MMC */
38 GPIO7_MMC1_CLK,
39 GPIO14_MMC1_CMD,
40 GPIO3_MMC1_DAT0,
41 GPIO4_MMC1_DAT1,
42 GPIO5_MMC1_DAT2,
43 GPIO6_MMC1_DAT3,
44 GPIO39_GPIO, /* SD detect */
45
46 /* UHC */
47 GPIO0_2_USBH_PEN,
48 GPIO1_2_USBH_PWR,
Marek Vasut072e1ae2010-08-12 01:30:39 +020049
50 /* I2C */
51 GPIO21_I2C_SCL,
52 GPIO22_I2C_SDA,
Marek Vasut9b6956f2010-08-12 01:18:38 +020053};
54#else
55static mfp_cfg_t colibri_pxa300_evalboard_pin_config[] __initdata = {};
56#endif
57
Daniel Mack5fc9f9a2009-03-13 16:37:09 +010058#if defined(CONFIG_AX88796)
Daniel Mackacb36552009-03-23 02:04:17 +010059#define COLIBRI_ETH_IRQ_GPIO mfp_to_gpio(GPIO26_GPIO)
Daniel Mack5fc9f9a2009-03-13 16:37:09 +010060/*
61 * Asix AX88796 Ethernet
62 */
63static struct ax_plat_data colibri_asix_platdata = {
Daniel Mack22a02002009-04-02 08:33:14 +020064 .flags = 0, /* defined later */
65 .wordlength = 2,
Daniel Mack5fc9f9a2009-03-13 16:37:09 +010066};
67
68static struct resource colibri_asix_resource[] = {
69 [0] = {
70 .start = PXA3xx_CS2_PHYS,
Daniel Mack626806d2009-03-23 02:04:16 +010071 .end = PXA3xx_CS2_PHYS + (0x20 * 2) - 1,
Daniel Mack5fc9f9a2009-03-13 16:37:09 +010072 .flags = IORESOURCE_MEM,
73 },
74 [1] = {
Daniel Mackacb36552009-03-23 02:04:17 +010075 .start = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO),
76 .end = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO),
Daniel Mack8a28b102009-04-02 08:33:15 +020077 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_FALLING,
Daniel Mack5fc9f9a2009-03-13 16:37:09 +010078 }
79};
80
81static struct platform_device asix_device = {
82 .name = "ax88796",
83 .id = 0,
84 .num_resources = ARRAY_SIZE(colibri_asix_resource),
85 .resource = colibri_asix_resource,
86 .dev = {
87 .platform_data = &colibri_asix_platdata
88 }
89};
Daniel Mackacb36552009-03-23 02:04:17 +010090
91static mfp_cfg_t colibri_pxa300_eth_pin_config[] __initdata = {
92 GPIO1_nCS2, /* AX88796 chip select */
93 GPIO26_GPIO | MFP_PULL_HIGH /* AX88796 IRQ */
94};
95
96static void __init colibri_pxa300_init_eth(void)
97{
Daniel Mack22a02002009-04-02 08:33:14 +020098 colibri_pxa3xx_init_eth(&colibri_asix_platdata);
Daniel Mackacb36552009-03-23 02:04:17 +010099 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_eth_pin_config));
Daniel Mackacb36552009-03-23 02:04:17 +0100100 platform_device_register(&asix_device);
101}
102#else
103static inline void __init colibri_pxa300_init_eth(void) {}
Daniel Mack5fc9f9a2009-03-13 16:37:09 +0100104#endif /* CONFIG_AX88796 */
105
Daniel Mack91fcfb92009-03-23 02:04:19 +0100106#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
107static mfp_cfg_t colibri_pxa300_lcd_pin_config[] __initdata = {
108 GPIO54_LCD_LDD_0,
109 GPIO55_LCD_LDD_1,
110 GPIO56_LCD_LDD_2,
111 GPIO57_LCD_LDD_3,
112 GPIO58_LCD_LDD_4,
113 GPIO59_LCD_LDD_5,
114 GPIO60_LCD_LDD_6,
115 GPIO61_LCD_LDD_7,
116 GPIO62_LCD_LDD_8,
117 GPIO63_LCD_LDD_9,
118 GPIO64_LCD_LDD_10,
119 GPIO65_LCD_LDD_11,
120 GPIO66_LCD_LDD_12,
121 GPIO67_LCD_LDD_13,
122 GPIO68_LCD_LDD_14,
123 GPIO69_LCD_LDD_15,
124 GPIO70_LCD_LDD_16,
125 GPIO71_LCD_LDD_17,
126 GPIO62_LCD_CS_N,
127 GPIO72_LCD_FCLK,
128 GPIO73_LCD_LCLK,
129 GPIO74_LCD_PCLK,
130 GPIO75_LCD_BIAS,
131 GPIO76_LCD_VSYNC,
132};
133
134static void __init colibri_pxa300_init_lcd(void)
135{
136 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_lcd_pin_config));
137}
138
139#else
140static inline void colibri_pxa300_init_lcd(void) {}
141#endif /* CONFIG_FB_PXA || CONFIG_FB_PXA_MODULE */
142
pieterg7fad6982010-07-08 19:04:05 +0200143#if defined(CONFIG_SND_AC97_CODEC) || defined(CONFIG_SND_AC97_CODEC_MODULE)
Daniel Macke2bb5be2009-03-23 02:04:20 +0100144static mfp_cfg_t colibri_pxa310_ac97_pin_config[] __initdata = {
145 GPIO24_AC97_SYSCLK,
146 GPIO23_AC97_nACRESET,
147 GPIO25_AC97_SDATA_IN_0,
148 GPIO27_AC97_SDATA_OUT,
149 GPIO28_AC97_SYNC,
150 GPIO29_AC97_BITCLK
151};
152
153static inline void __init colibri_pxa310_init_ac97(void)
154{
155 /* no AC97 codec on Colibri PXA300 */
156 if (!cpu_is_pxa310())
157 return;
158
159 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa310_ac97_pin_config));
160 pxa_set_ac97_info(NULL);
161}
162#else
163static inline void colibri_pxa310_init_ac97(void) {}
164#endif
165
Daniel Mackacb36552009-03-23 02:04:17 +0100166void __init colibri_pxa300_init(void)
Daniel Mack5fc9f9a2009-03-13 16:37:09 +0100167{
Daniel Mackacb36552009-03-23 02:04:17 +0100168 colibri_pxa300_init_eth();
Daniel Mack53740df2009-06-17 10:32:54 +0200169 colibri_pxa3xx_init_nand();
Daniel Mack91fcfb92009-03-23 02:04:19 +0100170 colibri_pxa300_init_lcd();
Daniel Mackc9b78182009-03-27 22:00:09 +0100171 colibri_pxa3xx_init_lcd(mfp_to_gpio(GPIO39_GPIO));
Daniel Macke2bb5be2009-03-23 02:04:20 +0100172 colibri_pxa310_init_ac97();
Marek Vasut9b6956f2010-08-12 01:18:38 +0200173
174 /* Evalboard init */
175 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_evalboard_pin_config));
176 colibri_pxa270_evalboard_init();
Daniel Mack5fc9f9a2009-03-13 16:37:09 +0100177}
178
179MACHINE_START(COLIBRI300, "Toradex Colibri PXA300")
Daniel Mack5fc9f9a2009-03-13 16:37:09 +0100180 .boot_params = COLIBRI_SDRAM_BASE + 0x100,
181 .init_machine = colibri_pxa300_init,
Marek Vasut851982c2010-10-11 02:20:19 +0200182 .map_io = pxa3xx_map_io,
Daniel Mack5fc9f9a2009-03-13 16:37:09 +0100183 .init_irq = pxa3xx_init_irq,
184 .timer = &pxa_timer,
185MACHINE_END
186