linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] ARM: OMAP4: fix MMC failure due to regulator enable/disable ops
@ 2011-05-30 14:25 Balaji T K
  2011-05-30 14:25 ` [PATCH 1/2] ARM: OMAP4: MMC: increase delay for pbias Balaji T K
  2011-05-30 14:25 ` [PATCH 2/2] ARM: OMAP4: MMC: no regulator off during probe for eMMC Balaji T K
  0 siblings, 2 replies; 11+ messages in thread
From: Balaji T K @ 2011-05-30 14:25 UTC (permalink / raw)
  To: linux-arm-kernel

Balaji T K (2):
  ARM: OMAP4: MMC: increase delay for pbias
  ARM: OMAP4: MMC: no regulator off during probe for eMMC

 arch/arm/mach-omap2/board-4430sdp.c   |    1 +
 arch/arm/mach-omap2/hsmmc.c           |   16 +++++++++++++---
 arch/arm/mach-omap2/hsmmc.h           |    1 +
 arch/arm/plat-omap/include/plat/mmc.h |    3 +++
 drivers/mmc/host/omap_hsmmc.c         |    3 +++
 5 files changed, 21 insertions(+), 3 deletions(-)

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/2] ARM: OMAP4: MMC: increase delay for pbias
  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
  2011-05-31 13:28   ` Tony Lindgren
                     ` (2 more replies)
  2011-05-30 14:25 ` [PATCH 2/2] ARM: OMAP4: MMC: no regulator off during probe for eMMC Balaji T K
  1 sibling, 3 replies; 11+ messages in thread
From: Balaji T K @ 2011-05-30 14:25 UTC (permalink / raw)
  To: linux-arm-kernel

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

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/2] ARM: OMAP4: MMC: no regulator off during probe for eMMC
  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 ` [PATCH 1/2] ARM: OMAP4: MMC: increase delay for pbias Balaji T K
@ 2011-05-30 14:25 ` Balaji T K
  2011-05-31 13:26   ` Tony Lindgren
  2011-05-31 14:41   ` Kishore Kadiyala
  1 sibling, 2 replies; 11+ messages in thread
From: Balaji T K @ 2011-05-30 14:25 UTC (permalink / raw)
  To: linux-arm-kernel

eMMC does not handle power off when not in sleep state,
Skip regulator disable during probe when eMMC is
not in known state - state left by bootloader.

Resolves eMMC failure on OMAP4
mmc0: error -110 whilst initialising MMC card

Signed-off-by: Balaji T K <balajitk@ti.com>
---
 arch/arm/mach-omap2/board-4430sdp.c   |    1 +
 arch/arm/mach-omap2/hsmmc.c           |    3 +++
 arch/arm/mach-omap2/hsmmc.h           |    1 +
 arch/arm/plat-omap/include/plat/mmc.h |    3 +++
 drivers/mmc/host/omap_hsmmc.c         |    3 +++
 5 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index 73fa90b..b324605 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -322,6 +322,7 @@ static struct omap2_hsmmc_info mmc[] = {
 		.gpio_wp	= -EINVAL,
 		.nonremovable   = true,
 		.ocr_mask	= MMC_VDD_29_30,
+		.no_off_init	= true,
 	},
 	{
 		.mmc		= 1,
diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
index 3f8dc16..28ca144 100644
--- a/arch/arm/mach-omap2/hsmmc.c
+++ b/arch/arm/mach-omap2/hsmmc.c
@@ -338,6 +338,9 @@ static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c,
 	if (c->no_off)
 		mmc->slots[0].no_off = 1;
 
+	if (c->no_off_init)
+		mmc->slots[0].no_regulator_off_init = c->no_off_init;
+
 	if (c->vcc_aux_disable_is_sleep)
 		mmc->slots[0].vcc_aux_disable_is_sleep = 1;
 
diff --git a/arch/arm/mach-omap2/hsmmc.h b/arch/arm/mach-omap2/hsmmc.h
index f119348..f757e78 100644
--- a/arch/arm/mach-omap2/hsmmc.h
+++ b/arch/arm/mach-omap2/hsmmc.h
@@ -18,6 +18,7 @@ struct omap2_hsmmc_info {
 	bool	nonremovable;	/* Nonremovable e.g. eMMC */
 	bool	power_saving;	/* Try to sleep or power off when possible */
 	bool	no_off;		/* power_saving and power is not to go off */
+	bool	no_off_init;	/* no power off when not in MMC sleep state */
 	bool	vcc_aux_disable_is_sleep; /* Regulator off remapped to sleep */
 	int	gpio_cd;	/* or -EINVAL */
 	int	gpio_wp;	/* or -EINVAL */
diff --git a/arch/arm/plat-omap/include/plat/mmc.h b/arch/arm/plat-omap/include/plat/mmc.h
index f38fef9..c7b8741 100644
--- a/arch/arm/plat-omap/include/plat/mmc.h
+++ b/arch/arm/plat-omap/include/plat/mmc.h
@@ -101,6 +101,9 @@ struct omap_mmc_platform_data {
 		/* If using power_saving and the MMC power is not to go off */
 		unsigned no_off:1;
 
+		/* eMMC does not handle power off when not in sleep state */
+		unsigned no_regulator_off_init:1;
+
 		/* Regulator off remapped to sleep */
 		unsigned vcc_aux_disable_is_sleep:1;
 
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 259ece0..5b2e215 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -435,6 +435,9 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
 		reg = regulator_get(host->dev, "vmmc_aux");
 		host->vcc_aux = IS_ERR(reg) ? NULL : reg;
 
+		/* For eMMC do not power off when not in sleep state */
+		if (mmc_slot(host).no_regulator_off_init)
+			return 0;
 		/*
 		* UGLY HACK:  workaround regulator framework bugs.
 		* When the bootloader leaves a supply active, it's
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/2] ARM: OMAP4: MMC: no regulator off during probe for eMMC
  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 14:41   ` Kishore Kadiyala
  1 sibling, 1 reply; 11+ messages in thread
From: Tony Lindgren @ 2011-05-31 13:26 UTC (permalink / raw)
  To: linux-arm-kernel

* Balaji T K <balajitk@ti.com> [110530 07:23]:
> eMMC does not handle power off when not in sleep state,
> Skip regulator disable during probe when eMMC is
> not in known state - state left by bootloader.
> 
> Resolves eMMC failure on OMAP4
> mmc0: error -110 whilst initialising MMC card
> 
> --- a/arch/arm/mach-omap2/hsmmc.h
> +++ b/arch/arm/mach-omap2/hsmmc.h
> @@ -18,6 +18,7 @@ struct omap2_hsmmc_info {
>  	bool	nonremovable;	/* Nonremovable e.g. eMMC */
>  	bool	power_saving;	/* Try to sleep or power off when possible */
>  	bool	no_off;		/* power_saving and power is not to go off */
> +	bool	no_off_init;	/* no power off when not in MMC sleep state */
>  	bool	vcc_aux_disable_is_sleep; /* Regulator off remapped to sleep */
>  	int	gpio_cd;	/* or -EINVAL */
>  	int	gpio_wp;	/* or -EINVAL */

Can't you use no_off for this too?

Tony

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/2] ARM: OMAP4: MMC: increase delay for pbias
  2011-05-30 14:25 ` [PATCH 1/2] ARM: OMAP4: MMC: increase delay for pbias Balaji T K
@ 2011-05-31 13:28   ` Tony Lindgren
  2011-05-31 14:04   ` Kishore Kadiyala
  2011-06-01  7:41   ` Tony Lindgren
  2 siblings, 0 replies; 11+ messages in thread
From: Tony Lindgren @ 2011-05-31 13:28 UTC (permalink / raw)
  To: linux-arm-kernel

* Balaji T K <balajitk@ti.com> [110530 07:23]:
> 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"

Thanks will queue as a fix.

Tony

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 2/2] ARM: OMAP4: MMC: no regulator off during probe for eMMC
  2011-05-31 13:26   ` Tony Lindgren
@ 2011-05-31 13:32     ` T Krishnamoorthy, Balaji
  2011-05-31 13:45       ` Tony Lindgren
  0 siblings, 1 reply; 11+ messages in thread
From: T Krishnamoorthy, Balaji @ 2011-05-31 13:32 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, May 31, 2011 at 6:56 PM, Tony Lindgren <tony@atomide.com> wrote:
> * Balaji T K <balajitk@ti.com> [110530 07:23]:
>> eMMC does not handle power off when not in sleep state,
>> Skip regulator disable during probe when eMMC is
>> not in known state - state left by bootloader.
>>
>> Resolves eMMC failure on OMAP4
>> mmc0: error -110 whilst initialising MMC card
>>
>> --- a/arch/arm/mach-omap2/hsmmc.h
>> +++ b/arch/arm/mach-omap2/hsmmc.h
>> @@ -18,6 +18,7 @@ struct omap2_hsmmc_info {
>> ? ? ? bool ? ?nonremovable; ? /* Nonremovable e.g. eMMC */
>> ? ? ? bool ? ?power_saving; ? /* Try to sleep or power off when possible */
>> ? ? ? bool ? ?no_off; ? ? ? ? /* power_saving and power is not to go off */
>> + ? ? bool ? ?no_off_init; ? ?/* no power off when not in MMC sleep state */
>> ? ? ? bool ? ?vcc_aux_disable_is_sleep; /* Regulator off remapped to sleep */
>> ? ? ? int ? ? gpio_cd; ? ? ? ?/* or -EINVAL */
>> ? ? ? int ? ? gpio_wp; ? ? ? ?/* or -EINVAL */
>
> Can't you use no_off for this too?

no_off is used for devices which do not want to disable regulator at any time.

newly introduced no_off_init is to skip disable regulator only during probe
After eMMC is put in sleep state (while suspend), regulator for eMMC
(VAUX1) can be disabled.

-- 
Thanks and Regards,
Balaji T K

>
> Tony
>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 2/2] ARM: OMAP4: MMC: no regulator off during probe for eMMC
  2011-05-31 13:32     ` T Krishnamoorthy, Balaji
@ 2011-05-31 13:45       ` Tony Lindgren
  0 siblings, 0 replies; 11+ messages in thread
From: Tony Lindgren @ 2011-05-31 13:45 UTC (permalink / raw)
  To: linux-arm-kernel

* T Krishnamoorthy, Balaji <balajitk@ti.com> [110531 06:28]:
> On Tue, May 31, 2011 at 6:56 PM, Tony Lindgren <tony@atomide.com> wrote:
> > * Balaji T K <balajitk@ti.com> [110530 07:23]:
> >> eMMC does not handle power off when not in sleep state,
> >> Skip regulator disable during probe when eMMC is
> >> not in known state - state left by bootloader.
> >>
> >> Resolves eMMC failure on OMAP4
> >> mmc0: error -110 whilst initialising MMC card
> >>
> >> --- a/arch/arm/mach-omap2/hsmmc.h
> >> +++ b/arch/arm/mach-omap2/hsmmc.h
> >> @@ -18,6 +18,7 @@ struct omap2_hsmmc_info {
> >> ? ? ? bool ? ?nonremovable; ? /* Nonremovable e.g. eMMC */
> >> ? ? ? bool ? ?power_saving; ? /* Try to sleep or power off when possible */
> >> ? ? ? bool ? ?no_off; ? ? ? ? /* power_saving and power is not to go off */
> >> + ? ? bool ? ?no_off_init; ? ?/* no power off when not in MMC sleep state */
> >> ? ? ? bool ? ?vcc_aux_disable_is_sleep; /* Regulator off remapped to sleep */
> >> ? ? ? int ? ? gpio_cd; ? ? ? ?/* or -EINVAL */
> >> ? ? ? int ? ? gpio_wp; ? ? ? ?/* or -EINVAL */
> >
> > Can't you use no_off for this too?
> 
> no_off is used for devices which do not want to disable regulator at any time.
> 
> newly introduced no_off_init is to skip disable regulator only during probe
> After eMMC is put in sleep state (while suspend), regulator for eMMC
> (VAUX1) can be disabled.

OK I'll queue this as a fix too then. Anybody from the MMC list care
to ack?

Tony

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/2] ARM: OMAP4: MMC: increase delay for pbias
  2011-05-30 14:25 ` [PATCH 1/2] ARM: OMAP4: MMC: increase delay for pbias Balaji T K
  2011-05-31 13:28   ` Tony Lindgren
@ 2011-05-31 14:04   ` Kishore Kadiyala
  2011-06-01  7:41   ` Tony Lindgren
  2 siblings, 0 replies; 11+ messages in thread
From: Kishore Kadiyala @ 2011-05-31 14:04 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, May 30, 2011 at 7:55 PM, Balaji T K <balajitk@ti.com> wrote:
> 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>

Acked-by:  Kishore Kadiyala <kishore.kadiyala@ti.com>

<snip>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 2/2] ARM: OMAP4: MMC: no regulator off during probe for eMMC
  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 14:41   ` Kishore Kadiyala
  1 sibling, 0 replies; 11+ messages in thread
From: Kishore Kadiyala @ 2011-05-31 14:41 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, May 30, 2011 at 7:55 PM, Balaji T K <balajitk@ti.com> wrote:
> eMMC does not handle power off when not in sleep state,
> Skip regulator disable during probe when eMMC is
> not in known state - state left by bootloader.
>
> Resolves eMMC failure on OMAP4
> mmc0: error -110 whilst initialising MMC card
>
> Signed-off-by: Balaji T K <balajitk@ti.com>

Tested-by:  Kishore Kadiyala <kishore.kadiyala@ti.com>
Acked-by:  Kishore Kadiyala <kishore.kadiyala@ti.com>

> ---
> ?arch/arm/mach-omap2/board-4430sdp.c ? | ? ?1 +
> ?arch/arm/mach-omap2/hsmmc.c ? ? ? ? ? | ? ?3 +++
> ?arch/arm/mach-omap2/hsmmc.h ? ? ? ? ? | ? ?1 +
> ?arch/arm/plat-omap/include/plat/mmc.h | ? ?3 +++
> ?drivers/mmc/host/omap_hsmmc.c ? ? ? ? | ? ?3 +++
> ?5 files changed, 11 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
> index 73fa90b..b324605 100644
> --- a/arch/arm/mach-omap2/board-4430sdp.c
> +++ b/arch/arm/mach-omap2/board-4430sdp.c
> @@ -322,6 +322,7 @@ static struct omap2_hsmmc_info mmc[] = {
> ? ? ? ? ? ? ? ?.gpio_wp ? ? ? ?= -EINVAL,
> ? ? ? ? ? ? ? ?.nonremovable ? = true,
> ? ? ? ? ? ? ? ?.ocr_mask ? ? ? = MMC_VDD_29_30,
> + ? ? ? ? ? ? ? .no_off_init ? ?= true,
> ? ? ? ?},
> ? ? ? ?{
> ? ? ? ? ? ? ? ?.mmc ? ? ? ? ? ?= 1,
> diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
> index 3f8dc16..28ca144 100644
> --- a/arch/arm/mach-omap2/hsmmc.c
> +++ b/arch/arm/mach-omap2/hsmmc.c
> @@ -338,6 +338,9 @@ static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c,
> ? ? ? ?if (c->no_off)
> ? ? ? ? ? ? ? ?mmc->slots[0].no_off = 1;
>
> + ? ? ? if (c->no_off_init)
> + ? ? ? ? ? ? ? mmc->slots[0].no_regulator_off_init = c->no_off_init;
> +
> ? ? ? ?if (c->vcc_aux_disable_is_sleep)
> ? ? ? ? ? ? ? ?mmc->slots[0].vcc_aux_disable_is_sleep = 1;
>
> diff --git a/arch/arm/mach-omap2/hsmmc.h b/arch/arm/mach-omap2/hsmmc.h
> index f119348..f757e78 100644
> --- a/arch/arm/mach-omap2/hsmmc.h
> +++ b/arch/arm/mach-omap2/hsmmc.h
> @@ -18,6 +18,7 @@ struct omap2_hsmmc_info {
> ? ? ? ?bool ? ?nonremovable; ? /* Nonremovable e.g. eMMC */
> ? ? ? ?bool ? ?power_saving; ? /* Try to sleep or power off when possible */
> ? ? ? ?bool ? ?no_off; ? ? ? ? /* power_saving and power is not to go off */
> + ? ? ? bool ? ?no_off_init; ? ?/* no power off when not in MMC sleep state */
> ? ? ? ?bool ? ?vcc_aux_disable_is_sleep; /* Regulator off remapped to sleep */
> ? ? ? ?int ? ? gpio_cd; ? ? ? ?/* or -EINVAL */
> ? ? ? ?int ? ? gpio_wp; ? ? ? ?/* or -EINVAL */
> diff --git a/arch/arm/plat-omap/include/plat/mmc.h b/arch/arm/plat-omap/include/plat/mmc.h
> index f38fef9..c7b8741 100644
> --- a/arch/arm/plat-omap/include/plat/mmc.h
> +++ b/arch/arm/plat-omap/include/plat/mmc.h
> @@ -101,6 +101,9 @@ struct omap_mmc_platform_data {
> ? ? ? ? ? ? ? ?/* If using power_saving and the MMC power is not to go off */
> ? ? ? ? ? ? ? ?unsigned no_off:1;
>
> + ? ? ? ? ? ? ? /* eMMC does not handle power off when not in sleep state */
> + ? ? ? ? ? ? ? unsigned no_regulator_off_init:1;
> +
> ? ? ? ? ? ? ? ?/* Regulator off remapped to sleep */
> ? ? ? ? ? ? ? ?unsigned vcc_aux_disable_is_sleep:1;
>
> diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
> index 259ece0..5b2e215 100644
> --- a/drivers/mmc/host/omap_hsmmc.c
> +++ b/drivers/mmc/host/omap_hsmmc.c
> @@ -435,6 +435,9 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
> ? ? ? ? ? ? ? ?reg = regulator_get(host->dev, "vmmc_aux");
> ? ? ? ? ? ? ? ?host->vcc_aux = IS_ERR(reg) ? NULL : reg;
>
> + ? ? ? ? ? ? ? /* For eMMC do not power off when not in sleep state */
> + ? ? ? ? ? ? ? if (mmc_slot(host).no_regulator_off_init)
> + ? ? ? ? ? ? ? ? ? ? ? return 0;
> ? ? ? ? ? ? ? ?/*
> ? ? ? ? ? ? ? ?* UGLY HACK: ?workaround regulator framework bugs.
> ? ? ? ? ? ? ? ?* When the bootloader leaves a supply active, it's
> --
> 1.7.0.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at ?http://vger.kernel.org/majordomo-info.html
>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/2] ARM: OMAP4: MMC: increase delay for pbias
  2011-05-30 14:25 ` [PATCH 1/2] ARM: OMAP4: MMC: increase delay for pbias Balaji T K
  2011-05-31 13:28   ` Tony Lindgren
  2011-05-31 14:04   ` Kishore Kadiyala
@ 2011-06-01  7:41   ` Tony Lindgren
  2011-06-01  9:18     ` T Krishnamoorthy, Balaji
  2 siblings, 1 reply; 11+ messages in thread
From: Tony Lindgren @ 2011-06-01  7:41 UTC (permalink / raw)
  To: linux-arm-kernel

* Balaji T K <balajitk@ti.com> [110530 07:23]:
> 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 */

Actually, can you check if you can use usleep_range here as recommended
by checkpatch.pl?

Tony

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/2] ARM: OMAP4: MMC: increase delay for pbias
  2011-06-01  7:41   ` Tony Lindgren
@ 2011-06-01  9:18     ` T Krishnamoorthy, Balaji
  0 siblings, 0 replies; 11+ messages in thread
From: T Krishnamoorthy, Balaji @ 2011-06-01  9:18 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Jun 1, 2011 at 1:11 PM, Tony Lindgren <tony@atomide.com> wrote:
> * Balaji T K <balajitk@ti.com> [110530 07:23]:
>> 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 */
>
> Actually, can you check if you can use usleep_range here as recommended
> by checkpatch.pl?

sure, fixing it in v2

>
> Tony
>

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2011-06-01  9:18 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH 1/2] ARM: OMAP4: MMC: increase delay for pbias Balaji T K
2011-05-31 13:28   ` 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

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).