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()
400 u32 value = ioread32(ep->fotg210->reg + in fotg210_ep0_queue()
404 iowrite32(value, ep->fotg210->reg + FOTG210_DMISGR0); in fotg210_ep0_queue()
420 if (ep->fotg210->gadget.speed == USB_SPEED_UNKNOWN) in fotg210_ep_queue()
423 spin_lock_irqsave(&ep->fotg210->lock, flags); in fotg210_ep_queue()
438 spin_unlock_irqrestore(&ep->fotg210->lock, flags); in fotg210_ep_queue()
452 spin_lock_irqsave(&ep->fotg210->lock, flags); in fotg210_ep_dequeue()
455 spin_unlock_irqrestore(&ep->fotg210->lock, flags); in fotg210_ep_dequeue()
462 struct fotg210_udc *fotg210 = ep->fotg210; in fotg210_set_epnstall() local
469 value = ioread32(fotg210->reg + FOTG210_DCFESR); in fotg210_set_epnstall()
474 fotg210->reg + FOTG210_INEPMPSR(ep->epnum) : in fotg210_set_epnstall()
475 fotg210->reg + FOTG210_OUTEPMPSR(ep->epnum); in fotg210_set_epnstall()
483 struct fotg210_udc *fotg210 = ep->fotg210; in fotg210_clear_epnstall() local
488 fotg210->reg + FOTG210_INEPMPSR(ep->epnum) : in fotg210_clear_epnstall()
489 fotg210->reg + FOTG210_OUTEPMPSR(ep->epnum); in fotg210_clear_epnstall()
498 struct fotg210_udc *fotg210; in fotg210_set_halt_and_wedge() local
504 fotg210 = ep->fotg210; in fotg210_set_halt_and_wedge()
506 spin_lock_irqsave(&ep->fotg210->lock, flags); in fotg210_set_halt_and_wedge()
514 fotg210_reset_tseq(fotg210, ep->epnum); in fotg210_set_halt_and_wedge()
522 spin_unlock_irqrestore(&ep->fotg210->lock, flags); in fotg210_set_halt_and_wedge()
555 static void fotg210_clear_tx0byte(struct fotg210_udc *fotg210) in fotg210_clear_tx0byte() argument
557 u32 value = ioread32(fotg210->reg + FOTG210_TX0BYTE); in fotg210_clear_tx0byte()
561 iowrite32(value, fotg210->reg + FOTG210_TX0BYTE); in fotg210_clear_tx0byte()
564 static void fotg210_clear_rx0byte(struct fotg210_udc *fotg210) in fotg210_clear_rx0byte() argument
566 u32 value = ioread32(fotg210->reg + FOTG210_RX0BYTE); in fotg210_clear_rx0byte()
570 iowrite32(value, fotg210->reg + FOTG210_RX0BYTE); in fotg210_clear_rx0byte()
574 static void fotg210_rdsetupp(struct fotg210_udc *fotg210, in fotg210_rdsetupp() argument
582 iowrite32(DMATFNR_ACC_CXF, fotg210->reg + FOTG210_DMATFNR); in fotg210_rdsetupp()
585 data = ioread32(fotg210->reg + FOTG210_CXPORT); in fotg210_rdsetupp()
595 data = ioread32(fotg210->reg + FOTG210_CXPORT); in fotg210_rdsetupp()
599 data = ioread32(fotg210->reg + FOTG210_CXPORT); in fotg210_rdsetupp()
604 data = ioread32(fotg210->reg + FOTG210_CXPORT); in fotg210_rdsetupp()
613 iowrite32(DMATFNR_DISDMA, fotg210->reg + FOTG210_DMATFNR); in fotg210_rdsetupp()
616 static void fotg210_set_configuration(struct fotg210_udc *fotg210) in fotg210_set_configuration() argument
618 u32 value = ioread32(fotg210->reg + FOTG210_DAR); in fotg210_set_configuration()
621 iowrite32(value, fotg210->reg + FOTG210_DAR); in fotg210_set_configuration()
624 static void fotg210_set_dev_addr(struct fotg210_udc *fotg210, u32 addr) in fotg210_set_dev_addr() argument
626 u32 value = ioread32(fotg210->reg + FOTG210_DAR); in fotg210_set_dev_addr()
629 iowrite32(value, fotg210->reg + FOTG210_DAR); in fotg210_set_dev_addr()
632 static void fotg210_set_cxstall(struct fotg210_udc *fotg210) in fotg210_set_cxstall() argument
634 u32 value = ioread32(fotg210->reg + FOTG210_DCFESR); in fotg210_set_cxstall()
637 iowrite32(value, fotg210->reg + FOTG210_DCFESR); in fotg210_set_cxstall()
640 static void fotg210_request_error(struct fotg210_udc *fotg210) in fotg210_request_error() argument
642 fotg210_set_cxstall(fotg210); in fotg210_request_error()
646 static void fotg210_set_address(struct fotg210_udc *fotg210, in fotg210_set_address() argument
650 fotg210_request_error(fotg210); in fotg210_set_address()
652 fotg210_set_dev_addr(fotg210, ctrl->wValue); in fotg210_set_address()
653 fotg210_set_cxdone(fotg210); in fotg210_set_address()
657 static void fotg210_set_feature(struct fotg210_udc *fotg210, in fotg210_set_feature() argument
662 fotg210_set_cxdone(fotg210); in fotg210_set_feature()
665 fotg210_set_cxdone(fotg210); in fotg210_set_feature()
671 fotg210_set_epnstall(fotg210->ep[epnum]); in fotg210_set_feature()
673 fotg210_set_cxstall(fotg210); in fotg210_set_feature()
674 fotg210_set_cxdone(fotg210); in fotg210_set_feature()
678 fotg210_request_error(fotg210); in fotg210_set_feature()
683 static void fotg210_clear_feature(struct fotg210_udc *fotg210, in fotg210_clear_feature() argument
687 fotg210->ep[ctrl->wIndex & USB_ENDPOINT_NUMBER_MASK]; in fotg210_clear_feature()
691 fotg210_set_cxdone(fotg210); in fotg210_clear_feature()
694 fotg210_set_cxdone(fotg210); in fotg210_clear_feature()
699 fotg210_set_cxdone(fotg210); in fotg210_clear_feature()
705 fotg210_set_cxdone(fotg210); in fotg210_clear_feature()
708 fotg210_request_error(fotg210); in fotg210_clear_feature()
715 struct fotg210_udc *fotg210 = ep->fotg210; in fotg210_is_epnstall() local
720 fotg210->reg + FOTG210_INEPMPSR(ep->epnum) : in fotg210_is_epnstall()
721 fotg210->reg + FOTG210_OUTEPMPSR(ep->epnum); in fotg210_is_epnstall()
726 static void fotg210_get_status(struct fotg210_udc *fotg210, in fotg210_get_status() argument
733 fotg210->ep0_data = 1 << USB_DEVICE_SELF_POWERED; in fotg210_get_status()
736 fotg210->ep0_data = 0; in fotg210_get_status()
741 fotg210->ep0_data = in fotg210_get_status()
742 fotg210_is_epnstall(fotg210->ep[epnum]) in fotg210_get_status()
745 fotg210_request_error(fotg210); in fotg210_get_status()
749 fotg210_request_error(fotg210); in fotg210_get_status()
753 fotg210->ep0_req->buf = &fotg210->ep0_data; in fotg210_get_status()
754 fotg210->ep0_req->length = 2; in fotg210_get_status()
756 spin_unlock(&fotg210->lock); in fotg210_get_status()
757 fotg210_ep_queue(fotg210->gadget.ep0, fotg210->ep0_req, GFP_KERNEL); in fotg210_get_status()
758 spin_lock(&fotg210->lock); in fotg210_get_status()
761 static int fotg210_setup_packet(struct fotg210_udc *fotg210, in fotg210_setup_packet() argument
767 fotg210_rdsetupp(fotg210, p); in fotg210_setup_packet()
769 fotg210->ep[0]->dir_in = ctrl->bRequestType & USB_DIR_IN; in fotg210_setup_packet()
771 if (fotg210->gadget.speed == USB_SPEED_UNKNOWN) { in fotg210_setup_packet()
772 u32 value = ioread32(fotg210->reg + FOTG210_DMCR); in fotg210_setup_packet()
773 fotg210->gadget.speed = value & DMCR_HS_EN ? in fotg210_setup_packet()
781 fotg210_get_status(fotg210, ctrl); in fotg210_setup_packet()
784 fotg210_clear_feature(fotg210, ctrl); in fotg210_setup_packet()
787 fotg210_set_feature(fotg210, ctrl); in fotg210_setup_packet()
790 fotg210_set_address(fotg210, ctrl); in fotg210_setup_packet()
793 fotg210_set_configuration(fotg210); in fotg210_setup_packet()
807 static void fotg210_ep0out(struct fotg210_udc *fotg210) in fotg210_ep0out() argument
809 struct fotg210_ep *ep = fotg210->ep[0]; in fotg210_ep0out()
827 static void fotg210_ep0in(struct fotg210_udc *fotg210) in fotg210_ep0in() argument
829 struct fotg210_ep *ep = fotg210->ep[0]; in fotg210_ep0in()
843 fotg210_set_cxdone(fotg210); in fotg210_ep0in()
847 static void fotg210_clear_comabt_int(struct fotg210_udc *fotg210) in fotg210_clear_comabt_int() argument
849 u32 value = ioread32(fotg210->reg + FOTG210_DISGR0); in fotg210_clear_comabt_int()
852 iowrite32(value, fotg210->reg + FOTG210_DISGR0); in fotg210_clear_comabt_int()
880 struct fotg210_udc *fotg210 = _fotg210; in fotg210_irq() local
881 u32 int_grp = ioread32(fotg210->reg + FOTG210_DIGR); in fotg210_irq()
882 u32 int_msk = ioread32(fotg210->reg + FOTG210_DMIGR); in fotg210_irq()
886 spin_lock(&fotg210->lock); in fotg210_irq()
889 void __iomem *reg = fotg210->reg + FOTG210_DISGR2; in fotg210_irq()
891 u32 int_msk2 = ioread32(fotg210->reg + FOTG210_DMISGR2); in fotg210_irq()
927 fotg210_clear_tx0byte(fotg210); in fotg210_irq()
934 fotg210_clear_rx0byte(fotg210); in fotg210_irq()
948 void __iomem *reg = fotg210->reg + FOTG210_DISGR0; in fotg210_irq()
950 u32 int_msk0 = ioread32(fotg210->reg + FOTG210_DMISGR0); in fotg210_irq()
957 fotg210_clear_comabt_int(fotg210); in fotg210_irq()
962 if (fotg210_setup_packet(fotg210, &ctrl)) { in fotg210_irq()
963 spin_unlock(&fotg210->lock); in fotg210_irq()
964 if (fotg210->driver->setup(&fotg210->gadget, in fotg210_irq()
966 fotg210_set_cxstall(fotg210); in fotg210_irq()
967 spin_lock(&fotg210->lock); in fotg210_irq()
974 fotg210_ep0in(fotg210); in fotg210_irq()
977 fotg210_ep0out(fotg210); in fotg210_irq()
980 fotg210_set_cxstall(fotg210); in fotg210_irq()
986 void __iomem *reg = fotg210->reg + FOTG210_DISGR1; in fotg210_irq()
988 u32 int_msk1 = ioread32(fotg210->reg + FOTG210_DMISGR1); in fotg210_irq()
995 fotg210_in_fifo_handler(fotg210->ep[fifo + 1]); in fotg210_irq()
999 fotg210_out_fifo_handler(fotg210->ep[fifo + 1]); in fotg210_irq()
1003 spin_unlock(&fotg210->lock); in fotg210_irq()
1008 static void fotg210_disable_unplug(struct fotg210_udc *fotg210) in fotg210_disable_unplug() argument
1010 u32 reg = ioread32(fotg210->reg + FOTG210_PHYTMSR); in fotg210_disable_unplug()
1013 iowrite32(reg, fotg210->reg + FOTG210_PHYTMSR); in fotg210_disable_unplug()
1019 struct fotg210_udc *fotg210 = gadget_to_fotg210(g); in fotg210_udc_start() local
1024 fotg210->driver = driver; in fotg210_udc_start()
1027 value = ioread32(fotg210->reg + FOTG210_DMCR); in fotg210_udc_start()
1029 iowrite32(value, fotg210->reg + FOTG210_DMCR); in fotg210_udc_start()
1034 static void fotg210_init(struct fotg210_udc *fotg210) in fotg210_init() argument
1040 fotg210->reg + FOTG210_GMIR); in fotg210_init()
1043 value = ioread32(fotg210->reg + FOTG210_DMCR); in fotg210_init()
1045 iowrite32(value, fotg210->reg + FOTG210_DMCR); in fotg210_init()
1048 iowrite32(~(u32)0, fotg210->reg + FOTG210_DMISGR1); in fotg210_init()
1051 value = ioread32(fotg210->reg + FOTG210_DMISGR0); in fotg210_init()
1053 iowrite32(value, fotg210->reg + FOTG210_DMISGR0); in fotg210_init()
1058 struct fotg210_udc *fotg210 = gadget_to_fotg210(g); in fotg210_udc_stop() local
1061 spin_lock_irqsave(&fotg210->lock, flags); in fotg210_udc_stop()
1063 fotg210_init(fotg210); in fotg210_udc_stop()
1064 fotg210->driver = NULL; in fotg210_udc_stop()
1066 spin_unlock_irqrestore(&fotg210->lock, flags); in fotg210_udc_stop()
1078 struct fotg210_udc *fotg210 = platform_get_drvdata(pdev); in fotg210_udc_remove() local
1080 usb_del_gadget_udc(&fotg210->gadget); in fotg210_udc_remove()
1081 iounmap(fotg210->reg); in fotg210_udc_remove()
1082 free_irq(platform_get_irq(pdev, 0), fotg210); in fotg210_udc_remove()
1084 fotg210_ep_free_request(&fotg210->ep[0]->ep, fotg210->ep0_req); in fotg210_udc_remove()
1085 kfree(fotg210); in fotg210_udc_remove()
1093 struct fotg210_udc *fotg210 = NULL; in fotg210_udc_probe() local
1113 fotg210 = kzalloc(sizeof(struct fotg210_udc), GFP_KERNEL); in fotg210_udc_probe()
1114 if (fotg210 == NULL) in fotg210_udc_probe()
1121 fotg210->ep[i] = _ep[i]; in fotg210_udc_probe()
1124 fotg210->reg = ioremap(res->start, resource_size(res)); in fotg210_udc_probe()
1125 if (fotg210->reg == NULL) { in fotg210_udc_probe()
1130 spin_lock_init(&fotg210->lock); in fotg210_udc_probe()
1132 platform_set_drvdata(pdev, fotg210); in fotg210_udc_probe()
1134 fotg210->gadget.ops = &fotg210_gadget_ops; in fotg210_udc_probe()
1136 fotg210->gadget.max_speed = USB_SPEED_HIGH; in fotg210_udc_probe()
1137 fotg210->gadget.dev.parent = &pdev->dev; in fotg210_udc_probe()
1138 fotg210->gadget.dev.dma_mask = pdev->dev.dma_mask; in fotg210_udc_probe()
1139 fotg210->gadget.name = udc_name; in fotg210_udc_probe()
1141 INIT_LIST_HEAD(&fotg210->gadget.ep_list); in fotg210_udc_probe()
1144 struct fotg210_ep *ep = fotg210->ep[i]; in fotg210_udc_probe()
1147 INIT_LIST_HEAD(&fotg210->ep[i]->ep.ep_list); in fotg210_udc_probe()
1148 list_add_tail(&fotg210->ep[i]->ep.ep_list, in fotg210_udc_probe()
1149 &fotg210->gadget.ep_list); in fotg210_udc_probe()
1151 ep->fotg210 = fotg210; in fotg210_udc_probe()
1157 usb_ep_set_maxpacket_limit(&fotg210->ep[0]->ep, 0x40); in fotg210_udc_probe()
1158 fotg210->gadget.ep0 = &fotg210->ep[0]->ep; in fotg210_udc_probe()
1159 INIT_LIST_HEAD(&fotg210->gadget.ep0->ep_list); in fotg210_udc_probe()
1161 fotg210->ep0_req = fotg210_ep_alloc_request(&fotg210->ep[0]->ep, in fotg210_udc_probe()
1163 if (fotg210->ep0_req == NULL) in fotg210_udc_probe()
1166 fotg210_init(fotg210); in fotg210_udc_probe()
1168 fotg210_disable_unplug(fotg210); in fotg210_udc_probe()
1171 udc_name, fotg210); in fotg210_udc_probe()
1177 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()