aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/usb
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-08-13 18:28:01 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-08-13 18:28:01 -0400
commit165f60642ae988f0b9dcfd4988806e7a938b26c7 (patch)
tree29293f73a4b022620f68dbf48d7450e501be5855 /include/linux/usb
parentc23bda365dfbf56aa4d6d4a97f83136c36050e01 (diff)
parent8b841cb217fac676498de3dfe8fabe38b39cba4e (diff)
Merge tag 'usb-for-v3.12' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next
Felipe writes: usb: patches for v3.12 merge window All patches here have been pending on linux-usb and sitting in linux-next for a while now. The biggest things in this tag are: DWC3 learned proper usage of threaded IRQ handlers and now we spend very little time in hardirq context. MUSB now has proper support for BeagleBone and Beaglebone Black. Tegra's USB support also got quite a bit of love and is learning to use PHY layer and generic DT attributes. Other than that, the usual pack of cleanups and non-critical fixes follow. Signed-of-by: Felipe Balbi <balbi@ti.com> Conflicts: drivers/usb/gadget/udc-core.c drivers/usb/host/ehci-tegra.c drivers/usb/musb/omap2430.c drivers/usb/musb/tusb6010.c
Diffstat (limited to 'include/linux/usb')
-rw-r--r--include/linux/usb/gadget.h4
-rw-r--r--include/linux/usb/of.h10
-rw-r--r--include/linux/usb/phy.h18
-rw-r--r--include/linux/usb/tegra_usb_phy.h40
-rw-r--r--include/linux/usb/usb_phy_gen_xceiv.h (renamed from include/linux/usb/nop-usb-xceiv.h)4
5 files changed, 49 insertions, 27 deletions
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index f1b0dca60f12..942ef5e053bf 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -22,6 +22,7 @@
22#include <linux/slab.h> 22#include <linux/slab.h>
23#include <linux/scatterlist.h> 23#include <linux/scatterlist.h>
24#include <linux/types.h> 24#include <linux/types.h>
25#include <linux/workqueue.h>
25#include <linux/usb/ch9.h> 26#include <linux/usb/ch9.h>
26 27
27struct usb_ep; 28struct usb_ep;
@@ -475,6 +476,7 @@ struct usb_gadget_ops {
475 476
476/** 477/**
477 * struct usb_gadget - represents a usb slave device 478 * struct usb_gadget - represents a usb slave device
479 * @work: (internal use) Workqueue to be used for sysfs_notify()
478 * @ops: Function pointers used to access hardware-specific operations. 480 * @ops: Function pointers used to access hardware-specific operations.
479 * @ep0: Endpoint zero, used when reading or writing responses to 481 * @ep0: Endpoint zero, used when reading or writing responses to
480 * driver setup() requests 482 * driver setup() requests
@@ -520,6 +522,7 @@ struct usb_gadget_ops {
520 * device is acting as a B-Peripheral (so is_a_peripheral is false). 522 * device is acting as a B-Peripheral (so is_a_peripheral is false).
521 */ 523 */
522struct usb_gadget { 524struct usb_gadget {
525 struct work_struct work;
523 /* readonly to gadget driver */ 526 /* readonly to gadget driver */
524 const struct usb_gadget_ops *ops; 527 const struct usb_gadget_ops *ops;
525 struct usb_ep *ep0; 528 struct usb_ep *ep0;
@@ -538,6 +541,7 @@ struct usb_gadget {
538 unsigned out_epnum; 541 unsigned out_epnum;
539 unsigned in_epnum; 542 unsigned in_epnum;
540}; 543};
544#define work_to_gadget(w) (container_of((w), struct usb_gadget, work))
541 545
542static inline void set_gadget_data(struct usb_gadget *gadget, void *data) 546static inline void set_gadget_data(struct usb_gadget *gadget, void *data)
543 { dev_set_drvdata(&gadget->dev, data); } 547 { dev_set_drvdata(&gadget->dev, data); }
diff --git a/include/linux/usb/of.h b/include/linux/usb/of.h
index a0ef405368b8..8c38aa26b3bb 100644
--- a/include/linux/usb/of.h
+++ b/include/linux/usb/of.h
@@ -7,19 +7,27 @@
7#ifndef __LINUX_USB_OF_H 7#ifndef __LINUX_USB_OF_H
8#define __LINUX_USB_OF_H 8#define __LINUX_USB_OF_H
9 9
10#include <linux/usb/ch9.h>
10#include <linux/usb/otg.h> 11#include <linux/usb/otg.h>
11#include <linux/usb/phy.h> 12#include <linux/usb/phy.h>
12 13
13#if IS_ENABLED(CONFIG_OF) 14#if IS_ENABLED(CONFIG_OF)
14enum usb_dr_mode of_usb_get_dr_mode(struct device_node *np); 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);
15#else 17#else
16static inline enum usb_dr_mode of_usb_get_dr_mode(struct device_node *np) 18static inline enum usb_dr_mode of_usb_get_dr_mode(struct device_node *np)
17{ 19{
18 return USB_DR_MODE_UNKNOWN; 20 return USB_DR_MODE_UNKNOWN;
19} 21}
22
23static inline enum usb_device_speed
24of_usb_get_maximum_speed(struct device_node *np)
25{
26 return USB_SPEED_UNKNOWN;
27}
20#endif 28#endif
21 29
22#if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_USB_PHY) 30#if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_USB_SUPPORT)
23enum usb_phy_interface of_usb_get_phy_mode(struct device_node *np); 31enum usb_phy_interface of_usb_get_phy_mode(struct device_node *np);
24#else 32#else
25static inline enum usb_phy_interface of_usb_get_phy_mode(struct device_node *np) 33static inline enum usb_phy_interface of_usb_get_phy_mode(struct device_node *np)
diff --git a/include/linux/usb/phy.h b/include/linux/usb/phy.h
index 44036808bf0f..6c0b1c513db7 100644
--- a/include/linux/usb/phy.h
+++ b/include/linux/usb/phy.h
@@ -142,7 +142,7 @@ extern void usb_remove_phy(struct usb_phy *);
142/* helpers for direct access thru low-level io interface */ 142/* helpers for direct access thru low-level io interface */
143static inline int usb_phy_io_read(struct usb_phy *x, u32 reg) 143static inline int usb_phy_io_read(struct usb_phy *x, u32 reg)
144{ 144{
145 if (x->io_ops && x->io_ops->read) 145 if (x && x->io_ops && x->io_ops->read)
146 return x->io_ops->read(x, reg); 146 return x->io_ops->read(x, reg);
147 147
148 return -EINVAL; 148 return -EINVAL;
@@ -150,7 +150,7 @@ static inline int usb_phy_io_read(struct usb_phy *x, u32 reg)
150 150
151static inline int usb_phy_io_write(struct usb_phy *x, u32 val, u32 reg) 151static inline int usb_phy_io_write(struct usb_phy *x, u32 val, u32 reg)
152{ 152{
153 if (x->io_ops && x->io_ops->write) 153 if (x && x->io_ops && x->io_ops->write)
154 return x->io_ops->write(x, val, reg); 154 return x->io_ops->write(x, val, reg);
155 155
156 return -EINVAL; 156 return -EINVAL;
@@ -159,7 +159,7 @@ static inline int usb_phy_io_write(struct usb_phy *x, u32 val, u32 reg)
159static inline int 159static inline int
160usb_phy_init(struct usb_phy *x) 160usb_phy_init(struct usb_phy *x)
161{ 161{
162 if (x->init) 162 if (x && x->init)
163 return x->init(x); 163 return x->init(x);
164 164
165 return 0; 165 return 0;
@@ -168,14 +168,14 @@ usb_phy_init(struct usb_phy *x)
168static inline void 168static inline void
169usb_phy_shutdown(struct usb_phy *x) 169usb_phy_shutdown(struct usb_phy *x)
170{ 170{
171 if (x->shutdown) 171 if (x && x->shutdown)
172 x->shutdown(x); 172 x->shutdown(x);
173} 173}
174 174
175static inline int 175static inline int
176usb_phy_vbus_on(struct usb_phy *x) 176usb_phy_vbus_on(struct usb_phy *x)
177{ 177{
178 if (!x->set_vbus) 178 if (!x || !x->set_vbus)
179 return 0; 179 return 0;
180 180
181 return x->set_vbus(x, true); 181 return x->set_vbus(x, true);
@@ -184,7 +184,7 @@ usb_phy_vbus_on(struct usb_phy *x)
184static inline int 184static inline int
185usb_phy_vbus_off(struct usb_phy *x) 185usb_phy_vbus_off(struct usb_phy *x)
186{ 186{
187 if (!x->set_vbus) 187 if (!x || !x->set_vbus)
188 return 0; 188 return 0;
189 189
190 return x->set_vbus(x, false); 190 return x->set_vbus(x, false);
@@ -258,7 +258,7 @@ usb_phy_set_power(struct usb_phy *x, unsigned mA)
258static inline int 258static inline int
259usb_phy_set_suspend(struct usb_phy *x, int suspend) 259usb_phy_set_suspend(struct usb_phy *x, int suspend)
260{ 260{
261 if (x->set_suspend != NULL) 261 if (x && x->set_suspend != NULL)
262 return x->set_suspend(x, suspend); 262 return x->set_suspend(x, suspend);
263 else 263 else
264 return 0; 264 return 0;
@@ -267,7 +267,7 @@ usb_phy_set_suspend(struct usb_phy *x, int suspend)
267static inline int 267static inline int
268usb_phy_notify_connect(struct usb_phy *x, enum usb_device_speed speed) 268usb_phy_notify_connect(struct usb_phy *x, enum usb_device_speed speed)
269{ 269{
270 if (x->notify_connect) 270 if (x && x->notify_connect)
271 return x->notify_connect(x, speed); 271 return x->notify_connect(x, speed);
272 else 272 else
273 return 0; 273 return 0;
@@ -276,7 +276,7 @@ usb_phy_notify_connect(struct usb_phy *x, enum usb_device_speed speed)
276static inline int 276static inline int
277usb_phy_notify_disconnect(struct usb_phy *x, enum usb_device_speed speed) 277usb_phy_notify_disconnect(struct usb_phy *x, enum usb_device_speed speed)
278{ 278{
279 if (x->notify_disconnect) 279 if (x && x->notify_disconnect)
280 return x->notify_disconnect(x, speed); 280 return x->notify_disconnect(x, speed);
281 else 281 else
282 return 0; 282 return 0;
diff --git a/include/linux/usb/tegra_usb_phy.h b/include/linux/usb/tegra_usb_phy.h
index d2ca919a5b73..1de16c324ec8 100644
--- a/include/linux/usb/tegra_usb_phy.h
+++ b/include/linux/usb/tegra_usb_phy.h
@@ -18,19 +18,36 @@
18#include <linux/clk.h> 18#include <linux/clk.h>
19#include <linux/usb/otg.h> 19#include <linux/usb/otg.h>
20 20
21/*
22 * utmi_pll_config_in_car_module: true if the UTMI PLL configuration registers
23 * should be set up by clk-tegra, false if by the PHY code
24 * has_hostpc: true if the USB controller has the HOSTPC extension, which
25 * changes the location of the PHCD and PTS fields
26 * requires_usbmode_setup: true if the USBMODE register needs to be set to
27 * enter host mode
28 * requires_extra_tuning_parameters: true if xcvr_hsslew, hssquelch_level
29 * and hsdiscon_level should be set for adequate signal quality
30 */
31
32struct tegra_phy_soc_config {
33 bool utmi_pll_config_in_car_module;
34 bool has_hostpc;
35 bool requires_usbmode_setup;
36 bool requires_extra_tuning_parameters;
37};
38
21struct tegra_utmip_config { 39struct tegra_utmip_config {
22 u8 hssync_start_delay; 40 u8 hssync_start_delay;
23 u8 elastic_limit; 41 u8 elastic_limit;
24 u8 idle_wait_delay; 42 u8 idle_wait_delay;
25 u8 term_range_adj; 43 u8 term_range_adj;
44 bool xcvr_setup_use_fuses;
26 u8 xcvr_setup; 45 u8 xcvr_setup;
27 u8 xcvr_lsfslew; 46 u8 xcvr_lsfslew;
28 u8 xcvr_lsrslew; 47 u8 xcvr_lsrslew;
29}; 48 u8 xcvr_hsslew;
30 49 u8 hssquelch_level;
31struct tegra_ulpi_config { 50 u8 hsdiscon_level;
32 int reset_gpio;
33 const char *clk;
34}; 51};
35 52
36enum tegra_usb_phy_port_speed { 53enum tegra_usb_phy_port_speed {
@@ -39,12 +56,6 @@ enum tegra_usb_phy_port_speed {
39 TEGRA_USB_PHY_PORT_SPEED_HIGH, 56 TEGRA_USB_PHY_PORT_SPEED_HIGH,
40}; 57};
41 58
42enum tegra_usb_phy_mode {
43 TEGRA_USB_PHY_MODE_DEVICE,
44 TEGRA_USB_PHY_MODE_HOST,
45 TEGRA_USB_PHY_MODE_OTG,
46};
47
48struct tegra_xtal_freq; 59struct tegra_xtal_freq;
49 60
50struct tegra_usb_phy { 61struct tegra_usb_phy {
@@ -55,18 +66,17 @@ struct tegra_usb_phy {
55 struct clk *clk; 66 struct clk *clk;
56 struct clk *pll_u; 67 struct clk *pll_u;
57 struct clk *pad_clk; 68 struct clk *pad_clk;
58 enum tegra_usb_phy_mode mode; 69 struct regulator *vbus;
70 enum usb_dr_mode mode;
59 void *config; 71 void *config;
72 const struct tegra_phy_soc_config *soc_config;
60 struct usb_phy *ulpi; 73 struct usb_phy *ulpi;
61 struct usb_phy u_phy; 74 struct usb_phy u_phy;
62 struct device *dev;
63 bool is_legacy_phy; 75 bool is_legacy_phy;
64 bool is_ulpi_phy; 76 bool is_ulpi_phy;
65 int reset_gpio; 77 int reset_gpio;
66}; 78};
67 79
68struct usb_phy *tegra_usb_get_phy(struct device_node *dn);
69
70void tegra_usb_phy_preresume(struct usb_phy *phy); 80void tegra_usb_phy_preresume(struct usb_phy *phy);
71 81
72void tegra_usb_phy_postresume(struct usb_phy *phy); 82void tegra_usb_phy_postresume(struct usb_phy *phy);
diff --git a/include/linux/usb/nop-usb-xceiv.h b/include/linux/usb/usb_phy_gen_xceiv.h
index 148d35171aac..f9a7e7bc925b 100644
--- a/include/linux/usb/nop-usb-xceiv.h
+++ b/include/linux/usb/usb_phy_gen_xceiv.h
@@ -3,7 +3,7 @@
3 3
4#include <linux/usb/otg.h> 4#include <linux/usb/otg.h>
5 5
6struct nop_usb_xceiv_platform_data { 6struct usb_phy_gen_xceiv_platform_data {
7 enum usb_phy_type type; 7 enum usb_phy_type type;
8 unsigned long clk_rate; 8 unsigned long clk_rate;
9 9
@@ -12,7 +12,7 @@ struct nop_usb_xceiv_platform_data {
12 unsigned int needs_reset:1; 12 unsigned int needs_reset:1;
13}; 13};
14 14
15#if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE) && defined(MODULE)) 15#if IS_ENABLED(CONFIG_NOP_USB_XCEIV)
16/* sometimes transceivers are accessed only through e.g. ULPI */ 16/* sometimes transceivers are accessed only through e.g. ULPI */
17extern void usb_nop_xceiv_register(void); 17extern void usb_nop_xceiv_register(void);
18extern void usb_nop_xceiv_unregister(void); 18extern void usb_nop_xceiv_unregister(void);