arm: tegra: p1852: Add USB_G_ANDROID support
Amlan Kundu [Mon, 16 Jul 2012 09:35:23 +0000 (14:35 +0530)]
+ require for android adb

bug 1005255

Change-Id: If2c8d197f987ddd43a9b6a6cc602ac1e2f4ae2f8
Signed-off-by: Amlan Kundu <akundu@nvidia.com>
Reviewed-on: http://git-master/r/114562
(cherry-picked from 6640721b05059f03325abadfebe2f08026a41a88)

arch/arm/mach-tegra/board-p1852.c

index e9cf144..2293447 100644 (file)
@@ -479,6 +479,32 @@ static int __init p1852_touch_init(void)
 
 #endif // CONFIG_TOUCHSCREEN_ATMEL_MXT
 
+#if defined(CONFIG_USB_G_ANDROID)
+static struct tegra_usb_platform_data tegra_udc_pdata = {
+       .port_otg = false,
+       .has_hostpc = true,
+       .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,
+       },
+       .u_cfg.utmi = {
+               .hssync_start_delay = 0,
+               .idle_wait_delay = 17,
+               .elastic_limit = 16,
+               .term_range_adj = 6,
+               .xcvr_setup = 63,
+               .xcvr_setup_offset = 6,
+               .xcvr_use_fuses = 1,
+               .xcvr_lsfslew = 2,
+               .xcvr_lsrslew = 2,
+               .xcvr_use_lsb = 1,
+       },
+};
+#else
 static struct tegra_usb_platform_data tegra_ehci1_utmi_pdata = {
        .port_otg = false,
        .has_hostpc = true,
@@ -504,6 +530,7 @@ static struct tegra_usb_platform_data tegra_ehci1_utmi_pdata = {
                .xcvr_use_lsb = 1,
        },
 };
+#endif
 
 static struct tegra_usb_platform_data tegra_ehci2_utmi_pdata = {
        .port_otg = false,
@@ -559,9 +586,16 @@ static struct tegra_usb_platform_data tegra_ehci3_utmi_pdata = {
 
 static void p1852_usb_init(void)
 {
+       /* Need to parse sku info to decide host/device mode */
+
+       /* G_ANDROID require device mode */
+#if defined(CONFIG_USB_G_ANDROID)
+       tegra_udc_device.dev.platform_data = &tegra_udc_pdata;
+       platform_device_register(&tegra_udc_device);
+#else
        tegra_ehci1_device.dev.platform_data = &tegra_ehci1_utmi_pdata;
        platform_device_register(&tegra_ehci1_device);
-
+#endif
        tegra_ehci2_device.dev.platform_data = &tegra_ehci2_utmi_pdata;
        platform_device_register(&tegra_ehci2_device);