[BPI-R2 pro] - Ethernet-switch

small update for r2pro with mt7531:

# dmesg | grep -i 'mt753'
[    0.000000] Linux version 5.17.0-r2pro-mt7531dsa-00166-g8e291c72610e (frank@frank-G5-U20) (aarch64-linux-gnu-gcc (Ubuntu 9.4.0-1u2
[    1.761349] mt7530 stmmac-0:00: no interrupt support
[    1.798268] mt7530 stmmac-0:00: configuring for fixed/rgmii link mode
[    1.800253] mt7530 stmmac-0:00: Link is Up - 1Gbps/Full - flow control rx/tx
[    1.840596] mt7530 stmmac-0:00 wan (uninitialized): PHY [mt7530-0:00] driver [MediaTek MT7531 PHY] (irq=POLL)
[    1.889002] mt7530 stmmac-0:00 lan0 (uninitialized): PHY [mt7530-0:01] driver [MediaTek MT7531 PHY] (irq=POLL)
[    1.940066] mt7530 stmmac-0:00 lan1 (uninitialized): PHY [mt7530-0:02] driver [MediaTek MT7531 PHY] (irq=POLL)
[    1.991166] mt7530 stmmac-0:00 lan2 (uninitialized): PHY [mt7530-0:03] driver [MediaTek MT7531 PHY] (irq=POLL)
[    2.042119] mt7530 stmmac-0:00 lan3 (uninitialized): PHY [mt7530-0:04] driver [MediaTek MT7531 PHY] (irq=POLL)
[    2.594275] mt7530 stmmac-0:00 wan: configuring for phy/gmii link mode
[    2.604647] mt7530 stmmac-0:00 lan0: configuring for phy/gmii link mode
[    2.619995] mt7530 stmmac-0:00 lan1: configuring for phy/gmii link mode
[    2.635667] mt7530 stmmac-0:00 lan2: configuring for phy/gmii link mode
[    2.653356] mt7530 stmmac-0:00 lan3: configuring for phy/gmii link mode
[  186.969595] mt7530 stmmac-0:00 lan1: Link is Up - 1Gbps/Full - flow control rx/tx
# 

basicly linked the mt753x_phc.c into the mt7530 dsa driver. not nice, but works so far. i plugged into second lan-port (tested the others too - except wan that is not connected they are right)

but have not yet traffic working over the switch…so there is still something missing. and i guess here i need some help

Imho i miss the vlan config

@wei.zuo @sinovoip can you tell me which port of mt7531 (p5 or p6) is connected to the gmac0 of rk3568? this is not clear to me and dsa driver seems to initialize only port 6

i do not know if port 5 is initialized…mt7530 part has note that only p6 is initialized, but p5 is changed below it…for mt7531 this part is completely missing. as the gmac only supports rgmii and switch seems to support this only on p5 (p6 sgmii only) i guess gmac0 is connected to p5…after some debug it looks like only port5 is enabled (succesfully in rgmii-mode), not port 6…based on my devicetree

seems i got it working with help of landen chao. CPU-Port in dsa driver was hardcoded to port 6…added a way to use devicetree for this setting

Hi @frank-w how you make it work? We have also board with RTL8367, which firmware we should use? Thanks…

I was told only mt7531 variant is sold. Here i fixed in mainline (6.0-rc1 has fixes in). There is only a speed-issue we are working on (wip patch),maybe fixed by some patches in daniels bpi-r3 staging tree (do similar as the wip for r2pro).

Realtek variant had no dsa driver,but now has. But i have not tested it after this got mainlined. Prepared a dual dts way in 5.18-main afair where you can try. Be aware of iodomains (different between these 2) if you have such variant.

Do not boot (mainline) dts for mt7531 if you really have a realtek switch!

Thanks for your answer.

My next question are,

1- R2 Pro has no ethernet transformer on both version previous(RTL8367) and current(mt7531) one. Why is that?

2- Another thing that I don’t understand is why there is need for driver? Is that about connecting switch through RGMII port?

3- And can we get expected speed from RTL8367? I could not make it work. Which image should I use to make RTL8367 work.

  1. what do you mean with ethernet-transformer? a phy? wan-port has a realtek phy and switch has a internal phy

  2. each hardware-part needs a driver. soc needs multiple drivers (power,clock,pinctrl, perpherals like spi/i2c, …), ethernet-gmacs, the realtek-phy, the switch,…independly on how they are connected…the connection is described mostly in devicetree

  3. there is imho no ready-to-use image as this version was not in sale…only for developers if you really have such board you can add dts like here and use this (tree also contains the reduced rtl8367 phy driver, maybe the dsa too):

driver for rtl8367 switch is already in mainline when you use 5.19

drivers/net/dsa/realtek/rtl8365mb.c

only need to enable it, maybe compatible needs to be changed.

Ethernet usually uses 1:1 transformers for isolation: Impulstransformatoren_TG110_TopBottom_C (Source: https://en.wikipedia.org/wiki/File:Impulstransformatoren_TG110_TopBottom_C.jpg)

Sometimes those happen to be built-into the RJ-45 sockets.

This is what I want to say. Does RTL8367 has internal Transformers?

i don’t think as they are coils (which imho cannot be inside ICs)

Okey, so they do not use it. When I checked Switch schematic with RTL8367 almost all has Coil (transformer) so, I wonder if not using is good or not. Thank’s for your answers @frank-w

I talked with BPI, RJ45 ports has internal coils. They said.

1 Like

Hi Frank. I’m making a switch using RTL8367RB to be able to connect to a controller. I’ve tried once and it doesn’t work. As I searched through the Internet, I found some schematics which are different to each other and I want to know how to connect other pins of the IC except RJ45s. can you please guide me and give me the schematic and PCB documents which you got result? I wanna use it as a source of my PCB. Thanks a lot. [email protected]

You should ask @sinovoip as i am not allowed to publish shematics. I only worked on software-support. The switch chip is now supported by mainline code (tested series in upstreaming process). Maybe sinovoip allows me to share parts of shematic…

Hello, Why on BPI-R2 Pro there is RTL8211F-CG PHY connected onto GMAC1 and acting as WAN port? Since there is also switch chip MT7615BE (2x RGMII+5PHYs) connected onto GMAC0 of RK3568 plus and only 4 PHY ports are used as LAN. Is it possible to use just switch MT7615BE with all 5 PHYs where one will be for WAN and 4 for LAN?

Imho this design is better for router design to ensure lan-wan separation. But maybe you can bridge eth1 with lan-ports to ensure what you want. Wan-port is not connected to switch. And mt7531 has only 1 (p5) cpu-port supporting rgmii. P6 can do only sgmii

I am working on designing similar hardware/PCB based on BPI-R2. Is it possible to have 1x RGMII connection to MT7531, and 4x LAN + 1x WAN on 5 available PHYs? Or I need to search for other switch chip which is having 2x RGMII + 5x PHYs and connect both RGMIIs to RK3568?

You could use something like MAX24287 Parallel-to-Serial MII converter IC to interface port 6 (SGMII) of the MT7531 to RGMII of the RK3568 in a better way…

Problem is that rk3586 has only 2x rgmii. So he will only get 1gbit/s. Or you drop 1 of the naneng (2xusb3,1xsata) phys and use them to get hsgmii. But i have not tried it only see that this is possble somehow

You can use only 1 gmac for switch and use 5 ports (afair p5 can also be used as user-port, then you have 6 ports on switch). But all ports sharing a 1gbit lane to soc…imho rk3568 is not useable as router,only if someone get hsgmii working…which needs one naneng (then you have only 1 usb+1 sata or 2 usb3).

ok thanks a lot. if it is possible, I want to have your email to ask some questions which are completely ruined my plan for device. Can I have it?