-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Raspberry Pi Pico Clock Control Driver #52901
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
Raspberry Pi Pico Clock Control Driver #52901
Conversation
0ee27a1 to
116cc05
Compare
116cc05 to
491bf42
Compare
7d4d910 to
fda9ad9
Compare
Added clock device tree bindings for Raspberry Pi Pico platform Signed-off-by: Andrei-Edward Popa <[email protected]>
Enabled syscon node in device tree Added clock control in defconfig Signed-off-by: Andrei-Edward Popa <[email protected]>
Added clock control header files for Raspberry Pi Pico Signed-off-by: Andrei-Edward Popa <[email protected]>
898127a to
200203a
Compare
Added clock driver for Raspberry Pi Pico platform Signed-off-by: Andrei-Edward Popa <[email protected]>
Added clock in supported hardware features Signed-off-by: Andrei-Edward Popa <[email protected]>
… Pico Changed how to get xtal frequency for Raspberry Pi Pico Signed-off-by: Andrei-Edward Popa <[email protected]>
Changed how to get clock frequency for PL022 Signed-off-by: Andrei-Edward Popa <[email protected]>
Removed all function calls from Raspberry Pi Pico SDK Added functions for setting uart baudrate and format Signed-off-by: Andrei-Edward Popa <[email protected]>
…nfig Added clock control as default in defconfig Signed-off-by: Andrei-Edward Popa <[email protected]>
Removed xtal clock node from device tree Signed-off-by: Andrei-Edward Popa <[email protected]>
047fca1 to
12a539f
Compare
Added clock control as default in defconfig Signed-off-by: Andrei-Edward Popa <[email protected]>
Removed xtal clock node from device tree Signed-off-by: Andrei-Edward Popa <[email protected]>
…iver Added myself to codeowners for Raspberry Pi Pico clock driver Signed-off-by: Andrei-Edward Popa <[email protected]>
12a539f to
19b7031
Compare
yonsch
left a comment
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.
A few questions, most importantly: how will clock sources be supported?
| zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF_DRIVER_CALIBRATION nrf_clock_calibration.c) | ||
| zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_RV32M1_PCC clock_control_rv32m1_pcc.c) | ||
| zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_INFINEON_CAT1 clock_control_ifx_cat1.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.
Something happened here with the blank lines...
|
|
||
| baudrate_div = (8 * pclk / input_baudrate); | ||
| baudrate_int = baudrate_div >> 7; | ||
| baudrate_frac = (baudrate_int == 0) || (baudrate_int >= 65535) ? 0 : |
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 even more parentheses
| [RPI_PICO_CLOCK_PERI] = { | ||
| .source = 0, | ||
| .aux_source = CLOCKS_CLK_PERI_CTRL_AUXSRC_VALUE_CLK_SYS, | ||
| .source_rate = DT_INST_PROP(0, sys_frequency), |
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.
Is this correct?
| #include <hardware/clocks.h> | ||
|
|
||
| #define CTRL_ENABLE_BITS CLOCKS_CLK_GPOUT0_CTRL_ENABLE_BITS | ||
| #define FIXED_CLOCK_FREQ(node_id, child) DT_PROP(DT_CHILD(node_id, child), clock_frequency) |
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.
This seems to be written specifically to access the children of clocks, so maybe it should be rewritten to something like:
#define FIXED_CLOCK_FREQ(clock) DT_PROP(DT_CHILD(DT_NODELABEL(clocks), clock), clock_frequency)
|
This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time. |
The DW driver used by the RP2040 boards uses a Kconfig symbol to determine the clock speed of the board. This value was set incorrectly by the pico board to 100MHz (instead of 125). For the other boards, it wasn't set at all. This commit fixes the kconfig defaults. In the future, this value should be taken directly from the devicetree. This is not currently possible as there is no clock control driver for the RP2040 (see zephyrproject-rtos#52901). Signed-off-by: Yonatan Schachter <[email protected]>
The DW driver used by the RP2040 boards uses a Kconfig symbol to determine the clock speed of the board. This value was set incorrectly by the pico board to 100MHz (instead of 125). For the other boards, it wasn't set at all. This commit fixes the kconfig defaults. In the future, this value should be taken directly from the devicetree. This is not currently possible as there is no clock control driver for the RP2040 (see #52901). Signed-off-by: Yonatan Schachter <[email protected]>
I have added driver support for clock control for Raspberry Pi Pico. Currently external clock sources are not supported by this driver.