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/i2c/panjit_ts.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>
36 #include <linux/usb/android_composite.h>
39 #include <mach/iomap.h>
40 #include <mach/irqs.h>
41 #include <mach/pinmux.h>
42 #include <mach/iomap.h>
45 #include <asm/mach-types.h>
46 #include <asm/mach/arch.h>
50 #include "board-ventana.h"
52 #include "gpio-names.h"
55 static struct plat_serial8250_port debug_uart_platform_data[] = {
57 .membase = IO_ADDRESS(TEGRA_UARTD_BASE),
58 .mapbase = TEGRA_UARTD_BASE,
60 .flags = UPF_BOOT_AUTOCONF,
69 static struct platform_device debug_uart = {
71 .id = PLAT8250_DEV_PLATFORM,
73 .platform_data = debug_uart_platform_data,
77 static __initdata struct tegra_clk_init_table ventana_clk_init_table[] = {
78 /* name parent rate enabled */
79 { "uartd", "pll_p", 216000000, true},
80 { "pll_m", "clk_m", 600000000, true},
81 { "pwm", "clk_32k", 32768, false},
85 static char *usb_functions[] = { "mtp" };
86 static char *usb_functions_adb[] = { "mtp", "adb" };
88 static struct android_usb_product usb_products[] = {
91 .num_functions = ARRAY_SIZE(usb_functions),
92 .functions = usb_functions,
96 .num_functions = ARRAY_SIZE(usb_functions_adb),
97 .functions = usb_functions_adb,
101 /* standard android USB platform data */
102 static struct android_usb_platform_data andusb_plat = {
104 .product_id = 0x7100,
105 .manufacturer_name = "NVIDIA",
106 .product_name = "Ventana",
107 .serial_number = NULL,
108 .num_products = ARRAY_SIZE(usb_products),
109 .products = usb_products,
110 .num_functions = ARRAY_SIZE(usb_functions_adb),
111 .functions = usb_functions_adb,
114 static struct platform_device androidusb_device = {
115 .name = "android_usb",
118 .platform_data = &andusb_plat,
122 static struct tegra_i2c_platform_data ventana_i2c1_platform_data = {
125 .bus_clk_rate = { 400000, 0 },
128 static const struct tegra_pingroup_config i2c2_ddc = {
129 .pingroup = TEGRA_PINGROUP_DDC,
130 .func = TEGRA_MUX_I2C2,
133 static const struct tegra_pingroup_config i2c2_gen2 = {
134 .pingroup = TEGRA_PINGROUP_PTA,
135 .func = TEGRA_MUX_I2C2,
138 static struct tegra_i2c_platform_data ventana_i2c2_platform_data = {
141 .bus_clk_rate = { 400000, 100000 },
142 .bus_mux = { &i2c2_ddc, &i2c2_gen2 },
143 .bus_mux_len = { 1, 1 },
146 static struct tegra_i2c_platform_data ventana_i2c3_platform_data = {
149 .bus_clk_rate = { 400000, 0 },
152 static struct tegra_i2c_platform_data ventana_dvc_platform_data = {
155 .bus_clk_rate = { 400000, 0 },
159 static void ventana_i2c_init(void)
161 tegra_i2c_device1.dev.platform_data = &ventana_i2c1_platform_data;
162 tegra_i2c_device2.dev.platform_data = &ventana_i2c2_platform_data;
163 tegra_i2c_device3.dev.platform_data = &ventana_i2c3_platform_data;
164 tegra_i2c_device4.dev.platform_data = &ventana_dvc_platform_data;
166 platform_device_register(&tegra_i2c_device4);
167 platform_device_register(&tegra_i2c_device3);
168 platform_device_register(&tegra_i2c_device2);
169 platform_device_register(&tegra_i2c_device1);
172 #define GPIO_KEY(_id, _gpio, _iswake) \
175 .gpio = TEGRA_GPIO_##_gpio, \
180 .debounce_interval = 10, \
183 static struct gpio_keys_button ventana_keys[] = {
184 [0] = GPIO_KEY(KEY_MENU, PQ3, 0),
185 [1] = GPIO_KEY(KEY_HOME, PQ1, 0),
186 [2] = GPIO_KEY(KEY_BACK, PQ2, 0),
187 [3] = GPIO_KEY(KEY_VOLUMEUP, PQ5, 0),
188 [4] = GPIO_KEY(KEY_VOLUMEDOWN, PQ4, 0),
189 [5] = GPIO_KEY(KEY_POWER, PV2, 1),
192 static struct gpio_keys_platform_data ventana_keys_platform_data = {
193 .buttons = ventana_keys,
194 .nbuttons = ARRAY_SIZE(ventana_keys),
197 static struct platform_device ventana_keys_device = {
201 .platform_data = &ventana_keys_platform_data,
205 static struct platform_device *ventana_devices[] __initdata = {
212 &ventana_keys_device,
215 static void ventana_keys_init(void)
219 for (i = 0; i < ARRAY_SIZE(ventana_keys); i++)
220 tegra_gpio_enable(ventana_keys[i].gpio);
223 static struct panjit_i2c_ts_platform_data panjit_data = {
224 .gpio_reset = TEGRA_GPIO_PQ7,
227 static const struct i2c_board_info ventana_i2c_bus1_touch_info[] = {
229 I2C_BOARD_INFO("panjit_touch", 0x3),
230 .irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_PV6),
231 .platform_data = &panjit_data,
235 static int __init ventana_touch_init(void)
237 tegra_gpio_enable(TEGRA_GPIO_PV6);
239 tegra_gpio_enable(TEGRA_GPIO_PQ7);
240 i2c_register_board_info(0, ventana_i2c_bus1_touch_info, 1);
245 static void __init tegra_ventana_init(void)
250 tegra_clk_init_from_table(ventana_clk_init_table);
251 ventana_pinmux_init();
253 snprintf(serial, sizeof(serial), "%llx", tegra_chip_uid());
254 andusb_plat.serial_number = kstrdup(serial, GFP_KERNEL);
255 platform_add_devices(ventana_devices, ARRAY_SIZE(ventana_devices));
257 ventana_sdhci_init();
259 ventana_regulator_init();
260 ventana_touch_init();
262 ventana_panel_init();
265 MACHINE_START(VENTANA, "ventana")
266 .boot_params = 0x00000100,
267 .phys_io = IO_APB_PHYS,
268 .io_pg_offst = ((IO_APB_VIRT) >> 18) & 0xfffc,
269 .init_irq = tegra_init_irq,
270 .init_machine = tegra_ventana_init,
271 .map_io = tegra_map_common_io,
272 .timer = &tegra_timer,