Message ID | 20220216093112.92469-3-Jerome.Pouiller@silabs.com (mailing list archive) |
---|---|
State | Not Applicable |
Delegated to: | Johannes Berg |
Headers | show |
Series | staging: wfx: apply SDIO suggestions | expand |
On Wednesday 16 February 2022 10:31:12 Jerome Pouiller wrote: > From: Jérôme Pouiller <jerome.pouiller@silabs.com> > > Until now, the SDIO quirks are applied directly from the driver. > However, it is better to apply the quirks before driver probing. So, > this patch relocate the quirks in the MMC framework. > > Note that the WF200 has no valid SDIO VID/PID. Therefore, we match DT > rather than on the SDIO VID/PID. > > Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com> Reviewed-by: Pali Rohár <pali@kernel.org> > --- > drivers/mmc/core/quirks.h | 5 +++++ > drivers/staging/wfx/bus_sdio.c | 3 --- > 2 files changed, 5 insertions(+), 3 deletions(-) > > diff --git a/drivers/mmc/core/quirks.h b/drivers/mmc/core/quirks.h > index 20f568727277..f879dc63d936 100644 > --- a/drivers/mmc/core/quirks.h > +++ b/drivers/mmc/core/quirks.h > @@ -149,6 +149,11 @@ static const struct mmc_fixup __maybe_unused sdio_fixup_methods[] = { > static const struct mmc_fixup __maybe_unused sdio_card_init_methods[] = { > SDIO_FIXUP_COMPATIBLE("ti,wl1251", wl1251_quirk, 0), > > + SDIO_FIXUP_COMPATIBLE("silabs,wf200", add_quirk, > + MMC_QUIRK_BROKEN_BYTE_MODE_512 | > + MMC_QUIRK_LENIENT_FN0 | > + MMC_QUIRK_BLKSZ_FOR_BYTE_MODE), > + > END_FIXUP > }; > > diff --git a/drivers/staging/wfx/bus_sdio.c b/drivers/staging/wfx/bus_sdio.c > index 312d2d391a24..51a0d58a9070 100644 > --- a/drivers/staging/wfx/bus_sdio.c > +++ b/drivers/staging/wfx/bus_sdio.c > @@ -216,9 +216,6 @@ static int wfx_sdio_probe(struct sdio_func *func, const struct sdio_device_id *i > bus->func = func; > bus->of_irq = irq_of_parse_and_map(np, 0); > sdio_set_drvdata(func, bus); > - func->card->quirks |= MMC_QUIRK_LENIENT_FN0 | > - MMC_QUIRK_BLKSZ_FOR_BYTE_MODE | > - MMC_QUIRK_BROKEN_BYTE_MODE_512; > > sdio_claim_host(func); > ret = sdio_enable_func(func); > -- > 2.34.1 >
Jerome Pouiller <Jerome.Pouiller@silabs.com> writes: > From: Jérôme Pouiller <jerome.pouiller@silabs.com> > > Until now, the SDIO quirks are applied directly from the driver. > However, it is better to apply the quirks before driver probing. So, > this patch relocate the quirks in the MMC framework. It would be good to know how this is better, what's the concrete advantage?
On Thu, 17 Feb 2022 at 10:59, Kalle Valo <kvalo@kernel.org> wrote: > > Jerome Pouiller <Jerome.Pouiller@silabs.com> writes: > > > From: Jérôme Pouiller <jerome.pouiller@silabs.com> > > > > Until now, the SDIO quirks are applied directly from the driver. > > However, it is better to apply the quirks before driver probing. So, > > this patch relocate the quirks in the MMC framework. > > It would be good to know how this is better, what's the concrete > advantage? The mmc core has a quirk interface for all types of cards (eMMC/SD/SDIO), which thus keeps these things from sprinkling to drivers. In some cases, the quirk needs to be applied already during card initialization, which is earlier than when probing an SDIO func driver or the MMC block device driver. Perhaps it's a good idea to explain a bit about this in the commit message. Kind regards Uffe
Ulf Hansson <ulf.hansson@linaro.org> writes: > On Thu, 17 Feb 2022 at 10:59, Kalle Valo <kvalo@kernel.org> wrote: >> >> Jerome Pouiller <Jerome.Pouiller@silabs.com> writes: >> >> > From: Jérôme Pouiller <jerome.pouiller@silabs.com> >> > >> > Until now, the SDIO quirks are applied directly from the driver. >> > However, it is better to apply the quirks before driver probing. So, >> > this patch relocate the quirks in the MMC framework. >> >> It would be good to know how this is better, what's the concrete >> advantage? > > The mmc core has a quirk interface for all types of cards > (eMMC/SD/SDIO), which thus keeps these things from sprinkling to > drivers. In some cases, the quirk needs to be applied already during > card initialization, which is earlier than when probing an SDIO func > driver or the MMC block device driver. > > Perhaps it's a good idea to explain a bit about this in the commit message. I would add the whole paragraph to the commit log :)
On Thursday 17 February 2022 16:04:51 CET Kalle Valo wrote: > Ulf Hansson <ulf.hansson@linaro.org> writes: > > On Thu, 17 Feb 2022 at 10:59, Kalle Valo <kvalo@kernel.org> wrote: > >> Jerome Pouiller <Jerome.Pouiller@silabs.com> writes: > >> > From: Jérôme Pouiller <jerome.pouiller@silabs.com> > >> > > >> > Until now, the SDIO quirks are applied directly from the driver. > >> > However, it is better to apply the quirks before driver probing. So, > >> > this patch relocate the quirks in the MMC framework. > >> > >> It would be good to know how this is better, what's the concrete > >> advantage? > > > > The mmc core has a quirk interface for all types of cards > > (eMMC/SD/SDIO), which thus keeps these things from sprinkling to > > drivers. In some cases, the quirk needs to be applied already during > > card initialization, which is earlier than when probing an SDIO func > > driver or the MMC block device driver. > > > > Perhaps it's a good idea to explain a bit about this in the commit message. > > I would add the whole paragraph to the commit log :) Arf, Greg has just pulled this patch into staging-testing. I assume it is too late to change the commit message.
On Thu, Feb 17, 2022 at 04:41:38PM +0100, Jérôme Pouiller wrote: > On Thursday 17 February 2022 16:04:51 CET Kalle Valo wrote: > > Ulf Hansson <ulf.hansson@linaro.org> writes: > > > On Thu, 17 Feb 2022 at 10:59, Kalle Valo <kvalo@kernel.org> wrote: > > >> Jerome Pouiller <Jerome.Pouiller@silabs.com> writes: > > >> > From: Jérôme Pouiller <jerome.pouiller@silabs.com> > > >> > > > >> > Until now, the SDIO quirks are applied directly from the driver. > > >> > However, it is better to apply the quirks before driver probing. So, > > >> > this patch relocate the quirks in the MMC framework. > > >> > > >> It would be good to know how this is better, what's the concrete > > >> advantage? > > > > > > The mmc core has a quirk interface for all types of cards > > > (eMMC/SD/SDIO), which thus keeps these things from sprinkling to > > > drivers. In some cases, the quirk needs to be applied already during > > > card initialization, which is earlier than when probing an SDIO func > > > driver or the MMC block device driver. > > > > > > Perhaps it's a good idea to explain a bit about this in the commit message. > > > > I would add the whole paragraph to the commit log :) > > Arf, Greg has just pulled this patch into staging-testing. I assume it is > too late to change the commit message. I can drop it, but really, it's fine as-is. thanks, greg k-h
diff --git a/drivers/mmc/core/quirks.h b/drivers/mmc/core/quirks.h index 20f568727277..f879dc63d936 100644 --- a/drivers/mmc/core/quirks.h +++ b/drivers/mmc/core/quirks.h @@ -149,6 +149,11 @@ static const struct mmc_fixup __maybe_unused sdio_fixup_methods[] = { static const struct mmc_fixup __maybe_unused sdio_card_init_methods[] = { SDIO_FIXUP_COMPATIBLE("ti,wl1251", wl1251_quirk, 0), + SDIO_FIXUP_COMPATIBLE("silabs,wf200", add_quirk, + MMC_QUIRK_BROKEN_BYTE_MODE_512 | + MMC_QUIRK_LENIENT_FN0 | + MMC_QUIRK_BLKSZ_FOR_BYTE_MODE), + END_FIXUP }; diff --git a/drivers/staging/wfx/bus_sdio.c b/drivers/staging/wfx/bus_sdio.c index 312d2d391a24..51a0d58a9070 100644 --- a/drivers/staging/wfx/bus_sdio.c +++ b/drivers/staging/wfx/bus_sdio.c @@ -216,9 +216,6 @@ static int wfx_sdio_probe(struct sdio_func *func, const struct sdio_device_id *i bus->func = func; bus->of_irq = irq_of_parse_and_map(np, 0); sdio_set_drvdata(func, bus); - func->card->quirks |= MMC_QUIRK_LENIENT_FN0 | - MMC_QUIRK_BLKSZ_FOR_BYTE_MODE | - MMC_QUIRK_BROKEN_BYTE_MODE_512; sdio_claim_host(func); ret = sdio_enable_func(func);