<&spi0 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&spi0_pins_default>;
pinctrl-1 = <&spi0_pins_sleep>;
ti,pindir-d0-in-d1-out =<1>; // optional
cs0-gpio = <&gpio0 5 GPIO_ACTIVE_LOW>; /* Bank 0 pin 5 软件控制cs片选*/
/*spidev@0{ /* 将此块注释掉,然后使用的是自己编写的驱动程序 */
status = "okay";
compatible = "rohm,dh2228fv";
spi-max-frequency = <48000000>;
reg =<0x0>;
};*/
adc128@0{
status = "okay";
compatible = "ti,adc128s022-0";
spi-max-frequency = <3200000>;
reg = <0>;
};
……
>
Shine:
在pinmux管脚复用配置里没看到cs片选信号gpio管脚复用的配置。
如果用gpio作为片选信号的话,需要修改spi驱动。请参考下面的链接。https://dev.iachieved.it/iachievedit/gpio-chip-selects-with-the-beaglebone/
user6335227:
回复 Shine:
设备树中已经设置了cs,将其作为gpio,软件片选/* adc128s022 chip pin */spi0_pins_default: spi0_pins_default {pinctrl-single,pins = <0x150 ( PIN_INPUT | MUX_MODE0 ) /* (P23) spi0_sclk.spi0_sclk */0x154 ( PIN_OUTPUT | MUX_MODE0 ) /* (T22) spi0_d0.spi0_d0 */0x158 ( PIN_INPUT| MUX_MODE0 ) /* (T21) spi0_d1.spi0_d1 */0x15c ( PIN_OUTPUT_PULLUP | MUX_MODE7 ) /* (137) spi0_cs0.gpio0_5 */0x26c ( PIN_OUTPUT_PULLUP | MUX_MODE7 ) /* (133) spi2_cs0.gpio3_25 */0x264 ( PIN_OUTPUT_PULLUP | MUX_MODE7 ) /* (135) spi2_d0.gpio3_22 */0x268 ( PIN_OUTPUT_PULLUP | MUX_MODE7 ) /* (136) spi2_d1.gpio3_23 */
>;};