Skip to content

Commit e4049eb

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6: (29 commits) USB: sl811-hcd: Fix device disconnect USB: ohci-at91: fix power management hanging USB: rename usb_buffer_alloc() and usb_buffer_free() USB: ti_usb: fix printk format warning USB: gadget: s3c-hsotg: Add missing unlock USB: fix build on OMAPs if CONFIG_PM_RUNTIME is not set USB: oxu210hp: release spinlock on error path USB: serial: option: add cinterion device id USB: serial: option: ZTEAC8710 Support with Device ID 0xffff USB: serial: pl2303: Hybrid reader Uniform HCR331 USB: option: add ID for ZTE MF 330 USB: xhci: properly set endpoint context fields for periodic eps. USB: xhci: properly set the "Mult" field of the endpoint context. USB: OHCI: don't look at the root hub to get the number of ports USB: don't choose configs with no interfaces USB: cdc-acm: add another device quirk USB: fix testing the wrong variable in fs_create_by_name() usb: Fix tusb6010 for DMA API musb_core: fix musb_init_controller() error cleanup path MUSB: fix DaVinci glue layer dependency ...
2 parents 35d824b + 8a3461e commit e4049eb

File tree

28 files changed

+206
-83
lines changed

28 files changed

+206
-83
lines changed

arch/arm/plat-omap/include/plat/usb.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ struct ehci_hcd_omap_platform_data {
4646
struct omap_musb_board_data {
4747
u8 interface_type;
4848
u8 mode;
49-
u8 power;
49+
u16 power;
5050
};
5151

5252
enum musb_interface {MUSB_INTERFACE_ULPI, MUSB_INTERFACE_UTMI};

drivers/usb/class/cdc-acm.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1542,6 +1542,9 @@ static const struct usb_device_id acm_ids[] = {
15421542
{ USB_DEVICE(0x1bbb, 0x0003), /* Alcatel OT-I650 */
15431543
.driver_info = NO_UNION_NORMAL, /* reports zero length descriptor */
15441544
},
1545+
{ USB_DEVICE(0x1576, 0x03b1), /* Maretron USB100 */
1546+
.driver_info = NO_UNION_NORMAL, /* reports zero length descriptor */
1547+
},
15451548

15461549
/* Nokia S60 phones expose two ACM channels. The first is
15471550
* a modem and is picked up by the standard AT-command

drivers/usb/core/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ config USB_SUSPEND
109109
config USB_OTG
110110
bool
111111
depends on USB && EXPERIMENTAL
112-
select USB_SUSPEND
112+
depends on USB_SUSPEND
113113
default n
114114

115115

drivers/usb/core/generic.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ int usb_choose_configuration(struct usb_device *udev)
120120
* than a vendor-specific driver. */
121121
else if (udev->descriptor.bDeviceClass !=
122122
USB_CLASS_VENDOR_SPEC &&
123-
(!desc || desc->bInterfaceClass !=
123+
(desc && desc->bInterfaceClass !=
124124
USB_CLASS_VENDOR_SPEC)) {
125125
best = c;
126126
break;

drivers/usb/core/inode.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,13 +515,13 @@ static int fs_create_by_name (const char *name, mode_t mode,
515515
*dentry = NULL;
516516
mutex_lock(&parent->d_inode->i_mutex);
517517
*dentry = lookup_one_len(name, parent, strlen(name));
518-
if (!IS_ERR(dentry)) {
518+
if (!IS_ERR(*dentry)) {
519519
if ((mode & S_IFMT) == S_IFDIR)
520520
error = usbfs_mkdir (parent->d_inode, *dentry, mode);
521521
else
522522
error = usbfs_create (parent->d_inode, *dentry, mode);
523523
} else
524-
error = PTR_ERR(dentry);
524+
error = PTR_ERR(*dentry);
525525
mutex_unlock(&parent->d_inode->i_mutex);
526526

527527
return error;

drivers/usb/core/usb.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ int __usb_get_extra_descriptor(char *buffer, unsigned size,
718718
EXPORT_SYMBOL_GPL(__usb_get_extra_descriptor);
719719

720720
/**
721-
* usb_buffer_alloc - allocate dma-consistent buffer for URB_NO_xxx_DMA_MAP
721+
* usb_alloc_coherent - allocate dma-consistent buffer for URB_NO_xxx_DMA_MAP
722722
* @dev: device the buffer will be used with
723723
* @size: requested buffer size
724724
* @mem_flags: affect whether allocation may block
@@ -737,38 +737,38 @@ EXPORT_SYMBOL_GPL(__usb_get_extra_descriptor);
737737
* architectures where CPU caches are not DMA-coherent. On systems without
738738
* bus-snooping caches, these buffers are uncached.
739739
*
740-
* When the buffer is no longer used, free it with usb_buffer_free().
740+
* When the buffer is no longer used, free it with usb_free_coherent().
741741
*/
742-
void *usb_buffer_alloc(struct usb_device *dev, size_t size, gfp_t mem_flags,
743-
dma_addr_t *dma)
742+
void *usb_alloc_coherent(struct usb_device *dev, size_t size, gfp_t mem_flags,
743+
dma_addr_t *dma)
744744
{
745745
if (!dev || !dev->bus)
746746
return NULL;
747747
return hcd_buffer_alloc(dev->bus, size, mem_flags, dma);
748748
}
749-
EXPORT_SYMBOL_GPL(usb_buffer_alloc);
749+
EXPORT_SYMBOL_GPL(usb_alloc_coherent);
750750

751751
/**
752-
* usb_buffer_free - free memory allocated with usb_buffer_alloc()
752+
* usb_free_coherent - free memory allocated with usb_alloc_coherent()
753753
* @dev: device the buffer was used with
754754
* @size: requested buffer size
755755
* @addr: CPU address of buffer
756756
* @dma: DMA address of buffer
757757
*
758758
* This reclaims an I/O buffer, letting it be reused. The memory must have
759-
* been allocated using usb_buffer_alloc(), and the parameters must match
759+
* been allocated using usb_alloc_coherent(), and the parameters must match
760760
* those provided in that allocation request.
761761
*/
762-
void usb_buffer_free(struct usb_device *dev, size_t size, void *addr,
763-
dma_addr_t dma)
762+
void usb_free_coherent(struct usb_device *dev, size_t size, void *addr,
763+
dma_addr_t dma)
764764
{
765765
if (!dev || !dev->bus)
766766
return;
767767
if (!addr)
768768
return;
769769
hcd_buffer_free(dev->bus, size, addr, dma);
770770
}
771-
EXPORT_SYMBOL_GPL(usb_buffer_free);
771+
EXPORT_SYMBOL_GPL(usb_free_coherent);
772772

773773
/**
774774
* usb_buffer_map - create DMA mapping(s) for an urb

drivers/usb/gadget/s3c-hsotg.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2145,6 +2145,7 @@ static int s3c_hsotg_ep_enable(struct usb_ep *ep,
21452145
u32 epctrl;
21462146
u32 mps;
21472147
int dir_in;
2148+
int ret = 0;
21482149

21492150
dev_dbg(hsotg->dev,
21502151
"%s: ep %s: a 0x%02x, attr 0x%02x, mps 0x%04x, intr %d\n",
@@ -2196,7 +2197,8 @@ static int s3c_hsotg_ep_enable(struct usb_ep *ep,
21962197
switch (desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) {
21972198
case USB_ENDPOINT_XFER_ISOC:
21982199
dev_err(hsotg->dev, "no current ISOC support\n");
2199-
return -EINVAL;
2200+
ret = -EINVAL;
2201+
goto out;
22002202

22012203
case USB_ENDPOINT_XFER_BULK:
22022204
epctrl |= S3C_DxEPCTL_EPType_Bulk;
@@ -2235,8 +2237,9 @@ static int s3c_hsotg_ep_enable(struct usb_ep *ep,
22352237
/* enable the endpoint interrupt */
22362238
s3c_hsotg_ctrl_epint(hsotg, index, dir_in, 1);
22372239

2240+
out:
22382241
spin_unlock_irqrestore(&hs_ep->lock, flags);
2239-
return 0;
2242+
return ret;
22402243
}
22412244

22422245
static int s3c_hsotg_ep_disable(struct usb_ep *ep)

drivers/usb/host/ohci-at91.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,8 @@ ohci_hcd_at91_drv_suspend(struct platform_device *pdev, pm_message_t mesg)
331331
*/
332332
if (at91_suspend_entering_slow_clock()) {
333333
ohci_usb_reset (ohci);
334+
/* flush the writes */
335+
(void) ohci_readl (ohci, &ohci->regs->control);
334336
at91_stop_clock();
335337
}
336338

drivers/usb/host/ohci-hub.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ static int ohci_hub_control (
697697
u16 wLength
698698
) {
699699
struct ohci_hcd *ohci = hcd_to_ohci (hcd);
700-
int ports = hcd_to_bus (hcd)->root_hub->maxchild;
700+
int ports = ohci->num_ports;
701701
u32 temp;
702702
int retval = 0;
703703

drivers/usb/host/oxu210hp-hcd.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -660,13 +660,13 @@ static struct ehci_qh *oxu_qh_alloc(struct oxu_hcd *oxu)
660660
if (qh->dummy == NULL) {
661661
oxu_dbg(oxu, "no dummy td\n");
662662
oxu->qh_used[i] = 0;
663-
664-
return NULL;
663+
qh = NULL;
664+
goto unlock;
665665
}
666666

667667
oxu->qh_used[i] = 1;
668668
}
669-
669+
unlock:
670670
spin_unlock(&oxu->mem_lock);
671671

672672
return qh;

drivers/usb/host/sl811-hcd.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -720,10 +720,10 @@ static irqreturn_t sl811h_irq(struct usb_hcd *hcd)
720720
/* port status seems weird until after reset, so
721721
* force the reset and make khubd clean up later.
722722
*/
723-
if (sl811->stat_insrmv & 1)
724-
sl811->port1 |= 1 << USB_PORT_FEAT_CONNECTION;
725-
else
723+
if (irqstat & SL11H_INTMASK_RD)
726724
sl811->port1 &= ~(1 << USB_PORT_FEAT_CONNECTION);
725+
else
726+
sl811->port1 |= 1 << USB_PORT_FEAT_CONNECTION;
727727

728728
sl811->port1 |= 1 << USB_PORT_FEAT_C_CONNECTION;
729729

drivers/usb/host/xhci-mem.c

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,19 @@ static inline unsigned int xhci_get_endpoint_interval(struct usb_device *udev,
582582
return EP_INTERVAL(interval);
583583
}
584584

585+
/* The "Mult" field in the endpoint context is only set for SuperSpeed devices.
586+
* High speed endpoint descriptors can define "the number of additional
587+
* transaction opportunities per microframe", but that goes in the Max Burst
588+
* endpoint context field.
589+
*/
590+
static inline u32 xhci_get_endpoint_mult(struct usb_device *udev,
591+
struct usb_host_endpoint *ep)
592+
{
593+
if (udev->speed != USB_SPEED_SUPER || !ep->ss_ep_comp)
594+
return 0;
595+
return ep->ss_ep_comp->desc.bmAttributes;
596+
}
597+
585598
static inline u32 xhci_get_endpoint_type(struct usb_device *udev,
586599
struct usb_host_endpoint *ep)
587600
{
@@ -612,6 +625,36 @@ static inline u32 xhci_get_endpoint_type(struct usb_device *udev,
612625
return type;
613626
}
614627

628+
/* Return the maximum endpoint service interval time (ESIT) payload.
629+
* Basically, this is the maxpacket size, multiplied by the burst size
630+
* and mult size.
631+
*/
632+
static inline u32 xhci_get_max_esit_payload(struct xhci_hcd *xhci,
633+
struct usb_device *udev,
634+
struct usb_host_endpoint *ep)
635+
{
636+
int max_burst;
637+
int max_packet;
638+
639+
/* Only applies for interrupt or isochronous endpoints */
640+
if (usb_endpoint_xfer_control(&ep->desc) ||
641+
usb_endpoint_xfer_bulk(&ep->desc))
642+
return 0;
643+
644+
if (udev->speed == USB_SPEED_SUPER) {
645+
if (ep->ss_ep_comp)
646+
return ep->ss_ep_comp->desc.wBytesPerInterval;
647+
xhci_warn(xhci, "WARN no SS endpoint companion descriptor.\n");
648+
/* Assume no bursts, no multiple opportunities to send. */
649+
return ep->desc.wMaxPacketSize;
650+
}
651+
652+
max_packet = ep->desc.wMaxPacketSize & 0x3ff;
653+
max_burst = (ep->desc.wMaxPacketSize & 0x1800) >> 11;
654+
/* A 0 in max burst means 1 transfer per ESIT */
655+
return max_packet * (max_burst + 1);
656+
}
657+
615658
int xhci_endpoint_init(struct xhci_hcd *xhci,
616659
struct xhci_virt_device *virt_dev,
617660
struct usb_device *udev,
@@ -623,6 +666,7 @@ int xhci_endpoint_init(struct xhci_hcd *xhci,
623666
struct xhci_ring *ep_ring;
624667
unsigned int max_packet;
625668
unsigned int max_burst;
669+
u32 max_esit_payload;
626670

627671
ep_index = xhci_get_endpoint_index(&ep->desc);
628672
ep_ctx = xhci_get_ep_ctx(xhci, virt_dev->in_ctx, ep_index);
@@ -644,6 +688,7 @@ int xhci_endpoint_init(struct xhci_hcd *xhci,
644688
ep_ctx->deq = ep_ring->first_seg->dma | ep_ring->cycle_state;
645689

646690
ep_ctx->ep_info = xhci_get_endpoint_interval(udev, ep);
691+
ep_ctx->ep_info |= EP_MULT(xhci_get_endpoint_mult(udev, ep));
647692

648693
/* FIXME dig Mult and streams info out of ep companion desc */
649694

@@ -689,6 +734,26 @@ int xhci_endpoint_init(struct xhci_hcd *xhci,
689734
default:
690735
BUG();
691736
}
737+
max_esit_payload = xhci_get_max_esit_payload(xhci, udev, ep);
738+
ep_ctx->tx_info = MAX_ESIT_PAYLOAD_FOR_EP(max_esit_payload);
739+
740+
/*
741+
* XXX no idea how to calculate the average TRB buffer length for bulk
742+
* endpoints, as the driver gives us no clue how big each scatter gather
743+
* list entry (or buffer) is going to be.
744+
*
745+
* For isochronous and interrupt endpoints, we set it to the max
746+
* available, until we have new API in the USB core to allow drivers to
747+
* declare how much bandwidth they actually need.
748+
*
749+
* Normally, it would be calculated by taking the total of the buffer
750+
* lengths in the TD and then dividing by the number of TRBs in a TD,
751+
* including link TRBs, No-op TRBs, and Event data TRBs. Since we don't
752+
* use Event Data TRBs, and we don't chain in a link TRB on short
753+
* transfers, we're basically dividing by 1.
754+
*/
755+
ep_ctx->tx_info |= AVG_TRB_LENGTH_FOR_EP(max_esit_payload);
756+
692757
/* FIXME Debug endpoint context */
693758
return 0;
694759
}

drivers/usb/host/xhci.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,10 @@ struct xhci_ep_ctx {
609609
#define MAX_PACKET_MASK (0xffff << 16)
610610
#define MAX_PACKET_DECODED(p) (((p) >> 16) & 0xffff)
611611

612+
/* tx_info bitmasks */
613+
#define AVG_TRB_LENGTH_FOR_EP(p) ((p) & 0xffff)
614+
#define MAX_ESIT_PAYLOAD_FOR_EP(p) (((p) & 0xffff) << 16)
615+
612616

613617
/**
614618
* struct xhci_input_control_context

drivers/usb/musb/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ config USB_MUSB_SOC
4242
default y if (BF52x && !BF522 && !BF523)
4343

4444
comment "DaVinci 35x and 644x USB support"
45-
depends on USB_MUSB_HDRC && ARCH_DAVINCI
45+
depends on USB_MUSB_HDRC && ARCH_DAVINCI_DMx
4646

4747
comment "OMAP 243x high speed USB support"
4848
depends on USB_MUSB_HDRC && ARCH_OMAP2430

drivers/usb/musb/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ musb_hdrc-objs := musb_core.o
66

77
obj-$(CONFIG_USB_MUSB_HDRC) += musb_hdrc.o
88

9-
ifeq ($(CONFIG_ARCH_DAVINCI),y)
9+
ifeq ($(CONFIG_ARCH_DAVINCI_DMx),y)
1010
musb_hdrc-objs += davinci.o
1111
endif
1212

drivers/usb/musb/blackfin.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -172,13 +172,7 @@ static irqreturn_t blackfin_interrupt(int irq, void *__hci)
172172

173173
spin_unlock_irqrestore(&musb->lock, flags);
174174

175-
/* REVISIT we sometimes get spurious IRQs on g_ep0
176-
* not clear why... fall in BF54x too.
177-
*/
178-
if (retval != IRQ_HANDLED)
179-
DBG(5, "spurious?\n");
180-
181-
return IRQ_HANDLED;
175+
return retval;
182176
}
183177

184178
static void musb_conn_timer_handler(unsigned long _musb)

drivers/usb/musb/davinci.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,8 @@ int __init musb_platform_init(struct musb *musb)
444444
return 0;
445445

446446
fail:
447+
clk_disable(musb->clock);
448+
447449
usb_nop_xceiv_unregister();
448450
return -ENODEV;
449451
}

0 commit comments

Comments
 (0)