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