AM3358的SPI1_D0和SPI1_D1数据手册上说可以均可设为MISO或者MOSI,我发现当D0设置为MISO,D1设置为MOSI时可以收发,反之不行
在设备树上我主要增加两点:
1.
spi1_pins: pinmux_spi1_pins {
pinctrl-single,pins = <
#if 1 //D0->MOSI,D1->MISO
0x190 (PIN_OUTPUT | MUX_MODE3) /* mcasp0_aclkx.spi1_sclk, INPUT_PULLUP | MODE3 */
0x194 (PIN_OUTPUT | MUX_MODE3) /* mcasp0_fsx.spi1_d0, OUTPUT_PULLUP | MODE3 */
0x198 (PIN_INPUT | MUX_MODE3)/* mcasp0_axr0.spi1_d1, INPUT_PULLUP | MODE3 */
//0x19c (PIN_OUTPUT_PULLUP | MUX_MODE7) /*0x13*/ /* mcasp0_ahclkr.spi1_cs0, OUTPUT_PULLUP | MODE3 */
#else //
0x190 ( PIN_INPUT | MUX_MODE3 )
0x194 ( PIN_INPUT | MUX_MODE3 )
0x198 ( PIN_OUTPUT | MUX_MODE3 )
//0x19c ( PIN_OUTPUT | MUX_MODE3 )
#endif
>;
};
2.
&spi1 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&spi1_pins>;
ti,pindir-d0-out-d1-in;//D0->MOSI,D1->MISO
spidev@0 {
compatible = "rohm,dh2228fv";
reg = <0>;
spi-max-frequency=<24000000>;
//spi-cpol;
};
};
请问你们使用D0作为MOSI时可以吗?
Jian Zhou:
SPI的控制寄存器也要对应修改吧。