Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3334695imu; Sun, 11 Nov 2018 12:37:05 -0800 (PST) X-Google-Smtp-Source: AJdET5cFnaszxAWqRNQg7e1KjgQPUuWXwIm/W/37XWKPKHtaAQp4NaFBvIODXusF1MESX3ij0Bgn X-Received: by 2002:a17:902:32a4:: with SMTP id z33-v6mr16933142plb.168.1541968625286; Sun, 11 Nov 2018 12:37:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541968625; cv=none; d=google.com; s=arc-20160816; b=J5O+FqxJ9mQYvL5/Eiu6QoOwJkg1c3Fi8BkVMpHbRaMTwnaEd+k8swQUhwmD2dT+U+ 2qBsSq6fc3vuyNPz527AUmm7UkrO+3G0OmQKbTjBBedQCSXPpiwCb72tgXR57junqx3I BzgP11DexeSX9GibByEfgE+SdCVVUMQ+sCDt8C822WLcAQruIwMLDKMxsCdwjC2SqzWf JxTdmSjY3aC0BGzdEzvPbVb8/2RBZaXqk3ouAYA4d/3cISxMgxHftJ8/Izj976rB2kD0 XDg4BR8wugvrbRTGEufMsgtE71gQiG3PnffBoGiI5uerHWtVFHcqmkzKhhBZvt8C/cxw wI1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=iTkQAp71SZGMzBBlki38BnX0gFyRgyCoGkP8IQuwRJ0=; b=T8ZplVn7nc757XFxvOto1S87KR20TOLf4FNde1YOsD5ZOKWvOjdU7OMNIK6TGWgE3p yhSkD2FvK7SuvpYaI0ZJM7Q7+pQ6JG1mRGRWlVB1uCpLamtVBDdjrev75WxEBbdiv+vF t070tpLv8hIajaU/LrGzdWAs+ZsrE0xdoFGLpJuJMeFwImZxGeVsnJQo5ztYbCvXDryc DkOAWGoDQNSjks162EOSPsMHVW5j7WxV5BCC+eXRO91TR0VbwGKDPzsWFI1JuzRwTaw9 nlhkvV/jCGl7fhMWsss/FBTJXtSFxqS5E1iCio0N80viMETUS2lnkMSLkJvKEbrVj4Vo fFVA== ARC-Authentication-Results: i=1; mx.google.com; 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 v10si16031606pgg.510.2018.11.11.12.36.50; Sun, 11 Nov 2018 12:37:05 -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; 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 S1731734AbeKLGYx (ORCPT + 99 others); Mon, 12 Nov 2018 01:24:53 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:49908 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730193AbeKLFsN (ORCPT ); Mon, 12 Nov 2018 00:48:13 -0500 Received: from [192.168.4.242] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gLvsZ-0000l7-8v; Sun, 11 Nov 2018 19:58:43 +0000 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1gLvsW-0001iF-2p; Sun, 11 Nov 2018 19:58:40 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Ulf Hansson" , "Stefan Agner" Date: Sun, 11 Nov 2018 19:49:05 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 241/366] mmc: sdhci-esdhc-imx: allow 1.8V modes without 100/200MHz pinctrl states In-Reply-To: X-SA-Exim-Connect-IP: 192.168.4.242 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.61-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Stefan Agner commit 92748beac07c471d995fbec642b63572dc01b3dc upstream. If pinctrl nodes for 100/200MHz are missing, the controller should not select any mode which need signal frequencies 100MHz or higher. To prevent such speed modes the driver currently uses the quirk flag SDHCI_QUIRK2_NO_1_8_V. This works nicely for SD cards since 1.8V signaling is required for all faster modes and slower modes use 3.3V signaling only. However, there are eMMC modes which use 1.8V signaling and run below 100MHz, e.g. DDR52 at 1.8V. With using SDHCI_QUIRK2_NO_1_8_V this mode is prevented. When using a fixed 1.8V regulator as vqmmc-supply the stack has no valid mode to use. In this tenuous situation the kernel continuously prints voltage switching errors: mmc1: Switching to 3.3V signalling voltage failed Avoid using SDHCI_QUIRK2_NO_1_8_V and prevent faster modes by altering the SDHCI capability register. With that the stack is able to select 1.8V modes even if no faster pinctrl states are available: # cat /sys/kernel/debug/mmc1/ios ... timing spec: 8 (mmc DDR52) signal voltage: 1 (1.80 V) ... Link: http://lkml.kernel.org/r/20180628081331.13051-1-stefan@agner.ch Signed-off-by: Stefan Agner Fixes: ad93220de7da ("mmc: sdhci-esdhc-imx: change pinctrl state according to uhs mode") Signed-off-by: Ulf Hansson [bwh: Backported to 3.16: - There is no SDHCI_SUPPORT_HS400 flag to clear - Adjust context] Signed-off-by: Ben Hutchings --- --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -261,6 +261,15 @@ static u32 esdhc_readl_le(struct sdhci_h val = SDHCI_SUPPORT_DDR50 | SDHCI_SUPPORT_SDR104 | SDHCI_SUPPORT_SDR50 | SDHCI_USE_SDR50_TUNING; + + /* + * Do not advertise faster UHS modes if there are no + * pinctrl states for 100MHz/200MHz. + */ + if (IS_ERR_OR_NULL(imx_data->pins_100mhz) || + IS_ERR_OR_NULL(imx_data->pins_200mhz)) + val &= ~(SDHCI_SUPPORT_SDR50 | SDHCI_SUPPORT_DDR50 + | SDHCI_SUPPORT_SDR104); } } @@ -1108,15 +1117,6 @@ static int sdhci_esdhc_imx_probe(struct ESDHC_PINCTRL_STATE_100MHZ); imx_data->pins_200mhz = pinctrl_lookup_state(imx_data->pinctrl, ESDHC_PINCTRL_STATE_200MHZ); - if (IS_ERR(imx_data->pins_100mhz) || - IS_ERR(imx_data->pins_200mhz)) { - dev_warn(mmc_dev(host->mmc), - "could not get ultra high speed state, work on normal mode\n"); - /* fall back to not support uhs by specify no 1.8v quirk */ - host->quirks2 |= SDHCI_QUIRK2_NO_1_8_V; - } - } else { - host->quirks2 |= SDHCI_QUIRK2_NO_1_8_V; } err = sdhci_add_host(host);