From: Kamil Debski <k.deb...@samsung.com>

This patch moves the part of code that initializes the PHY bus width.
This results in simpler code and removes the need to check whether
the Generic PHY Framework is used.

Signed-off-by: Kamil Debski <k.deb...@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprow...@samsung.com>
Signed-off-by: Robert Baldyga <r.bald...@samsung.com>
---
 drivers/usb/dwc2/gadget.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index 70eab95..fc27b4c 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -3395,6 +3395,9 @@ static int s3c_hsotg_probe(struct platform_device *pdev)
                return -ENOMEM;
        }
 
+       /* Set default UTMI width */
+       hsotg->phyif = GUSBCFG_PHYIF16;
+
        /*
         * Attempt to find a generic PHY, then look for an old style
         * USB PHY, finally fall back to pdata
@@ -3413,8 +3416,15 @@ static int s3c_hsotg_probe(struct platform_device *pdev)
                        hsotg->plat = plat;
                } else
                        hsotg->uphy = uphy;
-       } else
+       } else {
                hsotg->phy = phy;
+               /*
+                * If using the generic PHY framework, check if the PHY bus
+                * width is 8-bit and set the phyif appropriately.
+                */
+               if (phy_get_bus_width(phy) == 8)
+                       hsotg->phyif = GUSBCFG_PHYIF8;
+       }
 
        hsotg->dev = dev;
 
@@ -3481,16 +3491,6 @@ static int s3c_hsotg_probe(struct platform_device *pdev)
                goto err_supplies;
        }
 
-       /* Set default UTMI width */
-       hsotg->phyif = GUSBCFG_PHYIF16;
-
-       /*
-        * If using the generic PHY framework, check if the PHY bus
-        * width is 8-bit and set the phyif appropriately.
-        */
-       if (hsotg->phy && (phy_get_bus_width(phy) == 8))
-               hsotg->phyif = GUSBCFG_PHYIF8;
-
        /* usb phy enable */
        s3c_hsotg_phy_enable(hsotg);
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to