OpenWrt Forum Archive

Topic: Porting router with MT7620a + RTL8367RB

The content of this topic has been archived on 2 May 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hello!

Please help in writing correct device tree for Zyxel Keenetic Viva. I can't make external switch working.
As I know it has MT7620a SoC and ethernet switch RTL8367RB connected to 5-th port of internal switch MT7530.
It's managed with MDIO.

Currently I have this code for device tree.

/dts-v1/;

#include "mt7620a.dtsi"

/ {
    compatible = "ralink,mt7620a-eval-board", "ralink,mt7620a-soc";
    model = "ZyXEL Keenetic Viva";

    gpio-leds {
        compatible = "gpio-leds";

        power {
            label = "kng_rc:green:power";
            gpios = <&gpio0 14 1>;
        };

        power_alert {
            label = "kng_rc:red:power";
            gpios = <&gpio0 10 1>;
        };

        wan {
            label = "kng_rc:green:wan";
            gpios = <&gpio0 7 1>;
        };

        wifi {
            label = "kng_rc:green:wifi";
            gpios = <&gpio0 11 1>;
        };

        usb {
            label = "kng_rc:green:usb";
            gpios = <&gpio0 8 1>;
        };
    };

    gpio-keys-polled {
        compatible = "gpio-keys";
        #address-cells = <1>;
        #size-cells = <0>;
        poll-interval = <20>;

        reset {
            label = "reset";
            gpios = <&gpio0 1 1>;
            linux,code = <0x101>;
        };

        wps {
            label = "wps";
            gpios = <&gpio0 2 1>;
            linux,code = <0x100>;
        };

        fn {
            label = "fn";
            gpios = <&gpio0 9 1>;
            linux,code = <0x102>;
        };
    };

    rtl8367rb {
        compatible = "realtek,rtl8367b";
        realtek,extif0 = <1 0 1 1 1 1 1 1 2>;
        gpio-sck = <&gpio0 1 0>;
        gpio-sda = <&gpio0 2 0>;
    };
};

&spi0 {
    status = "okay";

    m25p80@0 {
        #address-cells = <1>;
        #size-cells = <1>;
        compatible = "jedec,spi-nor";
        reg = <0>;
        linux,modalias = "m25p80", "en25q64";
        spi-max-frequency = <10000000>;

        partition@0 {
            label = "u-boot";
            reg = <0x0 0x30000>;
            read-only;
        };

        partition@30000 {
            label = "u-boot-env";
            reg = <0x30000 0x10000>;
            read-only;
        };

        factory: partition@40000 {
            label = "factory";
            reg = <0x40000 0x10000>;
            read-only;
        };

        partition@50000 {
            label = "firmware";
            reg = <0x50000 0xda0000>;
        };

        partition@df0000 {
            label = "config";
            reg = <0xdf0000 0x10000>;
        };

        partition@e00000 {
            label = "storage";
            reg = <0xe00000 0x200000>;
        };

        backup@50000 {
            label = "backup";
            reg = <0x50000 0xfb0000>;
            read-only;
        };

        full@0 {
            label = "full";
            reg = <0x0 0x1000000>;
            read-only;
        };

    };
};

&pinctrl {
    state_default: pinctrl0 {
        gpio {
            ralink,group = "i2c", "uartf", "rgmii1", "rgmii2";
            ralink,function = "gpio";
        };
    };
};

&ethernet {
    status = "okay";
    pinctrl-names = "default";
    pinctrl-0 = <&rgmii1_pins &rgmii2_pins>;
    mtd-mac-address = <&factory 0x00004>;

    port@5 {
        status = "okay";
        mediatek,fixed-link = <1000 1 1 1>;
        phy-mode = "rgmii";
        phy-handle = <&phy5>;
    };

    mdio-bus {
        status = "okay";

        phy5: ethernet-phy@5 {
            reg = <5>;
            phy-mode = "rgmii";
        };
    };
};

&gsw {
    mediatek,port4 = "gmac";
};

&wmac {
    ralink,mtd-eeprom = <&factory 0>;
};

&sdhci {
    status = "okay";
};

&ehci {
    status = "okay";
};

&ohci {
    status = "okay";
};

&pcie {
    status = "disabled";
};
    ethernet@10100000 {
        status = "okay";
        mtd-mac-address = <&factory 0x4>;
        pinctrl-names = "default";
        pinctrl-0 = <&rgmii1_pins &rgmii2_pins &mdio_pins>;

        ...
elektroman wrote:
    ethernet@10100000 {
        status = "okay";
        mtd-mac-address = <&factory 0x4>;
        pinctrl-names = "default";
        pinctrl-0 = <&rgmii1_pins &rgmii2_pins &mdio_pins>;

        ...

still not working.

@yoq
Thanks for the hint for this ...
I actually stumbled across the same issue on my device Edimax BR-6478AC V2,
which was advertised in some wiki with a mt7530 switch and will not cooperate.
GBit links shwo up as 100MBit, after reading the SDK my device is also using this switch chip.

Well, so soon I'll begin to adapt driver present in current openwrt trunk to make it working with mdio.

Made working driver. Soon will publish.

13hakta wrote:

Made working driver. Soon will publish.


Hi, 13 hakta

Have any new update?

I have TRENDnet TEW-752DRU ,

TRENDnet TEW-752DRU
FCC ID: XU8TEW752DRU
wireless router    abgn   
MediaTek MT7620A @ 580 MHz    8 MiB    64 MiB   
MediaTek MT7620A 2x2:2, bgn   
Ralink RT5592EP 2x2:2, an Ant. conn: U.FL   
Realtek RTL8367RB    10/100/1000
4 LAN 1 WAN    USB 2.0    1 USB

Not one can make it work with openwrt, Please .help

Currently hosting code on github at 13hakta/source/tree/staging
One issue is remaining with determining exclusion for unattached port.

The discussion might have continued from here.