OMAP2PLUS: WDT: Implement WDT in HWMOD way
Subsystems (5)
cover OMAP2PLUS: WDT: Implement WDT in HWMOD way
This patch series makes OMAP2PLUS Watchdog Timer Module implemented in HWMOD FW way. It also implements OMAP2/3 Watchdog timer driver to use the runtime PM layer.
This patch series is created on "origin/pm-wip/hwmod-omap4".
This patch series is tested on OMAP3430 SDP, OMAP3630 SDP and OMAP4430 SDP. It would be of great help if someone could test the same on OMAP1 and OMAP2 boards.
The same patchset is also tested on "origin/pm-wip/runtime". Please note that patch 5/6 "OMAP4: WDT: Enable watchdog timer2 hwmod structure" is not valid in "origin/pm-wip/runtime" branch.
Charulatha V (6):
OMAP2PLUS: WDT: Add ICLKEN, FCLKEN, WKEN shared bits for WDT
OMAP3: WDT: Add watchdog timer HWMOD data for OMAP3
OMAP2420: WDT: Add watchdog timer HWMOD data for OMAP2420
OMAP2430: WDT: Add watchdog timer HWMOD data for OMAP2430
OMAP4: WDT: Enable watchdog timer2 hwmod structure
OMAP2PLUS: WDT: Conversion to runtime PM
arch/arm/mach-omap2/omap_hwmod_2420_data.c | 56 +++++++++++++++++++++++++ arch/arm/mach-omap2/omap_hwmod_2430_data.c | 56 +++++++++++++++++++++++++ arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 61 ++++++++++++++++++++++++++++ arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 2 +- arch/arm/mach-omap2/prcm-common.h | 4 ++ arch/arm/plat-omap/devices.c | 52 ++++++++++++++++------- drivers/watchdog/omap_wdt.c | 43 +++++++++++--------- 7 files changed, 238insertions(+), 36 deletions(-)
PATCH 1/6 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 (1 << 3)#define OMAP24XX_EN_GPIOS_SHIFT 2#define OMAP24XX_EN_GPIOS (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 (1 << 5) +#define OMAP3430_EN_WDT2_SHIFT 5#define OMAP3430_EN_GPIO1 (1 << 3)#define OMAP3430_EN_GPIO1_SHIFT 3#define OMAP3430_EN_GPT12 (1 << 1)
Signature · 1 line
1.6.3.3
PATCH 2/6 OMAP3: WDT: Add watchdog timer HWMOD data for OMAP3
Add hwmod structures for Watchdog module on OMAP3
--- arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 61 ++++++++++++++++++++++++++++ 1 files changed, 61 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +61 -0
@@ -80,6 +80,7 @@ static struct omap_hwmod omap3xxx_l3_hwmod = { };static struct omap_hwmod omap3xxx_l4_wkup_hwmod; +static struct omap_hwmod omap3xxx_wd_timer2_hwmod;/* L4_CORE -> L4_WKUP interface */ static struct omap_hwmod_ocp_if omap3xxx_l4_core__l4_wkup = {
@@ -129,6 +130,24 @@ static struct omap_hwmod omap3xxx_l4_per_hwmod = { .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430) }; +/* WDTIMER2 <- L4_WKUP interface */ +static struct omap_hwmod_addr_space omap3xxx_wd_timer2_addrs[] = { + { + .pa_start =0x48314000 , + .pa_end =0x48314000 +SZ_4K -1 , + .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 , +}; +/* Slave interfaces on the L4_WKUP interconnect */ static struct omap_hwmod_ocp_if *omap3xxx_l4_wkup_slaves[] = { &omap3xxx_l4_core__l4_wkup,
@@ -149,6 +168,47 @@ static struct omap_hwmod omap3xxx_l4_wkup_hwmod = { .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430) }; +/* WDTIMER common */ + +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 ), + .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, +}; + +/* WDTIMER2 */ +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 =5 , + }, + }, + .slaves = omap3xxx_wd_timer2_slaves, + .slaves_cnt =ARRAY_SIZE (omap3xxx_wd_timer2_slaves), + .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP3430 ), +}; +/* Master interfaces on the MPU device */ static struct omap_hwmod_ocp_if *omap3xxx_mpu_masters[] = { &omap3xxx_mpu__l3,
@@ -170,6 +230,7 @@ static __initdata struct omap_hwmod *omap3xxx_hwmods[] = { &omap3xxx_l4_per_hwmod, &omap3xxx_l4_wkup_hwmod, &omap3xxx_mpu_hwmod, + &omap3xxx_wd_timer2_hwmod, NULL, };
Signature · 1 line
1.6.3.3
PATCH 3/6 OMAP2420: WDT: Add watchdog timer HWMOD data for OMAP2420
Add hwmod structures for Watchdog module on OMAP2420
--- arch/arm/mach-omap2/omap_hwmod_2420_data.c | 56 ++++++++++++++++++++++++++++ 1 files changed, 56 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/omap_hwmod_2420_data.c +56 -0
@@ -69,6 +69,7 @@ static struct omap_hwmod omap2420_l3_hwmod = { };static struct omap_hwmod omap2420_l4_wkup_hwmod; +static struct omap_hwmod omap2420_wd_timer2_hwmod;/* L4_CORE -> L4_WKUP interface */ static struct omap_hwmod_ocp_if omap2420_l4_core__l4_wkup = {
@@ -118,6 +119,60 @@ static struct omap_hwmod omap2420_l4_wkup_hwmod = { .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420) }; +/* WDTIMER2 <- L4_WKUP interface */ +static struct omap_hwmod_addr_space omap2420_wd_timer2_addrs[] = { + { + .pa_start =0x48022000 , + .pa_end =0x48022000 +SZ_4K -1 , + .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 , +}; + +/* WDTIMER common */ + +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, +}; + +/* WDTIMER2 */ +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 , + }, + }, + .slaves = omap2420_wd_timer2_slaves, + .slaves_cnt =ARRAY_SIZE (omap2420_wd_timer2_slaves), + .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP2420 ), +}; +/* Master interfaces on the MPU device */ static struct omap_hwmod_ocp_if *omap2420_mpu_masters[] = { &omap2420_mpu__l3,
@@ -138,6 +193,7 @@ static __initdata struct omap_hwmod *omap2420_hwmods[] = { &omap2420_l4_core_hwmod, &omap2420_l4_wkup_hwmod, &omap2420_mpu_hwmod, + &omap2420_wd_timer2_hwmod, NULL, };
Signature · 1 line
1.6.3.3
PATCH 4/6 OMAP2430: WDT: Add watchdog timer HWMOD data for OMAP2430
Add hwmod structures for Watchdog module on OMAP2430
--- arch/arm/mach-omap2/omap_hwmod_2430_data.c | 56 ++++++++++++++++++++++++++++ 1 files changed, 56 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/omap_hwmod_2430_data.c +56 -0
@@ -71,6 +71,7 @@ static struct omap_hwmod omap2430_l3_hwmod = {static struct omap_hwmod omap2430_l4_wkup_hwmod;static struct omap_hwmod omap2430_mmc1_hwmod;static struct omap_hwmod omap2430_mmc2_hwmod; +static struct omap_hwmod omap2430_wd_timer2_hwmod;/* L4_CORE -> L4_WKUP interface */ static struct omap_hwmod_ocp_if omap2430_l4_core__l4_wkup = {
@@ -125,6 +126,60 @@ static struct omap_hwmod_ocp_if *omap2430_mpu_masters[] = { &omap2430_mpu__l3, }; +/* WDTIMER2 <- L4_WKUP interface */ +static struct omap_hwmod_addr_space omap2430_wd_timer2_addrs[] = { + { + .pa_start =0x49016000 , + .pa_end =0x49016000 +SZ_4K -1 , + .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 , +}; + +/* WDTIMER common */ + +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, +}; + +/* WDTIMER2 */ +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 , + }, + }, + .slaves = omap2430_wd_timer2_slaves, + .slaves_cnt =ARRAY_SIZE (omap2430_wd_timer2_slaves), + .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP2430 ), +}; +/* MPU */ static struct omap_hwmod omap2430_mpu_hwmod = { .name ="mpu" ,
@@ -140,6 +195,7 @@ static __initdata struct omap_hwmod *omap2430_hwmods[] = { &omap2430_l4_core_hwmod, &omap2430_l4_wkup_hwmod, &omap2430_mpu_hwmod, + &omap2430_wd_timer2_hwmod, NULL, };
Signature · 1 line
1.6.3.3
PATCH 5/6 OMAP4: WDT: Enable watchdog timer2 hwmod structure
This patch enables the watchdog timer2 hwmod structure
--- arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +1 -1
@@ -4888,7 +4888,7 @@ static __initdata struct omap_hwmod *omap44xx_hwmods[] = {/* usb_tll_hs class */ /* &omap44xx_usb_tll_hs_hwmod, */ /* wd_timer class */ -/* &omap44xx_wd_timer2_hwmod, */ + &omap44xx_wd_timer2_hwmod,/* &omap44xx_wd_timer3_hwmod, */ NULL, };
Signature · 1 line
1.6.3.3
PATCH 6/6 OMAP2PLUS: WDT: Conversion to runtime PM
This patch converts the OMAP2/3 Watchdog timer driver to get adapted to HWMOD FW and to use the runtime PM APIs.
This patch is tested on SDP3430, SDP3630 and SDP4430.
--- arch/arm/plat-omap/devices.c | 52 ++++++++++++++++++++++++---------- drivers/watchdog/omap_wdt.c | 63 ++++++++++++++--------------------------- 2 files changed, 58 insertions(+), 57 deletions(-)
arch/arm/plat-omap/devices.c +36 -16
@@ -15,6 +15,7 @@#include <linux/platform_device.h> #include <linux/io.h> #include <linux/slab.h> +#include <linux/err.h> #include <mach/hardware.h> #include <asm/mach-types.h>
@@ -30,6 +31,8 @@#include <plat/mcbsp.h> #include <plat/dsp_common.h> #include <plat/omap44xx.h> +#include <plat/omap_hwmod.h> +#include <plat/omap_device.h> #if defined(CONFIG_OMAP_DSP ) || defined(CONFIG_OMAP_DSP_MODULE )
@@ -360,6 +363,8 @@ static inline void omap_init_uwire(void) {}static struct resource wdt_resources[] = { { + .start =0xfffeb000 , + .end =0xfffeb07F , .flags =IORESOURCE_MEM , }, };
@@ -371,24 +376,39 @@ static struct platform_device omap_wdt_device = { .resource = wdt_resources, }; -static void omap_init_wdt (void ) -{ -if (cpu_is_omap16xx ()) - wdt_resources[0 ].start =0xfffeb000 ; -else if (cpu_is_omap2420 ()) - wdt_resources[0 ].start =0x48022000 ;/* WDT2 */ -else if (cpu_is_omap2430 ()) - wdt_resources[0 ].start =0x49016000 ;/* WDT2 */ -else if (cpu_is_omap343x ()) - wdt_resources[0 ].start =0x48314000 ;/* WDT2 */ -else if (cpu_is_omap44xx ()) - wdt_resources[0 ].start =0x4a314000 ; -else -return ; +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 , + }, +}; - wdt_resources[0 ].end = wdt_resources[0 ].start +0x4f ; +static int omap2_init_wdt (struct omap_hwmod *oh,void *user) +{ +int id =-1 ; +struct omap_device *od; +char *name ="omap_wdt" ; + +if (!oh) +pr_err ("Could not look up wdtimer2_hwmod\n" ); + + od =omap_device_build (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" , + name, oh->name); +return 0 ; +} - (void )platform_device_register (&omap_wdt_device); +static void omap_init_wdt (void ) +{ +if (cpu_class_is_omap2 ()) +omap_hwmod_for_each_by_class ("wd_timer" , omap2_init_wdt, +NULL ); +else if (cpu_is_omap16xx ()) + (void )platform_device_register (&omap_wdt_device); +return ; }#else static inline void omap_init_wdt (void ) {}
drivers/watchdog/omap_wdt.c +22 -41
133 lines not on this page · raw message
Signature · 1 line
1.6.3.3
Re: [PATCH 1/6] OMAP2PLUS: WDT: Add ICLKEN, FCLKEN, WKEN shared bits for WDT
In reply to Charulatha VQuoted 22 lines · Charulatha V
This patch adds the
CM_FCLKEN_WKUP,CM_ICLKEN_WKUP,PM_WKEN_WKUPshared bits for OMAP2PLUS watchdog timer moduleSigned-off-by Charulatha V <[email protected]>--- arch/arm/mach-omap2/prcm-common.h | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)arch/arm/mach-omap2/prcm-common.h +2
-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 (1 << 3)#define OMAP24XX_EN_GPIOS_SHIFT 2#define OMAP24XX_EN_GPIOS (1 << 2)#define OMAP24XX_EN_GPT1_SHIFT 0
arch/arm/mach-omap2/prcm-common.h line 353
Quoted 8 lines
arch/arm/mach-omap2/prcm-common.h +2
-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 (1 << 5) +#define OMAP3430_EN_WDT2_SHIFT 5#define OMAP3430_EN_GPIO1 (1 << 3)#define OMAP3430_EN_GPIO1_SHIFT 3#define OMAP3430_EN_GPT12 (1 << 1)
This needs a refresh against current pm-wip/* branches based on v2.6.35.
These defines were updated to include the _MASK suffix for consistency.
Kevin
Re: [PATCH 3/6] OMAP2420: WDT: Add watchdog timer HWMOD data for OMAP2420
In reply to Charulatha VQuoted 7 lines · Charulatha V
Add hwmod structures for Watchdog module on OMAP2420
Signed-off-by Charulatha V <[email protected]>--- arch/arm/mach-omap2/omap_hwmod_2420_data.c | 56 ++++++++++++++++++++++++++++ 1 files changed, 56 insertions(+), 0 deletions(-)
[...]
arch/arm/mach-omap2/omap_hwmod_2420_data.c static struct omap_hwmod omap2420_l4_wkup_hwmod = { · line 166
Quoted 11 lines
arch/arm/mach-omap2/omap_hwmod_2420_data.c +11
-0+/* WDTIMER2 */ +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 = {
missing .module_offs
arch/arm/mach-omap2/omap_hwmod_2420_data.c static struct omap_hwmod omap2420_l4_wkup_hwmod = { · line 176
Quoted 10 lines
arch/arm/mach-omap2/omap_hwmod_2420_data.c +9
-0+ .prcm_reg_id = 1, + .module_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), +}; +/* Master interfaces on the MPU device */
Kevin
Re: [PATCH 4/6] OMAP2430: WDT: Add watchdog timer HWMOD data for OMAP2430
In reply to Charulatha VQuoted 7 lines · Charulatha V
Add hwmod structures for Watchdog module on OMAP2430
Signed-off-by Charulatha V <[email protected]>--- arch/arm/mach-omap2/omap_hwmod_2430_data.c | 56 ++++++++++++++++++++++++++++ 1 files changed, 56 insertions(+), 0 deletions(-)
[...]
arch/arm/mach-omap2/omap_hwmod_2430_data.c static struct omap_hwmod_ocp_if *omap2430_mpu_masters[] = { · line 173
Quoted 11 lines
arch/arm/mach-omap2/omap_hwmod_2430_data.c +11
-0+/* WDTIMER2 */ +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 = {
missing .module_offs
arch/arm/mach-omap2/omap_hwmod_2430_data.c static struct omap_hwmod_ocp_if *omap2430_mpu_masters[] = { · line 182
Quoted 9 lines
arch/arm/mach-omap2/omap_hwmod_2430_data.c +9
-0+ .prcm_reg_id = 1, + .module_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), +}; +
Kevin
Re: [PATCH 6/6] OMAP2PLUS: WDT: Conversion to runtime PM
In reply to Charulatha VQuoted 11 lines · Charulatha V
This patch converts the OMAP2/3 Watchdog timer driver to get adapted to HWMOD FW and to use the runtime PM APIs.
This patch is tested on SDP3430, SDP3630 and SDP4430.
Signed-off-by Charulatha V <[email protected]>--- arch/arm/plat-omap/devices.c | 52 ++++++++++++++++++++++++---------- drivers/watchdog/omap_wdt.c | 63 ++++++++++++++--------------------------- 2 files changed, 58 insertions(+), 57 deletions(-)
[...]
Quoted 4 lines
drivers/watchdog/omap_wdt.c +0
-0@@ -142,12 +143,13 @@ static int omap_wdt_open(struct inode *inode, struct file *file) {struct omap_wdt_dev *wdev =platform_get_drvdata (omap_wdt_dev);void __iomem *base = wdev->base;
drivers/watchdog/omap_wdt.c static int omap_wdt_open(struct inode *inode, struct file *file) · line 152
Quoted 10 lines
drivers/watchdog/omap_wdt.c +4
-3-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 */ +if (!wdt_runtime_state) { +pm_runtime_get_sync (wdev->dev); + wdt_runtime_state =1 ; + }
I don't follow the need (or usage) of wdt_runtime_state. You seem to be using it as a rudimentary form of usage counting for multiple calls to _open()? The runtime PM API will handle all the usage counting, so this shouldn't be necessary.
Quoted 26 lines
drivers/watchdog/omap_wdt.c +2
-10/* initialize prescaler */ while (__raw_readl (base +OMAP_WATCHDOG_WPS ) &0x01 )@@ -177,8 +179,8 @@ 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); + wdt_runtime_state =0 ;#else printk (KERN_CRIT "omap_wdt: Unexpected close, not stopping!\n" );#endif @@ -290,32 +292,24 @@ static int __devinit omap_wdt_probe(struct platform_device *pdev) goto err_kzalloc; } - 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;
drivers/watchdog/omap_wdt.c static int __devinit omap_wdt_probe(struct platform_device *pdev) · line 295
Quoted 10 lines
drivers/watchdog/omap_wdt.c +1
-9- } - wdev->fck =clk_get (&pdev->dev,"fck" ); -if (IS_ERR (wdev->fck)) { - ret =PTR_ERR (wdev->fck); - wdev->fck =NULL ; - goto err_clk; - } - - wdev->base =ioremap (res->start,resource_size (res)); + wdev->base =ioremap (res->start,SZ_4K );
Why switch from resource_size() to SZ_4K? Yes, the region
mapped is small and will round up to PAGE_SIZE, but no need to hard-code that assumption here.
Quoted 9 lines
drivers/watchdog/omap_wdt.c +4
-0if (!wdev->base) { ret = -ENOMEM ; goto err_ioremap; } + wdev->omap_wdt_users =0 ; + wdev->mem = mem; + wdev->dev = &pdev->dev; +
drivers/watchdog/omap_wdt.c static int __devinit omap_wdt_probe(struct platform_device *pdev) · line 312
Quoted 10 lines
drivers/watchdog/omap_wdt.c +6
-2platform_set_drvdata (pdev, wdev); -clk_enable (wdev->ick); -clk_enable (wdev->fck); +pm_runtime_enable (wdev->dev); +pm_runtime_get_sync (wdev->dev); +#ifndef CONFIG_PM_RUNTIME +/* If runtime PM is not enabled, ensure clocks are always enabled */ +omap_device_enable (pdev); +#endif
As with my comment on GPIO, lets drop the handling of #ifndef CONFIG_PM_RUNTIME from the drivers and handle that in common code.
Kevin