Enabling USB-to-Ethernet Connectivity in Linux Kernel

Background

Embedded development often requires network connectivity between the target board and host PC. When the target device lacks a native RJ45 Ethernet port, USB-to-Ethernet adapters provide a practical solution. This guide covers the kernel configuration needed to enable USB networking support.

Hardware Prerequisites

A USB-to-Ethernet dongle compatible with common chipsets such as the ASIX AX88772B is required. These adapters typically support USB 2.0 and provide 10/100 Mbps Ethernet connectivity.

Kernel Configuration

USB Core Support

The following options enable basic USB functionality:

CONFIG_USB

  • Location: Device Drivers → USB support (USB_SUPPORT [=y])

Associated source files:

kernel/drivers/usb/core
kernel/drivers/usb/core/usbcore.c

CONFIG_USB_DWC2

  • Location: Device Drivers → USB support → DesignWare USB2 DRD Core Support

This enables the DesignWare USB2 dual-role controller.

CONFIG_USB_DWC2_HOST

  • Location: Device Drivers → USB support → DesignWare USB2 DRD Core Support → DWC2 Mode Selection

Configures the controller for host-only operation.

Source files for DWC2 driver:

kernel/drivers/usb/dwc2
kernel/drivers/usb/dwc2/dwc2.c

USB Network Adapter Support

These options anable USB-based network devices:

CONFIG_USB_USBNET

  • Location: Device Drivers → Network device support → USB Network Adapters

This provides the multi-purpose USB Networking Framework that supports various USB network chipsest.

CONFIG_USB_NET_AX8817X

  • Location: Device Drivers → Network device support → USB Network Adapters → Multi-purpose USB Networking Framewokr

This specifically enables support for ASIX AX88xxx series USB 2.0 Ethernet adapters.

Source files for USB networking:

kernel/drivers/net/usb
kernel/drivers/net/usb/asix.c

USB PHY Configuration

CONFIG_INGENIC_INNOPHY

  • Location: Device Drivers → USB support → USB Physical Layer drivers → Ingenic usb Phy selects

This enables the Ingenic USB PHY driver required for certain platforms.

Source file:

kernel/drivers/usb/phy/phy-ingenic-inno.c

Verification on Target System

After connecting the USB-to-Ethernet adapter, the kernel logs should display recognition of the device:

[34890.278234] usb 1-1: new high-speed USB device number 3 using dwc2
[34891.320513] asix 1-1:1.0 eth0: register 'asix' at usb-13500000.otg-1, ASIX AX88772B USB 2.0 Ethernet, 00:6f:00:01:05:4c

Network interface verification using ifconfig -a:

eth0      Link encap:Ethernet  HWaddr 00:6F:00:01:05:4C  
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

DHCP client configuration to obtain IP address:

# udhcpc eth0
udhcpc (v1.22.1) started
[35048.802148] asix 1-1:1.0 eth0: link down
Sending discover...
[35050.723127] asix 1-1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0xCDE1
Sending select for 172.17.150.144...
Lease of 172.17.150.144 obtained, lease time 86202

Connectivity test results:

# ping 172.17.151.10
PING 172.17.151.10 (172.17.151.10): 56 data bytes
64 bytes from 172.17.151.10: seq=0 ttl=128 time=1.093 ms
64 bytes from 172.17.151.10: seq=1 ttl=128 time=0.754 ms
64 bytes from 172.17.151.10: seq=2 ttl=128 time=0.766 ms
64 bytes from 172.17.151.10: seq=3 ttl=128 time=0.685 ms
64 bytes from 172.17.151.10: seq=4 ttl=128 time=0.688 ms

--- 172.17.151.10 ping statistics ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max = 0.685/0.797/1.093 ms

The adapter successfully establishes a 100Mbps full-duplex link and obtains an IP address via DHCP, enabling standard network operations for file transfers and remote debugging.

Tags: linux-kernel usb-networking embedded-linux asix-driver dwc2-usb

Posted on Sat, 09 May 2026 19:14:27 +0000 by CoderDan