linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] MMC: Fix multiblock SDIO transfers in AT91 MCI
@ 2010-11-25 10:11 Yauhen Kharuzhy
  2010-11-26 11:17 ` Nicolas Ferre
  2010-11-26 19:46 ` [PATCH] MMC: Fix multiblock SDIO transfers in AT91 MCI Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 2 replies; 9+ messages in thread
From: Yauhen Kharuzhy @ 2010-11-25 10:11 UTC (permalink / raw)
  To: linux-arm-kernel

The AT91 MCI has special SDIO transfer types: SDIO block and SDIO byte
transfers, but at91_mci driver doesn't use them and handles all SDIO
transfers as ordinary MMC block transfers. This causes problems for
multiple-block SDIO transfers (in particular for 256-bytes blocks).

Fix this situation by check opcode for SDIO CMD53 and set transfer
type in AT91_MCI_CMDR register properly.

This patch was tested with libertas SDIO driver: problem with TX
timeouts on big packets was eliminated.

Signed-off-by: Yauhen Kharuzhy <yauhen.kharuzhy@promwad.com>
---
 arch/arm/mach-at91/include/mach/at91_mci.h |    2 ++
 drivers/mmc/host/at91_mci.c                |   13 +++++++++----
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-at91/include/mach/at91_mci.h b/arch/arm/mach-at91/include/mach/at91_mci.h
index 57f8ee1..27ac6f5 100644
--- a/arch/arm/mach-at91/include/mach/at91_mci.h
+++ b/arch/arm/mach-at91/include/mach/at91_mci.h
@@ -74,6 +74,8 @@
 #define			AT91_MCI_TRTYP_BLOCK	(0 << 19)
 #define			AT91_MCI_TRTYP_MULTIPLE	(1 << 19)
 #define			AT91_MCI_TRTYP_STREAM	(2 << 19)
+#define			AT91_MCI_TRTYP_SDIO_BYTE	(4 << 19)
+#define			AT91_MCI_TRTYP_SDIO_BLOCK	(5 << 19)
 
 #define AT91_MCI_BLKR		0x18		/* Block Register */
 #define		AT91_MCI_BLKR_BCNT(n)	((0xffff & (n)) << 0)	/* Block count */
diff --git a/drivers/mmc/host/at91_mci.c b/drivers/mmc/host/at91_mci.c
index 591ab54..d3e6a96 100644
--- a/drivers/mmc/host/at91_mci.c
+++ b/drivers/mmc/host/at91_mci.c
@@ -69,6 +69,7 @@
 #include <linux/highmem.h>
 
 #include <linux/mmc/host.h>
+#include <linux/mmc/sdio.h>
 
 #include <asm/io.h>
 #include <asm/irq.h>
@@ -493,10 +494,14 @@ static void at91_mci_send_command(struct at91mci_host *host, struct mmc_command
 		else if (data->flags & MMC_DATA_WRITE)
 			cmdr |= AT91_MCI_TRCMD_START;
 
-		if (data->flags & MMC_DATA_STREAM)
-			cmdr |= AT91_MCI_TRTYP_STREAM;
-		if (data->blocks > 1)
-			cmdr |= AT91_MCI_TRTYP_MULTIPLE;
+		if (cmd->opcode == SD_IO_RW_EXTENDED) {
+			cmdr |= AT91_MCI_TRTYP_SDIO_BLOCK;
+		} else {
+			if (data->flags & MMC_DATA_STREAM)
+				cmdr |= AT91_MCI_TRTYP_STREAM;
+			if (data->blocks > 1)
+				cmdr |= AT91_MCI_TRTYP_MULTIPLE;
+		}
 	}
 	else {
 		block_length = 0;
-- 
1.7.2.3

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

* [PATCH] MMC: Fix multiblock SDIO transfers in AT91 MCI
  2010-11-25 10:11 [PATCH] MMC: Fix multiblock SDIO transfers in AT91 MCI Yauhen Kharuzhy
@ 2010-11-26 11:17 ` Nicolas Ferre
  2010-12-10 15:54   ` Nicolas Ferre
  2010-11-26 19:46 ` [PATCH] MMC: Fix multiblock SDIO transfers in AT91 MCI Jean-Christophe PLAGNIOL-VILLARD
  1 sibling, 1 reply; 9+ messages in thread
From: Nicolas Ferre @ 2010-11-26 11:17 UTC (permalink / raw)
  To: linux-arm-kernel

Le 25/11/2010 11:11, Yauhen Kharuzhy :
> The AT91 MCI has special SDIO transfer types: SDIO block and SDIO byte
> transfers, but at91_mci driver doesn't use them and handles all SDIO
> transfers as ordinary MMC block transfers. This causes problems for
> multiple-block SDIO transfers (in particular for 256-bytes blocks).
> 
> Fix this situation by check opcode for SDIO CMD53 and set transfer
> type in AT91_MCI_CMDR register properly.
> 
> This patch was tested with libertas SDIO driver: problem with TX
> timeouts on big packets was eliminated.
> 
> Signed-off-by: Yauhen Kharuzhy <yauhen.kharuzhy@promwad.com>

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>

> ---
>  arch/arm/mach-at91/include/mach/at91_mci.h |    2 ++
>  drivers/mmc/host/at91_mci.c                |   13 +++++++++----
>  2 files changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm/mach-at91/include/mach/at91_mci.h b/arch/arm/mach-at91/include/mach/at91_mci.h
> index 57f8ee1..27ac6f5 100644
> --- a/arch/arm/mach-at91/include/mach/at91_mci.h
> +++ b/arch/arm/mach-at91/include/mach/at91_mci.h
> @@ -74,6 +74,8 @@
>  #define			AT91_MCI_TRTYP_BLOCK	(0 << 19)
>  #define			AT91_MCI_TRTYP_MULTIPLE	(1 << 19)
>  #define			AT91_MCI_TRTYP_STREAM	(2 << 19)
> +#define			AT91_MCI_TRTYP_SDIO_BYTE	(4 << 19)
> +#define			AT91_MCI_TRTYP_SDIO_BLOCK	(5 << 19)
>  
>  #define AT91_MCI_BLKR		0x18		/* Block Register */
>  #define		AT91_MCI_BLKR_BCNT(n)	((0xffff & (n)) << 0)	/* Block count */
> diff --git a/drivers/mmc/host/at91_mci.c b/drivers/mmc/host/at91_mci.c
> index 591ab54..d3e6a96 100644
> --- a/drivers/mmc/host/at91_mci.c
> +++ b/drivers/mmc/host/at91_mci.c
> @@ -69,6 +69,7 @@
>  #include <linux/highmem.h>
>  
>  #include <linux/mmc/host.h>
> +#include <linux/mmc/sdio.h>
>  
>  #include <asm/io.h>
>  #include <asm/irq.h>
> @@ -493,10 +494,14 @@ static void at91_mci_send_command(struct at91mci_host *host, struct mmc_command
>  		else if (data->flags & MMC_DATA_WRITE)
>  			cmdr |= AT91_MCI_TRCMD_START;
>  
> -		if (data->flags & MMC_DATA_STREAM)
> -			cmdr |= AT91_MCI_TRTYP_STREAM;
> -		if (data->blocks > 1)
> -			cmdr |= AT91_MCI_TRTYP_MULTIPLE;
> +		if (cmd->opcode == SD_IO_RW_EXTENDED) {
> +			cmdr |= AT91_MCI_TRTYP_SDIO_BLOCK;
> +		} else {
> +			if (data->flags & MMC_DATA_STREAM)
> +				cmdr |= AT91_MCI_TRTYP_STREAM;
> +			if (data->blocks > 1)
> +				cmdr |= AT91_MCI_TRTYP_MULTIPLE;
> +		}
>  	}
>  	else {
>  		block_length = 0;


-- 
Nicolas Ferre

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

* [PATCH] MMC: Fix multiblock SDIO transfers in AT91 MCI
  2010-11-25 10:11 [PATCH] MMC: Fix multiblock SDIO transfers in AT91 MCI Yauhen Kharuzhy
  2010-11-26 11:17 ` Nicolas Ferre
@ 2010-11-26 19:46 ` Jean-Christophe PLAGNIOL-VILLARD
  1 sibling, 0 replies; 9+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2010-11-26 19:46 UTC (permalink / raw)
  To: linux-arm-kernel

On 12:11 Thu 25 Nov     , Yauhen Kharuzhy wrote:
> The AT91 MCI has special SDIO transfer types: SDIO block and SDIO byte
> transfers, but at91_mci driver doesn't use them and handles all SDIO
> transfers as ordinary MMC block transfers. This causes problems for
> multiple-block SDIO transfers (in particular for 256-bytes blocks).
> 
> Fix this situation by check opcode for SDIO CMD53 and set transfer
> type in AT91_MCI_CMDR register properly.
> 
> This patch was tested with libertas SDIO driver: problem with TX
> timeouts on big packets was eliminated.
> 
> Signed-off-by: Yauhen Kharuzhy <yauhen.kharuzhy@promwad.com>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

Best Regards,
J.

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

* [PATCH] MMC: Fix multiblock SDIO transfers in AT91 MCI
  2010-11-26 11:17 ` Nicolas Ferre
@ 2010-12-10 15:54   ` Nicolas Ferre
  2010-12-10 16:23     ` Chris Ball
  0 siblings, 1 reply; 9+ messages in thread
From: Nicolas Ferre @ 2010-12-10 15:54 UTC (permalink / raw)
  To: linux-arm-kernel

Le 26/11/2010 12:17, Nicolas Ferre :
> Le 25/11/2010 11:11, Yauhen Kharuzhy :
>> The AT91 MCI has special SDIO transfer types: SDIO block and SDIO byte
>> transfers, but at91_mci driver doesn't use them and handles all SDIO
>> transfers as ordinary MMC block transfers. This causes problems for
>> multiple-block SDIO transfers (in particular for 256-bytes blocks).
>>
>> Fix this situation by check opcode for SDIO CMD53 and set transfer
>> type in AT91_MCI_CMDR register properly.
>>
>> This patch was tested with libertas SDIO driver: problem with TX
>> timeouts on big packets was eliminated.
>>
>> Signed-off-by: Yauhen Kharuzhy <yauhen.kharuzhy@promwad.com>
> 
> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>

Hi Chris,

A little "ping"!

Do you want that I re-send you the patch with relevant S-O-B lines or
you can include them yourself?

Best regards,

>> ---
>>  arch/arm/mach-at91/include/mach/at91_mci.h |    2 ++
>>  drivers/mmc/host/at91_mci.c                |   13 +++++++++----
>>  2 files changed, 11 insertions(+), 4 deletions(-)
>>
>> diff --git a/arch/arm/mach-at91/include/mach/at91_mci.h b/arch/arm/mach-at91/include/mach/at91_mci.h
>> index 57f8ee1..27ac6f5 100644
>> --- a/arch/arm/mach-at91/include/mach/at91_mci.h
>> +++ b/arch/arm/mach-at91/include/mach/at91_mci.h
>> @@ -74,6 +74,8 @@
>>  #define			AT91_MCI_TRTYP_BLOCK	(0 << 19)
>>  #define			AT91_MCI_TRTYP_MULTIPLE	(1 << 19)
>>  #define			AT91_MCI_TRTYP_STREAM	(2 << 19)
>> +#define			AT91_MCI_TRTYP_SDIO_BYTE	(4 << 19)
>> +#define			AT91_MCI_TRTYP_SDIO_BLOCK	(5 << 19)
>>  
>>  #define AT91_MCI_BLKR		0x18		/* Block Register */
>>  #define		AT91_MCI_BLKR_BCNT(n)	((0xffff & (n)) << 0)	/* Block count */
>> diff --git a/drivers/mmc/host/at91_mci.c b/drivers/mmc/host/at91_mci.c
>> index 591ab54..d3e6a96 100644
>> --- a/drivers/mmc/host/at91_mci.c
>> +++ b/drivers/mmc/host/at91_mci.c
>> @@ -69,6 +69,7 @@
>>  #include <linux/highmem.h>
>>  
>>  #include <linux/mmc/host.h>
>> +#include <linux/mmc/sdio.h>
>>  
>>  #include <asm/io.h>
>>  #include <asm/irq.h>
>> @@ -493,10 +494,14 @@ static void at91_mci_send_command(struct at91mci_host *host, struct mmc_command
>>  		else if (data->flags & MMC_DATA_WRITE)
>>  			cmdr |= AT91_MCI_TRCMD_START;
>>  
>> -		if (data->flags & MMC_DATA_STREAM)
>> -			cmdr |= AT91_MCI_TRTYP_STREAM;
>> -		if (data->blocks > 1)
>> -			cmdr |= AT91_MCI_TRTYP_MULTIPLE;
>> +		if (cmd->opcode == SD_IO_RW_EXTENDED) {
>> +			cmdr |= AT91_MCI_TRTYP_SDIO_BLOCK;
>> +		} else {
>> +			if (data->flags & MMC_DATA_STREAM)
>> +				cmdr |= AT91_MCI_TRTYP_STREAM;
>> +			if (data->blocks > 1)
>> +				cmdr |= AT91_MCI_TRTYP_MULTIPLE;
>> +		}
>>  	}
>>  	else {
>>  		block_length = 0;
> 
> 


-- 
Nicolas Ferre

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

* [PATCH] MMC: Fix multiblock SDIO transfers in AT91 MCI
  2010-12-10 15:54   ` Nicolas Ferre
@ 2010-12-10 16:23     ` Chris Ball
  2010-12-10 18:14       ` [PATCH] MMC: Fix multiblock SDIO transfers in ATMEL MCI Nicolas Ferre
  0 siblings, 1 reply; 9+ messages in thread
From: Chris Ball @ 2010-12-10 16:23 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Nicolas,

On Fri, Dec 10, 2010 at 04:54:13PM +0100, Nicolas Ferre wrote:
> A little "ping"!
> 
> Do you want that I re-send you the patch with relevant S-O-B lines or
> you can include them yourself?

Thanks for the ping -- I've pushed this to mmc-next and queued it for
2.6.37 now.  This looks like a candidate for the stable kernel to me;
do you agree?

Thanks,

-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child

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

* [PATCH] MMC: Fix multiblock SDIO transfers in ATMEL MCI
  2010-12-10 18:14       ` [PATCH] MMC: Fix multiblock SDIO transfers in ATMEL MCI Nicolas Ferre
@ 2010-12-10 17:21         ` Chris Ball
  2010-12-12  0:42         ` Jean-Christophe PLAGNIOL-VILLARD
  1 sibling, 0 replies; 9+ messages in thread
From: Chris Ball @ 2010-12-10 17:21 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Nicolas,

On Fri, Dec 10, 2010 at 07:14:32PM +0100, Nicolas Ferre wrote:
> Based on report made by Yauhen in:
> "MMC: Fix multiblock SDIO transfers in AT91 MCI" patch,
> I report those changes to the brother driver: atmel-mci.
> 
> So, this patch sets SDIO transfer types: SDIO block and SDIO byte
> transfers instead of using ordinary MMC block transfers.
> It is checking opcode for SDIO CMD53 and setting transfer
> type in MCI_CMDR register properly.
> 
> Reported-by: Yauhen Kharuzhy <yauhen.kharuzhy@promwad.com>
> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> ---
> 
> Hi Chris,
> 
> In addition to the at91_mci multiblock SDIO fix, I add this little one too as
> it concerns the brother driver atmel-mci with same issue.
> 
> I hope that you will be able to queue those fixes to .37-final and stable...

That's fine, this is queued now too.  Thanks!

-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child

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

* [PATCH] MMC: Fix multiblock SDIO transfers in ATMEL MCI
  2010-12-10 16:23     ` Chris Ball
@ 2010-12-10 18:14       ` Nicolas Ferre
  2010-12-10 17:21         ` Chris Ball
  2010-12-12  0:42         ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 2 replies; 9+ messages in thread
From: Nicolas Ferre @ 2010-12-10 18:14 UTC (permalink / raw)
  To: linux-arm-kernel

Based on report made by Yauhen in:
"MMC: Fix multiblock SDIO transfers in AT91 MCI" patch,
I report those changes to the brother driver: atmel-mci.

So, this patch sets SDIO transfer types: SDIO block and SDIO byte
transfers instead of using ordinary MMC block transfers.
It is checking opcode for SDIO CMD53 and setting transfer
type in MCI_CMDR register properly.

Reported-by: Yauhen Kharuzhy <yauhen.kharuzhy@promwad.com>
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---

Hi Chris,

In addition to the at91_mci multiblock SDIO fix, I add this little one too as
it concerns the brother driver atmel-mci with same issue.

I hope that you will be able to queue those fixes to .37-final and stable...

Thanks a lot, best regards,

 drivers/mmc/host/atmel-mci.c |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index 301351a..ad2a7a0 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -26,6 +26,7 @@
 #include <linux/stat.h>
 
 #include <linux/mmc/host.h>
+#include <linux/mmc/sdio.h>
 
 #include <mach/atmel-mci.h>
 #include <linux/atmel-mci.h>
@@ -532,12 +533,17 @@ static u32 atmci_prepare_command(struct mmc_host *mmc,
 	data = cmd->data;
 	if (data) {
 		cmdr |= MCI_CMDR_START_XFER;
-		if (data->flags & MMC_DATA_STREAM)
-			cmdr |= MCI_CMDR_STREAM;
-		else if (data->blocks > 1)
-			cmdr |= MCI_CMDR_MULTI_BLOCK;
-		else
-			cmdr |= MCI_CMDR_BLOCK;
+
+		if (cmd->opcode == SD_IO_RW_EXTENDED) {
+			cmdr |= MCI_CMDR_SDIO_BLOCK;
+		} else {
+			if (data->flags & MMC_DATA_STREAM)
+				cmdr |= MCI_CMDR_STREAM;
+			else if (data->blocks > 1)
+				cmdr |= MCI_CMDR_MULTI_BLOCK;
+			else
+				cmdr |= MCI_CMDR_BLOCK;
+		}
 
 		if (data->flags & MMC_DATA_READ)
 			cmdr |= MCI_CMDR_TRDIR_READ;
-- 
1.7.3

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

* [PATCH] MMC: Fix multiblock SDIO transfers in ATMEL MCI
  2010-12-10 18:14       ` [PATCH] MMC: Fix multiblock SDIO transfers in ATMEL MCI Nicolas Ferre
  2010-12-10 17:21         ` Chris Ball
@ 2010-12-12  0:42         ` Jean-Christophe PLAGNIOL-VILLARD
  2010-12-12  1:13           ` Chris Ball
  1 sibling, 1 reply; 9+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2010-12-12  0:42 UTC (permalink / raw)
  To: linux-arm-kernel

On 19:14 Fri 10 Dec     , Nicolas Ferre wrote:
> Based on report made by Yauhen in:
> "MMC: Fix multiblock SDIO transfers in AT91 MCI" patch,
> I report those changes to the brother driver: atmel-mci.
> 
> So, this patch sets SDIO transfer types: SDIO block and SDIO byte
> transfers instead of using ordinary MMC block transfers.
> It is checking opcode for SDIO CMD53 and setting transfer
> type in MCI_CMDR register properly.
> 
> Reported-by: Yauhen Kharuzhy <yauhen.kharuzhy@promwad.com>
> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

Best Regards,
J.

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

* [PATCH] MMC: Fix multiblock SDIO transfers in ATMEL MCI
  2010-12-12  0:42         ` Jean-Christophe PLAGNIOL-VILLARD
@ 2010-12-12  1:13           ` Chris Ball
  0 siblings, 0 replies; 9+ messages in thread
From: Chris Ball @ 2010-12-12  1:13 UTC (permalink / raw)
  To: linux-arm-kernel

On Dec 12, 2010 at 01:42:03AM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > Based on report made by Yauhen in:
> > "MMC: Fix multiblock SDIO transfers in AT91 MCI" patch,
> > I report those changes to the brother driver: atmel-mci.
> > 
> > So, this patch sets SDIO transfer types: SDIO block and SDIO byte
> > transfers instead of using ordinary MMC block transfers.
> > It is checking opcode for SDIO CMD53 and setting transfer
> > type in MCI_CMDR register properly.
> > 
> > Reported-by: Yauhen Kharuzhy <yauhen.kharuzhy@promwad.com>
> > Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

Thanks, pushed to mmc-next and queued for .37/stable.

-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child

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

end of thread, other threads:[~2010-12-12  1:13 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-25 10:11 [PATCH] MMC: Fix multiblock SDIO transfers in AT91 MCI Yauhen Kharuzhy
2010-11-26 11:17 ` Nicolas Ferre
2010-12-10 15:54   ` Nicolas Ferre
2010-12-10 16:23     ` Chris Ball
2010-12-10 18:14       ` [PATCH] MMC: Fix multiblock SDIO transfers in ATMEL MCI Nicolas Ferre
2010-12-10 17:21         ` Chris Ball
2010-12-12  0:42         ` Jean-Christophe PLAGNIOL-VILLARD
2010-12-12  1:13           ` Chris Ball
2010-11-26 19:46 ` [PATCH] MMC: Fix multiblock SDIO transfers in AT91 MCI Jean-Christophe PLAGNIOL-VILLARD

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).