rockchip: resource: fix reading hw-id dtbs failed

- search order: hw-id dtbs => rk-kernel.dtb.
- initial resource list if empty.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I8f174aad96f1afc4b9792d2fe5cffb841a730233
This commit is contained in:
Joseph Chen 2020-05-06 10:19:32 +08:00
parent a79e8fe670
commit c495a36ee4
1 changed files with 10 additions and 2 deletions

View File

@ -824,6 +824,11 @@ static struct resource_file *rockchip_read_hwid_dtb(void)
struct resource_file *file;
struct list_head *node;
if (list_empty(&entrys_head)) {
if (init_resource_list())
return NULL;
}
/* Find dtb file according to hardware id(GPIO/ADC) */
list_for_each(node, &entrys_head) {
file = list_entry(node, struct resource_file, link);
@ -849,10 +854,13 @@ int rockchip_read_resource_dtb(void *fdt_addr, char **hash, int *hash_size)
struct resource_file *file;
int ret;
file = get_file_info(DTB_FILE);
#ifdef CONFIG_ROCKCHIP_HWID_DTB
file = rockchip_read_hwid_dtb();
/* If dtbs matched hardware id(GPIO/ADC) not found, try the default */
if (!file)
file = rockchip_read_hwid_dtb();
file = get_file_info(DTB_FILE);
#else
file = get_file_info(DTB_FILE);
#endif
if (!file)
return -ENODEV;