Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2523130yba; Mon, 15 Apr 2019 13:31:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqym1DJe6MkizB6KBkuAYMc5nBltix9/Qnx9adlMKdQoONz23VVNi2rOf+CgNvPg8AJxhA0K X-Received: by 2002:a17:902:56e:: with SMTP id 101mr27916100plf.142.1555360298526; Mon, 15 Apr 2019 13:31:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555360298; cv=none; d=google.com; s=arc-20160816; b=uDoBYq6NAY8BDnvFS7huPWKamyw2ykjUQfWOdYJke8ht3rg7eAGtXmLwfXaAWEZuXh wXnlky4Utcfj8PC/YvyNU2aJhXFDlPup2fcIfttxz3x2Z1wfmSWEGBg+6ogHu8y9b018 uZkVQk83E3DC91Nh/Us5HE/6PGEXQJihGTeS/nnX2lYnA18OYnhi+EAkF/DOTra2UVzQ cCuruEQd1DSJHTVm8yC8iv6xA2+ReSs/l7GvgJ5rZ23tQm+6M6ylWg9jtj690bYF4nnh 5YS8xsGrcR2ws1xyFLvddeHGs3IRjFwm/Vg0J9TtFmovho/0q7LxpJs45sWYwsCWkpLF EySw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=13xeLrodgFaqUSo2l0EUAHKn/gyiK+h8d2pj4BslLF0=; b=H9j45bbtSr/7sI8M3mbcKDhjX7M4bm6r3KBVjLYRJa8wdlegoOm1/9rU9cJRF91uKX C4wY4/FRUGv2fp6o8ZkU+1RJhNivTg3mPsytl78tgiCRGuYIPJzAP+60Dpr3cD/WzbwV xMN8nCP0OkOQRPAzWwkz8mq2ZS9XDJGpya6PLnh6X6sLxPoIQoVF5XnTF8RhXOkaE5GQ hbQiZLHmhwn4Z6Lz0ePLpiBgjFGN7YEEOb3zqVZRT4j/i4f0npStmdhxDgG5P9w0mKZ3 mqVh7wth87vM4jpn6FkLk61LsG4Go4YNxy+ekxx7Ak/GrFQERjRtO5eYSDUpnWTnkqcT gmnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jV1oVgxx; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ba5si15884748plb.24.2019.04.15.13.31.22; Mon, 15 Apr 2019 13:31:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jV1oVgxx; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731024AbfDOTMb (ORCPT + 99 others); Mon, 15 Apr 2019 15:12:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:49834 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731401AbfDOTM2 (ORCPT ); Mon, 15 Apr 2019 15:12:28 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 97F8C218FE; Mon, 15 Apr 2019 19:12:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555355547; bh=yERuPivEkKib14P3HfVOLixesCoQ19t41shFONiA1yU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jV1oVgxx0HdYQPXySLncax2roUw4zYw+P+GO0wdENmuGBS9PyqwBghnPV/y8IJ0Fy c19V3/j5grmd/+0gS45t2UDUOE1SSAFLNM7iKDCT/BS/00S9v1u1PbgLE/AKrImVON HYbXJ65JP5Vrv/PWDfQtdRCo8QQ8KxCBprPEmSsg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Faiz Abbas , Adrian Hunter , Ulf Hansson Subject: [PATCH 5.0 061/117] mmc: sdhci-omap: Dont finish_mrq() on a command error during tuning Date: Mon, 15 Apr 2019 21:00:31 +0200 Message-Id: <20190415183748.030474659@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190415183744.887851196@linuxfoundation.org> References: <20190415183744.887851196@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Faiz Abbas commit 5c41ea6d52003b5bc77c2a82fd5ca7d480237d89 upstream. commit 5b0d62108b46 ("mmc: sdhci-omap: Add platform specific reset callback") skips data resets during tuning operation. Because of this, a data error or data finish interrupt might still arrive after a command error has been handled and the mrq ended. This ends up with a "mmc0: Got data interrupt 0x00000002 even though no data operation was in progress" error message. Fix this by adding a platform specific callback for sdhci_irq. Mark the mrq as a failure but wait for a data interrupt instead of calling finish_mrq(). Fixes: 5b0d62108b46 ("mmc: sdhci-omap: Add platform specific reset callback") Signed-off-by: Faiz Abbas Acked-by: Adrian Hunter Cc: stable@vger.kernel.org Signed-off-by: Ulf Hansson Signed-off-by: Greg Kroah-Hartman --- drivers/mmc/host/sdhci-omap.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) --- a/drivers/mmc/host/sdhci-omap.c +++ b/drivers/mmc/host/sdhci-omap.c @@ -797,6 +797,43 @@ void sdhci_omap_reset(struct sdhci_host sdhci_reset(host, mask); } +#define CMD_ERR_MASK (SDHCI_INT_CRC | SDHCI_INT_END_BIT | SDHCI_INT_INDEX |\ + SDHCI_INT_TIMEOUT) +#define CMD_MASK (CMD_ERR_MASK | SDHCI_INT_RESPONSE) + +static u32 sdhci_omap_irq(struct sdhci_host *host, u32 intmask) +{ + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); + struct sdhci_omap_host *omap_host = sdhci_pltfm_priv(pltfm_host); + + if (omap_host->is_tuning && host->cmd && !host->data_early && + (intmask & CMD_ERR_MASK)) { + + /* + * Since we are not resetting data lines during tuning + * operation, data error or data complete interrupts + * might still arrive. Mark this request as a failure + * but still wait for the data interrupt + */ + if (intmask & SDHCI_INT_TIMEOUT) + host->cmd->error = -ETIMEDOUT; + else + host->cmd->error = -EILSEQ; + + host->cmd = NULL; + + /* + * Sometimes command error interrupts and command complete + * interrupt will arrive together. Clear all command related + * interrupts here. + */ + sdhci_writel(host, intmask & CMD_MASK, SDHCI_INT_STATUS); + intmask &= ~CMD_MASK; + } + + return intmask; +} + static struct sdhci_ops sdhci_omap_ops = { .set_clock = sdhci_omap_set_clock, .set_power = sdhci_omap_set_power, @@ -807,6 +844,7 @@ static struct sdhci_ops sdhci_omap_ops = .platform_send_init_74_clocks = sdhci_omap_init_74_clocks, .reset = sdhci_omap_reset, .set_uhs_signaling = sdhci_omap_set_uhs_signaling, + .irq = sdhci_omap_irq, }; static int sdhci_omap_set_capabilities(struct sdhci_omap_host *omap_host)