Skip to content

Conversation

@thenguyenyf
Copy link
Contributor

@thenguyenyf thenguyenyf commented Dec 9, 2024

This PR to initial support for UHC driver on Renesas RA boards.

@zephyrbot
Copy link

zephyrbot commented Dec 9, 2024

The following west manifest projects have changed revision in this Pull Request:

Name Old Revision New Revision Diff

All manifest checks OK

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

@zephyrbot zephyrbot added manifest manifest-hal_renesas DNM This PR should not be merged (Do Not Merge) labels Dec 9, 2024
@thenguyenyf thenguyenyf force-pushed the support_renesas_ra_uhc branch 6 times, most recently from 9356bc5 to 68f0507 Compare December 23, 2024 03:07
@thenguyenyf thenguyenyf marked this pull request as ready for review December 23, 2024 04:28
@zephyrbot zephyrbot added platform: Renesas RA Renesas Electronics Corporation, RA area: Samples Samples area: USB Universal Serial Bus labels Dec 23, 2024
@thenguyenyf thenguyenyf force-pushed the support_renesas_ra_uhc branch from 68f0507 to 00f6cce Compare December 23, 2024 09:53
tmon-nordic
tmon-nordic previously approved these changes Jan 9, 2025
@fabiobaltieri fabiobaltieri added DNM (manifest) This PR should not be merged (controlled by action-manifest) and removed DNM This PR should not be merged (Do Not Merge) labels Feb 4, 2025
@facchinm facchinm mentioned this pull request Feb 6, 2025
16 tasks
@thenguyenyf thenguyenyf force-pushed the support_renesas_ra_uhc branch from 00f6cce to 3ce519d Compare February 17, 2025 08:58
@thenguyenyf
Copy link
Contributor Author

Last push just to rebase main

@thenguyenyf
Copy link
Contributor Author

Hello @jfischer-no. Is there any chance this PR could be merged? All review items have been fixed but this PR is still blocked due to your change request. Could you please review and verify?

Hello @thenguyenyf #82730 (comment) still not addressed, , there is not reason to add board overlays.

Hello @jfischer-no . Please verify it

Hello @jfischer-no . Could you please revisit and verify this change?

return -EINVAL;
}

usb_desc_endpoint_t ep0_desc = {.bLength = sizeof(usb_desc_endpoint_t),
Copy link
Contributor

Choose a reason for hiding this comment

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

Variable definition should be at the top of a block. Please fix style.
Why is the name ep0_desc?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. The name was changed to ep_desc

Copy link
Contributor

Choose a reason for hiding this comment

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

There is now unnecessary type conversion, please change it to

	const struct uhc_renesas_ra_config *config = dev->config;
	usb_desc_endpoint_t ep_desc = {
		.bDescriptorType = USB_DT_ENDPOINT,
		.bEndpointAddress = ep,
		.bmAttributes = {attrib},
		.wMaxPacketSize = mps,
		.bInterval = 0,
	};
	fsp_err_t err;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I fixed it

Comment on lines 16 to 19
bus-wait-cycles:
type: int
description: Specifies CPU bus access wait cycles

Copy link
Contributor

Choose a reason for hiding this comment

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

Stray change? I do not think it is UHC relevant. Where is it used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

This commit adds a new property that is already exclusively used in the HAL driver configuration. Devicetree should be used to configure drivers in Zephyr. The HAL driver or HAL module must not depend on anything from Zephyr. You have to fix it, see https://github.com/zephyrproject-rtos/zephyr/tree/main/modules, also there is no obligation to use HAL drivers.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Normal use case does not need to change this setting. Removed this property from Zephyr DT link and configure it as fixed in HAL.

static const struct uhc_renesas_ra_config uhc_config_##n = { \
.pcfg = PINCTRL_DT_DEV_CONFIG_GET(DT_INST_PARENT(n)), \
.make_thread = uhc_renesas_ra_create_thread_##n, \
.udev_count = DT_PROP_OR(DT_INST_PARENT(node_id), usb_devices_count, 10), \
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is it a DT property and why does it need to be configured per instance? I see it only used in the shim driver. Why is 10 default value?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This HWIP only support up to 10 devices connected to. So, the 0xb or higher address is invalid for this driver.

Copy link
Contributor

Choose a reason for hiding this comment

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

why does it need to be configured per instance? Are there SoC variants where it has a different value?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated. Currently all device instances are limited to 5 max. Fixed in source code.

@jfischer-no jfischer-no requested review from josuah and removed request for JarmouniA and nashif September 25, 2025 19:49
@thenguyenyf thenguyenyf force-pushed the support_renesas_ra_uhc branch from 9a10f10 to dc43286 Compare September 26, 2025 02:46
@thenguyenyf thenguyenyf force-pushed the support_renesas_ra_uhc branch from dc43286 to 6303874 Compare September 26, 2025 02:55
@thenguyenyf
Copy link
Contributor Author

Hello @jfischer-no . Could you please re-visit this PR and verify the change request?

Copy link
Contributor

@josuah josuah left a comment

Choose a reason for hiding this comment

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

Hello all.
Some few practical details which you might be interested in before pursuing.

@thenguyenyf
Copy link
Contributor Author

thenguyenyf commented Oct 24, 2025

The failed compliance job is not related to update from this PR, under fixing by #98173

@thenguyenyf thenguyenyf requested a review from josuah October 24, 2025 09:08
@josuah
Copy link
Contributor

josuah commented Oct 24, 2025

Thank you for the changes.

The CI should not raise this line as not changed by this patch but a small commit "fix coding style" at the beginning should fix it:

dts/arm/renesas/ra/ra8/ra8x1.dtsi:64 Expecting 1 space(s).
dts/arm/renesas/ra/ra8/ra8x1.dtsi:79 Expecting 0 space(s).
boards/renesas/ek_ra8d1/ek_ra8d1-pinctrl.dtsi:65 Expecting 2 new line(s)
cb81e85

In addition:

drivers/usb/uhc/uhc_renesas_ra.c:741 line length of 103 exceeds 100 columns

Minh Hoang and others added 4 commits October 24, 2025 10:07
First commit to support UHC driver for Renesas RA family

Signed-off-by: Minh Hoang <[email protected]>
Signed-off-by: The Nguyen <[email protected]>
Add device node to support UHC on Renesas RA SoCs

Signed-off-by: Minh Hoang <[email protected]>
Signed-off-by: The Nguyen <[email protected]>
Enable USB host support on Renesas RA boards

Signed-off-by: Minh Hoang <[email protected]>
Signed-off-by: The Nguyen <[email protected]>
Support USBH shell sample for renesas,ra-uhc

Signed-off-by: The Nguyen <[email protected]>
@thenguyenyf thenguyenyf force-pushed the support_renesas_ra_uhc branch from cb81e85 to 8ed3356 Compare October 24, 2025 10:08
@thenguyenyf
Copy link
Contributor Author

The failed compliance job is not related to update from this PR, under fixing by #98173

Rebase to get the workflow fix commit

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.

LGTM. Thanks.

@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.