Limitation on the speed of SPI

1 Problem:I finished all operations needed to enable my SPI, but I can’t see spidev0.0 but spidev0.1 .

2 Problem:The speed of clk can’t be changed by programming or the seting in device tree;
in my dts:(when i set all spi-max-frequency = <0x100>, it didn’t work;)

spi@7000d400 {
		compatible = "nvidia,tegra114-spi";
		reg = <0x0 0x7000d400 0x0 0x200>;
		interrupts = <0x0 0x3b 0x4>;
		nvidia,dma-request-selector = <0x7 0xf>;
		nvidia,memory-clients = <0xe>;
		#address-cells = <0x1>;
		#size-cells = <0x0>;
		clocks = <0xc 0x29>;
		status = "okay";
		dmas = <0x7 0xf 0x7 0xf>;
		dma-names = "rx", "tx";
		spi-max-frequency = <0x17d7840>;
		
		spi0_0 {
                        #address-cells = <0x1>;
                        #size-cells = <0x0>;
                        compatible = "spidev";
                        reg = <0x0>;
                        spi-max-frequency = <0x17d4870>;
                        controller-data{
                                nvidia,enable-hw-based-cs;
                                nvidia,cs-inactive-cycles=<0x1>;
                                nvidia,cs-setup-clk-count = <0x0>;
                                nvidia,cs-hold-clk-count = <0x0>;
                                nvidia,rx-clk-tap-delay = <0x0>;
                                nvidia,tx-clk-tap-delay = <0x0>;
                        };

                };

		spi0_1 {
			#address-cells = <0x1>;
			#size-cells = <0x0>;
			compatible = "spidev";
			reg = <0x1>;
			spi-max-frequency = <0x17d4870>;
			controller-data{
                                nvidia,enable-hw-based-cs;
                                nvidia,cs-inactive-cycles=<0x1>;
                                nvidia,cs-setup-clk-count = <0x0>;
                                nvidia,cs-hold-clk-count = <0x0>;
                                nvidia,rx-clk-tap-delay = <0x0>;
                                nvidia,tx-clk-tap-delay = <0x0>;
                        };

		};
	};

in my program :

__u32	speed=1000000;
  if (ioctl(fd, SPI_IOC_WR_MAX_SPEED_HZ, &speed) > 0) {
		perror("SPI write max_speed_hz");
		return;
    }
  if (ioctl(fd, SPI_IOC_RD_MAX_SPEED_HZ, &speed) < 0) {

		perror("SPI max_speed_hz");
		return;
	}
  printf("%s: spi mode %d, %d bitsr, %d bitsw, %sper word, %d Hz max\n",
		name, mode, bitsr, bitsw, lsb ? "(lsb first) " : "", speed);

when I print, it shows 1000000Hz max. However, the speed of clk in oscilloscope is 24MHz.

3 Problem: When the speed of clk is 24MHz, I transfer 16 bit when the CS is low using ioctl(). Also I choosed nvidia, enable-hw-based-cs.But the maxmium speed ia about 14KHz. How can I get higer speed? I found the same problem using the way in http://neurorobotictech.com/Community/Blog/tabid/184/ID/13/Using-the-Jetson-TK1-SPI--Part-3-Configuring-SPI-in-the-device-tree.aspx.

4 Reference: I referenced this paper http://neurorobotictech.com/Community/Blog/tabid/184/ID/13/Using-the-Jetson-TK1-SPI--Part-3-Configuring-SPI-in-the-device-tree.aspx. I finished all operation without using Grinch but the default kernel.

Hi Zelan
The first problem may cause by some device driver try to use the SPI0 CS0, I saw the kernel message show “spi-tegra114 spi-tegra114.0: chipselect 0 already in use”

I see the same message, but I’m confused about this. Is there any way to figure out how to solve this problem or figure why? Off course this problem is nothing important.
Thanks!

I found that the speed can’t be lower than 3.2 MHz in forums. It’s useful when I set speed higher than 3.2 MHz in my program.

Hi Zelan
Can you post the topic link here?

https://devtalk.nvidia.com/default/topic/850638/?comment=4737501

Hi Zelan
That topic is argue can not set the clock lower than 3.2Mk

Hi Zelan

  1. The spidev0.0 can’t create cause by the touch define in the board-ardbeg.c remove them the spidev0.0/spidev0.1 can create normally.

  2. I probe the clock and below command can set the clock as what I want. This case I can measure the 10Mk, I think there’s no problem for the clock. The max-spi-clock is not necessary be the transfer speed, you can trace the driver and print message to see how it work.

spidev_test -D/dev/spidev0.0 -s10000000 -n100 -g30 -p4