fotg210 30 drivers/usb/gadget/udc/fotg210-udc.c u32 value = ioread32(ep->fotg210->reg + FOTG210_DMISGR1); fotg210 36 drivers/usb/gadget/udc/fotg210-udc.c iowrite32(value, ep->fotg210->reg + FOTG210_DMISGR1); fotg210 41 drivers/usb/gadget/udc/fotg210-udc.c u32 value = ioread32(ep->fotg210->reg + FOTG210_DMISGR1); fotg210 47 drivers/usb/gadget/udc/fotg210-udc.c iowrite32(value, ep->fotg210->reg + FOTG210_DMISGR1); fotg210 50 drivers/usb/gadget/udc/fotg210-udc.c static void fotg210_set_cxdone(struct fotg210_udc *fotg210) fotg210 52 drivers/usb/gadget/udc/fotg210-udc.c u32 value = ioread32(fotg210->reg + FOTG210_DCFESR); fotg210 55 drivers/usb/gadget/udc/fotg210-udc.c iowrite32(value, fotg210->reg + FOTG210_DCFESR); fotg210 64 drivers/usb/gadget/udc/fotg210-udc.c if (ep->fotg210->gadget.speed == USB_SPEED_UNKNOWN) fotg210 69 drivers/usb/gadget/udc/fotg210-udc.c spin_unlock(&ep->fotg210->lock); fotg210 71 drivers/usb/gadget/udc/fotg210-udc.c spin_lock(&ep->fotg210->lock); fotg210 77 drivers/usb/gadget/udc/fotg210-udc.c fotg210_set_cxdone(ep->fotg210); fotg210 84 drivers/usb/gadget/udc/fotg210-udc.c struct fotg210_udc *fotg210 = ep->fotg210; fotg210 92 drivers/usb/gadget/udc/fotg210-udc.c val = ioread32(fotg210->reg + FOTG210_EPMAP); fotg210 95 drivers/usb/gadget/udc/fotg210-udc.c iowrite32(val, fotg210->reg + FOTG210_EPMAP); fotg210 98 drivers/usb/gadget/udc/fotg210-udc.c val = ioread32(fotg210->reg + FOTG210_FIFOMAP); fotg210 101 drivers/usb/gadget/udc/fotg210-udc.c iowrite32(val, fotg210->reg + FOTG210_FIFOMAP); fotg210 104 drivers/usb/gadget/udc/fotg210-udc.c val = ioread32(fotg210->reg + FOTG210_FIFOCF); fotg210 106 drivers/usb/gadget/udc/fotg210-udc.c iowrite32(val, fotg210->reg + FOTG210_FIFOCF); fotg210 111 drivers/usb/gadget/udc/fotg210-udc.c struct fotg210_udc *fotg210 = ep->fotg210; fotg210 114 drivers/usb/gadget/udc/fotg210-udc.c val = ioread32(fotg210->reg + FOTG210_FIFOMAP); fotg210 116 drivers/usb/gadget/udc/fotg210-udc.c iowrite32(val, fotg210->reg + FOTG210_FIFOMAP); fotg210 121 drivers/usb/gadget/udc/fotg210-udc.c struct fotg210_udc *fotg210 = ep->fotg210; fotg210 124 drivers/usb/gadget/udc/fotg210-udc.c val = ioread32(fotg210->reg + FOTG210_FIFOCF); fotg210 126 drivers/usb/gadget/udc/fotg210-udc.c iowrite32(val, fotg210->reg + FOTG210_FIFOCF); fotg210 132 drivers/usb/gadget/udc/fotg210-udc.c struct fotg210_udc *fotg210 = ep->fotg210; fotg210 137 drivers/usb/gadget/udc/fotg210-udc.c val = ioread32(fotg210->reg + offset); fotg210 139 drivers/usb/gadget/udc/fotg210-udc.c iowrite32(val, fotg210->reg + offset); fotg210 145 drivers/usb/gadget/udc/fotg210-udc.c struct fotg210_udc *fotg210 = ep->fotg210; fotg210 152 drivers/usb/gadget/udc/fotg210-udc.c fotg210->ep[ep->epnum] = ep; fotg210 173 drivers/usb/gadget/udc/fotg210-udc.c static void fotg210_reset_tseq(struct fotg210_udc *fotg210, u8 epnum) fotg210 175 drivers/usb/gadget/udc/fotg210-udc.c struct fotg210_ep *ep = fotg210->ep[epnum]; fotg210 180 drivers/usb/gadget/udc/fotg210-udc.c fotg210->reg + FOTG210_INEPMPSR(epnum) : fotg210 181 drivers/usb/gadget/udc/fotg210-udc.c fotg210->reg + FOTG210_OUTEPMPSR(epnum); fotg210 204 drivers/usb/gadget/udc/fotg210-udc.c fotg210_reset_tseq(ep->fotg210, ep->epnum); fotg210 222 drivers/usb/gadget/udc/fotg210-udc.c spin_lock_irqsave(&ep->fotg210->lock, flags); fotg210 224 drivers/usb/gadget/udc/fotg210-udc.c spin_unlock_irqrestore(&ep->fotg210->lock, flags); fotg210 257 drivers/usb/gadget/udc/fotg210-udc.c struct fotg210_udc *fotg210 = ep->fotg210; fotg210 260 drivers/usb/gadget/udc/fotg210-udc.c value = ioread32(fotg210->reg + FOTG210_DMACPSR1); fotg210 263 drivers/usb/gadget/udc/fotg210-udc.c iowrite32(value, fotg210->reg + FOTG210_DMACPSR1); fotg210 266 drivers/usb/gadget/udc/fotg210-udc.c value = ioread32(fotg210->reg + FOTG210_DMATFNR); fotg210 271 drivers/usb/gadget/udc/fotg210-udc.c iowrite32(value, fotg210->reg + FOTG210_DMATFNR); fotg210 274 drivers/usb/gadget/udc/fotg210-udc.c iowrite32(d, fotg210->reg + FOTG210_DMACPSR2); fotg210 277 drivers/usb/gadget/udc/fotg210-udc.c value = ioread32(fotg210->reg + FOTG210_DMISGR2); fotg210 279 drivers/usb/gadget/udc/fotg210-udc.c iowrite32(value, fotg210->reg + FOTG210_DMISGR2); fotg210 282 drivers/usb/gadget/udc/fotg210-udc.c value = ioread32(fotg210->reg + FOTG210_DMACPSR1); fotg210 284 drivers/usb/gadget/udc/fotg210-udc.c iowrite32(value, fotg210->reg + FOTG210_DMACPSR1); fotg210 289 drivers/usb/gadget/udc/fotg210-udc.c iowrite32(DMATFNR_DISDMA, ep->fotg210->reg + FOTG210_DMATFNR); fotg210 297 drivers/usb/gadget/udc/fotg210-udc.c value = ioread32(ep->fotg210->reg + FOTG210_DISGR2); fotg210 304 drivers/usb/gadget/udc/fotg210-udc.c iowrite32(value, ep->fotg210->reg + FOTG210_DISGR2); fotg210 308 drivers/usb/gadget/udc/fotg210-udc.c value = ioread32(ep->fotg210->reg + FOTG210_DMACPSR1); fotg210 310 drivers/usb/gadget/udc/fotg210-udc.c iowrite32(value, ep->fotg210->reg + FOTG210_DMACPSR1); fotg210 314 drivers/usb/gadget/udc/fotg210-udc.c value = ioread32(ep->fotg210->reg + fotg210 317 drivers/usb/gadget/udc/fotg210-udc.c iowrite32(value, ep->fotg210->reg + fotg210 320 drivers/usb/gadget/udc/fotg210-udc.c value = ioread32(ep->fotg210->reg + FOTG210_DCFESR); fotg210 322 drivers/usb/gadget/udc/fotg210-udc.c iowrite32(value, ep->fotg210->reg + FOTG210_DCFESR); fotg210 329 drivers/usb/gadget/udc/fotg210-udc.c struct device *dev = &ep->fotg210->gadget.dev; fotg210 340 drivers/usb/gadget/udc/fotg210-udc.c length = ioread32(ep->fotg210->reg + fotg210 386 drivers/usb/gadget/udc/fotg210-udc.c u32 value = ioread32(ep->fotg210->reg + FOTG210_DMISGR0); fotg210 389 drivers/usb/gadget/udc/fotg210-udc.c iowrite32(value, ep->fotg210->reg + FOTG210_DMISGR0); fotg210 404 drivers/usb/gadget/udc/fotg210-udc.c if (ep->fotg210->gadget.speed == USB_SPEED_UNKNOWN) fotg210 407 drivers/usb/gadget/udc/fotg210-udc.c spin_lock_irqsave(&ep->fotg210->lock, flags); fotg210 422 drivers/usb/gadget/udc/fotg210-udc.c spin_unlock_irqrestore(&ep->fotg210->lock, flags); fotg210 436 drivers/usb/gadget/udc/fotg210-udc.c spin_lock_irqsave(&ep->fotg210->lock, flags); fotg210 439 drivers/usb/gadget/udc/fotg210-udc.c spin_unlock_irqrestore(&ep->fotg210->lock, flags); fotg210 446 drivers/usb/gadget/udc/fotg210-udc.c struct fotg210_udc *fotg210 = ep->fotg210; fotg210 453 drivers/usb/gadget/udc/fotg210-udc.c value = ioread32(fotg210->reg + FOTG210_DCFESR); fotg210 458 drivers/usb/gadget/udc/fotg210-udc.c fotg210->reg + FOTG210_INEPMPSR(ep->epnum) : fotg210 459 drivers/usb/gadget/udc/fotg210-udc.c fotg210->reg + FOTG210_OUTEPMPSR(ep->epnum); fotg210 467 drivers/usb/gadget/udc/fotg210-udc.c struct fotg210_udc *fotg210 = ep->fotg210; fotg210 472 drivers/usb/gadget/udc/fotg210-udc.c fotg210->reg + FOTG210_INEPMPSR(ep->epnum) : fotg210 473 drivers/usb/gadget/udc/fotg210-udc.c fotg210->reg + FOTG210_OUTEPMPSR(ep->epnum); fotg210 482 drivers/usb/gadget/udc/fotg210-udc.c struct fotg210_udc *fotg210; fotg210 487 drivers/usb/gadget/udc/fotg210-udc.c fotg210 = ep->fotg210; fotg210 489 drivers/usb/gadget/udc/fotg210-udc.c spin_lock_irqsave(&ep->fotg210->lock, flags); fotg210 497 drivers/usb/gadget/udc/fotg210-udc.c fotg210_reset_tseq(fotg210, ep->epnum); fotg210 505 drivers/usb/gadget/udc/fotg210-udc.c spin_unlock_irqrestore(&ep->fotg210->lock, flags); fotg210 538 drivers/usb/gadget/udc/fotg210-udc.c static void fotg210_clear_tx0byte(struct fotg210_udc *fotg210) fotg210 540 drivers/usb/gadget/udc/fotg210-udc.c u32 value = ioread32(fotg210->reg + FOTG210_TX0BYTE); fotg210 544 drivers/usb/gadget/udc/fotg210-udc.c iowrite32(value, fotg210->reg + FOTG210_TX0BYTE); fotg210 547 drivers/usb/gadget/udc/fotg210-udc.c static void fotg210_clear_rx0byte(struct fotg210_udc *fotg210) fotg210 549 drivers/usb/gadget/udc/fotg210-udc.c u32 value = ioread32(fotg210->reg + FOTG210_RX0BYTE); fotg210 553 drivers/usb/gadget/udc/fotg210-udc.c iowrite32(value, fotg210->reg + FOTG210_RX0BYTE); fotg210 557 drivers/usb/gadget/udc/fotg210-udc.c static void fotg210_rdsetupp(struct fotg210_udc *fotg210, fotg210 565 drivers/usb/gadget/udc/fotg210-udc.c iowrite32(DMATFNR_ACC_CXF, fotg210->reg + FOTG210_DMATFNR); fotg210 568 drivers/usb/gadget/udc/fotg210-udc.c data = ioread32(fotg210->reg + FOTG210_CXPORT); fotg210 578 drivers/usb/gadget/udc/fotg210-udc.c data = ioread32(fotg210->reg + FOTG210_CXPORT); fotg210 582 drivers/usb/gadget/udc/fotg210-udc.c data = ioread32(fotg210->reg + FOTG210_CXPORT); fotg210 587 drivers/usb/gadget/udc/fotg210-udc.c data = ioread32(fotg210->reg + FOTG210_CXPORT); fotg210 596 drivers/usb/gadget/udc/fotg210-udc.c iowrite32(DMATFNR_DISDMA, fotg210->reg + FOTG210_DMATFNR); fotg210 599 drivers/usb/gadget/udc/fotg210-udc.c static void fotg210_set_configuration(struct fotg210_udc *fotg210) fotg210 601 drivers/usb/gadget/udc/fotg210-udc.c u32 value = ioread32(fotg210->reg + FOTG210_DAR); fotg210 604 drivers/usb/gadget/udc/fotg210-udc.c iowrite32(value, fotg210->reg + FOTG210_DAR); fotg210 607 drivers/usb/gadget/udc/fotg210-udc.c static void fotg210_set_dev_addr(struct fotg210_udc *fotg210, u32 addr) fotg210 609 drivers/usb/gadget/udc/fotg210-udc.c u32 value = ioread32(fotg210->reg + FOTG210_DAR); fotg210 612 drivers/usb/gadget/udc/fotg210-udc.c iowrite32(value, fotg210->reg + FOTG210_DAR); fotg210 615 drivers/usb/gadget/udc/fotg210-udc.c static void fotg210_set_cxstall(struct fotg210_udc *fotg210) fotg210 617 drivers/usb/gadget/udc/fotg210-udc.c u32 value = ioread32(fotg210->reg + FOTG210_DCFESR); fotg210 620 drivers/usb/gadget/udc/fotg210-udc.c iowrite32(value, fotg210->reg + FOTG210_DCFESR); fotg210 623 drivers/usb/gadget/udc/fotg210-udc.c static void fotg210_request_error(struct fotg210_udc *fotg210) fotg210 625 drivers/usb/gadget/udc/fotg210-udc.c fotg210_set_cxstall(fotg210); fotg210 629 drivers/usb/gadget/udc/fotg210-udc.c static void fotg210_set_address(struct fotg210_udc *fotg210, fotg210 633 drivers/usb/gadget/udc/fotg210-udc.c fotg210_request_error(fotg210); fotg210 635 drivers/usb/gadget/udc/fotg210-udc.c fotg210_set_dev_addr(fotg210, ctrl->wValue); fotg210 636 drivers/usb/gadget/udc/fotg210-udc.c fotg210_set_cxdone(fotg210); fotg210 640 drivers/usb/gadget/udc/fotg210-udc.c static void fotg210_set_feature(struct fotg210_udc *fotg210, fotg210 645 drivers/usb/gadget/udc/fotg210-udc.c fotg210_set_cxdone(fotg210); fotg210 648 drivers/usb/gadget/udc/fotg210-udc.c fotg210_set_cxdone(fotg210); fotg210 654 drivers/usb/gadget/udc/fotg210-udc.c fotg210_set_epnstall(fotg210->ep[epnum]); fotg210 656 drivers/usb/gadget/udc/fotg210-udc.c fotg210_set_cxstall(fotg210); fotg210 657 drivers/usb/gadget/udc/fotg210-udc.c fotg210_set_cxdone(fotg210); fotg210 661 drivers/usb/gadget/udc/fotg210-udc.c fotg210_request_error(fotg210); fotg210 666 drivers/usb/gadget/udc/fotg210-udc.c static void fotg210_clear_feature(struct fotg210_udc *fotg210, fotg210 670 drivers/usb/gadget/udc/fotg210-udc.c fotg210->ep[ctrl->wIndex & USB_ENDPOINT_NUMBER_MASK]; fotg210 674 drivers/usb/gadget/udc/fotg210-udc.c fotg210_set_cxdone(fotg210); fotg210 677 drivers/usb/gadget/udc/fotg210-udc.c fotg210_set_cxdone(fotg210); fotg210 682 drivers/usb/gadget/udc/fotg210-udc.c fotg210_set_cxdone(fotg210); fotg210 688 drivers/usb/gadget/udc/fotg210-udc.c fotg210_set_cxdone(fotg210); fotg210 691 drivers/usb/gadget/udc/fotg210-udc.c fotg210_request_error(fotg210); fotg210 698 drivers/usb/gadget/udc/fotg210-udc.c struct fotg210_udc *fotg210 = ep->fotg210; fotg210 703 drivers/usb/gadget/udc/fotg210-udc.c fotg210->reg + FOTG210_INEPMPSR(ep->epnum) : fotg210 704 drivers/usb/gadget/udc/fotg210-udc.c fotg210->reg + FOTG210_OUTEPMPSR(ep->epnum); fotg210 709 drivers/usb/gadget/udc/fotg210-udc.c static void fotg210_get_status(struct fotg210_udc *fotg210, fotg210 716 drivers/usb/gadget/udc/fotg210-udc.c fotg210->ep0_data = 1 << USB_DEVICE_SELF_POWERED; fotg210 719 drivers/usb/gadget/udc/fotg210-udc.c fotg210->ep0_data = 0; fotg210 724 drivers/usb/gadget/udc/fotg210-udc.c fotg210->ep0_data = fotg210 725 drivers/usb/gadget/udc/fotg210-udc.c fotg210_is_epnstall(fotg210->ep[epnum]) fotg210 728 drivers/usb/gadget/udc/fotg210-udc.c fotg210_request_error(fotg210); fotg210 732 drivers/usb/gadget/udc/fotg210-udc.c fotg210_request_error(fotg210); fotg210 736 drivers/usb/gadget/udc/fotg210-udc.c fotg210->ep0_req->buf = &fotg210->ep0_data; fotg210 737 drivers/usb/gadget/udc/fotg210-udc.c fotg210->ep0_req->length = 2; fotg210 739 drivers/usb/gadget/udc/fotg210-udc.c spin_unlock(&fotg210->lock); fotg210 740 drivers/usb/gadget/udc/fotg210-udc.c fotg210_ep_queue(fotg210->gadget.ep0, fotg210->ep0_req, GFP_ATOMIC); fotg210 741 drivers/usb/gadget/udc/fotg210-udc.c spin_lock(&fotg210->lock); fotg210 744 drivers/usb/gadget/udc/fotg210-udc.c static int fotg210_setup_packet(struct fotg210_udc *fotg210, fotg210 750 drivers/usb/gadget/udc/fotg210-udc.c fotg210_rdsetupp(fotg210, p); fotg210 752 drivers/usb/gadget/udc/fotg210-udc.c fotg210->ep[0]->dir_in = ctrl->bRequestType & USB_DIR_IN; fotg210 754 drivers/usb/gadget/udc/fotg210-udc.c if (fotg210->gadget.speed == USB_SPEED_UNKNOWN) { fotg210 755 drivers/usb/gadget/udc/fotg210-udc.c u32 value = ioread32(fotg210->reg + FOTG210_DMCR); fotg210 756 drivers/usb/gadget/udc/fotg210-udc.c fotg210->gadget.speed = value & DMCR_HS_EN ? fotg210 764 drivers/usb/gadget/udc/fotg210-udc.c fotg210_get_status(fotg210, ctrl); fotg210 767 drivers/usb/gadget/udc/fotg210-udc.c fotg210_clear_feature(fotg210, ctrl); fotg210 770 drivers/usb/gadget/udc/fotg210-udc.c fotg210_set_feature(fotg210, ctrl); fotg210 773 drivers/usb/gadget/udc/fotg210-udc.c fotg210_set_address(fotg210, ctrl); fotg210 776 drivers/usb/gadget/udc/fotg210-udc.c fotg210_set_configuration(fotg210); fotg210 790 drivers/usb/gadget/udc/fotg210-udc.c static void fotg210_ep0out(struct fotg210_udc *fotg210) fotg210 792 drivers/usb/gadget/udc/fotg210-udc.c struct fotg210_ep *ep = fotg210->ep[0]; fotg210 810 drivers/usb/gadget/udc/fotg210-udc.c static void fotg210_ep0in(struct fotg210_udc *fotg210) fotg210 812 drivers/usb/gadget/udc/fotg210-udc.c struct fotg210_ep *ep = fotg210->ep[0]; fotg210 826 drivers/usb/gadget/udc/fotg210-udc.c fotg210_set_cxdone(fotg210); fotg210 830 drivers/usb/gadget/udc/fotg210-udc.c static void fotg210_clear_comabt_int(struct fotg210_udc *fotg210) fotg210 832 drivers/usb/gadget/udc/fotg210-udc.c u32 value = ioread32(fotg210->reg + FOTG210_DISGR0); fotg210 835 drivers/usb/gadget/udc/fotg210-udc.c iowrite32(value, fotg210->reg + FOTG210_DISGR0); fotg210 863 drivers/usb/gadget/udc/fotg210-udc.c struct fotg210_udc *fotg210 = _fotg210; fotg210 864 drivers/usb/gadget/udc/fotg210-udc.c u32 int_grp = ioread32(fotg210->reg + FOTG210_DIGR); fotg210 865 drivers/usb/gadget/udc/fotg210-udc.c u32 int_msk = ioread32(fotg210->reg + FOTG210_DMIGR); fotg210 869 drivers/usb/gadget/udc/fotg210-udc.c spin_lock(&fotg210->lock); fotg210 872 drivers/usb/gadget/udc/fotg210-udc.c void __iomem *reg = fotg210->reg + FOTG210_DISGR2; fotg210 874 drivers/usb/gadget/udc/fotg210-udc.c u32 int_msk2 = ioread32(fotg210->reg + FOTG210_DMISGR2); fotg210 910 drivers/usb/gadget/udc/fotg210-udc.c fotg210_clear_tx0byte(fotg210); fotg210 917 drivers/usb/gadget/udc/fotg210-udc.c fotg210_clear_rx0byte(fotg210); fotg210 931 drivers/usb/gadget/udc/fotg210-udc.c void __iomem *reg = fotg210->reg + FOTG210_DISGR0; fotg210 933 drivers/usb/gadget/udc/fotg210-udc.c u32 int_msk0 = ioread32(fotg210->reg + FOTG210_DMISGR0); fotg210 940 drivers/usb/gadget/udc/fotg210-udc.c fotg210_clear_comabt_int(fotg210); fotg210 945 drivers/usb/gadget/udc/fotg210-udc.c if (fotg210_setup_packet(fotg210, &ctrl)) { fotg210 946 drivers/usb/gadget/udc/fotg210-udc.c spin_unlock(&fotg210->lock); fotg210 947 drivers/usb/gadget/udc/fotg210-udc.c if (fotg210->driver->setup(&fotg210->gadget, fotg210 949 drivers/usb/gadget/udc/fotg210-udc.c fotg210_set_cxstall(fotg210); fotg210 950 drivers/usb/gadget/udc/fotg210-udc.c spin_lock(&fotg210->lock); fotg210 957 drivers/usb/gadget/udc/fotg210-udc.c fotg210_ep0in(fotg210); fotg210 960 drivers/usb/gadget/udc/fotg210-udc.c fotg210_ep0out(fotg210); fotg210 963 drivers/usb/gadget/udc/fotg210-udc.c fotg210_set_cxstall(fotg210); fotg210 969 drivers/usb/gadget/udc/fotg210-udc.c void __iomem *reg = fotg210->reg + FOTG210_DISGR1; fotg210 971 drivers/usb/gadget/udc/fotg210-udc.c u32 int_msk1 = ioread32(fotg210->reg + FOTG210_DMISGR1); fotg210 978 drivers/usb/gadget/udc/fotg210-udc.c fotg210_in_fifo_handler(fotg210->ep[fifo + 1]); fotg210 982 drivers/usb/gadget/udc/fotg210-udc.c fotg210_out_fifo_handler(fotg210->ep[fifo + 1]); fotg210 986 drivers/usb/gadget/udc/fotg210-udc.c spin_unlock(&fotg210->lock); fotg210 991 drivers/usb/gadget/udc/fotg210-udc.c static void fotg210_disable_unplug(struct fotg210_udc *fotg210) fotg210 993 drivers/usb/gadget/udc/fotg210-udc.c u32 reg = ioread32(fotg210->reg + FOTG210_PHYTMSR); fotg210 996 drivers/usb/gadget/udc/fotg210-udc.c iowrite32(reg, fotg210->reg + FOTG210_PHYTMSR); fotg210 1002 drivers/usb/gadget/udc/fotg210-udc.c struct fotg210_udc *fotg210 = gadget_to_fotg210(g); fotg210 1007 drivers/usb/gadget/udc/fotg210-udc.c fotg210->driver = driver; fotg210 1010 drivers/usb/gadget/udc/fotg210-udc.c value = ioread32(fotg210->reg + FOTG210_DMCR); fotg210 1012 drivers/usb/gadget/udc/fotg210-udc.c iowrite32(value, fotg210->reg + FOTG210_DMCR); fotg210 1017 drivers/usb/gadget/udc/fotg210-udc.c static void fotg210_init(struct fotg210_udc *fotg210) fotg210 1023 drivers/usb/gadget/udc/fotg210-udc.c fotg210->reg + FOTG210_GMIR); fotg210 1026 drivers/usb/gadget/udc/fotg210-udc.c value = ioread32(fotg210->reg + FOTG210_DMCR); fotg210 1028 drivers/usb/gadget/udc/fotg210-udc.c iowrite32(value, fotg210->reg + FOTG210_DMCR); fotg210 1031 drivers/usb/gadget/udc/fotg210-udc.c iowrite32(~(u32)0, fotg210->reg + FOTG210_DMISGR1); fotg210 1034 drivers/usb/gadget/udc/fotg210-udc.c value = ioread32(fotg210->reg + FOTG210_DMISGR0); fotg210 1036 drivers/usb/gadget/udc/fotg210-udc.c iowrite32(value, fotg210->reg + FOTG210_DMISGR0); fotg210 1041 drivers/usb/gadget/udc/fotg210-udc.c struct fotg210_udc *fotg210 = gadget_to_fotg210(g); fotg210 1044 drivers/usb/gadget/udc/fotg210-udc.c spin_lock_irqsave(&fotg210->lock, flags); fotg210 1046 drivers/usb/gadget/udc/fotg210-udc.c fotg210_init(fotg210); fotg210 1047 drivers/usb/gadget/udc/fotg210-udc.c fotg210->driver = NULL; fotg210 1049 drivers/usb/gadget/udc/fotg210-udc.c spin_unlock_irqrestore(&fotg210->lock, flags); fotg210 1061 drivers/usb/gadget/udc/fotg210-udc.c struct fotg210_udc *fotg210 = platform_get_drvdata(pdev); fotg210 1064 drivers/usb/gadget/udc/fotg210-udc.c usb_del_gadget_udc(&fotg210->gadget); fotg210 1065 drivers/usb/gadget/udc/fotg210-udc.c iounmap(fotg210->reg); fotg210 1066 drivers/usb/gadget/udc/fotg210-udc.c free_irq(platform_get_irq(pdev, 0), fotg210); fotg210 1068 drivers/usb/gadget/udc/fotg210-udc.c fotg210_ep_free_request(&fotg210->ep[0]->ep, fotg210->ep0_req); fotg210 1070 drivers/usb/gadget/udc/fotg210-udc.c kfree(fotg210->ep[i]); fotg210 1071 drivers/usb/gadget/udc/fotg210-udc.c kfree(fotg210); fotg210 1079 drivers/usb/gadget/udc/fotg210-udc.c struct fotg210_udc *fotg210 = NULL; fotg210 1099 drivers/usb/gadget/udc/fotg210-udc.c fotg210 = kzalloc(sizeof(struct fotg210_udc), GFP_KERNEL); fotg210 1100 drivers/usb/gadget/udc/fotg210-udc.c if (fotg210 == NULL) fotg210 1107 drivers/usb/gadget/udc/fotg210-udc.c fotg210->ep[i] = _ep[i]; fotg210 1110 drivers/usb/gadget/udc/fotg210-udc.c fotg210->reg = ioremap(res->start, resource_size(res)); fotg210 1111 drivers/usb/gadget/udc/fotg210-udc.c if (fotg210->reg == NULL) { fotg210 1116 drivers/usb/gadget/udc/fotg210-udc.c spin_lock_init(&fotg210->lock); fotg210 1118 drivers/usb/gadget/udc/fotg210-udc.c platform_set_drvdata(pdev, fotg210); fotg210 1120 drivers/usb/gadget/udc/fotg210-udc.c fotg210->gadget.ops = &fotg210_gadget_ops; fotg210 1122 drivers/usb/gadget/udc/fotg210-udc.c fotg210->gadget.max_speed = USB_SPEED_HIGH; fotg210 1123 drivers/usb/gadget/udc/fotg210-udc.c fotg210->gadget.dev.parent = &pdev->dev; fotg210 1124 drivers/usb/gadget/udc/fotg210-udc.c fotg210->gadget.dev.dma_mask = pdev->dev.dma_mask; fotg210 1125 drivers/usb/gadget/udc/fotg210-udc.c fotg210->gadget.name = udc_name; fotg210 1127 drivers/usb/gadget/udc/fotg210-udc.c INIT_LIST_HEAD(&fotg210->gadget.ep_list); fotg210 1130 drivers/usb/gadget/udc/fotg210-udc.c struct fotg210_ep *ep = fotg210->ep[i]; fotg210 1133 drivers/usb/gadget/udc/fotg210-udc.c INIT_LIST_HEAD(&fotg210->ep[i]->ep.ep_list); fotg210 1134 drivers/usb/gadget/udc/fotg210-udc.c list_add_tail(&fotg210->ep[i]->ep.ep_list, fotg210 1135 drivers/usb/gadget/udc/fotg210-udc.c &fotg210->gadget.ep_list); fotg210 1137 drivers/usb/gadget/udc/fotg210-udc.c ep->fotg210 = fotg210; fotg210 1154 drivers/usb/gadget/udc/fotg210-udc.c usb_ep_set_maxpacket_limit(&fotg210->ep[0]->ep, 0x40); fotg210 1155 drivers/usb/gadget/udc/fotg210-udc.c fotg210->gadget.ep0 = &fotg210->ep[0]->ep; fotg210 1156 drivers/usb/gadget/udc/fotg210-udc.c INIT_LIST_HEAD(&fotg210->gadget.ep0->ep_list); fotg210 1158 drivers/usb/gadget/udc/fotg210-udc.c fotg210->ep0_req = fotg210_ep_alloc_request(&fotg210->ep[0]->ep, fotg210 1160 drivers/usb/gadget/udc/fotg210-udc.c if (fotg210->ep0_req == NULL) fotg210 1163 drivers/usb/gadget/udc/fotg210-udc.c fotg210_init(fotg210); fotg210 1165 drivers/usb/gadget/udc/fotg210-udc.c fotg210_disable_unplug(fotg210); fotg210 1168 drivers/usb/gadget/udc/fotg210-udc.c udc_name, fotg210); fotg210 1174 drivers/usb/gadget/udc/fotg210-udc.c ret = usb_add_gadget_udc(&pdev->dev, &fotg210->gadget); fotg210 1183 drivers/usb/gadget/udc/fotg210-udc.c free_irq(ires->start, fotg210); fotg210 1186 drivers/usb/gadget/udc/fotg210-udc.c fotg210_ep_free_request(&fotg210->ep[0]->ep, fotg210->ep0_req); fotg210 1189 drivers/usb/gadget/udc/fotg210-udc.c iounmap(fotg210->reg); fotg210 1193 drivers/usb/gadget/udc/fotg210-udc.c kfree(fotg210->ep[i]); fotg210 1194 drivers/usb/gadget/udc/fotg210-udc.c kfree(fotg210); fotg210 217 drivers/usb/gadget/udc/fotg210.h struct fotg210_udc *fotg210; fotg210 81 drivers/usb/host/fotg210-hcd.c #define fotg210_dbg(fotg210, fmt, args...) \ fotg210 82 drivers/usb/host/fotg210-hcd.c dev_dbg(fotg210_to_hcd(fotg210)->self.controller, fmt, ## args) fotg210 83 drivers/usb/host/fotg210-hcd.c #define fotg210_err(fotg210, fmt, args...) \ fotg210 84 drivers/usb/host/fotg210-hcd.c dev_err(fotg210_to_hcd(fotg210)->self.controller, fmt, ## args) fotg210 85 drivers/usb/host/fotg210-hcd.c #define fotg210_info(fotg210, fmt, args...) \ fotg210 86 drivers/usb/host/fotg210-hcd.c dev_info(fotg210_to_hcd(fotg210)->self.controller, fmt, ## args) fotg210 87 drivers/usb/host/fotg210-hcd.c #define fotg210_warn(fotg210, fmt, args...) \ fotg210 88 drivers/usb/host/fotg210-hcd.c dev_warn(fotg210_to_hcd(fotg210)->self.controller, fmt, ## args) fotg210 93 drivers/usb/host/fotg210-hcd.c static void dbg_hcs_params(struct fotg210_hcd *fotg210, char *label) fotg210 95 drivers/usb/host/fotg210-hcd.c u32 params = fotg210_readl(fotg210, &fotg210->caps->hcs_params); fotg210 97 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, "%s hcs_params 0x%x ports=%d\n", label, params, fotg210 104 drivers/usb/host/fotg210-hcd.c static void dbg_hcc_params(struct fotg210_hcd *fotg210, char *label) fotg210 106 drivers/usb/host/fotg210-hcd.c u32 params = fotg210_readl(fotg210, &fotg210->caps->hcc_params); fotg210 108 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, "%s hcc_params %04x uframes %s%s\n", label, fotg210 115 drivers/usb/host/fotg210-hcd.c dbg_qtd(const char *label, struct fotg210_hcd *fotg210, struct fotg210_qtd *qtd) fotg210 117 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, "%s td %p n%08x %08x t%08x p0=%08x\n", label, qtd, fotg210 118 drivers/usb/host/fotg210-hcd.c hc32_to_cpup(fotg210, &qtd->hw_next), fotg210 119 drivers/usb/host/fotg210-hcd.c hc32_to_cpup(fotg210, &qtd->hw_alt_next), fotg210 120 drivers/usb/host/fotg210-hcd.c hc32_to_cpup(fotg210, &qtd->hw_token), fotg210 121 drivers/usb/host/fotg210-hcd.c hc32_to_cpup(fotg210, &qtd->hw_buf[0])); fotg210 123 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, " p1=%08x p2=%08x p3=%08x p4=%08x\n", fotg210 124 drivers/usb/host/fotg210-hcd.c hc32_to_cpup(fotg210, &qtd->hw_buf[1]), fotg210 125 drivers/usb/host/fotg210-hcd.c hc32_to_cpup(fotg210, &qtd->hw_buf[2]), fotg210 126 drivers/usb/host/fotg210-hcd.c hc32_to_cpup(fotg210, &qtd->hw_buf[3]), fotg210 127 drivers/usb/host/fotg210-hcd.c hc32_to_cpup(fotg210, &qtd->hw_buf[4])); fotg210 131 drivers/usb/host/fotg210-hcd.c dbg_qh(const char *label, struct fotg210_hcd *fotg210, struct fotg210_qh *qh) fotg210 135 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, "%s qh %p n%08x info %x %x qtd %x\n", label, qh, fotg210 139 drivers/usb/host/fotg210-hcd.c dbg_qtd("overlay", fotg210, (struct fotg210_qtd *) &hw->hw_qtd_next); fotg210 143 drivers/usb/host/fotg210-hcd.c dbg_itd(const char *label, struct fotg210_hcd *fotg210, struct fotg210_itd *itd) fotg210 145 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, "%s[%d] itd %p, next %08x, urb %p\n", label, fotg210 146 drivers/usb/host/fotg210-hcd.c itd->frame, itd, hc32_to_cpu(fotg210, itd->hw_next), fotg210 149 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, fotg210 151 drivers/usb/host/fotg210-hcd.c hc32_to_cpu(fotg210, itd->hw_transaction[0]), fotg210 152 drivers/usb/host/fotg210-hcd.c hc32_to_cpu(fotg210, itd->hw_transaction[1]), fotg210 153 drivers/usb/host/fotg210-hcd.c hc32_to_cpu(fotg210, itd->hw_transaction[2]), fotg210 154 drivers/usb/host/fotg210-hcd.c hc32_to_cpu(fotg210, itd->hw_transaction[3]), fotg210 155 drivers/usb/host/fotg210-hcd.c hc32_to_cpu(fotg210, itd->hw_transaction[4]), fotg210 156 drivers/usb/host/fotg210-hcd.c hc32_to_cpu(fotg210, itd->hw_transaction[5]), fotg210 157 drivers/usb/host/fotg210-hcd.c hc32_to_cpu(fotg210, itd->hw_transaction[6]), fotg210 158 drivers/usb/host/fotg210-hcd.c hc32_to_cpu(fotg210, itd->hw_transaction[7])); fotg210 160 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, fotg210 162 drivers/usb/host/fotg210-hcd.c hc32_to_cpu(fotg210, itd->hw_bufp[0]), fotg210 163 drivers/usb/host/fotg210-hcd.c hc32_to_cpu(fotg210, itd->hw_bufp[1]), fotg210 164 drivers/usb/host/fotg210-hcd.c hc32_to_cpu(fotg210, itd->hw_bufp[2]), fotg210 165 drivers/usb/host/fotg210-hcd.c hc32_to_cpu(fotg210, itd->hw_bufp[3]), fotg210 166 drivers/usb/host/fotg210-hcd.c hc32_to_cpu(fotg210, itd->hw_bufp[4]), fotg210 167 drivers/usb/host/fotg210-hcd.c hc32_to_cpu(fotg210, itd->hw_bufp[5]), fotg210 168 drivers/usb/host/fotg210-hcd.c hc32_to_cpu(fotg210, itd->hw_bufp[6])); fotg210 170 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, " index: %d %d %d %d %d %d %d %d\n", fotg210 262 drivers/usb/host/fotg210-hcd.c #define dbg_status(fotg210, label, status) { \ fotg210 265 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, "%s\n", _buf); \ fotg210 268 drivers/usb/host/fotg210-hcd.c #define dbg_cmd(fotg210, label, command) { \ fotg210 271 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, "%s\n", _buf); \ fotg210 274 drivers/usb/host/fotg210-hcd.c #define dbg_port(fotg210, label, port, status) { \ fotg210 276 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, "%s\n", \ fotg210 339 drivers/usb/host/fotg210-hcd.c static inline char token_mark(struct fotg210_hcd *fotg210, __hc32 token) fotg210 341 drivers/usb/host/fotg210-hcd.c __u32 v = hc32_to_cpu(fotg210, token); fotg210 353 drivers/usb/host/fotg210-hcd.c static void qh_lines(struct fotg210_hcd *fotg210, struct fotg210_qh *qh, fotg210 363 drivers/usb/host/fotg210-hcd.c __le32 list_end = FOTG210_LIST_END(fotg210); fotg210 369 drivers/usb/host/fotg210-hcd.c mark = token_mark(fotg210, hw->hw_token); fotg210 371 drivers/usb/host/fotg210-hcd.c if ((hw->hw_alt_next & QTD_MASK(fotg210)) == fotg210 372 drivers/usb/host/fotg210-hcd.c fotg210->async->hw->hw_alt_next) fotg210 378 drivers/usb/host/fotg210-hcd.c scratch = hc32_to_cpup(fotg210, &hw->hw_info1); fotg210 379 drivers/usb/host/fotg210-hcd.c hw_curr = (mark == '*') ? hc32_to_cpup(fotg210, &hw->hw_current) : 0; fotg210 385 drivers/usb/host/fotg210-hcd.c scratch, hc32_to_cpup(fotg210, &hw->hw_info2), fotg210 386 drivers/usb/host/fotg210-hcd.c hc32_to_cpup(fotg210, &hw->hw_token), mark, fotg210 387 drivers/usb/host/fotg210-hcd.c (cpu_to_hc32(fotg210, QTD_TOGGLE) & hw->hw_token) fotg210 389 drivers/usb/host/fotg210-hcd.c (hc32_to_cpup(fotg210, &hw->hw_alt_next) >> 1) & 0x0f); fotg210 395 drivers/usb/host/fotg210-hcd.c scratch = hc32_to_cpup(fotg210, &td->hw_token); fotg210 399 drivers/usb/host/fotg210-hcd.c else if (hw->hw_qtd_next == cpu_to_hc32(fotg210, td->qtd_dma)) fotg210 402 drivers/usb/host/fotg210-hcd.c if (td->hw_alt_next == fotg210->async->hw->hw_alt_next) fotg210 450 drivers/usb/host/fotg210-hcd.c struct fotg210_hcd *fotg210; fotg210 457 drivers/usb/host/fotg210-hcd.c fotg210 = hcd_to_fotg210(hcd); fotg210 467 drivers/usb/host/fotg210-hcd.c spin_lock_irqsave(&fotg210->lock, flags); fotg210 468 drivers/usb/host/fotg210-hcd.c for (qh = fotg210->async->qh_next.qh; size > 0 && qh; fotg210 470 drivers/usb/host/fotg210-hcd.c qh_lines(fotg210, qh, &next, &size); fotg210 471 drivers/usb/host/fotg210-hcd.c if (fotg210->async_unlink && size > 0) { fotg210 476 drivers/usb/host/fotg210-hcd.c for (qh = fotg210->async_unlink; size > 0 && qh; fotg210 478 drivers/usb/host/fotg210-hcd.c qh_lines(fotg210, qh, &next, &size); fotg210 480 drivers/usb/host/fotg210-hcd.c spin_unlock_irqrestore(&fotg210->lock, flags); fotg210 486 drivers/usb/host/fotg210-hcd.c static unsigned output_buf_tds_dir(char *buf, struct fotg210_hcd *fotg210, fotg210 489 drivers/usb/host/fotg210-hcd.c u32 scratch = hc32_to_cpup(fotg210, &hw->hw_info1); fotg210 497 drivers/usb/host/fotg210-hcd.c switch ((hc32_to_cpu(fotg210, qtd->hw_token) >> 8) & 0x03) { fotg210 517 drivers/usb/host/fotg210-hcd.c struct fotg210_hcd *fotg210; fotg210 532 drivers/usb/host/fotg210-hcd.c fotg210 = hcd_to_fotg210(hcd); fotg210 536 drivers/usb/host/fotg210-hcd.c temp = scnprintf(next, size, "size = %d\n", fotg210->periodic_size); fotg210 543 drivers/usb/host/fotg210-hcd.c spin_lock_irqsave(&fotg210->lock, flags); fotg210 544 drivers/usb/host/fotg210-hcd.c for (i = 0; i < fotg210->periodic_size; i++) { fotg210 545 drivers/usb/host/fotg210-hcd.c p = fotg210->pshadow[i]; fotg210 549 drivers/usb/host/fotg210-hcd.c tag = Q_NEXT_TYPE(fotg210, fotg210->periodic[i]); fotg210 558 drivers/usb/host/fotg210-hcd.c switch (hc32_to_cpu(fotg210, tag)) { fotg210 563 drivers/usb/host/fotg210-hcd.c hc32_to_cpup(fotg210, fotg210 585 drivers/usb/host/fotg210-hcd.c fotg210, hw, fotg210 592 drivers/usb/host/fotg210-hcd.c tag = Q_NEXT_TYPE(fotg210, hw->hw_next); fotg210 599 drivers/usb/host/fotg210-hcd.c tag = Q_NEXT_TYPE(fotg210, p.fstn->hw_next); fotg210 605 drivers/usb/host/fotg210-hcd.c tag = Q_NEXT_TYPE(fotg210, p.itd->hw_next); fotg210 617 drivers/usb/host/fotg210-hcd.c spin_unlock_irqrestore(&fotg210->lock, flags); fotg210 624 drivers/usb/host/fotg210-hcd.c static const char *rh_state_string(struct fotg210_hcd *fotg210) fotg210 626 drivers/usb/host/fotg210-hcd.c switch (fotg210->rh_state) { fotg210 642 drivers/usb/host/fotg210-hcd.c struct fotg210_hcd *fotg210; fotg210 650 drivers/usb/host/fotg210-hcd.c fotg210 = hcd_to_fotg210(hcd); fotg210 654 drivers/usb/host/fotg210-hcd.c spin_lock_irqsave(&fotg210->lock, flags); fotg210 668 drivers/usb/host/fotg210-hcd.c i = HC_VERSION(fotg210, fotg210_readl(fotg210, fotg210 669 drivers/usb/host/fotg210-hcd.c &fotg210->caps->hc_capbase)); fotg210 677 drivers/usb/host/fotg210-hcd.c i >> 8, i & 0x0ff, rh_state_string(fotg210)); fotg210 682 drivers/usb/host/fotg210-hcd.c i = fotg210_readl(fotg210, &fotg210->caps->hcs_params); fotg210 687 drivers/usb/host/fotg210-hcd.c i = fotg210_readl(fotg210, &fotg210->caps->hcc_params); fotg210 694 drivers/usb/host/fotg210-hcd.c fotg210_readl(fotg210, &fotg210->regs->status)); fotg210 700 drivers/usb/host/fotg210-hcd.c fotg210_readl(fotg210, &fotg210->regs->command)); fotg210 706 drivers/usb/host/fotg210-hcd.c fotg210_readl(fotg210, &fotg210->regs->intr_enable)); fotg210 712 drivers/usb/host/fotg210-hcd.c fotg210_read_frame_index(fotg210)); fotg210 716 drivers/usb/host/fotg210-hcd.c if (fotg210->async_unlink) { fotg210 718 drivers/usb/host/fotg210-hcd.c fotg210->async_unlink); fotg210 726 drivers/usb/host/fotg210-hcd.c fotg210->stats.normal, fotg210->stats.error, fotg210 727 drivers/usb/host/fotg210-hcd.c fotg210->stats.iaa, fotg210->stats.lost_iaa); fotg210 732 drivers/usb/host/fotg210-hcd.c fotg210->stats.complete, fotg210->stats.unlink); fotg210 738 drivers/usb/host/fotg210-hcd.c spin_unlock_irqrestore(&fotg210->lock, flags); fotg210 846 drivers/usb/host/fotg210-hcd.c static inline void create_debug_files(struct fotg210_hcd *fotg210) fotg210 848 drivers/usb/host/fotg210-hcd.c struct usb_bus *bus = &fotg210_to_hcd(fotg210)->self; fotg210 852 drivers/usb/host/fotg210-hcd.c fotg210->debug_dir = root; fotg210 861 drivers/usb/host/fotg210-hcd.c static inline void remove_debug_files(struct fotg210_hcd *fotg210) fotg210 863 drivers/usb/host/fotg210-hcd.c debugfs_remove_recursive(fotg210->debug_dir); fotg210 882 drivers/usb/host/fotg210-hcd.c static int handshake(struct fotg210_hcd *fotg210, void __iomem *ptr, fotg210 888 drivers/usb/host/fotg210-hcd.c result = fotg210_readl(fotg210, ptr); fotg210 903 drivers/usb/host/fotg210-hcd.c static int fotg210_halt(struct fotg210_hcd *fotg210) fotg210 907 drivers/usb/host/fotg210-hcd.c spin_lock_irq(&fotg210->lock); fotg210 910 drivers/usb/host/fotg210-hcd.c fotg210_writel(fotg210, 0, &fotg210->regs->intr_enable); fotg210 916 drivers/usb/host/fotg210-hcd.c fotg210->command &= ~CMD_RUN; fotg210 917 drivers/usb/host/fotg210-hcd.c temp = fotg210_readl(fotg210, &fotg210->regs->command); fotg210 919 drivers/usb/host/fotg210-hcd.c fotg210_writel(fotg210, temp, &fotg210->regs->command); fotg210 921 drivers/usb/host/fotg210-hcd.c spin_unlock_irq(&fotg210->lock); fotg210 922 drivers/usb/host/fotg210-hcd.c synchronize_irq(fotg210_to_hcd(fotg210)->irq); fotg210 924 drivers/usb/host/fotg210-hcd.c return handshake(fotg210, &fotg210->regs->status, fotg210 931 drivers/usb/host/fotg210-hcd.c static int fotg210_reset(struct fotg210_hcd *fotg210) fotg210 934 drivers/usb/host/fotg210-hcd.c u32 command = fotg210_readl(fotg210, &fotg210->regs->command); fotg210 939 drivers/usb/host/fotg210-hcd.c if (fotg210->debug && !dbgp_reset_prep(fotg210_to_hcd(fotg210))) fotg210 940 drivers/usb/host/fotg210-hcd.c fotg210->debug = NULL; fotg210 943 drivers/usb/host/fotg210-hcd.c dbg_cmd(fotg210, "reset", command); fotg210 944 drivers/usb/host/fotg210-hcd.c fotg210_writel(fotg210, command, &fotg210->regs->command); fotg210 945 drivers/usb/host/fotg210-hcd.c fotg210->rh_state = FOTG210_RH_HALTED; fotg210 946 drivers/usb/host/fotg210-hcd.c fotg210->next_statechange = jiffies; fotg210 947 drivers/usb/host/fotg210-hcd.c retval = handshake(fotg210, &fotg210->regs->command, fotg210 953 drivers/usb/host/fotg210-hcd.c if (fotg210->debug) fotg210 954 drivers/usb/host/fotg210-hcd.c dbgp_external_startup(fotg210_to_hcd(fotg210)); fotg210 956 drivers/usb/host/fotg210-hcd.c fotg210->port_c_suspend = fotg210->suspended_ports = fotg210 957 drivers/usb/host/fotg210-hcd.c fotg210->resuming_ports = 0; fotg210 964 drivers/usb/host/fotg210-hcd.c static void fotg210_quiesce(struct fotg210_hcd *fotg210) fotg210 968 drivers/usb/host/fotg210-hcd.c if (fotg210->rh_state != FOTG210_RH_RUNNING) fotg210 972 drivers/usb/host/fotg210-hcd.c temp = (fotg210->command << 10) & (STS_ASS | STS_PSS); fotg210 973 drivers/usb/host/fotg210-hcd.c handshake(fotg210, &fotg210->regs->status, STS_ASS | STS_PSS, temp, fotg210 977 drivers/usb/host/fotg210-hcd.c spin_lock_irq(&fotg210->lock); fotg210 978 drivers/usb/host/fotg210-hcd.c fotg210->command &= ~(CMD_ASE | CMD_PSE); fotg210 979 drivers/usb/host/fotg210-hcd.c fotg210_writel(fotg210, fotg210->command, &fotg210->regs->command); fotg210 980 drivers/usb/host/fotg210-hcd.c spin_unlock_irq(&fotg210->lock); fotg210 983 drivers/usb/host/fotg210-hcd.c handshake(fotg210, &fotg210->regs->status, STS_ASS | STS_PSS, 0, fotg210 987 drivers/usb/host/fotg210-hcd.c static void end_unlink_async(struct fotg210_hcd *fotg210); fotg210 988 drivers/usb/host/fotg210-hcd.c static void unlink_empty_async(struct fotg210_hcd *fotg210); fotg210 989 drivers/usb/host/fotg210-hcd.c static void fotg210_work(struct fotg210_hcd *fotg210); fotg210 990 drivers/usb/host/fotg210-hcd.c static void start_unlink_intr(struct fotg210_hcd *fotg210, fotg210 992 drivers/usb/host/fotg210-hcd.c static void end_unlink_intr(struct fotg210_hcd *fotg210, struct fotg210_qh *qh); fotg210 995 drivers/usb/host/fotg210-hcd.c static void fotg210_set_command_bit(struct fotg210_hcd *fotg210, u32 bit) fotg210 997 drivers/usb/host/fotg210-hcd.c fotg210->command |= bit; fotg210 998 drivers/usb/host/fotg210-hcd.c fotg210_writel(fotg210, fotg210->command, &fotg210->regs->command); fotg210 1001 drivers/usb/host/fotg210-hcd.c fotg210_readl(fotg210, &fotg210->regs->command); fotg210 1005 drivers/usb/host/fotg210-hcd.c static void fotg210_clear_command_bit(struct fotg210_hcd *fotg210, u32 bit) fotg210 1007 drivers/usb/host/fotg210-hcd.c fotg210->command &= ~bit; fotg210 1008 drivers/usb/host/fotg210-hcd.c fotg210_writel(fotg210, fotg210->command, &fotg210->regs->command); fotg210 1011 drivers/usb/host/fotg210-hcd.c fotg210_readl(fotg210, &fotg210->regs->command); fotg210 1054 drivers/usb/host/fotg210-hcd.c static void fotg210_enable_event(struct fotg210_hcd *fotg210, unsigned event, fotg210 1057 drivers/usb/host/fotg210-hcd.c ktime_t *timeout = &fotg210->hr_timeouts[event]; fotg210 1061 drivers/usb/host/fotg210-hcd.c fotg210->enabled_hrtimer_events |= (1 << event); fotg210 1064 drivers/usb/host/fotg210-hcd.c if (event < fotg210->next_hrtimer_event) { fotg210 1065 drivers/usb/host/fotg210-hcd.c fotg210->next_hrtimer_event = event; fotg210 1066 drivers/usb/host/fotg210-hcd.c hrtimer_start_range_ns(&fotg210->hrtimer, *timeout, fotg210 1073 drivers/usb/host/fotg210-hcd.c static void fotg210_poll_ASS(struct fotg210_hcd *fotg210) fotg210 1078 drivers/usb/host/fotg210-hcd.c if (fotg210->rh_state != FOTG210_RH_RUNNING) fotg210 1081 drivers/usb/host/fotg210-hcd.c want = (fotg210->command & CMD_ASE) ? STS_ASS : 0; fotg210 1082 drivers/usb/host/fotg210-hcd.c actual = fotg210_readl(fotg210, &fotg210->regs->status) & STS_ASS; fotg210 1087 drivers/usb/host/fotg210-hcd.c if (fotg210->ASS_poll_count++ < 20) { fotg210 1088 drivers/usb/host/fotg210-hcd.c fotg210_enable_event(fotg210, FOTG210_HRTIMER_POLL_ASS, fotg210 1092 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, "Waited too long for the async schedule status (%x/%x), giving up\n", fotg210 1095 drivers/usb/host/fotg210-hcd.c fotg210->ASS_poll_count = 0; fotg210 1099 drivers/usb/host/fotg210-hcd.c if (fotg210->async_count > 0) fotg210 1100 drivers/usb/host/fotg210-hcd.c fotg210_set_command_bit(fotg210, CMD_ASE); fotg210 1103 drivers/usb/host/fotg210-hcd.c if (fotg210->async_count == 0) { fotg210 1106 drivers/usb/host/fotg210-hcd.c fotg210_enable_event(fotg210, fotg210 1114 drivers/usb/host/fotg210-hcd.c static void fotg210_disable_ASE(struct fotg210_hcd *fotg210) fotg210 1116 drivers/usb/host/fotg210-hcd.c fotg210_clear_command_bit(fotg210, CMD_ASE); fotg210 1121 drivers/usb/host/fotg210-hcd.c static void fotg210_poll_PSS(struct fotg210_hcd *fotg210) fotg210 1126 drivers/usb/host/fotg210-hcd.c if (fotg210->rh_state != FOTG210_RH_RUNNING) fotg210 1129 drivers/usb/host/fotg210-hcd.c want = (fotg210->command & CMD_PSE) ? STS_PSS : 0; fotg210 1130 drivers/usb/host/fotg210-hcd.c actual = fotg210_readl(fotg210, &fotg210->regs->status) & STS_PSS; fotg210 1135 drivers/usb/host/fotg210-hcd.c if (fotg210->PSS_poll_count++ < 20) { fotg210 1136 drivers/usb/host/fotg210-hcd.c fotg210_enable_event(fotg210, FOTG210_HRTIMER_POLL_PSS, fotg210 1140 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, "Waited too long for the periodic schedule status (%x/%x), giving up\n", fotg210 1143 drivers/usb/host/fotg210-hcd.c fotg210->PSS_poll_count = 0; fotg210 1147 drivers/usb/host/fotg210-hcd.c if (fotg210->periodic_count > 0) fotg210 1148 drivers/usb/host/fotg210-hcd.c fotg210_set_command_bit(fotg210, CMD_PSE); fotg210 1151 drivers/usb/host/fotg210-hcd.c if (fotg210->periodic_count == 0) { fotg210 1154 drivers/usb/host/fotg210-hcd.c fotg210_enable_event(fotg210, fotg210 1162 drivers/usb/host/fotg210-hcd.c static void fotg210_disable_PSE(struct fotg210_hcd *fotg210) fotg210 1164 drivers/usb/host/fotg210-hcd.c fotg210_clear_command_bit(fotg210, CMD_PSE); fotg210 1169 drivers/usb/host/fotg210-hcd.c static void fotg210_handle_controller_death(struct fotg210_hcd *fotg210) fotg210 1171 drivers/usb/host/fotg210-hcd.c if (!(fotg210_readl(fotg210, &fotg210->regs->status) & STS_HALT)) { fotg210 1174 drivers/usb/host/fotg210-hcd.c if (fotg210->died_poll_count++ < 5) { fotg210 1176 drivers/usb/host/fotg210-hcd.c fotg210_enable_event(fotg210, fotg210 1180 drivers/usb/host/fotg210-hcd.c fotg210_warn(fotg210, "Waited too long for the controller to stop, giving up\n"); fotg210 1184 drivers/usb/host/fotg210-hcd.c fotg210->rh_state = FOTG210_RH_HALTED; fotg210 1185 drivers/usb/host/fotg210-hcd.c fotg210_writel(fotg210, 0, &fotg210->regs->intr_enable); fotg210 1186 drivers/usb/host/fotg210-hcd.c fotg210_work(fotg210); fotg210 1187 drivers/usb/host/fotg210-hcd.c end_unlink_async(fotg210); fotg210 1194 drivers/usb/host/fotg210-hcd.c static void fotg210_handle_intr_unlinks(struct fotg210_hcd *fotg210) fotg210 1196 drivers/usb/host/fotg210-hcd.c bool stopped = (fotg210->rh_state < FOTG210_RH_RUNNING); fotg210 1205 drivers/usb/host/fotg210-hcd.c fotg210->intr_unlinking = true; fotg210 1206 drivers/usb/host/fotg210-hcd.c while (fotg210->intr_unlink) { fotg210 1207 drivers/usb/host/fotg210-hcd.c struct fotg210_qh *qh = fotg210->intr_unlink; fotg210 1209 drivers/usb/host/fotg210-hcd.c if (!stopped && qh->unlink_cycle == fotg210->intr_unlink_cycle) fotg210 1211 drivers/usb/host/fotg210-hcd.c fotg210->intr_unlink = qh->unlink_next; fotg210 1213 drivers/usb/host/fotg210-hcd.c end_unlink_intr(fotg210, qh); fotg210 1217 drivers/usb/host/fotg210-hcd.c if (fotg210->intr_unlink) { fotg210 1218 drivers/usb/host/fotg210-hcd.c fotg210_enable_event(fotg210, FOTG210_HRTIMER_UNLINK_INTR, fotg210 1220 drivers/usb/host/fotg210-hcd.c ++fotg210->intr_unlink_cycle; fotg210 1222 drivers/usb/host/fotg210-hcd.c fotg210->intr_unlinking = false; fotg210 1227 drivers/usb/host/fotg210-hcd.c static void start_free_itds(struct fotg210_hcd *fotg210) fotg210 1229 drivers/usb/host/fotg210-hcd.c if (!(fotg210->enabled_hrtimer_events & fotg210 1231 drivers/usb/host/fotg210-hcd.c fotg210->last_itd_to_free = list_entry( fotg210 1232 drivers/usb/host/fotg210-hcd.c fotg210->cached_itd_list.prev, fotg210 1234 drivers/usb/host/fotg210-hcd.c fotg210_enable_event(fotg210, FOTG210_HRTIMER_FREE_ITDS, true); fotg210 1239 drivers/usb/host/fotg210-hcd.c static void end_free_itds(struct fotg210_hcd *fotg210) fotg210 1243 drivers/usb/host/fotg210-hcd.c if (fotg210->rh_state < FOTG210_RH_RUNNING) fotg210 1244 drivers/usb/host/fotg210-hcd.c fotg210->last_itd_to_free = NULL; fotg210 1246 drivers/usb/host/fotg210-hcd.c list_for_each_entry_safe(itd, n, &fotg210->cached_itd_list, itd_list) { fotg210 1248 drivers/usb/host/fotg210-hcd.c dma_pool_free(fotg210->itd_pool, itd, itd->itd_dma); fotg210 1249 drivers/usb/host/fotg210-hcd.c if (itd == fotg210->last_itd_to_free) fotg210 1253 drivers/usb/host/fotg210-hcd.c if (!list_empty(&fotg210->cached_itd_list)) fotg210 1254 drivers/usb/host/fotg210-hcd.c start_free_itds(fotg210); fotg210 1259 drivers/usb/host/fotg210-hcd.c static void fotg210_iaa_watchdog(struct fotg210_hcd *fotg210) fotg210 1261 drivers/usb/host/fotg210-hcd.c if (fotg210->rh_state != FOTG210_RH_RUNNING) fotg210 1270 drivers/usb/host/fotg210-hcd.c if (fotg210->async_iaa) { fotg210 1279 drivers/usb/host/fotg210-hcd.c cmd = fotg210_readl(fotg210, &fotg210->regs->command); fotg210 1288 drivers/usb/host/fotg210-hcd.c status = fotg210_readl(fotg210, &fotg210->regs->status); fotg210 1290 drivers/usb/host/fotg210-hcd.c INCR(fotg210->stats.lost_iaa); fotg210 1291 drivers/usb/host/fotg210-hcd.c fotg210_writel(fotg210, STS_IAA, fotg210 1292 drivers/usb/host/fotg210-hcd.c &fotg210->regs->status); fotg210 1295 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, "IAA watchdog: status %x cmd %x\n", fotg210 1297 drivers/usb/host/fotg210-hcd.c end_unlink_async(fotg210); fotg210 1303 drivers/usb/host/fotg210-hcd.c static void turn_on_io_watchdog(struct fotg210_hcd *fotg210) fotg210 1306 drivers/usb/host/fotg210-hcd.c if (fotg210->rh_state != FOTG210_RH_RUNNING || fotg210 1307 drivers/usb/host/fotg210-hcd.c (fotg210->enabled_hrtimer_events & fotg210 1315 drivers/usb/host/fotg210-hcd.c if (fotg210->isoc_count > 0 || (fotg210->need_io_watchdog && fotg210 1316 drivers/usb/host/fotg210-hcd.c fotg210->async_count + fotg210->intr_count > 0)) fotg210 1317 drivers/usb/host/fotg210-hcd.c fotg210_enable_event(fotg210, FOTG210_HRTIMER_IO_WATCHDOG, fotg210 1341 drivers/usb/host/fotg210-hcd.c struct fotg210_hcd *fotg210 = fotg210 1348 drivers/usb/host/fotg210-hcd.c spin_lock_irqsave(&fotg210->lock, flags); fotg210 1350 drivers/usb/host/fotg210-hcd.c events = fotg210->enabled_hrtimer_events; fotg210 1351 drivers/usb/host/fotg210-hcd.c fotg210->enabled_hrtimer_events = 0; fotg210 1352 drivers/usb/host/fotg210-hcd.c fotg210->next_hrtimer_event = FOTG210_HRTIMER_NO_EVENT; fotg210 1360 drivers/usb/host/fotg210-hcd.c if (ktime_compare(now, fotg210->hr_timeouts[e]) >= 0) fotg210 1361 drivers/usb/host/fotg210-hcd.c event_handlers[e](fotg210); fotg210 1363 drivers/usb/host/fotg210-hcd.c fotg210_enable_event(fotg210, e, false); fotg210 1366 drivers/usb/host/fotg210-hcd.c spin_unlock_irqrestore(&fotg210->lock, flags); fotg210 1373 drivers/usb/host/fotg210-hcd.c static int check_reset_complete(struct fotg210_hcd *fotg210, int index, fotg210 1382 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, "Failed to enable port %d on root hub TT\n", fotg210 1385 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, "port %d reset complete, port enabled\n", fotg210 1396 drivers/usb/host/fotg210-hcd.c struct fotg210_hcd *fotg210 = hcd_to_fotg210(hcd); fotg210 1408 drivers/usb/host/fotg210-hcd.c status = fotg210->resuming_ports; fotg210 1416 drivers/usb/host/fotg210-hcd.c spin_lock_irqsave(&fotg210->lock, flags); fotg210 1418 drivers/usb/host/fotg210-hcd.c temp = fotg210_readl(fotg210, &fotg210->regs->port_status); fotg210 1427 drivers/usb/host/fotg210-hcd.c if ((temp & mask) != 0 || test_bit(0, &fotg210->port_c_suspend) || fotg210 1428 drivers/usb/host/fotg210-hcd.c (fotg210->reset_done[0] && fotg210 1429 drivers/usb/host/fotg210-hcd.c time_after_eq(jiffies, fotg210->reset_done[0]))) { fotg210 1434 drivers/usb/host/fotg210-hcd.c spin_unlock_irqrestore(&fotg210->lock, flags); fotg210 1438 drivers/usb/host/fotg210-hcd.c static void fotg210_hub_descriptor(struct fotg210_hcd *fotg210, fotg210 1441 drivers/usb/host/fotg210-hcd.c int ports = HCS_N_PORTS(fotg210->hcs_params); fotg210 1464 drivers/usb/host/fotg210-hcd.c struct fotg210_hcd *fotg210 = hcd_to_fotg210(hcd); fotg210 1465 drivers/usb/host/fotg210-hcd.c int ports = HCS_N_PORTS(fotg210->hcs_params); fotg210 1466 drivers/usb/host/fotg210-hcd.c u32 __iomem *status_reg = &fotg210->regs->port_status; fotg210 1479 drivers/usb/host/fotg210-hcd.c spin_lock_irqsave(&fotg210->lock, flags); fotg210 1495 drivers/usb/host/fotg210-hcd.c temp = fotg210_readl(fotg210, status_reg); fotg210 1507 drivers/usb/host/fotg210-hcd.c fotg210_writel(fotg210, temp & ~PORT_PE, status_reg); fotg210 1510 drivers/usb/host/fotg210-hcd.c fotg210_writel(fotg210, temp | PORT_PEC, status_reg); fotg210 1521 drivers/usb/host/fotg210-hcd.c fotg210_writel(fotg210, temp | PORT_RESUME, status_reg); fotg210 1522 drivers/usb/host/fotg210-hcd.c fotg210->reset_done[wIndex] = jiffies fotg210 1526 drivers/usb/host/fotg210-hcd.c clear_bit(wIndex, &fotg210->port_c_suspend); fotg210 1529 drivers/usb/host/fotg210-hcd.c fotg210_writel(fotg210, temp | PORT_CSC, status_reg); fotg210 1532 drivers/usb/host/fotg210-hcd.c fotg210_writel(fotg210, temp | OTGISR_OVC, fotg210 1533 drivers/usb/host/fotg210-hcd.c &fotg210->regs->otgisr); fotg210 1541 drivers/usb/host/fotg210-hcd.c fotg210_readl(fotg210, &fotg210->regs->command); fotg210 1544 drivers/usb/host/fotg210-hcd.c fotg210_hub_descriptor(fotg210, (struct usb_hub_descriptor *) fotg210 1557 drivers/usb/host/fotg210-hcd.c temp = fotg210_readl(fotg210, status_reg); fotg210 1565 drivers/usb/host/fotg210-hcd.c temp1 = fotg210_readl(fotg210, &fotg210->regs->otgisr); fotg210 1573 drivers/usb/host/fotg210-hcd.c if (!fotg210->reset_done[wIndex]) { fotg210 1575 drivers/usb/host/fotg210-hcd.c fotg210->reset_done[wIndex] = jiffies fotg210 1578 drivers/usb/host/fotg210-hcd.c mod_timer(&fotg210_to_hcd(fotg210)->rh_timer, fotg210 1579 drivers/usb/host/fotg210-hcd.c fotg210->reset_done[wIndex]); fotg210 1584 drivers/usb/host/fotg210-hcd.c fotg210->reset_done[wIndex])) { fotg210 1585 drivers/usb/host/fotg210-hcd.c clear_bit(wIndex, &fotg210->suspended_ports); fotg210 1586 drivers/usb/host/fotg210-hcd.c set_bit(wIndex, &fotg210->port_c_suspend); fotg210 1587 drivers/usb/host/fotg210-hcd.c fotg210->reset_done[wIndex] = 0; fotg210 1590 drivers/usb/host/fotg210-hcd.c temp = fotg210_readl(fotg210, status_reg); fotg210 1591 drivers/usb/host/fotg210-hcd.c fotg210_writel(fotg210, temp & fotg210 1594 drivers/usb/host/fotg210-hcd.c clear_bit(wIndex, &fotg210->resuming_ports); fotg210 1595 drivers/usb/host/fotg210-hcd.c retval = handshake(fotg210, status_reg, fotg210 1598 drivers/usb/host/fotg210-hcd.c fotg210_err(fotg210, fotg210 1609 drivers/usb/host/fotg210-hcd.c fotg210->reset_done[wIndex])) { fotg210 1611 drivers/usb/host/fotg210-hcd.c fotg210->reset_done[wIndex] = 0; fotg210 1612 drivers/usb/host/fotg210-hcd.c clear_bit(wIndex, &fotg210->resuming_ports); fotg210 1615 drivers/usb/host/fotg210-hcd.c fotg210_writel(fotg210, fotg210 1621 drivers/usb/host/fotg210-hcd.c retval = handshake(fotg210, status_reg, fotg210 1624 drivers/usb/host/fotg210-hcd.c fotg210_err(fotg210, "port %d reset error %d\n", fotg210 1630 drivers/usb/host/fotg210-hcd.c temp = check_reset_complete(fotg210, wIndex, status_reg, fotg210 1631 drivers/usb/host/fotg210-hcd.c fotg210_readl(fotg210, status_reg)); fotg210 1634 drivers/usb/host/fotg210-hcd.c fotg210->command |= CMD_RUN; fotg210 1635 drivers/usb/host/fotg210-hcd.c fotg210_writel(fotg210, fotg210->command, &fotg210->regs->command); fotg210 1639 drivers/usb/host/fotg210-hcd.c fotg210->reset_done[wIndex] = 0; fotg210 1640 drivers/usb/host/fotg210-hcd.c clear_bit(wIndex, &fotg210->resuming_ports); fotg210 1645 drivers/usb/host/fotg210-hcd.c test_bit(wIndex, &fotg210->companion_ports)) { fotg210 1647 drivers/usb/host/fotg210-hcd.c fotg210_writel(fotg210, temp, status_reg); fotg210 1648 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, "port %d --> companion\n", fotg210 1650 drivers/usb/host/fotg210-hcd.c temp = fotg210_readl(fotg210, status_reg); fotg210 1661 drivers/usb/host/fotg210-hcd.c status |= fotg210_port_speed(fotg210, temp); fotg210 1669 drivers/usb/host/fotg210-hcd.c } else if (test_bit(wIndex, &fotg210->suspended_ports)) { fotg210 1670 drivers/usb/host/fotg210-hcd.c clear_bit(wIndex, &fotg210->suspended_ports); fotg210 1671 drivers/usb/host/fotg210-hcd.c clear_bit(wIndex, &fotg210->resuming_ports); fotg210 1672 drivers/usb/host/fotg210-hcd.c fotg210->reset_done[wIndex] = 0; fotg210 1674 drivers/usb/host/fotg210-hcd.c set_bit(wIndex, &fotg210->port_c_suspend); fotg210 1677 drivers/usb/host/fotg210-hcd.c temp1 = fotg210_readl(fotg210, &fotg210->regs->otgisr); fotg210 1682 drivers/usb/host/fotg210-hcd.c if (test_bit(wIndex, &fotg210->port_c_suspend)) fotg210 1686 drivers/usb/host/fotg210-hcd.c dbg_port(fotg210, "GetStatus", wIndex + 1, temp); fotg210 1706 drivers/usb/host/fotg210-hcd.c temp = fotg210_readl(fotg210, status_reg); fotg210 1718 drivers/usb/host/fotg210-hcd.c fotg210_writel(fotg210, temp | PORT_SUSPEND, fotg210 1720 drivers/usb/host/fotg210-hcd.c set_bit(wIndex, &fotg210->suspended_ports); fotg210 1729 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, "port %d reset\n", wIndex + 1); fotg210 1737 drivers/usb/host/fotg210-hcd.c fotg210->reset_done[wIndex] = jiffies fotg210 1739 drivers/usb/host/fotg210-hcd.c fotg210_writel(fotg210, temp, status_reg); fotg210 1751 drivers/usb/host/fotg210-hcd.c spin_unlock_irqrestore(&fotg210->lock, flags); fotg210 1752 drivers/usb/host/fotg210-hcd.c fotg210_quiesce(fotg210); fotg210 1753 drivers/usb/host/fotg210-hcd.c spin_lock_irqsave(&fotg210->lock, flags); fotg210 1756 drivers/usb/host/fotg210-hcd.c temp = fotg210_readl(fotg210, status_reg) & fotg210 1759 drivers/usb/host/fotg210-hcd.c fotg210_writel(fotg210, temp | PORT_SUSPEND, fotg210 1762 drivers/usb/host/fotg210-hcd.c spin_unlock_irqrestore(&fotg210->lock, flags); fotg210 1763 drivers/usb/host/fotg210-hcd.c fotg210_halt(fotg210); fotg210 1764 drivers/usb/host/fotg210-hcd.c spin_lock_irqsave(&fotg210->lock, flags); fotg210 1766 drivers/usb/host/fotg210-hcd.c temp = fotg210_readl(fotg210, status_reg); fotg210 1768 drivers/usb/host/fotg210-hcd.c fotg210_writel(fotg210, temp, status_reg); fotg210 1774 drivers/usb/host/fotg210-hcd.c fotg210_readl(fotg210, &fotg210->regs->command); fotg210 1782 drivers/usb/host/fotg210-hcd.c spin_unlock_irqrestore(&fotg210->lock, flags); fotg210 1809 drivers/usb/host/fotg210-hcd.c static inline void fotg210_qtd_init(struct fotg210_hcd *fotg210, fotg210 1814 drivers/usb/host/fotg210-hcd.c qtd->hw_token = cpu_to_hc32(fotg210, QTD_STS_HALT); fotg210 1815 drivers/usb/host/fotg210-hcd.c qtd->hw_next = FOTG210_LIST_END(fotg210); fotg210 1816 drivers/usb/host/fotg210-hcd.c qtd->hw_alt_next = FOTG210_LIST_END(fotg210); fotg210 1820 drivers/usb/host/fotg210-hcd.c static struct fotg210_qtd *fotg210_qtd_alloc(struct fotg210_hcd *fotg210, fotg210 1826 drivers/usb/host/fotg210-hcd.c qtd = dma_pool_alloc(fotg210->qtd_pool, flags, &dma); fotg210 1828 drivers/usb/host/fotg210-hcd.c fotg210_qtd_init(fotg210, qtd, dma); fotg210 1833 drivers/usb/host/fotg210-hcd.c static inline void fotg210_qtd_free(struct fotg210_hcd *fotg210, fotg210 1836 drivers/usb/host/fotg210-hcd.c dma_pool_free(fotg210->qtd_pool, qtd, qtd->qtd_dma); fotg210 1840 drivers/usb/host/fotg210-hcd.c static void qh_destroy(struct fotg210_hcd *fotg210, struct fotg210_qh *qh) fotg210 1844 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, "unused qh not empty!\n"); fotg210 1848 drivers/usb/host/fotg210-hcd.c fotg210_qtd_free(fotg210, qh->dummy); fotg210 1849 drivers/usb/host/fotg210-hcd.c dma_pool_free(fotg210->qh_pool, qh->hw, qh->qh_dma); fotg210 1853 drivers/usb/host/fotg210-hcd.c static struct fotg210_qh *fotg210_qh_alloc(struct fotg210_hcd *fotg210, fotg210 1862 drivers/usb/host/fotg210-hcd.c qh->hw = dma_pool_zalloc(fotg210->qh_pool, flags, &dma); fotg210 1869 drivers/usb/host/fotg210-hcd.c qh->dummy = fotg210_qtd_alloc(fotg210, flags); fotg210 1871 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, "no dummy td\n"); fotg210 1877 drivers/usb/host/fotg210-hcd.c dma_pool_free(fotg210->qh_pool, qh->hw, qh->qh_dma); fotg210 1888 drivers/usb/host/fotg210-hcd.c static void fotg210_mem_cleanup(struct fotg210_hcd *fotg210) fotg210 1890 drivers/usb/host/fotg210-hcd.c if (fotg210->async) fotg210 1891 drivers/usb/host/fotg210-hcd.c qh_destroy(fotg210, fotg210->async); fotg210 1892 drivers/usb/host/fotg210-hcd.c fotg210->async = NULL; fotg210 1894 drivers/usb/host/fotg210-hcd.c if (fotg210->dummy) fotg210 1895 drivers/usb/host/fotg210-hcd.c qh_destroy(fotg210, fotg210->dummy); fotg210 1896 drivers/usb/host/fotg210-hcd.c fotg210->dummy = NULL; fotg210 1899 drivers/usb/host/fotg210-hcd.c dma_pool_destroy(fotg210->qtd_pool); fotg210 1900 drivers/usb/host/fotg210-hcd.c fotg210->qtd_pool = NULL; fotg210 1902 drivers/usb/host/fotg210-hcd.c dma_pool_destroy(fotg210->qh_pool); fotg210 1903 drivers/usb/host/fotg210-hcd.c fotg210->qh_pool = NULL; fotg210 1905 drivers/usb/host/fotg210-hcd.c dma_pool_destroy(fotg210->itd_pool); fotg210 1906 drivers/usb/host/fotg210-hcd.c fotg210->itd_pool = NULL; fotg210 1908 drivers/usb/host/fotg210-hcd.c if (fotg210->periodic) fotg210 1909 drivers/usb/host/fotg210-hcd.c dma_free_coherent(fotg210_to_hcd(fotg210)->self.controller, fotg210 1910 drivers/usb/host/fotg210-hcd.c fotg210->periodic_size * sizeof(u32), fotg210 1911 drivers/usb/host/fotg210-hcd.c fotg210->periodic, fotg210->periodic_dma); fotg210 1912 drivers/usb/host/fotg210-hcd.c fotg210->periodic = NULL; fotg210 1915 drivers/usb/host/fotg210-hcd.c kfree(fotg210->pshadow); fotg210 1916 drivers/usb/host/fotg210-hcd.c fotg210->pshadow = NULL; fotg210 1920 drivers/usb/host/fotg210-hcd.c static int fotg210_mem_init(struct fotg210_hcd *fotg210, gfp_t flags) fotg210 1925 drivers/usb/host/fotg210-hcd.c fotg210->qtd_pool = dma_pool_create("fotg210_qtd", fotg210 1926 drivers/usb/host/fotg210-hcd.c fotg210_to_hcd(fotg210)->self.controller, fotg210 1930 drivers/usb/host/fotg210-hcd.c if (!fotg210->qtd_pool) fotg210 1934 drivers/usb/host/fotg210-hcd.c fotg210->qh_pool = dma_pool_create("fotg210_qh", fotg210 1935 drivers/usb/host/fotg210-hcd.c fotg210_to_hcd(fotg210)->self.controller, fotg210 1939 drivers/usb/host/fotg210-hcd.c if (!fotg210->qh_pool) fotg210 1942 drivers/usb/host/fotg210-hcd.c fotg210->async = fotg210_qh_alloc(fotg210, flags); fotg210 1943 drivers/usb/host/fotg210-hcd.c if (!fotg210->async) fotg210 1947 drivers/usb/host/fotg210-hcd.c fotg210->itd_pool = dma_pool_create("fotg210_itd", fotg210 1948 drivers/usb/host/fotg210-hcd.c fotg210_to_hcd(fotg210)->self.controller, fotg210 1952 drivers/usb/host/fotg210-hcd.c if (!fotg210->itd_pool) fotg210 1956 drivers/usb/host/fotg210-hcd.c fotg210->periodic = (__le32 *) fotg210 1957 drivers/usb/host/fotg210-hcd.c dma_alloc_coherent(fotg210_to_hcd(fotg210)->self.controller, fotg210 1958 drivers/usb/host/fotg210-hcd.c fotg210->periodic_size * sizeof(__le32), fotg210 1959 drivers/usb/host/fotg210-hcd.c &fotg210->periodic_dma, 0); fotg210 1960 drivers/usb/host/fotg210-hcd.c if (fotg210->periodic == NULL) fotg210 1963 drivers/usb/host/fotg210-hcd.c for (i = 0; i < fotg210->periodic_size; i++) fotg210 1964 drivers/usb/host/fotg210-hcd.c fotg210->periodic[i] = FOTG210_LIST_END(fotg210); fotg210 1967 drivers/usb/host/fotg210-hcd.c fotg210->pshadow = kcalloc(fotg210->periodic_size, sizeof(void *), fotg210 1969 drivers/usb/host/fotg210-hcd.c if (fotg210->pshadow != NULL) fotg210 1973 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, "couldn't init memory\n"); fotg210 1974 drivers/usb/host/fotg210-hcd.c fotg210_mem_cleanup(fotg210); fotg210 1995 drivers/usb/host/fotg210-hcd.c static int qtd_fill(struct fotg210_hcd *fotg210, struct fotg210_qtd *qtd, fotg210 2002 drivers/usb/host/fotg210-hcd.c qtd->hw_buf[0] = cpu_to_hc32(fotg210, (u32)addr); fotg210 2003 drivers/usb/host/fotg210-hcd.c qtd->hw_buf_hi[0] = cpu_to_hc32(fotg210, (u32)(addr >> 32)); fotg210 2014 drivers/usb/host/fotg210-hcd.c qtd->hw_buf[i] = cpu_to_hc32(fotg210, (u32)addr); fotg210 2015 drivers/usb/host/fotg210-hcd.c qtd->hw_buf_hi[i] = cpu_to_hc32(fotg210, fotg210 2028 drivers/usb/host/fotg210-hcd.c qtd->hw_token = cpu_to_hc32(fotg210, (count << 16) | token); fotg210 2034 drivers/usb/host/fotg210-hcd.c static inline void qh_update(struct fotg210_hcd *fotg210, fotg210 2042 drivers/usb/host/fotg210-hcd.c hw->hw_qtd_next = QTD_NEXT(fotg210, qtd->qtd_dma); fotg210 2043 drivers/usb/host/fotg210-hcd.c hw->hw_alt_next = FOTG210_LIST_END(fotg210); fotg210 2050 drivers/usb/host/fotg210-hcd.c if (!(hw->hw_info1 & cpu_to_hc32(fotg210, QH_TOGGLE_CTL))) { fotg210 2054 drivers/usb/host/fotg210-hcd.c epnum = (hc32_to_cpup(fotg210, &hw->hw_info1) >> 8) & 0x0f; fotg210 2056 drivers/usb/host/fotg210-hcd.c hw->hw_token &= ~cpu_to_hc32(fotg210, QTD_TOGGLE); fotg210 2061 drivers/usb/host/fotg210-hcd.c hw->hw_token &= cpu_to_hc32(fotg210, QTD_TOGGLE | QTD_STS_PING); fotg210 2068 drivers/usb/host/fotg210-hcd.c static void qh_refresh(struct fotg210_hcd *fotg210, struct fotg210_qh *qh) fotg210 2084 drivers/usb/host/fotg210-hcd.c if (cpu_to_hc32(fotg210, qtd->qtd_dma) == qh->hw->hw_current) { fotg210 2091 drivers/usb/host/fotg210-hcd.c qh_update(fotg210, qh, qtd); fotg210 2094 drivers/usb/host/fotg210-hcd.c static void qh_link_async(struct fotg210_hcd *fotg210, struct fotg210_qh *qh); fotg210 2099 drivers/usb/host/fotg210-hcd.c struct fotg210_hcd *fotg210 = hcd_to_fotg210(hcd); fotg210 2103 drivers/usb/host/fotg210-hcd.c spin_lock_irqsave(&fotg210->lock, flags); fotg210 2106 drivers/usb/host/fotg210-hcd.c && fotg210->rh_state == FOTG210_RH_RUNNING) fotg210 2107 drivers/usb/host/fotg210-hcd.c qh_link_async(fotg210, qh); fotg210 2108 drivers/usb/host/fotg210-hcd.c spin_unlock_irqrestore(&fotg210->lock, flags); fotg210 2111 drivers/usb/host/fotg210-hcd.c static void fotg210_clear_tt_buffer(struct fotg210_hcd *fotg210, fotg210 2130 drivers/usb/host/fotg210-hcd.c fotg210_to_hcd(fotg210)->self.root_hub) { fotg210 2137 drivers/usb/host/fotg210-hcd.c static int qtd_copy_status(struct fotg210_hcd *fotg210, struct urb *urb, fotg210 2176 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, "devpath %s ep%d%s 3strikes\n", fotg210 2185 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, fotg210 2196 drivers/usb/host/fotg210-hcd.c static void fotg210_urb_done(struct fotg210_hcd *fotg210, struct urb *urb, fotg210 2198 drivers/usb/host/fotg210-hcd.c __releases(fotg210->lock) fotg210 2199 drivers/usb/host/fotg210-hcd.c __acquires(fotg210->lock) fotg210 2205 drivers/usb/host/fotg210-hcd.c if ((qh->hw->hw_info2 & cpu_to_hc32(fotg210, QH_SMASK)) != 0) { fotg210 2208 drivers/usb/host/fotg210-hcd.c fotg210_to_hcd(fotg210)->self.bandwidth_int_reqs--; fotg210 2213 drivers/usb/host/fotg210-hcd.c INCR(fotg210->stats.unlink); fotg210 2218 drivers/usb/host/fotg210-hcd.c INCR(fotg210->stats.complete); fotg210 2222 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, fotg210 2232 drivers/usb/host/fotg210-hcd.c usb_hcd_unlink_urb_from_ep(fotg210_to_hcd(fotg210), urb); fotg210 2233 drivers/usb/host/fotg210-hcd.c spin_unlock(&fotg210->lock); fotg210 2234 drivers/usb/host/fotg210-hcd.c usb_hcd_giveback_urb(fotg210_to_hcd(fotg210), urb, status); fotg210 2235 drivers/usb/host/fotg210-hcd.c spin_lock(&fotg210->lock); fotg210 2238 drivers/usb/host/fotg210-hcd.c static int qh_schedule(struct fotg210_hcd *fotg210, struct fotg210_qh *qh); fotg210 2244 drivers/usb/host/fotg210-hcd.c static unsigned qh_completions(struct fotg210_hcd *fotg210, fotg210 2291 drivers/usb/host/fotg210-hcd.c fotg210_urb_done(fotg210, last->urb, fotg210 2296 drivers/usb/host/fotg210-hcd.c fotg210_qtd_free(fotg210, last); fotg210 2306 drivers/usb/host/fotg210-hcd.c token = hc32_to_cpu(fotg210, qtd->hw_token); fotg210 2314 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, fotg210 2333 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, fotg210 2347 drivers/usb/host/fotg210-hcd.c qtd->hw_token = cpu_to_hc32(fotg210, fotg210 2350 drivers/usb/host/fotg210-hcd.c hw->hw_token = cpu_to_hc32(fotg210, fotg210 2367 drivers/usb/host/fotg210-hcd.c FOTG210_LIST_END(fotg210))) { fotg210 2373 drivers/usb/host/fotg210-hcd.c && fotg210->rh_state >= FOTG210_RH_RUNNING)) { fotg210 2381 drivers/usb/host/fotg210-hcd.c if (fotg210->rh_state < FOTG210_RH_RUNNING) fotg210 2392 drivers/usb/host/fotg210-hcd.c cpu_to_hc32(fotg210, qtd->qtd_dma) fotg210 2394 drivers/usb/host/fotg210-hcd.c token = hc32_to_cpu(fotg210, hw->hw_token); fotg210 2400 drivers/usb/host/fotg210-hcd.c fotg210_clear_tt_buffer(fotg210, qh, urb, fotg210 2413 drivers/usb/host/fotg210-hcd.c last_status = qtd_copy_status(fotg210, urb, fotg210 2417 drivers/usb/host/fotg210-hcd.c FOTG210_LIST_END(fotg210))) fotg210 2435 drivers/usb/host/fotg210-hcd.c fotg210_clear_tt_buffer(fotg210, qh, fotg210 2459 drivers/usb/host/fotg210-hcd.c fotg210_urb_done(fotg210, last->urb, last_status); fotg210 2461 drivers/usb/host/fotg210-hcd.c fotg210_qtd_free(fotg210, last); fotg210 2486 drivers/usb/host/fotg210-hcd.c if (stopped != 0 || hw->hw_qtd_next == FOTG210_LIST_END(fotg210)) { fotg210 2489 drivers/usb/host/fotg210-hcd.c qh_refresh(fotg210, qh); fotg210 2522 drivers/usb/host/fotg210-hcd.c static void qtd_list_free(struct fotg210_hcd *fotg210, struct urb *urb, fotg210 2529 drivers/usb/host/fotg210-hcd.c fotg210_qtd_free(fotg210, qtd); fotg210 2535 drivers/usb/host/fotg210-hcd.c static struct list_head *qh_urb_transaction(struct fotg210_hcd *fotg210, fotg210 2549 drivers/usb/host/fotg210-hcd.c qtd = fotg210_qtd_alloc(fotg210, flags); fotg210 2563 drivers/usb/host/fotg210-hcd.c qtd_fill(fotg210, qtd, urb->setup_dma, fotg210 2570 drivers/usb/host/fotg210-hcd.c qtd = fotg210_qtd_alloc(fotg210, flags); fotg210 2574 drivers/usb/host/fotg210-hcd.c qtd_prev->hw_next = QTD_NEXT(fotg210, qtd->qtd_dma); fotg210 2614 drivers/usb/host/fotg210-hcd.c this_qtd_len = qtd_fill(fotg210, qtd, buf, this_sg_len, token, fotg210 2626 drivers/usb/host/fotg210-hcd.c qtd->hw_alt_next = fotg210->async->hw->hw_alt_next; fotg210 2641 drivers/usb/host/fotg210-hcd.c qtd = fotg210_qtd_alloc(fotg210, flags); fotg210 2645 drivers/usb/host/fotg210-hcd.c qtd_prev->hw_next = QTD_NEXT(fotg210, qtd->qtd_dma); fotg210 2656 drivers/usb/host/fotg210-hcd.c qtd->hw_alt_next = FOTG210_LIST_END(fotg210); fotg210 2677 drivers/usb/host/fotg210-hcd.c qtd = fotg210_qtd_alloc(fotg210, flags); fotg210 2681 drivers/usb/host/fotg210-hcd.c qtd_prev->hw_next = QTD_NEXT(fotg210, qtd->qtd_dma); fotg210 2685 drivers/usb/host/fotg210-hcd.c qtd_fill(fotg210, qtd, 0, 0, token, 0); fotg210 2691 drivers/usb/host/fotg210-hcd.c qtd->hw_token |= cpu_to_hc32(fotg210, QTD_IOC); fotg210 2695 drivers/usb/host/fotg210-hcd.c qtd_list_free(fotg210, urb, head); fotg210 2714 drivers/usb/host/fotg210-hcd.c static struct fotg210_qh *qh_make(struct fotg210_hcd *fotg210, struct urb *urb, fotg210 2717 drivers/usb/host/fotg210-hcd.c struct fotg210_qh *qh = fotg210_qh_alloc(fotg210, flags); fotg210 2741 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, "bogus qh maxpacket %d\n", fotg210 2771 drivers/usb/host/fotg210-hcd.c } else if (qh->period > fotg210->periodic_size) { fotg210 2772 drivers/usb/host/fotg210-hcd.c qh->period = fotg210->periodic_size; fotg210 2796 drivers/usb/host/fotg210-hcd.c if (qh->period > fotg210->periodic_size) { fotg210 2797 drivers/usb/host/fotg210-hcd.c qh->period = fotg210->periodic_size; fotg210 2827 drivers/usb/host/fotg210-hcd.c if (fotg210_has_fsl_portno_bug(fotg210)) fotg210 2835 drivers/usb/host/fotg210-hcd.c if (tt && tt->hub != fotg210_to_hcd(fotg210)->self.root_hub) fotg210 2865 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, "bogus dev %p speed %d\n", urb->dev, fotg210 2868 drivers/usb/host/fotg210-hcd.c qh_destroy(fotg210, qh); fotg210 2877 drivers/usb/host/fotg210-hcd.c hw->hw_info1 = cpu_to_hc32(fotg210, info1); fotg210 2878 drivers/usb/host/fotg210-hcd.c hw->hw_info2 = cpu_to_hc32(fotg210, info2); fotg210 2881 drivers/usb/host/fotg210-hcd.c qh_refresh(fotg210, qh); fotg210 2885 drivers/usb/host/fotg210-hcd.c static void enable_async(struct fotg210_hcd *fotg210) fotg210 2887 drivers/usb/host/fotg210-hcd.c if (fotg210->async_count++) fotg210 2891 drivers/usb/host/fotg210-hcd.c fotg210->enabled_hrtimer_events &= ~BIT(FOTG210_HRTIMER_DISABLE_ASYNC); fotg210 2894 drivers/usb/host/fotg210-hcd.c fotg210_poll_ASS(fotg210); fotg210 2895 drivers/usb/host/fotg210-hcd.c turn_on_io_watchdog(fotg210); fotg210 2898 drivers/usb/host/fotg210-hcd.c static void disable_async(struct fotg210_hcd *fotg210) fotg210 2900 drivers/usb/host/fotg210-hcd.c if (--fotg210->async_count) fotg210 2904 drivers/usb/host/fotg210-hcd.c WARN_ON(fotg210->async->qh_next.qh || fotg210->async_unlink); fotg210 2907 drivers/usb/host/fotg210-hcd.c fotg210_poll_ASS(fotg210); fotg210 2912 drivers/usb/host/fotg210-hcd.c static void qh_link_async(struct fotg210_hcd *fotg210, struct fotg210_qh *qh) fotg210 2914 drivers/usb/host/fotg210-hcd.c __hc32 dma = QH_NEXT(fotg210, qh->qh_dma); fotg210 2924 drivers/usb/host/fotg210-hcd.c qh_refresh(fotg210, qh); fotg210 2927 drivers/usb/host/fotg210-hcd.c head = fotg210->async; fotg210 2939 drivers/usb/host/fotg210-hcd.c enable_async(fotg210); fotg210 2947 drivers/usb/host/fotg210-hcd.c static struct fotg210_qh *qh_append_tds(struct fotg210_hcd *fotg210, fotg210 2952 drivers/usb/host/fotg210-hcd.c __hc32 qh_addr_mask = cpu_to_hc32(fotg210, 0x7f); fotg210 2957 drivers/usb/host/fotg210-hcd.c qh = qh_make(fotg210, urb, GFP_ATOMIC); fotg210 2990 drivers/usb/host/fotg210-hcd.c qtd->hw_token = HALT_BIT(fotg210); fotg210 3002 drivers/usb/host/fotg210-hcd.c fotg210_qtd_init(fotg210, qtd, qtd->qtd_dma); fotg210 3009 drivers/usb/host/fotg210-hcd.c qtd->hw_next = QTD_NEXT(fotg210, dma); fotg210 3021 drivers/usb/host/fotg210-hcd.c static int submit_async(struct fotg210_hcd *fotg210, struct urb *urb, fotg210 3036 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, fotg210 3046 drivers/usb/host/fotg210-hcd.c spin_lock_irqsave(&fotg210->lock, flags); fotg210 3047 drivers/usb/host/fotg210-hcd.c if (unlikely(!HCD_HW_ACCESSIBLE(fotg210_to_hcd(fotg210)))) { fotg210 3051 drivers/usb/host/fotg210-hcd.c rc = usb_hcd_link_urb_to_ep(fotg210_to_hcd(fotg210), urb); fotg210 3055 drivers/usb/host/fotg210-hcd.c qh = qh_append_tds(fotg210, urb, qtd_list, epnum, &urb->ep->hcpriv); fotg210 3057 drivers/usb/host/fotg210-hcd.c usb_hcd_unlink_urb_from_ep(fotg210_to_hcd(fotg210), urb); fotg210 3066 drivers/usb/host/fotg210-hcd.c qh_link_async(fotg210, qh); fotg210 3068 drivers/usb/host/fotg210-hcd.c spin_unlock_irqrestore(&fotg210->lock, flags); fotg210 3070 drivers/usb/host/fotg210-hcd.c qtd_list_free(fotg210, urb, qtd_list); fotg210 3074 drivers/usb/host/fotg210-hcd.c static void single_unlink_async(struct fotg210_hcd *fotg210, fotg210 3081 drivers/usb/host/fotg210-hcd.c if (fotg210->async_unlink) fotg210 3082 drivers/usb/host/fotg210-hcd.c fotg210->async_unlink_last->unlink_next = qh; fotg210 3084 drivers/usb/host/fotg210-hcd.c fotg210->async_unlink = qh; fotg210 3085 drivers/usb/host/fotg210-hcd.c fotg210->async_unlink_last = qh; fotg210 3088 drivers/usb/host/fotg210-hcd.c prev = fotg210->async; fotg210 3094 drivers/usb/host/fotg210-hcd.c if (fotg210->qh_scan_next == qh) fotg210 3095 drivers/usb/host/fotg210-hcd.c fotg210->qh_scan_next = qh->qh_next.qh; fotg210 3098 drivers/usb/host/fotg210-hcd.c static void start_iaa_cycle(struct fotg210_hcd *fotg210, bool nested) fotg210 3104 drivers/usb/host/fotg210-hcd.c if (fotg210->async_iaa || fotg210->async_unlinking) fotg210 3108 drivers/usb/host/fotg210-hcd.c fotg210->async_iaa = fotg210->async_unlink; fotg210 3109 drivers/usb/host/fotg210-hcd.c fotg210->async_unlink = NULL; fotg210 3112 drivers/usb/host/fotg210-hcd.c if (unlikely(fotg210->rh_state < FOTG210_RH_RUNNING)) { fotg210 3114 drivers/usb/host/fotg210-hcd.c end_unlink_async(fotg210); fotg210 3117 drivers/usb/host/fotg210-hcd.c } else if (likely(fotg210->rh_state == FOTG210_RH_RUNNING)) { fotg210 3121 drivers/usb/host/fotg210-hcd.c fotg210_writel(fotg210, fotg210->command | CMD_IAAD, fotg210 3122 drivers/usb/host/fotg210-hcd.c &fotg210->regs->command); fotg210 3123 drivers/usb/host/fotg210-hcd.c fotg210_readl(fotg210, &fotg210->regs->command); fotg210 3124 drivers/usb/host/fotg210-hcd.c fotg210_enable_event(fotg210, FOTG210_HRTIMER_IAA_WATCHDOG, fotg210 3131 drivers/usb/host/fotg210-hcd.c static void end_unlink_async(struct fotg210_hcd *fotg210) fotg210 3137 drivers/usb/host/fotg210-hcd.c fotg210->async_unlinking = true; fotg210 3138 drivers/usb/host/fotg210-hcd.c while (fotg210->async_iaa) { fotg210 3139 drivers/usb/host/fotg210-hcd.c qh = fotg210->async_iaa; fotg210 3140 drivers/usb/host/fotg210-hcd.c fotg210->async_iaa = qh->unlink_next; fotg210 3146 drivers/usb/host/fotg210-hcd.c qh_completions(fotg210, qh); fotg210 3148 drivers/usb/host/fotg210-hcd.c fotg210->rh_state == FOTG210_RH_RUNNING) fotg210 3149 drivers/usb/host/fotg210-hcd.c qh_link_async(fotg210, qh); fotg210 3150 drivers/usb/host/fotg210-hcd.c disable_async(fotg210); fotg210 3152 drivers/usb/host/fotg210-hcd.c fotg210->async_unlinking = false; fotg210 3155 drivers/usb/host/fotg210-hcd.c if (fotg210->async_unlink) { fotg210 3156 drivers/usb/host/fotg210-hcd.c start_iaa_cycle(fotg210, true); fotg210 3157 drivers/usb/host/fotg210-hcd.c if (unlikely(fotg210->rh_state < FOTG210_RH_RUNNING)) fotg210 3162 drivers/usb/host/fotg210-hcd.c static void unlink_empty_async(struct fotg210_hcd *fotg210) fotg210 3165 drivers/usb/host/fotg210-hcd.c bool stopped = (fotg210->rh_state < FOTG210_RH_RUNNING); fotg210 3169 drivers/usb/host/fotg210-hcd.c next = fotg210->async->qh_next.qh; fotg210 3177 drivers/usb/host/fotg210-hcd.c fotg210->async_unlink_cycle) fotg210 3180 drivers/usb/host/fotg210-hcd.c single_unlink_async(fotg210, qh); fotg210 3185 drivers/usb/host/fotg210-hcd.c if (fotg210->async_unlink) fotg210 3186 drivers/usb/host/fotg210-hcd.c start_iaa_cycle(fotg210, false); fotg210 3190 drivers/usb/host/fotg210-hcd.c fotg210_enable_event(fotg210, FOTG210_HRTIMER_ASYNC_UNLINKS, fotg210 3192 drivers/usb/host/fotg210-hcd.c ++fotg210->async_unlink_cycle; fotg210 3199 drivers/usb/host/fotg210-hcd.c static void start_unlink_async(struct fotg210_hcd *fotg210, fotg210 3213 drivers/usb/host/fotg210-hcd.c single_unlink_async(fotg210, qh); fotg210 3214 drivers/usb/host/fotg210-hcd.c start_iaa_cycle(fotg210, false); fotg210 3217 drivers/usb/host/fotg210-hcd.c static void scan_async(struct fotg210_hcd *fotg210) fotg210 3222 drivers/usb/host/fotg210-hcd.c fotg210->qh_scan_next = fotg210->async->qh_next.qh; fotg210 3223 drivers/usb/host/fotg210-hcd.c while (fotg210->qh_scan_next) { fotg210 3224 drivers/usb/host/fotg210-hcd.c qh = fotg210->qh_scan_next; fotg210 3225 drivers/usb/host/fotg210-hcd.c fotg210->qh_scan_next = qh->qh_next.qh; fotg210 3238 drivers/usb/host/fotg210-hcd.c temp = qh_completions(fotg210, qh); fotg210 3240 drivers/usb/host/fotg210-hcd.c start_unlink_async(fotg210, qh); fotg210 3243 drivers/usb/host/fotg210-hcd.c qh->unlink_cycle = fotg210->async_unlink_cycle; fotg210 3256 drivers/usb/host/fotg210-hcd.c if (check_unlinks_later && fotg210->rh_state == FOTG210_RH_RUNNING && fotg210 3257 drivers/usb/host/fotg210-hcd.c !(fotg210->enabled_hrtimer_events & fotg210 3259 drivers/usb/host/fotg210-hcd.c fotg210_enable_event(fotg210, fotg210 3261 drivers/usb/host/fotg210-hcd.c ++fotg210->async_unlink_cycle; fotg210 3281 drivers/usb/host/fotg210-hcd.c static union fotg210_shadow *periodic_next_shadow(struct fotg210_hcd *fotg210, fotg210 3284 drivers/usb/host/fotg210-hcd.c switch (hc32_to_cpu(fotg210, tag)) { fotg210 3294 drivers/usb/host/fotg210-hcd.c static __hc32 *shadow_next_periodic(struct fotg210_hcd *fotg210, fotg210 3297 drivers/usb/host/fotg210-hcd.c switch (hc32_to_cpu(fotg210, tag)) { fotg210 3308 drivers/usb/host/fotg210-hcd.c static void periodic_unlink(struct fotg210_hcd *fotg210, unsigned frame, fotg210 3311 drivers/usb/host/fotg210-hcd.c union fotg210_shadow *prev_p = &fotg210->pshadow[frame]; fotg210 3312 drivers/usb/host/fotg210-hcd.c __hc32 *hw_p = &fotg210->periodic[frame]; fotg210 3317 drivers/usb/host/fotg210-hcd.c prev_p = periodic_next_shadow(fotg210, prev_p, fotg210 3318 drivers/usb/host/fotg210-hcd.c Q_NEXT_TYPE(fotg210, *hw_p)); fotg210 3319 drivers/usb/host/fotg210-hcd.c hw_p = shadow_next_periodic(fotg210, &here, fotg210 3320 drivers/usb/host/fotg210-hcd.c Q_NEXT_TYPE(fotg210, *hw_p)); fotg210 3330 drivers/usb/host/fotg210-hcd.c *prev_p = *periodic_next_shadow(fotg210, &here, fotg210 3331 drivers/usb/host/fotg210-hcd.c Q_NEXT_TYPE(fotg210, *hw_p)); fotg210 3333 drivers/usb/host/fotg210-hcd.c *hw_p = *shadow_next_periodic(fotg210, &here, fotg210 3334 drivers/usb/host/fotg210-hcd.c Q_NEXT_TYPE(fotg210, *hw_p)); fotg210 3338 drivers/usb/host/fotg210-hcd.c static unsigned short periodic_usecs(struct fotg210_hcd *fotg210, fotg210 3341 drivers/usb/host/fotg210-hcd.c __hc32 *hw_p = &fotg210->periodic[frame]; fotg210 3342 drivers/usb/host/fotg210-hcd.c union fotg210_shadow *q = &fotg210->pshadow[frame]; fotg210 3347 drivers/usb/host/fotg210-hcd.c switch (hc32_to_cpu(fotg210, Q_NEXT_TYPE(fotg210, *hw_p))) { fotg210 3351 drivers/usb/host/fotg210-hcd.c if (hw->hw_info2 & cpu_to_hc32(fotg210, 1 << uframe)) fotg210 3354 drivers/usb/host/fotg210-hcd.c if (hw->hw_info2 & cpu_to_hc32(fotg210, fotg210 3365 drivers/usb/host/fotg210-hcd.c if (q->fstn->hw_prev != FOTG210_LIST_END(fotg210)) fotg210 3366 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, "ignoring FSTN cost ...\n"); fotg210 3379 drivers/usb/host/fotg210-hcd.c if (usecs > fotg210->uframe_periodic_max) fotg210 3380 drivers/usb/host/fotg210-hcd.c fotg210_err(fotg210, "uframe %d sched overrun: %d usecs\n", fotg210 3401 drivers/usb/host/fotg210-hcd.c static int tt_no_collision(struct fotg210_hcd *fotg210, unsigned period, fotg210 3411 drivers/usb/host/fotg210-hcd.c for (; frame < fotg210->periodic_size; frame += period) { fotg210 3416 drivers/usb/host/fotg210-hcd.c here = fotg210->pshadow[frame]; fotg210 3417 drivers/usb/host/fotg210-hcd.c type = Q_NEXT_TYPE(fotg210, fotg210->periodic[frame]); fotg210 3419 drivers/usb/host/fotg210-hcd.c switch (hc32_to_cpu(fotg210, type)) { fotg210 3421 drivers/usb/host/fotg210-hcd.c type = Q_NEXT_TYPE(fotg210, here.itd->hw_next); fotg210 3429 drivers/usb/host/fotg210-hcd.c mask = hc32_to_cpu(fotg210, fotg210 3436 drivers/usb/host/fotg210-hcd.c type = Q_NEXT_TYPE(fotg210, hw->hw_next); fotg210 3441 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, fotg210 3455 drivers/usb/host/fotg210-hcd.c static void enable_periodic(struct fotg210_hcd *fotg210) fotg210 3457 drivers/usb/host/fotg210-hcd.c if (fotg210->periodic_count++) fotg210 3461 drivers/usb/host/fotg210-hcd.c fotg210->enabled_hrtimer_events &= fotg210 3465 drivers/usb/host/fotg210-hcd.c fotg210_poll_PSS(fotg210); fotg210 3466 drivers/usb/host/fotg210-hcd.c turn_on_io_watchdog(fotg210); fotg210 3469 drivers/usb/host/fotg210-hcd.c static void disable_periodic(struct fotg210_hcd *fotg210) fotg210 3471 drivers/usb/host/fotg210-hcd.c if (--fotg210->periodic_count) fotg210 3475 drivers/usb/host/fotg210-hcd.c fotg210_poll_PSS(fotg210); fotg210 3484 drivers/usb/host/fotg210-hcd.c static void qh_link_periodic(struct fotg210_hcd *fotg210, struct fotg210_qh *qh) fotg210 3491 drivers/usb/host/fotg210-hcd.c hc32_to_cpup(fotg210, &qh->hw->hw_info2) & fotg210 3499 drivers/usb/host/fotg210-hcd.c for (i = qh->start; i < fotg210->periodic_size; i += period) { fotg210 3500 drivers/usb/host/fotg210-hcd.c union fotg210_shadow *prev = &fotg210->pshadow[i]; fotg210 3501 drivers/usb/host/fotg210-hcd.c __hc32 *hw_p = &fotg210->periodic[i]; fotg210 3507 drivers/usb/host/fotg210-hcd.c type = Q_NEXT_TYPE(fotg210, *hw_p); fotg210 3508 drivers/usb/host/fotg210-hcd.c if (type == cpu_to_hc32(fotg210, Q_TYPE_QH)) fotg210 3510 drivers/usb/host/fotg210-hcd.c prev = periodic_next_shadow(fotg210, prev, type); fotg210 3511 drivers/usb/host/fotg210-hcd.c hw_p = shadow_next_periodic(fotg210, &here, type); fotg210 3532 drivers/usb/host/fotg210-hcd.c *hw_p = QH_NEXT(fotg210, qh->qh_dma); fotg210 3539 drivers/usb/host/fotg210-hcd.c fotg210_to_hcd(fotg210)->self.bandwidth_allocated += qh->period fotg210 3543 drivers/usb/host/fotg210-hcd.c list_add(&qh->intr_node, &fotg210->intr_qh_list); fotg210 3546 drivers/usb/host/fotg210-hcd.c ++fotg210->intr_count; fotg210 3547 drivers/usb/host/fotg210-hcd.c enable_periodic(fotg210); fotg210 3550 drivers/usb/host/fotg210-hcd.c static void qh_unlink_periodic(struct fotg210_hcd *fotg210, fotg210 3576 drivers/usb/host/fotg210-hcd.c for (i = qh->start; i < fotg210->periodic_size; i += period) fotg210 3577 drivers/usb/host/fotg210-hcd.c periodic_unlink(fotg210, i, qh); fotg210 3580 drivers/usb/host/fotg210-hcd.c fotg210_to_hcd(fotg210)->self.bandwidth_allocated -= qh->period fotg210 3586 drivers/usb/host/fotg210-hcd.c qh->period, hc32_to_cpup(fotg210, &qh->hw->hw_info2) & fotg210 3594 drivers/usb/host/fotg210-hcd.c if (fotg210->qh_scan_next == qh) fotg210 3595 drivers/usb/host/fotg210-hcd.c fotg210->qh_scan_next = list_entry(qh->intr_node.next, fotg210 3600 drivers/usb/host/fotg210-hcd.c static void start_unlink_intr(struct fotg210_hcd *fotg210, fotg210 3613 drivers/usb/host/fotg210-hcd.c qh_unlink_periodic(fotg210, qh); fotg210 3623 drivers/usb/host/fotg210-hcd.c qh->unlink_cycle = fotg210->intr_unlink_cycle; fotg210 3626 drivers/usb/host/fotg210-hcd.c if (fotg210->intr_unlink) fotg210 3627 drivers/usb/host/fotg210-hcd.c fotg210->intr_unlink_last->unlink_next = qh; fotg210 3629 drivers/usb/host/fotg210-hcd.c fotg210->intr_unlink = qh; fotg210 3630 drivers/usb/host/fotg210-hcd.c fotg210->intr_unlink_last = qh; fotg210 3632 drivers/usb/host/fotg210-hcd.c if (fotg210->intr_unlinking) fotg210 3634 drivers/usb/host/fotg210-hcd.c else if (fotg210->rh_state < FOTG210_RH_RUNNING) fotg210 3635 drivers/usb/host/fotg210-hcd.c fotg210_handle_intr_unlinks(fotg210); fotg210 3636 drivers/usb/host/fotg210-hcd.c else if (fotg210->intr_unlink == qh) { fotg210 3637 drivers/usb/host/fotg210-hcd.c fotg210_enable_event(fotg210, FOTG210_HRTIMER_UNLINK_INTR, fotg210 3639 drivers/usb/host/fotg210-hcd.c ++fotg210->intr_unlink_cycle; fotg210 3643 drivers/usb/host/fotg210-hcd.c static void end_unlink_intr(struct fotg210_hcd *fotg210, struct fotg210_qh *qh) fotg210 3649 drivers/usb/host/fotg210-hcd.c hw->hw_next = FOTG210_LIST_END(fotg210); fotg210 3651 drivers/usb/host/fotg210-hcd.c qh_completions(fotg210, qh); fotg210 3655 drivers/usb/host/fotg210-hcd.c fotg210->rh_state == FOTG210_RH_RUNNING) { fotg210 3656 drivers/usb/host/fotg210-hcd.c rc = qh_schedule(fotg210, qh); fotg210 3665 drivers/usb/host/fotg210-hcd.c fotg210_err(fotg210, "can't reschedule qh %p, err %d\n", fotg210 3670 drivers/usb/host/fotg210-hcd.c --fotg210->intr_count; fotg210 3671 drivers/usb/host/fotg210-hcd.c disable_periodic(fotg210); fotg210 3674 drivers/usb/host/fotg210-hcd.c static int check_period(struct fotg210_hcd *fotg210, unsigned frame, fotg210 3686 drivers/usb/host/fotg210-hcd.c usecs = fotg210->uframe_periodic_max - usecs; fotg210 3694 drivers/usb/host/fotg210-hcd.c claimed = periodic_usecs(fotg210, frame, fotg210 3699 drivers/usb/host/fotg210-hcd.c } while ((frame += 1) < fotg210->periodic_size); fotg210 3704 drivers/usb/host/fotg210-hcd.c claimed = periodic_usecs(fotg210, frame, uframe); fotg210 3707 drivers/usb/host/fotg210-hcd.c } while ((frame += period) < fotg210->periodic_size); fotg210 3714 drivers/usb/host/fotg210-hcd.c static int check_intr_schedule(struct fotg210_hcd *fotg210, unsigned frame, fotg210 3723 drivers/usb/host/fotg210-hcd.c if (!check_period(fotg210, frame, uframe, qh->period, qh->usecs)) fotg210 3739 drivers/usb/host/fotg210-hcd.c *c_maskp = cpu_to_hc32(fotg210, mask << 8); fotg210 3742 drivers/usb/host/fotg210-hcd.c if (tt_no_collision(fotg210, qh->period, qh->dev, frame, mask)) { fotg210 3743 drivers/usb/host/fotg210-hcd.c if (!check_period(fotg210, frame, uframe + qh->gap_uf + 1, fotg210 3746 drivers/usb/host/fotg210-hcd.c if (!check_period(fotg210, frame, uframe + qh->gap_uf, fotg210 3758 drivers/usb/host/fotg210-hcd.c static int qh_schedule(struct fotg210_hcd *fotg210, struct fotg210_qh *qh) fotg210 3766 drivers/usb/host/fotg210-hcd.c qh_refresh(fotg210, qh); fotg210 3767 drivers/usb/host/fotg210-hcd.c hw->hw_next = FOTG210_LIST_END(fotg210); fotg210 3772 drivers/usb/host/fotg210-hcd.c uframe = ffs(hc32_to_cpup(fotg210, &hw->hw_info2) & QH_SMASK); fotg210 3773 drivers/usb/host/fotg210-hcd.c status = check_intr_schedule(fotg210, frame, --uframe, fotg210 3790 drivers/usb/host/fotg210-hcd.c frame = ++fotg210->random_frame % qh->period; fotg210 3792 drivers/usb/host/fotg210-hcd.c status = check_intr_schedule(fotg210, fotg210 3803 drivers/usb/host/fotg210-hcd.c status = check_intr_schedule(fotg210, 0, 0, qh, fotg210 3811 drivers/usb/host/fotg210-hcd.c hw->hw_info2 &= cpu_to_hc32(fotg210, ~(QH_CMASK | QH_SMASK)); fotg210 3813 drivers/usb/host/fotg210-hcd.c ? cpu_to_hc32(fotg210, 1 << uframe) fotg210 3814 drivers/usb/host/fotg210-hcd.c : cpu_to_hc32(fotg210, QH_SMASK); fotg210 3817 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, "reused qh %p schedule\n", qh); fotg210 3820 drivers/usb/host/fotg210-hcd.c qh_link_periodic(fotg210, qh); fotg210 3825 drivers/usb/host/fotg210-hcd.c static int intr_submit(struct fotg210_hcd *fotg210, struct urb *urb, fotg210 3837 drivers/usb/host/fotg210-hcd.c spin_lock_irqsave(&fotg210->lock, flags); fotg210 3839 drivers/usb/host/fotg210-hcd.c if (unlikely(!HCD_HW_ACCESSIBLE(fotg210_to_hcd(fotg210)))) { fotg210 3843 drivers/usb/host/fotg210-hcd.c status = usb_hcd_link_urb_to_ep(fotg210_to_hcd(fotg210), urb); fotg210 3849 drivers/usb/host/fotg210-hcd.c qh = qh_append_tds(fotg210, urb, &empty, epnum, &urb->ep->hcpriv); fotg210 3855 drivers/usb/host/fotg210-hcd.c status = qh_schedule(fotg210, qh); fotg210 3861 drivers/usb/host/fotg210-hcd.c qh = qh_append_tds(fotg210, urb, qtd_list, epnum, &urb->ep->hcpriv); fotg210 3865 drivers/usb/host/fotg210-hcd.c fotg210_to_hcd(fotg210)->self.bandwidth_int_reqs++; fotg210 3869 drivers/usb/host/fotg210-hcd.c usb_hcd_unlink_urb_from_ep(fotg210_to_hcd(fotg210), urb); fotg210 3871 drivers/usb/host/fotg210-hcd.c spin_unlock_irqrestore(&fotg210->lock, flags); fotg210 3873 drivers/usb/host/fotg210-hcd.c qtd_list_free(fotg210, urb, qtd_list); fotg210 3878 drivers/usb/host/fotg210-hcd.c static void scan_intr(struct fotg210_hcd *fotg210) fotg210 3882 drivers/usb/host/fotg210-hcd.c list_for_each_entry_safe(qh, fotg210->qh_scan_next, fotg210 3883 drivers/usb/host/fotg210-hcd.c &fotg210->intr_qh_list, intr_node) { fotg210 3896 drivers/usb/host/fotg210-hcd.c temp = qh_completions(fotg210, qh); fotg210 3900 drivers/usb/host/fotg210-hcd.c start_unlink_intr(fotg210, qh); fotg210 3922 drivers/usb/host/fotg210-hcd.c static void iso_stream_init(struct fotg210_hcd *fotg210, fotg210 3949 drivers/usb/host/fotg210-hcd.c stream->buf0 = cpu_to_hc32(fotg210, (epnum << 8) | dev->devnum); fotg210 3950 drivers/usb/host/fotg210-hcd.c stream->buf1 = cpu_to_hc32(fotg210, buf1); fotg210 3951 drivers/usb/host/fotg210-hcd.c stream->buf2 = cpu_to_hc32(fotg210, multi); fotg210 3975 drivers/usb/host/fotg210-hcd.c static struct fotg210_iso_stream *iso_stream_find(struct fotg210_hcd *fotg210, fotg210 3989 drivers/usb/host/fotg210-hcd.c spin_lock_irqsave(&fotg210->lock, flags); fotg210 3997 drivers/usb/host/fotg210-hcd.c iso_stream_init(fotg210, stream, urb->dev, urb->pipe, fotg210 4003 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, "dev %s ep%d%s, not iso??\n", fotg210 4009 drivers/usb/host/fotg210-hcd.c spin_unlock_irqrestore(&fotg210->lock, flags); fotg210 4029 drivers/usb/host/fotg210-hcd.c static inline void itd_sched_init(struct fotg210_hcd *fotg210, fotg210 4057 drivers/usb/host/fotg210-hcd.c uframe->transaction = cpu_to_hc32(fotg210, trans); fotg210 4078 drivers/usb/host/fotg210-hcd.c struct fotg210_hcd *fotg210, struct urb *urb, gfp_t mem_flags) fotg210 4091 drivers/usb/host/fotg210-hcd.c itd_sched_init(fotg210, sched, stream, urb); fotg210 4099 drivers/usb/host/fotg210-hcd.c spin_lock_irqsave(&fotg210->lock, flags); fotg210 4109 drivers/usb/host/fotg210-hcd.c if (itd->frame == fotg210->now_frame) fotg210 4115 drivers/usb/host/fotg210-hcd.c spin_unlock_irqrestore(&fotg210->lock, flags); fotg210 4116 drivers/usb/host/fotg210-hcd.c itd = dma_pool_zalloc(fotg210->itd_pool, mem_flags, fotg210 4118 drivers/usb/host/fotg210-hcd.c spin_lock_irqsave(&fotg210->lock, flags); fotg210 4121 drivers/usb/host/fotg210-hcd.c spin_unlock_irqrestore(&fotg210->lock, flags); fotg210 4129 drivers/usb/host/fotg210-hcd.c spin_unlock_irqrestore(&fotg210->lock, flags); fotg210 4137 drivers/usb/host/fotg210-hcd.c static inline int itd_slot_ok(struct fotg210_hcd *fotg210, u32 mod, u32 uframe, fotg210 4143 drivers/usb/host/fotg210-hcd.c if (periodic_usecs(fotg210, uframe >> 3, uframe & 0x7) fotg210 4144 drivers/usb/host/fotg210-hcd.c > (fotg210->uframe_periodic_max - usecs)) fotg210 4165 drivers/usb/host/fotg210-hcd.c static int iso_stream_schedule(struct fotg210_hcd *fotg210, struct urb *urb, fotg210 4170 drivers/usb/host/fotg210-hcd.c unsigned mod = fotg210->periodic_size << 3; fotg210 4177 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, "iso request %p too long\n", urb); fotg210 4182 drivers/usb/host/fotg210-hcd.c now = fotg210_read_frame_index(fotg210) & (mod - 1); fotg210 4197 drivers/usb/host/fotg210-hcd.c if (!stream->highspeed && fotg210->fs_i_thresh) fotg210 4198 drivers/usb/host/fotg210-hcd.c next = now + fotg210->i_thresh; fotg210 4213 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, "request %p would overflow (%d+%d >= %d)\n", fotg210 4244 drivers/usb/host/fotg210-hcd.c if (itd_slot_ok(fotg210, mod, start, fotg210 4251 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, "iso resched full %p (now %d max %d)\n", fotg210 4261 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, "request %p would overflow (%d+%d >= %d)\n", fotg210 4276 drivers/usb/host/fotg210-hcd.c if (fotg210->isoc_count == 0) fotg210 4277 drivers/usb/host/fotg210-hcd.c fotg210->next_frame = now >> 3; fotg210 4286 drivers/usb/host/fotg210-hcd.c static inline void itd_init(struct fotg210_hcd *fotg210, fotg210 4292 drivers/usb/host/fotg210-hcd.c itd->hw_next = FOTG210_LIST_END(fotg210); fotg210 4303 drivers/usb/host/fotg210-hcd.c static inline void itd_patch(struct fotg210_hcd *fotg210, fotg210 4314 drivers/usb/host/fotg210-hcd.c itd->hw_transaction[uframe] |= cpu_to_hc32(fotg210, pg << 12); fotg210 4315 drivers/usb/host/fotg210-hcd.c itd->hw_bufp[pg] |= cpu_to_hc32(fotg210, uf->bufp & ~(u32)0); fotg210 4316 drivers/usb/host/fotg210-hcd.c itd->hw_bufp_hi[pg] |= cpu_to_hc32(fotg210, (u32)(uf->bufp >> 32)); fotg210 4323 drivers/usb/host/fotg210-hcd.c itd->hw_bufp[pg] |= cpu_to_hc32(fotg210, bufp & ~(u32)0); fotg210 4324 drivers/usb/host/fotg210-hcd.c itd->hw_bufp_hi[pg] |= cpu_to_hc32(fotg210, (u32)(bufp >> 32)); fotg210 4328 drivers/usb/host/fotg210-hcd.c static inline void itd_link(struct fotg210_hcd *fotg210, unsigned frame, fotg210 4331 drivers/usb/host/fotg210-hcd.c union fotg210_shadow *prev = &fotg210->pshadow[frame]; fotg210 4332 drivers/usb/host/fotg210-hcd.c __hc32 *hw_p = &fotg210->periodic[frame]; fotg210 4338 drivers/usb/host/fotg210-hcd.c type = Q_NEXT_TYPE(fotg210, *hw_p); fotg210 4339 drivers/usb/host/fotg210-hcd.c if (type == cpu_to_hc32(fotg210, Q_TYPE_QH)) fotg210 4341 drivers/usb/host/fotg210-hcd.c prev = periodic_next_shadow(fotg210, prev, type); fotg210 4342 drivers/usb/host/fotg210-hcd.c hw_p = shadow_next_periodic(fotg210, &here, type); fotg210 4351 drivers/usb/host/fotg210-hcd.c *hw_p = cpu_to_hc32(fotg210, itd->itd_dma | Q_TYPE_ITD); fotg210 4355 drivers/usb/host/fotg210-hcd.c static void itd_link_urb(struct fotg210_hcd *fotg210, struct urb *urb, fotg210 4366 drivers/usb/host/fotg210-hcd.c fotg210_to_hcd(fotg210)->self.bandwidth_allocated fotg210 4368 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, fotg210 4388 drivers/usb/host/fotg210-hcd.c itd_init(fotg210, stream, itd); fotg210 4394 drivers/usb/host/fotg210-hcd.c itd_patch(fotg210, itd, iso_sched, packet, uframe); fotg210 4403 drivers/usb/host/fotg210-hcd.c itd_link(fotg210, frame & (fotg210->periodic_size - 1), fotg210 4414 drivers/usb/host/fotg210-hcd.c ++fotg210->isoc_count; fotg210 4415 drivers/usb/host/fotg210-hcd.c enable_periodic(fotg210); fotg210 4431 drivers/usb/host/fotg210-hcd.c static bool itd_complete(struct fotg210_hcd *fotg210, struct fotg210_itd *itd) fotg210 4449 drivers/usb/host/fotg210-hcd.c t = hc32_to_cpup(fotg210, &itd->hw_transaction[uframe]); fotg210 4491 drivers/usb/host/fotg210-hcd.c fotg210_urb_done(fotg210, urb, 0); fotg210 4495 drivers/usb/host/fotg210-hcd.c --fotg210->isoc_count; fotg210 4496 drivers/usb/host/fotg210-hcd.c disable_periodic(fotg210); fotg210 4499 drivers/usb/host/fotg210-hcd.c fotg210_to_hcd(fotg210)->self.bandwidth_allocated fotg210 4501 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, fotg210 4516 drivers/usb/host/fotg210-hcd.c &fotg210->cached_itd_list); fotg210 4517 drivers/usb/host/fotg210-hcd.c start_free_itds(fotg210); fotg210 4523 drivers/usb/host/fotg210-hcd.c static int itd_submit(struct fotg210_hcd *fotg210, struct urb *urb, fotg210 4531 drivers/usb/host/fotg210-hcd.c stream = iso_stream_find(fotg210, urb); fotg210 4533 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, "can't get iso stream\n"); fotg210 4537 drivers/usb/host/fotg210-hcd.c fotg210_port_speed(fotg210, 0) == fotg210 4539 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, "can't change iso interval %d --> %d\n", fotg210 4545 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, fotg210 4556 drivers/usb/host/fotg210-hcd.c status = itd_urb_transaction(stream, fotg210, urb, mem_flags); fotg210 4558 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, "can't init itds\n"); fotg210 4563 drivers/usb/host/fotg210-hcd.c spin_lock_irqsave(&fotg210->lock, flags); fotg210 4564 drivers/usb/host/fotg210-hcd.c if (unlikely(!HCD_HW_ACCESSIBLE(fotg210_to_hcd(fotg210)))) { fotg210 4568 drivers/usb/host/fotg210-hcd.c status = usb_hcd_link_urb_to_ep(fotg210_to_hcd(fotg210), urb); fotg210 4571 drivers/usb/host/fotg210-hcd.c status = iso_stream_schedule(fotg210, urb, stream); fotg210 4573 drivers/usb/host/fotg210-hcd.c itd_link_urb(fotg210, urb, fotg210->periodic_size << 3, stream); fotg210 4575 drivers/usb/host/fotg210-hcd.c usb_hcd_unlink_urb_from_ep(fotg210_to_hcd(fotg210), urb); fotg210 4577 drivers/usb/host/fotg210-hcd.c spin_unlock_irqrestore(&fotg210->lock, flags); fotg210 4582 drivers/usb/host/fotg210-hcd.c static inline int scan_frame_queue(struct fotg210_hcd *fotg210, unsigned frame, fotg210 4591 drivers/usb/host/fotg210-hcd.c q_p = &fotg210->pshadow[frame]; fotg210 4592 drivers/usb/host/fotg210-hcd.c hw_p = &fotg210->periodic[frame]; fotg210 4594 drivers/usb/host/fotg210-hcd.c type = Q_NEXT_TYPE(fotg210, *hw_p); fotg210 4598 drivers/usb/host/fotg210-hcd.c switch (hc32_to_cpu(fotg210, type)) { fotg210 4609 drivers/usb/host/fotg210-hcd.c ITD_ACTIVE(fotg210)) fotg210 4615 drivers/usb/host/fotg210-hcd.c type = Q_NEXT_TYPE(fotg210, fotg210 4629 drivers/usb/host/fotg210-hcd.c type = Q_NEXT_TYPE(fotg210, q.itd->hw_next); fotg210 4631 drivers/usb/host/fotg210-hcd.c modified = itd_complete(fotg210, q.itd); fotg210 4635 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, "corrupt type %d frame %d shadow %p\n", fotg210 4646 drivers/usb/host/fotg210-hcd.c if (unlikely(modified && fotg210->isoc_count > 0)) fotg210 4652 drivers/usb/host/fotg210-hcd.c static void scan_isoc(struct fotg210_hcd *fotg210) fotg210 4655 drivers/usb/host/fotg210-hcd.c unsigned fmask = fotg210->periodic_size - 1; fotg210 4663 drivers/usb/host/fotg210-hcd.c if (fotg210->rh_state >= FOTG210_RH_RUNNING) { fotg210 4664 drivers/usb/host/fotg210-hcd.c uf = fotg210_read_frame_index(fotg210); fotg210 4668 drivers/usb/host/fotg210-hcd.c now_frame = (fotg210->next_frame - 1) & fmask; fotg210 4671 drivers/usb/host/fotg210-hcd.c fotg210->now_frame = now_frame; fotg210 4673 drivers/usb/host/fotg210-hcd.c frame = fotg210->next_frame; fotg210 4677 drivers/usb/host/fotg210-hcd.c ret = scan_frame_queue(fotg210, frame, fotg210 4685 drivers/usb/host/fotg210-hcd.c fotg210->next_frame = now_frame; fotg210 4693 drivers/usb/host/fotg210-hcd.c struct fotg210_hcd *fotg210; fotg210 4696 drivers/usb/host/fotg210-hcd.c fotg210 = hcd_to_fotg210(bus_to_hcd(dev_get_drvdata(dev))); fotg210 4697 drivers/usb/host/fotg210-hcd.c n = scnprintf(buf, PAGE_SIZE, "%d\n", fotg210->uframe_periodic_max); fotg210 4705 drivers/usb/host/fotg210-hcd.c struct fotg210_hcd *fotg210; fotg210 4712 drivers/usb/host/fotg210-hcd.c fotg210 = hcd_to_fotg210(bus_to_hcd(dev_get_drvdata(dev))); fotg210 4717 drivers/usb/host/fotg210-hcd.c fotg210_info(fotg210, "rejecting invalid request for uframe_periodic_max=%u\n", fotg210 4728 drivers/usb/host/fotg210-hcd.c spin_lock_irqsave(&fotg210->lock, flags); fotg210 4735 drivers/usb/host/fotg210-hcd.c if (uframe_periodic_max < fotg210->uframe_periodic_max) { fotg210 4738 drivers/usb/host/fotg210-hcd.c for (frame = 0; frame < fotg210->periodic_size; ++frame) fotg210 4741 drivers/usb/host/fotg210-hcd.c periodic_usecs(fotg210, frame, fotg210 4745 drivers/usb/host/fotg210-hcd.c fotg210_info(fotg210, fotg210 4754 drivers/usb/host/fotg210-hcd.c fotg210_info(fotg210, fotg210 4759 drivers/usb/host/fotg210-hcd.c fotg210_warn(fotg210, "max periodic bandwidth set is non-standard\n"); fotg210 4761 drivers/usb/host/fotg210-hcd.c fotg210->uframe_periodic_max = uframe_periodic_max; fotg210 4765 drivers/usb/host/fotg210-hcd.c spin_unlock_irqrestore(&fotg210->lock, flags); fotg210 4771 drivers/usb/host/fotg210-hcd.c static inline int create_sysfs_files(struct fotg210_hcd *fotg210) fotg210 4773 drivers/usb/host/fotg210-hcd.c struct device *controller = fotg210_to_hcd(fotg210)->self.controller; fotg210 4778 drivers/usb/host/fotg210-hcd.c static inline void remove_sysfs_files(struct fotg210_hcd *fotg210) fotg210 4780 drivers/usb/host/fotg210-hcd.c struct device *controller = fotg210_to_hcd(fotg210)->self.controller; fotg210 4788 drivers/usb/host/fotg210-hcd.c static void fotg210_turn_off_all_ports(struct fotg210_hcd *fotg210) fotg210 4790 drivers/usb/host/fotg210-hcd.c u32 __iomem *status_reg = &fotg210->regs->port_status; fotg210 4792 drivers/usb/host/fotg210-hcd.c fotg210_writel(fotg210, PORT_RWC_BITS, status_reg); fotg210 4798 drivers/usb/host/fotg210-hcd.c static void fotg210_silence_controller(struct fotg210_hcd *fotg210) fotg210 4800 drivers/usb/host/fotg210-hcd.c fotg210_halt(fotg210); fotg210 4802 drivers/usb/host/fotg210-hcd.c spin_lock_irq(&fotg210->lock); fotg210 4803 drivers/usb/host/fotg210-hcd.c fotg210->rh_state = FOTG210_RH_HALTED; fotg210 4804 drivers/usb/host/fotg210-hcd.c fotg210_turn_off_all_ports(fotg210); fotg210 4805 drivers/usb/host/fotg210-hcd.c spin_unlock_irq(&fotg210->lock); fotg210 4814 drivers/usb/host/fotg210-hcd.c struct fotg210_hcd *fotg210 = hcd_to_fotg210(hcd); fotg210 4816 drivers/usb/host/fotg210-hcd.c spin_lock_irq(&fotg210->lock); fotg210 4817 drivers/usb/host/fotg210-hcd.c fotg210->shutdown = true; fotg210 4818 drivers/usb/host/fotg210-hcd.c fotg210->rh_state = FOTG210_RH_STOPPING; fotg210 4819 drivers/usb/host/fotg210-hcd.c fotg210->enabled_hrtimer_events = 0; fotg210 4820 drivers/usb/host/fotg210-hcd.c spin_unlock_irq(&fotg210->lock); fotg210 4822 drivers/usb/host/fotg210-hcd.c fotg210_silence_controller(fotg210); fotg210 4824 drivers/usb/host/fotg210-hcd.c hrtimer_cancel(&fotg210->hrtimer); fotg210 4830 drivers/usb/host/fotg210-hcd.c static void fotg210_work(struct fotg210_hcd *fotg210) fotg210 4836 drivers/usb/host/fotg210-hcd.c if (fotg210->scanning) { fotg210 4837 drivers/usb/host/fotg210-hcd.c fotg210->need_rescan = true; fotg210 4840 drivers/usb/host/fotg210-hcd.c fotg210->scanning = true; fotg210 4843 drivers/usb/host/fotg210-hcd.c fotg210->need_rescan = false; fotg210 4844 drivers/usb/host/fotg210-hcd.c if (fotg210->async_count) fotg210 4845 drivers/usb/host/fotg210-hcd.c scan_async(fotg210); fotg210 4846 drivers/usb/host/fotg210-hcd.c if (fotg210->intr_count > 0) fotg210 4847 drivers/usb/host/fotg210-hcd.c scan_intr(fotg210); fotg210 4848 drivers/usb/host/fotg210-hcd.c if (fotg210->isoc_count > 0) fotg210 4849 drivers/usb/host/fotg210-hcd.c scan_isoc(fotg210); fotg210 4850 drivers/usb/host/fotg210-hcd.c if (fotg210->need_rescan) fotg210 4852 drivers/usb/host/fotg210-hcd.c fotg210->scanning = false; fotg210 4858 drivers/usb/host/fotg210-hcd.c turn_on_io_watchdog(fotg210); fotg210 4865 drivers/usb/host/fotg210-hcd.c struct fotg210_hcd *fotg210 = hcd_to_fotg210(hcd); fotg210 4867 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, "stop\n"); fotg210 4871 drivers/usb/host/fotg210-hcd.c spin_lock_irq(&fotg210->lock); fotg210 4872 drivers/usb/host/fotg210-hcd.c fotg210->enabled_hrtimer_events = 0; fotg210 4873 drivers/usb/host/fotg210-hcd.c spin_unlock_irq(&fotg210->lock); fotg210 4875 drivers/usb/host/fotg210-hcd.c fotg210_quiesce(fotg210); fotg210 4876 drivers/usb/host/fotg210-hcd.c fotg210_silence_controller(fotg210); fotg210 4877 drivers/usb/host/fotg210-hcd.c fotg210_reset(fotg210); fotg210 4879 drivers/usb/host/fotg210-hcd.c hrtimer_cancel(&fotg210->hrtimer); fotg210 4880 drivers/usb/host/fotg210-hcd.c remove_sysfs_files(fotg210); fotg210 4881 drivers/usb/host/fotg210-hcd.c remove_debug_files(fotg210); fotg210 4884 drivers/usb/host/fotg210-hcd.c spin_lock_irq(&fotg210->lock); fotg210 4885 drivers/usb/host/fotg210-hcd.c end_free_itds(fotg210); fotg210 4886 drivers/usb/host/fotg210-hcd.c spin_unlock_irq(&fotg210->lock); fotg210 4887 drivers/usb/host/fotg210-hcd.c fotg210_mem_cleanup(fotg210); fotg210 4890 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, "irq normal %ld err %ld iaa %ld (lost %ld)\n", fotg210 4891 drivers/usb/host/fotg210-hcd.c fotg210->stats.normal, fotg210->stats.error, fotg210 4892 drivers/usb/host/fotg210-hcd.c fotg210->stats.iaa, fotg210->stats.lost_iaa); fotg210 4893 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, "complete %ld unlink %ld\n", fotg210 4894 drivers/usb/host/fotg210-hcd.c fotg210->stats.complete, fotg210->stats.unlink); fotg210 4897 drivers/usb/host/fotg210-hcd.c dbg_status(fotg210, "fotg210_stop completed", fotg210 4898 drivers/usb/host/fotg210-hcd.c fotg210_readl(fotg210, &fotg210->regs->status)); fotg210 4904 drivers/usb/host/fotg210-hcd.c struct fotg210_hcd *fotg210 = hcd_to_fotg210(hcd); fotg210 4910 drivers/usb/host/fotg210-hcd.c spin_lock_init(&fotg210->lock); fotg210 4915 drivers/usb/host/fotg210-hcd.c fotg210->need_io_watchdog = 1; fotg210 4917 drivers/usb/host/fotg210-hcd.c hrtimer_init(&fotg210->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); fotg210 4918 drivers/usb/host/fotg210-hcd.c fotg210->hrtimer.function = fotg210_hrtimer_func; fotg210 4919 drivers/usb/host/fotg210-hcd.c fotg210->next_hrtimer_event = FOTG210_HRTIMER_NO_EVENT; fotg210 4921 drivers/usb/host/fotg210-hcd.c hcc_params = fotg210_readl(fotg210, &fotg210->caps->hcc_params); fotg210 4927 drivers/usb/host/fotg210-hcd.c fotg210->uframe_periodic_max = 100; fotg210 4933 drivers/usb/host/fotg210-hcd.c fotg210->periodic_size = DEFAULT_I_TDPS; fotg210 4934 drivers/usb/host/fotg210-hcd.c INIT_LIST_HEAD(&fotg210->intr_qh_list); fotg210 4935 drivers/usb/host/fotg210-hcd.c INIT_LIST_HEAD(&fotg210->cached_itd_list); fotg210 4941 drivers/usb/host/fotg210-hcd.c fotg210->periodic_size = 1024; fotg210 4944 drivers/usb/host/fotg210-hcd.c fotg210->periodic_size = 512; fotg210 4947 drivers/usb/host/fotg210-hcd.c fotg210->periodic_size = 256; fotg210 4953 drivers/usb/host/fotg210-hcd.c retval = fotg210_mem_init(fotg210, GFP_KERNEL); fotg210 4958 drivers/usb/host/fotg210-hcd.c fotg210->i_thresh = 2; fotg210 4967 drivers/usb/host/fotg210-hcd.c fotg210->async->qh_next.qh = NULL; fotg210 4968 drivers/usb/host/fotg210-hcd.c hw = fotg210->async->hw; fotg210 4969 drivers/usb/host/fotg210-hcd.c hw->hw_next = QH_NEXT(fotg210, fotg210->async->qh_dma); fotg210 4970 drivers/usb/host/fotg210-hcd.c hw->hw_info1 = cpu_to_hc32(fotg210, QH_HEAD); fotg210 4971 drivers/usb/host/fotg210-hcd.c hw->hw_token = cpu_to_hc32(fotg210, QTD_STS_HALT); fotg210 4972 drivers/usb/host/fotg210-hcd.c hw->hw_qtd_next = FOTG210_LIST_END(fotg210); fotg210 4973 drivers/usb/host/fotg210-hcd.c fotg210->async->qh_state = QH_STATE_LINKED; fotg210 4974 drivers/usb/host/fotg210-hcd.c hw->hw_alt_next = QTD_NEXT(fotg210, fotg210->async->dummy->qtd_dma); fotg210 4993 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, "park %d\n", park); fotg210 5000 drivers/usb/host/fotg210-hcd.c fotg210->command = temp; fotg210 5011 drivers/usb/host/fotg210-hcd.c struct fotg210_hcd *fotg210 = hcd_to_fotg210(hcd); fotg210 5019 drivers/usb/host/fotg210-hcd.c fotg210_writel(fotg210, fotg210->periodic_dma, fotg210 5020 drivers/usb/host/fotg210-hcd.c &fotg210->regs->frame_list); fotg210 5021 drivers/usb/host/fotg210-hcd.c fotg210_writel(fotg210, (u32)fotg210->async->qh_dma, fotg210 5022 drivers/usb/host/fotg210-hcd.c &fotg210->regs->async_next); fotg210 5036 drivers/usb/host/fotg210-hcd.c hcc_params = fotg210_readl(fotg210, &fotg210->caps->hcc_params); fotg210 5042 drivers/usb/host/fotg210-hcd.c fotg210->command &= ~(CMD_IAAD|CMD_PSE|CMD_ASE|CMD_RESET); fotg210 5043 drivers/usb/host/fotg210-hcd.c fotg210->command |= CMD_RUN; fotg210 5044 drivers/usb/host/fotg210-hcd.c fotg210_writel(fotg210, fotg210->command, &fotg210->regs->command); fotg210 5045 drivers/usb/host/fotg210-hcd.c dbg_cmd(fotg210, "init", fotg210->command); fotg210 5062 drivers/usb/host/fotg210-hcd.c fotg210->rh_state = FOTG210_RH_RUNNING; fotg210 5064 drivers/usb/host/fotg210-hcd.c fotg210_readl(fotg210, &fotg210->regs->command); fotg210 5067 drivers/usb/host/fotg210-hcd.c fotg210->last_periodic_enable = ktime_get_real(); fotg210 5069 drivers/usb/host/fotg210-hcd.c temp = HC_VERSION(fotg210, fotg210 5070 drivers/usb/host/fotg210-hcd.c fotg210_readl(fotg210, &fotg210->caps->hc_capbase)); fotg210 5071 drivers/usb/host/fotg210-hcd.c fotg210_info(fotg210, fotg210 5073 drivers/usb/host/fotg210-hcd.c ((fotg210->sbrn & 0xf0) >> 4), (fotg210->sbrn & 0x0f), fotg210 5076 drivers/usb/host/fotg210-hcd.c fotg210_writel(fotg210, INTR_MASK, fotg210 5077 drivers/usb/host/fotg210-hcd.c &fotg210->regs->intr_enable); /* Turn On Interrupts */ fotg210 5083 drivers/usb/host/fotg210-hcd.c create_debug_files(fotg210); fotg210 5084 drivers/usb/host/fotg210-hcd.c create_sysfs_files(fotg210); fotg210 5091 drivers/usb/host/fotg210-hcd.c struct fotg210_hcd *fotg210 = hcd_to_fotg210(hcd); fotg210 5094 drivers/usb/host/fotg210-hcd.c fotg210->regs = (void __iomem *)fotg210->caps + fotg210 5095 drivers/usb/host/fotg210-hcd.c HC_LENGTH(fotg210, fotg210 5096 drivers/usb/host/fotg210-hcd.c fotg210_readl(fotg210, &fotg210->caps->hc_capbase)); fotg210 5097 drivers/usb/host/fotg210-hcd.c dbg_hcs_params(fotg210, "reset"); fotg210 5098 drivers/usb/host/fotg210-hcd.c dbg_hcc_params(fotg210, "reset"); fotg210 5101 drivers/usb/host/fotg210-hcd.c fotg210->hcs_params = fotg210_readl(fotg210, fotg210 5102 drivers/usb/host/fotg210-hcd.c &fotg210->caps->hcs_params); fotg210 5104 drivers/usb/host/fotg210-hcd.c fotg210->sbrn = HCD_USB2; fotg210 5111 drivers/usb/host/fotg210-hcd.c retval = fotg210_halt(fotg210); fotg210 5115 drivers/usb/host/fotg210-hcd.c fotg210_reset(fotg210); fotg210 5122 drivers/usb/host/fotg210-hcd.c struct fotg210_hcd *fotg210 = hcd_to_fotg210(hcd); fotg210 5126 drivers/usb/host/fotg210-hcd.c spin_lock(&fotg210->lock); fotg210 5128 drivers/usb/host/fotg210-hcd.c status = fotg210_readl(fotg210, &fotg210->regs->status); fotg210 5132 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, "device removed\n"); fotg210 5144 drivers/usb/host/fotg210-hcd.c unlikely(fotg210->rh_state == FOTG210_RH_HALTED)) { fotg210 5145 drivers/usb/host/fotg210-hcd.c spin_unlock(&fotg210->lock); fotg210 5150 drivers/usb/host/fotg210-hcd.c fotg210_writel(fotg210, masked_status, &fotg210->regs->status); fotg210 5151 drivers/usb/host/fotg210-hcd.c cmd = fotg210_readl(fotg210, &fotg210->regs->command); fotg210 5155 drivers/usb/host/fotg210-hcd.c dbg_status(fotg210, "irq", status); fotg210 5162 drivers/usb/host/fotg210-hcd.c INCR(fotg210->stats.normal); fotg210 5164 drivers/usb/host/fotg210-hcd.c INCR(fotg210->stats.error); fotg210 5172 drivers/usb/host/fotg210-hcd.c fotg210->enabled_hrtimer_events &= fotg210 5182 drivers/usb/host/fotg210-hcd.c if (fotg210->next_hrtimer_event == FOTG210_HRTIMER_IAA_WATCHDOG) fotg210 5183 drivers/usb/host/fotg210-hcd.c ++fotg210->next_hrtimer_event; fotg210 5187 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, "IAA with IAAD still set?\n"); fotg210 5188 drivers/usb/host/fotg210-hcd.c if (fotg210->async_iaa) { fotg210 5189 drivers/usb/host/fotg210-hcd.c INCR(fotg210->stats.iaa); fotg210 5190 drivers/usb/host/fotg210-hcd.c end_unlink_async(fotg210); fotg210 5192 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, "IAA with nothing unlinked?\n"); fotg210 5198 drivers/usb/host/fotg210-hcd.c u32 __iomem *status_reg = &fotg210->regs->port_status; fotg210 5204 drivers/usb/host/fotg210-hcd.c if (fotg210->rh_state == FOTG210_RH_SUSPENDED) fotg210 5207 drivers/usb/host/fotg210-hcd.c pstatus = fotg210_readl(fotg210, status_reg); fotg210 5209 drivers/usb/host/fotg210-hcd.c if (test_bit(0, &fotg210->suspended_ports) && fotg210 5213 drivers/usb/host/fotg210-hcd.c fotg210->reset_done[0] == 0) { fotg210 5220 drivers/usb/host/fotg210-hcd.c fotg210->reset_done[0] = jiffies + msecs_to_jiffies(25); fotg210 5221 drivers/usb/host/fotg210-hcd.c set_bit(0, &fotg210->resuming_ports); fotg210 5222 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, "port 1 remote wakeup\n"); fotg210 5223 drivers/usb/host/fotg210-hcd.c mod_timer(&hcd->rh_timer, fotg210->reset_done[0]); fotg210 5229 drivers/usb/host/fotg210-hcd.c fotg210_err(fotg210, "fatal error\n"); fotg210 5230 drivers/usb/host/fotg210-hcd.c dbg_cmd(fotg210, "fatal", cmd); fotg210 5231 drivers/usb/host/fotg210-hcd.c dbg_status(fotg210, "fatal", status); fotg210 5236 drivers/usb/host/fotg210-hcd.c fotg210->shutdown = true; fotg210 5237 drivers/usb/host/fotg210-hcd.c fotg210->rh_state = FOTG210_RH_STOPPING; fotg210 5238 drivers/usb/host/fotg210-hcd.c fotg210->command &= ~(CMD_RUN | CMD_ASE | CMD_PSE); fotg210 5239 drivers/usb/host/fotg210-hcd.c fotg210_writel(fotg210, fotg210->command, fotg210 5240 drivers/usb/host/fotg210-hcd.c &fotg210->regs->command); fotg210 5241 drivers/usb/host/fotg210-hcd.c fotg210_writel(fotg210, 0, &fotg210->regs->intr_enable); fotg210 5242 drivers/usb/host/fotg210-hcd.c fotg210_handle_controller_death(fotg210); fotg210 5249 drivers/usb/host/fotg210-hcd.c fotg210_work(fotg210); fotg210 5250 drivers/usb/host/fotg210-hcd.c spin_unlock(&fotg210->lock); fotg210 5270 drivers/usb/host/fotg210-hcd.c struct fotg210_hcd *fotg210 = hcd_to_fotg210(hcd); fotg210 5285 drivers/usb/host/fotg210-hcd.c if (!qh_urb_transaction(fotg210, urb, &qtd_list, mem_flags)) fotg210 5287 drivers/usb/host/fotg210-hcd.c return submit_async(fotg210, urb, &qtd_list, mem_flags); fotg210 5290 drivers/usb/host/fotg210-hcd.c if (!qh_urb_transaction(fotg210, urb, &qtd_list, mem_flags)) fotg210 5292 drivers/usb/host/fotg210-hcd.c return intr_submit(fotg210, urb, &qtd_list, mem_flags); fotg210 5295 drivers/usb/host/fotg210-hcd.c return itd_submit(fotg210, urb, mem_flags); fotg210 5305 drivers/usb/host/fotg210-hcd.c struct fotg210_hcd *fotg210 = hcd_to_fotg210(hcd); fotg210 5310 drivers/usb/host/fotg210-hcd.c spin_lock_irqsave(&fotg210->lock, flags); fotg210 5325 drivers/usb/host/fotg210-hcd.c start_unlink_async(fotg210, qh); fotg210 5333 drivers/usb/host/fotg210-hcd.c qh_completions(fotg210, qh); fotg210 5345 drivers/usb/host/fotg210-hcd.c start_unlink_intr(fotg210, qh); fotg210 5348 drivers/usb/host/fotg210-hcd.c qh_completions(fotg210, qh); fotg210 5351 drivers/usb/host/fotg210-hcd.c fotg210_dbg(fotg210, "bogus qh %p state %d\n", fotg210 5365 drivers/usb/host/fotg210-hcd.c spin_unlock_irqrestore(&fotg210->lock, flags); fotg210 5374 drivers/usb/host/fotg210-hcd.c struct fotg210_hcd *fotg210 = hcd_to_fotg210(hcd); fotg210 5382 drivers/usb/host/fotg210-hcd.c spin_lock_irqsave(&fotg210->lock, flags); fotg210 5401 drivers/usb/host/fotg210-hcd.c if (fotg210->rh_state < FOTG210_RH_RUNNING) fotg210 5406 drivers/usb/host/fotg210-hcd.c for (tmp = fotg210->async->qh_next.qh; fotg210 5414 drivers/usb/host/fotg210-hcd.c start_unlink_async(fotg210, qh); fotg210 5419 drivers/usb/host/fotg210-hcd.c spin_unlock_irqrestore(&fotg210->lock, flags); fotg210 5426 drivers/usb/host/fotg210-hcd.c qh_destroy(fotg210, qh); fotg210 5434 drivers/usb/host/fotg210-hcd.c fotg210_err(fotg210, "qh %p (#%02x) state %d%s\n", fotg210 5441 drivers/usb/host/fotg210-hcd.c spin_unlock_irqrestore(&fotg210->lock, flags); fotg210 5447 drivers/usb/host/fotg210-hcd.c struct fotg210_hcd *fotg210 = hcd_to_fotg210(hcd); fotg210 5457 drivers/usb/host/fotg210-hcd.c spin_lock_irqsave(&fotg210->lock, flags); fotg210 5477 drivers/usb/host/fotg210-hcd.c start_unlink_async(fotg210, qh); fotg210 5479 drivers/usb/host/fotg210-hcd.c start_unlink_intr(fotg210, qh); fotg210 5482 drivers/usb/host/fotg210-hcd.c spin_unlock_irqrestore(&fotg210->lock, flags); fotg210 5487 drivers/usb/host/fotg210-hcd.c struct fotg210_hcd *fotg210 = hcd_to_fotg210(hcd); fotg210 5489 drivers/usb/host/fotg210-hcd.c return (fotg210_read_frame_index(fotg210) >> 3) % fotg210 5490 drivers/usb/host/fotg210-hcd.c fotg210->periodic_size; fotg210 5548 drivers/usb/host/fotg210-hcd.c static void fotg210_init(struct fotg210_hcd *fotg210) fotg210 5553 drivers/usb/host/fotg210-hcd.c &fotg210->regs->gmir); fotg210 5555 drivers/usb/host/fotg210-hcd.c value = ioread32(&fotg210->regs->otgcsr); fotg210 5558 drivers/usb/host/fotg210-hcd.c iowrite32(value, &fotg210->regs->otgcsr); fotg210 5575 drivers/usb/host/fotg210-hcd.c struct fotg210_hcd *fotg210; fotg210 5611 drivers/usb/host/fotg210-hcd.c fotg210 = hcd_to_fotg210(hcd); fotg210 5613 drivers/usb/host/fotg210-hcd.c fotg210->caps = hcd->regs; fotg210 5616 drivers/usb/host/fotg210-hcd.c fotg210->pclk = clk_get(dev, "PCLK"); fotg210 5617 drivers/usb/host/fotg210-hcd.c if (!IS_ERR(fotg210->pclk)) { fotg210 5618 drivers/usb/host/fotg210-hcd.c retval = clk_prepare_enable(fotg210->pclk); fotg210 5623 drivers/usb/host/fotg210-hcd.c } else if (PTR_ERR(fotg210->pclk) == -EPROBE_DEFER) { fotg210 5628 drivers/usb/host/fotg210-hcd.c retval = PTR_ERR(fotg210->pclk); fotg210 5636 drivers/usb/host/fotg210-hcd.c fotg210_init(fotg210); fotg210 5649 drivers/usb/host/fotg210-hcd.c if (!IS_ERR(fotg210->pclk)) fotg210 5650 drivers/usb/host/fotg210-hcd.c clk_disable_unprepare(fotg210->pclk); fotg210 5666 drivers/usb/host/fotg210-hcd.c struct fotg210_hcd *fotg210 = hcd_to_fotg210(hcd); fotg210 5668 drivers/usb/host/fotg210-hcd.c if (!IS_ERR(fotg210->pclk)) fotg210 5669 drivers/usb/host/fotg210-hcd.c clk_disable_unprepare(fotg210->pclk); fotg210 197 drivers/usb/host/fotg210.h static inline struct usb_hcd *fotg210_to_hcd(struct fotg210_hcd *fotg210) fotg210 199 drivers/usb/host/fotg210.h return container_of((void *) fotg210, struct usb_hcd, hcd_priv); fotg210 215 drivers/usb/host/fotg210.h #define HC_LENGTH(fotg210, p) (0x00ff&((p) >> /* bits 7:0 / offset 00h */ \ fotg210 216 drivers/usb/host/fotg210.h (fotg210_big_endian_capbase(fotg210) ? 24 : 0))) fotg210 217 drivers/usb/host/fotg210.h #define HC_VERSION(fotg210, p) (0xffff&((p) >> /* bits 31:16 / offset 02h */ \ fotg210 218 drivers/usb/host/fotg210.h (fotg210_big_endian_capbase(fotg210) ? 0 : 16))) fotg210 310 drivers/usb/host/fotg210.h #define QTD_NEXT(fotg210, dma) cpu_to_hc32(fotg210, (u32)dma) fotg210 339 drivers/usb/host/fotg210.h #define ACTIVE_BIT(fotg210) cpu_to_hc32(fotg210, QTD_STS_ACTIVE) fotg210 340 drivers/usb/host/fotg210.h #define HALT_BIT(fotg210) cpu_to_hc32(fotg210, QTD_STS_HALT) fotg210 341 drivers/usb/host/fotg210.h #define STATUS_BIT(fotg210) cpu_to_hc32(fotg210, QTD_STS_STS) fotg210 354 drivers/usb/host/fotg210.h #define QTD_MASK(fotg210) cpu_to_hc32(fotg210, ~0x1f) fotg210 361 drivers/usb/host/fotg210.h #define Q_NEXT_TYPE(fotg210, dma) ((dma) & cpu_to_hc32(fotg210, 3 << 1)) fotg210 377 drivers/usb/host/fotg210.h #define QH_NEXT(fotg210, dma) \ fotg210 378 drivers/usb/host/fotg210.h (cpu_to_hc32(fotg210, (((u32)dma)&~0x01f)|Q_TYPE_QH)) fotg210 381 drivers/usb/host/fotg210.h #define FOTG210_LIST_END(fotg210) \ fotg210 382 drivers/usb/host/fotg210.h cpu_to_hc32(fotg210, 1) /* "null pointer" to hw */ fotg210 554 drivers/usb/host/fotg210.h #define ITD_ACTIVE(fotg210) cpu_to_hc32(fotg210, FOTG210_ISOC_ACTIVE) fotg210 597 drivers/usb/host/fotg210.h #define fotg210_prepare_ports_for_controller_suspend(fotg210, do_wakeup) \ fotg210 598 drivers/usb/host/fotg210.h fotg210_adjust_port_wakeup_flags(fotg210, true, do_wakeup) fotg210 600 drivers/usb/host/fotg210.h #define fotg210_prepare_ports_for_controller_resume(fotg210) \ fotg210 601 drivers/usb/host/fotg210.h fotg210_adjust_port_wakeup_flags(fotg210, false, false) fotg210 613 drivers/usb/host/fotg210.h fotg210_get_speed(struct fotg210_hcd *fotg210, unsigned int portsc) fotg210 615 drivers/usb/host/fotg210.h return (readl(&fotg210->regs->otgcsr) fotg210 621 drivers/usb/host/fotg210.h fotg210_port_speed(struct fotg210_hcd *fotg210, unsigned int portsc) fotg210 623 drivers/usb/host/fotg210.h switch (fotg210_get_speed(fotg210, portsc)) { fotg210 652 drivers/usb/host/fotg210.h static inline unsigned int fotg210_readl(const struct fotg210_hcd *fotg210, fotg210 658 drivers/usb/host/fotg210.h static inline void fotg210_writel(const struct fotg210_hcd *fotg210, fotg210 665 drivers/usb/host/fotg210.h static inline __hc32 cpu_to_hc32(const struct fotg210_hcd *fotg210, const u32 x) fotg210 671 drivers/usb/host/fotg210.h static inline u32 hc32_to_cpu(const struct fotg210_hcd *fotg210, const __hc32 x) fotg210 676 drivers/usb/host/fotg210.h static inline u32 hc32_to_cpup(const struct fotg210_hcd *fotg210, fotg210 684 drivers/usb/host/fotg210.h static inline unsigned fotg210_read_frame_index(struct fotg210_hcd *fotg210) fotg210 686 drivers/usb/host/fotg210.h return fotg210_readl(fotg210, &fotg210->regs->frame_index);