usb: xhci: tegra: cleanup hs disconnect fix
Ajay Gupta [Tue, 14 May 2013 22:11:34 +0000 (15:11 -0700)]
HS disconnect fix has introduced Coverity bug by returning
unconditionally from a function leaving dead code after return.
Fixing the same by checking a flag "ignore_freq_change" which
will be set for T114 in arch/arm/mach-tegra/xusb.c.

Bug 1046331

Change-Id: I7b86a47b7d1051db6d29fb56fb27c4a426df2ec6
Signed-off-by: Ajay Gupta <ajayg@nvidia.com>
Reviewed-on: http://git-master/r/229986
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Ashutosh Jha <ajha@nvidia.com>
GVS: Gerrit_Virtual_Submit

arch/arm/mach-tegra/include/mach/xusb.h
arch/arm/mach-tegra/xusb.c
drivers/usb/host/xhci-tegra.c

index a14cd2a..02125ca 100644 (file)
@@ -56,7 +56,11 @@ struct tegra_xusb_platform_data {
        u32 hs_iref_cap;
        u32 hs_term_range_adj;
        u32 hs_squelch_level;
+       /* chip specific */
+       unsigned long quirks;
 };
 
+#define TEGRA_XUSB_NEED_HS_DISCONNECT_SW_WAR BIT(0)
+
 extern void tegra_xusb_init(struct tegra_xusb_board_data *bdata);
 #endif /* _XUSB_H */
index 3a96f43..f0482db 100644 (file)
@@ -47,6 +47,9 @@ static void tegra_xusb_read_usb_calib(void)
 
 void tegra_xusb_init(struct tegra_xusb_board_data *bdata)
 {
+#ifdef CONFIG_ARCH_TEGRA_11x_SOC
+       tegra_xusb_plat_data.quirks |= TEGRA_XUSB_NEED_HS_DISCONNECT_SW_WAR;
+#endif
        tegra_xusb_read_usb_calib();
        tegra_xusb_plat_data.bdata = bdata;
        tegra_xhci_device.dev.platform_data = &tegra_xusb_plat_data;
index 48ec635..d8b268f 100644 (file)
@@ -747,8 +747,10 @@ tegra_xusb_request_clk_rate(struct tegra_xhci_hcd *tegra,
        int fw_req_rate = rate, cur_rate;
 
        /* Do not handle clock change as needed for HS disconnect issue */
-       *sw_resp = fw_req_rate | (MBOX_CMD_ACK << MBOX_CMD_SHIFT);
-       return ret;
+       if (tegra->pdata->quirks & TEGRA_XUSB_NEED_HS_DISCONNECT_SW_WAR) {
+               *sw_resp = fw_req_rate | (MBOX_CMD_ACK << MBOX_CMD_SHIFT);
+               return ret;
+       }
 
        /* frequency request from firmware is in KHz.
         * Convert it to MHz