Hi,
I want to enable the SPI interfaces on the beaglebone and I have looking into the changes that would have to be made to the device tree file. See below
+ /* SPI0 /*
+ bb_spi0_pins: pinmux_bb_spi0_pins {
+ pinctrl-single,pins = <
+ 0x150 0x30 /* spi0_sclk.spi0_sclk, INPUT_PULLUP | MODE0 */
+ 0x154 0x30 /* spi0_d0.spi0_d0, INPUT_PULLUP | MODE0 */
+ 0x158 0x10 /* spi0_d1.spi0_d1, OUTPUT_PULLUP | MODE0 */
+ 0x15c 0x10 /* spi0_cs0.spi0_cs0, OUTPUT_PULLUP | MODE0 */
+ >;
+ };
+
+ /* SPI1. */
+ bb_spi1_pins: pinmux_bb_spi1_pins {
+ pinctrl-single,pins = <
+ 0x190 0x33 /* mcasp0_aclkx.spi1_sclk, INPUT_PULLUP | MODE3 */
+ 0x194 0x33 /* mcasp0_fsx.spi1_d0, INPUT_PULLUP | MODE3 */
+ 0x198 0x13 /* mcasp0_axr0.spi1_d1, OUTPUT_PULLUP | MODE3 */
+ 0x19c 0x13 /* mcasp0_ahclkr.spi1_cs0, OUTPUT_PULLUP | MODE3 */
+ >;
+ };
+};
+
+/* Enable SPI0. */
+&spi0 {
+ status = "okay";
+ pinctrl-names = "default";
+ pinctrl-0 = <&bb_spi0_pins>;
+};
+
+/* Enable SPI1. */
+&spi1 {
+ status = "okay";
+ pinctrl-names = "default";
+ pinctrl-0 = <&bb_spi1_pins>;
+};
Does this look right?
It is based the .dts for
http://blacklib.yigityuce.com/ that i plan to use to communicate with a IMU over SPI. I have appended the original .dts file below.
/dts-v1/;
/plugin/;
/ {
compatible = "ti,beaglebone", "ti,beaglebone-black";
part-number = "BLACKLIB-SPI1";
version = "00A0";
exclusive-use =
"P9.31", /* spi1_sclk */
"P9.29", /* spi1_d0 */
"P9.30", /* spi1_d1 */
"P9.28", /* spi1_cs0 */
// "P9.42", /* spi1_cs1 */
"spi1"; /* the hardware ip uses */
fragment@0 {
target = <&am33xx_pinmux>;
__overlay__ {
bb_spi1_pins: pinmux_bb_spi1_pins {
pinctrl-single,pins = <
0x190 0x33 /* mcasp0_aclkx.spi1_sclk, INPUT_PULLUP | MODE3 */
0x194 0x33 /* mcasp0_fsx.spi1_d0, INPUT_PULLUP | MODE3 */
0x198 0x13 /* mcasp0_axr0.spi1_d1, OUTPUT_PULLUP | MODE3 */
0x19c 0x13 /* mcasp0_ahclkr.spi1_cs0, OUTPUT_PULLUP | MODE3 */
// 0x164 0x12 /* eCAP0_in_PWM0_out.spi1_cs1 OUTPUT_PULLUP | MODE2 */
>;
};
};
};
fragment@1 {
target = <&spi1>;
__overlay__ {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&bb_spi1_pins>;
spidev@0{
compatible = "spidev";
reg = <0>;
spi-max-frequency = <24000000>;
};
spidev@1{
compatible = "spidev";
reg = <1>;
spi-max-frequency = <24000000>;
};
};
};
};