Skip to contentSkip to conversation

power: regulator: rk8xx: Add 500us delay after LDO regulator is enabled

PATCH In review Jonas Karlman 3 participants 8 messages Jul 2, 2023 – Jul 31, 2023 1 message not in the archive MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

cover power: regulator: rk8xx: Add 500us delay after LDO regulator is enabled

With the series "regulator: implement basic reference counter" [1], keeping regulator enablement in balance become more important.

A quick power cycle of a LDO regulator during dw-mmc signal voltage change, see patch 1, has shown that SD-card does not always get recognized after the vqmmc-supply is re-enabled.

Patch 2 fix this issue by applying a similar 400us enable_time delay the linux driver use.

Patch 1 is marked as DO NOT MERGE because it may have unintended affects like this and should be considered together with the "regulator:
implement basic reference counter" series.

[1] https://patchwork.ozlabs.org/project/uboot/list/?series=351536

Jonas Karlman (2):
DO NOT MERGE: mmc: dw_mmc: Keep vqmmc-supply enable count in balance
power: regulator: rk8xx: Add 500us delay after LDO regulator is
enabled

 drivers/mmc/dw_mmc.c            | 4 ++++
 drivers/power/regulator/rk8xx.c | 4 ++++
 2 files changed, 8 insertions(+)
Signature · 1 line
2.41.0
#1 lore raw

PATCH 1/2 DO NOT MERGE: mmc: dw_mmc: Keep vqmmc-supply enable count in balance

With the series "regulator: implement basic reference counter" [1], keeping regulator enablement in balance become more important.

Disable vqmmc-supply before signal voltage is changed to keep regulator enable counter in balance.

[1] https://patchwork.ozlabs.org/project/uboot/list/?series=351536

---
 drivers/mmc/dw_mmc.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/mmc/dw_mmc.c +4 -0
index 5085a3b491da..400066fa99a2 100644
@@ -509,6 +509,10 @@ static int dwmci_set_ios(struct mmc *mmc)
 	if (mmc->vqmmc_supply) {
 		int ret;
 
+		ret = regulator_set_enable_if_allowed(mmc->vqmmc_supply, false);
+		if (ret)
+			return ret;
+
 		if (mmc->signal_voltage == MMC_SIGNAL_VOLTAGE_180)
 			regulator_set_value(mmc->vqmmc_supply, 1800000);
 		else
Signature · 1 line
2.41.0
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] DO NOT MERGE: mmc: dw_mmc: Keep vqmmc-supply enable count in balance

Quoted 9 lines · Jonas Karlman

With the series "regulator: implement basic reference counter" [1], keeping regulator enablement in balance become more important.

Disable vqmmc-supply before signal voltage is changed to keep regulator enable counter in balance.

[1] https://patchwork.ozlabs.org/project/uboot/list/?series=351536

Thanks,
- Kever

Quoted 19 lines
---
  drivers/mmc/dw_mmc.c | 4 ++++
  1 file changed, 4 insertions(+)
drivers/mmc/dw_mmc.c +4 -0
index 5085a3b491da..400066fa99a2 100644
@@ -509,6 +509,10 @@ static int dwmci_set_ios(struct mmc *mmc)
  	if (mmc->vqmmc_supply) {
  		int ret;
 
+		ret = regulator_set_enable_if_allowed(mmc->vqmmc_supply, false);
+		if (ret)
+			return ret;
+
  		if (mmc->signal_voltage == MMC_SIGNAL_VOLTAGE_180)
  			regulator_set_value(mmc->vqmmc_supply, 1800000);
  		else
#3 lore raw

Re: [PATCH 1/2] DO NOT MERGE: mmc: dw_mmc: Keep vqmmc-supply enable count in balance

Hi Kever,

This patch was not intended to be merged as-is, at least not with "DO NOT MERGE" in the subject.

An updated revision of this patch is part of the "Keep fixed/gpio regulator enable count in balance" series [2] and should be merged as part of that series.

[2] https://patchwork.ozlabs.org/project/uboot/list/?series=364753

Regards,
Jonas

Quoted 34 lines · Kever Yang
Quoted 9 lines · Jonas Karlman

With the series "regulator: implement basic reference counter" [1], keeping regulator enablement in balance become more important.

Disable vqmmc-supply before signal voltage is changed to keep regulator enable counter in balance.

[1] https://patchwork.ozlabs.org/project/uboot/list/?series=351536

Thanks,
- Kever

Quoted 19 lines
---
  drivers/mmc/dw_mmc.c | 4 ++++
  1 file changed, 4 insertions(+)
drivers/mmc/dw_mmc.c +4 -0
index 5085a3b491da..400066fa99a2 100644
@@ -509,6 +509,10 @@ static int dwmci_set_ios(struct mmc *mmc)
  	if (mmc->vqmmc_supply) {
  		int ret;
 
+		ret = regulator_set_enable_if_allowed(mmc->vqmmc_supply, false);
+		if (ret)
+			return ret;
+
  		if (mmc->signal_voltage == MMC_SIGNAL_VOLTAGE_180)
  			regulator_set_value(mmc->vqmmc_supply, 1800000);
  		else
#4 lore raw

PATCH 2/2 power: regulator: rk8xx: Add 500us delay after LDO regulator is enabled

In reply to Jonas Karlman

A quick power cycle of a LDO regulator during dw-mmc signal voltage change has shown that SD-card does not always get recognized.

Linux driver use an enable_time of 400us for LDO regulators. Apply a 500us delay when a LDO regulator is enabled to fix possible issues.

Fixes 94afc1cb466a ("power: regulator: rk8xx: update the driver for rk808 and rk818")
---
 drivers/power/regulator/rk8xx.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/power/regulator/rk8xx.c +4 -0
index 0ee07ad299d7..e95640a39b0a 100644
@@ -12,6 +12,7 @@
 #include <dm.h>
 #include <errno.h>
 #include <log.h>
+#include <linux/delay.h>
 #include <power/rk8xx_pmic.h>
 #include <power/pmic.h>
 #include <power/regulator.h>
@@ -616,6 +617,9 @@ static int _ldo_set_enable(struct udevice *pmic, int ldo, bool enable)
 		break;
 	}
 
+	if (enable)
+		udelay(500);
+
 	return ret;
 }
 
Signature · 1 line
2.41.0
#5 lore raw

Hi Jonas,

Quoted 5 lines · Jonas Karlman

A quick power cycle of a LDO regulator during dw-mmc signal voltage change has shown that SD-card does not always get recognized.

Linux driver use an enable_time of 400us for LDO regulators. Apply a 500us delay when a LDO regulator is enabled to fix possible issues.

Does 400us not enough for the board you test?

Hi Elaine,

    Could help to check this change?

Thanks,

- Kever

Quoted 29 lines
Fixes 94afc1cb466a ("power: regulator: rk8xx: update the driver for rk808 and rk818")
---
  drivers/power/regulator/rk8xx.c | 4 ++++
  1 file changed, 4 insertions(+)
drivers/power/regulator/rk8xx.c +4 -0
index 0ee07ad299d7..e95640a39b0a 100644
@@ -12,6 +12,7 @@
  #include <dm.h>
  #include <errno.h>
  #include <log.h>
+#include <linux/delay.h>
  #include <power/rk8xx_pmic.h>
  #include <power/pmic.h>
  #include <power/regulator.h>
@@ -616,6 +617,9 @@ static int _ldo_set_enable(struct udevice *pmic, int ldo, bool enable)
  		break;
  	}
 
+	if (enable)
+		udelay(500);
+
  	return ret;
  }
 

A message that is not in the archive (sent off-list or not yet received): [email protected]

Reviewed-by elaine.zhang
#7 lore raw

hi,

Quoted 5 lines · Jonas Karlman

Hi Kever,

Quoted 3 lines · Kever Yang

Hi Jonas,

On 2023/7/2 20:41, Jonas Karlman wrote:

Quoted 8 lines
Quoted 6 lines
Quoted 5 lines

A quick power cycle of a LDO regulator during dw-mmc signal voltage change has shown that SD-card does not always get recognized.

Linux driver use an enable_time of 400us for LDO regulators. Apply a 500us delay when a LDO regulator is enabled to fix possible issues.

Does 400us not enough for the board you test?

It probably is, linux apply a 400-500us range sleep so I went with upper limit of 500us for this patch.

This looks okay.

Quoted 41 lines

Regards,
Jonas

Quoted 37 lines

Hi Elaine,

    Could help to check this change?

Thanks,

- Kever

Quoted 28 lines
Fixes 94afc1cb466a ("power: regulator: rk8xx: update the driver for rk808 and rk818")
---
   drivers/power/regulator/rk8xx.c | 4 ++++
   1 file changed, 4 insertions(+)
drivers/power/regulator/rk8xx.c +4 -0
index 0ee07ad299d7..e95640a39b0a 100644
@@ -12,6 +12,7 @@
   #include <dm.h>
   #include <errno.h>
   #include <log.h>
+#include <linux/delay.h>
   #include <power/rk8xx_pmic.h>
   #include <power/pmic.h>
   #include <power/regulator.h>
@@ -616,6 +617,9 @@ static int _ldo_set_enable(struct udevice *pmic, int ldo, bool enable)
   		break;
   	}
 
+	if (enable)
+		udelay(500);
+
   	return ret;
   }
 
Signature · 14 lines
张晴
瑞芯微电子股份有限公司
Rockchip Electronics Co.,Ltd
地址:福建省福州市铜盘路软件大道89号软件园A区21号楼
Add:No.21 Building, A District, No.89 Software Boulevard Fuzhou, Fujian 350003, P.R.China
Tel:+86-0591-83991906-8601
邮编:350003
E-mail:[email protected]
****************************************************************************
保密提示:本邮件及其附件含有机密信息,仅发送给本邮件所指特定收件人。若非该特定收件人,请勿复制、使用或披露本邮件的任何内容。若误收本邮件,请从系统中永久性删除本邮件及所有附件,并以回复邮件或其他方式即刻告知发件人。福州瑞芯微电子有限公司拥有本邮件信息的著作权及解释权,禁止任何未经授权许可的侵权行为。

IMPORTANT NOTICE: This email is from Fuzhou Rockchip Electronics Co., Ltd .The contents of this email and any attachments may contain information that is privileged, confidential and/or exempt from disclosure under applicable law and relevant NDA. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information is STRICTLY PROHIBITED. Please immediately contact the sender as soon as possible and destroy the material in its entirety in any format. Thank you.

****************************************************************************
Reviewed-by on v1 2/2
#8 lore raw
In reply to Jonas Karlman
Quoted 8 lines · Jonas Karlman

A quick power cycle of a LDO regulator during dw-mmc signal voltage change has shown that SD-card does not always get recognized.

Linux driver use an enable_time of 400us for LDO regulators. Apply a 500us delay when a LDO regulator is enabled to fix possible issues.

Fixes 94afc1cb466a ("power: regulator: rk8xx: update the driver for rk808 and rk818")

Thanks,
- Kever

Quoted 26 lines
---
  drivers/power/regulator/rk8xx.c | 4 ++++
  1 file changed, 4 insertions(+)
drivers/power/regulator/rk8xx.c +4 -0
index 0ee07ad299d7..e95640a39b0a 100644
@@ -12,6 +12,7 @@
  #include <dm.h>
  #include <errno.h>
  #include <log.h>
+#include <linux/delay.h>
  #include <power/rk8xx_pmic.h>
  #include <power/pmic.h>
  #include <power/regulator.h>
@@ -616,6 +617,9 @@ static int _ldo_set_enable(struct udevice *pmic, int ldo, bool enable)
  		break;
  	}
 
+	if (enable)
+		udelay(500);
+
  	return ret;
  }