Message ID | 20231023-th1520-mmc-v3-2-abc5e7491166@baylibre.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce89:0:b0:403:3b70:6f57 with SMTP id p9csp1554576vqx; Mon, 23 Oct 2023 14:08:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEu7rFJ4l8zhTJX5fNQQZdq92SvVQadZqd9KD14sU7KWei4SVNaR8hJWmGEVRYAIs9ZUZHH X-Received: by 2002:a05:6a21:71c7:b0:14c:ca25:3b53 with SMTP id ay7-20020a056a2171c700b0014cca253b53mr673097pzc.27.1698095290011; Mon, 23 Oct 2023 14:08:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698095290; cv=none; d=google.com; s=arc-20160816; b=Mh7Ierd8PjR7ljI1JWppQ1CITw6vZVc+CYETKOiB6ivd2Fl6L7rjxIHYhzGMjfnKVS pEqNvlANO6WBrFus58QJoVe25o9pGIUGH0qoySOafgqwaG0YkApk0Gmyxf3fdmGjxKb0 1P2GaI8g+iP2CSDcBKRQI+4SRaTXQzvEKEYwJeYI2MBQhYZQS7RZkR6PhX+1+6hNCdc/ 60A2iNUJbk7NSvx+vN+s89BzkxMD7uRWaU1z/La4fNTKAj9zv2dvHhVzo6xZZY/mmMN+ HDl3Nvo8sTAfhYY4x8Gbr5MNs3d+YOfKtCXL9/N9rT+CHk0yqqdXPu39IKCPkOoVQckR J6fw== 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=l++Rbeq1YJ0LFMw4HKx/yirX8siQghzI93qQn3u3z5E=; fh=vHR8U309XOCZR8G4JUyhb/0ihb0aVduZkDFEUxYc3iE=; b=wOd2RNq96WM8P9PMLeA7r7V2osAZSuEzayn08UrKHwTIG13odvZOTgP8zQj1cd2OnS ZAW84gw4CQEWOCkSU37Uua1hZAAZEEFmL+9wuy8+EyJu5urGu0SHcFRDvVS6Rpd5IjEz UP4DZQKseJ91tzSI2zr+KpsBejMrCHHaQRTF40jSa0xtpryOH4kloFn5ZPsuNGpINbSK SItpr8sqtTv9bftbLtGY6BcULB8RSxuw4SAr3ue70SCb32bixX1KPmmjeixJYIXtLxWM rkMXNtRwKvn+DdOn1yLeMswqR2EBFciUp9M/l8z0+QdX+GHxis9kbImWgu8fxaC5ZzBr Fp0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=uFvndL+H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id fh30-20020a056a00391e00b006b7037ffaf7si7105156pfb.128.2023.10.23.14.08.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 14:08:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=uFvndL+H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (Postfix) with ESMTP id EE4FB80557F4; Mon, 23 Oct 2023 14:07:54 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231382AbjJWVHW (ORCPT <rfc822;aposhian.dev@gmail.com> + 27 others); Mon, 23 Oct 2023 17:07:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230197AbjJWVHP (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 23 Oct 2023 17:07:15 -0400 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C772810C0 for <linux-kernel@vger.kernel.org>; Mon, 23 Oct 2023 14:07:10 -0700 (PDT) Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-6ba172c5f3dso3089955b3a.0 for <linux-kernel@vger.kernel.org>; Mon, 23 Oct 2023 14:07:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1698095230; x=1698700030; 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=l++Rbeq1YJ0LFMw4HKx/yirX8siQghzI93qQn3u3z5E=; b=uFvndL+HtOVx0wazlcdBIIJTUJDU3maM+DndsgPAxABr6pLyBk1GnYdQbo94Femj33 yk3r6M/eZrZn8PBdRF/+AcqoNEXhV7dQfgHQ3cf5qV1sHceVMAFiQcMt2x2uxczMHDTL XRwx3FGMCK5gCM4JHXLeMyL1YderUiaNmiE9KiW8Dz/mgDY1p5yfhZZf1BmlllicduWI pd8mvqqpwfg7TO8JAapZzrDBuYMaotYZjcZ19nz8nYyyV37Ah0ICt3BqU5DYL70W/8KA ARp5GOeAx6SXuhbb8pl9miivCQsbOR5SrQHRElA1RG4FL6GwpVlSjqvUBxCskR8k8jUH 2mQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698095230; x=1698700030; 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=l++Rbeq1YJ0LFMw4HKx/yirX8siQghzI93qQn3u3z5E=; b=gjzYkmIVmdSMkjss9wFOPJpaFn0l0ZMc6zL2sYjuRrEgMHuwHotozvOUJTtkPCRhAI xsYx72inNI4i5KF8v/pzuAuljUg3f0mIy7MB/NYsuTJZpkB75s/lWPSVhFLCHuaZWu3A tUbWJLYHwAnLEAayAhkcD/lu9D3+oyBGvmm67rwOF6spiDf2zgvxsctnyzhxGMuf3S7M j4L0UC27f6nKbLwC4ykYQtifbdfj3ZJQn2oyOmRnsK+12C2uatiS8C3188XynnB/i1oV 7JxKrJND3sp/v7d4ykDbCDFBf1Vy4k/oMrITOgLQhxyUEj1UGk0uLxLmU/5VJ3JnTxJF sKyA== X-Gm-Message-State: AOJu0YxCxxtuvd+dswk2/QwDR0HjYYqA5jwreXcjM6WUu8kMIzeVuK4y RS1ew/1N9TzkvY66e2nVH+b+Qg== X-Received: by 2002:a05:6a00:134b:b0:690:422f:4f17 with SMTP id k11-20020a056a00134b00b00690422f4f17mr9329657pfu.4.1698095230237; Mon, 23 Oct 2023 14:07:10 -0700 (PDT) Received: from [127.0.1.1] ([2601:1c2:1800:f680:b9a0:8714:407c:4146]) by smtp.gmail.com with ESMTPSA id k28-20020aa79d1c000000b006bde2480806sm6573066pfp.47.2023.10.23.14.07.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 14:07:10 -0700 (PDT) From: Drew Fustini <dfustini@baylibre.com> Date: Mon, 23 Oct 2023 14:07:03 -0700 Subject: [PATCH v3 2/7] 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: <20231023-th1520-mmc-v3-2-abc5e7491166@baylibre.com> References: <20231023-th1520-mmc-v3-0-abc5e7491166@baylibre.com> In-Reply-To: <20231023-th1520-mmc-v3-0-abc5e7491166@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=1698095224; l=2057; i=dfustini@baylibre.com; s=20230430; h=from:subject:message-id; bh=O0pl7kPWnknxTc+1ciCix3vi2PmSyK8UTzQqhv8rZP0=; b=2M/0RlZn/69xiXATrzBfiSFScyxwOg2KlSuXzWRniQ5zD9O5bgp0P38TJusbwZ8FFlU4Swp9/ 0oC2SozqlS+D21SOjAte8vQCnRMpvZqWnzDIIfnnaSe57pXae58DgD5 X-Developer-Key: i=dfustini@baylibre.com; a=ed25519; pk=p3GKE9XFmjhwAayAHG4U108yag7V8xQVd4zJLdW0g7g= X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,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 fry.vger.email 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 (fry.vger.email [0.0.0.0]); Mon, 23 Oct 2023 14:07:55 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780581967126526583 X-GMAIL-MSGID: 1780581967126526583 |
Series |
RISC-V: Add MMC support for TH1520 boards
|
|
Commit Message
Drew Fustini
Oct. 23, 2023, 9:07 p.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 | 3 ++-
drivers/mmc/host/sdhci.h | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)
Comments
On Mon, Oct 23, 2023 at 02:07:03PM -0700, 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 Hi Drew, Just FYI, my th1520 version patch in my local repo overrides the mmc_host_ops.execute_tuning as the following: host->mmc_host_ops.execute_tuning = dwcmshc_execute_tuning; In dwcmshc_execute_tuning(), I will do some necessary setting then call sdhci_execute_tuning(); So I don't need to export __sdhci_execute_tuning(). The main reason is that the __abc symbol is expected to be used internally. However, I have no big preference. I would leave the decision be made by mmc maintainers @Ulf @Adrian, can you please comment? Thanks > 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 | 3 ++- > drivers/mmc/host/sdhci.h | 1 + > 2 files changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c > index ff41aa56564e..c79f73459915 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; > > @@ -2879,6 +2879,7 @@ static int __sdhci_execute_tuning(struct sdhci_host *host, u32 opcode) > sdhci_reset_tuning(host); > return -EAGAIN; > } > +EXPORT_SYMBOL_GPL(__sdhci_execute_tuning); > > int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode) > { > 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); > > -- > 2.34.1 >
On 25/10/23 18:29, Jisheng Zhang wrote: > On Mon, Oct 23, 2023 at 02:07:03PM -0700, 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 > > Hi Drew, > > Just FYI, my th1520 version patch in my local repo overrides the > mmc_host_ops.execute_tuning as the following: > > host->mmc_host_ops.execute_tuning = dwcmshc_execute_tuning; > > In dwcmshc_execute_tuning(), I will do some necessary setting then > call sdhci_execute_tuning(); > > So I don't need to export __sdhci_execute_tuning(). The main reason > is that the __abc symbol is expected to be used internally. However, > I have no big preference. I would leave the decision be made by > mmc maintainers @Ulf @Adrian, can you please comment? > It is OK. We try to consider SDHCI as more of a library, so sharing any reasonably well-defined function is OK.
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index ff41aa56564e..c79f73459915 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; @@ -2879,6 +2879,7 @@ static int __sdhci_execute_tuning(struct sdhci_host *host, u32 opcode) sdhci_reset_tuning(host); return -EAGAIN; } +EXPORT_SYMBOL_GPL(__sdhci_execute_tuning); int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode) { 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);