summaryrefslogtreecommitdiff
path: root/drivers/usb/dwc3/core.h
diff options
context:
space:
mode:
authorRoger Quadros <rogerq@ti.com>2017-04-04 12:49:18 +0300
committerLeonard Crestez <leonard.crestez@nxp.com>2018-08-24 12:41:33 +0300
commit4522773e7fd32b2be7b5eccee7638ae02c7f45c5 (patch)
treed866e5e6124ca38973a5b19cbdfe1bb23c6d8b26 /drivers/usb/dwc3/core.h
parenta78539c2c75d12d659886d4b4b82c6edd8b0ffb0 (diff)
usb: dwc3: core: make dwc3_set_mode() work properly
We can't have both Host and Peripheral roles active at the same time because of one detail on DWC3: it shares the same memory area for both Host and Peripheral registers. When swapping roles we must reinitialize the new role every time. Let's make sure this works for our debugfs interface. Signed-off-by: Roger Quadros <rogerq@ti.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Diffstat (limited to 'drivers/usb/dwc3/core.h')
-rw-r--r--drivers/usb/dwc3/core.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index 315577e39b68..bd3a9588f885 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -741,6 +741,7 @@ struct dwc3_scratchpad_array {
/**
* struct dwc3 - representation of our controller
* @ctrl_req: usb control request which is used for ep0
+ * @drd_work - workqueue used for role swapping
* @ep0_trb: trb which is used for the ctrl_req
* @ep0_bounce: bounce buffer for ep0
* @zlp_buf: used when request->zero is set
@@ -766,6 +767,7 @@ struct dwc3_scratchpad_array {
* @revision: revision register contents
* @dr_mode: requested mode of operation
* @current_dr_role: current role of operation when in dual-role mode
+ * @desired_dr_role: desired role of operation when in dual-role mode
* @hsphy_mode: UTMI phy mode, one of following:
* - USBPHY_INTERFACE_MODE_UTMI
* - USBPHY_INTERFACE_MODE_UTMIW
@@ -839,6 +841,7 @@ struct dwc3_scratchpad_array {
*/
struct dwc3 {
struct usb_ctrlrequest *ctrl_req;
+ struct work_struct drd_work;
struct dwc3_trb *ep0_trb;
void *ep0_bounce;
void *zlp_buf;
@@ -877,6 +880,7 @@ struct dwc3 {
enum usb_dr_mode dr_mode;
u32 current_dr_role;
+ u32 desired_dr_role;
enum usb_phy_interface hsphy_mode;
u32 fladj;
@@ -984,7 +988,7 @@ struct dwc3 {
unsigned tx_de_emphasis:2;
};
-/* -------------------------------------------------------------------------- */
+#define work_to_dwc(w) (container_of((w), struct dwc3, drd_work))
/* -------------------------------------------------------------------------- */