summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorRob Herring <robh@kernel.org>2015-01-26 21:49:01 (GMT)
committerMarek Vasut <marex@denx.de>2015-02-25 16:47:02 (GMT)
commit372d7decfe972966c49b337f3d2888e09004dbe4 (patch)
treea17c3427f6aefe7757ead1409984f140be46a6a5 /drivers
parentde1956202e24bc490787192b443a1a8e8048c83b (diff)
downloadu-boot-372d7decfe972966c49b337f3d2888e09004dbe4.tar.xz
fastboot: add support for "oem format" command
Add "oem format" command to write partition table. This relies on the env variable partitions to contain the list of partitions as required by the gpt command. Note that this does not erase any data other than the partition table. Signed-off-by: Rob Herring <robh@kernel.org> Reviewed-by: Steve Rae <srae@broadcom.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/gadget/f_fastboot.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index e2fda86..f7d84bf 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -516,6 +516,17 @@ static void cb_flash(struct usb_ep *ep, struct usb_request *req)
static void cb_oem(struct usb_ep *ep, struct usb_request *req)
{
char *cmd = req->buf;
+#ifdef CONFIG_FASTBOOT_FLASH
+ if (strncmp("format", cmd + 4, 6) == 0) {
+ char cmdbuf[32];
+ sprintf(cmdbuf, "gpt write mmc %x $partitions",
+ CONFIG_FASTBOOT_FLASH_MMC_DEV);
+ if (run_command(cmdbuf, 0))
+ fastboot_tx_write_str("FAIL");
+ else
+ fastboot_tx_write_str("OKAY");
+ } else
+#endif
if (strncmp("unlock", cmd + 4, 8) == 0) {
fastboot_tx_write_str("FAILnot implemented");
}