diff options
author | Scott Williams <scwilliams@nvidia.com> | 2010-12-07 11:20:05 -0800 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2011-11-30 21:45:24 -0800 |
commit | e8c4914e040999d075b562ea671d99ab64cf45a4 (patch) | |
tree | 153a5500a8a1639f7ae6b95bc04d43a20145209c /arch/arm/mach-tegra/board-aruba.c | |
parent | 5a5ed447904971aa146e15966b2d9c982fa157b0 (diff) |
[ARM/tegra] Add Aruba board definition files
Bug 764354
Original-Change-Id: I23d0ddc5107c02195ef58cab0e0c49ea65c72a87
Reviewed-on: http://git-master/r/12229
Reviewed-by: Scott Williams <scwilliams@nvidia.com>
Tested-by: Scott Williams <scwilliams@nvidia.com>
Original-Change-Id: Ibaa7f1e4cd5a3e3475d56601b420e40985194197
Rebase-Id: Rbdcbee634d19419502574f356a35370797db473a
Diffstat (limited to 'arch/arm/mach-tegra/board-aruba.c')
-rw-r--r-- | arch/arm/mach-tegra/board-aruba.c | 434 |
1 files changed, 434 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/board-aruba.c b/arch/arm/mach-tegra/board-aruba.c new file mode 100644 index 000000000000..ea1f90fecd1d --- /dev/null +++ b/arch/arm/mach-tegra/board-aruba.c @@ -0,0 +1,434 @@ +/* + * arch/arm/mach-tegra/board-aruba.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 <linux/kernel.h> +#include <linux/init.h> +#include <linux/slab.h> +#include <linux/ctype.h> +#include <linux/platform_device.h> +#include <linux/clk.h> +#include <linux/serial_8250.h> +#include <linux/i2c.h> +#include <linux/i2c/panjit_ts.h> +#include <linux/dma-mapping.h> +#include <linux/delay.h> +#include <linux/i2c-tegra.h> +#include <linux/gpio.h> +#include <linux/gpio_keys.h> +#include <linux/input.h> +#include <linux/tegra_usb.h> +#include <mach/clk.h> +#include <mach/iomap.h> +#include <mach/irqs.h> +#include <mach/pinmux.h> +#include <mach/iomap.h> +#include <mach/io.h> +#include <mach/i2s.h> +#include <mach/audio.h> +#include <asm/mach-types.h> +#include <asm/mach/arch.h> +#include <mach/usb_phy.h> + +#include "board.h" +#include "clock.h" +#include "board-aruba.h" +#include "devices.h" +#include "gpio-names.h" +#include "fuse.h" + +static struct plat_serial8250_port debug_uart_platform_data[] = { + { + .membase = IO_ADDRESS(TEGRA_UARTA_BASE), + .mapbase = TEGRA_UARTA_BASE, + .irq = INT_UARTA, + .flags = UPF_BOOT_AUTOCONF | UPF_FIXED_TYPE, + .type = PORT_TEGRA, + .iotype = UPIO_MEM, + .regshift = 2, + .uartclk = 13000000, + }, { + .flags = 0, + } +}; + +static struct platform_device debug_uart = { + .name = "serial8250", + .id = PLAT8250_DEV_PLATFORM, + .dev = { + .platform_data = debug_uart_platform_data, + }, +}; + +/* !!!FIXME!!! THESE ARE VENTANA SETTINGS */ +static struct tegra_utmip_config utmi_phy_config[] = { + [0] = { + .hssync_start_delay = 0, + .idle_wait_delay = 17, + .elastic_limit = 16, + .term_range_adj = 6, + .xcvr_setup = 15, + .xcvr_lsfslew = 2, + .xcvr_lsrslew = 2, + }, + [1] = { + .hssync_start_delay = 0, + .idle_wait_delay = 17, + .elastic_limit = 16, + .term_range_adj = 6, + .xcvr_setup = 8, + .xcvr_lsfslew = 2, + .xcvr_lsrslew = 2, + }, +}; + +/* !!!FIXME!!! THESE ARE VENTANA SETTINGS */ +static struct tegra_ulpi_config ulpi_phy_config = { + .reset_gpio = TEGRA_GPIO_PG2, // !!!FIXME!!! CABLE DETECT? if so GPIO_PC7 on aruba + .clk = "clk_dev2", +}; + +#ifdef CONFIG_BCM4329_RFKILL + +static struct resource aruba_bcm4329_rfkill_resources[] = { + { + .name = "bcm4329_nreset_gpio", + .start = TEGRA_GPIO_PU0, + .end = TEGRA_GPIO_PU0, + .flags = IORESOURCE_IO, + }, + { + .name = "bcm4329_nshutdown_gpio", + .start = TEGRA_GPIO_PK2, + .end = TEGRA_GPIO_PK2, + .flags = IORESOURCE_IO, + }, +}; + +static struct platform_device aruba_bcm4329_rfkill_device = { + .name = "bcm4329_rfkill", + .id = -1, + .num_resources = ARRAY_SIZE(aruba_bcm4329_rfkill_resources), + .resource = aruba_bcm4329_rfkill_resources, +}; + +static noinline void __init aruba_bt_rfkill(void) +{ + /*Add Clock Resource*/ + clk_add_alias("bcm4329_32k_clk", aruba_bcm4329_rfkill_device.name, \ + "blink", NULL); + + platform_device_register(&aruba_bcm4329_rfkill_device); + + return; +} +#else +static inline void aruba_bt_rfkill(void) { } +#endif + +static __initdata struct tegra_clk_init_table aruba_clk_init_table[] = { + /* name parent rate enabled */ + { "uarta", "pll_p", 216000000, true}, + { "uartb", "pll_p", 216000000, true}, + { "uartc", "pll_p", 216000000, true}, + { "uartd", "pll_p", 216000000, true}, + { "uarte", "pll_p", 216000000, true}, + { "pll_m", NULL, 600000000, true}, + { "uartc", "pll_m", 600000000, false}, + { "blink", "clk_32k", 32768, false}, + { "pll_p_out4", "pll_p", 24000000, true }, + { "pwm", "clk_32k", 32768, false}, + { "blink", "clk_32k", 32768, false}, + { "pll_a", NULL, 11289600, true}, + { "pll_a_out0", NULL, 11289600, true}, + { "i2s1", "pll_a_out0", 11289600, true}, + { "i2s2", "pll_a_out0", 11289600, true}, + { "audio", "pll_a_out0", 11289600, true}, + { "audio_2x", "audio", 22579200, true}, + { NULL, NULL, 0, 0}, +}; + +#if 0 // !!!CHECKME !!! +static struct i2c_board_info __initdata aruba_i2c_bus1_board_info[] = { + { + I2C_BOARD_INFO("wm8903", 0x1a), + }, +}; +#endif + +static struct tegra_ulpi_config aruba_ehci2_ulpi_phy_config = { + .reset_gpio = TEGRA_GPIO_PV1, + .clk = "clk_dev2", +}; + +static struct tegra_ehci_platform_data aruba_ehci2_ulpi_platform_data = { + .operating_mode = TEGRA_USB_HOST, + .power_down_on_bus_suspend = 0, + .phy_config = &aruba_ehci2_ulpi_phy_config, +}; + +static struct tegra_i2c_platform_data aruba_i2c1_platform_data = { + .adapter_nr = 0, + .bus_count = 1, + .bus_clk_rate = { 400000, 0 }, +}; + +#if 0 /* !!!FIXME!!! THESE ARE VENTANA SETTINGS */ +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, +}; +#endif + +static struct tegra_i2c_platform_data aruba_i2c2_platform_data = { + .adapter_nr = 1, + .bus_count = 2, + .bus_clk_rate = { 400000, 100000 }, +#if 0 /* !!!FIXME!!!! TESE ARE VENTANA SETTINGS */ + .bus_mux = { &i2c2_ddc, &i2c2_gen2 }, + .bus_mux_len = { 1, 1 }, +#endif +}; + +static struct tegra_i2c_platform_data aruba_i2c3_platform_data = { + .adapter_nr = 3, + .bus_count = 1, + .bus_clk_rate = { 400000, 0 }, +}; + +static struct tegra_i2c_platform_data aruba_i2c4_platform_data = { + .adapter_nr = 4, + .bus_count = 1, + .bus_clk_rate = { 400000, 0 }, + .is_dvc = true, +}; + +static struct tegra_i2c_platform_data aruba_i2c5_platform_data = { + .adapter_nr = 5, + .bus_count = 1, + .bus_clk_rate = { 400000, 0 }, +}; + + +static void aruba_i2c_init(void) +{ + tegra_i2c_device1.dev.platform_data = &aruba_i2c1_platform_data; + tegra_i2c_device2.dev.platform_data = &aruba_i2c2_platform_data; + tegra_i2c_device3.dev.platform_data = &aruba_i2c3_platform_data; + tegra_i2c_device4.dev.platform_data = &aruba_i2c4_platform_data; + tegra_i2c_device5.dev.platform_data = &aruba_i2c5_platform_data; + + platform_device_register(&tegra_i2c_device5); + 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, \ + } + +// !!!FIXME!!! THESE ARE VENTANA DEFINITIONS +static struct gpio_keys_button aruba_keys[] = { + [0] = GPIO_KEY(KEY_MENU, PQ0, 0), + [1] = GPIO_KEY(KEY_HOME, PQ1, 0), + [2] = GPIO_KEY(KEY_BACK, PQ2, 0), + [3] = GPIO_KEY(KEY_VOLUMEUP, PQ3, 0), + [4] = GPIO_KEY(KEY_VOLUMEDOWN, PQ4, 0), + [5] = GPIO_KEY(KEY_POWER, PV2, 1), +}; + +static struct gpio_keys_platform_data aruba_keys_platform_data = { + .buttons = aruba_keys, + .nbuttons = ARRAY_SIZE(aruba_keys), +}; + +static struct platform_device aruba_keys_device = { + .name = "gpio-keys", + .id = 0, + .dev = { + .platform_data = &aruba_keys_platform_data, + }, +}; + +static struct resource tegra_rtc_resources[] = { + [0] = { + .start = TEGRA_RTC_BASE, + .end = TEGRA_RTC_BASE + TEGRA_RTC_SIZE - 1, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = INT_RTC, + .end = INT_RTC, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct platform_device tegra_rtc_device = { + .name = "tegra_rtc", + .id = -1, + .resource = tegra_rtc_resources, + .num_resources = ARRAY_SIZE(tegra_rtc_resources), +}; + +static struct platform_device *aruba_devices[] __initdata = { + &tegra_otg_device, + &debug_uart, + &tegra_uart1_device, + &tegra_uart2_device, + &tegra_uart3_device, + &tegra_uart4_device, + &pmu_device, + &tegra_rtc_device, + &tegra_udc_device, + &tegra_ehci2_device, +#if defined(CONFIG_TEGRA_IOVMM_SMMU) + &tegra_smmu_device, +#endif + &aruba_keys_device, + &tegra_wdt_device, + &tegra_avp_device, +}; + +static void aruba_keys_init(void) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(aruba_keys); i++) + tegra_gpio_enable(aruba_keys[i].gpio); +} + +static int __init aruba_touch_init(void) +{ + return 0; +} + + +static struct tegra_ehci_platform_data tegra_ehci_pdata[] = { + [0] = { + .phy_config = &utmi_phy_config[0], + .operating_mode = TEGRA_USB_HOST, + .power_down_on_bus_suspend = 0, + }, + [1] = { + .phy_config = &ulpi_phy_config, + .operating_mode = TEGRA_USB_HOST, + .power_down_on_bus_suspend = 1, + }, + [2] = { + .phy_config = &utmi_phy_config[1], + .operating_mode = TEGRA_USB_HOST, + .power_down_on_bus_suspend = 0, + }, +}; + +static void aruba_usb_init(void) +{ + tegra_ehci3_device.dev.platform_data=&tegra_ehci_pdata[2]; + platform_device_register(&tegra_ehci3_device); +} + +struct platform_device *tegra_usb_otg_host_register(void) +{ + struct platform_device *pdev; + void *platform_data; + int val; + + pdev = platform_device_alloc(tegra_ehci1_device.name, tegra_ehci1_device.id); + if (!pdev) + return NULL; + + val = platform_device_add_resources(pdev, tegra_ehci1_device.resource, + tegra_ehci1_device.num_resources); + if (val) + goto error; + + pdev->dev.dma_mask = tegra_ehci1_device.dev.dma_mask; + pdev->dev.coherent_dma_mask = tegra_ehci1_device.dev.coherent_dma_mask; + + platform_data = kmalloc(sizeof(struct tegra_ehci_platform_data), GFP_KERNEL); + if (!platform_data) + goto error; + + memcpy(platform_data, &tegra_ehci_pdata[0], + sizeof(struct tegra_ehci_platform_data)); + pdev->dev.platform_data = platform_data; + + val = platform_device_add(pdev); + if (val) + goto error_add; + + return pdev; + +error_add: + kfree(platform_data); +error: + pr_err("%s: failed to add the host contoller device\n", __func__); + platform_device_put(pdev); + return NULL; +} + +void tegra_usb_otg_host_unregister(struct platform_device *pdev) +{ + platform_device_unregister(pdev); +} + +static void __init tegra_aruba_init(void) +{ + tegra_common_init(); + tegra_clk_init_from_table(aruba_clk_init_table); + aruba_pinmux_init(); + + tegra_ehci2_device.dev.platform_data + = &aruba_ehci2_ulpi_platform_data; + platform_add_devices(aruba_devices, ARRAY_SIZE(aruba_devices)); + + aruba_sdhci_init(); + aruba_i2c_init(); + aruba_regulator_init(); + aruba_touch_init(); + aruba_keys_init(); + aruba_usb_init(); + aruba_panel_init(); + aruba_sensors_init(); + aruba_bt_rfkill(); +} + +MACHINE_START(ARUBA, "aruba") + .boot_params = 0x80000100, + .phys_io = IO_APB_PHYS, + .io_pg_offst = ((IO_APB_VIRT) >> 18) & 0xfffc, + .init_irq = tegra_init_irq, + .init_machine = tegra_aruba_init, + .map_io = tegra_map_common_io, + .timer = &tegra_timer, +MACHINE_END |