]> git.ipfire.org Git - people/ms/u-boot.git/blame - nand_spl/board/freescale/mpc8569mds/nand_boot.c
Driver/DDR: Moving Freescale DDR driver to a common driver
[people/ms/u-boot.git] / nand_spl / board / freescale / mpc8569mds / nand_boot.c
CommitLineData
674ef7bd
LY
1/*
2 * Copyright 2009 Freescale Semiconductor, Inc.
3 *
1a459660 4 * SPDX-License-Identifier: GPL-2.0+
674ef7bd
LY
5 */
6#include <common.h>
7#include <mpc85xx.h>
61f2b38a 8#include <asm/io.h>
674ef7bd
LY
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>
674ef7bd
LY
14#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}