From patchwork Wed Jan 29 22:38:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 23910 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f69.google.com (mail-qa0-f69.google.com [209.85.216.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 013AA20300 for ; Wed, 29 Jan 2014 22:38:39 +0000 (UTC) Received: by mail-qa0-f69.google.com with SMTP id w8sf5006397qac.4 for ; Wed, 29 Jan 2014 14:38:39 -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=k75hJSyn/KNrggPvsc2LEDtp+zlMbRN9bSRAYxSDns2ktHgL3O+gjMMBVcGu4wxjpf L8E26kr6UfEWTny7sh92NXccMJKNZP7k19+8RIRHfPabMFH+NvoEUitJ1b4svf3i/DHA uL+k0k2KwpV4hGn7K/5zJ089Y5KKkUon57uMTnj9IkzOFKnOdKxi9xcgDRTZp2wuHiP4 SeIsQTpkgBggWOU+y9YQxRF68ITf2Q0HXLPXBRnJVoPvUsFwOuUZ6yvhQ3/0dCHe9nm5 yYM3PqO7saxQTordaf6WCnQZlYmLk9ZhAK5JQs9CLAndSnq4owMIdEtBi4/UN19KIH3X cGlQ== X-Gm-Message-State: ALoCoQktOMRoHRvQI+3y8Q0CmSTHPhZXj85Ej2s/45i40u6R9C9atLNyF+jJIYP9NyS5TLjrA1tf X-Received: by 10.236.118.12 with SMTP id k12mr3782259yhh.35.1391035119018; Wed, 29 Jan 2014 14:38:39 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.87.202 with SMTP id r68ls330654qgd.50.gmail; Wed, 29 Jan 2014 14:38:38 -0800 (PST) X-Received: by 10.52.170.241 with SMTP id ap17mr7286468vdc.13.1391035118891; Wed, 29 Jan 2014 14:38:38 -0800 (PST) Received: from mail-vb0-f46.google.com (mail-vb0-f46.google.com [209.85.212.46]) by mx.google.com with ESMTPS id a15si1255756vew.7.2014.01.29.14.38.38 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 29 Jan 2014 14:38:38 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.46 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.46; Received: by mail-vb0-f46.google.com with SMTP id o19so1554820vbm.5 for ; Wed, 29 Jan 2014 14:38:38 -0800 (PST) X-Received: by 10.52.108.40 with SMTP id hh8mr52206vdb.51.1391035118825; Wed, 29 Jan 2014 14:38:38 -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 u4csp152495vcz; Wed, 29 Jan 2014 14:38:38 -0800 (PST) X-Received: by 10.112.11.170 with SMTP id r10mr6727844lbb.23.1391035115720; Wed, 29 Jan 2014 14:38:35 -0800 (PST) Received: from mail-la0-f42.google.com (mail-la0-f42.google.com [209.85.215.42]) by mx.google.com with ESMTPS id vr3si1962896lbb.151.2014.01.29.14.38.35 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 29 Jan 2014 14:38:35 -0800 (PST) Received-SPF: neutral (google.com: 209.85.215.42 is neither permitted nor denied by best guess record for domain of ulf.hansson@linaro.org) client-ip=209.85.215.42; Received: by mail-la0-f42.google.com with SMTP id hr13so2025326lab.1 for ; Wed, 29 Jan 2014 14:38:35 -0800 (PST) X-Received: by 10.152.28.73 with SMTP id z9mr3509158lag.29.1391035114936; Wed, 29 Jan 2014 14:38:34 -0800 (PST) Received: from linaro-ulf.lan (90-231-160-185-no158.tbcn.telia.com. [90.231.160.185]) by mx.google.com with ESMTPSA id wt2sm3998221lbb.2.2014.01.29.14.38.33 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 29 Jan 2014 14:38:34 -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 12/13] mmc: mmci: Handle CMD irq before DATA irq Date: Wed, 29 Jan 2014 23:38:04 +0100 Message-Id: <1391035085-2747-13-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1391035085-2747-1-git-send-email-ulf.hansson@linaro.org> References: <1391035085-2747-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.212.46 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);