Skip to content

Commit

Permalink
can: mcp2517fd: added can0/can1 overlays
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Sperl <[email protected]>
  • Loading branch information
msperl committed Jan 6, 2019
1 parent 4ea109e commit f115b8b
Show file tree
Hide file tree
Showing 3 changed files with 158 additions and 0 deletions.
2 changes: 2 additions & 0 deletions arch/arm/boot/dts/overlays/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
mcp23s17.dtbo \
mcp2515-can0.dtbo \
mcp2515-can1.dtbo \
mcp2517fd-can0.dtbo \
mcp2517fd-can1.dtbo \
mcp3008.dtbo \
mcp3202.dtbo \
media-center.dtbo \
Expand Down
78 changes: 78 additions & 0 deletions arch/arm/boot/dts/overlays/mcp2517fd-can0-overlay.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*
* Device tree overlay for mcp2517fd/can0 on spi0.0
*/

/dts-v1/;
/plugin/;

/ {
compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709";
/* disable spi-dev for spi0.0 */
fragment@0 {
target = <&spi0>;
__overlay__ {
status = "okay";
};
};

fragment@1 {
target = <&spidev0>;
__overlay__ {
status = "disabled";
};
};

/* the interrupt pin of the can-controller */
fragment@2 {
target = <&gpio>;
__overlay__ {
can0_pins: can0_pins {
brcm,pins = <25>;
brcm,function = <0>; /* input */
};
};
};

/* the clock/oscillator of the can-controller */
fragment@3 {
target-path = "/clocks";
__overlay__ {
/* external oscillator of mcp2517fd on SPI0.0 */
can0_osc: can0_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>;
can0: mcp2517fd@0 {
reg = <0>;
compatible = "microchip,mcp2517fd";
pinctrl-names = "default";
pinctrl-0 = <&can0_pins>;
spi-max-frequency = <20000000>;
interrupt-parent = <&gpio>;
interrupts = <25 0x8>;
clocks = <&can0_osc>;
microchip,clock-out-div = <10>;
};
};
};

__overrides__ {
oscillator = <&can0_osc>,"clock-frequency:0";
spimaxfrequency = <&can0>,"spi-max-frequency:0";
interrupt = <&can0_pins>,"brcm,pins:0",<&can0>,"interrupts:0";
clockdiv = <&can0>,"microchip,clock-div?";
clockoutdiv = <&can0>,"microchip,clock-out-div:0";
opendrain = <&can0>, "gpio-open-drain?";
};
};
78 changes: 78 additions & 0 deletions arch/arm/boot/dts/overlays/mcp2517fd-can1-overlay.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*
* Device tree overlay for mcp2517fd/can1 on spi0.1
*/

/dts-v1/;
/plugin/;

/ {
compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709";
/* disable spi-dev for spi0.1 */
fragment@0 {
target = <&spi0>;
__overlay__ {
status = "okay";
};
};

fragment@1 {
target = <&spidev1>;
__overlay__ {
status = "disabled";
};
};

/* the interrupt pin of the can-controller */
fragment@2 {
target = <&gpio>;
__overlay__ {
can1_pins: can1_pins {
brcm,pins = <26>;
brcm,function = <0>; /* input */
};
};
};

/* the clock/oscillator of the can-controller */
fragment@3 {
target-path = "/clocks";
__overlay__ {
/* external oscillator of mcp2517fd on SPI0.0 */
can1_osc: can1_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>;
can1: mcp2517fd@1 {
reg = <1>;
compatible = "microchip,mcp2517fd";
pinctrl-names = "default";
pinctrl-0 = <&can1_pins>;
spi-max-frequency = <20000000>;
interrupt-parent = <&gpio>;
interrupts = <26 0x8>;
clocks = <&can1_osc>;
microchip,clock-out-div = <10>;
};
};
};

__overrides__ {
oscillator = <&can1_osc>,"clock-frequency:0";
spimaxfrequency = <&can1>,"spi-max-frequency:0";
interrupt = <&can1_pins>,"brcm,pins:0",<&can1>,"interrupts:0";
clockdiv = <&can1>,"microchip,clock-div?";
clockoutdiv = <&can1>,"microchip,clock-out-div:0";
opendrain = <&can1>, "gpio-open-drain?";
};
};

0 comments on commit f115b8b

Please sign in to comment.