Hello All.
This patch simplifies processor_flash_enable function a bit by simplifying the structure of the processor_enable.c. At least this patch removes more lines than introdces w/o sacrificing the simplicity.
Signed-off-by: Peter Lemenkov lemenkov@gmail.com --- processor_enable.c | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-)
diff --git a/processor_enable.c b/processor_enable.c index d680f97..d7f421d 100644 --- a/processor_enable.c +++ b/processor_enable.c @@ -24,19 +24,6 @@ #include "flash.h" #include "programmer.h"
-#if defined(__i386__) || defined(__x86_64__) - -int processor_flash_enable(void) -{ - /* On x86, flash access is not processor specific except on - * AMD Elan SC520, AMD Geode and maybe other SoC-style CPUs. - * FIXME: Move enable_flash_cs5536 and get_flashbase_sc520 here. - */ - return 0; -} - -#else - #if defined (__MIPSEL__) && defined (__linux) #include <stdio.h> #include <string.h> @@ -83,15 +70,20 @@ static int is_loongson(void)
int processor_flash_enable(void) { + int ret = 1; /* FIXME: detect loongson on FreeBSD and OpenBSD as well. */ #if defined (__MIPSEL__) && defined (__linux) if (is_loongson()) { flashbase = 0x1fc00000; - return 0; + ret = 0; } +#elif defined(__i386__) || defined(__x86_64__) + /* On x86, flash access is not processor specific except on + * AMD Elan SC520, AMD Geode and maybe other SoC-style CPUs. + * FIXME: Move enable_flash_cs5536 and get_flashbase_sc520 here. + */ + ret = 0; #endif /* Not implemented yet. Oh well. */ - return 1; + return ret; } - -#endif