diff options
Diffstat (limited to 'drivers/usb/gadget/amd5536udc.c')
-rw-r--r-- | drivers/usb/gadget/amd5536udc.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/drivers/usb/gadget/amd5536udc.c b/drivers/usb/gadget/amd5536udc.c index fc6f3483be44..ce337cb5d137 100644 --- a/drivers/usb/gadget/amd5536udc.c +++ b/drivers/usb/gadget/amd5536udc.c | |||
@@ -328,6 +328,7 @@ udc_ep_enable(struct usb_ep *usbep, const struct usb_endpoint_descriptor *desc) | |||
328 | u32 tmp; | 328 | u32 tmp; |
329 | unsigned long iflags; | 329 | unsigned long iflags; |
330 | u8 udc_csr_epix; | 330 | u8 udc_csr_epix; |
331 | unsigned maxpacket; | ||
331 | 332 | ||
332 | if (!usbep | 333 | if (!usbep |
333 | || usbep->name == ep0_string | 334 | || usbep->name == ep0_string |
@@ -354,9 +355,10 @@ udc_ep_enable(struct usb_ep *usbep, const struct usb_endpoint_descriptor *desc) | |||
354 | writel(tmp, &dev->ep[ep->num].regs->ctl); | 355 | writel(tmp, &dev->ep[ep->num].regs->ctl); |
355 | 356 | ||
356 | /* set max packet size */ | 357 | /* set max packet size */ |
358 | maxpacket = le16_to_cpu(desc->wMaxPacketSize); | ||
357 | tmp = readl(&dev->ep[ep->num].regs->bufout_maxpkt); | 359 | tmp = readl(&dev->ep[ep->num].regs->bufout_maxpkt); |
358 | tmp = AMD_ADDBITS(tmp, desc->wMaxPacketSize, UDC_EP_MAX_PKT_SIZE); | 360 | tmp = AMD_ADDBITS(tmp, maxpacket, UDC_EP_MAX_PKT_SIZE); |
359 | ep->ep.maxpacket = desc->wMaxPacketSize; | 361 | ep->ep.maxpacket = maxpacket; |
360 | writel(tmp, &dev->ep[ep->num].regs->bufout_maxpkt); | 362 | writel(tmp, &dev->ep[ep->num].regs->bufout_maxpkt); |
361 | 363 | ||
362 | /* IN ep */ | 364 | /* IN ep */ |
@@ -370,8 +372,8 @@ udc_ep_enable(struct usb_ep *usbep, const struct usb_endpoint_descriptor *desc) | |||
370 | /* double buffering: fifo size = 2 x max packet size */ | 372 | /* double buffering: fifo size = 2 x max packet size */ |
371 | tmp = AMD_ADDBITS( | 373 | tmp = AMD_ADDBITS( |
372 | tmp, | 374 | tmp, |
373 | desc->wMaxPacketSize * UDC_EPIN_BUFF_SIZE_MULT | 375 | maxpacket * UDC_EPIN_BUFF_SIZE_MULT |
374 | / UDC_DWORD_BYTES, | 376 | / UDC_DWORD_BYTES, |
375 | UDC_EPIN_BUFF_SIZE); | 377 | UDC_EPIN_BUFF_SIZE); |
376 | writel(tmp, &dev->ep[ep->num].regs->bufin_framenum); | 378 | writel(tmp, &dev->ep[ep->num].regs->bufin_framenum); |
377 | 379 | ||
@@ -390,7 +392,7 @@ udc_ep_enable(struct usb_ep *usbep, const struct usb_endpoint_descriptor *desc) | |||
390 | 392 | ||
391 | /* set max packet size UDC CSR */ | 393 | /* set max packet size UDC CSR */ |
392 | tmp = readl(&dev->csr->ne[ep->num - UDC_CSR_EP_OUT_IX_OFS]); | 394 | tmp = readl(&dev->csr->ne[ep->num - UDC_CSR_EP_OUT_IX_OFS]); |
393 | tmp = AMD_ADDBITS(tmp, desc->wMaxPacketSize, | 395 | tmp = AMD_ADDBITS(tmp, maxpacket, |
394 | UDC_CSR_NE_MAX_PKT); | 396 | UDC_CSR_NE_MAX_PKT); |
395 | writel(tmp, &dev->csr->ne[ep->num - UDC_CSR_EP_OUT_IX_OFS]); | 397 | writel(tmp, &dev->csr->ne[ep->num - UDC_CSR_EP_OUT_IX_OFS]); |
396 | 398 | ||
@@ -407,7 +409,7 @@ udc_ep_enable(struct usb_ep *usbep, const struct usb_endpoint_descriptor *desc) | |||
407 | /* set ep values */ | 409 | /* set ep values */ |
408 | tmp = readl(&dev->csr->ne[udc_csr_epix]); | 410 | tmp = readl(&dev->csr->ne[udc_csr_epix]); |
409 | /* max packet */ | 411 | /* max packet */ |
410 | tmp = AMD_ADDBITS(tmp, desc->wMaxPacketSize, UDC_CSR_NE_MAX_PKT); | 412 | tmp = AMD_ADDBITS(tmp, maxpacket, UDC_CSR_NE_MAX_PKT); |
411 | /* ep number */ | 413 | /* ep number */ |
412 | tmp = AMD_ADDBITS(tmp, desc->bEndpointAddress, UDC_CSR_NE_NUM); | 414 | tmp = AMD_ADDBITS(tmp, desc->bEndpointAddress, UDC_CSR_NE_NUM); |
413 | /* ep direction */ | 415 | /* ep direction */ |
@@ -2832,7 +2834,7 @@ __acquires(dev->lock) | |||
2832 | /* make usb request for gadget driver */ | 2834 | /* make usb request for gadget driver */ |
2833 | memset(&setup_data, 0 , sizeof(union udc_setup_data)); | 2835 | memset(&setup_data, 0 , sizeof(union udc_setup_data)); |
2834 | setup_data.request.bRequest = USB_REQ_SET_CONFIGURATION; | 2836 | setup_data.request.bRequest = USB_REQ_SET_CONFIGURATION; |
2835 | setup_data.request.wValue = dev->cur_config; | 2837 | setup_data.request.wValue = cpu_to_le16(dev->cur_config); |
2836 | 2838 | ||
2837 | /* programm the NE registers */ | 2839 | /* programm the NE registers */ |
2838 | for (i = 0; i < UDC_EP_NUM; i++) { | 2840 | for (i = 0; i < UDC_EP_NUM; i++) { |
@@ -2881,8 +2883,8 @@ __acquires(dev->lock) | |||
2881 | memset(&setup_data, 0 , sizeof(union udc_setup_data)); | 2883 | memset(&setup_data, 0 , sizeof(union udc_setup_data)); |
2882 | setup_data.request.bRequest = USB_REQ_SET_INTERFACE; | 2884 | setup_data.request.bRequest = USB_REQ_SET_INTERFACE; |
2883 | setup_data.request.bRequestType = USB_RECIP_INTERFACE; | 2885 | setup_data.request.bRequestType = USB_RECIP_INTERFACE; |
2884 | setup_data.request.wValue = dev->cur_alt; | 2886 | setup_data.request.wValue = cpu_to_le16(dev->cur_alt); |
2885 | setup_data.request.wIndex = dev->cur_intf; | 2887 | setup_data.request.wIndex = cpu_to_le16(dev->cur_intf); |
2886 | 2888 | ||
2887 | DBG(dev, "SET_INTERFACE interrupt: alt=%d intf=%d\n", | 2889 | DBG(dev, "SET_INTERFACE interrupt: alt=%d intf=%d\n", |
2888 | dev->cur_alt, dev->cur_intf); | 2890 | dev->cur_alt, dev->cur_intf); |