Using MCP23008 over i2c

In an upcoming version of our application, we’ve added some ICs to one of the i2c busses on the Xavier NX - I’ve got the AT24CS32 chip working fine (using the AT24) driver, so I know the i2c bus itself is working.

I’m having trouble with the three MCP23008 chips (i2c addresses 0x20, 0x21 and 0x22) - I can see them fine with i2cdetect, but it’s not clear to me how I’m supposed to attach the Linux GPIO driver to them.

I’ve created a devicetree overlay file (which does work for the AT24CS32), but I don’t see any indication of the MCP23008 devices being detected by the kernel. I have tried rebuilding the kernel with CONFIG_PINCTRL_MCP23S08_I2C=y but that doesn’t seem to help either.

The documentation on this driver is very thin on the ground - can someone point at what I’m doing wrong?

Here’s the .dts overlay I’m using (trimmed to only show one working and one nonworking device):

/dts-v1/;
/plugin/;
/{
        compatible = "nvidia,p3509-0000+p3668-0000\0nvidia,p3509-0000+p3668-0001
";
        overlay-name = "Olyns i2c devices Overlay";
        jetson-header-name = "Jetson 40pin Header";

        fragment@0 {
                target-path = "/";
                __overlay__ {
                        i2c@31e0000{
                                   compatible = "nvidia,tegra194-i2c";
                                   gpio@20 {
                                                   compatible = "microchip,mcp23008";
                                                   gpio-controller;
                                                   #gpio-cells = <2>;
                                                   reg = <0x20>;
                                                   status = "okay";
                                                   };
                                   at24@50 {
                                           compatible = "atmel,24c32","at24";
                                           reg = <0x50>;
                                           pagesize = <32>;
                                           size = <4096>;
                                           address-width = <16>;
                                           };
                                       };
                                };
                };
};

Hm, after posting this, I looked at /proc/config.gz, and it looks like the driver is not actually there:
# CONFIG_PINCTRL_MCP23S08 is not set

…I’ll have to try more explicitly. I definitely added it to the config, but maybe I did something wrong.

hello riz94107,

may I know which Jetpack release version you’re working with?
you may check release tag, $ cat /etc/nv_tegra_release for confirmation.

is the kernel image update correctly?
or… may I know your steps to update the kernel image?

The problem was (apparently) I needed to use CONFIG_PINCTRL_MCP23S08, not CONFIG_PINCTRL_MCP23S08_I2C - after rebuilding the kernel again, it works (with the overlay) now.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.