2 * Copyright 2010-2011 Freescale Semiconductor, Inc.
3 * Author: Roy Zang <tie-fei.zang@freescale.com>
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of
8 * the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
27 #include <asm/fsl_law.h>
29 /* Fixed sdram init -- doesn't use serial presence detect. */
32 ccsr_ddr_t *ddr = (ccsr_ddr_t *)CONFIG_SYS_MPC85xx_DDR_ADDR;
34 set_next_law(0, LAW_SIZE_2G, LAW_TRGT_IF_DDR_1);
36 out_be32(&ddr->cs0_bnds, CONFIG_SYS_DDR_CS0_BNDS);
37 out_be32(&ddr->cs0_config, CONFIG_SYS_DDR_CS0_CONFIG);
38 out_be32(&ddr->cs1_bnds, CONFIG_SYS_DDR_CS1_BNDS);
39 out_be32(&ddr->cs1_config, CONFIG_SYS_DDR_CS1_CONFIG);
40 out_be32(&ddr->timing_cfg_3, CONFIG_SYS_DDR_TIMING_3);
41 out_be32(&ddr->timing_cfg_0, CONFIG_SYS_DDR_TIMING_0);
42 out_be32(&ddr->timing_cfg_1, CONFIG_SYS_DDR_TIMING_1);
43 out_be32(&ddr->timing_cfg_2, CONFIG_SYS_DDR_TIMING_2);
44 out_be32(&ddr->sdram_cfg_2, CONFIG_SYS_DDR_CONTROL2);
45 out_be32(&ddr->sdram_mode, CONFIG_SYS_DDR_MODE_1);
46 out_be32(&ddr->sdram_mode_2, CONFIG_SYS_DDR_MODE_2);
47 out_be32(&ddr->sdram_interval, CONFIG_SYS_DDR_INTERVAL);
48 out_be32(&ddr->sdram_data_init, CONFIG_SYS_DDR_DATA_INIT);
49 out_be32(&ddr->sdram_clk_cntl, CONFIG_SYS_DDR_CLK_CTRL);
50 out_be32(&ddr->timing_cfg_4, CONFIG_SYS_DDR_TIMING_4);
51 out_be32(&ddr->timing_cfg_5, CONFIG_SYS_DDR_TIMING_5);
52 out_be32(&ddr->ddr_zq_cntl, CONFIG_SYS_DDR_ZQ_CNTL);
53 out_be32(&ddr->ddr_wrlvl_cntl, CONFIG_SYS_DDR_WRLVL_CNTL);
54 out_be32(&ddr->ddr_cdr1, CONFIG_SYS_DDR_CDR_1);
55 out_be32(&ddr->ddr_cdr2, CONFIG_SYS_DDR_CDR_2);
56 out_be32(&ddr->sdram_cfg, CONFIG_SYS_DDR_CONTROL);
59 void board_init_f(ulong bootflag)
61 u32 plat_ratio, bus_clk;
62 ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR;
64 /* initialize selected port with appropriate baud rate */
65 plat_ratio = in_be32(&gur->porpllsr) & MPC85xx_PORPLLSR_PLAT_RATIO;
67 bus_clk = CONFIG_SYS_CLK_FREQ * plat_ratio;
68 NS16550_init((NS16550_t)CONFIG_SYS_NS16550_COM1,
69 bus_clk / 16 / CONFIG_BAUDRATE);
71 puts("\nNAND boot... ");
72 /* Initialize the DDR3 */
74 /* copy code to RAM and jump to it - this should not return */
75 /* NOTE - code has to be copied out of NAND buffer before
76 * other blocks can be read.
78 relocate_code(CONFIG_SYS_NAND_U_BOOT_RELOC_SP, 0,
79 CONFIG_SYS_NAND_U_BOOT_RELOC);
82 void board_init_r(gd_t *gd, ulong dest_addr)
90 NS16550_putc((NS16550_t)CONFIG_SYS_NS16550_COM1, '\r');
92 NS16550_putc((NS16550_t)CONFIG_SYS_NS16550_COM1, c);
95 void puts(const char *str)