Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 9 Apr 2016 11:23:46 +0000 (UTC)
From:      Jared McNeill <jmcneill@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r297739 - head/sys/arm/allwinner/a20
Message-ID:  <201604091123.u39BNknO029421@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jmcneill
Date: Sat Apr  9 11:23:46 2016
New Revision: 297739
URL: https://svnweb.freebsd.org/changeset/base/297739

Log:
  Enable PHY regulator when the optional "phy-supply" property is present.
  
  Submitted by:	Emmanuel Vadot <manu@bidouilliste.com>

Modified:
  head/sys/arm/allwinner/a20/a20_if_dwc.c

Modified: head/sys/arm/allwinner/a20/a20_if_dwc.c
==============================================================================
--- head/sys/arm/allwinner/a20/a20_if_dwc.c	Sat Apr  9 10:58:08 2016	(r297738)
+++ head/sys/arm/allwinner/a20/a20_if_dwc.c	Sat Apr  9 11:23:46 2016	(r297739)
@@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
 
 #include <arm/allwinner/allwinner_machdep.h>
 #include <dev/extres/clk/clk.h>
+#include <dev/extres/regulator/regulator.h>
 
 #include "if_dwc_if.h"
 
@@ -64,6 +65,7 @@ a20_if_dwc_init(device_t dev)
 	const char *tx_parent_name;
 	char *phy_type;
 	clk_t clk_tx, clk_tx_parent;
+	regulator_t reg;
 	phandle_t node;
 	int error;
 
@@ -96,6 +98,15 @@ a20_if_dwc_init(device_t dev)
 		}
 	}
 
+	/* Enable PHY regulator if applicable */
+	if (regulator_get_by_ofw_property(dev, "phy-supply", &reg) == 0) {
+		error = regulator_enable(reg);
+		if (error != 0) {
+			device_printf(dev, "could not enable PHY regulator\n");
+			return (error);
+		}
+	}
+
 	return (0);
 }
 



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