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: Add reg-shift = <2>; to device tree #174

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

harrisonliew
Copy link

@harrisonliew harrisonliew commented Oct 14, 2021

Commit 72e4b60 made the I2C control registers 32-bit aligned to match the rest of the system. However, the OpenCores I2C driver (https://github.com/torvalds/linux/blob/master/drivers/i2c/busses/i2c-ocores.c) expects registers to be 8-bit aligned.

In cases where a user relies on a generated device tree instead of a custom one (e.g. in HiFive bootloaders https://github.com/sifive/freedom-u540-c000-bootloader/blob/master/fsbl/ux00_fsbl.dts#L300), the I2C block will not be functional because control registers will be improperly written. Setting reg-shift = <2>; this way allows the OpenCores driver to work properly by default.

This may break some custom drivers out there, but in the case of the Zephyr project driver (https://github.com/zephyrproject-rtos/zephyr/blob/main/drivers/i2c/i2c_sifive.c), this property is unused because it already expects 32-bit aligned registers.

Potentially addresses #154. Special thanks to @a0u for debugging.

Commit 72e4b60 made the I2C control registers 32-bit aligned to match the rest of the system. However, the OpenCores I2C driver (https://github.com/torvalds/linux/blob/master/drivers/i2c/busses/i2c-ocores.c) expects registers to be 8-bit aligned.

In cases where a user relies on a generated device tree instead of a custom one (e.g. in HiFive bootloaders https://github.com/sifive/freedom-u540-c000-bootloader/blob/master/fsbl/ux00_fsbl.dts#L300), the I2C block will not be functional because control registers will be improperly written. Setting `reg-shift = <2>;` this way allows the OpenCores driver to work properly by default.

This may break some custom drivers out there, but in the case of the Zephyr project driver (https://github.com/zephyrproject-rtos/zephyr/blob/main/drivers/i2c/i2c_sifive.c), this property is unused because it already expects 32-bit aligned registers.
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.

1 participant