1 From ec89a34069e9d33dd8f809c02a12ffb619d67e1f Mon Sep 17 00:00:00 2001
2 From: Li Jun <jun.li@nxp.com>
3 Date: Wed, 12 Apr 2017 05:31:17 +0800
4 Subject: [PATCH] MLK-14285-1 usb: phy: add usb mode for usb_phy
6 USB phy driver may need to know the current working mode of
7 the controller, and does some different settings according to
8 host mode or device mode.
10 Signed-off-by: Li Jun <jun.li@nxp.com>
11 (cherry picked from commit 2286cb30feedd6f4a5cb82a0f0af5aa3a04ab698)
12 Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
13 Signed-off-by: Srikanth Krishnakar <Srikanth_Krishnakar@mentor.com>
15 include/linux/usb/phy.h | 19 +++++++++++++++++++
16 1 file changed, 19 insertions(+)
18 --- a/include/linux/usb/phy.h
19 +++ b/include/linux/usb/phy.h
20 @@ -63,6 +63,13 @@ enum usb_otg_state {
24 +/* The usb role of phy to be working with */
25 +enum usb_current_mode {
28 + CUR_USB_MODE_DEVICE,
34 @@ -161,6 +168,9 @@ struct usb_phy {
35 int (*notify_resume)(struct usb_phy *x,
36 enum usb_device_speed speed);
38 + int (*set_mode)(struct usb_phy *x,
39 + enum usb_current_mode mode);
43 /* for board-specific init logic */
44 @@ -219,6 +229,15 @@ usb_phy_vbus_off(struct usb_phy *x)
45 return x->set_vbus(x, false);
49 +usb_phy_set_mode(struct usb_phy *x, enum usb_current_mode mode)
51 + if (!x || !x->set_mode)
54 + return x->set_mode(x, mode);
57 /* for usb host and peripheral controller drivers */
58 #if IS_ENABLED(CONFIG_USB_PHY)
59 extern struct usb_phy *usb_get_phy(enum usb_phy_type type);