Skip to content

[i2c, sw] Minor clean ups#687

Merged
martin-velay merged 2 commits into
lowRISC:mainfrom
KinzaQamar:clean-ups
Jul 20, 2026
Merged

[i2c, sw] Minor clean ups#687
martin-velay merged 2 commits into
lowRISC:mainfrom
KinzaQamar:clean-ups

Conversation

@KinzaQamar

Copy link
Copy Markdown
Contributor

No description provided.

A reviewer on lowRISC#633 commented about inconsistency in the naming
of tBUF timing parameter accross different places. That made me
look at the name of the bus_free_time_cycles field in the
i2c_timing_params_t struct and I realized that it is also
inconsistent.

Signed-off-by: Kinza Qamar <kqzaman@lowrisc.org>
Historically, it was there to clean up FMT FIFO since that
part was missing during errors. That still kept in place
at the start of read / write functions as a precautionary
step. I think this is no longer needed since clean up is
now done during errors in i2c_host_wait_transfer_finish().

Signed-off-by: Kinza Qamar <kqzaman@lowrisc.org>

@martin-velay martin-velay left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks Kinza for this cleanup.

I'd only suggest to add a comment to tell the user of i2c.h that they must always call i2c_wait_transfer_finish after each i2c_write_bytes/i2c_read_bytes.

Other than that, I just ran the i2c_host_tx_rx and the associated _cheri test, and everything pass.

@marnovandermaas marnovandermaas left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good to me, please do verify that the I2C regressions still pass with the expected pass rate.

@KinzaQamar

Copy link
Copy Markdown
Contributor Author

please do verify that the I2C regressions still pass with the expected pass rate.

The only test needs checking is i2c_host_tx_rx and i2c_host_tx_rx_cheri which @martin-velay already checked locally (thanks!). temperature_sensor test is checked in CI

I'd only suggest to add a comment to tell the user of i2c.h that they must always call i2c_wait_transfer_finish after each i2c_write_bytes/i2c_read_bytes.

There is a similar comment already exist here i2c.h#L121

@KinzaQamar
KinzaQamar added this pull request to the merge queue Jul 20, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Jul 20, 2026
@martin-velay
martin-velay added this pull request to the merge queue Jul 20, 2026
Merged via the queue into lowRISC:main with commit f61140a Jul 20, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants