Index | Thread | Search

From:
Mark Kettenis <mark.kettenis@xs4all.nl>
Subject:
Re: rkclock: add rk3528 i2c5 clk
To:
Jonathan Matthew <jonathan@d14n.org>
Cc:
tech@openbsd.org, kettenis@openbsd.org
Date:
Wed, 16 Sep 2026 16:26:58 +0200

Download raw body.

Thread
> Date: Wed, 16 Sep 2026 14:39:24 +1000
> From: Jonathan Matthew <jonathan@d14n.org>
> 
> The Radxa E24C has its rtc battery attached to its 6th i2c controller,
> which we're currently lacking a clock definition for.  With the diff below,
> derived from linux code, since I still can't find an RK3528 TRM, the
> rtc starts working:
> 
> pcxrtc0 at iic2 addr 0x51: battery ok
> 
> (it's iic2 because only i2c1, i2c2 and i2c5 are enabled in the device tree)
> 
> ok?

ok kettenis@

> Index: rkclock.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/fdt/rkclock.c,v
> diff -u -p -r1.99 rkclock.c
> --- rkclock.c	5 May 2026 10:23:27 -0000	1.99
> +++ rkclock.c	16 Sep 2026 04:26:14 -0000
> @@ -3255,6 +3255,12 @@ const struct rkclock rk3528_clocks[] = {
>  		{ RK3528_XIN24M }
>  	},
>  	{
> +		RK3528_CLK_I2C5, RK3528_CRU_CLKSEL_CON(63),
> +		SEL(15, 14), 0,
> +		{ RK3528_CLK_MATRIX_200M_SRC, RK3528_CLK_MATRIX_100M_SRC,
> +		  RK3528_CLK_MATRIX_50M_SRC, RK3528_XIN24M }
> +	},
> +	{
>  		RK3528_CLK_GMAC1_SRC_VPU, 0, 0, 0,
>  		{ RK3528_CLK_PPLL_125M_MATRIX }
>  	},
> Index: rkclock_clocks.h
> ===================================================================
> RCS file: /cvs/src/sys/dev/fdt/rkclock_clocks.h,v
> diff -u -p -r1.71 rkclock_clocks.h
> --- rkclock_clocks.h	5 May 2026 10:23:27 -0000	1.71
> +++ rkclock_clocks.h	16 Sep 2026 04:26:14 -0000
> @@ -303,6 +303,7 @@
>  #define RK3528_CCLK_SRC_EMMC		140
>  #define RK3528_BCLK_EMMC		143
>  #define RK3528_TCLK_EMMC		144
> +#define RK3528_CLK_I2C5			167
>  #define RK3528_CLK_GMAC1_SRC_VPU	173
>  #define RK3528_CLK_I2C1			221
>  #define RK3528_CCLK_SRC_SDMMC0		295
> 
>