From c495a36ee4ae2ff2bd174a11b874b56aeba63b95 Mon Sep 17 00:00:00 2001 From: Joseph Chen Date: Wed, 6 May 2020 10:19:32 +0800 Subject: [PATCH] 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 Change-Id: I8f174aad96f1afc4b9792d2fe5cffb841a730233 --- arch/arm/mach-rockchip/resource_img.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-rockchip/resource_img.c b/arch/arm/mach-rockchip/resource_img.c index 1b432f75a4..41c2873055 100644 --- a/arch/arm/mach-rockchip/resource_img.c +++ b/arch/arm/mach-rockchip/resource_img.c @@ -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;