xref: /rk3399_rockchip-uboot/board/compulab/cl-som-am57x/cl-som-am57x.c (revision 46650d583b8067c8aecf2ddea585e8a97f937d0c)
1 /*
2  * Board functions for CompuLab cl_som_am57x board
3  *
4  * (C) Copyright 2016 CompuLab, Ltd. http://compulab.co.il/
5  *
6  * Author: Dmitry Lifshitz <lifshitz@compulab.co.il>
7  *
8  * SPDX-License-Identifier:	GPL-2.0+
9  */
10 
11 #include <common.h>
12 #include <palmas.h>
13 #include <usb.h>
14 #include <asm/gpio.h>
15 #include <asm/arch/mmc_host_def.h>
16 #include <asm/arch/sys_proto.h>
17 
18 DECLARE_GLOBAL_DATA_PTR;
19 
20 const struct omap_sysinfo sysinfo = {
21 	"Board: CL-SOM-AM57x\n"
22 };
23 
24 int board_init(void)
25 {
26 	/* Disable PMIC Powerhold feature, DEV_CTRL.DEV_ON = 1 */
27 	palmas_i2c_write_u8(TPS65903X_CHIP_P1, 0xA0, 0x1);
28 
29 	gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
30 
31 	return 0;
32 }
33 
34 #ifdef CONFIG_GENERIC_MMC
35 #define SB_SOM_CD_GPIO 187
36 #define SB_SOM_WP_GPIO 188
37 
38 int board_mmc_init(bd_t *bis)
39 {
40 	int ret0, ret1;
41 
42 	ret0 = omap_mmc_init(0, 0, 0, SB_SOM_CD_GPIO, SB_SOM_WP_GPIO);
43 	if (ret0)
44 		printf("cl-som-am57x: failed to initialize mmc0\n");
45 
46 	ret1 = omap_mmc_init(1, 0, 0, -1, -1);
47 	if (ret1)
48 		printf("cl-som-am57x: failed to initialize mmc1\n");
49 
50 	return ret0 && ret1;
51 }
52 #endif /* CONFIG_GENERIC_MMC */
53 
54 #ifdef CONFIG_USB_XHCI_OMAP
55 int board_usb_init(int index, enum usb_init_type init)
56 {
57 	setbits_le32((*prcm)->cm_l3init_usb_otg_ss1_clkctrl,
58 		     OTG_SS_CLKCTRL_MODULEMODE_HW | OPTFCLKEN_REFCLK960M);
59 
60 	return 0;
61 }
62 #endif /* CONFIG_USB_XHCI_OMAP */
63