/* * arch/arm/mach-tegra/board-ventana.c * * Copyright (c) 2010, NVIDIA Corporation. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "board.h" #include "clock.h" #include "board-ventana.h" #include "devices.h" #include "gpio-names.h" static struct plat_serial8250_port debug_uart_platform_data[] = { { .membase = IO_ADDRESS(TEGRA_UARTD_BASE), .mapbase = TEGRA_UARTD_BASE, .irq = INT_UARTD, .flags = UPF_BOOT_AUTOCONF, .iotype = UPIO_MEM, .regshift = 2, .uartclk = 216000000, }, { .flags = 0, } }; static struct platform_device debug_uart = { .name = "serial8250", .id = PLAT8250_DEV_PLATFORM, .dev = { .platform_data = debug_uart_platform_data, }, }; static __initdata struct tegra_clk_init_table ventana_clk_init_table[] = { /* name parent rate enabled */ { "uartd", "pll_p", 216000000, true}, { "pll_m", "clk_m", 600000000, true}, { "pwm", "clk_32k", 32768, false}, { NULL, NULL, 0, 0}, }; static struct tegra_i2c_platform_data ventana_i2c1_platform_data = { .adapter_nr = 0, .bus_count = 1, .bus_clk_rate = { 400000, 0 }, }; static const struct tegra_pingroup_config i2c2_ddc = { .pingroup = TEGRA_PINGROUP_DDC, .func = TEGRA_MUX_I2C2, }; static const struct tegra_pingroup_config i2c2_gen2 = { .pingroup = TEGRA_PINGROUP_PTA, .func = TEGRA_MUX_I2C2, }; static struct tegra_i2c_platform_data ventana_i2c2_platform_data = { .adapter_nr = 1, .bus_count = 2, .bus_clk_rate = { 400000, 100000 }, .bus_mux = { &i2c2_ddc, &i2c2_gen2 }, .bus_mux_len = { 1, 1 }, }; static struct tegra_i2c_platform_data ventana_i2c3_platform_data = { .adapter_nr = 3, .bus_count = 1, .bus_clk_rate = { 400000, 0 }, }; static struct tegra_i2c_platform_data ventana_dvc_platform_data = { .adapter_nr = 4, .bus_count = 1, .bus_clk_rate = { 400000, 0 }, .is_dvc = true, }; static void ventana_i2c_init(void) { tegra_i2c_device1.dev.platform_data = &ventana_i2c1_platform_data; tegra_i2c_device2.dev.platform_data = &ventana_i2c2_platform_data; tegra_i2c_device3.dev.platform_data = &ventana_i2c3_platform_data; tegra_i2c_device4.dev.platform_data = &ventana_dvc_platform_data; platform_device_register(&tegra_i2c_device4); platform_device_register(&tegra_i2c_device3); platform_device_register(&tegra_i2c_device2); platform_device_register(&tegra_i2c_device1); } #define GPIO_KEY(_id, _gpio, _iswake) \ { \ .code = _id, \ .gpio = TEGRA_GPIO_##_gpio, \ .active_low = 1, \ .desc = #_id, \ .type = EV_KEY, \ .wakeup = _iswake, \ .debounce_interval = 10, \ } static struct gpio_keys_button ventana_keys[] = { [0] = GPIO_KEY(KEY_MENU, PQ3, 0), [1] = GPIO_KEY(KEY_HOME, PQ1, 0), [2] = GPIO_KEY(KEY_BACK, PQ2, 0), [3] = GPIO_KEY(KEY_VOLUMEUP, PQ5, 0), [4] = GPIO_KEY(KEY_VOLUMEDOWN, PQ4, 0), [5] = GPIO_KEY(KEY_POWER, PV2, 1), }; static struct gpio_keys_platform_data ventana_keys_platform_data = { .buttons = ventana_keys, .nbuttons = ARRAY_SIZE(ventana_keys), }; static struct platform_device ventana_keys_device = { .name = "gpio-keys", .id = 0, .dev = { .platform_data = &ventana_keys_platform_data, }, }; static struct platform_device *ventana_devices[] __initdata = { &tegra_otg_device, &debug_uart, &tegra_pmu_device, &tegra_udc_device, &tegra_gart_device, &tegra_aes_device, &ventana_keys_device, }; static void ventana_keys_init(void) { int i; for (i = 0; i < ARRAY_SIZE(ventana_keys); i++) tegra_gpio_enable(ventana_keys[i].gpio); } static struct panjit_i2c_ts_platform_data panjit_data = { .gpio_reset = TEGRA_GPIO_PQ7, }; static const struct i2c_board_info ventana_i2c_bus1_touch_info[] = { { I2C_BOARD_INFO("panjit_touch", 0x3), .irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_PV6), .platform_data = &panjit_data, }, }; static int __init ventana_touch_init(void) { tegra_gpio_enable(TEGRA_GPIO_PV6); tegra_gpio_enable(TEGRA_GPIO_PQ7); i2c_register_board_info(0, ventana_i2c_bus1_touch_info, 1); return 0; } static void __init tegra_ventana_init(void) { tegra_clk_init_from_table(ventana_clk_init_table); ventana_pinmux_init(); platform_add_devices(ventana_devices, ARRAY_SIZE(ventana_devices)); ventana_sdhci_init(); ventana_i2c_init(); ventana_regulator_init(); ventana_touch_init(); ventana_keys_init(); ventana_panel_init(); } MACHINE_START(VENTANA, "ventana") .map_io = tegra_map_common_io, .init_early = tegra20_init_early, .init_irq = tegra_init_irq, .handle_irq = gic_handle_irq, .timer = &tegra_timer, .init_machine = tegra_ventana_init, .restart = tegra_assert_system_reset, MACHINE_END