USB to Ethernet

Dear Support,
I have a custom board and I am using an imx8 mini. I am trying to use USB_1 as an Ethernet connection using the Microchip LAN7850.

When I searched for it using the grep and dmesg command[dmesg | grep lan78xx
], nothing found , and I am wondering if the driver is missing.

I have checked the Toradex Git repository, and I found that the driver should be present. Could you please help me determine if I need to install the driver or if there are any other instructions I need to follow? Thank you so much for your time and assistance.
also I found this on DT and should I change something like remove hnp-disable; srp-disable; adp-disable;

hnp-disable; srp-disable; adp-disable;: These properties disable the HNP (Host Negotiation Protocol), SRP (Session Request Protocol), and ADP (Adaptive Power Management) features of the USB OTG controller.

&usbotg1 {
dr_mode = “otg”;
hnp-disable;
srp-disable;
adp-disable;
over-current-active-low;
picophy,dc-vol-level-adjust = <7>;
picophy,pre-emp-curr-control = <3>;
vbus-supply = <&reg_usb_otg1_vbus>;
};

Best regards,
Mehrdad

Hi @Mehrdad !

Could you please share the output of tdx-info (without arguments)?

Best regards,

1 Like

Hi @henrique.tx
Happy New Year! thank you so much for your help.

Best regards,
Mehrdad

Hi @henrique.tx ,
Please let me know if you need further information.
Best regards,
Mehrdad

“Any support for this would be appreciated.” :slight_smile:

Hi @Mehrdad !

I am sorry for the delay.

To check for already enabled kernel modules, we can directly check on a module with TorizonCore installed:

torizon@colibri-imx8x-06995602:~$ cat /etc/os-release
ID=torizon
NAME="TorizonCore"
VERSION="5.7.0-devel-202206+build.24 (dunfell)"
VERSION_ID=5.7.0-devel-202206-build.24
PRETTY_NAME="TorizonCore 5.7.0-devel-202206+build.24 (dunfell)"
DISTRO_CODENAME="dunfell"
BUILD_ID="24"
ANSI_COLOR="1;34"
VARIANT="Docker"
torizon@colibri-imx8x-06995602:~$ zcat /proc/config.gz | grep -i config_usb_lan
# CONFIG_USB_LAN78XX is not set

Or we can go to GitHub - toradex/toradex-kernel-cache: Patches and configuration for the Toradex kernel tree (branch dunfell-5.x.y for TorizonCore 5.x.y). When searching here, we can also see that the CONFIG_USB_LAN78XX is not enabled.

Therefore, according to what we have in the Introduction section of Building External Kernel Modules With Torizon | Toradex Developer Center, I will trigger internally the request to enable the CONFIG_USB_LAN78XX for you.

The R&D team will evaluate if it has no negative impacts. If everything is ok, it might take around 3 days to be available on a nightly release of TorizonCore. But might be sooner as well.

I will let you know the result.

Best regards,

1 Like

Dear @henrique.tx ,

Thank you so much for your help and your time.

Yes, you are correct; it does not enable.

image

Thank you for the request for me and I am looking forward to the new update! :slight_smile:

Best regards,
Mehrdad

Hi @Mehrdad !

Do you really need this change for TorizonCore 5 or only TorizonCore 6 would be good?

Best regards,

1 Like

Hi @henrique.tx ,

on the Toradex page, I found that:

If you are in production with TorizonCore or you depend on the graphics stack on a board based on the NXP i.MX 8/8X/8M Mini, we recommend that you continue to use release 5.7.0. Otherwise, we recommend upgrading from 6.0.0-devel-202209 to this monthly release.

I am not sure if we should use TorizonCore 6 for this task. I would appreciate your advice on this matter.

Best regards,
Mehrdad

Hi @Mehrdad !

So, are you in production?

And, just for completeness, could you please point out from where you got that quote?

Best regards,

1 Like

Hi @henrique.tx ,

I found it here,

We have been working on the first prototype, making modifications to the device tree (DT) and testing all components. However, we have not yet been able to test the USB to Ethernet functionality, as it requires the LAN7850 driver.

Best regards,
Mehrdad

Hi @henrique.tx ,

Any update?

image

Are you working on that? or is it related to something else!! the warning in engineering mode

Hi @Mehrdad !

Sorry for the delay.

As it turns out, the kernel config for LAN7850 is already enabled in TorizonCore 6. So you can test it right away.

TorizonCore 5 is LTS already and no modifications/additions/removals are easily done in it.

I would recommend you to try TorizonCore 6 and see how it goes.

About this, the warning is shown due to the connection of the module with the new ApolloX extension that you might be using in your VS Code. Nothing to worry about :slight_smile:

Best regards.

Hi @henrique.tx ,
please see the image below I tried TorizonCore 6 but still no driver for LAN78xx

image
It should work after this configuration, but…

Best regards,
Mehrdad

Hi @Mehrdad !

From the content of /proc/config.gz we can see that the kernel configuration is enabled, therefore, during the compilation of TorizonCore, the kernel object(s) of the related driver were added to the image.

You can run the following command to check for the related kernel object (.ko file):

find / -iname *.ko 2>/dev/null | grep -i lan78

To get the kernel driver output on your dmesg, you would need to have the device connected to your module, or you can try to use insmod or modprobe commands to start the driver.

Best regards,

Hi @henrique.tx ,
I connected the LAN7850 and nothing happened.
Should I modify something? I thought it was plug-and-play as they mentioned: [** A driver supporting this product is already present in the Linux mainline kernel. Specific backports, when available, can be found within the drivers listed here.]

and for testing, I need to modify DT and I have the error below and


and I found this

what could I do for modification of DT?
Best regards,
Mehrdad

Hi @Mehrdad !

From where?

Unfortunately, I do not have the same USB device to perform tests here. But there is this documentation in Linux kernel: microchip,lan78xx.txt « net « bindings « devicetree « Documentation - linux-toradex.git - Linux kernel for Apalis, Colibri and Verdin modules

It seems like some modification on the device tree is needed.

Best regards,

Hi @henrique.tx

I have a new update, this command [modprobe is a Linux command used to add or remove kernel modules, which are device drivers or other pieces of code that can be dynamically loaded or unloaded from the running kernel.] Also I have TorizonCore 6 now.


torizon@verdin-imx8mm-07219476:~$ dmesg | grep lan78xx
torizon@verdin-imx8mm-07219476:~$ sudo modprobe lan78xx
Password:
torizon@verdin-imx8mm-07219476:~$ dmesg | grep lan78xx
[  107.195139] usbcore: registered new interface driver lan78xx

The output of dmesg | grep lan78xx is showing that the kernel module lan78xx has been loaded successfully and a new interface driver has been registered

ip link show

This will display a list of all network interfaces on SOM and should have the enx interface for the LAN7850 adapter, but there is not one.

torizon@verdin-imx8mm-07219476:~$  ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: sit0@NONE: <NOARP> mtu 1480 qdisc noop qlen 1000
    link/sit 0.0.0.0 brd 0.0.0.0
3: ethernet0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq qlen 1000
    link/ether 00:14:2d:6e:29:14 brd ff:ff:ff:ff:ff:ff
4: can0: <NOARP40000> mtu 16 qdisc noop qlen 10
    link/[280]
5: mlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq qlen 1000
    link/ether 1e:86:52:9b:75:c4 brd ff:ff:ff:ff:ff:ff
6: uap0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq qlen 1000
    link/ether 56:cd:e8:1a:36:44 brd ff:ff:ff:ff:ff:ff
7: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue
    link/ether 02:42:a0:e6:78:7b brd ff:ff:ff:ff:ff:ff
8: br-f7be2eb3f03f: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue
    link/ether 02:42:62:fe:b6:04 brd ff:ff:ff:ff:ff:ff
10: vethab045ba@if9: <BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN> mtu 1500 qdisc noqueue master br-f7be2eb3f03f
    link/ether 7a:8f:c3:37:50:11 brd ff:ff:ff:ff:ff:ff
12: vethc521d75@if11: <BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN> mtu 1500 qdisc noqueue master br-f7be2eb3f03f
    link/ether 3a:91:cd:93:09:a7 brd ff:ff:ff:ff:ff:ff

also output of lsmod


torizon@verdin-imx8mm-07219476:~$ lsmod
Module                  Size  Used by
lan78xx                69632  0
xt_nat                 16384  9

any suggestion?
Best regards,
Mehrdad

Hi @Mehrdad !

Did you check if there is anything in your dmesg related to the lan78xx device that you are trying to enable?

Did you follow the documentation shared before to enable it in your device tree? (microchip,lan78xx.txt « net « bindings « devicetree « Documentation - linux-toradex.git - Linux kernel for Apalis, Colibri and Verdin modules)

Best regards,