Skip to content

Conversation

@andrei-edward-popa
Copy link
Contributor

I have added driver support for clock control for Raspberry Pi Pico. Currently external clock sources are not supported by this driver.

@zephyrbot zephyrbot added area: Clock Control area: Watchdog Watchdog manifest-hal_rpi_pico area: Devicetree Binding PR modifies or adds a Device Tree binding area: UART Universal Asynchronous Receiver-Transmitter labels Dec 8, 2022
@andrei-edward-popa andrei-edward-popa force-pushed the rpi_pico_clock_control branch 4 times, most recently from 0ee27a1 to 116cc05 Compare December 8, 2022 16:01
@zephyrbot zephyrbot added the area: SPI SPI bus label Dec 8, 2022
@zephyrbot zephyrbot requested a review from teburd December 8, 2022 16:01
@yonsch yonsch added platform: Raspberry Pi Pico Raspberry Pi Pico (RPi Pico) labels Dec 8, 2022
@andrei-edward-popa andrei-edward-popa force-pushed the rpi_pico_clock_control branch 5 times, most recently from 7d4d910 to fda9ad9 Compare December 9, 2022 10:43
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]>
@andrei-edward-popa andrei-edward-popa force-pushed the rpi_pico_clock_control branch 4 times, most recently from 898127a to 200203a Compare March 18, 2023 22:04
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]>
@andrei-edward-popa andrei-edward-popa force-pushed the rpi_pico_clock_control branch 2 times, most recently from 047fca1 to 12a539f Compare March 18, 2023 22:52
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]>
Copy link
Contributor

@yonsch yonsch left a 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)

Copy link
Contributor

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

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

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

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)

@github-actions
Copy link

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.

@github-actions github-actions bot added the Stale label May 19, 2023
@github-actions github-actions bot closed this Jun 2, 2023
yonsch added a commit to yonsch/zephyr that referenced this pull request Jun 3, 2023
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]>
nashif pushed a commit that referenced this pull request Jun 5, 2023
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Clock Control area: Devicetree Binding PR modifies or adds a Device Tree binding area: SPI SPI bus area: UART Universal Asynchronous Receiver-Transmitter area: Watchdog Watchdog manifest-hal_rpi_pico platform: Raspberry Pi Pico Raspberry Pi Pico (RPi Pico) Stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants