[BPI-R64] (dsa-) switch-driver

Hi

After getting 4.19 booting on r64 i’m searching driver for switch-chip (rtl8367s). Currently i see 1 eth,but cannot use any of the ports. Switch seems not powered on.

I googled around,found only drivers for kernel 3.x and other 8367x (not s). 4.19+ contains dsa driver for 8366 here,but i found no ref to 8367…maybe its compatible or not…

Mhm, documentation also lists 8367 (without “s”), but in realtek-smi.c there is only rtl8366s+rb. for testing i need to know at least gpio-binding.

Also found phy-driver (don’t know kernel-version) on lede-repo https://github.com/lede-project/source/blob/master/target/linux/generic/files/drivers/net/phy/rtl8367.c https://github.com/lede-project/source/blob/master/target/linux/generic/files/include/linux/rtl8367.h

i guess i need both…phy-driver uses rtl8366_smi

can anybody help me here?

For official 4.4 this seems to be the driver:

@jackzeng Am i right? Btw. Please remove cmd and o files from public repo :slight_smile:

Regards Frank

got ethernet working with Patches from https://github.com/objelf/linux/commits/linux-4.19.y-mediatek

currently mapping is wrong (wan+lan0-2 over eth0 and lan3 over eth1), only if anybody uses my r64 branch

i guess it’s defined here:

currently i do not full understand the code and do not know which port is wan and which is lan3 to swap these 2 ports. maybe i can change it by the parameter want_at_p0…this changes where PORT0 and PORT4 are mapped into vlan (vlan1 = EXT_PORT0, vlan2= EXT_PORT1)

seems to be triggered here:

this seems to look if in “rtkgsw”-node the property “mediatek,port_map” is set to “wllll” and call rtl8367s_vlan_config(1); else with 0 dts and dtsi have no such property…so i assume it’s called with 0 (second “rtl8367s_vlan_config(0);” in preprocessor-condition-else)…i will try to add this option

seems to fix the wan/lan3-swap :wink:

btw. can you give me an example how i can define vlans on this board? imho it should be possible with swconfig, but i need params (port-numbering). maybe i can bet this via “swconfig show”

swconfig should support rtl8367 (https://oldwiki.archive.openwrt.org/doc/techref/swconfig)

tried to install it, but there seem no package in debian, found sourcecode, but it is not compilable (missing linux/switch.h that does also not exist in kernel 4.4)

hi,

i’m trying to get ethernet-driver working on 5.1 (for testing rene van dorsts phylink-modification), compiles good, ethernet-devices are shown, but no traffic over both gmacs…

any idea?

https://github.com/frank-w/BPI-R2-4.14/tree/5.1-r64-rc

i found no errors in dmesg

[    0.798817] sean debug physpeed = 2500                                                                                                            
[    0.825439] libphy: mdio: probed                                                                                                                  
[    0.828788] mtk_soc_eth 1b100000.ethernet: generated random MAC address 4a:df:27:e2:7e:cf                                                         
[    0.837544] mtk_soc_eth 1b100000.ethernet: setup gmac1 going through sgmii                                                                        
[    0.844693] mtk_soc_eth 1b100000.ethernet: connected mac 0 to PHY at fixed-0:00 [uid=00000000, driver=Generic PHY]                                
[    0.855664] mtk_soc_eth 1b100000.ethernet eth0: mediatek frame engine at 0xffffff8010ae0000, irq 128                                              
[    0.865105] mtk_soc_eth 1b100000.ethernet: generated random MAC address 4a:f6:08:25:ea:d5                                                         
[    0.873789] mtk_soc_eth 1b100000.ethernet: connected mac 1 to PHY at fixed-0:01 [uid=00000000, driver=Generic PHY]                                
[    0.884724] mtk_soc_eth 1b100000.ethernet eth1: mediatek frame engine at 0xffffff8010ae0000, irq 128

also leds on rj45-jack are flashing so i guess switch-chip is also initialized…switch itself seems to create no message on dmesg…also not on working 4.19

but i miss the “up-messages” in dmesg…ok these are also not there in 4.19.20 where eth works…

full dmesg: r64-5.1-boot.txt (34,7 KB)

root@bpi-r64:~# ip a                                                                                                                                 
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000                                                          
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00                                                                                            
    inet 127.0.0.1/8 scope host lo                                                                                                                   
       valid_lft forever preferred_lft forever                                                                                                       
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000                                                
    link/ether 4a:df:27:e2:7e:cf brd ff:ff:ff:ff:ff:ff                                                                                               
    inet 192.168.0.18/24 scope global eth0                                                                                                           
       valid_lft forever preferred_lft forever                                                                                                       
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000                                                
    link/ether 4a:f6:08:25:ea:d5 brd ff:ff:ff:ff:ff:ff

testing lan-ports first (lan0-port), these should be on eth0

it seems that 5.0-rc4 is also broken…currently i try to build 4.20, but this seems not starting…i see only ATF-info. compared dts and config, still see no problem

reading bananapi/bpi-r64/linux/dtb/4.20.0-r64.dtb                               
23325 bytes read in 8 ms (2.8 MiB/s)                                            
reading bananapi/bpi-r64/linux/uImage_4.20.0-r64                                
8763464 bytes read in 359 ms (23.3 MiB/s)                                       
bootm flag=0, states=70f                                                        
## Booting kernel from Legacy Image at 44000000 ...                             
   Image Name:   Linux Kernel 4.20.0-r64                                        
   Image Type:   ARM Linux Kernel Image (uncompressed)                          
   Data Size:    8763400 Bytes = 8.4 MiB                                        
   Load Address: 40080000                                                       
   Entry Point:  40080000                                                       
   Verifying Checksum ... OK                                                    
## Flattened Device Tree blob at 47000000                                       
   Booting using the fdt blob at 0x47000000                                     
   Loading Kernel Image ... OK                                                  
   Loading Device Tree to 5cf02000, end 5cf0ab1c ... OK                         
                                                                                
Starting kernel ...                                                             
                                                                                
[ATF][     5.697896]save kernel info                                            
[ATF][     5.701097]Kernel_EL2                                                  
[ATF][     5.703854]Kernel is 64Bit                                             
[ATF][     5.707042]pc=0x40080000, r0=0x5cf02000, r1=0x0                        
INFO:    BL3-1: Preparing for EL3 exit to normal world, Kernel                  
INFO:    BL3-1: Next image address = 0x40080000                                 
INFO:    BL3-1: Next image spsr = 0x3c9                                         
[ATF][     5.725308]el3_exit

and then nothing happens…i let the dts(i) from 4.20 and only copied build.sh and defconfig…

problem seems to be the kernel-image because i used the 4.20 dtb with another kernelimage and it boots…if i use 4.20 kernelimage with newer/older dtb it does not start

ethernet-issue on r64 with kernel 5.x is fixed

if i make massive traffic (~3Gbit) on the switch to r64, i have massive retransmits. tried to fix by setting speed of sgmii fixed link to 2500 instead of 1000 has no effect

throughput on lan is ~1 Gbit/s

with phylink i have ~1,5 Gbit/s with near 0 retransmits

any idea?

The driver in openwrt uses devm_gpio_free and that is removed with 6.0 https://github.com/torvalds/linux/commit/2b038e786f8338a3bc22d791000753e0ec113e00 :confused:

do you have an r64 with the rtl-chip? current board uses mt7531 switch which has dsa-driver in mainline…also the rtl chip has a dsa-driver in mainline so you do not need any additional driver when using at least 5.18

Can you link me to some information? :wink: OpenWrt uses 5.15 however, it will now switch to 6.1 in the future.

Edit: Okay here https://github.com/torvalds/linux/commit/c288575f7810a51fb0517b9ba8fef2f6e5d551c4

mt7531 support is till 5.10 afair. rtl8367 was later…depends on your switch-chip…this thread was about the rtl-chip in first r64