ARM: tegra: stingray: Disable USB detect when BP USB HW Bypass
authorJohn Michelau <john.michelau@motorola.com>
Mon, 22 Nov 2010 00:23:28 +0000 (18:23 -0600)
committerBenoit Goby <benoit@android.com>
Wed, 24 Nov 2010 22:51:37 +0000 (14:51 -0800)
The bootloader sets up a switch in this mode to reroute the
QCOM BP USB out of stingray's external USB connector. We must
disable the AP-side drivers in this mode, otherwise they
interfere with the BP's usage of the external USB.

Change-Id: Ib6cdd47be930781034f27095baff8c7a229469a6
Signed-off-by: Benoit Goby <benoit@android.com>
arch/arm/mach-tegra/board-stingray-power.c
arch/arm/mach-tegra/board-stingray.c
arch/arm/mach-tegra/board-stingray.h

index 6fc003efebeb8aa16e7805738ddd4187760e24ff..0ad1beea4eab25544b9a1cd3adf9dbf219f9ca80 100644 (file)
@@ -270,7 +270,6 @@ static struct platform_device cpcap_notification_led = {
 
 static struct platform_device *cpcap_devices[] = {
        &cpcap_validity_device,
-       &cpcap_whisper_device,
        &cpcap_notification_led,
        &cpcap_privacy_led,
        &cpcap_3mm5_device,
@@ -720,6 +719,9 @@ int __init stingray_power_init(void)
        for (i = 0; i < ARRAY_SIZE(cpcap_devices); i++)
                cpcap_device_register(cpcap_devices[i]);
 
+       if (!stingray_qbp_usb_hw_bypass_enabled())
+               cpcap_device_register(&cpcap_whisper_device);
+
        (void) cpcap_driver_register(&cpcap_validity_driver);
 
        i2c_register_board_info(3, stingray_i2c_bus4_power_info,
index 77ef3c92251b57eb6b3853505d576b3ffda250f1..aa2f03453b1b03edb69029b6cccc9d2e1ed79412 100644 (file)
@@ -893,6 +893,19 @@ static int __init stingray_revision_parse(char *options)
 }
 __setup("hw_rev=", stingray_revision_parse);
 
+int stingray_qbp_usb_hw_bypass_enabled(void)
+{
+       /* We could use the boot_mode string instead of probing the HW, but
+        * that would not work if we enable run-time switching to this mode
+        * in the future.
+        */
+       if (gpio_get_value(TEGRA_GPIO_PT3) && !gpio_get_value(TEGRA_GPIO_PV4)) {
+               pr_info("stingray_qbp_usb_hw_bypass enabled\n");
+               return 1;
+       }
+       return 0;
+}
+
 static struct tegra_suspend_platform_data stingray_suspend = {
        .cpu_timer = 1500,
        .cpu_off_timer = 1,
@@ -950,13 +963,15 @@ static void __init tegra_stingray_init(void)
        tegra_common_init();
        tegra_init_suspend(&stingray_suspend);
 
-       /* Stingray has a USB switch that disconnects the usb port from the AP20
+       /* Stingray has a USB switch that disconnects the usb port from the T20
           unless a factory cable is used, the factory jumper is set, or the
           usb_data_en gpio is set.
         */
-       tegra_gpio_enable(TEGRA_GPIO_PV4);
-       gpio_request(TEGRA_GPIO_PV4, "usb_data_en");
-       gpio_direction_output(TEGRA_GPIO_PV4, 1);
+       if (!stingray_qbp_usb_hw_bypass_enabled()) {
+               tegra_gpio_enable(TEGRA_GPIO_PV4);
+               gpio_request(TEGRA_GPIO_PV4, "usb_data_en");
+               gpio_direction_output(TEGRA_GPIO_PV4, 1);
+       }
 
        /* USB_FORCEON_N (TEGRA_GPIO_PC5) should be forced high at boot
           and will be pulled low by the hardware on attach */
index be6d9696819c41fecef959a94f70ca38fc999514..9a107ae5ee2f2a1791757e6f4c451d4c6f298018 100644 (file)
@@ -29,6 +29,7 @@ int stingray_power_init(void);
 unsigned int stingray_revision(void);
 unsigned int stingray_powerup_reason (void);
 void stingray_gps_init(void);
+int stingray_qbp_usb_hw_bypass_enabled(void);
 
 /* as defined in the bootloader*/
 #define HWREV(x)    (((x)>>16) & 0xFFFF)