]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - arch/nds32/lib/board.c
net: Remove the bd* parameter from net stack functions
[karo-tx-uboot.git] / arch / nds32 / lib / board.c
index 1776a725721743fe19dd8012955ab50f698e0eb6..24a09bc3c21764d1df50e7bfd0770a6f8821c458 100644 (file)
@@ -6,23 +6,7 @@
  * Shawn Lin, Andes Technology Corporation <nobuhiro@andestech.com>
  * Macpaul Lin, Andes Technology Corporation <macpaul@andestech.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 <common.h>
 #include <nand.h>
 #include <onenand_uboot.h>
 #include <mmc.h>
+#include <asm/sections.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#if defined(CONFIG_SYS_I2C)
+#include <i2c.h>
+#endif
+
 ulong monitor_flash_len;
 
 /*
@@ -50,13 +39,7 @@ ulong monitor_flash_len;
 #endif
 static int init_baudrate(void)
 {
-       char tmp[64];   /* long enough for environment variables */
-       int i = getenv_f("baudrate", tmp, sizeof(tmp));
-
-       gd->bd->bi_baudrate = gd->baudrate = (i > 0)
-                       ? (int) simple_strtoul(tmp, NULL, 10)
-                       : CONFIG_BAUDRATE;
-
+       gd->baudrate = getenv_ulong("baudrate", 10, CONFIG_BAUDRATE);
        return 0;
 }
 
@@ -109,6 +92,7 @@ static int nds32_pci_init(void)
 #endif /* CONFIG_CMD_PCI || CONFIG_PCI */
 
 #if defined(CONFIG_PMU) || defined(CONFIG_PCU)
+#ifndef CONFIG_SKIP_LOWLEVEL_INIT
 static int pmu_init(void)
 {
 #if defined(CONFIG_FTPMU010_POWER)
@@ -121,6 +105,7 @@ static int pmu_init(void)
        return 0;
 }
 #endif
+#endif
 
 /*
  * Breathe some life into the board...
@@ -176,7 +161,7 @@ init_fnc_t *init_sequence[] = {
 #if defined(CONFIG_DISPLAY_BOARDINFO)
        checkboard,             /* display board info */
 #endif
-#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C)
+#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SYS_I2C)
        init_func_i2c,
 #endif
        dram_init,              /* configure available RAM banks */
@@ -196,7 +181,7 @@ void board_init_f(ulong bootflag)
 
        memset((void *)gd, 0, GENERATED_GBL_DATA_SIZE);
 
-       gd->mon_len = (unsigned int)(&__bss_end__) - (unsigned int)(&_start);
+       gd->mon_len = (unsigned int)(&__bss_end) - (unsigned int)(&_start);
 
        for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
                if ((*init_fnc_ptr)() != 0)
@@ -211,17 +196,6 @@ void board_init_f(ulong bootflag)
 
        addr = CONFIG_SYS_SDRAM_BASE + gd->ram_size;
 
-#if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF))
-       /* reserve TLB table */
-       addr -= (4096 * 4);
-
-       /* round down to next 64 kB limit */
-       addr &= ~(0x10000 - 1);
-
-       gd->tlb_addr = addr;
-       debug("TLB table at: %08lx\n", addr);
-#endif
-
        /* round down to next 4 kB limit */
        addr &= ~(4096 - 1);
        debug("Top of RAM usable for U-Boot at: %08lx\n", addr);
@@ -281,7 +255,6 @@ void board_init_f(ulong bootflag)
        addr_sp &= ~0x07;
        debug("New Stack Pointer is: %08lx\n", addr_sp);
 
-       gd->bd->bi_baudrate = gd->baudrate;
        /* Ram isn't board specific, so move it to board code ... */
        dram_init_banksize();
        display_dram_config();  /* and display it */
@@ -307,18 +280,15 @@ void board_init_f(ulong bootflag)
  */
 void board_init_r(gd_t *id, ulong dest_addr)
 {
-       char *s;
        bd_t *bd;
        ulong malloc_start;
 
-       extern void malloc_bin_reloc(void);
-
        gd = id;
        bd = gd->bd;
 
        gd->flags |= GD_FLG_RELOC;      /* tell others: relocation done */
 
-       monitor_flash_len = &_end - &_start;
+       monitor_flash_len = (ulong)&_end - (ulong)&_start;
        debug("monitor flash len: %08lX\n", monitor_flash_len);
 
        board_init();   /* Setup chipselects */
@@ -327,20 +297,17 @@ void board_init_r(gd_t *id, ulong dest_addr)
        /*
         * We have to relocate the command table manually
         */
-       fixup_cmdtable(&__u_boot_cmd_start,
-               (ulong)(&__u_boot_cmd_end - &__u_boot_cmd_start));
+       fixup_cmdtable(ll_entry_start(cmd_tbl_t, cmd),
+                       ll_entry_count(cmd_tbl_t, cmd));
 #endif /* defined(CONFIG_NEEDS_MANUAL_RELOC) */
 
-#ifdef CONFIG_SERIAL_MULTI
        serial_initialize();
-#endif
 
        debug("Now running in RAM - U-Boot at: %08lx\n", dest_addr);
 
        /* The Malloc area is immediately below the monitor copy in DRAM */
        malloc_start = dest_addr - TOTAL_MALLOC_LEN;
        mem_malloc_init(malloc_start, TOTAL_MALLOC_LEN);
-       malloc_bin_reloc();
 
 #ifndef CONFIG_SYS_NO_FLASH
        /* configure available FLASH banks */
@@ -357,21 +324,28 @@ void board_init_r(gd_t *id, ulong dest_addr)
        nand_init();            /* go init the NAND */
 #endif
 
+#if defined(CONFIG_CMD_IDE)
+       puts("IDE:   ");
+       ide_init();
+#endif
+
 #ifdef CONFIG_GENERIC_MMC
        puts("MMC:   ");
        mmc_initialize(gd->bd);
 #endif
 
+#if defined(CONFIG_SYS_I2C_ADAPTERS)
+       i2c_reloc_fixup();
+#endif
+
        /* initialize environment */
        env_relocate();
 
 #if defined(CONFIG_CMD_PCI) || defined(CONFIG_PCI)
+       puts("PCI:   ");
        nds32_pci_init();
 #endif
 
-       /* IP Address */
-       gd->bd->bi_ip_addr = getenv_IPaddr("ipaddr");
-
        stdio_init();   /* get the devices list going. */
 
        jumptable_init();
@@ -400,24 +374,16 @@ void board_init_r(gd_t *id, ulong dest_addr)
 #endif
 
        /* Initialize from environment */
-       s = getenv("loadaddr");
-       if (s != NULL)
-               load_addr = simple_strtoul(s, NULL, 16);
+       load_addr = getenv_ulong("loadaddr", 16, load_addr);
 
-#if defined(CONFIG_CMD_NET)
-       s = getenv("bootfile");
-       if (s != NULL)
-               copy_filename(BootFile, s, sizeof(BootFile));
-#endif
-
-#ifdef BOARD_LATE_INIT
+#ifdef CONFIG_BOARD_LATE_INIT
        board_late_init();
 #endif
 
 #if defined(CONFIG_CMD_NET)
        puts("Net:   ");
 
-       eth_initialize(gd->bd);
+       eth_initialize();
 #if defined(CONFIG_RESET_PHY_R)
        debug("Reset Ethernet PHY\n");
        reset_phy();
@@ -430,10 +396,3 @@ void board_init_r(gd_t *id, ulong dest_addr)
 
        /* NOTREACHED - no way out of command loop except booting */
 }
-
-void hang(void)
-{
-       puts("### ERROR ### Please RESET the board ###\n");
-       for (;;)
-               ;
-}