driver: ram: rv1108: use common code to setup ddr parameter
use rockchip_setup_ddr_param to setup ddr parameter. The dram_init() and dram_init_banksize() make use of sdram common code. Change-Id: Icfc6cbef9fcc128e3a835184b46b89b9b22aab16 Signed-off-by: Zhihuan He <huan.he@rock-chips.com>
This commit is contained in:
parent
4cd861d04b
commit
e5f393836b
|
|
@ -57,24 +57,3 @@ void board_debug_uart_init(void)
|
|||
#endif
|
||||
#endif /*CONFIG_SPL_BUILD*/
|
||||
}
|
||||
|
||||
int dram_init(void)
|
||||
{
|
||||
struct rv1108_grf *grf = (void *)GRF_BASE;
|
||||
|
||||
gd->ram_size = rockchip_sdram_size((phys_addr_t)&grf->os_reg2);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int dram_init_banksize(void)
|
||||
{
|
||||
size_t max_size = min((unsigned long)(gd->ram_size +
|
||||
CONFIG_SYS_SDRAM_BASE), gd->ram_top);
|
||||
|
||||
gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
|
||||
gd->bd->bi_dram[0].size = max_size - gd->bd->bi_dram[0].start;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ CONFIG_ARM=y
|
|||
# CONFIG_SPL_USE_ARCH_MEMCPY is not set
|
||||
# CONFIG_SPL_USE_ARCH_MEMSET is not set
|
||||
CONFIG_ARCH_ROCKCHIP=y
|
||||
CONFIG_SPL_LIBCOMMON_SUPPORT=y
|
||||
CONFIG_SPL_LIBGENERIC_SUPPORT=y
|
||||
CONFIG_SYS_MALLOC_F_LEN=0x2000
|
||||
CONFIG_ROCKCHIP_RV1108=y
|
||||
CONFIG_SPL_ROCKCHIP_BACK_TO_BROM=y
|
||||
|
|
@ -16,6 +18,7 @@ CONFIG_DEBUG_UART=y
|
|||
# CONFIG_DISPLAY_CPUINFO is not set
|
||||
CONFIG_ANDROID_BOOTLOADER=y
|
||||
CONFIG_SPL_STACK_R=y
|
||||
CONFIG_PANIC_HANG=y
|
||||
CONFIG_TPL_TINY_FRAMEWORK=y
|
||||
CONFIG_TPL_SERIAL_SUPPORT=y
|
||||
CONFIG_FASTBOOT_BUF_ADDR=0x62000000
|
||||
|
|
@ -35,11 +38,12 @@ CONFIG_CMD_TIME=y
|
|||
CONFIG_SPL_OF_CONTROL=y
|
||||
CONFIG_TPL_OF_CONTROL=y
|
||||
CONFIG_OF_LIVE=y
|
||||
CONFIG_SPL_OF_PLATDATA=y
|
||||
CONFIG_TPL_OF_PLATDATA=y
|
||||
CONFIG_NET_RANDOM_ETHADDR=y
|
||||
CONFIG_REGMAP=y
|
||||
CONFIG_SPL_REGMAP=y
|
||||
CONFIG_SYSCON=y
|
||||
CONFIG_SPL_SYSCON=y
|
||||
CONFIG_CLK=y
|
||||
CONFIG_ROCKCHIP_GPIO=y
|
||||
CONFIG_SYS_I2C_ROCKCHIP=y
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ obj-$(CONFIG_ROCKCHIP_RK3399) += sdram_rk3399.o
|
|||
obj-$(CONFIG_ROCKCHIP_PX30) += sdram_px30.o sdram_pctl_px30.o sdram_phy_px30.o
|
||||
obj-$(CONFIG_ROCKCHIP_PX30) += rockchip_sdram.o
|
||||
obj-$(CONFIG_ROCKCHIP_RK1808) = rockchip_sdram.o
|
||||
obj-$(CONFIG_ROCKCHIP_RV1108) += rockchip_sdram.o
|
||||
obj-$(CONFIG_ROCKCHIP_RK3036) = rockchip_sdram.o
|
||||
obj-$(CONFIG_ROCKCHIP_RK3308) = rockchip_sdram.o
|
||||
ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_TPL_BUILD),)
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#include <syscon.h>
|
||||
#include <asm/arch/clock.h>
|
||||
#include <asm/arch/grf_px30.h>
|
||||
#include <asm/arch/grf_rv1108.h>
|
||||
#include <asm/arch/grf_rk1808.h>
|
||||
#include <asm/arch/grf_rk3036.h>
|
||||
#include <asm/arch/grf_rk3308.h>
|
||||
|
|
@ -28,7 +29,13 @@ static int dmc_probe(struct udevice *dev)
|
|||
struct dram_info *priv = dev_get_priv(dev);
|
||||
|
||||
if (!(gd->flags & GD_FLG_RELOC)) {
|
||||
#if defined(CONFIG_ROCKCHIP_RK3036)
|
||||
#if defined(CONFIG_ROCKCHIP_RV1108)
|
||||
struct rv1108_grf *grf =
|
||||
syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
|
||||
|
||||
priv->info.size =
|
||||
rockchip_sdram_size((phys_addr_t)&grf->os_reg2);
|
||||
#elif defined(CONFIG_ROCKCHIP_RK3036)
|
||||
struct rk3036_grf *grf =
|
||||
syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
|
||||
|
||||
|
|
@ -81,7 +88,9 @@ static struct ram_ops dmc_ops = {
|
|||
};
|
||||
|
||||
static const struct udevice_id dmc_ids[] = {
|
||||
#if defined(CONFIG_ROCKCHIP_RK3036)
|
||||
#if defined(CONFIG_ROCKCHIP_RV1108)
|
||||
{ .compatible = "rockchip,rv1108-dmc" },
|
||||
#elif defined(CONFIG_ROCKCHIP_RK3036)
|
||||
{ .compatible = "rockchip,rk3036-dmc" },
|
||||
#elif defined(CONFIG_ROCKCHIP_RK3308)
|
||||
{ .compatible = "rockchip,rk3308-dmc" },
|
||||
|
|
|
|||
|
|
@ -112,9 +112,21 @@ void *get_base_addr(unsigned int *reg, unsigned int offset)
|
|||
return (void *)p;
|
||||
}
|
||||
|
||||
void get_ddr_param(struct dram_info *sdram_priv,
|
||||
struct ddr_param *ddr_param)
|
||||
{
|
||||
size_t ram_size =
|
||||
rockchip_sdram_size((phys_addr_t)&sdram_priv->grf->os_reg2);
|
||||
|
||||
ddr_param->count = 1;
|
||||
ddr_param->para[0] = CONFIG_SYS_SDRAM_BASE;
|
||||
ddr_param->para[1] = ram_size;
|
||||
}
|
||||
|
||||
int sdram_init(void)
|
||||
{
|
||||
int ret;
|
||||
struct ddr_param ddr_param;
|
||||
struct dram_info *sdram_priv = &info;
|
||||
struct driver_info *info =
|
||||
ll_entry_start(struct driver_info, driver_info);
|
||||
|
|
@ -136,5 +148,8 @@ int sdram_init(void)
|
|||
if (ret)
|
||||
debug("rv1108_sdram_init() fail!");
|
||||
|
||||
get_ddr_param(sdram_priv, &ddr_param);
|
||||
rockchip_setup_ddr_param(&ddr_param);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
/* SPL support */
|
||||
#define CONFIG_SPL_STACK 0x10080700
|
||||
#define CONFIG_SPL_TEXT_BASE 0x10080800
|
||||
#define CONFIG_SPL_MAX_SIZE 0x1700
|
||||
#define CONFIG_SPL_MAX_SIZE 0x4000
|
||||
|
||||
/* BSS setup */
|
||||
#define CONFIG_SPL_BSS_MAX_SIZE 0x100
|
||||
|
|
|
|||
Loading…
Reference in New Issue