aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVineet Gupta <vgupta@synopsys.com>2017-01-18 15:59:21 -0500
committerVineet Gupta <vgupta@synopsys.com>2017-01-18 17:52:43 -0500
commite497c8e52a83ebb5309ab41c8851c9cb53f28b73 (patch)
tree09224d6a1274b9c74ebd8845486af8dd6e39b113
parent8c47f83ba45928ce9495fcf1b29e828c28e3c839 (diff)
ARCv2: IOC: Use actual memory size to setup aperture size
vs. fixed 512M before. But this still assumes that all of memory is under IOC which may not be true for the SoC. Improve that later when this becomes a real issue, by specifying this from DT. Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
-rw-r--r--arch/arc/include/asm/setup.h1
-rw-r--r--arch/arc/mm/cache.c12
-rw-r--r--arch/arc/mm/init.c5
3 files changed, 16 insertions, 2 deletions
diff --git a/arch/arc/include/asm/setup.h b/arch/arc/include/asm/setup.h
index cb954cdab070..c568a9df82b1 100644
--- a/arch/arc/include/asm/setup.h
+++ b/arch/arc/include/asm/setup.h
@@ -31,6 +31,7 @@ extern int root_mountflags, end_mem;
31 31
32void setup_processor(void); 32void setup_processor(void);
33void __init setup_arch_memory(void); 33void __init setup_arch_memory(void);
34long __init arc_get_mem_sz(void);
34 35
35/* Helpers used in arc_*_mumbojumbo routines */ 36/* Helpers used in arc_*_mumbojumbo routines */
36#define IS_AVAIL1(v, s) ((v) ? s : "") 37#define IS_AVAIL1(v, s) ((v) ? s : "")
diff --git a/arch/arc/mm/cache.c b/arch/arc/mm/cache.c
index 1b4cda10844a..3c275a81528c 100644
--- a/arch/arc/mm/cache.c
+++ b/arch/arc/mm/cache.c
@@ -995,6 +995,8 @@ SYSCALL_DEFINE3(cacheflush, uint32_t, start, uint32_t, sz, uint32_t, flags)
995 */ 995 */
996noinline void arc_ioc_setup(void) 996noinline void arc_ioc_setup(void)
997{ 997{
998 unsigned int ap_sz;
999
998 /* Flush + invalidate + disable L1 dcache */ 1000 /* Flush + invalidate + disable L1 dcache */
999 __dc_disable(); 1001 __dc_disable();
1000 1002
@@ -1005,8 +1007,14 @@ noinline void arc_ioc_setup(void)
1005 /* IOC Aperture start: TDB: handle non default CONFIG_LINUX_LINK_BASE */ 1007 /* IOC Aperture start: TDB: handle non default CONFIG_LINUX_LINK_BASE */
1006 write_aux_reg(ARC_REG_IO_COH_AP0_BASE, 0x80000); 1008 write_aux_reg(ARC_REG_IO_COH_AP0_BASE, 0x80000);
1007 1009
1008 /* IOC Aperture size: TBD: handle different mem sizes, PAE... */ 1010 /*
1009 write_aux_reg(ARC_REG_IO_COH_AP0_SIZE, 0x11); 1011 * IOC Aperture size:
1012 * decoded as 2 ^ (SIZE + 2) KB: so setting 0x11 implies 512M
1013 * TBD: fix for PGU + 1GB of low mem
1014 * TBD: fix for PAE
1015 */
1016 ap_sz = order_base_2(arc_get_mem_sz()/1024) - 2;
1017 write_aux_reg(ARC_REG_IO_COH_AP0_SIZE, ap_sz);
1010 1018
1011 write_aux_reg(ARC_REG_IO_COH_PARTIAL, 1); 1019 write_aux_reg(ARC_REG_IO_COH_PARTIAL, 1);
1012 write_aux_reg(ARC_REG_IO_COH_ENABLE, 1); 1020 write_aux_reg(ARC_REG_IO_COH_ENABLE, 1);
diff --git a/arch/arc/mm/init.c b/arch/arc/mm/init.c
index 399e2f223d25..8c9415ed6280 100644
--- a/arch/arc/mm/init.c
+++ b/arch/arc/mm/init.c
@@ -40,6 +40,11 @@ struct pglist_data node_data[MAX_NUMNODES] __read_mostly;
40EXPORT_SYMBOL(node_data); 40EXPORT_SYMBOL(node_data);
41#endif 41#endif
42 42
43long __init arc_get_mem_sz(void)
44{
45 return low_mem_sz;
46}
47
43/* User can over-ride above with "mem=nnn[KkMm]" in cmdline */ 48/* User can over-ride above with "mem=nnn[KkMm]" in cmdline */
44static int __init setup_mem_sz(char *str) 49static int __init setup_mem_sz(char *str)
45{ 50{