Skip to content

Commit 57604cb

Browse files
marckleinebuddepopcornmix
authored andcommitted
mcp251xfd: add overlay
Signed-off-by: Marc Kleine-Budde <[email protected]>
1 parent 04e0a17 commit 57604cb

File tree

3 files changed

+249
-0
lines changed

3 files changed

+249
-0
lines changed

arch/arm/boot/dts/overlays/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
108108
mcp23s17.dtbo \
109109
mcp2515-can0.dtbo \
110110
mcp2515-can1.dtbo \
111+
mcp251xfd.dtbo \
111112
mcp3008.dtbo \
112113
mcp3202.dtbo \
113114
mcp342x.dtbo \

arch/arm/boot/dts/overlays/README

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1779,6 +1779,28 @@ Params: oscillator Clock frequency for the CAN controller (Hz)
17791779
interrupt GPIO for interrupt signal
17801780

17811781

1782+
Name: mcp251xfd
1783+
Info: Configures the MCP251XFD CAN controller family
1784+
For devices on spi1 or spi2, the interfaces should be enabled
1785+
with one of the spi1-1/2/3cs and/or spi2-1/2/3cs overlays.
1786+
Load: dtoverlay=mcp251xfd,<param>=<val>
1787+
Params: spi<n>-<m> Configure device at spi<n>, cs<m>
1788+
(boolean, required)
1789+
1790+
oscillator Clock frequency for the CAN controller (Hz)
1791+
1792+
speed Maximum SPI frequence (Hz)
1793+
1794+
interrupt GPIO for interrupt signal
1795+
1796+
rx_interrupt GPIO for RX interrupt signal (nINT1) (optional)
1797+
1798+
xceiver_enable GPIO for CAN transceiver enable (optional)
1799+
1800+
xceiver_active_high specifiy if CAN transceiver enable pin is
1801+
active high (optional, default: active low)
1802+
1803+
17821804
Name: mcp3008
17831805
Info: Configures MCP3008 A/D converters
17841806
For devices on spi1 or spi2, the interfaces should be enabled
Lines changed: 226 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,226 @@
1+
// SPDX-License-Identifier: (GPL-2.0 OR MIT)
2+
3+
/dts-v1/;
4+
/plugin/;
5+
6+
#include <dt-bindings/gpio/gpio.h>
7+
#include <dt-bindings/interrupt-controller/irq.h>
8+
#include <dt-bindings/pinctrl/bcm2835.h>
9+
10+
/ {
11+
compatible = "brcm,bcm2835";
12+
13+
fragment@0 {
14+
target = <&spidev0>;
15+
__dormant__ {
16+
status = "disabled";
17+
};
18+
};
19+
20+
fragment@1 {
21+
target = <&spidev1>;
22+
__dormant__ {
23+
status = "disabled";
24+
};
25+
};
26+
27+
fragment@2 {
28+
target-path = "spi1/spidev@0";
29+
__dormant__ {
30+
status = "disabled";
31+
};
32+
};
33+
34+
fragment@3 {
35+
target-path = "spi1/spidev@1";
36+
__dormant__ {
37+
status = "disabled";
38+
};
39+
};
40+
41+
fragment@4 {
42+
target-path = "spi1/spidev@2";
43+
__dormant__ {
44+
status = "disabled";
45+
};
46+
};
47+
48+
fragment@5 {
49+
target-path = "spi2/spidev@0";
50+
__dormant__ {
51+
status = "disabled";
52+
};
53+
};
54+
55+
fragment@6 {
56+
target-path = "spi2/spidev@1";
57+
__dormant__ {
58+
status = "disabled";
59+
};
60+
};
61+
62+
fragment@7 {
63+
target-path = "spi2/spidev@2";
64+
__dormant__ {
65+
status = "disabled";
66+
};
67+
};
68+
69+
fragment@8 {
70+
target = <&gpio>;
71+
__overlay__ {
72+
mcp251xfd_pins: mcp251xfd_pins {
73+
brcm,pins = <25>;
74+
brcm,function = <BCM2835_FSEL_GPIO_IN>;
75+
};
76+
};
77+
};
78+
79+
fragment@9 {
80+
target-path = "/clocks";
81+
__overlay__ {
82+
clk_mcp251xfd_osc: mcp251xfd-osc {
83+
#clock-cells = <0>;
84+
compatible = "fixed-clock";
85+
clock-frequency = <40000000>;
86+
};
87+
};
88+
};
89+
90+
mcp251xfd_frag: fragment@10 {
91+
target = <&spi0>;
92+
__overlay__ {
93+
status = "okay";
94+
#address-cells = <1>;
95+
#size-cells = <0>;
96+
97+
mcp251xfd: mcp251xfd@0 {
98+
compatible = "microchip,mcp251xfd";
99+
reg = <0>;
100+
pinctrl-names = "default";
101+
pinctrl-0 = <&mcp251xfd_pins>;
102+
spi-max-frequency = <20000000>;
103+
interrupt-parent = <&gpio>;
104+
interrupts = <25 IRQ_TYPE_LEVEL_LOW>;
105+
clocks = <&clk_mcp251xfd_osc>;
106+
};
107+
};
108+
};
109+
110+
fragment@11 {
111+
target = <&mcp251xfd>;
112+
mcp251xfd_rx_int_gpios: __dormant__ {
113+
microchip,rx-int-gpios = <&gpio 255 GPIO_ACTIVE_LOW>;
114+
};
115+
};
116+
117+
fragment@12 {
118+
target = <&gpio>;
119+
__dormant__ {
120+
mcp251xfd_xceiver_pins: mcp251xfd_xceiver_pins {
121+
brcm,pins = <255>;
122+
brcm,function = <BCM2835_FSEL_GPIO_OUT>;
123+
};
124+
};
125+
};
126+
127+
fragment@13 {
128+
target-path = "/";
129+
__dormant__ {
130+
reg_mcp251xfd_xceiver: reg_mcp251xfd_xceiver {
131+
compatible = "regulator-fixed";
132+
regulator-name = "mcp251xfd_xceiver";
133+
regulator-min-microvolt = <3300000>;
134+
regulator-max-microvolt = <3300000>;
135+
gpio = <&gpio 4 GPIO_ACTIVE_HIGH>;
136+
pinctrl-names = "default";
137+
pinctrl-0 = <&mcp251xfd_xceiver_pins>;
138+
};
139+
};
140+
};
141+
142+
fragment@14 {
143+
target = <&mcp251xfd>;
144+
__dormant__ {
145+
xceiver-supply = <&reg_mcp251xfd_xceiver>;
146+
};
147+
};
148+
149+
__overrides__ {
150+
spi0-0 = <0>, "+0",
151+
<&mcp251xfd_frag>, "target:0=", <&spi0>,
152+
<&mcp251xfd>, "reg:0=0",
153+
<&mcp251xfd_pins>, "name=mcp251xfd_spi0_0_pins",
154+
<&clk_mcp251xfd_osc>, "name=mcp251xfd-spi0-0-osc",
155+
<&mcp251xfd_xceiver_pins>, "name=mcp251xfd_spi0_0_xceiver_pins",
156+
<&reg_mcp251xfd_xceiver>, "name=reg-mcp251xfd-spi0-0-xceiver",
157+
<&reg_mcp251xfd_xceiver>, "regulator-name=mcp251xfd-spi0-0-xceiver";
158+
spi0-1 = <0>, "+1",
159+
<&mcp251xfd_frag>, "target:0=", <&spi0>,
160+
<&mcp251xfd>, "reg:0=1",
161+
<&mcp251xfd_pins>, "name=mcp251xfd_spi0_1_pins",
162+
<&clk_mcp251xfd_osc>, "name=mcp251xfd-spi0-1-osc",
163+
<&mcp251xfd_xceiver_pins>, "name=mcp251xfd_spi0_1_xceiver_pins",
164+
<&reg_mcp251xfd_xceiver>, "name=reg-mcp251xfd-spi0-1-xceiver",
165+
<&reg_mcp251xfd_xceiver>, "regulator-name=mcp251xfd-spi0-1-xceiver";
166+
spi1-0 = <0>, "+2",
167+
<&mcp251xfd_frag>, "target:0=", <&spi1>,
168+
<&mcp251xfd>, "reg:0=0",
169+
<&mcp251xfd_pins>, "name=mcp251xfd_spi1_0_pins",
170+
<&clk_mcp251xfd_osc>, "name=mcp251xfd-spi1-0-osc",
171+
<&mcp251xfd_xceiver_pins>, "name=mcp251xfd_spi1_0_xceiver_pins",
172+
<&reg_mcp251xfd_xceiver>, "name=reg-mcp251xfd-spi1-0-xceiver",
173+
<&reg_mcp251xfd_xceiver>, "regulator-name=mcp251xfd-spi1-0-xceiver";
174+
spi1-1 = <0>, "+3",
175+
<&mcp251xfd_frag>, "target:0=", <&spi1>,
176+
<&mcp251xfd>, "reg:0=1",
177+
<&mcp251xfd_pins>, "name=mcp251xfd_spi1_1_pins",
178+
<&clk_mcp251xfd_osc>, "name=mcp251xfd-spi1-1-osc",
179+
<&mcp251xfd_xceiver_pins>, "name=mcp251xfd_spi1_1_xceiver_pins",
180+
<&reg_mcp251xfd_xceiver>, "name=reg-mcp251xfd-spi1-1-xceiver",
181+
<&reg_mcp251xfd_xceiver>, "regulator-name=mcp251xfd-spi1-1-xceiver";
182+
spi1-2 = <0>, "+4",
183+
<&mcp251xfd_frag>, "target:0=", <&spi1>,
184+
<&mcp251xfd>, "reg:0=2",
185+
<&mcp251xfd_pins>, "name=mcp251xfd_spi1_2_pins",
186+
<&clk_mcp251xfd_osc>, "name=mcp251xfd-spi1-2-osc",
187+
<&mcp251xfd_xceiver_pins>, "name=mcp251xfd_spi1_2_xceiver_pins",
188+
<&reg_mcp251xfd_xceiver>, "name=reg-mcp251xfd-spi1-2-xceiver",
189+
<&reg_mcp251xfd_xceiver>, "regulator-name=mcp251xfd-spi1-2-xceiver";
190+
spi2-0 = <0>, "+5",
191+
<&mcp251xfd_frag>, "target:0=", <&spi2>,
192+
<&mcp251xfd>, "reg:0=0",
193+
<&mcp251xfd_pins>, "name=mcp251xfd_spi2_0_pins",
194+
<&clk_mcp251xfd_osc>, "name=mcp251xfd-spi2-0-osc",
195+
<&mcp251xfd_xceiver_pins>, "name=mcp251xfd_spi2_0_xceiver_pins",
196+
<&reg_mcp251xfd_xceiver>, "name=reg-mcp251xfd-spi2-0-xceiver",
197+
<&reg_mcp251xfd_xceiver>, "regulator-name=mcp251xfd-spi2-0-xceiver";
198+
spi2-1 = <0>, "+6",
199+
<&mcp251xfd_frag>, "target:0=", <&spi2>,
200+
<&mcp251xfd>, "reg:0=1",
201+
<&mcp251xfd_pins>, "name=mcp251xfd_spi2_1_pins",
202+
<&clk_mcp251xfd_osc>, "name=mcp251xfd-spi2-1-osc",
203+
<&mcp251xfd_xceiver_pins>, "name=mcp251xfd_spi2_1_xceiver_pins",
204+
<&reg_mcp251xfd_xceiver>, "name=reg-mcp251xfd-spi2-1-xceiver",
205+
<&reg_mcp251xfd_xceiver>, "regulator-name=mcp251xfd-spi2-1-xceiver";
206+
spi2-2 = <0>, "+7",
207+
<&mcp251xfd_frag>, "target:0=", <&spi2>,
208+
<&mcp251xfd>, "reg:0=2",
209+
<&mcp251xfd_pins>, "name=mcp251xfd_spi2_2_pins",
210+
<&clk_mcp251xfd_osc>, "name=mcp251xfd-spi2-2-osc",
211+
<&mcp251xfd_xceiver_pins>, "name=mcp251xfd_spi2_2_xceiver_pins",
212+
<&reg_mcp251xfd_xceiver>, "name=reg-mcp251xfd-spi2-2-xceiver",
213+
<&reg_mcp251xfd_xceiver>, "regulator-name=mcp251xfd-spi2-2-xceiver";
214+
oscillator = <&clk_mcp251xfd_osc>, "clock-frequency:0";
215+
speed = <&mcp251xfd>, "spi-max-frequency:0";
216+
interrupt = <&mcp251xfd_pins>, "brcm,pins:0",
217+
<&mcp251xfd>, "interrupts:0";
218+
rx_interrupt = <0>, "+11",
219+
<&mcp251xfd_pins>, "brcm,pins:4",
220+
<&mcp251xfd_rx_int_gpios>, "microchip,rx-int-gpios:4";
221+
xceiver_enable = <0>, "+12+13+14",
222+
<&mcp251xfd_xceiver_pins>, "brcm,pins:0",
223+
<&reg_mcp251xfd_xceiver>, "gpio:4";
224+
xceiver_active_high = <&reg_mcp251xfd_xceiver>, "enable-active-high?";
225+
};
226+
};

0 commit comments

Comments
 (0)