2 * LG Optimus Black (P970) codename sniper board
4 * Copyright (C) 2015 Paul Kocialkowski <contact@paulk.fr>
6 * SPDX-License-Identifier: GPL-2.0+
12 #include <linux/ctype.h>
13 #include <linux/usb/musb.h>
14 #include <asm/omap_musb.h>
15 #include <asm/arch/mmc_host_def.h>
16 #include <asm/arch/sys_proto.h>
17 #include <asm/arch/mem.h>
23 DECLARE_GLOBAL_DATA_PTR;
25 const omap3_sysinfo sysinfo = {
27 .board_string = "Sniper",
31 static const struct ns16550_platdata serial_omap_platdata = {
32 .base = OMAP34XX_UART3,
34 .clock = V_NS16550_CLK
37 U_BOOT_DEVICE(sniper_serial) = {
38 .name = "serial_omap",
39 .platdata = &serial_omap_platdata
42 static struct musb_hdrc_config musb_config = {
49 static struct omap_musb_board_data musb_board_data = {
50 .interface_type = MUSB_INTERFACE_ULPI,
53 static struct musb_hdrc_platform_data musb_platform_data = {
54 .mode = MUSB_PERIPHERAL,
55 .config = &musb_config,
57 .platform_ops = &omap2430_ops,
58 .board_data = &musb_board_data,
61 #ifdef CONFIG_SPL_BUILD
62 void get_board_mem_timings(struct board_sdrc_timings *timings)
64 timings->mcfg = HYNIX_V_MCFG_200(256 << 20);
65 timings->ctrla = HYNIX_V_ACTIMA_200;
66 timings->ctrlb = HYNIX_V_ACTIMB_200;
67 timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_200MHz;
68 timings->mr = MICRON_V_MR_165;
72 u32 get_board_rev(void)
74 /* Sold devices are expected to be at least revision F. */
84 gd->bd->bi_arch_number = 3000;
87 gd->bd->bi_boot_params = OMAP34XX_SDRC_CS0 + 0x100;
94 char serial_string[17] = { 0 };
95 char reboot_mode[2] = { 0 };
97 unsigned char data = 0;
99 /* Power button reset init */
101 twl4030_power_reset_init();
105 reboot_mode[0] = omap_reboot_mode();
106 if (reboot_mode[0] > 0 && isascii(reboot_mode[0])) {
107 if (!getenv("reboot-mode"))
108 setenv("reboot-mode", (char *)reboot_mode);
110 omap_reboot_mode_clear();
113 * When not rebooting, valid power on reasons are either the
114 * power button, charger plug or USB plug.
117 data |= twl4030_input_power_button();
118 data |= twl4030_input_charger();
119 data |= twl4030_input_usb();
127 get_dieid((u32 *)&dieid);
129 if (!getenv("serial#")) {
130 snprintf(serial_string, sizeof(serial_string),
131 "%08x%08x", dieid[0], dieid[3]);
133 setenv("serial#", serial_string);
138 musb_register(&musb_platform_data, &musb_board_data, (void *)MUSB_BASE);
143 void get_board_serial(struct tag_serialnr *serialnr)
146 unsigned long long serial;
148 serial_string = getenv("serial#");
151 serial = simple_strtoull(serial_string, NULL, 16);
153 serialnr->high = (unsigned int) (serial >> 32);
154 serialnr->low = (unsigned int) (serial & 0xffffffff);
161 void reset_misc(void)
163 omap_reboot_mode_store('u');
166 int fb_set_reboot_flag(void)
168 return omap_reboot_mode_store('b');
171 void set_muxconf_regs(void)
176 #ifndef CONFIG_SPL_BUILD
177 int board_mmc_init(bd_t *bis)
179 return omap_mmc_init(1, 0, 0, -1, -1);
183 void board_mmc_power_init(void)
185 twl4030_power_mmc_init(1);