usb: musb: Offmode fix for idle path
Subsystems (7)
PATCH v2 6/8 usb: musb: Offmode fix for idle path
From: Hema HK <[email protected]>
With OMAP core-off support musb was not functional as context was getting lost after wakeup from core-off. And also musb was blocking the core-off after loading the gadget driver even with no cable connected sometimes.
Added the conext save/restore api in the platform layer which will be called in the idle and wakeup path.
Changed the usb sysconfig settings as per the usbotg functional spec. When the device is not active, configure to force idle and force standby mode. When it is being used, configure in smart standby and smart idle mode. So while attempting to coreoff the usb is configured to force standby and force idle mode, after wakeup configured in smart idle and smart standby.
---
arch/arm/mach-omap2/pm34xx.c | 4 ++ arch/arm/mach-omap2/usb-musb.c | 21 ++++++++++++++ arch/arm/plat-omap/include/plat/usb.h | 2 + drivers/usb/musb/musb_core.c | 11 ------- drivers/usb/musb/omap2430.c | 48 +++++++++++++++++++++++++++++++--- 5 files changed, 71 insertions(+), 15 deletions(-)
arch/arm/mach-omap2/pm34xx.c +5 -0
@@ -39,6 +39,7 @@#include <plat/gpmc.h> #include <plat/dma.h> #include <plat/dmtimer.h> +#include <plat/usb.h> #include <asm/tlbflush.h>
@@ -416,6 +417,8 @@if (core_next_state ==PWRDM_POWER_OFF ) {omap3_core_save_context ();omap3_prcm_save_context (); +/* Save MUSB context */ +musb_context_save_restore (1 ); } }
@@ -458,6 +461,8 @@omap3_prcm_restore_context ();omap3_sram_restore_context ();omap2_sms_restore_context (); +/* restore MUSB context */ +musb_context_save_restore (0 ); }omap_uart_resume_idle (0 );omap_uart_resume_idle (1 );
arch/arm/mach-omap2/usb-musb.c +21 -0
@@ -120,6 +120,27 @@ } } +void musb_context_save_restore (int save) +{ +struct omap_hwmod *oh =omap_hwmod_lookup ("usb_otg_hs" ); +struct omap_device *od = oh->od; +struct platform_device *pdev = &od->pdev; +struct device *dev = &pdev->dev; +struct device_driver *drv = dev->driver; + +if (drv) { +struct musb_hdrc_platform_data *pdata = dev->platform_data; +const struct dev_pm_ops *pm = drv->pm; +if (!pdata->is_usb_active (dev)) { + +if (save) + pm->suspend (dev); +else + pm->resume_noirq (dev); + } + } +} +#else void __init usb_musb_init (struct omap_musb_board_data *board_data) {
arch/arm/plat-omap/include/plat/usb.h +2 -0
@@ -79,6 +79,8 @@extern void usb_ohci_init (const struct ohci_hcd_omap_platform_data *pdata); +/* For saving and restoring the musb context during off/wakeup*/ +extern void musb_context_save_restore (int save);#endif
drivers/usb/musb/musb_core.c +0 -11
@@ -2427,11 +2427,6 @@ }musb_save_context (musb); - -if (musb->set_clock) - musb->set_clock (musb->clock,0 ); -else -clk_disable (musb->clock);spin_unlock_irqrestore (&musb->lock, flags);return 0 ; }
@@ -2443,12 +2438,6 @@if (!musb->clock)return 0 ; - -if (musb->set_clock) - musb->set_clock (musb->clock,1 ); -else -clk_enable (musb->clock); -musb_restore_context (musb);/* for static cmos like DaVinci, register values were preserved
drivers/usb/musb/omap2430.c +45 -4
72 lines not on this page · raw message
include/linux/usb/musb.h +3 -0
@@ -126,6 +126,9 @@/* Architecture specific board data */ void *board_data; + +/* check usb device active state*/ +int (*is_usb_active)(struct device *dev); };
Quoted 122 lines · Hema HK
From: Hema HK <[email protected]>
With OMAP core-off support musb was not functional as context was getting lost after wakeup from core-off. And also musb was blocking the core-off after loading the gadget driver even with no cable connected sometimes.
Added the conext save/restore api in the platform layer which will be called in the idle and wakeup path.
Changed the usb sysconfig settings as per the usbotg functional spec. When the device is not active, configure to force idle and force standby mode. When it is being used, configure in smart standby and smart idle mode. So while attempting to coreoff the usb is configured to force standby and force idle mode, after wakeup configured in smart idle and smart standby.
Signed-off-by Hema HK <[email protected]>Signed-off-by Maulik Mankad <[email protected]>Cc Felipe Balbi <[email protected]>Cc Tony Lindgren <[email protected]>Cc Kevin Hilman <[email protected]>---
arch/arm/mach-omap2/pm34xx.c | 4 ++
arch/arm/mach-omap2/usb-musb.c| 21 ++++++++++++++arch/arm/plat-omap/include/plat/usb.h| 2 +drivers/usb/musb/musb_core.c| 11 -------drivers/usb/musb/omap2430.c| 48 +++++++++++++++++++++++++++++++---5 files changed, 71 insertions(+), 15 deletions(-)Index:
linux-omap-pm/arch/arm/mach-omap2/pm34xx.c
===================================================================arch/arm/mach-omap2/pm34xx.c 2010-08-06 10:44:06.393863125 -0400 renamed from arch/arm/mach-omap2/pm34xx.c 2010-08-06 09:23:01.153862710 -0400 +5
-0@@ -39,6 +39,7 @@ #include <plat/gpmc.h> #include <plat/dma.h> #include <plat/dmtimer.h> +#include <plat/usb.h> #include <asm/tlbflush.h>@@ -416,6 +417,8 @@ if (core_next_state == PWRDM_POWER_OFF) { omap3_core_save_context(); omap3_prcm_save_context(); + /* Save MUSB context */ + musb_context_save_restore(1); } }@@ -458,6 +461,8 @@ omap3_prcm_restore_context(); omap3_sram_restore_context(); omap2_sms_restore_context(); + /* restore MUSB context */ + musb_context_save_restore(0); } omap_uart_resume_idle(0); omap_uart_resume_idle(1);Index:
linux-omap-pm/arch/arm/mach-omap2/usb-musb.c
===================================================================arch/arm/mach-omap2/usb-musb.c 2010-08-06 10:44:06.385862697 -0400 renamed from arch/arm/mach-omap2/usb-musb.c 2010-08-06 09:24:23.690112596 -0400 +21
-0@@ -120,6 +120,27 @@ } } +void musb_context_save_restore(int save) +{ + struct omap_hwmod *oh = omap_hwmod_lookup("usb_otg_hs"); + struct omap_device *od = oh->od; + struct platform_device *pdev = &od->pdev; + struct device *dev = &pdev->dev; + struct device_driver *drv = dev->driver; + + if (drv) { + struct musb_hdrc_platform_data *pdata = dev->platform_data; + const struct dev_pm_ops *pm = drv->pm; + if (!pdata->is_usb_active(dev)) { + + if (save) + pm->suspend(dev); + else + pm->resume_noirq(dev); + } + } +} + #else void __init usb_musb_init(struct omap_musb_board_data *board_data) {Index:
linux-omap-pm/arch/arm/plat-omap/include/plat/usb.h
===================================================================arch/arm/plat-omap/include/plat/usb.h 2010-08-06 10:44:06.381864367 -0400 renamed from arch/arm/plat-omap/include/plat/usb.h 2010-08-06 09:23:01.137862514 -0400 +2
-0@@ -79,6 +79,8 @@ extern void usb_ohci_init(const struct ohci_hcd_omap_platform_data *pdata); +/* For saving and restoring the musb context during off/wakeup*/ +extern void musb_context_save_restore(int save); #endifIndex:
linux-omap-pm/drivers/usb/musb/musb_core.c
===================================================================drivers/usb/musb/musb_core.c 2010-08-06 10:44:06.369863527 -0400 renamed from drivers/usb/musb/musb_core.c 2010-08-06 09:24:21.069863329 -0400 +0
-5@@ -2427,11 +2427,6 @@ } musb_save_context(musb); - - if (musb->set_clock) - musb->set_clock(musb->clock, 0); - else - clk_disable(musb->clock); spin_unlock_irqrestore(&musb->lock, flags); return 0; }
drivers/usb/musb/musb_core.c 2010-08-06 10:44:06.369863527 -0400 line 2440
Quoted 3 lines
drivers/usb/musb/musb_core.c 2010-08-06 10:44:06.369863527 -0400 renamed from drivers/usb/musb/musb_core.c 2010-08-06 09:24:21.069863329 -0400 +0
-0@@ -2443,12 +2438,6 @@ if (!musb->clock) return 0;
Is this check can be deleted also ?
Because our blackfin platform have no clock support now. Thanks.
Quoted 107 lines
drivers/usb/musb/musb_core.c 2010-08-06 10:44:06.369863527 -0400 renamed from drivers/usb/musb/musb_core.c 2010-08-06 09:24:21.069863329 -0400 +0
-6- - if (musb->set_clock) - musb->set_clock(musb->clock, 1); - else - clk_enable(musb->clock); - musb_restore_context(musb); /* for static cmos like DaVinci, register values were preservedIndex:
linux-omap-pm/drivers/usb/musb/omap2430.c
===================================================================drivers/usb/musb/omap2430.c 2010-08-06 10:44:30.093914217 -0400 renamed from drivers/usb/musb/omap2430.c 2010-08-06 09:24:21.069863329 -0400 +45
-4@@ -189,6 +189,19 @@ return 0; } +int is_musb_active(struct device *dev) +{ + struct musb *musb; + +#ifdef CONFIG_USB_MUSB_HDRC_HCD + /* usbcore insists dev->driver_data is a "struct hcd *" */ + musb = hcd_to_musb(dev_get_drvdata(dev)); +#else + musb = dev_get_drvdata(dev); +#endif + return musb->is_active; +} + int __init musb_platform_init(struct musb *musb) { u32 l;@@ -250,6 +263,7 @@ if (is_host_enabled(musb)) musb->board_set_vbus = omap_set_vbus; + plat->is_usb_active = is_musb_active; setup_timer(&musb_idle_timer, musb_do_idle, (unsigned long) musb); return 0;@@ -259,15 +273,42 @@ void musb_platform_save_context(struct musb *musb, struct musb_context_registers *musb_context) { - musb_context->otg_sysconfig = musb_readl(musb->mregs, OTG_SYSCONFIG); - musb_context->otg_forcestandby = musb_readl(musb->mregs, OTG_FORCESTDBY); + /* + * As per the omap-usbotg specification, configure it to forced standby + * and force idle mode when no activity on usb. + */ + void __iomem *musb_base = musb->mregs; + + musb_writel(musb_base, OTG_FORCESTDBY, 0); + + musb_writel(musb_base, OTG_SYSCONFIG, musb_readl(musb_base, + OTG_SYSCONFIG) & ~(NOSTDBY | SMARTSTDBY)); + + musb_writel(musb_base, OTG_SYSCONFIG, musb_readl(musb_base, + OTG_SYSCONFIG) & ~(AUTOIDLE)); + + musb_writel(musb_base, OTG_SYSCONFIG, musb_readl(musb_base, + OTG_SYSCONFIG) & ~(NOIDLE | SMARTIDLE)); + + musb_writel(musb_base, OTG_FORCESTDBY, 1); } void musb_platform_restore_context(struct musb *musb, struct musb_context_registers *musb_context) { - musb_writel(musb->mregs, OTG_SYSCONFIG, musb_context->otg_sysconfig); - musb_writel(musb->mregs, OTG_FORCESTDBY, musb_context->otg_forcestandby); + /* + * As per the omap-usbotg specification, configure it smart standby + * and smart idle during operation. + */ + void __iomem *musb_base = musb->mregs; + + musb_writel(musb_base, OTG_FORCESTDBY, 0); + + musb_writel(musb_base, OTG_SYSCONFIG, musb_readl(musb_base, + OTG_SYSCONFIG) | (SMARTSTDBY)); + + musb_writel(musb_base, OTG_SYSCONFIG, musb_readl(musb_base, + OTG_SYSCONFIG) | (SMARTIDLE)); } #endifIndex:
linux-omap-pm/include/linux/usb/musb.h
===================================================================include/linux/usb/musb.h 2010-08-06 10:44:06.401862567 -0400 renamed from include/linux/usb/musb.h 2010-08-06 09:23:01.161864151 -0400 +3
-1@@ -126,6 +126,9 @@ /* Architecture specific board data */ void *board_data; + + /* check usb device active state*/ + int (*is_usb_active)(struct device *dev); }; --To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 6 lines
Regards, --Bob -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Hello.
Quoted 17 lines · Hema HK
With OMAP core-off support musb was not functional as context was getting
lost after wakeup from core-off. And also musb was blocking the core-off after loading the gadget driver even with no cable connected sometimes.Added the conext save/restore api in the platform layer which will be called in the idle and wakeup path.
Changed the usb sysconfig settings as per the usbotg functional spec.
When the device is not active, configure to force idle and force standby mode.
When it is being used, configure in smart standby and smart idle mode.
So while attempting to coreoff the usb is configured to force standby and force idle mode, after wakeup configured in smart idle and smart standby.Signed-off-by Hema HK <[email protected]>Signed-off-by Maulik Mankad <[email protected]>Cc Felipe Balbi <[email protected]>Cc Tony Lindgren <[email protected]>Cc Kevin Hilman <[email protected]>
[...]
Quoted 9 lines
Index:
linux-omap-pm/arch/arm/mach-omap2/usb-musb.c
===================================================================arch/arm/mach-omap2/usb-musb.c +1
-0@@ -120,6 +120,27 @@ } } +void musb_context_save_restore (int save)
arch/arm/mach-omap2/usb-musb.c line 133
Quoted 10 lines
arch/arm/mach-omap2/usb-musb.c +10
-0+{ +struct omap_hwmod *oh =omap_hwmod_lookup ("usb_otg_hs" ); +struct omap_device *od = oh->od; +struct platform_device *pdev = &od->pdev; +struct device *dev = &pdev->dev; +struct device_driver *drv = dev->driver; + +if (drv) { +struct musb_hdrc_platform_data *pdata = dev->platform_data; +const struct dev_pm_ops *pm = drv->pm;
Should be an empty line after the declaration block...
Quoted 30 lines
arch/arm/mach-omap2/usb-musb.c +10
-0+if (!pdata->is_usb_active (dev)) { + +if (save) + pm->suspend (dev); +else + pm->resume_noirq (dev); + } + } +} +#else void __init usb_musb_init (struct omap_musb_board_data *board_data) {Index:
linux-omap-pm/drivers/usb/musb/musb_core.c
===================================================================drivers/usb/musb/musb_core.c +0
-5@@ -2427,11 +2427,6 @@ }musb_save_context (musb); - -if (musb->set_clock) - musb->set_clock (musb->clock,0 ); -else -clk_disable (musb->clock);spin_unlock_irqrestore (&musb->lock, flags);return 0 ; }
drivers/usb/musb/musb_core.c line 2441
Quoted 10 lines
drivers/usb/musb/musb_core.c +0
-6@@ -2443,12 +2438,6 @@if (!musb->clock)return 0 ; - -if (musb->set_clock) - musb->set_clock (musb->clock,1 ); -else -clk_enable (musb->clock); -musb_restore_context (musb);
The same question again: are you sure that clocks are auto-gated on
non-OMAP platfroms?
Quoted 4 lines
Index:
linux-omap-pm/drivers/usb/musb/omap2430.c
===================================================================drivers/usb/musb/omap2430.c +0
-0
[...]
drivers/usb/musb/omap2430.c line 263
Quoted 6 lines
drivers/usb/musb/omap2430.c +0
-2@@ -259,15 +273,42 @@void musb_platform_save_context (struct musb *musb,struct musb_context_registers *musb_context) { - musb_context->otg_sysconfig =musb_readl (musb->mregs,OTG_SYSCONFIG ); - musb_context->otg_forcestandby =musb_readl (musb->mregs,OTG_FORCESTDBY );
If you're not saving the registers, you should remove the corresponding
fields from 'struct musb_context_registers'.
drivers/usb/musb/omap2430.c line 288
Quoted 13 lines
drivers/usb/musb/omap2430.c +13
-0+/* +* As per the omap-usbotg specification, configure it to forced standby +* and force idle mode when no activity on usb. +*/ +void __iomem *musb_base = musb->mregs; + +musb_writel (musb_base,OTG_FORCESTDBY ,0 ); + +musb_writel (musb_base,OTG_SYSCONFIG ,musb_readl (musb_base, +OTG_SYSCONFIG ) & ~(NOSTDBY |SMARTSTDBY )); + +musb_writel (musb_base,OTG_SYSCONFIG ,musb_readl (musb_base, +OTG_SYSCONFIG ) & ~(AUTOIDLE ));
Pointless parens around AUTOIDLE...
Quoted 11 lines
drivers/usb/musb/omap2430.c +4
-2+musb_writel (musb_base,OTG_SYSCONFIG ,musb_readl (musb_base, +OTG_SYSCONFIG ) & ~(NOIDLE |SMARTIDLE )); + +musb_writel (musb_base,OTG_FORCESTDBY ,1 ); }void musb_platform_restore_context (struct musb *musb,struct musb_context_registers *musb_context) { -musb_writel (musb->mregs,OTG_SYSCONFIG , musb_context->otg_sysconfig); -musb_writel (musb->mregs,OTG_FORCESTDBY , musb_context->otg_forcestandby);
drivers/usb/musb/omap2430.c line 308
Quoted 10 lines
drivers/usb/musb/omap2430.c +10
-0+/* +* As per the omap-usbotg specification, configure it smart standby +* and smart idle during operation. +*/ +void __iomem *musb_base = musb->mregs; + +musb_writel (musb_base,OTG_FORCESTDBY ,0 ); + +musb_writel (musb_base,OTG_SYSCONFIG ,musb_readl (musb_base, +OTG_SYSCONFIG ) | (SMARTSTDBY ));
Pointless parens around SMARTSTDBY...
drivers/usb/musb/omap2430.c line 309
Quoted 2 lines
drivers/usb/musb/omap2430.c +2
-0+musb_writel (musb_base,OTG_SYSCONFIG ,musb_readl (musb_base, +OTG_SYSCONFIG ) | (SMARTIDLE ));
Pointless parens around SMARTIDLE...
WBR, Sergei
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 6 lines · Hema
From: Hema HK<[email protected]>
With OMAP core-off support musb was not functional as context was getting lost after wakeup from core-off. And also musb was blocking the core-off after loading the gadget driver even with no cable connected sometimes.
Quoted 8 lines
Added the conext save/restore api in the platform layer which will be called in the idle and wakeup path.
Changed the usb sysconfig settings as per the usbotg functional spec. When the device is not active, configure to force idle and force standby mode. When it is being used, configure in smart standby and smart idle mode. So while attempting to coreoff the usb is configured to force standby and force idle mode, after wakeup configured in smart idle and smart standby.
Is this valid for OMAP3 and OMAP4? I checked quickly the OMAP4 TRM vB in the USB_OTG chapter related to PM (23.13.4.2 Power-Management), and I cannot find any note regarding that specific programming model. Could give us reference to the documentation that contains the details about that?
Benoit
Quoted 214 lines
Signed-off-by Hema HK<[email protected]>Signed-off-by Maulik Mankad<[email protected]>Cc Felipe Balbi<[email protected]>Cc Tony Lindgren<[email protected]>Cc Kevin Hilman<[email protected]>---
arch/arm/mach-omap2/pm34xx.c | 4 ++ arch/arm/mach-omap2/usb-musb.c | 21 ++++++++++++++ arch/arm/plat-omap/include/plat/usb.h | 2 + drivers/usb/musb/musb_core.c | 11 ------- drivers/usb/musb/omap2430.c | 48 +++++++++++++++++++++++++++++++--- 5 files changed, 71 insertions(+), 15 deletions(-)Index:
linux-omap-pm/arch/arm/mach-omap2/pm34xx.c
===================================================================arch/arm/mach-omap2/pm34xx.c +5
-0@@ -39,6 +39,7 @@#include <plat/gpmc.h> #include <plat/dma.h> #include <plat/dmtimer.h> +#include <plat/usb.h> #include <asm/tlbflush.h> @@ -416,6 +417,8 @@if (core_next_state ==PWRDM_POWER_OFF ) {omap3_core_save_context ();omap3_prcm_save_context (); +/* Save MUSB context */ +musb_context_save_restore (1 ); } }@@ -458,6 +461,8 @@omap3_prcm_restore_context ();omap3_sram_restore_context ();omap2_sms_restore_context (); +/* restore MUSB context */ +musb_context_save_restore (0 ); }omap_uart_resume_idle (0 );omap_uart_resume_idle (1 );Index:
linux-omap-pm/arch/arm/mach-omap2/usb-musb.c
===================================================================arch/arm/mach-omap2/usb-musb.c +21
-0@@ -120,6 +120,27 @@ } } +void musb_context_save_restore (int save) +{ +struct omap_hwmod *oh =omap_hwmod_lookup ("usb_otg_hs" ); +struct omap_device *od = oh->od; +struct platform_device *pdev =&od->pdev; +struct device *dev =&pdev->dev; +struct device_driver *drv = dev->driver; + +if (drv) { +struct musb_hdrc_platform_data *pdata = dev->platform_data; +const struct dev_pm_ops *pm = drv->pm; +if (!pdata->is_usb_active (dev)) { + +if (save) + pm->suspend (dev); +else + pm->resume_noirq (dev); + } + } +} +#else void __init usb_musb_init (struct omap_musb_board_data *board_data) {Index:
linux-omap-pm/arch/arm/plat-omap/include/plat/usb.h
===================================================================arch/arm/plat-omap/include/plat/usb.h +2
-0@@ -79,6 +79,8 @@extern void usb_ohci_init (const struct ohci_hcd_omap_platform_data *pdata); +/* For saving and restoring the musb context during off/wakeup*/ +extern void musb_context_save_restore (int save);#endif Index:
linux-omap-pm/drivers/usb/musb/musb_core.c
===================================================================drivers/usb/musb/musb_core.c +0
-11@@ -2427,11 +2427,6 @@ }musb_save_context (musb); - -if (musb->set_clock) - musb->set_clock (musb->clock,0 ); -else -clk_disable (musb->clock);spin_unlock_irqrestore (&musb->lock, flags);return 0 ; }@@ -2443,12 +2438,6 @@if (!musb->clock)return 0 ; - -if (musb->set_clock) - musb->set_clock (musb->clock,1 ); -else -clk_enable (musb->clock); -musb_restore_context (musb);/* for static cmos like DaVinci, register values were preserved Index:
linux-omap-pm/drivers/usb/musb/omap2430.c
===================================================================drivers/usb/musb/omap2430.c +45
-4@@ -189,6 +189,19 @@return 0 ; } +int is_musb_active (struct device *dev) +{ +struct musb *musb; + +#ifdef CONFIG_USB_MUSB_HDRC_HCD +/* usbcore insists dev->driver_data is a "struct hcd *" */ + musb =hcd_to_musb (dev_get_drvdata (dev)); +#else + musb =dev_get_drvdata (dev); +#endif +return musb->is_active; +} +int __init musb_platform_init (struct musb *musb) {u32 l;@@ -250,6 +263,7 @@if (is_host_enabled (musb)) musb->board_set_vbus = omap_set_vbus; + plat->is_usb_active = is_musb_active;setup_timer (&musb_idle_timer, musb_do_idle, (unsigned long ) musb);return 0 ;@@ -259,15 +273,42 @@void musb_platform_save_context (struct musb *musb,struct musb_context_registers *musb_context) { - musb_context->otg_sysconfig =musb_readl (musb->mregs,OTG_SYSCONFIG ); - musb_context->otg_forcestandby =musb_readl (musb->mregs,OTG_FORCESTDBY ); +/* +* As per the omap-usbotg specification, configure it to forced standby +* and force idle mode when no activity on usb. +*/ +void __iomem *musb_base = musb->mregs; + +musb_writel (musb_base,OTG_FORCESTDBY ,0 ); + +musb_writel (musb_base,OTG_SYSCONFIG ,musb_readl (musb_base, +OTG_SYSCONFIG )& ~(NOSTDBY |SMARTSTDBY )); + +musb_writel (musb_base,OTG_SYSCONFIG ,musb_readl (musb_base, +OTG_SYSCONFIG )& ~(AUTOIDLE )); + +musb_writel (musb_base,OTG_SYSCONFIG ,musb_readl (musb_base, +OTG_SYSCONFIG )& ~(NOIDLE |SMARTIDLE )); + +musb_writel (musb_base,OTG_FORCESTDBY ,1 ); }void musb_platform_restore_context (struct musb *musb,struct musb_context_registers *musb_context) { -musb_writel (musb->mregs,OTG_SYSCONFIG , musb_context->otg_sysconfig); -musb_writel (musb->mregs,OTG_FORCESTDBY , musb_context->otg_forcestandby); +/* +* As per the omap-usbotg specification, configure it smart standby +* and smart idle during operation. +*/ +void __iomem *musb_base = musb->mregs; + +musb_writel (musb_base,OTG_FORCESTDBY ,0 ); + +musb_writel (musb_base,OTG_SYSCONFIG ,musb_readl (musb_base, +OTG_SYSCONFIG ) | (SMARTSTDBY )); + +musb_writel (musb_base,OTG_SYSCONFIG ,musb_readl (musb_base, +OTG_SYSCONFIG ) | (SMARTIDLE )); }#endif Index:
linux-omap-pm/include/linux/usb/musb.h
===================================================================include/linux/usb/musb.h +3
-1@@ -126,6 +126,9 @@/* Architecture specific board data */ void *board_data; + +/* check usb device active state*/ +int (*is_usb_active)(struct device *dev); }; --
Quoted 3 lines
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi,
Quoted 31 lines
-----Original Message-----
From: Cousson, Benoit
Sent: Monday, August 09, 2010 6:31 PM
To: Kalliguddi, Hema
Cc: [email protected]; [email protected]; Mankad, Maulik Ojas; Felipe Balbi; Tony Lindgren; Kevin Hilman
Subject: Re: [PATCH V2 6/8] usb: musb: Offmode fix for idle pathQuoted 3 lines · Hema
From: Hema HK<[email protected]>
With OMAP core-off support musb was not functional as
context was getting
Quoted 1 line
lost after wakeup from core-off. And also musb was blocking
the core-off
Quoted 1 line
after loading the gadget driver even with no cable connected
sometimes.
Quoted 6 lines
Added the conext save/restore api in the platform layer which will be called in the idle and wakeup path.
Changed the usb sysconfig settings as per the usbotg functional spec. When the device is not active, configure to force idle and
force standby mode.
Quoted 1 line
When it is being used, configure in smart standby and smart
idle mode.
Quoted 1 line
So while attempting to coreoff the usb is configured to
force standby and
Quoted 1 line
force idle mode, after wakeup configured in smart idle and
smart standby.
Quoted 9 lines
Is this valid for OMAP3 and OMAP4? I checked quickly the OMAP4 TRM vB in
theUSB_OTGchapter related to PM (23.13.4.2 Power-Management), and I cannot find any note regarding that specific programming model. Could give us reference to the documentation that contains the details about that?Benoit
This is valid for both OMAP3 and OMAP4. You can find this in 24.1.5.4 section With different modes. When not used with any application the mode has to be programmed is force idle and force standby. What I observed is that without this USB was blocking the coreoff.
http://focus.ti.com/pdfs/wtbu/SWPU223D_Final_EPDF_06_07_2010.pdf
Regards,
Hema
Quoted 243 lines
Quoted 7 lines
Signed-off-by Hema HK<[email protected]>Signed-off-by Maulik Mankad<[email protected]>Cc Felipe Balbi<[email protected]>Cc Tony Lindgren<[email protected]>Cc Kevin Hilman<[email protected]>Quoted 7 lines
---
arch/arm/mach-omap2/pm34xx.c | 4 ++ arch/arm/mach-omap2/usb-musb.c | 21 ++++++++++++++ arch/arm/plat-omap/include/plat/usb.h | 2 + drivers/usb/musb/musb_core.c | 11 ------- drivers/usb/musb/omap2430.c | 48+++++++++++++++++++++++++++++++---
Quoted 5 lines
5 files changed, 71 insertions(+), 15 deletions(-)Index:
linux-omap-pm/arch/arm/mach-omap2/pm34xx.c
===================================================================
---linux-omap-pm.orig/arch/arm/mach-omap2/pm34xx.c2010-08-06 09:23:01.153862710 -0400Quoted 1 line
+++
linux-omap-pm/arch/arm/mach-omap2/pm34xx.c2010-08-06 10:44:06.393863125 -0400Quoted 26 lines
arch/arm/mach-omap2/pm34xx.c +5
-0@@ -39,6 +39,7 @@#include <plat/gpmc.h> #include <plat/dma.h> #include <plat/dmtimer.h> +#include <plat/usb.h> #include <asm/tlbflush.h> @@ -416,6 +417,8 @@if (core_next_state ==PWRDM_POWER_OFF ) {omap3_core_save_context ();omap3_prcm_save_context (); +/* Save MUSB context */ +musb_context_save_restore (1 ); } }@@ -458,6 +461,8 @@omap3_prcm_restore_context ();omap3_sram_restore_context ();omap2_sms_restore_context (); +/* restore MUSB context */ +musb_context_save_restore (0 ); }omap_uart_resume_idle (0 );omap_uart_resume_idle (1 );Quoted 3 lines
Index:
linux-omap-pm/arch/arm/mach-omap2/usb-musb.c
===================================================================
---linux-omap-pm.orig/arch/arm/mach-omap2/usb-musb.c2010-08-06 09:24:23.690112596 -0400Quoted 1 line
+++
linux-omap-pm/arch/arm/mach-omap2/usb-musb.c2010-08-06 10:44:06.385862697 -0400Quoted 4 lines
arch/arm/mach-omap2/usb-musb.c +0
-0@@ -120,6 +120,27 @@ } }arch/arm/mach-omap2/usb-musb.c line 132
Quoted 10 lines
arch/arm/mach-omap2/usb-musb.c +10
-0+void musb_context_save_restore (int save) +{ +struct omap_hwmod *oh =omap_hwmod_lookup ("usb_otg_hs" ); +struct omap_device *od = oh->od; +struct platform_device *pdev =&od->pdev; +struct device *dev =&pdev->dev; +struct device_driver *drv = dev->driver; + +if (drv) { + struct musb_hdrc_platform_data *pdata =
dev->platform_data;Quoted 14 lines
arch/arm/mach-omap2/usb-musb.c +11
-0+const struct dev_pm_ops *pm = drv->pm; +if (!pdata->is_usb_active (dev)) { + +if (save) + pm->suspend (dev); +else + pm->resume_noirq (dev); + } + } +} +#else void __init usb_musb_init (struct omap_musb_board_data *board_data) {Quoted 3 lines
Index:
linux-omap-pm/arch/arm/plat-omap/include/plat/usb.h
===================================================================
---linux-omap-pm.orig/arch/arm/plat-omap/include/plat/usb.h2010-08-06 09:23:01.137862514 -0400Quoted 1 line
+++
linux-omap-pm/arch/arm/plat-omap/include/plat/usb.h2010-08-06 10:44:06.381864367 -0400Review line 80
Quoted 3 lines
(quoted diff) +0
-0@@ -79,6 +79,8 @@ extern void usb_ohci_init(const struct
ohci_hcd_omap_platform_data*pdata);Quoted 9 lines
arch/arm/plat-omap/include/plat/usb.h +2
-0+/* For saving and restoring the musb context during off/wakeup*/ +extern void musb_context_save_restore (int save);#endif Index:
linux-omap-pm/drivers/usb/musb/musb_core.c
===================================================================
---linux-omap-pm.orig/drivers/usb/musb/musb_core.c2010-08-06 09:24:21.069863329 -0400Quoted 1 line
+++
linux-omap-pm/drivers/usb/musb/musb_core.c2010-08-06 10:44:06.369863527 -0400Quoted 25 lines
drivers/usb/musb/musb_core.c +0
-11@@ -2427,11 +2427,6 @@ }musb_save_context (musb); - -if (musb->set_clock) - musb->set_clock (musb->clock,0 ); -else -clk_disable (musb->clock);spin_unlock_irqrestore (&musb->lock, flags);return 0 ; }@@ -2443,12 +2438,6 @@if (!musb->clock)return 0 ; - -if (musb->set_clock) - musb->set_clock (musb->clock,1 ); -else -clk_enable (musb->clock); -musb_restore_context (musb);/* for static cmos like DaVinci, register values were preserved Quoted 3 lines
Index:
linux-omap-pm/drivers/usb/musb/omap2430.c
===================================================================
---linux-omap-pm.orig/drivers/usb/musb/omap2430.c2010-08-06 09:24:21.069863329 -0400Quoted 1 line
+++
linux-omap-pm/drivers/usb/musb/omap2430.c2010-08-06 10:44:30.093914217 -0400Quoted 21 lines
drivers/usb/musb/omap2430.c +13
-0@@ -189,6 +189,19 @@return 0 ; } +int is_musb_active (struct device *dev) +{ +struct musb *musb; + +#ifdef CONFIG_USB_MUSB_HDRC_HCD +/* usbcore insists dev->driver_data is a "struct hcd *" */ + musb =hcd_to_musb (dev_get_drvdata (dev)); +#else + musb =dev_get_drvdata (dev); +#endif +return musb->is_active; +} +int __init musb_platform_init (struct musb *musb) {u32 l;drivers/usb/musb/omap2430.c line 267
Quoted 5 lines
drivers/usb/musb/omap2430.c +1
-0@@ -250,6 +263,7 @@if (is_host_enabled (musb)) musb->board_set_vbus = omap_set_vbus; + plat->is_usb_active = is_musb_active; setup_timer(&musb_idle_timer, musb_do_idle, (unsignedlong) musb);
drivers/usb/musb/omap2430.c line 262
Quoted 7 lines
drivers/usb/musb/omap2430.c +0
-1return 0 ;@@ -259,15 +273,42 @@void musb_platform_save_context (struct musb *musb,struct musb_context_registers *musb_context) { - musb_context->otg_sysconfig = musb_readl(musb->mregs,
OTG_SYSCONFIG);Review line 263
Quoted 1 line
(quoted diff) +0
-1- musb_context->otg_forcestandby =
musb_readl(musb->mregs, OTG_FORCESTDBY);Review line 277
Quoted 2 lines
(quoted diff) +2
-0+ /* + * As per the omap-usbotg specification, configure itto forced standby
drivers/usb/musb/omap2430.c
Quoted 8 lines
drivers/usb/musb/omap2430.c +8
-0+* and force idle mode when no activity on usb. +*/ +void __iomem *musb_base = musb->mregs; + +musb_writel (musb_base,OTG_FORCESTDBY ,0 ); + + musb_writel(musb_base, OTG_SYSCONFIG, musb_readl(musb_base, + OTG_SYSCONFIG)& ~(NOSTDBY |SMARTSTDBY));
Quoted 4 lines
drivers/usb/musb/omap2430.c +4
-0+ +musb_writel (musb_base,OTG_SYSCONFIG ,musb_readl (musb_base, +OTG_SYSCONFIG )& ~(AUTOIDLE )); +drivers/usb/musb/omap2430.c
Quoted 10 lines
drivers/usb/musb/omap2430.c +4
-1+musb_writel (musb_base,OTG_SYSCONFIG ,musb_readl (musb_base, +OTG_SYSCONFIG )& ~(NOIDLE |SMARTIDLE )); + +musb_writel (musb_base,OTG_FORCESTDBY ,1 ); }void musb_platform_restore_context (struct musb *musb,struct musb_context_registers *musb_context) { - musb_writel(musb->mregs, OTG_SYSCONFIG,
musb_context->otg_sysconfig);Review line 270
Quoted 1 line
(quoted diff) +0
-1- musb_writel(musb->mregs, OTG_FORCESTDBY,
musb_context->otg_forcestandby);Review line 300
Quoted 2 lines
(quoted diff) +2
-0+ /* + * As per the omap-usbotg specification, configure itsmart standby
Quoted 14 lines
drivers/usb/musb/omap2430.c +11
-0+* and smart idle during operation. +*/ +void __iomem *musb_base = musb->mregs; + +musb_writel (musb_base,OTG_FORCESTDBY ,0 ); + +musb_writel (musb_base,OTG_SYSCONFIG ,musb_readl (musb_base, +OTG_SYSCONFIG ) | (SMARTSTDBY )); + +musb_writel (musb_base,OTG_SYSCONFIG ,musb_readl (musb_base, + OTG_SYSCONFIG) | (SMARTIDLE)); }#endif Quoted 3 lines
Index:
linux-omap-pm/include/linux/usb/musb.h
===================================================================
---linux-omap-pm.orig/include/linux/usb/musb.h2010-08-06 09:23:01.161864151 -0400Quoted 1 line
+++
linux-omap-pm/include/linux/usb/musb.h2010-08-0610:44:06.401862567 -0400
Quoted 11 lines
include/linux/usb/musb.h +3
-1@@ -126,6 +126,9 @@/* Architecture specific board data */ void *board_data; + +/* check usb device active state*/ +int (*is_usb_active)(struct device *dev); }; --Quoted 1 line
To unsubscribe from this list: send the line "unsubscribe
linux-omap" in
Quoted 2 lines
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Hema,
Quoted 80 lines
-----Original Message-----
From: [email protected] [mailto:linux-omap- [email protected]] On Behalf Of Hema HK
Sent: Friday, August 06, 2010 10:57 PM
To: [email protected]; [email protected]
Cc: Kalliguddi, Hema; Mankad, Maulik Ojas; Felipe Balbi; Tony Lindgren;
Kevin Hilman
Subject: [PATCH V2 6/8] usb: musb: Offmode fix for idle pathFrom: Hema HK <[email protected]>
With OMAP core-off support musb was not functional as context was getting lost after wakeup from core-off. And also musb was blocking the core-off after loading the gadget driver even with no cable connected sometimes.
Added the conext save/restore api in the platform layer which will be called in the idle and wakeup path.
Changed the usb sysconfig settings as per the usbotg functional spec. When the device is not active, configure to force idle and force standby mode.
When it is being used, configure in smart standby and smart idle mode. So while attempting to coreoff the usb is configured to force standby and force idle mode, after wakeup configured in smart idle and smart standby.Signed-off-by Hema HK <[email protected]>Signed-off-by Maulik Mankad <[email protected]>Cc Felipe Balbi <[email protected]>Cc Tony Lindgren <[email protected]>Cc Kevin Hilman <[email protected]>---
arch/arm/mach-omap2/pm34xx.c | 4 ++ arch/arm/mach-omap2/usb-musb.c | 21 ++++++++++++++ arch/arm/plat-omap/include/plat/usb.h | 2 + drivers/usb/musb/musb_core.c | 11 ------- drivers/usb/musb/omap2430.c | 48 +++++++++++++++++++++++++++++++--- 5 files changed, 71 insertions(+), 15 deletions(-)Index:
linux-omap-pm/arch/arm/mach-omap2/pm34xx.c
===================================================================
---linux-omap-pm.orig/arch/arm/mach-omap2/pm34xx.c2010-08-06
09:23:01.153862710 -0400
+++linux-omap-pm/arch/arm/mach-omap2/pm34xx.c2010-08-06
10:44:06.393863125 -0400arch/arm/mach-omap2/pm34xx.c +5
-0@@ -39,6 +39,7 @@#include <plat/gpmc.h> #include <plat/dma.h> #include <plat/dmtimer.h> +#include <plat/usb.h> #include <asm/tlbflush.h> @@ -416,6 +417,8 @@if (core_next_state ==PWRDM_POWER_OFF ) {omap3_core_save_context ();omap3_prcm_save_context (); +/* Save MUSB context */ +musb_context_save_restore (1 ); } }@@ -458,6 +461,8 @@omap3_prcm_restore_context ();omap3_sram_restore_context ();omap2_sms_restore_context (); +/* restore MUSB context */ +musb_context_save_restore (0 ); }omap_uart_resume_idle (0 );omap_uart_resume_idle (1 );Index:
linux-omap-pm/arch/arm/mach-omap2/usb-musb.c
===================================================================
---linux-omap-pm.orig/arch/arm/mach-omap2/usb-musb.c2010-08-06
09:24:23.690112596 -0400
+++linux-omap-pm/arch/arm/mach-omap2/usb-musb.c2010-08-06
10:44:06.385862697 -0400
arch/arm/mach-omap2/usb-musb.c line 125
Quoted 6 lines
arch/arm/mach-omap2/usb-musb.c +3
-0@@ -120,6 +120,27 @@ } } +void musb_context_save_restore (int save) +{ +struct omap_hwmod *oh =omap_hwmod_lookup ("usb_otg_hs" );
Might be good idea to check (oh) before proceeding?
if (!oh) {
/* error message */
return;
}Quoted 112 lines
arch/arm/mach-omap2/usb-musb.c +18
-0+struct omap_device *od = oh->od; +struct platform_device *pdev = &od->pdev; +struct device *dev = &pdev->dev; +struct device_driver *drv = dev->driver; + +if (drv) { +struct musb_hdrc_platform_data *pdata = dev->platform_data; +const struct dev_pm_ops *pm = drv->pm; +if (!pdata->is_usb_active (dev)) { + +if (save) + pm->suspend (dev); +else + pm->resume_noirq (dev); + } + } +} +#else void __init usb_musb_init (struct omap_musb_board_data *board_data) {Index:
linux-omap-pm/arch/arm/plat-omap/include/plat/usb.h
===================================================================
---linux-omap-pm.orig/arch/arm/plat-omap/include/plat/usb.h2010-08-
06 09:23:01.137862514 -0400
+++linux-omap-pm/arch/arm/plat-omap/include/plat/usb.h2010-08-06
10:44:06.381864367 -0400arch/arm/plat-omap/include/plat/usb.h +2
-0@@ -79,6 +79,8 @@extern void usb_ohci_init (const struct ohci_hcd_omap_platform_data *pdata); +/* For saving and restoring the musb context during off/wakeup*/ +extern void musb_context_save_restore (int save);#endif Index:
linux-omap-pm/drivers/usb/musb/musb_core.c
===================================================================
---linux-omap-pm.orig/drivers/usb/musb/musb_core.c2010-08-06
09:24:21.069863329 -0400
+++linux-omap-pm/drivers/usb/musb/musb_core.c2010-08-06
10:44:06.369863527 -0400drivers/usb/musb/musb_core.c +0
-11@@ -2427,11 +2427,6 @@ }musb_save_context (musb); - -if (musb->set_clock) - musb->set_clock (musb->clock,0 ); -else -clk_disable (musb->clock);spin_unlock_irqrestore (&musb->lock, flags);return 0 ; }@@ -2443,12 +2438,6 @@if (!musb->clock)return 0 ; - -if (musb->set_clock) - musb->set_clock (musb->clock,1 ); -else -clk_enable (musb->clock); -musb_restore_context (musb);/* for static cmos like DaVinci, register values were preserved Index:
linux-omap-pm/drivers/usb/musb/omap2430.c
===================================================================
---linux-omap-pm.orig/drivers/usb/musb/omap2430.c2010-08-06
09:24:21.069863329 -0400
+++linux-omap-pm/drivers/usb/musb/omap2430.c2010-08-06
10:44:30.093914217 -0400drivers/usb/musb/omap2430.c +16
-2@@ -189,6 +189,19 @@return 0 ; } +int is_musb_active (struct device *dev) +{ +struct musb *musb; + +#ifdef CONFIG_USB_MUSB_HDRC_HCD +/* usbcore insists dev->driver_data is a "struct hcd *" */ + musb =hcd_to_musb (dev_get_drvdata (dev)); +#else + musb =dev_get_drvdata (dev); +#endif +return musb->is_active; +} +int __init musb_platform_init (struct musb *musb) {u32 l;@@ -250,6 +263,7 @@if (is_host_enabled (musb)) musb->board_set_vbus = omap_set_vbus; + plat->is_usb_active = is_musb_active;setup_timer (&musb_idle_timer, musb_do_idle, (unsigned long ) musb);return 0 ;@@ -259,15 +273,42 @@void musb_platform_save_context (struct musb *musb,struct musb_context_registers *musb_context) { - musb_context->otg_sysconfig =musb_readl (musb->mregs,OTG_SYSCONFIG ); - musb_context->otg_forcestandby =musb_readl (musb->mregs, OTG_FORCESTDBY); +/* +* As per the omap-usbotg specification, configure it to forced standby
drivers/usb/musb/omap2430.c line 281
Quoted 4 lines
drivers/usb/musb/omap2430.c +4
-0+* and force idle mode when no activity on usb. +*/ +void __iomem *musb_base = musb->mregs; +
Just to clarify, have you already taken care of ioremap() / request_mem_region() for musb_base?
Quoted 53 lines
drivers/usb/musb/omap2430.c +12
-2+musb_writel (musb_base,OTG_FORCESTDBY ,0 ); + +musb_writel (musb_base,OTG_SYSCONFIG ,musb_readl (musb_base, +OTG_SYSCONFIG ) & ~(NOSTDBY |SMARTSTDBY )); + +musb_writel (musb_base,OTG_SYSCONFIG ,musb_readl (musb_base, +OTG_SYSCONFIG ) & ~(AUTOIDLE )); + +musb_writel (musb_base,OTG_SYSCONFIG ,musb_readl (musb_base, +OTG_SYSCONFIG ) & ~(NOIDLE |SMARTIDLE )); + +musb_writel (musb_base,OTG_FORCESTDBY ,1 ); }void musb_platform_restore_context (struct musb *musb,struct musb_context_registers *musb_context) { -musb_writel (musb->mregs,OTG_SYSCONFIG , musb_context->otg_sysconfig); - musb_writel(musb->mregs, OTG_FORCESTDBY, musb_context-Quoted 1 line
otg_forcestandby);drivers/usb/musb/omap2430.c +13
-0+/* +* As per the omap-usbotg specification, configure it smart standby +* and smart idle during operation. +*/ +void __iomem *musb_base = musb->mregs; + +musb_writel (musb_base,OTG_FORCESTDBY ,0 ); + +musb_writel (musb_base,OTG_SYSCONFIG ,musb_readl (musb_base, +OTG_SYSCONFIG ) | (SMARTSTDBY )); + +musb_writel (musb_base,OTG_SYSCONFIG ,musb_readl (musb_base, + OTG_SYSCONFIG) | (SMARTIDLE)); }#endif Index:
linux-omap-pm/include/linux/usb/musb.h
===================================================================
---linux-omap-pm.orig/include/linux/usb/musb.h2010-08-06
09:23:01.161864151 -0400
+++linux-omap-pm/include/linux/usb/musb.h2010-08-06 10:44:06.401862567
-0400include/linux/usb/musb.h +3
-1@@ -126,6 +126,9 @@/* Architecture specific board data */ void *board_data; + +/* check usb device active state*/ +int (*is_usb_active)(struct device *dev); }; --
Quoted 3 lines
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
"Kalliguddi, Hema" <[email protected]> writes:
[...]
Quoted 21 lines
Quoted 11 lines
Quoted 3 lines
Changed the usb sysconfig settings as per the usbotg functional spec. When the device is not active, configure to force idle and
force standby mode.
Quoted 1 line
When it is being used, configure in smart standby and smart
idle mode.
Quoted 1 line
So while attempting to coreoff the usb is configured to
force standby and
Quoted 1 line
force idle mode, after wakeup configured in smart idle and
smart standby.
Quoted 9 lines
Is this valid for OMAP3 and OMAP4? I checked quickly the OMAP4 TRM vB in
theUSB_OTGchapter related to PM (23.13.4.2 Power-Management), and I cannot find any note regarding that specific programming model. Could give us reference to the documentation that contains the details about that?Benoit
Quoted 7 lines
This is valid for both OMAP3 and OMAP4. You can find this in 24.1.5.4 section With different modes. When not used with any application the mode has to be programmed is force idle and force standby. What I observed is that without this USB was blocking the coreoff.
http://focus.ti.com/pdfs/wtbu/SWPU223D_Final_EPDF_06_07_2010.pdf
For the next rev, please include links to public docs in the changelog.
Kevin
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 152 lines
-----Original Message-----
From: Bob Liu [mailto:[email protected]]
Sent: Saturday, August 07, 2010 7:54 AM
To: Kalliguddi, Hema
Cc: [email protected]; [email protected]; Mankad, Maulik Ojas; Felipe Balbi; Tony Lindgren; Kevin Hilman
Subject: Re: [PATCH V2 6/8] usb: musb: Offmode fix for idle pathQuoted 3 lines · Hema HK
From: Hema HK <[email protected]>
With OMAP core-off support musb was not functional as
context was getting
Quoted 1 line
lost after wakeup from core-off. And also musb was blocking
the core-off
Quoted 1 line
after loading the gadget driver even with no cable connected
sometimes.
Quoted 6 lines
Added the conext save/restore api in the platform layer which will be called in the idle and wakeup path.
Changed the usb sysconfig settings as per the usbotg functional spec. When the device is not active, configure to force idle and
force standby mode.
Quoted 1 line
When it is being used, configure in smart standby and smart
idle mode.
Quoted 1 line
So while attempting to coreoff the usb is configured to
force standby and
Quoted 1 line
force idle mode, after wakeup configured in smart idle and
smart standby.
Quoted 7 lines
Signed-off-by Hema HK <[email protected]>Signed-off-by Maulik Mankad <[email protected]>Cc Felipe Balbi <[email protected]>Cc Tony Lindgren <[email protected]>Cc Kevin Hilman <[email protected]>Quoted 7 lines
---
arch/arm/mach-omap2/pm34xx.c | 4 ++
arch/arm/mach-omap2/usb-musb.c| 21 ++++++++++++++arch/arm/plat-omap/include/plat/usb.h| 2 +drivers/usb/musb/musb_core.c| 11 -------drivers/usb/musb/omap2430.c| 48+++++++++++++++++++++++++++++++---
Quoted 5 lines
5 files changed, 71 insertions(+), 15 deletions(-)Index:
linux-omap-pm/arch/arm/mach-omap2/pm34xx.c
===================================================================
---linux-omap-pm.orig/arch/arm/mach-omap2/pm34xx.c2010-08-06 09:23:01.153862710 -0400Quoted 1 line
+++
linux-omap-pm/arch/arm/mach-omap2/pm34xx.c2010-08-0610:44:06.393863125 -0400
Quoted 26 lines
arch/arm/mach-omap2/pm34xx.c +5
-0@@ -39,6 +39,7 @@ #include <plat/gpmc.h> #include <plat/dma.h> #include <plat/dmtimer.h> +#include <plat/usb.h> #include <asm/tlbflush.h>@@ -416,6 +417,8 @@ if (core_next_state == PWRDM_POWER_OFF) { omap3_core_save_context(); omap3_prcm_save_context(); + /* Save MUSB context */ + musb_context_save_restore(1); } }@@ -458,6 +461,8 @@ omap3_prcm_restore_context(); omap3_sram_restore_context(); omap2_sms_restore_context(); + /* restore MUSB context */ + musb_context_save_restore(0); } omap_uart_resume_idle(0); omap_uart_resume_idle(1);Quoted 3 lines
Index:
linux-omap-pm/arch/arm/mach-omap2/usb-musb.c
===================================================================
---linux-omap-pm.orig/arch/arm/mach-omap2/usb-musb.c2010-08-06 09:24:23.690112596 -0400Quoted 1 line
+++
linux-omap-pm/arch/arm/mach-omap2/usb-musb.c2010-08-06 10:44:06.385862697 -0400Quoted 4 lines
arch/arm/mach-omap2/usb-musb.c +0
-0@@ -120,6 +120,27 @@ } }arch/arm/mach-omap2/usb-musb.c line 132
Quoted 10 lines
arch/arm/mach-omap2/usb-musb.c +10
-0+void musb_context_save_restore (int save) +{ + struct omap_hwmod *oh = omap_hwmod_lookup("usb_otg_hs"); + struct omap_device *od = oh->od; + struct platform_device *pdev = &od->pdev; + struct device *dev = &pdev->dev; + struct device_driver *drv = dev->driver; + + if (drv) { + struct musb_hdrc_platform_data *pdata =
dev->platform_data;Quoted 14 lines
arch/arm/mach-omap2/usb-musb.c +11
-0+ const struct dev_pm_ops *pm = drv->pm; + if (!pdata->is_usb_active(dev)) { + + if (save) + pm->suspend(dev); + else + pm->resume_noirq(dev); + } + } +} + #else void __init usb_musb_init(struct omap_musb_board_data *board_data) {Quoted 3 lines
Index:
linux-omap-pm/arch/arm/plat-omap/include/plat/usb.h
===================================================================
---linux-omap-pm.orig/arch/arm/plat-omap/include/plat/usb.h2010-08-06 09:23:01.137862514 -0400Quoted 1 line
+++
linux-omap-pm/arch/arm/plat-omap/include/plat/usb.h2010-08-06 10:44:06.381864367 -0400Quoted 3 lines
(quoted diff) +0
-0@@ -79,6 +79,8 @@extern void usb_ohci_init(const struct
ohci_hcd_omap_platform_data*pdata);Quoted 9 lines
arch/arm/plat-omap/include/plat/usb.h +2
-0+/* For saving and restoring the musb context during off/wakeup*/ +extern void musb_context_save_restore (int save);#endif
Index:
linux-omap-pm/drivers/usb/musb/musb_core.c
===================================================================
---linux-omap-pm.orig/drivers/usb/musb/musb_core.c2010-08-06 09:24:21.069863329 -0400Quoted 1 line
+++
linux-omap-pm/drivers/usb/musb/musb_core.c2010-08-0610:44:06.369863527 -0400
Quoted 14 lines
drivers/usb/musb/musb_core.c +0
-5@@ -2427,11 +2427,6 @@ } musb_save_context(musb); - - if (musb->set_clock) - musb->set_clock(musb->clock, 0); - else - clk_disable(musb->clock); spin_unlock_irqrestore(&musb->lock, flags); return 0; }@@ -2443,12 +2438,6 @@
Quoted 5 lines
drivers/usb/musb/musb_core.c line 2440
Quoted 2 lines
drivers/usb/musb/musb_core.c +0
-0if (!musb->clock) return 0;Is this check can be deleted also ?
Because our blackfin platform have no clock support now.
I think this can be removed.
Quoted 119 lines
Thanks.
drivers/usb/musb/musb_core.c
Quoted 9 lines
drivers/usb/musb/musb_core.c +0
-6- - if (musb->set_clock) - musb->set_clock(musb->clock, 1); - else - clk_enable(musb->clock); - musb_restore_context(musb); /* for static cmos like DaVinci, register values werepreserved
Quoted 3 lines
Index:
linux-omap-pm/drivers/usb/musb/omap2430.c
===================================================================
---linux-omap-pm.orig/drivers/usb/musb/omap2430.c2010-08-06 09:24:21.069863329 -0400Quoted 1 line
+++
linux-omap-pm/drivers/usb/musb/omap2430.c2010-08-0610:44:30.093914217 -0400
Quoted 25 lines
drivers/usb/musb/omap2430.c +14
-0@@ -189,6 +189,19 @@ return 0; } +int is_musb_active (struct device *dev) +{ + struct musb *musb; + +#ifdef CONFIG_USB_MUSB_HDRC_HCD + /* usbcore insists dev->driver_data is a "struct hcd *" */ + musb = hcd_to_musb(dev_get_drvdata(dev)); +#else + musb = dev_get_drvdata(dev); +#endif + return musb->is_active; +} + int __init musb_platform_init(struct musb *musb) { u32 l;@@ -250,6 +263,7 @@ if (is_host_enabled(musb)) musb->board_set_vbus = omap_set_vbus; + plat->is_usb_active = is_musb_active;Quoted 1 line
setup_timer(&musb_idle_timer,
musb_do_idle, (unsignedlong) musb);
drivers/usb/musb/omap2430.c line 262
Quoted 7 lines
return 0;
drivers/usb/musb/omap2430.c +0
-1@@ -259,15 +273,42 @@ void musb_platform_save_context(struct musb *musb, struct musb_context_registers *musb_context) { - musb_context->otg_sysconfig =
musb_readl(musb->mregs, OTG_SYSCONFIG);Review line 263
Quoted 1 line
(quoted diff) +0
-1- musb_context->otg_forcestandby =
musb_readl(musb->mregs, OTG_FORCESTDBY);Review line 277
Quoted 2 lines
(quoted diff) +2
-0+ /* + * As per the omap-usbotg specification, configureit to forced standby
drivers/usb/musb/omap2430.c
Quoted 8 lines
drivers/usb/musb/omap2430.c +8
-0+* and force idle mode when no activity on usb. +*/ + void __iomem *musb_base = musb->mregs; + + musb_writel(musb_base, OTG_FORCESTDBY, 0); + + musb_writel(musb_base, OTG_SYSCONFIG, musb_readl(musb_base, + OTG_SYSCONFIG) & ~(NOSTDBY |SMARTSTDBY));
drivers/usb/musb/omap2430.c
Quoted 3 lines
drivers/usb/musb/omap2430.c +3
-0+ + musb_writel(musb_base, OTG_SYSCONFIG, musb_readl(musb_base, + OTG_SYSCONFIG) &~(AUTOIDLE));
drivers/usb/musb/omap2430.c
Quoted 3 lines
drivers/usb/musb/omap2430.c +3
-0+ + musb_writel(musb_base, OTG_SYSCONFIG, musb_readl(musb_base, + OTG_SYSCONFIG) & ~(NOIDLE |SMARTIDLE));
drivers/usb/musb/omap2430.c
Quoted 8 lines
drivers/usb/musb/omap2430.c +2
-1+ + musb_writel(musb_base, OTG_FORCESTDBY, 1); } void musb_platform_restore_context(struct musb *musb, struct musb_context_registers *musb_context) { - musb_writel(musb->mregs, OTG_SYSCONFIG,
musb_context->otg_sysconfig);Review line 270
Quoted 1 line
(quoted diff) +0
-1- musb_writel(musb->mregs, OTG_FORCESTDBY,
musb_context->otg_forcestandby);Review line 300
Quoted 2 lines
(quoted diff) +2
-0+ /* + * As per the omap-usbotg specification, configureit smart standby
Quoted 14 lines
drivers/usb/musb/omap2430.c +11
-0+* and smart idle during operation. +*/ + void __iomem *musb_base = musb->mregs; + + musb_writel(musb_base, OTG_FORCESTDBY, 0); + + musb_writel(musb_base, OTG_SYSCONFIG, musb_readl(musb_base, + OTG_SYSCONFIG) | (SMARTSTDBY)); + + musb_writel(musb_base, OTG_SYSCONFIG, musb_readl(musb_base, + OTG_SYSCONFIG) | (SMARTIDLE)); } #endifQuoted 3 lines
Index:
linux-omap-pm/include/linux/usb/musb.h
===================================================================
---linux-omap-pm.orig/include/linux/usb/musb.h2010-08-0609:23:01.161864151 -0400
Quoted 1 line
+++
linux-omap-pm/include/linux/usb/musb.h2010-08-0610:44:06.401862567 -0400
Quoted 10 lines
include/linux/usb/musb.h +3
-0@@ -126,6 +126,9 @@ /* Architecture specific board data */ void *board_data; + + /* check usb device active state*/ + int (*is_usb_active)(struct device *dev); };
Quoted 11 lines
Quoted 2 lines
--
To unsubscribe from this list: send the line "unsubscribelinux-usb" in
Quoted 3 lines
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.htmlSignature · 3 lines
Regards, --Bob --
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi,
Quoted 62 lines
-----Original Message-----
From: Sergei Shtylyov [mailto:[email protected]]
Sent: Saturday, August 07, 2010 8:55 PM
To: Kalliguddi, Hema
Cc: [email protected]; [email protected]; Mankad, Maulik Ojas; Felipe Balbi; Tony Lindgren; Kevin Hilman
Subject: Re: [PATCH V2 6/8] usb: musb: Offmode fix for idle pathHello.
Quoted 1 line · Hema HK
With OMAP core-off support musb was not functional as
context was getting
Quoted 1 line
lost after wakeup from core-off. And also musb was blocking
the core-off
Quoted 1 line
after loading the gadget driver even with no cable connected
sometimes.
Quoted 5 lines
Added the conext save/restore api in the platform layer which will be called in the idle and wakeup path.
Changed the usb sysconfig settings as per the usbotg functional spec. When the device is not active, configure to force idle and
force standby mode.
Quoted 1 line
When it is being used, configure in smart standby and smart
idle mode.
Quoted 1 line
So while attempting to coreoff the usb is configured to
force standby and
Quoted 1 line
force idle mode, after wakeup configured in smart idle and
smart standby.
Quoted 6 lines
Signed-off-by Hema HK <[email protected]>Signed-off-by Maulik Mankad <[email protected]>Cc Felipe Balbi <[email protected]>Cc Tony Lindgren <[email protected]>Cc Kevin Hilman <[email protected]>[...]
Quoted 3 lines
Index:
linux-omap-pm/arch/arm/mach-omap2/usb-musb.c
===================================================================
---linux-omap-pm.orig/arch/arm/mach-omap2/usb-musb.c2010-08-06 09:24:23.690112596 -0400Quoted 1 line
+++
linux-omap-pm/arch/arm/mach-omap2/usb-musb.c2010-08-06 10:44:06.385862697 -0400Quoted 4 lines
arch/arm/mach-omap2/usb-musb.c +0
-0@@ -120,6 +120,27 @@ } }arch/arm/mach-omap2/usb-musb.c line 132
Quoted 10 lines
arch/arm/mach-omap2/usb-musb.c +10
-0+void musb_context_save_restore (int save) +{ +struct omap_hwmod *oh =omap_hwmod_lookup ("usb_otg_hs" ); +struct omap_device *od = oh->od; +struct platform_device *pdev = &od->pdev; +struct device *dev = &pdev->dev; +struct device_driver *drv = dev->driver; + +if (drv) { + struct musb_hdrc_platform_data *pdata =
dev->platform_data;
Quoted 3 lines
arch/arm/mach-omap2/usb-musb.c line 133
Quoted 1 line
arch/arm/mach-omap2/usb-musb.c +1
-0+const struct dev_pm_ops *pm = drv->pm;Should be an empty line after the declaration block...
Ok.
Quoted 34 lines
Quoted 14 lines
arch/arm/mach-omap2/usb-musb.c +10
-0+if (!pdata->is_usb_active (dev)) { + +if (save) + pm->suspend (dev); +else + pm->resume_noirq (dev); + } + } +} +#else void __init usb_musb_init (struct omap_musb_board_data *board_data) {Quoted 3 lines
Index:
linux-omap-pm/drivers/usb/musb/musb_core.c
===================================================================
---linux-omap-pm.orig/drivers/usb/musb/musb_core.c2010-08-06 09:24:21.069863329 -0400Quoted 1 line
+++
linux-omap-pm/drivers/usb/musb/musb_core.c2010-08-06 10:44:06.369863527 -0400Quoted 14 lines
drivers/usb/musb/musb_core.c +0
-5@@ -2427,11 +2427,6 @@ }musb_save_context (musb); - -if (musb->set_clock) - musb->set_clock (musb->clock,0 ); -else -clk_disable (musb->clock);spin_unlock_irqrestore (&musb->lock, flags);return 0 ; }@@ -2443,12 +2438,6 @@
Quoted 12 lines
drivers/usb/musb/musb_core.c line 2441
Quoted 9 lines
drivers/usb/musb/musb_core.c +0
-6if (!musb->clock)return 0 ; - -if (musb->set_clock) - musb->set_clock (musb->clock,1 ); -else -clk_enable (musb->clock); -musb_restore_context (musb);The same question again: are you sure that clocks are auto-gated on
non-OMAP platfroms?
Bon Lui confirmed that there is no clock for blackfin.
Quoted 14 lines
Quoted 4 lines
Index:
linux-omap-pm/drivers/usb/musb/omap2430.c
===================================================================
---linux-omap-pm.orig/drivers/usb/musb/omap2430.c2010-08-06 09:24:21.069863329 -0400Quoted 1 line
+++
linux-omap-pm/drivers/usb/musb/omap2430.c2010-08-06 10:44:30.093914217 -0400[...]
drivers/usb/musb/omap2430.c line 262
Quoted 5 lines
drivers/usb/musb/omap2430.c +0
-1@@ -259,15 +273,42 @@void musb_platform_save_context (struct musb *musb,struct musb_context_registers *musb_context) { - musb_context->otg_sysconfig = musb_readl(musb->mregs,
OTG_SYSCONFIG);
Quoted 6 lines
Review line 263
Quoted 1 line
(quoted diff) +0
-1- musb_context->otg_forcestandby =
musb_readl(musb->mregs, OTG_FORCESTDBY);If you're not saving the registers, you should remove the
corresponding
fields from 'structmusb_context_registers'.
Agreed. I will remove them from the structure.
Quoted 12 lines
Review line 277
Quoted 2 lines
(quoted diff) +2
-0+ /* + * As per the omap-usbotg specification, configure itto forced standby
drivers/usb/musb/omap2430.c
Quoted 8 lines
drivers/usb/musb/omap2430.c +8
-0+* and force idle mode when no activity on usb. +*/ +void __iomem *musb_base = musb->mregs; + +musb_writel (musb_base,OTG_FORCESTDBY ,0 ); + + musb_writel(musb_base, OTG_SYSCONFIG, musb_readl(musb_base, + OTG_SYSCONFIG) & ~(NOSTDBY |SMARTSTDBY));
Quoted 5 lines
drivers/usb/musb/omap2430.c line 288
Quoted 3 lines
drivers/usb/musb/omap2430.c +3
-0+ +musb_writel (musb_base,OTG_SYSCONFIG ,musb_readl (musb_base, +OTG_SYSCONFIG ) & ~(AUTOIDLE ));Pointless parens around AUTOIDLE...
Ok. I will remove.
Quoted 17 lines
drivers/usb/musb/omap2430.c
Quoted 11 lines
drivers/usb/musb/omap2430.c +4
-1+musb_writel (musb_base,OTG_SYSCONFIG ,musb_readl (musb_base, +OTG_SYSCONFIG ) & ~(NOIDLE |SMARTIDLE )); + +musb_writel (musb_base,OTG_FORCESTDBY ,1 ); }void musb_platform_restore_context (struct musb *musb,struct musb_context_registers *musb_context) { - musb_writel(musb->mregs, OTG_SYSCONFIG,
musb_context->otg_sysconfig);Review line 270
Quoted 1 line
(quoted diff) +0
-1- musb_writel(musb->mregs, OTG_FORCESTDBY,
musb_context->otg_forcestandby);Review line 299
Quoted 2 lines
(quoted diff) +2
-0+ /* + * As per the omap-usbotg specification, configure itsmart standby
Quoted 10 lines
drivers/usb/musb/omap2430.c line 308
Quoted 8 lines
drivers/usb/musb/omap2430.c +8
-0+* and smart idle during operation. +*/ +void __iomem *musb_base = musb->mregs; + +musb_writel (musb_base,OTG_FORCESTDBY ,0 ); + +musb_writel (musb_base,OTG_SYSCONFIG ,musb_readl (musb_base, +OTG_SYSCONFIG ) | (SMARTSTDBY ));Pointless parens around SMARTSTDBY...
Ok. I will remove.
Quoted 5 lines
Review line 309
Quoted 3 lines
(quoted diff) +2
-0+ musb_writel(musb_base, OTG_SYSCONFIG, musb_readl(musb_base, + OTG_SYSCONFIG) | (SMARTIDLE));Pointless parens around SMARTIDLE...
Ok. I will remove.
Quoted 4 lines
WBR, Sergei
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 105 lines
-----Original Message-----
From: DebBarma, Tarun Kanti
Sent: Monday, August 09, 2010 10:14 PM
To: Kalliguddi, Hema; [email protected]; [email protected]
Cc: Kalliguddi, Hema; Mankad, Maulik Ojas; Felipe Balbi; Tony Lindgren; Kevin Hilman
Subject: RE: [PATCH V2 6/8] usb: musb: Offmode fix for idle pathHema,
Quoted 6 lines
-----Original Message-----
From: [email protected] [mailto:linux-omap- [email protected]] On Behalf Of Hema HK
Sent: Friday, August 06, 2010 10:57 PM
To: [email protected]; [email protected]
Cc: Kalliguddi, Hema; Mankad, Maulik Ojas; Felipe Balbi;Tony Lindgren;
Quoted 6 lines
Kevin Hilman
Subject: [PATCH V2 6/8] usb: musb: Offmode fix for idle pathFrom: Hema HK <[email protected]>
With OMAP core-off support musb was not functional as
context was getting
Quoted 1 line
lost after wakeup from core-off. And also musb was blocking
the core-off
Quoted 1 line
after loading the gadget driver even with no cable connected
sometimes.
Quoted 6 lines
Added the conext save/restore api in the platform layer which will be called in the idle and wakeup path.
Changed the usb sysconfig settings as per the usbotg functional spec. When the device is not active, configure to force idle and
force standby
Quoted 2 lines
mode.
When it is being used, configure in smart standby and smartidle mode.
Quoted 1 line
So while attempting to coreoff the usb is configured to
force standby and
Quoted 1 line
force idle mode, after wakeup configured in smart idle and
smart standby.
Quoted 49 lines
Signed-off-by Hema HK <[email protected]>Signed-off-by Maulik Mankad <[email protected]>Cc Felipe Balbi <[email protected]>Cc Tony Lindgren <[email protected]>Cc Kevin Hilman <[email protected]>---
arch/arm/mach-omap2/pm34xx.c | 4 ++ arch/arm/mach-omap2/usb-musb.c | 21 ++++++++++++++ arch/arm/plat-omap/include/plat/usb.h | 2 + drivers/usb/musb/musb_core.c | 11 ------- drivers/usb/musb/omap2430.c | 48 +++++++++++++++++++++++++++++++--- 5 files changed, 71 insertions(+), 15 deletions(-)Index:
linux-omap-pm/arch/arm/mach-omap2/pm34xx.c
===================================================================
---linux-omap-pm.orig/arch/arm/mach-omap2/pm34xx.c2010-08-06
09:23:01.153862710 -0400
+++linux-omap-pm/arch/arm/mach-omap2/pm34xx.c2010-08-06
10:44:06.393863125 -0400arch/arm/mach-omap2/pm34xx.c +5
-0@@ -39,6 +39,7 @@#include <plat/gpmc.h> #include <plat/dma.h> #include <plat/dmtimer.h> +#include <plat/usb.h> #include <asm/tlbflush.h> @@ -416,6 +417,8 @@if (core_next_state ==PWRDM_POWER_OFF ) {omap3_core_save_context ();omap3_prcm_save_context (); +/* Save MUSB context */ +musb_context_save_restore (1 ); } }@@ -458,6 +461,8 @@omap3_prcm_restore_context ();omap3_sram_restore_context ();omap2_sms_restore_context (); +/* restore MUSB context */ +musb_context_save_restore (0 ); }omap_uart_resume_idle (0 );omap_uart_resume_idle (1 );Quoted 3 lines
Index:
linux-omap-pm/arch/arm/mach-omap2/usb-musb.c
===================================================================
---linux-omap-pm.orig/arch/arm/mach-omap2/usb-musb.c2010-08-06
Quoted 7 lines
09:24:23.690112596 -0400
+++linux-omap-pm/arch/arm/mach-omap2/usb-musb.c2010-08-06
10:44:06.385862697 -0400(quoted diff) +0
-0@@ -120,6 +120,27 @@ } }
Quoted 8 lines
arch/arm/mach-omap2/usb-musb.c line 125
Quoted 3 lines
arch/arm/mach-omap2/usb-musb.c +3
-0+void musb_context_save_restore (int save) +{ +struct omap_hwmod *oh =omap_hwmod_lookup ("usb_otg_hs" );Might be good idea to check (oh) before proceeding?
if (!oh) { /* error message */ return; }
You are right. I will put a check.
Quoted 112 lines
arch/arm/mach-omap2/usb-musb.c
Quoted 8 lines
arch/arm/mach-omap2/usb-musb.c +7
-0+struct omap_device *od = oh->od; +struct platform_device *pdev = &od->pdev; +struct device *dev = &pdev->dev; +struct device_driver *drv = dev->driver; + +if (drv) { + struct musb_hdrc_platform_data *pdata =
dev->platform_data;Quoted 14 lines
arch/arm/mach-omap2/usb-musb.c +11
-0+const struct dev_pm_ops *pm = drv->pm; +if (!pdata->is_usb_active (dev)) { + +if (save) + pm->suspend (dev); +else + pm->resume_noirq (dev); + } + } +} +#else void __init usb_musb_init (struct omap_musb_board_data *board_data) {Quoted 5 lines
Index:
linux-omap-pm/arch/arm/plat-omap/include/plat/usb.h
===================================================================
---linux-omap-pm.orig/arch/arm/plat-omap/include/plat/usb.h2010-08-
06 09:23:01.137862514 -0400
+++linux-omap-pm/arch/arm/plat-omap/include/plat/usb.h2010-08-06
Quoted 69 lines
10:44:06.381864367 -0400
arch/arm/plat-omap/include/plat/usb.h +2
-0@@ -79,6 +79,8 @@extern void usb_ohci_init (const struct ohci_hcd_omap_platform_data *pdata); +/* For saving and restoring the musb context during off/wakeup*/ +extern void musb_context_save_restore (int save);#endif Index:
linux-omap-pm/drivers/usb/musb/musb_core.c
===================================================================
---linux-omap-pm.orig/drivers/usb/musb/musb_core.c2010-08-06
09:24:21.069863329 -0400
+++linux-omap-pm/drivers/usb/musb/musb_core.c2010-08-06
10:44:06.369863527 -0400drivers/usb/musb/musb_core.c +0
-11@@ -2427,11 +2427,6 @@ }musb_save_context (musb); - -if (musb->set_clock) - musb->set_clock (musb->clock,0 ); -else -clk_disable (musb->clock);spin_unlock_irqrestore (&musb->lock, flags);return 0 ; }@@ -2443,12 +2438,6 @@if (!musb->clock)return 0 ; - -if (musb->set_clock) - musb->set_clock (musb->clock,1 ); -else -clk_enable (musb->clock); -musb_restore_context (musb);/* for static cmos like DaVinci, register values were preserved Index:
linux-omap-pm/drivers/usb/musb/omap2430.c
===================================================================
---linux-omap-pm.orig/drivers/usb/musb/omap2430.c2010-08-06
09:24:21.069863329 -0400
+++linux-omap-pm/drivers/usb/musb/omap2430.c2010-08-06
10:44:30.093914217 -0400drivers/usb/musb/omap2430.c +13
-0@@ -189,6 +189,19 @@return 0 ; } +int is_musb_active (struct device *dev) +{ +struct musb *musb; + +#ifdef CONFIG_USB_MUSB_HDRC_HCD +/* usbcore insists dev->driver_data is a "struct hcd *" */ + musb =hcd_to_musb (dev_get_drvdata (dev)); +#else + musb =dev_get_drvdata (dev); +#endif +return musb->is_active; +} +int __init musb_platform_init (struct musb *musb) {u32 l;drivers/usb/musb/omap2430.c line 267
Quoted 5 lines
drivers/usb/musb/omap2430.c +1
-0@@ -250,6 +263,7 @@if (is_host_enabled (musb)) musb->board_set_vbus = omap_set_vbus; + plat->is_usb_active = is_musb_active; setup_timer(&musb_idle_timer, musb_do_idle, (unsignedlong) musb);
drivers/usb/musb/omap2430.c line 262
Quoted 7 lines
drivers/usb/musb/omap2430.c +0
-1return 0 ;@@ -259,15 +273,42 @@void musb_platform_save_context (struct musb *musb,struct musb_context_registers *musb_context) { - musb_context->otg_sysconfig = musb_readl(musb->mregs,
OTG_SYSCONFIG);
Quoted 13 lines
drivers/usb/musb/omap2430.c line 281
Quoted 9 lines
(quoted diff) +2
-1- musb_context->otg_forcestandby = musb_readl(musb->mregs, OTG_FORCESTDBY); + /* + * As per the omap-usbotg specification, configure it to forcedstandby
drivers/usb/musb/omap2430.c +4
-0+* and force idle mode when no activity on usb. +*/ +void __iomem *musb_base = musb->mregs; +Just to clarify, have you already taken care of
ioremap()/request_mem_region()formusb_base?
This is already done.
Quoted 62 lines
drivers/usb/musb/omap2430.c
Quoted 4 lines
drivers/usb/musb/omap2430.c +4
-0+musb_writel (musb_base,OTG_FORCESTDBY ,0 ); + + musb_writel(musb_base, OTG_SYSCONFIG, musb_readl(musb_base, + OTG_SYSCONFIG) & ~(NOSTDBY |SMARTSTDBY));
Quoted 4 lines
drivers/usb/musb/omap2430.c +4
-0+ +musb_writel (musb_base,OTG_SYSCONFIG ,musb_readl (musb_base, +OTG_SYSCONFIG ) & ~(AUTOIDLE )); +drivers/usb/musb/omap2430.c
Quoted 10 lines
drivers/usb/musb/omap2430.c +4
-1+musb_writel (musb_base,OTG_SYSCONFIG ,musb_readl (musb_base, +OTG_SYSCONFIG ) & ~(NOIDLE |SMARTIDLE )); + +musb_writel (musb_base,OTG_FORCESTDBY ,1 ); }void musb_platform_restore_context (struct musb *musb,struct musb_context_registers *musb_context) { - musb_writel(musb->mregs, OTG_SYSCONFIG,
musb_context->otg_sysconfig);Review
Quoted 4 lines
(quoted diff) +0
-1- musb_writel(musb->mregs, OTG_FORCESTDBY, musb_context-Quoted 1 line
otg_forcestandby);(quoted diff) +2
-0+ /* + * As per the omap-usbotg specification, configure itsmart standby
Quoted 14 lines
drivers/usb/musb/omap2430.c +11
-0+* and smart idle during operation. +*/ +void __iomem *musb_base = musb->mregs; + +musb_writel (musb_base,OTG_FORCESTDBY ,0 ); + +musb_writel (musb_base,OTG_SYSCONFIG ,musb_readl (musb_base, +OTG_SYSCONFIG ) | (SMARTSTDBY )); + +musb_writel (musb_base,OTG_SYSCONFIG ,musb_readl (musb_base, + OTG_SYSCONFIG) | (SMARTIDLE)); }#endif Quoted 5 lines
Index:
linux-omap-pm/include/linux/usb/musb.h
===================================================================
---linux-omap-pm.orig/include/linux/usb/musb.h2010-08-06
09:23:01.161864151 -0400
+++linux-omap-pm/include/linux/usb/musb.h2010-08-0610:44:06.401862567
Quoted 12 lines
-0400
include/linux/usb/musb.h +3
-1@@ -126,6 +126,9 @@/* Architecture specific board data */ void *board_data; + +/* check usb device active state*/ +int (*is_usb_active)(struct device *dev); }; --Quoted 1 line
To unsubscribe from this list: send the line "unsubscribe
linux-omap" in
Quoted 2 lines
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Hello.
Quoted 51 lines · Hema
Quoted 38 lines
Quoted 15 lines
With OMAP core-off support musb was not functional as context was getting
lost after wakeup from core-off. And also musb was blocking the core-off after loading the gadget driver even with no cable connected sometimes.Added the conext save/restore api in the platform layer which will
be called in the idle and wakeup path.
Changed the usb sysconfig settings as per the usbotg functional spec.
When the device is not active, configure to force idle and force standby mode.
When it is being used, configure in smart standby and smart idle mode.
So while attempting to coreoff the usb is configured to force standby and force idle mode, after wakeup configured in smart idle and smart standby.Signed-off-by Hema HK <[email protected]>Signed-off-by Maulik Mankad <[email protected]>Cc Felipe Balbi <[email protected]>Cc Tony Lindgren <[email protected]>Cc Kevin Hilman <[email protected]>[...]
Quoted 3 lines
Index:
linux-omap-pm/drivers/usb/musb/musb_core.c
===================================================================
---linux-omap-pm.orig/drivers/usb/musb/musb_core.c2010-08-06 09:24:21.069863329 -0400Quoted 1 line
+++
linux-omap-pm/drivers/usb/musb/musb_core.c2010-08-06 10:44:06.369863527 -0400Quoted 14 lines
drivers/usb/musb/musb_core.c +0
-5@@ -2427,11 +2427,6 @@ }musb_save_context (musb); - -if (musb->set_clock) - musb->set_clock (musb->clock,0 ); -else -clk_disable (musb->clock);spin_unlock_irqrestore (&musb->lock, flags);return 0 ; }@@ -2443,12 +2438,6 @@Quoted 12 lines
drivers/usb/musb/musb_core.c line 2441
Quoted 9 lines
drivers/usb/musb/musb_core.c +0
-6if (!musb->clock)return 0 ; - -if (musb->set_clock) - musb->set_clock (musb->clock,1 ); -else -clk_enable (musb->clock); -musb_restore_context (musb);The same question again: are you sure that clocks are auto-gated on
non-OMAP platfroms?
Quoted 1 line
Bon Lui confirmed that there is no clock for blackfin.
What about DaVinci (and the coming DA8xx)?
WBR, Sergei
Hi,
Quoted 72 lines
-----Original Message-----
From: Sergei Shtylyov [mailto:[email protected]]
Sent: Tuesday, August 10, 2010 4:50 PM
To: Kalliguddi, Hema
Cc: Sergei Shtylyov; [email protected]; [email protected]; Mankad, Maulik Ojas; Felipe Balbi; Tony Lindgren; Kevin Hilman
Subject: Re: [PATCH V2 6/8] usb: musb: Offmode fix for idle pathHello.
Quoted 1 line · Hema
Quoted 1 line
Quoted 1 line
With OMAP core-off support musb was not functional as
context was getting
Quoted 1 line
Quoted 1 line
Quoted 1 line
lost after wakeup from core-off. And also musb was
blocking the core-off
Quoted 1 line
Quoted 1 line
Quoted 1 line
after loading the gadget driver even with no cable
connected sometimes.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Added the conext save/restore api in the platform layer which will be called in the idle and wakeup path.
Changed the usb sysconfig settings as per the usbotgfunctional spec.
Quoted 1 line
Quoted 1 line
Quoted 1 line
When the device is not active, configure to force idle and
force standby mode.
Quoted 1 line
Quoted 1 line
Quoted 1 line
When it is being used, configure in smart standby and
smart idle mode.
Quoted 1 line
Quoted 1 line
Quoted 1 line
So while attempting to coreoff the usb is configured to
force standby and
Quoted 1 line
Quoted 1 line
Quoted 1 line
force idle mode, after wakeup configured in smart idle and
smart standby.
Quoted 28 lines
Quoted 28 lines
Quoted 5 lines
Signed-off-by Hema HK <[email protected]>Signed-off-by Maulik Mankad <[email protected]>Cc Felipe Balbi <[email protected]>Cc Tony Lindgren <[email protected]>Cc Kevin Hilman <[email protected]>[...]
Quoted 3 lines
Index:
linux-omap-pm/drivers/usb/musb/musb_core.c
===================================================================
---linux-omap-pm.orig/drivers/usb/musb/musb_core.c2010-08-06 09:24:21.069863329 -0400Quoted 1 line
+++
linux-omap-pm/drivers/usb/musb/musb_core.c2010-08-06 10:44:06.369863527 -0400Quoted 14 lines
(quoted diff) +0
-5@@ -2427,11 +2427,6 @@ } musb_save_context(musb); - - if (musb->set_clock) - musb->set_clock(musb->clock, 0); - else - clk_disable(musb->clock); spin_unlock_irqrestore(&musb->lock, flags); return 0; }@@ -2443,12 +2438,6 @@Quoted 11 lines
Quoted 11 lines
Review line 2441
Quoted 9 lines
(quoted diff) +0
-6if (!musb->clock) return 0; - - if (musb->set_clock) - musb->set_clock(musb->clock, 1); - else - clk_enable(musb->clock); - musb_restore_context(musb);The same question again: are you sure that clocks are
Quoted 7 lines
auto-gated on
Quoted 3 lines
Quoted 1 line
non-OMAP platfroms?
Bon Lui confirmed that there is no clock for blackfin.
What about DaVinci (and the coming DA8xx)?
I checked with Ajay, it is not auto gated for for Davinci so I can't just remove this.
I am thinking of adding a member variable(clk_autogated) in them usb_hdrc_platform_data structure and check this in the musb_suspend() And musb_resume() APIs. Do you see any problem with it?
Regards,
Hema
Quoted 3 lines
WBR, Sergei
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Hello.
Quoted 40 lines · Hema
Quoted 40 lines
Hema,
Quoted 38 lines
-----Original Message-----
From: [email protected] [mailto:linux-omap- [email protected]] On Behalf Of Hema HK
Sent: Friday, August 06, 2010 10:57 PM
To: [email protected]; [email protected]
Cc: Kalliguddi, Hema; Mankad, Maulik Ojas; Felipe Balbi; Tony Lindgren; Kevin Hilman
Subject: [PATCH V2 6/8] usb: musb: Offmode fix for idle pathFrom: Hema HK <[email protected]>
With OMAP core-off support musb was not functional as context was getting lost after wakeup from core-off. And also musb was blocking the core-off after loading the gadget driver even with no cable connected sometimes.
Added the conext save/restore api in the platform layer which will be called in the idle and wakeup path.
Changed the usb sysconfig settings as per the usbotg functional spec. When the device is not active, configure to force idle and force standby mode.
When it is being used, configure in smart standby and smart idle mode. So while attempting to coreoff the usb is configured to force standby and force idle mode, after wakeup configured in smart idle and smart standby.Signed-off-by Hema HK <[email protected]>Signed-off-by Maulik Mankad <[email protected]>Cc Felipe Balbi <[email protected]>Cc Tony Lindgren <[email protected]>Cc Kevin Hilman <[email protected]>Index:
linux-omap-pm/drivers/usb/musb/omap2430.c
===================================================================
---linux-omap-pm.orig/drivers/usb/musb/omap2430.c2010-08-06
09:24:21.069863329 -0400
+++linux-omap-pm/drivers/usb/musb/omap2430.c2010-08-06
10:44:30.093914217 -0400
[...]
Quoted 15 lines
Quoted 6 lines
Quoted 6 lines
drivers/usb/musb/omap2430.c +0
-2@@ -259,15 +273,42 @@void musb_platform_save_context (struct musb *musb,struct musb_context_registers *musb_context) { - musb_context->otg_sysconfig =musb_readl (musb->mregs,OTG_SYSCONFIG ); - musb_context->otg_forcestandby =musb_readl (musb->mregs,OTG_FORCESTDBY );Quoted 8 lines
drivers/usb/musb/omap2430.c line 281
Quoted 6 lines
drivers/usb/musb/omap2430.c +6
-0+/* +* As per the omap-usbotg specification, configure it to forced standby +* and force idle mode when no activity on usb. +*/ +void __iomem *musb_base = musb->mregs; +Just to clarify, have you already taken care of
ioremap()/request_mem_region()formusb_base?
Quoted 1 line
This is already done.
Not quite. MUSB driver doesn't call request_mem_region().
WBR, Sergei