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

drivers: udc: add support for USB device on Renesas RA USBFS HWIP #83358

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

Conversation

thenguyenyf
Copy link
Contributor

This PR to add support for USB device on USBFS port of Renesas RA family

  • Add missing uclk clock node on RA2A1
  • Remove old binding of renesas,ra-usb → renesas,ra-usbhs and renesas,ra-usbfs
  • Remove unused interrupts of USBHS device in Renesas RA dts
  • Add driver support for Renesas RA USBFS module
  • Add support for USB device on Renesas RA USBFS port

@zephyrbot
Copy link
Collaborator

zephyrbot commented Dec 24, 2024

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

Name Old Revision New Revision Diff
hal_renesas zephyrproject-rtos/hal_renesas@abca7ee zephyrproject-rtos/hal_renesas@fbac993 (main) zephyrproject-rtos/hal_renesas@abca7ee3..fbac9938

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 24, 2024
@thenguyenyf thenguyenyf marked this pull request as ready for review December 24, 2024 14:32
@zephyrbot zephyrbot added platform: Renesas RA Renesas Electronics Corporation, RA area: USB Universal Serial Bus labels Dec 24, 2024
tmon-nordic
tmon-nordic previously approved these changes Jan 9, 2025
thaoluonguw
thaoluonguw previously approved these changes Jan 21, 2025
@thaoluonguw
Copy link
Collaborator

@thenguyenyf : Please rebase to solve conflict.

@thenguyenyf thenguyenyf dismissed stale reviews from thaoluonguw and tmon-nordic via 94f4294 January 23, 2025 01:23
@thenguyenyf thenguyenyf force-pushed the support_renesas_ra_usbfs branch from 01764f3 to 94f4294 Compare January 23, 2025 01:23
@thenguyenyf
Copy link
Contributor Author

Last push to update the hal_renesas rev, because it was merged, and solve the conflict

@zephyrbot zephyrbot removed the DNM This PR should not be merged (Do Not Merge) label Jan 23, 2025
static struct udc_data udc_data_##id = {.mutex = Z_MUTEX_INITIALIZER(udc_data_##id.mutex), \
.priv = &udc_priv_##id}; \
\
static int udc_renesas_ra_driver_preinit_##id(const struct device *dev) \
Copy link
Collaborator

Choose a reason for hiding this comment

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

This can be normal function as you have dev parameter, no need to put it inside macro.

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

return -ENOTSUP; \
} \
\
uint32_t uclk_src = RA_CGC_CLK_SRC(DT_CLOCKS_CTLR(DT_NODELABEL(uclk))); \
Copy link
Collaborator

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.

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

\
static void udc_renesas_ra_thread_##n(void *dev, void *arg1, void *arg2) \
static int renesas_ra_usb_irq_config##id(const struct device *dev) \
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can be normal function, no need to place it inside macro.

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

{ \
renesas_ra_thread_handler(dev); \
} \
\
static void udc_renesas_ra_make_thread_##n(const struct device *dev) \
static void udc_renesas_ra_make_thread_##id(const struct device *dev) \
Copy link
Collaborator

Choose a reason for hiding this comment

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

Stray change, no need to introduce id.

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

.ep_cfg_out = ep_cfg_out##id, \
.make_thread = udc_renesas_ra_make_thread_##id, \
.speed_idx = DT_ENUM_IDX_OR(id, maximum_speed, UDC_BUS_SPEED_FS), \
.irq_config_func = renesas_ra_usb_irq_config##id}; \
Copy link
Collaborator

Choose a reason for hiding this comment

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

		.irq_config_func = renesas_ra_usb_irq_config##id
	};

Style issue, please fix it everywhere.

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

@thenguyenyf thenguyenyf force-pushed the support_renesas_ra_usbfs branch from 94f4294 to 1002014 Compare February 3, 2025 08:08
Update revision of hal_renesas module to add support of UDC on
Renesas RA USBFS module

Signed-off-by: The Nguyen <the.nguyen.yf@renesas.com>
Add missing clock node of uclk on Renesas RA2A1 SoC

Signed-off-by: The Nguyen <the.nguyen.yf@renesas.com>
First commit to add support for USBFS module on Renesas RA
- Remove renesas,ra-usb binding
- Add 2 new binding for Renesas RA USBFS and USBHS
- Remove unused interrupts of USBHS

Signed-off-by: The Nguyen <the.nguyen.yf@renesas.com>
Add device node of usbfs on Renesas RA SoC

Signed-off-by: The Nguyen <the.nguyen.yf@renesas.com>
Add phys-clock to usbhs node in case internal phys-clock-src is used

Signed-off-by: The Nguyen <the.nguyen.yf@renesas.com>
Add USB support on USBFS port on these boards:
- RA8: ek_ra8m1, ek_ra8d1, mck_ra8t1
- RA6: ek_ra6m1, ek_ra6m2, ek_ra6m3, ek_ra6m4, ek_ra6m5
- RA4: ek_ra4m2, ek_ra4m3

Signed-off-by: The Nguyen <the.nguyen.yf@renesas.com>
@thenguyenyf thenguyenyf force-pushed the support_renesas_ra_usbfs branch from 1002014 to 38610d4 Compare February 3, 2025 08:10
@thenguyenyf
Copy link
Contributor Author

Last push to rebase main branch and solve conflict

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: USB Universal Serial Bus manifest manifest-hal_renesas platform: Renesas RA Renesas Electronics Corporation, RA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants