LG Optimus Black (P970) codename sniper support
[karo-tx-uboot.git] / board / lge / sniper / sniper.c
1 /*
2  * LG Optimus Black (P970) codename sniper board
3  *
4  * Copyright (C) 2015 Paul Kocialkowski <contact@paulk.fr>
5  *
6  * SPDX-License-Identifier:     GPL-2.0+
7  */
8
9 #include <config.h>
10 #include <common.h>
11 #include <dm.h>
12 #include <asm/arch/mmc_host_def.h>
13 #include <asm/arch/sys_proto.h>
14 #include <asm/arch/mem.h>
15 #include <asm/io.h>
16 #include <ns16550.h>
17 #include <twl4030.h>
18 #include "sniper.h"
19
20 DECLARE_GLOBAL_DATA_PTR;
21
22 const omap3_sysinfo sysinfo = {
23         .mtype = DDR_STACKED,
24         .board_string = "Sniper",
25         .nand_string = "MMC"
26 };
27
28 static const struct ns16550_platdata serial_omap_platdata = {
29         .base = OMAP34XX_UART3,
30         .reg_shift = 2,
31         .clock = V_NS16550_CLK
32 };
33
34 U_BOOT_DEVICE(sniper_serial) = {
35         .name = "serial_omap",
36         .platdata = &serial_omap_platdata
37 };
38
39 #ifdef CONFIG_SPL_BUILD
40 void get_board_mem_timings(struct board_sdrc_timings *timings)
41 {
42         timings->mcfg = HYNIX_V_MCFG_200(256 << 20);
43         timings->ctrla = HYNIX_V_ACTIMA_200;
44         timings->ctrlb = HYNIX_V_ACTIMB_200;
45         timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_200MHz;
46         timings->mr = MICRON_V_MR_165;
47 }
48 #endif
49
50 u32 get_board_rev(void)
51 {
52         /* Sold devices are expected to be at least revision F. */
53         return 6;
54 }
55
56 int board_init(void)
57 {
58         /* GPMC init */
59         gpmc_init();
60
61         /* MACH number */
62         gd->bd->bi_arch_number = 3000;
63
64         /* ATAGs location */
65         gd->bd->bi_boot_params = OMAP34XX_SDRC_CS0 + 0x100;
66
67         return 0;
68 }
69
70 void set_muxconf_regs(void)
71 {
72         MUX_SNIPER();
73 }
74
75 #ifndef CONFIG_SPL_BUILD
76 int board_mmc_init(bd_t *bis)
77 {
78         return omap_mmc_init(1, 0, 0, -1, -1);
79 }
80 #endif
81
82 void board_mmc_power_init(void)
83 {
84         twl4030_power_mmc_init(1);
85 }