Skip to contentSkip to conversation

nios2: zap cache status enable and disable functions

PATCH New Thomas Chou 2 participants 5 messages Oct 9, 2015 – Oct 13, 2015 NIOS2 architecture

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nios2: zap cache status enable and disable functions

As the icache and dcache of nios2 are always enabled, the cmd_cache is no of use and the cache status, enable and disable functions can be removed.

---
 arch/nios2/cpu/cpu.c | 15 ---------------
 1 file changed, 15 deletions(-)
arch/nios2/cpu/cpu.c +0 -15
index 229a07b..4183244 100644
@@ -29,21 +29,6 @@ int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	return 0;
 }
 
-int dcache_status(void)
-{
-	return 1;
-}
-
-void dcache_enable(void)
-{
-	flush_dcache(CONFIG_SYS_DCACHE_SIZE, CONFIG_SYS_DCACHELINE_SIZE);
-}
-
-void dcache_disable(void)
-{
-	flush_dcache(CONFIG_SYS_DCACHE_SIZE, CONFIG_SYS_DCACHELINE_SIZE);
-}
-
 int arch_cpu_init_dm(void)
 {
 	struct udevice *dev;
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/1 nios2: zap cache status enable and disable functions

Quoted 3 lines · Thomas Chou

As the icache and dcache of nios2 are always enabled, the cmd_cache is no of use and the cache status, enable and disable functions can be removed.

This is no good, I want to be able to enable/disable caches to look for DMA-related issues. That is, if I disable cache, the suspicious driver works and if I enable cache, the driver does not work, I can conclude that it's a DMA/cache-related issue.

Quoted 21 lines
---
 arch/nios2/cpu/cpu.c | 15 ---------------
 1 file changed, 15 deletions(-)
arch/nios2/cpu/cpu.c +0 -8
index 229a07b..4183244 100644
@@ -29,21 +29,6 @@ int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char
 * const argv[]) return 0;
 }
 
-int dcache_status(void)
-{
-	return 1;
-}
-
-void dcache_enable(void)
-{
-	flush_dcache(CONFIG_SYS_DCACHE_SIZE, CONFIG_SYS_DCACHELINE_SIZE);

arch/nios2/cpu/cpu.c int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char · line 34

Quoted 10 lines
arch/nios2/cpu/cpu.c +0 -7
-}
-
-void dcache_disable(void)
-{
-	flush_dcache(CONFIG_SYS_DCACHE_SIZE, CONFIG_SYS_DCACHELINE_SIZE);
-}
-
 int arch_cpu_init_dm(void)
 {
 	struct udevice *dev;

Best regards,
Marek Vasut

#2 lore raw

PATCH 1/1 nios2: zap cache status enable and disable functions

Hi Marek,

Quoted 9 lines · Marek Vasut
Quoted 3 lines · Thomas Chou

As the icache and dcache of nios2 are always enabled, the cmd_cache is no of use and the cache status, enable and disable functions can be removed.

This is no good, I want to be able to enable/disable caches to look for DMA-related issues. That is, if I disable cache, the suspicious driver works and if I enable cache, the driver does not work, I can conclude that it's a DMA/cache-related issue.

I understand. But the hardware always enables the cache if it is configured in nios2 cpu.

We can bypass (partially disable) the cache using ioremap() or dma_alloc_coherent(). If the DMA buffer address is mangled with ioremap(), then it is uncached. You may use this to debug.

Best regards,
Thomas Chou

#3 lore raw

PATCH 1/1 nios2: zap cache status enable and disable functions

Quoted 13 lines · Thomas Chou

Hi Marek,

Quoted 9 lines · Marek Vasut
Quoted 3 lines · Thomas Chou

As the icache and dcache of nios2 are always enabled, the cmd_cache is no of use and the cache status, enable and disable functions can be removed.

This is no good, I want to be able to enable/disable caches to look for DMA-related issues. That is, if I disable cache, the suspicious driver works and if I enable cache, the driver does not work, I can conclude that it's a DMA/cache-related issue.

Quoted 6 lines

I understand. But the hardware always enables the cache if it is configured in nios2 cpu.

We can bypass (partially disable) the cache using ioremap() or dma_alloc_coherent(). If the DMA buffer address is mangled with ioremap(), then it is uncached. You may use this to debug.

OK, now it's clearer to me what you mean, thanks.

Best regards,
Marek Vasut

#4 lore raw

PATCH 1/1 nios2: zap cache status enable and disable functions

In reply to Thomas Chou
Quoted 9 lines · Thomas Chou

As the icache and dcache of nios2 are always enabled, the cmd_cache is no of use and the cache status, enable and disable functions can be removed.

---
  arch/nios2/cpu/cpu.c | 15 ---------------
  1 file changed, 15 deletions(-)

Applied to u-boot-nios.