nios2: Pseudo implement dcache_status/enable/disable()
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
@@ -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
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
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
@@ -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
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.cdepends on these symbols.
Quoted 7 lines
Signed-off-by Joachim Foerster<[email protected]>---
Changes for v2:
- Remove return; from added void functionsarch/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
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
@@ -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
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.cdepends on these symbols.Signed-off-by Joachim Foerster<[email protected]>
Quoted 9 lines
---
Changes for v3:
- #include proper header file forflush_dcache()
Changes for v2:
- Remove return; from added void functionsarch/nios2/cpu/cpu.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-)
Thomas Chou
AppliedPATCH v3 1/1 nios2: Pseudo implement dcache_status/enable/disable()
In reply to Joachim FoersterQuoted 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.cdepends on these symbols.Signed-off-by Joachim Foerster<[email protected]>
Quoted 9 lines
---
Changes for v3:
- #include proper header file forflush_dcache()
Changes for v2:
- Remove return; from added void functionsarch/nios2/cpu/cpu.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-)
Hi Joachim,
Applied. Thanks.
Best regards,
Thomas