From patchwork Wed Sep 4 17:54:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 172949 Delivered-To: patch@linaro.org Received: by 2002:ac9:5c4b:0:0:0:0:0 with SMTP id r11csp1046782ocp; Wed, 4 Sep 2019 11:09:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqxh1DN3nlmdr0EEa65xgP+yiMRSjm0ZNuhanByqHmIYixrv3gCukd9Hb8IaXQ3Uh/c2KHh9 X-Received: by 2002:a17:902:4303:: with SMTP id i3mr43851117pld.30.1567620459625; Wed, 04 Sep 2019 11:07:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567620459; cv=none; d=google.com; s=arc-20160816; b=CQFG+6GPGzDdc1NizvJnSRAWPExodTrk0P/TeH+YQQTHMZo32kSErFgHoSJFSM3w0z aAxDVG93BPy/Br6jA7C18zRJuWk62Q/9lUuBsi2mMmjyG6ByzFNhCr7eDDKaT/LejItm asWdD2STsgoUq3AVaTpJ0nfTCDD6t+GG652fQMMzuPLLe/MDxaaxAQ6Ajma2gK+7wGD1 p7jFb8qTSzWU3ddunbauh4w4MquEAZC1altcWNWo+jokNSx6+f02eXcfx5gYkUtsg8iR F5NCf0WidRhKcdt8dut8ewhy/qlPn2IJUSwTdwQ7o2+C2BwWHezw4zVfRpUZeoD8/b4U /5JQ== 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=WsVCmhbIAfzBiSkhDfbATs/v+o1QQnEXOMIRluvJSJw=; b=ABmdzilKnL+rkWug4ldsp9pCrkZ8RmdYqwTkCL/H1ypQRyXlZ8sXq0SHDyVrIM37n2 lnD1bRFayN5mtMiNa1X9J/HFmIRiqrdnck5ZBTqqB121BnhVPfSf6ga2q34/9BAUAI1r 4ZNnhmjYgw5DSkvJY8oC2P0UFBr90hHqkPxCQ2ll97bE8ErYCIJ/hLY1EoFYt/EQwuHy lh/gTogIEiTLbVcLnYyIjYvjfcfsraU4/PJ2tuCzQM+3+EIiyEqVdpvewidk+JbfN11W RGiJclKdiLnmsvU0MNVqiryD5mSCIavSbxTzTahtJWmjE+2iTEj3Y+k1sU+qGm3Gqr0c IliA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MOI1rfJy; 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 b19si2834426pjo.55.2019.09.04.11.07.39; Wed, 04 Sep 2019 11:07:39 -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=MOI1rfJy; 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 S2389508AbfIDSHi (ORCPT + 28 others); Wed, 4 Sep 2019 14:07:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:50096 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389470AbfIDSHf (ORCPT ); Wed, 4 Sep 2019 14:07:35 -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 922F12087E; Wed, 4 Sep 2019 18:07:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567620454; bh=DAi0C6swFcMcd//mMOcVxSAobHTZG8k4cKETahqWwl8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MOI1rfJyY+/Ag64L+eiKpHqhQmDct6gIiILf74EpouDGig3I4OFkaLNubHT1SZrKX lB2VqxkntpGUiOf2CZ2ylNQsc7/Ytm1Kd3R7ueAhkgUedyXPniwnCInCC9orqIPbS7 LPyEExZMMRXWfH58h5jgWXshkjJpHlqeej9uVwhE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Philip Langdale , Ulf Hansson , Manuel Presnitz Subject: [PATCH 4.19 64/93] mmc: core: Fix init of SD cards reporting an invalid VDD range Date: Wed, 4 Sep 2019 19:54:06 +0200 Message-Id: <20190904175308.500855452@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190904175302.845828956@linuxfoundation.org> References: <20190904175302.845828956@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ulf Hansson commit 72741084d903e65e121c27bd29494d941729d4a1 upstream. The OCR register defines the supported range of VDD voltages for SD cards. However, it has turned out that some SD cards reports an invalid voltage range, for example having bit7 set. When a host supports MMC_CAP2_FULL_PWR_CYCLE and some of the voltages from the invalid VDD range, this triggers the core to run a power cycle of the card to try to initialize it at the lowest common supported voltage. Obviously this fails, since the card can't support it. Let's fix this problem, by clearing invalid bits from the read OCR register for SD cards, before proceeding with the VDD voltage negotiation. Cc: stable@vger.kernel.org Reported-by: Philip Langdale Signed-off-by: Ulf Hansson Reviewed-by: Philip Langdale Tested-by: Philip Langdale Tested-by: Manuel Presnitz Signed-off-by: Greg Kroah-Hartman --- drivers/mmc/core/sd.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c @@ -1277,6 +1277,12 @@ int mmc_attach_sd(struct mmc_host *host) goto err; } + /* + * Some SD cards claims an out of spec VDD voltage range. Let's treat + * these bits as being in-valid and especially also bit7. + */ + ocr &= ~0x7FFF; + rocr = mmc_select_voltage(host, ocr); /*