[PATCH] itco: itcoV3 internal timer is stored as seconds

19 views
Skip to first unread message

Mathieu Alexandre-Tétreault

unread,
Oct 7, 2019, 9:54:41 AM10/7/19
to efibootg...@googlegroups.com, jan.k...@siemens.com
From: "Mathieu A.-Tetreault" <alexa...@amotus.ca>

As per the linux kernel documentation:
The iTCO v1 and v2's internal timer is stored as ticks which decrement
every 0.6 seconds. v3's internal timer is stored as seconds (some
datasheets incorrectly state 0.6 seconds).

https://github.com/torvalds/linux/blob/master/drivers/watchdog/iTCO_wdt.c#L136

This have been tested on an iTCOv3 board.

Signed-off-by: Mathieu A.-Tetreault <alexa...@amotus.ca>
---
drivers/watchdog/itco.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/watchdog/itco.c b/drivers/watchdog/itco.c
index f46379d..8346f36 100644
--- a/drivers/watchdog/itco.c
+++ b/drivers/watchdog/itco.c
@@ -97,7 +97,7 @@ init(EFI_PCI_IO *pci_io, UINT16 pci_vendor_id, UINT16 pci_device_id,
return status;
}
value &= 0xfc00;
- value |= ((timeout * 10) / 6) & 0x3ff;
+ value |= timeout & 0x3ff;
status = uefi_call_wrapper(pci_io->Io.Write, 6, pci_io,
EfiPciIoWidthUint16,
EFI_PCI_IO_PASS_THROUGH_BAR,
--
2.19.2

Jan Kiszka

unread,
Oct 7, 2019, 10:22:26 AM10/7/19
to Mathieu Alexandre-Tétreault, efibootg...@googlegroups.com, Christian Storm
On 07.10.19 15:54, Mathieu Alexandre-Tétreault wrote:
> From: "Mathieu A.-Tetreault" <alexa...@amotus.ca>
>
> As per the linux kernel documentation:
> The iTCO v1 and v2's internal timer is stored as ticks which decrement
> every 0.6 seconds. v3's internal timer is stored as seconds (some
> datasheets incorrectly state 0.6 seconds).
>
> https://github.com/torvalds/linux/blob/master/drivers/watchdog/iTCO_wdt.c#L136
>
> This have been tested on an iTCOv3 board.

Yeah, I think our v2 vs. v3 discussion somewhere stranded without any
conclusion.

>
> Signed-off-by: Mathieu A.-Tetreault <alexa...@amotus.ca>
> ---
> drivers/watchdog/itco.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/watchdog/itco.c b/drivers/watchdog/itco.c
> index f46379d..8346f36 100644
> --- a/drivers/watchdog/itco.c
> +++ b/drivers/watchdog/itco.c
> @@ -97,7 +97,7 @@ init(EFI_PCI_IO *pci_io, UINT16 pci_vendor_id, UINT16 pci_device_id,
> return status;
> }
> value &= 0xfc00;
> - value |= ((timeout * 10) / 6) & 0x3ff;
> + value |= timeout & 0x3ff;
> status = uefi_call_wrapper(pci_io->Io.Write, 6, pci_io,
> EfiPciIoWidthUint16,
> EFI_PCI_IO_PASS_THROUGH_BAR,
>

Christian, you said you refactored things in this area as well. Does
this collide or is this orthogonal?

Thanks,
Jan

--
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux

Mathieu Alexandre-Tétreault

unread,
Oct 7, 2019, 10:26:30 AM10/7/19
to Jan Kiszka, efibootg...@googlegroups.com, Christian Storm
On 10/7/19 10:22 AM, Jan Kiszka wrote:
> On 07.10.19 15:54, Mathieu Alexandre-Tétreault wrote:
>> From: "Mathieu A.-Tetreault" <alexa...@amotus.ca>
>>
>> As per the linux kernel documentation:
>> The iTCO v1 and v2's internal timer is stored as ticks which decrement
>> every 0.6 seconds. v3's internal timer is stored as seconds (some
>> datasheets incorrectly state 0.6 seconds).
>>
>> https://github.com/torvalds/linux/blob/master/drivers/watchdog/iTCO_wdt.c#L136
>>
>> This have been tested on an iTCOv3 board.
> Yeah, I think our v2 vs. v3 discussion somewhere stranded without any
> conclusion.

Indeed, that is my fault. I took a one year paternity leave :)

I am now back, I'll take the time this week to take care of this. I am
sorry about that.

Christian Storm

unread,
Oct 9, 2019, 8:56:41 AM10/9/19
to efibootg...@googlegroups.com
Hi,

> [...]
> Christian, you said you refactored things in this area as well. Does
> this collide or is this orthogonal?

Indeed, I did a quite large refactoring of itco.c but ran out of time
upstreaming it. In particular, in order to fully support Apollo Lake's
iTCO, some branching was introduced which could be helpful in adding
more (board-specific) specializations.

The patch proposed by Mathieu is quite small, it fits right away.

For probably upcoming larger patches, I'd suggest to base on my
refactorings or to take them and further improve on them. I'll cut
some time to polish the patch for upstream consumption. Hang tight...


Kind regards,
Christian

--
Dr. Christian Storm
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Otto-Hahn-Ring 6, 81739 München, Germany

Jan Kiszka

unread,
Oct 9, 2019, 9:28:14 AM10/9/19
to Mathieu Alexandre-Tétreault, efibootg...@googlegroups.com
On 07.10.19 15:54, Mathieu Alexandre-Tétreault wrote:
Thanks, applied.

Jan

--
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Reply all
Reply to author
Forward
0 new messages