]> www.infradead.org Git - users/jedix/linux-maple.git/commit
usb: gadget: f_fs: add capability for dfu functional descriptor
authorDavid Sands <david.sands@biamp.com>
Sun, 11 Aug 2024 00:00:05 +0000 (20:00 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 13 Aug 2024 08:38:46 +0000 (10:38 +0200)
commitc26cee817f8bd9a22bfade20f739ec2fc6f20221
tree43d98a2db376657d3b740632f2bea82a02763d21
parentd1e14e06810a96ef0cdabf572513594031d4dad6
usb: gadget: f_fs: add capability for dfu functional descriptor

Add the ability for the USB FunctionFS (FFS) gadget driver to be able
to create Device Firmware Upgrade (DFU) functional descriptors. [1]

This patch allows implementation of DFU in userspace using the
FFS gadget. The DFU protocol uses the control pipe (ep0) for all
messaging so only the addition of the DFU functional descriptor
is needed in the kernel driver.

The DFU functional descriptor is written to the ep0 file along with
any other descriptors during FFS setup. DFU requires an interface
descriptor followed by the DFU functional descriptor.

This patch includes documentation of the added descriptor for DFU
and conversion of some existing documentation to kernel-doc format
so that it can be included in the generated docs.

An implementation of DFU 1.1 that implements just the runtime descriptor
using the FunctionFS gadget (with rebooting into u-boot for DFU mode)
has been tested on an i.MX8 Nano.

An implementation of DFU 1.1 that implements both runtime and DFU mode
using the FunctionFS gadget has been tested on Xilinx Zynq UltraScale+.
Note that for the best performance of firmware update file transfers, the
userspace program should respond as quick as possible to the setup packets.

[1] https://www.usb.org/sites/default/files/DFU_1.1.pdf

Signed-off-by: David Sands <david.sands@biamp.com>
Co-developed-by: Chris Wulff <crwulff@gmail.com>
Signed-off-by: Chris Wulff <crwulff@gmail.com>
Link: https://lore.kernel.org/r/20240811000004.1395888-2-crwulff@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Documentation/usb/functionfs-desc.rst [new file with mode: 0644]
Documentation/usb/functionfs.rst
Documentation/usb/index.rst
drivers/usb/gadget/function/f_fs.c
include/uapi/linux/usb/ch9.h
include/uapi/linux/usb/functionfs.h