Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions arch/arm/lib/bootm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
60 changes: 60 additions & 0 deletions arch/arm/mach-snapdragon/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <u-boot/md5.h>
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 } };
Expand Down Expand Up @@ -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);
Expand Down
113 changes: 0 additions & 113 deletions arch/arm/mach-snapdragon/of_fixup.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,114 +30,6 @@
#include <efi_api.h>
#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
Expand Down Expand Up @@ -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")) {
Expand Down
2 changes: 2 additions & 0 deletions arch/arm/mach-snapdragon/qcom-priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#include <stdbool.h>

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);
Expand Down
2 changes: 2 additions & 0 deletions board/qualcomm/retroidpocket.config
Original file line number Diff line number Diff line change
Expand Up @@ -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
13 changes: 12 additions & 1 deletion board/qualcomm/retroidpocket.env
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 8 additions & 0 deletions boot/image-fdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions cmd/fdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
2 changes: 2 additions & 0 deletions cmd/source.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
6 changes: 5 additions & 1 deletion disk/part.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -837,4 +841,4 @@ struct udevice *part_get_by_guid(const char *guid, struct disk_partition **info)
*info = NULL;
return ERR_PTR(-ENOENT);
}
#endif
#endif
2 changes: 1 addition & 1 deletion drivers/gpio/qcom_pmic_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
{ }
Expand Down
22 changes: 14 additions & 8 deletions drivers/video/simplefb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions fs/fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -795,13 +795,15 @@ 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(" (");
print_size(div_u64(len_read, time) * 1000, "/s");
puts(")");
}
puts("\n");
#endif

env_set_hex("fileaddr", addr);
env_set_hex("filesize", len_read);
Expand Down