Received: by 2002:a05:7412:518d:b0:e2:908c:2ebd with SMTP id fn13csp325911rdb; Thu, 5 Oct 2023 07:09:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFPzsXFSGoGWV2dcckfjulb528Eor2d1FdH4kKkiUN/sMOLQx5M2OcEJFvYFj2nmrPq1+w8 X-Received: by 2002:a17:902:c084:b0:1c7:23c9:a7db with SMTP id j4-20020a170902c08400b001c723c9a7dbmr5080128pld.26.1696514970109; Thu, 05 Oct 2023 07:09:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696514970; cv=none; d=google.com; s=arc-20160816; b=V8EuiA1flu0FCU0Vj7mV0EEJIH0BVRFLQvXM75SGr49jI5z/BWJQP9+u7Vrtx/ACko lpQt67m/zrti4dNoDPO/S2Kh6G0MyXrStalppP8vsn9O86FGAuEyTsuoZEFSwBictkoT Kda8Nhz83EVjZXlKn74OEFBnebtLYieKgR1ijwC9Khk2/i3lNc4QMAyUUDQOoIECqUUI kbiXxi68/0MuAGFR0LprvNbQuq/CihHi+74bTDFzM7KnWD7Bc2/S33AlEPKsVIxneg4A Uc/WGsy4UBxPqLX6bP9y0NKVm/ZG70w+8XLoWXlEwmY0bJdiIF7wfAjTYjh/Yjbln6Pu giag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=naZTOLgodXSRWT4LwUJ1kL94FBBp5L5BUMYnXCMGCqU=; fh=vBnKFefFPFrDyJU1mppZP0jQUnKYIcYzbFz/qeRKvVo=; b=pcmsmhLlmdRXf27TLz6tQ6XbsQZRvwsDyudAsKoLLUzqEiLXmO2RoSiNqJxkdSgmZ9 xCJXgO1fvbol4ActvKyjWMyuQo6qwMYmrW8qHVA8TpXMUV1bKW3vqroxmOscZeBZ5yNh 6jfOciHPih8cUyVfcwruYN9AmUbA1QNn/wDI0eLL5WURRxp9i4OUL+2FSbmxO+612hnX f0uYO5Ite3gDybsNIdEqr74QLjlSMybGDbZ/2BKubg7OYs+bXlbSlGVvwqlM34rtgo6F nQI8w/npxvmWJigN/zsexzTJNOJgZtLBgC3uRswMI2edTWbunj6ag2+Z6aoylKuBQzNX j/cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="x7U/Rhmk"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id jw8-20020a170903278800b001c0953d0055si1464550plb.262.2023.10.05.07.09.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 07:09:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="x7U/Rhmk"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 1094380A49BD; Thu, 5 Oct 2023 07:09:27 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232055AbjJEOJU (ORCPT + 99 others); Thu, 5 Oct 2023 10:09:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231371AbjJEOHJ (ORCPT ); Thu, 5 Oct 2023 10:07:09 -0400 Received: from mail-yb1-xb2c.google.com (mail-yb1-xb2c.google.com [IPv6:2607:f8b0:4864:20::b2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98D7B24EB0 for ; Thu, 5 Oct 2023 04:39:06 -0700 (PDT) Received: by mail-yb1-xb2c.google.com with SMTP id 3f1490d57ef6-d81d09d883dso992769276.0 for ; Thu, 05 Oct 2023 04:39:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696505945; x=1697110745; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=naZTOLgodXSRWT4LwUJ1kL94FBBp5L5BUMYnXCMGCqU=; b=x7U/RhmkBZjrf1zvnD1trRt2eOLLMC18PzHYFzNSviiAgvLXEQGmPP1qD+C2ykUgJH np6dOOLQwC1QkdksHQC2+jkK4ISG80C2XBmLDrIeQn4LUb+NtNxbwyWqpLcUWCSYtukj S84slw9NdCr4beYAmZTANWYrLqWP5rC6FAGVxhdCtFUK//jTUEv6FZpjvzJZQwlIV2S+ 1IMUcrItX1gnh8vue22FvlzzXY2fkF5nTCHTXgXGOZyVmYppO5yN8whUOVrUNWnSe0wO CT4jBBYzjxwVcRxN7v9ILGlMSKZBPxzy+wHaKgeXGn926IXZLbUhKAdLcK6uog21dC2W 9Icg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696505945; x=1697110745; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=naZTOLgodXSRWT4LwUJ1kL94FBBp5L5BUMYnXCMGCqU=; b=YFLENKdrIbrJoS01lx11UURq659afAgZ4AeOVnWDebUr2c+9YeNTLKwOub0bHimUdn x97gzW0xEU4A+zrCJ4afHR9ggCK3emhxRR9dvUy9EzyvpmkgiPo6NwYmtshq22HsooBs +3ut5UaQoSn57BfY3rO4EJqbzwA1O9VVGKRZ/7l53bral09H+CGxzR9CbGopFBZPS2t/ bm4KJ/AxfxTJqgyM2GTxcTxVO9LlQRgolC+B/BE4gWVyL/TOl9VlK5j1TbFG/0UMEl/j OmDP7Fb651YJfywwZC/bT+QzN6OpiZDlkIeLDHmiEhqLT40PQfCql5wy+fh1W/kVMfzd r0pg== X-Gm-Message-State: AOJu0YwdhBLoNlJJhMlobt9yvWyguYvXhG3z0Kln3ogXOeLB2PeedVOj nDV5e/4PLGfjSKXOy1UqWV3/KZ2LhGulp/z7IBebEg== X-Received: by 2002:a25:aac8:0:b0:d85:b07d:e2f8 with SMTP id t66-20020a25aac8000000b00d85b07de2f8mr4797738ybi.15.1696505945569; Thu, 05 Oct 2023 04:39:05 -0700 (PDT) MIME-Version: 1.0 References: <20230915094351.11120-1-victorshihgli@gmail.com> <20230915094351.11120-21-victorshihgli@gmail.com> In-Reply-To: <20230915094351.11120-21-victorshihgli@gmail.com> From: Ulf Hansson Date: Thu, 5 Oct 2023 13:38:29 +0200 Message-ID: Subject: Re: [PATCH V12 20/23] mmc: sdhci-uhs2: add add_host() and others to set up the driver To: Victor Shih Cc: adrian.hunter@intel.com, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, benchuanggli@gmail.com, HL.Liu@genesyslogic.com.tw, Greg.tu@genesyslogic.com.tw, takahiro.akashi@linaro.org, dlunev@chromium.org, Ben Chuang , Victor Shih Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 05 Oct 2023 07:09:27 -0700 (PDT) On Fri, 15 Sept 2023 at 11:44, Victor Shih wrote: > > From: Victor Shih > > This is a UHS-II version of sdhci's add_host/remove_host operation. > Any sdhci drivers which are capable of handling UHS-II cards must > call those functions instead of the corresponding sdhci's. > > Signed-off-by: Ben Chuang > Signed-off-by: AKASHI Takahiro > Signed-off-by: Victor Shih > Acked-by: Adrian Hunter [...] Just a few nitpicks, see below. > +static void __sdhci_uhs2_add_host_v4(struct sdhci_host *host, u32 caps1) > +{ > + struct mmc_host *mmc; > + u32 max_current_caps2; > + > + mmc = host->mmc; > + > + /* Support UHS2 */ > + if (caps1 & SDHCI_SUPPORT_UHS2) > + mmc->caps2 |= MMC_CAP2_SD_UHS2; > + > + max_current_caps2 = sdhci_readl(host, SDHCI_MAX_CURRENT_1); > + > + if ((caps1 & SDHCI_CAN_VDD2_180) && > + !max_current_caps2 && > + !IS_ERR(mmc->supply.vmmc2)) { > + /* UHS2 - VDD2 */ > + int curr = regulator_get_current_limit(mmc->supply.vmmc2); As I also stated in another reply, please use vqmmc2 instead, which we added in patch4. > + > + if (curr > 0) { > + /* convert to SDHCI_MAX_CURRENT format */ > + curr = curr / 1000; /* convert to mA */ > + curr = curr / SDHCI_MAX_CURRENT_MULTIPLIER; > + curr = min_t(u32, curr, SDHCI_MAX_CURRENT_LIMIT); > + max_current_caps2 = curr; > + } > + } > + > + if (!(caps1 & SDHCI_CAN_VDD2_180)) > + mmc->caps2 &= ~MMC_CAP2_SD_UHS2; > +} > + > +static int sdhci_uhs2_host_ops_init(struct sdhci_host *host); Please try to re-order the code so this declaration isn't needed. > + > +static void __sdhci_uhs2_remove_host(struct sdhci_host *host, int dead) > +{ > + if (!sdhci_uhs2_mode(host)) > + return; > + > + if (!dead) > + sdhci_uhs2_reset(host, SDHCI_UHS2_SW_RESET_FULL); > +} > + [...] Kind regards Uffe