Message ID | 1424300035-19634-2-git-send-email-dileep.katta@linaro.org |
---|---|
State | New |
Headers | show |
On Wed, Feb 18, 2015 at 4:53 PM, Dileep Katta <dileep.katta@linaro.org> wrote: > Fastboot oem command is updated with SPI specific functionality. > > Signed-off-by: Dileep Katta <dileep.katta@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); This doesn't enable SPI boot, but just erases the SPI. We already have erase and format commands. I suppose you have 2 xloader/bootloader partitions on SPI and MMC and want to select which one to flash? But you have no way to select which device to actually boot from. This could all be supported without this by enforcing that the SPI have unique partition names. Rob > + 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 >
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",
Fastboot oem command is updated with SPI specific functionality. Signed-off-by: Dileep Katta <dileep.katta@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(+)