sun60iw2: fix up external FDT DRAM size

This commit is contained in:
Qubot 2026-06-01 21:34:20 +08:00
parent cf69605008
commit 1cae3df323
3 changed files with 33 additions and 0 deletions

View File

@ -104,6 +104,34 @@ int __attribute__((weak)) update_bmu_info_to_kernel()
int disp_lcd_param_update_to_kernel(void);
int sunxi_drm_kernel_para_flush(void);
int sunxi_fixup_external_fdt_dram(void *dtb_base)
{
phys_size_t dram_size;
if (!dtb_base) {
pr_err("%s: dtb_base is NULL\n", __func__);
return -1;
}
dram_size = (phys_size_t)uboot_spare_head.boot_data.dram_scan_size *
1024 * 1024;
if (!dram_size) {
pr_err("%s: invalid dram_scan_size %u MiB\n", __func__,
uboot_spare_head.boot_data.dram_scan_size);
return -1;
}
gd->bd->bi_dram[0].size = dram_size;
if (arch_fixup_fdt(dtb_base) < 0) {
pr_err("%s: arch_fixup_fdt failed\n", __func__);
return -1;
}
tick_printf("sunxi: fixed external FDT DRAM size to %u MiB\n",
uboot_spare_head.boot_data.dram_scan_size);
return 0;
}
#ifdef CONFIG_SUNXI_BOOT_PARAM
int update_fdt_dram_para_from_bootpara(void *dtb_base)
{

View File

@ -12,6 +12,7 @@
void sunxi_dump(void *addr, unsigned int size);
int sunxi_update_fdt_para_for_kernel(void);
int sunxi_fixup_external_fdt_dram(void *dtb_base);
int sunxi_update_bootcmd(void);
int sunxi_update_partinfo(void);
int sunxi_update_rotpk_info(void);

View File

@ -30,6 +30,8 @@
#include <bootm.h>
#include <image.h>
int sunxi_fixup_external_fdt_dram(void *dtb_base);
#ifndef CONFIG_SYS_BOOTM_LEN
/* use 8MByte as default max gunzip size
* want to change the CONFIG_SYS_BOOTM_LEN
@ -363,6 +365,8 @@ int bootm_find_images(int flag, int argc, char * const argv[])
*/
images.ft_addr = (char *)simple_strtoul(argv[2], NULL, 16);
images.ft_len = fdt_totalsize(images.ft_addr);
sunxi_fixup_external_fdt_dram(images.ft_addr);
images.ft_len = fdt_totalsize(images.ft_addr);
printf("sunxi: using explicit FDT @ %p size 0x%lx\n",
images.ft_addr, images.ft_len);
}