/*
* arch/arm/mach-tegra/board-ventana.c
*
- * Copyright (c) 2010-2011, NVIDIA Corporation.
+ * Copyright (c) 2010-2013, NVIDIA CORPORATION. All rights reserved.
*
* 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
#include <linux/memblock.h>
#include <linux/i2c/atmel_mxt_ts.h>
#include <linux/tegra_uart.h>
+#include <linux/rfkill-gpio.h>
#include <sound/wm8903.h>
#include <mach/iomap.h>
#include <mach/io.h>
#include <mach/i2s.h>
-#include <mach/tegra_wm8903_pdata.h>
+#include <mach/tegra_asoc_pdata.h>
#include <asm/hardware/gic.h>
#include <asm/mach-types.h>
#include "wakeups-t2.h"
#include "pm.h"
#include "tegra2_emc.h"
+#include "common.h"
-static struct tegra_utmip_config utmi_phy_config[] = {
- [0] = {
- .hssync_start_delay = 9,
- .idle_wait_delay = 17,
- .elastic_limit = 16,
- .term_range_adj = 6,
- .xcvr_setup = 15,
- .xcvr_setup_offset = 0,
- .xcvr_use_fuses = 1,
- .xcvr_lsfslew = 2,
- .xcvr_lsrslew = 2,
- },
- [1] = {
- .hssync_start_delay = 9,
- .idle_wait_delay = 17,
- .elastic_limit = 16,
- .term_range_adj = 6,
- .xcvr_setup = 8,
- .xcvr_setup_offset = 0,
- .xcvr_use_fuses = 1,
- .xcvr_lsfslew = 2,
- .xcvr_lsrslew = 2,
- },
-};
-static struct tegra_ulpi_config ulpi_phy_config = {
- .reset_gpio = TEGRA_GPIO_PG2,
- .clk = "cdev2",
-};
-
-static struct resource ventana_bcm4329_rfkill_resources[] = {
+static struct rfkill_gpio_platform_data ventana_bt_rfkill_pdata[] = {
{
- .name = "bcm4329_nshutdown_gpio",
- .start = TEGRA_GPIO_PU0,
- .end = TEGRA_GPIO_PU0,
- .flags = IORESOURCE_IO,
+ .name = "bt_rfkill",
+ .shutdown_gpio = TEGRA_GPIO_PU0,
+ .reset_gpio = TEGRA_GPIO_INVALID,
+ .type = RFKILL_TYPE_BLUETOOTH,
},
};
-static struct platform_device ventana_bcm4329_rfkill_device = {
- .name = "bcm4329_rfkill",
+static struct platform_device ventana_bt_rfkill_device = {
+ .name = "rfkill_gpio",
.id = -1,
- .num_resources = ARRAY_SIZE(ventana_bcm4329_rfkill_resources),
- .resource = ventana_bcm4329_rfkill_resources,
+ .dev = {
+ .platform_data = ventana_bt_rfkill_pdata,
+ },
};
static void __init ventana_bt_rfkill(void)
{
/*Add Clock Resource*/
- clk_add_alias("bcm4329_32k_clk", ventana_bcm4329_rfkill_device.name, \
+ clk_add_alias("bcm4329_32k_clk", ventana_bt_rfkill_device.name, \
"blink", NULL);
return;
}
},
[2] = {
.name = "host_wake",
- .start = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_PU6),
- .end = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_PU6),
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
},
};
static void __init ventana_setup_bluesleep(void)
{
+ ventana_bluesleep_resources[2].start =
+ ventana_bluesleep_resources[2].end =
+ gpio_to_irq(TEGRA_GPIO_PU6);
platform_device_register(&ventana_bluesleep_device);
- tegra_gpio_enable(TEGRA_GPIO_PU6);
- tegra_gpio_enable(TEGRA_GPIO_PU1);
return;
}
{ NULL, NULL, 0, 0},
};
-static struct tegra_ulpi_config ventana_ehci2_ulpi_phy_config = {
- .reset_gpio = TEGRA_GPIO_PV1,
- .clk = "cdev2",
-};
-
-static struct tegra_ehci_platform_data ventana_ehci2_ulpi_platform_data = {
- .operating_mode = TEGRA_USB_HOST,
- .power_down_on_bus_suspend = 1,
- .phy_config = &ventana_ehci2_ulpi_phy_config,
- .phy_type = TEGRA_USB_PHY_TYPE_LINK_ULPI,
- .default_enable = true,
-};
-
static struct tegra_i2c_platform_data ventana_i2c1_platform_data = {
.adapter_nr = 0,
.bus_count = 1,
static struct i2c_board_info __initdata wm8903_board_info = {
I2C_BOARD_INFO("wm8903", 0x1a),
.platform_data = &ventana_wm8903_pdata,
- .irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_CDC_IRQ),
};
static void ventana_i2c_init(void)
platform_device_register(&tegra_i2c_device3);
platform_device_register(&tegra_i2c_device4);
+ wm8903_board_info.irq = gpio_to_irq(TEGRA_GPIO_CDC_IRQ);
i2c_register_board_info(0, &wm8903_board_info, 1);
}
static struct platform_device *ventana_uart_devices[] __initdata = {
unsigned long status =
readl(IO_ADDRESS(TEGRA_PMC_BASE) + PMC_WAKE_STATUS);
- return status & TEGRA_WAKE_GPIO_PV2 ? KEY_POWER : KEY_RESERVED;
+ return (status & (1 << TEGRA_WAKE_GPIO_PV2)) ?
+ KEY_POWER : KEY_RESERVED;
}
static struct gpio_keys_platform_data ventana_keys_platform_data = {
.platform_data = &ventana_keys_platform_data,
},
};
-
-static void ventana_keys_init(void)
-{
- int i;
-
- for (i = 0; i < ARRAY_SIZE(ventana_keys); i++)
- tegra_gpio_enable(ventana_keys[i].gpio);
-}
#endif
static struct platform_device tegra_camera = {
.id = -1,
};
-static struct tegra_wm8903_platform_data ventana_audio_pdata = {
+static struct tegra_asoc_platform_data ventana_audio_pdata = {
.gpio_spkr_en = TEGRA_GPIO_SPKR_EN,
.gpio_hp_det = TEGRA_GPIO_HP_DET,
.gpio_hp_mute = -1,
.gpio_int_mic_en = TEGRA_GPIO_INT_MIC_EN,
.gpio_ext_mic_en = TEGRA_GPIO_EXT_MIC_EN,
+ .i2s_param[HIFI_CODEC] = {
+ .audio_port_id = 0,
+ .is_i2s_master = 1,
+ .i2s_mode = TEGRA_DAIFMT_I2S,
+ },
+ .i2s_param[BASEBAND] = {
+ .audio_port_id = -1,
+ },
+ .i2s_param[BT_SCO] = {
+ .audio_port_id = 3,
+ .is_i2s_master = 1,
+ .i2s_mode = TEGRA_DAIFMT_DSP_A,
+ },
};
static struct platform_device ventana_audio_device = {
&tegra_das_device,
&spdif_dit_device,
&bluetooth_dit_device,
- &ventana_bcm4329_rfkill_device,
+ &ventana_bt_rfkill_device,
&tegra_pcm_device,
&ventana_audio_device,
};
+#define MXT_CFG_NAME "Android_Ventana_2012-01-31.cfg"
+static u8 read_chg(void)
+{
+ return gpio_get_value(TEGRA_GPIO_PH4);
+}
+
static struct mxt_platform_data atmel_mxt_info = {
- .x_line = 27,
- .y_line = 42,
- .x_size = 768,
- .y_size = 1366,
- .blen = 0x20,
- .threshold = 0x3C,
- .voltage = 3300000,
- .orient = MXT_ROTATED_90,
- .irqflags = IRQF_TRIGGER_FALLING,
+ .irqflags = IRQF_TRIGGER_FALLING,
+ .read_chg = &read_chg,
+ .mxt_cfg_name = MXT_CFG_NAME,
};
static struct i2c_board_info __initdata i2c_info[] = {
{
- I2C_BOARD_INFO("atmel_mxt_ts", 0x5A),
- .irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_PV6),
+ I2C_BOARD_INFO("atmel_mxt_ts", MXT1386_I2C_ADDR3),
.platform_data = &atmel_mxt_info,
},
};
static int __init ventana_touch_init_atmel(void)
{
- tegra_gpio_enable(TEGRA_GPIO_PV6);
- tegra_gpio_enable(TEGRA_GPIO_PQ7);
-
+ i2c_info[0].irq = gpio_to_irq(TEGRA_GPIO_PV6);
gpio_request(TEGRA_GPIO_PV6, "atmel-irq");
gpio_direction_input(TEGRA_GPIO_PV6);
static struct i2c_board_info __initdata 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_panjit(void)
{
- tegra_gpio_enable(TEGRA_GPIO_PV6);
-
- tegra_gpio_enable(TEGRA_GPIO_PQ7);
+ ventana_i2c_bus1_touch_info[0].irq = gpio_to_irq(TEGRA_GPIO_PV6);
i2c_register_board_info(0, ventana_i2c_bus1_touch_info, 1);
return 0;
}
-static struct usb_phy_plat_data tegra_usb_phy_pdata[] = {
- [0] = {
- .instance = 0,
- .vbus_irq = TPS6586X_INT_BASE + TPS6586X_INT_USB_DET,
- .vbus_gpio = TEGRA_GPIO_PD0,
+static int __init ventana_gps_init(void)
+{
+ struct clk *clk32 = clk_get_sys(NULL, "blink");
+ if (!IS_ERR(clk32)) {
+ clk_set_rate(clk32,clk32->parent->rate);
+ clk_enable(clk32);
+ }
+
+ return 0;
+}
+
+static struct tegra_usb_platform_data tegra_udc_pdata = {
+ .port_otg = true,
+ .has_hostpc = false,
+ .phy_intf = TEGRA_USB_PHY_INTF_UTMI,
+ .op_mode = TEGRA_USB_OPMODE_DEVICE,
+ .u_data.dev = {
+ .vbus_pmu_irq = 0,
+ .vbus_gpio = -1,
+ .charging_supported = false,
+ .remote_wakeup_supported = false,
},
- [1] = {
- .instance = 1,
- .vbus_gpio = -1,
+ .u_cfg.utmi = {
+ .hssync_start_delay = 0,
+ .elastic_limit = 16,
+ .idle_wait_delay = 17,
+ .term_range_adj = 6,
+ .xcvr_setup = 8,
+ .xcvr_lsfslew = 2,
+ .xcvr_lsrslew = 2,
+ .xcvr_setup_offset = 0,
+ .xcvr_use_fuses = 1,
},
- [2] = {
- .instance = 2,
- .vbus_gpio = TEGRA_GPIO_PD3,
+};
+
+static struct tegra_usb_platform_data tegra_ehci1_utmi_pdata = {
+ .port_otg = true,
+ .has_hostpc = false,
+ .phy_intf = TEGRA_USB_PHY_INTF_UTMI,
+ .op_mode = TEGRA_USB_OPMODE_HOST,
+ .u_data.host = {
+ .vbus_gpio = TEGRA_GPIO_PD0,
+ .hot_plug = true,
+ .remote_wakeup_supported = false,
+ .power_off_on_suspend = true,
+ },
+ .u_cfg.utmi = {
+ .hssync_start_delay = 9,
+ .elastic_limit = 16,
+ .idle_wait_delay = 17,
+ .term_range_adj = 6,
+ .xcvr_setup = 8,
+ .xcvr_lsfslew = 2,
+ .xcvr_lsrslew = 2,
},
};
-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 = 1,
- .default_enable = true,
+static void ulpi_link_platform_open(void)
+{
+ int reset_gpio = TEGRA_GPIO_PV1;
+
+ gpio_request(reset_gpio, "ulpi_phy_reset");
+ gpio_direction_output(reset_gpio, 0);
+ msleep(5);
+ gpio_direction_output(reset_gpio, 1);
+}
+
+static struct tegra_usb_phy_platform_ops ulpi_link_plat_ops = {
+ .open = ulpi_link_platform_open,
+};
+
+static struct tegra_usb_platform_data tegra_ehci2_ulpi_link_pdata = {
+ .port_otg = false,
+ .has_hostpc = false,
+ .phy_intf = TEGRA_USB_PHY_INTF_ULPI_LINK,
+ .op_mode = TEGRA_USB_OPMODE_HOST,
+ .u_data.host = {
+ .vbus_gpio = -1,
+ .hot_plug = false,
+ .remote_wakeup_supported = false,
+ .power_off_on_suspend = true,
},
- [1] = {
- .phy_config = &ulpi_phy_config,
- .operating_mode = TEGRA_USB_HOST,
- .power_down_on_bus_suspend = 1,
- .phy_type = TEGRA_USB_PHY_TYPE_LINK_ULPI,
- .default_enable = true,
+ .u_cfg.ulpi = {
+ .shadow_clk_delay = 10,
+ .clock_out_delay = 1,
+ .data_trimmer = 4,
+ .stpdirnxt_trimmer = 4,
+ .dir_trimmer = 4,
+ .clk = "cdev2",
},
- [2] = {
- .phy_config = &utmi_phy_config[1],
- .operating_mode = TEGRA_USB_HOST,
- .power_down_on_bus_suspend = 1,
- .hotplug = 1,
- .default_enable = true,
+ .ops = &ulpi_link_plat_ops,
+};
+
+static struct tegra_usb_platform_data tegra_ehci3_utmi_pdata = {
+ .port_otg = false,
+ .has_hostpc = false,
+ .phy_intf = TEGRA_USB_PHY_INTF_UTMI,
+ .op_mode = TEGRA_USB_OPMODE_HOST,
+ .u_data.host = {
+ .vbus_gpio = TEGRA_GPIO_PD3,
+ .hot_plug = true,
+ .remote_wakeup_supported = false,
+ .power_off_on_suspend = true,
+ },
+ .u_cfg.utmi = {
+ .hssync_start_delay = 9,
+ .elastic_limit = 16,
+ .idle_wait_delay = 17,
+ .term_range_adj = 6,
+ .xcvr_setup = 8,
+ .xcvr_lsfslew = 2,
+ .xcvr_lsrslew = 2,
},
};
-static struct tegra_otg_platform_data tegra_otg_pdata = {
+static struct tegra_usb_otg_data tegra_otg_pdata = {
.ehci_device = &tegra_ehci1_device,
- .ehci_pdata = &tegra_ehci_pdata[0],
+ .ehci_pdata = &tegra_ehci1_utmi_pdata,
};
-static int __init ventana_gps_init(void)
-{
- struct clk *clk32 = clk_get_sys(NULL, "blink");
- if (!IS_ERR(clk32)) {
- clk_set_rate(clk32,clk32->parent->rate);
- clk_enable(clk32);
- }
-
- tegra_gpio_enable(TEGRA_GPIO_PZ3);
- return 0;
-}
-
static void ventana_usb_init(void)
{
- tegra_usb_phy_init(tegra_usb_phy_pdata, ARRAY_SIZE(tegra_usb_phy_pdata));
/* OTG should be the first to be registered */
tegra_otg_device.dev.platform_data = &tegra_otg_pdata;
platform_device_register(&tegra_otg_device);
+ tegra_udc_device.dev.platform_data = &tegra_udc_pdata;
platform_device_register(&tegra_udc_device);
+
+ tegra_ehci2_device.dev.platform_data = &tegra_ehci2_ulpi_link_pdata;
platform_device_register(&tegra_ehci2_device);
- tegra_ehci3_device.dev.platform_data=&tegra_ehci_pdata[2];
+ tegra_ehci3_device.dev.platform_data = &tegra_ehci3_utmi_pdata;
platform_device_register(&tegra_ehci3_device);
}
tegra_clk_init_from_table(ventana_clk_init_table);
ventana_emc_init();
+ tegra_soc_device_init("ventana");
tegra_enable_pinmux();
ventana_pinmux_init();
ventana_i2c_init();
ventana_uart_init();
- tegra_ehci2_device.dev.platform_data
- = &ventana_ehci2_ulpi_platform_data;
platform_add_devices(ventana_devices, ARRAY_SIZE(ventana_devices));
tegra_ram_console_debug_init();
ventana_sdhci_init();
ventana_touch_init_panjit();
}
-#ifdef CONFIG_KEYBOARD_GPIO
- ventana_keys_init();
-#endif
-
ventana_usb_init();
ventana_gps_init();
ventana_panel_init();
ventana_bt_rfkill();
ventana_setup_bluesleep();
- tegra_release_bootloader_fb();
}
int __init tegra_ventana_protected_aperture_init(void)
tegra_ram_console_debug_reserve(SZ_1M);
}
+static const char *ventana_dt_board_compat[] = {
+ "nvidia,ventana",
+ NULL
+};
+
MACHINE_START(VENTANA, "ventana")
.atag_offset = 0x100,
+ .soc = &tegra_soc_desc,
.map_io = tegra_map_common_io,
.init_early = tegra20_init_early,
.init_irq = tegra_init_irq,
.timer = &tegra_timer,
.init_machine = tegra_ventana_init,
.restart = tegra_assert_system_reset,
+ .dt_compat = ventana_dt_board_compat,
MACHINE_END