2 * Copyright 2009 Freescale Semiconductor, Inc.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of
7 * the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
23 #include <asm-ppc/io.h>
27 #include <asm/immap_85xx.h>
28 #include <asm/fsl_ddr_sdram.h>
29 #include <asm/fsl_law.h>
31 #define SYSCLK_MASK 0x00200000
32 #define BOARDREV_MASK 0x10100000
33 #define BOARDREV_B 0x10100000
34 #define BOARDREV_C 0x00100000
36 #define SYSCLK_66 66666666
37 #define SYSCLK_50 50000000
38 #define SYSCLK_100 100000000
40 DECLARE_GLOBAL_DATA_PTR;
42 void board_init_f(ulong bootflag)
44 uint plat_ratio, bus_clk, sys_clk;
45 volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
46 volatile ccsr_gpio_t *pgpio = (void *)(CONFIG_SYS_MPC85xx_GPIO_ADDR);
47 uint val, temp, sysclk_mask;
50 sysclk_mask = val & SYSCLK_MASK;
51 temp = val & BOARDREV_MASK;
52 if (temp == BOARDREV_C) {
57 } else if (temp == BOARDREV_B) {
64 plat_ratio = gur->porpllsr & 0x0000003e;
66 bus_clk = plat_ratio * sys_clk;
67 NS16550_init((NS16550_t)CONFIG_SYS_NS16550_COM1,
68 bus_clk / 16 / CONFIG_BAUDRATE);
70 puts("\nNAND boot... ");
72 /* copy code to DDR and jump to it - this should not return */
73 /* NOTE - code has to be copied out of NAND buffer before
74 * other blocks can be read.
76 relocate_code(CONFIG_SYS_NAND_U_BOOT_RELOC_SP, 0,
77 CONFIG_SYS_NAND_U_BOOT_RELOC);
80 void board_init_r(gd_t *gd, ulong dest_addr)
88 NS16550_putc((NS16550_t)CONFIG_SYS_NS16550_COM1, '\r');
90 NS16550_putc((NS16550_t)CONFIG_SYS_NS16550_COM1, c);
93 void puts(const char *str)