Skip to contentSkip to conversation

fastboot: add support for reboot-bootloader command

PATCH Superseded Alexey Firago 3 participants 7 messages Feb 25, 2015 – Mar 23, 2015 USB

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 fastboot: add support for reboot-bootloader command

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.

---

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(+)
drivers/usb/gadget/f_fastboot.c +13 -0
index 310175a..a000c25 100644
@@ -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");
 }
Signature · 1 line
1.9.1
#1 lore raw

PATCH v3 1/1 fastboot: add support for reboot-bootloader command

Hi Alexey,

Quoted 57 lines

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.

---

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(+)
(quoted diff) +0 -0

b/drivers/usb/gadget/f_fastboot.c index 310175a..a000c25 100644

drivers/usb/gadget/f_fastboot.c +0 -0
@@ -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) {

drivers/usb/gadget/f_fastboot.c +12 -0
@@ -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");
Quoted 1 line

}

Applied to u-boot-dfu.

Thanks for patch!

Signature · 5 lines
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
#2 lore raw

PATCH v3 1/1 fastboot: add support for reboot-bootloader command

Hi Lukasz,

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

Thanks,
Alexey

Quoted 64 lines · Lukasz Majewski

Hi Alexey,

Quoted 57 lines

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.

---

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(+)
(quoted diff) +0 -0

b/drivers/usb/gadget/f_fastboot.c index 310175a..a000c25 100644

drivers/usb/gadget/f_fastboot.c +0 -0
@@ -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) {

drivers/usb/gadget/f_fastboot.c +12 -0
@@ -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");
Quoted 1 line
  }

Applied to u-boot-dfu.

Thanks for patch!

#3 lore raw

PATCH v3 1/1 fastboot: add support for reboot-bootloader command

Hi Alexey,

Quoted 4 lines

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

Quoted 70 lines

Thanks,
Alexey

Quoted 64 lines · Lukasz Majewski

Hi Alexey,

Quoted 57 lines

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.

---

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(+)
(quoted diff) +0 -0

b/drivers/usb/gadget/f_fastboot.c index 310175a..a000c25 100644

drivers/usb/gadget/f_fastboot.c +0 -0
@@ -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) {

drivers/usb/gadget/f_fastboot.c +12 -0
@@ -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");
Quoted 1 line
  }

Applied to u-boot-dfu.

Thanks for patch!

Signature · 5 lines
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
#4 lore raw

PATCH v3 1/1 fastboot: add support for reboot-bootloader command

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

Quoted 6 lines · Lukasz Majewski

Hi Alexey,

Quoted 4 lines

Hi Lukasz,

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

Quoted 78 lines

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

Quoted 68 lines

Thanks,
Alexey

Quoted 64 lines · Lukasz Majewski

Hi Alexey,

Quoted 57 lines

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.

---

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(+)
(quoted diff) +0 -0

b/drivers/usb/gadget/f_fastboot.c index 310175a..a000c25 100644

drivers/usb/gadget/f_fastboot.c +0 -0
@@ -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) {

drivers/usb/gadget/f_fastboot.c +12 -0
@@ -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");
Quoted 1 line
   }

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>

#5 lore raw

PATCH v3 1/1 fastboot: add support for reboot-bootloader command

In reply to Alexey Firago
Quoted 48 lines · Alexey Firago

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.

---

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(+)
drivers/usb/gadget/f_fastboot.c +6 -0
index 310175a..a000c25 100644
@@ -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)
  {

drivers/usb/gadget/f_fastboot.c static void compl_do_reset(struct usb_ep *ep, struct usb_request *req) · line 337

Quoted 10 lines
drivers/usb/gadget/f_fastboot.c +7 -0
+	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");
  }

(on bcm28155_ap board)
Thanks!

#6 lore raw

PATCH v3 1/1 fastboot: add support for reboot-bootloader command

Hi Steve,

Quoted 66 lines · Alexey Firago
Quoted 58 lines

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.

---

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(+)
(quoted diff) +0 -0

b/drivers/usb/gadget/f_fastboot.c index 310175a..a000c25 100644

drivers/usb/gadget/f_fastboot.c +0 -0
@@ -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) {

drivers/usb/gadget/f_fastboot.c +12 -0
@@ -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");
Quoted 2 lines
  }
Quoted 2 lines

(on bcm28155_ap board)
Thanks!

Applied to u-boot-dfu tree. Thanks!

Signature · 5 lines
Best regards,

Lukasz Majewski

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