LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: "Jérôme Pouiller" <jerome.pouiller@silabs.com>
To: Ulf Hansson <ulf.hansson@linaro.org>,
	"H. Nikolaus Schaller" <hns@goldelico.com>
Cc: Avri Altman <avri.altman@wdc.com>,
	Shawn Lin <shawn.lin@rock-chips.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Bean Huo <beanhuo@micron.com>,
	linux-mmc@vger.kernel.org,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Discussions about the Letux Kernel 
	<letux-kernel@openphoenux.org>,
	kernel@pyra-handheld.com, Tony Lindgren <tony@atomide.com>,
	Linux-OMAP <linux-omap@vger.kernel.org>
Subject: Re: [RFC] mmc: core: transplant ti,wl1251 quirks from to be retired omap_hsmmc
Date: Thu, 28 Oct 2021 10:59:17 +0200	[thread overview]
Message-ID: <2013308.OSlt1BDEiP@pc-42> (raw)
In-Reply-To: <470A96FD-DB24-4C32-BC9F-AE2F617FBF2D@goldelico.com>

Hi Nikolaus,

On Thursday 28 October 2021 09:08:50 CEST H. Nikolaus Schaller wrote:
> > Am 27.10.2021 um 23:31 schrieb Ulf Hansson <ulf.hansson@linaro.org>:
> > On Wed, 27 Oct 2021 at 19:01, H. Nikolaus Schaller <hns@goldelico.com> wrote:
> >>> Am 26.10.2021 um 20:08 schrieb H. Nikolaus Schaller <hns@goldelico.com>:
> >>>> As a matter of fact, the similar problem that you are looking to
> >>>> address (applying card quirks based on DT compatibility strings), is
> >>>> partly being taken care of in another series [1], being discussed
> >>>> right now. I think the solution for the ti,wl1251 should be based upon
> >>>> that too. Please have a look and see if you can play with that!?
> >>>
> >>> That is interesting.
> >>> Yes, maybe it can be the basis. At least for finding the chip and driver.
> >>
> >> I have done a first experiment.
> >>
> >> It seems as if the series [1] does the opposite of what we need... It just
> >> skips entries in struct mmc_fixup if the DT does *not* match.
> >
> > Ohh, I didn't look that close. In that case the code isn't doing what
> > it *should*. The point is really to match on the compatible string and
> > then add quirks if that is found.
> 
> That is what I had expected.

Note I have not tested this code. My primary goal was to submit the idea. I
think I will be able to send a true PR next week.


> > Let me have a closer look - and for sure, I am willing to help if needed.

I confirm it does not have the expected behavior. !mmc_fixup_of_compatible_match()
should be mmc_fixup_of_compatible_match(), sorry.


[...]
> >> What I don't get from the code is how cis.vendor or cis.device can be
> >> initialized from device tree for a specific device. As far as I see it can
> >> only be checked for and some quirks can be set from a table if vendor and
> >> device read from the CIS registers do match.
> >
> > Yes. I thought that should be possible, but maybe it is not?
> 
> It seems to be a hen or egg issue here. MMC_QUIRK_NONSTD_SDIO should be set
> before we can match by vendor and device or compatible. But it can't be set
> late.

I think you can add a new fixup table that could be applied earlier (as you
do in your suggestion below).


> >> Instead, we want to match DT and define some values for an otherwise unknown
> >> device (i.e. we can't match by vendor or other methods) to help to initialize
> >> the interface. So in mmc_fixup_device it is too late and we need something
> >> running earlier, based purely on device tree information...
> >
> > Okay, I will have a closer look. Maybe we need to extend the card
> > quirks interface a bit to make it suitable for this case too.
> 
> Combining your suggestions we could do roughly:
> 
> in mmc_sdio_init_card():
> 
>         if (host->ops->init_card)
>                 host->ops->init_card(host, card);
>         else
>                 mmc_fixup_device(host, sdio_prepare_fixups_methods);

I think I mostly agree, but why you don't call mmc_fixup_device() if
init_card is defined? (BTW, mmc_fixup_device() takes a card as
first parameter)


> Next we need a location for the sdio_prepare_fixups_methods table and functions.
> 
> For "ti,wl1251" we would then provide the entry in the table and a function doing
> the setup. But where should these be defined? Likely not in a header file like
> quirks.h? But there is no quirks.c.

I think you can place your function in drivers/mmc/core/card.h. There are
already add_quirk(), add_limit_rate_quirk(), add_quirk_mmc(), etc...


-- 
Jérôme Pouiller



  reply	other threads:[~2021-10-28  8:59 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-06 11:25 H. Nikolaus Schaller
2021-10-26 17:12 ` Ulf Hansson
2021-10-26 18:08   ` H. Nikolaus Schaller
2021-10-27 17:00     ` H. Nikolaus Schaller
2021-10-27 21:31       ` Ulf Hansson
2021-10-28  7:08         ` H. Nikolaus Schaller
2021-10-28  8:59           ` Jérôme Pouiller [this message]
2021-10-28  9:31             ` Ulf Hansson
2021-10-28  9:40             ` H. Nikolaus Schaller
2021-10-28  9:43               ` H. Nikolaus Schaller
2021-10-28  9:51                 ` Ulf Hansson
2021-10-28  9:55               ` Jérôme Pouiller
2021-10-28 10:07                 ` H. Nikolaus Schaller
2021-11-01  9:12                   ` H. Nikolaus Schaller

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=2013308.OSlt1BDEiP@pc-42 \
    --to=jerome.pouiller@silabs.com \
    --cc=avri.altman@wdc.com \
    --cc=beanhuo@micron.com \
    --cc=hns@goldelico.com \
    --cc=kernel@pyra-handheld.com \
    --cc=letux-kernel@openphoenux.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=shawn.lin@rock-chips.com \
    --cc=tony@atomide.com \
    --cc=ulf.hansson@linaro.org \
    --subject='Re: [RFC] mmc: core: transplant ti,wl1251 quirks from to be retired omap_hsmmc' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).