Commit 6d6671ff authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Merge kroah.com:/home/linux/linux/BK/bleeding-2.5

into kroah.com:/home/linux/linux/BK/gregkh-2.5
parents 30d66ad7 d39f11cd
...@@ -389,8 +389,8 @@ static int rh_call_control (struct usb_hcd *hcd, struct urb *urb) ...@@ -389,8 +389,8 @@ static int rh_call_control (struct usb_hcd *hcd, struct urb *urb)
break; break;
case DeviceOutRequest | USB_REQ_SET_ADDRESS: case DeviceOutRequest | USB_REQ_SET_ADDRESS:
// wValue == urb->dev->devaddr // wValue == urb->dev->devaddr
dbg ("%s root hub device address %d", dev_dbg (*hcd->controller, "root hub device address %d\n",
hcd->self.bus_name, wValue); wValue);
break; break;
/* INTERFACE REQUESTS (no defined feature/status flags) */ /* INTERFACE REQUESTS (no defined feature/status flags) */
...@@ -1188,7 +1188,6 @@ static int hcd_unlink_urb (struct urb *urb) ...@@ -1188,7 +1188,6 @@ static int hcd_unlink_urb (struct urb *urb)
if (urb->transfer_flags & URB_ASYNC_UNLINK) if (urb->transfer_flags & URB_ASYNC_UNLINK)
return -EINPROGRESS; return -EINPROGRESS;
dev_dbg (*sys, "wait for giveback urb %p\n", urb);
wait_for_completion (&splice.done); wait_for_completion (&splice.done);
return 0; return 0;
......
...@@ -57,6 +57,12 @@ static inline char *portspeed (int portstatus) ...@@ -57,6 +57,12 @@ static inline char *portspeed (int portstatus)
} }
#endif #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 */ /* USB 2.0 spec Section 11.24.4.5 */
static int usb_get_hub_descriptor(struct usb_device *dev, void *data, int size) 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, ...@@ -298,7 +304,7 @@ static int usb_hub_configure(struct usb_hub *hub,
} }
dev->maxchild = hub->descriptor->bNbrPorts; 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"); (dev->maxchild == 1) ? "" : "s");
le16_to_cpus(&hub->descriptor->wHubCharacteristics); le16_to_cpus(&hub->descriptor->wHubCharacteristics);
...@@ -521,7 +527,7 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id) ...@@ -521,7 +527,7 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id)
} }
/* We found a hub */ /* 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); hub = kmalloc(sizeof(*hub), GFP_KERNEL);
if (!hub) { if (!hub) {
...@@ -651,8 +657,6 @@ static int usb_hub_port_status(struct usb_device *hub, int port, ...@@ -651,8 +657,6 @@ static int usb_hub_port_status(struct usb_device *hub, int port,
else { else {
*status = le16_to_cpu(portsts->wPortStatus); *status = le16_to_cpu(portsts->wPortStatus);
*change = le16_to_cpu(portsts->wPortChange); *change = le16_to_cpu(portsts->wPortChange);
dbg("port %d, portstatus %x, change %x, %s", port + 1,
*status, *change, portspeed(*status));
ret = 0; ret = 0;
} }
kfree(portsts); kfree(portsts);
...@@ -710,8 +714,9 @@ static int usb_hub_port_wait_reset(struct usb_device *hub, int port, ...@@ -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) if (delay_time >= 2 * HUB_SHORT_RESET_TIME)
delay = HUB_LONG_RESET_TIME; delay = HUB_LONG_RESET_TIME;
dbg("port %d of hub %s not reset yet, waiting %dms", port + 1, dev_dbg (*hubdev (hub),
hub->devpath, delay); "port %d not reset yet, waiting %dms\n",
port + 1, delay);
} }
return -1; return -1;
...@@ -735,14 +740,15 @@ static int usb_hub_port_reset(struct usb_device *hub, int port, ...@@ -735,14 +740,15 @@ static int usb_hub_port_reset(struct usb_device *hub, int port,
return status; return status;
} }
dbg("port %d of hub %s not enabled, trying reset again...", dev_dbg (*hubdev (hub),
port + 1, hub->devpath); "port %d not enabled, trying reset again...\n",
port + 1);
delay = HUB_LONG_RESET_TIME; delay = HUB_LONG_RESET_TIME;
} }
err("Cannot enable port %i of hub %s, disabling port.", dev_err (*hubdev (hub),
port + 1, hub->devpath); "Cannot enable port %i. Maybe the USB cable is bad?\n",
err("Maybe the USB cable is bad?"); port + 1);
return -1; return -1;
} }
...@@ -808,8 +814,9 @@ static int usb_hub_port_debounce(struct usb_device *hub, int port) ...@@ -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. */ /* 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", dev_info (*hubdev (hub),
hub->devnum, port, delay_time, stable_count, portstatus); "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; 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, ...@@ -822,9 +829,9 @@ static void usb_hub_port_connect_change(struct usb_hub *hubstate, int port,
unsigned int delay = HUB_SHORT_RESET_TIME; unsigned int delay = HUB_SHORT_RESET_TIME;
int i; int i;
dbg("hub %s port %d, portstatus %x, change %x, %s", dev_dbg (hubstate->intf->dev,
hub->devpath, port + 1, "port %d, status %x, change %x, %s\n",
portstatus, portchange, portspeed (portstatus)); port + 1, portstatus, portchange, portspeed (portstatus));
/* Clear the connection change status */ /* Clear the connection change status */
usb_clear_port_feature(hub, port + 1, USB_PORT_FEAT_C_CONNECTION); 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, ...@@ -842,7 +849,9 @@ static void usb_hub_port_connect_change(struct usb_hub *hubstate, int port,
} }
if (usb_hub_port_debounce(hub, 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); usb_hub_port_disable(hub, port);
return; return;
} }
...@@ -861,7 +870,8 @@ static void usb_hub_port_connect_change(struct usb_hub *hubstate, int port, ...@@ -861,7 +870,8 @@ static void usb_hub_port_connect_change(struct usb_hub *hubstate, int port,
/* Allocate a new device struct */ /* Allocate a new device struct */
dev = usb_alloc_dev(hub, hub->bus); dev = usb_alloc_dev(hub, hub->bus);
if (!dev) { if (!dev) {
err("couldn't allocate usb_device"); dev_err (hubstate->intf->dev,
"couldn't allocate usb_device\n");
break; break;
} }
...@@ -904,10 +914,12 @@ static void usb_hub_port_connect_change(struct usb_hub *hubstate, int port, ...@@ -904,10 +914,12 @@ static void usb_hub_port_connect_change(struct usb_hub *hubstate, int port,
len = snprintf (dev->devpath, sizeof dev->devpath, len = snprintf (dev->devpath, sizeof dev->devpath,
"%d", port + 1); "%d", port + 1);
if (len == sizeof dev->devpath) 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); dev->bus->busnum, dev->devnum, dev->devpath);
info("new USB device %s-%s, assigned address %d", dev_info (hubstate->intf->dev,
dev->bus->bus_name, dev->devpath, dev->devnum); "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 /* put the device in the global device tree. the hub port
* is the "bus_id"; hubs show in hierarchy like bridges * is the "bus_id"; hubs show in hierarchy like bridges
...@@ -992,12 +1004,11 @@ static void usb_hub_events(void) ...@@ -992,12 +1004,11 @@ static void usb_hub_events(void)
} }
if (portchange & USB_PORT_STAT_C_CONNECTION) { 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); usb_hub_port_connect_change(hub, i, portstatus, portchange);
} else if (portchange & USB_PORT_STAT_C_ENABLE) { } else if (portchange & USB_PORT_STAT_C_ENABLE) {
dbg("hub %s port %d enable change, status %x", dev_dbg (*hubdev (dev),
dev->devpath, i + 1, portstatus); "port %d enable change, status %x\n",
i + 1, portstatus);
usb_clear_port_feature(dev, usb_clear_port_feature(dev,
i + 1, USB_PORT_FEAT_C_ENABLE); i + 1, USB_PORT_FEAT_C_ENABLE);
......
...@@ -18,21 +18,45 @@ ...@@ -18,21 +18,45 @@
/* this file is part of ehci-hcd.c */ /* this file is part of ehci-hcd.c */
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,50)
#define ehci_dbg(ehci, fmt, args...) \ #define ehci_dbg(ehci, fmt, args...) \
dev_dbg (*(ehci)->hcd.controller, 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 #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 #endif
#ifdef EHCI_VERBOSE_DEBUG #ifdef EHCI_VERBOSE_DEBUG
# define vdbg dbg # define vdbg dbg
# define ehci_vdbg ehci_dbg
#else #else
static inline void vdbg (char *fmt, ...) { } # define vdbg(fmt,args...) do { } while (0)
# define ehci_vdbg(ehci, fmt, args...) do { } while (0)
#endif #endif
#ifdef DEBUG #ifdef DEBUG
...@@ -289,7 +313,8 @@ static void qh_lines (struct ehci_qh *qh, char **nextp, unsigned *sizep) ...@@ -289,7 +313,8 @@ static void qh_lines (struct ehci_qh *qh, char **nextp, unsigned *sizep)
scratch = cpu_to_le32p (&qh->hw_info1); scratch = cpu_to_le32p (&qh->hw_info1);
hw_curr = cpu_to_le32p (&qh->hw_current); 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, qh, scratch & 0x007f,
speed_char (scratch), speed_char (scratch),
(scratch >> 8) & 0x000f, (scratch >> 8) & 0x000f,
......
...@@ -123,12 +123,6 @@ static int log2_irq_thresh = 0; // 0 to 6 ...@@ -123,12 +123,6 @@ static int log2_irq_thresh = 0; // 0 to 6
MODULE_PARM (log2_irq_thresh, "i"); MODULE_PARM (log2_irq_thresh, "i");
MODULE_PARM_DESC (log2_irq_thresh, "log2 IRQ latency, 1-64 microframes"); 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) #define INTR_MASK (STS_IAA | STS_FATAL | STS_ERR | STS_INT)
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
...@@ -202,7 +196,7 @@ static int ehci_reset (struct ehci_hcd *ehci) ...@@ -202,7 +196,7 @@ static int ehci_reset (struct ehci_hcd *ehci)
dbg_cmd (ehci, "reset", command); dbg_cmd (ehci, "reset", command);
writel (command, &ehci->regs->command); writel (command, &ehci->regs->command);
ehci->hcd.state = USB_STATE_HALT; 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) */ /* idle the controller (from running) */
...@@ -250,9 +244,7 @@ static void ehci_ready (struct ehci_hcd *ehci) ...@@ -250,9 +244,7 @@ static void ehci_ready (struct ehci_hcd *ehci)
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
static void ehci_tasklet (unsigned long param); static void ehci_work(struct ehci_hcd *ehci, struct pt_regs *regs);
static void ehci_irq (struct usb_hcd *hcd, struct pt_regs *regs);
static void ehci_watchdog (unsigned long param) static void ehci_watchdog (unsigned long param)
{ {
...@@ -260,10 +252,25 @@ static void ehci_watchdog (unsigned long param) ...@@ -260,10 +252,25 @@ static void ehci_watchdog (unsigned long param)
unsigned long flags; unsigned long flags;
spin_lock_irqsave (&ehci->lock, 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 */ /* stop async processing after it's idled a while */
if (ehci->async_idle) { else if (ehci->async_idle) {
start_unlink_async (ehci, ehci->async); start_unlink_async (ehci, ehci->async);
ehci->async_idle = 0; ehci->async_idle = 0;
} }
...@@ -289,8 +296,7 @@ static int bios_handoff (struct ehci_hcd *ehci, int where, u32 cap) ...@@ -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); pci_read_config_dword (ehci->hcd.pdev, where, &cap);
} while ((cap & (1 << 16)) && msec); } while ((cap & (1 << 16)) && msec);
if (cap & (1 << 16)) { if (cap & (1 << 16)) {
dev_info (*ehci->hcd.controller, ehci_err (ehci, "BIOS handoff failed (%d, %04x)\n",
"BIOS handoff failed (%d, %04x)\n",
where, cap); where, cap);
return 1; return 1;
} }
...@@ -333,8 +339,7 @@ static int ehci_start (struct usb_hcd *hcd) ...@@ -333,8 +339,7 @@ static int ehci_start (struct usb_hcd *hcd)
return -EOPNOTSUPP; return -EOPNOTSUPP;
break; break;
case 0: /* illegal reserved capability */ case 0: /* illegal reserved capability */
dev_warn (*ehci->hcd.controller, ehci_warn (ehci, "illegal capability!\n");
"illegal capability!\n");
cap = 0; cap = 0;
/* FALLTHROUGH */ /* FALLTHROUGH */
default: /* unknown */ default: /* unknown */
...@@ -381,6 +386,8 @@ static int ehci_start (struct usb_hcd *hcd) ...@@ -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 * 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 * a 'real' qh without stopping the async schedule [4.8]. use it
* as the 'reclamation list head' too. * 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->qh_next.qh = 0;
ehci->async->hw_next = QH_NEXT (ehci->async->qh_dma); ehci->async->hw_next = QH_NEXT (ehci->async->qh_dma);
...@@ -388,8 +395,7 @@ static int ehci_start (struct usb_hcd *hcd) ...@@ -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_token = cpu_to_le32 (QTD_STS_HALT);
ehci->async->hw_qtd_next = EHCI_LIST_END; ehci->async->hw_qtd_next = EHCI_LIST_END;
ehci->async->qh_state = QH_STATE_LINKED; ehci->async->qh_state = QH_STATE_LINKED;
ehci_qtd_free (ehci, ehci->async->dummy); ehci->async->hw_alt_next = QTD_NEXT (ehci->async->dummy->qtd_dma);
ehci->async->dummy = 0;
writel ((u32)ehci->async->qh_dma, &ehci->regs->async_next); writel ((u32)ehci->async->qh_dma, &ehci->regs->async_next);
/* /*
...@@ -406,8 +412,7 @@ static int ehci_start (struct usb_hcd *hcd) ...@@ -406,8 +412,7 @@ static int ehci_start (struct usb_hcd *hcd)
if (HCC_64BIT_ADDR (hcc_params)) { if (HCC_64BIT_ADDR (hcc_params)) {
writel (0, &ehci->regs->segment); writel (0, &ehci->regs->segment);
if (!pci_set_dma_mask (ehci->hcd.pdev, 0xffffffffffffffffULL)) if (!pci_set_dma_mask (ehci->hcd.pdev, 0xffffffffffffffffULL))
dev_info (*ehci->hcd.controller, ehci_info (ehci, "enabled 64bit PCI DMA\n");
"enabled 64bit PCI DMA (DAC)\n");
} }
/* clear interrupt enables, set irq latency */ /* clear interrupt enables, set irq latency */
...@@ -426,9 +431,6 @@ static int ehci_start (struct usb_hcd *hcd) ...@@ -426,9 +431,6 @@ static int ehci_start (struct usb_hcd *hcd)
/* set async sleep time = 10 us ... ? */ /* set async sleep time = 10 us ... ? */
ehci->tasklet.func = ehci_tasklet;
ehci->tasklet.data = (unsigned long) ehci;
init_timer (&ehci->watchdog); init_timer (&ehci->watchdog);
ehci->watchdog.function = ehci_watchdog; ehci->watchdog.function = ehci_watchdog;
ehci->watchdog.data = (unsigned long) ehci; ehci->watchdog.data = (unsigned long) ehci;
...@@ -454,7 +456,7 @@ static int ehci_start (struct usb_hcd *hcd) ...@@ -454,7 +456,7 @@ static int ehci_start (struct usb_hcd *hcd)
/* PCI Serial Bus Release Number is at 0x60 offset */ /* PCI Serial Bus Release Number is at 0x60 offset */
pci_read_config_byte (hcd->pdev, 0x60, &tempbyte); pci_read_config_byte (hcd->pdev, 0x60, &tempbyte);
temp = readw (&ehci->caps->hci_version); temp = readw (&ehci->caps->hci_version);
dev_info (*hcd->controller, ehci_info (ehci,
"USB %x.%x enabled, EHCI %x.%02x, driver %s\n", "USB %x.%x enabled, EHCI %x.%02x, driver %s\n",
((tempbyte & 0xf0)>>4), (tempbyte & 0x0f), ((tempbyte & 0xf0)>>4), (tempbyte & 0x0f),
temp >> 8, temp & 0xff, DRIVER_VERSION); temp >> 8, temp & 0xff, DRIVER_VERSION);
...@@ -494,10 +496,11 @@ static void ehci_stop (struct usb_hcd *hcd) ...@@ -494,10 +496,11 @@ static void ehci_stop (struct usb_hcd *hcd)
/* no more interrupts ... */ /* no more interrupts ... */
if (hcd->state == USB_STATE_RUNNING) if (hcd->state == USB_STATE_RUNNING)
ehci_ready (ehci); ehci_ready (ehci);
if (in_interrupt ()) /* should not happen!! */ if (in_interrupt ()) { /* must not happen!! */
dev_err (*hcd->controller, "stopped %s!\n", RUN_CONTEXT); ehci_err (ehci, "stopped in_interrupt!\n");
else return;
del_timer_sync (&ehci->watchdog); }
del_timer_sync (&ehci->watchdog);
ehci_reset (ehci); ehci_reset (ehci);
/* let companion controllers work when we aren't */ /* let companion controllers work when we aren't */
...@@ -506,8 +509,9 @@ static void ehci_stop (struct usb_hcd *hcd) ...@@ -506,8 +509,9 @@ static void ehci_stop (struct usb_hcd *hcd)
remove_debug_files (ehci); remove_debug_files (ehci);
/* root hub is shut down separately (first, when possible) */ /* root hub is shut down separately (first, when possible) */
tasklet_disable (&ehci->tasklet); spin_lock_irq (&ehci->lock);
ehci_tasklet ((unsigned long) ehci); ehci_work (ehci, NULL);
spin_unlock_irq (&ehci->lock);
ehci_mem_cleanup (ehci); ehci_mem_cleanup (ehci);
#ifdef EHCI_STATS #ifdef EHCI_STATS
...@@ -615,22 +619,16 @@ dbg ("%s: resume port %d", hcd_to_bus (hcd)->bus_name, i); ...@@ -615,22 +619,16 @@ dbg ("%s: resume port %d", hcd_to_bus (hcd)->bus_name, i);
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
/* /*
* tasklet scheduled by some interrupts and other events * ehci_work is called from some interrupts, timers, and so on.
* calls driver completion functions ... but not in_irq() * 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) if (ehci->reclaim_ready)
end_unlink_async (ehci); end_unlink_async (ehci, regs);
scan_async (ehci); scan_async (ehci, regs);
if (ehci->next_uframe != -1) if (ehci->next_uframe != -1)
scan_periodic (ehci); scan_periodic (ehci, regs);
spin_unlock_irq (&ehci->lock);
} }
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
...@@ -643,7 +641,7 @@ static void ehci_irq (struct usb_hcd *hcd, struct pt_regs *regs) ...@@ -643,7 +641,7 @@ static void ehci_irq (struct usb_hcd *hcd, struct pt_regs *regs)
/* e.g. cardbus physical eject */ /* e.g. cardbus physical eject */
if (status == ~(u32) 0) { if (status == ~(u32) 0) {
dbg ("%s: device removed!", hcd_to_bus (hcd)->bus_name); ehci_dbg (ehci, "device removed\n");
goto dead; goto dead;
} }
...@@ -651,6 +649,8 @@ static void ehci_irq (struct usb_hcd *hcd, struct pt_regs *regs) ...@@ -651,6 +649,8 @@ static void ehci_irq (struct usb_hcd *hcd, struct pt_regs *regs)
if (!status) /* irq sharing? */ if (!status) /* irq sharing? */
return; return;
spin_lock (&ehci->lock);
/* clear (just) interrupts */ /* clear (just) interrupts */
writel (status, &ehci->regs->status); writel (status, &ehci->regs->status);
readl (&ehci->regs->command); /* unblock posted write */ readl (&ehci->regs->command); /* unblock posted write */
...@@ -681,8 +681,7 @@ static void ehci_irq (struct usb_hcd *hcd, struct pt_regs *regs) ...@@ -681,8 +681,7 @@ static void ehci_irq (struct usb_hcd *hcd, struct pt_regs *regs)
/* PCI errors [4.15.2.4] */ /* PCI errors [4.15.2.4] */
if (unlikely ((status & STS_FATAL) != 0)) { if (unlikely ((status & STS_FATAL) != 0)) {
err ("%s: fatal error, state %x", ehci_err (ehci, "fatal error\n");
hcd_to_bus (hcd)->bus_name, hcd->state);
dead: dead:
ehci_reset (ehci); ehci_reset (ehci);
/* generic layer kills/unlinks all urbs, then /* generic layer kills/unlinks all urbs, then
...@@ -691,9 +690,9 @@ static void ehci_irq (struct usb_hcd *hcd, struct pt_regs *regs) ...@@ -691,9 +690,9 @@ static void ehci_irq (struct usb_hcd *hcd, struct pt_regs *regs)
bh = 1; bh = 1;
} }
/* most work doesn't need to be in_irq() */ if (bh)
if (likely (bh == 1)) ehci_work (ehci, regs);
tasklet_schedule (&ehci->tasklet); spin_unlock (&ehci->lock);
} }
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
...@@ -754,52 +753,52 @@ static int ehci_urb_enqueue ( ...@@ -754,52 +753,52 @@ static int ehci_urb_enqueue (
static int ehci_urb_dequeue (struct usb_hcd *hcd, struct urb *urb) static int ehci_urb_dequeue (struct usb_hcd *hcd, struct urb *urb)
{ {
struct ehci_hcd *ehci = hcd_to_ehci (hcd); struct ehci_hcd *ehci = hcd_to_ehci (hcd);
struct ehci_qh *qh = (struct ehci_qh *) urb->hcpriv; struct ehci_qh *qh;
unsigned long flags; unsigned long flags;
int maybe_irq = 1;
ehci_vdbg (ehci, "urb_dequeue %p qh %p state %d\n", spin_lock_irqsave (&ehci->lock, flags);
urb, qh, qh->qh_state);
switch (usb_pipetype (urb->pipe)) { switch (usb_pipetype (urb->pipe)) {
// case PIPE_CONTROL: // case PIPE_CONTROL:
// case PIPE_BULK: // case PIPE_BULK:
default: default:
spin_lock_irqsave (&ehci->lock, flags); qh = (struct ehci_qh *) urb->hcpriv;
if (ehci->reclaim) { if (!qh)
vdbg ("dq %p: reclaim = %p, %s", break;
qh, ehci->reclaim, RUN_CONTEXT); while (qh->qh_state == QH_STATE_LINKED
if (qh == ehci->reclaim) { && ehci->reclaim
/* unlinking qh for another queued urb? */ && HCD_IS_RUNNING (ehci->hcd.state)
spin_unlock_irqrestore (&ehci->lock, flags); ) {
return 0; spin_unlock_irqrestore (&ehci->lock, flags);
}
if (in_interrupt ()) { if (maybe_irq) {
spin_unlock_irqrestore (&ehci->lock, flags); if (in_interrupt ())
return -EAGAIN; return -EAGAIN;
} maybe_irq = 0;
while (qh->qh_state == QH_STATE_LINKED
&& ehci->reclaim
&& ehci->hcd.state != USB_STATE_HALT
) {
spin_unlock_irqrestore (&ehci->lock, flags);
/* let pending unlinks complete */
wait_ms (1);
spin_lock_irqsave (&ehci->lock, flags);
} }
/* 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) if (qh->qh_state == QH_STATE_LINKED)
start_unlink_async (ehci, qh); start_unlink_async (ehci, qh);
spin_unlock_irqrestore (&ehci->lock, flags);
break; break;
case PIPE_INTERRUPT: 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) { if (qh->qh_state == QH_STATE_LINKED) {
/* messy, can spin or block a microframe ... */ /* messy, can spin or block a microframe ... */
intr_deschedule (ehci, qh, 1); intr_deschedule (ehci, qh, 1);
/* qh_state == IDLE */ /* qh_state == IDLE */
} }
qh_completions (ehci, qh); qh_completions (ehci, qh, NULL);
/* reschedule QH iff another request is queued */ /* reschedule QH iff another request is queued */
if (!list_empty (&qh->qtd_list) if (!list_empty (&qh->qtd_list)
...@@ -817,7 +816,6 @@ static int ehci_urb_dequeue (struct usb_hcd *hcd, struct urb *urb) ...@@ -817,7 +816,6 @@ static int ehci_urb_dequeue (struct usb_hcd *hcd, struct urb *urb)
} }
return status; return status;
} }
spin_unlock_irqrestore (&ehci->lock, flags);
break; break;
case PIPE_ISOCHRONOUS: case PIPE_ISOCHRONOUS:
...@@ -828,6 +826,7 @@ static int ehci_urb_dequeue (struct usb_hcd *hcd, struct urb *urb) ...@@ -828,6 +826,7 @@ static int ehci_urb_dequeue (struct usb_hcd *hcd, struct urb *urb)
urb->transfer_flags |= EHCI_STATE_UNLINK; urb->transfer_flags |= EHCI_STATE_UNLINK;
break; break;
} }
spin_unlock_irqrestore (&ehci->lock, flags);
return 0; return 0;
} }
...@@ -885,11 +884,11 @@ static void ehci_free_config (struct usb_hcd *hcd, struct usb_device *udev) ...@@ -885,11 +884,11 @@ static void ehci_free_config (struct usb_hcd *hcd, struct usb_device *udev)
*/ */
while (qh->qh_state == QH_STATE_LINKED while (qh->qh_state == QH_STATE_LINKED
&& ehci->reclaim && ehci->reclaim
&& ehci->hcd.state != USB_STATE_HALT && HCD_IS_RUNNING (ehci->hcd.state)
) { ) {
spin_unlock_irqrestore (&ehci->lock, flags); spin_unlock_irqrestore (&ehci->lock, flags);
/* wait_ms() won't spin, we're a thread; /* 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); wait_ms (1);
spin_lock_irqsave (&ehci->lock, flags); spin_lock_irqsave (&ehci->lock, flags);
......
...@@ -315,7 +315,7 @@ static int ehci_hub_control ( ...@@ -315,7 +315,7 @@ static int ehci_hub_control (
wIndex + 1); wIndex + 1);
temp |= PORT_OWNER; temp |= PORT_OWNER;
} else { } else {
ehci_vdbg (ehci, "port %d reset", wIndex + 1); ehci_vdbg (ehci, "port %d reset\n", wIndex + 1);
temp |= PORT_RESET; temp |= PORT_RESET;
temp &= ~PORT_PE; temp &= ~PORT_PE;
......
...@@ -73,8 +73,11 @@ static struct ehci_qtd *ehci_qtd_alloc (struct ehci_hcd *ehci, int flags) ...@@ -73,8 +73,11 @@ static struct ehci_qtd *ehci_qtd_alloc (struct ehci_hcd *ehci, int flags)
dma_addr_t dma; dma_addr_t dma;
qtd = pci_pool_alloc (ehci->qtd_pool, flags, &dma); qtd = pci_pool_alloc (ehci->qtd_pool, flags, &dma);
if (qtd != 0) if (qtd != 0) {
ehci_qtd_init (qtd, dma); ehci_qtd_init (qtd, dma);
if (ehci->async)
qtd->hw_alt_next = ehci->async->hw_alt_next;
}
return qtd; return qtd;
} }
......
...@@ -73,11 +73,6 @@ qtd_fill (struct ehci_qtd *qtd, dma_addr_t buf, size_t len, int token) ...@@ -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->hw_token = cpu_to_le32 ((count << 16) | token);
qtd->length = count; 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; return count;
} }
...@@ -85,11 +80,12 @@ qtd_fill (struct ehci_qtd *qtd, dma_addr_t buf, size_t len, int token) ...@@ -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 */ /* 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_current = 0;
qh->hw_qtd_next = QTD_NEXT (qtd->qtd_dma); 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 */ /* HC must see latest qtd and qh data before we clear ACTIVE+HALT */
wmb (); wmb ();
...@@ -98,7 +94,12 @@ static void qh_update (struct ehci_qh *qh, struct ehci_qtd *qtd) ...@@ -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) */ /* count IN/OUT bytes, not SETUP (even short packets) */
if (likely (QTD_PID (token) != 2)) if (likely (QTD_PID (token) != 2))
...@@ -132,7 +133,7 @@ static inline void qtd_copy_status (struct urb *urb, size_t length, u32 token) ...@@ -132,7 +133,7 @@ static inline void qtd_copy_status (struct urb *urb, size_t length, u32 token)
ehci_vdbg (ehci, ehci_vdbg (ehci,
"dev%d ep%d%s qtd token %08x --> status %d\n", "dev%d ep%d%s qtd token %08x --> status %d\n",
usb_pipedev (urb->pipe), usb_pipedevice (urb->pipe),
usb_pipeendpoint (urb->pipe), usb_pipeendpoint (urb->pipe),
usb_pipein (urb->pipe) ? "in" : "out", usb_pipein (urb->pipe) ? "in" : "out",
token, urb->status); token, urb->status);
...@@ -157,9 +158,17 @@ static inline void qtd_copy_status (struct urb *urb, size_t length, u32 token) ...@@ -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)) { if (likely (urb->hcpriv != 0)) {
struct ehci_qh *qh = (struct ehci_qh *) urb->hcpriv; struct ehci_qh *qh = (struct ehci_qh *) urb->hcpriv;
...@@ -174,24 +183,26 @@ static void ehci_urb_done (struct ehci_hcd *ehci, struct urb *urb) ...@@ -174,24 +183,26 @@ static void ehci_urb_done (struct ehci_hcd *ehci, struct urb *urb)
urb->hcpriv = 0; urb->hcpriv = 0;
} }
if (likely (urb->status == -EINPROGRESS)) { switch (urb->status) {
if (urb->actual_length != urb->transfer_buffer_length case -EINPROGRESS: /* success */
&& (urb->transfer_flags & URB_SHORT_NOT_OK)) urb->status = 0;
urb->status = -EREMOTEIO; default: /* fault */
else COUNT (ehci->stats.complete);
break;
case -EREMOTEIO: /* fault or normal */
if (!(urb->transfer_flags & URB_SHORT_NOT_OK))
urb->status = 0; urb->status = 0;
}
if (likely (urb->status == 0))
COUNT (ehci->stats.complete); COUNT (ehci->stats.complete);
else if (urb->status == -ECONNRESET || urb->status == -ENOENT) break;
case -ECONNRESET: /* canceled */
case -ENOENT:
COUNT (ehci->stats.unlink); COUNT (ehci->stats.unlink);
else break;
COUNT (ehci->stats.error); }
/* complete() can reenter this HCD */ /* complete() can reenter this HCD */
spin_unlock (&ehci->lock); spin_unlock (&ehci->lock);
usb_hcd_giveback_urb (&ehci->hcd, urb, NULL); usb_hcd_giveback_urb (&ehci->hcd, urb, regs);
spin_lock (&ehci->lock); spin_lock (&ehci->lock);
} }
...@@ -203,14 +214,14 @@ static void ehci_urb_done (struct ehci_hcd *ehci, struct urb *urb) ...@@ -203,14 +214,14 @@ static void ehci_urb_done (struct ehci_hcd *ehci, struct urb *urb)
* indicating how much "real" work we did. * indicating how much "real" work we did.
*/ */
static unsigned 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 ehci_qtd *qtd, *last;
struct list_head *next, *qtd_list = &qh->qtd_list; struct list_head *next, *qtd_list = &qh->qtd_list;
int unlink = 0, halted = 0; int unlink = 0, stopped = 0;
unsigned count = 0; unsigned count = 0;
if (unlikely (list_empty (qtd_list))) if (unlikely (list_empty (&qh->qtd_list)))
return count; return count;
/* scan QTDs till end of list, or we reach an active one */ /* scan QTDs till end of list, or we reach an active one */
...@@ -225,7 +236,7 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh) ...@@ -225,7 +236,7 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh)
/* clean up any state from previous QTD ...*/ /* clean up any state from previous QTD ...*/
if (last) { if (last) {
if (likely (last->urb != urb)) { if (likely (last->urb != urb)) {
ehci_urb_done (ehci, last->urb); ehci_urb_done (ehci, last->urb, regs);
count++; count++;
} }
ehci_qtd_free (ehci, last); ehci_qtd_free (ehci, last);
...@@ -236,12 +247,14 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh) ...@@ -236,12 +247,14 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh)
/* QTDs at tail may be active if QH+HC are running, /* QTDs at tail may be active if QH+HC are running,
* or when unlinking some urbs queued to this QH * or when unlinking some urbs queued to this QH
*/ */
rmb ();
token = le32_to_cpu (qtd->hw_token); token = le32_to_cpu (qtd->hw_token);
halted = halted stopped = stopped
|| (qh->qh_state == QH_STATE_IDLE)
|| (__constant_cpu_to_le32 (QTD_STS_HALT) || (__constant_cpu_to_le32 (QTD_STS_HALT)
& qh->hw_token) != 0 & qh->hw_token) != 0
|| (ehci->hcd.state == USB_STATE_HALT) || (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. // FIXME Remove the automagic unlink mode.
// Drivers can now clean up safely; it's their job. // Drivers can now clean up safely; it's their job.
...@@ -257,7 +270,7 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh) ...@@ -257,7 +270,7 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh)
/* status copied below */ /* status copied below */
/* QH halts only because of fault (above) or unlink (here). */ /* 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? */ /* unlinking everything because of HC shutdown? */
if (ehci->hcd.state == USB_STATE_HALT) { if (ehci->hcd.state == USB_STATE_HALT) {
...@@ -293,32 +306,22 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh) ...@@ -293,32 +306,22 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh)
} }
spin_lock (&urb->lock); spin_lock (&urb->lock);
qtd_copy_status (urb, qtd->length, token); qtd_copy_status (ehci, urb, qtd->length, token);
spin_unlock (&urb->lock); spin_unlock (&urb->lock);
list_del (&qtd->qtd_list); 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 */ /* last urb's completion might still need calling */
if (likely (last != 0)) { if (likely (last != 0)) {
ehci_urb_done (ehci, last->urb); ehci_urb_done (ehci, last->urb, regs);
count++; count++;
ehci_qtd_free (ehci, last); ehci_qtd_free (ehci, last);
} }
/* reactivate queue after error and driver's cleanup */ /* reactivate queue after error and driver's cleanup */
if (unlikely (halted && !list_empty (qtd_list))) { if (unlikely (stopped && !list_empty (&qh->qtd_list))) {
qh_update (qh, list_entry (qtd_list->next, qh_update (ehci, qh, list_entry (qh->qtd_list.next,
struct ehci_qtd, qtd_list)); struct ehci_qtd, qtd_list));
} }
...@@ -369,7 +372,6 @@ qh_urb_transaction ( ...@@ -369,7 +372,6 @@ qh_urb_transaction (
qtd = ehci_qtd_alloc (ehci, flags); qtd = ehci_qtd_alloc (ehci, flags);
if (unlikely (!qtd)) if (unlikely (!qtd))
return 0; return 0;
qtd_prev = 0;
list_add_tail (&qtd->qtd_list, head); list_add_tail (&qtd->qtd_list, head);
qtd->urb = urb; qtd->urb = urb;
...@@ -377,6 +379,8 @@ qh_urb_transaction ( ...@@ -377,6 +379,8 @@ qh_urb_transaction (
token |= (EHCI_TUNE_CERR << 10); token |= (EHCI_TUNE_CERR << 10);
/* for split transactions, SplitXState initialized to zero */ /* for split transactions, SplitXState initialized to zero */
len = urb->transfer_buffer_length;
is_input = usb_pipein (urb->pipe);
if (usb_pipecontrol (urb->pipe)) { if (usb_pipecontrol (urb->pipe)) {
/* SETUP pid */ /* SETUP pid */
qtd_fill (qtd, urb->setup_dma, sizeof (struct usb_ctrlrequest), qtd_fill (qtd, urb->setup_dma, sizeof (struct usb_ctrlrequest),
...@@ -392,15 +396,14 @@ qh_urb_transaction ( ...@@ -392,15 +396,14 @@ qh_urb_transaction (
qtd_prev->hw_next = QTD_NEXT (qtd->qtd_dma); qtd_prev->hw_next = QTD_NEXT (qtd->qtd_dma);
list_add_tail (&qtd->qtd_list, head); 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; status_patch = 1;
} }
/* /*
* data transfer stage: buffer setup * data transfer stage: buffer setup
*/ */
len = urb->transfer_buffer_length;
is_input = usb_pipein (urb->pipe);
if (likely (len > 0)) if (likely (len > 0))
buf = urb->transfer_dma; buf = urb->transfer_dma;
else else
...@@ -420,7 +423,6 @@ qh_urb_transaction ( ...@@ -420,7 +423,6 @@ qh_urb_transaction (
for (;;) { for (;;) {
int this_qtd_len; int this_qtd_len;
qtd->urb = urb;
this_qtd_len = qtd_fill (qtd, buf, len, token); this_qtd_len = qtd_fill (qtd, buf, len, token);
len -= this_qtd_len; len -= this_qtd_len;
buf += this_qtd_len; buf += this_qtd_len;
...@@ -578,7 +580,6 @@ ehci_qh_make ( ...@@ -578,7 +580,6 @@ ehci_qh_make (
if (qh->period < 1) { if (qh->period < 1) {
dbg ("intr period %d uframes, NYET!", dbg ("intr period %d uframes, NYET!",
urb->interval); urb->interval);
qh = 0;
goto done; goto done;
} }
} else { } else {
...@@ -639,7 +640,9 @@ ehci_qh_make ( ...@@ -639,7 +640,9 @@ ehci_qh_make (
break; break;
default: default:
dbg ("bogus dev %p speed %d", urb->dev, urb->dev->speed); dbg ("bogus dev %p speed %d", urb->dev, urb->dev->speed);
return 0; done:
qh_put (ehci, qh);
return 0;
} }
/* NOTE: if (PIPE_INTERRUPT) { scheduler sets s-mask } */ /* NOTE: if (PIPE_INTERRUPT) { scheduler sets s-mask } */
...@@ -658,15 +661,13 @@ ehci_qh_make ( ...@@ -658,15 +661,13 @@ ehci_qh_make (
list_splice (qtd_list, &qh->qtd_list); list_splice (qtd_list, &qh->qtd_list);
qtd = list_entry (qtd_list->next, struct ehci_qtd, qtd_list); qtd = list_entry (qtd_list->next, struct ehci_qtd, qtd_list);
qh_update (qh, qtd); qh_update (ehci, qh, qtd);
} else { } else {
qh->hw_qtd_next = qh->hw_alt_next = EHCI_LIST_END; qh->hw_qtd_next = qh->hw_alt_next = EHCI_LIST_END;
} }
/* initialize data toggle state */ /* initialize data toggle state */
clear_toggle (urb->dev, usb_pipeendpoint (urb->pipe), !is_input, qh); clear_toggle (urb->dev, usb_pipeendpoint (urb->pipe), !is_input, qh);
done:
return qh; return qh;
} }
#undef hb_mult #undef hb_mult
...@@ -698,6 +699,8 @@ static void qh_link_async (struct ehci_hcd *ehci, struct ehci_qh *qh) ...@@ -698,6 +699,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 */ /* splice right after start */
qh->qh_next = head->qh_next; qh->qh_next = head->qh_next;
qh->hw_next = head->hw_next; qh->hw_next = head->hw_next;
...@@ -774,8 +777,8 @@ static struct ehci_qh *qh_append_tds ( ...@@ -774,8 +777,8 @@ static struct ehci_qh *qh_append_tds (
*/ */
token = qtd->hw_token; token = qtd->hw_token;
qtd->hw_token = 0; qtd->hw_token = 0;
wmb ();
dummy = qh->dummy; dummy = qh->dummy;
// dbg ("swap td %p with dummy %p", qtd, dummy);
dma = dummy->qtd_dma; dma = dummy->qtd_dma;
*dummy = *qtd; *dummy = *qtd;
...@@ -784,9 +787,11 @@ static struct ehci_qh *qh_append_tds ( ...@@ -784,9 +787,11 @@ static struct ehci_qh *qh_append_tds (
list_add (&dummy->qtd_list, qtd_list); list_add (&dummy->qtd_list, qtd_list);
ehci_qtd_init (qtd, qtd->qtd_dma); ehci_qtd_init (qtd, qtd->qtd_dma);
qtd->hw_alt_next = ehci->async->hw_alt_next;
qh->dummy = qtd; qh->dummy = qtd;
/* hc must see the new dummy at list end */ /* hc must see the new dummy at list end */
dma = qtd->qtd_dma;
qtd = list_entry (qh->qtd_list.prev, qtd = list_entry (qh->qtd_list.prev,
struct ehci_qtd, qtd_list); struct ehci_qtd, qtd_list);
qtd->hw_next = QTD_NEXT (dma); qtd->hw_next = QTD_NEXT (dma);
...@@ -797,15 +802,6 @@ static struct ehci_qh *qh_append_tds ( ...@@ -797,15 +802,6 @@ static struct ehci_qh *qh_append_tds (
/* no URB queued */ /* no URB queued */
} else { } 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 */ /* usb_clear_halt() means qh data toggle gets reset */
if (unlikely (!usb_gettoggle (urb->dev, if (unlikely (!usb_gettoggle (urb->dev,
(epnum & 0x0f), (epnum & 0x0f),
...@@ -813,15 +809,23 @@ static struct ehci_qh *qh_append_tds ( ...@@ -813,15 +809,23 @@ static struct ehci_qh *qh_append_tds (
clear_toggle (urb->dev, clear_toggle (urb->dev,
epnum & 0x0f, !(epnum & 0x10), qh); 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); list_splice (qtd_list, qh->qtd_list.prev);
} else { } else {
/* can't sleep here, we have ehci->lock... */ /* can't sleep here, we have ehci->lock... */
qh = ehci_qh_make (ehci, urb, qtd_list, SLAB_ATOMIC); qh = ehci_qh_make (ehci, urb, qtd_list, SLAB_ATOMIC);
// if (qh) dbg_qh ("new qh", ehci, qh);
*ptr = qh; *ptr = qh;
} }
if (qh) if (qh)
...@@ -877,34 +881,38 @@ submit_async ( ...@@ -877,34 +881,38 @@ submit_async (
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
/* the async qh for the qtds being reclaimed are now unlinked from the HC */ /* 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; struct ehci_qh *qh = ehci->reclaim;
del_timer (&ehci->watchdog); del_timer (&ehci->watchdog);
qh->hw_next = cpu_to_le32 (qh->qh_dma);
qh->qh_state = QH_STATE_IDLE; qh->qh_state = QH_STATE_IDLE;
qh->qh_next.qh = 0; qh->qh_next.qh = 0;
qh_put (ehci, qh); // refcount from reclaim qh_put (ehci, qh); // refcount from reclaim
ehci->reclaim = 0; ehci->reclaim = 0;
ehci->reclaim_ready = 0; ehci->reclaim_ready = 0;
qh_completions (ehci, qh); qh_completions (ehci, qh, regs);
if (!list_empty (&qh->qtd_list) if (!list_empty (&qh->qtd_list)
&& HCD_IS_RUNNING (ehci->hcd.state)) && HCD_IS_RUNNING (ehci->hcd.state))
qh_link_async (ehci, qh); qh_link_async (ehci, qh);
else else {
qh_put (ehci, qh); // refcount from async list 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. * 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_idle = 1; && ehci->async->qh_next.qh == 0
mod_timer (&ehci->watchdog, jiffies + EHCI_ASYNC_JIFFIES); && !timer_pending (&ehci->watchdog)) {
ehci->async_idle = 1;
mod_timer (&ehci->watchdog,
jiffies + EHCI_ASYNC_JIFFIES);
}
} }
} }
...@@ -941,12 +949,6 @@ static void start_unlink_async (struct ehci_hcd *ehci, struct ehci_qh *qh) ...@@ -941,12 +949,6 @@ static void start_unlink_async (struct ehci_hcd *ehci, struct ehci_qh *qh)
qh->qh_state = QH_STATE_UNLINK; qh->qh_state = QH_STATE_UNLINK;
ehci->reclaim = qh = qh_get (qh); 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; prev = ehci->async;
while (prev->qh_next.qh != qh) while (prev->qh_next.qh != qh)
prev = prev->qh_next.qh; prev = prev->qh_next.qh;
...@@ -955,6 +957,11 @@ static void start_unlink_async (struct ehci_hcd *ehci, struct ehci_qh *qh) ...@@ -955,6 +957,11 @@ static void start_unlink_async (struct ehci_hcd *ehci, struct ehci_qh *qh)
prev->qh_next = qh->qh_next; prev->qh_next = qh->qh_next;
wmb (); wmb ();
if (unlikely (ehci->hcd.state == USB_STATE_HALT)) {
end_unlink_async (ehci, NULL);
return;
}
ehci->reclaim_ready = 0; ehci->reclaim_ready = 0;
cmd |= CMD_IAAD; cmd |= CMD_IAAD;
writel (cmd, &ehci->regs->command); writel (cmd, &ehci->regs->command);
...@@ -966,7 +973,7 @@ static void start_unlink_async (struct ehci_hcd *ehci, struct ehci_qh *qh) ...@@ -966,7 +973,7 @@ static void start_unlink_async (struct ehci_hcd *ehci, struct ehci_qh *qh)
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
static void static void
scan_async (struct ehci_hcd *ehci) scan_async (struct ehci_hcd *ehci, struct pt_regs *regs)
{ {
struct ehci_qh *qh; struct ehci_qh *qh;
unsigned count; unsigned count;
...@@ -984,7 +991,7 @@ scan_async (struct ehci_hcd *ehci) ...@@ -984,7 +991,7 @@ scan_async (struct ehci_hcd *ehci)
* reporting drops the lock. * reporting drops the lock.
*/ */
qh = qh_get (qh); qh = qh_get (qh);
temp = qh_completions (ehci, qh); temp = qh_completions (ehci, qh, regs);
qh_put (ehci, qh); qh_put (ehci, qh);
if (temp != 0) { if (temp != 0) {
count += temp; count += temp;
...@@ -1002,14 +1009,6 @@ scan_async (struct ehci_hcd *ehci) ...@@ -1002,14 +1009,6 @@ scan_async (struct ehci_hcd *ehci)
start_unlink_async (ehci, qh); 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; qh = qh->qh_next.qh;
} while (qh); } while (qh);
} }
......
...@@ -190,7 +190,7 @@ static int enable_periodic (struct ehci_hcd *ehci) ...@@ -190,7 +190,7 @@ static int enable_periodic (struct ehci_hcd *ehci)
/* posted write ... PSS happens later */ /* posted write ... PSS happens later */
ehci->hcd.state = USB_STATE_RUNNING; 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->next_uframe = readl (&ehci->regs->frame_index)
% (ehci->periodic_size << 3); % (ehci->periodic_size << 3);
return 0; return 0;
...@@ -495,7 +495,8 @@ static unsigned ...@@ -495,7 +495,8 @@ static unsigned
intr_complete ( intr_complete (
struct ehci_hcd *ehci, struct ehci_hcd *ehci,
unsigned frame, unsigned frame,
struct ehci_qh *qh struct ehci_qh *qh,
struct pt_regs *regs
) { ) {
unsigned count; unsigned count;
...@@ -509,7 +510,7 @@ intr_complete ( ...@@ -509,7 +510,7 @@ intr_complete (
} }
/* handle any completions */ /* handle any completions */
count = qh_completions (ehci, qh); count = qh_completions (ehci, qh, regs);
if (unlikely (list_empty (&qh->qtd_list))) if (unlikely (list_empty (&qh->qtd_list)))
intr_deschedule (ehci, qh, 0); intr_deschedule (ehci, qh, 0);
...@@ -867,7 +868,8 @@ static unsigned ...@@ -867,7 +868,8 @@ static unsigned
itd_complete ( itd_complete (
struct ehci_hcd *ehci, struct ehci_hcd *ehci,
struct ehci_itd *itd, struct ehci_itd *itd,
unsigned uframe unsigned uframe,
struct pt_regs *regs
) { ) {
struct urb *urb = itd->urb; struct urb *urb = itd->urb;
struct usb_iso_packet_descriptor *desc; struct usb_iso_packet_descriptor *desc;
...@@ -922,7 +924,7 @@ itd_complete ( ...@@ -922,7 +924,7 @@ itd_complete (
/* complete() can reenter this HCD */ /* complete() can reenter this HCD */
spin_unlock (&ehci->lock); spin_unlock (&ehci->lock);
usb_hcd_giveback_urb (&ehci->hcd, urb, NULL); usb_hcd_giveback_urb (&ehci->hcd, urb, regs);
spin_lock (&ehci->lock); spin_lock (&ehci->lock);
/* defer stopping schedule; completion can submit */ /* defer stopping schedule; completion can submit */
...@@ -973,7 +975,7 @@ static int itd_submit (struct ehci_hcd *ehci, struct urb *urb, int mem_flags) ...@@ -973,7 +975,7 @@ static int itd_submit (struct ehci_hcd *ehci, struct urb *urb, int mem_flags)
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
static void 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 frame, clock, now_uframe, mod;
unsigned count = 0; unsigned count = 0;
...@@ -999,14 +1001,6 @@ scan_periodic (struct ehci_hcd *ehci) ...@@ -999,14 +1001,6 @@ scan_periodic (struct ehci_hcd *ehci)
u32 type, *hw_p; u32 type, *hw_p;
unsigned uframes; 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: restart:
/* scan schedule to _before_ current frame index */ /* scan schedule to _before_ current frame index */
if (frame == clock) if (frame == clock)
...@@ -1031,7 +1025,7 @@ scan_periodic (struct ehci_hcd *ehci) ...@@ -1031,7 +1025,7 @@ scan_periodic (struct ehci_hcd *ehci)
temp = q.qh->qh_next; temp = q.qh->qh_next;
type = Q_NEXT_TYPE (q.qh->hw_next); type = Q_NEXT_TYPE (q.qh->hw_next);
count += intr_complete (ehci, frame, count += intr_complete (ehci, frame,
qh_get (q.qh)); qh_get (q.qh), regs);
qh_put (ehci, q.qh); qh_put (ehci, q.qh);
q = temp; q = temp;
break; break;
...@@ -1064,7 +1058,7 @@ scan_periodic (struct ehci_hcd *ehci) ...@@ -1064,7 +1058,7 @@ scan_periodic (struct ehci_hcd *ehci)
/* might free q.itd ... */ /* might free q.itd ... */
count += itd_complete (ehci, count += itd_complete (ehci,
temp.itd, uf); temp.itd, uf, regs);
break; break;
} }
} }
......
...@@ -65,9 +65,6 @@ struct ehci_hcd { /* one per controller */ ...@@ -65,9 +65,6 @@ struct ehci_hcd { /* one per controller */
int next_uframe; /* scan periodic, start here */ int next_uframe; /* scan periodic, start here */
unsigned periodic_sched; /* periodic activity count */ unsigned periodic_sched; /* periodic activity count */
/* deferred work from IRQ, etc */
struct tasklet_struct tasklet;
/* per root hub port */ /* per root hub port */
unsigned long reset_done [EHCI_MAX_ROOT_PORTS]; unsigned long reset_done [EHCI_MAX_ROOT_PORTS];
......
...@@ -87,7 +87,7 @@ typedef struct { ...@@ -87,7 +87,7 @@ typedef struct {
} ibmcam_t; } ibmcam_t;
#define IBMCAM_T(uvd) ((ibmcam_t *)((uvd)->user_data)) #define IBMCAM_T(uvd) ((ibmcam_t *)((uvd)->user_data))
usbvideo_t *cams = NULL; struct usbvideo *cams = NULL;
static int debug = 0; static int debug = 0;
...@@ -249,7 +249,7 @@ static videosize_t ibmcam_size_to_videosize(int size) ...@@ -249,7 +249,7 @@ static videosize_t ibmcam_size_to_videosize(int size)
* History: * History:
* 1/21/00 Created. * 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; struct usbvideo_frame *frame;
ibmcam_t *icam; ibmcam_t *icam;
...@@ -397,7 +397,7 @@ case IBMCAM_MODEL_4: ...@@ -397,7 +397,7 @@ case IBMCAM_MODEL_4:
* 21-Jan-2000 Created. * 21-Jan-2000 Created.
* 12-Oct-2000 Reworked to reflect interlaced nature of the data. * 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 uvd *uvd,
struct usbvideo_frame *frame, struct usbvideo_frame *frame,
long *pcopylen) long *pcopylen)
...@@ -662,7 +662,7 @@ static ParseState_t ibmcam_parse_lines( ...@@ -662,7 +662,7 @@ static ParseState_t ibmcam_parse_lines(
* them both as R component in attempt to at least partially recover the * them both as R component in attempt to at least partially recover the
* lost resolution. * lost resolution.
*/ */
static ParseState_t ibmcam_model2_320x240_parse_lines( static enum ParseState ibmcam_model2_320x240_parse_lines(
struct uvd *uvd, struct uvd *uvd,
struct usbvideo_frame *frame, struct usbvideo_frame *frame,
long *pcopylen) long *pcopylen)
...@@ -816,7 +816,7 @@ static ParseState_t ibmcam_model2_320x240_parse_lines( ...@@ -816,7 +816,7 @@ static ParseState_t ibmcam_model2_320x240_parse_lines(
return scan_Continue; return scan_Continue;
} }
static ParseState_t ibmcam_model3_parse_lines( static enum ParseState ibmcam_model3_parse_lines(
struct uvd *uvd, struct uvd *uvd,
struct usbvideo_frame *frame, struct usbvideo_frame *frame,
long *pcopylen) long *pcopylen)
...@@ -961,7 +961,7 @@ static ParseState_t ibmcam_model3_parse_lines( ...@@ -961,7 +961,7 @@ static ParseState_t ibmcam_model3_parse_lines(
* History: * History:
* 10-Feb-2001 Created. * 10-Feb-2001 Created.
*/ */
static ParseState_t ibmcam_model4_128x96_parse_lines( static enum ParseState ibmcam_model4_128x96_parse_lines(
struct uvd *uvd, struct uvd *uvd,
struct usbvideo_frame *frame, struct usbvideo_frame *frame,
long *pcopylen) long *pcopylen)
...@@ -1051,7 +1051,7 @@ static ParseState_t ibmcam_model4_128x96_parse_lines( ...@@ -1051,7 +1051,7 @@ static ParseState_t ibmcam_model4_128x96_parse_lines(
*/ */
void ibmcam_ProcessIsocData(struct uvd *uvd, struct usbvideo_frame *frame) void ibmcam_ProcessIsocData(struct uvd *uvd, struct usbvideo_frame *frame)
{ {
ParseState_t newstate; enum ParseState newstate;
long copylen = 0; long copylen = 0;
int mod = IBMCAM_T(uvd)->camera_model; int mod = IBMCAM_T(uvd)->camera_model;
......
...@@ -51,7 +51,7 @@ enum frame_sizes { ...@@ -51,7 +51,7 @@ enum frame_sizes {
#define MAX_FRAME_SIZE SIZE_320X240 #define MAX_FRAME_SIZE SIZE_320X240
static usbvideo_t *cams; static struct usbvideo *cams;
#ifdef CONFIG_USB_DEBUG #ifdef CONFIG_USB_DEBUG
static int debug; static int debug;
......
...@@ -446,8 +446,8 @@ int pwc_set_video_mode(struct pwc_device *pdev, int width, int height, int frame ...@@ -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); Info("Video mode %s@%d fps is only supported with the decompressor module (pwcx).\n", size2name[size], frames);
else { else {
Err("Failed to set video mode %s@%d fps; return code = %d\n", size2name[size], frames, ret); 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.x = width;
pdev->view.y = height; pdev->view.y = height;
...@@ -1534,7 +1534,15 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) ...@@ -1534,7 +1534,15 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg)
*dynnoise = ret; *dynnoise = ret;
break; break;
} }
case VIDIOCPWCGREALSIZE:
{
struct pwc_imagesize *size = arg;
size->width = pdev->image.x;
size->height = pdev->image.y;
break;
}
default: default:
ret = -ENOIOCTLCMD; ret = -ENOIOCTLCMD;
......
...@@ -77,7 +77,7 @@ static struct usb_device_id pwc_device_table [] = { ...@@ -77,7 +77,7 @@ static struct usb_device_id pwc_device_table [] = {
{ USB_DEVICE(0x0471, 0x0312) }, { USB_DEVICE(0x0471, 0x0312) },
{ USB_DEVICE(0x069A, 0x0001) }, /* Askey */ { USB_DEVICE(0x069A, 0x0001) }, /* Askey */
{ USB_DEVICE(0x046D, 0x08b0) }, /* Logitech QuickCam Pro 3000 */ { 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, 0x08b2) }, /* Logitech QuickCam Pro 4000 */
{ USB_DEVICE(0x046D, 0x08b3) }, /* Logitech QuickCam Zoom */ { USB_DEVICE(0x046D, 0x08b3) }, /* Logitech QuickCam Zoom */
{ USB_DEVICE(0x055D, 0x9000) }, /* Samsung */ { USB_DEVICE(0x055D, 0x9000) }, /* Samsung */
...@@ -992,7 +992,7 @@ static int pwc_video_open(struct inode *inode, struct file *file) ...@@ -992,7 +992,7 @@ static int pwc_video_open(struct inode *inode, struct file *file)
case 0x40: sensor_type = "UPA 1021 sensor"; break; case 0x40: sensor_type = "UPA 1021 sensor"; break;
case 0x100: sensor_type = "VGA sensor"; break; case 0x100: sensor_type = "VGA sensor"; break;
case 0x101: sensor_type = "PAL MR sensor"; break; case 0x101: sensor_type = "PAL MR sensor"; break;
default: sensor_type = "unknown type of sensor"; break; default: sensor_type = "unknown type of sensor"; break;
} }
if (sensor_type != NULL) if (sensor_type != NULL)
Info("This %s camera is equipped with a %s (%d).\n", pdev->vdev->name, sensor_type, i); Info("This %s camera is equipped with a %s (%d).\n", pdev->vdev->name, sensor_type, i);
...@@ -1064,7 +1064,6 @@ static int pwc_video_open(struct inode *inode, struct file *file) ...@@ -1064,7 +1064,6 @@ static int pwc_video_open(struct inode *inode, struct file *file)
i = pwc_isoc_init(pdev); i = pwc_isoc_init(pdev);
if (i) { if (i) {
Trace(TRACE_OPEN, "Failed to init ISOC stuff = %d.\n", i); Trace(TRACE_OPEN, "Failed to init ISOC stuff = %d.\n", i);
MOD_DEC_USE_COUNT;
up(&pdev->modlock); up(&pdev->modlock);
return i; return i;
} }
...@@ -1689,8 +1688,8 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id ...@@ -1689,8 +1688,8 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id
type_id = 730; type_id = 730;
break; break;
case 0x08b1: case 0x08b1:
Info("Logitech QuickCam for Noteboos USB webcam detected.\n"); Info("Logitech QuickCam Notebook Pro USB webcam detected.\n");
name = "Logitech QuickCam Notebook"; name = "Logitech QuickCam Notebook Pro";
type_id = 740; /* ?? unknown sensor */ type_id = 740; /* ?? unknown sensor */
break; break;
case 0x08b2: case 0x08b2:
......
...@@ -18,12 +18,13 @@ ...@@ -18,12 +18,13 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 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 Changes
2001/08/03 Alvarado Added ioctl constants to access methods for 2001/08/03 Alvarado Added ioctl constants to access methods for
changing white balance and red/blue gains 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. /* These are private ioctl() commands, specific for the Philips webcams.
...@@ -104,7 +105,12 @@ struct pwc_leds ...@@ -104,7 +105,12 @@ struct pwc_leds
int led_off; /* Led off-time; range = 0..25000 */ int led_off; /* Led off-time; range = 0..25000 */
}; };
/* Image size (used with GREALSIZE) */
struct pwc_imagesize
{
int width;
int height;
};
/* Restore user settings */ /* Restore user settings */
#define VIDIOCPWCRUSER _IO('v', 192) #define VIDIOCPWCRUSER _IO('v', 192)
...@@ -173,4 +179,7 @@ struct pwc_leds ...@@ -173,4 +179,7 @@ struct pwc_leds
#define VIDIOCPWCSDYNNOISE _IOW('v', 209, int) #define VIDIOCPWCSDYNNOISE _IOW('v', 209, int)
#define VIDIOCPWCGDYNNOISE _IOR('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 #endif
...@@ -20,8 +20,8 @@ ...@@ -20,8 +20,8 @@
significant change should be reflected by increasing the significant change should be reflected by increasing the
pwc_decompressor_version major number. pwc_decompressor_version major number.
*/ */
#ifndef PWC_DEC_H #ifndef PWC_UNCOMPRESS_H
#define PWC_DEC_H #define PWC_UNCOMPRESS_H
#include <linux/config.h> #include <linux/config.h>
#include <linux/list.h> #include <linux/list.h>
......
...@@ -60,8 +60,8 @@ ...@@ -60,8 +60,8 @@
/* Version block */ /* Version block */
#define PWC_MAJOR 8 #define PWC_MAJOR 8
#define PWC_MINOR 9 #define PWC_MINOR 10
#define PWC_VERSION "8.9" #define PWC_VERSION "8.10"
#define PWC_NAME "pwc" #define PWC_NAME "pwc"
/* Turn certain features on/off */ /* Turn certain features on/off */
......
...@@ -25,7 +25,7 @@ typedef struct { ...@@ -25,7 +25,7 @@ typedef struct {
} ultracam_t; } ultracam_t;
#define ULTRACAM_T(uvd) ((ultracam_t *)((uvd)->user_data)) #define ULTRACAM_T(uvd) ((ultracam_t *)((uvd)->user_data))
static usbvideo_t *cams = NULL; static struct usbvideo *cams = NULL;
static int debug = 0; static int debug = 0;
......
...@@ -42,8 +42,8 @@ MODULE_PARM(video_nr, "i"); ...@@ -42,8 +42,8 @@ MODULE_PARM(video_nr, "i");
* Local prototypes. * Local prototypes.
*/ */
#if USES_PROC_FS #if USES_PROC_FS
static void usbvideo_procfs_level1_create(usbvideo_t *ut); static void usbvideo_procfs_level1_create(struct usbvideo *ut);
static void usbvideo_procfs_level1_destroy(usbvideo_t *ut); static void usbvideo_procfs_level1_destroy(struct usbvideo *ut);
static void usbvideo_procfs_level2_create(struct uvd *uvd); static void usbvideo_procfs_level2_create(struct uvd *uvd);
static void usbvideo_procfs_level2_destroy(struct uvd *uvd); static void usbvideo_procfs_level2_destroy(struct uvd *uvd);
static int usbvideo_default_procfs_read_proc( static int usbvideo_default_procfs_read_proc(
...@@ -765,7 +765,7 @@ static void usbvideo_ClientDecModCount(struct uvd *uvd) ...@@ -765,7 +765,7 @@ static void usbvideo_ClientDecModCount(struct uvd *uvd)
} }
int usbvideo_register( int usbvideo_register(
usbvideo_t **pCams, struct usbvideo **pCams,
const int num_cams, const int num_cams,
const int num_extra, const int num_extra,
const char *driverName, const char *driverName,
...@@ -773,7 +773,7 @@ int usbvideo_register( ...@@ -773,7 +773,7 @@ int usbvideo_register(
struct module *md, struct module *md,
const struct usb_device_id *id_table) const struct usb_device_id *id_table)
{ {
usbvideo_t *cams; struct usbvideo *cams;
int i, base_size; int i, base_size;
/* Check parameters for sanity */ /* Check parameters for sanity */
...@@ -788,10 +788,10 @@ int usbvideo_register( ...@@ -788,10 +788,10 @@ int usbvideo_register(
return -EINVAL; return -EINVAL;
} }
base_size = num_cams * sizeof(struct uvd) + sizeof(usbvideo_t); base_size = num_cams * sizeof(struct uvd) + sizeof(struct usbvideo);
cams = (usbvideo_t *) kmalloc(base_size, GFP_KERNEL); cams = (struct usbvideo *) kmalloc(base_size, GFP_KERNEL);
if (cams == NULL) { 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; return -ENOMEM;
} }
dbg("%s: Allocated $%p (%d. bytes) for %d. cameras", dbg("%s: Allocated $%p (%d. bytes) for %d. cameras",
...@@ -823,7 +823,7 @@ int usbvideo_register( ...@@ -823,7 +823,7 @@ int usbvideo_register(
#else /* !USES_PROC_FS */ #else /* !USES_PROC_FS */
/* Report a warning so that user knows why there is no /proc entries */ /* Report a warning so that user knows why there is no /proc entries */
if ((cams->cb.procfs_read != NULL) || (cams->cb.procfs_write == NULL)) { 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 #endif
cams->num_cameras = num_cams; cams->num_cameras = num_cams;
...@@ -889,9 +889,9 @@ EXPORT_SYMBOL(usbvideo_register); ...@@ -889,9 +889,9 @@ EXPORT_SYMBOL(usbvideo_register);
* if you had some dynamically allocated components in ->user field then * if you had some dynamically allocated components in ->user field then
* you should free them before calling here. * 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; int i;
if (pCams == NULL) { if (pCams == NULL) {
...@@ -1049,12 +1049,12 @@ static void usbvideo_CameraRelease(struct uvd *uvd) ...@@ -1049,12 +1049,12 @@ static void usbvideo_CameraRelease(struct uvd *uvd)
* History: * History:
* 27-Jan-2000 Created. * 27-Jan-2000 Created.
*/ */
static int usbvideo_find_struct(usbvideo_t *cams) static int usbvideo_find_struct(struct usbvideo *cams)
{ {
int u, rv = -1; int u, rv = -1;
if (cams == NULL) { if (cams == NULL) {
err("No usbvideo_t handle?"); err("No usbvideo handle?");
return -1; return -1;
} }
down(&cams->lock); down(&cams->lock);
...@@ -1089,13 +1089,13 @@ static struct video_device usbvideo_template = { ...@@ -1089,13 +1089,13 @@ static struct video_device usbvideo_template = {
.fops = &usbvideo_fops, .fops = &usbvideo_fops,
}; };
struct uvd *usbvideo_AllocateDevice(usbvideo_t *cams) struct uvd *usbvideo_AllocateDevice(struct usbvideo *cams)
{ {
int i, devnum; int i, devnum;
struct uvd *uvd = NULL; struct uvd *uvd = NULL;
if (cams == NULL) { if (cams == NULL) {
err("No usbvideo_t handle?"); err("No usbvideo handle?");
return NULL; return NULL;
} }
...@@ -2357,7 +2357,7 @@ static void usbvideo_SoftwareContrastAdjustment(struct uvd *uvd, ...@@ -2357,7 +2357,7 @@ static void usbvideo_SoftwareContrastAdjustment(struct uvd *uvd,
extern struct proc_dir_entry *video_proc_entry; 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) { if (ut == NULL) {
err("%s: ut == NULL", __FUNCTION__); err("%s: ut == NULL", __FUNCTION__);
...@@ -2376,7 +2376,7 @@ static void usbvideo_procfs_level1_create(usbvideo_t *ut) ...@@ -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) { if (ut == NULL) {
err("%s: ut == NULL", __FUNCTION__); err("%s: ut == NULL", __FUNCTION__);
......
...@@ -126,37 +126,37 @@ struct RingQueue { ...@@ -126,37 +126,37 @@ struct RingQueue {
wait_queue_head_t wqh; /* Processes waiting */ wait_queue_head_t wqh; /* Processes waiting */
}; };
typedef enum { enum ScanState {
ScanState_Scanning, /* Scanning for header */ ScanState_Scanning, /* Scanning for header */
ScanState_Lines /* Parsing lines */ ScanState_Lines /* Parsing lines */
} ScanState_t; };
/* Completion states of the data parser */ /* Completion states of the data parser */
typedef enum { enum ParseState {
scan_Continue, /* Just parse next item */ scan_Continue, /* Just parse next item */
scan_NextFrame, /* Frame done, send it to V4L */ scan_NextFrame, /* Frame done, send it to V4L */
scan_Out, /* Not enough data for frame */ scan_Out, /* Not enough data for frame */
scan_EndParse /* End parsing */ scan_EndParse /* End parsing */
} ParseState_t; };
typedef enum { enum FrameState {
FrameState_Unused, /* Unused (no MCAPTURE) */ FrameState_Unused, /* Unused (no MCAPTURE) */
FrameState_Ready, /* Ready to start grabbing */ FrameState_Ready, /* Ready to start grabbing */
FrameState_Grabbing, /* In the process of being grabbed into */ FrameState_Grabbing, /* In the process of being grabbed into */
FrameState_Done, /* Finished grabbing, but not been synced yet */ FrameState_Done, /* Finished grabbing, but not been synced yet */
FrameState_Done_Hold, /* Are syncing or reading */ FrameState_Done_Hold, /* Are syncing or reading */
FrameState_Error, /* Something bad happened while processing */ FrameState_Error, /* Something bad happened while processing */
} FrameState_t; };
/* /*
* Some frames may contain only even or odd lines. This type * Some frames may contain only even or odd lines. This type
* specifies what type of deinterlacing is required. * specifies what type of deinterlacing is required.
*/ */
typedef enum { enum Deinterlace {
Deinterlace_None=0, Deinterlace_None=0,
Deinterlace_FillOddLines, Deinterlace_FillOddLines,
Deinterlace_FillEvenLines Deinterlace_FillEvenLines
} Deinterlace_t; };
#define USBVIDEO_NUMFRAMES 2 /* How many frames we work with */ #define USBVIDEO_NUMFRAMES 2 /* How many frames we work with */
#define USBVIDEO_NUMSBUF 2 /* How many URBs linked in a ring */ #define USBVIDEO_NUMSBUF 2 /* How many URBs linked in a ring */
...@@ -175,9 +175,9 @@ struct usbvideo_frame { ...@@ -175,9 +175,9 @@ struct usbvideo_frame {
videosize_t request; /* That's what the application asked for */ videosize_t request; /* That's what the application asked for */
unsigned short palette; /* The desired format */ unsigned short palette; /* The desired format */
FrameState_t frameState;/* State of grabbing */ enum FrameState frameState;/* State of grabbing */
ScanState_t scanstate; /* State of scanning */ enum ScanState scanstate; /* State of scanning */
Deinterlace_t deinterlace; enum Deinterlace deinterlace;
int flags; /* USBVIDEO_FRAME_FLAG_xxx bit flags */ int flags; /* USBVIDEO_FRAME_FLAG_xxx bit flags */
int curline; /* Line of frame we're working on */ int curline; /* Line of frame we're working on */
...@@ -199,12 +199,12 @@ struct usbvideo_statistics { ...@@ -199,12 +199,12 @@ struct usbvideo_statistics {
unsigned long iso_err_count; /* How many bad ISO packets received */ unsigned long iso_err_count; /* How many bad ISO packets received */
}; };
struct s_usbvideo_t; struct usbvideo;
struct uvd { struct uvd {
struct video_device vdev; /* Must be the first field! */ struct video_device vdev; /* Must be the first field! */
struct usb_device *dev; 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 */ void *user_data; /* Camera-dependent data */
int user_size; /* Size of that camera-dependent data */ int user_size; /* Size of that camera-dependent data */
int debug; /* Debug level for usbvideo */ int debug; /* Debug level for usbvideo */
...@@ -273,7 +273,7 @@ struct usbvideo_cb { ...@@ -273,7 +273,7 @@ struct usbvideo_cb {
int (*setVideoMode)(struct uvd *uvd, struct video_window *vw); int (*setVideoMode)(struct uvd *uvd, struct video_window *vw);
}; };
struct s_usbvideo_t { struct usbvideo {
int num_cameras; /* As allocated */ int num_cameras; /* As allocated */
struct usb_driver usbdrv; /* Interface to the USB stack */ struct usb_driver usbdrv; /* Interface to the USB stack */
char drvName[80]; /* Driver name */ char drvName[80]; /* Driver name */
...@@ -285,7 +285,7 @@ struct s_usbvideo_t { ...@@ -285,7 +285,7 @@ struct s_usbvideo_t {
struct proc_dir_entry *procfs_dEntry; /* /proc/video/MYDRIVER */ struct proc_dir_entry *procfs_dEntry; /* /proc/video/MYDRIVER */
struct module *md_module; /* Minidriver module */ struct module *md_module; /* Minidriver module */
}; };
typedef struct s_usbvideo_t usbvideo_t;
/* /*
* This macro retrieves callback address from the struct uvd object. * This macro retrieves callback address from the struct uvd object.
...@@ -332,16 +332,16 @@ void usbvideo_TestPattern(struct uvd *uvd, int fullframe, int pmode); ...@@ -332,16 +332,16 @@ void usbvideo_TestPattern(struct uvd *uvd, int fullframe, int pmode);
unsigned long usbvideo_kvirt_to_pa(unsigned long adr); unsigned long usbvideo_kvirt_to_pa(unsigned long adr);
int usbvideo_register( int usbvideo_register(
usbvideo_t **pCams, struct usbvideo **pCams,
const int num_cams, const int num_cams,
const int num_extra, const int num_extra,
const char *driverName, const char *driverName,
const struct usbvideo_cb *cbTable, const struct usbvideo_cb *cbTable,
struct module *md, struct module *md,
const struct usb_device_id *id_table); 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); 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); int usbvideo_v4l_initialize(struct video_device *dev);
......
...@@ -144,8 +144,9 @@ struct udsl_instance_data *minor_data[MAX_UDSL]; ...@@ -144,8 +144,9 @@ struct udsl_instance_data *minor_data[MAX_UDSL];
static const char udsl_driver_name[] = "Alcatel SpeedTouch USB"; static const char udsl_driver_name[] = "Alcatel SpeedTouch USB";
/* data thread */ /* data thread */
static int datapid = 0;
DECLARE_WAIT_QUEUE_HEAD (udsl_wqh); DECLARE_WAIT_QUEUE_HEAD (udsl_wqh);
static DECLARE_COMPLETION(thread_grave);
static unsigned int datapid;
#ifdef DEBUG_PACKET #ifdef DEBUG_PACKET
int udsl_print_packet (const unsigned char *data, int len); int udsl_print_packet (const unsigned char *data, int len);
...@@ -431,21 +432,36 @@ int udsl_atm_processqueue_thread (void *data) ...@@ -431,21 +432,36 @@ int udsl_atm_processqueue_thread (void *data)
strcpy (current->comm, "kSpeedSARd"); strcpy (current->comm, "kSpeedSARd");
add_wait_queue (&udsl_wqh, &wait); add_wait_queue (&udsl_wqh, &wait);
set_current_state(TASK_INTERRUPTIBLE);
for (;;) { for (;;) {
interruptible_sleep_on (&udsl_wqh); schedule();
if (signal_pending (current)) if (signal_pending (current))
break; break;
PDEBUG ("SpeedSARd awoke\n"); PDEBUG ("SpeedSARd awoke\n");
retry:
for (i = 0; i < MAX_UDSL; i++) for (i = 0; i < MAX_UDSL; i++)
if (minor_data[i]) if (minor_data[i])
udsl_atm_processqueue (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); remove_wait_queue (&udsl_wqh, &wait);
datapid = 0;
PDEBUG ("SpeedSARd is exiting\n"); 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) ...@@ -461,16 +477,7 @@ void udsl_atm_sar_stop (void)
/* Kill the thread */ /* Kill the thread */
ret = kill_proc (datapid, SIGTERM, 1); ret = kill_proc (datapid, SIGTERM, 1);
if (!ret) { if (!ret) {
/* Wait 10 seconds */ wait_for_completion(&thread_grave);
int count = 10 * 100;
while (datapid && --count) {
current->state = TASK_INTERRUPTIBLE;
schedule_timeout (1);
}
if (!count)
err ("giving up on killing SpeedSAR thread.");
} }
} }
...@@ -598,7 +605,7 @@ static void udsl_usb_send_data_complete (struct urb *urb, struct pt_regs *regs) ...@@ -598,7 +605,7 @@ static void udsl_usb_send_data_complete (struct urb *urb, struct pt_regs *regs)
(unsigned char *) ctx->skb->data, (unsigned char *) ctx->skb->data,
ctx->skb->len, udsl_usb_send_data_complete, ctx); 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", PDEBUG ("udsl_usb_send_data_completion (send packet %p with length %d), retval = %d\n",
ctx->skb, ctx->skb->len, err); ctx->skb, ctx->skb->len, err);
...@@ -747,7 +754,7 @@ void udsl_usb_data_receive (struct urb *urb, struct pt_regs *regs) ...@@ -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), usb_rcvbulkpipe (instance->usb_dev, UDSL_ENDPOINT_DATA_IN),
(unsigned char *) ctx->skb->data, (unsigned char *) ctx->skb->data,
UDSL_RECEIVE_BUFFER_SIZE, udsl_usb_data_receive, ctx); UDSL_RECEIVE_BUFFER_SIZE, udsl_usb_data_receive, ctx);
usb_submit_urb (urb, GFP_KERNEL); usb_submit_urb (urb, GFP_ATOMIC);
return; return;
}; };
...@@ -845,8 +852,7 @@ static int udsl_usb_data_exit (struct udsl_instance_data *instance) ...@@ -845,8 +852,7 @@ static int udsl_usb_data_exit (struct udsl_instance_data *instance)
if ((!ctx->urb) || (!ctx->skb)) if ((!ctx->urb) || (!ctx->skb))
continue; continue;
if (ctx->urb->status == -EINPROGRESS) usb_unlink_urb (ctx->urb);
usb_unlink_urb (ctx->urb);
usb_free_urb (ctx->urb); usb_free_urb (ctx->urb);
kfree_skb (ctx->skb); kfree_skb (ctx->skb);
...@@ -856,8 +862,7 @@ static int udsl_usb_data_exit (struct udsl_instance_data *instance) ...@@ -856,8 +862,7 @@ static int udsl_usb_data_exit (struct udsl_instance_data *instance)
for (i = 0; i < UDSL_NUMBER_SND_URBS; i++) { for (i = 0; i < UDSL_NUMBER_SND_URBS; i++) {
struct udsl_usb_send_data_context *ctx = &(instance->send_ctx[i]); struct udsl_usb_send_data_context *ctx = &(instance->send_ctx[i]);
if (ctx->urb->status == -EINPROGRESS) usb_unlink_urb (ctx->urb);
usb_unlink_urb (ctx->urb);
if (ctx->skb) if (ctx->skb)
ctx->vcc->pop (ctx->vcc, ctx->skb); ctx->vcc->pop (ctx->vcc, ctx->skb);
......
...@@ -98,7 +98,7 @@ ioctl_lcd(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -98,7 +98,7 @@ ioctl_lcd(struct inode *inode, struct file *file, unsigned int cmd,
return -EFAULT; return -EFAULT;
break; break;
default: default:
return -ENOIOCTLCMD; return -ENOTTY;
break; break;
} }
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
* - GeneSys GL620USB-A * - GeneSys GL620USB-A
* - NetChip 1080 (interoperates with NetChip Win32 drivers) * - NetChip 1080 (interoperates with NetChip Win32 drivers)
* - Prolific PL-2301/2302 (replaces "plusb" driver) * - 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 * USB devices can implement their side of this protocol at the cost
* of two bulk endpoints; it's not restricted to "cable" applications. * of two bulk endpoints; it's not restricted to "cable" applications.
...@@ -61,8 +61,9 @@ ...@@ -61,8 +61,9 @@
* sheets, sometimes it's not needed and sometimes it hangs. Prolific has * sheets, sometimes it's not needed and sometimes it hangs. Prolific has
* not responded to repeated support/information requests. * not responded to repeated support/information requests.
* *
* - SA-1100 PDAs ... the www.handhelds.org SA-1100 support works nicely. * - SA-1100 PDAs ... the standard ARM Linux SA-1100 support works nicely,
* Zaurus support has some problems; it's made UHCI die. * 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. * Interop with more Win32 drivers may be a good thing.
* *
...@@ -116,7 +117,10 @@ ...@@ -116,7 +117,10 @@
* 07-may-2002 Generalize/cleanup keventd support, handling rx stalls (mostly * 07-may-2002 Generalize/cleanup keventd support, handling rx stalls (mostly
* for USB 2.0 TTs) and memory shortages (potential) too. (db) * for USB 2.0 TTs) and memory shortages (potential) too. (db)
* Use "locally assigned" IEEE802 address space. (Brad Hards) * Use "locally assigned" IEEE802 address space. (Brad Hards)
* 18-oct-2002 Support for Zaurus (Pavel Machek), related cleanup (db). * 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 @@ ...@@ -150,7 +154,8 @@
#define CONFIG_USB_GENESYS #define CONFIG_USB_GENESYS
#define CONFIG_USB_NET1080 #define CONFIG_USB_NET1080
#define CONFIG_USB_PL2301 #define CONFIG_USB_PL2301
#define CONFIG_USB_SA1110 // #define CONFIG_USB_PXA
#define CONFIG_USB_SA1100
#define CONFIG_USB_ZAURUS #define CONFIG_USB_ZAURUS
...@@ -162,6 +167,8 @@ ...@@ -162,6 +167,8 @@
* Nineteen USB 1.1 max size bulk transactions per frame (ms), max. * Nineteen USB 1.1 max size bulk transactions per frame (ms), max.
* Several dozen bytes of IPv4 data can fit in two such transactions. * Several dozen bytes of IPv4 data can fit in two such transactions.
* One maximum size Ethernet packet takes twenty four of them. * 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 #ifdef REALLY_QUEUE
#define RX_QLEN 4 #define RX_QLEN 4
...@@ -233,6 +240,7 @@ struct driver_info { ...@@ -233,6 +240,7 @@ struct driver_info {
int flags; int flags;
#define FLAG_FRAMING_NC 0x0001 /* guard against device dropouts */ #define FLAG_FRAMING_NC 0x0001 /* guard against device dropouts */
#define FLAG_FRAMING_GL 0x0002 /* genelink batches packets */ #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() */ #define FLAG_NO_SETINT 0x0010 /* device can't set_interface() */
/* reset device ... can sleep */ /* reset device ... can sleep */
...@@ -287,6 +295,12 @@ MODULE_PARM_DESC (msg_level, "Initial message level (default = 1)"); ...@@ -287,6 +295,12 @@ MODULE_PARM_DESC (msg_level, "Initial message level (default = 1)");
#define RUN_CONTEXT (in_irq () ? "in_irq" \ #define RUN_CONTEXT (in_irq () ? "in_irq" \
: (in_interrupt () ? "in_interrupt" : "can sleep")) : (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 #ifdef DEBUG
...@@ -364,6 +378,7 @@ static const struct driver_info belkin_info = { ...@@ -364,6 +378,7 @@ static const struct driver_info belkin_info = {
static const struct driver_info epson2888_info = { static const struct driver_info epson2888_info = {
.description = "Epson USB Device", .description = "Epson USB Device",
.check_connect = always_connected,
.in = 4, .out = 3, .in = 4, .out = 3,
.epsize = 64, .epsize = 64,
...@@ -457,10 +472,12 @@ static void gl_interrupt_complete (struct urb *urb, struct pt_regs *regs) ...@@ -457,10 +472,12 @@ static void gl_interrupt_complete (struct urb *urb, struct pt_regs *regs)
case -ENOENT: case -ENOENT:
case -ESHUTDOWN: case -ESHUTDOWN:
/* this urb is terminated, clean up */ /* 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; return;
default: 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); status = usb_submit_urb (urb, GFP_ATOMIC);
...@@ -1223,6 +1240,27 @@ static const struct driver_info prolific_info = { ...@@ -1223,6 +1240,27 @@ static const struct driver_info prolific_info = {
#endif /* CONFIG_USB_PL2301 */ #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 #ifdef CONFIG_USB_SA1100
...@@ -1230,16 +1268,17 @@ static const struct driver_info prolific_info = { ...@@ -1230,16 +1268,17 @@ static const struct driver_info prolific_info = {
* *
* Intel's SA-1100 chip integrates basic USB support, and is used * Intel's SA-1100 chip integrates basic USB support, and is used
* in PDAs like some iPaqs, the Yopy, some Zaurus models, and more. * 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. * 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). * The Zaurus uses a different driver (see later).
* *
*-------------------------------------------------------------------------*/ *-------------------------------------------------------------------------*/
static const struct driver_info linuxdev_info = { static const struct driver_info linuxdev_info = {
.description = "SA-1100 Linux Device", .description = "SA-1100 Linux Device",
.check_connect = always_connected,
.in = 2, .out = 1, .in = 2, .out = 1,
.epsize = 64, .epsize = 64,
...@@ -1247,6 +1286,7 @@ static const struct driver_info linuxdev_info = { ...@@ -1247,6 +1286,7 @@ static const struct driver_info linuxdev_info = {
static const struct driver_info yopy_info = { static const struct driver_info yopy_info = {
.description = "Yopy", .description = "Yopy",
.check_connect = always_connected,
.in = 2, .out = 1, .in = 2, .out = 1,
.epsize = 64, .epsize = 64,
...@@ -1257,65 +1297,20 @@ static const struct driver_info yopy_info = { ...@@ -1257,65 +1297,20 @@ static const struct driver_info yopy_info = {
#ifdef CONFIG_USB_ZAURUS #ifdef CONFIG_USB_ZAURUS
#include <linux/crc32.h>
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* *
* Zaurus is also a SA-1110 based PDA, but one using a different driver * 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, * For the current version of that driver, the main way that framing is
* and (b) the linux-friendly framing adds a crc32 to cope with some * nonstandard (also from perspective of the CDC ethernet model!) is a
* memory corruption observed with usb-to-memory DMA in some cases. * 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 * static struct sk_buff *
zaurus_tx_fixup (struct usbnet *dev, struct sk_buff *skb, int flags) 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) ...@@ -1334,11 +1329,9 @@ zaurus_tx_fixup (struct usbnet *dev, struct sk_buff *skb, int flags)
if (skb) { if (skb) {
u32 fcs; u32 fcs;
done: done:
fcs = fcs_compute32 (skb->data, skb->len, CRC32_INITFCS); fcs = crc32_le (~0, skb->data, skb->len);
fcs = ~fcs; fcs = ~fcs;
// ? add optional byte make addr even ?
*skb_put (skb, 1) = fcs & 0xff; *skb_put (skb, 1) = fcs & 0xff;
*skb_put (skb, 1) = (fcs>> 8) & 0xff; *skb_put (skb, 1) = (fcs>> 8) & 0xff;
*skb_put (skb, 1) = (fcs>>16) & 0xff; *skb_put (skb, 1) = (fcs>>16) & 0xff;
...@@ -1349,6 +1342,8 @@ zaurus_tx_fixup (struct usbnet *dev, struct sk_buff *skb, int flags) ...@@ -1349,6 +1342,8 @@ zaurus_tx_fixup (struct usbnet *dev, struct sk_buff *skb, int flags)
static const struct driver_info zaurus_sl5x00_info = { static const struct driver_info zaurus_sl5x00_info = {
.description = "Sharp Zaurus SL-5x00", .description = "Sharp Zaurus SL-5x00",
.flags = FLAG_FRAMING_Z,
.check_connect = always_connected,
.tx_fixup = zaurus_tx_fixup, .tx_fixup = zaurus_tx_fixup,
.in = 2, .out = 1, .in = 2, .out = 1,
...@@ -1356,11 +1351,16 @@ static const struct driver_info zaurus_sl5x00_info = { ...@@ -1356,11 +1351,16 @@ static const struct driver_info zaurus_sl5x00_info = {
}; };
static const struct driver_info zaurus_sla300_info = { static const struct driver_info zaurus_sla300_info = {
.description = "Sharp Zaurus SL-A300", .description = "Sharp Zaurus SL-A300",
.flags = FLAG_FRAMING_Z,
.check_connect = always_connected,
.tx_fixup = zaurus_tx_fixup, .tx_fixup = zaurus_tx_fixup,
.in = 1, .out = 2, .in = 1, .out = 2,
.epsize = 64, .epsize = 64,
}; };
// SL-5600 and C-700 are PXA based; should resemble A300
#endif #endif
...@@ -1403,7 +1403,7 @@ static struct net_device_stats *usbnet_get_stats (struct net_device *net) ...@@ -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) 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) ...@@ -1456,6 +1456,11 @@ static void rx_submit (struct usbnet *dev, struct urb *urb, int flags)
if (dev->driver_info->flags & FLAG_FRAMING_GL) if (dev->driver_info->flags & FLAG_FRAMING_GL)
size = GL_RCV_BUF_SIZE; size = GL_RCV_BUF_SIZE;
else else
#endif
#ifdef CONFIG_USB_ZAURUS
if (dev->driver_info->flags & FLAG_FRAMING_Z)
size = 6 + (sizeof (struct ethhdr) + dev->net.mtu);
else
#endif #endif
size = (sizeof (struct ethhdr) + dev->net.mtu); size = (sizeof (struct ethhdr) + dev->net.mtu);
...@@ -1476,11 +1481,6 @@ static void rx_submit (struct usbnet *dev, struct urb *urb, int flags) ...@@ -1476,11 +1481,6 @@ static void rx_submit (struct usbnet *dev, struct urb *urb, int flags)
usb_rcvbulkpipe (dev->udev, dev->driver_info->in), usb_rcvbulkpipe (dev->udev, dev->driver_info->in),
skb->data, size, rx_complete, skb); skb->data, size, rx_complete, skb);
urb->transfer_flags |= URB_ASYNC_UNLINK; 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); spin_lock_irqsave (&dev->rxq.lock, lockflags);
...@@ -1524,8 +1524,6 @@ static inline void rx_process (struct usbnet *dev, struct sk_buff *skb) ...@@ -1524,8 +1524,6 @@ static inline void rx_process (struct usbnet *dev, struct sk_buff *skb)
if (skb->len) { if (skb->len) {
int status; int status;
// FIXME: eth_copy_and_csum "small" packets to new SKB (small < ~200 bytes) ?
skb->dev = &dev->net; skb->dev = &dev->net;
skb->protocol = eth_type_trans (skb, &dev->net); skb->protocol = eth_type_trans (skb, &dev->net);
dev->stats.rx_packets++; dev->stats.rx_packets++;
...@@ -1904,7 +1902,7 @@ static void usbnet_tx_timeout (struct net_device *net) ...@@ -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) static int usbnet_start_xmit (struct sk_buff *skb, struct net_device *net)
{ {
struct usbnet *dev = (struct usbnet *) net->priv; struct usbnet *dev = (struct usbnet *) net->priv;
int length = skb->len; int length;
int retval = NET_XMIT_SUCCESS; int retval = NET_XMIT_SUCCESS;
struct urb *urb = 0; struct urb *urb = 0;
struct skb_data *entry; struct skb_data *entry;
...@@ -1924,6 +1922,7 @@ static int usbnet_start_xmit (struct sk_buff *skb, struct net_device *net) ...@@ -1924,6 +1922,7 @@ static int usbnet_start_xmit (struct sk_buff *skb, struct net_device *net)
goto drop; goto drop;
} }
} }
length = skb->len;
if (!(urb = usb_alloc_urb (0, GFP_ATOMIC))) { if (!(urb = usb_alloc_urb (0, GFP_ATOMIC))) {
dbg ("no urb"); dbg ("no urb");
...@@ -1938,6 +1937,7 @@ static int usbnet_start_xmit (struct sk_buff *skb, struct net_device *net) ...@@ -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 // FIXME: reorganize a bit, so that fixup() fills out NetChip
// framing too. (Packet ID update needs the spinlock...) // framing too. (Packet ID update needs the spinlock...)
// [ BETTER: we already own net->xmit_lock, that's enough ]
#ifdef CONFIG_USB_NET1080 #ifdef CONFIG_USB_NET1080
if (info->flags & FLAG_FRAMING_NC) { if (info->flags & FLAG_FRAMING_NC) {
...@@ -1958,7 +1958,6 @@ static int usbnet_start_xmit (struct sk_buff *skb, struct net_device *net) ...@@ -1958,7 +1958,6 @@ static int usbnet_start_xmit (struct sk_buff *skb, struct net_device *net)
usb_sndbulkpipe (dev->udev, info->out), usb_sndbulkpipe (dev->udev, info->out),
skb->data, skb->len, tx_complete, skb); skb->data, skb->len, tx_complete, skb);
urb->transfer_flags |= URB_ASYNC_UNLINK; urb->transfer_flags |= URB_ASYNC_UNLINK;
// FIXME urb->timeout = ... jiffies ... ;
spin_lock_irqsave (&dev->txq.lock, flags); spin_lock_irqsave (&dev->txq.lock, flags);
...@@ -2198,7 +2197,7 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) ...@@ -2198,7 +2197,7 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
#endif #endif
// ok, it's ready to go. // ok, it's ready to go.
dev_set_drvdata (&udev->dev, net); dev_set_drvdata (&udev->dev, dev);
mutex_lock (&usbnet_mutex); mutex_lock (&usbnet_mutex);
list_add (&dev->dev_list, &usbnet_list); list_add (&dev->dev_list, &usbnet_list);
mutex_unlock (&dev->mutex); mutex_unlock (&dev->mutex);
...@@ -2280,15 +2279,28 @@ static const struct usb_device_id products [] = { ...@@ -2280,15 +2279,28 @@ static const struct usb_device_id products [] = {
}, },
#endif #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 #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). * Often used when talking to Linux PDAs (iPaq, Yopy, etc).
* The sa-1100 "usb-eth" driver handles the basic framing. * The sa-1100 "usb-eth" driver handles the basic framing.
*/ */
{ {
// 1183 = 0x049F, both used as hex values? // 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, .driver_info = (unsigned long) &linuxdev_info,
}, { }, {
USB_DEVICE (0x0E7E, 0x1001), // G.Mate "Yopy" USB_DEVICE (0x0E7E, 0x1001), // G.Mate "Yopy"
...@@ -2323,8 +2335,6 @@ static const struct usb_device_id products [] = { ...@@ -2323,8 +2335,6 @@ static const struct usb_device_id products [] = {
}, },
#endif #endif
/* KC2190 from www.sepoong.co.kr "InstaNET" */
{ }, // END { }, // END
}; };
MODULE_DEVICE_TABLE (usb, products); MODULE_DEVICE_TABLE (usb, products);
......
...@@ -126,6 +126,7 @@ static struct usb_driver belkin_driver = { ...@@ -126,6 +126,7 @@ static struct usb_driver belkin_driver = {
static struct usb_serial_device_type belkin_device = { static struct usb_serial_device_type belkin_device = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "Belkin / Peracom / GoHubs USB Serial Adapter", .name = "Belkin / Peracom / GoHubs USB Serial Adapter",
.short_name = "belkin",
.id_table = id_table_combined, .id_table = id_table_combined,
.num_interrupt_in = 1, .num_interrupt_in = 1,
.num_bulk_in = 1, .num_bulk_in = 1,
......
...@@ -121,7 +121,10 @@ int usb_serial_bus_register(struct usb_serial_device_type *device) ...@@ -121,7 +121,10 @@ int usb_serial_bus_register(struct usb_serial_device_type *device)
{ {
int retval; int retval;
device->driver.name = (char *)device->name; 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.bus = &usb_serial_bus_type;
device->driver.probe = usb_serial_device_probe; device->driver.probe = usb_serial_device_probe;
device->driver.remove = usb_serial_device_remove; device->driver.remove = usb_serial_device_remove;
......
...@@ -83,6 +83,7 @@ static struct usb_driver cyberjack_driver = { ...@@ -83,6 +83,7 @@ static struct usb_driver cyberjack_driver = {
static struct usb_serial_device_type cyberjack_device = { static struct usb_serial_device_type cyberjack_device = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "Reiner SCT Cyberjack USB card reader", .name = "Reiner SCT Cyberjack USB card reader",
.short_name = "cyberjack",
.id_table = id_table, .id_table = id_table,
.num_interrupt_in = 1, .num_interrupt_in = 1,
.num_bulk_in = 1, .num_bulk_in = 1,
......
...@@ -43,6 +43,7 @@ static struct usb_device_id generic_device_ids[2]; /* Initially all zeroes. */ ...@@ -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 = { struct usb_serial_device_type usb_serial_generic_device = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "Generic", .name = "Generic",
.short_name = "generic",
.id_table = generic_device_ids, .id_table = generic_device_ids,
.num_interrupt_in = NUM_DONT_CARE, .num_interrupt_in = NUM_DONT_CARE,
.num_bulk_in = NUM_DONT_CARE, .num_bulk_in = NUM_DONT_CARE,
......
...@@ -100,6 +100,7 @@ MODULE_DEVICE_TABLE (usb, id_table_combined); ...@@ -100,6 +100,7 @@ MODULE_DEVICE_TABLE (usb, id_table_combined);
static struct usb_serial_device_type edgeport_1port_device = { static struct usb_serial_device_type edgeport_1port_device = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "Edgeport 1 port adapter", .name = "Edgeport 1 port adapter",
.short_name = "edgeport_1",
.id_table = edgeport_1port_id_table, .id_table = edgeport_1port_id_table,
.num_interrupt_in = 1, .num_interrupt_in = 1,
.num_bulk_in = 1, .num_bulk_in = 1,
...@@ -122,6 +123,7 @@ static struct usb_serial_device_type edgeport_1port_device = { ...@@ -122,6 +123,7 @@ static struct usb_serial_device_type edgeport_1port_device = {
static struct usb_serial_device_type edgeport_2port_device = { static struct usb_serial_device_type edgeport_2port_device = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "Edgeport 2 port adapter", .name = "Edgeport 2 port adapter",
.short_name = "edgeport_2",
.id_table = edgeport_2port_id_table, .id_table = edgeport_2port_id_table,
.num_interrupt_in = 1, .num_interrupt_in = 1,
.num_bulk_in = 1, .num_bulk_in = 1,
...@@ -144,6 +146,7 @@ static struct usb_serial_device_type edgeport_2port_device = { ...@@ -144,6 +146,7 @@ static struct usb_serial_device_type edgeport_2port_device = {
static struct usb_serial_device_type edgeport_4port_device = { static struct usb_serial_device_type edgeport_4port_device = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "Edgeport 4 port adapter", .name = "Edgeport 4 port adapter",
.short_name = "edgeport_4",
.id_table = edgeport_4port_id_table, .id_table = edgeport_4port_id_table,
.num_interrupt_in = 1, .num_interrupt_in = 1,
.num_bulk_in = 1, .num_bulk_in = 1,
...@@ -166,6 +169,7 @@ static struct usb_serial_device_type edgeport_4port_device = { ...@@ -166,6 +169,7 @@ static struct usb_serial_device_type edgeport_4port_device = {
static struct usb_serial_device_type edgeport_8port_device = { static struct usb_serial_device_type edgeport_8port_device = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "Edgeport 8 port adapter", .name = "Edgeport 8 port adapter",
.short_name = "edgeport_8",
.id_table = edgeport_8port_id_table, .id_table = edgeport_8port_id_table,
.num_interrupt_in = 1, .num_interrupt_in = 1,
.num_bulk_in = 1, .num_bulk_in = 1,
......
...@@ -2635,6 +2635,7 @@ static void edge_shutdown (struct usb_serial *serial) ...@@ -2635,6 +2635,7 @@ static void edge_shutdown (struct usb_serial *serial)
static struct usb_serial_device_type edgeport_1port_device = { static struct usb_serial_device_type edgeport_1port_device = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "Edgeport TI 1 port adapter", .name = "Edgeport TI 1 port adapter",
.short_name = "edgeport_ti_1",
.id_table = edgeport_1port_id_table, .id_table = edgeport_1port_id_table,
.num_interrupt_in = 1, .num_interrupt_in = 1,
.num_bulk_in = 1, .num_bulk_in = 1,
...@@ -2657,6 +2658,7 @@ static struct usb_serial_device_type edgeport_1port_device = { ...@@ -2657,6 +2658,7 @@ static struct usb_serial_device_type edgeport_1port_device = {
static struct usb_serial_device_type edgeport_2port_device = { static struct usb_serial_device_type edgeport_2port_device = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "Edgeport TI 2 port adapter", .name = "Edgeport TI 2 port adapter",
.short_name = "edgeport_ti_2",
.id_table = edgeport_2port_id_table, .id_table = edgeport_2port_id_table,
.num_interrupt_in = 1, .num_interrupt_in = 1,
.num_bulk_in = 2, .num_bulk_in = 2,
......
...@@ -481,6 +481,7 @@ static struct usb_device_id keyspan_4port_ids[] = { ...@@ -481,6 +481,7 @@ static struct usb_device_id keyspan_4port_ids[] = {
static struct usb_serial_device_type keyspan_pre_device = { static struct usb_serial_device_type keyspan_pre_device = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "Keyspan - (without firmware)", .name = "Keyspan - (without firmware)",
.short_name = "keyspan_no_firm",
.id_table = keyspan_pre_ids, .id_table = keyspan_pre_ids,
.num_interrupt_in = NUM_DONT_CARE, .num_interrupt_in = NUM_DONT_CARE,
.num_bulk_in = NUM_DONT_CARE, .num_bulk_in = NUM_DONT_CARE,
...@@ -492,6 +493,7 @@ static struct usb_serial_device_type keyspan_pre_device = { ...@@ -492,6 +493,7 @@ static struct usb_serial_device_type keyspan_pre_device = {
static struct usb_serial_device_type keyspan_1port_device = { static struct usb_serial_device_type keyspan_1port_device = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "Keyspan 1 port adapter", .name = "Keyspan 1 port adapter",
.short_name = "keyspan_1",
.id_table = keyspan_1port_ids, .id_table = keyspan_1port_ids,
.num_interrupt_in = NUM_DONT_CARE, .num_interrupt_in = NUM_DONT_CARE,
.num_bulk_in = 3, .num_bulk_in = 3,
...@@ -514,6 +516,7 @@ static struct usb_serial_device_type keyspan_1port_device = { ...@@ -514,6 +516,7 @@ static struct usb_serial_device_type keyspan_1port_device = {
static struct usb_serial_device_type keyspan_2port_device = { static struct usb_serial_device_type keyspan_2port_device = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "Keyspan 2 port adapter", .name = "Keyspan 2 port adapter",
.short_name = "keyspan_2",
.id_table = keyspan_2port_ids, .id_table = keyspan_2port_ids,
.num_interrupt_in = NUM_DONT_CARE, .num_interrupt_in = NUM_DONT_CARE,
.num_bulk_in = NUM_DONT_CARE, .num_bulk_in = NUM_DONT_CARE,
...@@ -536,6 +539,7 @@ static struct usb_serial_device_type keyspan_2port_device = { ...@@ -536,6 +539,7 @@ static struct usb_serial_device_type keyspan_2port_device = {
static struct usb_serial_device_type keyspan_4port_device = { static struct usb_serial_device_type keyspan_4port_device = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "Keyspan 4 port adapter", .name = "Keyspan 4 port adapter",
.short_name = "keyspan_4",
.id_table = keyspan_4port_ids, .id_table = keyspan_4port_ids,
.num_interrupt_in = NUM_DONT_CARE, .num_interrupt_in = NUM_DONT_CARE,
.num_bulk_in = 5, .num_bulk_in = 5,
......
...@@ -827,6 +827,7 @@ static void keyspan_pda_shutdown (struct usb_serial *serial) ...@@ -827,6 +827,7 @@ static void keyspan_pda_shutdown (struct usb_serial *serial)
static struct usb_serial_device_type keyspan_pda_fake_device = { static struct usb_serial_device_type keyspan_pda_fake_device = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "Keyspan PDA - (prerenumeration)", .name = "Keyspan PDA - (prerenumeration)",
.short_name = "kyspn_pda_nofirm",
.id_table = id_table_fake, .id_table = id_table_fake,
.num_interrupt_in = NUM_DONT_CARE, .num_interrupt_in = NUM_DONT_CARE,
.num_bulk_in = NUM_DONT_CARE, .num_bulk_in = NUM_DONT_CARE,
...@@ -840,6 +841,7 @@ static struct usb_serial_device_type keyspan_pda_fake_device = { ...@@ -840,6 +841,7 @@ static struct usb_serial_device_type keyspan_pda_fake_device = {
static struct usb_serial_device_type xircom_pgs_fake_device = { static struct usb_serial_device_type xircom_pgs_fake_device = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "Xircom / Entregra PGS - (prerenumeration)", .name = "Xircom / Entregra PGS - (prerenumeration)",
.short_name = "xircom_nofirm",
.id_table = id_table_fake_xircom, .id_table = id_table_fake_xircom,
.num_interrupt_in = NUM_DONT_CARE, .num_interrupt_in = NUM_DONT_CARE,
.num_bulk_in = NUM_DONT_CARE, .num_bulk_in = NUM_DONT_CARE,
...@@ -852,6 +854,7 @@ static struct usb_serial_device_type xircom_pgs_fake_device = { ...@@ -852,6 +854,7 @@ static struct usb_serial_device_type xircom_pgs_fake_device = {
static struct usb_serial_device_type keyspan_pda_device = { static struct usb_serial_device_type keyspan_pda_device = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "Keyspan PDA", .name = "Keyspan PDA",
.short_name = "keyspan_pda",
.id_table = id_table_std, .id_table = id_table_std,
.num_interrupt_in = 1, .num_interrupt_in = 1,
.num_bulk_in = 0, .num_bulk_in = 0,
......
...@@ -127,6 +127,7 @@ static struct usb_driver kl5kusb105d_driver = { ...@@ -127,6 +127,7 @@ static struct usb_driver kl5kusb105d_driver = {
static struct usb_serial_device_type kl5kusb105d_device = { static struct usb_serial_device_type kl5kusb105d_device = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "KL5KUSB105D / PalmConnect", .name = "KL5KUSB105D / PalmConnect",
.short_name = "kl5kusb105d",
.id_table = id_table, .id_table = id_table,
.num_interrupt_in = 1, .num_interrupt_in = 1,
.num_bulk_in = 1, .num_bulk_in = 1,
......
...@@ -149,6 +149,7 @@ static struct usb_driver mct_u232_driver = { ...@@ -149,6 +149,7 @@ static struct usb_driver mct_u232_driver = {
static struct usb_serial_device_type mct_u232_device = { static struct usb_serial_device_type mct_u232_device = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "Magic Control Technology USB-RS232", .name = "Magic Control Technology USB-RS232",
.short_name = "mct_u232",
.id_table = id_table_combined, .id_table = id_table_combined,
.num_interrupt_in = 2, .num_interrupt_in = 2,
.num_bulk_in = 0, .num_bulk_in = 0,
......
...@@ -94,6 +94,7 @@ static struct usb_driver omninet_driver = { ...@@ -94,6 +94,7 @@ static struct usb_driver omninet_driver = {
static struct usb_serial_device_type zyxel_omninet_device = { static struct usb_serial_device_type zyxel_omninet_device = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "ZyXEL - omni.net lcd plus usb", .name = "ZyXEL - omni.net lcd plus usb",
.short_name = "omninet",
.id_table = id_table, .id_table = id_table,
.num_interrupt_in = 1, .num_interrupt_in = 1,
.num_bulk_in = 1, .num_bulk_in = 1,
......
...@@ -168,6 +168,9 @@ struct usb_serial { ...@@ -168,6 +168,9 @@ struct usb_serial {
* @owner: pointer to the module that owns this device. * @owner: pointer to the module that owns this device.
* @name: pointer to a string that describes this device. This string used * @name: pointer to a string that describes this device. This string used
* in the syslog messages when a device is inserted or removed. * 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 * @id_table: pointer to a list of usb_device_id structures that define all
* of the devices this structure can support. * of the devices this structure can support.
* @num_interrupt_in: the number of interrupt in endpoints this device will * @num_interrupt_in: the number of interrupt in endpoints this device will
...@@ -201,6 +204,7 @@ struct usb_serial { ...@@ -201,6 +204,7 @@ struct usb_serial {
struct usb_serial_device_type { struct usb_serial_device_type {
struct module *owner; struct module *owner;
char *name; char *name;
char *short_name;
const struct usb_device_id *id_table; const struct usb_device_id *id_table;
char num_interrupt_in; char num_interrupt_in;
char num_bulk_in; char num_bulk_in;
......
...@@ -236,6 +236,7 @@ static struct usb_driver visor_driver = { ...@@ -236,6 +236,7 @@ static struct usb_driver visor_driver = {
static struct usb_serial_device_type handspring_device = { static struct usb_serial_device_type handspring_device = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "Handspring Visor / Treo / Palm 4.0 / Clié 4.x", .name = "Handspring Visor / Treo / Palm 4.0 / Clié 4.x",
.short_name = "visor",
.id_table = id_table, .id_table = id_table,
.num_interrupt_in = NUM_DONT_CARE, .num_interrupt_in = NUM_DONT_CARE,
.num_bulk_in = 2, .num_bulk_in = 2,
...@@ -262,6 +263,7 @@ static struct usb_serial_device_type handspring_device = { ...@@ -262,6 +263,7 @@ static struct usb_serial_device_type handspring_device = {
static struct usb_serial_device_type clie_3_5_device = { static struct usb_serial_device_type clie_3_5_device = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "Sony Clié 3.5", .name = "Sony Clié 3.5",
.short_name = "clie_3.5",
.id_table = clie_id_3_5_table, .id_table = clie_id_3_5_table,
.num_interrupt_in = 0, .num_interrupt_in = 0,
.num_bulk_in = 1, .num_bulk_in = 1,
......
...@@ -156,6 +156,7 @@ static void whiteheat_write_callback (struct urb *urb, struct pt_regs *regs); ...@@ -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 = { static struct usb_serial_device_type whiteheat_fake_device = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "Connect Tech - WhiteHEAT - (prerenumeration)", .name = "Connect Tech - WhiteHEAT - (prerenumeration)",
.short_name = "whiteheatnofirm",
.id_table = id_table_prerenumeration, .id_table = id_table_prerenumeration,
.num_interrupt_in = NUM_DONT_CARE, .num_interrupt_in = NUM_DONT_CARE,
.num_bulk_in = NUM_DONT_CARE, .num_bulk_in = NUM_DONT_CARE,
...@@ -168,6 +169,7 @@ static struct usb_serial_device_type whiteheat_fake_device = { ...@@ -168,6 +169,7 @@ static struct usb_serial_device_type whiteheat_fake_device = {
static struct usb_serial_device_type whiteheat_device = { static struct usb_serial_device_type whiteheat_device = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "Connect Tech - WhiteHEAT", .name = "Connect Tech - WhiteHEAT",
.short_name = "whiteheat",
.id_table = id_table_std, .id_table = id_table_std,
.num_interrupt_in = NUM_DONT_CARE, .num_interrupt_in = NUM_DONT_CARE,
.num_bulk_in = NUM_DONT_CARE, .num_bulk_in = NUM_DONT_CARE,
...@@ -512,9 +514,11 @@ static int whiteheat_attach (struct usb_serial *serial) ...@@ -512,9 +514,11 @@ static int whiteheat_attach (struct usb_serial *serial)
no_rx_buf: no_rx_buf:
usb_free_urb(urb); usb_free_urb(urb);
no_rx_urb: no_rx_urb:
;
} }
kfree(info); kfree(info);
no_private: no_private:
;
} }
return -ENOMEM; return -ENOMEM;
} }
......
...@@ -480,7 +480,7 @@ int usb_stor_control_msg(struct us_data *us, unsigned int pipe, ...@@ -480,7 +480,7 @@ int usb_stor_control_msg(struct us_data *us, unsigned int pipe,
status = usb_stor_msg_common(us); status = usb_stor_msg_common(us);
/* return the actual length of the data transferred if no error */ /* return the actual length of the data transferred if no error */
if (status >= 0) if (status == 0)
status = us->current_urb->actual_length; status = us->current_urb->actual_length;
return status; return status;
} }
...@@ -583,50 +583,52 @@ static int interpret_urb_result(struct us_data *us, unsigned int pipe, ...@@ -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", US_DEBUGP("Status code %d; transferred %u/%u\n",
result, partial, length); result, partial, length);
switch (result) {
/* stalled */ /* no error code; did we send all the data? */
if (result == -EPIPE) { 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 /* stalled */
* a protocol error */ case -EPIPE:
if (!usb_pipebulk(pipe)) { /* for control endpoints, a stall indicates a protocol error */
if (usb_pipecontrol(pipe)) {
US_DEBUGP("-- stall on control pipe\n"); US_DEBUGP("-- stall on control pipe\n");
return USB_STOR_XFER_ERROR; 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); US_DEBUGP("clearing endpoint halt for pipe 0x%x\n", pipe);
if (usb_stor_clear_halt(us, pipe) < 0) if (usb_stor_clear_halt(us, pipe) < 0)
return USB_STOR_XFER_ERROR; return USB_STOR_XFER_ERROR;
return USB_STOR_XFER_STALLED; return USB_STOR_XFER_STALLED;
}
/* NAK - that means we've retried this a few times already */ /* NAK - that means we've retried this a few times already */
if (result == -ETIMEDOUT) { case -ETIMEDOUT:
US_DEBUGP("-- device NAKed\n"); US_DEBUGP("-- device NAKed\n");
return USB_STOR_XFER_ERROR; return USB_STOR_XFER_ERROR;
}
/* the transfer was cancelled, presumably by an abort */ /* the transfer was cancelled, presumably by an abort */
if (result == -ENODEV) { case -ENODEV:
US_DEBUGP("-- transfer cancelled\n"); US_DEBUGP("-- transfer cancelled\n");
return USB_STOR_XFER_ERROR; 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 */ /* the catch-all error case */
if (result < 0) { default:
US_DEBUGP("-- unknown error\n"); US_DEBUGP("-- unknown error\n");
return USB_STOR_XFER_ERROR; 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, ...@@ -728,9 +728,13 @@ static int storage_probe(struct usb_interface *intf,
USB_ENDPOINT_NUMBER_MASK; USB_ENDPOINT_NUMBER_MASK;
ss->ep_out = ep_out->bEndpointAddress & ss->ep_out = ep_out->bEndpointAddress &
USB_ENDPOINT_NUMBER_MASK; USB_ENDPOINT_NUMBER_MASK;
ss->ep_int = ep_int->bEndpointAddress & if (ep_int) {
USB_ENDPOINT_NUMBER_MASK; ss->ep_int = ep_int->bEndpointAddress &
ss->ep_bInterval = ep_int->bInterval; 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 */ /* allocate the URB, the usb_ctrlrequest, and the IRQ URB */
if (usb_stor_allocate_urbs(ss)) if (usb_stor_allocate_urbs(ss))
...@@ -771,9 +775,13 @@ static int storage_probe(struct usb_interface *intf, ...@@ -771,9 +775,13 @@ static int storage_probe(struct usb_interface *intf,
USB_ENDPOINT_NUMBER_MASK; USB_ENDPOINT_NUMBER_MASK;
ss->ep_out = ep_out->bEndpointAddress & ss->ep_out = ep_out->bEndpointAddress &
USB_ENDPOINT_NUMBER_MASK; USB_ENDPOINT_NUMBER_MASK;
ss->ep_int = ep_int->bEndpointAddress & if (ep_int) {
USB_ENDPOINT_NUMBER_MASK; ss->ep_int = ep_int->bEndpointAddress &
ss->ep_bInterval = ep_int->bInterval; 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 */ /* establish the connection to the new device */
ss->ifnum = ifnum; 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