From 909878fd3fda056d19b8b51a5cc51cb1c0b563d1 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Thu, 9 Jul 2009 01:15:05 -0400 Subject: [PATCH 1/4] Blackfin: add os log functions Part of the mini Blackfin ABI with operating systems is that they can use 0x4f0-0x4f8 to pass log buffers to/from bootloaders. So add support to U-Boot for reading the log buffer. Signed-off-by: Mike Frysinger --- cpu/blackfin/Makefile | 2 +- cpu/blackfin/os_log.c | 30 +++++++++++++++++++++++++++ include/asm-blackfin/blackfin_local.h | 3 +++ lib_blackfin/board.c | 6 ++++++ 4 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 cpu/blackfin/os_log.c diff --git a/cpu/blackfin/Makefile b/cpu/blackfin/Makefile index 1378fd12b..f6841067f 100644 --- a/cpu/blackfin/Makefile +++ b/cpu/blackfin/Makefile @@ -17,7 +17,7 @@ EXTRA := CEXTRA := initcode.o SEXTRA := start.o SOBJS := interrupt.o cache.o -COBJS-y := cpu.o traps.o interrupts.o reset.o serial.o watchdog.o +COBJS-y := cpu.o traps.o interrupts.o os_log.o reset.o serial.o watchdog.o COBJS-$(CONFIG_JTAG_CONSOLE) += jtag-console.o ifeq ($(CONFIG_BFIN_BOOT_MODE),BFIN_BOOT_BYPASS) diff --git a/cpu/blackfin/os_log.c b/cpu/blackfin/os_log.c new file mode 100644 index 000000000..e1c8e2948 --- /dev/null +++ b/cpu/blackfin/os_log.c @@ -0,0 +1,30 @@ +/* + * functions for handling OS log buffer + * + * Copyright (c) 2009 Analog Devices Inc. + * + * Licensed under the 2-clause BSD. + */ + +#include + +#define OS_LOG_MAGIC 0xDEADBEEF +#define OS_LOG_MAGIC_ADDR ((unsigned long *)0x4f0) +#define OS_LOG_PTR_ADDR ((char **)0x4f4) + +bool bfin_os_log_check(void) +{ + if (*OS_LOG_MAGIC_ADDR != OS_LOG_MAGIC) + return false; + *OS_LOG_MAGIC_ADDR = 0; + return true; +} + +void bfin_os_log_dump(void) +{ + char *log = *OS_LOG_PTR_ADDR; + while (*log) { + puts(log); + log += strlen(log) + 1; + } +} diff --git a/include/asm-blackfin/blackfin_local.h b/include/asm-blackfin/blackfin_local.h index e17d8a200..8ec792894 100644 --- a/include/asm-blackfin/blackfin_local.h +++ b/include/asm-blackfin/blackfin_local.h @@ -61,6 +61,9 @@ extern u_long get_sclk(void); # define bfin_revid() (*pCHIPID >> 28) +extern bool bfin_os_log_check(void); +extern void bfin_os_log_dump(void); + extern void blackfin_icache_flush_range(const void *, const void *); extern void blackfin_dcache_flush_range(const void *, const void *); extern void blackfin_icache_dcache_flush_range(const void *, const void *); diff --git a/lib_blackfin/board.c b/lib_blackfin/board.c index 28de372b7..b957a9d8b 100644 --- a/lib_blackfin/board.c +++ b/lib_blackfin/board.c @@ -384,6 +384,12 @@ void board_init_r(gd_t * id, ulong dest_addr) post_run(NULL, POST_RAM | post_bootmode_get(0)); #endif + if (bfin_os_log_check()) { + puts("\nLog buffer from operating system:\n"); + bfin_os_log_dump(); + puts("\n"); + } + /* main_loop() can return to retry autoboot, if so just run it again. */ for (;;) main_loop(); From 490fe7349102012c48730f6fc14ef36c8d155068 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Thu, 9 Jul 2009 20:56:56 -0400 Subject: [PATCH 2/4] Blackfin: split cpu COBJS into multilines Signed-off-by: Mike Frysinger --- cpu/blackfin/Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cpu/blackfin/Makefile b/cpu/blackfin/Makefile index f6841067f..5eef6a306 100644 --- a/cpu/blackfin/Makefile +++ b/cpu/blackfin/Makefile @@ -17,8 +17,14 @@ EXTRA := CEXTRA := initcode.o SEXTRA := start.o SOBJS := interrupt.o cache.o -COBJS-y := cpu.o traps.o interrupts.o os_log.o reset.o serial.o watchdog.o +COBJS-y += cpu.o +COBJS-y += interrupts.o COBJS-$(CONFIG_JTAG_CONSOLE) += jtag-console.o +COBJS-y += os_log.o +COBJS-y += reset.o +COBJS-y += serial.o +COBJS-y += traps.o +COBJS-y += watchdog.o ifeq ($(CONFIG_BFIN_BOOT_MODE),BFIN_BOOT_BYPASS) COBJS-y += initcode.o From baf357050353aee30c04f3f4b868426cb54468ca Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Fri, 10 Jul 2009 10:42:06 -0400 Subject: [PATCH 3/4] Blackfin: bf533-stamp: back down SCLK a bit While the 1.0 and 1.2 spin of the bf533-stamp boards can handle the higher SCLK speeds just fine, the 1.1 spin cannot due to the bugs introduced with the shortened SDRAM traces. So lower the SCLK speed down to a value that all three can handle. Signed-off-by: Mike Frysinger --- include/configs/bf533-stamp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/configs/bf533-stamp.h b/include/configs/bf533-stamp.h index c03561cef..4be2a5cfb 100644 --- a/include/configs/bf533-stamp.h +++ b/include/configs/bf533-stamp.h @@ -36,7 +36,7 @@ #define CONFIG_CCLK_DIV 1 /* SCLK_DIV controls the system clock divider */ /* Values can range from 1-15 */ -#define CONFIG_SCLK_DIV 5 +#define CONFIG_SCLK_DIV 6 /* note: 1.2 boards can go faster */ /* From 8d1fea2c4041e665c96944e3f6fcffbde55db34b Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Thu, 16 Jul 2009 19:05:30 -0400 Subject: [PATCH 4/4] Blackfin: bf537-{minotaur,srv1}: do not hardcode CONFIG_ETHADDR MAC addresses should not be hardcoded in boards to avoid random link level conflicts. Signed-off-by: Mike Frysinger --- include/configs/bf537-minotaur.h | 5 ++--- include/configs/bf537-srv1.h | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/include/configs/bf537-minotaur.h b/include/configs/bf537-minotaur.h index 23c2d33bc..463b7d08c 100644 --- a/include/configs/bf537-minotaur.h +++ b/include/configs/bf537-minotaur.h @@ -87,9 +87,8 @@ #define CONFIG_SYS_AUTOLOAD "no" #define CONFIG_ROOTPATH /romfs -/* Use a fixed MAC address for booting up. Firstboot linux - * must fetch a valid MAC from the production server. */ -#define CONFIG_ETHADDR 02:80:ad:20:31:42 +/* Uncomment next line to use fixed MAC address */ +/* #define CONFIG_ETHADDR 02:80:ad:20:31:42 */ /* diff --git a/include/configs/bf537-srv1.h b/include/configs/bf537-srv1.h index 727b7e70e..736862998 100644 --- a/include/configs/bf537-srv1.h +++ b/include/configs/bf537-srv1.h @@ -87,9 +87,8 @@ #define CONFIG_SYS_AUTOLOAD "no" #define CONFIG_ROOTPATH /romfs -/* Use a fixed MAC address for booting up. Firstboot linux - * must fetch a valid MAC from the production server. */ -#define CONFIG_ETHADDR 02:80:ad:20:31:42 +/* Uncomment next line to use fixed MAC address */ +/* #define CONFIG_ETHADDR 02:80:ad:20:31:42 */ /*