ARC: [DeviceTree] Convert some Kconfig items to runtime values
* mem size now runtime configured (prev CONFIG_ARC_PLAT_SDRAM_SIZE)
* core cpu clk runtime configured (prev CONFIG_ARC_PLAT_CLK)
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Grant Likely <grant.likely@secretlab.ca>
diff --git a/arch/arc/mm/init.c b/arch/arc/mm/init.c
index 682cf57..caf797d 100644
--- a/arch/arc/mm/init.c
+++ b/arch/arc/mm/init.c
@@ -25,7 +25,7 @@
EXPORT_SYMBOL(empty_zero_page);
/* Default tot mem from .config */
-static unsigned long arc_mem_sz = CONFIG_ARC_PLAT_SDRAM_SIZE;
+static unsigned long arc_mem_sz = 0x20000000; /* some default */
/* User can over-ride above with "mem=nnn[KkMm]" in cmdline */
static int __init setup_mem_sz(char *str)
@@ -41,7 +41,8 @@
void __init early_init_dt_add_memory_arch(u64 base, u64 size)
{
- pr_err("%s(%llx, %llx)\n", __func__, base, size);
+ arc_mem_sz = size & PAGE_MASK;
+ pr_info("Memory size set via devicetree %ldM\n", TO_MB(arc_mem_sz));
}
/*
@@ -62,7 +63,9 @@
/*
* We do it here, so that memory is correctly instantiated
- * even if "mem=xxx" cmline over-ride is not given
+ * even if "mem=xxx" cmline over-ride is given and/or
+ * DT has memory node. Each causes an update to @arc_mem_sz
+ * and we finally add memory one here
*/
memblock_add(CONFIG_LINUX_LINK_BASE, arc_mem_sz);