Skip to content

drivers: usb: rename UDC buffer to USB buffer #86920

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

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

Conversation

jfischer-no
Copy link
Collaborator

Rename it to USB buffers so we can use it in host support without
confusion. Keep the UDC_* macros for now, we can deprecate and remove
them later.

@jfischer-no jfischer-no added area: Drivers area: USB Universal Serial Bus Experimental Experimental features not enabled by default labels Mar 11, 2025
@jfischer-no jfischer-no added this to the v4.2.0 milestone Mar 11, 2025
@@ -25,7 +25,7 @@ config UDC_BUF_POOL_SIZE
help
Total amount of memory available for UDC requests.

config UDC_BUF_FORCE_NOCACHE
config USB_BUF_FORCE_NOCACHE
Copy link
Collaborator

Choose a reason for hiding this comment

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

already see it in drivers/usb/Kconfig.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Indeed, the config was supposedly moved but the old entry is not removed.

Move the common rounding pattern to the UDC_ROUND_UP macro.

Signed-off-by: Johann Fischer <[email protected]>
Let's organize the common USB driver headers in include.

Signed-off-by: Johann Fischer <[email protected]>
Move it to USB common so that it can be used on the host side in the
future.

Signed-off-by: Johann Fischer <[email protected]>
@@ -3,6 +3,13 @@
# Copyright (c) 2016 Wind River Systems, Inc.
# SPDX-License-Identifier: Apache-2.0

config USB_BUF_FORCE_NOCACHE
bool
Copy link
Collaborator

Choose a reason for hiding this comment

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

I wouldn't remove the prompt as part of rename macro commit.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Changing functional behavior is something that should not be done in rename commit.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Changing functional behavior is something that should not be done in rename commit.

Where did you get that?
What functional behavior has been changed that is not described in the commit message?

Copy link
Collaborator

Choose a reason for hiding this comment

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

The Kconfig symbol is now promptless.

Copy link
Collaborator Author

@jfischer-no jfischer-no Apr 23, 2025

Choose a reason for hiding this comment

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

It should not have a prompt. And now it is moved up one level and it must not have a prompt. Rather there also should be menu USB.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hi @jfischer-no Could you please help to explain why it should not have a prompt? Without prompt, it can't be configured in application. Take NXP USB controller as one example, USB_BUF_FORCE_NOCACHE can be true default. application can set it as false, then data is in cached ram and data size aligned with cache line size, NXP USB controller will do the cached data maintenance.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

then data is in cached ram and data size aligned with cache line size, NXP USB controller will do the cached data maintenance.

If your driver can handle it, the driver should not select this option at all.

Copy link
Collaborator

Choose a reason for hiding this comment

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

OK, I understand your point. My original thought is: USB_BUF_FORCE_NOCACHE can give option that can be selected by User/Application. For example: User put the USB transfer buffer to non-cached ram that is faster (internal ram) than cached ram (external ram) in order that CPU can process the USB data faster, then the USB_BUF_FORCE_NOCACHE can be enabled by application. Anyway the USB buffer of application can be put in non-cached ram even USB_BUF_FORCE_NOCACHE is disabled. But the stack's USB transfer buffer's location can only be controlled by USB_BUF_FORCE_NOCACHE, application can't control it.
If you think it should not be controlled by application, I don't see the strong request now.
After this is merged, I can create PR to not select USB_BUF_FORCE_NOCACHE default in NXP controller drivers.

@@ -25,7 +25,7 @@ config UDC_BUF_POOL_SIZE
help
Total amount of memory available for UDC requests.

config UDC_BUF_FORCE_NOCACHE
config USB_BUF_FORCE_NOCACHE
Copy link
Collaborator

Choose a reason for hiding this comment

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

Indeed, the config was supposedly moved but the old entry is not removed.

Rename it to USB buffers so we can use it in host support without
confusion. Keep the UDC_* macros for now, we can deprecate and remove
them later.

Move the UDC_BUF_FORCE_NOCACHE Kconfig option level up and also rename
it so that it can be used by the UHC drivers. Do not keep the prompt, as
it is not something a user would select in menuconfig.

Signed-off-by: Johann Fischer <[email protected]>
Allow to use DMAable buffers in UHC driver and host support.

Signed-off-by: Johann Fischer <[email protected]>
@@ -3,6 +3,13 @@
# Copyright (c) 2016 Wind River Systems, Inc.
# SPDX-License-Identifier: Apache-2.0

config USB_BUF_FORCE_NOCACHE
bool
Copy link
Collaborator

Choose a reason for hiding this comment

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

Changing functional behavior is something that should not be done in rename commit.

@Thalley Thalley removed their request for review April 27, 2025 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Bluetooth Audio area: Bluetooth area: Drivers area: Samples Samples area: USB Universal Serial Bus Experimental Experimental features not enabled by default platform: NXP Drivers NXP Semiconductors, drivers platform: NXP NXP
Projects
Status: In Review
Development

Successfully merging this pull request may close these issues.

4 participants