Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2701089pxk; Mon, 14 Sep 2020 23:04:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZrYcD3jmD5gVJ8owrsmm0cpIT3SyXfxwMrTKCn/aX222qYtpIQiapqKNs7vfl9yshpy7I X-Received: by 2002:a17:906:bcfc:: with SMTP id op28mr12217860ejb.248.1600149862297; Mon, 14 Sep 2020 23:04:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600149862; cv=none; d=google.com; s=arc-20160816; b=emR8SnkIITAWMIcX0/4QWK2XhYfOGM2Eb6QgW7T1HIo1OwdbbK2J9zjriEULAclqFG Y02LQmg7bafWfBDSY9xbiv+1cHaxBabNLCHrcisk1+qdp2AbcdvW/oc1V5P2dM5NOPyN wRQEKbxMvCcFwJc+kZQqAjVwQ6P6Mm5wVKjhHO8t4iBZsvFvxO/W4UlbCywHCGNlkQ1j bzZz0yWszAeCGW2dR2FRnsqEiWiCOt/T/pRUr5r0WRcHB1S9wFJbKOh8+gpHNwtCyT37 /WWYrnV47nIgohmVlsrXdzMqZkUj1MCE3qydTLCQG2KlnfBvX7E970kEZPthZQ9iqJYZ hLrA== 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:content-disposition :mime-version:references:mail-followup-to:message-id:subject:cc:to :from:date:dkim-signature; bh=3G5dlwEHz8jxcNOlP2TgQ186ZfBjrtWHsDBlUo1Hw3k=; b=yAIePGpqNPHQLb3a5L+C9lhxrHXt8VkW2ZDVVB82qNg5o13BDW+uZcRE4LWpoy2xH3 vliMTrFbMAW53PTQwByyx2xATZIjy7Qq0qfiyRqob2SFI1/fvNIPwM2ux08sPse6taiK a76eyABgOZ1ysorzIlmwUj3nflxZt40ChpQEuS4w5we6tbvkRHCyAGWMXYPOhCYqKVJF WZFNz1N2jjBIcOP9/NC60/RqRYeCJSAXENCjTid0fGpRYw/Et0Hg2dbpyMD8ZYAPSYOK cPmY2KREqOowkPkzIaIl4ZrvpXGhuO29qEwd7VmT++cpCc9C9RKJh/jYDnx1JFnN9VE0 RSKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UNJ05fV3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c8si9891983edn.87.2020.09.14.23.03.59; Mon, 14 Sep 2020 23:04:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UNJ05fV3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726130AbgIOGDS (ORCPT + 99 others); Tue, 15 Sep 2020 02:03:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726102AbgIOGDN (ORCPT ); Tue, 15 Sep 2020 02:03:13 -0400 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6447FC061788 for ; Mon, 14 Sep 2020 23:03:13 -0700 (PDT) Received: by mail-pg1-x541.google.com with SMTP id l191so1415378pgd.5 for ; Mon, 14 Sep 2020 23:03:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=3G5dlwEHz8jxcNOlP2TgQ186ZfBjrtWHsDBlUo1Hw3k=; b=UNJ05fV3weupF0D6iKfIwcdiVpGv8MrSL1c2rbJac6Nt3f7+6UmbMwr6VccZU+Vh9h AD+0IBaFkmnxgbF9oOUg8vvmGsRjCMwAaaX+PPKkemeayxnx6hBxt+JNOCPCRzM92jt+ YRPhbghLpirWL9FN3q0y4bgjLoH2IZChBoER0jGDBTMxmu3Z7ijaTffUkQR9+qK4+IGu kRlI9Q0/TzSbkiPiwf7qmnPyv3wX5dCOqouNP4/IWouUhWFEAwmIW4QWnomDiT3Vz2iT Nx4RlvpfTmYZ7OYIS/xDvYnWu3xNBKClmom1tBeO8itYf88E5lYr1v2ScFzDtxCx6CoX ibjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=3G5dlwEHz8jxcNOlP2TgQ186ZfBjrtWHsDBlUo1Hw3k=; b=Mgak8+kNe+4+ADH0xX1w7wk/qvskTs9oiuZm3aqHG+70mpLl2S5O+ahVo4Dx3ER1BK FSi9w7v9Vkot4+dmOej9Es4fHcNehw6U9QpUO8UC1TPl2/Oqr9x6u0RdOy3b16kKQcyS Ehkhd8ZvgHSRJOucWg6MOwT+Qhon4j4eYv/Ryp6QWGTZ/Af50fuGIv/XwqxMmyT9jHch gRpe3uPF+z/aBbcc7KLxodAm0XxbwxPe0SK2C0WrYoCSwZnfEgHkcWxINuCftEWEuYgL 08Ee+CXuFovCWhzWZoQN6QN1R5JSjocU1X32M3bpeCtuShPC6M9aQIjtkFIcPtQaiBg7 /Yig== X-Gm-Message-State: AOAM531W/oVQ3mbPlikIeamKItnR4HSBHeu8MZTH64v0PZvEBkDhu23D HBfEjjidIw3f8gaM7V6MbqgtBQ== X-Received: by 2002:a63:e015:: with SMTP id e21mr13839304pgh.264.1600149791083; Mon, 14 Sep 2020 23:03:11 -0700 (PDT) Received: from laputa (p784a66b9.tkyea130.ap.so-net.ne.jp. [120.74.102.185]) by smtp.gmail.com with ESMTPSA id k2sm12230516pfi.169.2020.09.14.23.03.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Sep 2020 23:03:10 -0700 (PDT) Date: Tue, 15 Sep 2020 15:03:06 +0900 From: AKASHI Takahiro To: Adrian Hunter Cc: Ben Chuang , ulf.hansson@linaro.org, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, ben.chuang@genesyslogic.com.tw, greg.tu@genesyslogic.com.tw Subject: Re: [RFC PATCH V3 13/21] mmc: sdhci: UHS-II support, skip signal_voltage_switch() Message-ID: <20200915060306.GA2860208@laputa> Mail-Followup-To: AKASHI Takahiro , Adrian Hunter , Ben Chuang , ulf.hansson@linaro.org, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, ben.chuang@genesyslogic.com.tw, greg.tu@genesyslogic.com.tw References: <20200710111104.29616-1-benchuanggli@gmail.com> <9ab64a9d-cd78-785c-b48f-561048cfe2ed@intel.com> <20200914064001.GA2743583@laputa> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Ben, Adrian, On Mon, Sep 14, 2020 at 11:08:14AM +0300, Adrian Hunter wrote: > On 14/09/20 9:40 am, AKASHI Takahiro wrote: > > Adrian, > > > > On Fri, Aug 21, 2020 at 05:09:01PM +0300, Adrian Hunter wrote: > >> On 10/07/20 2:11 pm, Ben Chuang wrote: > >>> From: AKASHI Takahiro > >>> > >>> sdhci_start_signal_voltage_switch() should be called only in UHS-I mode, > >>> and not for UHS-II mode. > >>> > >>> Signed-off-by: Ben Chuang > >>> Signed-off-by: AKASHI Takahiro > >>> --- > >>> drivers/mmc/host/sdhci.c | 7 ++++++- > >>> 1 file changed, 6 insertions(+), 1 deletion(-) > >>> > >>> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c > >>> index 5511649946b9..7f2537648a08 100644 > >>> --- a/drivers/mmc/host/sdhci.c > >>> +++ b/drivers/mmc/host/sdhci.c > >>> @@ -2623,8 +2623,13 @@ int sdhci_start_signal_voltage_switch(struct mmc_host *mmc, > >>> /* > >>> * Signal Voltage Switching is only applicable for Host Controllers > >>> * v3.00 and above. > >>> + * But for UHS2, the signal voltage is supplied by vdd2 which is > >>> + * already 1.8v so no voltage switch required. I have been confused with this comment. (I know it came from the original Intel code, not from Ben.) If this comment is true, > >>> */ > >>> - if (host->version < SDHCI_SPEC_300) > >>> + if (host->version < SDHCI_SPEC_300 || > >>> + (IS_ENABLED(CONFIG_MMC_SDHCI_UHS2) && > >>> + host->version >= SDHCI_SPEC_400 && > >>> + host->mmc->flags & MMC_UHS2_SUPPORT)) the condition above must be wrong since 'flags & MMC_UHS2_SUPPORT' is one of capabilities for a host controller, not a card while the selection of voltage depends on a card type. So I wonder why this code still works. I guess that it is because set_signal_voltage(), or other variant functions, will never be called for UHS-II cards under the current implementation. Looking at mmc_sd_init_card(), we have added some hack: mmc_sd_init_card() { ... /* For UHS2, skip the UHS-I initialization. */ if ((host->flags & MMC_UHS2_SUPPORT) && (host->flags & MMC_UHS2_INITIALIZED)) goto done; ... if (mmc_sd_card_using_v18(card)) { if (mmc_host_set_uhs_voltage(host) || mmc_sd_init_uhs_card(card)) { ... } Ben, can you confirm this? (There is another callsite of mmc_host_set_uhs_voltage() though.) > >> Please look at hooking ->start_signal_voltage_switch() instead > > > > Do you mean that you want every platform driver who wants to support UHS-II > > to set NULL to start_signal_voltage_switch hook even if this hack is > > platform agnostic? > > No, I see UHS-II as a separate layer i.e. > > UHS-II host controller driver > | | > | v > | sdhci-uhs2 e.g. sdhci_uhs2_start_signal_voltage_switch > | | > v v > sdhci e.g. sdhci_start_signal_voltage_switch > > Most things should go through sdhci-uhs2 but not nessarily everything. What I meant by my previous comment is that we don't have to call any function, sdhci_uhs2_start_signal_voltage_switch in above example, for UHS-II cards in any case since it is always simply empty. -Takahiro Akashi