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 <m...@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);
 }
 
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to