2 * arch/arm/mach-tegra/board-ventana.c
4 * Copyright (c) 2010, NVIDIA Corporation.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #include <linux/kernel.h>
22 #include <linux/init.h>
23 #include <linux/slab.h>
24 #include <linux/ctype.h>
25 #include <linux/platform_device.h>
26 #include <linux/clk.h>
27 #include <linux/serial_8250.h>
28 #include <linux/i2c.h>
29 #include <linux/pda_power.h>
30 #include <linux/dma-mapping.h>
31 #include <linux/delay.h>
32 #include <linux/i2c-tegra.h>
33 #include <linux/gpio.h>
34 #include <linux/gpio_keys.h>
35 #include <linux/input.h>
37 #include <mach/iomap.h>
38 #include <mach/irqs.h>
39 #include <mach/pinmux.h>
40 #include <mach/iomap.h>
43 #include <asm/mach-types.h>
44 #include <asm/mach/arch.h>
48 #include "board-ventana.h"
50 #include "gpio-names.h"
52 static struct plat_serial8250_port debug_uart_platform_data[] = {
54 .membase = IO_ADDRESS(TEGRA_UARTD_BASE),
55 .mapbase = TEGRA_UARTD_BASE,
57 .flags = UPF_BOOT_AUTOCONF,
66 static struct platform_device debug_uart = {
68 .id = PLAT8250_DEV_PLATFORM,
70 .platform_data = debug_uart_platform_data,
74 static __initdata struct tegra_clk_init_table ventana_clk_init_table[] = {
75 /* name parent rate enabled */
76 { "uartd", "pll_p", 216000000, true},
77 { "pll_m", "clk_m", 600000000, true},
78 { "emc", "pll_m", 600000000, true},
83 static struct pda_power_pdata pda_power_pdata = {
86 static struct platform_device pda_power_device = {
90 .platform_data = &pda_power_pdata,
94 static struct tegra_i2c_platform_data ventana_i2c1_platform_data = {
97 .bus_clk_rate = { 400000, 0 },
100 static const struct tegra_pingroup_config i2c2_ddc = {
101 .pingroup = TEGRA_PINGROUP_DDC,
102 .func = TEGRA_MUX_I2C2,
105 static const struct tegra_pingroup_config i2c2_gen2 = {
106 .pingroup = TEGRA_PINGROUP_PTA,
107 .func = TEGRA_MUX_I2C2,
110 static struct tegra_i2c_platform_data ventana_i2c2_platform_data = {
113 .bus_clk_rate = { 400000, 100000 },
114 .bus_mux = { &i2c2_ddc, &i2c2_gen2 },
115 .bus_mux_len = { 1, 1 },
118 static struct tegra_i2c_platform_data ventana_i2c3_platform_data = {
121 .bus_clk_rate = { 400000, 0 },
124 static struct tegra_i2c_platform_data ventana_dvc_platform_data = {
127 .bus_clk_rate = { 400000, 0 },
131 static void ventana_i2c_init(void)
133 tegra_i2c_device1.dev.platform_data = &ventana_i2c1_platform_data;
134 tegra_i2c_device2.dev.platform_data = &ventana_i2c2_platform_data;
135 tegra_i2c_device3.dev.platform_data = &ventana_i2c3_platform_data;
136 tegra_i2c_device4.dev.platform_data = &ventana_dvc_platform_data;
138 platform_device_register(&tegra_i2c_device4);
139 platform_device_register(&tegra_i2c_device3);
140 platform_device_register(&tegra_i2c_device2);
141 platform_device_register(&tegra_i2c_device1);
144 #define GPIO_KEY(_id, _gpio, _iswake) \
147 .gpio = TEGRA_GPIO_##_gpio, \
152 .debounce_interval = 10, \
155 static struct gpio_keys_button ventana_keys[] = {
156 [0] = GPIO_KEY(KEY_MENU, PQ0, 0),
157 [1] = GPIO_KEY(KEY_HOME, PQ1, 0),
158 [2] = GPIO_KEY(KEY_BACK, PQ2, 0),
159 [3] = GPIO_KEY(KEY_VOLUMEUP, PQ3, 0),
160 [4] = GPIO_KEY(KEY_VOLUMEDOWN, PQ4, 0),
161 [5] = GPIO_KEY(KEY_POWER, PV2, 1),
164 static struct gpio_keys_platform_data ventana_keys_platform_data = {
165 .buttons = ventana_keys,
166 .nbuttons = ARRAY_SIZE(ventana_keys),
169 static struct platform_device ventana_keys_device = {
173 .platform_data = &ventana_keys_platform_data,
177 static struct platform_device *ventana_devices[] __initdata = {
183 &ventana_keys_device,
186 static void ventana_touch_reset(void)
188 gpio_set_value(TEGRA_GPIO_PQ7, 1);
190 gpio_set_value(TEGRA_GPIO_PQ7, 0);
194 static void ventana_keys_init(void)
198 for (i = 0; i < ARRAY_SIZE(ventana_keys); i++)
199 tegra_gpio_enable(ventana_keys[i].gpio);
202 static const struct i2c_board_info ventana_i2c_bus1_touch_info[] = {
204 I2C_BOARD_INFO("panjit_touch", 0x3),
205 .irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_PV6),
209 static int __init ventana_touch_init(void)
211 tegra_gpio_enable(TEGRA_GPIO_PV6);
213 tegra_gpio_enable(TEGRA_GPIO_PQ7);
214 gpio_request(TEGRA_GPIO_PQ7, "touch_reset");
215 gpio_direction_output(TEGRA_GPIO_PQ7, 1);
217 ventana_touch_reset();
218 i2c_register_board_info(0, ventana_i2c_bus1_touch_info, 1);
223 static void __init tegra_ventana_init(void)
227 tegra_clk_init_from_table(ventana_clk_init_table);
228 ventana_pinmux_init();
230 platform_add_devices(ventana_devices, ARRAY_SIZE(ventana_devices));
231 ventana_sdhci_init();
233 ventana_regulator_init();
234 ventana_touch_init();
238 MACHINE_START(VENTANA, "ventana")
239 .boot_params = 0x00000100,
240 .phys_io = IO_APB_PHYS,
241 .io_pg_offst = ((IO_APB_VIRT) >> 18) & 0xfffc,
242 .init_irq = tegra_init_irq,
243 .init_machine = tegra_ventana_init,
244 .map_io = tegra_map_common_io,
245 .timer = &tegra_timer,