ARM: Tegra: Force PORT_TEGRA as the UART type
[deliverable/linux.git] / arch / arm / mach-tegra / board-seaboard.c
1 /*
2 * Copyright (c) 2010, 2011 NVIDIA Corporation.
3 * Copyright (C) 2010, 2011 Google, Inc.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 */
16
17 #include <linux/kernel.h>
18 #include <linux/init.h>
19 #include <linux/platform_device.h>
20 #include <linux/serial_8250.h>
21 #include <linux/i2c.h>
22 #include <linux/delay.h>
23 #include <linux/input.h>
24 #include <linux/io.h>
25 #include <linux/gpio.h>
26 #include <linux/gpio_keys.h>
27
28 #include <sound/wm8903.h>
29
30 #include <mach/iomap.h>
31 #include <mach/irqs.h>
32 #include <mach/sdhci.h>
33 #include <mach/tegra_wm8903_pdata.h>
34
35 #include <asm/mach-types.h>
36 #include <asm/mach/arch.h>
37
38 #include "board.h"
39 #include "board-seaboard.h"
40 #include "clock.h"
41 #include "devices.h"
42 #include "gpio-names.h"
43
44 static struct plat_serial8250_port debug_uart_platform_data[] = {
45 {
46 /* Memory and IRQ filled in before registration */
47 .flags = UPF_BOOT_AUTOCONF | UPF_FIXED_TYPE,
48 .type = PORT_TEGRA,
49 .iotype = UPIO_MEM,
50 .regshift = 2,
51 .uartclk = 216000000,
52 }, {
53 .flags = 0,
54 }
55 };
56
57 static struct platform_device debug_uart = {
58 .name = "serial8250",
59 .id = PLAT8250_DEV_PLATFORM,
60 .dev = {
61 .platform_data = debug_uart_platform_data,
62 },
63 };
64
65 static __initdata struct tegra_clk_init_table seaboard_clk_init_table[] = {
66 /* name parent rate enabled */
67 { "uartb", "pll_p", 216000000, true},
68 { "uartd", "pll_p", 216000000, true},
69 { "pll_a", "pll_p_out1", 56448000, true },
70 { "pll_a_out0", "pll_a", 11289600, true },
71 { "cdev1", NULL, 0, true },
72 { "i2s1", "pll_a_out0", 11289600, false},
73 { "usbd", "clk_m", 12000000, true},
74 { "usb3", "clk_m", 12000000, true},
75 { NULL, NULL, 0, 0},
76 };
77
78 static struct gpio_keys_button seaboard_gpio_keys_buttons[] = {
79 {
80 .code = SW_LID,
81 .gpio = TEGRA_GPIO_LIDSWITCH,
82 .active_low = 0,
83 .desc = "Lid",
84 .type = EV_SW,
85 .wakeup = 1,
86 .debounce_interval = 1,
87 },
88 {
89 .code = KEY_POWER,
90 .gpio = TEGRA_GPIO_POWERKEY,
91 .active_low = 1,
92 .desc = "Power",
93 .type = EV_KEY,
94 .wakeup = 1,
95 },
96 };
97
98 static struct gpio_keys_platform_data seaboard_gpio_keys = {
99 .buttons = seaboard_gpio_keys_buttons,
100 .nbuttons = ARRAY_SIZE(seaboard_gpio_keys_buttons),
101 };
102
103 static struct platform_device seaboard_gpio_keys_device = {
104 .name = "gpio-keys",
105 .id = -1,
106 .dev = {
107 .platform_data = &seaboard_gpio_keys,
108 }
109 };
110
111 static struct tegra_sdhci_platform_data sdhci_pdata1 = {
112 .cd_gpio = -1,
113 .wp_gpio = -1,
114 .power_gpio = -1,
115 };
116
117 static struct tegra_sdhci_platform_data sdhci_pdata3 = {
118 .cd_gpio = TEGRA_GPIO_SD2_CD,
119 .wp_gpio = TEGRA_GPIO_SD2_WP,
120 .power_gpio = TEGRA_GPIO_SD2_POWER,
121 };
122
123 static struct tegra_sdhci_platform_data sdhci_pdata4 = {
124 .cd_gpio = -1,
125 .wp_gpio = -1,
126 .power_gpio = -1,
127 .is_8bit = 1,
128 };
129
130 static struct tegra_wm8903_platform_data seaboard_audio_pdata = {
131 .gpio_spkr_en = TEGRA_GPIO_SPKR_EN,
132 .gpio_hp_det = TEGRA_GPIO_HP_DET,
133 .gpio_hp_mute = -1,
134 .gpio_int_mic_en = -1,
135 .gpio_ext_mic_en = -1,
136 };
137
138 static struct platform_device seaboard_audio_device = {
139 .name = "tegra-snd-wm8903",
140 .id = 0,
141 .dev = {
142 .platform_data = &seaboard_audio_pdata,
143 },
144 };
145
146 static struct platform_device *seaboard_devices[] __initdata = {
147 &debug_uart,
148 &tegra_pmu_device,
149 &tegra_sdhci_device4,
150 &tegra_sdhci_device3,
151 &tegra_sdhci_device1,
152 &seaboard_gpio_keys_device,
153 &tegra_i2s_device1,
154 &tegra_das_device,
155 &tegra_pcm_device,
156 &seaboard_audio_device,
157 };
158
159 static struct i2c_board_info __initdata isl29018_device = {
160 I2C_BOARD_INFO("isl29018", 0x44),
161 .irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_ISL29018_IRQ),
162 };
163
164 static struct i2c_board_info __initdata adt7461_device = {
165 I2C_BOARD_INFO("adt7461", 0x4c),
166 };
167
168 static struct wm8903_platform_data wm8903_pdata = {
169 .irq_active_low = 0,
170 .micdet_cfg = 0,
171 .micdet_delay = 100,
172 .gpio_base = SEABOARD_GPIO_WM8903(0),
173 .gpio_cfg = {
174 WM8903_GPIO_NO_CONFIG,
175 WM8903_GPIO_NO_CONFIG,
176 0,
177 WM8903_GPIO_NO_CONFIG,
178 WM8903_GPIO_NO_CONFIG,
179 },
180 };
181
182 static struct i2c_board_info __initdata wm8903_device = {
183 I2C_BOARD_INFO("wm8903", 0x1a),
184 .platform_data = &wm8903_pdata,
185 .irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_CDC_IRQ),
186 };
187
188 static int seaboard_ehci_init(void)
189 {
190 int gpio_status;
191
192 gpio_status = gpio_request(TEGRA_GPIO_USB1, "VBUS_USB1");
193 if (gpio_status < 0) {
194 pr_err("VBUS_USB1 request GPIO FAILED\n");
195 WARN_ON(1);
196 }
197
198 gpio_status = gpio_direction_output(TEGRA_GPIO_USB1, 1);
199 if (gpio_status < 0) {
200 pr_err("VBUS_USB1 request GPIO DIRECTION FAILED\n");
201 WARN_ON(1);
202 }
203 gpio_set_value(TEGRA_GPIO_USB1, 1);
204
205 platform_device_register(&tegra_ehci1_device);
206 platform_device_register(&tegra_ehci3_device);
207
208 return 0;
209 }
210
211 static void __init seaboard_i2c_init(void)
212 {
213 gpio_request(TEGRA_GPIO_ISL29018_IRQ, "isl29018");
214 gpio_direction_input(TEGRA_GPIO_ISL29018_IRQ);
215
216 i2c_register_board_info(0, &isl29018_device, 1);
217 i2c_register_board_info(0, &wm8903_device, 1);
218
219 i2c_register_board_info(3, &adt7461_device, 1);
220
221 platform_device_register(&tegra_i2c_device1);
222 platform_device_register(&tegra_i2c_device2);
223 platform_device_register(&tegra_i2c_device3);
224 platform_device_register(&tegra_i2c_device4);
225 }
226
227 static void __init seaboard_common_init(void)
228 {
229 seaboard_pinmux_init();
230
231 tegra_clk_init_from_table(seaboard_clk_init_table);
232
233 tegra_sdhci_device1.dev.platform_data = &sdhci_pdata1;
234 tegra_sdhci_device3.dev.platform_data = &sdhci_pdata3;
235 tegra_sdhci_device4.dev.platform_data = &sdhci_pdata4;
236
237 platform_add_devices(seaboard_devices, ARRAY_SIZE(seaboard_devices));
238
239 seaboard_ehci_init();
240 }
241
242 static void __init tegra_seaboard_init(void)
243 {
244 /* Seaboard uses UARTD for the debug port. */
245 debug_uart_platform_data[0].membase = IO_ADDRESS(TEGRA_UARTD_BASE);
246 debug_uart_platform_data[0].mapbase = TEGRA_UARTD_BASE;
247 debug_uart_platform_data[0].irq = INT_UARTD;
248
249 seaboard_common_init();
250
251 seaboard_i2c_init();
252 }
253
254 static void __init tegra_kaen_init(void)
255 {
256 /* Kaen uses UARTB for the debug port. */
257 debug_uart_platform_data[0].membase = IO_ADDRESS(TEGRA_UARTB_BASE);
258 debug_uart_platform_data[0].mapbase = TEGRA_UARTB_BASE;
259 debug_uart_platform_data[0].irq = INT_UARTB;
260
261 seaboard_audio_pdata.gpio_hp_mute = TEGRA_GPIO_KAEN_HP_MUTE;
262 tegra_gpio_enable(TEGRA_GPIO_KAEN_HP_MUTE);
263
264 seaboard_common_init();
265
266 seaboard_i2c_init();
267 }
268
269 static void __init tegra_wario_init(void)
270 {
271 /* Wario uses UARTB for the debug port. */
272 debug_uart_platform_data[0].membase = IO_ADDRESS(TEGRA_UARTB_BASE);
273 debug_uart_platform_data[0].mapbase = TEGRA_UARTB_BASE;
274 debug_uart_platform_data[0].irq = INT_UARTB;
275
276 seaboard_common_init();
277
278 seaboard_i2c_init();
279 }
280
281
282 MACHINE_START(SEABOARD, "seaboard")
283 .boot_params = 0x00000100,
284 .map_io = tegra_map_common_io,
285 .init_early = tegra_init_early,
286 .init_irq = tegra_init_irq,
287 .timer = &tegra_timer,
288 .init_machine = tegra_seaboard_init,
289 MACHINE_END
290
291 MACHINE_START(KAEN, "kaen")
292 .boot_params = 0x00000100,
293 .map_io = tegra_map_common_io,
294 .init_early = tegra_init_early,
295 .init_irq = tegra_init_irq,
296 .timer = &tegra_timer,
297 .init_machine = tegra_kaen_init,
298 MACHINE_END
299
300 MACHINE_START(WARIO, "wario")
301 .boot_params = 0x00000100,
302 .map_io = tegra_map_common_io,
303 .init_early = tegra_init_early,
304 .init_irq = tegra_init_irq,
305 .timer = &tegra_timer,
306 .init_machine = tegra_wario_init,
307 MACHINE_END
This page took 0.039949 seconds and 5 git commands to generate.