Add watchdog DT nodes and use syscon regmap interfac to configure pmu registers
Subsystems (3)
v6 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 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 Exynos5 dtsi file
ARM: dts: add watchdog device nodes for Exynos5250 and Exynos5420
watchdog: s3c2410_wdt: use syscon regmap interface to configure pmu
register
.../devicetree/bindings/watchdog/samsung-wdt.txt | 21 ++- arch/arm/boot/dts/exynos5.dtsi | 12 +- arch/arm/boot/dts/exynos5250.dtsi | 6 +- arch/arm/boot/dts/exynos5420.dtsi | 9 ++ drivers/watchdog/s3c2410_wdt.c | 139 ++++++++++++++++++-- 5 files changed, 170 insertions(+), 17 deletions(-)
Signature · 1 line
1.7.10.4
PATCH v6 1/3 ARM: dts: Add pmu sysreg node to Exynos5 dtsi file
This patch adds pmusysreg node to Exynos5 dtsi file to handle PMU register accesses in a centralized way using syscon driver
--- arch/arm/boot/dts/exynos5.dtsi | 5 +++++ 1 file changed, 5 insertions(+)
arch/arm/boot/dts/exynos5.dtsi +5 -0
@@ -106,4 +106,9 @@ #size-cells = <0>; status = "disabled"; }; + + pmu_syscon: syscon@10040000 { + compatible = "syscon"; + reg = <0x10040000 0x5000>; + }; };
Signature · 1 line
1.7.10.4
Re: [PATCH V6 1/3] ARM: dts: Add pmu sysreg node to Exynos5 dtsi file
Hi Leela,
Quoted 15 lines · On Thursday 07 of November 2013 17:21:16 Leela Krishna Amudala wrote:
This patch adds pmusysreg node to Exynos5 dtsi file to handle PMU register accesses in a centralized way using syscon driver
Signed-off-by Leela Krishna Amudala <[email protected]>Reviewed-by Tomasz Figa <[email protected]>--- arch/arm/boot/dts/exynos5.dtsi | 5 +++++ 1 file changed, 5 insertions(+)arch/arm/boot/dts/exynos5.dtsi +0
-0
arch/arm/boot/dts/exynos5.dtsi line 114
Quoted 9 lines
arch/arm/boot/dts/exynos5.dtsi +5
-0@@ -106,4 +106,9 @@ #size-cells = <0>; status = "disabled"; }; + + pmu_syscon: syscon@10040000 { + compatible = "syscon"; + reg = <0x10040000 0x5000>; + }; };
Just to be safe, I would also add some SoC-specific compatible value to this node. My proposal is "samsung,exynos5250-pmu" for the PMU of Exynos5250 (unless all Exynos 5 SoCs really have identical set of PMU registers, but based on your patch to WDT driver, I don't think so) and put the node in dtsi of particular SoC.
We already have a PMU driver in arch/arm/mach-exynos and we should rather allow it to bind to some device tree node and access the registers it needs when we finally stop mapping PMU registers statically.
You should also document such binding somewhere. IMHO [1] would be a good place for it.
[1] - Documentation/devicetree/bindings/arm/samsung/pmu.txt
Best regards,
Tomasz
PATCH v6 2/3 ARM: dts: add watchdog device nodes for Exynos5250 and Exynos5420
In reply to Leela Krishna AmudalaAdds watchdog device nodes to the DT device list for Exynos5250 and Exynos5420
--- 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
@@ -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
@@ -158,9 +158,13 @@ interrupts = <0 47 0>; }; - 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
@@ -369,4 +369,13 @@ clock-names = "gscl"; samsung,power-domain = <&gsc_pd>; }; + + 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
Re: [PATCH V6 2/3] ARM: dts: add watchdog device nodes for Exynos5250 and Exynos5420
Hi Leela,
Quoted 1 line · On Thursday 07 of November 2013 17:21:17 Leela Krishna Amudala wrote:
Adds watchdog device nodes to the DT device list for Exynos5250 and Exynos5420
s/add/update/ since there was already a device tree node in exynos5.dtsi.
Also, patch description should mention all the changes done in the patch and I see more changes than described by your description. This patch also makes the watchdog node enabled by default.
Otherwise the patch looks good.
Best regards,
Tomasz
PATCH v6 3/3 watchdog: s3c2410_wdt: use syscon regmap interface to configure pmu register
In reply to Leela Krishna AmudalaThe syscon regmap interface is used 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/s3c2410_wdt.c | 139 ++++++++++++++++++-- 2 files changed, 151 insertions(+), 9 deletions(-)
Documentation/devicetree/bindings/watchdog/samsung-wdt.txt +20 -1
@@ -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/s3c2410_wdt.c +131 -8
234 lines not on this page · raw message
Signature · 1 line
1.7.10.4
Re: [PATCH V6 3/3] watchdog: s3c2410_wdt: use syscon regmap interface to configure pmu register
Hi Leela,
Quoted 9 lines · On Thursday 07 of November 2013 17:21:18 Leela Krishna Amudala wrote:
The syscon regmap interface is used to configure
AUTOMATIC_WDT_RESET_DISABLEandMASK_WDT_RESET_REQUESTregisters of PMU to mask/unmask enable/disable of watchdog in probe and s2r scenarios.Signed-off-by Leela Krishna Amudala <[email protected]>--- .../devicetree/bindings/watchdog/samsung-wdt.txt | 21 ++- drivers/watchdog/s3c2410_wdt.c | 139 ++++++++++++++++++-- 2 files changed, 151 insertions(+), 9 deletions(-)
[snip]
Quoted 4 lines
drivers/watchdog/s3c2410_wdt.c +0
-0
[snip]
drivers/watchdog/s3c2410_wdt.c static inline void s3c2410wdt_cpufreq_deregister(struct s3c2410_wdt *wdt) · line 417
Quoted 13 lines
drivers/watchdog/s3c2410_wdt.c +13
-0+/* s3c2410_get_wdt_driver_data */ +static inline struct s3c2410_wdt_variant * +get_wdt_drv_data (struct platform_device *pdev) +{ +#ifdef CONFIG_OF +if (pdev->dev.of_node) { +const struct of_device_id *match; + match =of_match_node (s3c2410_wdt_match, pdev->dev.of_node); +return (struct s3c2410_wdt_variant *)match->data; + } +#endif +return (struct s3c2410_wdt_variant *) +platform_get_device_id (pdev)->driver_data;
This code calls platform_get_device_id(), but I don't see any array of platform_device_id in this driver. This will always crash on a NULL pointer dereference whenever booted on a platform using board files.
Also, as this driver is now using syscon API, its Kconfig entry should select MFD_SYSCON.
Other than that, the patch looks fine.
Best regards,
Tomasz