aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-03-20 14:26:30 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-03-20 14:26:30 -0400
commited378a52dabf77b406b447fd3238f83ea24b71fa (patch)
tree07e1a7ec2d1c08767ee81b9910f5912b80502632 /include/linux
parent843ec558f91b8e8fdb6efc908f2c0506407cc750 (diff)
parent11207b6fe05438b2e87a26435cd98db3d55e6fa7 (diff)
Merge tag 'usb-3.3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB merge for 3.4-rc1 from Greg KH: "Here's the big USB merge for the 3.4-rc1 merge window. Lots of gadget driver reworks here, driver updates, xhci changes, some new drivers added, usb-serial core reworking to fix some bugs, and other various minor things. There are some patches touching arch code, but they have all been acked by the various arch maintainers." * tag 'usb-3.3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (302 commits) net: qmi_wwan: add support for ZTE MF820D USB: option: add ZTE MF820D usb: gadget: f_fs: Remove lock is held before freeing checks USB: option: make interface blacklist work again usb/ub: deprecate & schedule for removal the "Low Performance USB Block" driver USB: ohci-pxa27x: add clk_prepare/clk_unprepare calls USB: use generic platform driver on ath79 USB: EHCI: Add a generic platform device driver USB: OHCI: Add a generic platform device driver USB: ftdi_sio: new PID: LUMEL PD12 USB: ftdi_sio: add support for FT-X series devices USB: serial: mos7840: Fixed MCS7820 device attach problem usb: Don't make USB_ARCH_HAS_{XHCI,OHCI,EHCI} depend on USB_SUPPORT. usb gadget: fix a section mismatch when compiling g_ffs with CONFIG_USB_FUNCTIONFS_ETH USB: ohci-nxp: Remove i2c_write(), use smbus USB: ohci-nxp: Support for LPC32xx USB: ohci-nxp: Rename symbols from pnx4008 to nxp USB: OHCI-HCD: Rename ohci-pnx4008 to ohci-nxp usb: gadget: Kconfig: fix typo for 'different' usb: dwc3: pci: fix another failure path in dwc3_pci_probe() ...
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/device.h7
-rw-r--r--include/linux/platform_data/dwc3-exynos.h24
-rw-r--r--include/linux/usb.h10
-rw-r--r--include/linux/usb/audio-v2.h21
-rw-r--r--include/linux/usb/cdc-wdm.h19
-rw-r--r--include/linux/usb/ch11.h5
-rw-r--r--include/linux/usb/ch9.h5
-rw-r--r--include/linux/usb/ehci_pdriver.h46
-rw-r--r--include/linux/usb/gadget.h10
-rw-r--r--include/linux/usb/hcd.h4
-rw-r--r--include/linux/usb/intel_mid_otg.h6
-rw-r--r--include/linux/usb/msm_hsusb.h2
-rw-r--r--include/linux/usb/ohci_pdriver.h38
-rw-r--r--include/linux/usb/otg.h164
-rw-r--r--include/linux/usb/renesas_usbhs.h1
-rw-r--r--include/linux/usb/serial.h36
-rw-r--r--include/linux/usb/storage.h38
-rw-r--r--include/linux/usb/uas.h69
-rw-r--r--include/linux/usb/ulpi.h4
19 files changed, 425 insertions, 84 deletions
diff --git a/include/linux/device.h b/include/linux/device.h
index f62e21689fdd..7c46bc32fcbf 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -1005,19 +1005,20 @@ extern long sysfs_deprecated;
1005 * @__driver: driver name 1005 * @__driver: driver name
1006 * @__register: register function for this driver type 1006 * @__register: register function for this driver type
1007 * @__unregister: unregister function for this driver type 1007 * @__unregister: unregister function for this driver type
1008 * @...: Additional arguments to be passed to __register and __unregister.
1008 * 1009 *
1009 * Use this macro to construct bus specific macros for registering 1010 * Use this macro to construct bus specific macros for registering
1010 * drivers, and do not use it on its own. 1011 * drivers, and do not use it on its own.
1011 */ 1012 */
1012#define module_driver(__driver, __register, __unregister) \ 1013#define module_driver(__driver, __register, __unregister, ...) \
1013static int __init __driver##_init(void) \ 1014static int __init __driver##_init(void) \
1014{ \ 1015{ \
1015 return __register(&(__driver)); \ 1016 return __register(&(__driver) , ##__VA_ARGS__); \
1016} \ 1017} \
1017module_init(__driver##_init); \ 1018module_init(__driver##_init); \
1018static void __exit __driver##_exit(void) \ 1019static void __exit __driver##_exit(void) \
1019{ \ 1020{ \
1020 __unregister(&(__driver)); \ 1021 __unregister(&(__driver) , ##__VA_ARGS__); \
1021} \ 1022} \
1022module_exit(__driver##_exit); 1023module_exit(__driver##_exit);
1023 1024
diff --git a/include/linux/platform_data/dwc3-exynos.h b/include/linux/platform_data/dwc3-exynos.h
new file mode 100644
index 000000000000..5eb7da9b3772
--- /dev/null
+++ b/include/linux/platform_data/dwc3-exynos.h
@@ -0,0 +1,24 @@
1/**
2 * dwc3-exynos.h - Samsung EXYNOS DWC3 Specific Glue layer, header.
3 *
4 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com
6 *
7 * Author: Anton Tikhomirov <av.tikhomirov@samsung.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 */
14
15#ifndef _DWC3_EXYNOS_H_
16#define _DWC3_EXYNOS_H_
17
18struct dwc3_exynos_data {
19 int phy_type;
20 int (*phy_init)(struct platform_device *pdev, int type);
21 int (*phy_exit)(struct platform_device *pdev, int type);
22};
23
24#endif /* _DWC3_EXYNOS_H_ */
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 69d845739bc2..73b68d1f2cb0 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -376,6 +376,12 @@ struct usb_bus {
376 376
377struct usb_tt; 377struct usb_tt;
378 378
379enum usb_device_removable {
380 USB_DEVICE_REMOVABLE_UNKNOWN = 0,
381 USB_DEVICE_REMOVABLE,
382 USB_DEVICE_FIXED,
383};
384
379/** 385/**
380 * struct usb_device - kernel's representation of a USB device 386 * struct usb_device - kernel's representation of a USB device
381 * @devnum: device number; address on a USB bus 387 * @devnum: device number; address on a USB bus
@@ -432,6 +438,7 @@ struct usb_tt;
432 * @wusb_dev: if this is a Wireless USB device, link to the WUSB 438 * @wusb_dev: if this is a Wireless USB device, link to the WUSB
433 * specific data for the device. 439 * specific data for the device.
434 * @slot_id: Slot ID assigned by xHCI 440 * @slot_id: Slot ID assigned by xHCI
441 * @removable: Device can be physically removed from this port
435 * 442 *
436 * Notes: 443 * Notes:
437 * Usbcore drivers should not set usbdev->state directly. Instead use 444 * Usbcore drivers should not set usbdev->state directly. Instead use
@@ -494,7 +501,7 @@ struct usb_device {
494#endif 501#endif
495 502
496 int maxchild; 503 int maxchild;
497 struct usb_device *children[USB_MAXCHILDREN]; 504 struct usb_device **children;
498 505
499 u32 quirks; 506 u32 quirks;
500 atomic_t urbnum; 507 atomic_t urbnum;
@@ -509,6 +516,7 @@ struct usb_device {
509#endif 516#endif
510 struct wusb_dev *wusb_dev; 517 struct wusb_dev *wusb_dev;
511 int slot_id; 518 int slot_id;
519 enum usb_device_removable removable;
512}; 520};
513#define to_usb_device(d) container_of(d, struct usb_device, dev) 521#define to_usb_device(d) container_of(d, struct usb_device, dev)
514 522
diff --git a/include/linux/usb/audio-v2.h b/include/linux/usb/audio-v2.h
index 964cb603f7c7..ed13053153f4 100644
--- a/include/linux/usb/audio-v2.h
+++ b/include/linux/usb/audio-v2.h
@@ -43,6 +43,27 @@ static inline bool uac2_control_is_writeable(u32 bmControls, u8 control)
43 return (bmControls >> (control * 2)) & 0x2; 43 return (bmControls >> (control * 2)) & 0x2;
44} 44}
45 45
46/* 4.7.2 Class-Specific AC Interface Descriptor */
47struct uac2_ac_header_descriptor {
48 __u8 bLength; /* 9 */
49 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
50 __u8 bDescriptorSubtype; /* UAC_MS_HEADER */
51 __le16 bcdADC; /* 0x0200 */
52 __u8 bCategory;
53 __le16 wTotalLength; /* includes Unit and Terminal desc. */
54 __u8 bmControls;
55} __packed;
56
57/* 2.3.1.6 Type I Format Type Descriptor (Frmts20 final.pdf)*/
58struct uac2_format_type_i_descriptor {
59 __u8 bLength; /* in bytes: 6 */
60 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
61 __u8 bDescriptorSubtype; /* FORMAT_TYPE */
62 __u8 bFormatType; /* FORMAT_TYPE_1 */
63 __u8 bSubslotSize; /* {1,2,3,4} */
64 __u8 bBitResolution;
65} __packed;
66
46/* 4.7.2.1 Clock Source Descriptor */ 67/* 4.7.2.1 Clock Source Descriptor */
47 68
48struct uac_clock_source_descriptor { 69struct uac_clock_source_descriptor {
diff --git a/include/linux/usb/cdc-wdm.h b/include/linux/usb/cdc-wdm.h
new file mode 100644
index 000000000000..719c332620fa
--- /dev/null
+++ b/include/linux/usb/cdc-wdm.h
@@ -0,0 +1,19 @@
1/*
2 * USB CDC Device Management subdriver
3 *
4 * Copyright (c) 2012 Bjørn Mork <bjorn@mork.no>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
9 */
10
11#ifndef __LINUX_USB_CDC_WDM_H
12#define __LINUX_USB_CDC_WDM_H
13
14extern struct usb_driver *usb_cdc_wdm_register(struct usb_interface *intf,
15 struct usb_endpoint_descriptor *ep,
16 int bufsize,
17 int (*manage_power)(struct usb_interface *, int));
18
19#endif /* __LINUX_USB_CDC_WDM_H */
diff --git a/include/linux/usb/ch11.h b/include/linux/usb/ch11.h
index 0b83acd3360a..f1d26b6067f1 100644
--- a/include/linux/usb/ch11.h
+++ b/include/linux/usb/ch11.h
@@ -76,6 +76,11 @@
76#define USB_PORT_FEAT_C_BH_PORT_RESET 29 76#define USB_PORT_FEAT_C_BH_PORT_RESET 29
77#define USB_PORT_FEAT_FORCE_LINKPM_ACCEPT 30 77#define USB_PORT_FEAT_FORCE_LINKPM_ACCEPT 30
78 78
79/* USB 3.0 hub remote wake mask bits, see table 10-14 */
80#define USB_PORT_FEAT_REMOTE_WAKE_CONNECT (1 << 8)
81#define USB_PORT_FEAT_REMOTE_WAKE_DISCONNECT (1 << 9)
82#define USB_PORT_FEAT_REMOTE_WAKE_OVER_CURRENT (1 << 10)
83
79/* 84/*
80 * Hub Status and Hub Change results 85 * Hub Status and Hub Change results
81 * See USB 2.0 spec Table 11-19 and Table 11-20 86 * See USB 2.0 spec Table 11-19 and Table 11-20
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
index 3b6f628880f8..af21f3115919 100644
--- a/include/linux/usb/ch9.h
+++ b/include/linux/usb/ch9.h
@@ -789,6 +789,11 @@ struct usb_ext_cap_descriptor { /* Link Power Management */
789 __u8 bDevCapabilityType; 789 __u8 bDevCapabilityType;
790 __le32 bmAttributes; 790 __le32 bmAttributes;
791#define USB_LPM_SUPPORT (1 << 1) /* supports LPM */ 791#define USB_LPM_SUPPORT (1 << 1) /* supports LPM */
792#define USB_BESL_SUPPORT (1 << 2) /* supports BESL */
793#define USB_BESL_BASELINE_VALID (1 << 3) /* Baseline BESL valid*/
794#define USB_BESL_DEEP_VALID (1 << 4) /* Deep BESL valid */
795#define USB_GET_BESL_BASELINE(p) (((p) & (0xf << 8)) >> 8)
796#define USB_GET_BESL_DEEP(p) (((p) & (0xf << 12)) >> 12)
792} __attribute__((packed)); 797} __attribute__((packed));
793 798
794#define USB_DT_USB_EXT_CAP_SIZE 7 799#define USB_DT_USB_EXT_CAP_SIZE 7
diff --git a/include/linux/usb/ehci_pdriver.h b/include/linux/usb/ehci_pdriver.h
new file mode 100644
index 000000000000..1894f42fe3f7
--- /dev/null
+++ b/include/linux/usb/ehci_pdriver.h
@@ -0,0 +1,46 @@
1/*
2 * Copyright (C) 2012 Hauke Mehrtens <hauke@hauke-m.de>
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18
19#ifndef __USB_CORE_EHCI_PDRIVER_H
20#define __USB_CORE_EHCI_PDRIVER_H
21
22/**
23 * struct usb_ehci_pdata - platform_data for generic ehci driver
24 *
25 * @caps_offset: offset of the EHCI Capability Registers to the start of
26 * the io memory region provided to the driver.
27 * @has_tt: set to 1 if TT is integrated in root hub.
28 * @port_power_on: set to 1 if the controller needs a power up after
29 * initialization.
30 * @port_power_off: set to 1 if the controller needs to be powered down
31 * after initialization.
32 *
33 * These are general configuration options for the EHCI controller. All of
34 * these options are activating more or less workarounds for some hardware.
35 */
36struct usb_ehci_pdata {
37 int caps_offset;
38 unsigned has_tt:1;
39 unsigned has_synopsys_hc_bug:1;
40 unsigned big_endian_desc:1;
41 unsigned big_endian_mmio:1;
42 unsigned port_power_on:1;
43 unsigned port_power_off:1;
44};
45
46#endif /* __USB_CORE_EHCI_PDRIVER_H */
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index da653b5c7134..9517466ababb 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -950,6 +950,16 @@ static inline void usb_free_descriptors(struct usb_descriptor_header **v)
950 950
951/*-------------------------------------------------------------------------*/ 951/*-------------------------------------------------------------------------*/
952 952
953/* utility to simplify map/unmap of usb_requests to/from DMA */
954
955extern int usb_gadget_map_request(struct usb_gadget *gadget,
956 struct usb_request *req, int is_in);
957
958extern void usb_gadget_unmap_request(struct usb_gadget *gadget,
959 struct usb_request *req, int is_in);
960
961/*-------------------------------------------------------------------------*/
962
953/* utility wrapping a simple endpoint selection policy */ 963/* utility wrapping a simple endpoint selection policy */
954 964
955extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *, 965extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *,
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index b2f62f3a32af..5de415707c23 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -127,7 +127,7 @@ struct usb_hcd {
127 unsigned authorized_default:1; 127 unsigned authorized_default:1;
128 unsigned has_tt:1; /* Integrated TT in root hub */ 128 unsigned has_tt:1; /* Integrated TT in root hub */
129 129
130 int irq; /* irq allocated */ 130 unsigned int irq; /* irq allocated */
131 void __iomem *regs; /* device memory/io */ 131 void __iomem *regs; /* device memory/io */
132 u64 rsrc_start; /* memory/io resource start */ 132 u64 rsrc_start; /* memory/io resource start */
133 u64 rsrc_len; /* memory/io resource length */ 133 u64 rsrc_len; /* memory/io resource length */
@@ -412,6 +412,8 @@ extern irqreturn_t usb_hcd_irq(int irq, void *__hcd);
412 412
413extern void usb_hc_died(struct usb_hcd *hcd); 413extern void usb_hc_died(struct usb_hcd *hcd);
414extern void usb_hcd_poll_rh_status(struct usb_hcd *hcd); 414extern void usb_hcd_poll_rh_status(struct usb_hcd *hcd);
415extern void usb_wakeup_notification(struct usb_device *hdev,
416 unsigned int portnum);
415 417
416/* The D0/D1 toggle bits ... USE WITH CAUTION (they're almost hcd-internal) */ 418/* The D0/D1 toggle bits ... USE WITH CAUTION (they're almost hcd-internal) */
417#define usb_gettoggle(dev, ep, out) (((dev)->toggle[out] >> (ep)) & 1) 419#define usb_gettoggle(dev, ep, out) (((dev)->toggle[out] >> (ep)) & 1)
diff --git a/include/linux/usb/intel_mid_otg.h b/include/linux/usb/intel_mid_otg.h
index a0ccf795f362..756cf5543ffd 100644
--- a/include/linux/usb/intel_mid_otg.h
+++ b/include/linux/usb/intel_mid_otg.h
@@ -104,11 +104,11 @@ struct iotg_ulpi_access_ops {
104/* 104/*
105 * the Intel MID (Langwell/Penwell) otg transceiver driver needs to interact 105 * the Intel MID (Langwell/Penwell) otg transceiver driver needs to interact
106 * with device and host drivers to implement the USB OTG related feature. More 106 * with device and host drivers to implement the USB OTG related feature. More
107 * function members are added based on otg_transceiver data structure for this 107 * function members are added based on usb_phy data structure for this
108 * purpose. 108 * purpose.
109 */ 109 */
110struct intel_mid_otg_xceiv { 110struct intel_mid_otg_xceiv {
111 struct otg_transceiver otg; 111 struct usb_phy otg;
112 struct otg_hsm hsm; 112 struct otg_hsm hsm;
113 113
114 /* base address */ 114 /* base address */
@@ -147,7 +147,7 @@ struct intel_mid_otg_xceiv {
147 147
148}; 148};
149static inline 149static inline
150struct intel_mid_otg_xceiv *otg_to_mid_xceiv(struct otg_transceiver *otg) 150struct intel_mid_otg_xceiv *otg_to_mid_xceiv(struct usb_phy *otg)
151{ 151{
152 return container_of(otg, struct intel_mid_otg_xceiv, otg); 152 return container_of(otg, struct intel_mid_otg_xceiv, otg);
153} 153}
diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h
index 00311fe9d0df..22a396c13f3a 100644
--- a/include/linux/usb/msm_hsusb.h
+++ b/include/linux/usb/msm_hsusb.h
@@ -160,7 +160,7 @@ struct msm_otg_platform_data {
160 * detection process. 160 * detection process.
161 */ 161 */
162struct msm_otg { 162struct msm_otg {
163 struct otg_transceiver otg; 163 struct usb_phy phy;
164 struct msm_otg_platform_data *pdata; 164 struct msm_otg_platform_data *pdata;
165 int irq; 165 int irq;
166 struct clk *clk; 166 struct clk *clk;
diff --git a/include/linux/usb/ohci_pdriver.h b/include/linux/usb/ohci_pdriver.h
new file mode 100644
index 000000000000..2808f2a9cce8
--- /dev/null
+++ b/include/linux/usb/ohci_pdriver.h
@@ -0,0 +1,38 @@
1/*
2 * Copyright (C) 2012 Hauke Mehrtens <hauke@hauke-m.de>
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18
19#ifndef __USB_CORE_OHCI_PDRIVER_H
20#define __USB_CORE_OHCI_PDRIVER_H
21
22/**
23 * struct usb_ohci_pdata - platform_data for generic ohci driver
24 *
25 * @big_endian_desc: BE descriptors
26 * @big_endian_mmio: BE registers
27 * @no_big_frame_no: no big endian frame_no shift
28 *
29 * These are general configuration options for the OHCI controller. All of
30 * these options are activating more or less workarounds for some hardware.
31 */
32struct usb_ohci_pdata {
33 unsigned big_endian_desc:1;
34 unsigned big_endian_mmio:1;
35 unsigned no_big_frame_no:1;
36};
37
38#endif /* __USB_CORE_OHCI_PDRIVER_H */
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index d87f44f5b04e..f67810f8f21b 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -35,7 +35,7 @@ enum usb_otg_state {
35 OTG_STATE_A_VBUS_ERR, 35 OTG_STATE_A_VBUS_ERR,
36}; 36};
37 37
38enum usb_xceiv_events { 38enum usb_phy_events {
39 USB_EVENT_NONE, /* no events or cable disconnected */ 39 USB_EVENT_NONE, /* no events or cable disconnected */
40 USB_EVENT_VBUS, /* vbus valid event */ 40 USB_EVENT_VBUS, /* vbus valid event */
41 USB_EVENT_ID, /* id was grounded */ 41 USB_EVENT_ID, /* id was grounded */
@@ -43,14 +43,39 @@ enum usb_xceiv_events {
43 USB_EVENT_ENUMERATED, /* gadget driver enumerated */ 43 USB_EVENT_ENUMERATED, /* gadget driver enumerated */
44}; 44};
45 45
46struct otg_transceiver; 46struct usb_phy;
47 47
48/* for transceivers connected thru an ULPI interface, the user must 48/* for transceivers connected thru an ULPI interface, the user must
49 * provide access ops 49 * provide access ops
50 */ 50 */
51struct otg_io_access_ops { 51struct usb_phy_io_ops {
52 int (*read)(struct otg_transceiver *otg, u32 reg); 52 int (*read)(struct usb_phy *x, u32 reg);
53 int (*write)(struct otg_transceiver *otg, u32 val, u32 reg); 53 int (*write)(struct usb_phy *x, u32 val, u32 reg);
54};
55
56struct usb_otg {
57 u8 default_a;
58
59 struct usb_phy *phy;
60 struct usb_bus *host;
61 struct usb_gadget *gadget;
62
63 /* bind/unbind the host controller */
64 int (*set_host)(struct usb_otg *otg, struct usb_bus *host);
65
66 /* bind/unbind the peripheral controller */
67 int (*set_peripheral)(struct usb_otg *otg,
68 struct usb_gadget *gadget);
69
70 /* effective for A-peripheral, ignored for B devices */
71 int (*set_vbus)(struct usb_otg *otg, bool enabled);
72
73 /* for B devices only: start session with A-Host */
74 int (*start_srp)(struct usb_otg *otg);
75
76 /* start or continue HNP role switch */
77 int (*start_hnp)(struct usb_otg *otg);
78
54}; 79};
55 80
56/* 81/*
@@ -59,22 +84,20 @@ struct otg_io_access_ops {
59 * moment, using the transceiver, ID signal, HNP and sometimes static 84 * moment, using the transceiver, ID signal, HNP and sometimes static
60 * configuration information (including "board isn't wired for otg"). 85 * configuration information (including "board isn't wired for otg").
61 */ 86 */
62struct otg_transceiver { 87struct usb_phy {
63 struct device *dev; 88 struct device *dev;
64 const char *label; 89 const char *label;
65 unsigned int flags; 90 unsigned int flags;
66 91
67 u8 default_a;
68 enum usb_otg_state state; 92 enum usb_otg_state state;
69 enum usb_xceiv_events last_event; 93 enum usb_phy_events last_event;
70 94
71 struct usb_bus *host; 95 struct usb_otg *otg;
72 struct usb_gadget *gadget;
73 96
74 struct otg_io_access_ops *io_ops; 97 struct usb_phy_io_ops *io_ops;
75 void __iomem *io_priv; 98 void __iomem *io_priv;
76 99
77 /* for notification of usb_xceiv_events */ 100 /* for notification of usb_phy_events */
78 struct atomic_notifier_head notifier; 101 struct atomic_notifier_head notifier;
79 102
80 /* to pass extra port status to the root hub */ 103 /* to pass extra port status to the root hub */
@@ -82,40 +105,22 @@ struct otg_transceiver {
82 u16 port_change; 105 u16 port_change;
83 106
84 /* initialize/shutdown the OTG controller */ 107 /* initialize/shutdown the OTG controller */
85 int (*init)(struct otg_transceiver *otg); 108 int (*init)(struct usb_phy *x);
86 void (*shutdown)(struct otg_transceiver *otg); 109 void (*shutdown)(struct usb_phy *x);
87
88 /* bind/unbind the host controller */
89 int (*set_host)(struct otg_transceiver *otg,
90 struct usb_bus *host);
91
92 /* bind/unbind the peripheral controller */
93 int (*set_peripheral)(struct otg_transceiver *otg,
94 struct usb_gadget *gadget);
95 110
96 /* effective for B devices, ignored for A-peripheral */ 111 /* effective for B devices, ignored for A-peripheral */
97 int (*set_power)(struct otg_transceiver *otg, 112 int (*set_power)(struct usb_phy *x,
98 unsigned mA); 113 unsigned mA);
99 114
100 /* effective for A-peripheral, ignored for B devices */
101 int (*set_vbus)(struct otg_transceiver *otg,
102 bool enabled);
103
104 /* for non-OTG B devices: set transceiver into suspend mode */ 115 /* for non-OTG B devices: set transceiver into suspend mode */
105 int (*set_suspend)(struct otg_transceiver *otg, 116 int (*set_suspend)(struct usb_phy *x,
106 int suspend); 117 int suspend);
107 118
108 /* for B devices only: start session with A-Host */
109 int (*start_srp)(struct otg_transceiver *otg);
110
111 /* start or continue HNP role switch */
112 int (*start_hnp)(struct otg_transceiver *otg);
113
114}; 119};
115 120
116 121
117/* for board-specific init logic */ 122/* for board-specific init logic */
118extern int otg_set_transceiver(struct otg_transceiver *); 123extern int usb_set_transceiver(struct usb_phy *);
119 124
120#if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE) && defined(MODULE)) 125#if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE) && defined(MODULE))
121/* sometimes transceivers are accessed only through e.g. ULPI */ 126/* sometimes transceivers are accessed only through e.g. ULPI */
@@ -132,50 +137,50 @@ static inline void usb_nop_xceiv_unregister(void)
132#endif 137#endif
133 138
134/* helpers for direct access thru low-level io interface */ 139/* helpers for direct access thru low-level io interface */
135static inline int otg_io_read(struct otg_transceiver *otg, u32 reg) 140static inline int usb_phy_io_read(struct usb_phy *x, u32 reg)
136{ 141{
137 if (otg->io_ops && otg->io_ops->read) 142 if (x->io_ops && x->io_ops->read)
138 return otg->io_ops->read(otg, reg); 143 return x->io_ops->read(x, reg);
139 144
140 return -EINVAL; 145 return -EINVAL;
141} 146}
142 147
143static inline int otg_io_write(struct otg_transceiver *otg, u32 val, u32 reg) 148static inline int usb_phy_io_write(struct usb_phy *x, u32 val, u32 reg)
144{ 149{
145 if (otg->io_ops && otg->io_ops->write) 150 if (x->io_ops && x->io_ops->write)
146 return otg->io_ops->write(otg, val, reg); 151 return x->io_ops->write(x, val, reg);
147 152
148 return -EINVAL; 153 return -EINVAL;
149} 154}
150 155
151static inline int 156static inline int
152otg_init(struct otg_transceiver *otg) 157usb_phy_init(struct usb_phy *x)
153{ 158{
154 if (otg->init) 159 if (x->init)
155 return otg->init(otg); 160 return x->init(x);
156 161
157 return 0; 162 return 0;
158} 163}
159 164
160static inline void 165static inline void
161otg_shutdown(struct otg_transceiver *otg) 166usb_phy_shutdown(struct usb_phy *x)
162{ 167{
163 if (otg->shutdown) 168 if (x->shutdown)
164 otg->shutdown(otg); 169 x->shutdown(x);
165} 170}
166 171
167/* for usb host and peripheral controller drivers */ 172/* for usb host and peripheral controller drivers */
168#ifdef CONFIG_USB_OTG_UTILS 173#ifdef CONFIG_USB_OTG_UTILS
169extern struct otg_transceiver *otg_get_transceiver(void); 174extern struct usb_phy *usb_get_transceiver(void);
170extern void otg_put_transceiver(struct otg_transceiver *); 175extern void usb_put_transceiver(struct usb_phy *);
171extern const char *otg_state_string(enum usb_otg_state state); 176extern const char *otg_state_string(enum usb_otg_state state);
172#else 177#else
173static inline struct otg_transceiver *otg_get_transceiver(void) 178static inline struct usb_phy *usb_get_transceiver(void)
174{ 179{
175 return NULL; 180 return NULL;
176} 181}
177 182
178static inline void otg_put_transceiver(struct otg_transceiver *x) 183static inline void usb_put_transceiver(struct usb_phy *x)
179{ 184{
180} 185}
181 186
@@ -187,67 +192,84 @@ static inline const char *otg_state_string(enum usb_otg_state state)
187 192
188/* Context: can sleep */ 193/* Context: can sleep */
189static inline int 194static inline int
190otg_start_hnp(struct otg_transceiver *otg) 195otg_start_hnp(struct usb_otg *otg)
191{ 196{
192 return otg->start_hnp(otg); 197 if (otg && otg->start_hnp)
198 return otg->start_hnp(otg);
199
200 return -ENOTSUPP;
193} 201}
194 202
195/* Context: can sleep */ 203/* Context: can sleep */
196static inline int 204static inline int
197otg_set_vbus(struct otg_transceiver *otg, bool enabled) 205otg_set_vbus(struct usb_otg *otg, bool enabled)
198{ 206{
199 return otg->set_vbus(otg, enabled); 207 if (otg && otg->set_vbus)
208 return otg->set_vbus(otg, enabled);
209
210 return -ENOTSUPP;
200} 211}
201 212
202/* for HCDs */ 213/* for HCDs */
203static inline int 214static inline int
204otg_set_host(struct otg_transceiver *otg, struct usb_bus *host) 215otg_set_host(struct usb_otg *otg, struct usb_bus *host)
205{ 216{
206 return otg->set_host(otg, host); 217 if (otg && otg->set_host)
218 return otg->set_host(otg, host);
219
220 return -ENOTSUPP;
207} 221}
208 222
209/* for usb peripheral controller drivers */ 223/* for usb peripheral controller drivers */
210 224
211/* Context: can sleep */ 225/* Context: can sleep */
212static inline int 226static inline int
213otg_set_peripheral(struct otg_transceiver *otg, struct usb_gadget *periph) 227otg_set_peripheral(struct usb_otg *otg, struct usb_gadget *periph)
214{ 228{
215 return otg->set_peripheral(otg, periph); 229 if (otg && otg->set_peripheral)
230 return otg->set_peripheral(otg, periph);
231
232 return -ENOTSUPP;
216} 233}
217 234
218static inline int 235static inline int
219otg_set_power(struct otg_transceiver *otg, unsigned mA) 236usb_phy_set_power(struct usb_phy *x, unsigned mA)
220{ 237{
221 return otg->set_power(otg, mA); 238 if (x && x->set_power)
239 return x->set_power(x, mA);
240 return 0;
222} 241}
223 242
224/* Context: can sleep */ 243/* Context: can sleep */
225static inline int 244static inline int
226otg_set_suspend(struct otg_transceiver *otg, int suspend) 245usb_phy_set_suspend(struct usb_phy *x, int suspend)
227{ 246{
228 if (otg->set_suspend != NULL) 247 if (x->set_suspend != NULL)
229 return otg->set_suspend(otg, suspend); 248 return x->set_suspend(x, suspend);
230 else 249 else
231 return 0; 250 return 0;
232} 251}
233 252
234static inline int 253static inline int
235otg_start_srp(struct otg_transceiver *otg) 254otg_start_srp(struct usb_otg *otg)
236{ 255{
237 return otg->start_srp(otg); 256 if (otg && otg->start_srp)
257 return otg->start_srp(otg);
258
259 return -ENOTSUPP;
238} 260}
239 261
240/* notifiers */ 262/* notifiers */
241static inline int 263static inline int
242otg_register_notifier(struct otg_transceiver *otg, struct notifier_block *nb) 264usb_register_notifier(struct usb_phy *x, struct notifier_block *nb)
243{ 265{
244 return atomic_notifier_chain_register(&otg->notifier, nb); 266 return atomic_notifier_chain_register(&x->notifier, nb);
245} 267}
246 268
247static inline void 269static inline void
248otg_unregister_notifier(struct otg_transceiver *otg, struct notifier_block *nb) 270usb_unregister_notifier(struct usb_phy *x, struct notifier_block *nb)
249{ 271{
250 atomic_notifier_chain_unregister(&otg->notifier, nb); 272 atomic_notifier_chain_unregister(&x->notifier, nb);
251} 273}
252 274
253/* for OTG controller drivers (and maybe other stuff) */ 275/* for OTG controller drivers (and maybe other stuff) */
diff --git a/include/linux/usb/renesas_usbhs.h b/include/linux/usb/renesas_usbhs.h
index 0d3f98879256..547e59cc00ea 100644
--- a/include/linux/usb/renesas_usbhs.h
+++ b/include/linux/usb/renesas_usbhs.h
@@ -149,6 +149,7 @@ struct renesas_usbhs_driver_param {
149 * option: 149 * option:
150 */ 150 */
151 u32 has_otg:1; /* for controlling PWEN/EXTLP */ 151 u32 has_otg:1; /* for controlling PWEN/EXTLP */
152 u32 has_sudmac:1; /* for SUDMAC */
152}; 153};
153 154
154/* 155/*
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 4267a9c717ba..fbb666b1b670 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -300,8 +300,10 @@ struct usb_serial_driver {
300#define to_usb_serial_driver(d) \ 300#define to_usb_serial_driver(d) \
301 container_of(d, struct usb_serial_driver, driver) 301 container_of(d, struct usb_serial_driver, driver)
302 302
303extern int usb_serial_register(struct usb_serial_driver *driver); 303extern int usb_serial_register_drivers(struct usb_driver *udriver,
304extern void usb_serial_deregister(struct usb_serial_driver *driver); 304 struct usb_serial_driver * const serial_drivers[]);
305extern void usb_serial_deregister_drivers(struct usb_driver *udriver,
306 struct usb_serial_driver * const serial_drivers[]);
305extern void usb_serial_port_softint(struct usb_serial_port *port); 307extern void usb_serial_port_softint(struct usb_serial_port *port);
306 308
307extern int usb_serial_probe(struct usb_interface *iface, 309extern int usb_serial_probe(struct usb_interface *iface,
@@ -389,5 +391,35 @@ do { \
389 printk(KERN_DEBUG "%s: " format "\n", __FILE__, ##arg); \ 391 printk(KERN_DEBUG "%s: " format "\n", __FILE__, ##arg); \
390} while (0) 392} while (0)
391 393
394/*
395 * Macro for reporting errors in write path to avoid inifinite loop
396 * when port is used as a console.
397 */
398#define dev_err_console(usport, fmt, ...) \
399do { \
400 static bool __print_once; \
401 struct usb_serial_port *__port = (usport); \
402 \
403 if (!__port->port.console || !__print_once) { \
404 __print_once = true; \
405 dev_err(&__port->dev, fmt, ##__VA_ARGS__); \
406 } \
407} while (0)
408
409/*
410 * module_usb_serial_driver() - Helper macro for registering a USB Serial driver
411 * @__usb_driver: usb_driver struct to register
412 * @__serial_drivers: list of usb_serial drivers to register
413 *
414 * Helper macro for USB serial drivers which do not do anything special
415 * in module init/exit. This eliminates a lot of boilerplate. Each
416 * module may only use this macro once, and calling it replaces
417 * module_init() and module_exit()
418 *
419 */
420#define module_usb_serial_driver(__usb_driver, __serial_drivers) \
421 module_driver(__usb_driver, usb_serial_register_drivers, \
422 usb_serial_deregister_drivers, __serial_drivers)
423
392#endif /* __LINUX_USB_SERIAL_H */ 424#endif /* __LINUX_USB_SERIAL_H */
393 425
diff --git a/include/linux/usb/storage.h b/include/linux/usb/storage.h
index d7fc910f1dc4..cb33fff2ba0b 100644
--- a/include/linux/usb/storage.h
+++ b/include/linux/usb/storage.h
@@ -45,4 +45,42 @@
45 45
46#define USB_PR_DEVICE 0xff /* Use device's value */ 46#define USB_PR_DEVICE 0xff /* Use device's value */
47 47
48 /*
49 * Bulk only data structures
50 */
51
52/* command block wrapper */
53struct bulk_cb_wrap {
54 __le32 Signature; /* contains 'USBC' */
55 __u32 Tag; /* unique per command id */
56 __le32 DataTransferLength; /* size of data */
57 __u8 Flags; /* direction in bit 0 */
58 __u8 Lun; /* LUN normally 0 */
59 __u8 Length; /* of of the CDB */
60 __u8 CDB[16]; /* max command */
61};
62
63#define US_BULK_CB_WRAP_LEN 31
64#define US_BULK_CB_SIGN 0x43425355 /*spells out USBC */
65#define US_BULK_FLAG_IN (1 << 7)
66#define US_BULK_FLAG_OUT 0
67
68/* command status wrapper */
69struct bulk_cs_wrap {
70 __le32 Signature; /* should = 'USBS' */
71 __u32 Tag; /* same as original command */
72 __le32 Residue; /* amount not transferred */
73 __u8 Status; /* see below */
74};
75
76#define US_BULK_CS_WRAP_LEN 13
77#define US_BULK_CS_SIGN 0x53425355 /* spells out 'USBS' */
78#define US_BULK_STAT_OK 0
79#define US_BULK_STAT_FAIL 1
80#define US_BULK_STAT_PHASE 2
81
82/* bulk-only class specific requests */
83#define US_BULK_RESET_REQUEST 0xff
84#define US_BULK_GET_MAX_LUN 0xfe
85
48#endif 86#endif
diff --git a/include/linux/usb/uas.h b/include/linux/usb/uas.h
new file mode 100644
index 000000000000..9a988e413694
--- /dev/null
+++ b/include/linux/usb/uas.h
@@ -0,0 +1,69 @@
1#ifndef __USB_UAS_H__
2#define __USB_UAS_H__
3
4#include <scsi/scsi.h>
5#include <scsi/scsi_cmnd.h>
6
7/* Common header for all IUs */
8struct iu {
9 __u8 iu_id;
10 __u8 rsvd1;
11 __be16 tag;
12};
13
14enum {
15 IU_ID_COMMAND = 0x01,
16 IU_ID_STATUS = 0x03,
17 IU_ID_RESPONSE = 0x04,
18 IU_ID_TASK_MGMT = 0x05,
19 IU_ID_READ_READY = 0x06,
20 IU_ID_WRITE_READY = 0x07,
21};
22
23struct command_iu {
24 __u8 iu_id;
25 __u8 rsvd1;
26 __be16 tag;
27 __u8 prio_attr;
28 __u8 rsvd5;
29 __u8 len;
30 __u8 rsvd7;
31 struct scsi_lun lun;
32 __u8 cdb[16]; /* XXX: Overflow-checking tools may misunderstand */
33};
34
35/*
36 * Also used for the Read Ready and Write Ready IUs since they have the
37 * same first four bytes
38 */
39struct sense_iu {
40 __u8 iu_id;
41 __u8 rsvd1;
42 __be16 tag;
43 __be16 status_qual;
44 __u8 status;
45 __u8 rsvd7[7];
46 __be16 len;
47 __u8 sense[SCSI_SENSE_BUFFERSIZE];
48};
49
50struct usb_pipe_usage_descriptor {
51 __u8 bLength;
52 __u8 bDescriptorType;
53
54 __u8 bPipeID;
55 __u8 Reserved;
56} __attribute__((__packed__));
57
58enum {
59 CMD_PIPE_ID = 1,
60 STATUS_PIPE_ID = 2,
61 DATA_IN_PIPE_ID = 3,
62 DATA_OUT_PIPE_ID = 4,
63
64 UAS_SIMPLE_TAG = 0,
65 UAS_HEAD_TAG = 1,
66 UAS_ORDERED_TAG = 2,
67 UAS_ACA = 4,
68};
69#endif
diff --git a/include/linux/usb/ulpi.h b/include/linux/usb/ulpi.h
index 9595796d62ed..6f033a415ecb 100644
--- a/include/linux/usb/ulpi.h
+++ b/include/linux/usb/ulpi.h
@@ -181,12 +181,12 @@
181 181
182/*-------------------------------------------------------------------------*/ 182/*-------------------------------------------------------------------------*/
183 183
184struct otg_transceiver *otg_ulpi_create(struct otg_io_access_ops *ops, 184struct usb_phy *otg_ulpi_create(struct usb_phy_io_ops *ops,
185 unsigned int flags); 185 unsigned int flags);
186 186
187#ifdef CONFIG_USB_ULPI_VIEWPORT 187#ifdef CONFIG_USB_ULPI_VIEWPORT
188/* access ops for controllers with a viewport register */ 188/* access ops for controllers with a viewport register */
189extern struct otg_io_access_ops ulpi_viewport_access_ops; 189extern struct usb_phy_io_ops ulpi_viewport_access_ops;
190#endif 190#endif
191 191
192#endif /* __LINUX_USB_ULPI_H */ 192#endif /* __LINUX_USB_ULPI_H */