OMAP2+: hwmod core upgrades for 2.6.38: first set
Subsystems (5)
Paul Walmsley
maintainercover OMAP2+: hwmod core upgrades for 2.6.38: first set
This patch series contains upgrades for the OMAP2+ hwmod core code, intended for 2.6.38. Most of these patches were developed in response to use-cases discovered while converting device drivers to use the hwmod code.
Tested on an OMAP34xx BeagleBoard with omap2plus_defconfig.
- Paul
---
hwmod_a_2.6.38
text data bss dec hex filename
5708416 472960 5608992 11790368 b3e820 vmlinux.omap2plus_defconfig.orig
5709076 470560 5608992 11788628 b3e154 vmlinux.omap2plus_defconfig.patched
Paul Walmsley (7):
OMAP2+: io: split omap2_init_common_hw()
OMAP2+: hwmod: allow custom pre-shutdown functions
OMAP2+: hwmod: add postsetup state
OMAP2+: hwmod: add support for per-class custom device reset functions OMAP2+: hwmod: rename omap_hwmod_mutex to _hwmod_list_mutex OMAP2+: hwmod: upgrade per-hwmod mutex to a spinlock OMAP2+: hwmod: fix a warning, add some docs, remove unused fields
Rajendra Nayak (1):
OMAP2+: hwmod: Update the sysc_cache in case module context is lost
arch/arm/mach-omap2/board-2430sdp.c | 3 arch/arm/mach-omap2/board-3430sdp.c | 3 arch/arm/mach-omap2/board-3630sdp.c | 5 arch/arm/mach-omap2/board-4430sdp.c | 3 arch/arm/mach-omap2/board-am3517evm.c | 4 arch/arm/mach-omap2/board-apollon.c | 3 arch/arm/mach-omap2/board-cm-t35.c | 3 arch/arm/mach-omap2/board-cm-t3517.c | 3 arch/arm/mach-omap2/board-devkit8000.c | 5 arch/arm/mach-omap2/board-generic.c | 3 arch/arm/mach-omap2/board-h4.c | 3 arch/arm/mach-omap2/board-igep0020.c | 4 arch/arm/mach-omap2/board-igep0030.c | 4 arch/arm/mach-omap2/board-ldp.c | 3 arch/arm/mach-omap2/board-n8x0.c | 3 arch/arm/mach-omap2/board-omap3beagle.c | 5 arch/arm/mach-omap2/board-omap3evm.c | 3 arch/arm/mach-omap2/board-omap3logic.c | 3 arch/arm/mach-omap2/board-omap3pandora.c | 5 arch/arm/mach-omap2/board-omap3stalker.c | 3 arch/arm/mach-omap2/board-omap3touchbook.c | 5 arch/arm/mach-omap2/board-omap4panda.c | 3 arch/arm/mach-omap2/board-overo.c | 5 arch/arm/mach-omap2/board-rx51.c | 3 arch/arm/mach-omap2/board-zoom.c | 9 - arch/arm/mach-omap2/io.c | 32 ++- arch/arm/mach-omap2/omap_hwmod.c | 264 ++++++++++++++++++-------- arch/arm/mach-omap2/omap_hwmod_2430_data.c | 2 arch/arm/mach-omap2/serial.c | 9 - arch/arm/plat-omap/include/plat/io.h | 5 arch/arm/plat-omap/include/plat/omap_hwmod.h | 47 +++-- 31 files changed, 302 insertions(+), 153 deletions(-)
Paul Walmsley
maintainerPATCH 1/8 OMAP2+: io: split omap2_init_common_hw()
Split omap2_init_common_hw() into two functions. The first, omap2_init_common_infrastructure(), initializes the hwmod code and data, the OMAP PM code, and the clock code and data. The second, omap2_init_common_devices(), handles any other early device initialization that, for whatever reason, has not been or cannot be moved to initcalls or early platform devices.
This patch is required for the hwmod postsetup patch, which allows board files to change the state that hwmods should be placed into at the conclusion of the hwmod _setup() function. For example, for a board whose creators wish to ensure watchdog coverage across the entire kernel boot process, code to change the watchdog's postsetup state will be added in the board-*.c file between the omap2_init_common_infrastructure() and omap2_init_common_devices() function calls.
--- arch/arm/mach-omap2/board-2430sdp.c | 3 ++- arch/arm/mach-omap2/board-3430sdp.c | 3 ++- arch/arm/mach-omap2/board-3630sdp.c | 5 +++-- arch/arm/mach-omap2/board-4430sdp.c | 3 ++- arch/arm/mach-omap2/board-am3517evm.c | 4 ++-- arch/arm/mach-omap2/board-apollon.c | 3 ++- arch/arm/mach-omap2/board-cm-t35.c | 3 ++- arch/arm/mach-omap2/board-cm-t3517.c | 3 ++- arch/arm/mach-omap2/board-devkit8000.c | 5 +++-- arch/arm/mach-omap2/board-generic.c | 3 ++- arch/arm/mach-omap2/board-h4.c | 3 ++- arch/arm/mach-omap2/board-igep0020.c | 4 +++- arch/arm/mach-omap2/board-igep0030.c | 4 +++- arch/arm/mach-omap2/board-ldp.c | 3 ++- arch/arm/mach-omap2/board-n8x0.c | 3 ++- arch/arm/mach-omap2/board-omap3beagle.c | 5 +++-- arch/arm/mach-omap2/board-omap3evm.c | 3 ++- arch/arm/mach-omap2/board-omap3logic.c | 3 ++- arch/arm/mach-omap2/board-omap3pandora.c | 5 +++-- arch/arm/mach-omap2/board-omap3stalker.c | 3 ++- arch/arm/mach-omap2/board-omap3touchbook.c | 5 +++-- arch/arm/mach-omap2/board-omap4panda.c | 3 ++- arch/arm/mach-omap2/board-overo.c | 5 +++-- arch/arm/mach-omap2/board-rx51.c | 3 ++- arch/arm/mach-omap2/board-zoom.c | 9 +++++---- arch/arm/mach-omap2/io.c | 16 ++++++++++++---- arch/arm/plat-omap/include/plat/io.h | 5 +++-- 27 files changed, 76 insertions(+), 41 deletions(-)
arch/arm/mach-omap2/board-2430sdp.c +2 -1
@@ -143,7 +143,8 @@ static void __init omap_2430sdp_init_irq(void) { omap_board_config = sdp2430_config; omap_board_config_size =ARRAY_SIZE (sdp2430_config); -omap2_init_common_hw (NULL ,NULL ); +omap2_init_common_infrastructure (); +omap2_init_common_devices (NULL ,NULL );omap_init_irq ();omap_gpio_init (); }
arch/arm/mach-omap2/board-3430sdp.c +2 -1
@@ -326,7 +326,8 @@ static void __init omap_3430sdp_init_irq(void) omap_board_config = sdp3430_config; omap_board_config_size =ARRAY_SIZE (sdp3430_config);omap3_pm_init_cpuidle (omap3_cpuidle_params_table); -omap2_init_common_hw (hyb18m512160af6_sdrc_params,NULL ); +omap2_init_common_infrastructure (); +omap2_init_common_devices (hyb18m512160af6_sdrc_params,NULL );omap_init_irq ();omap_gpio_init (); }
arch/arm/mach-omap2/board-3630sdp.c +3 -2
@@ -73,8 +73,9 @@ static void __init omap_sdp_init_irq(void) { omap_board_config = sdp_config; omap_board_config_size =ARRAY_SIZE (sdp_config); -omap2_init_common_hw (h8mbx00u0mer0em_sdrc_params, - h8mbx00u0mer0em_sdrc_params); +omap2_init_common_infrastructure (); +omap2_init_common_devices (h8mbx00u0mer0em_sdrc_params, + h8mbx00u0mer0em_sdrc_params);omap_init_irq ();omap_gpio_init (); }
arch/arm/mach-omap2/board-4430sdp.c +2 -1
@@ -217,7 +217,8 @@ static void __init omap_4430sdp_init_irq(void) { omap_board_config = sdp4430_config; omap_board_config_size =ARRAY_SIZE (sdp4430_config); -omap2_init_common_hw (NULL ,NULL ); +omap2_init_common_infrastructure (); +omap2_init_common_devices (NULL ,NULL );#ifdef CONFIG_OMAP_32K_TIMER omap2_gp_clockevent_set_gptimer (1 );#endif
arch/arm/mach-omap2/board-am3517evm.c +2 -2
@@ -389,8 +389,8 @@ static void __init am3517_evm_init_irq(void) { omap_board_config = am3517_evm_config; omap_board_config_size =ARRAY_SIZE (am3517_evm_config); - -omap2_init_common_hw (NULL ,NULL ); +omap2_init_common_infrastructure (); +omap2_init_common_devices (NULL ,NULL );omap_init_irq ();omap_gpio_init (); }
arch/arm/mach-omap2/board-apollon.c +2 -1
@@ -278,7 +278,8 @@ static void __init omap_apollon_init_irq(void) { omap_board_config = apollon_config; omap_board_config_size =ARRAY_SIZE (apollon_config); -omap2_init_common_hw (NULL ,NULL ); +omap2_init_common_infrastructure (); +omap2_init_common_devices (NULL ,NULL );omap_init_irq ();omap_gpio_init ();apollon_init_smc91x ();
arch/arm/mach-omap2/board-cm-t35.c +2 -1
@@ -683,7 +683,8 @@ static void __init cm_t35_init_irq(void) omap_board_config = cm_t35_config; omap_board_config_size =ARRAY_SIZE (cm_t35_config); -omap2_init_common_hw (mt46h32m32lf6_sdrc_params, +omap2_init_common_infrastructure (); +omap2_init_common_devices (mt46h32m32lf6_sdrc_params, mt46h32m32lf6_sdrc_params);omap_init_irq ();omap_gpio_init ();
arch/arm/mach-omap2/board-cm-t3517.c +2 -1
@@ -248,7 +248,8 @@ static void __init cm_t3517_init_irq(void) omap_board_config = cm_t3517_config; omap_board_config_size =ARRAY_SIZE (cm_t3517_config); -omap2_init_common_hw (NULL ,NULL ); +omap2_init_common_infrastructure (); +omap2_init_common_devices (NULL ,NULL );omap_init_irq ();omap_gpio_init (); }
arch/arm/mach-omap2/board-devkit8000.c +3 -2
@@ -444,8 +444,9 @@ static struct platform_device keys_gpio = {static void __init devkit8000_init_irq (void ) { -omap2_init_common_hw (mt46h32m32lf6_sdrc_params, - mt46h32m32lf6_sdrc_params); +omap2_init_common_infrastructure (); +omap2_init_common_devices (mt46h32m32lf6_sdrc_params, + mt46h32m32lf6_sdrc_params);omap_init_irq ();#ifdef CONFIG_OMAP_32K_TIMER omap2_gp_clockevent_set_gptimer (12 );
arch/arm/mach-omap2/board-generic.c +2 -1
@@ -37,7 +37,8 @@ static void __init omap_generic_init_irq(void) { omap_board_config = generic_config; omap_board_config_size =ARRAY_SIZE (generic_config); -omap2_init_common_hw (NULL ,NULL ); +omap2_init_common_infrastructure (); +omap2_init_common_devices (NULL ,NULL );omap_init_irq (); }
arch/arm/mach-omap2/board-h4.c +2 -1
@@ -291,7 +291,8 @@ static void __init omap_h4_init_irq(void) { omap_board_config = h4_config; omap_board_config_size =ARRAY_SIZE (h4_config); -omap2_init_common_hw (NULL ,NULL ); +omap2_init_common_infrastructure (); +omap2_init_common_devices (NULL ,NULL );omap_init_irq ();omap_gpio_init ();h4_init_flash ();
arch/arm/mach-omap2/board-igep0020.c +3 -1
@@ -482,7 +482,9 @@ static struct platform_device *igep2_devices[] __initdata = {static void __init igep2_init_irq (void ) { -omap2_init_common_hw (m65kxxxxam_sdrc_params, m65kxxxxam_sdrc_params); +omap2_init_common_infrastructure (); +omap2_init_common_devices (m65kxxxxam_sdrc_params, + m65kxxxxam_sdrc_params);omap_init_irq ();omap_gpio_init (); }
arch/arm/mach-omap2/board-igep0030.c +3 -1
@@ -289,7 +289,9 @@ static struct twl4030_usb_data igep3_twl4030_usb_data = {static void __init igep3_init_irq (void ) { -omap2_init_common_hw (m65kxxxxam_sdrc_params, m65kxxxxam_sdrc_params); +omap2_init_common_infrastructure (); +omap2_init_common_devices (m65kxxxxam_sdrc_params, + m65kxxxxam_sdrc_params);omap_init_irq ();omap_gpio_init (); }
arch/arm/mach-omap2/board-ldp.c +2 -1
@@ -292,7 +292,8 @@ static void __init omap_ldp_init_irq(void) { omap_board_config = ldp_config; omap_board_config_size =ARRAY_SIZE (ldp_config); -omap2_init_common_hw (NULL ,NULL ); +omap2_init_common_infrastructure (); +omap2_init_common_devices (NULL ,NULL );omap_init_irq ();omap_gpio_init ();ldp_init_smsc911x ();
arch/arm/mach-omap2/board-n8x0.c +2 -1
@@ -741,7 +741,8 @@ static void __init n8x0_map_io(void)static void __init n8x0_init_irq (void ) { -omap2_init_common_hw (NULL ,NULL ); +omap2_init_common_infrastructure (); +omap2_init_common_devices (NULL ,NULL );omap_init_irq ();omap_gpio_init (); }
arch/arm/mach-omap2/board-omap3beagle.c +3 -2
@@ -484,8 +484,9 @@ static struct platform_device keys_gpio = {static void __init omap3_beagle_init_irq (void ) { -omap2_init_common_hw (mt46h32m32lf6_sdrc_params, - mt46h32m32lf6_sdrc_params); +omap2_init_common_infrastructure (); +omap2_init_common_devices (mt46h32m32lf6_sdrc_params, + mt46h32m32lf6_sdrc_params);omap_init_irq ();#ifdef CONFIG_OMAP_32K_TIMER omap2_gp_clockevent_set_gptimer (12 );
arch/arm/mach-omap2/board-omap3evm.c +2 -1
@@ -623,7 +623,8 @@ static void __init omap3_evm_init_irq(void) { omap_board_config = omap3_evm_config; omap_board_config_size =ARRAY_SIZE (omap3_evm_config); -omap2_init_common_hw (mt46h32m32lf6_sdrc_params,NULL ); +omap2_init_common_infrastructure (); +omap2_init_common_devices (mt46h32m32lf6_sdrc_params,NULL );omap_init_irq ();omap_gpio_init (); }
arch/arm/mach-omap2/board-omap3logic.c +2 -1
@@ -197,7 +197,8 @@ static inline void __init board_smsc911x_init(void)static void __init omap3logic_init_irq (void ) { -omap2_init_common_hw (NULL ,NULL ); +omap2_init_common_infrastructure (); +omap2_init_common_devices (NULL ,NULL );omap_init_irq ();omap_gpio_init (); }
arch/arm/mach-omap2/board-omap3pandora.c +3 -2
@@ -636,8 +636,9 @@ static struct spi_board_info omap3pandora_spi_board_info[] __initdata = {static void __init omap3pandora_init_irq (void ) { -omap2_init_common_hw (mt46h32m32lf6_sdrc_params, - mt46h32m32lf6_sdrc_params); +omap2_init_common_infrastructure (); +omap2_init_common_devices (mt46h32m32lf6_sdrc_params, + mt46h32m32lf6_sdrc_params);omap_init_irq ();omap_gpio_init (); }
arch/arm/mach-omap2/board-omap3stalker.c +2 -1
@@ -584,7 +584,8 @@ static void __init omap3_stalker_init_irq(void) { omap_board_config = omap3_stalker_config; omap_board_config_size =ARRAY_SIZE (omap3_stalker_config); -omap2_init_common_hw (mt46h32m32lf6_sdrc_params,NULL ); +omap2_init_common_infrastructure (); +omap2_init_common_devices (mt46h32m32lf6_sdrc_params,NULL );omap_init_irq ();#ifdef CONFIG_OMAP_32K_TIMER omap2_gp_clockevent_set_gptimer (12 );
arch/arm/mach-omap2/board-omap3touchbook.c +3 -2
@@ -422,8 +422,9 @@ static void __init omap3_touchbook_init_irq(void)omap3_mux_init (board_mux,OMAP_PACKAGE_CBB ); omap_board_config = omap3_touchbook_config; omap_board_config_size =ARRAY_SIZE (omap3_touchbook_config); -omap2_init_common_hw (mt46h32m32lf6_sdrc_params, - mt46h32m32lf6_sdrc_params); +omap2_init_common_infrastructure (); +omap2_init_common_devices (mt46h32m32lf6_sdrc_params, + mt46h32m32lf6_sdrc_params);omap_init_irq ();#ifdef CONFIG_OMAP_32K_TIMER omap2_gp_clockevent_set_gptimer (12 );
arch/arm/mach-omap2/board-omap4panda.c +2 -1
@@ -76,7 +76,8 @@ static struct platform_device *panda_devices[] __initdata = {static void __init omap4_panda_init_irq (void ) { -omap2_init_common_hw (NULL ,NULL ); +omap2_init_common_infrastructure (); +omap2_init_common_devices (NULL ,NULL );gic_init_irq ();omap_gpio_init (); }
arch/arm/mach-omap2/board-overo.c +3 -2
@@ -413,8 +413,9 @@ static void __init overo_init_irq(void) { omap_board_config = overo_config; omap_board_config_size =ARRAY_SIZE (overo_config); -omap2_init_common_hw (mt46h32m32lf6_sdrc_params, - mt46h32m32lf6_sdrc_params); +omap2_init_common_infrastructure (); +omap2_init_common_devices (mt46h32m32lf6_sdrc_params, + mt46h32m32lf6_sdrc_params);omap_init_irq ();omap_gpio_init (); }
arch/arm/mach-omap2/board-rx51.c +2 -1
@@ -105,8 +105,9 @@ static void __init rx51_init_irq(void) omap_board_config = rx51_config; omap_board_config_size =ARRAY_SIZE (rx51_config);omap3_pm_init_cpuidle (rx51_cpuidle_params); +omap2_init_common_infrastructure (); sdrc_params =rx51_get_sdram_timings (); -omap2_init_common_hw (sdrc_params, sdrc_params); +omap2_init_common_devices (sdrc_params, sdrc_params);omap_init_irq ();omap_gpio_init (); }
arch/arm/mach-omap2/board-zoom.c +5 -4
@@ -35,12 +35,13 @@static void __init omap_zoom_init_irq (void ) { +omap2_init_common_infrastructure ();if (machine_is_omap_zoom2 ()) -omap2_init_common_hw (mt46h32m32lf6_sdrc_params, - mt46h32m32lf6_sdrc_params); +omap2_init_common_devices (mt46h32m32lf6_sdrc_params, + mt46h32m32lf6_sdrc_params);else if (machine_is_omap_zoom3 ()) -omap2_init_common_hw (h8mbx00u0mer0em_sdrc_params, - h8mbx00u0mer0em_sdrc_params); +omap2_init_common_devices (h8mbx00u0mer0em_sdrc_params, + h8mbx00u0mer0em_sdrc_params);omap_init_irq ();omap_gpio_init ();
arch/arm/mach-omap2/io.c +12 -4
@@ -311,11 +311,8 @@ static int __init _omap2_init_reprogram_sdrc(void)return v; } -void __init omap2_init_common_hw (struct omap_sdrc_params *sdrc_cs0, -struct omap_sdrc_params *sdrc_cs1) +void __init omap2_init_common_infrastructure (void ) { -u8 skip_setup_idle =0 ; -pwrdm_init (powerdomains_omap);clkdm_init (clockdomains_omap, clkdm_autodeps);if (cpu_is_omap242x ())
@@ -340,6 +337,17 @@ void __init omap2_init_common_hw(struct omap_sdrc_params *sdrc_cs0,omap4xxx_clk_init (); else pr_err("Could not init clock framework - unknown CPU\n"); +} + +/* +* XXX Ideally, this function will dwindle into nothingness over time; +* almost all device init code should be possible through initcalls +* and other generalized mechanisms +*/ +void __init omap2_init_common_devices (struct omap_sdrc_params *sdrc_cs0, +struct omap_sdrc_params *sdrc_cs1) +{ +u8 skip_setup_idle =0 ;omap_serial_early_init ();
arch/arm/plat-omap/include/plat/io.h +3 -2
@@ -291,8 +291,9 @@ static inline void omap44xx_map_common_io(void) }#endif -extern void omap2_init_common_hw (struct omap_sdrc_params *sdrc_cs0, -struct omap_sdrc_params *sdrc_cs1); +extern void omap2_init_common_infrastructure (void ); +extern void omap2_init_common_devices (struct omap_sdrc_params *sdrc_cs0, +struct omap_sdrc_params *sdrc_cs1);#define __arch_ioremap (p,s,t) omap_ioremap(p,s,t)#define __arch_iounmap (v) omap_iounmap(v)
Paul Walmsley
maintainerPATCH 1/8 OMAP2+: io: split omap2_init_common_hw()
Quoted 7 lines · Paul Walmsley
Split
omap2_init_common_hw()into two functions. The first,omap2_init_common_infrastructure(), initializes the hwmod code and data, the OMAP PM code, and the clock code and data. The second,omap2_init_common_devices(), handles any other early device initialization that, for whatever reason, has not been or cannot be moved to initcalls or early platform devices.
Quoted 8 lines
This patch is required for the hwmod postsetup patch, which allows board files to change the state that hwmods should be placed into at the conclusion of the hwmod
_setup()function. For example, for a board whose creators wish to ensure watchdog coverage across the entire kernel boot process, code to change the watchdog's postsetup state will be added in the board-*.c file between theomap2_init_common_infrastructure()andomap2_init_common_devices()function calls.
This patch has been updated to fix the two new board files in Tony's omap-for-linus branch, board-rm680.c and board-am3517crane.c. The revised patch follows.
- Paul
[PATCH] OMAP2+: io: split omap2_init_common_hw()
Split omap2_init_common_hw() into two functions. The first, omap2_init_common_infrastructure(), initializes the hwmod code and data, the OMAP PM code, and the clock code and data. The second, omap2_init_common_devices(), handles any other early device initialization that, for whatever reason, has not been or cannot be moved to initcalls or early platform devices.
This patch is required for the hwmod postsetup patch, which allows board files to change the state that hwmods should be placed into at the conclusion of the hwmod _setup() function. For example, for a board whose creators wish to ensure watchdog coverage across the entire kernel boot process, code to change the watchdog's postsetup state will be added in the board-*.c file between the omap2_init_common_infrastructure() and omap2_init_common_devices() function calls.
--- arch/arm/mach-omap2/board-2430sdp.c | 3 ++- arch/arm/mach-omap2/board-3430sdp.c | 3 ++- arch/arm/mach-omap2/board-3630sdp.c | 5 +++-- arch/arm/mach-omap2/board-4430sdp.c | 3 ++- arch/arm/mach-omap2/board-am3517crane.c | 3 ++- arch/arm/mach-omap2/board-am3517evm.c | 4 ++-- arch/arm/mach-omap2/board-apollon.c | 3 ++- arch/arm/mach-omap2/board-cm-t35.c | 3 ++- arch/arm/mach-omap2/board-cm-t3517.c | 3 ++- arch/arm/mach-omap2/board-devkit8000.c | 5 +++-- arch/arm/mach-omap2/board-generic.c | 3 ++- arch/arm/mach-omap2/board-h4.c | 3 ++- arch/arm/mach-omap2/board-igep0020.c | 4 +++- arch/arm/mach-omap2/board-igep0030.c | 4 +++- arch/arm/mach-omap2/board-ldp.c | 3 ++- arch/arm/mach-omap2/board-n8x0.c | 3 ++- arch/arm/mach-omap2/board-omap3beagle.c | 5 +++-- arch/arm/mach-omap2/board-omap3evm.c | 3 ++- arch/arm/mach-omap2/board-omap3logic.c | 3 ++- arch/arm/mach-omap2/board-omap3pandora.c | 5 +++-- arch/arm/mach-omap2/board-omap3stalker.c | 3 ++- arch/arm/mach-omap2/board-omap3touchbook.c | 5 +++-- arch/arm/mach-omap2/board-omap4panda.c | 3 ++- arch/arm/mach-omap2/board-overo.c | 5 +++-- arch/arm/mach-omap2/board-rm680.c | 3 ++- arch/arm/mach-omap2/board-rx51.c | 3 ++- arch/arm/mach-omap2/board-zoom.c | 9 +++++---- arch/arm/mach-omap2/io.c | 16 ++++++++++++---- arch/arm/plat-omap/include/plat/io.h | 5 +++-- 29 files changed, 80 insertions(+), 43 deletions(-)
arch/arm/mach-omap2/board-2430sdp.c +2 -1
@@ -143,7 +143,8 @@ static void __init omap_2430sdp_init_irq(void) { omap_board_config = sdp2430_config; omap_board_config_size =ARRAY_SIZE (sdp2430_config); -omap2_init_common_hw (NULL ,NULL ); +omap2_init_common_infrastructure (); +omap2_init_common_devices (NULL ,NULL );omap_init_irq (); }
arch/arm/mach-omap2/board-3430sdp.c +2 -1
@@ -326,7 +326,8 @@ static void __init omap_3430sdp_init_irq(void) omap_board_config = sdp3430_config; omap_board_config_size =ARRAY_SIZE (sdp3430_config);omap3_pm_init_cpuidle (omap3_cpuidle_params_table); -omap2_init_common_hw (hyb18m512160af6_sdrc_params,NULL ); +omap2_init_common_infrastructure (); +omap2_init_common_devices (hyb18m512160af6_sdrc_params,NULL );omap_init_irq (); }
arch/arm/mach-omap2/board-3630sdp.c +3 -2
@@ -73,8 +73,9 @@ static void __init omap_sdp_init_irq(void) { omap_board_config = sdp_config; omap_board_config_size =ARRAY_SIZE (sdp_config); -omap2_init_common_hw (h8mbx00u0mer0em_sdrc_params, - h8mbx00u0mer0em_sdrc_params); +omap2_init_common_infrastructure (); +omap2_init_common_devices (h8mbx00u0mer0em_sdrc_params, + h8mbx00u0mer0em_sdrc_params);omap_init_irq (); }
arch/arm/mach-omap2/board-4430sdp.c +2 -1
@@ -242,7 +242,8 @@ static void __init omap_4430sdp_init_irq(void) { omap_board_config = sdp4430_config; omap_board_config_size =ARRAY_SIZE (sdp4430_config); -omap2_init_common_hw (NULL ,NULL ); +omap2_init_common_infrastructure (); +omap2_init_common_devices (NULL ,NULL );#ifdef CONFIG_OMAP_32K_TIMER omap2_gp_clockevent_set_gptimer (1 );#endif
arch/arm/mach-omap2/board-am3517crane.c +2 -1
@@ -47,7 +47,8 @@ static void __init am3517_crane_init_irq(void) omap_board_config = am3517_crane_config; omap_board_config_size =ARRAY_SIZE (am3517_crane_config); -omap2_init_common_hw (NULL ,NULL ); +omap2_init_common_infrastructure (); +omap2_init_common_devices (NULL ,NULL );omap_init_irq (); }
arch/arm/mach-omap2/board-am3517evm.c +2 -2
@@ -389,8 +389,8 @@ static void __init am3517_evm_init_irq(void) { omap_board_config = am3517_evm_config; omap_board_config_size =ARRAY_SIZE (am3517_evm_config); - -omap2_init_common_hw (NULL ,NULL ); +omap2_init_common_infrastructure (); +omap2_init_common_devices (NULL ,NULL );omap_init_irq (); }
arch/arm/mach-omap2/board-apollon.c +2 -1
@@ -278,7 +278,8 @@ static void __init omap_apollon_init_irq(void) { omap_board_config = apollon_config; omap_board_config_size =ARRAY_SIZE (apollon_config); -omap2_init_common_hw (NULL ,NULL ); +omap2_init_common_infrastructure (); +omap2_init_common_devices (NULL ,NULL );omap_init_irq (); }
arch/arm/mach-omap2/board-cm-t35.c +2 -1
@@ -677,7 +677,8 @@ static void __init cm_t35_init_irq(void) omap_board_config = cm_t35_config; omap_board_config_size =ARRAY_SIZE (cm_t35_config); -omap2_init_common_hw (mt46h32m32lf6_sdrc_params, +omap2_init_common_infrastructure (); +omap2_init_common_devices (mt46h32m32lf6_sdrc_params, mt46h32m32lf6_sdrc_params);omap_init_irq (); }
arch/arm/mach-omap2/board-cm-t3517.c +2 -1
@@ -248,7 +248,8 @@ static void __init cm_t3517_init_irq(void) omap_board_config = cm_t3517_config; omap_board_config_size =ARRAY_SIZE (cm_t3517_config); -omap2_init_common_hw (NULL ,NULL ); +omap2_init_common_infrastructure (); +omap2_init_common_devices (NULL ,NULL );omap_init_irq (); }
arch/arm/mach-omap2/board-devkit8000.c +3 -2
@@ -444,8 +444,9 @@ static struct platform_device keys_gpio = {static void __init devkit8000_init_irq (void ) { -omap2_init_common_hw (mt46h32m32lf6_sdrc_params, - mt46h32m32lf6_sdrc_params); +omap2_init_common_infrastructure (); +omap2_init_common_devices (mt46h32m32lf6_sdrc_params, + mt46h32m32lf6_sdrc_params);omap_init_irq ();#ifdef CONFIG_OMAP_32K_TIMER omap2_gp_clockevent_set_gptimer (12 );
arch/arm/mach-omap2/board-generic.c +2 -1
@@ -37,7 +37,8 @@ static void __init omap_generic_init_irq(void) { omap_board_config = generic_config; omap_board_config_size =ARRAY_SIZE (generic_config); -omap2_init_common_hw (NULL ,NULL ); +omap2_init_common_infrastructure (); +omap2_init_common_devices (NULL ,NULL );omap_init_irq (); }
arch/arm/mach-omap2/board-h4.c +2 -1
@@ -291,7 +291,8 @@ static void __init omap_h4_init_irq(void) { omap_board_config = h4_config; omap_board_config_size =ARRAY_SIZE (h4_config); -omap2_init_common_hw (NULL ,NULL ); +omap2_init_common_infrastructure (); +omap2_init_common_devices (NULL ,NULL );omap_init_irq ();h4_init_flash (); }
arch/arm/mach-omap2/board-igep0020.c +3 -1
@@ -520,7 +520,9 @@ static struct platform_device *igep2_devices[] __initdata = {static void __init igep2_init_irq (void ) { -omap2_init_common_hw (m65kxxxxam_sdrc_params, m65kxxxxam_sdrc_params); +omap2_init_common_infrastructure (); +omap2_init_common_devices (m65kxxxxam_sdrc_params, + m65kxxxxam_sdrc_params);omap_init_irq (); }
arch/arm/mach-omap2/board-igep0030.c +3 -1
@@ -289,7 +289,9 @@ static struct twl4030_usb_data igep3_twl4030_usb_data = {static void __init igep3_init_irq (void ) { -omap2_init_common_hw (m65kxxxxam_sdrc_params, m65kxxxxam_sdrc_params); +omap2_init_common_infrastructure (); +omap2_init_common_devices (m65kxxxxam_sdrc_params, + m65kxxxxam_sdrc_params);omap_init_irq (); }
arch/arm/mach-omap2/board-ldp.c +2 -1
@@ -292,7 +292,8 @@ static void __init omap_ldp_init_irq(void) { omap_board_config = ldp_config; omap_board_config_size =ARRAY_SIZE (ldp_config); -omap2_init_common_hw (NULL ,NULL ); +omap2_init_common_infrastructure (); +omap2_init_common_devices (NULL ,NULL );omap_init_irq (); }
arch/arm/mach-omap2/board-n8x0.c +2 -1
@@ -631,7 +631,8 @@ static void __init n8x0_map_io(void)static void __init n8x0_init_irq (void ) { -omap2_init_common_hw (NULL ,NULL ); +omap2_init_common_infrastructure (); +omap2_init_common_devices (NULL ,NULL );omap_init_irq (); }
arch/arm/mach-omap2/board-omap3beagle.c +3 -2
@@ -484,8 +484,9 @@ static struct platform_device keys_gpio = {static void __init omap3_beagle_init_irq (void ) { -omap2_init_common_hw (mt46h32m32lf6_sdrc_params, - mt46h32m32lf6_sdrc_params); +omap2_init_common_infrastructure (); +omap2_init_common_devices (mt46h32m32lf6_sdrc_params, + mt46h32m32lf6_sdrc_params);omap_init_irq ();#ifdef CONFIG_OMAP_32K_TIMER omap2_gp_clockevent_set_gptimer (12 );
arch/arm/mach-omap2/board-omap3evm.c +2 -1
@@ -623,7 +623,8 @@ static void __init omap3_evm_init_irq(void) { omap_board_config = omap3_evm_config; omap_board_config_size =ARRAY_SIZE (omap3_evm_config); -omap2_init_common_hw (mt46h32m32lf6_sdrc_params,NULL ); +omap2_init_common_infrastructure (); +omap2_init_common_devices (mt46h32m32lf6_sdrc_params,NULL );omap_init_irq (); }
arch/arm/mach-omap2/board-omap3logic.c +2 -1
@@ -197,7 +197,8 @@ static inline void __init board_smsc911x_init(void)static void __init omap3logic_init_irq (void ) { -omap2_init_common_hw (NULL ,NULL ); +omap2_init_common_infrastructure (); +omap2_init_common_devices (NULL ,NULL );omap_init_irq (); }
arch/arm/mach-omap2/board-omap3pandora.c +3 -2
@@ -636,8 +636,9 @@ static struct spi_board_info omap3pandora_spi_board_info[] __initdata = {static void __init omap3pandora_init_irq (void ) { -omap2_init_common_hw (mt46h32m32lf6_sdrc_params, - mt46h32m32lf6_sdrc_params); +omap2_init_common_infrastructure (); +omap2_init_common_devices (mt46h32m32lf6_sdrc_params, + mt46h32m32lf6_sdrc_params);omap_init_irq (); }
arch/arm/mach-omap2/board-omap3stalker.c +2 -1
@@ -584,7 +584,8 @@ static void __init omap3_stalker_init_irq(void) { omap_board_config = omap3_stalker_config; omap_board_config_size =ARRAY_SIZE (omap3_stalker_config); -omap2_init_common_hw (mt46h32m32lf6_sdrc_params,NULL ); +omap2_init_common_infrastructure (); +omap2_init_common_devices (mt46h32m32lf6_sdrc_params,NULL );omap_init_irq ();#ifdef CONFIG_OMAP_32K_TIMER omap2_gp_clockevent_set_gptimer (12 );
arch/arm/mach-omap2/board-omap3touchbook.c +3 -2
@@ -420,8 +420,9 @@ static void __init omap3_touchbook_init_irq(void)omap3_mux_init (board_mux,OMAP_PACKAGE_CBB ); omap_board_config = omap3_touchbook_config; omap_board_config_size =ARRAY_SIZE (omap3_touchbook_config); -omap2_init_common_hw (mt46h32m32lf6_sdrc_params, - mt46h32m32lf6_sdrc_params); +omap2_init_common_infrastructure (); +omap2_init_common_devices (mt46h32m32lf6_sdrc_params, + mt46h32m32lf6_sdrc_params);omap_init_irq ();#ifdef CONFIG_OMAP_32K_TIMER omap2_gp_clockevent_set_gptimer (12 );
arch/arm/mach-omap2/board-omap4panda.c +2 -1
@@ -77,7 +77,8 @@ static struct platform_device *panda_devices[] __initdata = {static void __init omap4_panda_init_irq (void ) { -omap2_init_common_hw (NULL ,NULL ); +omap2_init_common_infrastructure (); +omap2_init_common_devices (NULL ,NULL );gic_init_irq (); }
arch/arm/mach-omap2/board-overo.c +3 -2
@@ -413,8 +413,9 @@ static void __init overo_init_irq(void) { omap_board_config = overo_config; omap_board_config_size =ARRAY_SIZE (overo_config); -omap2_init_common_hw (mt46h32m32lf6_sdrc_params, - mt46h32m32lf6_sdrc_params); +omap2_init_common_infrastructure (); +omap2_init_common_devices (mt46h32m32lf6_sdrc_params, + mt46h32m32lf6_sdrc_params);omap_init_irq (); }
arch/arm/mach-omap2/board-rm680.c +2 -1
@@ -145,8 +145,9 @@ static void __init rm680_init_irq(void) {struct omap_sdrc_params *sdrc_params; +omap2_init_common_infrastructure (); sdrc_params =nokia_get_sdram_timings (); -omap2_init_common_hw (sdrc_params, sdrc_params); +omap2_init_common_devices (sdrc_params, sdrc_params);omap_init_irq (); }
arch/arm/mach-omap2/board-rx51.c +2 -1
@@ -105,8 +105,9 @@ static void __init rx51_init_irq(void) omap_board_config = rx51_config; omap_board_config_size =ARRAY_SIZE (rx51_config);omap3_pm_init_cpuidle (rx51_cpuidle_params); +omap2_init_common_infrastructure (); sdrc_params =nokia_get_sdram_timings (); -omap2_init_common_hw (sdrc_params, sdrc_params); +omap2_init_common_devices (sdrc_params, sdrc_params);omap_init_irq (); }
arch/arm/mach-omap2/board-zoom.c +5 -4
@@ -35,12 +35,13 @@static void __init omap_zoom_init_irq (void ) { +omap2_init_common_infrastructure ();if (machine_is_omap_zoom2 ()) -omap2_init_common_hw (mt46h32m32lf6_sdrc_params, - mt46h32m32lf6_sdrc_params); +omap2_init_common_devices (mt46h32m32lf6_sdrc_params, + mt46h32m32lf6_sdrc_params);else if (machine_is_omap_zoom3 ()) -omap2_init_common_hw (h8mbx00u0mer0em_sdrc_params, - h8mbx00u0mer0em_sdrc_params); +omap2_init_common_devices (h8mbx00u0mer0em_sdrc_params, + h8mbx00u0mer0em_sdrc_params);omap_init_irq (); }
arch/arm/mach-omap2/io.c +12 -4
@@ -331,11 +331,8 @@ static inline void omap_irq_base_init(void)#endif } -void __init omap2_init_common_hw (struct omap_sdrc_params *sdrc_cs0, -struct omap_sdrc_params *sdrc_cs1) +void __init omap2_init_common_infrastructure (void ) { -u8 skip_setup_idle =0 ; -pwrdm_init (powerdomains_omap);clkdm_init (clockdomains_omap, clkdm_autodeps);if (cpu_is_omap242x ())
@@ -360,6 +357,17 @@ void __init omap2_init_common_hw(struct omap_sdrc_params *sdrc_cs0,omap4xxx_clk_init (); else pr_err("Could not init clock framework - unknown CPU\n"); +} + +/* +* XXX Ideally, this function will dwindle into nothingness over time; +* almost all device init code should be possible through initcalls +* and other generalized mechanisms +*/ +void __init omap2_init_common_devices (struct omap_sdrc_params *sdrc_cs0, +struct omap_sdrc_params *sdrc_cs1) +{ +u8 skip_setup_idle =0 ;omap_serial_early_init ();
arch/arm/plat-omap/include/plat/io.h +3 -2
@@ -291,8 +291,9 @@ static inline void omap44xx_map_common_io(void) }#endif -extern void omap2_init_common_hw (struct omap_sdrc_params *sdrc_cs0, -struct omap_sdrc_params *sdrc_cs1); +extern void omap2_init_common_infrastructure (void ); +extern void omap2_init_common_devices (struct omap_sdrc_params *sdrc_cs0, +struct omap_sdrc_params *sdrc_cs1);#define __arch_ioremap omap_ioremap#define __arch_iounmap omap_iounmap
Signature · 1 line
1.7.2.3
Paul Walmsley
maintainerPATCH 2/8 OMAP2+: hwmod: allow custom pre-shutdown functions
In reply to Paul WalmsleySome OMAP IP blocks, such as the watchdog timers, cannot be completely shut down via the standard hwmod shutdown mechanism. This patch enables the hwmod data files to supply a pointer to a custom pre-shutdown function via the struct omap_hwmod_class.pre_shutdown function pointer. If the struct omap_hwmod_class.pre_shutdown function pointer is non-null, the function will be executed before the existing hwmod shutdown code runs.
--- arch/arm/mach-omap2/omap_hwmod.c | 15 +++++++++++++++ arch/arm/plat-omap/include/plat/omap_hwmod.h | 10 ++++++++++ 2 files changed, 25 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/omap_hwmod.c +15 -0
@@ -1261,6 +1261,9 @@ int _omap_hwmod_idle(struct omap_hwmod *oh)*/ static int _shutdown (struct omap_hwmod *oh) { +int ret; +u8 prev_state; +if (oh->_state != _HWMOD_STATE_IDLE && oh->_state != _HWMOD_STATE_ENABLED) { WARN(1, "omap_hwmod: %s: disabled state can only be entered "
@@ -1270,6 +1273,18 @@ static int _shutdown(struct omap_hwmod *oh)pr_debug ("omap_hwmod: %s: disabling\n" , oh->name); +if (oh->class->pre_shutdown) { + prev_state = oh->_state; +if (oh->_state == _HWMOD_STATE_IDLE) +_omap_hwmod_enable (oh); + ret = oh->class->pre_shutdown (oh); +if (ret) { +if (prev_state == _HWMOD_STATE_IDLE) +_omap_hwmod_idle (oh); +return ret; + } + } +if (oh->class->sysc)_shutdown_sysc (oh);
arch/arm/plat-omap/include/plat/omap_hwmod.h +10 -0
@@ -415,14 +415,24 @@ struct omap_hwmod_omap4_prcm {* @name: name of the hwmod_class * @sysc: device SYSCONFIG/SYSSTATUS register data * @rev: revision of the IP class +* @pre_shutdown: ptr to fn to be executed immediately prior to device shutdown * * Represent the class of a OMAP hardware "modules" (e.g. timer, * smartreflex, gpio, uart...) +* +* @pre_shutdown is a function that will be run immediately before +* hwmod clocks are disabled, etc. It is intended for use for hwmods +* like the MPU watchdog, which cannot be disabled with the standard +* omap_hwmod_shutdown(). The function should return 0 upon success, +* or some negative error upon failure. Returning an error will cause +* omap_hwmod_shutdown() to abort the device shutdown and return an +* error. */ struct omap_hwmod_class {const char *name;struct omap_hwmod_class_sysconfig *sysc;u32 rev; +int (*pre_shutdown)(struct omap_hwmod *oh); };/**
Paul Walmsley
maintainerPATCH 3/8 OMAP2+: hwmod: add postsetup state
In reply to Paul WalmsleyAllow board files and OMAP core code to control the state that some or all of the hwmods end up in at the end of _setup() (called by omap_hwmod_late_init() ). Reimplement the old skip_setup_idle code in terms of this new postsetup state code.
There are two use-cases for this patch: the !CONFIG_PM_RUNTIME case, in which all IP blocks should stay enabled after _setup() finishes; and the MPU watchdog case, in which the watchdog IP block should enter idle if watchdog coverage of kernel initialization is desired, and should be disabled otherwise.
--- arch/arm/mach-omap2/io.c | 32 ++++++---- arch/arm/mach-omap2/omap_hwmod.c | 82 ++++++++++++++++++++------ arch/arm/plat-omap/include/plat/omap_hwmod.h | 6 ++ 3 files changed, 88 insertions(+), 32 deletions(-)
arch/arm/mach-omap2/io.c +20 -12
@@ -311,8 +311,15 @@ static int __init _omap2_init_reprogram_sdrc(void)return v; } +static int _set_hwmod_postsetup_state (struct omap_hwmod *oh,void *data) +{ +return omap_hwmod_set_postsetup_state (oh, *(u8 *)data); +} +void __init omap2_init_common_infrastructure (void ) { +u8 postsetup_state; +pwrdm_init (powerdomains_omap);clkdm_init (clockdomains_omap, clkdm_autodeps);if (cpu_is_omap242x ())
@@ -323,6 +330,16 @@ void __init omap2_init_common_infrastructure(void)omap3xxx_hwmod_init (); else if (cpu_is_omap44xx()) omap44xx_hwmod_init(); + else + pr_err("Could not init hwmod data - unknown SoC\n"); + +/* Set the default postsetup state for all hwmods */ +#ifdef CONFIG_PM_RUNTIME + postsetup_state = _HWMOD_STATE_IDLE; +#else + postsetup_state = _HWMOD_STATE_ENABLED; +#endif +omap_hwmod_for_each (_set_hwmod_postsetup_state, &postsetup_state);/* The OPP tables have to be registered before a clk init */ omap_pm_if_early_init (mpu_opps, dsp_opps, l3_opps);
@@ -336,25 +353,16 @@ void __init omap2_init_common_infrastructure(void)else if (cpu_is_omap44xx ())omap4xxx_clk_init ();else -pr_err ("Could not init clock framework - unknown CPU\n" ); +pr_err ("Could not init clock framework - unknown SoC\n" ); } -/* -* XXX Ideally, this function will dwindle into nothingness over time; -* almost all device init code should be possible through initcalls -* and other generalized mechanisms -*/ void __init omap2_init_common_devices (struct omap_sdrc_params *sdrc_cs0,struct omap_sdrc_params *sdrc_cs1) { -u8 skip_setup_idle =0 ; -omap_serial_early_init (); -#ifndef CONFIG_PM_RUNTIME - skip_setup_idle =1 ; -#endif -omap_hwmod_late_init (skip_setup_idle); +omap_hwmod_late_init (); +if (cpu_is_omap24xx () ||cpu_is_omap34xx ()) {omap2_sdrc_init (sdrc_cs0, sdrc_cs1);_omap2_init_reprogram_sdrc ();
arch/arm/mach-omap2/omap_hwmod.c +63 -19
133 lines not on this page · raw message
arch/arm/plat-omap/include/plat/omap_hwmod.h +5 -1
@@ -462,6 +462,7 @@ struct omap_hwmod_class {* @response_lat: device OCP response latency (in interface clock cycles) * @_int_flags: internal-use hwmod flags * @_state: internal-use hwmod state +* @_postsetup_state: internal-use state to leave the hwmod in after _setup() * @flags: hwmod flags (documented below) * @omap_chip: OMAP chips this hwmod is present on * @_mutex: mutex serializing operations on this hwmod
@@ -510,6 +511,7 @@ struct omap_hwmod {u8 hwmods_cnt;u8 _int_flags;u8 _state; +u8 _postsetup_state;const struct omap_chip_id omap_chip; };
@@ -519,7 +521,7 @@ int omap_hwmod_unregister(struct omap_hwmod *oh);struct omap_hwmod *omap_hwmod_lookup (const char *name);int omap_hwmod_for_each (int (*fn)(struct omap_hwmod *oh,void *data),void *data); -int omap_hwmod_late_init (u8 skip_setup_idle); +int omap_hwmod_late_init (void );int omap_hwmod_enable (struct omap_hwmod *oh);int _omap_hwmod_enable (struct omap_hwmod *oh);
@@ -566,6 +568,8 @@ int omap_hwmod_for_each_by_class(const char *classname, void *user), void *user); +int omap_hwmod_set_postsetup_state (struct omap_hwmod *oh,u8 state); +/* * Chip variant-specific hwmod init routines - XXX should be converted * to use initcalls once the initial boot ordering is straightened out
Paul Walmsley
maintainerPATCH 4/8 OMAP2+: hwmod: add support for per-class custom device reset functions
In reply to Paul WalmsleyThe standard omap_hwmod.c _reset() code relies on an IP block's OCP_SYSCONFIG.SOFTRESET register bit to reset the IP block. This works for most IP blocks on the chip, but unfortunately not all. For example, initiator-only IP blocks often don't have any MPU-accessible OCP-header registers, and therefore the MPU can't write to any OCP_SYSCONFIG registers in that block. Other IP blocks, such as the IVA, require a specialized reset sequence.
Since we need to be able to reset these IP blocks as well, allow custom IP block reset functions to be passed into the hwmod code via a per-hwmod-class reset function pointer, struct omap_hwmod_class.reset. If .reset is non-null, then the hwmod _reset() code will call the custom function instead of the standard OCP SOFTRESET-based code.
As part of this change, rename most of the existing _reset() function code to _ocp_softreset(), to indicate more clearly that it does not work for all cases.
--- arch/arm/mach-omap2/omap_hwmod.c | 38 +++++++++++++++++++++++--- arch/arm/plat-omap/include/plat/omap_hwmod.h | 9 +++++- 2 files changed, 41 insertions(+), 6 deletions(-)
arch/arm/mach-omap2/omap_hwmod.c +33 -5
@@ -1089,7 +1089,7 @@ static int _read_hardreset(struct omap_hwmod *oh, const char *name) }/** -* _reset - reset an omap_hwmod +* _ocp_softreset - reset an omap_hwmod via the OCP_SYSCONFIG bit * @oh: struct omap_hwmod * * * Resets an omap_hwmod @oh via the OCP_SYSCONFIG bit. hwmod must be
@@ -1098,12 +1098,13 @@ static int _read_hardreset(struct omap_hwmod *oh, const char *name)* the module did not reset in time, or 0 upon success. * * In OMAP3 a specific SYSSTATUS register is used to get the reset status. -* Starting in OMAP4, some IPs does not have SYSSTATUS register and instead +* Starting in OMAP4, some IPs do not have SYSSTATUS registers and instead * use the SYSCONFIG softreset bit to provide the status. * -* Note that some IP like McBSP does have a reset control but no reset status. +* Note that some IP like McBSP do have reset control but don't have +* reset status. */ -static int _reset (struct omap_hwmod *oh) +static int _ocp_softreset (struct omap_hwmod *oh) {u32 v;int c =0 ;
@@ -1124,7 +1125,7 @@ static int _reset(struct omap_hwmod *oh)if (oh->flags &HWMOD_CONTROL_OPT_CLKS_IN_RESET )_enable_optional_clocks (oh); -pr_debug ("omap_hwmod: %s: resetting\n" , oh->name); +pr_debug ("omap_hwmod: %s: resetting via OCP SOFTRESET\n" , oh->name); v = oh->_sysc_cache; ret =_set_softreset (oh, &v);
@@ -1164,6 +1165,33 @@ dis_opt_clks: }/** +* _reset - reset an omap_hwmod +* @oh: struct omap_hwmod * +* +* Resets an omap_hwmod @oh. The default software reset mechanism for +* most OMAP IP blocks is triggered via the OCP_SYSCONFIG.SOFTRESET +* bit. However, some hwmods cannot be reset via this method: some +* are not targets and therefore have no OCP header registers to +* access; others (like the IVA) have idiosyncratic reset sequences. +* So for these relatively rare cases, custom reset code can be +* supplied in the struct omap_hwmod_class .reset function pointer. +* Passes along the return value from either _reset() or the custom +* reset function - these must return -EINVAL if the hwmod cannot be +* reset this way or if the hwmod is in the wrong state, -ETIMEDOUT if +* the module did not reset in time, or 0 upon success. +*/ +static int _reset (struct omap_hwmod *oh) +{ +int ret; + +pr_debug ("omap_hwmod: %s: resetting\n" , oh->name); + + ret = (oh->class->reset) ? oh->class->reset (oh) :_ocp_softreset (oh); + +return ret; +} + +/** * _omap_hwmod_enable - enable an omap_hwmod * @oh: struct omap_hwmod * *
arch/arm/plat-omap/include/plat/omap_hwmod.h +8 -1
@@ -364,7 +364,7 @@ struct omap_hwmod_omap4_prcm {* when module is enabled, rather than the default, which is to * enable autoidle * HWMOD_SET_DEFAULT_CLOCKACT: program CLOCKACTIVITY bits at startup -* HWMOD_NO_IDLEST : this module does not have idle status - this is the case +* HWMOD_NO_IDLEST: this module does not have idle status - this is the case * only for few initiator modules on OMAP2 & 3. * HWMOD_CONTROL_OPT_CLKS_IN_RESET: Enable all optional clocks during reset. * This is needed for devices like DSS that require optional clocks enabled
@@ -416,6 +416,7 @@ struct omap_hwmod_omap4_prcm {* @sysc: device SYSCONFIG/SYSSTATUS register data * @rev: revision of the IP class * @pre_shutdown: ptr to fn to be executed immediately prior to device shutdown +* @reset: ptr to fn to be executed in place of the standard hwmod reset fn * * Represent the class of a OMAP hardware "modules" (e.g. timer, * smartreflex, gpio, uart...)
@@ -427,12 +428,18 @@ struct omap_hwmod_omap4_prcm {* or some negative error upon failure. Returning an error will cause * omap_hwmod_shutdown() to abort the device shutdown and return an * error. +* +* If @reset is defined, then the function it points to will be +* executed in place of the standard hwmod _reset() code in +* mach-omap2/omap_hwmod.c. This is needed for IP blocks which have +* unusual reset sequences - usually processor IP blocks like the IVA. */ struct omap_hwmod_class {const char *name;struct omap_hwmod_class_sysconfig *sysc;u32 rev;int (*pre_shutdown)(struct omap_hwmod *oh); +int (*reset)(struct omap_hwmod *oh); };/**
Paul Walmsley
maintainerPATCH 5/8 OMAP2+: hwmod: rename omap_hwmod_mutex to _hwmod_list_mutex
In reply to Paul WalmsleyThis trivial patch renames omap_hwmod_mutex to _hwmod_list_mutex to indicate clearly that it is only used for hwmod list manipulation operations.
--- arch/arm/mach-omap2/omap_hwmod.c | 27 ++++++++++++++------------- 1 files changed, 14 insertions(+), 13 deletions(-)
arch/arm/mach-omap2/omap_hwmod.c +14 -13
@@ -156,7 +156,8 @@/* omap_hwmod_list contains all registered struct omap_hwmods */ static LIST_HEAD (omap_hwmod_list); -static DEFINE_MUTEX (omap_hwmod_mutex); +/* _hwmod_list_mutex protects the list of registered hwmods */ +static DEFINE_MUTEX (_hwmod_list_mutex);/* mpu_oh: used to add/remove MPU initiator from sleepdep list */ static struct omap_hwmod *mpu_oh;
@@ -874,7 +875,7 @@ static void _shutdown_sysc(struct omap_hwmod *oh)* @name: find an omap_hwmod by name * * Return a pointer to an omap_hwmod by name, or NULL if not found. -* Caller must hold omap_hwmod_mutex. +* Caller must hold _hwmod_list_mutex. */ static struct omap_hwmod *_lookup (const char *name) {
@@ -1502,7 +1503,7 @@ int omap_hwmod_register(struct omap_hwmod *oh) (oh->_state != _HWMOD_STATE_UNKNOWN))return -EINVAL ; -mutex_lock (&omap_hwmod_mutex); +mutex_lock (&_hwmod_list_mutex);pr_debug ("omap_hwmod: %s: registering\n" , oh->name);
@@ -1528,7 +1529,7 @@ int omap_hwmod_register(struct omap_hwmod *oh) ret =0 ; ohr_unlock: -mutex_unlock (&omap_hwmod_mutex); +mutex_unlock (&_hwmod_list_mutex);return ret; }
@@ -1546,9 +1547,9 @@ struct omap_hwmod *omap_hwmod_lookup(const char *name)if (!name)return NULL ; -mutex_lock (&omap_hwmod_mutex); +mutex_lock (&_hwmod_list_mutex); oh =_lookup (name); -mutex_unlock (&omap_hwmod_mutex); +mutex_unlock (&_hwmod_list_mutex);return oh; }
@@ -1574,13 +1575,13 @@ int omap_hwmod_for_each(int (*fn)(struct omap_hwmod *oh, void *data),if (!fn)return -EINVAL ; -mutex_lock (&omap_hwmod_mutex); +mutex_lock (&_hwmod_list_mutex);list_for_each_entry (temp_oh, &omap_hwmod_list, node) { ret = (*fn)(temp_oh, data);if (ret)break ; } -mutex_unlock (&omap_hwmod_mutex); +mutex_unlock (&_hwmod_list_mutex);return ret; }
@@ -1663,10 +1664,10 @@ int omap_hwmod_unregister(struct omap_hwmod *oh)pr_debug ("omap_hwmod: %s: unregistering\n" , oh->name); -mutex_lock (&omap_hwmod_mutex); +mutex_lock (&_hwmod_list_mutex);iounmap (oh->_mpu_rt_va);list_del (&oh->node); -mutex_unlock (&omap_hwmod_mutex); +mutex_unlock (&_hwmod_list_mutex);return 0 ; }
@@ -2125,7 +2126,7 @@ int omap_hwmod_read_hardreset(struct omap_hwmod *oh, const char *name)* @user: arbitrary context data to pass to the callback function * * For each omap_hwmod of class @classname, call @fn. Takes -* omap_hwmod_mutex to prevent the hwmod list from changing during the +* _hwmod_list_mutex to prevent the hwmod list from changing during the * iteration. If the callback function returns something other than * zero, the iterator is terminated, and the callback function's return * value is passed back to the caller. Returns 0 upon success, -EINVAL
@@ -2145,7 +2146,7 @@ int omap_hwmod_for_each_by_class(const char *classname,pr_debug ("omap_hwmod: %s: looking for modules of class %s\n" , __func__, classname); -mutex_lock (&omap_hwmod_mutex); +mutex_lock (&_hwmod_list_mutex);list_for_each_entry (temp_oh, &omap_hwmod_list, node) {if (!strcmp (temp_oh->class->name, classname)) {
@@ -2157,7 +2158,7 @@ int omap_hwmod_for_each_by_class(const char *classname, } } -mutex_unlock (&omap_hwmod_mutex); +mutex_unlock (&_hwmod_list_mutex);if (ret) pr_debug("omap_hwmod: %s: iterator terminated early: %d\n",
PATCH 5/8 OMAP2+: hwmod: rename omap_hwmod_mutex to _hwmod_list_mutex
Hi Paul,
Funny, I was about to send you a RFC to get rid of that mutex :-)
Today that mutex is preventing us to be re-entrant during hwmod lookup and for_each_by_class iteration, and we'd like to in order to manage link between 2 hwmods.
The context is the link between mcbsp and sidetone on OMAP3. Since this module are tightly coupled, I was suggesting to Kishon to add the sidetone reference directly in the mcbsp hwmod in order to create a omap_device that will handle the 2 hwmods at the same time.
Since we are using the iteration to get all the hwmod that belongs to the mcbsp class we cannot call the lookup function to get the sidetone hwmod at that time.
For the moment we need to do 2 iteration and use intermediate storage to workaround that.
After checking the purpose of the mutex, I was wondering if this is useful. For the moment the creation of the hwmod list is done only at init time, and nothing is supposed to change that at runtime except the unregister function.
So I've started to get rid of this function, then of the mutex and I added the __init to all these registration functions to avoid the usage at runtime. It will save a little bit of memory as well.
Thanks to that we can now use the omap_hwmod_lookup inside the omap_hwmod_for_each_by_class.
Does that make sense to you?
I can send you the patches if you want.
Regards,
Benoit
Quoted 120 lines · Paul Walmsley
This trivial patch renames
omap_hwmod_mutexto_hwmod_list_mutexto indicate clearly that it is only used for hwmod list manipulation operations.Signed-off-by Paul Walmsley<[email protected]>Cc Beno?t Cousson<[email protected]>--- arch/arm/mach-omap2/omap_hwmod.c | 27 ++++++++++++++------------- 1 files changed, 14 insertions(+), 13 deletions(-)arch/arm/mach-omap2/omap_hwmod.c +14
-13@@ -156,7 +156,8 @@/* omap_hwmod_list contains all registered struct omap_hwmods */ static LIST_HEAD (omap_hwmod_list); -static DEFINE_MUTEX (omap_hwmod_mutex); +/* _hwmod_list_mutex protects the list of registered hwmods */ +static DEFINE_MUTEX (_hwmod_list_mutex);/* mpu_oh: used to add/remove MPU initiator from sleepdep list */ static struct omap_hwmod *mpu_oh;@@ -874,7 +875,7 @@ static void _shutdown_sysc(struct omap_hwmod *oh)* @name: find an omap_hwmod by name * * Return a pointer to an omap_hwmod by name, or NULL if not found. -* Caller must hold omap_hwmod_mutex. +* Caller must hold _hwmod_list_mutex. */ static struct omap_hwmod *_lookup (const char *name) {@@ -1502,7 +1503,7 @@ int omap_hwmod_register(struct omap_hwmod *oh) (oh->_state != _HWMOD_STATE_UNKNOWN))return -EINVAL ; -mutex_lock (&omap_hwmod_mutex); +mutex_lock (&_hwmod_list_mutex);pr_debug ("omap_hwmod: %s: registering\n" , oh->name);@@ -1528,7 +1529,7 @@ int omap_hwmod_register(struct omap_hwmod *oh) ret =0 ; ohr_unlock: -mutex_unlock (&omap_hwmod_mutex); +mutex_unlock (&_hwmod_list_mutex);return ret; }@@ -1546,9 +1547,9 @@ struct omap_hwmod *omap_hwmod_lookup(const char *name)if (!name)return NULL ; -mutex_lock (&omap_hwmod_mutex); +mutex_lock (&_hwmod_list_mutex); oh =_lookup (name); -mutex_unlock (&omap_hwmod_mutex); +mutex_unlock (&_hwmod_list_mutex);return oh; }@@ -1574,13 +1575,13 @@ int omap_hwmod_for_each(int (*fn)(struct omap_hwmod *oh, void *data),if (!fn)return -EINVAL ; -mutex_lock (&omap_hwmod_mutex); +mutex_lock (&_hwmod_list_mutex);list_for_each_entry (temp_oh,&omap_hwmod_list, node) { ret = (*fn)(temp_oh, data);if (ret)break ; } -mutex_unlock (&omap_hwmod_mutex); +mutex_unlock (&_hwmod_list_mutex);return ret; }@@ -1663,10 +1664,10 @@ int omap_hwmod_unregister(struct omap_hwmod *oh)pr_debug ("omap_hwmod: %s: unregistering\n" , oh->name); -mutex_lock (&omap_hwmod_mutex); +mutex_lock (&_hwmod_list_mutex);iounmap (oh->_mpu_rt_va);list_del (&oh->node); -mutex_unlock (&omap_hwmod_mutex); +mutex_unlock (&_hwmod_list_mutex);return 0 ; }@@ -2125,7 +2126,7 @@ int omap_hwmod_read_hardreset(struct omap_hwmod *oh, const char *name)* @user: arbitrary context data to pass to the callback function * * For each omap_hwmod of class @classname, call @fn. Takes -* omap_hwmod_mutex to prevent the hwmod list from changing during the +* _hwmod_list_mutex to prevent the hwmod list from changing during the * iteration. If the callback function returns something other than * zero, the iterator is terminated, and the callback function's return * value is passed back to the caller. Returns 0 upon success, -EINVAL @@ -2145,7 +2146,7 @@ int omap_hwmod_for_each_by_class(const char *classname,pr_debug ("omap_hwmod: %s: looking for modules of class %s\n" , __func__, classname); -mutex_lock (&omap_hwmod_mutex); +mutex_lock (&_hwmod_list_mutex);list_for_each_entry (temp_oh,&omap_hwmod_list, node) {if (!strcmp (temp_oh->class->name, classname)) {@@ -2157,7 +2158,7 @@ int omap_hwmod_for_each_by_class(const char *classname, } } -mutex_unlock (&omap_hwmod_mutex); +mutex_unlock (&_hwmod_list_mutex);if (ret) pr_debug("omap_hwmod: %s: iterator terminated early: %d\n",
Paul Walmsley
maintainerPATCH 5/8 OMAP2+: hwmod: rename omap_hwmod_mutex to _hwmod_list_mutex
Hi Beno?t,
Quoted 25 lines · Benoit
Funny, I was about to send you a RFC to get rid of that mutex :-)
Today that mutex is preventing us to be re-entrant during hwmod lookup and
for_each_by_classiteration, and we'd like to in order to manage link between 2 hwmods.The context is the link between mcbsp and sidetone on OMAP3. Since this module are tightly coupled, I was suggesting to Kishon to add the sidetone reference directly in the mcbsp hwmod in order to create a
omap_devicethat will handle the 2 hwmods at the same time.Since we are using the iteration to get all the hwmod that belongs to the mcbsp class we cannot call the lookup function to get the sidetone hwmod at that time.
For the moment we need to do 2 iteration and use intermediate storage to workaround that.After checking the purpose of the mutex, I was wondering if this is useful. For the moment the creation of the hwmod list is done only at init time, and nothing is supposed to change that at runtime except the unregister function.
So I've started to get rid of this function, then of the mutex and I added the
__initto all these registration functions to avoid the usage at runtime. It will save a little bit of memory as well.
Quoted 5 lines
Thanks to that we can now use the
omap_hwmod_lookupinside theomap_hwmod_for_each_by_class.Does that make sense to you?
I can send you the patches if you want.
Yep, that sounds fine to me. I'll plan to drop the mutex rename patch once you send your patch to avoid the noise. I guess that omap_hwmod_register() can become static also, and can be renamed to _register(), and we'll just use omap_hwmod_init() as the entry point to register hwmods.
- Paul
Paul Walmsley
maintainerPATCH 6/8 OMAP2+: hwmod: upgrade per-hwmod mutex to a spinlock
In reply to Paul WalmsleyChange the per-hwmod mutex to a spinlock. (The per-hwmod lock serializes most post-initialization hwmod operations such as enable, idle, and shutdown.) Spinlocks are needed, because in some cases, hwmods must be enabled from timer interrupt disabled-context, such as an ISR. The current use-case that is driving this is the OMAP GPIO block ISR: it can trigger interrupts even with its clocks disabled, but these clocks are needed for register accesses in the ISR to succeed.
This patch also effectively reverts commit 848240223c35fcc71c424ad51a8e8aef42d3879c - this patch makes _omap_hwmod_enable() and _omap_hwmod_init() static, renames them back to _enable() and _idle(), and changes their callers to call the spinlocking versions. Previously, since omap_hwmod_{enable,init}() attempted to take mutexes, these functions could not be called while the timer interrupt was disabled; but now that the functions use spinlocks and save and restore the IRQ state, it is appropriate to call them directly.
Kevin Hilman <[email protected]> originally proposed this patch - thanks Kevin.
--- arch/arm/mach-omap2/omap_hwmod.c | 105 +++++++++++++++----------- arch/arm/mach-omap2/serial.c | 9 -- arch/arm/plat-omap/include/plat/omap_hwmod.h | 6 + 3 files changed, 64 insertions(+), 56 deletions(-)
arch/arm/mach-omap2/omap_hwmod.c +59 -46
@@ -135,6 +135,7 @@#include <linux/err.h> #include <linux/list.h> #include <linux/mutex.h> +#include <linux/spinlock.h> #include <plat/common.h> #include <plat/cpu.h>
@@ -1193,17 +1194,14 @@ static int _reset(struct omap_hwmod *oh) }/** -* _omap_hwmod_enable - enable an omap_hwmod +* _enable - enable an omap_hwmod * @oh: struct omap_hwmod * * * Enables an omap_hwmod @oh such that the MPU can access the hwmod's -* register target. (This function has a full name -- -* _omap_hwmod_enable() rather than simply _enable() -- because it is -* currently required by the pm34xx.c idle loop.) Returns -EINVAL if -* the hwmod is in the wrong state or passes along the return value of -* _wait_target_ready(). +* register target. Returns -EINVAL if the hwmod is in the wrong +* state or passes along the return value of _wait_target_ready(). */ -int _omap_hwmod_enable (struct omap_hwmod *oh) +static int _enable (struct omap_hwmod *oh) {int r;
@@ -1250,16 +1248,14 @@ int _omap_hwmod_enable(struct omap_hwmod *oh) }/** -* _omap_hwmod_idle - idle an omap_hwmod +* _idle - idle an omap_hwmod * @oh: struct omap_hwmod * * * Idles an omap_hwmod @oh. This should be called once the hwmod has -* no further work. (This function has a full name -- -* _omap_hwmod_idle() rather than simply _idle() -- because it is -* currently required by the pm34xx.c idle loop.) Returns -EINVAL if -* the hwmod is in the wrong state or returns 0. +* no further work. Returns -EINVAL if the hwmod is in the wrong +* state or returns 0. */ -int _omap_hwmod_idle (struct omap_hwmod *oh) +static int _idle (struct omap_hwmod *oh) {if (oh->_state != _HWMOD_STATE_ENABLED) { WARN(1, "omap_hwmod: %s: idle state can only be entered from "
@@ -1305,11 +1301,11 @@ static int _shutdown(struct omap_hwmod *oh)if (oh->class->pre_shutdown) { prev_state = oh->_state;if (oh->_state == _HWMOD_STATE_IDLE) -_omap_hwmod_enable (oh); +_enable (oh); ret = oh->class->pre_shutdown (oh);if (ret) {if (prev_state == _HWMOD_STATE_IDLE) -_omap_hwmod_idle (oh); +_idle (oh);return ret; } }
@@ -1382,7 +1378,7 @@ static int _setup(struct omap_hwmod *oh, void *data)if ((oh->flags &HWMOD_INIT_NO_RESET ) && oh->rst_lines_cnt ==1 )return 0 ; - r =_omap_hwmod_enable (oh); + r =_enable (oh);if (r) {pr_warning ("omap_hwmod: %s: cannot be enabled (%d)\n" , oh->name, oh->_state);
@@ -1394,7 +1390,7 @@ static int _setup(struct omap_hwmod *oh, void *data)/* * OCP_SYSCONFIG bits need to be reprogrammed after a softreset. -* The _omap_hwmod_enable() function should be split to +* The _enable() function should be split to * avoid the rewrite of the OCP_SYSCONFIG register. */ if (oh->class->sysc) {
@@ -1416,7 +1412,7 @@ static int _setup(struct omap_hwmod *oh, void *data) postsetup_state = _HWMOD_STATE_ENABLED;if (postsetup_state == _HWMOD_STATE_IDLE) -_omap_hwmod_idle (oh); +_idle (oh);else if (postsetup_state == _HWMOD_STATE_DISABLED)_shutdown (oh);else if (postsetup_state != _HWMOD_STATE_ENABLED)
@@ -1522,7 +1518,7 @@ int omap_hwmod_register(struct omap_hwmod *oh)list_add_tail (&oh->node, &omap_hwmod_list); -mutex_init (&oh->_mutex); +spin_lock_init (&oh->_lock); oh->_state = _HWMOD_STATE_REGISTERED;
@@ -1682,18 +1678,18 @@ int omap_hwmod_unregister(struct omap_hwmod *oh)int omap_hwmod_enable (struct omap_hwmod *oh) {int r; +unsigned long flags;if (!oh)return -EINVAL ; -mutex_lock (&oh->_mutex); - r =_omap_hwmod_enable (oh); -mutex_unlock (&oh->_mutex); +spin_lock_irqsave (&oh->_lock, flags); + r =_enable (oh); +spin_unlock_irqrestore (&oh->_lock, flags);return r; } -/** * omap_hwmod_idle - idle an omap_hwmod * @oh: struct omap_hwmod *
@@ -1703,12 +1699,14 @@ int omap_hwmod_enable(struct omap_hwmod *oh)*/ int omap_hwmod_idle (struct omap_hwmod *oh) { +unsigned long flags; +if (!oh)return -EINVAL ; -mutex_lock (&oh->_mutex); -_omap_hwmod_idle (oh); -mutex_unlock (&oh->_mutex); +spin_lock_irqsave (&oh->_lock, flags); +_idle (oh); +spin_unlock_irqrestore (&oh->_lock, flags);return 0 ; }
@@ -1723,12 +1721,14 @@ int omap_hwmod_idle(struct omap_hwmod *oh)*/ int omap_hwmod_shutdown (struct omap_hwmod *oh) { +unsigned long flags; +if (!oh)return -EINVAL ; -mutex_lock (&oh->_mutex); +spin_lock_irqsave (&oh->_lock, flags);_shutdown (oh); -mutex_unlock (&oh->_mutex); +spin_unlock_irqrestore (&oh->_lock, flags);return 0 ; }
@@ -1741,9 +1741,11 @@ int omap_hwmod_shutdown(struct omap_hwmod *oh)*/ int omap_hwmod_enable_clocks (struct omap_hwmod *oh) { -mutex_lock (&oh->_mutex); +unsigned long flags; + +spin_lock_irqsave (&oh->_lock, flags);_enable_clocks (oh); -mutex_unlock (&oh->_mutex); +spin_unlock_irqrestore (&oh->_lock, flags);return 0 ; }
@@ -1756,9 +1758,11 @@ int omap_hwmod_enable_clocks(struct omap_hwmod *oh)*/ int omap_hwmod_disable_clocks (struct omap_hwmod *oh) { -mutex_lock (&oh->_mutex); +unsigned long flags; + +spin_lock_irqsave (&oh->_lock, flags);_disable_clocks (oh); -mutex_unlock (&oh->_mutex); +spin_unlock_irqrestore (&oh->_lock, flags);return 0 ; }
@@ -1802,13 +1806,14 @@ void omap_hwmod_ocp_barrier(struct omap_hwmod *oh)int omap_hwmod_reset (struct omap_hwmod *oh) {int r; +unsigned long flags;if (!oh)return -EINVAL ; -mutex_lock (&oh->_mutex); +spin_lock_irqsave (&oh->_lock, flags); r =_reset (oh); -mutex_unlock (&oh->_mutex); +spin_unlock_irqrestore (&oh->_lock, flags);return r; }
@@ -2005,13 +2010,15 @@ int omap_hwmod_del_initiator_dep(struct omap_hwmod *oh,*/ int omap_hwmod_enable_wakeup (struct omap_hwmod *oh) { +unsigned long flags; +if (!oh->class->sysc || !(oh->class->sysc->sysc_flags &SYSC_HAS_ENAWAKEUP ))return -EINVAL ; -mutex_lock (&oh->_mutex); +spin_lock_irqsave (&oh->_lock, flags);_enable_wakeup (oh); -mutex_unlock (&oh->_mutex); +spin_unlock_irqrestore (&oh->_lock, flags);return 0 ; }
@@ -2030,13 +2037,15 @@ int omap_hwmod_enable_wakeup(struct omap_hwmod *oh)*/ int omap_hwmod_disable_wakeup (struct omap_hwmod *oh) { +unsigned long flags; +if (!oh->class->sysc || !(oh->class->sysc->sysc_flags &SYSC_HAS_ENAWAKEUP ))return -EINVAL ; -mutex_lock (&oh->_mutex); +spin_lock_irqsave (&oh->_lock, flags);_disable_wakeup (oh); -mutex_unlock (&oh->_mutex); +spin_unlock_irqrestore (&oh->_lock, flags);return 0 ; }
@@ -2056,13 +2065,14 @@ int omap_hwmod_disable_wakeup(struct omap_hwmod *oh)int omap_hwmod_assert_hardreset (struct omap_hwmod *oh,const char *name) {int ret; +unsigned long flags;if (!oh)return -EINVAL ; -mutex_lock (&oh->_mutex); +spin_lock_irqsave (&oh->_lock, flags); ret =_assert_hardreset (oh, name); -mutex_unlock (&oh->_mutex); +spin_unlock_irqrestore (&oh->_lock, flags);return ret; }
@@ -2082,13 +2092,14 @@ int omap_hwmod_assert_hardreset(struct omap_hwmod *oh, const char *name)int omap_hwmod_deassert_hardreset (struct omap_hwmod *oh,const char *name) {int ret; +unsigned long flags;if (!oh)return -EINVAL ; -mutex_lock (&oh->_mutex); +spin_lock_irqsave (&oh->_lock, flags); ret =_deassert_hardreset (oh, name); -mutex_unlock (&oh->_mutex); +spin_unlock_irqrestore (&oh->_lock, flags);return ret; }
@@ -2107,13 +2118,14 @@ int omap_hwmod_deassert_hardreset(struct omap_hwmod *oh, const char *name)int omap_hwmod_read_hardreset (struct omap_hwmod *oh,const char *name) {int ret; +unsigned long flags;if (!oh)return -EINVAL ; -mutex_lock (&oh->_mutex); +spin_lock_irqsave (&oh->_lock, flags); ret =_read_hardreset (oh, name); -mutex_unlock (&oh->_mutex); +spin_unlock_irqrestore (&oh->_lock, flags);return ret; }
@@ -2181,6 +2193,7 @@ int omap_hwmod_for_each_by_class(const char *classname,int omap_hwmod_set_postsetup_state (struct omap_hwmod *oh,u8 state) {int ret; +unsigned long flags;if (!oh)return -EINVAL ;
@@ -2190,7 +2203,7 @@ int omap_hwmod_set_postsetup_state(struct omap_hwmod *oh, u8 state) state != _HWMOD_STATE_IDLE)return -EINVAL ; -mutex_lock (&oh->_mutex); +spin_lock_irqsave (&oh->_lock, flags);if (oh->_state != _HWMOD_STATE_REGISTERED) { ret = -EINVAL ;
@@ -2201,7 +2214,7 @@ int omap_hwmod_set_postsetup_state(struct omap_hwmod *oh, u8 state) ret =0 ; ohsps_unlock: -mutex_unlock (&oh->_mutex); +spin_unlock_irqrestore (&oh->_lock, flags);return ret; }
arch/arm/mach-omap2/serial.c +2 -7
@@ -105,21 +105,16 @@ struct omap_uart_state {static LIST_HEAD (uart_list);static u8 num_uarts; -/* -* Since these idle/enable hooks are used in the idle path itself -* which has interrupts disabled, use the non-locking versions of -* the hwmod enable/disable functions. -*/ static int uart_idle_hwmod (struct omap_device *od) { -_omap_hwmod_idle (od->hwmods[0 ]); +omap_hwmod_idle (od->hwmods[0 ]);return 0 ; }static int uart_enable_hwmod (struct omap_device *od) { -_omap_hwmod_enable (od->hwmods[0 ]); +omap_hwmod_enable (od->hwmods[0 ]);return 0 ; }
arch/arm/plat-omap/include/plat/omap_hwmod.h +3 -3
@@ -32,7 +32,7 @@#include <linux/kernel.h> #include <linux/list.h> #include <linux/ioport.h> -#include <linux/mutex.h> +#include <linux/spinlock.h> #include <plat/cpu.h> struct omap_device ;
@@ -472,7 +472,7 @@ struct omap_hwmod_class {* @_postsetup_state: internal-use state to leave the hwmod in after _setup() * @flags: hwmod flags (documented below) * @omap_chip: OMAP chips this hwmod is present on -* @_mutex: mutex serializing operations on this hwmod +* @_lock: spinlock serializing operations on this hwmod * @node: list node for hwmod list (internal use) * * @main_clk refers to this module's "main clock," which for our
@@ -502,7 +502,7 @@ struct omap_hwmod {void *dev_attr;u32 _sysc_cache;void __iomem *_mpu_rt_va; -struct mutex _mutex; +spinlock_t _lock;struct list_head node;u16 flags;u8 _mpu_port_index;
Paul Walmsley
maintainerPATCH 6/8 OMAP2+: hwmod: upgrade per-hwmod mutex to a spinlock
Hi Kevin, Beno?t,
Quoted 7 lines · Paul Walmsley
Change the per-hwmod mutex to a spinlock. (The per-hwmod lock serializes most post-initialization hwmod operations such as enable, idle, and shutdown.) Spinlocks are needed, because in some cases, hwmods must be enabled from timer interrupt disabled-context, such as an ISR. The current use-case that is driving this is the OMAP GPIO block ISR: it can trigger interrupts even with its clocks disabled, but these clocks are needed for register accesses in the ISR to succeed.
The more I think about this patch, the less I like it. At some point it would be good to try to convert the OMAP clock code to using mutexes in as many places as possible, rather than spinlocks. When that happens, this is going to be a liability. Nevertheless I will leave it this patch in for now by request, but this is just a simultaneous request: as we review these hwmod conversions, we need to be very careful with any code that will attempt to call the hwmod functions from timer-interrupt-disabled context ... we should try to discourage it if at all possible and if that is not possible, to put a big fat XXX comment there to review the situation...
- Paul
Paul Walmsley
maintainerPATCH 7/8 OMAP2+: hwmod: fix a warning, add some docs, remove unused fields
In reply to Paul WalmsleyTrivial cleanup and documentation changes on the hwmod code and data:
- resolve the OMAP2430 hwmod data i2c_dev_attr warning
- add some hwmod documentation to indicate flags that should be moved outside the static hwmod data in a future patch
- remove some unused fields in the struct omap_hwmod_ocp_if and struct omap_hwmod structures
--- arch/arm/mach-omap2/omap_hwmod_2430_data.c | 2 -- arch/arm/plat-omap/include/plat/omap_hwmod.h | 16 ++++------------ 2 files changed, 4 insertions(+), 14 deletions(-)
arch/arm/mach-omap2/omap_hwmod_2430_data.c +0 -2
@@ -475,8 +475,6 @@ static struct omap_hwmod_class i2c_class = { .sysc = &i2c_sysc, }; -static struct omap_i2c_dev_attr i2c_dev_attr; -/* I2C1 */ static struct omap_i2c_dev_attr i2c1_dev_attr = {
arch/arm/plat-omap/include/plat/omap_hwmod.h +4 -12
@@ -23,7 +23,7 @@* - add pinmuxing * - init_conn_id_bit (CONNID_BIT_VECTOR) * - implement default hwmod SMS/SDRC flags? -* - remove unused fields +* - move Linux-specific data ("non-ROM data") out * */ #ifndef __ARCH_ARM_PLAT_OMAP_INCLUDE_MACH_OMAP_HWMOD_H
@@ -159,7 +159,7 @@ struct omap_hwmod_omap2_firewall {* ADDR_MAP_ON_INIT: Map this address space during omap_hwmod init. * ADDR_TYPE_RT: Address space contains module register target data. */ -#define ADDR_MAP_ON_INIT (1 << 0) +#define ADDR_MAP_ON_INIT (1 << 0)/* XXX does not belong */ #define ADDR_TYPE_RT (1 << 1)/**
@@ -200,8 +200,6 @@ struct omap_hwmod_addr_space {* @fw: interface firewall data * @addr_cnt: ARRAY_SIZE(@addr) * @width: OCP data width -* @thread_cnt: number of threads -* @max_burst_len: maximum burst length in @width sized words (0 if unlimited) * @user: initiators using this interface (see OCP_USER_* macros above) * @flags: OCP interface flags (see OCPIF_* macros above) *
@@ -221,8 +219,6 @@ struct omap_hwmod_ocp_if { } fw;u8 addr_cnt;u8 width; -u8 thread_cnt; -u8 max_burst_len;u8 user;u8 flags; };
@@ -357,9 +353,9 @@ struct omap_hwmod_omap4_prcm {* HWMOD_SWSUP_MSTDBY: omap_hwmod code should manually bring module in and out * of standby, rather than relying on module smart-standby * HWMOD_INIT_NO_RESET: don't reset this module at boot - important for -* SDRAM controller, etc. +* SDRAM controller, etc. XXX probably belongs outside the main hwmod file * HWMOD_INIT_NO_IDLE: don't idle this module@boot - important for SDRAM -* controller, etc. +* controller, etc. XXX probably belongs outside the main hwmod file * HWMOD_NO_AUTOIDLE: disable module autoidle (OCP_SYSCONFIG.AUTOIDLE) * when module is enabled, rather than the default, which is to * enable autoidle
@@ -459,8 +455,6 @@ struct omap_hwmod_class {* @_sysc_cache: internal-use hwmod flags * @_mpu_rt_va: cached register target start address (internal use) * @_mpu_port_index: cached MPU register target slave ID (internal use) -* @msuspendmux_reg_id: CONTROL_MSUSPENDMUX register ID (1-6) -* @msuspendmux_shift: CONTROL_MSUSPENDMUX register bit shift * @mpu_irqs_cnt: number of @mpu_irqs * @sdma_reqs_cnt: number of @sdma_reqs * @opt_clks_cnt: number of @opt_clks
@@ -506,8 +500,6 @@ struct omap_hwmod {struct list_head node;u16 flags;u8 _mpu_port_index; -u8 msuspendmux_reg_id; -u8 msuspendmux_shift;u8 response_lat;u8 mpu_irqs_cnt;u8 sdma_reqs_cnt;
Paul Walmsley
maintainerPATCH 8/8 OMAP2+: hwmod: Update the sysc_cache in case module context is lost
In reply to Paul WalmsleyFrom: Rajendra Nayak <[email protected]>
Do not skip the sysc programming in the hmwod framework based on the cached value alone, since at times the module might have lost context (due to the Powerdomain in which the module belongs transitions to either Open Switch RET or OFF).
Identifying if a module has lost context requires atleast one register read, and since a register read has more latency than a write, it makes sense to do a blind write always.
--- arch/arm/mach-omap2/omap_hwmod.c | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-)
arch/arm/mach-omap2/omap_hwmod.c +3 -4
@@ -211,10 +211,9 @@ static void _write_sysconfig(u32 v, struct omap_hwmod *oh)/* XXX ensure module interface clock is up */ -if (oh->_sysc_cache != v) { - oh->_sysc_cache = v; -omap_hwmod_write (v, oh, oh->class->sysc->sysc_offs); - } +/* Module might have lost context, always update cache and register */ + oh->_sysc_cache = v; +omap_hwmod_write (v, oh, oh->class->sysc->sysc_offs); }/**
Paul Walmsley
maintainercover OMAP2+: hwmod core upgrades for 2.6.38: first set
In reply to Paul WalmsleyQuoted 6 lines · Paul Walmsley
This patch series contains upgrades for the OMAP2+ hwmod core code, intended for 2.6.38. Most of these patches were developed in response to use-cases discovered while converting device drivers to use the hwmod code.
Tested on an OMAP34xx BeagleBoard with
omap2plus_defconfig.
Just FYI, this branch 'hwmod_a_2.6.38' is available atgit://git.pwsan.com/linux-2.6
Warning: it's based on Tony's tree, not the mainline, due to the recent board file changes.
- Paul
cover OMAP2+: hwmod core upgrades for 2.6.38: first set
Quoted 7 lines · Paul Walmsley
Quoted 5 lines · Paul Walmsley
This patch series contains upgrades for the OMAP2+ hwmod core code, intended for 2.6.38. Most of these patches were developed in response to use-cases discovered while converting device drivers to use the hwmod code.
Quoted 7 lines
Quoted 1 line
Tested on an OMAP34xx BeagleBoard with
omap2plus_defconfig.Just FYI, this branch 'hwmod_a_2.6.38' is available at
git://git.pwsan.com/linux-2.6Warning: it's based on Tony's tree, not the mainline, due to the recent board file changes.
Looks like Tony has collected the board file changes into his devel-board branch. Can this rebased there?
That way, I can included it as part of the PM branch testing without having to pull in master.
Thanks,
Kevin
Paul Walmsley
maintainercover OMAP2+: hwmod core upgrades for 2.6.38: first set
Quoted 14 lines · Kevin Hilman
Quoted 12 lines · Paul Walmsley
Quoted 6 lines · Paul Walmsley
This patch series contains upgrades for the OMAP2+ hwmod core code, intended for 2.6.38. Most of these patches were developed in response to use-cases discovered while converting device drivers to use the hwmod code.
Tested on an OMAP34xx BeagleBoard with
omap2plus_defconfig.Just FYI, this branch 'hwmod_a_2.6.38' is available at
git://git.pwsan.com/linux-2.6
Quoted 8 lines
Quoted 2 lines
Warning: it's based on Tony's tree, not the mainline, due to the recent board file changes.
Looks like Tony has collected the board file changes into his devel-board branch. Can this rebased there?
That way, I can included it as part of the PM branch testing without having to pull in master.
hwmod_a_2.6.38 is now based on devel-board and wdt_2.6.38 is now rebased on the updated hwmod_a_2.6.38.
- Paul
cover OMAP2+: hwmod core upgrades for 2.6.38: first set
Quoted 19 lines · Paul Walmsley
Quoted 17 lines · Kevin Hilman
Quoted 14 lines · Paul Walmsley
Quoted 6 lines · Paul Walmsley
This patch series contains upgrades for the OMAP2+ hwmod core code, intended for 2.6.38. Most of these patches were developed in response to use-cases discovered while converting device drivers to use the hwmod code.
Tested on an OMAP34xx BeagleBoard with
omap2plus_defconfig.Just FYI, this branch 'hwmod_a_2.6.38' is available at
git://git.pwsan.com/linux-2.6Warning: it's based on Tony's tree, not the mainline, due to the recent board file changes.
Quoted 8 lines
Quoted 5 lines
Looks like Tony has collected the board file changes into his devel-board branch. Can this rebased there?
That way, I can included it as part of the PM branch testing without having to pull in master.
hwmod_a_2.6.38 is now based on devel-board and wdt_2.6.38 is now rebased on the updated hwmod_a_2.6.38.
Tested on 35xx/omap3evm, 34xx/n900 and 35xx/beagle.
Kevin