aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/usb
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-04-05 18:18:00 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-04-05 18:18:00 -0400
commit64dc9e2e7320f079b97c46b106133b58b8e18d40 (patch)
treeab010dc1337d44e29c2b32b7f11788620a91fe4f /include/linux/usb
parent01a60e76b6392547ad3dca3ac05b9c886fa5da45 (diff)
parent9b192de60b5a584ee4ed967fb6758773c75e4643 (diff)
Merge tag 'usb-for-v3.10' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next
Felipe writes: usb: patches for v3.10 merge window Here is the big Gadget & PHY pull request. Many of us have been really busy lately getting multiple drivers to a better position. Since this pull request is so large, I will divide it in sections so it's easier to grasp what's included. - cleanups: . UDC drivers no longer touch gadget->dev, that's now udc-core responsibility . Many more UDC drivers converted to usb_gadget_map/unmap_request() . UDC drivers no longer initialize DMA-related fields from gadget's device structure . UDC drivers don't touch gadget.dev.driver directly . UDC drivers don't assign gadget.dev.release directly . Removal of some unused DMA_ADDR_INVALID . Introduction of CONFIG_USB_PHY . All phy drivers have been moved to drivers/usb/phy and renamed to a common naming scheme . Fix PHY layer so it never returns a NULL pointer, also fix all callers to avoid using IS_ERR_OR_NULL() . Sparse fixes all over the place . drivers/usb/otg/ has been deleted . Marvel drivers (mv_udc, ehci-mv, mv_otg and mv_u3d) improved clock usage - new features: . UDC core now provides a generic way for tracking and reporting UDC's state (not attached, resuming, suspended, addressed, default, etc) . twl4030-usb learned that it shouldn't be enabled during init . Full DT support for DWC3 has been implemented . ab8500-usb learned about pinctrl framework . nop PHY learned about DeviceTree and regulators . DWC3 learned about suspend/resume . DWC3 can now be compiled in host-only and gadget-only (as well as DRD) configurations . UVC now enables streaming endpoint based on negotiated speed . isp1301 now implements the PHY API properly . configfs-based interface for gadget drivers which will lead to the removal of all code which just combines functions together to build functional gadget drivers. . f_serial and f_obex were converted to new configfs interface while maintaining old interface around. - non-critical fixes: . UVC gadget driver got fixes for Endpoint usage and stream calculation . ab8500-usb fixed unbalanced clock and regulator API usage . twl4030-usb got a fix for when OMAP3 is booted with cable connected . fusb300_udc got a fix for DMA usage . UVC got fixes for two assertions of the USB Video Class Compliance specification revision 1.1 . build warning issues caused by recent addition of __must_check to regulator API These are all changes which deserve a mention, all other changes are related to these one or minor spelling fixes and other similar tasks. Signed-of-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'include/linux/usb')
-rw-r--r--include/linux/usb/ch9.h9
-rw-r--r--include/linux/usb/composite.h3
-rw-r--r--include/linux/usb/dwc3-omap.h6
-rw-r--r--include/linux/usb/gadget.h11
-rw-r--r--include/linux/usb/gadget_configfs.h110
-rw-r--r--include/linux/usb/musb-ux500.h31
-rw-r--r--include/linux/usb/nop-usb-xceiv.h5
-rw-r--r--include/linux/usb/otg.h9
-rw-r--r--include/linux/usb/phy.h33
-rw-r--r--include/linux/usb/renesas_usbhs.h6
10 files changed, 203 insertions, 20 deletions
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
index 9c210f2283df..27603bcbb9b9 100644
--- a/include/linux/usb/ch9.h
+++ b/include/linux/usb/ch9.h
@@ -43,4 +43,13 @@
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/**
48 * usb_state_string - Returns human readable name for the state.
49 * @state: The state to return a human-readable name for. If it's not
50 * any of the states devices in usb_device_state_string enum,
51 * the string UNKNOWN will be returned.
52 */
53extern const char *usb_state_string(enum usb_device_state state);
54
46#endif /* __LINUX_USB_CH9_H */ 55#endif /* __LINUX_USB_CH9_H */
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index 8860594d6364..5e61589fc166 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -39,6 +39,7 @@
39#include <linux/usb/ch9.h> 39#include <linux/usb/ch9.h>
40#include <linux/usb/gadget.h> 40#include <linux/usb/gadget.h>
41#include <linux/log2.h> 41#include <linux/log2.h>
42#include <linux/configfs.h>
42 43
43/* 44/*
44 * USB function drivers should return USB_GADGET_DELAYED_STATUS if they 45 * USB function drivers should return USB_GADGET_DELAYED_STATUS if they
@@ -464,6 +465,8 @@ struct usb_function_driver {
464}; 465};
465 466
466struct usb_function_instance { 467struct usb_function_instance {
468 struct config_group group;
469 struct list_head cfs_list;
467 struct usb_function_driver *fd; 470 struct usb_function_driver *fd;
468 void (*free_func_inst)(struct usb_function_instance *inst); 471 void (*free_func_inst)(struct usb_function_instance *inst);
469}; 472};
diff --git a/include/linux/usb/dwc3-omap.h b/include/linux/usb/dwc3-omap.h
index 51eae14477f7..5615f4d82724 100644
--- a/include/linux/usb/dwc3-omap.h
+++ b/include/linux/usb/dwc3-omap.h
@@ -19,11 +19,11 @@ enum omap_dwc3_vbus_id_status {
19}; 19};
20 20
21#if (defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_DWC3_MODULE)) 21#if (defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_DWC3_MODULE))
22extern void dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status); 22extern int dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status);
23#else 23#else
24static inline void dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status) 24static inline int dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status)
25{ 25{
26 return; 26 return -ENODEV;
27} 27}
28#endif 28#endif
29 29
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index 2e297e80d59a..c454a88abf2e 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -482,6 +482,7 @@ struct usb_gadget_ops {
482 * @speed: Speed of current connection to USB host. 482 * @speed: Speed of current connection to USB host.
483 * @max_speed: Maximal speed the UDC can handle. UDC must support this 483 * @max_speed: Maximal speed the UDC can handle. UDC must support this
484 * and all slower speeds. 484 * and all slower speeds.
485 * @state: the state we are now (attached, suspended, configured, etc)
485 * @sg_supported: true if we can handle scatter-gather 486 * @sg_supported: true if we can handle scatter-gather
486 * @is_otg: True if the USB device port uses a Mini-AB jack, so that the 487 * @is_otg: True if the USB device port uses a Mini-AB jack, so that the
487 * gadget driver must provide a USB OTG descriptor. 488 * gadget driver must provide a USB OTG descriptor.
@@ -525,6 +526,7 @@ struct usb_gadget {
525 struct list_head ep_list; /* of usb_ep */ 526 struct list_head ep_list; /* of usb_ep */
526 enum usb_device_speed speed; 527 enum usb_device_speed speed;
527 enum usb_device_speed max_speed; 528 enum usb_device_speed max_speed;
529 enum usb_device_state state;
528 unsigned sg_supported:1; 530 unsigned sg_supported:1;
529 unsigned is_otg:1; 531 unsigned is_otg:1;
530 unsigned is_a_peripheral:1; 532 unsigned is_a_peripheral:1;
@@ -872,6 +874,8 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver);
872 */ 874 */
873int usb_gadget_unregister_driver(struct usb_gadget_driver *driver); 875int usb_gadget_unregister_driver(struct usb_gadget_driver *driver);
874 876
877extern int usb_add_gadget_udc_release(struct device *parent,
878 struct usb_gadget *gadget, void (*release)(struct device *dev));
875extern int usb_add_gadget_udc(struct device *parent, struct usb_gadget *gadget); 879extern int usb_add_gadget_udc(struct device *parent, struct usb_gadget *gadget);
876extern void usb_del_gadget_udc(struct usb_gadget *gadget); 880extern void usb_del_gadget_udc(struct usb_gadget *gadget);
877extern int udc_attach_driver(const char *name, 881extern int udc_attach_driver(const char *name,
@@ -959,6 +963,13 @@ extern void usb_gadget_unmap_request(struct usb_gadget *gadget,
959 963
960/*-------------------------------------------------------------------------*/ 964/*-------------------------------------------------------------------------*/
961 965
966/* utility to set gadget state properly */
967
968extern void usb_gadget_set_state(struct usb_gadget *gadget,
969 enum usb_device_state state);
970
971/*-------------------------------------------------------------------------*/
972
962/* utility wrapping a simple endpoint selection policy */ 973/* utility wrapping a simple endpoint selection policy */
963 974
964extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *, 975extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *,
diff --git a/include/linux/usb/gadget_configfs.h b/include/linux/usb/gadget_configfs.h
new file mode 100644
index 000000000000..d74c0ae989d5
--- /dev/null
+++ b/include/linux/usb/gadget_configfs.h
@@ -0,0 +1,110 @@
1#ifndef __GADGET_CONFIGFS__
2#define __GADGET_CONFIGFS__
3
4#include <linux/configfs.h>
5
6int check_user_usb_string(const char *name,
7 struct usb_gadget_strings *stringtab_dev);
8
9#define GS_STRINGS_W(__struct, __name) \
10 static ssize_t __struct##_##__name##_store(struct __struct *gs, \
11 const char *page, size_t len) \
12{ \
13 int ret; \
14 \
15 ret = usb_string_copy(page, &gs->__name); \
16 if (ret) \
17 return ret; \
18 return len; \
19}
20
21#define GS_STRINGS_R(__struct, __name) \
22 static ssize_t __struct##_##__name##_show(struct __struct *gs, \
23 char *page) \
24{ \
25 return sprintf(page, "%s\n", gs->__name ?: ""); \
26}
27
28#define GS_STRING_ITEM_ATTR(struct_name, name) \
29 static struct struct_name##_attribute struct_name##_##name = \
30 __CONFIGFS_ATTR(name, S_IRUGO | S_IWUSR, \
31 struct_name##_##name##_show, \
32 struct_name##_##name##_store)
33
34#define GS_STRINGS_RW(struct_name, _name) \
35 GS_STRINGS_R(struct_name, _name) \
36 GS_STRINGS_W(struct_name, _name) \
37 GS_STRING_ITEM_ATTR(struct_name, _name)
38
39#define USB_CONFIG_STRING_RW_OPS(struct_in) \
40 CONFIGFS_ATTR_OPS(struct_in); \
41 \
42static struct configfs_item_operations struct_in##_langid_item_ops = { \
43 .release = struct_in##_attr_release, \
44 .show_attribute = struct_in##_attr_show, \
45 .store_attribute = struct_in##_attr_store, \
46}; \
47 \
48static struct config_item_type struct_in##_langid_type = { \
49 .ct_item_ops = &struct_in##_langid_item_ops, \
50 .ct_attrs = struct_in##_langid_attrs, \
51 .ct_owner = THIS_MODULE, \
52}
53
54#define USB_CONFIG_STRINGS_LANG(struct_in, struct_member) \
55 static struct config_group *struct_in##_strings_make( \
56 struct config_group *group, \
57 const char *name) \
58 { \
59 struct struct_member *gi; \
60 struct struct_in *gs; \
61 struct struct_in *new; \
62 int langs = 0; \
63 int ret; \
64 \
65 new = kzalloc(sizeof(*new), GFP_KERNEL); \
66 if (!new) \
67 return ERR_PTR(-ENOMEM); \
68 \
69 ret = check_user_usb_string(name, &new->stringtab_dev); \
70 if (ret) \
71 goto err; \
72 config_group_init_type_name(&new->group, name, \
73 &struct_in##_langid_type); \
74 \
75 gi = container_of(group, struct struct_member, strings_group); \
76 ret = -EEXIST; \
77 list_for_each_entry(gs, &gi->string_list, list) { \
78 if (gs->stringtab_dev.language == new->stringtab_dev.language) \
79 goto err; \
80 langs++; \
81 } \
82 ret = -EOVERFLOW; \
83 if (langs >= MAX_USB_STRING_LANGS) \
84 goto err; \
85 \
86 list_add_tail(&new->list, &gi->string_list); \
87 return &new->group; \
88err: \
89 kfree(new); \
90 return ERR_PTR(ret); \
91} \
92 \
93static void struct_in##_strings_drop( \
94 struct config_group *group, \
95 struct config_item *item) \
96{ \
97 config_item_put(item); \
98} \
99 \
100static struct configfs_group_operations struct_in##_strings_ops = { \
101 .make_group = &struct_in##_strings_make, \
102 .drop_item = &struct_in##_strings_drop, \
103}; \
104 \
105static struct config_item_type struct_in##_strings_type = { \
106 .ct_group_ops = &struct_in##_strings_ops, \
107 .ct_owner = THIS_MODULE, \
108}
109
110#endif
diff --git a/include/linux/usb/musb-ux500.h b/include/linux/usb/musb-ux500.h
new file mode 100644
index 000000000000..1e2c7130f6e1
--- /dev/null
+++ b/include/linux/usb/musb-ux500.h
@@ -0,0 +1,31 @@
1/*
2 * Copyright (C) 2013 ST-Ericsson AB
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#ifndef __MUSB_UX500_H__
16#define __MUSB_UX500_H__
17
18enum ux500_musb_vbus_id_status {
19 UX500_MUSB_NONE = 0,
20 UX500_MUSB_VBUS,
21 UX500_MUSB_ID,
22 UX500_MUSB_CHARGER,
23 UX500_MUSB_ENUMERATED,
24 UX500_MUSB_RIDA,
25 UX500_MUSB_RIDB,
26 UX500_MUSB_RIDC,
27 UX500_MUSB_PREPARE,
28 UX500_MUSB_CLEAN,
29};
30
31#endif /* __MUSB_UX500_H__ */
diff --git a/include/linux/usb/nop-usb-xceiv.h b/include/linux/usb/nop-usb-xceiv.h
index 28884c717411..148d35171aac 100644
--- a/include/linux/usb/nop-usb-xceiv.h
+++ b/include/linux/usb/nop-usb-xceiv.h
@@ -5,6 +5,11 @@
5 5
6struct nop_usb_xceiv_platform_data { 6struct nop_usb_xceiv_platform_data {
7 enum usb_phy_type type; 7 enum usb_phy_type type;
8 unsigned long clk_rate;
9
10 /* if set fails with -EPROBE_DEFER if can't get regulator */
11 unsigned int needs_vcc:1;
12 unsigned int needs_reset:1;
8}; 13};
9 14
10#if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE) && defined(MODULE)) 15#if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE) && defined(MODULE))
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index e8a5fe87c6bd..291e01ba32e5 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -36,14 +36,7 @@ struct usb_otg {
36 36
37}; 37};
38 38
39#ifdef CONFIG_USB_OTG_UTILS 39extern const char *usb_otg_state_string(enum usb_otg_state state);
40extern const char *otg_state_string(enum usb_otg_state state);
41#else
42static inline const char *otg_state_string(enum usb_otg_state state)
43{
44 return NULL;
45}
46#endif
47 40
48/* Context: can sleep */ 41/* Context: can sleep */
49static inline int 42static inline int
diff --git a/include/linux/usb/phy.h b/include/linux/usb/phy.h
index 15847cbdb512..6b5978f57633 100644
--- a/include/linux/usb/phy.h
+++ b/include/linux/usb/phy.h
@@ -91,6 +91,9 @@ struct usb_phy {
91 int (*init)(struct usb_phy *x); 91 int (*init)(struct usb_phy *x);
92 void (*shutdown)(struct usb_phy *x); 92 void (*shutdown)(struct usb_phy *x);
93 93
94 /* enable/disable VBUS */
95 int (*set_vbus)(struct usb_phy *x, int on);
96
94 /* effective for B devices, ignored for A-peripheral */ 97 /* effective for B devices, ignored for A-peripheral */
95 int (*set_power)(struct usb_phy *x, 98 int (*set_power)(struct usb_phy *x,
96 unsigned mA); 99 unsigned mA);
@@ -160,8 +163,26 @@ usb_phy_shutdown(struct usb_phy *x)
160 x->shutdown(x); 163 x->shutdown(x);
161} 164}
162 165
166static inline int
167usb_phy_vbus_on(struct usb_phy *x)
168{
169 if (!x->set_vbus)
170 return 0;
171
172 return x->set_vbus(x, true);
173}
174
175static inline int
176usb_phy_vbus_off(struct usb_phy *x)
177{
178 if (!x->set_vbus)
179 return 0;
180
181 return x->set_vbus(x, false);
182}
183
163/* for usb host and peripheral controller drivers */ 184/* for usb host and peripheral controller drivers */
164#ifdef CONFIG_USB_OTG_UTILS 185#if IS_ENABLED(CONFIG_USB_PHY)
165extern struct usb_phy *usb_get_phy(enum usb_phy_type type); 186extern struct usb_phy *usb_get_phy(enum usb_phy_type type);
166extern struct usb_phy *devm_usb_get_phy(struct device *dev, 187extern struct usb_phy *devm_usb_get_phy(struct device *dev,
167 enum usb_phy_type type); 188 enum usb_phy_type type);
@@ -176,29 +197,29 @@ extern int usb_bind_phy(const char *dev_name, u8 index,
176#else 197#else
177static inline struct usb_phy *usb_get_phy(enum usb_phy_type type) 198static inline struct usb_phy *usb_get_phy(enum usb_phy_type type)
178{ 199{
179 return NULL; 200 return ERR_PTR(-ENXIO);
180} 201}
181 202
182static inline struct usb_phy *devm_usb_get_phy(struct device *dev, 203static inline struct usb_phy *devm_usb_get_phy(struct device *dev,
183 enum usb_phy_type type) 204 enum usb_phy_type type)
184{ 205{
185 return NULL; 206 return ERR_PTR(-ENXIO);
186} 207}
187 208
188static inline struct usb_phy *usb_get_phy_dev(struct device *dev, u8 index) 209static inline struct usb_phy *usb_get_phy_dev(struct device *dev, u8 index)
189{ 210{
190 return NULL; 211 return ERR_PTR(-ENXIO);
191} 212}
192 213
193static inline struct usb_phy *devm_usb_get_phy_dev(struct device *dev, u8 index) 214static inline struct usb_phy *devm_usb_get_phy_dev(struct device *dev, u8 index)
194{ 215{
195 return NULL; 216 return ERR_PTR(-ENXIO);
196} 217}
197 218
198static inline struct usb_phy *devm_usb_get_phy_by_phandle(struct device *dev, 219static inline struct usb_phy *devm_usb_get_phy_by_phandle(struct device *dev,
199 const char *phandle, u8 index) 220 const char *phandle, u8 index)
200{ 221{
201 return NULL; 222 return ERR_PTR(-ENXIO);
202} 223}
203 224
204static inline void usb_put_phy(struct usb_phy *x) 225static inline void usb_put_phy(struct usb_phy *x)
diff --git a/include/linux/usb/renesas_usbhs.h b/include/linux/usb/renesas_usbhs.h
index c5d36c65c33b..e452ba6ec6bd 100644
--- a/include/linux/usb/renesas_usbhs.h
+++ b/include/linux/usb/renesas_usbhs.h
@@ -62,14 +62,14 @@ struct renesas_usbhs_platform_callback {
62 * Hardware exit function for platform. 62 * Hardware exit function for platform.
63 * it is called when driver was removed 63 * it is called when driver was removed
64 */ 64 */
65 void (*hardware_exit)(struct platform_device *pdev); 65 int (*hardware_exit)(struct platform_device *pdev);
66 66
67 /* 67 /*
68 * option: 68 * option:
69 * 69 *
70 * for board specific clock control 70 * for board specific clock control
71 */ 71 */
72 void (*power_ctrl)(struct platform_device *pdev, 72 int (*power_ctrl)(struct platform_device *pdev,
73 void __iomem *base, int enable); 73 void __iomem *base, int enable);
74 74
75 /* 75 /*
@@ -77,7 +77,7 @@ struct renesas_usbhs_platform_callback {
77 * 77 *
78 * Phy reset for platform 78 * Phy reset for platform
79 */ 79 */
80 void (*phy_reset)(struct platform_device *pdev); 80 int (*phy_reset)(struct platform_device *pdev);
81 81
82 /* 82 /*
83 * get USB ID function 83 * get USB ID function