linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: balajitk@ti.com (Balaji T K)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] ARM: OMAP4: MMC: increase delay for pbias
Date: Mon, 30 May 2011 19:55:33 +0530	[thread overview]
Message-ID: <1306765534-20103-2-git-send-email-balajitk@ti.com> (raw)
In-Reply-To: <1306765534-20103-1-git-send-email-balajitk@ti.com>

4 micro seconds is not enough for PBIAS if MMC regulator is
enabled from MMC regulator OFF.
Increase the delay for PBIAS to stabilize.
Wait for PBIAS and timeout if not.

Resolves MMC/SD failure on OMAP4
"Pbias Voltage is not same as LDO"

Signed-off-by: Balaji T K <balajitk@ti.com>
---
 arch/arm/mach-omap2/hsmmc.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
index b2f30be..3f8dc16 100644
--- a/arch/arm/mach-omap2/hsmmc.c
+++ b/arch/arm/mach-omap2/hsmmc.c
@@ -145,6 +145,7 @@ static void omap4_hsmmc1_after_set_reg(struct device *dev, int slot,
 				 int power_on, int vdd)
 {
 	u32 reg;
+	unsigned long timeout;
 
 	if (power_on) {
 		reg = omap4_ctrl_pad_readl(control_pbias_offset);
@@ -157,9 +158,15 @@ static void omap4_hsmmc1_after_set_reg(struct device *dev, int slot,
 			OMAP4_MMC1_PWRDNZ_MASK |
 			OMAP4_USBC1_ICUSB_PWRDNZ_MASK);
 		omap4_ctrl_pad_writel(reg, control_pbias_offset);
-		/* 4 microsec delay for comparator to generate an error*/
-		udelay(4);
-		reg = omap4_ctrl_pad_readl(control_pbias_offset);
+
+		timeout = jiffies + msecs_to_jiffies(5);
+		do {
+			reg = omap4_ctrl_pad_readl(control_pbias_offset);
+			if (!(reg & OMAP4_MMC1_PBIASLITE_VMODE_ERROR_MASK))
+				break;
+			udelay(100);
+		} while (!time_after(jiffies, timeout));
+
 		if (reg & OMAP4_MMC1_PBIASLITE_VMODE_ERROR_MASK) {
 			pr_err("Pbias Voltage is not same as LDO\n");
 			/* Caution : On VMODE_ERROR Power Down MMC IO */
-- 
1.7.0.4

  reply	other threads:[~2011-05-30 14:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-30 14:25 [PATCH 0/2] ARM: OMAP4: fix MMC failure due to regulator enable/disable ops Balaji T K
2011-05-30 14:25 ` Balaji T K [this message]
2011-05-31 13:28   ` [PATCH 1/2] ARM: OMAP4: MMC: increase delay for pbias Tony Lindgren
2011-05-31 14:04   ` Kishore Kadiyala
2011-06-01  7:41   ` Tony Lindgren
2011-06-01  9:18     ` T Krishnamoorthy, Balaji
2011-05-30 14:25 ` [PATCH 2/2] ARM: OMAP4: MMC: no regulator off during probe for eMMC Balaji T K
2011-05-31 13:26   ` Tony Lindgren
2011-05-31 13:32     ` T Krishnamoorthy, Balaji
2011-05-31 13:45       ` Tony Lindgren
2011-05-31 14:41   ` Kishore Kadiyala

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1306765534-20103-2-git-send-email-balajitk@ti.com \
    --to=balajitk@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).