Enable more CS pins for SPI - Cannot find /Linux-for-Tegras directory

TLDR:

To change Pinmux follow this guide: Jetson Module Adaptation and Bring-Up: Jetson AGX Xavier Series — NVIDIA Jetson Linux Developer Guide 1 documentation

Find the source device-tree file:

  • In the jetson device run $ dmesg|grep dts to find the .dtsi file;
    In my case was in hardware/nvidia/platform/t19x/galen/kernel-dts/common/tegra194-p2888-0001-p2822-0000-common.dtsi

  • Change the source device-tree (in this case I change the original CS pins to a custom ones):

(To increase the number of CS pins you need to change the num-cs parameter, set the chosen pins in cs-gpios parameter and add spi@2 and spi@3 sections)

tegra194-p2888-0001-p2822-0000-common.dtsi

spi@3210000 {
		status = "okay";	
		spi-max-frequency = <33000000>;
		num-cs = <2>;
		cs-gpios = <TEGRA194_AON_GPIO(BB, 1) GPIO_ACTIVE_LOW>, <TEGRA194_MAIN_GPIO(Q, 1) GPIO_ACTIVE_LOW>;

		spi@0 {
			compatible = "tegra-spidev";
			reg = <0x00>;
			spi-max-frequency = <33000000>;
			controller-data {
				nvidia,rx-clk-tap-delay = <0x11>;
			};
		};

		spi@1 {
			compatible = "tegra-spidev";
			reg = <0x01>;
			spi-max-frequency = <33000000>;
			controller-data {
				nvidia,rx-clk-tap-delay = <0x11>;
			};
		};
	};
  • Finally rebuilt the kernel and flash the device
1 Like