Please follow the following steps to enable Ethernet of demo boards.
1. Go to kernel folder, run ‘make menuconfig’. Then, use arrow and Enter key to select <Device Drivers> → <Network device support> → <Ethernet driver support> and then enable <Sunplus devices> as below:
2. This step is only for demo board V3. Skip this step if you are using V1 or V2.
Demo board V3 consists of two Ethernet ports, you can set the two Ethernet ports in “An NIC with Daisy-chain” mode or “Dual NIC” mode. To select mode, move cursor to “Selected Mode” and press Enter to select modes. Refer to picture below:
where “Dual NIC Mode” is selected. You will have two Ethernet ports, eth0 and eth1, in Linux.
3. Save settings of ‘menuconfig' and go to top folder to run 'make all’ to build image.
4. Appendix
Besides selecting mode in ‘menuconfig’, Sunplus Ethernet driver also supports dynamic (run-time) mode-switching. That’s, even after Linux boots up, you can use ‘sysfs’ to switch operation mode. Just simply write a ‘mode’ character to ‘sysfs’. ‘mode’ character is defined as:
0: An NIC with daisy-chain mode
1: Dual NIC mode
2: An NIC with daisy-chain mode 2
For example, to switch to “Dual NIC mode”, just simply issue shell command as:
/ # echo 1 > /sys/devices/platform/soc@B/9c108000.l2sw/mode
Current operation mode of Ethernet driver can also be read out from ‘sysfs’. For example, issue the shell command as:
/ # cat /sys/devices/platform/soc@B/9c108000.l2sw/mode
Dynamic mode-switching function can be turned off by simply disable the menu item “Support Dynamic Mode-switching by sysfs”. Refer the screen picture below:
Sunplus Ethernet driver supports 3 operation modes:
a. An NIC with daisy-chain mode
b. Dual NIC mode
c. An NIC with daisy-chain mode 2
In “An NIC with daisy-chain mode”, Ethernet driver creates one net-device interface (eg: eth0). The net-device interface is connected to two LAN ports (two RJ45 sockets) via L2 switch. In this mode, a packet from one LAN port will be either forwarded to net-device interface (eht0) if its destination address matches MAC address of net-device interface (eth0), or forwarded to other LAN port. A packet from net-device interface (eth0) will be forwarded to a LAN port if its destination address is learnt by L2 switch, or forwarded to both LAN ports if its destination has not been learnt yet. The following diagram illustrates the packets flow in this mode.
In “Dual NIC mode”, Ethernet driver creates two net-device interfaces (eg: eth0 and eth1). Each has its dedicated LAN port. Packets will not be forwarded between two ports, unless you run some bridge utilities manually in Linux. Refer to diagram below, packets from eth0 will be always forwarded to LAN port 0 and packets from LAN port 0 will be always forwarded to eth0. The same theory is applied for eth1 and LAN port 1.
“An NIC with daisy-chain mode 2” is similar to “An NIC with daisy-chain mode”. The difference is that a packet from net-device interface (eth0) will be always forwarded to both LAN ports. Learning function of L2 switch is turned off in this mode. This means L2 switch will never learn the source address of a packet. So, it always forward packets to both LAN ports. This mode works like you have 2-port Ethernet hub.
Add Comment