Lines Matching full:chip

38 	struct fotg210_chip                  *chip;  member
66 static inline int fifo_to_ep(struct fotg210_chip *chip, int id, int in) in fifo_to_ep() argument
71 static inline int ep_to_fifo(struct fotg210_chip *chip, int id) in ep_to_fifo() argument
76 static inline int ep_reset(struct fotg210_chip *chip, uint8_t ep_addr) in ep_reset() argument
79 struct fotg210_regs *regs = chip->regs; in ep_reset()
100 static int fotg210_reset(struct fotg210_chip *chip) in fotg210_reset() argument
102 struct fotg210_regs *regs = chip->regs; in fotg210_reset()
105 chip->state = USB_STATE_POWERED; in fotg210_reset()
107 /* chip enable */ in fotg210_reset()
111 chip->addr = 0; in fotg210_reset()
131 /* chip reset */ in fotg210_reset()
135 printf("fotg210: chip reset failed\n"); in fotg210_reset()
189 static inline int fotg210_cxwait(struct fotg210_chip *chip, uint32_t mask) in fotg210_cxwait() argument
191 struct fotg210_regs *regs = chip->regs; in fotg210_cxwait()
210 struct fotg210_chip *chip = ep->chip; in fotg210_dma() local
211 struct fotg210_regs *regs = chip->regs; in fotg210_dma()
215 int fifo = ep_to_fifo(chip, ep->id); in fotg210_dma()
246 fotg210_cxwait(chip, CXFIFO_CXFIFOE); in fotg210_dma()
251 fotg210_cxwait(chip, CXFIFO_FIFOE(fifo)); in fotg210_dma()
318 static void fotg210_setup(struct fotg210_chip *chip) in fotg210_setup() argument
323 struct fotg210_regs *regs = chip->regs; in fotg210_setup()
329 if (chip->state == USB_STATE_POWERED) { in fotg210_setup()
330 chip->state = USB_STATE_DEFAULT; in fotg210_setup()
335 chip->gadget.speed = USB_SPEED_HIGH; in fotg210_setup()
340 chip->gadget.speed = USB_SPEED_FULL; in fotg210_setup()
369 chip->state = USB_STATE_ADDRESS; in fotg210_setup()
370 writel(chip->addr, &regs->dev_addr); in fotg210_setup()
372 chip->state = USB_STATE_CONFIGURED; in fotg210_setup()
373 writel(chip->addr | DEVADDR_CONF, in fotg210_setup()
381 chip->state = USB_STATE_ADDRESS; in fotg210_setup()
382 chip->addr = req->wValue & DEVADDR_ADDR_MASK; in fotg210_setup()
384 writel(chip->addr, &regs->dev_addr); in fotg210_setup()
392 ep_reset(chip, req->wIndex); in fotg210_setup()
438 if (ret == CX_IDLE && chip->driver->setup) { in fotg210_setup()
439 if (chip->driver->setup(&chip->gadget, req) < 0) in fotg210_setup()
466 static void fotg210_recv(struct fotg210_chip *chip, int ep_id) in fotg210_recv() argument
468 struct fotg210_regs *regs = chip->regs; in fotg210_recv()
469 struct fotg210_ep *ep = chip->ep + ep_id; in fotg210_recv()
493 GIMR1_FIFO_RX(ep_to_fifo(chip, ep->id))); in fotg210_recv()
504 struct fotg210_chip *chip = ep->chip; in fotg210_ep_enable() local
505 struct fotg210_regs *regs = chip->regs; in fotg210_ep_enable()
506 int id = ep_to_fifo(chip, ep->id); in fotg210_ep_enable()
548 struct fotg210_chip *chip = ep->chip; in fotg210_ep_disable() local
549 struct fotg210_regs *regs = chip->regs; in fotg210_ep_disable()
550 int id = ep_to_fifo(chip, ep->id); in fotg210_ep_disable()
586 struct fotg210_chip *chip = ep->chip; in fotg210_ep_queue() local
587 struct fotg210_regs *regs = chip->regs; in fotg210_ep_queue()
597 if (!chip || chip->state == USB_STATE_SUSPENDED) { in fotg210_ep_queue()
598 printf("fotg210: request while chip suspended\n"); in fotg210_ep_queue()
630 GIMR1_FIFO_RX(ep_to_fifo(chip, ep->id))); in fotg210_ep_queue()
671 struct fotg210_chip *chip = ep->chip; in fotg210_ep_halt() local
672 struct fotg210_regs *regs = chip->regs; in fotg210_ep_halt()
681 fotg210_cxwait(chip, 0xf00); in fotg210_ep_halt()
708 static void pullup(struct fotg210_chip *chip, int is_on) in pullup() argument
710 struct fotg210_regs *regs = chip->regs; in pullup()
713 if (!chip->pullup) { in pullup()
714 chip->state = USB_STATE_POWERED; in pullup()
715 chip->pullup = 1; in pullup()
716 /* enable the chip */ in pullup()
722 chip->state = USB_STATE_NOTATTACHED; in pullup()
723 chip->pullup = 0; in pullup()
724 chip->addr = 0; in pullup()
725 writel(chip->addr, &regs->dev_addr); in pullup()
728 /* disable the chip */ in pullup()
735 struct fotg210_chip *chip; in fotg210_pullup() local
737 chip = container_of(_gadget, struct fotg210_chip, gadget); in fotg210_pullup()
741 pullup(chip, is_on); in fotg210_pullup()
748 struct fotg210_chip *chip; in fotg210_get_frame() local
751 chip = container_of(_gadget, struct fotg210_chip, gadget); in fotg210_get_frame()
752 regs = chip->regs; in fotg210_get_frame()
793 .chip = &controller,
802 .chip = &controller,
811 .chip = &controller,
820 .chip = &controller,
829 .chip = &controller,
836 struct fotg210_chip *chip = &controller; in usb_gadget_handle_interrupts() local
837 struct fotg210_regs *regs = chip->regs; in usb_gadget_handle_interrupts()
866 fotg210_setup(chip); in usb_gadget_handle_interrupts()
876 fotg210_recv(chip, fifo_to_ep(chip, id, 0)); in usb_gadget_handle_interrupts()
914 struct fotg210_chip *chip = &controller; in usb_gadget_register_driver() local
921 INIT_LIST_HEAD(&chip->gadget.ep_list); in usb_gadget_register_driver()
923 struct fotg210_ep *ep = chip->ep + i; in usb_gadget_register_driver()
932 list_add_tail(&ep->ep.ep_list, &chip->gadget.ep_list); in usb_gadget_register_driver()
936 if (fotg210_reset(chip)) { in usb_gadget_register_driver()
941 ret = driver->bind(&chip->gadget); in usb_gadget_register_driver()
946 chip->driver = driver; in usb_gadget_register_driver()
953 struct fotg210_chip *chip = &controller; in usb_gadget_unregister_driver() local
955 driver->unbind(&chip->gadget); in usb_gadget_unregister_driver()
956 chip->driver = NULL; in usb_gadget_unregister_driver()
958 pullup(chip, 0); in usb_gadget_unregister_driver()