public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Lukasz Majewski <l.majewski@samsung.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3] fastboot: add support for reboot-bootloader command
Date: Thu, 26 Feb 2015 11:22:30 +0100	[thread overview]
Message-ID: <20150226112230.78fe4b1e@amdc2363> (raw)
In-Reply-To: <1424873447-22426-1-git-send-email-alexey_firago@mentor.com>

Hi Alexey,

> The "fastboot reboot-bootloader" command is defined to
> re-enter into fastboot mode after rebooting into
> bootloader. This command is usually used after updating
> bootloader via fastboot.
> 
> This commit implements only a generic side of the
> command - setting of the reset flag and then resetting.
> Setting of the reset flag is implemented using __weak
> fb_set_reboot_flag() function. The actual setting and
> checking of the reset flag should be implemented by
> a boot script and/or board/SoC specific code.
> 
> Signed-off-by: Alexey Firago <alexey_firago@mentor.com>
> ---
> 
> Changes in v3:
> - return -ENOSYS from default fb_set_reboot_flag()
> 
> Changes in v2:
> - return error in default fb_set_reboot_flag()
> 
>  drivers/usb/gadget/f_fastboot.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/drivers/usb/gadget/f_fastboot.c
> b/drivers/usb/gadget/f_fastboot.c index 310175a..a000c25 100644
> --- a/drivers/usb/gadget/f_fastboot.c
> +++ b/drivers/usb/gadget/f_fastboot.c
> @@ -122,6 +122,7 @@ static struct usb_gadget_strings
> *fastboot_strings[] = { };
>  
>  static void rx_handler_command(struct usb_ep *ep, struct usb_request
> *req); +static int strcmp_l1(const char *s1, const char *s2);
>  
>  static void fastboot_complete(struct usb_ep *ep, struct usb_request
> *req) {
> @@ -317,8 +318,20 @@ static void compl_do_reset(struct usb_ep *ep,
> struct usb_request *req) do_reset(NULL, 0, 0, NULL);
>  }
>  
> +int __weak fb_set_reboot_flag(void)
> +{
> +	return -ENOSYS;
> +}
> +
>  static void cb_reboot(struct usb_ep *ep, struct usb_request *req)
>  {
> +	char *cmd = req->buf;
> +	if (!strcmp_l1("reboot-bootloader", cmd)) {
> +		if (fb_set_reboot_flag()) {
> +			fastboot_tx_write_str("FAILCannot set reboot
> flag");
> +			return;
> +		}
> +	}
>  	fastboot_func->in_req->complete = compl_do_reset;
>  	fastboot_tx_write_str("OKAY");
>  }

Applied to u-boot-dfu.

Thanks for patch!

-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

  reply	other threads:[~2015-02-26 10:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-25 14:10 [U-Boot] [PATCH v3] fastboot: add support for reboot-bootloader command Alexey Firago
2015-02-26 10:22 ` Lukasz Majewski [this message]
2015-03-05  9:15   ` Alexey Firago
2015-03-05 10:04     ` Lukasz Majewski
2015-03-05 11:29       ` Alexey Firago
2015-03-06  0:10 ` Steve Rae
2015-03-23  9:17   ` Lukasz Majewski

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=20150226112230.78fe4b1e@amdc2363 \
    --to=l.majewski@samsung.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