1 /*
2  * (C) Copyright 2012
3  * Corscience GmbH & Co. KG, <www.corscience.de>
4  * Thomas Weber <weber@corscience.de>
5  * Sunil Kumar <sunilsaini05@gmail.com>
6  * Shashi Ranjan <shashiranjanmca05@gmail.com>
7  *
8  * Derived from Devkit8000 code by
9  * Frederik Kriewitz <frederik@kriewitz.eu>
10  *
11  * See file CREDITS for list of people who contributed to this
12  * project.
13  *
14  * This program is free software; you can redistribute it and/or
15  * modify it under the terms of the GNU General Public License as
16  * published by the Free Software Foundation; either version 2 of
17  * the License, or (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  * GNU General Public License for more details.
23  *
24  * You should have received a copy of the GNU General Public License
25  * along with this program; if not, write to the Free Software
26  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
27  * MA 02111-1307 USA
28  */
29 #include <common.h>
30 #include <twl4030.h>
31 #include <asm/io.h>
32 #include <asm/arch/mmc_host_def.h>
33 #include <asm/arch/mux.h>
34 #include <asm/arch/sys_proto.h>
35 #include <asm/arch/mem.h>
36 #include "tricorder.h"
37 
38 DECLARE_GLOBAL_DATA_PTR;
39 
40 /*
41  * Routine: board_init
42  * Description: Early hardware init.
43  */
44 int board_init(void)
45 {
46 	gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
47 	/* boot param addr */
48 	gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
49 
50 	return 0;
51 }
52 
53 /*
54  * Routine: misc_init_r
55  * Description: Configure board specific parts
56  */
57 int misc_init_r(void)
58 {
59 	twl4030_power_init();
60 #ifdef CONFIG_TWL4030_LED
61 	twl4030_led_init(TWL4030_LED_LEDEN_LEDAON | TWL4030_LED_LEDEN_LEDBON);
62 #endif
63 
64 	dieid_num_r();
65 
66 	return 0;
67 }
68 
69 /*
70  * Routine: set_muxconf_regs
71  * Description: Setting up the configuration Mux registers specific to the
72  *		hardware. Many pins need to be moved from protect to primary
73  *		mode.
74  */
75 void set_muxconf_regs(void)
76 {
77 	MUX_TRICORDER();
78 }
79 
80 #if defined(CONFIG_GENERIC_MMC) && !(defined(CONFIG_SPL_BUILD))
81 int board_mmc_init(bd_t *bis)
82 {
83 	return omap_mmc_init(0, 0, 0);
84 }
85 #endif
86 
87 /*
88  * Routine: get_board_mem_timings
89  * Description: If we use SPL then there is no x-loader nor config header
90  * so we have to setup the DDR timings ourself on the first bank.  This
91  * provides the timing values back to the function that configures
92  * the memory.  We have either one or two banks of 128MB DDR.
93  */
94 void get_board_mem_timings(u32 *mcfg, u32 *ctrla, u32 *ctrlb, u32 *rfr_ctrl,
95 				u32 *mr)
96 {
97 	/* General SDRC config */
98 	*mcfg = MICRON_V_MCFG_165(128 << 20);
99 	*rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
100 
101 	/* AC timings */
102 	*ctrla = MICRON_V_ACTIMA_165;
103 	*ctrlb = MICRON_V_ACTIMB_165;
104 	*mr = MICRON_V_MR_165;
105 }
106