ehci-sched.c (f0eef25339f92f7cd4aeea23d9ae97987a5a1e82) | ehci-sched.c (083522d76662cda71328df1f3d75e5a9057c7c9f) |
---|---|
1/* 2 * Copyright (c) 2001-2004 by David Brownell 3 * Copyright (c) 2003 Michal Sojka, for high-speed iso transfers 4 * 5 * This program is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License as published by the 7 * Free Software Foundation; either version 2 of the License, or (at your 8 * option) any later version. --- 419 unchanged lines hidden (view full) --- 428static int enable_periodic (struct ehci_hcd *ehci) 429{ 430 u32 cmd; 431 int status; 432 433 /* did clearing PSE did take effect yet? 434 * takes effect only at frame boundaries... 435 */ | 1/* 2 * Copyright (c) 2001-2004 by David Brownell 3 * Copyright (c) 2003 Michal Sojka, for high-speed iso transfers 4 * 5 * This program is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License as published by the 7 * Free Software Foundation; either version 2 of the License, or (at your 8 * option) any later version. --- 419 unchanged lines hidden (view full) --- 428static int enable_periodic (struct ehci_hcd *ehci) 429{ 430 u32 cmd; 431 int status; 432 433 /* did clearing PSE did take effect yet? 434 * takes effect only at frame boundaries... 435 */ |
436 status = handshake (&ehci->regs->status, STS_PSS, 0, 9 * 125); | 436 status = handshake(ehci, &ehci->regs->status, STS_PSS, 0, 9 * 125); |
437 if (status != 0) { 438 ehci_to_hcd(ehci)->state = HC_STATE_HALT; 439 return status; 440 } 441 | 437 if (status != 0) { 438 ehci_to_hcd(ehci)->state = HC_STATE_HALT; 439 return status; 440 } 441 |
442 cmd = readl (&ehci->regs->command) | CMD_PSE; 443 writel (cmd, &ehci->regs->command); | 442 cmd = ehci_readl(ehci, &ehci->regs->command) | CMD_PSE; 443 ehci_writel(ehci, cmd, &ehci->regs->command); |
444 /* posted write ... PSS happens later */ 445 ehci_to_hcd(ehci)->state = HC_STATE_RUNNING; 446 447 /* make sure ehci_work scans these */ | 444 /* posted write ... PSS happens later */ 445 ehci_to_hcd(ehci)->state = HC_STATE_RUNNING; 446 447 /* make sure ehci_work scans these */ |
448 ehci->next_uframe = readl (&ehci->regs->frame_index) 449 % (ehci->periodic_size << 3); | 448 ehci->next_uframe = ehci_readl(ehci, &ehci->regs->frame_index) 449 % (ehci->periodic_size << 3); |
450 return 0; 451} 452 453static int disable_periodic (struct ehci_hcd *ehci) 454{ 455 u32 cmd; 456 int status; 457 458 /* did setting PSE not take effect yet? 459 * takes effect only at frame boundaries... 460 */ | 450 return 0; 451} 452 453static int disable_periodic (struct ehci_hcd *ehci) 454{ 455 u32 cmd; 456 int status; 457 458 /* did setting PSE not take effect yet? 459 * takes effect only at frame boundaries... 460 */ |
461 status = handshake (&ehci->regs->status, STS_PSS, STS_PSS, 9 * 125); | 461 status = handshake(ehci, &ehci->regs->status, STS_PSS, STS_PSS, 9 * 125); |
462 if (status != 0) { 463 ehci_to_hcd(ehci)->state = HC_STATE_HALT; 464 return status; 465 } 466 | 462 if (status != 0) { 463 ehci_to_hcd(ehci)->state = HC_STATE_HALT; 464 return status; 465 } 466 |
467 cmd = readl (&ehci->regs->command) & ~CMD_PSE; 468 writel (cmd, &ehci->regs->command); | 467 cmd = ehci_readl(ehci, &ehci->regs->command) & ~CMD_PSE; 468 ehci_writel(ehci, cmd, &ehci->regs->command); |
469 /* posted write ... */ 470 471 ehci->next_uframe = -1; 472 return 0; 473} 474 475/*-------------------------------------------------------------------------*/ 476 --- 854 unchanged lines hidden (view full) --- 1331 1332 if ((stream->depth + sched->span) > mod) { 1333 ehci_dbg (ehci, "request %p would overflow (%d+%d>%d)\n", 1334 urb, stream->depth, sched->span, mod); 1335 status = -EFBIG; 1336 goto fail; 1337 } 1338 | 469 /* posted write ... */ 470 471 ehci->next_uframe = -1; 472 return 0; 473} 474 475/*-------------------------------------------------------------------------*/ 476 --- 854 unchanged lines hidden (view full) --- 1331 1332 if ((stream->depth + sched->span) > mod) { 1333 ehci_dbg (ehci, "request %p would overflow (%d+%d>%d)\n", 1334 urb, stream->depth, sched->span, mod); 1335 status = -EFBIG; 1336 goto fail; 1337 } 1338 |
1339 now = readl (&ehci->regs->frame_index) % mod; | 1339 now = ehci_readl(ehci, &ehci->regs->frame_index) % mod; |
1340 1341 /* when's the last uframe this urb could start? */ 1342 max = now + mod; 1343 1344 /* typical case: reuse current schedule. stream is still active, 1345 * and no gaps from host falling behind (irq delays etc) 1346 */ 1347 if (likely (!list_empty (&stream->td_list))) { --- 735 unchanged lines hidden (view full) --- 2083 2084 /* 2085 * When running, scan from last scan point up to "now" 2086 * else clean up by scanning everything that's left. 2087 * Touches as few pages as possible: cache-friendly. 2088 */ 2089 now_uframe = ehci->next_uframe; 2090 if (HC_IS_RUNNING (ehci_to_hcd(ehci)->state)) | 1340 1341 /* when's the last uframe this urb could start? */ 1342 max = now + mod; 1343 1344 /* typical case: reuse current schedule. stream is still active, 1345 * and no gaps from host falling behind (irq delays etc) 1346 */ 1347 if (likely (!list_empty (&stream->td_list))) { --- 735 unchanged lines hidden (view full) --- 2083 2084 /* 2085 * When running, scan from last scan point up to "now" 2086 * else clean up by scanning everything that's left. 2087 * Touches as few pages as possible: cache-friendly. 2088 */ 2089 now_uframe = ehci->next_uframe; 2090 if (HC_IS_RUNNING (ehci_to_hcd(ehci)->state)) |
2091 clock = readl (&ehci->regs->frame_index); | 2091 clock = ehci_readl(ehci, &ehci->regs->frame_index); |
2092 else 2093 clock = now_uframe + mod - 1; 2094 clock %= mod; 2095 2096 for (;;) { 2097 union ehci_shadow q, *q_p; 2098 __le32 type, *hw_p; 2099 unsigned uframes; --- 108 unchanged lines hidden (view full) --- 2208 // FIXME: likewise assumes HC doesn't halt mid-scan 2209 2210 if (now_uframe == clock) { 2211 unsigned now; 2212 2213 if (!HC_IS_RUNNING (ehci_to_hcd(ehci)->state)) 2214 break; 2215 ehci->next_uframe = now_uframe; | 2092 else 2093 clock = now_uframe + mod - 1; 2094 clock %= mod; 2095 2096 for (;;) { 2097 union ehci_shadow q, *q_p; 2098 __le32 type, *hw_p; 2099 unsigned uframes; --- 108 unchanged lines hidden (view full) --- 2208 // FIXME: likewise assumes HC doesn't halt mid-scan 2209 2210 if (now_uframe == clock) { 2211 unsigned now; 2212 2213 if (!HC_IS_RUNNING (ehci_to_hcd(ehci)->state)) 2214 break; 2215 ehci->next_uframe = now_uframe; |
2216 now = readl (&ehci->regs->frame_index) % mod; | 2216 now = ehci_readl(ehci, &ehci->regs->frame_index) % mod; |
2217 if (now_uframe == now) 2218 break; 2219 2220 /* rescan the rest of this frame, then ... */ 2221 clock = now; 2222 } else { 2223 now_uframe++; 2224 now_uframe %= mod; 2225 } 2226 } 2227} | 2217 if (now_uframe == now) 2218 break; 2219 2220 /* rescan the rest of this frame, then ... */ 2221 clock = now; 2222 } else { 2223 now_uframe++; 2224 now_uframe %= mod; 2225 } 2226 } 2227} |