mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ARC: Force disable IOC if ioc_enable=0
@ 2017-12-05 10:19 Alexey Brodkin
  2017-12-12 17:49 ` Vineet Gupta
  0 siblings, 1 reply; 2+ messages in thread
From: Alexey Brodkin @ 2017-12-05 10:19 UTC (permalink / raw)
  To: linux-snps-arc; +Cc: linux-kernel, Vineet Gupta, Alexey Brodkin

U-Boot enables and uses IOC so if we don't want to use it in the kernel
we need to _disable_ it for real. This is in comparison to what we do
today based on "ioc_enable" flag - if it is set to 0 we just
_dont_enable_ IOC which effectively keeps IOC alive and kicking.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
---
 arch/arc/mm/cache.c | 47 +++++++++++++++++++++++++++--------------------
 1 file changed, 27 insertions(+), 20 deletions(-)

diff --git a/arch/arc/mm/cache.c b/arch/arc/mm/cache.c
index eee924dfffa6..b763c34aa6bc 100644
--- a/arch/arc/mm/cache.c
+++ b/arch/arc/mm/cache.c
@@ -1149,6 +1149,10 @@ noinline void __init arc_ioc_setup(void)
 {
 	unsigned int ioc_base, mem_sz;
 
+	/* Force disable IOC if it exists but we don't want to use it */
+	if (ioc_exists && !ioc_enable)
+		write_aux_reg(ARC_REG_IO_COH_ENABLE, 0);
+
 	/* Flush + invalidate + disable L1 dcache */
 	__dc_disable();
 
@@ -1156,31 +1160,34 @@ noinline void __init arc_ioc_setup(void)
 	if (read_aux_reg(ARC_REG_SLC_BCR))
 		slc_entire_op(OP_FLUSH_N_INV);
 
-	/*
-	 * currently IOC Aperture covers entire DDR
-	 * TBD: fix for PGU + 1GB of low mem
-	 * TBD: fix for PAE
-	 */
-	mem_sz = arc_get_mem_sz();
+	/* Only setup IOC if we really want to use it */
+	if (ioc_exists && ioc_enable) {
+		/*
+		 * currently IOC Aperture covers entire DDR
+		 * TBD: fix for PGU + 1GB of low mem
+		 * TBD: fix for PAE
+		 */
+		mem_sz = arc_get_mem_sz();
 
-	if (!is_power_of_2(mem_sz) || mem_sz < 4096)
-		panic("IOC Aperture size must be power of 2 larger than 4KB");
+		if (!is_power_of_2(mem_sz) || mem_sz < 4096)
+			panic("IOC Aperture size must be power of 2 larger than 4KB");
 
-	/*
-	 * IOC Aperture size decoded as 2 ^ (SIZE + 2) KB,
-	 * so setting 0x11 implies 512MB, 0x12 implies 1GB...
-	 */
-	write_aux_reg(ARC_REG_IO_COH_AP0_SIZE, order_base_2(mem_sz >> 10) - 2);
+		/*
+		 * IOC Aperture size decoded as 2 ^ (SIZE + 2) KB,
+		 * so setting 0x11 implies 512MB, 0x12 implies 1GB...
+		 */
+		write_aux_reg(ARC_REG_IO_COH_AP0_SIZE, order_base_2(mem_sz >> 10) - 2);
 
-	/* for now assume kernel base is start of IOC aperture */
-	ioc_base = CONFIG_LINUX_RAM_BASE;
+		/* for now assume kernel base is start of IOC aperture */
+		ioc_base = CONFIG_LINUX_RAM_BASE;
 
-	if (ioc_base % mem_sz != 0)
-		panic("IOC Aperture start must be aligned to the size of the aperture");
+		if (ioc_base % mem_sz != 0)
+			panic("IOC Aperture start must be aligned to the size of the aperture");
 
-	write_aux_reg(ARC_REG_IO_COH_AP0_BASE, ioc_base >> 12);
-	write_aux_reg(ARC_REG_IO_COH_PARTIAL, 1);
-	write_aux_reg(ARC_REG_IO_COH_ENABLE, 1);
+		write_aux_reg(ARC_REG_IO_COH_AP0_BASE, ioc_base >> 12);
+		write_aux_reg(ARC_REG_IO_COH_PARTIAL, 1);
+		write_aux_reg(ARC_REG_IO_COH_ENABLE, 1);
+	}
 
 	/* Re-enable L1 dcache */
 	__dc_enable();
-- 
2.7.5

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-12-12 17:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-05 10:19 [PATCH] ARC: Force disable IOC if ioc_enable=0 Alexey Brodkin
2017-12-12 17:49 ` Vineet Gupta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®