Работа с сетью В SoC Allwinner H616 контроллер Ethernet имеет два интерфейса (см. Контроллер EMAC): Для работы с локальной сетью в SPI-загрузчике OrangePi Zero2 используется EMAC0, т.е. гигабитный порт Ethernet. Ethernet PHY - это приемопередатчик Ethernet RTL 8211F (см. Datasheet RTL8211F ) EMAC0 имеет базовый адрес: 0x05020000 ( см. Регистры EMAC ) В дереве устройств контроллер EMAC0 описывает узел soc/ethernet@5020000 ethernet@5020000 {
syscon = <0x00000012>; reg = <0x05020000 0x00010000>; interrupts = <0x00000000 0x0000000e 0x00000004>; interrupt-names = "macirq"; resets = <0x00000002 0x0000001e>; reset-names = "stmmaceth"; clocks = <0x00000002 0x00000052>; clock-names = "stmmaceth"; status = "okay"; pinctrl-names = "default"; pinctrl-0 = <0x00000013>; phy-mode = "rgmii"; phy-handle = <0x00000014>; phy-supply = <0x0000000a>; allwinner,rx-delay-ps = <0x00000c1c>; allwinner,tx-delay-ps = <0x000002bc>; phandle = <0x00000031>; mdio {
#address-cells = <0x00000001>; #size-cells = <0x00000000>; phandle = <0x00000032>; ethernet-phy@1 { compatible = "ethernet-phy-ieee802.3-c22"; reg = <0x00000001>; phandle = <0x00000014>; }; Примечания: aliases {
serial0 = "/soc/serial@5000000"; mmc0 = "/soc/mmc@4020000"; __symbols__ {
emac0 = "/soc/ethernet@5020000"; mdio0 = "/soc/ethernet@5020000/mdio"; ext_rgmii_phy = "/soc/ethernet@5020000/mdio/ethernet-phy@1"; ........... Команды оболочки U-Boot для работы с сетью
В этих командах могут использоваться параметры (аргументы): net=> help net net - NET sub-system Usage: net list - list available devices => net list eth0 : ethernet@5020000 02:00:59:aa:2d:08 active => tftpboot=> help tftpboot tftpboot - load file via network using TFTP protocol Usage: tftpboot [loadAddress] [[hostIPaddr:]bootfilename] => Например: => tftpboot 0x45000000 spl.bin Using ethernet@5020000 device TFTP from server 192.168.0.105; our IP address is 192.168.0.122 Filename 'spl.bin'. Load address: 0x45000000 Loading: ################################################# 2.9 MiB/s done Bytes transferred = 754349 (b82ad hex) => tftpputtftpput address size [[hostIPaddr:]filename] Здесь:
nfs=> help nfs nfs - boot image via network using NFS protocol Usage: nfs [loadAddress] [[hostIPaddr:]bootfilename] => bootp=> help bootp bootp - boot image via network using BOOTP/TFTP protocol Usage: bootp [loadAddress] [[hostIPaddr:]bootfilename] => dhcp=> help dhcp dhcp - boot image via network using DHCP/TFTP protocol Usage: dhcp [loadAddress] [[hostIPaddr:]bootfilename] => mdio=> help mdio mdio - MDIO utility commands Usage: mdio list - List MDIO buses mdio read <phydev> [<devad>.]<reg> - read PHY's register at <devad>.<reg> mdio write <phydev> [<devad>.]<reg> <data> - write PHY's register at <devad>. mdio rx <phydev> [<devad>.]<reg> - read PHY's extended register at <devad>.<reg> mdio wx <phydev> [<devad>.]<reg> <data> - write PHY's extended register at <devad>. <phydev> may be: <busname> <addr> <addr> <eth name> <addr> <devad>, and <reg> may be ranges, e.g. 1-5.4-0x1f. => Например: => mdio list ethernet@5020000: 1 - RealTek RTL8211F <--> ethernet@5020000 => mii=> help mii mii - MII utility commands Usage: mii device - list available devices mii device mii info mii read mii write mii modify updating bits identified in mii dump Addr and/or reg may be ranges, e.g. 2-7. => Например: => mii device MII devices: 'ethernet@5020000' Current device: 'ethernet@5020000' => ping=> help ping ping - send ICMP ECHO_REQUEST to network host Usage: ping pingAddress => Например: => ping 192.168.0.112 Using ethernet@5020000 device host 192.168.0.112 is alive => ping 192.168.0.113 Using ethernet@5020000 device ARP Retry count exceeded; starting again ping failed; host 192.168.0.113 is not alive => |