2 * (C) Copyright 2017 Theobroma Systems Design und Consulting GmbH
4 * SPDX-License-Identifier: GPL-2.0+
10 #include <dm/pinctrl.h>
11 #include <dm/uclass-internal.h>
12 #include <asm/arch/periph.h>
13 #include <power/regulator.h>
14 #include <u-boot/sha256.h>
16 DECLARE_GLOBAL_DATA_PTR;
18 #define RK3399_CPUID_OFF 0x7
19 #define RK3399_CPUID_LEN 0x10
21 DECLARE_GLOBAL_DATA_PTR;
25 struct udevice *pinctrl, *regulator;
29 * The PWM does not have decicated interrupt number in dts and can
30 * not get periph_id by pinctrl framework, so let's init them here.
31 * The PWM2 and PWM3 are for pwm regulators.
33 ret = uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl);
35 debug("%s: Cannot find pinctrl device\n", __func__);
39 ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_PWM2);
41 debug("%s PWM2 pinctrl init fail!\n", __func__);
45 /* rk3399 need to init vdd_center to get the correct output voltage */
46 ret = regulator_get_by_platname("vdd_center", ®ulator);
48 debug("%s: Cannot get vdd_center regulator\n", __func__);
50 ret = regulator_get_by_platname("vcc5v0_host", ®ulator);
52 debug("%s vcc5v0_host init fail! ret %d\n", __func__, ret);
56 ret = regulator_set_enable(regulator, true);
58 debug("%s vcc5v0-host-en set fail!\n", __func__);
72 ret = uclass_get_device(UCLASS_RAM, 0, &dev);
74 debug("DRAM init failed: %d\n", ret);
77 ret = ram_get_info(dev, &ram);
79 debug("Cannot get DRAM size: %d\n", ret);
82 debug("SDRAM base=%llx, size=%x\n", ram.base, (unsigned int)ram.size);
83 gd->ram_size = ram.size;
88 int dram_init_banksize(void)
90 /* Reserve 0x200000 for ATF bl31 */
91 gd->bd->bi_dram[0].start = 0x200000;
92 gd->bd->bi_dram[0].size = 0x7e000000;