]> git.ipfire.org Git - people/ms/u-boot.git/blame - board/freescale/p1010rdb/spl_minimal.c
armv8: LS1046AQDS: Add NOR Secure Boot Target
[people/ms/u-boot.git] / board / freescale / p1010rdb / spl_minimal.c
CommitLineData
d793e5a8
DD
1/*
2 * Copyright 2011 Freescale Semiconductor, Inc.
3 *
1a459660 4 * SPDX-License-Identifier: GPL-2.0+
d793e5a8
DD
5 */
6#include <common.h>
7#include <mpc85xx.h>
8#include <asm/io.h>
9#include <ns16550.h>
10#include <nand.h>
11#include <asm/mmu.h>
12#include <asm/immap_85xx.h>
5614e71b 13#include <fsl_ddr_sdram.h>
d793e5a8 14#include <asm/fsl_law.h>
8c454047 15#include <asm/global_data.h>
d793e5a8 16
8c454047 17DECLARE_GLOBAL_DATA_PTR;
d793e5a8 18
d793e5a8
DD
19void board_init_f(ulong bootflag)
20{
0fa934d2 21 u32 plat_ratio;
d793e5a8
DD
22 ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR;
23
c9e1f588
YZ
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
d793e5a8
DD
29 /* initialize selected port with appropriate baud rate */
30 plat_ratio = in_be32(&gur->porpllsr) & MPC85xx_PORPLLSR_PLAT_RATIO;
31 plat_ratio >>= 1;
8c454047 32 gd->bus_clk = CONFIG_SYS_CLK_FREQ * plat_ratio;
d793e5a8 33
d793e5a8 34 NS16550_init((NS16550_t)CONFIG_SYS_NS16550_COM1,
8c454047 35 gd->bus_clk / 16 / CONFIG_BAUDRATE);
d793e5a8
DD
36
37 puts("\nNAND boot... ");
38
d793e5a8
DD
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 */
0fa934d2
PK
43
44 relocate_code(CONFIG_SPL_RELOC_STACK, 0, CONFIG_SPL_RELOC_TEXT_BASE);
d793e5a8
DD
45}
46
47void board_init_r(gd_t *gd, ulong dest_addr)
48{
c9e1f588 49 puts("\nSecond program loader running in sram...");
d793e5a8
DD
50 nand_boot();
51}
52
53void putc(char c)
54{
55 if (c == '\n')
56 NS16550_putc((NS16550_t)CONFIG_SYS_NS16550_COM1, '\r');
57
58 NS16550_putc((NS16550_t)CONFIG_SYS_NS16550_COM1, c);
59}
60
61void puts(const char *str)
62{
63 while (*str)
64 putc(*str++);
65}