All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rockchip: rk3288: Add OF board setup
@ 2020-07-02  8:48 ` Jagan Teki
  0 siblings, 0 replies; 16+ messages in thread
From: Jagan Teki @ 2020-07-02  8:48 UTC (permalink / raw)
  To: Kever Yang, Philipp Tomsich, Simon Glass, heiko, mylene.josserand
  Cc: Suniel Mahesh, Michael Trimarchi, U-Boot-Denx, linux-rockchip,
	linux-amarula, Jagan Teki

The new rk3288 revision rk3288w has some changes with respect
to legacy rk3288 like hclk_vio and usb host0 ohci.

In order to work these on the same in Linux kernel update the
compatible the root compatible with rockchip,rk3288w before
booting.

So, this support during of board setup code of rk3288.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
 arch/arm/mach-rockchip/Kconfig         |  1 +
 arch/arm/mach-rockchip/rk3288/rk3288.c | 26 ++++++++++++++++++++++++++
 2 files changed, 27 insertions(+)

diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index b1008a5058..822d8d4e9c 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -98,6 +98,7 @@ config ROCKCHIP_RK322X
 config ROCKCHIP_RK3288
 	bool "Support Rockchip RK3288"
 	select CPU_V7A
+	select OF_BOARD_SETUP
 	select SUPPORT_SPL
 	select SPL
 	select SUPPORT_TPL
diff --git a/arch/arm/mach-rockchip/rk3288/rk3288.c b/arch/arm/mach-rockchip/rk3288/rk3288.c
index 804abe8a1b..8a682675e6 100644
--- a/arch/arm/mach-rockchip/rk3288/rk3288.c
+++ b/arch/arm/mach-rockchip/rk3288/rk3288.c
@@ -115,6 +115,32 @@ int rk_board_late_init(void)
 	return rk3288_board_late_init();
 }
 
+#ifdef CONFIG_OF_BOARD_SETUP
+
+#define RK3288_HDMI_PHYS	0xff980000
+#define RK3288W_HDMI_REV	0x1A
+#define HDMI_CONFIG0_ID		0x04
+
+int ft_board_setup(void *blob, bd_t *bd)
+{
+	u8 config0;
+	int ret;
+
+	config0 = readb(RK3288_HDMI_PHYS + HDMI_CONFIG0_ID);
+	if (config0 == RK3288W_HDMI_REV) {
+		ret = fdt_setprop_string(blob, 0,
+					 "compatible", "rockchip,rk3288w");
+		if (ret < 0) {
+			printf("failed to set rk3288w compatible (ret=%d)\n",
+			       ret);
+			return ret;
+		}
+	}
+
+	return 0;
+}
+#endif
+
 static int do_clock(struct cmd_tbl *cmdtp, int flag, int argc,
 		    char *const argv[])
 {
-- 
2.25.1

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

* [PATCH] rockchip: rk3288: Add OF board setup
@ 2020-07-02  8:48 ` Jagan Teki
  0 siblings, 0 replies; 16+ messages in thread
From: Jagan Teki @ 2020-07-02  8:48 UTC (permalink / raw)
  To: u-boot

The new rk3288 revision rk3288w has some changes with respect
to legacy rk3288 like hclk_vio and usb host0 ohci.

In order to work these on the same in Linux kernel update the
compatible the root compatible with rockchip,rk3288w before
booting.

So, this support during of board setup code of rk3288.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
 arch/arm/mach-rockchip/Kconfig         |  1 +
 arch/arm/mach-rockchip/rk3288/rk3288.c | 26 ++++++++++++++++++++++++++
 2 files changed, 27 insertions(+)

diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index b1008a5058..822d8d4e9c 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -98,6 +98,7 @@ config ROCKCHIP_RK322X
 config ROCKCHIP_RK3288
 	bool "Support Rockchip RK3288"
 	select CPU_V7A
+	select OF_BOARD_SETUP
 	select SUPPORT_SPL
 	select SPL
 	select SUPPORT_TPL
diff --git a/arch/arm/mach-rockchip/rk3288/rk3288.c b/arch/arm/mach-rockchip/rk3288/rk3288.c
index 804abe8a1b..8a682675e6 100644
--- a/arch/arm/mach-rockchip/rk3288/rk3288.c
+++ b/arch/arm/mach-rockchip/rk3288/rk3288.c
@@ -115,6 +115,32 @@ int rk_board_late_init(void)
 	return rk3288_board_late_init();
 }
 
+#ifdef CONFIG_OF_BOARD_SETUP
+
+#define RK3288_HDMI_PHYS	0xff980000
+#define RK3288W_HDMI_REV	0x1A
+#define HDMI_CONFIG0_ID		0x04
+
+int ft_board_setup(void *blob, bd_t *bd)
+{
+	u8 config0;
+	int ret;
+
+	config0 = readb(RK3288_HDMI_PHYS + HDMI_CONFIG0_ID);
+	if (config0 == RK3288W_HDMI_REV) {
+		ret = fdt_setprop_string(blob, 0,
+					 "compatible", "rockchip,rk3288w");
+		if (ret < 0) {
+			printf("failed to set rk3288w compatible (ret=%d)\n",
+			       ret);
+			return ret;
+		}
+	}
+
+	return 0;
+}
+#endif
+
 static int do_clock(struct cmd_tbl *cmdtp, int flag, int argc,
 		    char *const argv[])
 {
-- 
2.25.1

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

* Re: [PATCH] rockchip: rk3288: Add OF board setup
  2020-07-02  8:48 ` Jagan Teki
@ 2020-07-02 13:56   ` Robin Murphy
  -1 siblings, 0 replies; 16+ messages in thread
From: Robin Murphy @ 2020-07-02 13:56 UTC (permalink / raw)
  To: Jagan Teki, Kever Yang, Philipp Tomsich, Simon Glass, heiko,
	mylene.josserand
  Cc: linux-rockchip, U-Boot-Denx, Suniel Mahesh, Michael Trimarchi,
	linux-amarula

On 2020-07-02 09:48, Jagan Teki wrote:
> The new rk3288 revision rk3288w has some changes with respect
> to legacy rk3288 like hclk_vio and usb host0 ohci.
> 
> In order to work these on the same in Linux kernel update the
> compatible the root compatible with rockchip,rk3288w before
> booting.
> 
> So, this support during of board setup code of rk3288.
> 
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> ---
>   arch/arm/mach-rockchip/Kconfig         |  1 +
>   arch/arm/mach-rockchip/rk3288/rk3288.c | 26 ++++++++++++++++++++++++++
>   2 files changed, 27 insertions(+)
> 
> diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
> index b1008a5058..822d8d4e9c 100644
> --- a/arch/arm/mach-rockchip/Kconfig
> +++ b/arch/arm/mach-rockchip/Kconfig
> @@ -98,6 +98,7 @@ config ROCKCHIP_RK322X
>   config ROCKCHIP_RK3288
>   	bool "Support Rockchip RK3288"
>   	select CPU_V7A
> +	select OF_BOARD_SETUP
>   	select SUPPORT_SPL
>   	select SPL
>   	select SUPPORT_TPL
> diff --git a/arch/arm/mach-rockchip/rk3288/rk3288.c b/arch/arm/mach-rockchip/rk3288/rk3288.c
> index 804abe8a1b..8a682675e6 100644
> --- a/arch/arm/mach-rockchip/rk3288/rk3288.c
> +++ b/arch/arm/mach-rockchip/rk3288/rk3288.c
> @@ -115,6 +115,32 @@ int rk_board_late_init(void)
>   	return rk3288_board_late_init();
>   }
>   
> +#ifdef CONFIG_OF_BOARD_SETUP
> +
> +#define RK3288_HDMI_PHYS	0xff980000
> +#define RK3288W_HDMI_REV	0x1A
> +#define HDMI_CONFIG0_ID		0x04
> +
> +int ft_board_setup(void *blob, bd_t *bd)
> +{
> +	u8 config0;
> +	int ret;
> +
> +	config0 = readb(RK3288_HDMI_PHYS + HDMI_CONFIG0_ID);
> +	if (config0 == RK3288W_HDMI_REV) {
> +		ret = fdt_setprop_string(blob, 0,
> +					 "compatible", "rockchip,rk3288w");

Does this end up replacing the entire top-level compatible property? 
i.e. from:

	compatible = "vendor,board\0rockchip,rk3288";

to just:

	compatible = "rockchip,rk3288w";

If so, that's a bit of a problem for various drivers that care about the 
actual board compatible rather than the SoC.

Robin.

> +		if (ret < 0) {
> +			printf("failed to set rk3288w compatible (ret=%d)\n",
> +			       ret);
> +			return ret;
> +		}
> +	}
> +
> +	return 0;
> +}
> +#endif
> +
>   static int do_clock(struct cmd_tbl *cmdtp, int flag, int argc,
>   		    char *const argv[])
>   {
> 

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

* [PATCH] rockchip: rk3288: Add OF board setup
@ 2020-07-02 13:56   ` Robin Murphy
  0 siblings, 0 replies; 16+ messages in thread
From: Robin Murphy @ 2020-07-02 13:56 UTC (permalink / raw)
  To: u-boot

On 2020-07-02 09:48, Jagan Teki wrote:
> The new rk3288 revision rk3288w has some changes with respect
> to legacy rk3288 like hclk_vio and usb host0 ohci.
> 
> In order to work these on the same in Linux kernel update the
> compatible the root compatible with rockchip,rk3288w before
> booting.
> 
> So, this support during of board setup code of rk3288.
> 
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> ---
>   arch/arm/mach-rockchip/Kconfig         |  1 +
>   arch/arm/mach-rockchip/rk3288/rk3288.c | 26 ++++++++++++++++++++++++++
>   2 files changed, 27 insertions(+)
> 
> diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
> index b1008a5058..822d8d4e9c 100644
> --- a/arch/arm/mach-rockchip/Kconfig
> +++ b/arch/arm/mach-rockchip/Kconfig
> @@ -98,6 +98,7 @@ config ROCKCHIP_RK322X
>   config ROCKCHIP_RK3288
>   	bool "Support Rockchip RK3288"
>   	select CPU_V7A
> +	select OF_BOARD_SETUP
>   	select SUPPORT_SPL
>   	select SPL
>   	select SUPPORT_TPL
> diff --git a/arch/arm/mach-rockchip/rk3288/rk3288.c b/arch/arm/mach-rockchip/rk3288/rk3288.c
> index 804abe8a1b..8a682675e6 100644
> --- a/arch/arm/mach-rockchip/rk3288/rk3288.c
> +++ b/arch/arm/mach-rockchip/rk3288/rk3288.c
> @@ -115,6 +115,32 @@ int rk_board_late_init(void)
>   	return rk3288_board_late_init();
>   }
>   
> +#ifdef CONFIG_OF_BOARD_SETUP
> +
> +#define RK3288_HDMI_PHYS	0xff980000
> +#define RK3288W_HDMI_REV	0x1A
> +#define HDMI_CONFIG0_ID		0x04
> +
> +int ft_board_setup(void *blob, bd_t *bd)
> +{
> +	u8 config0;
> +	int ret;
> +
> +	config0 = readb(RK3288_HDMI_PHYS + HDMI_CONFIG0_ID);
> +	if (config0 == RK3288W_HDMI_REV) {
> +		ret = fdt_setprop_string(blob, 0,
> +					 "compatible", "rockchip,rk3288w");

Does this end up replacing the entire top-level compatible property? 
i.e. from:

	compatible = "vendor,board\0rockchip,rk3288";

to just:

	compatible = "rockchip,rk3288w";

If so, that's a bit of a problem for various drivers that care about the 
actual board compatible rather than the SoC.

Robin.

> +		if (ret < 0) {
> +			printf("failed to set rk3288w compatible (ret=%d)\n",
> +			       ret);
> +			return ret;
> +		}
> +	}
> +
> +	return 0;
> +}
> +#endif
> +
>   static int do_clock(struct cmd_tbl *cmdtp, int flag, int argc,
>   		    char *const argv[])
>   {
> 

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

* Re: [PATCH] rockchip: rk3288: Add OF board setup
  2020-07-02 13:56   ` Robin Murphy
@ 2020-07-03 10:10     ` Jagan Teki
  -1 siblings, 0 replies; 16+ messages in thread
From: Jagan Teki @ 2020-07-03 10:10 UTC (permalink / raw)
  To: Robin Murphy
  Cc: Kever Yang, Philipp Tomsich, Simon Glass, Heiko Stübner,
	Mylène Josserand, open list:ARM/Rockchip SoC...,
	U-Boot-Denx, Suniel Mahesh, Michael Trimarchi, linux-amarula

On Thu, Jul 2, 2020 at 7:26 PM Robin Murphy <robin.murphy@arm.com> wrote:
>
> On 2020-07-02 09:48, Jagan Teki wrote:
> > The new rk3288 revision rk3288w has some changes with respect
> > to legacy rk3288 like hclk_vio and usb host0 ohci.
> >
> > In order to work these on the same in Linux kernel update the
> > compatible the root compatible with rockchip,rk3288w before
> > booting.
> >
> > So, this support during of board setup code of rk3288.
> >
> > Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> > ---
> >   arch/arm/mach-rockchip/Kconfig         |  1 +
> >   arch/arm/mach-rockchip/rk3288/rk3288.c | 26 ++++++++++++++++++++++++++
> >   2 files changed, 27 insertions(+)
> >
> > diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
> > index b1008a5058..822d8d4e9c 100644
> > --- a/arch/arm/mach-rockchip/Kconfig
> > +++ b/arch/arm/mach-rockchip/Kconfig
> > @@ -98,6 +98,7 @@ config ROCKCHIP_RK322X
> >   config ROCKCHIP_RK3288
> >       bool "Support Rockchip RK3288"
> >       select CPU_V7A
> > +     select OF_BOARD_SETUP
> >       select SUPPORT_SPL
> >       select SPL
> >       select SUPPORT_TPL
> > diff --git a/arch/arm/mach-rockchip/rk3288/rk3288.c b/arch/arm/mach-rockchip/rk3288/rk3288.c
> > index 804abe8a1b..8a682675e6 100644
> > --- a/arch/arm/mach-rockchip/rk3288/rk3288.c
> > +++ b/arch/arm/mach-rockchip/rk3288/rk3288.c
> > @@ -115,6 +115,32 @@ int rk_board_late_init(void)
> >       return rk3288_board_late_init();
> >   }
> >
> > +#ifdef CONFIG_OF_BOARD_SETUP
> > +
> > +#define RK3288_HDMI_PHYS     0xff980000
> > +#define RK3288W_HDMI_REV     0x1A
> > +#define HDMI_CONFIG0_ID              0x04
> > +
> > +int ft_board_setup(void *blob, bd_t *bd)
> > +{
> > +     u8 config0;
> > +     int ret;
> > +
> > +     config0 = readb(RK3288_HDMI_PHYS + HDMI_CONFIG0_ID);
> > +     if (config0 == RK3288W_HDMI_REV) {
> > +             ret = fdt_setprop_string(blob, 0,
> > +                                      "compatible", "rockchip,rk3288w");
>
> Does this end up replacing the entire top-level compatible property?
> i.e. from:
>
>         compatible = "vendor,board\0rockchip,rk3288";
>
> to just:
>
>         compatible = "rockchip,rk3288w";
>
> If so, that's a bit of a problem for various drivers that care about the
> actual board compatible rather than the SoC.

Yes, It looks replacing the entire compatible. I think the root
compatible is mostly untouchable because of this reason.

But, if we skip the root compatible and trying to replace individual
nodes for W revision then it requires extra registration code on in
the Linux drivers like Linux clock driver is registering the clock
with rockchip,rk3288-cru but updating this compatible with
rockchip,rk3288w-cru will require another registration code. Having
common rockchip,rk3288w can be possible to check any code in the tree.

Jagan.

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

* [PATCH] rockchip: rk3288: Add OF board setup
@ 2020-07-03 10:10     ` Jagan Teki
  0 siblings, 0 replies; 16+ messages in thread
From: Jagan Teki @ 2020-07-03 10:10 UTC (permalink / raw)
  To: u-boot

On Thu, Jul 2, 2020 at 7:26 PM Robin Murphy <robin.murphy@arm.com> wrote:
>
> On 2020-07-02 09:48, Jagan Teki wrote:
> > The new rk3288 revision rk3288w has some changes with respect
> > to legacy rk3288 like hclk_vio and usb host0 ohci.
> >
> > In order to work these on the same in Linux kernel update the
> > compatible the root compatible with rockchip,rk3288w before
> > booting.
> >
> > So, this support during of board setup code of rk3288.
> >
> > Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> > ---
> >   arch/arm/mach-rockchip/Kconfig         |  1 +
> >   arch/arm/mach-rockchip/rk3288/rk3288.c | 26 ++++++++++++++++++++++++++
> >   2 files changed, 27 insertions(+)
> >
> > diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
> > index b1008a5058..822d8d4e9c 100644
> > --- a/arch/arm/mach-rockchip/Kconfig
> > +++ b/arch/arm/mach-rockchip/Kconfig
> > @@ -98,6 +98,7 @@ config ROCKCHIP_RK322X
> >   config ROCKCHIP_RK3288
> >       bool "Support Rockchip RK3288"
> >       select CPU_V7A
> > +     select OF_BOARD_SETUP
> >       select SUPPORT_SPL
> >       select SPL
> >       select SUPPORT_TPL
> > diff --git a/arch/arm/mach-rockchip/rk3288/rk3288.c b/arch/arm/mach-rockchip/rk3288/rk3288.c
> > index 804abe8a1b..8a682675e6 100644
> > --- a/arch/arm/mach-rockchip/rk3288/rk3288.c
> > +++ b/arch/arm/mach-rockchip/rk3288/rk3288.c
> > @@ -115,6 +115,32 @@ int rk_board_late_init(void)
> >       return rk3288_board_late_init();
> >   }
> >
> > +#ifdef CONFIG_OF_BOARD_SETUP
> > +
> > +#define RK3288_HDMI_PHYS     0xff980000
> > +#define RK3288W_HDMI_REV     0x1A
> > +#define HDMI_CONFIG0_ID              0x04
> > +
> > +int ft_board_setup(void *blob, bd_t *bd)
> > +{
> > +     u8 config0;
> > +     int ret;
> > +
> > +     config0 = readb(RK3288_HDMI_PHYS + HDMI_CONFIG0_ID);
> > +     if (config0 == RK3288W_HDMI_REV) {
> > +             ret = fdt_setprop_string(blob, 0,
> > +                                      "compatible", "rockchip,rk3288w");
>
> Does this end up replacing the entire top-level compatible property?
> i.e. from:
>
>         compatible = "vendor,board\0rockchip,rk3288";
>
> to just:
>
>         compatible = "rockchip,rk3288w";
>
> If so, that's a bit of a problem for various drivers that care about the
> actual board compatible rather than the SoC.

Yes, It looks replacing the entire compatible. I think the root
compatible is mostly untouchable because of this reason.

But, if we skip the root compatible and trying to replace individual
nodes for W revision then it requires extra registration code on in
the Linux drivers like Linux clock driver is registering the clock
with rockchip,rk3288-cru but updating this compatible with
rockchip,rk3288w-cru will require another registration code. Having
common rockchip,rk3288w can be possible to check any code in the tree.

Jagan.

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

* Re: [PATCH] rockchip: rk3288: Add OF board setup
  2020-07-03 10:10     ` Jagan Teki
@ 2020-07-03 12:39       ` Robin Murphy
  -1 siblings, 0 replies; 16+ messages in thread
From: Robin Murphy @ 2020-07-03 12:39 UTC (permalink / raw)
  To: Jagan Teki
  Cc: Kever Yang, Philipp Tomsich, Simon Glass, Heiko Stübner,
	Mylène Josserand, open list:ARM/Rockchip SoC...,
	U-Boot-Denx, Suniel Mahesh, Michael Trimarchi, linux-amarula

On 2020-07-03 11:10, Jagan Teki wrote:
> On Thu, Jul 2, 2020 at 7:26 PM Robin Murphy <robin.murphy@arm.com> wrote:
>>
>> On 2020-07-02 09:48, Jagan Teki wrote:
>>> The new rk3288 revision rk3288w has some changes with respect
>>> to legacy rk3288 like hclk_vio and usb host0 ohci.
>>>
>>> In order to work these on the same in Linux kernel update the
>>> compatible the root compatible with rockchip,rk3288w before
>>> booting.
>>>
>>> So, this support during of board setup code of rk3288.
>>>
>>> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
>>> ---
>>>    arch/arm/mach-rockchip/Kconfig         |  1 +
>>>    arch/arm/mach-rockchip/rk3288/rk3288.c | 26 ++++++++++++++++++++++++++
>>>    2 files changed, 27 insertions(+)
>>>
>>> diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
>>> index b1008a5058..822d8d4e9c 100644
>>> --- a/arch/arm/mach-rockchip/Kconfig
>>> +++ b/arch/arm/mach-rockchip/Kconfig
>>> @@ -98,6 +98,7 @@ config ROCKCHIP_RK322X
>>>    config ROCKCHIP_RK3288
>>>        bool "Support Rockchip RK3288"
>>>        select CPU_V7A
>>> +     select OF_BOARD_SETUP
>>>        select SUPPORT_SPL
>>>        select SPL
>>>        select SUPPORT_TPL
>>> diff --git a/arch/arm/mach-rockchip/rk3288/rk3288.c b/arch/arm/mach-rockchip/rk3288/rk3288.c
>>> index 804abe8a1b..8a682675e6 100644
>>> --- a/arch/arm/mach-rockchip/rk3288/rk3288.c
>>> +++ b/arch/arm/mach-rockchip/rk3288/rk3288.c
>>> @@ -115,6 +115,32 @@ int rk_board_late_init(void)
>>>        return rk3288_board_late_init();
>>>    }
>>>
>>> +#ifdef CONFIG_OF_BOARD_SETUP
>>> +
>>> +#define RK3288_HDMI_PHYS     0xff980000
>>> +#define RK3288W_HDMI_REV     0x1A
>>> +#define HDMI_CONFIG0_ID              0x04
>>> +
>>> +int ft_board_setup(void *blob, bd_t *bd)
>>> +{
>>> +     u8 config0;
>>> +     int ret;
>>> +
>>> +     config0 = readb(RK3288_HDMI_PHYS + HDMI_CONFIG0_ID);
>>> +     if (config0 == RK3288W_HDMI_REV) {
>>> +             ret = fdt_setprop_string(blob, 0,
>>> +                                      "compatible", "rockchip,rk3288w");
>>
>> Does this end up replacing the entire top-level compatible property?
>> i.e. from:
>>
>>          compatible = "vendor,board\0rockchip,rk3288";
>>
>> to just:
>>
>>          compatible = "rockchip,rk3288w";
>>
>> If so, that's a bit of a problem for various drivers that care about the
>> actual board compatible rather than the SoC.
> 
> Yes, It looks replacing the entire compatible. I think the root
> compatible is mostly untouchable because of this reason.
> 
> But, if we skip the root compatible and trying to replace individual
> nodes for W revision then it requires extra registration code on in
> the Linux drivers like Linux clock driver is registering the clock
> with rockchip,rk3288-cru but updating this compatible with
> rockchip,rk3288w-cru will require another registration code. Having
> common rockchip,rk3288w can be possible to check any code in the tree.

Right, it's definitely reasonable to update the top-level SoC 
compatible, we just need to be prepared to deal with a whole string list 
here. It looks like libfdt doesn't offer any nice helpers for 
inserting/removing/updating in string lists, but given that the SoC 
should be the last entry here we might be able to cheat a bit - just get 
the whole raw property, check that the final characters are exactly 
"rockchip,rk3288", and if so append a "w" to the end and write it back.

Robin.

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

* [PATCH] rockchip: rk3288: Add OF board setup
@ 2020-07-03 12:39       ` Robin Murphy
  0 siblings, 0 replies; 16+ messages in thread
From: Robin Murphy @ 2020-07-03 12:39 UTC (permalink / raw)
  To: u-boot

On 2020-07-03 11:10, Jagan Teki wrote:
> On Thu, Jul 2, 2020 at 7:26 PM Robin Murphy <robin.murphy@arm.com> wrote:
>>
>> On 2020-07-02 09:48, Jagan Teki wrote:
>>> The new rk3288 revision rk3288w has some changes with respect
>>> to legacy rk3288 like hclk_vio and usb host0 ohci.
>>>
>>> In order to work these on the same in Linux kernel update the
>>> compatible the root compatible with rockchip,rk3288w before
>>> booting.
>>>
>>> So, this support during of board setup code of rk3288.
>>>
>>> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
>>> ---
>>>    arch/arm/mach-rockchip/Kconfig         |  1 +
>>>    arch/arm/mach-rockchip/rk3288/rk3288.c | 26 ++++++++++++++++++++++++++
>>>    2 files changed, 27 insertions(+)
>>>
>>> diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
>>> index b1008a5058..822d8d4e9c 100644
>>> --- a/arch/arm/mach-rockchip/Kconfig
>>> +++ b/arch/arm/mach-rockchip/Kconfig
>>> @@ -98,6 +98,7 @@ config ROCKCHIP_RK322X
>>>    config ROCKCHIP_RK3288
>>>        bool "Support Rockchip RK3288"
>>>        select CPU_V7A
>>> +     select OF_BOARD_SETUP
>>>        select SUPPORT_SPL
>>>        select SPL
>>>        select SUPPORT_TPL
>>> diff --git a/arch/arm/mach-rockchip/rk3288/rk3288.c b/arch/arm/mach-rockchip/rk3288/rk3288.c
>>> index 804abe8a1b..8a682675e6 100644
>>> --- a/arch/arm/mach-rockchip/rk3288/rk3288.c
>>> +++ b/arch/arm/mach-rockchip/rk3288/rk3288.c
>>> @@ -115,6 +115,32 @@ int rk_board_late_init(void)
>>>        return rk3288_board_late_init();
>>>    }
>>>
>>> +#ifdef CONFIG_OF_BOARD_SETUP
>>> +
>>> +#define RK3288_HDMI_PHYS     0xff980000
>>> +#define RK3288W_HDMI_REV     0x1A
>>> +#define HDMI_CONFIG0_ID              0x04
>>> +
>>> +int ft_board_setup(void *blob, bd_t *bd)
>>> +{
>>> +     u8 config0;
>>> +     int ret;
>>> +
>>> +     config0 = readb(RK3288_HDMI_PHYS + HDMI_CONFIG0_ID);
>>> +     if (config0 == RK3288W_HDMI_REV) {
>>> +             ret = fdt_setprop_string(blob, 0,
>>> +                                      "compatible", "rockchip,rk3288w");
>>
>> Does this end up replacing the entire top-level compatible property?
>> i.e. from:
>>
>>          compatible = "vendor,board\0rockchip,rk3288";
>>
>> to just:
>>
>>          compatible = "rockchip,rk3288w";
>>
>> If so, that's a bit of a problem for various drivers that care about the
>> actual board compatible rather than the SoC.
> 
> Yes, It looks replacing the entire compatible. I think the root
> compatible is mostly untouchable because of this reason.
> 
> But, if we skip the root compatible and trying to replace individual
> nodes for W revision then it requires extra registration code on in
> the Linux drivers like Linux clock driver is registering the clock
> with rockchip,rk3288-cru but updating this compatible with
> rockchip,rk3288w-cru will require another registration code. Having
> common rockchip,rk3288w can be possible to check any code in the tree.

Right, it's definitely reasonable to update the top-level SoC 
compatible, we just need to be prepared to deal with a whole string list 
here. It looks like libfdt doesn't offer any nice helpers for 
inserting/removing/updating in string lists, but given that the SoC 
should be the last entry here we might be able to cheat a bit - just get 
the whole raw property, check that the final characters are exactly 
"rockchip,rk3288", and if so append a "w" to the end and write it back.

Robin.

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

* Re: [PATCH] rockchip: rk3288: Add OF board setup
  2020-07-03 12:39       ` Robin Murphy
@ 2020-07-03 14:04         ` Jagan Teki
  -1 siblings, 0 replies; 16+ messages in thread
From: Jagan Teki @ 2020-07-03 14:04 UTC (permalink / raw)
  To: Robin Murphy
  Cc: Kever Yang, Philipp Tomsich, Simon Glass, Heiko Stübner,
	Mylène Josserand, open list:ARM/Rockchip SoC...,
	U-Boot-Denx, Suniel Mahesh, Michael Trimarchi, linux-amarula

On Fri, Jul 3, 2020 at 6:09 PM Robin Murphy <robin.murphy@arm.com> wrote:
>
> On 2020-07-03 11:10, Jagan Teki wrote:
> > On Thu, Jul 2, 2020 at 7:26 PM Robin Murphy <robin.murphy@arm.com> wrote:
> >>
> >> On 2020-07-02 09:48, Jagan Teki wrote:
> >>> The new rk3288 revision rk3288w has some changes with respect
> >>> to legacy rk3288 like hclk_vio and usb host0 ohci.
> >>>
> >>> In order to work these on the same in Linux kernel update the
> >>> compatible the root compatible with rockchip,rk3288w before
> >>> booting.
> >>>
> >>> So, this support during of board setup code of rk3288.
> >>>
> >>> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> >>> ---
> >>>    arch/arm/mach-rockchip/Kconfig         |  1 +
> >>>    arch/arm/mach-rockchip/rk3288/rk3288.c | 26 ++++++++++++++++++++++++++
> >>>    2 files changed, 27 insertions(+)
> >>>
> >>> diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
> >>> index b1008a5058..822d8d4e9c 100644
> >>> --- a/arch/arm/mach-rockchip/Kconfig
> >>> +++ b/arch/arm/mach-rockchip/Kconfig
> >>> @@ -98,6 +98,7 @@ config ROCKCHIP_RK322X
> >>>    config ROCKCHIP_RK3288
> >>>        bool "Support Rockchip RK3288"
> >>>        select CPU_V7A
> >>> +     select OF_BOARD_SETUP
> >>>        select SUPPORT_SPL
> >>>        select SPL
> >>>        select SUPPORT_TPL
> >>> diff --git a/arch/arm/mach-rockchip/rk3288/rk3288.c b/arch/arm/mach-rockchip/rk3288/rk3288.c
> >>> index 804abe8a1b..8a682675e6 100644
> >>> --- a/arch/arm/mach-rockchip/rk3288/rk3288.c
> >>> +++ b/arch/arm/mach-rockchip/rk3288/rk3288.c
> >>> @@ -115,6 +115,32 @@ int rk_board_late_init(void)
> >>>        return rk3288_board_late_init();
> >>>    }
> >>>
> >>> +#ifdef CONFIG_OF_BOARD_SETUP
> >>> +
> >>> +#define RK3288_HDMI_PHYS     0xff980000
> >>> +#define RK3288W_HDMI_REV     0x1A
> >>> +#define HDMI_CONFIG0_ID              0x04
> >>> +
> >>> +int ft_board_setup(void *blob, bd_t *bd)
> >>> +{
> >>> +     u8 config0;
> >>> +     int ret;
> >>> +
> >>> +     config0 = readb(RK3288_HDMI_PHYS + HDMI_CONFIG0_ID);
> >>> +     if (config0 == RK3288W_HDMI_REV) {
> >>> +             ret = fdt_setprop_string(blob, 0,
> >>> +                                      "compatible", "rockchip,rk3288w");
> >>
> >> Does this end up replacing the entire top-level compatible property?
> >> i.e. from:
> >>
> >>          compatible = "vendor,board\0rockchip,rk3288";
> >>
> >> to just:
> >>
> >>          compatible = "rockchip,rk3288w";
> >>
> >> If so, that's a bit of a problem for various drivers that care about the
> >> actual board compatible rather than the SoC.
> >
> > Yes, It looks replacing the entire compatible. I think the root
> > compatible is mostly untouchable because of this reason.
> >
> > But, if we skip the root compatible and trying to replace individual
> > nodes for W revision then it requires extra registration code on in
> > the Linux drivers like Linux clock driver is registering the clock
> > with rockchip,rk3288-cru but updating this compatible with
> > rockchip,rk3288w-cru will require another registration code. Having
> > common rockchip,rk3288w can be possible to check any code in the tree.
>
> Right, it's definitely reasonable to update the top-level SoC
> compatible, we just need to be prepared to deal with a whole string list
> here. It looks like libfdt doesn't offer any nice helpers for
> inserting/removing/updating in string lists, but given that the SoC
> should be the last entry here we might be able to cheat a bit - just get
> the whole raw property, check that the final characters are exactly
> "rockchip,rk3288", and if so append a "w" to the end and write it back.

Look like exiting fdt helper does print the compatible up to \0
instead of whole root compatible, at least I have checked with
fdt_getpro and fdt_get_property.

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

* [PATCH] rockchip: rk3288: Add OF board setup
@ 2020-07-03 14:04         ` Jagan Teki
  0 siblings, 0 replies; 16+ messages in thread
From: Jagan Teki @ 2020-07-03 14:04 UTC (permalink / raw)
  To: u-boot

On Fri, Jul 3, 2020 at 6:09 PM Robin Murphy <robin.murphy@arm.com> wrote:
>
> On 2020-07-03 11:10, Jagan Teki wrote:
> > On Thu, Jul 2, 2020 at 7:26 PM Robin Murphy <robin.murphy@arm.com> wrote:
> >>
> >> On 2020-07-02 09:48, Jagan Teki wrote:
> >>> The new rk3288 revision rk3288w has some changes with respect
> >>> to legacy rk3288 like hclk_vio and usb host0 ohci.
> >>>
> >>> In order to work these on the same in Linux kernel update the
> >>> compatible the root compatible with rockchip,rk3288w before
> >>> booting.
> >>>
> >>> So, this support during of board setup code of rk3288.
> >>>
> >>> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> >>> ---
> >>>    arch/arm/mach-rockchip/Kconfig         |  1 +
> >>>    arch/arm/mach-rockchip/rk3288/rk3288.c | 26 ++++++++++++++++++++++++++
> >>>    2 files changed, 27 insertions(+)
> >>>
> >>> diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
> >>> index b1008a5058..822d8d4e9c 100644
> >>> --- a/arch/arm/mach-rockchip/Kconfig
> >>> +++ b/arch/arm/mach-rockchip/Kconfig
> >>> @@ -98,6 +98,7 @@ config ROCKCHIP_RK322X
> >>>    config ROCKCHIP_RK3288
> >>>        bool "Support Rockchip RK3288"
> >>>        select CPU_V7A
> >>> +     select OF_BOARD_SETUP
> >>>        select SUPPORT_SPL
> >>>        select SPL
> >>>        select SUPPORT_TPL
> >>> diff --git a/arch/arm/mach-rockchip/rk3288/rk3288.c b/arch/arm/mach-rockchip/rk3288/rk3288.c
> >>> index 804abe8a1b..8a682675e6 100644
> >>> --- a/arch/arm/mach-rockchip/rk3288/rk3288.c
> >>> +++ b/arch/arm/mach-rockchip/rk3288/rk3288.c
> >>> @@ -115,6 +115,32 @@ int rk_board_late_init(void)
> >>>        return rk3288_board_late_init();
> >>>    }
> >>>
> >>> +#ifdef CONFIG_OF_BOARD_SETUP
> >>> +
> >>> +#define RK3288_HDMI_PHYS     0xff980000
> >>> +#define RK3288W_HDMI_REV     0x1A
> >>> +#define HDMI_CONFIG0_ID              0x04
> >>> +
> >>> +int ft_board_setup(void *blob, bd_t *bd)
> >>> +{
> >>> +     u8 config0;
> >>> +     int ret;
> >>> +
> >>> +     config0 = readb(RK3288_HDMI_PHYS + HDMI_CONFIG0_ID);
> >>> +     if (config0 == RK3288W_HDMI_REV) {
> >>> +             ret = fdt_setprop_string(blob, 0,
> >>> +                                      "compatible", "rockchip,rk3288w");
> >>
> >> Does this end up replacing the entire top-level compatible property?
> >> i.e. from:
> >>
> >>          compatible = "vendor,board\0rockchip,rk3288";
> >>
> >> to just:
> >>
> >>          compatible = "rockchip,rk3288w";
> >>
> >> If so, that's a bit of a problem for various drivers that care about the
> >> actual board compatible rather than the SoC.
> >
> > Yes, It looks replacing the entire compatible. I think the root
> > compatible is mostly untouchable because of this reason.
> >
> > But, if we skip the root compatible and trying to replace individual
> > nodes for W revision then it requires extra registration code on in
> > the Linux drivers like Linux clock driver is registering the clock
> > with rockchip,rk3288-cru but updating this compatible with
> > rockchip,rk3288w-cru will require another registration code. Having
> > common rockchip,rk3288w can be possible to check any code in the tree.
>
> Right, it's definitely reasonable to update the top-level SoC
> compatible, we just need to be prepared to deal with a whole string list
> here. It looks like libfdt doesn't offer any nice helpers for
> inserting/removing/updating in string lists, but given that the SoC
> should be the last entry here we might be able to cheat a bit - just get
> the whole raw property, check that the final characters are exactly
> "rockchip,rk3288", and if so append a "w" to the end and write it back.

Look like exiting fdt helper does print the compatible up to \0
instead of whole root compatible, at least I have checked with
fdt_getpro and fdt_get_property.

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

* Re: [PATCH] rockchip: rk3288: Add OF board setup
  2020-07-03 14:04         ` Jagan Teki
@ 2020-07-04  8:55           ` Jagan Teki
  -1 siblings, 0 replies; 16+ messages in thread
From: Jagan Teki @ 2020-07-04  8:55 UTC (permalink / raw)
  To: Robin Murphy
  Cc: Kever Yang, Philipp Tomsich, Simon Glass, Heiko Stübner,
	Mylène Josserand, open list:ARM/Rockchip SoC...,
	U-Boot-Denx, Suniel Mahesh, Michael Trimarchi, linux-amarula

On Fri, Jul 3, 2020 at 7:34 PM Jagan Teki <jagan@amarulasolutions.com> wrote:
>
> On Fri, Jul 3, 2020 at 6:09 PM Robin Murphy <robin.murphy@arm.com> wrote:
> >
> > On 2020-07-03 11:10, Jagan Teki wrote:
> > > On Thu, Jul 2, 2020 at 7:26 PM Robin Murphy <robin.murphy@arm.com> wrote:
> > >>
> > >> On 2020-07-02 09:48, Jagan Teki wrote:
> > >>> The new rk3288 revision rk3288w has some changes with respect
> > >>> to legacy rk3288 like hclk_vio and usb host0 ohci.
> > >>>
> > >>> In order to work these on the same in Linux kernel update the
> > >>> compatible the root compatible with rockchip,rk3288w before
> > >>> booting.
> > >>>
> > >>> So, this support during of board setup code of rk3288.
> > >>>
> > >>> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> > >>> ---
> > >>>    arch/arm/mach-rockchip/Kconfig         |  1 +
> > >>>    arch/arm/mach-rockchip/rk3288/rk3288.c | 26 ++++++++++++++++++++++++++
> > >>>    2 files changed, 27 insertions(+)
> > >>>
> > >>> diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
> > >>> index b1008a5058..822d8d4e9c 100644
> > >>> --- a/arch/arm/mach-rockchip/Kconfig
> > >>> +++ b/arch/arm/mach-rockchip/Kconfig
> > >>> @@ -98,6 +98,7 @@ config ROCKCHIP_RK322X
> > >>>    config ROCKCHIP_RK3288
> > >>>        bool "Support Rockchip RK3288"
> > >>>        select CPU_V7A
> > >>> +     select OF_BOARD_SETUP
> > >>>        select SUPPORT_SPL
> > >>>        select SPL
> > >>>        select SUPPORT_TPL
> > >>> diff --git a/arch/arm/mach-rockchip/rk3288/rk3288.c b/arch/arm/mach-rockchip/rk3288/rk3288.c
> > >>> index 804abe8a1b..8a682675e6 100644
> > >>> --- a/arch/arm/mach-rockchip/rk3288/rk3288.c
> > >>> +++ b/arch/arm/mach-rockchip/rk3288/rk3288.c
> > >>> @@ -115,6 +115,32 @@ int rk_board_late_init(void)
> > >>>        return rk3288_board_late_init();
> > >>>    }
> > >>>
> > >>> +#ifdef CONFIG_OF_BOARD_SETUP
> > >>> +
> > >>> +#define RK3288_HDMI_PHYS     0xff980000
> > >>> +#define RK3288W_HDMI_REV     0x1A
> > >>> +#define HDMI_CONFIG0_ID              0x04
> > >>> +
> > >>> +int ft_board_setup(void *blob, bd_t *bd)
> > >>> +{
> > >>> +     u8 config0;
> > >>> +     int ret;
> > >>> +
> > >>> +     config0 = readb(RK3288_HDMI_PHYS + HDMI_CONFIG0_ID);
> > >>> +     if (config0 == RK3288W_HDMI_REV) {
> > >>> +             ret = fdt_setprop_string(blob, 0,
> > >>> +                                      "compatible", "rockchip,rk3288w");
> > >>
> > >> Does this end up replacing the entire top-level compatible property?
> > >> i.e. from:
> > >>
> > >>          compatible = "vendor,board\0rockchip,rk3288";
> > >>
> > >> to just:
> > >>
> > >>          compatible = "rockchip,rk3288w";
> > >>
> > >> If so, that's a bit of a problem for various drivers that care about the
> > >> actual board compatible rather than the SoC.
> > >
> > > Yes, It looks replacing the entire compatible. I think the root
> > > compatible is mostly untouchable because of this reason.
> > >
> > > But, if we skip the root compatible and trying to replace individual
> > > nodes for W revision then it requires extra registration code on in
> > > the Linux drivers like Linux clock driver is registering the clock
> > > with rockchip,rk3288-cru but updating this compatible with
> > > rockchip,rk3288w-cru will require another registration code. Having
> > > common rockchip,rk3288w can be possible to check any code in the tree.
> >
> > Right, it's definitely reasonable to update the top-level SoC
> > compatible, we just need to be prepared to deal with a whole string list
> > here. It looks like libfdt doesn't offer any nice helpers for
> > inserting/removing/updating in string lists, but given that the SoC
> > should be the last entry here we might be able to cheat a bit - just get
> > the whole raw property, check that the final characters are exactly
> > "rockchip,rk3288", and if so append a "w" to the end and write it back.
>
> Look like exiting fdt helper does print the compatible up to \0
> instead of whole root compatible, at least I have checked with
> fdt_getpro and fdt_get_property.

Look like we didn't have any requirement to change the root compatible
at this point since disabling ohci driver for legacy rk3288 revision
chips of no use.


Jagan.

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

* [PATCH] rockchip: rk3288: Add OF board setup
@ 2020-07-04  8:55           ` Jagan Teki
  0 siblings, 0 replies; 16+ messages in thread
From: Jagan Teki @ 2020-07-04  8:55 UTC (permalink / raw)
  To: u-boot

On Fri, Jul 3, 2020 at 7:34 PM Jagan Teki <jagan@amarulasolutions.com> wrote:
>
> On Fri, Jul 3, 2020 at 6:09 PM Robin Murphy <robin.murphy@arm.com> wrote:
> >
> > On 2020-07-03 11:10, Jagan Teki wrote:
> > > On Thu, Jul 2, 2020 at 7:26 PM Robin Murphy <robin.murphy@arm.com> wrote:
> > >>
> > >> On 2020-07-02 09:48, Jagan Teki wrote:
> > >>> The new rk3288 revision rk3288w has some changes with respect
> > >>> to legacy rk3288 like hclk_vio and usb host0 ohci.
> > >>>
> > >>> In order to work these on the same in Linux kernel update the
> > >>> compatible the root compatible with rockchip,rk3288w before
> > >>> booting.
> > >>>
> > >>> So, this support during of board setup code of rk3288.
> > >>>
> > >>> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> > >>> ---
> > >>>    arch/arm/mach-rockchip/Kconfig         |  1 +
> > >>>    arch/arm/mach-rockchip/rk3288/rk3288.c | 26 ++++++++++++++++++++++++++
> > >>>    2 files changed, 27 insertions(+)
> > >>>
> > >>> diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
> > >>> index b1008a5058..822d8d4e9c 100644
> > >>> --- a/arch/arm/mach-rockchip/Kconfig
> > >>> +++ b/arch/arm/mach-rockchip/Kconfig
> > >>> @@ -98,6 +98,7 @@ config ROCKCHIP_RK322X
> > >>>    config ROCKCHIP_RK3288
> > >>>        bool "Support Rockchip RK3288"
> > >>>        select CPU_V7A
> > >>> +     select OF_BOARD_SETUP
> > >>>        select SUPPORT_SPL
> > >>>        select SPL
> > >>>        select SUPPORT_TPL
> > >>> diff --git a/arch/arm/mach-rockchip/rk3288/rk3288.c b/arch/arm/mach-rockchip/rk3288/rk3288.c
> > >>> index 804abe8a1b..8a682675e6 100644
> > >>> --- a/arch/arm/mach-rockchip/rk3288/rk3288.c
> > >>> +++ b/arch/arm/mach-rockchip/rk3288/rk3288.c
> > >>> @@ -115,6 +115,32 @@ int rk_board_late_init(void)
> > >>>        return rk3288_board_late_init();
> > >>>    }
> > >>>
> > >>> +#ifdef CONFIG_OF_BOARD_SETUP
> > >>> +
> > >>> +#define RK3288_HDMI_PHYS     0xff980000
> > >>> +#define RK3288W_HDMI_REV     0x1A
> > >>> +#define HDMI_CONFIG0_ID              0x04
> > >>> +
> > >>> +int ft_board_setup(void *blob, bd_t *bd)
> > >>> +{
> > >>> +     u8 config0;
> > >>> +     int ret;
> > >>> +
> > >>> +     config0 = readb(RK3288_HDMI_PHYS + HDMI_CONFIG0_ID);
> > >>> +     if (config0 == RK3288W_HDMI_REV) {
> > >>> +             ret = fdt_setprop_string(blob, 0,
> > >>> +                                      "compatible", "rockchip,rk3288w");
> > >>
> > >> Does this end up replacing the entire top-level compatible property?
> > >> i.e. from:
> > >>
> > >>          compatible = "vendor,board\0rockchip,rk3288";
> > >>
> > >> to just:
> > >>
> > >>          compatible = "rockchip,rk3288w";
> > >>
> > >> If so, that's a bit of a problem for various drivers that care about the
> > >> actual board compatible rather than the SoC.
> > >
> > > Yes, It looks replacing the entire compatible. I think the root
> > > compatible is mostly untouchable because of this reason.
> > >
> > > But, if we skip the root compatible and trying to replace individual
> > > nodes for W revision then it requires extra registration code on in
> > > the Linux drivers like Linux clock driver is registering the clock
> > > with rockchip,rk3288-cru but updating this compatible with
> > > rockchip,rk3288w-cru will require another registration code. Having
> > > common rockchip,rk3288w can be possible to check any code in the tree.
> >
> > Right, it's definitely reasonable to update the top-level SoC
> > compatible, we just need to be prepared to deal with a whole string list
> > here. It looks like libfdt doesn't offer any nice helpers for
> > inserting/removing/updating in string lists, but given that the SoC
> > should be the last entry here we might be able to cheat a bit - just get
> > the whole raw property, check that the final characters are exactly
> > "rockchip,rk3288", and if so append a "w" to the end and write it back.
>
> Look like exiting fdt helper does print the compatible up to \0
> instead of whole root compatible, at least I have checked with
> fdt_getpro and fdt_get_property.

Look like we didn't have any requirement to change the root compatible
at this point since disabling ohci driver for legacy rk3288 revision
chips of no use.


Jagan.

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

* Re: [PATCH] rockchip: rk3288: Add OF board setup
  2020-07-02  8:48 ` Jagan Teki
@ 2020-07-08 10:04   ` Kever Yang
  -1 siblings, 0 replies; 16+ messages in thread
From: Kever Yang @ 2020-07-08 10:04 UTC (permalink / raw)
  To: Jagan Teki, Philipp Tomsich, Simon Glass, heiko, mylene.josserand
  Cc: Suniel Mahesh, Michael Trimarchi, U-Boot-Denx, linux-rockchip,
	linux-amarula


On 2020/7/2 下午4:48, Jagan Teki wrote:
> The new rk3288 revision rk3288w has some changes with respect
> to legacy rk3288 like hclk_vio and usb host0 ohci.
>
> In order to work these on the same in Linux kernel update the
> compatible the root compatible with rockchip,rk3288w before
> booting.
>
> So, this support during of board setup code of rk3288.
>
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

Reviewed-by: Kever Yang<kever.yang@rock-chips.com>

Thanks,
- Kever

> ---
>   arch/arm/mach-rockchip/Kconfig         |  1 +
>   arch/arm/mach-rockchip/rk3288/rk3288.c | 26 ++++++++++++++++++++++++++
>   2 files changed, 27 insertions(+)
>
> diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
> index b1008a5058..822d8d4e9c 100644
> --- a/arch/arm/mach-rockchip/Kconfig
> +++ b/arch/arm/mach-rockchip/Kconfig
> @@ -98,6 +98,7 @@ config ROCKCHIP_RK322X
>   config ROCKCHIP_RK3288
>   	bool "Support Rockchip RK3288"
>   	select CPU_V7A
> +	select OF_BOARD_SETUP
>   	select SUPPORT_SPL
>   	select SPL
>   	select SUPPORT_TPL
> diff --git a/arch/arm/mach-rockchip/rk3288/rk3288.c b/arch/arm/mach-rockchip/rk3288/rk3288.c
> index 804abe8a1b..8a682675e6 100644
> --- a/arch/arm/mach-rockchip/rk3288/rk3288.c
> +++ b/arch/arm/mach-rockchip/rk3288/rk3288.c
> @@ -115,6 +115,32 @@ int rk_board_late_init(void)
>   	return rk3288_board_late_init();
>   }
>   
> +#ifdef CONFIG_OF_BOARD_SETUP
> +
> +#define RK3288_HDMI_PHYS	0xff980000
> +#define RK3288W_HDMI_REV	0x1A
> +#define HDMI_CONFIG0_ID		0x04
> +
> +int ft_board_setup(void *blob, bd_t *bd)
> +{
> +	u8 config0;
> +	int ret;
> +
> +	config0 = readb(RK3288_HDMI_PHYS + HDMI_CONFIG0_ID);
> +	if (config0 == RK3288W_HDMI_REV) {
> +		ret = fdt_setprop_string(blob, 0,
> +					 "compatible", "rockchip,rk3288w");
> +		if (ret < 0) {
> +			printf("failed to set rk3288w compatible (ret=%d)\n",
> +			       ret);
> +			return ret;
> +		}
> +	}
> +
> +	return 0;
> +}
> +#endif
> +
>   static int do_clock(struct cmd_tbl *cmdtp, int flag, int argc,
>   		    char *const argv[])
>   {

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

* [PATCH] rockchip: rk3288: Add OF board setup
@ 2020-07-08 10:04   ` Kever Yang
  0 siblings, 0 replies; 16+ messages in thread
From: Kever Yang @ 2020-07-08 10:04 UTC (permalink / raw)
  To: u-boot


On 2020/7/2 ??4:48, Jagan Teki wrote:
> The new rk3288 revision rk3288w has some changes with respect
> to legacy rk3288 like hclk_vio and usb host0 ohci.
>
> In order to work these on the same in Linux kernel update the
> compatible the root compatible with rockchip,rk3288w before
> booting.
>
> So, this support during of board setup code of rk3288.
>
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

Reviewed-by: Kever Yang<kever.yang@rock-chips.com>

Thanks,
- Kever

> ---
>   arch/arm/mach-rockchip/Kconfig         |  1 +
>   arch/arm/mach-rockchip/rk3288/rk3288.c | 26 ++++++++++++++++++++++++++
>   2 files changed, 27 insertions(+)
>
> diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
> index b1008a5058..822d8d4e9c 100644
> --- a/arch/arm/mach-rockchip/Kconfig
> +++ b/arch/arm/mach-rockchip/Kconfig
> @@ -98,6 +98,7 @@ config ROCKCHIP_RK322X
>   config ROCKCHIP_RK3288
>   	bool "Support Rockchip RK3288"
>   	select CPU_V7A
> +	select OF_BOARD_SETUP
>   	select SUPPORT_SPL
>   	select SPL
>   	select SUPPORT_TPL
> diff --git a/arch/arm/mach-rockchip/rk3288/rk3288.c b/arch/arm/mach-rockchip/rk3288/rk3288.c
> index 804abe8a1b..8a682675e6 100644
> --- a/arch/arm/mach-rockchip/rk3288/rk3288.c
> +++ b/arch/arm/mach-rockchip/rk3288/rk3288.c
> @@ -115,6 +115,32 @@ int rk_board_late_init(void)
>   	return rk3288_board_late_init();
>   }
>   
> +#ifdef CONFIG_OF_BOARD_SETUP
> +
> +#define RK3288_HDMI_PHYS	0xff980000
> +#define RK3288W_HDMI_REV	0x1A
> +#define HDMI_CONFIG0_ID		0x04
> +
> +int ft_board_setup(void *blob, bd_t *bd)
> +{
> +	u8 config0;
> +	int ret;
> +
> +	config0 = readb(RK3288_HDMI_PHYS + HDMI_CONFIG0_ID);
> +	if (config0 == RK3288W_HDMI_REV) {
> +		ret = fdt_setprop_string(blob, 0,
> +					 "compatible", "rockchip,rk3288w");
> +		if (ret < 0) {
> +			printf("failed to set rk3288w compatible (ret=%d)\n",
> +			       ret);
> +			return ret;
> +		}
> +	}
> +
> +	return 0;
> +}
> +#endif
> +
>   static int do_clock(struct cmd_tbl *cmdtp, int flag, int argc,
>   		    char *const argv[])
>   {

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

* Re: [PATCH] rockchip: rk3288: Add OF board setup
  2020-07-08 10:04   ` Kever Yang
@ 2020-07-08 10:10     ` Jagan Teki
  -1 siblings, 0 replies; 16+ messages in thread
From: Jagan Teki @ 2020-07-08 10:10 UTC (permalink / raw)
  To: Kever Yang
  Cc: Philipp Tomsich, Simon Glass, Heiko Stübner,
	Mylène Josserand, Suniel Mahesh, Michael Trimarchi,
	U-Boot-Denx, open list:ARM/Rockchip SoC...,
	linux-amarula

On Wed, Jul 8, 2020 at 3:35 PM Kever Yang <kever.yang@rock-chips.com> wrote:
>
>
> On 2020/7/2 下午4:48, Jagan Teki wrote:
> > The new rk3288 revision rk3288w has some changes with respect
> > to legacy rk3288 like hclk_vio and usb host0 ohci.
> >
> > In order to work these on the same in Linux kernel update the
> > compatible the root compatible with rockchip,rk3288w before
> > booting.
> >
> > So, this support during of board setup code of rk3288.
> >
> > Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
>
> Reviewed-by: Kever Yang<kever.yang@rock-chips.com>

Added v2 for this. please have a look

Jagan.

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

* [PATCH] rockchip: rk3288: Add OF board setup
@ 2020-07-08 10:10     ` Jagan Teki
  0 siblings, 0 replies; 16+ messages in thread
From: Jagan Teki @ 2020-07-08 10:10 UTC (permalink / raw)
  To: u-boot

On Wed, Jul 8, 2020 at 3:35 PM Kever Yang <kever.yang@rock-chips.com> wrote:
>
>
> On 2020/7/2 ??4:48, Jagan Teki wrote:
> > The new rk3288 revision rk3288w has some changes with respect
> > to legacy rk3288 like hclk_vio and usb host0 ohci.
> >
> > In order to work these on the same in Linux kernel update the
> > compatible the root compatible with rockchip,rk3288w before
> > booting.
> >
> > So, this support during of board setup code of rk3288.
> >
> > Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
>
> Reviewed-by: Kever Yang<kever.yang@rock-chips.com>

Added v2 for this. please have a look

Jagan.

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

end of thread, other threads:[~2020-07-08 10:10 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-02  8:48 [PATCH] rockchip: rk3288: Add OF board setup Jagan Teki
2020-07-02  8:48 ` Jagan Teki
2020-07-02 13:56 ` Robin Murphy
2020-07-02 13:56   ` Robin Murphy
2020-07-03 10:10   ` Jagan Teki
2020-07-03 10:10     ` Jagan Teki
2020-07-03 12:39     ` Robin Murphy
2020-07-03 12:39       ` Robin Murphy
2020-07-03 14:04       ` Jagan Teki
2020-07-03 14:04         ` Jagan Teki
2020-07-04  8:55         ` Jagan Teki
2020-07-04  8:55           ` Jagan Teki
2020-07-08 10:04 ` Kever Yang
2020-07-08 10:04   ` Kever Yang
2020-07-08 10:10   ` Jagan Teki
2020-07-08 10:10     ` Jagan Teki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.