VAR-SOM-MX6 SPI: Difference between revisions
From Variscite Wiki
No edit summary |
(Add category Debian) |
||
(7 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{PageHeader|VAR-SOM-MX6 - SPI}} {{DocImage|category1=VAR-SOM-MX6 | {{PageHeader|VAR-SOM-MX6 - SPI}} {{DocImage|category1=Yocto|category2=Debian}} [[category:VAR-SOM-MX6]] __toc__ | ||
Testing SPI from user space require some changes. | Testing SPI from user space require some changes. | ||
* Configure your kernel and | * Configure your kernel (using "make menuconfig", for example) and make sure the spidev driver (SPI_SPIDEV) is included: Device Drivers -> SPI support -> <*> User mode SPI device driver support<br> | ||
* Add spidev to your device tree<br> | * Add spidev and pinctrl to your device tree<br> | ||
For VAR-SOM-MX6, edit arch/arm/boot/dts/imx6qdl-var-som.dtsi<br> | |||
For DART-MX6, edit arch/arm/boot/dts/imx6qdl-var-dart.dtsi<br> | |||
<pre>&ecspi1 { | <pre>&ecspi1 { | ||
fsl,spi-num-chipselects = <1>; | fsl,spi-num-chipselects = <1>; | ||
cs-gpios = <&gpio4 9 0>; | cs-gpios = <&gpio4 9 0>; | ||
pinctrl-names = "default"; | pinctrl-names = "default"; | ||
pinctrl-0 = <& | pinctrl-0 = <&pinctrl_ecspi1_1>; | ||
status = "okay"; | status = "okay"; | ||
Line 24: | Line 26: | ||
*/ | */ | ||
};</pre> | };</pre> | ||
* | <pre> | ||
* For testing use the | pinctrl_ecspi1_1: ecspi1grp { | ||
fsl,pins = < | |||
MX6QDL_PAD_KEY_COL1__ECSPI1_MISO 0x100b1 | |||
MX6QDL_PAD_KEY_ROW0__ECSPI1_MOSI 0x100b1 | |||
MX6QDL_PAD_KEY_COL0__ECSPI1_SCLK 0x100b1 | |||
MX6QDL_PAD_KEY_ROW1__GPIO4_IO09 0x80000000 | |||
>; | |||
}; | |||
</pre> | |||
Choose the right chip select (you can also have multiple chip selects). | |||
* Continue following the "Customizing the Linux kernel" guide to build the kernel and device trees. | |||
* For testing use the SPI testing utility in the tools folder of the kernel source tree: tools/spi/spidev_test.c (in older kernels: Documentation/spi/spidev_test.c) |
Latest revision as of 19:25, 28 April 2023
VAR-SOM-MX6 - SPI
Testing SPI from user space require some changes.
- Configure your kernel (using "make menuconfig", for example) and make sure the spidev driver (SPI_SPIDEV) is included: Device Drivers -> SPI support -> <*> User mode SPI device driver support
- Add spidev and pinctrl to your device tree
For VAR-SOM-MX6, edit arch/arm/boot/dts/imx6qdl-var-som.dtsi
For DART-MX6, edit arch/arm/boot/dts/imx6qdl-var-dart.dtsi
&ecspi1 { fsl,spi-num-chipselects = <1>; cs-gpios = <&gpio4 9 0>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_ecspi1_1>; status = "okay"; chip1: spidev@0 { compatible = "spidev"; spi-max-frequency = <12000000>; reg = <0>; }; /* chip2: spidev@1 { compatible = "spidev"; spi-max-frequency = <20000000>; reg = <1>; }; */ };
pinctrl_ecspi1_1: ecspi1grp { fsl,pins = < MX6QDL_PAD_KEY_COL1__ECSPI1_MISO 0x100b1 MX6QDL_PAD_KEY_ROW0__ECSPI1_MOSI 0x100b1 MX6QDL_PAD_KEY_COL0__ECSPI1_SCLK 0x100b1 MX6QDL_PAD_KEY_ROW1__GPIO4_IO09 0x80000000 >; };
Choose the right chip select (you can also have multiple chip selects).
- Continue following the "Customizing the Linux kernel" guide to build the kernel and device trees.
- For testing use the SPI testing utility in the tools folder of the kernel source tree: tools/spi/spidev_test.c (in older kernels: Documentation/spi/spidev_test.c)