Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 104605
b: refs/heads/master
c: 397f519
h: refs/heads/master
i:
  104603: 5e00c1e
v: v3
  • Loading branch information
Yoshihiro Shimoda authored and Greg Kroah-Hartman committed Jul 21, 2008
1 parent f80f3f8 commit 789c587
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0bf32b807ff28bb71012f60660e97e79408252ce
refs/heads/master: 397f519a0d771a6bddbcd71a31da6880e81c2e6b
31 changes: 27 additions & 4 deletions trunk/drivers/usb/host/r8a66597-hcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -863,6 +863,32 @@ static void disable_r8a66597_pipe_all(struct r8a66597 *r8a66597,
dev->dma_map = 0;
}

static u16 get_interval(struct urb *urb, __u8 interval)
{
u16 time = 1;
int i;

if (urb->dev->speed == USB_SPEED_HIGH) {
if (interval > IITV)
time = IITV;
else
time = interval ? interval - 1 : 0;
} else {
if (interval > 128) {
time = IITV;
} else {
/* calculate the nearest value for PIPEPERI */
for (i = 0; i < 7; i++) {
if ((1 << i) < interval &&
(1 << (i + 1) > interval))
time = 1 << i;
}
}
}

return time;
}

static unsigned long get_timer_interval(struct urb *urb, __u8 interval)
{
__u8 i;
Expand Down Expand Up @@ -901,10 +927,7 @@ static void init_pipe_info(struct r8a66597 *r8a66597, struct urb *urb,
info.interval = 0;
info.timer_interval = 0;
} else {
if (ep->bInterval > IITV)
info.interval = IITV;
else
info.interval = ep->bInterval ? ep->bInterval - 1 : 0;
info.interval = get_interval(urb, ep->bInterval);
info.timer_interval = get_timer_interval(urb, ep->bInterval);
}
if (ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK)
Expand Down

0 comments on commit 789c587

Please sign in to comment.