Skip to content
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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

TonyHan11
Copy link
Contributor

No description provided.

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]>
Copy link
Contributor

@etienne-lms etienne-lms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some minor comments

@@ -12,6 +12,7 @@
#include <tee_api_defines.h>
#include <tee_api_types.h>
#include <types_ext.h>
#include <drivers/rstctrl.h>
Copy link
Contributor

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>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add #include <util.h>

Copy link
Contributor

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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add #include <stdbool.h>

Copy link
Contributor

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")

@@ -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);
Copy link
Contributor

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?

@TonyHan11
Copy link
Contributor Author

@etienne-lms updated according to the comments, thank you very much.

Copy link
Contributor

@etienne-lms etienne-lms left a 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.

@@ -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; }
Copy link
Contributor

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.


if (!rd)
return SCMI_NOT_FOUND;

Copy link
Contributor

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]>
@TonyHan11
Copy link
Contributor Author

@etienne-lms update according to your comments and add part of the review tags, thank you.

Copy link
Contributor

@etienne-lms etienne-lms left a 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>
Copy link
Contributor

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;
Copy link
Contributor

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")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants