Can't change SPI2 speed above 3MHz


One of our partners can’t set the speed of SPI2 above 3MHz. However, they were able to set the speed of SPI1 to 5Mhz. The device tree and kernel were left unchanged.

Below is the command used to change the SPI speed:


(fd) was obtained when opening spide v4.2, and for a 5MHz clock, we use 5000000.

Is there a setting we missed on why SPI2 cannot go pass 3Mhz?

Attached is the boot log for reference.

Best Regards,

Hi Leo,

I was checking on this and just to be clear:

  • SPI1: spidev0.0
  • SPI2: spidev4.2

according to the board file:

Can you check with the customer this? What is the output of ls -l /dev/spi* ? Maybe they are checking the incorrect /dev/spidevX.Y.

Thanks, Alvaro.

Hi Alvaro,

Below is the output.

root@apalis-t30:~# ls -l /dev/spi*
crw-------    1 root     root      153,   0 Apr  1  2019 /dev/spidev0.0
crw-------    1 root     root      153,   1 Apr  1  2019 /dev/spidev4.2


HI Leo, noted. I will check internally and get back to you.

Hi @lsionzon , a few more questions please

  • How did the customer confirmed that this doesn’t go above the set speed? Did they use an oscilloscope? Is there any error code from the kernel or from their application?
  • Can you confirm that with the same procedure/code, spidev0.0 can be set to the 5MHz?
  • I see in your email that you are checking on the spi-max-frequency but this is not available in the customer version. Can we check the output of ls -l /sys/class/spidev/*?

Thanks, Alvaro.

HI @lsionzon

I could reproduce the issue. The solution is to apply following changes to kernel to get a same clock for spidev4.2.

diff --git a/arch/arm/mach-tegra/board-apalis_t30.c b/arch/arm/mach-tegra/board-apalis_t30.c
index fdbc2c10230e..48d8f5aa9c0a 100644
--- a/arch/arm/mach-tegra/board-apalis_t30.c
+++ b/arch/arm/mach-tegra/board-apalis_t30.c
@@ -1031,12 +1031,6 @@ static struct platform_device *apalis_t30_spi_devices[] __initdata = {

 static struct spi_clk_parent spi_parent_clk[] = {
        [0] = {.name = "pll_p"},
-       [1] = {.name = "pll_m"},
-       [2] = {.name = "clk_m"},
-       [1] = {.name = "clk_m"},
 static struct tegra_spi_platform_data apalis_t30_spi_pdata = {
@@ -1064,6 +1058,7 @@ static void __init apalis_t30_spi_init(void)
        apalis_t30_spi_pdata.parent_clk_list = spi_parent_clk;
        apalis_t30_spi_pdata.parent_clk_count = ARRAY_SIZE(spi_parent_clk); = &apalis_t30_spi_pdata;
+ = &apalis_t30_spi_pdata;

Best regards,