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/of_serial.h>
22 #include <linux/i2c.h>
23 #include <linux/delay.h>
24 #include <linux/input.h>
26 #include <linux/gpio.h>
27 #include <linux/gpio_keys.h>
28 #include <linux/platform_data/tegra_usb.h>
30 #include <sound/wm8903.h>
32 #include <mach/iomap.h>
33 #include <mach/irqs.h>
34 #include <mach/sdhci.h>
35 #include <mach/tegra_wm8903_pdata.h>
37 #include <asm/mach-types.h>
38 #include <asm/mach/arch.h>
39 #include <asm/hardware/gic.h>
42 #include "board-seaboard.h"
45 #include "gpio-names.h"
47 static struct plat_serial8250_port debug_uart_platform_data[] = {
49 /* Memory and IRQ filled in before registration */
50 .flags = UPF_BOOT_AUTOCONF | UPF_FIXED_TYPE,
52 .handle_break = tegra_serial_handle_break,
61 static struct platform_device debug_uart = {
63 .id = PLAT8250_DEV_PLATFORM,
65 .platform_data = debug_uart_platform_data,
69 static __initdata struct tegra_clk_init_table seaboard_clk_init_table[] = {
70 /* name parent rate enabled */
71 { "uartb", "pll_p", 216000000, true},
72 { "uartd", "pll_p", 216000000, true},
73 { "pll_a", "pll_p_out1", 56448000, true },
74 { "pll_a_out0", "pll_a", 11289600, true },
75 { "cdev1", NULL, 0, true },
76 { "i2s1", "pll_a_out0", 11289600, false},
77 { "usbd", "clk_m", 12000000, true},
78 { "usb3", "clk_m", 12000000, true},
82 static struct gpio_keys_button seaboard_gpio_keys_buttons[] = {
85 .gpio = TEGRA_GPIO_LIDSWITCH,
90 .debounce_interval = 1,
94 .gpio = TEGRA_GPIO_POWERKEY,
102 static struct gpio_keys_platform_data seaboard_gpio_keys = {
103 .buttons = seaboard_gpio_keys_buttons,
104 .nbuttons = ARRAY_SIZE(seaboard_gpio_keys_buttons),
107 static struct platform_device seaboard_gpio_keys_device = {
111 .platform_data = &seaboard_gpio_keys,
115 static struct tegra_sdhci_platform_data sdhci_pdata1 = {
121 static struct tegra_sdhci_platform_data sdhci_pdata3 = {
122 .cd_gpio = TEGRA_GPIO_SD2_CD,
123 .wp_gpio = TEGRA_GPIO_SD2_WP,
124 .power_gpio = TEGRA_GPIO_SD2_POWER,
127 static struct tegra_sdhci_platform_data sdhci_pdata4 = {
134 static struct tegra_wm8903_platform_data seaboard_audio_pdata = {
135 .gpio_spkr_en = TEGRA_GPIO_SPKR_EN,
136 .gpio_hp_det = TEGRA_GPIO_HP_DET,
138 .gpio_int_mic_en = -1,
139 .gpio_ext_mic_en = -1,
142 static struct platform_device seaboard_audio_device = {
143 .name = "tegra-snd-wm8903",
146 .platform_data = &seaboard_audio_pdata,
150 static struct platform_device *seaboard_devices[] __initdata = {
153 &tegra_sdhci_device4,
154 &tegra_sdhci_device3,
155 &tegra_sdhci_device1,
156 &seaboard_gpio_keys_device,
160 &seaboard_audio_device,
163 static struct i2c_board_info __initdata isl29018_device = {
164 I2C_BOARD_INFO("isl29018", 0x44),
167 static struct i2c_board_info __initdata adt7461_device = {
168 I2C_BOARD_INFO("adt7461", 0x4c),
171 static struct wm8903_platform_data wm8903_pdata = {
175 .gpio_base = SEABOARD_GPIO_WM8903(0),
179 WM8903_GPIO_CONFIG_ZERO,
185 static struct i2c_board_info __initdata wm8903_device = {
186 I2C_BOARD_INFO("wm8903", 0x1a),
187 .platform_data = &wm8903_pdata,
190 static int seaboard_ehci_init(void)
192 struct tegra_ehci_platform_data *pdata;
194 pdata = tegra_ehci1_device.dev.platform_data;
195 pdata->vbus_gpio = TEGRA_GPIO_USB1;
197 platform_device_register(&tegra_ehci1_device);
198 platform_device_register(&tegra_ehci3_device);
203 static void __init seaboard_i2c_init(void)
205 isl29018_device.irq = gpio_to_irq(TEGRA_GPIO_ISL29018_IRQ);
206 i2c_register_board_info(0, &isl29018_device, 1);
208 wm8903_device.irq = gpio_to_irq(TEGRA_GPIO_CDC_IRQ);
209 i2c_register_board_info(0, &wm8903_device, 1);
211 i2c_register_board_info(3, &adt7461_device, 1);
213 platform_device_register(&tegra_i2c_device1);
214 platform_device_register(&tegra_i2c_device2);
215 platform_device_register(&tegra_i2c_device3);
216 platform_device_register(&tegra_i2c_device4);
219 static void __init seaboard_common_init(void)
221 seaboard_pinmux_init();
223 tegra_clk_init_from_table(seaboard_clk_init_table);
225 tegra_sdhci_device1.dev.platform_data = &sdhci_pdata1;
226 tegra_sdhci_device3.dev.platform_data = &sdhci_pdata3;
227 tegra_sdhci_device4.dev.platform_data = &sdhci_pdata4;
229 platform_add_devices(seaboard_devices, ARRAY_SIZE(seaboard_devices));
231 seaboard_ehci_init();
234 static void __init tegra_seaboard_init(void)
236 /* Seaboard uses UARTD for the debug port. */
237 debug_uart_platform_data[0].membase = IO_ADDRESS(TEGRA_UARTD_BASE);
238 debug_uart_platform_data[0].mapbase = TEGRA_UARTD_BASE;
239 debug_uart_platform_data[0].irq = INT_UARTD;
241 seaboard_common_init();
246 static void __init tegra_kaen_init(void)
248 /* Kaen uses UARTB for the debug port. */
249 debug_uart_platform_data[0].membase = IO_ADDRESS(TEGRA_UARTB_BASE);
250 debug_uart_platform_data[0].mapbase = TEGRA_UARTB_BASE;
251 debug_uart_platform_data[0].irq = INT_UARTB;
253 seaboard_audio_pdata.gpio_hp_mute = TEGRA_GPIO_KAEN_HP_MUTE;
255 seaboard_common_init();
260 static void __init tegra_wario_init(void)
262 /* Wario uses UARTB for the debug port. */
263 debug_uart_platform_data[0].membase = IO_ADDRESS(TEGRA_UARTB_BASE);
264 debug_uart_platform_data[0].mapbase = TEGRA_UARTB_BASE;
265 debug_uart_platform_data[0].irq = INT_UARTB;
267 seaboard_common_init();
273 MACHINE_START(SEABOARD, "seaboard")
274 .atag_offset = 0x100,
275 .map_io = tegra_map_common_io,
276 .init_early = tegra20_init_early,
277 .init_irq = tegra_init_irq,
278 .handle_irq = gic_handle_irq,
279 .timer = &tegra_timer,
280 .init_machine = tegra_seaboard_init,
281 .restart = tegra_assert_system_reset,
284 MACHINE_START(KAEN, "kaen")
285 .atag_offset = 0x100,
286 .map_io = tegra_map_common_io,
287 .init_early = tegra20_init_early,
288 .init_irq = tegra_init_irq,
289 .handle_irq = gic_handle_irq,
290 .timer = &tegra_timer,
291 .init_machine = tegra_kaen_init,
292 .restart = tegra_assert_system_reset,
295 MACHINE_START(WARIO, "wario")
296 .atag_offset = 0x100,
297 .map_io = tegra_map_common_io,
298 .init_early = tegra20_init_early,
299 .init_irq = tegra_init_irq,
300 .handle_irq = gic_handle_irq,
301 .timer = &tegra_timer,
302 .init_machine = tegra_wario_init,
303 .restart = tegra_assert_system_reset,