All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v3] fastboot: add support for reboot-bootloader command
@ 2015-02-25 14:10 Alexey Firago
  2015-02-26 10:22 ` Lukasz Majewski
  2015-03-06  0:10 ` Steve Rae
  0 siblings, 2 replies; 7+ messages in thread
From: Alexey Firago @ 2015-02-25 14:10 UTC (permalink / raw)
  To: u-boot

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");
 }
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH v3] fastboot: add support for reboot-bootloader command
  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
  2015-03-05  9:15   ` Alexey Firago
  2015-03-06  0:10 ` Steve Rae
  1 sibling, 1 reply; 7+ messages in thread
From: Lukasz Majewski @ 2015-02-26 10:22 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH v3] fastboot: add support for reboot-bootloader command
  2015-02-26 10:22 ` Lukasz Majewski
@ 2015-03-05  9:15   ` Alexey Firago
  2015-03-05 10:04     ` Lukasz Majewski
  0 siblings, 1 reply; 7+ messages in thread
From: Alexey Firago @ 2015-03-05  9:15 UTC (permalink / raw)
  To: u-boot

Hi Lukasz,

Hmm, I don't see it applied to u-boot-dfu now. Do I need to add something ?

Thanks,
Alexey

On 26.02.2015 13:22, Lukasz Majewski wrote:
> 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!
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH v3] fastboot: add support for reboot-bootloader command
  2015-03-05  9:15   ` Alexey Firago
@ 2015-03-05 10:04     ` Lukasz Majewski
  2015-03-05 11:29       ` Alexey Firago
  0 siblings, 1 reply; 7+ messages in thread
From: Lukasz Majewski @ 2015-03-05 10:04 UTC (permalink / raw)
  To: u-boot

Hi Alexey,

> Hi Lukasz,
> 
> Hmm, I don't see it applied to u-boot-dfu now. Do I need to add
> something ?

If possible, please look into the current status of fastboot support in
u-boot mainline (since we are at -rc3).

Since I'm not (yet) a fastboot user, please support me with testing.

Best regards,
Lukasz

> 
> Thanks,
> Alexey
> 
> On 26.02.2015 13:22, Lukasz Majewski wrote:
> > 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH v3] fastboot: add support for reboot-bootloader command
  2015-03-05 10:04     ` Lukasz Majewski
@ 2015-03-05 11:29       ` Alexey Firago
  0 siblings, 0 replies; 7+ messages in thread
From: Alexey Firago @ 2015-03-05 11:29 UTC (permalink / raw)
  To: u-boot

Lukasz,

Here is how I've tested "v3 fastboot: add support for reboot-bootloader 
command" patch:

* Applied it to master ( 7ae8350f67eea861280a4cbd2d067777a0e87153)
* Board to test - Nitrogen6q
* Applied attached 
"0001-test-nitrogen6x-fastboot-add-reboot-bootloader-suppo.patch" with 
the board specific flags handling functions and envs
* On "fastboot reboot-bootloader" command, nitrogen6x specific 
fb_set_reboot_flag() is called, setting bit in the SNVS_LPGPR register 
(as in Freescale's releases)
* On reboot board checks this bit in board's misc_init_r() and sets 
"fastboot_flag" env accordingly
* bootscript handles "fastboot_flag"

Let me know if I've missed something.

Regards,
Alexey

On 05.03.2015 13:04, Lukasz Majewski wrote:
> Hi Alexey,
>
>> Hi Lukasz,
>>
>> Hmm, I don't see it applied to u-boot-dfu now. Do I need to add
>> something ?
> If possible, please look into the current status of fastboot support in
> u-boot mainline (since we are at -rc3).
>
> Since I'm not (yet) a fastboot user, please support me with testing.
>
> Best regards,
> Lukasz
>
>> Thanks,
>> Alexey
>>
>> On 26.02.2015 13:22, Lukasz Majewski wrote:
>>> 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!
>>>
>
>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-test-nitrogen6x-fastboot-add-reboot-bootloader-suppo.patch
Type: text/x-patch
Size: 2819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150305/aef9a3dd/attachment.bin>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH v3] fastboot: add support for reboot-bootloader command
  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
@ 2015-03-06  0:10 ` Steve Rae
  2015-03-23  9:17   ` Lukasz Majewski
  1 sibling, 1 reply; 7+ messages in thread
From: Steve Rae @ 2015-03-06  0:10 UTC (permalink / raw)
  To: u-boot



On 15-02-25 06:10 AM, Alexey Firago wrote:
> 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");
>   }
>

Tested-by: Steve Rae <srae@broadcom.com>

(on bcm28155_ap board)
Thanks!

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH v3] fastboot: add support for reboot-bootloader command
  2015-03-06  0:10 ` Steve Rae
@ 2015-03-23  9:17   ` Lukasz Majewski
  0 siblings, 0 replies; 7+ messages in thread
From: Lukasz Majewski @ 2015-03-23  9:17 UTC (permalink / raw)
  To: u-boot

Hi Steve,

> 
> 
> On 15-02-25 06:10 AM, Alexey Firago wrote:
> > 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");
> >   }
> >
> 
> Tested-by: Steve Rae <srae@broadcom.com>
> 
> (on bcm28155_ap board)
> Thanks!

Applied to u-boot-dfu tree. Thanks!

-- 
Best regards,

Lukasz Majewski

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-03-23  9:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.