From: AKASHI Takahiro <takahiro.akashi@linaro.org>
To: Ben Chuang <benchuanggli@gmail.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>,
Ulf Hansson <ulf.hansson@linaro.org>,
linux-mmc <linux-mmc@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Ben Chuang <ben.chuang@genesyslogic.com.tw>,
greg.tu@genesyslogic.com.tw, Renius.Chen@genesyslogic.com.tw
Subject: Re: [RFC PATCH V3 12/21] mmc: sdhci: UHS-II support, add hooks for additional operations
Date: Thu, 24 Sep 2020 18:57:47 +0900 [thread overview]
Message-ID: <20200924095747.GB38298@laputa> (raw)
In-Reply-To: <CACT4zj-Uo6v_H_G0_LtYjDEN1jKsssjwN-utcZH2y-zqpV1Y3Q@mail.gmail.com>
Ben,
On Fri, Sep 18, 2020 at 06:50:24PM +0800, Ben Chuang wrote:
> On Fri, Sep 18, 2020 at 2:38 PM AKASHI Takahiro
> <takahiro.akashi@linaro.org> wrote:
> >
> > Adrian, Ben,
> >
> > Regarding _set_ios() function,
> >
> > On Fri, Aug 21, 2020 at 05:08:32PM +0300, Adrian Hunter wrote:
> > > On 10/07/20 2:10 pm, Ben Chuang wrote:
> > > > From: Ben Chuang <ben.chuang@genesyslogic.com.tw>
> > > >
> > > > In this commit, UHS-II related operations will be called via a function
> > > > pointer array, sdhci_uhs2_ops, in order to make UHS-II support as
> > > > a kernel module.
> > > > This array will be initialized only if CONFIG_MMC_SDHCI_UHS2 is enabled
> > > > and when the UHS-II module is loaded. Otherwise, all the functions
> > > > stay void.
> > > >
> > > > Signed-off-by: Ben Chuang <ben.chuang@genesyslogic.com.tw>
> > > > Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> >
> > (snip)
> >
> > > > @@ -2261,6 +2324,7 @@ void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
> > > > {
> > > > struct sdhci_host *host = mmc_priv(mmc);
> > > > u8 ctrl;
> > > > + u16 ctrl_2;
> > > >
> > > > if (ios->power_mode == MMC_POWER_UNDEFINED)
> > > > return;
> > > > @@ -2287,6 +2351,10 @@ void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
> > > > sdhci_enable_preset_value(host, false);
> > > >
> > > > if (!ios->clock || ios->clock != host->clock) {
> > > > + if (IS_ENABLED(CONFIG_MMC_SDHCI_UHS2) &&
> > > > + ios->timing == MMC_TIMING_UHS2)
> > > > + host->timing = ios->timing;
> > > > +
> > > > host->ops->set_clock(host, ios->clock);
> > > > host->clock = ios->clock;
> > > >
> > > > @@ -2308,6 +2376,18 @@ void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
> > > > else
> > > > sdhci_set_power(host, ios->power_mode, ios->vdd);
> > > >
> > > > + /* 4.0 host support */
> > > > + if (host->version >= SDHCI_SPEC_400) {
> > > > + /* UHS2 Support */
> > > > + if (IS_ENABLED(CONFIG_MMC_SDHCI_UHS2) &&
> > > > + host->mmc->flags & MMC_UHS2_SUPPORT &&
> > > > + host->mmc->caps & MMC_CAP_UHS2) {
> > > > + if (sdhci_uhs2_ops.do_set_ios)
> > > > + sdhci_uhs2_ops.do_set_ios(host, ios);
> > > > + return;
> > > > + }
> > > > + }
> > > > +
> > >
> > > Please look at using existing callbacks instead, maybe creating uhs2_set_ios(), uhs2_set_clock(), uhs2_set_power()
> >
> > I think that we will create uhs2_set_ios() (and uhs2_set_power()
> > as we discussed on patch#15/21), but not uhs_set_clock().
> >
> > Since we have a hook only in struct mmc_host_ops, but not in struct
> > sdhci_ops, all the drivers who want to support UHS-II need to
> > set host->mmc_host_ops->set_ios to sdhci_uhs2_set_ios explicitly
> > in their own init (or probe) function.
> > (Again, sdhci_uhs2_set_ios() seems to be generic though.)
> >
> > Is this okay for you?
> > -> Adrian
> >
> > During refactoring the code, I found that sdhci_set_power() is called
> > twice in sdhci_set_ios():
> > sdhci_set_ios(host, power_mode, vdd1, -1); in sdhci_set_ios(), and
> > sdhci_set_ios(host, power_mode, vdd1, vdd2) in ush2_do_set_ios()
> >
> > Can you please confirm that those are redundant?
>
> Yes, uhs2 set power is independent with uhs1.
> But set uhs2 power process should meet uhs2 spec.
Can you elaborate a bit more about the last sentence, please?
What I meant above is that
sdhci_set_ios(host, power_mode, vdd1, vdd2) in ush2_do_set_ios()
this code will 'set_power' both vdd and vdd2 anyway and so
sdhci_set_ios(host, power_mode, vdd1, -1); in sdhci_set_ios(), and
is just redundant.
> > -> Ben
> >
> > I also wonder why we need spin locks in uhs2_do_set_ios() while
> > not in sdhci_set_ios().
>
> You can check if spin locks in uhs2_do_set_ios() is necessary.
I'm asking you.
While calling set_ios() doesn't require spin locks, are you aware of
any cases where we need spin locks in calling set_ios() for uhs-2?
(I mean that callers/contexts are the same either for uhs or uhs-2.)
-Takahiro Akashi
> If set/clear irq can be execute safely without spin locks, you can
> remove spin locks.
>
> >
> > -> Ben
> >
> > -Takahiro Akashi
next prev parent reply other threads:[~2020-09-24 9:57 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-10 11:10 [RFC PATCH V3 12/21] mmc: sdhci: UHS-II support, add hooks for additional operations Ben Chuang
2020-08-21 14:08 ` Adrian Hunter
2020-09-16 8:05 ` AKASHI Takahiro
2020-09-16 10:00 ` Adrian Hunter
2020-09-17 2:31 ` AKASHI Takahiro
2020-09-17 4:52 ` Adrian Hunter
2020-09-17 5:16 ` AKASHI Takahiro
2020-09-17 5:12 ` AKASHI Takahiro
2020-09-17 10:12 ` Ben Chuang
2020-09-18 1:15 ` AKASHI Takahiro
2020-09-18 10:27 ` Ben Chuang
2020-09-24 9:46 ` AKASHI Takahiro
2020-09-25 7:59 ` Ben Chuang
2020-09-18 6:38 ` AKASHI Takahiro
2020-09-18 10:50 ` Ben Chuang
2020-09-24 9:57 ` AKASHI Takahiro [this message]
2020-09-25 7:55 ` Ben Chuang
2020-09-24 9:35 ` AKASHI Takahiro
2020-09-25 9:02 ` Adrian Hunter
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=20200924095747.GB38298@laputa \
--to=takahiro.akashi@linaro.org \
--cc=Renius.Chen@genesyslogic.com.tw \
--cc=adrian.hunter@intel.com \
--cc=ben.chuang@genesyslogic.com.tw \
--cc=benchuanggli@gmail.com \
--cc=greg.tu@genesyslogic.com.tw \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox