How to configure SPI2 as a slave?

Hi teams

I use the agx xavier device, and L4T is R32 (release), REVISION: 5.1, GCID: 26202423, BOARD: t186ref, EABI: aarch64

I want to configure SPI2 as a slave mode device in Xavier. I want to know the configuration in the dt and pinmux settings.

And which addree is SPI 's address, is 0xc260000? Which document can i find the answer?

Thank you very much.

Can someone help me?

Xavier or Xavier NX?
You can use jetson-io to enable it for Xavier NX.

Hi it is AGX Xavier

Have reference to below topic for Xavier.

Hi ShaneCCC
Please answer me some questions
1: which address is SPI2 address, is 0xc260000?
2: set the SPI2 as slave mode - ( SPI2 = spi1, if SPI1 = spi0(the address is 3210000)) , the pinmux settings is what?
3: i will change the dt as below , is there any problems?

spi@c260000 {
		status = "okay";	//zp add
		spidev@0 {
			status = "okay";
	        compatible = "nvidia,tegra186-spi-slave";
	        spi@0 {
	            compatible = "spidev";
	            reg = <0>;
	            spi-max-frequency = <33000000>;
	            controller-data {
	                nvidia,enable-hw-based-cs;
	            };
	        };
		};
	};

Thanks so much for your answer and help.

                spi0 = "/spi@3210000";
                spi1 = "/spi@c260000";
                spi2 = "/spi@3230000";

  1. The pinmux configure are the same with master mode.
  2. No
1 Like

and the pinmux setting is set as below, if you say the master mode and the slave mode is same, so the below setting is useful, right?

pinmux.0x0c302048 = 0x00000400; # spi2_sck_pcc0: spi2, tristate-disable, input-disable, io_high_voltage-disable, lpdr-disable
pinmux.0x0c302050 = 0x00000450; # spi2_miso_pcc1: spi2, tristate-enable, input-enable, io_high_voltage-disable, lpdr-disable
pinmux.0x0c302028 = 0x00000400; # spi2_mosi_pcc2: spi2, tristate-disable, input-disable, io_high_voltage-disable, lpdr-disable
pinmux.0x0c302038 = 0x00000400; # spi2_cs0_pcc3: spi2, tristate-disable, input-disable, io_high_voltage-disable, lpdr-disable

Have program them as below.

pinmux.0x0243d040 = 0x00000450; # spi1_sck_pz3: rsvd1, pull-down, tristate-enable, input-enable, lpdr-disable
pinmux.0x0243d020 = 0x00000450; # spi1_miso_pz4: rsvd1, pull-down, tristate-enable, input-enable, lpdr-disable
pinmux.0x0243d058 = 0x00000450; # spi1_miso_pz4: rsvd1, pull-down, tristate-enable, input-enable, lpdr-disable
pinmux.0x0243d010 = 0x00000448; # spi1_cs0_pz6: rsvd1, pull-up, tristate-disable, input-enable, lpdr-disable
pinmux.0x0243d010 = 0x00000448; # spi1_cs0_pz6: rsvd1, pull-up, tristate-disable, input-enable, lpdr-disable

What is the command to get the receive date from spi2?
I use the command as below to get the date, but it does not work correctly.

root@dev-desktop:~/lab# ./spidev_test -D /dev/spidev1.0 -p dummy-8B
spi mode: 0x0
bits per word: 8
max speed: 12500000 Hz (12500 KHz)
can't send spi message: Invalid argument
Aborted (core dumped)

Could you enable SPI1 as mast and connect the SPI1 to SPI2 as loopback to run the test.

Does the SPI1 and SPI2 have internal connect channel for loopback test?

No you have connect them from external.

I cant test the spi2 from external, it is inseted in the board