2 * (C) Copyright 2016 Rockchip Electronics Co., Ltd.
4 * SPDX-License-Identifier: GPL-2.0
11 #include <asm/arch/clock.h>
12 #include <asm/arch/grf_rk3368.h>
13 #include <asm/arch/sdram_common.h>
15 DECLARE_GLOBAL_DATA_PTR;
18 struct rk3368_pmu_grf *pmugrf;
21 static int rk3368_dmc_probe(struct udevice *dev)
23 struct dram_info *priv = dev_get_priv(dev);
25 priv->pmugrf = syscon_get_first_range(ROCKCHIP_SYSCON_PMUGRF);
26 debug("%s: grf=%p\n", __func__, priv->pmugrf);
27 priv->info.base = CONFIG_SYS_SDRAM_BASE;
28 priv->info.size = rockchip_sdram_size(
29 (phys_addr_t)&priv->pmugrf->os_reg[2]);
34 static int rk3368_dmc_get_info(struct udevice *dev, struct ram_info *info)
36 struct dram_info *priv = dev_get_priv(dev);
43 static struct ram_ops rk3368_dmc_ops = {
44 .get_info = rk3368_dmc_get_info,
48 static const struct udevice_id rk3368_dmc_ids[] = {
49 { .compatible = "rockchip,rk3368-dmc" },
53 U_BOOT_DRIVER(dmc_rk3368) = {
54 .name = "rockchip_rk3368_dmc",
56 .of_match = rk3368_dmc_ids,
57 .ops = &rk3368_dmc_ops,
58 .probe = rk3368_dmc_probe,
59 .priv_auto_alloc_size = sizeof(struct dram_info),