The PHY reset code is moved at the begining and end of the function
omap_start_ehc. This simplfies the writing clocks enabling code for 
OMAP4 later. 

Signed-off-by: Keshava Munegowda <keshava_mgo...@ti.com>
Signed-off-by: Anand Gadiyar <gadi...@ti.com>
---
 drivers/usb/host/ehci-omap.c |   52 +++++++++++++++++++++----------------------
 1 file changed, 26 insertions(+), 26 deletions(-)

Index: linux-2.6/drivers/usb/host/ehci-omap.c
===================================================================
--- linux-2.6.orig/drivers/usb/host/ehci-omap.c
+++ linux-2.6/drivers/usb/host/ehci-omap.c
@@ -279,6 +279,24 @@ static int omap_start_ehc(struct ehci_hc
 
        dev_dbg(omap->dev, "starting TI EHCI USB Controller\n");
 
+       if (omap->phy_reset) {
+               /* Refer: ISSUE1 */
+               if (gpio_is_valid(omap->reset_gpio_port[0])) {
+                       gpio_request(omap->reset_gpio_port[0],
+                                               "USB1 PHY reset");
+                       gpio_direction_output(omap->reset_gpio_port[0], 0);
+               }
+
+               if (gpio_is_valid(omap->reset_gpio_port[1])) {
+                       gpio_request(omap->reset_gpio_port[1],
+                                               "USB2 PHY reset");
+                       gpio_direction_output(omap->reset_gpio_port[1], 0);
+               }
+
+               /* Hold the PHY in RESET for enough time till DIR is high */
+               udelay(10);
+       }
+
        /* Enable Clocks for USBHOST */
        omap->usbhost_ick = clk_get(omap->dev, "usbhost_ick");
        if (IS_ERR(omap->usbhost_ick)) {
@@ -301,24 +319,6 @@ static int omap_start_ehc(struct ehci_hc
        }
        clk_enable(omap->usbhost_fs_fck);
 
-       if (omap->phy_reset) {
-               /* Refer: ISSUE1 */
-               if (gpio_is_valid(omap->reset_gpio_port[0])) {
-                       gpio_request(omap->reset_gpio_port[0],
-                                               "USB1 PHY reset");
-                       gpio_direction_output(omap->reset_gpio_port[0], 0);
-               }
-
-               if (gpio_is_valid(omap->reset_gpio_port[1])) {
-                       gpio_request(omap->reset_gpio_port[1],
-                                               "USB2 PHY reset");
-                       gpio_direction_output(omap->reset_gpio_port[1], 0);
-               }
-
-               /* Hold the PHY in RESET for enough time till DIR is high */
-               udelay(10);
-       }
-
        /* Configure TLL for 60Mhz clk for ULPI */
        omap->usbtll_fck = clk_get(omap->dev, "usbtll_fck");
        if (IS_ERR(omap->usbtll_fck)) {
@@ -476,14 +476,6 @@ err_tll_fck:
        clk_disable(omap->usbhost_fs_fck);
        clk_put(omap->usbhost_fs_fck);
 
-       if (omap->phy_reset) {
-               if (gpio_is_valid(omap->reset_gpio_port[0]))
-                       gpio_free(omap->reset_gpio_port[0]);
-
-               if (gpio_is_valid(omap->reset_gpio_port[1]))
-                       gpio_free(omap->reset_gpio_port[1]);
-       }
-
 err_host_fs_fck:
        clk_disable(omap->usbhost_hs_fck);
        clk_put(omap->usbhost_hs_fck);
@@ -493,6 +485,14 @@ err_host_hs_fck:
        clk_put(omap->usbhost_ick);
 
 err_host_ick:
+       if (omap->phy_reset) {
+               if (gpio_is_valid(omap->reset_gpio_port[0]))
+                       gpio_free(omap->reset_gpio_port[0]);
+
+               if (gpio_is_valid(omap->reset_gpio_port[1]))
+                       gpio_free(omap->reset_gpio_port[1]);
+       }
+
        return ret;
 }
 
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to