Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Please follow the following steps to setup operation modes and enable Ethernet of demo boardsSP7021.

1.

...

Enable Sunplus Ethernet device

Run make kconfig in project top directory. When “Linux/arm Kernel Configuration” menu pops up, use arrow and Enter key to select <Device Drivers> → <Network device support> → <Ethernet driver support> and then enable <Sunplus Ethernet devices> as . Refer to screenshot 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

...

<Sunplus Ethernet devices> is enabled.

2. Setup operating mode of Ethernet device

Modify node l2sw in device-tree source file to set up operating mode of Ethernet device. For example, if you are using SP7021 demo board V3 and you need dual network interfaces, please modify the device-tree source file, linux/kernel/arch/arm/boot/dts/sp7021-demov3.dts, as shown below:

Code Block
&l2sw {
	pinctrl-names = "default";
	pinctrl-0 = <&l2sw_demo_board_v3_pins>;
	mode = < 1 >;
		/* 0 = daisy-chain mode
		 * 1 = dual NIC mode
		 * 2 = daisy-chain mode (disable SA learning) */
};

where property mode is set to 1 to set up operating mode to “dual NIC”.

SP7021 supports two Ethernet ports, you can choose to set the two Ethernet ports in “An NIC with Daisy“daisy-chain” mode, “dual NIC” mode or “Dual NIC” mode. Refer to picture below:

...

where “Dual NIC Mode” is selected. You , or “daisy-chain mode but disable source-address learning” mode.

If “dual NIC” mode is set, you will have two Ethernet portsinterfaces, eth0 and eth1, in Linux. Otherwise, you will have one Ethernet interface, eth0, in Linux.

3.

...

Build Linux image

Go to top folder to run 'make all’ . Run make all to build Linux image.

4

...

. Boot Linux

Boot Linux with the built image.

5. Dynamic switch operating mode

Besides selecting mode in ‘menuconfig’device-tree source file, Sunplus Ethernet driver also supports dynamic (run-time) mode-switching. That’s, even after To enable dynamic mode-switching, please enable “Support Dynamic Mode-switching by sysfs“ in “Linux/arm Kernel Configuration” menu. Refer to screenshot below:

...

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 “daisy-chain” mode

1: Dual NIC “dual NIC” mode

2: An NIC with daisy“daisy-chain but disable SA learning” mode 2

For example, to switch to “Dual NIC mode”“dual NIC” mode, just simply issue 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:

...

6. Appendix

Sunplus Ethernet driver supports 3 operation modes:

a. An NIC with daisy-chain “daisy-chain” mode

b. Dual NIC “dual NIC” mode

c. An NIC with daisy“daisy-chain but disable source address learning” mode 2

In “An NIC with daisy-chain mode”“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”“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“daisy-chain but disable source address learning” mode 2” is similar to “An NIC with daisy-chain mode”“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.

...