]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
usb: dwc3: remove pm related operations from dwc3 driver
authorKishon Vijay Abraham I <kishon@ti.com>
Mon, 23 Feb 2015 13:09:55 +0000 (18:39 +0530)
committerMarek Vasut <marex@denx.de>
Tue, 14 Apr 2015 03:48:09 +0000 (05:48 +0200)
Removed all pm related operations including pm_runtime APIs,
suspend/resume hooks as support for these are not present in u-boot.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
drivers/usb/dwc3/core.c
drivers/usb/dwc3/core.h
drivers/usb/dwc3/dwc3-omap.c
drivers/usb/dwc3/gadget.c

index b79a8b3d3160290fdf2a000be31442e61aa1df30..ebfb6ca0f25c31f0af3e76608f114cbb894bc296 100644 (file)
@@ -20,7 +20,6 @@
 #include <linux/slab.h>
 #include <linux/spinlock.h>
 #include <linux/platform_device.h>
-#include <linux/pm_runtime.h>
 #include <linux/interrupt.h>
 #include <linux/ioport.h>
 #include <linux/io.h>
@@ -884,10 +883,6 @@ static int dwc3_probe(struct platform_device *pdev)
                dma_set_coherent_mask(dev, dev->parent->coherent_dma_mask);
        }
 
-       pm_runtime_enable(dev);
-       pm_runtime_get_sync(dev);
-       pm_runtime_forbid(dev);
-
        dwc3_cache_hwparams(dwc);
 
        ret = dwc3_alloc_event_buffers(dwc, DWC3_EVENT_BUFFERS_SIZE);
@@ -937,8 +932,6 @@ static int dwc3_probe(struct platform_device *pdev)
                goto err3;
        }
 
-       pm_runtime_allow(dev);
-
        return 0;
 
 err3:
@@ -980,97 +973,9 @@ static int dwc3_remove(struct platform_device *pdev)
 
        dwc3_core_exit(dwc);
 
-       pm_runtime_put_sync(&pdev->dev);
-       pm_runtime_disable(&pdev->dev);
-
-       return 0;
-}
-
-#ifdef CONFIG_PM_SLEEP
-static int dwc3_suspend(struct device *dev)
-{
-       struct dwc3     *dwc = dev_get_drvdata(dev);
-       unsigned long   flags;
-
-       spin_lock_irqsave(&dwc->lock, flags);
-
-       switch (dwc->dr_mode) {
-       case USB_DR_MODE_PERIPHERAL:
-       case USB_DR_MODE_OTG:
-               dwc3_gadget_suspend(dwc);
-               /* FALLTHROUGH */
-       case USB_DR_MODE_HOST:
-       default:
-               dwc3_event_buffers_cleanup(dwc);
-               break;
-       }
-
-       dwc->gctl = dwc3_readl(dwc->regs, DWC3_GCTL);
-       spin_unlock_irqrestore(&dwc->lock, flags);
-
-       usb_phy_shutdown(dwc->usb3_phy);
-       usb_phy_shutdown(dwc->usb2_phy);
-       phy_exit(dwc->usb2_generic_phy);
-       phy_exit(dwc->usb3_generic_phy);
-
        return 0;
 }
 
-static int dwc3_resume(struct device *dev)
-{
-       struct dwc3     *dwc = dev_get_drvdata(dev);
-       unsigned long   flags;
-       int             ret;
-
-       usb_phy_init(dwc->usb3_phy);
-       usb_phy_init(dwc->usb2_phy);
-       ret = phy_init(dwc->usb2_generic_phy);
-       if (ret < 0)
-               return ret;
-
-       ret = phy_init(dwc->usb3_generic_phy);
-       if (ret < 0)
-               goto err_usb2phy_init;
-
-       spin_lock_irqsave(&dwc->lock, flags);
-
-       dwc3_event_buffers_setup(dwc);
-       dwc3_writel(dwc->regs, DWC3_GCTL, dwc->gctl);
-
-       switch (dwc->dr_mode) {
-       case USB_DR_MODE_PERIPHERAL:
-       case USB_DR_MODE_OTG:
-               dwc3_gadget_resume(dwc);
-               /* FALLTHROUGH */
-       case USB_DR_MODE_HOST:
-       default:
-               /* do nothing */
-               break;
-       }
-
-       spin_unlock_irqrestore(&dwc->lock, flags);
-
-       pm_runtime_disable(dev);
-       pm_runtime_set_active(dev);
-       pm_runtime_enable(dev);
-
-       return 0;
-
-err_usb2phy_init:
-       phy_exit(dwc->usb2_generic_phy);
-
-       return ret;
-}
-
-static const struct dev_pm_ops dwc3_dev_pm_ops = {
-       SET_SYSTEM_SLEEP_PM_OPS(dwc3_suspend, dwc3_resume)
-};
-
-#define DWC3_PM_OPS    &(dwc3_dev_pm_ops)
-#else
-#define DWC3_PM_OPS    NULL
-#endif
-
 #ifdef CONFIG_OF
 static const struct of_device_id of_dwc3_match[] = {
        {
@@ -1102,7 +1007,6 @@ static struct platform_driver dwc3_driver = {
                .name   = "dwc3",
                .of_match_table = of_match_ptr(of_dwc3_match),
                .acpi_match_table = ACPI_PTR(dwc3_acpi_match),
-               .pm     = DWC3_PM_OPS,
        },
 };
 
index a7a7082e52dcf427bf4073dd79c0d4b2c6db9c48..97f71ad93f1d155b448224a20c56cccbe75b3af9 100644 (file)
@@ -1012,20 +1012,4 @@ static inline int dwc3_send_gadget_generic_command(struct dwc3 *dwc,
 { return 0; }
 #endif
 
-/* power management interface */
-#if !IS_ENABLED(CONFIG_USB_DWC3_HOST)
-int dwc3_gadget_suspend(struct dwc3 *dwc);
-int dwc3_gadget_resume(struct dwc3 *dwc);
-#else
-static inline int dwc3_gadget_suspend(struct dwc3 *dwc)
-{
-       return 0;
-}
-
-static inline int dwc3_gadget_resume(struct dwc3 *dwc)
-{
-       return 0;
-}
-#endif /* !IS_ENABLED(CONFIG_USB_DWC3_HOST) */
-
 #endif /* __DRIVERS_USB_DWC3_CORE_H */
index 12b57cf8a9923b67e7e9072c9ccf19340f9b2c29..ce2d6a6a525bea0e9999435511a83dec6ce152ec 100644 (file)
@@ -20,7 +20,6 @@
 #include <linux/interrupt.h>
 #include <linux/platform_device.h>
 #include <linux/platform_data/dwc3-omap.h>
-#include <linux/pm_runtime.h>
 #include <linux/dma-mapping.h>
 #include <linux/ioport.h>
 #include <linux/io.h>
@@ -509,13 +508,6 @@ static int dwc3_omap_probe(struct platform_device *pdev)
        omap->vbus_reg  = vbus_reg;
        dev->dma_mask   = &dwc3_omap_dma_mask;
 
-       pm_runtime_enable(dev);
-       ret = pm_runtime_get_sync(dev);
-       if (ret < 0) {
-               dev_err(dev, "get_sync failed with err %d\n", ret);
-               goto err0;
-       }
-
        dwc3_omap_map_offset(omap);
        dwc3_omap_set_utmi_mode(omap);
 
@@ -528,38 +520,33 @@ static int dwc3_omap_probe(struct platform_device *pdev)
        if (ret) {
                dev_err(dev, "failed to request IRQ #%d --> %d\n",
                                omap->irq, ret);
-               goto err1;
+               goto err0;
        }
 
        dwc3_omap_enable_irqs(omap);
 
        ret = dwc3_omap_extcon_register(omap);
        if (ret < 0)
-               goto err2;
+               goto err1;
 
        ret = of_platform_populate(node, NULL, NULL, dev);
        if (ret) {
                dev_err(&pdev->dev, "failed to create dwc3 core\n");
-               goto err3;
+               goto err2;
        }
 
        return 0;
 
-err3:
+err2:
        if (omap->extcon_vbus_dev.edev)
                extcon_unregister_interest(&omap->extcon_vbus_dev);
        if (omap->extcon_id_dev.edev)
                extcon_unregister_interest(&omap->extcon_id_dev);
 
-err2:
-       dwc3_omap_disable_irqs(omap);
-
 err1:
-       pm_runtime_put_sync(dev);
+       dwc3_omap_disable_irqs(omap);
 
 err0:
-       pm_runtime_disable(dev);
-
        return ret;
 }
 
@@ -573,8 +560,6 @@ static int dwc3_omap_remove(struct platform_device *pdev)
                extcon_unregister_interest(&omap->extcon_id_dev);
        dwc3_omap_disable_irqs(omap);
        device_for_each_child(&pdev->dev, NULL, dwc3_omap_remove_core);
-       pm_runtime_put_sync(&pdev->dev);
-       pm_runtime_disable(&pdev->dev);
 
        return 0;
 }
@@ -590,48 +575,12 @@ static const struct of_device_id of_dwc3_match[] = {
 };
 MODULE_DEVICE_TABLE(of, of_dwc3_match);
 
-#ifdef CONFIG_PM_SLEEP
-static int dwc3_omap_suspend(struct device *dev)
-{
-       struct dwc3_omap        *omap = dev_get_drvdata(dev);
-
-       omap->utmi_otg_status = dwc3_omap_read_utmi_status(omap);
-       dwc3_omap_disable_irqs(omap);
-
-       return 0;
-}
-
-static int dwc3_omap_resume(struct device *dev)
-{
-       struct dwc3_omap        *omap = dev_get_drvdata(dev);
-
-       dwc3_omap_write_utmi_status(omap, omap->utmi_otg_status);
-       dwc3_omap_enable_irqs(omap);
-
-       pm_runtime_disable(dev);
-       pm_runtime_set_active(dev);
-       pm_runtime_enable(dev);
-
-       return 0;
-}
-
-static const struct dev_pm_ops dwc3_omap_dev_pm_ops = {
-
-       SET_SYSTEM_SLEEP_PM_OPS(dwc3_omap_suspend, dwc3_omap_resume)
-};
-
-#define DEV_PM_OPS     (&dwc3_omap_dev_pm_ops)
-#else
-#define DEV_PM_OPS     NULL
-#endif /* CONFIG_PM_SLEEP */
-
 static struct platform_driver dwc3_omap_driver = {
        .probe          = dwc3_omap_probe,
        .remove         = dwc3_omap_remove,
        .driver         = {
                .name   = "omap-dwc3",
                .of_match_table = of_dwc3_match,
-               .pm     = DEV_PM_OPS,
        },
 };
 
index ca0f0cd63c612bdcdeea3ffc43fadccaa8189d2e..7c932c6064d6ca8a2ccccceb6758c9fd925a51bf 100644 (file)
@@ -2748,58 +2748,3 @@ void dwc3_gadget_exit(struct dwc3 *dwc)
        dma_free_coherent(dwc->dev, sizeof(*dwc->ctrl_req),
                        dwc->ctrl_req, dwc->ctrl_req_addr);
 }
-
-int dwc3_gadget_suspend(struct dwc3 *dwc)
-{
-       if (dwc->pullups_connected) {
-               dwc3_gadget_disable_irq(dwc);
-               dwc3_gadget_run_stop(dwc, true, true);
-       }
-
-       __dwc3_gadget_ep_disable(dwc->eps[0]);
-       __dwc3_gadget_ep_disable(dwc->eps[1]);
-
-       dwc->dcfg = dwc3_readl(dwc->regs, DWC3_DCFG);
-
-       return 0;
-}
-
-int dwc3_gadget_resume(struct dwc3 *dwc)
-{
-       struct dwc3_ep          *dep;
-       int                     ret;
-
-       /* Start with SuperSpeed Default */
-       dwc3_gadget_ep0_desc.wMaxPacketSize = cpu_to_le16(512);
-
-       dep = dwc->eps[0];
-       ret = __dwc3_gadget_ep_enable(dep, &dwc3_gadget_ep0_desc, NULL, false,
-                       false);
-       if (ret)
-               goto err0;
-
-       dep = dwc->eps[1];
-       ret = __dwc3_gadget_ep_enable(dep, &dwc3_gadget_ep0_desc, NULL, false,
-                       false);
-       if (ret)
-               goto err1;
-
-       /* begin to receive SETUP packets */
-       dwc->ep0state = EP0_SETUP_PHASE;
-       dwc3_ep0_out_start(dwc);
-
-       dwc3_writel(dwc->regs, DWC3_DCFG, dwc->dcfg);
-
-       if (dwc->pullups_connected) {
-               dwc3_gadget_enable_irq(dwc);
-               dwc3_gadget_run_stop(dwc, true, false);
-       }
-
-       return 0;
-
-err1:
-       __dwc3_gadget_ep_disable(dwc->eps[0]);
-
-err0:
-       return ret;
-}