mm: move shmem prototypes to shmem_fs.h
[linux/fpc-iii.git] / arch / arm / mach-tegra / board-seaboard.c
bloba8d7ace9f958ef2fd4c6db3e5802e2a8d8a861e5
1 /*
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
13 * more details.
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/i2c-tegra.h>
23 #include <linux/delay.h>
24 #include <linux/input.h>
25 #include <linux/io.h>
26 #include <linux/gpio.h>
27 #include <linux/gpio_keys.h>
29 #include <mach/iomap.h>
30 #include <mach/irqs.h>
31 #include <mach/sdhci.h>
33 #include <asm/mach-types.h>
34 #include <asm/mach/arch.h>
36 #include "board.h"
37 #include "board-seaboard.h"
38 #include "clock.h"
39 #include "devices.h"
40 #include "gpio-names.h"
42 static struct plat_serial8250_port debug_uart_platform_data[] = {
44 /* Memory and IRQ filled in before registration */
45 .flags = UPF_BOOT_AUTOCONF,
46 .iotype = UPIO_MEM,
47 .regshift = 2,
48 .uartclk = 216000000,
49 }, {
50 .flags = 0,
54 static struct platform_device debug_uart = {
55 .name = "serial8250",
56 .id = PLAT8250_DEV_PLATFORM,
57 .dev = {
58 .platform_data = debug_uart_platform_data,
62 static __initdata struct tegra_clk_init_table seaboard_clk_init_table[] = {
63 /* name parent rate enabled */
64 { "uartb", "pll_p", 216000000, true},
65 { "uartd", "pll_p", 216000000, true},
66 { NULL, NULL, 0, 0},
69 static struct tegra_i2c_platform_data seaboard_i2c1_platform_data = {
70 .bus_clk_rate = 400000.
73 static struct tegra_i2c_platform_data seaboard_i2c2_platform_data = {
74 .bus_clk_rate = 400000,
77 static struct tegra_i2c_platform_data seaboard_i2c3_platform_data = {
78 .bus_clk_rate = 400000,
81 static struct tegra_i2c_platform_data seaboard_dvc_platform_data = {
82 .bus_clk_rate = 400000,
85 static struct gpio_keys_button seaboard_gpio_keys_buttons[] = {
87 .code = SW_LID,
88 .gpio = TEGRA_GPIO_LIDSWITCH,
89 .active_low = 0,
90 .desc = "Lid",
91 .type = EV_SW,
92 .wakeup = 1,
93 .debounce_interval = 1,
96 .code = KEY_POWER,
97 .gpio = TEGRA_GPIO_POWERKEY,
98 .active_low = 1,
99 .desc = "Power",
100 .type = EV_KEY,
101 .wakeup = 1,
105 static struct gpio_keys_platform_data seaboard_gpio_keys = {
106 .buttons = seaboard_gpio_keys_buttons,
107 .nbuttons = ARRAY_SIZE(seaboard_gpio_keys_buttons),
110 static struct platform_device seaboard_gpio_keys_device = {
111 .name = "gpio-keys",
112 .id = -1,
113 .dev = {
114 .platform_data = &seaboard_gpio_keys,
118 static struct tegra_sdhci_platform_data sdhci_pdata1 = {
119 .cd_gpio = -1,
120 .wp_gpio = -1,
121 .power_gpio = -1,
124 static struct tegra_sdhci_platform_data sdhci_pdata3 = {
125 .cd_gpio = TEGRA_GPIO_SD2_CD,
126 .wp_gpio = TEGRA_GPIO_SD2_WP,
127 .power_gpio = TEGRA_GPIO_SD2_POWER,
130 static struct tegra_sdhci_platform_data sdhci_pdata4 = {
131 .cd_gpio = -1,
132 .wp_gpio = -1,
133 .power_gpio = -1,
134 .is_8bit = 1,
137 static struct platform_device *seaboard_devices[] __initdata = {
138 &debug_uart,
139 &tegra_pmu_device,
140 &tegra_sdhci_device1,
141 &tegra_sdhci_device3,
142 &tegra_sdhci_device4,
143 &seaboard_gpio_keys_device,
146 static struct i2c_board_info __initdata isl29018_device = {
147 I2C_BOARD_INFO("isl29018", 0x44),
148 .irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_ISL29018_IRQ),
151 static struct i2c_board_info __initdata adt7461_device = {
152 I2C_BOARD_INFO("adt7461", 0x4c),
155 static void __init seaboard_i2c_init(void)
157 gpio_request(TEGRA_GPIO_ISL29018_IRQ, "isl29018");
158 gpio_direction_input(TEGRA_GPIO_ISL29018_IRQ);
160 i2c_register_board_info(0, &isl29018_device, 1);
162 i2c_register_board_info(4, &adt7461_device, 1);
164 tegra_i2c_device1.dev.platform_data = &seaboard_i2c1_platform_data;
165 tegra_i2c_device2.dev.platform_data = &seaboard_i2c2_platform_data;
166 tegra_i2c_device3.dev.platform_data = &seaboard_i2c3_platform_data;
167 tegra_i2c_device4.dev.platform_data = &seaboard_dvc_platform_data;
169 platform_device_register(&tegra_i2c_device1);
170 platform_device_register(&tegra_i2c_device2);
171 platform_device_register(&tegra_i2c_device3);
172 platform_device_register(&tegra_i2c_device4);
175 static void __init seaboard_common_init(void)
177 seaboard_pinmux_init();
179 tegra_clk_init_from_table(seaboard_clk_init_table);
181 tegra_sdhci_device1.dev.platform_data = &sdhci_pdata1;
182 tegra_sdhci_device3.dev.platform_data = &sdhci_pdata3;
183 tegra_sdhci_device4.dev.platform_data = &sdhci_pdata4;
185 platform_add_devices(seaboard_devices, ARRAY_SIZE(seaboard_devices));
188 static void __init tegra_seaboard_init(void)
190 /* Seaboard uses UARTD for the debug port. */
191 debug_uart_platform_data[0].membase = IO_ADDRESS(TEGRA_UARTD_BASE);
192 debug_uart_platform_data[0].mapbase = TEGRA_UARTD_BASE;
193 debug_uart_platform_data[0].irq = INT_UARTD;
195 seaboard_common_init();
197 seaboard_i2c_init();
200 static void __init tegra_kaen_init(void)
202 /* Kaen uses UARTB for the debug port. */
203 debug_uart_platform_data[0].membase = IO_ADDRESS(TEGRA_UARTB_BASE);
204 debug_uart_platform_data[0].mapbase = TEGRA_UARTB_BASE;
205 debug_uart_platform_data[0].irq = INT_UARTB;
207 seaboard_common_init();
209 seaboard_i2c_init();
212 static void __init tegra_wario_init(void)
214 /* Wario uses UARTB for the debug port. */
215 debug_uart_platform_data[0].membase = IO_ADDRESS(TEGRA_UARTB_BASE);
216 debug_uart_platform_data[0].mapbase = TEGRA_UARTB_BASE;
217 debug_uart_platform_data[0].irq = INT_UARTB;
219 seaboard_common_init();
221 seaboard_i2c_init();
225 MACHINE_START(SEABOARD, "seaboard")
226 .boot_params = 0x00000100,
227 .map_io = tegra_map_common_io,
228 .init_early = tegra_init_early,
229 .init_irq = tegra_init_irq,
230 .timer = &tegra_timer,
231 .init_machine = tegra_seaboard_init,
232 MACHINE_END
234 MACHINE_START(KAEN, "kaen")
235 .boot_params = 0x00000100,
236 .map_io = tegra_map_common_io,
237 .init_early = tegra_init_early,
238 .init_irq = tegra_init_irq,
239 .timer = &tegra_timer,
240 .init_machine = tegra_kaen_init,
241 MACHINE_END
243 MACHINE_START(WARIO, "wario")
244 .boot_params = 0x00000100,
245 .map_io = tegra_map_common_io,
246 .init_early = tegra_init_early,
247 .init_irq = tegra_init_irq,
248 .timer = &tegra_timer,
249 .init_machine = tegra_wario_init,
250 MACHINE_END