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

i2c: Bug fixes for default RTIO handler #79890

Merged
merged 3 commits into from
Oct 22, 2024

Conversation

teburd
Copy link
Collaborator

@teburd teburd commented Oct 15, 2024

TXRX is meant specifically to handle a full duplex bus like SPI, I2C is half duplex meaning only read or write can be performed at once. Drop TXRX from the default handler.

Each transaction should result in a single call to i2c_transfer. This corrects the default handler to do just that. Also simplifies the various helpers here.

ubieda
ubieda previously approved these changes Oct 18, 2024
@ubieda
Copy link
Member

ubieda commented Oct 18, 2024

Not sure why this PR didn't get review-requests.

@teburd teburd changed the title i2c: Drop TXRX from default RTIO handler i2c: Bug fixes for default RTIO handler Oct 18, 2024
TXRX is meant specifically to handle a full duplex bus like SPI, I2C is
half duplex meaning only read or write can be performed at once.

Drop TXRX as a supported operation code for the default I2C submission
path.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
@teburd teburd force-pushed the i2c_rtio_drop_txrx branch 3 times, most recently from 30417c4 to eff46a7 Compare October 18, 2024 15:08
@teburd teburd added the bug The issue is a bug, or the PR is fixing a bug label Oct 18, 2024
@teburd teburd added this to the 4.1 milestone Oct 18, 2024
@XenuIsWatching
Copy link
Member

looks like some tests may need to be updated... but I ported over this code to my default i3c rtio handler branch that I'm working on and it's looking as expected with 'restarts' in between transactions. Thanks for this!!

ubieda
ubieda previously approved these changes Oct 19, 2024
Copy link
Member

@ubieda ubieda left a comment

Choose a reason for hiding this comment

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

Code looks good! Approving assuming we take care of https://github.com/zephyrproject-rtos/zephyr/tree/main/tests/subsys/rtio/rtio_i2c.

@teburd teburd force-pushed the i2c_rtio_drop_txrx branch 2 times, most recently from 77186ea to d84d383 Compare October 22, 2024 13:59
Transactions from RTIO should result in single calls to i2c_transfer.
This corrects the default handler to first count the number of
submissions in the transaction, allocate on the stack, and then copy
over each submission to an equivalent i2c_msg.

It also cleans up the helper functions to be infallible, taking only the
submission and msg to copy to.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
Transactions should result in a single transfer call not multiple
transfer calls. Transceive isn't supported by i2c and so the TXRX op
isn't validated for success anymore.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
Copy link
Collaborator

@bjarki-andreasen bjarki-andreasen left a comment

Choose a reason for hiding this comment

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

Nice!

@teburd teburd assigned bjarki-andreasen and unassigned teburd Oct 22, 2024
@nashif nashif merged commit 5bd0912 into zephyrproject-rtos:main Oct 22, 2024
25 checks passed
@fabiobaltieri fabiobaltieri removed this from the 4.1 milestone Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: I2C area: RTIO bug The issue is a bug, or the PR is fixing a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants