wdt: Update uclass to make clear that the timeout is in ms
PATCH v2 1/1 wdt: Update uclass to make clear that the timeout is in ms
From: Andy Shevchenko <[email protected]>
Convert name to show explicitly that we are using milliseconds. For a watchdog timer this is precise enough.
No functional change intended.
---
Changes in v2:
- Use milliseconds since microseconds seems too fine a control
- Update commit message to suit
drivers/watchdog/wdt-uclass.c | 4 ++-- include/wdt.h | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/watchdog/wdt-uclass.c +2 -2
@@ -13,14 +13,14 @@DECLARE_GLOBAL_DATA_PTR ; -int wdt_start (struct udevice *dev,u64 timeout,ulong flags) +int wdt_start (struct udevice *dev,u64 timeout_ms,ulong flags) {const struct wdt_ops *ops =device_get_ops (dev);if (!ops->start)return -ENOSYS ; -return ops->start (dev, timeout, flags); +return ops->start (dev, timeout_ms, flags); }int wdt_stop (struct udevice *dev)
include/wdt.h +4 -4
@@ -21,12 +21,12 @@* Start the timer * * @dev: WDT Device -* @timeout: Number of ticks before timer expires +* @timeout_ms: Number of ticks (milliseconds) before timer expires * @flags: Driver specific flags. This might be used to specify * which action needs to be executed when the timer expires * @return: 0 if OK, -ve on error */ -int wdt_start (struct udevice *dev,u64 timeout,ulong flags); +int wdt_start (struct udevice *dev,u64 timeout_ms,ulong flags);/* * Stop the timer, thus disabling the Watchdog. Use wdt_start to start it again.
@@ -67,12 +67,12 @@ struct wdt_ops {* Start the timer * * @dev: WDT Device -* @timeout: Number of ticks before the timer expires +* @timeout_ms: Number of ticks (milliseconds) before the timer expires * @flags: Driver specific flags. This might be used to specify * which action needs to be executed when the timer expires * @return: 0 if OK, -ve on error */ -int (*start)(struct udevice *dev,u64 timeout,ulong flags); +int (*start)(struct udevice *dev,u64 timeout_ms,ulong flags);/* * Stop the timer *
Signature · 1 line
2.14.0.rc1.383.gd1ce394fe2-goog
PATCH v2 1/1 wdt: Update uclass to make clear that the timeout is in ms
Quoted 48 lines · Simon Glass
From: Andy Shevchenko <[email protected]>
Convert name to show explicitly that we are using milliseconds. For a watchdog timer this is precise enough.
No functional change intended.
Signed-off-by Andy Shevchenko <[email protected]>Signed-off-by Simon Glass <[email protected]>---
Changes in v2:
- Use milliseconds since microseconds seems too fine a control
- Update commit message to suit
drivers/watchdog/wdt-uclass.c| 4 ++--include/wdt.h| 8 ++++----2 files changed, 6 insertions(+), 6 deletions(-)drivers/watchdog/wdt-uclass.c +2
-2@@ -13,14 +13,14 @@DECLARE_GLOBAL_DATA_PTR ; -int wdt_start (struct udevice *dev,u64 timeout,ulong flags) +int wdt_start (struct udevice *dev,u64 timeout_ms,ulong flags) {const struct wdt_ops *ops =device_get_ops (dev);if (!ops->start)return -ENOSYS ; -return ops->start (dev, timeout, flags); +return ops->start (dev, timeout_ms, flags); }int wdt_stop (struct udevice *dev)include/wdt.h +0
-0
include/wdt.h line 24
Quoted 5 lines
include/wdt.h +1
-1@@ -21,12 +21,12 @@* Start the timer * * @dev: WDT Device -* @timeout: Number of ticks before timer expires +* @timeout_ms: Number of ticks (milliseconds) before timer expires
Should this not just be ‘number of milliseconds’ (as this would otherwise equate ticks and milliseconds, which don’t necessarily need to be the same)?
Quoted 10 lines
include/wdt.h +1
-1* @flags: Driver specific flags. This might be used to specify * which action needs to be executed when the timer expires * @return: 0 if OK, -ve on error */ -int wdt_start (struct udevice *dev,u64 timeout,ulong flags); +int wdt_start (struct udevice *dev,u64 timeout_ms,ulong flags);/* * Stop the timer, thus disabling the Watchdog. Use wdt_start to start it again.
include/wdt.h struct wdt_ops { · line 70
Quoted 5 lines
include/wdt.h +1
-1@@ -67,12 +67,12 @@ struct wdt_ops {* Start the timer * * @dev: WDT Device -* @timeout: Number of ticks before the timer expires +* @timeout_ms: Number of ticks (milliseconds) before the timer expires
See above.
Quoted 16 lines
include/wdt.h +1
-1* @flags: Driver specific flags. This might be used to specify * which action needs to be executed when the timer expires * @return: 0 if OK, -ve on error */ -int (*start)(struct udevice *dev,u64 timeout,ulong flags); +int (*start)(struct udevice *dev,u64 timeout_ms,ulong flags);/* * Stop the timer * Signature · 6 lines
2.14.0.rc1.383.gd1ce394fe2-goog _______________________________________________ U-Boot mailing list U-Boot at lists.denx.de https://lists.denx.de/listinfo/u-boot
PATCH v2 1/1 wdt: Update uclass to make clear that the timeout is in ms
+Tom
Hi Philipp,
Quoted 42 lines · Dr. Philipp Tomsich
Quoted 42 lines · Simon Glass
From: Andy Shevchenko <[email protected]>
Convert name to show explicitly that we are using milliseconds. For a watchdog timer this is precise enough.
No functional change intended.
Signed-off-by Andy Shevchenko <[email protected]>Signed-off-by Simon Glass <[email protected]>---
Changes in v2:
- Use milliseconds since microseconds seems too fine a control
- Update commit message to suit
drivers/watchdog/wdt-uclass.c| 4 ++--include/wdt.h| 8 ++++----2 files changed, 6 insertions(+), 6 deletions(-)drivers/watchdog/wdt-uclass.c +2
-2@@ -13,14 +13,14 @@DECLARE_GLOBAL_DATA_PTR ; -int wdt_start (struct udevice *dev,u64 timeout,ulong flags) +int wdt_start (struct udevice *dev,u64 timeout_ms,ulong flags) {const struct wdt_ops *ops =device_get_ops (dev);if (!ops->start)return -ENOSYS ; -return ops->start (dev, timeout, flags); +return ops->start (dev, timeout_ms, flags); }
Quoted 14 lines
include/wdt.h line 24
Quoted 11 lines
drivers/watchdog/wdt-uclass.c +0
-0int wdt_stop (struct udevice *dev)include/wdt.h +1
-1@@ -21,12 +21,12 @@* Start the timer * * @dev: WDT Device -* @timeout: Number of ticks before timer expires +* @timeout_ms: Number of ticks (milliseconds) before timer expires Should this not just be ‘number of milliseconds’ (as this would otherwise equate ticks and milliseconds, which don’t necess
Iarily
Quoted 1 line
need to be the same)?
I believe they are the same. We used to have a setting for it (CONFIG_SYS_HZ I think) but now everything is in milliseconds. See for example get_timer().
Quoted 8 lines
Quoted 8 lines
include/wdt.h +1
-1* @flags: Driver specific flags. This might be used to specify * which action needs to be executed when the timer expires * @return: 0 if OK, -ve on error */ -int wdt_start (struct udevice *dev,u64 timeout,ulong flags); +int wdt_start (struct udevice *dev,u64 timeout_ms,ulong flags);
Quoted 28 lines
include/wdt.h struct wdt_ops { · line 70
Quoted 8 lines
include/wdt.h +1
-1/* * Stop the timer, thus disabling the Watchdog. Use wdt_start to start it again. @@ -67,12 +67,12 @@ struct wdt_ops {* Start the timer * * @dev: WDT Device -* @timeout: Number of ticks before the timer expires +* @timeout_ms: Number of ticks (milliseconds) before the timer expires See above.
Quoted 16 lines
include/wdt.h +1
-2* @flags: Driver specific flags. This might be used to specify * which action needs to be executed when the timer expires * @return: 0 if OK, -ve on error */ -int (*start)(struct udevice *dev,u64 timeout,ulong flags); +int (*start)(struct udevice *dev,u64 timeout_ms,ulong flags);/* * Stop the timer * -- 2.14.0.rc1.383.gd1ce394fe2-goog
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
Regards,
Simon
PATCH v2 1/1 wdt: Update uclass to make clear that the timeout is in ms
Quoted 67 lines · Simon Glass
+Tom
Hi Philipp,
Quoted 42 lines · Dr. Philipp Tomsich
Quoted 42 lines · Simon Glass
From: Andy Shevchenko <[email protected]>
Convert name to show explicitly that we are using milliseconds. For a watchdog timer this is precise enough.
No functional change intended.
Signed-off-by Andy Shevchenko <[email protected]>Signed-off-by Simon Glass <[email protected]>---
Changes in v2:
- Use milliseconds since microseconds seems too fine a control
- Update commit message to suit
drivers/watchdog/wdt-uclass.c| 4 ++--include/wdt.h| 8 ++++----2 files changed, 6 insertions(+), 6 deletions(-)drivers/watchdog/wdt-uclass.c +2
-2@@ -13,14 +13,14 @@DECLARE_GLOBAL_DATA_PTR ; -int wdt_start (struct udevice *dev,u64 timeout,ulong flags) +int wdt_start (struct udevice *dev,u64 timeout_ms,ulong flags) {const struct wdt_ops *ops =device_get_ops (dev);if (!ops->start)return -ENOSYS ; -return ops->start (dev, timeout, flags); +return ops->start (dev, timeout_ms, flags); }Quoted 15 lines
include/wdt.h line 24
Quoted 11 lines
drivers/watchdog/wdt-uclass.c +0
-0int wdt_stop (struct udevice *dev)include/wdt.h +1
-1@@ -21,12 +21,12 @@* Start the timer * * @dev: WDT Device -* @timeout: Number of ticks before timer expires +* @timeout_ms: Number of ticks (milliseconds) before timer expires Should this not just be ‘number of milliseconds’ (as this would otherwise equate ticks and milliseconds, which don’t necessarily need to be the same)?
Quoted 3 lines
I believe they are the same. We used to have a setting for it (
CONFIG_SYS_HZI think) but now everything is in milliseconds. See for exampleget_timer().
I had thought of my remark more as a nitpick.
Bit it seems there’s more to it, after all: at least lib/time.c still treats ’ticks’ and ‘milliseconds' as separate concepts:
uint64_t __weak notrace get_ticks(void)
{
unsigned long now = timer_read_counter();
/* increment tbu if tbl has rolled over */
if (now < gd->timebase_l)
gd->timebase_h++;
gd->timebase_l = now;
return ((uint64_t)gd->timebase_h << 32) | gd->timebase_l;
}/* Returns time in milliseconds */
static uint64_t notrace tick_to_time(uint64_t tick)
{
ulong div = get_tbclk();
tick *= CONFIG_SYS_HZ;
do_div(tick, div);
return tick;
}Quoted 40 lines
Quoted 9 lines
Quoted 9 lines
include/wdt.h +1
-1* @flags: Driver specific flags. This might be used to specify * which action needs to be executed when the timer expires * @return: 0 if OK, -ve on error */ -int wdt_start (struct udevice *dev,u64 timeout,ulong flags); +int wdt_start (struct udevice *dev,u64 timeout_ms,ulong flags);Quoted 28 lines
include/wdt.h struct wdt_ops { · line 70
Quoted 8 lines
include/wdt.h +1
-1/* * Stop the timer, thus disabling the Watchdog. Use wdt_start to start it again. @@ -67,12 +67,12 @@ struct wdt_ops {* Start the timer * * @dev: WDT Device -* @timeout: Number of ticks before the timer expires +* @timeout_ms: Number of ticks (milliseconds) before the timer expires See above.
Quoted 16 lines
include/wdt.h +1
-2* @flags: Driver specific flags. This might be used to specify * which action needs to be executed when the timer expires * @return: 0 if OK, -ve on error */ -int (*start)(struct udevice *dev,u64 timeout,ulong flags); +int (*start)(struct udevice *dev,u64 timeout_ms,ulong flags);/* * Stop the timer * -- 2.14.0.rc1.383.gd1ce394fe2-goog
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-bootRegards,
Simon
PATCH v2 1/1 wdt: Update uclass to make clear that the timeout is in ms
Hi,
Quoted 88 lines · Dr. Philipp Tomsich
Quoted 67 lines · Simon Glass
+Tom
Hi Philipp,
Quoted 42 lines · Dr. Philipp Tomsich
Quoted 42 lines · Simon Glass
From: Andy Shevchenko <[email protected]>
Convert name to show explicitly that we are using milliseconds. For a watchdog timer this is precise enough.
No functional change intended.
Signed-off-by Andy Shevchenko <[email protected]>Signed-off-by Simon Glass <[email protected]>---
Changes in v2:
- Use milliseconds since microseconds seems too fine a control
- Update commit message to suit
drivers/watchdog/wdt-uclass.c| 4 ++--include/wdt.h| 8 ++++----2 files changed, 6 insertions(+), 6 deletions(-)drivers/watchdog/wdt-uclass.c +2
-2@@ -13,14 +13,14 @@DECLARE_GLOBAL_DATA_PTR ; -int wdt_start (struct udevice *dev,u64 timeout,ulong flags) +int wdt_start (struct udevice *dev,u64 timeout_ms,ulong flags) {const struct wdt_ops *ops =device_get_ops (dev);if (!ops->start)return -ENOSYS ; -return ops->start (dev, timeout, flags); +return ops->start (dev, timeout_ms, flags); }Quoted 15 lines
include/wdt.h line 24
Quoted 11 lines
drivers/watchdog/wdt-uclass.c +0
-0int wdt_stop (struct udevice *dev)include/wdt.h +1
-1@@ -21,12 +21,12 @@* Start the timer * * @dev: WDT Device -* @timeout: Number of ticks before timer expires +* @timeout_ms: Number of ticks (milliseconds) before timer expires Should this not just be ‘number of milliseconds’ (as this would otherwise equate ticks and milliseconds, which don’t necessarily need to be the same)?
Quoted 3 lines
I believe they are the same. We used to have a setting for it (
CONFIG_SYS_HZI think) but now everything is in milliseconds. See for exampleget_timer().I had thought of my remark more as a nitpick.
Bit it seems there’s more to it, after all: at leastlib/time.cstill treats ’ticks’ and ‘milliseconds' as separate concepts:
uint64_t__weaknotraceget_ticks(void){ unsigned long now = timer_read_counter(); /* increment tbu if tbl has rolled over */ if (now < gd->timebase_l) gd->timebase_h++; gd->timebase_l = now; return ((uint64_t)gd->timebase_h << 32) | gd->timebase_l; }/* Returns time in milliseconds */
staticuint64_tnotracetick_to_time(uint64_t tick)
Quoted 8 lines
{
ulong div = get_tbclk();
tick *= CONFIG_SYS_HZ;
do_div(tick, div);
return tick;
}But see lib/Kconfig:
config SYS_HZ
int
default 1000
help
The frequency of the timer returned by get_timer(). get_timer() must operate in milliseconds and this option must be set to 1000.
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
Quoted 12 lines
include/wdt.h +1
-1* @flags: Driver specific flags. This might be used to specify * which action needs to be executed when the timer expires * @return: 0 if OK, -ve on error */ -int wdt_start (struct udevice *dev,u64 timeout,ulong flags); +int wdt_start (struct udevice *dev,u64 timeout_ms,ulong flags);/* * Stop the timer, thus disabling the Watchdog. Use wdt_start to start it again. include/wdt.h struct wdt_ops { · line 70
Quoted 5 lines
include/wdt.h +1
-1@@ -67,12 +67,12 @@ struct wdt_ops {* Start the timer * * @dev: WDT Device -* @timeout: Number of ticks before the timer expires +* @timeout_ms: Number of ticks (milliseconds) before the timer expires See above.
Quoted 12 lines
include/wdt.h +1
-2* @flags: Driver specific flags. This might be used to specify * which action needs to be executed when the timer expires * @return: 0 if OK, -ve on error */ -int (*start)(struct udevice *dev,u64 timeout,ulong flags); +int (*start)(struct udevice *dev,u64 timeout_ms,ulong flags);/* * Stop the timer * -- 2.14.0.rc1.383.gd1ce394fe2-goog
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
Regards,
Simon
PATCH v2 1/1 wdt: Update uclass to make clear that the timeout is in ms
In reply to Simon GlassQuoted 11 lines · Simon Glass
From: Andy Shevchenko <[email protected]>
Convert name to show explicitly that we are using milliseconds. For a watchdog timer this is precise enough.
No functional change intended.
Signed-off-by Andy Shevchenko <[email protected]>Signed-off-by Simon Glass <[email protected]>---
Quoted 8 lines
Changes in v2:
- Use milliseconds since microseconds seems too fine a control
- Update commit message to suitdrivers/watchdog/wdt-uclass.c | 4 ++-- include/wdt.h | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-)
PATCH v2 1/1 wdt: Update uclass to make clear that the timeout is in ms
In reply to Simon GlassQuoted 45 lines · Simon Glass
From: Andy Shevchenko <[email protected]>
Convert name to show explicitly that we are using milliseconds. For a watchdog timer this is precise enough.
No functional change intended.
Signed-off-by Andy Shevchenko <[email protected]>Signed-off-by Simon Glass <[email protected]>---
Changes in v2:
- Use milliseconds since microseconds seems too fine a control
- Update commit message to suitdrivers/watchdog/wdt-uclass.c | 4 ++-- include/wdt.h | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-)drivers/watchdog/wdt-uclass.c +2
-2@@ -13,14 +13,14 @@DECLARE_GLOBAL_DATA_PTR ; -int wdt_start (struct udevice *dev,u64 timeout,ulong flags) +int wdt_start (struct udevice *dev,u64 timeout_ms,ulong flags) {const struct wdt_ops *ops =device_get_ops (dev);if (!ops->start)return -ENOSYS ; -return ops->start (dev, timeout, flags); +return ops->start (dev, timeout_ms, flags); }int wdt_stop (struct udevice *dev)include/wdt.h +0
-0
include/wdt.h line 24
Quoted 5 lines
include/wdt.h +1
-1@@ -21,12 +21,12 @@* Start the timer * * @dev: WDT Device -* @timeout: Number of ticks before timer expires +* @timeout_ms: Number of ticks (milliseconds) before timer expires
These are not the same and this is definitely a functional change. The length of a single tick depends on frequency of the clock that feeds WDT. It might not be the same as 1/SYS_HZ. For example ast_wdt driver uses 1MHz clock, so this parameter means microseconds for it.
Quoted 27 lines
include/wdt.h +3
-4* @flags: Driver specific flags. This might be used to specify * which action needs to be executed when the timer expires * @return: 0 if OK, -ve on error */ -int wdt_start (struct udevice *dev,u64 timeout,ulong flags); +int wdt_start (struct udevice *dev,u64 timeout_ms,ulong flags);/* * Stop the timer, thus disabling the Watchdog. Use wdt_start to start it again. @@ -67,12 +67,12 @@ struct wdt_ops {* Start the timer * * @dev: WDT Device -* @timeout: Number of ticks before the timer expires +* @timeout_ms: Number of ticks (milliseconds) before the timer expires * @flags: Driver specific flags. This might be used to specify * which action needs to be executed when the timer expires * @return: 0 if OK, -ve on error */ -int (*start)(struct udevice *dev,u64 timeout,ulong flags); +int (*start)(struct udevice *dev,u64 timeout_ms,ulong flags);/* * Stop the timer * -- 2.14.0.rc1.383.gd1ce394fe2-goog
Signature · 1 line
Maxim Sloyko
PATCH v2 1/1 wdt: Update uclass to make clear that the timeout is in ms
Hi Maxim,
Quoted 40 lines · Maxim Sloyko
Quoted 39 lines · Simon Glass
From: Andy Shevchenko <[email protected]>
Convert name to show explicitly that we are using milliseconds. For a watchdog timer this is precise enough.
No functional change intended.
Signed-off-by Andy Shevchenko <[email protected]>Signed-off-by Simon Glass <[email protected]>---
Changes in v2:
- Use milliseconds since microseconds seems too fine a control
- Update commit message to suitdrivers/watchdog/wdt-uclass.c | 4 ++-- include/wdt.h | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-)drivers/watchdog/wdt-uclass.c +2
-2@@ -13,14 +13,14 @@DECLARE_GLOBAL_DATA_PTR ; -int wdt_start (struct udevice *dev,u64 timeout,ulong flags) +int wdt_start (struct udevice *dev,u64 timeout_ms,ulong flags) {const struct wdt_ops *ops =device_get_ops (dev);if (!ops->start)return -ENOSYS ; -return ops->start (dev, timeout, flags); +return ops->start (dev, timeout_ms, flags); }
Quoted 16 lines
include/wdt.h line 24
Quoted 11 lines
drivers/watchdog/wdt-uclass.c +0
-0int wdt_stop (struct udevice *dev)include/wdt.h +1
-1@@ -21,12 +21,12 @@* Start the timer * * @dev: WDT Device -* @timeout: Number of ticks before timer expires +* @timeout_ms: Number of ticks (milliseconds) before timer expires These are not the same and this is definitely a functional change. The length of a single tick depends on frequency of the clock that feeds WDT. It might not be the same as 1/SYS_HZ. For example
ast_wdtdriver uses 1MHz clock, so this parameter means microseconds for it.
OK I see. Then the current code is doubly confusing, because ticks has a certain meaning in U-Boot and we cannot have the WDT using a different meaning.
This patch changes / clarifies the API to indicate that the time is in ms. Can we update existing drivers to honour that?
Quoted 25 lines
Quoted 25 lines
include/wdt.h +3
-3* @flags: Driver specific flags. This might be used to specify * which action needs to be executed when the timer expires * @return: 0 if OK, -ve on error */ -int wdt_start (struct udevice *dev,u64 timeout,ulong flags); +int wdt_start (struct udevice *dev,u64 timeout_ms,ulong flags);/* * Stop the timer, thus disabling the Watchdog. Use wdt_start to start it again. @@ -67,12 +67,12 @@ struct wdt_ops {* Start the timer * * @dev: WDT Device -* @timeout: Number of ticks before the timer expires +* @timeout_ms: Number of ticks (milliseconds) before the timer expires * @flags: Driver specific flags. This might be used to specify * which action needs to be executed when the timer expires * @return: 0 if OK, -ve on error */ -int (*start)(struct udevice *dev,u64 timeout,ulong flags); +int (*start)(struct udevice *dev,u64 timeout_ms,ulong flags);/* * Stop the timer *
Quoted 8 lines
Quoted 3 lines
--
2.14.0.rc1.383.gd1ce394fe2-goog--
Maxim Sloyko
Regards,
Simon
PATCH v2 1/1 wdt: Update uclass to make clear that the timeout is in ms
In reply to Simon GlassQuoted 10 lines · Simon Glass
From: Andy Shevchenko <[email protected]>
Convert name to show explicitly that we are using milliseconds. For a watchdog timer this is precise enough.
No functional change intended.
Signed-off-by Andy Shevchenko <[email protected]>Signed-off-by Simon Glass <[email protected]>Reviewed-by Bin Meng <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170813/efffdea5/attachment.sig>