From patchwork Tue Sep 27 07:46:08 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 4357 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id BDFDE23EFB for ; Tue, 27 Sep 2011 07:46:30 +0000 (UTC) Received: from mail-fx0-f52.google.com (mail-fx0-f52.google.com [209.85.161.52]) by fiordland.canonical.com (Postfix) with ESMTP id B2F1EA184D5 for ; Tue, 27 Sep 2011 07:46:30 +0000 (UTC) Received: by mail-fx0-f52.google.com with SMTP id 23so9532052fxe.11 for ; Tue, 27 Sep 2011 00:46:30 -0700 (PDT) Received: by 10.223.57.17 with SMTP id a17mr7101571fah.65.1317109590634; Tue, 27 Sep 2011 00:46:30 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.152.3.234 with SMTP id f10cs63547laf; Tue, 27 Sep 2011 00:46:30 -0700 (PDT) Received: by 10.213.17.17 with SMTP id q17mr177303eba.115.1317109589901; Tue, 27 Sep 2011 00:46:29 -0700 (PDT) Received: from eu1sys200aog112.obsmtp.com (eu1sys200aog112.obsmtp.com. [207.126.144.133]) by mx.google.com with SMTP id v12si6776515eej.132.2011.09.27.00.46.25 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 27 Sep 2011 00:46:29 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.133 is neither permitted nor denied by best guess record for domain of ulf.hansson@stericsson.com) client-ip=207.126.144.133; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.133 is neither permitted nor denied by best guess record for domain of ulf.hansson@stericsson.com) smtp.mail=ulf.hansson@stericsson.com Received: from beta.dmz-ap.st.com ([138.198.100.35]) (using TLSv1) by eu1sys200aob112.postini.com ([207.126.147.11]) with SMTP ID DSNKToF/T9Wxf9wjglrpDHql/bXVSTdMwylr@postini.com; Tue, 27 Sep 2011 07:46:29 UTC Received: from zeta.dmz-ap.st.com (ns6.st.com [138.198.234.13]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 6CF5A123; Tue, 27 Sep 2011 07:37:52 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 60EA19D6; Tue, 27 Sep 2011 07:46:20 +0000 (GMT) Received: from exdcvycastm003.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm003", Issuer "exdcvycastm003" (not verified)) by relay2.stm.gmessaging.net (Postfix) with ESMTPS id 143B2A807E; Tue, 27 Sep 2011 09:46:16 +0200 (CEST) Received: from localhost.localdomain (10.230.100.153) by smtp.stericsson.com (10.230.100.1) with Microsoft SMTP Server (TLS) id 8.3.83.0; Tue, 27 Sep 2011 09:46:19 +0200 From: Ulf Hansson To: , Cc: Russell King , Ulf Hansson , Lee Jones , Stefan Nilsson XK Subject: [PATCH 1/4] mmc: mmci: Bugfix in pio read for small packets Date: Tue, 27 Sep 2011 09:46:08 +0200 Message-ID: <1317109568-17905-1-git-send-email-ulf.hansson@stericsson.com> X-Mailer: git-send-email 1.7.5.4 MIME-Version: 1.0 From: Stefan Nilsson XK Corrects a bug in pio read when reading packets < 4 bytes. These small packets are only relevant for SDIO transfers. Signed-off-by: Ulf Hansson Signed-off-by: Stefan Nilsson XK --- drivers/mmc/host/mmci.c | 19 ++++++++++++++++++- 1 files changed, 18 insertions(+), 1 deletions(-) diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index 40e4c05..8831b2f 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c @@ -776,7 +776,24 @@ static int mmci_pio_read(struct mmci_host *host, char *buffer, unsigned int rema if (count <= 0) break; - readsl(base + MMCIFIFO, ptr, count >> 2); + /* + * SDIO especially may want to receive something that is + * not divisible by 4 (as opposed to card sectors + * etc). Therefore make sure we always read the last bytes + * out of the FIFO. + */ + switch (count) { + case 1: + case 3: + readsb(base + MMCIFIFO, ptr, count); + break; + case 2: + readsw(base + MMCIFIFO, ptr, 1); + break; + default: + readsl(base + MMCIFIFO, ptr, count >> 2); + break; + } ptr += count; remain -= count;