why is gpiochip for I2C PCF8575 only created if present during boot

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

why is gpiochip for I2C PCF8575 only created if present during boot

Jump to solution
1,201 Views
bap3ball
Contributor III

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?

Labels (2)
0 Kudos
1 Solution
890 Views
bap3ball
Contributor III

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)

View solution in original post

0 Kudos
2 Replies
891 Views
bap3ball
Contributor III

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)

0 Kudos
889 Views
b36401
NXP Employee
NXP Employee

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!                                                                                       

-----------------------------------------------------------------------------------------------------------------------                                                            

0 Kudos