2 * LG Optimus Black 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
,
35 .fcr
= UART_FCR_DEFVAL
,
38 U_BOOT_DEVICE(sniper_serial
) = {
39 .name
= "ns16550_serial",
40 .platdata
= &serial_omap_platdata
43 static struct musb_hdrc_config musb_config
= {
50 static struct omap_musb_board_data musb_board_data
= {
51 .interface_type
= MUSB_INTERFACE_ULPI
,
54 static struct musb_hdrc_platform_data musb_platform_data
= {
55 .mode
= MUSB_PERIPHERAL
,
56 .config
= &musb_config
,
58 .platform_ops
= &omap2430_ops
,
59 .board_data
= &musb_board_data
,
62 void set_muxconf_regs(void)
67 #ifdef CONFIG_SPL_BUILD
68 void get_board_mem_timings(struct board_sdrc_timings
*timings
)
70 timings
->mcfg
= HYNIX_V_MCFG_200(256 << 20);
71 timings
->ctrla
= HYNIX_V_ACTIMA_200
;
72 timings
->ctrlb
= HYNIX_V_ACTIMB_200
;
73 timings
->rfr_ctrl
= SDP_3430_SDRC_RFR_CTRL_200MHz
;
74 timings
->mr
= MICRON_V_MR_165
;
84 gd
->bd
->bi_arch_number
= 3000;
87 gd
->bd
->bi_boot_params
= OMAP34XX_SDRC_CS0
+ 0x100;
94 unsigned char keypad_matrix
[64] = { 0 };
95 char reboot_mode
[2] = { 0 };
96 unsigned char keys
[3];
97 unsigned char data
= 0;
100 /* Power button reset init */
102 twl4030_power_reset_init();
106 twl4030_keypad_scan((unsigned char *)&keypad_matrix
);
108 keys
[0] = twl4030_keypad_key((unsigned char *)&keypad_matrix
, 0, 0);
109 keys
[1] = twl4030_keypad_key((unsigned char *)&keypad_matrix
, 0, 1);
110 keys
[2] = twl4030_keypad_key((unsigned char *)&keypad_matrix
, 0, 2);
114 rc
= omap_reboot_mode(reboot_mode
, sizeof(reboot_mode
));
117 reboot_mode
[0] = 'r';
119 reboot_mode
[0] = 'b';
121 if (rc
< 0 || reboot_mode
[0] == 'o') {
123 * When not rebooting, valid power on reasons are either the
124 * power button, charger plug or USB plug.
127 data
|= twl4030_input_power_button();
128 data
|= twl4030_input_charger();
129 data
|= twl4030_input_usb();
135 if (reboot_mode
[0] > 0 && isascii(reboot_mode
[0])) {
136 if (!getenv("reboot-mode"))
137 setenv("reboot-mode", (char *)reboot_mode
);
140 omap_reboot_mode_clear();
144 omap_die_id_serial();
148 musb_register(&musb_platform_data
, &musb_board_data
, (void *)MUSB_BASE
);
153 u32
get_board_rev(void)
155 /* Sold devices are expected to be at least revision F. */
159 void get_board_serial(struct tag_serialnr
*serialnr
)
161 omap_die_id_get_board_serial(serialnr
);
164 void reset_misc(void)
166 char reboot_mode
[2] = { 0 };
169 * Valid resets must contain the reboot mode magic, but we must not
170 * override it when set previously (e.g. reboot to bootloader).
173 omap_reboot_mode(reboot_mode
, sizeof(reboot_mode
));
174 omap_reboot_mode_store(reboot_mode
);
177 int fb_set_reboot_flag(void)
179 return omap_reboot_mode_store("b");
182 int board_mmc_init(bd_t
*bis
)
184 return omap_mmc_init(1, 0, 0, -1, -1);
187 void board_mmc_power_init(void)
189 twl4030_power_mmc_init(1);