Lines Matching +full:combined +full:- +full:power +full:- +full:req

1 // SPDX-License-Identifier: GPL-2.0
5 * Copyright (C) 2005 Lothar Wassmann <LW@KARO-electronics.de>
21 * 2. Implement platform-specific delay function possibly
22 * combined with configuring the memory controller; see
99 #define DRIVER_VERSION "2005-04-04"
105 static const char hcd_name[] = "isp1362-hcd";
110 /*-------------------------------------------------------------------------*/
113 * When called from the interrupthandler only isp1362_hcd->irqenb is modified,
114 * since the interrupt handler will write isp1362_hcd->irqenb to HCuPINT upon
121 if ((isp1362_hcd->irqenb | mask) == isp1362_hcd->irqenb) in isp1362_enable_int()
123 if (mask & ~isp1362_hcd->irqenb) in isp1362_enable_int()
124 isp1362_write_reg16(isp1362_hcd, HCuPINT, mask & ~isp1362_hcd->irqenb); in isp1362_enable_int()
125 isp1362_hcd->irqenb |= mask; in isp1362_enable_int()
126 if (isp1362_hcd->irq_active) in isp1362_enable_int()
128 isp1362_write_reg16(isp1362_hcd, HCuPINTENB, isp1362_hcd->irqenb); in isp1362_enable_int()
131 /*-------------------------------------------------------------------------*/
138 if (offset < isp1362_hcd->istl_queue[1].buf_start) in get_ptd_queue()
139 epq = &isp1362_hcd->istl_queue[0]; in get_ptd_queue()
140 else if (offset < isp1362_hcd->intl_queue.buf_start) in get_ptd_queue()
141 epq = &isp1362_hcd->istl_queue[1]; in get_ptd_queue()
142 else if (offset < isp1362_hcd->atl_queue.buf_start) in get_ptd_queue()
143 epq = &isp1362_hcd->intl_queue; in get_ptd_queue()
144 else if (offset < isp1362_hcd->atl_queue.buf_start + in get_ptd_queue()
145 isp1362_hcd->atl_queue.buf_size) in get_ptd_queue()
146 epq = &isp1362_hcd->atl_queue; in get_ptd_queue()
149 DBG(1, "%s: PTD $%04x is on %s queue\n", __func__, offset, epq->name); in get_ptd_queue()
160 if (index * epq->blk_size > epq->buf_size) { in get_ptd_offset()
162 __func__, epq->name, index, in get_ptd_offset()
163 epq->buf_size / epq->blk_size); in get_ptd_offset()
164 return -EINVAL; in get_ptd_offset()
166 offset = epq->buf_start + index * epq->blk_size; in get_ptd_offset()
167 DBG(3, "%s: %s PTD[%02x] # %04x\n", __func__, epq->name, index, offset); in get_ptd_offset()
172 /*-------------------------------------------------------------------------*/
179 xfer_size = min_t(size_t, xfer_size, epq->buf_avail * epq->blk_size - PTD_HEADER_SIZE); in max_transfer_size()
181 xfer_size -= xfer_size % mps; in max_transfer_size()
189 int ptd_offset = -EINVAL; in claim_ptd_buffers()
190 int num_ptds = ((len + PTD_HEADER_SIZE - 1) / epq->blk_size) + 1; in claim_ptd_buffers()
193 BUG_ON(len > epq->buf_size); in claim_ptd_buffers()
195 if (!epq->buf_avail) in claim_ptd_buffers()
196 return -ENOMEM; in claim_ptd_buffers()
198 if (ep->num_ptds) in claim_ptd_buffers()
200 epq->name, len, epq->blk_size, num_ptds, epq->buf_map, epq->skip_map); in claim_ptd_buffers()
201 BUG_ON(ep->num_ptds != 0); in claim_ptd_buffers()
203 found = bitmap_find_next_zero_area(&epq->buf_map, epq->buf_count, 0, in claim_ptd_buffers()
205 if (found >= epq->buf_count) in claim_ptd_buffers()
206 return -EOVERFLOW; in claim_ptd_buffers()
209 num_ptds, found, len, (int)(epq->blk_size - PTD_HEADER_SIZE)); in claim_ptd_buffers()
212 ep->ptd_offset = ptd_offset; in claim_ptd_buffers()
213 ep->num_ptds += num_ptds; in claim_ptd_buffers()
214 epq->buf_avail -= num_ptds; in claim_ptd_buffers()
215 BUG_ON(epq->buf_avail > epq->buf_count); in claim_ptd_buffers()
216 ep->ptd_index = found; in claim_ptd_buffers()
217 bitmap_set(&epq->buf_map, found, num_ptds); in claim_ptd_buffers()
219 __func__, epq->name, ep->ptd_index, ep->ptd_offset, in claim_ptd_buffers()
220 epq->buf_avail, epq->buf_count, num_ptds, epq->buf_map, epq->skip_map); in claim_ptd_buffers()
227 int last = ep->ptd_index + ep->num_ptds; in release_ptd_buffers()
229 if (last > epq->buf_count) in release_ptd_buffers()
230 …pr_err("%s: ep %p req %d len %d %s PTD[%d] $%04x num_ptds %d buf_count %d buf_avail %d buf_map %08… in release_ptd_buffers()
231 __func__, ep, ep->num_req, ep->length, epq->name, ep->ptd_index, in release_ptd_buffers()
232 ep->ptd_offset, ep->num_ptds, epq->buf_count, epq->buf_avail, in release_ptd_buffers()
233 epq->buf_map, epq->skip_map); in release_ptd_buffers()
234 BUG_ON(last > epq->buf_count); in release_ptd_buffers()
236 bitmap_clear(&epq->buf_map, ep->ptd_index, ep->num_ptds); in release_ptd_buffers()
237 bitmap_set(&epq->skip_map, ep->ptd_index, ep->num_ptds); in release_ptd_buffers()
238 epq->buf_avail += ep->num_ptds; in release_ptd_buffers()
239 epq->ptd_count--; in release_ptd_buffers()
241 BUG_ON(epq->buf_avail > epq->buf_count); in release_ptd_buffers()
242 BUG_ON(epq->ptd_count > epq->buf_count); in release_ptd_buffers()
245 __func__, epq->name, in release_ptd_buffers()
246 ep->ptd_offset, ep->num_ptds, epq->buf_avail, epq->buf_count); in release_ptd_buffers()
248 epq->buf_map, epq->skip_map); in release_ptd_buffers()
250 ep->num_ptds = 0; in release_ptd_buffers()
251 ep->ptd_offset = -EINVAL; in release_ptd_buffers()
252 ep->ptd_index = -EINVAL; in release_ptd_buffers()
255 /*-------------------------------------------------------------------------*/
268 size_t buf_len = urb->transfer_buffer_length - urb->actual_length; in prepare_ptd()
270 DBG(3, "%s: %s ep %p\n", __func__, epq->name, ep); in prepare_ptd()
272 ptd = &ep->ptd; in prepare_ptd()
274 ep->data = (unsigned char *)urb->transfer_buffer + urb->actual_length; in prepare_ptd()
276 switch (ep->nextpid) { in prepare_ptd()
278 toggle = usb_gettoggle(urb->dev, ep->epnum, 0); in prepare_ptd()
280 if (usb_pipecontrol(urb->pipe)) { in prepare_ptd()
281 len = min_t(size_t, ep->maxpacket, buf_len); in prepare_ptd()
282 } else if (usb_pipeisoc(urb->pipe)) { in prepare_ptd()
283 len = min_t(size_t, urb->iso_frame_desc[fno].length, MAX_XFER_SIZE); in prepare_ptd()
284 ep->data = urb->transfer_buffer + urb->iso_frame_desc[fno].offset; in prepare_ptd()
286 len = max_transfer_size(epq, buf_len, ep->maxpacket); in prepare_ptd()
287 DBG(1, "%s: IN len %d/%d/%d from URB\n", __func__, len, ep->maxpacket, in prepare_ptd()
291 toggle = usb_gettoggle(urb->dev, ep->epnum, 1); in prepare_ptd()
293 if (usb_pipecontrol(urb->pipe)) in prepare_ptd()
294 len = min_t(size_t, ep->maxpacket, buf_len); in prepare_ptd()
295 else if (usb_pipeisoc(urb->pipe)) in prepare_ptd()
296 len = min_t(size_t, urb->iso_frame_desc[0].length, MAX_XFER_SIZE); in prepare_ptd()
298 len = max_transfer_size(epq, buf_len, ep->maxpacket); in prepare_ptd()
301 urb->transfer_flags & URB_ZERO_PACKET); in prepare_ptd()
302 DBG(1, "%s: OUT len %d/%d/%d from URB\n", __func__, len, ep->maxpacket, in prepare_ptd()
310 ep->data = urb->setup_packet; in prepare_ptd()
315 dir = (urb->transfer_buffer_length && usb_pipein(urb->pipe)) ? in prepare_ptd()
321 pr_err("%s@%d: ep->nextpid %02x\n", __func__, __LINE__, ep->nextpid); in prepare_ptd()
325 ep->length = len; in prepare_ptd()
327 ep->data = NULL; in prepare_ptd()
329 ptd->count = PTD_CC_MSK | PTD_ACTIVE_MSK | PTD_TOGGLE(toggle); in prepare_ptd()
330 ptd->mps = PTD_MPS(ep->maxpacket) | PTD_SPD(urb->dev->speed == USB_SPEED_LOW) | in prepare_ptd()
331 PTD_EP(ep->epnum); in prepare_ptd()
332 ptd->len = PTD_LEN(len) | PTD_DIR(dir); in prepare_ptd()
333 ptd->faddr = PTD_FA(usb_pipedevice(urb->pipe)); in prepare_ptd()
335 if (usb_pipeint(urb->pipe)) { in prepare_ptd()
336 ptd->faddr |= PTD_SF_INT(ep->branch); in prepare_ptd()
337 ptd->faddr |= PTD_PR(ep->interval ? __ffs(ep->interval) : 0); in prepare_ptd()
339 if (usb_pipeisoc(urb->pipe)) in prepare_ptd()
340 ptd->faddr |= PTD_SF_ISO(fno); in prepare_ptd()
348 struct ptd *ptd = &ep->ptd; in isp1362_write_ptd()
349 int len = PTD_GET_DIR(ptd) == PTD_DIR_IN ? 0 : ep->length; in isp1362_write_ptd()
352 isp1362_write_buffer(isp1362_hcd, ptd, ep->ptd_offset, PTD_HEADER_SIZE); in isp1362_write_ptd()
354 isp1362_write_buffer(isp1362_hcd, ep->data, in isp1362_write_ptd()
355 ep->ptd_offset + PTD_HEADER_SIZE, len); in isp1362_write_ptd()
358 dump_ptd_out_data(ptd, ep->data); in isp1362_write_ptd()
364 struct ptd *ptd = &ep->ptd; in isp1362_read_ptd()
367 WARN_ON(list_empty(&ep->active)); in isp1362_read_ptd()
368 BUG_ON(ep->ptd_offset < 0); in isp1362_read_ptd()
370 list_del_init(&ep->active); in isp1362_read_ptd()
371 DBG(1, "%s: ep %p removed from active list %p\n", __func__, ep, &epq->active); in isp1362_read_ptd()
374 isp1362_read_buffer(isp1362_hcd, ptd, ep->ptd_offset, PTD_HEADER_SIZE); in isp1362_read_ptd()
379 if (act_len > ep->length) in isp1362_read_ptd()
380 pr_err("%s: ep %p PTD $%04x act_len %d ep->length %d\n", __func__, ep, in isp1362_read_ptd()
381 ep->ptd_offset, act_len, ep->length); in isp1362_read_ptd()
382 BUG_ON(act_len > ep->length); in isp1362_read_ptd()
387 prefetchw(ep->data); in isp1362_read_ptd()
388 isp1362_read_buffer(isp1362_hcd, ep->data, in isp1362_read_ptd()
389 ep->ptd_offset + PTD_HEADER_SIZE, act_len); in isp1362_read_ptd()
390 dump_ptd_in_data(ptd, ep->data); in isp1362_read_ptd()
404 DBG(1, "%s: ep %p PTD[%d] $%04x\n", __func__, ep, ep->ptd_index, ep->ptd_offset); in remove_ptd()
405 BUG_ON(ep->ptd_offset < 0); in remove_ptd()
407 epq = get_ptd_queue(isp1362_hcd, ep->ptd_offset); in remove_ptd()
411 WARN_ON(!list_empty(&ep->remove_list)); in remove_ptd()
412 list_add_tail(&ep->remove_list, &isp1362_hcd->remove_list); in remove_ptd()
416 index = ep->ptd_index; in remove_ptd()
422 index, ep->ptd_offset, epq->skip_map, 1 << index); in remove_ptd()
425 epq->skip_map |= 1 << index; in remove_ptd()
426 if (epq == &isp1362_hcd->atl_queue) { in remove_ptd()
427 DBG(2, "%s: ATLSKIP = %08x -> %08lx\n", __func__, in remove_ptd()
428 isp1362_read_reg32(isp1362_hcd, HCATLSKIP), epq->skip_map); in remove_ptd()
429 isp1362_write_reg32(isp1362_hcd, HCATLSKIP, epq->skip_map); in remove_ptd()
430 if (~epq->skip_map == 0) in remove_ptd()
432 } else if (epq == &isp1362_hcd->intl_queue) { in remove_ptd()
433 DBG(2, "%s: INTLSKIP = %08x -> %08lx\n", __func__, in remove_ptd()
434 isp1362_read_reg32(isp1362_hcd, HCINTLSKIP), epq->skip_map); in remove_ptd()
435 isp1362_write_reg32(isp1362_hcd, HCINTLSKIP, epq->skip_map); in remove_ptd()
436 if (~epq->skip_map == 0) in remove_ptd()
447 __releases(isp1362_hcd->lock) in finish_request()
448 __acquires(isp1362_hcd->lock) in finish_request()
450 urb->hcpriv = NULL; in finish_request()
451 ep->error_count = 0; in finish_request()
453 if (usb_pipecontrol(urb->pipe)) in finish_request()
454 ep->nextpid = USB_PID_SETUP; in finish_request()
456 URB_DBG("%s: req %d FA %d ep%d%s %s: len %d/%d %s stat %d\n", __func__, in finish_request()
457 ep->num_req, usb_pipedevice(urb->pipe), in finish_request()
458 usb_pipeendpoint(urb->pipe), in finish_request()
459 !usb_pipein(urb->pipe) ? "out" : "in", in finish_request()
460 usb_pipecontrol(urb->pipe) ? "ctrl" : in finish_request()
461 usb_pipeint(urb->pipe) ? "int" : in finish_request()
462 usb_pipebulk(urb->pipe) ? "bulk" : in finish_request()
464 urb->actual_length, urb->transfer_buffer_length, in finish_request()
465 !(urb->transfer_flags & URB_SHORT_NOT_OK) ? in finish_request()
466 "short_ok" : "", urb->status); in finish_request()
470 spin_unlock(&isp1362_hcd->lock); in finish_request()
472 spin_lock(&isp1362_hcd->lock); in finish_request()
475 if (!list_empty(&ep->hep->urb_list)) in finish_request()
479 if (!list_empty(&ep->schedule)) { in finish_request()
480 list_del_init(&ep->schedule); in finish_request()
485 if (ep->interval) { in finish_request()
487 DBG(1, "deschedule qh%d/%p branch %d load %d bandwidth %d -> %d\n", ep->interval, in finish_request()
488 ep, ep->branch, ep->load, in finish_request()
489 isp1362_hcd->load[ep->branch], in finish_request()
490 isp1362_hcd->load[ep->branch] - ep->load); in finish_request()
491 isp1362_hcd->load[ep->branch] -= ep->load; in finish_request()
492 ep->branch = PERIODIC_SIZE; in finish_request()
506 int urbstat = -EINPROGRESS; in postproc_ep()
509 DBG(2, "%s: ep %p req %d\n", __func__, ep, ep->num_req); in postproc_ep()
511 udev = urb->dev; in postproc_ep()
512 ptd = &ep->ptd; in postproc_ep()
515 pr_err("%s: req %d PTD %p Untouched by ISP1362\n", __func__, in postproc_ep()
516 ep->num_req, ptd); in postproc_ep()
520 short_ok = !(urb->transfer_flags & URB_SHORT_NOT_OK); in postproc_ep()
521 len = urb->transfer_buffer_length - urb->actual_length; in postproc_ep()
531 DBG(1, "%s: req %d Allowed data underrun short_%sok %d/%d/%d byte\n", in postproc_ep()
532 __func__, ep->num_req, short_ok ? "" : "not_", in postproc_ep()
533 PTD_GET_COUNT(ptd), ep->maxpacket, len); in postproc_ep()
537 DBG(1, "%s: req %d Data Underrun %s nextpid %02x short_%sok %d/%d/%d byte\n", in postproc_ep()
538 __func__, ep->num_req, in postproc_ep()
539 usb_pipein(urb->pipe) ? "IN" : "OUT", ep->nextpid, in postproc_ep()
541 PTD_GET_COUNT(ptd), ep->maxpacket, len); in postproc_ep()
545 urb->actual_length += PTD_GET_COUNT(ptd); in postproc_ep()
546 if (usb_pipecontrol(urb->pipe)) { in postproc_ep()
547 ep->nextpid = USB_PID_ACK; in postproc_ep()
548 BUG_ON(urb->actual_length > urb->transfer_buffer_length); in postproc_ep()
550 if (urb->status == -EINPROGRESS) in postproc_ep()
551 urb->status = cc_to_error[PTD_DATAUNDERRUN]; in postproc_ep()
553 usb_settoggle(udev, ep->epnum, ep->nextpid == USB_PID_OUT, in postproc_ep()
562 if (++ep->error_count >= 3 || cc == PTD_CC_STALL || cc == PTD_DATAOVERRUN) { in postproc_ep()
564 DBG(1, "%s: req %d nextpid %02x, status %d, error %d, error_count %d\n", in postproc_ep()
565 __func__, ep->num_req, ep->nextpid, urbstat, cc, in postproc_ep()
566 ep->error_count); in postproc_ep()
571 switch (ep->nextpid) { in postproc_ep()
573 if (PTD_GET_COUNT(ptd) != ep->length) in postproc_ep()
575 PTD_GET_COUNT(ptd), ep->length); in postproc_ep()
576 BUG_ON(PTD_GET_COUNT(ptd) != ep->length); in postproc_ep()
577 urb->actual_length += ep->length; in postproc_ep()
578 BUG_ON(urb->actual_length > urb->transfer_buffer_length); in postproc_ep()
579 usb_settoggle(udev, ep->epnum, 1, PTD_GET_TOGGLE(ptd)); in postproc_ep()
580 if (urb->actual_length == urb->transfer_buffer_length) { in postproc_ep()
581 DBG(3, "%s: req %d xfer complete %d/%d status %d -> 0\n", __func__, in postproc_ep()
582 ep->num_req, len, ep->maxpacket, urbstat); in postproc_ep()
583 if (usb_pipecontrol(urb->pipe)) { in postproc_ep()
584 DBG(3, "%s: req %d %s Wait for ACK\n", __func__, in postproc_ep()
585 ep->num_req, in postproc_ep()
586 usb_pipein(urb->pipe) ? "IN" : "OUT"); in postproc_ep()
587 ep->nextpid = USB_PID_ACK; in postproc_ep()
589 if (len % ep->maxpacket || in postproc_ep()
590 !(urb->transfer_flags & URB_ZERO_PACKET)) { in postproc_ep()
592 DBG(3, "%s: req %d URB %s status %d count %d/%d/%d\n", in postproc_ep()
593 __func__, ep->num_req, usb_pipein(urb->pipe) ? "IN" : "OUT", in postproc_ep()
594 urbstat, len, ep->maxpacket, urb->actual_length); in postproc_ep()
601 BUG_ON(len > ep->length); in postproc_ep()
602 urb->actual_length += len; in postproc_ep()
603 BUG_ON(urb->actual_length > urb->transfer_buffer_length); in postproc_ep()
604 usb_settoggle(udev, ep->epnum, 0, PTD_GET_TOGGLE(ptd)); in postproc_ep()
606 if ((urb->transfer_buffer_length == urb->actual_length) || in postproc_ep()
607 len % ep->maxpacket) { in postproc_ep()
608 DBG(3, "%s: req %d xfer complete %d/%d status %d -> 0\n", __func__, in postproc_ep()
609 ep->num_req, len, ep->maxpacket, urbstat); in postproc_ep()
610 if (usb_pipecontrol(urb->pipe)) { in postproc_ep()
611 DBG(3, "%s: req %d %s Wait for ACK\n", __func__, in postproc_ep()
612 ep->num_req, in postproc_ep()
613 usb_pipein(urb->pipe) ? "IN" : "OUT"); in postproc_ep()
614 ep->nextpid = USB_PID_ACK; in postproc_ep()
617 DBG(3, "%s: req %d URB %s status %d count %d/%d/%d\n", in postproc_ep()
618 __func__, ep->num_req, usb_pipein(urb->pipe) ? "IN" : "OUT", in postproc_ep()
619 urbstat, len, ep->maxpacket, urb->actual_length); in postproc_ep()
624 if (urb->transfer_buffer_length == urb->actual_length) { in postproc_ep()
625 ep->nextpid = USB_PID_ACK; in postproc_ep()
626 } else if (usb_pipeout(urb->pipe)) { in postproc_ep()
628 ep->nextpid = USB_PID_OUT; in postproc_ep()
631 ep->nextpid = USB_PID_IN; in postproc_ep()
635 DBG(3, "%s: req %d got ACK %d -> 0\n", __func__, ep->num_req, in postproc_ep()
637 WARN_ON(urbstat != -EINPROGRESS); in postproc_ep()
639 ep->nextpid = 0; in postproc_ep()
646 if (urbstat != -EINPROGRESS) { in postproc_ep()
647 DBG(2, "%s: Finishing ep %p req %d urb %p status %d\n", __func__, in postproc_ep()
648 ep, ep->num_req, urb, urbstat); in postproc_ep()
658 list_for_each_entry_safe(ep, tmp, &isp1362_hcd->remove_list, remove_list) { in finish_unlinks()
660 get_ptd_queue(isp1362_hcd, ep->ptd_offset); in finish_unlinks()
661 int index = ep->ptd_index; in finish_unlinks()
665 DBG(1, "%s: remove PTD[%d] $%04x\n", __func__, index, ep->ptd_offset); in finish_unlinks()
666 BUG_ON(ep->num_ptds == 0); in finish_unlinks()
669 if (!list_empty(&ep->hep->urb_list)) { in finish_unlinks()
672 DBG(1, "%s: Finishing req %d ep %p from remove_list\n", __func__, in finish_unlinks()
673 ep->num_req, ep); in finish_unlinks()
674 finish_request(isp1362_hcd, ep, urb, -ESHUTDOWN); in finish_unlinks()
676 WARN_ON(list_empty(&ep->active)); in finish_unlinks()
677 if (!list_empty(&ep->active)) { in finish_unlinks()
678 list_del_init(&ep->active); in finish_unlinks()
681 list_del_init(&ep->remove_list); in finish_unlinks()
690 if (count < isp1362_hcd->atl_queue.ptd_count) in enable_atl_transfers()
693 isp1362_write_reg32(isp1362_hcd, HCATLSKIP, isp1362_hcd->atl_queue.skip_map); in enable_atl_transfers()
703 isp1362_write_reg32(isp1362_hcd, HCINTLSKIP, isp1362_hcd->intl_queue.skip_map); in enable_intl_transfers()
719 index = claim_ptd_buffers(epq, ep, ep->length); in submit_req()
720 if (index == -ENOMEM) { in submit_req()
721 DBG(1, "%s: req %d No free %s PTD available: %d, %08lx:%08lx\n", __func__, in submit_req()
722 ep->num_req, epq->name, ep->num_ptds, epq->buf_map, epq->skip_map); in submit_req()
724 } else if (index == -EOVERFLOW) { in submit_req()
725 DBG(1, "%s: req %d Not enough space for %d byte %s PTD %d %08lx:%08lx\n", in submit_req()
726 __func__, ep->num_req, ep->length, epq->name, ep->num_ptds, in submit_req()
727 epq->buf_map, epq->skip_map); in submit_req()
731 list_add_tail(&ep->active, &epq->active); in submit_req()
732 DBG(1, "%s: ep %p req %d len %d added to active list %p\n", __func__, in submit_req()
733 ep, ep->num_req, ep->length, &epq->active); in submit_req()
734 DBG(1, "%s: Submitting %s PTD $%04x for ep %p req %d\n", __func__, epq->name, in submit_req()
735 ep->ptd_offset, ep, ep->num_req); in submit_req()
737 __clear_bit(ep->ptd_index, &epq->skip_map); in submit_req()
745 struct isp1362_ep_queue *epq = &isp1362_hcd->atl_queue; in start_atl_transfers()
749 if (atomic_read(&epq->finishing)) { in start_atl_transfers()
750 DBG(1, "%s: finish_transfers is active for %s\n", __func__, epq->name); in start_atl_transfers()
754 list_for_each_entry(ep, &isp1362_hcd->async, schedule) { in start_atl_transfers()
758 if (!list_empty(&ep->active)) { in start_atl_transfers()
759 DBG(2, "%s: Skipping active %s ep %p\n", __func__, epq->name, ep); in start_atl_transfers()
763 DBG(1, "%s: Processing %s ep %p req %d\n", __func__, epq->name, in start_atl_transfers()
764 ep, ep->num_req); in start_atl_transfers()
767 if (ret == -ENOMEM) { in start_atl_transfers()
770 } else if (ret == -EOVERFLOW) { in start_atl_transfers()
775 defer = ep->nextpid == USB_PID_SETUP; in start_atl_transfers()
781 if (isp1362_hcd->async.next != isp1362_hcd->async.prev) { in start_atl_transfers()
783 list_move(&isp1362_hcd->async, isp1362_hcd->async.next); in start_atl_transfers()
788 epq->ptd_count += ptd_count; in start_atl_transfers()
789 if (epq->ptd_count > epq->stat_maxptds) { in start_atl_transfers()
790 epq->stat_maxptds = epq->ptd_count; in start_atl_transfers()
791 DBG(0, "%s: max_ptds: %d\n", __func__, epq->stat_maxptds); in start_atl_transfers()
798 struct isp1362_ep_queue *epq = &isp1362_hcd->intl_queue; in start_intl_transfers()
801 if (atomic_read(&epq->finishing)) { in start_intl_transfers()
802 DBG(1, "%s: finish_transfers is active for %s\n", __func__, epq->name); in start_intl_transfers()
806 list_for_each_entry(ep, &isp1362_hcd->periodic, schedule) { in start_intl_transfers()
810 if (!list_empty(&ep->active)) { in start_intl_transfers()
812 epq->name, ep); in start_intl_transfers()
816 DBG(1, "%s: Processing %s ep %p req %d\n", __func__, in start_intl_transfers()
817 epq->name, ep, ep->num_req); in start_intl_transfers()
819 if (ret == -ENOMEM) in start_intl_transfers()
821 else if (ret == -EOVERFLOW) in start_intl_transfers()
836 epq->ptd_count += ptd_count; in start_intl_transfers()
837 if (epq->ptd_count > epq->stat_maxptds) in start_intl_transfers()
838 epq->stat_maxptds = epq->ptd_count; in start_intl_transfers()
843 u16 ptd_offset = ep->ptd_offset; in next_ptd()
844 int num_ptds = (ep->length + PTD_HEADER_SIZE + (epq->blk_size - 1)) / epq->blk_size; in next_ptd()
846 DBG(2, "%s: PTD offset $%04x + %04x => %d * %04x -> $%04x\n", __func__, ptd_offset, in next_ptd()
847 ep->length, num_ptds, epq->blk_size, ptd_offset + num_ptds * epq->blk_size); in next_ptd()
849 ptd_offset += num_ptds * epq->blk_size; in next_ptd()
850 if (ptd_offset < epq->buf_start + epq->buf_size) in next_ptd()
853 return -ENOMEM; in next_ptd()
859 int flip = isp1362_hcd->istl_flip; in start_iso_transfers()
867 epq = &isp1362_hcd->istl_queue[flip]; in start_iso_transfers()
868 if (atomic_read(&epq->finishing)) { in start_iso_transfers()
869 DBG(1, "%s: finish_transfers is active for %s\n", __func__, epq->name); in start_iso_transfers()
873 if (!list_empty(&epq->active)) in start_iso_transfers()
876 ptd_offset = epq->buf_start; in start_iso_transfers()
877 list_for_each_entry_safe(ep, tmp, &isp1362_hcd->isoc, schedule) { in start_iso_transfers()
879 s16 diff = fno - (u16)urb->start_frame; in start_iso_transfers()
881 DBG(1, "%s: Processing %s ep %p\n", __func__, epq->name, ep); in start_iso_transfers()
883 if (diff > urb->number_of_packets) { in start_iso_transfers()
885 finish_request(isp1362_hcd, ep, urb, -EOVERFLOW); in start_iso_transfers()
887 } else if (diff < -1) { in start_iso_transfers()
889 * Comparing with '-1' instead of '0' accounts for double in start_iso_transfers()
893 } else if (diff == -1) { in start_iso_transfers()
896 if (ptd_offset + PTD_HEADER_SIZE + ep->length > in start_iso_transfers()
897 epq->buf_start + epq->buf_size) { in start_iso_transfers()
899 __func__, ep->length); in start_iso_transfers()
902 ep->ptd_offset = ptd_offset; in start_iso_transfers()
903 list_add_tail(&ep->active, &epq->active); in start_iso_transfers()
907 pr_warn("%s: req %d No more %s PTD buffers available\n", in start_iso_transfers()
908 __func__, ep->num_req, epq->name); in start_iso_transfers()
913 list_for_each_entry(ep, &epq->active, active) { in start_iso_transfers()
914 if (epq->active.next == &ep->active) in start_iso_transfers()
915 ep->ptd.mps |= PTD_LAST_MSK; in start_iso_transfers()
923 epq->ptd_count += ptd_count; in start_iso_transfers()
924 if (epq->ptd_count > epq->stat_maxptds) in start_iso_transfers()
925 epq->stat_maxptds = epq->ptd_count; in start_iso_transfers()
932 flip = 1 - flip; in start_iso_transfers()
943 if (list_empty(&epq->active)) { in finish_transfers()
944 DBG(1, "%s: Nothing to do for %s queue\n", __func__, epq->name); in finish_transfers()
948 DBG(1, "%s: Finishing %s transfers %08lx\n", __func__, epq->name, done_map); in finish_transfers()
950 atomic_inc(&epq->finishing); in finish_transfers()
951 list_for_each_entry_safe(ep, tmp, &epq->active, active) { in finish_transfers()
952 int index = ep->ptd_index; in finish_transfers()
954 DBG(1, "%s: Checking %s PTD[%02x] $%04x\n", __func__, epq->name, in finish_transfers()
955 index, ep->ptd_offset); in finish_transfers()
960 epq->free_ptd = index; in finish_transfers()
961 BUG_ON(ep->num_ptds == 0); in finish_transfers()
964 DBG(1, "%s: ep %p req %d removed from active list\n", __func__, in finish_transfers()
965 ep, ep->num_req); in finish_transfers()
966 if (!list_empty(&ep->remove_list)) { in finish_transfers()
967 list_del_init(&ep->remove_list); in finish_transfers()
970 DBG(1, "%s: Postprocessing %s ep %p req %d\n", __func__, epq->name, in finish_transfers()
971 ep, ep->num_req); in finish_transfers()
979 __func__, done_map, epq->skip_map); in finish_transfers()
980 atomic_dec(&epq->finishing); in finish_transfers()
988 if (list_empty(&epq->active)) { in finish_iso_transfers()
989 DBG(1, "%s: Nothing to do for %s queue\n", __func__, epq->name); in finish_iso_transfers()
993 DBG(1, "%s: Finishing %s transfers\n", __func__, epq->name); in finish_iso_transfers()
995 atomic_inc(&epq->finishing); in finish_iso_transfers()
996 list_for_each_entry_safe(ep, tmp, &epq->active, active) { in finish_iso_transfers()
997 DBG(1, "%s: Checking PTD $%04x\n", __func__, ep->ptd_offset); in finish_iso_transfers()
1000 DBG(1, "%s: Postprocessing %s ep %p\n", __func__, epq->name, ep); in finish_iso_transfers()
1003 WARN_ON(epq->blk_size != 0); in finish_iso_transfers()
1004 atomic_dec(&epq->finishing); in finish_iso_transfers()
1014 spin_lock(&isp1362_hcd->lock); in isp1362_irq()
1016 BUG_ON(isp1362_hcd->irq_active++); in isp1362_irq()
1021 DBG(3, "%s: got IRQ %04x:%04x\n", __func__, irqstat, isp1362_hcd->irqenb); in isp1362_irq()
1024 irqstat &= isp1362_hcd->irqenb; in isp1362_irq()
1029 isp1362_hcd->irqenb &= ~HCuPINT_SOF; in isp1362_irq()
1030 isp1362_hcd->irq_stat[ISP1362_INT_SOF]++; in isp1362_irq()
1034 isp1362_hcd->fmindex = isp1362_read_reg32(isp1362_hcd, HCFMNUM); in isp1362_irq()
1035 if (!list_empty(&isp1362_hcd->remove_list)) in isp1362_irq()
1037 if (!list_empty(&isp1362_hcd->async) && !(irqstat & HCuPINT_ATL)) { in isp1362_irq()
1038 if (list_empty(&isp1362_hcd->atl_queue.active)) { in isp1362_irq()
1043 isp1362_hcd->atl_queue.skip_map); in isp1362_irq()
1050 isp1362_hcd->irq_stat[ISP1362_INT_ISTL0]++; in isp1362_irq()
1055 WARN_ON((int)!!isp1362_hcd->istl_flip); in isp1362_irq()
1060 isp1362_hcd->irqenb &= ~HCuPINT_ISTL0; in isp1362_irq()
1064 isp1362_hcd->irq_stat[ISP1362_INT_ISTL1]++; in isp1362_irq()
1069 WARN_ON(!(int)isp1362_hcd->istl_flip); in isp1362_irq()
1074 isp1362_hcd->irqenb &= ~HCuPINT_ISTL1; in isp1362_irq()
1081 &isp1362_hcd->istl_queue[isp1362_hcd->istl_flip]); in isp1362_irq()
1083 isp1362_hcd->istl_flip = 1 - isp1362_hcd->istl_flip; in isp1362_irq()
1089 isp1362_hcd->irq_stat[ISP1362_INT_INTL]++; in isp1362_irq()
1104 finish_transfers(isp1362_hcd, done_map, &isp1362_hcd->intl_queue); in isp1362_irq()
1112 isp1362_hcd->irq_stat[ISP1362_INT_ATL]++; in isp1362_irq()
1123 finish_transfers(isp1362_hcd, done_map, &isp1362_hcd->atl_queue); in isp1362_irq()
1131 isp1362_hcd->irq_stat[ISP1362_INT_OPR]++; in isp1362_irq()
1134 DBG(2, "%s: OPR %08x:%08x\n", __func__, intstat, isp1362_hcd->intenb); in isp1362_irq()
1135 intstat &= isp1362_hcd->intenb; in isp1362_irq()
1141 isp1362_hcd->rhstatus = isp1362_read_reg32(isp1362_hcd, HCRHSTATUS); in isp1362_irq()
1142 isp1362_hcd->rhport[0] = isp1362_read_reg32(isp1362_hcd, HCRHPORT1); in isp1362_irq()
1143 isp1362_hcd->rhport[1] = isp1362_read_reg32(isp1362_hcd, HCRHPORT2); in isp1362_irq()
1156 isp1362_hcd->irq_stat[ISP1362_INT_SUSP]++; in isp1362_irq()
1164 isp1362_hcd->irq_stat[ISP1362_INT_CLKRDY]++; in isp1362_irq()
1166 isp1362_hcd->irqenb &= ~HCuPINT_CLKRDY; in isp1362_irq()
1174 isp1362_write_reg16(isp1362_hcd, HCuPINTENB, isp1362_hcd->irqenb); in isp1362_irq()
1175 isp1362_hcd->irq_active--; in isp1362_irq()
1176 spin_unlock(&isp1362_hcd->lock); in isp1362_irq()
1181 /*-------------------------------------------------------------------------*/
1186 int i, branch = -ENOSPC; in balance()
1192 if (branch < 0 || isp1362_hcd->load[branch] > isp1362_hcd->load[i]) { in balance()
1196 if ((isp1362_hcd->load[j] + load) > MAX_PERIODIC_LOAD) { in balance()
1198 load, j, isp1362_hcd->load[j], MAX_PERIODIC_LOAD); in balance()
1210 /* NB! ALL the code above this point runs with isp1362_hcd->lock
1214 /*-------------------------------------------------------------------------*/
1221 struct usb_device *udev = urb->dev; in isp1362_urb_enqueue()
1222 unsigned int pipe = urb->pipe; in isp1362_urb_enqueue()
1226 struct usb_host_endpoint *hep = urb->ep; in isp1362_urb_enqueue()
1235 return -ENOSPC; in isp1362_urb_enqueue()
1245 urb->transfer_buffer_length, in isp1362_urb_enqueue()
1246 (urb->transfer_flags & URB_ZERO_PACKET) ? "ZERO_PACKET " : "", in isp1362_urb_enqueue()
1247 !(urb->transfer_flags & URB_SHORT_NOT_OK) ? in isp1362_urb_enqueue()
1251 if (!hep->hcpriv) { in isp1362_urb_enqueue()
1254 return -ENOMEM; in isp1362_urb_enqueue()
1256 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_urb_enqueue()
1259 if (!((isp1362_hcd->rhport[0] | isp1362_hcd->rhport[1]) & in isp1362_urb_enqueue()
1261 !HC_IS_RUNNING(hcd->state)) { in isp1362_urb_enqueue()
1263 retval = -ENODEV; in isp1362_urb_enqueue()
1273 if (hep->hcpriv) { in isp1362_urb_enqueue()
1274 ep = hep->hcpriv; in isp1362_urb_enqueue()
1276 INIT_LIST_HEAD(&ep->schedule); in isp1362_urb_enqueue()
1277 INIT_LIST_HEAD(&ep->active); in isp1362_urb_enqueue()
1278 INIT_LIST_HEAD(&ep->remove_list); in isp1362_urb_enqueue()
1279 ep->udev = usb_get_dev(udev); in isp1362_urb_enqueue()
1280 ep->hep = hep; in isp1362_urb_enqueue()
1281 ep->epnum = epnum; in isp1362_urb_enqueue()
1282 ep->maxpacket = usb_maxpacket(udev, urb->pipe); in isp1362_urb_enqueue()
1283 ep->ptd_offset = -EINVAL; in isp1362_urb_enqueue()
1284 ep->ptd_index = -EINVAL; in isp1362_urb_enqueue()
1288 ep->nextpid = USB_PID_SETUP; in isp1362_urb_enqueue()
1290 ep->nextpid = USB_PID_OUT; in isp1362_urb_enqueue()
1292 ep->nextpid = USB_PID_IN; in isp1362_urb_enqueue()
1297 if (urb->interval > PERIODIC_SIZE) in isp1362_urb_enqueue()
1298 urb->interval = PERIODIC_SIZE; in isp1362_urb_enqueue()
1299 ep->interval = urb->interval; in isp1362_urb_enqueue()
1300 ep->branch = PERIODIC_SIZE; in isp1362_urb_enqueue()
1301 ep->load = usb_calc_bus_time(udev->speed, !is_out, in isp1362_urb_enqueue()
1306 hep->hcpriv = ep; in isp1362_urb_enqueue()
1308 ep->num_req = isp1362_hcd->req_serial++; in isp1362_urb_enqueue()
1314 if (list_empty(&ep->schedule)) { in isp1362_urb_enqueue()
1315 DBG(1, "%s: Adding ep %p req %d to async schedule\n", in isp1362_urb_enqueue()
1316 __func__, ep, ep->num_req); in isp1362_urb_enqueue()
1317 list_add_tail(&ep->schedule, &isp1362_hcd->async); in isp1362_urb_enqueue()
1322 urb->interval = ep->interval; in isp1362_urb_enqueue()
1325 if (ep->branch < PERIODIC_SIZE) in isp1362_urb_enqueue()
1328 retval = balance(isp1362_hcd, ep->interval, ep->load); in isp1362_urb_enqueue()
1333 ep->branch = retval; in isp1362_urb_enqueue()
1335 isp1362_hcd->fmindex = isp1362_read_reg32(isp1362_hcd, HCFMNUM); in isp1362_urb_enqueue()
1337 __func__, isp1362_hcd->fmindex, ep->branch, in isp1362_urb_enqueue()
1338 ((isp1362_hcd->fmindex + PERIODIC_SIZE - 1) & in isp1362_urb_enqueue()
1339 ~(PERIODIC_SIZE - 1)) + ep->branch, in isp1362_urb_enqueue()
1340 (isp1362_hcd->fmindex & (PERIODIC_SIZE - 1)) + ep->branch); in isp1362_urb_enqueue()
1342 if (list_empty(&ep->schedule)) { in isp1362_urb_enqueue()
1344 u16 frame = isp1362_hcd->fmindex; in isp1362_urb_enqueue()
1346 frame += max_t(u16, 8, ep->interval); in isp1362_urb_enqueue()
1347 frame &= ~(ep->interval - 1); in isp1362_urb_enqueue()
1348 frame |= ep->branch; in isp1362_urb_enqueue()
1349 if (frame_before(frame, isp1362_hcd->fmindex)) in isp1362_urb_enqueue()
1350 frame += ep->interval; in isp1362_urb_enqueue()
1351 urb->start_frame = frame; in isp1362_urb_enqueue()
1354 list_add_tail(&ep->schedule, &isp1362_hcd->isoc); in isp1362_urb_enqueue()
1357 list_add_tail(&ep->schedule, &isp1362_hcd->periodic); in isp1362_urb_enqueue()
1362 DBG(2, "%s: load %d bandwidth %d -> %d\n", __func__, in isp1362_urb_enqueue()
1363 ep->load / ep->interval, isp1362_hcd->load[ep->branch], in isp1362_urb_enqueue()
1364 isp1362_hcd->load[ep->branch] + ep->load); in isp1362_urb_enqueue()
1365 isp1362_hcd->load[ep->branch] += ep->load; in isp1362_urb_enqueue()
1368 urb->hcpriv = hep; in isp1362_urb_enqueue()
1369 ALIGNSTAT(isp1362_hcd, urb->transfer_buffer); in isp1362_urb_enqueue()
1391 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_urb_enqueue()
1407 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_urb_dequeue()
1412 hep = urb->hcpriv; in isp1362_urb_dequeue()
1415 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_urb_dequeue()
1416 return -EIDRM; in isp1362_urb_dequeue()
1419 ep = hep->hcpriv; in isp1362_urb_dequeue()
1422 if (ep->hep->urb_list.next == &urb->urb_list) { in isp1362_urb_dequeue()
1423 if (!list_empty(&ep->active)) { in isp1362_urb_dequeue()
1424 DBG(1, "%s: urb %p ep %p req %d active PTD[%d] $%04x\n", __func__, in isp1362_urb_dequeue()
1425 urb, ep, ep->num_req, ep->ptd_index, ep->ptd_offset); in isp1362_urb_dequeue()
1432 DBG(1, "%s: Finishing ep %p req %d\n", __func__, ep, in isp1362_urb_dequeue()
1433 ep->num_req); in isp1362_urb_dequeue()
1439 retval = -EINVAL; in isp1362_urb_dequeue()
1442 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_urb_dequeue()
1451 struct isp1362_ep *ep = hep->hcpriv; in isp1362_endpoint_disable()
1458 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_endpoint_disable()
1459 if (!list_empty(&hep->urb_list)) { in isp1362_endpoint_disable()
1460 if (!list_empty(&ep->active) && list_empty(&ep->remove_list)) { in isp1362_endpoint_disable()
1461 DBG(1, "%s: Removing ep %p req %d PTD[%d] $%04x\n", __func__, in isp1362_endpoint_disable()
1462 ep, ep->num_req, ep->ptd_index, ep->ptd_offset); in isp1362_endpoint_disable()
1467 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_endpoint_disable()
1469 while (!list_empty(&ep->active)) in isp1362_endpoint_disable()
1474 usb_put_dev(ep->udev); in isp1362_endpoint_disable()
1476 hep->hcpriv = NULL; in isp1362_endpoint_disable()
1485 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_get_frame()
1487 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_get_frame()
1492 /*-------------------------------------------------------------------------*/
1494 /* Adapted from ohci-hub.c */
1501 if (!HC_IS_RUNNING(hcd->state)) in isp1362_hub_status_data()
1502 return -ESHUTDOWN; in isp1362_hub_status_data()
1506 if (timer_pending(&hcd->rh_timer)) in isp1362_hub_status_data()
1509 ports = isp1362_hcd->rhdesca & RH_A_NDP; in isp1362_hub_status_data()
1512 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_hub_status_data()
1514 if (isp1362_hcd->rhstatus & (RH_HS_LPSC | RH_HS_OCIC)) in isp1362_hub_status_data()
1520 u32 status = isp1362_hcd->rhport[i]; in isp1362_hub_status_data()
1532 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_hub_status_data()
1539 u32 reg = isp1362_hcd->rhdesca; in isp1362_hub_descriptor()
1543 desc->bDescriptorType = USB_DT_HUB; in isp1362_hub_descriptor()
1544 desc->bDescLength = 9; in isp1362_hub_descriptor()
1545 desc->bHubContrCurrent = 0; in isp1362_hub_descriptor()
1546 desc->bNbrPorts = reg & 0x3; in isp1362_hub_descriptor()
1547 /* Power switching, device type, overcurrent. */ in isp1362_hub_descriptor()
1548 desc->wHubCharacteristics = cpu_to_le16((reg >> 8) & in isp1362_hub_descriptor()
1553 desc->wHubCharacteristics); in isp1362_hub_descriptor()
1554 desc->bPwrOn2PwrGood = (reg >> 24) & 0xff; in isp1362_hub_descriptor()
1556 desc->u.hs.DeviceRemovable[0] = desc->bNbrPorts == 1 ? 1 << 1 : 3 << 1; in isp1362_hub_descriptor()
1557 desc->u.hs.DeviceRemovable[1] = ~0; in isp1362_hub_descriptor()
1562 /* Adapted from ohci-hub.c */
1570 int ports = isp1362_hcd->rhdesca & RH_A_NDP; in isp1362_hub_control()
1579 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_hub_control()
1581 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_hub_control()
1615 tmp = isp1362_hcd->rhport[--wIndex]; in isp1362_hub_control()
1622 wIndex--; in isp1362_hub_control()
1662 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_hub_control()
1664 isp1362_hcd->rhport[wIndex] = in isp1362_hub_control()
1666 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_hub_control()
1672 wIndex--; in isp1362_hub_control()
1676 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_hub_control()
1678 isp1362_hcd->rhport[wIndex] = in isp1362_hub_control()
1680 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_hub_control()
1684 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_hub_control()
1686 isp1362_hcd->rhport[wIndex] = in isp1362_hub_control()
1688 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_hub_control()
1692 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_hub_control()
1708 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_hub_control()
1710 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_hub_control()
1713 isp1362_hcd->rhport[wIndex] = isp1362_read_reg32(isp1362_hcd, in isp1362_hub_control()
1715 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_hub_control()
1726 retval = -EPIPE; in isp1362_hub_control()
1739 if (time_before(jiffies, isp1362_hcd->next_statechange)) in isp1362_bus_suspend()
1742 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_bus_suspend()
1744 isp1362_hcd->hc_control = isp1362_read_reg32(isp1362_hcd, HCCONTROL); in isp1362_bus_suspend()
1745 switch (isp1362_hcd->hc_control & OHCI_CTRL_HCFS) { in isp1362_bus_suspend()
1748 isp1362_hcd->hc_control &= ~OHCI_CTRL_HCFS; in isp1362_bus_suspend()
1749 isp1362_hcd->hc_control |= OHCI_USB_RESET; in isp1362_bus_suspend()
1750 isp1362_write_reg32(isp1362_hcd, HCCONTROL, isp1362_hcd->hc_control); in isp1362_bus_suspend()
1753 status = -EBUSY; in isp1362_bus_suspend()
1763 hcd->state = HC_STATE_QUIESCING; in isp1362_bus_suspend()
1764 if (!list_empty(&isp1362_hcd->atl_queue.active) || in isp1362_bus_suspend()
1765 !list_empty(&isp1362_hcd->intl_queue.active) || in isp1362_bus_suspend()
1766 !list_empty(&isp1362_hcd->istl_queue[0] .active) || in isp1362_bus_suspend()
1767 !list_empty(&isp1362_hcd->istl_queue[1] .active)) { in isp1362_bus_suspend()
1780 limit -= 250; in isp1362_bus_suspend()
1787 finish_transfers(isp1362_hcd, done_map, &isp1362_hcd->atl_queue); in isp1362_bus_suspend()
1791 finish_transfers(isp1362_hcd, done_map, &isp1362_hcd->intl_queue); in isp1362_bus_suspend()
1794 finish_iso_transfers(isp1362_hcd, &isp1362_hcd->istl_queue[0]); in isp1362_bus_suspend()
1796 finish_iso_transfers(isp1362_hcd, &isp1362_hcd->istl_queue[1]); in isp1362_bus_suspend()
1804 isp1362_hcd->hc_control = OHCI_USB_SUSPEND; in isp1362_bus_suspend()
1806 isp1362_write_reg32(isp1362_hcd, HCCONTROL, isp1362_hcd->hc_control); in isp1362_bus_suspend()
1810 isp1362_hcd->hc_control = isp1362_read_reg32(isp1362_hcd, HCCONTROL); in isp1362_bus_suspend()
1811 if ((isp1362_hcd->hc_control & OHCI_CTRL_HCFS) != OHCI_USB_SUSPEND) { in isp1362_bus_suspend()
1813 isp1362_hcd->hc_control); in isp1362_bus_suspend()
1814 status = -EBUSY; in isp1362_bus_suspend()
1819 isp1362_hcd->next_statechange = jiffies + msecs_to_jiffies(5); in isp1362_bus_suspend()
1823 hcd->state = HC_STATE_SUSPENDED; in isp1362_bus_suspend()
1827 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_bus_suspend()
1836 int status = -EINPROGRESS; in isp1362_bus_resume()
1838 if (time_before(jiffies, isp1362_hcd->next_statechange)) in isp1362_bus_resume()
1841 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_bus_resume()
1842 isp1362_hcd->hc_control = isp1362_read_reg32(isp1362_hcd, HCCONTROL); in isp1362_bus_resume()
1843 pr_info("%s: HCCONTROL: %08x\n", __func__, isp1362_hcd->hc_control); in isp1362_bus_resume()
1844 if (hcd->state == HC_STATE_RESUMING) { in isp1362_bus_resume()
1848 switch (isp1362_hcd->hc_control & OHCI_CTRL_HCFS) { in isp1362_bus_resume()
1851 isp1362_hcd->hc_control &= ~OHCI_CTRL_HCFS; in isp1362_bus_resume()
1852 isp1362_hcd->hc_control |= OHCI_USB_RESUME; in isp1362_bus_resume()
1853 isp1362_write_reg32(isp1362_hcd, HCCONTROL, isp1362_hcd->hc_control); in isp1362_bus_resume()
1862 hcd->self.root_hub->dev.power.power_state = PMSG_ON; in isp1362_bus_resume()
1864 default: /* RESET, we lost power */ in isp1362_bus_resume()
1866 status = -EBUSY; in isp1362_bus_resume()
1868 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_bus_resume()
1869 if (status == -EBUSY) { in isp1362_bus_resume()
1874 if (status != -EINPROGRESS) in isp1362_bus_resume()
1876 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_bus_resume()
1878 while (port--) { in isp1362_bus_resume()
1889 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_bus_resume()
1891 /* Some controllers (lucent) need extra-long delays */ in isp1362_bus_resume()
1892 hcd->state = HC_STATE_RESUMING; in isp1362_bus_resume()
1895 isp1362_hcd->hc_control = OHCI_USB_OPER; in isp1362_bus_resume()
1896 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_bus_resume()
1898 isp1362_write_reg32(isp1362_hcd, HCCONTROL, isp1362_hcd->hc_control); in isp1362_bus_resume()
1899 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_bus_resume()
1904 isp1362_hcd->next_statechange = jiffies + msecs_to_jiffies(250); in isp1362_bus_resume()
1906 hcd->self.root_hub->dev.power.power_state = PMSG_ON; in isp1362_bus_resume()
1907 hcd->state = HC_STATE_RUNNING; in isp1362_bus_resume()
1915 /*-------------------------------------------------------------------------*/
1919 seq_printf(s, "%-15s %04x%s%s%s%s%s%s\n", label, mask, in dump_irq()
1930 seq_printf(s, "%-15s %08x%s%s%s%s%s%s%s\n", label, mask, in dump_int()
1942 seq_printf(s, "%-15s %08x%s%s%s\n", label, mask, in dump_ctrl()
2061 struct isp1362_hcd *isp1362_hcd = s->private; in isp1362_show()
2066 isp1362_hcd_to_hcd(isp1362_hcd)->product_desc, hcd_name, DRIVER_VERSION); in isp1362_show()
2072 isp1362_hcd->stat16, isp1362_hcd->stat8, isp1362_hcd->stat4, in isp1362_show()
2073 isp1362_hcd->stat2, isp1362_hcd->stat1); in isp1362_show()
2074 seq_printf(s, "max # ptds in ATL fifo: %d\n", isp1362_hcd->atl_queue.stat_maxptds); in isp1362_show()
2075 seq_printf(s, "max # ptds in INTL fifo: %d\n", isp1362_hcd->intl_queue.stat_maxptds); in isp1362_show()
2077 max(isp1362_hcd->istl_queue[0] .stat_maxptds, in isp1362_show()
2078 isp1362_hcd->istl_queue[1] .stat_maxptds)); in isp1362_show()
2081 spin_lock_irq(&isp1362_hcd->lock); in isp1362_show()
2090 if (isp1362_hcd->irq_stat[i]) in isp1362_show()
2091 seq_printf(s, "%-15s: %d\n", in isp1362_show()
2092 ISP1362_INT_NAME(i), isp1362_hcd->irq_stat[i]); in isp1362_show()
2095 list_for_each_entry(ep, &isp1362_hcd->async, schedule) { in isp1362_show()
2098 seq_printf(s, "%p, ep%d%s, maxpacket %d:\n", ep, ep->epnum, in isp1362_show()
2101 switch (ep->nextpid) { in isp1362_show()
2118 s;}), ep->maxpacket) ; in isp1362_show()
2119 list_for_each_entry(urb, &ep->hep->urb_list, urb_list) { in isp1362_show()
2121 urb->actual_length, in isp1362_show()
2122 urb->transfer_buffer_length); in isp1362_show()
2125 if (!list_empty(&isp1362_hcd->async)) in isp1362_show()
2127 dump_ptd_queue(&isp1362_hcd->atl_queue); in isp1362_show()
2131 list_for_each_entry(ep, &isp1362_hcd->periodic, schedule) { in isp1362_show()
2132 seq_printf(s, "branch:%2d load:%3d PTD[%d] $%04x:\n", ep->branch, in isp1362_show()
2133 isp1362_hcd->load[ep->branch], ep->ptd_index, ep->ptd_offset); in isp1362_show()
2136 ep->interval, ep, in isp1362_show()
2137 (ep->udev->speed == USB_SPEED_FULL) ? "" : "ls ", in isp1362_show()
2138 ep->udev->devnum, ep->epnum, in isp1362_show()
2139 (ep->epnum == 0) ? "" : in isp1362_show()
2140 ((ep->nextpid == USB_PID_IN) ? in isp1362_show()
2141 "in" : "out"), ep->maxpacket); in isp1362_show()
2143 dump_ptd_queue(&isp1362_hcd->intl_queue); in isp1362_show()
2147 list_for_each_entry(ep, &isp1362_hcd->isoc, schedule) { in isp1362_show()
2149 ep->interval, ep, in isp1362_show()
2150 (ep->udev->speed == USB_SPEED_FULL) ? "" : "ls ", in isp1362_show()
2151 ep->udev->devnum, ep->epnum, in isp1362_show()
2152 (ep->epnum == 0) ? "" : in isp1362_show()
2153 ((ep->nextpid == USB_PID_IN) ? in isp1362_show()
2154 "in" : "out"), ep->maxpacket); in isp1362_show()
2157 spin_unlock_irq(&isp1362_hcd->lock); in isp1362_show()
2176 /*-------------------------------------------------------------------------*/
2184 while (--tmp) { in __isp1362_sw_reset()
2197 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_sw_reset()
2199 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_sw_reset()
2211 u16 atl_buffers = (ISP1362_BUF_SIZE - (istl_size + intl_size)) / atl_blksize; in isp1362_mem_config()
2226 dev_info(hcd->self.controller, "ISP1362 Memory usage:\n"); in isp1362_mem_config()
2227 dev_info(hcd->self.controller, " ISTL: 2 * %4d: %4d @ $%04x:$%04x\n", in isp1362_mem_config()
2229 dev_info(hcd->self.controller, " INTL: %4d * (%3zu+8): %4d @ $%04x\n", in isp1362_mem_config()
2230 ISP1362_INTL_BUFFERS, intl_blksize - PTD_HEADER_SIZE, in isp1362_mem_config()
2232 dev_info(hcd->self.controller, " ATL : %4d * (%3zu+8): %4d @ $%04x\n", in isp1362_mem_config()
2233 atl_buffers, atl_blksize - PTD_HEADER_SIZE, in isp1362_mem_config()
2235 dev_info(hcd->self.controller, " USED/FREE: %4d %4d\n", total, in isp1362_mem_config()
2236 ISP1362_BUF_SIZE - total); in isp1362_mem_config()
2239 dev_err(hcd->self.controller, "%s: Memory requested: %d, available %d\n", in isp1362_mem_config()
2241 return -ENOMEM; in isp1362_mem_config()
2244 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_mem_config()
2247 isp1362_hcd->istl_queue[i].buf_start = i * istl_size / 2, in isp1362_mem_config()
2248 isp1362_hcd->istl_queue[i].buf_size = istl_size / 2; in isp1362_mem_config()
2249 isp1362_hcd->istl_queue[i].blk_size = 4; in isp1362_mem_config()
2250 INIT_LIST_HEAD(&isp1362_hcd->istl_queue[i].active); in isp1362_mem_config()
2251 snprintf(isp1362_hcd->istl_queue[i].name, in isp1362_mem_config()
2252 sizeof(isp1362_hcd->istl_queue[i].name), "ISTL%d", i); in isp1362_mem_config()
2254 isp1362_hcd->istl_queue[i].name, in isp1362_mem_config()
2255 isp1362_hcd->istl_queue[i].buf_start, in isp1362_mem_config()
2256 isp1362_hcd->istl_queue[i].buf_size); in isp1362_mem_config()
2260 isp1362_hcd->intl_queue.buf_start = istl_size; in isp1362_mem_config()
2261 isp1362_hcd->intl_queue.buf_size = intl_size; in isp1362_mem_config()
2262 isp1362_hcd->intl_queue.buf_count = ISP1362_INTL_BUFFERS; in isp1362_mem_config()
2263 isp1362_hcd->intl_queue.blk_size = intl_blksize; in isp1362_mem_config()
2264 isp1362_hcd->intl_queue.buf_avail = isp1362_hcd->intl_queue.buf_count; in isp1362_mem_config()
2265 isp1362_hcd->intl_queue.skip_map = ~0; in isp1362_mem_config()
2266 INIT_LIST_HEAD(&isp1362_hcd->intl_queue.active); in isp1362_mem_config()
2269 isp1362_hcd->intl_queue.buf_size); in isp1362_mem_config()
2271 isp1362_hcd->intl_queue.blk_size - PTD_HEADER_SIZE); in isp1362_mem_config()
2274 1 << (ISP1362_INTL_BUFFERS - 1)); in isp1362_mem_config()
2276 isp1362_hcd->atl_queue.buf_start = istl_size + intl_size; in isp1362_mem_config()
2277 isp1362_hcd->atl_queue.buf_size = atl_size; in isp1362_mem_config()
2278 isp1362_hcd->atl_queue.buf_count = atl_buffers; in isp1362_mem_config()
2279 isp1362_hcd->atl_queue.blk_size = atl_blksize; in isp1362_mem_config()
2280 isp1362_hcd->atl_queue.buf_avail = isp1362_hcd->atl_queue.buf_count; in isp1362_mem_config()
2281 isp1362_hcd->atl_queue.skip_map = ~0; in isp1362_mem_config()
2282 INIT_LIST_HEAD(&isp1362_hcd->atl_queue.active); in isp1362_mem_config()
2285 isp1362_hcd->atl_queue.buf_size); in isp1362_mem_config()
2287 isp1362_hcd->atl_queue.blk_size - PTD_HEADER_SIZE); in isp1362_mem_config()
2290 1 << (atl_buffers - 1)); in isp1362_mem_config()
2292 snprintf(isp1362_hcd->atl_queue.name, in isp1362_mem_config()
2293 sizeof(isp1362_hcd->atl_queue.name), "ATL"); in isp1362_mem_config()
2294 snprintf(isp1362_hcd->intl_queue.name, in isp1362_mem_config()
2295 sizeof(isp1362_hcd->intl_queue.name), "INTL"); in isp1362_mem_config()
2297 isp1362_hcd->intl_queue.name, in isp1362_mem_config()
2298 isp1362_hcd->intl_queue.buf_start, in isp1362_mem_config()
2299 ISP1362_INTL_BUFFERS, isp1362_hcd->intl_queue.blk_size, in isp1362_mem_config()
2300 isp1362_hcd->intl_queue.buf_size); in isp1362_mem_config()
2302 isp1362_hcd->atl_queue.name, in isp1362_mem_config()
2303 isp1362_hcd->atl_queue.buf_start, in isp1362_mem_config()
2304 atl_buffers, isp1362_hcd->atl_queue.blk_size, in isp1362_mem_config()
2305 isp1362_hcd->atl_queue.buf_size); in isp1362_mem_config()
2307 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_mem_config()
2323 if (isp1362_hcd->board && isp1362_hcd->board->reset) { in isp1362_hc_reset()
2324 isp1362_hcd->board->reset(hcd->self.controller, 1); in isp1362_hc_reset()
2326 if (isp1362_hcd->board->clock) in isp1362_hc_reset()
2327 isp1362_hcd->board->clock(hcd->self.controller, 1); in isp1362_hc_reset()
2328 isp1362_hcd->board->reset(hcd->self.controller, 0); in isp1362_hc_reset()
2335 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_hc_reset()
2337 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_hc_reset()
2342 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_hc_reset()
2344 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_hc_reset()
2347 ret = -ENODEV; in isp1362_hc_reset()
2360 del_timer_sync(&hcd->rh_timer); in isp1362_hc_stop()
2362 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_hc_stop()
2366 /* Switch off power for all ports */ in isp1362_hc_stop()
2373 if (isp1362_hcd->board && isp1362_hcd->board->reset) in isp1362_hc_stop()
2374 isp1362_hcd->board->reset(hcd->self.controller, 1); in isp1362_hc_stop()
2378 if (isp1362_hcd->board && isp1362_hcd->board->clock) in isp1362_hc_stop()
2379 isp1362_hcd->board->clock(hcd->self.controller, 0); in isp1362_hc_stop()
2381 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_hc_stop()
2405 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_chip_test()
2408 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_chip_test()
2411 ret = -ENODEV; in isp1362_chip_test()
2420 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_chip_test()
2423 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_chip_test()
2426 ret = -ENODEV; in isp1362_chip_test()
2437 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_chip_test()
2440 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_chip_test()
2447 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_chip_test()
2453 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_chip_test()
2457 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_chip_test()
2460 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_chip_test()
2462 ret = -ENODEV; in isp1362_chip_test()
2481 struct isp1362_platform_data *board = isp1362_hcd->board; in isp1362_hc_start()
2488 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_hc_start()
2490 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_hc_start()
2494 return -ENODEV; in isp1362_hc_start()
2500 return -ENODEV; in isp1362_hc_start()
2502 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_hc_start()
2509 if (board->sel15Kres) in isp1362_hc_start()
2512 if (board->clknotstop) in isp1362_hc_start()
2514 if (board->oc_enable) in isp1362_hc_start()
2516 if (board->int_act_high) in isp1362_hc_start()
2518 if (board->int_edge_triggered) in isp1362_hc_start()
2520 if (board->dreq_act_high) in isp1362_hc_start()
2522 if (board->dack_act_high) in isp1362_hc_start()
2527 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_hc_start()
2533 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_hc_start()
2536 isp1362_hcd->rhdesca = 0; in isp1362_hc_start()
2537 if (board->no_power_switching) in isp1362_hc_start()
2538 isp1362_hcd->rhdesca |= RH_A_NPS; in isp1362_hc_start()
2539 if (board->power_switching_mode) in isp1362_hc_start()
2540 isp1362_hcd->rhdesca |= RH_A_PSM; in isp1362_hc_start()
2541 if (board->potpg) in isp1362_hc_start()
2542 isp1362_hcd->rhdesca |= (board->potpg << 24) & RH_A_POTPGT; in isp1362_hc_start()
2544 isp1362_hcd->rhdesca |= (25 << 24) & RH_A_POTPGT; in isp1362_hc_start()
2546 isp1362_write_reg32(isp1362_hcd, HCRHDESCA, isp1362_hcd->rhdesca & ~RH_A_OCPM); in isp1362_hc_start()
2547 isp1362_write_reg32(isp1362_hcd, HCRHDESCA, isp1362_hcd->rhdesca | RH_A_OCPM); in isp1362_hc_start()
2548 isp1362_hcd->rhdesca = isp1362_read_reg32(isp1362_hcd, HCRHDESCA); in isp1362_hc_start()
2550 isp1362_hcd->rhdescb = RH_B_PPCM; in isp1362_hc_start()
2551 isp1362_write_reg32(isp1362_hcd, HCRHDESCB, isp1362_hcd->rhdescb); in isp1362_hc_start()
2552 isp1362_hcd->rhdescb = isp1362_read_reg32(isp1362_hcd, HCRHDESCB); in isp1362_hc_start()
2558 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_hc_start()
2560 isp1362_hcd->hc_control = OHCI_USB_OPER; in isp1362_hc_start()
2561 hcd->state = HC_STATE_RUNNING; in isp1362_hc_start()
2563 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_hc_start()
2565 isp1362_hcd->intenb = OHCI_INTR_MIE | OHCI_INTR_RHSC | OHCI_INTR_UE; in isp1362_hc_start()
2566 isp1362_hcd->intenb |= OHCI_INTR_RD; in isp1362_hc_start()
2567 isp1362_hcd->irqenb = HCuPINT_OPR | HCuPINT_SUSP; in isp1362_hc_start()
2568 isp1362_write_reg32(isp1362_hcd, HCINTENB, isp1362_hcd->intenb); in isp1362_hc_start()
2569 isp1362_write_reg16(isp1362_hcd, HCuPINTENB, isp1362_hcd->irqenb); in isp1362_hc_start()
2572 isp1362_write_reg32(isp1362_hcd, HCCONTROL, isp1362_hcd->hc_control); in isp1362_hc_start()
2573 /* enable global power */ in isp1362_hc_start()
2576 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_hc_start()
2581 /*-------------------------------------------------------------------------*/
2607 /*-------------------------------------------------------------------------*/
2634 return -ENODEV; in isp1362_probe()
2636 /* basic sanity checks first. board-specific init logic should in isp1362_probe()
2641 if (pdev->num_resources < 3) in isp1362_probe()
2642 return -ENODEV; in isp1362_probe()
2646 return -ENODEV; in isp1362_probe()
2648 irq = irq_res->start; in isp1362_probe()
2659 hcd = usb_create_hcd(&isp1362_hc_driver, &pdev->dev, dev_name(&pdev->dev)); in isp1362_probe()
2661 return -ENOMEM; in isp1362_probe()
2663 hcd->rsrc_start = data->start; in isp1362_probe()
2665 isp1362_hcd->data_reg = data_reg; in isp1362_probe()
2666 isp1362_hcd->addr_reg = addr_reg; in isp1362_probe()
2668 isp1362_hcd->next_statechange = jiffies; in isp1362_probe()
2669 spin_lock_init(&isp1362_hcd->lock); in isp1362_probe()
2670 INIT_LIST_HEAD(&isp1362_hcd->async); in isp1362_probe()
2671 INIT_LIST_HEAD(&isp1362_hcd->periodic); in isp1362_probe()
2672 INIT_LIST_HEAD(&isp1362_hcd->isoc); in isp1362_probe()
2673 INIT_LIST_HEAD(&isp1362_hcd->remove_list); in isp1362_probe()
2674 isp1362_hcd->board = dev_get_platdata(&pdev->dev); in isp1362_probe()
2676 if (!isp1362_hcd->board->delay) { in isp1362_probe()
2677 dev_err(hcd->self.controller, "No platform delay function given\n"); in isp1362_probe()
2678 retval = -ENODEV; in isp1362_probe()
2683 if (irq_res->flags & IORESOURCE_IRQ_HIGHEDGE) in isp1362_probe()
2685 if (irq_res->flags & IORESOURCE_IRQ_LOWEDGE) in isp1362_probe()
2687 if (irq_res->flags & IORESOURCE_IRQ_HIGHLEVEL) in isp1362_probe()
2689 if (irq_res->flags & IORESOURCE_IRQ_LOWLEVEL) in isp1362_probe()
2695 device_wakeup_enable(hcd->self.controller); in isp1362_probe()
2697 dev_info(&pdev->dev, "%s, irq %d\n", hcd->product_desc, irq); in isp1362_probe()
2724 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_suspend()
2726 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_suspend()
2729 pdev->dev.power.power_state = state; in isp1362_suspend()
2741 if (pdev->dev.power.power_state.event == PM_EVENT_SUSPEND) { in isp1362_resume()
2743 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_resume()
2745 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_resume()
2749 pdev->dev.power.power_state = PMSG_ON; in isp1362_resume()