summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/Kconfig4
-rw-r--r--arch/arm/include/asm/emif.h3
-rw-r--r--arch/blackfin/config.mk3
-rw-r--r--arch/blackfin/cpu/cpu.c334
-rw-r--r--arch/blackfin/cpu/start.S14
-rw-r--r--arch/blackfin/cpu/u-boot.lds4
-rw-r--r--arch/blackfin/include/asm/clock.h2
-rw-r--r--arch/blackfin/include/asm/config.h4
-rw-r--r--arch/blackfin/include/asm/mach-bf609/BF609_def.h2
-rw-r--r--arch/blackfin/include/asm/u-boot.h3
-rw-r--r--arch/blackfin/lib/Makefile7
-rw-r--r--arch/blackfin/lib/board.c443
-rw-r--r--arch/blackfin/lib/sections.c11
-rw-r--r--arch/nios2/Kconfig8
-rw-r--r--arch/nios2/config.mk2
-rw-r--r--arch/nios2/cpu/Makefile2
-rw-r--r--arch/nios2/cpu/cpu.c14
-rw-r--r--arch/nios2/cpu/epcs.c717
-rw-r--r--arch/nios2/cpu/start.S34
-rw-r--r--arch/nios2/include/asm/config.h3
-rw-r--r--arch/nios2/include/asm/posix_types.h4
-rw-r--r--arch/nios2/include/asm/u-boot.h10
-rw-r--r--arch/nios2/lib/Makefile1
-rw-r--r--arch/nios2/lib/board.c147
-rw-r--r--arch/powerpc/cpu/mpc85xx/cpu_init.c28
-rw-r--r--arch/powerpc/cpu/mpc85xx/fdt.c15
-rw-r--r--arch/powerpc/cpu/mpc8xx/Kconfig20
-rw-r--r--arch/powerpc/cpu/mpc8xx/cpu_init.c4
-rw-r--r--arch/powerpc/lib/board.c2
29 files changed, 435 insertions, 1410 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index e385eda94c..e97f94db25 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -287,9 +287,6 @@ config TARGET_SC_SPS_1
config TARGET_NHK8815
bool "Support nhk8815"
-config TARGET_OMAP5912OSK
- bool "Support omap5912osk"
-
config TARGET_EDMINIV2
bool "Support edminiv2"
@@ -977,7 +974,6 @@ source "board/ti/beagle/Kconfig"
source "board/ti/dra7xx/Kconfig"
source "board/ti/evm/Kconfig"
source "board/ti/ks2_evm/Kconfig"
-source "board/ti/omap5912osk/Kconfig"
source "board/ti/omap5_uevm/Kconfig"
source "board/ti/panda/Kconfig"
source "board/ti/sdp3430/Kconfig"
diff --git a/arch/arm/include/asm/emif.h b/arch/arm/include/asm/emif.h
index b8d6bdca9b..2fe5776c6c 100644
--- a/arch/arm/include/asm/emif.h
+++ b/arch/arm/include/asm/emif.h
@@ -878,7 +878,6 @@ struct dmm_lisa_map_regs {
((REG_CS_TIM << EMIF_REG_CS_TIM_SHIFT) & EMIF_REG_CS_TIM_MASK)|\
((REG_SR_TIM << EMIF_REG_SR_TIM_SHIFT) & EMIF_REG_SR_TIM_MASK)|\
((REG_PD_TIM << EMIF_REG_PD_TIM_SHIFT) & EMIF_REG_PD_TIM_MASK)|\
- ((REG_PD_TIM << EMIF_REG_PD_TIM_SHIFT) & EMIF_REG_PD_TIM_MASK)|\
((LP_MODE_DISABLE << EMIF_REG_LP_MODE_SHIFT)\
& EMIF_REG_LP_MODE_MASK) |\
((DPD_DISABLE << EMIF_REG_DPD_EN_SHIFT)\
@@ -890,8 +889,6 @@ struct dmm_lisa_map_regs {
((REG_SR_TIM << EMIF_REG_SR_TIM_SHDW_SHIFT)\
& EMIF_REG_SR_TIM_SHDW_MASK) |\
((REG_PD_TIM << EMIF_REG_PD_TIM_SHDW_SHIFT)\
- & EMIF_REG_PD_TIM_SHDW_MASK) |\
- ((REG_PD_TIM << EMIF_REG_PD_TIM_SHDW_SHIFT)\
& EMIF_REG_PD_TIM_SHDW_MASK))
/* EMIF_L3_CONFIG register value */
diff --git a/arch/blackfin/config.mk b/arch/blackfin/config.mk
index 7b17b75743..584b38b17a 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 2409c300ed..b7f118801d 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 29a7c232e2..f31abfacf2 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 7f0411f612..ae1b813c1f 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/clock.h b/arch/blackfin/include/asm/clock.h
index 59d3faa29d..05ae03c09a 100644
--- a/arch/blackfin/include/asm/clock.h
+++ b/arch/blackfin/include/asm/clock.h
@@ -78,7 +78,7 @@ extern u_long get_sclk1(void);
extern u_long get_dclk(void);
# define get_uart_clk get_sclk0
# define get_i2c_clk get_sclk0
-# define get_spi_clk get_sclk0
+# define get_spi_clk get_sclk1
#else
# define get_uart_clk get_sclk
# define get_i2c_clk get_sclk
diff --git a/arch/blackfin/include/asm/config.h b/arch/blackfin/include/asm/config.h
index 1da386ea49..836658a1c4 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/mach-bf609/BF609_def.h b/arch/blackfin/include/asm/mach-bf609/BF609_def.h
index 02b81d3fd1..fd0d86d39e 100644
--- a/arch/blackfin/include/asm/mach-bf609/BF609_def.h
+++ b/arch/blackfin/include/asm/mach-bf609/BF609_def.h
@@ -125,6 +125,8 @@
#define WDOG1_CNT 0xFFC17804 /* WDOG1 Count Register */
#define WDOG1_STAT 0xFFC17808 /* WDOG1 Watchdog Timer Status Register */
+#define SDU0_MSG_SET 0xFFC1F084 /* SDU0 Message Set Register */
+
#define EMAC0_MACCFG 0xFFC20000 /* EMAC0 MAC Configuration Register */
#define EMAC1_MACCFG 0xFFC22000 /* EMAC1 MAC Configuration Register */
diff --git a/arch/blackfin/include/asm/u-boot.h b/arch/blackfin/include/asm/u-boot.h
index acaeee9053..7b5cf6a1b6 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 4ba7bf6949..b534a98c9c 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 87842557df..0000000000
--- 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@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 0000000000..b50f30aa45
--- /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/arch/nios2/Kconfig b/arch/nios2/Kconfig
index b70364680b..0cba45bdbe 100644
--- a/arch/nios2/Kconfig
+++ b/arch/nios2/Kconfig
@@ -11,16 +11,8 @@ choice
config TARGET_NIOS2_GENERIC
bool "Support nios2-generic"
-config TARGET_PCI5441
- bool "Support PCI5441"
-
-config TARGET_PK1C20
- bool "Support PK1C20"
-
endchoice
source "board/altera/nios2-generic/Kconfig"
-source "board/psyent/pci5441/Kconfig"
-source "board/psyent/pk1c20/Kconfig"
endmenu
diff --git a/arch/nios2/config.mk b/arch/nios2/config.mk
index 82bd887961..9b7c56dc85 100644
--- a/arch/nios2/config.mk
+++ b/arch/nios2/config.mk
@@ -17,3 +17,5 @@ PLATFORM_CPPFLAGS += -G0
LDFLAGS_FINAL += --gc-sections
PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections
+
+__HAVE_ARCH_GENERIC_BOARD := y
diff --git a/arch/nios2/cpu/Makefile b/arch/nios2/cpu/Makefile
index bdd983d3f1..3fe7847160 100644
--- a/arch/nios2/cpu/Makefile
+++ b/arch/nios2/cpu/Makefile
@@ -7,5 +7,5 @@
extra-y = start.o
obj-y = exceptions.o
-obj-y += cpu.o interrupts.o sysid.o traps.o epcs.o
+obj-y += cpu.o interrupts.o sysid.o traps.o
obj-y += fdt.o
diff --git a/arch/nios2/cpu/cpu.c b/arch/nios2/cpu/cpu.c
index e0dcbc201f..86f94b76fa 100644
--- a/arch/nios2/cpu/cpu.c
+++ b/arch/nios2/cpu/cpu.c
@@ -10,11 +10,14 @@
#include <nios2-io.h>
#include <asm/cache.h>
+DECLARE_GLOBAL_DATA_PTR;
+
#if defined (CONFIG_SYS_NIOS_SYSID_BASE)
extern void display_sysid (void);
#endif /* CONFIG_SYS_NIOS_SYSID_BASE */
-int checkcpu (void)
+#ifdef CONFIG_DISPLAY_CPUINFO
+int print_cpuinfo(void)
{
printf ("CPU : Nios-II\n");
#if !defined(CONFIG_SYS_NIOS_SYSID_BASE)
@@ -24,6 +27,7 @@ int checkcpu (void)
#endif
return (0);
}
+#endif /* CONFIG_DISPLAY_CPUINFO */
int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
@@ -47,3 +51,11 @@ void dcache_disable(void)
{
flush_dcache(CONFIG_SYS_DCACHE_SIZE, CONFIG_SYS_DCACHELINE_SIZE);
}
+
+int arch_cpu_init(void)
+{
+ gd->cpu_clk = CONFIG_SYS_CLK_FREQ;
+ gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
+
+ return 0;
+}
diff --git a/arch/nios2/cpu/epcs.c b/arch/nios2/cpu/epcs.c
deleted file mode 100644
index 9758552447..0000000000
--- a/arch/nios2/cpu/epcs.c
+++ /dev/null
@@ -1,717 +0,0 @@
-/*
- * (C) Copyright 2004, Psyent Corporation <www.psyent.com>
- * Scott McNutt <smcnutt@psyent.com>
- *
- * SPDX-License-Identifier: GPL-2.0+
- */
-
-#include <common.h>
-
-#if defined(CONFIG_SYS_NIOS_EPCSBASE)
-#include <command.h>
-#include <asm/io.h>
-#include <nios2-io.h>
-#include <nios2-epcs.h>
-
-
-/*-----------------------------------------------------------------------*/
-#define SHORT_HELP\
- "epcs - read/write Cyclone EPCS configuration device.\n"
-
-#define LONG_HELP\
- "\n"\
- "epcs erase start [end]\n"\
- " - erase sector start or sectors start through end.\n"\
- "epcs info\n"\
- " - display EPCS device information.\n"\
- "epcs protect on | off\n"\
- " - turn device protection on or off.\n"\
- "epcs read addr offset count\n"\
- " - read count bytes from offset to addr.\n"\
- "epcs write addr offset count\n"\
- " - write count bytes to offset from addr.\n"\
- "epcs verify addr offset count\n"\
- " - verify count bytes at offset from addr."
-
-
-/*-----------------------------------------------------------------------*/
-/* Operation codes for serial configuration devices
- */
-#define EPCS_WRITE_ENA 0x06 /* Write enable */
-#define EPCS_WRITE_DIS 0x04 /* Write disable */
-#define EPCS_READ_STAT 0x05 /* Read status */
-#define EPCS_READ_BYTES 0x03 /* Read bytes */
-#define EPCS_READ_ID 0xab /* Read silicon id */
-#define EPCS_WRITE_STAT 0x01 /* Write status */
-#define EPCS_WRITE_BYTES 0x02 /* Write bytes */
-#define EPCS_ERASE_BULK 0xc7 /* Erase entire device */
-#define EPCS_ERASE_SECT 0xd8 /* Erase sector */
-
-/* Device status register bits
- */
-#define EPCS_STATUS_WIP (1<<0) /* Write in progress */
-#define EPCS_STATUS_WEL (1<<1) /* Write enable latch */
-
-/* Misc
- */
-#define EPCS_TIMEOUT 100 /* 100 msec timeout */
-
-static nios_spi_t *epcs = (nios_spi_t *)CONFIG_SYS_NIOS_EPCSBASE;
-
-/***********************************************************************
- * Device access
- ***********************************************************************/
-static int epcs_cs (int assert)
-{
- ulong start;
- unsigned tmp;
-
-
- if (assert) {
- tmp = readl (&epcs->control);
- writel (tmp | NIOS_SPI_SSO, &epcs->control);
- } else {
- /* Let all bits shift out */
- start = get_timer (0);
- while ((readl (&epcs->status) & NIOS_SPI_TMT) == 0)
- if (get_timer (start) > EPCS_TIMEOUT)
- return (-1);
- tmp = readl (&epcs->control);
- writel (tmp & ~NIOS_SPI_SSO, &epcs->control);
- }
- return (0);
-}
-
-static int epcs_tx (unsigned char c)
-{
- ulong start;
-
- start = get_timer (0);
- while ((readl (&epcs->status) & NIOS_SPI_TRDY) == 0)
- if (get_timer (start) > EPCS_TIMEOUT)
- return (-1);
- writel (c, &epcs->txdata);
- return (0);
-}
-
-static int epcs_rx (void)
-{
- ulong start;
-
- start = get_timer (0);
- while ((readl (&epcs->status) & NIOS_SPI_RRDY) == 0)
- if (get_timer (start) > EPCS_TIMEOUT)
- return (-1);
- return (readl (&epcs->rxdata));
-}
-
-static unsigned char bitrev[] = {
- 0x00, 0x08, 0x04, 0x0c, 0x02, 0x0a, 0x06, 0x0e,
- 0x01, 0x09, 0x05, 0x0d, 0x03, 0x0b, 0x07, 0x0f
-};
-
-static unsigned char epcs_bitrev (unsigned char c)
-{
- unsigned char val;
-
- val = bitrev[c>>4];
- val |= bitrev[c & 0x0f]<<4;
- return (val);
-}
-
-static void epcs_rcv (unsigned char *dst, int len)
-{
- while (len--) {
- epcs_tx (0);
- *dst++ = epcs_rx ();
- }
-}
-
-static void epcs_rrcv (unsigned char *dst, int len)
-{
- while (len--) {
- epcs_tx (0);
- *dst++ = epcs_bitrev (epcs_rx ());
- }
-}
-
-static void epcs_snd (unsigned char *src, int len)
-{
- while (len--) {
- epcs_tx (*src++);
- epcs_rx ();
- }
-}
-
-static void epcs_rsnd (unsigned char *src, int len)
-{
- while (len--) {
- epcs_tx (epcs_bitrev (*src++));
- epcs_rx ();
- }
-}
-
-static void epcs_wr_enable (void)
-{
- epcs_cs (1);
- epcs_tx (EPCS_WRITE_ENA);
- epcs_rx ();
- epcs_cs (0);
-}
-
-static unsigned char epcs_status_rd (void)
-{
- unsigned char status;
-
- epcs_cs (1);
- epcs_tx (EPCS_READ_STAT);
- epcs_rx ();
- epcs_tx (0);
- status = epcs_rx ();
- epcs_cs (0);
- return (status);
-}
-
-static void epcs_status_wr (unsigned char status)
-{
- epcs_wr_enable ();
- epcs_cs (1);
- epcs_tx (EPCS_WRITE_STAT);
- epcs_rx ();
- epcs_tx (status);
- epcs_rx ();
- epcs_cs (0);
- return;
-}
-
-/***********************************************************************
- * Device information
- ***********************************************************************/
-
-static struct epcs_devinfo_t devinfo[] = {
- { "EPCS1 ", 0x10, 17, 4, 15, 8, 0x0c },
- { "EPCS4 ", 0x12, 19, 8, 16, 8, 0x1c },
- { "EPCS16", 0x14, 21, 32, 16, 8, 0x1c },
- { "EPCS64", 0x16, 23,128, 16, 8, 0x1c },
- { 0, 0, 0, 0, 0, 0 }
-};
-
-int epcs_reset (void)
-{
- /* When booting from an epcs controller, the epcs bootrom
- * code may leave the slave select in an asserted state.
- * This causes two problems: (1) The initial epcs access
- * will fail -- not a big deal, and (2) a software reset
- * will cause the bootrom code to hang since it does not
- * ensure the select is negated prior to first access -- a
- * big deal. Here we just negate chip select and everything
- * gets better :-)
- */
- epcs_cs (0); /* Negate chip select */
- return (0);
-}
-
-epcs_devinfo_t *epcs_dev_find (void)
-{
- unsigned char buf[4];
- unsigned char id;
- int i;
- struct epcs_devinfo_t *dev = NULL;
-
- /* Read silicon id requires 3 "dummy bytes" before it's put
- * on the wire.
- */
- buf[0] = EPCS_READ_ID;
- buf[1] = 0;
- buf[2] = 0;
- buf[3] = 0;
-
- epcs_cs (1);
- epcs_snd (buf,4);
- epcs_rcv (buf,1);
- if (epcs_cs (0) == -1)
- return (NULL);
- id = buf[0];
-
- /* Find the info struct */
- i = 0;
- while (devinfo[i].name) {
- if (id == devinfo[i].id) {
- dev = &devinfo[i];
- break;
- }
- i++;
- }
-
- return (dev);
-}
-
-/***********************************************************************
- * Misc Utilities
- ***********************************************************************/
-int epcs_cfgsz (void)
-{
- int sz = 0;
- unsigned char buf[128];
- unsigned char *p;
- struct epcs_devinfo_t *dev = epcs_dev_find ();
-
- if (!dev)
- return (-1);
-
- /* Read in the first 128 bytes of the device */
- buf[0] = EPCS_READ_BYTES;
- buf[1] = 0;
- buf[2] = 0;
- buf[3] = 0;
-
- epcs_cs (1);
- epcs_snd (buf,4);
- epcs_rrcv (buf, sizeof(buf));
- epcs_cs (0);
-
- /* Search for the starting 0x6a which is followed by the
- * 4-byte 'register' and 4-byte bit-count.
- */
- p = buf;
- while (p < buf + sizeof(buf)-8) {
- if ( *p == 0x6a ) {
- /* Point to bit count and extract */
- p += 5;
- sz = *p++;
- sz |= *p++ << 8;
- sz |= *p++ << 16;
- sz |= *p++ << 24;
- /* Convert to byte count */
- sz += 7;
- sz >>= 3;
- } else if (*p == 0xff) {
- /* 0xff is ok ... just skip */
- p++;
- continue;
- } else {
- /* Not 0xff or 0x6a ... something's not
- * right ... report 'unknown' (sz=0).
- */
- break;
- }
- }
- return (sz);
-}
-
-int epcs_erase (unsigned start, unsigned end)
-{
- unsigned off, sectsz;
- unsigned char buf[4];
- struct epcs_devinfo_t *dev = epcs_dev_find ();
-
- if (!dev || (start>end))
- return (-1);
-
- /* Erase the requested sectors. An address is required
- * that lies within the requested sector -- we'll just
- * use the first address in the sector.
- */
- printf ("epcs erasing sector %d ", start);
- if (start != end)
- printf ("to %d ", end);
- sectsz = (1 << dev->sz_sect);
- while (start <= end) {
- off = start * sectsz;
- start++;
-
- buf[0] = EPCS_ERASE_SECT;
- buf[1] = off >> 16;
- buf[2] = off >> 8;
- buf[3] = off;
-
- epcs_wr_enable ();
- epcs_cs (1);
- epcs_snd (buf,4);
- epcs_cs (0);
-
- printf ("."); /* Some user feedback */
-
- /* Wait for erase to complete */
- while (epcs_status_rd() & EPCS_STATUS_WIP)
- ;
- }
- printf (" done.\n");
- return (0);
-}
-
-int epcs_read (ulong addr, ulong off, ulong cnt)
-{
- unsigned char buf[4];
- struct epcs_devinfo_t *dev = epcs_dev_find ();
-
- if (!dev)
- return (-1);
-
- buf[0] = EPCS_READ_BYTES;
- buf[1] = off >> 16;
- buf[2] = off >> 8;
- buf[3] = off;
-
- epcs_cs (1);
- epcs_snd (buf,4);
- epcs_rrcv ((unsigned char *)addr, cnt);
- epcs_cs (0);
-
- return (0);
-}
-
-int epcs_write (ulong addr, ulong off, ulong cnt)
-{
- ulong wrcnt;
- unsigned pgsz;
- unsigned char buf[4];
- struct epcs_devinfo_t *dev = epcs_dev_find ();
-
- if (!dev)
- return (-1);
-
- pgsz = (1<<dev->sz_page);
- while (cnt) {
- if (off % pgsz)
- wrcnt = pgsz - (off % pgsz);
- else
- wrcnt = pgsz;
- wrcnt = (wrcnt > cnt) ? cnt : wrcnt;
-
- buf[0] = EPCS_WRITE_BYTES;
- buf[1] = off >> 16;
- buf[2] = off >> 8;
- buf[3] = off;
-
- epcs_wr_enable ();
- epcs_cs (1);
- epcs_snd (buf,4);
- epcs_rsnd ((unsigned char *)addr, wrcnt);
- epcs_cs (0);
-
- /* Wait for write to complete */
- while (epcs_status_rd() & EPCS_STATUS_WIP)
- ;
-
- cnt -= wrcnt;
- off += wrcnt;
- addr += wrcnt;
- }
-
- return (0);
-}
-
-int epcs_verify (ulong addr, ulong off, ulong cnt, ulong *err)
-{
- ulong rdcnt;
- unsigned char buf[256];
- unsigned char *start,*end;
- int i;
-
- start = end = (unsigned char *)addr;
- while (cnt) {
- rdcnt = (cnt>sizeof(buf)) ? sizeof(buf) : cnt;
- epcs_read ((ulong)buf, off, rdcnt);
- for (i=0; i<rdcnt; i++) {
- if (*end != buf[i]) {
- *err = end - start;
- return(-1);
- }
- end++;
- }
- cnt -= rdcnt;
- off += rdcnt;
- }
- return (0);
-}
-
-static int epcs_sect_erased (int sect, unsigned *offset,
- struct epcs_devinfo_t *dev)
-{
- unsigned char buf[128];
- unsigned off, end;
- unsigned sectsz;
- int i;
-
- sectsz = (1 << dev->sz_sect);
- off = sectsz * sect;
- end = off + sectsz;
-
- while (off < end) {
- epcs_read ((ulong)buf, off, sizeof(buf));
- for (i=0; i < sizeof(buf); i++) {
- if (buf[i] != 0xff) {
- *offset = off + i;
- return (0);
- }
- }
- off += sizeof(buf);
- }
- return (1);
-}
-
-
-/***********************************************************************
- * Commands
- ***********************************************************************/
-static
-void do_epcs_info (struct epcs_devinfo_t *dev, int argc, char * const argv[])
-{
- int i;
- unsigned char stat;
- unsigned tmp;
- int erased;
-
- /* Basic device info */
- printf ("%s: %d kbytes (%d sectors x %d kbytes,"
- " %d bytes/page)\n",
- dev->name, 1 << (dev->size-10),
- dev->num_sects, 1 << (dev->sz_sect-10),
- 1 << dev->sz_page );
-
- /* Status -- for now protection is all-or-nothing */
- stat = epcs_status_rd();
- printf ("status: 0x%02x (WIP:%d, WEL:%d, PROT:%s)\n",
- stat,
- (stat & EPCS_STATUS_WIP) ? 1 : 0,
- (stat & EPCS_STATUS_WEL) ? 1 : 0,
- (stat & dev->prot_mask) ? "on" : "off" );
-
- /* Configuration */
- tmp = epcs_cfgsz ();
- if (tmp) {
- printf ("config: 0x%06x (%d) bytes\n", tmp, tmp );
- } else {
- printf ("config: unknown\n" );
- }
-
- /* Sector info */
- for (i=0; (i < dev->num_sects) && (argc > 1); i++) {
- erased = epcs_sect_erased (i, &tmp, dev);
- if ((i & 0x03) == 0) printf ("\n");
- printf ("%4d: %07x ",
- i, i*(1<<dev->sz_sect) );
- if (erased)
- printf ("E ");
- else
- printf (" ");
- }
- printf ("\n");
-
- return;
-}
-
-static
-void do_epcs_erase (struct epcs_devinfo_t *dev, int argc, char * const argv[])
-{
- unsigned start,end;
-
- if ((argc < 3) || (argc > 4)) {
- printf ("USAGE: epcs erase sect [end]\n");
- return;
- }
- if ((epcs_status_rd() & dev->prot_mask) != 0) {
- printf ( "epcs: device protected.\n");
- return;
- }
-
- start = simple_strtoul (argv[2], NULL, 10);
- if (argc > 3)
- end = simple_strtoul (argv[3], NULL, 10);
- else
- end = start;
- if ((start >= dev->num_sects) || (start > end)) {
- printf ("epcs: invalid sector range: [%d:%d]\n",
- start, end );
- return;
- }
-
- epcs_erase (start, end);
-
- return;
-}
-
-static
-void do_epcs_protect (struct epcs_devinfo_t *dev, int argc, char * const argv[])
-{
- unsigned char stat;
-
- /* For now protection is all-or-nothing to keep things
- * simple. The protection bits don't map in a linear
- * fashion ... and we would rather protect the bottom
- * of the device since it contains the config data and
- * leave the top unprotected for app use. But unfortunately
- * protection works from top-to-bottom so it does
- * really help very much from a software app point-of-view.
- */
- if (argc < 3) {
- printf ("USAGE: epcs protect on | off\n");
- return;
- }
- if (!dev)
- return;
-
- /* Protection on/off is just a matter of setting/clearing
- * all protection bits in the status register.
- */
- stat = epcs_status_rd ();
- if (strcmp ("on", argv[2]) == 0) {
- stat |= dev->prot_mask;
- } else if (strcmp ("off", argv[2]) == 0 ) {
- stat &= ~dev->prot_mask;
- } else {
- printf ("epcs: unknown protection: %s\n", argv[2]);
- return;
- }
- epcs_status_wr (stat);
- return;
-}
-
-static
-void do_epcs_read (struct epcs_devinfo_t *dev, int argc, char * const argv[])
-{
- ulong addr,off,cnt;
- ulong sz;
-
- if (argc < 5) {
- printf ("USAGE: epcs read addr offset count\n");
- return;
- }
-
- sz = 1 << dev->size;
- addr = simple_strtoul (argv[2], NULL, 16);
- off = simple_strtoul (argv[3], NULL, 16);
- cnt = simple_strtoul (argv[4], NULL, 16);
- if (off > sz) {
- printf ("offset is greater than device size"
- "... aborting.\n");
- return;
- }
- if ((off + cnt) > sz) {
- printf ("request exceeds device size"
- "... truncating.\n");
- cnt = sz - off;
- }
- printf ("epcs: read %08lx <- %06lx (0x%lx bytes)\n",
- addr, off, cnt);
- epcs_read (addr, off, cnt);
-
- return;
-}
-
-static
-void do_epcs_write (struct epcs_devinfo_t *dev, int argc, char * const argv[])
-{
- ulong addr,off,cnt;
- ulong sz;
- ulong err;
-
- if (argc < 5) {
- printf ("USAGE: epcs write addr offset count\n");
- return;
- }
- if ((epcs_status_rd() & dev->prot_mask) != 0) {
- printf ( "epcs: device protected.\n");
- return;
- }
-
- sz = 1 << dev->size;
- addr = simple_strtoul (argv[2], NULL, 16);
- off = simple_strtoul (argv[3], NULL, 16);
- cnt = simple_strtoul (argv[4], NULL, 16);
- if (off > sz) {
- printf ("offset is greater than device size"
- "... aborting.\n");
- return;
- }
- if ((off + cnt) > sz) {
- printf ("request exceeds device size"
- "... truncating.\n");
- cnt = sz - off;
- }
- printf ("epcs: write %08lx -> %06lx (0x%lx bytes)\n",
- addr, off, cnt);
- epcs_write (addr, off, cnt);
- if (epcs_verify (addr, off, cnt, &err) != 0)
- printf ("epcs: write error at offset %06lx\n", err);
-
- return;
-}
-
-static
-void do_epcs_verify (struct epcs_devinfo_t *dev, int argc, char * const argv[])
-{
- ulong addr,off,cnt;
- ulong sz;
- ulong err;
-
- if (argc < 5) {
- printf ("USAGE: epcs verify addr offset count\n");
- return;
- }
-
- sz = 1 << dev->size;
- addr = simple_strtoul (argv[2], NULL, 16);
- off = simple_strtoul (argv[3], NULL, 16);
- cnt = simple_strtoul (argv[4], NULL, 16);
- if (off > sz) {
- printf ("offset is greater than device size"
- "... aborting.\n");
- return;
- }
- if ((off + cnt) > sz) {
- printf ("request exceeds device size"
- "... truncating.\n");
- cnt = sz - off;
- }
- printf ("epcs: verify %08lx -> %06lx (0x%lx bytes)\n",
- addr, off, cnt);
- if (epcs_verify (addr, off, cnt, &err) != 0)
- printf ("epcs: verify error at offset %06lx\n", err);
-
- return;
-}
-
-/*-----------------------------------------------------------------------*/
-int do_epcs (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
- int len;
- struct epcs_devinfo_t *dev = epcs_dev_find ();
-
- if (!dev) {
- printf ("epcs: device not found.\n");
- return (-1);
- }
-
- if (argc < 2) {
- do_epcs_info (dev, argc, argv);
- return (0);
- }
-
- len = strlen (argv[1]);
- if (strncmp ("info", argv[1], len) == 0) {
- do_epcs_info (dev, argc, argv);
- } else if (strncmp ("erase", argv[1], len) == 0) {
- do_epcs_erase (dev, argc, argv);
- } else if (strncmp ("protect", argv[1], len) == 0) {
- do_epcs_protect (dev, argc, argv);
- } else if (strncmp ("read", argv[1], len) == 0) {
- do_epcs_read (dev, argc, argv);
- } else if (strncmp ("write", argv[1], len) == 0) {
- do_epcs_write (dev, argc, argv);
- } else if (strncmp ("verify", argv[1], len) == 0) {
- do_epcs_verify (dev, argc, argv);
- } else {
- printf ("epcs: unknown operation: %s\n", argv[1]);
- }
-
- return (0);
-}
-
-/*-----------------------------------------------------------------------*/
-
-
-U_BOOT_CMD( epcs, 5, 0, do_epcs, SHORT_HELP, LONG_HELP );
-
-#endif /* CONFIG_NIOS_EPCS */
diff --git a/arch/nios2/cpu/start.S b/arch/nios2/cpu/start.S
index 7ce0d34d7f..6af9b4e943 100644
--- a/arch/nios2/cpu/start.S
+++ b/arch/nios2/cpu/start.S
@@ -134,11 +134,12 @@ _reloc:
mov fp, sp
/*
- * Call board_init -- never returns
+ * Call board_init_f -- never returns
*/
- movhi r4, %hi(board_init@h)
- ori r4, r4, %lo(board_init@h)
- callr r4
+ mov r4, r0
+ movhi r2, %hi(board_init_f@h)
+ ori r2, r2, %lo(board_init_f@h)
+ callr r2
/* NEVER RETURNS -- but branch to the _start just
* in case ;-)
@@ -146,6 +147,31 @@ _reloc:
br _start
+
+/*
+ * relocate_code -- Nios2 handles the relocation above. But
+ * the generic board code monkeys with the heap, stack, etc.
+ * (it makes some assumptions that may not be appropriate
+ * for Nios). Nevertheless, we capitulate here.
+ *
+ * We'll call the board_init_r from here since this isn't
+ * supposed to return.
+ *
+ * void relocate_code (ulong sp, gd_t *global_data,
+ * ulong reloc_addr)
+ * __attribute__ ((noreturn));
+ */
+ .text
+ .global relocate_code
+
+relocate_code:
+ mov sp, r4 /* Set the new sp */
+ mov r4, r5
+ movhi r8, %hi(board_init_r@h)
+ ori r8, r8, %lo(board_init_r@h)
+ callr r8
+ ret
+
/*
* dly_clks -- Nios2 (like Nios1) doesn't have a timebase in
* the core. For simple delay loops, we do our best by counting
diff --git a/arch/nios2/include/asm/config.h b/arch/nios2/include/asm/config.h
index cd29734789..476a32bdc6 100644
--- a/arch/nios2/include/asm/config.h
+++ b/arch/nios2/include/asm/config.h
@@ -7,4 +7,7 @@
#ifndef _ASM_CONFIG_H_
#define _ASM_CONFIG_H_
+#define CONFIG_SYS_GENERIC_BOARD
+#define CONFIG_SYS_GENERIC_GLOBAL_DATA
+
#endif
diff --git a/arch/nios2/include/asm/posix_types.h b/arch/nios2/include/asm/posix_types.h
index 673364099a..6b6c39bcc0 100644
--- a/arch/nios2/include/asm/posix_types.h
+++ b/arch/nios2/include/asm/posix_types.h
@@ -16,7 +16,11 @@ typedef int __kernel_pid_t;
typedef unsigned short __kernel_ipc_pid_t;
typedef unsigned short __kernel_uid_t;
typedef unsigned short __kernel_gid_t;
+#ifdef __GNUC__
+typedef __SIZE_TYPE__ __kernel_size_t;
+#else
typedef unsigned long __kernel_size_t;
+#endif
typedef long __kernel_ssize_t;
typedef int __kernel_ptrdiff_t;
typedef long __kernel_time_t;
diff --git a/arch/nios2/include/asm/u-boot.h b/arch/nios2/include/asm/u-boot.h
index 51f6c30ef7..cb02e98a82 100644
--- a/arch/nios2/include/asm/u-boot.h
+++ b/arch/nios2/include/asm/u-boot.h
@@ -15,15 +15,7 @@
#ifndef __ASM_NIOS2_U_BOOT_H_
#define __ASM_NIOS2_U_BOOT_H_
-typedef struct bd_info {
- unsigned long bi_memstart; /* start of DRAM memory */
- phys_size_t bi_memsize; /* size of DRAM memory in bytes */
- unsigned long bi_flashstart; /* start of FLASH memory */
- unsigned long bi_flashsize; /* size of FLASH memory */
- unsigned long bi_flashoffset; /* reserved area for startup monitor */
- unsigned long bi_sramstart; /* start of SRAM memory */
- unsigned long bi_sramsize; /* size of SRAM memory */
-} bd_t;
+#include <asm-generic/u-boot.h>
/* For image.h:image_check_target_arch() */
#define IH_ARCH_DEFAULT IH_ARCH_NIOS2
diff --git a/arch/nios2/lib/Makefile b/arch/nios2/lib/Makefile
index 7cb25c0ee1..079378a905 100644
--- a/arch/nios2/lib/Makefile
+++ b/arch/nios2/lib/Makefile
@@ -6,7 +6,6 @@
#
obj-y += cache.o
-obj-y += board.o
obj-$(CONFIG_CMD_BOOTM) += bootm.o
obj-y += libgcc.o
obj-y += time.o
diff --git a/arch/nios2/lib/board.c b/arch/nios2/lib/board.c
deleted file mode 100644
index f24218ff1c..0000000000
--- a/arch/nios2/lib/board.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * (C) Copyright 2003, Psyent Corporation <www.psyent.com>
- * Scott McNutt <smcnutt@psyent.com>
- *
- * (C) Copyright 2000-2002
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * SPDX-License-Identifier: GPL-2.0+
- */
-
-#include <common.h>
-#include <stdio_dev.h>
-#include <watchdog.h>
-#include <malloc.h>
-#include <mmc.h>
-#include <net.h>
-#ifdef CONFIG_STATUS_LED
-#include <status_led.h>
-#endif
-#if defined(CONFIG_SYS_NIOS_EPCSBASE)
-#include <nios2-epcs.h>
-#endif
-#ifdef CONFIG_CMD_NAND
-#include <nand.h> /* cannot even include nand.h if it isnt configured */
-#endif
-
-DECLARE_GLOBAL_DATA_PTR;
-
-/*
- * 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".
- */
-
-
-typedef int (init_fnc_t) (void);
-
-
-/************************************************************************
- * Initialization sequence *
- ***********************************************************************/
-
-init_fnc_t *init_sequence[] = {
-#if defined(CONFIG_BOARD_EARLY_INIT_F)
- board_early_init_f, /* Call board-specific init code early.*/
-#endif
-#if defined(CONFIG_SYS_NIOS_EPCSBASE)
- epcs_reset,
-#endif
-
- env_init,
- serial_init,
- console_init_f,
- display_options,
- checkcpu,
- checkboard,
- NULL, /* Terminate this list */
-};
-
-
-/***********************************************************************/
-void board_init(void)
-{
- bd_t *bd;
- init_fnc_t **init_fnc_ptr;
- static gd_t gd_data;
- static bd_t bd_data;
-
- /* Pointer is writable since we allocated a register for it. */
- gd = &gd_data;
- /* compiler optimization barrier needed for GCC >= 3.4 */
- __asm__ __volatile__("" : : : "memory");
-
- gd->bd = &bd_data;
- gd->baudrate = CONFIG_BAUDRATE;
- gd->cpu_clk = CONFIG_SYS_CLK_FREQ;
-
- bd = gd->bd;
- bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
- bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
-#ifndef CONFIG_SYS_NO_FLASH
- bd->bi_flashstart = CONFIG_SYS_FLASH_BASE;
-#endif
-#if defined(CONFIG_SYS_SRAM_BASE) && defined(CONFIG_SYS_SRAM_SIZE)
- bd->bi_sramstart = CONFIG_SYS_SRAM_BASE;
- bd->bi_sramsize = CONFIG_SYS_SRAM_SIZE;
-#endif
-
- for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
- WATCHDOG_RESET();
- if ((*init_fnc_ptr) () != 0)
- hang();
- }
-
- WATCHDOG_RESET();
-
- /* The Malloc area is immediately below the monitor copy in RAM */
- mem_malloc_init(CONFIG_SYS_MALLOC_BASE, CONFIG_SYS_MALLOC_LEN);
-
-#ifndef CONFIG_SYS_NO_FLASH
- WATCHDOG_RESET();
- bd->bi_flashsize = flash_init();
-#endif
-
-#ifdef CONFIG_CMD_NAND
- puts("NAND: ");
- nand_init();
-#endif
-
-#ifdef CONFIG_GENERIC_MMC
- puts("MMC: ");
- mmc_initialize(bd);
-#endif
-
- WATCHDOG_RESET();
- env_relocate();
-
- WATCHDOG_RESET();
- stdio_init();
- jumptable_init();
- console_init_r();
-
- WATCHDOG_RESET();
- interrupt_init();
-
-#if defined(CONFIG_BOARD_LATE_INIT)
- board_late_init();
-#endif
-
-#if defined(CONFIG_CMD_NET)
- puts("Net: ");
- eth_initialize(bd);
-#endif
-
- /* main_loop */
- for (;;) {
- WATCHDOG_RESET();
- main_loop();
- }
-}
diff --git a/arch/powerpc/cpu/mpc85xx/cpu_init.c b/arch/powerpc/cpu/mpc85xx/cpu_init.c
index b237505d3e..5bfab70b7e 100644
--- a/arch/powerpc/cpu/mpc85xx/cpu_init.c
+++ b/arch/powerpc/cpu/mpc85xx/cpu_init.c
@@ -254,12 +254,36 @@ static void enable_tdm_law(void)
void enable_cpc(void)
{
int i;
+ int ret;
u32 size = 0;
-
+ u32 cpccfg0;
+ char buffer[HWCONFIG_BUFFER_SIZE];
+ char cpc_subarg[16];
+ bool have_hwconfig = false;
+ int cpc_args = 0;
cpc_corenet_t *cpc = (cpc_corenet_t *)CONFIG_SYS_FSL_CPC_ADDR;
+ /* Extract hwconfig from environment */
+ ret = getenv_f("hwconfig", buffer, sizeof(buffer));
+ if (ret > 0) {
+ /*
+ * If "en_cpc" is not defined in hwconfig then by default all
+ * cpcs are enable. If this config is defined then individual
+ * cpcs which have to be enabled should also be defined.
+ * e.g en_cpc:cpc1,cpc2;
+ */
+ if (hwconfig_f("en_cpc", buffer))
+ have_hwconfig = true;
+ }
+
for (i = 0; i < CONFIG_SYS_NUM_CPC; i++, cpc++) {
- u32 cpccfg0 = in_be32(&cpc->cpccfg0);
+ if (have_hwconfig) {
+ sprintf(cpc_subarg, "cpc%u", i + 1);
+ cpc_args = hwconfig_sub_f("en_cpc", cpc_subarg, buffer);
+ if (cpc_args == 0)
+ continue;
+ }
+ cpccfg0 = in_be32(&cpc->cpccfg0);
size += CPC_CFG0_SZ_K(cpccfg0);
#ifdef CONFIG_SYS_FSL_ERRATUM_CPC_A002
diff --git a/arch/powerpc/cpu/mpc85xx/fdt.c b/arch/powerpc/cpu/mpc85xx/fdt.c
index 3665ec6b6c..3222e26a5a 100644
--- a/arch/powerpc/cpu/mpc85xx/fdt.c
+++ b/arch/powerpc/cpu/mpc85xx/fdt.c
@@ -134,6 +134,21 @@ void ft_fixup_cpu(void *blob, u64 memory_limit)
printf("Failed to reserve memory for spin table: %s\n",
fdt_strerror(off));
}
+#ifdef CONFIG_DEEP_SLEEP
+#ifdef CONFIG_SPL_MMC_BOOT
+ off = fdt_add_mem_rsv(blob, CONFIG_SYS_MMC_U_BOOT_START,
+ CONFIG_SYS_MMC_U_BOOT_SIZE);
+ if (off < 0)
+ printf("Failed to reserve memory for SD deep sleep: %s\n",
+ fdt_strerror(off));
+#elif defined(CONFIG_SPL_SPI_BOOT)
+ off = fdt_add_mem_rsv(blob, CONFIG_SYS_SPI_FLASH_U_BOOT_START,
+ CONFIG_SYS_SPI_FLASH_U_BOOT_SIZE);
+ if (off < 0)
+ printf("Failed to reserve memory for SPI deep sleep: %s\n",
+ fdt_strerror(off));
+#endif
+#endif
}
#endif
diff --git a/arch/powerpc/cpu/mpc8xx/Kconfig b/arch/powerpc/cpu/mpc8xx/Kconfig
index 35608a68b0..2c39244fa7 100644
--- a/arch/powerpc/cpu/mpc8xx/Kconfig
+++ b/arch/powerpc/cpu/mpc8xx/Kconfig
@@ -14,12 +14,6 @@ config TARGET_COGENT_MPC8XX
config TARGET_ESTEEM192E
bool "Support ESTEEM192E"
-config TARGET_FLAGADM
- bool "Support FLAGADM"
-
-config TARGET_GEN860T
- bool "Support GEN860T"
-
config TARGET_HERMES
bool "Support hermes"
@@ -47,15 +41,9 @@ config TARGET_R360MPI
config TARGET_RRVISION
bool "Support RRvision"
-config TARGET_SXNI855T
- bool "Support SXNI855T"
-
config TARGET_SPD823TS
bool "Support SPD823TS"
-config TARGET_SVM_SC8XX
- bool "Support svm_sc8xx"
-
config TARGET_MHPC
bool "Support MHPC"
@@ -74,9 +62,6 @@ config TARGET_ELPT860
config TARGET_UC100
bool "Support uc100"
-config TARGET_STXXTC
- bool "Support stxxtc"
-
config TARGET_FPS850L
bool "Support FPS850L"
@@ -139,8 +124,6 @@ source "board/cogent/Kconfig"
source "board/eltec/mhpc/Kconfig"
source "board/emk/top860/Kconfig"
source "board/esteem192e/Kconfig"
-source "board/flagadm/Kconfig"
-source "board/gen860t/Kconfig"
source "board/hermes/Kconfig"
source "board/icu862/Kconfig"
source "board/ip860/Kconfig"
@@ -151,10 +134,7 @@ source "board/lwmon/Kconfig"
source "board/manroland/uc100/Kconfig"
source "board/netvia/Kconfig"
source "board/r360mpi/Kconfig"
-source "board/sixnet/Kconfig"
source "board/spd8xx/Kconfig"
-source "board/stx/stxxtc/Kconfig"
-source "board/svm_sc8xx/Kconfig"
source "board/tqc/tqm8xx/Kconfig"
endmenu
diff --git a/arch/powerpc/cpu/mpc8xx/cpu_init.c b/arch/powerpc/cpu/mpc8xx/cpu_init.c
index e51fec7260..90c7e61d83 100644
--- a/arch/powerpc/cpu/mpc8xx/cpu_init.c
+++ b/arch/powerpc/cpu/mpc8xx/cpu_init.c
@@ -44,11 +44,7 @@ void cpu_init_f (volatile immap_t * immr)
#endif /* CONFIG_WATCHDOG */
/* SIUMCR - contains debug pin configuration (11-6) */
-#ifndef CONFIG_SVM_SC8xx
immr->im_siu_conf.sc_siumcr |= CONFIG_SYS_SIUMCR;
-#else
- immr->im_siu_conf.sc_siumcr = CONFIG_SYS_SIUMCR;
-#endif
/* initialize timebase status and control register (11-26) */
/* unlock TBSCRK */
diff --git a/arch/powerpc/lib/board.c b/arch/powerpc/lib/board.c
index 02962054f6..6eaab88243 100644
--- a/arch/powerpc/lib/board.c
+++ b/arch/powerpc/lib/board.c
@@ -366,6 +366,8 @@ void board_init_f(ulong bootflag)
memset((void *) gd, 0, sizeof(gd_t));
#endif
+ gd->flags = bootflag;
+
for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr)
if ((*init_fnc_ptr) () != 0)
hang();