I2C: Add reg-shift = <2>; to device tree#174
Open
Harrison Liew (harrisonliew) wants to merge 1 commit intosifive:masterfrom
Open
I2C: Add reg-shift = <2>; to device tree#174Harrison Liew (harrisonliew) wants to merge 1 commit intosifive:masterfrom
Harrison Liew (harrisonliew) wants to merge 1 commit intosifive:masterfrom
Conversation
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.
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.
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 Albert Ou (@a0u) for debugging.