summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLi Jun <jun.li@nxp.com>2016-02-19 03:04:42 +0100
committerFelipe Balbi <balbi@kernel.org>2016-03-04 14:14:36 +0100
commitae57e97a95211397b46a40f8cb0a23966c054bc5 (patch)
tree3d6f2248f4edb3e5d1e5d3ea19b9c8ea97862ac3 /include
parentusb: add OTG status selector definition for HNP polling (diff)
downloadlinux-ae57e97a95211397b46a40f8cb0a23966c054bc5.tar.xz
linux-ae57e97a95211397b46a40f8cb0a23966c054bc5.zip
usb: common: otg-fsm: add HNP polling support
Adds HNP polling timer when transits to host state, the OTG status request will be sent to peripheral after timeout, if host request flag is set, it will switch to peripheral state, otherwise it will repeat HNP polling every 1.5s and maintain the current session. Acked-by: Peter Chen <peter.chen@nxp.com> Signed-off-by: Li Jun <jun.li@nxp.com> Signed-off-by: Felipe Balbi <balbi@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/usb/otg-fsm.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/linux/usb/otg-fsm.h b/include/linux/usb/otg-fsm.h
index f728f1854829..3059a9599f53 100644
--- a/include/linux/usb/otg-fsm.h
+++ b/include/linux/usb/otg-fsm.h
@@ -40,6 +40,18 @@
#define PROTO_HOST (1)
#define PROTO_GADGET (2)
+#define OTG_STS_SELECTOR 0xF000 /* OTG status selector, according to
+ * OTG and EH 2.0 Chapter 6.2.3
+ * Table:6-4
+ */
+
+#define HOST_REQUEST_FLAG 1 /* Host request flag, according to
+ * OTG and EH 2.0 Charpter 6.2.3
+ * Table:6-5
+ */
+
+#define T_HOST_REQ_POLL (1500) /* 1500ms, HNP polling interval */
+
enum otg_fsm_timer {
/* Standard OTG timers */
A_WAIT_VRISE,
@@ -119,6 +131,8 @@ struct otg_fsm {
/* Current usb protocol used: 0:undefine; 1:host; 2:client */
int protocol;
struct mutex lock;
+ u8 *host_req_flag;
+ struct delayed_work hnp_polling_work;
};
struct otg_fsm_ops {