BPI-R2 Ethernet MAC address

Have you used a actual uboot?

There is a fix for eth in uboot from nov 30th:

Probably not, I’ve been using the recent images of LEDE and Ubuntu, but haven’t paid attention to what version of u-boot is included. I haven’t tried building BPI-R2-bsp yet, I will soon.

You can download the actual uboot from my gdrive

https://drive.google.com/drive/mobile/folders/1WLWAR1FC-rF4n2SgFecBlU1ym_XKqAR_/15Y5Y3NAOwg_IMmN3k6hdb7pAQj9oTVTl?usp=sharing&sort=13&direction=a

You can update it using bpi-update or like this: http://www.fw-web.de/dokuwiki/doku.php?id=en/bpi-r2/uboot#update_uboot

this patch fixed the uboot load code issue which cannot download image via tftp protocol sometimes.

1 Like

if the problem exists in current uboot,are there fixes for this?

it is not an issue since mac address is from dts not uboot, thanks.

How do i set mac in dts? Is’nt there an uboot-way?

you can refer to below discussion, thanks. http://zedboard.com/content/passing-mac-address-kernel-device-tree-blob

in that thread there must be added a entry to ethernet@xxxxx

local-mac-address = [00 0a 35 00 00 01];

i’ve found in mt7623.dtsi only 1 ethernet-section, is that eth0 or eth1?

as i see in curent kernel there are lan and wan both mapped to eth0:

4: wan@eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default0
5: lan0@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP0
6: lan1@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state 0

is that right? i supposed wan is a separate nic (eth1) and the lan-ports on eth0

this is on 4.4.70 (without dsa):

5: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKN0
6: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qle0

it seems that both nics are in same controller:

root@bpi-r2:~# find /sys/devices/platform/ -name 'eth0'
/sys/devices/platform/1b100000.ethernet/net/eth0
root@bpi-r2:~# find /sys/devices/platform/ -name 'eth1'
/sys/devices/platform/1b100000.ethernet/net/eth1

found nothing how they separated and why here 2 devices created

Ethernet-dts-entry is different…

4.4.70:

eth: ethernet@1b100000 {
		compatible = "mediatek,mt7623-eth";
		reg = <0 0x1b100000 0 0x20000>;
		interrupts = <GIC_SPI 200 IRQ_TYPE_LEVEL_LOW>,
			     <GIC_SPI 199 IRQ_TYPE_LEVEL_LOW>,
			     <GIC_SPI 198 IRQ_TYPE_LEVEL_LOW>;
		clocks = <&topckgen CLK_TOP_ETHIF_SEL>,
			 <&clk26m>,
			 <&clk26m>,
			 <&clk26m>,
			 <&apmixedsys CLK_APMIXED_TRGPLL>,
			 <&ethsys CLK_ETHSYS_ESW>,
			 <&ethsys CLK_ETHSYS_GP2>,
			 <&ethsys CLK_ETHSYS_GP1>,
			 <&clk26m>,
			 <&clk26m>,
			 <&clk26m>,
			 <&clk26m>,
			 <&clk26m>;
		clock-names = "ethif", "eth1pll", "eth2pll",
			      "sgmipll", "trgpll", "esw", "gp2",
			      "gp1", "gp0", "sgmii_tx250m",
			      "sgmii_rx250m", "sgmii_cdr_ref",
			      "sgmii_cdr_fb";
		power-domains = <&scpsys MT2701_POWER_DOMAIN_ETH>;
		resets = <&watchdog MT2701_TOPRGU_ETHDMA_RST>;
		reset-names = "eth";
		mediatek,ethsys = <&ethsys>;
            mediatek,pctl = <&syscfg_pctl_a>;
		mediatek,switch = <&gsw>;
		#reset-cells = <1>;
		#address-cells = <1>;
		#size-cells = <0>;
		status = "disabled";
	};

	gsw: gswsys@1b100000 {
		compatible = "mediatek,mt7623-gsw",
			     "mediatek,mt2701-gsw";
		mediatek,ethsys = <&ethsys>;
		status = "disabled";
};

4.14 (last part):

reset-names = "fe", "gmac", "ppe";
power-domains = <&scpsys MT2701_POWER_DOMAIN_ETH>; 
mediatek,ethsys = <&ethsys>; 
mediatek,pctl = <&syscfg_pctl_a>;
#address-cells = <1>;
#size-cells = <0>;
status = "disabled";

as you see in 4.4.70 there is a additional line +section

mediatek,switch = <&gsw>;

This will raise the question about lan/wan-isolation again…

Looked in schematics,but it’s not clear…on last page i see in block-diagram,that lan+wan goes over the 7530 switch…on the page with the switch only lan-ports are listed (1-4)

Hi

I’ve tried the command ifconfig ethx hw ether 00:11:22:33:44:55 on both lede and ubuntu, it works. Can you please have a try?

i can also change mac with ifconfig hw ether…so i’m doing it currently (/etc/network/interfaces): http://www.fw-web.de/dokuwiki/doku.php?id=en/bpi-r2/software

but if the right way to do it is in dts…i want to set both interfaces in uboot, because then i have not recompile kernel and its independend from runnnig system

the way with “hwaddress ether” does not work in debian 9 (stretch), here you can do that with

iface lan0 inet static
  address 192.168.0.10
  netmask 255.255.255.0
  gateway 192.168.0.5
#  pre-up ip link set $IFACE up
  pre-up ip link set $IFACE address 02:01:02:03:04:08 up
  post-down ip link set $IFACE down

in /etc/network/interfaces

It actually work in LEDE. Can you try use same MAC in wan and the device under br-lan.

Hi BoringCat

I don’t think we can use the same MAC address for both wan and br-lan, this may cause switch chip doesn’t work fine.

$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether ae:fc:de:ad:be:ef brd ff:ff:ff:ff:ff:ff
3: wan@eth0: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether ae:fc:de:ad:be:ef brd ff:ff:ff:ff:ff:ff
4: lan0@eth0: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether ae:fc:de:ad:be:ef brd ff:ff:ff:ff:ff:ff
5: lan1@eth0: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether ae:fc:de:ad:be:ef brd ff:ff:ff:ff:ff:ff
6: lan2@eth0: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether ae:fc:de:ad:be:ef brd ff:ff:ff:ff:ff:ff
7: lan3@eth0: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether ae:fc:de:ad:be:ef brd ff:ff:ff:ff:ff:ff
$ cat /etc/udev/rules.d/00-static-mac-address.rules
ACTION=="add", SUBSYSTEM=="net", KERNELS=="1b100000.ethernet", RUN+="/sbin/ip link set dev %k address ae:fc:de:ad:be:ef"

I hate this solution, But …

@frank-w

1 Like

?? what do you want to say me? :thinking:

that all interfaces are the same mac? it’s because currently only 1 gmac is used between mt7530 (switch) and CPU

see thread about the second GMAC

I @you because the your solution(BPI-R2 Ethernet MAC address) might not work well for the linux kernel from your github repos.

currently in debian stretch with my kernel i do it that way:

iface lan0 inet static
  address 192.168.0.10
  netmask 255.255.255.0
  gateway 192.168.0.5
#  pre-up ip link set $IFACE up
  pre-up ip link set $IFACE address 02:01:02:03:04:08 up

but good to know that there is a udev-way to do that

1 Like

it is ok because lan and wan are different subnet and we only need to make sure the mac address is unique for one subnet.

Yes it is. But just on “Network Layer”. Because all Ethernet port on R2 is actually a mt7530 switch. The switch works on “Data Link Layer”. So If there are two devices have same MAC. It’s chip will not work fine.