All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v4 1/2] blackfin: convert blackfin board_f and board_r to use generic board init functions
@ 2014-08-07  7:08 Sonic Zhang
  2014-08-07  7:08 ` [U-Boot] [PATCH v4 2/2] support blackfin board initialization in generic board_f Sonic Zhang
  2014-08-29 12:20 ` [U-Boot] [PATCH v4 1/2] blackfin: convert blackfin board_f and board_r to use generic board init functions Michal Simek
  0 siblings, 2 replies; 6+ messages in thread
From: Sonic Zhang @ 2014-08-07  7:08 UTC (permalink / raw)
  To: u-boot

From: Sonic Zhang <sonic.zhang@analog.com>

- move blackfin specific cpu init code from blackfin board.c to cpu.c
- remove blackfin specific board init code and invoke generic board_f fron cpu init entry
- rename section name bss_vma to bss_start in order to match the generic board init code
- add a fake relocate_code function to set up the new stack only

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

---

v4-changes:
- move macros for generic board to arch specific config.h
- disable flash driver in board files to shrink default image size

---
 arch/blackfin/config.mk            |   3 +
 arch/blackfin/cpu/cpu.c            | 334 +++++++++++++++++++++++++---
 arch/blackfin/cpu/start.S          |  14 +-
 arch/blackfin/cpu/u-boot.lds       |   4 +-
 arch/blackfin/include/asm/config.h |   4 +
 arch/blackfin/include/asm/u-boot.h |   3 +
 arch/blackfin/lib/Makefile         |   7 +-
 arch/blackfin/lib/board.c          | 443 -------------------------------------
 arch/blackfin/lib/sections.c       |  11 +
 include/configs/bf506f-ezkit.h     |   5 +-
 include/configs/bf533-stamp.h      |   3 +-
 include/configs/bf538f-ezkit.h     |   3 +-
 12 files changed, 341 insertions(+), 493 deletions(-)
 delete mode 100644 arch/blackfin/lib/board.c
 create mode 100644 arch/blackfin/lib/sections.c

diff --git a/arch/blackfin/config.mk b/arch/blackfin/config.mk
index 7b17b75..584b38b 100644
--- a/arch/blackfin/config.mk
+++ b/arch/blackfin/config.mk
@@ -20,6 +20,9 @@ CONFIG_BFIN_CPU := $(strip $(CONFIG_BFIN_CPU:"%"=%))
 endif
 CONFIG_BFIN_BOOT_MODE := $(strip $(CONFIG_BFIN_BOOT_MODE:"%"=%))
 
+# Support generic board on Blackfin
+__HAVE_ARCH_GENERIC_BOARD := y
+
 PLATFORM_RELFLAGS += -ffixed-P3 -fomit-frame-pointer -mno-fdpic
 
 LDFLAGS_FINAL += --gc-sections
diff --git a/arch/blackfin/cpu/cpu.c b/arch/blackfin/cpu/cpu.c
index 2409c30..b7f1188 100644
--- a/arch/blackfin/cpu/cpu.c
+++ b/arch/blackfin/cpu/cpu.c
@@ -11,17 +11,22 @@
 
 #include <common.h>
 #include <command.h>
+#include <serial.h>
+#include <version.h>
+#include <i2c.h>
+
 #include <asm/blackfin.h>
 #include <asm/cplb.h>
+#include <asm/clock.h>
 #include <asm/mach-common/bits/core.h>
 #include <asm/mach-common/bits/ebiu.h>
 #include <asm/mach-common/bits/trace.h>
-#include <asm/serial.h>
 
 #include "cpu.h"
 #include "initcode.h"
 
 ulong bfin_poweron_retx;
+DECLARE_GLOBAL_DATA_PTR;
 
 #if defined(CONFIG_CORE1_RUN) && defined(COREB_L1_CODE_START)
 void bfin_core1_start(void)
@@ -48,6 +53,252 @@ void bfin_core1_start(void)
 }
 #endif
 
+__attribute__((always_inline))
+static inline void serial_early_puts(const char *s)
+{
+#ifdef CONFIG_DEBUG_EARLY_SERIAL
+	serial_puts("Early: ");
+	serial_puts(s);
+#endif
+}
+
+static int global_board_data_init(void)
+{
+#ifndef CONFIG_SYS_GBL_DATA_ADDR
+# define CONFIG_SYS_GBL_DATA_ADDR 0
+#endif
+#ifndef CONFIG_SYS_BD_INFO_ADDR
+# define CONFIG_SYS_BD_INFO_ADDR 0
+#endif
+
+	bd_t *bd;
+
+	if (CONFIG_SYS_GBL_DATA_ADDR) {
+		gd = (gd_t *)(CONFIG_SYS_GBL_DATA_ADDR);
+		memset((void *)gd, 0, GENERATED_GBL_DATA_SIZE);
+	} else {
+		static gd_t _bfin_gd;
+		gd = &_bfin_gd;
+	}
+	if (CONFIG_SYS_BD_INFO_ADDR) {
+		bd = (bd_t *)(CONFIG_SYS_BD_INFO_ADDR);
+		memset(bd, 0, GENERATED_BD_INFO_SIZE);
+	} else {
+		static bd_t _bfin_bd;
+		bd = &_bfin_bd;
+	}
+
+	gd->bd = bd;
+
+	bd->bi_r_version = version_string;
+	bd->bi_cpu = __stringify(CONFIG_BFIN_CPU);
+	bd->bi_board_name = CONFIG_SYS_BOARD;
+	bd->bi_vco = get_vco();
+	bd->bi_cclk = get_cclk();
+	bd->bi_sclk = get_sclk();
+	bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
+	bd->bi_memsize = CONFIG_SYS_MAX_RAM_SIZE;
+
+	gd->ram_size = CONFIG_SYS_MAX_RAM_SIZE;
+
+	return 0;
+}
+
+static void display_global_data(void)
+{
+	bd_t *bd;
+
+#ifndef CONFIG_DEBUG_EARLY_SERIAL
+	return;
+#endif
+
+	bd = gd->bd;
+	printf(" gd: %p\n", gd);
+	printf(" |-flags: %lx\n", gd->flags);
+	printf(" |-board_type: %lx\n", gd->arch.board_type);
+	printf(" |-baudrate: %u\n", gd->baudrate);
+	printf(" |-have_console: %lx\n", gd->have_console);
+	printf(" |-ram_size: %lx\n", gd->ram_size);
+	printf(" |-env_addr: %lx\n", gd->env_addr);
+	printf(" |-env_valid: %lx\n", gd->env_valid);
+	printf(" |-jt(%p): %p\n", gd->jt, *(gd->jt));
+	printf(" \\-bd: %p\n", gd->bd);
+	printf("   |-bi_boot_params: %lx\n", bd->bi_boot_params);
+	printf("   |-bi_memstart: %lx\n", bd->bi_memstart);
+	printf("   |-bi_memsize: %lx\n", bd->bi_memsize);
+	printf("   |-bi_flashstart: %lx\n", bd->bi_flashstart);
+	printf("   |-bi_flashsize: %lx\n", bd->bi_flashsize);
+	printf("   \\-bi_flashoffset: %lx\n", bd->bi_flashoffset);
+}
+
+#define CPLB_PAGE_SIZE (4 * 1024 * 1024)
+#define CPLB_PAGE_MASK (~(CPLB_PAGE_SIZE - 1))
+#if defined(__ADSPBF60x__)
+#define CPLB_EX_PAGE_SIZE (16 * 1024 * 1024)
+#define CPLB_EX_PAGE_MASK (~(CPLB_EX_PAGE_SIZE - 1))
+#else
+#define CPLB_EX_PAGE_SIZE CPLB_PAGE_SIZE
+#define CPLB_EX_PAGE_MASK CPLB_PAGE_MASK
+#endif
+void init_cplbtables(void)
+{
+	uint32_t *ICPLB_ADDR, *ICPLB_DATA;
+	uint32_t *DCPLB_ADDR, *DCPLB_DATA;
+	uint32_t extern_memory;
+	size_t i;
+
+	void icplb_add(uint32_t addr, uint32_t data)
+	{
+		bfin_write32(ICPLB_ADDR + i, addr);
+		bfin_write32(ICPLB_DATA + i, data);
+	}
+	void dcplb_add(uint32_t addr, uint32_t data)
+	{
+		bfin_write32(DCPLB_ADDR + i, addr);
+		bfin_write32(DCPLB_DATA + i, data);
+	}
+
+	/* populate a few common entries ... we'll let
+	 * the memory map and cplb exception handler do
+	 * the rest of the work.
+	 */
+	i = 0;
+	ICPLB_ADDR = (uint32_t *)ICPLB_ADDR0;
+	ICPLB_DATA = (uint32_t *)ICPLB_DATA0;
+	DCPLB_ADDR = (uint32_t *)DCPLB_ADDR0;
+	DCPLB_DATA = (uint32_t *)DCPLB_DATA0;
+
+	icplb_add(0xFFA00000, L1_IMEMORY);
+	dcplb_add(0xFF800000, L1_DMEMORY);
+	++i;
+#if defined(__ADSPBF60x__)
+	icplb_add(0x0, 0x0);
+	dcplb_add(CONFIG_SYS_FLASH_BASE, PAGE_SIZE_16MB | CPLB_DIRTY |
+		CPLB_SUPV_WR | CPLB_USER_WR | CPLB_USER_RD | CPLB_VALID);
+	++i;
+#endif
+
+	if (CONFIG_MEM_SIZE) {
+		uint32_t mbase = CONFIG_SYS_MONITOR_BASE;
+		uint32_t mend  = mbase + CONFIG_SYS_MONITOR_LEN - 1;
+		mbase &= CPLB_PAGE_MASK;
+		mend &= CPLB_PAGE_MASK;
+
+		icplb_add(mbase, SDRAM_IKERNEL);
+		dcplb_add(mbase, SDRAM_DKERNEL);
+		++i;
+
+		/*
+		 * If the monitor crosses a 4 meg boundary, we'll need
+		 * to lock two entries for it.  We assume it doesn't
+		 * cross two 4 meg boundaries ...
+		 */
+		if (mbase != mend) {
+			icplb_add(mend, SDRAM_IKERNEL);
+			dcplb_add(mend, SDRAM_DKERNEL);
+			++i;
+		}
+	}
+
+#ifndef __ADSPBF60x__
+	icplb_add(0x20000000, SDRAM_INON_CHBL);
+	dcplb_add(0x20000000, SDRAM_EBIU);
+	++i;
+#endif
+
+	/* Add entries for the rest of external RAM up to the bootrom */
+	extern_memory = 0;
+
+#ifdef CONFIG_DEBUG_NULL_PTR
+	icplb_add(extern_memory,
+		  (SDRAM_IKERNEL & ~PAGE_SIZE_MASK) | PAGE_SIZE_1KB);
+	dcplb_add(extern_memory,
+		  (SDRAM_DKERNEL & ~PAGE_SIZE_MASK) | PAGE_SIZE_1KB);
+	++i;
+	icplb_add(extern_memory, SDRAM_IKERNEL);
+	dcplb_add(extern_memory, SDRAM_DKERNEL);
+	extern_memory += CPLB_PAGE_SIZE;
+	++i;
+#endif
+
+	while (i < 16 && extern_memory <
+		(CONFIG_SYS_MONITOR_BASE & CPLB_EX_PAGE_MASK)) {
+		icplb_add(extern_memory, SDRAM_IGENERIC);
+		dcplb_add(extern_memory, SDRAM_DGENERIC);
+		extern_memory += CPLB_EX_PAGE_SIZE;
+		++i;
+	}
+	while (i < 16) {
+		icplb_add(0, 0);
+		dcplb_add(0, 0);
+		++i;
+	}
+}
+
+int print_cpuinfo(void)
+{
+	char buf[32];
+
+	printf("CPU:   ADSP %s (Detected Rev: 0.%d) (%s boot)\n",
+	       gd->bd->bi_cpu,
+	       bfin_revid(),
+	       get_bfin_boot_mode(CONFIG_BFIN_BOOT_MODE));
+
+	printf("Clock: VCO: %s MHz, ", strmhz(buf, get_vco()));
+	printf("Core: %s MHz, ", strmhz(buf, get_cclk()));
+#if defined(__ADSPBF60x__)
+	printf("System0: %s MHz, ", strmhz(buf, get_sclk0()));
+	printf("System1: %s MHz, ", strmhz(buf, get_sclk1()));
+	printf("Dclk: %s MHz\n", strmhz(buf, get_dclk()));
+#else
+	printf("System: %s MHz\n", strmhz(buf, get_sclk()));
+#endif
+
+	return 0;
+}
+
+int exception_init(void)
+{
+	bfin_write_EVT3(trap);
+	return 0;
+}
+
+int irq_init(void)
+{
+#ifdef SIC_IMASK0
+	bfin_write_SIC_IMASK0(0);
+	bfin_write_SIC_IMASK1(0);
+# ifdef SIC_IMASK2
+	bfin_write_SIC_IMASK2(0);
+# endif
+#elif defined(SICA_IMASK0)
+	bfin_write_SICA_IMASK0(0);
+	bfin_write_SICA_IMASK1(0);
+#elif defined(SIC_IMASK)
+	bfin_write_SIC_IMASK(0);
+#endif
+	/* Set up a dummy NMI handler if needed.  */
+	if (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_BYPASS || ANOMALY_05000219)
+		bfin_write_EVT2(evt_nmi);	/* NMI */
+	bfin_write_EVT5(evt_default);	/* hardware error */
+	bfin_write_EVT6(evt_default);	/* core timer */
+	bfin_write_EVT7(evt_default);
+	bfin_write_EVT8(evt_default);
+	bfin_write_EVT9(evt_default);
+	bfin_write_EVT10(evt_default);
+	bfin_write_EVT11(evt_default);
+	bfin_write_EVT12(evt_default);
+	bfin_write_EVT13(evt_default);
+	bfin_write_EVT14(evt_default);
+	bfin_write_EVT15(evt_default);
+	bfin_write_ILAT(0);
+	CSYNC();
+	/* enable hardware error irq */
+	irq_flags = 0x3f;
+	local_irq_enable();
+	return 0;
+}
+
 __attribute__ ((__noreturn__))
 void cpu_init_f(ulong bootflag, ulong loaded_from_ldr)
 {
@@ -102,51 +353,62 @@ void cpu_init_f(ulong bootflag, ulong loaded_from_ldr)
 	bfin_core1_start();
 #endif
 
-	serial_early_puts("Board init flash\n");
-	board_init_f(bootflag);
+	serial_early_puts("Init global data\n");
+	global_board_data_init();
+
+	board_init_f(0);
 
 	/* should not be reached */
 	while (1);
 }
 
-int exception_init(void)
+int arch_cpu_init(void)
 {
-	bfin_write_EVT3(trap);
+	serial_early_puts("Init CPLB tables\n");
+	init_cplbtables();
+
+	serial_early_puts("Exceptions setup\n");
+	exception_init();
+
+#ifndef CONFIG_ICACHE_OFF
+	serial_early_puts("Turn on ICACHE\n");
+	icache_enable();
+#endif
+#ifndef CONFIG_DCACHE_OFF
+	serial_early_puts("Turn on DCACHE\n");
+	dcache_enable();
+#endif
+
+#ifdef DEBUG
+	if (GENERATED_GBL_DATA_SIZE < sizeof(*gd))
+		hang();
+#endif
+
+	/* Initialize */
+	serial_early_puts("IRQ init\n");
+	irq_init();
+
 	return 0;
 }
 
-int irq_init(void)
+int arch_misc_init(void)
 {
-#ifdef SIC_IMASK0
-	bfin_write_SIC_IMASK0(0);
-	bfin_write_SIC_IMASK1(0);
-# ifdef SIC_IMASK2
-	bfin_write_SIC_IMASK2(0);
-# endif
-#elif defined(SICA_IMASK0)
-	bfin_write_SICA_IMASK0(0);
-	bfin_write_SICA_IMASK1(0);
-#elif defined(SIC_IMASK)
-	bfin_write_SIC_IMASK(0);
+#if defined(CONFIG_SYS_I2C)
+	i2c_reloc_fixup();
 #endif
-	/* Set up a dummy NMI handler if needed.  */
-	if (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_BYPASS || ANOMALY_05000219)
-		bfin_write_EVT2(evt_nmi);	/* NMI */
-	bfin_write_EVT5(evt_default);	/* hardware error */
-	bfin_write_EVT6(evt_default);	/* core timer */
-	bfin_write_EVT7(evt_default);
-	bfin_write_EVT8(evt_default);
-	bfin_write_EVT9(evt_default);
-	bfin_write_EVT10(evt_default);
-	bfin_write_EVT11(evt_default);
-	bfin_write_EVT12(evt_default);
-	bfin_write_EVT13(evt_default);
-	bfin_write_EVT14(evt_default);
-	bfin_write_EVT15(evt_default);
-	bfin_write_ILAT(0);
-	CSYNC();
-	/* enable hardware error irq */
-	irq_flags = 0x3f;
-	local_irq_enable();
+
+	display_global_data();
+
+	if (CONFIG_MEM_SIZE && bfin_os_log_check()) {
+		puts("\nLog buffer from operating system:\n");
+		bfin_os_log_dump();
+		puts("\n");
+	}
+
+	return 0;
+}
+
+int interrupt_init(void)
+{
 	return 0;
 }
diff --git a/arch/blackfin/cpu/start.S b/arch/blackfin/cpu/start.S
index 29a7c23..f31abfa 100644
--- a/arch/blackfin/cpu/start.S
+++ b/arch/blackfin/cpu/start.S
@@ -196,8 +196,8 @@ ENTRY(_start)
 	 * takes care of clearing things for us.
 	 */
 	serial_early_puts("Zero BSS");
-	r0.l = __bss_vma;
-	r0.h = __bss_vma;
+	r0.l = __bss_start;
+	r0.h = __bss_start;
 	r1 = 0 (x);
 	r2.l = __bss_len;
 	r2.h = __bss_len;
@@ -251,3 +251,13 @@ LENTRY(_get_pc)
 #endif
 	rts;
 ENDPROC(_get_pc)
+
+ENTRY(_relocate_code)
+	/* Fake relocate code. Setup the new stack only */
+	sp = r0;
+	fp = sp;
+	r0 = p3;
+	r1.h = 0x2000;
+	r1.l = 0x10;
+	jump.l _board_init_r
+ENDPROC(_relocate_code)
diff --git a/arch/blackfin/cpu/u-boot.lds b/arch/blackfin/cpu/u-boot.lds
index 7f0411f..ae1b813 100644
--- a/arch/blackfin/cpu/u-boot.lds
+++ b/arch/blackfin/cpu/u-boot.lds
@@ -135,6 +135,8 @@ SECTIONS
 		*(COMMON)
 		. = ALIGN(4);
 	} >ram_data
-	__bss_vma = ADDR(.bss);
+	__bss_end = .;
+	__bss_start = ADDR(.bss);
 	__bss_len = SIZEOF(.bss);
+	__init_end = .;
 }
diff --git a/arch/blackfin/include/asm/config.h b/arch/blackfin/include/asm/config.h
index 1da386e..836658a 100644
--- a/arch/blackfin/include/asm/config.h
+++ b/arch/blackfin/include/asm/config.h
@@ -174,4 +174,8 @@
 	}
 #endif
 
+#define CONFIG_SYS_GENERIC_BOARD
+#define CONFIG_DISPLAY_CPUINFO
+#define CONFIG_ARCH_MISC_INIT
+
 #endif
diff --git a/arch/blackfin/include/asm/u-boot.h b/arch/blackfin/include/asm/u-boot.h
index acaeee9..7b5cf6a 100644
--- a/arch/blackfin/include/asm/u-boot.h
+++ b/arch/blackfin/include/asm/u-boot.h
@@ -25,9 +25,12 @@ typedef struct bd_info {
 	unsigned long bi_vco;
 	unsigned long bi_cclk;
 	unsigned long bi_sclk;
+	unsigned char bi_enetaddr[6];
 } bd_t;
 
 /* For image.h:image_check_target_arch() */
 #define IH_ARCH_DEFAULT IH_ARCH_BLACKFIN
 
+int	arch_misc_init(void);
+
 #endif	/* _U_BOOT_H_ */
diff --git a/arch/blackfin/lib/Makefile b/arch/blackfin/lib/Makefile
index 4ba7bf6..b534a98 100644
--- a/arch/blackfin/lib/Makefile
+++ b/arch/blackfin/lib/Makefile
@@ -9,11 +9,6 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
-# Unnecessary.
-# Use CONFIG_SYS_BOARD instead of BFIN_BOARD_NAME
-# and delete this.
-ccflags-y += -DBFIN_BOARD_NAME='"$(BOARD)"'
-
 obj-y	+= ins.o
 obj-y	+= memcmp.o
 obj-y	+= memcpy.o
@@ -21,7 +16,6 @@ obj-y	+= memmove.o
 obj-y	+= memset.o
 obj-y	+= outs.o
 obj-$(CONFIG_CMD_KGDB) += __kgdb.o
-obj-y	+= board.o
 obj-y	+= boot.o
 obj-y	+= cache.o
 obj-y	+= clocks.o
@@ -30,3 +24,4 @@ obj-$(CONFIG_CMD_KGDB) += kgdb.o
 obj-y	+= muldi3.o
 obj-$(CONFIG_HAS_POST) += post.o
 obj-y	+= string.o
+obj-y	+= sections.o
diff --git a/arch/blackfin/lib/board.c b/arch/blackfin/lib/board.c
deleted file mode 100644
index 8784255..0000000
--- a/arch/blackfin/lib/board.c
+++ /dev/null
@@ -1,443 +0,0 @@
-/*
- * U-boot - board.c First C file to be called contains init routines
- *
- * Copyright (c) 2005-2008 Analog Devices Inc.
- *
- * (C) Copyright 2000-2004
- * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
- *
- * Licensed under the GPL-2 or later.
- */
-
-#include <common.h>
-#include <command.h>
-#include <stdio_dev.h>
-#include <serial.h>
-#include <environment.h>
-#include <malloc.h>
-#include <mmc.h>
-#include <net.h>
-#include <status_led.h>
-#include <version.h>
-#include <watchdog.h>
-
-#include <asm/cplb.h>
-#include <asm/mach-common/bits/mpu.h>
-#include <asm/clock.h>
-#include <kgdb.h>
-
-#ifdef CONFIG_CMD_NAND
-#include <nand.h>	/* cannot even include nand.h if it isnt configured */
-#endif
-
-#ifdef CONFIG_BITBANGMII
-#include <miiphy.h>
-#endif
-
-#if defined(CONFIG_POST)
-#include <post.h>
-int post_flag;
-#endif
-
-#if defined(CONFIG_SYS_I2C)
-#include <i2c.h>
-#endif
-
-DECLARE_GLOBAL_DATA_PTR;
-
-__attribute__((always_inline))
-static inline void serial_early_puts(const char *s)
-{
-#ifdef CONFIG_DEBUG_EARLY_SERIAL
-	serial_puts("Early: ");
-	serial_puts(s);
-#endif
-}
-
-static int display_banner(void)
-{
-	display_options();
-	printf("CPU:   ADSP %s "
-		"(Detected Rev: 0.%d) "
-		"(%s boot)\n",
-		gd->bd->bi_cpu,
-		bfin_revid(),
-		get_bfin_boot_mode(CONFIG_BFIN_BOOT_MODE));
-	return 0;
-}
-
-static int init_baudrate(void)
-{
-	gd->baudrate = getenv_ulong("baudrate", 10, CONFIG_BAUDRATE);
-	return 0;
-}
-
-static void display_global_data(void)
-{
-	bd_t *bd;
-
-#ifndef CONFIG_DEBUG_EARLY_SERIAL
-	return;
-#endif
-
-	bd = gd->bd;
-	printf(" gd: %p\n", gd);
-	printf(" |-flags: %lx\n", gd->flags);
-	printf(" |-board_type: %lx\n", gd->arch.board_type);
-	printf(" |-baudrate: %u\n", gd->baudrate);
-	printf(" |-have_console: %lx\n", gd->have_console);
-	printf(" |-ram_size: %lx\n", gd->ram_size);
-	printf(" |-env_addr: %lx\n", gd->env_addr);
-	printf(" |-env_valid: %lx\n", gd->env_valid);
-	printf(" |-jt(%p): %p\n", gd->jt, *(gd->jt));
-	printf(" \\-bd: %p\n", gd->bd);
-	printf("   |-bi_boot_params: %lx\n", bd->bi_boot_params);
-	printf("   |-bi_memstart: %lx\n", bd->bi_memstart);
-	printf("   |-bi_memsize: %lx\n", bd->bi_memsize);
-	printf("   |-bi_flashstart: %lx\n", bd->bi_flashstart);
-	printf("   |-bi_flashsize: %lx\n", bd->bi_flashsize);
-	printf("   \\-bi_flashoffset: %lx\n", bd->bi_flashoffset);
-}
-
-#define CPLB_PAGE_SIZE (4 * 1024 * 1024)
-#define CPLB_PAGE_MASK (~(CPLB_PAGE_SIZE - 1))
-#if defined(__ADSPBF60x__)
-#define CPLB_EX_PAGE_SIZE (16 * 1024 * 1024)
-#define CPLB_EX_PAGE_MASK (~(CPLB_EX_PAGE_SIZE - 1))
-#else
-#define CPLB_EX_PAGE_SIZE CPLB_PAGE_SIZE
-#define CPLB_EX_PAGE_MASK CPLB_PAGE_MASK
-#endif
-void init_cplbtables(void)
-{
-	volatile uint32_t *ICPLB_ADDR, *ICPLB_DATA;
-	volatile uint32_t *DCPLB_ADDR, *DCPLB_DATA;
-	uint32_t extern_memory;
-	size_t i;
-
-	void icplb_add(uint32_t addr, uint32_t data)
-	{
-		*(ICPLB_ADDR + i) = addr;
-		*(ICPLB_DATA + i) = data;
-	}
-	void dcplb_add(uint32_t addr, uint32_t data)
-	{
-		*(DCPLB_ADDR + i) = addr;
-		*(DCPLB_DATA + i) = data;
-	}
-
-	/* populate a few common entries ... we'll let
-	 * the memory map and cplb exception handler do
-	 * the rest of the work.
-	 */
-	i = 0;
-	ICPLB_ADDR = (uint32_t *)ICPLB_ADDR0;
-	ICPLB_DATA = (uint32_t *)ICPLB_DATA0;
-	DCPLB_ADDR = (uint32_t *)DCPLB_ADDR0;
-	DCPLB_DATA = (uint32_t *)DCPLB_DATA0;
-
-	icplb_add(0xFFA00000, L1_IMEMORY);
-	dcplb_add(0xFF800000, L1_DMEMORY);
-	++i;
-#if defined(__ADSPBF60x__)
-	icplb_add(0x0, 0x0);
-	dcplb_add(CONFIG_SYS_FLASH_BASE, PAGE_SIZE_16MB | CPLB_DIRTY |
-		CPLB_SUPV_WR | CPLB_USER_WR | CPLB_USER_RD | CPLB_VALID);
-	++i;
-#endif
-
-	if (CONFIG_MEM_SIZE) {
-		uint32_t mbase = CONFIG_SYS_MONITOR_BASE;
-		uint32_t mend  = mbase + CONFIG_SYS_MONITOR_LEN;
-		mbase &= CPLB_PAGE_MASK;
-		mend &= CPLB_PAGE_MASK;
-
-		icplb_add(mbase, SDRAM_IKERNEL);
-		dcplb_add(mbase, SDRAM_DKERNEL);
-		++i;
-
-		/*
-		 * If the monitor crosses a 4 meg boundary, we'll need
-		 * to lock two entries for it.  We assume it doesn't
-		 * cross two 4 meg boundaries ...
-		 */
-		if (mbase != mend) {
-			icplb_add(mend, SDRAM_IKERNEL);
-			dcplb_add(mend, SDRAM_DKERNEL);
-			++i;
-		}
-	}
-
-#ifndef __ADSPBF60x__
-	icplb_add(0x20000000, SDRAM_INON_CHBL);
-	dcplb_add(0x20000000, SDRAM_EBIU);
-	++i;
-#endif
-
-	/* Add entries for the rest of external RAM up to the bootrom */
-	extern_memory = 0;
-
-#ifdef CONFIG_DEBUG_NULL_PTR
-	icplb_add(extern_memory, (SDRAM_IKERNEL & ~PAGE_SIZE_MASK) | PAGE_SIZE_1KB);
-	dcplb_add(extern_memory, (SDRAM_DKERNEL & ~PAGE_SIZE_MASK) | PAGE_SIZE_1KB);
-	++i;
-	icplb_add(extern_memory, SDRAM_IKERNEL);
-	dcplb_add(extern_memory, SDRAM_DKERNEL);
-	extern_memory += CPLB_PAGE_SIZE;
-	++i;
-#endif
-
-	while (i < 16 && extern_memory <
-		(CONFIG_SYS_MONITOR_BASE & CPLB_EX_PAGE_MASK)) {
-		icplb_add(extern_memory, SDRAM_IGENERIC);
-		dcplb_add(extern_memory, SDRAM_DGENERIC);
-		extern_memory += CPLB_EX_PAGE_SIZE;
-		++i;
-	}
-	while (i < 16) {
-		icplb_add(0, 0);
-		dcplb_add(0, 0);
-		++i;
-	}
-}
-
-static int global_board_data_init(void)
-{
-#ifndef CONFIG_SYS_GBL_DATA_ADDR
-# define CONFIG_SYS_GBL_DATA_ADDR 0
-#endif
-#ifndef CONFIG_SYS_BD_INFO_ADDR
-# define CONFIG_SYS_BD_INFO_ADDR 0
-#endif
-
-	bd_t *bd;
-
-	if (CONFIG_SYS_GBL_DATA_ADDR) {
-		gd = (gd_t *) (CONFIG_SYS_GBL_DATA_ADDR);
-		memset((void *)gd, 0, GENERATED_GBL_DATA_SIZE);
-	} else {
-		static gd_t _bfin_gd;
-		gd = &_bfin_gd;
-	}
-
-	if (CONFIG_SYS_BD_INFO_ADDR) {
-		bd = (bd_t *) (CONFIG_SYS_BD_INFO_ADDR);
-		memset(bd, 0, GENERATED_BD_INFO_SIZE);
-	} else {
-		static bd_t _bfin_bd;
-		bd = &_bfin_bd;
-	}
-	gd->bd = bd;
-
-	bd->bi_r_version = version_string;
-	bd->bi_cpu = __stringify(CONFIG_BFIN_CPU);
-	bd->bi_board_name = BFIN_BOARD_NAME;
-	bd->bi_vco = get_vco();
-	bd->bi_cclk = get_cclk();
-	bd->bi_sclk = get_sclk();
-	bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
-	bd->bi_memsize = CONFIG_SYS_MAX_RAM_SIZE;
-
-	return 0;
-}
-
-/*
- * All attempts to come up with a "common" initialization sequence
- * that works for all boards and architectures failed: some of the
- * requirements are just _too_ different. To get rid of the resulting
- * mess of board dependend #ifdef'ed code we now make the whole
- * initialization sequence configurable to the user.
- *
- * The requirements for any new initalization function is simple: it
- * receives a pointer to the "global data" structure as it's only
- * argument, and returns an integer return code, where 0 means
- * "continue" and != 0 means "fatal error, hang the system".
- */
-
-extern int watchdog_init(void);
-extern int exception_init(void);
-extern int irq_init(void);
-extern int timer_init(void);
-
-void board_init_f(ulong bootflag)
-{
-	char buf[32];
-
-#ifdef CONFIG_BOARD_EARLY_INIT_F
-	serial_early_puts("Board early init flash\n");
-	board_early_init_f();
-#endif
-
-	serial_early_puts("Init CPLB tables\n");
-	init_cplbtables();
-
-	serial_early_puts("Exceptions setup\n");
-	exception_init();
-
-#ifndef CONFIG_ICACHE_OFF
-	serial_early_puts("Turn on ICACHE\n");
-	icache_enable();
-#endif
-#ifndef CONFIG_DCACHE_OFF
-	serial_early_puts("Turn on DCACHE\n");
-	dcache_enable();
-#endif
-
-#ifdef CONFIG_HW_WATCHDOG
-	serial_early_puts("Setting up external watchdog\n");
-	hw_watchdog_init();
-#endif
-
-#ifdef DEBUG
-	if (GENERATED_GBL_DATA_SIZE < sizeof(*gd))
-		hang();
-#endif
-	serial_early_puts("Init global data\n");
-
-	global_board_data_init();
-
-	/* Initialize */
-	serial_early_puts("IRQ init\n");
-	irq_init();
-	serial_early_puts("Environment init\n");
-	env_init();
-	serial_early_puts("Baudrate init\n");
-	init_baudrate();
-	serial_early_puts("Serial init\n");
-	serial_init();
-	serial_initialize();
-	serial_early_puts("Console init flash\n");
-	console_init_f();
-	serial_early_puts("End of early debugging\n");
-	display_banner();
-
-	checkboard();
-	timer_init();
-
-	printf("Clock: VCO: %s MHz, ", strmhz(buf, get_vco()));
-	printf("Core: %s MHz, ", strmhz(buf, get_cclk()));
-#if defined(__ADSPBF60x__)
-	printf("System0: %s MHz, ", strmhz(buf, get_sclk0()));
-	printf("System1: %s MHz, ", strmhz(buf, get_sclk1()));
-	printf("Dclk: %s MHz\n", strmhz(buf, get_dclk()));
-#else
-	printf("System: %s MHz\n", strmhz(buf, get_sclk()));
-#endif
-
-	if (CONFIG_MEM_SIZE) {
-		printf("RAM:   ");
-		print_size(gd->bd->bi_memsize, "\n");
-	}
-
-#if defined(CONFIG_POST)
-	post_init_f();
-	post_bootmode_init();
-	post_run(NULL, POST_ROM | post_bootmode_get(0));
-#endif
-
-	board_init_r((gd_t *) gd, 0x20000010);
-}
-
-static void board_net_init_r(bd_t *bd)
-{
-#ifdef CONFIG_BITBANGMII
-	bb_miiphy_init();
-#endif
-#ifdef CONFIG_CMD_NET
-	printf("Net:   ");
-	eth_initialize(bd);
-#endif
-}
-
-void board_init_r(gd_t * id, ulong dest_addr)
-{
-	bd_t *bd;
-	gd = id;
-	gd->flags |= GD_FLG_RELOC;	/* tell others: relocation done */
-	bd = gd->bd;
-
-#if defined(CONFIG_POST)
-	post_output_backlog();
-#endif
-
-	/* initialize malloc() area */
-	mem_malloc_init(CONFIG_SYS_MALLOC_BASE, CONFIG_SYS_MALLOC_LEN);
-
-#if	!defined(CONFIG_SYS_NO_FLASH)
-	/* Initialize the flash and protect u-boot by default */
-	extern flash_info_t flash_info[];
-	puts("Flash: ");
-	ulong size = flash_init();
-	print_size(size, "\n");
-	flash_protect(FLAG_PROTECT_SET, CONFIG_SYS_FLASH_BASE,
-		CONFIG_SYS_FLASH_BASE + CONFIG_SYS_MONITOR_LEN - 1,
-		&flash_info[0]);
-	bd->bi_flashstart = CONFIG_SYS_FLASH_BASE;
-	bd->bi_flashsize = size;
-	bd->bi_flashoffset = 0;
-#else
-	bd->bi_flashstart = 0;
-	bd->bi_flashsize = 0;
-	bd->bi_flashoffset = 0;
-#endif
-
-#ifdef CONFIG_CMD_NAND
-	puts("NAND:  ");
-	nand_init();		/* go init the NAND */
-#endif
-
-#ifdef CONFIG_GENERIC_MMC
-	puts("MMC:   ");
-	mmc_initialize(bd);
-#endif
-
-#if defined(CONFIG_SYS_I2C)
-	i2c_reloc_fixup();
-#endif
-	/* relocate environment function pointers etc. */
-	env_relocate();
-
-	/* Initialize stdio devices */
-	stdio_init();
-	jumptable_init();
-
-	/* Initialize the console (after the relocation and devices init) */
-	console_init_r();
-
-#ifdef CONFIG_CMD_KGDB
-	puts("KGDB:  ");
-	kgdb_init();
-#endif
-
-#ifdef CONFIG_STATUS_LED
-	status_led_set(STATUS_LED_BOOT, STATUS_LED_BLINKING);
-	status_led_set(STATUS_LED_CRASH, STATUS_LED_OFF);
-#endif
-
-	/* Initialize from environment */
-	load_addr = getenv_ulong("loadaddr", 16, load_addr);
-
-#if defined(CONFIG_MISC_INIT_R)
-	/* miscellaneous platform dependent initialisations */
-	misc_init_r();
-#endif
-
-	board_net_init_r(bd);
-
-	display_global_data();
-
-#if defined(CONFIG_POST)
-	if (post_flag)
-		post_run(NULL, POST_RAM | post_bootmode_get(0));
-#endif
-
-	if (CONFIG_MEM_SIZE && 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();
-}
diff --git a/arch/blackfin/lib/sections.c b/arch/blackfin/lib/sections.c
new file mode 100644
index 0000000..b50f30a
--- /dev/null
+++ b/arch/blackfin/lib/sections.c
@@ -0,0 +1,11 @@
+/*
+ * U-boot - section.c
+ *
+ * Copyright (c) 2014 Analog Devices Inc.
+ *
+ * Licensed under the GPL-2 or later.
+ */
+
+char __bss_start[0] __attribute__((section(".__bss_start")));
+char __bss_end[0] __attribute__((section(".__bss_end")));
+char __init_end[0] __attribute__((section(".__init_end")));
diff --git a/include/configs/bf506f-ezkit.h b/include/configs/bf506f-ezkit.h
index eed2d5b..5db1819 100644
--- a/include/configs/bf506f-ezkit.h
+++ b/include/configs/bf506f-ezkit.h
@@ -56,7 +56,7 @@
 /*
  * Flash Settings
  */
-
+/*
 #define CONFIG_FLASH_CFI_DRIVER
 #define CONFIG_SYS_FLASH_BASE		0x20000000
 #define CONFIG_SYS_FLASH_CFI
@@ -64,9 +64,8 @@
 #define CONFIG_SYS_MAX_FLASH_SECT	71
 #define CONFIG_CMD_FLASH
 #define CONFIG_MONITOR_IS_IN_RAM
-/*
-#define CONFIG_SYS_NO_FLASH
 */
+#define CONFIG_SYS_NO_FLASH
 
 /*
  * SPI Settings
diff --git a/include/configs/bf533-stamp.h b/include/configs/bf533-stamp.h
index d82c5b2..3d36d84 100644
--- a/include/configs/bf533-stamp.h
+++ b/include/configs/bf533-stamp.h
@@ -98,10 +98,11 @@
  */
 #define CONFIG_BFIN_SPI
 #define CONFIG_ENV_SPI_MAX_HZ	30000000
+/*
 #define CONFIG_SF_DEFAULT_SPEED	30000000
 #define CONFIG_SPI_FLASH
 #define CONFIG_SPI_FLASH_ALL
-
+*/
 
 /*
  * Env Storage Settings
diff --git a/include/configs/bf538f-ezkit.h b/include/configs/bf538f-ezkit.h
index 742c299..32df5ec 100644
--- a/include/configs/bf538f-ezkit.h
+++ b/include/configs/bf538f-ezkit.h
@@ -83,10 +83,11 @@
  */
 #define CONFIG_BFIN_SPI
 #define CONFIG_ENV_SPI_MAX_HZ	30000000
+/*
 #define CONFIG_SF_DEFAULT_SPEED	30000000
 #define CONFIG_SPI_FLASH
 #define CONFIG_SPI_FLASH_ALL
-
+*/
 
 /*
  * Env Storage Settings
-- 
1.8.2.3

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH v4 2/2] support blackfin board initialization in generic board_f
  2014-08-07  7:08 [U-Boot] [PATCH v4 1/2] blackfin: convert blackfin board_f and board_r to use generic board init functions Sonic Zhang
@ 2014-08-07  7:08 ` Sonic Zhang
  2014-08-08 16:50   ` Tom Rini
  2014-08-29 12:20 ` [U-Boot] [PATCH v4 1/2] blackfin: convert blackfin board_f and board_r to use generic board init functions Michal Simek
  1 sibling, 1 reply; 6+ messages in thread
From: Sonic Zhang @ 2014-08-07  7:08 UTC (permalink / raw)
  To: u-boot

From: Sonic Zhang <sonic.zhang@analog.com>

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

---

v2-changes:
- make hardware watchdog init depend on BLACKFIN || M68K || MICROBLAZE || SH
- define watchdog init and reset macros for both software and hardware watchdog

v3-changes:
- allocate board info struct only when it is not already allocated in arch init

v4-changes:
- Init hw watchdog only when generic board macro is defined, because m68k havsn't
switched over to generic board yet.
- avoid reserving video for Blackfin boards

---
 common/board_f.c   | 45 ++++++++++++++++++++++++++++++++++-----------
 include/watchdog.h |  3 ++-
 2 files changed, 36 insertions(+), 12 deletions(-)

diff --git a/common/board_f.c b/common/board_f.c
index 6203d85..d5e7622 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -106,9 +106,14 @@ __weak void blue_led_off(void) {}
  * Could the CONFIG_SPL_BUILD infection become a flag in gd?
  */
 
-#if defined(CONFIG_WATCHDOG)
+#if defined(CONFIG_WATCHDOG) || defined(CONFIG_HW_WATCHDOG)
 static int init_func_watchdog_init(void)
 {
+# if defined(CONFIG_HW_WATCHDOG) && (defined(CONFIG_BLACKFIN) || \
+	defined(CONFIG_M68K) || defined(CONFIG_MICROBLAZE) || \
+	defined(CONFIG_SH))
+	hw_watchdog_init();
+# endif
 	puts("       Watchdog enabled\n");
 	WATCHDOG_RESET();
 
@@ -146,7 +151,11 @@ static int display_text_info(void)
 	bss_end = (ulong)&__bss_end;
 
 	debug("U-Boot code: %08X -> %08lX  BSS: -> %08lX\n",
+#ifdef CONFIG_SYS_TEXT_BASE
 	      CONFIG_SYS_TEXT_BASE, bss_start, bss_end);
+#else
+	      CONFIG_SYS_MONITOR_BASE, bss_start, bss_end);
+#endif
 #endif
 
 #ifdef CONFIG_MODEM_SUPPORT
@@ -261,6 +270,8 @@ static int setup_mon_len(void)
 	gd->mon_len = (ulong)&__bss_end - (ulong)_start;
 #elif defined(CONFIG_SANDBOX)
 	gd->mon_len = (ulong)&_end - (ulong)_init;
+#elif defined(CONFIG_BLACKFIN)
+	gd->mon_len = CONFIG_SYS_MONITOR_LEN;
 #else
 	/* TODO: use (ulong)&__bss_end - (ulong)&__text_start; ? */
 	gd->mon_len = (ulong)&__bss_end - CONFIG_SYS_MONITOR_BASE;
@@ -470,8 +481,9 @@ static int reserve_trace(void)
 	return 0;
 }
 
-#if defined(CONFIG_VIDEO) && (!defined(CONFIG_PPC) || defined(CONFIG_8xx)) \
-		&& !defined(CONFIG_ARM) && !defined(CONFIG_X86)
+#if defined(CONFIG_VIDEO) && (!defined(CONFIG_PPC) || defined(CONFIG_8xx)) && \
+		!defined(CONFIG_ARM) && !defined(CONFIG_X86) && \
+		!defined(CONFIG_BLACKFIN)
 static int reserve_video(void)
 {
 	/* reserve memory for video display (always full pages) */
@@ -516,11 +528,13 @@ static int reserve_malloc(void)
 /* (permanently) allocate a Board Info struct */
 static int reserve_board(void)
 {
-	gd->start_addr_sp -= sizeof(bd_t);
-	gd->bd = (bd_t *)map_sysmem(gd->start_addr_sp, sizeof(bd_t));
-	memset(gd->bd, '\0', sizeof(bd_t));
-	debug("Reserving %zu Bytes for Board Info at: %08lx\n",
-			sizeof(bd_t), gd->start_addr_sp);
+	if (!gd->bd) {
+		gd->start_addr_sp -= sizeof(bd_t);
+		gd->bd = (bd_t *)map_sysmem(gd->start_addr_sp, sizeof(bd_t));
+		memset(gd->bd, '\0', sizeof(bd_t));
+		debug("Reserving %zu Bytes for Board Info at: %08lx\n",
+		      sizeof(bd_t), gd->start_addr_sp);
+	}
 	return 0;
 }
 #endif
@@ -721,7 +735,9 @@ static int reloc_fdt(void)
 
 static int setup_reloc(void)
 {
+#ifdef CONFIG_SYS_TEXT_BASE
 	gd->reloc_off = gd->relocaddr - CONFIG_SYS_TEXT_BASE;
+#endif
 	memcpy(gd->new_gd, (char *)gd, sizeof(gd_t));
 
 	debug("Relocation Offset is: %08lx\n", gd->reloc_off);
@@ -828,7 +844,7 @@ static init_fnc_t init_sequence_f[] = {
 	/* TODO: can we rename this to timer_init()? */
 	init_timebase,
 #endif
-#if defined(CONFIG_ARM) || defined(CONFIG_MIPS)
+#if defined(CONFIG_ARM) || defined(CONFIG_MIPS) || defined(CONFIG_BLACKFIN)
 	timer_init,		/* initialize timer */
 #endif
 #ifdef CONFIG_SYS_ALLOC_DPRAM
@@ -929,6 +945,10 @@ static init_fnc_t init_sequence_f[] = {
 	 *  - board info struct
 	 */
 	setup_dest_addr,
+#if defined(CONFIG_BLACKFIN)
+	/* Blackfin u-boot monitor should be on top of the ram */
+	reserve_uboot,
+#endif
 #if defined(CONFIG_LOGBUFFER) && !defined(CONFIG_ALT_LB_ADDR)
 	reserve_logbuffer,
 #endif
@@ -945,11 +965,14 @@ static init_fnc_t init_sequence_f[] = {
 #endif
 	reserve_trace,
 	/* TODO: Why the dependency on CONFIG_8xx? */
-#if defined(CONFIG_VIDEO) && (!defined(CONFIG_PPC) || defined(CONFIG_8xx)) \
-		&& !defined(CONFIG_ARM) && !defined(CONFIG_X86)
+#if defined(CONFIG_VIDEO) && (!defined(CONFIG_PPC) || defined(CONFIG_8xx)) && \
+		!defined(CONFIG_ARM) && !defined(CONFIG_X86) && \
+		!defined(CONFIG_BLACKFIN)
 	reserve_video,
 #endif
+#if !defined(CONFIG_BLACKFIN)
 	reserve_uboot,
+#endif
 #ifndef CONFIG_SPL_BUILD
 	reserve_malloc,
 	reserve_board,
diff --git a/include/watchdog.h b/include/watchdog.h
index bd0a8d6..9273fa1 100644
--- a/include/watchdog.h
+++ b/include/watchdog.h
@@ -21,7 +21,8 @@
 int init_func_watchdog_reset(void);
 #endif
 
-#ifdef CONFIG_WATCHDOG
+#if defined(CONFIG_SYS_GENERIC_BOARD) && \
+	(defined(CONFIG_WATCHDOG) || defined(CONFIG_HW_WATCHDOG))
 #define INIT_FUNC_WATCHDOG_INIT	init_func_watchdog_init,
 #define INIT_FUNC_WATCHDOG_RESET	init_func_watchdog_reset,
 #else
-- 
1.8.2.3

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH v4 2/2] support blackfin board initialization in generic board_f
  2014-08-07  7:08 ` [U-Boot] [PATCH v4 2/2] support blackfin board initialization in generic board_f Sonic Zhang
@ 2014-08-08 16:50   ` Tom Rini
  0 siblings, 0 replies; 6+ messages in thread
From: Tom Rini @ 2014-08-08 16:50 UTC (permalink / raw)
  To: u-boot

On Thu, Aug 07, 2014 at 03:08:52PM +0800, Sonic Zhang wrote:

> From: Sonic Zhang <sonic.zhang@analog.com>
> 
> - init hardware watchdog if applicable
> - use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
> - reserve u-boot memory at the top field of the RAM for Blackfin
> - avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin
> 
> Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

Build tested this and 1/2 for blackfin and m68k here and everything is
good now, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140808/1698b975/attachment.pgp>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH v4 1/2] blackfin: convert blackfin board_f and board_r to use generic board init functions
  2014-08-07  7:08 [U-Boot] [PATCH v4 1/2] blackfin: convert blackfin board_f and board_r to use generic board init functions Sonic Zhang
  2014-08-07  7:08 ` [U-Boot] [PATCH v4 2/2] support blackfin board initialization in generic board_f Sonic Zhang
@ 2014-08-29 12:20 ` Michal Simek
  2014-09-01  2:52   ` Sonic Zhang
  1 sibling, 1 reply; 6+ messages in thread
From: Michal Simek @ 2014-08-29 12:20 UTC (permalink / raw)
  To: u-boot

Hi Sonic

On 08/07/2014 09:08 AM, Sonic Zhang wrote:
> From: Sonic Zhang <sonic.zhang@analog.com>
> 
> - move blackfin specific cpu init code from blackfin board.c to cpu.c
> - remove blackfin specific board init code and invoke generic board_f fron cpu init entry
> - rename section name bss_vma to bss_start in order to match the generic board init code
> - add a fake relocate_code function to set up the new stack only

I would like get more information about this change.
I have spent some time on Microblaze to move to generic board
and I need to use sort of the same approach.
I will play with full reloc but as I see there will be a lot of additional
code generated which increase u-boot footprint and brings nothing.

That's why I would like to know why you have decided to use fake relocate_code
function and what setup you are using before and "after" relocation (location of stack, gd, malloc
areas, etc).

Thanks,
Michal

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140829/b7644819/attachment.pgp>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH v4 1/2] blackfin: convert blackfin board_f and board_r to use generic board init functions
  2014-08-29 12:20 ` [U-Boot] [PATCH v4 1/2] blackfin: convert blackfin board_f and board_r to use generic board init functions Michal Simek
@ 2014-09-01  2:52   ` Sonic Zhang
  2014-09-01 11:01     ` Michal Simek
  0 siblings, 1 reply; 6+ messages in thread
From: Sonic Zhang @ 2014-09-01  2:52 UTC (permalink / raw)
  To: u-boot

Hi Michael,

On Fri, Aug 29, 2014 at 8:20 PM, Michal Simek <monstr@monstr.eu> wrote:
> Hi Sonic
>
> On 08/07/2014 09:08 AM, Sonic Zhang wrote:
>> From: Sonic Zhang <sonic.zhang@analog.com>
>>
>> - move blackfin specific cpu init code from blackfin board.c to cpu.c
>> - remove blackfin specific board init code and invoke generic board_f fron cpu init entry
>> - rename section name bss_vma to bss_start in order to match the generic board init code
>> - add a fake relocate_code function to set up the new stack only
>
> I would like get more information about this change.
> I have spent some time on Microblaze to move to generic board
> and I need to use sort of the same approach.
> I will play with full reloc but as I see there will be a lot of additional
> code generated which increase u-boot footprint and brings nothing.
>
> That's why I would like to know why you have decided to use fake relocate_code
> function and what setup you are using before and "after" relocation (location of stack, gd, malloc
> areas, etc).

The Blackfin u-boot start code has already done the relocation before
the generic board_init_f() is invoked. But, the new stack pointer can
not be set until all functions in init_sequence_f[] are done. So, the
last function in init_sequence_f[] relocate_code() is used to update
the stack point and jump to the generic board_init_f(). Blackfin
architecture defines global static gd and bd data and set the init
stack point to (CONFIG_SYS_MALLOC_BASE - 4).

Regards,

Sonic

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH v4 1/2] blackfin: convert blackfin board_f and board_r to use generic board init functions
  2014-09-01  2:52   ` Sonic Zhang
@ 2014-09-01 11:01     ` Michal Simek
  0 siblings, 0 replies; 6+ messages in thread
From: Michal Simek @ 2014-09-01 11:01 UTC (permalink / raw)
  To: u-boot

On 09/01/2014 04:52 AM, Sonic Zhang wrote:
> Hi Michael,
> 
> On Fri, Aug 29, 2014 at 8:20 PM, Michal Simek <monstr@monstr.eu> wrote:
>> Hi Sonic
>>
>> On 08/07/2014 09:08 AM, Sonic Zhang wrote:
>>> From: Sonic Zhang <sonic.zhang@analog.com>
>>>
>>> - move blackfin specific cpu init code from blackfin board.c to cpu.c
>>> - remove blackfin specific board init code and invoke generic board_f fron cpu init entry
>>> - rename section name bss_vma to bss_start in order to match the generic board init code
>>> - add a fake relocate_code function to set up the new stack only
>>
>> I would like get more information about this change.
>> I have spent some time on Microblaze to move to generic board
>> and I need to use sort of the same approach.
>> I will play with full reloc but as I see there will be a lot of additional
>> code generated which increase u-boot footprint and brings nothing.
>>
>> That's why I would like to know why you have decided to use fake relocate_code
>> function and what setup you are using before and "after" relocation (location of stack, gd, malloc
>> areas, etc).
> 
> The Blackfin u-boot start code has already done the relocation before
> the generic board_init_f() is invoked. But, the new stack pointer can
> not be set until all functions in init_sequence_f[] are done. So, the
> last function in init_sequence_f[] relocate_code() is used to update
> the stack point and jump to the generic board_init_f(). Blackfin
> architecture defines global static gd and bd data and set the init
> stack point to (CONFIG_SYS_MALLOC_BASE - 4).

Ah ok.

Thanks,
Michal

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform



-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140901/f4366f3d/attachment.pgp>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-09-01 11:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-07  7:08 [U-Boot] [PATCH v4 1/2] blackfin: convert blackfin board_f and board_r to use generic board init functions Sonic Zhang
2014-08-07  7:08 ` [U-Boot] [PATCH v4 2/2] support blackfin board initialization in generic board_f Sonic Zhang
2014-08-08 16:50   ` Tom Rini
2014-08-29 12:20 ` [U-Boot] [PATCH v4 1/2] blackfin: convert blackfin board_f and board_r to use generic board init functions Michal Simek
2014-09-01  2:52   ` Sonic Zhang
2014-09-01 11:01     ` Michal Simek

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.