From c8a3e6838ad70c8613b5221641b36a79a9967137 Mon Sep 17 00:00:00 2001 From: AmadeusGhost <42570690+AmadeusGhost@users.noreply.github.com> Date: Wed, 27 May 2020 16:10:51 +0800 Subject: [PATCH] ramips: dir878/jdcloud: convert to DSA --- .../ramips/dts/mt7621_dlink_dir-878-a1.dts | 52 ++++++++++++++----- .../ramips/dts/mt7621_jdcloud_re-sp-01b.dts | 31 ++++++++--- target/linux/ramips/image/mt7621.mk | 7 +-- .../mt7621/base-files/etc/board.d/01_leds | 3 +- 4 files changed, 71 insertions(+), 22 deletions(-) diff --git a/target/linux/ramips/dts/mt7621_dlink_dir-878-a1.dts b/target/linux/ramips/dts/mt7621_dlink_dir-878-a1.dts index 305dbdbd57..25136fbdc4 100644 --- a/target/linux/ramips/dts/mt7621_dlink_dir-878-a1.dts +++ b/target/linux/ramips/dts/mt7621_dlink_dir-878-a1.dts @@ -15,7 +15,7 @@ led-failsafe = &led_power_green; led-running = &led_power_green; led-upgrade = &led_net_orange; - label-mac-device = ðernet; + label-mac-device = &gmac0; }; chosen { @@ -27,22 +27,22 @@ led_power_orange: power_orange { label = "dir-878-a1:orange:power"; - gpios = <&gpio0 8 GPIO_ACTIVE_LOW>; + gpios = <&gpio 8 GPIO_ACTIVE_LOW>; }; led_power_green: power_green { label = "dir-878-a1:green:power"; - gpios = <&gpio0 16 GPIO_ACTIVE_LOW>; + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; }; led_net_orange: net_orange { label = "dir-878-a1:orange:net"; - gpios = <&gpio0 4 GPIO_ACTIVE_LOW>; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; }; net_green { label = "dir-878-a1:green:net"; - gpios = <&gpio0 3 GPIO_ACTIVE_LOW>; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; }; }; @@ -51,19 +51,19 @@ reset { label = "reset"; - gpios = <&gpio0 15 GPIO_ACTIVE_LOW>; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; linux,code = ; }; wps { label = "wps"; - gpios = <&gpio0 18 GPIO_ACTIVE_LOW>; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; linux,code = ; }; wifi { label = "wifi"; - gpios = <&gpio0 7 GPIO_ACTIVE_LOW>; + gpios = <&gpio 7 GPIO_ACTIVE_LOW>; linux,code = ; }; }; @@ -76,7 +76,6 @@ compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <50000000>; - m25p,fast-read; partitions { compatible = "fixed-partitions"; @@ -140,14 +139,43 @@ }; }; -ðernet { +&gmac0 { mtd-mac-address = <&factory 0xe000>; - mediatek,portmap = "llllw"; +}; + +&switch0 { + ports { + port@0 { + status = "okay"; + label = "lan4"; + }; + + port@1 { + status = "okay"; + label = "lan3"; + }; + + port@2 { + status = "okay"; + label = "lan2"; + }; + + port@3 { + status = "okay"; + label = "lan1"; + }; + + port@4 { + status = "okay"; + label = "wan"; + mtd-mac-address = <&factory 0xe006>; + }; + }; }; &state_default { gpio { - groups = "i2c", "uart3", "jtag", "wdt"; + groups = "uart3", "jtag", "wdt"; function = "gpio"; }; }; diff --git a/target/linux/ramips/dts/mt7621_jdcloud_re-sp-01b.dts b/target/linux/ramips/dts/mt7621_jdcloud_re-sp-01b.dts index 603fbc96e1..48bcc6cd7e 100644 --- a/target/linux/ramips/dts/mt7621_jdcloud_re-sp-01b.dts +++ b/target/linux/ramips/dts/mt7621_jdcloud_re-sp-01b.dts @@ -15,7 +15,7 @@ led-failsafe = &led_red; led-running = &led_green; led-upgrade = &led_blue; - label-mac-device = ðernet; + label-mac-device = &gmac0; }; chosen { @@ -27,7 +27,7 @@ reset { label = "reset"; - gpios = <&gpio0 18 GPIO_ACTIVE_LOW>; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; linux,code = ; }; }; @@ -37,18 +37,18 @@ led_red: red { label = "jdcloud:red:sys"; - gpios = <&gpio0 6 GPIO_ACTIVE_LOW>; + gpios = <&gpio 6 GPIO_ACTIVE_LOW>; panic-indicator; }; led_green: green { label = "jdcloud:green:sys"; - gpios = <&gpio0 8 GPIO_ACTIVE_LOW>; + gpios = <&gpio 8 GPIO_ACTIVE_LOW>; }; led_blue: blue { label = "jdcloud:blue:sys"; - gpios = <&gpio0 12 GPIO_ACTIVE_LOW>; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; }; }; }; @@ -109,10 +109,29 @@ }; }; -ðernet { +&gmac0 { mtd-mac-address-ascii = <&config 0x4429>; }; +&switch0 { + ports { + port@0 { + status = "okay"; + label = "wan"; + }; + + port@1 { + status = "okay"; + label = "lan1"; + }; + + port@2 { + status = "okay"; + label = "lan2"; + }; + }; +}; + &pcie { status = "okay"; }; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index e9f8e78b59..110615b125 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -235,13 +235,13 @@ define Device/dlink_dir-878-a1 BLOCKSIZE := 64k IMAGE_SIZE := 16000k DEVICE_VENDOR := D-Link - IMAGES += factory.bin DEVICE_MODEL := DIR-878 DEVICE_VARIANT := A1 DEVICE_PACKAGES := kmod-mt7615e wpad-openssl KERNEL_INITRAMFS := $$(KERNEL) | ubootpad96 + IMAGES += factory.bin IMAGE/sysupgrade.bin := append-kernel | append-rootfs | ubootpad96 |\ - pad-rootfs | check-size $$$$(IMAGE_SIZE) | append-metadata + pad-rootfs | check-size $$$$(IMAGE_SIZE) | append-metadata IMAGE/factory.bin := append-kernel | append-rootfs | ubootpad96 |\ check-size $$$$(IMAGE_SIZE) endef @@ -482,7 +482,8 @@ define Device/jdcloud_re-sp-01b IMAGE_SIZE := 27328k DEVICE_VENDOR := JDCloud DEVICE_MODEL := RE-SP-01B - DEVICE_PACKAGES := kmod-fs-ext4 kmod-mt7603 kmod-mt7615e kmod-sdhci-mt7620 kmod-usb3 wpad-openssl + DEVICE_PACKAGES := kmod-fs-ext4 kmod-mt7603 kmod-mt7615e kmod-sdhci-mt7620 \ + kmod-usb3 wpad-openssl endef TARGET_DEVICES += jdcloud_re-sp-01b diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds index fdfd29d011..96fa0c7014 100755 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds @@ -26,7 +26,8 @@ d-team,pbr-m1|\ gehua,ghl-r-001) ucidef_set_led_netdev "internet" "internet" "$boardname:blue:internet" "wan" ;; -dlink,dir-860l-b1) +dlink,dir-860l-b1|\ +dlink,dir-878-a1) ucidef_set_led_netdev "wan" "wan" "$boardname:green:net" "wan" ;; gnubee,gb-pc1|\