-
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
drivers: sam: add SCMI reset domain management protocol support #7136
Conversation
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.
some minor comments
core/drivers/atmel_rstc.c
Outdated
@@ -12,6 +12,7 @@ | |||
#include <tee_api_defines.h> | |||
#include <tee_api_types.h> | |||
#include <types_ext.h> | |||
#include <drivers/rstctrl.h> |
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.
sort in alphabetical order and add #include <sys/queue.h>
@@ -8,6 +8,12 @@ | |||
#include <compiler.h> | |||
#include <stdbool.h> |
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.
add #include <util.h>
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.
Please address the above comment.
(commit "drivers: atmel_rstc: new data and functions to handle reset assert/deassert")
@@ -24,6 +24,11 @@ | |||
|
|||
static vaddr_t rstc_base; | |||
|
|||
struct sam_reset_data { | |||
bool rstc_always_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.
add #include <stdbool.h>
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.
Please address the above comment.
(commit "drivers: atmel_rstc: add functions to allocate/get reset controller/lines")
core/include/drivers/atmel_rstc.h
Outdated
@@ -30,4 +30,6 @@ static inline void sam_rstc_usb_por(unsigned char id __unused, | |||
bool enable __unused) {} | |||
#endif | |||
|
|||
struct rstctrl *sam_get_rstctrl(unsigned int reset_id); |
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.
maybe consider #if defined(CFG_ATMEL_RSTC)
to declare/define this function?
ac07e4e
to
9e05490
Compare
@etienne-lms updated according to the comments, thank you very much. |
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.
1 comment to address for commit
"drivers: atmel_rstc: new data and functions to handle reset assert/deassert".
Few comments to address for commit
"drivers: atmel_rstc: add functions to allocate/get reset controller/lines".
Acked-by: Etienne Carriere <[email protected]>
for commit
"drivers: atmel_rstc: probe RSTC with reset controller and reset lines" and
"plat-sam: enable SCMI reset domain management protocol and rstctrl driver".
1 comment for "plat-sam: scmi_server: use SCMI reset to manage USB reset for sama7g5". If not applicable, you can add my Acked-by
tag to that commit.
core/include/drivers/atmel_rstc.h
Outdated
@@ -28,6 +30,7 @@ static inline bool atmel_rstc_available(void) | |||
static inline void atmel_rstc_reset(void) {} | |||
static inline void sam_rstc_usb_por(unsigned char id __unused, | |||
bool enable __unused) {} | |||
struct rstctrl *sam_get_rstctrl(unsigned int reset_id) { return NULL; } |
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.
static inline
+ __unused
for the function argument.
#define RESET_ID_MASK GENMASK_32(31, 5) | ||
#define RESET_ID_SHIFT U(5) | ||
#define RESET_BIT_POS_MASK GENMASK_32(4, 0) | ||
#define RESET_OFFSET(id) (((id) & RESET_ID_MASK) >> RESET_ID_SHIFT) |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
|
||
if (!rd) | ||
return SCMI_NOT_FOUND; | ||
|
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.
if (!rd->rstctrl) return SCMI_DENIED
?
(to match rstctrl_get_exclusive()
test at line 1141)
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.
If reset controller access is not exclusive t line 1141 then rd->rstctrl
is NULL and OP-TEE core will segfault at line 1094/1097.
9e05490
to
122c571
Compare
@etienne-lms update according to your comments and add part of the review tags, thank you. |
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.
Acked-by: Etienne Carriere <[email protected]>
fro commit
"drivers: clk: sam: rename the sama7g5 UTMI clocks for USB PHY".
Few comments still to address.
@@ -8,6 +8,12 @@ | |||
#include <compiler.h> | |||
#include <stdbool.h> |
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.
Please address the above comment.
(commit "drivers: atmel_rstc: new data and functions to handle reset assert/deassert")
@@ -24,6 +24,11 @@ | |||
|
|||
static vaddr_t rstc_base; | |||
|
|||
struct sam_reset_data { | |||
bool rstc_always_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.
Please address the above comment.
(commit "drivers: atmel_rstc: add functions to allocate/get reset controller/lines")
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.
There is a comment not address on commit "plat-sam: scmi_server: use SCMI reset to manage USB reset for sama7g5".
Could you rebase this P-R to fix the merge conflicts?
|
||
if (!rd) | ||
return SCMI_NOT_FOUND; | ||
|
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.
If reset controller access is not exclusive t line 1141 then rd->rstctrl
is NULL and OP-TEE core will segfault at line 1094/1097.
core/arch/arm/plat-sam/scmi_server.c
Outdated
{ | ||
const struct channel_resources *resource = find_resource(channel_id); | ||
|
||
if (resource && scmi_id < resource->rd_count) |
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.
nitpicking: by the way:, remove the extra space char before scmi_id
.
redundant space char before |
rebased on the latest master branch with the merge conflict fixed. |
Add a commit to fix the compile error caused by the wrong path of the header file included in |
Sorry for adding another fix for correcting the length used for comparing the clock names in |
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 you should squash commits
"drivers: atmel_rstc: new data and functions to handle reset assert/deassert"
and "drivers: atmel_rstc: add functions to allocate/get reset controller/lines"
unless what to former likely triggers a build warning on unused sam_rst_list
.
Acked-by: Etienne Carriere <[email protected]>
for commits
"drivers: atmel_rstc: add functions to allocate/get reset controller/lines" (with malloc.h inclusion fixed)
and "plat-sam: scmi_server: use SCMI reset to manage USB reset for sama7g5".
For commit "drivers: microchip_pit: fix the path of "dt_driver.h" included", could you add a Fixes:
tag to the commit message. With that addressed,
Acked-by: Etienne Carriere <[email protected]>
for that commit.
if (sam_rstline) | ||
return sam_rstline; | ||
|
||
sam_rstline = calloc(1, sizeof(*sam_rstline)); |
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.
#include <malloc.h>
The UTMI clocks for USB PHY are handled in OP-TEE due to they are controlled by the registers from RSTC (reset controller) which is always-secured. SCMI "reset domain management protocol" makes it prossible to handle the resets from the kernel running in normal world. So the code in kernel for these clocks need to be enabled. Here renaming the clocks to avoid registering them failed from the kernel. Signed-off-by: Tony Han <[email protected]> Acked-by: Etienne Carriere <[email protected]>
Commits "drivers: atmel_rstc: new data and functions to handle reset assert/deassert"
Thank you very much. |
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.
Acked-by: Etienne Carriere <[email protected]>
for commit
"drivers: microchip_pit: fix the length used for comparing the clock names".
I've added a comment for another potential debug inconvenience.
@@ -34,7 +34,8 @@ static TEE_Result microchip_pit_probe(const void *fdt, int node, | |||
|
|||
do { | |||
parent = clk_get_parent_by_index(gclk, i++); | |||
if (!memcmp("syspll", clk_get_name(parent), sizeof("syspll"))) | |||
if (!memcmp("syspll", clk_get_name(parent), | |||
sizeof("syspll") - 1)) |
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.
For consistency, i think you also should also test parent
is not NULL (at least with assert()
) to get a better trace message instead of a segfault from clk_get_name()
. No strong issue here since anyway you expect a panic at line 42 but this line would never be reached.
|
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.
Acked-by: Etienne Carriere <[email protected]>
for commit
"drivers: atmel_rstc: new data and functions to handle reset assert/deassert".
The whole series looks good to me.
…assert Define new struct and functions for handling the reset controller, reset lines and the reset operations (assert, deassert). Signed-off-by: Tony Han <[email protected]> Acked-by: Etienne Carriere <[email protected]>
…ines Define new functions for getting the reset controller, find or allocate the reset lines. Signed-off-by: Tony Han <[email protected]> Acked-by: Etienne Carriere <[email protected]>
Update the type of RSTC driver to DT_DRIVER_RSTCTRL and probe RSTC with the concept of controller and lines. Signed-off-by: Tony Han <[email protected]> Acked-by: Etienne Carriere <[email protected]>
Enable "reset domain management protocol", add reset domains to SCMI channel and add functions for SCMI reset domain. Signed-off-by: Tony Han <[email protected]> Acked-by: Etienne Carriere <[email protected]>
…iver Enable CFG_SCMI_MSG_RESET_DOMAIN and CFG_DRIVERS_RSTCTRL. Signed-off-by: Tony Han <[email protected]> Acked-by: Etienne Carriere <[email protected]>
change "#include <dt_driver.h>" to "#include <kernel/dt_driver.h>" due to "dt_driver.h" is located at "core/include/kernel/" and the path is not in the include paths which would cause compile errors. Fixes: 8796ab4 ("drivers: microchip_pit: add driver for sama7g54's pit64b") Signed-off-by: Tony Han <[email protected]> Acked-by: Etienne Carriere <[email protected]>
…ames sizeof("syspll") equals to 7 with a character '\0' in count, adjust the length used for the comparison to obtain the expected result. Move the test of "parent" into the while loop to improve debug convenience. Fixes: 8796ab4 ("drivers: microchip_pit: add driver for sama7g54's pit64b") Signed-off-by: Tony Han <[email protected]> Acked-by: Etienne Carriere <[email protected]>
@etienne-lms The review tag added, thanks a lot. |
No description provided.