-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
plat-stm32mp1: remove registering to platform shared_resources driver #7169
Open
etienne-lms
wants to merge
7
commits into
OP-TEE:master
Choose a base branch
from
etienne-lms:stm32-shres
base: master
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.
+34
−127
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a3bf66c
plat-stm32mp1: CFG_STM32_IWDG requires CFG_WDT_SM_HANDLER
etienne-lms 4c866bd
drivers: stm32_iwdg: remove registering to shared_resources driver
etienne-lms 682e76d
drivers: stm32_iwdg: remove useless device list
etienne-lms 90c751c
drivers: stm32_rng: remove registering to shared_resources driver
etienne-lms 695512d
drivers: stm32_uart: remove registering to shared_resources driver
etienne-lms 3d706ce
drivers: stm32_cryp: remove registering to shared_resource driver
etienne-lms 0df1333
plat-stm32mp1: remove PMIC registering to shared_resources driver
etienne-lms 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 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 |
---|---|---|
|
@@ -61,14 +61,12 @@ | |
* IWDG_FLAGS_HW_ENABLED Watchdog is enabled by BootROM | ||
* IWDG_FLAGS_DISABLE_ON_STOP Watchdog is freezed in SoC STOP mode | ||
* IWDG_FLAGS_DISABLE_ON_STANDBY Watchdog is freezed in SoC STANDBY mode | ||
* IWDG_FLAGS_NON_SECURE Instance is assigned to non-secure world | ||
* IWDG_FLAGS_ENABLED Watchdog has been enabled | ||
*/ | ||
#define IWDG_FLAGS_HW_ENABLED BIT(0) | ||
#define IWDG_FLAGS_DISABLE_ON_STOP BIT(1) | ||
#define IWDG_FLAGS_DISABLE_ON_STANDBY BIT(2) | ||
#define IWDG_FLAGS_NON_SECURE BIT(3) | ||
#define IWDG_FLAGS_ENABLED BIT(4) | ||
#define IWDG_FLAGS_ENABLED BIT(3) | ||
|
||
/* | ||
* IWDG watch instance data | ||
|
@@ -78,7 +76,6 @@ | |
* @flags - Property flags for the IWDG instance | ||
* @timeout - Watchdog elaspure timeout | ||
* @wdt_chip - Wathcdog chip instance | ||
* @link - Link in registered watchdog instance list | ||
*/ | ||
struct stm32_iwdg_device { | ||
struct io_pa_va base; | ||
|
@@ -87,22 +84,13 @@ struct stm32_iwdg_device { | |
uint32_t flags; | ||
unsigned long timeout; | ||
struct wdt_chip wdt_chip; | ||
SLIST_ENTRY(stm32_iwdg_device) link; | ||
}; | ||
|
||
static SLIST_HEAD(iwdg_dev_list_head, stm32_iwdg_device) iwdg_dev_list = | ||
SLIST_HEAD_INITIALIZER(iwdg_dev_list_head); | ||
|
||
static vaddr_t get_base(struct stm32_iwdg_device *iwdg) | ||
{ | ||
return io_pa_or_va(&iwdg->base, 1); | ||
} | ||
|
||
static bool is_assigned_to_nsec(struct stm32_iwdg_device *iwdg) | ||
{ | ||
return iwdg->flags & IWDG_FLAGS_NON_SECURE; | ||
} | ||
|
||
static void iwdg_wdt_set_enabled(struct stm32_iwdg_device *iwdg) | ||
{ | ||
iwdg->flags |= IWDG_FLAGS_ENABLED; | ||
|
@@ -268,17 +256,9 @@ static TEE_Result stm32_iwdg_parse_fdt(struct stm32_iwdg_device *iwdg, | |
if (res) | ||
return res; | ||
|
||
if (dt_info.status == DT_STATUS_OK_NSEC) | ||
iwdg->flags |= IWDG_FLAGS_NON_SECURE; | ||
|
||
/* Get IOMEM address */ | ||
iwdg->base.pa = dt_info.reg; | ||
|
||
if (iwdg->flags & IWDG_FLAGS_NON_SECURE) | ||
io_pa_or_va_nsec(&iwdg->base, dt_info.reg_size); | ||
else | ||
io_pa_or_va_secure(&iwdg->base, dt_info.reg_size); | ||
|
||
io_pa_or_va_secure(&iwdg->base, dt_info.reg_size); | ||
assert(iwdg->base.va); | ||
|
||
/* Get and check timeout value */ | ||
|
@@ -355,50 +335,30 @@ static TEE_Result stm32_iwdg_setup(struct stm32_iwdg_device *iwdg, | |
return TEE_SUCCESS; | ||
} | ||
|
||
static TEE_Result stm32_iwdg_register(struct stm32_iwdg_device *iwdg) | ||
{ | ||
TEE_Result res = TEE_ERROR_GENERIC; | ||
|
||
if (is_assigned_to_nsec(iwdg)) { | ||
stm32mp_register_non_secure_periph_iomem(iwdg->base.pa); | ||
} else { | ||
stm32mp_register_secure_periph_iomem(iwdg->base.pa); | ||
|
||
/* Expose watchdog runtime service only to secure IWDG */ | ||
iwdg->wdt_chip.ops = &stm32_iwdg_ops; | ||
|
||
res = watchdog_register(&iwdg->wdt_chip); | ||
if (res) | ||
return res; | ||
} | ||
|
||
SLIST_INSERT_HEAD(&iwdg_dev_list, iwdg, link); | ||
|
||
return TEE_SUCCESS; | ||
} | ||
|
||
static TEE_Result stm32_iwdg_probe(const void *fdt, int node, | ||
const void *compat_data __unused) | ||
{ | ||
struct stm32_iwdg_device *iwdg = NULL; | ||
TEE_Result res = TEE_SUCCESS; | ||
|
||
static_assert(IS_ENABLED(CFG_WDT) && IS_ENABLED(CFG_WDT_SM_HANDLER)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not useful as CFG_STM32_IWDG is disabled when either CFG_WDT or CFG_WDT_SM_HANDLER is disabled? |
||
|
||
iwdg = calloc(1, sizeof(*iwdg)); | ||
if (!iwdg) | ||
return TEE_ERROR_OUT_OF_MEMORY; | ||
|
||
res = stm32_iwdg_setup(iwdg, fdt, node); | ||
if (res) | ||
goto err; | ||
goto out; | ||
|
||
res = stm32_iwdg_register(iwdg); | ||
if (res) | ||
goto err; | ||
iwdg->wdt_chip.ops = &stm32_iwdg_ops; | ||
|
||
return TEE_SUCCESS; | ||
res = watchdog_register(&iwdg->wdt_chip); | ||
|
||
out: | ||
if (res) | ||
free(iwdg); | ||
|
||
err: | ||
free(iwdg); | ||
return res; | ||
} | ||
|
||
|
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
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 don't fancy we rely of secure-status in
dt_pmic_is_secure()
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.
We can address this in a dedicated P-R, it's out of the scope of this series that only intend to get rid of plat-stm32mp1/shared_resources.c.
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've created #7172 to address that point.