2020-12-11 13:35:29

by Sudeep Holla

[permalink] [raw]
Subject: [PATCH] drivers: soc: atmel: Avoid calling at91_soc_init on non AT91 SoCs

Since at91_soc_init is called unconditionally from atmel_soc_device_init,
we get the following warning on all non AT91 SoCs:
" AT91: Could not find identification node"

Fix the same by filtering with allowed AT91 SoC list.

Cc: Nicolas Ferre <[email protected]>
Cc: Alexandre Belloni <[email protected]>
Cc: Ludovic Desroches <[email protected]>
Signed-off-by: Sudeep Holla <[email protected]>
---
drivers/soc/atmel/soc.c | 11 +++++++++++
1 file changed, 11 insertions(+)

diff --git a/drivers/soc/atmel/soc.c b/drivers/soc/atmel/soc.c
index c4472b68b7c2..ba9fc07cd91c 100644
--- a/drivers/soc/atmel/soc.c
+++ b/drivers/soc/atmel/soc.c
@@ -271,8 +271,19 @@ struct soc_device * __init at91_soc_init(const struct at91_soc *socs)
return soc_dev;
}

+static const struct of_device_id at91_soc_allowed_list[] __initconst = {
+ { .compatible = "atmel,at91rm9200", },
+ { .compatible = "atmel,at91sam9260", },
+ { .compatible = "atmel,sama5d2", },
+};
+
static int __init atmel_soc_device_init(void)
{
+ struct device_node *np = of_find_node_by_path("/");
+
+ if (!of_match_node(at91_soc_allowed_list, np))
+ return 0;
+
at91_soc_init(socs);

return 0;
--
2.25.1


2020-12-11 14:04:52

by Alexandre Belloni

[permalink] [raw]
Subject: Re: [PATCH] drivers: soc: atmel: Avoid calling at91_soc_init on non AT91 SoCs

On 11/12/2020 11:50:55+0000, Sudeep Holla wrote:
> On Fri, Dec 11, 2020 at 12:45:15PM +0100, Alexandre Belloni wrote:
> > Hello,
> >
> > On 11/12/2020 10:31:43+0000, Sudeep Holla wrote:
> > > Since at91_soc_init is called unconditionally from atmel_soc_device_init,
> > > we get the following warning on all non AT91 SoCs:
> > > " AT91: Could not find identification node"
> > >
> > > Fix the same by filtering with allowed AT91 SoC list.
> > >
> > > Cc: Nicolas Ferre <[email protected]>
> > > Cc: Alexandre Belloni <[email protected]>
> > > Cc: Ludovic Desroches <[email protected]>
> > > Signed-off-by: Sudeep Holla <[email protected]>
> > > ---
> > > drivers/soc/atmel/soc.c | 11 +++++++++++
> > > 1 file changed, 11 insertions(+)
> > >
> > > diff --git a/drivers/soc/atmel/soc.c b/drivers/soc/atmel/soc.c
> > > index c4472b68b7c2..ba9fc07cd91c 100644
> > > --- a/drivers/soc/atmel/soc.c
> > > +++ b/drivers/soc/atmel/soc.c
> > > @@ -271,8 +271,19 @@ struct soc_device * __init at91_soc_init(const struct at91_soc *socs)
> > > return soc_dev;
> > > }
> > >
> > > +static const struct of_device_id at91_soc_allowed_list[] __initconst = {
> > > + { .compatible = "atmel,at91rm9200", },
> > > + { .compatible = "atmel,at91sam9260", },
> > > + { .compatible = "atmel,sama5d2", },
> >
> > This is a very small subset of the supported SoCs. a proper list would
> > be:
> >
> > atmel,at91rm9200
> > atmel,at91sam9
> > atmel,sama5
> > atmel,samv7
> >
>
> Sure I can update it but the existing functions at91_get_cidr_exid_from_chipid
> and at91_get_cidr_exid_from_dbgu check for following 3 compatibles and bail
> out if not found:
> "atmel,at91rm9200-dbgu"
> "atmel,at91sam9260-dbgu"
> "atmel,sama5d2-chipid"
>
> Quick check on DTS upstream suggested only 3 platforms, hence the choice.
>

No, atmel,at91sam9260-dbgu is used on most platforms:
$ git grep atmel,at91sam9260-dbgu arch/arm/boot/dts/
arch/arm/boot/dts/at91sam9260.dtsi: compatible = "atmel,at91sam9260-dbgu", "atmel,at91sam9260-usart";
arch/arm/boot/dts/at91sam9261.dtsi: compatible = "atmel,at91sam9260-dbgu", "atmel,at91sam9260-usart";
arch/arm/boot/dts/at91sam9263.dtsi: compatible = "atmel,at91sam9260-dbgu", "atmel,at91sam9260-usart";
arch/arm/boot/dts/at91sam9g45.dtsi: compatible = "atmel,at91sam9260-dbgu", "atmel,at91sam9260-usart";
arch/arm/boot/dts/at91sam9n12.dtsi: compatible = "atmel,at91sam9260-dbgu", "atmel,at91sam9260-usart";
arch/arm/boot/dts/at91sam9rl.dtsi: compatible = "atmel,at91sam9260-dbgu", "atmel,at91sam9260-usart";
arch/arm/boot/dts/at91sam9x5.dtsi: compatible = "atmel,at91sam9260-dbgu", "atmel,at91sam9260-usart";
arch/arm/boot/dts/sam9x60.dtsi: compatible = "microchip,sam9x60-dbgu", "microchip,sam9x60-usart", "atmel,at91sam9260-dbgu", "atmel,at91sam9260-usart";
arch/arm/boot/dts/sama5d3.dtsi: compatible = "atmel,at91sam9260-dbgu", "atmel,at91sam9260-usart";
arch/arm/boot/dts/sama5d4.dtsi: compatible = "atmel,at91sam9260-dbgu", "atmel,at91sam9260-usart";


> --
> Regards,
> Sudeep

--
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

2020-12-11 14:06:51

by Sudeep Holla

[permalink] [raw]
Subject: Re: [PATCH] drivers: soc: atmel: Avoid calling at91_soc_init on non AT91 SoCs

On Fri, Dec 11, 2020 at 12:58:00PM +0100, Alexandre Belloni wrote:
> On 11/12/2020 11:50:55+0000, Sudeep Holla wrote:
> > On Fri, Dec 11, 2020 at 12:45:15PM +0100, Alexandre Belloni wrote:
> > > Hello,
> > >
> > > On 11/12/2020 10:31:43+0000, Sudeep Holla wrote:
> > > > Since at91_soc_init is called unconditionally from atmel_soc_device_init,
> > > > we get the following warning on all non AT91 SoCs:
> > > > " AT91: Could not find identification node"
> > > >
> > > > Fix the same by filtering with allowed AT91 SoC list.
> > > >
> > > > Cc: Nicolas Ferre <[email protected]>
> > > > Cc: Alexandre Belloni <[email protected]>
> > > > Cc: Ludovic Desroches <[email protected]>
> > > > Signed-off-by: Sudeep Holla <[email protected]>
> > > > ---
> > > > drivers/soc/atmel/soc.c | 11 +++++++++++
> > > > 1 file changed, 11 insertions(+)
> > > >
> > > > diff --git a/drivers/soc/atmel/soc.c b/drivers/soc/atmel/soc.c
> > > > index c4472b68b7c2..ba9fc07cd91c 100644
> > > > --- a/drivers/soc/atmel/soc.c
> > > > +++ b/drivers/soc/atmel/soc.c
> > > > @@ -271,8 +271,19 @@ struct soc_device * __init at91_soc_init(const struct at91_soc *socs)
> > > > return soc_dev;
> > > > }
> > > >
> > > > +static const struct of_device_id at91_soc_allowed_list[] __initconst = {
> > > > + { .compatible = "atmel,at91rm9200", },
> > > > + { .compatible = "atmel,at91sam9260", },
> > > > + { .compatible = "atmel,sama5d2", },
> > >
> > > This is a very small subset of the supported SoCs. a proper list would
> > > be:
> > >
> > > atmel,at91rm9200
> > > atmel,at91sam9
> > > atmel,sama5
> > > atmel,samv7
> > >
> >
> > Sure I can update it but the existing functions at91_get_cidr_exid_from_chipid
> > and at91_get_cidr_exid_from_dbgu check for following 3 compatibles and bail
> > out if not found:
> > "atmel,at91rm9200-dbgu"
> > "atmel,at91sam9260-dbgu"
> > "atmel,sama5d2-chipid"
> >
> > Quick check on DTS upstream suggested only 3 platforms, hence the choice.
> >
>
> No, atmel,at91sam9260-dbgu is used on most platforms:
> $ git grep atmel,at91sam9260-dbgu arch/arm/boot/dts/
> arch/arm/boot/dts/at91sam9260.dtsi: compatible = "atmel,at91sam9260-dbgu", "atmel,at91sam9260-usart";
> arch/arm/boot/dts/at91sam9261.dtsi: compatible = "atmel,at91sam9260-dbgu", "atmel,at91sam9260-usart";
> arch/arm/boot/dts/at91sam9263.dtsi: compatible = "atmel,at91sam9260-dbgu", "atmel,at91sam9260-usart";
> arch/arm/boot/dts/at91sam9g45.dtsi: compatible = "atmel,at91sam9260-dbgu", "atmel,at91sam9260-usart";
> arch/arm/boot/dts/at91sam9n12.dtsi: compatible = "atmel,at91sam9260-dbgu", "atmel,at91sam9260-usart";
> arch/arm/boot/dts/at91sam9rl.dtsi: compatible = "atmel,at91sam9260-dbgu", "atmel,at91sam9260-usart";
> arch/arm/boot/dts/at91sam9x5.dtsi: compatible = "atmel,at91sam9260-dbgu", "atmel,at91sam9260-usart";
> arch/arm/boot/dts/sam9x60.dtsi: compatible = "microchip,sam9x60-dbgu", "microchip,sam9x60-usart", "atmel,at91sam9260-dbgu", "atmel,at91sam9260-usart";
> arch/arm/boot/dts/sama5d3.dtsi: compatible = "atmel,at91sam9260-dbgu", "atmel,at91sam9260-usart";
> arch/arm/boot/dts/sama5d4.dtsi: compatible = "atmel,at91sam9260-dbgu", "atmel,at91sam9260-usart";
>

Ah, I must have messed up my grep then for sure. Also not familiar with
AT91 series of platforms. I will respin with the list you suggested. Thanks!

--
Regards,
Sudeep

2020-12-11 17:09:24

by Alexandre Belloni

[permalink] [raw]
Subject: Re: [PATCH] drivers: soc: atmel: Avoid calling at91_soc_init on non AT91 SoCs

Hello,

On 11/12/2020 10:31:43+0000, Sudeep Holla wrote:
> Since at91_soc_init is called unconditionally from atmel_soc_device_init,
> we get the following warning on all non AT91 SoCs:
> " AT91: Could not find identification node"
>
> Fix the same by filtering with allowed AT91 SoC list.
>
> Cc: Nicolas Ferre <[email protected]>
> Cc: Alexandre Belloni <[email protected]>
> Cc: Ludovic Desroches <[email protected]>
> Signed-off-by: Sudeep Holla <[email protected]>
> ---
> drivers/soc/atmel/soc.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/drivers/soc/atmel/soc.c b/drivers/soc/atmel/soc.c
> index c4472b68b7c2..ba9fc07cd91c 100644
> --- a/drivers/soc/atmel/soc.c
> +++ b/drivers/soc/atmel/soc.c
> @@ -271,8 +271,19 @@ struct soc_device * __init at91_soc_init(const struct at91_soc *socs)
> return soc_dev;
> }
>
> +static const struct of_device_id at91_soc_allowed_list[] __initconst = {
> + { .compatible = "atmel,at91rm9200", },
> + { .compatible = "atmel,at91sam9260", },
> + { .compatible = "atmel,sama5d2", },

This is a very small subset of the supported SoCs. a proper list would
be:

atmel,at91rm9200
atmel,at91sam9
atmel,sama5
atmel,samv7


--
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

2020-12-11 17:09:26

by Sudeep Holla

[permalink] [raw]
Subject: Re: [PATCH] drivers: soc: atmel: Avoid calling at91_soc_init on non AT91 SoCs

On Fri, Dec 11, 2020 at 12:45:15PM +0100, Alexandre Belloni wrote:
> Hello,
>
> On 11/12/2020 10:31:43+0000, Sudeep Holla wrote:
> > Since at91_soc_init is called unconditionally from atmel_soc_device_init,
> > we get the following warning on all non AT91 SoCs:
> > " AT91: Could not find identification node"
> >
> > Fix the same by filtering with allowed AT91 SoC list.
> >
> > Cc: Nicolas Ferre <[email protected]>
> > Cc: Alexandre Belloni <[email protected]>
> > Cc: Ludovic Desroches <[email protected]>
> > Signed-off-by: Sudeep Holla <[email protected]>
> > ---
> > drivers/soc/atmel/soc.c | 11 +++++++++++
> > 1 file changed, 11 insertions(+)
> >
> > diff --git a/drivers/soc/atmel/soc.c b/drivers/soc/atmel/soc.c
> > index c4472b68b7c2..ba9fc07cd91c 100644
> > --- a/drivers/soc/atmel/soc.c
> > +++ b/drivers/soc/atmel/soc.c
> > @@ -271,8 +271,19 @@ struct soc_device * __init at91_soc_init(const struct at91_soc *socs)
> > return soc_dev;
> > }
> >
> > +static const struct of_device_id at91_soc_allowed_list[] __initconst = {
> > + { .compatible = "atmel,at91rm9200", },
> > + { .compatible = "atmel,at91sam9260", },
> > + { .compatible = "atmel,sama5d2", },
>
> This is a very small subset of the supported SoCs. a proper list would
> be:
>
> atmel,at91rm9200
> atmel,at91sam9
> atmel,sama5
> atmel,samv7
>

Sure I can update it but the existing functions at91_get_cidr_exid_from_chipid
and at91_get_cidr_exid_from_dbgu check for following 3 compatibles and bail
out if not found:
"atmel,at91rm9200-dbgu"
"atmel,at91sam9260-dbgu"
"atmel,sama5d2-chipid"

Quick check on DTS upstream suggested only 3 platforms, hence the choice.

--
Regards,
Sudeep