diff mbox

[v2] mmc: mxcmmc: fix SD cards not being detected sometimes.

Message ID 1351612447-18982-1-git-send-email-javier.martin@vista-silicon.com (mailing list archive)
State New, archived
Headers show

Commit Message

Javier Martin Oct. 30, 2012, 3:54 p.m. UTC
When a SD card is initialized some data transfers of 64 and 8 bytes
are issued. It seems the DMA has some problems dealing with these kind
of "short" transfers, leading sometimes to the SD card not being detected.

In order to solve this problem, do not use DMA for transfer sizes lower
than the sector size.

Signed-off-by: Javier Martin <javier.martin@vista-silicon.com>
---
Changes since v1:
 - Do not remove the check "sg->length & 3".

---
 drivers/mmc/host/mxcmmc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Sascha Hauer Nov. 2, 2012, 8:25 a.m. UTC | #1
On Tue, Oct 30, 2012 at 04:54:07PM +0100, Javier Martin wrote:
> When a SD card is initialized some data transfers of 64 and 8 bytes
> are issued. It seems the DMA has some problems dealing with these kind
> of "short" transfers, leading sometimes to the SD card not being detected.
> 
> In order to solve this problem, do not use DMA for transfer sizes lower
> than the sector size.
> 
> Signed-off-by: Javier Martin <javier.martin@vista-silicon.com>

Acked-by: Sascha Hauer <s.hauer@pengutronix.de>

Sascha

> ---
> Changes since v1:
>  - Do not remove the check "sg->length & 3".
> 
> ---
>  drivers/mmc/host/mxcmmc.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/host/mxcmmc.c b/drivers/mmc/host/mxcmmc.c
> index fc42a2e..a09637f 100644
> --- a/drivers/mmc/host/mxcmmc.c
> +++ b/drivers/mmc/host/mxcmmc.c
> @@ -240,7 +240,7 @@ static int mxcmci_setup_data(struct mxcmci_host *host, struct mmc_data *data)
>  		return 0;
>  
>  	for_each_sg(data->sg, sg, data->sg_len, i) {
> -		if (sg->offset & 3 || sg->length & 3) {
> +		if (sg->offset & 3 || sg->length & 3 || sg->length < 512) {
>  			host->do_dma = 0;
>  			return 0;
>  		}
> -- 
> 1.7.9.5
> 
>
Chris Ball Nov. 7, 2012, 7:43 p.m. UTC | #2
Hi,

On Fri, Nov 02 2012, Sascha Hauer wrote:
> On Tue, Oct 30, 2012 at 04:54:07PM +0100, Javier Martin wrote:
>> When a SD card is initialized some data transfers of 64 and 8 bytes
>> are issued. It seems the DMA has some problems dealing with these kind
>> of "short" transfers, leading sometimes to the SD card not being detected.
>> 
>> In order to solve this problem, do not use DMA for transfer sizes lower
>> than the sector size.
>> 
>> Signed-off-by: Javier Martin <javier.martin@vista-silicon.com>
>
> Acked-by: Sascha Hauer <s.hauer@pengutronix.de>

Thanks, pushed to mmc-next for 3.7.

- Chris.
diff mbox

Patch

diff --git a/drivers/mmc/host/mxcmmc.c b/drivers/mmc/host/mxcmmc.c
index fc42a2e..a09637f 100644
--- a/drivers/mmc/host/mxcmmc.c
+++ b/drivers/mmc/host/mxcmmc.c
@@ -240,7 +240,7 @@  static int mxcmci_setup_data(struct mxcmci_host *host, struct mmc_data *data)
 		return 0;
 
 	for_each_sg(data->sg, sg, data->sg_len, i) {
-		if (sg->offset & 3 || sg->length & 3) {
+		if (sg->offset & 3 || sg->length & 3 || sg->length < 512) {
 			host->do_dma = 0;
 			return 0;
 		}