-
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
base: master
Are you sure you want to change the base?
Conversation
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]>
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)
…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]>
…ines Define new functions for getting the reset controller, find or allocate the reset lines. Signed-off-by: Tony Han <[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]>
…iver Enable CFG_SCMI_MSG_RESET_DOMAIN and CFG_DRIVERS_RSTCTRL. Signed-off-by: Tony Han <[email protected]> Acked-by: Etienne Carriere <[email protected]>
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")
No description provided.