In the device tree I’m trying to configure a second SPI port for use from user space.
We have ecspi3 working and it is available as spidev2.0 in user space. It works when called, and I can see that bytes are read from or written to the ecspi3 SPI port using a logic analyzer.
We’re also trying to configure a second SPI port, ecspi2, for use. I’m using similar node names, to ecspi3 for setting up ecspi2 in the device tree. Here are the device tree nodes:
&ecspi2 {
status = "okay";
spidev0: spidev@0 {
compatible = "toradex,evalspi";
reg = <0>;
spi-max-frequency = <23000000>;
status = "okay";
};
};
/* Colibri SPI */
&ecspi2 {
fsl,spi-num-chipselects = <1>;
cs-gpios = <&gpio7 9 GPIO_ACTIVE_HIGH>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ecspi2 &pinctrl_ecspi2_cs>;
};
// 5/26/20167 KJC - Setup i2c3 port lines used for communicating with the
// FPGA.
&iomuxc {
imx7d-p1100 {
pinctrl_ecspi2_cs: ecspi2_cs_grp {
fsl,pins = <
MX7D_PAD_ENET1_RGMII_TD3__GPIO7_IO9 0x14 // 194
>;
};
pinctrl_ecspi2: ecspi2grp {
fsl,pins = <
MX7D_PAD_ENET1_RGMII_TD2__ECSPI2_MISO 0x2 // 196
MX7D_PAD_ENET1_RGMII_RD3__ECSPI2_MOSI 0x2 // 55
MX7D_PAD_ENET1_RGMII_RD2__ECSPI2_SCLK 0x2 // 63
>;
};
};
};
After adding the above lines to our carrier board dts file, building, and then copying the dtb file to our device I can see two spi ports available from userspace: spidev1.0, and spidev2.0. spidev1.0 corresponds to escpi2, and spidev2.0 corresponds to ecspi3.
When I make the call to escpi3 using: open( "/dev/spidev2.0", O_RDWR)
it works and I can read data from and write data to the spi port. I can see the activity on the spi lines using our logic port analyzer.
When I make the call to escpi2 using: open( "/dev/spidev1.0", O_RDWR)
the only activity I see on the logic analyzer is that chip select (SSO) goes low, as it should, but there is no clock, MOSI, or MISO activity.
I did discover that one of the GPIO lines we are using for ecspi2: MX7D_PAD_ENET1_RGMII_TD2__ECSPI2_MISO
is also used for i2c4 in the Colibri evaluation board as: MX7D_PAD_ENET1_RGMII_TD2__I2C4_SCL
.
I have commented out those lines in the imx7-colibri.dtsi file that setup i2c4 and use the GPIO line that we need for ecspi2 (spidev1.0), but ecspi2 is still not woirking. Only the chip select line (SS0) seems to behave the way that it should.
I’ve also tried disabling ecspi3 by setting it’s status
property to disabled
. When I do this only spidev1.0 appears in /dev as I would expect, but it still doesn’t work.
What do I need to do to get escpi2 (spidev1.0) working properly?
Thank You