All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC}  sdhci.c set_ios -- disable global interrupts and Question on Power Management
@ 2011-02-13  5:39 Philip Rakity
  2011-02-13 10:25 ` Pierre Tardy
  0 siblings, 1 reply; 14+ messages in thread
From: Philip Rakity @ 2011-02-13  5:39 UTC (permalink / raw)
  To: Pierre Tardy; +Cc: linux-mmc


Pierre,

I am preparing a patch to just diable to interrupt line to the SD controller so global interrupts are not locked out.  This
will allow mdelay to work correctly in the routines the set_ios() calls.

The pm_ calls  remove the lock before being called and restore it afterwards.  Is this just to ensure interrupts are globally
enabled ?  If so, I can simplify my patch deleting the original spin_lock calls that surround the pm_ calls.

Philip


>From 782c474f1abe992a203ad76594db025414332e67 Mon Sep 17 00:00:00 2001
From: Philip Rakity <prakity@marvell.com>
Date: Tue, 25 Jan 2011 16:04:42 -0800
Subject: [PATCH 1/2] sdhci: sdhci.c: Do not disable global interrupts while waiting in set_ios

holding the spin_lock with all interrupts disabled
is not good form when doing mdelay.
set_ios calls routines that need to delay for power to
stabalize or for chip issues when quirks are defined.

disable only our interupt and spin_lock on the chip
instead of spin_lock with all interrupts disabled.

Signed-off-by: Philip Rakity <prakity@marvell.com>
Signed-off-by: Mark F. Brown <markb@marvell.com>
---
 drivers/mmc/host/sdhci.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 655617c..1a88303 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1161,13 +1161,13 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq)
 static void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 {
 	struct sdhci_host *host;
-	unsigned long flags;
 	unsigned int lastclock;
 	u8 ctrl;
 
 	host = mmc_priv(mmc);
 
-	spin_lock_irqsave(&host->lock, flags);
+	disable_irq(host->irq);
+	spin_lock(&host->lock);
 
 	if (host->flags & SDHCI_DEVICE_DEAD)
 		goto out;
@@ -1180,14 +1180,14 @@ static void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 	lastclock = host->iosclock;
 	host->iosclock = ios->clock;
 	if (lastclock == 0 && ios->clock != 0) {
-		spin_unlock_irqrestore(&host->lock, flags);
+		spin_unlock(&host->lock);
 		pm_runtime_get_sync(host->mmc->parent);
-		spin_lock_irqsave(&host->lock, flags);
+		spin_lock(&host->lock);
 	} else if (lastclock != 0 && ios->clock == 0) {
-		spin_unlock_irqrestore(&host->lock, flags);
+		spin_unlock(&host->lock);
 		pm_runtime_mark_last_busy(host->mmc->parent);
 		pm_runtime_put_autosuspend(host->mmc->parent);
-		spin_lock_irqsave(&host->lock, flags);
+		spin_lock(&host->lock);
 	}
 	/* no need to configure the rest.. */
 	if (host->iosclock == 0)
@@ -1257,7 +1257,8 @@ static void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 
 out:
 	mmiowb();
-	spin_unlock_irqrestore(&host->lock, flags);
+	spin_unlock(&host->lock);
+	enable_irq(host->irq);
 }
 
 static int sdhci_get_ro(struct mmc_host *mmc)
-- 
1.7.0.4



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

end of thread, other threads:[~2011-02-15  9:13 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-13  5:39 [RFC} sdhci.c set_ios -- disable global interrupts and Question on Power Management Philip Rakity
2011-02-13 10:25 ` Pierre Tardy
2011-02-13 17:57   ` Philip Rakity
2011-02-14  5:50     ` Philip Rakity
2011-02-14  9:29       ` Pierre Tardy
2011-02-14  9:55         ` Wolfram Sang
2011-02-14 17:27           ` Philip Rakity
2011-02-15  9:13             ` Wolfram Sang
2011-02-14 18:34         ` Philip Rakity
2011-02-14 18:41           ` Tardy, Pierre
2011-02-14 20:17             ` Philip Rakity
2011-02-14 20:44             ` Philip Rakity
2011-02-15  8:39             ` Wolfram Sang
2011-02-15  3:09         ` Philip Rakity

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.