Kernel module probe function is never called

Hi everyone,
I’m trying to communicate with MCP2515.This is my .dtbo file, i followed these steps to configure the SPI. After rebooting, everything is OK, i can see my spi_dev on /dev, and it also generated a tegra210-p3448-0000-p3449-0000-b00-mcp251x-can-controller.dtb. I wrote my own driver file like this

http://www.macs.hw.ac.uk/~hwloidl/hackspace/linux/drivers/net/can/spi/mcp251x.c

$ sudo insmod mcp251x.ko --> successful

$ ifconfig -a --> I can see the can0

$ sudo ip link set can0 up type can bitrate 500000

$ candump can0

RTNETLINK answers: Invalid argument

$ dmesg | grep mcp
[ 0.562011] GPIO line 200 (mcp2515_int) hogged as input
[ 8.786868] mcp251x: loading out-of-tree module taints kernel.
[ 70.862175] mcp251x spi0.0: failed to acquire irq 0

I have some questions

  1. I try to add some debug statements (printk or
    dev_dbg) to the MCP251x driver’s “mcp251x_can_probe” function. But I never see any of the debug prints from the MCP251x’s probe function on dmesg . Why? I can’t figure out why this probe function isn’t being called, but something is managing to return mcp251x spi0.0: failed to acquire irq 0

  2. Why do i always get message “mcp251x: loading out-of-tree module taints kernel” ?

Thank you very much

This is a part of my tegra210-p3448-0000-p3449-0000-b00-mcp251x-can-controller.dts file

    clocks {
    		can_clock {
    			phandle = <0x12c>;
    			linux,phandle = <0x12c>;
    			clock-accuracy = <0x64>;
    			clock-frequency = <0xf42400>;
    			#clock-cells = <0x0>;
    			compatible = "fixed-clock";
    		};
    	};

    spi@7000d400 {
    		compatible = "nvidia,tegra210-spi";
    		reg = <0x0 0x7000d400 0x0 0x200>;
    		interrupts = <0x0 0x3b 0x4>;
    		iommus = <0x2b 0xe>;
    		#address-cells = <0x1>;
    		#size-cells = <0x0>;
    		dmas = <0x4c 0xf 0x4c 0xf>;
    		dma-names = "rx", "tx";
    		nvidia,clk-parents = "pll_p", "clk_m";
    		clocks = <0x21 0x29 0x21 0xf3 0x21 0xe9>;
    		clock-names = "spi", "pll_p", "clk_m";
    		resets = <0x21 0x29>;
    		reset-names = "spi";
    		status = "okay";
    		linux,phandle = <0x10c>;
    		phandle = <0x10c>;

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

    			prod {
    				prod = <0x4 0xfff 0x0>;
    			};

    			prod_c_flash {
    				status = "disabled";
    				prod = <0x4 0x3f 0x7>;
    			};

    			prod_c_loop {
    				status = "disabled";
    				prod = <0x4 0xfff 0x44b>;
    			};
    		};

    		spi@0 {
    			//interrupt-parent = <0x56>;
    			//interrupts = <0xc8 0x1>;
    			interrupts = <0x56 0xc8 0x2>;
    			clocks = <0x12c>;
    			nvidia,rx-clk-tap-delay = <0x6>;
    			nvidia,enable-hw-based-cs;
    			compatible = "microchip,mcp2515";
    			reg = <0x0>;
    			spi-max-frequency = <0x989680>;

    			controller-data {
    				nvidia,tx-clk-tap-delay = <0x0>;
    				nvidia,cs-hold-clk-count = <0x1e>;
    				nvidia,cs-setup-clk-count = <0x1e>;
    				nvidia,enable-hw-based-cs;
    				nvidia,rx-clk-tap-delay = <0x1f>;
    			};
    		};

    		spi@1 {
    			compatible = "spidev";
    			reg = <0x1>;
    			spi-max-frequency = <0x1f78a40>;

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

Hi thanhhaipif96,
Your driver is not compatible with kernel/Image you flashed. Also, your driver does not have functionality to use interrupts based on GPIO. That’s why it says failed to acquire irq .
Why your prints is not visible because your driver is not updated under /lib/modules/…
I would recommend you to use my driver I have attached in this thread Jetson nano and mcp2515 can module
Compile this driver and flash the compiled Image first. Then copy this compiled .ko in /lib/modules/… after flashing, it should work.

Thanks,
Shubhi