mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [urgent] ARM: rockchip: fix iodomain for r2pro V1.0
@ 2022-05-14 15:56 Frank Wunderlich
  2022-05-16  8:37 ` Sascha Hauer
  2022-05-16  8:41 ` Sascha Hauer
  0 siblings, 2 replies; 4+ messages in thread
From: Frank Wunderlich @ 2022-05-14 15:56 UTC (permalink / raw)
  To: barebox; +Cc: Frank Wunderlich

From: Frank Wunderlich <frank-w@public-files.de>

Current code sets vccio4 and vccio6 both to 1v8. R2Pro v1.0 needs 3v3
setting on vccio4, else gmac0 (switch for lan-ports) will be damaged.

IO-domain is per default 3v3 so only vccio6 needs to be set to 1v8 and
clear this bit in the 3v3 register.

Fixes: 8ba96c5942d6 ("ARM: rockchip: add BPI-R2-Pro V00 board")
Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
---
 arch/arm/boards/rockchip-rk3568-bpi-r2pro/lowlevel.c | 9 ++++++---
 arch/arm/mach-rockchip/include/mach/rockchip.h       | 3 +++
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boards/rockchip-rk3568-bpi-r2pro/lowlevel.c b/arch/arm/boards/rockchip-rk3568-bpi-r2pro/lowlevel.c
index 4c5b4751b3fb..2a6e0700233a 100644
--- a/arch/arm/boards/rockchip-rk3568-bpi-r2pro/lowlevel.c
+++ b/arch/arm/boards/rockchip-rk3568-bpi-r2pro/lowlevel.c
@@ -17,10 +17,13 @@ static noinline void rk3568_start(void *fdt_blob_fixed_offset)
 	void *fdt;
 
 	/*
-	 * Enable vccio4 1.8V and vccio6 1.8V
-	 * Needed for GMAC to work.
+	 * set iodomain vccio6 to 1.8V needed for GMAC1 to work.
+	 * vccio4 (gmac0/switch) needs to stay at 3v3 (default)
 	 */
-	writel(RK_SETBITS(0x50), 0xfdc20140);
+	//set bit 6 in PMU_GRF_IO_VSEL0 for vccio6 1v8
+	writel(RK_SETBITS(BIT(6)), PMU_GRF_IO_VSEL0);
+	//clear bit 6 for 3v3 as it was set to 1v8
+	writel(RK_CLRBITS(BIT(6)), PMU_GRF_IO_VSEL1);
 
 	fdt = fdt_blob_fixed_offset;
 
diff --git a/arch/arm/mach-rockchip/include/mach/rockchip.h b/arch/arm/mach-rockchip/include/mach/rockchip.h
index f24db36f0161..ff8b1109f858 100644
--- a/arch/arm/mach-rockchip/include/mach/rockchip.h
+++ b/arch/arm/mach-rockchip/include/mach/rockchip.h
@@ -23,6 +23,9 @@ static inline int rk3288_init(void)
 
 #ifdef CONFIG_ARCH_RK3568
 int rk3568_init(void);
+#define PMU_GRF		0xfdc20000
+#define PMU_GRF_IO_VSEL0	(PMU_GRF + 0x140)
+#define PMU_GRF_IO_VSEL1	(PMU_GRF + 0x144)
 #else
 static inline int rk3568_init(void)
 {
-- 
2.25.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


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

* Re: [urgent] ARM: rockchip: fix iodomain for r2pro V1.0
  2022-05-14 15:56 [urgent] ARM: rockchip: fix iodomain for r2pro V1.0 Frank Wunderlich
@ 2022-05-16  8:37 ` Sascha Hauer
  2022-05-16  8:41 ` Sascha Hauer
  1 sibling, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2022-05-16  8:37 UTC (permalink / raw)
  To: Frank Wunderlich; +Cc: barebox, Frank Wunderlich

On Sat, May 14, 2022 at 05:56:09PM +0200, Frank Wunderlich wrote:
> From: Frank Wunderlich <frank-w@public-files.de>
> 
> Current code sets vccio4 and vccio6 both to 1v8. R2Pro v1.0 needs 3v3
> setting on vccio4, else gmac0 (switch for lan-ports) will be damaged.
> 
> IO-domain is per default 3v3 so only vccio6 needs to be set to 1v8 and
> clear this bit in the 3v3 register.
> 
> Fixes: 8ba96c5942d6 ("ARM: rockchip: add BPI-R2-Pro V00 board")
> Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
> ---
>  arch/arm/boards/rockchip-rk3568-bpi-r2pro/lowlevel.c | 9 ++++++---
>  arch/arm/mach-rockchip/include/mach/rockchip.h       | 3 +++
>  2 files changed, 9 insertions(+), 3 deletions(-)

Applied, thanks

Sascha

> 
> diff --git a/arch/arm/boards/rockchip-rk3568-bpi-r2pro/lowlevel.c b/arch/arm/boards/rockchip-rk3568-bpi-r2pro/lowlevel.c
> index 4c5b4751b3fb..2a6e0700233a 100644
> --- a/arch/arm/boards/rockchip-rk3568-bpi-r2pro/lowlevel.c
> +++ b/arch/arm/boards/rockchip-rk3568-bpi-r2pro/lowlevel.c
> @@ -17,10 +17,13 @@ static noinline void rk3568_start(void *fdt_blob_fixed_offset)
>  	void *fdt;
>  
>  	/*
> -	 * Enable vccio4 1.8V and vccio6 1.8V
> -	 * Needed for GMAC to work.
> +	 * set iodomain vccio6 to 1.8V needed for GMAC1 to work.
> +	 * vccio4 (gmac0/switch) needs to stay at 3v3 (default)
>  	 */
> -	writel(RK_SETBITS(0x50), 0xfdc20140);
> +	//set bit 6 in PMU_GRF_IO_VSEL0 for vccio6 1v8
> +	writel(RK_SETBITS(BIT(6)), PMU_GRF_IO_VSEL0);
> +	//clear bit 6 for 3v3 as it was set to 1v8
> +	writel(RK_CLRBITS(BIT(6)), PMU_GRF_IO_VSEL1);
>  
>  	fdt = fdt_blob_fixed_offset;
>  
> diff --git a/arch/arm/mach-rockchip/include/mach/rockchip.h b/arch/arm/mach-rockchip/include/mach/rockchip.h
> index f24db36f0161..ff8b1109f858 100644
> --- a/arch/arm/mach-rockchip/include/mach/rockchip.h
> +++ b/arch/arm/mach-rockchip/include/mach/rockchip.h
> @@ -23,6 +23,9 @@ static inline int rk3288_init(void)
>  
>  #ifdef CONFIG_ARCH_RK3568
>  int rk3568_init(void);
> +#define PMU_GRF		0xfdc20000
> +#define PMU_GRF_IO_VSEL0	(PMU_GRF + 0x140)
> +#define PMU_GRF_IO_VSEL1	(PMU_GRF + 0x144)
>  #else
>  static inline int rk3568_init(void)
>  {
> -- 
> 2.25.1
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


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

* Re: [urgent] ARM: rockchip: fix iodomain for r2pro V1.0
  2022-05-14 15:56 [urgent] ARM: rockchip: fix iodomain for r2pro V1.0 Frank Wunderlich
  2022-05-16  8:37 ` Sascha Hauer
@ 2022-05-16  8:41 ` Sascha Hauer
  2022-05-16  9:11   ` Frank Wunderlich
  1 sibling, 1 reply; 4+ messages in thread
From: Sascha Hauer @ 2022-05-16  8:41 UTC (permalink / raw)
  To: Frank Wunderlich; +Cc: barebox, Frank Wunderlich

On Sat, May 14, 2022 at 05:56:09PM +0200, Frank Wunderlich wrote:
> From: Frank Wunderlich <frank-w@public-files.de>
> 
> Current code sets vccio4 and vccio6 both to 1v8. R2Pro v1.0 needs 3v3
> setting on vccio4, else gmac0 (switch for lan-ports) will be damaged.

By damaged you mean physically damaged? How can this happen? Does that
mean some input signals are not 3v3 tolerant when the domain is supplied
with 1v8?

Sascha

> 
> IO-domain is per default 3v3 so only vccio6 needs to be set to 1v8 and
> clear this bit in the 3v3 register.
> 
> Fixes: 8ba96c5942d6 ("ARM: rockchip: add BPI-R2-Pro V00 board")
> Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
> ---
>  arch/arm/boards/rockchip-rk3568-bpi-r2pro/lowlevel.c | 9 ++++++---
>  arch/arm/mach-rockchip/include/mach/rockchip.h       | 3 +++
>  2 files changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/boards/rockchip-rk3568-bpi-r2pro/lowlevel.c b/arch/arm/boards/rockchip-rk3568-bpi-r2pro/lowlevel.c
> index 4c5b4751b3fb..2a6e0700233a 100644
> --- a/arch/arm/boards/rockchip-rk3568-bpi-r2pro/lowlevel.c
> +++ b/arch/arm/boards/rockchip-rk3568-bpi-r2pro/lowlevel.c
> @@ -17,10 +17,13 @@ static noinline void rk3568_start(void *fdt_blob_fixed_offset)
>  	void *fdt;
>  
>  	/*
> -	 * Enable vccio4 1.8V and vccio6 1.8V
> -	 * Needed for GMAC to work.
> +	 * set iodomain vccio6 to 1.8V needed for GMAC1 to work.
> +	 * vccio4 (gmac0/switch) needs to stay at 3v3 (default)
>  	 */
> -	writel(RK_SETBITS(0x50), 0xfdc20140);
> +	//set bit 6 in PMU_GRF_IO_VSEL0 for vccio6 1v8
> +	writel(RK_SETBITS(BIT(6)), PMU_GRF_IO_VSEL0);
> +	//clear bit 6 for 3v3 as it was set to 1v8
> +	writel(RK_CLRBITS(BIT(6)), PMU_GRF_IO_VSEL1);
>  
>  	fdt = fdt_blob_fixed_offset;
>  
> diff --git a/arch/arm/mach-rockchip/include/mach/rockchip.h b/arch/arm/mach-rockchip/include/mach/rockchip.h
> index f24db36f0161..ff8b1109f858 100644
> --- a/arch/arm/mach-rockchip/include/mach/rockchip.h
> +++ b/arch/arm/mach-rockchip/include/mach/rockchip.h
> @@ -23,6 +23,9 @@ static inline int rk3288_init(void)
>  
>  #ifdef CONFIG_ARCH_RK3568
>  int rk3568_init(void);
> +#define PMU_GRF		0xfdc20000
> +#define PMU_GRF_IO_VSEL0	(PMU_GRF + 0x140)
> +#define PMU_GRF_IO_VSEL1	(PMU_GRF + 0x144)
>  #else
>  static inline int rk3568_init(void)
>  {
> -- 
> 2.25.1
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


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

* Re: [urgent] ARM: rockchip: fix iodomain for r2pro V1.0
  2022-05-16  8:41 ` Sascha Hauer
@ 2022-05-16  9:11   ` Frank Wunderlich
  0 siblings, 0 replies; 4+ messages in thread
From: Frank Wunderlich @ 2022-05-16  9:11 UTC (permalink / raw)
  To: Sascha Hauer, Frank Wunderlich; +Cc: barebox

Am 16. Mai 2022 10:41:26 MESZ schrieb Sascha Hauer <s.hauer@pengutronix.de>:
>On Sat, May 14, 2022 at 05:56:09PM +0200, Frank Wunderlich wrote:
>> From: Frank Wunderlich <frank-w@public-files.de>
>> 
>> Current code sets vccio4 and vccio6 both to 1v8. R2Pro v1.0 needs 3v3
>> setting on vccio4, else gmac0 (switch for lan-ports) will be damaged.
>
>By damaged you mean physically damaged? How can this happen? Does that
>mean some input signals are not 3v3 tolerant when the domain is
>supplied
>with 1v8?

Yes, if iodomain is set to 1v8 and board works with 3v3 signals it breaks hardware physically (affected me). I know this for device tree,but did not noticed this direct register write.

>Sascha
>
>> 
>> IO-domain is per default 3v3 so only vccio6 needs to be set to 1v8
>and
>> clear this bit in the 3v3 register.
>> 
>> Fixes: 8ba96c5942d6 ("ARM: rockchip: add BPI-R2-Pro V00 board")
>> Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
>> ---
>>  arch/arm/boards/rockchip-rk3568-bpi-r2pro/lowlevel.c | 9 ++++++---
>>  arch/arm/mach-rockchip/include/mach/rockchip.h       | 3 +++
>>  2 files changed, 9 insertions(+), 3 deletions(-)
>> 
>> diff --git a/arch/arm/boards/rockchip-rk3568-bpi-r2pro/lowlevel.c
>b/arch/arm/boards/rockchip-rk3568-bpi-r2pro/lowlevel.c
>> index 4c5b4751b3fb..2a6e0700233a 100644
>> --- a/arch/arm/boards/rockchip-rk3568-bpi-r2pro/lowlevel.c
>> +++ b/arch/arm/boards/rockchip-rk3568-bpi-r2pro/lowlevel.c
>> @@ -17,10 +17,13 @@ static noinline void rk3568_start(void
>*fdt_blob_fixed_offset)
>>  	void *fdt;
>>  
>>  	/*
>> -	 * Enable vccio4 1.8V and vccio6 1.8V
>> -	 * Needed for GMAC to work.
>> +	 * set iodomain vccio6 to 1.8V needed for GMAC1 to work.
>> +	 * vccio4 (gmac0/switch) needs to stay at 3v3 (default)
>>  	 */
>> -	writel(RK_SETBITS(0x50), 0xfdc20140);
>> +	//set bit 6 in PMU_GRF_IO_VSEL0 for vccio6 1v8
>> +	writel(RK_SETBITS(BIT(6)), PMU_GRF_IO_VSEL0);
>> +	//clear bit 6 for 3v3 as it was set to 1v8
>> +	writel(RK_CLRBITS(BIT(6)), PMU_GRF_IO_VSEL1);
>>  
>>  	fdt = fdt_blob_fixed_offset;
>>  
>> diff --git a/arch/arm/mach-rockchip/include/mach/rockchip.h
>b/arch/arm/mach-rockchip/include/mach/rockchip.h
>> index f24db36f0161..ff8b1109f858 100644
>> --- a/arch/arm/mach-rockchip/include/mach/rockchip.h
>> +++ b/arch/arm/mach-rockchip/include/mach/rockchip.h
>> @@ -23,6 +23,9 @@ static inline int rk3288_init(void)
>>  
>>  #ifdef CONFIG_ARCH_RK3568
>>  int rk3568_init(void);
>> +#define PMU_GRF		0xfdc20000
>> +#define PMU_GRF_IO_VSEL0	(PMU_GRF + 0x140)
>> +#define PMU_GRF_IO_VSEL1	(PMU_GRF + 0x144)
>>  #else
>>  static inline int rk3568_init(void)
>>  {
>> -- 
>> 2.25.1
>> 
>> 


regards Frank

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


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

end of thread, other threads:[~2022-05-16  9:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-14 15:56 [urgent] ARM: rockchip: fix iodomain for r2pro V1.0 Frank Wunderlich
2022-05-16  8:37 ` Sascha Hauer
2022-05-16  8:41 ` Sascha Hauer
2022-05-16  9:11   ` Frank Wunderlich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox