summaryrefslogtreecommitdiff
path: root/common/cmd_burnup.c
diff options
context:
space:
mode:
authorSam Wu <yihui.wu@amlogic.com>2019-02-20 13:48:35 +0800
committerDongjin Kim <tobetter@gmail.com>2019-05-16 13:17:13 +0900
commit5aa4091f5ba339fae52ad4ddd0739e5ee8d232ca (patch)
treeb58e5455da2938d746ed6b550bbafc111466a1e0 /common/cmd_burnup.c
parent072d68201be56c70e85afb7bb81f99dfea24c7f7 (diff)
downloadu-boot-odroid-c1-5aa4091f5ba339fae52ad4ddd0739e5ee8d232ca.tar.gz
factoryBurn: mmc: support upgrade whole mmc
PD#SWPL-4992 Problem: customer requires flashing whole mmc in bootloader mode, rather than enter recovery mode which has selinux issue. Solution: support "sdc_update/usb_update 1 emmc.bin" in bootloader mode support "update partition 1 emmc.bin" in bootloader mode Verify: test pass by project Change-Id: Ied3eda01a1840d3242fa3598bd88de30c8468f6c Signed-off-by: Sam Wu <yihui.wu@amlogic.com>
Diffstat (limited to 'common/cmd_burnup.c')
-rw-r--r--common/cmd_burnup.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/common/cmd_burnup.c b/common/cmd_burnup.c
index 4c1308ac69..f566325bb2 100644
--- a/common/cmd_burnup.c
+++ b/common/cmd_burnup.c
@@ -7,6 +7,7 @@
#include <div64.h>
#include <linux/err.h>
#include <partition_table.h>
+#include <mmc.h>
#define DbgP(fmt...) //printf("[burnupDbg]"fmt)
#define MsgP(fmt...) printf("[burnup]"fmt)
@@ -88,6 +89,23 @@ int store_write_ops(unsigned char *partition_name,unsigned char * buf, uint64_t
name = partition_name;
addr = (unsigned long)buf;
+ if ((EMMC_BOOT_FLAG == device_boot_flag) && !strcmp("1", (char*)name))
+ {
+ if (off & 0x1ff) {
+ ErrP("emmc1 invalid offset 0x%llx\n", off);
+ return -__LINE__;
+ }
+ if (size & 0xff) {
+ MsgP("NOT align sz 0x%llx\n", size);
+ }
+ sprintf(str, "mmc write 0x%p 0x%llx 0x%llx", buf, (off>>9), (size>>9));
+ ret = run_command(str, 0);
+ if (ret) {
+ ErrP("Fail in cmd[%s]\n", str);
+ return -__LINE__;
+ }
+ return ret;
+ }
#if CONFIG_AML_MTD
if ((size & MtdAlignMask) && (NAND_BOOT_FLAG == device_boot_flag )) {
@@ -127,6 +145,31 @@ int store_get_partititon_size(unsigned char *partition_name, uint64_t *size)
char str[128];
int ret=0;
+ if (isdigit(*partition_name) && 1 == strlen((char*)partition_name))
+ {
+ const int curDev = *partition_name - '0';
+ sprintf(str, "mmc dev %d", curDev);
+ MsgP("cmd[%s]\n", str);
+ if (run_command(str, 0)) {
+ ErrP("Fail probe dev %d\n", curDev);
+ return 0;
+ }
+ struct mmc *mmc = find_mmc_device(curDev);
+ if (!mmc) {
+ ErrP("Fail find mmc %s\n", partition_name);
+ return 0;
+ }
+ if (mmc_init(mmc)) {
+ ErrP("FAil init mmc %s\n", partition_name);
+ return 0;
+ }
+ MsgP("mmc %s capacity 0x%llx\n", partition_name, mmc->capacity);
+ *size = mmc->capacity;
+ run_command("store disprotect key", 0);
+ MsgP("cmd[%s]\n", str);
+ return 0;
+ }
+
sprintf(str, "%s size %s 0x%p ",cmd_name, partition_name, size);
store_dbg("command: %s", str);
ret = run_command(str, 0);