Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2684384imj; Mon, 11 Feb 2019 07:00:58 -0800 (PST) X-Google-Smtp-Source: AHgI3IYdJLythnO1G+kYlq4bWarXRf0rVdUqbDYaaXXK7DC5F7wHjKpsQSa2oCYIEgQqaK54S8hK X-Received: by 2002:a17:902:166:: with SMTP id 93mr37959652plb.20.1549897258117; Mon, 11 Feb 2019 07:00:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549897258; cv=none; d=google.com; s=arc-20160816; b=ttSdR186417xbvnBAFxqJgiT1uu9wg4DH8GAGP5c3DUl80r2CfozpdvNI9BMALdCoT UXnArx2jUS1jr0Kv8GOactihgSGVTI7S8AxYhuo1vtf8xe3uLBod3adAjxIWJmTgA+5k fRGeTF2CEcfoLrnkFO93ueJbSMS4t7xtRqS4yRF56xql3zesjorvgU+AAp5UkCtZnl2x LD3j3E6rvdirGrKZnS4yxHgdrsl4aW/c2jiPx2i6TJ1D7HUle0eu0IGqjRECRDn4izvC YSGdUskyszKtzD0R/pvT9lxSu/yscmJuf70J+b9GmbvCLWRht+477aeBsAkvlTvKXoSl Ar0w== 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=D5c3nLw3rpzRNYchac0oOOfl22/oeKEkyl6xtAJaFJU=; b=SpomdgorZuIjUbcc+hFY2UIsDAWDmBgDBfFO3DxRqrKCA3CJNfg0fqXOSrRU39hmqJ h90+q8vQgJ30lrhkn6PIMfNlENBnLnOhSUZeQDPh4ZsTSdw/2O5Kbb+4Pv4bQFQeRbY3 Wjc9fd5XsTgLj834CQY6+EblA7kCjHbeNzcDCKuJCrJc8J2AG334TuRbZ6zlW/CafYjK h62QoT3phoREkQzFOq5MNwB5FV61EhlzWL1aYBtbOYyuMCh/n/J3WD6yyqOaQ3USea6B zdAkGpdrK9P9OQadbPpHXTYLKY52vf1ZlFtSMlUJc3Isvsjk4/a1t0DIqudDnfmAnmOo F4YA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0LJqPJxc; 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 s5si10314777pfk.97.2019.02.11.07.00.38; Mon, 11 Feb 2019 07:00:58 -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=0LJqPJxc; 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 S2389591AbfBKO6d (ORCPT + 99 others); Mon, 11 Feb 2019 09:58:33 -0500 Received: from mail.kernel.org ([198.145.29.99]:46202 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389577AbfBKO6c (ORCPT ); Mon, 11 Feb 2019 09:58:32 -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 4891A222A1; Mon, 11 Feb 2019 14:58:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549897111; bh=6caIUtnU9JP3ilrK7jee1vHIIM4pWvFZSfLqhW3zfgA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0LJqPJxc3ynFFpPya/53ArH0QZETBYbKV+AgoMJql3ZTu/Wm8Jy/uydmleti7JktC oNdOoPUSDMp9SCfOLAwC5teLOLVoCC/Tw+Zb8vIndMcYpCfZz3pXxiAGqDelvRgSE/ iRr911+TOxxxlEBeALVj5oSshC4hvc6y3eI9a530= 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.14 095/205] mmc: bcm2835: Recover from MMC_SEND_EXT_CSD Date: Mon, 11 Feb 2019 15:18:13 +0100 Message-Id: <20190211141834.843065657@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141827.214852402@linuxfoundation.org> References: <20190211141827.214852402@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.14-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