All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicolas Ferre <nicolas.ferre@atmel.com>
To: Yauhen Kharuzhy <yauhen.kharuzhy@promwad.com>,
	Chris Ball <cjb@laptop.org>
Cc: linux-arm-kernel@lists.infradead.org, linux-mmc@vger.kernel.org
Subject: Re: [PATCH] MMC: Fix multiblock SDIO transfers in AT91 MCI
Date: Fri, 26 Nov 2010 12:17:21 +0100	[thread overview]
Message-ID: <4CEF9741.1010007@atmel.com> (raw)
In-Reply-To: <1290679911-5992-1-git-send-email-yauhen.kharuzhy@promwad.com>

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


WARNING: multiple messages have this Message-ID (diff)
From: nicolas.ferre@atmel.com (Nicolas Ferre)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] MMC: Fix multiblock SDIO transfers in AT91 MCI
Date: Fri, 26 Nov 2010 12:17:21 +0100	[thread overview]
Message-ID: <4CEF9741.1010007@atmel.com> (raw)
In-Reply-To: <1290679911-5992-1-git-send-email-yauhen.kharuzhy@promwad.com>

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

  reply	other threads:[~2010-11-26 11:19 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-25 10:11 [PATCH] MMC: Fix multiblock SDIO transfers in AT91 MCI Yauhen Kharuzhy
2010-11-25 10:11 ` Yauhen Kharuzhy
2010-11-26 11:17 ` Nicolas Ferre [this message]
2010-11-26 11:17   ` Nicolas Ferre
2010-12-10 15:54   ` Nicolas Ferre
2010-12-10 15:54     ` Nicolas Ferre
2010-12-10 16:23     ` Chris Ball
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 18:14         ` Nicolas Ferre
2010-12-10 17:21         ` Chris Ball
2010-12-10 17:21           ` Chris Ball
2010-12-12  0:42         ` Jean-Christophe PLAGNIOL-VILLARD
2010-12-12  0:42           ` Jean-Christophe PLAGNIOL-VILLARD
2010-12-12  1:13           ` Chris Ball
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
2010-11-26 19:46   ` Jean-Christophe PLAGNIOL-VILLARD

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4CEF9741.1010007@atmel.com \
    --to=nicolas.ferre@atmel.com \
    --cc=cjb@laptop.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=yauhen.kharuzhy@promwad.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.