I'm trying to get mcp25xxfd device to work on OpenWRT. Currently I'm using ramips platform (Linux Kernel version is 4.14.180). I have the following configuration in one of my DTS files:
osc: oscillator {
compatible = "fixed-clock";
clock-frequency = <40000000>;
};
spidev1 {
compatible = "spi-gpio";
gpio-sck = <&gpio0 25 GPIO_ACTIVE_HIGH>;
gpio-mosi = <&gpio0 26 GPIO_ACTIVE_HIGH>;
gpio-miso = <&gpio0 27 GPIO_ACTIVE_HIGH>;
cs-gpios = <&gpio0 28 GPIO_ACTIVE_HIGH>;
num-chipselects = <1>;
can0: mcp2517fd@0 {
compatible = "microchip,mcp2517fd";
status = "okay";
clock-names = "can0_osc";
clocks = <&osc>;
reg = <0>;
spi-max-frequency = <16000000>;
interrupt-parent = <&gpio0>;
interrupts = <11>;
};
};
However, when I try to probe it using insmod utility, I get error:
[ 30.522030] mcp25xxfd: probe of spi1.0 failed with error -2
If I comment out the following section
compatible = "spi-gpio";
gpio-sck = <&gpio0 25 GPIO_ACTIVE_HIGH>;
gpio-mosi = <&gpio0 26 GPIO_ACTIVE_HIGH>;
gpio-miso = <&gpio0 27 GPIO_ACTIVE_HIGH>;
cs-gpios = <&gpio0 28 GPIO_ACTIVE_HIGH>;
num-chipselects = <1>;
and try to create SPI device manually
insmod spi-gpio-custom bus0=1,25,26,27,0,1000000,28
and then again try to load mcp25xxfd, nothing happens:
root@Sensors:/# insmod mcp25xxfd
root@Sensors:/#
I can see spidev1.0 is on /dev, but no can0.
Can anyone help with this problem?