]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
mediatek: filogic: restructure SmartRG MT7988 device trees
authorChad Monroe <chad@monroe.io>
Tue, 11 Aug 2026 02:56:59 +0000 (19:56 -0700)
committerJonas Jelonek <jelonek.jonas@gmail.com>
Tue, 11 Aug 2026 20:13:09 +0000 (22:13 +0200)
Replace mt7988a-smartrg-mt-stuart.dtsi with layered dtsi files.
The existing 3 boards assemble from shared building blocks instead
of include-then-delete:

 * mt798x-smartrg-common.dtsi: thermal trip/cooling-map macros
 * mt798x-smartrg-factory.dtsi: eMMC factory/mfginfo nvmem layout
 * mt7988-smartrg-base.dtsi: PMIC, regulators, eMMC, ramoops,
   console, watchdog, reset button
 * mt7988-smartrg-sysled.dtsi: system LED controller and aliases
 * mt7988-smartrg-mt-stuart-gsw.dtsi: built-in switch as lan2-4
   with the per-port PHY LEDs
 * mt7988-smartrg-wifi-pcie3.dtsi / -wifi-mt7995.dtsi: radio second
   PCIe function and pcie0 radio wiring for SDG-8733A
 * mt7988a-smartrg-mt-stuart-phase1.dtsi plus per-model pair dtsi
   for SDG-8733 (AQR113C WAN) and SDG-8734 (SFP+ WAN)

No functional change is intended. Nodes for hardware that a board
does not have are no longer instantiated on that board: the
unstuffed WAN PHY on SDG-8734, unused pin groups per model, and
the PHY LED setup of the disabled switch on SDG-8733A.

Signed-off-by: Chad Monroe <chad@monroe.io>
Link: https://github.com/openwrt/openwrt/pull/24352
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
14 files changed:
target/linux/mediatek/dts/mt7988-smartrg-base.dtsi [new file with mode: 0644]
target/linux/mediatek/dts/mt7988-smartrg-mt-stuart-gsw.dtsi [new file with mode: 0644]
target/linux/mediatek/dts/mt7988-smartrg-sysled.dtsi [new file with mode: 0644]
target/linux/mediatek/dts/mt7988-smartrg-wifi-mt7995.dtsi [new file with mode: 0644]
target/linux/mediatek/dts/mt7988-smartrg-wifi-pcie3.dtsi [new file with mode: 0644]
target/linux/mediatek/dts/mt7988a-smartrg-SDG-8733.dts
target/linux/mediatek/dts/mt7988a-smartrg-SDG-8733.dtsi [new file with mode: 0644]
target/linux/mediatek/dts/mt7988a-smartrg-SDG-8734.dts
target/linux/mediatek/dts/mt7988a-smartrg-SDG-8734.dtsi [new file with mode: 0644]
target/linux/mediatek/dts/mt7988a-smartrg-mt-stuart-phase1.dtsi [new file with mode: 0644]
target/linux/mediatek/dts/mt7988a-smartrg-mt-stuart.dtsi [deleted file]
target/linux/mediatek/dts/mt7988d-smartrg-SDG-8733A.dts
target/linux/mediatek/dts/mt798x-smartrg-common.dtsi [new file with mode: 0644]
target/linux/mediatek/dts/mt798x-smartrg-factory.dtsi [new file with mode: 0644]

diff --git a/target/linux/mediatek/dts/mt7988-smartrg-base.dtsi b/target/linux/mediatek/dts/mt7988-smartrg-base.dtsi
new file mode 100644 (file)
index 0000000..16ee635
--- /dev/null
@@ -0,0 +1,251 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2026 SmartRG Inc.
+ * Author: Chad Monroe <chad.monroe@smartrg.com>
+ *
+ * Hardware common to all SmartRG MT7988 designs: PMIC, fixed
+ * regulators, eMMC, ramoops/bootdata layout, console, watchdog and
+ * the reset button. Boards on MT7988D must delete cpu@3 themselves.
+ */
+
+/dts-v1/;
+#include "mt7988a.dtsi"
+#include "mt798x-smartrg-common.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/leds/common.h>
+#include <dt-bindings/pinctrl/mt65xx.h>
+#include <dt-bindings/regulator/richtek,rt5190a-regulator.h>
+
+/ {
+       aliases {
+               serial0 = &serial0;
+       };
+
+       chosen {
+               bootargs = "console=ttyS0,115200n1 root=PARTLABEL=rootfs";
+               stdout-path = "serial0:115200n8";
+       };
+
+       memory@40000000 {
+               reg = <0x0 0x40000000 0x0 0x40000000>;
+               device_type = "memory";
+       };
+
+       reserved-memory {
+               #address-cells = <2>;
+               #size-cells = <2>;
+               ranges;
+
+               /delete-node/ramoops@42ff0000;
+
+               bootdata_reserved: bootdata@45000000 {
+                       no-map;
+                       reg = <0x0 0x45000000 0x0 0x00001000>;
+               };
+
+               ramoops_reserved: ramoops@45001000 {
+                       no-map;
+                       compatible = "ramoops";
+                       reg = <0x0 0x45001000 0x0 0x00140000>;
+                       ftrace-size = <0x20000>;
+                       record-size = <0x20000>;
+                       console-size = <0x20000>;
+                       pmsg-size = <0x80000>;
+               };
+       };
+
+       reg_1p8v: regulator-1p8v {
+               compatible = "regulator-fixed";
+               regulator-name = "fixed-1.8V";
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <1800000>;
+               regulator-boot-on;
+               regulator-always-on;
+       };
+
+       reg_3p3v: regulator-3p3v {
+               compatible = "regulator-fixed";
+               regulator-name = "fixed-3.3V";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               regulator-boot-on;
+               regulator-always-on;
+       };
+
+       gpio-keys {
+               compatible = "gpio-keys";
+               pinctrl-names = "default";
+               pinctrl-0 = <&button_pins>;
+
+               button-reset {
+                       label = "reset";
+                       linux,code = <KEY_RESTART>;
+                       gpios = <&pio 13 GPIO_ACTIVE_LOW>;
+               };
+       };
+};
+
+&cpu0 {
+       proc-supply = <&rt5190_buck3>;
+};
+
+&cpu1 {
+       proc-supply = <&rt5190_buck3>;
+};
+
+&cpu2 {
+       proc-supply = <&rt5190_buck3>;
+};
+
+&cpu3 {
+       proc-supply = <&rt5190_buck3>;
+};
+
+&cci {
+       proc-supply = <&rt5190_buck3>;
+};
+
+&eth {
+       pinctrl-0 = <&mdio0_pins>;
+       pinctrl-names = "default";
+       status = "okay";
+};
+
+&i2c0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&i2c0_pins>;
+       status = "okay";
+
+       rt5190a_64: rt5190a@64 {
+               compatible = "richtek,rt5190a";
+               reg = <0x64>;
+               /*interrupts-extended = <&gpio26 0 IRQ_TYPE_LEVEL_LOW>;*/
+               vin2-supply = <&rt5190_buck1>;
+               vin3-supply = <&rt5190_buck1>;
+               vin4-supply = <&rt5190_buck1>;
+
+               regulators {
+                       rt5190_buck1: buck1 {
+                               regulator-name = "rt5190a-buck1";
+                               regulator-min-microvolt = <5090000>;
+                               regulator-max-microvolt = <5090000>;
+                               regulator-allowed-modes =
+                               <RT5190A_OPMODE_AUTO RT5190A_OPMODE_FPWM>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+                       buck2 {
+                               regulator-name = "vcore";
+                               regulator-min-microvolt = <600000>;
+                               regulator-max-microvolt = <1400000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+                       rt5190_buck3: buck3 {
+                               regulator-name = "vproc";
+                               regulator-min-microvolt = <600000>;
+                               regulator-max-microvolt = <1400000>;
+                               regulator-boot-on;
+                       };
+                       buck4 {
+                               regulator-name = "rt5190a-buck4";
+                               regulator-min-microvolt = <850000>;
+                               regulator-max-microvolt = <850000>;
+                               regulator-allowed-modes =
+                               <RT5190A_OPMODE_AUTO RT5190A_OPMODE_FPWM>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+                       ldo {
+                               regulator-name = "rt5190a-ldo";
+                               regulator-min-microvolt = <1200000>;
+                               regulator-max-microvolt = <1200000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+               };
+       };
+};
+
+&i2c1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&i2c1_pins>;
+       status = "okay";
+};
+
+&mmc0 {
+       pinctrl-names = "default", "state_uhs";
+       pinctrl-0 = <&mmc0_pins_emmc_51>;
+       pinctrl-1 = <&mmc0_pins_emmc_51>;
+       bus-width = <8>;
+       max-frequency = <200000000>;
+       cap-mmc-highspeed;
+       mmc-hs200-1_8v;
+       vmmc-supply = <&reg_3p3v>;
+       vqmmc-supply = <&reg_1p8v>;
+       non-removable;
+       no-sd;
+       no-sdio;
+       status = "okay";
+       #address-cells = <1>;
+       #size-cells = <0>;
+
+       card@0 {
+               compatible = "mmc-card";
+               reg = <0>;
+
+               emmc_block: block {
+                       compatible = "block-device";
+               };
+       };
+};
+
+&pio {
+       button_pins: button-pins {
+               pins = "GPIO_RESET";
+               bias-disable;
+       };
+
+       i2c0_pins: i2c0-g0-pins {
+               mux {
+                       function = "i2c";
+                       groups = "i2c0_1";
+               };
+       };
+
+       i2c1_pins: i2c1-g0-pins {
+               mux {
+                       function = "i2c";
+                       groups = "i2c1_0";
+               };
+       };
+
+       mdio0_pins: mdio0-pins {
+               mux {
+                       function = "eth";
+                       groups = "mdc_mdio0";
+               };
+
+               conf {
+                       groups = "mdc_mdio0";
+                       drive-strength = <MTK_DRIVE_8mA>;
+               };
+       };
+
+       mmc0_pins_emmc_51: mmc0-emmc-51-pins {
+               mux {
+                       function = "flash";
+                       groups = "emmc_51";
+               };
+       };
+};
+
+&serial0 {
+       status = "okay";
+};
+
+&watchdog {
+       status = "okay";
+};
diff --git a/target/linux/mediatek/dts/mt7988-smartrg-mt-stuart-gsw.dtsi b/target/linux/mediatek/dts/mt7988-smartrg-mt-stuart-gsw.dtsi
new file mode 100644 (file)
index 0000000..7945557
--- /dev/null
@@ -0,0 +1,137 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2026 SmartRG Inc.
+ * Author: Chad Monroe <chad.monroe@smartrg.com>
+ *
+ * MT7988 built-in gigabit switch as lan2..lan4 with the per-port
+ * PHY LEDs, shared by the Mt. Stuart designs that expose the gsw
+ * ports.
+ */
+
+&gmac0 {
+       nvmem-cells = <&macaddr 0x1>;
+       nvmem-cell-names = "mac-address";
+
+       status = "okay";
+};
+
+&gsw_phy0 {
+       status = "disabled";
+};
+
+&gsw_phy1 {
+       pinctrl-names = "gbe-led";
+       pinctrl-0 = <&gbe1_led0_pins>, <&gbe1_led1_pins>;
+};
+
+&gsw_phy1_led0 {
+       status = "okay";
+       function = LED_FUNCTION_LAN;
+       color = <LED_COLOR_ID_GREEN>;
+};
+
+&gsw_phy1_led1 {
+       status = "okay";
+       function = LED_FUNCTION_LAN;
+       color = <LED_COLOR_ID_AMBER>;
+};
+
+&gsw_phy2 {
+       pinctrl-names = "gbe-led";
+       pinctrl-0 = <&gbe2_led0_pins>, <&gbe2_led1_pins>;
+};
+
+&gsw_phy2_led0 {
+       status = "okay";
+       function = LED_FUNCTION_LAN;
+       color = <LED_COLOR_ID_GREEN>;
+};
+
+&gsw_phy2_led1 {
+       status = "okay";
+       function = LED_FUNCTION_LAN;
+       color = <LED_COLOR_ID_AMBER>;
+};
+
+&gsw_phy3 {
+       pinctrl-names = "gbe-led";
+       pinctrl-0 = <&gbe3_led0_pins>, <&gbe3_led1_pins>;
+};
+
+&gsw_phy3_led0 {
+       status = "okay";
+       function = LED_FUNCTION_LAN;
+       color = <LED_COLOR_ID_GREEN>;
+};
+
+&gsw_phy3_led1 {
+       status = "okay";
+       function = LED_FUNCTION_LAN;
+       color = <LED_COLOR_ID_AMBER>;
+};
+
+&pio {
+       gbe1_led0_pins: gbe1-led0-pins {
+               mux {
+                       function = "led";
+                       groups = "gbe1_led0";
+               };
+       };
+
+       gbe2_led0_pins: gbe2-led0-pins {
+               mux {
+                       function = "led";
+                       groups = "gbe2_led0";
+               };
+       };
+
+       gbe3_led0_pins: gbe3-led0-pins {
+               mux {
+                       function = "led";
+                       groups = "gbe3_led0";
+               };
+       };
+
+       gbe1_led1_pins: gbe1-led1-pins {
+               mux {
+                       function = "led";
+                       groups = "gbe1_led1";
+               };
+       };
+
+       gbe2_led1_pins: gbe2-led1-pins {
+               mux {
+                       function = "led";
+                       groups = "gbe2_led1";
+               };
+       };
+
+       gbe3_led1_pins: gbe3-led1-pins {
+               mux {
+                       function = "led";
+                       groups = "gbe3_led1";
+               };
+       };
+};
+
+&switch {
+       status = "okay";
+
+       ports {
+               port@0 {
+                       status = "disabled";
+               };
+
+               port@1 {
+                       label = "lan2";
+               };
+
+               port@2 {
+                       label = "lan3";
+               };
+
+               port@3 {
+                       label = "lan4";
+               };
+       };
+};
diff --git a/target/linux/mediatek/dts/mt7988-smartrg-sysled.dtsi b/target/linux/mediatek/dts/mt7988-smartrg-sysled.dtsi
new file mode 100644 (file)
index 0000000..89eb197
--- /dev/null
@@ -0,0 +1,45 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2026 SmartRG Inc.
+ * Author: Chad Monroe <chad.monroe@smartrg.com>
+ *
+ * Holtek MCU system LED controller on i2c1.
+ */
+
+/ {
+       aliases {
+               led-boot = &led_sys_green;
+               led-failsafe = &led_sys_blue;
+               led-running = &led_sys_white;
+               led-upgrade = &led_sys_red;
+       };
+};
+
+&i2c1 {
+       system-leds@30 {
+               compatible = "srg,sysled";
+               reg = <0x30>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               led_sys_red: led@1 {
+                       label = "red";
+                       reg = <1>;
+               };
+
+               led_sys_green: led@2 {
+                       label = "green";
+                       reg = <2>;
+               };
+
+               led_sys_blue: led@3 {
+                       label = "blue";
+                       reg = <3>;
+               };
+
+               led_sys_white: led@4 {
+                       label = "white";
+                       reg = <4>;
+               };
+       };
+};
diff --git a/target/linux/mediatek/dts/mt7988-smartrg-wifi-mt7995.dtsi b/target/linux/mediatek/dts/mt7988-smartrg-wifi-mt7995.dtsi
new file mode 100644 (file)
index 0000000..55785bb
--- /dev/null
@@ -0,0 +1,53 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2026 SmartRG Inc.
+ * Author: Chad Monroe <chad.monroe@smartrg.com>
+ *
+ * MT7995 tri-band radio: main function and radio node on pcie0 with
+ * the matching mt7995 factory precal. Consumers set the pcie0
+ * pinctrl and wire up the second PCIe function and module reset;
+ * board routing differs (pcie3 on SDG-8733A, pcie1 on SDG-8733B).
+ */
+
+#include "mt798x-smartrg-factory.dtsi"
+
+&pcie0 {
+       status = "okay";
+
+       pcie@0,0 {
+               reg = <0x0000 0 0 0 0>;
+               #address-cells = <3>;
+               #size-cells = <2>;
+
+               radio0: wifi@0,0 {
+                       compatible = "mediatek,mt76";
+                       reg = <0x0000 0 0 0 0>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       nvmem-cells = <&eeprom_factory_0>;
+                       nvmem-cell-names = "eeprom";
+                       ieee80211-freq-limit = <2400000 2500000>, <5170000 5835000>, <5945000 7125000>;
+
+                       band@0 {
+                               /* 2.4 GHz */
+                               reg = <0>;
+                               nvmem-cells = <&macaddr 0x4>;
+                               nvmem-cell-names = "mac-address";
+                       };
+
+                       band@1 {
+                               /* 5 GHz */
+                               reg = <1>;
+                               nvmem-cells = <&macaddr 0xa>;
+                               nvmem-cell-names = "mac-address";
+                       };
+
+                       band@2 {
+                               /* 6 GHz */
+                               reg = <2>;
+                               nvmem-cells = <&macaddr 0x6>;
+                               nvmem-cell-names = "mac-address";
+                       };
+               };
+       };
+};
diff --git a/target/linux/mediatek/dts/mt7988-smartrg-wifi-pcie3.dtsi b/target/linux/mediatek/dts/mt7988-smartrg-wifi-pcie3.dtsi
new file mode 100644 (file)
index 0000000..ce25d28
--- /dev/null
@@ -0,0 +1,23 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2026 SmartRG Inc.
+ * Author: Chad Monroe <chad.monroe@smartrg.com>
+ *
+ * Second PCIe function of the MT7995/MT7996-233 radio modules. The
+ * main function (and the radio0 node) lives on pcie0.
+ */
+
+&pcie3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pcie3_1_pins>;
+       status = "okay";
+};
+
+&pio {
+       pcie3_1_pins: pcie3-pins-g1 {
+               mux {
+                       function = "pcie";
+                       groups = "pcie_1l_1_pereset", "pcie_clk_req_n3";
+               };
+       };
+};
index 7ac5a4d6fa2daad894a66f9aadd10a0543ff8a39..c58c047499d8f747d7ca1f88b8154f9703102513 100644 (file)
@@ -4,13 +4,9 @@
  * Author: Chad Monroe <chad.monroe@smartrg.com>
  */
 
-#include "mt7988a-smartrg-mt-stuart.dtsi"
+#include "mt7988a-smartrg-SDG-8733.dtsi"
 
 / {
        model = "SmartRG SDG-8733";
        compatible = "smartrg,sdg-8733", "mediatek,mt7988a";
 };
-
-&gmac1 {
-       phy = <&phy0>;
-};
diff --git a/target/linux/mediatek/dts/mt7988a-smartrg-SDG-8733.dtsi b/target/linux/mediatek/dts/mt7988a-smartrg-SDG-8733.dtsi
new file mode 100644 (file)
index 0000000..604ab4d
--- /dev/null
@@ -0,0 +1,49 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2023 SmartRG Inc.
+ * Author: Chad Monroe <chad.monroe@smartrg.com>
+ *
+ * SDG-8733: Mt. Stuart phase 1 with AQR113C 10G WAN.
+ */
+
+#include "mt7988a-smartrg-mt-stuart-phase1.dtsi"
+
+&gmac1 {
+       phy = <&phy0>;
+};
+
+&mdio_bus {
+       phy0: ethernet-phy@0 {
+               /* AQR113C */
+               compatible = "ethernet-phy-ieee802.3-c45";
+               reg = <0>;
+
+               reset-gpios = <&pio 62 GPIO_ACTIVE_LOW>;
+               reset-assert-us = <100000>;
+               reset-deassert-us = <1000000>;
+
+               leds {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+
+                       led@0 {
+                               reg = <0>;
+                               function = LED_FUNCTION_WAN;
+                               color = <LED_COLOR_ID_GREEN>;
+                       };
+
+                       led@1 {
+                               reg = <1>;
+                               function = LED_FUNCTION_WAN;
+                               color = <LED_COLOR_ID_ORANGE>;
+                       };
+
+                       led@2 {
+                               reg = <2>;
+                               function = LED_FUNCTION_WAN;
+                               color = <LED_COLOR_ID_WHITE>;
+                               active-high;
+                       };
+               };
+       };
+};
index 6eeb4993f5b7531882421655789be8560488f686..2736cfaf7121a7103eee34c319097b1c0c9c72da 100644 (file)
@@ -4,54 +4,9 @@
  * Author: Chad Monroe <chad.monroe@smartrg.com>
  */
 
-#include "mt7988a-smartrg-mt-stuart.dtsi"
+#include "mt7988a-smartrg-SDG-8734.dtsi"
 
 / {
        model = "SmartRG SDG-8734";
        compatible = "smartrg,sdg-8734", "mediatek,mt7988a";
-
-       gpio-leds {
-               compatible = "gpio-leds";
-
-               sfp_green {
-                       color = <LED_COLOR_ID_GREEN>;
-                       function = "sfp";
-                       gpios = <&pio 69 GPIO_ACTIVE_HIGH>;
-               };
-
-               sfp_red {
-                       color = <LED_COLOR_ID_RED>;
-                       function = "sfp";
-                       gpios = <&pio 70 GPIO_ACTIVE_HIGH>;
-               };
-       };
-
-       i2c_sfp1: i2c-gpio-0 {
-               pinctrl-names = "default";
-               pinctrl-0 = <&sfp_i2c_pins>;
-
-               compatible = "i2c-gpio";
-               sda-gpios = <&pio 27 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
-               scl-gpios = <&pio 22 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
-               i2c-gpio,delay-us = <2>;
-               #address-cells = <1>;
-               #size-cells = <0>;
-       };
-
-       sfp1: sfp1 {
-               compatible = "sff,sfp";
-               i2c-bus = <&i2c_sfp1>;
-               los-gpios = <&pio 32 GPIO_ACTIVE_HIGH>;
-               mod-def0-gpios = <&pio 35 GPIO_ACTIVE_LOW>;
-               rate-select0-gpios = <&pio 34 GPIO_ACTIVE_HIGH>;
-               rate-select1-gpios = <&pio 33 GPIO_ACTIVE_HIGH>;
-               tx-disable-gpios = <&pio 36 GPIO_ACTIVE_HIGH>;
-               tx-fault-gpios = <&pio 37 GPIO_ACTIVE_HIGH>;
-               maximum-power-milliwatt = <4000>;
-       };
-};
-
-&gmac1 {
-       sfp = <&sfp1>;
-       managed = "in-band-status";
 };
diff --git a/target/linux/mediatek/dts/mt7988a-smartrg-SDG-8734.dtsi b/target/linux/mediatek/dts/mt7988a-smartrg-SDG-8734.dtsi
new file mode 100644 (file)
index 0000000..e41f9bd
--- /dev/null
@@ -0,0 +1,71 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2023 SmartRG Inc.
+ * Author: Chad Monroe <chad.monroe@smartrg.com>
+ *
+ * SDG-8734: Mt. Stuart phase 1 with SFP+ WAN.
+ */
+
+#include "mt7988a-smartrg-mt-stuart-phase1.dtsi"
+
+/ {
+       gpio-leds {
+               compatible = "gpio-leds";
+
+               sfp_green {
+                       color = <LED_COLOR_ID_GREEN>;
+                       function = "sfp";
+                       gpios = <&pio 69 GPIO_ACTIVE_HIGH>;
+               };
+
+               sfp_red {
+                       color = <LED_COLOR_ID_RED>;
+                       function = "sfp";
+                       gpios = <&pio 70 GPIO_ACTIVE_HIGH>;
+               };
+       };
+
+       i2c_sfp1: i2c-gpio-0 {
+               pinctrl-names = "default";
+               pinctrl-0 = <&sfp_i2c_pins>;
+
+               compatible = "i2c-gpio";
+               sda-gpios = <&pio 27 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
+               scl-gpios = <&pio 22 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
+               i2c-gpio,delay-us = <2>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+       };
+
+       sfp1: sfp1 {
+               compatible = "sff,sfp";
+               i2c-bus = <&i2c_sfp1>;
+               los-gpios = <&pio 32 GPIO_ACTIVE_HIGH>;
+               mod-def0-gpios = <&pio 35 GPIO_ACTIVE_LOW>;
+               rate-select0-gpios = <&pio 34 GPIO_ACTIVE_HIGH>;
+               rate-select1-gpios = <&pio 33 GPIO_ACTIVE_HIGH>;
+               tx-disable-gpios = <&pio 36 GPIO_ACTIVE_HIGH>;
+               tx-fault-gpios = <&pio 37 GPIO_ACTIVE_HIGH>;
+               maximum-power-milliwatt = <4000>;
+       };
+};
+
+&gmac1 {
+       sfp = <&sfp1>;
+       managed = "in-band-status";
+};
+
+&pio {
+       sfp_i2c_pins: sfp-i2c-pins {
+               conf-scl {
+                       pins = "LED_A";
+                       drive-strength = <MTK_DRIVE_8mA>;
+                       bias-pull-up = <MTK_PUPD_SET_R1R0_01>;
+               };
+               conf-sda {
+                       pins = "LED_E";
+                       drive-strength = <MTK_DRIVE_8mA>;
+                       bias-disable;
+               };
+       };
+};
diff --git a/target/linux/mediatek/dts/mt7988a-smartrg-mt-stuart-phase1.dtsi b/target/linux/mediatek/dts/mt7988a-smartrg-mt-stuart-phase1.dtsi
new file mode 100644 (file)
index 0000000..70f8a0a
--- /dev/null
@@ -0,0 +1,269 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2023 SmartRG Inc.
+ * Author: Chad Monroe <chad.monroe@smartrg.com>
+ *
+ * Mt. Stuart phase 1: AQR113C 10G LAN, MT7996 tri-band radio on
+ * pcie0/pcie1, built-in switch as lan2..lan4, GPS and Bluetooth
+ * uarts, fan. The WAN frontend differs per model: SDG-8733 adds a
+ * second AQR113C, SDG-8734 an SFP+ cage.
+ */
+
+#include "mt7988-smartrg-base.dtsi"
+#include "mt7988-smartrg-sysled.dtsi"
+#include "mt7988-smartrg-mt-stuart-gsw.dtsi"
+#include "mt798x-smartrg-factory.dtsi"
+
+/ {
+       aliases {
+               label-mac-device = &gmac1;
+       };
+
+       gpio-keys {
+               button-sync {
+                       label = "sync";
+                       linux,code = <KEY_WPS_BUTTON>;
+                       gpios = <&pio 14 GPIO_ACTIVE_LOW>;
+               };
+       };
+
+       gpio-export {
+               compatible = "gpio-export";
+
+               bluetooth_reset {
+                       gpio-export,name = "bt_reset";
+                       gpio-export,direction_may_change;
+                       gpios = <&pio 20 GPIO_ACTIVE_HIGH>;
+               };
+
+               bluetooth_txrx_ctl {
+                       gpio-export,name = "bt_txrx_ctl";
+                       gpio-export,direction_may_change;
+                       gpios = <&pio 74 GPIO_ACTIVE_HIGH>;
+               };
+
+               gps_enable {
+                       gpio-export,name = "gps_enable";
+                       gpio-export,output = <1>;
+                       gpios = <&pio 9 GPIO_ACTIVE_LOW>;
+               };
+
+               usb_enable {
+                       gpio-export,name = "usb_enable";
+                       gpio-export,output = <1>;
+                       gpios = <&pio 63 GPIO_ACTIVE_HIGH>;
+               };
+       };
+
+       fan: pwm-fan {
+               compatible = "pwm-fan";
+               #cooling-cells = <2>;
+               #thermal-sensor-cells = <1>;
+
+               pwms = <&pwm 0 40000 0>;
+
+               /**
+                * set fan speed
+                *
+                * 0 = off
+                * 61 = 24% duty cycle
+                * 77 = 30% duty cycle
+                * 102 = 40% duty cycle
+                * 128 - 50% duty cycle
+                * 255 = 100% duty cycle
+                */
+               cooling-levels = <61 77 102 128>;
+
+               interrupt-parent = <&pio>;
+               interrupts = <21 IRQ_TYPE_EDGE_FALLING>;
+               pulses-per-revolution = <2>;
+
+               status = "okay";
+       };
+
+       sdg_thermal: thermal-zones {
+               cpu_thermal: cpu-thermal {
+                       thermal-sensors = <&lvts 0>;
+                       SDG_1FAN_THERMAL_MAP(cpu_thermal, &fan,
+                                            125000, 120000,
+                                            110000, 80000,
+                                            60000, 40000);
+               };
+       };
+};
+
+&button_pins {
+       pins = "GPIO_RESET", "GPIO_WPS";
+};
+
+&gmac1 {
+       nvmem-cells = <&macaddr 0x0>;
+       nvmem-cell-names = "mac-address";
+       label = "wan";
+       phy-mode = "usxgmii";
+
+       status = "okay";
+};
+
+&gmac2 {
+       nvmem-cells = <&macaddr 0x1>;
+       nvmem-cell-names = "mac-address";
+       label = "lan1";
+       phy-mode = "usxgmii";
+       phy = <&phy8>;
+
+       status = "okay";
+};
+
+&mdio_bus {
+       phy8: ethernet-phy@8 {
+               /* AQR113C */
+               compatible = "ethernet-phy-ieee802.3-c45";
+               reg = <8>;
+
+               reset-gpios = <&pio 71 GPIO_ACTIVE_LOW>;
+               reset-assert-us = <100000>;
+               reset-deassert-us = <1000000>;
+
+               leds {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+
+                       led@0 {
+                               reg = <0>;
+                               function = LED_FUNCTION_LAN;
+                               color = <LED_COLOR_ID_GREEN>;
+                       };
+
+                       led@1 {
+                               reg = <1>;
+                               function = LED_FUNCTION_LAN;
+                               color = <LED_COLOR_ID_ORANGE>;
+                       };
+
+                       led@2 {
+                               reg = <2>;
+                               function = LED_FUNCTION_LAN;
+                               color = <LED_COLOR_ID_WHITE>;
+                               active-high;
+                       };
+               };
+       };
+};
+
+&pcie0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pcie0_1_pins>;
+       reset-gpios = <&pio 7 GPIO_ACTIVE_LOW>;
+       status = "okay";
+
+       pcie@0,0 {
+               reg = <0x0000 0 0 0 0>;
+               #address-cells = <3>;
+               #size-cells = <2>;
+
+               radio0: wifi@0,0 {
+                       compatible = "mediatek,mt76";
+                       reg = <0x0000 0 0 0 0>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       nvmem-cells = <&eeprom_factory_0>;
+                       nvmem-cell-names = "eeprom";
+                       ieee80211-freq-limit = <2400000 2500000>, <5170000 5835000>, <5945000 7125000>;
+
+                       band@0 {
+                               /* 2.4 GHz */
+                               reg = <0>;
+                               nvmem-cells = <&macaddr 0x4>;
+                               nvmem-cell-names = "mac-address";
+                       };
+
+                       band@1 {
+                               /* 5 GHz */
+                               reg = <1>;
+                               nvmem-cells = <&macaddr 0xa>;
+                               nvmem-cell-names = "mac-address";
+                       };
+
+                       band@2 {
+                               /* 6 GHz */
+                               reg = <2>;
+                               nvmem-cells = <&macaddr 0x6>;
+                               nvmem-cell-names = "mac-address";
+                       };
+               };
+       };
+};
+
+&pcie1 {
+       /* second PCIe function of the MT7996 module */
+       status = "okay";
+};
+
+&pio {
+       pcie0_1_pins: pcie0-pins-g1 {
+               mux {
+                       function = "pcie";
+                       groups = "pcie_2l_0_pereset", "pcie_clk_req_n0_0";
+               };
+       };
+
+       pwm_pins: pwm-pins {
+               mux {
+                       function = "pwm";
+                       groups = "pwm0", "pwm1";
+               };
+       };
+
+       uart1_pins: uart1-pins {
+               mux {
+                       function = "uart";
+                       groups = "uart1_2";
+               };
+       };
+
+       uart2_pins: uart2-pins {
+               mux {
+                       function = "uart";
+                       groups = "uart2";
+               };
+       };
+};
+
+&pwm {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pwm_pins>;
+       status = "okay";
+};
+
+&ssusb0 {
+       status = "okay";
+};
+
+&ssusb1 {
+       status = "okay";
+};
+
+&tphy {
+       status = "okay";
+};
+
+&serial1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&uart1_pins>;
+       status = "okay";
+
+       /* Airoha AG3352 GPS */
+};
+
+&serial2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&uart2_pins>;
+       status = "okay";
+
+       /* DA14531MOD Bluetooth */
+};
+
+&xsphy {
+       status = "okay";
+};
diff --git a/target/linux/mediatek/dts/mt7988a-smartrg-mt-stuart.dtsi b/target/linux/mediatek/dts/mt7988a-smartrg-mt-stuart.dtsi
deleted file mode 100644 (file)
index 9db2384..0000000
+++ /dev/null
@@ -1,782 +0,0 @@
-// SPDX-License-Identifier: (GPL-2.0 OR MIT)
-/*
- * Copyright (C) 2023 SmartRG Inc.
- * Author: Chad Monroe <chad.monroe@smartrg.com>
- */
-
-/dts-v1/;
-#include "mt7988a.dtsi"
-#include <dt-bindings/gpio/gpio.h>
-#include <dt-bindings/input/input.h>
-#include <dt-bindings/leds/common.h>
-#include <dt-bindings/pinctrl/mt65xx.h>
-#include <dt-bindings/regulator/richtek,rt5190a-regulator.h>
-
-/ {
-       aliases {
-               serial0 = &serial0;
-               label-mac-device = &gmac1;
-               led-boot = &led_sys_green;
-               led-failsafe = &led_sys_blue;
-               led-running = &led_sys_white;
-               led-upgrade = &led_sys_red;
-       };
-
-       chosen {
-               stdout-path = &serial0;
-               bootargs = "console=ttyS0,115200n1 root=PARTLABEL=rootfs";
-       };
-
-       memory@40000000 {
-               reg = <0x0 0x40000000 0x0 0x40000000>;
-               device_type = "memory";
-       };
-
-       reserved-memory {
-               #address-cells = <2>;
-               #size-cells = <2>;
-               ranges;
-
-               /delete-node/ramoops@42ff0000;
-
-               bootdata@45000000 {
-                       no-map;
-                       reg = <0x0 0x45000000 0x0 0x00001000>;
-               };
-
-               ramoops_reserved: ramoops@45001000 {
-                       no-map;
-                       compatible = "ramoops";
-                       reg = <0x0 0x45001000 0x0 0x00140000>;
-                       ftrace-size = <0x20000>;
-                       record-size = <0x20000>;
-                       console-size = <0x20000>;
-                       pmsg-size = <0x80000>;
-               };
-       };
-
-       reg_1p8v: regulator-1p8v {
-               compatible = "regulator-fixed";
-               regulator-name = "fixed-1.8V";
-               regulator-min-microvolt = <1800000>;
-               regulator-max-microvolt = <1800000>;
-               regulator-boot-on;
-               regulator-always-on;
-       };
-
-       reg_3p3v: regulator-3p3v {
-               compatible = "regulator-fixed";
-               regulator-name = "fixed-3.3V";
-               regulator-min-microvolt = <3300000>;
-               regulator-max-microvolt = <3300000>;
-               regulator-boot-on;
-               regulator-always-on;
-       };
-
-       gpio-keys {
-               compatible = "gpio-keys";
-               pinctrl-names = "default";
-               pinctrl-0 = <&button_pins>;
-
-               factory {
-                       label = "reset";
-                       linux,code = <KEY_RESTART>;
-                       gpios = <&pio 13 GPIO_ACTIVE_LOW>;
-               };
-
-               wps {
-                       label = "sync";
-                       linux,code = <KEY_WPS_BUTTON>;
-                       gpios = <&pio 14 GPIO_ACTIVE_LOW>;
-               };
-       };
-
-       gpio-export {
-               compatible = "gpio-export";
-
-               bluetooth_reset {
-                       gpio-export,name = "bt_reset";
-                       gpio-export,direction_may_change;
-                       gpios = <&pio 20 GPIO_ACTIVE_HIGH>;
-               };
-
-               bluetooth_txrx_ctl {
-                       gpio-export,name = "bt_txrx_ctl";
-                       gpio-export,direction_may_change;
-                       gpios = <&pio 74 GPIO_ACTIVE_HIGH>;
-               };
-
-               gps_enable {
-                       gpio-export,name = "gps_enable";
-                       gpio-export,output = <1>;
-                       gpios = <&pio 9 GPIO_ACTIVE_LOW>;
-               };
-
-               usb_enable {
-                       gpio-export,name = "usb_enable";
-                       gpio-export,output = <1>;
-                       gpios = <&pio 63 GPIO_ACTIVE_HIGH>;
-               };
-       };
-
-       fan: pwm-fan {
-               compatible = "pwm-fan";
-               #cooling-cells = <2>;
-               #thermal-sensor-cells = <1>;
-
-               pwms = <&pwm 0 40000 0>;
-
-               /**
-                * set fan speed
-                *
-                * 0 = off
-                * 61 = 24% duty cycle
-                * 77 = 30% duty cycle
-                * 102 = 40% duty cycle
-                * 128 - 50% duty cycle
-                * 255 = 100% duty cycle
-                */
-               cooling-levels = <61 77 102 128>;
-
-               interrupt-parent = <&pio>;
-               interrupts = <21 IRQ_TYPE_EDGE_FALLING>;
-               pulses-per-revolution = <2>;
-       };
-};
-
-&cpu0 {
-       proc-supply = <&rt5190_buck3>;
-};
-
-&cpu1 {
-       proc-supply = <&rt5190_buck3>;
-};
-
-&cpu2 {
-       proc-supply = <&rt5190_buck3>;
-};
-
-&cpu3 {
-       proc-supply = <&rt5190_buck3>;
-};
-
-&cci {
-       proc-supply = <&rt5190_buck3>;
-};
-
-&cpu_thermal {
-       /delete-node/cooling-maps;
-       /delete-node/trips;
-
-       trips {
-               cpu_trip_crit: crit {
-                       temperature = <125000>;
-                       hysteresis = <2000>;
-                       type = "critical";
-               };
-
-               cpu_trip_hot: hot {
-                       temperature = <120000>;
-                       hysteresis = <2000>;
-                       type = "hot";
-               };
-
-               cpu_trip_active_high: active-high {
-                       temperature = <110000>;
-                       hysteresis = <2000>;
-                       type = "active";
-               };
-
-               cpu_trip_active_med: active-med {
-                       temperature = <80000>;
-                       hysteresis = <2000>;
-                       type = "active";
-               };
-
-               cpu_trip_active_low: active-low {
-                       temperature = <60000>;
-                       hysteresis = <2000>;
-                       type = "active";
-               };
-
-               cpu_trip_active_silent: active-silent {
-                       temperature = <40000>;
-                       hysteresis = <2000>;
-                       type = "active";
-               };
-       };
-
-       cooling-maps {
-               cpu-active-high {
-                       /* active: set fan to cooling level 3 */
-                       cooling-device = <&fan 3 3>;
-                       trip = <&cpu_trip_active_high>;
-               };
-
-               cpu-active-med {
-                       /* active: set fan to cooling level 2 */
-                       cooling-device = <&fan 2 2>;
-                       trip = <&cpu_trip_active_med>;
-               };
-
-               cpu-active-low {
-                       /* active: set fan to cooling level 1 */
-                       cooling-device = <&fan 1 1>;
-                       trip = <&cpu_trip_active_low>;
-               };
-
-               cpu-active-silent {
-                       /* active: set fan to cooling level 0 */
-                       cooling-device = <&fan 0 0>;
-                       trip = <&cpu_trip_active_silent>;
-               };
-       };
-};
-
-&eth {
-       pinctrl-0 = <&mdio0_pins>;
-       pinctrl-names = "default";
-       status = "okay";
-};
-
-&gmac0 {
-       nvmem-cells = <&macaddr 1>;
-       nvmem-cell-names = "mac-address";
-
-       status = "okay";
-};
-
-&gmac1 {
-       nvmem-cells = <&macaddr 0>;
-       nvmem-cell-names = "mac-address";
-       label = "wan";
-       phy-mode = "usxgmii";
-
-       status = "okay";
-};
-
-&gmac2 {
-       nvmem-cells = <&macaddr 1>;
-       nvmem-cell-names = "mac-address";
-       label = "lan1";
-       phy-mode = "usxgmii";
-       phy = <&phy8>;
-
-       status = "okay";
-};
-
-&gsw_phy0 {
-       status = "disabled";
-};
-
-&gsw_phy1 {
-       pinctrl-names = "gbe-led";
-       pinctrl-0 = <&gbe1_led0_pins>, <&gbe1_led1_pins>;
-};
-
-&gsw_phy1_led0 {
-       status = "okay";
-       function = LED_FUNCTION_LAN;
-       color = <LED_COLOR_ID_GREEN>;
-};
-
-&gsw_phy1_led1 {
-       status = "okay";
-       function = LED_FUNCTION_LAN;
-       color = <LED_COLOR_ID_AMBER>;
-};
-
-&gsw_phy2 {
-       pinctrl-names = "gbe-led";
-       pinctrl-0 = <&gbe2_led0_pins>, <&gbe2_led1_pins>;
-};
-
-&gsw_phy2_led0 {
-       status = "okay";
-       function = LED_FUNCTION_LAN;
-       color = <LED_COLOR_ID_GREEN>;
-};
-
-&gsw_phy2_led1 {
-       status = "okay";
-       function = LED_FUNCTION_LAN;
-       color = <LED_COLOR_ID_AMBER>;
-};
-
-&gsw_phy3 {
-       pinctrl-names = "gbe-led";
-       pinctrl-0 = <&gbe3_led0_pins>, <&gbe3_led1_pins>;
-};
-
-&gsw_phy3_led0 {
-       status = "okay";
-       function = LED_FUNCTION_LAN;
-       color = <LED_COLOR_ID_GREEN>;
-};
-
-&gsw_phy3_led1 {
-       status = "okay";
-       function = LED_FUNCTION_LAN;
-       color = <LED_COLOR_ID_AMBER>;
-};
-
-&i2c0 {
-       pinctrl-names = "default";
-       pinctrl-0 = <&i2c0_pins>;
-       status = "okay";
-
-       rt5190a_64: rt5190a@64 {
-               compatible = "richtek,rt5190a";
-               reg = <0x64>;
-               /*interrupts-extended = <&gpio26 0 IRQ_TYPE_LEVEL_LOW>;*/
-               vin2-supply = <&rt5190_buck1>;
-               vin3-supply = <&rt5190_buck1>;
-               vin4-supply = <&rt5190_buck1>;
-
-               regulators {
-                       rt5190_buck1: buck1 {
-                               regulator-name = "rt5190a-buck1";
-                               regulator-min-microvolt = <5090000>;
-                               regulator-max-microvolt = <5090000>;
-                               regulator-allowed-modes =
-                               <RT5190A_OPMODE_AUTO RT5190A_OPMODE_FPWM>;
-                               regulator-boot-on;
-                               regulator-always-on;
-                       };
-                       buck2 {
-                               regulator-name = "vcore";
-                               regulator-min-microvolt = <600000>;
-                               regulator-max-microvolt = <1400000>;
-                               regulator-boot-on;
-                               regulator-always-on;
-                       };
-                       rt5190_buck3: buck3 {
-                               regulator-name = "vproc";
-                               regulator-min-microvolt = <600000>;
-                               regulator-max-microvolt = <1400000>;
-                               regulator-boot-on;
-                       };
-                       buck4 {
-                               regulator-name = "rt5190a-buck4";
-                               regulator-min-microvolt = <850000>;
-                               regulator-max-microvolt = <850000>;
-                               regulator-allowed-modes =
-                               <RT5190A_OPMODE_AUTO RT5190A_OPMODE_FPWM>;
-                               regulator-boot-on;
-                               regulator-always-on;
-                       };
-                       ldo {
-                               regulator-name = "rt5190a-ldo";
-                               regulator-min-microvolt = <1200000>;
-                               regulator-max-microvolt = <1200000>;
-                               regulator-boot-on;
-                               regulator-always-on;
-                       };
-               };
-       };
-};
-
-&i2c1 {
-       pinctrl-names = "default";
-       pinctrl-0 = <&i2c1_pins>;
-       status = "okay";
-
-       system-leds@30 {
-               compatible = "srg,sysled";
-               reg = <0x30>;
-               #address-cells = <1>;
-               #size-cells = <0>;
-
-               led_sys_red: led@1 {
-                       label = "red";
-                       reg = <1>;
-               };
-
-               led_sys_green: led@2 {
-                       label = "green";
-                       reg = <2>;
-               };
-
-               led_sys_blue: led@3 {
-                       label = "blue";
-                       reg = <3>;
-               };
-
-               led_sys_white: led@4 {
-                       label = "white";
-                       reg = <4>;
-               };
-       };
-};
-
-&mdio_bus {
-       phy0: ethernet-phy@0 {
-               /* AQR113C */
-               compatible = "ethernet-phy-ieee802.3-c45";
-               reg = <0>;
-
-               reset-gpios = <&pio 62 GPIO_ACTIVE_LOW>;
-               reset-assert-us = <100000>;
-               reset-deassert-us = <1000000>;
-
-               leds {
-                       #address-cells = <1>;
-                       #size-cells = <0>;
-
-                       led@0 {
-                               reg = <0>;
-                               function = LED_FUNCTION_WAN;
-                               color = <LED_COLOR_ID_GREEN>;
-                       };
-
-                       led@1 {
-                               reg = <1>;
-                               function = LED_FUNCTION_WAN;
-                               color = <LED_COLOR_ID_ORANGE>;
-                       };
-
-                       led@2 {
-                               reg = <2>;
-                               function = LED_FUNCTION_WAN;
-                               color = <LED_COLOR_ID_WHITE>;
-                               active-high;
-                       };
-               };
-       };
-
-       phy8: ethernet-phy@8 {
-               /* AQR113C */
-               compatible = "ethernet-phy-ieee802.3-c45";
-               reg = <8>;
-
-               reset-gpios = <&pio 71 GPIO_ACTIVE_LOW>;
-               reset-assert-us = <100000>;
-               reset-deassert-us = <1000000>;
-
-               leds {
-                       #address-cells = <1>;
-                       #size-cells = <0>;
-
-                       aqr_green_led: led@0 {
-                               reg = <0>;
-                               function = LED_FUNCTION_LAN;
-                               color = <LED_COLOR_ID_GREEN>;
-                       };
-
-                       aqr_orange_led: led@1 {
-                               reg = <1>;
-                               function = LED_FUNCTION_LAN;
-                               color = <LED_COLOR_ID_ORANGE>;
-                       };
-
-                       aqr_white_led: led@2 {
-                               reg = <2>;
-                               function = LED_FUNCTION_LAN;
-                               color = <LED_COLOR_ID_WHITE>;
-                               active-high;
-                       };
-               };
-       };
-};
-
-&mmc0 {
-       pinctrl-names = "default", "state_uhs";
-       pinctrl-0 = <&mmc0_pins_emmc_51>;
-       pinctrl-1 = <&mmc0_pins_emmc_51>;
-       bus-width = <8>;
-       max-frequency = <200000000>;
-       cap-mmc-highspeed;
-       mmc-hs200-1_8v;
-       vmmc-supply = <&reg_3p3v>;
-       vqmmc-supply = <&reg_1p8v>;
-       non-removable;
-       no-sd;
-       no-sdio;
-       status = "okay";
-       #address-cells = <1>;
-       #size-cells = <0>;
-
-       card@0 {
-               compatible = "mmc-card";
-               reg = <0>;
-
-               block {
-                       compatible = "block-device";
-
-                       partitions {
-                               block-partition-factory {
-                                       partname = "factory";
-
-                                       nvmem-layout {
-                                               compatible = "fixed-layout";
-                                               #address-cells = <1>;
-                                               #size-cells = <1>;
-
-                                               eeprom_factory_0: eeprom@0 {
-                                                       reg = <0x0 0x1e00>;
-                                               };
-                                       };
-                               };
-
-                               block-partition-mfginfo {
-                                       partname = "mfginfo";
-
-                                       nvmem-layout {
-                                               compatible = "adtran,mfginfo";
-
-                                               macaddr: mfg-mac {
-                                                       #nvmem-cell-cells = <1>;
-                                               };
-                                       };
-                               };
-                       };
-               };
-       };
-};
-
-&pcie0 {
-       pinctrl-names = "default";
-       pinctrl-0 = <&pcie0_1_pins>;
-       reset-gpios = <&pio 7 GPIO_ACTIVE_LOW>;
-       status = "okay";
-
-       pcie@0,0 {
-               reg = <0x0000 0 0 0 0>;
-               #address-cells = <3>;
-               #size-cells = <2>;
-
-               wifi@0,0 {
-                       compatible = "mediatek,mt76";
-                       reg = <0x0000 0 0 0 0>;
-                       #address-cells = <1>;
-                       #size-cells = <0>;
-                       nvmem-cells = <&eeprom_factory_0>;
-                       nvmem-cell-names = "eeprom";
-                       ieee80211-freq-limit = <2400000 2500000>, <5170000 5835000>, <5945000 7125000>;
-
-                       band@0 {
-                               /* 2.4 GHz */
-                               reg = <0>;
-                               nvmem-cells = <&macaddr 4>;
-                               nvmem-cell-names = "mac-address";
-                       };
-
-                       band@1 {
-                               /* 5 GHz */
-                               reg = <1>;
-                               nvmem-cells = <&macaddr 10>;
-                               nvmem-cell-names = "mac-address";
-                       };
-
-                       band@2 {
-                               /* 6 GHz */
-                               reg = <2>;
-                               nvmem-cells = <&macaddr 6>;
-                               nvmem-cell-names = "mac-address";
-                       };
-               };
-       };
-};
-
-&pcie1 {
-       status = "okay";
-};
-
-&pcie2 {
-       status = "disabled";
-};
-
-&pcie3 {
-       status = "disabled";
-};
-
-&pio {
-       button_pins: button-pins {
-               pins = "GPIO_RESET", "GPIO_WPS";
-               bias-disable; /* bias-disable */
-       };
-
-       gbe1_led0_pins: gbe1-led0-pins {
-               mux {
-                       function = "led";
-                       groups = "gbe1_led0";
-               };
-       };
-
-       gbe2_led0_pins: gbe2-led0-pins {
-               mux {
-                       function = "led";
-                       groups = "gbe2_led0";
-               };
-       };
-
-       gbe3_led0_pins: gbe3-led0-pins {
-               mux {
-                       function = "led";
-                       groups = "gbe3_led0";
-               };
-       };
-
-       gbe1_led1_pins: gbe1-led1-pins {
-               mux {
-                       function = "led";
-                       groups = "gbe1_led1";
-               };
-       };
-
-       gbe2_led1_pins: gbe2-led1-pins {
-               mux {
-                       function = "led";
-                       groups = "gbe2_led1";
-               };
-       };
-
-       gbe3_led1_pins: gbe3-led1-pins {
-               mux {
-                       function = "led";
-                       groups = "gbe3_led1";
-               };
-       };
-
-       i2c0_pins: i2c0-g0-pins {
-               mux {
-                       function = "i2c";
-                       groups = "i2c0_1";
-               };
-       };
-
-       i2c1_pins: i2c1-g0-pins {
-               mux {
-                       function = "i2c";
-                       groups = "i2c1_0";
-               };
-       };
-
-       mdio0_pins: mdio0-pins {
-               mux {
-                       function = "eth";
-                       groups = "mdc_mdio0";
-               };
-
-               conf {
-                       groups = "mdc_mdio0";
-                       drive-strength = <MTK_DRIVE_8mA>;
-               };
-       };
-
-       mmc0_pins_emmc_51: mmc0-emmc-51-pins {
-               mux {
-                       function = "flash";
-                       groups = "emmc_51";
-               };
-       };
-
-       pcie0_1_pins: pcie0-pins-g1 {
-               mux {
-                       function = "pcie";
-                       groups = "pcie_2l_0_pereset", "pcie_clk_req_n0_0";
-               };
-       };
-
-       pwm_pins: pwm-pins {
-               mux {
-                       function = "pwm";
-                       groups = "pwm0", "pwm1";
-               };
-       };
-
-       sfp_i2c_pins: sfp-i2c-pins {
-               conf-scl {
-                       pins = "LED_A";
-                       drive-strength = <MTK_DRIVE_8mA>;
-                       bias-pull-up = <MTK_PUPD_SET_R1R0_01>;
-               };
-               conf-sda {
-                       pins = "LED_E";
-                       drive-strength = <MTK_DRIVE_8mA>;
-                       bias-disable;
-               };
-       };
-
-       uart1_pins: uart1-pins {
-               mux {
-                       function = "uart";
-                       groups = "uart1_2";
-               };
-       };
-
-       uart2_pins: uart2-pins {
-               mux {
-                       function = "uart";
-                       groups = "uart2";
-               };
-       };
-};
-
-&pwm {
-       pinctrl-names = "default";
-       pinctrl-0 = <&pwm_pins>;
-       status = "okay";
-};
-
-&ssusb0 {
-       status = "okay";
-};
-
-&ssusb1 {
-       status = "okay";
-};
-
-&switch {
-       status = "okay";
-
-       ports {
-               port@0 {
-                       status = "disabled";
-               };
-
-               port@1 {
-                       label = "lan2";
-               };
-
-               port@2 {
-                       label = "lan3";
-               };
-
-               port@3 {
-                       label = "lan4";
-               };
-       };
-};
-
-&tphy {
-       status = "okay";
-};
-
-&serial0 {
-       status = "okay";
-};
-
-&serial1 {
-       pinctrl-names = "default";
-       pinctrl-0 = <&uart1_pins>;
-       status = "okay";
-
-       /* Airoha AG3352 GPS */
-};
-
-&serial2 {
-       pinctrl-names = "default";
-       pinctrl-0 = <&uart2_pins>;
-       status = "okay";
-
-       /* DA14531MOD Bluetooth */
-};
-
-&watchdog {
-       status = "okay";
-};
-
-&xsphy {
-       status = "okay";
-};
index 9d2e8b9df816da822173c5f6b9d5412c1c9636b6..9b4f4956b86fba3080efbc87c7ce2ba554adebaf 100644 (file)
@@ -4,20 +4,32 @@
  * Author: Chad Monroe <chad.monroe@smartrg.com>
  */
 
-#include "mt7988a-smartrg-mt-stuart.dtsi"
+#include "mt7988-smartrg-base.dtsi"
+#include "mt7988-smartrg-sysled.dtsi"
+#include "mt7988-smartrg-wifi-pcie3.dtsi"
+#include "mt7988-smartrg-wifi-mt7995.dtsi"
 
 / {
        model = "SmartRG SDG-8733A";
        compatible = "smartrg,sdg-8733a", "mediatek,mt7988d";
 
+       aliases {
+               label-mac-device = &gmac1;
+       };
+
        cpus {
                /delete-node/ cpu@3;
        };
 
-       /delete-node/ gpio-export;
-       /delete-node/ gpio-leds;
+       gpio-keys {
+               button-sync {
+                       label = "sync";
+                       linux,code = <KEY_WPS_BUTTON>;
+                       gpios = <&pio 14 GPIO_ACTIVE_LOW>;
+               };
+       };
 
-       gpio-export {
+       gpio_export: gpio-export {
                compatible = "gpio-export";
 
                bluetooth_reset: bluetooth-reset {
                };
        };
 
-       gpio-leds {
+       fan: pwm-fan {
+               compatible = "pwm-fan";
+               #cooling-cells = <2>;
+               #thermal-sensor-cells = <1>;
+
+               pwms = <&pwm 1 40000 0>;
+
+               /**
+                * set fan speed
+                *
+                * 0 = off
+                * 61 = 24% duty cycle
+                * 77 = 30% duty cycle
+                * 102 = 40% duty cycle
+                * 128 - 50% duty cycle
+                * 255 = 100% duty cycle
+                */
+               cooling-levels = <61 77 102 128>;
+
+               interrupt-parent = <&pio>;
+               interrupts = <57 IRQ_TYPE_EDGE_FALLING>;
+               pulses-per-revolution = <2>;
+
+               status = "okay";
+       };
+
+       leds: gpio-leds {
                compatible = "gpio-leds";
 
                lan_amber {
                        gpios = <&pio 60 GPIO_ACTIVE_HIGH>;
                };
        };
-};
 
-&fan {
-       pwms = <&pwm 1 40000 0>;
+       thermal-zones {
+               cpu_thermal: cpu-thermal {
+                       thermal-sensors = <&lvts 0>;
+                       SDG_1FAN_THERMAL_MAP(cpu_thermal, &fan,
+                                            125000, 120000,
+                                            110000, 80000,
+                                            60000, 40000);
+               };
+
+       };
+};
 
-       interrupts = <57 IRQ_TYPE_EDGE_FALLING>;
+&button_pins {
+       pins = "GPIO_RESET", "GPIO_WPS";
 };
 
 &gmac0 {
 };
 
 &gmac1 {
-       label = "lan";
-       nvmem-cells = <&macaddr 1>;
+       nvmem-cells = <&macaddr 0x1>;
        nvmem-cell-names = "mac-address";
+       label = "lan";
        phy-mode = "internal";
        phy = <&int_2p5g_phy>;
+
+       status = "okay";
 };
 
 &gmac2 {
-       label = "wan";
-       nvmem-cells = <&macaddr 0>;
+       nvmem-cells = <&macaddr 0x0>;
        nvmem-cell-names = "mac-address";
+       label = "wan";
        phy-mode = "usxgmii";
        phy = <&phy8>;
+
+       status = "okay";
 };
 
 &int_2p5g_phy {
        pinctrl-0 = <&i2p5gbe_led0_pins>;
 };
 
+&i2p5gbe_led0 {
+       color = <LED_COLOR_ID_GREEN>;
+       function = LED_FUNCTION_LAN;
+       status = "okay";
+};
+
 &mdio_bus {
-       /delete-node/ ethernet-phy@0;
+       phy8: ethernet-phy@8 {
+               /* AQR113C */
+               compatible = "ethernet-phy-ieee802.3-c45";
+               reg = <8>;
+
+               reset-gpios = <&pio 62 GPIO_ACTIVE_LOW>;
+               reset-assert-us = <100000>;
+               reset-deassert-us = <1000000>;
+
+               marvell,mdi-cfg-order = <0>;
+
+               leds {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+
+                       led@0 {
+                               reg = <0>;
+                               function = LED_FUNCTION_WAN;
+                               color = <LED_COLOR_ID_GREEN>;
+                       };
+
+                       led@1 {
+                               reg = <1>;
+                               function = LED_FUNCTION_WAN;
+                               color = <LED_COLOR_ID_ORANGE>;
+                       };
+
+                       led@2 {
+                               reg = <2>;
+                               function = LED_FUNCTION_WAN;
+                               color = <LED_COLOR_ID_WHITE>;
+                               active-high;
+                       };
+               };
+       };
+};
+
+&pcie0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pcie0_1_pins>;
+       reset-gpios = <&pio 9 GPIO_ACTIVE_HIGH>;
 };
 
 &pio {
                };
        };
 
-       pcie3_1_pins: pcie3-pins-g1 {
+       pcie0_1_pins: pcie0-pins-g1 {
                mux {
                        function = "pcie";
-                       groups = "pcie_1l_1_pereset", "pcie_clk_req_n3";
+                       groups = "pcie_2l_0_pereset", "pcie_clk_req_n0_0";
                };
        };
-};
 
-&pcie0 {
-       reset-gpios = <&pio 9 GPIO_ACTIVE_HIGH>;
-};
+       pwm_pins: pwm-pins {
+               mux {
+                       function = "pwm";
+                       groups = "pwm0", "pwm1";
+               };
+       };
 
-&pcie1 {
-       status = "disabled";
+       uart2_pins: uart2-pins {
+               mux {
+                       function = "uart";
+                       groups = "uart2";
+               };
+       };
 };
 
-&pcie3 {
+&pwm {
        pinctrl-names = "default";
-       pinctrl-0 = <&pcie3_1_pins>;
+       pinctrl-0 = <&pwm_pins>;
        status = "okay";
 };
 
-&phy8 {
-       reset-gpios = <&pio 62 GPIO_ACTIVE_LOW>;
-       marvell,mdi-cfg-order = <0>;
-};
-
-&aqr_green_led {
-       function = LED_FUNCTION_WAN;
-};
-
-&aqr_orange_led {
-       function = LED_FUNCTION_WAN;
-};
-
-&aqr_white_led {
-       function = LED_FUNCTION_WAN;
-};
-
-&i2p5gbe_led0 {
-       color = <LED_COLOR_ID_GREEN>;
-       function = LED_FUNCTION_LAN;
+&serial2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&uart2_pins>;
        status = "okay";
-};
 
-&ssusb0 {
-       status = "disabled";
-};
-
-&ssusb1 {
-       status = "disabled";
+       /* DA14531MOD Bluetooth */
 };
 
 &switch {
        status = "disabled";
 };
-
-&tphy {
-       status = "disabled";
-};
-
-&serial1 {
-       status = "disabled";
-};
-
-&xsphy {
-       status = "disabled";
-};
diff --git a/target/linux/mediatek/dts/mt798x-smartrg-common.dtsi b/target/linux/mediatek/dts/mt798x-smartrg-common.dtsi
new file mode 100644 (file)
index 0000000..38d6673
--- /dev/null
@@ -0,0 +1,95 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2025 SmartRG Inc.
+ * Author: Piotr Kubik <piotr.kubik@adtran.com>
+ */
+
+#define SDG_THERMAL_HEADER                                                                     \
+       polling-delay-passive = <1000>;                                                         \
+       polling-delay = <1000>;                                                                 \
+       /delete-node/cooling-maps;                                                              \
+       /delete-node/trips;
+
+#define SDG_THERMAL_TRIPS(_cname, _crit, _hot, _high, _med, _low, _silent)                     \
+       trips {                                                                                 \
+               _cname##_critical: critical {                                                   \
+                       temperature = <_crit>;                                                  \
+                       hysteresis = <2000>;                                                    \
+                       type = "critical";                                                      \
+               };                                                                              \
+               _cname##_hot: hot {                                                             \
+                       temperature = <_hot>;                                                   \
+                       hysteresis = <2000>;                                                    \
+                       type = "hot";                                                           \
+               };                                                                              \
+               _cname##_active_high: active-high {                                             \
+                       temperature = <_high>;                                                  \
+                       hysteresis = <2000>;                                                    \
+                       type = "active";                                                        \
+               };                                                                              \
+               _cname##_active_med: active-med {                                               \
+                       temperature = <_med>;                                                   \
+                       hysteresis = <2000>;                                                    \
+                       type = "active";                                                        \
+               };                                                                              \
+               _cname##_active_low: active-low {                                               \
+                       temperature = <_low>;                                                   \
+                       hysteresis = <2000>;                                                    \
+                       type = "active";                                                        \
+               };                                                                              \
+               _cname##_active_silent: active-silent {                                         \
+                       temperature = <_silent>;                                                \
+                       hysteresis = <2000>;                                                    \
+                       type = "active";                                                        \
+               };                                                                              \
+       };
+
+#define SDG_COOLING_MAP_1FAN(_cname, _fan0)                                                    \
+       cooling-maps {                                                                          \
+               map3 {                                                                          \
+                       trip = <&_cname##_active_high>;                                         \
+                       cooling-device = <_fan0 3 3>;                                           \
+               };                                                                              \
+               map2 {                                                                          \
+                       trip = <&_cname##_active_med>;                                          \
+                       cooling-device = <_fan0 2 2>;                                           \
+               };                                                                              \
+               map1 {                                                                          \
+                       trip = <&_cname##_active_low>;                                          \
+                       cooling-device = <_fan0 1 1>;                                           \
+               };                                                                              \
+               map0 {                                                                          \
+                       trip = <&_cname##_active_silent>;                                       \
+                       cooling-device = <_fan0 0 0>;                                           \
+               };                                                                              \
+       }
+
+#define SDG_COOLING_MAP_2FAN(_cname, _fan0, _fan1)                                             \
+       cooling-maps {                                                                          \
+               map3 {                                                                          \
+                       trip = <&_cname##_active_high>;                                         \
+                       cooling-device = <_fan0 3 3>, <_fan1 3 3>;                              \
+               };                                                                              \
+               map2 {                                                                          \
+                       trip = <&_cname##_active_med>;                                          \
+                       cooling-device = <_fan0 2 2>, <_fan1 2 2>;                              \
+               };                                                                              \
+               map1 {                                                                          \
+                       trip = <&_cname##_active_low>;                                          \
+                       cooling-device = <_fan0 1 1>, <_fan1 1 1>;                              \
+               };                                                                              \
+               map0 {                                                                          \
+                       trip = <&_cname##_active_silent>;                                       \
+                       cooling-device = <_fan0 0 0>, <_fan1 0 0>;                              \
+               };                                                                              \
+       }
+
+#define SDG_1FAN_THERMAL_MAP(_cname, _fan0, _crit, _hot, _high, _med, _low, _silent)           \
+       SDG_THERMAL_HEADER                                                                      \
+       SDG_THERMAL_TRIPS(_cname, _crit, _hot, _high, _med, _low, _silent)                      \
+       SDG_COOLING_MAP_1FAN(_cname, _fan0)
+
+#define SDG_2FAN_THERMAL_MAP(_cname, _fan0, _fan1, _crit, _hot, _high, _med, _low, _silent)    \
+       SDG_THERMAL_HEADER                                                                      \
+       SDG_THERMAL_TRIPS(_cname, _crit, _hot, _high, _med, _low, _silent)                      \
+       SDG_COOLING_MAP_2FAN(_cname, _fan0, _fan1)
diff --git a/target/linux/mediatek/dts/mt798x-smartrg-factory.dtsi b/target/linux/mediatek/dts/mt798x-smartrg-factory.dtsi
new file mode 100644 (file)
index 0000000..1752d70
--- /dev/null
@@ -0,0 +1,38 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * eMMC factory partition layout common to every SmartRG SKU with an
+ * mt799x PCIe radio (MT7987 and MT7988 hosts): the radio eeprom cell
+ * and the mfginfo MAC provider. Include after the dtsi defining
+ * &emmc_block. MT7981/MT7986 SKUs use the built-in wifi layout
+ * (0x1000 eeprom) and do not fit here.
+ */
+
+&emmc_block {
+       partitions {
+               block-partition-factory {
+                       partname = "factory";
+
+                       factory_layout: nvmem-layout {
+                               compatible = "fixed-layout";
+                               #address-cells = <1>;
+                               #size-cells = <1>;
+
+                               eeprom_factory_0: eeprom@0 {
+                                       reg = <0x0 0x1e00>;
+                               };
+                       };
+               };
+
+               block-partition-mfginfo {
+                       partname = "mfginfo";
+
+                       nvmem-layout {
+                               compatible = "adtran,mfginfo";
+
+                               macaddr: mfg-mac {
+                                       #nvmem-cell-cells = <1>;
+                               };
+                       };
+               };
+       };
+};