]> git.karo-electronics.de Git - karo-tx-uboot.git/blobdiff - arch/powerpc/lib/board.c
Merge branch 'rmobile' of git://git.denx.de/u-boot-sh
[karo-tx-uboot.git] / arch / powerpc / lib / board.c
index fc4c1d5812179a1d7af48af4c243cee91a5581d9..e6d5355f261fd9b6e4bd521fa141ccd61db22860 100644 (file)
@@ -2,23 +2,7 @@
  * (C) Copyright 2000-2011
  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  *
- * 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>
@@ -98,8 +82,7 @@ extern void sc3_read_eeprom(void);
 #if defined(CONFIG_CMD_DOC)
 void doc_init(void);
 #endif
-#if defined(CONFIG_HARD_I2C) || \
-    defined(CONFIG_SOFT_I2C)
+#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SYS_I2C)
 #include <i2c.h>
 #endif
 #include <spi.h>
@@ -214,11 +197,15 @@ static int init_func_ram(void)
 
 /***********************************************************************/
 
-#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C)
+#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SYS_I2C)
 static int init_func_i2c(void)
 {
        puts("I2C:   ");
+#ifdef CONFIG_SYS_I2C
+       i2c_init_all();
+#else
        i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
+#endif
        puts("ready\n");
        return 0;
 }
@@ -239,6 +226,9 @@ static int init_func_spi(void)
 #if defined(CONFIG_WATCHDOG)
 int init_func_watchdog_init(void)
 {
+#if defined(CONFIG_MPC85xx)
+       init_85xx_watchdog();
+#endif
        puts("       Watchdog enabled\n");
        WATCHDOG_RESET();
        return 0;
@@ -290,10 +280,10 @@ static init_fnc_t *init_sequence[] = {
        serial_init,
        console_init_f,
        display_options,
-#if defined(CONFIG_8260)
+#if defined(CONFIG_MPC8260)
        prt_8260_rsr,
        prt_8260_clks,
-#endif /* CONFIG_8260 */
+#endif /* CONFIG_MPC8260 */
 #if defined(CONFIG_MPC83xx)
        prt_83xx_rsr,
 #endif
@@ -307,7 +297,7 @@ static init_fnc_t *init_sequence[] = {
        misc_init_f,
 #endif
        INIT_FUNC_WATCHDOG_RESET
-#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C)
+#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SYS_I2C)
        init_func_i2c,
 #endif
 #if defined(CONFIG_HARD_SPI)
@@ -325,17 +315,6 @@ static init_fnc_t *init_sequence[] = {
        NULL,   /* Terminate this list */
 };
 
-ulong get_effective_memsize(void)
-{
-#ifndef        CONFIG_VERY_BIG_RAM
-       return gd->ram_size;
-#else
-       /* limit stack to what we can reasonable map */
-       return ((gd->ram_size > CONFIG_MAX_MEM_MAPPED) ?
-               CONFIG_MAX_MEM_MAPPED : gd->ram_size);
-#endif
-}
-
 static int __fixup_cpu(void)
 {
        return 0;
@@ -356,13 +335,6 @@ int fixup_cpu(void) __attribute__((weak, alias("__fixup_cpu")));
  * initialized, and stack space is limited to a few kB.
  */
 
-#ifdef CONFIG_LOGBUFFER
-unsigned long logbuffer_base(void)
-{
-       return CONFIG_SYS_SDRAM_BASE + get_effective_memsize() - LOGBUFF_LEN;
-}
-#endif
-
 void board_init_f(ulong bootflag)
 {
        bd_t *bd;
@@ -374,6 +346,13 @@ void board_init_f(ulong bootflag)
 #ifdef CONFIG_PRAM
        ulong reg;
 #endif
+#ifdef CONFIG_DEEP_SLEEP
+       const ccsr_gur_t *gur = (void __iomem *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
+       struct ccsr_scfg *scfg = (void *)CONFIG_SYS_MPC85xx_SCFG;
+       u32 start_addr;
+       typedef void (*func_t)(void);
+       func_t kernel_resume;
+#endif
 
        /* Pointer is writable since we allocated a register for it */
        gd = (gd_t *) (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_GBL_DATA_OFFSET);
@@ -387,10 +366,26 @@ 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();
 
+#ifdef CONFIG_DEEP_SLEEP
+       /* Jump to kernel in deep sleep case */
+       if (in_be32(&gur->scrtsr[0]) & (1 << 3)) {
+               l2cache_init();
+#if defined(CONFIG_RAMBOOT_PBL)
+               disable_cpc_sram();
+#endif
+               enable_cpc();
+               start_addr = in_be32(&scfg->sparecr[1]);
+               kernel_resume = (func_t)start_addr;
+               kernel_resume();
+       }
+#endif
+
 #ifdef CONFIG_POST
        post_bootmode_init();
        post_run(NULL, POST_ROM | post_bootmode_get(NULL));
@@ -535,7 +530,7 @@ void board_init_f(ulong bootflag)
        bd->bi_sramsize = CONFIG_SYS_SRAM_SIZE;         /* size  of SRAM */
 #endif
 
-#if defined(CONFIG_8xx) || defined(CONFIG_8260) || defined(CONFIG_5xx) || \
+#if defined(CONFIG_8xx) || defined(CONFIG_MPC8260) || defined(CONFIG_5xx) || \
     defined(CONFIG_E500) || defined(CONFIG_MPC86xx)
        bd->bi_immr_base = CONFIG_SYS_IMMR;     /* base  of IMMR register     */
 #endif
@@ -562,7 +557,6 @@ void board_init_f(ulong bootflag)
        bd->bi_ipbfreq = gd->arch.ipb_clk;
        bd->bi_pcifreq = gd->pci_clk;
 #endif /* CONFIG_MPC5xxx */
-       bd->bi_baudrate = gd->baudrate; /* Console Baudrate     */
 
 #ifdef CONFIG_SYS_EXTBDINFO
        strncpy((char *) bd->bi_s_version, "1.2", sizeof(bd->bi_s_version));
@@ -826,13 +820,6 @@ void board_init_r(gd_t *id, ulong dest_addr)
        mac_read_from_eeprom();
 #endif
 
-#ifdef CONFIG_HERMES
-       if ((gd->board_type >> 16) == 2)
-               bd->bi_ethspeed = gd->board_type & 0xFFFF;
-       else
-               bd->bi_ethspeed = 0xFFFF;
-#endif
-
 #ifdef CONFIG_CMD_NET
        /* kept around for legacy kernels only ... ignore the next section */
        eth_getenv_enetaddr("ethaddr", bd->bi_enetaddr);
@@ -882,11 +869,6 @@ void board_init_r(gd_t *id, ulong dest_addr)
        misc_init_r();
 #endif
 
-#ifdef CONFIG_HERMES
-       if (bd->bi_ethspeed != 0xFFFF)
-               hermes_start_lxt980((int) bd->bi_ethspeed);
-#endif
-
 #if defined(CONFIG_CMD_KGDB)
        WATCHDOG_RESET();
        puts("KGDB:  ");
@@ -997,7 +979,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
                pram += (LOGBUFF_LEN + LOGBUFF_OVERHEAD) / 1024;
 #endif
 #endif
-               sprintf(memsz, "%ldk", (bd->bi_memsize / 1024) - pram);
+               sprintf(memsz, "%ldk", (ulong) (bd->bi_memsize / 1024) - pram);
                setenv("mem", memsz);
        }
 #endif
@@ -1007,14 +989,6 @@ void board_init_r(gd_t *id, ulong dest_addr)
        kbd_init();
 #endif
 
-#ifdef CONFIG_MODEM_SUPPORT
-       {
-               extern int do_mdm_init;
-
-               do_mdm_init = gd->do_mdm_init;
-       }
-#endif
-
        /* Initialization complete - start the monitor */
 
        /* main_loop() can return to retry autoboot, if so just run it again. */