File tree Expand file tree Collapse file tree
scripts/install/boot/overlays Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ /dts-v1/;
2+ /plugin/;
3+
4+ /*
5+ How to use spidev with MIP color displays.
6+ Set CS to active high (default is active low).
7+
8+ setup
9+ $ dtc -@ -I dts -O dtb -o spi0-cs0-gpio8-cshigh.dtbo spi0-cs0-gpio8-cshigh.dts
10+ $ sudo cp spi0-cs0-gpio8-cshigh.dtbo /boot/firmware/overlays/
11+
12+ /boot/firmware/config.txt
13+ dtparam=spi=on
14+ dtoverlay=spi0-cs0-gpio8-cshigh
15+
16+ /boot/firmware/cmdline.txt
17+ ~ spidev.bufsiz=65536
18+ */
19+
20+ / {
21+ compatible = "brcm,bcm2835";
22+
23+ fragment@0 {
24+ target = <&spi0>;
25+ __overlay__ {
26+ status = "okay";
27+
28+ /* use CS0(GPIO8) as GPIO */
29+ cs-gpios = <&gpio 8 0>, <&gpio 7 1>;
30+
31+ pinctrl-names = "default";
32+ pinctrl-0 = <&spi0_pins_no_cs &spi0_cs0_gpio8 &spi0_cs1_gpio7>;
33+ };
34+ };
35+
36+ fragment@1 {
37+ target = <&gpio>;
38+ __overlay__ {
39+ spi0_pins_no_cs: spi0_pins_no_cs {
40+ brcm,pins = <9 10 11>;
41+ brcm,function = <4>; /* ALT0 */
42+ };
43+
44+ spi0_cs0_gpio8: spi0_cs0_gpio8 {
45+ brcm,pins = <8>;
46+ brcm,function = <1>; /* output */
47+ brcm,pull = <0>;
48+ };
49+
50+ spi0_cs1_gpio7: spi0_cs1_gpio7 {
51+ brcm,pins = <7>;
52+ brcm,function = <1>; /* output */
53+ brcm,pull = <0>;
54+ };
55+ };
56+ };
57+
58+ /* set spidev@0 to “CS active-high” */
59+ fragment@2 {
60+ target-path = "/soc/spi@7e204000/spidev@0";
61+ __overlay__ {
62+ status = "okay";
63+ spi-cs-high;
64+ spi-max-frequency = <7000000>;
65+ };
66+ };
67+ };
You can’t perform that action at this time.
0 commit comments