diff mbox series

[1/2] platform: starfive: correct system clock device tree node

Message ID 088ccae83cf0165d1390627d7e2e782d74941e62.1705490088.git.namcao@linutronix.de
State Superseded
Headers show
Series [1/2] platform: starfive: correct system clock device tree node | expand

Commit Message

Nam Cao Jan. 17, 2024, 11:16 a.m. UTC
Starfive names the system clock device tree node "starfive,jh7110-clkgen"
in all their git repositories. However, a different name is used in
upstream U-Boot (and also Linux): "starfive,jh7110-syscrg". Since
OpenSBI gets the device tree from U-Boot, this inconsistency leads the
problem that OpenSBI doesn't know the system clock device exists.

Correct this name to keep the consistency.

Signed-off-by: Nam Cao <namcao@linutronix.de>
---
 platform/generic/starfive/jh7110.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Xiang W Jan. 17, 2024, 11:32 a.m. UTC | #1
在 2024-01-17星期三的 12:16 +0100,Nam Cao写道:
> Starfive names the system clock device tree node "starfive,jh7110-clkgen"
> in all their git repositories. However, a different name is used in
> upstream U-Boot (and also Linux): "starfive,jh7110-syscrg". Since
> OpenSBI gets the device tree from U-Boot, this inconsistency leads the
> problem that OpenSBI doesn't know the system clock device exists.
> 
> Correct this name to keep the consistency.
This sounds like a problem of u-boot. Directly replacing compatible strings is 
not a good way. It is best to try another compatible string after the search
fails.

Regards,
Xiang W
> 
> Signed-off-by: Nam Cao <namcao@linutronix.de>
> ---
>  platform/generic/starfive/jh7110.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/platform/generic/starfive/jh7110.c b/platform/generic/starfive/jh7110.c
> index dcd6306..4b22175 100644
> --- a/platform/generic/starfive/jh7110.c
> +++ b/platform/generic/starfive/jh7110.c
> @@ -252,7 +252,7 @@ static int starfive_jh7110_inst_init(void *fdt)
>  		jh7110_inst.pmu_reg_base = addr;
>  	}
>  
> -	noff = fdt_node_offset_by_compatible(fdt, -1, "starfive,jh7110-clkgen");
> +	noff = fdt_node_offset_by_compatible(fdt, -1, "starfive,jh7110-syscrg");
>  	if (-1 < noff) {
>  		rc = fdt_get_node_addr_size(fdt, noff, 0, &addr, NULL);
>  		if (rc)
> -- 
> 2.39.2
> 
>
David Abdurachmanov Jan. 17, 2024, 11:47 a.m. UTC | #2
On Wed, Jan 17, 2024 at 1:33 PM Xiang W <wxjstz@126.com> wrote:
>
> 在 2024-01-17星期三的 12:16 +0100,Nam Cao写道:
> > Starfive names the system clock device tree node "starfive,jh7110-clkgen"
> > in all their git repositories. However, a different name is used in
> > upstream U-Boot (and also Linux): "starfive,jh7110-syscrg". Since
> > OpenSBI gets the device tree from U-Boot, this inconsistency leads the
> > problem that OpenSBI doesn't know the system clock device exists.
> >
> > Correct this name to keep the consistency.
> This sounds like a problem of u-boot. Directly replacing compatible strings is
> not a good way. It is best to try another compatible string after the search
> fails.

At a quick glance there are no approved bindings for
starfive,jh7110-clkgen. There are bindings for starfive,jh7110-syscrg
in the Linux tree. IIUC v1 patch to add bindings referenced
starfive,jh7110-clkgen compatible, but that's no what landed. U-Boot
is supposed to regularly sync their DTS from the kernel tree.

Most likely OpenSBI stuff was merged before bindings got officially
approved in the Linux tree.

Cheers,
david

>
> Regards,
> Xiang W
> >
> > Signed-off-by: Nam Cao <namcao@linutronix.de>
> > ---
> >  platform/generic/starfive/jh7110.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/platform/generic/starfive/jh7110.c b/platform/generic/starfive/jh7110.c
> > index dcd6306..4b22175 100644
> > --- a/platform/generic/starfive/jh7110.c
> > +++ b/platform/generic/starfive/jh7110.c
> > @@ -252,7 +252,7 @@ static int starfive_jh7110_inst_init(void *fdt)
> >               jh7110_inst.pmu_reg_base = addr;
> >       }
> >
> > -     noff = fdt_node_offset_by_compatible(fdt, -1, "starfive,jh7110-clkgen");
> > +     noff = fdt_node_offset_by_compatible(fdt, -1, "starfive,jh7110-syscrg");
> >       if (-1 < noff) {
> >               rc = fdt_get_node_addr_size(fdt, noff, 0, &addr, NULL);
> >               if (rc)
> > --
> > 2.39.2
> >
> >
>
>
> --
> opensbi mailing list
> opensbi@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/opensbi
Nam Cao Jan. 17, 2024, 12:03 p.m. UTC | #3
On Wed, 17 Jan 2024 13:47:13 +0200 David Abdurachmanov <david.abdurachmanov@gmail.com> wrote:
> On Wed, Jan 17, 2024 at 1:33 PM Xiang W <wxjstz@126.com> wrote:
> >
> > 在 2024-01-17星期三的 12:16 +0100,Nam Cao写道:  
> > > Starfive names the system clock device tree node "starfive,jh7110-clkgen"
> > > in all their git repositories. However, a different name is used in
> > > upstream U-Boot (and also Linux): "starfive,jh7110-syscrg". Since
> > > OpenSBI gets the device tree from U-Boot, this inconsistency leads the
> > > problem that OpenSBI doesn't know the system clock device exists.
> > >
> > > Correct this name to keep the consistency.  
> > This sounds like a problem of u-boot. Directly replacing compatible strings is
> > not a good way. It is best to try another compatible string after the search
> > fails.  
> 
> At a quick glance there are no approved bindings for
> starfive,jh7110-clkgen. There are bindings for starfive,jh7110-syscrg
> in the Linux tree. IIUC v1 patch to add bindings referenced
> starfive,jh7110-clkgen compatible, but that's no what landed. U-Boot
> is supposed to regularly sync their DTS from the kernel tree.
> 
> Most likely OpenSBI stuff was merged before bindings got officially
> approved in the Linux tree.

This is also what I think: this stuff is merged to OpenSBI too early.

However, this patch breaks OpenSBI's compatibility with Starfive's U-Boot.
So the question is whether we should keep the compatibility with both
upstream U-Boot and Starfive's U-Boot, or just the upstream one. I would
say being compatible with upstream U-Boot is sufficient.

That said, if anyone insists on keeping the compatibility with Starfive's
U-Boot too, I can send a v2.

Best regards,
Nam
diff mbox series

Patch

diff --git a/platform/generic/starfive/jh7110.c b/platform/generic/starfive/jh7110.c
index dcd6306..4b22175 100644
--- a/platform/generic/starfive/jh7110.c
+++ b/platform/generic/starfive/jh7110.c
@@ -252,7 +252,7 @@  static int starfive_jh7110_inst_init(void *fdt)
 		jh7110_inst.pmu_reg_base = addr;
 	}
 
-	noff = fdt_node_offset_by_compatible(fdt, -1, "starfive,jh7110-clkgen");
+	noff = fdt_node_offset_by_compatible(fdt, -1, "starfive,jh7110-syscrg");
 	if (-1 < noff) {
 		rc = fdt_get_node_addr_size(fdt, noff, 0, &addr, NULL);
 		if (rc)