Hello All,
我尝试如下设置设备树,但CS信号仅在默认硬件引脚上
&spi1 {
pinctrl-names = "default";
pinctrl-0 = <&spi1_pins_a>;
status = "okay";
num_chipselect = <2>;
cs_gpios = <&pio 3 2 GPIO_ACTIVE_LOW>,
<&pio 3 14 GPIO_ACTIVE_LOW>,
gpio1: gpio@0x00 {
compatible = "fairchild,74hc595";
reg = <0>;
gpio-controller;
#gpio-cells = <2>;
registers-number = <2>;
spi-max-frequency = <1000000>;
};
gpio2: gpio@0x01 {
compatible = "ti,sn65hvs882", "pisosr-gpio";
gpio-controller;
#gpio-cells = <1>;
reg = <1>;
spi-max-frequency = <1000000>;
};
};
我注意到spi设备驱动程序未从设备树中读取任何现成的解决方案来支持多个CS?
离线
非常感谢您提供宝贵的信息,
但这对我的情况不起作用。
&spi1 {
pinctrl-names = "default";
pinctrl-0 = <&spi1_pins_a &spi1_pins_cs>;
status = "okay";
num_chipselect = <4>;
cs_gpios = <&pio 3 2 GPIO_ACTIVE_LOW>, /*PD2 main lcd*/
<&pio 3 14 GPIO_ACTIVE_LOW>, /*PD14 SR Latch*/
<&pio 3 21 GPIO_ACTIVE_LOW>, /*PD21 rtc*/
<0>; /*lcd2*/
gpio1: gpio@0x01 {
compatible = "fairchild,74hc595";
reg = <1>;
gpio-controller;
#gpio-cells = <2>;
registers-number = <1>;
spi-max-frequency = <1000000>;
};
};
spi1_pins_a: spi1-pins-pc {
pins = "PA0", "PA1", "PA2", "A3";
function = "spi1";
};
spi1_pins_cs: spi1_pins_cs {
pins = "PD2", "D14", "PD21";
function = "gpio_out";
};
CS信号仍在默认端口PA0上
我检查了驱动程序代码,未找到此行devm_gpio_request
离线
&pio {
spi0_cs_pins: spi0_cs_pins {
pins = "PC3", "PH6";
function = "gpio_out";
};
};
&spi0 {
status ="okay";
pinctrl-names = "default";
pinctrl-0 = <&spi0_pins &spi0_cs_pins>;
cs-gpios = <&pio 2 3 GPIO_ACTIVE_HIGH>, <&pio 7 6 GPIO_ACTIVE_HIGH>;
mx25l25635e:mx25l25635e@0 {
compatible = "jedec,spi-nor";
reg = <0x0>;
spi-max-frequency = <50000000>;
#address-cells = <1>;
#size-cells = <1>;
};
panel@0 {
compatible = "sitronix,st7789v";
reg = <1>;
reset-gpios = <&pio 2 4 GPIO_ACTIVE_HIGH>;//PC4
dc-gpios = <&pio 2 7 GPIO_ACTIVE_LOW>;//PC7
/*backlight = <&pwm_bl>;*/
led-gpios = <&pio 7 0 GPIO_ACTIVE_LOW>;//PH0
spi-max-frequency = <50000000>;
spi-cpol;
spi-cpha;
buswidth = <8>;
rotate = <270>;
rgb;
fps = <30>;
debug = <1>;
};
亲测可用。
离线
非常感谢,它对我有用
主要更改是cs_gpios更改为cs-gpios
离线
非常感谢,它对我有用
主要更改是cs_gpios更改为cs-gpios
咦,好像是噢,居然能通过编译?
离线
非常感谢,它对我有用
主要更改是cs_gpios更改为cs-gpios
现在可以了吗?
离线
现在可以了吗?
Yes, Now it's working
离线
记录一下,后面会用到这个
离线
&pio { spi0_cs_pins: spi0_cs_pins { pins = "PC3", "PH6"; function = "gpio_out"; }; }; &spi0 { status ="okay"; pinctrl-names = "default"; pinctrl-0 = <&spi0_pins &spi0_cs_pins>; cs-gpios = <&pio 2 3 GPIO_ACTIVE_HIGH>, <&pio 7 6 GPIO_ACTIVE_HIGH>; mx25l25635e:mx25l25635e@0 { compatible = "jedec,spi-nor"; reg = <0x0>; spi-max-frequency = <50000000>; #address-cells = <1>; #size-cells = <1>; }; panel@0 { compatible = "sitronix,st7789v"; reg = <1>; reset-gpios = <&pio 2 4 GPIO_ACTIVE_HIGH>;//PC4 dc-gpios = <&pio 2 7 GPIO_ACTIVE_LOW>;//PC7 /*backlight = <&pwm_bl>;*/ led-gpios = <&pio 7 0 GPIO_ACTIVE_LOW>;//PH0 spi-max-frequency = <50000000>; spi-cpol; spi-cpha; buswidth = <8>; rotate = <270>; rgb; fps = <30>; debug = <1>; };
亲测可用。
对于f1c100s的spi0的cs应该默认为PC1
离线
Hi @Yujian Tianya,
Do you know how to do this for the f1c200s spi1 controller ?? I'm using spidev, and it looks like cs is not working.
离线
piyush 说:非常感谢,它对我有用
主要更改是cs_gpios更改为cs-gpios
咦,好像是噢,居然能通过编译?
肯定可以编译,那就是个标签
离线
使用不同的GPIO作为片选就可以,我也在一个项目中就是这样用的
离线