From patchwork Wed Sep 4 17:54:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 172943 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp257880ilq; Wed, 4 Sep 2019 11:02:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqwnY1jN3ykUkDR5RQ6qw3DBuHzl/3MKbdVUutMlGNdSBDa8gDPbFK0Trn+V+TUvH7z6n3j5 X-Received: by 2002:aa7:8005:: with SMTP id j5mr3557599pfi.50.1567620134998; Wed, 04 Sep 2019 11:02:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567620134; cv=none; d=google.com; s=arc-20160816; b=iDwZfji8knTfbNcIpsA17sY1j5NJ3RGJib1cyhMdd9EyaXVDm7kIzpH/vnOrQZVgEQ WgYQNhG+RlX0bjJJCQKZ+DPzGEeTfgwUhKWUwjYiCQ2o+yaOAS0/8LsAJXy4s+SEKZZG HmeXanKIk0K/hy5Sn+8lCyjP4x6guKbZexlewYprtgNfO4TknJ1biKWBiEnPBA/dMu9c iUEm9nJGFjBZ7qwRv2Aw9USC0ETrzYNhcer1RQ8DI4C+iwO+Q7cIUlHSCcG5jvk+gPZr hr0t3LLgHIDYpnzN0aW3AX94ewZdTrxV16MjmIucNcSNKoWjAiCcdR5xjo8N3As04Mxt Yeaw== 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=FGdRgD40TZw9PNqE0FD3HPdez6QtdeBCEG5VW9pWDnk=; b=a9pjqR5YZZEkjL7YbhmUFHXPJ4UPeq+4LJyfYgFVu7/zPN3bXjdouRSP5p5snwFRZI ouktXCE0YiDRWXcPkK248BA03Gf550tM8M92mpNfRKAalMwFcqGbwyPClFkrcJlODUQg HEJ3gX8eaN8G+SglTpIks24//KpF9QDivvpVthfECdfZMwvgdEf44cWriLxtFUhYEE7J dKTAOEXQuYhOMyKgLtlK4R+pEz7NRWTlZrgCXIARNKb/TdXAoyZcfLA5M8+8o3/A7F8R HxcSAAYYlItBy3NyP7gjvEEUUVstDmv6DsStBFn2mI4l6qrT7m4omeqi/QjnzehtQN82 gIlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gh7Sv+3x; 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 b3si706926pfo.123.2019.09.04.11.02.14; Wed, 04 Sep 2019 11:02:14 -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=gh7Sv+3x; 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 S2388717AbfIDSCN (ORCPT + 28 others); Wed, 4 Sep 2019 14:02:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:41956 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388701AbfIDSCK (ORCPT ); Wed, 4 Sep 2019 14:02:10 -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 036EB22CF5; Wed, 4 Sep 2019 18:02:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567620129; bh=8XGpZNUio1W7mgwl+llBK/s9QyI+imtyhJPb9C6TdJc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gh7Sv+3xsf/+uvYYw6mnvTPJQeUai6iK8IpM0i1If+9bmPjG7F09F+FsTU9TSJdr3 +PodMzFCmazL3nPNm8pA4ImAF4dLBf8oqXCWdTFnuQqZ7ZzDb3Apcjs7JnKVjGApHA 9v9QE/qXEJIzttBhsQ2wkkqfsMvWt/Qw94oVVMUI= 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.9 75/83] mmc: core: Fix init of SD cards reporting an invalid VDD range Date: Wed, 4 Sep 2019 19:54:07 +0200 Message-Id: <20190904175310.199461467@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190904175303.488266791@linuxfoundation.org> References: <20190904175303.488266791@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 @@ -1259,6 +1259,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); /*