Lines Matching full:ep0
5 * ep0.c - Endpoint 0 handling
37 struct usb_request *req = &ep->ep0.req.req; in ast_vhub_reply()
42 if (WARN_ON(!ep->ep0.dir_in)) in ast_vhub_reply()
98 memcpy_fromio(&crq, ep->ep0.setup, sizeof(crq)); in ast_vhub_ep0_handle_setup()
106 ep->ep0.state); in ast_vhub_ep0_handle_setup()
118 if (ep->ep0.state != ep0_state_token && in ast_vhub_ep0_handle_setup()
119 ep->ep0.state != ep0_state_stall) { in ast_vhub_ep0_handle_setup()
124 /* Calculate next state for EP0 */ in ast_vhub_ep0_handle_setup()
125 ep->ep0.state = ep0_state_data; in ast_vhub_ep0_handle_setup()
126 ep->ep0.dir_in = !!(crq.bRequestType & USB_DIR_IN); in ast_vhub_ep0_handle_setup()
169 writel(VHUB_EP0_CTRL_STALL, ep->ep0.ctlstat); in ast_vhub_ep0_handle_setup()
170 ep->ep0.state = ep0_state_stall; in ast_vhub_ep0_handle_setup()
171 ep->ep0.dir_in = false; in ast_vhub_ep0_handle_setup()
176 writel(VHUB_EP0_TX_BUFF_RDY, ep->ep0.ctlstat); in ast_vhub_ep0_handle_setup()
177 ep->ep0.state = ep0_state_status; in ast_vhub_ep0_handle_setup()
178 ep->ep0.dir_in = false; in ast_vhub_ep0_handle_setup()
198 ep->ep0.state = ep0_state_status; in ast_vhub_ep0_do_send()
199 writel(VHUB_EP0_RX_BUFF_RDY, ep->ep0.ctlstat); in ast_vhub_ep0_do_send()
228 writel(reg, ep->ep0.ctlstat); in ast_vhub_ep0_do_send()
229 writel(reg | VHUB_EP0_TX_BUFF_RDY, ep->ep0.ctlstat); in ast_vhub_ep0_do_send()
238 writel(VHUB_EP0_RX_BUFF_RDY, ep->ep0.ctlstat); in ast_vhub_ep0_rx_prime()
265 ep->ep0.state = ep0_state_status; in ast_vhub_ep0_do_receive()
266 writel(VHUB_EP0_TX_BUFF_RDY, ep->ep0.ctlstat); in ast_vhub_ep0_do_receive()
280 /* Read EP0 status */ in ast_vhub_ep0_handle_ack()
281 stat = readl(ep->ep0.ctlstat); in ast_vhub_ep0_handle_ack()
287 stat, ep->ep0.state, ep->ep0.dir_in, in_ack, req); in ast_vhub_ep0_handle_ack()
289 switch(ep->ep0.state) { in ast_vhub_ep0_handle_ack()
301 if ((ep->ep0.dir_in && (stat & VHUB_EP0_TX_BUFF_RDY)) || in ast_vhub_ep0_handle_ack()
302 (!ep->ep0.dir_in && (stat & VHUB_EP0_RX_BUFF_RDY)) || in ast_vhub_ep0_handle_ack()
303 (ep->ep0.dir_in != in_ack)) { in ast_vhub_ep0_handle_ack()
319 if (ep->ep0.dir_in) in ast_vhub_ep0_handle_ack()
336 if (ep->ep0.dir_in == in_ack) { in ast_vhub_ep0_handle_ack()
352 writel(VHUB_EP0_CTRL_STALL, ep->ep0.ctlstat); in ast_vhub_ep0_handle_ack()
353 ep->ep0.state = ep0_state_stall; in ast_vhub_ep0_handle_ack()
355 ep->ep0.state = ep0_state_token; in ast_vhub_ep0_handle_ack()
369 dev_warn(dev, "Bogus EP0 request ! u_req=%p\n", u_req); in ast_vhub_ep0_queue()
394 u_req->short_not_ok, ep->ep0.dir_in); in ast_vhub_ep0_queue()
404 /* EP0 can only support a single request at a time */ in ast_vhub_ep0_queue()
406 ep->ep0.state == ep0_state_token || in ast_vhub_ep0_queue()
407 ep->ep0.state == ep0_state_stall) { in ast_vhub_ep0_queue()
408 dev_warn(dev, "EP0: Request in wrong state\n"); in ast_vhub_ep0_queue()
409 EPVDBG(ep, "EP0: list_empty=%d state=%d\n", in ast_vhub_ep0_queue()
410 list_empty(&ep->queue), ep->ep0.state); in ast_vhub_ep0_queue()
418 if (ep->ep0.dir_in) { in ast_vhub_ep0_queue()
424 ep->ep0.state = ep0_state_status; in ast_vhub_ep0_queue()
425 writel(VHUB_EP0_TX_BUFF_RDY, ep->ep0.ctlstat); in ast_vhub_ep0_queue()
461 writel(VHUB_EP0_CTRL_STALL, ep->ep0.ctlstat); in ast_vhub_ep0_dequeue()
462 ep->ep0.state = ep0_state_status; in ast_vhub_ep0_dequeue()
463 ep->ep0.dir_in = false; in ast_vhub_ep0_dequeue()
480 struct ast_vhub_ep *ep = &dev->ep0; in ast_vhub_reset_ep0()
483 ep->ep0.state = ep0_state_token; in ast_vhub_reset_ep0()
495 ep->ep.name = "ep0"; in ast_vhub_init_ep0()
501 ep->ep0.state = ep0_state_token; in ast_vhub_init_ep0()
502 INIT_LIST_HEAD(&ep->ep0.req.queue); in ast_vhub_init_ep0()
503 ep->ep0.req.internal = true; in ast_vhub_init_ep0()
507 ep->ep0.ctlstat = dev->regs + AST_VHUB_DEV_EP0_CTRL; in ast_vhub_init_ep0()
508 ep->ep0.setup = vhub->regs + in ast_vhub_init_ep0()
515 ep->ep0.ctlstat = vhub->regs + AST_VHUB_EP0_CTRL; in ast_vhub_init_ep0()
516 ep->ep0.setup = vhub->regs + AST_VHUB_SETUP0; in ast_vhub_init_ep0()