mediatek: add prpl,mozart platform
authorJohn Crispin <john@phrozen.org>
Sat, 21 Sep 2024 07:48:47 +0000 (09:48 +0200)
committerJohn Crispin <john@phrozen.org>
Wed, 23 Oct 2024 12:14:38 +0000 (14:14 +0200)
Signed-off-by: John Crispin <john@phrozen.org>
target/linux/mediatek/dts/mt7988a-prpl-mozart.dts [new file with mode: 0644]
target/linux/mediatek/filogic/base-files/etc/board.d/02_network
target/linux/mediatek/image/filogic.mk

diff --git a/target/linux/mediatek/dts/mt7988a-prpl-mozart.dts b/target/linux/mediatek/dts/mt7988a-prpl-mozart.dts
new file mode 100644 (file)
index 0000000..44caa31
--- /dev/null
@@ -0,0 +1,295 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+
+/dts-v1/;
+#include "mt7988a-rfb.dts"
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/leds/common.h>
+
+/ {
+       compatible = "prpl,mozart", "mediatek,mt7988a";
+       model = "PrplOS Mozart board";
+
+       aliases {
+               serial0 = &uart0;
+               led-boot = &led_status_blue;
+               led-failsafe = &led_status_red;
+               led-running = &led_status_green;
+               led-upgrade = &led_status_green;
+       };
+
+       chosen {
+               rootdisk = <&emmc_rootfs>;
+       };
+
+       gpio-leds {
+               compatible = "gpio-leds";
+
+               wifi_white {
+                       color = <LED_COLOR_ID_WHITE>;
+                       function = LED_FUNCTION_STATUS;
+                       gpios = <&pio 68 GPIO_ACTIVE_HIGH>;
+               };
+
+               led_status_red: wifi_red {
+                       color = <LED_COLOR_ID_RED>;
+                       function = LED_FUNCTION_STATUS;
+                       gpios = <&pio 29 GPIO_ACTIVE_HIGH>;
+               };
+
+               led_status_green: wifi_green {
+                       color = <LED_COLOR_ID_GREEN>;
+                       function = LED_FUNCTION_STATUS;
+                       gpios = <&pio 30 GPIO_ACTIVE_HIGH>;
+               };
+
+               led_status_blue: wifi_blue {
+                       color = <LED_COLOR_ID_BLUE>;
+                       function = LED_FUNCTION_STATUS;
+                       gpios = <&pio 31 GPIO_ACTIVE_HIGH>;
+               };
+       };
+
+       keys {
+               compatible = "gpio-keys";
+
+               button-reset {
+                       label = "reset";
+                       linux,code = <KEY_RESTART>;
+                       gpios = <&pio 13 GPIO_ACTIVE_LOW>;
+               };
+       };
+};
+
+&pio {
+       mdio0_pins: mdio0-pins {
+               mux {
+                       function = "eth";
+                       groups = "mdc_mdio0";
+               };
+
+               conf {
+                       groups = "mdc_mdio0";
+                       drive-strength = <MTK_DRIVE_10mA>;
+               };
+       };
+
+       spic_pins: spi1-pins {
+               mux {
+                       function = "spi";
+                       groups = "spi1";
+               };
+       };
+};
+
+&usxgmiisys0 {
+       mediatek,pn_swap_rx;
+};
+
+&usxgmiisys1 {
+       mediatek,pn_swap_rx;
+};
+
+&mdio_bus {
+       #address-cells = <1>;
+       #size-cells = <0>;
+       reset-gpios = <&pio 72 1>;
+       reset-delay-us = <40000>;
+
+       /* external Realtek RTL8261N */
+       phy0: ethernet-phy@0 {
+               reg = <0>;
+               compatible = "ethernet-phy-ieee802.3-c45";
+       };
+
+       phy8: ethernet-phy@8 {
+               reg = <8>;
+               compatible = "ethernet-phy-ieee802.3-c45";
+       };
+};
+
+&gmac1 {
+       phy-mode = "usxgmii";
+       phy-connection-type = "usxgmii";
+       phy = <&phy0>;
+       status = "okay";
+};
+
+&gmac2 {
+       phy-mode = "usxgmii";
+       phy-connection-type = "usxgmii";
+       phy = <&phy8>;
+       status = "okay";
+};
+
+&switch {
+       /delete-node/ports;
+
+       ports {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               gsw_port0: port@0 {
+                       reg = <0>;
+                       label = "lan0";
+                       phy-mode = "internal";
+                       phy-handle = <&gsw_phy0>;
+               };
+
+               port@6 {
+                       reg = <6>;
+                       ethernet = <&gmac0>;
+                       phy-mode = "internal";
+
+                       fixed-link {
+                               speed = <10000>;
+                               full-duplex;
+                               pause;
+                       };
+               };
+       };
+};
+
+&i2c1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&i2c1_pins>;
+       clock-frequency = <100000>;
+       status = "okay";
+
+       icp201xx@63{
+               compatible = "invensense,icp201xx";
+               reg = <0x63>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+       };
+};
+
+&uart1 {
+       status = "okay";
+};
+
+&fan {
+       pwms = <&pwm 1 40000 0>;
+       //cooling-levels = <255 175 128 0>;
+       //cooling-levels = <80 60 40 0>;
+       status = "okay";
+};
+
+&pwm {
+       status = "okay";
+};
+
+&spi1 {
+       pinctrl-names = "default";
+       /* pin shared with snfi */
+       pinctrl-0 = <&spic_pins>;
+       status = "disabled";
+};
+
+&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;
+       mmc-hs400-1_8v;
+       hs400-ds-delay = <0x12814>;
+       vqmmc-supply = <&reg_1p8v>;
+       vmmc-supply = <&reg_3p3v>;
+       non-removable;
+       no-sd;
+       no-sdio;
+       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-layout";
+                                       };
+                               };
+
+                               emmc_rootfs: block-partition-production {
+                                       partname = "production";
+                               };
+                       };
+               };
+       };
+};
+
+&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>;
+               };
+       };
+};
index af5c4ceafee13113faae6c032ae05c4931fa53f5..7999f10d4943b16befb023dcb8ce1d2b1779b8f4 100644 (file)
@@ -94,6 +94,9 @@ mediatek_setup_interfaces()
        mercusys,mr90x-v1)
                ucidef_set_interfaces_lan_wan "lan0 lan1 lan2" eth1
                ;;
+       prpl,mozart)
+               ucidef_set_interfaces_lan_wan "lan0 eth1" eth2
+               ;;
        smartrg,sdg-8622|\
        smartrg,sdg-8632|\
        smartrg,sdg-8733a|\
index ac535aeaa0f8d12e325405fa14b68546f4b2f387..9f4d4c83d0cf4e2f0b73a1c3006f9ba94a612859 100644 (file)
@@ -383,9 +383,10 @@ define Device/bananapi_bpi-r4-common
   KERNEL_LOADADDR := 0x46000000
   KERNEL_INITRAMFS_SUFFIX := -recovery.itb
   ARTIFACTS := \
-              emmc-preloader.bin emmc-bl31-uboot.fip \
+              emmc-preloader.bin emmc-bl31-uboot.fip emmc-gpt.bin \
               sdcard.img.gz \
               snand-preloader.bin snand-bl31-uboot.fip
+  ARTIFACT/emmc-gpt.bin := mt798x-gpt emmc
   ARTIFACT/emmc-preloader.bin  := mt7988-bl2 emmc-comb
   ARTIFACT/emmc-bl31-uboot.fip := mt7988-bl31-uboot $$(DEVICE_NAME)-emmc
   ARTIFACT/snand-preloader.bin := mt7988-bl2 spim-nand-ubi-comb
@@ -1097,6 +1098,30 @@ define Device/openwrt_one
 endef
 TARGET_DEVICES += openwrt_one
 
+define Device/prpl_mozart
+  DEVICE_VENDOR := Prpl
+  DEVICE_MODEL := Mozart
+  DEVICE_DTS := mt7988a-prpl-mozart
+  DEVICE_DTS_DIR := ../dts
+  DEVICE_DTC_FLAGS := --pad 4096
+  DEVICE_DTS_LOADADDR := 0x45f00000
+  DEVICE_PACKAGES := kmod-hwmon-pwmfan e2fsprogs f2fsck mkf2fs kmod-mt7996-firmware
+  KERNEL_LOADADDR := 0x46000000
+  KERNEL := kernel-bin | gzip
+  KERNEL_INITRAMFS := kernel-bin | lzma | \
+        fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k
+  KERNEL_INITRAMFS_SUFFIX := .itb
+  IMAGE_SIZE := $$(shell expr 64 + $$(CONFIG_TARGET_ROOTFS_PARTSIZE))m
+  IMAGES := sysupgrade.itb
+  IMAGE/sysupgrade.itb := append-kernel | fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-with-rootfs | pad-rootfs | append-metadata
+  ARTIFACTS := emmc-preloader.bin emmc-bl31-uboot.fip emmc-gpt.bin
+  ARTIFACT/emmc-gpt.bin := mt798x-gpt emmc
+  ARTIFACT/emmc-preloader.bin  := mt7988-bl2 emmc-comb
+  ARTIFACT/emmc-bl31-uboot.fip := mt7988-bl31-uboot prpl_mozart
+  SUPPORTED_DEVICES += prpl,mozart
+endef
+TARGET_DEVICES += prpl_mozart
+
 define Device/qihoo_360t7
   DEVICE_VENDOR := Qihoo
   DEVICE_MODEL := 360T7