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()
329 struct device *dev = &ep->fotg210->gadget.dev; in fotg210_start_dma()
340 length = ioread32(ep->fotg210->reg + in fotg210_start_dma()
386 u32 value = ioread32(ep->fotg210->reg + FOTG210_DMISGR0); in fotg210_ep0_queue()
389 iowrite32(value, ep->fotg210->reg + FOTG210_DMISGR0); in fotg210_ep0_queue()
404 if (ep->fotg210->gadget.speed == USB_SPEED_UNKNOWN) in fotg210_ep_queue()
407 spin_lock_irqsave(&ep->fotg210->lock, flags); in fotg210_ep_queue()
422 spin_unlock_irqrestore(&ep->fotg210->lock, flags); in fotg210_ep_queue()
436 spin_lock_irqsave(&ep->fotg210->lock, flags); in fotg210_ep_dequeue()
439 spin_unlock_irqrestore(&ep->fotg210->lock, flags); in fotg210_ep_dequeue()
446 struct fotg210_udc *fotg210 = ep->fotg210; in fotg210_set_epnstall() local
453 value = ioread32(fotg210->reg + FOTG210_DCFESR); in fotg210_set_epnstall()
458 fotg210->reg + FOTG210_INEPMPSR(ep->epnum) : in fotg210_set_epnstall()
459 fotg210->reg + FOTG210_OUTEPMPSR(ep->epnum); in fotg210_set_epnstall()
467 struct fotg210_udc *fotg210 = ep->fotg210; in fotg210_clear_epnstall() local
472 fotg210->reg + FOTG210_INEPMPSR(ep->epnum) : in fotg210_clear_epnstall()
473 fotg210->reg + FOTG210_OUTEPMPSR(ep->epnum); in fotg210_clear_epnstall()
482 struct fotg210_udc *fotg210; in fotg210_set_halt_and_wedge() local
487 fotg210 = ep->fotg210; in fotg210_set_halt_and_wedge()
489 spin_lock_irqsave(&ep->fotg210->lock, flags); in fotg210_set_halt_and_wedge()
497 fotg210_reset_tseq(fotg210, ep->epnum); in fotg210_set_halt_and_wedge()
505 spin_unlock_irqrestore(&ep->fotg210->lock, flags); in fotg210_set_halt_and_wedge()
538 static void fotg210_clear_tx0byte(struct fotg210_udc *fotg210) in fotg210_clear_tx0byte() argument
540 u32 value = ioread32(fotg210->reg + FOTG210_TX0BYTE); in fotg210_clear_tx0byte()
544 iowrite32(value, fotg210->reg + FOTG210_TX0BYTE); in fotg210_clear_tx0byte()
547 static void fotg210_clear_rx0byte(struct fotg210_udc *fotg210) in fotg210_clear_rx0byte() argument
549 u32 value = ioread32(fotg210->reg + FOTG210_RX0BYTE); in fotg210_clear_rx0byte()
553 iowrite32(value, fotg210->reg + FOTG210_RX0BYTE); in fotg210_clear_rx0byte()
557 static void fotg210_rdsetupp(struct fotg210_udc *fotg210, in fotg210_rdsetupp() argument
565 iowrite32(DMATFNR_ACC_CXF, fotg210->reg + FOTG210_DMATFNR); in fotg210_rdsetupp()
568 data = ioread32(fotg210->reg + FOTG210_CXPORT); in fotg210_rdsetupp()
578 data = ioread32(fotg210->reg + FOTG210_CXPORT); in fotg210_rdsetupp()
582 data = ioread32(fotg210->reg + FOTG210_CXPORT); in fotg210_rdsetupp()
587 data = ioread32(fotg210->reg + FOTG210_CXPORT); in fotg210_rdsetupp()
596 iowrite32(DMATFNR_DISDMA, fotg210->reg + FOTG210_DMATFNR); in fotg210_rdsetupp()
599 static void fotg210_set_configuration(struct fotg210_udc *fotg210) in fotg210_set_configuration() argument
601 u32 value = ioread32(fotg210->reg + FOTG210_DAR); in fotg210_set_configuration()
604 iowrite32(value, fotg210->reg + FOTG210_DAR); in fotg210_set_configuration()
607 static void fotg210_set_dev_addr(struct fotg210_udc *fotg210, u32 addr) in fotg210_set_dev_addr() argument
609 u32 value = ioread32(fotg210->reg + FOTG210_DAR); in fotg210_set_dev_addr()
612 iowrite32(value, fotg210->reg + FOTG210_DAR); in fotg210_set_dev_addr()
615 static void fotg210_set_cxstall(struct fotg210_udc *fotg210) in fotg210_set_cxstall() argument
617 u32 value = ioread32(fotg210->reg + FOTG210_DCFESR); in fotg210_set_cxstall()
620 iowrite32(value, fotg210->reg + FOTG210_DCFESR); in fotg210_set_cxstall()
623 static void fotg210_request_error(struct fotg210_udc *fotg210) in fotg210_request_error() argument
625 fotg210_set_cxstall(fotg210); in fotg210_request_error()
629 static void fotg210_set_address(struct fotg210_udc *fotg210, in fotg210_set_address() argument
633 fotg210_request_error(fotg210); in fotg210_set_address()
635 fotg210_set_dev_addr(fotg210, ctrl->wValue); in fotg210_set_address()
636 fotg210_set_cxdone(fotg210); in fotg210_set_address()
640 static void fotg210_set_feature(struct fotg210_udc *fotg210, in fotg210_set_feature() argument
645 fotg210_set_cxdone(fotg210); in fotg210_set_feature()
648 fotg210_set_cxdone(fotg210); in fotg210_set_feature()
654 fotg210_set_epnstall(fotg210->ep[epnum]); in fotg210_set_feature()
656 fotg210_set_cxstall(fotg210); in fotg210_set_feature()
657 fotg210_set_cxdone(fotg210); in fotg210_set_feature()
661 fotg210_request_error(fotg210); in fotg210_set_feature()
666 static void fotg210_clear_feature(struct fotg210_udc *fotg210, in fotg210_clear_feature() argument
670 fotg210->ep[ctrl->wIndex & USB_ENDPOINT_NUMBER_MASK]; in fotg210_clear_feature()
674 fotg210_set_cxdone(fotg210); in fotg210_clear_feature()
677 fotg210_set_cxdone(fotg210); in fotg210_clear_feature()
682 fotg210_set_cxdone(fotg210); in fotg210_clear_feature()
688 fotg210_set_cxdone(fotg210); in fotg210_clear_feature()
691 fotg210_request_error(fotg210); in fotg210_clear_feature()
698 struct fotg210_udc *fotg210 = ep->fotg210; in fotg210_is_epnstall() local
703 fotg210->reg + FOTG210_INEPMPSR(ep->epnum) : in fotg210_is_epnstall()
704 fotg210->reg + FOTG210_OUTEPMPSR(ep->epnum); in fotg210_is_epnstall()
709 static void fotg210_get_status(struct fotg210_udc *fotg210, in fotg210_get_status() argument
716 fotg210->ep0_data = 1 << USB_DEVICE_SELF_POWERED; in fotg210_get_status()
719 fotg210->ep0_data = 0; in fotg210_get_status()
724 fotg210->ep0_data = in fotg210_get_status()
725 fotg210_is_epnstall(fotg210->ep[epnum]) in fotg210_get_status()
728 fotg210_request_error(fotg210); in fotg210_get_status()
732 fotg210_request_error(fotg210); in fotg210_get_status()
736 fotg210->ep0_req->buf = &fotg210->ep0_data; in fotg210_get_status()
737 fotg210->ep0_req->length = 2; in fotg210_get_status()
739 spin_unlock(&fotg210->lock); in fotg210_get_status()
740 fotg210_ep_queue(fotg210->gadget.ep0, fotg210->ep0_req, GFP_ATOMIC); in fotg210_get_status()
741 spin_lock(&fotg210->lock); in fotg210_get_status()
744 static int fotg210_setup_packet(struct fotg210_udc *fotg210, in fotg210_setup_packet() argument
750 fotg210_rdsetupp(fotg210, p); in fotg210_setup_packet()
752 fotg210->ep[0]->dir_in = ctrl->bRequestType & USB_DIR_IN; in fotg210_setup_packet()
754 if (fotg210->gadget.speed == USB_SPEED_UNKNOWN) { in fotg210_setup_packet()
755 u32 value = ioread32(fotg210->reg + FOTG210_DMCR); in fotg210_setup_packet()
756 fotg210->gadget.speed = value & DMCR_HS_EN ? in fotg210_setup_packet()
764 fotg210_get_status(fotg210, ctrl); in fotg210_setup_packet()
767 fotg210_clear_feature(fotg210, ctrl); in fotg210_setup_packet()
770 fotg210_set_feature(fotg210, ctrl); in fotg210_setup_packet()
773 fotg210_set_address(fotg210, ctrl); in fotg210_setup_packet()
776 fotg210_set_configuration(fotg210); in fotg210_setup_packet()
790 static void fotg210_ep0out(struct fotg210_udc *fotg210) in fotg210_ep0out() argument
792 struct fotg210_ep *ep = fotg210->ep[0]; in fotg210_ep0out()
810 static void fotg210_ep0in(struct fotg210_udc *fotg210) in fotg210_ep0in() argument
812 struct fotg210_ep *ep = fotg210->ep[0]; in fotg210_ep0in()
826 fotg210_set_cxdone(fotg210); in fotg210_ep0in()
830 static void fotg210_clear_comabt_int(struct fotg210_udc *fotg210) in fotg210_clear_comabt_int() argument
832 u32 value = ioread32(fotg210->reg + FOTG210_DISGR0); in fotg210_clear_comabt_int()
835 iowrite32(value, fotg210->reg + FOTG210_DISGR0); in fotg210_clear_comabt_int()
852 int disgr1 = ioread32(ep->fotg210->reg + FOTG210_DISGR1); in fotg210_out_fifo_handler()
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()
1038 fotg210->reg + FOTG210_DMISGR2); in fotg210_init()
1041 iowrite32(~(u32)0, fotg210->reg + FOTG210_DMISGR1); in fotg210_init()
1044 value = ioread32(fotg210->reg + FOTG210_DMISGR0); in fotg210_init()
1046 iowrite32(value, fotg210->reg + FOTG210_DMISGR0); in fotg210_init()
1051 struct fotg210_udc *fotg210 = gadget_to_fotg210(g); in fotg210_udc_stop() local
1054 spin_lock_irqsave(&fotg210->lock, flags); in fotg210_udc_stop()
1056 fotg210_init(fotg210); in fotg210_udc_stop()
1057 fotg210->driver = NULL; in fotg210_udc_stop()
1059 spin_unlock_irqrestore(&fotg210->lock, flags); in fotg210_udc_stop()
1071 struct fotg210_udc *fotg210 = platform_get_drvdata(pdev); in fotg210_udc_remove() local
1074 usb_del_gadget_udc(&fotg210->gadget); in fotg210_udc_remove()
1075 iounmap(fotg210->reg); in fotg210_udc_remove()
1076 free_irq(platform_get_irq(pdev, 0), fotg210); in fotg210_udc_remove()
1078 fotg210_ep_free_request(&fotg210->ep[0]->ep, fotg210->ep0_req); in fotg210_udc_remove()
1080 kfree(fotg210->ep[i]); in fotg210_udc_remove()
1081 kfree(fotg210); in fotg210_udc_remove()
1089 struct fotg210_udc *fotg210 = NULL; in fotg210_udc_probe() local
1109 fotg210 = kzalloc(sizeof(struct fotg210_udc), GFP_KERNEL); in fotg210_udc_probe()
1110 if (fotg210 == NULL) in fotg210_udc_probe()
1117 fotg210->ep[i] = _ep[i]; in fotg210_udc_probe()
1120 fotg210->reg = ioremap(res->start, resource_size(res)); in fotg210_udc_probe()
1121 if (fotg210->reg == NULL) { in fotg210_udc_probe()
1126 spin_lock_init(&fotg210->lock); in fotg210_udc_probe()
1128 platform_set_drvdata(pdev, fotg210); in fotg210_udc_probe()
1130 fotg210->gadget.ops = &fotg210_gadget_ops; in fotg210_udc_probe()
1132 fotg210->gadget.max_speed = USB_SPEED_HIGH; in fotg210_udc_probe()
1133 fotg210->gadget.dev.parent = &pdev->dev; in fotg210_udc_probe()
1134 fotg210->gadget.dev.dma_mask = pdev->dev.dma_mask; in fotg210_udc_probe()
1135 fotg210->gadget.name = udc_name; in fotg210_udc_probe()
1137 INIT_LIST_HEAD(&fotg210->gadget.ep_list); in fotg210_udc_probe()
1140 struct fotg210_ep *ep = fotg210->ep[i]; in fotg210_udc_probe()
1143 INIT_LIST_HEAD(&fotg210->ep[i]->ep.ep_list); in fotg210_udc_probe()
1144 list_add_tail(&fotg210->ep[i]->ep.ep_list, in fotg210_udc_probe()
1145 &fotg210->gadget.ep_list); in fotg210_udc_probe()
1147 ep->fotg210 = fotg210; in fotg210_udc_probe()
1164 usb_ep_set_maxpacket_limit(&fotg210->ep[0]->ep, 0x40); in fotg210_udc_probe()
1165 fotg210->gadget.ep0 = &fotg210->ep[0]->ep; in fotg210_udc_probe()
1166 INIT_LIST_HEAD(&fotg210->gadget.ep0->ep_list); in fotg210_udc_probe()
1168 fotg210->ep0_req = fotg210_ep_alloc_request(&fotg210->ep[0]->ep, in fotg210_udc_probe()
1170 if (fotg210->ep0_req == NULL) in fotg210_udc_probe()
1173 fotg210_init(fotg210); in fotg210_udc_probe()
1175 fotg210_disable_unplug(fotg210); in fotg210_udc_probe()
1178 udc_name, fotg210); in fotg210_udc_probe()
1184 ret = usb_add_gadget_udc(&pdev->dev, &fotg210->gadget); in fotg210_udc_probe()
1193 free_irq(ires->start, fotg210); in fotg210_udc_probe()
1196 fotg210_ep_free_request(&fotg210->ep[0]->ep, fotg210->ep0_req); in fotg210_udc_probe()
1199 iounmap(fotg210->reg); in fotg210_udc_probe()
1203 kfree(fotg210->ep[i]); in fotg210_udc_probe()
1204 kfree(fotg210); in fotg210_udc_probe()