-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Description
As I have just figured out how to implement the mcp2515 as an overlay configuration (without spi-config)
Maybe you want to help all the people who still rely on an externally compiled 3.12.X to make CAN-bus work out of the box by including the can drivers for the mcp2515.
What would be essentially needed is enabling the following:
CONFIG_CAN=m
CONFIG_CAN_RAW=m
CONFIG_CAN_BCM=m
CONFIG_CAN_GW=m
CONFIG_CAN_VCAN=m
CONFIG_CAN_DEV=m
CONFIG_CAN_CALC_BITTIMING=y
CONFIG_CAN_MCP251X=m
(maybe a few of the other USB devices as well)
On top of that you might also want to add the following overlay mcp2515-can0:
/*
* Device tree overlay for mcp251x - can0 on spi0.0
*/
/dts-v1/;
/plugin/;
/ {
compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709";
fragment@0 {
target = <&spi0>;
__overlay__ {
status = "okay";
spidev@0{
status = "disabled";
};
};
};
fragment@1 {
target = <&gpio>;
__overlay__ {
can0_pins: can0_pins {
brcm,pins = <25>;
brcm,function = <0>; /* input */
};
};
};
fragment@2 {
target = <&spi0>; /* this is ugly, but it works until we get /clocks */
__overlay__ {
/* external oscillator of mcp2515 on SPI0.0 */
can0_osc: can0_osc {
compatible = "fixed-clock";
#clock-cells = <0>;
clock-frequency = <16000000>;
};
};
};
fragment@3 {
target = <&spi0>;
__overlay__ {
/* needed to avoid dtc warning */
#address-cells = <1>;
#size-cells = <0>;
can0: mcp2515@0 {
reg = <0>;
compatible = "microchip,mcp2515";
pinctrl-names = "default";
pinctrl-0 = <&can0_pins>;
spi-max-frequency = <10000000>;
interrupt-parent = <&gpio>;
interrupts = <25 0x2>;
clocks = <&can0_osc>;
};
};
};
__overrides__ {
can0_oscillator = <&can0_osc>,"oscillator-frequency";
can0_speed = <&can0>,"spi-max-frequency:0";
can0_interrupt = <&can0_pins>,"brcm,pins:0";
can0_interrupt2 = <&can0>,"interrupts:0";
};
};
in your builds to even further help people to get quickly started...
Note that the override parameters are still requiring some thought so that there is no need to give the same value in two parameters to make an interrupt selection "easy"...
Metadata
Metadata
Assignees
Labels
No labels