public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] usb: musb: Power management support
@ 2011-02-25 10:10 Hema HK
  2011-02-25 10:10 ` [PATCH 1/5] usb: otg: TWL4030: Update the last_event variable Hema HK
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Hema HK @ 2011-02-25 10:10 UTC (permalink / raw)
  To: linux-usb; +Cc: linux-omap, Hema HK

This patch series supports the retention and offmode support in the 
idle path for musb driver using runtime pm APIs.

This is restricted to support offmode and retention only when device not
connected.When device/cable connected with gadget driver loaded, configured
to no idle/standby which will not allow the core transition to retention
or off.

There is no context save/restore done by hardware for musb in OMAP3
and OMAP4,driver has to take care of saving and restoring the context
during offmode.

Musb has a requirement of configuring sysconfig register to force
idle/standby mode and set the ENABLE_FORCE bit in module STANDBY register
for retention and offmode support.

Runtime pm and hwmod frameworks will take care of configuring to force
idle/standby when pm_runtime_put_sync is called and back to no
idle/standby when pm_runeime_get_sync is called.

Compile, boot tested and also tested the retention in the idle path on
OMAP3630Zoom3. And tested the global suspend/resume with offmode enabled.
Usb basic functionality tested on OMAP4430SDP.

There is some problem with idle path offmode in mainline, I could not test
with offmode. But I have tested this patch with resetting the controller
in the idle path when wakeup from retention just to make sure that the
context is lost, and restore path is working fine.


Hema HK (5):
  usb: otg: TWL4030: Update the last_event variable.
  usb: musb: Remove platform context save/restore APIs
  usb: musb: Idle path retention and offmode support for OMAP3
  usb: musb: OMAP4430: Power down the PHY during board init
  usb:musb: OMAP4430: Save/restore the context

 arch/arm/mach-omap2/omap_phy_internal.c |    7 ++++
 arch/arm/mach-omap2/usb-musb.c          |    4 ++
 drivers/usb/musb/musb_core.c            |   40 +++++++++++++++++++++++
 drivers/usb/musb/musb_core.h            |    4 --
 drivers/usb/musb/musb_gadget.c          |   11 ++++++
 drivers/usb/musb/omap2430.c             |   54 ++++++++++++++----------------
 drivers/usb/otg/twl4030-usb.c           |    2 +
 7 files changed, 89 insertions(+), 33 deletions(-)


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 1/5] usb: otg: TWL4030: Update the last_event variable.
  2011-02-25 10:10 [PATCH 0/5] usb: musb: Power management support Hema HK
@ 2011-02-25 10:10 ` Hema HK
  2011-02-25 10:11 ` [PATCH 3/5] usb: musb: Idle path retention and offmode support for OMAP3 Hema HK
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 13+ messages in thread
From: Hema HK @ 2011-02-25 10:10 UTC (permalink / raw)
  To: linux-usb; +Cc: linux-omap, Hema HK, Felipe Balbi

Update the last_event variable of otg_transceiver. This will be used in
the musb platform glue driver for runtime idling the device.

Signed-off-by: Hema HK <hemahk@ti.com>
Cc: Felipe Balbi <balbi@ti.com>
---
 drivers/usb/otg/twl4030-usb.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/otg/twl4030-usb.c b/drivers/usb/otg/twl4030-usb.c
index 6ca505f..013b804 100644
--- a/drivers/usb/otg/twl4030-usb.c
+++ b/drivers/usb/otg/twl4030-usb.c
@@ -275,6 +275,8 @@ static enum usb_xceiv_events twl4030_usb_linkstat(struct twl4030_usb *twl)
 	dev_dbg(twl->dev, "HW_CONDITIONS 0x%02x/%d; link %d\n",
 			status, status, linkstat);
 
+	twl->otg.last_event = linkstat;
+
 	/* REVISIT this assumes host and peripheral controllers
 	 * are registered, and that both are active...
 	 */
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 2/5] usb: musb: Remove platform context save/restore APIs
       [not found] ` <1298628663-27650-1-git-send-email-hemahk-l0cyMroinI0@public.gmane.org>
@ 2011-02-25 10:11   ` Hema HK
  2011-02-25 10:13     ` Felipe Balbi
  2011-02-25 10:11   ` [PATCH 4/5] usb: musb: OMAP4430: Power down the PHY during board init Hema HK
  2011-02-25 10:11   ` [PATCH 5/5] usb: musb: OMAP4430: Save/restore the context Hema HK
  2 siblings, 1 reply; 13+ messages in thread
From: Hema HK @ 2011-02-25 10:11 UTC (permalink / raw)
  To: linux-usb-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA, Hema HK

For OMAP3 and OMAP4 for offmode and retention support, musb
sysconfig is configured to force idle and standby with ENABLE_FORCE bit
of OTG_FORCESTNDBY set.
And on wakeup configure to no idle/standby with resetting the ENABLE_FORCE
bit. There is no need to save and restore of this register anymore
so removed omap2430_save_context/omap2430_restore_context functions.
and also removed otg_forcestandby member of musb_context_registers
structure

Signed-off-by: Hema HK <hemahk-l0cyMroinI0@public.gmane.org>
---
 drivers/usb/musb/musb_core.h |    4 ----
 drivers/usb/musb/omap2430.c  |   11 -----------
 2 files changed, 0 insertions(+), 15 deletions(-)

diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index cdb8ad7..1a71037 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -358,10 +358,6 @@ struct musb_csr_regs {
 
 struct musb_context_registers {
 
-#if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3) || \
-    defined(CONFIG_ARCH_OMAP4)
-	u32 otg_forcestandby;
-#endif
 	u8 power;
 	u16 intrtxe, intrrxe;
 	u8 intrusbe;
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 4dccb54..9ba7ddc 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -488,15 +488,6 @@ static int __exit omap2430_remove(struct platform_device *pdev)
 }
 
 #ifdef CONFIG_PM
-static void omap2430_save_context(struct musb *musb)
-{
-	musb->context.otg_forcestandby = musb_readl(musb->mregs, OTG_FORCESTDBY);
-}
-
-static void omap2430_restore_context(struct musb *musb)
-{
-	musb_writel(musb->mregs, OTG_FORCESTDBY, musb->context.otg_forcestandby);
-}
 
 static int omap2430_suspend(struct device *dev)
 {
@@ -505,7 +496,6 @@ static int omap2430_suspend(struct device *dev)
 
 	omap2430_low_level_exit(musb);
 	otg_set_suspend(musb->xceiv, 1);
-	omap2430_save_context(musb);
 
 	if (!pm_runtime_suspended(dev) && dev->bus && dev->bus->pm &&
 					dev->bus->pm->runtime_suspend)
@@ -524,7 +514,6 @@ static int omap2430_resume(struct device *dev)
 		dev->bus->pm->runtime_resume(dev);
 
 	omap2430_low_level_init(musb);
-	omap2430_restore_context(musb);
 	otg_set_suspend(musb->xceiv, 0);
 
 	return 0;
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 3/5] usb: musb: Idle path retention and offmode support for OMAP3
  2011-02-25 10:10 [PATCH 0/5] usb: musb: Power management support Hema HK
  2011-02-25 10:10 ` [PATCH 1/5] usb: otg: TWL4030: Update the last_event variable Hema HK
@ 2011-02-25 10:11 ` Hema HK
  2011-02-25 10:14   ` Felipe Balbi
       [not found] ` <1298628663-27650-1-git-send-email-hemahk-l0cyMroinI0@public.gmane.org>
  2011-02-25 10:21 ` [PATCH 0/5] usb: musb: Power management support Felipe Balbi
  3 siblings, 1 reply; 13+ messages in thread
From: Hema HK @ 2011-02-25 10:11 UTC (permalink / raw)
  To: linux-usb; +Cc: linux-omap, Hema HK, Felipe Balbi

This patch supports the retention and offmode support in the idle path for
musb driver using runtime pm APIs.

This is restricted to support offmode and retention only when device not
connected.When device/cable connected with gadget driver loaded, configured
to no idle/standby which will not allow the core transition to retention
or off.

There is no context save/restore done by hardware for musb in OMAP3
and OMAP4,driver has to take care of saving and restoring the context
during offmode.

Musb has a requirement of configuring sysconfig register to force
idle/standby mode and set the ENFORCE bit in module STANDBY register
for retention and offmode support.

Runtime pm and hwmod frameworks will take care of configuring to force
idle/standby when pm_runtime_put_sync is called and back to no
idle/standby when pm_runeime_get_sync is called.

Compile, boot tested and also tested the retention in the idle path on
OMAP3630Zoom3. And tested the global suspend/resume with offmode enabled.
Usb basic functionality tested on OMAP4430SDP.

There is some problem with idle path offmode in mainline, I could not test
with offmode. But I have tested this patch with resetting the controller
in the idle path when wakeup from retention just to make sure that the
context is lost, and restore path is working fine.

Removed .suspend/.resume function pointers and functions because there
is no need of having these functions as all required work is done
at runtime in the driver.

There is no need to call the runtime pm API with glue driver device
as glue layer device is the parent of musb core device, when runtime APIs
are called for the child, parent device runtime functionality
will be invoked.

Design overview:

pm_runtime_get_sync: When called with musb core device takes care of
enabling the clock, calling runtime callback function of omap2430 glue
layer, runtime call back of musb driver and configure the musb sysconfig
to no idle/standby

pm_runtime_put: Takes care of calling runtime callback function of omap2430
glue layer, runtime call back of musb driver, Configure the musb sysconfig
to force idle/standby and disable the clock.

During musb driver load: Call pm_runtime_get_sync.

End of musb driver load: Call pm_runtime_put

During gadget driver load: Call pm_runtime_get_sync,
End of gadget driver load: Call pm_runtime_put if there is no device
or cable is connected.

During unload of the gadget driver:Call pm_runtime_get_sync if cable/device
is not connected.
End of the gadget driver unload : pm_runtime_put

During unload of musb driver : Call pm_runtime_get_sync
End of unload: Call pm_runtime_put

On connect of usb cable/device -> transceiver notification(VBUS and ID-GND):
pm_runtime_get_sync only if the gadget driver loaded.

On disconnect of the cable/device -> Disconnect Notification:
pm_runtime_put if the gadget driver is loaded.

Signed-off-by: Hema HK <hemahk@ti.com>
Cc: Felipe Balbi <balbi@ti.com>
---
 drivers/usb/musb/musb_core.c   |   40 ++++++++++++++++++++++++++++++++++++++++
 drivers/usb/musb/musb_gadget.c |   11 +++++++++++
 drivers/usb/musb/omap2430.c    |   40 ++++++++++++++++++++++------------------
 3 files changed, 73 insertions(+), 18 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 958e8ce..07b8bc6 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1982,6 +1982,10 @@ bad_config:
 		goto fail0;
 	}
 
+	pm_runtime_use_autosuspend(musb->controller);
+	pm_runtime_set_autosuspend_delay(musb->controller, 200);
+	pm_runtime_enable(musb->controller);
+
 	spin_lock_init(&musb->lock);
 	musb->board_mode = plat->mode;
 	musb->board_set_power = plat->set_power;
@@ -2117,6 +2121,8 @@ bad_config:
 	if (status < 0)
 		goto fail3;
 
+	pm_runtime_put(musb->controller);
+
 	status = musb_init_debugfs(musb);
 	if (status < 0)
 		goto fail4;
@@ -2216,9 +2222,11 @@ static int __exit musb_remove(struct platform_device *pdev)
 	 *  - Peripheral mode: peripheral is deactivated (or never-activated)
 	 *  - OTG mode: both roles are deactivated (or never-activated)
 	 */
+	pm_runtime_get_sync(musb->controller);
 	musb_exit_debugfs(musb);
 	musb_shutdown(pdev);
 
+	pm_runtime_put(musb->controller);
 	musb_free(musb);
 	iounmap(ctrl_base);
 	device_init_wakeup(&pdev->dev, 0);
@@ -2404,9 +2412,41 @@ static int musb_resume_noirq(struct device *dev)
 	return 0;
 }
 
+static int musb_runtime_suspend(struct device *dev)
+{
+	struct musb	*musb = dev_to_musb(dev);
+
+	musb_save_context(musb);
+
+	return 0;
+}
+
+static int musb_runtime_resume(struct device *dev)
+{
+	struct musb	*musb = dev_to_musb(dev);
+	static int	first = 1;
+
+	/*
+	 * When pm_runtime_get_sync called for the first time in driver
+	 * init,  some of the structure is still not initialized which is
+	 * used in restore function. But clock needs to be
+	 * enabled before any register access, so
+	 * pm_runtime_get_sync has to be called.
+	 * Also context restore without save does not make
+	 * any sense
+	 */
+	if (!first)
+		musb_restore_context(musb);
+	first = 0;
+
+	return 0;
+}
+
 static const struct dev_pm_ops musb_dev_pm_ops = {
 	.suspend	= musb_suspend,
 	.resume_noirq	= musb_resume_noirq,
+	.runtime_suspend = musb_runtime_suspend,
+	.runtime_resume = musb_runtime_resume,
 };
 
 #define MUSB_DEV_PM_OPS (&musb_dev_pm_ops)
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index d1574eb..c1a1942 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -1789,6 +1789,8 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver,
 		return -ENODEV;
 	}
 
+	pm_runtime_get_sync(musb->controller);
+
 	DBG(3, "registering driver %s\n", driver->function);
 	spin_lock_irqsave(&musb->lock, flags);
 
@@ -1860,6 +1862,10 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver,
 						&& musb->xceiv->set_vbus)
 				otg_set_vbus(musb->xceiv, 1);
 		}
+
+		if (musb->xceiv->last_event == USB_EVENT_NONE)
+			pm_runtime_put(musb->controller);
+
 	}
 
 	return retval;
@@ -1923,6 +1929,9 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
 	if (!driver || !driver->unbind || !musb)
 		return -EINVAL;
 
+	if (musb->xceiv->last_event == USB_EVENT_NONE)
+		pm_runtime_get_sync(musb->controller);
+
 	/* REVISIT always use otg_set_peripheral() here too;
 	 * this needs to shut down the OTG engine.
 	 */
@@ -1963,6 +1972,8 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
 		 */
 	}
 
+	pm_runtime_put(musb->controller);
+
 	return retval;
 }
 EXPORT_SYMBOL(usb_gadget_unregister_driver);
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 9ba7ddc..776e07f 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -244,6 +244,7 @@ static int musb_otg_notifications(struct notifier_block *nb,
 		if (is_otg_enabled(musb)) {
 #ifdef CONFIG_USB_GADGET_MUSB_HDRC
 			if (musb->gadget_driver) {
+				pm_runtime_get_sync(musb->controller);
 				otg_init(musb->xceiv);
 
 				if (data->interface_type ==
@@ -253,6 +254,7 @@ static int musb_otg_notifications(struct notifier_block *nb,
 			}
 #endif
 		} else {
+			pm_runtime_get_sync(musb->controller);
 			otg_init(musb->xceiv);
 			if (data->interface_type ==
 					MUSB_INTERFACE_UTMI)
@@ -263,12 +265,24 @@ static int musb_otg_notifications(struct notifier_block *nb,
 	case USB_EVENT_VBUS:
 		DBG(4, "VBUS Connect\n");
 
+		if (musb->gadget_driver)
+			pm_runtime_get_sync(musb->controller);
+
 		otg_init(musb->xceiv);
 		break;
 
 	case USB_EVENT_NONE:
 		DBG(4, "VBUS Disconnect\n");
 
+#ifdef CONFIG_USB_GADGET_MUSB_HDRC
+		if (is_otg_enabled(musb))
+			if (musb->gadget_driver)
+#endif
+			{
+				pm_runtime_mark_last_busy(musb->controller);
+				pm_runtime_put_autosuspend(musb->controller);
+			}
+
 		if (data->interface_type == MUSB_INTERFACE_UTMI) {
 			if (musb->xceiv->set_vbus)
 				otg_set_vbus(musb->xceiv, 0);
@@ -300,7 +314,12 @@ static int omap2430_musb_init(struct musb *musb)
 		return -ENODEV;
 	}
 
-	omap2430_low_level_init(musb);
+	status = pm_runtime_get_sync(dev);
+	if (status < 0) {
+		dev_err(dev, "pm_runtime_get_sync FAILED");
+		pm_runtime_disable(dev);
+		return -EINVAL;
+	}
 
 	l = musb_readl(musb->mregs, OTG_INTERFSEL);
 
@@ -454,16 +473,9 @@ static int __init omap2430_probe(struct platform_device *pdev)
 	}
 
 	pm_runtime_enable(&pdev->dev);
-	status = pm_runtime_get_sync(&pdev->dev);
-	if (status < 0) {
-		dev_err(&pdev->dev, "pm_runtime_get_sync FAILED");
-		goto err3;
-	}
 
 	return 0;
 
-err3:
-	pm_runtime_disable(&pdev->dev);
 err2:
 	platform_device_put(musb);
 
@@ -497,10 +509,6 @@ static int omap2430_suspend(struct device *dev)
 	omap2430_low_level_exit(musb);
 	otg_set_suspend(musb->xceiv, 1);
 
-	if (!pm_runtime_suspended(dev) && dev->bus && dev->bus->pm &&
-					dev->bus->pm->runtime_suspend)
-		dev->bus->pm->runtime_suspend(dev);
-
 	return 0;
 }
 
@@ -509,10 +517,6 @@ static int omap2430_resume(struct device *dev)
 	struct omap2430_glue		*glue = dev_get_drvdata(dev);
 	struct musb			*musb = glue_to_musb(glue);
 
-	if (!pm_runtime_suspended(dev) && dev->bus && dev->bus->pm &&
-		 			dev->bus->pm->runtime_resume)
-		dev->bus->pm->runtime_resume(dev);
-
 	omap2430_low_level_init(musb);
 	otg_set_suspend(musb->xceiv, 0);
 
@@ -520,8 +524,8 @@ static int omap2430_resume(struct device *dev)
 }
 
 static struct dev_pm_ops omap2430_pm_ops = {
-	.suspend	= omap2430_suspend,
-	.resume		= omap2430_resume,
+	.runtime_suspend = omap2430_suspend,
+	.runtime_resume = omap2430_resume,
 };
 
 #define DEV_PM_OPS	(&omap2430_pm_ops)
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 4/5] usb: musb: OMAP4430: Power down the PHY during board init
       [not found] ` <1298628663-27650-1-git-send-email-hemahk-l0cyMroinI0@public.gmane.org>
  2011-02-25 10:11   ` [PATCH 2/5] usb: musb: Remove platform context save/restore APIs Hema HK
@ 2011-02-25 10:11   ` Hema HK
  2011-02-25 10:11   ` [PATCH 5/5] usb: musb: OMAP4430: Save/restore the context Hema HK
  2 siblings, 0 replies; 13+ messages in thread
From: Hema HK @ 2011-02-25 10:11 UTC (permalink / raw)
  To: linux-usb-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA, Hema HK, Felipe Balbi,
	Tony Lindgren, Paul Walmsley

Powerdown the internal PHY during board init for OMAP44xx.
So that when musb is disabled core transition to retention/off
is not blocked.

Signed-off-by: Hema HK <hemahk-l0cyMroinI0@public.gmane.org>
Cc: Felipe Balbi <balbi-l0cyMroinI0@public.gmane.org>
Cc: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
Cc: Paul Walmsley <paul-DWxLp4Yu+b8AvxtiuMwx3w@public.gmane.org>
---
 arch/arm/mach-omap2/usb-musb.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/usb-musb.c b/arch/arm/mach-omap2/usb-musb.c
index 85fc30a..268ce0a 100644
--- a/arch/arm/mach-omap2/usb-musb.c
+++ b/arch/arm/mach-omap2/usb-musb.c
@@ -115,6 +115,10 @@ void __init usb_musb_init(struct omap_musb_board_data *board_data)
 	dev->dma_mask = &musb_dmamask;
 	dev->coherent_dma_mask = musb_dmamask;
 	put_device(dev);
+
+	if (cpu_is_omap44xx())
+		omap4430_phy_init(dev);
+
 }
 
 #else
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 5/5] usb: musb: OMAP4430: Save/restore the context
       [not found] ` <1298628663-27650-1-git-send-email-hemahk-l0cyMroinI0@public.gmane.org>
  2011-02-25 10:11   ` [PATCH 2/5] usb: musb: Remove platform context save/restore APIs Hema HK
  2011-02-25 10:11   ` [PATCH 4/5] usb: musb: OMAP4430: Power down the PHY during board init Hema HK
@ 2011-02-25 10:11   ` Hema HK
  2 siblings, 0 replies; 13+ messages in thread
From: Hema HK @ 2011-02-25 10:11 UTC (permalink / raw)
  To: linux-usb-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA, Hema HK, Felipe Balbi,
	Tony Lindgren, Paul Walmsley

Add the context save restore for the control module register
used for OMAP4430 musb with UTMI embedded PHY interface.

Signed-off-by: Hema HK <hemahk-l0cyMroinI0@public.gmane.org>
Cc: Felipe Balbi <balbi-l0cyMroinI0@public.gmane.org>
Cc: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
Cc: Paul Walmsley <paul-DWxLp4Yu+b8AvxtiuMwx3w@public.gmane.org>
---
 arch/arm/mach-omap2/omap_phy_internal.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_phy_internal.c b/arch/arm/mach-omap2/omap_phy_internal.c
index c50441f..e2e605f 100644
--- a/arch/arm/mach-omap2/omap_phy_internal.c
+++ b/arch/arm/mach-omap2/omap_phy_internal.c
@@ -44,6 +44,7 @@
 
 static struct clk *phyclk, *clk48m, *clk32k;
 static void __iomem *ctrl_base;
+static int usbotghs_control;
 
 int omap4430_phy_init(struct device *dev)
 {
@@ -130,6 +131,9 @@ int omap4430_phy_suspend(struct device *dev, int suspend)
 		omap4430_phy_set_clk(dev, 0);
 		/* Power down the phy */
 		__raw_writel(PHY_PD, ctrl_base + CONTROL_DEV_CONF);
+
+		/* save the context */
+		usbotghs_control = __raw_readl(ctrl_base + USBOTGHS_CONTROL);
 	} else {
 		/* Enable the internel phy clcoks */
 		omap4430_phy_set_clk(dev, 1);
@@ -138,6 +142,9 @@ int omap4430_phy_suspend(struct device *dev, int suspend)
 			__raw_writel(~PHY_PD, ctrl_base + CONTROL_DEV_CONF);
 			mdelay(200);
 		}
+
+		/* restore the context */
+		__raw_writel(usbotghs_control, ctrl_base + USBOTGHS_CONTROL);
 	}
 
 	return 0;
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/5] usb: musb: Remove platform context save/restore APIs
  2011-02-25 10:11   ` [PATCH 2/5] usb: musb: Remove platform context save/restore APIs Hema HK
@ 2011-02-25 10:13     ` Felipe Balbi
  0 siblings, 0 replies; 13+ messages in thread
From: Felipe Balbi @ 2011-02-25 10:13 UTC (permalink / raw)
  To: Hema HK; +Cc: linux-usb, linux-omap

On Fri, Feb 25, 2011 at 03:41:00PM +0530, Hema HK wrote:
> For OMAP3 and OMAP4 for offmode and retention support, musb
> sysconfig is configured to force idle and standby with ENABLE_FORCE bit
> of OTG_FORCESTNDBY set.
> And on wakeup configure to no idle/standby with resetting the ENABLE_FORCE
> bit. There is no need to save and restore of this register anymore
> so removed omap2430_save_context/omap2430_restore_context functions.
> and also removed otg_forcestandby member of musb_context_registers
> structure
> 
> Signed-off-by: Hema HK <hemahk@ti.com>

Nice, good one ;-)

-- 
balbi

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 3/5] usb: musb: Idle path retention and offmode support for OMAP3
  2011-02-25 10:11 ` [PATCH 3/5] usb: musb: Idle path retention and offmode support for OMAP3 Hema HK
@ 2011-02-25 10:14   ` Felipe Balbi
       [not found]     ` <20110225101452.GB4190-UiBtZHVXSwEVvW8u9ZQWYwjfymiNCTlR@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Felipe Balbi @ 2011-02-25 10:14 UTC (permalink / raw)
  To: Hema HK; +Cc: linux-usb, linux-omap, Felipe Balbi

On Fri, Feb 25, 2011 at 03:41:01PM +0530, Hema HK wrote:
> @@ -520,8 +524,8 @@ static int omap2430_resume(struct device *dev)
>  }
>  
>  static struct dev_pm_ops omap2430_pm_ops = {
> -	.suspend	= omap2430_suspend,
> -	.resume		= omap2430_resume,
> +	.runtime_suspend = omap2430_suspend,
> +	.runtime_resume = omap2430_resume,

while at that, please rename omap2430_suspend to
omap2430_runtime_suspend and omap2430_resume to omap2430_runtime_resume
just to keep consistency.

-- 
balbi

^ permalink raw reply	[flat|nested] 13+ messages in thread

* RE: [PATCH 3/5] usb: musb: Idle path retention and offmode support for OMAP3
       [not found]     ` <20110225101452.GB4190-UiBtZHVXSwEVvW8u9ZQWYwjfymiNCTlR@public.gmane.org>
@ 2011-02-25 10:16       ` Hema Kalliguddi
  0 siblings, 0 replies; 13+ messages in thread
From: Hema Kalliguddi @ 2011-02-25 10:16 UTC (permalink / raw)
  To: balbi-l0cyMroinI0
  Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA

 Felipe,

>-----Original Message-----
>From: Felipe Balbi [mailto:balbi-l0cyMroinI0@public.gmane.org]
>Sent: Friday, February 25, 2011 3:45 PM
>To: Hema HK
>Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; Felipe Balbi
>Subject: Re: [PATCH 3/5] usb: musb: Idle path retention and
>offmode support for OMAP3
>
>On Fri, Feb 25, 2011 at 03:41:01PM +0530, Hema HK wrote:
>> @@ -520,8 +524,8 @@ static int omap2430_resume(struct device *dev)
>>  }
>>
>>  static struct dev_pm_ops omap2430_pm_ops = {
>> -	.suspend	= omap2430_suspend,
>> -	.resume		= omap2430_resume,
>> +	.runtime_suspend = omap2430_suspend,
>> +	.runtime_resume = omap2430_resume,
>
>while at that, please rename omap2430_suspend to
>omap2430_runtime_suspend and omap2430_resume to omap2430_runtime_resume
>just to keep consistency.
>

Ok.

Regards,
Hema
>--
>balbi
>
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0/5] usb: musb: Power management support
  2011-02-25 10:10 [PATCH 0/5] usb: musb: Power management support Hema HK
                   ` (2 preceding siblings ...)
       [not found] ` <1298628663-27650-1-git-send-email-hemahk-l0cyMroinI0@public.gmane.org>
@ 2011-02-25 10:21 ` Felipe Balbi
       [not found]   ` <20110225102112.GC4190-UiBtZHVXSwEVvW8u9ZQWYwjfymiNCTlR@public.gmane.org>
  3 siblings, 1 reply; 13+ messages in thread
From: Felipe Balbi @ 2011-02-25 10:21 UTC (permalink / raw)
  To: Hema HK; +Cc: linux-usb, linux-omap

On Fri, Feb 25, 2011 at 03:40:58PM +0530, Hema HK wrote:
> This patch series supports the retention and offmode support in the 
> idle path for musb driver using runtime pm APIs.
> 
> This is restricted to support offmode and retention only when device not
> connected.When device/cable connected with gadget driver loaded, configured
> to no idle/standby which will not allow the core transition to retention
> or off.
> 
> There is no context save/restore done by hardware for musb in OMAP3
> and OMAP4,driver has to take care of saving and restoring the context
> during offmode.
> 
> Musb has a requirement of configuring sysconfig register to force
> idle/standby mode and set the ENABLE_FORCE bit in module STANDBY register
> for retention and offmode support.
> 
> Runtime pm and hwmod frameworks will take care of configuring to force
> idle/standby when pm_runtime_put_sync is called and back to no
> idle/standby when pm_runeime_get_sync is called.
> 
> Compile, boot tested and also tested the retention in the idle path on
> OMAP3630Zoom3. And tested the global suspend/resume with offmode enabled.
> Usb basic functionality tested on OMAP4430SDP.
> 
> There is some problem with idle path offmode in mainline, I could not test
> with offmode. But I have tested this patch with resetting the controller
> in the idle path when wakeup from retention just to make sure that the
> context is lost, and restore path is working fine.

please base this off of my for-next branch

-- 
balbi

^ permalink raw reply	[flat|nested] 13+ messages in thread

* RE: [PATCH 0/5] usb: musb: Power management support
       [not found]   ` <20110225102112.GC4190-UiBtZHVXSwEVvW8u9ZQWYwjfymiNCTlR@public.gmane.org>
@ 2011-02-25 10:26     ` Hema Kalliguddi
       [not found]       ` <875afd9a6c1e7ccc61c7ff025fd57588-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Hema Kalliguddi @ 2011-02-25 10:26 UTC (permalink / raw)
  To: balbi-l0cyMroinI0
  Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA

Felipe,

>-----Original Message-----
>From: Felipe Balbi [mailto:balbi-l0cyMroinI0@public.gmane.org]
>Sent: Friday, February 25, 2011 3:51 PM
>To: Hema HK
>Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>Subject: Re: [PATCH 0/5] usb: musb: Power management support
>
>On Fri, Feb 25, 2011 at 03:40:58PM +0530, Hema HK wrote:
>> This patch series supports the retention and offmode support in the
>> idle path for musb driver using runtime pm APIs.
>>
>> This is restricted to support offmode and retention only
>when device not
>> connected.When device/cable connected with gadget driver
>loaded, configured
>> to no idle/standby which will not allow the core transition
>to retention
>> or off.
>>
>> There is no context save/restore done by hardware for musb in OMAP3
>> and OMAP4,driver has to take care of saving and restoring the context
>> during offmode.
>>
>> Musb has a requirement of configuring sysconfig register to force
>> idle/standby mode and set the ENABLE_FORCE bit in module
>STANDBY register
>> for retention and offmode support.
>>
>> Runtime pm and hwmod frameworks will take care of
>configuring to force
>> idle/standby when pm_runtime_put_sync is called and back to no
>> idle/standby when pm_runeime_get_sync is called.
>>
>> Compile, boot tested and also tested the retention in the
>idle path on
>> OMAP3630Zoom3. And tested the global suspend/resume with
>offmode enabled.
>> Usb basic functionality tested on OMAP4430SDP.
>>
>> There is some problem with idle path offmode in mainline, I
>could not test
>> with offmode. But I have tested this patch with resetting
>the controller
>> in the idle path when wakeup from retention just to make
>sure that the
>> context is lost, and restore path is working fine.
>
>please base this off of my for-next branch
>
I tried to rebase and found that my hardware mod patches are not
in for-next branch. So there will be some conflicts for patch 4 and 5.
Is there any branch in which you have all the usb and platform changes
merged?

Regards,
Hema
>--
>balbi
>
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0/5] usb: musb: Power management support
       [not found]       ` <875afd9a6c1e7ccc61c7ff025fd57588-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2011-02-25 10:39         ` Felipe Balbi
       [not found]           ` <20110225103930.GD4190-UiBtZHVXSwEVvW8u9ZQWYwjfymiNCTlR@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Felipe Balbi @ 2011-02-25 10:39 UTC (permalink / raw)
  To: Hema Kalliguddi
  Cc: balbi-l0cyMroinI0, linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA

Hi,

On Fri, Feb 25, 2011 at 03:56:46PM +0530, Hema Kalliguddi wrote:
> I tried to rebase and found that my hardware mod patches are not
> in for-next branch. So there will be some conflicts for patch 4 and 5.
> Is there any branch in which you have all the usb and platform changes
> merged?

I just built one, please use musb-hwmod-pm-runtime It has all your
recent patches plus a few extra ones.

-- 
balbi
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 13+ messages in thread

* RE: [PATCH 0/5] usb: musb: Power management support
       [not found]           ` <20110225103930.GD4190-UiBtZHVXSwEVvW8u9ZQWYwjfymiNCTlR@public.gmane.org>
@ 2011-02-25 10:43             ` Hema Kalliguddi
  0 siblings, 0 replies; 13+ messages in thread
From: Hema Kalliguddi @ 2011-02-25 10:43 UTC (permalink / raw)
  To: balbi-l0cyMroinI0
  Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA

Hi,

>-----Original Message-----
>From: Felipe Balbi [mailto:balbi-l0cyMroinI0@public.gmane.org]
>Sent: Friday, February 25, 2011 4:10 PM
>To: Hema Kalliguddi
>Cc: balbi-l0cyMroinI0@public.gmane.org; linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>Subject: Re: [PATCH 0/5] usb: musb: Power management support
>
>Hi,
>
>On Fri, Feb 25, 2011 at 03:56:46PM +0530, Hema Kalliguddi wrote:
>> I tried to rebase and found that my hardware mod patches are not
>> in for-next branch. So there will be some conflicts for
>patch 4 and 5.
>> Is there any branch in which you have all the usb and
>platform changes
>> merged?
>
>I just built one, please use musb-hwmod-pm-runtime It has all your
>recent patches plus a few extra ones.

Thanks,
Hema
>
>--
>balbi
>
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2011-02-25 10:43 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-25 10:10 [PATCH 0/5] usb: musb: Power management support Hema HK
2011-02-25 10:10 ` [PATCH 1/5] usb: otg: TWL4030: Update the last_event variable Hema HK
2011-02-25 10:11 ` [PATCH 3/5] usb: musb: Idle path retention and offmode support for OMAP3 Hema HK
2011-02-25 10:14   ` Felipe Balbi
     [not found]     ` <20110225101452.GB4190-UiBtZHVXSwEVvW8u9ZQWYwjfymiNCTlR@public.gmane.org>
2011-02-25 10:16       ` Hema Kalliguddi
     [not found] ` <1298628663-27650-1-git-send-email-hemahk-l0cyMroinI0@public.gmane.org>
2011-02-25 10:11   ` [PATCH 2/5] usb: musb: Remove platform context save/restore APIs Hema HK
2011-02-25 10:13     ` Felipe Balbi
2011-02-25 10:11   ` [PATCH 4/5] usb: musb: OMAP4430: Power down the PHY during board init Hema HK
2011-02-25 10:11   ` [PATCH 5/5] usb: musb: OMAP4430: Save/restore the context Hema HK
2011-02-25 10:21 ` [PATCH 0/5] usb: musb: Power management support Felipe Balbi
     [not found]   ` <20110225102112.GC4190-UiBtZHVXSwEVvW8u9ZQWYwjfymiNCTlR@public.gmane.org>
2011-02-25 10:26     ` Hema Kalliguddi
     [not found]       ` <875afd9a6c1e7ccc61c7ff025fd57588-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-02-25 10:39         ` Felipe Balbi
     [not found]           ` <20110225103930.GD4190-UiBtZHVXSwEVvW8u9ZQWYwjfymiNCTlR@public.gmane.org>
2011-02-25 10:43             ` Hema Kalliguddi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox