Skip to contentSkip to conversation

OMAP: WDT: Implement WDT in hwmod way

PATCH Superseded Varadarajan, Charulatha 5 participants 27 messages Sep 15, 2010 – Sep 17, 2010

Subsystems (5)

v5 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

v5 cover OMAP: WDT: Implement WDT in hwmod way

Series of patches to port watchdog module to use hwmod and omap_device apis for OMAP2plus chips. For this hwmod data structures are poulated. This patch series also implements watchdog module to use PM runtime APIs.

This patch series is created on "origin/pm-core" and are tested on OMAP2430, OMAP44430, OMAP3430 SDP boards and zoom3 board. Also verified that this patch series does not break the OMAP1 build.

Version History:
---------------
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

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 (5):
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-omap2/omap_hwmod_2420_data.c |   59 ++++++++++++++++++++++++
 arch/arm/mach-omap2/omap_hwmod_2430_data.c |   59 ++++++++++++++++++++++++
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |   61 +++++++++++++++++++++++++
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |   68 ++++++++++++++++++++++++++++
 arch/arm/mach-omap2/prcm-common.h          |    4 ++
 arch/arm/plat-omap/devices.c               |   64 ++++++++++++++++++--------
 drivers/watchdog/omap_wdt.c                |   42 +++--------------
 7 files changed, 302 insertions(+), 55 deletions(-)
#1 lore raw

PATCH v5 1/6 OMAP3: hwmod data: Add watchdog timer

Add watchdog timer hwmod data for OMAP3 chip

---
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |   61 ++++++++++++++++++++++++++++
 arch/arm/mach-omap2/prcm-common.h          |    4 ++
 2 files changed, 65 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +61 -0
index 5d8eb58..a9812a8 100644
@@ -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,65 @@ static struct omap_hwmod omap3xxx_iva_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		= 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,
+};
+
+/* 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 | 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,
+};
+
+/* 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 = 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 +264,7 @@ static __initdata struct omap_hwmod *omap3xxx_hwmods[] = {
 	&omap3xxx_l4_wkup_hwmod,
 	&omap3xxx_mpu_hwmod,
 	&omap3xxx_iva_hwmod,
+	&omap3xxx_wd_timer2_hwmod,
 	NULL,
 };
 
arch/arm/mach-omap2/prcm-common.h +4 -0
index 995b7ed..e190c64 100644
@@ -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
#2 lore raw

Re: [PATCH v5 1/6] OMAP3: hwmod data: Add watchdog timer

Quoted 21 lines · Charulatha

Add watchdog timer hwmod data for OMAP3 chip

---
  arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |   61 ++++++++++++++++++++++++++++
  arch/arm/mach-omap2/prcm-common.h          |    4 ++
  2 files changed, 65 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +1 -0
index 5d8eb58..a9812a8 100644
@@ -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 = {

arch/arm/mach-omap2/omap_hwmod_3xxx_data.c static struct omap_hwmod omap3xxx_iva_hwmod = { · line 201

Quoted 4 lines
arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +1 -0
@@ -197,6 +198,65 @@ static struct omap_hwmod omap3xxx_iva_hwmod = {
  	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
  };
 
+/* WDTIMER2<- L4_WKUP interface */

Minor point, but the name convention is wd_timerX. It is valid for all other comments in this file.

Quoted 83 lines
arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +59 -0
+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,
+};
+
+/* 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 | 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,
+};
+
+/* 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 = 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 +264,7 @@ static __initdata struct omap_hwmod *omap3xxx_hwmods[] = {
  	&omap3xxx_l4_wkup_hwmod,
  	&omap3xxx_mpu_hwmod,
  	&omap3xxx_iva_hwmod,
+	&omap3xxx_wd_timer2_hwmod,
  	NULL,
  };
 
arch/arm/mach-omap2/prcm-common.h +2 -0
index 995b7ed..e190c64 100644
@@ -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

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_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)

That part is not related to the subject of this patch. You should probably put that in another patch.

Benoit

#3 lore raw

RE: [PATCH v5 1/6] OMAP3: hwmod data: Add watchdog timer

Quoted 38 lines

-----Original Message-----
From: Cousson, Benoit
Sent: Thursday, September 16, 2010 2:57 AM
To: Varadarajan, Charulatha
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Nayak, Rajendra; Basak, Partha; [email protected]
Subject: Re: [PATCH v5 1/6] OMAP3: hwmod data: Add watchdog timer

Quoted 5 lines · Charulatha

Add watchdog timer hwmod data for OMAP3 chip

---
  arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |   61

++++++++++++++++++++++++++++

arch/arm/mach-

Quoted 4 lines
  arch/arm/mach-omap2/prcm-common.h          |    4 ++
  2 files changed, 65 insertions(+), 0 deletions(-)
arch/arm/mach- renamed from arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +0 -0

omap2/omap_hwmod_3xxx_data.c

Quoted 15 lines

index 5d8eb58..a9812a8 100644

arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +1 -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,65 @@ static struct omap_hwmod omap3xxx_iva_hwmod = {
  	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
  };
 
Quoted 4 lines

arch/arm/mach-omap2/omap_hwmod_3xxx_data.c static struct omap_hwmod omap3xxx_iva_hwmod = { · line 201

Quoted 1 line
arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +1 -0
+/* WDTIMER2<- L4_WKUP interface */

Minor point, but the name convention is wd_timerX. It is valid for all other comments in this file.

Okay.

Quoted 88 lines

arch/arm/mach-omap2/omap_hwmod_3xxx_data.c static __initdata struct omap_hwmod

Quoted 63 lines
arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +58 -0
+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,
+};
+
+/* 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 | 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,
+};
+
+/* 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 = 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 +264,7 @@ static __initdata struct omap_hwmod

*omap3xxx_hwmods[] = {

arch/arm/mach-

Quoted 8 lines
arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +1 -0
  	&omap3xxx_l4_wkup_hwmod,
  	&omap3xxx_mpu_hwmod,
  	&omap3xxx_iva_hwmod,
+	&omap3xxx_wd_timer2_hwmod,
  	NULL,
  };
 
arch/arm/mach- renamed from arch/arm/mach-omap2/prcm-common.h +0 -0

omap2/prcm-common.h

Quoted 15 lines

index 995b7ed..e190c64 100644

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_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)
 
Quoted 9 lines

arch/arm/mach-omap2/prcm-common.h

Quoted 6 lines
arch/arm/mach-omap2/prcm-common.h +2 -0
  /* 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)

That part is not related to the subject of this patch. You should probably put that in another patch.

Okay.

Quoted 2 lines

Benoit

#4 lore raw

PATCH v5 2/6 OMAP2420: hwmod data: Add watchdog timer

In reply to Varadarajan, Charulatha

Add watchdog timer hwmod data for OMAP2420 chip

---
 arch/arm/mach-omap2/omap_hwmod_2420_data.c |   59 ++++++++++++++++++++++++++++
 1 files changed, 59 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/omap_hwmod_2420_data.c +59 -0
index 3cc768e..73a516e 100644
@@ -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,70 @@ static struct omap_hwmod omap2420_iva_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		= 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,
+};
+
+/* 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,
+			.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
#5 lore raw

PATCH v5 3/6 OMAP2430: hwmod data: Add watchdog timer

In reply to Varadarajan, Charulatha

Add watchdog timer hwmod data for OMAP2430 chip

---
 arch/arm/mach-omap2/omap_hwmod_2430_data.c |   59 ++++++++++++++++++++++++++++
 1 files changed, 59 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/omap_hwmod_2430_data.c +59 -0
index 4526628..f74fca0 100644
@@ -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,70 @@ static struct omap_hwmod omap2430_iva_hwmod = {
 	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2430)
 };
 
+/* WDTIMER2 <- L4_WKUP interface */
+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,
+};
+
+/* 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,
+			.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
#6 lore raw

PATCH v5 4/6 OMAP4: hwmod data: Add watchdog timer

In reply to Varadarajan, Charulatha

From: Benoit Cousson <[email protected]>

Add watchdog timer hwmod data for OMAP4 chip

---
This patch is extracted from the below patch sent by Benoit
OMAP4: hwmod: Add partial hwmod support for OMAP4430 ES1.0
https://patchwork.kernel.org/patch/99052/

 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |   68 ++++++++++++++++++++++++++++
 1 files changed, 68 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +68 -0
index e20b0ee..06851f7 100644
@@ -452,6 +452,72 @@ 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),
+};
+
 static __initdata struct omap_hwmod *omap44xx_hwmods[] = {
 	/* dmm class */
 	&omap44xx_dmm_hwmod,
@@ -472,6 +538,8 @@ static __initdata struct omap_hwmod *omap44xx_hwmods[] = {
 
 	/* mpu class */
 	&omap44xx_mpu_hwmod,
+	/* wd_timer class */
+	&omap44xx_wd_timer2_hwmod,
 	NULL,
 };
 
Signature · 1 line
1.7.0.4
#7 lore raw

Re: [PATCH v5 4/6] OMAP4: hwmod data: Add watchdog timer

Hi Charu,

Quoted 92 lines · Charulatha

From: Benoit Cousson<[email protected]>

Add watchdog timer hwmod data for OMAP4 chip

---
This patch is extracted from the below patch sent by Benoit
OMAP4: hwmod: Add partial hwmod support for OMAP4430 ES1.0
https://patchwork.kernel.org/patch/99052/

  arch/arm/mach-omap2/omap_hwmod_44xx_data.c |   68 ++++++++++++++++++++++++++++
  1 files changed, 68 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +66 -0
index e20b0ee..06851f7 100644
@@ -452,6 +452,72 @@ 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),
+};
+
  static __initdata struct omap_hwmod *omap44xx_hwmods[] = {
  	/* dmm class */
  	&omap44xx_dmm_hwmod,

arch/arm/mach-omap2/omap_hwmod_44xx_data.c static __initdata struct omap_hwmod *omap44xx_hwmods[] = { · line 544

Quoted 7 lines
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +2 -0
@@ -472,6 +538,8 @@ static __initdata struct omap_hwmod *omap44xx_hwmods[] = {
 
  	/* mpu class */
  	&omap44xx_mpu_hwmod,
+	/* wd_timer class */
+	&omap44xx_wd_timer2_hwmod,
  	NULL,
  };

What about the wd_timer3? It is in the audio backend, and I'm not sure who will use it, but it does exist.

Benoit

#8 lore raw

RE: [PATCH v5 4/6] OMAP4: hwmod data: Add watchdog timer

Quoted 11 lines

-----Original Message-----
From: Cousson, Benoit
Sent: Thursday, September 16, 2010 2:49 AM
To: Varadarajan, Charulatha
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Nayak, Rajendra; Basak, Partha; [email protected]
Subject: Re: [PATCH v5 4/6] OMAP4: hwmod data: Add watchdog timer

Quoted 10 lines

Hi Charu,

Quoted 7 lines · Charulatha

From: Benoit Cousson<[email protected]>

Add watchdog timer hwmod data for OMAP4 chip

---

<<snip>>

Quoted 12 lines

Review static __initdata struct omap_hwmod

Quoted 1 line
(quoted diff) +0 -0
@@ -472,6 +538,8 @@ static __initdata struct omap_hwmod

*omap44xx_hwmods[] = {

arch/arm/mach-omap2/omap_hwmod_44xx_data.c static __initdata struct omap_hwmod *omap44xx_hwmods[] = { · line 544

Quoted 7 lines
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +2 -0
  	/* mpu class */
  	&omap44xx_mpu_hwmod,
+	/* wd_timer class */
+	&omap44xx_wd_timer2_hwmod,
  	NULL,
  };

What about the wd_timer3? It is in the audio backend, and I'm not sure who will use it, but it does exist.

As you mentioned, wd_timer3 in OMAP4 is an IVA3 watchdog timer.

Also the current watchdog driver (omap_wdt.c) does not support more than one watchdog timer. To add this support we need to first redesign the driver code and then add wd_timer3 to the database.

This patch series is intended to make watchdog driver to use omap_hwmod APIs and PM runtime APIs. Driver modification to support more than one watchdog timers can be taken up as a separate activity later.

<<snip>>

Quoted 2 lines

Benoit

#9 lore raw

Re: [PATCH v5 4/6] OMAP4: hwmod data: Add watchdog timer

Hi Charu,

Quoted 36 lines · Charulatha
Quoted 11 lines

-----Original Message-----
From: Cousson, Benoit
Sent: Thursday, September 16, 2010 2:49 AM
To: Varadarajan, Charulatha
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Nayak, Rajendra; Basak, Partha; [email protected]
Subject: Re: [PATCH v5 4/6] OMAP4: hwmod data: Add watchdog timer

Quoted 10 lines

Hi Charu,

Quoted 7 lines · Charulatha

From: Benoit Cousson<[email protected]>

Add watchdog timer hwmod data for OMAP4 chip

---

<<snip>>

Quoted 12 lines

Review static __initdata struct omap_hwmod

Quoted 1 line
(quoted diff) +0 -0
@@ -472,6 +538,8 @@ static __initdata struct omap_hwmod

*omap44xx_hwmods[] = {

arch/arm/mach-omap2/omap_hwmod_44xx_data.c static __initdata struct omap_hwmod *omap44xx_hwmods[] = { · line 544

Quoted 7 lines
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +2 -0
   	/* mpu class */
   	&omap44xx_mpu_hwmod,
+	/* wd_timer class */
+	&omap44xx_wd_timer2_hwmod,
   	NULL,
   };

What about the wd_timer3? It is in the audio backend, and I'm not sure who will use it, but it does exist.

Quoted 5 lines

As you mentioned, wd_timer3 in OMAP4 is an IVA3 watchdog timer.

Also the current watchdog driver (omap_wdt.c) does not support more than one watchdog timer. To add this support we need to first redesign the driver code and then add wd_timer3 to the database.

This patch series is intended to make watchdog driver to use omap_hwmod APIs and PM runtime APIs. Driver modification to support more than one watchdog timers can be taken up as a separate activity later.

No necessarily, even if you do not manage this watchdog, we do need to expose its hwmod in order to allow dspbridge/syslink to potentially enable or disable it.

Maybe, it should be up to syslink people to do that then.
In that case, please add comment in the DB to explain that we do have other instances but they are not managed yet.

Thanks,
Benoit

#10 lore raw

RE: [PATCH v5 4/6] OMAP4: hwmod data: Add watchdog timer

Quoted 60 lines

-----Original Message-----
From: Cousson, Benoit
Sent: Friday, September 17, 2010 3:26 PM
To: Varadarajan, Charulatha
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Nayak, Rajendra; Basak, Partha; [email protected]
Subject: Re: [PATCH v5 4/6] OMAP4: hwmod data: Add watchdog timer

Hi Charu,

Quoted 36 lines · Charulatha
Quoted 11 lines

-----Original Message-----
From: Cousson, Benoit
Sent: Thursday, September 16, 2010 2:49 AM
To: Varadarajan, Charulatha
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Nayak, Rajendra; Basak, Partha; [email protected]
Subject: Re: [PATCH v5 4/6] OMAP4: hwmod data: Add watchdog timer

Quoted 10 lines

Hi Charu,

Quoted 7 lines · Charulatha

From: Benoit Cousson<[email protected]>

Add watchdog timer hwmod data for OMAP4 chip

---

<<snip>>

Quoted 12 lines

Review static __initdata struct omap_hwmod

Quoted 1 line
(quoted diff) +0 -0
@@ -472,6 +538,8 @@ static __initdata struct omap_hwmod

*omap44xx_hwmods[] = {

arch/arm/mach-omap2/omap_hwmod_44xx_data.c static __initdata struct omap_hwmod *omap44xx_hwmods[] = { · line 544

Quoted 7 lines
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +2 -0
   	/* mpu class */
   	&omap44xx_mpu_hwmod,
+	/* wd_timer class */
+	&omap44xx_wd_timer2_hwmod,
   	NULL,
   };

What about the wd_timer3? It is in the audio backend, and I'm not sure who will use it, but it does exist.

Quoted 3 lines

As you mentioned, wd_timer3 in OMAP4 is an IVA3 watchdog timer.

Also the current watchdog driver (omap_wdt.c) does not support more than

one watchdog timer. To add this support we need to first redesign the driver code and then add wd_timer3 to the database.

Quoted 2 lines

This patch series is intended to make watchdog driver to use omap_hwmod

APIs and PM runtime APIs. Driver modification to support more than one watchdog timers can be taken up as a separate activity later.

Quoted 7 lines

No necessarily, even if you do not manage this watchdog, we do need to expose its hwmod in order to allow dspbridge/syslink to potentially enable or disable it.

Maybe, it should be up to syslink people to do that then. In that case, please add comment in the DB to explain that we do have other instances but they are not managed yet.

Okay. Sure will do that.

Quoted 3 lines

Thanks,
Benoit

#11 lore raw

Re: [PATCH v5 4/6] OMAP4: hwmod data: Add watchdog timer

In reply to Cousson, Benoit
Quoted 41 lines · Benoit

Hi Charu,

Quoted 38 lines · Charulatha
Quoted 11 lines

-----Original Message-----
From: Cousson, Benoit
Sent: Thursday, September 16, 2010 2:49 AM
To: Varadarajan, Charulatha
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Nayak, Rajendra; Basak, Partha; [email protected]
Subject: Re: [PATCH v5 4/6] OMAP4: hwmod data: Add watchdog timer

Quoted 10 lines

Hi Charu,

Quoted 7 lines · Charulatha

From: Benoit Cousson<[email protected]>

Add watchdog timer hwmod data for OMAP4 chip

---

<<snip>>

Quoted 12 lines

Review static __initdata struct omap_hwmod

Quoted 1 line
(quoted diff) +0 -0
@@ -472,6 +538,8 @@ static __initdata struct omap_hwmod

*omap44xx_hwmods[] = {

arch/arm/mach-omap2/omap_hwmod_44xx_data.c static __initdata struct omap_hwmod *omap44xx_hwmods[] = { · line 544

Quoted 7 lines
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +2 -0
   	/* mpu class */
   	&omap44xx_mpu_hwmod,
+	/* wd_timer class */
+	&omap44xx_wd_timer2_hwmod,
   	NULL,
   };

What about the wd_timer3? It is in the audio backend, and I'm not sure who will use it, but it does exist.

As you mentioned, wd_timer3 in OMAP4 is an IVA3 watchdog timer.

Quoted 7 lines
Quoted 3 lines

Also the current watchdog driver (omap_wdt.c) does not support more than one watchdog timer. To add this support we need to first redesign the driver code and then add wd_timer3 to the database.

This patch series is intended to make watchdog driver to use omap_hwmod APIs and PM runtime APIs. Driver modification to support more than one watchdog timers can be taken up as a separate activity later.

No necessarily, even if you do not manage this watchdog, we do need to expose its hwmod in order to allow dspbridge/syslink to potentially enable or disable it.

We also should expose it in the hwmod db so that it is initialized and properly reset on init.

Later on bridge/syslink can initialize and use as desired.

Kevin

Quoted 6 lines

Maybe, it should be up to syslink people to do that then. In that case, please add comment in the DB to explain that we do have other instances but they are not managed yet.

Thanks,
Benoit

#12 lore raw

Re: [PATCH v5 4/6] OMAP4: hwmod data: Add watchdog timer

Quoted 45 lines · Kevin Hilman
Quoted 43 lines · Benoit

Hi Charu,

Quoted 40 lines · Charulatha
Quoted 11 lines

-----Original Message-----
From: Cousson, Benoit
Sent: Thursday, September 16, 2010 2:49 AM
To: Varadarajan, Charulatha
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Nayak, Rajendra; Basak, Partha; [email protected]
Subject: Re: [PATCH v5 4/6] OMAP4: hwmod data: Add watchdog timer

Quoted 10 lines

Hi Charu,

Quoted 7 lines · Charulatha

From: Benoit Cousson<[email protected]>

Add watchdog timer hwmod data for OMAP4 chip

---

<<snip>>

Quoted 12 lines

Review static __initdata struct omap_hwmod

Quoted 1 line
(quoted diff) +0 -0
@@ -472,6 +538,8 @@ static __initdata struct omap_hwmod

*omap44xx_hwmods[] = {

arch/arm/mach-omap2/omap_hwmod_44xx_data.c static __initdata struct omap_hwmod *omap44xx_hwmods[] = { · line 544

Quoted 7 lines
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +2 -0
    	/* mpu class */
    	&omap44xx_mpu_hwmod,
+	/* wd_timer class */
+	&omap44xx_wd_timer2_hwmod,
    	NULL,
    };

What about the wd_timer3? It is in the audio backend, and I'm not sure who will use it, but it does exist.

As you mentioned, wd_timer3 in OMAP4 is an IVA3 watchdog timer.

Also the current watchdog driver (omap_wdt.c) does not support more than one watchdog timer. To add this support we need to first redesign the driver code and then add wd_timer3 to the database.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

This patch series is intended to make watchdog driver to use omap_hwmod APIs and PM runtime APIs. Driver modification to support more than one watchdog timers can be taken up as a separate activity later.

No necessarily, even if you do not manage this watchdog, we do need to expose its hwmod in order to allow dspbridge/syslink to potentially enable or disable it.

We also should expose it in the hwmod db so that it is initialized and properly reset on init.

Correct, so you do recommend to expose most hwmods as soon as they are not crashing at boot? So far, the plan was to add only the ones validated with the drivers.

Benoit

Quoted 11 lines

Later on bridge/syslink can initialize and use as desired.

Kevin

Quoted 6 lines

Maybe, it should be up to syslink people to do that then. In that case, please add comment in the DB to explain that we do have other instances but they are not managed yet.

Thanks,
Benoit

#13 lore raw

Re: [PATCH v5 4/6] OMAP4: hwmod data: Add watchdog timer

"Cousson, Benoit" <[email protected]> writes:

[...]

Quoted 16 lines
Quoted 16 lines
Quoted 15 lines
Quoted 11 lines

As you mentioned, wd_timer3 in OMAP4 is an IVA3 watchdog timer.

Also the current watchdog driver (omap_wdt.c) does not support more than one watchdog timer. To add this support we need to first redesign the driver code and then add wd_timer3 to the database.

This patch series is intended to make watchdog driver to use omap_hwmod APIs and PM runtime APIs. Driver modification to support more than one watchdog timers can be taken up as a separate activity later.

No necessarily, even if you do not manage this watchdog, we do need to expose its hwmod in order to allow dspbridge/syslink to potentially enable or disable it.

Quoted 6 lines
Quoted 2 lines

We also should expose it in the hwmod db so that it is initialized and properly reset on init.

Correct, so you do recommend to expose most hwmods as soon as they are not crashing at boot? So far, the plan was to add only the ones validated with the drivers.

I think all hwmods for a given class should be posted at the same time.

If they are not validated with the driver, that is fine and the reason should be clearly stated in the changelog.

Kevin

#14 lore raw

Re: [PATCH v5 4/6] OMAP4: hwmod data: Add watchdog timer

In reply to Varadarajan, Charulatha
Quoted 10 lines · Charulatha

From: Benoit Cousson<[email protected]>

Add watchdog timer hwmod data for OMAP4 chip

---
This patch is extracted from the below patch sent by Benoit
OMAP4: hwmod: Add partial hwmod support for OMAP4430 ES1.0
https://patchwork.kernel.org/patch/99052/

Since that one, I sent a newer version:
OMAP4: hwmod: Add initial data for OMAP4430 ES1 & ES2
https://patchwork.kernel.org/patch/117347/

In fact the patch that really contains all the data is not there, probably because of its size :-(

Benoit

Quoted 90 lines
  arch/arm/mach-omap2/omap_hwmod_44xx_data.c |   68 ++++++++++++++++++++++++++++
  1 files changed, 68 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +68 -0
index e20b0ee..06851f7 100644
@@ -452,6 +452,72 @@ 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),
+};
+
  static __initdata struct omap_hwmod *omap44xx_hwmods[] = {
  	/* dmm class */
  	&omap44xx_dmm_hwmod,
@@ -472,6 +538,8 @@ static __initdata struct omap_hwmod *omap44xx_hwmods[] = {
 
  	/* mpu class */
  	&omap44xx_mpu_hwmod,
+	/* wd_timer class */
+	&omap44xx_wd_timer2_hwmod,
  	NULL,
  };
 
#15 lore raw

RE: [PATCH v5 4/6] OMAP4: hwmod data: Add watchdog timer

Quoted 23 lines

-----Original Message-----
From: Cousson, Benoit
Sent: Thursday, September 16, 2010 3:05 AM
To: Varadarajan, Charulatha
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Nayak, Rajendra; Basak, Partha; [email protected]
Subject: Re: [PATCH v5 4/6] OMAP4: hwmod data: Add watchdog timer

Quoted 10 lines · Charulatha

From: Benoit Cousson<[email protected]>

Add watchdog timer hwmod data for OMAP4 chip

---
This patch is extracted from the below patch sent by Benoit
OMAP4: hwmod: Add partial hwmod support for OMAP4430 ES1.0
https://patchwork.kernel.org/patch/99052/

Quoted 6 lines

Since that one, I sent a newer version:
OMAP4: hwmod: Add initial data for OMAP4430 ES1 & ES2
https://patchwork.kernel.org/patch/117347/

In fact the patch that really contains all the data is not there, probably because of its size :-(

Okay add this link also.

Quoted 4 lines

Benoit

Quoted 1 line
#16 lore raw

PATCH v5 5/6 OMAP2PLUS: WDT: use omap_device_build for device registration

In reply to Varadarajan, Charulatha

Use omap_device_build API instead of platform_device_register for watchdog timer device registration.

For OMAP2PLUS chips, the device specific data defined in centralized hwmod database will be used.

---
 arch/arm/plat-omap/devices.c |   64 ++++++++++++++++++++++++++++-------------
 1 files changed, 44 insertions(+), 20 deletions(-)
arch/arm/plat-omap/devices.c +44 -20
index d1920be..6885f4f 100644
@@ -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>
@@ -28,6 +29,8 @@
 #include <plat/menelaus.h>
 #include <plat/mcbsp.h>
 #include <plat/omap44xx.h>
+#include <plat/omap_hwmod.h>
+#include <plat/omap_device.h>
 
 /*-------------------------------------------------------------------------*/
 
@@ -236,37 +239,58 @@ static inline void omap_init_uwire(void) {}
 
 #if	defined(CONFIG_OMAP_WATCHDOG) || defined(CONFIG_OMAP_WATCHDOG_MODULE)
 
-static struct resource wdt_resources[] = {
+struct omap_device_pm_latency omap2_wdt_latency[] = {
+	[0] = {
+		.deactivate_func = omap_device_idle_hwmods,
+		.activate_func   = omap_device_enable_hwmods,
+		.flags		 = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
+	},
+};
+
+static void omap2_init_wdt(void)
+{
+	int id = -1;
+	struct omap_device *od;
+	struct omap_hwmod *oh;
+	char *oh_name = "wd_timer2";
+	char *name = "omap_wdt";
+
+	oh = omap_hwmod_lookup(oh_name);
+	if (!oh) {
+		pr_err("Could not look up %s\n", oh_name);
+		return;
+	}
+
+	od = omap_device_build(name, id, oh, NULL, 0,
+				omap2_wdt_latency,
+				ARRAY_SIZE(omap2_wdt_latency), 0);
+	WARN(IS_ERR(od), "Cant build omap_device for %s:%s.\n",
+				name, oh->name);
+	return;
+}
+
+static struct resource omap1_wdt_resources[] = {
 	{
+		.start		= 0xfffeb000,
+		.end		= 0xfffeb07F,
 		.flags		= IORESOURCE_MEM,
 	},
 };
 
-static struct platform_device omap_wdt_device = {
+static struct platform_device omap1_wdt_device = {
 	.name	   = "omap_wdt",
 	.id	     = -1,
-	.num_resources	= ARRAY_SIZE(wdt_resources),
-	.resource	= wdt_resources,
+	.num_resources	= ARRAY_SIZE(omap1_wdt_resources),
+	.resource	= omap1_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;
-
-	wdt_resources[0].end = wdt_resources[0].start + 0x4f;
-
-	(void) platform_device_register(&omap_wdt_device);
+	if (cpu_class_is_omap2())
+		omap2_init_wdt();
+	else if (cpu_is_omap16xx())
+		(void) platform_device_register(&omap1_wdt_device);
+	return;
 }
 #else
 static inline void omap_init_wdt(void) {}
Signature · 1 line
1.7.0.4
maintainer
#17 lore raw

Re: [PATCH v5 5/6] OMAP2PLUS: WDT: use omap_device_build for device registration

Quoted 5 lines · Varadarajan, Charulatha

Use omap_device_build API instead of platform_device_register for watchdog timer device registration.

For OMAP2PLUS chips, the device specific data defined in centralized hwmod database will be used.

<snip>

Quoted 16 lines

static void omap_init_wdt(void)
{

arch/arm/plat-omap/devices.c +0 -14
-	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;
-
-	wdt_resources[0].end = wdt_resources[0].start + 0x4f;

arch/arm/plat-omap/devices.c static inline void omap_init_uwire(void) {} · line 296

Quoted 10 lines
arch/arm/plat-omap/devices.c +5 -2
-
-	(void) platform_device_register(&omap_wdt_device);
+	if (cpu_class_is_omap2())
+		omap2_init_wdt();
+	else if (cpu_is_omap16xx())
+		(void) platform_device_register(&omap1_wdt_device);
+	return;
 }
 #else
 static inline void omap_init_wdt(void) {}

Please just split this into separate omap_init_wdt functions under mach-omap1 and mach-omap2. Then set them up with subsys_initcall and make sure you return early from the subsys_initcall if the platform is not the right one.

Tony

#18 lore raw

RE: [PATCH v5 5/6] OMAP2PLUS: WDT: use omap_device_build for device registration

Quoted 44 lines

-----Original Message-----
From: Tony Lindgren [mailto:[email protected]]
Sent: Wednesday, September 15, 2010 11:23 PM
To: Varadarajan, Charulatha
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Cousson, Benoit; Nayak, Rajendra; Basak, Partha; [email protected]
Subject: Re: [PATCH v5 5/6] OMAP2PLUS: WDT: use omap_device_build for device registration

Quoted 5 lines · Varadarajan, Charulatha

Use omap_device_build API instead of platform_device_register for watchdog timer device registration.

For OMAP2PLUS chips, the device specific data defined in centralized hwmod database will be used.

<snip>

Quoted 23 lines

static void omap_init_wdt(void)
{

arch/arm/plat-omap/devices.c +5 -16
-	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;
-
-	wdt_resources[0].end = wdt_resources[0].start + 0x4f;
-
-	(void) platform_device_register(&omap_wdt_device);
+	if (cpu_class_is_omap2())
+		omap2_init_wdt();
+	else if (cpu_is_omap16xx())
+		(void) platform_device_register(&omap1_wdt_device);
+	return;
Quoted 9 lines
Quoted 3 lines

}
#else
static inline void omap_init_wdt(void) {}

Please just split this into separate omap_init_wdt functions under mach-omap1 and mach-omap2. Then set them up with subsys_initcall and make sure you return early from the subsys_initcall if the platform is not the right one.

Okay.

Quoted 1 line

Tony

#19 lore raw

PATCH v5 6/6 OMAP: WDT: Use PM runtime APIs instead of clk FW APIs

In reply to Varadarajan, Charulatha

Call 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
index 76b58ab..dbbc580 100644
@@ -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
#20 lore raw

Re: [PATCH v5 6/6] OMAP: WDT: Use PM runtime APIs instead of clk FW APIs

Hi Wim,

Quoted 5 lines · Charulatha

Call 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.

With your ack, I'll be glad to merge this via the OMAP tree since it depends on the rest of the series for the OMAP platform specific changes.

Kevin

Quoted 117 lines
---
 drivers/watchdog/omap_wdt.c |   42 +++++++-----------------------------------
 1 files changed, 7 insertions(+), 35 deletions(-)
drivers/watchdog/omap_wdt.c +7 -35
index 76b58ab..dbbc580 100644
@@ -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);
maintainer
#21 lore raw

Re: [PATCH v5 6/6] OMAP: WDT: Use PM runtime APIs instead of clk FW APIs

Quoted 8 lines · Kevin Hilman

Hi Wim,

Quoted 4 lines · Charulatha

Call 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.

Quoted 5 lines
Quoted 1 line

With your ack, I'll be glad to merge this via the OMAP tree since it depends on the rest of the series for the OMAP platform specific changes.

Just checking.. The pm_runtime functions are implemented as clk_enable/disable functions for omap1, right?

Tony

#22 lore raw

Re: [PATCH v5 6/6] OMAP: WDT: Use PM runtime APIs instead of clk FW APIs

Quoted 9 lines · Tony Lindgren
Quoted 8 lines · Kevin Hilman

Hi Wim,

Quoted 4 lines · Charulatha

Call 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.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

With your ack, I'll be glad to merge this via the OMAP tree since it depends on the rest of the series for the OMAP platform specific changes.

Just checking.. The pm_runtime functions are implemented as clk_enable/disable functions for omap1, right?

Yes.

Kevin

#23 lore raw

Re: [PATCH v5 6/6] OMAP: WDT: Use PM runtime APIs instead of clk FW APIs

In reply to Varadarajan, Charulatha

Hi All,

Quoted 5 lines

Call 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.

This is all omap specific code. So if Kevin and Tony are fine with the code then tou gave my ACK also.

Kind regards,
WIm.

#24 lore raw

Re: [PATCH v5 6/6] OMAP: WDT: Use PM runtime APIs instead of clk FW APIs

In reply to Varadarajan, Charulatha
Quoted 15 lines · Charulatha

Call 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 +0 -0
index 76b58ab..dbbc580 100644
@@ -38,11 +38,11 @@
  #include<linux/err.h>

drivers/watchdog/omap_wdt.c line 47

Quoted 10 lines
drivers/watchdog/omap_wdt.c +1 -1
  #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>

Why do you have to access the PRCM from the driver?

Benoit

Quoted 97 lines
drivers/watchdog/omap_wdt.c +6 -34
@@ -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);
#25 lore raw

RE: [PATCH v5 6/6] OMAP: WDT: Use PM runtime APIs instead of clk FW APIs

Quoted 33 lines

-----Original Message-----
From: Cousson, Benoit
Sent: Thursday, September 16, 2010 3:11 AM
To: Varadarajan, Charulatha
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Nayak, Rajendra; Basak, Partha; [email protected]
Subject: Re: [PATCH v5 6/6] OMAP: WDT: Use PM runtime APIs instead of clk FW APIs

Quoted 7 lines · Charulatha

Call 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 +++++++----------------------------

-------

Quoted 12 lines
  1 files changed, 7 insertions(+), 35 deletions(-)
drivers/watchdog/omap_wdt.c +0 -1
index 76b58ab..dbbc580 100644
@@ -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>
Quoted 8 lines

drivers/watchdog/omap_wdt.c line 47

Quoted 6 lines
drivers/watchdog/omap_wdt.c +1 -0
  #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>

Why do you have to access the PRCM from the driver?

This has nothing to do with hwmod patch series.

The reason for using prcm header is to support GET_BOOT_STATUS ioctl which uses "omap_prcm_get_reset_sources()"

case WDIOC_GETBOOTSTATUS:

                if (cpu_is_omap16xx())
                        return put_user(__raw_readw(ARM_SYSST),
                                        (int __user *)arg);
                if (cpu_is_omap24xx())
                        return put_user(omap_prcm_get_reset_sources(),
                                        (int __user *)arg);

-V Charulatha

Quoted 106 lines

Benoit

drivers/watchdog/omap_wdt.c static int omap_wdt_open(struct inode *inode, struct

Quoted 11 lines
drivers/watchdog/omap_wdt.c +0 -2
@@ -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)

drivers/watchdog/omap_wdt.c static int omap_wdt_release(struct inode *inode,

Quoted 10 lines
drivers/watchdog/omap_wdt.c +1 -2
  	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)

drivers/watchdog/omap_wdt.c static int __devinit omap_wdt_probe(struct

Quoted 10 lines
drivers/watchdog/omap_wdt.c +1 -2
  	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)

drivers/watchdog/omap_wdt.c static int __devinit omap_wdt_probe(struct

Quoted 21 lines
drivers/watchdog/omap_wdt.c +1 -13
  	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)

drivers/watchdog/omap_wdt.c static int __devinit omap_wdt_probe(struct

Quoted 11 lines
drivers/watchdog/omap_wdt.c +2 -2
  	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)

drivers/watchdog/omap_wdt.c static int __devexit omap_wdt_remove(struct

Quoted 26 lines
drivers/watchdog/omap_wdt.c +1 -11
  		__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)

Quoted 8 lines
drivers/watchdog/omap_wdt.c +0 -2
  	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);
#26 lore raw

Re: [PATCH v5 6/6] OMAP: WDT: Use PM runtime APIs instead of clk FW APIs

Quoted 35 lines · Charulatha
Quoted 26 lines

From: Cousson, Benoit
Sent: Thursday, September 16, 2010 3:11 AM

Quoted 7 lines · Charulatha

Call 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 +++++++----------------------------

-------

Quoted 12 lines
   1 files changed, 7 insertions(+), 35 deletions(-)
drivers/watchdog/omap_wdt.c +0 -1
index 76b58ab..dbbc580 100644
@@ -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>
Quoted 8 lines

drivers/watchdog/omap_wdt.c line 47

Quoted 6 lines
drivers/watchdog/omap_wdt.c +1 -0
   #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>

Why do you have to access the PRCM from the driver?

Quoted 1 line

This has nothing to do with hwmod patch series.

Yes, I know, but since you removed some include, I was wondering if that one was still useful.

Quoted 2 lines

The reason for using prcm header is to support GET_BOOT_STATUS ioctl which uses "omap_prcm_get_reset_sources()"

Thanks,
Benoit