Commit c5fc26c9 authored by Linus Torvalds's avatar Linus Torvalds

Merge http://linux-sound.bkbits.net/linux-sound

into home.transmeta.com:/home/torvalds/v2.5/linux
parents e1f8e356 59584359
......@@ -389,8 +389,8 @@ static int rh_call_control (struct usb_hcd *hcd, struct urb *urb)
break;
case DeviceOutRequest | USB_REQ_SET_ADDRESS:
// wValue == urb->dev->devaddr
dbg ("%s root hub device address %d",
hcd->self.bus_name, wValue);
dev_dbg (*hcd->controller, "root hub device address %d\n",
wValue);
break;
/* INTERFACE REQUESTS (no defined feature/status flags) */
......@@ -1188,7 +1188,6 @@ static int hcd_unlink_urb (struct urb *urb)
if (urb->transfer_flags & URB_ASYNC_UNLINK)
return -EINPROGRESS;
dev_dbg (*sys, "wait for giveback urb %p\n", urb);
wait_for_completion (&splice.done);
return 0;
......
......@@ -57,6 +57,12 @@ static inline char *portspeed (int portstatus)
}
#endif
/* for dev_info, dev_dbg, etc */
static inline struct device *hubdev (struct usb_device *dev)
{
return &dev->actconfig->interface [0].dev;
}
/* USB 2.0 spec Section 11.24.4.5 */
static int usb_get_hub_descriptor(struct usb_device *dev, void *data, int size)
{
......@@ -298,7 +304,7 @@ static int usb_hub_configure(struct usb_hub *hub,
}
dev->maxchild = hub->descriptor->bNbrPorts;
info("%d port%s detected", dev->maxchild,
dev_info (*hubdev (dev), "%d port%s detected\n", dev->maxchild,
(dev->maxchild == 1) ? "" : "s");
le16_to_cpus(&hub->descriptor->wHubCharacteristics);
......@@ -521,7 +527,7 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id)
}
/* We found a hub */
info("USB hub found at %s", dev->devpath);
dev_info (*hubdev (dev), "USB hub found\n");
hub = kmalloc(sizeof(*hub), GFP_KERNEL);
if (!hub) {
......@@ -651,8 +657,6 @@ static int usb_hub_port_status(struct usb_device *hub, int port,
else {
*status = le16_to_cpu(portsts->wPortStatus);
*change = le16_to_cpu(portsts->wPortChange);
dbg("port %d, portstatus %x, change %x, %s", port + 1,
*status, *change, portspeed(*status));
ret = 0;
}
kfree(portsts);
......@@ -710,8 +714,9 @@ static int usb_hub_port_wait_reset(struct usb_device *hub, int port,
if (delay_time >= 2 * HUB_SHORT_RESET_TIME)
delay = HUB_LONG_RESET_TIME;
dbg("port %d of hub %s not reset yet, waiting %dms", port + 1,
hub->devpath, delay);
dev_dbg (*hubdev (hub),
"port %d not reset yet, waiting %dms\n",
port + 1, delay);
}
return -1;
......@@ -735,14 +740,15 @@ static int usb_hub_port_reset(struct usb_device *hub, int port,
return status;
}
dbg("port %d of hub %s not enabled, trying reset again...",
port + 1, hub->devpath);
dev_dbg (*hubdev (hub),
"port %d not enabled, trying reset again...\n",
port + 1);
delay = HUB_LONG_RESET_TIME;
}
err("Cannot enable port %i of hub %s, disabling port.",
port + 1, hub->devpath);
err("Maybe the USB cable is bad?");
dev_err (*hubdev (hub),
"Cannot enable port %i. Maybe the USB cable is bad?\n",
port + 1);
return -1;
}
......@@ -808,8 +814,9 @@ static int usb_hub_port_debounce(struct usb_device *hub, int port)
}
/* XXX Replace this with dbg() when 2.6 is about to ship. */
info("debounce: hub %d port %d: delay %dms stable %d status 0x%x\n",
hub->devnum, port, delay_time, stable_count, portstatus);
dev_info (*hubdev (hub),
"debounce: port %d: delay %dms stable %d status 0x%x\n",
port + 1, delay_time, stable_count, portstatus);
return ((portstatus&USB_PORT_STAT_CONNECTION)) ? 0 : 1;
}
......@@ -822,9 +829,9 @@ static void usb_hub_port_connect_change(struct usb_hub *hubstate, int port,
unsigned int delay = HUB_SHORT_RESET_TIME;
int i;
dbg("hub %s port %d, portstatus %x, change %x, %s",
hub->devpath, port + 1,
portstatus, portchange, portspeed (portstatus));
dev_dbg (hubstate->intf->dev,
"port %d, status %x, change %x, %s\n",
port + 1, portstatus, portchange, portspeed (portstatus));
/* Clear the connection change status */
usb_clear_port_feature(hub, port + 1, USB_PORT_FEAT_C_CONNECTION);
......@@ -842,7 +849,9 @@ static void usb_hub_port_connect_change(struct usb_hub *hubstate, int port,
}
if (usb_hub_port_debounce(hub, port)) {
err("connect-debounce failed, port %d disabled", port+1);
dev_err (hubstate->intf->dev,
"connect-debounce failed, port %d disabled\n",
port+1);
usb_hub_port_disable(hub, port);
return;
}
......@@ -861,7 +870,8 @@ static void usb_hub_port_connect_change(struct usb_hub *hubstate, int port,
/* Allocate a new device struct */
dev = usb_alloc_dev(hub, hub->bus);
if (!dev) {
err("couldn't allocate usb_device");
dev_err (hubstate->intf->dev,
"couldn't allocate usb_device\n");
break;
}
......@@ -904,10 +914,12 @@ static void usb_hub_port_connect_change(struct usb_hub *hubstate, int port,
len = snprintf (dev->devpath, sizeof dev->devpath,
"%d", port + 1);
if (len == sizeof dev->devpath)
warn ("devpath size! usb/%03d/%03d path %s",
dev_err (hubstate->intf->dev,
"devpath size! usb/%03d/%03d path %s\n",
dev->bus->busnum, dev->devnum, dev->devpath);
info("new USB device %s-%s, assigned address %d",
dev->bus->bus_name, dev->devpath, dev->devnum);
dev_info (hubstate->intf->dev,
"new USB device on port %d, assigned address %d\n",
port + 1, dev->devnum);
/* put the device in the global device tree. the hub port
* is the "bus_id"; hubs show in hierarchy like bridges
......@@ -992,12 +1004,11 @@ static void usb_hub_events(void)
}
if (portchange & USB_PORT_STAT_C_CONNECTION) {
dbg("hub %s port %d connection change",
dev->devpath, i + 1);
usb_hub_port_connect_change(hub, i, portstatus, portchange);
} else if (portchange & USB_PORT_STAT_C_ENABLE) {
dbg("hub %s port %d enable change, status %x",
dev->devpath, i + 1, portstatus);
dev_dbg (*hubdev (dev),
"port %d enable change, status %x\n",
i + 1, portstatus);
usb_clear_port_feature(dev,
i + 1, USB_PORT_FEAT_C_ENABLE);
......
......@@ -487,10 +487,15 @@ static void fs_remove_file (struct dentry *dentry)
* It will be removed when the 2.7.x development cycle is started.
* You have been warned :)
*/
static struct file_system_type usbdevice_fs_type;
static struct super_block *usb_get_sb(struct file_system_type *fs_type,
int flags, char *dev_name, void *data)
{
if (fs_type == &usbdevice_fs_type)
printk (KERN_INFO "Please use the 'usbfs' filetype instead, "
"the 'usbdevfs' name is depreciated.\n");
return get_sb_single(fs_type, flags, data, usbfs_fill_super);
}
......
......@@ -18,21 +18,45 @@
/* this file is part of ehci-hcd.c */
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,50)
#define ehci_dbg(ehci, fmt, args...) \
dev_dbg (*(ehci)->hcd.controller, fmt, ## args )
#define ehci_err(ehci, fmt, args...) \
dev_err (*(ehci)->hcd.controller, fmt, ## args )
#define ehci_info(ehci, fmt, args...) \
dev_info (*(ehci)->hcd.controller, fmt, ## args )
#define ehci_warn(ehci, fmt, args...) \
dev_warn (*(ehci)->hcd.controller, fmt, ## args )
#ifdef EHCI_VERBOSE_DEBUG
#define ehci_vdbg(ehci, fmt, args...) \
dev_dbg (*(ehci)->hcd.controller, fmt, ## args )
#else
#define ehci_vdbg(ehci, fmt, args...) do { } while (0)
#ifdef DEBUG
#define ehci_dbg(ehci, fmt, args...) \
printk(KERN_DEBUG "%s %s: " fmt, hcd_name, \
(ehci)->hcd.pdev->slot_name, ## args )
#else
#define ehci_dbg(ehci, fmt, args...) do { } while (0)
#endif
#define ehci_err(ehci, fmt, args...) \
printk(KERN_ERR "%s %s: " fmt, hcd_name, \
(ehci)->hcd.pdev->slot_name, ## args )
#define ehci_info(ehci, fmt, args...) \
printk(KERN_INFO "%s %s: " fmt, hcd_name, \
(ehci)->hcd.pdev->slot_name, ## args )
#define ehci_warn(ehci, fmt, args...) \
printk(KERN_WARNING "%s %s: " fmt, hcd_name, \
(ehci)->hcd.pdev->slot_name, ## args )
#endif
#ifdef EHCI_VERBOSE_DEBUG
# define vdbg dbg
# define ehci_vdbg ehci_dbg
#else
static inline void vdbg (char *fmt, ...) { }
# define vdbg(fmt,args...) do { } while (0)
# define ehci_vdbg(ehci, fmt, args...) do { } while (0)
#endif
#ifdef DEBUG
......@@ -289,7 +313,8 @@ static void qh_lines (struct ehci_qh *qh, char **nextp, unsigned *sizep)
scratch = cpu_to_le32p (&qh->hw_info1);
hw_curr = cpu_to_le32p (&qh->hw_current);
temp = snprintf (next, size, "qh/%p dev%d %cs ep%d %08x %08x (%08x %08x)",
temp = snprintf (next, size,
"qh/%p dev%d %cs ep%d %08x %08x (%08x %08x)",
qh, scratch & 0x007f,
speed_char (scratch),
(scratch >> 8) & 0x000f,
......
......@@ -123,12 +123,6 @@ static int log2_irq_thresh = 0; // 0 to 6
MODULE_PARM (log2_irq_thresh, "i");
MODULE_PARM_DESC (log2_irq_thresh, "log2 IRQ latency, 1-64 microframes");
/* allow irqs at least every N URB completions */
static int max_completions = 16;
MODULE_PARM (max_completions, "i");
MODULE_PARM_DESC (max_completions,
"limit for urb completions called with irqs disenabled");
#define INTR_MASK (STS_IAA | STS_FATAL | STS_ERR | STS_INT)
/*-------------------------------------------------------------------------*/
......@@ -202,7 +196,7 @@ static int ehci_reset (struct ehci_hcd *ehci)
dbg_cmd (ehci, "reset", command);
writel (command, &ehci->regs->command);
ehci->hcd.state = USB_STATE_HALT;
return handshake (&ehci->regs->command, CMD_RESET, 0, 250);
return handshake (&ehci->regs->command, CMD_RESET, 0, 250 * 1000);
}
/* idle the controller (from running) */
......@@ -250,9 +244,7 @@ static void ehci_ready (struct ehci_hcd *ehci)
/*-------------------------------------------------------------------------*/
static void ehci_tasklet (unsigned long param);
static void ehci_irq (struct usb_hcd *hcd, struct pt_regs *regs);
static void ehci_work(struct ehci_hcd *ehci, struct pt_regs *regs);
static void ehci_watchdog (unsigned long param)
{
......@@ -260,10 +252,25 @@ static void ehci_watchdog (unsigned long param)
unsigned long flags;
spin_lock_irqsave (&ehci->lock, flags);
/* guard against lost IAA, which wedges everything */
ehci_irq (&ehci->hcd, NULL);
/* lost IAA irqs wedge things badly; seen with a vt8235 */
if (ehci->reclaim) {
u32 status = readl (&ehci->regs->status);
if (status & STS_IAA) {
ehci_vdbg (ehci, "lost IAA\n");
writel (STS_IAA, &ehci->regs->status);
ehci->reclaim_ready = 1;
}
}
ehci_work (ehci, NULL);
if (ehci->reclaim && !timer_pending (&ehci->watchdog))
mod_timer (&ehci->watchdog,
jiffies + EHCI_WATCHDOG_JIFFIES);
/* stop async processing after it's idled a while */
if (ehci->async_idle) {
else if (ehci->async_idle) {
start_unlink_async (ehci, ehci->async);
ehci->async_idle = 0;
}
......@@ -289,8 +296,7 @@ static int bios_handoff (struct ehci_hcd *ehci, int where, u32 cap)
pci_read_config_dword (ehci->hcd.pdev, where, &cap);
} while ((cap & (1 << 16)) && msec);
if (cap & (1 << 16)) {
dev_info (*ehci->hcd.controller,
"BIOS handoff failed (%d, %04x)\n",
ehci_err (ehci, "BIOS handoff failed (%d, %04x)\n",
where, cap);
return 1;
}
......@@ -333,8 +339,7 @@ static int ehci_start (struct usb_hcd *hcd)
return -EOPNOTSUPP;
break;
case 0: /* illegal reserved capability */
dev_warn (*ehci->hcd.controller,
"illegal capability!\n");
ehci_warn (ehci, "illegal capability!\n");
cap = 0;
/* FALLTHROUGH */
default: /* unknown */
......@@ -381,6 +386,8 @@ static int ehci_start (struct usb_hcd *hcd)
* dedicate a qh for the async ring head, since we couldn't unlink
* a 'real' qh without stopping the async schedule [4.8]. use it
* as the 'reclamation list head' too.
* its dummy is used in hw_alt_next of many tds, to prevent the qh
* from automatically advancing to the next td after short reads.
*/
ehci->async->qh_next.qh = 0;
ehci->async->hw_next = QH_NEXT (ehci->async->qh_dma);
......@@ -388,8 +395,7 @@ static int ehci_start (struct usb_hcd *hcd)
ehci->async->hw_token = cpu_to_le32 (QTD_STS_HALT);
ehci->async->hw_qtd_next = EHCI_LIST_END;
ehci->async->qh_state = QH_STATE_LINKED;
ehci_qtd_free (ehci, ehci->async->dummy);
ehci->async->dummy = 0;
ehci->async->hw_alt_next = QTD_NEXT (ehci->async->dummy->qtd_dma);
writel ((u32)ehci->async->qh_dma, &ehci->regs->async_next);
/*
......@@ -406,8 +412,7 @@ static int ehci_start (struct usb_hcd *hcd)
if (HCC_64BIT_ADDR (hcc_params)) {
writel (0, &ehci->regs->segment);
if (!pci_set_dma_mask (ehci->hcd.pdev, 0xffffffffffffffffULL))
dev_info (*ehci->hcd.controller,
"enabled 64bit PCI DMA (DAC)\n");
ehci_info (ehci, "enabled 64bit PCI DMA\n");
}
/* clear interrupt enables, set irq latency */
......@@ -426,9 +431,6 @@ static int ehci_start (struct usb_hcd *hcd)
/* set async sleep time = 10 us ... ? */
ehci->tasklet.func = ehci_tasklet;
ehci->tasklet.data = (unsigned long) ehci;
init_timer (&ehci->watchdog);
ehci->watchdog.function = ehci_watchdog;
ehci->watchdog.data = (unsigned long) ehci;
......@@ -454,7 +456,7 @@ static int ehci_start (struct usb_hcd *hcd)
/* PCI Serial Bus Release Number is at 0x60 offset */
pci_read_config_byte (hcd->pdev, 0x60, &tempbyte);
temp = readw (&ehci->caps->hci_version);
dev_info (*hcd->controller,
ehci_info (ehci,
"USB %x.%x enabled, EHCI %x.%02x, driver %s\n",
((tempbyte & 0xf0)>>4), (tempbyte & 0x0f),
temp >> 8, temp & 0xff, DRIVER_VERSION);
......@@ -494,9 +496,10 @@ static void ehci_stop (struct usb_hcd *hcd)
/* no more interrupts ... */
if (hcd->state == USB_STATE_RUNNING)
ehci_ready (ehci);
if (in_interrupt ()) /* should not happen!! */
dev_err (*hcd->controller, "stopped %s!\n", RUN_CONTEXT);
else
if (in_interrupt ()) { /* must not happen!! */
ehci_err (ehci, "stopped in_interrupt!\n");
return;
}
del_timer_sync (&ehci->watchdog);
ehci_reset (ehci);
......@@ -506,8 +509,9 @@ static void ehci_stop (struct usb_hcd *hcd)
remove_debug_files (ehci);
/* root hub is shut down separately (first, when possible) */
tasklet_disable (&ehci->tasklet);
ehci_tasklet ((unsigned long) ehci);
spin_lock_irq (&ehci->lock);
ehci_work (ehci, NULL);
spin_unlock_irq (&ehci->lock);
ehci_mem_cleanup (ehci);
#ifdef EHCI_STATS
......@@ -615,22 +619,16 @@ dbg ("%s: resume port %d", hcd_to_bus (hcd)->bus_name, i);
/*-------------------------------------------------------------------------*/
/*
* tasklet scheduled by some interrupts and other events
* calls driver completion functions ... but not in_irq()
* ehci_work is called from some interrupts, timers, and so on.
* it calls driver completion functions, after dropping ehci->lock.
*/
static void ehci_tasklet (unsigned long param)
static void ehci_work (struct ehci_hcd *ehci, struct pt_regs *regs)
{
struct ehci_hcd *ehci = (struct ehci_hcd *) param;
spin_lock_irq (&ehci->lock);
if (ehci->reclaim_ready)
end_unlink_async (ehci);
scan_async (ehci);
end_unlink_async (ehci, regs);
scan_async (ehci, regs);
if (ehci->next_uframe != -1)
scan_periodic (ehci);
spin_unlock_irq (&ehci->lock);
scan_periodic (ehci, regs);
}
/*-------------------------------------------------------------------------*/
......@@ -643,7 +641,7 @@ static void ehci_irq (struct usb_hcd *hcd, struct pt_regs *regs)
/* e.g. cardbus physical eject */
if (status == ~(u32) 0) {
dbg ("%s: device removed!", hcd_to_bus (hcd)->bus_name);
ehci_dbg (ehci, "device removed\n");
goto dead;
}
......@@ -651,6 +649,8 @@ static void ehci_irq (struct usb_hcd *hcd, struct pt_regs *regs)
if (!status) /* irq sharing? */
return;
spin_lock (&ehci->lock);
/* clear (just) interrupts */
writel (status, &ehci->regs->status);
readl (&ehci->regs->command); /* unblock posted write */
......@@ -681,8 +681,7 @@ static void ehci_irq (struct usb_hcd *hcd, struct pt_regs *regs)
/* PCI errors [4.15.2.4] */
if (unlikely ((status & STS_FATAL) != 0)) {
err ("%s: fatal error, state %x",
hcd_to_bus (hcd)->bus_name, hcd->state);
ehci_err (ehci, "fatal error\n");
dead:
ehci_reset (ehci);
/* generic layer kills/unlinks all urbs, then
......@@ -691,9 +690,9 @@ static void ehci_irq (struct usb_hcd *hcd, struct pt_regs *regs)
bh = 1;
}
/* most work doesn't need to be in_irq() */
if (likely (bh == 1))
tasklet_schedule (&ehci->tasklet);
if (bh)
ehci_work (ehci, regs);
spin_unlock (&ehci->lock);
}
/*-------------------------------------------------------------------------*/
......@@ -754,52 +753,52 @@ static int ehci_urb_enqueue (
static int ehci_urb_dequeue (struct usb_hcd *hcd, struct urb *urb)
{
struct ehci_hcd *ehci = hcd_to_ehci (hcd);
struct ehci_qh *qh = (struct ehci_qh *) urb->hcpriv;
struct ehci_qh *qh;
unsigned long flags;
int maybe_irq = 1;
ehci_vdbg (ehci, "urb_dequeue %p qh %p state %d\n",
urb, qh, qh->qh_state);
spin_lock_irqsave (&ehci->lock, flags);
switch (usb_pipetype (urb->pipe)) {
// case PIPE_CONTROL:
// case PIPE_BULK:
default:
spin_lock_irqsave (&ehci->lock, flags);
if (ehci->reclaim) {
vdbg ("dq %p: reclaim = %p, %s",
qh, ehci->reclaim, RUN_CONTEXT);
if (qh == ehci->reclaim) {
/* unlinking qh for another queued urb? */
spin_unlock_irqrestore (&ehci->lock, flags);
return 0;
}
if (in_interrupt ()) {
spin_unlock_irqrestore (&ehci->lock, flags);
return -EAGAIN;
}
qh = (struct ehci_qh *) urb->hcpriv;
if (!qh)
break;
while (qh->qh_state == QH_STATE_LINKED
&& ehci->reclaim
&& ehci->hcd.state != USB_STATE_HALT
&& HCD_IS_RUNNING (ehci->hcd.state)
) {
spin_unlock_irqrestore (&ehci->lock, flags);
/* let pending unlinks complete */
if (maybe_irq) {
if (in_interrupt ())
return -EAGAIN;
maybe_irq = 0;
}
/* let pending unlinks complete, so this can start */
wait_ms (1);
spin_lock_irqsave (&ehci->lock, flags);
}
}
if (!HCD_IS_RUNNING (ehci->hcd.state) && ehci->reclaim)
end_unlink_async (ehci, NULL);
/* something else might have unlinked the qh by now */
if (qh->qh_state == QH_STATE_LINKED)
start_unlink_async (ehci, qh);
spin_unlock_irqrestore (&ehci->lock, flags);
break;
case PIPE_INTERRUPT:
spin_lock_irqsave (&ehci->lock, flags);
qh = (struct ehci_qh *) urb->hcpriv;
if (!qh)
break;
if (qh->qh_state == QH_STATE_LINKED) {
/* messy, can spin or block a microframe ... */
intr_deschedule (ehci, qh, 1);
/* qh_state == IDLE */
}
qh_completions (ehci, qh);
qh_completions (ehci, qh, NULL);
/* reschedule QH iff another request is queued */
if (!list_empty (&qh->qtd_list)
......@@ -817,7 +816,6 @@ static int ehci_urb_dequeue (struct usb_hcd *hcd, struct urb *urb)
}
return status;
}
spin_unlock_irqrestore (&ehci->lock, flags);
break;
case PIPE_ISOCHRONOUS:
......@@ -828,6 +826,7 @@ static int ehci_urb_dequeue (struct usb_hcd *hcd, struct urb *urb)
urb->transfer_flags |= EHCI_STATE_UNLINK;
break;
}
spin_unlock_irqrestore (&ehci->lock, flags);
return 0;
}
......@@ -885,11 +884,11 @@ static void ehci_free_config (struct usb_hcd *hcd, struct usb_device *udev)
*/
while (qh->qh_state == QH_STATE_LINKED
&& ehci->reclaim
&& ehci->hcd.state != USB_STATE_HALT
&& HCD_IS_RUNNING (ehci->hcd.state)
) {
spin_unlock_irqrestore (&ehci->lock, flags);
/* wait_ms() won't spin, we're a thread;
* and we know IRQ+tasklet can progress
* and we know IRQ/timer/... can progress
*/
wait_ms (1);
spin_lock_irqsave (&ehci->lock, flags);
......
......@@ -315,7 +315,7 @@ static int ehci_hub_control (
wIndex + 1);
temp |= PORT_OWNER;
} else {
ehci_vdbg (ehci, "port %d reset", wIndex + 1);
ehci_vdbg (ehci, "port %d reset\n", wIndex + 1);
temp |= PORT_RESET;
temp &= ~PORT_PE;
......
......@@ -73,8 +73,11 @@ static struct ehci_qtd *ehci_qtd_alloc (struct ehci_hcd *ehci, int flags)
dma_addr_t dma;
qtd = pci_pool_alloc (ehci->qtd_pool, flags, &dma);
if (qtd != 0)
if (qtd != 0) {
ehci_qtd_init (qtd, dma);
if (ehci->async)
qtd->hw_alt_next = ehci->async->hw_alt_next;
}
return qtd;
}
......
......@@ -73,11 +73,6 @@ qtd_fill (struct ehci_qtd *qtd, dma_addr_t buf, size_t len, int token)
qtd->hw_token = cpu_to_le32 ((count << 16) | token);
qtd->length = count;
#if 0
vdbg (" qtd_fill %p, token %8x bytes %d dma %x",
qtd, le32_to_cpu (qtd->hw_token), count, qtd->hw_buf [0]);
#endif
return count;
}
......@@ -85,11 +80,12 @@ qtd_fill (struct ehci_qtd *qtd, dma_addr_t buf, size_t len, int token)
/* update halted (but potentially linked) qh */
static void qh_update (struct ehci_qh *qh, struct ehci_qtd *qtd)
static void
qh_update (struct ehci_hcd *ehci, struct ehci_qh *qh, struct ehci_qtd *qtd)
{
qh->hw_current = 0;
qh->hw_qtd_next = QTD_NEXT (qtd->qtd_dma);
qh->hw_alt_next = EHCI_LIST_END;
qh->hw_alt_next = ehci->async->hw_alt_next;
/* HC must see latest qtd and qh data before we clear ACTIVE+HALT */
wmb ();
......@@ -98,7 +94,12 @@ static void qh_update (struct ehci_qh *qh, struct ehci_qtd *qtd)
/*-------------------------------------------------------------------------*/
static inline void qtd_copy_status (struct urb *urb, size_t length, u32 token)
static inline void qtd_copy_status (
struct ehci_hcd *ehci,
struct urb *urb,
size_t length,
u32 token
)
{
/* count IN/OUT bytes, not SETUP (even short packets) */
if (likely (QTD_PID (token) != 2))
......@@ -132,7 +133,7 @@ static inline void qtd_copy_status (struct urb *urb, size_t length, u32 token)
ehci_vdbg (ehci,
"dev%d ep%d%s qtd token %08x --> status %d\n",
usb_pipedev (urb->pipe),
usb_pipedevice (urb->pipe),
usb_pipeendpoint (urb->pipe),
usb_pipein (urb->pipe) ? "in" : "out",
token, urb->status);
......@@ -157,9 +158,17 @@ static inline void qtd_copy_status (struct urb *urb, size_t length, u32 token)
}
}
}
/* force cleanup after short read; not necessarily an error */
if (unlikely (urb->status == -EINPROGRESS
&& QTD_LENGTH (token) != 0
&& QTD_PID (token) == 1)) {
urb->status = -EREMOTEIO;
}
}
static void ehci_urb_done (struct ehci_hcd *ehci, struct urb *urb)
static void
ehci_urb_done (struct ehci_hcd *ehci, struct urb *urb, struct pt_regs *regs)
{
if (likely (urb->hcpriv != 0)) {
struct ehci_qh *qh = (struct ehci_qh *) urb->hcpriv;
......@@ -171,27 +180,31 @@ static void ehci_urb_done (struct ehci_hcd *ehci, struct urb *urb)
hcd_to_bus (&ehci->hcd)->bandwidth_int_reqs--;
}
qh_put (ehci, qh);
urb->hcpriv = 0;
}
if (likely (urb->status == -EINPROGRESS)) {
if (urb->actual_length != urb->transfer_buffer_length
&& (urb->transfer_flags & URB_SHORT_NOT_OK))
urb->status = -EREMOTEIO;
else
spin_lock (&urb->lock);
urb->hcpriv = 0;
switch (urb->status) {
case -EINPROGRESS: /* success */
urb->status = 0;
}
if (likely (urb->status == 0))
default: /* fault */
COUNT (ehci->stats.complete);
else if (urb->status == -ECONNRESET || urb->status == -ENOENT)
break;
case -EREMOTEIO: /* fault or normal */
if (!(urb->transfer_flags & URB_SHORT_NOT_OK))
urb->status = 0;
COUNT (ehci->stats.complete);
break;
case -ECONNRESET: /* canceled */
case -ENOENT:
COUNT (ehci->stats.unlink);
else
COUNT (ehci->stats.error);
break;
}
spin_unlock (&urb->lock);
/* complete() can reenter this HCD */
spin_unlock (&ehci->lock);
usb_hcd_giveback_urb (&ehci->hcd, urb, NULL);
usb_hcd_giveback_urb (&ehci->hcd, urb, regs);
spin_lock (&ehci->lock);
}
......@@ -203,14 +216,14 @@ static void ehci_urb_done (struct ehci_hcd *ehci, struct urb *urb)
* indicating how much "real" work we did.
*/
static unsigned
qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh)
qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh, struct pt_regs *regs)
{
struct ehci_qtd *qtd, *last;
struct list_head *next, *qtd_list = &qh->qtd_list;
int unlink = 0, halted = 0;
int unlink = 0, stopped = 0;
unsigned count = 0;
if (unlikely (list_empty (qtd_list)))
if (unlikely (list_empty (&qh->qtd_list)))
return count;
/* scan QTDs till end of list, or we reach an active one */
......@@ -225,7 +238,7 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh)
/* clean up any state from previous QTD ...*/
if (last) {
if (likely (last->urb != urb)) {
ehci_urb_done (ehci, last->urb);
ehci_urb_done (ehci, last->urb, regs);
count++;
}
ehci_qtd_free (ehci, last);
......@@ -236,12 +249,14 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh)
/* QTDs at tail may be active if QH+HC are running,
* or when unlinking some urbs queued to this QH
*/
rmb ();
token = le32_to_cpu (qtd->hw_token);
halted = halted
stopped = stopped
|| (qh->qh_state == QH_STATE_IDLE)
|| (__constant_cpu_to_le32 (QTD_STS_HALT)
& qh->hw_token) != 0
|| (ehci->hcd.state == USB_STATE_HALT)
|| (qh->qh_state == QH_STATE_IDLE);
|| (qh->hw_current == ehci->async->hw_alt_next);
// FIXME Remove the automagic unlink mode.
// Drivers can now clean up safely; it's their job.
......@@ -257,7 +272,7 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh)
/* status copied below */
/* QH halts only because of fault (above) or unlink (here). */
} else if (unlikely (halted != 0)) {
} else if (unlikely (stopped != 0)) {
/* unlinking everything because of HC shutdown? */
if (ehci->hcd.state == USB_STATE_HALT) {
......@@ -293,32 +308,22 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh)
}
spin_lock (&urb->lock);
qtd_copy_status (urb, qtd->length, token);
qtd_copy_status (ehci, urb, qtd->length, token);
spin_unlock (&urb->lock);
list_del (&qtd->qtd_list);
#if 0
if (urb->status == -EINPROGRESS)
vdbg (" qtd %p ok, urb %p, token %8x, len %d",
qtd, urb, token, urb->actual_length);
else
vdbg ("urb %p status %d, qtd %p, token %8x, len %d",
urb, urb->status, qtd, token,
urb->actual_length);
#endif
}
/* last urb's completion might still need calling */
if (likely (last != 0)) {
ehci_urb_done (ehci, last->urb);
ehci_urb_done (ehci, last->urb, regs);
count++;
ehci_qtd_free (ehci, last);
}
/* reactivate queue after error and driver's cleanup */
if (unlikely (halted && !list_empty (qtd_list))) {
qh_update (qh, list_entry (qtd_list->next,
if (unlikely (stopped && !list_empty (&qh->qtd_list))) {
qh_update (ehci, qh, list_entry (qh->qtd_list.next,
struct ehci_qtd, qtd_list));
}
......@@ -369,7 +374,6 @@ qh_urb_transaction (
qtd = ehci_qtd_alloc (ehci, flags);
if (unlikely (!qtd))
return 0;
qtd_prev = 0;
list_add_tail (&qtd->qtd_list, head);
qtd->urb = urb;
......@@ -377,6 +381,8 @@ qh_urb_transaction (
token |= (EHCI_TUNE_CERR << 10);
/* for split transactions, SplitXState initialized to zero */
len = urb->transfer_buffer_length;
is_input = usb_pipein (urb->pipe);
if (usb_pipecontrol (urb->pipe)) {
/* SETUP pid */
qtd_fill (qtd, urb->setup_dma, sizeof (struct usb_ctrlrequest),
......@@ -392,15 +398,14 @@ qh_urb_transaction (
qtd_prev->hw_next = QTD_NEXT (qtd->qtd_dma);
list_add_tail (&qtd->qtd_list, head);
if (!(urb->transfer_flags & URB_SHORT_NOT_OK))
if (len > 0 && is_input
&& !(urb->transfer_flags & URB_SHORT_NOT_OK))
status_patch = 1;
}
/*
* data transfer stage: buffer setup
*/
len = urb->transfer_buffer_length;
is_input = usb_pipein (urb->pipe);
if (likely (len > 0))
buf = urb->transfer_dma;
else
......@@ -420,7 +425,6 @@ qh_urb_transaction (
for (;;) {
int this_qtd_len;
qtd->urb = urb;
this_qtd_len = qtd_fill (qtd, buf, len, token);
len -= this_qtd_len;
buf += this_qtd_len;
......@@ -578,7 +582,6 @@ ehci_qh_make (
if (qh->period < 1) {
dbg ("intr period %d uframes, NYET!",
urb->interval);
qh = 0;
goto done;
}
} else {
......@@ -639,6 +642,8 @@ ehci_qh_make (
break;
default:
dbg ("bogus dev %p speed %d", urb->dev, urb->dev->speed);
done:
qh_put (ehci, qh);
return 0;
}
......@@ -658,15 +663,13 @@ ehci_qh_make (
list_splice (qtd_list, &qh->qtd_list);
qtd = list_entry (qtd_list->next, struct ehci_qtd, qtd_list);
qh_update (qh, qtd);
qh_update (ehci, qh, qtd);
} else {
qh->hw_qtd_next = qh->hw_alt_next = EHCI_LIST_END;
}
/* initialize data toggle state */
clear_toggle (urb->dev, usb_pipeendpoint (urb->pipe), !is_input, qh);
done:
return qh;
}
#undef hb_mult
......@@ -685,7 +688,7 @@ static void qh_link_async (struct ehci_hcd *ehci, struct ehci_qh *qh)
head = ehci->async;
if (ehci->async_idle)
del_timer (&ehci->watchdog);
else if (!head->qh_next.qh) {
if (!head->qh_next.qh) {
u32 cmd = readl (&ehci->regs->command);
if (!(cmd & CMD_ASE)) {
......@@ -698,6 +701,8 @@ static void qh_link_async (struct ehci_hcd *ehci, struct ehci_qh *qh)
}
}
qh->hw_token &= ~__constant_cpu_to_le32 (QTD_STS_HALT);
/* splice right after start */
qh->qh_next = head->qh_next;
qh->hw_next = head->hw_next;
......@@ -774,8 +779,8 @@ static struct ehci_qh *qh_append_tds (
*/
token = qtd->hw_token;
qtd->hw_token = 0;
wmb ();
dummy = qh->dummy;
// dbg ("swap td %p with dummy %p", qtd, dummy);
dma = dummy->qtd_dma;
*dummy = *qtd;
......@@ -784,9 +789,11 @@ static struct ehci_qh *qh_append_tds (
list_add (&dummy->qtd_list, qtd_list);
ehci_qtd_init (qtd, qtd->qtd_dma);
qtd->hw_alt_next = ehci->async->hw_alt_next;
qh->dummy = qtd;
/* hc must see the new dummy at list end */
dma = qtd->qtd_dma;
qtd = list_entry (qh->qtd_list.prev,
struct ehci_qtd, qtd_list);
qtd->hw_next = QTD_NEXT (dma);
......@@ -797,15 +804,6 @@ static struct ehci_qh *qh_append_tds (
/* no URB queued */
} else {
struct ehci_qtd *last_qtd;
/* make sure hc sees current dummy at the end */
last_qtd = list_entry (qtd_list->prev,
struct ehci_qtd, qtd_list);
last_qtd->hw_next = QTD_NEXT (qh->dummy->qtd_dma);
// dbg_qh ("empty qh", ehci, qh);
/* usb_clear_halt() means qh data toggle gets reset */
if (unlikely (!usb_gettoggle (urb->dev,
(epnum & 0x0f),
......@@ -813,15 +811,23 @@ static struct ehci_qh *qh_append_tds (
clear_toggle (urb->dev,
epnum & 0x0f, !(epnum & 0x10), qh);
}
if (qtd)
qh_update (qh, qtd);
/* make sure hc sees current dummy at the end */
if (qtd) {
struct ehci_qtd *last_qtd;
last_qtd = list_entry (qtd_list->prev,
struct ehci_qtd, qtd_list);
last_qtd->hw_next = QTD_NEXT (
qh->dummy->qtd_dma);
qh_update (ehci, qh, qtd);
}
}
list_splice (qtd_list, qh->qtd_list.prev);
} else {
/* can't sleep here, we have ehci->lock... */
qh = ehci_qh_make (ehci, urb, qtd_list, SLAB_ATOMIC);
// if (qh) dbg_qh ("new qh", ehci, qh);
*ptr = qh;
}
if (qh)
......@@ -877,34 +883,38 @@ submit_async (
/*-------------------------------------------------------------------------*/
/* the async qh for the qtds being reclaimed are now unlinked from the HC */
/* caller must not own ehci->lock */
static void end_unlink_async (struct ehci_hcd *ehci)
static void end_unlink_async (struct ehci_hcd *ehci, struct pt_regs *regs)
{
struct ehci_qh *qh = ehci->reclaim;
del_timer (&ehci->watchdog);
qh->hw_next = cpu_to_le32 (qh->qh_dma);
qh->qh_state = QH_STATE_IDLE;
qh->qh_next.qh = 0;
qh_put (ehci, qh); // refcount from reclaim
ehci->reclaim = 0;
ehci->reclaim_ready = 0;
qh_completions (ehci, qh);
qh_completions (ehci, qh, regs);
if (!list_empty (&qh->qtd_list)
&& HCD_IS_RUNNING (ehci->hcd.state))
qh_link_async (ehci, qh);
else
else {
qh_put (ehci, qh); // refcount from async list
/* it's not free to turn the async schedule on/off, so we leave it
/* it's not free to turn the async schedule on/off; leave it
* active but idle for a while once it empties.
*/
if (!ehci->async->qh_next.qh && !timer_pending (&ehci->watchdog)) {
if (HCD_IS_RUNNING (ehci->hcd.state)
&& ehci->async->qh_next.qh == 0
&& !timer_pending (&ehci->watchdog)) {
ehci->async_idle = 1;
mod_timer (&ehci->watchdog, jiffies + EHCI_ASYNC_JIFFIES);
mod_timer (&ehci->watchdog,
jiffies + EHCI_ASYNC_JIFFIES);
}
}
}
......@@ -941,12 +951,6 @@ static void start_unlink_async (struct ehci_hcd *ehci, struct ehci_qh *qh)
qh->qh_state = QH_STATE_UNLINK;
ehci->reclaim = qh = qh_get (qh);
if (unlikely (ehci->hcd.state == USB_STATE_HALT)) {
ehci->reclaim_ready = 1;
tasklet_schedule (&ehci->tasklet);
return;
}
prev = ehci->async;
while (prev->qh_next.qh != qh)
prev = prev->qh_next.qh;
......@@ -955,6 +959,11 @@ static void start_unlink_async (struct ehci_hcd *ehci, struct ehci_qh *qh)
prev->qh_next = qh->qh_next;
wmb ();
if (unlikely (ehci->hcd.state == USB_STATE_HALT)) {
end_unlink_async (ehci, NULL);
return;
}
ehci->reclaim_ready = 0;
cmd |= CMD_IAAD;
writel (cmd, &ehci->regs->command);
......@@ -966,7 +975,7 @@ static void start_unlink_async (struct ehci_hcd *ehci, struct ehci_qh *qh)
/*-------------------------------------------------------------------------*/
static void
scan_async (struct ehci_hcd *ehci)
scan_async (struct ehci_hcd *ehci, struct pt_regs *regs)
{
struct ehci_qh *qh;
unsigned count;
......@@ -984,7 +993,7 @@ scan_async (struct ehci_hcd *ehci)
* reporting drops the lock.
*/
qh = qh_get (qh);
temp = qh_completions (ehci, qh);
temp = qh_completions (ehci, qh, regs);
qh_put (ehci, qh);
if (temp != 0) {
count += temp;
......@@ -1002,14 +1011,6 @@ scan_async (struct ehci_hcd *ehci)
start_unlink_async (ehci, qh);
}
/* keep latencies down: let any irqs in */
if (count > max_completions) {
spin_unlock_irq (&ehci->lock);
cpu_relax ();
spin_lock_irq (&ehci->lock);
goto rescan;
}
qh = qh->qh_next.qh;
} while (qh);
}
......
......@@ -190,7 +190,7 @@ static int enable_periodic (struct ehci_hcd *ehci)
/* posted write ... PSS happens later */
ehci->hcd.state = USB_STATE_RUNNING;
/* make sure tasklet scans these */
/* make sure ehci_work scans these */
ehci->next_uframe = readl (&ehci->regs->frame_index)
% (ehci->periodic_size << 3);
return 0;
......@@ -495,7 +495,8 @@ static unsigned
intr_complete (
struct ehci_hcd *ehci,
unsigned frame,
struct ehci_qh *qh
struct ehci_qh *qh,
struct pt_regs *regs
) {
unsigned count;
......@@ -509,7 +510,7 @@ intr_complete (
}
/* handle any completions */
count = qh_completions (ehci, qh);
count = qh_completions (ehci, qh, regs);
if (unlikely (list_empty (&qh->qtd_list)))
intr_deschedule (ehci, qh, 0);
......@@ -867,7 +868,8 @@ static unsigned
itd_complete (
struct ehci_hcd *ehci,
struct ehci_itd *itd,
unsigned uframe
unsigned uframe,
struct pt_regs *regs
) {
struct urb *urb = itd->urb;
struct usb_iso_packet_descriptor *desc;
......@@ -922,7 +924,7 @@ itd_complete (
/* complete() can reenter this HCD */
spin_unlock (&ehci->lock);
usb_hcd_giveback_urb (&ehci->hcd, urb, NULL);
usb_hcd_giveback_urb (&ehci->hcd, urb, regs);
spin_lock (&ehci->lock);
/* defer stopping schedule; completion can submit */
......@@ -973,7 +975,7 @@ static int itd_submit (struct ehci_hcd *ehci, struct urb *urb, int mem_flags)
/*-------------------------------------------------------------------------*/
static void
scan_periodic (struct ehci_hcd *ehci)
scan_periodic (struct ehci_hcd *ehci, struct pt_regs *regs)
{
unsigned frame, clock, now_uframe, mod;
unsigned count = 0;
......@@ -999,14 +1001,6 @@ scan_periodic (struct ehci_hcd *ehci)
u32 type, *hw_p;
unsigned uframes;
/* keep latencies down: let any irqs in */
if (count > max_completions) {
spin_unlock_irq (&ehci->lock);
cpu_relax ();
count = 0;
spin_lock_irq (&ehci->lock);
}
restart:
/* scan schedule to _before_ current frame index */
if (frame == clock)
......@@ -1031,7 +1025,7 @@ scan_periodic (struct ehci_hcd *ehci)
temp = q.qh->qh_next;
type = Q_NEXT_TYPE (q.qh->hw_next);
count += intr_complete (ehci, frame,
qh_get (q.qh));
qh_get (q.qh), regs);
qh_put (ehci, q.qh);
q = temp;
break;
......@@ -1064,7 +1058,7 @@ scan_periodic (struct ehci_hcd *ehci)
/* might free q.itd ... */
count += itd_complete (ehci,
temp.itd, uf);
temp.itd, uf, regs);
break;
}
}
......
......@@ -65,9 +65,6 @@ struct ehci_hcd { /* one per controller */
int next_uframe; /* scan periodic, start here */
unsigned periodic_sched; /* periodic activity count */
/* deferred work from IRQ, etc */
struct tasklet_struct tasklet;
/* per root hub port */
unsigned long reset_done [EHCI_MAX_ROOT_PORTS];
......
......@@ -87,7 +87,7 @@ typedef struct {
} ibmcam_t;
#define IBMCAM_T(uvd) ((ibmcam_t *)((uvd)->user_data))
usbvideo_t *cams = NULL;
struct usbvideo *cams = NULL;
static int debug = 0;
......@@ -249,7 +249,7 @@ static videosize_t ibmcam_size_to_videosize(int size)
* History:
* 1/21/00 Created.
*/
static ParseState_t ibmcam_find_header(struct uvd *uvd) /* FIXME: Add frame here */
static enum ParseState ibmcam_find_header(struct uvd *uvd) /* FIXME: Add frame here */
{
struct usbvideo_frame *frame;
ibmcam_t *icam;
......@@ -397,7 +397,7 @@ case IBMCAM_MODEL_4:
* 21-Jan-2000 Created.
* 12-Oct-2000 Reworked to reflect interlaced nature of the data.
*/
static ParseState_t ibmcam_parse_lines(
static enum ParseState ibmcam_parse_lines(
struct uvd *uvd,
struct usbvideo_frame *frame,
long *pcopylen)
......@@ -662,7 +662,7 @@ static ParseState_t ibmcam_parse_lines(
* them both as R component in attempt to at least partially recover the
* lost resolution.
*/
static ParseState_t ibmcam_model2_320x240_parse_lines(
static enum ParseState ibmcam_model2_320x240_parse_lines(
struct uvd *uvd,
struct usbvideo_frame *frame,
long *pcopylen)
......@@ -816,7 +816,7 @@ static ParseState_t ibmcam_model2_320x240_parse_lines(
return scan_Continue;
}
static ParseState_t ibmcam_model3_parse_lines(
static enum ParseState ibmcam_model3_parse_lines(
struct uvd *uvd,
struct usbvideo_frame *frame,
long *pcopylen)
......@@ -961,7 +961,7 @@ static ParseState_t ibmcam_model3_parse_lines(
* History:
* 10-Feb-2001 Created.
*/
static ParseState_t ibmcam_model4_128x96_parse_lines(
static enum ParseState ibmcam_model4_128x96_parse_lines(
struct uvd *uvd,
struct usbvideo_frame *frame,
long *pcopylen)
......@@ -1051,7 +1051,7 @@ static ParseState_t ibmcam_model4_128x96_parse_lines(
*/
void ibmcam_ProcessIsocData(struct uvd *uvd, struct usbvideo_frame *frame)
{
ParseState_t newstate;
enum ParseState newstate;
long copylen = 0;
int mod = IBMCAM_T(uvd)->camera_model;
......
......@@ -51,7 +51,7 @@ enum frame_sizes {
#define MAX_FRAME_SIZE SIZE_320X240
static usbvideo_t *cams;
static struct usbvideo *cams;
#ifdef CONFIG_USB_DEBUG
static int debug;
......
......@@ -446,8 +446,8 @@ int pwc_set_video_mode(struct pwc_device *pdev, int width, int height, int frame
Info("Video mode %s@%d fps is only supported with the decompressor module (pwcx).\n", size2name[size], frames);
else {
Err("Failed to set video mode %s@%d fps; return code = %d\n", size2name[size], frames, ret);
return ret;
}
return ret;
}
pdev->view.x = width;
pdev->view.y = height;
......@@ -1535,6 +1535,14 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg)
break;
}
case VIDIOCPWCGREALSIZE:
{
struct pwc_imagesize *size = arg;
size->width = pdev->image.x;
size->height = pdev->image.y;
break;
}
default:
ret = -ENOIOCTLCMD;
......
......@@ -77,7 +77,7 @@ static struct usb_device_id pwc_device_table [] = {
{ USB_DEVICE(0x0471, 0x0312) },
{ USB_DEVICE(0x069A, 0x0001) }, /* Askey */
{ USB_DEVICE(0x046D, 0x08b0) }, /* Logitech QuickCam Pro 3000 */
{ USB_DEVICE(0x046D, 0x08b1) }, /* Logitech QuickCam for Notebooks */
{ USB_DEVICE(0x046D, 0x08b1) }, /* Logitech QuickCam Notebook Pro */
{ USB_DEVICE(0x046D, 0x08b2) }, /* Logitech QuickCam Pro 4000 */
{ USB_DEVICE(0x046D, 0x08b3) }, /* Logitech QuickCam Zoom */
{ USB_DEVICE(0x055D, 0x9000) }, /* Samsung */
......@@ -1064,7 +1064,6 @@ static int pwc_video_open(struct inode *inode, struct file *file)
i = pwc_isoc_init(pdev);
if (i) {
Trace(TRACE_OPEN, "Failed to init ISOC stuff = %d.\n", i);
MOD_DEC_USE_COUNT;
up(&pdev->modlock);
return i;
}
......@@ -1689,8 +1688,8 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id
type_id = 730;
break;
case 0x08b1:
Info("Logitech QuickCam for Noteboos USB webcam detected.\n");
name = "Logitech QuickCam Notebook";
Info("Logitech QuickCam Notebook Pro USB webcam detected.\n");
name = "Logitech QuickCam Notebook Pro";
type_id = 740; /* ?? unknown sensor */
break;
case 0x08b2:
......
......@@ -18,12 +18,13 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* This is pwc-ioctl.h belonging to PWC 8.7 */
/* This is pwc-ioctl.h belonging to PWC 8.10 */
/*
Changes
2001/08/03 Alvarado Added ioctl constants to access methods for
changing white balance and red/blue gains
2002/12/15 G. H. Fernandez-Toribio VIDIOCGREALSIZE
*/
/* These are private ioctl() commands, specific for the Philips webcams.
......@@ -104,7 +105,12 @@ struct pwc_leds
int led_off; /* Led off-time; range = 0..25000 */
};
/* Image size (used with GREALSIZE) */
struct pwc_imagesize
{
int width;
int height;
};
/* Restore user settings */
#define VIDIOCPWCRUSER _IO('v', 192)
......@@ -173,4 +179,7 @@ struct pwc_leds
#define VIDIOCPWCSDYNNOISE _IOW('v', 209, int)
#define VIDIOCPWCGDYNNOISE _IOR('v', 209, int)
/* Real image size as used by the camera; tells you whether or not there's a gray border around the image */
#define VIDIOCPWCGREALSIZE _IOR('v', 210, struct pwc_imagesize)
#endif
......@@ -20,8 +20,8 @@
significant change should be reflected by increasing the
pwc_decompressor_version major number.
*/
#ifndef PWC_DEC_H
#define PWC_DEC_H
#ifndef PWC_UNCOMPRESS_H
#define PWC_UNCOMPRESS_H
#include <linux/config.h>
#include <linux/list.h>
......
......@@ -60,8 +60,8 @@
/* Version block */
#define PWC_MAJOR 8
#define PWC_MINOR 9
#define PWC_VERSION "8.9"
#define PWC_MINOR 10
#define PWC_VERSION "8.10"
#define PWC_NAME "pwc"
/* Turn certain features on/off */
......
......@@ -25,7 +25,7 @@ typedef struct {
} ultracam_t;
#define ULTRACAM_T(uvd) ((ultracam_t *)((uvd)->user_data))
static usbvideo_t *cams = NULL;
static struct usbvideo *cams = NULL;
static int debug = 0;
......
......@@ -42,8 +42,8 @@ MODULE_PARM(video_nr, "i");
* Local prototypes.
*/
#if USES_PROC_FS
static void usbvideo_procfs_level1_create(usbvideo_t *ut);
static void usbvideo_procfs_level1_destroy(usbvideo_t *ut);
static void usbvideo_procfs_level1_create(struct usbvideo *ut);
static void usbvideo_procfs_level1_destroy(struct usbvideo *ut);
static void usbvideo_procfs_level2_create(struct uvd *uvd);
static void usbvideo_procfs_level2_destroy(struct uvd *uvd);
static int usbvideo_default_procfs_read_proc(
......@@ -765,7 +765,7 @@ static void usbvideo_ClientDecModCount(struct uvd *uvd)
}
int usbvideo_register(
usbvideo_t **pCams,
struct usbvideo **pCams,
const int num_cams,
const int num_extra,
const char *driverName,
......@@ -773,7 +773,7 @@ int usbvideo_register(
struct module *md,
const struct usb_device_id *id_table)
{
usbvideo_t *cams;
struct usbvideo *cams;
int i, base_size;
/* Check parameters for sanity */
......@@ -788,10 +788,10 @@ int usbvideo_register(
return -EINVAL;
}
base_size = num_cams * sizeof(struct uvd) + sizeof(usbvideo_t);
cams = (usbvideo_t *) kmalloc(base_size, GFP_KERNEL);
base_size = num_cams * sizeof(struct uvd) + sizeof(struct usbvideo);
cams = (struct usbvideo *) kmalloc(base_size, GFP_KERNEL);
if (cams == NULL) {
err("Failed to allocate %d. bytes for usbvideo_t", base_size);
err("Failed to allocate %d. bytes for usbvideo struct", base_size);
return -ENOMEM;
}
dbg("%s: Allocated $%p (%d. bytes) for %d. cameras",
......@@ -823,7 +823,7 @@ int usbvideo_register(
#else /* !USES_PROC_FS */
/* Report a warning so that user knows why there is no /proc entries */
if ((cams->cb.procfs_read != NULL) || (cams->cb.procfs_write == NULL)) {
dbg("%s: /proc fs support requested but not configured!", proc);
dbg("%s: /proc fs support requested but not configured!", __FUNCTION__);
}
#endif
cams->num_cameras = num_cams;
......@@ -889,9 +889,9 @@ EXPORT_SYMBOL(usbvideo_register);
* if you had some dynamically allocated components in ->user field then
* you should free them before calling here.
*/
void usbvideo_Deregister(usbvideo_t **pCams)
void usbvideo_Deregister(struct usbvideo **pCams)
{
usbvideo_t *cams;
struct usbvideo *cams;
int i;
if (pCams == NULL) {
......@@ -1049,12 +1049,12 @@ static void usbvideo_CameraRelease(struct uvd *uvd)
* History:
* 27-Jan-2000 Created.
*/
static int usbvideo_find_struct(usbvideo_t *cams)
static int usbvideo_find_struct(struct usbvideo *cams)
{
int u, rv = -1;
if (cams == NULL) {
err("No usbvideo_t handle?");
err("No usbvideo handle?");
return -1;
}
down(&cams->lock);
......@@ -1089,13 +1089,13 @@ static struct video_device usbvideo_template = {
.fops = &usbvideo_fops,
};
struct uvd *usbvideo_AllocateDevice(usbvideo_t *cams)
struct uvd *usbvideo_AllocateDevice(struct usbvideo *cams)
{
int i, devnum;
struct uvd *uvd = NULL;
if (cams == NULL) {
err("No usbvideo_t handle?");
err("No usbvideo handle?");
return NULL;
}
......@@ -2357,7 +2357,7 @@ static void usbvideo_SoftwareContrastAdjustment(struct uvd *uvd,
extern struct proc_dir_entry *video_proc_entry;
static void usbvideo_procfs_level1_create(usbvideo_t *ut)
static void usbvideo_procfs_level1_create(struct usbvideo *ut)
{
if (ut == NULL) {
err("%s: ut == NULL", __FUNCTION__);
......@@ -2376,7 +2376,7 @@ static void usbvideo_procfs_level1_create(usbvideo_t *ut)
}
}
static void usbvideo_procfs_level1_destroy(usbvideo_t *ut)
static void usbvideo_procfs_level1_destroy(struct usbvideo *ut)
{
if (ut == NULL) {
err("%s: ut == NULL", __FUNCTION__);
......
......@@ -126,37 +126,37 @@ struct RingQueue {
wait_queue_head_t wqh; /* Processes waiting */
};
typedef enum {
enum ScanState {
ScanState_Scanning, /* Scanning for header */
ScanState_Lines /* Parsing lines */
} ScanState_t;
};
/* Completion states of the data parser */
typedef enum {
enum ParseState {
scan_Continue, /* Just parse next item */
scan_NextFrame, /* Frame done, send it to V4L */
scan_Out, /* Not enough data for frame */
scan_EndParse /* End parsing */
} ParseState_t;
};
typedef enum {
enum FrameState {
FrameState_Unused, /* Unused (no MCAPTURE) */
FrameState_Ready, /* Ready to start grabbing */
FrameState_Grabbing, /* In the process of being grabbed into */
FrameState_Done, /* Finished grabbing, but not been synced yet */
FrameState_Done_Hold, /* Are syncing or reading */
FrameState_Error, /* Something bad happened while processing */
} FrameState_t;
};
/*
* Some frames may contain only even or odd lines. This type
* specifies what type of deinterlacing is required.
*/
typedef enum {
enum Deinterlace {
Deinterlace_None=0,
Deinterlace_FillOddLines,
Deinterlace_FillEvenLines
} Deinterlace_t;
};
#define USBVIDEO_NUMFRAMES 2 /* How many frames we work with */
#define USBVIDEO_NUMSBUF 2 /* How many URBs linked in a ring */
......@@ -175,9 +175,9 @@ struct usbvideo_frame {
videosize_t request; /* That's what the application asked for */
unsigned short palette; /* The desired format */
FrameState_t frameState;/* State of grabbing */
ScanState_t scanstate; /* State of scanning */
Deinterlace_t deinterlace;
enum FrameState frameState;/* State of grabbing */
enum ScanState scanstate; /* State of scanning */
enum Deinterlace deinterlace;
int flags; /* USBVIDEO_FRAME_FLAG_xxx bit flags */
int curline; /* Line of frame we're working on */
......@@ -199,12 +199,12 @@ struct usbvideo_statistics {
unsigned long iso_err_count; /* How many bad ISO packets received */
};
struct s_usbvideo_t;
struct usbvideo;
struct uvd {
struct video_device vdev; /* Must be the first field! */
struct usb_device *dev;
struct s_usbvideo_t *handle; /* Points back to the usbvideo_t */
struct usbvideo *handle; /* Points back to the struct usbvideo */
void *user_data; /* Camera-dependent data */
int user_size; /* Size of that camera-dependent data */
int debug; /* Debug level for usbvideo */
......@@ -273,7 +273,7 @@ struct usbvideo_cb {
int (*setVideoMode)(struct uvd *uvd, struct video_window *vw);
};
struct s_usbvideo_t {
struct usbvideo {
int num_cameras; /* As allocated */
struct usb_driver usbdrv; /* Interface to the USB stack */
char drvName[80]; /* Driver name */
......@@ -285,7 +285,7 @@ struct s_usbvideo_t {
struct proc_dir_entry *procfs_dEntry; /* /proc/video/MYDRIVER */
struct module *md_module; /* Minidriver module */
};
typedef struct s_usbvideo_t usbvideo_t;
/*
* This macro retrieves callback address from the struct uvd object.
......@@ -332,16 +332,16 @@ void usbvideo_TestPattern(struct uvd *uvd, int fullframe, int pmode);
unsigned long usbvideo_kvirt_to_pa(unsigned long adr);
int usbvideo_register(
usbvideo_t **pCams,
struct usbvideo **pCams,
const int num_cams,
const int num_extra,
const char *driverName,
const struct usbvideo_cb *cbTable,
struct module *md,
const struct usb_device_id *id_table);
struct uvd *usbvideo_AllocateDevice(usbvideo_t *cams);
struct uvd *usbvideo_AllocateDevice(struct usbvideo *cams);
int usbvideo_RegisterVideoDevice(struct uvd *uvd);
void usbvideo_Deregister(usbvideo_t **uvt);
void usbvideo_Deregister(struct usbvideo **uvt);
int usbvideo_v4l_initialize(struct video_device *dev);
......
......@@ -144,8 +144,9 @@ struct udsl_instance_data *minor_data[MAX_UDSL];
static const char udsl_driver_name[] = "Alcatel SpeedTouch USB";
/* data thread */
static int datapid = 0;
DECLARE_WAIT_QUEUE_HEAD (udsl_wqh);
static DECLARE_COMPLETION(thread_grave);
static unsigned int datapid;
#ifdef DEBUG_PACKET
int udsl_print_packet (const unsigned char *data, int len);
......@@ -431,21 +432,36 @@ int udsl_atm_processqueue_thread (void *data)
strcpy (current->comm, "kSpeedSARd");
add_wait_queue (&udsl_wqh, &wait);
set_current_state(TASK_INTERRUPTIBLE);
for (;;) {
interruptible_sleep_on (&udsl_wqh);
schedule();
if (signal_pending (current))
break;
PDEBUG ("SpeedSARd awoke\n");
retry:
for (i = 0; i < MAX_UDSL; i++)
if (minor_data[i])
udsl_atm_processqueue (minor_data[i]);
set_current_state(TASK_INTERRUPTIBLE);
/* we must check for data recieved and restart processing if there's any */
for (i = 0; i < MAX_UDSL; i++) {
spin_lock_irq(&minor_data[i]->recvqlock);
if (!skb_queue_empty(&minor_data[i]->recvqueue)) {
spin_unlock_irq(&minor_data[i]->recvqlock);
set_current_state(TASK_RUNNING);
goto retry;
} else {
spin_unlock_irq(&minor_data[i]->recvqlock);
}
}
};
set_current_state(TASK_RUNNING);
remove_wait_queue (&udsl_wqh, &wait);
datapid = 0;
PDEBUG ("SpeedSARd is exiting\n");
return 0;
complete_and_exit(&thread_grave, 0);
return 0; //never reached
}
......@@ -461,16 +477,7 @@ void udsl_atm_sar_stop (void)
/* Kill the thread */
ret = kill_proc (datapid, SIGTERM, 1);
if (!ret) {
/* Wait 10 seconds */
int count = 10 * 100;
while (datapid && --count) {
current->state = TASK_INTERRUPTIBLE;
schedule_timeout (1);
}
if (!count)
err ("giving up on killing SpeedSAR thread.");
wait_for_completion(&thread_grave);
}
}
......@@ -598,7 +605,7 @@ static void udsl_usb_send_data_complete (struct urb *urb, struct pt_regs *regs)
(unsigned char *) ctx->skb->data,
ctx->skb->len, udsl_usb_send_data_complete, ctx);
err = usb_submit_urb (urb, GFP_KERNEL);
err = usb_submit_urb (urb, GFP_ATOMIC);
PDEBUG ("udsl_usb_send_data_completion (send packet %p with length %d), retval = %d\n",
ctx->skb, ctx->skb->len, err);
......@@ -747,7 +754,7 @@ void udsl_usb_data_receive (struct urb *urb, struct pt_regs *regs)
usb_rcvbulkpipe (instance->usb_dev, UDSL_ENDPOINT_DATA_IN),
(unsigned char *) ctx->skb->data,
UDSL_RECEIVE_BUFFER_SIZE, udsl_usb_data_receive, ctx);
usb_submit_urb (urb, GFP_KERNEL);
usb_submit_urb (urb, GFP_ATOMIC);
return;
};
......@@ -845,7 +852,6 @@ static int udsl_usb_data_exit (struct udsl_instance_data *instance)
if ((!ctx->urb) || (!ctx->skb))
continue;
if (ctx->urb->status == -EINPROGRESS)
usb_unlink_urb (ctx->urb);
usb_free_urb (ctx->urb);
......@@ -856,7 +862,6 @@ static int udsl_usb_data_exit (struct udsl_instance_data *instance)
for (i = 0; i < UDSL_NUMBER_SND_URBS; i++) {
struct udsl_usb_send_data_context *ctx = &(instance->send_ctx[i]);
if (ctx->urb->status == -EINPROGRESS)
usb_unlink_urb (ctx->urb);
if (ctx->skb)
......
......@@ -98,7 +98,7 @@ ioctl_lcd(struct inode *inode, struct file *file, unsigned int cmd,
return -EFAULT;
break;
default:
return -ENOIOCTLCMD;
return -ENOTTY;
break;
}
......
......@@ -35,7 +35,7 @@
* - GeneSys GL620USB-A
* - NetChip 1080 (interoperates with NetChip Win32 drivers)
* - Prolific PL-2301/2302 (replaces "plusb" driver)
* - SA-1100 based Linux PDAs like iPaq, Yopy, and Zaurus
* - PXA-250 or SA-1100 Linux PDAs like iPaq, Yopy, and Zaurus
*
* USB devices can implement their side of this protocol at the cost
* of two bulk endpoints; it's not restricted to "cable" applications.
......@@ -61,8 +61,9 @@
* sheets, sometimes it's not needed and sometimes it hangs. Prolific has
* not responded to repeated support/information requests.
*
* - SA-1100 PDAs ... the www.handhelds.org SA-1100 support works nicely.
* Zaurus support has some problems; it's made UHCI die.
* - SA-1100 PDAs ... the standard ARM Linux SA-1100 support works nicely,
* as found in www.handhelds.org and other kernels. The Sharp/Lineo
* kernels use different drivers, which also talk to this code.
*
* Interop with more Win32 drivers may be a good thing.
*
......@@ -117,6 +118,9 @@
* for USB 2.0 TTs) and memory shortages (potential) too. (db)
* Use "locally assigned" IEEE802 address space. (Brad Hards)
* 18-oct-2002 Support for Zaurus (Pavel Machek), related cleanup (db).
* 14-dec-2002 Remove Zaurus-private crc32 code (Pavel); 2.5 oops fix,
* cleanups and stubbed PXA-250 support (db), fix for framing
* issues on Z, net1080, and gl620a (Toby Milne)
*
*-------------------------------------------------------------------------*/
......@@ -150,7 +154,8 @@
#define CONFIG_USB_GENESYS
#define CONFIG_USB_NET1080
#define CONFIG_USB_PL2301
#define CONFIG_USB_SA1110
// #define CONFIG_USB_PXA
#define CONFIG_USB_SA1100
#define CONFIG_USB_ZAURUS
......@@ -162,6 +167,8 @@
* Nineteen USB 1.1 max size bulk transactions per frame (ms), max.
* Several dozen bytes of IPv4 data can fit in two such transactions.
* One maximum size Ethernet packet takes twenty four of them.
* For high speed, each frame comfortably fits almost 36 max size
* Ethernet packets (so queues should be bigger).
*/
#ifdef REALLY_QUEUE
#define RX_QLEN 4
......@@ -233,6 +240,7 @@ struct driver_info {
int flags;
#define FLAG_FRAMING_NC 0x0001 /* guard against device dropouts */
#define FLAG_FRAMING_GL 0x0002 /* genelink batches packets */
#define FLAG_FRAMING_Z 0x0004 /* zaurus adds a trailer */
#define FLAG_NO_SETINT 0x0010 /* device can't set_interface() */
/* reset device ... can sleep */
......@@ -287,6 +295,12 @@ MODULE_PARM_DESC (msg_level, "Initial message level (default = 1)");
#define RUN_CONTEXT (in_irq () ? "in_irq" \
: (in_interrupt () ? "in_interrupt" : "can sleep"))
/* mostly for PDA style devices, which are always present */
static int always_connected (struct usbnet *dev)
{
return 0;
}
/*-------------------------------------------------------------------------*/
#ifdef DEBUG
......@@ -364,6 +378,7 @@ static const struct driver_info belkin_info = {
static const struct driver_info epson2888_info = {
.description = "Epson USB Device",
.check_connect = always_connected,
.in = 4, .out = 3,
.epsize = 64,
......@@ -457,10 +472,12 @@ static void gl_interrupt_complete (struct urb *urb, struct pt_regs *regs)
case -ENOENT:
case -ESHUTDOWN:
/* this urb is terminated, clean up */
dbg("%s - urb shutting down with status: %d", __FUNCTION__, status);
dbg("%s - urb shutting down with status: %d",
__FUNCTION__, status);
return;
default:
dbg("%s - nonzero urb status received: %d", __FUNCTION__, urb->status);
dbg("%s - nonzero urb status received: %d",
__FUNCTION__, urb->status);
}
status = usb_submit_urb (urb, GFP_ATOMIC);
......@@ -1223,6 +1240,27 @@ static const struct driver_info prolific_info = {
#endif /* CONFIG_USB_PL2301 */
#ifdef CONFIG_USB_PXA
/*-------------------------------------------------------------------------
*
* PXA250 and PXA210 use XScale cores (ARM v5TE) with better USB support,
* and different USB endpoint numbering than the SA1100 devices.
*
*-------------------------------------------------------------------------*/
static const struct driver_info pxa_info = {
.description = "PXA-250 Linux Device",
.check_connect = always_connected,
.in = 1, .out = 2,
.epsize = 64,
};
#endif /* CONFIG_USB_PXA */
#ifdef CONFIG_USB_SA1100
......@@ -1230,16 +1268,17 @@ static const struct driver_info prolific_info = {
*
* Intel's SA-1100 chip integrates basic USB support, and is used
* in PDAs like some iPaqs, the Yopy, some Zaurus models, and more.
* When they runs Linux, arch/arm/sa1100/usb-eth.c may be used to
* When they run Linux, arch/arm/mach-sa1100/usb-eth.c may be used to
* network using minimal USB framing data.
*
* This describes the driver currently in www.handhelds.org kernels.
* This describes the driver currently in standard ARM Linux kernels.
* The Zaurus uses a different driver (see later).
*
*-------------------------------------------------------------------------*/
static const struct driver_info linuxdev_info = {
.description = "SA-1100 Linux Device",
.check_connect = always_connected,
.in = 2, .out = 1,
.epsize = 64,
......@@ -1247,6 +1286,7 @@ static const struct driver_info linuxdev_info = {
static const struct driver_info yopy_info = {
.description = "Yopy",
.check_connect = always_connected,
.in = 2, .out = 1,
.epsize = 64,
......@@ -1257,65 +1297,20 @@ static const struct driver_info yopy_info = {
#ifdef CONFIG_USB_ZAURUS
#include <linux/crc32.h>
/*-------------------------------------------------------------------------
*
* Zaurus is also a SA-1110 based PDA, but one using a different driver
* for its USB slave/target controller than the case above.
* (and framing) for its USB slave/gadget controller than the case above.
*
* The key differences are that (a) it's got a msft-friendly configuration,
* and (b) the linux-friendly framing adds a crc32 to cope with some
* memory corruption observed with usb-to-memory DMA in some cases.
* For the current version of that driver, the main way that framing is
* nonstandard (also from perspective of the CDC ethernet model!) is a
* crc32, added to help detect when some sa1100 usb-to-memory DMA errata
* haven't been fully worked around.
*
*-------------------------------------------------------------------------*/
static const u32 crc32_table [256] = {
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5,
0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f,
0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d,
0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457,
0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb,
0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9,
0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad,
0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683,
0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7,
0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79,
0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f,
0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21,
0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45,
0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db,
0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf,
0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
};
#define CRC32_INITFCS 0xffffffff // Initial FCS value
#define CRC32_FCS(fcs, c) (((fcs) >> 8) ^ crc32_table[((fcs) ^ (c)) & 0xff])
/* fcs_compute32 - memcpy and calculate fcs
* Perform a memcpy and calculate fcs using ppp 32bit CRC algorithm.
*/
static inline u32 fcs_compute32 (unsigned char *sp, int len, u32 fcs)
{
for (;len-- > 0; fcs = CRC32_FCS (fcs, *sp++))
continue;
return fcs;
}
static struct sk_buff *
zaurus_tx_fixup (struct usbnet *dev, struct sk_buff *skb, int flags)
{
......@@ -1334,11 +1329,9 @@ zaurus_tx_fixup (struct usbnet *dev, struct sk_buff *skb, int flags)
if (skb) {
u32 fcs;
done:
fcs = fcs_compute32 (skb->data, skb->len, CRC32_INITFCS);
fcs = crc32_le (~0, skb->data, skb->len);
fcs = ~fcs;
// ? add optional byte make addr even ?
*skb_put (skb, 1) = fcs & 0xff;
*skb_put (skb, 1) = (fcs>> 8) & 0xff;
*skb_put (skb, 1) = (fcs>>16) & 0xff;
......@@ -1349,6 +1342,8 @@ zaurus_tx_fixup (struct usbnet *dev, struct sk_buff *skb, int flags)
static const struct driver_info zaurus_sl5x00_info = {
.description = "Sharp Zaurus SL-5x00",
.flags = FLAG_FRAMING_Z,
.check_connect = always_connected,
.tx_fixup = zaurus_tx_fixup,
.in = 2, .out = 1,
......@@ -1356,11 +1351,16 @@ static const struct driver_info zaurus_sl5x00_info = {
};
static const struct driver_info zaurus_sla300_info = {
.description = "Sharp Zaurus SL-A300",
.flags = FLAG_FRAMING_Z,
.check_connect = always_connected,
.tx_fixup = zaurus_tx_fixup,
.in = 1, .out = 2,
.epsize = 64,
};
// SL-5600 and C-700 are PXA based; should resemble A300
#endif
......@@ -1403,7 +1403,7 @@ static struct net_device_stats *usbnet_get_stats (struct net_device *net)
/*-------------------------------------------------------------------------*/
/* urb completions are currently in_irq; avoid doing real work then. */
/* urb completions may be in_irq; avoid doing real work then. */
static void defer_bh (struct usbnet *dev, struct sk_buff *skb)
{
......@@ -1456,6 +1456,11 @@ static void rx_submit (struct usbnet *dev, struct urb *urb, int flags)
if (dev->driver_info->flags & FLAG_FRAMING_GL)
size = GL_RCV_BUF_SIZE;
else
#endif
#ifdef CONFIG_USB_ZAURUS
if (dev->driver_info->flags & FLAG_FRAMING_Z)
size = 6 + (sizeof (struct ethhdr) + dev->net.mtu);
else
#endif
size = (sizeof (struct ethhdr) + dev->net.mtu);
......@@ -1476,11 +1481,6 @@ static void rx_submit (struct usbnet *dev, struct urb *urb, int flags)
usb_rcvbulkpipe (dev->udev, dev->driver_info->in),
skb->data, size, rx_complete, skb);
urb->transfer_flags |= URB_ASYNC_UNLINK;
#if 0
// Idle-but-posted reads with UHCI really chew up
// PCI bandwidth unless FSBR is disabled
urb->transfer_flags |= URB_NO_FSBR;
#endif
spin_lock_irqsave (&dev->rxq.lock, lockflags);
......@@ -1524,8 +1524,6 @@ static inline void rx_process (struct usbnet *dev, struct sk_buff *skb)
if (skb->len) {
int status;
// FIXME: eth_copy_and_csum "small" packets to new SKB (small < ~200 bytes) ?
skb->dev = &dev->net;
skb->protocol = eth_type_trans (skb, &dev->net);
dev->stats.rx_packets++;
......@@ -1904,7 +1902,7 @@ static void usbnet_tx_timeout (struct net_device *net)
static int usbnet_start_xmit (struct sk_buff *skb, struct net_device *net)
{
struct usbnet *dev = (struct usbnet *) net->priv;
int length = skb->len;
int length;
int retval = NET_XMIT_SUCCESS;
struct urb *urb = 0;
struct skb_data *entry;
......@@ -1924,6 +1922,7 @@ static int usbnet_start_xmit (struct sk_buff *skb, struct net_device *net)
goto drop;
}
}
length = skb->len;
if (!(urb = usb_alloc_urb (0, GFP_ATOMIC))) {
dbg ("no urb");
......@@ -1938,6 +1937,7 @@ static int usbnet_start_xmit (struct sk_buff *skb, struct net_device *net)
// FIXME: reorganize a bit, so that fixup() fills out NetChip
// framing too. (Packet ID update needs the spinlock...)
// [ BETTER: we already own net->xmit_lock, that's enough ]
#ifdef CONFIG_USB_NET1080
if (info->flags & FLAG_FRAMING_NC) {
......@@ -1958,7 +1958,6 @@ static int usbnet_start_xmit (struct sk_buff *skb, struct net_device *net)
usb_sndbulkpipe (dev->udev, info->out),
skb->data, skb->len, tx_complete, skb);
urb->transfer_flags |= URB_ASYNC_UNLINK;
// FIXME urb->timeout = ... jiffies ... ;
spin_lock_irqsave (&dev->txq.lock, flags);
......@@ -2198,7 +2197,7 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
#endif
// ok, it's ready to go.
dev_set_drvdata (&udev->dev, net);
dev_set_drvdata (&udev->dev, dev);
mutex_lock (&usbnet_mutex);
list_add (&dev->dev_list, &usbnet_list);
mutex_unlock (&dev->mutex);
......@@ -2280,15 +2279,28 @@ static const struct usb_device_id products [] = {
},
#endif
#ifdef CONFIG_USB_PXA
/*
* PXA250 or PXA210 ... these use a "usb-eth" driver much like
* the sa1100 one.
*/
{
// Compaq "Itsy" vendor/product id, version "2.0"
USB_DEVICE_VER (0x049F, 0x505A, 0x0200, 0x0200),
.driver_info = (unsigned long) &pxa_info,
},
#endif
#ifdef CONFIG_USB_SA1100
/*
* SA-1100 using www.handhelds.org kernels, or compatible.
* SA-1100 using standard ARM Linux kernels, or compatible.
* Often used when talking to Linux PDAs (iPaq, Yopy, etc).
* The sa-1100 "usb-eth" driver handles the basic framing.
*/
{
// 1183 = 0x049F, both used as hex values?
USB_DEVICE (0x049F, 0x505A), // iPaq: Compaq "Itsy"
// Compaq "Itsy" vendor/product id, version "0.0"
USB_DEVICE_VER (0x049F, 0x505A, 0, 0),
.driver_info = (unsigned long) &linuxdev_info,
}, {
USB_DEVICE (0x0E7E, 0x1001), // G.Mate "Yopy"
......@@ -2323,8 +2335,6 @@ static const struct usb_device_id products [] = {
},
#endif
/* KC2190 from www.sepoong.co.kr "InstaNET" */
{ }, // END
};
MODULE_DEVICE_TABLE (usb, products);
......
......@@ -126,6 +126,7 @@ static struct usb_driver belkin_driver = {
static struct usb_serial_device_type belkin_device = {
.owner = THIS_MODULE,
.name = "Belkin / Peracom / GoHubs USB Serial Adapter",
.short_name = "belkin",
.id_table = id_table_combined,
.num_interrupt_in = 1,
.num_bulk_in = 1,
......
......@@ -121,6 +121,9 @@ int usb_serial_bus_register(struct usb_serial_device_type *device)
{
int retval;
if (device->short_name)
device->driver.name = (char *)device->short_name;
else
device->driver.name = (char *)device->name;
device->driver.bus = &usb_serial_bus_type;
device->driver.probe = usb_serial_device_probe;
......
......@@ -83,6 +83,7 @@ static struct usb_driver cyberjack_driver = {
static struct usb_serial_device_type cyberjack_device = {
.owner = THIS_MODULE,
.name = "Reiner SCT Cyberjack USB card reader",
.short_name = "cyberjack",
.id_table = id_table,
.num_interrupt_in = 1,
.num_bulk_in = 1,
......
......@@ -43,6 +43,7 @@ static struct usb_device_id generic_device_ids[2]; /* Initially all zeroes. */
struct usb_serial_device_type usb_serial_generic_device = {
.owner = THIS_MODULE,
.name = "Generic",
.short_name = "generic",
.id_table = generic_device_ids,
.num_interrupt_in = NUM_DONT_CARE,
.num_bulk_in = NUM_DONT_CARE,
......
......@@ -100,6 +100,7 @@ MODULE_DEVICE_TABLE (usb, id_table_combined);
static struct usb_serial_device_type edgeport_1port_device = {
.owner = THIS_MODULE,
.name = "Edgeport 1 port adapter",
.short_name = "edgeport_1",
.id_table = edgeport_1port_id_table,
.num_interrupt_in = 1,
.num_bulk_in = 1,
......@@ -122,6 +123,7 @@ static struct usb_serial_device_type edgeport_1port_device = {
static struct usb_serial_device_type edgeport_2port_device = {
.owner = THIS_MODULE,
.name = "Edgeport 2 port adapter",
.short_name = "edgeport_2",
.id_table = edgeport_2port_id_table,
.num_interrupt_in = 1,
.num_bulk_in = 1,
......@@ -144,6 +146,7 @@ static struct usb_serial_device_type edgeport_2port_device = {
static struct usb_serial_device_type edgeport_4port_device = {
.owner = THIS_MODULE,
.name = "Edgeport 4 port adapter",
.short_name = "edgeport_4",
.id_table = edgeport_4port_id_table,
.num_interrupt_in = 1,
.num_bulk_in = 1,
......@@ -166,6 +169,7 @@ static struct usb_serial_device_type edgeport_4port_device = {
static struct usb_serial_device_type edgeport_8port_device = {
.owner = THIS_MODULE,
.name = "Edgeport 8 port adapter",
.short_name = "edgeport_8",
.id_table = edgeport_8port_id_table,
.num_interrupt_in = 1,
.num_bulk_in = 1,
......
......@@ -2635,6 +2635,7 @@ static void edge_shutdown (struct usb_serial *serial)
static struct usb_serial_device_type edgeport_1port_device = {
.owner = THIS_MODULE,
.name = "Edgeport TI 1 port adapter",
.short_name = "edgeport_ti_1",
.id_table = edgeport_1port_id_table,
.num_interrupt_in = 1,
.num_bulk_in = 1,
......@@ -2657,6 +2658,7 @@ static struct usb_serial_device_type edgeport_1port_device = {
static struct usb_serial_device_type edgeport_2port_device = {
.owner = THIS_MODULE,
.name = "Edgeport TI 2 port adapter",
.short_name = "edgeport_ti_2",
.id_table = edgeport_2port_id_table,
.num_interrupt_in = 1,
.num_bulk_in = 2,
......
......@@ -481,6 +481,7 @@ static struct usb_device_id keyspan_4port_ids[] = {
static struct usb_serial_device_type keyspan_pre_device = {
.owner = THIS_MODULE,
.name = "Keyspan - (without firmware)",
.short_name = "keyspan_no_firm",
.id_table = keyspan_pre_ids,
.num_interrupt_in = NUM_DONT_CARE,
.num_bulk_in = NUM_DONT_CARE,
......@@ -492,6 +493,7 @@ static struct usb_serial_device_type keyspan_pre_device = {
static struct usb_serial_device_type keyspan_1port_device = {
.owner = THIS_MODULE,
.name = "Keyspan 1 port adapter",
.short_name = "keyspan_1",
.id_table = keyspan_1port_ids,
.num_interrupt_in = NUM_DONT_CARE,
.num_bulk_in = 3,
......@@ -514,6 +516,7 @@ static struct usb_serial_device_type keyspan_1port_device = {
static struct usb_serial_device_type keyspan_2port_device = {
.owner = THIS_MODULE,
.name = "Keyspan 2 port adapter",
.short_name = "keyspan_2",
.id_table = keyspan_2port_ids,
.num_interrupt_in = NUM_DONT_CARE,
.num_bulk_in = NUM_DONT_CARE,
......@@ -536,6 +539,7 @@ static struct usb_serial_device_type keyspan_2port_device = {
static struct usb_serial_device_type keyspan_4port_device = {
.owner = THIS_MODULE,
.name = "Keyspan 4 port adapter",
.short_name = "keyspan_4",
.id_table = keyspan_4port_ids,
.num_interrupt_in = NUM_DONT_CARE,
.num_bulk_in = 5,
......
......@@ -827,6 +827,7 @@ static void keyspan_pda_shutdown (struct usb_serial *serial)
static struct usb_serial_device_type keyspan_pda_fake_device = {
.owner = THIS_MODULE,
.name = "Keyspan PDA - (prerenumeration)",
.short_name = "kyspn_pda_nofirm",
.id_table = id_table_fake,
.num_interrupt_in = NUM_DONT_CARE,
.num_bulk_in = NUM_DONT_CARE,
......@@ -840,6 +841,7 @@ static struct usb_serial_device_type keyspan_pda_fake_device = {
static struct usb_serial_device_type xircom_pgs_fake_device = {
.owner = THIS_MODULE,
.name = "Xircom / Entregra PGS - (prerenumeration)",
.short_name = "xircom_nofirm",
.id_table = id_table_fake_xircom,
.num_interrupt_in = NUM_DONT_CARE,
.num_bulk_in = NUM_DONT_CARE,
......@@ -852,6 +854,7 @@ static struct usb_serial_device_type xircom_pgs_fake_device = {
static struct usb_serial_device_type keyspan_pda_device = {
.owner = THIS_MODULE,
.name = "Keyspan PDA",
.short_name = "keyspan_pda",
.id_table = id_table_std,
.num_interrupt_in = 1,
.num_bulk_in = 0,
......
......@@ -127,6 +127,7 @@ static struct usb_driver kl5kusb105d_driver = {
static struct usb_serial_device_type kl5kusb105d_device = {
.owner = THIS_MODULE,
.name = "KL5KUSB105D / PalmConnect",
.short_name = "kl5kusb105d",
.id_table = id_table,
.num_interrupt_in = 1,
.num_bulk_in = 1,
......
......@@ -149,6 +149,7 @@ static struct usb_driver mct_u232_driver = {
static struct usb_serial_device_type mct_u232_device = {
.owner = THIS_MODULE,
.name = "Magic Control Technology USB-RS232",
.short_name = "mct_u232",
.id_table = id_table_combined,
.num_interrupt_in = 2,
.num_bulk_in = 0,
......
......@@ -94,6 +94,7 @@ static struct usb_driver omninet_driver = {
static struct usb_serial_device_type zyxel_omninet_device = {
.owner = THIS_MODULE,
.name = "ZyXEL - omni.net lcd plus usb",
.short_name = "omninet",
.id_table = id_table,
.num_interrupt_in = 1,
.num_bulk_in = 1,
......
......@@ -168,6 +168,9 @@ struct usb_serial {
* @owner: pointer to the module that owns this device.
* @name: pointer to a string that describes this device. This string used
* in the syslog messages when a device is inserted or removed.
* @short_name: a pointer to a string that describes this device in
* KOBJ_NAME_LEN characters or less. This is used for the sysfs interface
* to describe the driver.
* @id_table: pointer to a list of usb_device_id structures that define all
* of the devices this structure can support.
* @num_interrupt_in: the number of interrupt in endpoints this device will
......@@ -201,6 +204,7 @@ struct usb_serial {
struct usb_serial_device_type {
struct module *owner;
char *name;
char *short_name;
const struct usb_device_id *id_table;
char num_interrupt_in;
char num_bulk_in;
......
......@@ -236,6 +236,7 @@ static struct usb_driver visor_driver = {
static struct usb_serial_device_type handspring_device = {
.owner = THIS_MODULE,
.name = "Handspring Visor / Treo / Palm 4.0 / Clié 4.x",
.short_name = "visor",
.id_table = id_table,
.num_interrupt_in = NUM_DONT_CARE,
.num_bulk_in = 2,
......@@ -262,6 +263,7 @@ static struct usb_serial_device_type handspring_device = {
static struct usb_serial_device_type clie_3_5_device = {
.owner = THIS_MODULE,
.name = "Sony Clié 3.5",
.short_name = "clie_3.5",
.id_table = clie_id_3_5_table,
.num_interrupt_in = 0,
.num_bulk_in = 1,
......
......@@ -156,6 +156,7 @@ static void whiteheat_write_callback (struct urb *urb, struct pt_regs *regs);
static struct usb_serial_device_type whiteheat_fake_device = {
.owner = THIS_MODULE,
.name = "Connect Tech - WhiteHEAT - (prerenumeration)",
.short_name = "whiteheatnofirm",
.id_table = id_table_prerenumeration,
.num_interrupt_in = NUM_DONT_CARE,
.num_bulk_in = NUM_DONT_CARE,
......@@ -168,6 +169,7 @@ static struct usb_serial_device_type whiteheat_fake_device = {
static struct usb_serial_device_type whiteheat_device = {
.owner = THIS_MODULE,
.name = "Connect Tech - WhiteHEAT",
.short_name = "whiteheat",
.id_table = id_table_std,
.num_interrupt_in = NUM_DONT_CARE,
.num_bulk_in = NUM_DONT_CARE,
......@@ -512,9 +514,11 @@ static int whiteheat_attach (struct usb_serial *serial)
no_rx_buf:
usb_free_urb(urb);
no_rx_urb:
;
}
kfree(info);
no_private:
;
}
return -ENOMEM;
}
......
......@@ -480,7 +480,7 @@ int usb_stor_control_msg(struct us_data *us, unsigned int pipe,
status = usb_stor_msg_common(us);
/* return the actual length of the data transferred if no error */
if (status >= 0)
if (status == 0)
status = us->current_urb->actual_length;
return status;
}
......@@ -583,50 +583,52 @@ static int interpret_urb_result(struct us_data *us, unsigned int pipe,
US_DEBUGP("Status code %d; transferred %u/%u\n",
result, partial, length);
switch (result) {
/* stalled */
if (result == -EPIPE) {
/* no error code; did we send all the data? */
case 0:
if (partial != length) {
US_DEBUGP("-- short transfer\n");
return USB_STOR_XFER_SHORT;
}
US_DEBUGP("-- transfer complete\n");
return USB_STOR_XFER_GOOD;
/* for non-bulk (i.e., control) endpoints, a stall indicates
* a protocol error */
if (!usb_pipebulk(pipe)) {
/* stalled */
case -EPIPE:
/* for control endpoints, a stall indicates a protocol error */
if (usb_pipecontrol(pipe)) {
US_DEBUGP("-- stall on control pipe\n");
return USB_STOR_XFER_ERROR;
}
/* for a bulk endpoint, clear the stall */
/* for other sorts of endpoint, clear the stall */
US_DEBUGP("clearing endpoint halt for pipe 0x%x\n", pipe);
if (usb_stor_clear_halt(us, pipe) < 0)
return USB_STOR_XFER_ERROR;
return USB_STOR_XFER_STALLED;
}
/* NAK - that means we've retried this a few times already */
if (result == -ETIMEDOUT) {
case -ETIMEDOUT:
US_DEBUGP("-- device NAKed\n");
return USB_STOR_XFER_ERROR;
}
/* the transfer was cancelled, presumably by an abort */
if (result == -ENODEV) {
case -ENODEV:
US_DEBUGP("-- transfer cancelled\n");
return USB_STOR_XFER_ERROR;
}
/* short scatter-gather read transfer */
case -EREMOTEIO:
US_DEBUGP("-- short read transfer\n");
return USB_STOR_XFER_SHORT;
/* the catch-all error case */
if (result < 0) {
default:
US_DEBUGP("-- unknown error\n");
return USB_STOR_XFER_ERROR;
}
/* no error code; did we send all the data? */
if (partial != length) {
US_DEBUGP("-- transferred only %u bytes\n", partial);
return USB_STOR_XFER_SHORT;
}
US_DEBUGP("-- transfer complete\n");
return USB_STOR_XFER_GOOD;
}
/*
......
......@@ -728,9 +728,13 @@ static int storage_probe(struct usb_interface *intf,
USB_ENDPOINT_NUMBER_MASK;
ss->ep_out = ep_out->bEndpointAddress &
USB_ENDPOINT_NUMBER_MASK;
if (ep_int) {
ss->ep_int = ep_int->bEndpointAddress &
USB_ENDPOINT_NUMBER_MASK;
ss->ep_bInterval = ep_int->bInterval;
}
else
ss->ep_int = ss->ep_bInterval = 0;
/* allocate the URB, the usb_ctrlrequest, and the IRQ URB */
if (usb_stor_allocate_urbs(ss))
......@@ -771,9 +775,13 @@ static int storage_probe(struct usb_interface *intf,
USB_ENDPOINT_NUMBER_MASK;
ss->ep_out = ep_out->bEndpointAddress &
USB_ENDPOINT_NUMBER_MASK;
if (ep_int) {
ss->ep_int = ep_int->bEndpointAddress &
USB_ENDPOINT_NUMBER_MASK;
ss->ep_bInterval = ep_int->bInterval;
}
else
ss->ep_int = ss->ep_bInterval = 0;
/* establish the connection to the new device */
ss->ifnum = ifnum;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment