Skip to contentSkip to conversation

nios2: Pseudo implement dcache_status/enable/disable()

RFC PATCH Superseded Joachim Foerster 3 participants 7 messages Oct 17, 2011 – Oct 28, 2011 NIOS2 architecture

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 nios2: Pseudo implement dcache_status/enable/disable()

AFAIK the NIOS2 architecture does not have any possibility to dynamically switch off the data cache. So _status() always reports 1 and _enable/_disable() just issue a flush of everything.

For example, common/cmd_elf.c depends on these symbols.

---
 arch/nios2/cpu/cpu.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
arch/nios2/cpu/cpu.c +17 -0
index ef360ee..01dd057 100644
@@ -47,3 +47,20 @@ int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	nios2_callr(CONFIG_SYS_RESET_ADDR);
 	return 0;
 }
+
+int dcache_status(void)
+{
+	return 1;
+}
+
+void dcache_enable(void)
+{
+	flush_dcache(CONFIG_SYS_DCACHE_SIZE, CONFIG_SYS_DCACHELINE_SIZE);
+	return;
+}
+
+void dcache_disable(void)
+{
+	flush_dcache(CONFIG_SYS_DCACHE_SIZE, CONFIG_SYS_DCACHELINE_SIZE);
+	return;
+}
Signature · 1 line
1.7.6
#1 lore raw

RFC PATCH 1/1 nios2: Pseudo implement dcache_status/enable/disable()

arch/nios2/cpu/cpu.c int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) · line 66

Quoted 11 lines · On Monday 17 October 2011 11:40:09 Joachim Foerster wrote:
arch/nios2/cpu/cpu.c +11 -0
+void dcache_enable(void)
+{
+	flush_dcache(CONFIG_SYS_DCACHE_SIZE, CONFIG_SYS_DCACHELINE_SIZE);
+	return;
+}
+
+void dcache_disable(void)
+{
+	flush_dcache(CONFIG_SYS_DCACHE_SIZE, CONFIG_SYS_DCACHELINE_SIZE);
+	return;
+}

drop the useless "return;" statements
-mike

#2 lore raw

PATCH v2 1/1 nios2: Pseudo implement dcache_status/enable/disable()

AFAIK the NIOS2 architecture does not have any possibility to dynamically switch off the data cache. So _status() always reports 1 and _enable/_disable() just issue a flush of everything.

For example, common/cmd_elf.c depends on these symbols.

---
Changes for v2:
- Remove return; from added void functions

 arch/nios2/cpu/cpu.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
arch/nios2/cpu/cpu.c +15 -0
index ef360ee..c9ce390 100644
@@ -47,3 +47,18 @@ int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	nios2_callr(CONFIG_SYS_RESET_ADDR);
 	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);
+}
Signature · 1 line
1.7.6
#3 lore raw

PATCH v2 1/1 nios2: Pseudo implement dcache_status/enable/disable()

Quoted 6 lines · Joachim Foerster

AFAIK the NIOS2 architecture does not have any possibility to dynamically switch off the data cache. So _status() always reports 1 and _enable/_disable() just issue a flush of everything.

For example, common/cmd_elf.c depends on these symbols.

Quoted 7 lines

---
Changes for v2:
- Remove return; from added void functions

  arch/nios2/cpu/cpu.c |   15 +++++++++++++++
  1 files changed, 15 insertions(+), 0 deletions(-)

Hi Joachim,

I got this warning. Please fix it with appropriate header. Thanks.

Configuring for nios2-generic board...
cpu.c: In function 'dcache_enable':
cpu.c:58: warning: implicit declaration of function 'flush_dcache'

Best regards,
Thomas

#4 lore raw

PATCH v3 1/1 nios2: Pseudo implement dcache_status/enable/disable()

AFAIK the NIOS2 architecture does not have any possibility to dynamically switch off the data cache. So _status() always reports 1 and _enable/_disable() just issue a flush of everything.

For example, common/cmd_elf.c depends on these symbols.

---
Changes for v3:
- #include proper header file for flush_dcache()
Changes for v2:
- Remove return; from added void functions

 arch/nios2/cpu/cpu.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
arch/nios2/cpu/cpu.c +16 -0
index ef360ee..edf2560 100644
@@ -24,6 +24,7 @@
 #include <common.h>
 #include <nios2.h>
 #include <nios2-io.h>
+#include <asm/cache.h>
 
 #if defined (CONFIG_SYS_NIOS_SYSID_BASE)
 extern void display_sysid (void);
@@ -47,3 +48,18 @@ int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	nios2_callr(CONFIG_SYS_RESET_ADDR);
 	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);
+}
Signature · 1 line
1.7.6
#5 lore raw

PATCH v3 1/1 nios2: Pseudo implement dcache_status/enable/disable()

Quoted 7 lines · Joachim Foerster

AFAIK the NIOS2 architecture does not have any possibility to dynamically switch off the data cache. So _status() always reports 1 and _enable/_disable() just issue a flush of everything.

For example, common/cmd_elf.c depends on these symbols.

Quoted 9 lines

---
Changes for v3:
- #include proper header file for flush_dcache()
Changes for v2:
- Remove return; from added void functions

  arch/nios2/cpu/cpu.c |   16 ++++++++++++++++
  1 files changed, 16 insertions(+), 0 deletions(-)
Applied
#6 lore raw

PATCH v3 1/1 nios2: Pseudo implement dcache_status/enable/disable()

In reply to Joachim Foerster
Quoted 7 lines · Joachim Foerster

AFAIK the NIOS2 architecture does not have any possibility to dynamically switch off the data cache. So _status() always reports 1 and _enable/_disable() just issue a flush of everything.

For example, common/cmd_elf.c depends on these symbols.

Quoted 9 lines

---
Changes for v3:
- #include proper header file for flush_dcache()
Changes for v2:
- Remove return; from added void functions

  arch/nios2/cpu/cpu.c |   16 ++++++++++++++++
  1 files changed, 16 insertions(+), 0 deletions(-)

Hi Joachim,

Applied. Thanks.

Best regards,
Thomas