svn commit: r321172 - head/sys/arm/allwinner

Emmanuel Vadot manu at FreeBSD.org
Tue Jul 18 19:50:04 UTC 2017


Author: manu
Date: Tue Jul 18 19:50:02 2017
New Revision: 321172
URL: https://svnweb.freebsd.org/changeset/base/321172

Log:
  Allwinner EHCI: Do not fail if we cannot get a phy
  
  If we cannot get a phy, do not detach the driver, some boards have phy
  always enabled and not exposed.
  While here do not release the clocks if we fails as we release them
  in a10_ehci_detach.
  
  Tested-on:	OrangePi-One

Modified:
  head/sys/arm/allwinner/a10_ehci.c

Modified: head/sys/arm/allwinner/a10_ehci.c
==============================================================================
--- head/sys/arm/allwinner/a10_ehci.c	Tue Jul 18 19:00:15 2017	(r321171)
+++ head/sys/arm/allwinner/a10_ehci.c	Tue Jul 18 19:50:02 2017	(r321172)
@@ -226,16 +226,13 @@ a10_ehci_attach(device_t self)
 	}
 
 	/* Enable USB PHY */
-	err = phy_get_by_ofw_name(self, 0, "usb", &aw_sc->phy);
-	if (err != 0) {
-		device_printf(self, "Could not get phy\n");
-		goto error;
+	if (phy_get_by_ofw_name(self, 0, "usb", &aw_sc->phy) == 0) {
+		err = phy_enable(self, aw_sc->phy);
+		if (err != 0) {
+			device_printf(self, "Could not enable phy\n");
+			goto error;
+		}
 	}
-	err = phy_enable(self, aw_sc->phy);
-	if (err != 0) {
-		device_printf(self, "Could not enable phy\n");
-		goto error;
-	}
 
 	/* Enable passby */
 	reg_value = A10_READ_4(sc, SW_USB_PMU_IRQ_ENABLE);
@@ -263,10 +260,6 @@ a10_ehci_attach(device_t self)
 	return (0);
 
 error:
-	if (aw_sc->clk != NULL) {
-		clk_disable(aw_sc->clk);
-		clk_release(aw_sc->clk);
-	}
 	a10_ehci_detach(self);
 	return (ENXIO);
 }


More information about the svn-src-all mailing list