diff --git a/arch/ppc/Makefile b/arch/ppc/Makefile index 68d85314a..0a3130e48 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 41e564d38..2b6cd27af 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; + gd->reloc_off = dest_addr; +PUTC('\n'); +PUTHEX_LL(dest_addr); - 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 - - 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 b3c47ef62..8133e687b 100644 --- a/common/misc.c +++ b/common/misc.c @@ -1,4 +1,4 @@ - +#include #include /* diff --git a/cpu/mpc5xxx/cpu.c b/cpu/mpc5xxx/cpu.c index d7e590375..a19eed54c 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 7a8f8ed79..b6c9a3e5d 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(®s->mcr, 0, 0); - mpc_reg_out(®s->madr, saddr << 1, 0); +#warning mpc5xxx i2c is broken +// mpc_reg_out(®s->madr, saddr << 1, 0); /* Set clock */ diff --git a/cpu/mpc5xxx/start.S b/cpu/mpc5xxx/start.S index a81ebabe0..c48ecb80f 100644 --- a/cpu/mpc5xxx/start.S +++ b/cpu/mpc5xxx/start.S @@ -71,16 +71,6 @@ GOT_ENTRY(__bss_start) END_GOT -/* - * Version string - */ - .data - .globl version_string -version_string: - .ascii U_BOOT_VERSION - .ascii " (", __DATE__, " - ", __TIME__, ")" - .ascii CONFIG_IDENT_STRING, "\0" - /* * Exception vectors */ diff --git a/include/common.h b/include/common.h index 7030c7648..41c1c18ee 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 9985c1d20..f3772aa1f 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 +#define PUTC(x) serial_putc(x) + +//#if defined (CONFIG_DEBUG_LL) +//# include # 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 a8f729afe..9f4c58223 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 0e5a18c45..19d887ebd 100644 --- a/lib_generic/global.c +++ b/lib_generic/global.c @@ -5,28 +5,34 @@ #include #include -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 8cb4be8dd..981b1c7a9 100644 --- a/lib_generic/misc.c +++ b/lib_generic/misc.c @@ -2,6 +2,7 @@ #include #include #include +#include #include 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); +