]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - nand_spl/board/freescale/mpc8569mds/nand_boot.c
arm: rmobile: lager: Remove NOR-Flash support from boards.cfg
[karo-tx-uboot.git] / nand_spl / board / freescale / mpc8569mds / nand_boot.c
1 /*
2  * Copyright 2009 Freescale Semiconductor, Inc.
3  *
4  * SPDX-License-Identifier:     GPL-2.0+
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>
13 #include <fsl_ddr_sdram.h>
14 #include <asm/fsl_law.h>
15
16 #define SYSCLK_66       66666666
17
18 DECLARE_GLOBAL_DATA_PTR;
19
20 void 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
43 void board_init_r(gd_t *gd, ulong dest_addr)
44 {
45         nand_boot();
46 }
47
48 void 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
56 void puts(const char *str)
57 {
58         while (*str)
59                 putc(*str++);
60 }