diff options
author | Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> | 2014-05-20 12:30:10 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2014-06-30 13:33:34 -0400 |
commit | ae8e530a7e5d87592cb23996bee7fd6f1eb202ed (patch) | |
tree | 1b4195692b4c31b6876be6559b525a220e452e96 | |
parent | fae3c158800339765a2580ac5d6236ae116ec5cb (diff) |
usb: gadget: net2280: Code Cleanup
- Move logical continuations to end of line
- Improve spacing
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
-rw-r--r-- | drivers/usb/gadget/net2280.c | 155 | ||||
-rw-r--r-- | drivers/usb/gadget/net2280.h | 4 |
2 files changed, 78 insertions, 81 deletions
diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c index d1d4f4fc9da7..d506c83d204a 100644 --- a/drivers/usb/gadget/net2280.c +++ b/drivers/usb/gadget/net2280.c | |||
@@ -100,9 +100,9 @@ static bool use_dma_chaining; | |||
100 | static bool use_msi = true; | 100 | static bool use_msi = true; |
101 | 101 | ||
102 | /* "modprobe net2280 use_dma=n" etc */ | 102 | /* "modprobe net2280 use_dma=n" etc */ |
103 | module_param(use_dma, bool, S_IRUGO); | 103 | module_param(use_dma, bool, 0444); |
104 | module_param(use_dma_chaining, bool, S_IRUGO); | 104 | module_param(use_dma_chaining, bool, 0444); |
105 | module_param(use_msi, bool, S_IRUGO); | 105 | module_param(use_msi, bool, 0444); |
106 | 106 | ||
107 | /* mode 0 == ep-{a,b,c,d} 1K fifo each | 107 | /* mode 0 == ep-{a,b,c,d} 1K fifo each |
108 | * mode 1 == ep-{a,b} 2K fifo each, ep-{c,d} unavailable | 108 | * mode 1 == ep-{a,b} 2K fifo each, ep-{c,d} unavailable |
@@ -111,7 +111,7 @@ module_param(use_msi, bool, S_IRUGO); | |||
111 | static ushort fifo_mode; | 111 | static ushort fifo_mode; |
112 | 112 | ||
113 | /* "modprobe net2280 fifo_mode=1" etc */ | 113 | /* "modprobe net2280 fifo_mode=1" etc */ |
114 | module_param (fifo_mode, ushort, 0644); | 114 | module_param(fifo_mode, ushort, 0644); |
115 | 115 | ||
116 | /* enable_suspend -- When enabled, the driver will respond to | 116 | /* enable_suspend -- When enabled, the driver will respond to |
117 | * USB suspend requests by powering down the NET2280. Otherwise, | 117 | * USB suspend requests by powering down the NET2280. Otherwise, |
@@ -121,7 +121,7 @@ module_param (fifo_mode, ushort, 0644); | |||
121 | static bool enable_suspend; | 121 | static bool enable_suspend; |
122 | 122 | ||
123 | /* "modprobe net2280 enable_suspend=1" etc */ | 123 | /* "modprobe net2280 enable_suspend=1" etc */ |
124 | module_param(enable_suspend, bool, S_IRUGO); | 124 | module_param(enable_suspend, bool, 0444); |
125 | 125 | ||
126 | /* force full-speed operation */ | 126 | /* force full-speed operation */ |
127 | static bool full_speed; | 127 | static bool full_speed; |
@@ -169,8 +169,8 @@ net2280_enable(struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc) | |||
169 | static const u32 ep_key[9] = { 1, 0, 1, 0, 1, 1, 0, 1, 0 }; | 169 | static const u32 ep_key[9] = { 1, 0, 1, 0, 1, 1, 0, 1, 0 }; |
170 | 170 | ||
171 | ep = container_of(_ep, struct net2280_ep, ep); | 171 | ep = container_of(_ep, struct net2280_ep, ep); |
172 | if (!_ep || !desc || ep->desc || _ep->name == ep0name | 172 | if (!_ep || !desc || ep->desc || _ep->name == ep0name || |
173 | || desc->bDescriptorType != USB_DT_ENDPOINT) | 173 | desc->bDescriptorType != USB_DT_ENDPOINT) |
174 | return -EINVAL; | 174 | return -EINVAL; |
175 | dev = ep->dev; | 175 | dev = ep->dev; |
176 | if (!dev->driver || dev->gadget.speed == USB_SPEED_UNKNOWN) | 176 | if (!dev->driver || dev->gadget.speed == USB_SPEED_UNKNOWN) |
@@ -220,9 +220,9 @@ net2280_enable(struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc) | |||
220 | tmp = (desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK); | 220 | tmp = (desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK); |
221 | if (tmp == USB_ENDPOINT_XFER_INT) { | 221 | if (tmp == USB_ENDPOINT_XFER_INT) { |
222 | /* erratum 0105 workaround prevents hs NYET */ | 222 | /* erratum 0105 workaround prevents hs NYET */ |
223 | if (dev->chiprev == 0100 | 223 | if (dev->chiprev == 0100 && |
224 | && dev->gadget.speed == USB_SPEED_HIGH | 224 | dev->gadget.speed == USB_SPEED_HIGH && |
225 | && !(desc->bEndpointAddress & USB_DIR_IN)) | 225 | !(desc->bEndpointAddress & USB_DIR_IN)) |
226 | writel(BIT(CLEAR_NAK_OUT_PACKETS_MODE), | 226 | writel(BIT(CLEAR_NAK_OUT_PACKETS_MODE), |
227 | &ep->regs->ep_rsp); | 227 | &ep->regs->ep_rsp); |
228 | } else if (tmp == USB_ENDPOINT_XFER_BULK) { | 228 | } else if (tmp == USB_ENDPOINT_XFER_BULK) { |
@@ -402,8 +402,8 @@ static void ep_reset_228x(struct net2280_regs __iomem *regs, | |||
402 | BIT(DATA_PACKET_RECEIVED_INTERRUPT) | | 402 | BIT(DATA_PACKET_RECEIVED_INTERRUPT) | |
403 | BIT(DATA_PACKET_TRANSMITTED_INTERRUPT) | | 403 | BIT(DATA_PACKET_TRANSMITTED_INTERRUPT) | |
404 | BIT(DATA_OUT_PING_TOKEN_INTERRUPT) | | 404 | BIT(DATA_OUT_PING_TOKEN_INTERRUPT) | |
405 | BIT(DATA_IN_TOKEN_INTERRUPT) | 405 | BIT(DATA_IN_TOKEN_INTERRUPT), |
406 | , &ep->regs->ep_stat); | 406 | &ep->regs->ep_stat); |
407 | 407 | ||
408 | /* fifo size is handled separately */ | 408 | /* fifo size is handled separately */ |
409 | } | 409 | } |
@@ -425,9 +425,9 @@ static void ep_reset_338x(struct net2280_regs __iomem *regs, | |||
425 | writel(BIT(DMA_ABORT_DONE_INTERRUPT) | | 425 | writel(BIT(DMA_ABORT_DONE_INTERRUPT) | |
426 | BIT(DMA_PAUSE_DONE_INTERRUPT) | | 426 | BIT(DMA_PAUSE_DONE_INTERRUPT) | |
427 | BIT(DMA_SCATTER_GATHER_DONE_INTERRUPT) | | 427 | BIT(DMA_SCATTER_GATHER_DONE_INTERRUPT) | |
428 | BIT(DMA_TRANSACTION_DONE_INTERRUPT) | 428 | BIT(DMA_TRANSACTION_DONE_INTERRUPT), |
429 | /* | BIT(DMA_ABORT) */ | 429 | /* | BIT(DMA_ABORT), */ |
430 | , &ep->dma->dmastat); | 430 | &ep->dma->dmastat); |
431 | 431 | ||
432 | dmastat = readl(&ep->dma->dmastat); | 432 | dmastat = readl(&ep->dma->dmastat); |
433 | if (dmastat == 0x5002) { | 433 | if (dmastat == 0x5002) { |
@@ -618,15 +618,15 @@ static void out_flush(struct net2280_ep *ep) | |||
618 | 618 | ||
619 | statp = &ep->regs->ep_stat; | 619 | statp = &ep->regs->ep_stat; |
620 | writel(BIT(DATA_OUT_PING_TOKEN_INTERRUPT) | | 620 | writel(BIT(DATA_OUT_PING_TOKEN_INTERRUPT) | |
621 | BIT(DATA_PACKET_RECEIVED_INTERRUPT) | 621 | BIT(DATA_PACKET_RECEIVED_INTERRUPT), |
622 | , statp); | 622 | statp); |
623 | writel(BIT(FIFO_FLUSH), statp); | 623 | writel(BIT(FIFO_FLUSH), statp); |
624 | /* Make sure that stap is written */ | 624 | /* Make sure that stap is written */ |
625 | mb(); | 625 | mb(); |
626 | tmp = readl(statp); | 626 | tmp = readl(statp); |
627 | if (tmp & BIT(DATA_OUT_PING_TOKEN_INTERRUPT) | 627 | if (tmp & BIT(DATA_OUT_PING_TOKEN_INTERRUPT) && |
628 | /* high speed did bulk NYET; fifo isn't filling */ | 628 | /* high speed did bulk NYET; fifo isn't filling */ |
629 | && ep->dev->gadget.speed == USB_SPEED_FULL) { | 629 | ep->dev->gadget.speed == USB_SPEED_FULL) { |
630 | unsigned usec; | 630 | unsigned usec; |
631 | 631 | ||
632 | usec = 50; /* 64 byte bulk/interrupt */ | 632 | usec = 50; /* 64 byte bulk/interrupt */ |
@@ -653,8 +653,8 @@ static int read_fifo(struct net2280_ep *ep, struct net2280_request *req) | |||
653 | /* erratum 0106 ... packets coming in during fifo reads might | 653 | /* erratum 0106 ... packets coming in during fifo reads might |
654 | * be incompletely rejected. not all cases have workarounds. | 654 | * be incompletely rejected. not all cases have workarounds. |
655 | */ | 655 | */ |
656 | if (ep->dev->chiprev == 0x0100 | 656 | if (ep->dev->chiprev == 0x0100 && |
657 | && ep->dev->gadget.speed == USB_SPEED_FULL) { | 657 | ep->dev->gadget.speed == USB_SPEED_FULL) { |
658 | udelay(1); | 658 | udelay(1); |
659 | tmp = readl(&ep->regs->ep_stat); | 659 | tmp = readl(&ep->regs->ep_stat); |
660 | if ((tmp & BIT(NAK_OUT_PACKETS))) | 660 | if ((tmp & BIT(NAK_OUT_PACKETS))) |
@@ -726,8 +726,8 @@ static int read_fifo(struct net2280_ep *ep, struct net2280_request *req) | |||
726 | (void) readl(&ep->regs->ep_rsp); | 726 | (void) readl(&ep->regs->ep_rsp); |
727 | } | 727 | } |
728 | 728 | ||
729 | return is_short || ((req->req.actual == req->req.length) | 729 | return is_short || ((req->req.actual == req->req.length) && |
730 | && !req->req.zero); | 730 | !req->req.zero); |
731 | } | 731 | } |
732 | 732 | ||
733 | /* fill out dma descriptor to match a given request */ | 733 | /* fill out dma descriptor to match a given request */ |
@@ -744,8 +744,8 @@ static void fill_dma_desc(struct net2280_ep *ep, | |||
744 | */ | 744 | */ |
745 | if (ep->is_in) | 745 | if (ep->is_in) |
746 | dmacount |= BIT(DMA_DIRECTION); | 746 | dmacount |= BIT(DMA_DIRECTION); |
747 | if ((!ep->is_in && (dmacount % ep->ep.maxpacket) != 0) | 747 | if ((!ep->is_in && (dmacount % ep->ep.maxpacket) != 0) || |
748 | || ep->dev->pdev->device != 0x2280) | 748 | ep->dev->pdev->device != 0x2280) |
749 | dmacount |= BIT(END_OF_CHAIN); | 749 | dmacount |= BIT(END_OF_CHAIN); |
750 | 750 | ||
751 | req->valid = valid; | 751 | req->valid = valid; |
@@ -836,8 +836,8 @@ static void start_dma(struct net2280_ep *ep, struct net2280_request *req) | |||
836 | 836 | ||
837 | /* dma irq, faking scatterlist status */ | 837 | /* dma irq, faking scatterlist status */ |
838 | req->td->dmacount = cpu_to_le32(req->req.length - tmp); | 838 | req->td->dmacount = cpu_to_le32(req->req.length - tmp); |
839 | writel(BIT(DMA_DONE_INTERRUPT_ENABLE) | 839 | writel(BIT(DMA_DONE_INTERRUPT_ENABLE) | tmp, |
840 | | tmp, &dma->dmacount); | 840 | &dma->dmacount); |
841 | req->td->dmadesc = 0; | 841 | req->td->dmadesc = 0; |
842 | req->valid = 1; | 842 | req->valid = 1; |
843 | 843 | ||
@@ -1120,8 +1120,8 @@ static void scan_dma_completions(struct net2280_ep *ep) | |||
1120 | /* single transfer mode */ | 1120 | /* single transfer mode */ |
1121 | dma_done(ep, req, tmp, 0); | 1121 | dma_done(ep, req, tmp, 0); |
1122 | break; | 1122 | break; |
1123 | } else if (!ep->is_in | 1123 | } else if (!ep->is_in && |
1124 | && (req->req.length % ep->ep.maxpacket) != 0) { | 1124 | (req->req.length % ep->ep.maxpacket) != 0) { |
1125 | tmp = readl(&ep->regs->ep_stat); | 1125 | tmp = readl(&ep->regs->ep_stat); |
1126 | if (ep->dev->pdev->vendor == PCI_VENDOR_ID_PLX) | 1126 | if (ep->dev->pdev->vendor == PCI_VENDOR_ID_PLX) |
1127 | return dma_done(ep, req, tmp, 0); | 1127 | return dma_done(ep, req, tmp, 0); |
@@ -1317,8 +1317,8 @@ static int net2280_dequeue(struct usb_ep *_ep, struct usb_request *_req) | |||
1317 | writel(le32_to_cpu(req->td->dmadesc), | 1317 | writel(le32_to_cpu(req->td->dmadesc), |
1318 | &ep->dma->dmadesc); | 1318 | &ep->dma->dmadesc); |
1319 | if (req->td->dmacount & dma_done_ie) | 1319 | if (req->td->dmacount & dma_done_ie) |
1320 | writel(readl(&ep->dma->dmacount) | 1320 | writel(readl(&ep->dma->dmacount) | |
1321 | | le32_to_cpu(dma_done_ie), | 1321 | le32_to_cpu(dma_done_ie), |
1322 | &ep->dma->dmacount); | 1322 | &ep->dma->dmacount); |
1323 | } else { | 1323 | } else { |
1324 | struct net2280_request *prev; | 1324 | struct net2280_request *prev; |
@@ -2255,8 +2255,8 @@ static void ep0_start_228x(struct net2280 *dev) | |||
2255 | { | 2255 | { |
2256 | writel(BIT(CLEAR_EP_HIDE_STATUS_PHASE) | | 2256 | writel(BIT(CLEAR_EP_HIDE_STATUS_PHASE) | |
2257 | BIT(CLEAR_NAK_OUT_PACKETS) | | 2257 | BIT(CLEAR_NAK_OUT_PACKETS) | |
2258 | BIT(CLEAR_CONTROL_STATUS_PHASE_HANDSHAKE) | 2258 | BIT(CLEAR_CONTROL_STATUS_PHASE_HANDSHAKE), |
2259 | , &dev->epregs[0].ep_rsp); | 2259 | &dev->epregs[0].ep_rsp); |
2260 | 2260 | ||
2261 | /* | 2261 | /* |
2262 | * hardware optionally handles a bunch of standard requests | 2262 | * hardware optionally handles a bunch of standard requests |
@@ -2268,8 +2268,8 @@ static void ep0_start_228x(struct net2280 *dev) | |||
2268 | BIT(SET_ADDRESS) | | 2268 | BIT(SET_ADDRESS) | |
2269 | BIT(DEVICE_SET_CLEAR_DEVICE_REMOTE_WAKEUP) | | 2269 | BIT(DEVICE_SET_CLEAR_DEVICE_REMOTE_WAKEUP) | |
2270 | BIT(GET_DEVICE_STATUS) | | 2270 | BIT(GET_DEVICE_STATUS) | |
2271 | BIT(GET_INTERFACE_STATUS) | 2271 | BIT(GET_INTERFACE_STATUS), |
2272 | , &dev->usb->stdrsp); | 2272 | &dev->usb->stdrsp); |
2273 | writel(BIT(USB_ROOT_PORT_WAKEUP_ENABLE) | | 2273 | writel(BIT(USB_ROOT_PORT_WAKEUP_ENABLE) | |
2274 | BIT(SELF_POWERED_USB_DEVICE) | | 2274 | BIT(SELF_POWERED_USB_DEVICE) | |
2275 | BIT(REMOTE_WAKEUP_SUPPORT) | | 2275 | BIT(REMOTE_WAKEUP_SUPPORT) | |
@@ -2330,8 +2330,8 @@ static void ep0_start_338x(struct net2280 *dev) | |||
2330 | 2330 | ||
2331 | /* enable irqs so we can see ep0 and general operation */ | 2331 | /* enable irqs so we can see ep0 and general operation */ |
2332 | writel(BIT(SETUP_PACKET_INTERRUPT_ENABLE) | | 2332 | writel(BIT(SETUP_PACKET_INTERRUPT_ENABLE) | |
2333 | BIT(ENDPOINT_0_INTERRUPT_ENABLE) | 2333 | BIT(ENDPOINT_0_INTERRUPT_ENABLE), |
2334 | , &dev->regs->pciirqenb0); | 2334 | &dev->regs->pciirqenb0); |
2335 | writel(BIT(PCI_INTERRUPT_ENABLE) | | 2335 | writel(BIT(PCI_INTERRUPT_ENABLE) | |
2336 | BIT(ROOT_PORT_RESET_INTERRUPT_ENABLE) | | 2336 | BIT(ROOT_PORT_RESET_INTERRUPT_ENABLE) | |
2337 | BIT(SUSPEND_REQUEST_CHANGE_INTERRUPT_ENABLE) | | 2337 | BIT(SUSPEND_REQUEST_CHANGE_INTERRUPT_ENABLE) | |
@@ -2366,8 +2366,8 @@ static int net2280_start(struct usb_gadget *_gadget, | |||
2366 | * (dev->usb->xcvrdiag & FORCE_FULL_SPEED_MODE) | 2366 | * (dev->usb->xcvrdiag & FORCE_FULL_SPEED_MODE) |
2367 | * "must not be used in normal operation" | 2367 | * "must not be used in normal operation" |
2368 | */ | 2368 | */ |
2369 | if (!driver || driver->max_speed < USB_SPEED_HIGH | 2369 | if (!driver || driver->max_speed < USB_SPEED_HIGH || |
2370 | || !driver->setup) | 2370 | !driver->setup) |
2371 | return -EINVAL; | 2371 | return -EINVAL; |
2372 | 2372 | ||
2373 | dev = container_of(_gadget, struct net2280, gadget); | 2373 | dev = container_of(_gadget, struct net2280, gadget); |
@@ -2542,10 +2542,10 @@ static void handle_ep_small(struct net2280_ep *ep) | |||
2542 | } | 2542 | } |
2543 | mode = 2; | 2543 | mode = 2; |
2544 | /* an extra OUT token is an error */ | 2544 | /* an extra OUT token is an error */ |
2545 | } else if (((t & BIT(DATA_OUT_PING_TOKEN_INTERRUPT)) | 2545 | } else if (((t & BIT(DATA_OUT_PING_TOKEN_INTERRUPT)) && |
2546 | && req | 2546 | req && |
2547 | && req->req.actual == req->req.length) | 2547 | req->req.actual == req->req.length) || |
2548 | || (ep->responded && !req)) { | 2548 | (ep->responded && !req)) { |
2549 | ep->dev->protocol_stall = 1; | 2549 | ep->dev->protocol_stall = 1; |
2550 | set_halt(ep); | 2550 | set_halt(ep); |
2551 | ep->stopped = 1; | 2551 | ep->stopped = 1; |
@@ -2576,8 +2576,8 @@ static void handle_ep_small(struct net2280_ep *ep) | |||
2576 | * dma handles (M >= N), may empty the queue | 2576 | * dma handles (M >= N), may empty the queue |
2577 | */ | 2577 | */ |
2578 | scan_dma_completions(ep); | 2578 | scan_dma_completions(ep); |
2579 | if (unlikely(list_empty(&ep->queue) | 2579 | if (unlikely(list_empty(&ep->queue) || |
2580 | || ep->out_overflow)) { | 2580 | ep->out_overflow)) { |
2581 | req = NULL; | 2581 | req = NULL; |
2582 | break; | 2582 | break; |
2583 | } | 2583 | } |
@@ -2611,10 +2611,10 @@ static void handle_ep_small(struct net2280_ep *ep) | |||
2611 | } | 2611 | } |
2612 | 2612 | ||
2613 | /* also flush to prevent erratum 0106 trouble */ | 2613 | /* also flush to prevent erratum 0106 trouble */ |
2614 | if (unlikely(ep->out_overflow | 2614 | if (unlikely(ep->out_overflow || |
2615 | || (ep->dev->chiprev == 0x0100 | 2615 | (ep->dev->chiprev == 0x0100 && |
2616 | && ep->dev->gadget.speed | 2616 | ep->dev->gadget.speed |
2617 | == USB_SPEED_FULL))) { | 2617 | == USB_SPEED_FULL))) { |
2618 | out_flush(ep); | 2618 | out_flush(ep); |
2619 | ep->out_overflow = 0; | 2619 | ep->out_overflow = 0; |
2620 | } | 2620 | } |
@@ -2808,9 +2808,9 @@ static void ep_stall(struct net2280_ep *ep, int stall) | |||
2808 | val = readl(&ep->regs->ep_rsp); | 2808 | val = readl(&ep->regs->ep_rsp); |
2809 | val |= BIT(CLEAR_ENDPOINT_HALT) | | 2809 | val |= BIT(CLEAR_ENDPOINT_HALT) | |
2810 | BIT(CLEAR_ENDPOINT_TOGGLE); | 2810 | BIT(CLEAR_ENDPOINT_TOGGLE); |
2811 | writel(val | 2811 | writel(val, |
2812 | /* | BIT(CLEAR_NAK_PACKETS)*/ | 2812 | /* | BIT(CLEAR_NAK_PACKETS),*/ |
2813 | , &ep->regs->ep_rsp); | 2813 | &ep->regs->ep_rsp); |
2814 | ep->is_halt = 0; | 2814 | ep->is_halt = 0; |
2815 | val = readl(&ep->regs->ep_rsp); | 2815 | val = readl(&ep->regs->ep_rsp); |
2816 | } | 2816 | } |
@@ -3125,8 +3125,8 @@ static void handle_stat0_irqs(struct net2280 *dev, u32 stat) | |||
3125 | BIT(DATA_PACKET_RECEIVED_INTERRUPT) | | 3125 | BIT(DATA_PACKET_RECEIVED_INTERRUPT) | |
3126 | BIT(DATA_PACKET_TRANSMITTED_INTERRUPT) | | 3126 | BIT(DATA_PACKET_TRANSMITTED_INTERRUPT) | |
3127 | BIT(DATA_OUT_PING_TOKEN_INTERRUPT) | | 3127 | BIT(DATA_OUT_PING_TOKEN_INTERRUPT) | |
3128 | BIT(DATA_IN_TOKEN_INTERRUPT) | 3128 | BIT(DATA_IN_TOKEN_INTERRUPT), |
3129 | , &ep->regs->ep_stat); | 3129 | &ep->regs->ep_stat); |
3130 | } | 3130 | } |
3131 | u.raw[0] = readl(&dev->usb->setup0123); | 3131 | u.raw[0] = readl(&dev->usb->setup0123); |
3132 | u.raw[1] = readl(&dev->usb->setup4567); | 3132 | u.raw[1] = readl(&dev->usb->setup4567); |
@@ -3206,8 +3206,7 @@ static void handle_stat0_irqs(struct net2280 *dev, u32 stat) | |||
3206 | /* hw handles device features */ | 3206 | /* hw handles device features */ |
3207 | if (u.r.bRequestType != USB_RECIP_ENDPOINT) | 3207 | if (u.r.bRequestType != USB_RECIP_ENDPOINT) |
3208 | goto delegate; | 3208 | goto delegate; |
3209 | if (w_value != USB_ENDPOINT_HALT | 3209 | if (w_value != USB_ENDPOINT_HALT || w_length != 0) |
3210 | || w_length != 0) | ||
3211 | goto do_stall; | 3210 | goto do_stall; |
3212 | e = get_ep_by_addr(dev, w_index); | 3211 | e = get_ep_by_addr(dev, w_index); |
3213 | if (!e) | 3212 | if (!e) |
@@ -3233,8 +3232,7 @@ static void handle_stat0_irqs(struct net2280 *dev, u32 stat) | |||
3233 | /* hw handles device features */ | 3232 | /* hw handles device features */ |
3234 | if (u.r.bRequestType != USB_RECIP_ENDPOINT) | 3233 | if (u.r.bRequestType != USB_RECIP_ENDPOINT) |
3235 | goto delegate; | 3234 | goto delegate; |
3236 | if (w_value != USB_ENDPOINT_HALT | 3235 | if (w_value != USB_ENDPOINT_HALT || w_length != 0) |
3237 | || w_length != 0) | ||
3238 | goto do_stall; | 3236 | goto do_stall; |
3239 | e = get_ep_by_addr(dev, w_index); | 3237 | e = get_ep_by_addr(dev, w_index); |
3240 | if (!e) | 3238 | if (!e) |
@@ -3326,12 +3324,11 @@ static void handle_stat1_irqs(struct net2280 *dev, u32 stat) | |||
3326 | */ | 3324 | */ |
3327 | if (stat & tmp) { | 3325 | if (stat & tmp) { |
3328 | writel(tmp, &dev->regs->irqstat1); | 3326 | writel(tmp, &dev->regs->irqstat1); |
3329 | if ((((stat & BIT(ROOT_PORT_RESET_INTERRUPT)) | 3327 | if ((((stat & BIT(ROOT_PORT_RESET_INTERRUPT)) && |
3330 | && ((readl(&dev->usb->usbstat) & mask) | 3328 | (readl(&dev->usb->usbstat) & mask)) || |
3331 | == 0)) | 3329 | ((readl(&dev->usb->usbctl) & |
3332 | || ((readl(&dev->usb->usbctl) | 3330 | BIT(VBUS_PIN)) == 0)) && |
3333 | & BIT(VBUS_PIN)) == 0) | 3331 | (dev->gadget.speed != USB_SPEED_UNKNOWN)) { |
3334 | ) && (dev->gadget.speed != USB_SPEED_UNKNOWN)) { | ||
3335 | DEBUG(dev, "disconnect %s\n", | 3332 | DEBUG(dev, "disconnect %s\n", |
3336 | dev->driver->driver.name); | 3333 | dev->driver->driver.name); |
3337 | stop_activity(dev, dev->driver); | 3334 | stop_activity(dev, dev->driver); |
@@ -3560,7 +3557,7 @@ static void net2280_remove(struct pci_dev *pdev) | |||
3560 | pci_disable_device(pdev); | 3557 | pci_disable_device(pdev); |
3561 | device_remove_file(&pdev->dev, &dev_attr_registers); | 3558 | device_remove_file(&pdev->dev, &dev_attr_registers); |
3562 | 3559 | ||
3563 | INFO (dev, "unbind\n"); | 3560 | INFO(dev, "unbind\n"); |
3564 | } | 3561 | } |
3565 | 3562 | ||
3566 | /* wrap this driver around the specified device, but | 3563 | /* wrap this driver around the specified device, but |
@@ -3783,29 +3780,29 @@ static const struct pci_device_id pci_ids[] = { { | |||
3783 | .device = 0x2280, | 3780 | .device = 0x2280, |
3784 | .subvendor = PCI_ANY_ID, | 3781 | .subvendor = PCI_ANY_ID, |
3785 | .subdevice = PCI_ANY_ID, | 3782 | .subdevice = PCI_ANY_ID, |
3786 | }, { | 3783 | }, { |
3787 | .class = ((PCI_CLASS_SERIAL_USB << 8) | 0xfe), | 3784 | .class = ((PCI_CLASS_SERIAL_USB << 8) | 0xfe), |
3788 | .class_mask = ~0, | 3785 | .class_mask = ~0, |
3789 | .vendor = PCI_VENDOR_ID_PLX_LEGACY, | 3786 | .vendor = PCI_VENDOR_ID_PLX_LEGACY, |
3790 | .device = 0x2282, | 3787 | .device = 0x2282, |
3791 | .subvendor = PCI_ANY_ID, | 3788 | .subvendor = PCI_ANY_ID, |
3792 | .subdevice = PCI_ANY_ID, | 3789 | .subdevice = PCI_ANY_ID, |
3793 | }, | 3790 | }, |
3794 | { | 3791 | { |
3795 | .class = ((PCI_CLASS_SERIAL_USB << 8) | 0xfe), | 3792 | .class = ((PCI_CLASS_SERIAL_USB << 8) | 0xfe), |
3796 | .class_mask = ~0, | 3793 | .class_mask = ~0, |
3797 | .vendor = PCI_VENDOR_ID_PLX, | 3794 | .vendor = PCI_VENDOR_ID_PLX, |
3798 | .device = 0x3380, | 3795 | .device = 0x3380, |
3799 | .subvendor = PCI_ANY_ID, | 3796 | .subvendor = PCI_ANY_ID, |
3800 | .subdevice = PCI_ANY_ID, | 3797 | .subdevice = PCI_ANY_ID, |
3801 | }, | 3798 | }, |
3802 | { | 3799 | { |
3803 | .class = ((PCI_CLASS_SERIAL_USB << 8) | 0xfe), | 3800 | .class = ((PCI_CLASS_SERIAL_USB << 8) | 0xfe), |
3804 | .class_mask = ~0, | 3801 | .class_mask = ~0, |
3805 | .vendor = PCI_VENDOR_ID_PLX, | 3802 | .vendor = PCI_VENDOR_ID_PLX, |
3806 | .device = 0x3382, | 3803 | .device = 0x3382, |
3807 | .subvendor = PCI_ANY_ID, | 3804 | .subvendor = PCI_ANY_ID, |
3808 | .subdevice = PCI_ANY_ID, | 3805 | .subdevice = PCI_ANY_ID, |
3809 | }, | 3806 | }, |
3810 | { /* end: all zeroes */ } | 3807 | { /* end: all zeroes */ } |
3811 | }; | 3808 | }; |
diff --git a/drivers/usb/gadget/net2280.h b/drivers/usb/gadget/net2280.h index f019d6c74fc3..77c39d9f6d8a 100644 --- a/drivers/usb/gadget/net2280.h +++ b/drivers/usb/gadget/net2280.h | |||
@@ -117,8 +117,8 @@ static inline void allow_status(struct net2280_ep *ep) | |||
117 | /* ep0 only */ | 117 | /* ep0 only */ |
118 | writel(BIT(CLEAR_CONTROL_STATUS_PHASE_HANDSHAKE) | | 118 | writel(BIT(CLEAR_CONTROL_STATUS_PHASE_HANDSHAKE) | |
119 | BIT(CLEAR_NAK_OUT_PACKETS) | | 119 | BIT(CLEAR_NAK_OUT_PACKETS) | |
120 | BIT(CLEAR_NAK_OUT_PACKETS_MODE) | 120 | BIT(CLEAR_NAK_OUT_PACKETS_MODE), |
121 | , &ep->regs->ep_rsp); | 121 | &ep->regs->ep_rsp); |
122 | ep->stopped = 1; | 122 | ep->stopped = 1; |
123 | } | 123 | } |
124 | 124 | ||