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

soc: renesas: ra: ra4m1: Migrate to FSP-based configuration #76794

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

soburi
Copy link
Member

@soburi soburi commented Aug 7, 2024

Change to use FSP to integrate with other Renesas RA series.

@soburi soburi added the DNM This PR should not be merged (Do Not Merge) label Aug 7, 2024
@zephyrbot
Copy link
Collaborator

zephyrbot commented Aug 7, 2024

The following west manifest projects have been modified in this Pull Request:

Name Old Revision New Revision Diff
hal_renesas zephyrproject-rtos/hal_renesas@1ec8891 zephyrproject-rtos/hal_renesas#36 zephyrproject-rtos/hal_renesas#36/files

Note: This message is automatically posted and updated by the Manifest GitHub Action.

Copy link
Collaborator

@KhiemNguyenT KhiemNguyenT left a comment

Choose a reason for hiding this comment

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

@soburi , I think you need to brush up the PR. There are some changes for RA2A1 are mixed into.

@KhiemNguyenT KhiemNguyenT self-assigned this Aug 21, 2024
@soburi soburi force-pushed the ra4m1_migrate_to_fsp branch 4 times, most recently from 0708bdb to b58b9d0 Compare September 1, 2024 08:26
@soburi
Copy link
Member Author

soburi commented Sep 2, 2024

@KhiemNguyenT

@soburi , I think you need to brush up the PR. There are some changes for RA2A1 are mixed into.

Update done.
I will remove DNM and proceed once the following PR in hal_renesas is approved.

zephyrproject-rtos/hal_renesas#31

@soburi soburi marked this pull request as ready for review September 2, 2024 05:43
@zephyrbot zephyrbot added area: GPIO area: Pinctrl platform: Renesas RA Renesas Electronics Corporation, RA area: Clock Control area: UART Universal Asynchronous Receiver-Transmitter labels Sep 2, 2024
Comment on lines 66 to 67
source = <RA_PLL_SOURCE_MAIN_OSC>;
div = <RA_PLL_DIV_2>;
Copy link
Member

Choose a reason for hiding this comment

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

wrong:

  • source: define another clock and make it source using eg clocks = <&main_osc>;
  • divider should be given as integer div = <2>;.

Copy link
Member Author

@soburi soburi Sep 6, 2024

Choose a reason for hiding this comment

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

@duynguyenxa @quytranpzz
Are these properties actually used?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@soburi , these properties are used to provide information for the bsp_clock_cfg.h in the hal layer:

#define BSP_CFG_PLL_SOURCE                                                                         \
	BSP_CLOCK_PROP_HAS_STATUS_OKAY_OR(DT_NODELABEL(pll), source, RA_PLL_SOURCE_DISABLE)
#define BSP_CFG_PLL_DIV BSP_CLOCK_PROP_HAS_STATUS_OKAY_OR(DT_NODELABEL(pll), div, RA_PLL_DIV_2)
#if DT_NODE_HAS_STATUS(DT_NODELABEL(pll), okay)

The BSP_CFG_PLL_SOURCE, and BSP_CFG_PLL_DIV BSP will be used in the bsp_clock_init() to configure PLL clock.

Copy link
Member

Choose a reason for hiding this comment

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

FYI: We can't have HALisms in DT.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@gmarull , the macro is defined in zephyr main repo, zephyr/include/zephyr/dt-bindings/clock/ra_clock.h

Copy link
Member

Choose a reason for hiding this comment

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

it still looks wrong, why isn't div = <2>? Are such values encoding what HAL expects?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@gmarull , sorry for late response, it's expect the value map with HWM here for the pll.
image

Copy link
Member Author

Choose a reason for hiding this comment

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

@duynguyenxa

The root of this problem is that the DeviceTree is a hardware description language,
and how values ​​are handled should not be mixed in here.
In other words, the DeviceTree should be able to describe semantic values; for example, if the division factor is 2, then it should be describable as "2", and it should be up to the implementation side, i.e., the .h or .c file, to convert this to bit notation.

Copy link
Member Author

Choose a reason for hiding this comment

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

I splitted out this issue to #78365.


pclka: pclka {
compatible = "renesas,ra-cgc-pclk";
clk_div = <RA_SYS_CLOCK_DIV_16>;
Copy link
Member

Choose a reason for hiding this comment

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

no underscores in properties please.

Copy link
Member Author

Choose a reason for hiding this comment

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

I have created #78097.
I will fix it after this PR is merged.

Comment on lines 14 to 15
help
Enable support for Renesas RA4M1 MCU series
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
help
Enable support for Renesas RA4M1 MCU series

Update HAL to improve the BSP clock setting process.

Signed-off-by: TOKITA Hiroshi <[email protected]>
Like some other string properties, I will add a derived form
to FULL_NAME to make it easier to reference from macros.

Signed-off-by: TOKITA Hiroshi <[email protected]>
Adding tests for DT_NODE_FULL_NAME_UNQUOTED(), DT_NODE_FULL_NAME_TOKEN(),
and DT_NODE_FULL_NAME_UPPER_TOKEN().

Signed-off-by: TOKITA Hiroshi <[email protected]>
Changes the path name of a DTS node so that it can be used
as the stem of a BSP macro.
All nodes to be changed are referenced via labels,
so only the name is changed.

Signed-off-by: TOKITA Hiroshi <[email protected]>
DeviceTree typically references the clock source using the `clocks`
property defined in `base.yaml`, so we'll change it to this.

Also delete the custom clock source definitions in
`renesas,ra-cgc-pclk-block.yaml`, `renesas,ra-cgc-pclk.yaml`, and
`renesas,ra-cgc-pll.yaml`.

Signed-off-by: TOKITA Hiroshi <[email protected]>
Move the process of replacing numerical values with macros to
the header, and set the division ratio in a numeric without
using macros in the device tree.

Change `clk-div` defined in `renesas,ra-cgc-pclk.yaml` to `div`.

Signed-off-by: TOKITA Hiroshi <[email protected]>
Adding the macros `RA_CGC_CLK_SRC` and `RA_CGC_CLK_DIV` that derive
the BSP clock settings from the DeviceTree node settings.
I also define some aliases to fill in the gaps with the BSP
naming conventions.

Signed-off-by: TOKITA Hiroshi <[email protected]>
Change to use FSP to integrate with other Renesas RA series.

Signed-off-by: TOKITA Hiroshi <[email protected]>
Since the Option Setting Memory area is set in FSP, the Kconfig value
switches between using the FSP implementation or the existing
Option Setting Memory implementation.

Signed-off-by: TOKITA Hiroshi <[email protected]>
Switch the pinctrl driver to renesas,ra-pinctrl-pfs which can be
used with FSP.

Signed-off-by: TOKITA Hiroshi <[email protected]>
Switch the clock controller driver to renesas,ra-cgc-pclkblock
which can be used with FSP.

Signed-off-by: TOKITA Hiroshi <[email protected]>
Update configuration for migrate to FSP

Signed-off-by: TOKITA Hiroshi <[email protected]>
Update configuration for migrate to FSP

Signed-off-by: TOKITA Hiroshi <[email protected]>
Remove the renesas,ra-pinctrl driver, which is no longer
needed after migrating to the FSP-based implementation.

Signed-off-by: TOKITA Hiroshi <[email protected]>
Remove the renesas,ra-clock-generation-circuit driver, which is no longer
needed after migrating to the FSP-based implementation.

Signed-off-by: TOKITA Hiroshi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Build System area: Clock Control area: Devicetree area: GPIO area: Pinctrl area: UART Universal Asynchronous Receiver-Transmitter DNM This PR should not be merged (Do Not Merge) manifest manifest-hal_renesas platform: Renesas RA Renesas Electronics Corporation, RA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants