summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXingyu Wu <xingyu.wu@starfivetech.com>2023-09-06 11:58:00 +0300
committerXingyu Wu <xingyu.wu@starfivetech.com>2023-09-07 04:34:13 +0300
commit0c23a7095f57bc91df7980f7597f3fb84e223d57 (patch)
treee71a30c9d66cbe25e5090942c2ae41fcd0b1c759
parent3e6f524ed4d35695de2318351aeab81f7171087c (diff)
downloadu-boot-0c23a7095f57bc91df7980f7597f3fb84e223d57.tar.xz
driver: fastboot: Add new flag to load image file without partition
Add new flag to load image file to preset address without partition. Signed-off-by: Xingyu Wu <xingyu.wu@starfivetech.com>
-rw-r--r--drivers/fastboot/fb_mmc.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/drivers/fastboot/fb_mmc.c b/drivers/fastboot/fb_mmc.c
index cbb3f7b1de..d645ab4d86 100644
--- a/drivers/fastboot/fb_mmc.c
+++ b/drivers/fastboot/fb_mmc.c
@@ -513,6 +513,7 @@ void fastboot_mmc_flash_write(const char *cmd, void *download_buffer,
{
struct blk_desc *dev_desc;
struct disk_partition info = {0};
+ char *fastboot_env;
#ifdef CONFIG_FASTBOOT_MMC_BOOT_SUPPORT
if (strcmp(cmd, CONFIG_FASTBOOT_MMC_BOOT1_NAME) == 0) {
@@ -606,6 +607,52 @@ void fastboot_mmc_flash_write(const char *cmd, void *download_buffer,
}
#endif
+ /* Fastboot for StarFive JH7110 SoC */
+ fastboot_env = env_get("fb_sf_flag");
+ if (fastboot_env) {
+ dev_desc = blk_get_dev("mmc", 0);
+ if (!dev_desc)
+ return;
+
+ if (strcmp(cmd, "all") == 0) {
+ strlcpy((char *)&info.name, cmd, sizeof(info.name));
+ info.start = 0x0;
+ info.size = 0x80000000;
+ info.blksz = 0x200;
+ } else if (strcmp(cmd, "part") == 0) {
+ strlcpy((char *)&info.name, cmd, sizeof(info.name));
+ info.start = 0x0;
+ info.size = 0x1000;
+ info.blksz = 0x200;
+ } else if (strcmp(cmd, "spl") == 0) {
+ strlcpy((char *)&info.name, cmd, sizeof(info.name));
+ info.start = 0x1000;
+ info.size = 0x1000;
+ info.blksz = 0x200;
+ } else if (strcmp(cmd, "uboot") == 0) {
+ strlcpy((char *)&info.name, cmd, sizeof(info.name));
+ info.start = 0x2000;
+ info.size = 0x2000;
+ info.blksz = 0x200;
+ } else if (strcmp(cmd, "image") == 0) {
+ fastboot_env = env_get("fb_sf_image_addr");
+ if (fastboot_env) {
+ strlcpy((char *)&info.name, cmd, sizeof(info.name));
+ info.start = simple_strtoul(fastboot_env, NULL, 16);
+ info.size = 0x92000;
+ info.blksz = 0x200;
+ }
+ } else if (strcmp(cmd, "root") == 0) {
+ fastboot_env = env_get("fb_sf_root_addr");
+ if (fastboot_env) {
+ strlcpy((char *)&info.name, cmd, sizeof(info.name));
+ info.start = simple_strtoul(fastboot_env, NULL, 16);
+ info.size = 0x80000000;
+ info.blksz = 0x200;
+ }
+ }
+ }
+
if (!info.name[0] &&
fastboot_mmc_get_part_info(cmd, &dev_desc, &info, response) < 0)
return;