X-Git-Url: https://git.kernelconcepts.de/?a=blobdiff_plain;f=arch%2Fsparc%2Flib%2Fboard.c;h=c778ba26e737745d1e848c7bc3e8afa4eae3b3d4;hb=d53ccdb341cf16e32c0ca2d6099b194d9572fe0c;hp=4f6970965b0e2529cfacda4a9b7aa585c4bdd0c8;hpb=cdb749778aa3a8f8d2a41dd4ad811ef822aecfe6;p=karo-tx-uboot.git diff --git a/arch/sparc/lib/board.c b/arch/sparc/lib/board.c index 4f6970965b..c778ba26e7 100644 --- a/arch/sparc/lib/board.c +++ b/arch/sparc/lib/board.c @@ -6,23 +6,7 @@ * (C) Copyright 2007 * Daniel Hellstrom, Gaisler Research, daniel@gaisler.com. * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA + * SPDX-License-Identifier: GPL-2.0+ */ #include @@ -62,7 +46,6 @@ DECLARE_GLOBAL_DATA_PTR; */ extern void timer_interrupt_init(void); -extern void malloc_bin_reloc(void); extern int do_ambapp_print(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]); extern int prom_init(void); @@ -87,13 +70,8 @@ ulong monitor_flash_len; static int init_baudrate(void) { - char tmp[64]; /* long enough for environment variables */ - int i = getenv_f("baudrate", tmp, sizeof(tmp)); - - gd->baudrate = (i > 0) - ? (int)simple_strtoul(tmp, NULL, 10) - : CONFIG_BAUDRATE; - return (0); + gd->baudrate = getenv_ulong("baudrate", 10, CONFIG_BAUDRATE); + return 0; } /***********************************************************************/ @@ -170,13 +148,9 @@ char *str_init_seq_done = "\n\rInit sequence done...\r\n\r\n"; void board_init_f(ulong bootflag) { - cmd_tbl_t *cmdtp; bd_t *bd; - unsigned char *s; init_fnc_t **init_fnc_ptr; int j; - int i; - char *e; #ifndef CONFIG_SYS_NO_FLASH ulong flash_size; @@ -244,7 +218,7 @@ void board_init_f(ulong bootflag) printf("CONFIG_SYS_PROM_OFFSET: 0x%lx (%d)\n", CONFIG_SYS_PROM_OFFSET, CONFIG_SYS_PROM_SIZE); printf("CONFIG_SYS_GBL_DATA_OFFSET: 0x%lx (%d)\n", CONFIG_SYS_GBL_DATA_OFFSET, - CONFIG_SYS_GBL_DATA_SIZE); + GENERATED_GBL_DATA_SIZE); #endif #ifdef CONFIG_POST @@ -252,33 +226,13 @@ void board_init_f(ulong bootflag) post_run(NULL, POST_ROM | post_bootmode_get(0)); #endif +#if defined(CONFIG_NEEDS_MANUAL_RELOC) /* * We have to relocate the command table manually */ - for (cmdtp = &__u_boot_cmd_start; cmdtp != &__u_boot_cmd_end; cmdtp++) { - ulong addr; - addr = (ulong) (cmdtp->cmd) + gd->reloc_off; -#if DEBUG_COMMANDS - printf("Command \"%s\": 0x%08lx => 0x%08lx\n", - cmdtp->name, (ulong) (cmdtp->cmd), addr); -#endif - cmdtp->cmd = - (int (*)(struct cmd_tbl_s *, int, int, char *[]))addr; - - addr = (ulong) (cmdtp->name) + gd->reloc_off; - cmdtp->name = (char *)addr; - - if (cmdtp->usage) { - addr = (ulong) (cmdtp->usage) + gd->reloc_off; - cmdtp->usage = (char *)addr; - } -#ifdef CONFIG_SYS_LONGHELP - if (cmdtp->help) { - addr = (ulong) (cmdtp->help) + gd->reloc_off; - cmdtp->help = (char *)addr; - } -#endif - } + fixup_cmdtable(ll_entry_start(cmd_tbl_t, cmd), + ll_entry_count(cmd_tbl_t, cmd)); +#endif /* defined(CONFIG_NEEDS_MANUAL_RELOC) */ #if defined(CONFIG_CMD_AMBAPP) && defined(CONFIG_SYS_AMBAPP_PRINT_ON_STARTUP) puts("AMBA:\n"); @@ -301,10 +255,9 @@ void board_init_f(ulong bootflag) /* The Malloc area is immediately below the monitor copy in RAM */ mem_malloc_init(CONFIG_SYS_MALLOC_BASE, CONFIG_SYS_MALLOC_END - CONFIG_SYS_MALLOC_BASE); - malloc_bin_reloc(); #if !defined(CONFIG_SYS_NO_FLASH) - puts("FLASH: "); + puts("Flash: "); if ((flash_size = flash_init()) > 0) { # ifdef CONFIG_SYS_FLASH_CHECKSUM @@ -314,8 +267,7 @@ void board_init_f(ulong bootflag) * * NOTE: Maybe we should add some WATCHDOG_RESET()? XXX */ - s = getenv("flashchecksum"); - if (s && (*s == 'y')) { + if (getenv_yesno("flashchecksum") == 1) { printf(" CRC: %08lX", crc32(0, (const unsigned char *)CONFIG_SYS_FLASH_BASE, flash_size) @@ -361,8 +313,6 @@ void board_init_f(ulong bootflag) mac_read_from_eeprom(); #endif - /* IP Address */ - bd->bi_ip_addr = getenv_IPaddr("ipaddr"); #if defined(CONFIG_PCI) /* * Do pci configuration @@ -379,27 +329,14 @@ void board_init_f(ulong bootflag) /* Initialize the console (after the relocation and devices init) */ console_init_r(); -#ifdef CONFIG_SERIAL_SOFTWARE_FIFO - serial_buffered_init(); -#endif - #ifdef CONFIG_STATUS_LED status_led_set(STATUS_LED_BOOT, STATUS_LED_BLINKING); #endif udelay(20); - set_timer(0); - /* Initialize from environment */ - if ((s = getenv("loadaddr")) != NULL) { - load_addr = simple_strtoul(s, NULL, 16); - } -#if defined(CONFIG_CMD_NET) - if ((s = getenv("bootfile")) != NULL) { - copy_filename(BootFile, s, sizeof(BootFile)); - } -#endif /* CONFIG_CMD_NET */ + load_addr = getenv_ulong("loadaddr", 16, load_addr); WATCHDOG_RESET(); @@ -413,10 +350,8 @@ void board_init_f(ulong bootflag) bb_miiphy_init(); #endif #if defined(CONFIG_CMD_NET) -#if defined(CONFIG_NET_MULTI) WATCHDOG_RESET(); puts("Net: "); -#endif eth_initialize(bd); #endif @@ -460,13 +395,4 @@ void board_init_f(ulong bootflag) } -void hang(void) -{ - puts("### ERROR ### Please RESET the board ###\n"); -#ifdef CONFIG_SHOW_BOOT_PROGRESS - show_boot_progress(-30); -#endif - for (;;) ; -} - /************************************************************************/