ARM: davinci: turn off DDR PHY when entering deep sleep
Subsystems (10)
PATCH 1/1 ARM: davinci: turn off DDR PHY when entering deep sleep
Deepsleep is the most power saving state on the davinci-platform. The DDR PHY consumes about 25mW and should be turned off in this low power state.
--- arch/arm/mach-davinci/include/mach/memory.h | 2 ++ arch/arm/mach-davinci/sleep.S | 10 ++++++++++ 2 files changed, 12 insertions(+), 0 deletions(-)
arch/arm/mach-davinci/include/mach/memory.h +2 -0
@@ -36,6 +36,8 @@#define DDR2_MCLKSTOPEN_BIT BIT(30)#define DDR2_LPMODEN_BIT BIT(31) +#define DDR2_DRPHYC1R_OFFSET 0xe4 +#define DDR_PWRDNEN_BIT BIT(6)/* * Increase size of DMA-consistent memory region */
arch/arm/mach-davinci/sleep.S +10 -0
@@ -57,6 +57,11 @@ ENTRY(davinci_cpu_suspend) ldmia r0, {r0-r4} + /* Turn PHY off */ + ldr ip, [r0, #DDR2_DRPHYC1R_OFFSET] + orr ip, ip, #DDR_PWRDNEN_BIT + str ip, [r0, #DDR2_DRPHYC1R_OFFSET] + /* * Switch DDR to self-refresh mode. */
@@ -171,6 +176,11 @@ ENTRY(davinci_cpu_suspend) bic ip, ip, #DDR2_LPMODEN_BIT str ip, [r0, #DDR2_SDRCR_OFFSET] + /* Turn PHY on */ + ldr ip, [r0, #DDR2_DRPHYC1R_OFFSET] + bic ip, ip, #DDR_PWRDNEN_BIT + str ip, [r0, #DDR2_DRPHYC1R_OFFSET] + /* Restore registers and return */ ldmfd sp!, {r0-r12, pc}
Signature · 1 line
1.7.5.4
Hi Marcus,
Thanks for the patch.
arch/arm/mach-davinci/include/mach/memory.h
Quoted 14 lines · Marcus Folkesson
Deepsleep is the most power saving state on the davinci-platform. The DDR PHY consumes about 25mW and should be turned off in this low power state.
Signed-off-by Marcus Folkesson <[email protected]>--- arch/arm/mach-davinci/include/mach/memory.h | 2 ++ arch/arm/mach-davinci/sleep.S | 10 ++++++++++ 2 files changed, 12 insertions(+), 0 deletions(-)arch/arm/mach-davinci/include/mach/memory.h +0
-0
This is moved to arch/arm/mach-davinci/include/mach/ddr2.h in current kernel.
Quoted 14 lines
arch/arm/mach-davinci/include/mach/memory.h +2
-0@@ -36,6 +36,8 @@#define DDR2_MCLKSTOPEN_BIT BIT(30)#define DDR2_LPMODEN_BIT BIT(31) +#define DDR2_DRPHYC1R_OFFSET 0xe4 +#define DDR_PWRDNEN_BIT BIT(6)/* * Increase size of DMA-consistent memory region */ arch/arm/mach-davinci/sleep.S +0
-0
arch/arm/mach-davinci/sleep.S ENTRY(davinci_cpu_suspend) · line 63
Quoted 7 lines
arch/arm/mach-davinci/sleep.S +4
-0@@ -57,6 +57,11 @@ ENTRY(davinci_cpu_suspend) ldmia r0, {r0-r4} + /* Turn PHY off */ + ldr ip, [r0, #DDR2_DRPHYC1R_OFFSET] + orr ip, ip, #DDR_PWRDNEN_BIT + str ip, [r0, #DDR2_DRPHYC1R_OFFSET]
Current TRM (section 14.2.13.1) specifies that this bit be set during DDR initialization sequence itself (done in UBL or U-Boot/SPL). I am checking with folks from the TI design team on whether it can be done later on as part of the DeepSleep sequence.
It looks like IOPWRDN bit in VTPIO_CTL also needs to be set for this configuration take effect. You probably did not have to do it because the bootloader you are using already has this set?
How much testing has this patch undergone? Have you tested it across multiple suspend-resume cycles? How much does the power consumed by DDR PHY go down by (and which type of DDR)?
Thanks,
Sekhar
Hi Sekhar,
2012/5/21 Sekhar Nori <[email protected]>:
Quoted 50 lines
Hi Marcus,
Thanks for the patch.
arch/arm/mach-davinci/include/mach/memory.h
Quoted 14 lines · Marcus Folkesson
Deepsleep is the most power saving state on the davinci-platform. The DDR PHY consumes about 25mW and should be turned off in this low power state.
Signed-off-by Marcus Folkesson <[email protected]>---
?arch/arm/mach-davinci/include/mach/memory.h | ? ?2 ++ ?arch/arm/mach-davinci/sleep.S ? ? ? ? ? ? ? | ? 10 ++++++++++ ?2 files changed, 12 insertions(+), 0 deletions(-)arch/arm/mach-davinci/include/mach/memory.h +0
-0This is moved to
arch/arm/mach-davinci/include/mach/ddr2.hin current kernel.Quoted 14 lines
arch/arm/mach-davinci/include/mach/memory.h +2
-0@@ -36,6 +36,8 @@ ?#define DDR2_MCLKSTOPEN_BIT ?BIT(30) ?#define DDR2_LPMODEN_BIT ? ? BIT(31) +#define DDR2_DRPHYC1R_OFFSET ? ? ? ? 0xe4 +#define DDR_PWRDNEN_BIT ? ? ? ? ? ? ?BIT(6)?/*
? * Increase size of DMA-consistent memory region
? */arch/arm/mach-davinci/sleep.S +0
-0arch/arm/mach-davinci/sleep.S ENTRY(davinci_cpu_suspend) · line 63
Quoted 7 lines
arch/arm/mach-davinci/sleep.S +4
-0@@ -57,6 +57,11 @@ ENTRY(davinci_cpu_suspend) ? ? ? ldmia ? r0, {r0-r4} + ? ? /* Turn PHY off */ + ? ? ldr ? ? ip, [r0, #DDR2_DRPHYC1R_OFFSET] + ? ? orr ? ? ip, ip, #DDR_PWRDNEN_BIT + ? ? str ? ? ip, [r0, #DDR2_DRPHYC1R_OFFSET]Current TRM (section 14.2.13.1) specifies that this bit be set during DDR initialization sequence itself (done in UBL or U-Boot/SPL). I am checking with folks from the TI design team on whether it can be done later on as part of the DeepSleep sequence.
Quoted 7 lines
It looks like IOPWRDN bit in
VTPIO_CTLalso needs to be set for this configuration take effect. You probably did not have to do it because the bootloader you are using already has this set?How much testing has this patch undergone? Have you tested it across multiple suspend-resume cycles? How much does the power consumed by DDR PHY go down by (and which type of DDR)?
You are right.
I now see that it is possible to set all those bits in the bootloader and let the PHY automatically go down in idle.
This patch is therefore unnecessary.
Thank you all for the attention!
Best regards
Marcus Folkesson
Hi Marcus,
Quoted 26 lines · Marcus Folkesson
Quoted 18 lines
arch/arm/mach-davinci/sleep.S ENTRY(davinci_cpu_suspend) · line 63
Quoted 12 lines
arch/arm/mach-davinci/sleep.S +4
-0@@ -57,6 +57,11 @@ ENTRY(davinci_cpu_suspend) ldmia r0, {r0-r4} + /* Turn PHY off */ + ldr ip, [r0, #DDR2_DRPHYC1R_OFFSET] + orr ip, ip, #DDR_PWRDNEN_BIT + str ip, [r0, #DDR2_DRPHYC1R_OFFSET]Current TRM (section 14.2.13.1) specifies that this bit be set during DDR initialization sequence itself (done in UBL or U-Boot/SPL). I am checking with folks from the TI design team on whether it can be done later on as part of the DeepSleep sequence.
Quoted 7 lines
It looks like IOPWRDN bit in
VTPIO_CTLalso needs to be set for this configuration take effect. You probably did not have to do it because the bootloader you are using already has this set?How much testing has this patch undergone? Have you tested it across multiple suspend-resume cycles? How much does the power consumed by DDR PHY go down by (and which type of DDR)?
Quoted 5 lines
You are right.
I now see that it is possible to set all those bits in the bootloader and let the PHY automatically go down in idle.
This patch is therefore unnecessary.
It will be great if you can check if the current U-Boot/SPL for AM18x sets these bits as part of the DDR initialization and if not, submit a patch to U-Boot list for that?
BTW, I am yet to hear from the designers on whether this can be done outside of DDR initialization step. If they confirm this can be done, it will be useful to take this patch in to minimize the bootloader dependency.
Thanks,
Sekhar
cover watchdog: make use of timeout-secs
All these drivers is using watchdog_init_timeout() to set timeout. If the timeout-parameter is set to an valid value, it will allways pick that and not even consider if timeout-secs is set in the devicetree.
Most of the patches will just remove the initial value for timeout-parameter.
Some of the drivers allready has documented device-tree-bindings for timeout-secs (but will not work), add property for those which not.
I wrote a similiar (tested) patch for imx2 and simply did the same to these drivers. These patches is *NOT* tested, so please review extra carefully.
Taken from Documentation/watchdog/watchdog-kernel-api.txt:
The watchdog_init_timeout function allows you to initialize the timeout field using the module timeout parameter or by retrieving the timeout-sec property from the device tree (if the module timeout parameter is invalid). Best practice is to set the default timeout value as timeout value in the watchdog_device and then use this function to set the user "preferred" timeout value.
Best regards
Marcus Folkesson
PATCH 1/7 watchdog: sama5d4: make use of timeout-secs provided in devicetree
watchdog_init_timeout() will allways pick timeout_param since it defaults to a valid timeout.
Following best practice described in Documentation/watchdog/watchdog-kernel-api.txt to make use of the parameter logic.
--- drivers/watchdog/sama5d4_wdt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/watchdog/sama5d4_wdt.c +2 -2
@@ -33,7 +33,7 @@ struct sama5d4_wdt {unsigned long last_ping; }; -static int wdt_timeout =WDT_DEFAULT_TIMEOUT ; +static int wdt_timeout;static bool nowayout =WATCHDOG_NOWAYOUT ;module_param (wdt_timeout, int,0 );
@@ -212,7 +212,7 @@ static int sama5d4_wdt_probe(struct platform_device *pdev)return -ENOMEM ; wdd = &wdt->wdd; - wdd->timeout = wdt_timeout; + wdd->timeout =WDT_DEFAULT_TIMEOUT ; wdd->info = &sama5d4_wdt_info; wdd->ops = &sama5d4_wdt_ops; wdd->min_timeout =MIN_WDT_TIMEOUT ;
Signature · 1 line
2.15.1
PATCH 2/7 watchdog: sunxi: allow setting timeout in devicetree
In reply to Marcus Folkessonwatchdog_init_timeout() will allways pick timeout_param since it defaults to a valid timeout.
By following best practice described in Documentation/watchdog/watchdog-kernel-api.txt, it also let us to set timout-sec property in devicetree.
--- Documentation/devicetree/bindings/watchdog/sunxi-wdt.txt | 4 ++++ drivers/watchdog/sunxi_wdt.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/watchdog/sunxi-wdt.txt +4 -0
@@ -6,9 +6,13 @@ Required properties: "allwinner,sun6i-a31-wdt" - reg : Specifies base physical address and size of the registers. +Optional properties: +- timeout-sec : Contains the watchdog timeout in seconds + Example: wdt: watchdog at 1c20c90 { compatible = "allwinner,sun4i-a10-wdt"; reg = <0x01c20c90 0x10>; + timeout-sec = <10>; };
drivers/watchdog/sunxi_wdt.c +1 -1
@@ -39,7 +39,7 @@#define DRV_VERSION "1.0"static bool nowayout =WATCHDOG_NOWAYOUT ; -static unsigned int timeout =WDT_MAX_TIMEOUT ; +static unsigned int timeout;/* * This structure stores the register offsets for different variants
Signature · 1 line
2.15.1
PATCH 3/7 watchdog: sirfsoc: allow setting timeout in devicetree
In reply to Marcus Folkessonwatchdog_init_timeout() will allways pick timeout_param since it defaults to a valid timeout.
By following best practice described in Documentation/watchdog/watchdog-kernel-api.txt, it also let us to set timout-sec property in devicetree.
--- Documentation/devicetree/bindings/watchdog/sirfsoc_wdt.txt | 4 ++++ drivers/watchdog/sirfsoc_wdt.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/watchdog/sirfsoc_wdt.txt +4 -0
@@ -5,10 +5,14 @@ Required properties: - reg: Address range of tick timer/WDT register set - interrupts: interrupt number to the cpu +Optional properties: +- timeout-sec : Contains the watchdog timeout in seconds + Example: timer at b0020000 { compatible = "sirf,prima2-tick"; reg = <0xb0020000 0x1000>; interrupts = <0>; + timeout-sec = <30>; };
drivers/watchdog/sirfsoc_wdt.c +1 -1
@@ -29,7 +29,7 @@#define SIRFSOC_WDT_MAX_TIMEOUT (10 * 60)/* 10 mins */ #define SIRFSOC_WDT_DEFAULT_TIMEOUT 30/* 30 secs */ -static unsigned int timeout =SIRFSOC_WDT_DEFAULT_TIMEOUT ; +static unsigned int timeout;static bool nowayout =WATCHDOG_NOWAYOUT ;module_param (timeout, uint,0 );
Signature · 1 line
2.15.1
PATCH 4/7 watchdog: pnx4008: make use of timeout-secs provided in devicetree
In reply to Marcus Folkessonwatchdog_init_timeout() will allways pick timeout_param since it defaults to a valid timeout.
Following best practice described in Documentation/watchdog/watchdog-kernel-api.txt to make use of the parameter logic.
--- drivers/watchdog/pnx4008_wdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/watchdog/pnx4008_wdt.c +1 -1
@@ -78,7 +78,7 @@#define WDOG_COUNTER_RATE 13000000/*the counter clock is 13 MHz fixed */ static bool nowayout =WATCHDOG_NOWAYOUT ; -static unsigned int heartbeat =DEFAULT_HEARTBEAT ; +static unsigned int heartbeat;static DEFINE_SPINLOCK (io_lock);static void __iomem *wdt_base;
Signature · 1 line
2.15.1
PATCH 5/7 watchdog: mtk: allow setting timeout in devicetree
In reply to Marcus Folkessonwatchdog_init_timeout() will allways pick timeout_param since it defaults to a valid timeout.
By following best practice described in Documentation/watchdog/watchdog-kernel-api.txt, it also let us to set timout-sec property in devicetree.
--- Documentation/devicetree/bindings/watchdog/mtk-wdt.txt | 4 ++++ drivers/watchdog/mtk_wdt.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/watchdog/mtk-wdt.txt +4 -0
@@ -11,9 +11,13 @@ Required properties: - reg : Specifies base physical address and size of the registers. +Optional properties: +- timeout-sec: contains the watchdog timeout in seconds. + Example: wdt: watchdog at 10000000 { compatible = "mediatek,mt6589-wdt"; reg = <0x10000000 0x18>; + timeout-sec = <10>; };
drivers/watchdog/mtk_wdt.c +1 -1
@@ -57,7 +57,7 @@#define DRV_VERSION "1.0"static bool nowayout =WATCHDOG_NOWAYOUT ; -static unsigned int timeout =WDT_MAX_TIMEOUT ; +static unsigned int timeout;struct mtk_wdt_dev {struct watchdog_device wdt_dev;
Signature · 1 line
2.15.1
PATCH 6/7 watchdog: meson: allow setting timeout in devicetree
In reply to Marcus Folkessonwatchdog_init_timeout() will allways pick timeout_param since it defaults to a valid timeout.
By following best practice described in Documentation/watchdog/watchdog-kernel-api.txt, it also let us to set timout-sec property in devicetree.
--- Documentation/devicetree/bindings/watchdog/meson-wdt.txt | 4 ++++ drivers/watchdog/meson_wdt.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/watchdog/meson-wdt.txt +4 -0
@@ -9,9 +9,13 @@ Required properties: "amlogic,meson8m2-wdt" and "amlogic,meson8b-wdt" on Meson8m2 SoCs - reg : Specifies base physical address and size of the registers. +Optional properties: +- timeout-sec: contains the watchdog timeout in seconds. + Example: wdt: watchdog at c1109900 { compatible = "amlogic,meson6-wdt"; reg = <0xc1109900 0x8>; + timeout-sec = <10>; };
drivers/watchdog/meson_wdt.c +1 -1
@@ -36,7 +36,7 @@#define MESON_SEC_TO_TC (s, c) ((s) * (c))static bool nowayout =WATCHDOG_NOWAYOUT ; -static unsigned int timeout =MESON_WDT_TIMEOUT ; +static unsigned int timeout;struct meson_wdt_data {unsigned int enable;
Signature · 1 line
2.15.1
PATCH 7/7 watchdog: coh901327: make use of timeout-secs provided in devicetree
In reply to Marcus Folkessonwatchdog_init_timeout() will allways pick timeout_param since it defaults to a valid timeout.
Following best practice described in Documentation/watchdog/watchdog-kernel-api.txt to make use of the parameter logic.
--- drivers/watchdog/coh901327_wdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/watchdog/coh901327_wdt.c +1 -1
@@ -67,7 +67,7 @@#define U300_WDOG_IFR_WILL_BARK_IRQ_FORCE_ENABLE 0x0001U/* Default timeout in seconds = 1 minute */ -static unsigned int margin =60 ; +static unsigned int margin;static int irq;static void __iomem *virtbase;static struct device *parent;
Signature · 1 line
2.15.1
Re: [PATCH 1/7] watchdog: sama5d4: make use of timeout-secs provided in devicetree
In reply to Marcus FolkessonThe summary email did not make it for some reason.
However.
All these drivers is using watchdog_init_timeout() to set timeout. If the timeout-parameter is set to an valid value, it will allways pick that and not even consider if timeout-secs is set in devicetree.
Most of the patches will just remove the initial value for timeout-parameter.
Some of the drivers allready has documented device-tree-bindings for timeout-secs (but will not work), add property for those which not.
I wrote a similiar (tested) patch for imx2 and simply did the same to these drivers. These patches is *NOT* tested, so please review extra carefully.
Taken from Documentation/watchdog/watchdog-kernel-api.txt:
The watchdog_init_timeout function allows you to initialize the timeout field using the module timeout parameter or by retrieving the timeout-sec property from the device tree (if the module timeout parameter is invalid). Best practice is to set the default timeout value as timeout value in the watchdog_device and then use this function to set the user "preferred" timeout value.
Best regards
Marcus Folkesson
Re: [PATCH 1/7] watchdog: sama5d4: make use of timeout-secs provided in devicetree
In reply to Marcus FolkessonQuoted 8 lines · Marcus Folkesson
watchdog_init_timeout()will allways picktimeout_paramsince it defaults to a valid timeout.Following best practice described in
Documentation/watchdog/watchdog-kernel-api.txtto make use of the parameter logic.Signed-off-by Marcus Folkesson <[email protected]>
Quoted 29 lines
--- drivers/watchdog/sama5d4_wdt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/watchdog/sama5d4_wdt.c +2
-2@@ -33,7 +33,7 @@ struct sama5d4_wdt {unsigned long last_ping; }; -static int wdt_timeout =WDT_DEFAULT_TIMEOUT ; +static int wdt_timeout;static bool nowayout =WATCHDOG_NOWAYOUT ;module_param (wdt_timeout, int,0 );@@ -212,7 +212,7 @@ static int sama5d4_wdt_probe(struct platform_device *pdev)return -ENOMEM ; wdd = &wdt->wdd; - wdd->timeout = wdt_timeout; + wdd->timeout =WDT_DEFAULT_TIMEOUT ; wdd->info = &sama5d4_wdt_info; wdd->ops = &sama5d4_wdt_ops; wdd->min_timeout =MIN_WDT_TIMEOUT ;Signature · 1 line
2.15.1
Re: [PATCH 2/7] watchdog: sunxi: allow setting timeout in devicetree
In reply to Marcus FolkessonQuoted 8 lines · Marcus Folkesson
watchdog_init_timeout()will allways picktimeout_paramsince it defaults to a valid timeout.By following best practice described in
Documentation/watchdog/watchdog-kernel-api.txt, it also let us to set timout-sec property in devicetree.Signed-off-by Marcus Folkesson <[email protected]>
Quoted 39 lines
--- Documentation/devicetree/bindings/watchdog/sunxi-wdt.txt | 4 ++++ drivers/watchdog/sunxi_wdt.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-)Documentation/devicetree/bindings/watchdog/sunxi-wdt.txt +4
-0@@ -6,9 +6,13 @@ Required properties: "allwinner,sun6i-a31-wdt" - reg : Specifies base physical address and size of the registers. +Optional properties: +- timeout-sec : Contains the watchdog timeout in seconds + Example: wdt: watchdog at 1c20c90 { compatible = "allwinner,sun4i-a10-wdt"; reg = <0x01c20c90 0x10>; + timeout-sec = <10>; };drivers/watchdog/sunxi_wdt.c +1
-1@@ -39,7 +39,7 @@#define DRV_VERSION "1.0"static bool nowayout =WATCHDOG_NOWAYOUT ; -static unsigned int timeout =WDT_MAX_TIMEOUT ; +static unsigned int timeout;/* * This structure stores the register offsets for different variants Signature · 1 line
2.15.1
Re: [PATCH 3/7] watchdog: sirfsoc: allow setting timeout in devicetree
In reply to Marcus FolkessonQuoted 8 lines · Marcus Folkesson
watchdog_init_timeout()will allways picktimeout_paramsince it defaults to a valid timeout.By following best practice described in
Documentation/watchdog/watchdog-kernel-api.txt, it also let us to set timout-sec property in devicetree.Signed-off-by Marcus Folkesson <[email protected]>
Quoted 40 lines
--- Documentation/devicetree/bindings/watchdog/sirfsoc_wdt.txt | 4 ++++ drivers/watchdog/sirfsoc_wdt.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-)Documentation/devicetree/bindings/watchdog/sirfsoc_wdt.txt +4
-0@@ -5,10 +5,14 @@ Required properties: - reg: Address range of tick timer/WDT register set - interrupts: interrupt number to the cpu +Optional properties: +- timeout-sec : Contains the watchdog timeout in seconds + Example: timer at b0020000 { compatible = "sirf,prima2-tick"; reg = <0xb0020000 0x1000>; interrupts = <0>; + timeout-sec = <30>; };drivers/watchdog/sirfsoc_wdt.c +1
-1@@ -29,7 +29,7 @@#define SIRFSOC_WDT_MAX_TIMEOUT (10 * 60)/* 10 mins */ #define SIRFSOC_WDT_DEFAULT_TIMEOUT 30/* 30 secs */ -static unsigned int timeout =SIRFSOC_WDT_DEFAULT_TIMEOUT ; +static unsigned int timeout;static bool nowayout =WATCHDOG_NOWAYOUT ;module_param (timeout, uint,0 );Signature · 1 line
2.15.1
Re: [PATCH 4/7] watchdog: pnx4008: make use of timeout-secs provided in devicetree
In reply to Marcus FolkessonQuoted 8 lines · Marcus Folkesson
watchdog_init_timeout()will allways picktimeout_paramsince it defaults to a valid timeout.Following best practice described in
Documentation/watchdog/watchdog-kernel-api.txtto make use of the parameter logic.Signed-off-by Marcus Folkesson <[email protected]>
Quoted 20 lines
--- drivers/watchdog/pnx4008_wdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/watchdog/pnx4008_wdt.c +1
-1@@ -78,7 +78,7 @@#define WDOG_COUNTER_RATE 13000000/*the counter clock is 13 MHz fixed */ static bool nowayout =WATCHDOG_NOWAYOUT ; -static unsigned int heartbeat =DEFAULT_HEARTBEAT ; +static unsigned int heartbeat;static DEFINE_SPINLOCK (io_lock);static void __iomem *wdt_base;Signature · 1 line
2.15.1
Re: [PATCH 4/7] watchdog: pnx4008: make use of timeout-secs provided in devicetree
In reply to Marcus FolkessonQuoted 8 lines · Marcus Folkesson
watchdog_init_timeout()will allways picktimeout_paramsince it defaults to a valid timeout.Following best practice described in
Documentation/watchdog/watchdog-kernel-api.txtto make use of the parameter logic.Signed-off-by Marcus Folkesson <[email protected]>
Quoted 20 lines
--- drivers/watchdog/pnx4008_wdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/watchdog/pnx4008_wdt.c +1
-1@@ -78,7 +78,7 @@#define WDOG_COUNTER_RATE 13000000/*the counter clock is 13 MHz fixed */ static bool nowayout =WATCHDOG_NOWAYOUT ; -static unsigned int heartbeat =DEFAULT_HEARTBEAT ; +static unsigned int heartbeat;static DEFINE_SPINLOCK (io_lock);static void __iomem *wdt_base;Signature · 1 line
2.15.1
Re: [PATCH 5/7] watchdog: mtk: allow setting timeout in devicetree
In reply to Marcus FolkessonQuoted 8 lines · Marcus Folkesson
watchdog_init_timeout()will allways picktimeout_paramsince it defaults to a valid timeout.By following best practice described in
Documentation/watchdog/watchdog-kernel-api.txt, it also let us to set timout-sec property in devicetree.Signed-off-by Marcus Folkesson <[email protected]>
Quoted 39 lines
--- Documentation/devicetree/bindings/watchdog/mtk-wdt.txt | 4 ++++ drivers/watchdog/mtk_wdt.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-)Documentation/devicetree/bindings/watchdog/mtk-wdt.txt +4
-0@@ -11,9 +11,13 @@ Required properties: - reg : Specifies base physical address and size of the registers. +Optional properties: +- timeout-sec: contains the watchdog timeout in seconds. + Example: wdt: watchdog at 10000000 { compatible = "mediatek,mt6589-wdt"; reg = <0x10000000 0x18>; + timeout-sec = <10>; };drivers/watchdog/mtk_wdt.c +1
-1@@ -57,7 +57,7 @@#define DRV_VERSION "1.0"static bool nowayout =WATCHDOG_NOWAYOUT ; -static unsigned int timeout =WDT_MAX_TIMEOUT ; +static unsigned int timeout;struct mtk_wdt_dev {struct watchdog_device wdt_dev;Signature · 1 line
2.15.1
Re: [PATCH 6/7] watchdog: meson: allow setting timeout in devicetree
In reply to Marcus FolkessonQuoted 8 lines · Marcus Folkesson
watchdog_init_timeout()will allways picktimeout_paramsince it defaults to a valid timeout.By following best practice described in
Documentation/watchdog/watchdog-kernel-api.txt, it also let us to set timout-sec property in devicetree.Signed-off-by Marcus Folkesson <[email protected]>
Quoted 39 lines
--- Documentation/devicetree/bindings/watchdog/meson-wdt.txt | 4 ++++ drivers/watchdog/meson_wdt.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-)Documentation/devicetree/bindings/watchdog/meson-wdt.txt +4
-0@@ -9,9 +9,13 @@ Required properties: "amlogic,meson8m2-wdt" and "amlogic,meson8b-wdt" on Meson8m2 SoCs - reg : Specifies base physical address and size of the registers. +Optional properties: +- timeout-sec: contains the watchdog timeout in seconds. + Example: wdt: watchdog at c1109900 { compatible = "amlogic,meson6-wdt"; reg = <0xc1109900 0x8>; + timeout-sec = <10>; };drivers/watchdog/meson_wdt.c +1
-1@@ -36,7 +36,7 @@#define MESON_SEC_TO_TC (s, c) ((s) * (c))static bool nowayout =WATCHDOG_NOWAYOUT ; -static unsigned int timeout =MESON_WDT_TIMEOUT ; +static unsigned int timeout;struct meson_wdt_data {unsigned int enable;Signature · 1 line
2.15.1
Guenter Roeck
maintainerRe: [PATCH 7/7] watchdog: coh901327: make use of timeout-secs provided in devicetree
In reply to Marcus FolkessonQuoted 17 lines · Marcus Folkesson
watchdog_init_timeout()will allways picktimeout_paramsince it defaults to a valid timeout.Following best practice described in
Documentation/watchdog/watchdog-kernel-api.txtto make use of the parameter logic.Signed-off-by Marcus Folkesson <[email protected]>--- drivers/watchdog/coh901327_wdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/watchdog/coh901327_wdt.c +0
-0
drivers/watchdog/coh901327_wdt.c line 73
Quoted 8 lines
drivers/watchdog/coh901327_wdt.c +1
-1@@ -67,7 +67,7 @@#define U300_WDOG_IFR_WILL_BARK_IRQ_FORCE_ENABLE 0x0001U/* Default timeout in seconds = 1 minute */ -static unsigned int margin =60 ; +static unsigned int margin;static int irq;static void __iomem *virtbase;static struct device *parent;
I would suggest to initialize .timeout in 'static struct watchdog_device coh901327_wdt', and drop the error check when calling watchdog_init_timeout().
Guenter
Re: [PATCH 6/7] watchdog: meson: allow setting timeout in devicetree
In reply to Guenter RoeckHi Guenter,
Quoted 11 lines · Guenter Roeck
Quoted 8 lines · Marcus Folkesson
watchdog_init_timeout()will allways picktimeout_paramsince it defaults to a valid timeout.By following best practice described in
Documentation/watchdog/watchdog-kernel-api.txt, it also let us to set timout-sec property in devicetree.Signed-off-by Marcus Folkesson <[email protected]>Reviewed-by Guenetr Roeck <[email protected]>
^
A small typo in your name
Quoted 39 lines
Quoted 39 lines
--- Documentation/devicetree/bindings/watchdog/meson-wdt.txt | 4 ++++ drivers/watchdog/meson_wdt.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-)Documentation/devicetree/bindings/watchdog/meson-wdt.txt +4
-0@@ -9,9 +9,13 @@ Required properties: "amlogic,meson8m2-wdt" and "amlogic,meson8b-wdt" on Meson8m2 SoCs - reg : Specifies base physical address and size of the registers. +Optional properties: +- timeout-sec: contains the watchdog timeout in seconds. + Example: wdt: watchdog at c1109900 { compatible = "amlogic,meson6-wdt"; reg = <0xc1109900 0x8>; + timeout-sec = <10>; };drivers/watchdog/meson_wdt.c +1
-1@@ -36,7 +36,7 @@#define MESON_SEC_TO_TC (s, c) ((s) * (c))static bool nowayout =WATCHDOG_NOWAYOUT ; -static unsigned int timeout =MESON_WDT_TIMEOUT ; +static unsigned int timeout;struct meson_wdt_data {unsigned int enable;Signature · 1 line
2.15.1
Signature · 3 lines
Alexandre Belloni, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering http://bootlin.com
Guenter Roeck
maintainerRe: [PATCH 6/7] watchdog: meson: allow setting timeout in devicetree
Quoted 11 lines · Alexandre Belloni
Hi Guenter,
Quoted 8 lines · Guenter Roeck
Quoted 7 lines · Marcus Folkesson
watchdog_init_timeout()will allways picktimeout_paramsince it defaults to a valid timeout.By following best practice described in
Documentation/watchdog/watchdog-kernel-api.txt, it also let us to set timout-sec property in devicetree.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Marcus Folkesson <[email protected]>Reviewed-by Guenetr Roeck <[email protected]>^A small typo in your name
Mr. Fat Fingers At Work :-)
Guenter
Re: [PATCH 7/7] watchdog: coh901327: make use of timeout-secs provided in devicetree
In reply to Guenter RoeckHi,
Quoted 20 lines · Guenter Roeck
Quoted 19 lines · Marcus Folkesson
watchdog_init_timeout()will allways picktimeout_paramsince it defaults to a valid timeout.Following best practice described in
Documentation/watchdog/watchdog-kernel-api.txtto make use of the parameter logic.Signed-off-by Marcus Folkesson <[email protected]>--- drivers/watchdog/coh901327_wdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/watchdog/coh901327_wdt.c +0
-0@@ -67,7 +67,7 @@#define U300_WDOG_IFR_WILL_BARK_IRQ_FORCE_ENABLE 0x0001U
Quoted 9 lines
drivers/watchdog/coh901327_wdt.c line 73
Quoted 6 lines
drivers/watchdog/coh901327_wdt.c +1
-1/* Default timeout in seconds = 1 minute */ -static unsigned int margin =60 ; +static unsigned int margin;static int irq;static void __iomem *virtbase;static struct device *parent;I would suggest to initialize .timeout in 'static struct
watchdog_devicecoh901327_wdt', and drop the error check when callingwatchdog_init_timeout().
Will do, thank you.
Quoted 2 lines
Guenter
Best regards
Marcus Folkesson
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-amlogic/attachments/20180210/13b40f3d/attachment.sig>
Guenter Roeck
maintainerRe: [1/7] watchdog: sama5d4: make use of timeout-secs provided in devicetree
In reply to Marcus FolkessonQuoted 9 lines · Marcus Folkesson
watchdog_init_timeout()will allways picktimeout_paramsince it defaults to a valid timeout.Following best practice described in
Documentation/watchdog/watchdog-kernel-api.txtto make use of the parameter logic.Signed-off-by Marcus Folkesson <[email protected]>Reviewed-by Guenter Roeck <[email protected]>
Unfortunately I'll have to withdraw the Reviewed-by:. wdt_timeout is used at the end of the probe function to display the selected timeout. This will have to be changed to display the actual timeout.
Guenter
Quoted 26 lines
--- drivers/watchdog/sama5d4_wdt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/watchdog/sama5d4_wdt.c +2
-2@@ -33,7 +33,7 @@ struct sama5d4_wdt {unsigned long last_ping; }; -static int wdt_timeout =WDT_DEFAULT_TIMEOUT ; +static int wdt_timeout;static bool nowayout =WATCHDOG_NOWAYOUT ;module_param (wdt_timeout, int,0 );@@ -212,7 +212,7 @@ static int sama5d4_wdt_probe(struct platform_device *pdev)return -ENOMEM ; wdd = &wdt->wdd; - wdd->timeout = wdt_timeout; + wdd->timeout =WDT_DEFAULT_TIMEOUT ; wdd->info = &sama5d4_wdt_info; wdd->ops = &sama5d4_wdt_ops; wdd->min_timeout =MIN_WDT_TIMEOUT ;