static int usbhsc_drvcllbck_notify_hotplug(struct platform_device *pdev) { struct usbhs_priv *priv = usbhs_pdev_to_priv(pdev); int delay = usbhs_get_dparam(priv, detection_delay); /* * This functions will be called in interrupt. * To make sure safety context, * use workqueue for usbhs_notify_hotplug */ schedule_delayed_work(&priv->notify_hotplug_work, msecs_to_jiffies(delay)); return 0; }
static int usbhs_rcar3_power_ctrl(struct platform_device *pdev, void __iomem *base, int enable) { struct usbhs_priv *priv = usbhs_pdev_to_priv(pdev); usbhs_write32(priv, UGCTRL2, UGCTRL2_RESERVED_3 | UGCTRL2_USB0SEL_OTG); if (enable) usbhs_bset(priv, LPSTS, LPSTS_SUSPM, LPSTS_SUSPM); else usbhs_bset(priv, LPSTS, LPSTS_SUSPM, 0); return 0; }
static int usbhs_remove(struct platform_device *pdev) { struct usbhs_priv *priv = usbhs_pdev_to_priv(pdev); struct renesas_usbhs_platform_info *info = dev_get_platdata(&pdev->dev); struct renesas_usbhs_driver_callback *dfunc = &info->driver_callback; dev_dbg(&pdev->dev, "usb remove\n"); dfunc->notify_hotplug = NULL; /* power off */ if (!usbhsc_flags_has(priv, USBHSF_RUNTIME_PWCTRL)) usbhsc_power_ctrl(priv, 0); pm_runtime_disable(&pdev->dev); usbhs_platform_call(priv, hardware_exit, pdev); usbhs_mod_remove(priv); usbhs_fifo_remove(priv); usbhs_pipe_remove(priv); return 0; }
/* * autonomy * * these functions are used if platform doesn't have external phy. * -> there is no "notify_hotplug" callback from platform * -> call "notify_hotplug" by itself * -> use own interrupt to connect/disconnect * -> it mean module clock is always ON * ~~~~~~~~~~~~~~~~~~~~~~~~~ */ static int usbhsm_autonomy_get_vbus(struct platform_device *pdev) { struct usbhs_priv *priv = usbhs_pdev_to_priv(pdev); return VBSTS & usbhs_read(priv, INTSTS0); }