Lines Matching refs:fotg210

30 	u32 value = ioread32(ep->fotg210->reg + FOTG210_DMISGR1);  in fotg210_disable_fifo_int()
36 iowrite32(value, ep->fotg210->reg + FOTG210_DMISGR1); in fotg210_disable_fifo_int()
41 u32 value = ioread32(ep->fotg210->reg + FOTG210_DMISGR1); in fotg210_enable_fifo_int()
47 iowrite32(value, ep->fotg210->reg + FOTG210_DMISGR1); in fotg210_enable_fifo_int()
50 static void fotg210_set_cxdone(struct fotg210_udc *fotg210) in fotg210_set_cxdone() argument
52 u32 value = ioread32(fotg210->reg + FOTG210_DCFESR); in fotg210_set_cxdone()
55 iowrite32(value, fotg210->reg + FOTG210_DCFESR); in fotg210_set_cxdone()
64 if (ep->fotg210->gadget.speed == USB_SPEED_UNKNOWN) in fotg210_done()
69 spin_unlock(&ep->fotg210->lock); in fotg210_done()
71 spin_lock(&ep->fotg210->lock); in fotg210_done()
77 fotg210_set_cxdone(ep->fotg210); in fotg210_done()
84 struct fotg210_udc *fotg210 = ep->fotg210; in fotg210_fifo_ep_mapping() local
92 val = ioread32(fotg210->reg + FOTG210_EPMAP); in fotg210_fifo_ep_mapping()
95 iowrite32(val, fotg210->reg + FOTG210_EPMAP); in fotg210_fifo_ep_mapping()
98 val = ioread32(fotg210->reg + FOTG210_FIFOMAP); in fotg210_fifo_ep_mapping()
101 iowrite32(val, fotg210->reg + FOTG210_FIFOMAP); in fotg210_fifo_ep_mapping()
104 val = ioread32(fotg210->reg + FOTG210_FIFOCF); in fotg210_fifo_ep_mapping()
106 iowrite32(val, fotg210->reg + FOTG210_FIFOCF); in fotg210_fifo_ep_mapping()
111 struct fotg210_udc *fotg210 = ep->fotg210; in fotg210_set_fifo_dir() local
114 val = ioread32(fotg210->reg + FOTG210_FIFOMAP); in fotg210_set_fifo_dir()
116 iowrite32(val, fotg210->reg + FOTG210_FIFOMAP); in fotg210_set_fifo_dir()
121 struct fotg210_udc *fotg210 = ep->fotg210; in fotg210_set_tfrtype() local
124 val = ioread32(fotg210->reg + FOTG210_FIFOCF); in fotg210_set_tfrtype()
126 iowrite32(val, fotg210->reg + FOTG210_FIFOCF); in fotg210_set_tfrtype()
132 struct fotg210_udc *fotg210 = ep->fotg210; in fotg210_set_mps() local
137 val = ioread32(fotg210->reg + offset); in fotg210_set_mps()
139 iowrite32(val, fotg210->reg + offset); in fotg210_set_mps()
145 struct fotg210_udc *fotg210 = ep->fotg210; in fotg210_config_ep() local
152 fotg210->ep[ep->epnum] = ep; in fotg210_config_ep()
173 static void fotg210_reset_tseq(struct fotg210_udc *fotg210, u8 epnum) in fotg210_reset_tseq() argument
175 struct fotg210_ep *ep = fotg210->ep[epnum]; in fotg210_reset_tseq()
180 fotg210->reg + FOTG210_INEPMPSR(epnum) : in fotg210_reset_tseq()
181 fotg210->reg + FOTG210_OUTEPMPSR(epnum); in fotg210_reset_tseq()
204 fotg210_reset_tseq(ep->fotg210, ep->epnum); in fotg210_ep_release()
222 spin_lock_irqsave(&ep->fotg210->lock, flags); in fotg210_ep_disable()
224 spin_unlock_irqrestore(&ep->fotg210->lock, flags); in fotg210_ep_disable()
257 struct fotg210_udc *fotg210 = ep->fotg210; in fotg210_enable_dma() local
260 value = ioread32(fotg210->reg + FOTG210_DMACPSR1); in fotg210_enable_dma()
263 iowrite32(value, fotg210->reg + FOTG210_DMACPSR1); in fotg210_enable_dma()
266 value = ioread32(fotg210->reg + FOTG210_DMATFNR); in fotg210_enable_dma()
271 iowrite32(value, fotg210->reg + FOTG210_DMATFNR); in fotg210_enable_dma()
274 iowrite32(d, fotg210->reg + FOTG210_DMACPSR2); in fotg210_enable_dma()
277 value = ioread32(fotg210->reg + FOTG210_DMISGR2); in fotg210_enable_dma()
279 iowrite32(value, fotg210->reg + FOTG210_DMISGR2); in fotg210_enable_dma()
282 value = ioread32(fotg210->reg + FOTG210_DMACPSR1); in fotg210_enable_dma()
284 iowrite32(value, fotg210->reg + FOTG210_DMACPSR1); in fotg210_enable_dma()
289 iowrite32(DMATFNR_DISDMA, ep->fotg210->reg + FOTG210_DMATFNR); in fotg210_disable_dma()
297 value = ioread32(ep->fotg210->reg + FOTG210_DISGR2); in fotg210_wait_dma_done()
304 iowrite32(value, ep->fotg210->reg + FOTG210_DISGR2); in fotg210_wait_dma_done()
308 value = ioread32(ep->fotg210->reg + FOTG210_DMACPSR1); in fotg210_wait_dma_done()
310 iowrite32(value, ep->fotg210->reg + FOTG210_DMACPSR1); in fotg210_wait_dma_done()
314 value = ioread32(ep->fotg210->reg + in fotg210_wait_dma_done()
317 iowrite32(value, ep->fotg210->reg + in fotg210_wait_dma_done()
320 value = ioread32(ep->fotg210->reg + FOTG210_DCFESR); in fotg210_wait_dma_done()
322 iowrite32(value, ep->fotg210->reg + FOTG210_DCFESR); in fotg210_wait_dma_done()
339 length = ioread32(ep->fotg210->reg + in fotg210_start_dma()
389 u32 value = ioread32(ep->fotg210->reg + FOTG210_DMISGR0); in fotg210_ep0_queue()
392 iowrite32(value, ep->fotg210->reg + FOTG210_DMISGR0); in fotg210_ep0_queue()
407 if (ep->fotg210->gadget.speed == USB_SPEED_UNKNOWN) in fotg210_ep_queue()
410 spin_lock_irqsave(&ep->fotg210->lock, flags); in fotg210_ep_queue()
425 spin_unlock_irqrestore(&ep->fotg210->lock, flags); in fotg210_ep_queue()
439 spin_lock_irqsave(&ep->fotg210->lock, flags); in fotg210_ep_dequeue()
442 spin_unlock_irqrestore(&ep->fotg210->lock, flags); in fotg210_ep_dequeue()
449 struct fotg210_udc *fotg210 = ep->fotg210; in fotg210_set_epnstall() local
456 value = ioread32(fotg210->reg + FOTG210_DCFESR); in fotg210_set_epnstall()
461 fotg210->reg + FOTG210_INEPMPSR(ep->epnum) : in fotg210_set_epnstall()
462 fotg210->reg + FOTG210_OUTEPMPSR(ep->epnum); in fotg210_set_epnstall()
470 struct fotg210_udc *fotg210 = ep->fotg210; in fotg210_clear_epnstall() local
475 fotg210->reg + FOTG210_INEPMPSR(ep->epnum) : in fotg210_clear_epnstall()
476 fotg210->reg + FOTG210_OUTEPMPSR(ep->epnum); in fotg210_clear_epnstall()
485 struct fotg210_udc *fotg210; in fotg210_set_halt_and_wedge() local
491 fotg210 = ep->fotg210; in fotg210_set_halt_and_wedge()
493 spin_lock_irqsave(&ep->fotg210->lock, flags); in fotg210_set_halt_and_wedge()
501 fotg210_reset_tseq(fotg210, ep->epnum); in fotg210_set_halt_and_wedge()
509 spin_unlock_irqrestore(&ep->fotg210->lock, flags); in fotg210_set_halt_and_wedge()
542 static void fotg210_clear_tx0byte(struct fotg210_udc *fotg210) in fotg210_clear_tx0byte() argument
544 u32 value = ioread32(fotg210->reg + FOTG210_TX0BYTE); in fotg210_clear_tx0byte()
548 iowrite32(value, fotg210->reg + FOTG210_TX0BYTE); in fotg210_clear_tx0byte()
551 static void fotg210_clear_rx0byte(struct fotg210_udc *fotg210) in fotg210_clear_rx0byte() argument
553 u32 value = ioread32(fotg210->reg + FOTG210_RX0BYTE); in fotg210_clear_rx0byte()
557 iowrite32(value, fotg210->reg + FOTG210_RX0BYTE); in fotg210_clear_rx0byte()
561 static void fotg210_rdsetupp(struct fotg210_udc *fotg210, in fotg210_rdsetupp() argument
569 iowrite32(DMATFNR_ACC_CXF, fotg210->reg + FOTG210_DMATFNR); in fotg210_rdsetupp()
572 data = ioread32(fotg210->reg + FOTG210_CXPORT); in fotg210_rdsetupp()
582 data = ioread32(fotg210->reg + FOTG210_CXPORT); in fotg210_rdsetupp()
586 data = ioread32(fotg210->reg + FOTG210_CXPORT); in fotg210_rdsetupp()
591 data = ioread32(fotg210->reg + FOTG210_CXPORT); in fotg210_rdsetupp()
600 iowrite32(DMATFNR_DISDMA, fotg210->reg + FOTG210_DMATFNR); in fotg210_rdsetupp()
603 static void fotg210_set_configuration(struct fotg210_udc *fotg210) in fotg210_set_configuration() argument
605 u32 value = ioread32(fotg210->reg + FOTG210_DAR); in fotg210_set_configuration()
608 iowrite32(value, fotg210->reg + FOTG210_DAR); in fotg210_set_configuration()
611 static void fotg210_set_dev_addr(struct fotg210_udc *fotg210, u32 addr) in fotg210_set_dev_addr() argument
613 u32 value = ioread32(fotg210->reg + FOTG210_DAR); in fotg210_set_dev_addr()
616 iowrite32(value, fotg210->reg + FOTG210_DAR); in fotg210_set_dev_addr()
619 static void fotg210_set_cxstall(struct fotg210_udc *fotg210) in fotg210_set_cxstall() argument
621 u32 value = ioread32(fotg210->reg + FOTG210_DCFESR); in fotg210_set_cxstall()
624 iowrite32(value, fotg210->reg + FOTG210_DCFESR); in fotg210_set_cxstall()
627 static void fotg210_request_error(struct fotg210_udc *fotg210) in fotg210_request_error() argument
629 fotg210_set_cxstall(fotg210); in fotg210_request_error()
633 static void fotg210_set_address(struct fotg210_udc *fotg210, in fotg210_set_address() argument
637 fotg210_request_error(fotg210); in fotg210_set_address()
639 fotg210_set_dev_addr(fotg210, ctrl->wValue); in fotg210_set_address()
640 fotg210_set_cxdone(fotg210); in fotg210_set_address()
644 static void fotg210_set_feature(struct fotg210_udc *fotg210, in fotg210_set_feature() argument
649 fotg210_set_cxdone(fotg210); in fotg210_set_feature()
652 fotg210_set_cxdone(fotg210); in fotg210_set_feature()
658 fotg210_set_epnstall(fotg210->ep[epnum]); in fotg210_set_feature()
660 fotg210_set_cxstall(fotg210); in fotg210_set_feature()
661 fotg210_set_cxdone(fotg210); in fotg210_set_feature()
665 fotg210_request_error(fotg210); in fotg210_set_feature()
670 static void fotg210_clear_feature(struct fotg210_udc *fotg210, in fotg210_clear_feature() argument
674 fotg210->ep[ctrl->wIndex & USB_ENDPOINT_NUMBER_MASK]; in fotg210_clear_feature()
678 fotg210_set_cxdone(fotg210); in fotg210_clear_feature()
681 fotg210_set_cxdone(fotg210); in fotg210_clear_feature()
686 fotg210_set_cxdone(fotg210); in fotg210_clear_feature()
692 fotg210_set_cxdone(fotg210); in fotg210_clear_feature()
695 fotg210_request_error(fotg210); in fotg210_clear_feature()
702 struct fotg210_udc *fotg210 = ep->fotg210; in fotg210_is_epnstall() local
707 fotg210->reg + FOTG210_INEPMPSR(ep->epnum) : in fotg210_is_epnstall()
708 fotg210->reg + FOTG210_OUTEPMPSR(ep->epnum); in fotg210_is_epnstall()
713 static void fotg210_get_status(struct fotg210_udc *fotg210, in fotg210_get_status() argument
720 fotg210->ep0_data = 1 << USB_DEVICE_SELF_POWERED; in fotg210_get_status()
723 fotg210->ep0_data = 0; in fotg210_get_status()
728 fotg210->ep0_data = in fotg210_get_status()
729 fotg210_is_epnstall(fotg210->ep[epnum]) in fotg210_get_status()
732 fotg210_request_error(fotg210); in fotg210_get_status()
736 fotg210_request_error(fotg210); in fotg210_get_status()
740 fotg210->ep0_req->buf = &fotg210->ep0_data; in fotg210_get_status()
741 fotg210->ep0_req->length = 2; in fotg210_get_status()
743 spin_unlock(&fotg210->lock); in fotg210_get_status()
744 fotg210_ep_queue(fotg210->gadget.ep0, fotg210->ep0_req, GFP_KERNEL); in fotg210_get_status()
745 spin_lock(&fotg210->lock); in fotg210_get_status()
748 static int fotg210_setup_packet(struct fotg210_udc *fotg210, in fotg210_setup_packet() argument
754 fotg210_rdsetupp(fotg210, p); in fotg210_setup_packet()
756 fotg210->ep[0]->dir_in = ctrl->bRequestType & USB_DIR_IN; in fotg210_setup_packet()
758 if (fotg210->gadget.speed == USB_SPEED_UNKNOWN) { in fotg210_setup_packet()
759 u32 value = ioread32(fotg210->reg + FOTG210_DMCR); in fotg210_setup_packet()
760 fotg210->gadget.speed = value & DMCR_HS_EN ? in fotg210_setup_packet()
768 fotg210_get_status(fotg210, ctrl); in fotg210_setup_packet()
771 fotg210_clear_feature(fotg210, ctrl); in fotg210_setup_packet()
774 fotg210_set_feature(fotg210, ctrl); in fotg210_setup_packet()
777 fotg210_set_address(fotg210, ctrl); in fotg210_setup_packet()
780 fotg210_set_configuration(fotg210); in fotg210_setup_packet()
794 static void fotg210_ep0out(struct fotg210_udc *fotg210) in fotg210_ep0out() argument
796 struct fotg210_ep *ep = fotg210->ep[0]; in fotg210_ep0out()
814 static void fotg210_ep0in(struct fotg210_udc *fotg210) in fotg210_ep0in() argument
816 struct fotg210_ep *ep = fotg210->ep[0]; in fotg210_ep0in()
830 fotg210_set_cxdone(fotg210); in fotg210_ep0in()
834 static void fotg210_clear_comabt_int(struct fotg210_udc *fotg210) in fotg210_clear_comabt_int() argument
836 u32 value = ioread32(fotg210->reg + FOTG210_DISGR0); in fotg210_clear_comabt_int()
839 iowrite32(value, fotg210->reg + FOTG210_DISGR0); in fotg210_clear_comabt_int()
867 struct fotg210_udc *fotg210 = _fotg210; in fotg210_irq() local
868 u32 int_grp = ioread32(fotg210->reg + FOTG210_DIGR); in fotg210_irq()
869 u32 int_msk = ioread32(fotg210->reg + FOTG210_DMIGR); in fotg210_irq()
873 spin_lock(&fotg210->lock); in fotg210_irq()
876 void __iomem *reg = fotg210->reg + FOTG210_DISGR2; in fotg210_irq()
878 u32 int_msk2 = ioread32(fotg210->reg + FOTG210_DMISGR2); in fotg210_irq()
914 fotg210_clear_tx0byte(fotg210); in fotg210_irq()
921 fotg210_clear_rx0byte(fotg210); in fotg210_irq()
935 void __iomem *reg = fotg210->reg + FOTG210_DISGR0; in fotg210_irq()
937 u32 int_msk0 = ioread32(fotg210->reg + FOTG210_DMISGR0); in fotg210_irq()
944 fotg210_clear_comabt_int(fotg210); in fotg210_irq()
949 if (fotg210_setup_packet(fotg210, &ctrl)) { in fotg210_irq()
950 spin_unlock(&fotg210->lock); in fotg210_irq()
951 if (fotg210->driver->setup(&fotg210->gadget, in fotg210_irq()
953 fotg210_set_cxstall(fotg210); in fotg210_irq()
954 spin_lock(&fotg210->lock); in fotg210_irq()
961 fotg210_ep0in(fotg210); in fotg210_irq()
964 fotg210_ep0out(fotg210); in fotg210_irq()
967 fotg210_set_cxstall(fotg210); in fotg210_irq()
973 void __iomem *reg = fotg210->reg + FOTG210_DISGR1; in fotg210_irq()
975 u32 int_msk1 = ioread32(fotg210->reg + FOTG210_DMISGR1); in fotg210_irq()
982 fotg210_in_fifo_handler(fotg210->ep[fifo + 1]); in fotg210_irq()
986 fotg210_out_fifo_handler(fotg210->ep[fifo + 1]); in fotg210_irq()
990 spin_unlock(&fotg210->lock); in fotg210_irq()
995 static void fotg210_disable_unplug(struct fotg210_udc *fotg210) in fotg210_disable_unplug() argument
997 u32 reg = ioread32(fotg210->reg + FOTG210_PHYTMSR); in fotg210_disable_unplug()
1000 iowrite32(reg, fotg210->reg + FOTG210_PHYTMSR); in fotg210_disable_unplug()
1006 struct fotg210_udc *fotg210 = gadget_to_fotg210(g); in fotg210_udc_start() local
1011 fotg210->driver = driver; in fotg210_udc_start()
1014 value = ioread32(fotg210->reg + FOTG210_DMCR); in fotg210_udc_start()
1016 iowrite32(value, fotg210->reg + FOTG210_DMCR); in fotg210_udc_start()
1021 static void fotg210_init(struct fotg210_udc *fotg210) in fotg210_init() argument
1027 fotg210->reg + FOTG210_GMIR); in fotg210_init()
1030 value = ioread32(fotg210->reg + FOTG210_DMCR); in fotg210_init()
1032 iowrite32(value, fotg210->reg + FOTG210_DMCR); in fotg210_init()
1035 iowrite32(~(u32)0, fotg210->reg + FOTG210_DMISGR1); in fotg210_init()
1038 value = ioread32(fotg210->reg + FOTG210_DMISGR0); in fotg210_init()
1040 iowrite32(value, fotg210->reg + FOTG210_DMISGR0); in fotg210_init()
1045 struct fotg210_udc *fotg210 = gadget_to_fotg210(g); in fotg210_udc_stop() local
1048 spin_lock_irqsave(&fotg210->lock, flags); in fotg210_udc_stop()
1050 fotg210_init(fotg210); in fotg210_udc_stop()
1051 fotg210->driver = NULL; in fotg210_udc_stop()
1053 spin_unlock_irqrestore(&fotg210->lock, flags); in fotg210_udc_stop()
1065 struct fotg210_udc *fotg210 = platform_get_drvdata(pdev); in fotg210_udc_remove() local
1068 usb_del_gadget_udc(&fotg210->gadget); in fotg210_udc_remove()
1069 iounmap(fotg210->reg); in fotg210_udc_remove()
1070 free_irq(platform_get_irq(pdev, 0), fotg210); in fotg210_udc_remove()
1072 fotg210_ep_free_request(&fotg210->ep[0]->ep, fotg210->ep0_req); in fotg210_udc_remove()
1074 kfree(fotg210->ep[i]); 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 iounmap(fotg210->reg); in fotg210_udc_probe()
1197 kfree(fotg210->ep[i]); in fotg210_udc_probe()
1198 kfree(fotg210); in fotg210_udc_probe()