-
Notifications
You must be signed in to change notification settings - Fork 7.6k
drivers: firmware: Clock control TISCI driver support #90216
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
base: main
Are you sure you want to change the base?
Conversation
7cf310e
to
2dc18ee
Compare
8b10b9f
to
9ee64d7
Compare
9a47dbf
to
20b38b7
Compare
6bd0da6
to
7f1f9bf
Compare
2154640
to
20a6a86
Compare
Support added for clock control using TISCI for devices using the binding ti,k2g-sci-clk. This driver relies on the TISCI layer to make calls to the DMSC core to set and get the clock rate and retrieve clock status. Signed-off-by: Dave Joseph <d-joseph@ti.com>
20a6a86
to
a524875
Compare
|
#define TISCI_GET_CLOCK_DETAILS(_dev) \ | ||
{.dev_id = DT_CLOCKS_CELL(DT_NODELABEL(_dev), devid), \ | ||
.clk_id = DT_CLOCKS_CELL(DT_NODELABEL(_dev), clkid)} | ||
|
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.
#define TISCI_GET_CLOCK_DETAILS(_dev) \ | |
{.dev_id = DT_CLOCKS_CELL(DT_NODELABEL(_dev), devid), \ | |
.clk_id = DT_CLOCKS_CELL(DT_NODELABEL(_dev), clkid)} | |
#define TISCI_GET_CLOCK_DETAILS(node_id) \ | |
{ \ | |
.dev_id = DT_CLOCKS_CELL(node_id, devid), \ | |
.clk_id = DT_CLOCKS_CELL(node_id, clkid), \ | |
} | |
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.
same here
#define TISCI_GET_CLOCK_BY_INST(inst) DEVICE_DT_INST_GET(inst) | ||
|
||
#define TISCI_GET_CLOCK_DETAILS_BY_INST(inst) \ | ||
{.dev_id = DT_INST_CLOCKS_CELL(inst, devid), .clk_id = DT_INST_CLOCKS_CELL(inst, clkid)} |
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.
{.dev_id = DT_INST_CLOCKS_CELL(inst, devid), .clk_id = DT_INST_CLOCKS_CELL(inst, clkid)} | |
TISCI_GET_CLOCK_DETAILS(DT_DRV_INST(inst)) |
uint32_t clk_id; | ||
}; | ||
|
||
#define TISCI_GET_CLOCK(_dev) DEVICE_DT_GET(DT_PHANDLE(DT_NODELABEL(_dev), clocks)) |
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.
#define TISCI_GET_CLOCK(_dev) DEVICE_DT_GET(DT_PHANDLE(DT_NODELABEL(_dev), clocks)) | |
#define TISCI_GET_CLOCK(node_id) DEVICE_DT_GET(DT_PHANDLE(node_id, clocks)) |
I feel we should follow the devicetree.h
convention and use node_id instead of manually using DT_NODELABEL
here
{.dev_id = DT_CLOCKS_CELL(DT_NODELABEL(_dev), devid), \ | ||
.clk_id = DT_CLOCKS_CELL(DT_NODELABEL(_dev), clkid)} | ||
|
||
#define TISCI_GET_CLOCK_BY_INST(inst) DEVICE_DT_INST_GET(inst) |
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.
#define TISCI_GET_CLOCK_BY_INST(inst) DEVICE_DT_INST_GET(inst) | |
#define TISCI_GET_CLOCK_BY_INST(inst) TISCI_GET_CLOCK(DT_DRV_INST(inst)) |
zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF54H_HFXO clock_control_nrf54h_hfxo.c) | ||
zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF_HSFLL_LOCAL clock_control_nrf_hsfll_local.c) | ||
zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF_LFCLK clock_control_nrf_lfclk.c) | ||
zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_BOUFFALOLAB_BL60X clock_control_bl60x.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.
The above look unrelated, seems like you had some rebase issue going on here.
{ | ||
struct tisci_clock_config *req = (struct tisci_clock_config *)sys; | ||
uint64_t temp_rate; | ||
int ret = tisci_cmd_clk_get_freq(dmsc, req->dev_id, req->clk_id, &temp_rate); |
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.
Declare ret
, then a newline, then assign to it, then no newline after between the assignment and the checking of ret
. Same for tisci_set_rate()
, make them look like you did in tisci_get_status()
.
if (curr_state) { | ||
return CLOCK_CONTROL_STATUS_OFF; | ||
} | ||
return state; |
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.
return CLOCK_CONTROL_STATUS_UNKNOWN;
here, then just drop the state
variable.
return ret; | ||
} | ||
|
||
static inline enum clock_control_status tisci_get_status(const struct device *dev, |
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.
inline?
Support added for clock control using TISCI added for devices using the binding ti,k2g-sci-clk. This PR waits on #90053
Testing
Refer: ClockControllerTest
Output: