Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp927956imm; Wed, 4 Jul 2018 08:19:13 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdIQJdjghftEho5Xx87X20PfCOuK86k8IOiZrv1XUf1uR99h4eq1CZwgHoz/lVIMqYgoqw6 X-Received: by 2002:a62:23d1:: with SMTP id q78-v6mr2582777pfj.179.1530717553029; Wed, 04 Jul 2018 08:19:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530717553; cv=none; d=google.com; s=arc-20160816; b=k2sA0tSFCEXYLSNpjvlKH6e7HwbSvXVZVF8/VQi5/Uw4K/y+6FNiv4mx9ke0ZafMvz Lw+4P/hlSqHrSs9Ra1KR+5yEIaeIRMUBdIcie/thzrFXjZJb0N2ocSxhpOhOO3zvDvrh u+pC3AYCUnTxuIzf1owCigPBmZvYJLLWPloOdm0VyIbzmKDOL+71MkHHKXJtTfbeXWC+ UXwLje4Xcz6aTmiY4Oiie4FyjPrwqiFf46okbyT7cNxjE/CMiULGsWo7/PsqaWatY65p k3htTR9pi3/I+XmQyWnavW9OnrlwmUFDT/Bgb9Gph4Pu8DLBeeEekNZxWM9zE7U6VW7G qlbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature:arc-authentication-results; bh=JGblaBr6sob28U6hVnYV5ySgV1comTQAEG+kVmRsIf8=; b=JMQGe9FeTydHwmX54JiKxyEmNXB51zXiNJnpP6VD/j165fkQ3McRvRzljhk89elv4F d6DNBdPzPh/cv6szhDtby1AM8TaOFPFqA51C076M1Y1gVjO6b5/FEwvZaw1Af2N9MiXy Rxjk3EB6M1264XbgAQn7wxTouuNksKtxyoaam5H4MIWH6M2vXBjnEOSoZxjKm9hidsL/ ceqJSLke93wjRYwBHjU+lpwdpVAc2FV1sTwd4z3Jins39iF9xctkuiPySbyQNbbArtuN zmhP2Vim9nf+EaYTY4gSj1ONViVjU+IlnRGuYGvQr8b8EBs9dAS6ErU2AsLVURi7AMI2 UZTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@agner.ch header.s=dkim header.b=fa10OSSm; 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 w5-v6si3524401plz.438.2018.07.04.08.18.58; Wed, 04 Jul 2018 08:19:12 -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=@agner.ch header.s=dkim header.b=fa10OSSm; 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 S1752611AbeGDPSU (ORCPT + 99 others); Wed, 4 Jul 2018 11:18:20 -0400 Received: from mail.kmu-office.ch ([178.209.48.109]:57724 "EHLO mail.kmu-office.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752145AbeGDPST (ORCPT ); Wed, 4 Jul 2018 11:18:19 -0400 Received: from webmail.kmu-office.ch (unknown [IPv6:2a02:418:6a02::a3]) by mail.kmu-office.ch (Postfix) with ESMTPSA id 01FDC5C015F; Wed, 4 Jul 2018 17:18:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agner.ch; s=dkim; t=1530717497; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JGblaBr6sob28U6hVnYV5ySgV1comTQAEG+kVmRsIf8=; b=fa10OSSmPPmzQ/0jXMprApYrTATN+zyEyRg34POkvT/Ip2ag4Gw8ix34PXodAJ9SWUOmT2 +MZsSTjbiD+nim1QWenIxc2Ut/FERBflFACfUkcP9dq/bitG4tLzSzl52ts7U3L0MmVL+4 JGSHPtU+PB5eXsQk85JYt+pLD6iEEFo= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Date: Wed, 04 Jul 2018 17:18:15 +0200 From: Stefan Agner To: adrian.hunter@intel.com, ulf.hansson@linaro.org Cc: fabio.estevam@nxp.com, haibo.chen@nxp.com, aisheng.dong@nxp.com, michael@amarulasolutions.com, rmk+kernel@armlinux.org.uk, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] mmc: sdhci-esdhc-imx: allow 1.8V modes without 100/200MHz pinctrl states In-Reply-To: <20180704150745.21003-1-stefan@agner.ch> References: <20180704150745.21003-1-stefan@agner.ch> Message-ID: X-Sender: stefan@agner.ch User-Agent: Roundcube Webmail/1.3.4 X-Spamd-Result: default: False [-3.10 / 15.00]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; BAYES_HAM(-3.00)[100.00%]; TAGGED_RCPT(0.00)[kernel]; MIME_GOOD(-0.10)[text/plain]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_SEVEN(0.00)[9]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[]; RCVD_COUNT_ZERO(0.00)[0]; ASN(0.00)[asn:29691, ipnet:2a02:418::/29, country:CH]; TO_DN_NONE(0.00)[]; RCVD_TLS_ALL(0.00)[]; ARC_NA(0.00)[] Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04.07.2018 17:07, Stefan Agner wrote: > 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 > --- Btw, I still get the switching error once during boot-up: mmc1: Switching to 3.3V signalling voltage failed This is due to the call from mmc_set_initial_signal_voltage. It is a bit unfortunate since this is printed as a warning. Not sure if that could be prevented somehow? -- Stefan > drivers/mmc/host/sdhci-esdhc-imx.c | 21 +++++++++------------ > 1 file changed, 9 insertions(+), 12 deletions(-) > > diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c > b/drivers/mmc/host/sdhci-esdhc-imx.c > index 20a420b765b3..e96d969ab2c3 100644 > --- a/drivers/mmc/host/sdhci-esdhc-imx.c > +++ b/drivers/mmc/host/sdhci-esdhc-imx.c > @@ -312,6 +312,15 @@ static u32 esdhc_readl_le(struct sdhci_host *host, int reg) > > if (imx_data->socdata->flags & ESDHC_FLAG_HS400) > val |= SDHCI_SUPPORT_HS400; > + > + /* > + * 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 | SDHCI_SUPPORT_HS400); > } > } > > @@ -1157,18 +1166,6 @@ sdhci_esdhc_imx_probe_dt(struct platform_device *pdev, > 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 supporting uhs by specifying no > - * 1.8v quirk > - */ > - host->quirks2 |= SDHCI_QUIRK2_NO_1_8_V; > - } > - } else { > - host->quirks2 |= SDHCI_QUIRK2_NO_1_8_V; > } > > /* call to generic mmc_of_parse to support additional capabilities */