static void usb_dev_complete(struct device *dev) { /* Currently used only for rebinding interfaces */ printk("usb_dev_complete+\n"); usb_resume(dev, PMSG_ON); /* FIXME: change to PMSG_COMPLETE */ printk("usb_dev_complete-\n"); }
static int usb_dev_resume(struct device *dev) { struct usb_device *udev = to_usb_device(dev); if (udev && udev->quirks & USB_QUIRK_NO_DPM_RESUME) return 0; return usb_resume(dev, PMSG_RESUME); }
static int usb_dev_resume(struct device *dev) { #if defined(CONFIG_LINK_DEVICE_HSIC) || defined(CONFIG_MDM_HSIC_PM) struct usb_device *udev = to_usb_device(dev); if (udev && udev->quirks & USB_QUIRK_NO_DPM_RESUME) return 0; #endif return usb_resume(dev, PMSG_RESUME); }
static int usb_dev_resume(struct device *dev) { #if defined(CONFIG_LINK_DEVICE_HSIC) struct usb_device *udev = to_usb_device(dev); if (udev && udev->quirks & USB_QUIRK_NO_DPM_RESUME) return 0; /* EHCI root-hub resume later */ if (udev && udev->serial && !strcmp("s5p-ehci", udev->serial)) return 0; #endif return usb_resume(dev, PMSG_RESUME); }
static int usb_dev_resume(struct device *dev) { #ifndef CONFIG_LTE_MODEM_SHANNON #if defined(CONFIG_LINK_DEVICE_HSIC) || defined(CONFIG_MDM_HSIC_PM) struct usb_device *udev = to_usb_device(dev); struct device *pdev = dev->parent; if (udev && udev->quirks & USB_QUIRK_NO_DPM_RESUME) return 0; /* EHCI root-hub resume later */ if (pdev && !strcmp("s5p-ehci", pdev->driver->name)) return 0; #endif #endif return usb_resume(dev, PMSG_RESUME); }
static void usb_dev_complete(struct device *dev) { /* Currently used only for rebinding interfaces */ usb_resume(dev); /* Implement eventually? */ }
static int usb_dev_restore(struct device *dev) { return usb_resume(dev, PMSG_RESTORE); }
void platform_isr_usb (void) { /// Check if the setup interrupt is pending. We need to check it before other /// interrupts, to work around that the Setup Int has lower priority then Input /// Endpoint 0 //ot_u8 bWakeUp = FALSE; if (USBIFG & SETUPIFG) { //bWakeUp = usbisr_setuppkt(); usbisr_setuppkt(); USBIFG &= ~SETUPIFG; // clear the interrupt bit } switch (__even_in_range(USBVECINT, USBVECINT_OUTPUT_ENDPOINT7)) { case USBVECINT_NONE: break; case USBVECINT_PWR_DROP: //__no_operation(); break; case USBVECINT_PLL_LOCK: break; case USBVECINT_PLL_SIGNAL: break; # if (USBEVT_MASK & USBEVT_CLOCKFAULT) case USBVECINT_PLL_RANGE: usbevt_pllerror(); break; # endif case USBVECINT_PWR_VBUSOn: usbisr_vbuson(); # if (USBEVT_MASK & USBEVT_VBUSON) usbevt_vbuson(); # endif break; case USBVECINT_PWR_VBUSOff: usbisr_vbusoff(); # if (USBEVT_MASK & USBEVT_VBUSOFF) usbevt_vbusoff(); # endif break; case USBVECINT_USB_TIMESTAMP: break; case USBVECINT_INPUT_ENDPOINT0: usbisr_ep0in(); break; case USBVECINT_OUTPUT_ENDPOINT0: //bWakeUp = usbisr_ep0out(); usbisr_ep0out(); break; case USBVECINT_RSTR: usb_reset(); # if (USBEVT_MASK & USBEVT_RESET) usbevt_reset(); # endif break; case USBVECINT_SUSR: usb_suspend(); # if (USBEVT_MASK & USBEVT_SUSPEND) usbevt_suspend(); # endif break; case USBVECINT_RESR: usb_resume(); # if (USBEVT_MASK & USBEVT_RESUME) usbevt_resume(); # endif //bWakeUp = TRUE; //Always wake on resume break; case USBVECINT_SETUP_PACKET_RECEIVED: // NAK both IEP and OEP enpoints dblock_ep0.bIEPBCNT = EPBCNT_NAK; dblock_ep0.bOEPBCNT = EPBCNT_NAK; //bWakeUp = usbisr_setuppkt(); usbisr_setuppkt(); break; case USBVECINT_STPOW_PACKET_RECEIVED: break; case USBVECINT_INPUT_ENDPOINT1: break; case USBVECINT_INPUT_ENDPOINT2: //bWakeUp = CdcToHostFromBuffer(CDC0_INTFNUM); usbcdc_transfer_buf2host(CDC0_INTFNUM); break; case USBVECINT_INPUT_ENDPOINT3: break; case USBVECINT_INPUT_ENDPOINT4: break; case USBVECINT_INPUT_ENDPOINT5: break; case USBVECINT_INPUT_ENDPOINT6: break; case USBVECINT_INPUT_ENDPOINT7: break; case USBVECINT_OUTPUT_ENDPOINT1: break; case USBVECINT_OUTPUT_ENDPOINT2: //bWakeUp = CdcToBufferFromHost(CDC0_INTFNUM); usbcdc_transfer_host2buf(CDC0_INTFNUM); break; case USBVECINT_OUTPUT_ENDPOINT3: break; case USBVECINT_OUTPUT_ENDPOINT4: break; case USBVECINT_OUTPUT_ENDPOINT5: break; case USBVECINT_OUTPUT_ENDPOINT6: break; case USBVECINT_OUTPUT_ENDPOINT7: break; default: break; } //return bWakeUp; }
static void usb_dev_complete(struct device *dev) { /* Currently used only for rebinding interfaces */ usb_resume(dev, PMSG_ON); }
static void usb_dev_complete(struct device *dev) { /* Currently used only for rebinding interfaces */ usb_resume(dev, PMSG_RESUME); /* Message event is meaningless */ }
static int usb_dev_resume(struct device *dev) { MYDBG(""); return usb_resume(dev, PMSG_RESUME); }
static int ehci_fsl_drv_resume(struct platform_device *pdev) { struct usb_hcd *hcd = platform_get_drvdata(pdev); struct ehci_hcd *ehci = hcd_to_ehci(hcd); struct usb_device *roothub = hcd->self.root_hub; u32 tmp; struct fsl_usb2_platform_data *pdata = pdev->dev.platform_data; struct fsl_usb2_wakeup_platform_data *wake_up_pdata = pdata->wakeup_pdata; /* Only handles OTG mode switch event */ printk(KERN_DEBUG "ehci fsl drv resume begins: %s\n", pdata->name); if (pdata->pmflags == 0) { printk(KERN_DEBUG "%s,pm event, wait for wakeup irq if needed\n", __func__); wait_event_interruptible(wake_up_pdata->wq, !wake_up_pdata->usb_wakeup_is_pending); if (!host_can_wakeup_system(pdev)) { if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) { fsl_usb_clk_gate(hcd->self.controller->platform_data, true); } usb_host_set_wakeup(hcd->self.controller, true); if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) { fsl_usb_clk_gate(hcd->self.controller->platform_data, false); } } return 0; } if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) { set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); fsl_usb_clk_gate(hcd->self.controller->platform_data, true); usb_host_set_wakeup(hcd->self.controller, false); fsl_usb_lowpower_mode(pdata, false); } /* set host mode */ fsl_platform_set_host_mode(hcd); /* restore EHCI registers */ ehci_writel(ehci, pdata->pm_portsc, &ehci->regs->port_status[0]); ehci_writel(ehci, pdata->pm_command, &ehci->regs->command); ehci_writel(ehci, pdata->pm_intr_enable, &ehci->regs->intr_enable); ehci_writel(ehci, pdata->pm_frame_index, &ehci->regs->frame_index); ehci_writel(ehci, pdata->pm_segment, &ehci->regs->segment); ehci_writel(ehci, pdata->pm_frame_list, &ehci->regs->frame_list); ehci_writel(ehci, pdata->pm_async_next, &ehci->regs->async_next); ehci_writel(ehci, pdata->pm_configured_flag, &ehci->regs->configured_flag); tmp = ehci_readl(ehci, &ehci->regs->command); tmp |= CMD_RUN; ehci_writel(ehci, tmp, &ehci->regs->command); if ((hcd->state & HC_STATE_SUSPENDED)) { printk(KERN_DEBUG "will resume roothub and its children\n"); usb_lock_device(roothub); usb_resume(&roothub->dev, PMSG_USER_RESUME); usb_unlock_device(roothub); } pdata->pmflags = 0; printk(KERN_DEBUG "ehci fsl drv resume ends: %s\n", pdata->name); return 0; }
/* These routines rely on the bus (pci, platform, etc) * to handle powerdown and wakeup, and currently also on * transceivers that don't need any software attention to set up * the right sort of wakeup. * * They're also used for turning on/off the port when doing OTG. */ static int ehci_fsl_drv_suspend(struct platform_device *pdev, pm_message_t message) { struct usb_hcd *hcd = platform_get_drvdata(pdev); struct ehci_hcd *ehci = hcd_to_ehci(hcd); struct usb_device *roothub = hcd->self.root_hub; u32 port_status; struct fsl_usb2_platform_data *pdata = pdev->dev.platform_data; printk(KERN_DEBUG "USB Host suspend begins\n"); /* Only handles OTG mode switch event, system suspend event will be done in bus suspend */ if (pdata->pmflags == 0) { printk(KERN_DEBUG "%s, pm event \n", __func__); if (!host_can_wakeup_system(pdev)) { int mask; /* Need open clock for register access */ if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) fsl_usb_clk_gate(hcd->self.controller->platform_data, true); mask = ehci_readl(ehci, &ehci->regs->intr_enable); mask &= ~STS_PCD; ehci_writel(ehci, mask, &ehci->regs->intr_enable); usb_host_set_wakeup(hcd->self.controller, false); fsl_usb_clk_gate(hcd->self.controller->platform_data, false); } return 0; } /* only the otg host can go here */ /* wait for all usb device on the hcd dettached */ usb_lock_device(roothub); if (roothub->children[0] != NULL) { int old = hcd->self.is_b_host; printk(KERN_DEBUG "will resume roothub and its children\n"); hcd->self.is_b_host = 0; /* resume the roothub, so that it can test the children is disconnected */ if (roothub->state == USB_STATE_SUSPENDED) usb_resume(&roothub->dev, PMSG_USER_SUSPEND); /* we must do unlock here, the hubd thread will hold the same lock * here release the lock, so that the hubd thread can process the usb * disconnect event and set the children[0] be NULL, or there will be * a deadlock */ usb_unlock_device(roothub); while (roothub->children[0] != NULL) msleep(1); usb_lock_device(roothub); hcd->self.is_b_host = old; } usb_unlock_device(roothub); if (!(hcd->state & HC_STATE_SUSPENDED)) { printk(KERN_DEBUG "will suspend roothub and its children\n"); usb_lock_device(roothub); usb_suspend(&roothub->dev, PMSG_USER_SUSPEND); usb_unlock_device(roothub); } if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) { fsl_usb_clk_gate(hcd->self.controller->platform_data, true); set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); } port_status = ehci_readl(ehci, &ehci->regs->port_status[0]); /* save EHCI registers */ pdata->pm_command = ehci_readl(ehci, &ehci->regs->command); pdata->pm_command &= ~CMD_RUN; pdata->pm_status = ehci_readl(ehci, &ehci->regs->status); pdata->pm_intr_enable = ehci_readl(ehci, &ehci->regs->intr_enable); pdata->pm_frame_index = ehci_readl(ehci, &ehci->regs->frame_index); pdata->pm_segment = ehci_readl(ehci, &ehci->regs->segment); pdata->pm_frame_list = ehci_readl(ehci, &ehci->regs->frame_list); pdata->pm_async_next = ehci_readl(ehci, &ehci->regs->async_next); pdata->pm_configured_flag = ehci_readl(ehci, &ehci->regs->configured_flag); pdata->pm_portsc = ehci_readl(ehci, &ehci->regs->port_status[0]); /* clear the W1C bits */ pdata->pm_portsc &= cpu_to_hc32(ehci, ~PORT_RWC_BITS); /* clear PHCD bit */ pdata->pm_portsc &= ~PORT_PTS_PHCD; usb_host_set_wakeup(hcd->self.controller, true); fsl_usb_lowpower_mode(pdata, true); if (test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) { clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); fsl_usb_clk_gate(hcd->self.controller->platform_data, false); } pdata->pmflags = 0; printk(KERN_DEBUG "host suspend ends\n"); return 0; }
static void usb_dev_complete(struct device *dev) { usb_resume(dev, PMSG_RESUME); }
static int usb_dev_thaw(struct device *dev) { return usb_resume(dev); }
static int usb_dev_restore(struct device *dev) { return usb_resume(dev); }
void __irq_usb_lp_can_rx0(void) { if (CAN1->enabled) { can_rx_irq_handler(); return; } uint16 istr = USB_BASE->ISTR; /* Use USB_ISR_MSK to only include code for bits we care about. */ #if (USB_ISR_MSK & USB_ISTR_RESET) if (istr & USB_ISTR_RESET & USBLIB->irq_mask) { USB_BASE->ISTR = ~USB_ISTR_RESET; pProperty->Reset(); } #endif #if (USB_ISR_MSK & USB_ISTR_PMAOVR) if (istr & ISTR_PMAOVR & USBLIB->irq_mask) { USB_BASE->ISTR = ~USB_ISTR_PMAOVR; } #endif #if (USB_ISR_MSK & USB_ISTR_ERR) if (istr & USB_ISTR_ERR & USBLIB->irq_mask) { USB_BASE->ISTR = ~USB_ISTR_ERR; } #endif #if (USB_ISR_MSK & USB_ISTR_WKUP) if (istr & USB_ISTR_WKUP & USBLIB->irq_mask) { USB_BASE->ISTR = ~USB_ISTR_WKUP; usb_resume(RESUME_EXTERNAL); } #endif #if (USB_ISR_MSK & USB_ISTR_SUSP) if (istr & USB_ISTR_SUSP & USBLIB->irq_mask) { /* check if SUSPEND is possible */ if (SUSPEND_ENABLED) { usb_suspend(); } else { /* if not possible then resume after xx ms */ usb_resume(RESUME_LATER); } /* clear of the ISTR bit must be done after setting of CNTR_FSUSP */ USB_BASE->ISTR = ~USB_ISTR_SUSP; } #endif #if (USB_ISR_MSK & USB_ISTR_SOF) if (istr & USB_ISTR_SOF & USBLIB->irq_mask) { USB_BASE->ISTR = ~USB_ISTR_SOF; } #endif #if (USB_ISR_MSK & USB_ISTR_ESOF) if (istr & USB_ISTR_ESOF & USBLIB->irq_mask) { USB_BASE->ISTR = ~USB_ISTR_ESOF; /* resume handling timing is made with ESOFs */ usb_resume(RESUME_ESOF); /* request without change of the machine state */ } #endif /* * Service the correct transfer interrupt. */ #if (USB_ISR_MSK & USB_ISTR_CTR) if (istr & USB_ISTR_CTR & USBLIB->irq_mask) { dispatch_ctr_lp(); } #endif }