How to use aon spi on TX2-NX

In our design,we connect the CANFD mcp2518fd device to the aon spi port(pin-106,pin-108,pin-104,pin-110),and I config the dts like this

    clock {
        /* external 20M oscillator of mcp2518fd on SPI0.0 */
        mcp2518fd_osc: mcp2518fd_osc {
            compatible = "fixed-clock";
            #clock-cells = <0>;
            clock-frequency  = <20000000>;
            clock-accuracy = <100>;
        };
    };
    aon_spi@c260000 {
        status = "okay";

        mcp2518fdcan0: can@0 {
            status = "okay";
            compatible = "microchip,mcp2518fd";
            reg = <0>;
            spi-max-frequency = <20000000>;
            nvidia,enable-hw-based-cs;
            nvidia,rx-clk-tap-delay = <0x7>;

            nvidia,clk-parents = "osc";
            clocks = <&mcp2518fd_osc>;
            interrupt-parent = <&gpio_tca9539>;
            interrupts =<&gpio_tca9539 5 IRQ_TYPE_LEVEL_LOW>;
            controller-data {
                nvidia,cs-setup-clk-count = <0x1e>;
                nvidia,cs-hold-clk-count = <0x1e>;
                nvidia,rx-clk-tap-delay = <0x1f>;
                nvidia,tx-clk-tap-delay = <0x0>;
            };
        };
    };

After build the kernel and flash the dtb to the board,the aon spi boot failed as below log

[    0.963393] tegra-aon-spi aon_spi@c260000: can't get mailbox channel (-517)
[    0.963400] tegra-aon-spi aon_spi@c260000: tegra_aon_spi_driver_probe() FAILED
[    8.265367] tegra-aon-spi aon_spi@c260000: Timeout waiting for ipc response
[    8.272431] tegra-aon-spi aon_spi@c260000: Error in transfer
[    8.278159] spi_master spi4: failed to transfer one message from queue
[   13.385359] tegra-aon-spi aon_spi@c260000: Timeout waiting for ipc response
[   13.392424] tegra-aon-spi aon_spi@c260000: Error in transfer
[   13.400135] spi_master spi4: failed to transfer one message from queue
[   13.407141] mcp25xxfd spi4.0: interrupts enabled failed!
[   13.628387] tegra-aon-spi aon_spi@c260000: mbox_send_message() failed with -62
[   13.635683] tegra-aon-spi aon_spi@c260000: Error in transfer
[   13.642449] spi_master spi4: failed to transfer one message from queue
[   13.649180] mcp25xxfd spi4.0: Probe failed, err=5
[   13.654153] mcp25xxfd: probe of spi4.0 failed with error -5

My Board: Jetson TX2-NX
Soft version: L4T R32.5.1

Can anyone help me out?

But when I modify the dts like this

spi@c260000 {
        status = "okay";

        mcp2518fdcan0: can@0 {
            status = "okay";
            compatible = "microchip,mcp2518fd";
            reg = <0>;
            spi-max-frequency = <20000000>;
            nvidia,enable-hw-based-cs;
            nvidia,rx-clk-tap-delay = <0x7>;

            nvidia,clk-parents = "osc";
            clocks = <&mcp2518fd_osc>;
            interrupt-parent = <&gpio_tca9539>;
            interrupts =<&gpio_tca9539 5 IRQ_TYPE_LEVEL_LOW>;
            controller-data {
                nvidia,cs-setup-clk-count = <0x1e>;
                nvidia,cs-hold-clk-count = <0x1e>;
                nvidia,rx-clk-tap-delay = <0x1f>;
                nvidia,tx-clk-tap-delay = <0x0>;
            };
        };
    };

The mcp2518fd driver load success

[    3.187495] mcp25xxfd spi1.0: MCP2518 successfully initialized.

When I operate as follow,the CANFD can’t work
step 1

ifconfig -a 

Got

can0: flags=128<NOARP>  mtu 72
        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 10  (UNSPEC)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

step 2

sudo ip link set can0 type can bitrate 500000 dbitrate 2000000 fd on loopback on

setp 3

ip -details link show can0

Got

4: can0: <NOARP,ECHO> mtu 72 qdisc noop state DOWN mode DEFAULT group default qlen 10
    link/can  promiscuity 0 
    can <LOOPBACK,FD> state STOPPED (berr-counter tx 0 rx 0) restart-ms 0 
          bitrate 5000000 sample-point 0.750 
          tq 50 prop-seg 1 phase-seg1 1 phase-seg2 1 sjw 1
          mcp25xxfd: tseg1 2..256 tseg2 1..128 sjw 1..128 brp 1..256 brp-inc 1
          dbitrate 2000000 dsample-point 0.700 
          dtq 50 dprop-seg 3 dphase-seg1 3 dphase-seg2 3 dsjw 1
          mcp25xxfd: dtseg1 1..32 dtseg2 1..16 dsjw 1..16 dbrp 1..256 dbrp-inc 1
          clock 20000000numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 

step 4

sudo ip link set can0 up

step 5

ip -details link show can0

Got

4: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 72 qdisc pfifo_fast state UP mode DEFAULT group default qlen 10
    link/can  promiscuity 0 
    can <LOOPBACK,FD> state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 0 
          bitrate 500000 sample-point 0.875 
          tq 50 prop-seg 17 phase-seg1 17 phase-seg2 5 sjw 1
          mcp25xxfd: tseg1 2..256 tseg2 1..128 sjw 1..128 brp 1..256 brp-inc 1
          dbitrate 2000000 dsample-point 0.700 
          dtq 50 dprop-seg 3 dphase-seg1 3 dphase-seg2 3 dsjw 1
          mcp25xxfd: dtseg1 1..32 dtseg2 1..16 dsjw 1..16 dbrp 1..256 dbrp-inc 1
          clock 20000000numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 

step 6

sudo candump can0 &

step 7

cansend can0 123#11223344556677 

Then got failed as follow

[  261.451912] pcieport 0000:00:01.0: PCIe Bus Error: severity=Corrected, type=Physical Layer, id=0008(Receiver ID)
[  261.462152] pcieport 0000:00:01.0:   device [10de:10e5] error status/mask=00000001/00002000
syrius@tegra-ubuntu:~$ [  261.470696] pcieport 0000:00:01.0:    [ 0] Receiver Error         (First)
[  261.479333] mcp25xxfd spi1.0 can0: CAN Bus error experienced

Add the SPI pin configure like below to enable the SPI function to check.

	pinmux@2430000 {
		pinctrl-0 = <0x179>;
		pinctrl-names = "default";
		compatible = "nvidia,tegra194-pinmux";
		reg = <0x0 0x2430000 0x0 0x17000 0x0 0xc300000 0x0 0x4000>;
		#gpio-range-cells = <0x3>;
		status = "okay";
		linux,phandle = <0xab>;
		phandle = <0xab>;

		header-40pin-pinmux {
			phandle = <0x179>;
			linux,phandle = <0x179>;

			pin37 {
				nvidia,lpdr = <0x0>;
				nvidia,io-high-voltage = <0x0>;
				nvidia,enable-input = <0x1>;
				nvidia,tristate = <0x0>;
				nvidia,pull = <0x1>;
				nvidia,pins = "spi3_mosi_py2";
				nvidia,function = "spi3";
			};

			pin28 {
				nvidia,lpdr = <0x1>;
				nvidia,io-high-voltage = <0x1>;
				nvidia,enable-input = <0x1>;
				nvidia,tristate = <0x0>;
				nvidia,pull = <0x0>;
				nvidia,pins = "gen2_i2c_scl_pcc7";
				nvidia,function = "i2c2";
			};

			pin27 {
				nvidia,lpdr = <0x1>;
				nvidia,io-high-voltage = <0x1>;
				nvidia,enable-input = <0x1>;
				nvidia,tristate = <0x0>;
				nvidia,pull = <0x0>;
				nvidia,pins = "gen2_i2c_sda_pdd0";
				nvidia,function = "i2c2";
			};

			pin26 {
				nvidia,lpdr = <0x0>;
				nvidia,enable-input = <0x1>;
				nvidia,tristate = <0x0>;
				nvidia,pull = <0x2>;
				nvidia,pins = "spi1_cs1_pz7";
				nvidia,function = "spi1";
			};

			pin24 {
				nvidia,lpdr = <0x0>;
				nvidia,enable-input = <0x1>;
				nvidia,tristate = <0x0>;
				nvidia,pull = <0x2>;
				nvidia,pins = "spi1_cs0_pz6";
				nvidia,function = "spi1";
			};

			pin23 {
				nvidia,lpdr = <0x0>;
				nvidia,enable-input = <0x1>;
				nvidia,tristate = <0x0>;
				nvidia,pull = <0x1>;
				nvidia,pins = "spi1_sck_pz3";
				nvidia,function = "spi1";
			};

			pin22 {
				nvidia,lpdr = <0x0>;
				nvidia,io-high-voltage = <0x0>;
				nvidia,enable-input = <0x1>;
				nvidia,tristate = <0x0>;
				nvidia,pull = <0x1>;
				nvidia,pins = "spi3_miso_py1";
				nvidia,function = "spi3";
			};

			pin21 {
				nvidia,lpdr = <0x0>;
				nvidia,enable-input = <0x1>;
				nvidia,tristate = <0x0>;
				nvidia,pull = <0x1>;
				nvidia,pins = "spi1_miso_pz4";
				nvidia,function = "spi1";
			};

			pin19 {
				nvidia,lpdr = <0x0>;
				nvidia,enable-input = <0x1>;
				nvidia,tristate = <0x0>;
				nvidia,pull = <0x1>;
				nvidia,pins = "spi1_mosi_pz5";
				nvidia,function = "spi1";
			};

			pin18 {
				nvidia,lpdr = <0x0>;
				nvidia,io-high-voltage = <0x0>;
				nvidia,enable-input = <0x1>;
				nvidia,tristate = <0x0>;
				nvidia,pull = <0x2>;
				nvidia,pins = "spi3_cs0_py3";
				nvidia,function = "spi3";
			};

			pin16 {
				nvidia,lpdr = <0x0>;
				nvidia,io-high-voltage = <0x0>;
				nvidia,enable-input = <0x1>;
				nvidia,tristate = <0x0>;
				nvidia,pull = <0x2>;
				nvidia,pins = "spi3_cs1_py4";
				nvidia,function = "spi3";
			};

			pin13 {
				nvidia,lpdr = <0x0>;
				nvidia,io-high-voltage = <0x0>;
				nvidia,enable-input = <0x1>;
				nvidia,tristate = <0x0>;
				nvidia,pull = <0x1>;
				nvidia,pins = "spi3_sck_py0";
				nvidia,function = "spi3";
			};

			pin10 {
				nvidia,lpdr = <0x0>;
				nvidia,io-high-voltage = <0x0>;
				nvidia,enable-input = <0x1>;
				nvidia,tristate = <0x1>;
				nvidia,pull = <0x2>;
				nvidia,pins = "uart1_rx_pr3";
				nvidia,function = "uarta";
			};

			pin8 {
				nvidia,lpdr = <0x0>;
				nvidia,io-high-voltage = <0x0>;
				nvidia,enable-input = <0x0>;
				nvidia,tristate = <0x0>;
				nvidia,pull = <0x0>;
				nvidia,pins = "uart1_tx_pr2";
				nvidia,function = "uarta";
			};
		};