Hi all
I'm working on an IMX6Q based product whose hardware very similar (though not identical) to the SabreSD. As the board is based on SabreSD I have been altering the Yocto (Fido, linux-imx kernel version 3.14.28) MX6Q SabreSD files to get the system working. I have added drivers (networking etc) and made adaptations to the imx6qdl-sabresd.dtsi file. So far I have successfully built the "fsl-image-multimedia-full" image and can login to the system via serial comms and ssh. My build host is an x86 Ubuntu 15 system.
Presently, I'm trying to get the SPI bus (ecspi2) to talk to an external device using the SPIDEV device. I have added the SPIDEV device information into the imx6qdl-sabresd.dtsi file (see below) and enabled spidev in the linux kernel (see below). Following build cycle, a device file is built and I tested it using the spidev_test.c program provided in the kernel source (Documentation/spi/spidev_test.c). I receive the following output (always the same output no matter what command line switches I give it):
root@imx6qsabresd:~# ./spidev_test -D /dev/spidev1.0
can't set spi mode: Inappropriate ioctl for device
Aborted
Viewing the SPI signals on a scope I see none of the signals toggling (SCLK stays low, MISO, MOSI, CS stay high). The above results lead me to suspect that my SPI settings are wrong.
I have searched the IMX forum and tried suggestions that I've seen on the web regarding making changes to the .dtsi file. Sadly none of these suggestions have moved me forward. I'm sure there is a logical explanation for these issues.
Please could anyone in the community suggest what settings need to be changed/what they should be?
Thanks in advance
A
I've included as much detail below as I think might be needed to make a prognosis.
IMX6Q schematic pins used for ecspi2:
MISO: J24
MOSI: J23
SCLK: H24
SS0: K20
SS1: K22
.dtsi file settings:
...
&ecspi2 {
fsl,spi-num-chipselects = <2>;
cs-gpios = <&gpio2 26 0>,
<&gpio2 27 0>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ecspi2>;
status = "okay";
// add spidev driver
spidev0: spi@0 {
compatible = "spidev";
reg = <0>;
spi-max-frequency = <57600000>;
};
};
...
pinctrl_ecspi2: ecspi2grp {
fsl,pins = <
MX6QDL_PAD_EIM_OE__ECSPI2_MISO 0x100b1
MX6QDL_PAD_EIM_CS1__ECSPI2_MOSI 0x100b1
MX6QDL_PAD_EIM_CS0__ECSPI2_SCLK 0x100b1
MX6QDL_PAD_EIM_RW__GPIO2_IO26 0x1b0b0
MX6QDL_PAD_EIM_LBA__GPIO2_IO27 0x1b0b0
>;
};
...
Linux Kernel .config SPI settings:
CONFIG_RWSEM_GENERIC_SPINLOCK=y
CONFIG_UNINLINE_SPIN_UNLOCK=y
CONFIG_MUTEX_SPIN_ON_OWNER=y
CONFIG_IMX_HAVE_PLATFORM_SPI_IMX=y
CONFIG_REGMAP_SPI=y
CONFIG_SPI_FSL_QUADSPI=y
CONFIG_SPI=y
CONFIG_SPI_MASTER=y
CONFIG_SPI_BITBANG=y
CONFIG_SPI_GPIO=y
CONFIG_SPI_IMX=y
CONFIG_SPI_SPIDEV=y
CONFIG_MFD_MC13XXX_SPI=y
CONFIG_SND_SPI=y
CONFIG_SND_SOC_I2C_AND_SPI=y
Solved! Go to Solution.
please check the spidev_test.c, is the IOCTL wrongly used? example: SPI_IOC_WR_MODE32 used, but there is only SPI_IOC_WR_MODE in the spidev.c.
what is output of "dmesg |grep spi" ?
what is the spidev name in /dev/ ?
root@imx6qsabresd:~# more /var/log/dmesg | grep -i "spi"
[ 1.320379] spi_imx 2008000.ecspi: probed
[ 1.324654] spi_imx 200c000.ecspi: probed
root@imx6qsabresd:~# ls -l /dev/spidev1.0
crw------- 1 root root 153, 0 Jan 1 1970 /dev/spidev1.0
root@imx6qsabresd:~#
please check the spidev_test.c, is the IOCTL wrongly used? example: SPI_IOC_WR_MODE32 used, but there is only SPI_IOC_WR_MODE in the spidev.c.
SPI_IOC_WR_MODE32 changed to SPI_IOC_WR_MODE in spidev.c and I can now see the SPI pins toggling.
Many thanks