Skip to contentSkip to conversation

Add watchdog DT nodes and use syscon regmap interfac to configure pmu registers

PATCH Superseded Leela Krishna Amudala 4 participants 9 messages Nov 11, 2013 – Nov 12, 2013 3 messages not in the archive

Subsystems (3)

v7 of 12 Superseded Latest is v12 →

lore
Share & tools
lore
#0 lore raw

v7 cover Add watchdog DT nodes and use syscon regmap interfac to configure pmu registers

This patchset does the following things
- Adds pmusysreg device node to exynos5.dtsi file
- Adds watchdog DT nodes to Exynos5250 and 5420
- Uses syscon regmap interface to configure pmu registers to mask/unmask enable/disable of watchdog.

This patch set is rebased on Kgene's for-next branch and tested on SMDK5420

changes since V6:
- added SoC-specific compatible value to syscon node and documented it
- given more patch description for below patch
ARM: dts: update watchdog device nodes for Exynos5250 and Exynos5420
- added platform_device_id array for watchdog devices
- selected MFD_SYSCON in Kconfig entry for watchdog

Changes since V5:
- removed status property in DT nodes
- changed the return type for the function s3c2410wdt_mask_and_disable_reset() and handled error cases
- Handled to get driver data in non-DT cases
- Addressed comments given by Tomasz Figa <[email protected]>

Changes since V4:
- changed the node name from pmusysreg to syscon and node label from pmu_sys_reg to pmu_syscon
- changed the property name from samsung,pmusysreg to samsung,syscon-phandle
- used regmap_update_bits instead of remap_read/regmap_write
- Addressed other comments given by Tomasz Figa <[email protected]>

Changes since V3:
- changed the compatible strings for watchdog node
- splitted up adding pmusysreg node and made it separate patch
- Addressed comments given by Sachin Kamat <[email protected]>

Changes since V2:
- used syscon regmap interface to configure pmu registers in WDT driver (suggested by Tomasz Figa <[email protected]>)

Changes since V1:
- Added new compatible string for Exynos5 SoCs
- Introduced quirk mechanism to program PMU registers
- Addressed comments given by Tomasz Figa <[email protected]>

Leela Krishna Amudala (3):
ARM: dts: Add pmu sysreg node to exynos5250 and exynos5420 dtsi files
ARM: dts: update watchdog device nodes for Exynos5250 and Exynos5420
watchdog: s3c2410_wdt: add device tree support and use syscon
regmap interface to configure pmu register

 .../devicetree/bindings/arm/samsung/pmu.txt        |   13 ++
 .../devicetree/bindings/watchdog/samsung-wdt.txt   |   21 ++-
 arch/arm/boot/dts/exynos5.dtsi                     |    7 -
 arch/arm/boot/dts/exynos5250.dtsi                  |   11 +-
 arch/arm/boot/dts/exynos5420.dtsi                  |   14 ++
 drivers/watchdog/Kconfig                           |    1 +
 drivers/watchdog/s3c2410_wdt.c                     |  154 +++++++++++++++++++-
 7 files changed, 204 insertions(+), 17 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/samsung/pmu.txt
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH v7 1/3 ARM: dts: Add pmu sysreg node to exynos5250 and exynos5420 dtsi files

This patch adds pmusysreg node to exynos5250 and exynos5420 dtsi files to handle PMU register accesses in a centralized way using syscon driver

---
 Documentation/devicetree/bindings/arm/samsung/pmu.txt |   13 +++++++++++++
 arch/arm/boot/dts/exynos5250.dtsi                     |    5 +++++
 arch/arm/boot/dts/exynos5420.dtsi                     |    5 +++++
 3 files changed, 23 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/samsung/pmu.txt
Documentation/devicetree/bindings/arm/samsung/pmu.txt new file +13 -0
new file mode 100644
index 0000000..90f975d
@@ -0,0 +1,13 @@
+SAMSUNG Exynos SoC series PMU Registers
+
+Properties:
+ - name : should be 'syscon';
+ - compatible : should contain "samsung,<chip name>-pmu", "syscon";
+   For Exynos5250 SoC it should be "samsung,exynos5250-pmu", "syscon";
+ - reg : offset and length of the register set.
+
+Example :
+pmu_syscon: syscon@10040000 {
+	compatible = "samsung,exynos5250-pmu", "syscon";
+	reg = <0x10040000 0x5000>;
+};
arch/arm/boot/dts/exynos5250.dtsi +5 -0
index c4a8662..6056a83 100644
@@ -158,6 +158,11 @@
 		interrupts = <0 47 0>;
 	};
 
+	pmu_syscon: syscon@10040000 {
+		compatible = "samsung,exynos5250-pmu", "syscon";
+		reg = <0x10040000 0x5000>;
+	};
+
 	watchdog {
 		clocks = <&clock 336>;
 		clock-names = "watchdog";
arch/arm/boot/dts/exynos5420.dtsi +5 -0
index 6ffefd1..39ce15a 100644
@@ -369,4 +369,9 @@
 		clock-names = "gscl";
 		samsung,power-domain = <&gsc_pd>;
 	};
+
+	pmu_syscon: syscon@10040000 {
+		compatible = "samsung,exynos5420-pmu", "syscon";
+		reg = <0x10040000 0x5000>;
+	};
 };
Signature · 1 line
1.7.10.4

A message that is not in the archive (sent off-list or not yet received): 1384173897-16106-2-git-send-email-l.krishna-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org

Reviewed-by
#3 lore raw

Re: [PATCH V7 1/3] ARM: dts: Add pmu sysreg node to exynos5250 and exynos5420 dtsi files

Hi Leela,

Quoted 10 lines · On Monday 11 of November 2013 18:14:55 Leela Krishna Amudala wrote:

This patch adds pmusysreg node to exynos5250 and exynos5420 dtsi files to handle PMU register accesses in a centralized way using syscon driver

---
 Documentation/devicetree/bindings/arm/samsung/pmu.txt |   13 +++++++++++++
 arch/arm/boot/dts/exynos5250.dtsi                     |    5 +++++
 arch/arm/boot/dts/exynos5420.dtsi                     |    5 +++++
 3 files changed, 23 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/samsung/pmu.txt

Best regards,
Tomasz

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1384173897-16106-1-git-send-email-l.krishna-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org

#5 lore raw

PATCH v7 2/3 ARM: dts: update watchdog device nodes for Exynos5250 and Exynos5420

In Exynos5 series SoCs, PMU has registers to enable/disable mask/unmask watchdog timer which is not the case with s3c series SoCs so, there is a need to have different compatible names for watchdog to handle these pmu registers access.

Hence this patch removes watchdog node from Exynos5.dtsi common file and make it separate by updating existing node in Exynos5250 and adding new node to Exynos5420. This patch also makes the watchdog node enabled by default

---
 arch/arm/boot/dts/exynos5.dtsi    |    7 -------
 arch/arm/boot/dts/exynos5250.dtsi |    6 +++++-
 arch/arm/boot/dts/exynos5420.dtsi |    9 +++++++++
 3 files changed, 14 insertions(+), 8 deletions(-)
arch/arm/boot/dts/exynos5.dtsi +0 -7
index e52b038..f1fea28 100644
@@ -81,13 +81,6 @@
 		status = "disabled";
 	};
 
-	watchdog {
-		compatible = "samsung,s3c2410-wdt";
-		reg = <0x101D0000 0x100>;
-		interrupts = <0 42 0>;
-		status = "disabled";
-	};
-
 	fimd@14400000 {
 		compatible = "samsung,exynos5250-fimd";
 		interrupt-parent = <&combiner>;
arch/arm/boot/dts/exynos5250.dtsi +5 -1
index 6056a83..69f6c6a 100644
@@ -163,9 +163,13 @@
 		reg = <0x10040000 0x5000>;
 	};
 
-	watchdog {
+	watchdog@101D0000 {
+		compatible = "samsung,exynos5250-wdt";
+		reg = <0x101D0000 0x100>;
+		interrupts = <0 42 0>;
 		clocks = <&clock 336>;
 		clock-names = "watchdog";
+		samsung,syscon-phandle = <&pmu_syscon>;
 	};
 
 	g2d@10850000 {
arch/arm/boot/dts/exynos5420.dtsi +9 -0
index 39ce15a..61764bb 100644
@@ -374,4 +374,13 @@
 		compatible = "samsung,exynos5420-pmu", "syscon";
 		reg = <0x10040000 0x5000>;
 	};
+
+        watchdog@101D0000 {
+		compatible = "samsung,exynos5420-wdt";
+		reg = <0x101D0000 0x100>;
+		interrupts = <0 42 0>;
+		clocks = <&clock 316>;
+		clock-names = "watchdog";
+		samsung,syscon-phandle = <&pmu_syscon>;
+        };
 };
Signature · 1 line
1.7.10.4

A message that is not in the archive (sent off-list or not yet received): 1384173897-16106-3-git-send-email-l.krishna-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org

Reviewed-by
#7 lore raw

Re: [PATCH V7 2/3] ARM: dts: update watchdog device nodes for Exynos5250 and Exynos5420

Hi Leela,

Quoted 9 lines · On Monday 11 of November 2013 18:14:56 Leela Krishna Amudala wrote:

In Exynos5 series SoCs, PMU has registers to enable/disable mask/unmask watchdog timer which is not the case with s3c series SoCs so, there is a need to have different compatible names for watchdog to handle these pmu registers access.

Hence this patch removes watchdog node from Exynos5.dtsi common file and make it separate by updating existing node in Exynos5250 and adding new node to Exynos5420. This patch also makes the watchdog node enabled by default

Quoted 6 lines
---
 arch/arm/boot/dts/exynos5.dtsi    |    7 -------
 arch/arm/boot/dts/exynos5250.dtsi |    6 +++++-
 arch/arm/boot/dts/exynos5420.dtsi |    9 +++++++++
 3 files changed, 14 insertions(+), 8 deletions(-)

This patch should go as the last in this series, because otherwise it would change DTS files to use compatible values that are not yet supported.

The patch itself is fine, so

Best regards,
Tomasz

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#8 lore raw

Re: [PATCH V7 2/3] ARM: dts: update watchdog device nodes for Exynos5250 and Exynos5420

Hi Tomasz,

Quoted 19 lines · Tomasz Figa

Hi Leela,

Quoted 9 lines · On Monday 11 of November 2013 18:14:56 Leela Krishna Amudala wrote:

In Exynos5 series SoCs, PMU has registers to enable/disable mask/unmask watchdog timer which is not the case with s3c series SoCs so, there is a need to have different compatible names for watchdog to handle these pmu registers access.

Hence this patch removes watchdog node from Exynos5.dtsi common file and make it separate by updating existing node in Exynos5250 and adding new node to Exynos5420. This patch also makes the watchdog node enabled by default

Quoted 6 lines
---
 arch/arm/boot/dts/exynos5.dtsi    |    7 -------
 arch/arm/boot/dts/exynos5250.dtsi |    6 +++++-
 arch/arm/boot/dts/exynos5420.dtsi |    9 +++++++++
 3 files changed, 14 insertions(+), 8 deletions(-)
Quoted 4 lines

This patch should go as the last in this series, because otherwise it would change DTS files to use compatible values that are not yet supported.

Okay, will make it as last patch in the series

Best Wishes,
Leela Krishna

Quoted 11 lines

The patch itself is fine, so

Best regards,
Tomasz

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#9 lore raw

PATCH v7 3/3 watchdog: s3c2410_wdt: add device tree support and use syscon regmap interface to configure pmu register

In reply to Leela Krishna Amudala

Add device tree support and use syscon regmap interface to configure AUTOMATIC_WDT_RESET_DISABLE and MASK_WDT_RESET_REQUEST registers of PMU to mask/unmask enable/disable of watchdog in probe and s2r scenarios.

---
 .../devicetree/bindings/watchdog/samsung-wdt.txt   |   21 ++-
 drivers/watchdog/Kconfig                           |    1 +
 drivers/watchdog/s3c2410_wdt.c                     |  154 +++++++++++++++++++-
 3 files changed, 167 insertions(+), 9 deletions(-)
Documentation/devicetree/bindings/watchdog/samsung-wdt.txt +20 -1
index 2aa486c..5dea363 100644
@@ -5,10 +5,29 @@ after a preset amount of time during which the WDT reset event has not
 occurred.
 
 Required properties:
-- compatible : should be "samsung,s3c2410-wdt"
+- compatible : should be one among the following
+	(a) "samsung,s3c2410-wdt" for Exynos4 and previous SoCs
+	(b) "samsung,exynos5250-wdt" for Exynos5250
+	(c) "samsung,exynos5420-wdt" for Exynos5420
+
 - reg : base physical address of the controller and length of memory mapped
 	region.
 - interrupts : interrupt number to the cpu.
+- samsung,syscon-phandle : reference to syscon node (This property required only
+	in case of compatible being "samsung,exynos5250-wdt" or "samsung,exynos5420-wdt".
+	In case of Exynos5250 and 5420 this property points to syscon node holding the PMU
+	base address)
 
 Optional properties:
 - timeout-sec : contains the watchdog timeout in seconds.
+
+Example:
+
+watchdog@101D0000 {
+	compatible = "samsung,exynos5250-wdt";
+	reg = <0x101D0000 0x100>;
+	interrupts = <0 42 0>;
+	clocks = <&clock 336>;
+	clock-names = "watchdog";
+	samsung,syscon-phandle = <&pmu_sys_reg>;
+};
drivers/watchdog/Kconfig +1 -0
index d1d53f3..0d272ae 100644
@@ -188,6 +188,7 @@ config S3C2410_WATCHDOG
 	tristate "S3C2410 Watchdog"
 	depends on HAVE_S3C2410_WATCHDOG
 	select WATCHDOG_CORE
+	select MFD_SYSCON if ARCH_EXYNOS5
 	help
 	  Watchdog timer block in the Samsung SoCs. This will reboot
 	  the system when the timer expires with the watchdog enabled.
drivers/watchdog/s3c2410_wdt.c +146 -8

254 lines not on this page · raw message

Signature · 1 line
1.7.10.4
#10 lore raw

Re: [PATCH V7 3/3] watchdog: s3c2410_wdt: add device tree support and use syscon regmap interface to configure pmu register

Hi Leela,

Thanks for addressing my comments for previous version. However now this won't even build when CONFIG_OF is disabled. See my comments inline.

Quoted 10 lines · On Monday 11 of November 2013 18:14:57 Leela Krishna Amudala wrote:

Add device tree support and use syscon regmap interface to configure AUTOMATIC_WDT_RESET_DISABLE and MASK_WDT_RESET_REQUEST registers of PMU to mask/unmask enable/disable of watchdog in probe and s2r scenarios.

---
 .../devicetree/bindings/watchdog/samsung-wdt.txt   |   21 ++-
 drivers/watchdog/Kconfig                           |    1 +
 drivers/watchdog/s3c2410_wdt.c                     |  154 +++++++++++++++++++-
 3 files changed, 167 insertions(+), 9 deletions(-)

[snip]

Quoted 4 lines
drivers/watchdog/s3c2410_wdt.c +0 -0
index 23aad7c..b57ccae 100644

[snip]

Quoted 16 lines
drivers/watchdog/s3c2410_wdt.c +12 -0
@@ -94,8 +107,56 @@ struct s3c2410_wdt {
 	unsigned long		wtdat_save;
 	struct watchdog_device	wdt_device;
 	struct notifier_block	freq_transition;
+	struct s3c2410_wdt_variant *pmu_config;
+	struct regmap *pmureg;
+};
+
+#ifdef CONFIG_OF
+static const struct s3c2410_wdt_variant pmu_config_s3c2410 = {
+	.quirks = 0
+};
+
+static const struct s3c2410_wdt_variant pmu_config_5250  = {
+	.disable_reg = WDT_DISABLE_REG_OFFSET,
+	.mask_reset_reg = WDT_MASK_RESET_REG_OFFSET,

drivers/watchdog/s3c2410_wdt.c struct s3c2410_wdt { · line 131

Quoted 10 lines
drivers/watchdog/s3c2410_wdt.c +8 -0
+	.mask_bit = 20,
+	.quirks = QUIRK_NEEDS_PMU_CONFIG
 };
 
+static const struct s3c2410_wdt_variant pmu_config_5420 = {
+	.disable_reg = WDT_DISABLE_REG_OFFSET,
+	.mask_reset_reg = WDT_MASK_RESET_REG_OFFSET,
+	.mask_bit = 0,
+	.quirks = QUIRK_NEEDS_PMU_CONFIG
+};

The three variant data structs above are under #ifdef CONFIG_OF, while they are always needed for the platform match table.

However, since Exynos supports only DT-based device instantation, I would move only the basic pmu_config_s3c2410 out of the ifdef and limit the platform match table only to this single variant.

Quoted 4 lines
drivers/watchdog/s3c2410_wdt.c +4 -0
+
+static const struct of_device_id s3c2410_wdt_match[] = {
+	{ .compatible = "samsung,s3c2410-wdt",
+	  .data = &pmu_config_s3c2410 },

drivers/watchdog/s3c2410_wdt.c struct s3c2410_wdt { · line 145

Quoted 10 lines
drivers/watchdog/s3c2410_wdt.c +10 -0
+	{ .compatible = "samsung,exynos5250-wdt",
+	  .data = &pmu_config_5250 },
+	{ .compatible = "samsung,exynos5420-wdt",
+	  .data = &pmu_config_5420 },
+	{},
+};
+MODULE_DEVICE_TABLE(of, s3c2410_wdt_match);
+#endif
+
+static const struct platform_device_id s3c_wdt_driver_ids[] = {

nit: For consistency with other names in this file, what about calling this s3c2410_wdt_ids[] instead?

drivers/watchdog/s3c2410_wdt.c struct s3c2410_wdt { · line 155

Quoted 10 lines
drivers/watchdog/s3c2410_wdt.c +10 -0
+	{
+		.name = "s3c2410-wdt",
+		.driver_data = (unsigned long)&pmu_config_s3c2410,
+	}, {
+		.name = "exynos5250-wdt",
+		.driver_data = (unsigned long)&pmu_config_5250,
+	}, {
+		.name = "exynos5420-wdt",
+		.driver_data = (unsigned long)&pmu_config_5420,
+	},

So, generally, you don't need the two Exynos variants above in this array.

Otherwise, the patch is fine.

Best regards,
Tomasz

#11 lore raw

Re: [PATCH V7 3/3] watchdog: s3c2410_wdt: add device tree support and use syscon regmap interface to configure pmu register

Hi Tomasz,

Thanks for reviewing the patch

Quoted 5 lines · Tomasz Figa

Hi Leela,

Thanks for addressing my comments for previous version. However now this won't even build when CONFIG_OF is disabled. See my comments inline.

Yes, you are right, I didn't compile it disabling CONFIG_OF

Quoted 47 lines · On Monday 11 of November 2013 18:14:57 Leela Krishna Amudala wrote:
Quoted 10 lines

Add device tree support and use syscon regmap interface to configure AUTOMATIC_WDT_RESET_DISABLE and MASK_WDT_RESET_REQUEST registers of PMU to mask/unmask enable/disable of watchdog in probe and s2r scenarios.

---
 .../devicetree/bindings/watchdog/samsung-wdt.txt   |   21 ++-
 drivers/watchdog/Kconfig                           |    1 +
 drivers/watchdog/s3c2410_wdt.c                     |  154 +++++++++++++++++++-
 3 files changed, 167 insertions(+), 9 deletions(-)

[snip]

Quoted 4 lines
drivers/watchdog/s3c2410_wdt.c +0 -0
index 23aad7c..b57ccae 100644

[snip]

Quoted 16 lines
drivers/watchdog/s3c2410_wdt.c +12 -0
@@ -94,8 +107,56 @@ struct s3c2410_wdt {
      unsigned long           wtdat_save;
      struct watchdog_device  wdt_device;
      struct notifier_block   freq_transition;
+     struct s3c2410_wdt_variant *pmu_config;
+     struct regmap *pmureg;
+};
+
+#ifdef CONFIG_OF
+static const struct s3c2410_wdt_variant pmu_config_s3c2410 = {
+     .quirks = 0
+};
+
+static const struct s3c2410_wdt_variant pmu_config_5250  = {
+     .disable_reg = WDT_DISABLE_REG_OFFSET,
+     .mask_reset_reg = WDT_MASK_RESET_REG_OFFSET,

drivers/watchdog/s3c2410_wdt.c struct s3c2410_wdt { · line 131

Quoted 10 lines
drivers/watchdog/s3c2410_wdt.c +8 -0
+     .mask_bit = 20,
+     .quirks = QUIRK_NEEDS_PMU_CONFIG
 };
 
+static const struct s3c2410_wdt_variant pmu_config_5420 = {
+     .disable_reg = WDT_DISABLE_REG_OFFSET,
+     .mask_reset_reg = WDT_MASK_RESET_REG_OFFSET,
+     .mask_bit = 0,
+     .quirks = QUIRK_NEEDS_PMU_CONFIG
+};

The three variant data structs above are under #ifdef CONFIG_OF, while they are always needed for the platform match table.

Quoted 4 lines

However, since Exynos supports only DT-based device instantation, I would move only the basic pmu_config_s3c2410 out of the ifdef and limit the platform match table only to this single variant.

Okay, Taken care

Quoted 9 lines
Quoted 9 lines
drivers/watchdog/s3c2410_wdt.c +9 -0
+
+static const struct of_device_id s3c2410_wdt_match[] = {
+     { .compatible = "samsung,s3c2410-wdt",
+       .data = &pmu_config_s3c2410 },
+     { .compatible = "samsung,exynos5250-wdt",
+       .data = &pmu_config_5250 },
+     { .compatible = "samsung,exynos5420-wdt",
+       .data = &pmu_config_5420 },
+     {},
Quoted 9 lines

drivers/watchdog/s3c2410_wdt.c struct s3c2410_wdt { · line 145

Quoted 5 lines
drivers/watchdog/s3c2410_wdt.c +5 -0
+};
+MODULE_DEVICE_TABLE(of, s3c2410_wdt_match);
+#endif
+
+static const struct platform_device_id s3c_wdt_driver_ids[] = {

nit: For consistency with other names in this file, what about calling this s3c2410_wdt_ids[] instead?

Okay, modified

Quoted 11 lines

drivers/watchdog/s3c2410_wdt.c struct s3c2410_wdt { · line 155

Quoted 10 lines
drivers/watchdog/s3c2410_wdt.c +10 -0
+     {
+             .name = "s3c2410-wdt",
+             .driver_data = (unsigned long)&pmu_config_s3c2410,
+     }, {
+             .name = "exynos5250-wdt",
+             .driver_data = (unsigned long)&pmu_config_5250,
+     }, {
+             .name = "exynos5420-wdt",
+             .driver_data = (unsigned long)&pmu_config_5420,
+     },
Quoted 2 lines

So, generally, you don't need the two Exynos variants above in this array.

Yes, removed from the array

Best Wishes,
Leela Krishna

Quoted 9 lines

Otherwise, the patch is fine.

Best regards,
Tomasz

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html