Created
October 27, 2020 06:28
-
-
Save pdp7/784d0ba8b9648d20ab055747ec945225 to your computer and use it in GitHub Desktop.
2xMCP2517FD-overlay.dts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Device tree overlay for mcp251x/mcp2517fd on spi0.0 | |
*/ | |
/dts-v1/; | |
/plugin/; | |
/ { | |
compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; | |
/* disable spi-dev for spi0.0 */ | |
fragment@0{ | |
target = <&spidev0>; | |
__overlay__ { | |
status = "disabled"; | |
}; | |
}; | |
fragment@1{ | |
target = <&spidev1>; | |
__overlay__ { | |
status = "disabled"; | |
}; | |
}; | |
/* the interrupt pin of the can-controller */ | |
fragment@2 { | |
target = <&gpio>; | |
__overlay__ { | |
can_int_pins: can_int_pins { | |
brcm,pins = <25 16>; | |
brcm,function = <0>; /* input */ | |
}; | |
spi1_pins: spi1_pins { | |
brcm,pins = <19 20 21>; | |
brcm,function = <3>; /* alt4 */ | |
}; | |
spi1_cs_pins: spi1_cs_pins { | |
brcm,pins = <26>; | |
brcm,function = <1>; /* output */ | |
}; | |
}; | |
}; | |
/* the clock/oscillator of the can-controller */ | |
fragment@3 { | |
target-path = "/clocks"; | |
__overlay__ { | |
/* external 40M oscillator of mcp2517fd on SPI0.0 */ | |
mcp2517fd_osc: mcp2517fd_osc { | |
compatible = "fixed-clock"; | |
#clock-cells = <0>; | |
clock-frequency = <40000000>; | |
}; | |
}; | |
}; | |
/* the spi config of the can-controller itself binding everything together */ | |
fragment@4 { | |
target = <&spi0>; | |
__overlay__ { | |
/* needed to avoid dtc warning */ | |
#address-cells = <1>; | |
#size-cells = <0>; | |
status = "okay"; | |
can0: can@0 { | |
reg = <0>; | |
pinctrl-names = "default"; | |
pinctrl-0 = <&can_int_pins>; | |
compatible = "microchip,mcp2517fd"; | |
spi-max-frequency = <125000000>; | |
interrupt-parent = <&gpio>; | |
interrupts = <25 8>; /* IRQ_TYPE_LEVEL_LOW */ | |
clocks = <&mcp2517fd_osc>; | |
}; | |
}; | |
}; | |
/* the spi config of the can-controller itself binding everything together */ | |
fragment@5 { | |
target = <&spi1>; | |
__overlay__ { | |
/* needed to avoid dtc warning */ | |
#address-cells = <1>; | |
#size-cells = <0>; | |
cs-gpios = <&gpio 26 1>; | |
status = "okay"; | |
can1: can@1 { | |
reg = <0>; | |
pinctrl-names = "default"; | |
pinctrl-0 = <&spi1_pins &spi1_cs_pins>; | |
compatible = "microchip,mcp2517fd"; | |
spi-max-frequency = <125000000>; | |
interrupt-parent = <&gpio>; | |
interrupts = <16 8>; /* IRQ_TYPE_LEVEL_LOW */ | |
clocks = <&mcp2517fd_osc>; | |
}; | |
}; | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@alexbewley Ok, here's the details. Right now, I'm running a Raspberry Pi4.
/boot/config.txt
is:Kernel version is
Linux pi4 5.15.24-v8+ #1526 SMP PREEMPT Fri Feb 18 14:59:51 GMT 2022 aarch64 GNU/Linux
.Userland is arm64-Raspbian based on Debian Bullseye.
Here's the relevant detection part from
dmesg
: