From: Jiayu Du <jiayu.riscv@isrc.iscas.ac.cn>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: krzk@kernel.org, adrian.hunter@intel.com, robh@kernel.org,
krzk+dt@kernel.org, conor+dt@kernel.org, pjw@kernel.org,
palmer@dabbelt.com, aou@eecs.berkeley.edu,
linux-mmc@vger.kernel.org, devicetree@vger.kernel.org,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
gaohan@iscas.ac.cn, me@ziyao.cc
Subject: Re: [PATCH v2 2/3] mmc: sdhci-dwcmshc: Add Canaan K230 DWCMSHC controller support
Date: Fri, 6 Mar 2026 17:00:23 +0800 [thread overview]
Message-ID: <aaqXpzEPeKfSYF41@duge-virtual-machine> (raw)
In-Reply-To: <CAPDyKFrxJ0oWuMWoUEYGO0t-WOYU+G7p5eFw8cUY7xyPaREB5Q@mail.gmail.com>
On Thu, Mar 05, 2026 at 12:48:29PM +0100, Ulf Hansson wrote:
> On Thu, 26 Feb 2026 at 12:59, Jiayu Du <jiayu.riscv@isrc.iscas.ac.cn> wrote:
> >
> > Add SDHCI controller driver for Canaan k230 SoC. Implement custom
> > sdhci_ops for set_clock, phy init, init and reset.
> >
> > Signed-off-by: Jiayu Du <jiayu.riscv@isrc.iscas.ac.cn>
> > ---
> > drivers/mmc/host/sdhci-of-dwcmshc.c | 288 ++++++++++++++++++++++++++++
> > 1 file changed, 288 insertions(+)
> >
> > diff --git a/drivers/mmc/host/sdhci-of-dwcmshc.c b/drivers/mmc/host/sdhci-of-dwcmshc.c
> > index 2b75a36c096b..21c77e908d77 100644
> > --- a/drivers/mmc/host/sdhci-of-dwcmshc.c
> > +++ b/drivers/mmc/host/sdhci-of-dwcmshc.c
...
> > struct dwcmshc_pltfm_data {
> > + const void *match_data;
>
> This makes sense to me!
>
> Although, I realized that dwcmshc_rk35xx_init() could also move its
> assignment of "devtype" into this match_data.
>
> Can you please create a follow-up patch to fixup this and to avoid
> storing this type of data in two different ways?
>
...
> > +static int dwcmshc_k230_init(struct device *dev, struct sdhci_host *host,
> > + struct dwcmshc_priv *dwc_priv)
> > +{
> > + static const char * const clk_ids[] = {"block", "timer", "axi"};
> > + const struct dwcmshc_k230_match_data *match_data;
> > + const struct dwcmshc_pltfm_data *pltfm_data;
> > + struct device_node *usb_phy_node;
> > + struct k230_priv *k230_priv;
> > + u32 data;
> > + int ret;
> > +
> > + pltfm_data = device_get_match_data(dev);
> > +
> > + if (!pltfm_data || !pltfm_data->match_data) {
> > + dev_err(dev, "No vendor data found for K230\n");
> > + return -EINVAL;
> > + }
> > + match_data = pltfm_data->match_data;
>
> I don't think this should be specific to dwcmshc_k230_init().
>
> Instead I suggest adding a "const void *match_data" to the "struct
> dwcmshc_priv" - and copy the pointer in the common dwcmshc_probe()
> instead. In this way, all variants will be able to use it.
Your suggestions make perfect sense. I'll prepare a new version to add
the "const void *match_data" to "struct dwcmshc_priv", assign it in
"dwcmshc_probe()", and adjust the K230 init accordingly.
I'll also migrate the rk35xx devtype assignment to match_data for
consistency. Once ready, I'll post the link as a reply to this k230 mmc
series.
Best regards,
Jiayu Du
>
> Kind regards
> Uffe
WARNING: multiple messages have this Message-ID (diff)
From: Jiayu Du <jiayu.riscv@isrc.iscas.ac.cn>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: krzk@kernel.org, adrian.hunter@intel.com, robh@kernel.org,
krzk+dt@kernel.org, conor+dt@kernel.org, pjw@kernel.org,
palmer@dabbelt.com, aou@eecs.berkeley.edu,
linux-mmc@vger.kernel.org, devicetree@vger.kernel.org,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
gaohan@iscas.ac.cn, me@ziyao.cc
Subject: Re: [PATCH v2 2/3] mmc: sdhci-dwcmshc: Add Canaan K230 DWCMSHC controller support
Date: Fri, 6 Mar 2026 17:00:23 +0800 [thread overview]
Message-ID: <aaqXpzEPeKfSYF41@duge-virtual-machine> (raw)
In-Reply-To: <CAPDyKFrxJ0oWuMWoUEYGO0t-WOYU+G7p5eFw8cUY7xyPaREB5Q@mail.gmail.com>
On Thu, Mar 05, 2026 at 12:48:29PM +0100, Ulf Hansson wrote:
> On Thu, 26 Feb 2026 at 12:59, Jiayu Du <jiayu.riscv@isrc.iscas.ac.cn> wrote:
> >
> > Add SDHCI controller driver for Canaan k230 SoC. Implement custom
> > sdhci_ops for set_clock, phy init, init and reset.
> >
> > Signed-off-by: Jiayu Du <jiayu.riscv@isrc.iscas.ac.cn>
> > ---
> > drivers/mmc/host/sdhci-of-dwcmshc.c | 288 ++++++++++++++++++++++++++++
> > 1 file changed, 288 insertions(+)
> >
> > diff --git a/drivers/mmc/host/sdhci-of-dwcmshc.c b/drivers/mmc/host/sdhci-of-dwcmshc.c
> > index 2b75a36c096b..21c77e908d77 100644
> > --- a/drivers/mmc/host/sdhci-of-dwcmshc.c
> > +++ b/drivers/mmc/host/sdhci-of-dwcmshc.c
...
> > struct dwcmshc_pltfm_data {
> > + const void *match_data;
>
> This makes sense to me!
>
> Although, I realized that dwcmshc_rk35xx_init() could also move its
> assignment of "devtype" into this match_data.
>
> Can you please create a follow-up patch to fixup this and to avoid
> storing this type of data in two different ways?
>
...
> > +static int dwcmshc_k230_init(struct device *dev, struct sdhci_host *host,
> > + struct dwcmshc_priv *dwc_priv)
> > +{
> > + static const char * const clk_ids[] = {"block", "timer", "axi"};
> > + const struct dwcmshc_k230_match_data *match_data;
> > + const struct dwcmshc_pltfm_data *pltfm_data;
> > + struct device_node *usb_phy_node;
> > + struct k230_priv *k230_priv;
> > + u32 data;
> > + int ret;
> > +
> > + pltfm_data = device_get_match_data(dev);
> > +
> > + if (!pltfm_data || !pltfm_data->match_data) {
> > + dev_err(dev, "No vendor data found for K230\n");
> > + return -EINVAL;
> > + }
> > + match_data = pltfm_data->match_data;
>
> I don't think this should be specific to dwcmshc_k230_init().
>
> Instead I suggest adding a "const void *match_data" to the "struct
> dwcmshc_priv" - and copy the pointer in the common dwcmshc_probe()
> instead. In this way, all variants will be able to use it.
Your suggestions make perfect sense. I'll prepare a new version to add
the "const void *match_data" to "struct dwcmshc_priv", assign it in
"dwcmshc_probe()", and adjust the K230 init accordingly.
I'll also migrate the rk35xx devtype assignment to match_data for
consistency. Once ready, I'll post the link as a reply to this k230 mmc
series.
Best regards,
Jiayu Du
>
> Kind regards
> Uffe
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2026-03-06 9:00 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-26 11:59 [PATCH v2 0/3] Add SDHCI support for Canaan K230 SoC Jiayu Du
2026-02-26 11:59 ` Jiayu Du
2026-02-26 11:59 ` [PATCH v2 1/3] dt-bindings: mmc: Add sdhci support for Canaan k230 Jiayu Du
2026-02-26 11:59 ` Jiayu Du
2026-02-26 18:30 ` Conor Dooley
2026-02-26 18:30 ` Conor Dooley
2026-02-26 11:59 ` [PATCH v2 2/3] mmc: sdhci-dwcmshc: Add Canaan K230 DWCMSHC controller support Jiayu Du
2026-02-26 11:59 ` Jiayu Du
2026-03-04 9:25 ` Jiayu Du
2026-03-04 9:25 ` Jiayu Du
2026-03-05 11:48 ` Ulf Hansson
2026-03-05 11:48 ` Ulf Hansson
2026-03-06 9:00 ` Jiayu Du [this message]
2026-03-06 9:00 ` Jiayu Du
2026-02-26 11:59 ` [PATCH v2 3/3] riscv: dts: canaan: Add mmc nodes for K230 Jiayu Du
2026-02-26 11:59 ` Jiayu Du
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aaqXpzEPeKfSYF41@duge-virtual-machine \
--to=jiayu.riscv@isrc.iscas.ac.cn \
--cc=adrian.hunter@intel.com \
--cc=aou@eecs.berkeley.edu \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=gaohan@iscas.ac.cn \
--cc=krzk+dt@kernel.org \
--cc=krzk@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=me@ziyao.cc \
--cc=palmer@dabbelt.com \
--cc=pjw@kernel.org \
--cc=robh@kernel.org \
--cc=ulf.hansson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.