TS-TPC-7990 CPU SPI Controller: Difference between revisions

From embeddedTS Manuals
No edit summary
m (Links auto-updated for 2022 re-branding ( https://github.com/embeddedarm/linux-3.10.17-imx6/blob/master/Documentation/spi/spidev →‎ https://github.com/embeddedTS/linux-3.10.17-imx6/blob/master/Documentation/spi/spidev https://github.com/embeddedarm/linux-3.10.17-imx6/blob/master/Documentation/spi/spidev_test.c →‎ https://github.com/embeddedTS/linux-3.10.17-imx6/blob/master/Documentation/spi/spidev_test.c))
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
SPI is located on the [[#DIO Header]] through /dev/spidev1.2.
SPI is located on the [[#DIO Header|DIO header]] and is available in software via /dev/spidev1.2


This board includes one SPI interface which is accessible through either specific kernel drivers, or userspace using the /dev/spi interface.  To utilize SPI, some projects will end up with a customized device tree, so setting up the kernel build environment will be necessary.  See the [[#Compile_the_Kernel|kernel compile guide here]] for more details.
This platform includes one SPI interface which is accessible through either kernel drivers or userspace using the /dev/spi interface.


Open the dts from arch/arm/boot/dts/imx6qdl-ts7990.dtsi.  The kernel requires a spidev device be added to the relevant ECSPI controller. For example:
Developing or implementing kernel SPI drivers are beyond the scope of this document, but the build environment is described in the [[#Compile_the_Kernel|kernel compile guide]].
<source lang=javascript>
&ecspi2 {
fsl,spi-num-chipselects = <3>;
cs-gpios = <&gpio5 31 0>, <&gpio1 6 0>, <&gpio5 18 0>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ecspi2>;
status = "okay";


serial1: max3100-0@0 {
The /dev/spidev1.2 interface can be accessed using the userspace API.  For more information see the documentation and sample code:
compatible = "max3100-ts";
* [https://github.com/embeddedTS/linux-3.10.17-imx6/blob/master/Documentation/spi/spidev Linux kernel spidev documentation]
reg = <0>;
* [https://github.com/embeddedTS/linux-3.10.17-imx6/blob/master/Documentation/spi/spidev_test.c spidev example code]
interrupt-parent = <&gpio5>;
interrupts = <20 IRQ_TYPE_LEVEL_LOW>;
spi-max-frequency = <10000000>;
loopback = <0>;
crystal = <1>;
poll-time = <100>;
};
 
spidevfpga: spi@1 {
compatible = "spidev";
reg = <1>;
spi-max-frequency = <1000000>;
};
 
spidevdc1: spi@2 {
compatible = "spidev";
reg = <2>;
spi-max-frequency = <1000000>;
};
};
</source>
 
In this case ecspi2 is configured with a spidev at 1MHz which will be available at /dev/spidev1.1 and /dev/spidev1.2.
 
Once you have a /dev/spidev device, you can open this file and use the standard Linux SPI API.  For more information see the documentation and sample code:
* [https://github.com/embeddedarm/linux-3.10.17-imx6/blob/master/Documentation/spi/spidev Linux kernel spidev documentation]
* [https://github.com/embeddedarm/linux-3.10.17-imx6/blob/master/Documentation/spi/spidev_test.c spidev example code]

Latest revision as of 17:44, 17 January 2022

SPI is located on the DIO header and is available in software via /dev/spidev1.2

This platform includes one SPI interface which is accessible through either kernel drivers or userspace using the /dev/spi interface.

Developing or implementing kernel SPI drivers are beyond the scope of this document, but the build environment is described in the kernel compile guide.

The /dev/spidev1.2 interface can be accessed using the userspace API. For more information see the documentation and sample code: