Lines Matching +full:addr +full:- +full:mode
1 // SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
3 * core.c - DesignWare HS OTG Controller common routines
5 * Copyright (C) 2004-2013 Synopsys, Inc.
18 #include <linux/dma-mapping.h>
31 * dwc2_backup_global_registers() - Backup global controller registers.
41 dev_dbg(hsotg->dev, "%s\n", __func__); in dwc2_backup_global_registers()
44 gr = &hsotg->gr_backup; in dwc2_backup_global_registers()
46 gr->gotgctl = dwc2_readl(hsotg, GOTGCTL); in dwc2_backup_global_registers()
47 gr->gintmsk = dwc2_readl(hsotg, GINTMSK); in dwc2_backup_global_registers()
48 gr->gahbcfg = dwc2_readl(hsotg, GAHBCFG); in dwc2_backup_global_registers()
49 gr->gusbcfg = dwc2_readl(hsotg, GUSBCFG); in dwc2_backup_global_registers()
50 gr->grxfsiz = dwc2_readl(hsotg, GRXFSIZ); in dwc2_backup_global_registers()
51 gr->gnptxfsiz = dwc2_readl(hsotg, GNPTXFSIZ); in dwc2_backup_global_registers()
52 gr->gdfifocfg = dwc2_readl(hsotg, GDFIFOCFG); in dwc2_backup_global_registers()
53 gr->pcgcctl1 = dwc2_readl(hsotg, PCGCCTL1); in dwc2_backup_global_registers()
54 gr->glpmcfg = dwc2_readl(hsotg, GLPMCFG); in dwc2_backup_global_registers()
55 gr->gi2cctl = dwc2_readl(hsotg, GI2CCTL); in dwc2_backup_global_registers()
56 gr->pcgcctl = dwc2_readl(hsotg, PCGCTL); in dwc2_backup_global_registers()
58 gr->valid = true; in dwc2_backup_global_registers()
63 * dwc2_restore_global_registers() - Restore controller global registers.
73 dev_dbg(hsotg->dev, "%s\n", __func__); in dwc2_restore_global_registers()
76 gr = &hsotg->gr_backup; in dwc2_restore_global_registers()
77 if (!gr->valid) { in dwc2_restore_global_registers()
78 dev_err(hsotg->dev, "%s: no global registers to restore\n", in dwc2_restore_global_registers()
80 return -EINVAL; in dwc2_restore_global_registers()
82 gr->valid = false; in dwc2_restore_global_registers()
85 dwc2_writel(hsotg, gr->gotgctl, GOTGCTL); in dwc2_restore_global_registers()
86 dwc2_writel(hsotg, gr->gintmsk, GINTMSK); in dwc2_restore_global_registers()
87 dwc2_writel(hsotg, gr->gusbcfg, GUSBCFG); in dwc2_restore_global_registers()
88 dwc2_writel(hsotg, gr->gahbcfg, GAHBCFG); in dwc2_restore_global_registers()
89 dwc2_writel(hsotg, gr->grxfsiz, GRXFSIZ); in dwc2_restore_global_registers()
90 dwc2_writel(hsotg, gr->gnptxfsiz, GNPTXFSIZ); in dwc2_restore_global_registers()
91 dwc2_writel(hsotg, gr->gdfifocfg, GDFIFOCFG); in dwc2_restore_global_registers()
92 dwc2_writel(hsotg, gr->pcgcctl1, PCGCCTL1); in dwc2_restore_global_registers()
93 dwc2_writel(hsotg, gr->glpmcfg, GLPMCFG); in dwc2_restore_global_registers()
94 dwc2_writel(hsotg, gr->pcgcctl, PCGCTL); in dwc2_restore_global_registers()
95 dwc2_writel(hsotg, gr->gi2cctl, GI2CCTL); in dwc2_restore_global_registers()
101 * dwc2_exit_partial_power_down() - Exit controller from Partial Power Down.
112 gr = &hsotg->gr_backup; in dwc2_exit_partial_power_down()
115 * Restore host or device regisers with the same mode core enterted in dwc2_exit_partial_power_down()
119 if (gr->gotgctl & GOTGCTL_CURMODE_HOST) in dwc2_exit_partial_power_down()
127 * dwc2_enter_partial_power_down() - Put controller in Partial Power Down.
140 * dwc2_restore_essential_regs() - Restore essiential regs of core.
143 * @rmode: Restore mode, enabled in case of remote-wakeup.
144 * @is_host: Host or device mode.
154 gr = &hsotg->gr_backup; in dwc2_restore_essential_regs()
155 dr = &hsotg->dr_backup; in dwc2_restore_essential_regs()
156 hr = &hsotg->hr_backup; in dwc2_restore_essential_regs()
158 dev_dbg(hsotg->dev, "%s: restoring essential regs\n", __func__); in dwc2_restore_essential_regs()
161 pcgcctl = (gr->pcgcctl & 0xffffc000); in dwc2_restore_essential_regs()
173 dwc2_writel(hsotg, gr->gahbcfg | GAHBCFG_GLBL_INTR_EN, GAHBCFG); in dwc2_restore_essential_regs()
182 dwc2_writel(hsotg, gr->gusbcfg, GUSBCFG); in dwc2_restore_essential_regs()
185 dwc2_writel(hsotg, hr->hcfg, HCFG); in dwc2_restore_essential_regs()
195 dwc2_writel(hsotg, dr->dcfg, DCFG); in dwc2_restore_essential_regs()
208 * dwc2_hib_restore_common() - Common part of restore routine.
211 * @rem_wakeup: Remote-wakeup, enabled in case of remote-wakeup.
212 * @is_host: Host or device mode.
219 /* Switch-on voltage to the core */ in dwc2_hib_restore_common()
267 dev_dbg(hsotg->dev, in dwc2_hib_restore_common()
271 dev_dbg(hsotg->dev, "restore done generated here\n"); in dwc2_hib_restore_common()
282 * dwc2_wait_for_mode() - Waits for the controller mode.
284 * @host_mode: If true, waits for host mode, otherwise device mode.
293 dev_vdbg(hsotg->dev, "Waiting for %s mode\n", in dwc2_wait_for_mode()
302 dev_vdbg(hsotg->dev, "%s mode set\n", in dwc2_wait_for_mode()
311 dev_warn(hsotg->dev, "%s: Couldn't set %s mode\n", in dwc2_wait_for_mode()
321 * dwc2_iddig_filter_enabled() - Returns true if the IDDIG debounce
355 * dwc2_enter_hibernation() - Common function to enter hibernation.
358 * @is_host: True if core is in host mode.
371 * dwc2_exit_hibernation() - Common function to exit from hibernation.
374 * @rem_wakeup: Remote-wakeup, enabled in case of remote-wakeup.
376 * @is_host: True if core is in host mode.
398 dev_vdbg(hsotg->dev, "%s()\n", __func__); in dwc2_core_reset()
401 * If the current mode is host, either due to the force mode in dwc2_core_reset()
404 * the mode to device. A delay from the IDDIG debounce filter in dwc2_core_reset()
405 * will occur before going back to host mode. in dwc2_core_reset()
407 * Determine whether we will go back into host mode after a in dwc2_core_reset()
425 if ((hsotg->hw_params.snpsid & DWC2_CORE_REV_MASK) < in dwc2_core_reset()
429 dev_warn(hsotg->dev, "%s: HANG! Soft Reset timeout GRSTCTL_CSFTRST\n", in dwc2_core_reset()
431 return -EBUSY; in dwc2_core_reset()
436 dev_warn(hsotg->dev, "%s: HANG! Soft Reset timeout GRSTCTL_CSFTRST_DONE\n", in dwc2_core_reset()
438 return -EBUSY; in dwc2_core_reset()
447 * Switching from device mode to host mode by disconnecting in dwc2_core_reset()
452 * if in host mode we disconnect the micro a to b host in dwc2_core_reset()
458 * mode. in dwc2_core_reset()
464 dev_warn(hsotg->dev, "%s: HANG! AHB Idle timeout GRSTCTL GRSTCTL_AHBIDLE\n", in dwc2_core_reset()
466 return -EBUSY; in dwc2_core_reset()
476 * dwc2_force_mode() - Force the mode of the controller.
478 * Forcing the mode is needed for two cases:
481 * controller to stay in a particular mode regardless of ID pin
486 * device mode. We may need to force the mode if the current mode does
487 * not allow us to access the register in the mode that we want.
489 * In either case it only makes sense to force the mode if the
496 * the filter is configured and enabled. We poll the current mode of
500 * @host: Host mode flag
508 dev_dbg(hsotg->dev, "Forcing mode to %s\n", host ? "host" : "device"); in dwc2_force_mode()
511 * Force mode has no effect if the hardware is not OTG. in dwc2_force_mode()
518 * need to ever force the mode to the opposite mode. in dwc2_force_mode()
520 if (WARN_ON(host && hsotg->dr_mode == USB_DR_MODE_PERIPHERAL)) in dwc2_force_mode()
523 if (WARN_ON(!host && hsotg->dr_mode == USB_DR_MODE_HOST)) in dwc2_force_mode()
540 * dwc2_clear_force_mode() - Clears the force mode bits.
545 * the force mode. We only need to call this once during probe if
557 dev_dbg(hsotg->dev, "Clearing force mode bits\n"); in dwc2_clear_force_mode()
569 * Sets or clears force mode based on the dr_mode parameter.
573 switch (hsotg->dr_mode) { in dwc2_force_dr_mode()
577 * platforms on their host-only dwc2. in dwc2_force_dr_mode()
590 dev_warn(hsotg->dev, "%s() Invalid dr_mode=%d\n", in dwc2_force_dr_mode()
591 __func__, hsotg->dr_mode); in dwc2_force_dr_mode()
597 * dwc2_enable_acg - enable active clock gating feature
601 if (hsotg->params.acg_enable) { in dwc2_enable_acg()
604 dev_dbg(hsotg->dev, "Enabling Active Clock Gating\n"); in dwc2_enable_acg()
611 * dwc2_dump_host_registers() - Prints the host registers
621 u32 __iomem *addr; in dwc2_dump_host_registers() local
624 dev_dbg(hsotg->dev, "Host Global Registers\n"); in dwc2_dump_host_registers()
625 addr = hsotg->regs + HCFG; in dwc2_dump_host_registers()
626 dev_dbg(hsotg->dev, "HCFG @0x%08lX : 0x%08X\n", in dwc2_dump_host_registers()
627 (unsigned long)addr, dwc2_readl(hsotg, HCFG)); in dwc2_dump_host_registers()
628 addr = hsotg->regs + HFIR; in dwc2_dump_host_registers()
629 dev_dbg(hsotg->dev, "HFIR @0x%08lX : 0x%08X\n", in dwc2_dump_host_registers()
630 (unsigned long)addr, dwc2_readl(hsotg, HFIR)); in dwc2_dump_host_registers()
631 addr = hsotg->regs + HFNUM; in dwc2_dump_host_registers()
632 dev_dbg(hsotg->dev, "HFNUM @0x%08lX : 0x%08X\n", in dwc2_dump_host_registers()
633 (unsigned long)addr, dwc2_readl(hsotg, HFNUM)); in dwc2_dump_host_registers()
634 addr = hsotg->regs + HPTXSTS; in dwc2_dump_host_registers()
635 dev_dbg(hsotg->dev, "HPTXSTS @0x%08lX : 0x%08X\n", in dwc2_dump_host_registers()
636 (unsigned long)addr, dwc2_readl(hsotg, HPTXSTS)); in dwc2_dump_host_registers()
637 addr = hsotg->regs + HAINT; in dwc2_dump_host_registers()
638 dev_dbg(hsotg->dev, "HAINT @0x%08lX : 0x%08X\n", in dwc2_dump_host_registers()
639 (unsigned long)addr, dwc2_readl(hsotg, HAINT)); in dwc2_dump_host_registers()
640 addr = hsotg->regs + HAINTMSK; in dwc2_dump_host_registers()
641 dev_dbg(hsotg->dev, "HAINTMSK @0x%08lX : 0x%08X\n", in dwc2_dump_host_registers()
642 (unsigned long)addr, dwc2_readl(hsotg, HAINTMSK)); in dwc2_dump_host_registers()
643 if (hsotg->params.dma_desc_enable) { in dwc2_dump_host_registers()
644 addr = hsotg->regs + HFLBADDR; in dwc2_dump_host_registers()
645 dev_dbg(hsotg->dev, "HFLBADDR @0x%08lX : 0x%08X\n", in dwc2_dump_host_registers()
646 (unsigned long)addr, dwc2_readl(hsotg, HFLBADDR)); in dwc2_dump_host_registers()
649 addr = hsotg->regs + HPRT0; in dwc2_dump_host_registers()
650 dev_dbg(hsotg->dev, "HPRT0 @0x%08lX : 0x%08X\n", in dwc2_dump_host_registers()
651 (unsigned long)addr, dwc2_readl(hsotg, HPRT0)); in dwc2_dump_host_registers()
653 for (i = 0; i < hsotg->params.host_channels; i++) { in dwc2_dump_host_registers()
654 dev_dbg(hsotg->dev, "Host Channel %d Specific Registers\n", i); in dwc2_dump_host_registers()
655 addr = hsotg->regs + HCCHAR(i); in dwc2_dump_host_registers()
656 dev_dbg(hsotg->dev, "HCCHAR @0x%08lX : 0x%08X\n", in dwc2_dump_host_registers()
657 (unsigned long)addr, dwc2_readl(hsotg, HCCHAR(i))); in dwc2_dump_host_registers()
658 addr = hsotg->regs + HCSPLT(i); in dwc2_dump_host_registers()
659 dev_dbg(hsotg->dev, "HCSPLT @0x%08lX : 0x%08X\n", in dwc2_dump_host_registers()
660 (unsigned long)addr, dwc2_readl(hsotg, HCSPLT(i))); in dwc2_dump_host_registers()
661 addr = hsotg->regs + HCINT(i); in dwc2_dump_host_registers()
662 dev_dbg(hsotg->dev, "HCINT @0x%08lX : 0x%08X\n", in dwc2_dump_host_registers()
663 (unsigned long)addr, dwc2_readl(hsotg, HCINT(i))); in dwc2_dump_host_registers()
664 addr = hsotg->regs + HCINTMSK(i); in dwc2_dump_host_registers()
665 dev_dbg(hsotg->dev, "HCINTMSK @0x%08lX : 0x%08X\n", in dwc2_dump_host_registers()
666 (unsigned long)addr, dwc2_readl(hsotg, HCINTMSK(i))); in dwc2_dump_host_registers()
667 addr = hsotg->regs + HCTSIZ(i); in dwc2_dump_host_registers()
668 dev_dbg(hsotg->dev, "HCTSIZ @0x%08lX : 0x%08X\n", in dwc2_dump_host_registers()
669 (unsigned long)addr, dwc2_readl(hsotg, HCTSIZ(i))); in dwc2_dump_host_registers()
670 addr = hsotg->regs + HCDMA(i); in dwc2_dump_host_registers()
671 dev_dbg(hsotg->dev, "HCDMA @0x%08lX : 0x%08X\n", in dwc2_dump_host_registers()
672 (unsigned long)addr, dwc2_readl(hsotg, HCDMA(i))); in dwc2_dump_host_registers()
673 if (hsotg->params.dma_desc_enable) { in dwc2_dump_host_registers()
674 addr = hsotg->regs + HCDMAB(i); in dwc2_dump_host_registers()
675 dev_dbg(hsotg->dev, "HCDMAB @0x%08lX : 0x%08X\n", in dwc2_dump_host_registers()
676 (unsigned long)addr, dwc2_readl(hsotg, in dwc2_dump_host_registers()
684 * dwc2_dump_global_registers() - Prints the core global registers
694 u32 __iomem *addr; in dwc2_dump_global_registers() local
696 dev_dbg(hsotg->dev, "Core Global Registers\n"); in dwc2_dump_global_registers()
697 addr = hsotg->regs + GOTGCTL; in dwc2_dump_global_registers()
698 dev_dbg(hsotg->dev, "GOTGCTL @0x%08lX : 0x%08X\n", in dwc2_dump_global_registers()
699 (unsigned long)addr, dwc2_readl(hsotg, GOTGCTL)); in dwc2_dump_global_registers()
700 addr = hsotg->regs + GOTGINT; in dwc2_dump_global_registers()
701 dev_dbg(hsotg->dev, "GOTGINT @0x%08lX : 0x%08X\n", in dwc2_dump_global_registers()
702 (unsigned long)addr, dwc2_readl(hsotg, GOTGINT)); in dwc2_dump_global_registers()
703 addr = hsotg->regs + GAHBCFG; in dwc2_dump_global_registers()
704 dev_dbg(hsotg->dev, "GAHBCFG @0x%08lX : 0x%08X\n", in dwc2_dump_global_registers()
705 (unsigned long)addr, dwc2_readl(hsotg, GAHBCFG)); in dwc2_dump_global_registers()
706 addr = hsotg->regs + GUSBCFG; in dwc2_dump_global_registers()
707 dev_dbg(hsotg->dev, "GUSBCFG @0x%08lX : 0x%08X\n", in dwc2_dump_global_registers()
708 (unsigned long)addr, dwc2_readl(hsotg, GUSBCFG)); in dwc2_dump_global_registers()
709 addr = hsotg->regs + GRSTCTL; in dwc2_dump_global_registers()
710 dev_dbg(hsotg->dev, "GRSTCTL @0x%08lX : 0x%08X\n", in dwc2_dump_global_registers()
711 (unsigned long)addr, dwc2_readl(hsotg, GRSTCTL)); in dwc2_dump_global_registers()
712 addr = hsotg->regs + GINTSTS; in dwc2_dump_global_registers()
713 dev_dbg(hsotg->dev, "GINTSTS @0x%08lX : 0x%08X\n", in dwc2_dump_global_registers()
714 (unsigned long)addr, dwc2_readl(hsotg, GINTSTS)); in dwc2_dump_global_registers()
715 addr = hsotg->regs + GINTMSK; in dwc2_dump_global_registers()
716 dev_dbg(hsotg->dev, "GINTMSK @0x%08lX : 0x%08X\n", in dwc2_dump_global_registers()
717 (unsigned long)addr, dwc2_readl(hsotg, GINTMSK)); in dwc2_dump_global_registers()
718 addr = hsotg->regs + GRXSTSR; in dwc2_dump_global_registers()
719 dev_dbg(hsotg->dev, "GRXSTSR @0x%08lX : 0x%08X\n", in dwc2_dump_global_registers()
720 (unsigned long)addr, dwc2_readl(hsotg, GRXSTSR)); in dwc2_dump_global_registers()
721 addr = hsotg->regs + GRXFSIZ; in dwc2_dump_global_registers()
722 dev_dbg(hsotg->dev, "GRXFSIZ @0x%08lX : 0x%08X\n", in dwc2_dump_global_registers()
723 (unsigned long)addr, dwc2_readl(hsotg, GRXFSIZ)); in dwc2_dump_global_registers()
724 addr = hsotg->regs + GNPTXFSIZ; in dwc2_dump_global_registers()
725 dev_dbg(hsotg->dev, "GNPTXFSIZ @0x%08lX : 0x%08X\n", in dwc2_dump_global_registers()
726 (unsigned long)addr, dwc2_readl(hsotg, GNPTXFSIZ)); in dwc2_dump_global_registers()
727 addr = hsotg->regs + GNPTXSTS; in dwc2_dump_global_registers()
728 dev_dbg(hsotg->dev, "GNPTXSTS @0x%08lX : 0x%08X\n", in dwc2_dump_global_registers()
729 (unsigned long)addr, dwc2_readl(hsotg, GNPTXSTS)); in dwc2_dump_global_registers()
730 addr = hsotg->regs + GI2CCTL; in dwc2_dump_global_registers()
731 dev_dbg(hsotg->dev, "GI2CCTL @0x%08lX : 0x%08X\n", in dwc2_dump_global_registers()
732 (unsigned long)addr, dwc2_readl(hsotg, GI2CCTL)); in dwc2_dump_global_registers()
733 addr = hsotg->regs + GPVNDCTL; in dwc2_dump_global_registers()
734 dev_dbg(hsotg->dev, "GPVNDCTL @0x%08lX : 0x%08X\n", in dwc2_dump_global_registers()
735 (unsigned long)addr, dwc2_readl(hsotg, GPVNDCTL)); in dwc2_dump_global_registers()
736 addr = hsotg->regs + GGPIO; in dwc2_dump_global_registers()
737 dev_dbg(hsotg->dev, "GGPIO @0x%08lX : 0x%08X\n", in dwc2_dump_global_registers()
738 (unsigned long)addr, dwc2_readl(hsotg, GGPIO)); in dwc2_dump_global_registers()
739 addr = hsotg->regs + GUID; in dwc2_dump_global_registers()
740 dev_dbg(hsotg->dev, "GUID @0x%08lX : 0x%08X\n", in dwc2_dump_global_registers()
741 (unsigned long)addr, dwc2_readl(hsotg, GUID)); in dwc2_dump_global_registers()
742 addr = hsotg->regs + GSNPSID; in dwc2_dump_global_registers()
743 dev_dbg(hsotg->dev, "GSNPSID @0x%08lX : 0x%08X\n", in dwc2_dump_global_registers()
744 (unsigned long)addr, dwc2_readl(hsotg, GSNPSID)); in dwc2_dump_global_registers()
745 addr = hsotg->regs + GHWCFG1; in dwc2_dump_global_registers()
746 dev_dbg(hsotg->dev, "GHWCFG1 @0x%08lX : 0x%08X\n", in dwc2_dump_global_registers()
747 (unsigned long)addr, dwc2_readl(hsotg, GHWCFG1)); in dwc2_dump_global_registers()
748 addr = hsotg->regs + GHWCFG2; in dwc2_dump_global_registers()
749 dev_dbg(hsotg->dev, "GHWCFG2 @0x%08lX : 0x%08X\n", in dwc2_dump_global_registers()
750 (unsigned long)addr, dwc2_readl(hsotg, GHWCFG2)); in dwc2_dump_global_registers()
751 addr = hsotg->regs + GHWCFG3; in dwc2_dump_global_registers()
752 dev_dbg(hsotg->dev, "GHWCFG3 @0x%08lX : 0x%08X\n", in dwc2_dump_global_registers()
753 (unsigned long)addr, dwc2_readl(hsotg, GHWCFG3)); in dwc2_dump_global_registers()
754 addr = hsotg->regs + GHWCFG4; in dwc2_dump_global_registers()
755 dev_dbg(hsotg->dev, "GHWCFG4 @0x%08lX : 0x%08X\n", in dwc2_dump_global_registers()
756 (unsigned long)addr, dwc2_readl(hsotg, GHWCFG4)); in dwc2_dump_global_registers()
757 addr = hsotg->regs + GLPMCFG; in dwc2_dump_global_registers()
758 dev_dbg(hsotg->dev, "GLPMCFG @0x%08lX : 0x%08X\n", in dwc2_dump_global_registers()
759 (unsigned long)addr, dwc2_readl(hsotg, GLPMCFG)); in dwc2_dump_global_registers()
760 addr = hsotg->regs + GPWRDN; in dwc2_dump_global_registers()
761 dev_dbg(hsotg->dev, "GPWRDN @0x%08lX : 0x%08X\n", in dwc2_dump_global_registers()
762 (unsigned long)addr, dwc2_readl(hsotg, GPWRDN)); in dwc2_dump_global_registers()
763 addr = hsotg->regs + GDFIFOCFG; in dwc2_dump_global_registers()
764 dev_dbg(hsotg->dev, "GDFIFOCFG @0x%08lX : 0x%08X\n", in dwc2_dump_global_registers()
765 (unsigned long)addr, dwc2_readl(hsotg, GDFIFOCFG)); in dwc2_dump_global_registers()
766 addr = hsotg->regs + HPTXFSIZ; in dwc2_dump_global_registers()
767 dev_dbg(hsotg->dev, "HPTXFSIZ @0x%08lX : 0x%08X\n", in dwc2_dump_global_registers()
768 (unsigned long)addr, dwc2_readl(hsotg, HPTXFSIZ)); in dwc2_dump_global_registers()
770 addr = hsotg->regs + PCGCTL; in dwc2_dump_global_registers()
771 dev_dbg(hsotg->dev, "PCGCTL @0x%08lX : 0x%08X\n", in dwc2_dump_global_registers()
772 (unsigned long)addr, dwc2_readl(hsotg, PCGCTL)); in dwc2_dump_global_registers()
777 * dwc2_flush_tx_fifo() - Flushes a Tx FIFO
786 dev_vdbg(hsotg->dev, "Flush Tx FIFO %d\n", num); in dwc2_flush_tx_fifo()
790 dev_warn(hsotg->dev, "%s: HANG! AHB Idle GRSCTL\n", in dwc2_flush_tx_fifo()
798 dev_warn(hsotg->dev, "%s: HANG! timeout GRSTCTL GRSTCTL_TXFFLSH\n", in dwc2_flush_tx_fifo()
806 * dwc2_flush_rx_fifo() - Flushes the Rx FIFO
814 dev_vdbg(hsotg->dev, "%s()\n", __func__); in dwc2_flush_rx_fifo()
818 dev_warn(hsotg->dev, "%s: HANG! AHB Idle GRSCTL\n", in dwc2_flush_rx_fifo()
826 dev_warn(hsotg->dev, "%s: HANG! timeout GRSTCTL GRSTCTL_RXFFLSH\n", in dwc2_flush_rx_fifo()
842 * dwc2_enable_global_interrupts() - Enables the controller's Global
856 * dwc2_disable_global_interrupts() - Disables the controller's Global
888 /* Returns true if the controller is host-only. */
897 /* Returns true if the controller is device-only. */
907 * dwc2_hsotg_wait_bit_set - Waits for bit to be set.
913 * Return: 0 if bit/bits are set or -ETIMEDOUT in case of timeout.
926 return -ETIMEDOUT; in dwc2_hsotg_wait_bit_set()
930 * dwc2_hsotg_wait_bit_clear - Waits for bit to be clear.
936 * Return: 0 if bit/bits are set or -ETIMEDOUT in case of timeout.
949 return -ETIMEDOUT; in dwc2_hsotg_wait_bit_clear()
960 if ((hsotg->hw_params.hs_phy_type == GHWCFG2_HS_PHY_TYPE_ULPI && in dwc2_init_fs_ls_pclk_sel()
961 hsotg->hw_params.fs_phy_type == GHWCFG2_FS_PHY_TYPE_DEDICATED && in dwc2_init_fs_ls_pclk_sel()
962 hsotg->params.ulpi_fs_ls) || in dwc2_init_fs_ls_pclk_sel()
963 hsotg->params.phy_type == DWC2_PHY_TYPE_PARAM_FS) { in dwc2_init_fs_ls_pclk_sel()
971 dev_dbg(hsotg->dev, "Initializing HCFG.FSLSPClkSel to %08x\n", val); in dwc2_init_fs_ls_pclk_sel()
988 dev_dbg(hsotg->dev, "FS PHY selected\n"); in dwc2_fs_phy_init()
999 dev_err(hsotg->dev, in dwc2_fs_phy_init()
1005 if (hsotg->params.activate_stm_fs_transceiver) { in dwc2_fs_phy_init()
1008 dev_dbg(hsotg->dev, "Activating transceiver\n"); in dwc2_fs_phy_init()
1021 * do this on HNP Dev/Host mode switches (done in dev_init and in dwc2_fs_phy_init()
1027 if (hsotg->params.i2c_enable) { in dwc2_fs_phy_init()
1028 dev_dbg(hsotg->dev, "FS PHY enabling I2C\n"); in dwc2_fs_phy_init()
1064 switch (hsotg->params.phy_type) { in dwc2_hs_phy_init()
1067 dev_dbg(hsotg->dev, "HS ULPI PHY selected\n"); in dwc2_hs_phy_init()
1070 if (hsotg->params.phy_ulpi_ddr) in dwc2_hs_phy_init()
1074 if (hsotg->params.oc_disable) in dwc2_hs_phy_init()
1080 dev_dbg(hsotg->dev, "HS UTMI+ PHY selected\n"); in dwc2_hs_phy_init()
1082 if (hsotg->params.phy_utmi_width == 16) in dwc2_hs_phy_init()
1086 dev_err(hsotg->dev, "FS PHY selected at HS!\n"); in dwc2_hs_phy_init()
1096 dev_err(hsotg->dev, in dwc2_hs_phy_init()
1109 if (hsotg->params.phy_type != DWC2_PHY_TYPE_PARAM_UTMI) in dwc2_set_turnaround_time()
1115 if (hsotg->params.phy_utmi_width == 16) in dwc2_set_turnaround_time()
1129 if ((hsotg->params.speed == DWC2_SPEED_PARAM_FULL || in dwc2_phy_init()
1130 hsotg->params.speed == DWC2_SPEED_PARAM_LOW) && in dwc2_phy_init()
1131 hsotg->params.phy_type == DWC2_PHY_TYPE_PARAM_FS) { in dwc2_phy_init()
1132 /* If FS/LS mode with FS/LS PHY */ in dwc2_phy_init()
1146 if (hsotg->hw_params.hs_phy_type == GHWCFG2_HS_PHY_TYPE_ULPI && in dwc2_phy_init()
1147 hsotg->hw_params.fs_phy_type == GHWCFG2_FS_PHY_TYPE_DEDICATED && in dwc2_phy_init()
1148 hsotg->params.ulpi_fs_ls) { in dwc2_phy_init()
1149 dev_dbg(hsotg->dev, "Setting ULPI FSLS\n"); in dwc2_phy_init()
1161 if (!hsotg->params.activate_ingenic_overcurrent_detection) { in dwc2_phy_init()
1163 otgctl = readl(hsotg->regs + GOTGCTL); in dwc2_phy_init()
1165 writel(otgctl, hsotg->regs + GOTGCTL); in dwc2_phy_init()