Lines Matching refs:chip
39 struct fotg210_chip *chip; member
67 static inline int fifo_to_ep(struct fotg210_chip *chip, int id, int in) in fifo_to_ep() argument
72 static inline int ep_to_fifo(struct fotg210_chip *chip, int id) in ep_to_fifo() argument
77 static inline int ep_reset(struct fotg210_chip *chip, uint8_t ep_addr) in ep_reset() argument
80 struct fotg210_regs *regs = chip->regs; in ep_reset()
101 static int fotg210_reset(struct fotg210_chip *chip) in fotg210_reset() argument
103 struct fotg210_regs *regs = chip->regs; in fotg210_reset()
106 chip->state = USB_STATE_POWERED; in fotg210_reset()
112 chip->addr = 0; in fotg210_reset()
190 static inline int fotg210_cxwait(struct fotg210_chip *chip, uint32_t mask) in fotg210_cxwait() argument
192 struct fotg210_regs *regs = chip->regs; in fotg210_cxwait()
211 struct fotg210_chip *chip = ep->chip; in fotg210_dma() local
212 struct fotg210_regs *regs = chip->regs; in fotg210_dma()
216 int fifo = ep_to_fifo(chip, ep->id); in fotg210_dma()
247 fotg210_cxwait(chip, CXFIFO_CXFIFOE); in fotg210_dma()
252 fotg210_cxwait(chip, CXFIFO_FIFOE(fifo)); in fotg210_dma()
319 static void fotg210_setup(struct fotg210_chip *chip) in fotg210_setup() argument
324 struct fotg210_regs *regs = chip->regs; in fotg210_setup()
330 if (chip->state == USB_STATE_POWERED) { in fotg210_setup()
331 chip->state = USB_STATE_DEFAULT; in fotg210_setup()
336 chip->gadget.speed = USB_SPEED_HIGH; in fotg210_setup()
341 chip->gadget.speed = USB_SPEED_FULL; in fotg210_setup()
370 chip->state = USB_STATE_ADDRESS; in fotg210_setup()
371 writel(chip->addr, ®s->dev_addr); in fotg210_setup()
373 chip->state = USB_STATE_CONFIGURED; in fotg210_setup()
374 writel(chip->addr | DEVADDR_CONF, in fotg210_setup()
382 chip->state = USB_STATE_ADDRESS; in fotg210_setup()
383 chip->addr = req->wValue & DEVADDR_ADDR_MASK; in fotg210_setup()
385 writel(chip->addr, ®s->dev_addr); in fotg210_setup()
393 ep_reset(chip, req->wIndex); in fotg210_setup()
439 if (ret == CX_IDLE && chip->driver->setup) { in fotg210_setup()
440 if (chip->driver->setup(&chip->gadget, req) < 0) in fotg210_setup()
467 static void fotg210_recv(struct fotg210_chip *chip, int ep_id) in fotg210_recv() argument
469 struct fotg210_regs *regs = chip->regs; in fotg210_recv()
470 struct fotg210_ep *ep = chip->ep + ep_id; in fotg210_recv()
494 GIMR1_FIFO_RX(ep_to_fifo(chip, ep->id))); in fotg210_recv()
505 struct fotg210_chip *chip = ep->chip; in fotg210_ep_enable() local
506 struct fotg210_regs *regs = chip->regs; in fotg210_ep_enable()
507 int id = ep_to_fifo(chip, ep->id); in fotg210_ep_enable()
549 struct fotg210_chip *chip = ep->chip; in fotg210_ep_disable() local
550 struct fotg210_regs *regs = chip->regs; in fotg210_ep_disable()
551 int id = ep_to_fifo(chip, ep->id); in fotg210_ep_disable()
587 struct fotg210_chip *chip = ep->chip; in fotg210_ep_queue() local
588 struct fotg210_regs *regs = chip->regs; in fotg210_ep_queue()
598 if (!chip || chip->state == USB_STATE_SUSPENDED) { in fotg210_ep_queue()
631 GIMR1_FIFO_RX(ep_to_fifo(chip, ep->id))); in fotg210_ep_queue()
672 struct fotg210_chip *chip = ep->chip; in fotg210_ep_halt() local
673 struct fotg210_regs *regs = chip->regs; in fotg210_ep_halt()
682 fotg210_cxwait(chip, 0xf00); in fotg210_ep_halt()
709 static void pullup(struct fotg210_chip *chip, int is_on) in pullup() argument
711 struct fotg210_regs *regs = chip->regs; in pullup()
714 if (!chip->pullup) { in pullup()
715 chip->state = USB_STATE_POWERED; in pullup()
716 chip->pullup = 1; in pullup()
723 chip->state = USB_STATE_NOTATTACHED; in pullup()
724 chip->pullup = 0; in pullup()
725 chip->addr = 0; in pullup()
726 writel(chip->addr, ®s->dev_addr); in pullup()
736 struct fotg210_chip *chip; in fotg210_pullup() local
738 chip = container_of(_gadget, struct fotg210_chip, gadget); in fotg210_pullup()
742 pullup(chip, is_on); in fotg210_pullup()
749 struct fotg210_chip *chip; in fotg210_get_frame() local
752 chip = container_of(_gadget, struct fotg210_chip, gadget); in fotg210_get_frame()
753 regs = chip->regs; in fotg210_get_frame()
794 .chip = &controller,
803 .chip = &controller,
812 .chip = &controller,
821 .chip = &controller,
830 .chip = &controller,
837 struct fotg210_chip *chip = &controller; in usb_gadget_handle_interrupts() local
838 struct fotg210_regs *regs = chip->regs; in usb_gadget_handle_interrupts()
867 fotg210_setup(chip); in usb_gadget_handle_interrupts()
877 fotg210_recv(chip, fifo_to_ep(chip, id, 0)); in usb_gadget_handle_interrupts()
915 struct fotg210_chip *chip = &controller; in usb_gadget_register_driver() local
922 INIT_LIST_HEAD(&chip->gadget.ep_list); in usb_gadget_register_driver()
924 struct fotg210_ep *ep = chip->ep + i; in usb_gadget_register_driver()
933 list_add_tail(&ep->ep.ep_list, &chip->gadget.ep_list); in usb_gadget_register_driver()
937 if (fotg210_reset(chip)) { in usb_gadget_register_driver()
942 ret = driver->bind(&chip->gadget); in usb_gadget_register_driver()
947 chip->driver = driver; in usb_gadget_register_driver()
954 struct fotg210_chip *chip = &controller; in usb_gadget_unregister_driver() local
956 driver->unbind(&chip->gadget); in usb_gadget_unregister_driver()
957 chip->driver = NULL; in usb_gadget_unregister_driver()
959 pullup(chip, 0); in usb_gadget_unregister_driver()