Lines Matching refs:base

63 #define USB_DW_EP_FIFO(base, idx)	\  argument
64 (*(uint32_t *)(POINTER_TO_UINT(base) + 0x1000 * (idx + 1)))
67 struct usb_dwc2_reg *const base; member
71 int (*pwr_on_func)(struct usb_dwc2_reg *const base);
169 .base = (struct usb_dwc2_reg *)DT_INST_REG_ADDR(n), \
185 struct usb_dwc2_reg *const base = usb_dw_cfg.base; in usb_dw_reg_dump() local
189 "0x%x", base->gotgctl, base->gotgint, base->gahbcfg); in usb_dw_reg_dump()
191 base->gusbcfg, base->gintsts, base->gintmsk); in usb_dw_reg_dump()
193 base->dcfg, base->dctl, base->dsts); in usb_dw_reg_dump()
195 base->diepmsk, base->doepmsk, base->daint); in usb_dw_reg_dump()
197 base->daintmsk, base->ghwcfg1, base->ghwcfg2); in usb_dw_reg_dump()
199 base->ghwcfg3, base->ghwcfg4); in usb_dw_reg_dump()
203 "0x%x", i, base->in_ep[i].diepctl, in usb_dw_reg_dump()
204 base->in_ep[i].diepint); in usb_dw_reg_dump()
206 "0x%x", base->in_ep[i].dieptsiz, in usb_dw_reg_dump()
207 base->in_ep[i].diepdma, in usb_dw_reg_dump()
208 base->out_ep[i].doepctl); in usb_dw_reg_dump()
210 "0x%x", base->out_ep[i].doepint, in usb_dw_reg_dump()
211 base->out_ep[i].doeptsiz, in usb_dw_reg_dump()
212 base->out_ep[i].doepdma); in usb_dw_reg_dump()
253 struct usb_dwc2_reg *const base = usb_dw_cfg.base; in usb_dw_reset() local
257 while (!(base->grstctl & USB_DWC2_GRSTCTL_AHBIDLE)) { in usb_dw_reset()
262 base->grstctl); in usb_dw_reset()
269 base->grstctl |= USB_DWC2_GRSTCTL_CSFTRST; in usb_dw_reset()
274 base->grstctl); in usb_dw_reset()
278 } while (base->grstctl & USB_DWC2_GRSTCTL_CSFTRST); in usb_dw_reset()
288 struct usb_dwc2_reg *const base = usb_dw_cfg.base; in usb_dw_num_dev_eps() local
290 return (base->ghwcfg2 >> 10) & 0xf; in usb_dw_num_dev_eps()
295 struct usb_dwc2_reg *const base = usb_dw_cfg.base; in usb_dw_flush_tx_fifo() local
298 base->grstctl = (fnum << 6) | (1<<5); in usb_dw_flush_tx_fifo()
299 while (base->grstctl & (1<<5)) { in usb_dw_flush_tx_fifo()
305 struct usb_dwc2_reg *const base = usb_dw_cfg.base; in usb_dw_tx_fifo_avail() local
307 return base->in_ep[ep].dtxfsts & USB_DWC2_DTXFSTS_INEPTXFSPCAVAIL_MASK; in usb_dw_tx_fifo_avail()
313 struct usb_dwc2_reg *const base = usb_dw_cfg.base; in usb_dw_set_fifo() local
315 volatile uint32_t *reg = &base->in_ep[ep_idx].diepctl; in usb_dw_set_fifo()
318 int ded_fifo = !!(base->ghwcfg4 & USB_DWC2_GHWCFG4_DEDFIFOMODE); in usb_dw_set_fifo()
343 reg = &base->in_ep[ep_idx].diepctl; in usb_dw_set_fifo()
362 struct usb_dwc2_reg *const base = usb_dw_cfg.base; in usb_dw_ep_set() local
369 p_depctl = &base->out_ep[ep_idx].doepctl; in usb_dw_ep_set()
372 p_depctl = &base->in_ep[ep_idx].diepctl; in usb_dw_ep_set()
448 struct usb_dwc2_reg *const base = usb_dw_cfg.base; in usb_dw_prep_rx() local
456 base->out_ep[ep_idx].doeptsiz = in usb_dw_prep_rx()
462 base->out_ep[ep_idx].doepctl |= USB_DWC2_DEPCTL_CNAK; in usb_dw_prep_rx()
465 base->out_ep[ep_idx].doepctl |= USB_DWC2_DEPCTL_EPENA; in usb_dw_prep_rx()
473 struct usb_dwc2_reg *const base = usb_dw_cfg.base; in usb_dw_tx() local
495 base->in_ep[ep_idx].dtxfsts); in usb_dw_tx()
554 base->in_ep[ep_idx].dieptsiz = in usb_dw_tx()
558 base->in_ep[ep_idx].diepctl |= (USB_DWC2_DEPCTL_EPENA | in usb_dw_tx()
583 USB_DW_EP_FIFO(base, ep_idx) = val; in usb_dw_tx()
595 struct usb_dwc2_reg *const base = usb_dw_cfg.base; in usb_dw_init() local
608 base->gusbcfg |= USB_DWC2_GUSBCFG_FORCEDEVMODE; in usb_dw_init()
613 base->gusbcfg = (base->gusbcfg & ~USB_DWC2_GUSBCFG_PHYIF_16_BIT) | in usb_dw_init()
617 base->dcfg |= USB_DWC2_DCFG_DEVSPD_USBHS20; in usb_dw_init()
620 base->dcfg |= USB_DWC2_DCFG_DEVSPD_USBFS1148; in usb_dw_init()
625 base->out_ep[ep].doepctl = USB_DWC2_DEPCTL_SNAK; in usb_dw_init()
629 base->gintmsk = USB_DWC2_GINTSTS_OEPINT | in usb_dw_init()
637 base->gahbcfg |= USB_DWC2_GAHBCFG_GLBINTRMASK; in usb_dw_init()
641 ret = usb_dw_cfg.pwr_on_func(base); in usb_dw_init()
648 base->dctl &= ~USB_DWC2_DCTL_SFTDISCON; in usb_dw_init()
657 struct usb_dwc2_reg *const base = usb_dw_cfg.base; in usb_dw_handle_reset() local
667 base->dcfg &= ~USB_DWC2_DCFG_DEVADDR_MASK; in usb_dw_handle_reset()
670 base->doepmsk = 0U; in usb_dw_handle_reset()
671 base->gintmsk |= USB_DWC2_GINTSTS_RXFLVL; in usb_dw_handle_reset()
672 base->diepmsk |= USB_DWC2_DIEPINT_XFERCOMPL; in usb_dw_handle_reset()
677 struct usb_dwc2_reg *const base = usb_dw_cfg.base; in usb_dw_handle_enum_done() local
680 speed = (base->dsts & ~USB_DWC2_DSTS_ENUMSPD_MASK) >> in usb_dw_handle_enum_done()
695 struct usb_dwc2_reg *const base = usb_dw_cfg.base; in usb_dw_int_rx_flvl_handler() local
696 uint32_t grxstsp = base->grxstsp; in usb_dw_int_rx_flvl_handler()
741 struct usb_dwc2_reg *const base = usb_dw_cfg.base; in usb_dw_int_iep_handler() local
747 if (base->daint & USB_DWC2_DAINT_INEPINT(ep_idx)) { in usb_dw_int_iep_handler()
749 ep_int_status = base->in_ep[ep_idx].diepint & in usb_dw_int_iep_handler()
750 base->diepmsk; in usb_dw_int_iep_handler()
753 base->in_ep[ep_idx].diepint = ep_int_status; in usb_dw_int_iep_handler()
770 base->gintsts = USB_DWC2_GINTSTS_IEPINT; in usb_dw_int_iep_handler()
775 struct usb_dwc2_reg *const base = usb_dw_cfg.base; in usb_dw_int_oep_handler() local
780 if (base->daint & USB_DWC2_DAINT_OUTEPINT(ep_idx)) { in usb_dw_int_oep_handler()
782 ep_int_status = base->out_ep[ep_idx].doepint & in usb_dw_int_oep_handler()
783 base->doepmsk; in usb_dw_int_oep_handler()
786 base->out_ep[ep_idx].doepint = ep_int_status; in usb_dw_int_oep_handler()
794 base->gintsts = USB_DWC2_GINTSTS_OEPINT; in usb_dw_int_oep_handler()
799 struct usb_dwc2_reg *const base = usb_dw_cfg.base; in usb_dw_isr_handler() local
805 while ((int_status = (base->gintsts & base->gintmsk))) { in usb_dw_isr_handler()
811 base->gintsts = USB_DWC2_GINTSTS_USBRST; in usb_dw_isr_handler()
819 base->gintsts = USB_DWC2_GINTSTS_ENUMDONE; in usb_dw_isr_handler()
827 base->gintsts = USB_DWC2_GINTSTS_USBSUSP; in usb_dw_isr_handler()
836 base->gintsts = USB_DWC2_GINTSTS_WKUPINT; in usb_dw_isr_handler()
897 struct usb_dwc2_reg *const base = usb_dw_cfg.base; in usb_dc_detach() local
906 base->dctl |= USB_DWC2_DCTL_SFTDISCON; in usb_dc_detach()
927 struct usb_dwc2_reg *const base = usb_dw_cfg.base; in usb_dc_set_address() local
933 base->dcfg &= ~USB_DWC2_DCFG_DEVADDR_MASK; in usb_dc_set_address()
934 base->dcfg |= addr << USB_DWC2_DCFG_DEVADDR_POS; in usb_dc_set_address()
991 struct usb_dwc2_reg *const base = usb_dw_cfg.base; in usb_dc_ep_set_stall() local
1000 base->out_ep[ep_idx].doepctl |= USB_DWC2_DEPCTL_STALL; in usb_dc_ep_set_stall()
1002 base->in_ep[ep_idx].diepctl |= USB_DWC2_DEPCTL_STALL; in usb_dc_ep_set_stall()
1010 struct usb_dwc2_reg *const base = usb_dw_cfg.base; in usb_dc_ep_clear_stall() local
1024 base->out_ep[ep_idx].doepctl &= ~USB_DWC2_DEPCTL_STALL; in usb_dc_ep_clear_stall()
1026 base->in_ep[ep_idx].diepctl &= ~USB_DWC2_DEPCTL_STALL; in usb_dc_ep_clear_stall()
1034 struct usb_dwc2_reg *const base = usb_dw_cfg.base; in usb_dc_ep_halt() local
1048 p_depctl = &base->out_ep[ep_idx].doepctl; in usb_dc_ep_halt()
1050 p_depctl = &base->in_ep[ep_idx].diepctl; in usb_dc_ep_halt()
1066 struct usb_dwc2_reg *const base = usb_dw_cfg.base; in usb_dc_ep_is_stalled() local
1080 if (base->out_ep[ep_idx].doepctl & USB_DWC2_DEPCTL_STALL) { in usb_dc_ep_is_stalled()
1084 if (base->in_ep[ep_idx].diepctl & USB_DWC2_DEPCTL_STALL) { in usb_dc_ep_is_stalled()
1094 struct usb_dwc2_reg *const base = usb_dw_cfg.base; in usb_dc_ep_enable() local
1104 base->daintmsk |= USB_DWC2_DAINT_OUTEPINT(ep_idx); in usb_dc_ep_enable()
1106 base->daintmsk |= USB_DWC2_DAINT_INEPINT(ep_idx); in usb_dc_ep_enable()
1111 base->out_ep[ep_idx].doepctl |= USB_DWC2_DEPCTL_USBACTEP; in usb_dc_ep_enable()
1114 base->in_ep[ep_idx].diepctl |= USB_DWC2_DEPCTL_USBACTEP; in usb_dc_ep_enable()
1129 struct usb_dwc2_reg *const base = usb_dw_cfg.base; in usb_dc_ep_disable() local
1139 base->daintmsk &= ~USB_DWC2_DAINT_OUTEPINT(ep_idx); in usb_dc_ep_disable()
1140 base->doepmsk &= ~USB_DWC2_DOEPINT_SETUP; in usb_dc_ep_disable()
1142 base->daintmsk &= ~USB_DWC2_DAINT_INEPINT(ep_idx); in usb_dc_ep_disable()
1143 base->diepmsk &= ~USB_DWC2_DIEPINT_XFERCOMPL; in usb_dc_ep_disable()
1144 base->gintmsk &= ~USB_DWC2_GINTSTS_RXFLVL; in usb_dc_ep_disable()
1149 base->out_ep[ep_idx].doepctl &= in usb_dc_ep_disable()
1155 base->in_ep[ep_idx].diepctl &= in usb_dc_ep_disable()
1167 struct usb_dwc2_reg *const base = usb_dw_cfg.base; in usb_dc_ep_flush() local
1182 base->grstctl |= ep_idx << USB_DWC2_GRSTCTL_TXFNUM_POS; in usb_dc_ep_flush()
1183 base->grstctl |= USB_DWC2_GRSTCTL_TXFFLSH; in usb_dc_ep_flush()
1193 } while (base->grstctl & USB_DWC2_GRSTCTL_TXFFLSH); in usb_dc_ep_flush()
1233 struct usb_dwc2_reg *const base = usb_dw_cfg.base; in usb_dc_ep_read_wait() local
1285 *(uint32_t *)(data + i) = USB_DW_EP_FIFO(base, ep_idx); in usb_dc_ep_read_wait()
1289 uint32_t last_dw = USB_DW_EP_FIFO(base, ep_idx); in usb_dc_ep_read_wait()