Skip to content

Commit b4bc615

Browse files
yc-hou-0919scorpiochang
authored andcommitted
Add CAN-Bus
Change-Id: Ied8dc39adf43fea110b3e7236d91eba60b267254 Reviewed-on: https://tp-biosrd-v02/gerrit/82150 Reviewed-by: Scorpio Chang(張志賢) <Scorpio_Chang@asus.com> Tested-by: Scorpio Chang(張志賢) <Scorpio_Chang@asus.com>
1 parent 47bd0b9 commit b4bc615

File tree

3 files changed

+76
-0
lines changed

3 files changed

+76
-0
lines changed

arch/arm/boot/dts/overlays/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ dtbo-$(CONFIG_ARCH_ROCKCHIP) += \
1919
ds1307.dtbo \
2020
lirc-rpi.dtbo \
2121
lirc-toshiba.dtbo \
22+
mcp2515-can0.dtbo \
23+
2224

2325
targets += dtbs dtbs_install
2426
targets += $(dtbo-y)
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
/*
2+
* Device tree overlay for mcp251x/can0 on spi0.0
3+
*/
4+
5+
/dts-v1/;
6+
/plugin/;
7+
8+
/ {
9+
compatible = "rockchip,rk3288-miniarm", "rockchip,rk3288";
10+
/* disable spi-dev for spi0.0 */
11+
fragment@0 {
12+
target = <&spi2>;
13+
__overlay__ {
14+
status = "okay";
15+
spidev@0{
16+
status = "disabled";
17+
};
18+
spidev@1{
19+
status = "disabled";
20+
};
21+
};
22+
};
23+
24+
/* the interrupt pin of the can-controller */
25+
fragment@1 {
26+
target = <&gpio5>;
27+
__overlay__ {
28+
can0_pins: can0_pins {
29+
rockchip,pins = <5 19 0 &pcfg_pull_none>;
30+
};
31+
};
32+
};
33+
34+
/* the clock/oscillator of the can-controller */
35+
fragment@2 {
36+
target-path = "/";
37+
__overlay__ {
38+
/* external oscillator of mcp2515 on SPI0.0 */
39+
can0_osc: can0_osc {
40+
compatible = "fixed-clock";
41+
#clock-cells = <0>;
42+
clock-frequency = <16000000>;
43+
};
44+
};
45+
};
46+
47+
/* the spi config of the can-controller itself binding everything together */
48+
fragment@3 {
49+
target = <&spi2>;
50+
__overlay__ {
51+
/* needed to avoid dtc warning */
52+
#address-cells = <2>;
53+
#size-cells = <0>;
54+
can0: mcp2515@0 {
55+
reg = <0>;
56+
compatible = "microchip,mcp2515";
57+
pinctrl-names = "default";
58+
pinctrl-0 = <&can0_pins>;
59+
spi-max-frequency = <10000000>;
60+
interrupt-parent = <&gpio5>;
61+
interrupts = <19 0x2>;
62+
clocks = <&can0_osc>;
63+
};
64+
};
65+
};
66+
//__overrides__ {
67+
// oscillator = <&can0_osc>,"clock-frequency:0";
68+
// spimaxfrequency = <&can0>,"spi-max-frequency:0";
69+
// interrupt = <&can0_pins>,"brcm,pins:0",<&can0>,"interrupts:0";
70+
//};
71+
};

arch/arm/configs/miniarm-rk3288_defconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -823,3 +823,6 @@ CONFIG_TASKSTATS=y
823823
CONFIG_TASK_DELAY_ACCT=y
824824
CONFIG_TASK_XACCT=y
825825
CONFIG_TASK_IO_ACCOUNTING=y
826+
CONFIG_CAN=y
827+
CONFIG_CAN_DEV=y
828+
CONFIG_CAN_MCP251X=y

0 commit comments

Comments
 (0)