rockchip: px30: add sdram driver

This driver only add support to ram frame work, do not have really
dram init driver.

Change-Id: I4c079bcbfea1fc1079df536cf505b8ca87848f44
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
This commit is contained in:
Kever Yang 2018-01-22 15:08:12 +08:00
parent c876650a87
commit 5eeb396bc2
2 changed files with 61 additions and 0 deletions

View File

@ -11,3 +11,4 @@ obj-$(CONFIG_ROCKCHIP_RK322X) = sdram_rk322x.o
obj-$(CONFIG_ROCKCHIP_RK3288) = sdram_rk3288.o
obj-$(CONFIG_ROCKCHIP_RK3328) = sdram_rk3328.o
obj-$(CONFIG_ROCKCHIP_RK3399) = sdram_rk3399.o
obj-$(CONFIG_ROCKCHIP_PX30) = sdram_px30.o

View File

@ -0,0 +1,60 @@
/*
* (C) Copyright 2017 Rockchip Electronics Co., Ltd.
*
* SPDX-License-Identifier: GPL-2.0
*/
#include <common.h>
#include <dm.h>
#include <ram.h>
#include <syscon.h>
#include <asm/arch/clock.h>
#include <asm/arch/grf_px30.h>
#include <asm/arch/sdram_common.h>
DECLARE_GLOBAL_DATA_PTR;
struct dram_info {
struct ram_info info;
struct px30_pmugrf *pmugrf;
};
static int px30_dmc_probe(struct udevice *dev)
{
struct dram_info *priv = dev_get_priv(dev);
priv->pmugrf = syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
debug("%s: pmugrf=%p\n", __func__, priv->pmugrf);
priv->info.base = CONFIG_SYS_SDRAM_BASE;
priv->info.size = rockchip_sdram_size(
(phys_addr_t)&priv->pmugrf->os_reg[2]);
return 0;
}
static int px30_dmc_get_info(struct udevice *dev, struct ram_info *info)
{
struct dram_info *priv = dev_get_priv(dev);
*info = priv->info;
return 0;
}
static struct ram_ops px30_dmc_ops = {
.get_info = px30_dmc_get_info,
};
static const struct udevice_id px30_dmc_ids[] = {
{ .compatible = "rockchip,px30-dmc" },
{ }
};
U_BOOT_DRIVER(dmc_px30) = {
.name = "rockchip_px30_dmc",
.id = UCLASS_RAM,
.of_match = px30_dmc_ids,
.ops = &px30_dmc_ops,
.probe = px30_dmc_probe,
.priv_auto_alloc_size = sizeof(struct dram_info),
};