Hi,
I’m trying to write a custom overlay file to connect an MCP2515 CAN driver. I used the overlay file for the Raspberry Pi as reference (raspberry_kernel_mptcp/mcp2515-can0-overlay.dts at master · Ysurac/raspberry_kernel_mptcp · GitHub) and tried to modify it for the VIM 3L:
/dts-v1/;
/plugin/;
/ {
/* disable spi-dev for spi1.0 */
fragment@0 {
target = <&spicc1>;
__overlay__ {
status = "okay";
spidev@0 {
status = "disabled";
};
};
};
/* the interrupt pin of the can-controller */
fragment@1 {
target = <&pinctrl_periphs>;
__overlay__ {
can0_pins: can0_pins {
mux {
groups = "GPIOZ_15";
function = "gpio_periphs";
input-enable;
};
};
};
};
/* the clock/oscillator of the can-controller */
fragment@2 {
target-path = <&clks>;
__overlay__ {
/* external oscillator of mcp2515 on SPI1.0 */
can0_osc: can0_osc {
compatible = "fixed-clock";
#clock-cells = <0>;
clock-frequency = <16000000>;
};
};
};
/* the spi config of the can-controller itself binding everything together */
fragment@3 {
target = <&spicc1>;
__overlay__ {
can0: mcp2515@0 {
status = "okay";
reg = <0>;
compatible = "microchip,mcp2515";
pinctrl-names = "default";
pinctrl-0 = <&can0_pins>;
spi-max-frequency = <10000000>;
interrupt-parent = <&gpio>;
interrupts = <426 2>;
clocks = <&can0_osc>;
};
};
};
__overrides__ {
oscillator = <&can0_osc>,"clock-frequency:0";
spimaxfrequency = <&can0>,"spi-max-frequency:0";
interrupt = <&can0_pins>,"pins:0",<&can0>,"interrupts:0";
};
};
The interrupt is connect to pin 39 (GPIODZ_15) of the 40 pin IO connector.
But the ‘make kernel’ build command fails at dtc with the error message:
dtc: scripts/dtc/livetree.c:543: get_node_by_phandle: Assertion '(phandle != 0) && (phandle != -1)' failed