Last active
April 19, 2025 17:31
-
-
Save sorki/9a8ea1835a1c1dac57e50950cd443030 to your computer and use it in GitHub Desktop.
pi2 spi.dts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <dt-bindings/pinctrl/bcm2835.h> | |
/dts-v1/; | |
/plugin/; | |
/ { | |
compatible = "raspberrypi,2-model-b"; | |
fragment@0 { | |
target = <&spi>; | |
__overlay__ { | |
cs-gpios = <&gpio 8 1>, <&gpio 7 1>; | |
status = "okay"; | |
pinctrl-names = "default"; | |
pinctrl-0 = <&spi0_pins &spi0_cs_pins>; | |
#address-cells = <1>; | |
#size-cells = <0>; | |
/* | |
spidev@0 { | |
reg = <0>; // CE0 | |
spi-max-frequency = <500000>; | |
compatible = "spidev"; | |
}; | |
spidev@1 { | |
reg = <1>; // CE1 | |
spi-max-frequency = <500000>; | |
compatible = "spidev"; | |
}; | |
*/ | |
}; | |
}; | |
// alternatively we could say | |
/* target = <&gpio>; | |
__overlay__ { | |
pinctrl-0 = <>; | |
} | |
*/ | |
// to not assign any pins by default | |
// or just pinctrl-0 = <&gpioout>; | |
// like.. what's the point? | |
fragment@1 { | |
target = <&gpio>; | |
__overlay__ { | |
// By default this pinctrl-0 = <&gpioout &alt0 &i2s_alt0>; | |
// keep juts gpioout which is only pin 6 | |
pinctrl-0 = <&gpioout>; | |
}; | |
}; | |
fragment@2 { | |
target = <&gpio>; | |
__overlay__ { | |
spi0_pins: spi0_pins { | |
brcm,pins = <9 10 11>; | |
brcm,function = <BCM2835_FSEL_ALT0>; | |
}; | |
spi0_cs_pins: spi0_cs_pins { | |
brcm,pins = <8 7>; | |
brcm,function = <BCM2835_FSEL_GPIO_OUT>; | |
}; | |
}; | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment