Skip to contentSkip to conversation

Documentation: USB gadget: document usbgadget.fastboot_bbu variable

PATCH Applied Ladislav Michl 2 participants 3 messages Oct 26, 2018 – Oct 29, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Documentation: USB gadget: document usbgadget.fastboot_bbu variable

---
 Documentation/user/usb.rst | 2 ++
 1 file changed, 2 insertions(+)
Documentation/user/usb.rst +2 -0
index 8396f3897..b89d46bb6 100644
@@ -266,3 +266,5 @@ USB Gadget autostart Options
   See :ref:`command_usbgadget` -a. (Default 0).
 ``global.usbgadget.fastboot_function``
   Function description for fastboot. See :ref:`command_usbgadget` -A [desc].
+``global.usbgadget.fastboot_bbu``
+  Export barebox update handlers. See :ref:`command_usbgadget` -b. (Default 0).
Signature · 7 lines
2.19.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw

PATCH v2 2/2 usbgadget: autostart: add DFU support

Use global variable dfu_function to autostart DFU. As similar code is used to start multifunction gadget using command, move common code to common/usbgadget.c and consolidate it.
It turned out that '-s' option of usbgadget command does nothing, so remove its help text and make it function as '-a'.

---
Changes:
-v2: Add documentation, move prototy to the header, remove -s,
polishing...

 Documentation/user/usb.rst                    |  2 +
 commands/Kconfig                              |  1 -
 commands/usbgadget.c                          | 72 +++------------
 common/Kconfig                                |  7 ++
 common/Makefile                               |  1 +
 .../gadget/autostart.c => common/usbgadget.c  | 88 ++++++++++++++-----
 drivers/usb/gadget/Kconfig                    |  8 +-
 drivers/usb/gadget/Makefile                   |  1 -
 include/usb/gadget-multi.h                    |  4 +
 9 files changed, 95 insertions(+), 89 deletions(-)
 rename drivers/usb/gadget/autostart.c => common/usbgadget.c (51%)
Documentation/user/usb.rst +2 -0
index b89d46bb6..029e46354 100644
@@ -264,6 +264,8 @@ USB Gadget autostart Options
 ``global.usbgadget.acm``
   Boolean flag. If set to 1, CDC ACM function will be created.
   See :ref:`command_usbgadget` -a. (Default 0).
+``global.usbgadget.dfu_function``
+  Function description for DFU. See :ref:`command_usbgadget` -D [desc].
 ``global.usbgadget.fastboot_function``
   Function description for fastboot. See :ref:`command_usbgadget` -A [desc].
 ``global.usbgadget.fastboot_bbu``
commands/Kconfig +0 -1
index 675bd1ca7..1de4b9d60 100644
@@ -1910,7 +1910,6 @@ config CMD_USB
 config CMD_USBGADGET
 	bool
 	depends on USB_GADGET
-	select FILE_LIST
 	prompt "usbgadget"
 
 config CMD_WD
commands/usbgadget.c +11 -61

106 lines not on this page · raw message

common/Kconfig +7 -0
index eddd99ea3..2ad92158c 100644
@@ -115,6 +115,13 @@ config UBIFORMAT
 	depends on MTD_UBI
 	default y
 
+config USBGADGET_START
+	bool
+	depends on CMD_USBGADGET || USB_GADGET_AUTOSTART
+	select ENVIRONMENT_VARIABLES
+	select FILE_LIST
+	default y
+
 config BOOT
 	bool
 
common/Makefile +1 -0
index 13920cc5a..2b0f4cc98 100644
@@ -64,6 +64,7 @@ obj-$(CONFIG_UBIFORMAT)		+= ubiformat.o
 obj-$(CONFIG_BAREBOX_UPDATE_IMX_NAND_FCB) += imx-bbu-nand-fcb.o
 obj-$(CONFIG_BOOT)		+= boot.o
 obj-$(CONFIG_SERIAL_DEV_BUS)	+= serdev.o
+obj-$(CONFIG_USBGADGET_START)	+= usbgadget.o
 
 ifdef CONFIG_PASSWORD
 
common/usbgadget.c renamed from drivers/usb/gadget/autostart.c +67 -21

135 lines not on this page · raw message

drivers/usb/gadget/Kconfig +3 -5
index b0408e3bb..ca1bfc1b4 100644
@@ -33,13 +33,11 @@ config USB_GADGET_DRIVER_PXA27X
 config USB_GADGET_AUTOSTART
 	bool
 	default y
-	select ENVIRONMENT_VARIABLES
-	select FILE_LIST
 	prompt "Automatically start usbgadget on boot"
 	help
-	  Enabling this option allows to automatically start a fastboot
-	  gadget during boot. This behaviour is controlled with the
-	  global.usbgadget.fastboot_function variable.
+	  Enabling this option allows to automatically start a dfu or
+	  fastboot gadget during boot. This behaviour is controlled with
+	  the global.usbgadget.{dfu,fastboot}_function variable.
 
 comment "USB Gadget drivers"
 
drivers/usb/gadget/Makefile +0 -1
index e74cf0266..9ef594575 100644
@@ -1,6 +1,5 @@
 
 obj-$(CONFIG_USB_GADGET) += composite.o config.o usbstring.o epautoconf.o udc-core.o functions.o config.o multi.o
-obj-$(CONFIG_USB_GADGET_AUTOSTART) += autostart.o
 obj-$(CONFIG_USB_GADGET_SERIAL) += u_serial.o serial.o f_serial.o f_acm.o
 obj-$(CONFIG_USB_GADGET_DFU) += dfu.o
 obj-$(CONFIG_USB_GADGET_FASTBOOT) += f_fastboot.o
include/usb/gadget-multi.h +4 -0
index 81beddc7c..030e604fe 100644
@@ -16,4 +16,8 @@ int usb_multi_register(struct f_multi_opts *opts);
 void usb_multi_unregister(void);
 void usb_multi_opts_release(struct f_multi_opts *opts);
 
+int usbgadget_register(bool dfu, const char *dfu_opts,
+		       bool fastboot, const char *fastboot_opts,
+		       bool acm, bool export_bbu);
+
 #endif /* __USB_GADGET_MULTI_H */
Signature · 7 lines
2.19.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Applied
#2 lore raw
In reply to Ladislav Michl
Quoted 4 lines · Ladislav Michl
---
 Documentation/user/usb.rst | 2 ++
 1 file changed, 2 insertions(+)

Applied, thanks

Sascha

Quoted 20 lines
Documentation/user/usb.rst +2 -0
index 8396f3897..b89d46bb6 100644
@@ -266,3 +266,5 @@ USB Gadget autostart Options
   See :ref:`command_usbgadget` -a. (Default 0).
 ``global.usbgadget.fastboot_function``
   Function description for fastboot. See :ref:`command_usbgadget` -A [desc].
+``global.usbgadget.fastboot_bbu``
+  Export barebox update handlers. See :ref:`command_usbgadget` -b. (Default 0).
Signature · 7 lines
2.19.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox