aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arc
diff options
context:
space:
mode:
authorVineet Gupta <vgupta@synopsys.com>2016-10-13 18:58:59 -0400
committerVineet Gupta <vgupta@synopsys.com>2016-10-24 12:24:47 -0400
commitcf986d470208fbdd68b6934a86ccd81c04408484 (patch)
treed87390ab95834343e6ef9236d847e2f91d5f3720 /arch/arc
parent91e040a79df73d371f70792f30380d4e44805250 (diff)
ARCv2: IOC: use @ioc_enable not @ioc_exist where intended
if user disables IOC from debugger at startup (by clearing @ioc_enable), @ioc_exists is cleared too. This means boot prints don't capture the fact that IOC was present but disabled which could be misleading. So invert how we use @ioc_enable and @ioc_exists and make it more canonical. @ioc_exists represent whether hardware is present or not and stays same whether enabled or not. @ioc_enable is still user driven, but will be auto-disabled if IOC hardware is not present, i.e. if @ioc_exist=0. This is opposite to what we were doing before, but much clearer. This means @ioc_enable is now the "exported" toggle in rest of code such as dma mapping API. Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Diffstat (limited to 'arch/arc')
-rw-r--r--arch/arc/include/asm/cache.h2
-rw-r--r--arch/arc/mm/cache.c10
-rw-r--r--arch/arc/mm/dma.c4
3 files changed, 9 insertions, 7 deletions
diff --git a/arch/arc/include/asm/cache.h b/arch/arc/include/asm/cache.h
index fb781e34f322..b3410ff6a62d 100644
--- a/arch/arc/include/asm/cache.h
+++ b/arch/arc/include/asm/cache.h
@@ -53,7 +53,7 @@ extern void arc_cache_init(void);
53extern char *arc_cache_mumbojumbo(int cpu_id, char *buf, int len); 53extern char *arc_cache_mumbojumbo(int cpu_id, char *buf, int len);
54extern void read_decode_cache_bcr(void); 54extern void read_decode_cache_bcr(void);
55 55
56extern int ioc_exists; 56extern int ioc_enable;
57extern unsigned long perip_base, perip_end; 57extern unsigned long perip_base, perip_end;
58 58
59#endif /* !__ASSEMBLY__ */ 59#endif /* !__ASSEMBLY__ */
diff --git a/arch/arc/mm/cache.c b/arch/arc/mm/cache.c
index 97dddbefb86a..518ff76771f3 100644
--- a/arch/arc/mm/cache.c
+++ b/arch/arc/mm/cache.c
@@ -22,8 +22,8 @@
22#include <asm/setup.h> 22#include <asm/setup.h>
23 23
24static int l2_line_sz; 24static int l2_line_sz;
25int ioc_exists; 25static int ioc_exists;
26volatile int slc_enable = 1, ioc_enable = 1; 26int slc_enable = 1, ioc_enable = 1;
27unsigned long perip_base = ARC_UNCACHED_ADDR_SPACE; /* legacy value for boot */ 27unsigned long perip_base = ARC_UNCACHED_ADDR_SPACE; /* legacy value for boot */
28unsigned long perip_end = 0xFFFFFFFF; /* legacy value */ 28unsigned long perip_end = 0xFFFFFFFF; /* legacy value */
29 29
@@ -113,8 +113,10 @@ static void read_decode_cache_bcr_arcv2(int cpu)
113 } 113 }
114 114
115 READ_BCR(ARC_REG_CLUSTER_BCR, cbcr); 115 READ_BCR(ARC_REG_CLUSTER_BCR, cbcr);
116 if (cbcr.c && ioc_enable) 116 if (cbcr.c)
117 ioc_exists = 1; 117 ioc_exists = 1;
118 else
119 ioc_enable = 0;
118 120
119 /* HS 2.0 didn't have AUX_VOL */ 121 /* HS 2.0 didn't have AUX_VOL */
120 if (cpuinfo_arc700[cpu].core.family > 0x51) { 122 if (cpuinfo_arc700[cpu].core.family > 0x51) {
@@ -1002,7 +1004,7 @@ void arc_cache_init(void)
1002 read_aux_reg(ARC_REG_SLC_CTRL) | SLC_CTRL_DISABLE); 1004 read_aux_reg(ARC_REG_SLC_CTRL) | SLC_CTRL_DISABLE);
1003 } 1005 }
1004 1006
1005 if (is_isa_arcv2() && ioc_exists) { 1007 if (is_isa_arcv2() && ioc_enable) {
1006 /* IO coherency base - 0x8z */ 1008 /* IO coherency base - 0x8z */
1007 write_aux_reg(ARC_REG_IO_COH_AP0_BASE, 0x80000); 1009 write_aux_reg(ARC_REG_IO_COH_AP0_BASE, 0x80000);
1008 /* IO coherency aperture size - 512Mb: 0x8z-0xAz */ 1010 /* IO coherency aperture size - 512Mb: 0x8z-0xAz */
diff --git a/arch/arc/mm/dma.c b/arch/arc/mm/dma.c
index 20afc65e22dc..60aab5a7522b 100644
--- a/arch/arc/mm/dma.c
+++ b/arch/arc/mm/dma.c
@@ -45,7 +45,7 @@ static void *arc_dma_alloc(struct device *dev, size_t size,
45 * -For coherent data, Read/Write to buffers terminate early in cache 45 * -For coherent data, Read/Write to buffers terminate early in cache
46 * (vs. always going to memory - thus are faster) 46 * (vs. always going to memory - thus are faster)
47 */ 47 */
48 if ((is_isa_arcv2() && ioc_exists) || 48 if ((is_isa_arcv2() && ioc_enable) ||
49 (attrs & DMA_ATTR_NON_CONSISTENT)) 49 (attrs & DMA_ATTR_NON_CONSISTENT))
50 need_coh = 0; 50 need_coh = 0;
51 51
@@ -97,7 +97,7 @@ static void arc_dma_free(struct device *dev, size_t size, void *vaddr,
97 int is_non_coh = 1; 97 int is_non_coh = 1;
98 98
99 is_non_coh = (attrs & DMA_ATTR_NON_CONSISTENT) || 99 is_non_coh = (attrs & DMA_ATTR_NON_CONSISTENT) ||
100 (is_isa_arcv2() && ioc_exists); 100 (is_isa_arcv2() && ioc_enable);
101 101
102 if (PageHighMem(page) || !is_non_coh) 102 if (PageHighMem(page) || !is_non_coh)
103 iounmap((void __force __iomem *)vaddr); 103 iounmap((void __force __iomem *)vaddr);