Page MenuHomeFreeBSD

rk_gpio: Fix register read/write on rk3568
ClosedPublic

Authored by devivanov_proton.me on Sep 13 2025, 2:01 PM.
Tags
None
Referenced Files
F131997078: D52512.id161977.diff
Sun, Oct 12, 7:42 PM
Unknown Object (File)
Fri, Oct 10, 5:19 AM
Unknown Object (File)
Thu, Oct 9, 11:53 PM
Unknown Object (File)
Thu, Oct 9, 11:53 PM
Unknown Object (File)
Thu, Oct 9, 11:53 PM
Unknown Object (File)
Thu, Oct 9, 11:53 PM
Unknown Object (File)
Thu, Oct 9, 8:57 PM
Unknown Object (File)
Thu, Oct 9, 7:58 PM
Subscribers

Details

Summary

Not all registers have a write mask with high/low register on rk3568.

Test Plan

Tested via gpioctl(1). This bug effected gpio inputs >= 16 as well as interrupts >= 16

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

sys/arm64/rockchip/rk_gpio.c
146

This should be a pointer, instead of copying the struct.

sys/arm64/rockchip/rk_gpio.c
146

Is it better when the struct is only 2 bytes?

sys/arm64/rockchip/rk_gpio.c
146

I don't think it would matter much. At the end of the day the assembly will look very similar once optimized. But in theory, one copies the struct to the stack then reads it's members by dereferencing offsets on the stack, while the other reads it's members by dereferencing offsets on the passed pointer.

Use a reference instead of copying struct

I don't have the hardware to test this, but cross referencing the documentation, it looks good to me.

sys/arm64/rockchip/rk_gpio.c
180

Are we intentionally not preserving the old value here?

This revision is now accepted and ready to land.Thu, Sep 25, 9:18 AM
This revision was automatically updated to reflect the committed changes.