diff options
Diffstat (limited to 'include/linux/usb')
-rw-r--r-- | include/linux/usb/composite.h | 78 | ||||
-rw-r--r-- | include/linux/usb/dwc3-omap.h | 30 | ||||
-rw-r--r-- | include/linux/usb/gadget.h | 13 | ||||
-rw-r--r-- | include/linux/usb/musb.h | 2 | ||||
-rw-r--r-- | include/linux/usb/omap_control_usb.h | 92 | ||||
-rw-r--r-- | include/linux/usb/omap_usb.h | 27 | ||||
-rw-r--r-- | include/linux/usb/phy.h | 43 | ||||
-rw-r--r-- | include/linux/usb/samsung_usb_phy.h | 16 | ||||
-rw-r--r-- | include/linux/usb/tegra_usb_phy.h | 16 | ||||
-rw-r--r-- | include/linux/usb/usbnet.h | 4 |
10 files changed, 301 insertions, 20 deletions
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h index b09c37e04a91..8860594d6364 100644 --- a/include/linux/usb/composite.h +++ b/include/linux/usb/composite.h | |||
@@ -60,7 +60,7 @@ struct usb_configuration; | |||
60 | * @name: For diagnostics, identifies the function. | 60 | * @name: For diagnostics, identifies the function. |
61 | * @strings: tables of strings, keyed by identifiers assigned during bind() | 61 | * @strings: tables of strings, keyed by identifiers assigned during bind() |
62 | * and by language IDs provided in control requests | 62 | * and by language IDs provided in control requests |
63 | * @descriptors: Table of full (or low) speed descriptors, using interface and | 63 | * @fs_descriptors: Table of full (or low) speed descriptors, using interface and |
64 | * string identifiers assigned during @bind(). If this pointer is null, | 64 | * string identifiers assigned during @bind(). If this pointer is null, |
65 | * the function will not be available at full speed (or at low speed). | 65 | * the function will not be available at full speed (or at low speed). |
66 | * @hs_descriptors: Table of high speed descriptors, using interface and | 66 | * @hs_descriptors: Table of high speed descriptors, using interface and |
@@ -77,6 +77,8 @@ struct usb_configuration; | |||
77 | * in interface or class descriptors; endpoints; I/O buffers; and so on. | 77 | * in interface or class descriptors; endpoints; I/O buffers; and so on. |
78 | * @unbind: Reverses @bind; called as a side effect of unregistering the | 78 | * @unbind: Reverses @bind; called as a side effect of unregistering the |
79 | * driver which added this function. | 79 | * driver which added this function. |
80 | * @free_func: free the struct usb_function. | ||
81 | * @mod: (internal) points to the module that created this structure. | ||
80 | * @set_alt: (REQUIRED) Reconfigures altsettings; function drivers may | 82 | * @set_alt: (REQUIRED) Reconfigures altsettings; function drivers may |
81 | * initialize usb_ep.driver data at this time (when it is used). | 83 | * initialize usb_ep.driver data at this time (when it is used). |
82 | * Note that setting an interface to its current altsetting resets | 84 | * Note that setting an interface to its current altsetting resets |
@@ -116,6 +118,7 @@ struct usb_configuration; | |||
116 | * two or more distinct instances within the same configuration, providing | 118 | * two or more distinct instances within the same configuration, providing |
117 | * several independent logical data links to a USB host. | 119 | * several independent logical data links to a USB host. |
118 | */ | 120 | */ |
121 | |||
119 | struct usb_function { | 122 | struct usb_function { |
120 | const char *name; | 123 | const char *name; |
121 | struct usb_gadget_strings **strings; | 124 | struct usb_gadget_strings **strings; |
@@ -136,6 +139,8 @@ struct usb_function { | |||
136 | struct usb_function *); | 139 | struct usb_function *); |
137 | void (*unbind)(struct usb_configuration *, | 140 | void (*unbind)(struct usb_configuration *, |
138 | struct usb_function *); | 141 | struct usb_function *); |
142 | void (*free_func)(struct usb_function *f); | ||
143 | struct module *mod; | ||
139 | 144 | ||
140 | /* runtime state management */ | 145 | /* runtime state management */ |
141 | int (*set_alt)(struct usb_function *, | 146 | int (*set_alt)(struct usb_function *, |
@@ -156,6 +161,7 @@ struct usb_function { | |||
156 | /* internals */ | 161 | /* internals */ |
157 | struct list_head list; | 162 | struct list_head list; |
158 | DECLARE_BITMAP(endpoints, 32); | 163 | DECLARE_BITMAP(endpoints, 32); |
164 | const struct usb_function_instance *fi; | ||
159 | }; | 165 | }; |
160 | 166 | ||
161 | int usb_add_function(struct usb_configuration *, struct usb_function *); | 167 | int usb_add_function(struct usb_configuration *, struct usb_function *); |
@@ -184,7 +190,8 @@ int config_ep_by_speed(struct usb_gadget *g, struct usb_function *f, | |||
184 | * @bConfigurationValue: Copied into configuration descriptor. | 190 | * @bConfigurationValue: Copied into configuration descriptor. |
185 | * @iConfiguration: Copied into configuration descriptor. | 191 | * @iConfiguration: Copied into configuration descriptor. |
186 | * @bmAttributes: Copied into configuration descriptor. | 192 | * @bmAttributes: Copied into configuration descriptor. |
187 | * @bMaxPower: Copied into configuration descriptor. | 193 | * @MaxPower: Power consumtion in mA. Used to compute bMaxPower in the |
194 | * configuration descriptor after considering the bus speed. | ||
188 | * @cdev: assigned by @usb_add_config() before calling @bind(); this is | 195 | * @cdev: assigned by @usb_add_config() before calling @bind(); this is |
189 | * the device associated with this configuration. | 196 | * the device associated with this configuration. |
190 | * | 197 | * |
@@ -230,7 +237,7 @@ struct usb_configuration { | |||
230 | u8 bConfigurationValue; | 237 | u8 bConfigurationValue; |
231 | u8 iConfiguration; | 238 | u8 iConfiguration; |
232 | u8 bmAttributes; | 239 | u8 bmAttributes; |
233 | u8 bMaxPower; | 240 | u16 MaxPower; |
234 | 241 | ||
235 | struct usb_composite_dev *cdev; | 242 | struct usb_composite_dev *cdev; |
236 | 243 | ||
@@ -283,6 +290,7 @@ enum { | |||
283 | * after function notifications | 290 | * after function notifications |
284 | * @resume: Notifies configuration when the host restarts USB traffic, | 291 | * @resume: Notifies configuration when the host restarts USB traffic, |
285 | * before function notifications | 292 | * before function notifications |
293 | * @gadget_driver: Gadget driver controlling this driver | ||
286 | * | 294 | * |
287 | * Devices default to reporting self powered operation. Devices which rely | 295 | * Devices default to reporting self powered operation. Devices which rely |
288 | * on bus powered operation should report this in their @bind method. | 296 | * on bus powered operation should report this in their @bind method. |
@@ -316,7 +324,15 @@ struct usb_composite_driver { | |||
316 | extern int usb_composite_probe(struct usb_composite_driver *driver); | 324 | extern int usb_composite_probe(struct usb_composite_driver *driver); |
317 | extern void usb_composite_unregister(struct usb_composite_driver *driver); | 325 | extern void usb_composite_unregister(struct usb_composite_driver *driver); |
318 | extern void usb_composite_setup_continue(struct usb_composite_dev *cdev); | 326 | extern void usb_composite_setup_continue(struct usb_composite_dev *cdev); |
327 | extern int composite_dev_prepare(struct usb_composite_driver *composite, | ||
328 | struct usb_composite_dev *cdev); | ||
329 | void composite_dev_cleanup(struct usb_composite_dev *cdev); | ||
319 | 330 | ||
331 | static inline struct usb_composite_driver *to_cdriver( | ||
332 | struct usb_gadget_driver *gdrv) | ||
333 | { | ||
334 | return container_of(gdrv, struct usb_composite_driver, gadget_driver); | ||
335 | } | ||
320 | 336 | ||
321 | /** | 337 | /** |
322 | * struct usb_composite_device - represents one composite usb gadget | 338 | * struct usb_composite_device - represents one composite usb gadget |
@@ -360,6 +376,7 @@ struct usb_composite_dev { | |||
360 | unsigned int suspended:1; | 376 | unsigned int suspended:1; |
361 | struct usb_device_descriptor desc; | 377 | struct usb_device_descriptor desc; |
362 | struct list_head configs; | 378 | struct list_head configs; |
379 | struct list_head gstrings; | ||
363 | struct usb_composite_driver *driver; | 380 | struct usb_composite_driver *driver; |
364 | u8 next_string_id; | 381 | u8 next_string_id; |
365 | char *def_manufacturer; | 382 | char *def_manufacturer; |
@@ -381,8 +398,15 @@ struct usb_composite_dev { | |||
381 | extern int usb_string_id(struct usb_composite_dev *c); | 398 | extern int usb_string_id(struct usb_composite_dev *c); |
382 | extern int usb_string_ids_tab(struct usb_composite_dev *c, | 399 | extern int usb_string_ids_tab(struct usb_composite_dev *c, |
383 | struct usb_string *str); | 400 | struct usb_string *str); |
401 | extern struct usb_string *usb_gstrings_attach(struct usb_composite_dev *cdev, | ||
402 | struct usb_gadget_strings **sp, unsigned n_strings); | ||
403 | |||
384 | extern int usb_string_ids_n(struct usb_composite_dev *c, unsigned n); | 404 | extern int usb_string_ids_n(struct usb_composite_dev *c, unsigned n); |
385 | 405 | ||
406 | extern void composite_disconnect(struct usb_gadget *gadget); | ||
407 | extern int composite_setup(struct usb_gadget *gadget, | ||
408 | const struct usb_ctrlrequest *ctrl); | ||
409 | |||
386 | /* | 410 | /* |
387 | * Some systems will need runtime overrides for the product identifiers | 411 | * Some systems will need runtime overrides for the product identifiers |
388 | * published in the device descriptor, either numbers or strings or both. | 412 | * published in the device descriptor, either numbers or strings or both. |
@@ -431,6 +455,54 @@ static inline u16 get_default_bcdDevice(void) | |||
431 | return bcdDevice; | 455 | return bcdDevice; |
432 | } | 456 | } |
433 | 457 | ||
458 | struct usb_function_driver { | ||
459 | const char *name; | ||
460 | struct module *mod; | ||
461 | struct list_head list; | ||
462 | struct usb_function_instance *(*alloc_inst)(void); | ||
463 | struct usb_function *(*alloc_func)(struct usb_function_instance *inst); | ||
464 | }; | ||
465 | |||
466 | struct usb_function_instance { | ||
467 | struct usb_function_driver *fd; | ||
468 | void (*free_func_inst)(struct usb_function_instance *inst); | ||
469 | }; | ||
470 | |||
471 | void usb_function_unregister(struct usb_function_driver *f); | ||
472 | int usb_function_register(struct usb_function_driver *newf); | ||
473 | void usb_put_function_instance(struct usb_function_instance *fi); | ||
474 | void usb_put_function(struct usb_function *f); | ||
475 | struct usb_function_instance *usb_get_function_instance(const char *name); | ||
476 | struct usb_function *usb_get_function(struct usb_function_instance *fi); | ||
477 | |||
478 | struct usb_configuration *usb_get_config(struct usb_composite_dev *cdev, | ||
479 | int val); | ||
480 | int usb_add_config_only(struct usb_composite_dev *cdev, | ||
481 | struct usb_configuration *config); | ||
482 | void usb_remove_function(struct usb_configuration *c, struct usb_function *f); | ||
483 | |||
484 | #define DECLARE_USB_FUNCTION(_name, _inst_alloc, _func_alloc) \ | ||
485 | static struct usb_function_driver _name ## usb_func = { \ | ||
486 | .name = __stringify(_name), \ | ||
487 | .mod = THIS_MODULE, \ | ||
488 | .alloc_inst = _inst_alloc, \ | ||
489 | .alloc_func = _func_alloc, \ | ||
490 | }; \ | ||
491 | MODULE_ALIAS("usbfunc:"__stringify(_name)); | ||
492 | |||
493 | #define DECLARE_USB_FUNCTION_INIT(_name, _inst_alloc, _func_alloc) \ | ||
494 | DECLARE_USB_FUNCTION(_name, _inst_alloc, _func_alloc) \ | ||
495 | static int __init _name ## mod_init(void) \ | ||
496 | { \ | ||
497 | return usb_function_register(&_name ## usb_func); \ | ||
498 | } \ | ||
499 | static void __exit _name ## mod_exit(void) \ | ||
500 | { \ | ||
501 | usb_function_unregister(&_name ## usb_func); \ | ||
502 | } \ | ||
503 | module_init(_name ## mod_init); \ | ||
504 | module_exit(_name ## mod_exit) | ||
505 | |||
434 | /* messaging utils */ | 506 | /* messaging utils */ |
435 | #define DBG(d, fmt, args...) \ | 507 | #define DBG(d, fmt, args...) \ |
436 | dev_dbg(&(d)->gadget->dev , fmt , ## args) | 508 | dev_dbg(&(d)->gadget->dev , fmt , ## args) |
diff --git a/include/linux/usb/dwc3-omap.h b/include/linux/usb/dwc3-omap.h new file mode 100644 index 000000000000..51eae14477f7 --- /dev/null +++ b/include/linux/usb/dwc3-omap.h | |||
@@ -0,0 +1,30 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2013 by Texas Instruments | ||
3 | * | ||
4 | * The Inventra Controller Driver for Linux is free software; you | ||
5 | * can redistribute it and/or modify it under the terms of the GNU | ||
6 | * General Public License version 2 as published by the Free Software | ||
7 | * Foundation. | ||
8 | */ | ||
9 | |||
10 | #ifndef __DWC3_OMAP_H__ | ||
11 | #define __DWC3_OMAP_H__ | ||
12 | |||
13 | enum omap_dwc3_vbus_id_status { | ||
14 | OMAP_DWC3_UNKNOWN = 0, | ||
15 | OMAP_DWC3_ID_GROUND, | ||
16 | OMAP_DWC3_ID_FLOAT, | ||
17 | OMAP_DWC3_VBUS_VALID, | ||
18 | OMAP_DWC3_VBUS_OFF, | ||
19 | }; | ||
20 | |||
21 | #if (defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_DWC3_MODULE)) | ||
22 | extern void dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status); | ||
23 | #else | ||
24 | static inline void dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status) | ||
25 | { | ||
26 | return; | ||
27 | } | ||
28 | #endif | ||
29 | |||
30 | #endif /* __DWC3_OMAP_H__ */ | ||
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index 0af6569b8cc6..2e297e80d59a 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h | |||
@@ -471,12 +471,6 @@ struct usb_gadget_ops { | |||
471 | struct usb_gadget_driver *); | 471 | struct usb_gadget_driver *); |
472 | int (*udc_stop)(struct usb_gadget *, | 472 | int (*udc_stop)(struct usb_gadget *, |
473 | struct usb_gadget_driver *); | 473 | struct usb_gadget_driver *); |
474 | |||
475 | /* Those two are deprecated */ | ||
476 | int (*start)(struct usb_gadget_driver *, | ||
477 | int (*bind)(struct usb_gadget *, | ||
478 | struct usb_gadget_driver *driver)); | ||
479 | int (*stop)(struct usb_gadget_driver *); | ||
480 | }; | 474 | }; |
481 | 475 | ||
482 | /** | 476 | /** |
@@ -880,6 +874,8 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver); | |||
880 | 874 | ||
881 | extern int usb_add_gadget_udc(struct device *parent, struct usb_gadget *gadget); | 875 | extern int usb_add_gadget_udc(struct device *parent, struct usb_gadget *gadget); |
882 | extern void usb_del_gadget_udc(struct usb_gadget *gadget); | 876 | extern void usb_del_gadget_udc(struct usb_gadget *gadget); |
877 | extern int udc_attach_driver(const char *name, | ||
878 | struct usb_gadget_driver *driver); | ||
883 | 879 | ||
884 | /*-------------------------------------------------------------------------*/ | 880 | /*-------------------------------------------------------------------------*/ |
885 | 881 | ||
@@ -911,6 +907,11 @@ struct usb_gadget_strings { | |||
911 | struct usb_string *strings; | 907 | struct usb_string *strings; |
912 | }; | 908 | }; |
913 | 909 | ||
910 | struct usb_gadget_string_container { | ||
911 | struct list_head list; | ||
912 | u8 *stash[0]; | ||
913 | }; | ||
914 | |||
914 | /* put descriptor for string with that id into buf (buflen >= 256) */ | 915 | /* put descriptor for string with that id into buf (buflen >= 256) */ |
915 | int usb_gadget_get_string(struct usb_gadget_strings *table, int id, u8 *buf); | 916 | int usb_gadget_get_string(struct usb_gadget_strings *table, int id, u8 *buf); |
916 | 917 | ||
diff --git a/include/linux/usb/musb.h b/include/linux/usb/musb.h index eb505250940a..053c26841cc3 100644 --- a/include/linux/usb/musb.h +++ b/include/linux/usb/musb.h | |||
@@ -99,6 +99,8 @@ struct musb_hdrc_platform_data { | |||
99 | /* MUSB_HOST, MUSB_PERIPHERAL, or MUSB_OTG */ | 99 | /* MUSB_HOST, MUSB_PERIPHERAL, or MUSB_OTG */ |
100 | u8 mode; | 100 | u8 mode; |
101 | 101 | ||
102 | u8 has_mailbox:1; | ||
103 | |||
102 | /* for clk_get() */ | 104 | /* for clk_get() */ |
103 | const char *clock; | 105 | const char *clock; |
104 | 106 | ||
diff --git a/include/linux/usb/omap_control_usb.h b/include/linux/usb/omap_control_usb.h new file mode 100644 index 000000000000..27b5b8c931b0 --- /dev/null +++ b/include/linux/usb/omap_control_usb.h | |||
@@ -0,0 +1,92 @@ | |||
1 | /* | ||
2 | * omap_control_usb.h - Header file for the USB part of control module. | ||
3 | * | ||
4 | * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * Author: Kishon Vijay Abraham I <kishon@ti.com> | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | */ | ||
18 | |||
19 | #ifndef __OMAP_CONTROL_USB_H__ | ||
20 | #define __OMAP_CONTROL_USB_H__ | ||
21 | |||
22 | struct omap_control_usb { | ||
23 | struct device *dev; | ||
24 | |||
25 | u32 __iomem *dev_conf; | ||
26 | u32 __iomem *otghs_control; | ||
27 | u32 __iomem *phy_power; | ||
28 | |||
29 | struct clk *sys_clk; | ||
30 | |||
31 | u32 type; | ||
32 | }; | ||
33 | |||
34 | struct omap_control_usb_platform_data { | ||
35 | u8 type; | ||
36 | }; | ||
37 | |||
38 | enum omap_control_usb_mode { | ||
39 | USB_MODE_UNDEFINED = 0, | ||
40 | USB_MODE_HOST, | ||
41 | USB_MODE_DEVICE, | ||
42 | USB_MODE_DISCONNECT, | ||
43 | }; | ||
44 | |||
45 | /* To differentiate ctrl module IP having either mailbox or USB3 PHY power */ | ||
46 | #define OMAP_CTRL_DEV_TYPE1 0x1 | ||
47 | #define OMAP_CTRL_DEV_TYPE2 0x2 | ||
48 | |||
49 | #define OMAP_CTRL_DEV_PHY_PD BIT(0) | ||
50 | |||
51 | #define OMAP_CTRL_DEV_AVALID BIT(0) | ||
52 | #define OMAP_CTRL_DEV_BVALID BIT(1) | ||
53 | #define OMAP_CTRL_DEV_VBUSVALID BIT(2) | ||
54 | #define OMAP_CTRL_DEV_SESSEND BIT(3) | ||
55 | #define OMAP_CTRL_DEV_IDDIG BIT(4) | ||
56 | |||
57 | #define OMAP_CTRL_USB_PWRCTL_CLK_CMD_MASK 0x003FC000 | ||
58 | #define OMAP_CTRL_USB_PWRCTL_CLK_CMD_SHIFT 0xE | ||
59 | |||
60 | #define OMAP_CTRL_USB_PWRCTL_CLK_FREQ_MASK 0xFFC00000 | ||
61 | #define OMAP_CTRL_USB_PWRCTL_CLK_FREQ_SHIFT 0x16 | ||
62 | |||
63 | #define OMAP_CTRL_USB3_PHY_TX_RX_POWERON 0x3 | ||
64 | #define OMAP_CTRL_USB3_PHY_TX_RX_POWEROFF 0x0 | ||
65 | |||
66 | #if IS_ENABLED(CONFIG_OMAP_CONTROL_USB) | ||
67 | extern struct device *omap_get_control_dev(void); | ||
68 | extern void omap_control_usb_phy_power(struct device *dev, int on); | ||
69 | extern void omap_control_usb3_phy_power(struct device *dev, bool on); | ||
70 | extern void omap_control_usb_set_mode(struct device *dev, | ||
71 | enum omap_control_usb_mode mode); | ||
72 | #else | ||
73 | static inline struct device *omap_get_control_dev(void) | ||
74 | { | ||
75 | return ERR_PTR(-ENODEV); | ||
76 | } | ||
77 | |||
78 | static inline void omap_control_usb_phy_power(struct device *dev, int on) | ||
79 | { | ||
80 | } | ||
81 | |||
82 | static inline void omap_control_usb3_phy_power(struct device *dev, int on) | ||
83 | { | ||
84 | } | ||
85 | |||
86 | static inline void omap_control_usb_set_mode(struct device *dev, | ||
87 | enum omap_control_usb_mode mode) | ||
88 | { | ||
89 | } | ||
90 | #endif | ||
91 | |||
92 | #endif /* __OMAP_CONTROL_USB_H__ */ | ||
diff --git a/include/linux/usb/omap_usb.h b/include/linux/usb/omap_usb.h index 0ea17f8ae820..6ae29360e1d2 100644 --- a/include/linux/usb/omap_usb.h +++ b/include/linux/usb/omap_usb.h | |||
@@ -19,19 +19,29 @@ | |||
19 | #ifndef __DRIVERS_OMAP_USB2_H | 19 | #ifndef __DRIVERS_OMAP_USB2_H |
20 | #define __DRIVERS_OMAP_USB2_H | 20 | #define __DRIVERS_OMAP_USB2_H |
21 | 21 | ||
22 | #include <linux/io.h> | ||
22 | #include <linux/usb/otg.h> | 23 | #include <linux/usb/otg.h> |
23 | 24 | ||
25 | struct usb_dpll_params { | ||
26 | u16 m; | ||
27 | u8 n; | ||
28 | u8 freq:3; | ||
29 | u8 sd; | ||
30 | u32 mf; | ||
31 | }; | ||
32 | |||
24 | struct omap_usb { | 33 | struct omap_usb { |
25 | struct usb_phy phy; | 34 | struct usb_phy phy; |
26 | struct phy_companion *comparator; | 35 | struct phy_companion *comparator; |
36 | void __iomem *pll_ctrl_base; | ||
27 | struct device *dev; | 37 | struct device *dev; |
28 | u32 __iomem *control_dev; | 38 | struct device *control_dev; |
29 | struct clk *wkupclk; | 39 | struct clk *wkupclk; |
40 | struct clk *sys_clk; | ||
41 | struct clk *optclk; | ||
30 | u8 is_suspended:1; | 42 | u8 is_suspended:1; |
31 | }; | 43 | }; |
32 | 44 | ||
33 | #define PHY_PD 0x1 | ||
34 | |||
35 | #define phy_to_omapusb(x) container_of((x), struct omap_usb, phy) | 45 | #define phy_to_omapusb(x) container_of((x), struct omap_usb, phy) |
36 | 46 | ||
37 | #if defined(CONFIG_OMAP_USB2) || defined(CONFIG_OMAP_USB2_MODULE) | 47 | #if defined(CONFIG_OMAP_USB2) || defined(CONFIG_OMAP_USB2_MODULE) |
@@ -43,4 +53,15 @@ static inline int omap_usb2_set_comparator(struct phy_companion *comparator) | |||
43 | } | 53 | } |
44 | #endif | 54 | #endif |
45 | 55 | ||
56 | static inline u32 omap_usb_readl(void __iomem *addr, unsigned offset) | ||
57 | { | ||
58 | return __raw_readl(addr + offset); | ||
59 | } | ||
60 | |||
61 | static inline void omap_usb_writel(void __iomem *addr, unsigned offset, | ||
62 | u32 data) | ||
63 | { | ||
64 | __raw_writel(data, addr + offset); | ||
65 | } | ||
66 | |||
46 | #endif /* __DRIVERS_OMAP_USB_H */ | 67 | #endif /* __DRIVERS_OMAP_USB_H */ |
diff --git a/include/linux/usb/phy.h b/include/linux/usb/phy.h index a29ae1eb9346..15847cbdb512 100644 --- a/include/linux/usb/phy.h +++ b/include/linux/usb/phy.h | |||
@@ -106,9 +106,25 @@ struct usb_phy { | |||
106 | enum usb_device_speed speed); | 106 | enum usb_device_speed speed); |
107 | }; | 107 | }; |
108 | 108 | ||
109 | /** | ||
110 | * struct usb_phy_bind - represent the binding for the phy | ||
111 | * @dev_name: the device name of the device that will bind to the phy | ||
112 | * @phy_dev_name: the device name of the phy | ||
113 | * @index: used if a single controller uses multiple phys | ||
114 | * @phy: reference to the phy | ||
115 | * @list: to maintain a linked list of the binding information | ||
116 | */ | ||
117 | struct usb_phy_bind { | ||
118 | const char *dev_name; | ||
119 | const char *phy_dev_name; | ||
120 | u8 index; | ||
121 | struct usb_phy *phy; | ||
122 | struct list_head list; | ||
123 | }; | ||
109 | 124 | ||
110 | /* for board-specific init logic */ | 125 | /* for board-specific init logic */ |
111 | extern int usb_add_phy(struct usb_phy *, enum usb_phy_type type); | 126 | extern int usb_add_phy(struct usb_phy *, enum usb_phy_type type); |
127 | extern int usb_add_phy_dev(struct usb_phy *); | ||
112 | extern void usb_remove_phy(struct usb_phy *); | 128 | extern void usb_remove_phy(struct usb_phy *); |
113 | 129 | ||
114 | /* helpers for direct access thru low-level io interface */ | 130 | /* helpers for direct access thru low-level io interface */ |
@@ -149,8 +165,14 @@ usb_phy_shutdown(struct usb_phy *x) | |||
149 | extern struct usb_phy *usb_get_phy(enum usb_phy_type type); | 165 | extern struct usb_phy *usb_get_phy(enum usb_phy_type type); |
150 | extern struct usb_phy *devm_usb_get_phy(struct device *dev, | 166 | extern struct usb_phy *devm_usb_get_phy(struct device *dev, |
151 | enum usb_phy_type type); | 167 | enum usb_phy_type type); |
168 | extern struct usb_phy *usb_get_phy_dev(struct device *dev, u8 index); | ||
169 | extern struct usb_phy *devm_usb_get_phy_dev(struct device *dev, u8 index); | ||
170 | extern struct usb_phy *devm_usb_get_phy_by_phandle(struct device *dev, | ||
171 | const char *phandle, u8 index); | ||
152 | extern void usb_put_phy(struct usb_phy *); | 172 | extern void usb_put_phy(struct usb_phy *); |
153 | extern void devm_usb_put_phy(struct device *dev, struct usb_phy *x); | 173 | extern void devm_usb_put_phy(struct device *dev, struct usb_phy *x); |
174 | extern int usb_bind_phy(const char *dev_name, u8 index, | ||
175 | const char *phy_dev_name); | ||
154 | #else | 176 | #else |
155 | static inline struct usb_phy *usb_get_phy(enum usb_phy_type type) | 177 | static inline struct usb_phy *usb_get_phy(enum usb_phy_type type) |
156 | { | 178 | { |
@@ -163,6 +185,22 @@ static inline struct usb_phy *devm_usb_get_phy(struct device *dev, | |||
163 | return NULL; | 185 | return NULL; |
164 | } | 186 | } |
165 | 187 | ||
188 | static inline struct usb_phy *usb_get_phy_dev(struct device *dev, u8 index) | ||
189 | { | ||
190 | return NULL; | ||
191 | } | ||
192 | |||
193 | static inline struct usb_phy *devm_usb_get_phy_dev(struct device *dev, u8 index) | ||
194 | { | ||
195 | return NULL; | ||
196 | } | ||
197 | |||
198 | static inline struct usb_phy *devm_usb_get_phy_by_phandle(struct device *dev, | ||
199 | const char *phandle, u8 index) | ||
200 | { | ||
201 | return NULL; | ||
202 | } | ||
203 | |||
166 | static inline void usb_put_phy(struct usb_phy *x) | 204 | static inline void usb_put_phy(struct usb_phy *x) |
167 | { | 205 | { |
168 | } | 206 | } |
@@ -171,6 +209,11 @@ static inline void devm_usb_put_phy(struct device *dev, struct usb_phy *x) | |||
171 | { | 209 | { |
172 | } | 210 | } |
173 | 211 | ||
212 | static inline int usb_bind_phy(const char *dev_name, u8 index, | ||
213 | const char *phy_dev_name) | ||
214 | { | ||
215 | return -EOPNOTSUPP; | ||
216 | } | ||
174 | #endif | 217 | #endif |
175 | 218 | ||
176 | static inline int | 219 | static inline int |
diff --git a/include/linux/usb/samsung_usb_phy.h b/include/linux/usb/samsung_usb_phy.h new file mode 100644 index 000000000000..916782699f1c --- /dev/null +++ b/include/linux/usb/samsung_usb_phy.h | |||
@@ -0,0 +1,16 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2012 Samsung Electronics Co.Ltd | ||
3 | * http://www.samsung.com/ | ||
4 | * | ||
5 | * Defines phy types for samsung usb phy controllers - HOST or DEIVCE. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License as published by the | ||
9 | * Free Software Foundation; either version 2 of the License, or (at your | ||
10 | * option) any later version. | ||
11 | */ | ||
12 | |||
13 | enum samsung_usb_phy_type { | ||
14 | USB_PHY_TYPE_DEVICE, | ||
15 | USB_PHY_TYPE_HOST, | ||
16 | }; | ||
diff --git a/include/linux/usb/tegra_usb_phy.h b/include/linux/usb/tegra_usb_phy.h index 176b1ca06ae4..9ebebe906925 100644 --- a/include/linux/usb/tegra_usb_phy.h +++ b/include/linux/usb/tegra_usb_phy.h | |||
@@ -59,22 +59,24 @@ struct tegra_usb_phy { | |||
59 | struct usb_phy *ulpi; | 59 | struct usb_phy *ulpi; |
60 | struct usb_phy u_phy; | 60 | struct usb_phy u_phy; |
61 | struct device *dev; | 61 | struct device *dev; |
62 | bool is_legacy_phy; | ||
63 | bool is_ulpi_phy; | ||
62 | }; | 64 | }; |
63 | 65 | ||
64 | struct tegra_usb_phy *tegra_usb_phy_open(struct device *dev, int instance, | 66 | struct tegra_usb_phy *tegra_usb_phy_open(struct device *dev, int instance, |
65 | void __iomem *regs, void *config, enum tegra_usb_phy_mode phy_mode); | 67 | void __iomem *regs, void *config, enum tegra_usb_phy_mode phy_mode); |
66 | 68 | ||
67 | void tegra_usb_phy_clk_disable(struct tegra_usb_phy *phy); | 69 | void tegra_usb_phy_preresume(struct usb_phy *phy); |
68 | 70 | ||
69 | void tegra_usb_phy_clk_enable(struct tegra_usb_phy *phy); | 71 | void tegra_usb_phy_postresume(struct usb_phy *phy); |
70 | 72 | ||
71 | void tegra_usb_phy_preresume(struct tegra_usb_phy *phy); | 73 | void tegra_ehci_phy_restore_start(struct usb_phy *phy, |
74 | enum tegra_usb_phy_port_speed port_speed); | ||
72 | 75 | ||
73 | void tegra_usb_phy_postresume(struct tegra_usb_phy *phy); | 76 | void tegra_ehci_phy_restore_end(struct usb_phy *phy); |
74 | 77 | ||
75 | void tegra_ehci_phy_restore_start(struct tegra_usb_phy *phy, | 78 | void tegra_ehci_set_pts(struct usb_phy *x, u8 pts_val); |
76 | enum tegra_usb_phy_port_speed port_speed); | ||
77 | 79 | ||
78 | void tegra_ehci_phy_restore_end(struct tegra_usb_phy *phy); | 80 | void tegra_ehci_set_phcd(struct usb_phy *x, bool enable); |
79 | 81 | ||
80 | #endif /* __TEGRA_USB_PHY_H */ | 82 | #endif /* __TEGRA_USB_PHY_H */ |
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h index 5de7a220e986..0e5ac93bab10 100644 --- a/include/linux/usb/usbnet.h +++ b/include/linux/usb/usbnet.h | |||
@@ -33,6 +33,7 @@ struct usbnet { | |||
33 | wait_queue_head_t *wait; | 33 | wait_queue_head_t *wait; |
34 | struct mutex phy_mutex; | 34 | struct mutex phy_mutex; |
35 | unsigned char suspend_count; | 35 | unsigned char suspend_count; |
36 | unsigned char pkt_cnt, pkt_err; | ||
36 | 37 | ||
37 | /* i/o info: pipes etc */ | 38 | /* i/o info: pipes etc */ |
38 | unsigned in, out; | 39 | unsigned in, out; |
@@ -70,6 +71,7 @@ struct usbnet { | |||
70 | # define EVENT_DEV_OPEN 7 | 71 | # define EVENT_DEV_OPEN 7 |
71 | # define EVENT_DEVICE_REPORT_IDLE 8 | 72 | # define EVENT_DEVICE_REPORT_IDLE 8 |
72 | # define EVENT_NO_RUNTIME_PM 9 | 73 | # define EVENT_NO_RUNTIME_PM 9 |
74 | # define EVENT_RX_KILL 10 | ||
73 | }; | 75 | }; |
74 | 76 | ||
75 | static inline struct usb_driver *driver_of(struct usb_interface *intf) | 77 | static inline struct usb_driver *driver_of(struct usb_interface *intf) |
@@ -100,7 +102,6 @@ struct driver_info { | |||
100 | #define FLAG_LINK_INTR 0x0800 /* updates link (carrier) status */ | 102 | #define FLAG_LINK_INTR 0x0800 /* updates link (carrier) status */ |
101 | 103 | ||
102 | #define FLAG_POINTTOPOINT 0x1000 /* possibly use "usb%d" names */ | 104 | #define FLAG_POINTTOPOINT 0x1000 /* possibly use "usb%d" names */ |
103 | #define FLAG_NOARP 0x2000 /* device can't do ARP */ | ||
104 | 105 | ||
105 | /* | 106 | /* |
106 | * Indicates to usbnet, that USB driver accumulates multiple IP packets. | 107 | * Indicates to usbnet, that USB driver accumulates multiple IP packets. |
@@ -108,6 +109,7 @@ struct driver_info { | |||
108 | */ | 109 | */ |
109 | #define FLAG_MULTI_PACKET 0x2000 | 110 | #define FLAG_MULTI_PACKET 0x2000 |
110 | #define FLAG_RX_ASSEMBLE 0x4000 /* rx packets may span >1 frames */ | 111 | #define FLAG_RX_ASSEMBLE 0x4000 /* rx packets may span >1 frames */ |
112 | #define FLAG_NOARP 0x8000 /* device can't do ARP */ | ||
111 | 113 | ||
112 | /* init device ... can sleep, or cause probe() failure */ | 114 | /* init device ... can sleep, or cause probe() failure */ |
113 | int (*bind)(struct usbnet *, struct usb_interface *); | 115 | int (*bind)(struct usbnet *, struct usb_interface *); |