TS-4100 CPU SPI Controller: Difference between revisions

From embeddedTS Manuals
(Created page with "The default kernel sets up two SPI controllers. One to the Onboard WIFI, and the other to the FPGA and offboard chip selects. SPI is accessible through either specific kerne...")
 
mNo edit summary
Line 1: Line 1:
The default kernel sets up two SPI controllers.  One to the Onboard WIFI, and the other to the FPGA and offboard chip selects.  SPI is accessible through either specific kernel drivers, or userspace using the /dev/spi interface.  See the [[#Compile_the_Kernel|kernel compile guide here]] for more details.
The default kernel sets up two SPI controllers.  One to the Onboard WIFI, and the other to the FPGA and offboard chip selects.  SPI is accessible through either specific kernel drivers, or userspace using the /dev/spi interface.  See the [[#Compile_the_Kernel|kernel compile guide here]] for more details.


Open the baseboard dts from arch/arm/boot/dts/imx6qdl-ts4900-<baseboardid>.dtsi, or the generic imx6qdl-ts4900.dtsi.  The kernel requires a spidev device be added to the relevant ECSPI controller.  For example:
Open the baseboard dts from arch/arm/boot/dts/imx6ul-ts4100-<baseboardid>.dtsi, or the generic imx6ul-ts4100.dtsi.  The kernel requires a spidev device be added to the relevant ECSPI controller.  For example:
<source lang=javascript>
<source lang=javascript>
&ecspi3 {
&ecspi3 {

Revision as of 12:44, 19 April 2017

The default kernel sets up two SPI controllers. One to the Onboard WIFI, and the other to the FPGA and offboard chip selects. SPI is accessible through either specific kernel drivers, or userspace using the /dev/spi interface. See the kernel compile guide here for more details.

Open the baseboard dts from arch/arm/boot/dts/imx6ul-ts4100-<baseboardid>.dtsi, or the generic imx6ul-ts4100.dtsi. The kernel requires a spidev device be added to the relevant ECSPI controller. For example:

&ecspi3 {
	fsl,spi-num-chipselects = <2>;
	cs-gpios = <&gpio4 12 0>, <&gpio4 10 0>;
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_ecspi3>;
	status = "okay";

	spidevfpga: spi@0 {
		compatible = "spidev";
		reg = <0>;
		spi-max-frequency = <1000000>;
	};

	spioffbd: spi@1 {
		compatible = "spidev";
		reg = <1>;
		spi-max-frequency = <1000000>;
	};
};

In this case the two spidev devices are set to 1MHz. To adjust this further you will need to modify the kernel for your device. Linux will create two devices for the above spidev nodes:

  • /dev/spidev2.0 #FPGA
  • /dev/spidev2.1 #offboard

The FPGA SPI is left to custom ZPU code. You can also add additional CPU GPIO to the cs-gpios section to create more chip selects. For further information on the SPI programming see the kernel example code and documentation: