2022-02-16 09:39:31

by Jérôme Pouiller

[permalink] [raw]
Subject: [PATCH 0/2] staging: wfx: apply SDIO suggestions

From: Jérôme Pouiller <[email protected]>

Hi Ulf, Greg,

The second patch of this series touch to the staging tree and to the MMC
framework. I don't know what is the rule for these cases, but I think it
makes more sense to carry this patch with the staging tree.


Jérôme Pouiller (2):
staging: wfx: WF200 has no official SDIO IDs
staging: wfx: apply the necessary SDIO quirks for the Silabs WF200

drivers/mmc/core/quirks.h | 5 +++++
drivers/staging/wfx/bus_sdio.c | 8 ++------
2 files changed, 7 insertions(+), 6 deletions(-)

--
2.34.1


2022-02-16 09:39:32

by Jérôme Pouiller

[permalink] [raw]
Subject: [PATCH 1/2] staging: wfx: WF200 has no official SDIO IDs

From: Jérôme Pouiller <[email protected]>

Some may think that SDIO_VENDOR_ID_SILABS / SDIO_DEVICE_ID_SILABS_WF200
are official SDIO IDs. However, it is not the case, the values used by
WF200 are not official (BTW, the driver rely on the DT rather than on
the SDIO IDs to probe the device).

To avoid any confusion, remove the definitions SDIO_*_ID_SILABS* and use
raw values.

Signed-off-by: Jérôme Pouiller <[email protected]>
---
drivers/staging/wfx/bus_sdio.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wfx/bus_sdio.c b/drivers/staging/wfx/bus_sdio.c
index bc3df85a05b6..312d2d391a24 100644
--- a/drivers/staging/wfx/bus_sdio.c
+++ b/drivers/staging/wfx/bus_sdio.c
@@ -257,10 +257,9 @@ static void wfx_sdio_remove(struct sdio_func *func)
sdio_release_host(func);
}

-#define SDIO_VENDOR_ID_SILABS 0x0000
-#define SDIO_DEVICE_ID_SILABS_WF200 0x1000
static const struct sdio_device_id wfx_sdio_ids[] = {
- { SDIO_DEVICE(SDIO_VENDOR_ID_SILABS, SDIO_DEVICE_ID_SILABS_WF200) },
+ /* WF200 does not have official VID/PID */
+ { SDIO_DEVICE(0x0000, 0x1000) },
{ },
};
MODULE_DEVICE_TABLE(sdio, wfx_sdio_ids);
--
2.34.1

2022-02-16 09:39:33

by Jérôme Pouiller

[permalink] [raw]
Subject: [PATCH 2/2] staging: wfx: apply the necessary SDIO quirks for the Silabs WF200

From: Jérôme Pouiller <[email protected]>

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 <[email protected]>
---
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

2022-02-16 09:52:28

by Pali Rohár

[permalink] [raw]
Subject: Re: [PATCH 1/2] staging: wfx: WF200 has no official SDIO IDs

On Wednesday 16 February 2022 10:31:11 Jerome Pouiller wrote:
> From: Jérôme Pouiller <[email protected]>
>
> Some may think that SDIO_VENDOR_ID_SILABS / SDIO_DEVICE_ID_SILABS_WF200
> are official SDIO IDs. However, it is not the case, the values used by
> WF200 are not official (BTW, the driver rely on the DT rather than on
> the SDIO IDs to probe the device).
>
> To avoid any confusion, remove the definitions SDIO_*_ID_SILABS* and use
> raw values.
>
> Signed-off-by: Jérôme Pouiller <[email protected]>

Reviewed-by: Pali Rohár <[email protected]>

> ---
> drivers/staging/wfx/bus_sdio.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/wfx/bus_sdio.c b/drivers/staging/wfx/bus_sdio.c
> index bc3df85a05b6..312d2d391a24 100644
> --- a/drivers/staging/wfx/bus_sdio.c
> +++ b/drivers/staging/wfx/bus_sdio.c
> @@ -257,10 +257,9 @@ static void wfx_sdio_remove(struct sdio_func *func)
> sdio_release_host(func);
> }
>
> -#define SDIO_VENDOR_ID_SILABS 0x0000
> -#define SDIO_DEVICE_ID_SILABS_WF200 0x1000
> static const struct sdio_device_id wfx_sdio_ids[] = {
> - { SDIO_DEVICE(SDIO_VENDOR_ID_SILABS, SDIO_DEVICE_ID_SILABS_WF200) },
> + /* WF200 does not have official VID/PID */
> + { SDIO_DEVICE(0x0000, 0x1000) },
> { },
> };
> MODULE_DEVICE_TABLE(sdio, wfx_sdio_ids);
> --
> 2.34.1
>

2022-02-16 09:52:45

by Pali Rohár

[permalink] [raw]
Subject: Re: [PATCH 2/2] staging: wfx: apply the necessary SDIO quirks for the Silabs WF200

On Wednesday 16 February 2022 10:31:12 Jerome Pouiller wrote:
> From: Jérôme Pouiller <[email protected]>
>
> 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 <[email protected]>

Reviewed-by: Pali Rohár <[email protected]>

> ---
> 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
>

2022-02-16 10:43:52

by Ulf Hansson

[permalink] [raw]
Subject: Re: [PATCH 0/2] staging: wfx: apply SDIO suggestions

On Wed, 16 Feb 2022 at 10:31, Jerome Pouiller
<[email protected]> wrote:
>
> From: Jérôme Pouiller <[email protected]>
>
> Hi Ulf, Greg,
>
> The second patch of this series touch to the staging tree and to the MMC
> framework. I don't know what is the rule for these cases, but I think it
> makes more sense to carry this patch with the staging tree.

I don't believe the changes to the mmc core will cause any merge
conflict, so feel free to funnel this through whatever tree makes best
sense.

For the series:
Reviewed-by: Ulf Hansson <[email protected]>

Kind regards
Uffe

>
>
> Jérôme Pouiller (2):
> staging: wfx: WF200 has no official SDIO IDs
> staging: wfx: apply the necessary SDIO quirks for the Silabs WF200
>
> drivers/mmc/core/quirks.h | 5 +++++
> drivers/staging/wfx/bus_sdio.c | 8 ++------
> 2 files changed, 7 insertions(+), 6 deletions(-)
>
> --
> 2.34.1
>

2022-02-17 14:01:54

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 2/2] staging: wfx: apply the necessary SDIO quirks for the Silabs WF200

Jerome Pouiller <[email protected]> writes:

> From: Jérôme Pouiller <[email protected]>
>
> 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?

--
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

2022-02-17 16:07:36

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 2/2] staging: wfx: apply the necessary SDIO quirks for the Silabs WF200

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 <[email protected]> writes:
> > > On Thu, 17 Feb 2022 at 10:59, Kalle Valo <[email protected]> wrote:
> > >> Jerome Pouiller <[email protected]> writes:
> > >> > From: J?r?me Pouiller <[email protected]>
> > >> >
> > >> > 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

2022-02-17 18:26:08

by Ulf Hansson

[permalink] [raw]
Subject: Re: [PATCH 2/2] staging: wfx: apply the necessary SDIO quirks for the Silabs WF200

On Thu, 17 Feb 2022 at 10:59, Kalle Valo <[email protected]> wrote:
>
> Jerome Pouiller <[email protected]> writes:
>
> > From: Jérôme Pouiller <[email protected]>
> >
> > 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

2022-02-17 20:02:58

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 2/2] staging: wfx: apply the necessary SDIO quirks for the Silabs WF200

Ulf Hansson <[email protected]> writes:

> On Thu, 17 Feb 2022 at 10:59, Kalle Valo <[email protected]> wrote:
>>
>> Jerome Pouiller <[email protected]> writes:
>>
>> > From: Jérôme Pouiller <[email protected]>
>> >
>> > 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 :)

--
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

2022-02-17 23:21:02

by Jérôme Pouiller

[permalink] [raw]
Subject: Re: [PATCH 2/2] staging: wfx: apply the necessary SDIO quirks for the Silabs WF200

On Thursday 17 February 2022 16:04:51 CET Kalle Valo wrote:
> Ulf Hansson <[email protected]> writes:
> > On Thu, 17 Feb 2022 at 10:59, Kalle Valo <[email protected]> wrote:
> >> Jerome Pouiller <[email protected]> writes:
> >> > From: J?r?me Pouiller <[email protected]>
> >> >
> >> > 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.

--
J?r?me Pouiller