2 * Copyright (c) 2010, 2011 NVIDIA Corporation.
3 * Copyright (C) 2010, 2011 Google, Inc.
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.
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
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>
25 #include <linux/gpio.h>
26 #include <linux/gpio_keys.h>
27 #include <linux/platform_data/tegra_usb.h>
29 #include <sound/wm8903.h>
31 #include <mach/iomap.h>
32 #include <mach/irqs.h>
33 #include <mach/sdhci.h>
34 #include <mach/tegra_wm8903_pdata.h>
36 #include <asm/mach-types.h>
37 #include <asm/mach/arch.h>
38 #include <asm/hardware/gic.h>
41 #include "board-seaboard.h"
44 #include "gpio-names.h"
46 static struct plat_serial8250_port debug_uart_platform_data[] = {
48 /* Memory and IRQ filled in before registration */
49 .flags = UPF_BOOT_AUTOCONF | UPF_FIXED_TYPE,
59 static struct platform_device debug_uart = {
61 .id = PLAT8250_DEV_PLATFORM,
63 .platform_data = debug_uart_platform_data,
67 static __initdata struct tegra_clk_init_table seaboard_clk_init_table[] = {
68 /* name parent rate enabled */
69 { "uartb", "pll_p", 216000000, true},
70 { "uartd", "pll_p", 216000000, true},
71 { "pll_a", "pll_p_out1", 56448000, true },
72 { "pll_a_out0", "pll_a", 11289600, true },
73 { "cdev1", NULL, 0, true },
74 { "i2s1", "pll_a_out0", 11289600, false},
75 { "usbd", "clk_m", 12000000, true},
76 { "usb3", "clk_m", 12000000, true},
80 static struct gpio_keys_button seaboard_gpio_keys_buttons[] = {
83 .gpio = TEGRA_GPIO_LIDSWITCH,
88 .debounce_interval = 1,
92 .gpio = TEGRA_GPIO_POWERKEY,
100 static struct gpio_keys_platform_data seaboard_gpio_keys = {
101 .buttons = seaboard_gpio_keys_buttons,
102 .nbuttons = ARRAY_SIZE(seaboard_gpio_keys_buttons),
105 static struct platform_device seaboard_gpio_keys_device = {
109 .platform_data = &seaboard_gpio_keys,
113 static struct tegra_sdhci_platform_data sdhci_pdata1 = {
119 static struct tegra_sdhci_platform_data sdhci_pdata3 = {
120 .cd_gpio = TEGRA_GPIO_SD2_CD,
121 .wp_gpio = TEGRA_GPIO_SD2_WP,
122 .power_gpio = TEGRA_GPIO_SD2_POWER,
125 static struct tegra_sdhci_platform_data sdhci_pdata4 = {
132 static struct tegra_wm8903_platform_data seaboard_audio_pdata = {
133 .gpio_spkr_en = TEGRA_GPIO_SPKR_EN,
134 .gpio_hp_det = TEGRA_GPIO_HP_DET,
136 .gpio_int_mic_en = -1,
137 .gpio_ext_mic_en = -1,
140 static struct platform_device seaboard_audio_device = {
141 .name = "tegra-snd-wm8903",
144 .platform_data = &seaboard_audio_pdata,
148 static struct platform_device *seaboard_devices[] __initdata = {
151 &tegra_sdhci_device4,
152 &tegra_sdhci_device3,
153 &tegra_sdhci_device1,
154 &seaboard_gpio_keys_device,
158 &seaboard_audio_device,
161 static struct i2c_board_info __initdata isl29018_device = {
162 I2C_BOARD_INFO("isl29018", 0x44),
165 static struct i2c_board_info __initdata adt7461_device = {
166 I2C_BOARD_INFO("adt7461", 0x4c),
169 static struct wm8903_platform_data wm8903_pdata = {
173 .gpio_base = SEABOARD_GPIO_WM8903(0),
177 WM8903_GPIO_CONFIG_ZERO,
183 static struct i2c_board_info __initdata wm8903_device = {
184 I2C_BOARD_INFO("wm8903", 0x1a),
185 .platform_data = &wm8903_pdata,
188 static int seaboard_ehci_init(void)
190 struct tegra_ehci_platform_data *pdata;
192 pdata = tegra_ehci1_device.dev.platform_data;
193 pdata->vbus_gpio = TEGRA_GPIO_USB1;
195 platform_device_register(&tegra_ehci1_device);
196 platform_device_register(&tegra_ehci3_device);
201 static void __init seaboard_i2c_init(void)
203 isl29018_device.irq = gpio_to_irq(TEGRA_GPIO_ISL29018_IRQ);
204 i2c_register_board_info(0, &isl29018_device, 1);
206 wm8903_device.irq = gpio_to_irq(TEGRA_GPIO_CDC_IRQ);
207 i2c_register_board_info(0, &wm8903_device, 1);
209 i2c_register_board_info(3, &adt7461_device, 1);
211 platform_device_register(&tegra_i2c_device1);
212 platform_device_register(&tegra_i2c_device2);
213 platform_device_register(&tegra_i2c_device3);
214 platform_device_register(&tegra_i2c_device4);
217 static void __init seaboard_common_init(void)
219 seaboard_pinmux_init();
221 tegra_clk_init_from_table(seaboard_clk_init_table);
223 tegra_sdhci_device1.dev.platform_data = &sdhci_pdata1;
224 tegra_sdhci_device3.dev.platform_data = &sdhci_pdata3;
225 tegra_sdhci_device4.dev.platform_data = &sdhci_pdata4;
227 platform_add_devices(seaboard_devices, ARRAY_SIZE(seaboard_devices));
229 seaboard_ehci_init();
232 static void __init tegra_seaboard_init(void)
234 /* Seaboard uses UARTD for the debug port. */
235 debug_uart_platform_data[0].membase = IO_ADDRESS(TEGRA_UARTD_BASE);
236 debug_uart_platform_data[0].mapbase = TEGRA_UARTD_BASE;
237 debug_uart_platform_data[0].irq = INT_UARTD;
239 seaboard_common_init();
244 static void __init tegra_kaen_init(void)
246 /* Kaen uses UARTB for the debug port. */
247 debug_uart_platform_data[0].membase = IO_ADDRESS(TEGRA_UARTB_BASE);
248 debug_uart_platform_data[0].mapbase = TEGRA_UARTB_BASE;
249 debug_uart_platform_data[0].irq = INT_UARTB;
251 seaboard_audio_pdata.gpio_hp_mute = TEGRA_GPIO_KAEN_HP_MUTE;
253 seaboard_common_init();
258 static void __init tegra_wario_init(void)
260 /* Wario uses UARTB for the debug port. */
261 debug_uart_platform_data[0].membase = IO_ADDRESS(TEGRA_UARTB_BASE);
262 debug_uart_platform_data[0].mapbase = TEGRA_UARTB_BASE;
263 debug_uart_platform_data[0].irq = INT_UARTB;
265 seaboard_common_init();
271 MACHINE_START(SEABOARD, "seaboard")
272 .atag_offset = 0x100,
273 .map_io = tegra_map_common_io,
274 .init_early = tegra20_init_early,
275 .init_irq = tegra_init_irq,
276 .handle_irq = gic_handle_irq,
277 .timer = &tegra_timer,
278 .init_machine = tegra_seaboard_init,
279 .restart = tegra_assert_system_reset,
282 MACHINE_START(KAEN, "kaen")
283 .atag_offset = 0x100,
284 .map_io = tegra_map_common_io,
285 .init_early = tegra20_init_early,
286 .init_irq = tegra_init_irq,
287 .handle_irq = gic_handle_irq,
288 .timer = &tegra_timer,
289 .init_machine = tegra_kaen_init,
290 .restart = tegra_assert_system_reset,
293 MACHINE_START(WARIO, "wario")
294 .atag_offset = 0x100,
295 .map_io = tegra_map_common_io,
296 .init_early = tegra20_init_early,
297 .init_irq = tegra_init_irq,
298 .handle_irq = gic_handle_irq,
299 .timer = &tegra_timer,
300 .init_machine = tegra_wario_init,
301 .restart = tegra_assert_system_reset,