Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2760938imj; Mon, 11 Feb 2019 08:05:28 -0800 (PST) X-Google-Smtp-Source: AHgI3IY9/0Zb4ePzQWeBy9xfnD8yO4rJwaDOFkk1+M+CjhkrQXZXnEpDc95GnSe1BlrE0xAAPxsW X-Received: by 2002:a62:4549:: with SMTP id s70mr37035609pfa.233.1549901128248; Mon, 11 Feb 2019 08:05:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549901128; cv=none; d=google.com; s=arc-20160816; b=j4GkMZovsl+896EdlKnewbp/7i+noNqRWqW+Dpc+aJXxyns8S2P7MJiGwMMw1WyDQg gjIzJ4Q6+V72S9IjvZTKwbmg9qvYMajJB4E2DkBjogXO45kwGZegyzyqahiXoNjqkdPC CRdceF3J7SN6Sr8rzA/WPkVXZr/V+l9doTNVRfJJXO1fsE7q9JTlLMRm3f928oj1xIeC 4k1c4RqlMGWySOgz6HRO2P98Gjob2GsHP+xdPIJCO54M6/TIn6izpb0s+uJITTiq5zKt vdLCE7Irq9c06ENxEf2KvrZUBfy8bj/tI8WhCMGqHuCFpfdPgEBbp47LXJIs7ujhpZAd xtLA== 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=xb5KA2jNJT6KTzqcGnSDTfEePUL22NOykZqYS4AvXVI=; b=PYhX0KdolzbSdgwjKbN9IoiJlhtiIk6B2mziZrLiIA8FoAPwLyw0bc7WDrWMPTdX1E x7G/ZE0jcilLkU5ddTj4pJWNYN3K7uXMdAq02KqqdY2K7POfjY9f5Gl9KR4X7HZ0lbj7 8rHNDLljjxmArdezUbq7X1Nbr1l59Or2/R5w5fuIgQansBkrNgNcRE7gflhDNSy8p4N1 0qSTJVZZlzUQhwKREKOv7BDCA6Y97p7xne10qyvMLmENP8fMdCk8rIfwb88I16TpNNmp dSo8fb2Ok454hwBjDZUr3lU+aGdq06BOTJf2rdVusmuUX6vEL4pQoDtVk+cljvkoiLmf tzFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kADsh8XY; 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 c26si9318831pfd.2.2019.02.11.08.05.05; Mon, 11 Feb 2019 08:05:28 -0800 (PST) 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=kADsh8XY; 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 S1729907AbfBKO27 (ORCPT + 99 others); Mon, 11 Feb 2019 09:28:59 -0500 Received: from mail.kernel.org ([198.145.29.99]:34938 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729285AbfBKO24 (ORCPT ); Mon, 11 Feb 2019 09:28:56 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.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 7D4BC20844; Mon, 11 Feb 2019 14:28:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549895336; bh=j6whXEggQGT6S3iQzMFHWke+1dNQktF2/ADkD5gXDCc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kADsh8XYnEo95whRcqsjqC4Y/jxRfiBtqIYWngambOC6Ktjk6G/FFEadxbdYu5ufw nPV5nt+ria3i5uLwKhvsXSiDWp3uFQRM74lmR0EoPi2yE3yrGDngVpePFiBLbIKaOX ePTpR5qk1H3+QGVvo76bQgbnlQRhl04Q68CFKFow= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Phil Elwell , Stefan Wahren , Eric Anholt , Ulf Hansson , Sasha Levin Subject: [PATCH 4.20 171/352] mmc: bcm2835: Recover from MMC_SEND_EXT_CSD Date: Mon, 11 Feb 2019 15:16:38 +0100 Message-Id: <20190211141857.933311139@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 07d405769afea5718529fc9e341f0b13b3189b6f ] If the user issues an "mmc extcsd read", the SD controller receives what it thinks is a SEND_IF_COND command with an unexpected data block. The resulting operations leave the FSM stuck in READWAIT, a state which persists until the MMC framework resets the controller, by which point the root filesystem is likely to have been unmounted. A less heavyweight solution is to detect the condition and nudge the FSM by asserting the (self-clearing) FORCE_DATA_MODE bit. Link: https://github.com/raspberrypi/linux/issues/2728 Signed-off-by: Phil Elwell Signed-off-by: Stefan Wahren Acked-by: Eric Anholt Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin --- drivers/mmc/host/bcm2835.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/mmc/host/bcm2835.c b/drivers/mmc/host/bcm2835.c index 0d3b7473bc21..abf1f3c8b0c3 100644 --- a/drivers/mmc/host/bcm2835.c +++ b/drivers/mmc/host/bcm2835.c @@ -772,6 +772,8 @@ static void bcm2835_finish_command(struct bcm2835_host *host) if (!(sdhsts & SDHSTS_CRC7_ERROR) || (host->cmd->opcode != MMC_SEND_OP_COND)) { + u32 edm, fsm; + if (sdhsts & SDHSTS_CMD_TIME_OUT) { host->cmd->error = -ETIMEDOUT; } else { @@ -780,6 +782,13 @@ static void bcm2835_finish_command(struct bcm2835_host *host) bcm2835_dumpregs(host); host->cmd->error = -EILSEQ; } + edm = readl(host->ioaddr + SDEDM); + fsm = edm & SDEDM_FSM_MASK; + if (fsm == SDEDM_FSM_READWAIT || + fsm == SDEDM_FSM_WRITESTART1) + /* Kick the FSM out of its wait */ + writel(edm | SDEDM_FORCE_DATA_MODE, + host->ioaddr + SDEDM); bcm2835_finish_request(host); return; } -- 2.19.1