2 * f_dfu.h -- Device Firmware Update gadget
4 * Copyright (C) 2011-2012 Samsung Electronics
5 * author: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
7 * SPDX-License-Identifier: GPL-2.0+
13 #include <linux/compiler.h>
14 #include <linux/usb/composite.h>
16 #define DFU_CONFIG_VAL 1
17 #define DFU_DT_FUNC 0x21
19 #define DFU_BIT_WILL_DETACH (0x1 << 3)
20 #define DFU_BIT_MANIFESTATION_TOLERANT (0x1 << 2)
21 #define DFU_BIT_CAN_UPLOAD (0x1 << 1)
22 #define DFU_BIT_CAN_DNLOAD 0x1
24 /* big enough to hold our biggest descriptor */
25 #define DFU_USB_BUFSIZ 4096
27 #define USB_REQ_DFU_DETACH 0x00
28 #define USB_REQ_DFU_DNLOAD 0x01
29 #define USB_REQ_DFU_UPLOAD 0x02
30 #define USB_REQ_DFU_GETSTATUS 0x03
31 #define USB_REQ_DFU_CLRSTATUS 0x04
32 #define USB_REQ_DFU_GETSTATE 0x05
33 #define USB_REQ_DFU_ABORT 0x06
35 #define DFU_STATUS_OK 0x00
36 #define DFU_STATUS_errTARGET 0x01
37 #define DFU_STATUS_errFILE 0x02
38 #define DFU_STATUS_errWRITE 0x03
39 #define DFU_STATUS_errERASE 0x04
40 #define DFU_STATUS_errCHECK_ERASED 0x05
41 #define DFU_STATUS_errPROG 0x06
42 #define DFU_STATUS_errVERIFY 0x07
43 #define DFU_STATUS_errADDRESS 0x08
44 #define DFU_STATUS_errNOTDONE 0x09
45 #define DFU_STATUS_errFIRMWARE 0x0a
46 #define DFU_STATUS_errVENDOR 0x0b
47 #define DFU_STATUS_errUSBR 0x0c
48 #define DFU_STATUS_errPOR 0x0d
49 #define DFU_STATUS_errUNKNOWN 0x0e
50 #define DFU_STATUS_errSTALLEDPKT 0x0f
54 #define RET_STAT_LEN 6
57 DFU_STATE_appIDLE
= 0,
58 DFU_STATE_appDETACH
= 1,
59 DFU_STATE_dfuIDLE
= 2,
60 DFU_STATE_dfuDNLOAD_SYNC
= 3,
61 DFU_STATE_dfuDNBUSY
= 4,
62 DFU_STATE_dfuDNLOAD_IDLE
= 5,
63 DFU_STATE_dfuMANIFEST_SYNC
= 6,
64 DFU_STATE_dfuMANIFEST
= 7,
65 DFU_STATE_dfuMANIFEST_WAIT_RST
= 8,
66 DFU_STATE_dfuUPLOAD_IDLE
= 9,
67 DFU_STATE_dfuERROR
= 10,
72 __u8 bwPollTimeout
[3];
77 struct dfu_function_descriptor
{
81 __le16 wDetachTimeOut
;
86 #define DFU_POLL_TIMEOUT_MASK (0xFFFFFFUL)
87 #endif /* __F_DFU_H_ */