Because of the holidays, TI E2E™ design support forum responses will be delayed from Dec. 25 through Jan. 2. Thank you for your patience.

This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TDA4AL-Q1: How to configure the DMA feature of SPI?

Part Number: TDA4AL-Q1

I followed this document to configure mcu SPI2 and SPI4, and ran the use case and found that neither party accepted the data

SPI Enablement and Validation on TDA4 Family.pdf

Here is the log that runs

root@j721s2-evm:/home/spi-test# ls -l /sys/class/spi*
/sys/class/spi_master:
total 0
lrwxrwxrwx 1 root root 0 Dec 16 07:58 spi0 -> ../../devices/platform/bus@100000/bus@100000:bus@28380000/40320000.spi/spi_master/spi0
lrwxrwxrwx 1 root root 0 Dec 16 07:58 spi1 -> ../../devices/platform/bus@100000/2110000.spi/spi_master/spi1
lrwxrwxrwx 1 root root 0 Dec 16 07:58 spi2 -> ../../devices/platform/bus@100000/2120000.spi/spi_master/spi2
lrwxrwxrwx 1 root root 0 Dec 16 07:58 spi3 -> ../../devices/platform/bus@100000/2130000.spi/spi_master/spi3
lrwxrwxrwx 1 root root 0 Dec 16 07:58 spi4 -> ../../devices/platform/bus@100000/2150000.spi/spi_master/spi4
lrwxrwxrwx 1 root root 0 Dec 16 07:58 spi5 -> ../../devices/platform/bus@100000/2160000.spi/spi_master/spi5
lrwxrwxrwx 1 root root 0 Dec 16 07:58 spi6 -> ../../devices/platform/bus@100000/2170000.spi/spi_master/spi6
lrwxrwxrwx 1 root root 0 Dec 16 07:58 spi7 -> ../../devices/platform/bus@100000/bus@100000:bus@28380000/47000000.syscon/47040000.spi/spi_master/spi7

/sys/class/spi_slave:
total 0
lrwxrwxrwx 1 root root 0 Dec 16 07:58 spi8 -> ../../devices/platform/bus@100000/2100000.spi/spi_slave/spi8
lrwxrwxrwx 1 root root 0 Dec 16 07:58 spi9 -> ../../devices/platform/bus@100000/2140000.spi/spi_slave/spi9

/sys/class/spidev:
total 0
lrwxrwxrwx 1 root root 0 Dec 16 07:58 spidev0.0 -> ../../devices/platform/bus@100000/bus@100000:bus@28380000/40320000.spi/spi_master/spi0/spi0.0/spidev/spidev0.0
lrwxrwxrwx 1 root root 0 Dec 16 07:58 spidev9.0 -> ../../devices/platform/bus@100000/2140000.spi/spi_slave/spi9/spi9.0/spidev/spidev9.0
root@j721s2-evm:/home/spi-test# ./spidev_test -v -D /dev/spidev9.0 -p slave-hello-to-master &
[1] 1201
spi mode: 0x0[ 4339.144088] [slave][byd:omap2_mcspi_transfer_one:1091] pos

bits per word: 8
max speed: 500000 Hz (500 kHz)
[ 4339.150710] [slave][byd:omap2_mcspi_txrx_pio:654] pos word_len=8
root@j721s2-evm:/home/spi-test# [ 4340.161299] spidev spi9.0: RXS timed out
TX | 73 6C 61 76 65 2D 68 65 6C 6C 6F 2D 74 6F 2D 6D 61 73 74 65 72 __ __ __ __ __ __ __ __ __ __ __  |slave-hello-to-master|
RX | 2F 73 79 73 74 65 6D 2E 73 6C 69 63 65 2F 73 79 73 74 65 6D 64 __ __ __ __ __ __ __ __ __ __ __  |/system.slice/systemd|
root@j721s2-evm:/home/spi-test# ./spidev_test -v -D /dev/spidev0.0 -p master-hello-to-slave
spi mode: 0x0[ 4349.375580] [master][byd:omap2_mcspi_transfer_one:1091] pos

bits per word: 8
max speed: 500000 Hz (500 kHz)
[ 4349.382259] [master][byd:omap2_mcspi_txrx_pio:654] pos word_len=8
TX | 6D 61 73 74 65 72 2D 68 65 6C 6C 6F 2D 74 6F 2D 73 6C 61 76 65 __ __ __ __ __ __ __ __ __ __ __  |master-hello-to-slave|
RX | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 __ __ __ __ __ __ __ __ __ __ __  |.....................|
[1]+  Done                    ./spidev_test -v -D /dev/spidev9.0 -p slave-hello-to-master
root@j721s2-evm:/home/spi-test#

Here are the code modifications

diff --git a/board-support/linux-5.10.153+gitAUTOINC+90c3a58fd2-g90c3a58fd2/arch/arm64/boot/dts/ti/k3-j721s2-common-proc-board.dts b/board-support/linux-5.10.153+gitAUTOINC+90c3a58fd2-g90c3a58fd2/arch/arm64/boot/dts/ti/k3-j721s2-common-proc-board.dts
index 5d57dc2b1..9785847cb 100644
--- a/board-support/linux-5.10.153+gitAUTOINC+90c3a58fd2-g90c3a58fd2/arch/arm64/boot/dts/ti/k3-j721s2-common-proc-board.dts
+++ b/board-support/linux-5.10.153+gitAUTOINC+90c3a58fd2-g90c3a58fd2/arch/arm64/boot/dts/ti/k3-j721s2-common-proc-board.dts
+&main_spi4 {
+       status="okay";
+       spi-slave;
+       slave@0 {
+               spi-max-frequency = <24000000>;
+               reg = <0>;
+               compatible = "linux,spidev";
+       };
+};
+
+&mcu_spi2 {
+       status="okay";
+       spidev@0 {
+               spi-max-frequency = <24000000>;
+               reg = <0>;
+               compatible = "linux,spidev";
+       };
+};
diff --git a/board-support/linux-5.10.153+gitAUTOINC+90c3a58fd2-g90c3a58fd2/arch/arm64/boot/dts/ti/k3-j721s2-main.dtsi b/board-support/linux-5.10.153+gitAUTOINC+90c3a58fd2-g90c3a58fd2/arch/arm64/boot/dts/ti/k3-j721s2-main.dtsi
index c566dec93..01e9649a3 100644
--- a/board-support/linux-5.10.153+gitAUTOINC+90c3a58fd2-g90c3a58fd2/arch/arm64/boot/dts/ti/k3-j721s2-main.dtsi
+++ b/board-support/linux-5.10.153+gitAUTOINC+90c3a58fd2-g90c3a58fd2/arch/arm64/boot/dts/ti/k3-j721s2-main.dtsi
 	main_spi1: spi@2110000 {
@@ -1385,6 +1387,8 @@ main_spi4: spi@2140000 {
 		#size-cells = <0>;
 		clocks = <&k3_clks 343 1>;
 		power-domains = <&k3_pds 343 TI_SCI_PD_EXCLUSIVE>;
+		dmas = <&main_udmap 0xc618>, <&main_udmap 0x4618>;
+        dma-names = "tx0", "rx0";
 	};
 
 	main_spi5: spi@2150000 {
diff --git a/board-support/linux-5.10.153+gitAUTOINC+90c3a58fd2-g90c3a58fd2/arch/arm64/boot/dts/ti/k3-j721s2.dtsi b/board-support/linux-5.10.153+gitAUTOINC+90c3a58fd2-g90c3a58fd2/arch/arm64/boot/dts/ti/k3-j721s2.dtsi
index 75bc8dfac..25dab477a 100644
--- a/board-support/linux-5.10.153+gitAUTOINC+90c3a58fd2-g90c3a58fd2/arch/arm64/boot/dts/ti/k3-j721s2.dtsi
+++ b/board-support/linux-5.10.153+gitAUTOINC+90c3a58fd2-g90c3a58fd2/arch/arm64/boot/dts/ti/k3-j721s2.dtsi
@@ -145,6 +145,7 @@ cbass_mcu_wakeup: bus@28380000 {
 			#size-cells = <2>;
 			ranges = <0x00 0x28380000 0x00 0x28380000 0x00 0x03880000>, /* MCU NAVSS*/
 				 <0x00 0x40200000 0x00 0x40200000 0x00 0x00998400>, /* First peripheral window */
+				 <0x00 0x40320000 0x00 0x40320000 0x00 0x00000400>, /* MCU SPI2 */
 				 <0x00 0x40f00000 0x00 0x40f00000 0x00 0x00020000>, /* CTRL_MMR0 */
 				 <0x00 0x41000000 0x00 0x41000000 0x00 0x00020000>, /* MCU R5F Core0 */
 				 <0x00 0x41400000 0x00 0x41400000 0x00 0x00020000>, /* MCU R5F Core1 */
diff --git a/board-support/linux-5.10.153+gitAUTOINC+90c3a58fd2-g90c3a58fd2/arch/arm64/configs/tisdk_j721s2-evm_defconfig b/board-support/linux-5.10.153+gitAUTOINC+90c3a58fd2-g90c3a58fd2/arch/arm64/configs/tisdk_j721s2-evm_defconfig
index a68a36227..e992df20a 100644
--- a/board-support/linux-5.10.153+gitAUTOINC+90c3a58fd2-g90c3a58fd2/arch/arm64/configs/tisdk_j721s2-evm_defconfig
+++ b/board-support/linux-5.10.153+gitAUTOINC+90c3a58fd2-g90c3a58fd2/arch/arm64/configs/tisdk_j721s2-evm_defconfig
@@ -3110,9 +3110,11 @@ CONFIG_SPI_PL022=y
 # SPI Protocol Masters
 #
 # CONFIG_SPI_SPIDEV is not set
+CONFIG_SPI_SPIDEV=y
 # CONFIG_SPI_LOOPBACK_TEST is not set
 # CONFIG_SPI_TLE62X0 is not set
 # CONFIG_SPI_SLAVE is not set
+CONFIG_SPI_SLAVE=y
 CONFIG_SPI_DYNAMIC=y
 CONFIG_SPMI=y
 # CONFIG_HSI is not set
diff --git a/board-support/linux-5.10.153+gitAUTOINC+90c3a58fd2-g90c3a58fd2/drivers/dma/ti/k3-psil-j721s2.c b/board-support/linux-5.10.153+gitAUTOINC+90c3a58fd2-g90c3a58fd2/drivers/dma/ti/k3-psil-j721s2.c
index 6fd6c203f..2bca38749 100644
--- a/board-support/linux-5.10.153+gitAUTOINC+90c3a58fd2-g90c3a58fd2/drivers/dma/ti/k3-psil-j721s2.c
+++ b/board-support/linux-5.10.153+gitAUTOINC+90c3a58fd2-g90c3a58fd2/drivers/dma/ti/k3-psil-j721s2.c
@@ -78,14 +78,17 @@ static struct psil_ep j721s2_src_ep_map[] = {
 	PSIL_PDMA_XY_PKT(0x4601),
 	PSIL_PDMA_XY_PKT(0x4602),
 	PSIL_PDMA_XY_PKT(0x4603),
+	
 	PSIL_PDMA_XY_PKT(0x4604),
 	PSIL_PDMA_XY_PKT(0x4605),
 	PSIL_PDMA_XY_PKT(0x4606),
 	PSIL_PDMA_XY_PKT(0x4607),
+	
 	PSIL_PDMA_XY_PKT(0x4608),
 	PSIL_PDMA_XY_PKT(0x4609),
 	PSIL_PDMA_XY_PKT(0x460a),
 	PSIL_PDMA_XY_PKT(0x460b),
+	
 	PSIL_PDMA_XY_PKT(0x460c),
 	PSIL_PDMA_XY_PKT(0x460d),
 	PSIL_PDMA_XY_PKT(0x460e),
@@ -248,6 +251,16 @@ static struct psil_ep j721s2_dst_ep_map[] = {
 	/* SA2UL */
 	PSIL_SA2UL(0xf500, 1),
 	PSIL_SA2UL(0xf501, 1),
+	/* PDMA10 (PDMA_MISC_G2) - SPI4 */
+	PSIL_PDMA_XY_PKT(0xc618),
+	PSIL_PDMA_XY_PKT(0xc619),
+	PSIL_PDMA_XY_PKT(0xc61a),
+	PSIL_PDMA_XY_PKT(0xc61b),
 };
 
 struct psil_ep_map j721s2_ep_map = {

I think DMA didn't work, because when configuring DMA, it was configured with reference to k3-psil-j721e.c, I don't know how PSIL_PDMA_XY_PKT is matched, can you tell me, thanks

  • Hi,

    There is a corresponding file for j721s2: drivers/dma/ti/k3-psil-j721s2.c

    Can you add your changes to that?

    - Keerthy

  • yes,i add it ,but it don`t work

    diff --git a/board-support/linux-5.10.153+gitAUTOINC+90c3a58fd2-g90c3a58fd2/drivers/dma/ti/k3-psil-j721s2.c b/board-support/linux-5.10.153+gitAUTOINC+90c3a58fd2-g90c3a58fd2/drivers/dma/ti/k3-psil-j721s2.c
    index 6fd6c203f..2bca38749 100644
    --- a/board-support/linux-5.10.153+gitAUTOINC+90c3a58fd2-g90c3a58fd2/drivers/dma/ti/k3-psil-j721s2.c
    +++ b/board-support/linux-5.10.153+gitAUTOINC+90c3a58fd2-g90c3a58fd2/drivers/dma/ti/k3-psil-j721s2.c
    @@ -78,14 +78,17 @@ static struct psil_ep j721s2_src_ep_map[] = {
     	PSIL_PDMA_XY_PKT(0x4601),
     	PSIL_PDMA_XY_PKT(0x4602),
     	PSIL_PDMA_XY_PKT(0x4603),
    +	
     	PSIL_PDMA_XY_PKT(0x4604),
     	PSIL_PDMA_XY_PKT(0x4605),
     	PSIL_PDMA_XY_PKT(0x4606),
     	PSIL_PDMA_XY_PKT(0x4607),
    +	
     	PSIL_PDMA_XY_PKT(0x4608),
     	PSIL_PDMA_XY_PKT(0x4609),
     	PSIL_PDMA_XY_PKT(0x460a),
     	PSIL_PDMA_XY_PKT(0x460b),
    +	
     	PSIL_PDMA_XY_PKT(0x460c),
     	PSIL_PDMA_XY_PKT(0x460d),
     	PSIL_PDMA_XY_PKT(0x460e),
    @@ -248,6 +251,16 @@ static struct psil_ep j721s2_dst_ep_map[] = {
     	/* SA2UL */
     	PSIL_SA2UL(0xf500, 1),
     	PSIL_SA2UL(0xf501, 1),
    +	/* PDMA10 (PDMA_MISC_G2) - SPI4 */
    +	PSIL_PDMA_XY_PKT(0xc618),
    +	PSIL_PDMA_XY_PKT(0xc619),
    +	PSIL_PDMA_XY_PKT(0xc61a),
    +	PSIL_PDMA_XY_PKT(0xc61b),
     };

  • Hi,

    The PSIL thread IDs are different on the j721s.

    File: drivers/dma/ti/k3-psil-j721s2.c

     /* PDMA_SPI_G1 - SPI4-7 */
            PSIL_PDMA_XY_PKT(0x4610),
            PSIL_PDMA_XY_PKT(0x4611),
            PSIL_PDMA_XY_PKT(0x4612),
            PSIL_PDMA_XY_PKT(0x4613),

    So the RX thread ID for J721s2 SPI4 is 0x4610 & NOT 0x4618.

    Also you need to add the TX threads for SPI4 something like below:

    diff --git a/drivers/dma/ti/k3-psil-j721s2.c b/drivers/dma/ti/k3-psil-j721s2.c
    index 6fd6c203f..d153431fe 100644
    --- a/drivers/dma/ti/k3-psil-j721s2.c
    +++ b/drivers/dma/ti/k3-psil-j721s2.c
    @@ -233,6 +233,11 @@ static struct psil_ep j721s2_dst_ep_map[] = {
            PSIL_ETHERNET(0xf005),
            PSIL_ETHERNET(0xf006),
            PSIL_ETHERNET(0xf007),
    +       /* PDMA_SPI_G1 - SPI4 */
    +       PSIL_PDMA_XY_PKT(0xc610),
    +       PSIL_PDMA_XY_PKT(0xc611),
    +       PSIL_PDMA_XY_PKT(0xc612),
    +       PSIL_PDMA_XY_PKT(0xc613),
    

    So your node changes like:

    diff --git a/board-support/linux-5.10.153+gitAUTOINC+90c3a58fd2-g90c3a58fd2/arch/arm64/boot/dts/ti/k3-j721s2-main.dtsi b/board-support/linux-5.10.153+gitAUTOINC+90c3a58fd2-g90c3a58fd2/arch/arm64/boot/dts/ti/k3-j721s2-main.dtsi
    index c566dec93..01e9649a3 100644
    --- a/board-support/linux-5.10.153+gitAUTOINC+90c3a58fd2-g90c3a58fd2/arch/arm64/boot/dts/ti/k3-j721s2-main.dtsi
    +++ b/board-support/linux-5.10.153+gitAUTOINC+90c3a58fd2-g90c3a58fd2/arch/arm64/boot/dts/ti/k3-j721s2-main.dtsi
     	main_spi1: spi@2110000 {
    @@ -1385,6 +1387,8 @@ main_spi4: spi@2140000 {
     		#size-cells = <0>;
     		clocks = <&k3_clks 343 1>;
     		power-domains = <&k3_pds 343 TI_SCI_PD_EXCLUSIVE>;
    +		dmas = <&main_udmap 0xc610>, <&main_udmap 0x4610>;
    +        dma-names = "tx0", "rx0";

    Try that and let me know if that works for you. I have not tried the changes but those are changes w.r.t J721s2.

    Regards,
    Keerthy

  • I modified it with the code you gave, but it still doesn't work, it seems that DMA doesn't work

    Here are the log and modification records

    root@j721s2-evm:/home/spi-test# ls -l /sys/class/spi*
    /sys/class/spi_master:
    total 0
    lrwxrwxrwx 1 root root 0 Dec 16 07:58 spi0 -> ../../devices/platform/bus@100000/bus@100000:bus@28380000/40320000.spi/spi_master/spi0
    lrwxrwxrwx 1 root root 0 Dec 16 07:58 spi1 -> ../../devices/platform/bus@100000/2100000.spi/spi_master/spi1
    lrwxrwxrwx 1 root root 0 Dec 16 07:58 spi2 -> ../../devices/platform/bus@100000/2110000.spi/spi_master/spi2
    lrwxrwxrwx 1 root root 0 Dec 16 07:58 spi3 -> ../../devices/platform/bus@100000/2120000.spi/spi_master/spi3
    lrwxrwxrwx 1 root root 0 Dec 16 07:58 spi4 -> ../../devices/platform/bus@100000/2130000.spi/spi_master/spi4
    lrwxrwxrwx 1 root root 0 Dec 16 07:58 spi5 -> ../../devices/platform/bus@100000/2150000.spi/spi_master/spi5
    lrwxrwxrwx 1 root root 0 Dec 16 07:58 spi6 -> ../../devices/platform/bus@100000/2160000.spi/spi_master/spi6
    lrwxrwxrwx 1 root root 0 Dec 16 07:58 spi7 -> ../../devices/platform/bus@100000/2170000.spi/spi_master/spi7
    lrwxrwxrwx 1 root root 0 Dec 16 07:58 spi8 -> ../../devices/platform/bus@100000/bus@100000:bus@28380000/47000000.syscon/47040000.spi/spi_master/spi8
    
    /sys/class/spi_slave:
    total 0
    lrwxrwxrwx 1 root root 0 Dec 16 07:58 spi9 -> ../../devices/platform/bus@100000/2140000.spi/spi_slave/spi9
    
    /sys/class/spidev:
    total 0
    lrwxrwxrwx 1 root root 0 Dec 16 07:58 spidev0.0 -> ../../devices/platform/bus@100000/bus@100000:bus@28380000/40320000.spi/spi_master/spi0/spi0.0/spidev/spidev0.0
    lrwxrwxrwx 1 root root 0 Dec 16 07:58 spidev1.0 -> ../../devices/platform/bus@100000/2100000.spi/spi_master/spi1/spi1.0/spidev/spidev1.0
    lrwxrwxrwx 1 root root 0 Dec 16 07:58 spidev9.0 -> ../../devices/platform/bus@100000/2140000.spi/spi_slave/spi9/spi9.0/spidev/spidev9.0
    root@j721s2-evm:/home/spi-test# ./spidev_test -v -D /dev/spidev9.0 -p slave-hello-to-master &
    [1] 941
    spi mode: 0x0
    [   96.438789] [slave][byd:omap2_mcspi_transfer_one:1146] pos
    bits per word: 8
    max speed: 10000000 Hz (10000 kHz)
    [   96.445539] [slave][byd:omap2_mcspi_txrx_pio:703] pos word_len=8
    root@j721s2-evm:/home/spi-test# [   97.456916] spidev spi9.0: RXS timed out
    TX | 73 6C 61 76 65 2D 68 65 6C 6C 6F 2D 74 6F 2D 6D 61 73 74 65 72 __ __ __ __ __ __ __ __ __ __ __  |slave-hello-to-master|
    RX | 2F 73 79 73 74 65 6D 2E 73 6C 69 63 65 2F 73 79 73 74 65 6D 64 __ __ __ __ __ __ __ __ __ __ __  |/system.slice/systemd|
    
    [1]+  Done                    ./spidev_test -v -D /dev/spidev9.0 -p slave-hello-to-master
    root@j721s2-evm:/home/spi-test# ./spidev_test -v -D /dev/spidev0.0 -p master-hello-to-slave
    spi mode: 0x0
    [  130.731109] [master][byd:omap2_mcspi_transfer_one:1146] pos
    bits per word: 8
    max speed: 10000000 Hz (10000 kHz)
    [  130.737953] [master][byd:omap2_mcspi_txrx_pio:703] pos word_len=8
    TX | 6D 61 73 74 65 72 2D 68 65 6C 6C 6F 2D 74 6F 2D 73 6C 61 76 65 __ __ __ __ __ __ __ __ __ __ __  |master-hello-to-slave|
    RX | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 __ __ __ __ __ __ __ __ __ __ __  |.....................|
    
    root@j721s2-evm:/home/spi-test# dmesg | grep spi
    [    0.000000] Kernel command line: console=ttyS2,115200n8 earlycon=ns16550a,mmio32,0x02880000 mtdparts=47040000.spi.0:512k(ospi.tiboot3),2m(ospi.tispl),4m(ospi.u-boot),256k(ospi.env),256k(ospi.env.backup),57088k@8m(ospi.rootfs),256k(ospi.phypattern);47034000.hyperbus:512k(hbmc.tiboot3),2m(hbmc.tispl),4m(hbmc.u-boot),256k(hbmc.env),-@8m(hbmc.rootfs) root=PARTUUID=a82823d5-02 rw rootfstype=ext4 rootwait
    [    2.378810] spi-nor spi8.0: unrecognized JEDEC id bytes: 80 00 00 00 00 00
    [    2.385686] spi-nor: probe of spi8.0 failed with error -2
    [   97.456916] spidev spi9.0: RXS timed out
    
    

    diff --git a/board-support/linux-5.10.153+gitAUTOINC+90c3a58fd2-g90c3a58fd2/arch/arm64/boot/dts/ti/k3-j721s2-common-proc-board.dts b/board-support/linux-5.10.153+gitAUTOINC+90c3a58fd2-g90c3a58fd2/arch/arm64/boot/dts/ti/k3-j721s2-common-proc-board.dts
    index 5d57dc2b1..b786675ed 100644
    --- a/board-support/linux-5.10.153+gitAUTOINC+90c3a58fd2-g90c3a58fd2/arch/arm64/boot/dts/ti/k3-j721s2-common-proc-board.dts
    +++ b/board-support/linux-5.10.153+gitAUTOINC+90c3a58fd2-g90c3a58fd2/arch/arm64/boot/dts/ti/k3-j721s2-common-proc-board.dts
    
     &wkup_pmx0 {
    @@ -332,6 +344,9 @@ J721S2_WKUP_IOPAD(0x044, PIN_INPUT, 0) /* (B20) MCU_OSPI1_LBCLKO */
     	};
     };
     
    +
    +
    +
     &main_gpio2 {
     	status = "disabled";
     };
    @@ -474,13 +489,14 @@ &main_sdhci0 {
     	non-removable;
     	ti,driver-strength-ohm = <50>;
     	disable-wp;
    -	status = "disabled";
    +	//status = "disabled";
     };
     
     &main_sdhci1 {
     	/* SD card */
     	pinctrl-0 = <&main_mmc1_pins_default>;
     	pinctrl-names = "default";
    +	no-1-8-v;
     	disable-wp;
     	/*vmmc-supply = <&vdd_mmc1>;*/
     	/*vqmmc-supply = <&vdd_sd_dv>;*/
    @@ -842,3 +858,38 @@ gpio {
     		};
     	};
     };
    
    +&main_spi4 {
    +       status="okay";
    +       spi-slave;
    +       slave@0 {
    +               spi-max-frequency = <24000000>;
    +               reg = <0>;
    +               compatible = "linux,spidev";
    +       };
    +};
    +
    +&mcu_spi2 {
    +       status="okay";
    +       spidev@0 {
    +               spi-max-frequency = <24000000>;
    +               reg = <0>;
    +               compatible = "linux,spidev";
    +       };
    +};
    diff --git a/board-support/linux-5.10.153+gitAUTOINC+90c3a58fd2-g90c3a58fd2/arch/arm64/boot/dts/ti/k3-j721s2-main.dtsi b/board-support/linux-5.10.153+gitAUTOINC+90c3a58fd2-g90c3a58fd2/arch/arm64/boot/dts/ti/k3-j721s2-main.dtsi
    index c566dec93..95f576920 100644
    --- a/board-support/linux-5.10.153+gitAUTOINC+90c3a58fd2-g90c3a58fd2/arch/arm64/boot/dts/ti/k3-j721s2-main.dtsi
    +++ b/board-support/linux-5.10.153+gitAUTOINC+90c3a58fd2-g90c3a58fd2/arch/arm64/boot/dts/ti/k3-j721s2-main.dtsi
     	main_spi1: spi@2110000 {
    @@ -1385,6 +1387,8 @@ main_spi4: spi@2140000 {
     		#size-cells = <0>;
     		clocks = <&k3_clks 343 1>;
     		power-domains = <&k3_pds 343 TI_SCI_PD_EXCLUSIVE>;
    +		dmas = <&main_udmap 0xc610>, <&main_udmap 0x4610>;
    +        dma-names = "tx0", "rx0";
     	};
     
     	main_spi5: spi@2150000 {
    diff --git a/board-support/linux-5.10.153+gitAUTOINC+90c3a58fd2-g90c3a58fd2/arch/arm64/boot/dts/ti/k3-j721s2.dtsi b/board-support/linux-5.10.153+gitAUTOINC+90c3a58fd2-g90c3a58fd2/arch/arm64/boot/dts/ti/k3-j721s2.dtsi
    index 75bc8dfac..25dab477a 100644
    --- a/board-support/linux-5.10.153+gitAUTOINC+90c3a58fd2-g90c3a58fd2/arch/arm64/boot/dts/ti/k3-j721s2.dtsi
    +++ b/board-support/linux-5.10.153+gitAUTOINC+90c3a58fd2-g90c3a58fd2/arch/arm64/boot/dts/ti/k3-j721s2.dtsi
    @@ -145,6 +145,7 @@ cbass_mcu_wakeup: bus@28380000 {
     			#size-cells = <2>;
     			ranges = <0x00 0x28380000 0x00 0x28380000 0x00 0x03880000>, /* MCU NAVSS*/
     				 <0x00 0x40200000 0x00 0x40200000 0x00 0x00998400>, /* First peripheral window */
    +				 <0x00 0x40320000 0x00 0x40320000 0x00 0x00000400>, /* MCU SPI2 */
     				 <0x00 0x40f00000 0x00 0x40f00000 0x00 0x00020000>, /* CTRL_MMR0 */
     				 <0x00 0x41000000 0x00 0x41000000 0x00 0x00020000>, /* MCU R5F Core0 */
     				 <0x00 0x41400000 0x00 0x41400000 0x00 0x00020000>, /* MCU R5F Core1 */
    diff --git a/board-support/linux-5.10.153+gitAUTOINC+90c3a58fd2-g90c3a58fd2/arch/arm64/configs/tisdk_j721s2-evm_defconfig b/board-support/linux-5.10.153+gitAUTOINC+90c3a58fd2-g90c3a58fd2/arch/arm64/configs/tisdk_j721s2-evm_defconfig
    index a68a36227..e992df20a 100644
    --- a/board-support/linux-5.10.153+gitAUTOINC+90c3a58fd2-g90c3a58fd2/arch/arm64/configs/tisdk_j721s2-evm_defconfig
    +++ b/board-support/linux-5.10.153+gitAUTOINC+90c3a58fd2-g90c3a58fd2/arch/arm64/configs/tisdk_j721s2-evm_defconfig
    @@ -3110,9 +3110,11 @@ CONFIG_SPI_PL022=y
     # SPI Protocol Masters
     #
     # CONFIG_SPI_SPIDEV is not set
    +CONFIG_SPI_SPIDEV=y
     # CONFIG_SPI_LOOPBACK_TEST is not set
     # CONFIG_SPI_TLE62X0 is not set
     # CONFIG_SPI_SLAVE is not set
    +CONFIG_SPI_SLAVE=y
     CONFIG_SPI_DYNAMIC=y
     CONFIG_SPMI=y
     # CONFIG_HSI is not set
    diff --git a/board-support/linux-5.10.153+gitAUTOINC+90c3a58fd2-g90c3a58fd2/drivers/dma/ti/k3-psil-j721s2.c b/board-support/linux-5.10.153+gitAUTOINC+90c3a58fd2-g90c3a58fd2/drivers/dma/ti/k3-psil-j721s2.c
    index 6fd6c203f..1e9d692e4 100644
    --- a/board-support/linux-5.10.153+gitAUTOINC+90c3a58fd2-g90c3a58fd2/drivers/dma/ti/k3-psil-j721s2.c
    +++ b/board-support/linux-5.10.153+gitAUTOINC+90c3a58fd2-g90c3a58fd2/drivers/dma/ti/k3-psil-j721s2.c
    @@ -78,14 +78,17 @@ static struct psil_ep j721s2_src_ep_map[] = {
     	PSIL_PDMA_XY_PKT(0x4601),
     	PSIL_PDMA_XY_PKT(0x4602),
     	PSIL_PDMA_XY_PKT(0x4603),
    +	
     	PSIL_PDMA_XY_PKT(0x4604),
     	PSIL_PDMA_XY_PKT(0x4605),
     	PSIL_PDMA_XY_PKT(0x4606),
     	PSIL_PDMA_XY_PKT(0x4607),
    +	
     	PSIL_PDMA_XY_PKT(0x4608),
     	PSIL_PDMA_XY_PKT(0x4609),
     	PSIL_PDMA_XY_PKT(0x460a),
     	PSIL_PDMA_XY_PKT(0x460b),
    +	
     	PSIL_PDMA_XY_PKT(0x460c),
     	PSIL_PDMA_XY_PKT(0x460d),
     	PSIL_PDMA_XY_PKT(0x460e),
    @@ -248,6 +251,17 @@ static struct psil_ep j721s2_dst_ep_map[] = {
     	/* SA2UL */
     	PSIL_SA2UL(0xf500, 1),
     	PSIL_SA2UL(0xf501, 1),
    +	/* PDMA10 (PDMA_MISC_G0) - SPI0 */
    +    PSIL_PDMA_XY_PKT(0xc600),
    +    PSIL_PDMA_XY_PKT(0xc601),
    +    PSIL_PDMA_XY_PKT(0xc602),
    +    PSIL_PDMA_XY_PKT(0xc603),
    +	/* PDMA10 (PDMA_MISC_G1) - SPI4 */
    +    PSIL_PDMA_XY_PKT(0xc610),
    +    PSIL_PDMA_XY_PKT(0xc611),
    +    PSIL_PDMA_XY_PKT(0xc612),
    +    PSIL_PDMA_XY_PKT(0xc613),
    +
     };
     
     struct psil_ep_map j721s2_ep_map = {

  • Hi,

    I see that only in the J721e TRM. In the j721s2 TRM I do not see the same in the overview section. I will check internally on this to confirm that it is the same instances hardwired as SPI Slave and masters.

    Please share the code changes that you have done for a review?

    - Keerthy