Jump to content

Recommended Posts

Posted

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.

Posted

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!

Posted
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 ?

Posted

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!

Posted

Now browsing Kernel mainline ive seen that driver was removed after v4.12.......

EDIT: It is moved to pinctrl driver folder :)

Posted

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....

mcp400.PNG

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines