aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arc
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arc')
-rw-r--r--arch/arc/Kconfig12
-rw-r--r--arch/arc/boot/dts/skeleton.dtsi6
-rw-r--r--arch/arc/include/asm/clk.h2
-rw-r--r--arch/arc/kernel/clk.c12
-rw-r--r--arch/arc/kernel/devtree.c13
-rw-r--r--arch/arc/mm/init.c9
6 files changed, 37 insertions, 17 deletions
diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index 76668579b543..7db978570fb8 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -249,10 +249,6 @@ source "arch/arc/plat-arcfpga/Kconfig"
249 249
250#New platform adds here 250#New platform adds here
251 251
252config ARC_PLAT_CLK
253 int "Clk speed in Hz"
254 default "80000000"
255
256config LINUX_LINK_BASE 252config LINUX_LINK_BASE
257 hex "Linux Link Address" 253 hex "Linux Link Address"
258 default "0x80000000" 254 default "0x80000000"
@@ -266,14 +262,6 @@ config LINUX_LINK_BASE
266 Linux needs to be scooted a bit. 262 Linux needs to be scooted a bit.
267 If you don't know what the above means, leave this setting alone. 263 If you don't know what the above means, leave this setting alone.
268 264
269config ARC_PLAT_SDRAM_SIZE
270 hex "SD RAM Size"
271 default "0x10000000"
272 help
273 Implies the amount of SDRAM/DRAM Linux is going to claim/own.
274 The actual memory itself could be larger than this number. But for
275 all software purposes, this is the amt of memory.
276
277endmenu # "Platform Board Configuration" 265endmenu # "Platform Board Configuration"
278 266
279config ARC_STACK_NONEXEC 267config ARC_STACK_NONEXEC
diff --git a/arch/arc/boot/dts/skeleton.dtsi b/arch/arc/boot/dts/skeleton.dtsi
index 9b357d802a10..eb8b77367352 100644
--- a/arch/arc/boot/dts/skeleton.dtsi
+++ b/arch/arc/boot/dts/skeleton.dtsi
@@ -13,9 +13,13 @@
13 13
14/ { 14/ {
15 compatible = "snps,arc"; 15 compatible = "snps,arc";
16 clock-frequency = <80000000>; /* 80 MHZ */
16 #address-cells = <1>; 17 #address-cells = <1>;
17 #size-cells = <1>; 18 #size-cells = <1>;
18 chosen { }; 19 chosen { };
19 aliases { }; 20 aliases { };
20 memory { device_type = "memory"; reg = <0 0>; }; 21 memory {
22 device_type = "memory";
23 reg = <0x00000000 0x10000000>; /* 256M */
24 };
21}; 25};
diff --git a/arch/arc/include/asm/clk.h b/arch/arc/include/asm/clk.h
index 61956436c75c..bf9d29f5bd53 100644
--- a/arch/arc/include/asm/clk.h
+++ b/arch/arc/include/asm/clk.h
@@ -17,4 +17,6 @@ static inline unsigned long arc_get_core_freq(void)
17 return core_freq; 17 return core_freq;
18} 18}
19 19
20extern int arc_set_core_freq(unsigned long);
21
20#endif 22#endif
diff --git a/arch/arc/kernel/clk.c b/arch/arc/kernel/clk.c
index 64925db9eb5e..66ce0dc917fb 100644
--- a/arch/arc/kernel/clk.c
+++ b/arch/arc/kernel/clk.c
@@ -8,4 +8,14 @@
8 8
9#include <asm/clk.h> 9#include <asm/clk.h>
10 10
11unsigned long core_freq = CONFIG_ARC_PLAT_CLK; 11unsigned long core_freq = 800000000;
12
13/*
14 * As of now we default to device-tree provided clock
15 * In future we can determine this in early boot
16 */
17int arc_set_core_freq(unsigned long freq)
18{
19 core_freq = freq;
20 return 0;
21}
diff --git a/arch/arc/kernel/devtree.c b/arch/arc/kernel/devtree.c
index 48e157efad15..c8166dc02c38 100644
--- a/arch/arc/kernel/devtree.c
+++ b/arch/arc/kernel/devtree.c
@@ -15,6 +15,7 @@
15#include <linux/of.h> 15#include <linux/of.h>
16#include <linux/of_fdt.h> 16#include <linux/of_fdt.h>
17#include <asm/prom.h> 17#include <asm/prom.h>
18#include <asm/clk.h>
18 19
19/* called from unflatten_device_tree() to bootstrap devicetree itself */ 20/* called from unflatten_device_tree() to bootstrap devicetree itself */
20void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align) 21void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
@@ -34,7 +35,9 @@ int __init setup_machine_fdt(void *dt)
34 struct boot_param_header *devtree = dt; 35 struct boot_param_header *devtree = dt;
35 unsigned long dt_root; 36 unsigned long dt_root;
36 char *model, *compat; 37 char *model, *compat;
38 void *clk;
37 char manufacturer[16]; 39 char manufacturer[16];
40 unsigned long len;
38 41
39 /* check device tree validity */ 42 /* check device tree validity */
40 if (be32_to_cpu(devtree->magic) != OF_DT_HEADER) 43 if (be32_to_cpu(devtree->magic) != OF_DT_HEADER)
@@ -60,5 +63,15 @@ int __init setup_machine_fdt(void *dt)
60 /* Retrieve various information from the /chosen node */ 63 /* Retrieve various information from the /chosen node */
61 of_scan_flat_dt(early_init_dt_scan_chosen, boot_command_line); 64 of_scan_flat_dt(early_init_dt_scan_chosen, boot_command_line);
62 65
66 /* Initialize {size,address}-cells info */
67 of_scan_flat_dt(early_init_dt_scan_root, NULL);
68
69 /* Setup memory, calling early_init_dt_add_memory_arch */
70 of_scan_flat_dt(early_init_dt_scan_memory, NULL);
71
72 clk = of_get_flat_dt_prop(dt_root, "clock-frequency", &len);
73 if (clk)
74 arc_set_core_freq(of_read_ulong(clk, len/4));
75
63 return 0; 76 return 0;
64} 77}
diff --git a/arch/arc/mm/init.c b/arch/arc/mm/init.c
index 682cf5740483..caf797de23fc 100644
--- a/arch/arc/mm/init.c
+++ b/arch/arc/mm/init.c
@@ -25,7 +25,7 @@ char empty_zero_page[PAGE_SIZE] __aligned(PAGE_SIZE);
25EXPORT_SYMBOL(empty_zero_page); 25EXPORT_SYMBOL(empty_zero_page);
26 26
27/* Default tot mem from .config */ 27/* Default tot mem from .config */
28static unsigned long arc_mem_sz = CONFIG_ARC_PLAT_SDRAM_SIZE; 28static unsigned long arc_mem_sz = 0x20000000; /* some default */
29 29
30/* User can over-ride above with "mem=nnn[KkMm]" in cmdline */ 30/* User can over-ride above with "mem=nnn[KkMm]" in cmdline */
31static int __init setup_mem_sz(char *str) 31static int __init setup_mem_sz(char *str)
@@ -41,7 +41,8 @@ early_param("mem", setup_mem_sz);
41 41
42void __init early_init_dt_add_memory_arch(u64 base, u64 size) 42void __init early_init_dt_add_memory_arch(u64 base, u64 size)
43{ 43{
44 pr_err("%s(%llx, %llx)\n", __func__, base, size); 44 arc_mem_sz = size & PAGE_MASK;
45 pr_info("Memory size set via devicetree %ldM\n", TO_MB(arc_mem_sz));
45} 46}
46 47
47/* 48/*
@@ -62,7 +63,9 @@ void __init setup_arch_memory(void)
62 63
63 /* 64 /*
64 * We do it here, so that memory is correctly instantiated 65 * We do it here, so that memory is correctly instantiated
65 * even if "mem=xxx" cmline over-ride is not given 66 * even if "mem=xxx" cmline over-ride is given and/or
67 * DT has memory node. Each causes an update to @arc_mem_sz
68 * and we finally add memory one here
66 */ 69 */
67 memblock_add(CONFIG_LINUX_LINK_BASE, arc_mem_sz); 70 memblock_add(CONFIG_LINUX_LINK_BASE, arc_mem_sz);
68 71