Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Jul 2017 19:50:03 +0000 (UTC)
From:      Emmanuel Vadot <manu@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r321172 - head/sys/arm/allwinner
Message-ID:  <201707181950.v6IJo3b6016045@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201707181950.v6IJo3b6016045>