Skip to contentSkip to conversation

net: dm: fec: Fix regulator enable when using DM_REGULATOR

PATCH In review Adam Ford 4 participants 4 messages Jan 15, 2019 – Feb 16, 2019 Network drivers

lore
Share & tools
lore

Adam Ford

author
#0 lore raw

PATCH 1/1 net: dm: fec: Fix regulator enable when using DM_REGULATOR

When DM_REGULATOR is enabled, the driver attempts to call regulator_autoset() which expects the regulators to be on at boot and/or always on and fails if they are not true.
For a more generic approach, this patch just calls regulator_set_enable() which shouldn't have such restrictions.

Fixes ad8c43cbcafb ("net: dm: fec: Support the phy-supply

binding")

drivers/net/fec_mxc.c +1 -1
index 32fb34b793..e924ddeb6d 100644
@@ -1327,7 +1327,7 @@ static int fecmxc_probe(struct udevice *dev)
 
 #ifdef CONFIG_DM_REGULATOR
 	if (priv->phy_supply) {
-		ret = regulator_autoset(priv->phy_supply);
+		ret = regulator_set_enable(priv->phy_supply, true);
 		if (ret) {
 			printf("%s: Error enabling phy supply\n", dev->name);
 			return ret;
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 net: dm: fec: Fix regulator enable when using DM_REGULATOR

Hi Adam,

Quoted 16 lines · Adam Ford

When DM_REGULATOR is enabled, the driver attempts to call regulator_autoset() which expects the regulators to be on at boot and/or always on and fails if they are not true.
For a more generic approach, this patch just calls regulator_set_enable() which shouldn't have such restrictions.

Fixes ad8c43cbcafb ("net: dm: fec: Support the phy-supply

binding")

drivers/net/fec_mxc.c +0 -0
index 32fb34b793..e924ddeb6d 100644

drivers/net/fec_mxc.c static int fecmxc_probe(struct udevice *dev) · line 1333

Quoted 8 lines
drivers/net/fec_mxc.c +1 -1
@@ -1327,7 +1327,7 @@ static int fecmxc_probe(struct udevice *dev)
 
  #ifdef CONFIG_DM_REGULATOR
  	if (priv->phy_supply) {
-		ret = regulator_autoset(priv->phy_supply);
+		ret = regulator_set_enable(priv->phy_supply, true);
  		if (ret) {
  			printf("%s: Error enabling phy supply\n", dev->name);
  			return ret;

Thanks for fixing this.

Regards,

Martin

#2 lore raw

PATCH 1/1 net: dm: fec: Fix regulator enable when using DM_REGULATOR

In reply to Adam Ford
Quoted 11 lines · Adam Ford

When DM_REGULATOR is enabled, the driver attempts to call regulator_autoset() which expects the regulators to be on at boot and/or always on and fails if they are not true.
For a more generic approach, this patch just calls regulator_set_enable() which shouldn't have such restrictions.

Fixes ad8c43cbcafb ("net: dm: fec: Support the phy-supply

binding")

#3 lore raw
In reply to Adam Ford
Quoted 15 lines

When DM_REGULATOR is enabled, the driver attempts to call regulator_autoset() which expects the regulators to be on at boot and/or always on and fails if they are not true.
For a more generic approach, this patch just calls regulator_set_enable() which shouldn't have such restrictions.

Fixes ad8c43cbcafb ("net: dm: fec: Support the phy-supply

binding")

drivers/net/fec_mxc.c +0 -0
index 32fb34b793..e924ddeb6d 100644

drivers/net/fec_mxc.c static int fecmxc_probe(struct udevice *dev) · line 1333

Quoted 8 lines
drivers/net/fec_mxc.c +1 -1
@@ -1327,7 +1327,7 @@ static int fecmxc_probe(struct udevice *dev)
 
 #ifdef CONFIG_DM_REGULATOR
 	if (priv->phy_supply) {
-		ret = regulator_autoset(priv->phy_supply);
+		ret = regulator_set_enable(priv->phy_supply, true);
 		if (ret) {
 			printf("%s: Error enabling phy supply\n", dev->name);
 			return ret;

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================