aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/usb
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-11-05 00:26:27 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-11-05 00:26:27 -0500
commit3d6f47801c34e42da26e2b6b29706f0bfe423978 (patch)
tree98062d64ec5d1f4034f67265c7d933cf6c04aec6 /include/linux/usb
parente0700ce70921fbe3d1913968c663beb9df2b01a9 (diff)
parent0bbc367e21bfeea33230d893be4fa3a3ff9bcb48 (diff)
Merge tag 'usb-4.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB updates from Greg KH: "Here is the big USB patchset for 4.4-rc1. As usual, most of the changes are in the gadget subsystem, and we removed a host controller for a device that is no longer in existance, and probably never was even made public. There is also other minor driver updates and new device ids, full details in the changelog. All of these have been in linux-next for a while" * tag 'usb-4.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (233 commits) USB: core: Codestyle fix in urb.c usb: misc: usb3503: Use i2c_add_driver helper macro usb: host: lpc32xx: don't unregister phy device usb: host: lpc32xx: balance clk enable/disable on removal usb: host: lpc32xx: fix warnings caused by enabling unprepared clock uwb: drp: Use setup_timer uwb: neh: Use setup_timer uwb: rsv: Use setup_timer USB: qcserial: add Sierra Wireless MC74xx/EM74xx usb: chipidea: otg: don't wait vbus drops below BSV when starts host chipidea: ci_hdrc_pci: use PCI_VDEVICE() instead of PCI_DEVICE() doc: dt-binding: ci-hdrc-usb2: split vendor specific properties usb: chipidea: imx: add imx6ul usb support doc: dt-binding: ci-hdrc-usb2: improve property description usb: chipidea: imx: add usb support for imx7d Doc: usb: ci-hdrc-usb2: Add phy-clkgate-delay-us entry usb: chipidea: Add support for 'phy-clkgate-delay-us' property usb: chipidea: Use extcon framework for VBUS and ID detect usb: gadget: net2280: restore ep_cfg after defect7374 workaround usb: dwc2: host: Fix use after free w/ simultaneous irqs ...
Diffstat (limited to 'include/linux/usb')
-rw-r--r--include/linux/usb/ch9.h11
-rw-r--r--include/linux/usb/chipidea.h24
-rw-r--r--include/linux/usb/gadget.h29
-rw-r--r--include/linux/usb/hcd.h26
-rw-r--r--include/linux/usb/musb.h2
-rw-r--r--include/linux/usb/of.h12
-rw-r--r--include/linux/usb/otg.h9
-rw-r--r--include/linux/usb/phy.h8
8 files changed, 94 insertions, 27 deletions
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
index 27603bcbb9b9..6cc96bb12ddc 100644
--- a/include/linux/usb/ch9.h
+++ b/include/linux/usb/ch9.h
@@ -32,9 +32,9 @@
32#ifndef __LINUX_USB_CH9_H 32#ifndef __LINUX_USB_CH9_H
33#define __LINUX_USB_CH9_H 33#define __LINUX_USB_CH9_H
34 34
35#include <linux/device.h>
35#include <uapi/linux/usb/ch9.h> 36#include <uapi/linux/usb/ch9.h>
36 37
37
38/** 38/**
39 * usb_speed_string() - Returns human readable-name of the speed. 39 * usb_speed_string() - Returns human readable-name of the speed.
40 * @speed: The speed to return human-readable name for. If it's not 40 * @speed: The speed to return human-readable name for. If it's not
@@ -43,6 +43,15 @@
43 */ 43 */
44extern const char *usb_speed_string(enum usb_device_speed speed); 44extern const char *usb_speed_string(enum usb_device_speed speed);
45 45
46/**
47 * usb_get_maximum_speed - Get maximum requested speed for a given USB
48 * controller.
49 * @dev: Pointer to the given USB controller device
50 *
51 * The function gets the maximum speed string from property "maximum-speed",
52 * and returns the corresponding enum usb_device_speed.
53 */
54extern enum usb_device_speed usb_get_maximum_speed(struct device *dev);
46 55
47/** 56/**
48 * usb_state_string - Returns human readable name for the state. 57 * usb_state_string - Returns human readable name for the state.
diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h
index a41833cd184c..5dd75fa47dd8 100644
--- a/include/linux/usb/chipidea.h
+++ b/include/linux/usb/chipidea.h
@@ -5,9 +5,28 @@
5#ifndef __LINUX_USB_CHIPIDEA_H 5#ifndef __LINUX_USB_CHIPIDEA_H
6#define __LINUX_USB_CHIPIDEA_H 6#define __LINUX_USB_CHIPIDEA_H
7 7
8#include <linux/extcon.h>
8#include <linux/usb/otg.h> 9#include <linux/usb/otg.h>
9 10
10struct ci_hdrc; 11struct ci_hdrc;
12
13/**
14 * struct ci_hdrc_cable - structure for external connector cable state tracking
15 * @state: current state of the line
16 * @changed: set to true when extcon event happen
17 * @edev: device which generate events
18 * @ci: driver state of the chipidea device
19 * @nb: hold event notification callback
20 * @conn: used for notification registration
21 */
22struct ci_hdrc_cable {
23 bool state;
24 bool changed;
25 struct extcon_dev *edev;
26 struct ci_hdrc *ci;
27 struct notifier_block nb;
28};
29
11struct ci_hdrc_platform_data { 30struct ci_hdrc_platform_data {
12 const char *name; 31 const char *name;
13 /* offset of the capability registers */ 32 /* offset of the capability registers */
@@ -48,6 +67,11 @@ struct ci_hdrc_platform_data {
48 u32 ahb_burst_config; 67 u32 ahb_burst_config;
49 u32 tx_burst_size; 68 u32 tx_burst_size;
50 u32 rx_burst_size; 69 u32 rx_burst_size;
70
71 /* VBUS and ID signal state tracking, using extcon framework */
72 struct ci_hdrc_cable vbus_extcon;
73 struct ci_hdrc_cable id_extcon;
74 u32 phy_clkgate_delay_us;
51}; 75};
52 76
53/* Default offset of capability registers */ 77/* Default offset of capability registers */
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index c14a69b36d27..3d583a10b926 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -215,6 +215,7 @@ struct usb_ep {
215 struct list_head ep_list; 215 struct list_head ep_list;
216 struct usb_ep_caps caps; 216 struct usb_ep_caps caps;
217 bool claimed; 217 bool claimed;
218 bool enabled;
218 unsigned maxpacket:16; 219 unsigned maxpacket:16;
219 unsigned maxpacket_limit:16; 220 unsigned maxpacket_limit:16;
220 unsigned max_streams:16; 221 unsigned max_streams:16;
@@ -264,7 +265,18 @@ static inline void usb_ep_set_maxpacket_limit(struct usb_ep *ep,
264 */ 265 */
265static inline int usb_ep_enable(struct usb_ep *ep) 266static inline int usb_ep_enable(struct usb_ep *ep)
266{ 267{
267 return ep->ops->enable(ep, ep->desc); 268 int ret;
269
270 if (ep->enabled)
271 return 0;
272
273 ret = ep->ops->enable(ep, ep->desc);
274 if (ret)
275 return ret;
276
277 ep->enabled = true;
278
279 return 0;
268} 280}
269 281
270/** 282/**
@@ -281,7 +293,18 @@ static inline int usb_ep_enable(struct usb_ep *ep)
281 */ 293 */
282static inline int usb_ep_disable(struct usb_ep *ep) 294static inline int usb_ep_disable(struct usb_ep *ep)
283{ 295{
284 return ep->ops->disable(ep); 296 int ret;
297
298 if (!ep->enabled)
299 return 0;
300
301 ret = ep->ops->disable(ep);
302 if (ret)
303 return ret;
304
305 ep->enabled = false;
306
307 return 0;
285} 308}
286 309
287/** 310/**
@@ -1233,6 +1256,8 @@ extern struct usb_ep *usb_ep_autoconfig_ss(struct usb_gadget *,
1233 struct usb_endpoint_descriptor *, 1256 struct usb_endpoint_descriptor *,
1234 struct usb_ss_ep_comp_descriptor *); 1257 struct usb_ss_ep_comp_descriptor *);
1235 1258
1259extern void usb_ep_autoconfig_release(struct usb_ep *);
1260
1236extern void usb_ep_autoconfig_reset(struct usb_gadget *); 1261extern void usb_ep_autoconfig_reset(struct usb_gadget *);
1237 1262
1238#endif /* __LINUX_USB_GADGET_H */ 1263#endif /* __LINUX_USB_GADGET_H */
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index d2784c10bfe2..f89c24bd53a4 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -58,12 +58,6 @@
58 * 58 *
59 * Since "struct usb_bus" is so thin, you can't share much code in it. 59 * Since "struct usb_bus" is so thin, you can't share much code in it.
60 * This framework is a layer over that, and should be more sharable. 60 * This framework is a layer over that, and should be more sharable.
61 *
62 * @authorized_default: Specifies if new devices are authorized to
63 * connect by default or they require explicit
64 * user space authorization; this bit is settable
65 * through /sys/class/usb_host/X/authorized_default.
66 * For the rest is RO, so we don't lock to r/w it.
67 */ 61 */
68 62
69/*-------------------------------------------------------------------------*/ 63/*-------------------------------------------------------------------------*/
@@ -120,6 +114,8 @@ struct usb_hcd {
120#define HCD_FLAG_WAKEUP_PENDING 4 /* root hub is resuming? */ 114#define HCD_FLAG_WAKEUP_PENDING 4 /* root hub is resuming? */
121#define HCD_FLAG_RH_RUNNING 5 /* root hub is running? */ 115#define HCD_FLAG_RH_RUNNING 5 /* root hub is running? */
122#define HCD_FLAG_DEAD 6 /* controller has died? */ 116#define HCD_FLAG_DEAD 6 /* controller has died? */
117#define HCD_FLAG_INTF_AUTHORIZED 7 /* authorize interfaces? */
118#define HCD_FLAG_DEV_AUTHORIZED 8 /* authorize devices? */
123 119
124 /* The flags can be tested using these macros; they are likely to 120 /* The flags can be tested using these macros; they are likely to
125 * be slightly faster than test_bit(). 121 * be slightly faster than test_bit().
@@ -131,6 +127,22 @@ struct usb_hcd {
131#define HCD_RH_RUNNING(hcd) ((hcd)->flags & (1U << HCD_FLAG_RH_RUNNING)) 127#define HCD_RH_RUNNING(hcd) ((hcd)->flags & (1U << HCD_FLAG_RH_RUNNING))
132#define HCD_DEAD(hcd) ((hcd)->flags & (1U << HCD_FLAG_DEAD)) 128#define HCD_DEAD(hcd) ((hcd)->flags & (1U << HCD_FLAG_DEAD))
133 129
130 /*
131 * Specifies if interfaces are authorized by default
132 * or they require explicit user space authorization; this bit is
133 * settable through /sys/class/usb_host/X/interface_authorized_default
134 */
135#define HCD_INTF_AUTHORIZED(hcd) \
136 ((hcd)->flags & (1U << HCD_FLAG_INTF_AUTHORIZED))
137
138 /*
139 * Specifies if devices are authorized by default
140 * or they require explicit user space authorization; this bit is
141 * settable through /sys/class/usb_host/X/authorized_default
142 */
143#define HCD_DEV_AUTHORIZED(hcd) \
144 ((hcd)->flags & (1U << HCD_FLAG_DEV_AUTHORIZED))
145
134 /* Flags that get set only during HCD registration or removal. */ 146 /* Flags that get set only during HCD registration or removal. */
135 unsigned rh_registered:1;/* is root hub registered? */ 147 unsigned rh_registered:1;/* is root hub registered? */
136 unsigned rh_pollable:1; /* may we poll the root hub? */ 148 unsigned rh_pollable:1; /* may we poll the root hub? */
@@ -141,7 +153,6 @@ struct usb_hcd {
141 * support the new root-hub polling mechanism. */ 153 * support the new root-hub polling mechanism. */
142 unsigned uses_new_polling:1; 154 unsigned uses_new_polling:1;
143 unsigned wireless:1; /* Wireless USB HCD */ 155 unsigned wireless:1; /* Wireless USB HCD */
144 unsigned authorized_default:1;
145 unsigned has_tt:1; /* Integrated TT in root hub */ 156 unsigned has_tt:1; /* Integrated TT in root hub */
146 unsigned amd_resume_bug:1; /* AMD remote wakeup quirk */ 157 unsigned amd_resume_bug:1; /* AMD remote wakeup quirk */
147 unsigned can_do_streams:1; /* HC supports streams */ 158 unsigned can_do_streams:1; /* HC supports streams */
@@ -239,6 +250,7 @@ struct hc_driver {
239#define HCD_USB2 0x0020 /* USB 2.0 */ 250#define HCD_USB2 0x0020 /* USB 2.0 */
240#define HCD_USB25 0x0030 /* Wireless USB 1.0 (USB 2.5)*/ 251#define HCD_USB25 0x0030 /* Wireless USB 1.0 (USB 2.5)*/
241#define HCD_USB3 0x0040 /* USB 3.0 */ 252#define HCD_USB3 0x0040 /* USB 3.0 */
253#define HCD_USB31 0x0050 /* USB 3.1 */
242#define HCD_MASK 0x0070 254#define HCD_MASK 0x0070
243#define HCD_BH 0x0100 /* URB complete in BH context */ 255#define HCD_BH 0x0100 /* URB complete in BH context */
244 256
diff --git a/include/linux/usb/musb.h b/include/linux/usb/musb.h
index a4ee1b582183..fa6dc132bd1b 100644
--- a/include/linux/usb/musb.h
+++ b/include/linux/usb/musb.h
@@ -95,7 +95,7 @@ struct musb_hdrc_config {
95 /* musb CLKIN in Blackfin in MHZ */ 95 /* musb CLKIN in Blackfin in MHZ */
96 unsigned char clkin; 96 unsigned char clkin;
97#endif 97#endif
98 98 u32 maximum_speed;
99}; 99};
100 100
101struct musb_hdrc_platform_data { 101struct musb_hdrc_platform_data {
diff --git a/include/linux/usb/of.h b/include/linux/usb/of.h
index 8c5a818ec244..c3fe9e48ce27 100644
--- a/include/linux/usb/of.h
+++ b/include/linux/usb/of.h
@@ -12,22 +12,10 @@
12#include <linux/usb/phy.h> 12#include <linux/usb/phy.h>
13 13
14#if IS_ENABLED(CONFIG_OF) 14#if IS_ENABLED(CONFIG_OF)
15enum usb_dr_mode of_usb_get_dr_mode(struct device_node *np);
16enum usb_device_speed of_usb_get_maximum_speed(struct device_node *np);
17bool of_usb_host_tpl_support(struct device_node *np); 15bool of_usb_host_tpl_support(struct device_node *np);
18int of_usb_update_otg_caps(struct device_node *np, 16int of_usb_update_otg_caps(struct device_node *np,
19 struct usb_otg_caps *otg_caps); 17 struct usb_otg_caps *otg_caps);
20#else 18#else
21static inline enum usb_dr_mode of_usb_get_dr_mode(struct device_node *np)
22{
23 return USB_DR_MODE_UNKNOWN;
24}
25
26static inline enum usb_device_speed
27of_usb_get_maximum_speed(struct device_node *np)
28{
29 return USB_SPEED_UNKNOWN;
30}
31static inline bool of_usb_host_tpl_support(struct device_node *np) 19static inline bool of_usb_host_tpl_support(struct device_node *np)
32{ 20{
33 return false; 21 return false;
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index bd1dcf816100..67929df86df5 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -119,4 +119,13 @@ enum usb_dr_mode {
119 USB_DR_MODE_OTG, 119 USB_DR_MODE_OTG,
120}; 120};
121 121
122/**
123 * usb_get_dr_mode - Get dual role mode for given device
124 * @dev: Pointer to the given device
125 *
126 * The function gets phy interface string from property 'dr_mode',
127 * and returns the correspondig enum usb_dr_mode
128 */
129extern enum usb_dr_mode usb_get_dr_mode(struct device *dev);
130
122#endif /* __LINUX_USB_OTG_H */ 131#endif /* __LINUX_USB_OTG_H */
diff --git a/include/linux/usb/phy.h b/include/linux/usb/phy.h
index e39f251cf861..31a8068c42a5 100644
--- a/include/linux/usb/phy.h
+++ b/include/linux/usb/phy.h
@@ -63,7 +63,7 @@ enum usb_otg_state {
63struct usb_phy; 63struct usb_phy;
64struct usb_otg; 64struct usb_otg;
65 65
66/* for transceivers connected thru an ULPI interface, the user must 66/* for phys connected thru an ULPI interface, the user must
67 * provide access ops 67 * provide access ops
68 */ 68 */
69struct usb_phy_io_ops { 69struct usb_phy_io_ops {
@@ -92,10 +92,10 @@ struct usb_phy {
92 u16 port_status; 92 u16 port_status;
93 u16 port_change; 93 u16 port_change;
94 94
95 /* to support controllers that have multiple transceivers */ 95 /* to support controllers that have multiple phys */
96 struct list_head head; 96 struct list_head head;
97 97
98 /* initialize/shutdown the OTG controller */ 98 /* initialize/shutdown the phy */
99 int (*init)(struct usb_phy *x); 99 int (*init)(struct usb_phy *x);
100 void (*shutdown)(struct usb_phy *x); 100 void (*shutdown)(struct usb_phy *x);
101 101
@@ -106,7 +106,7 @@ struct usb_phy {
106 int (*set_power)(struct usb_phy *x, 106 int (*set_power)(struct usb_phy *x,
107 unsigned mA); 107 unsigned mA);
108 108
109 /* Set transceiver into suspend mode */ 109 /* Set phy into suspend mode */
110 int (*set_suspend)(struct usb_phy *x, 110 int (*set_suspend)(struct usb_phy *x,
111 int suspend); 111 int suspend);
112 112