Contents

General

The ADM5120 has a built in ethernet switch.
It has up to 6 external ports (5 on the SQFP package, the BGA package has an extra MII port).
Also there is a special 'CPU' port which is used to send the packages to and from the CPU.

VLANs

Internally the driver works with 6 VLANs. Each of the ports (including the cpu port) can be part of any of these vlans. These VLANS can be seen as the actual switches, if two ports are part of the same VLAN packets will be routed between them.

Switch matrix and the Linux driver

The setup of these vlans can be done using a switch matrix. This is a 6 by 7 matrix encoded into 6 bytes. Each of the bytes is the matrix setup for a single vlan. Each of the bits of such a byte represent one of the 6 ports or the cpu port. (It is possible to configure a switch without the cpu port in it, this will result in a ethernet switch with no cpu load at all.)

The Linux driver will allocate an ethernet device for each of the available vlans.
Per default the driver will setup up the matrix such that each port has its own vlan and the cpu port is part off every vlan.

Configure vlan via /proc

There is a patch for 2.4.32 kernel (part of midge distribution) which can be useful for configuring vlans via /proc

Getting admswconfig

Limitations

The admswconfig tool does not work on the Hawking H2WR54G Linux 2.4.18 kernel. It does not recognize any of the ethX devices as VLANs. The ADM5120 network switch driver code that supports the necessary IOCTL calls seems to be missing from the kernel. It is hard to tell exactly what the problem is since Hawking does not supply source code for their devices as required by the GPL. The Hawking firmware seems to be substantially based on the tried-and-true Edimax source but there are significant differences that are impossible to pin down without the source code.

However, AMiLDA Linux's kernel has this driver backported from 2.6, and so the admswconfig tool can be used perfectly.

ADM5120 switch hardware descriptor has 25-bit dma address field. So dma-addressible only 32Mb. But in MIPS Linux kernel dma-addressible all memory. So if you have memory more than 32Mb, driver would not works properly.
And sometimes in switch drivers DMA mask is incorrect: 0xffffff instead 0x1ffffff (look in driver header files).