diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-17 15:43:52 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-17 15:43:52 -0700 |
commit | 0cfd81031a26717fe14380d18275f8e217571615 (patch) | |
tree | 78a84e4cb97e7f45eb77dc0fbd8857a5dd717869 /drivers/usb/gadget/net2280.c | |
parent | f7ea4a4ba84f382e8eb143e435551de0feee5b4b (diff) | |
parent | 802f389a2cc6e2771b8de915ac241456d41eb79e (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6: (94 commits)
USB: remove err() macro from more usb drivers
USB: remove err() macro from usb misc drivers
USB: remove err() macro from usb core code
USB: remove err() macro from usb class drivers
USB: remove use of err() in drivers/usb/serial
USB: remove info() macro from usb mtd drivers
USB: remove info() macro from usb input drivers
USB: remove info() macro from usb network drivers
USB: remove info() macro from remaining usb drivers
USB: remove info() macro from usb/misc drivers
USB: remove info() macro from usb/serial drivers
USB: remove warn macro from HID core
USB: remove warn() macro from usb drivers
USB: remove warn() macro from usb net drivers
USB: remove warn() macro from usb media drivers
USB: remove warn() macro from usb input drivers
usb/fsl_qe_udc: clear data toggle on clear halt request
usb/fsl_qe_udc: fix response to get status request
fsl_usb2_udc: Fix oops on probe failure.
fsl_usb2_udc: Add a wmb before priming endpoint.
...
Diffstat (limited to 'drivers/usb/gadget/net2280.c')
-rw-r--r-- | drivers/usb/gadget/net2280.c | 40 |
1 files changed, 34 insertions, 6 deletions
diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c index 5cfb5ebf388..8ae70de2c37 100644 --- a/drivers/usb/gadget/net2280.c +++ b/drivers/usb/gadget/net2280.c @@ -178,6 +178,7 @@ net2280_enable (struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc) /* ep_reset() has already been called */ ep->stopped = 0; + ep->wedged = 0; ep->out_overflow = 0; /* set speed-dependent max packet; may kick in high bandwidth */ @@ -1218,7 +1219,7 @@ static int net2280_dequeue (struct usb_ep *_ep, struct usb_request *_req) static int net2280_fifo_status (struct usb_ep *_ep); static int -net2280_set_halt (struct usb_ep *_ep, int value) +net2280_set_halt_and_wedge(struct usb_ep *_ep, int value, int wedged) { struct net2280_ep *ep; unsigned long flags; @@ -1239,16 +1240,21 @@ net2280_set_halt (struct usb_ep *_ep, int value) else if (ep->is_in && value && net2280_fifo_status (_ep) != 0) retval = -EAGAIN; else { - VDEBUG (ep->dev, "%s %s halt\n", _ep->name, - value ? "set" : "clear"); + VDEBUG (ep->dev, "%s %s %s\n", _ep->name, + value ? "set" : "clear", + wedged ? "wedge" : "halt"); /* set/clear, then synch memory views with the device */ if (value) { if (ep->num == 0) ep->dev->protocol_stall = 1; else set_halt (ep); - } else + if (wedged) + ep->wedged = 1; + } else { clear_halt (ep); + ep->wedged = 0; + } (void) readl (&ep->regs->ep_rsp); } spin_unlock_irqrestore (&ep->dev->lock, flags); @@ -1257,6 +1263,20 @@ net2280_set_halt (struct usb_ep *_ep, int value) } static int +net2280_set_halt(struct usb_ep *_ep, int value) +{ + return net2280_set_halt_and_wedge(_ep, value, 0); +} + +static int +net2280_set_wedge(struct usb_ep *_ep) +{ + if (!_ep || _ep->name == ep0name) + return -EINVAL; + return net2280_set_halt_and_wedge(_ep, 1, 1); +} + +static int net2280_fifo_status (struct usb_ep *_ep) { struct net2280_ep *ep; @@ -1302,6 +1322,7 @@ static const struct usb_ep_ops net2280_ep_ops = { .dequeue = net2280_dequeue, .set_halt = net2280_set_halt, + .set_wedge = net2280_set_wedge, .fifo_status = net2280_fifo_status, .fifo_flush = net2280_fifo_flush, }; @@ -2410,9 +2431,14 @@ static void handle_stat0_irqs (struct net2280 *dev, u32 stat) goto do_stall; if ((e = get_ep_by_addr (dev, w_index)) == 0) goto do_stall; - clear_halt (e); + if (e->wedged) { + VDEBUG(dev, "%s wedged, halt not cleared\n", + ep->ep.name); + } else { + VDEBUG(dev, "%s clear halt\n", ep->ep.name); + clear_halt(e); + } allow_status (ep); - VDEBUG (dev, "%s clear halt\n", ep->ep.name); goto next_endpoints; } break; @@ -2427,6 +2453,8 @@ static void handle_stat0_irqs (struct net2280 *dev, u32 stat) goto do_stall; if ((e = get_ep_by_addr (dev, w_index)) == 0) goto do_stall; + if (e->ep.name == ep0name) + goto do_stall; set_halt (e); allow_status (ep); VDEBUG (dev, "%s set halt\n", ep->ep.name); |