From patchwork Tue Jul 12 10:17:07 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "elen.song" X-Patchwork-Id: 104336 X-Patchwork-Delegate: afleming@freescale.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 82A6DB6F7A for ; Tue, 12 Jul 2011 20:17:36 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8EE7528090; Tue, 12 Jul 2011 12:17:33 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oBLnRYThWda5; Tue, 12 Jul 2011 12:17:33 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 63AFE28088; Tue, 12 Jul 2011 12:17:29 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0135228088 for ; Tue, 12 Jul 2011 12:17:26 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id eRDhFoOGdD4k for ; Tue, 12 Jul 2011 12:17:23 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from sjogate2.atmel.com (newsmtp5.atmel.com [204.2.163.5]) by theia.denx.de (Postfix) with ESMTP id 114E828084 for ; Tue, 12 Jul 2011 12:17:21 +0200 (CEST) Received: from penbh01.corp.atmel.com ([10.168.5.31]) by sjogate2.atmel.com (8.13.6/8.13.6) with ESMTP id p6CAE2tw025206; Tue, 12 Jul 2011 03:14:03 -0700 (PDT) Received: from penmb01.corp.atmel.com ([10.168.5.33]) by penbh01.corp.atmel.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 12 Jul 2011 18:17:08 +0800 Received: from localhost.localdomain ([10.217.2.52]) by penmb01.corp.atmel.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 12 Jul 2011 18:17:08 +0800 From: "elen.song" To: u-boot@emk-elektronik.de Date: Tue, 12 Jul 2011 18:17:07 +0800 Message-Id: <1310465827-9599-1-git-send-email-elen.song@atmel.com> X-Mailer: git-send-email 1.6.3.3 X-OriginalArrivalTime: 12 Jul 2011 10:17:08.0698 (UTC) FILETIME=[DB57ABA0:01CC407C] Cc: u-boot@lists.denx.de, "elen.song" Subject: [U-Boot] [PATCH] AT91:mmc:fix multiple read/write error X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de According to datasheet,set block count before multiple read/write. Signed-off-by: elen.song --- drivers/mmc/atmel_mci.h | 9 ++++++++- drivers/mmc/gen_atmel_mci.c | 4 ++++ 2 files changed, 12 insertions(+), 1 deletions(-) diff --git a/drivers/mmc/atmel_mci.h b/drivers/mmc/atmel_mci.h index 90ab6a8..3095d22 100644 --- a/drivers/mmc/atmel_mci.h +++ b/drivers/mmc/atmel_mci.h @@ -36,7 +36,7 @@ typedef struct atmel_mci { u32 sdcr; /* 0x0c */ u32 argr; /* 0x10 */ u32 cmdr; /* 0x14 */ - u32 _18; /* 0x18 */ + u32 blkr; /* 0x18 */ u32 _1c; /* 0x1c */ u32 rspr; /* 0x20 */ u32 rspr1; /* 0x24 */ @@ -67,6 +67,7 @@ typedef struct atmel_mci { #define MMCI_SDCR 0x000c #define MMCI_ARGR 0x0010 #define MMCI_CMDR 0x0014 +#define MMCI_BLKR 0x0018 #define MMCI_RSPR 0x0020 #define MMCI_RSPR1 0x0024 #define MMCI_RSPR2 0x0028 @@ -140,6 +141,12 @@ typedef struct atmel_mci { #define MMCI_TRTYP_OFFSET 19 #define MMCI_TRTYP_SIZE 2 +/* Bitfields in BLKR */ +#define MMCI_BCNT_OFFSET 0 +#define MMCI_BCNT_SIZE 16 +#define MMCI_BLKLEN_OFFSET 16 +#define MMCI_BLKLEN_SIZE 16 + /* Bitfields in RSPRx */ #define MMCI_RSP_OFFSET 0 #define MMCI_RSP_SIZE 32 diff --git a/drivers/mmc/gen_atmel_mci.c b/drivers/mmc/gen_atmel_mci.c index f346b24..d217574 100644 --- a/drivers/mmc/gen_atmel_mci.c +++ b/drivers/mmc/gen_atmel_mci.c @@ -183,6 +183,10 @@ mci_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data) /* Figure out the transfer arguments */ cmdr = mci_encode_cmd(cmd, data, &error_flags); + if (data) + writel(MMCI_BF(BCNT, data->blocks) | + MMCI_BF(BLKLEN, mmc->read_bl_len), &mci->blkr); + /* Send the command */ writel(cmd->cmdarg, &mci->argr); writel(cmdr, &mci->cmdr);