1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * (C) Copyright 2010
4  * Texas Instruments Incorporated, <www.ti.com>
5  * Aneesh V       <aneesh@ti.com>
6  * Steve Sakoman  <steve@sakoman.com>
7  */
8 #include <common.h>
9 #include <init.h>
10 #include <net.h>
11 #include <twl6030.h>
12 #include <serial.h>
13 #include <asm/arch/sys_proto.h>
14 #include <asm/arch/mmc_host_def.h>
15 #include <asm/global_data.h>
16 
17 #include "sdp4430_mux_data.h"
18 
19 DECLARE_GLOBAL_DATA_PTR;
20 
21 const struct omap_sysinfo sysinfo = {
22 	"Board: OMAP4430 SDP\n"
23 };
24 
25 /**
26  * @brief board_init
27  *
28  * @return 0
29  */
board_init(void)30 int board_init(void)
31 {
32 	gpmc_init();
33 
34 	gd->bd->bi_boot_params = (0x80000000 + 0x100); /* boot param addr */
35 
36 	return 0;
37 }
38 
board_eth_init(struct bd_info * bis)39 int board_eth_init(struct bd_info *bis)
40 {
41 	return 0;
42 }
43 
44 /**
45  * @brief misc_init_r - Configure SDP board specific configurations
46  * such as power configurations, ethernet initialization as phase2 of
47  * boot sequence
48  *
49  * @return 0
50  */
misc_init_r(void)51 int misc_init_r(void)
52 {
53 #ifdef CONFIG_TWL6030_POWER
54 	twl6030_init_battery_charging();
55 #endif
56 	return 0;
57 }
58 
set_muxconf_regs(void)59 void set_muxconf_regs(void)
60 {
61 	do_set_mux((*ctrl)->control_padconf_core_base,
62 		   core_padconf_array_essential,
63 		   sizeof(core_padconf_array_essential) /
64 		   sizeof(struct pad_conf_entry));
65 
66 	do_set_mux((*ctrl)->control_padconf_wkup_base,
67 		   wkup_padconf_array_essential,
68 		   sizeof(wkup_padconf_array_essential) /
69 		   sizeof(struct pad_conf_entry));
70 
71 	if ((omap_revision() >= OMAP4460_ES1_0) &&
72 			(omap_revision() < OMAP4470_ES1_0))
73 		do_set_mux((*ctrl)->control_padconf_wkup_base,
74 				 wkup_padconf_array_essential_4460,
75 				 sizeof(wkup_padconf_array_essential_4460) /
76 				 sizeof(struct pad_conf_entry));
77 }
78 
79 #if defined(CONFIG_MMC)
board_mmc_init(struct bd_info * bis)80 int board_mmc_init(struct bd_info *bis)
81 {
82 	omap_mmc_init(0, 0, 0, -1, -1);
83 	omap_mmc_init(1, 0, 0, -1, -1);
84 	return 0;
85 }
86 
87 #if !defined(CONFIG_SPL_BUILD)
board_mmc_power_init(void)88 void board_mmc_power_init(void)
89 {
90 	twl6030_power_mmc_init(0);
91 	twl6030_power_mmc_init(1);
92 }
93 #endif
94 #endif
95 
96 #if defined(CONFIG_SPL_OS_BOOT)
spl_start_uboot(void)97 int spl_start_uboot(void)
98 {
99 	/* break into full u-boot on 'c' */
100 	if (serial_tstc() && serial_getc() == 'c')
101 		return 1;
102 
103 	return 0;
104 }
105 #endif /* CONFIG_SPL_OS_BOOT */
106 
107 /*
108  * get_board_rev() - get board revision
109  */
get_board_rev(void)110 u32 get_board_rev(void)
111 {
112 	return 0x20;
113 }
114