xhci: tegra: load fw from filesystem earlier
Bibek Basu [Fri, 22 May 2015 07:30:54 +0000 (12:30 +0530)]
Loading firmware from filesystem takes much time. Enabing vbus regualtor
before loading firmware will cause the time gap between vbus ON and host
controller ready too large. So, we move the time of firmware loading
earlier.

Bug 200067006

Change-Id: I63ecbd9e65f3bb56db564f72cc417fc4f76adbc3
Signed-off-by: Henry Lin <henryl@nvidia.com>
Signed-off-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-on: http://git-master/r/736193
(cherry picked from commit 6875a1752b3ed4e121efcc3fddca0810ffd22546)
Reviewed-on: http://git-master/r/746074
GVS: Gerrit_Virtual_Submit
Reviewed-by: Venkat Moganty <vmoganty@nvidia.com>

drivers/usb/host/xhci-tegra.c

index da83737..8a4c53d 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * xhci-tegra.c - Nvidia xHCI host controller driver
  *
- * Copyright (c) 2013-2014, NVIDIA CORPORATION.  All rights reserved.
+ * Copyright (c) 2013-2015, NVIDIA CORPORATION.  All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
@@ -4281,9 +4281,6 @@ static int hsic_power_create_file(struct tegra_xhci_hcd *tegra)
 static int tegra_xhci_probe(struct platform_device *pdev)
 {
        struct tegra_xhci_hcd *tegra;
-       struct resource *res;
-       unsigned pad;
-       u32 val;
        int ret;
        int irq;
        const struct tegra_xusb_soc_config *soc_config;
@@ -4372,6 +4369,35 @@ static int tegra_xhci_probe(struct platform_device *pdev)
                return ret;
        }
 
+       fw_log_init(tegra);
+       ret = init_firmware(tegra);
+       if (ret < 0) {
+               dev_err(&pdev->dev, "failed to init firmware\n");
+               ret = -ENODEV;
+               goto err_deinit_firmware_log;
+       }
+
+       return 0;
+
+err_deinit_firmware_log:
+       fw_log_deinit(tegra);
+
+       return ret;
+}
+
+static int tegra_xhci_probe2(struct tegra_xhci_hcd *tegra)
+{
+       struct platform_device *pdev = tegra->pdev;
+       const struct hc_driver *driver;
+       int ret;
+       struct resource *res;
+       int irq;
+       struct xhci_hcd *xhci;
+       struct usb_hcd  *hcd;
+       unsigned port;
+       unsigned pad;
+       u32 val;
+
        ret = tegra_xusb_partitions_clk_init(tegra);
        if (ret) {
                dev_err(&pdev->dev,
@@ -4481,42 +4507,6 @@ static int tegra_xhci_probe(struct platform_device *pdev)
        tegra_periph_reset_deassert(tegra->ss_clk);
 
        platform_set_drvdata(pdev, tegra);
-       fw_log_init(tegra);
-       ret = init_firmware(tegra);
-       if (ret < 0) {
-               dev_err(&pdev->dev, "failed to init firmware\n");
-               ret = -ENODEV;
-               goto err_deinit_firmware_log;
-       }
-
-       return 0;
-
-err_deinit_firmware_log:
-       fw_log_deinit(tegra);
-err_deinit_usb2_clocks:
-       tegra_usb2_clocks_deinit(tegra);
-err_deinit_tegra_xusb_regulator:
-       tegra_xusb_regulator_deinit(tegra);
-err_deinit_xusb_partition_clk:
-       if (tegra->transceiver)
-               usb_unregister_notifier(tegra->transceiver, &tegra->otgnb);
-
-       tegra_xusb_partitions_clk_deinit(tegra);
-
-       return ret;
-}
-
-static int tegra_xhci_probe2(struct tegra_xhci_hcd *tegra)
-{
-       struct platform_device *pdev = tegra->pdev;
-       const struct hc_driver *driver;
-       int ret;
-       struct resource *res;
-       int irq;
-       struct xhci_hcd *xhci;
-       struct usb_hcd  *hcd;
-       unsigned port;
-
 
        ret = load_firmware(tegra, false /* do reset ARU */);
        if (ret < 0) {
@@ -4668,6 +4658,15 @@ err_remove_usb2_hcd:
        usb_remove_hcd(hcd);
 err_put_usb2_hcd:
        usb_put_hcd(hcd);
+err_deinit_usb2_clocks:
+       tegra_usb2_clocks_deinit(tegra);
+err_deinit_tegra_xusb_regulator:
+       tegra_xusb_regulator_deinit(tegra);
+err_deinit_xusb_partition_clk:
+       if (tegra->transceiver)
+               usb_unregister_notifier(tegra->transceiver, &tegra->otgnb);
+
+       tegra_xusb_partitions_clk_deinit(tegra);
 
        return ret;
 }