board_f: Drop return value from initdram()
[oweals/u-boot.git] / board / freescale / t102xrdb / spl.c
index dd2dec4412101948b00cad99ea9efbea0b6fc829..5be71628afd5aa864accb2b587b4d616800f58bc 100644 (file)
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <console.h>
 #include <malloc.h>
 #include <ns16550.h>
 #include <nand.h>
@@ -11,6 +12,8 @@
 #include <mmc.h>
 #include <fsl_esdhc.h>
 #include <spi_flash.h>
+#include "../common/sleep.h"
+#include "../common/spl.h"
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -29,6 +32,30 @@ unsigned long get_board_ddr_clk(void)
        return CONFIG_DDR_CLK_FREQ;
 }
 
+#if defined(CONFIG_SPL_MMC_BOOT)
+#define GPIO1_SD_SEL 0x00020000
+int board_mmc_getcd(struct mmc *mmc)
+{
+       ccsr_gpio_t __iomem *pgpio = (void *)(CONFIG_SYS_MPC85xx_GPIO_ADDR);
+       u32 val = in_be32(&pgpio->gpdat);
+
+       /* GPIO1_14, 0: eMMC, 1: SD */
+       val &= GPIO1_SD_SEL;
+
+       return val ? -1 : 1;
+}
+
+int board_mmc_getwp(struct mmc *mmc)
+{
+       ccsr_gpio_t __iomem *pgpio = (void *)(CONFIG_SYS_MPC85xx_GPIO_ADDR);
+       u32 val = in_be32(&pgpio->gpdat);
+
+       val &= GPIO1_SD_SEL;
+
+       return val ? -1 : 0;
+}
+#endif
+
 void board_init_f(ulong bootflag)
 {
        u32 plat_ratio, sys_clk, ccb_clk;
@@ -42,6 +69,12 @@ void board_init_f(ulong bootflag)
 
        console_init_f();
 
+#ifdef CONFIG_DEEP_SLEEP
+       /* disable the console if boot from deep sleep */
+       if (is_warm_boot())
+               fsl_dp_disable_console();
+#endif
+
        /* initialize selected port with appropriate baud rate */
        sys_clk = get_board_sys_clk();
        plat_ratio = (in_be32(&gur->rcwsr[0]) >> 25) & 0x1f;
@@ -71,10 +104,11 @@ void board_init_r(gd_t *gd, ulong dest_addr)
        bd->bi_memstart = CONFIG_SYS_INIT_L3_ADDR;
        bd->bi_memsize = CONFIG_SYS_L3_SIZE;
 
-       probecpu();
+       arch_cpu_init();
        get_clocks();
        mem_malloc_init(CONFIG_SPL_RELOC_MALLOC_ADDR,
                        CONFIG_SPL_RELOC_MALLOC_SIZE);
+       gd->flags |= GD_FLG_FULL_MALLOC_INIT;
 
 #ifdef CONFIG_SPL_NAND_BOOT
        nand_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
@@ -86,8 +120,8 @@ void board_init_r(gd_t *gd, ulong dest_addr)
                           (uchar *)CONFIG_ENV_ADDR);
 #endif
 #ifdef CONFIG_SPL_SPI_BOOT
-       spi_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
-                          (uchar *)CONFIG_ENV_ADDR);
+       fsl_spi_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
+                              (uchar *)CONFIG_ENV_ADDR);
 #endif
 
        gd->env_addr  = (ulong)(CONFIG_ENV_ADDR);
@@ -95,12 +129,12 @@ void board_init_r(gd_t *gd, ulong dest_addr)
 
        i2c_init_all();
 
-       gd->ram_size = initdram(0);
+       initdram();
 
 #ifdef CONFIG_SPL_MMC_BOOT
        mmc_boot();
 #elif defined(CONFIG_SPL_SPI_BOOT)
-       spi_boot();
+       fsl_spi_boot();
 #elif defined(CONFIG_SPL_NAND_BOOT)
        nand_boot();
 #endif