diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-21 15:20:00 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-21 15:20:00 -0500 |
commit | 74e1a2a39355b2d3ae8c60c78d8add162c6d7183 (patch) | |
tree | 1ce09f285c505a774838a95cff7327a750dc85fc /include/linux/usb | |
parent | b5c78e04dd061b776978dad61dd85357081147b0 (diff) | |
parent | 6166805c3de539a41cfcae39026c5bc273d7c6aa (diff) |
Merge tag 'usb-3.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB patches from Greg Kroah-Hartman:
"Here's the big USB merge for 3.9-rc1
Nothing major, lots of gadget fixes, and of course, xhci stuff.
All of this has been in linux-next for a while, with the exception of
the last 3 patches, which were reverts of patches in the tree that
caused problems, they went in yesterday."
* tag 'usb-3.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (190 commits)
Revert "USB: EHCI: make ehci-vt8500 a separate driver"
Revert "USB: EHCI: make ehci-orion a separate driver"
Revert "USB: update host controller Kconfig entries"
USB: update host controller Kconfig entries
USB: EHCI: make ehci-orion a separate driver
USB: EHCI: make ehci-vt8500 a separate driver
USB: usb-storage: unusual_devs update for Super TOP SATA bridge
USB: ehci-omap: Fix autoloading of module
USB: ehci-omap: Don't free gpios that we didn't request
USB: option: add Huawei "ACM" devices using protocol = vendor
USB: serial: fix null-pointer dereferences on disconnect
USB: option: add Yota / Megafon M100-1 4g modem
drivers/usb: add missing GENERIC_HARDIRQS dependencies
USB: storage: properly handle the endian issues of idProduct
testusb: remove all mentions of 'usbfs'
usb: gadget: imx_udc: make it depend on BROKEN
usb: omap_control_usb: fix compile warning
ARM: OMAP: USB: Add phy binding information
ARM: OMAP2: MUSB: Specify omap4 has mailbox
ARM: OMAP: devices: create device for usb part of control module
...
Diffstat (limited to 'include/linux/usb')
-rw-r--r-- | include/linux/usb/composite.h | 75 | ||||
-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 |
8 files changed, 287 insertions, 11 deletions
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h index b09c37e04a91..3c671c1b37f6 100644 --- a/include/linux/usb/composite.h +++ b/include/linux/usb/composite.h | |||
@@ -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 | ||
@@ -316,7 +323,15 @@ struct usb_composite_driver { | |||
316 | extern int usb_composite_probe(struct usb_composite_driver *driver); | 323 | extern int usb_composite_probe(struct usb_composite_driver *driver); |
317 | extern void usb_composite_unregister(struct usb_composite_driver *driver); | 324 | extern void usb_composite_unregister(struct usb_composite_driver *driver); |
318 | extern void usb_composite_setup_continue(struct usb_composite_dev *cdev); | 325 | extern void usb_composite_setup_continue(struct usb_composite_dev *cdev); |
326 | extern int composite_dev_prepare(struct usb_composite_driver *composite, | ||
327 | struct usb_composite_dev *cdev); | ||
328 | void composite_dev_cleanup(struct usb_composite_dev *cdev); | ||
319 | 329 | ||
330 | static inline struct usb_composite_driver *to_cdriver( | ||
331 | struct usb_gadget_driver *gdrv) | ||
332 | { | ||
333 | return container_of(gdrv, struct usb_composite_driver, gadget_driver); | ||
334 | } | ||
320 | 335 | ||
321 | /** | 336 | /** |
322 | * struct usb_composite_device - represents one composite usb gadget | 337 | * struct usb_composite_device - represents one composite usb gadget |
@@ -360,6 +375,7 @@ struct usb_composite_dev { | |||
360 | unsigned int suspended:1; | 375 | unsigned int suspended:1; |
361 | struct usb_device_descriptor desc; | 376 | struct usb_device_descriptor desc; |
362 | struct list_head configs; | 377 | struct list_head configs; |
378 | struct list_head gstrings; | ||
363 | struct usb_composite_driver *driver; | 379 | struct usb_composite_driver *driver; |
364 | u8 next_string_id; | 380 | u8 next_string_id; |
365 | char *def_manufacturer; | 381 | char *def_manufacturer; |
@@ -381,8 +397,15 @@ struct usb_composite_dev { | |||
381 | extern int usb_string_id(struct usb_composite_dev *c); | 397 | extern int usb_string_id(struct usb_composite_dev *c); |
382 | extern int usb_string_ids_tab(struct usb_composite_dev *c, | 398 | extern int usb_string_ids_tab(struct usb_composite_dev *c, |
383 | struct usb_string *str); | 399 | struct usb_string *str); |
400 | extern struct usb_string *usb_gstrings_attach(struct usb_composite_dev *cdev, | ||
401 | struct usb_gadget_strings **sp, unsigned n_strings); | ||
402 | |||
384 | extern int usb_string_ids_n(struct usb_composite_dev *c, unsigned n); | 403 | extern int usb_string_ids_n(struct usb_composite_dev *c, unsigned n); |
385 | 404 | ||
405 | extern void composite_disconnect(struct usb_gadget *gadget); | ||
406 | extern int composite_setup(struct usb_gadget *gadget, | ||
407 | const struct usb_ctrlrequest *ctrl); | ||
408 | |||
386 | /* | 409 | /* |
387 | * Some systems will need runtime overrides for the product identifiers | 410 | * Some systems will need runtime overrides for the product identifiers |
388 | * published in the device descriptor, either numbers or strings or both. | 411 | * published in the device descriptor, either numbers or strings or both. |
@@ -431,6 +454,54 @@ static inline u16 get_default_bcdDevice(void) | |||
431 | return bcdDevice; | 454 | return bcdDevice; |
432 | } | 455 | } |
433 | 456 | ||
457 | struct usb_function_driver { | ||
458 | const char *name; | ||
459 | struct module *mod; | ||
460 | struct list_head list; | ||
461 | struct usb_function_instance *(*alloc_inst)(void); | ||
462 | struct usb_function *(*alloc_func)(struct usb_function_instance *inst); | ||
463 | }; | ||
464 | |||
465 | struct usb_function_instance { | ||
466 | struct usb_function_driver *fd; | ||
467 | void (*free_func_inst)(struct usb_function_instance *inst); | ||
468 | }; | ||
469 | |||
470 | void usb_function_unregister(struct usb_function_driver *f); | ||
471 | int usb_function_register(struct usb_function_driver *newf); | ||
472 | void usb_put_function_instance(struct usb_function_instance *fi); | ||
473 | void usb_put_function(struct usb_function *f); | ||
474 | struct usb_function_instance *usb_get_function_instance(const char *name); | ||
475 | struct usb_function *usb_get_function(struct usb_function_instance *fi); | ||
476 | |||
477 | struct usb_configuration *usb_get_config(struct usb_composite_dev *cdev, | ||
478 | int val); | ||
479 | int usb_add_config_only(struct usb_composite_dev *cdev, | ||
480 | struct usb_configuration *config); | ||
481 | void usb_remove_function(struct usb_configuration *c, struct usb_function *f); | ||
482 | |||
483 | #define DECLARE_USB_FUNCTION(_name, _inst_alloc, _func_alloc) \ | ||
484 | static struct usb_function_driver _name ## usb_func = { \ | ||
485 | .name = __stringify(_name), \ | ||
486 | .mod = THIS_MODULE, \ | ||
487 | .alloc_inst = _inst_alloc, \ | ||
488 | .alloc_func = _func_alloc, \ | ||
489 | }; \ | ||
490 | MODULE_ALIAS("usbfunc:"__stringify(_name)); | ||
491 | |||
492 | #define DECLARE_USB_FUNCTION_INIT(_name, _inst_alloc, _func_alloc) \ | ||
493 | DECLARE_USB_FUNCTION(_name, _inst_alloc, _func_alloc) \ | ||
494 | static int __init _name ## mod_init(void) \ | ||
495 | { \ | ||
496 | return usb_function_register(&_name ## usb_func); \ | ||
497 | } \ | ||
498 | static void __exit _name ## mod_exit(void) \ | ||
499 | { \ | ||
500 | usb_function_unregister(&_name ## usb_func); \ | ||
501 | } \ | ||
502 | module_init(_name ## mod_init); \ | ||
503 | module_exit(_name ## mod_exit) | ||
504 | |||
434 | /* messaging utils */ | 505 | /* messaging utils */ |
435 | #define DBG(d, fmt, args...) \ | 506 | #define DBG(d, fmt, args...) \ |
436 | dev_dbg(&(d)->gadget->dev , fmt , ## args) | 507 | 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 | }; | ||