I2C SW cleanups#605
Merged
Merged
Conversation
compute_timing_parameters() is only used by i2c_init(). Signed-off-by: Kinza Qamar <kqzaman@lowrisc.org>
Signed-off-by: Kinza Qamar <kqzaman@lowrisc.org>
Now that we are chip level I2C Host/Device tests, renaming existing i2c/smoketest with the functionality of the test seems reasonable. Signed-off-by: Kinza Qamar <kqzaman@lowrisc.org>
The only difference b/w them was that i2c_wait_read_finish() wasn't checking cmd_complete field of the intr_state register. In host mode, this interrupt is raised if the host issues a repeated START or terminates the transaction by issuing STOP. But OT's programming guide doesn't say anything about checking that field in case of a read transfer. I think it is better to check that field in case of Reads as it basically means that the transfer is completed. This also reduce the need of having 2 separate functions with just a difference of not checking cmd_complete field of the intr_state register. Signed-off-by: Kinza Qamar <kqzaman@lowrisc.org>
elliotb-lowrisc
approved these changes
Jun 8, 2026
elliotb-lowrisc
left a comment
Contributor
There was a problem hiding this comment.
Thanks for the improvements
ziuziakowska
approved these changes
Jun 8, 2026
| if (i2c_intr_state_reg & i2c_intr_cmd_complete) { | ||
| i2c_status i2c_status_reg = VOLATILE_READ(i2c->status); | ||
| if (i2c_status_reg & i2c_status_fmtempty) { | ||
| if (VOLATILE_READ(i2c->status) & i2c_status_fmtempty) { |
Contributor
There was a problem hiding this comment.
I think this is probably fine as-is, just with the name status.
Contributor
Author
There was a problem hiding this comment.
Hmm. status name will look inconsistent with the rest of the naming convention used within this function for registers.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Apart from 38ec242, every commit is addressing review comments in #473