Re: [PATCH] mmc: core: Add host specific tuning support for SD HS mode

From: Ulf Hansson
Date: Fri Aug 11 2023 - 04:43:03 EST


On Fri, 11 Aug 2023 at 09:23, Wenchao Chen <wenchao.chen666@xxxxxxxxx> wrote:
>
> On Wed, Aug 9, 2023 at 6:09 PM Ulf Hansson <ulf.hansson@xxxxxxxxxx> wrote:
> >
> > On Wed, 9 Aug 2023 at 07:30, Wenchao Chen <wenchao.chen@xxxxxxxxxx> wrote:
> > >
> > > Added .prepare_hs_tuning and .execute_hs_tuning host
> > > callbacks to support host-specific tuning for SD high
> > > speed mode.
> >
> > This certainly needs to be clarified more. Especially why it's needed
> > for the sdhci-sprd variant.
> >
>
> First of all, Unisoc's IC provides cmd delay and read delay to ensure
> that the host can
> get the correct data. However, according to SD Spec, there is no need
> to do tuning in
> high speed mode, but with the development of chip processes, it is
> more and more difficult
> to find a suitable delay to cover all the chips.
> Therefore, we need SD high speed mode online tuning.

Thanks for sharing this information - and please add some of this in
the commit message next time.

[...]

> > > +static int mmc_send_tuning_data(struct mmc_card *card)
> > > +{
> > > + u8 status[64];
> >
> > We use kmalloc-ed data for data transfers.
> >
>
> Why is it better to use kmalloc-ed data?

If you use DMA for example. From the core point of view, all data
should be kmalloc-ed, if it's a data transfer and possibility that
that DMA is used. Hence, it seems reasonable to conform to this
behaviour when using this helper function from the core.

[...]

Kind regards
Uffe