diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c index 192c120a7d2e..222453ed8ff8 100644 --- a/arch/arm/lib/bootm.c +++ b/arch/arm/lib/bootm.c @@ -67,8 +67,10 @@ static void announce_and_cleanup(int fake) board_quiesce_devices(); +#if 0 printf("\nStarting kernel ...%s\n\n", fake ? "(fake run for tracing)" : ""); +#endif /* * Call remove function of all devices with a removal flag set. * This may be useful for last-stage operations, like cancelling diff --git a/arch/arm/mach-snapdragon/board.c b/arch/arm/mach-snapdragon/board.c index cd09526b9702..11860e860ff6 100644 --- a/arch/arm/mach-snapdragon/board.c +++ b/arch/arm/mach-snapdragon/board.c @@ -37,6 +37,53 @@ #include "qcom-priv.h" +static u64 get_ram_size_bytes(void) +{ + struct bd_info *bd = gd->bd; + u64 total_size = 0; + int i; + + for (i = 0; i < CONFIG_NR_DRAM_BANKS && bd->bi_dram[i].size; i++) { + total_size += bd->bi_dram[i].size; + } + + return total_size; +} + +bool is_retroid_pocketmini(void) +{ + u64 ram_size = get_ram_size_bytes(); + return (ram_size < 7ULL * 1024 * 1024 * 1024); // Less than 7GB threshold +} + +#include +bool is_retroid_pocketmini_v2(void) { + unsigned int height = 1080; + unsigned int width = 1240; + const uint8_t *mem_ptr = (const uint8_t *)0x9C000000; + unsigned int framebuffer_bytes = 4 * height * width; + const unsigned char expected_md5[16] = { + 0xB6, 0xBC, 0x26, 0xCB, 0x1A, 0xB3, 0x9B, 0x10, + 0xEC, 0xF4, 0xF4, 0x61, 0x73, 0xA1, 0x78, 0xAD + }; + unsigned char calculated_md5[16]; + md5_wd(mem_ptr, framebuffer_bytes, calculated_md5, MD5_DEF_CHUNK_SZ); + return (memcmp(calculated_md5, expected_md5, 16) == 0); +} +bool is_retroid_pocketflip2(void) { + unsigned int height = 1080; + unsigned int width = 1920; + const uint8_t *mem_ptr = (const uint8_t *)0x9C000000; + unsigned int framebuffer_bytes = 4 * height * width; + const unsigned char expected_md5[16] = { + 0xAE, 0x77, 0xDA, 0x1C, 0xBB, 0xD7, 0xFD, 0xB7, + 0xF6, 0xA2, 0xD3, 0x7C, 0x61, 0x1D, 0x69, 0x9C + }; + unsigned char calculated_md5[16]; + md5_wd(mem_ptr, framebuffer_bytes, calculated_md5, MD5_DEF_CHUNK_SZ); + return (memcmp(calculated_md5, expected_md5, 16) == 0); +} + DECLARE_GLOBAL_DATA_PTR; static struct mm_region rbx_mem_map[CONFIG_NR_DRAM_BANKS + 2] = { { 0 } }; @@ -367,6 +414,19 @@ int board_late_init(void) phys_addr_t addr; struct fdt_header *fdt_blob = (struct fdt_header *)gd->fdt_blob; + if (is_retroid_pocketmini()) { + if (is_retroid_pocketmini_v2()) { + env_set("dtb_name", "sm8250-retroidpocket-rpminiv2.dtb"); + } else { + env_set("dtb_name", "sm8250-retroidpocket-rpmini.dtb"); + } + } else if (is_retroid_pocketflip2()) { + env_set("dtb_name", "sm8250-retroidpocket-flip2.dtb"); + } else { + env_set("dtb_name", "sm8250-retroidpocket-rp5.dtb"); + } + + /* We need to be fairly conservative here as we support boards with just 1G of TOTAL RAM */ addr = addr_alloc(SZ_128M); status |= env_set_hex("kernel_addr_r", addr); diff --git a/arch/arm/mach-snapdragon/of_fixup.c b/arch/arm/mach-snapdragon/of_fixup.c index 8fff7eda6d9b..94f278c41434 100644 --- a/arch/arm/mach-snapdragon/of_fixup.c +++ b/arch/arm/mach-snapdragon/of_fixup.c @@ -30,114 +30,6 @@ #include #include "qcom-priv.h" -static u64 get_ram_size_bytes(void) -{ - struct bd_info *bd = gd->bd; - u64 total_size = 0; - int i; - - for (i = 0; i < CONFIG_NR_DRAM_BANKS && bd->bi_dram[i].size; i++) { - total_size += bd->bi_dram[i].size; - } - - return total_size; -} - -bool is_retroid_pocketmini(void) -{ - u64 ram_size = get_ram_size_bytes(); - return (ram_size < 7ULL * 1024 * 1024 * 1024); // Less than 7GB threshold -} - -static int fixup_retroid_fdt(void *blob) -{ - int nodeoff; - int ret; - efi_status_t efi_ret; - - /* Ensure FDT has enough space for modifications */ - ret = fdt_increase_size(blob, 512); /* Add 512 bytes of padding */ - if (ret < 0) { - printf("Failed to increase FDT size\n"); - return -1; - } - - /* Get root node first */ - nodeoff = fdt_path_offset(blob, "/"); - if (nodeoff < 0) { - printf("ERROR: Cannot find root node\n"); - return -1; - } - - /* Set rocknix,u-boot property */ - ret = fdt_setprop_empty(blob, nodeoff, "rocknix,u-boot"); - if (ret < 0) { - printf("ERROR: Failed to set rocknix,u-boot property\n"); - return -1; - } - - if (is_retroid_pocketmini()) { - /* Set model and compatible properties */ - ret = fdt_setprop_string(blob, nodeoff, "model", "Retroid Pocket Mini"); - if (ret < 0) { - printf("ERROR: Failed to set model property\n"); - return -1; - } - - const char compatible[] = "retroidpocket,rpmini\0qcom,sm8250"; - ret = fdt_setprop(blob, nodeoff, "compatible", compatible, sizeof(compatible)); - if (ret < 0) { - printf("ERROR: Failed to set compatible property\n"); - return -1; - } - - /* Framebuffer modifications */ - nodeoff = fdt_path_offset(blob, "/chosen/framebuffer@9c000000"); - if (nodeoff >= 0) { - ret = fdt_setprop_u32(blob, nodeoff, "width", 0x3c0); - ret |= fdt_setprop_u32(blob, nodeoff, "height", 0x500); - ret |= fdt_setprop_u32(blob, nodeoff, "stride", 0xf00); - if (ret < 0) { - printf("ERROR: Failed to modify framebuffer properties\n"); - return -1; - } - } - - /* Touchscreen modifications */ - nodeoff = fdt_path_offset(blob, "/soc@0/geniqup@ac0000/i2c@a94000/touchscreen@38"); - if (nodeoff >= 0) { - ret = fdt_setprop_u32(blob, nodeoff, "touchscreen-size-x", 0x3c0); - ret |= fdt_setprop_u32(blob, nodeoff, "touchscreen-size-y", 0x500); - ret |= fdt_delprop(blob, nodeoff, "touchscreen-inverted-x"); - ret |= fdt_delprop(blob, nodeoff, "touchscreen-inverted-y"); - if (ret < 0) { - printf("ERROR: Failed to modify touchscreen properties\n"); - return -1; - } - } - - /* Panel modifications */ - nodeoff = fdt_path_offset(blob, "/soc@0/display-subsystem@ae00000/dsi@ae94000/panel@0"); - if (nodeoff >= 0) { - ret = fdt_setprop_string(blob, nodeoff, "compatible", "ch13726a,rpmini"); - ret |= fdt_setprop_u32(blob, nodeoff, "rotation", 0x5a); - if (ret < 0) { - printf("ERROR: Failed to modify panel properties\n"); - return -1; - } - } - - /* After all modifications are done, install the modified DTB in the EFI configuration table */ - efi_ret = efi_install_configuration_table(&efi_guid_fdt, blob); - if (efi_ret != EFI_SUCCESS) { - printf("ERROR: Failed to install FDT in configuration table: %ld\n", efi_ret); - return efi_ret; - } - } - - return 0; -} - /* U-Boot only supports USB high-speed mode on Qualcomm platforms with DWC3 * USB controllers. Rather than requiring source level DT changes, we fix up * DT here. This improves compatibility with upstream DT and simplifies the @@ -271,11 +163,6 @@ int ft_board_setup(void *blob, struct bd_info __maybe_unused *bd) { struct fdt_header *fdt = blob; int node; - int ret = 0; - - ret = fixup_retroid_fdt(blob); - if (ret < 0) - printf("WARNING: Failed to modify device tree: %d\n", ret); /* On RB2 we need to fix-up the dr_mode */ if (!fdt_node_check_compatible(fdt, 0, "qcom,qrb4210-rb2")) { diff --git a/arch/arm/mach-snapdragon/qcom-priv.h b/arch/arm/mach-snapdragon/qcom-priv.h index 34d9f9ca4b3d..509af7ac561b 100644 --- a/arch/arm/mach-snapdragon/qcom-priv.h +++ b/arch/arm/mach-snapdragon/qcom-priv.h @@ -6,6 +6,8 @@ #include bool is_retroid_pocketmini(void); +bool is_retroid_pocketmini_v2(void); +bool is_retroid_pocketflip2(void); #if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) void qcom_configure_capsule_updates(void); diff --git a/board/qualcomm/retroidpocket.config b/board/qualcomm/retroidpocket.config index 25a86bea9ddc..b5f15b2007db 100644 --- a/board/qualcomm/retroidpocket.config +++ b/board/qualcomm/retroidpocket.config @@ -12,3 +12,5 @@ CONFIG_BOOTSTD_IGNORE_BOOTABLE=y CONFIG_BOOT_RETRY=y CONFIG_BOOT_RETRY_TIME=1 CONFIG_CONSOLE_ROTATION=y + +CONFIG_CMD_POWEROFF=y diff --git a/board/qualcomm/retroidpocket.env b/board/qualcomm/retroidpocket.env index 947ba33a2703..b0b6310dd4f2 100644 --- a/board/qualcomm/retroidpocket.env +++ b/board/qualcomm/retroidpocket.env @@ -11,4 +11,15 @@ button_cmd_0=run menucmd # Override bootcmd to return to the menu so boot retry will # just open the menu again. menucmd=setenv bootcmd run menucmd; bootmenu -1 -bootcmd=bootefi bootmgr; pause + +bootcmd= \ + if load scsi 0:18 ${loadaddr} /boot.scr; then \ + setenv device "scsi 0:18"; \ + source ${loadaddr}; \ + else \ + if load mmc 0:1 ${loadaddr} boot.scr; then \ + setenv device "mmc 0:1"; \ + source ${loadaddr}; \ + fi; \ + fi; \ + bootefi bootmgr; pause diff --git a/boot/image-fdt.c b/boot/image-fdt.c index 3d5b6f9e2dc7..43cb184b24fc 100644 --- a/boot/image-fdt.c +++ b/boot/image-fdt.c @@ -249,15 +249,19 @@ int boot_relocate_fdt(char **of_flat_tree, ulong *of_size) debug("## device tree at %p ... %p (len=%ld [0x%lX])\n", fdt_blob, fdt_blob + *of_size - 1, of_len, of_len); +#if 0 printf(" Loading Device Tree to %p, end %p ... ", of_start, of_start + of_len - 1); +#endif err = fdt_open_into(fdt_blob, of_start, of_len); if (err != 0) { fdt_error("fdt move failed"); goto error; } +#if 0 puts("OK\n"); +#endif } *of_flat_tree = of_start; @@ -425,8 +429,10 @@ static int select_fdt(struct bootm_headers *images, const char *select, u8 arch, * FDT blob */ debug("* fdt: raw FDT blob\n"); +#if 0 printf("## Flattened Device Tree blob at %08lx\n", (long)fdt_addr); +#endif } break; default: @@ -456,7 +462,9 @@ int boot_get_fdt(void *buf, const char *select, uint arch, goto no_fdt; else if (ret) return 1; +#if 0 printf(" Booting using the fdt blob at %#08lx\n", fdt_addr); +#endif fdt_blob = map_sysmem(fdt_addr, 0); } else if (images->legacy_hdr_valid && image_check_type(&images->legacy_hdr_os_copy, diff --git a/cmd/fdt.c b/cmd/fdt.c index d16b141ce32d..18075e7dd8a9 100644 --- a/cmd/fdt.c +++ b/cmd/fdt.c @@ -46,7 +46,9 @@ static void set_working_fdt_addr_quiet(ulong addr) void set_working_fdt_addr(ulong addr) { +#if 0 printf("Working FDT set to %lx\n", addr); +#endif set_working_fdt_addr_quiet(addr); } diff --git a/cmd/source.c b/cmd/source.c index c9b5f8e400a6..dbc0b33fab0a 100644 --- a/cmd/source.c +++ b/cmd/source.c @@ -48,7 +48,9 @@ static int do_source(struct cmd_tbl *cmdtp, int flag, int argc, debug("* source: cmdline image address = 0x%08lx\n", addr); } +#if 0 printf ("## Executing script at %08lx\n", addr); +#endif rcode = cmd_source_script(addr, fit_uname, confname); return rcode; } diff --git a/disk/part.c b/disk/part.c index 4fb86f28269f..9be3792e6f60 100644 --- a/disk/part.c +++ b/disk/part.c @@ -601,7 +601,9 @@ int blk_get_device_part_str(const char *ifname, const char *dev_part_str, if (part != PART_AUTO) { ret = part_get_info(*desc, part, info); if (ret) { +#if 0 printf("** Invalid partition %d **\n", part); +#endif goto cleanup; } } else { @@ -772,8 +774,10 @@ int part_get_info_by_dev_and_name_or_num(const char *dev_iface, ret = blk_get_device_part_str(dev_iface, dev_part_str, desc, part_info, allow_whole_dev); if (ret < 0) +#if 0 printf("Couldn't find partition %s %s\n", dev_iface, dev_part_str); +#endif return ret; } @@ -837,4 +841,4 @@ struct udevice *part_get_by_guid(const char *guid, struct disk_partition **info) *info = NULL; return ERR_PTR(-ENOENT); } -#endif \ No newline at end of file +#endif diff --git a/drivers/gpio/qcom_pmic_gpio.c b/drivers/gpio/qcom_pmic_gpio.c index 5be1cbfe12db..2125294d3b5c 100644 --- a/drivers/gpio/qcom_pmic_gpio.c +++ b/drivers/gpio/qcom_pmic_gpio.c @@ -364,7 +364,7 @@ static const struct udevice_id qcom_gpio_ids[] = { { .compatible = "qcom,pm8998-gpio" }, { .compatible = "qcom,pms405-gpio" }, { .compatible = "qcom,pm6125-gpio" }, - { .compatible = "qcom,pm8150-gpio" }, + { .compatible = "qcom,pm8150-gpio", .data = QCOM_PMIC_QUIRK_READONLY }, { .compatible = "qcom,pm8550-gpio", .data = QCOM_PMIC_QUIRK_READONLY }, { .compatible = "qcom,pm7325-gpio" }, { } diff --git a/drivers/video/simplefb.c b/drivers/video/simplefb.c index 4b2a5bbad717..0866a6a07558 100644 --- a/drivers/video/simplefb.c +++ b/drivers/video/simplefb.c @@ -48,16 +48,22 @@ static int simple_video_probe(struct udevice *dev) log_err("%s: invalid width or height: %d\n", __func__, ret); return ret ?: -EINVAL; } - ofnode_read_u32(node, "rot", &rot); - uc_priv->rot = rot; - uc_priv->xsize = width; - uc_priv->ysize = height; - if (is_retroid_pocketmini()) { - uc_priv->xsize = 1280; - uc_priv->ysize = 960; - uc_priv->line_length = 960 * 4; + if (is_retroid_pocketmini_v2()) { + uc_priv->xsize = 1080; + uc_priv->ysize = 1240; + uc_priv->line_length = 1080 * 4; + } else { + uc_priv->xsize = 960; + uc_priv->ysize = 1280; + uc_priv->line_length = 960 * 4; + } + } else { + uc_priv->xsize = width; + uc_priv->ysize = height; } + ofnode_read_u32(node, "rot", &rot); + uc_priv->rot = rot; format = ofnode_read_string(node, "format"); debug("%s: %dx%d@%s\n", __func__, uc_priv->xsize, uc_priv->ysize, format); diff --git a/fs/fs.c b/fs/fs.c index 1afa0fbeaed9..7b45eeee5faa 100644 --- a/fs/fs.c +++ b/fs/fs.c @@ -795,6 +795,7 @@ int do_load(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[], (argc > 4) ? argv[4] : "", map_sysmem(addr, 0), len_read); +#if 0 printf("%llu bytes read in %lu ms", len_read, time); if (time > 0) { puts(" ("); @@ -802,6 +803,7 @@ int do_load(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[], puts(")"); } puts("\n"); +#endif env_set_hex("fileaddr", addr); env_set_hex("filesize", len_read);