Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1021592ybe; Wed, 4 Sep 2019 11:16:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqyNQLt0KYmjSbJsNGXPTK99ubl0dhiK0+iIAHmoufS4VwOsz9QR1OdNLomcL9yjhzOtZBd5 X-Received: by 2002:a17:902:96a:: with SMTP id 97mr41863236plm.264.1567620959913; Wed, 04 Sep 2019 11:15:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567620959; cv=none; d=google.com; s=arc-20160816; b=utzUF3zeuL2CeZ481ccP3wdRbi4rKpIr5UoKwii3n7T8aclYVk/fWe4D8s4DnYxWms In6amwE8sxupo9n0FnqPRgjx5O7/fdI/gBouiHYJBie0wGO2bkSWiW9fdSPWpoadJa7d SLIgl4ywbAuLYTXAo9jwawB48ecg/9LVbnOq3gALWr9fxKMA58695YUnaE0tP4WxU8jR zeGKKEgh6CB3flzML3Yh73stAHKdi3+wsD1kUSi4jW3HXG4buURFL3HUminsLeIiaVP6 24TK0oeukXKBktZ450JW0wFBmNhyrhePXo+Qgd9jZdtrAAUPzVZOozEmyWszK0fzcNOU lDCA== 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=0oTSEfQofQ5jo58Sz06lJfxPSTEEQEGpm5nI+oYJ+yc=; b=ogr+xD9gEE4dbOdwq0GqqSjZ11YsWL3CnYX3pXH64jui64hSo2GD3wapMKzzV/Is7Z TYA4rOANoFRi85qaVF4Gs3I8T1WclF/YWaCj7fTfUVxhRqHB13cSYYpAtI0y93ecwJOV 8pvNTC7qeXJIPetGB91KHyHv6Ejc83LaFz14PiHp2V45sXXyobQlghca5W1RyZDBfw5C uRVsvO4Pb+B0URogLLjb/Z/f/NIqINITHsvo7k9YJZF1qraD6NEOrsPFkEaH9SIl9uxr guB6qSXJXQWj8GnvxWfKtQEdhpk5jznVDmcmZq9OwAydftrhr/rJjwrM/wGoAwUCjmQi K0Ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Q0gmUIjh; 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 h136si15762562pfe.256.2019.09.04.11.15.44; Wed, 04 Sep 2019 11:15:59 -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=Q0gmUIjh; 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 S2390641AbfIDSNP (ORCPT + 99 others); Wed, 4 Sep 2019 14:13:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:57920 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390637AbfIDSNN (ORCPT ); Wed, 4 Sep 2019 14:13:13 -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 8C6D122CEA; Wed, 4 Sep 2019 18:13:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567620793; bh=e4VEkKiQELvj7Z6AAa95aiGEQyZjhunkkdsvdZzpoo8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q0gmUIjhao0S0JdrOJsQcjF6V6r+0e1r6Tcw18evvsxdb8vh56jMXiUSxSHg9wv5b hHJk86G/RXUciac/EFz1ckKIoxpkQ2ctMF8ZZs9FeEKATMxZdPegoExQIsPK8wI/x0 +bnj+6CI2dufSg0x6mAhQFgpY1xUTscAMKaeDUF4= 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 5.2 095/143] mmc: core: Fix init of SD cards reporting an invalid VDD range Date: Wed, 4 Sep 2019 19:53:58 +0200 Message-Id: <20190904175317.892860511@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190904175314.206239922@linuxfoundation.org> References: <20190904175314.206239922@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: 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 @@ -1292,6 +1292,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); /*