[PATCH 1/9] ram: rockchip: rk3568: Simplify get_info() ops
Jonas Karlman <[email protected]> Tue, 4 Aug 2026 10:57:10 +0000
| Newsgroups | gmane.comp.boot-loaders.u-boot |
|---|---|
| Message-ID | <[email protected]> |
The PMUGRF base address is fixed and known at compile time. However, the base address is read from DT at runtime in this driver, delaying reading the two HW regs to determine RAM size by several ms. Change to use a constant for the PMUGRF base address to speed up reading RAM size and simplify the driver by removing use of probe and private data. The driver list entry name is also renamed to match the compatible, for possible use with OF_PLATDATA. Signed-off-by: Jonas Karlman <[email protected]> --- drivers/ram/rockchip/sdram_rk3568.c | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-) diff --git a/drivers/ram/rockchip/sdram_rk3568.c b/drivers/ram/rockchip/sdram_rk3568.c index a252d5c70106..d768b849a0f7 100644 --- a/drivers/ram/rockchip/sdram_rk3568.c +++ b/drivers/ram/rockchip/sdram_rk3568.c @@ -3,36 +3,19 @@ * (C) Copyright 2021 Rockchip Electronics Co., Ltd. */ -#include <config.h> #include <dm.h> #include <ram.h> -#include <syscon.h> -#include <asm/arch-rockchip/clock.h> #include <asm/arch-rockchip/grf_rk3568.h> #include <asm/arch-rockchip/sdram.h> -struct dram_info { - struct ram_info info; - struct rk3568_pmugrf *pmugrf; -}; - -static int rk3568_dmc_probe(struct udevice *dev) -{ - struct dram_info *priv = dev_get_priv(dev); - - priv->pmugrf = syscon_get_first_range(ROCKCHIP_SYSCON_PMUGRF); - priv->info.base = CFG_SYS_SDRAM_BASE; - priv->info.size = - rockchip_sdram_size((phys_addr_t)&priv->pmugrf->pmu_os_reg2); - - return 0; -} +#define PMUGRF_BASE 0xfdc20000 static int rk3568_dmc_get_info(struct udevice *dev, struct ram_info *info) { - struct dram_info *priv = dev_get_priv(dev); + static struct rk3568_pmugrf * const pmugrf = (void *)PMUGRF_BASE; - *info = priv->info; + info->base = CFG_SYS_SDRAM_BASE; + info->size = rockchip_sdram_size((phys_addr_t)&pmugrf->pmu_os_reg2); return 0; } @@ -46,11 +29,9 @@ static const struct udevice_id rk3568_dmc_ids[] = { { } }; -U_BOOT_DRIVER(dmc_rk3568) = { +U_BOOT_DRIVER(rockchip_rk3568_dmc) = { .name = "rockchip_rk3568_dmc", .id = UCLASS_RAM, .of_match = rk3568_dmc_ids, .ops = &rk3568_dmc_ops, - .probe = rk3568_dmc_probe, - .priv_auto = sizeof(struct dram_info), }; -- 2.54.0