Merge https://gitlab.denx.de/u-boot/custodians/u-boot-spi into next
[platform/kernel/u-boot.git] / board / ti / sdp4430 / sdp.c
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
16 #include "sdp4430_mux_data.h"
17
18 DECLARE_GLOBAL_DATA_PTR;
19
20 const struct omap_sysinfo sysinfo = {
21         "Board: OMAP4430 SDP\n"
22 };
23
24 /**
25  * @brief board_init
26  *
27  * @return 0
28  */
29 int board_init(void)
30 {
31         gpmc_init();
32
33         gd->bd->bi_boot_params = (0x80000000 + 0x100); /* boot param addr */
34
35         return 0;
36 }
37
38 int board_eth_init(bd_t *bis)
39 {
40         return 0;
41 }
42
43 /**
44  * @brief misc_init_r - Configure SDP board specific configurations
45  * such as power configurations, ethernet initialization as phase2 of
46  * boot sequence
47  *
48  * @return 0
49  */
50 int misc_init_r(void)
51 {
52 #ifdef CONFIG_TWL6030_POWER
53         twl6030_init_battery_charging();
54 #endif
55         return 0;
56 }
57
58 void set_muxconf_regs(void)
59 {
60         do_set_mux((*ctrl)->control_padconf_core_base,
61                    core_padconf_array_essential,
62                    sizeof(core_padconf_array_essential) /
63                    sizeof(struct pad_conf_entry));
64
65         do_set_mux((*ctrl)->control_padconf_wkup_base,
66                    wkup_padconf_array_essential,
67                    sizeof(wkup_padconf_array_essential) /
68                    sizeof(struct pad_conf_entry));
69
70         if ((omap_revision() >= OMAP4460_ES1_0) &&
71                         (omap_revision() < OMAP4470_ES1_0))
72                 do_set_mux((*ctrl)->control_padconf_wkup_base,
73                                  wkup_padconf_array_essential_4460,
74                                  sizeof(wkup_padconf_array_essential_4460) /
75                                  sizeof(struct pad_conf_entry));
76 }
77
78 #if defined(CONFIG_MMC)
79 int board_mmc_init(bd_t *bis)
80 {
81         omap_mmc_init(0, 0, 0, -1, -1);
82         omap_mmc_init(1, 0, 0, -1, -1);
83         return 0;
84 }
85
86 #if !defined(CONFIG_SPL_BUILD)
87 void board_mmc_power_init(void)
88 {
89         twl6030_power_mmc_init(0);
90         twl6030_power_mmc_init(1);
91 }
92 #endif
93 #endif
94
95 #if defined(CONFIG_SPL_OS_BOOT)
96 int spl_start_uboot(void)
97 {
98         /* break into full u-boot on 'c' */
99         if (serial_tstc() && serial_getc() == 'c')
100                 return 1;
101
102         return 0;
103 }
104 #endif /* CONFIG_SPL_OS_BOOT */
105
106 /*
107  * get_board_rev() - get board revision
108  */
109 u32 get_board_rev(void)
110 {
111         return 0x20;
112 }