Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mediatek: filogic: add ZyXEL EX5700 (Telenor) support #12276

Merged
merged 3 commits into from Aug 19, 2023

Conversation

bmork
Copy link
Contributor

@bmork bmork commented Mar 28, 2023

Add support for the Telenor branded version of the ZyXEL EX5700. This comes with a modified U-Boot requiring device specific workarounds.

@github-actions github-actions bot added build/scripts/tools pull request/issues for build, scripts and tools related changes core packages pull request/issue for core (in-tree) packages kernel pull request/issue with Linux kernel related changes target/mediatek pull request/issue for mediatek target labels Mar 28, 2023
dangowrt referenced this pull request in lynxis/openwrt Apr 13, 2023
@aiamadeus
Copy link
Contributor

aiamadeus commented Apr 25, 2023

Hi, the "mediatek,eth-mac label" patch has been rejected in #11435.

Hardware
RAM: 1GB DDR3

Should it be 1GB DDR4 here?

@bmork
Copy link
Contributor Author

bmork commented Apr 25, 2023

Hi, the "mediatek,eth-mac label" patch has been rejected in #11435.

Thanks for the info. Makes absolutely no sense given that the patch already is in OpenWrt.... But in principle, I agree with the idea behind it - follow upstream as closely as possible.

AFAICS, "label" is documented in Documentation/devicetree/bindings/net/ethernet-controller.yaml and implemented in at least the DSA subsystem. Allowing that, which could just as well have been done in userspace, but rejecting it for other mac drivers is inconsistent.

I'll remove this patch here, and replace it with some hacky userspace solution.

Thinking about trying upstream again. Too bad it's hard (impossible?) to implement this in some common infrastructure. Looks like it has to be done in every driver?

Hardware
RAM: 1GB DDR3

Should it be 1GB DDR4 here?

Probably. Will fix.

Thanks for the review

@csharper2005
Copy link
Contributor

WIFI:  Mediatek MT7986 802.11ax 5 GHz
       Mediatek MT7916 DBDC 802.11ax 2.4 + 6 GHz

Megadevice. 0_o

target/linux/mediatek/image/filogic.mk Outdated Show resolved Hide resolved
target/linux/mediatek/image/filogic.mk Outdated Show resolved Hide resolved
target/linux/mediatek/dts/mt7986a-zyxel-ex5700-telenor.dts Outdated Show resolved Hide resolved
scripts/mkits.sh Outdated Show resolved Hide resolved
@bmork
Copy link
Contributor Author

bmork commented May 19, 2023

Pushed an updated branch with all comments handled. Changes:

  • rebased to current master
  • fixed RAM description
  • ethernet driver label patch replaced by userspace solution
  • dropped unneccessary device vars
  • dropped "cpu" label from dts

@github-actions github-actions bot removed the kernel pull request/issue with Linux kernel related changes label May 19, 2023
@bmork bmork force-pushed the ex5700 branch 2 times, most recently from 525da81 to c6d1380 Compare May 23, 2023 12:57
@bmork
Copy link
Contributor Author

bmork commented May 23, 2023

rebased onto master, resolving the conflicts caused by the recently added EX5600 sister device

@bmork
Copy link
Contributor Author

bmork commented Jun 5, 2023

updated to account for commit 7a0ec00 ("mediatek: sync MT7986 device trees with upstream") and rebased onto current main

@bmork
Copy link
Contributor Author

bmork commented Jul 7, 2023

  • rebased onto main after the mediatek v6.1 kernel support was merged
  • fixed up a number of checkpatch whitespace warnings
  • run-tested with both v5.15 and v6.1 kernels

@github-actions github-actions bot removed the build/scripts/tools pull request/issues for build, scripts and tools related changes label Jul 9, 2023
@bmork
Copy link
Contributor Author

bmork commented Jul 9, 2023

Yet another rebase on main, dropping the mkits patch which was merged as commit 2b133ab ("scripts: use sep-char for hash nodes")

@bmork
Copy link
Contributor Author

bmork commented Aug 10, 2023

rebased to resolve conflicts after the NWA50AX Pro addition

The vendor U-Boot implementaion on Telenor branded ZyXEL EX5700
devices does not store its environment on flash. It is instead
kept in a memory region.  This is persistent over reboots, but
not over power cycling.

The dual partition failsafe system used by the vendor U-Boot
requires the OS to modify a variable in this memory environment.
This driver allows the ordinary uboot-envtools to access a
memory region like it was a partition on NOR flash.

The specific vendor U-Boot adds a "no-map" /reserved-memory
section and a top level /ubootenv node pointing to the memory
environment.  The driver uses this device specific fact to
locate the region.  The matching and probing code will likely
have to be adjusted for any other devices to be supported.

Example partial device tree:

 / {
    ..
    ubootenv {
        memory-region = <&uenv>;
        compatible = "ubootenv";
    };
    ..
    reserved-memory {
        ..
        uenv: ubootenv@7ffe8000 {
            no-map;
            reg = <0 0x7ffe8000 0 0x4000>;
        };

Signed-off-by: Bjørn Mork <bjorn@mork.no>
Implement the functionality of
target/linux/ramips/patches-5.15/700-net-ethernet-mediatek-support-net-labels.patch
in userspace, since the driver patch has been rejected as a generic solution:
openwrt#11435

Signed-off-by: Bjørn Mork <bjorn@mork.no>
Telenor quirks
--------------
The operator specific firmware running on the Telenor branded
ZyXEL EX5700 includes U-Boot modifications affecting the OpenWrt
installation.

Notable changes to U-Boot include
- environment is stored in RAM and reset to defaults when power
  cycled
- dual partition scheme with "nomimal" or "rescue" systems, falling
  back to "rescue" unless the OS signals success in 3 attempts
- several runtime additions to the device-tree

Some of these modifications have side effects requiring workarounds
- U-Boot modifies /chosen/bootargs in an unsafe manner, and will crash
  unless this node exists
- U-Boot verifies that the selected rootfs UBI volume exists, and
  refuses to boot if it doesn't. The chosen "rootfs" volume must contain
  a squashfs signature even for tftp or initramfs booting.
- U-Boot parses the "factoryparams" UBI volume, setting the "ethaddr"
  variable to the label mac.  But "factoryparams" does not always
  exist.  Instead there is a "RIP" volume containing all the factory
  data.  Copying the "RIP" volume to  "factoryparams" will fix this

Hardware
--------
SOC:   MediaTek MT7986
RAM:   1GB DDR4
FLASH: 512MB SPI-NAND (Mikron xxx)
WIFI:  Mediatek MT7986 802.11ax 5 GHz
       Mediatek MT7916 DBDC 802.11ax 2.4 + 6 GHz
ETH:   MediaTek MT7531 Switch + SoC
       3 x builtin 1G phy (lan1, lan2, lan3)
       2 x MaxLinear GPY211C 2.5 N-Base-T phy (lan4, wan)
USB:   1 x USB 3.2 Enhanced SuperSpeed port
UART:  3V3 115200 8N1 (Pinout: GND KEY RX TX VCC)

Installation
------------
1. Download the OpenWrt initramfs image. Copy the image to a TFTP server
   reachable at 192.168.1.2/24. Rename the image to C0A80101.img.

2. Connect the TFTP server to lan1, lan2 or lan3. Connect to the serial
   console, Interrupt the autoboot process by pressing ESC when prompted.

3. Download and boot the OpenWrt initramfs image.

   $ env set uboot_bootcount 0
   $ env set firmware nominal
   $ tftpboot
   $ bootm

4. Wait for OpenWrt to boot. Transfer the sysupgrade image to the device
   using scp and install using sysupgrade.

   $ sysupgrade -n <path-to-sysupgrade.bin>

Missing features
----------------

- The "lan1", "lan2" and "lan3" port LEDs are driven by the switch but
  OpenWrt does not correctly configure the output.
- The "lan4" and "wan" port LEDs are driven by the GPH211C phys and
  not configured by OpenWrt.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
@openwrt-bot openwrt-bot merged commit 6cc14bf into openwrt:main Aug 19, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core packages pull request/issue for core (in-tree) packages target/mediatek pull request/issue for mediatek target
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants