I’ve enabled the i2c-a0 bus and now I’m trying to add support for my MCP23008 GPIO expander on the bus at address 0x23:
$ ls -al /sys/class/i2c-dev/
total 0
drwxr-xr-x 2 root root 0 Dec 31 1969 .
drwxr-xr-x 88 root root 0 Dec 31 1969 ..
lrwxrwxrwx 1 root root 0 Dec 31 1969 i2c-0 -> ../../devices/platform/soc/c8100000.bus/c8100500.i2c/i2c-0/i2c-dev/i2c-0
lrwxrwxrwx 1 root root 0 Oct 24 11:05 i2c-1 -> ../../devices/platform/soc/c883a000.hdmi-tx/i2c-1/i2c-dev/i2c-1
$ i2cdetect -y 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- 23 -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
Here is the overlay:
/dts-v1/;
/plugin/;
/ {
compatible = "libretech,cc", "amlogic,s905x", "amlogic,meson-gxl";
fragment@0 {
target = <&i2c_AO>;
__overlay__ {
status = "okay";
};
};
fragment@1 {
target = <&gpio>;
__overlay__ {
mcp23008_pins: mcp23008_pins {
brcm,pins = <4>;
brcm,function = <0>;
};
};
};
fragment@2 {
target = <&i2c_AO>;
__overlay__ {
#address-cells = <1>;
#size-cells = <0>;
mcp23008: mcp@23 {
compatible = "microchip,mcp23008";
reg = <0x23>;
gpio-controller;
#gpio-cells = <2>;
#interrupt-cells=<2>;
interrupt-parent = <&gpio>;
interrupts = <4 2>;
interrupt-controller;
microchip,irq-mirror;
};
};
};
__overrides__ {
gpiopin = <&mcp23008_pins>,"brcm,pins:0",
<&mcp23008>,"interrupts:0";
addr = <&mcp23008>,"reg:0";
};
};
It compiles and merges just fine, but it turns out there is also no driver for that IC:
$ ls -al /lib/modules/6.1.26-05272-g26c406245a2c/kernel/drivers/gpio
total 212
drwxr-xr-x 1 root root 502 Jul 13 18:16 .
drwxr-xr-x 1 root root 580 Jul 13 18:16 ..
-rw-r--r-- 1 root root 11136 Apr 27 03:43 gpio-74x164.ko
-rw-r--r-- 1 root root 15464 Apr 27 03:43 gpio-adnp.ko
-rw-r--r-- 1 root root 13184 Apr 27 03:43 gpio-altera.ko
-rw-r--r-- 1 root root 8480 Apr 27 03:43 gpio-bd9571mwv.ko
-rw-r--r-- 1 root root 8168 Apr 27 03:43 gpio-gw-pld.ko
-rw-r--r-- 1 root root 18352 Apr 27 03:43 gpio-max3191x.ko
-rw-r--r-- 1 root root 6816 Apr 27 03:43 gpio-max7300.ko
-rw-r--r-- 1 root root 7176 Apr 27 03:43 gpio-max7301.ko
-rw-r--r-- 1 root root 6736 Apr 27 03:43 gpio-max730x.ko
-rw-r--r-- 1 root root 14544 Apr 27 03:43 gpio-max732x.ko
-rw-r--r-- 1 root root 7728 Apr 27 03:43 gpio-mc33880.ko
-rw-r--r-- 1 root root 8744 Apr 27 03:43 gpio-pca9570.ko
-rw-r--r-- 1 root root 18552 Apr 27 03:43 gpio-pcf857x.ko
-rw-r--r-- 1 root root 10648 Apr 27 03:43 gpio-pisosr.ko
-rw-r--r-- 1 root root 10808 Apr 27 03:43 gpio-syscon.ko
-rw-r--r-- 1 root root 8896 Apr 27 03:43 gpio-tpic2810.ko
-rw-r--r-- 1 root root 11440 Apr 27 03:43 gpio-xra1403.ko
A couple of questions,
Does the devicetree overlay look correct?
The mcp23008 driver is normally part of the Raspbian build but it’s not in the Libre port…
Is this intentional?
Is there a way for me to customize the Raspbian kernel to include this driver in the Libre port?
Do I need to move away from Raspbian and go to Ubuntu or a custom build of Armbian?