Skip to contentSkip to conversation

gpio-mcp23s08 DT usage with shared chip select

DISCUSSION Nathan Williams 1 participant 1 message Jul 1, 2016 GPIO

lore
Share & tools
lore
#0 lore raw

Hi,

I'm using gpio-mcp23s08 for two MCP23S17 chips that use the same SPI chip select (and different addresses).

My device tree contains:

&spi0 {
        status = "okay";
        bus-num = <0>;
        num-cs = <2>;
        cs-gpios =
                <&portc 2 0>,
                <&portc 3 0>;

        gpio@1 {
                compatible = "microchip,mcp23s17";
                gpio-controller;
                #gpio-cells = <2>;
                microchip,spi-present-mask = <0x03>;
                reg = <1>;
                spi-max-frequency = <1000000>;
        };
};

The driver registers both gpiochips but both are labelled "mcp23s17" and I can't differentiate between the chips without probing the hardware.

I'd also like to be able to give each GPIO a name with gpio-line-names. What's the best way to achieve this? Add support to the driver for child DT nodes for each gpiochip?

Regards,
Nathan