From patchwork Wed Oct 10 16:03:19 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 12153 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 E253923F58 for ; Wed, 10 Oct 2012 16:03:55 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id 81BD0A188B3 for ; Wed, 10 Oct 2012 16:03:55 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id e10so1165324iej.11 for ; Wed, 10 Oct 2012 09:03:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:mime-version:content-type :x-gm-message-state; bh=9CllX3XLIKlgQpzuvwt0BEIYxLK9r6GDrIDXdfQ/dj0=; b=SQ3JnMd8bcmbrRXjKqT0L3Nvu/NafNGnVUSNAz94aFcL80ytAWFGuhyMCTCBUmbInX I94hYS4tfvICqVo0Zkv6CDOJadaASo5tlQ9plUpYkZovSotRK3CRw0lGalwjgifwVrre 2Hn522m4EkKkbD6ebAmV+ccB7DNmYb8qHI7Y0/AbCbtG9P7MWIQ/FUyVeoeiE/9XMOpe 3KSbdHsL/ZcLS8m2xFnQCYK2aDTAamux7QH4qHpZbx9bwGRUNagtf4z5nl2vLGAhUWsr KLC2TcBeyfCa/2x05IxVP7HAUSJqqjYjx7kn6GrrLVAAik2KpLStRBZhwh2PsP3MbKmo HCXA== Received: by 10.50.152.137 with SMTP id uy9mr5712251igb.62.1349885035312; Wed, 10 Oct 2012 09:03:55 -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.50.67.148 with SMTP id n20csp246111igt; Wed, 10 Oct 2012 09:03:54 -0700 (PDT) Received: by 10.14.173.131 with SMTP id v3mr33741797eel.15.1349885033535; Wed, 10 Oct 2012 09:03:53 -0700 (PDT) Received: from eu1sys200aog117.obsmtp.com (eu1sys200aog117.obsmtp.com [207.126.144.143]) by mx.google.com with SMTP id f43si1370777eem.90.2012.10.10.09.03.48 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 10 Oct 2012 09:03:53 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.143 is neither permitted nor denied by best guess record for domain of ulf.hansson@stericsson.com) client-ip=207.126.144.143; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.143 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-eu.st.com ([164.129.1.35]) (using TLSv1) by eu1sys200aob117.postini.com ([207.126.147.11]) with SMTP ID DSNKUHWcYIL3rzfKVWqgO4gGT7mxHUTsX1I6@postini.com; Wed, 10 Oct 2012 16:03:53 UTC Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id C02631DE; Wed, 10 Oct 2012 16:03:24 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 4C4CD1ED5; Wed, 10 Oct 2012 16:03:24 +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 6C940A8093; Wed, 10 Oct 2012 18:03:17 +0200 (CEST) Received: from steludxu1397.lud.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.1) with Microsoft SMTP Server (TLS) id 8.3.83.0; Wed, 10 Oct 2012 18:03:23 +0200 From: Ulf Hansson To: , Chris Ball Cc: , Russell King , Linus Walleij , Ulf Hansson Subject: [RESEND PATCH 1/2] mmc: mmci: Fix incorrect handling of HW flow control for SDIO Date: Wed, 10 Oct 2012 18:03:19 +0200 Message-ID: <1349885000-22887-1-git-send-email-ulf.hansson@stericsson.com> X-Mailer: git-send-email 1.7.10 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQmJsdonfpLMu5zyplcRWt1UZreKxmYoj/lN3irpFBgEMriMaKdyqMi4ec298EA6LFxuBMSE From: Ulf Hansson For data writes <= 8 bytes, HW flow control was disabled but never re-enabled when the transfer was completed. This meant that a following read request would give buffer overrun errors. Signed-off-by: Ulf Hansson --- drivers/mmc/host/mmci.c | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index edc3e9b..877079e 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c @@ -654,9 +654,29 @@ static void mmci_start_data(struct mmci_host *host, struct mmc_data *data) /* The ST Micro variants has a special bit to enable SDIO */ if (variant->sdio && host->mmc->card) - if (mmc_card_sdio(host->mmc->card)) + if (mmc_card_sdio(host->mmc->card)) { + /* + * The ST Micro variants has a special bit + * to enable SDIO. + */ + u32 clk; + datactrl |= MCI_ST_DPSM_SDIOEN; + /* + * The ST Micro variant for SDIO transfer sizes + * less then 8 bytes should have clock H/W flow + * control disabled. + */ + if ((host->size < 8) && + (data->flags & MMC_DATA_WRITE)) + clk = host->clk_reg & ~variant->clkreg_enable; + else + clk = host->clk_reg | variant->clkreg_enable; + + mmci_write_clkreg(host, clk); + } + /* * Attempt to use DMA operation mode, if this * should fail, fall back to PIO mode @@ -877,22 +897,6 @@ static int mmci_pio_write(struct mmci_host *host, char *buffer, unsigned int rem count = min(remain, maxcnt); /* - * The ST Micro variant for SDIO transfer sizes - * less then 8 bytes should have clock H/W flow - * control disabled. - */ - if (variant->sdio && - mmc_card_sdio(host->mmc->card)) { - u32 clk; - if (count < 8) - clk = host->clk_reg & ~variant->clkreg_enable; - else - clk = host->clk_reg | variant->clkreg_enable; - - mmci_write_clkreg(host, clk); - } - - /* * SDIO especially may want to send something that is * not divisible by 4 (as opposed to card sectors * etc), and the FIFO only accept full 32-bit writes.