Lines Matching refs:fotg210

33 	u32 value = ioread32(ep->fotg210->reg + FOTG210_DMISGR1);  in fotg210_disable_fifo_int()
39 iowrite32(value, ep->fotg210->reg + FOTG210_DMISGR1); in fotg210_disable_fifo_int()
44 u32 value = ioread32(ep->fotg210->reg + FOTG210_DMISGR1); in fotg210_enable_fifo_int()
50 iowrite32(value, ep->fotg210->reg + FOTG210_DMISGR1); in fotg210_enable_fifo_int()
53 static void fotg210_set_cxdone(struct fotg210_udc *fotg210) in fotg210_set_cxdone() argument
55 u32 value = ioread32(fotg210->reg + FOTG210_DCFESR); in fotg210_set_cxdone()
58 iowrite32(value, fotg210->reg + FOTG210_DCFESR); in fotg210_set_cxdone()
67 if (ep->fotg210->gadget.speed == USB_SPEED_UNKNOWN) in fotg210_done()
72 spin_unlock(&ep->fotg210->lock); in fotg210_done()
74 spin_lock(&ep->fotg210->lock); in fotg210_done()
80 fotg210_set_cxdone(ep->fotg210); in fotg210_done()
87 struct fotg210_udc *fotg210 = ep->fotg210; in fotg210_fifo_ep_mapping() local
95 val = ioread32(fotg210->reg + FOTG210_EPMAP); in fotg210_fifo_ep_mapping()
98 iowrite32(val, fotg210->reg + FOTG210_EPMAP); in fotg210_fifo_ep_mapping()
101 val = ioread32(fotg210->reg + FOTG210_FIFOMAP); in fotg210_fifo_ep_mapping()
104 iowrite32(val, fotg210->reg + FOTG210_FIFOMAP); in fotg210_fifo_ep_mapping()
107 val = ioread32(fotg210->reg + FOTG210_FIFOCF); in fotg210_fifo_ep_mapping()
109 iowrite32(val, fotg210->reg + FOTG210_FIFOCF); in fotg210_fifo_ep_mapping()
114 struct fotg210_udc *fotg210 = ep->fotg210; in fotg210_set_fifo_dir() local
117 val = ioread32(fotg210->reg + FOTG210_FIFOMAP); in fotg210_set_fifo_dir()
119 iowrite32(val, fotg210->reg + FOTG210_FIFOMAP); in fotg210_set_fifo_dir()
124 struct fotg210_udc *fotg210 = ep->fotg210; in fotg210_set_tfrtype() local
127 val = ioread32(fotg210->reg + FOTG210_FIFOCF); in fotg210_set_tfrtype()
129 iowrite32(val, fotg210->reg + FOTG210_FIFOCF); in fotg210_set_tfrtype()
135 struct fotg210_udc *fotg210 = ep->fotg210; in fotg210_set_mps() local
140 val = ioread32(fotg210->reg + offset); in fotg210_set_mps()
142 iowrite32(val, fotg210->reg + offset); in fotg210_set_mps()
148 struct fotg210_udc *fotg210 = ep->fotg210; in fotg210_config_ep() local
155 fotg210->ep[ep->epnum] = ep; in fotg210_config_ep()
176 static void fotg210_reset_tseq(struct fotg210_udc *fotg210, u8 epnum) in fotg210_reset_tseq() argument
178 struct fotg210_ep *ep = fotg210->ep[epnum]; in fotg210_reset_tseq()
183 fotg210->reg + FOTG210_INEPMPSR(epnum) : in fotg210_reset_tseq()
184 fotg210->reg + FOTG210_OUTEPMPSR(epnum); in fotg210_reset_tseq()
207 fotg210_reset_tseq(ep->fotg210, ep->epnum); in fotg210_ep_release()
225 spin_lock_irqsave(&ep->fotg210->lock, flags); in fotg210_ep_disable()
227 spin_unlock_irqrestore(&ep->fotg210->lock, flags); in fotg210_ep_disable()
260 struct fotg210_udc *fotg210 = ep->fotg210; in fotg210_enable_dma() local
263 value = ioread32(fotg210->reg + FOTG210_DMACPSR1); in fotg210_enable_dma()
266 iowrite32(value, fotg210->reg + FOTG210_DMACPSR1); in fotg210_enable_dma()
269 value = ioread32(fotg210->reg + FOTG210_DMATFNR); in fotg210_enable_dma()
274 iowrite32(value, fotg210->reg + FOTG210_DMATFNR); in fotg210_enable_dma()
277 iowrite32(d, fotg210->reg + FOTG210_DMACPSR2); in fotg210_enable_dma()
280 value = ioread32(fotg210->reg + FOTG210_DMISGR2); in fotg210_enable_dma()
282 iowrite32(value, fotg210->reg + FOTG210_DMISGR2); in fotg210_enable_dma()
285 value = ioread32(fotg210->reg + FOTG210_DMACPSR1); in fotg210_enable_dma()
287 iowrite32(value, fotg210->reg + FOTG210_DMACPSR1); in fotg210_enable_dma()
292 iowrite32(DMATFNR_DISDMA, ep->fotg210->reg + FOTG210_DMATFNR); in fotg210_disable_dma()
300 value = ioread32(ep->fotg210->reg + FOTG210_DISGR2); in fotg210_wait_dma_done()
307 iowrite32(value, ep->fotg210->reg + FOTG210_DISGR2); in fotg210_wait_dma_done()
311 value = ioread32(ep->fotg210->reg + FOTG210_DMACPSR1); in fotg210_wait_dma_done()
313 iowrite32(value, ep->fotg210->reg + FOTG210_DMACPSR1); in fotg210_wait_dma_done()
317 value = ioread32(ep->fotg210->reg + in fotg210_wait_dma_done()
320 iowrite32(value, ep->fotg210->reg + in fotg210_wait_dma_done()
323 value = ioread32(ep->fotg210->reg + FOTG210_DCFESR); in fotg210_wait_dma_done()
325 iowrite32(value, ep->fotg210->reg + FOTG210_DCFESR); in fotg210_wait_dma_done()
342 length = ioread32(ep->fotg210->reg + in fotg210_start_dma()
392 u32 value = ioread32(ep->fotg210->reg + FOTG210_DMISGR0); in fotg210_ep0_queue()
395 iowrite32(value, ep->fotg210->reg + FOTG210_DMISGR0); in fotg210_ep0_queue()
410 if (ep->fotg210->gadget.speed == USB_SPEED_UNKNOWN) in fotg210_ep_queue()
413 spin_lock_irqsave(&ep->fotg210->lock, flags); in fotg210_ep_queue()
428 spin_unlock_irqrestore(&ep->fotg210->lock, flags); in fotg210_ep_queue()
442 spin_lock_irqsave(&ep->fotg210->lock, flags); in fotg210_ep_dequeue()
445 spin_unlock_irqrestore(&ep->fotg210->lock, flags); in fotg210_ep_dequeue()
452 struct fotg210_udc *fotg210 = ep->fotg210; in fotg210_set_epnstall() local
459 value = ioread32(fotg210->reg + FOTG210_DCFESR); in fotg210_set_epnstall()
464 fotg210->reg + FOTG210_INEPMPSR(ep->epnum) : in fotg210_set_epnstall()
465 fotg210->reg + FOTG210_OUTEPMPSR(ep->epnum); in fotg210_set_epnstall()
473 struct fotg210_udc *fotg210 = ep->fotg210; in fotg210_clear_epnstall() local
478 fotg210->reg + FOTG210_INEPMPSR(ep->epnum) : in fotg210_clear_epnstall()
479 fotg210->reg + FOTG210_OUTEPMPSR(ep->epnum); in fotg210_clear_epnstall()
488 struct fotg210_udc *fotg210; in fotg210_set_halt_and_wedge() local
494 fotg210 = ep->fotg210; in fotg210_set_halt_and_wedge()
496 spin_lock_irqsave(&ep->fotg210->lock, flags); in fotg210_set_halt_and_wedge()
504 fotg210_reset_tseq(fotg210, ep->epnum); in fotg210_set_halt_and_wedge()
512 spin_unlock_irqrestore(&ep->fotg210->lock, flags); in fotg210_set_halt_and_wedge()
545 static void fotg210_clear_tx0byte(struct fotg210_udc *fotg210) in fotg210_clear_tx0byte() argument
547 u32 value = ioread32(fotg210->reg + FOTG210_TX0BYTE); in fotg210_clear_tx0byte()
551 iowrite32(value, fotg210->reg + FOTG210_TX0BYTE); in fotg210_clear_tx0byte()
554 static void fotg210_clear_rx0byte(struct fotg210_udc *fotg210) in fotg210_clear_rx0byte() argument
556 u32 value = ioread32(fotg210->reg + FOTG210_RX0BYTE); in fotg210_clear_rx0byte()
560 iowrite32(value, fotg210->reg + FOTG210_RX0BYTE); in fotg210_clear_rx0byte()
564 static void fotg210_rdsetupp(struct fotg210_udc *fotg210, in fotg210_rdsetupp() argument
572 iowrite32(DMATFNR_ACC_CXF, fotg210->reg + FOTG210_DMATFNR); in fotg210_rdsetupp()
575 data = ioread32(fotg210->reg + FOTG210_CXPORT); in fotg210_rdsetupp()
585 data = ioread32(fotg210->reg + FOTG210_CXPORT); in fotg210_rdsetupp()
589 data = ioread32(fotg210->reg + FOTG210_CXPORT); in fotg210_rdsetupp()
594 data = ioread32(fotg210->reg + FOTG210_CXPORT); in fotg210_rdsetupp()
603 iowrite32(DMATFNR_DISDMA, fotg210->reg + FOTG210_DMATFNR); in fotg210_rdsetupp()
606 static void fotg210_set_configuration(struct fotg210_udc *fotg210) in fotg210_set_configuration() argument
608 u32 value = ioread32(fotg210->reg + FOTG210_DAR); in fotg210_set_configuration()
611 iowrite32(value, fotg210->reg + FOTG210_DAR); in fotg210_set_configuration()
614 static void fotg210_set_dev_addr(struct fotg210_udc *fotg210, u32 addr) in fotg210_set_dev_addr() argument
616 u32 value = ioread32(fotg210->reg + FOTG210_DAR); in fotg210_set_dev_addr()
619 iowrite32(value, fotg210->reg + FOTG210_DAR); in fotg210_set_dev_addr()
622 static void fotg210_set_cxstall(struct fotg210_udc *fotg210) in fotg210_set_cxstall() argument
624 u32 value = ioread32(fotg210->reg + FOTG210_DCFESR); in fotg210_set_cxstall()
627 iowrite32(value, fotg210->reg + FOTG210_DCFESR); in fotg210_set_cxstall()
630 static void fotg210_request_error(struct fotg210_udc *fotg210) in fotg210_request_error() argument
632 fotg210_set_cxstall(fotg210); in fotg210_request_error()
636 static void fotg210_set_address(struct fotg210_udc *fotg210, in fotg210_set_address() argument
640 fotg210_request_error(fotg210); in fotg210_set_address()
642 fotg210_set_dev_addr(fotg210, ctrl->wValue); in fotg210_set_address()
643 fotg210_set_cxdone(fotg210); in fotg210_set_address()
647 static void fotg210_set_feature(struct fotg210_udc *fotg210, in fotg210_set_feature() argument
652 fotg210_set_cxdone(fotg210); in fotg210_set_feature()
655 fotg210_set_cxdone(fotg210); in fotg210_set_feature()
661 fotg210_set_epnstall(fotg210->ep[epnum]); in fotg210_set_feature()
663 fotg210_set_cxstall(fotg210); in fotg210_set_feature()
664 fotg210_set_cxdone(fotg210); in fotg210_set_feature()
668 fotg210_request_error(fotg210); in fotg210_set_feature()
673 static void fotg210_clear_feature(struct fotg210_udc *fotg210, in fotg210_clear_feature() argument
677 fotg210->ep[ctrl->wIndex & USB_ENDPOINT_NUMBER_MASK]; in fotg210_clear_feature()
681 fotg210_set_cxdone(fotg210); in fotg210_clear_feature()
684 fotg210_set_cxdone(fotg210); in fotg210_clear_feature()
689 fotg210_set_cxdone(fotg210); in fotg210_clear_feature()
695 fotg210_set_cxdone(fotg210); in fotg210_clear_feature()
698 fotg210_request_error(fotg210); in fotg210_clear_feature()
705 struct fotg210_udc *fotg210 = ep->fotg210; in fotg210_is_epnstall() local
710 fotg210->reg + FOTG210_INEPMPSR(ep->epnum) : in fotg210_is_epnstall()
711 fotg210->reg + FOTG210_OUTEPMPSR(ep->epnum); in fotg210_is_epnstall()
716 static void fotg210_get_status(struct fotg210_udc *fotg210, in fotg210_get_status() argument
723 fotg210->ep0_data = 1 << USB_DEVICE_SELF_POWERED; in fotg210_get_status()
726 fotg210->ep0_data = 0; in fotg210_get_status()
731 fotg210->ep0_data = in fotg210_get_status()
732 fotg210_is_epnstall(fotg210->ep[epnum]) in fotg210_get_status()
735 fotg210_request_error(fotg210); in fotg210_get_status()
739 fotg210_request_error(fotg210); in fotg210_get_status()
743 fotg210->ep0_req->buf = &fotg210->ep0_data; in fotg210_get_status()
744 fotg210->ep0_req->length = 2; in fotg210_get_status()
746 spin_unlock(&fotg210->lock); in fotg210_get_status()
747 fotg210_ep_queue(fotg210->gadget.ep0, fotg210->ep0_req, GFP_KERNEL); in fotg210_get_status()
748 spin_lock(&fotg210->lock); in fotg210_get_status()
751 static int fotg210_setup_packet(struct fotg210_udc *fotg210, in fotg210_setup_packet() argument
757 fotg210_rdsetupp(fotg210, p); in fotg210_setup_packet()
759 fotg210->ep[0]->dir_in = ctrl->bRequestType & USB_DIR_IN; in fotg210_setup_packet()
761 if (fotg210->gadget.speed == USB_SPEED_UNKNOWN) { in fotg210_setup_packet()
762 u32 value = ioread32(fotg210->reg + FOTG210_DMCR); in fotg210_setup_packet()
763 fotg210->gadget.speed = value & DMCR_HS_EN ? in fotg210_setup_packet()
771 fotg210_get_status(fotg210, ctrl); in fotg210_setup_packet()
774 fotg210_clear_feature(fotg210, ctrl); in fotg210_setup_packet()
777 fotg210_set_feature(fotg210, ctrl); in fotg210_setup_packet()
780 fotg210_set_address(fotg210, ctrl); in fotg210_setup_packet()
783 fotg210_set_configuration(fotg210); in fotg210_setup_packet()
797 static void fotg210_ep0out(struct fotg210_udc *fotg210) in fotg210_ep0out() argument
799 struct fotg210_ep *ep = fotg210->ep[0]; in fotg210_ep0out()
817 static void fotg210_ep0in(struct fotg210_udc *fotg210) in fotg210_ep0in() argument
819 struct fotg210_ep *ep = fotg210->ep[0]; in fotg210_ep0in()
833 fotg210_set_cxdone(fotg210); in fotg210_ep0in()
837 static void fotg210_clear_comabt_int(struct fotg210_udc *fotg210) in fotg210_clear_comabt_int() argument
839 u32 value = ioread32(fotg210->reg + FOTG210_DISGR0); in fotg210_clear_comabt_int()
842 iowrite32(value, fotg210->reg + FOTG210_DISGR0); in fotg210_clear_comabt_int()
870 struct fotg210_udc *fotg210 = _fotg210; in fotg210_irq() local
871 u32 int_grp = ioread32(fotg210->reg + FOTG210_DIGR); in fotg210_irq()
872 u32 int_msk = ioread32(fotg210->reg + FOTG210_DMIGR); in fotg210_irq()
876 spin_lock(&fotg210->lock); in fotg210_irq()
879 void __iomem *reg = fotg210->reg + FOTG210_DISGR2; in fotg210_irq()
881 u32 int_msk2 = ioread32(fotg210->reg + FOTG210_DMISGR2); in fotg210_irq()
917 fotg210_clear_tx0byte(fotg210); in fotg210_irq()
924 fotg210_clear_rx0byte(fotg210); in fotg210_irq()
938 void __iomem *reg = fotg210->reg + FOTG210_DISGR0; in fotg210_irq()
940 u32 int_msk0 = ioread32(fotg210->reg + FOTG210_DMISGR0); in fotg210_irq()
947 fotg210_clear_comabt_int(fotg210); in fotg210_irq()
952 if (fotg210_setup_packet(fotg210, &ctrl)) { in fotg210_irq()
953 spin_unlock(&fotg210->lock); in fotg210_irq()
954 if (fotg210->driver->setup(&fotg210->gadget, in fotg210_irq()
956 fotg210_set_cxstall(fotg210); in fotg210_irq()
957 spin_lock(&fotg210->lock); in fotg210_irq()
964 fotg210_ep0in(fotg210); in fotg210_irq()
967 fotg210_ep0out(fotg210); in fotg210_irq()
970 fotg210_set_cxstall(fotg210); in fotg210_irq()
976 void __iomem *reg = fotg210->reg + FOTG210_DISGR1; in fotg210_irq()
978 u32 int_msk1 = ioread32(fotg210->reg + FOTG210_DMISGR1); in fotg210_irq()
985 fotg210_in_fifo_handler(fotg210->ep[fifo + 1]); in fotg210_irq()
989 fotg210_out_fifo_handler(fotg210->ep[fifo + 1]); in fotg210_irq()
993 spin_unlock(&fotg210->lock); in fotg210_irq()
998 static void fotg210_disable_unplug(struct fotg210_udc *fotg210) in fotg210_disable_unplug() argument
1000 u32 reg = ioread32(fotg210->reg + FOTG210_PHYTMSR); in fotg210_disable_unplug()
1003 iowrite32(reg, fotg210->reg + FOTG210_PHYTMSR); in fotg210_disable_unplug()
1009 struct fotg210_udc *fotg210 = gadget_to_fotg210(g); in fotg210_udc_start() local
1014 fotg210->driver = driver; in fotg210_udc_start()
1017 value = ioread32(fotg210->reg + FOTG210_DMCR); in fotg210_udc_start()
1019 iowrite32(value, fotg210->reg + FOTG210_DMCR); in fotg210_udc_start()
1024 static void fotg210_init(struct fotg210_udc *fotg210) in fotg210_init() argument
1030 fotg210->reg + FOTG210_GMIR); in fotg210_init()
1033 value = ioread32(fotg210->reg + FOTG210_DMCR); in fotg210_init()
1035 iowrite32(value, fotg210->reg + FOTG210_DMCR); in fotg210_init()
1038 iowrite32(~(u32)0, fotg210->reg + FOTG210_DMISGR1); in fotg210_init()
1041 value = ioread32(fotg210->reg + FOTG210_DMISGR0); in fotg210_init()
1043 iowrite32(value, fotg210->reg + FOTG210_DMISGR0); in fotg210_init()
1048 struct fotg210_udc *fotg210 = gadget_to_fotg210(g); in fotg210_udc_stop() local
1051 spin_lock_irqsave(&fotg210->lock, flags); in fotg210_udc_stop()
1053 fotg210_init(fotg210); in fotg210_udc_stop()
1054 fotg210->driver = NULL; in fotg210_udc_stop()
1056 spin_unlock_irqrestore(&fotg210->lock, flags); in fotg210_udc_stop()
1068 struct fotg210_udc *fotg210 = platform_get_drvdata(pdev); in fotg210_udc_remove() local
1070 usb_del_gadget_udc(&fotg210->gadget); in fotg210_udc_remove()
1071 iounmap(fotg210->reg); in fotg210_udc_remove()
1072 free_irq(platform_get_irq(pdev, 0), fotg210); in fotg210_udc_remove()
1074 fotg210_ep_free_request(&fotg210->ep[0]->ep, fotg210->ep0_req); in fotg210_udc_remove()
1075 kfree(fotg210); in fotg210_udc_remove()
1083 struct fotg210_udc *fotg210 = NULL; in fotg210_udc_probe() local
1103 fotg210 = kzalloc(sizeof(struct fotg210_udc), GFP_KERNEL); in fotg210_udc_probe()
1104 if (fotg210 == NULL) in fotg210_udc_probe()
1111 fotg210->ep[i] = _ep[i]; in fotg210_udc_probe()
1114 fotg210->reg = ioremap(res->start, resource_size(res)); in fotg210_udc_probe()
1115 if (fotg210->reg == NULL) { in fotg210_udc_probe()
1120 spin_lock_init(&fotg210->lock); in fotg210_udc_probe()
1122 platform_set_drvdata(pdev, fotg210); in fotg210_udc_probe()
1124 fotg210->gadget.ops = &fotg210_gadget_ops; in fotg210_udc_probe()
1126 fotg210->gadget.max_speed = USB_SPEED_HIGH; in fotg210_udc_probe()
1127 fotg210->gadget.dev.parent = &pdev->dev; in fotg210_udc_probe()
1128 fotg210->gadget.dev.dma_mask = pdev->dev.dma_mask; in fotg210_udc_probe()
1129 fotg210->gadget.name = udc_name; in fotg210_udc_probe()
1131 INIT_LIST_HEAD(&fotg210->gadget.ep_list); in fotg210_udc_probe()
1134 struct fotg210_ep *ep = fotg210->ep[i]; in fotg210_udc_probe()
1137 INIT_LIST_HEAD(&fotg210->ep[i]->ep.ep_list); in fotg210_udc_probe()
1138 list_add_tail(&fotg210->ep[i]->ep.ep_list, in fotg210_udc_probe()
1139 &fotg210->gadget.ep_list); in fotg210_udc_probe()
1141 ep->fotg210 = fotg210; in fotg210_udc_probe()
1158 usb_ep_set_maxpacket_limit(&fotg210->ep[0]->ep, 0x40); in fotg210_udc_probe()
1159 fotg210->gadget.ep0 = &fotg210->ep[0]->ep; in fotg210_udc_probe()
1160 INIT_LIST_HEAD(&fotg210->gadget.ep0->ep_list); in fotg210_udc_probe()
1162 fotg210->ep0_req = fotg210_ep_alloc_request(&fotg210->ep[0]->ep, in fotg210_udc_probe()
1164 if (fotg210->ep0_req == NULL) in fotg210_udc_probe()
1167 fotg210_init(fotg210); in fotg210_udc_probe()
1169 fotg210_disable_unplug(fotg210); in fotg210_udc_probe()
1172 udc_name, fotg210); in fotg210_udc_probe()
1178 ret = usb_add_gadget_udc(&pdev->dev, &fotg210->gadget); in fotg210_udc_probe()
1187 free_irq(ires->start, fotg210); in fotg210_udc_probe()
1190 fotg210_ep_free_request(&fotg210->ep[0]->ep, fotg210->ep0_req); in fotg210_udc_probe()
1193 if (fotg210->reg) in fotg210_udc_probe()
1194 iounmap(fotg210->reg); in fotg210_udc_probe()
1197 kfree(fotg210); in fotg210_udc_probe()