Managing custom switch board

Hi,
I have a custom board based on a stm32mp257fak3 with an ethernet switch rtl8367s. I’m trying to make openwrt to use the switch ports, but I’m stuck. The kernel detects the switch and the ports, and even detetcts the connection and disconnection of the ethernet cables, but I’m not capable of seen traffic in the ports.

My configuration is the next one: I have the interface eth0 of the stm32 connected to a rtl8211f as an independant port, and the interface eth1 connected to the rtl8367s. The eth0 works perfectly.

The images that i have linked show how the device detetects the ports, and i don’t know how to configure it to use them as independant ports.

And this is the configuration in the /etc/config/networkThank you in advance for the help.Best regards.

config interface 'loopback'
option device 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'

config globals 'globals'
option ula_prefix 'fdfc:2136:14e7::/48'

config device
option name 'br-lan'
option type 'bridge'
list ports 'eth0'

config interface 'lan'
option device 'br-lan'
option proto 'static'
option ipaddr '192.168.1.1'
option netmask '255.255.255.0'
option ip6assign '60'

config interface 'wan'
option device 'eth1'
option proto 'dhcp'

config interface 'wan6'
option device 'eth1'
option proto 'dhcpv6'

Thank you in advance for your help.
Best regards

which openwrt version is this, please post ubus call system board output.

Hi, this is the output

ubus call system board
{
"kernel": "6.6.86",
"hostname": "OpenWrt",
"system": "ARMv8 Processor rev 0",
"model": "GradDeck by Gradhoc",
"board_name": "st,stm32mp257f-ev1",
"rootfs_type": "ext4",
"release": {
"distribution": "OpenWrt",
"version": "24.10.1",
"revision": "r28597-0425664679",
"target": "stm32/stm32mp2",
"description": "OpenWrt 24.10.1 r28597-0425664679",
"builddate": "1744562312"
}
}

it won't help you, but if you're planning on getting it officially supported, you'll need to build against the main branch (snapshots), currently using kernel 6.12.

okay, i will take a look.
Thank you.

If eth1 is connected to the switch (as the cpu port), then this should be one of the switch ports. e.g. lan1. Or a bridge containing these ports.

Thank you for the response.
So, how is the network archive should look like to implement this solution?

from your description and screenshots (showing lan1@eth1) I was expecting to see the dedicated port as WAN and the then LAN ports on the switch as br-lan.

Let me cross reference this post over at the STM community which appears to have a newer DTS of your board.

Similar like how it is configured for many routers out of the box

ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan"

Source: https://github.com/openwrt/openwrt/blob/main/target/linux/ipq40xx/base-files/etc/board.d/02_network#L75

/etc/config/network would contain these changes:

config device
        option name 'br-lan'
        option type 'bridge'
        list ports 'lan1' # lan1-3 instead of eth0
        list ports 'lan2'
        list ports 'lan3'

config interface 'lan'
        option device 'br-lan'
        option proto 'static'
        option ipaddr '192.168.1.1'
        option netmask '255.255.255.0'
        option ip6assign '60'

config interface 'wan'
        option device 'eth0' # eth0 instead of eth1
        option proto 'dhcp'

config interface 'wan6'
        option device '@wan'
        option proto 'dhcpv6'

Can you post your current dts-file?

Which driver do you use? I’m not sure that dsa driver support latest rtl8367s chip. But old (swconfig) driver rtl8367b contain support for rtl8367s chips since 24.10 realese.

Hi, i tried to apply the changes in the network archive, but it didn’t work. Here i let the logs that i get when i apply the chages.

root@OpenWrt:~# /etc/init.d/network restart
[ 97.563615] stm32-dwmac 482c0000.eth1 eth0: FPE workqueue stop
[ 98.064536] stm32-dwmac 482c0000.eth1 eth0: Timeout accessing MAC_VLAN_Tag_Filter
[ 98.066517] stm32-dwmac 482c0000.eth1 eth0: failed to kill vid 0081/0
root@OpenWrt:~# [ 99.719124] stm32-dwmac 482d0000.eth2 eth1: Register MEM_TYPE_PAGE_POOL RxQ-0
[ 99.721155] stm32-dwmac 482d0000.eth2 eth1: Register MEM_TYPE_PAGE_POOL RxQ-1
[ 99.741325] dwmac4: Master AXI performs any burst length
[ 99.741416] stm32-dwmac 482d0000.eth2 eth1: No Safety Features support found
[ 99.950551] stm32-dwmac 482d0000.eth2 eth1: IEEE 1588-2008 Advanced Timestamp supported
[ 99.953206] stm32-dwmac 482d0000.eth2 eth1: registered PTP clock
[ 99.959211] stm32-dwmac 482d0000.eth2 eth1: FPE workqueue start
[ 99.964991] stm32-dwmac 482d0000.eth2 eth1: configuring for fixed/rgmii-id link mode
[ 99.972975] 8021q: adding VLAN 0 to HW filter on device eth1
[ 99.978500] stm32-dwmac 482d0000.eth2 eth1: Link is Up - 1Gbps/Full - flow control rx/tx
[ 99.983010] realtek-smi switch@0 lan1: configuring for phy/gmii link mode
[ 99.993974] 8021q: adding VLAN 0 to HW filter on device lan1
[ 99.999217] br-lan: port 1(lan1) entered blocking state
[ 100.004317] br-lan: port 1(lan1) entered disabled state
[ 100.009404] realtek-smi switch@0 lan1: entered allmulticast mode
[ 100.015496] stm32-dwmac 482d0000.eth2 eth1: entered allmulticast mode
[ 100.071324] realtek-smi switch@0 lan1: failed to initialize vlan filtering on this port
[ 100.074537] realtek-smi switch@0 lan1: left allmulticast mode
[ 100.079486] stm32-dwmac 482d0000.eth2 eth1: left allmulticast mode
[ 100.086133] br-lan: port 1(lan1) entered blocking state
[ 100.090991] br-lan: port 1(lan1) entered disabled state
[ 100.096174] realtek-smi switch@0 lan1: entered allmulticast mode
[ 100.102230] stm32-dwmac 482d0000.eth2 eth1: entered allmulticast mode
[ 100.141288] realtek-smi switch@0 lan1: failed to initialize vlan filtering on this port
[ 100.144473] realtek-smi switch@0 lan1: left allmulticast mode
[ 100.149522] stm32-dwmac 482d0000.eth2 eth1: left allmulticast mode
[ 100.156036] br-lan: port 1(lan1) entered blocking state
[ 100.160893] br-lan: port 1(lan1) entered disabled state
[ 100.166176] realtek-smi switch@0 lan1: entered allmulticast mode
[ 100.172149] stm32-dwmac 482d0000.eth2 eth1: entered allmulticast mode
[ 100.211287] realtek-smi switch@0 lan1: failed to initialize vlan filtering on this port
[ 100.214467] realtek-smi switch@0 lan1: left allmulticast mode
[ 100.219516] stm32-dwmac 482d0000.eth2 eth1: left allmulticast mode
[ 100.226780] stm32-dwmac 482d0000.eth2 eth1: Link is Down
[ 100.232718] stm32-dwmac 482d0000.eth2 eth1: FPE workqueue stop
[ 100.710186] stm32-dwmac 482d0000.eth2 eth1: Register MEM_TYPE_PAGE_POOL RxQ-0
[ 100.712980] stm32-dwmac 482d0000.eth2 eth1: Register MEM_TYPE_PAGE_POOL RxQ-1
[ 100.729782] dwmac4: Master AXI performs any burst length
[ 100.729867] stm32-dwmac 482d0000.eth2 eth1: No Safety Features support found
[ 100.939199] stm32-dwmac 482d0000.eth2 eth1: IEEE 1588-2008 Advanced Timestamp supported
[ 100.941854] stm32-dwmac 482d0000.eth2 eth1: registered PTP clock
[ 100.947774] stm32-dwmac 482d0000.eth2 eth1: FPE workqueue start
[ 100.953653] stm32-dwmac 482d0000.eth2 eth1: configuring for fixed/rgmii-id link mode
[ 100.961364] stm32-dwmac 482d0000.eth2 eth1: Link is Up - 1Gbps/Full - flow control rx/tx
[ 100.969828] 8021q: adding VLAN 0 to HW filter on device eth1
[ 100.979510] realtek-smi switch@0 lan2: configuring for phy/gmii link mode
[ 100.982548] 8021q: adding VLAN 0 to HW filter on device lan2
[ 100.987893] br-lan: port 1(lan2) entered blocking state
[ 100.992780] br-lan: port 1(lan2) entered disabled state
[ 100.998057] realtek-smi switch@0 lan2: entered allmulticast mode
[ 101.004141] stm32-dwmac 482d0000.eth2 eth1: entered allmulticast mode
[ 101.061811] realtek-smi switch@0 lan2: failed to initialize vlan filtering on this port
[ 101.064474] realtek-smi switch@0 lan2: left allmulticast mode
[ 101.070022] stm32-dwmac 482d0000.eth2 eth1: left allmulticast mode
[ 101.076548] br-lan: port 1(lan2) entered blocking state
[ 101.081424] br-lan: port 1(lan2) entered disabled state
[ 101.086686] realtek-smi switch@0 lan2: entered allmulticast mode
[ 101.092647] stm32-dwmac 482d0000.eth2 eth1: entered allmulticast mode
[ 101.111932] realtek-smi switch@0 lan2: failed to initialize vlan filtering on this port
[ 101.114584] realtek-smi switch@0 lan2: left allmulticast mode
[ 101.120136] stm32-dwmac 482d0000.eth2 eth1: left allmulticast mode
[ 101.127208] br-lan: port 1(lan2) entered blocking state
[ 101.131580] br-lan: port 1(lan2) entered disabled state
[ 101.136743] realtek-smi switch@0 lan2: entered allmulticast mode
[ 101.142806] stm32-dwmac 482d0000.eth2 eth1: entered allmulticast mode
[ 101.211285] realtek-smi switch@0 lan2: failed to initialize vlan filtering on this port
[ 101.214462] realtek-smi switch@0 lan2: left allmulticast mode
[ 101.219510] stm32-dwmac 482d0000.eth2 eth1: left allmulticast mode
[ 101.226692] stm32-dwmac 482d0000.eth2 eth1: Link is Down
[ 101.233306] stm32-dwmac 482d0000.eth2 eth1: FPE workqueue stop
[ 101.769436] stm32-dwmac 482d0000.eth2 eth1: Register MEM_TYPE_PAGE_POOL RxQ-0
[ 101.772210] stm32-dwmac 482d0000.eth2 eth1: Register MEM_TYPE_PAGE_POOL RxQ-1
[ 101.789704] dwmac4: Master AXI performs any burst length
[ 101.789801] stm32-dwmac 482d0000.eth2 eth1: No Safety Features support found
[ 102.000389] stm32-dwmac 482d0000.eth2 eth1: IEEE 1588-2008 Advanced Timestamp supported
[ 102.003043] stm32-dwmac 482d0000.eth2 eth1: registered PTP clock
[ 102.009065] stm32-dwmac 482d0000.eth2 eth1: FPE workqueue start
[ 102.014841] stm32-dwmac 482d0000.eth2 eth1: configuring for fixed/rgmii-id link mode
[ 102.022759] stm32-dwmac 482d0000.eth2 eth1: Link is Up - 1Gbps/Full - flow control rx/tx
[ 102.030681] 8021q: adding VLAN 0 to HW filter on device eth1
[ 102.040933] realtek-smi switch@0 lan3: configuring for phy/gmii link mode
[ 102.046095] 8021q: adding VLAN 0 to HW filter on device lan3
[ 102.049094] br-lan: port 1(lan3) entered blocking state
[ 102.054068] br-lan: port 1(lan3) entered disabled state
[ 102.059231] realtek-smi switch@0 lan3: entered allmulticast mode
[ 102.065299] stm32-dwmac 482d0000.eth2 eth1: entered allmulticast mode
[ 102.101288] realtek-smi switch@0 lan3: failed to initialize vlan filtering on this port
[ 102.103985] realtek-smi switch@0 lan3: left allmulticast mode
[ 102.109433] stm32-dwmac 482d0000.eth2 eth1: left allmulticast mode
[ 102.116045] br-lan: port 1(lan3) entered blocking state
[ 102.120900] br-lan: port 1(lan3) entered disabled state
[ 102.126180] realtek-smi switch@0 lan3: entered allmulticast mode
[ 102.132138] stm32-dwmac 482d0000.eth2 eth1: entered allmulticast mode
[ 102.171290] realtek-smi switch@0 lan3: failed to initialize vlan filtering on this port
[ 102.174064] realtek-smi switch@0 lan3: left allmulticast mode
[ 102.179518] stm32-dwmac 482d0000.eth2 eth1: left allmulticast mode
[ 102.186020] br-lan: port 1(lan3) entered blocking state
[ 102.190871] br-lan: port 1(lan3) entered disabled state
[ 102.196159] realtek-smi switch@0 lan3: entered allmulticast mode
[ 102.202119] stm32-dwmac 482d0000.eth2 eth1: entered allmulticast mode
[ 102.281283] realtek-smi switch@0 lan3: failed to initialize vlan filtering on this port
[ 102.284056] realtek-smi switch@0 lan3: left allmulticast mode
[ 102.289509] stm32-dwmac 482d0000.eth2 eth1: left allmulticast mode
[ 102.296915] stm32-dwmac 482d0000.eth2 eth1: Link is Down
[ 102.302985] stm32-dwmac 482d0000.eth2 eth1: FPE workqueue stop
[ 102.879792] stm32-dwmac 482c0000.eth1 eth0: Register MEM_TYPE_PAGE_POOL RxQ-0
[ 102.882551] stm32-dwmac 482c0000.eth1 eth0: Register MEM_TYPE_PAGE_POOL RxQ-1
[ 103.151288] stm32-dwmac 482c0000.eth1 eth0: PHY [stmmac-0:05] driver [RTL8211F Gigabit Ethernet] (irq=POLL)
[ 103.161401] dwmac4: Master AXI performs any burst length
[ 103.161455] stm32-dwmac 482c0000.eth1 eth0: No Safety Features support found
[ 103.370461] stm32-dwmac 482c0000.eth1 eth0: IEEE 1588-2008 Advanced Timestamp supported
[ 103.373090] stm32-dwmac 482c0000.eth1 eth0: registered PTP clock
[ 103.379513] stm32-dwmac 482c0000.eth1 eth0: FPE workqueue start
[ 103.384896] stm32-dwmac 482c0000.eth1 eth0: configuring for phy/rgmii-id link mode
[ 103.431470] 8021q: adding VLAN 0 to HW filter on device eth0

Hi, i post here the dts archive. I’m certanly using the dsa driver, but i think that’s neccesary for using the switch? Am I right?

// SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-3-Clause)
/dts-v1/;
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/leds/common.h>
#include <dt-bindings/regulator/st,stm32mp25-regulator.h>
#include <dt-bindings/interrupt-controller/irq.h>
#include "stm32mp257.dtsi"
#include "stm32mp25xf.dtsi"
#include "stm32mp25-pinctrl.dtsi"
#include "stm32mp25xxak-pinctrl.dtsi"
#include "stm32mp257f-ev1-ca35tdcid-resmem.dtsi"
 
/ {
    model = "GradDeck by Gradhoc";
    compatible = "st,stm32mp257f-ev1", "st,stm32mp257";
 
    aliases {
        ethernet0 = &eth1;
        ethernet1 = &eth2;
        serial0 = &uart5;
    };
 
    chosen {
        stdout-path = "serial0:115200n8";
    };
 
    memory@80000000 {
        device_type = "memory";
        reg = <0x0 0x80000000 0x1 0x0>;
    };
 
    /* Switch RTL8367S usando interfaz SMI */
    switch1: switch@0 {
        compatible = "realtek,rtl8365mb";
        /* SMI interface - bit-banging usando GPIOs */
        mdc-gpios = <&gpioc 6 GPIO_ACTIVE_HIGH>;
        mdio-gpios = <&gpioc 5 GPIO_ACTIVE_HIGH>;
        reset-gpios = <&gpioa 2 GPIO_ACTIVE_LOW>;
        reset-assert-us = <50000>;
        reset-deassert-us = <300000>;
 
        /* MDIO interno para los PHYs integrados del switch */
        mdio {
            compatible = "realtek,smi-mdio";
            #address-cells = <1>;
            #size-cells = <0>;
            phy0: ethernet-phy@0 {
                reg = <0>;
            };
            phy1: ethernet-phy@1 {
                reg = <1>;
            };
            phy2: ethernet-phy@2 {
                reg = <2>;
            };
        };
 
        ports {
            #address-cells = <1>;
            #size-cells = <0>;
 
            port@0 {
                reg = <0>;
                label = "lan1";
                phy-handle = <&phy0>;
            };
            port@1 {
                reg = <1>;
                label = "lan2";
                phy-handle = <&phy1>;
            };
            port@2 {
                reg = <2>;
                label = "lan3";
                phy-handle = <&phy2>;
            };
            port@7 {
                reg = <7>;
                label = "cpu";
                ethernet = <&eth2>;
                phy-mode = "rgmii-id";
                fixed-link {
                    speed = <1000>;
                    full-duplex;
                    pause;
                };
            };
        };
    };
};
 
&a35ss_syscfg {
    status = "okay";
};
 
&arm_wdt {
    timeout-sec = <32>;
    status = "okay";
};
 
&combophy {
    clocks = <&rcc CK_BUS_USB3PCIEPHY>, <&rcc CK_KER_USB3PCIEPHY>;
    clock-names = "apb-clk", "ker-clk";
    st,rx_equalizer = <1>;
    status = "okay";
};
 
&crc {
    status = "disabled";
};
 
&cryp1 {
    status = "disabled";
};
 
/* ETH1 - WAN con PHY RTL8211F */
&eth1 {
    status = "okay";
    pinctrl-0 = <&eth1_mdio_pins_mx>, <&eth1_rgmii_pins_mx>;
    pinctrl-1 = <&eth1_mdio_sleep_pins_mx>, <&eth1_rgmii_sleep_pins_mx>;
    pinctrl-names = "default", "sleep";
    phy-mode = "rgmii-id";
    max-speed = <1000>;
    phy-handle = <&phy1_eth1>;
    st,ext-phyclk;
 
    mdio1 {
        #address-cells = <1>;
        #size-cells = <0>;
        compatible = "snps,dwmac-mdio";
 
        phy1_eth1: ethernet-phy@5 {
            compatible = "ethernet-phy-id001c.c916";
            reg = <5>;
            reset-gpios = <&gpiof 3 GPIO_ACTIVE_LOW>;
            reset-assert-us = <10000>;
            reset-deassert-us = <80000>;
            realtek,eee-disable;
        };
    };
};
 
&eth2 {
    status = "okay";
    pinctrl-0 = <&eth2_rgmii_pins_a>;
    pinctrl-1 = <&eth2_rgmii_sleep_pins_a>;
    pinctrl-names = "default", "sleep";
    /* Probar sin delays primero */
    phy-mode = "rgmii-id";
    max-speed = <1000>;
    st,ext-phyclk;
    st,eth-ptp-from-rcc;

    clock-names = "stmmaceth",
                  "mac-clk-tx",
                  "mac-clk-rx",
                  "ptp_ref",
                  "ethstp",
                  "eth-ck";
        clocks = <&rcc CK_ETH2_MAC>,
<&rcc CK_ETH2_TX>,
<&rcc CK_ETH2_RX>,
<&rcc CK_KER_ETH2PTP>,
<&rcc CK_ETH2_STP>,
<&rcc CK_KER_ETH2>;
    fixed-link {
        speed = <1000>;
        full-duplex;
        pause;
    };
};
 
&gpu {
    status = "okay";
};
 
&hpdma {
    memory-region = <&hpdma1_lli>;
};
 
&hpdma2 {
    memory-region = <&hpdma2_lli>;
};
 
&hpdma3 {
    memory-region = <&hpdma3_lli>;
};
 
&ipcc1 {
    status = "okay";
};
 
&ipcc2 {
    status = "okay";
};
 
&lptimer3 {
    status = "okay";
    timer {
        status = "okay";
    };
};
 
&pcie_rc {
    pinctrl-names = "default", "init", "sleep";
    pinctrl-0 = <&pcie_pins_a>;
    pinctrl-1 = <&pcie_init_pins_a>;
    pinctrl-2 = <&pcie_sleep_pins_a>;
    status = "okay";
};
 
&rtc {
    status = "okay";
};
 
&sdmmc2 {
    pinctrl-names = "default", "opendrain", "sleep";
    pinctrl-0 = <&sdmmc2_pins_mx>;
    pinctrl-1 = <&sdmmc2_opendrain_pins_mx>;
    pinctrl-2 = <&sdmmc2_sleep_pins_mx>;
    vmmc-supply = <&scmi_vdd_emmc>;
    vqmmc-supply = <&scmi_v1v8>;
    status = "okay";
};
 
&scmi_regu {
    scmi_vddio1: regulator@0 {
        regulator-min-microvolt = <1800000>;
        regulator-max-microvolt = <3300000>;
    };
    scmi_vddcore: regulator@b {
        reg = <VOLTD_SCMI_STPMIC2_BUCK2>;
        regulator-name = "vddcore";
    };
    scmi_v1v8: regulator@e {
        reg = <VOLTD_SCMI_STPMIC2_BUCK5>;
        regulator-name = "v1v8";
    };
    scmi_v3v3: regulator@10 {
        reg = <VOLTD_SCMI_STPMIC2_BUCK7>;
    regulator-name = "v3v3";

};

scmi_vdd_emmc: regulator@12 {

    reg = <VOLTD_SCMI_STPMIC2_LDO2>;

    regulator-name = "vdd_emmc";

};

scmi_vdd3v3_usb: regulator@14 {

    reg = <VOLTD_SCMI_STPMIC2_LDO4>;

    regulator-name = "vdd3v3_usb";

};

scmi_vdd_sdcard: regulator@17 {

    reg = <VOLTD_SCMI_STPMIC2_LDO7>;

    regulator-name = "vdd_sdcard";

};

};

&uart5 {

pinctrl-names = "default", "idle", "sleep";

pinctrl-0 = <&uart5_pins_mx>;

pinctrl-1 = <&uart5_idle_pins_mx>;

pinctrl-2 = <&uart5_sleep_pins_mx>;

status = "okay";

};

Before dsa (current default switch management) openwrt used its own swconfig switch management. Since release 24.10 swconfig driver rtl8367b supports rtl8367s realtek chips.

I’m not sure that dsa support these chip. At least there exist PR https://github.com/openwrt/openwrt/pull/19397 to add rtl8367s into dsa driver.

So you can try this patch or switch to old swconfig driver. I can help to configure swconfig.

Hi,
First of all thank you four your help.
I would like to try to use swconfig, at least to confirm that the switch is okay and in the future maybe change to dsa. So how i have to apply the swconfig in the dts for my device?

This are the results that i have with the realtek85mb dsa driver. I can bring up the ethernet switch lan port, but there is no traffic on it.

Before start swconfig tests check lan2 statistics. ifconfig show 15 rx packet. So it’s possible that dsa driver partially work (at least in switch to SoC direction). With tcpdump and ethtool you can gain more info.

And correct phy-mode = "rgmi-id"to phy-mode = "rgmii-txid”for dsa switch (don’t use rx delay for rtl8367s). rgmii rx delay may break connection in SoC to rtl8367s direction.

Hi i did what you said to me, now the switch part on my dts look like thislook like this

/ {
model = "GradDeck by Gradhoc";
compatible = "st,stm32mp257f-ev1", "st,stm32mp257";

aliases {
    ethernet0 = &eth1;
    ethernet1 = &eth2;
    serial0 = &uart5;
};
chosen {
    stdout-path = "serial0:115200n8";
};
memory@80000000 {
    device_type = "memory";
    reg = <0x0 0x80000000 0x1 0x0>;
};
/* Switch RTL8367S usando interfaz SMI */
switch1: switch@0 {
    compatible = "realtek,rtl8365mb";
    /* SMI interface - bit-banging usando GPIOs */
    mdc-gpios = <&gpioc 6 GPIO_ACTIVE_HIGH>;
    mdio-gpios = <&gpioc 5 GPIO_ACTIVE_HIGH>;
    reset-gpios = <&gpioa 2 GPIO_ACTIVE_LOW>;
    /* reset-assert-us = <50000>; */
    /* reset-deassert-us = <300000>; */

    /* MDIO interno para los PHYs integrados del switch */
    mdio {
        compatible = "realtek,smi-mdio";
        #address-cells = <1>;
        #size-cells = <0>;
        phy0: ethernet-phy@0 {
            reg = <0>;
        };
        phy1: ethernet-phy@1 {
            reg = <1>;
        };
        phy2: ethernet-phy@2 {
            reg = <2>;
        };
    };

    ports {
        #address-cells = <1>;
        #size-cells = <0>;

        port@0 {
            reg = <0>;
            label = "lan1";
            phy-handle = <&phy0>;
        };
        port@1 {
            reg = <1>;
            label = "lan2";
            phy-handle = <&phy1>;
        };
        port@2 {
            reg = <2>;
            label = "lan3";
            phy-handle = <&phy2>;
        };
        port@7 {
            reg = <7>;
            label = "cpu";
            ethernet = <&eth2>;
            phy-mode = "rgmii-txid";
            fixed-link {
                speed = <1000>;
                full-duplex;
                pause;
            };
        };
    };
};

};

&eth2 {
status = "okay";
pinctrl-0 = <&eth2_rgmii_pins_mx>;
pinctrl-1 = <&eth2_rgmii_sleep_pins_mx>;
pinctrl-names = "default", "sleep";
/* Probar sin delays primero */
phy-mode = "rgmii-txid";
max-speed = <1000>;
st,ext-phyclk;
st,eth-ptp-from-rcc;

clock-names = "stmmaceth",
              "mac-clk-tx",
              "mac-clk-rx",
              "ptp_ref",
              "ethstp",
              "eth-ck";
    clocks = <&rcc CK_ETH2_MAC>,

<&rcc CK_ETH2_TX>,
<&rcc CK_ETH2_RX>,
<&rcc CK_KER_ETH2PTP>,
<&rcc CK_ETH2_STP>,
<&rcc CK_KER_ETH2>;
fixed-link {
speed = <1000>;
full-duplex;
pause;
};
};

When i boot the device, the switch is detected and i can make a link up in the lan ports. Then i can see traffic going throught the ports, but the device is no capable of give an ip to the ports. Below thie i post the info of the boot, the ifconfig, and the network configuration file.

You configure lan2 as wan interface. Is it really connected to ISP or local client which want receive ip from you too? I think that for local test it’s better move device lan2 int br-lan switch and connect local client to lan2port.

Hi, eth0 is the interface which is using the controller rtl8211f. It’s an independent interface, apart form the switch. The interface that is really connected with the switch rtl8367s is eth1. No matter what i do, if i configure the br-lan with eth0 (fixed ip) and the switch as wan interface (receiving dhcp), or using br-lan with the switch, so the switch will have an static IP and not using eth0. I see the traffic in the ports of the switch but looks like the RX pin don’t transmit data with the switch. I’m also capable of detecting the connection and dssconnection of each port.
When I try to configure br-lan with any of the ports of the switch, the next error appears

Ok. I understand hardware topology.

Correct if I’m wrong.

When you add lan2 (or any other port of switch) to bridge device then in logs dsa config error arise and lan2 (or any other port) is turned into disable state.

For standalone lan2(configured as wan) there is not dsa config error, traffic flow in both direction but router can not receive ip address.

It concern both case (bridged an standalone lan2)? Logs correspond to which network config. It’s somtimes not clear.

Hi, here i post the logs with itself configuration

  1. Configuration and logs with the lan port 2 defined as wan. As i said erlaier, the port doesnt have an IP, but in the boot there is no error on the setup of port.

  1. Configuration and logs
    In this case, lan2 is a bridge device anda interface is created as br-lan2, now in the boot the lan shows an error and is disabled. And the same happens, i have traffic in the port, but nothing in the interface

I have no idea. So start swconfig configuration for tests.

  1. Change global config (make menuconfig)

    • enable SWCONFIG support, disable DSA;
    • add swconfig driver for rtl8366_smi and rtl8367b
    • add userspace config utility swconfig;
  2. Correct dts-file: replace dsa config node with data (based on your dts-file)
    rtl8367s {
    compatible = "realtek,rtl8367b";
    gpio-sck = <&gpioc 6 GPIO_ACTIVE_HIGH>;
    gpio-sda = <&gpioc 5 GPIO_ACTIVE_HIGH>;
    realtek,extif = <7 1 0 1 1 1 1 1 1 2>;
    };

    where realtek,extif = <7 1 0 1 1 1 1 1 1 2>; means (from left to right):
    cpu port (port 7 of switch is connected to SoC mac);
    txdelay (1 - enable);
    rxdelay (0 - disable;
    mode (1 - rgmii);
    force_mode (1 - force settings);
    txpause (1 - enable);
    rxpause (1 - enable);
    link (1 - force link);
    duplex (1 - enable);
    speed (2 - 1Gbit);

  3. Default network config may be corrected for device (base-files/etc/board.d/02_network).
    But for tests it's simpler assign lan/wan eth0/eth1.

After first boot you can see realtek chip identification in logs.

If no error we configure rtl8367s as simple as possible (join all ports together):

swconfig dev switch0 set reset 1
swconfig dev switch0 set enable_vlan 1
swconfig dev switch0 vlan 1 set ports '0 1 2 3 4 7'
swconfig dev switch0 set apply 1

If eth1 configured as wan you can try connect ISP cable to any switch port and get ip. This config will be lost after reboot. For test you can add into /etc/config/network to keep after reboot:

config switch
	option name switch0
	option reset 1
	option enable_vlan 1

config switch_vlan
	option device switch0
	option vlan 1
	option ports '0 1 2 3 4 7'