1 /*
2  * Embest/Timll DevKit3250 board support
3  *
4  * Copyright (C) 2011 Vladimir Zapolskiy <vz@mleia.com>
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation; either version 2 of
9  * the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
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., 51 Franklin Street, Fifth Floor, Boston,
19  * MA 02110-1301, USA.
20  */
21 
22 #include <common.h>
23 #include <asm/arch/sys_proto.h>
24 #include <asm/arch/cpu.h>
25 #include <asm/arch/emc.h>
26 
27 DECLARE_GLOBAL_DATA_PTR;
28 
29 static struct emc_regs *emc = (struct emc_regs *)EMC_BASE;
30 
31 int board_early_init_f(void)
32 {
33 	lpc32xx_uart_init(CONFIG_SYS_LPC32XX_UART);
34 
35 	return 0;
36 }
37 
38 int board_init(void)
39 {
40 	/* adress of boot parameters */
41 	gd->bd->bi_boot_params  = CONFIG_SYS_SDRAM_BASE + 0x100;
42 
43 #ifdef CONFIG_SYS_FLASH_CFI
44 	/* Use 16-bit memory interface for NOR Flash */
45 	emc->stat[0].config	= EMC_STAT_CONFIG_PB | EMC_STAT_CONFIG_16BIT;
46 
47 	/* Change the NOR timings to optimum value to get maximum bandwidth */
48 	emc->stat[0].waitwen	= EMC_STAT_WAITWEN(1);
49 	emc->stat[0].waitoen	= EMC_STAT_WAITOEN(1);
50 	emc->stat[0].waitrd	= EMC_STAT_WAITRD(12);
51 	emc->stat[0].waitpage	= EMC_STAT_WAITPAGE(12);
52 	emc->stat[0].waitwr	= EMC_STAT_WAITWR(5);
53 	emc->stat[0].waitturn	= EMC_STAT_WAITTURN(2);
54 #endif
55 
56 	return 0;
57 }
58 
59 int dram_init(void)
60 {
61 	gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE,
62 				    CONFIG_SYS_SDRAM_SIZE);
63 
64 	return 0;
65 }
66