Help completing dts for ZyXEL WRE6505 (mt7620a + mt7610e)

Check the OEM firmware and see if the MAC address of the wireless is different than the Ethernet.

Switch config, when needed, is usually in 02_network

Bridge config, should be "auto-magical" once LAN is defined and wireless detection creates a template /etc/config/wireless

1 Like

Just pasted above: wireless + physical have the same MAC, in AP mode. In repeater mode I don't get a shell, and I think I don't get a phys link. Probably the 2.4GHz steals the show.

Figure 6 from the device PDF manual indicates that all 3 should work.

Yadda. 5G working. Just need to ensure you compile in the mt76x0e driver. ( make menuconfig -> kernel modules -> wireless drivers -> kmod-76x0e

DTS file addition:

&pcie0 {
        mt76@0,0 {
                reg = <0x0000 0 0 0 0>;
                mediatek,mtd-eeprom = <&factory 0x8000>;
                ieee80211-freq-limit = <5000000 6000000>;
                mtd-mac-address = <&factory 0x8004>;
                //mtd-mac-address-increment = <(-1)>;
        };
};

Kernel:

[    8.390577] mt76x0e 0000:01:00.0: card - bus=0x1, slot = 0x0 irq=4
[    8.403143] mt76x0e 0000:01:00.0: ASIC revision: 76100002
[    8.415481] mt76x0e 0000:01:00.0: Firmware Version: 0.1.00
[    8.512013] mt76x0e 0000:01:00.0: EEPROM ver:01 fae:00

then you can

root@OpenWrt:/# ifconfig wlan0 up

Standard /etc/config/wireless config will ensure config endures.

2 Likes

Not sure what that is (it might not exist in this case) - but I got the sources. Had a dig for everything that mentions GPIO stuff. It seems that all of the flashing LED things were done in some separate daemon/app. Not to mention for an older kernel.

I cannot seem to find a combination in the DTS file which doesn't produce something like:

[  136.754602] rt2880-pinmux pinctrl: pin 13 is not set to gpio mux
[  136.766647] rt2880-pinmux pinctrl: request() failed for pin 13
[  136.778303] rt2880-pinmux pinctrl: pin-13 (pio:13) status -22

DTS (probably got this wrong):

        keys {
                compatible = "gpio-keys-polled";
                poll-interval = <20>;

                //confirmed 0
                wps {
                        label = "wps";
                        gpios = <&gpio0 0 GPIO_ACTIVE_LOW>;
                        linux,code = <KEY_WPS_BUTTON>;
                };
                //there's the AP/repeater slide switch. Basically reboots the device.
        };

        leds {
                compatible = "gpio-leds";

                lan {
                        //ra ether 32-24;
                        label = "wre6505:green:lan";
                        gpios = <&gpio1 8 GPIO_ACTIVE_LOW>;
                };

                led_power: power {
                        label = "wre6505:green:power";
                        gpios = <&gpio1 7 GPIO_ACTIVE_LOW>;
                        //default-state = "keep";
                };

                //confirmed: 13
                wps {
                        label = "wre6505:blue:wps";
                        gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
                };
        };

        pinctrl {
                state_default: pinctrl0 {
                        gpio { //tried various combinations of this
                                //ralink,group = "i2c", "spi", "jtag", "mdio", "rgmii", "uartf";
                                ralink,group = "wled";
                                ralink,function = "gpio";
                        };
                        uartf {
                                ralink,group = "uartf";
                                ralink,function = "uartf";

                        };
                };
        };

help :confused:

Does the part compatible = "gpio-keys-polled"; mean that kmod-input-gpio-keys-polled should be built and loaded? If it is I just get log lines like:

[    8.692040] Error: Driver 'gpio-keys-polled' is already registered, aborting...

Try

        keys {
                compatible = "gpio-keys";
[...]
        };

Old-style kernel config, is a C file. See, for example

target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c7.c

Edit: Which, for that device, includes information like

#define ARCHER_C7_GPIO_LED_WLAN2G       12
#define ARCHER_C7_GPIO_LED_SYSTEM       14
#define ARCHER_C7_GPIO_LED_QSS          15
#define ARCHER_C7_GPIO_LED_WLAN5G       17
#define ARCHER_C7_GPIO_LED_USB1         18
#define ARCHER_C7_GPIO_LED_USB2         19

#define ARCHER_C7_GPIO_BTN_RFKILL       23
#define ARCHER_C7_V2_GPIO_BTN_RFKILL    23
#define ARCHER_C7_GPIO_BTN_RESET        16

#define ARCHER_C7_GPIO_USB1_POWER       22
#define ARCHER_C7_GPIO_USB2_POWER       21

#define ARCHER_C7_KEYS_POLL_INTERVAL    20      /* msecs */
#define ARCHER_C7_KEYS_DEBOUNCE_INTERVAL (3 * ARCHER_C7_KEYS_POLL_INTERVAL)

#define ARCHER_C7_WMAC_CALDATA_OFFSET   0x1000
#define ARCHER_C7_PCIE_CALDATA_OFFSET   0x5000
1 Like

Oh sweet. :slight_smile:
Altho the equivalent for ramips doesn't exist. Folder target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/ is fairly thin on the ground for mentions of gpio. But the patches folder.... hmm - this could be what I've been missing. I have no idea whether those patches have been applied at compile time or this is some sauce we add by hand. e.g.

target/linux/ramips/patches-4.14/0027-GPIO-MIPS-ralink-add-gpio-driver-for-ralink-SoC.patch

Edit: seems to be. Just not obvious :confused:

Those are patches that OpenWrt supplies, yes.

The mach file would be in the OEM source.

You have to look it up in MT7620 datasheet/programming guide to figure out a correct pinctrl setting

Yeah, I figured out that much by myself. I've been reading the data-sheet, and I understand what's there, but this doesn't help me with the specifics of how this board is built, and to which GPIOs the LEDs and buttons are connected... I'm under the impression that once you've specced the LEDs and their pins correctly in the DTS, OWRT takes care of the rest, right?

No mach file in the source, as I can see. :frowning: From what kernel version did the mach file syntax appear? The source was built against 2.6.

β€œmach” files are the old way, DTS is current

OK, after some DTS fun, all LEDs light up and flash, everything is working. Buttons don't seem to be a thing people want much... but when they do, they want them baaad. :smiley:

In case anyone else is interested to do something with this device, the relevant files should be here in my repo.. Special thanks to @jeff for the pointers.

One issue I don't think I ever managed to get past was having the original firmware accept an owrt compiled image for flashing. There was always something about the magic that I tried to insert that it did not like. I tried this to suit what I found in the original source. Maybe others with firmware magic experience have some good ideas?