News:

Attention: For security reasons,please choose a user name *different* from your login name.
Also make sure to choose a secure password and change it regularly.

Main Menu

why are the TE0720 CPLD I2C to GPIO blocks bound to "ti,pcf8574"

Started by bigguiness, February 02, 2023, 12:11:05 AM

Previous topic - Next topic

bigguiness

I noticed in the TE0720 BSP that the system-user.dtsi has this:

/* I2C need I2C1 connected to te0720 system controller ip */
&i2c1 {

    iexp@20 {       // GPIO in CPLD
        #gpio-cells = <2>;
        compatible = "ti,pcf8574";
        reg = <0x20>;
        gpio-controller;
    };

    iexp@21 {       // GPIO in CPLD
        #gpio-cells = <2>;
        compatible = "ti,pcf8574";
        reg = <0x21>;
        gpio-controller;
    };

    rtc@6F {        // Real Time Clock
        compatible = "isl12022";
        reg = <0x6F>;
    };
};


The rtc@6F binding makes sense but I don't understand why the CPLD I2C to GPIO blocks (iexp@20 and iexp@21) are bound to "ti,pcf8574".

If I check /sys/devices/soc0/amba/e0005000.i2c/i2c-1 I see the three devices. But only iexp@21 (and rtc@6F) is bound:
root@s6:/sys/devices/soc0/amba/e0005000.i2c/i2c-1# ls -la
total 0
drwxr-xr-x    7 root     root             0 Feb  1 15:34 .
drwxr-xr-x    4 root     root             0 Feb  1 15:34 ..
drwxr-xr-x    3 root     root             0 Feb  1 15:34 1-0020
drwxr-xr-x    5 root     root             0 Feb  1 15:34 1-0021
drwxr-xr-x    4 root     root             0 Feb  1 15:34 1-006f
--w-------    1 root     root          4096 Feb  1 15:51 delete_device
lrwxrwxrwx    1 root     root             0 Feb  1 15:51 device -> ../../e0005000.i2c
drwxr-xr-x    3 root     root             0 Feb  1 15:34 i2c-dev
-r--r--r--    1 root     root          4096 Feb  1 15:51 name
--w-------    1 root     root          4096 Feb  1 15:51 new_device
lrwxrwxrwx    1 root     root             0 Feb  1 15:51 of_node -> ../../../../../firmware/devicetree/base/amba/i2c@e0005000
drwxr-xr-x    2 root     root             0 Feb  1 15:51 power
lrwxrwxrwx    1 root     root             0 Feb  1 15:34 subsystem -> ../../../../../bus/i2c
-rw-r--r--    1 root     root          4096 Feb  1 15:34 uevent
root@s6:/sys/devices/soc0/amba/e0005000.i2c/i2c-1# ls 1-0020 -la
total 0
drwxr-xr-x    3 root     root             0 Feb  1 15:34 .
drwxr-xr-x    7 root     root             0 Feb  1 15:34 ..
-r--r--r--    1 root     root          4096 Feb  1 15:52 modalias
-r--r--r--    1 root     root          4096 Feb  1 15:52 name
lrwxrwxrwx    1 root     root             0 Feb  1 15:52 of_node -> ../../../../../../firmware/devicetree/base/amba/i2c@e0005000/iexp@20
drwxr-xr-x    2 root     root             0 Feb  1 15:52 power
lrwxrwxrwx    1 root     root             0 Feb  1 15:52 subsystem -> ../../../../../../bus/i2c
-rw-r--r--    1 root     root          4096 Feb  1 15:34 uevent
root@s6:/sys/devices/soc0/amba/e0005000.i2c/i2c-1# ls 1-0021 -la
total 0
drwxr-xr-x    5 root     root             0 Feb  1 15:34 .
drwxr-xr-x    7 root     root             0 Feb  1 15:34 ..
lrwxrwxrwx    1 root     root             0 Feb  1 16:04 driver -> ../../../../../../bus/i2c/drivers/pcf857x
drwxr-xr-x    3 root     root             0 Feb  1 15:34 gpio
drwxr-xr-x    3 root     root             0 Feb  1 15:34 gpiochip3
-r--r--r--    1 root     root          4096 Feb  1 16:04 modalias
-r--r--r--    1 root     root          4096 Feb  1 16:04 name
lrwxrwxrwx    1 root     root             0 Feb  1 16:04 of_node -> ../../../../../../firmware/devicetree/base/amba/i2c@e0005000/iexp@21
drwxr-xr-x    2 root     root             0 Feb  1 16:04 power
lrwxrwxrwx    1 root     root             0 Feb  1 16:04 subsystem -> ../../../../../../bus/i2c
-rw-r--r--    1 root     root          4096 Feb  1 15:34 uevent


I also see the probes during the boot:
root@s6:~# dmesg | grep 1-00
[    0.860928] pcf857x 1-0021: probed
[    0.863791] rtc-isl12022 1-006f: registered as rtc0
[    1.060969] rtc-isl12022 1-006f: setting system clock to 2023-02-01T22:34:17 UTC (1675290857)


Why doesn't iexp@20 get probed and bound?

Anyone know why these are in the device tree (and possibly how to use them)?

Thanks

JH

Hi,
this is a relict from older version of the CPLD. We didn't removed it from TE0720 reference design until now. We didn't use drivers for testen and we changed code over the time...
Use simple use I2C get and I2C set function to get access if needed.
br
John