Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spi-tegra114.c has a big delay after transfer #38

Open
ymkim92 opened this issue Jan 9, 2023 · 0 comments
Open

spi-tegra114.c has a big delay after transfer #38

ymkim92 opened this issue Jan 9, 2023 · 0 comments

Comments

@ymkim92
Copy link

ymkim92 commented Jan 9, 2023

I am not sure if here is the right place to ask this. If I am in a wrong place, please advise me.

I have a Jetson Xavier NX that runs Yocto linux with the branch of oe4t-patches-l4t-r32.5 of linux-tegra-4.9.
And I have applied rt patches.

SPI master runs in the NX and needs to read multiple 2-byte registers one-by-one. To reduce whole transmission time, I hope to use ioctl(fd, SPI_IOC_MESSAGE(len), buf) call.
My problem is there is a big delay after transfer the data. It is about 100us for each 2 bytes data tranmission.
image
In the above, yellow is SCK and cyan is CS. First two transmissions use SPI_IOC_MESSAGE(1) in ioctl call and 3rd to 5th transmission uses SPI_IOC_MESSAGE(3) where each message is 2 bytes. The delay is too big.

I found this part of the code of spi-tegra114.c is one that takes long time:

		if (tspi->polling_mode)
			timeleft = tegra_spi_status_poll(tspi);
		else
			timeleft = wait_for_completion_timeout(
					&tspi->xfer_completion,
					SPI_DMA_TIMEOUT);

I tried either way and they are the same. Why does this take a long time of more than 50 us?


I measured the time by ktime_get_ns(). This is the sample:
image

[81056.799779] spi-tegra114 3210000.spi:         1686 41856
[81056.799783] spi-tegra114 3210000.spi:         1687 46176
[81056.799798] spi-tegra114 3210000.spi:         1689 60576
[81056.799853] spi-tegra114 3210000.spi:         1691 115648
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant