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: 3523931 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4BA799F2D6 for ; Wed, 22 Jan 2014 15:01:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 97A30200D6 for ; Wed, 22 Jan 2014 15:00:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 045272011D for ; Wed, 22 Jan 2014 15:00:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755997AbaAVPAp (ORCPT ); Wed, 22 Jan 2014 10:00:45 -0500 Received: from mail-we0-f179.google.com ([74.125.82.179]:53606 "EHLO mail-we0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755316AbaAVPAo (ORCPT ); Wed, 22 Jan 2014 10:00:44 -0500 Received: by mail-we0-f179.google.com with SMTP id w62so394452wes.24 for ; Wed, 22 Jan 2014 07:00:43 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=vLWZxmBII5PZARScbR/2AdLdwVYnCK19QbzkrUrCBag=; b=KGUT5Wrk7GqEAmaB+0bBq9Ra5R/qGDgzpnsypa162rU6vF8/m+Gb+aSkHFDGGwQqYR gweSRehJuh7h50mxR5GJphl/2ZTwmYIEzMwio2ECLWBKm0gFneHiex89SRhf9SD+R9Mq LPi6fZ9pQ8hj0q7ogy2lYhsa5OWDf80BBDF1sYbd+w1R03oJbiZ6is5bSKwOOdc1IDuT IwQEwqyPq+fCGAI4IvX49tqxNj22z8DKHNA6x4QP3CykEVVLY+3oq19DoTBQ83GMB7y8 9iOocfbYTcpZiqFWlag7GR0I3xn/YCkOwUR8kzNGeSsJxiNeTkc/dRRLtcSKmHyxabD3 P5og== X-Gm-Message-State: ALoCoQnUhxsAztJYujXv0FJi0tSZ8joqI3OrHENQ+lt+vGdJ+q/1XOS83BnS7lI9kdR95m5k1Rkg 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> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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);