OMAP3: PM: reset USB OTG module on boot
Subsystems (4)
PATCH v2 1/1 OMAP3: PM: reset USB OTG module on boot
Rather than simply setting force-idle mode on boot, do a reset of the OTG module. This really ensures that any bootloader/bootstrap code that leaves it active will not prevent future retention. After reset, OTG module will be in force-idle, force-standby mode.
In addition, ensure that the iclk is enabled before attempting a write to the module SYSCONFIG register.
Problem reported by Mike Chan <[email protected]>
---
Updates from v1
- use ioremap()+__raw_write instead of deprecated omap_write()
- Re: defines in omap2430.h, this header is not exported outside drivers/usb, so define it locally yere
arch/arm/mach-omap2/usb-musb.c | 31 +++++++++++++++++++++++++++---- 1 files changed, 27 insertions(+), 4 deletions(-)
arch/arm/mach-omap2/usb-musb.c +27 -4
@@ -26,18 +26,41 @@#include <linux/usb/musb.h> +#include <asm/sizes.h> +#include <mach/hardware.h> #include <mach/irqs.h> #include <mach/mux.h> #include <mach/usb.h> -#define OTG_SYSCONFIG (OMAP34XX_HSUSB_OTG_BASE + 0x404) +#define OTG_SYSCONFIG 0x404 +#define OTG_SYSC_SOFTRESET BIT(1)static void __init usb_musb_pm_init (void ) { -/* Ensure force-idle mode for OTG controller */ -if (cpu_is_omap34xx ()) -omap_writel (0 ,OTG_SYSCONFIG ); +struct clk *iclk; +void __iomem *otg_base; + +if (!cpu_is_omap34xx ()) +return ; + + otg_base =ioremap (OMAP34XX_HSUSB_OTG_BASE ,SZ_4K ); +if (WARN_ON (!otg_base)) +return ; + + iclk =clk_get (NULL ,"hsotgusb_ick" ); +if (WARN_ON (!iclk)) +return ; + +clk_enable (iclk); + +/* Reset OTG controller. After reset, it will be in +* force-idle, force-standby mode. */ +__raw_writel (OTG_SYSC_SOFTRESET , otg_base +OTG_SYSCONFIG ); + +clk_disable (iclk); +clk_put (iclk); +iounmap (otg_base); }#ifdef CONFIG_USB_MUSB_SOC
Signature · 1 line
1.6.3.2
Quoted 9 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Kevin Hilman
Sent: Wednesday, June 24, 2009 10:32 AM
To: [email protected]
Subject: [PATCH v2] OMAP3: PM: reset USB OTG module on boot
Quoted 7 lines
Rather than simply setting force-idle mode on boot, do a reset of the OTG module. This really ensures that any bootloader/bootstrap code that leaves it active will not prevent future retention. After reset, OTG module will be in force-idle, force-standby mode.
In addition, ensure that the iclk is enabled before attempting a write to the module SYSCONFIG register.
This patch solves MUSB issue, but is not generic for all IP blocks on omap.
ROM code or u-boot could leave the module sysconfig in a non-idle state.
I recommend just like CONFIG_OMAP_RESET_CLOCKS for clocks, same could be done generically for all SYSCONFIG registers in some prcm code and not driver specific.
Quoted 22 lines
Problem reported by Mike Chan <[email protected]>
Tested-by Mike Chan <[email protected]>Signed-off-by Kevin Hilman <[email protected]>---
Updates from v1
- use ioremap()+__raw_write instead of deprecatedomap_write()
- Re: defines inomap2430.h, this header is not exported outsidedrivers/usb, so define it locally yere
arch/arm/mach-omap2/usb-musb.c| 31 +++++++++++++++++++++++++++----1 files changed, 27 insertions(+), 4 deletions(-)arch/arm/mach-omap2/usb-musb.c +0
-0@@ -26,18 +26,41 @@#include <linux/usb/musb.h>
arch/arm/mach-omap2/usb-musb.c line 37
Quoted 10 lines
arch/arm/mach-omap2/usb-musb.c +4
-1+#include <asm/sizes.h> +#include <mach/hardware.h> #include <mach/irqs.h> #include <mach/mux.h> #include <mach/usb.h> -#define OTG_SYSCONFIG (OMAP34XX_HSUSB_OTG_BASE + 0x404) +#define OTG_SYSCONFIG 0x404 +#define OTG_SYSC_SOFTRESET BIT(1)
This is already defined in drivers/usb/musb/omap2430.h Could we reuse?
#if defined(CONFIG_ARCH_OMAP2430)
#define OMAP_HSOTG_BASE (OMAP243X_HS_BASE)
#elif defined(CONFIG_ARCH_OMAP3430)
#define OMAP_HSOTG_BASE (OMAP34XX_HSUSB_OTG_BASE)
#endif
#define OMAP_HSOTG(offset) (OMAP_HSOTG_BASE + 0x400 + (offset)) #define OTG_REVISION OMAP_HSOTG(0x0) #define OTG_SYSCONFIG OMAP_HSOTG(0x4)
arch/arm/mach-omap2/usb-musb.c line 45
Quoted 11 lines
arch/arm/mach-omap2/usb-musb.c +5
-3static void __init usb_musb_pm_init (void ) { -/* Ensure force-idle mode for OTG controller */ -if (cpu_is_omap34xx ()) -omap_writel (0 ,OTG_SYSCONFIG ); +struct clk *iclk; +void __iomem *otg_base; + +if (!cpu_is_omap34xx ()) +return ;
Why is this sys-config reset done only for omap34xx() This should be valid for any old 24xx() as well as new 44xx() omaps
Quoted 28 lines
arch/arm/mach-omap2/usb-musb.c +18
-1+ + otg_base =ioremap (OMAP34XX_HSUSB_OTG_BASE ,SZ_4K ); +if (WARN_ON (!otg_base)) +return ; + + iclk =clk_get (NULL ,"hsotgusb_ick" ); +if (WARN_ON (!iclk)) +return ; + +clk_enable (iclk); + +/* Reset OTG controller. After reset, it will be in +* force-idle, force-standby mode. */ +__raw_writel (OTG_SYSC_SOFTRESET , otg_base +OTG_SYSCONFIG ); + +clk_disable (iclk); +clk_put (iclk); +iounmap (otg_base); }#ifdef CONFIG_USB_MUSB_SOC --1.6.3.2
--
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
Quoted 9 lines · Vikram
Quoted 8 lines
Rather than simply setting force-idle mode on boot, do a reset of the OTG module. This really ensures that any bootloader/bootstrap code that leaves it active will not prevent future retention. After reset, OTG module will be in force-idle, force-standby mode.
In addition, ensure that the iclk is enabled before attempting a write to the module SYSCONFIG register.
Quoted 7 lines
This patch solves MUSB issue, but is not generic for all IP blocks on omap.
ROM code or u-boot could leave the module sysconfig in a non-idle state.
I recommend just like
CONFIG_OMAP_RESET_CLOCKSfor clocks, same could be done generically for all SYSCONFIG registers in some prcm code and not driver specific.
Completely agree.
This feature will come as soon as we have omap_hwmod/omapdev in place. With that, we will have an easy way to model the SYSCONFIG regs of each modules, and iterate through them.
Kevin
Quoted 89 lines
Quoted 22 lines
Problem reported by Mike Chan <[email protected]>
Tested-by Mike Chan <[email protected]>Signed-off-by Kevin Hilman <[email protected]>---
Updates from v1
- use ioremap()+__raw_write instead of deprecatedomap_write()
- Re: defines inomap2430.h, this header is not exported outsidedrivers/usb, so define it locally yere
arch/arm/mach-omap2/usb-musb.c| 31 +++++++++++++++++++++++++++----1 files changed, 27 insertions(+), 4 deletions(-)arch/arm/mach-omap2/usb-musb.c +0
-0@@ -26,18 +26,41 @@#include <linux/usb/musb.h> arch/arm/mach-omap2/usb-musb.c line 37
Quoted 10 lines
arch/arm/mach-omap2/usb-musb.c +4
-1+#include <asm/sizes.h> +#include <mach/hardware.h> #include <mach/irqs.h> #include <mach/mux.h> #include <mach/usb.h> -#define OTG_SYSCONFIG (OMAP34XX_HSUSB_OTG_BASE + 0x404) +#define OTG_SYSCONFIG 0x404 +#define OTG_SYSC_SOFTRESET BIT(1)This is already defined in
drivers/usb/musb/omap2430.hCould we reuse?#if
defined(CONFIG_ARCH_OMAP2430)
#defineOMAP_HSOTG_BASE(OMAP243X_HS_BASE)
#elifdefined(CONFIG_ARCH_OMAP3430)
#defineOMAP_HSOTG_BASE(OMAP34XX_HSUSB_OTG_BASE)
#endif#define OMAP_HSOTG(offset) (OMAP_HSOTG_BASE + 0x400 + (offset)) #define OTG_REVISION OMAP_HSOTG(0x0) #define OTG_SYSCONFIG OMAP_HSOTG(0x4)arch/arm/mach-omap2/usb-musb.c line 45
Quoted 11 lines
arch/arm/mach-omap2/usb-musb.c +5
-3static void __init usb_musb_pm_init (void ) { -/* Ensure force-idle mode for OTG controller */ -if (cpu_is_omap34xx ()) -omap_writel (0 ,OTG_SYSCONFIG ); +struct clk *iclk; +void __iomem *otg_base; + +if (!cpu_is_omap34xx ()) +return ;Why is this sys-config reset done only for
omap34xx()This should be valid for any old 24xx() as well as new 44xx() omapsQuoted 28 lines
arch/arm/mach-omap2/usb-musb.c +18
-1+ + otg_base =ioremap (OMAP34XX_HSUSB_OTG_BASE ,SZ_4K ); +if (WARN_ON (!otg_base)) +return ; + + iclk =clk_get (NULL ,"hsotgusb_ick" ); +if (WARN_ON (!iclk)) +return ; + +clk_enable (iclk); + +/* Reset OTG controller. After reset, it will be in +* force-idle, force-standby mode. */ +__raw_writel (OTG_SYSC_SOFTRESET , otg_base +OTG_SYSCONFIG ); + +clk_disable (iclk); +clk_put (iclk); +iounmap (otg_base); }#ifdef CONFIG_USB_MUSB_SOC --1.6.3.2
--
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
Quoted 50 lines · Vikram
Quoted 7 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Kevin Hilman
Sent: Wednesday, June 24, 2009 10:32 AM
To: [email protected]
Subject: [PATCH v2] OMAP3: PM: reset USB OTG module on bootQuoted 7 lines
Rather than simply setting force-idle mode on boot, do a reset of the OTG module. This really ensures that any bootloader/bootstrap code that leaves it active will not prevent future retention. After reset, OTG module will be in force-idle, force-standby mode.
In addition, ensure that the iclk is enabled before attempting a write to the module SYSCONFIG register.
This patch solves MUSB issue, but is not generic for all IP blocks on omap.
ROM code or u-boot could leave the module sysconfig in a non-idle state.
I recommend just like
CONFIG_OMAP_RESET_CLOCKSfor clocks, same could be done generically for all SYSCONFIG registers in some prcm code and not driver specific.Quoted 29 lines
Problem reported by Mike Chan <[email protected]>
Tested-by Mike Chan <[email protected]>Signed-off-by Kevin Hilman <[email protected]>---
Updates from v1
- use ioremap()+__raw_write instead of deprecatedomap_write()
- Re: defines inomap2430.h, this header is not exported outsidedrivers/usb, so define it locally yere
arch/arm/mach-omap2/usb-musb.c| 31 +++++++++++++++++++++++++++----1 files changed, 27 insertions(+), 4 deletions(-)arch/arm/mach-omap2/usb-musb.c +2
-0@@ -26,18 +26,41 @@#include <linux/usb/musb.h> +#include <asm/sizes.h> +#include <mach/hardware.h> #include <mach/irqs.h> #include <mach/mux.h> #include <mach/usb.h>
Quoted 6 lines
arch/arm/mach-omap2/usb-musb.c line 37
Quoted 3 lines
arch/arm/mach-omap2/usb-musb.c +2
-1-#define OTG_SYSCONFIG (OMAP34XX_HSUSB_OTG_BASE + 0x404) +#define OTG_SYSCONFIG 0x404 +#define OTG_SYSC_SOFTRESET BIT(1)This is already defined in
drivers/usb/musb/omap2430.hCould we reuse?
See comment above in the 'Updates from v1' section.
Quoted 12 lines
#if
defined(CONFIG_ARCH_OMAP2430)
#defineOMAP_HSOTG_BASE(OMAP243X_HS_BASE)
#elifdefined(CONFIG_ARCH_OMAP3430)
#defineOMAP_HSOTG_BASE(OMAP34XX_HSUSB_OTG_BASE)
#endif#define OMAP_HSOTG(offset) (OMAP_HSOTG_BASE + 0x400 + (offset)) #define OTG_REVISION OMAP_HSOTG(0x0) #define OTG_SYSCONFIG OMAP_HSOTG(0x4)Quoted 1 line
Quoted 13 lines
arch/arm/mach-omap2/usb-musb.c line 45
Quoted 10 lines
static void
__initusb_musb_pm_init(void)
{arch/arm/mach-omap2/usb-musb.c +5
-3-/* Ensure force-idle mode for OTG controller */ -if (cpu_is_omap34xx ()) -omap_writel (0 ,OTG_SYSCONFIG ); +struct clk *iclk; +void __iomem *otg_base; + +if (!cpu_is_omap34xx ()) +return ;Why is this sys-config reset done only for
omap34xx()This should be valid for any old 24xx() as well as new 44xx() omaps
You're correct. Good catch.
The force-idle "fix" that this is replacing was only being done on 34xx due to the smart-idle errata. However, this reset should be done even without any errata.
Thanks for review, will respin.
Kevin
Quoted 28 lines
Quoted 28 lines
arch/arm/mach-omap2/usb-musb.c +18
-0+ + otg_base =ioremap (OMAP34XX_HSUSB_OTG_BASE ,SZ_4K ); +if (WARN_ON (!otg_base)) +return ; + + iclk =clk_get (NULL ,"hsotgusb_ick" ); +if (WARN_ON (!iclk)) +return ; + +clk_enable (iclk); + +/* Reset OTG controller. After reset, it will be in +* force-idle, force-standby mode. */ +__raw_writel (OTG_SYSC_SOFTRESET , otg_base +OTG_SYSCONFIG ); + +clk_disable (iclk); +clk_put (iclk); +iounmap (otg_base);}
#ifdef
CONFIG_USB_MUSB_SOC
--
1.6.3.2--
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
<snip>
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
static void
__initusb_musb_pm_init(void)
{arch/arm/mach-omap2/usb-musb.c +5
-3-/* Ensure force-idle mode for OTG controller */ -if (cpu_is_omap34xx ()) -omap_writel (0 ,OTG_SYSCONFIG ); +struct clk *iclk; +void __iomem *otg_base; + +if (!cpu_is_omap34xx ()) +return ;
Quoted 3 lines
Quoted 2 lines
Why is this sys-config reset done only for
omap34xx()This should be valid for any old 24xx() as well as new 44xx() omaps
Minor correction - it's valid only for any old 243x() only. 242x did not have this controller, IIRC.
Quoted 10 lines
You're correct. Good catch.
The force-idle "fix" that this is replacing was only being done on 34xx due to the smart-idle errata. However, this reset should be done even without any errata.
Thanks for review, will respin.
Kevin
Quoted 4 lines
From: [email protected] [mailto:linux-omap- [email protected]] On Behalf Of Kevin Hilman
Quoted 8 lines
Quoted 2 lines
Why is this sys-config reset done only for
omap34xx()This should be valid for any old 24xx() as well as new 44xx() omapsYou're correct. Good catch.
The force-idle "fix" that this is replacing was only being done on 34xx due to the smart-idle errata. However, this reset should be done even without any errata.
Minor note, IIRC the different OTG IP used in OMAP2420 did require a similar force at boot time. That would be a different file if it exists.
Regards,
Richard W.
Quoted 12 lines · Vikram
Quoted 11 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Kevin HilmanRather than simply setting force-idle mode on boot, do a reset of the OTG module. This really ensures that any bootloader/bootstrap code that leaves it active will not prevent future retention. After reset, OTG module will be in force-idle, force-standby mode.
In addition, ensure that the iclk is enabled before attempting a write to the module SYSCONFIG register.
Quoted 7 lines
This patch solves MUSB issue, but is not generic for all IP blocks on omap.
ROM code or u-boot could leave the module sysconfig in a non-idle state.
I recommend just like
CONFIG_OMAP_RESET_CLOCKSfor clocks, same could be done generically for all SYSCONFIG registers in some prcm code and not driver specific.
I agree. Please contribute to the development of the omap_hwmod patchset, which does this (among other things).
- Paul