1*83d290c5STom Rini // SPDX-License-Identifier: GPL-2.0+
2e9b3ce3fSVladimir Zapolskiy /*
3e9b3ce3fSVladimir Zapolskiy * Timll DevKit3250 board support, SPL board configuration
4e9b3ce3fSVladimir Zapolskiy *
5e9b3ce3fSVladimir Zapolskiy * (C) Copyright 2015 Vladimir Zapolskiy <vz@mleia.com>
6e9b3ce3fSVladimir Zapolskiy */
7e9b3ce3fSVladimir Zapolskiy
8e9b3ce3fSVladimir Zapolskiy #include <common.h>
9e9b3ce3fSVladimir Zapolskiy #include <asm/io.h>
10e9b3ce3fSVladimir Zapolskiy #include <asm/arch/sys_proto.h>
11e9b3ce3fSVladimir Zapolskiy #include <asm/arch/cpu.h>
12e9b3ce3fSVladimir Zapolskiy #include <asm/arch/emc.h>
13e9b3ce3fSVladimir Zapolskiy #include <asm/arch-lpc32xx/gpio.h>
14e9b3ce3fSVladimir Zapolskiy #include <spl.h>
15e9b3ce3fSVladimir Zapolskiy
16e9b3ce3fSVladimir Zapolskiy static struct gpio_regs *gpio = (struct gpio_regs *)GPIO_BASE;
17e9b3ce3fSVladimir Zapolskiy
18e9b3ce3fSVladimir Zapolskiy /*
19e9b3ce3fSVladimir Zapolskiy * SDRAM K4S561632N-LC60 settings are selected in assumption that
20e9b3ce3fSVladimir Zapolskiy * SDRAM clock may be set up to 166 MHz, however at the moment
21e9b3ce3fSVladimir Zapolskiy * it is 104 MHz. Most delay values are converted to be a multiple of
22e9b3ce3fSVladimir Zapolskiy * base clock, and precise pinned values are not needed here.
23e9b3ce3fSVladimir Zapolskiy */
24e9b3ce3fSVladimir Zapolskiy struct emc_dram_settings dram_64mb = {
25e9b3ce3fSVladimir Zapolskiy .cmddelay = 0x0001C000,
26e9b3ce3fSVladimir Zapolskiy .config0 = 0x00005682,
27e9b3ce3fSVladimir Zapolskiy .rascas0 = 0x00000302,
28e9b3ce3fSVladimir Zapolskiy .rdconfig = 0x00000011, /* undocumented but crucial value */
29e9b3ce3fSVladimir Zapolskiy
30e9b3ce3fSVladimir Zapolskiy .trp = 83333333,
31e9b3ce3fSVladimir Zapolskiy .tras = 23809524,
32e9b3ce3fSVladimir Zapolskiy .tsrex = 12500000,
33e9b3ce3fSVladimir Zapolskiy .twr = 83000000, /* tWR = tRDL = 2 CLK */
34e9b3ce3fSVladimir Zapolskiy .trc = 15384616,
35e9b3ce3fSVladimir Zapolskiy .trfc = 15384616,
36e9b3ce3fSVladimir Zapolskiy .txsr = 12500000,
37e9b3ce3fSVladimir Zapolskiy .trrd = 1,
38e9b3ce3fSVladimir Zapolskiy .tmrd = 1,
39e9b3ce3fSVladimir Zapolskiy .tcdlr = 0,
40e9b3ce3fSVladimir Zapolskiy
41e9b3ce3fSVladimir Zapolskiy .refresh = 130000, /* 800 clock cycles */
42e9b3ce3fSVladimir Zapolskiy
43e9b3ce3fSVladimir Zapolskiy .mode = 0x00018000,
44e9b3ce3fSVladimir Zapolskiy .emode = 0x02000000,
45e9b3ce3fSVladimir Zapolskiy };
46e9b3ce3fSVladimir Zapolskiy
spl_board_init(void)47e9b3ce3fSVladimir Zapolskiy void spl_board_init(void)
48e9b3ce3fSVladimir Zapolskiy {
49e9b3ce3fSVladimir Zapolskiy /* First of all silence buzzer controlled by GPO_20 */
50e9b3ce3fSVladimir Zapolskiy writel((1 << 20), &gpio->p3_outp_clr);
51e9b3ce3fSVladimir Zapolskiy
52e9b3ce3fSVladimir Zapolskiy lpc32xx_uart_init(CONFIG_SYS_LPC32XX_UART);
53e9b3ce3fSVladimir Zapolskiy preloader_console_init();
54e9b3ce3fSVladimir Zapolskiy
55e9b3ce3fSVladimir Zapolskiy ddr_init(&dram_64mb);
56e9b3ce3fSVladimir Zapolskiy
57e9b3ce3fSVladimir Zapolskiy /*
58e9b3ce3fSVladimir Zapolskiy * NAND initialization is done by nand_init(),
59e9b3ce3fSVladimir Zapolskiy * here just enable NAND SLC clocks
60e9b3ce3fSVladimir Zapolskiy */
61e9b3ce3fSVladimir Zapolskiy lpc32xx_slc_nand_init();
62e9b3ce3fSVladimir Zapolskiy }
63e9b3ce3fSVladimir Zapolskiy
spl_boot_device(void)64e9b3ce3fSVladimir Zapolskiy u32 spl_boot_device(void)
65e9b3ce3fSVladimir Zapolskiy {
66e9b3ce3fSVladimir Zapolskiy return BOOT_DEVICE_NAND;
67e9b3ce3fSVladimir Zapolskiy }
68