From: mglocker Date: Thu, 8 Sep 2022 19:02:04 +0000 (+0000) Subject: Zap inactive gadget functions. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=c1954c240b51eed5775f68a9fb3c3c9b9be4adcf;p=openbsd Zap inactive gadget functions. --- diff --git a/sys/dev/usb/dwc2/dwc2_core.c b/sys/dev/usb/dwc2/dwc2_core.c index f2eb065930c..3d9ae459c73 100644 --- a/sys/dev/usb/dwc2/dwc2_core.c +++ b/sys/dev/usb/dwc2/dwc2_core.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dwc2_core.c,v 1.12 2022/09/04 08:42:39 mglocker Exp $ */ +/* $OpenBSD: dwc2_core.c,v 1.13 2022/09/08 19:02:04 mglocker Exp $ */ /* $NetBSD: dwc2_core.c,v 1.6 2014/04/03 06:34:58 skrll Exp $ */ /* @@ -1205,124 +1205,3 @@ STATIC int dwc2_phy_init(struct dwc2_hsotg *hsotg, bool select_phy) return retval; } - -/*** gadget.c *****************************************************************/ -#if 0 -/** - * dwc2_backup_device_registers() - Backup controller device registers. - * When suspending usb bus, registers needs to be backuped - * if controller power is disabled once suspended. - * - * @hsotg: Programming view of the DWC_otg controller - */ -int dwc2_backup_device_registers(struct dwc2_hsotg *hsotg) -{ - struct dwc2_dregs_backup *dr; - int i; - - dev_dbg(hsotg->dev, "%s\n", __func__); - - /* Backup dev regs */ - dr = &hsotg->dr_backup; - - dr->dcfg = dwc2_readl(hsotg, DCFG); - dr->dctl = dwc2_readl(hsotg, DCTL); - dr->daintmsk = dwc2_readl(hsotg, DAINTMSK); - dr->diepmsk = dwc2_readl(hsotg, DIEPMSK); - dr->doepmsk = dwc2_readl(hsotg, DOEPMSK); - - for (i = 0; i < hsotg->num_of_eps; i++) { - /* Backup IN EPs */ - dr->diepctl[i] = dwc2_readl(hsotg, DIEPCTL(i)); - - /* Ensure DATA PID is correctly configured */ - if (dr->diepctl[i] & DXEPCTL_DPID) - dr->diepctl[i] |= DXEPCTL_SETD1PID; - else - dr->diepctl[i] |= DXEPCTL_SETD0PID; - - dr->dieptsiz[i] = dwc2_readl(hsotg, DIEPTSIZ(i)); - dr->diepdma[i] = dwc2_readl(hsotg, DIEPDMA(i)); - - /* Backup OUT EPs */ - dr->doepctl[i] = dwc2_readl(hsotg, DOEPCTL(i)); - - /* Ensure DATA PID is correctly configured */ - if (dr->doepctl[i] & DXEPCTL_DPID) - dr->doepctl[i] |= DXEPCTL_SETD1PID; - else - dr->doepctl[i] |= DXEPCTL_SETD0PID; - - dr->doeptsiz[i] = dwc2_readl(hsotg, DOEPTSIZ(i)); - dr->doepdma[i] = dwc2_readl(hsotg, DOEPDMA(i)); - } - dr->valid = true; - return 0; -} - -/** - * dwc2_restore_device_registers() - Restore controller device registers. - * When resuming usb bus, device registers needs to be restored - * if controller power were disabled. - * - * @hsotg: Programming view of the DWC_otg controller - * @remote_wakeup: Indicates whether resume is initiated by Device or Host. - * - * Return: 0 if successful, negative error code otherwise - */ -STATIC int dwc2_restore_device_registers(struct dwc2_hsotg *hsotg) -{ - struct dwc2_dregs_backup *dr; - u32 dctl; - int i; - - dev_dbg(hsotg->dev, "%s\n", __func__); - - /* Restore dev regs */ - dr = &hsotg->dr_backup; - if (!dr->valid) { - dev_err(hsotg->dev, "%s: no device registers to restore\n", - __func__); - return -EINVAL; - } - dr->valid = false; - - if (!remote_wakeup) - dwc2_writel(hsotg, dr->dctl, DCTL); - - dwc2_writel(hsotg, dr->daintmsk, DAINTMSK); - dwc2_writel(hsotg, dr->diepmsk, DIEPMSK); - dwc2_writel(hsotg, dr->doepmsk, DOEPMSK); - - for (i = 0; i < hsotg->num_of_eps; i++) { - /* Restore IN EPs */ - dwc2_writel(hsotg, dr->dieptsiz[i], DIEPTSIZ(i)); - dwc2_writel(hsotg, dr->diepdma[i], DIEPDMA(i)); - dwc2_writel(hsotg, dr->doeptsiz[i], DOEPTSIZ(i)); - /** WA for enabled EPx's IN in DDMA mode. On entering to - * hibernation wrong value read and saved from DIEPDMAx, - * as result BNA interrupt asserted on hibernation exit - * by restoring from saved area. - */ - if (hsotg->params.g_dma_desc && - (dr->diepctl[i] & DXEPCTL_EPENA)) - dr->diepdma[i] = hsotg->eps_in[i]->desc_list_dma; - dwc2_writel(hsotg, dr->dtxfsiz[i], DPTXFSIZN(i)); - dwc2_writel(hsotg, dr->diepctl[i], DIEPCTL(i)); - /* Restore OUT EPs */ - dwc2_writel(hsotg, dr->doeptsiz[i], DOEPTSIZ(i)); - /* WA for enabled EPx's OUT in DDMA mode. On entering to - * hibernation wrong value read and saved from DOEPDMAx, - * as result BNA interrupt asserted on hibernation exit - * by restoring from saved area. - */ - if (hsotg->params.g_dma_desc && - (dr->doepctl[i] & DXEPCTL_EPENA)) - dr->doepdma[i] = hsotg->eps_out[i]->desc_list_dma; - dwc2_writel(hsotg, dr->doepdma[i], DOEPDMA(i)); - dwc2_writel(hsotg, dr->doepctl[i], DOEPCTL(i)); - } - - return 0; -} -#endif