From 968b822c0023861ef6e4e15bb68582b36e89ad29 Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Thu, 3 Nov 2011 12:03:38 -0400 Subject: USB: Remove the SAW_IRQ hcd flag The HCD_FLAG_SAW_IRQ flag was introduced in order to catch IRQ routing errors: If an URB was unlinked and the host controller hadn't gotten any IRQs, it seemed likely that the IRQs were directed to the wrong vector. This warning hasn't come up in many years, as far as I know; interrupt routing now seems to be well under control. Therefore there's no reason to keep the flag around any more. This patch (as1495) finally removes it. Signed-off-by: Alan Stern Signed-off-by: Greg Kroah-Hartman --- include/linux/usb/hcd.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'include') diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h index 03354d557b7..b2f62f3a32a 100644 --- a/include/linux/usb/hcd.h +++ b/include/linux/usb/hcd.h @@ -99,7 +99,6 @@ struct usb_hcd { */ unsigned long flags; #define HCD_FLAG_HW_ACCESSIBLE 0 /* at full power */ -#define HCD_FLAG_SAW_IRQ 1 #define HCD_FLAG_POLL_RH 2 /* poll for rh status? */ #define HCD_FLAG_POLL_PENDING 3 /* status has changed? */ #define HCD_FLAG_WAKEUP_PENDING 4 /* root hub is resuming? */ @@ -110,7 +109,6 @@ struct usb_hcd { * be slightly faster than test_bit(). */ #define HCD_HW_ACCESSIBLE(hcd) ((hcd)->flags & (1U << HCD_FLAG_HW_ACCESSIBLE)) -#define HCD_SAW_IRQ(hcd) ((hcd)->flags & (1U << HCD_FLAG_SAW_IRQ)) #define HCD_POLL_RH(hcd) ((hcd)->flags & (1U << HCD_FLAG_POLL_RH)) #define HCD_POLL_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_POLL_PENDING)) #define HCD_WAKEUP_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_WAKEUP_PENDING)) -- cgit v1.2.3 From 4556143cab73e013d0c3fa00f0f4f4373882399e Mon Sep 17 00:00:00 2001 From: Johan Hovold Date: Sun, 6 Nov 2011 19:06:25 +0100 Subject: USB: serial: remove write_urb_busy field from usb_serial_port Remove no longer used write_urb_busy field from struct usb_serial_port. Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- include/linux/usb/serial.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'include') diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index b29f70b2eca..8ccd405e900 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h @@ -62,7 +62,6 @@ enum port_dev_state { * @bulk_out_size: the size of the bulk_out_buffer, in bytes. * @write_urb: pointer to the bulk out struct urb for this port. * @write_fifo: kfifo used to buffer outgoing data - * @write_urb_busy: port`s writing status * @bulk_out_buffers: pointers to the bulk out buffers for this port * @write_urbs: pointers to the bulk out urbs for this port * @write_urbs_free: status bitmap the for bulk out urbs @@ -103,7 +102,6 @@ struct usb_serial_port { int bulk_out_size; struct urb *write_urb; struct kfifo write_fifo; - int write_urb_busy; unsigned char *bulk_out_buffers[2]; struct urb *write_urbs[2]; -- cgit v1.2.3 From d83b405383c965498923f3561c3321e2b5df5727 Mon Sep 17 00:00:00 2001 From: Johan Hovold Date: Sun, 6 Nov 2011 19:06:37 +0100 Subject: USB: serial: add support for multiple read urbs Add support for multiple read urbs to generic read implementation. Use a static array of two read urbs for now which is enough to get a 50% throughput increase in one test setup. Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- include/linux/usb/serial.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index 8ccd405e900..4267a9c717b 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h @@ -58,6 +58,9 @@ enum port_dev_state { * @read_urb: pointer to the bulk in struct urb for this port. * @bulk_in_endpointAddress: endpoint address for the bulk in pipe for this * port. + * @bulk_in_buffers: pointers to the bulk in buffers for this port + * @read_urbs: pointers to the bulk in urbs for this port + * @read_urbs_free: status bitmap the for bulk in urbs * @bulk_out_buffer: pointer to the bulk out buffer for this port. * @bulk_out_size: the size of the bulk_out_buffer, in bytes. * @write_urb: pointer to the bulk out struct urb for this port. @@ -98,6 +101,10 @@ struct usb_serial_port { struct urb *read_urb; __u8 bulk_in_endpointAddress; + unsigned char *bulk_in_buffers[2]; + struct urb *read_urbs[2]; + unsigned long read_urbs_free; + unsigned char *bulk_out_buffer; int bulk_out_size; struct urb *write_urb; @@ -338,7 +345,7 @@ extern void usb_serial_generic_disconnect(struct usb_serial *serial); extern void usb_serial_generic_release(struct usb_serial *serial); extern int usb_serial_generic_register(int debug); extern void usb_serial_generic_deregister(void); -extern int usb_serial_generic_submit_read_urb(struct usb_serial_port *port, +extern int usb_serial_generic_submit_read_urbs(struct usb_serial_port *port, gfp_t mem_flags); extern void usb_serial_generic_process_read_urb(struct urb *urb); extern int usb_serial_generic_prepare_write_buffer(struct usb_serial_port *port, -- cgit v1.2.3 From 2c4d6bf295ae10ffcd84f0df6cb642598eb66603 Mon Sep 17 00:00:00 2001 From: Johan Hovold Date: Thu, 10 Nov 2011 14:58:26 +0100 Subject: USB: move usb_translate_errors to linux/usb.h Move usb_translate_errors from usb core to linux/usb.h as it is meant to be accessed from drivers. Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- include/linux/usb.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'include') diff --git a/include/linux/usb.h b/include/linux/usb.h index d3d0c137433..2f05a7fa1ec 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -1598,6 +1598,19 @@ usb_maxpacket(struct usb_device *udev, int pipe, int is_out) /* ----------------------------------------------------------------------- */ +/* translate USB error codes to codes user space understands */ +static inline int usb_translate_errors(int error_code) +{ + switch (error_code) { + case 0: + case -ENOMEM: + case -ENODEV: + return error_code; + default: + return -EIO; + } +} + /* Events from the usb core */ #define USB_DEVICE_ADD 0x0001 #define USB_DEVICE_REMOVE 0x0002 -- cgit v1.2.3 From 0720a06a7518c9d0c0125bd5d1f3b6264c55c3dd Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Thu, 17 Nov 2011 16:42:19 -0500 Subject: NLS: improve UTF8 -> UTF16 string conversion routine The utf8s_to_utf16s conversion routine needs to be improved. Unlike its utf16s_to_utf8s sibling, it doesn't accept arguments specifying the maximum length of the output buffer or the endianness of its 16-bit output. This patch (as1501) adds the two missing arguments, and adjusts the only two places in the kernel where the function is called. A follow-on patch will add a third caller that does utilize the new capabilities. The two conversion routines are still annoyingly inconsistent in the way they handle invalid byte combinations. But that's a subject for a different patch. Signed-off-by: Alan Stern CC: Clemens Ladisch Signed-off-by: Greg Kroah-Hartman --- include/linux/nls.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/linux/nls.h b/include/linux/nls.h index d47beef08df..5dc635f8d79 100644 --- a/include/linux/nls.h +++ b/include/linux/nls.h @@ -43,7 +43,7 @@ enum utf16_endian { UTF16_BIG_ENDIAN }; -/* nls.c */ +/* nls_base.c */ extern int register_nls(struct nls_table *); extern int unregister_nls(struct nls_table *); extern struct nls_table *load_nls(char *); @@ -52,7 +52,8 @@ extern struct nls_table *load_nls_default(void); extern int utf8_to_utf32(const u8 *s, int len, unicode_t *pu); extern int utf32_to_utf8(unicode_t u, u8 *s, int maxlen); -extern int utf8s_to_utf16s(const u8 *s, int len, wchar_t *pwcs); +extern int utf8s_to_utf16s(const u8 *s, int len, + enum utf16_endian endian, wchar_t *pwcs, int maxlen); extern int utf16s_to_utf8s(const wchar_t *pwcs, int len, enum utf16_endian endian, u8 *s, int maxlen); -- cgit v1.2.3 From c8421147926fcacf53081a36438a0bed394da9f5 Mon Sep 17 00:00:00 2001 From: Aman Deep Date: Tue, 22 Nov 2011 19:33:36 +0530 Subject: xHCI: Adding #define values used for hub descriptor xhci-hub used some numerical values for initialisation of root hub descriptors. #define values are addded in usb 2.0 hub specification file and these values are used for root hub characteristics initialisation. Also use some #defines in places where magic numbers are being used. Signed-off-by: Aman Deep Acked-by: Sarah Sharp Signed-off-by: Greg Kroah-Hartman --- include/linux/usb/ch11.h | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/linux/usb/ch11.h b/include/linux/usb/ch11.h index 4ebaf082417..55e7325926c 100644 --- a/include/linux/usb/ch11.h +++ b/include/linux/usb/ch11.h @@ -165,11 +165,20 @@ struct usb_port_status { * wHubCharacteristics (masks) * See USB 2.0 spec Table 11-13, offset 3 */ -#define HUB_CHAR_LPSM 0x0003 /* D1 .. D0 */ -#define HUB_CHAR_COMPOUND 0x0004 /* D2 */ -#define HUB_CHAR_OCPM 0x0018 /* D4 .. D3 */ -#define HUB_CHAR_TTTT 0x0060 /* D6 .. D5 */ -#define HUB_CHAR_PORTIND 0x0080 /* D7 */ +#define HUB_CHAR_LPSM 0x0003 /* Logical Power Switching Mode mask */ +#define HUB_CHAR_COMMON_LPSM 0x0000 /* All ports power control at once */ +#define HUB_CHAR_INDV_PORT_LPSM 0x0001 /* per-port power control */ +#define HUB_CHAR_NO_LPSM 0x0002 /* no power switching */ + +#define HUB_CHAR_COMPOUND 0x0004 /* hub is part of a compound device */ + +#define HUB_CHAR_OCPM 0x0018 /* Over-Current Protection Mode mask */ +#define HUB_CHAR_COMMON_OCPM 0x0000 /* All ports Over-Current reporting */ +#define HUB_CHAR_INDV_PORT_OCPM 0x0008 /* per-port Over-current reporting */ +#define HUB_CHAR_NO_OCPM 0x0010 /* No Over-current Protection support */ + +#define HUB_CHAR_TTTT 0x0060 /* TT Think Time mask */ +#define HUB_CHAR_PORTIND 0x0080 /* per-port indicators (LEDs) */ struct usb_hub_status { __le16 wHubStatus; -- cgit v1.2.3 From bc677d5b64644c399cd3db6a905453e611f402ab Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Sat, 3 Dec 2011 23:41:31 +0100 Subject: usb: fix number of mapped SG DMA entries Add a new field num_mapped_sgs to struct urb so that we have a place to store the number of mapped entries and can also retain the original value of entries in num_sgs. Previously, usb_hcd_map_urb_for_dma() would overwrite this with the number of mapped entries, which would break dma_unmap_sg() because it requires the original number of entries. This fixes warnings like the following when using USB storage devices: ------------[ cut here ]------------ WARNING: at lib/dma-debug.c:902 check_unmap+0x4e4/0x695() ehci_hcd 0000:00:12.2: DMA-API: device driver frees DMA sg list with different entry count [map count=4] [unmap count=1] Modules linked in: ohci_hcd ehci_hcd Pid: 0, comm: kworker/0:1 Not tainted 3.2.0-rc2+ #319 Call Trace: [] warn_slowpath_common+0x80/0x98 [] warn_slowpath_fmt+0x41/0x43 [] check_unmap+0x4e4/0x695 [] ? trace_hardirqs_off+0xd/0xf [] ? _raw_spin_unlock_irqrestore+0x33/0x50 [] debug_dma_unmap_sg+0xeb/0x117 [] usb_hcd_unmap_urb_for_dma+0x71/0x188 [] unmap_urb_for_dma+0x20/0x22 [] usb_hcd_giveback_urb+0x5d/0xc0 [] ehci_urb_done+0xf7/0x10c [ehci_hcd] [] qh_completions+0x429/0x4bd [ehci_hcd] [] ehci_work+0x95/0x9c0 [ehci_hcd] ... ---[ end trace f29ac88a5a48c580 ]--- Mapped at: [] debug_dma_map_sg+0x45/0x139 [] usb_hcd_map_urb_for_dma+0x22e/0x478 [] usb_hcd_submit_urb+0x63f/0x6fa [] usb_submit_urb+0x2c7/0x2de [] usb_sg_wait+0x55/0x161 Signed-off-by: Clemens Ladisch Cc: stable Signed-off-by: Greg Kroah-Hartman --- include/linux/usb.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/linux/usb.h b/include/linux/usb.h index 2f05a7fa1ec..4269c3f8814 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -1221,6 +1221,7 @@ struct urb { void *transfer_buffer; /* (in) associated data buffer */ dma_addr_t transfer_dma; /* (in) dma addr for transfer_buffer */ struct scatterlist *sg; /* (in) scatter gather buffer list */ + int num_mapped_sgs; /* (internal) mapped sg entries */ int num_sgs; /* (in) number of entries in the sg list */ u32 transfer_buffer_length; /* (in) data buffer length */ u32 actual_length; /* (return) actual transfer length */ -- cgit v1.2.3 From 7bf01185c5e9ec19f739f7208646dc2e2cf1904b Mon Sep 17 00:00:00 2001 From: Aman Deep Date: Thu, 8 Dec 2011 12:05:22 +0530 Subject: USB: Adding #define in hub_configure() and hcd.c file This patch is in succession of previous patch commit c8421147926fcacf53081a36438a0bed394da9f5 xHCI: Adding #define values used for hub descriptor Hub descriptors characteristics #defines values are added in hub_configure() in place of magic numbers as asked by Alan Stern. And the indentation for switch and case is changed to be same. Some #defines values are added in ch11.h for defining hub class protocols and used in hub.c and hcd.c in which magic values were used for hub class protocols. Signed-off-by: Aman Deep Signed-off-by: Greg Kroah-Hartman --- include/linux/usb/ch11.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'include') diff --git a/include/linux/usb/ch11.h b/include/linux/usb/ch11.h index 55e7325926c..0832eb841a3 100644 --- a/include/linux/usb/ch11.h +++ b/include/linux/usb/ch11.h @@ -207,6 +207,17 @@ struct usb_hub_status { #define USB_DT_HUB_NONVAR_SIZE 7 #define USB_DT_SS_HUB_SIZE 12 +/* + * Hub Device descriptor + * USB Hub class device protocols + */ + +#define USB_HUB_PR_FS 0 /* Full speed hub */ +#define USB_HUB_PR_HS_NO_TT 0 /* Hi-speed hub without TT */ +#define USB_HUB_PR_HS_SINGLE_TT 1 /* Hi-speed hub with single TT */ +#define USB_HUB_PR_HS_MULTI_TT 2 /* Hi-speed hub with multiple TT */ +#define USB_HUB_PR_SS 3 /* Super speed hub */ + struct usb_hub_descriptor { __u8 bDescLength; __u8 bDescriptorType; -- cgit v1.2.3 From a49a88f108516fd5ae24e26df5a63beb847807df Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Sun, 23 Oct 2011 19:57:02 -0700 Subject: usb: gadget: renesas_usbhs: tidyup the unit of detection_delay detection_delay was assumed as msec Signed-off-by: Kuninori Morimoto Signed-off-by: Felipe Balbi --- include/linux/usb/renesas_usbhs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/usb/renesas_usbhs.h b/include/linux/usb/renesas_usbhs.h index e5a40c31854..c9fceb9f769 100644 --- a/include/linux/usb/renesas_usbhs.h +++ b/include/linux/usb/renesas_usbhs.h @@ -118,7 +118,7 @@ struct renesas_usbhs_driver_param { * * delay time from notify_hotplug callback */ - int detection_delay; + int detection_delay; /* msec */ /* * option: -- cgit v1.2.3 From f1ee56a0004c4a5974e7a69665330b6ff818bf92 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Sun, 23 Oct 2011 19:57:10 -0700 Subject: usb: gadget: renesas_usbhs: add platform power control function Signed-off-by: Kuninori Morimoto Signed-off-by: Felipe Balbi --- include/linux/usb/renesas_usbhs.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include') diff --git a/include/linux/usb/renesas_usbhs.h b/include/linux/usb/renesas_usbhs.h index c9fceb9f769..0d3f9887925 100644 --- a/include/linux/usb/renesas_usbhs.h +++ b/include/linux/usb/renesas_usbhs.h @@ -64,6 +64,14 @@ struct renesas_usbhs_platform_callback { */ void (*hardware_exit)(struct platform_device *pdev); + /* + * option: + * + * for board specific clock control + */ + void (*power_ctrl)(struct platform_device *pdev, + void __iomem *base, int enable); + /* * option: * -- cgit v1.2.3 From d327ab5b6d660d6fe22b073b743fde1668e593bb Mon Sep 17 00:00:00 2001 From: Michal Nazarewicz Date: Sat, 19 Nov 2011 18:27:37 +0100 Subject: usb: gadget: replace usb_gadget::is_dualspeed with max_speed This commit replaces usb_gadget's is_dualspeed field with a max_speed field. [ balbi@ti.com : Fixed DWC3 driver ] Signed-off-by: Michal Nazarewicz Signed-off-by: Felipe Balbi --- include/linux/usb/gadget.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index 1d3a67523ff..98dc306898b 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h @@ -477,8 +477,8 @@ struct usb_gadget_ops { * driver setup() requests * @ep_list: List of other endpoints supported by the device. * @speed: Speed of current connection to USB host. - * @is_dualspeed: True if the controller supports both high and full speed - * operation. If it does, the gadget driver must also support both. + * @max_speed: Maximal speed the UDC can handle. UDC must support this + * and all slower speeds. * @is_otg: True if the USB device port uses a Mini-AB jack, so that the * gadget driver must provide a USB OTG descriptor. * @is_a_peripheral: False unless is_otg, the "A" end of a USB cable @@ -518,7 +518,7 @@ struct usb_gadget { struct usb_ep *ep0; struct list_head ep_list; /* of usb_ep */ enum usb_device_speed speed; - unsigned is_dualspeed:1; + enum usb_device_speed max_speed; unsigned is_otg:1; unsigned is_a_peripheral:1; unsigned b_hnp_enable:1; @@ -549,7 +549,7 @@ static inline struct usb_gadget *dev_to_usb_gadget(struct device *dev) static inline int gadget_is_dualspeed(struct usb_gadget *g) { #ifdef CONFIG_USB_GADGET_DUALSPEED - /* runtime test would check "g->is_dualspeed" ... that might be + /* runtime test would check "g->max_speed" ... that might be * useful to work around hardware bugs, but is mostly pointless */ return 1; @@ -567,7 +567,7 @@ static inline int gadget_is_superspeed(struct usb_gadget *g) { #ifdef CONFIG_USB_GADGET_SUPERSPEED /* - * runtime test would check "g->is_superspeed" ... that might be + * runtime test would check "g->max_speed" ... that might be * useful to work around hardware bugs, but is mostly pointless */ return 1; -- cgit v1.2.3 From 7177aed44f515d949f587170e0e177ce17e74793 Mon Sep 17 00:00:00 2001 From: Michal Nazarewicz Date: Sat, 19 Nov 2011 18:27:38 +0100 Subject: usb: gadget: rename usb_gadget_driver::speed to max_speed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit renames the “speed” field of the usb_gadget_driver structure to “max_speed”. This is so that to make it more apparent that the field represents the maximum speed gadget driver can support. This also make the field look more like fields with the same name in usb_gadget and usb_composite_driver structures. All of those represent the *maximal* speed given entity supports. After this commit, there are the following fields in various structures: * usb_gadget::speed - the current connection speed, * usb_gadget::max_speed - maximal speed UDC supports, * usb_gadget_driver::max_speed - maximal speed gadget driver supports, and * usb_composite_driver::max_speed - maximal speed composite gadget supports. Signed-off-by: Michal Nazarewicz Signed-off-by: Felipe Balbi --- include/linux/usb/gadget.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index 98dc306898b..317d8925387 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h @@ -760,7 +760,7 @@ static inline int usb_gadget_disconnect(struct usb_gadget *gadget) /** * struct usb_gadget_driver - driver for usb 'slave' devices * @function: String describing the gadget's function - * @speed: Highest speed the driver handles. + * @max_speed: Highest speed the driver handles. * @setup: Invoked for ep0 control requests that aren't handled by * the hardware level driver. Most calls must be handled by * the gadget driver, including descriptor and configuration @@ -824,7 +824,7 @@ static inline int usb_gadget_disconnect(struct usb_gadget *gadget) */ struct usb_gadget_driver { char *function; - enum usb_device_speed speed; + enum usb_device_speed max_speed; void (*unbind)(struct usb_gadget *); int (*setup)(struct usb_gadget *, const struct usb_ctrlrequest *); -- cgit v1.2.3 From c91043adaf50ef13609003120f3471783460fb71 Mon Sep 17 00:00:00 2001 From: Qinglin Ye Date: Sun, 11 Dec 2011 16:40:22 +0800 Subject: USB: Remove the duplicate definition of HUB_SET_DEPTH The macro HUB_SET_DEPTH is defined twice in ch11.h (introduced by commit 0eadcc0 "usb: USB3.0 ch11 definitions" and dbe79bb "USB 3.0 Hub Changes"), so remove the duplicate one in the USB 2.0 part. Signed-off-by: Qinglin Ye Cc: John Youn Cc: Sergei Shtylyov Signed-off-by: Greg Kroah-Hartman --- include/linux/usb/ch11.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/linux/usb/ch11.h b/include/linux/usb/ch11.h index 0832eb841a3..31fdb4c6ee3 100644 --- a/include/linux/usb/ch11.h +++ b/include/linux/usb/ch11.h @@ -26,7 +26,6 @@ #define HUB_RESET_TT 9 #define HUB_GET_TT_STATE 10 #define HUB_STOP_TT 11 -#define HUB_SET_DEPTH 12 /* * Hub class additional requests defined by USB 3.0 spec -- cgit v1.2.3 From a7250db36308424ae040f1b2eeb5bfd0cbee0b0d Mon Sep 17 00:00:00 2001 From: Yu Xu Date: Mon, 19 Dec 2011 17:33:03 +0800 Subject: usb: gadget: enlarge maxburst bit width. For super speed bulk transfer, the max burst size is 16, so that 4 bits of maxburst cannot store it. Signed-off-by: Yu Xu Signed-off-by: Felipe Balbi --- include/linux/usb/gadget.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index 317d8925387..4d99805bcbb 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h @@ -164,7 +164,7 @@ struct usb_ep { unsigned maxpacket:16; unsigned max_streams:16; unsigned mult:2; - unsigned maxburst:4; + unsigned maxburst:5; u8 address; const struct usb_endpoint_descriptor *desc; const struct usb_ss_ep_comp_descriptor *comp_desc; -- cgit v1.2.3 From 5e6c86b017691230b6b47f19b7d5449997e8a0b8 Mon Sep 17 00:00:00 2001 From: Neil Zhang Date: Tue, 20 Dec 2011 13:20:21 +0800 Subject: usb: gadget: mv_udc: drop ARCH dependency This patch do the following things: 1. Change the Kconfig information. 2. Rename the driver name. 3. Don't do any type cast to io memory. 4. Add dummy stub for clk framework. Signed-off-by: Neil Zhang Signed-off-by: Felipe Balbi --- include/linux/platform_data/mv_usb.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/linux/platform_data/mv_usb.h b/include/linux/platform_data/mv_usb.h index e9d9149ddf3..a642cf20ad6 100644 --- a/include/linux/platform_data/mv_usb.h +++ b/include/linux/platform_data/mv_usb.h @@ -42,9 +42,17 @@ struct mv_usb_platform_data { /* only valid for HCD. OTG or Host only*/ unsigned int mode; - int (*phy_init)(unsigned int regbase); - void (*phy_deinit)(unsigned int regbase); + int (*phy_init)(void __iomem *regbase); + void (*phy_deinit)(void __iomem *regbase); int (*set_vbus)(unsigned int vbus); }; +#ifndef CONFIG_HAVE_CLK +/* Dummy stub for clk framework */ +#define clk_get(dev, id) NULL +#define clk_put(clock) do {} while (0) +#define clk_enable(clock) do {} while (0) +#define clk_disable(clock) do {} while (0) +#endif + #endif -- cgit v1.2.3 From 277164f03f466b7a1ea0d0c3dac8b8a0599ce0dc Mon Sep 17 00:00:00 2001 From: Neil Zhang Date: Tue, 20 Dec 2011 13:20:22 +0800 Subject: USB: OTG: add Marvell usb OTG driver support This driver is for ChipIdea USB OTG controller on Marvell Socs. PXA9xx/MMP2/MMP3/MGx all have this USB OTG controller. Signed-off-by: Neil Zhang Signed-off-by: Felipe Balbi --- include/linux/platform_data/mv_usb.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include') diff --git a/include/linux/platform_data/mv_usb.h b/include/linux/platform_data/mv_usb.h index a642cf20ad6..f4cb0ec373c 100644 --- a/include/linux/platform_data/mv_usb.h +++ b/include/linux/platform_data/mv_usb.h @@ -42,6 +42,11 @@ struct mv_usb_platform_data { /* only valid for HCD. OTG or Host only*/ unsigned int mode; + /* This flag is used for that needs id pin checked by otg */ + unsigned int disable_otg_clock_gating:1; + /* Force a_bus_req to be asserted */ + unsigned int otg_force_a_bus_req:1; + int (*phy_init)(void __iomem *regbase); void (*phy_deinit)(void __iomem *regbase); int (*set_vbus)(unsigned int vbus); -- cgit v1.2.3 From 3a082ec9b2f544a81e977cfa259e3f990a995dc8 Mon Sep 17 00:00:00 2001 From: Neil Zhang Date: Tue, 20 Dec 2011 13:20:23 +0800 Subject: USB: EHCI: Add Marvell Host Controller driver This patch adds support for EHCI compliant HSUSB Host controller found on Marvell Socs. It fits both OTG and SPH controller on marvell Socs, including PXA9xx/MMP2/MMP3/MGx. Signed-off-by: Neil Zhang Signed-off-by: Felipe Balbi --- include/linux/platform_data/mv_usb.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/linux/platform_data/mv_usb.h b/include/linux/platform_data/mv_usb.h index f4cb0ec373c..d94804aca76 100644 --- a/include/linux/platform_data/mv_usb.h +++ b/include/linux/platform_data/mv_usb.h @@ -50,6 +50,7 @@ struct mv_usb_platform_data { int (*phy_init)(void __iomem *regbase); void (*phy_deinit)(void __iomem *regbase); int (*set_vbus)(unsigned int vbus); + int (*private_init)(void __iomem *opregs, void __iomem *phyregs); }; #ifndef CONFIG_HAVE_CLK -- cgit v1.2.3 From 715a3e41e78a40e1e711298667435d5a2cef1972 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Heiko=20St=C3=BCbner?= Date: Mon, 19 Dec 2011 19:39:15 +0100 Subject: usb: gadget: s3c-hsudc: move platform_data struct to global header Gadget drivers should be compilable on all architectures. This patch removes one dependency on architecture-specific code. Acked-by: Kukjin Kim Signed-off-by: Heiko Stuebner Signed-off-by: Felipe Balbi --- include/linux/platform_data/s3c-hsudc.h | 34 +++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 include/linux/platform_data/s3c-hsudc.h (limited to 'include') diff --git a/include/linux/platform_data/s3c-hsudc.h b/include/linux/platform_data/s3c-hsudc.h new file mode 100644 index 00000000000..6fa109339bf --- /dev/null +++ b/include/linux/platform_data/s3c-hsudc.h @@ -0,0 +1,34 @@ +/* + * S3C24XX USB 2.0 High-speed USB controller gadget driver + * + * Copyright (c) 2010 Samsung Electronics Co., Ltd. + * http://www.samsung.com/ + * + * The S3C24XX USB 2.0 high-speed USB controller supports upto 9 endpoints. + * Each endpoint can be configured as either in or out endpoint. Endpoints + * can be configured for Bulk or Interrupt transfer mode. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. +*/ + +#ifndef __LINUX_USB_S3C_HSUDC_H +#define __LINUX_USB_S3C_HSUDC_H + +/** + * s3c24xx_hsudc_platdata - Platform data for USB High-Speed gadget controller. + * @epnum: Number of endpoints to be instantiated by the controller driver. + * @gpio_init: Platform specific USB related GPIO initialization. + * @gpio_uninit: Platform specific USB releted GPIO uninitialzation. + * + * Representation of platform data for the S3C24XX USB 2.0 High Speed gadget + * controllers. + */ +struct s3c24xx_hsudc_platdata { + unsigned int epnum; + void (*gpio_init)(void); + void (*gpio_uninit)(void); +}; + +#endif /* __LINUX_USB_S3C_HSUDC_H */ -- cgit v1.2.3 From 898c60867827796f0f6f84e5de446098d776c866 Mon Sep 17 00:00:00 2001 From: Felipe Balbi Date: Tue, 22 Nov 2011 11:11:50 +0200 Subject: usb: gadget: introduce support for sg lists Some controllers support scatter/gather transfers and that might be very useful for some gadget drivers. This means that we can make use of larger buffer allocations which means we will have less completion IRQs overtime, thus improving the perceived performance. Signed-off-by: Felipe Balbi --- include/linux/usb/gadget.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include') diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index 4d99805bcbb..da653b5c713 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -32,6 +33,9 @@ struct usb_ep; * @dma: DMA address corresponding to 'buf'. If you don't set this * field, and the usb controller needs one, it is responsible * for mapping and unmapping the buffer. + * @sg: a scatterlist for SG-capable controllers. + * @num_sgs: number of SG entries + * @num_mapped_sgs: number of SG entries mapped to DMA (internal) * @length: Length of that data * @stream_id: The stream id, when USB3.0 bulk streams are being used * @no_interrupt: If true, hints that no completion irq is needed. @@ -88,6 +92,10 @@ struct usb_request { unsigned length; dma_addr_t dma; + struct scatterlist *sg; + unsigned num_sgs; + unsigned num_mapped_sgs; + unsigned stream_id:16; unsigned no_interrupt:1; unsigned zero:1; @@ -479,6 +487,7 @@ struct usb_gadget_ops { * @speed: Speed of current connection to USB host. * @max_speed: Maximal speed the UDC can handle. UDC must support this * and all slower speeds. + * @sg_supported: true if we can handle scatter-gather * @is_otg: True if the USB device port uses a Mini-AB jack, so that the * gadget driver must provide a USB OTG descriptor. * @is_a_peripheral: False unless is_otg, the "A" end of a USB cable @@ -519,6 +528,7 @@ struct usb_gadget { struct list_head ep_list; /* of usb_ep */ enum usb_device_speed speed; enum usb_device_speed max_speed; + unsigned sg_supported:1; unsigned is_otg:1; unsigned is_a_peripheral:1; unsigned b_hnp_enable:1; -- cgit v1.2.3 From 18b7ede5f7ee2092aedcb578d3ac30bd5d4fc23c Mon Sep 17 00:00:00 2001 From: Felipe Balbi Date: Mon, 2 Jan 2012 13:35:41 +0200 Subject: usb: ch9: fix up MaxStreams helper According to USB 3.0 Specification Table 9-22, if bmAttributes [4:0] are set to zero, it means "no streams supported", but the way this helper was defined on Linux, we will *always* have one stream which might cause several problems. For example on DWC3, we would tell the controller endpoint has streams enabled and yet start transfers with Stream ID set to 0, which would goof up the host side. While doing that, convert the macro to an inline function due to the different checks we now need. Signed-off-by: Felipe Balbi Signed-off-by: Sarah Sharp Cc: stable Signed-off-by: Greg Kroah-Hartman --- include/linux/usb/ch9.h | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h index d5da6c68c25..61b29057b05 100644 --- a/include/linux/usb/ch9.h +++ b/include/linux/usb/ch9.h @@ -605,8 +605,26 @@ struct usb_ss_ep_comp_descriptor { } __attribute__ ((packed)); #define USB_DT_SS_EP_COMP_SIZE 6 + /* Bits 4:0 of bmAttributes if this is a bulk endpoint */ -#define USB_SS_MAX_STREAMS(p) (1 << ((p) & 0x1f)) +static inline int +usb_ss_max_streams(const struct usb_ss_ep_comp_descriptor *comp) +{ + int max_streams; + + if (!comp) + return 0; + + max_streams = comp->bmAttributes & 0x1f; + + if (!max_streams) + return 0; + + max_streams = 1 << max_streams; + + return max_streams; +} + /* Bits 1:0 of bmAttributes if this is an isoc endpoint */ #define USB_SS_MULT(p) (1 + ((p) & 0x3)) -- cgit v1.2.3