summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/ppc/Makefile2
-rw-r--r--arch/ppc/lib/board.c48
-rw-r--r--common/misc.c2
-rw-r--r--cpu/mpc5xxx/cpu.c1
-rw-r--r--cpu/mpc5xxx/i2c.c3
-rw-r--r--cpu/mpc5xxx/start.S10
-rw-r--r--include/common.h5
-rw-r--r--include/debug_ll.h14
-rw-r--r--include/i2c.h1
-rw-r--r--lib_generic/global.c16
-rw-r--r--lib_generic/misc.c12
11 files changed, 49 insertions, 65 deletions
diff --git a/arch/ppc/Makefile b/arch/ppc/Makefile
index 68d85314a3..0a3130e480 100644
--- a/arch/ppc/Makefile
+++ b/arch/ppc/Makefile
@@ -10,7 +10,7 @@ cpu-$(CONFIG_MPC5200) := mpc5xxx
TEXT_BASE = $(CONFIG_TEXT_BASE)
CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE) -P
-CFLAGS := -fno-common -Os
+CFLAGS := -fno-common -Os -mrelocatable
LDFLAGS_vmlinux :=-L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc -Ttext $(TEXT_BASE)
ifeq ($(incdir-y),)
diff --git a/arch/ppc/lib/board.c b/arch/ppc/lib/board.c
index 41e564d38c..2b6cd27af7 100644
--- a/arch/ppc/lib/board.c
+++ b/arch/ppc/lib/board.c
@@ -122,8 +122,10 @@ int ppc_mem_alloc_init(void)
{
ulong dest_addr = CFG_MONITOR_BASE + gd->reloc_off;
- mem_alloc_init(dest_addr - TOTAL_MALLOC_LEN,
+ mem_malloc_init(dest_addr - TOTAL_MALLOC_LEN,
dest_addr);
+
+ return 0;
}
core_initcall(ppc_mem_alloc_init);
@@ -344,28 +346,23 @@ PUTC(':');
void board_init_r (gd_t *id, ulong dest_addr)
{
cmd_tbl_t *cmdtp;
- char *s, *e;
bd_t *bd;
+ initcall_t *initcall;
+ extern initcall_t __u_boot_initcalls_start[], __u_boot_initcalls_end[];
int i;
extern void malloc_bin_reloc (void);
PUTC('B');
-while(1);
gd = id; /* initialize RAM version of global data */
bd = gd->bd;
gd->flags |= GD_FLG_RELOC; /* tell others: relocation done */
- gd->reloc_off = dest_addr - CFG_MONITOR_BASE;
-
- debug ("Now running in RAM - U-Boot at: %08lx\n", dest_addr);
-
- WATCHDOG_RESET ();
-
-#if defined(CONFIG_BOARD_EARLY_INIT_R)
- board_early_init_r ();
-#endif
+ gd->reloc_off = dest_addr;
+PUTC('\n');
+PUTHEX_LL(dest_addr);
- monitor_flash_len = (ulong)&__init_end - dest_addr;
+ for (initcall = __u_boot_initcalls_start; initcall < __u_boot_initcalls_end; initcall++)
+ *initcall += gd->reloc_off;
/*
* We have to relocate the command table manually
@@ -391,8 +388,6 @@ while(1);
#endif
}
- WATCHDOG_RESET ();
-
asm ("sync ; isync");
/*
@@ -400,17 +395,11 @@ while(1);
*/
trap_init (dest_addr);
- WATCHDOG_RESET ();
-
/* initialize higher level parts of CPU like time base and timers */
cpu_init_r ();
- WATCHDOG_RESET ();
-
malloc_bin_reloc ();
- WATCHDOG_RESET ();
-
/*
* Enable Interrupts
*/
@@ -422,20 +411,5 @@ while(1);
/* Initialization complete - start the monitor */
- /* main_loop() can return to retry autoboot, if so just run it again. */
- for (;;) {
- WATCHDOG_RESET ();
- main_loop ();
- }
-
- /* NOTREACHED - no way out of command loop except booting */
-}
-
-void hang (void)
-{
- puts ("### ERROR ### Please RESET the board ###\n");
-#ifdef CONFIG_SHOW_BOOT_PROGRESS
- show_boot_progress(-30);
-#endif
- for (;;);
+ start_uboot();
}
diff --git a/common/misc.c b/common/misc.c
index b3c47ef62d..8133e687b0 100644
--- a/common/misc.c
+++ b/common/misc.c
@@ -1,4 +1,4 @@
-
+#include <common.h>
#include <mem_malloc.h>
/*
diff --git a/cpu/mpc5xxx/cpu.c b/cpu/mpc5xxx/cpu.c
index d7e5903752..a19eed54c8 100644
--- a/cpu/mpc5xxx/cpu.c
+++ b/cpu/mpc5xxx/cpu.c
@@ -138,6 +138,7 @@ static int mpc5xxx_bd_init(void)
bd->bi_mbar_base = CFG_MBAR; /* base of internal registers */
bd->bi_ipbfreq = gd->ipb_clk;
bd->bi_pcifreq = gd->pci_clk;
+ return 0;
}
bd_initcall(mpc5xxx_bd_init);
diff --git a/cpu/mpc5xxx/i2c.c b/cpu/mpc5xxx/i2c.c
index 7a8f8ed79a..b6c9a3e5dc 100644
--- a/cpu/mpc5xxx/i2c.c
+++ b/cpu/mpc5xxx/i2c.c
@@ -211,7 +211,8 @@ int i2c_init(void)
struct mpc5xxx_i2c *regs = (struct mpc5xxx_i2c *)I2C_BASE;
mpc_reg_out(&regs->mcr, 0, 0);
- mpc_reg_out(&regs->madr, saddr << 1, 0);
+#warning mpc5xxx i2c is broken
+// mpc_reg_out(&regs->madr, saddr << 1, 0);
/* Set clock
*/
diff --git a/cpu/mpc5xxx/start.S b/cpu/mpc5xxx/start.S
index a81ebabe02..c48ecb80f8 100644
--- a/cpu/mpc5xxx/start.S
+++ b/cpu/mpc5xxx/start.S
@@ -72,16 +72,6 @@
END_GOT
/*
- * Version string
- */
- .data
- .globl version_string
-version_string:
- .ascii U_BOOT_VERSION
- .ascii " (", __DATE__, " - ", __TIME__, ")"
- .ascii CONFIG_IDENT_STRING, "\0"
-
-/*
* Exception vectors
*/
.text
diff --git a/include/common.h b/include/common.h
index 7030c76483..41c1c18ee3 100644
--- a/include/common.h
+++ b/include/common.h
@@ -368,7 +368,7 @@ void icache_disable(void);
int dcache_status (void);
void dcache_enable (void);
void dcache_disable(void);
-//void relocate_code (ulong, gd_t *, ulong);
+void relocate_code (ulong, gd_t *, ulong);
ulong get_endaddr (void);
void trap_init (ulong);
#if defined (CONFIG_4xx) || \
@@ -549,7 +549,6 @@ void wait_ticks (unsigned long);
int udelay (unsigned long);
ulong usec2ticks (unsigned long usec);
ulong ticks2usec (unsigned long ticks);
-int init_timebase (void);
/* lib_generic/vsprintf.c */
ulong simple_strtoul(const char *cp,char **endp,unsigned int base);
@@ -642,4 +641,6 @@ int spec_str_to_info(const char *str, struct memarea_info *info);
/* Just like simple_strtoul(), but this one honors a K/M/G suffix */
unsigned long strtoul_suffix(const char *str, char **endp, int base);
+extern void start_uboot(void);
+
#endif /* __COMMON_H_ */
diff --git a/include/debug_ll.h b/include/debug_ll.h
index 9985c1d20f..f3772aa1fe 100644
--- a/include/debug_ll.h
+++ b/include/debug_ll.h
@@ -25,8 +25,10 @@
#ifndef __INCLUDE_DEBUG_LL_H__
#define __INCLUDE_DEBUG_LL_H__
-#if defined (CONFIG_DEBUG_LL)
-# include <asm/arch/debug_ll.h>
+#define PUTC(x) serial_putc(x)
+
+//#if defined (CONFIG_DEBUG_LL)
+//# include <asm/arch/debug_ll.h>
# define PUTHEX_LL(value) ({ unsigned long v = (unsigned long) (value); \
int i; unsigned char ch; \
@@ -34,10 +36,10 @@
ch = ((v >> (i*4)) & 0xf);\
ch += (ch >= 10) ? 'a' - 10 : '0';\
PUTC (ch); }})
-#else
-# define PUTC_LL(c) do {} while (0)
-# define PUTHEX_LL(v) do {} while (0)
+//#else
+//# define PUTC_LL(c) do {} while (0)
+//# define PUTHEX_LL(v) do {} while (0)
-#endif
+//#endif
#endif /* __INCLUDE_DEBUG_LL_H__ */
diff --git a/include/i2c.h b/include/i2c.h
index a8f729afe0..9f4c582230 100644
--- a/include/i2c.h
+++ b/include/i2c.h
@@ -50,7 +50,6 @@
* Initialization, must be called once on start up, may be called
* repeatedly to change the speed and slave addresses.
*/
-void i2c_init(int speed, int slaveaddr);
#ifdef CFG_I2C_INIT_BOARD
void i2c_init_board(void);
#endif
diff --git a/lib_generic/global.c b/lib_generic/global.c
index 0e5a18c454..19d887ebd0 100644
--- a/lib_generic/global.c
+++ b/lib_generic/global.c
@@ -5,28 +5,34 @@
#include <malloc.h>
#include <asm-generic/errno.h>
-struct device_d global_dev;
+static struct device_d global_dev;
int global_add_parameter(struct param_d *param)
{
return dev_add_parameter(&global_dev, param);
}
-struct device_d global_dev = {
+static int my_probe(struct device_d *dev)
+{
+ return 0;
+}
+
+static struct device_d global_dev = {
.name = "global",
.id = "env",
.map_base = 0,
.size = 0,
};
-struct driver_d global_driver = {
+static struct driver_d global_driver = {
.name = "global",
- .probe = dummy_probe,
+ .probe = my_probe,
};
static int global_init(void)
{
- register_device(&global_dev);
+ global_driver.probe = my_probe;
+ register_device(&global_dev);
register_driver(&global_driver);
return 0;
}
diff --git a/lib_generic/misc.c b/lib_generic/misc.c
index 8cb4be8dd3..981b1c7a93 100644
--- a/lib_generic/misc.c
+++ b/lib_generic/misc.c
@@ -2,6 +2,7 @@
#include <common.h>
#include <command.h>
#include <driver.h>
+#include <init.h>
#include <linux/ctype.h>
int cmd_get_data_size(char* arg, int default_size)
@@ -58,7 +59,9 @@ struct device_d *get_device_by_id(char *id)
static int match(struct driver_d *drv, struct device_d *dev)
{
int(*handler)(struct device_d *);
-
+printf("match: 0x%p 0x%p\n", drv, dev);
+printf("match: %s %s\n",dev->name, drv->name);
+printf("match: probe: 0x%08x\n",drv->probe);
if (strcmp(dev->name, drv->name))
return -1;
if (dev->type != drv->type)
@@ -486,3 +489,10 @@ U_BOOT_CMD(
""
);
+int dev_init(void) {
+ memset(device_handler, 0, sizeof(ulong) * MAX_DEVICE_TYPE);
+ return 0;
+}
+
+core_initcall(dev_init);
+