uboot/board/freescale/p1_p2_rdb_pc/spl_minimal.c
<<
>>
Prefs
   1// SPDX-License-Identifier: GPL-2.0+
   2/*
   3 * Copyright 2011 Freescale Semiconductor, Inc.
   4 */
   5
   6#include <common.h>
   7#include <clock_legacy.h>
   8#include <init.h>
   9#include <ns16550.h>
  10#include <asm/io.h>
  11#include <nand.h>
  12#include <linux/compiler.h>
  13#include <asm/fsl_law.h>
  14#include <fsl_ddr_sdram.h>
  15#include <asm/global_data.h>
  16
  17DECLARE_GLOBAL_DATA_PTR;
  18
  19void board_init_f(ulong bootflag)
  20{
  21        u32 plat_ratio;
  22        ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR;
  23
  24#if defined(CONFIG_SYS_NAND_BR_PRELIM) && defined(CONFIG_SYS_NAND_OR_PRELIM)
  25        set_lbc_br(0, CONFIG_SYS_NAND_BR_PRELIM);
  26        set_lbc_or(0, CONFIG_SYS_NAND_OR_PRELIM);
  27#endif
  28
  29        /* initialize selected port with appropriate baud rate */
  30        plat_ratio = in_be32(&gur->porpllsr) & MPC85xx_PORPLLSR_PLAT_RATIO;
  31        plat_ratio >>= 1;
  32        gd->bus_clk = get_board_sys_clk() * plat_ratio;
  33
  34        ns16550_init((struct ns16550 *)CONFIG_SYS_NS16550_COM1,
  35                     gd->bus_clk / 16 / CONFIG_BAUDRATE);
  36
  37        puts("\nNAND boot... ");
  38
  39        /* copy code to RAM and jump to it - this should not return */
  40        /* NOTE - code has to be copied out of NAND buffer before
  41         * other blocks can be read.
  42         */
  43        relocate_code(CONFIG_SPL_RELOC_STACK, 0, CONFIG_SPL_RELOC_TEXT_BASE);
  44}
  45
  46void board_init_r(gd_t *gd, ulong dest_addr)
  47{
  48        puts("\nSecond program loader running in sram...");
  49        nand_boot();
  50}
  51
  52void putc(char c)
  53{
  54        if (c == '\n')
  55                ns16550_putc((struct ns16550 *)CONFIG_SYS_NS16550_COM1, '\r');
  56
  57        ns16550_putc((struct ns16550 *)CONFIG_SYS_NS16550_COM1, c);
  58}
  59
  60void puts(const char *str)
  61{
  62        while (*str)
  63                putc(*str++);
  64}
  65