Tegra tx2 SPI register setting issue


I’d like to set the SONY sensor with tegra tx2 SPI.
I’m using the SPI2 interface in the tegra tx2 module interface.
(H14-SPI2_SCK, H15-SPI2_MISO, G15-SPI2_MOSI, F16-SPI2_CS1)

at this moment, the SPI signal is transferred to sensor. but the data transferring edge of clock is mismatched. sensor spec requires falling edge transfer, but tegra tx2 transfer with rising edge. i found that the MODE register of SPI_COMMAND_1[29:28] in the Parker TRM to change the clock edge. i wrote that and checked the register value. but it does not work.
and one more issue is there. sensor spec require the little endian bit order of data transfer, then tegra transfer big endian bit order. it also, i found the register to change in the parker register map. that is En_LE_Bit [16]bit in the same SPI_COMMAND_1 register. i wrote the 1 for LSB first. but it doesn’t work.
With that I changed the CS_SW_HW[21] register in the SPI_COMMAND_1, it works well. after setting this value as 0, I can see the CS timing is changing.

I’d like to know the SPI_COMMAND_1/[29:28] MODE register and [16] En_LE_Bit register work properly or not.
Is there any issue related with this.

[ 4408.890392] [dooman:tegra_spi_writel] ss_mask(0x10011000), val(0x54c19827) <-- SPI_COMMAND_1 register value just before writel function in spi-tegra114.c

Did you just modify the SPI driver to change the mode?
Could you try to modify the mode in spi_message instead of modify driver directly.

Thank you for advise.
But i don’t know the way to use spi_message to control the spi mode of tegra. Is it more useful than driver control? If it is possible, please let me know.
Anyway with my applicaion to control the spi register, i can control the register.
I found that the SPI_COMMAND_1[29:28] mode register also working. but the En_LE_Bit [16] is still not working. I’d like to know that register has fault or not.
And if it is possible i’d like to know the way to change the En_LE_Bit with spi_message.

Below is the mode setting used on initialing the SPI device, maybe he can try to use it.
spi_device->mode = (SPI_LSB_FIRST|SPI_CPOL|SPI_CPHA);