From patchwork Wed Dec 8 09:33:06 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sahitya Tummala X-Patchwork-Id: 390272 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oB89XgjX001541 for ; Wed, 8 Dec 2010 09:34:07 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754468Ab0LHJeF (ORCPT ); Wed, 8 Dec 2010 04:34:05 -0500 Received: from wolverine02.qualcomm.com ([199.106.114.251]:2055 "EHLO wolverine02.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754335Ab0LHJeE (ORCPT ); Wed, 8 Dec 2010 04:34:04 -0500 X-IronPort-AV: E=McAfee;i="5400,1158,6190"; a="65727072" Received: from pdmz-ns-mip.qualcomm.com (HELO mostmsg01.qualcomm.com) ([199.106.114.10]) by wolverine02.qualcomm.com with ESMTP/TLS/ADH-AES256-SHA; 08 Dec 2010 01:33:56 -0800 Received: from stummala-linux.in.qualcomm.com (pdmz-snip-v218.qualcomm.com [192.168.218.1]) by mostmsg01.qualcomm.com (Postfix) with ESMTPA id 5C5E710004D2; Wed, 8 Dec 2010 01:33:46 -0800 (PST) From: Sahitya Tummala To: cjb@laptop.org, dwalker@codeaurora.org, linux-mmc@vger.kernel.org Cc: san@google.com, linux-arm-msm@vger.kernel.org, Sahitya Tummala Subject: [PATCH V2 4/5] mmc: msm_sdcc: Fix bug in PIO mode when data size is not word aligned Date: Wed, 8 Dec 2010 15:03:06 +0530 Message-Id: <1291800787-24757-4-git-send-email-stummala@codeaurora.org> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1291800787-24757-1-git-send-email-stummala@codeaurora.org> References: <1291800787-24757-1-git-send-email-stummala@codeaurora.org> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Wed, 08 Dec 2010 09:34:07 +0000 (UTC) diff --git a/drivers/mmc/host/msm_sdcc.c b/drivers/mmc/host/msm_sdcc.c index 81ed16f..9badc51 100644 --- a/drivers/mmc/host/msm_sdcc.c +++ b/drivers/mmc/host/msm_sdcc.c @@ -613,6 +613,9 @@ msmsdcc_pio_read(struct msmsdcc_host *host, char *buffer, unsigned int remain) uint32_t *ptr = (uint32_t *) buffer; int count = 0; + if (remain % 4) + remain = ((remain >> 2) + 1) << 2; + while (msmsdcc_readl(host, MMCISTATUS) & MCI_RXDATAAVLBL) { *ptr = msmsdcc_readl(host, MMCIFIFO + (count % MCI_FIFOSIZE)); ptr++; @@ -633,13 +636,14 @@ msmsdcc_pio_write(struct msmsdcc_host *host, char *buffer, char *ptr = buffer; do { - unsigned int count, maxcnt; + unsigned int count, maxcnt, sz; maxcnt = status & MCI_TXFIFOEMPTY ? MCI_FIFOSIZE : MCI_FIFOHALFSIZE; count = min(remain, maxcnt); - writesl(base + MMCIFIFO, ptr, count >> 2); + sz = count % 4 ? (count >> 2) + 1 : (count >> 2); + writesl(base + MMCIFIFO, ptr, sz); ptr += count; remain -= count;