[PATCH] mmc: queue: exclude asynchronous transfer for special request

2012-12-20 Thread Seungwon Jeon
Unlike normal r/w request, special requests(discard, flush)
is finished with a one-time issue_fn. Request change to
mqrq_prev makes unnecessary call.

Signed-off-by: Seungwon Jeon tgih@samsung.com
---
 drivers/mmc/card/queue.c |8 
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c
index fadf52e..a71db7a 100644
--- a/drivers/mmc/card/queue.c
+++ b/drivers/mmc/card/queue.c
@@ -58,6 +58,7 @@ static int mmc_queue_thread(void *d)
do {
struct request *req = NULL;
struct mmc_queue_req *tmp;
+   unsigned int cmd_flags = 0;
 
spin_lock_irq(q-queue_lock);
set_current_state(TASK_INTERRUPTIBLE);
@@ -67,12 +68,19 @@ static int mmc_queue_thread(void *d)
 
if (req || mq-mqrq_prev-req) {
set_current_state(TASK_RUNNING);
+   cmd_flags = req ? req-cmd_flags : 0;
mq-issue_fn(mq, req);
 
/*
 * Current request becomes previous request
 * and vice versa.
+* In case of special requests, current request
+* has been finished. Do not remain it to previous
+* request.
 */
+   if (cmd_flags  REQ_DISCARD || cmd_flags  REQ_FLUSH)
+   mq-mqrq_cur-req = NULL;
+
mq-mqrq_prev-brq.mrq.data = NULL;
mq-mqrq_prev-req = NULL;
tmp = mq-mqrq_prev;
-- 
1.7.0.4


--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] mmc: sdhci: add pm runtime protection

2012-12-20 Thread Kevin Liu
Added pm runtime protection for suspend/resume and add/remove functions.
When these functions called, pm runtime may have suspended.

Signed-off-by: Jialing Fu j...@marvell.com
Signed-off-by: Kevin Liu kl...@marvell.com
---
 drivers/mmc/host/sdhci.c |   22 ++
 1 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 6f0bfc0..ec7da59 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2460,6 +2460,7 @@ int sdhci_suspend_host(struct sdhci_host *host)
 {
int ret;
 
+   sdhci_runtime_pm_get(host);
if (host-ops-platform_suspend)
host-ops-platform_suspend(host);
 
@@ -2480,12 +2481,13 @@ int sdhci_suspend_host(struct sdhci_host *host)
}
 
sdhci_enable_card_detection(host);
-
+   sdhci_runtime_pm_put(host);
return ret;
}
 
free_irq(host-irq, host);
 
+   sdhci_runtime_pm_put(host);
return ret;
 }
 
@@ -2495,6 +2497,7 @@ int sdhci_resume_host(struct sdhci_host *host)
 {
int ret;
 
+   sdhci_runtime_pm_get(host);
if (host-flags  (SDHCI_USE_SDMA | SDHCI_USE_ADMA)) {
if (host-ops-enable_dma)
host-ops-enable_dma(host);
@@ -2502,8 +2505,10 @@ int sdhci_resume_host(struct sdhci_host *host)
 
ret = request_irq(host-irq, sdhci_irq, IRQF_SHARED,
  mmc_hostname(host-mmc), host);
-   if (ret)
+   if (ret) {
+   sdhci_runtime_pm_put(host);
return ret;
+   }
 
if ((host-mmc-pm_flags  MMC_PM_KEEP_POWER) 
(host-quirks2  SDHCI_QUIRK2_HOST_OFF_CARD_ON)) {
@@ -2527,6 +2532,7 @@ int sdhci_resume_host(struct sdhci_host *host)
if (host-flags  SDHCI_USING_RETUNING_TIMER)
host-flags |= SDHCI_NEEDS_RETUNING;
 
+   sdhci_runtime_pm_put(host);
return ret;
 }
 
@@ -2664,6 +2670,7 @@ int sdhci_add_host(struct sdhci_host *host)
if (host == NULL)
return -EINVAL;
 
+   sdhci_runtime_pm_get(host);
mmc = host-mmc;
 
if (debug_quirks)
@@ -2766,6 +2773,7 @@ int sdhci_add_host(struct sdhci_host *host)
if (!host-ops-get_max_clock) {
pr_err(%s: Hardware doesn't specify base clock 
   frequency.\n, mmc_hostname(mmc));
+   sdhci_runtime_pm_put(host);
return -ENODEV;
}
host-max_clk = host-ops-get_max_clock(host);
@@ -2812,6 +2820,7 @@ int sdhci_add_host(struct sdhci_host *host)
SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK)) {
pr_err(%s: Hardware doesn't specify timeout clock 
   frequency.\n, mmc_hostname(mmc));
+   sdhci_runtime_pm_put(host);
return -ENODEV;
}
}
@@ -3015,6 +3024,7 @@ int sdhci_add_host(struct sdhci_host *host)
if (mmc-ocr_avail == 0) {
pr_err(%s: Hardware doesn't report any 
support voltages.\n, mmc_hostname(mmc));
+   sdhci_runtime_pm_put(host);
return -ENODEV;
}
 
@@ -3133,7 +3143,7 @@ int sdhci_add_host(struct sdhci_host *host)
(host-flags  SDHCI_USE_SDMA) ? DMA : PIO);
 
sdhci_enable_card_detection(host);
-
+   sdhci_runtime_pm_put(host);
return 0;
 
 #ifdef SDHCI_USE_LEDS_CLASS
@@ -3144,7 +3154,7 @@ reset:
 untasklet:
tasklet_kill(host-card_tasklet);
tasklet_kill(host-finish_tasklet);
-
+   sdhci_runtime_pm_put(host);
return ret;
 }
 
@@ -3154,6 +3164,8 @@ void sdhci_remove_host(struct sdhci_host *host, int dead)
 {
unsigned long flags;
 
+   sdhci_runtime_pm_get(host);
+
if (dead) {
spin_lock_irqsave(host-lock, flags);
 
@@ -3203,6 +3215,8 @@ void sdhci_remove_host(struct sdhci_host *host, int dead)
 
host-adma_desc = NULL;
host-align_buffer = NULL;
+
+   sdhci_runtime_pm_put(host);
 }
 
 EXPORT_SYMBOL_GPL(sdhci_remove_host);
-- 
1.7.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] mmc: sdhci-pxav3: add pm runtime support

2012-12-20 Thread Kevin Liu
Signed-off-by: Jialing Fu j...@marvell.com
Signed-off-by: Kevin Liu kl...@marvell.com
---
 drivers/mmc/host/sdhci-pxav3.c |   89 ++-
 1 files changed, 86 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c
index fad0966..ba3a524 100644
--- a/drivers/mmc/host/sdhci-pxav3.c
+++ b/drivers/mmc/host/sdhci-pxav3.c
@@ -32,10 +32,15 @@
 #include linux/of.h
 #include linux/of_device.h
 #include linux/of_gpio.h
+#include linux/pm.h
+#include linux/pm_runtime.h
+#include plat/pm.h
 
 #include sdhci.h
 #include sdhci-pltfm.h
 
+#define PXAV3_RPM_DELAY_MS 50
+
 #define SD_CLOCK_BURST_SIZE_SETUP  0x10A
 #define SDCLK_SEL  0x100
 #define SDCLK_DELAY_SHIFT  9
@@ -253,8 +258,9 @@ static int sdhci_pxav3_probe(struct platform_device *pdev)
goto err_clk_get;
}
pltfm_host-clk = clk;
+#ifndef CONFIG_PM_RUNTIME
clk_prepare_enable(clk);
-
+#endif
host-quirks = SDHCI_QUIRK_BROKEN_TIMEOUT_VAL
| SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC
| SDHCI_QUIRK_32BIT_ADMA_SIZE
@@ -303,9 +309,17 @@ static int sdhci_pxav3_probe(struct platform_device *pdev)
 
sdhci_get_of_property(pdev);
 
+   pm_runtime_enable(pdev-dev);
+   pm_runtime_set_autosuspend_delay(pdev-dev,
+   PXAV3_RPM_DELAY_MS);
+   pm_runtime_use_autosuspend(pdev-dev);
+   pm_suspend_ignore_children(pdev-dev, 1);
+
ret = sdhci_add_host(host);
if (ret) {
dev_err(pdev-dev, failed to add host\n);
+   pm_runtime_forbid(pdev-dev);
+   pm_runtime_get_noresume(pdev-dev);
goto err_add_host;
}
 
@@ -314,7 +328,9 @@ static int sdhci_pxav3_probe(struct platform_device *pdev)
return 0;
 
 err_add_host:
+#ifndef CONFIG_PM_RUNTIME
clk_disable_unprepare(clk);
+#endif
clk_put(clk);
mmc_gpio_free_cd(host-mmc);
 err_cd_req:
@@ -332,8 +348,10 @@ static int sdhci_pxav3_remove(struct platform_device *pdev)
struct sdhci_pxa_platdata *pdata = pdev-dev.platform_data;
 
sdhci_remove_host(host, 1);
-
+   pm_runtime_disable(pdev-dev);
+#ifndef CONFIG_PM_RUNTIME
clk_disable_unprepare(pltfm_host-clk);
+#endif
clk_put(pltfm_host-clk);
 
if (gpio_is_valid(pdata-ext_cd_gpio))
@@ -347,6 +365,71 @@ static int sdhci_pxav3_remove(struct platform_device *pdev)
return 0;
 }
 
+#ifdef CONFIG_PM_SLEEP
+static int sdhci_pxav3_suspend(struct device *dev)
+{
+   struct sdhci_host *host = dev_get_drvdata(dev);
+
+   return sdhci_suspend_host(host);
+}
+
+static int sdhci_pxav3_resume(struct device *dev)
+{
+   struct sdhci_host *host = dev_get_drvdata(dev);
+
+   return sdhci_resume_host(host);
+}
+#endif
+
+#ifdef CONFIG_PM_RUNTIME
+static int sdhci_pxav3_runtime_suspend(struct device *dev)
+{
+   struct sdhci_host *host = dev_get_drvdata(dev);
+   struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+   unsigned long flags;
+
+   if (pltfm_host-clk) {
+   spin_lock_irqsave(host-lock, flags);
+   host-runtime_suspended = true;
+   spin_unlock_irqrestore(host-lock, flags);
+
+   clk_disable_unprepare(pltfm_host-clk);
+   }
+
+   return 0;
+}
+
+static int sdhci_pxav3_runtime_resume(struct device *dev)
+{
+   struct sdhci_host *host = dev_get_drvdata(dev);
+   struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+   unsigned long flags;
+
+   if (pltfm_host-clk) {
+   clk_prepare_enable(pltfm_host-clk);
+
+   spin_lock_irqsave(host-lock, flags);
+   host-runtime_suspended = false;
+   spin_unlock_irqrestore(host-lock, flags);
+   }
+
+   return 0;
+}
+#endif
+
+#ifdef CONFIG_PM
+static const struct dev_pm_ops sdhci_pxav3_pmops = {
+   SET_SYSTEM_SLEEP_PM_OPS(sdhci_pxav3_suspend, sdhci_pxav3_resume)
+   SET_RUNTIME_PM_OPS(sdhci_pxav3_runtime_suspend,
+   sdhci_pxav3_runtime_resume, NULL)
+};
+
+#define SDHCI_PXAV3_PMOPS (sdhci_pxav3_pmops)
+
+#else
+#define SDHCI_PXAV3_PMOPS NULL
+#endif
+
 static struct platform_driver sdhci_pxav3_driver = {
.driver = {
.name   = sdhci-pxav3,
@@ -354,7 +437,7 @@ static struct platform_driver sdhci_pxav3_driver = {
.of_match_table = sdhci_pxav3_of_match,
 #endif
.owner  = THIS_MODULE,
-   .pm = SDHCI_PLTFM_PMOPS,
+   .pm = SDHCI_PXAV3_PMOPS,
},
.probe  = sdhci_pxav3_probe,
.remove = sdhci_pxav3_remove,
-- 
1.7.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] mmc: queue: exclude asynchronous transfer for special request

2012-12-20 Thread Konstantin Dorfman

Hello Jeon,


On 12/20/2012 12:27 PM, Seungwon Jeon wrote:

Unlike normal r/w request, special requests(discard, flush)
is finished with a one-time issue_fn. Request change to
mqrq_prev makes unnecessary call.

Signed-off-by: Seungwon Jeon tgih@samsung.com
---
  drivers/mmc/card/queue.c |8 
  1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c
index fadf52e..a71db7a 100644
--- a/drivers/mmc/card/queue.c
+++ b/drivers/mmc/card/queue.c
@@ -58,6 +58,7 @@ static int mmc_queue_thread(void *d)
do {
struct request *req = NULL;
struct mmc_queue_req *tmp;
+   unsigned int cmd_flags = 0;

spin_lock_irq(q-queue_lock);
set_current_state(TASK_INTERRUPTIBLE);
@@ -67,12 +68,19 @@ static int mmc_queue_thread(void *d)

if (req || mq-mqrq_prev-req) {
set_current_state(TASK_RUNNING);
+   cmd_flags = req ? req-cmd_flags : 0;
mq-issue_fn(mq, req);

/*
 * Current request becomes previous request
 * and vice versa.
+* In case of special requests, current request
+* has been finished. Do not remain it to previous
+* request.
 */
+   if (cmd_flags  REQ_DISCARD || cmd_flags  REQ_FLUSH)
+   mq-mqrq_cur-req = NULL;
+
mq-mqrq_prev-brq.mrq.data = NULL;
mq-mqrq_prev-req = NULL;
tmp = mq-mqrq_prev;


It is better to define control mask, REQ_CONTROL_MASK, which will
include all control/special requests.

Then, when additional request will be added, there will be no need to
change here, only update the mask.

Another option - to clean mq-mqrq_cur-req immediately after executing
a special request in mmc_blk_issue_rq().


--
Konstantin Dorfman,
QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center,
Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] mmc:core:if detect mmc card remove,don't wait for req done

2012-12-20 Thread Linus Torvalds
Hi,

On Thu, Dec 20, 2012 at 1:32 AM,  zhenpeng.q...@tieto.com wrote:

 I find a bug about mmc/core/core.c, and send you a patch which I fix
 this bug.

 In fact, the bug is a low probability of occurrence.

 Hope you help me to analyze it and discuss with me.

I've added the proper people - Chris Ball and linux-mmc - to the
participants list.

I also wanted to check with you: the commit message implies that this
can cause an IO timeout and then a call to
msmsdcc_start_command_deferred() with a NULL cmd-mrq. Which I assume
results in a NULL pointer dereference and Oops, but that wasn't
spelled out.

Chris, please give it a look, and perhaps edit the commit message a bit.

 Linus


0001-mmc-core.patch
Description: Binary data


[PATCH] mmc: omap_hsmmc: correct precedence of operators

2012-12-20 Thread Sasha Levin
With the current code, the condition in the if() doesn't make much sense due to
precedence of operators.

Signed-off-by: Sasha Levin sasha.le...@oracle.com
---
 drivers/mmc/host/omap_hsmmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index bc58078..3ee2664 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -611,7 +611,7 @@ static int omap_hsmmc_context_restore(struct 
omap_hsmmc_host *host)
if (host-context_loss == context_loss)
return 1;
 
-   if (!OMAP_HSMMC_READ(host-base, SYSSTATUS)  RESETDONE)
+   if (!(OMAP_HSMMC_READ(host-base, SYSSTATUS)  RESETDONE))
return 1;
 
if (host-pdata-controller_flags  OMAP_HSMMC_SUPPORTS_DUAL_VOLT) {
-- 
1.8.0

--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] mmc: omap_hsmmc: correct precedence of operators

2012-12-20 Thread Felipe Balbi
On Thu, Dec 20, 2012 at 02:11:26PM -0500, Sasha Levin wrote:
 With the current code, the condition in the if() doesn't make much sense due 
 to
 precedence of operators.
 
 Signed-off-by: Sasha Levin sasha.le...@oracle.com

nice catch!!!

Acked-by: Felipe Balbi ba...@ti.com

 ---
  drivers/mmc/host/omap_hsmmc.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
 index bc58078..3ee2664 100644
 --- a/drivers/mmc/host/omap_hsmmc.c
 +++ b/drivers/mmc/host/omap_hsmmc.c
 @@ -611,7 +611,7 @@ static int omap_hsmmc_context_restore(struct 
 omap_hsmmc_host *host)
   if (host-context_loss == context_loss)
   return 1;
  
 - if (!OMAP_HSMMC_READ(host-base, SYSSTATUS)  RESETDONE)
 + if (!(OMAP_HSMMC_READ(host-base, SYSSTATUS)  RESETDONE))
   return 1;
  
   if (host-pdata-controller_flags  OMAP_HSMMC_SUPPORTS_DUAL_VOLT) {
 -- 
 1.8.0
 
 --
 To unsubscribe from this list: send the line unsubscribe linux-kernel in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 Please read the FAQ at  http://www.tux.org/lkml/

-- 
balbi


signature.asc
Description: Digital signature


Re: omap_hsmmc: SDIO IRQ on AM335x family

2012-12-20 Thread Andreas Fenkart
Hi,

On Fri, Nov 30, 2012 at 07:57:35PM +0100, Daniel Mack wrote:
 
 On 30.11.2012 18:40, Tony Lindgren wrote:
  * Andreas Fenkart andreas.fenk...@streamunlimited.com [121130 03:21]:
 
  The alternative was to configure dat1 line as a GPIO, while
  waiting for an IRQ. Then configuring it back as dat1 when the
  SDIO card is signalling an IRQ. Or the host starts a transfer. I
  guess this will perform poorly, hence not considering it really.
  
  This might work for SDIO cards. It should be disabled for data
  cards naturally to avoid potential data corruption.
I don't understand your concern here, could you explain

  The way to implement this is set named states in the .dts file
  for the pins using pinctrl-single.c, then have the MMC driver
  request states default active and idle during the probe,
  then toggle between active and idle during the runtime.
  
  As far as I remember the GPIO functionality does not need to
  be enabled, just muxing the pin to GPIO mode for the wake-up
  is enough.
 
 Wouldn't that be racy, given that an interrupt which occurs at beween
 the point in time when the driver decides to wait for IRQs again until
 the mux has finished switching over, could potentially be lost?

The IRQ is level triggered, so can't be lost. I implemented it as
suggested and surprisingly performance is pretty good. Actually not
worse than keeping the fclk enabled all times.

module: 88W8787 / mwifiex
tx bitrate: 150.0 MBit/s MCS 7 40Mhz short GI

   |   tcp tx |  signal  | cpu idle
---
keep fclk enabled  |   50.3 Mbits/sec | -23 dBm  | 15 %
suspend/resume |   49.7 Mbits/sec | -22 dBM  | 13 %

patch follows

/Andi
--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] mmc: omap_hsmmc: Enable SDIO IRQ using a GPIO in idle mode.

2012-12-20 Thread Andreas Fenkart
Without functional clock the omap_hsmmc module can't forward
SDIO IRQs to the system. This patch reconfigures dat1 line
as a gpio while the fclk is off. And uses SDIO IRQ detection of
the module, while fclk is present.

Signed-off-by: Andreas Fenkart andreas.fenk...@streamunlimited.com
---
 .../devicetree/bindings/mmc/ti-omap-hsmmc.txt  |   42 
 arch/arm/plat-omap/include/plat/mmc.h  |4 +
 drivers/mmc/host/omap_hsmmc.c  |  219 ++--
 3 files changed, 247 insertions(+), 18 deletions(-)

diff --git a/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt 
b/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
index d1b8932..4d57637 100644
--- a/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
+++ b/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
@@ -24,6 +24,29 @@ One tx and one rx pair is required.
 dma-names: DMA request names. These strings correspond 1:1 with
 the ordered pairs in dmas. The RX request must be rx and the
 TX request must be tx.
+ti,cirq-gpio: When omap_hsmmc module is suspended, its functional
+clock is turned off. Without fclk it can't forward SDIO IRQs to the
+system. For that to happen, it needs to tell the PRCM to restore
+its fclk, which is done through the swakeup line.
+
+   --
+  | PRCM |
+   --
+| ^
+   fclk | | swakeup
+v |
+  ---   --
+  -- IRQ -- | hsmmc | -- CIRQ -- | card |
+  ---   --
+
+The problem is, that on the AM335x family the swakeup line is
+missing, it has not been routed from the module to the PRCM.
+The way to work around this, is to reconfigure the dat1 line as a
+GPIO upon suspend. Beyond this option you also need to set named
+states default and idle in the .dts file for the pins, using
+pinctrl-single.c. The MMC driver will then then toggle between
+default and idle during the runtime.
+
 
 Examples:
 
@@ -53,3 +76,22 @@ Examples:
edma 25;
dma-names = tx, rx;
};
+
+[am335x with with gpio for sdio irq]
+
+   mmc1_cirq_pin: pinmux_cirq_pin {
+   pinctrl-single,pins = 
+   0x0f8 0x3f  /* MMC0_DAT1 as GPIO2_28 */
+   ;
+   };
+
+   mmc1: mmc@4806 {
+   pinctrl-names = default, idle;
+   pinctrl-0 = mmc1_pins;
+   pinctrl-1 = mmc1_cirq_pin;
+   ti,cirq-gpio = gpio3 28 0;
+   ti,non-removable;
+   bus-width = 4;
+   vmmc-supply = ldo2_reg;
+   vmmc_aux-supply = vmmc;
+   };
diff --git a/arch/arm/plat-omap/include/plat/mmc.h 
b/arch/arm/plat-omap/include/plat/mmc.h
index 8b4e4f2..807676a 100644
--- a/arch/arm/plat-omap/include/plat/mmc.h
+++ b/arch/arm/plat-omap/include/plat/mmc.h
@@ -130,6 +130,7 @@ struct omap_mmc_platform_data {
 
int switch_pin; /* gpio (card detect) */
int gpio_wp;/* gpio (write protect) */
+   int gpio_cirq;  /* gpio (card irq) */
 
int (*set_bus_mode)(struct device *dev, int slot, int bus_mode);
int (*set_power)(struct device *dev, int slot,
@@ -160,6 +161,9 @@ struct omap_mmc_platform_data {
int card_detect_irq;
int (*card_detect)(struct device *dev, int slot);
 
+   /* SDIO IRQs */
+   int sdio_irq;
+
unsigned int ban_openended:1;
 
} slots[OMAP_MMC_MAX_SLOTS];
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 53703c6..1a48cb1 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -108,6 +108,7 @@ static void apply_clk_hack(void)
 #define INT_EN_MASK0x307F0033
 #define BWR_ENABLE (1  4)
 #define BRR_ENABLE (1  5)
+#define CIRQ_ENABLE(1  8)
 #define DTO_ENABLE (1  20)
 #define INIT_STREAM(1  1)
 #define DP_SELECT  (1  21)
@@ -121,6 +122,7 @@ static void apply_clk_hack(void)
 #define CC 0x1
 #define TC 0x02
 #define OD 0x1
+#define CIRQ   (1  8)
 #define ERR(1  15)
 #define CMD_TIMEOUT(1  16)
 #define DATA_TIMEOUT   (1  20)
@@ -198,11 +200,25 @@ struct omap_hsmmc_host {
int reqs_blocked;
int use_reg;
int req_in_progress;
+   boolactive_pinmux;
+   boolsdio_irq_en;
struct omap_hsmmc_next  next_data;
 
struct  omap_mmc_platform_data  *pdata;
+
+   struct pinctrl *pinctrl;
+   struct pinctrl_state *active, *idle;
+
 };
 
+static irqreturn_t omap_hsmmc_cirq(int irq, void 

Re: [PATCH] mmc: omap_hsmmc: correct precedence of operators

2012-12-20 Thread Paul Walmsley
(cc Tero)

Hi,

On Thu, 20 Dec 2012, Sasha Levin wrote:

 With the current code, the condition in the if() doesn't make much sense due 
 to
 precedence of operators.
 
 Signed-off-by: Sasha Levin sasha.le...@oracle.com
 ---
  drivers/mmc/host/omap_hsmmc.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
 index bc58078..3ee2664 100644
 --- a/drivers/mmc/host/omap_hsmmc.c
 +++ b/drivers/mmc/host/omap_hsmmc.c
 @@ -611,7 +611,7 @@ static int omap_hsmmc_context_restore(struct 
 omap_hsmmc_host *host)
   if (host-context_loss == context_loss)
   return 1;
  
 - if (!OMAP_HSMMC_READ(host-base, SYSSTATUS)  RESETDONE)
 + if (!(OMAP_HSMMC_READ(host-base, SYSSTATUS)  RESETDONE))
   return 1;
  
   if (host-pdata-controller_flags  OMAP_HSMMC_SUPPORTS_DUAL_VOLT) {

Makes sense to me, but I wonder if this code is even necessary after:

commit 613ad0e98c3596cd2524172fae2a795c3fc57e4a
Author: Tero Kristo t-kri...@ti.com
Date:   Mon Oct 29 22:02:13 2012 -0600

ARM: OMAP: hwmod: wait for sysreset complete after enabling hwmod


?  You might just be able to drop those lines completely now.



- Paul
--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html