Index | Thread | Search

From:
pasta <pasta@pastatech.eu>
Subject:
Re: RK3588 board reset on reboot
To:
Jan Schreiber <jes@posteo.de>
Cc:
tech@openbsd.org
Date:
Wed, 15 Jul 2026 16:05:03 +0200

Download raw body.

Thread
out of curiosity, what board or other special stuff are you using?
i've probably rebooted always my rk3588 (rock5b) more than a thousand
times and never seen the message you are talking about

On Wed, Jul 15, 2026 at 01:47:34PM +0000, Jan Schreiber wrote:
> When rebooting a RK3588 more often than not I a serial output that wants
> me to reset the board. When using following patch it does reboot
> reliably.
> 
> Values are found the RK3588 TRM Part 1.
> 
> diff --git sys/dev/fdt/rkclock.c sys/dev/fdt/rkclock.c
> index 5cf37730bbd..3237e698bb7 100644
> --- sys/dev/fdt/rkclock.c
> +++ sys/dev/fdt/rkclock.c
> @@ -235,6 +235,8 @@
>  #define RK3588_CRU_CLKSEL_CON(i)	(0x00300 + (i) * 4)
>  #define RK3588_CRU_GATE_CON(i)		(0x00800 + (i) * 4)
>  #define RK3588_CRU_SOFTRST_CON(i)	(0x00a00 + (i) * 4)
> +#define RK3588_CRU_GLB_SRST_FST		0x00c08
> +#define  RK3588_GLB_SRST_FST_VAL		0xfdb9
> 
>  #define RK3588_PHPTOPCRU_PPLL_CON(i)	(0x08200 + (i) * 4)
>  #define RK3588_PHPTOPCRU_SOFTRST_CON(i)	(0x08a00 + (i) * 4)
> @@ -4987,11 +4989,28 @@ const uint32_t rk3588_gates[78] = {
>  	[66] = 0x00000004,
>  };
> 
> +extern void (*cpuresetfn)(void);
> +struct rkclock_softc *rk3588_cru_sc;
> +
> +void
> +rk3588_cpureset(void)
> +{
> +	struct rkclock_softc *sc = rk3588_cru_sc;
> +
> +	if (sc != NULL)
> +		HWRITE4(sc, RK3588_CRU_GLB_SRST_FST, RK3588_GLB_SRST_FST_VAL);
> +	for (;;)
> +		continue;
> +}
> +
>  void
>  rk3588_init(struct rkclock_softc *sc)
>  {
>  	int i;
> 
> +	rk3588_cru_sc = sc;
> +	cpuresetfn = rk3588_cpureset;
> +
>  	/* The code below assumes all clocks are enabled.  Check this!. */
>  	for (i = 0; i < nitems(rk3588_gates); i++) {
>  		if (HREAD4(sc, RK3588_CRU_GATE_CON(i)) != rk3588_gates[i]) {
>