Skip to content

Commit 398aa9a

Browse files
Manan Auroragregkh
authored andcommitted
usb: dwc3: Support EBC feature of DWC_usb31
Support configuration and use of bulk endpoints in the so-called EBC mode described in the DBC_usb31 databook (appendix E) Added a bit fifo_mode to usb_ep to indicate to the UDC driver that a specific endpoint is to operate in the EBC (or equivalent) mode when enabled Added macros for bits 15 and 14 of DEPCFG parameter 1 to indicate EBC mode and write back behaviour. These bits will be set to 1 when configuring an EBC endpoint as described in the programming guide Signed-off-by: Manan Aurora <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent cd099cd commit 398aa9a

File tree

4 files changed

+10
-0
lines changed

4 files changed

+10
-0
lines changed

drivers/usb/dwc3/core.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,7 @@
376376
/* Global HWPARAMS4 Register */
377377
#define DWC3_GHWPARAMS4_HIBER_SCRATCHBUFS(n) (((n) & (0x0f << 13)) >> 13)
378378
#define DWC3_MAX_HIBER_SCRATCHBUFS 15
379+
#define DWC3_EXT_BUFF_CONTROL BIT(21)
379380

380381
/* Global HWPARAMS6 Register */
381382
#define DWC3_GHWPARAMS6_BCSUPPORT BIT(14)

drivers/usb/dwc3/gadget.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -673,6 +673,12 @@ static int dwc3_gadget_set_ep_config(struct dwc3_ep *dep, unsigned int action)
673673
params.param1 |= DWC3_DEPCFG_BINTERVAL_M1(bInterval_m1);
674674
}
675675

676+
if (dep->endpoint.fifo_mode) {
677+
if (!(dwc->hwparams.hwparams4 & DWC3_EXT_BUFF_CONTROL))
678+
return -EINVAL;
679+
params.param1 |= DWC3_DEPCFG_EBC_HWO_NOWB | DWC3_DEPCFG_USE_EBC;
680+
}
681+
676682
return dwc3_send_gadget_ep_cmd(dep, DWC3_DEPCMD_SETEPCONFIG, &params);
677683
}
678684

drivers/usb/dwc3/gadget.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ struct dwc3;
2626
#define DWC3_DEPCFG_XFER_NOT_READY_EN BIT(10)
2727
#define DWC3_DEPCFG_FIFO_ERROR_EN BIT(11)
2828
#define DWC3_DEPCFG_STREAM_EVENT_EN BIT(13)
29+
#define DWC3_DEPCFG_EBC_HWO_NOWB BIT(14)
30+
#define DWC3_DEPCFG_USE_EBC BIT(15)
2931
#define DWC3_DEPCFG_BINTERVAL_M1(n) (((n) & 0xff) << 16)
3032
#define DWC3_DEPCFG_STREAM_CAPABLE BIT(24)
3133
#define DWC3_DEPCFG_EP_NUMBER(n) (((n) & 0x1f) << 25)

include/linux/usb/gadget.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ struct usb_ep {
236236
unsigned max_streams:16;
237237
unsigned mult:2;
238238
unsigned maxburst:5;
239+
unsigned fifo_mode:1;
239240
u8 address;
240241
const struct usb_endpoint_descriptor *desc;
241242
const struct usb_ss_ep_comp_descriptor *comp_desc;

0 commit comments

Comments
 (0)