m68k: Implement a default flush_dcache_all
Subsystems (4)
PATCH 1/7 m68k: Implement a default flush_dcache_all
Implement a weak default version of flush_dcache_all which is based on the ARM default, which is to flush the entire range via flush_dcache_range(...).
---
Cc: Huan Wang <[email protected]>
Cc: Angelo Dureghello <[email protected]>
--- arch/m68k/lib/cache.c | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/m68k/lib/cache.c +9 -0
@@ -134,6 +134,15 @@ void dcache_invalid(void)#endif } +/* +* Default implementation: +* do a range flush for the entire range +*/ +__weak void flush_dcache_all (void ) +{ +flush_dcache_range (0 , ~0 ); +} +__weak void invalidate_dcache_range (unsigned long start,unsigned long stop) {/* An empty stub, real implementation should be in platform code */
Signature · 1 line
2.34.1
PATCH 2/7 m68k: Rename icache_invalid to invalidate_icache_all
The implementation of icache_invalid appears to be doing what other architectures call invalidate_icache_all so rename to match.
---
Huan Wang <[email protected]>
Angelo Dureghello <[email protected]>
--- arch/m68k/include/asm/cache.h | 1 - arch/m68k/lib/cache.c | 6 +++--- drivers/net/mcffec.c | 5 +++-- 3 files changed, 6 insertions(+), 6 deletions(-)
arch/m68k/include/asm/cache.h +0 -1
@@ -185,7 +185,6 @@#ifndef __ASSEMBLY__/* put C only stuff in this section */ -void icache_invalid (void );void dcache_invalid (void );#endif
arch/m68k/lib/cache.c +3 -3
@@ -29,7 +29,7 @@ int dcache_status(void)void icache_enable (void ) { -icache_invalid (); +invalidate_icache_all (); *cf_icache_status =1 ;
@@ -53,7 +53,7 @@ void icache_disable(void)u32 temp =0 ; *cf_icache_status =0 ; -icache_invalid (); +invalidate_icache_all ();#if defined(CONFIG_CF_V4 ) || defined(CFG_CF_V4E ) __asm__ __volatile__("movec %0, %%acr2" ::"r" (temp));
@@ -68,7 +68,7 @@ void icache_disable(void)#endif } -void icache_invalid (void ) +void invalidate_icache_all (void ) {u32 temp;
drivers/net/mcffec.c +3 -2
@@ -11,6 +11,7 @@*/ #include <config.h> +#include <cpu_func.h> #include <env.h> #include <hang.h> #include <malloc.h>
@@ -399,7 +400,7 @@ static int mcffec_send(struct udevice *dev, void *packet, int length)#endif #ifdef CONFIG_SYS_UNIFY_CACHE -icache_invalid (); +invalidate_icache_all ();#endif j =0 ;
@@ -433,7 +434,7 @@ static int mcffec_recv(struct udevice *dev, int flags, uchar **packetp)for (;;) {#ifdef CONFIG_SYS_UNIFY_CACHE -icache_invalid (); +invalidate_icache_all ();#endif /* If nothing received - leave for() loop */ if (info->rxbd[info->rx_idx].cbd_sc &BD_ENET_RX_EMPTY )
Signature · 1 line
2.34.1
Re: [PATCH 2/7] m68k: Rename icache_invalid to invalidate_icache_all
Quoted 88 lines · Tom Rini
The implementation of
icache_invalidappears to be doing what other architectures callinvalidate_icache_allso rename to match.Signed-off-by Tom Rini <[email protected]>---
Huan Wang <[email protected]>
Angelo Dureghello <[email protected]>--- arch/m68k/include/asm/cache.h | 1 - arch/m68k/lib/cache.c | 6 +++--- drivers/net/mcffec.c | 5 +++-- 3 files changed, 6 insertions(+), 6 deletions(-)arch/m68k/include/asm/cache.h +0
-1@@ -185,7 +185,6 @@#ifndef __ASSEMBLY__/* put C only stuff in this section */ -void icache_invalid (void );void dcache_invalid (void );#endif arch/m68k/lib/cache.c +3
-3@@ -29,7 +29,7 @@ int dcache_status(void)void icache_enable (void ) { -icache_invalid (); +invalidate_icache_all (); *cf_icache_status =1 ;@@ -53,7 +53,7 @@ void icache_disable(void)u32 temp =0 ; *cf_icache_status =0 ; -icache_invalid (); +invalidate_icache_all ();#if defined(CONFIG_CF_V4 ) || defined(CFG_CF_V4E ) __asm__ __volatile__("movec %0, %%acr2" ::"r" (temp));@@ -68,7 +68,7 @@ void icache_disable(void)#endif } -void icache_invalid (void ) +void invalidate_icache_all (void ) {u32 temp;drivers/net/mcffec.c +3
-3@@ -11,6 +11,7 @@*/ #include <config.h> +#include <cpu_func.h> #include <env.h> #include <hang.h> #include <malloc.h> @@ -399,7 +400,7 @@ static int mcffec_send(struct udevice *dev, void *packet, int length)#endif #ifdef CONFIG_SYS_UNIFY_CACHE -icache_invalid (); +invalidate_icache_all ();#endif j =0 ;@@ -433,7 +434,7 @@ static int mcffec_recv(struct udevice *dev, int flags, uchar **packetp)for (;;) {#ifdef CONFIG_SYS_UNIFY_CACHE -icache_invalid (); +invalidate_icache_all ();#endif /* If nothing received - leave for() loop */ if (info->rxbd[info->rx_idx].cbd_sc &BD_ENET_RX_EMPTY ) --
Quoted 2 lines
2.34.1
PATCH 3/7 sh: Implement a default flush_dcache_all
In reply to Tom RiniImplement a weak default version of flush_dcache_all which is based on the ARM default, which is to flush the entire range via flush_dcache_range(...).
---
Cc: Marek Vasut <[email protected]>
Cc: Nobuhiro Iwamatsu <[email protected]>
--- arch/sh/cpu/sh4/cache.c | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/sh/cpu/sh4/cache.c +9 -0
@@ -65,6 +65,15 @@ void flush_dcache_range(unsigned long start, unsigned long end) } } +/* +* Default implementation: +* do a range flush for the entire range +*/ +void flush_dcache_all (void ) +{ +flush_dcache_range (0 , ~0 ); +} +void invalidate_dcache_range (unsigned long start,unsigned long end) {u32 v;
Signature · 1 line
2.34.1
Re: [PATCH 3/7] sh: Implement a default flush_dcache_all
Quoted 34 lines · Tom Rini
Implement a weak default version of
flush_dcache_allwhich is based on the ARM default, which is to flush the entire range viaflush_dcache_range(...).Signed-off-by Tom Rini <[email protected]>---
Cc: Marek Vasut <[email protected]>
Cc: Nobuhiro Iwamatsu <[email protected]>--- arch/sh/cpu/sh4/cache.c | 9 +++++++++ 1 file changed, 9 insertions(+)arch/sh/cpu/sh4/cache.c +9
-1@@ -65,6 +65,15 @@ void flush_dcache_range(unsigned long start, unsigned long end) } } +/* +* Default implementation: +* do a range flush for the entire range +*/ +void flush_dcache_all (void ) +{ +flush_dcache_range (0 , ~0 ); +} +void invalidate_dcache_range (unsigned long start,unsigned long end) {u32 v; --
Quoted 2 lines
2.34.1
Re: [PATCH 3/7] sh: Implement a default flush_dcache_all
In reply to Tom RiniQuoted 18 lines · Tom Rini
Implement a weak default version of
flush_dcache_allwhich is based on the ARM default, which is to flush the entire range viaflush_dcache_range(...).Signed-off-by Tom Rini <[email protected]>---
Cc: Marek Vasut <[email protected]>
Cc: Nobuhiro Iwamatsu <[email protected]>--- arch/sh/cpu/sh4/cache.c | 9 +++++++++ 1 file changed, 9 insertions(+)arch/sh/cpu/sh4/cache.c +0
-0@@ -65,6 +65,15 @@ void flush_dcache_range(unsigned long start, unsigned long end) }
arch/sh/cpu/sh4/cache.c void flush_dcache_range(unsigned long start, unsigned long end) · line 75
Quoted 10 lines
arch/sh/cpu/sh4/cache.c +8
-0} +/* +* Default implementation: +* do a range flush for the entire range +*/ +void flush_dcache_all (void ) +{ +flush_dcache_range (0 , ~0 ); +}
The current implementation that is in tree should be fine, thanks.
PATCH 4/7 sh: Add the old invalidate_icache_all function
In reply to Tom RiniAdd the old invalidate_icache_all function that prints a warning that was previously found in cmd/cache.c
---
Cc: Marek Vasut <[email protected]>
Cc: Nobuhiro Iwamatsu <[email protected]>
--- arch/sh/cpu/sh4/cache.c | 6 ++++++ 1 file changed, 6 insertions(+)
arch/sh/cpu/sh4/cache.c +6 -0
@@ -6,6 +6,7 @@#include <command.h> #include <cpu_func.h> +#include <stdio.h> #include <asm/cache.h> #include <asm/io.h> #include <asm/processor.h>
@@ -100,6 +101,11 @@ void icache_disable(void)cache_control (CACHE_DISABLE ); } +void invalidate_icache_all (void ) +{ +puts ("No arch specific invalidate_icache_all available!\n" ); +} +int icache_status (void ) {return 0 ;
Signature · 1 line
2.34.1
Re: [PATCH 4/7] sh: Add the old invalidate_icache_all function
Quoted 25 lines · Tom Rini
Add the old
invalidate_icache_allfunction that prints a warning that was previously found incmd/cache.cSigned-off-by Tom Rini <[email protected]>---
Cc: Marek Vasut <[email protected]>
Cc: Nobuhiro Iwamatsu <[email protected]>--- arch/sh/cpu/sh4/cache.c | 6 ++++++ 1 file changed, 6 insertions(+)arch/sh/cpu/sh4/cache.c +1
-0@@ -6,6 +6,7 @@#include <command.h> #include <cpu_func.h> +#include <stdio.h> #include <asm/cache.h> #include <asm/io.h> #include <asm/processor.h> @@ -100,6 +101,11 @@ void icache_disable(void)cache_control (CACHE_DISABLE );
arch/sh/cpu/sh4/cache.c void icache_disable(void) · line 111
Quoted 10 lines
arch/sh/cpu/sh4/cache.c +5
-0} +void invalidate_icache_all (void ) +{ +puts ("No arch specific invalidate_icache_all available!\n" ); +} +int icache_status (void ) {return 0 ;
I just posted
sh: cache: Fill in invalidate_icache_all()
PATCH 5/7 powerpc: Implement a default flush_dcache_all
In reply to Tom RiniImplement a weak default version of flush_dcache_all which is based on the ARM default, which is to flush the entire range via flush_dcache_range(...).
--- arch/powerpc/lib/cache.c | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/powerpc/lib/cache.c +9 -0
@@ -43,3 +43,12 @@ void flush_cache(ulong start_addr, ulong size)/* flush prefetch queue */ asmvolatile ("isync" : : :"memory" ); } + +/* +* Default implementation: +* do a range flush for the entire range +*/ +void flush_dcache_all (void ) +{ +flush_dcache_range (0 , ~0 ); +}
Signature · 1 line
2.34.1
Re: [PATCH 5/7] powerpc: Implement a default flush_dcache_all
Quoted 28 lines · Tom Rini
Implement a weak default version of
flush_dcache_allwhich is based on the ARM default, which is to flush the entire range viaflush_dcache_range(...).Signed-off-by Tom Rini <[email protected]>--- arch/powerpc/lib/cache.c | 9 +++++++++ 1 file changed, 9 insertions(+)arch/powerpc/lib/cache.c +9
-1@@ -43,3 +43,12 @@ void flush_cache(ulong start_addr, ulong size)/* flush prefetch queue */ asmvolatile ("isync" : : :"memory" ); } + +/* +* Default implementation: +* do a range flush for the entire range +*/ +void flush_dcache_all (void ) +{ +flush_dcache_range (0 , ~0 ); +} --
Quoted 2 lines
2.34.1
PATCH 6/7 powerpc: Add the old invalidate_icache_all function
In reply to Tom RiniAdd the old invalidate_icache_all function that prints a warning that was previously found in cmd/cache.c
--- arch/powerpc/lib/cache.c | 6 ++++++ 1 file changed, 6 insertions(+)
arch/powerpc/lib/cache.c +6 -0
@@ -5,6 +5,7 @@*/ #include <cpu_func.h> +#include <stdio.h> #include <asm/cache.h> #include <watchdog.h>
@@ -52,3 +53,8 @@ void flush_dcache_all(void) {flush_dcache_range (0 , ~0 ); } + +void invalidate_icache_all (void ) +{ +puts ("No arch specific invalidate_icache_all available!\n" ); +}
Signature · 1 line
2.34.1
PATCH 7/7 cmd: cache: Remove weak functions
In reply to Tom RiniIt should be up to an architecture to decide how to implement cache functions, and if they need to use weak functions or not. Allowing the cache command to be built without cache functionality implemented is unhelpful. Further, guard the call to noncached_set_region with CONFIG_SYS_NONCACHED_MEMORY as that's when it's implemented and again is an architecture specific detail.
---
This patch series is intended to replace
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
--- cmd/cache.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-)
cmd/cache.c +2 -16
@@ -13,16 +13,6 @@static int parse_argv (const char *); -void __weak invalidate_icache_all (void ) -{ -/* please define arch specific invalidate_icache_all */ -puts ("No arch specific invalidate_icache_all available!\n" ); -} - -__weak void noncached_set_region (void ) -{ -} -static int do_icache (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) {
@@ -52,12 +42,6 @@ static int do_icache(struct cmd_tbl *cmdtp, int flag, int argc,return 0 ; } -void __weak flush_dcache_all (void ) -{ -puts ("No arch specific flush_dcache_all available!\n" ); -/* please define arch specific flush_dcache_all */ -} -static int do_dcache (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) {
@@ -69,7 +53,9 @@ static int do_dcache(struct cmd_tbl *cmdtp, int flag, int argc,break ;case 1 :dcache_enable (); +#ifdef CONFIG_SYS_NONCACHED_MEMORY noncached_set_region (); +#endif break ;case 2 :flush_dcache_all ();
Signature · 1 line
2.34.1
Re: [PATCH 7/7] cmd: cache: Remove weak functions
Quoted 61 lines · Tom Rini
It should be up to an architecture to decide how to implement cache functions, and if they need to use weak functions or not. Allowing the cache command to be built without cache functionality implemented is unhelpful. Further, guard the call to
noncached_set_regionwithCONFIG_SYS_NONCACHED_MEMORYas that's when it's implemented and again is an architecture specific detail.Signed-off-by Tom Rini <[email protected]>---
This patch series is intended to replace
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/--- cmd/cache.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-)cmd/cache.c +2
-17@@ -13,16 +13,6 @@static int parse_argv (const char *); -void __weak invalidate_icache_all (void ) -{ -/* please define arch specific invalidate_icache_all */ -puts ("No arch specific invalidate_icache_all available!\n" ); -} - -__weak void noncached_set_region (void ) -{ -} -static int do_icache (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) {@@ -52,12 +42,6 @@ static int do_icache(struct cmd_tbl *cmdtp, int flag, int argc,return 0 ; } -void __weak flush_dcache_all (void ) -{ -puts ("No arch specific flush_dcache_all available!\n" ); -/* please define arch specific flush_dcache_all */ -} -static int do_dcache (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) {@@ -69,7 +53,9 @@ static int do_dcache(struct cmd_tbl *cmdtp, int flag, int argc,break ;case 1 :dcache_enable (); +#ifdef CONFIG_SYS_NONCACHED_MEMORY noncached_set_region (); +#endif break ;case 2 :flush_dcache_all (); --
Quoted 2 lines
2.34.1
Acked
In reply to Tom RiniHi Tom,
thanks,
angelo
Quoted 32 lines · Tom Rini
Implement a weak default version of
flush_dcache_allwhich is based on the ARM default, which is to flush the entire range viaflush_dcache_range(...).Signed-off-by Tom Rini <[email protected]>---
Cc: Huan Wang <[email protected]>
Cc: Angelo Dureghello <[email protected]>--- arch/m68k/lib/cache.c | 9 +++++++++ 1 file changed, 9 insertions(+)arch/m68k/lib/cache.c +9
-0@@ -134,6 +134,15 @@ void dcache_invalid(void)#endif } +/* +* Default implementation: +* do a range flush for the entire range +*/ +__weak void flush_dcache_all (void ) +{ +flush_dcache_range (0 , ~0 ); +} +__weak void invalidate_dcache_range (unsigned long start,unsigned long stop) {/* An empty stub, real implementation should be in platform code */
Quoted 34 lines · Tom Rini
Implement a weak default version of
flush_dcache_allwhich is based on the ARM default, which is to flush the entire range viaflush_dcache_range(...).Signed-off-by Tom Rini <[email protected]>---
Cc: Huan Wang <[email protected]>
Cc: Angelo Dureghello <[email protected]>--- arch/m68k/lib/cache.c | 9 +++++++++ 1 file changed, 9 insertions(+)arch/m68k/lib/cache.c +9
-1@@ -134,6 +134,15 @@ void dcache_invalid(void)#endif } +/* +* Default implementation: +* do a range flush for the entire range +*/ +__weak void flush_dcache_all (void ) +{ +flush_dcache_range (0 , ~0 ); +} +__weak void invalidate_dcache_range (unsigned long start,unsigned long stop) {/* An empty stub, real implementation should be in platform code */ --
Quoted 2 lines
2.34.1
Quoted 5 lines · Tom Rini
Implement a weak default version of
flush_dcache_allwhich is based on the ARM default, which is to flush the entire range viaflush_dcache_range(...).
Applied to u-boot/master, thanks!
Signature · 1 line
Tom