blob: a70b256591e673414f0499c3bbe6a0b9e64b923e [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
Daniel Mack5fc9f9a2009-03-13 16:37:09 +010034#if defined(CONFIG_AX88796)
Daniel Mackacb36552009-03-23 02:04:17 +010035#define COLIBRI_ETH_IRQ_GPIO mfp_to_gpio(GPIO26_GPIO)
Daniel Mack22a02002009-04-02 08:33:14 +020036
Daniel Mack5fc9f9a2009-03-13 16:37:09 +010037/*
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 Mack5fc9f9a2009-03-13 16:37:09 +010043};
44
45static struct resource colibri_asix_resource[] = {
46 [0] = {
47 .start = PXA3xx_CS2_PHYS,
Daniel Mack626806d2009-03-23 02:04:16 +010048 .end = PXA3xx_CS2_PHYS + (0x20 * 2) - 1,
Daniel Mack5fc9f9a2009-03-13 16:37:09 +010049 .flags = IORESOURCE_MEM,
50 },
51 [1] = {
Daniel Mackacb36552009-03-23 02:04:17 +010052 .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 Mack5fc9f9a2009-03-13 16:37:09 +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};
Daniel Mackacb36552009-03-23 02:04:17 +010067
68static mfp_cfg_t colibri_pxa300_eth_pin_config[] __initdata = {
69 GPIO1_nCS2, /* AX88796 chip select */
70 GPIO26_GPIO | MFP_PULL_HIGH /* AX88796 IRQ */
71};
72
73static void __init colibri_pxa300_init_eth(void)
74{
Daniel Mack22a02002009-04-02 08:33:14 +020075 colibri_pxa3xx_init_eth(&colibri_asix_platdata);
Daniel Mackacb36552009-03-23 02:04:17 +010076 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_eth_pin_config));
Daniel Mackacb36552009-03-23 02:04:17 +010077 platform_device_register(&asix_device);
78}
79#else
80static inline void __init colibri_pxa300_init_eth(void) {}
Daniel Mack5fc9f9a2009-03-13 16:37:09 +010081#endif /* CONFIG_AX88796 */
82
Daniel Mack42e07ad2009-03-13 16:37:11 +010083#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
Daniel Mackacb36552009-03-23 02:04:17 +010084static mfp_cfg_t colibri_pxa300_usb_pin_config[] __initdata = {
85 GPIO0_2_USBH_PEN,
86 GPIO1_2_USBH_PWR,
87};
88
Daniel Mack42e07ad2009-03-13 16:37:11 +010089static struct pxaohci_platform_data colibri_pxa300_ohci_info = {
90 .port_mode = PMM_GLOBAL_MODE,
91 .flags = ENABLE_PORT1 | POWER_CONTROL_LOW | POWER_SENSE_LOW,
92};
93
Daniel Mackacb36552009-03-23 02:04:17 +010094void __init colibri_pxa300_init_ohci(void)
Daniel Mack42e07ad2009-03-13 16:37:11 +010095{
Daniel Mackacb36552009-03-23 02:04:17 +010096 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_usb_pin_config));
Daniel Mack42e07ad2009-03-13 16:37:11 +010097 pxa_set_ohci_info(&colibri_pxa300_ohci_info);
98}
99#else
100static inline void colibri_pxa300_init_ohci(void) {}
101#endif /* CONFIG_USB_OHCI_HCD || CONFIG_USB_OHCI_HCD_MODULE */
102
Daniel Mackacb36552009-03-23 02:04:17 +0100103static mfp_cfg_t colibri_pxa300_mmc_pin_config[] __initdata = {
104 GPIO7_MMC1_CLK,
105 GPIO14_MMC1_CMD,
106 GPIO3_MMC1_DAT0,
107 GPIO4_MMC1_DAT1,
108 GPIO5_MMC1_DAT2,
109 GPIO6_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_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{
Russell Kingcc155c62009-11-09 13:34:08 +0800174 pxa_set_ffuart_info(NULL);
175 pxa_set_btuart_info(NULL);
176 pxa_set_stuart_info(NULL);
177
Daniel Mackacb36552009-03-23 02:04:17 +0100178 colibri_pxa300_init_eth();
Daniel Mack42e07ad2009-03-13 16:37:11 +0100179 colibri_pxa300_init_ohci();
Daniel Mack53740df2009-06-17 10:32:54 +0200180 colibri_pxa3xx_init_nand();
Daniel Mack91fcfb92009-03-23 02:04:19 +0100181 colibri_pxa300_init_lcd();
Daniel Mackc9b78182009-03-27 22:00:09 +0100182 colibri_pxa3xx_init_lcd(mfp_to_gpio(GPIO39_GPIO));
Daniel Macke2bb5be2009-03-23 02:04:20 +0100183 colibri_pxa310_init_ac97();
Daniel Mackacb36552009-03-23 02:04:17 +0100184 colibri_pxa3xx_init_mmc(ARRAY_AND_SIZE(colibri_pxa300_mmc_pin_config),
185 mfp_to_gpio(MFP_PIN_GPIO13));
Daniel Mack5fc9f9a2009-03-13 16:37:09 +0100186}
187
188MACHINE_START(COLIBRI300, "Toradex Colibri PXA300")
Daniel Mack5fc9f9a2009-03-13 16:37:09 +0100189 .boot_params = COLIBRI_SDRAM_BASE + 0x100,
190 .init_machine = colibri_pxa300_init,
191 .map_io = pxa_map_io,
192 .init_irq = pxa3xx_init_irq,
193 .timer = &pxa_timer,
194MACHINE_END
195