All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmc: dw_mmc: init desc in dw_mci_idmac_init
@ 2015-04-29 13:31 Zhangfei Gao
  2015-04-30  8:01 ` Jaehoon Chung
  2015-04-30 14:16 ` Zhangfei Gao
  0 siblings, 2 replies; 6+ messages in thread
From: Zhangfei Gao @ 2015-04-29 13:31 UTC (permalink / raw)
  To: Jaehoon Chung, Ulf Hansson; +Cc: linux-mmc, Zhangfei Gao, Fei Wang

Set 0 to des1 in 32bit case.
Otherwise the random value of des1 will be used in
dw_mci_translate_sglist: IDMAC_64ADDR_SET_BUFFER1_SIZE(desc, length)

Signed-off-by: Fei Wang <w.f@huawei.com>
Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
---
 drivers/mmc/host/dw_mmc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 241454f..488a8af 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -589,9 +589,11 @@ static int dw_mci_idmac_init(struct dw_mci *host)
 		host->ring_size = PAGE_SIZE / sizeof(struct idmac_desc);
 
 		/* Forward link the descriptor list */
-		for (i = 0, p = host->sg_cpu; i < host->ring_size - 1; i++, p++)
+		for (i = 0, p = host->sg_cpu; i < host->ring_size - 1; i++, p++) {
 			p->des3 = cpu_to_le32(host->sg_dma +
 					(sizeof(struct idmac_desc) * (i + 1)));
+			p->des1 = 0;
+		}
 
 		/* Set the last descriptor as the end-of-ring descriptor */
 		p->des3 = cpu_to_le32(host->sg_dma);
-- 
1.9.1


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

* Re: [PATCH] mmc: dw_mmc: init desc in dw_mci_idmac_init
  2015-04-29 13:31 [PATCH] mmc: dw_mmc: init desc in dw_mci_idmac_init Zhangfei Gao
@ 2015-04-30  8:01 ` Jaehoon Chung
  2015-04-30  8:37   ` zhangfei
  2015-04-30 14:16 ` Zhangfei Gao
  1 sibling, 1 reply; 6+ messages in thread
From: Jaehoon Chung @ 2015-04-30  8:01 UTC (permalink / raw)
  To: Zhangfei Gao, Jaehoon Chung, Ulf Hansson; +Cc: linux-mmc, Fei Wang, CPGS

Hi.

On 04/29/2015 10:31 PM, Zhangfei Gao wrote:
> Set 0 to des1 in 32bit case.
> Otherwise the random value of des1 will be used in
> dw_mci_translate_sglist: IDMAC_64ADDR_SET_BUFFER1_SIZE(desc, length)

I'm not understanding this comment.
how does it use the IDMAC_64ADDR_SET_BUFFER1_SIZE(desc, length)?

Best Regards,
Jaehoon Chung
> 
> Signed-off-by: Fei Wang <w.f@huawei.com>
> Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
> ---
>  drivers/mmc/host/dw_mmc.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> index 241454f..488a8af 100644
> --- a/drivers/mmc/host/dw_mmc.c
> +++ b/drivers/mmc/host/dw_mmc.c
> @@ -589,9 +589,11 @@ static int dw_mci_idmac_init(struct dw_mci *host)
>  		host->ring_size = PAGE_SIZE / sizeof(struct idmac_desc);
>  
>  		/* Forward link the descriptor list */
> -		for (i = 0, p = host->sg_cpu; i < host->ring_size - 1; i++, p++)
> +		for (i = 0, p = host->sg_cpu; i < host->ring_size - 1; i++, p++) {
>  			p->des3 = cpu_to_le32(host->sg_dma +
>  					(sizeof(struct idmac_desc) * (i + 1)));
> +			p->des1 = 0;
> +		}
>  
>  		/* Set the last descriptor as the end-of-ring descriptor */
>  		p->des3 = cpu_to_le32(host->sg_dma);
> 


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

* Re: [PATCH] mmc: dw_mmc: init desc in dw_mci_idmac_init
  2015-04-30  8:01 ` Jaehoon Chung
@ 2015-04-30  8:37   ` zhangfei
       [not found]     ` <CAELcNGSWV_EVECekLcnP=x992XO8=164bUcA=P=G28Ee0J6myg@mail.gmail.com>
  0 siblings, 1 reply; 6+ messages in thread
From: zhangfei @ 2015-04-30  8:37 UTC (permalink / raw)
  To: Jaehoon Chung, Ulf Hansson; +Cc: linux-mmc, Fei Wang, CPGS



On 04/30/2015 04:01 PM, Jaehoon Chung wrote:
> Hi.
>
> On 04/29/2015 10:31 PM, Zhangfei Gao wrote:
>> Set 0 to des1 in 32bit case.
>> Otherwise the random value of des1 will be used in
>> dw_mci_translate_sglist: IDMAC_64ADDR_SET_BUFFER1_SIZE(desc, length)
>
> I'm not understanding this comment.
> how does it use the IDMAC_64ADDR_SET_BUFFER1_SIZE(desc, length)?

p->des1 contains random value, coming from dmam_alloc_coherent in 
dw_mci_init_dma

In dw_mci_translate_sglist -> IDMAC_SET_BUFFER1_SIZE(desc, length);
#define IDMAC_SET_BUFFER1_SIZE(d, s) \
         ((d)->des1 = ((d)->des1 & 0x03ffe000) | ((s) & 0x1fff))

The random value will be set to des1 as well as length, causing 
unexpected behavior.

So des1 need to be init to 0.
While des0, des2, des3 are set in dw_mci_idmac_init and 
dw_mci_translate_sglist.

Thanks


>
> Best Regards,
> Jaehoon Chung
>>
>> Signed-off-by: Fei Wang <w.f@huawei.com>
>> Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
>> ---
>>   drivers/mmc/host/dw_mmc.c | 4 +++-
>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
>> index 241454f..488a8af 100644
>> --- a/drivers/mmc/host/dw_mmc.c
>> +++ b/drivers/mmc/host/dw_mmc.c
>> @@ -589,9 +589,11 @@ static int dw_mci_idmac_init(struct dw_mci *host)
>>   		host->ring_size = PAGE_SIZE / sizeof(struct idmac_desc);
>>
>>   		/* Forward link the descriptor list */
>> -		for (i = 0, p = host->sg_cpu; i < host->ring_size - 1; i++, p++)
>> +		for (i = 0, p = host->sg_cpu; i < host->ring_size - 1; i++, p++) {
>>   			p->des3 = cpu_to_le32(host->sg_dma +
>>   					(sizeof(struct idmac_desc) * (i + 1)));
>> +			p->des1 = 0;
>> +		}
>>
>>   		/* Set the last descriptor as the end-of-ring descriptor */
>>   		p->des3 = cpu_to_le32(host->sg_dma);
>>
>

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

* Re: [PATCH] mmc: dw_mmc: init desc in dw_mci_idmac_init
       [not found]     ` <CAELcNGSWV_EVECekLcnP=x992XO8=164bUcA=P=G28Ee0J6myg@mail.gmail.com>
@ 2015-04-30 14:13       ` Zhangfei Gao
  0 siblings, 0 replies; 6+ messages in thread
From: Zhangfei Gao @ 2015-04-30 14:13 UTC (permalink / raw)
  To: Jae hoon Chung; +Cc: Jaehoon Chung, Ulf Hansson, linux-mmc, Fei Wang, CPGS

On 30 April 2015 at 18:28, Jae hoon Chung <jh80.chung@gmail.com> wrote:
>
>
> 2015-04-30 17:37 GMT+09:00 zhangfei <zhangfei.gao@linaro.org>:
>>
>>
>>
>> On 04/30/2015 04:01 PM, Jaehoon Chung wrote:
>>>
>>> Hi.
>>>
>>> On 04/29/2015 10:31 PM, Zhangfei Gao wrote:
>>>>
>>>> Set 0 to des1 in 32bit case.
>>>> Otherwise the random value of des1 will be used in
>>>> dw_mci_translate_sglist: IDMAC_64ADDR_SET_BUFFER1_SIZE(desc, length)
>>>
>>>
>>> I'm not understanding this comment.
>>> how does it use the IDMAC_64ADDR_SET_BUFFER1_SIZE(desc, length)?
>>
>>
>> p->des1 contains random value, coming from dmam_alloc_coherent in
>> dw_mci_init_dma
>>
>> In dw_mci_translate_sglist -> IDMAC_SET_BUFFER1_SIZE(desc, length);
>> #define IDMAC_SET_BUFFER1_SIZE(d, s) \
>>         ((d)->des1 = ((d)->des1 & 0x03ffe000) | ((s) & 0x1fff))
>>
> I think you need to change the commit message
> (IDMAC_SET_BUFFER1_SIZE instead of IDMAC_64ADDR_SET_BUFFER1_SIZE.
>
> You mentioned about desc1, but IDMAC_64ADDR_SET_BUFFER1_SIZE assign to
> desc2.

Yes, made mistake, will change the log.

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

* [PATCH] mmc: dw_mmc: init desc in dw_mci_idmac_init
  2015-04-29 13:31 [PATCH] mmc: dw_mmc: init desc in dw_mci_idmac_init Zhangfei Gao
  2015-04-30  8:01 ` Jaehoon Chung
@ 2015-04-30 14:16 ` Zhangfei Gao
  2015-05-04  0:07   ` Jaehoon Chung
  1 sibling, 1 reply; 6+ messages in thread
From: Zhangfei Gao @ 2015-04-30 14:16 UTC (permalink / raw)
  To: Jaehoon Chung, Ulf Hansson; +Cc: linux-mmc, Zhangfei Gao, Fei Wang

Set 0 to des1 in 32bit case.
Otherwise the random value of des1 will be used in
dw_mci_translate_sglist: IDMAC_SET_BUFFER1_SIZE(desc, length)

Signed-off-by: Fei Wang <w.f@huawei.com>
Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
---
 drivers/mmc/host/dw_mmc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 241454f..488a8af 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -589,9 +589,11 @@ static int dw_mci_idmac_init(struct dw_mci *host)
 		host->ring_size = PAGE_SIZE / sizeof(struct idmac_desc);
 
 		/* Forward link the descriptor list */
-		for (i = 0, p = host->sg_cpu; i < host->ring_size - 1; i++, p++)
+		for (i = 0, p = host->sg_cpu; i < host->ring_size - 1; i++, p++) {
 			p->des3 = cpu_to_le32(host->sg_dma +
 					(sizeof(struct idmac_desc) * (i + 1)));
+			p->des1 = 0;
+		}
 
 		/* Set the last descriptor as the end-of-ring descriptor */
 		p->des3 = cpu_to_le32(host->sg_dma);
-- 
1.9.1


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

* Re: [PATCH] mmc: dw_mmc: init desc in dw_mci_idmac_init
  2015-04-30 14:16 ` Zhangfei Gao
@ 2015-05-04  0:07   ` Jaehoon Chung
  0 siblings, 0 replies; 6+ messages in thread
From: Jaehoon Chung @ 2015-05-04  0:07 UTC (permalink / raw)
  To: Zhangfei Gao, Ulf Hansson; +Cc: linux-mmc, Fei Wang, CPGS

Hi, Zhangfei.

Will apply this patch at my dw-mmc tree.
Thanks!

Best Regards,
Jaehoon Chung

On 04/30/2015 11:16 PM, Zhangfei Gao wrote:
> Set 0 to des1 in 32bit case.
> Otherwise the random value of des1 will be used in
> dw_mci_translate_sglist: IDMAC_SET_BUFFER1_SIZE(desc, length)
> 
> Signed-off-by: Fei Wang <w.f@huawei.com>
> Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
> ---
>  drivers/mmc/host/dw_mmc.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> index 241454f..488a8af 100644
> --- a/drivers/mmc/host/dw_mmc.c
> +++ b/drivers/mmc/host/dw_mmc.c
> @@ -589,9 +589,11 @@ static int dw_mci_idmac_init(struct dw_mci *host)
>  		host->ring_size = PAGE_SIZE / sizeof(struct idmac_desc);
>  
>  		/* Forward link the descriptor list */
> -		for (i = 0, p = host->sg_cpu; i < host->ring_size - 1; i++, p++)
> +		for (i = 0, p = host->sg_cpu; i < host->ring_size - 1; i++, p++) {
>  			p->des3 = cpu_to_le32(host->sg_dma +
>  					(sizeof(struct idmac_desc) * (i + 1)));
> +			p->des1 = 0;
> +		}
>  
>  		/* Set the last descriptor as the end-of-ring descriptor */
>  		p->des3 = cpu_to_le32(host->sg_dma);
> 


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

end of thread, other threads:[~2015-05-04  0:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-29 13:31 [PATCH] mmc: dw_mmc: init desc in dw_mci_idmac_init Zhangfei Gao
2015-04-30  8:01 ` Jaehoon Chung
2015-04-30  8:37   ` zhangfei
     [not found]     ` <CAELcNGSWV_EVECekLcnP=x992XO8=164bUcA=P=G28Ee0J6myg@mail.gmail.com>
2015-04-30 14:13       ` Zhangfei Gao
2015-04-30 14:16 ` Zhangfei Gao
2015-05-04  0:07   ` Jaehoon Chung

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.