openwrt/target/linux/mediatek/dts/mt7981b-nradio-c8-668gl.dts
Yaoguang Bai 6b32a5d768 mediatek: filogic: add support for NRadio C8-668GL
NRadio C8-668GL is a Wi-Fi 6 5G cellular router based on MediaTek MT7981B SoC.

- **SoC**: MediaTek MT7981B (2x Cortex-A53, 1.3GHz)
- **RAM**: Nanya NT5AD512M16C4-JR 1GB DDR4
- **Flash**: ESMT FC51L08SFY3A 8GB eMMC
- **Ethernet**:
  - 1x 2.5GbE (via GMAC0 and GPY211 PHY, shared with MT7531AE)
  - 3x 10/100/1000 Mbps (via MT7531AE, connected to GMAC0)
  - 5G Modem: GMAC1 (via GPY211 PHY - RTL8125BG - RM520N-GL)
- **Wi-Fi**: MediaTek MT7976CN (2.4GHz/5GHz, 802.11ax, 2x2 MIMO, AX3000)
- **Buttons**: Reset, WPS
- **LEDs**: Power, 5G, 4G, WiFi
- **SIM Slot**: 1x Nano SIM
- **5G Modem**: Quectel RM520N-GL (Snapdragon™ X62)
- **Power**: 12V/2A DC, 5.5×2.1 connector

The MAC addresses are derived from the `fac_mac` field in the `bdinfo` partition, formatted as `fac_mac = HWMAC`. The allocation is as follows:

| Vendor  | OpenWrt Interface | Address       | Notes                                          |
|---------|-------------------|---------------|------------------------------------------------|
| LAN     | br-lan            | Label MAC     | Default                                        |
| WAN     | lan4              | Label MAC+1   | Only when lan4 is switched to WAN             |
| 2.4GHz  | phy0-ap0          | Label MAC     |                                                |
| 5GHz    | phy1-ap0          | Label MAC     | (Local Admin bit set)                         |
| Modem   | eth1              | Label MAC+2   |                                                |

1. Log in to the router via `http://192.168.66.1`/.
2. Upgrade the official firmware to dual-system mode.
3. Select **Burn second system** and upload the `sysupgrade.bin` image.
   - Download the image from the OpenWrt build system or build it yourself using the OpenWrt buildroot.
4. Wait for 30 seconds and click **Switch system**.
5. The device will reboot and switch to OpenWrt.

Set the U-Boot environment variable `boot_system=0` and reboot:
```bash
fw_setenv boot_system 0
```

Power off the router, hold the **WPS button**, and power it back on.

1. Rename the stock firmware file to **`recovery.bin`**.
2. Set your PC's Ethernet IP to **192.168.1.88** and connect it to the lan1 port on the router.
3. Run a TFTP server and place the `recovery.bin` file in its root directory.
4. Power off the router, press and hold the **Reset button**, and power it back on.
5. Release the Reset button when the TFTP server shows activity.
6. Wait for the router to flash the firmware and reboot automatically.

- By default, `lan4` is part of `br-lan` and uses the label MAC address.
- To query the RM520N-GL module, use the following command:
  ```bash
  cat /dev/ttyUSB2 & printf 'ATI\r\n' > /dev/ttyUSB2
  ```

Signed-off-by: Yaoguang Bai <0xdeadc0de@badguys.club>
Link: https://github.com/openwrt/openwrt/pull/17093
Signed-off-by: John Crispin <john@phrozen.org>
2024-12-13 15:29:04 +01:00

265 lines
4.4 KiB
Plaintext

// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;
#include "mt7981.dtsi"
/ {
model = "NRadio C8-668GL";
compatible = "nradio,c8-668gl", "mediatek,mt7981";
aliases {
ethernet0 = &gmac0;
led-boot = &led_power;
led-failsafe = &led_power;
led-running = &led_power;
led-upgrade = &led_power;
serial0 = &uart0;
};
chosen {
stdout-path = "serial0:115200n1";
/* If official system version < 1.9.2.n6.c3, use root=PARTLABEL=rootfs */
bootargs = "console=ttyS0,115200n1 root=PARTLABEL=rootfs_2nd rootwait";
};
gpio-keys {
compatible = "gpio-keys";
reset {
label = "reset";
linux,code = <KEY_RESTART>;
gpios = <&pio 1 GPIO_ACTIVE_LOW>;
};
wps {
label = "wps";
linux,code = <KEY_WPS_BUTTON>;
gpios = <&pio 9 GPIO_ACTIVE_LOW>;
};
};
gpio-export {
compatible = "gpio-export";
#size-cells = <0>;
cpepower {
gpio-export,name = "cpe-pwr";
gpio-export,output = <0>;
gpios = <&pio 31 GPIO_ACTIVE_LOW>;
};
cpesel0 {
gpio-export,name = "cpe-sel0";
gpio-export,output = <1>;
gpios = <&pio 30 GPIO_ACTIVE_HIGH>;
};
};
leds {
compatible = "gpio-leds";
led_power: power {
color = <LED_COLOR_ID_BLUE>;
function = LED_FUNCTION_POWER;
gpios = <&pio 10 GPIO_ACTIVE_LOW>;
};
led-cellular-5g {
color = <LED_COLOR_ID_BLUE>;
function = LED_FUNCTION_INDICATOR;
function-enumerator = <0>;
gpios = <&pio 11 GPIO_ACTIVE_LOW>;
};
led-cellular-4g {
color = <LED_COLOR_ID_BLUE>;
function = LED_FUNCTION_INDICATOR;
function-enumerator = <1>;
gpios = <&pio 12 GPIO_ACTIVE_LOW>;
};
led-wifi {
color = <LED_COLOR_ID_BLUE>;
function = LED_FUNCTION_WLAN;
gpios = <&pio 13 GPIO_ACTIVE_LOW>;
};
};
};
&uart0 {
status = "okay";
};
&watchdog {
status = "okay";
};
&mmc0 {
pinctrl-names = "default", "state_uhs";
pinctrl-0 = <&mmc0_pins_default>;
pinctrl-1 = <&mmc0_pins_uhs>;
bus-width = <8>;
max-frequency = <52000000>;
cap-mmc-highspeed;
vmmc-supply = <&reg_3p3v>;
non-removable;
status = "okay";
card@0 {
compatible = "mmc-card";
reg = <0>;
block {
compatible = "block-device";
partitions {
block-partition-env {
partname = "u-boot-env";
nvmem-layout {
compatible = "u-boot,env";
};
};
block-partition-factory {
partname = "factory";
nvmem-layout {
compatible = "fixed-layout";
#address-cells = <1>;
#size-cells = <1>;
eeprom_factory_0: eeprom@0 {
reg = <0x0 0x1000>;
};
};
};
};
};
};
};
&pio {
mmc0_pins_default: mmc0-pins-default {
mux {
function = "flash";
groups = "emmc_45";
};
};
mmc0_pins_uhs: mmc0-pins-uhs {
mux {
function = "flash";
groups = "emmc_45";
};
};
};
&eth {
status = "okay";
gmac0: mac@0 {
compatible = "mediatek,eth-mac";
reg = <0>;
phy-mode = "2500base-x";
fixed-link {
speed = <2500>;
full-duplex;
pause;
};
};
gmac1: mac@1 {
compatible = "mediatek,eth-mac";
reg = <1>;
phy-mode = "2500base-x";
phy-handle = <&phy21>;
};
mdio: mdio-bus {
#address-cells = <1>;
#size-cells = <0>;
phy5: ethernet-phy@5 {
compatible = "ethernet-phy-ieee802.3-c45";
reg = <5>;
reset-gpios = <&pio 7 GPIO_ACTIVE_LOW>;
reset-assert-us = <600>;
reset-deassert-us = <20000>;
};
phy21: ethernet-phy@21 {
compatible = "ethernet-phy-ieee802.3-c45";
reg = <21>;
reset-gpios = <&pio 8 GPIO_ACTIVE_LOW>;
reset-assert-us = <600>;
reset-deassert-us = <20000>;
};
switch@1f {
compatible = "mediatek,mt7531";
reg = <31>;
reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>;
interrupt-controller;
#interrupt-cells = <1>;
interrupt-parent = <&pio>;
interrupts = <38 IRQ_TYPE_LEVEL_HIGH>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@1 {
reg = <1>;
label = "lan1";
};
port@2 {
reg = <2>;
label = "lan2";
};
port@3 {
reg = <3>;
label = "lan3";
};
port@5 {
reg = <5>;
label = "lan4";
phy-mode = "2500base-x";
phy-handle = <&phy5>;
};
port@6 {
reg = <6>;
label = "cpu";
ethernet = <&gmac0>;
phy-mode = "2500base-x";
fixed-link {
speed = <2500>;
full-duplex;
pause;
};
};
};
};
};
};
&usb_phy {
status = "okay";
};
&xhci {
status = "okay";
};
&wifi {
nvmem-cells = <&eeprom_factory_0>;
nvmem-cell-names = "eeprom";
status = "okay";
};