18167af14SThomas Weber /*
28167af14SThomas Weber  * (C) Copyright 2012
38167af14SThomas Weber  * Corscience GmbH & Co. KG, <www.corscience.de>
48167af14SThomas Weber  * Thomas Weber <weber@corscience.de>
58167af14SThomas Weber  * Sunil Kumar <sunilsaini05@gmail.com>
68167af14SThomas Weber  * Shashi Ranjan <shashiranjanmca05@gmail.com>
78167af14SThomas Weber  *
88167af14SThomas Weber  * Derived from Devkit8000 code by
98167af14SThomas Weber  * Frederik Kriewitz <frederik@kriewitz.eu>
108167af14SThomas Weber  *
118167af14SThomas Weber  * See file CREDITS for list of people who contributed to this
128167af14SThomas Weber  * project.
138167af14SThomas Weber  *
148167af14SThomas Weber  * This program is free software; you can redistribute it and/or
158167af14SThomas Weber  * modify it under the terms of the GNU General Public License as
168167af14SThomas Weber  * published by the Free Software Foundation; either version 2 of
178167af14SThomas Weber  * the License, or (at your option) any later version.
188167af14SThomas Weber  *
198167af14SThomas Weber  * This program is distributed in the hope that it will be useful,
208167af14SThomas Weber  * but WITHOUT ANY WARRANTY; without even the implied warranty of
218167af14SThomas Weber  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
228167af14SThomas Weber  * GNU General Public License for more details.
238167af14SThomas Weber  *
248167af14SThomas Weber  * You should have received a copy of the GNU General Public License
258167af14SThomas Weber  * along with this program; if not, write to the Free Software
268167af14SThomas Weber  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
278167af14SThomas Weber  * MA 02111-1307 USA
288167af14SThomas Weber  */
298167af14SThomas Weber #include <common.h>
308167af14SThomas Weber #include <twl4030.h>
318167af14SThomas Weber #include <asm/io.h>
328167af14SThomas Weber #include <asm/arch/mmc_host_def.h>
338167af14SThomas Weber #include <asm/arch/mux.h>
348167af14SThomas Weber #include <asm/arch/sys_proto.h>
358167af14SThomas Weber #include <asm/arch/mem.h>
368167af14SThomas Weber #include "tricorder.h"
378167af14SThomas Weber 
388167af14SThomas Weber DECLARE_GLOBAL_DATA_PTR;
398167af14SThomas Weber 
408167af14SThomas Weber /*
418167af14SThomas Weber  * Routine: board_init
428167af14SThomas Weber  * Description: Early hardware init.
438167af14SThomas Weber  */
448167af14SThomas Weber int board_init(void)
458167af14SThomas Weber {
468167af14SThomas Weber 	gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
478167af14SThomas Weber 	/* boot param addr */
488167af14SThomas Weber 	gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
498167af14SThomas Weber 
508167af14SThomas Weber 	return 0;
518167af14SThomas Weber }
528167af14SThomas Weber 
538167af14SThomas Weber /*
548167af14SThomas Weber  * Routine: misc_init_r
558167af14SThomas Weber  * Description: Configure board specific parts
568167af14SThomas Weber  */
578167af14SThomas Weber int misc_init_r(void)
588167af14SThomas Weber {
598167af14SThomas Weber 	twl4030_power_init();
608167af14SThomas Weber #ifdef CONFIG_TWL4030_LED
618167af14SThomas Weber 	twl4030_led_init(TWL4030_LED_LEDEN_LEDAON | TWL4030_LED_LEDEN_LEDBON);
628167af14SThomas Weber #endif
638167af14SThomas Weber 
648167af14SThomas Weber 	dieid_num_r();
658167af14SThomas Weber 
668167af14SThomas Weber 	return 0;
678167af14SThomas Weber }
688167af14SThomas Weber 
698167af14SThomas Weber /*
708167af14SThomas Weber  * Routine: set_muxconf_regs
718167af14SThomas Weber  * Description: Setting up the configuration Mux registers specific to the
728167af14SThomas Weber  *		hardware. Many pins need to be moved from protect to primary
738167af14SThomas Weber  *		mode.
748167af14SThomas Weber  */
758167af14SThomas Weber void set_muxconf_regs(void)
768167af14SThomas Weber {
778167af14SThomas Weber 	MUX_TRICORDER();
788167af14SThomas Weber }
798167af14SThomas Weber 
808167af14SThomas Weber #if defined(CONFIG_GENERIC_MMC) && !(defined(CONFIG_SPL_BUILD))
818167af14SThomas Weber int board_mmc_init(bd_t *bis)
828167af14SThomas Weber {
83*e3913f56SNikita Kiryanov 	return omap_mmc_init(0, 0, 0, -1, -1);
848167af14SThomas Weber }
858167af14SThomas Weber #endif
868167af14SThomas Weber 
878167af14SThomas Weber /*
888167af14SThomas Weber  * Routine: get_board_mem_timings
898167af14SThomas Weber  * Description: If we use SPL then there is no x-loader nor config header
908167af14SThomas Weber  * so we have to setup the DDR timings ourself on the first bank.  This
918167af14SThomas Weber  * provides the timing values back to the function that configures
928167af14SThomas Weber  * the memory.  We have either one or two banks of 128MB DDR.
938167af14SThomas Weber  */
948c4445d2SPeter Barada void get_board_mem_timings(struct board_sdrc_timings *timings)
958167af14SThomas Weber {
968167af14SThomas Weber 	/* General SDRC config */
978c4445d2SPeter Barada 	timings->mcfg = MICRON_V_MCFG_165(128 << 20);
988c4445d2SPeter Barada 	timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
998167af14SThomas Weber 
1008167af14SThomas Weber 	/* AC timings */
1018c4445d2SPeter Barada 	timings->ctrla = MICRON_V_ACTIMA_165;
1028c4445d2SPeter Barada 	timings->ctrlb = MICRON_V_ACTIMB_165;
1038c4445d2SPeter Barada 	timings->mr = MICRON_V_MR_165;
1048167af14SThomas Weber }
105