* [U-Boot] [PATCH] rockchip: rk3399: use actual dram size
@ 2017-04-12 10:38 Kever Yang
2017-04-16 19:31 ` Simon Glass
0 siblings, 1 reply; 2+ messages in thread
From: Kever Yang @ 2017-04-12 10:38 UTC (permalink / raw)
To: u-boot
Since our sdram driver is ready, we can use the actual size
instead of hard code.
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
---
arch/arm/mach-rockchip/rk3399/sdram_rk3399.c | 8 ++++----
board/rockchip/evb_rk3399/evb-rk3399.c | 19 ++++++++++++++++++-
2 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/arch/arm/mach-rockchip/rk3399/sdram_rk3399.c b/arch/arm/mach-rockchip/rk3399/sdram_rk3399.c
index 749b52c..536879d 100644
--- a/arch/arm/mach-rockchip/rk3399/sdram_rk3399.c
+++ b/arch/arm/mach-rockchip/rk3399/sdram_rk3399.c
@@ -1280,6 +1280,8 @@ static int rk3399_dmc_probe(struct udevice *dev)
priv->pmugrf = syscon_get_first_range(ROCKCHIP_SYSCON_PMUGRF);
debug("%s: pmugrf=%p\n", __func__, priv->pmugrf);
+ priv->info.base = 0;
+ priv->info.size = sdram_size_mb(priv) << 20;
#endif
return 0;
}
@@ -1288,9 +1290,7 @@ static int rk3399_dmc_get_info(struct udevice *dev, struct ram_info *info)
{
struct dram_info *priv = dev_get_priv(dev);
- info = &priv->info;
- priv->info.base = 0;
- priv->info.size = sdram_size_mb(priv) << 20;
+ *info = priv->info;
return 0;
}
@@ -1314,8 +1314,8 @@ U_BOOT_DRIVER(dmc_rk3399) = {
.ofdata_to_platdata = rk3399_dmc_ofdata_to_platdata,
#endif
.probe = rk3399_dmc_probe,
-#ifdef CONFIG_SPL_BUILD
.priv_auto_alloc_size = sizeof(struct dram_info),
+#ifdef CONFIG_SPL_BUILD
.platdata_auto_alloc_size = sizeof(struct rockchip_dmc_plat),
#endif
};
diff --git a/board/rockchip/evb_rk3399/evb-rk3399.c b/board/rockchip/evb_rk3399/evb-rk3399.c
index 4b0d83c..6f9a954 100644
--- a/board/rockchip/evb_rk3399/evb-rk3399.c
+++ b/board/rockchip/evb_rk3399/evb-rk3399.c
@@ -5,6 +5,7 @@
*/
#include <common.h>
#include <dm.h>
+#include <ram.h>
#include <dm/pinctrl.h>
#include <dm/uclass-internal.h>
#include <asm/arch/periph.h>
@@ -65,7 +66,23 @@ out:
int dram_init(void)
{
- gd->ram_size = 0x80000000;
+ struct ram_info ram;
+ struct udevice *dev;
+ int ret;
+
+ ret = uclass_get_device(UCLASS_RAM, 0, &dev);
+ if (ret) {
+ debug("DRAM init failed: %d\n", ret);
+ return ret;
+ }
+ ret = ram_get_info(dev, &ram);
+ if (ret) {
+ debug("Cannot get DRAM size: %d\n", ret);
+ return ret;
+ }
+ debug("SDRAM base=%lx, size=%x\n", ram.base, ram.size);
+ gd->ram_size = ram.size;
+
return 0;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [U-Boot] [PATCH] rockchip: rk3399: use actual dram size
2017-04-12 10:38 [U-Boot] [PATCH] rockchip: rk3399: use actual dram size Kever Yang
@ 2017-04-16 19:31 ` Simon Glass
0 siblings, 0 replies; 2+ messages in thread
From: Simon Glass @ 2017-04-16 19:31 UTC (permalink / raw)
To: u-boot
On 12 April 2017 at 04:38, Kever Yang <kever.yang@rock-chips.com> wrote:
> Since our sdram driver is ready, we can use the actual size
> instead of hard code.
>
> Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
> ---
>
> arch/arm/mach-rockchip/rk3399/sdram_rk3399.c | 8 ++++----
> board/rockchip/evb_rk3399/evb-rk3399.c | 19 ++++++++++++++++++-
> 2 files changed, 22 insertions(+), 5 deletions(-)
>
Acked-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-04-16 19:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-12 10:38 [U-Boot] [PATCH] rockchip: rk3399: use actual dram size Kever Yang
2017-04-16 19:31 ` Simon Glass
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.