Heiko Stuebner | 0d75bd1 | 2025-04-15 23:51:20 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
| 3 | * (C) Copyright 2024 Rockchip Electronics Co., Ltd. |
| 4 | */ |
| 5 | |
| 6 | #include <dm.h> |
| 7 | #include <ram.h> |
| 8 | #include <asm/arch-rockchip/sdram.h> |
| 9 | |
| 10 | #define PMU1GRF_BASE 0x26026000 |
| 11 | #define OS_REG2_REG 0x208 |
| 12 | |
| 13 | static int rk3576_dmc_get_info(struct udevice *dev, struct ram_info *info) |
| 14 | { |
| 15 | info->base = CFG_SYS_SDRAM_BASE; |
| 16 | info->size = rockchip_sdram_size(PMU1GRF_BASE + OS_REG2_REG); |
| 17 | |
| 18 | return 0; |
| 19 | } |
| 20 | |
| 21 | static struct ram_ops rk3576_dmc_ops = { |
| 22 | .get_info = rk3576_dmc_get_info, |
| 23 | }; |
| 24 | |
| 25 | static const struct udevice_id rk3576_dmc_ids[] = { |
| 26 | { .compatible = "rockchip,rk3576-dmc" }, |
| 27 | { } |
| 28 | }; |
| 29 | |
| 30 | U_BOOT_DRIVER(rockchip_rk3576_dmc) = { |
| 31 | .name = "rockchip_rk3576_dmc", |
| 32 | .id = UCLASS_RAM, |
| 33 | .of_match = rk3576_dmc_ids, |
| 34 | .ops = &rk3576_dmc_ops, |
| 35 | }; |