Skip to content

Commit

Permalink
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6
Browse files Browse the repository at this point in the history
* 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
  ...
  • Loading branch information
torvalds committed Apr 30, 2010
2 parents 35d824b + 8a3461e commit e4049eb
Show file tree
Hide file tree
Showing 28 changed files with 206 additions and 83 deletions.
2 changes: 1 addition & 1 deletion arch/arm/plat-omap/include/plat/usb.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ struct ehci_hcd_omap_platform_data {
struct omap_musb_board_data {
u8 interface_type;
u8 mode;
u8 power;
u16 power;
};

enum musb_interface {MUSB_INTERFACE_ULPI, MUSB_INTERFACE_UTMI};
Expand Down
3 changes: 3 additions & 0 deletions drivers/usb/class/cdc-acm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1542,6 +1542,9 @@ static const struct usb_device_id acm_ids[] = {
{ USB_DEVICE(0x1bbb, 0x0003), /* Alcatel OT-I650 */
.driver_info = NO_UNION_NORMAL, /* reports zero length descriptor */
},
{ USB_DEVICE(0x1576, 0x03b1), /* Maretron USB100 */
.driver_info = NO_UNION_NORMAL, /* reports zero length descriptor */
},

/* Nokia S60 phones expose two ACM channels. The first is
* a modem and is picked up by the standard AT-command
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/core/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ config USB_SUSPEND
config USB_OTG
bool
depends on USB && EXPERIMENTAL
select USB_SUSPEND
depends on USB_SUSPEND
default n


Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/core/generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ int usb_choose_configuration(struct usb_device *udev)
* than a vendor-specific driver. */
else if (udev->descriptor.bDeviceClass !=
USB_CLASS_VENDOR_SPEC &&
(!desc || desc->bInterfaceClass !=
(desc && desc->bInterfaceClass !=
USB_CLASS_VENDOR_SPEC)) {
best = c;
break;
Expand Down
4 changes: 2 additions & 2 deletions drivers/usb/core/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -515,13 +515,13 @@ static int fs_create_by_name (const char *name, mode_t mode,
*dentry = NULL;
mutex_lock(&parent->d_inode->i_mutex);
*dentry = lookup_one_len(name, parent, strlen(name));
if (!IS_ERR(dentry)) {
if (!IS_ERR(*dentry)) {
if ((mode & S_IFMT) == S_IFDIR)
error = usbfs_mkdir (parent->d_inode, *dentry, mode);
else
error = usbfs_create (parent->d_inode, *dentry, mode);
} else
error = PTR_ERR(dentry);
error = PTR_ERR(*dentry);
mutex_unlock(&parent->d_inode->i_mutex);

return error;
Expand Down
20 changes: 10 additions & 10 deletions drivers/usb/core/usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ int __usb_get_extra_descriptor(char *buffer, unsigned size,
EXPORT_SYMBOL_GPL(__usb_get_extra_descriptor);

/**
* usb_buffer_alloc - allocate dma-consistent buffer for URB_NO_xxx_DMA_MAP
* usb_alloc_coherent - allocate dma-consistent buffer for URB_NO_xxx_DMA_MAP
* @dev: device the buffer will be used with
* @size: requested buffer size
* @mem_flags: affect whether allocation may block
Expand All @@ -737,38 +737,38 @@ EXPORT_SYMBOL_GPL(__usb_get_extra_descriptor);
* architectures where CPU caches are not DMA-coherent. On systems without
* bus-snooping caches, these buffers are uncached.
*
* When the buffer is no longer used, free it with usb_buffer_free().
* When the buffer is no longer used, free it with usb_free_coherent().
*/
void *usb_buffer_alloc(struct usb_device *dev, size_t size, gfp_t mem_flags,
dma_addr_t *dma)
void *usb_alloc_coherent(struct usb_device *dev, size_t size, gfp_t mem_flags,
dma_addr_t *dma)
{
if (!dev || !dev->bus)
return NULL;
return hcd_buffer_alloc(dev->bus, size, mem_flags, dma);
}
EXPORT_SYMBOL_GPL(usb_buffer_alloc);
EXPORT_SYMBOL_GPL(usb_alloc_coherent);

/**
* usb_buffer_free - free memory allocated with usb_buffer_alloc()
* usb_free_coherent - free memory allocated with usb_alloc_coherent()
* @dev: device the buffer was used with
* @size: requested buffer size
* @addr: CPU address of buffer
* @dma: DMA address of buffer
*
* This reclaims an I/O buffer, letting it be reused. The memory must have
* been allocated using usb_buffer_alloc(), and the parameters must match
* been allocated using usb_alloc_coherent(), and the parameters must match
* those provided in that allocation request.
*/
void usb_buffer_free(struct usb_device *dev, size_t size, void *addr,
dma_addr_t dma)
void usb_free_coherent(struct usb_device *dev, size_t size, void *addr,
dma_addr_t dma)
{
if (!dev || !dev->bus)
return;
if (!addr)
return;
hcd_buffer_free(dev->bus, size, addr, dma);
}
EXPORT_SYMBOL_GPL(usb_buffer_free);
EXPORT_SYMBOL_GPL(usb_free_coherent);

/**
* usb_buffer_map - create DMA mapping(s) for an urb
Expand Down
7 changes: 5 additions & 2 deletions drivers/usb/gadget/s3c-hsotg.c
Original file line number Diff line number Diff line change
Expand Up @@ -2145,6 +2145,7 @@ static int s3c_hsotg_ep_enable(struct usb_ep *ep,
u32 epctrl;
u32 mps;
int dir_in;
int ret = 0;

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

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

out:
spin_unlock_irqrestore(&hs_ep->lock, flags);
return 0;
return ret;
}

static int s3c_hsotg_ep_disable(struct usb_ep *ep)
Expand Down
2 changes: 2 additions & 0 deletions drivers/usb/host/ohci-at91.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,8 @@ ohci_hcd_at91_drv_suspend(struct platform_device *pdev, pm_message_t mesg)
*/
if (at91_suspend_entering_slow_clock()) {
ohci_usb_reset (ohci);
/* flush the writes */
(void) ohci_readl (ohci, &ohci->regs->control);
at91_stop_clock();
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/host/ohci-hub.c
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ static int ohci_hub_control (
u16 wLength
) {
struct ohci_hcd *ohci = hcd_to_ohci (hcd);
int ports = hcd_to_bus (hcd)->root_hub->maxchild;
int ports = ohci->num_ports;
u32 temp;
int retval = 0;

Expand Down
6 changes: 3 additions & 3 deletions drivers/usb/host/oxu210hp-hcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -660,13 +660,13 @@ static struct ehci_qh *oxu_qh_alloc(struct oxu_hcd *oxu)
if (qh->dummy == NULL) {
oxu_dbg(oxu, "no dummy td\n");
oxu->qh_used[i] = 0;

return NULL;
qh = NULL;
goto unlock;
}

oxu->qh_used[i] = 1;
}

unlock:
spin_unlock(&oxu->mem_lock);

return qh;
Expand Down
6 changes: 3 additions & 3 deletions drivers/usb/host/sl811-hcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -720,10 +720,10 @@ static irqreturn_t sl811h_irq(struct usb_hcd *hcd)
/* port status seems weird until after reset, so
* force the reset and make khubd clean up later.
*/
if (sl811->stat_insrmv & 1)
sl811->port1 |= 1 << USB_PORT_FEAT_CONNECTION;
else
if (irqstat & SL11H_INTMASK_RD)
sl811->port1 &= ~(1 << USB_PORT_FEAT_CONNECTION);
else
sl811->port1 |= 1 << USB_PORT_FEAT_CONNECTION;

sl811->port1 |= 1 << USB_PORT_FEAT_C_CONNECTION;

Expand Down
65 changes: 65 additions & 0 deletions drivers/usb/host/xhci-mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,19 @@ static inline unsigned int xhci_get_endpoint_interval(struct usb_device *udev,
return EP_INTERVAL(interval);
}

/* The "Mult" field in the endpoint context is only set for SuperSpeed devices.
* High speed endpoint descriptors can define "the number of additional
* transaction opportunities per microframe", but that goes in the Max Burst
* endpoint context field.
*/
static inline u32 xhci_get_endpoint_mult(struct usb_device *udev,
struct usb_host_endpoint *ep)
{
if (udev->speed != USB_SPEED_SUPER || !ep->ss_ep_comp)
return 0;
return ep->ss_ep_comp->desc.bmAttributes;
}

static inline u32 xhci_get_endpoint_type(struct usb_device *udev,
struct usb_host_endpoint *ep)
{
Expand Down Expand Up @@ -612,6 +625,36 @@ static inline u32 xhci_get_endpoint_type(struct usb_device *udev,
return type;
}

/* Return the maximum endpoint service interval time (ESIT) payload.
* Basically, this is the maxpacket size, multiplied by the burst size
* and mult size.
*/
static inline u32 xhci_get_max_esit_payload(struct xhci_hcd *xhci,
struct usb_device *udev,
struct usb_host_endpoint *ep)
{
int max_burst;
int max_packet;

/* Only applies for interrupt or isochronous endpoints */
if (usb_endpoint_xfer_control(&ep->desc) ||
usb_endpoint_xfer_bulk(&ep->desc))
return 0;

if (udev->speed == USB_SPEED_SUPER) {
if (ep->ss_ep_comp)
return ep->ss_ep_comp->desc.wBytesPerInterval;
xhci_warn(xhci, "WARN no SS endpoint companion descriptor.\n");
/* Assume no bursts, no multiple opportunities to send. */
return ep->desc.wMaxPacketSize;
}

max_packet = ep->desc.wMaxPacketSize & 0x3ff;
max_burst = (ep->desc.wMaxPacketSize & 0x1800) >> 11;
/* A 0 in max burst means 1 transfer per ESIT */
return max_packet * (max_burst + 1);
}

int xhci_endpoint_init(struct xhci_hcd *xhci,
struct xhci_virt_device *virt_dev,
struct usb_device *udev,
Expand All @@ -623,6 +666,7 @@ int xhci_endpoint_init(struct xhci_hcd *xhci,
struct xhci_ring *ep_ring;
unsigned int max_packet;
unsigned int max_burst;
u32 max_esit_payload;

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

ep_ctx->ep_info = xhci_get_endpoint_interval(udev, ep);
ep_ctx->ep_info |= EP_MULT(xhci_get_endpoint_mult(udev, ep));

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

Expand Down Expand Up @@ -689,6 +734,26 @@ int xhci_endpoint_init(struct xhci_hcd *xhci,
default:
BUG();
}
max_esit_payload = xhci_get_max_esit_payload(xhci, udev, ep);
ep_ctx->tx_info = MAX_ESIT_PAYLOAD_FOR_EP(max_esit_payload);

/*
* XXX no idea how to calculate the average TRB buffer length for bulk
* endpoints, as the driver gives us no clue how big each scatter gather
* list entry (or buffer) is going to be.
*
* For isochronous and interrupt endpoints, we set it to the max
* available, until we have new API in the USB core to allow drivers to
* declare how much bandwidth they actually need.
*
* Normally, it would be calculated by taking the total of the buffer
* lengths in the TD and then dividing by the number of TRBs in a TD,
* including link TRBs, No-op TRBs, and Event data TRBs. Since we don't
* use Event Data TRBs, and we don't chain in a link TRB on short
* transfers, we're basically dividing by 1.
*/
ep_ctx->tx_info |= AVG_TRB_LENGTH_FOR_EP(max_esit_payload);

/* FIXME Debug endpoint context */
return 0;
}
Expand Down
4 changes: 4 additions & 0 deletions drivers/usb/host/xhci.h
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,10 @@ struct xhci_ep_ctx {
#define MAX_PACKET_MASK (0xffff << 16)
#define MAX_PACKET_DECODED(p) (((p) >> 16) & 0xffff)

/* tx_info bitmasks */
#define AVG_TRB_LENGTH_FOR_EP(p) ((p) & 0xffff)
#define MAX_ESIT_PAYLOAD_FOR_EP(p) (((p) & 0xffff) << 16)


/**
* struct xhci_input_control_context
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/musb/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ config USB_MUSB_SOC
default y if (BF52x && !BF522 && !BF523)

comment "DaVinci 35x and 644x USB support"
depends on USB_MUSB_HDRC && ARCH_DAVINCI
depends on USB_MUSB_HDRC && ARCH_DAVINCI_DMx

comment "OMAP 243x high speed USB support"
depends on USB_MUSB_HDRC && ARCH_OMAP2430
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/musb/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ musb_hdrc-objs := musb_core.o

obj-$(CONFIG_USB_MUSB_HDRC) += musb_hdrc.o

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

Expand Down
8 changes: 1 addition & 7 deletions drivers/usb/musb/blackfin.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,7 @@ static irqreturn_t blackfin_interrupt(int irq, void *__hci)

spin_unlock_irqrestore(&musb->lock, flags);

/* REVISIT we sometimes get spurious IRQs on g_ep0
* not clear why... fall in BF54x too.
*/
if (retval != IRQ_HANDLED)
DBG(5, "spurious?\n");

return IRQ_HANDLED;
return retval;
}

static void musb_conn_timer_handler(unsigned long _musb)
Expand Down
2 changes: 2 additions & 0 deletions drivers/usb/musb/davinci.c
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,8 @@ int __init musb_platform_init(struct musb *musb)
return 0;

fail:
clk_disable(musb->clock);

usb_nop_xceiv_unregister();
return -ENODEV;
}
Expand Down
Loading

0 comments on commit e4049eb

Please sign in to comment.