Skip to content

Renesas ra2 #75740

Closed
avolkov-1221 wants to merge 10 commits intozephyrproject-rtos:mainfrom
avolkov-1221:renesas_ra2_poc
Closed

Renesas ra2 #75740
avolkov-1221 wants to merge 10 commits intozephyrproject-rtos:mainfrom
avolkov-1221:renesas_ra2_poc

Conversation

@avolkov-1221
Copy link
Contributor

This is an initial support of Renesas RA2L1 chips family and EK-RA2L1 eval board. Unlike the Renesas port, it does not require additional HAL modules.

@avolkov-1221 avolkov-1221 force-pushed the renesas_ra2_poc branch 2 times, most recently from feb2064 to c1b5e80 Compare July 13, 2024 17:51
@soburi soburi added the platform: Renesas RA Renesas Electronics Corporation, RA label Jul 14, 2024
Copy link
Member

@soburi soburi left a comment

Choose a reason for hiding this comment

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

There are several PRs to add support for RA2, including my own.
In my opinion, having multiple implementations makes maintenance difficult, so I think we should consolidate them.
I would also like to align RA4M1, which I created previously, with this one.

It would be easier to discuss if you submitted it as a patch to the existing drivers rather than adding an alternative driver.

@avolkov-1221
Copy link
Contributor Author

avolkov-1221 commented Jul 15, 2024

There are several PRs to add support for RA2, including my own.

Sorry, but could you give me this PR number ? I only see my and Renesas PRs.

In my opinion, having multiple implementations makes maintenance difficult, so I think we should consolidate them. I would also like to align RA4M1, which I created previously, with this one.

It would be easier to discuss if you submitted it as a patch to the existing drivers rather than adding an alternative driver.It will definitely be good to at least combine our work. I didn't do this because I don't have the RA4M1 hardware and can't test it.

It will definitely be good to at least merge our works. I didn't do this because I don't have the RA4M1 hardware and can't test it. Part of our implementations are close enough and didn't depends on external modules, like Renesas port do.

However Renesas provide very, very useful stuff like documentation and eval. board implementations.

@avolkov-1221 avolkov-1221 force-pushed the renesas_ra2_poc branch 3 times, most recently from 2a5807f to 05bc562 Compare July 15, 2024 12:44
@avolkov-1221 avolkov-1221 force-pushed the renesas_ra2_poc branch 6 times, most recently from 33eb5cd to 15956c4 Compare August 24, 2024 16:10
…ount"

The "channels-num" should not be used here, other system's parts are using
"channel-count" instead for the same purpose.

Also property's description has been сorrected.

Signed-off-by: Andrey VOLKOV <andrey.volkov@munic.io>
Add basic support for Renesas RA2L1 SOC series.

Signed-off-by: Andrey VOLKOV <andrey.volkov@munic.io>
Add initial clock control drivers set for Renesas RA2L1.

Signed-off-by: Andrey VOLKOV <andrey.volkov@munic.io>
…ture

Add initial Renesas RA LPM support and reference driver
for Renesas RA2L1 SOC.

Signed-off-by: Andrey VOLKOV <andrey.volkov@munic.io>
Add initial pinctrl support for Renesas RA2L1.

Signed-off-by: Andrey VOLKOV <andrey.volkov@munic.io>
…RA2L1

Add initial Interrupt Controller Unit (ICU) driver for Renesas RA2L1.

Signed-off-by: Andrey VOLKOV <andrey.volkov@munic.io>
Add initial GPIO driver for Renesas RA2L1.

Signed-off-by: Andrey VOLKOV <andrey.volkov@munic.io>
Add initial SCI UART driver for Renesas RA2L1.

Signed-off-by: Andrey VOLKOV <andrey.volkov@munic.io>
Add initial flash controller support for Renesas RA2L1.

Signed-off-by: Andrey VOLKOV <andrey.volkov@munic.io>
Add inital support for the Renesas EK-RA2L1 evaluation board.

Signed-off-by: Andrey VOLKOV <andrey.volkov@munic.io>
@@ -0,0 +1,3 @@
# SPDX-License-Identifier: Apache-2.0
Copy link
Member

Choose a reason for hiding this comment

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

Please put it into misc.


source "drivers/clock_control/Kconfig.renesas_ra_cgc"

source "drivers/clock_control/Kconfig.renesas_ra2"
Copy link
Member

Choose a reason for hiding this comment

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

Since having multiple implementations of the same control target is not desirable, I request that the existing implementation be used for the clock controller or improved.
The clock controller does not essentially depend on FSP, and I think the current implementation can work without FSP if some trivial functions are reimplemented.

Similarly, the interrupt controller and pinctrl are unrelated to FSP, so I think they should have a common implementation.

The interrupt controller will need to be addressed after merging #75946, which I have submitted, so please consider it after that.

As you pointed out, I think there are still some problems with the implementation that uses FSP for pinctrl, so I guess it is okay to leave it as it is for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@soburi could you escalate the #75946 ?
I agree that it will be better to use your new implementation then this obsoleted one. Actually I have already ISR implementation based on it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

About the clocks: I'm really thinking about how to better utilize both of them. So far, it's not very straightforward: one of the ideas used in our implementation is the use of fine-grained ref counters, which would allow the PM to switch off unused clocks in sleep modes (the DT support of the counters already in place). A good example of this functionality is when the CAN module is the sole client of the MOSC clock. However, I don't see such features in the FSP implementations.

Copy link
Member

Choose a reason for hiding this comment

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

About the clocks: I'm really thinking about how to better utilize both of them. So far, it's not very straightforward: one of the ideas used in our implementation is the use of fine-grained ref counters, which would allow the PM to switch off unused clocks in sleep modes (the DT support of the counters already in place). A good example of this functionality is when the CAN module is the sole client of the MOSC clock. However, I don't see such features in the FSP implementations.

Understood.
If you still need to consider whether it's optimal for other SoCs, I think it's fine to leave it as it is for now.
However, ultimately, there should be a single implementation for the RA family, so please design it assuming it will be integrated.

Copy link
Contributor

Choose a reason for hiding this comment

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

There are many nodes without the respective DTS bindings, so it is not possible to crosscheck them.
Could you introduce the nodes when you add the drivers in follow-up PRs?

return 0;
}

static int gpio_ra_port_set_masked_raw(const struct device *port,
Copy link
Contributor

Choose a reason for hiding this comment

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

gpio_port_set_masked_raw() may also set a pin to low physical level. Does the current implementation support this?

# Copyright (c) 2021-2024 MUNIC SA
# SPDX-License-Identifier: Apache-2.0

CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=480000000
Copy link
Member

Choose a reason for hiding this comment

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

@avolkov-1221 , Please recheck the value. Should this be only 48000000 (48MHz) as you're using hoco for sysclk source

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, thank you.

R_SCI_SEMR_RXDESEL_Msk
);

uart_ra_configure(dev, &data->ucfg);
Copy link
Member

@duynguyenxa duynguyenxa Aug 26, 2024

Choose a reason for hiding this comment

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

@avolkov-1221 , This function only available when CONFIG_UART_USE_RUNTIME_CONFIGURE is on, if user turn it off I assumed the SCI hardware wouldn't be configured?

Comment on lines +12 to +13
#ifndef __INCLUDE_DRIVERS_FLASH_FLASH_RA_H__
#define __INCLUDE_DRIVERS_FLASH_FLASH_RA_H__
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
#ifndef __INCLUDE_DRIVERS_FLASH_FLASH_RA_H__
#define __INCLUDE_DRIVERS_FLASH_FLASH_RA_H__
#ifndef __ZEPHYR_INCLUDE_DRIVERS_FLASH_FLASH_RA2_H__
#define __ZEPHYR_INCLUDE_DRIVERS_FLASH_FLASH_RA2_H__
Comment on lines +11 to +12
#ifndef __CLOCK_CONTROL_RA_PRIV_H__
#define __CLOCK_CONTROL_RA_PRIV_H__
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
#ifndef __CLOCK_CONTROL_RA_PRIV_H__
#define __CLOCK_CONTROL_RA_PRIV_H__
#ifndef __CLOCK_CONTROL_RA2_PRIV_H__
#define __CLOCK_CONTROL_RA2_PRIV_H__
- name: ra8t1
socs:
- name: r7fa8t1ahecbd
- name: ra2l1

Choose a reason for hiding this comment

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

Please move it up, after ra2a1.

Copy link
Contributor Author

@avolkov-1221 avolkov-1221 Aug 26, 2024

Choose a reason for hiding this comment

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

Done. Thank you.

BTW, could your team update the other SoCs (I mean RA8xx and RA6xx) according to this commit?

In my opinion, using the temperature and quality grade information in the names of the SoCs is useless. However, the socket type (referred to as "package type" in datasheets) defines the number of GPIOs and some peripherals, making it meaningful from a software perspective. Additionally, this can't be easily defined in DTS.

@KhiemNguyenT KhiemNguyenT self-requested a review August 26, 2024 14:30
Copy link

@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.

It sounds to me that some improvement feedback has not been addressed, esp. reuse the existing drivers rather than adding the new ones. And there's no explanation in review comments or in commit messages.
@avolkov-1221 please understand that RA2L1 will not stand alone. RA2A1 is one of its brothers and others will come. Your contribution to existing drivers and next ones are welcomed, but the implementation must be aligned across RA2 devices and other RA series, if there's no big reason to create a new ones.

To accelerate the review and get the patches merged, please consider a " PR for minimal support", without any changes which still need more discussion, dependency to another PR. Next ones should be driver support, such as LPM, ICU, etc. If you want to get the PR merge quickly, please consider to split the PRs.

Last but not least, this PR consumed much effort of many reviewers. I hope we can have focus on smaller PR from now. This is a reasonable request, right ?

@avolkov-1221
Copy link
Contributor Author

It sounds to me that some improvement feedback has not been addressed, esp. reuse the existing drivers rather than adding the new ones. And there's no explanation in review comments or in commit messages. @avolkov-1221 please understand that RA2L1 will not stand alone. RA2A1 is one of its brothers and others will come. Your contribution to existing drivers and next ones are welcomed, but the implementation must be aligned across RA2 devices and other RA series, if there's no big reason to create a new ones.

I haven't started the merge yet, except for the OFS, clocks, GPIO, and pinctrls, so I didn't have anything to reply to or comment on.

To accelerate the review and get the patches merged, please consider a " PR for minimal support", without any changes which still need more discussion, dependency to another PR. Next ones should be driver support, such as LPM, ICU, etc. If you want to get the PR merge quickly, please consider to split the PRs.

Well, it seems reasonable to separate the first commit from the others. But for the rest, that's not the case. They depend on each other.

Last but not least, this PR consumed much effort of many reviewers. I hope we can have focus on smaller PR from now. This is a reasonable request, right ?

Yes, I can freeze this PR and create new ones. Perhaps they won't be so ill-fated.

@github-actions
Copy link

github-actions bot commented Nov 1, 2024

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 Nov 1, 2024
@github-actions github-actions bot closed this Nov 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ADC Analog-to-Digital Converter (ADC) area: Clock Control area: Devicetree Binding PR modifies or adds a Device Tree binding area: Flash area: GPIO area: Interrupt Controller area: Pinctrl area: UART Universal Asynchronous Receiver-Transmitter platform: Renesas RA Renesas Electronics Corporation, RA platforms: Renesas RA Stale