AnsweredAssumed Answered

Need to use an I2C device from mxc_restart(...)

Question asked by Steve Anderson on Oct 29, 2014
Latest reply on Nov 11, 2014 by Steve Anderson

I am porting a project into Yocto 3.10.17 from Linaro 3.0.35.

The PMIC is used to issue the system reset, but it needs an I2C interface.

The problem is that I2C support is shut down by the time mxc_restart(...) is called.

 

In Linaro they simply re-muxed the pins and bitbanged the message out to I2C2 using GPIO...

However, those APIs for the IOMUX no longer exist under the device tree implementation...

 

For the sake of not writing a whole lot of new code, I am inclined to port the equivalent steps, but I need guidance regarding how to access the IOMUX; particularly this far into the shutdown cycle.

 

So, ideally, I want to use the IOMUX to re-assign the pads used for I2C2 during runtime as GPIO;  I can then use the GPIO to send the necessary I2C command.

 

I have been unable to find example code for obtaining the IOMUX device, and I am not sure it is even there at this late stage in the shutdown process.

Furthermore, I have run across apparent moves to eliminate the pinctrl_get/put APIs - so I am not sure I want to use them in the long run, even if I can get an appropriate device pointer...  These pointers seem a bit circular and I am not sure where to begin...  To get a pinctrl I need a device, to get a device I need a driver, to get a driver I seem to need a bus, and I have not run across a way to get a bus without a device -- yet...

 

So, if someone can help me break this circle and access the IOMUX controller, it would be immensely appreciated.

However, if this is impractical then I suppose I can brute-force the IOMUX settings from my restart module...

I am just hoping someone might suggest a slightly more elegant solution.

Outcomes