-
Notifications
You must be signed in to change notification settings - Fork 15
[top,sw/dv] Clk pwr rst smoke tests #460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
csabakiss-semify
wants to merge
4
commits into
lowRISC:main
Choose a base branch
from
csabakiss-semify:clk_pwr_rst_smoke_test
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
d6d8dfe
[sw] Added reset manager smoke test
csabakiss-semify 9d3cac1
[sw] Added clock manager smoke test
csabakiss-semify 3b4a677
[sw] Added power manager smoke test
csabakiss-semify 7364ed3
[script] Added reset manager, clock manager and power manager smoke t…
csabakiss-semify File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,59 @@ | ||
| // Copyright lowRISC contributors (COSMIC project). | ||
| // Licensed under the Apache License, Version 2.0, see LICENSE for details. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| #include "hal/pwrmgr.h" | ||
| #include "hal/mmio.h" | ||
| #include <stdint.h> | ||
|
|
||
| uint32_t pwrmgr_control_get(pwrmgr_t pwrmgr) | ||
| { | ||
| return DEV_READ(pwrmgr + PWRMGR_CONTROL_REG); | ||
| } | ||
|
|
||
| void pwrmgr_control_set(pwrmgr_t pwrmgr, uint32_t value) | ||
| { | ||
| DEV_WRITE(pwrmgr + PWRMGR_CONTROL_REG, value & PWRMGR_CONTROL_MASK); | ||
| } | ||
|
|
||
| void pwrmgr_cfg_sync(pwrmgr_t pwrmgr) | ||
| { | ||
| DEV_WRITE(pwrmgr + PWRMGR_CFG_CDC_SYNC_REG, 1u); | ||
| while ((DEV_READ(pwrmgr + PWRMGR_CFG_CDC_SYNC_REG) & 1u) != 0u) { | ||
| } | ||
| } | ||
|
|
||
| uint32_t pwrmgr_wakeup_enable_get(pwrmgr_t pwrmgr) | ||
| { | ||
| return DEV_READ(pwrmgr + PWRMGR_WAKEUP_EN_REG); | ||
| } | ||
|
|
||
| void pwrmgr_wakeup_enable_set(pwrmgr_t pwrmgr, uint32_t value) | ||
| { | ||
| DEV_WRITE(pwrmgr + PWRMGR_WAKEUP_EN_REG, value); | ||
| } | ||
|
|
||
| uint32_t pwrmgr_wakeup_status_get(pwrmgr_t pwrmgr) | ||
| { | ||
| return DEV_READ(pwrmgr + PWRMGR_WAKE_STATUS_REG); | ||
| } | ||
|
|
||
| uint32_t pwrmgr_reset_status_get(pwrmgr_t pwrmgr) | ||
| { | ||
| return DEV_READ(pwrmgr + PWRMGR_RESET_STATUS_REG); | ||
| } | ||
|
|
||
| uint32_t pwrmgr_escalate_reset_status_get(pwrmgr_t pwrmgr) | ||
| { | ||
| return DEV_READ(pwrmgr + PWRMGR_ESCALATE_RESET_STATUS_REG); | ||
| } | ||
|
|
||
| uint32_t pwrmgr_wake_info_get(pwrmgr_t pwrmgr) | ||
| { | ||
| return DEV_READ(pwrmgr + PWRMGR_WAKE_INFO_REG); | ||
| } | ||
|
|
||
| void pwrmgr_wake_info_clear(pwrmgr_t pwrmgr, uint32_t mask) | ||
| { | ||
| DEV_WRITE(pwrmgr + PWRMGR_WAKE_INFO_REG, mask); | ||
| } |
This file contains hidden or 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,50 @@ | ||
| // Copyright lowRISC contributors (COSMIC project). | ||
| // Licensed under the Apache License, Version 2.0, see LICENSE for details. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| // Power manager interface. | ||
|
|
||
| #pragma once | ||
|
|
||
| #include <stdint.h> | ||
|
|
||
| #define PWRMGR_CONTROL_REG (0x14) | ||
| #define PWRMGR_CFG_CDC_SYNC_REG (0x18) | ||
| #define PWRMGR_WAKEUP_EN_REG (0x20) | ||
| #define PWRMGR_WAKE_STATUS_REG (0x24) | ||
| #define PWRMGR_RESET_STATUS_REG (0x30) | ||
| #define PWRMGR_ESCALATE_RESET_STATUS_REG (0x34) | ||
| #define PWRMGR_WAKE_INFO_REG (0x3C) | ||
|
|
||
| #define PWRMGR_CONTROL_LOW_POWER_HINT_BIT (1u << 0) | ||
| #define PWRMGR_CONTROL_CORE_CLK_EN_BIT (1u << 4) | ||
| #define PWRMGR_CONTROL_IO_CLK_EN_BIT (1u << 5) | ||
| #define PWRMGR_CONTROL_MAIN_PD_N_BIT (1u << 6) | ||
| #define PWRMGR_CONTROL_MASK \ | ||
| (PWRMGR_CONTROL_LOW_POWER_HINT_BIT | PWRMGR_CONTROL_CORE_CLK_EN_BIT | \ | ||
| PWRMGR_CONTROL_IO_CLK_EN_BIT | PWRMGR_CONTROL_MAIN_PD_N_BIT) | ||
|
|
||
| #define PWRMGR_WAKEUP_EN_SOC_PROXY_EXT_WKUP_REQ_BIT (1u << 0) | ||
|
|
||
| #define PWRMGR_WAKE_INFO_REASONS_BIT (1u << 0) | ||
| #define PWRMGR_WAKE_INFO_FALL_THROUGH_BIT (1u << 1) | ||
| #define PWRMGR_WAKE_INFO_ABORT_BIT (1u << 2) | ||
|
|
||
| typedef void *pwrmgr_t; | ||
|
|
||
| #define PWRMGR_FROM_BASE_ADDR(addr) ((pwrmgr_t)(addr)) | ||
|
|
||
| uint32_t pwrmgr_control_get(pwrmgr_t pwrmgr); | ||
| void pwrmgr_control_set(pwrmgr_t pwrmgr, uint32_t value); | ||
|
|
||
| void pwrmgr_cfg_sync(pwrmgr_t pwrmgr); | ||
|
|
||
| uint32_t pwrmgr_wakeup_enable_get(pwrmgr_t pwrmgr); | ||
| void pwrmgr_wakeup_enable_set(pwrmgr_t pwrmgr, uint32_t value); | ||
|
|
||
| uint32_t pwrmgr_wakeup_status_get(pwrmgr_t pwrmgr); | ||
| uint32_t pwrmgr_reset_status_get(pwrmgr_t pwrmgr); | ||
| uint32_t pwrmgr_escalate_reset_status_get(pwrmgr_t pwrmgr); | ||
|
|
||
| uint32_t pwrmgr_wake_info_get(pwrmgr_t pwrmgr); | ||
| void pwrmgr_wake_info_clear(pwrmgr_t pwrmgr, uint32_t mask); |
This file contains hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can now remove this function. I think it was only used in the software_reset test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. The test now reads and clears the reset reason directly, so this function is not needed anymore. I will remove it from the HAL source and header.