diff options
Diffstat (limited to 'drivers/usb/host/r8a66597-hcd.c')
-rw-r--r-- | drivers/usb/host/r8a66597-hcd.c | 44 |
1 files changed, 36 insertions, 8 deletions
diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c index 16667342b3c3..d5f02dddb120 100644 --- a/drivers/usb/host/r8a66597-hcd.c +++ b/drivers/usb/host/r8a66597-hcd.c | |||
@@ -312,9 +312,9 @@ static void put_child_connect_map(struct r8a66597 *r8a66597, int address) | |||
312 | static void set_pipe_reg_addr(struct r8a66597_pipe *pipe, u8 dma_ch) | 312 | static void set_pipe_reg_addr(struct r8a66597_pipe *pipe, u8 dma_ch) |
313 | { | 313 | { |
314 | u16 pipenum = pipe->info.pipenum; | 314 | u16 pipenum = pipe->info.pipenum; |
315 | unsigned long fifoaddr[] = {D0FIFO, D1FIFO, CFIFO}; | 315 | const unsigned long fifoaddr[] = {D0FIFO, D1FIFO, CFIFO}; |
316 | unsigned long fifosel[] = {D0FIFOSEL, D1FIFOSEL, CFIFOSEL}; | 316 | const unsigned long fifosel[] = {D0FIFOSEL, D1FIFOSEL, CFIFOSEL}; |
317 | unsigned long fifoctr[] = {D0FIFOCTR, D1FIFOCTR, CFIFOCTR}; | 317 | const unsigned long fifoctr[] = {D0FIFOCTR, D1FIFOCTR, CFIFOCTR}; |
318 | 318 | ||
319 | if (dma_ch > R8A66597_PIPE_NO_DMA) /* dma fifo not use? */ | 319 | if (dma_ch > R8A66597_PIPE_NO_DMA) /* dma fifo not use? */ |
320 | dma_ch = R8A66597_PIPE_NO_DMA; | 320 | dma_ch = R8A66597_PIPE_NO_DMA; |
@@ -863,6 +863,32 @@ static void disable_r8a66597_pipe_all(struct r8a66597 *r8a66597, | |||
863 | dev->dma_map = 0; | 863 | dev->dma_map = 0; |
864 | } | 864 | } |
865 | 865 | ||
866 | static u16 get_interval(struct urb *urb, __u8 interval) | ||
867 | { | ||
868 | u16 time = 1; | ||
869 | int i; | ||
870 | |||
871 | if (urb->dev->speed == USB_SPEED_HIGH) { | ||
872 | if (interval > IITV) | ||
873 | time = IITV; | ||
874 | else | ||
875 | time = interval ? interval - 1 : 0; | ||
876 | } else { | ||
877 | if (interval > 128) { | ||
878 | time = IITV; | ||
879 | } else { | ||
880 | /* calculate the nearest value for PIPEPERI */ | ||
881 | for (i = 0; i < 7; i++) { | ||
882 | if ((1 << i) < interval && | ||
883 | (1 << (i + 1) > interval)) | ||
884 | time = 1 << i; | ||
885 | } | ||
886 | } | ||
887 | } | ||
888 | |||
889 | return time; | ||
890 | } | ||
891 | |||
866 | static unsigned long get_timer_interval(struct urb *urb, __u8 interval) | 892 | static unsigned long get_timer_interval(struct urb *urb, __u8 interval) |
867 | { | 893 | { |
868 | __u8 i; | 894 | __u8 i; |
@@ -901,10 +927,7 @@ static void init_pipe_info(struct r8a66597 *r8a66597, struct urb *urb, | |||
901 | info.interval = 0; | 927 | info.interval = 0; |
902 | info.timer_interval = 0; | 928 | info.timer_interval = 0; |
903 | } else { | 929 | } else { |
904 | if (ep->bInterval > IITV) | 930 | info.interval = get_interval(urb, ep->bInterval); |
905 | info.interval = IITV; | ||
906 | else | ||
907 | info.interval = ep->bInterval ? ep->bInterval - 1 : 0; | ||
908 | info.timer_interval = get_timer_interval(urb, ep->bInterval); | 931 | info.timer_interval = get_timer_interval(urb, ep->bInterval); |
909 | } | 932 | } |
910 | if (ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK) | 933 | if (ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK) |
@@ -2244,6 +2267,7 @@ static int __init r8a66597_probe(struct platform_device *pdev) | |||
2244 | struct r8a66597 *r8a66597; | 2267 | struct r8a66597 *r8a66597; |
2245 | int ret = 0; | 2268 | int ret = 0; |
2246 | int i; | 2269 | int i; |
2270 | unsigned long irq_trigger; | ||
2247 | 2271 | ||
2248 | if (pdev->dev.dma_mask) { | 2272 | if (pdev->dev.dma_mask) { |
2249 | ret = -EINVAL; | 2273 | ret = -EINVAL; |
@@ -2302,7 +2326,11 @@ static int __init r8a66597_probe(struct platform_device *pdev) | |||
2302 | INIT_LIST_HEAD(&r8a66597->child_device); | 2326 | INIT_LIST_HEAD(&r8a66597->child_device); |
2303 | 2327 | ||
2304 | hcd->rsrc_start = res->start; | 2328 | hcd->rsrc_start = res->start; |
2305 | ret = usb_add_hcd(hcd, irq, IRQF_DISABLED); | 2329 | if (irq_sense == INTL) |
2330 | irq_trigger = IRQF_TRIGGER_LOW; | ||
2331 | else | ||
2332 | irq_trigger = IRQF_TRIGGER_FALLING; | ||
2333 | ret = usb_add_hcd(hcd, irq, IRQF_DISABLED | irq_trigger); | ||
2306 | if (ret != 0) { | 2334 | if (ret != 0) { |
2307 | err("Failed to add hcd"); | 2335 | err("Failed to add hcd"); |
2308 | goto clean_up; | 2336 | goto clean_up; |