[U-Boot] [PATCH v1 2/2] fastboot: Add support in fastboot oem command to set QSPI as boot device
Dileep Katta
dileep.katta at linaro.org
Wed Feb 18 23:53:55 CET 2015
Fastboot oem command is updated with SPI specific functionality.
Signed-off-by: Dileep Katta <dileep.katta at linaro.org>
---
Note: This is on top of Rob Herring patches submitted to support oem format command
Ref: https://patchwork.ozlabs.org/patch/433056/
https://patchwork.ozlabs.org/patch/433057/
drivers/usb/gadget/f_fastboot.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index a170eea..04fa4c2 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -591,7 +591,33 @@ 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
+#ifdef CONFIG_SPL_SPI_SUPPORT
+ char *sf_erase[4] = {"sf", "erase", "0", "20000"};
+ int status;
+ char *sf_probe[3] = {"sf", "probe", "0"};
+ if (strncmp(req->buf + 4, "spi", 3) == 0) {
+ boot_from_spi = 1;
+ status = do_spi_flash(NULL, 0, 3, sf_probe);
+ if (status) {
+ fastboot_tx_write_str("FAILcould not probe SPI");
+ return;
+ }
+ status = do_spi_flash(NULL, 0, 4, sf_erase);
+ if (status) {
+ fastboot_tx_write_str("FAILcould not erase SPI");
+ return;
+ }
+ fastboot_tx_write_str("OKAY");
+ return;
+ } else if (strncmp(req->buf + 4, "mmc", 3) == 0) {
+ boot_from_spi = 0;
+ fastboot_tx_write_str("OKAY");
+ return;
+ }
+#endif
+
if (strncmp("format", cmd + 4, 6) == 0) {
char cmdbuf[32];
sprintf(cmdbuf, "gpt write mmc %x $partitions",
--
1.8.3.2
More information about the U-Boot
mailing list