blob: ce7f6191caa89775126a64e8e1c07afc12edf962 [file] [log] [blame]
Liu Yu2639e512010-01-18 19:03:28 +08001/*
2 * Copyright 2009 Freescale Semiconductor, Inc.
3 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02004 * SPDX-License-Identifier: GPL-2.0+
Liu Yu2639e512010-01-18 19:03:28 +08005 */
6#include <common.h>
7#include <mpc85xx.h>
Peter Tyser133c0fe2010-04-12 22:28:07 -05008#include <asm/io.h>
Liu Yu2639e512010-01-18 19:03:28 +08009#include <ns16550.h>
10#include <nand.h>
11#include <asm/mmu.h>
12#include <asm/immap_85xx.h>
York Sunf0626592013-09-30 09:22:09 -070013#include <fsl_ddr_sdram.h>
Liu Yu2639e512010-01-18 19:03:28 +080014#include <asm/fsl_law.h>
15
16#define SYSCLK_66 66666666
17
18DECLARE_GLOBAL_DATA_PTR;
19
20void board_init_f(ulong bootflag)
21{
22 uint plat_ratio, bus_clk, sys_clk;
23 volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
24
25 sys_clk = SYSCLK_66;
26
27 plat_ratio = gur->porpllsr & 0x0000003e;
28 plat_ratio >>= 1;
29 bus_clk = plat_ratio * sys_clk;
30 NS16550_init((NS16550_t)CONFIG_SYS_NS16550_COM1,
31 bus_clk / 16 / CONFIG_BAUDRATE);
32
33 puts("\nNAND boot... ");
34
35 /* copy code to DDR and jump to it - this should not return */
36 /* NOTE - code has to be copied out of NAND buffer before
37 * other blocks can be read.
38 */
39 relocate_code(CONFIG_SYS_NAND_U_BOOT_RELOC_SP, 0,
40 CONFIG_SYS_NAND_U_BOOT_RELOC);
41}
42
43void board_init_r(gd_t *gd, ulong dest_addr)
44{
45 nand_boot();
46}
47
48void putc(char c)
49{
50 if (c == '\n')
51 NS16550_putc((NS16550_t)CONFIG_SYS_NS16550_COM1, '\r');
52
53 NS16550_putc((NS16550_t)CONFIG_SYS_NS16550_COM1, c);
54}
55
56void puts(const char *str)
57{
58 while (*str)
59 putc(*str++);
60}