1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright 2022 Marek Vasut <marex@denx.de>
*/
#include <common.h>
#include <hang.h>
#include <image.h>
#include <init.h>
#include <spl.h>
#include <asm/io.h>
#include <asm-generic/gpio.h>
#include <asm/arch/clock.h>
#include <asm/arch/imx8mm_pins.h>
#include <asm/arch/sys_proto.h>
#include <asm/arch/ddr.h>
#include <asm/mach-imx/boot_mode.h>
#include <dm/uclass.h>
#include <dm/device.h>
#include <dm/uclass-internal.h>
#include <dm/device-internal.h>
#include <power/pmic.h>
#include <power/bd71837.h>
#include "lpddr4_timing.h"
#include "../common/common.h"
DECLARE_GLOBAL_DATA_PTR;
int data_modul_imx_edm_sbc_board_power_init(void)
{
struct udevice *dev;
int ret;
ret = pmic_get("pmic@4b", &dev);
if (ret == -ENODEV) {
puts("Failed to get PMIC\n");
return 0;
}
if (ret != 0)
return ret;
/* Unlock the PMIC regs */
pmic_reg_write(dev, BD718XX_REGLOCK, 0x1);
/* Increase VDD_SOC to typical value 0.85V before first DRAM access */
pmic_reg_write(dev, BD718XX_BUCK1_VOLT_RUN, 0x0f);
/* Increase VDD_DRAM to 0.975V for 3GHz DDR */
pmic_reg_write(dev, BD718XX_1ST_NODVS_BUCK_VOLT, 0x83);
/* Lock the PMIC regs */
pmic_reg_write(dev, BD718XX_REGLOCK, 0x11);
return 0;
}
int spl_board_boot_device(enum boot_device boot_dev_spl)
{
if (boot_dev_spl == MMC3_BOOT)
return BOOT_DEVICE_MMC2; /* eMMC */
else
return BOOT_DEVICE_MMC1; /* SD */
}
void board_boot_order(u32 *spl_boot_list)
{
int boot_device = spl_boot_device();
spl_boot_list[0] = boot_device; /* 1:SD 2:eMMC */
if (boot_device == BOOT_DEVICE_MMC1)
spl_boot_list[1] = BOOT_DEVICE_MMC2; /* eMMC */
else
spl_boot_list[1] = BOOT_DEVICE_MMC1; /* SD */
spl_boot_list[2] = BOOT_DEVICE_UART; /* YModem */
spl_boot_list[3] = BOOT_DEVICE_NONE;
}
static struct dram_timing_info *dram_timing_info[8] = {
&dmo_imx8mm_sbc_dram_timing_32_32, /* 32 Gbit x32 */
NULL, /* 32 Gbit x16 */
&dmo_imx8mm_sbc_dram_timing_16_32, /* 16 Gbit x32 */
NULL, /* 16 Gbit x16 */
NULL, /* 8 Gbit x32 */
NULL, /* 8 Gbit x16 */
NULL, /* INVALID */
NULL, /* INVALID */
};
void board_init_f(ulong dummy)
{
dmo_board_init_f(IMX8MM_PAD_GPIO1_IO02_WDOG1_WDOG_B, dram_timing_info);
}
|