OMAP: WDT: Implement WDT in hwmod way
Subsystems (6)
v6 cover OMAP: WDT: Implement WDT in hwmod way
Series of patches to port watchdog module to use hwmod APIs for OMAP2PLUS chips and use runtime APIs for all OMAP chips. For this hwmod database for OMAP2PLUS watchdog instances are populated. This patch series also implements watchdog module to use PM runtime APIs.
This patch series is created on "origin/pm-core" and is tested on OMAP2430, OMAP44430, OMAP3430 SDP boards and zoom3 board. Also verified that this patch series does not break the OMAP1 build.
This series is tested on OMAP4430 ES2 using the below series
http://www.spinics.net/lists/linux-omap/msg36023.html
Version History:
---------------
Version v6:
*Split omap_init_wdt() into separate omap_init_wdt functions under mach-omap1 and mach-omap2 and set them up with subsys_initcall
*Include wd_timer3 database for OMAP4
*In hwmod database follow naming convention "wd_timerX"
Version v5:
*Delete wdt_runtime_resume and wdt_runtime_suspend functions as the fix for the return values in the generic runtime PM calls has been queued for 2.6.37 (see below link)
https://lists.linux-foundation.org/pipermail/linux-pm/2010-September/028466.html
Some of the v5 links:
https://patchwork.kernel.org/patch/181812/
https://patchwork.kernel.org/patch/181782/
https://patchwork.kernel.org/patch/181772/
https://patchwork.kernel.org/patch/181792/
Version v4:
*Implement hwmod adapdation first and then PM runtime adaptation as two different patches in the series
*Remove inclusion of omap_device.h in the driver file. Some of the v4 links:
https://patchwork.kernel.org/patch/174672/
https://patchwork.kernel.org/patch/174662/
Version v3:
*Fix Minor comments like renaming omap1 watchdog structures with an omap1_ prefix
Some of the v3 links:
https://patchwork.kernel.org/patch/119698/
https://patchwork.kernel.org/patch/119696/
Version v2:
*Rebase to latest kernel
Some of the v2 links:
http://www.spinics.net/lists/linux-omap/msg34741.html
http://www.spinics.net/lists/linux-omap/msg34673.html
Version v1:
*Initial series
Some of the v1 links:
http://www.spinics.net/lists/linux-omap/msg30628.html
http://www.spinics.net/lists/linux-omap/msg30625.html
Benoit Cousson (1):
OMAP4: hwmod data: Add watchdog timer
Varadarajan, Charulatha (6):
OMAP2PLUS: WDT: Add ICLKEN, FCLKEN, WKEN shared bits for WDT
OMAP3: hwmod data: Add watchdog timer
OMAP2420: hwmod data: Add watchdog timer
OMAP2430: hwmod data: Add watchdog timer
OMAP2PLUS: WDT: use omap_device_build for device registration
OMAP: WDT: Use PM runtime APIs instead of clk FW APIs
arch/arm/mach-omap1/devices.c | 27 ++++++ arch/arm/mach-omap2/devices.c | 38 ++++++++ arch/arm/mach-omap2/omap_hwmod_2420_data.c | 63 +++++++++++++ arch/arm/mach-omap2/omap_hwmod_2430_data.c | 63 +++++++++++++ arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 65 +++++++++++++ arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 135 ++++++++++++++++++++++++++++ arch/arm/mach-omap2/prcm-common.h | 4 + arch/arm/plat-omap/devices.c | 41 --------- drivers/watchdog/omap_wdt.c | 42 ++------- 9 files changed, 402 insertions(+), 76 deletions(-)
PATCH v6 1/7 OMAP2PLUS: WDT: Add ICLKEN, FCLKEN, WKEN shared bits for WDT
This patch adds the CM_FCLKEN_WKUP, CM_ICLKEN_WKUP, PM_WKEN_WKUP shared bits for OMAP2PLUS watchdog timer module.
--- arch/arm/mach-omap2/prcm-common.h | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/prcm-common.h +4 -0
@@ -237,6 +237,8 @@#define OMAP24XX_ST_USB_MASK (1 << 0)/* CM_FCLKEN_WKUP, CM_ICLKEN_WKUP, PM_WKEN_WKUP shared bits */ +#define OMAP24XX_EN_WDT2_SHIFT 3 +#define OMAP24XX_EN_WDT2_MASK (1 << 3)#define OMAP24XX_EN_GPIOS_SHIFT 2#define OMAP24XX_EN_GPIOS_MASK (1 << 2)#define OMAP24XX_EN_GPT1_SHIFT 0
@@ -344,6 +346,8 @@#define OMAP3430_ST_D2D_MASK (1 << 3)/* CM_FCLKEN_WKUP, CM_ICLKEN_WKUP, PM_WKEN_WKUP shared bits */ +#define OMAP3430_EN_WDT2_SHIFT 5 +#define OMAP3430_EN_WDT2_MASK (1 << 5)#define OMAP3430_EN_GPIO1_MASK (1 << 3)#define OMAP3430_EN_GPIO1_SHIFT 3#define OMAP3430_EN_GPT12_MASK (1 << 1)
Signature · 1 line
1.7.0.4
PATCH v6 2/7 OMAP3: hwmod data: Add watchdog timer
In reply to Varadarajan, CharulathaAdd watchdog timer hwmod data for OMAP3 chip
--- arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 65 ++++++++++++++++++++++++++++ 1 files changed, 65 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +65 -0
@@ -36,6 +36,7 @@ static struct omap_hwmod omap3xxx_iva_hwmod;static struct omap_hwmod omap3xxx_l3_main_hwmod;static struct omap_hwmod omap3xxx_l4_core_hwmod;static struct omap_hwmod omap3xxx_l4_per_hwmod; +static struct omap_hwmod omap3xxx_wd_timer2_hwmod;/* L3 -> L4_CORE interface */ static struct omap_hwmod_ocp_if omap3xxx_l3_main__l4_core = {
@@ -197,6 +198,69 @@ static struct omap_hwmod omap3xxx_iva_hwmod = { .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430) }; +/* l4_wkup -> wd_timer2 */ +static struct omap_hwmod_addr_space omap3xxx_wd_timer2_addrs[] = { + { + .pa_start =0x48314000 , + .pa_end =0x4831407f , + .flags =ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap3xxx_l4_wkup__wd_timer2 = { + .master = &omap3xxx_l4_wkup_hwmod, + .slave = &omap3xxx_wd_timer2_hwmod, + .clk ="wdt2_ick" , + .addr = omap3xxx_wd_timer2_addrs, + .addr_cnt =ARRAY_SIZE (omap3xxx_wd_timer2_addrs), + .user =OCP_USER_MPU |OCP_USER_SDMA , +}; + +/* +* 'wd_timer' class +* 32-bit watchdog upward counter that generates a pulse on the reset pin on +* overflow condition +*/ + +static struct omap_hwmod_class_sysconfig omap3xxx_wd_timer_sysc = { + .rev_offs =0x0000 , + .sysc_offs =0x0010 , + .syss_offs =0x0014 , + .sysc_flags = (SYSC_HAS_SIDLEMODE |SYSC_HAS_EMUFREE | +SYSC_HAS_ENAWAKEUP |SYSC_HAS_SOFTRESET | +SYSC_HAS_AUTOIDLE |SYSC_HAS_CLOCKACTIVITY ), + .idlemodes = (SIDLE_FORCE |SIDLE_NO |SIDLE_SMART ), + .sysc_fields = &omap_hwmod_sysc_type1, +}; + +static struct omap_hwmod_class omap3xxx_wd_timer_hwmod_class = { + .name ="wd_timer" , + .sysc = &omap3xxx_wd_timer_sysc, +}; + +/* wd_timer2 */ +static struct omap_hwmod_ocp_if *omap3xxx_wd_timer2_slaves[] = { + &omap3xxx_l4_wkup__wd_timer2, +}; + +static struct omap_hwmod omap3xxx_wd_timer2_hwmod = { + .name ="wd_timer2" , + .class = &omap3xxx_wd_timer_hwmod_class, + .main_clk ="wdt2_fck" , + .prcm = { + .omap2 = { + .prcm_reg_id =1 , + .module_bit =OMAP3430_EN_WDT2_SHIFT , + .module_offs =WKUP_MOD , + .idlest_reg_id =1 , + .idlest_idle_bit =OMAP3430_EN_WDT2_SHIFT , + }, + }, + .slaves = omap3xxx_wd_timer2_slaves, + .slaves_cnt =ARRAY_SIZE (omap3xxx_wd_timer2_slaves), + .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP3430 ), +}; +static __initdata struct omap_hwmod *omap3xxx_hwmods[] = { &omap3xxx_l3_main_hwmod, &omap3xxx_l4_core_hwmod,
@@ -204,6 +268,7 @@ static __initdata struct omap_hwmod *omap3xxx_hwmods[] = { &omap3xxx_l4_wkup_hwmod, &omap3xxx_mpu_hwmod, &omap3xxx_iva_hwmod, + &omap3xxx_wd_timer2_hwmod, NULL, };
Signature · 1 line
1.7.0.4
PATCH v6 3/7 OMAP2420: hwmod data: Add watchdog timer
In reply to Varadarajan, CharulathaAdd watchdog timer hwmod data for OMAP2420 chip
--- arch/arm/mach-omap2/omap_hwmod_2420_data.c | 63 ++++++++++++++++++++++++++++ 1 files changed, 63 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/omap_hwmod_2420_data.c +63 -0
@@ -33,6 +33,7 @@ static struct omap_hwmod omap2420_mpu_hwmod;static struct omap_hwmod omap2420_iva_hwmod;static struct omap_hwmod omap2420_l3_main_hwmod;static struct omap_hwmod omap2420_l4_core_hwmod; +static struct omap_hwmod omap2420_wd_timer2_hwmod;/* L3 -> L4_CORE interface */ static struct omap_hwmod_ocp_if omap2420_l3_main__l4_core = {
@@ -165,12 +166,74 @@ static struct omap_hwmod omap2420_iva_hwmod = { .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420) }; +/* l4_wkup -> wd_timer2 */ +static struct omap_hwmod_addr_space omap2420_wd_timer2_addrs[] = { + { + .pa_start =0x48022000 , + .pa_end =0x4802207f , + .flags =ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap2420_l4_wkup__wd_timer2 = { + .master = &omap2420_l4_wkup_hwmod, + .slave = &omap2420_wd_timer2_hwmod, + .clk ="mpu_wdt_ick" , + .addr = omap2420_wd_timer2_addrs, + .addr_cnt =ARRAY_SIZE (omap2420_wd_timer2_addrs), + .user =OCP_USER_MPU |OCP_USER_SDMA , +}; + +/* +* 'wd_timer' class +* 32-bit watchdog upward counter that generates a pulse on the reset pin on +* overflow condition +*/ + +static struct omap_hwmod_class_sysconfig omap2420_wd_timer_sysc = { + .rev_offs =0x0000 , + .sysc_offs =0x0010 , + .syss_offs =0x0014 , + .sysc_flags = (SYSC_HAS_EMUFREE |SYSC_HAS_SOFTRESET | +SYSC_HAS_AUTOIDLE ), + .sysc_fields = &omap_hwmod_sysc_type1, +}; + +static struct omap_hwmod_class omap2420_wd_timer_hwmod_class = { + .name ="wd_timer" , + .sysc = &omap2420_wd_timer_sysc, +}; + +/* wd_timer2 */ +static struct omap_hwmod_ocp_if *omap2420_wd_timer2_slaves[] = { + &omap2420_l4_wkup__wd_timer2, +}; + +static struct omap_hwmod omap2420_wd_timer2_hwmod = { + .name ="wd_timer2" , + .class = &omap2420_wd_timer_hwmod_class, + .main_clk ="mpu_wdt_fck" , + .prcm = { + .omap2 = { + .prcm_reg_id =1 , + .module_bit =OMAP24XX_EN_WDT2_SHIFT , + .module_offs =WKUP_MOD , + .idlest_reg_id =1 , + .idlest_idle_bit =OMAP24XX_EN_WDT2_SHIFT , + }, + }, + .slaves = omap2420_wd_timer2_slaves, + .slaves_cnt =ARRAY_SIZE (omap2420_wd_timer2_slaves), + .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP2420 ), +}; +static __initdata struct omap_hwmod *omap2420_hwmods[] = { &omap2420_l3_main_hwmod, &omap2420_l4_core_hwmod, &omap2420_l4_wkup_hwmod, &omap2420_mpu_hwmod, &omap2420_iva_hwmod, + &omap2420_wd_timer2_hwmod,NULL , };
Signature · 1 line
1.7.0.4
PATCH v6 4/7 OMAP2430: hwmod data: Add watchdog timer
In reply to Varadarajan, CharulathaAdd watchdog timer hwmod data for OMAP2430 chip
--- arch/arm/mach-omap2/omap_hwmod_2430_data.c | 63 ++++++++++++++++++++++++++++ 1 files changed, 63 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/omap_hwmod_2430_data.c +63 -0
@@ -33,6 +33,7 @@ static struct omap_hwmod omap2430_mpu_hwmod;static struct omap_hwmod omap2430_iva_hwmod;static struct omap_hwmod omap2430_l3_main_hwmod;static struct omap_hwmod omap2430_l4_core_hwmod; +static struct omap_hwmod omap2430_wd_timer2_hwmod;/* L3 -> L4_CORE interface */ static struct omap_hwmod_ocp_if omap2430_l3_main__l4_core = {
@@ -165,12 +166,74 @@ static struct omap_hwmod omap2430_iva_hwmod = { .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430) }; +/* l4_wkup -> wd_timer2 */ +static struct omap_hwmod_addr_space omap2430_wd_timer2_addrs[] = { + { + .pa_start =0x49016000 , + .pa_end =0x4901607f , + .flags =ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap2430_l4_wkup__wd_timer2 = { + .master = &omap2430_l4_wkup_hwmod, + .slave = &omap2430_wd_timer2_hwmod, + .clk ="mpu_wdt_ick" , + .addr = omap2430_wd_timer2_addrs, + .addr_cnt =ARRAY_SIZE (omap2430_wd_timer2_addrs), + .user =OCP_USER_MPU |OCP_USER_SDMA , +}; + +/* +* 'wd_timer' class +* 32-bit watchdog upward counter that generates a pulse on the reset pin on +* overflow condition +*/ + +static struct omap_hwmod_class_sysconfig omap2430_wd_timer_sysc = { + .rev_offs =0x0 , + .sysc_offs =0x0010 , + .syss_offs =0x0014 , + .sysc_flags = (SYSC_HAS_EMUFREE |SYSC_HAS_SOFTRESET | +SYSC_HAS_AUTOIDLE ), + .sysc_fields = &omap_hwmod_sysc_type1, +}; + +static struct omap_hwmod_class omap2430_wd_timer_hwmod_class = { + .name ="wd_timer" , + .sysc = &omap2430_wd_timer_sysc, +}; + +/* wd_timer2 */ +static struct omap_hwmod_ocp_if *omap2430_wd_timer2_slaves[] = { + &omap2430_l4_wkup__wd_timer2, +}; + +static struct omap_hwmod omap2430_wd_timer2_hwmod = { + .name ="wd_timer2" , + .class = &omap2430_wd_timer_hwmod_class, + .main_clk ="mpu_wdt_fck" , + .prcm = { + .omap2 = { + .prcm_reg_id =1 , + .module_bit =OMAP24XX_EN_WDT2_SHIFT , + .module_offs =WKUP_MOD , + .idlest_reg_id =1 , + .idlest_idle_bit =OMAP24XX_EN_WDT2_SHIFT , + }, + }, + .slaves = omap2430_wd_timer2_slaves, + .slaves_cnt =ARRAY_SIZE (omap2430_wd_timer2_slaves), + .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP2430 ), +}; +static __initdata struct omap_hwmod *omap2430_hwmods[] = { &omap2430_l3_main_hwmod, &omap2430_l4_core_hwmod, &omap2430_l4_wkup_hwmod, &omap2430_mpu_hwmod, &omap2430_iva_hwmod, + &omap2430_wd_timer2_hwmod,NULL , };
Signature · 1 line
1.7.0.4
PATCH v6 5/7 OMAP4: hwmod data: Add watchdog timer
In reply to Varadarajan, CharulathaFrom: Benoit Cousson <[email protected]>
Add watchdog timer hwmod data for OMAP4 chip
---
This patch is extracted from the below patch sent by Benoit
https://patchwork.kernel.org/patch/117347/
arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 135 ++++++++++++++++++++++++++++ 1 files changed, 135 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +135 -0
@@ -452,6 +452,136 @@ static struct omap_hwmod omap44xx_mpu_hwmod = { .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), }; +/* +* 'wd_timer' class +* 32-bit watchdog upward counter that generates a pulse on the reset pin on +* overflow condition +*/ + +static struct omap_hwmod_class_sysconfig omap44xx_wd_timer_sysc = { + .rev_offs =0x0000 , + .sysc_offs =0x0010 , + .syss_offs =0x0014 , + .sysc_flags = (SYSC_HAS_SIDLEMODE |SYSC_HAS_EMUFREE | +SYSC_HAS_SOFTRESET ), + .idlemodes = (SIDLE_FORCE |SIDLE_NO |SIDLE_SMART ), + .sysc_fields = &omap_hwmod_sysc_type1, +}; + +static struct omap_hwmod_class omap44xx_wd_timer_hwmod_class = { + .name ="wd_timer" , + .sysc = &omap44xx_wd_timer_sysc, +}; + +/* wd_timer2 */ +static struct omap_hwmod omap44xx_wd_timer2_hwmod; +static struct omap_hwmod_irq_info omap44xx_wd_timer2_irqs[] = { + { .irq =80 +OMAP44XX_IRQ_GIC_START }, +}; + +static struct omap_hwmod_addr_space omap44xx_wd_timer2_addrs[] = { + { + .pa_start =0x4a314000 , + .pa_end =0x4a31407f , + .flags =ADDR_TYPE_RT + }, +}; + +/* l4_wkup -> wd_timer2 */ +static struct omap_hwmod_ocp_if omap44xx_l4_wkup__wd_timer2 = { + .master = &omap44xx_l4_wkup_hwmod, + .slave = &omap44xx_wd_timer2_hwmod, + .clk ="l4_wkup_clk_mux_ck" , + .addr = omap44xx_wd_timer2_addrs, + .addr_cnt =ARRAY_SIZE (omap44xx_wd_timer2_addrs), + .user =OCP_USER_MPU |OCP_USER_SDMA , +}; + +/* wd_timer2 slave ports */ +static struct omap_hwmod_ocp_if *omap44xx_wd_timer2_slaves[] = { + &omap44xx_l4_wkup__wd_timer2, +}; + +static struct omap_hwmod omap44xx_wd_timer2_hwmod = { + .name ="wd_timer2" , + .class = &omap44xx_wd_timer_hwmod_class, + .mpu_irqs = omap44xx_wd_timer2_irqs, + .mpu_irqs_cnt =ARRAY_SIZE (omap44xx_wd_timer2_irqs), + .main_clk ="wd_timer2_fck" , + .prcm = { + .omap4 = { + .clkctrl_reg =OMAP4430_CM_WKUP_WDT2_CLKCTRL , + }, + }, + .slaves = omap44xx_wd_timer2_slaves, + .slaves_cnt =ARRAY_SIZE (omap44xx_wd_timer2_slaves), + .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP4430 ), +}; + +/* wd_timer3 */ +static struct omap_hwmod omap44xx_wd_timer3_hwmod; +static struct omap_hwmod_irq_info omap44xx_wd_timer3_irqs[] = { + { .irq =36 +OMAP44XX_IRQ_GIC_START }, +}; + +static struct omap_hwmod_addr_space omap44xx_wd_timer3_addrs[] = { + { + .pa_start =0x40130000 , + .pa_end =0x4013007f , + .flags =ADDR_TYPE_RT + }, +}; + +/* l4_abe -> wd_timer3 */ +static struct omap_hwmod_ocp_if omap44xx_l4_abe__wd_timer3 = { + .master = &omap44xx_l4_abe_hwmod, + .slave = &omap44xx_wd_timer3_hwmod, + .clk ="ocp_abe_iclk" , + .addr = omap44xx_wd_timer3_addrs, + .addr_cnt =ARRAY_SIZE (omap44xx_wd_timer3_addrs), + .user =OCP_USER_MPU , +}; + +/* l4_abe -> wd_timer3 (dma) */ +static struct omap_hwmod_addr_space omap44xx_wd_timer3_dma_addrs[] = { + { + .pa_start =0x49030000 , + .pa_end =0x4903007f , + .flags =ADDR_TYPE_RT + }, +}; + +static struct omap_hwmod_ocp_if omap44xx_l4_abe__wd_timer3_dma = { + .master = &omap44xx_l4_abe_hwmod, + .slave = &omap44xx_wd_timer3_hwmod, + .clk ="ocp_abe_iclk" , + .addr = omap44xx_wd_timer3_dma_addrs, + .addr_cnt =ARRAY_SIZE (omap44xx_wd_timer3_dma_addrs), + .user =OCP_USER_SDMA , +}; + +/* wd_timer3 slave ports */ +static struct omap_hwmod_ocp_if *omap44xx_wd_timer3_slaves[] = { + &omap44xx_l4_abe__wd_timer3, + &omap44xx_l4_abe__wd_timer3_dma, +}; + +static struct omap_hwmod omap44xx_wd_timer3_hwmod = { + .name ="wd_timer3" , + .class = &omap44xx_wd_timer_hwmod_class, + .mpu_irqs = omap44xx_wd_timer3_irqs, + .mpu_irqs_cnt =ARRAY_SIZE (omap44xx_wd_timer3_irqs), + .main_clk ="wd_timer3_fck" , + .prcm = { + .omap4 = { + .clkctrl_reg =OMAP4430_CM1_ABE_WDT3_CLKCTRL , + }, + }, + .slaves = omap44xx_wd_timer3_slaves, + .slaves_cnt =ARRAY_SIZE (omap44xx_wd_timer3_slaves), + .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP4430 ), +}; +static __initdata struct omap_hwmod *omap44xx_hwmods[] = {/* dmm class */ &omap44xx_dmm_hwmod,
@@ -472,6 +602,11 @@ static __initdata struct omap_hwmod *omap44xx_hwmods[] = {/* mpu class */ &omap44xx_mpu_hwmod, +/* wd_timer class */ + &omap44xx_wd_timer2_hwmod, + +/* wd_timer3 not yet supported */ +/* &omap44xx_wd_timer3_hwmod, */ NULL, };
Signature · 1 line
1.7.0.4
PATCH v6 6/7 OMAP2PLUS: WDT: use omap_device_build for device registration
In reply to Varadarajan, CharulathaThis patch splits omap_init_wdt() into separate omap_init_wdt() functions under mach-omap1 and mach-omap2 and set them up with subsys_initcall.
Also it uses omap_device_build() API instead of platform_device_register() for watchdog timer device registration for OMAP2plus chips.
For OMAP2plus chips, the device specific data defined in centralized hwmod database will be used.
--- arch/arm/mach-omap1/devices.c | 27 +++++++++++++++++++++++++++ arch/arm/mach-omap2/devices.c | 39 +++++++++++++++++++++++++++++++++++++++ arch/arm/plat-omap/devices.c | 41 ----------------------------------------- 3 files changed, 66 insertions(+), 41 deletions(-)
arch/arm/mach-omap1/devices.c +27 -0
@@ -232,3 +232,30 @@ static int __init omap1_init_devices(void) }arch_initcall (omap1_init_devices); +#if defined(CONFIG_OMAP_WATCHDOG ) || defined(CONFIG_OMAP_WATCHDOG_MODULE ) + +static struct resource wdt_resources[] = { + { + .start =0xfffeb000 , + .end =0xfffeb07F , + .flags =IORESOURCE_MEM , + }, +}; + +static struct platform_device omap_wdt_device = { + .name ="omap_wdt" , + .id =-1 , + .num_resources =ARRAY_SIZE (wdt_resources), + .resource = wdt_resources, +}; + +static int __init omap_init_wdt (void ) +{ +if (!cpu_is_omap16xx ()) +return ; + +platform_device_register (&omap_wdt_device); +return ; +} +subsys_initcall (omap_init_wdt); +#endif
arch/arm/mach-omap2/devices.c +39 -0
@@ -15,6 +15,7 @@#include <linux/platform_device.h> #include <linux/io.h> #include <linux/clk.h> +#include <linux/err.h> #include <mach/hardware.h> #include <mach/irqs.h>
@@ -28,6 +29,8 @@#include <mach/gpio.h> #include <plat/mmc.h> #include <plat/dma.h> +#include <plat/omap_hwmod.h> +#include <plat/omap_device.h> #include "mux.h"
@@ -859,3 +862,39 @@ static int __init omap2_init_devices(void)return 0 ; }arch_initcall (omap2_init_devices); + +#if defined(CONFIG_OMAP_WATCHDOG ) || defined(CONFIG_OMAP_WATCHDOG_MODULE ) +struct omap_device_pm_latency omap_wdt_latency[] = { + [0 ] = { + .deactivate_func = omap_device_idle_hwmods, + .activate_func = omap_device_enable_hwmods, + .flags =OMAP_DEVICE_LATENCY_AUTO_ADJUST , + }, +}; + +static int __init omap_init_wdt (void ) +{ +int id =-1 ; +struct omap_device *od; +struct omap_hwmod *oh; +char *oh_name ="wd_timer2" ; +char *dev_name ="omap_wdt" ; + +if (!cpu_class_is_omap2 ()) +return 0 ; + + oh =omap_hwmod_lookup (oh_name); +if (!oh) { +pr_err ("Could not look up wd_timer%d hwmod\n" , id); +return -EINVAL ; + } + + od =omap_device_build (dev_name, id, oh,NULL ,0 , + omap_wdt_latency, +ARRAY_SIZE (omap_wdt_latency),0 ); +WARN (IS_ERR (od),"Cant build omap_device for %s:%s.\n" , + dev_name, oh->name); +return 0 ; +} +subsys_initcall (omap_init_wdt); +#endif
arch/arm/plat-omap/devices.c +0 -41
53 lines not on this page · raw message
Signature · 1 line
1.7.0.4
PATCH v6 7/7 OMAP: WDT: Use PM runtime APIs instead of clk FW APIs
In reply to Varadarajan, CharulathaCall runtime pm APIs pm_runtime_put_sync() and pm_runtime_get_sync() for enabling/disabling the clocks, sysconfig settings instead of using clock FW APIs.
--- drivers/watchdog/omap_wdt.c | 42 +++++++----------------------------------- 1 files changed, 7 insertions(+), 35 deletions(-)
drivers/watchdog/omap_wdt.c +7 -35
@@ -38,11 +38,11 @@#include <linux/err.h> #include <linux/platform_device.h> #include <linux/moduleparam.h> -#include <linux/clk.h> #include <linux/bitops.h> #include <linux/io.h> #include <linux/uaccess.h> #include <linux/slab.h> +#include <linux/pm_runtime.h> #include <mach/hardware.h> #include <plat/prcm.h>
@@ -61,8 +61,6 @@ struct omap_wdt_dev {void __iomem *base;/* physical */ struct device *dev;int omap_wdt_users; -struct clk *ick; -struct clk *fck;struct resource *mem;struct miscdevice omap_wdt_miscdev; };
@@ -146,8 +144,7 @@ static int omap_wdt_open(struct inode *inode, struct file *file)if (test_and_set_bit (1 , (unsigned long *)&(wdev->omap_wdt_users)))return -EBUSY ; -clk_enable (wdev->ick);/* Enable the interface clock */ -clk_enable (wdev->fck);/* Enable the functional clock */ +pm_runtime_get_sync (wdev->dev);/* initialize prescaler */ while (__raw_readl (base +OMAP_WATCHDOG_WPS ) &0x01 )
@@ -177,8 +174,7 @@ static int omap_wdt_release(struct inode *inode, struct file *file)omap_wdt_disable (wdev); -clk_disable (wdev->ick); -clk_disable (wdev->fck); +pm_runtime_put_sync (wdev->dev);#else printk (KERN_CRIT "omap_wdt: Unexpected close, not stopping!\n" );#endif
@@ -292,19 +288,7 @@ static int __devinit omap_wdt_probe(struct platform_device *pdev) wdev->omap_wdt_users =0 ; wdev->mem = mem; - - wdev->ick =clk_get (&pdev->dev,"ick" ); -if (IS_ERR (wdev->ick)) { - ret =PTR_ERR (wdev->ick); - wdev->ick =NULL ; - goto err_clk; - } - wdev->fck =clk_get (&pdev->dev,"fck" ); -if (IS_ERR (wdev->fck)) { - ret =PTR_ERR (wdev->fck); - wdev->fck =NULL ; - goto err_clk; - } + wdev->dev = &pdev->dev; wdev->base =ioremap (res->start,resource_size (res));if (!wdev->base) {
@@ -314,8 +298,8 @@ static int __devinit omap_wdt_probe(struct platform_device *pdev)platform_set_drvdata (pdev, wdev); -clk_enable (wdev->ick); -clk_enable (wdev->fck); +pm_runtime_enable (wdev->dev); +pm_runtime_get_sync (wdev->dev);omap_wdt_disable (wdev);omap_wdt_adjust_timeout (timer_margin);
@@ -333,11 +317,7 @@ static int __devinit omap_wdt_probe(struct platform_device *pdev)__raw_readl (wdev->base +OMAP_WATCHDOG_REV ) &0xFF , timer_margin); -/* autogate OCP interface clock */ -__raw_writel (0x01 , wdev->base +OMAP_WATCHDOG_SYS_CONFIG ); - -clk_disable (wdev->ick); -clk_disable (wdev->fck); +pm_runtime_put_sync (wdev->dev); omap_wdt_dev = pdev;
@@ -349,12 +329,6 @@ err_misc: err_ioremap: wdev->base =NULL ; - -err_clk: -if (wdev->ick) -clk_put (wdev->ick); -if (wdev->fck) -clk_put (wdev->fck);kfree (wdev); err_kzalloc:
@@ -386,8 +360,6 @@ static int __devexit omap_wdt_remove(struct platform_device *pdev)release_mem_region (res->start,resource_size (res));platform_set_drvdata (pdev,NULL ); -clk_put (wdev->ick); -clk_put (wdev->fck);iounmap (wdev->base);kfree (wdev);
Signature · 1 line
1.7.0.4
Tony Lindgren
maintainerQuoted 6 lines · Varadarajan, Charulatha
Series of patches to port watchdog module to use hwmod APIs for OMAP2PLUS chips and use runtime APIs for all OMAP chips. For this hwmod database for OMAP2PLUS watchdog instances are populated. This patch series also implements watchdog module to use PM runtime APIs.
Quoted 6 lines
This patch series is created on "origin/pm-core" and is tested on OMAP2430, OMAP44430, OMAP3430 SDP boards and zoom3 board. Also verified that this patch series does not break the OMAP1 build.
This series is tested on OMAP4430 ES2 using the below series
http://www.spinics.net/lists/linux-omap/msg36023.html
Can you please list the exact dependencies to other patches for the mainline kernel? Are they the same as for the omap serial driver just posted?
Tony
Quoted 11 lines · Tony Lindgren
Quoted 10 lines · Varadarajan, Charulatha
Series of patches to port watchdog module to use hwmod APIs for OMAP2PLUS chips and use runtime APIs for all OMAP chips. For this hwmod database for OMAP2PLUS watchdog instances are populated. This patch series also implements watchdog module to use PM runtime APIs.
This patch series is created on "origin/pm-core" and is tested on OMAP2430, OMAP44430, OMAP3430 SDP boards and zoom3 board. Also verified that this patch series does not break the OMAP1 build.
Quoted 6 lines
Quoted 2 lines
This series is tested on OMAP4430 ES2 using the below series
http://www.spinics.net/lists/linux-omap/msg36023.htmlCan you please list the exact dependencies to other patches for the mainline kernel? Are they the same as for the omap serial driver just posted?
Hi Tony,
This series is based on my pm-core branch which is basically the the stuff I have submitted upstream (my pm-next series, the runtime PM core) and a collection of hwmod fixes that Paul/Benoit have lined up for 2.6.37.
I will gladly queue these hwmod conversion patches in my tree if you prefer since I am already managing all the dependencies.
Kevin
Tony Lindgren
maintainerQuoted 20 lines · Kevin Hilman
Quoted 11 lines · Tony Lindgren
Quoted 10 lines · Varadarajan, Charulatha
Series of patches to port watchdog module to use hwmod APIs for OMAP2PLUS chips and use runtime APIs for all OMAP chips. For this hwmod database for OMAP2PLUS watchdog instances are populated. This patch series also implements watchdog module to use PM runtime APIs.
This patch series is created on "origin/pm-core" and is tested on OMAP2430, OMAP44430, OMAP3430 SDP boards and zoom3 board. Also verified that this patch series does not break the OMAP1 build.
Quoted 6 lines
Quoted 2 lines
This series is tested on OMAP4430 ES2 using the below series
http://www.spinics.net/lists/linux-omap/msg36023.htmlCan you please list the exact dependencies to other patches for the mainline kernel? Are they the same as for the omap serial driver just posted?
Quoted 6 lines
Hi Tony,
This series is based on my pm-core branch which is basically the the stuff I have submitted upstream (my pm-next series, the runtime PM core) and a collection of hwmod fixes that Paul/Benoit have lined up for 2.6.37.
OK thanks for the summary.
So let's get all the dependencies out of the way and pull them into linux-omap master branch for testing. Sounds like we should base this on Paul's core hwmod branch and your pm-next.
Then for the runtime PM core, let's just keep merging them from Greg's queue into l-o master until they are merged to the mainline tree.
I assume that the runtime PM core patches are the ones at [1] below?
Quoted 2 lines
I will gladly queue these hwmod conversion patches in my tree if you prefer since I am already managing all the dependencies.
Yes, once we have dependencies queued up, then let's pull these in, at least for testing.
For merging some hwdmod drivers to mainline, do we have all the necessary acks from the driver maintainers?
Regards,
Tony
[1] http://ftp.litnet.lt/pub/linux/kernel/people/gregkh/gregkh-2.6/gregkh-05-driver-core/
Quoted 28 lines · Tony Lindgren
Quoted 20 lines · Kevin Hilman
Quoted 11 lines · Tony Lindgren
Quoted 10 lines · Varadarajan, Charulatha
Series of patches to port watchdog module to use hwmod APIs for OMAP2PLUS chips and use runtime APIs for all OMAP chips. For this hwmod database for OMAP2PLUS watchdog instances are populated. This patch series also implements watchdog module to use PM runtime APIs.
This patch series is created on "origin/pm-core" and is tested on OMAP2430, OMAP44430, OMAP3430 SDP boards and zoom3 board. Also verified that this patch series does not break the OMAP1 build.
Quoted 6 lines
Quoted 2 lines
This series is tested on OMAP4430 ES2 using the below series
http://www.spinics.net/lists/linux-omap/msg36023.htmlCan you please list the exact dependencies to other patches for the mainline kernel? Are they the same as for the omap serial driver just posted?
Quoted 6 lines
Hi Tony,
This series is based on my pm-core branch which is basically the the stuff I have submitted upstream (my pm-next series, the runtime PM core) and a collection of hwmod fixes that Paul/Benoit have lined up for 2.6.37.
Quoted 5 lines
OK thanks for the summary.
So let's get all the dependencies out of the way and pull them into linux-omap master branch for testing. Sounds like we should base this on Paul's core hwmod branch and your pm-next.
Yes, those two branches are required as the bare minimum.
Quoted 4 lines
Then for the runtime PM core, let's just keep merging them from Greg's queue into l-o master until they are merged to the mainline tree.
I assume that the runtime PM core patches are the ones at [1] below?
I should've said runtime PM core for OMAP, by which I mean:
http://marc.info/?l=linux-omap&m=128459521813724&w=2
That series has a dependency on only one of the patches from Greg's queue you mentioned. Specifically, the one from me:
driver core: platform_bus: allow runtime override of dev_pm_ops
which I also have in my pm-backports branch.
Quoted 8 lines
Quoted 2 lines
I will gladly queue these hwmod conversion patches in my tree if you prefer since I am already managing all the dependencies.
Yes, once we have dependencies queued up, then let's pull these in, at least for testing.
For merging some hwdmod drivers to mainline, do we have all the necessary acks from the driver maintainers?
The only one that's currently ready is watchdog, and for that one I have an Ack from Wim to merge this via linux-omap.
For the others that are close (UART, GPIO, i2c) I've asked that the next versions of those be posted to LAKML as well as the subsystem lists.
Quoted 1 line
From there, I will ask the subsystem maintainers for an ack so we can
merge them via linux-omap along with all the platform changes.
Kevin
Tony Lindgren
maintainerQuoted 8 lines · Kevin Hilman
Quoted 3 lines · Tony Lindgren
So let's get all the dependencies out of the way and pull them into linux-omap master branch for testing. Sounds like we should base this on Paul's core hwmod branch and your pm-next.
Yes, those two branches are required as the bare minimum.
Quoted 8 lines
Quoted 4 lines
Then for the runtime PM core, let's just keep merging them from Greg's queue into l-o master until they are merged to the mainline tree.
I assume that the runtime PM core patches are the ones at [1] below?
I should've said runtime PM core for OMAP, by which I mean:
http://marc.info/?l=linux-omap&m=128459521813724&w=2
OK
Quoted 6 lines
That series has a dependency on only one of the patches from Greg's queue you mentioned. Specifically, the one from me:
driver core:
platform_bus: allow runtime override ofdev_pm_opswhich I also have in my pm-backports branch.
OK, I'll add that to omap-testing as well.
Quoted 11 lines
Quoted 8 lines
Quoted 2 lines
I will gladly queue these hwmod conversion patches in my tree if you prefer since I am already managing all the dependencies.
Yes, once we have dependencies queued up, then let's pull these in, at least for testing.
For merging some hwdmod drivers to mainline, do we have all the necessary acks from the driver maintainers?
The only one that's currently ready is watchdog, and for that one I have an Ack from Wim to merge this via linux-omap.
OK
Quoted 4 lines
For the others that are close (UART, GPIO, i2c) I've asked that the next versions of those be posted to LAKML as well as the subsystem lists. From there, I will ask the subsystem maintainers for an ack so we can merge them via linux-omap along with all the platform changes.
OK, well if you have something ready, we could some of those branches into linux-omap master branch too for testing.
Regards,
Tony
Paul Walmsley
maintainerQuoted 8 lines · Tony Lindgren
Quoted 7 lines · Kevin Hilman
Quoted 3 lines · Tony Lindgren
So let's get all the dependencies out of the way and pull them into linux-omap master branch for testing. Sounds like we should base this on Paul's core hwmod branch and your pm-next.
Yes, those two branches are required as the bare minimum.
Just a quick note - the branch
git://git.pwsan.com/linux-2.6 hwmod_2.6.37
contains the current set of hwmod core patches that I'd like to get upstream for 2.6.37. Will send a pull request tomorrow.
I plan to have a few more branches for 2.6.37 with some SCM, SDRC, clock, clockdomain, and powerdomain patches. Will post those separately and also assemble a composite 'for_2.6.37' branch with both the hwmod and the clock/clockdomain/powerdomain/SCM/SDRC patches.
regards,
- Paul