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: Serial: Refactored [tx/rx]-invert as generic uart properties #72947

Conversation

cx-anuj-pathak
Copy link
Contributor

Initially TX/RX-inverted capability is only supported in STM32 driver, But recently NXP and ESP driver support is also added. With these changes adding support in additional vendors will be easy

Copy link

Hello @cx-anuj-pathak, and thank you very much for your first pull request to the Zephyr project!
Our Continuous Integration pipeline will execute a series of checks on your Pull Request commit messages and code, and you are expected to address any failures by updating the PR. Please take a look at our commit message guidelines to find out how to format your commit messages, and at our contribution workflow to understand how to update your Pull Request. If you haven't already, please make sure to review the project's Contributor Expectations and update (by amending and force-pushing the commits) your pull request if necessary.
If you are stuck or need help please join us on Discord and ask your question there. Additionally, you can escalate the review when applicable. 😊

@ubieda ubieda self-requested a review May 17, 2024 14:27
@cx-anuj-pathak cx-anuj-pathak force-pushed the driver_uart_make_tx_rx_invert_property_generic branch 4 times, most recently from a1b3757 to a3fa092 Compare May 20, 2024 14:11
drivers/serial/Kconfig Outdated Show resolved Hide resolved
Copy link
Collaborator

@sylvioalves sylvioalves left a comment

Choose a reason for hiding this comment

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

LGTM, minor stuff.

@cx-anuj-pathak cx-anuj-pathak marked this pull request as ready for review May 21, 2024 11:43
@zephyrbot zephyrbot added area: UART Universal Asynchronous Receiver-Transmitter platform: NXP Drivers NXP Semiconductors, drivers platform: STM32 ST Micro STM32 platform: ESP32 Espressif ESP32 area: Devicetree Binding PR modifies or adds a Device Tree binding labels May 21, 2024
@cx-anuj-pathak cx-anuj-pathak force-pushed the driver_uart_make_tx_rx_invert_property_generic branch from a3fa092 to 9b6e98b Compare May 21, 2024 11:49
Copy link
Member

@erwango erwango left a comment

Choose a reason for hiding this comment

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

I'd suggest to split the change into several commit:

  • Add the new symbols in the header, define new bindings
  • Get the drivers to support the new bindings

drivers/serial/Kconfig Outdated Show resolved Hide resolved
drivers/serial/uart_esp32.c Outdated Show resolved Hide resolved
drivers/serial/Kconfig.stm32 Outdated Show resolved Hide resolved
@cx-anuj-pathak
Copy link
Contributor Author

I'd suggest to split the change into several commit:

  • Add the new symbols in the header, define new bindings
  • Get the drivers to support the new bindings

Sure I'll do that.

@cx-anuj-pathak cx-anuj-pathak force-pushed the driver_uart_make_tx_rx_invert_property_generic branch 2 times, most recently from 4e3f9b8 to 8591faa Compare May 22, 2024 05:01
@erwango erwango self-requested a review May 22, 2024 07:21
@ubieda
Copy link
Collaborator

ubieda commented May 22, 2024

FYI - CI Failures seem to be related to GH/CI issues. Let's re-run them after they're settled.

@cx-anuj-pathak cx-anuj-pathak force-pushed the driver_uart_make_tx_rx_invert_property_generic branch from 8591faa to 42704c3 Compare May 23, 2024 13:00
include/zephyr/drivers/uart.h Outdated Show resolved Hide resolved
@cx-anuj-pathak
Copy link
Contributor Author

@henrikbrixandersen @dcpleung @erwango @ubieda

Hi guys, I have planned simplify this PR, keeping in mind that runtime tx/rx inversion capability is not needed as of now.

  1. Remove SERIAL_SUPPORT_DATA_LINE_INVERSION KConfig variable.
  2. Have tx/rx-invert property in "uart-controller-pin-inversion.yaml" included by only supported driver dts bindings.
  3. Remove uart_config stucture changes from uart.h
  4. Create a private header file in drivers/serial directory to extend uart_config structure and Include that header and use that config structure in only supported driver.

Let me know if you have any objections. otherwise I'll proceed with suggested changes.

@henrikbrixandersen
Copy link
Member

@henrikbrixandersen @dcpleung @erwango @ubieda

Hi guys, I have planned simplify this PR, keeping in mind that runtime tx/rx inversion capability is not needed as of now.

  1. Remove SERIAL_SUPPORT_DATA_LINE_INVERSION KConfig variable.
  2. Have tx/rx-invert property in "uart-controller-pin-inversion.yaml" included by only supported driver dts bindings.
  3. Remove uart_config stucture changes from uart.h
  4. Create a private header file in drivers/serial directory to extend uart_config structure and Include that header and use that config structure in only supported driver.

Not sure a separate header is needed for this - can't we just keep these two booleans in the config structure of the drivers supporting it?

Otherwise sounds good to me.

@cx-anuj-pathak
Copy link
Contributor Author

cx-anuj-pathak commented May 25, 2024

@henrikbrixandersen @dcpleung @erwango @ubieda
Hi guys, I have planned simplify this PR, keeping in mind that runtime tx/rx inversion capability is not needed as of now.

  1. Remove SERIAL_SUPPORT_DATA_LINE_INVERSION KConfig variable.
  2. Have tx/rx-invert property in "uart-controller-pin-inversion.yaml" included by only supported driver dts bindings.
  3. Remove uart_config stucture changes from uart.h
  4. Create a private header file in drivers/serial directory to extend uart_config structure and Include that header and use that config structure in only supported driver.

Not sure a separate header is needed for this - can't we just keep these two booleans in the config structure of the drivers supporting it?

Otherwise sounds good to me.

Without extended config structure in a separate header file each driver file will have duplicates.
The way we will have a common yaml file for tx/rx dts property, i think it will be more streamlined if we have a common header file with extended structure too.
In any case that will be a separate commit, i have went ahead and pushed yaml changes.

EDIT: agreed to merge only yaml changes.

Refactored vendor-specific duplicates of uart tx/rx invert properties
into a common dts file uart-controller-pin-inversion.yaml

Signed-off-by: Anuj Pathak <anuj@croxel.com>
@ajarmouni-st ajarmouni-st removed the request for review from ABOSTM May 28, 2024 12:00
@cx-anuj-pathak
Copy link
Contributor Author

cx-anuj-pathak commented May 30, 2024

@henrikbrixandersen @erwango @dcpleung Can you please review the latest changes, I'm good with merging only yaml changes

@henrikbrixandersen henrikbrixandersen merged commit ac49a21 into zephyrproject-rtos:main May 31, 2024
21 checks passed
Copy link

Hi @cx-anuj-pathak!
Congratulations on getting your very first Zephyr pull request merged 🎉🥳. This is a fantastic achievement, and we're thrilled to have you as part of our community!

To celebrate this milestone and showcase your contribution, we'd love to award you the Zephyr Technical Contributor badge. If you're interested, please claim your badge by filling out this form: Claim Your Zephyr Badge.

Thank you for your valuable input, and we look forward to seeing more of your contributions in the future! 🪁

@cx-anuj-pathak cx-anuj-pathak deleted the driver_uart_make_tx_rx_invert_property_generic branch May 31, 2024 06:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Devicetree Binding PR modifies or adds a Device Tree binding area: UART Universal Asynchronous Receiver-Transmitter platform: ESP32 Espressif ESP32 platform: NXP Drivers NXP Semiconductors, drivers platform: STM32 ST Micro STM32
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants