瀏覽代碼

usb: dwc2/gadget: move phy bus legth initialization

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.debski@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Kamil Debski 11 年之前
父節點
當前提交
1b59fc7e3c
共有 1 個文件被更改,包括 11 次插入11 次删除
  1. 11 11
      drivers/usb/dwc2/gadget.c

+ 11 - 11
drivers/usb/dwc2/gadget.c

@@ -3423,6 +3423,9 @@ static int s3c_hsotg_probe(struct platform_device *pdev)
 	if (!hsotg)
 	if (!hsotg)
 		return -ENOMEM;
 		return -ENOMEM;
 
 
+	/* Set default UTMI width */
+	hsotg->phyif = GUSBCFG_PHYIF16;
+
 	/*
 	/*
 	 * Attempt to find a generic PHY, then look for an old style
 	 * Attempt to find a generic PHY, then look for an old style
 	 * USB PHY, finally fall back to pdata
 	 * USB PHY, finally fall back to pdata
@@ -3441,8 +3444,15 @@ static int s3c_hsotg_probe(struct platform_device *pdev)
 			hsotg->plat = plat;
 			hsotg->plat = plat;
 		} else
 		} else
 			hsotg->uphy = uphy;
 			hsotg->uphy = uphy;
-	} else
+	} else {
 		hsotg->phy = phy;
 		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;
 	hsotg->dev = dev;
 
 
@@ -3502,16 +3512,6 @@ static int s3c_hsotg_probe(struct platform_device *pdev)
 		goto err_supplies;
 		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 */
 	/* usb phy enable */
 	s3c_hsotg_phy_enable(hsotg);
 	s3c_hsotg_phy_enable(hsotg);