linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
To: Bin Liu <b-liu-l0cyMroinI0@public.gmane.org>
Cc: Felipe Balbi <balbi-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	George Cherian <george.cherian-l0cyMroinI0@public.gmane.org>,
	linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH 06/10] usb: musb: Split PM runtime between wrapper IP and musb core
Date: Thu, 28 Apr 2016 10:33:16 -0700	[thread overview]
Message-ID: <1461864800-29979-7-git-send-email-tony@atomide.com> (raw)
In-Reply-To: <1461864800-29979-1-git-send-email-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>

Let's not tinker with the PM runtime of musb core from the omap2430
wrapper. This allows us to initialize PM runtime for musb core later
on instead of doing it in stages. And omap2430 wrapper has no need
to for accessing musb core at this point.

Note that this does not remove all the PM runtime calls from the
glue layer, those will get removed in a later patch.

Signed-off-by: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
---
 drivers/usb/musb/musb_core.c | 25 ++++++++++---------------
 drivers/usb/musb/omap2430.c  | 10 ----------
 2 files changed, 10 insertions(+), 25 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 90ccdb2..b492316 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -2005,11 +2005,6 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
 	musb_readl = musb_default_readl;
 	musb_writel = musb_default_writel;
 
-	/* We need musb_read/write functions initialized for PM */
-	pm_runtime_use_autosuspend(musb->controller);
-	pm_runtime_set_autosuspend_delay(musb->controller, 500);
-	pm_runtime_enable(musb->controller);
-
 	/* The musb_platform_init() call:
 	 *   - adjusts musb->mregs
 	 *   - sets the musb->isr
@@ -2111,6 +2106,10 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
 	if (musb->ops->phy_callback)
 		musb_phy_callback = musb->ops->phy_callback;
 
+	/* We need musb_read/write functions initialized for PM */
+	pm_runtime_use_autosuspend(musb->controller);
+	pm_runtime_set_autosuspend_delay(musb->controller, 500);
+	pm_runtime_enable(musb->controller);
 	pm_runtime_get_sync(musb->controller);
 
 	status = usb_phy_init(musb->xceiv);
@@ -2300,6 +2299,9 @@ static int musb_remove(struct platform_device *pdev)
 	 */
 	musb_exit_debugfs(musb);
 
+	cancel_work_sync(&musb->irq_work);
+	cancel_delayed_work_sync(&musb->finish_resume_work);
+	cancel_delayed_work_sync(&musb->deassert_reset_work);
 	pm_runtime_get_sync(musb->controller);
 	musb_host_cleanup(musb);
 	musb_gadget_cleanup(musb);
@@ -2308,21 +2310,14 @@ static int musb_remove(struct platform_device *pdev)
 	musb_generic_disable(musb);
 	spin_unlock_irqrestore(&musb->lock, flags);
 	musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
+	pm_runtime_dont_use_autosuspend(musb->controller);
+	pm_runtime_put_sync(musb->controller);
+	pm_runtime_disable(musb->controller);
 	musb_platform_exit(musb);
-
 	musb_phy_callback = NULL;
-
 	if (musb->dma_controller)
 		musb_dma_controller_destroy(musb->dma_controller);
-
 	usb_phy_shutdown(musb->xceiv);
-
-	cancel_work_sync(&musb->irq_work);
-	cancel_delayed_work_sync(&musb->finish_resume_work);
-	cancel_delayed_work_sync(&musb->deassert_reset_work);
-	pm_runtime_dont_use_autosuspend(musb->controller);
-	pm_runtime_put_sync(musb->controller);
-	pm_runtime_disable(musb->controller);
 	musb_free(musb);
 	device_init_wakeup(dev, 0);
 	return 0;
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index c55d4f3..a2a158f 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -406,13 +406,6 @@ static int omap2430_musb_init(struct musb *musb)
 	if (status < 0)
 		goto err1;
 
-	status = pm_runtime_get_sync(dev);
-	if (status < 0) {
-		dev_err(dev, "pm_runtime_get_sync FAILED %d\n", status);
-		pm_runtime_put_sync(glue->dev);
-		goto err1;
-	}
-
 	l = musb_readl(musb->mregs, OTG_INTERFSEL);
 
 	if (data->interface_type == MUSB_INTERFACE_UTMI) {
@@ -440,9 +433,6 @@ static int omap2430_musb_init(struct musb *musb)
 
 	phy_init(musb->phy);
 	phy_power_on(musb->phy);

  parent reply	other threads:[~2016-04-28 17:33 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-28 17:33 [PATCH 00/10] Get MUSB PM runtime working again Tony Lindgren
     [not found] ` <1461864800-29979-1-git-send-email-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-04-28 17:33   ` [PATCH 01/10] usb: phy: Fix initial state for twl6030 Tony Lindgren
2016-04-28 17:33   ` [PATCH 02/10] usb: musb: Fix idling after host mode by increasing autosuspend delay Tony Lindgren
     [not found]     ` <1461864800-29979-3-git-send-email-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-05-05 15:02       ` Bin Liu
2016-05-05 17:04         ` Tony Lindgren
     [not found]           ` <20160505170439.GX5995-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-05-05 17:47             ` Bin Liu
2016-05-06  6:45               ` Felipe Balbi
     [not found]                 ` <87k2j7it0f.fsf-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-05-09 19:57                   ` Tony Lindgren
2016-04-28 17:33   ` [PATCH 03/10] usb: musb: Fix PM runtime handling for connected cable Tony Lindgren
     [not found]     ` <1461864800-29979-4-git-send-email-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-04-28 17:53       ` Sergei Shtylyov
     [not found]         ` <57224E1F.7040707-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
2016-04-28 18:07           ` Tony Lindgren
     [not found]             ` <20160428180741.GF5995-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-04-29 15:52               ` Tony Lindgren
2016-04-28 17:33   ` [PATCH 04/10] usb: musb: Remove unnecessary shutdown function Tony Lindgren
     [not found]     ` <1461864800-29979-5-git-send-email-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-05-05 19:20       ` Bin Liu
2016-05-05 19:28         ` Tony Lindgren
     [not found]           ` <20160505192852.GD5995-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-05-05 19:49             ` Bin Liu
2016-04-28 17:33   ` [PATCH 05/10] usb: musb: Fix PM runtime autosuspend Tony Lindgren
2016-04-28 17:33   ` Tony Lindgren [this message]
2016-04-28 17:33   ` [PATCH 07/10] usb: musb: Manage USB phy from PM runtime calls Tony Lindgren
2016-04-28 17:33   ` [PATCH 08/10] usb: musb: Remove try_idle for 2430 glue layer Tony Lindgren
2016-04-28 17:33   ` [PATCH 09/10] usb: musb: Fix PM runtime with delayed work Tony Lindgren
2016-04-28 17:33   ` [PATCH 10/10] usb: musb: Remove pm_runtime_set_irq_safe Tony Lindgren
2016-05-01  6:33   ` [PATCH 00/10] Get MUSB PM runtime working again Ivaylo Dimitrov
     [not found]     ` <5725A31D.8020508-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-05-03 16:25       ` Tony Lindgren
     [not found]         ` <20160503162528.GM5995-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-05-03 17:43           ` Ivaylo Dimitrov
     [not found]             ` <5728E334.3090000-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-05-11 23:03               ` Tony Lindgren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1461864800-29979-7-git-send-email-tony@atomide.com \
    --to=tony-4v6ys6ai5vpbdgjk7y7tuq@public.gmane.org \
    --cc=b-liu-l0cyMroinI0@public.gmane.org \
    --cc=balbi-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=george.cherian-l0cyMroinI0@public.gmane.org \
    --cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).