-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable system WDT with timeout of 8s
Enable WDT to ensure the system: - Does not hang processing any task, such as previous cases of PECI commands never completing. - Does not take longer than the timeout period to complete all outstanding tasks. A timeout of 8s is used to remain close to the existing use of the WDT in scratch ROM, which was set to 10s. Signed-off-by: Tim Crawford <tcrawford@system76.com>
- Loading branch information
Showing
7 changed files
with
61 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// SPDX-License-Identifier: GPL-3.0-only | ||
|
||
#include <ec/etwd.h> | ||
#include <common/macro.h> | ||
|
||
enum EtwdPrescaler { | ||
ETWD_PRESCALER_32768_HZ = 0, | ||
ETWD_PRESCALER_1024_HZ = 1, | ||
ETWD_PRESCALER_32_HZ = 2, | ||
ETWD_PRESCALER_EC_CLK = 3, // Not available for ET1PS | ||
}; | ||
|
||
void wdt_init(void) { | ||
ET1PSR = ETWD_PRESCALER_1024_HZ; | ||
|
||
// Enable WDT key match, use ET1 prescaler for WDT clock | ||
ETWCFG = BIT(5) | BIT(4); | ||
|
||
// Start ET1 so EWDT can be started | ||
ET1CNTLLR = 0xFF; | ||
|
||
// Start EWDT with timeout of 8s | ||
// TODO: Determine time based on system performance | ||
EWDCNTLHR = 0x20; | ||
EWDCNTLLR = 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters