All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] mmc: dw_mmc: push/pop all FIFO data if any data request
@ 2016-09-19  2:16 ` Ziyuan Xu
  2016-09-19  6:43   ` Jaehoon Chung
  0 siblings, 1 reply; 3+ messages in thread
From: Ziyuan Xu @ 2016-09-19  2:16 UTC (permalink / raw)
  To: u-boot

From: "jacob2.chen" <jacob2.chen@rock-chips.com>

When DTO interrupt occurred, there are any remaining data still in FIFO
due to RX FIFO threshold is larger than remaining data. It also
causes that dwmmc didn't trigger RXDR interrupt, so is TX.

It's responsibility of driver to read remaining bytes on seeing DTO
interrupt.

Signed-off-by: jacob2.chen <jacob2.chen@rock-chips.com>
Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
---

 drivers/mmc/dw_mmc.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c
index afc674d..074f86c 100644
--- a/drivers/mmc/dw_mmc.c
+++ b/drivers/mmc/dw_mmc.c
@@ -120,9 +120,9 @@ static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data)
 
 		if (host->fifo_mode && size) {
 			len = 0;
-			if (data->flags == MMC_DATA_READ) {
-				if ((dwmci_readl(host, DWMCI_RINTSTS) &
-				     DWMCI_INTMSK_RXDR)) {
+			if (data->flags == MMC_DATA_READ &&
+			    (mask & DWMCI_INTMSK_RXDR)) {
+				while (size) {
 					len = dwmci_readl(host, DWMCI_STATUS);
 					len = (len >> DWMCI_FIFO_SHIFT) &
 						    DWMCI_FIFO_MASK;
@@ -130,12 +130,13 @@ static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data)
 					for (i = 0; i < len; i++)
 						*buf++ =
 						dwmci_readl(host, DWMCI_DATA);
-					dwmci_writel(host, DWMCI_RINTSTS,
-						     DWMCI_INTMSK_RXDR);
+					size = size > len ? (size - len) : 0;
 				}
-			} else {
-				if ((dwmci_readl(host, DWMCI_RINTSTS) &
-				     DWMCI_INTMSK_TXDR)) {
+				dwmci_writel(host, DWMCI_RINTSTS,
+					     DWMCI_INTMSK_RXDR);
+			} else if (data->flags == MMC_DATA_WRITE &&
+				   (mask & DWMCI_INTMSK_TXDR)) {
+				while (size) {
 					len = dwmci_readl(host, DWMCI_STATUS);
 					len = fifo_depth - ((len >>
 						   DWMCI_FIFO_SHIFT) &
@@ -144,11 +145,11 @@ static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data)
 					for (i = 0; i < len; i++)
 						dwmci_writel(host, DWMCI_DATA,
 							     *buf++);
-					dwmci_writel(host, DWMCI_RINTSTS,
-						     DWMCI_INTMSK_TXDR);
+					size = size > len ? (size - len) : 0;
 				}
+				dwmci_writel(host, DWMCI_RINTSTS,
+					     DWMCI_INTMSK_TXDR);
 			}
-			size = size > len ? (size - len) : 0;
 		}
 
 		/* Data arrived correctly. */
-- 
2.9.2

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

* [U-Boot] [PATCH] mmc: dw_mmc: push/pop all FIFO data if any data request
  2016-09-19  2:16 ` [U-Boot] [PATCH] mmc: dw_mmc: push/pop all FIFO data if any data request Ziyuan Xu
@ 2016-09-19  6:43   ` Jaehoon Chung
  2016-09-19  6:48     ` Ziyuan Xu
  0 siblings, 1 reply; 3+ messages in thread
From: Jaehoon Chung @ 2016-09-19  6:43 UTC (permalink / raw)
  To: u-boot

Hi Ziyuan,

On 09/19/2016 11:16 AM, Ziyuan Xu wrote:
> From: "jacob2.chen" <jacob2.chen@rock-chips.com>

As I remembered, I mentioned that changed to real name, not mail ID.
likes "Jacob Chen <jacob2,chen@rock-chips.com>"

If it's right and you're ok, i will change this when i apply this patch.
How about?

And Next Time, could you add the changelog for Patch Version, plz? :)

Best Regards,
Jaehoon Chung

> 
> When DTO interrupt occurred, there are any remaining data still in FIFO
> due to RX FIFO threshold is larger than remaining data. It also
> causes that dwmmc didn't trigger RXDR interrupt, so is TX.
> 
> It's responsibility of driver to read remaining bytes on seeing DTO
> interrupt.
> 
> Signed-off-by: jacob2.chen <jacob2.chen@rock-chips.com>
> Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
> ---
> 
>  drivers/mmc/dw_mmc.c | 23 ++++++++++++-----------
>  1 file changed, 12 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c
> index afc674d..074f86c 100644
> --- a/drivers/mmc/dw_mmc.c
> +++ b/drivers/mmc/dw_mmc.c
> @@ -120,9 +120,9 @@ static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data)
>  
>  		if (host->fifo_mode && size) {
>  			len = 0;
> -			if (data->flags == MMC_DATA_READ) {
> -				if ((dwmci_readl(host, DWMCI_RINTSTS) &
> -				     DWMCI_INTMSK_RXDR)) {
> +			if (data->flags == MMC_DATA_READ &&
> +			    (mask & DWMCI_INTMSK_RXDR)) {
> +				while (size) {
>  					len = dwmci_readl(host, DWMCI_STATUS);
>  					len = (len >> DWMCI_FIFO_SHIFT) &
>  						    DWMCI_FIFO_MASK;
> @@ -130,12 +130,13 @@ static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data)
>  					for (i = 0; i < len; i++)
>  						*buf++ =
>  						dwmci_readl(host, DWMCI_DATA);
> -					dwmci_writel(host, DWMCI_RINTSTS,
> -						     DWMCI_INTMSK_RXDR);
> +					size = size > len ? (size - len) : 0;
>  				}
> -			} else {
> -				if ((dwmci_readl(host, DWMCI_RINTSTS) &
> -				     DWMCI_INTMSK_TXDR)) {
> +				dwmci_writel(host, DWMCI_RINTSTS,
> +					     DWMCI_INTMSK_RXDR);
> +			} else if (data->flags == MMC_DATA_WRITE &&
> +				   (mask & DWMCI_INTMSK_TXDR)) {
> +				while (size) {
>  					len = dwmci_readl(host, DWMCI_STATUS);
>  					len = fifo_depth - ((len >>
>  						   DWMCI_FIFO_SHIFT) &
> @@ -144,11 +145,11 @@ static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data)
>  					for (i = 0; i < len; i++)
>  						dwmci_writel(host, DWMCI_DATA,
>  							     *buf++);
> -					dwmci_writel(host, DWMCI_RINTSTS,
> -						     DWMCI_INTMSK_TXDR);
> +					size = size > len ? (size - len) : 0;
>  				}
> +				dwmci_writel(host, DWMCI_RINTSTS,
> +					     DWMCI_INTMSK_TXDR);
>  			}
> -			size = size > len ? (size - len) : 0;
>  		}
>  
>  		/* Data arrived correctly. */
> 

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

* [U-Boot] [PATCH] mmc: dw_mmc: push/pop all FIFO data if any data request
  2016-09-19  6:43   ` Jaehoon Chung
@ 2016-09-19  6:48     ` Ziyuan Xu
  0 siblings, 0 replies; 3+ messages in thread
From: Ziyuan Xu @ 2016-09-19  6:48 UTC (permalink / raw)
  To: u-boot

hi Jaehoon,


On 2016?09?19? 14:43, Jaehoon Chung wrote:
> Hi Ziyuan,
>
> On 09/19/2016 11:16 AM, Ziyuan Xu wrote:
>> From: "jacob2.chen" <jacob2.chen@rock-chips.com>
> As I remembered, I mentioned that changed to real name, not mail ID.
> likes "Jacob Chen <jacob2,chen@rock-chips.com>"
>
> If it's right and you're ok, i will change this when i apply this patch.
> How about?

Yup, it's ok.

>
> And Next Time, could you add the changelog for Patch Version, plz? :)

I'm sorry about it, I'll bear it in mind, thanks!

>
> Best Regards,
> Jaehoon Chung
>
>> When DTO interrupt occurred, there are any remaining data still in FIFO
>> due to RX FIFO threshold is larger than remaining data. It also
>> causes that dwmmc didn't trigger RXDR interrupt, so is TX.
>>
>> It's responsibility of driver to read remaining bytes on seeing DTO
>> interrupt.
>>
>> Signed-off-by: jacob2.chen <jacob2.chen@rock-chips.com>
>> Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
>> ---
>>
>>   drivers/mmc/dw_mmc.c | 23 ++++++++++++-----------
>>   1 file changed, 12 insertions(+), 11 deletions(-)
>>
>> diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c
>> index afc674d..074f86c 100644
>> --- a/drivers/mmc/dw_mmc.c
>> +++ b/drivers/mmc/dw_mmc.c
>> @@ -120,9 +120,9 @@ static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data)
>>   
>>   		if (host->fifo_mode && size) {
>>   			len = 0;
>> -			if (data->flags == MMC_DATA_READ) {
>> -				if ((dwmci_readl(host, DWMCI_RINTSTS) &
>> -				     DWMCI_INTMSK_RXDR)) {
>> +			if (data->flags == MMC_DATA_READ &&
>> +			    (mask & DWMCI_INTMSK_RXDR)) {
>> +				while (size) {
>>   					len = dwmci_readl(host, DWMCI_STATUS);
>>   					len = (len >> DWMCI_FIFO_SHIFT) &
>>   						    DWMCI_FIFO_MASK;
>> @@ -130,12 +130,13 @@ static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data)
>>   					for (i = 0; i < len; i++)
>>   						*buf++ =
>>   						dwmci_readl(host, DWMCI_DATA);
>> -					dwmci_writel(host, DWMCI_RINTSTS,
>> -						     DWMCI_INTMSK_RXDR);
>> +					size = size > len ? (size - len) : 0;
>>   				}
>> -			} else {
>> -				if ((dwmci_readl(host, DWMCI_RINTSTS) &
>> -				     DWMCI_INTMSK_TXDR)) {
>> +				dwmci_writel(host, DWMCI_RINTSTS,
>> +					     DWMCI_INTMSK_RXDR);
>> +			} else if (data->flags == MMC_DATA_WRITE &&
>> +				   (mask & DWMCI_INTMSK_TXDR)) {
>> +				while (size) {
>>   					len = dwmci_readl(host, DWMCI_STATUS);
>>   					len = fifo_depth - ((len >>
>>   						   DWMCI_FIFO_SHIFT) &
>> @@ -144,11 +145,11 @@ static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data)
>>   					for (i = 0; i < len; i++)
>>   						dwmci_writel(host, DWMCI_DATA,
>>   							     *buf++);
>> -					dwmci_writel(host, DWMCI_RINTSTS,
>> -						     DWMCI_INTMSK_TXDR);
>> +					size = size > len ? (size - len) : 0;
>>   				}
>> +				dwmci_writel(host, DWMCI_RINTSTS,
>> +					     DWMCI_INTMSK_TXDR);
>>   			}
>> -			size = size > len ? (size - len) : 0;
>>   		}
>>   
>>   		/* Data arrived correctly. */
>>
>
>
>

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

end of thread, other threads:[~2016-09-19  6:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20160919021723epcas1p21f0be1da5346d8d5584e39c0c603d0f0@epcas1p2.samsung.com>
2016-09-19  2:16 ` [U-Boot] [PATCH] mmc: dw_mmc: push/pop all FIFO data if any data request Ziyuan Xu
2016-09-19  6:43   ` Jaehoon Chung
2016-09-19  6:48     ` Ziyuan Xu

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.