summaryrefslogtreecommitdiff
path: root/lib_blackfin
diff options
context:
space:
mode:
Diffstat (limited to 'lib_blackfin')
-rw-r--r--lib_blackfin/board.c49
-rw-r--r--lib_blackfin/bootm.c5
-rw-r--r--lib_blackfin/cache.c35
-rw-r--r--lib_blackfin/post.c4
-rw-r--r--lib_blackfin/tests.c76
5 files changed, 102 insertions, 67 deletions
diff --git a/lib_blackfin/board.c b/lib_blackfin/board.c
index 43d8be8..fde4bbe 100644
--- a/lib_blackfin/board.c
+++ b/lib_blackfin/board.c
@@ -16,6 +16,7 @@
#include <i2c.h>
#include <malloc.h>
#include <net.h>
+#include <timestamp.h>
#include <version.h>
#include <asm/cplb.h>
@@ -32,7 +33,7 @@ int post_flag;
DECLARE_GLOBAL_DATA_PTR;
-const char version_string[] = U_BOOT_VERSION " (" __DATE__ " - " __TIME__ ")";
+const char version_string[] = U_BOOT_VERSION " ("U_BOOT_DATE" - "U_BOOT_TIME")";
__attribute__((always_inline))
static inline void serial_early_puts(const char *s)
@@ -91,8 +92,8 @@ static void *mem_malloc_start, *mem_malloc_end, *mem_malloc_brk;
static void mem_malloc_init(void)
{
- mem_malloc_start = (void *)CFG_MALLOC_BASE;
- mem_malloc_end = (void *)(CFG_MALLOC_BASE + CFG_MALLOC_LEN);
+ mem_malloc_start = (void *)CONFIG_SYS_MALLOC_BASE;
+ mem_malloc_end = (void *)(CONFIG_SYS_MALLOC_BASE + CONFIG_SYS_MALLOC_LEN);
mem_malloc_brk = mem_malloc_start;
memset(mem_malloc_start, 0, mem_malloc_end - mem_malloc_start);
}
@@ -192,16 +193,16 @@ void init_cplbtables(void)
dcplb_add(0xFF800000, L1_DMEMORY);
++i;
- icplb_add(CFG_MONITOR_BASE & CPLB_PAGE_MASK, SDRAM_IKERNEL);
- dcplb_add(CFG_MONITOR_BASE & CPLB_PAGE_MASK, SDRAM_DKERNEL);
+ icplb_add(CONFIG_SYS_MONITOR_BASE & CPLB_PAGE_MASK, SDRAM_IKERNEL);
+ dcplb_add(CONFIG_SYS_MONITOR_BASE & CPLB_PAGE_MASK, SDRAM_DKERNEL);
++i;
/* If the monitor crosses a 4 meg boundary, we'll need
* to lock two entries for it.
*/
- if ((CFG_MONITOR_BASE & CPLB_PAGE_MASK) != ((CFG_MONITOR_BASE + CFG_MONITOR_LEN) & CPLB_PAGE_MASK)) {
- icplb_add((CFG_MONITOR_BASE + CFG_MONITOR_LEN) & CPLB_PAGE_MASK, SDRAM_IKERNEL);
- dcplb_add((CFG_MONITOR_BASE + CFG_MONITOR_LEN) & CPLB_PAGE_MASK, SDRAM_DKERNEL);
+ if ((CONFIG_SYS_MONITOR_BASE & CPLB_PAGE_MASK) != ((CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN) & CPLB_PAGE_MASK)) {
+ icplb_add((CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN) & CPLB_PAGE_MASK, SDRAM_IKERNEL);
+ dcplb_add((CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN) & CPLB_PAGE_MASK, SDRAM_DKERNEL);
++i;
}
@@ -222,7 +223,7 @@ void init_cplbtables(void)
++i;
#endif
- while (i < 16 && extern_memory < (CFG_MONITOR_BASE & CPLB_PAGE_MASK)) {
+ while (i < 16 && extern_memory < (CONFIG_SYS_MONITOR_BASE & CPLB_PAGE_MASK)) {
icplb_add(extern_memory, SDRAM_IGENERIC);
dcplb_add(extern_memory, SDRAM_DGENERIC);
extern_memory += CPLB_PAGE_SIZE;
@@ -250,7 +251,6 @@ void init_cplbtables(void)
extern int exception_init(void);
extern int irq_init(void);
-extern int rtc_init(void);
extern int timer_init(void);
void board_init_f(ulong bootflag)
@@ -279,11 +279,11 @@ void board_init_f(ulong bootflag)
#endif
serial_early_puts("Init global data\n");
- gd = (gd_t *) (CFG_GBL_DATA_ADDR);
+ gd = (gd_t *) (CONFIG_SYS_GBL_DATA_ADDR);
memset((void *)gd, 0, sizeof(gd_t));
/* Board data initialization */
- addr = (CFG_GBL_DATA_ADDR + sizeof(gd_t));
+ addr = (CONFIG_SYS_GBL_DATA_ADDR + sizeof(gd_t));
/* Align to 4 byte boundary */
addr &= ~(4 - 1);
@@ -313,9 +313,6 @@ void board_init_f(ulong bootflag)
display_banner();
checkboard();
-#if defined(CONFIG_RTC_BFIN) && defined(CONFIG_CMD_DATE)
- rtc_init();
-#endif
timer_init();
printf("Clock: VCO: %lu MHz, Core: %lu MHz, System: %lu MHz\n",
@@ -336,7 +333,7 @@ void board_init_f(ulong bootflag)
static int init_func_i2c(void)
{
puts("I2C: ");
- i2c_init(CFG_I2C_SPEED, CFG_I2C_SLAVE);
+ i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
puts("ready\n");
return (0);
}
@@ -356,16 +353,16 @@ void board_init_r(gd_t * id, ulong dest_addr)
post_reloc();
#endif
-#if !defined(CFG_NO_FLASH)
+#if !defined(CONFIG_SYS_NO_FLASH)
/* There are some other pointer constants we must deal with */
/* configure available FLASH banks */
extern flash_info_t flash_info[];
ulong size = flash_init();
puts("Flash: ");
print_size(size, "\n");
- flash_protect(FLAG_PROTECT_SET, CFG_FLASH_BASE,
- CFG_FLASH_BASE + 0x1ffff, &flash_info[0]);
- bd->bi_flashstart = CFG_FLASH_BASE;
+ flash_protect(FLAG_PROTECT_SET, CONFIG_SYS_FLASH_BASE,
+ CONFIG_SYS_FLASH_BASE + 0x1ffff, &flash_info[0]);
+ bd->bi_flashstart = CONFIG_SYS_FLASH_BASE;
bd->bi_flashsize = size;
bd->bi_flashoffset = 0;
#else
@@ -378,12 +375,17 @@ void board_init_r(gd_t * id, ulong dest_addr)
malloc_bin_reloc();
#ifdef CONFIG_SPI
-# if ! defined(CFG_ENV_IS_IN_EEPROM)
+# if ! defined(CONFIG_ENV_IS_IN_EEPROM)
spi_init_f();
# endif
spi_init_r();
#endif
+#ifdef CONFIG_CMD_NAND
+ puts("NAND: ");
+ nand_init(); /* go init the NAND */
+#endif
+
/* relocate environment function pointers etc. */
env_relocate();
@@ -431,11 +433,6 @@ void board_init_r(gd_t * id, ulong dest_addr)
copy_filename(BootFile, s, sizeof(BootFile));
#endif
-#ifdef CONFIG_CMD_NAND
- puts("NAND: ");
- nand_init(); /* go init the NAND */
-#endif
-
#if defined(CONFIG_MISC_INIT_R)
/* miscellaneous platform dependent initialisations */
misc_init_r();
diff --git a/lib_blackfin/bootm.c b/lib_blackfin/bootm.c
index d0afb21..195eb9c 100644
--- a/lib_blackfin/bootm.c
+++ b/lib_blackfin/bootm.c
@@ -36,6 +36,9 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
int (*appl) (char *cmdline);
char *cmdline;
+ if ((flag != 0) && (flag != BOOTM_STATE_OS_GO))
+ return 1;
+
#ifdef SHARED_RESOURCES
swap_to(FLASH);
#endif
@@ -48,6 +51,6 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
dcache_disable();
(*appl) (cmdline);
/* does not return */
-error:
+
return 1;
}
diff --git a/lib_blackfin/cache.c b/lib_blackfin/cache.c
index c2f6e28..870c5bf 100644
--- a/lib_blackfin/cache.c
+++ b/lib_blackfin/cache.c
@@ -11,6 +11,7 @@
#include <common.h>
#include <asm/blackfin.h>
+#include <asm/mach-common/bits/mpu.h>
void flush_cache(unsigned long addr, unsigned long size)
{
@@ -24,3 +25,37 @@ void flush_cache(unsigned long addr, unsigned long size)
if (dcache_status())
blackfin_dcache_flush_range((void *)addr, (void *)(addr + size));
}
+
+void icache_enable(void)
+{
+ bfin_write_IMEM_CONTROL(IMC | ENICPLB);
+ SSYNC();
+}
+
+void icache_disable(void)
+{
+ bfin_write_IMEM_CONTROL(0);
+ SSYNC();
+}
+
+int icache_status(void)
+{
+ return bfin_read_IMEM_CONTROL() & IMC;
+}
+
+void dcache_enable(void)
+{
+ bfin_write_DMEM_CONTROL(ACACHE_BCACHE | ENDCPLB | PORT_PREF0);
+ SSYNC();
+}
+
+void dcache_disable(void)
+{
+ bfin_write_DMEM_CONTROL(0);
+ SSYNC();
+}
+
+int dcache_status(void)
+{
+ return bfin_read_DMEM_CONTROL() & ACACHE_BCACHE;
+}
diff --git a/lib_blackfin/post.c b/lib_blackfin/post.c
index 3c4d5c5..4ab9e8b 100644
--- a/lib_blackfin/post.c
+++ b/lib_blackfin/post.c
@@ -345,7 +345,7 @@ int post_log(char *format, ...)
{
va_list args;
uint i;
- char printbuffer[CFG_PBSIZE];
+ char printbuffer[CONFIG_SYS_PBSIZE];
va_start(args, format);
@@ -419,7 +419,7 @@ void post_reloc(void)
*/
unsigned long post_time_ms(unsigned long base)
{
- return (unsigned long)get_ticks() / (get_tbclk() / CFG_HZ) - base;
+ return (unsigned long)get_ticks() / (get_tbclk() / CONFIG_SYS_HZ) - base;
}
#endif /* CONFIG_POST */
diff --git a/lib_blackfin/tests.c b/lib_blackfin/tests.c
index 051649d..c2319ec 100644
--- a/lib_blackfin/tests.c
+++ b/lib_blackfin/tests.c
@@ -21,7 +21,7 @@
* MA 02111-1307 USA
*
* Be sure to mark tests to be run before relocation as such with the
- * CFG_POST_PREREL flag so that logging is done correctly if the
+ * CONFIG_SYS_POST_PREREL flag so that logging is done correctly if the
* logbuffer support is enabled.
*/
@@ -30,9 +30,9 @@
#ifdef CONFIG_POST
#include <post.h>
-#define CFG_POST_FLASH 0x00004000
-#define CFG_POST_LED 0x00008000
-#define CFG_POST_BUTTON 0x00010000
+#define CONFIG_SYS_POST_FLASH 0x00004000
+#define CONFIG_SYS_POST_LED 0x00008000
+#define CONFIG_SYS_POST_BUTTON 0x00010000
extern int cache_post_test(int flags);
extern int watchdog_post_test(int flags);
@@ -58,7 +58,7 @@ extern int led_post_test(int flags);
extern int button_post_test(int flags);
struct post_test post_list[] = {
-#if CONFIG_POST & CFG_POST_CACHE
+#if CONFIG_POST & CONFIG_SYS_POST_CACHE
{
"Cache test",
"cache",
@@ -67,9 +67,9 @@ struct post_test post_list[] = {
&cache_post_test,
NULL,
NULL,
- CFG_POST_CACHE},
+ CONFIG_SYS_POST_CACHE},
#endif
-#if CONFIG_POST & CFG_POST_WATCHDOG
+#if CONFIG_POST & CONFIG_SYS_POST_WATCHDOG
{
"Watchdog timer test",
"watchdog",
@@ -78,9 +78,9 @@ struct post_test post_list[] = {
&watchdog_post_test,
NULL,
NULL,
- CFG_POST_WATCHDOG},
+ CONFIG_SYS_POST_WATCHDOG},
#endif
-#if CONFIG_POST & CFG_POST_I2C
+#if CONFIG_POST & CONFIG_SYS_POST_I2C
{
"I2C test",
"i2c",
@@ -89,9 +89,9 @@ struct post_test post_list[] = {
&i2c_post_test,
NULL,
NULL,
- CFG_POST_I2C},
+ CONFIG_SYS_POST_I2C},
#endif
-#if CONFIG_POST & CFG_POST_RTC
+#if CONFIG_POST & CONFIG_SYS_POST_RTC
{
"RTC test",
"rtc",
@@ -100,9 +100,9 @@ struct post_test post_list[] = {
&rtc_post_test,
NULL,
NULL,
- CFG_POST_RTC},
+ CONFIG_SYS_POST_RTC},
#endif
-#if CONFIG_POST & CFG_POST_MEMORY
+#if CONFIG_POST & CONFIG_SYS_POST_MEMORY
{
"Memory test",
"memory",
@@ -111,9 +111,9 @@ struct post_test post_list[] = {
&memory_post_test,
NULL,
NULL,
- CFG_POST_MEMORY},
+ CONFIG_SYS_POST_MEMORY},
#endif
-#if CONFIG_POST & CFG_POST_CPU
+#if CONFIG_POST & CONFIG_SYS_POST_CPU
{
"CPU test",
"cpu",
@@ -122,9 +122,9 @@ struct post_test post_list[] = {
&cpu_post_test,
NULL,
NULL,
- CFG_POST_CPU},
+ CONFIG_SYS_POST_CPU},
#endif
-#if CONFIG_POST & CFG_POST_UART
+#if CONFIG_POST & CONFIG_SYS_POST_UART
{
"UART test",
"uart",
@@ -133,9 +133,9 @@ struct post_test post_list[] = {
&uart_post_test,
NULL,
NULL,
- CFG_POST_UART},
+ CONFIG_SYS_POST_UART},
#endif
-#if CONFIG_POST & CFG_POST_ETHER
+#if CONFIG_POST & CONFIG_SYS_POST_ETHER
{
"ETHERNET test",
"ethernet",
@@ -144,9 +144,9 @@ struct post_test post_list[] = {
&ether_post_test,
NULL,
NULL,
- CFG_POST_ETHER},
+ CONFIG_SYS_POST_ETHER},
#endif
-#if CONFIG_POST & CFG_POST_SPI
+#if CONFIG_POST & CONFIG_SYS_POST_SPI
{
"SPI test",
"spi",
@@ -155,9 +155,9 @@ struct post_test post_list[] = {
&spi_post_test,
NULL,
NULL,
- CFG_POST_SPI},
+ CONFIG_SYS_POST_SPI},
#endif
-#if CONFIG_POST & CFG_POST_USB
+#if CONFIG_POST & CONFIG_SYS_POST_USB
{
"USB test",
"usb",
@@ -166,9 +166,9 @@ struct post_test post_list[] = {
&usb_post_test,
NULL,
NULL,
- CFG_POST_USB},
+ CONFIG_SYS_POST_USB},
#endif
-#if CONFIG_POST & CFG_POST_SPR
+#if CONFIG_POST & CONFIG_SYS_POST_SPR
{
"SPR test",
"spr",
@@ -177,9 +177,9 @@ struct post_test post_list[] = {
&spr_post_test,
NULL,
NULL,
- CFG_POST_SPR},
+ CONFIG_SYS_POST_SPR},
#endif
-#if CONFIG_POST & CFG_POST_SYSMON
+#if CONFIG_POST & CONFIG_SYS_POST_SYSMON
{
"SYSMON test",
"sysmon",
@@ -188,9 +188,9 @@ struct post_test post_list[] = {
&sysmon_post_test,
&sysmon_init_f,
&sysmon_reloc,
- CFG_POST_SYSMON},
+ CONFIG_SYS_POST_SYSMON},
#endif
-#if CONFIG_POST & CFG_POST_DSP
+#if CONFIG_POST & CONFIG_SYS_POST_DSP
{
"DSP test",
"dsp",
@@ -199,9 +199,9 @@ struct post_test post_list[] = {
&dsp_post_test,
NULL,
NULL,
- CFG_POST_DSP},
+ CONFIG_SYS_POST_DSP},
#endif
-#if CONFIG_POST & CFG_POST_CODEC
+#if CONFIG_POST & CONFIG_SYS_POST_CODEC
{
"CODEC test",
"codec",
@@ -210,9 +210,9 @@ struct post_test post_list[] = {
&codec_post_test,
NULL,
NULL,
- CFG_POST_CODEC},
+ CONFIG_SYS_POST_CODEC},
#endif
-#if CONFIG_POST & CFG_POST_FLASH
+#if CONFIG_POST & CONFIG_SYS_POST_FLASH
{
"FLASH test",
"flash",
@@ -221,9 +221,9 @@ struct post_test post_list[] = {
&flash_post_test,
NULL,
NULL,
- CFG_POST_FLASH},
+ CONFIG_SYS_POST_FLASH},
#endif
-#if CONFIG_POST & CFG_POST_LED
+#if CONFIG_POST & CONFIG_SYS_POST_LED
{
"LED test",
"LED",
@@ -232,9 +232,9 @@ struct post_test post_list[] = {
&led_post_test,
NULL,
NULL,
- CFG_POST_LED},
+ CONFIG_SYS_POST_LED},
#endif
-#if CONFIG_POST & CFG_POST_BUTTON
+#if CONFIG_POST & CONFIG_SYS_POST_BUTTON
{
"Button test",
"button",
@@ -243,7 +243,7 @@ struct post_test post_list[] = {
&button_post_test,
NULL,
NULL,
- CFG_POST_BUTTON},
+ CONFIG_SYS_POST_BUTTON},
#endif
};