Module Name: src
Committed By: jmcneill
Date: Mon May 27 23:27:26 UTC 2019
Modified Files:
src/sys/arch/arm/sunxi: sunxi_gmac.c
Log Message:
Enable phy-supply if present
To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/sunxi/sunxi_gmac.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/arm/sunxi/sunxi_gmac.c
diff -u src/sys/arch/arm/sunxi/sunxi_gmac.c:1.3 src/sys/arch/arm/sunxi/sunxi_gmac.c:1.4
--- src/sys/arch/arm/sunxi/sunxi_gmac.c:1.3 Sat Feb 23 17:18:38 2019
+++ src/sys/arch/arm/sunxi/sunxi_gmac.c Mon May 27 23:27:26 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_gmac.c,v 1.3 2019/02/23 17:18:38 martin Exp $ */
+/* $NetBSD: sunxi_gmac.c,v 1.4 2019/05/27 23:27:26 jmcneill Exp $ */
/*-
* Copyright (c) 2017 Jared McNeill <[email protected]>
@@ -28,7 +28,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sunxi_gmac.c,v 1.3 2019/02/23 17:18:38 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_gmac.c,v 1.4 2019/05/27 23:27:26 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -108,6 +108,7 @@ sunxi_gmac_attach(device_t parent, devic
const int phandle = faa->faa_phandle;
struct clk *clk_gmac, *clk_gmac_tx;
struct fdtbus_reset *rst_gmac;
+ struct fdtbus_regulator *reg_phy;
const char *phy_mode;
char intrstr[128];
bus_addr_t addr;
@@ -145,6 +146,13 @@ sunxi_gmac_attach(device_t parent, devic
aprint_error(": missing 'phy-mode' property\n");
return;
}
+
+ reg_phy = fdtbus_regulator_acquire(phandle, "phy-supply");
+ if (reg_phy != NULL && fdtbus_regulator_enable(reg_phy) != 0) {
+ aprint_error(": couldn't enable PHY regualtor\n");
+ return;
+ }
+
if (strcmp(phy_mode, "mii") == 0) {
if (clk_set_rate(clk_gmac_tx, GMAC_TX_RATE_MII) != 0) {
aprint_error(": failed to set TX clock rate (MII)\n");