Re: [RFC 4/4] mmc: sdhci-msm: Handle unexpected interrupt case on enabling legacy IRQs on CQE halt

2017-09-01 Thread Ritesh Harjani


On 8/31/2017 1:05 PM, Adrian Hunter wrote:

On 30/08/17 16:04, Ritesh Harjani wrote:

There is a case when enabling the legacy IRQs and halting CQE is
resuling into a command response interrupt without any command in
progress. This patch handles such case here.

Error signature without this patch:-
mmc0: Got command interrupt 0x0001 even though no command operation
was in progress.

Signed-off-by: Ritesh Harjani 


Seems fine, but this is a necessary part of enabling i.e. put all the
sdhci-msm changes into one patch.


Yes, sure.




---
  drivers/mmc/host/sdhci-msm.c | 11 +++
  1 file changed, 11 insertions(+)

diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
index baa3409..8fdc2c0 100644
--- a/drivers/mmc/host/sdhci-msm.c
+++ b/drivers/mmc/host/sdhci-msm.c
@@ -1124,10 +1124,21 @@ void sdhci_msm_cqe_enable(struct mmc_host *mmc)
  void sdhci_msm_cqe_disable(struct mmc_host *mmc, bool recovery)
  {
struct sdhci_host *host = mmc_priv(mmc);
+   unsigned long flags;
+   u32 ctrl;
  
  	if (host->flags & SDHCI_USE_64_BIT_DMA)

host->desc_sz = 16;
  
+	spin_lock_irqsave(>lock, flags);

+


Could use a comment here.


Ok. Thanks.




+   ctrl = sdhci_readl(host, SDHCI_INT_ENABLE);
+   ctrl |= SDHCI_INT_RESPONSE;
+   sdhci_writel(host,  ctrl, SDHCI_INT_ENABLE);
+   sdhci_writel(host, SDHCI_INT_RESPONSE, SDHCI_INT_STATUS);
+
+   spin_unlock_irqrestore(>lock, flags);
+
sdhci_cqe_disable(mmc, recovery);
  }
  





--
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, 
Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a 
Linux Foundation Collaborative Project.


Re: [RFC 4/4] mmc: sdhci-msm: Handle unexpected interrupt case on enabling legacy IRQs on CQE halt

2017-09-01 Thread Ritesh Harjani


On 8/31/2017 1:05 PM, Adrian Hunter wrote:

On 30/08/17 16:04, Ritesh Harjani wrote:

There is a case when enabling the legacy IRQs and halting CQE is
resuling into a command response interrupt without any command in
progress. This patch handles such case here.

Error signature without this patch:-
mmc0: Got command interrupt 0x0001 even though no command operation
was in progress.

Signed-off-by: Ritesh Harjani 


Seems fine, but this is a necessary part of enabling i.e. put all the
sdhci-msm changes into one patch.


Yes, sure.




---
  drivers/mmc/host/sdhci-msm.c | 11 +++
  1 file changed, 11 insertions(+)

diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
index baa3409..8fdc2c0 100644
--- a/drivers/mmc/host/sdhci-msm.c
+++ b/drivers/mmc/host/sdhci-msm.c
@@ -1124,10 +1124,21 @@ void sdhci_msm_cqe_enable(struct mmc_host *mmc)
  void sdhci_msm_cqe_disable(struct mmc_host *mmc, bool recovery)
  {
struct sdhci_host *host = mmc_priv(mmc);
+   unsigned long flags;
+   u32 ctrl;
  
  	if (host->flags & SDHCI_USE_64_BIT_DMA)

host->desc_sz = 16;
  
+	spin_lock_irqsave(>lock, flags);

+


Could use a comment here.


Ok. Thanks.




+   ctrl = sdhci_readl(host, SDHCI_INT_ENABLE);
+   ctrl |= SDHCI_INT_RESPONSE;
+   sdhci_writel(host,  ctrl, SDHCI_INT_ENABLE);
+   sdhci_writel(host, SDHCI_INT_RESPONSE, SDHCI_INT_STATUS);
+
+   spin_unlock_irqrestore(>lock, flags);
+
sdhci_cqe_disable(mmc, recovery);
  }
  





--
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, 
Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a 
Linux Foundation Collaborative Project.


Re: [RFC 4/4] mmc: sdhci-msm: Handle unexpected interrupt case on enabling legacy IRQs on CQE halt

2017-08-31 Thread Adrian Hunter
On 30/08/17 16:04, Ritesh Harjani wrote:
> There is a case when enabling the legacy IRQs and halting CQE is
> resuling into a command response interrupt without any command in
> progress. This patch handles such case here.
> 
> Error signature without this patch:-
> mmc0: Got command interrupt 0x0001 even though no command operation
> was in progress.
> 
> Signed-off-by: Ritesh Harjani 

Seems fine, but this is a necessary part of enabling i.e. put all the
sdhci-msm changes into one patch.

> ---
>  drivers/mmc/host/sdhci-msm.c | 11 +++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
> index baa3409..8fdc2c0 100644
> --- a/drivers/mmc/host/sdhci-msm.c
> +++ b/drivers/mmc/host/sdhci-msm.c
> @@ -1124,10 +1124,21 @@ void sdhci_msm_cqe_enable(struct mmc_host *mmc)
>  void sdhci_msm_cqe_disable(struct mmc_host *mmc, bool recovery)
>  {
>   struct sdhci_host *host = mmc_priv(mmc);
> + unsigned long flags;
> + u32 ctrl;
>  
>   if (host->flags & SDHCI_USE_64_BIT_DMA)
>   host->desc_sz = 16;
>  
> + spin_lock_irqsave(>lock, flags);
> +

Could use a comment here.

> + ctrl = sdhci_readl(host, SDHCI_INT_ENABLE);
> + ctrl |= SDHCI_INT_RESPONSE;
> + sdhci_writel(host,  ctrl, SDHCI_INT_ENABLE);
> + sdhci_writel(host, SDHCI_INT_RESPONSE, SDHCI_INT_STATUS);
> +
> + spin_unlock_irqrestore(>lock, flags);
> +
>   sdhci_cqe_disable(mmc, recovery);
>  }
>  
> 



Re: [RFC 4/4] mmc: sdhci-msm: Handle unexpected interrupt case on enabling legacy IRQs on CQE halt

2017-08-31 Thread Adrian Hunter
On 30/08/17 16:04, Ritesh Harjani wrote:
> There is a case when enabling the legacy IRQs and halting CQE is
> resuling into a command response interrupt without any command in
> progress. This patch handles such case here.
> 
> Error signature without this patch:-
> mmc0: Got command interrupt 0x0001 even though no command operation
> was in progress.
> 
> Signed-off-by: Ritesh Harjani 

Seems fine, but this is a necessary part of enabling i.e. put all the
sdhci-msm changes into one patch.

> ---
>  drivers/mmc/host/sdhci-msm.c | 11 +++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
> index baa3409..8fdc2c0 100644
> --- a/drivers/mmc/host/sdhci-msm.c
> +++ b/drivers/mmc/host/sdhci-msm.c
> @@ -1124,10 +1124,21 @@ void sdhci_msm_cqe_enable(struct mmc_host *mmc)
>  void sdhci_msm_cqe_disable(struct mmc_host *mmc, bool recovery)
>  {
>   struct sdhci_host *host = mmc_priv(mmc);
> + unsigned long flags;
> + u32 ctrl;
>  
>   if (host->flags & SDHCI_USE_64_BIT_DMA)
>   host->desc_sz = 16;
>  
> + spin_lock_irqsave(>lock, flags);
> +

Could use a comment here.

> + ctrl = sdhci_readl(host, SDHCI_INT_ENABLE);
> + ctrl |= SDHCI_INT_RESPONSE;
> + sdhci_writel(host,  ctrl, SDHCI_INT_ENABLE);
> + sdhci_writel(host, SDHCI_INT_RESPONSE, SDHCI_INT_STATUS);
> +
> + spin_unlock_irqrestore(>lock, flags);
> +
>   sdhci_cqe_disable(mmc, recovery);
>  }
>  
> 



[RFC 4/4] mmc: sdhci-msm: Handle unexpected interrupt case on enabling legacy IRQs on CQE halt

2017-08-30 Thread Ritesh Harjani
There is a case when enabling the legacy IRQs and halting CQE is
resuling into a command response interrupt without any command in
progress. This patch handles such case here.

Error signature without this patch:-
mmc0: Got command interrupt 0x0001 even though no command operation
was in progress.

Signed-off-by: Ritesh Harjani 
---
 drivers/mmc/host/sdhci-msm.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
index baa3409..8fdc2c0 100644
--- a/drivers/mmc/host/sdhci-msm.c
+++ b/drivers/mmc/host/sdhci-msm.c
@@ -1124,10 +1124,21 @@ void sdhci_msm_cqe_enable(struct mmc_host *mmc)
 void sdhci_msm_cqe_disable(struct mmc_host *mmc, bool recovery)
 {
struct sdhci_host *host = mmc_priv(mmc);
+   unsigned long flags;
+   u32 ctrl;
 
if (host->flags & SDHCI_USE_64_BIT_DMA)
host->desc_sz = 16;
 
+   spin_lock_irqsave(>lock, flags);
+
+   ctrl = sdhci_readl(host, SDHCI_INT_ENABLE);
+   ctrl |= SDHCI_INT_RESPONSE;
+   sdhci_writel(host,  ctrl, SDHCI_INT_ENABLE);
+   sdhci_writel(host, SDHCI_INT_RESPONSE, SDHCI_INT_STATUS);
+
+   spin_unlock_irqrestore(>lock, flags);
+
sdhci_cqe_disable(mmc, recovery);
 }
 
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux 
Foundation Collaborative Project.



[RFC 4/4] mmc: sdhci-msm: Handle unexpected interrupt case on enabling legacy IRQs on CQE halt

2017-08-30 Thread Ritesh Harjani
There is a case when enabling the legacy IRQs and halting CQE is
resuling into a command response interrupt without any command in
progress. This patch handles such case here.

Error signature without this patch:-
mmc0: Got command interrupt 0x0001 even though no command operation
was in progress.

Signed-off-by: Ritesh Harjani 
---
 drivers/mmc/host/sdhci-msm.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
index baa3409..8fdc2c0 100644
--- a/drivers/mmc/host/sdhci-msm.c
+++ b/drivers/mmc/host/sdhci-msm.c
@@ -1124,10 +1124,21 @@ void sdhci_msm_cqe_enable(struct mmc_host *mmc)
 void sdhci_msm_cqe_disable(struct mmc_host *mmc, bool recovery)
 {
struct sdhci_host *host = mmc_priv(mmc);
+   unsigned long flags;
+   u32 ctrl;
 
if (host->flags & SDHCI_USE_64_BIT_DMA)
host->desc_sz = 16;
 
+   spin_lock_irqsave(>lock, flags);
+
+   ctrl = sdhci_readl(host, SDHCI_INT_ENABLE);
+   ctrl |= SDHCI_INT_RESPONSE;
+   sdhci_writel(host,  ctrl, SDHCI_INT_ENABLE);
+   sdhci_writel(host, SDHCI_INT_RESPONSE, SDHCI_INT_STATUS);
+
+   spin_unlock_irqrestore(>lock, flags);
+
sdhci_cqe_disable(mmc, recovery);
 }
 
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux 
Foundation Collaborative Project.



[RFC 4/4] mmc: sdhci-msm: Handle unexpected interrupt case on enabling legacy IRQs on CQE halt

2017-08-30 Thread Ritesh Harjani
From: Ritesh Harjani 

There is a case when enabling the legacy IRQs and halting CQE is
resuling into a command response interrupt without any command in
progress. This patch handles such case here.

Error signature without this patch:-
mmc0: Got command interrupt 0x0001 even though no command operation
was in progress.

Signed-off-by: Ritesh Harjani 
---
 drivers/mmc/host/sdhci-msm.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
index baa3409..8fdc2c0 100644
--- a/drivers/mmc/host/sdhci-msm.c
+++ b/drivers/mmc/host/sdhci-msm.c
@@ -1124,10 +1124,21 @@ void sdhci_msm_cqe_enable(struct mmc_host *mmc)
 void sdhci_msm_cqe_disable(struct mmc_host *mmc, bool recovery)
 {
struct sdhci_host *host = mmc_priv(mmc);
+   unsigned long flags;
+   u32 ctrl;
 
if (host->flags & SDHCI_USE_64_BIT_DMA)
host->desc_sz = 16;
 
+   spin_lock_irqsave(>lock, flags);
+
+   ctrl = sdhci_readl(host, SDHCI_INT_ENABLE);
+   ctrl |= SDHCI_INT_RESPONSE;
+   sdhci_writel(host,  ctrl, SDHCI_INT_ENABLE);
+   sdhci_writel(host, SDHCI_INT_RESPONSE, SDHCI_INT_STATUS);
+
+   spin_unlock_irqrestore(>lock, flags);
+
sdhci_cqe_disable(mmc, recovery);
 }
 
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux 
Foundation Collaborative Project.



[RFC 4/4] mmc: sdhci-msm: Handle unexpected interrupt case on enabling legacy IRQs on CQE halt

2017-08-30 Thread Ritesh Harjani
From: Ritesh Harjani 

There is a case when enabling the legacy IRQs and halting CQE is
resuling into a command response interrupt without any command in
progress. This patch handles such case here.

Error signature without this patch:-
mmc0: Got command interrupt 0x0001 even though no command operation
was in progress.

Signed-off-by: Ritesh Harjani 
---
 drivers/mmc/host/sdhci-msm.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
index baa3409..8fdc2c0 100644
--- a/drivers/mmc/host/sdhci-msm.c
+++ b/drivers/mmc/host/sdhci-msm.c
@@ -1124,10 +1124,21 @@ void sdhci_msm_cqe_enable(struct mmc_host *mmc)
 void sdhci_msm_cqe_disable(struct mmc_host *mmc, bool recovery)
 {
struct sdhci_host *host = mmc_priv(mmc);
+   unsigned long flags;
+   u32 ctrl;
 
if (host->flags & SDHCI_USE_64_BIT_DMA)
host->desc_sz = 16;
 
+   spin_lock_irqsave(>lock, flags);
+
+   ctrl = sdhci_readl(host, SDHCI_INT_ENABLE);
+   ctrl |= SDHCI_INT_RESPONSE;
+   sdhci_writel(host,  ctrl, SDHCI_INT_ENABLE);
+   sdhci_writel(host, SDHCI_INT_RESPONSE, SDHCI_INT_STATUS);
+
+   spin_unlock_irqrestore(>lock, flags);
+
sdhci_cqe_disable(mmc, recovery);
 }
 
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux 
Foundation Collaborative Project.