Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp917957imm; Wed, 4 Jul 2018 08:09:14 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcTM9O0RjWvvdmCxwASWY6zKndykEDFuVZ8JZ9Bk67OrepyLPDQZSS6YZPVbSHtYCzN8PJg X-Received: by 2002:a17:902:683:: with SMTP id 3-v6mr2501717plh.291.1530716954676; Wed, 04 Jul 2018 08:09:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530716954; cv=none; d=google.com; s=arc-20160816; b=v7rD0HhGpKfGwKGta2RnQhmVRpiW619pqYx+PopJO1IHyW1OdBQO8OoaBCejFWvhiB 1jmbbrPknLAU1Di6nZFycFR/cbvVqCtvzr1d59lc55znqE+oyLSG6sg/uSYPWAy/X4I/ NHyAl+rBL6YHHGRGeiajAFbl2gace/0qb8sZ2GYHxqZq/cliA5lQKZd7I+3VjTaHIiQV jN8XkvNDBONotaIDYjc/RIlUBCWYPcvPc8AtM2W0D8Op++DHl6hh22yb3c/SSh5TiO9t MWs0sWbHyiiamlB+nIdfg6uHG8sXGus7oc4jwu0qLr2NjDqip28ykRFMV3BaEoOkJ7id lSuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=Bc6t6m7OBA3M4CoNr39md6xKDwamVrWxogMgmAw5iSo=; b=Asxc2jyjJp+dOsix57OgzUUK/jdBSaE3NeU61KeuNvsVDAz7pLVazCDtrk+AP0ddWA g6HQLzOSXuO0EgTyOOj+n/0K9dSdFTAuA/DZbj+pXdifCTFQRZoyO5gJ9pPFyyCaRIKo FGfQJe52hbl0gedcF6HnXcoeGYCUy+oviIyW7lV34QIw8NyKpaHGVDon4u7ye6MflZFT +IRdV2s3hLEEl3I7ZUu6m2ePRCJK4R7rgWESalxMLu75QRK7TXe6134jTP/KVZnZ4sqh 7084jzvdE4qBGFV+bZicPUX2l0kylChaFTerPC1du06vyP2dfiGI/8kDbRwbPbRsz/pt TSSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@agner.ch header.s=dkim header.b="Jd/WhUjE"; 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 97-v6si3677321pld.345.2018.07.04.08.08.59; Wed, 04 Jul 2018 08:09: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=@agner.ch header.s=dkim header.b="Jd/WhUjE"; 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 S1752844AbeGDPHz (ORCPT + 99 others); Wed, 4 Jul 2018 11:07:55 -0400 Received: from mail.kmu-office.ch ([178.209.48.109]:57572 "EHLO mail.kmu-office.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752218AbeGDPHy (ORCPT ); Wed, 4 Jul 2018 11:07:54 -0400 Received: from trochilidae.toradex.int (unknown [46.140.72.82]) by mail.kmu-office.ch (Postfix) with ESMTPSA id DAD2D5C02AD; Wed, 4 Jul 2018 17:07:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agner.ch; s=dkim; t=1530716873; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:content-type:content-transfer-encoding: in-reply-to:references; bh=Bc6t6m7OBA3M4CoNr39md6xKDwamVrWxogMgmAw5iSo=; b=Jd/WhUjE9VO5j7xQ3iXHTh6NMF2x8F8ZqgR0LYXT3Hs531NC66N0sY2lv92nh1trNX0YMe Sabu6Dug8VjkJt73wPy2HtN6J6SKgNxrGExMEjfPcc0thr5edRPZNXlHcQ1lyJL7xDOpPe YzJUhKmQ9A1tH30g9qbYwkXhlTWosC4= 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, Stefan Agner Subject: [PATCH v2] mmc: sdhci-esdhc-imx: allow 1.8V modes without 100/200MHz pinctrl states Date: Wed, 4 Jul 2018 17:07:45 +0200 Message-Id: <20180704150745.21003-1-stefan@agner.ch> X-Mailer: git-send-email 2.18.0 X-Spamd-Result: default: False [-2.10 / 15.00]; TO_MATCH_ENVRCPT_ALL(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)[10]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_COUNT_ZERO(0.00)[0]; MID_CONTAINS_FROM(1.00)[]; ASN(0.00)[asn:6830, ipnet:46.140.0.0/17, country:AT]; 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 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 --- 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 */ -- 2.18.0