pmlody Posted September 8, 2017 Posted September 8, 2017 Hello. I need use MCP23017 extension. I have found kernel module gpio-mcp23s08. I have trouble with dtb overlay. I have only found RPi overlay. Can anyone have or can help with write correct overlay? I am using MCP with I2C bus at 0x20 address.
martinayotte Posted September 8, 2017 Posted September 8, 2017 Post the RPi overlay version here, we can probably just tweak it.
meda Posted July 8, 2018 Posted July 8, 2018 Hi all, Im runing latest stable version xenial and i had to upgrade to 4.14.18, nanopi duo, but i could not find gpio-mcp23s08 module? Here is dts file iv based on online example. /dts-v1/; /plugin/; / { compatible = "allwinner,sun8i-h3"; fragment@0 { /* This fragment is required only if using interrupts */ target = <&pio>; __overlay__ { mcp23017_pin_irq: mcp23017_pin_irq { pins = "PG11"; function = "irq"; bias-pull-up; }; }; }; fragment@1 { target = <&i2c0>; __overlay__ { #address-cells = <1>; #size-cells = <0>; mcp23017@20 { compatible = "microchip,mcp23017"; reg = <0x20>; status = "okay"; gpio-controller; #gpio-cells = <2>; /* Below are optional properties for supporting interrupts */ interrupt-controller; #interrupt-cells = <2>; interrupt-parent = <&pio>; interrupts = <0 363 2>; /* PG11 IRQ_TYPE_EDGE_FALLING */ pinctrl-names = "default"; pinctrl-0 = <&mcp23017_pin_irq>; }; }; }; }; But of course i cannot see mcp23017 in list once i run: ls -l /sys/class/gpio/. I know hw is ok and working good as if i use i2c detect i can see it at addr 0x20 also with i2cset i can manually trigger mcp230xx changes. Can someone give nay hint where to look now and how to bind overlay to correct module? Thanks!
martinayotte Posted July 8, 2018 Posted July 8, 2018 2 hours ago, meda said: gpio-mcp23s08 module BTW, I presume your module is MCP2308, not MCP23S08, since "S" means SPI ... Do you have ' status = "okay"; ' on the i2c itself ?
meda Posted July 8, 2018 Posted July 8, 2018 Yes sorry for not being clear, im using MCP23017 an i2c port expander. If i understood good in mainline kernel gpio-mcp23s08 is used for 4 differnet devices. https://www.kernel.org/doc/Documentation/devicetree/bindings/gpio/gpio-mcp23s08.txt Quote Do you have ' status = "okay"; ' on the i2c itself ? Not sure what you mean by this... I2C overlay works good as from user space i can control MCP23017 without any problem, but i want to implement it on system level so it can be used by other libraries that are talking with linux level gpio. Ive followed this overlay, and applied changes that are specific for mcp device: https://github.com/armbian/sunxi-DT-overlays/blob/master/examples/i2c-pca857x.dts I think that overlay looks good but i think problem is that gpio-mcp23s08 is missing from my install (find /lib/modules/$(uname -r) -type f -name '*.ko*'), sorry for noob questions, catching up on this stuff now Thanks!
meda Posted July 9, 2018 Posted July 9, 2018 Ive also tried to build kernel following https://docs.armbian.com/Developer-Guide_Build-Preparation/ Unfortuanately in Device Drivers > GPIO Support> i2c gpio expanders i could not find mcp23xxx series driver. Is there any info how i can buld this driver module? It seems gpio-mcp23s08 driver is located in mainline for a while already.... Thank you!
meda Posted July 9, 2018 Posted July 9, 2018 Now browsing Kernel mainline ive seen that driver was removed after v4.12....... EDIT: It is moved to pinctrl driver folder
meda Posted July 9, 2018 Posted July 9, 2018 Hi all, After building complete image on my own (v4.14.54) wiht included pincrtl-mcp23c08 i was able to test overlay i posted before and its workign good. I havent had any need to modprobe driver, just applied overlay and it appeared in sys. IN my case it started from linux gpio 400. Maybe someone find this interesting for future. Still have to test interrupt pins....
Recommended Posts