Wiznet w5500 via SPI to Jetson TX2

Hi,

I am trying to connect a wiznet w5500 to the Jetson TX2 using the devkit carrier board. I am running JetPack 4.3.

What I did:

  1. compiled w5100 and w5100-spi modules and they load correctly
  2. changed pinmux to enable SPI, validated with loop back test on J21 connector of MISO and MOSI using spidev_test that it worked
  3. tested the actual w5100 using spidev_test and saw that it respond something
  4. Updated device tree to switch from spidev to w5500 see [1] for changes to default DTB

It looks like everything is setup correctly, upon boot the kernel loads w5500_spi module and the fails when trying to access the interrupt pin as specified by pinctrl-0:

[    3.818848] w5100 spi3.0: could not find pctldev for node /gpio@2200000/eth1_pins, deferring probe

It tries it a bunch of times until it fails.

I tried digging into pinctrl code of the tegra and it means that it can’t find the pin controller for eth1_pins which is gpio@2200000 (tegra main gpio)

Any idea what is the issue?
Apart from adding the pin in the gpio controller do I need to add it somewhere else?
I am using GPIO19 which is gpio395 in sysfs

[1]


	spi@3240000 {
		...............
                  /*spi@0 {
			compatible = "spidev";
			reg = <0x00>;
			spi-max-frequency = <0x1f78a40>;
			nvidia,enable-hw-based-cs;
			nvidia,rx-clk-tap-delay = <0x08>;
			nvidia,tx-clk-tap-delay = <0x16>;
		};*/

		eth1@0 {
			compatible = "wiznet,w5500";
			nvidia,tx-clk-tap-delay = <0x16>;
			nvidia,enable-hw-based-cs;
			nvidia,rx-clk-tap-delay = <0x8>;
			reg = <0x0>;
			spi-max-frequency = <0x1f78a40>;

			pinctrl-names = "default";
			pinctrl-0 = <&eth1_pins>;
			interrupt-parent = <0x1b>;
			interrupts = <0x4b 0x01>;
		};

............

gpio@2200000 {
		......

		eth1_pins: eth1_pins {
			gpios = <0x4b 0x0>;
			gpio-hog;
			status = "okay";
			label = "eth1-pins";
			input;
		};

Attached:

  1. dmesg dmesg (54.8 KB)
  2. actual DTB new.dtb (362.7 KB)
  3. dts rootfs.dts (492.9 KB)
  4. pinmux tegra186-mb1-bct-pinmux-quill-p3310-1000-c03.cfg (28.6 KB)

Suppose the eth1_pins isn’t Tegra. It could be the driver define in others platform. You may need to check if this pin need it Jetson platform to modify/remove it.

I defined eth1_pins in tegra_main_gpio controller (gpio@220000) as other pins defined there…

This eth1_pins is used by w5500 driver to get a pin used for interrupt pin.

The issue happens in pinctrl of tegra186

The error message is from w5100 driver. You may need to know what’s means to fix it.

The error is not from w5100 driver but from pinctrl device tree code written by nvidia (see file header)

See here:

dev_info(p->dev, “could not find pctldev for node %s, deferring probe\n”,|

Suppose GPIO pin should not define as pinctrl dev.

It should be according to w5100 binding documentation, see example and link to it.

Can you please address the issue and not avoid it?

&spi {
	ethernet@0: w5500@0 {
		compatible = "wiznet,w5500";
		reg = <0>;
		pinctrl-names = "default";
		pinctrl-0 = <&eth1_pins>;
		interrupt-parent = <&gpio>;
		interrupts = <25 IRQ_TYPE_EDGE_FALLING>;
		spi-max-frequency = <30000000>;
	};
};

&gpio {
	eth1_pins: eth1_pins {
		brcm,pins = <25>;
		brcm,function = <0>; /* in */
		brcm,pull = <0>; /* none */
	};
};

Maybe reference to sensor driver to modify the w5500 driver to set the GPIO as require state.

https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide/camera_sensor_prog.47.1.html#wwpID0E0450HA

I don’t understand how it relates to my issue. pinctrl-0 is a common property used in the device tree, there are many uses of it in the Jetson DTB and it should work out of the box.

Can you explain what is the issue with my definition that prevent its usage?

OK, could you check the why print the error from the devicetree.c

That is my question why there is an error, the error is looking for the pctrldev of eth1_pins which is ofc the gpio controller.

The question is why it doesn’t find it

Could confirm np_pctldev or of_node_is_root in below statement?

		if (!np_pctldev || of_node_is_root(np_pctldev)) {
			dev_info(p->dev, "could not find pctldev for node %s, deferring probe\n",
				np_config->full_name);
			of_node_put(np_pctldev);
			/* OK let's just assume this will appear later then */
			return -EPROBE_DEFER;

How you suggest to do that? add a kprintf and recompile the kernel?
Also what data you want to see?

Is there a simpler way? some debug messages of the devicetree?

Yes, need add print in this driver and recompile the kernel to check it.

No other way to proceed with this?

Sorry, I don’t have any others idea for that now.

Can you escalate to the JP team? pinctrl-0 is used in all the device tree