* [U-Boot] [PATCH 1/2] command/cmd_cache.c: Add optional flush arguments
@ 2011-05-23 18:38 Matthew McClintock
2011-05-23 18:38 ` [U-Boot] [PATCH 2/2] powerpc/85xx: provide 85xx flush_icache for cmd_cache Matthew McClintock
2011-05-24 0:25 ` [U-Boot] [PATCH 1/2] command/cmd_cache.c: Add optional flush arguments Mike Frysinger
0 siblings, 2 replies; 8+ messages in thread
From: Matthew McClintock @ 2011-05-23 18:38 UTC (permalink / raw)
To: u-boot
It might be desirable to have the ability to flush icache/dcache
within u-boot, this patch gives each arch the ability to provide
a flush_dcache/flush_icache function to let u-boot flush caches
from the prompt
Signed-off-by: Matthew McClintock <msm@freescale.com>
---
There are some checkpatch.pl warnings for formatting issues. In this case
I choose to keep the same formatting as was used in the file already:
#44: FILE: common/cmd_cache.c:48:
+ case 2: flush_icache();
ERROR: trailing statements should be on next line
#70: FILE: common/cmd_cache.c:78:
+ case 2: flush_dcache();
ERROR: return is not a function, parentheses are not required
#84: FILE: common/cmd_cache.c:96:
+ return (2);
total: 3 errors, 0 warnings, 83 lines checked
common/cmd_cache.c | 38 +++++++++++++++++++++++++++++---------
1 files changed, 29 insertions(+), 9 deletions(-)
diff --git a/common/cmd_cache.c b/common/cmd_cache.c
index 5cdd834..78d53df 100644
--- a/common/cmd_cache.c
+++ b/common/cmd_cache.c
@@ -27,17 +27,26 @@
#include <common.h>
#include <command.h>
-static int on_off (const char *);
+static int parse_argv(const char *);
+
+void __flush_icache(void)
+{
+ /* please define arch specific flush_icache */
+ printf("No arch specific flush_icache available!\n");
+}
+void flush_icache(void) __attribute__((weak, alias("__flush_icache")));
int do_icache ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
switch (argc) {
case 2: /* on / off */
- switch (on_off(argv[1])) {
+ switch (parse_argv(argv[1])) {
case 0: icache_disable();
break;
case 1: icache_enable ();
break;
+ case 2: flush_icache();
+ break;
}
/* FALL TROUGH */
case 1: /* get status */
@@ -50,15 +59,24 @@ int do_icache ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return 0;
}
+void __flush_dcache(void)
+{
+ printf("No arch specific flush_dcache available!\n");
+ /* please define arch specific flush_dcache */
+}
+void flush_dcache(void) __attribute__((weak, alias("__flush_dcache")));
+
int do_dcache ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
switch (argc) {
case 2: /* on / off */
- switch (on_off(argv[1])) {
+ switch (parse_argv(argv[1])) {
case 0: dcache_disable();
break;
case 1: dcache_enable ();
break;
+ case 2: flush_dcache();
+ break;
}
/* FALL TROUGH */
case 1: /* get status */
@@ -72,9 +90,11 @@ int do_dcache ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
}
-static int on_off (const char *s)
+static int parse_argv(const char *s)
{
- if (strcmp(s, "on") == 0) {
+ if (strcmp(s, "flush") == 0) {
+ return (2);
+ } else if (strcmp(s, "on") == 0) {
return (1);
} else if (strcmp(s, "off") == 0) {
return (0);
@@ -86,13 +106,13 @@ static int on_off (const char *s)
U_BOOT_CMD(
icache, 2, 1, do_icache,
"enable or disable instruction cache",
- "[on, off]\n"
- " - enable or disable instruction cache"
+ "[on, off, flush]\n"
+ " - enable, disable, or flush instruction cache"
);
U_BOOT_CMD(
dcache, 2, 1, do_dcache,
"enable or disable data cache",
- "[on, off]\n"
- " - enable or disable data (writethrough) cache"
+ "[on, off, flush]\n"
+ " - enable, disable, or flush data (writethrough) cache"
);
--
1.7.3.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [U-Boot] [PATCH 2/2] powerpc/85xx: provide 85xx flush_icache for cmd_cache
2011-05-23 18:38 [U-Boot] [PATCH 1/2] command/cmd_cache.c: Add optional flush arguments Matthew McClintock
@ 2011-05-23 18:38 ` Matthew McClintock
2011-07-26 13:31 ` Kumar Gala
2011-05-24 0:25 ` [U-Boot] [PATCH 1/2] command/cmd_cache.c: Add optional flush arguments Mike Frysinger
1 sibling, 1 reply; 8+ messages in thread
From: Matthew McClintock @ 2011-05-23 18:38 UTC (permalink / raw)
To: u-boot
This provides a function that will override the weak function
flush_icache to let 85xx boards to flush the icache
cc: Kumar Gala <kumar.gala@freescale.com>
Signed-off-by: Matthew McClintock <msm@freescale.com>
---
arch/powerpc/cpu/mpc85xx/start.S | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/cpu/mpc85xx/start.S b/arch/powerpc/cpu/mpc85xx/start.S
index 05db90a..f717309 100644
--- a/arch/powerpc/cpu/mpc85xx/start.S
+++ b/arch/powerpc/cpu/mpc85xx/start.S
@@ -745,6 +745,8 @@ mck_return:
/* Cache functions.
*/
+.globl flush_icache
+flush_icache:
.globl invalidate_icache
invalidate_icache:
mfspr r0,L1CSR1
--
1.7.3.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [U-Boot] [PATCH 1/2] command/cmd_cache.c: Add optional flush arguments
2011-05-23 18:38 [U-Boot] [PATCH 1/2] command/cmd_cache.c: Add optional flush arguments Matthew McClintock
2011-05-23 18:38 ` [U-Boot] [PATCH 2/2] powerpc/85xx: provide 85xx flush_icache for cmd_cache Matthew McClintock
@ 2011-05-24 0:25 ` Mike Frysinger
2011-05-24 15:06 ` McClintock Matthew-B29882
1 sibling, 1 reply; 8+ messages in thread
From: Mike Frysinger @ 2011-05-24 0:25 UTC (permalink / raw)
To: u-boot
On Monday, May 23, 2011 14:38:52 Matthew McClintock wrote:
> There are some checkpatch.pl warnings for formatting issues. In this case
> I choose to keep the same formatting as was used in the file already:
this is fine i think. otherwise, you'd send another patch to first fix the
formatting and then base this on top of that.
> +void __flush_icache(void)
> +{
> + /* please define arch specific flush_icache */
> + printf("No arch specific flush_icache available!\n");
> +}
> +void flush_icache(void) __attribute__((weak, alias("__flush_icache")));
i dont see much point in having the indirection. just do:
void __weak flush_icache(void)
{
/* please define arch specific flush_icache */
puts("No arch specific flush_icache available!\n");
}
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110523/d1f2de84/attachment.pgp
^ permalink raw reply [flat|nested] 8+ messages in thread
* [U-Boot] [PATCH 1/2] command/cmd_cache.c: Add optional flush arguments
2011-05-24 0:25 ` [U-Boot] [PATCH 1/2] command/cmd_cache.c: Add optional flush arguments Mike Frysinger
@ 2011-05-24 15:06 ` McClintock Matthew-B29882
2011-05-24 18:23 ` Mike Frysinger
0 siblings, 1 reply; 8+ messages in thread
From: McClintock Matthew-B29882 @ 2011-05-24 15:06 UTC (permalink / raw)
To: u-boot
On Mon, May 23, 2011 at 7:25 PM, Mike Frysinger <vapier@gentoo.org> wrote:
> void __weak flush_icache(void)
> {
> ? ? ? ?/* please define arch specific flush_icache */
> ? ? ? ?puts("No arch specific flush_icache available!\n");
> }
This syntax does not quite work for me... how about something like:
void flush_icache(void) __attribute__((weak));
void flush_icache(void)
{
/* please define arch specific flush_icache */
puts("No arch specific flush_icache available!\n");
}
I seem to require separate declaration and definition for this to
work.... however the alias is not required.
-M
^ permalink raw reply [flat|nested] 8+ messages in thread
* [U-Boot] [PATCH 1/2] command/cmd_cache.c: Add optional flush arguments
2011-05-24 15:06 ` McClintock Matthew-B29882
@ 2011-05-24 18:23 ` Mike Frysinger
2011-05-24 20:09 ` [U-Boot] [PATCH v2 " Matthew McClintock
0 siblings, 1 reply; 8+ messages in thread
From: Mike Frysinger @ 2011-05-24 18:23 UTC (permalink / raw)
To: u-boot
On Tuesday, May 24, 2011 11:06:03 McClintock Matthew-B29882 wrote:
> On Mon, May 23, 2011 at 7:25 PM, Mike Frysinger <vapier@gentoo.org> wrote:
> > void __weak flush_icache(void)
> > {
> > /* please define arch specific flush_icache */
> > puts("No arch specific flush_icache available!\n");
> > }
>
> This syntax does not quite work for me... how about something like:
>
> void flush_icache(void) __attribute__((weak));
> void flush_icache(void)
now, that's exactly what i do not want. i'm guessing you simply did not
include linux/compiler.h and so was missing the __weak define.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110524/3c7d2dc4/attachment.pgp
^ permalink raw reply [flat|nested] 8+ messages in thread
* [U-Boot] [PATCH v2 1/2] command/cmd_cache.c: Add optional flush arguments
2011-05-24 18:23 ` Mike Frysinger
@ 2011-05-24 20:09 ` Matthew McClintock
2011-07-26 12:30 ` Wolfgang Denk
0 siblings, 1 reply; 8+ messages in thread
From: Matthew McClintock @ 2011-05-24 20:09 UTC (permalink / raw)
To: u-boot
It might be desirable to have the ability to flush icache/dcache
within u-boot, this patch gives each arch the ability to provide
a flush_dcache/flush_icache function to let u-boot flush caches
from the prompt
Signed-off-by: Matthew McClintock <msm@freescale.com>
---
v2: Use __weak instead of __attribute__((weak,alias))
common/cmd_cache.c | 37 ++++++++++++++++++++++++++++---------
1 files changed, 28 insertions(+), 9 deletions(-)
diff --git a/common/cmd_cache.c b/common/cmd_cache.c
index 5cdd834..9778d3b 100644
--- a/common/cmd_cache.c
+++ b/common/cmd_cache.c
@@ -26,18 +26,27 @@
*/
#include <common.h>
#include <command.h>
+#include <linux/compiler.h>
-static int on_off (const char *);
+static int parse_argv(const char *);
+
+void __weak flush_icache(void)
+{
+ /* please define arch specific flush_icache */
+ puts("No arch specific flush_icache available!\n");
+}
int do_icache ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
switch (argc) {
case 2: /* on / off */
- switch (on_off(argv[1])) {
+ switch (parse_argv(argv[1])) {
case 0: icache_disable();
break;
case 1: icache_enable ();
break;
+ case 2: flush_icache();
+ break;
}
/* FALL TROUGH */
case 1: /* get status */
@@ -50,15 +59,23 @@ int do_icache ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return 0;
}
+void __weak flush_dcache(void)
+{
+ puts("No arch specific flush_dcache available!\n");
+ /* please define arch specific flush_dcache */
+}
+
int do_dcache ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
switch (argc) {
case 2: /* on / off */
- switch (on_off(argv[1])) {
+ switch (parse_argv(argv[1])) {
case 0: dcache_disable();
break;
case 1: dcache_enable ();
break;
+ case 2: flush_dcache();
+ break;
}
/* FALL TROUGH */
case 1: /* get status */
@@ -72,9 +89,11 @@ int do_dcache ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
}
-static int on_off (const char *s)
+static int parse_argv(const char *s)
{
- if (strcmp(s, "on") == 0) {
+ if (strcmp(s, "flush") == 0) {
+ return (2);
+ } else if (strcmp(s, "on") == 0) {
return (1);
} else if (strcmp(s, "off") == 0) {
return (0);
@@ -86,13 +105,13 @@ static int on_off (const char *s)
U_BOOT_CMD(
icache, 2, 1, do_icache,
"enable or disable instruction cache",
- "[on, off]\n"
- " - enable or disable instruction cache"
+ "[on, off, flush]\n"
+ " - enable, disable, or flush instruction cache"
);
U_BOOT_CMD(
dcache, 2, 1, do_dcache,
"enable or disable data cache",
- "[on, off]\n"
- " - enable or disable data (writethrough) cache"
+ "[on, off, flush]\n"
+ " - enable, disable, or flush data (writethrough) cache"
);
--
1.7.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [U-Boot] [PATCH v2 1/2] command/cmd_cache.c: Add optional flush arguments
2011-05-24 20:09 ` [U-Boot] [PATCH v2 " Matthew McClintock
@ 2011-07-26 12:30 ` Wolfgang Denk
0 siblings, 0 replies; 8+ messages in thread
From: Wolfgang Denk @ 2011-07-26 12:30 UTC (permalink / raw)
To: u-boot
Dear Matthew McClintock,
In message <1306267745-14531-1-git-send-email-msm@freescale.com> you wrote:
> It might be desirable to have the ability to flush icache/dcache
> within u-boot, this patch gives each arch the ability to provide
> a flush_dcache/flush_icache function to let u-boot flush caches
> from the prompt
>
> Signed-off-by: Matthew McClintock <msm@freescale.com>
> ---
> v2: Use __weak instead of __attribute__((weak,alias))
>
> common/cmd_cache.c | 37 ++++++++++++++++++++++++++++---------
> 1 files changed, 28 insertions(+), 9 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Q: How do you spell "onomatopoeia"?
A: The way it sounds.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [U-Boot] [PATCH 2/2] powerpc/85xx: provide 85xx flush_icache for cmd_cache
2011-05-23 18:38 ` [U-Boot] [PATCH 2/2] powerpc/85xx: provide 85xx flush_icache for cmd_cache Matthew McClintock
@ 2011-07-26 13:31 ` Kumar Gala
0 siblings, 0 replies; 8+ messages in thread
From: Kumar Gala @ 2011-07-26 13:31 UTC (permalink / raw)
To: u-boot
On May 23, 2011, at 1:38 PM, Matthew McClintock wrote:
> This provides a function that will override the weak function
> flush_icache to let 85xx boards to flush the icache
>
> cc: Kumar Gala <kumar.gala@freescale.com>
> Signed-off-by: Matthew McClintock <msm@freescale.com>
> ---
> arch/powerpc/cpu/mpc85xx/start.S | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
applied to 85xx
- k
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2011-07-26 13:31 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-23 18:38 [U-Boot] [PATCH 1/2] command/cmd_cache.c: Add optional flush arguments Matthew McClintock
2011-05-23 18:38 ` [U-Boot] [PATCH 2/2] powerpc/85xx: provide 85xx flush_icache for cmd_cache Matthew McClintock
2011-07-26 13:31 ` Kumar Gala
2011-05-24 0:25 ` [U-Boot] [PATCH 1/2] command/cmd_cache.c: Add optional flush arguments Mike Frysinger
2011-05-24 15:06 ` McClintock Matthew-B29882
2011-05-24 18:23 ` Mike Frysinger
2011-05-24 20:09 ` [U-Boot] [PATCH v2 " Matthew McClintock
2011-07-26 12:30 ` Wolfgang Denk
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.