[U-Boot,3/3] rockchip: updata the style of reporting sdram cap

Message ID 1515725502-26051-1-git-send-email-huan.he@rock-chips.com
State Changes Requested
Delegated to: Philipp Tomsich
Headers show
Series
  • Untitled series #22925
Related show

Commit Message

huan.he@rock-chips.com Jan. 12, 2018, 2:51 a.m.
updata the style of reporting sdram capacity to uboot

Signed-off-by: zhihuan he <huan.he@rock-chips.com>
---

 arch/arm/mach-rockchip/rv1108/rv1108.c | 30 ++++++++++++++++++++++
 board/rockchip/evb_rv1108/evb_rv1108.c | 47 ----------------------------------
 2 files changed, 30 insertions(+), 47 deletions(-)

Patch

diff --git a/arch/arm/mach-rockchip/rv1108/rv1108.c b/arch/arm/mach-rockchip/rv1108/rv1108.c
index 868cdd5..68343ed 100644
--- a/arch/arm/mach-rockchip/rv1108/rv1108.c
+++ b/arch/arm/mach-rockchip/rv1108/rv1108.c
@@ -5,6 +5,9 @@ 
  */
 
 #include <common.h>
+#include <asm/io.h>
+#include <asm/arch/hardware.h>
+#include <asm/arch/sdram_rv1108.h>
 
 #ifndef CONFIG_SYS_DCACHE_OFF
 void enable_caches(void)
@@ -13,3 +16,30 @@  void enable_caches(void)
 	dcache_enable();
 }
 #endif
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int board_init(void)
+{
+	return 0;
+}
+
+#define GRF_BASE		0x10300000
+
+int dram_init(void)
+{
+	gd->ram_size = sdram_size();
+
+	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;
+}
diff --git a/board/rockchip/evb_rv1108/evb_rv1108.c b/board/rockchip/evb_rv1108/evb_rv1108.c
index fe37eac..f497615 100644
--- a/board/rockchip/evb_rv1108/evb_rv1108.c
+++ b/board/rockchip/evb_rv1108/evb_rv1108.c
@@ -3,50 +3,3 @@ 
  * Authors: Andy Yan <andy.yan@rock-chips.com>
  * SPDX-License-Identifier:     GPL-2.0+
  */
-
-#include <common.h>
-#include <asm/io.h>
-#include <fdtdec.h>
-#include <asm/arch/grf_rv1108.h>
-#include <asm/arch/hardware.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-int mach_cpu_init(void)
-{
-	int node;
-	struct rv1108_grf *grf;
-
-	node = fdt_node_offset_by_compatible(gd->fdt_blob, -1, "rockchip,rv1108-grf");
-	grf = (struct rv1108_grf *)fdtdec_get_addr(gd->fdt_blob, node, "reg");
-
-	/*evb board use UART2 m0 for debug*/
-	rk_clrsetreg(&grf->gpio2d_iomux,
-		     GPIO2D2_MASK | GPIO2D1_MASK,
-		     GPIO2D2_UART2_SOUT_M0 << GPIO2D2_SHIFT |
-		     GPIO2D1_UART2_SIN_M0 << GPIO2D1_SHIFT);
-	rk_clrreg(&grf->gpio3c_iomux, GPIO3C3_MASK | GPIO3C2_MASK);
-
-	return 0;
-}
-
-
-int board_init(void)
-{
-	return 0;
-}
-
-int dram_init(void)
-{
-	gd->ram_size = 0x8000000;
-
-	return 0;
-}
-
-int dram_init_banksize(void)
-{
-	gd->bd->bi_dram[0].start = 0x60000000;
-	gd->bd->bi_dram[0].size = 0x8000000;
-
-	return 0;
-}