summaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc3/core.h
diff options
context:
space:
mode:
authorRoger Quadros <rogerq@ti.com>2017-04-04 12:49:18 +0300
committerFelipe Balbi <felipe.balbi@linux.intel.com>2017-04-11 10:58:30 +0300
commit41ce1456e1dbbc7355d0fcc10cf7c337c13def24 (patch)
treef5e52d7040ff415c60dceb757f598b5dc2330883 /drivers/usb/dwc3/core.h
parentb202c42cbf812070ae1d47209d12512226d1d8a5 (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.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index 3464dbfe153b..1fe23e36485f 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -28,6 +28,7 @@
#include <linux/mm.h>
#include <linux/debugfs.h>
#include <linux/wait.h>
+#include <linux/workqueue.h>
#include <linux/usb/ch9.h>
#include <linux/usb/gadget.h>
@@ -760,6 +761,7 @@ struct dwc3_scratchpad_array {
/**
* struct dwc3 - representation of our controller
+ * @drd_work - workqueue used for role swapping
* @ep0_trb: trb which is used for the ctrl_req
* @setup_buf: used while precessing STD USB requests
* @ep0_trb: dma address of ep0_trb
@@ -782,6 +784,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
@@ -855,6 +858,7 @@ struct dwc3_scratchpad_array {
* increments or 0 to disable.
*/
struct dwc3 {
+ struct work_struct drd_work;
struct dwc3_trb *ep0_trb;
void *bounce;
void *scratchbuf;
@@ -893,6 +897,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;
@@ -1002,7 +1007,7 @@ struct dwc3 {
u16 imod_interval;
};
-/* -------------------------------------------------------------------------- */
+#define work_to_dwc(w) (container_of((w), struct dwc3, drd_work))
/* -------------------------------------------------------------------------- */