SPRAD26 April   2022 TDA4VM

 

  1.   Trademarks
  2. 1SPI: Serial Peripheral Interface
  3. 2J7200/J721e MCSPI Support
    1. 2.1 MCSPI Features
  4. 3SPI: Master Mode Enabling and Validation on Linux
    1. 3.1 Enable SPI Instances of J721e/TDA4VM
    2. 3.2 Enable SPIDEV on TD4VM SDK
    3. 3.3 Exercise SPI From User Space on TI J7/TDA4x Using Standard Linux spidev_test Tool
  5. 4SPI: Slave Mode Enabling and Validation on Linux
    1. 4.1 Enable SPI Instances of J7200
    2. 4.2 Enable DMA for MCSPI4 Slave Node
    3. 4.3 Enable SPIDEV and SPI_SLAVE Configs
    4. 4.4 Test SPI Slave Functionality From User Space on TI J7200 Using Standard Linux spidev_test Tool
    5. 4.5 SPI Slave Testing Using spi-slave-time
    6. 4.6 Linux SPI Slave Challenges
    7. 4.7 Linux SPI Slave Mode General Limitations
    8. 4.8 McSPI SPI Slave Mode Limitations
  6. 5References

Enable SPI Instances of J721e/TDA4VM

For example lets us take main domain SPI6 instance. To enable SPI6, add the device tree node and the corresponding pinmux node.

diff --git a/arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts b/arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts
index 6788a3611..77b845354 100644
--- a/arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts
+++ b/arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts
@@ -170,6 +170,18 @@
>;
};

+ spi6_pins_default: spi6_pins_default {
+ pinctrl-single,pins = <
+ J721E_IOPAD(0x9c, PIN_INPUT, 4) /* (AC22) PRG1_PRU1_GPO17.SPI6_CLK */
+ J721E_IOPAD(0x74, PIN_INPUT, 4) /* (AC21) PRG1_PRU1_GPO7.SPI6_CS0 */
+ J721E_IOPAD(0x28, PIN_INPUT, 4) /* (AG20) PRG1_PRU0_GPO9.SPI6_CS1 */
+ J721E_IOPAD(0x2c, PIN_INPUT, 4) /* (AD21) PRG1_PRU0_GPO10.SPI6_CS2 */
+ J721E_IOPAD(0x7c, PIN_INPUT, 4) /* (AF21) PRG1_PRU1_GPO9.SPI6_CS3 */
+ J721E_IOPAD(0xa0, PIN_INPUT, 4) /* (AJ22) PRG1_PRU1_GPO18.SPI6_D0 */
+ J721E_IOPAD(0xa4, PIN_INPUT, 4) /* (AH22) PRG1_PRU1_GPO19.SPI6_D1 */
+ >;
+ };
+

diff --git a/arch/arm64/boot/dts/ti/k3-j721e-main.dtsi b/arch/arm64/boot/dts/ti/k3-j721e-main.dtsi
index c036df124..edc42720f 100644
--- a/arch/arm64/boot/dts/ti/k3-j721e-main.dtsi
+++ b/arch/arm64/boot/dts/ti/k3-j721e-main.dtsi
@@ -74,6 +74,16 @@
};
};

+ main_spi6: spi@2160000 {
+ compatible = "ti,am654-mcspi","ti,omap4-mcspi";
+ reg = <0x0 0x2160000 0x0 0x400>;
+ interrupts = <GIC_SPI 190 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&k3_clks 272 1>;
+ power-domains = <&k3_pds 272 TI_SCI_PD_EXCLUSIVE>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ };
+

CONFIG_SPI_OMAP24XX=y is already set in arch/arm64/configs/tisdk_j7-evm_defconfig. The SPI master driver is drivers/spi/spi-omap2-mcspi.c.