Orin NX, GPIO as interrupt for SPI device cannot be requested

Hi,
For our custom Orin NX board, we are adding a MAX14830 to the device tree. The chip has an interrupt line connected to the DP1_HPD / GPIO3_PM.00, which gives kernel errors during boot. Here is our device tree:

/ {
    model = "Custom Jetson Board";
    compatible = "nvidia,jetson-custom-board", "nvidia,tegra234";

       clocks {
                max14830_xtal: max14830_xtal {
                       compatible = "fixed-clock";
                       #clock-cells = <0>;
                       clock-frequency = <3686400>;
               };

       };


    bus@0 {

        spi@3210000 {
            status = "okay";

            max14830@0 {
                compatible = "maxim,max14830";
                reg = <0x0>;
                spi-max-frequency = <500000>;
                clocks = <&max14830_xtal>;
                clock-names = "xtal";
                interrupt-parent = <&tegra_main_gpio>;
                interrupts = <TEGRA234_MAIN_GPIO(M, 0) IRQ_TYPE_LEVEL_LOW>;
                gpio-controller;
                #gpio-cells = <2>;

                controller-data {
                    nvidia,enable-hw-based-cs;
                    nvidia,rx-clk-tap-delay = <0x10>;
                    nvidia,tx-clk-tap-delay = <0x0>;
                };
            };
        };
    };
};

However, I get the following error message when booting the board, regarding the interrupt:

[   10.685448] CPU:0, Error: cbb-fabric@0x13a00000, irq=178
[   10.685453] **************************************
[   10.685455] CPU:0, Error:cbb-fabric, Errmon:2
[   10.685460] 	  Error Code		: SLAVE_ERR

[   10.685469] 	  Error Code		: SLAVE_ERR
[   10.685470] 	  MASTER_ID		: CCPLEX
[   10.685471] 	  Address		: 0x2212000
[   10.685472] 	  Cache			: 0x1 -- Bufferable 
[   10.685473] 	  Protection		: 0x2 -- Unprivileged, Non-Secure, Data Access
[   10.685475] 	  Access_Type		: Read
[   10.685476] 	  Access_ID		: 0x14
[   10.685477] 	  Fabric		: cbb-fabric
[   10.685477] 	  Slave_Id		: 0x3b
[   10.685478] 	  Burst_length		: 0x0
[   10.685479] 	  Burst_type		: 0x1
[   10.685479] 	  Beat_size		: 0x2
[   10.685480] 	  VQC			: 0x0
[   10.685480] 	  GRPSEC		: 0x7e
[   10.685481] 	  FALCONSEC		: 0x0
[   10.685482] 	  Slave			: AXI2APB_9
[   10.685484] 	**************************************
[   10.685505] ------------[ cut here ]------------
[   10.685506] WARNING: CPU: 0 PID: 647 at /drivers/soc/tegra/cbb/tegra234-cbb.c:608 tegra234_cbb_isr+0x154/0x1a0
[   10.685526] Modules linked in: thermal_trip_event(O+) tegra_aconnect(+) nv_imx219(O+) snd_hda_tegra(+) snd_hda_codec snd_hda_core pwm_tegra_tachometer(O) r8168(O+) at24 pwm_tegra host1x_fence(O) mc_hwpm(O) spi_tegra114(+) nvidia_vrs_pseq(O) tegra_bpmp_thermal nvhost_isp5(O) nvhost_vi5(O) nvhost_nvcsi_t194(O) tegra_camera(O) v4l2_dv_timings nvhost_nvcsi(O) tegra_camera_platform(O) capture_ivc(O) tegra_camera_rtcpu(O) ivc_bus(O) hsp_mailbox_client(O) ivc_ext(O) v4l2_fwnode v4l2_async videobuf2_dma_contig videobuf2_memops videobuf2_v4l2 videobuf2_common governor_userspace videodev mc tegra_drm(O) nvhost_pva(O) nvhost_nvdla(O) nvhost_capture(O) tegra_wmark(O) nvhwpm(O) cec spidev pwm_fan nvidia_drm(O) nvidia_modeset(O) nvidia(O) tegra_dce(O) tsecriscv(O) host1x_nvhost(O) drm_kms_helper nvgpu(O) governor_pod_scaling(O) nvmap(O) nvsciipc(O) host1x(O) mc_utils(O) dm_multipath ina3221 fuse drm nfnetlink ipv6 nvme nvme_core tegra_xudc pcie_tegra194 phy_tegra194_p2u
[   10.685589] CPU: 0 PID: 647 Comm: (udev-worker) Tainted: G           O      5.15.148-l4t-r36.4-1012.12+g8dc079d5c8c4 #1
[   10.685592] Hardware name: NVIDIA Custom Jetson Board/Jetson, BIOS v36.4.0 01/08/2024
[   10.685594] pstate: 604000c9 (nZCv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[   10.685597] pc : tegra234_cbb_isr+0x154/0x1a0
[   10.685600] lr : tegra234_cbb_isr+0x12c/0x1a0
[   10.685603] sp : ffff800008003e60
[   10.685604] x29: ffff800008003e60 x28: ffff0000803bcd80 x27: 00000000000000c0
[   10.685607] x26: 0000000000000001 x25: ffffde1e490bbae0 x24: ffffde1e49fba770
[   10.685610] x23: ffffde1e4945c008 x22: 00000000000000b2 x21: ffffde1e49defc08
[   10.685612] x20: ffffde1e49defcc8 x19: 0000000000000000 x18: 00000000fffffffd
[   10.685615] x17: ffff21e3a7dce000 x16: ffff800008000000 x15: ffffde1e49f74b84
[   10.685618] x14: 0000000000000001 x13: 2a2a2a2a2a2a2a2a x12: 2a2a2a2a2a2a2a2a
[   10.685620] x11: 2a2a2a2a2a2a2a2a x10: 2a2a2a2a2a2a2a2a x9 : 2a2a2a2a2a2a2a2a
[   10.685622] x8 : 2a2a2a2a2a2a2a2a x7 : 0000000000000000 x6 : 000000000000000c
[   10.685625] x5 : ffff0001f122ca10 x4 : 00000000fffff2e1 x3 : 0000000000000000
[   10.685627] x2 : ffffde1e47521298 x1 : ffff0000803bcd80 x0 : 0000000100010000
[   10.685630] Call trace:
[   10.685632]  tegra234_cbb_isr+0x154/0x1a0
[   10.685635]  __handle_irq_event_percpu+0x70/0x268
[   10.685643]  handle_irq_event+0x74/0x11c
[   10.685646]  handle_fasteoi_irq+0xac/0x1a0
[   10.685649]  handle_domain_irq+0x74/0xa8
[   10.685652]  gic_handle_irq+0x68/0x140
[   10.685657]  call_on_irq_stack+0x20/0x5c
[   10.685661]  do_interrupt_handler+0x70/0x80
[   10.685663]  el1_interrupt+0x30/0x7c
[   10.685667]  el1h_64_irq_handler+0x18/0x24
[   10.685669]  el1h_64_irq+0x7c/0x80
[   10.685670]  _dev_err+0x38/0xa8
[   10.685674]  gpiochip_lock_as_irq+0x164/0x168
[   10.685679]  gpiochip_irq_reqres+0x48/0xa0
[   10.685681]  __setup_irq+0x3b0/0x8ac
[   10.685683]  request_threaded_irq+0xd4/0x174
[   10.685685]  devm_request_threaded_irq+0x8c/0x108
[   10.685687]  max310x_spi_probe+0x850/0xa10
[   10.685692]  spi_probe+0x90/0xf8
[   10.685696]  really_probe+0xcc/0x46c
[   10.685700]  __driver_probe_device+0x114/0x170
[   10.685703]  driver_probe_device+0x54/0x130
[   10.685705]  __device_attach_driver+0xc8/0x170
[   10.685707]  bus_for_each_drv+0x94/0xf0
[   10.685709]  __device_attach+0xac/0x1d0
[   10.685711]  device_initial_probe+0x2c/0x40
[   10.685713]  bus_probe_device+0xb0/0xc0
[   10.685716]  device_add+0x44c/0x90c
[   10.685717]  __spi_add_device+0x84/0x184
[   10.685720]  spi_add_device+0x50/0x88
[   10.685722]  of_register_spi_device+0x1fc/0x3a0
[   10.685725]  spi_register_controller+0x644/0x8c0
[   10.685727]  devm_spi_register_controller+0x58/0xb0
[   10.685729]  tegra_spi_probe+0x3c0/0x578 [spi_tegra114]
[   10.685742]  platform_probe+0x74/0xe4
[   10.685745]  really_probe+0xcc/0x46c
[   10.685747]  __driver_probe_device+0x114/0x170
[   10.685750]  driver_probe_device+0x54/0x130
[   10.685752]  __driver_attach+0xd8/0x200
[   10.685753]  bus_for_each_dev+0x8c/0xf0
[   10.685755]  driver_attach+0x38/0x48
[   10.685757]  bus_add_driver+0x15c/0x260
[   10.685759]  driver_register+0x80/0x140
[   10.685761]  __platform_driver_register+0x3c/0x58
[   10.685764]  tegra_spi_driver_init+0x2c/0x1000 [spi_tegra114]
[   10.685767]  do_one_initcall+0x64/0x2c0
[   10.685769]  do_init_module+0x54/0x240
[   10.685774]  load_module+0x2098/0x2618
[   10.685777]  __do_sys_finit_module+0xa8/0x120
[   10.685779]  __arm64_sys_finit_module+0x30/0x40
[   10.685782]  invoke_syscall+0x5c/0x120
[   10.685786]  el0_svc_common.constprop.0+0xf0/0x110
[   10.685789]  do_el0_svc+0x3c/0x9c
[   10.685791]  el0_svc+0x20/0x60
[   10.685793]  el0t_64_sync_handler+0x108/0x120
[   10.685795]  el0t_64_sync+0x1a4/0x1a8
[   10.685798] ---[ end trace 6316402b7856fa70 ]---
[   11.489808] gpio gpiochip0: (tegra234-gpio): gpiochip_lock_as_irq: tried to flag a GPIO set as output for IRQ
[   11.489814] gpio gpiochip0: (tegra234-gpio): unable to lock HW IRQ 76 for IRQ
[   11.489817] genirq: Failed to request resources for spi0.0 (irq 249) on irqchip 2200000.gpio
[   11.489844] max310x spi0.0: Unable to reguest IRQ 249

gpioinfo confirms that it is set as output:

root@p3768-0000-p3767-0001:~# gpioinfo | grep PM.00
	line  76:      "PM.00"       kernel  output  active-high [used]

Although I set it up as input here is my pinmux:

			dp_aux_ch0_hpd_pm0 {
				nvidia,pins = "dp_aux_ch0_hpd_pm0";
				nvidia,function = "rsvd1";
				nvidia,pull = <TEGRA_PIN_PULL_UP>;
				nvidia,tristate = <TEGRA_PIN_ENABLE>;
				nvidia,enable-input = <TEGRA_PIN_ENABLE>;
				nvidia,io-high-voltage = <TEGRA_PIN_DISABLE>;
				nvidia,lpdr = <TEGRA_PIN_DISABLE>;
			};

Is there anything I am missing, or anything more that needs to be setup?

Thanks!

Hi myriads-beep.5q,

What’s the Jetpack version in use?

Input/Output is configured in gpio dtsi rather than pinmux dtsi.
I would suggest configuring the pin in pinmux spreadsheet and generate the gpio/pinmux dtsi files.

Have you verified SPI loopback test before porting MAX14830 module?

Hi Kevin,

Thanks for the answer.

Yes, I tried loopback and the SPI works. I also get connection with the MAX. The problem is only the interrupt.

This is my gpio configuration. I tried with or without adding it to gpio-input:

	gpio@2200000 {
		gpio-init-names = "default";
		gpio-init-0 = <&gpio_main_default>;

		gpio_main_default: default {
			gpio-input = <
				...
				TEGRA234_MAIN_GPIO(M, 0)
				>;
			gpio-output-low = <
				TEGRA234_MAIN_GPIO(H, 6)
				TEGRA234_MAIN_GPIO(I, 5)
				TEGRA234_MAIN_GPIO(AC, 0)
				TEGRA234_MAIN_GPIO(K, 4)
				TEGRA234_MAIN_GPIO(K, 5)
				>;
			gpio-output-high = <
				TEGRA234_MAIN_GPIO(P, 6)
				TEGRA234_MAIN_GPIO(Q, 3)
				TEGRA234_MAIN_GPIO(A, 0)
				>;
		};
	};

Is there anything special I should add to the pinmux generator sheet other than input and pull-up?

I’m using meta-tegra to build my image, which uses R36.4.0 JetPack release: 6.1.

Interestingly, when I delete the two lines regarding interrupt in the block for the max, I get this:

root@p3768-0000-p3767-0001:~# gpioinfo |grep PM.00 
        line  76:      "PM.00"       kernel   input  active-high [used]

Then, it is setup as input as expected and specified in gpio/pinmux. However, it still says kernel ... [used] Which I think is strange.

I found a place where the pin was used in tegra234-p3768-0000+p3767-xxxx-nv-common.dtsi:

        display@13800000 {
                /* os_gpio_hotplug_a is used for hotplug */
-               os_gpio_hotplug_a = <&gpio TEGRA234_MAIN_GPIO(M, 0) GPIO_ACTIVE_HIGH>;
-               status = "okay";
+               /* os_gpio_hotplug_a = <&gpio TEGRA234_MAIN_GPIO(M, 0) GPIO_ACTIVE_HIGH>;*/
+               status = "disabled";
        };

However, even after disabling, it’s still reserved by the kernel it seems:

root@p3768-0000-p3767-0001:~# gpioinfo |grep PM.00
        line  76:      "PM.00"       kernel   input  active-high [used]

Likely related to How can I use GPIO used by "kernel"? - #15 by enrique.ramirez

Testing this now.

It seemed to work with the changes here:

root@p3768-0000-p3767-0001:/proc/device-tree# dmesg|grep MAX
[   10.753893] spi0.0: ttyMAX0 at I/O 0x0 (irq = 250, base_baud = 2764800) is a MAX14830
[   10.759392] spi0.0: ttyMAX1 at I/O 0x20 (irq = 250, base_baud = 2764800) is a MAX14830
[   10.762332] spi0.0: ttyMAX2 at I/O 0x40 (irq = 250, base_baud = 2764800) is a MAX14830
[   10.788307] spi0.0: ttyMAX3 at I/O 0x60 (irq = 250, base_baud = 2764800) is a MAX14830
root@p3768-0000-p3767-0001:/proc/device-tree# gpioinfo |grep M.00
	line  76:      "PM.00"  "interrupt"   input  active-high [used]

Is there any documentation what the register in tegra234-mb2-bct-scr-p3767-0000.dts does?

Is that from yocto project?

DO you manage to get it work after applying that patch?

It seems a device tree configuration for firewall and sorry that there’s no public document for them currently.

Yes

Yes, it seems to work. I got some other problems with the interrupt, but that’s unrelated to the ticket here I think.

Thanks