Skip to content

[ot] Fix EarlGrey GPIO DIRECT_OUT/DIRECT_OE readback#329

Merged
luismarques merged 1 commit into
lowRISC:ot-10.2.0from
moidx:gpio-fixes
Jun 1, 2026
Merged

[ot] Fix EarlGrey GPIO DIRECT_OUT/DIRECT_OE readback#329
luismarques merged 1 commit into
lowRISC:ot-10.2.0from
moidx:gpio-fixes

Conversation

@moidx
Copy link
Copy Markdown

@moidx moidx commented Jun 1, 2026

ot_gpio_eg_read() returned s->regs[reg] for DIRECT_OUT and DIRECT_OE. Those register slots are only updated on a direct write, but firmware that drives outputs through MASKED_OUT_{LOWER,UPPER} / MASKED_OE_{LOWER,UPPER} updates s->data_out / s->data_oe and never the DIRECT_* register slots. As a result a value set via a masked write was not observable through a DIRECT_OUT read, which read back as 0.

DIRECT_OUT and the MASKED_OUT registers are alternate views of the same output data register on real hardware (likewise DIRECT_OE and MASKED_OE), so return the live s->data_out / s->data_oe instead.

@moidx moidx requested review from cfrantz and luismarques June 1, 2026 02:10
@moidx moidx changed the title hw/opentitan: fix Earlgrey GPIO DIRECT_OUT/DIRECT_OE readback [ot] Fix EarlGrey GPIO DIRECT_OUT/DIRECT_OE readback Jun 1, 2026
… readback

ot_gpio_eg_read() returned s->regs[reg] for DIRECT_OUT and DIRECT_OE.
Those register slots are only updated on a direct write, but firmware
that drives outputs through MASKED_OUT_{LOWER,UPPER} /
MASKED_OE_{LOWER,UPPER} updates s->data_out / s->data_oe and never the
DIRECT_* register slots. As a result a value set via a masked write was
not observable through a DIRECT_OUT read, which read back as 0.

DIRECT_OUT and the MASKED_OUT registers are alternate views of the same
output data register on real hardware (likewise DIRECT_OE and MASKED_OE),
so return the live s->data_out / s->data_oe instead.

Signed-off-by: Miguel Osorio <miguelosorio@google.com>
@luismarques luismarques merged commit f5d0d11 into lowRISC:ot-10.2.0 Jun 1, 2026
7 of 10 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