linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] soc: renesas: Add support for reading product revision for RZ/G2L family
@ 2022-01-21  1:41 Lad Prabhakar
  2022-01-27 10:12 ` Geert Uytterhoeven
  0 siblings, 1 reply; 8+ messages in thread
From: Lad Prabhakar @ 2022-01-21  1:41 UTC (permalink / raw)
  To: Geert Uytterhoeven, Magnus Damm, linux-renesas-soc
  Cc: linux-kernel, Prabhakar, Biju Das, Lad Prabhakar

From: Biju Das <biju.das.jz@bp.renesas.com>

As per RZ/G2L HW manual (Rev.1.00 Sep, 2021) DEV_ID [31:28] indicates
product revision. Use this information to populate the revision info
for RZ/G2L family.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v1->v2
* Fixed freeing up soc_dev_attr in error path.

Output from SMARC RZ/G2L:
root@smarc-rzg2l:~# for i in machine family soc_id revision; do echo -n "$i: ";cat /sys/devices/soc0/$i; done
machine: Renesas SMARC EVK based on r9a07g044l2
family: RZ/G2L
soc_id: r9a07g044
revision: Rev 1
root@smarc-rzg2l:~#
root@smarc-rzg2l:~#
---
 drivers/soc/renesas/renesas-soc.c | 49 ++++++++++++++++++-------------
 1 file changed, 29 insertions(+), 20 deletions(-)

diff --git a/drivers/soc/renesas/renesas-soc.c b/drivers/soc/renesas/renesas-soc.c
index 7da0ea3587c4..44e365b36b26 100644
--- a/drivers/soc/renesas/renesas-soc.c
+++ b/drivers/soc/renesas/renesas-soc.c
@@ -371,6 +371,7 @@ static int __init renesas_soc_init(void)
 	struct soc_device *soc_dev;
 	struct device_node *np;
 	const char *soc_id;
+	int ret;
 
 	match = of_match_node(renesas_socs, of_root);
 	if (!match)
@@ -391,6 +392,17 @@ static int __init renesas_soc_init(void)
 		chipid = ioremap(family->reg, 4);
 	}
 
+	soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
+	if (!soc_dev_attr)
+		return -ENOMEM;
+
+	np = of_find_node_by_path("/");
+	of_property_read_string(np, "model", &soc_dev_attr->machine);
+	of_node_put(np);
+
+	soc_dev_attr->family = kstrdup_const(family->name, GFP_KERNEL);
+	soc_dev_attr->soc_id = kstrdup_const(soc_id, GFP_KERNEL);
+
 	if (chipid) {
 		product = readl(chipid + id->offset);
 		iounmap(chipid);
@@ -405,41 +417,38 @@ static int __init renesas_soc_init(void)
 
 			eshi = ((product >> 4) & 0x0f) + 1;
 			eslo = product & 0xf;
+			soc_dev_attr->revision = kasprintf(GFP_KERNEL, "ES%u.%u",
+							   eshi, eslo);
+		}  else if (id == &id_rzg2l) {
+			eshi =  ((product >> 28) & 0x0f);
+			soc_dev_attr->revision = kasprintf(GFP_KERNEL, "Rev %u",
+							   eshi);
 		}
 
 		if (soc->id &&
 		    ((product & id->mask) >> __ffs(id->mask)) != soc->id) {
 			pr_warn("SoC mismatch (product = 0x%x)\n", product);
-			return -ENODEV;
+			ret = -ENODEV;
+			goto free_soc_dev_attr;
 		}
 	}
 
-	soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
-	if (!soc_dev_attr)
-		return -ENOMEM;
-
-	np = of_find_node_by_path("/");
-	of_property_read_string(np, "model", &soc_dev_attr->machine);
-	of_node_put(np);
-
-	soc_dev_attr->family = kstrdup_const(family->name, GFP_KERNEL);
-	soc_dev_attr->soc_id = kstrdup_const(soc_id, GFP_KERNEL);
-	if (eshi)
-		soc_dev_attr->revision = kasprintf(GFP_KERNEL, "ES%u.%u", eshi,
-						   eslo);
-
 	pr_info("Detected Renesas %s %s %s\n", soc_dev_attr->family,
 		soc_dev_attr->soc_id, soc_dev_attr->revision ?: "");
 
 	soc_dev = soc_device_register(soc_dev_attr);
 	if (IS_ERR(soc_dev)) {
-		kfree(soc_dev_attr->revision);
-		kfree_const(soc_dev_attr->soc_id);
-		kfree_const(soc_dev_attr->family);
-		kfree(soc_dev_attr);
-		return PTR_ERR(soc_dev);
+		ret = PTR_ERR(soc_dev);
+		goto free_soc_dev_attr;
 	}
 
 	return 0;
+
+free_soc_dev_attr:
+	kfree(soc_dev_attr->revision);
+	kfree_const(soc_dev_attr->soc_id);
+	kfree_const(soc_dev_attr->family);
+	kfree(soc_dev_attr);
+	return ret;
 }
 early_initcall(renesas_soc_init);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] soc: renesas: Add support for reading product revision for RZ/G2L family
  2022-01-21  1:41 [PATCH v2] soc: renesas: Add support for reading product revision for RZ/G2L family Lad Prabhakar
@ 2022-01-27 10:12 ` Geert Uytterhoeven
  2022-01-27 11:26   ` Lad, Prabhakar
  2022-02-02  9:51   ` Biju Das
  0 siblings, 2 replies; 8+ messages in thread
From: Geert Uytterhoeven @ 2022-01-27 10:12 UTC (permalink / raw)
  To: Lad Prabhakar
  Cc: Magnus Damm, Linux-Renesas, Linux Kernel Mailing List, Prabhakar,
	Biju Das

Hi Prabhakar,

On Fri, Jan 21, 2022 at 2:41 AM Lad Prabhakar
<prabhakar.mahadev-lad.rj@bp.renesas.com> wrote:
> From: Biju Das <biju.das.jz@bp.renesas.com>
>
> As per RZ/G2L HW manual (Rev.1.00 Sep, 2021) DEV_ID [31:28] indicates
> product revision. Use this information to populate the revision info
> for RZ/G2L family.
>
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> ---
> v1->v2
> * Fixed freeing up soc_dev_attr in error path.

Thanks for the update!

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
i.e. will queue in renesas-devel for v5.18.

> --- a/drivers/soc/renesas/renesas-soc.c
> +++ b/drivers/soc/renesas/renesas-soc.c
> @@ -405,41 +417,38 @@ static int __init renesas_soc_init(void)
>
>                         eshi = ((product >> 4) & 0x0f) + 1;
>                         eslo = product & 0xf;
> +                       soc_dev_attr->revision = kasprintf(GFP_KERNEL, "ES%u.%u",
> +                                                          eshi, eslo);
> +               }  else if (id == &id_rzg2l) {
> +                       eshi =  ((product >> 28) & 0x0f);
> +                       soc_dev_attr->revision = kasprintf(GFP_KERNEL, "Rev %u",
> +                                                          eshi);

Would you mind if I would drop the "Rev " while applying?

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] soc: renesas: Add support for reading product revision for RZ/G2L family
  2022-01-27 10:12 ` Geert Uytterhoeven
@ 2022-01-27 11:26   ` Lad, Prabhakar
  2022-02-02  9:51   ` Biju Das
  1 sibling, 0 replies; 8+ messages in thread
From: Lad, Prabhakar @ 2022-01-27 11:26 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Lad Prabhakar, Magnus Damm, Linux-Renesas,
	Linux Kernel Mailing List, Biju Das

Hi Geert,

Thank you for the review.

On Thu, Jan 27, 2022 at 10:12 AM Geert Uytterhoeven
<geert@linux-m68k.org> wrote:
>
> Hi Prabhakar,
>
> On Fri, Jan 21, 2022 at 2:41 AM Lad Prabhakar
> <prabhakar.mahadev-lad.rj@bp.renesas.com> wrote:
> > From: Biju Das <biju.das.jz@bp.renesas.com>
> >
> > As per RZ/G2L HW manual (Rev.1.00 Sep, 2021) DEV_ID [31:28] indicates
> > product revision. Use this information to populate the revision info
> > for RZ/G2L family.
> >
> > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > ---
> > v1->v2
> > * Fixed freeing up soc_dev_attr in error path.
>
> Thanks for the update!
>
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> i.e. will queue in renesas-devel for v5.18.
>
> > --- a/drivers/soc/renesas/renesas-soc.c
> > +++ b/drivers/soc/renesas/renesas-soc.c
> > @@ -405,41 +417,38 @@ static int __init renesas_soc_init(void)
> >
> >                         eshi = ((product >> 4) & 0x0f) + 1;
> >                         eslo = product & 0xf;
> > +                       soc_dev_attr->revision = kasprintf(GFP_KERNEL, "ES%u.%u",
> > +                                                          eshi, eslo);
> > +               }  else if (id == &id_rzg2l) {
> > +                       eshi =  ((product >> 28) & 0x0f);
> > +                       soc_dev_attr->revision = kasprintf(GFP_KERNEL, "Rev %u",
> > +                                                          eshi);
>
> Would you mind if I would drop the "Rev " while applying?
>
Fine by me as it's already assigned to revision so there isn't any
point having "Rev" prepended to it.

Cheers,
Prabhakar

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH v2] soc: renesas: Add support for reading product revision for RZ/G2L family
  2022-01-27 10:12 ` Geert Uytterhoeven
  2022-01-27 11:26   ` Lad, Prabhakar
@ 2022-02-02  9:51   ` Biju Das
  2022-02-02 10:38     ` Geert Uytterhoeven
  1 sibling, 1 reply; 8+ messages in thread
From: Biju Das @ 2022-02-02  9:51 UTC (permalink / raw)
  To: Geert Uytterhoeven, Prabhakar Mahadev Lad
  Cc: Magnus Damm, Linux-Renesas, Linux Kernel Mailing List, Prabhakar

Hi Geert,

> Subject: Re: [PATCH v2] soc: renesas: Add support for reading product
> revision for RZ/G2L family
> 
> Hi Prabhakar,
> 
> On Fri, Jan 21, 2022 at 2:41 AM Lad Prabhakar <prabhakar.mahadev-
> lad.rj@bp.renesas.com> wrote:
> > From: Biju Das <biju.das.jz@bp.renesas.com>
> >
> > As per RZ/G2L HW manual (Rev.1.00 Sep, 2021) DEV_ID [31:28] indicates
> > product revision. Use this information to populate the revision info
> > for RZ/G2L family.
> >
> > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > ---
> > v1->v2
> > * Fixed freeing up soc_dev_attr in error path.
> 
> Thanks for the update!
> 
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> i.e. will queue
> in renesas-devel for v5.18.
> 
> > --- a/drivers/soc/renesas/renesas-soc.c
> > +++ b/drivers/soc/renesas/renesas-soc.c
> > @@ -405,41 +417,38 @@ static int __init renesas_soc_init(void)
> >
> >                         eshi = ((product >> 4) & 0x0f) + 1;
> >                         eslo = product & 0xf;
> > +                       soc_dev_attr->revision = kasprintf(GFP_KERNEL,
> "ES%u.%u",
> > +                                                          eshi, eslo);
> > +               }  else if (id == &id_rzg2l) {
> > +                       eshi =  ((product >> 28) & 0x0f);
> > +                       soc_dev_attr->revision = kasprintf(GFP_KERNEL,
> "Rev %u",
> > +                                                          eshi);
> 
> Would you mind if I would drop the "Rev " while applying?

Kernel reports the below message after dropping Rev. Is it OK? 

[    0.018297] Detected Renesas RZ/G2L r9a07g044 1

Cheers,
Biju

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] soc: renesas: Add support for reading product revision for RZ/G2L family
  2022-02-02  9:51   ` Biju Das
@ 2022-02-02 10:38     ` Geert Uytterhoeven
  2022-02-02 11:20       ` Biju Das
  0 siblings, 1 reply; 8+ messages in thread
From: Geert Uytterhoeven @ 2022-02-02 10:38 UTC (permalink / raw)
  To: Biju Das
  Cc: Prabhakar Mahadev Lad, Magnus Damm, Linux-Renesas,
	Linux Kernel Mailing List, Prabhakar

Hi Biju,

On Wed, Feb 2, 2022 at 10:51 AM Biju Das <biju.das.jz@bp.renesas.com> wrote:
> > Subject: Re: [PATCH v2] soc: renesas: Add support for reading product
> > revision for RZ/G2L family
> > On Fri, Jan 21, 2022 at 2:41 AM Lad Prabhakar <prabhakar.mahadev-
> > lad.rj@bp.renesas.com> wrote:
> > > From: Biju Das <biju.das.jz@bp.renesas.com>
> > > As per RZ/G2L HW manual (Rev.1.00 Sep, 2021) DEV_ID [31:28] indicates
> > > product revision. Use this information to populate the revision info
> > > for RZ/G2L family.
> > >
> > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

> > > --- a/drivers/soc/renesas/renesas-soc.c
> > > +++ b/drivers/soc/renesas/renesas-soc.c
> > > @@ -405,41 +417,38 @@ static int __init renesas_soc_init(void)
> > >
> > >                         eshi = ((product >> 4) & 0x0f) + 1;
> > >                         eslo = product & 0xf;
> > > +                       soc_dev_attr->revision = kasprintf(GFP_KERNEL,
> > "ES%u.%u",
> > > +                                                          eshi, eslo);
> > > +               }  else if (id == &id_rzg2l) {
> > > +                       eshi =  ((product >> 28) & 0x0f);
> > > +                       soc_dev_attr->revision = kasprintf(GFP_KERNEL,
> > "Rev %u",
> > > +                                                          eshi);
> >
> > Would you mind if I would drop the "Rev " while applying?
>
> Kernel reports the below message after dropping Rev. Is it OK?
>
> [    0.018297] Detected Renesas RZ/G2L r9a07g044 1

That's indeed not so nice...

Either we have to add it back, or do something like:

-       pr_info("Detected Renesas %s %s %s\n", soc_dev_attr->family,
-               soc_dev_attr->soc_id, soc_dev_attr->revision ?: "");
+       pr_info("Detected Renesas %s %s%s%s\n", soc_dev_attr->family,
+               soc_dev_attr->soc_id, soc_dev_attr->revision ? " Rev " : "",
+               soc_dev_attr->revision ?: "");

Any other options?

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH v2] soc: renesas: Add support for reading product revision for RZ/G2L family
  2022-02-02 10:38     ` Geert Uytterhoeven
@ 2022-02-02 11:20       ` Biju Das
  2022-02-02 13:36         ` Geert Uytterhoeven
  0 siblings, 1 reply; 8+ messages in thread
From: Biju Das @ 2022-02-02 11:20 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Prabhakar Mahadev Lad, Magnus Damm, Linux-Renesas,
	Linux Kernel Mailing List, Prabhakar

Hi Geert,


> Subject: Re: [PATCH v2] soc: renesas: Add support for reading product
> revision for RZ/G2L family
> 
> Hi Biju,
> 
> On Wed, Feb 2, 2022 at 10:51 AM Biju Das <biju.das.jz@bp.renesas.com>
> wrote:
> > > Subject: Re: [PATCH v2] soc: renesas: Add support for reading
> > > product revision for RZ/G2L family On Fri, Jan 21, 2022 at 2:41 AM
> > > Lad Prabhakar <prabhakar.mahadev- lad.rj@bp.renesas.com> wrote:
> > > > From: Biju Das <biju.das.jz@bp.renesas.com> As per RZ/G2L HW
> > > > manual (Rev.1.00 Sep, 2021) DEV_ID [31:28] indicates product
> > > > revision. Use this information to populate the revision info for
> > > > RZ/G2L family.
> > > >
> > > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > > > Signed-off-by: Lad Prabhakar
> > > > <prabhakar.mahadev-lad.rj@bp.renesas.com>
> 
> > > > --- a/drivers/soc/renesas/renesas-soc.c
> > > > +++ b/drivers/soc/renesas/renesas-soc.c
> > > > @@ -405,41 +417,38 @@ static int __init renesas_soc_init(void)
> > > >
> > > >                         eshi = ((product >> 4) & 0x0f) + 1;
> > > >                         eslo = product & 0xf;
> > > > +                       soc_dev_attr->revision =
> > > > + kasprintf(GFP_KERNEL,
> > > "ES%u.%u",
> > > > +                                                          eshi,
> eslo);
> > > > +               }  else if (id == &id_rzg2l) {
> > > > +                       eshi =  ((product >> 28) & 0x0f);
> > > > +                       soc_dev_attr->revision =
> > > > + kasprintf(GFP_KERNEL,
> > > "Rev %u",
> > > > +                                                          eshi);
> > >
> > > Would you mind if I would drop the "Rev " while applying?
> >
> > Kernel reports the below message after dropping Rev. Is it OK?
> >
> > [    0.018297] Detected Renesas RZ/G2L r9a07g044 1
> 
> That's indeed not so nice...
> 
> Either we have to add it back, or do something like:

This is much better.

[    0.003427] Detected Renesas RZ/G2L r9a07g044 Rev 1
root@smarc-rzg2l:~# for i in machine family soc_id revision; do echo -n "$i: ";cat /sys/devices/soc0/$i; done
machine: Renesas SMARC EVK based on r9a07g044l2
family: RZ/G2L
soc_id: r9a07g044
revision: 1
root@smarc-rzg2l:~#

> 
> -       pr_info("Detected Renesas %s %s %s\n", soc_dev_attr->family,
> -               soc_dev_attr->soc_id, soc_dev_attr->revision ?: "");
> +       pr_info("Detected Renesas %s %s%s%s\n", soc_dev_attr->family,
> +               soc_dev_attr->soc_id, soc_dev_attr->revision ? " Rev " :
> "",
> +               soc_dev_attr->revision ?: "");
> 

Will you post this change or Do you want me to send the patch?

Please let me know.

Cheers,
Biju

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] soc: renesas: Add support for reading product revision for RZ/G2L family
  2022-02-02 11:20       ` Biju Das
@ 2022-02-02 13:36         ` Geert Uytterhoeven
  2022-02-02 13:51           ` Biju Das
  0 siblings, 1 reply; 8+ messages in thread
From: Geert Uytterhoeven @ 2022-02-02 13:36 UTC (permalink / raw)
  To: Biju Das
  Cc: Prabhakar Mahadev Lad, Magnus Damm, Linux-Renesas,
	Linux Kernel Mailing List, Prabhakar

Hi Biju,

On Wed, Feb 2, 2022 at 12:20 PM Biju Das <biju.das.jz@bp.renesas.com> wrote:
> > Subject: Re: [PATCH v2] soc: renesas: Add support for reading product
> > revision for RZ/G2L family
> > On Wed, Feb 2, 2022 at 10:51 AM Biju Das <biju.das.jz@bp.renesas.com>
> > wrote:
> > > > Subject: Re: [PATCH v2] soc: renesas: Add support for reading
> > > > product revision for RZ/G2L family On Fri, Jan 21, 2022 at 2:41 AM
> > > > Lad Prabhakar <prabhakar.mahadev- lad.rj@bp.renesas.com> wrote:
> > > > > From: Biju Das <biju.das.jz@bp.renesas.com> As per RZ/G2L HW
> > > > > manual (Rev.1.00 Sep, 2021) DEV_ID [31:28] indicates product
> > > > > revision. Use this information to populate the revision info for
> > > > > RZ/G2L family.
> > > > >
> > > > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > > > > Signed-off-by: Lad Prabhakar
> > > > > <prabhakar.mahadev-lad.rj@bp.renesas.com>
> >
> > > > > --- a/drivers/soc/renesas/renesas-soc.c
> > > > > +++ b/drivers/soc/renesas/renesas-soc.c
> > > > > @@ -405,41 +417,38 @@ static int __init renesas_soc_init(void)
> > > > >
> > > > >                         eshi = ((product >> 4) & 0x0f) + 1;
> > > > >                         eslo = product & 0xf;
> > > > > +                       soc_dev_attr->revision =
> > > > > + kasprintf(GFP_KERNEL,
> > > > "ES%u.%u",
> > > > > +                                                          eshi,
> > eslo);
> > > > > +               }  else if (id == &id_rzg2l) {
> > > > > +                       eshi =  ((product >> 28) & 0x0f);
> > > > > +                       soc_dev_attr->revision =
> > > > > + kasprintf(GFP_KERNEL,
> > > > "Rev %u",
> > > > > +                                                          eshi);
> > > >
> > > > Would you mind if I would drop the "Rev " while applying?
> > >
> > > Kernel reports the below message after dropping Rev. Is it OK?
> > >
> > > [    0.018297] Detected Renesas RZ/G2L r9a07g044 1
> >
> > That's indeed not so nice...
> >
> > Either we have to add it back, or do something like:
>
> This is much better.
>
> [    0.003427] Detected Renesas RZ/G2L r9a07g044 Rev 1
> root@smarc-rzg2l:~# for i in machine family soc_id revision; do echo -n "$i: ";cat /sys/devices/soc0/$i; done
> machine: Renesas SMARC EVK based on r9a07g044l2
> family: RZ/G2L
> soc_id: r9a07g044
> revision: 1
> root@smarc-rzg2l:~#
>
> >
> > -       pr_info("Detected Renesas %s %s %s\n", soc_dev_attr->family,
> > -               soc_dev_attr->soc_id, soc_dev_attr->revision ?: "");
> > +       pr_info("Detected Renesas %s %s%s%s\n", soc_dev_attr->family,
> > +               soc_dev_attr->soc_id, soc_dev_attr->revision ? " Rev " :
> > "",
> > +               soc_dev_attr->revision ?: "");
> >
>
> Will you post this change or Do you want me to send the patch?
>
> Please let me know.

I'll send a patch, to be folded in to the original.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH v2] soc: renesas: Add support for reading product revision for RZ/G2L family
  2022-02-02 13:36         ` Geert Uytterhoeven
@ 2022-02-02 13:51           ` Biju Das
  0 siblings, 0 replies; 8+ messages in thread
From: Biju Das @ 2022-02-02 13:51 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Prabhakar Mahadev Lad, Magnus Damm, Linux-Renesas,
	Linux Kernel Mailing List, Prabhakar

Hi Geert,

> Subject: Re: [PATCH v2] soc: renesas: Add support for reading product
> revision for RZ/G2L family
> 
> Hi Biju,
> 
> On Wed, Feb 2, 2022 at 12:20 PM Biju Das <biju.das.jz@bp.renesas.com>
> wrote:
> > > Subject: Re: [PATCH v2] soc: renesas: Add support for reading
> > > product revision for RZ/G2L family On Wed, Feb 2, 2022 at 10:51 AM
> > > Biju Das <biju.das.jz@bp.renesas.com>
> > > wrote:
> > > > > Subject: Re: [PATCH v2] soc: renesas: Add support for reading
> > > > > product revision for RZ/G2L family On Fri, Jan 21, 2022 at 2:41
> > > > > AM Lad Prabhakar <prabhakar.mahadev- lad.rj@bp.renesas.com> wrote:
> > > > > > From: Biju Das <biju.das.jz@bp.renesas.com> As per RZ/G2L HW
> > > > > > manual (Rev.1.00 Sep, 2021) DEV_ID [31:28] indicates product
> > > > > > revision. Use this information to populate the revision info
> > > > > > for RZ/G2L family.
> > > > > >
> > > > > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > > > > > Signed-off-by: Lad Prabhakar
> > > > > > <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > >
> > > > > > --- a/drivers/soc/renesas/renesas-soc.c
> > > > > > +++ b/drivers/soc/renesas/renesas-soc.c
> > > > > > @@ -405,41 +417,38 @@ static int __init renesas_soc_init(void)
> > > > > >
> > > > > >                         eshi = ((product >> 4) & 0x0f) + 1;
> > > > > >                         eslo = product & 0xf;
> > > > > > +                       soc_dev_attr->revision =
> > > > > > + kasprintf(GFP_KERNEL,
> > > > > "ES%u.%u",
> > > > > > +
> > > > > > + eshi,
> > > eslo);
> > > > > > +               }  else if (id == &id_rzg2l) {
> > > > > > +                       eshi =  ((product >> 28) & 0x0f);
> > > > > > +                       soc_dev_attr->revision =
> > > > > > + kasprintf(GFP_KERNEL,
> > > > > "Rev %u",
> > > > > > +
> > > > > > + eshi);
> > > > >
> > > > > Would you mind if I would drop the "Rev " while applying?
> > > >
> > > > Kernel reports the below message after dropping Rev. Is it OK?
> > > >
> > > > [    0.018297] Detected Renesas RZ/G2L r9a07g044 1
> > >
> > > That's indeed not so nice...
> > >
> > > Either we have to add it back, or do something like:
> >
> > This is much better.
> >
> > [    0.003427] Detected Renesas RZ/G2L r9a07g044 Rev 1
> > root@smarc-rzg2l:~# for i in machine family soc_id revision; do echo
> > -n "$i: ";cat /sys/devices/soc0/$i; done
> > machine: Renesas SMARC EVK based on r9a07g044l2
> > family: RZ/G2L
> > soc_id: r9a07g044
> > revision: 1
> > root@smarc-rzg2l:~#
> >
> > >
> > > -       pr_info("Detected Renesas %s %s %s\n", soc_dev_attr->family,
> > > -               soc_dev_attr->soc_id, soc_dev_attr->revision ?: "");
> > > +       pr_info("Detected Renesas %s %s%s%s\n", soc_dev_attr->family,
> > > +               soc_dev_attr->soc_id, soc_dev_attr->revision ? " Rev "
> :
> > > "",
> > > +               soc_dev_attr->revision ?: "");
> > >
> >
> > Will you post this change or Do you want me to send the patch?
> >
> > Please let me know.
> 
> I'll send a patch, to be folded in to the original.

Thanks,

Biju

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-02-02 13:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-21  1:41 [PATCH v2] soc: renesas: Add support for reading product revision for RZ/G2L family Lad Prabhakar
2022-01-27 10:12 ` Geert Uytterhoeven
2022-01-27 11:26   ` Lad, Prabhakar
2022-02-02  9:51   ` Biju Das
2022-02-02 10:38     ` Geert Uytterhoeven
2022-02-02 11:20       ` Biju Das
2022-02-02 13:36         ` Geert Uytterhoeven
2022-02-02 13:51           ` Biju Das

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