rockchip: resource: fix/optimise some code logic
- alloc sysmem after load kernel dtb successfully; - allow distro kernel dtb to be loaded later than other resource file, that is not controlled by code condition "if (list_empty(&entrys_head))". Change-Id: If1657289a4f8980ad7d7a5df7da0e061aab21504 Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
This commit is contained in:
parent
bcf005ba08
commit
6069a2cc24
|
|
@ -845,22 +845,21 @@ int rockchip_read_dtb_file(void *fdt_addr)
|
||||||
char *dtb_name = DTB_FILE;
|
char *dtb_name = DTB_FILE;
|
||||||
int size = -ENODEV;
|
int size = -ENODEV;
|
||||||
|
|
||||||
if (list_empty(&entrys_head)) {
|
if (!get_file_info(NULL, dtb_name)) {
|
||||||
if (init_resource_list(NULL)) {
|
|
||||||
/* Load dtb from distro boot.img */
|
|
||||||
#ifdef CONFIG_ROCKCHIP_EARLY_DISTRO_DTB
|
#ifdef CONFIG_ROCKCHIP_EARLY_DISTRO_DTB
|
||||||
printf("Distro DTB: %s\n",
|
/* Load dtb from distro boot.img */
|
||||||
CONFIG_ROCKCHIP_EARLY_DISTRO_DTB_PATH);
|
printf("Distro DTB: %s\n",
|
||||||
size = rockchip_read_distro_dtb_file(fdt_addr);
|
CONFIG_ROCKCHIP_EARLY_DISTRO_DTB_PATH);
|
||||||
if (size < 0)
|
size = rockchip_read_distro_dtb_file(fdt_addr);
|
||||||
return size;
|
if (size < 0)
|
||||||
if (!sysmem_alloc_base(MEMBLK_ID_FDT,
|
|
||||||
(phys_addr_t)fdt_addr,
|
|
||||||
ALIGN(size, RK_BLK_SIZE) + CONFIG_SYS_FDT_PAD))
|
|
||||||
return -ENOMEM;
|
|
||||||
#endif
|
|
||||||
return size;
|
return size;
|
||||||
}
|
|
||||||
|
if (!sysmem_alloc_base(MEMBLK_ID_FDT,
|
||||||
|
(phys_addr_t)fdt_addr,
|
||||||
|
ALIGN(size, RK_BLK_SIZE) + CONFIG_SYS_FDT_PAD))
|
||||||
|
return -ENOMEM;
|
||||||
|
#endif
|
||||||
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find dtb file according to hardware id(GPIO/ADC) */
|
/* Find dtb file according to hardware id(GPIO/ADC) */
|
||||||
|
|
@ -887,10 +886,6 @@ int rockchip_read_dtb_file(void *fdt_addr)
|
||||||
if (size < 0)
|
if (size < 0)
|
||||||
return size;
|
return size;
|
||||||
|
|
||||||
if (!sysmem_alloc_base(MEMBLK_ID_FDT, (phys_addr_t)fdt_addr,
|
|
||||||
ALIGN(size, RK_BLK_SIZE) + CONFIG_SYS_FDT_PAD))
|
|
||||||
return -ENOMEM;
|
|
||||||
|
|
||||||
size = rockchip_read_resource_file((void *)fdt_addr, dtb_name, 0, 0);
|
size = rockchip_read_resource_file((void *)fdt_addr, dtb_name, 0, 0);
|
||||||
if (size < 0)
|
if (size < 0)
|
||||||
return size;
|
return size;
|
||||||
|
|
@ -900,6 +895,10 @@ int rockchip_read_dtb_file(void *fdt_addr)
|
||||||
return -EBADF;
|
return -EBADF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!sysmem_alloc_base(MEMBLK_ID_FDT, (phys_addr_t)fdt_addr,
|
||||||
|
ALIGN(size, RK_BLK_SIZE) + CONFIG_SYS_FDT_PAD))
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
/* Apply DTBO */
|
/* Apply DTBO */
|
||||||
#if defined(CONFIG_CMD_DTIMG) && defined(CONFIG_OF_LIBFDT_OVERLAY)
|
#if defined(CONFIG_CMD_DTIMG) && defined(CONFIG_OF_LIBFDT_OVERLAY)
|
||||||
android_fdt_overlay_apply((void *)fdt_addr);
|
android_fdt_overlay_apply((void *)fdt_addr);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue