timer: dw-apb: Add missing 64bit up-conversion
PATCH 1/1 timer: dw-apb: Add missing 64bit up-conversion
The generic timer count is an incrementing 64bit value and a timer driver must return an incrementing 64bit value. The DW APB timer only provides a 32bit timer counting down, thus the result must be inverted and converted to a 64bit value. The current implementation is however missing the 64bit up-conversion and this results in random timer roll-overs, which in turn triggers random timeouts throughout the codebase.
This patch adds the missing 64bit up-conversion to fix the issue.
--- drivers/timer/dw-apb-timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/timer/dw-apb-timer.c +1 -1
@@ -32,7 +32,7 @@ static int dw_apb_timer_get_count(struct udevice *dev, u64 *count)* requires the count to be incrementing. Invert the * result. */ - *count = ~readl (priv->regs +DW_APB_CURR_VAL ); + *count =timer_conv_64 (~readl (priv->regs +DW_APB_CURR_VAL ));return 0 ; }
Signature · 1 line
2.20.1
PATCH 1/1 timer: dw-apb: Add missing 64bit up-conversion
Quoted 8 lines · Marek Vasut
The generic timer count is an incrementing 64bit value and a timer driver must return an incrementing 64bit value. The DW APB timer only provides a 32bit timer counting down, thus the result must be inverted and converted to a 64bit value. The current implementation is however missing the 64bit up-conversion and this results in random timer roll-overs, which in turn triggers random timeouts throughout the codebase.
Quoted 8 lines
This patch adds the missing 64bit up-conversion to fix the issue.
Signed-off-by Marek Vasut <[email protected]>Cc Chin Liang See <[email protected]>Cc Dinh Nguyen <[email protected]>Cc Ley Foon Tan <[email protected]>Cc Simon Goldschmidt <[email protected]>Cc Tien Fong Chee <[email protected]>
Quoted 20 lines
--- drivers/timer/dw-apb-timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/timer/dw-apb-timer.c +1
-2@@ -32,7 +32,7 @@ static int dw_apb_timer_get_count(struct udevice *dev, u64 *count)* requires the count to be incrementing. Invert the * result. */ - *count = ~readl (priv->regs +DW_APB_CURR_VAL ); + *count =timer_conv_64 (~readl (priv->regs +DW_APB_CURR_VAL ));return 0 ; } --2.20.1
PATCH 1/1 timer: dw-apb: Add missing 64bit up-conversion
Quoted 11 lines · Simon Goldschmidt
Quoted 10 lines · Marek Vasut
The generic timer count is an incrementing 64bit value and a timer driver must return an incrementing 64bit value. The DW APB timer only provides a 32bit timer counting down, thus the result must be inverted and converted to a 64bit value. The current implementation is however missing the 64bit up-conversion and this results in random timer roll-overs, which in turn triggers random timeouts throughout the codebase.
This patch adds the missing 64bit up-conversion to fix the issue.
Quoted 8 lines
Quoted 6 lines
Signed-off-by Marek Vasut <[email protected]>Cc Chin Liang See <[email protected]>Cc Dinh Nguyen <[email protected]>Cc Ley Foon Tan <[email protected]>Cc Simon Goldschmidt <[email protected]>Cc Tien Fong Chee <[email protected]>Reviewed-by Simon Goldschmidt <[email protected]>
Maybe it's time to convert Gen5 to this timer driver too :)
Signature · 2 lines
Best regards, Marek Vasut
PATCH 1/1 timer: dw-apb: Add missing 64bit up-conversion
Quoted 20 lines · Marek Vasut
Quoted 18 lines · Simon Goldschmidt
Quoted 16 lines · Marek Vasut
The generic timer count is an incrementing 64bit value and a timer driver must return an incrementing 64bit value. The DW APB timer only provides a 32bit timer counting down, thus the result must be inverted and converted to a 64bit value. The current implementation is however missing the 64bit up-conversion and this results in random timer roll-overs, which in turn triggers random timeouts throughout the codebase.
This patch adds the missing 64bit up-conversion to fix the issue.
Signed-off-by Marek Vasut <[email protected]>Cc Chin Liang See <[email protected]>Cc Dinh Nguyen <[email protected]>Cc Ley Foon Tan <[email protected]>Cc Simon Goldschmidt <[email protected]>Cc Tien Fong Chee <[email protected]>
Quoted 3 lines
Quoted 1 line
Reviewed-by Simon Goldschmidt <[email protected]>Maybe it's time to convert Gen5 to this timer driver too :)
Yes, well, let's see when I find the time. Converting clock and pinctrl to devicetree is on my list as well...
Regards,
Simon