[PATCHv3 wireless-next 3/7] wifi: rt2800soc: allow loading from OF

Rosen Penev posted 7 patches 2 months, 4 weeks ago
There is a newer version of this series
[PATCHv3 wireless-next 3/7] wifi: rt2800soc: allow loading from OF
Posted by Rosen Penev 2 months, 4 weeks ago
Add a single binding to help the already present dts files load the
driver. More are possible but there doesn't seem to be a significant
difference between them to justify this.

Use wifi name per dtschema requirements.

The data field will be used to remove the custom non static probe
function and use of_device_get_match_data.

Added OF dependency to SOC CONFIG as adding of_match_table without OF
being present makes no sense.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Reviewed-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
---
 drivers/net/wireless/ralink/rt2x00/Kconfig     | 2 +-
 drivers/net/wireless/ralink/rt2x00/rt2800soc.c | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ralink/rt2x00/Kconfig b/drivers/net/wireless/ralink/rt2x00/Kconfig
index 3a32ceead54f..a0dc9a751234 100644
--- a/drivers/net/wireless/ralink/rt2x00/Kconfig
+++ b/drivers/net/wireless/ralink/rt2x00/Kconfig
@@ -202,7 +202,7 @@ endif
 
 config RT2800SOC
 	tristate "Ralink WiSoC support"
-	depends on SOC_RT288X || SOC_RT305X || SOC_MT7620 || COMPILE_TEST
+	depends on OF && (SOC_RT288X || SOC_RT305X || SOC_MT7620 || COMPILE_TEST)
 	select RT2X00_LIB_SOC
 	select RT2X00_LIB_MMIO
 	select RT2X00_LIB_CRYPTO
diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
index e73394cf6ea6..db8d01f0cdc3 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
@@ -243,9 +243,16 @@ static int rt2800soc_probe(struct platform_device *pdev)
 	return rt2x00soc_probe(pdev, &rt2800soc_ops);
 }
 
+static const struct of_device_id rt2880_wmac_match[] = {
+	{ .compatible = "ralink,rt2880-wifi", .data = &rt2800soc_ops },
+	{},
+};
+MODULE_DEVICE_TABLE(of, rt2880_wmac_match);
+
 static struct platform_driver rt2800soc_driver = {
 	.driver		= {
 		.name		= "rt2800_wmac",
+		.of_match_table = rt2880_wmac_match,
 	},
 	.probe		= rt2800soc_probe,
 	.remove		= rt2x00soc_remove,
-- 
2.50.0
Re: [PATCHv3 wireless-next 3/7] wifi: rt2800soc: allow loading from OF
Posted by Stanislaw Gruszka 2 months, 3 weeks ago
On Thu, Jul 10, 2025 at 01:08:16PM -0700, Rosen Penev wrote:
> Add a single binding to help the already present dts files load the
> driver. More are possible but there doesn't seem to be a significant
> difference between them to justify this.
> 
> Use wifi name per dtschema requirements.
> 
> The data field will be used to remove the custom non static probe
> function and use of_device_get_match_data.
> 
> Added OF dependency to SOC CONFIG as adding of_match_table without OF
> being present makes no sense.
> 
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> Reviewed-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
> ---
>  drivers/net/wireless/ralink/rt2x00/Kconfig     | 2 +-
>  drivers/net/wireless/ralink/rt2x00/rt2800soc.c | 7 +++++++
>  2 files changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/ralink/rt2x00/Kconfig b/drivers/net/wireless/ralink/rt2x00/Kconfig
> index 3a32ceead54f..a0dc9a751234 100644
> --- a/drivers/net/wireless/ralink/rt2x00/Kconfig
> +++ b/drivers/net/wireless/ralink/rt2x00/Kconfig
> @@ -202,7 +202,7 @@ endif
>  
>  config RT2800SOC
>  	tristate "Ralink WiSoC support"
> -	depends on SOC_RT288X || SOC_RT305X || SOC_MT7620 || COMPILE_TEST
> +	depends on OF && (SOC_RT288X || SOC_RT305X || SOC_MT7620 || COMPILE_TEST)
>  	select RT2X00_LIB_SOC
>  	select RT2X00_LIB_MMIO
>  	select RT2X00_LIB_CRYPTO
> diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
> index e73394cf6ea6..db8d01f0cdc3 100644
> --- a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
> +++ b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
> @@ -243,9 +243,16 @@ static int rt2800soc_probe(struct platform_device *pdev)
>  	return rt2x00soc_probe(pdev, &rt2800soc_ops);
>  }
>  
> +static const struct of_device_id rt2880_wmac_match[] = {
> +	{ .compatible = "ralink,rt2880-wifi", .data = &rt2800soc_ops },

Why do .data = rt2800soc_ops here and use it via of_device_get_match_data()
in patch 5, insead of just use rt2800soc_ops directly in rt2800soc_probe ? 

Regards
Stanislaw

> +	{},
> +};
> +MODULE_DEVICE_TABLE(of, rt2880_wmac_match);
> +
>  static struct platform_driver rt2800soc_driver = {
>  	.driver		= {
>  		.name		= "rt2800_wmac",
> +		.of_match_table = rt2880_wmac_match,
>  	},
>  	.probe		= rt2800soc_probe,
>  	.remove		= rt2x00soc_remove,
> -- 
> 2.50.0
>
Re: [PATCHv3 wireless-next 3/7] wifi: rt2800soc: allow loading from OF
Posted by Rosen Penev 2 months, 3 weeks ago
On Sat, Jul 12, 2025 at 3:14 AM Stanislaw Gruszka <stf_xl@wp.pl> wrote:
>
> On Thu, Jul 10, 2025 at 01:08:16PM -0700, Rosen Penev wrote:
> > Add a single binding to help the already present dts files load the
> > driver. More are possible but there doesn't seem to be a significant
> > difference between them to justify this.
> >
> > Use wifi name per dtschema requirements.
> >
> > The data field will be used to remove the custom non static probe
> > function and use of_device_get_match_data.
> >
> > Added OF dependency to SOC CONFIG as adding of_match_table without OF
> > being present makes no sense.
> >
> > Signed-off-by: Rosen Penev <rosenp@gmail.com>
> > Reviewed-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
> > ---
> >  drivers/net/wireless/ralink/rt2x00/Kconfig     | 2 +-
> >  drivers/net/wireless/ralink/rt2x00/rt2800soc.c | 7 +++++++
> >  2 files changed, 8 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/wireless/ralink/rt2x00/Kconfig b/drivers/net/wireless/ralink/rt2x00/Kconfig
> > index 3a32ceead54f..a0dc9a751234 100644
> > --- a/drivers/net/wireless/ralink/rt2x00/Kconfig
> > +++ b/drivers/net/wireless/ralink/rt2x00/Kconfig
> > @@ -202,7 +202,7 @@ endif
> >
> >  config RT2800SOC
> >       tristate "Ralink WiSoC support"
> > -     depends on SOC_RT288X || SOC_RT305X || SOC_MT7620 || COMPILE_TEST
> > +     depends on OF && (SOC_RT288X || SOC_RT305X || SOC_MT7620 || COMPILE_TEST)
> >       select RT2X00_LIB_SOC
> >       select RT2X00_LIB_MMIO
> >       select RT2X00_LIB_CRYPTO
> > diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
> > index e73394cf6ea6..db8d01f0cdc3 100644
> > --- a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
> > +++ b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
> > @@ -243,9 +243,16 @@ static int rt2800soc_probe(struct platform_device *pdev)
> >       return rt2x00soc_probe(pdev, &rt2800soc_ops);
> >  }
> >
> > +static const struct of_device_id rt2880_wmac_match[] = {
> > +     { .compatible = "ralink,rt2880-wifi", .data = &rt2800soc_ops },
>
> Why do .data = rt2800soc_ops here and use it via of_device_get_match_data()
> in patch 5, insead of just use rt2800soc_ops directly in rt2800soc_probe ?
I see more of the former instead of the latter in drivers.
>
> Regards
> Stanislaw
>
> > +     {},
> > +};
> > +MODULE_DEVICE_TABLE(of, rt2880_wmac_match);
> > +
> >  static struct platform_driver rt2800soc_driver = {
> >       .driver         = {
> >               .name           = "rt2800_wmac",
> > +             .of_match_table = rt2880_wmac_match,
> >       },
> >       .probe          = rt2800soc_probe,
> >       .remove         = rt2x00soc_remove,
> > --
> > 2.50.0
> >
Re: [PATCHv3 wireless-next 3/7] wifi: rt2800soc: allow loading from OF
Posted by Stanislaw Gruszka 2 months, 3 weeks ago
On Sat, Jul 12, 2025 at 12:02:35PM -0700, Rosen Penev wrote:
> On Sat, Jul 12, 2025 at 3:14 AM Stanislaw Gruszka <stf_xl@wp.pl> wrote:
> >
> > On Thu, Jul 10, 2025 at 01:08:16PM -0700, Rosen Penev wrote:
> > > Add a single binding to help the already present dts files load the
> > > driver. More are possible but there doesn't seem to be a significant
> > > difference between them to justify this.
> > >
> > > Use wifi name per dtschema requirements.
> > >
> > > The data field will be used to remove the custom non static probe
> > > function and use of_device_get_match_data.
> > >
> > > Added OF dependency to SOC CONFIG as adding of_match_table without OF
> > > being present makes no sense.
> > >
> > > Signed-off-by: Rosen Penev <rosenp@gmail.com>
> > > Reviewed-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
> > > ---
> > >  drivers/net/wireless/ralink/rt2x00/Kconfig     | 2 +-
> > >  drivers/net/wireless/ralink/rt2x00/rt2800soc.c | 7 +++++++
> > >  2 files changed, 8 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/net/wireless/ralink/rt2x00/Kconfig b/drivers/net/wireless/ralink/rt2x00/Kconfig
> > > index 3a32ceead54f..a0dc9a751234 100644
> > > --- a/drivers/net/wireless/ralink/rt2x00/Kconfig
> > > +++ b/drivers/net/wireless/ralink/rt2x00/Kconfig
> > > @@ -202,7 +202,7 @@ endif
> > >
> > >  config RT2800SOC
> > >       tristate "Ralink WiSoC support"
> > > -     depends on SOC_RT288X || SOC_RT305X || SOC_MT7620 || COMPILE_TEST
> > > +     depends on OF && (SOC_RT288X || SOC_RT305X || SOC_MT7620 || COMPILE_TEST)
> > >       select RT2X00_LIB_SOC
> > >       select RT2X00_LIB_MMIO
> > >       select RT2X00_LIB_CRYPTO
> > > diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
> > > index e73394cf6ea6..db8d01f0cdc3 100644
> > > --- a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
> > > +++ b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
> > > @@ -243,9 +243,16 @@ static int rt2800soc_probe(struct platform_device *pdev)
> > >       return rt2x00soc_probe(pdev, &rt2800soc_ops);
> > >  }
> > >
> > > +static const struct of_device_id rt2880_wmac_match[] = {
> > > +     { .compatible = "ralink,rt2880-wifi", .data = &rt2800soc_ops },
> >
> > Why do .data = rt2800soc_ops here and use it via of_device_get_match_data()
> > in patch 5, insead of just use rt2800soc_ops directly in rt2800soc_probe ?
> I see more of the former instead of the latter in drivers.

If there is no technical reason to use indirection, this can be
simplified as well. Can be done as separate patch since you already
posed v4.

Regards
Stanislaw

Re: [PATCHv3 wireless-next 3/7] wifi: rt2800soc: allow loading from OF
Posted by Johannes Berg 2 months, 3 weeks ago
On Sun, 2025-07-13 at 09:15 +0200, Stanislaw Gruszka wrote:
> 
> Can be done as separate patch since you already
> posed v4.

Maybe I should point out that I've simply been dropping the patches
unseen because they don't even apply.

johannes
Re: [PATCHv3 wireless-next 3/7] wifi: rt2800soc: allow loading from OF
Posted by Johannes Berg 2 months, 3 weeks ago
On Sun, 2025-07-13 at 10:49 +0200, Johannes Berg wrote:
> On Sun, 2025-07-13 at 09:15 +0200, Stanislaw Gruszka wrote:
> > 
> > Can be done as separate patch since you already
> > posed v4.
> 
> Maybe I should point out that I've simply been dropping the patches
> unseen because they don't even apply.

Ah, that's because of Felix's fix, so looks it will apply now that I've
fast-forwarded wireless and wireless-next.

I'd prefer a resend though (perhaps with the small thing Stanislaw
thought might be fixed, your call) so the bot can pick it up.

johannes