Radxa CM3 and MCP2515

Hi,

I’m trying to add CAN compatibility to a Rock3 CM3 using the MCP2515 and I have some issues with it.
I’m using the following compilted .dts on the Radxa CM3 but I’m getting some erros when trying to initialize the MCP2515. The .dts has been extracted from Radxa overlays Github.
/dts-v1/;
/plugin/;

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/pinctrl/rockchip.h>
#include <dt-bindings/interrupt-controller/irq.h>

/ {

	metadata {
		title = "Enable MCP2515 on SPI3-M0 CS0";
		compatible = "radxa,rock-3c";
		category = "misc";
		exclusive = "GPIO4_B3", "GPIO4_A6", "GPIO4_B0", "GPIO4_B2", "GPIO0_C3";
		description = "Enable MCP2515 on SPI3-M0 CS0 with 8 MHz Crystal Oscillator.\nINT=GPIO22";
	};

	fragment@0 {
		target = <&pinctrl>;

		__overlay__ {
			mcp2515_int_pin {
				mcp2515_int_pin: mcp2515_int_pin {
					rockchip,pins = <0 RK_PC3 RK_FUNC_GPIO &pcfg_pull_none>;
				};
			};
		};
	};

	fragment@1 {
		target-path = "/";

		__overlay__ {
			can_mcp2515_osc: can-mcp2515-osc {
				compatible = "fixed-clock";
				clock-frequency = <8000000>;
				#clock-cells = <0>;
			};
		};
	};

	fragment@2 {
		target = <&spi3>;

		__overlay__ {
			status = "okay";
			max-freq = <10000000>;
			#address-cells = <1>;
			#size-cells = <0>;
			pinctrl-names = "default", "high_speed";
			pinctrl-0 = <&spi3m0_cs0 &spi3m0_pins>;
			pinctrl-1 = <&spi3m0_cs0 &spi3m0_pins_hs>;

			can_mcp2515: can-mcp2515@0 {
				status = "okay";
				compatible = "microchip,mcp2515";
				reg = <0>;
				interrupt-parent = <&gpio0>;
				interrupts = <RK_PC3 IRQ_TYPE_EDGE_FALLING>;
				spi-max-frequency = <10000000>;
				clocks = <&can_mcp2515_osc>;
				vdd-supply = <&vcc3v3_sys>;
				xceiver-supply = <&vcc3v3_sys>;
				pinctrl-names = "default";
				pinctrl-0 = <&mcp2515_int_pin>;
			};
		};
	};
};

The error that I’m getting is the following,

root@radxa-cm3-io:/home/rock# dmesg | grep spi
[    3.803976] mcp251x spi3.0: Looking up vdd-supply from device tree
[    3.804056] mcp251x spi3.0: Linked as a consumer to regulator.2
[    3.804175] mcp251x spi3.0: Looking up xceiver-supply from device tree
[    4.825238] mcp251x spi3.0: MCP251x didn't enter in conf mode after reset
[    4.825290] mcp251x spi3.0: Probe failed, err=16
[    4.825433] mcp251x: probe of spi3.0 failed with error -16

I’ve checked schematics and I cannot see any error on it. The funny thing is that the same board changing the SoM Radxa CM3 for a Raspberry Pi CM4, the MCP2515 works perfectly withou any issue.

Anyone have any idea on what is going on in terms of software?

Many thanks.

I am having simular issues with adding dtoverlays, however don’t you need to use the .dtbo from the compiled output rather then the .dts from source?