From patchwork Wed Jan 22 15:00:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 23537 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pb0-f69.google.com (mail-pb0-f69.google.com [209.85.160.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 08509218CB for ; Wed, 22 Jan 2014 15:00:46 +0000 (UTC) Received: by mail-pb0-f69.google.com with SMTP id md12sf1041300pbc.8 for ; Wed, 22 Jan 2014 07:00:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=vLWZxmBII5PZARScbR/2AdLdwVYnCK19QbzkrUrCBag=; b=gYeAPLQTovk2mlk+39sGIqiN8jTAtmUy9HaococWb44cASQNsb1l1zU4wY4ZF5dk8T 5KbQYMKqMFr4dRiGAHatNVJU/naivktvyyMiymoD+m4sOaxwLgFoSxVr4Vgb4h6PB0OC byjKZddF7NJi3m30HAo5ieCqpXfl4m3eKi9+vQ3xV4cz1K8Y+StSfOoHNcHopZOKBmbz sFXyIbBxq0gnb/7+O42Th7M1b53QNH/w5Asiz6sdTIluFY4J/iVC8XFlq+6QEVMyaMKF bkv4xx4Yr/hStnFqIoXJOavlmSJApMKZNMledhnHqOJ0uLtYPi5FIXAT2KrXIkks9msa htyA== X-Gm-Message-State: ALoCoQkUag2HwH+Pa86v+wUzAPRLiEsUfDG+qSTLVuoWpC5s0Ilnqb1Goy5NZjtcf/o2KZhcEyfI X-Received: by 10.66.228.67 with SMTP id sg3mr688837pac.25.1390402846240; Wed, 22 Jan 2014 07:00:46 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.102.49 with SMTP id v46ls58195qge.6.gmail; Wed, 22 Jan 2014 07:00:46 -0800 (PST) X-Received: by 10.58.69.20 with SMTP id a20mr1269647veu.0.1390402846101; Wed, 22 Jan 2014 07:00:46 -0800 (PST) Received: from mail-vc0-f174.google.com (mail-vc0-f174.google.com [209.85.220.174]) by mx.google.com with ESMTPS id us10si4683508vcb.134.2014.01.22.07.00.45 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 22 Jan 2014 07:00:46 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.174 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.174; Received: by mail-vc0-f174.google.com with SMTP id im17so281114vcb.33 for ; Wed, 22 Jan 2014 07:00:45 -0800 (PST) X-Received: by 10.220.159.4 with SMTP id h4mr1224709vcx.1.1390402845908; Wed, 22 Jan 2014 07:00:45 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp190337vcz; Wed, 22 Jan 2014 07:00:45 -0800 (PST) X-Received: by 10.194.110.135 with SMTP id ia7mr2231781wjb.5.1390402844499; Wed, 22 Jan 2014 07:00:44 -0800 (PST) Received: from mail-we0-f171.google.com (mail-we0-f171.google.com [74.125.82.171]) by mx.google.com with ESMTPS id lr5si6887374wjb.138.2014.01.22.07.00.44 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 22 Jan 2014 07:00:44 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.171 is neither permitted nor denied by best guess record for domain of ulf.hansson@linaro.org) client-ip=74.125.82.171; Received: by mail-we0-f171.google.com with SMTP id w61so406631wes.16 for ; Wed, 22 Jan 2014 07:00:43 -0800 (PST) X-Received: by 10.194.22.196 with SMTP id g4mr2077322wjf.86.1390402843857; Wed, 22 Jan 2014 07:00:43 -0800 (PST) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id dd3sm15401824wjb.9.2014.01.22.07.00.42 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 22 Jan 2014 07:00:43 -0800 (PST) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Chris Ball Cc: Dong Aisheng , Stephen Warren , Vladimir Zapolskiy , Adrian Hunter , Ulf Hansson , Russell King , Johan Rudholm Subject: [PATCH 09/10] mmc: mmci: Handle CMD irq before DATA irq Date: Wed, 22 Jan 2014 16:00:23 +0100 Message-Id: <1390402824-9850-10-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1390402824-9850-1-git-send-email-ulf.hansson@linaro.org> References: <1390402824-9850-1-git-send-email-ulf.hansson@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ulf.hansson@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.174 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , In case of a read operation both MCI_CMDRESPEND and MCI_DATAEND can be set in the status register when entering the interrupt handler. This is due to that the card start sending data before the host has acknowledged the command response. To resolve the issue for this scenario, we must start by handling the CMD irq instead of the DATA irq. The reason is beacuse the completion of the DATA irq will not respect the current command and then causing it to be garbled. Cc: Russell King Cc: Johan Rudholm Signed-off-by: Ulf Hansson --- drivers/mmc/host/mmci.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index f320579..1a4b153 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c @@ -1144,16 +1144,17 @@ static irqreturn_t mmci_irq(int irq, void *dev_id) dev_dbg(mmc_dev(host->mmc), "irq0 (data+cmd) %08x\n", status); + cmd = host->cmd; + if (status & (MCI_CMDCRCFAIL|MCI_CMDTIMEOUT|MCI_CMDSENT| + MCI_CMDRESPEND) && cmd) + mmci_cmd_irq(host, cmd, status); + data = host->data; if (status & (MCI_DATACRCFAIL|MCI_DATATIMEOUT|MCI_STARTBITERR| MCI_TXUNDERRUN|MCI_RXOVERRUN|MCI_DATAEND| MCI_DATABLOCKEND) && data) mmci_data_irq(host, data, status); - cmd = host->cmd; - if (status & (MCI_CMDCRCFAIL|MCI_CMDTIMEOUT|MCI_CMDSENT|MCI_CMDRESPEND) && cmd) - mmci_cmd_irq(host, cmd, status); - ret = 1; } while (status);