From: Steve Rae <srae@broadcom.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v4 2/5] usb/gadget: fastboot: add support for flash command
Date: Wed, 6 Aug 2014 16:55:10 -0700 [thread overview]
Message-ID: <1407369313-13815-3-git-send-email-srae@broadcom.com> (raw)
In-Reply-To: <1407369313-13815-1-git-send-email-srae@broadcom.com>
- implement 'fastboot flash' for eMMC devices
Signed-off-by: Steve Rae <srae@broadcom.com>
Reviewed-by: Marek Vasut <marex@denx.de>
---
Changes in v4: None
Changes in v3: None
Changes in v2:
- update README.android-fastboot file
README | 10 ++++++++++
doc/README.android-fastboot | 5 +++--
drivers/usb/gadget/f_fastboot.c | 31 +++++++++++++++++++++++++++++++
3 files changed, 44 insertions(+), 2 deletions(-)
diff --git a/README b/README
index 1d71359..ed26884 100644
--- a/README
+++ b/README
@@ -1623,6 +1623,16 @@ The following options need to be configured:
downloads. This buffer should be as large as possible for a
platform. Define this to the size available RAM for fastboot.
+ CONFIG_FASTBOOT_FLASH
+ The fastboot protocol includes a "flash" command for writing
+ the downloaded image to a non-volatile storage device. Define
+ this to enable the "fastboot flash" command.
+
+ CONFIG_FASTBOOT_FLASH_MMC_DEV
+ The fastboot "flash" command requires addition information
+ regarding the non-volatile storage device. Define this to
+ the eMMC device that fastboot should use to store the image.
+
- Journaling Flash filesystem support:
CONFIG_JFFS2_NAND, CONFIG_JFFS2_NAND_OFF, CONFIG_JFFS2_NAND_SIZE,
CONFIG_JFFS2_NAND_DEV
diff --git a/doc/README.android-fastboot b/doc/README.android-fastboot
index f1d128c..430e29c 100644
--- a/doc/README.android-fastboot
+++ b/doc/README.android-fastboot
@@ -6,8 +6,9 @@ Overview
The protocol that is used over USB is described in
README.android-fastboot-protocol in same directory.
-The current implementation does not yet support the flash and erase
-commands.
+The current implementation does not yet support the erase command or the
+"oem format" command, and there is minimal support for the flash command;
+it only supports eMMC devices.
Client installation
===================
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index 7a1acb9..e2659fa 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -19,6 +19,9 @@
#include <linux/compiler.h>
#include <version.h>
#include <g_dnl.h>
+#ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
+#include <fb_mmc.h>
+#endif
#define FASTBOOT_VERSION "0.4"
@@ -469,6 +472,28 @@ static void cb_boot(struct usb_ep *ep, struct usb_request *req)
fastboot_tx_write_str("OKAY");
}
+#ifdef CONFIG_FASTBOOT_FLASH
+static void cb_flash(struct usb_ep *ep, struct usb_request *req)
+{
+ char *cmd = req->buf;
+ char response[RESPONSE_LEN];
+
+ strsep(&cmd, ":");
+ if (!cmd) {
+ printf("%s: missing partition name\n", __func__);
+ fastboot_tx_write_str("FAILmissing partition name");
+ return;
+ }
+
+ strcpy(response, "FAILno flash device defined");
+#ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
+ fb_mmc_flash_write(cmd, (void *)CONFIG_USB_FASTBOOT_BUF_ADDR,
+ download_bytes, response);
+#endif
+ fastboot_tx_write_str(response);
+}
+#endif
+
struct cmd_dispatch_info {
char *cmd;
void (*cb)(struct usb_ep *ep, struct usb_request *req);
@@ -488,6 +513,12 @@ static const struct cmd_dispatch_info cmd_dispatch_info[] = {
.cmd = "boot",
.cb = cb_boot,
},
+#ifdef CONFIG_FASTBOOT_FLASH
+ {
+ .cmd = "flash",
+ .cb = cb_flash,
+ },
+#endif
};
static void rx_handler_command(struct usb_ep *ep, struct usb_request *req)
--
1.8.5
next prev parent reply other threads:[~2014-08-06 23:55 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-06 23:55 [U-Boot] [PATCH v4 0/5] Implement "fastboot flash" for eMMC Steve Rae
2014-08-06 23:55 ` [U-Boot] [PATCH v4 1/5] usb/gadget: fastboot: add eMMC support for flash command Steve Rae
2014-08-06 23:55 ` Steve Rae [this message]
2014-08-06 23:55 ` [U-Boot] [PATCH v4 3/5] usb/gadget: fastboot: minor cleanup Steve Rae
2014-08-06 23:55 ` [U-Boot] [PATCH v4 4/5] usb/gadget: fastboot: add sparse image definitions Steve Rae
2014-08-07 0:14 ` Marek Vasut
2014-08-07 0:31 ` Steve Rae
2014-08-07 0:37 ` Marek Vasut
2014-08-07 5:36 ` Wolfgang Denk
2014-08-07 13:11 ` Marek Vasut
2014-08-07 5:34 ` Wolfgang Denk
2014-08-07 13:09 ` Marek Vasut
2014-08-07 13:29 ` Sebastian Andrzej Siewior
2014-08-07 13:45 ` Marek Vasut
2014-08-07 13:51 ` Sebastian Andrzej Siewior
2014-08-07 14:12 ` Marek Vasut
2014-08-07 16:40 ` Steve Rae
2014-08-07 20:59 ` Wolfgang Denk
2014-08-07 21:02 ` Jeroen Hofstee
2014-08-07 21:10 ` Wolfgang Denk
2014-08-07 21:15 ` Jeroen Hofstee
2014-08-07 21:19 ` Jeroen Hofstee
2014-08-07 21:36 ` Wolfgang Denk
2014-08-07 21:43 ` Marek Vasut
2014-08-07 22:17 ` Wolfgang Denk
2014-08-09 12:48 ` Marek Vasut
2014-08-09 16:53 ` Steve Rae
2014-08-10 20:42 ` Marek Vasut
2014-08-07 21:49 ` Marek Vasut
2014-08-06 23:55 ` [U-Boot] [PATCH v4 5/5] usb/gadget: fastboot: implement sparse format Steve Rae
2014-08-07 0:16 ` [U-Boot] [PATCH v4 0/5] Implement "fastboot flash" for eMMC Marek Vasut
2014-08-07 0:29 ` Steve Rae
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1407369313-13815-3-git-send-email-srae@broadcom.com \
--to=srae@broadcom.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox