2018-05-06 21:58:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2016-07-29 02:35:25 +00:00
|
|
|
/*
|
|
|
|
* (C) Copyright 2016 Rockchip Electronics Co., Ltd
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <dm.h>
|
2020-05-10 17:40:05 +00:00
|
|
|
#include <log.h>
|
2016-07-29 02:35:25 +00:00
|
|
|
#include <syscon.h>
|
2019-03-28 03:01:23 +00:00
|
|
|
#include <asm/arch-rockchip/clock.h>
|
2016-07-29 02:35:25 +00:00
|
|
|
|
|
|
|
static const struct udevice_id rk3399_syscon_ids[] = {
|
|
|
|
{ .compatible = "rockchip,rk3399-grf", .data = ROCKCHIP_SYSCON_GRF },
|
2016-08-16 09:58:10 +00:00
|
|
|
{ .compatible = "rockchip,rk3399-pmugrf", .data = ROCKCHIP_SYSCON_PMUGRF },
|
2017-02-13 09:38:59 +00:00
|
|
|
{ .compatible = "rockchip,rk3399-pmusgrf", .data = ROCKCHIP_SYSCON_PMUSGRF },
|
|
|
|
{ .compatible = "rockchip,rk3399-cic", .data = ROCKCHIP_SYSCON_CIC },
|
2019-07-16 11:57:33 +00:00
|
|
|
{ .compatible = "rockchip,rk3399-pmu", .data = ROCKCHIP_SYSCON_PMU },
|
rockchip: rk3399: Add missing sentinel in syscon
when enable PMIC rk808,the system will halt at very
early stage,log is shown as bellow.
INFO: plat_rockchip_pmu_init(1211): pd status 3e
INFO: BL31: Initializing runtime services
INFO: BL31: Preparing for EL3 exit to normal world
INFO: Entry point address = 0x200000
INFO: SPSR = 0x3c9
time 44561b, 0 (<<----Just stop here)
It's caused by the absence of "{ }" in syscon_rk3399.c
,which will lead to memory overflow like below.According
to Sysmap file ,we can find the function buck_get_value
of rk808 is just follow the compatible struct,the pointer
"of_match" point to "buck_get_value",but it is not a
struct and don't have member of compatible, In this case,
system crash. So,on the face, it looks like that rk808 is
guilty.but he is really innocent.
while (of_match->compatible) { <<----------
if (!strcmp(of_match->compatible, compat)) {
*of_idp = of_match;
return 0;
}
of_match++;
}
Signed-off-by: Eric Gao <eric.gao@rock-chips.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Tested-by: Kever Yang <kever.yang@rock-chips.com>
2017-04-10 01:53:31 +00:00
|
|
|
{ }
|
2016-07-29 02:35:25 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
U_BOOT_DRIVER(syscon_rk3399) = {
|
|
|
|
.name = "rk3399_syscon",
|
|
|
|
.id = UCLASS_SYSCON,
|
2020-05-26 03:32:08 +00:00
|
|
|
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
|
|
|
.bind = dm_scan_fdt_dev,
|
|
|
|
#endif
|
2016-07-29 02:35:25 +00:00
|
|
|
.of_match = rk3399_syscon_ids,
|
|
|
|
};
|
2017-02-13 09:38:59 +00:00
|
|
|
|
|
|
|
#if CONFIG_IS_ENABLED(OF_PLATDATA)
|
2020-12-03 23:55:23 +00:00
|
|
|
static int rk3399_syscon_bind_of_plat(struct udevice *dev)
|
2017-02-13 09:38:59 +00:00
|
|
|
{
|
|
|
|
dev->driver_data = dev->driver->of_match->data;
|
|
|
|
debug("syscon: %s %d\n", dev->name, (uint)dev->driver_data);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
U_BOOT_DRIVER(rockchip_rk3399_grf) = {
|
|
|
|
.name = "rockchip_rk3399_grf",
|
|
|
|
.id = UCLASS_SYSCON,
|
|
|
|
.of_match = rk3399_syscon_ids,
|
2020-12-03 23:55:23 +00:00
|
|
|
.bind = rk3399_syscon_bind_of_plat,
|
2017-02-13 09:38:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
U_BOOT_DRIVER(rockchip_rk3399_pmugrf) = {
|
|
|
|
.name = "rockchip_rk3399_pmugrf",
|
|
|
|
.id = UCLASS_SYSCON,
|
|
|
|
.of_match = rk3399_syscon_ids + 1,
|
2020-12-03 23:55:23 +00:00
|
|
|
.bind = rk3399_syscon_bind_of_plat,
|
2017-02-13 09:38:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
U_BOOT_DRIVER(rockchip_rk3399_pmusgrf) = {
|
|
|
|
.name = "rockchip_rk3399_pmusgrf",
|
|
|
|
.id = UCLASS_SYSCON,
|
|
|
|
.of_match = rk3399_syscon_ids + 2,
|
2020-12-03 23:55:23 +00:00
|
|
|
.bind = rk3399_syscon_bind_of_plat,
|
2017-02-13 09:38:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
U_BOOT_DRIVER(rockchip_rk3399_cic) = {
|
|
|
|
.name = "rockchip_rk3399_cic",
|
|
|
|
.id = UCLASS_SYSCON,
|
|
|
|
.of_match = rk3399_syscon_ids + 3,
|
2020-12-03 23:55:23 +00:00
|
|
|
.bind = rk3399_syscon_bind_of_plat,
|
2017-02-13 09:38:59 +00:00
|
|
|
};
|
2019-07-16 11:57:33 +00:00
|
|
|
|
|
|
|
U_BOOT_DRIVER(rockchip_rk3399_pmu) = {
|
|
|
|
.name = "rockchip_rk3399_pmu",
|
|
|
|
.id = UCLASS_SYSCON,
|
|
|
|
.of_match = rk3399_syscon_ids + 4,
|
2020-12-03 23:55:23 +00:00
|
|
|
.bind = rk3399_syscon_bind_of_plat,
|
2019-07-16 11:57:33 +00:00
|
|
|
};
|
2017-02-13 09:38:59 +00:00
|
|
|
#endif
|