aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host
diff options
context:
space:
mode:
authorYoshihiro Shimoda <shimoda.yoshihiro@renesas.com>2008-06-27 06:09:58 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2008-07-21 18:16:35 -0400
commit397f519a0d771a6bddbcd71a31da6880e81c2e6b (patch)
treed4bc7f296b2d9296fe917ffadcfe6a698a296616 /drivers/usb/host
parent0bf32b807ff28bb71012f60660e97e79408252ce (diff)
usb: r8a66597-hcd: fix iinterval for Full/Low speed device
fix interrupt transfer interval for Full/Low speed device. Signed-off-by: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/host')
-rw-r--r--drivers/usb/host/r8a66597-hcd.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c
index 4db0107f3178..d5f02dddb120 100644
--- a/drivers/usb/host/r8a66597-hcd.c
+++ b/drivers/usb/host/r8a66597-hcd.c
@@ -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
866static 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
866static unsigned long get_timer_interval(struct urb *urb, __u8 interval) 892static 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)