blob: bb6def8ec979d280ebf866c927612b5445424919 [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
Marek Vasuta3172e52010-08-12 01:45:05 +020035#ifdef CONFIG_MACH_COLIBRI_EVALBOARD
Marek Vasut9b6956f2010-08-12 01:18:38 +020036static 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,
Bjørn Forsman57834a72010-12-23 16:01:02 +010044 GPIO13_GPIO, /* GPIO13_COLIBRI_PXA300_SD_DETECT */
Marek Vasut9b6956f2010-08-12 01:18:38 +020045
46 /* UHC */
47 GPIO0_2_USBH_PEN,
48 GPIO1_2_USBH_PWR,
Bjorn Forsman3534ccc2010-11-03 00:46:04 +010049 GPIO77_USB_P3_1,
50 GPIO78_USB_P3_2,
51 GPIO79_USB_P3_3,
52 GPIO80_USB_P3_4,
53 GPIO81_USB_P3_5,
54 GPIO82_USB_P3_6,
Marek Vasut072e1ae2010-08-12 01:30:39 +020055
56 /* I2C */
57 GPIO21_I2C_SCL,
58 GPIO22_I2C_SDA,
Marek Vasut9b6956f2010-08-12 01:18:38 +020059};
60#else
61static mfp_cfg_t colibri_pxa300_evalboard_pin_config[] __initdata = {};
62#endif
63
Daniel Mack5fc9f9a2009-03-13 16:37:09 +010064#if defined(CONFIG_AX88796)
Daniel Mackacb36552009-03-23 02:04:17 +010065#define COLIBRI_ETH_IRQ_GPIO mfp_to_gpio(GPIO26_GPIO)
Daniel Mack5fc9f9a2009-03-13 16:37:09 +010066/*
67 * Asix AX88796 Ethernet
68 */
69static struct ax_plat_data colibri_asix_platdata = {
Daniel Mack22a02002009-04-02 08:33:14 +020070 .flags = 0, /* defined later */
71 .wordlength = 2,
Daniel Mack5fc9f9a2009-03-13 16:37:09 +010072};
73
74static struct resource colibri_asix_resource[] = {
75 [0] = {
76 .start = PXA3xx_CS2_PHYS,
Daniel Mack626806d2009-03-23 02:04:16 +010077 .end = PXA3xx_CS2_PHYS + (0x20 * 2) - 1,
Daniel Mack5fc9f9a2009-03-13 16:37:09 +010078 .flags = IORESOURCE_MEM,
79 },
80 [1] = {
Haojian Zhuang4929f5a2011-10-10 16:03:51 +080081 .start = PXA_GPIO_TO_IRQ(COLIBRI_ETH_IRQ_GPIO),
82 .end = PXA_GPIO_TO_IRQ(COLIBRI_ETH_IRQ_GPIO),
Daniel Mack8a28b102009-04-02 08:33:15 +020083 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_FALLING,
Daniel Mack5fc9f9a2009-03-13 16:37:09 +010084 }
85};
86
87static struct platform_device asix_device = {
88 .name = "ax88796",
89 .id = 0,
90 .num_resources = ARRAY_SIZE(colibri_asix_resource),
91 .resource = colibri_asix_resource,
92 .dev = {
93 .platform_data = &colibri_asix_platdata
94 }
95};
Daniel Mackacb36552009-03-23 02:04:17 +010096
97static mfp_cfg_t colibri_pxa300_eth_pin_config[] __initdata = {
98 GPIO1_nCS2, /* AX88796 chip select */
99 GPIO26_GPIO | MFP_PULL_HIGH /* AX88796 IRQ */
100};
101
102static void __init colibri_pxa300_init_eth(void)
103{
Daniel Mack22a02002009-04-02 08:33:14 +0200104 colibri_pxa3xx_init_eth(&colibri_asix_platdata);
Daniel Mackacb36552009-03-23 02:04:17 +0100105 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_eth_pin_config));
Daniel Mackacb36552009-03-23 02:04:17 +0100106 platform_device_register(&asix_device);
107}
108#else
109static inline void __init colibri_pxa300_init_eth(void) {}
Daniel Mack5fc9f9a2009-03-13 16:37:09 +0100110#endif /* CONFIG_AX88796 */
111
Daniel Mack91fcfb92009-03-23 02:04:19 +0100112#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
113static mfp_cfg_t colibri_pxa300_lcd_pin_config[] __initdata = {
114 GPIO54_LCD_LDD_0,
115 GPIO55_LCD_LDD_1,
116 GPIO56_LCD_LDD_2,
117 GPIO57_LCD_LDD_3,
118 GPIO58_LCD_LDD_4,
119 GPIO59_LCD_LDD_5,
120 GPIO60_LCD_LDD_6,
121 GPIO61_LCD_LDD_7,
122 GPIO62_LCD_LDD_8,
123 GPIO63_LCD_LDD_9,
124 GPIO64_LCD_LDD_10,
125 GPIO65_LCD_LDD_11,
126 GPIO66_LCD_LDD_12,
127 GPIO67_LCD_LDD_13,
128 GPIO68_LCD_LDD_14,
129 GPIO69_LCD_LDD_15,
130 GPIO70_LCD_LDD_16,
131 GPIO71_LCD_LDD_17,
132 GPIO62_LCD_CS_N,
133 GPIO72_LCD_FCLK,
134 GPIO73_LCD_LCLK,
135 GPIO74_LCD_PCLK,
136 GPIO75_LCD_BIAS,
137 GPIO76_LCD_VSYNC,
138};
139
140static void __init colibri_pxa300_init_lcd(void)
141{
142 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_lcd_pin_config));
143}
144
145#else
146static inline void colibri_pxa300_init_lcd(void) {}
147#endif /* CONFIG_FB_PXA || CONFIG_FB_PXA_MODULE */
148
pieterg7fad6982010-07-08 19:04:05 +0200149#if defined(CONFIG_SND_AC97_CODEC) || defined(CONFIG_SND_AC97_CODEC_MODULE)
Daniel Macke2bb5be2009-03-23 02:04:20 +0100150static mfp_cfg_t colibri_pxa310_ac97_pin_config[] __initdata = {
151 GPIO24_AC97_SYSCLK,
152 GPIO23_AC97_nACRESET,
153 GPIO25_AC97_SDATA_IN_0,
154 GPIO27_AC97_SDATA_OUT,
155 GPIO28_AC97_SYNC,
156 GPIO29_AC97_BITCLK
157};
158
159static inline void __init colibri_pxa310_init_ac97(void)
160{
161 /* no AC97 codec on Colibri PXA300 */
162 if (!cpu_is_pxa310())
163 return;
164
165 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa310_ac97_pin_config));
166 pxa_set_ac97_info(NULL);
167}
168#else
169static inline void colibri_pxa310_init_ac97(void) {}
170#endif
171
Daniel Mackacb36552009-03-23 02:04:17 +0100172void __init colibri_pxa300_init(void)
Daniel Mack5fc9f9a2009-03-13 16:37:09 +0100173{
Daniel Mackacb36552009-03-23 02:04:17 +0100174 colibri_pxa300_init_eth();
Daniel Mack53740df2009-06-17 10:32:54 +0200175 colibri_pxa3xx_init_nand();
Daniel Mack91fcfb92009-03-23 02:04:19 +0100176 colibri_pxa300_init_lcd();
Daniel Mackc9b78182009-03-27 22:00:09 +0100177 colibri_pxa3xx_init_lcd(mfp_to_gpio(GPIO39_GPIO));
Daniel Macke2bb5be2009-03-23 02:04:20 +0100178 colibri_pxa310_init_ac97();
Marek Vasut9b6956f2010-08-12 01:18:38 +0200179
180 /* Evalboard init */
181 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_evalboard_pin_config));
Marek Vasuta3172e52010-08-12 01:45:05 +0200182 colibri_evalboard_init();
Daniel Mack5fc9f9a2009-03-13 16:37:09 +0100183}
184
185MACHINE_START(COLIBRI300, "Toradex Colibri PXA300")
Nicolas Pitre7375aba2011-07-05 22:38:15 -0400186 .atag_offset = 0x100,
Daniel Mack5fc9f9a2009-03-13 16:37:09 +0100187 .init_machine = colibri_pxa300_init,
Marek Vasut851982c2010-10-11 02:20:19 +0200188 .map_io = pxa3xx_map_io,
Rob Herring4e611092012-01-03 16:53:48 -0600189 .nr_irqs = PXA_NR_IRQS,
Daniel Mack5fc9f9a2009-03-13 16:37:09 +0100190 .init_irq = pxa3xx_init_irq,
Eric Miao8a97ae22011-05-18 21:30:04 +0800191 .handle_irq = pxa3xx_handle_irq,
Daniel Mack5fc9f9a2009-03-13 16:37:09 +0100192 .timer = &pxa_timer,
Russell King271a74f2011-11-04 14:15:53 +0000193 .restart = pxa_restart,
Daniel Mack5fc9f9a2009-03-13 16:37:09 +0100194MACHINE_END
195