Message ID | 20230921-th1520-mmc-v1-2-49f76c274fb3@baylibre.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp5355294vqi; Thu, 21 Sep 2023 23:17:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHfeogIlHdSR0799z5j3QWpdF6znfmGLMeh9Jp5/BcBVk/X4m/wFmXdaKXUUsxt3/wXxoUB X-Received: by 2002:a17:90b:19c3:b0:274:1bb1:415a with SMTP id nm3-20020a17090b19c300b002741bb1415amr7176252pjb.41.1695363421726; Thu, 21 Sep 2023 23:17:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695363421; cv=none; d=google.com; s=arc-20160816; b=QTmRmGvHt7Wc2rmWnU6YNZAMa77HOJzlXnETnHV2Wy5scJtYCjuTKu0QaWxJiJSsIN i23/mHgVJF1aHQ9hsrTH7RgxDJW+tBVf6J0Uvyac/3RgY0kM3ylsTIWy5MtPn6BFFCV1 4NPLDz/cXxUkKQtd0RqpDJ/hNt9h8KAyKFvKTI+WcLQCBTb77Xdbd0eUVcQOzU8Gdk17 bEU6u85pskyvNh9eVqqCy+4hJ1IlYs+Ij7gxzGA/xb0uLDKrwB0YDzNkHRo6lmOp8HeD fPIfcMWzBMEb1KNB6TaDmd9w0q1KrgQeqzhrPT/uUQ2aU/O4czV5spWFccEENBPw3sZb Rv0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=ixTqiGVx8ZXpjpR7y6lRGGFsz7OZ+ET+MZdQ4NUAsFY=; fh=vHR8U309XOCZR8G4JUyhb/0ihb0aVduZkDFEUxYc3iE=; b=H+W8WO2DMFbdCPOgtVkMDHnFsOfSzmQCyx1/IgMouuYEfYnO0Ag8vGCV0xv+a85jBD 7+aF2Htm67NMDe0a1tEZXQQeSE7xpM+EPW09egaM657c369Mu7UQwmyxM//iUcpPh40O hYLTF9D9DUCdRmiSetpnQvpYEW9jyq7KRWjzXr2Iy6aG1UGAxZao6AqnqtuiTmAKUF5c RqwsQekP20r/7UT5sSTAzzotyhg6eCUHkCnXoa23hJ3TQB4yQ4D8wnsfuOmp/XS3bROx K6vQ3CWGTix1fDMBD6SFPQ1ay81rXknaujBFxbkto1b6TvcJ9Gsb0/IieR5dr5JaAux+ 2bdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=0BJaoaU9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id em10-20020a17090b014a00b00271c377a534si3084072pjb.104.2023.09.21.23.17.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 23:17:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=0BJaoaU9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id E88988364D5F; Thu, 21 Sep 2023 18:51:27 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230305AbjIVBvW (ORCPT <rfc822;chrisfriedt@gmail.com> + 30 others); Thu, 21 Sep 2023 21:51:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230190AbjIVBvR (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 21 Sep 2023 21:51:17 -0400 Received: from mail-ua1-x92e.google.com (mail-ua1-x92e.google.com [IPv6:2607:f8b0:4864:20::92e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2EBCD195 for <linux-kernel@vger.kernel.org>; Thu, 21 Sep 2023 18:51:11 -0700 (PDT) Received: by mail-ua1-x92e.google.com with SMTP id a1e0cc1a2514c-7a282340fdfso694331241.0 for <linux-kernel@vger.kernel.org>; Thu, 21 Sep 2023 18:51:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1695347470; x=1695952270; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=ixTqiGVx8ZXpjpR7y6lRGGFsz7OZ+ET+MZdQ4NUAsFY=; b=0BJaoaU9XC4nRsOaixYnv7sFr6wZ+OzRUAHSrqBaxDbv1QODUjSQlNmiXQ3LqlMb9M 8Rn+AherQVkpmDua9c3SV3IlLaruQkaMlPl00dxge+ZhLpQBt8gVEO140LGysAdrgH08 sWpMUdsisqUbrNrOanobDjOOQlFYF04tgJiPd/qjw/dhdw+aRGz0oLe+ltzLrPUXMHun XaGi5dsH+PMzEWeXsyo7+tYcf5POJ+VbXP8w6Do8ILFFR/t4VmxQhTHMaH7lr16Aw6pJ z2ZQ6N7NZk182Y9wOaIVJuFj9vumFEzB8TXosPtzIny3h3i23SrmsB4+2SEBO/RLtSoN Lj1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695347470; x=1695952270; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ixTqiGVx8ZXpjpR7y6lRGGFsz7OZ+ET+MZdQ4NUAsFY=; b=b+pUsf4PdCWZn0RorvHCsRa+BPBw3lsSDILrl5zr+F5LwK/FTWXYIybVjh13BtKqBE 03nfqDeJHIbssd/tdYCI7FkBU1Gd2zcplIa9qtePJ5b51tetIfvY9s93xLviF/qcdnjk IRVSp/QhpfupshI0ZPVHfC4e5e9H1QrMbnyoOtM6jCl52iEeFegjgzdqUQxEkuDSK3hf XAtPADPzd3grlTSIXu1JIoF9HJogK3Qn4DomMG5VNPm6+AseGHJTELE9V9AnPugAp1Bq +QpxezJPfTlxz6bOBXZAksEb7aCTW/a9LLbYJgeWVP61gnsJ07fG0f/pmNEKCem4Mx6m n30w== X-Gm-Message-State: AOJu0YwrZRnNmz4WTgL34m5/AVZTThrjDyozokOOPO3RBMMm/X4oAtxM xGCXww1qGJS/OJFn+UyoI7Urig== X-Received: by 2002:a05:6102:302c:b0:44d:4d5f:79a4 with SMTP id v12-20020a056102302c00b0044d4d5f79a4mr6139892vsa.20.1695347470206; Thu, 21 Sep 2023 18:51:10 -0700 (PDT) Received: from [127.0.1.1] ([2601:1c2:1800:f680:fa26:6227:be1c:67f0]) by smtp.gmail.com with ESMTPSA id y10-20020a63b50a000000b0057412d84d25sm1973856pge.4.2023.09.21.18.51.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 18:51:09 -0700 (PDT) From: Drew Fustini <dfustini@baylibre.com> Date: Thu, 21 Sep 2023 18:49:49 -0700 Subject: [PATCH 2/6] mmc: sdhci: add __sdhci_execute_tuning() to header MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230921-th1520-mmc-v1-2-49f76c274fb3@baylibre.com> References: <20230921-th1520-mmc-v1-0-49f76c274fb3@baylibre.com> In-Reply-To: <20230921-th1520-mmc-v1-0-49f76c274fb3@baylibre.com> To: Ulf Hansson <ulf.hansson@linaro.org>, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Conor Dooley <conor+dt@kernel.org>, Jisheng Zhang <jszhang@kernel.org>, Adrian Hunter <adrian.hunter@intel.com>, Guo Ren <guoren@kernel.org>, Fu Wei <wefu@redhat.com>, Paul Walmsley <paul.walmsley@sifive.com>, Palmer Dabbelt <palmer@dabbelt.com>, Albert Ou <aou@eecs.berkeley.edu>, Conor Dooley <conor@kernel.org> Cc: Robert Nelson <robertcnelson@beagleboard.org>, Jason Kridner <jkridner@beagleboard.org>, Xi Ruoyao <xry111@xry111.site>, Han Gao <gaohan@iscas.ac.cn>, Icenowy Zheng <uwu@icenowy.me>, linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Drew Fustini <dfustini@baylibre.com> X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1695347467; l=1797; i=dfustini@baylibre.com; s=20230430; h=from:subject:message-id; bh=jbhsItAspw9Y505sHjMPZkocmfoBMXCEAbwf8HhAE8A=; b=Y7zI2YH3NQD0FaxiSQ4VnQS2RFqoHRb3cydOhAc2I8kHbSV81T3H1sj3MdzwctHhwtJlv39EH CGD7yjz/YJWDePGxpJZ2guSYNA4iKk5mDzTqvA3yDNkTUQHmVRbKFIQ X-Developer-Key: i=dfustini@baylibre.com; a=ed25519; pk=p3GKE9XFmjhwAayAHG4U108yag7V8xQVd4zJLdW0g7g= X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 21 Sep 2023 18:51:28 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777717395644225830 X-GMAIL-MSGID: 1777717395644225830 |
Series |
RISC-V: Add eMMC support for TH1520 boards
|
|
Commit Message
Drew Fustini
Sept. 22, 2023, 1:49 a.m. UTC
Expose __sdhci_execute_tuning() so that it can be called from the
mmc host controller drivers.
In the sdhci-of-dwcmshc driver, sdhci_dwcmshc_th1520_ops sets
platform_execute_tuning to th1520_execute_tuning(). That function has
to manipulate phy registers before tuning can be performed. To avoid
copying the code verbatim from __sdhci_execute_tuning() into
th1520_execute_tuning(), make it possible for __sdhci_execute_tuning()
to be called from sdhci-of-dwcmshc.
Signed-off-by: Drew Fustini <dfustini@baylibre.com>
---
drivers/mmc/host/sdhci.c | 2 +-
drivers/mmc/host/sdhci.h | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
Comments
On 22/09/23 04:49, Drew Fustini wrote: > Expose __sdhci_execute_tuning() so that it can be called from the > mmc host controller drivers. > > In the sdhci-of-dwcmshc driver, sdhci_dwcmshc_th1520_ops sets > platform_execute_tuning to th1520_execute_tuning(). That function has > to manipulate phy registers before tuning can be performed. To avoid > copying the code verbatim from __sdhci_execute_tuning() into > th1520_execute_tuning(), make it possible for __sdhci_execute_tuning() > to be called from sdhci-of-dwcmshc. > > Signed-off-by: Drew Fustini <dfustini@baylibre.com> > --- > drivers/mmc/host/sdhci.c | 2 +- > drivers/mmc/host/sdhci.h | 1 + > 2 files changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c > index ff41aa56564e..fd607058d176 100644 > --- a/drivers/mmc/host/sdhci.c > +++ b/drivers/mmc/host/sdhci.c > @@ -2841,7 +2841,7 @@ void sdhci_send_tuning(struct sdhci_host *host, u32 opcode) > } > EXPORT_SYMBOL_GPL(sdhci_send_tuning); > > -static int __sdhci_execute_tuning(struct sdhci_host *host, u32 opcode) > +int __sdhci_execute_tuning(struct sdhci_host *host, u32 opcode) Also need EXPORT_SYMBOL_GPL(__sdhci_execute_tuning); > { > int i; > > diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h > index f219bdea8f28..a20864fc0641 100644 > --- a/drivers/mmc/host/sdhci.h > +++ b/drivers/mmc/host/sdhci.h > @@ -793,6 +793,7 @@ void sdhci_set_bus_width(struct sdhci_host *host, int width); > void sdhci_reset(struct sdhci_host *host, u8 mask); > void sdhci_set_uhs_signaling(struct sdhci_host *host, unsigned timing); > int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode); > +int __sdhci_execute_tuning(struct sdhci_host *host, u32 opcode); > void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios); > int sdhci_start_signal_voltage_switch(struct mmc_host *mmc, > struct mmc_ios *ios); >
On Mon, 2023-09-25 at 13:21 +0300, Adrian Hunter wrote: > On 22/09/23 04:49, Drew Fustini wrote: > > Expose __sdhci_execute_tuning() so that it can be called from the > > mmc host controller drivers. > > > > In the sdhci-of-dwcmshc driver, sdhci_dwcmshc_th1520_ops sets > > platform_execute_tuning to th1520_execute_tuning(). That function has > > to manipulate phy registers before tuning can be performed. To avoid > > copying the code verbatim from __sdhci_execute_tuning() into > > th1520_execute_tuning(), make it possible for __sdhci_execute_tuning() > > to be called from sdhci-of-dwcmshc. > > > > Signed-off-by: Drew Fustini <dfustini@baylibre.com> > > --- > > drivers/mmc/host/sdhci.c | 2 +- > > drivers/mmc/host/sdhci.h | 1 + > > 2 files changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c > > index ff41aa56564e..fd607058d176 100644 > > --- a/drivers/mmc/host/sdhci.c > > +++ b/drivers/mmc/host/sdhci.c > > @@ -2841,7 +2841,7 @@ void sdhci_send_tuning(struct sdhci_host *host, u32 opcode) > > } > > EXPORT_SYMBOL_GPL(sdhci_send_tuning); > > > > -static int __sdhci_execute_tuning(struct sdhci_host *host, u32 opcode) > > +int __sdhci_execute_tuning(struct sdhci_host *host, u32 opcode) > > Also need > EXPORT_SYMBOL_GPL(__sdhci_execute_tuning); > > > { > > int i; By the way should we rename this function? I think "__sdhci_execute_tuning" vs "sdhci_execute_tuning" might be confusing when we export both.
On 25/09/23 13:23, Xi Ruoyao wrote: > On Mon, 2023-09-25 at 13:21 +0300, Adrian Hunter wrote: >> On 22/09/23 04:49, Drew Fustini wrote: >>> Expose __sdhci_execute_tuning() so that it can be called from the >>> mmc host controller drivers. >>> >>> In the sdhci-of-dwcmshc driver, sdhci_dwcmshc_th1520_ops sets >>> platform_execute_tuning to th1520_execute_tuning(). That function has >>> to manipulate phy registers before tuning can be performed. To avoid >>> copying the code verbatim from __sdhci_execute_tuning() into >>> th1520_execute_tuning(), make it possible for __sdhci_execute_tuning() >>> to be called from sdhci-of-dwcmshc. >>> >>> Signed-off-by: Drew Fustini <dfustini@baylibre.com> >>> --- >>> drivers/mmc/host/sdhci.c | 2 +- >>> drivers/mmc/host/sdhci.h | 1 + >>> 2 files changed, 2 insertions(+), 1 deletion(-) >>> >>> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c >>> index ff41aa56564e..fd607058d176 100644 >>> --- a/drivers/mmc/host/sdhci.c >>> +++ b/drivers/mmc/host/sdhci.c >>> @@ -2841,7 +2841,7 @@ void sdhci_send_tuning(struct sdhci_host *host, u32 opcode) >>> } >>> EXPORT_SYMBOL_GPL(sdhci_send_tuning); >>> >>> -static int __sdhci_execute_tuning(struct sdhci_host *host, u32 opcode) >>> +int __sdhci_execute_tuning(struct sdhci_host *host, u32 opcode) >> >> Also need >> EXPORT_SYMBOL_GPL(__sdhci_execute_tuning); >> >>> { >>> int i; > > By the way should we rename this function? I think > "__sdhci_execute_tuning" vs "sdhci_execute_tuning" might be confusing > when we export both. > 'name()' and '__name()' is not a particularly rare paradigm in the kernel, so it seems ok.
On Mon, Sep 25, 2023 at 01:21:05PM +0300, Adrian Hunter wrote: > On 22/09/23 04:49, Drew Fustini wrote: > > Expose __sdhci_execute_tuning() so that it can be called from the > > mmc host controller drivers. > > > > In the sdhci-of-dwcmshc driver, sdhci_dwcmshc_th1520_ops sets > > platform_execute_tuning to th1520_execute_tuning(). That function has > > to manipulate phy registers before tuning can be performed. To avoid > > copying the code verbatim from __sdhci_execute_tuning() into > > th1520_execute_tuning(), make it possible for __sdhci_execute_tuning() > > to be called from sdhci-of-dwcmshc. > > > > Signed-off-by: Drew Fustini <dfustini@baylibre.com> > > --- > > drivers/mmc/host/sdhci.c | 2 +- > > drivers/mmc/host/sdhci.h | 1 + > > 2 files changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c > > index ff41aa56564e..fd607058d176 100644 > > --- a/drivers/mmc/host/sdhci.c > > +++ b/drivers/mmc/host/sdhci.c > > @@ -2841,7 +2841,7 @@ void sdhci_send_tuning(struct sdhci_host *host, u32 opcode) > > } > > EXPORT_SYMBOL_GPL(sdhci_send_tuning); > > > > -static int __sdhci_execute_tuning(struct sdhci_host *host, u32 opcode) > > +int __sdhci_execute_tuning(struct sdhci_host *host, u32 opcode) > > Also need > EXPORT_SYMBOL_GPL(__sdhci_execute_tuning); Thank, I will add that. I wasn't sure if making __sdhci_execute_tuning() available outside of sdhci.c was going to be seen as an acceptable solution. Do you think my apporach is acceptable (once I add EXPORT_SYMBOL_GPL)? Thanks, Drew
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index ff41aa56564e..fd607058d176 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -2841,7 +2841,7 @@ void sdhci_send_tuning(struct sdhci_host *host, u32 opcode) } EXPORT_SYMBOL_GPL(sdhci_send_tuning); -static int __sdhci_execute_tuning(struct sdhci_host *host, u32 opcode) +int __sdhci_execute_tuning(struct sdhci_host *host, u32 opcode) { int i; diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index f219bdea8f28..a20864fc0641 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -793,6 +793,7 @@ void sdhci_set_bus_width(struct sdhci_host *host, int width); void sdhci_reset(struct sdhci_host *host, u8 mask); void sdhci_set_uhs_signaling(struct sdhci_host *host, unsigned timing); int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode); +int __sdhci_execute_tuning(struct sdhci_host *host, u32 opcode); void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios); int sdhci_start_signal_voltage_switch(struct mmc_host *mmc, struct mmc_ios *ios);