| 32 | == GW740x Ethernet Notes |
| 33 | |
| 34 | The GW740x has 6 RJ45's on the front panel. When looking at the board |
| 35 | from the front with the user LED and barrel jack on the left these |
| 36 | ports are: |
| 37 | eth0 (IMX8MM EQOS MAC + GPY111 RGMII PHY) |
| 38 | lan1 (KSZ9477 switch port from IMX8MM FEC MAC (eth1) CPU uplink) |
| 39 | lan2 (KSZ9477 switch port from IMX8MM FEC MAC (eth1) CPU uplink) |
| 40 | lan3 (KSZ9477 switch port from IMX8MM FEC MAC (eth1) CPU uplink) |
| 41 | lan4 (KSZ9477 switch port from IMX8MM FEC MAC (eth1) CPU uplink) |
| 42 | lan5 (KSZ9477 switch port from IMX8MM FEC MAC (eth1) CPU uplink) |
| 43 | |
| 44 | In U-Boot use the 'net list' command to show the available network |
| 45 | devices as well as the 'eth' interface name and the device name that |
| 46 | can be used to specify the active device in U-Boot. Either name can be |
| 47 | set to the 'ethact' env variable to specify the active device and only |
| 48 | 1 device is active at a time for U-Boot network commands. |
| 49 | |
| 50 | Note that from the CPU's perspective 'eth1' is the CPU uplink device |
| 51 | to the KSZ9477 switch so it is never used by itself. |
| 52 | |
| 53 | Example: |
| 54 | # list network devs in U-Boot |
| 55 | u-boot=> net list |
| 56 | eth2 : lan1 00:d0:12:d3:f7:8e |
| 57 | eth3 : lan2 00:d0:12:d3:f7:8f |
| 58 | eth4 : lan3 00:d0:12:d3:f7:90 |
| 59 | eth5 : lan4 00:d0:12:d3:f7:91 |
| 60 | eth6 : lan5 00:d0:12:d3:f7:92 |
| 61 | eth1 : ethernet@30be0000 00:d0:12:d3:f7:8d |
| 62 | eth0 : ethernet@30bf0000 00:d0:12:d3:f7:8c active |
| 63 | # specify eth0 (the 1st RJ45) (this is also the default) |
| 64 | setenv ethact eth0 |
| 65 | # specify lan1 (the 2nd RJ45) |
| 66 | setenv ethact lan1 # or eth2 if you want but that is a U-Boot only name |
| 67 | # save env if you want this to persist in U-Boot across boots |
| 68 | saveenv |
| 69 | |
| 70 | For Linux, specifically our kernel and BSP you will see the device naming above: |
| 71 | eth0 (IMX8MM EQOS MAC + GPY111 RGMII PHY) |
| 72 | lan1 (KSZ9477 switch port from IMX8MM FEC MAC (eth1) CPU uplink) |
| 73 | lan2 (KSZ9477 switch port from IMX8MM FEC MAC (eth1) CPU uplink) |
| 74 | lan3 (KSZ9477 switch port from IMX8MM FEC MAC (eth1) CPU uplink) |
| 75 | lan4 (KSZ9477 switch port from IMX8MM FEC MAC (eth1) CPU uplink) |
| 76 | lan5 (KSZ9477 switch port from IMX8MM FEC MAC (eth1) CPU uplink) |
| 77 | |
| 78 | In Linux 5.12+ you do not need to bring up the CPU uplink port to the |
| 79 | switch (eth1) as it will be brought up whenever any of the downstream |
| 80 | ports are brought up. Modern Linux DSA (Distributed Switch |
| 81 | Architecture) provides more or less full interface devices for the |
| 82 | ports on the switch thus you can have IP configuration, VLAN etc, on |
| 83 | the individual ports. |
| 84 | |
| 85 | Additionally our BSP is pre-configured to bring up eth0 with DHCP so |
| 86 | if you have the first RJ45 plugged into your network you should see |
| 87 | 'eth0' properly configured for networking. If you want to use the 2nd |
| 88 | RJ45 it would be 'lan1', etc. |
| 89 | |
| 90 | For Linux here are some gory details that you should be aware of if |
| 91 | you stray from our kernel/BSP: |
| 92 | In Linux things can be a bit more complicated depending on if you have |
| 93 | systemd/udev changing device names or not. Linux will register |
| 94 | on-board network devices as 'eth%d' starting at 0 and incrementing in |
| 95 | the order the device is registered which depends greatly on the kernel |
| 96 | (linking order, modules vs static drivers etc) and the kernel makes NO |
| 97 | attempt to make this consistent across reboots. Therefore there is a |
| 98 | concept in Linux where a userspace process like systemd/udev will |
| 99 | rename the network interfaces as they get registered to use |
| 100 | bus/port/path specific names that are consistent across boots. This |
| 101 | produces pretty confusing names to most users so we disable this |
| 102 | feature in our default build by passing 'net.ifnames=0' on the kernel |
| 103 | command line which confusing enough is not at all a kernel option but |
| 104 | systemd/udev parses the kernel cmdline to look for this. To make |
| 105 | things worse DSA drivers (which modern switch devices are) get their |
| 106 | port names from device-tree so Linux will name those 'lan1', 'lan2'. |
| 107 | And to make things really worse because the IMX8MM FEC and EQOS |
| 108 | network devices are different MAC's (both inside the IMX8MP) they have |
| 109 | different drivers and those drivers can register in either order so |
| 110 | eth0/eth1 can flip around across boots. I added a kernel patch (a |
| 111 | controversial one that will never make it upstream) to our kernel to |
| 112 | avoid this and make them consistent. |
| 113 | |
| 114 | Linux 5.12 DSA drivers will bring up the cpu port interface |
| 115 | automatically which is why one may see eth1 up after bringing up any of |
| 116 | the lan ports. |
| 117 | |
| 118 | |
| 119 | |