[BPI-R2 pro] - Ethernet-switch

Hi,

based on the Wiki (Banana Pi BPI-R2 Pro - Banana Pi Wiki) the switch-chip is a RTL8367RB-VB-CG. this have no dsa-driver. but openwrt offers a phy-driver and i have one in my old 5.4-r64 branch…

is this chip replaced after some time with another like it was done for r64?

seems like openwrt uses much smaller driver than i had used on my old r64 branch…but i guess it depends on swconfig framework

is the driver only this file (maybe some includes)?

i see no Makefile/Kconfig including it…

added both drivers to branch 5.15-r2pro of my repo…old driver is still not compilable due to api changes, openwrt-driver compiles (currently active)

regards Frank

as current dts for rk3568 EVB board does not have ethernet-node, i copied the node from rk3368 (clock constants are unknown, as they have different names like ACLK_GMAC0/PCLK_GMAC0/…) and changed compatible, as driver seems to support it

drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c:1675:	{ .compatible = "rockchip,rk3568-gmac", .data = &rk3568_ops },

now i need to know if the switch is connected through mdio bus or via i2c (sda/scl linking of rtl8367)

Hello Frank, I was working with RTL8367RB and RK3328 last year, and i also asked for reference schematics here itself.

With the R2-Pro, my guesses would be that the RTL8367RB is connected via MDIO bus, and MAC-MAC RGMII fixed link to EXT1 interface of switch from GMAC of SoC.

The design part is tricky as GMAC requires RGMII reference clock of 125Mhz, else the interface can’t be brought up.

I have started here

https://github.com/frank-w/BPI-R2-4.14/commits/5.15-r2pro

Is ext1 cpu-port5?

This depends on the exact switch model used on the R2-Pro.

RTL8367 has a lot of variants, the one I was working on had RTL8367RB marked on the chip, but actually was the RTL8367C or SB (idk why realtek would do that)

The OpenWrt RTL8367RB drivers wasn’t able to recognize the switch,

rtl8367b rtl8367rb: unknown chip num:6367 ver:0020, mode:0020

but luckily RTL8367C was commonly used in routers like the Archer C5 v4, and there was an active PR(now closed): ramips: add support for TP-Link Archer C5 v4 by dengqf6 · Pull Request #2174 · openwrt/openwrt (github.com)

With the patch, swconfig found the switch and was able to view full switch statistics.

[    5.342680] rtl8367b rtl8367rb: switch phy addr=29
[    5.343128] rtl8367b rtl8367rb: using MDIO bus 'stmmac'
[    5.347581] rtl8367b rtl8367rb: RTL8367C chip found
[    6.367760] rtl8367b rtl8367rb: checking chip_num=0x6367 ver=0x20...
RTL8367C swconfig (expand)
root@OpenWrt:/# swconfig dev rtl8367rb show
Global attributes:
        enable_vlan: 1
        enable_vlan4k: 0
        max_length: 1
Port 0:
        mib: Port 0 MIB counters
ifInOctets                          : 0
dot3StatsFCSErrors                  : 0
dot3StatsSymbolErrors               : 0
dot3InPauseFrames                   : 0
dot3ControlInUnknownOpcodes         : 0
etherStatsFragments                 : 0
etherStatsJabbers                   : 0
ifInUcastPkts                       : 0
etherStatsDropEvents                : 0
ifInMulticastPkts                   : 0
ifInBroadcastPkts                   : 0
inMldChecksumError                  : 0
inIgmpChecksumError                 : 0
inMldSpecificQuery                  : 0
inMldGeneralQuery                   : 0
inIgmpSpecificQuery                 : 0
inIgmpGeneralQuery                  : 0
inMldLeaves                         : 0
inIgmpLeaves                        : 0
etherStatsOctets                    : 0
etherStatsUnderSizePkts             : 0
etherOversizeStats                  : 0
etherStatsPkts64Octets              : 0
etherStatsPkts65to127Octets         : 0
etherStatsPkts128to255Octets        : 0
etherStatsPkts256to511Octets        : 0
etherStatsPkts512to1023Octets       : 0
etherStatsPkts1024to1518Octets      : 0
ifOutOctets                         : 0
dot3StatsSingleCollisionFrames      : 0
dot3StatMultipleCollisionFrames     : 0
dot3sDeferredTransmissions          : 0
dot3StatsLateCollisions             : 0
etherStatsCollisions                : 0
dot3StatsExcessiveCollisions        : 0
dot3OutPauseFrames                  : 0
ifOutDiscards                       : 0
dot1dTpPortInDiscards               : 0
ifOutUcastPkts                      : 0
ifOutMulticastPkts                  : 0
ifOutBroadcastPkts                  : 0
outOampduPkts                       : 0
inOampduPkts                        : 0
inIgmpJoinsSuccess                  : 0
inIgmpJoinsFail                     : 0
inMldJoinsSuccess                   : 0
inMldJoinsFail                      : 0
inReportSuppressionDrop             : 0
inLeaveSuppressionDrop              : 0
outIgmpReports                      : 0
outIgmpLeaves                       : 0
outIgmpGeneralQuery                 : 0
outIgmpSpecificQuery                : 0
outMldReports                       : 0
outMldLeaves                        : 0
outMldGeneralQuery                  : 0
outMldSpecificQuery                 : 0
inKnownMulticastPkts                : 0

        pvid: 1
        link: port:0 link:down
Port 1:
        mib: Port 1 MIB counters
ifInOctets                          : 0
dot3StatsFCSErrors                  : 0
dot3StatsSymbolErrors               : 0
dot3InPauseFrames                   : 0
dot3ControlInUnknownOpcodes         : 0
etherStatsFragments                 : 0
etherStatsJabbers                   : 0
ifInUcastPkts                       : 0
etherStatsDropEvents                : 0
ifInMulticastPkts                   : 0
ifInBroadcastPkts                   : 0
inMldChecksumError                  : 0
inIgmpChecksumError                 : 0
inMldSpecificQuery                  : 0
inMldGeneralQuery                   : 0
inIgmpSpecificQuery                 : 0
inIgmpGeneralQuery                  : 0
inMldLeaves                         : 0
inIgmpLeaves                        : 0
etherStatsOctets                    : 0
etherStatsUnderSizePkts             : 0
etherOversizeStats                  : 0
etherStatsPkts64Octets              : 0
etherStatsPkts65to127Octets         : 0
etherStatsPkts128to255Octets        : 0
etherStatsPkts256to511Octets        : 0
etherStatsPkts512to1023Octets       : 0
etherStatsPkts1024to1518Octets      : 0
ifOutOctets                         : 0
dot3StatsSingleCollisionFrames      : 0
dot3StatMultipleCollisionFrames     : 0
dot3sDeferredTransmissions          : 0
dot3StatsLateCollisions             : 0
etherStatsCollisions                : 0
dot3StatsExcessiveCollisions        : 0
dot3OutPauseFrames                  : 0
ifOutDiscards                       : 0
dot1dTpPortInDiscards               : 0
ifOutUcastPkts                      : 0
ifOutMulticastPkts                  : 0
ifOutBroadcastPkts                  : 0
outOampduPkts                       : 0
inOampduPkts                        : 0
inIgmpJoinsSuccess                  : 0
inIgmpJoinsFail                     : 0
inMldJoinsSuccess                   : 0
inMldJoinsFail                      : 0
inReportSuppressionDrop             : 0
inLeaveSuppressionDrop              : 0
outIgmpReports                      : 0
outIgmpLeaves                       : 0
outIgmpGeneralQuery                 : 0
outIgmpSpecificQuery                : 0
outMldReports                       : 0
outMldLeaves                        : 0
outMldGeneralQuery                  : 0
outMldSpecificQuery                 : 0
inKnownMulticastPkts                : 0

        pvid: 2
        link: port:1 link:down
Port 2:
        mib: Port 2 MIB counters
ifInOctets                          : 0
dot3StatsFCSErrors                  : 0
dot3StatsSymbolErrors               : 0
dot3InPauseFrames                   : 0
dot3ControlInUnknownOpcodes         : 0
etherStatsFragments                 : 0
etherStatsJabbers                   : 0
ifInUcastPkts                       : 0
etherStatsDropEvents                : 0
ifInMulticastPkts                   : 0
ifInBroadcastPkts                   : 0
inMldChecksumError                  : 0
inIgmpChecksumError                 : 0
inMldSpecificQuery                  : 0
inMldGeneralQuery                   : 0
inIgmpSpecificQuery                 : 0
inIgmpGeneralQuery                  : 0
inMldLeaves                         : 0
inIgmpLeaves                        : 0
etherStatsOctets                    : 0
etherStatsUnderSizePkts             : 0
etherOversizeStats                  : 0
etherStatsPkts64Octets              : 0
etherStatsPkts65to127Octets         : 0
etherStatsPkts128to255Octets        : 0
etherStatsPkts256to511Octets        : 0
etherStatsPkts512to1023Octets       : 0
etherStatsPkts1024to1518Octets      : 0
ifOutOctets                         : 0
dot3StatsSingleCollisionFrames      : 0
dot3StatMultipleCollisionFrames     : 0
dot3sDeferredTransmissions          : 0
dot3StatsLateCollisions             : 0
etherStatsCollisions                : 0
dot3StatsExcessiveCollisions        : 0
dot3OutPauseFrames                  : 0
ifOutDiscards                       : 0
dot1dTpPortInDiscards               : 0
ifOutUcastPkts                      : 0
ifOutMulticastPkts                  : 0
ifOutBroadcastPkts                  : 0
outOampduPkts                       : 0
inOampduPkts                        : 0
inIgmpJoinsSuccess                  : 0
inIgmpJoinsFail                     : 0
inMldJoinsSuccess                   : 0
inMldJoinsFail                      : 0
inReportSuppressionDrop             : 0
inLeaveSuppressionDrop              : 0
outIgmpReports                      : 0
outIgmpLeaves                       : 0
outIgmpGeneralQuery                 : 0
outIgmpSpecificQuery                : 0
outMldReports                       : 0
outMldLeaves                        : 0
outMldGeneralQuery                  : 0
outMldSpecificQuery                 : 0
inKnownMulticastPkts                : 0

        pvid: 3
        link: port:2 link:down
Port 3:
        mib: Port 3 MIB counters
ifInOctets                          : 0
dot3StatsFCSErrors                  : 0
dot3StatsSymbolErrors               : 0
dot3InPauseFrames                   : 0
dot3ControlInUnknownOpcodes         : 0
etherStatsFragments                 : 0
etherStatsJabbers                   : 0
ifInUcastPkts                       : 0
etherStatsDropEvents                : 0
ifInMulticastPkts                   : 0
ifInBroadcastPkts                   : 0
inMldChecksumError                  : 0
inIgmpChecksumError                 : 0
inMldSpecificQuery                  : 0
inMldGeneralQuery                   : 0
inIgmpSpecificQuery                 : 0
inIgmpGeneralQuery                  : 0
inMldLeaves                         : 0
inIgmpLeaves                        : 0
etherStatsOctets                    : 0
etherStatsUnderSizePkts             : 0
etherOversizeStats                  : 0
etherStatsPkts64Octets              : 0
etherStatsPkts65to127Octets         : 0
etherStatsPkts128to255Octets        : 0
etherStatsPkts256to511Octets        : 0
etherStatsPkts512to1023Octets       : 0
etherStatsPkts1024to1518Octets      : 0
ifOutOctets                         : 0
dot3StatsSingleCollisionFrames      : 0
dot3StatMultipleCollisionFrames     : 0
dot3sDeferredTransmissions          : 0
dot3StatsLateCollisions             : 0
etherStatsCollisions                : 0
dot3StatsExcessiveCollisions        : 0
dot3OutPauseFrames                  : 0
ifOutDiscards                       : 0
dot1dTpPortInDiscards               : 0
ifOutUcastPkts                      : 0
ifOutMulticastPkts                  : 0
ifOutBroadcastPkts                  : 0
outOampduPkts                       : 0
inOampduPkts                        : 0
inIgmpJoinsSuccess                  : 0
inIgmpJoinsFail                     : 0
inMldJoinsSuccess                   : 0
inMldJoinsFail                      : 0
inReportSuppressionDrop             : 0
inLeaveSuppressionDrop              : 0
outIgmpReports                      : 0
outIgmpLeaves                       : 0
outIgmpGeneralQuery                 : 0
outIgmpSpecificQuery                : 0
outMldReports                       : 0
outMldLeaves                        : 0
outMldGeneralQuery                  : 0
outMldSpecificQuery                 : 0
inKnownMulticastPkts                : 0

        pvid: 4
        link: port:3 link:down
Port 4:
        mib: Port 4 MIB counters
ifInOctets                          : 0
dot3StatsFCSErrors                  : 0
dot3StatsSymbolErrors               : 0
dot3InPauseFrames                   : 0
dot3ControlInUnknownOpcodes         : 0
etherStatsFragments                 : 0
etherStatsJabbers                   : 0
ifInUcastPkts                       : 0
etherStatsDropEvents                : 0
ifInMulticastPkts                   : 0
ifInBroadcastPkts                   : 0
inMldChecksumError                  : 0
inIgmpChecksumError                 : 0
inMldSpecificQuery                  : 0
inMldGeneralQuery                   : 0
inIgmpSpecificQuery                 : 0
inIgmpGeneralQuery                  : 0
inMldLeaves                         : 0
inIgmpLeaves                        : 0
etherStatsOctets                    : 0
etherStatsUnderSizePkts             : 0
etherOversizeStats                  : 0
etherStatsPkts64Octets              : 0
etherStatsPkts65to127Octets         : 0
etherStatsPkts128to255Octets        : 0
etherStatsPkts256to511Octets        : 0
etherStatsPkts512to1023Octets       : 0
etherStatsPkts1024to1518Octets      : 0
ifOutOctets                         : 0
dot3StatsSingleCollisionFrames      : 0
dot3StatMultipleCollisionFrames     : 0
dot3sDeferredTransmissions          : 0
dot3StatsLateCollisions             : 0
etherStatsCollisions                : 0
dot3StatsExcessiveCollisions        : 0
dot3OutPauseFrames                  : 0
ifOutDiscards                       : 0
dot1dTpPortInDiscards               : 0
ifOutUcastPkts                      : 0
ifOutMulticastPkts                  : 0
ifOutBroadcastPkts                  : 0
outOampduPkts                       : 0
inOampduPkts                        : 0
inIgmpJoinsSuccess                  : 0
inIgmpJoinsFail                     : 0
inMldJoinsSuccess                   : 0
inMldJoinsFail                      : 0
inReportSuppressionDrop             : 0
inLeaveSuppressionDrop              : 0
outIgmpReports                      : 0
outIgmpLeaves                       : 0
outIgmpGeneralQuery                 : 0
outIgmpSpecificQuery                : 0
outMldReports                       : 0
outMldLeaves                        : 0
outMldGeneralQuery                  : 0
outMldSpecificQuery                 : 0
inKnownMulticastPkts                : 0

        pvid: 5
        link: port:4 link:down
Port 5:
        mib: Port 5 MIB counters
ifInOctets                          : 0
dot3StatsFCSErrors                  : 0
dot3StatsSymbolErrors               : 0
dot3InPauseFrames                   : 0
dot3ControlInUnknownOpcodes         : 0
etherStatsFragments                 : 0
etherStatsJabbers                   : 0
ifInUcastPkts                       : 0
etherStatsDropEvents                : 0
ifInMulticastPkts                   : 0
ifInBroadcastPkts                   : 0
inMldChecksumError                  : 0
inIgmpChecksumError                 : 0
inMldSpecificQuery                  : 0
inMldGeneralQuery                   : 0
inIgmpSpecificQuery                 : 0
inIgmpGeneralQuery                  : 0
inMldLeaves                         : 0
inIgmpLeaves                        : 0
etherStatsOctets                    : 0
etherStatsUnderSizePkts             : 0
etherOversizeStats                  : 0
etherStatsPkts64Octets              : 0
etherStatsPkts65to127Octets         : 0
etherStatsPkts128to255Octets        : 0
etherStatsPkts256to511Octets        : 0
etherStatsPkts512to1023Octets       : 0
etherStatsPkts1024to1518Octets      : 0
ifOutOctets                         : 0
dot3StatsSingleCollisionFrames      : 0
dot3StatMultipleCollisionFrames     : 0
dot3sDeferredTransmissions          : 0
dot3StatsLateCollisions             : 0
etherStatsCollisions                : 0
dot3StatsExcessiveCollisions        : 0
dot3OutPauseFrames                  : 0
ifOutDiscards                       : 0
dot1dTpPortInDiscards               : 0
ifOutUcastPkts                      : 0
ifOutMulticastPkts                  : 0
ifOutBroadcastPkts                  : 0
outOampduPkts                       : 0
inOampduPkts                        : 0
inIgmpJoinsSuccess                  : 0
inIgmpJoinsFail                     : 0
inMldJoinsSuccess                   : 0
inMldJoinsFail                      : 0
inReportSuppressionDrop             : 0
inLeaveSuppressionDrop              : 0
outIgmpReports                      : 0
outIgmpLeaves                       : 0
outIgmpGeneralQuery                 : 0
outIgmpSpecificQuery                : 0
outMldReports                       : 0
outMldLeaves                        : 0
outMldGeneralQuery                  : 0
outMldSpecificQuery                 : 0
inKnownMulticastPkts                : 0

        pvid: 6
        link: port:5 link:down
Port 6:
        mib: Port 6 MIB counters
ifInOctets                          : 0
dot3StatsFCSErrors                  : 0
dot3StatsSymbolErrors               : 0
dot3InPauseFrames                   : 0
dot3ControlInUnknownOpcodes         : 0
etherStatsFragments                 : 0
etherStatsJabbers                   : 0
ifInUcastPkts                       : 0
etherStatsDropEvents                : 0
ifInMulticastPkts                   : 0
ifInBroadcastPkts                   : 0
inMldChecksumError                  : 0
inIgmpChecksumError                 : 0
inMldSpecificQuery                  : 0
inMldGeneralQuery                   : 0
inIgmpSpecificQuery                 : 0
inIgmpGeneralQuery                  : 0
inMldLeaves                         : 0
inIgmpLeaves                        : 0
etherStatsOctets                    : 0
etherStatsUnderSizePkts             : 0
etherOversizeStats                  : 0
etherStatsPkts64Octets              : 0
etherStatsPkts65to127Octets         : 0
etherStatsPkts128to255Octets        : 0
etherStatsPkts256to511Octets        : 0
etherStatsPkts512to1023Octets       : 0
etherStatsPkts1024to1518Octets      : 0
ifOutOctets                         : 0
dot3StatsSingleCollisionFrames      : 0
dot3StatMultipleCollisionFrames     : 0
dot3sDeferredTransmissions          : 0
dot3StatsLateCollisions             : 0
etherStatsCollisions                : 0
dot3StatsExcessiveCollisions        : 0
dot3OutPauseFrames                  : 0
ifOutDiscards                       : 0
dot1dTpPortInDiscards               : 0
ifOutUcastPkts                      : 0
ifOutMulticastPkts                  : 0
ifOutBroadcastPkts                  : 0
outOampduPkts                       : 0
inOampduPkts                        : 0
inIgmpJoinsSuccess                  : 0
inIgmpJoinsFail                     : 0
inMldJoinsSuccess                   : 0
inMldJoinsFail                      : 0
inReportSuppressionDrop             : 0
inLeaveSuppressionDrop              : 0
outIgmpReports                      : 0
outIgmpLeaves                       : 0
outIgmpGeneralQuery                 : 0
outIgmpSpecificQuery                : 0
outMldReports                       : 0
outMldLeaves                        : 0
outMldGeneralQuery                  : 0
outMldSpecificQuery                 : 0
inKnownMulticastPkts                : 0

        pvid: 7
        link: port:6 link:down
Port 7:
        mib: Port 7 MIB counters
ifInOctets                          : 0
dot3StatsFCSErrors                  : 0
dot3StatsSymbolErrors               : 0
dot3InPauseFrames                   : 0
dot3ControlInUnknownOpcodes         : 0
etherStatsFragments                 : 0
etherStatsJabbers                   : 0
ifInUcastPkts                       : 0
etherStatsDropEvents                : 0
ifInMulticastPkts                   : 0
ifInBroadcastPkts                   : 0
inMldChecksumError                  : 0
inIgmpChecksumError                 : 0
inMldSpecificQuery                  : 0
inMldGeneralQuery                   : 0
inIgmpSpecificQuery                 : 0
inIgmpGeneralQuery                  : 0
inMldLeaves                         : 0
inIgmpLeaves                        : 0
etherStatsOctets                    : 0
etherStatsUnderSizePkts             : 0
etherOversizeStats                  : 0
etherStatsPkts64Octets              : 0
etherStatsPkts65to127Octets         : 0
etherStatsPkts128to255Octets        : 0
etherStatsPkts256to511Octets        : 0
etherStatsPkts512to1023Octets       : 0
etherStatsPkts1024to1518Octets      : 0
ifOutOctets                         : 0
dot3StatsSingleCollisionFrames      : 0
dot3StatMultipleCollisionFrames     : 0
dot3sDeferredTransmissions          : 0
dot3StatsLateCollisions             : 0
etherStatsCollisions                : 0
dot3StatsExcessiveCollisions        : 0
dot3OutPauseFrames                  : 0
ifOutDiscards                       : 0
dot1dTpPortInDiscards               : 0
ifOutUcastPkts                      : 0
ifOutMulticastPkts                  : 0
ifOutBroadcastPkts                  : 0
outOampduPkts                       : 0
inOampduPkts                        : 0
inIgmpJoinsSuccess                  : 0
inIgmpJoinsFail                     : 0
inMldJoinsSuccess                   : 0
inMldJoinsFail                      : 0
inReportSuppressionDrop             : 0
inLeaveSuppressionDrop              : 0
outIgmpReports                      : 0
outIgmpLeaves                       : 0
outIgmpGeneralQuery                 : 0
outIgmpSpecificQuery                : 0
outMldReports                       : 0
outMldLeaves                        : 0
outMldGeneralQuery                  : 0
outMldSpecificQuery                 : 0
inKnownMulticastPkts                : 0

        pvid: 8
        link: port:7 link:up speed:1000baseT full-duplex txflow rxflow
VLAN 1:
        info: VLAN 1: Ports: '07', members=0081, untag=0081, fid=0
        ports: 0 7
VLAN 2:
        info: VLAN 2: Ports: '17', members=0082, untag=0082, fid=0
        ports: 1 7
VLAN 3:
        info: VLAN 3: Ports: '27', members=0084, untag=0084, fid=0
        ports: 2 7
VLAN 4:
        info: VLAN 4: Ports: '37', members=0088, untag=0088, fid=0
        ports: 3 7
VLAN 5:
        info: VLAN 5: Ports: '47', members=0090, untag=0090, fid=0
        ports: 4 7
VLAN 6:
        info: VLAN 6: Ports: '57', members=00a0, untag=00a0, fid=0
        ports: 5 7
VLAN 7:
        info: VLAN 7: Ports: '67', members=00c0, untag=00c0, fid=0
        ports: 6 7
VLAN 8:
        info: VLAN 8: Ports: '01234567', members=00ff, untag=00ff, fid=0
        ports: 0 1 2 3 4 5 6 7
1 Like

I copied the file rtl8367b and its depencies to my repo…so i hope RTL8367RB-VB-CG is supported by this. If this does not work i can try the driver i’ve used on bpi-r64 (but this still needs some changes to be compilable in 5.15)

i don’t know swconfig tool much (only its name) and cannot compile it outside of openwrt (tried some years ago). basicly it should have a fixed config for debian/ubuntu (wan to eth1,lanX to eth0)

IMHO bringing up the RTL8367 won’t be an issue. although, getting a fixed-link at GMAC to EXT interface of switch will require some modifications to stmmac drivers.

Maybe @sinovoip could comment on this.

@frank-w Can you give a try with this repo: jekader/swconfig: project to package the swconfig utility from OpenWRT for Debian and derivatives (github.com)

is there any uboot-driver? or work to get dsa-support in linux?

regarding swconfig…i’m not sure i tried this repo, but i need crossompile-support and imho this failed on depencies (libnl) and passing the kernel-dir

got it “cross”-compiled with an debian chroot (used distro buster and arch arm64 i already created) in ubuntu

buildchroot.sh (1,2 KB) build_swconfig.sh (611 Bytes) switch.h (2,5 KB)

#first change distro and arch in buildchroot.sh and add execute-bit for both scripts 
./buildchroot.sh
rootdir=debian_buster_arm64/
sudo cp build_swconfig.sh $rootdir/root/
sudo mkdir -p $rootdir/usr/include/linux
sudo cp switch.h $rootdir/usr/include/linux/
sudo chroot $rootdir /root/build_swconfig.sh

…mhm…looks like the binary file was not added to deb file…

$ dpkg -c ${rootdir}usr/src/swconfig_15.04-1_arm64.deb
drwxr-xr-x root/root         0 2015-04-04 21:49 ./
drwxr-xr-x root/root         0 2015-04-04 21:49 ./usr/
drwxr-xr-x root/root         0 2015-04-04 21:49 ./usr/share/
drwxr-xr-x root/root         0 2015-04-04 21:49 ./usr/share/doc/
drwxr-xr-x root/root         0 2015-04-04 21:49 ./usr/share/doc/swconfig/
-rw-r--r-- root/root       147 2015-04-04 21:49 ./usr/share/doc/swconfig/changelog.Debian.gz
-rw-r--r-- root/root       391 2015-04-04 21:49 ./usr/share/doc/swconfig/copyright

seems like perl called by lintian is failed due to missing procfs…

Cannot open /proc/109668/fd, falling back to generic method - No such file or directory at /usr/share/perl5/IO/Async/OS/linux.pm line 38.

so i did this:

sudo mount -o bind /proc $rootdir/proc

now the error disappear, but still no binary in deb…but i see binary in usr/src/swconfig with actual timestamp and i can call it inside the chroot, so i append it here…no need for debian-package for now

/usr/src/swconfig# ./swconfig 
swconfig list
swconfig dev <dev> [port <port>|vlan <vlan>] (help|set <key> <value>|get <key>|load <config>|show)

swconfig (76,2 KB)

1 Like

Openwrt tries to recognize chip model by software version:

Seems it is impossible to get the chip_id,you can try add your chip_ver to the switch above

Currently i look if we can transform openwrt phy driver above into an dsa driver. One problem is to find out mdio-gpio which is needed by realtek smi driver

I hope i get sample soon to check if at least phy driver is working or to look what to modify

@lionwang @zuowei8 can you tell me which chipnum (data) is recognized on r2pro?

On r64 v0.1 i got 0x6367 here

i saw you setup 2 rgmii gmacs instead of 1 sgmii (like r64), but except of this driver looks similar

case 0x0276:
case 0x0597:
case 0x6367:
    *pSwitchChip = CHIP_RTL8367C;
    halCtrl = &rtl8367c_hal_Ctrl;
    break;
1 Like

RTL8367RB

1 Like

Thank you,can you tell me if switch will be replaced by mt753x or similar (as it was done on r64 v0.x)? I see there is no switch driver in uboot yet,so netboot will not be possible

btw. what does this mean:

 PLEASE CHECK BOARD GPIO POWER DOMAIN CONFIGURATION !!!!!
 <<< ESPECIALLY Wi-Fi/Flash/Ethernet IO power domain >>> !!!!!
 Check Node [pmu_io_domains] in the file: /media/data_nvme/git/kernel/BPI-R2PRO-BSP/kernel/arch/arm64/boot/dts/rockchip/rk3568-bpi-r2pro-pc.dts 

 请再次确认板级的电源域配置!!!!!!
 <<< 特别是Wi-Fi,FLASH,以太网这几路IO电源的配置 >>> !!!!!
 检查内核文件 /media/data_nvme/git/kernel/BPI-R2PRO-BSP/kernel/arch/arm64/boot/dts/rockchip/rk3568-bpi-r2pro-pc.dts 的节点 [pmu_io_domains] 


pmuio1-supply 
regulator-min-microvolt =  3300mV
regulator-max-microvolt =  3300mV


pmuio2-supply 
regulator-min-microvolt =  3300mV
regulator-max-microvolt =  3300mV


vccio1-supply 
regulator-min-microvolt =  3300mV
regulator-max-microvolt =  3300mV


vccio3-supply 
regulator-min-microvolt =  1800mV
regulator-max-microvolt =  3300mV

vccio4-supply 
regulator-min-microvolt =  1800mV
regulator-max-microvolt =  1800mV

to check it, i need to know which values are right :wink: or are the printed values the right ones? Did not found pmu-domain in this dts

i found it, defined in rk3568.dtsi and overridden/extended in rk3568-bpi-r2pro-core.dtsi

pmugrf: syscon@fdc20000 {
	compatible = "rockchip,rk3568-pmugrf", "syscon", "simple-mfd";
	reg = <0x0 0xfdc20000 0x0 0x10000>;

	pmu_io_domains: io-domains {
		compatible = "rockchip,rk3568-pmu-io-voltage-domain";
		status = "disabled";
	};

		vccio_acodec: LDO_REG4 {
			regulator-always-on;
			regulator-boot-on;
			regulator-min-microvolt = <3300000>;
			regulator-max-microvolt = <3300000>;
			regulator-name = "vccio_acodec";
			regulator-state-mem {
				regulator-off-in-suspend;
			};
		};

		vccio_sd: LDO_REG5 {
			regulator-always-on;
			regulator-boot-on;
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <3300000>;
			regulator-name = "vccio_sd";
			regulator-state-mem {
				regulator-off-in-suspend;
			};
		};

&pmu_io_domains {
	status = "okay";
	pmuio1-supply = <&vcc3v3_pmu>;
	pmuio2-supply = <&vcc3v3_pmu>;
	vccio1-supply = <&vccio_acodec>;
	vccio3-supply = <&vccio_sd>;
	vccio4-supply = <&vcc_1v8>;
	vccio5-supply = <&vcc_3v3>;
	vccio6-supply = <&vcc_3v3>;
	vccio7-supply = <&vcc_3v3>;
};

seems to match the values printed

maybe someone from bpi team can help me transforming the rtl8367 phy-driver to a dsa driver…i have stripped needed functions from the codebase (100k => 3.5k lines) to get a smaller driver. but i hang on mdio-bus needed for dsa (for accessing the phy)…don’t understand the concept behind acces from dsa core to the switch phy (imho driver should setup the switch not the dsa core, maybe some translation is required).

@wei.zuo can you tell me whats different in network compared to evb? I can boot mainline (5.16-rc4) with my dts (evb with changed iodomain and switch node added),but ethernet driver reports it cannot connect to phy

Just for info: mainline uboot (2022-01-rc) with patch for fip-creation is bootable,but cannot boot kernel. Confirmed by Peter. So i use peters uboot and boot Image+dtb with extlinux.conf (currently with his initrd and reduced quartz64 defconfig)

Just for info: there is a patch for rtl8367c dsa.

https://patchwork.kernel.org/project/netdevbpf/patch/[email protected]/

Our chipid 0x6367 seems to be supported. Currently i hang on getting gmac/mdio up on soc-side (with reduced phy driver) but then we can test the dsa driver. currently it’s hard to apply it because it depends on net-next with many other patches before.

If anybody can figure out,how to define the dts (linking to mdio, interface mode) we can test it.

1 Like

I have added the dsa driver in 5.16-r2pro-dsa tree,and do some tests woth old r64,but it seems that mdio is not working right…i always get 0x0 as chip id and so initialization is not done

Maybe anyone has an idea whats missing/wrong? Maybe the reset is needed,but driver does not support it yet

with a reset of switch using the gpio definition from phy-driver, i get dsa-driver running partially on my r64 v0.1…switch is initialized and dsa-ports are shown in “ip a”…after changing names the seem to be functional…but i cannot get the gmac to run (no traffic), in phy-driver it uses EXTPORT0 as gmac0 (sgmii-port in r64v0.1 i have changed to rgmii/1000Mbit/s already, dsa driver only supports only rgmii). this is mapped to internal number 16, need to look how this is used and compare to dsa driver where a dts-property “realtek,ext-int” (defined as 0-2, so i used 0) is used like it seems…but i’m unsure if i need to change “reg” too

in dsa driver these values are used:

#define RTL8367C_EXT_RGMXF_REG0		0x1306 /*EXT0*/
#define RTL8367C_EXT_RGMXF_REG1		0x1307 /*EXT1*/
#define RTL8367C_EXT_RGMXF_REG2		0x13C5 /*EXT2*/
#define RTL8367C_EXT_RGMXF_REG(_extint) \
		(_extint==0 ? RTL8367C_EXT_RGMXF_REG0 : \
		 _extint==1 ? RTL8367C_EXT_RGMXF_REG1 : \
		 _extint==2 ? RTL8367C_EXT_RGMXF_REG2 : \
		 0x0)

in phy driver this is used:

if(port == EXT_PORT0)
    regAddr = RTL8367C_REG_EXT1_RGMXF; //0x1307
else if(port == EXT_PORT1)
    regAddr = RTL8367C_REG_EXT2_RGMXF;

so imho i need to set it to dts property to 1 :thinking: but this alone is not enough

merged the phy driver from bpi to my tree and got switch+gmac up

# dmesg | grep -i switch
[    1.644853] DEBUG: Passed rtk_switch_init 1382 
[    1.645160] DEBUG: Passed rtk_switch_probe 742 
[    1.648553] DEBUG: Passed rtk_switch_probe 747 
[    1.651954] DEBUG: Passed rtk_switch_probe 751 
[    1.655351] DEBUG: Passed rtk_switch_probe 755 
[    1.658731] DEBUG: Passed rtk_switch_probe 759 data:0x6367
[    1.659137] DEBUG: Passed rtk_switch_probe 790 
[    1.659431] DEBUG: Passed rtk_switch_init 1388 0
[    1.659729] DEBUG: Passed rtk_switch_init 1398 
[    1.660018] DEBUG: Passed _rtk_switch_init_8367c 363 
[    1.663463] DEBUG: Passed _rtk_switch_init_8367c 367 
[    1.666878] DEBUG: Passed _rtk_switch_init_8367c 371 
[    1.670332] DEBUG: Passed _rtk_switch_init_8367c 375 
[    3.151267] BPI-R2PRO RK3568's RTL8367RB Switch Init Successfully !!!

# dmesg | grep -i eth0
[    4.552516] rk_gmac-dwmac fe010000.ethernet eth0: Register MEM_TYPE_PAGE_POOL RxQ-0
[    4.554334] rk_gmac-dwmac fe010000.ethernet eth0: No Safety Features support found
[    4.554925] rk_gmac-dwmac fe010000.ethernet eth0: IEEE 1588-2008 Advanced Timestamp supported
[    4.555997] rk_gmac-dwmac fe010000.ethernet eth0: registered PTP clock
[    4.557108] rk_gmac-dwmac fe010000.ethernet eth0: configuring for fixed/rgmii link mode
[    4.558259] rk_gmac-dwmac fe010000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx

but it seems they come not together (no traffic), rx_pkt_n is zero whereas tx_pkt_n is 51 after some pings (using “lan0” port, first lan next to wan)

@wei.zuo any idea? btw. i wonder why switch driver setup 2 gmacs but wan-port seems not going over switch (is already working in my mainline linux without working switch)

Edit: problem is portmap…as wan is directly connected i dropped portmap property in dts. Now the last port (port4,not connected) get the vlan config for “wan”…now all 4 lan-ports working with full phy driver. And after changing mdio phy-id (r64 used 29,r2pro uses 0) in my reduced driver it works too :slight_smile:

edit 2: my reduced phy driver has now a dts property to set the phy-id, works on both devices without touching driver code. got dsa driver on r64 working by using second gmac (already rgmii), maybe first gmac/switchport does not support rgmii. wait for next version and merge this then to r2pro and test there

1 Like

FYI: With some minor problems (strange ip assignment, flapping unconnected interfaces) i got the dsa driver posted to mainline working on my r2pro. It will not be merged to 5.17 but maybe 5.18.

It is a very basic driver that does not support internal switching (all traffic goes to cpu), no hw offload and rgmii only.

1 Like