Spi flash cannot be recognized On JP5.1.2

Hi,all:
I use the Orin NX Demo board and use SPI1 to connect to Winbound 25Q64JVSIQ, but the spi flash cannot be recognized.

root@tegra:/home/robot# dmesg |grep spi
[ 4.264995] spi-tegra114 3210000.spi: Adding to iommu group 0
[ 4.271049] spi-tegra114 3210000.spi: can not get clock
[ 4.276476] spi-tegra114 3230000.spi: Adding to iommu group 0
[ 4.282391] spi-tegra114 3230000.spi: can not get clock
[ 7.475944] spi-tegra114 3210000.spi: prod settings failed with error -19
[ 7.477131] spi-tegra114 3210000.spi: registered master spi0
[ 7.477502] spi spi0.0: setup 8 bpw, ~cpol, ~cpha, 40000000Hz
[ 7.477507] spi spi0.0: child node ‘controller-data’ not found
[ 7.477683] spi spi0.0: setup mode 0, 8 bits/w, 40000000 Hz max → 0
[ 7.479843] spi-tegra114 3210000.spi: Setting clk_src pll_p
[ 7.481084] spi-tegra114 3210000.spi: prod settings failed with error -19
[ 7.481090] spi-tegra114 3210000.spi: The def 0x40408000 and written 0x40608807
[ 7.481123] spi-tegra114 3210000.spi: The def 0x40408000 and written 0x40609027

[ 7.481182] spi-nor spi0.0: unrecognized JEDEC id bytes: ff ff ff ff ff ff

[ 7.488279] spi-nor: probe of spi0.0 failed with error -2
[ 7.493846] spi-tegra114 3210000.spi: registered child spi0.0
[ 7.493856] spi spi0.1: setup 8 bpw, ~cpol, ~cpha, 50000000Hz
[ 7.494027] spi spi0.1: setup mode 0, 8 bits/w, 50000000 Hz max → 0
[ 7.494257] spi-tegra114 3210000.spi: registered child spi0.1
[ 7.495036] spi-tegra114 3230000.spi: prod settings failed with error -19
[ 7.495859] spi-tegra114 3230000.spi: registered master spi2
[ 7.496254] spi spi2.0: setup 8 bpw, ~cpol, ~cpha, 50000000Hz
[ 7.496415] spi spi2.0: setup mode 0, 8 bits/w, 50000000 Hz max → 0
[ 7.496531] spi-tegra114 3230000.spi: registered child spi2.0
[ 7.496541] spi spi2.1: setup 8 bpw, ~cpol, ~cpha, 50000000Hz
[ 7.496806] spi spi2.1: setup mode 0, 8 bits/w, 50000000 Hz max → 0
[ 7.496918] spi-tegra114 3230000.spi: registered child spi2.1

PINMUX Config(SPI1):
sudo /opt/nvidia/jetson-io/jetson-io.py

dts:

	spi@3210000 {
		compatible = "nvidia,tegra186-spi";
		reg = <0x00 0x3210000 0x00 0x10000>;
		interrupts = <0x00 0x24 0x04>;
		#address-cells = <0x01>;
		#size-cells = <0x00>;
		iommus = <0x06 0x04>;
		dma-coherent;
		dmas = <0x3f 0x0f 0x3f 0x0f>;
		dma-names = "rx\0tx";
		spi-max-frequency = <0x3dfd240>;
		nvidia,clk-parents = "pll_p\0clk_m";
		clocks = <0x02 0x87 0x02 0x66 0x02 0x0e>;
		clock-names = "spi\0pll_p\0clk_m";
		resets = <0x02 0x5b>;
		reset-names = "spi";
		status = "okay";
		phandle = <0x31f>;

		prod-settings {
			#prod-cells = <0x04>;

			prod {
				prod = <0x00 0x194 0x80000000 0x00>;
			};
		};

		spi@0 {
			compatible = "jedec,spi-nor";
			reg = <0x00>;
			spi-max-frequency = <0x2625a00>;
			#address-cells = <0x01>;
			#size-cells = <0x01>;
			m25p,fast-read;
		};

		spi@1 {
			compatible = "tegra-spidev";
			reg = <0x01>;
			spi-max-frequency = <0x2faf080>;

			controller-data {
				nvidia,rx-clk-tap-delay = <0x10>;
				nvidia,tx-clk-tap-delay = <0x00>;
			};
		};
	};

$ defconfig

@@ -1,4 +1,5 @@
 # CONFIG_LOCALVERSION_AUTO is not set
+CONFIG_MTD_OF_PARTS=y
 CONFIG_SYSVIPC=y
 CONFIG_POSIX_MQUEUE=y
 CONFIG_WATCH_QUEUE=y
@@ -330,13 +331,13 @@ CONFIG_BRCMSTB_GISB_ARB=y
 CONFIG_SIMPLE_PM_BUS=y
 CONFIG_TEGRA_ACONNECT=y
 CONFIG_VEXPRESS_CONFIG=y
-CONFIG_MTD=m
+CONFIG_MTD=y
 CONFIG_MTD_CMDLINE_PARTS=m
 CONFIG_MTD_BLOCK=m
 CONFIG_MTD_QSPI_FLASH=m
 CONFIG_MTD_TEGRA_VIRT=m
 CONFIG_MTD_RAW_NAND=m
-CONFIG_MTD_SPI_NOR=m
+CONFIG_MTD_SPI_NOR=y
 CONFIG_MTD_UBI=m
 # CONFIG_PNP_DEBUG_MESSAGES is not set
 CONFIG_ZRAM=m
@@ -736,19 +737,20 @@ CONFIG_I2C_TEGRA194_SLAVE=m
 CONFIG_I2C_STUB=m
 CONFIG_I2C_SLAVE_EEPROM=m
 CONFIG_SPI=y
+CONFIG_SPI_DEBUG=y
 CONFIG_SPI_CADENCE=m
 CONFIG_SPI_CADENCE_QUADSPI=y
 CONFIG_SPI_NXP_FLEXSPI=y
 CONFIG_SPI_PXA2XX=m
 CONFIG_SPI_SC18IS602=m
-CONFIG_SPI_TEGRA114=m
+CONFIG_SPI_TEGRA114=y
 CONFIG_SPI_TEGRA124_SLAVE=y
 CONFIG_SPI_TEGRA194_SLAVE=y
 CONFIG_QSPI_TEGRA23x=y
 CONFIG_QSPI_TEGRA210=m
 CONFIG_SPI_XCOMM=m
 CONFIG_SPI_ZYNQMP_GQSPI=m
-CONFIG_SPI_SPIDEV=m
+CONFIG_SPI_SPIDEV=y
 CONFIG_SPI_TLE62X0=m
 CONFIG_SPMI=m
 CONFIG_PPS_DEBUG=y

image

(it’s no problem)

dmesg:
dmesg.txt (76.8 KB)

whole dts:
dts.txt (430.3 KB)

version:
cat /etc/nv_tegra_release
R35 (release), REVISION: 4.1, GCID: 33958178, BOARD: t186ref, EABI: aarch64, DATE: Tue Aug 1 19:57:35 UTC 2023

Hi,
There are guidance for enabling MCP2515. Please refer to the steps in
Jetson/L4T/peripheral/ - eLinux.org

Hi wxsrite,

Are you using Orin NX on the Orin Nano devkit board? Or other custom carrier board?

Have you verified the SPI loopback test before using your module?

Are you connecting your SPI NOR flash module(Winbound 25Q64JVSIQ) with SPI1_CS0?

[    4.271049] spi-tegra114 3210000.spi: can not get clock
...
[    7.475944] spi-tegra114 3210000.spi: prod settings failed with error -19

It seems there’s clock issue in your case.
Could you share your original dts configuration for this SPI interface rather than the one decompiled from dtb?

Hi KevinFFF:

Are you using Orin NX on the Orin Nano devkit board? Or other custom carrier board?

---- Orin NX on the Orin Nano devkit board

Have you verified the SPI loopback test before using your module?

---- SPI loopback test ok.

Are you connecting your SPI NOR flash module(Winbound 25Q64JVSIQ) with SPI1_CS0 ?

---- yes.

Could you share your original dts configuration for this SPI interface rather than the one decompiled from dtb?


tegra234-p3767-0000-p3768-0000-a0.txt (1.5 KB)

image

[ 7.440894] spi-nor spi0.0: unrecognized JEDEC id bytes: f7 a0 0b 80 00 00
[ 7.447994] spi-nor: probe of spi0.0 failed with error -2

Sorry, the ground wire was connected incorrectly before. The phenomenon has been corrected. Questions are as follows:

root@tegra:/home/robot# dmesg | grep spi
[    2.265866] tegra234-pinctrl 2430000.pinmux: found group selector 119 for spi3_mosi_py2
[    2.265869] tegra234-pinctrl 2430000.pinmux: found group selector 119 for spi3_mosi_py2
[    2.265873] tegra234-pinctrl 2430000.pinmux: found group selector 117 for spi1_cs1_pz7
[    2.265875] tegra234-pinctrl 2430000.pinmux: found group selector 117 for spi1_cs1_pz7
[    2.265878] tegra234-pinctrl 2430000.pinmux: found group selector 111 for spi1_cs0_pz6
[    2.265880] tegra234-pinctrl 2430000.pinmux: found group selector 111 for spi1_cs0_pz6
[    2.265883] tegra234-pinctrl 2430000.pinmux: found group selector 115 for spi1_sck_pz3
[    2.265885] tegra234-pinctrl 2430000.pinmux: found group selector 115 for spi1_sck_pz3
[    2.265889] tegra234-pinctrl 2430000.pinmux: found group selector 110 for spi3_miso_py1
[    2.265890] tegra234-pinctrl 2430000.pinmux: found group selector 110 for spi3_miso_py1
[    2.265893] tegra234-pinctrl 2430000.pinmux: found group selector 113 for spi1_miso_pz4
[    2.265898] tegra234-pinctrl 2430000.pinmux: found group selector 113 for spi1_miso_pz4
[    2.265901] tegra234-pinctrl 2430000.pinmux: found group selector 118 for spi1_mosi_pz5
[    2.265903] tegra234-pinctrl 2430000.pinmux: found group selector 118 for spi1_mosi_pz5
[    2.265905] tegra234-pinctrl 2430000.pinmux: found group selector 112 for spi3_cs0_py3
[    2.265907] tegra234-pinctrl 2430000.pinmux: found group selector 112 for spi3_cs0_py3
[    2.265910] tegra234-pinctrl 2430000.pinmux: found group selector 114 for spi3_cs1_py4
[    2.265912] tegra234-pinctrl 2430000.pinmux: found group selector 114 for spi3_cs1_py4
[    2.265914] tegra234-pinctrl 2430000.pinmux: found group selector 116 for spi3_sck_py0
[    2.265916] tegra234-pinctrl 2430000.pinmux: found group selector 116 for spi3_sck_py0
[    4.216843] spi-tegra114 3210000.spi: Adding to iommu group 0
[    4.222906] spi-tegra114 3210000.spi: can not get clock
[    4.228313] spi-tegra114 3230000.spi: Adding to iommu group 0
[    4.234233] spi-tegra114 3230000.spi: can not get clock
[    7.436324] spi-tegra114 3210000.spi: prod settings failed with error -19
[    7.436816] spi-tegra114 3210000.spi: registered master spi0
[    7.437205] spi spi0.0: setup 8 bpw, ~cpol, ~cpha, 40000000Hz
[    7.437210] spi spi0.0: child node 'controller-data' not found
[    7.437387] spi spi0.0: setup mode 0, 8 bits/w, 40000000 Hz max --> 0
[    7.439551] spi-tegra114 3210000.spi: Setting clk_src pll_p
[    7.440807] spi-tegra114 3210000.spi: prod settings failed with error -19
[    7.440813] spi-tegra114 3210000.spi: The def 0x40408000 and written 0x40608807
[    7.440844] spi-tegra114 3210000.spi: The def 0x40408000 and written 0x40609027

[    7.440894] spi-nor spi0.0: unrecognized JEDEC id bytes: f7 a0 0b 80 00 00
[    7.447994] spi-nor: probe of spi0.0 failed with error -2

[    7.453589] spi-tegra114 3210000.spi: registered child spi0.0
[    7.453598] spi spi0.1: setup 8 bpw, ~cpol, ~cpha, 50000000Hz
[    7.453806] spi spi0.1: setup mode 0, 8 bits/w, 50000000 Hz max --> 0
[    7.454294] spi-tegra114 3210000.spi: registered child spi0.1
[    7.455116] spi-tegra114 3230000.spi: prod settings failed with error -19
[    7.455541] spi-tegra114 3230000.spi: registered master spi2
[    7.455953] spi spi2.0: setup 8 bpw, ~cpol, ~cpha, 50000000Hz
[    7.456126] spi spi2.0: setup mode 0, 8 bits/w, 50000000 Hz max --> 0
[    7.456610] spi-tegra114 3230000.spi: registered child spi2.0
[    7.456620] spi spi2.1: setup 8 bpw, ~cpol, ~cpha, 50000000Hz
[    7.456777] spi spi2.1: setup mode 0, 8 bits/w, 50000000 Hz max --> 0
[    7.457283] spi-tegra114 3230000.spi: registered child spi2.1
root@tegra:/home/robot#

dmesg:
dmeg.txt (97.9 KB)

It seems you still having the issue to get clock for SPI.

[    7.437210] spi spi0.0: child node 'controller-data' not found

Is there the parameter missing in your device tree?

It seems you don’t configure the CS for SPI.
Could you try to add the following lines in your spi@0 node?

controller-data {
 				nvidia,enable-hw-based-cs;
 				nvidia,rx-clk-tap-delay = <0x10>;
 				nvidia,tx-clk-tap-delay = <0x10>;
}
	spi@0 {
		#address-cells = <1>;
		#size-cells = <1>;
		compatible = "jedec,spi-nor";
		reg = <0>;
		spi-max-frequency = <40000000>;
		m25p,fast-read;
		controller-data {
			nvidia,enable-hw-based-cs;
			nvidia,rx-clk-tap-delay = <0x10>;
			nvidia,tx-clk-tap-delay = <0x10>;
		};
	};

The problem is still the same.

root@tegra:/home/robot# dmesg | grep spi
[ 4.202175] spi-tegra114 3210000.spi: Adding to iommu group 0
[ 4.208247] spi-tegra114 3210000.spi: can not get clock
[ 4.213660] spi-tegra114 3230000.spi: Adding to iommu group 0
[ 4.219598] spi-tegra114 3230000.spi: can not get clock
[ 7.376515] spi-tegra114 3210000.spi: prod settings failed with error -19
[ 7.377015] spi-tegra114 3210000.spi: registered master spi0
[ 7.377465] spi spi0.0: setup 8 bpw, ~cpol, ~cpha, 40000000Hz
[ 7.377630] spi spi0.0: setup mode 0, 8 bits/w, 40000000 Hz max → 0
[ 7.379813] spi-tegra114 3210000.spi: Setting clk_src pll_p
[ 7.381067] spi-tegra114 3210000.spi: prod settings failed with error -19
[ 7.381068] spi-tegra114 3210000.spi: The def 0x40408000 and written 0x40608807
[ 7.381102] spi-tegra114 3210000.spi: The def 0x40408000 and written 0x40609027

[ 7.381153] spi-nor spi0.0: unrecognized JEDEC id bytes: f7 a0 0b 80 00 00
[ 7.388245] spi-nor: probe of spi0.0 failed with error -2

[ 7.393844] spi-tegra114 3210000.spi: registered child spi0.0
[ 7.393854] spi spi0.1: setup 8 bpw, ~cpol, ~cpha, 50000000Hz
[ 7.394288] spi spi0.1: setup mode 0, 8 bits/w, 50000000 Hz max → 0
[ 7.394820] spi-tegra114 3210000.spi: registered child spi0.1
[ 7.395620] spi-tegra114 3230000.spi: prod settings failed with error -19
[ 7.396073] spi-tegra114 3230000.spi: registered master spi2
[ 7.396562] spi spi2.0: setup 8 bpw, ~cpol, ~cpha, 50000000Hz
[ 7.396723] spi spi2.0: setup mode 0, 8 bits/w, 50000000 Hz max → 0
[ 7.397251] spi-tegra114 3230000.spi: registered child spi2.0
[ 7.397260] spi spi2.1: setup 8 bpw, ~cpol, ~cpha, 50000000Hz
[ 7.397417] spi spi2.1: setup mode 0, 8 bits/w, 50000000 Hz max → 0
[ 7.397924] spi-tegra114 3230000.spi: registered child spi2.1
root@tegra:/home/robot#

dmesg.txt (72.8 KB)
dts.txt (428.8 KB)

It seems the error of missing controller-data get fixed in your current log.
Since we don’t have your SPI NOR flash module to reproduce the issue locally, please try adding more debug messages in your spi nor driver.

[    7.381153] spi-nor spi0.0: unrecognized JEDEC id bytes: f7 a0 0b 80 00 00

It seems the ID read from your module is not expected.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.