Does TX2 support the enc28j60 device?

Hello everyone,

I want to testing the enc28j60 ethernet device on TX2, and I built the enc28j60 driver into the tx2.

And I can find the driver information that /sys/bus/spi/driver/enc28j60.

But I don’t how to set the device tree and let it work?

Have a check this doc

https://elixir.bootlin.com/linux/latest/source/Documentation/devicetree/bindings/net/microchip,enc28j60.txt

Hi ShaneCCC,

I read the document, but how to I set the device tree on TX2?

Can I use the “spidev” config at spi@3240000, just replace the compatible?

How to set the “pinctrl-0” and “interrupt-parent” value?

Thank you.

Have a check below document to build customize kernel or dtb for TX2.
For the pin configure that depend on enc28j60 connect to which GPIO pins.

https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%2520Linux%2520Driver%2520Package%2520Development%2520Guide%2Fkernel_custom.html%23

Hi ShaneCCC,

if I want to use the enc28j60 driver by spi0.

Ex.

    spi@3240000 {
            status = "okay";
            enc28j60: ethernet@0 {
                    compatible = "microchip,enc28j60";
                    pinctrl-names = "default";
                    pinctrl-0 = <&enc28j60_pins>;
                    reg = <0>;
                    interrupt-parent = <&gpio3>;
                    interrupts = <3 IRQ_TYPE_EDGE_FALLING>;
                    spi-max-frequency = <12000000>;
            };
    };

but the “pinctrl-0 = <&enc28j60_pins>” and “interrupt-parent = <&gpio3>;” is wrong.

I don’t how to set even I read the “GPIO change” in kernel_custom document.

Could you give me a real case like using “GPIO15_AP2MDM_READY” to set, please?

thank you.

SHould be like below. Need to change the GPIO pin C as your connection.

interrupt-parent = <&tegra_main_gpio>;
interrupts = <TEGRA_MAIN_GPIO(C, 0) 0x14>;

Thanks.

But the pinctrl-0 value also set like below?

pinctrl@80018000 {
enc28j60_pins: enc28j60_pins@0 {
reg = <0>;
fsl,pinmux-ids = <
MX28_PAD_AUART0_RTS__GPIO_3_3 /* Interrupt */
>;
fsl,drive-strength = <MXS_DRIVE_4mA>;
fsl,voltage = <MXS_VOLTAGE_HIGH>;
fsl,pull-up = <MXS_PULL_DISABLE>;
};
};

the address of pinctrl is 3520000, right??

You may need to check the driver to know what the pinctl-0 for and correct configure it.
If the driver not have it I think you can ignore it.

Hi ShaneCCC,

I want to create a custom device tree overlay for the 40‑pin Header like the link(https://docs.nvidia.com/jetson/archives/l4t-archived/l4t-3231/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide%2Fhw_setup_jetson_io.html)

I got some error message like below when I use the command(“sudo /opt/nvidia/jetson-io/config-by-function.py -o dtbo spi3”).

Traceback (most recent call last):
File “/opt/nvidia/jetson-io/config-by-function.py”, line 24, in
from Jetson import board
ImportError: cannot import name ‘board’

how can i fix the problem?

thank you.

Check the Note.

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

hi ShaneCCC,

Did you use the ethernet controller(ENC28J60) on Jetson?

I have no idea about the root cause of the issue.

I guess the device tree was incorrect.

Sorry didn’t use it ever. You may need vendor to support how to add the device tree for this device.

OK, Thank you very much ^^