I am working to convert an existing product from WinCE to Torizon.
We’ve run into an interesting problem with i2c.
I think we have a workaround, but it is not very elegant, and I hope you might have a better idea.
The product uses the Colibri iMX6DL and uses many i2c devices.
The PCBA for this product includes an RTC in the same way as the Toradex dev board.
The product only uses one i2c channel to comply with the standard Colibri family pin-out.
We can’t change the hardware design at this time as this is a released product.
One of the other i2c devices has the same address as the RTC, which is 0x68.
This product contains multiple instances of the device with address 0x68.
The hardware solution which was implemented for WinCE was to use multiple i2c multiplexors.
On power-up the multiplexors default to connecting the RTC to the Colibri.
WinCE then finds the RTC at boot time and reads the time from it.
Then our firmware takes control of the i2c bus and sets the multiplexors to access each device.
This works well for WinCE.
This scheme does not work well on Linux because the device tree instantiates an RTC device on address 0x68. The kernel then reserves address 0x68 for its RTC driver.
If we try to access one of the non-RTC devices which have the same i2c address then the kernel denies our request.
We are able to access all the other i2c devices which use different i2c addresses.
If we edit the device tree to disable the RTC then the kernel does not reserve access to address 0x68. We can then access all of the i2c devices in our system.
But the downside of this is that all of the kernel RTC features are disabled, which is unfortunate.
A potential solution to this problem is for us to control the RTC directly from our firmware and take over responsibility for time management from the kernel. We’d rather not do that as the kernel normally does a good job of taking care of this.
Before we invest time in doing that, does anyone have a suggestion for a more elegant solution?
A way to share i2c address 0x68 between the kernel and user space?