imx6sx hardware platform.
Linux version 3.14.52-1.1.
We have a platform in which some of the I2C PCF8575 GPIO expander devices located on the I2C bus are not present until after the system is booted. All of the potential devices are listed in the device tree and entries for each potential devices does show up in the /sys/bus/i2c/devices subfolders. However, only the only devices which show up in the /sys/class/gpio folder as a gpiochip<number> are ones that are powered on when the kernel boots.
On a previous platform that uses an embedded PowerPC CPU, gpiochip<number> nodes are created for all potential devices specified in the device tree regardless if they are present during boot or not.
Does anyone know if this an architecture difference in how I2C GPIO expanders are handled?
What would be the proper method to add the missing chips as gpio controllers chips after boot?
已解决! 转到解答。
Turns out this is just the way the kernel now creates gpiochip's in the sysfs; the chip has to be discovered and not just in the device tree. My PowerPC system used an older version of Linux that created the gpiochip's based on device tree and not what was discovered. My solution was to remove the 8575 from device tree and access them as simple I2C devices (not as GPIO)
Turns out this is just the way the kernel now creates gpiochip's in the sysfs; the chip has to be discovered and not just in the device tree. My PowerPC system used an older version of Linux that created the gpiochip's based on device tree and not what was discovered. My solution was to remove the 8575 from device tree and access them as simple I2C devices (not as GPIO)
I can suggest to try to perform early initialization of GPIO similar to UART early initialization.
Also you can refer this document regarding to early userspace support:
https://www.kernel.org/doc/readme/Documentation-early-userspace-README
Have a great day,
Victor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------