From bb52f1c604d09b0c378addfa5c75c82efc219b03 Mon Sep 17 00:00:00 2001 From: Eugen Hristev Date: Mon, 15 May 2023 13:55:04 +0300 Subject: reset: rockchip: implement rk3588 lookup table The current DT bindings for the rk3588 clock use a different ID than the one that is supposed to be written to the hardware registers. Thus, we cannot use directly the id provided in the phandle, but rather use a lookup table to correctly setup the hardware. This approach has been implemented already in Linux, by commit : f1c506d152ff ("clk: rockchip: add clock controller for the RK3588") Hence, implement a similar approach using the lookup table, and adapt the existing reset driver to work with SoCs using lookup table. The file rst-rk3588.c has been copied as much as possible from Linux. Adapt the clk rk3588 driver as well to bind the reset driver with the lookup table. Reviewed-by: Kever Yang Signed-off-by: Eugen Hristev --- arch/arm/include/asm/arch-rockchip/clock.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'arch/arm/include/asm') diff --git a/arch/arm/include/asm/arch-rockchip/clock.h b/arch/arm/include/asm/arch-rockchip/clock.h index f002ebc..f01c5ae 100644 --- a/arch/arm/include/asm/arch-rockchip/clock.h +++ b/arch/arm/include/asm/arch-rockchip/clock.h @@ -194,5 +194,26 @@ int rockchip_get_clk(struct udevice **devp); * Return: 0 success, or error value */ int rockchip_reset_bind(struct udevice *pdev, u32 reg_offset, u32 reg_number); +/* + * rockchip_reset_bind_lut() - Bind soft reset device as child of clock device + * using a dedicated SoC lookup table + * @pdev: clock udevice + * @lookup_table: register lookup_table dedicated to SoC + * @reg_offset: the first offset in cru for softreset registers + * @reg_number: the reg numbers of softreset registers + * Return: 0 success, or error value + */ +int rockchip_reset_bind_lut(struct udevice *pdev, const int *lookup_table, + u32 reg_offset, u32 reg_number); +/* + * rk3588_reset_bind_lut() - Bind soft reset device as child of clock device + * using dedicated RK3588 lookup table + * + * @pdev: clock udevice + * @reg_offset: the first offset in cru for softreset registers + * @reg_number: the reg numbers of softreset registers + * Return: 0 success, or error value + */ +int rk3588_reset_bind_lut(struct udevice *pdev, u32 reg_offset, u32 reg_number); #endif -- cgit v1.1