diff options
Diffstat (limited to 'drivers/fastboot/fb_mmc.c')
-rw-r--r-- | drivers/fastboot/fb_mmc.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/drivers/fastboot/fb_mmc.c b/drivers/fastboot/fb_mmc.c index cbb3f7b1de..ef51a5ed67 100644 --- a/drivers/fastboot/fb_mmc.c +++ b/drivers/fastboot/fb_mmc.c @@ -20,7 +20,11 @@ #include <linux/compat.h> #include <android_image.h> +#ifdef CONFIG_FASTBOOT_STARFIVE_MAX_BLK_WRITE +#define FASTBOOT_MAX_BLK_WRITE CONFIG_FASTBOOT_STARFIVE_MAX_BLK_WRITE /* = 8192 */ +#else #define FASTBOOT_MAX_BLK_WRITE 16384 +#endif #define BOOT_PARTITION_NAME "boot" @@ -513,6 +517,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 +611,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; |