From 372ee1919d281dd3e86121996805291a6948c982 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Wed, 17 Aug 2022 11:04:29 +0200 Subject: [PATCH 01/28] kernel: rename 5.20 patches to 6.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rafał Miłecki --- ...411-v6.0-mtd-parsers-add-support-for-Sercomm-partitions.patch} | 0 ...xt-mtd-core-introduce-of-support-for-dynamic-partitions.patch} | 0 ...001-dt-bindings-leds-add-Broadcom-s-BCM63138-controller.patch} | 0 ...-0002-leds-bcm63138-add-support-for-BCM63138-controller.patch} | 0 ...01-dt-bindings-leds-leds-bcm63138-unify-full-stops-in-d.patch} | 0 ...v6.0-0002-leds-add-help-info-about-BCM63138-module-name.patch} | 0 ... => 846-v6.0-0003-leds-leds-bcm63138-get-rid-of-LED_OFF.patch} | 0 ...401-v6.0-mtd-parsers-add-support-for-Sercomm-partitions.patch} | 0 ...xt-mtd-core-introduce-of-support-for-dynamic-partitions.patch} | 0 ...001-dt-bindings-leds-add-Broadcom-s-BCM63138-controller.patch} | 0 ...-0002-leds-bcm63138-add-support-for-BCM63138-controller.patch} | 0 ...01-dt-bindings-leds-leds-bcm63138-unify-full-stops-in-d.patch} | 0 ...v6.0-0002-leds-add-help-info-about-BCM63138-module-name.patch} | 0 ... => 801-v6.0-0003-leds-leds-bcm63138-get-rid-of-LED_OFF.patch} | 0 14 files changed, 0 insertions(+), 0 deletions(-) rename target/linux/generic/backport-5.10/{411-v5.20-mtd-parsers-add-support-for-Sercomm-partitions.patch => 411-v6.0-mtd-parsers-add-support-for-Sercomm-partitions.patch} (100%) rename target/linux/generic/backport-5.10/{413-v5.20-mtd-next-mtd-core-introduce-of-support-for-dynamic-partitions.patch => 413-v6.0-mtd-next-mtd-core-introduce-of-support-for-dynamic-partitions.patch} (100%) rename target/linux/generic/backport-5.10/{845-v5.20-0001-dt-bindings-leds-add-Broadcom-s-BCM63138-controller.patch => 845-v6.0-0001-dt-bindings-leds-add-Broadcom-s-BCM63138-controller.patch} (100%) rename target/linux/generic/backport-5.10/{845-v5.20-0002-leds-bcm63138-add-support-for-BCM63138-controller.patch => 845-v6.0-0002-leds-bcm63138-add-support-for-BCM63138-controller.patch} (100%) rename target/linux/generic/backport-5.10/{846-v5.20-0001-dt-bindings-leds-leds-bcm63138-unify-full-stops-in-d.patch => 846-v6.0-0001-dt-bindings-leds-leds-bcm63138-unify-full-stops-in-d.patch} (100%) rename target/linux/generic/backport-5.10/{846-v5.20-0002-leds-add-help-info-about-BCM63138-module-name.patch => 846-v6.0-0002-leds-add-help-info-about-BCM63138-module-name.patch} (100%) rename target/linux/generic/backport-5.10/{846-v5.20-0003-leds-leds-bcm63138-get-rid-of-LED_OFF.patch => 846-v6.0-0003-leds-leds-bcm63138-get-rid-of-LED_OFF.patch} (100%) rename target/linux/generic/backport-5.15/{401-v5.20-mtd-parsers-add-support-for-Sercomm-partitions.patch => 401-v6.0-mtd-parsers-add-support-for-Sercomm-partitions.patch} (100%) rename target/linux/generic/backport-5.15/{402-v5.20-mtd-next-mtd-core-introduce-of-support-for-dynamic-partitions.patch => 402-v6.0-mtd-next-mtd-core-introduce-of-support-for-dynamic-partitions.patch} (100%) rename target/linux/generic/backport-5.15/{800-v5.20-0001-dt-bindings-leds-add-Broadcom-s-BCM63138-controller.patch => 800-v6.0-0001-dt-bindings-leds-add-Broadcom-s-BCM63138-controller.patch} (100%) rename target/linux/generic/backport-5.15/{800-v5.20-0002-leds-bcm63138-add-support-for-BCM63138-controller.patch => 800-v6.0-0002-leds-bcm63138-add-support-for-BCM63138-controller.patch} (100%) rename target/linux/generic/backport-5.15/{801-v5.20-0001-dt-bindings-leds-leds-bcm63138-unify-full-stops-in-d.patch => 801-v6.0-0001-dt-bindings-leds-leds-bcm63138-unify-full-stops-in-d.patch} (100%) rename target/linux/generic/backport-5.15/{801-v5.20-0002-leds-add-help-info-about-BCM63138-module-name.patch => 801-v6.0-0002-leds-add-help-info-about-BCM63138-module-name.patch} (100%) rename target/linux/generic/backport-5.15/{801-v5.20-0003-leds-leds-bcm63138-get-rid-of-LED_OFF.patch => 801-v6.0-0003-leds-leds-bcm63138-get-rid-of-LED_OFF.patch} (100%) diff --git a/target/linux/generic/backport-5.10/411-v5.20-mtd-parsers-add-support-for-Sercomm-partitions.patch b/target/linux/generic/backport-5.10/411-v6.0-mtd-parsers-add-support-for-Sercomm-partitions.patch similarity index 100% rename from target/linux/generic/backport-5.10/411-v5.20-mtd-parsers-add-support-for-Sercomm-partitions.patch rename to target/linux/generic/backport-5.10/411-v6.0-mtd-parsers-add-support-for-Sercomm-partitions.patch diff --git a/target/linux/generic/backport-5.10/413-v5.20-mtd-next-mtd-core-introduce-of-support-for-dynamic-partitions.patch b/target/linux/generic/backport-5.10/413-v6.0-mtd-next-mtd-core-introduce-of-support-for-dynamic-partitions.patch similarity index 100% rename from target/linux/generic/backport-5.10/413-v5.20-mtd-next-mtd-core-introduce-of-support-for-dynamic-partitions.patch rename to target/linux/generic/backport-5.10/413-v6.0-mtd-next-mtd-core-introduce-of-support-for-dynamic-partitions.patch diff --git a/target/linux/generic/backport-5.10/845-v5.20-0001-dt-bindings-leds-add-Broadcom-s-BCM63138-controller.patch b/target/linux/generic/backport-5.10/845-v6.0-0001-dt-bindings-leds-add-Broadcom-s-BCM63138-controller.patch similarity index 100% rename from target/linux/generic/backport-5.10/845-v5.20-0001-dt-bindings-leds-add-Broadcom-s-BCM63138-controller.patch rename to target/linux/generic/backport-5.10/845-v6.0-0001-dt-bindings-leds-add-Broadcom-s-BCM63138-controller.patch diff --git a/target/linux/generic/backport-5.10/845-v5.20-0002-leds-bcm63138-add-support-for-BCM63138-controller.patch b/target/linux/generic/backport-5.10/845-v6.0-0002-leds-bcm63138-add-support-for-BCM63138-controller.patch similarity index 100% rename from target/linux/generic/backport-5.10/845-v5.20-0002-leds-bcm63138-add-support-for-BCM63138-controller.patch rename to target/linux/generic/backport-5.10/845-v6.0-0002-leds-bcm63138-add-support-for-BCM63138-controller.patch diff --git a/target/linux/generic/backport-5.10/846-v5.20-0001-dt-bindings-leds-leds-bcm63138-unify-full-stops-in-d.patch b/target/linux/generic/backport-5.10/846-v6.0-0001-dt-bindings-leds-leds-bcm63138-unify-full-stops-in-d.patch similarity index 100% rename from target/linux/generic/backport-5.10/846-v5.20-0001-dt-bindings-leds-leds-bcm63138-unify-full-stops-in-d.patch rename to target/linux/generic/backport-5.10/846-v6.0-0001-dt-bindings-leds-leds-bcm63138-unify-full-stops-in-d.patch diff --git a/target/linux/generic/backport-5.10/846-v5.20-0002-leds-add-help-info-about-BCM63138-module-name.patch b/target/linux/generic/backport-5.10/846-v6.0-0002-leds-add-help-info-about-BCM63138-module-name.patch similarity index 100% rename from target/linux/generic/backport-5.10/846-v5.20-0002-leds-add-help-info-about-BCM63138-module-name.patch rename to target/linux/generic/backport-5.10/846-v6.0-0002-leds-add-help-info-about-BCM63138-module-name.patch diff --git a/target/linux/generic/backport-5.10/846-v5.20-0003-leds-leds-bcm63138-get-rid-of-LED_OFF.patch b/target/linux/generic/backport-5.10/846-v6.0-0003-leds-leds-bcm63138-get-rid-of-LED_OFF.patch similarity index 100% rename from target/linux/generic/backport-5.10/846-v5.20-0003-leds-leds-bcm63138-get-rid-of-LED_OFF.patch rename to target/linux/generic/backport-5.10/846-v6.0-0003-leds-leds-bcm63138-get-rid-of-LED_OFF.patch diff --git a/target/linux/generic/backport-5.15/401-v5.20-mtd-parsers-add-support-for-Sercomm-partitions.patch b/target/linux/generic/backport-5.15/401-v6.0-mtd-parsers-add-support-for-Sercomm-partitions.patch similarity index 100% rename from target/linux/generic/backport-5.15/401-v5.20-mtd-parsers-add-support-for-Sercomm-partitions.patch rename to target/linux/generic/backport-5.15/401-v6.0-mtd-parsers-add-support-for-Sercomm-partitions.patch diff --git a/target/linux/generic/backport-5.15/402-v5.20-mtd-next-mtd-core-introduce-of-support-for-dynamic-partitions.patch b/target/linux/generic/backport-5.15/402-v6.0-mtd-next-mtd-core-introduce-of-support-for-dynamic-partitions.patch similarity index 100% rename from target/linux/generic/backport-5.15/402-v5.20-mtd-next-mtd-core-introduce-of-support-for-dynamic-partitions.patch rename to target/linux/generic/backport-5.15/402-v6.0-mtd-next-mtd-core-introduce-of-support-for-dynamic-partitions.patch diff --git a/target/linux/generic/backport-5.15/800-v5.20-0001-dt-bindings-leds-add-Broadcom-s-BCM63138-controller.patch b/target/linux/generic/backport-5.15/800-v6.0-0001-dt-bindings-leds-add-Broadcom-s-BCM63138-controller.patch similarity index 100% rename from target/linux/generic/backport-5.15/800-v5.20-0001-dt-bindings-leds-add-Broadcom-s-BCM63138-controller.patch rename to target/linux/generic/backport-5.15/800-v6.0-0001-dt-bindings-leds-add-Broadcom-s-BCM63138-controller.patch diff --git a/target/linux/generic/backport-5.15/800-v5.20-0002-leds-bcm63138-add-support-for-BCM63138-controller.patch b/target/linux/generic/backport-5.15/800-v6.0-0002-leds-bcm63138-add-support-for-BCM63138-controller.patch similarity index 100% rename from target/linux/generic/backport-5.15/800-v5.20-0002-leds-bcm63138-add-support-for-BCM63138-controller.patch rename to target/linux/generic/backport-5.15/800-v6.0-0002-leds-bcm63138-add-support-for-BCM63138-controller.patch diff --git a/target/linux/generic/backport-5.15/801-v5.20-0001-dt-bindings-leds-leds-bcm63138-unify-full-stops-in-d.patch b/target/linux/generic/backport-5.15/801-v6.0-0001-dt-bindings-leds-leds-bcm63138-unify-full-stops-in-d.patch similarity index 100% rename from target/linux/generic/backport-5.15/801-v5.20-0001-dt-bindings-leds-leds-bcm63138-unify-full-stops-in-d.patch rename to target/linux/generic/backport-5.15/801-v6.0-0001-dt-bindings-leds-leds-bcm63138-unify-full-stops-in-d.patch diff --git a/target/linux/generic/backport-5.15/801-v5.20-0002-leds-add-help-info-about-BCM63138-module-name.patch b/target/linux/generic/backport-5.15/801-v6.0-0002-leds-add-help-info-about-BCM63138-module-name.patch similarity index 100% rename from target/linux/generic/backport-5.15/801-v5.20-0002-leds-add-help-info-about-BCM63138-module-name.patch rename to target/linux/generic/backport-5.15/801-v6.0-0002-leds-add-help-info-about-BCM63138-module-name.patch diff --git a/target/linux/generic/backport-5.15/801-v5.20-0003-leds-leds-bcm63138-get-rid-of-LED_OFF.patch b/target/linux/generic/backport-5.15/801-v6.0-0003-leds-leds-bcm63138-get-rid-of-LED_OFF.patch similarity index 100% rename from target/linux/generic/backport-5.15/801-v5.20-0003-leds-leds-bcm63138-get-rid-of-LED_OFF.patch rename to target/linux/generic/backport-5.15/801-v6.0-0003-leds-leds-bcm63138-get-rid-of-LED_OFF.patch From 34cf31043504473df3174a22d163b71b75e46542 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Wed, 17 Aug 2022 20:44:52 +0200 Subject: [PATCH 02/28] kernel: backport U-Boot environment data NVMEM driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It parses U-Boot env data into NVMEM cells. Signed-off-by: Rafał Miłecki --- ...-new-driver-exposing-Broadcom-s-NVRA.patch | 12 +- ...g-MTD-device-associated-with-a-speci.patch | 72 +++++ ...-handling-U-Boot-environment-variabl.patch | 278 ++++++++++++++++++ ...g-MTD-device-associated-with-a-speci.patch | 72 +++++ ...-handling-U-Boot-environment-variabl.patch | 278 ++++++++++++++++++ .../400-mtd-mtdsplit-support.patch | 2 +- ...-mtd-core-add-get_mtd_device_by_node.patch | 6 +- .../400-mtd-mtdsplit-support.patch | 2 +- ...-mtd-core-add-get_mtd_device_by_node.patch | 6 +- 9 files changed, 714 insertions(+), 14 deletions(-) create mode 100644 target/linux/generic/backport-5.10/414-v6.1-mtd-allow-getting-MTD-device-associated-with-a-speci.patch create mode 100644 target/linux/generic/backport-5.10/801-v6.1-nvmem-add-driver-handling-U-Boot-environment-variabl.patch create mode 100644 target/linux/generic/backport-5.15/403-v6.1-mtd-allow-getting-MTD-device-associated-with-a-speci.patch create mode 100644 target/linux/generic/backport-5.15/802-v6.1-nvmem-add-driver-handling-U-Boot-environment-variabl.patch diff --git a/target/linux/bcm53xx/patches-5.10/080-v5.13-0002-nvmem-brcm_nvram-new-driver-exposing-Broadcom-s-NVRA.patch b/target/linux/bcm53xx/patches-5.10/080-v5.13-0002-nvmem-brcm_nvram-new-driver-exposing-Broadcom-s-NVRA.patch index ac89ea4bc2..3a8940b36a 100644 --- a/target/linux/bcm53xx/patches-5.10/080-v5.13-0002-nvmem-brcm_nvram-new-driver-exposing-Broadcom-s-NVRA.patch +++ b/target/linux/bcm53xx/patches-5.10/080-v5.13-0002-nvmem-brcm_nvram-new-driver-exposing-Broadcom-s-NVRA.patch @@ -19,9 +19,9 @@ Signed-off-by: Srinivas Kandagatla --- a/drivers/nvmem/Kconfig +++ b/drivers/nvmem/Kconfig -@@ -270,4 +270,13 @@ config SPRD_EFUSE - This driver can also be built as a module. If so, the module - will be called nvmem-sprd-efuse. +@@ -283,4 +283,13 @@ config NVMEM_U_BOOT_ENV + + If compiled as module it will be called nvmem_u-boot-env. + +config NVMEM_BRCM_NVRAM @@ -35,10 +35,10 @@ Signed-off-by: Srinivas Kandagatla endif --- a/drivers/nvmem/Makefile +++ b/drivers/nvmem/Makefile -@@ -55,3 +55,5 @@ obj-$(CONFIG_NVMEM_ZYNQMP) += nvmem_zynq - nvmem_zynqmp_nvmem-y := zynqmp_nvmem.o - obj-$(CONFIG_SPRD_EFUSE) += nvmem_sprd_efuse.o +@@ -57,3 +57,5 @@ obj-$(CONFIG_SPRD_EFUSE) += nvmem_sprd_e nvmem_sprd_efuse-y := sprd-efuse.o + obj-$(CONFIG_NVMEM_U_BOOT_ENV) += nvmem_u-boot-env.o + nvmem_u-boot-env-y := u-boot-env.o +obj-$(CONFIG_NVMEM_BRCM_NVRAM) += nvmem_brcm_nvram.o +nvmem_brcm_nvram-y := brcm_nvram.o --- /dev/null diff --git a/target/linux/generic/backport-5.10/414-v6.1-mtd-allow-getting-MTD-device-associated-with-a-speci.patch b/target/linux/generic/backport-5.10/414-v6.1-mtd-allow-getting-MTD-device-associated-with-a-speci.patch new file mode 100644 index 0000000000..0e8708e5bb --- /dev/null +++ b/target/linux/generic/backport-5.10/414-v6.1-mtd-allow-getting-MTD-device-associated-with-a-speci.patch @@ -0,0 +1,72 @@ +From b0321721be50b80c03a51866a94fde4f94690e18 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Wed, 15 Jun 2022 21:42:59 +0200 +Subject: [PATCH] mtd: allow getting MTD device associated with a specific DT + node +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +MTD subsystem API allows interacting with MTD devices (e.g. reading, +writing, handling bad blocks). So far a random driver could get MTD +device only by its name (get_mtd_device_nm()). This change allows +getting them also by a DT node. + +This API is required for drivers handling DT defined MTD partitions in a +specific way (e.g. U-Boot (sub)partition with environment variables). + +Signed-off-by: Rafał Miłecki +Acked-by: Miquel Raynal +Signed-off-by: Srinivas Kandagatla +--- + drivers/mtd/mtdcore.c | 28 ++++++++++++++++++++++++++++ + include/linux/mtd/mtd.h | 1 + + 2 files changed, 29 insertions(+) + +--- a/drivers/mtd/mtdcore.c ++++ b/drivers/mtd/mtdcore.c +@@ -1070,6 +1070,34 @@ int __get_mtd_device(struct mtd_info *mt + EXPORT_SYMBOL_GPL(__get_mtd_device); + + /** ++ * of_get_mtd_device_by_node - obtain an MTD device associated with a given node ++ * ++ * @np: device tree node ++ */ ++struct mtd_info *of_get_mtd_device_by_node(struct device_node *np) ++{ ++ struct mtd_info *mtd = NULL; ++ struct mtd_info *tmp; ++ int err; ++ ++ mutex_lock(&mtd_table_mutex); ++ ++ err = -EPROBE_DEFER; ++ mtd_for_each_device(tmp) { ++ if (mtd_get_of_node(tmp) == np) { ++ mtd = tmp; ++ err = __get_mtd_device(mtd); ++ break; ++ } ++ } ++ ++ mutex_unlock(&mtd_table_mutex); ++ ++ return err ? ERR_PTR(err) : mtd; ++} ++EXPORT_SYMBOL_GPL(of_get_mtd_device_by_node); ++ ++/** + * get_mtd_device_nm - obtain a validated handle for an MTD device by + * device name + * @name: MTD device name to open +--- a/include/linux/mtd/mtd.h ++++ b/include/linux/mtd/mtd.h +@@ -675,6 +675,7 @@ extern int mtd_device_unregister(struct + extern struct mtd_info *get_mtd_device(struct mtd_info *mtd, int num); + extern int __get_mtd_device(struct mtd_info *mtd); + extern void __put_mtd_device(struct mtd_info *mtd); ++extern struct mtd_info *of_get_mtd_device_by_node(struct device_node *np); + extern struct mtd_info *get_mtd_device_nm(const char *name); + extern void put_mtd_device(struct mtd_info *mtd); + diff --git a/target/linux/generic/backport-5.10/801-v6.1-nvmem-add-driver-handling-U-Boot-environment-variabl.patch b/target/linux/generic/backport-5.10/801-v6.1-nvmem-add-driver-handling-U-Boot-environment-variabl.patch new file mode 100644 index 0000000000..1459d1184e --- /dev/null +++ b/target/linux/generic/backport-5.10/801-v6.1-nvmem-add-driver-handling-U-Boot-environment-variabl.patch @@ -0,0 +1,278 @@ +From f955dc14450695564926711cf9fa8e1d5d854302 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Wed, 15 Jun 2022 21:43:00 +0200 +Subject: [PATCH] nvmem: add driver handling U-Boot environment variables +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +U-Boot stores its setup as environment variables. It's a list of +key-value pairs stored on flash device with a custom header. + +This commit adds an NVMEM driver that: +1. Provides NVMEM access to environment vars binary data +2. Extracts variables as NVMEM cells + +Current Linux's NVMEM sysfs API allows reading whole NVMEM data block. +It can be used by user-space tools for reading U-Boot env vars block +without the hassle of finding its location. Parsing will still need to +be re-done there. + +Kernel-parsed NVMEM cells can be read however by Linux drivers. This may +be useful for Ethernet drivers for reading device MAC address which is +often stored as U-Boot env variable. + +Signed-off-by: Rafał Miłecki +Reviewed-by: Ahmad Fatoum +Signed-off-by: Srinivas Kandagatla +--- + +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -270,4 +270,17 @@ config SPRD_EFUSE + This driver can also be built as a module. If so, the module + will be called nvmem-sprd-efuse. + ++config NVMEM_U_BOOT_ENV ++ tristate "U-Boot environment variables support" ++ depends on OF && MTD ++ select CRC32 ++ help ++ U-Boot stores its setup as environment variables. This driver adds ++ support for verifying & exporting such data. It also exposes variables ++ as NVMEM cells so they can be referenced by other drivers. ++ ++ Currently this drivers works only with env variables on top of MTD. ++ ++ If compiled as module it will be called nvmem_u-boot-env. ++ + endif +--- a/drivers/nvmem/Makefile ++++ b/drivers/nvmem/Makefile +@@ -55,3 +55,5 @@ obj-$(CONFIG_NVMEM_ZYNQMP) += nvmem_zynq + nvmem_zynqmp_nvmem-y := zynqmp_nvmem.o + obj-$(CONFIG_SPRD_EFUSE) += nvmem_sprd_efuse.o + nvmem_sprd_efuse-y := sprd-efuse.o ++obj-$(CONFIG_NVMEM_U_BOOT_ENV) += nvmem_u-boot-env.o ++nvmem_u-boot-env-y := u-boot-env.o +--- /dev/null ++++ b/drivers/nvmem/u-boot-env.c +@@ -0,0 +1,218 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++/* ++ * Copyright (C) 2022 Rafał Miłecki ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++enum u_boot_env_format { ++ U_BOOT_FORMAT_SINGLE, ++ U_BOOT_FORMAT_REDUNDANT, ++}; ++ ++struct u_boot_env { ++ struct device *dev; ++ enum u_boot_env_format format; ++ ++ struct mtd_info *mtd; ++ ++ /* Cells */ ++ struct nvmem_cell_info *cells; ++ int ncells; ++}; ++ ++struct u_boot_env_image_single { ++ __le32 crc32; ++ uint8_t data[]; ++} __packed; ++ ++struct u_boot_env_image_redundant { ++ __le32 crc32; ++ u8 mark; ++ uint8_t data[]; ++} __packed; ++ ++static int u_boot_env_read(void *context, unsigned int offset, void *val, ++ size_t bytes) ++{ ++ struct u_boot_env *priv = context; ++ struct device *dev = priv->dev; ++ size_t bytes_read; ++ int err; ++ ++ err = mtd_read(priv->mtd, offset, bytes, &bytes_read, val); ++ if (err && !mtd_is_bitflip(err)) { ++ dev_err(dev, "Failed to read from mtd: %d\n", err); ++ return err; ++ } ++ ++ if (bytes_read != bytes) { ++ dev_err(dev, "Failed to read %zu bytes\n", bytes); ++ return -EIO; ++ } ++ ++ return 0; ++} ++ ++static int u_boot_env_add_cells(struct u_boot_env *priv, uint8_t *buf, ++ size_t data_offset, size_t data_len) ++{ ++ struct device *dev = priv->dev; ++ char *data = buf + data_offset; ++ char *var, *value, *eq; ++ int idx; ++ ++ priv->ncells = 0; ++ for (var = data; var < data + data_len && *var; var += strlen(var) + 1) ++ priv->ncells++; ++ ++ priv->cells = devm_kcalloc(dev, priv->ncells, sizeof(*priv->cells), GFP_KERNEL); ++ if (!priv->cells) ++ return -ENOMEM; ++ ++ for (var = data, idx = 0; ++ var < data + data_len && *var; ++ var = value + strlen(value) + 1, idx++) { ++ eq = strchr(var, '='); ++ if (!eq) ++ break; ++ *eq = '\0'; ++ value = eq + 1; ++ ++ priv->cells[idx].name = devm_kstrdup(dev, var, GFP_KERNEL); ++ if (!priv->cells[idx].name) ++ return -ENOMEM; ++ priv->cells[idx].offset = data_offset + value - data; ++ priv->cells[idx].bytes = strlen(value); ++ } ++ ++ if (WARN_ON(idx != priv->ncells)) ++ priv->ncells = idx; ++ ++ return 0; ++} ++ ++static int u_boot_env_parse(struct u_boot_env *priv) ++{ ++ struct device *dev = priv->dev; ++ size_t crc32_data_offset; ++ size_t crc32_data_len; ++ size_t crc32_offset; ++ size_t data_offset; ++ size_t data_len; ++ uint32_t crc32; ++ uint32_t calc; ++ size_t bytes; ++ uint8_t *buf; ++ int err; ++ ++ buf = kcalloc(1, priv->mtd->size, GFP_KERNEL); ++ if (!buf) { ++ err = -ENOMEM; ++ goto err_out; ++ } ++ ++ err = mtd_read(priv->mtd, 0, priv->mtd->size, &bytes, buf); ++ if ((err && !mtd_is_bitflip(err)) || bytes != priv->mtd->size) { ++ dev_err(dev, "Failed to read from mtd: %d\n", err); ++ goto err_kfree; ++ } ++ ++ switch (priv->format) { ++ case U_BOOT_FORMAT_SINGLE: ++ crc32_offset = offsetof(struct u_boot_env_image_single, crc32); ++ crc32_data_offset = offsetof(struct u_boot_env_image_single, data); ++ data_offset = offsetof(struct u_boot_env_image_single, data); ++ break; ++ case U_BOOT_FORMAT_REDUNDANT: ++ crc32_offset = offsetof(struct u_boot_env_image_redundant, crc32); ++ crc32_data_offset = offsetof(struct u_boot_env_image_redundant, mark); ++ data_offset = offsetof(struct u_boot_env_image_redundant, data); ++ break; ++ } ++ crc32 = le32_to_cpu(*(uint32_t *)(buf + crc32_offset)); ++ crc32_data_len = priv->mtd->size - crc32_data_offset; ++ data_len = priv->mtd->size - data_offset; ++ ++ calc = crc32(~0, buf + crc32_data_offset, crc32_data_len) ^ ~0L; ++ if (calc != crc32) { ++ dev_err(dev, "Invalid calculated CRC32: 0x%08x (expected: 0x%08x)\n", calc, crc32); ++ err = -EINVAL; ++ goto err_kfree; ++ } ++ ++ buf[priv->mtd->size - 1] = '\0'; ++ err = u_boot_env_add_cells(priv, buf, data_offset, data_len); ++ if (err) ++ dev_err(dev, "Failed to add cells: %d\n", err); ++ ++err_kfree: ++ kfree(buf); ++err_out: ++ return err; ++} ++ ++static int u_boot_env_probe(struct platform_device *pdev) ++{ ++ struct nvmem_config config = { ++ .name = "u-boot-env", ++ .reg_read = u_boot_env_read, ++ }; ++ struct device *dev = &pdev->dev; ++ struct device_node *np = dev->of_node; ++ struct u_boot_env *priv; ++ int err; ++ ++ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); ++ if (!priv) ++ return -ENOMEM; ++ priv->dev = dev; ++ ++ priv->format = (uintptr_t)of_device_get_match_data(dev); ++ ++ priv->mtd = of_get_mtd_device_by_node(np); ++ if (IS_ERR(priv->mtd)) { ++ dev_err_probe(dev, PTR_ERR(priv->mtd), "Failed to get %pOF MTD\n", np); ++ return PTR_ERR(priv->mtd); ++ } ++ ++ err = u_boot_env_parse(priv); ++ if (err) ++ return err; ++ ++ config.dev = dev; ++ config.cells = priv->cells; ++ config.ncells = priv->ncells; ++ config.priv = priv; ++ config.size = priv->mtd->size; ++ ++ return PTR_ERR_OR_ZERO(devm_nvmem_register(dev, &config)); ++} ++ ++static const struct of_device_id u_boot_env_of_match_table[] = { ++ { .compatible = "u-boot,env", .data = (void *)U_BOOT_FORMAT_SINGLE, }, ++ { .compatible = "u-boot,env-redundant-bool", .data = (void *)U_BOOT_FORMAT_REDUNDANT, }, ++ { .compatible = "u-boot,env-redundant-count", .data = (void *)U_BOOT_FORMAT_REDUNDANT, }, ++ {}, ++}; ++ ++static struct platform_driver u_boot_env_driver = { ++ .probe = u_boot_env_probe, ++ .driver = { ++ .name = "u_boot_env", ++ .of_match_table = u_boot_env_of_match_table, ++ }, ++}; ++module_platform_driver(u_boot_env_driver); ++ ++MODULE_AUTHOR("Rafał Miłecki"); ++MODULE_LICENSE("GPL"); ++MODULE_DEVICE_TABLE(of, u_boot_env_of_match_table); diff --git a/target/linux/generic/backport-5.15/403-v6.1-mtd-allow-getting-MTD-device-associated-with-a-speci.patch b/target/linux/generic/backport-5.15/403-v6.1-mtd-allow-getting-MTD-device-associated-with-a-speci.patch new file mode 100644 index 0000000000..be1aa9cfb8 --- /dev/null +++ b/target/linux/generic/backport-5.15/403-v6.1-mtd-allow-getting-MTD-device-associated-with-a-speci.patch @@ -0,0 +1,72 @@ +From b0321721be50b80c03a51866a94fde4f94690e18 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Wed, 15 Jun 2022 21:42:59 +0200 +Subject: [PATCH] mtd: allow getting MTD device associated with a specific DT + node +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +MTD subsystem API allows interacting with MTD devices (e.g. reading, +writing, handling bad blocks). So far a random driver could get MTD +device only by its name (get_mtd_device_nm()). This change allows +getting them also by a DT node. + +This API is required for drivers handling DT defined MTD partitions in a +specific way (e.g. U-Boot (sub)partition with environment variables). + +Signed-off-by: Rafał Miłecki +Acked-by: Miquel Raynal +Signed-off-by: Srinivas Kandagatla +--- + drivers/mtd/mtdcore.c | 28 ++++++++++++++++++++++++++++ + include/linux/mtd/mtd.h | 1 + + 2 files changed, 29 insertions(+) + +--- a/drivers/mtd/mtdcore.c ++++ b/drivers/mtd/mtdcore.c +@@ -1227,6 +1227,34 @@ int __get_mtd_device(struct mtd_info *mt + EXPORT_SYMBOL_GPL(__get_mtd_device); + + /** ++ * of_get_mtd_device_by_node - obtain an MTD device associated with a given node ++ * ++ * @np: device tree node ++ */ ++struct mtd_info *of_get_mtd_device_by_node(struct device_node *np) ++{ ++ struct mtd_info *mtd = NULL; ++ struct mtd_info *tmp; ++ int err; ++ ++ mutex_lock(&mtd_table_mutex); ++ ++ err = -EPROBE_DEFER; ++ mtd_for_each_device(tmp) { ++ if (mtd_get_of_node(tmp) == np) { ++ mtd = tmp; ++ err = __get_mtd_device(mtd); ++ break; ++ } ++ } ++ ++ mutex_unlock(&mtd_table_mutex); ++ ++ return err ? ERR_PTR(err) : mtd; ++} ++EXPORT_SYMBOL_GPL(of_get_mtd_device_by_node); ++ ++/** + * get_mtd_device_nm - obtain a validated handle for an MTD device by + * device name + * @name: MTD device name to open +--- a/include/linux/mtd/mtd.h ++++ b/include/linux/mtd/mtd.h +@@ -682,6 +682,7 @@ extern int mtd_device_unregister(struct + extern struct mtd_info *get_mtd_device(struct mtd_info *mtd, int num); + extern int __get_mtd_device(struct mtd_info *mtd); + extern void __put_mtd_device(struct mtd_info *mtd); ++extern struct mtd_info *of_get_mtd_device_by_node(struct device_node *np); + extern struct mtd_info *get_mtd_device_nm(const char *name); + extern void put_mtd_device(struct mtd_info *mtd); + diff --git a/target/linux/generic/backport-5.15/802-v6.1-nvmem-add-driver-handling-U-Boot-environment-variabl.patch b/target/linux/generic/backport-5.15/802-v6.1-nvmem-add-driver-handling-U-Boot-environment-variabl.patch new file mode 100644 index 0000000000..a40c61f929 --- /dev/null +++ b/target/linux/generic/backport-5.15/802-v6.1-nvmem-add-driver-handling-U-Boot-environment-variabl.patch @@ -0,0 +1,278 @@ +From f955dc14450695564926711cf9fa8e1d5d854302 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Wed, 15 Jun 2022 21:43:00 +0200 +Subject: [PATCH] nvmem: add driver handling U-Boot environment variables +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +U-Boot stores its setup as environment variables. It's a list of +key-value pairs stored on flash device with a custom header. + +This commit adds an NVMEM driver that: +1. Provides NVMEM access to environment vars binary data +2. Extracts variables as NVMEM cells + +Current Linux's NVMEM sysfs API allows reading whole NVMEM data block. +It can be used by user-space tools for reading U-Boot env vars block +without the hassle of finding its location. Parsing will still need to +be re-done there. + +Kernel-parsed NVMEM cells can be read however by Linux drivers. This may +be useful for Ethernet drivers for reading device MAC address which is +often stored as U-Boot env variable. + +Signed-off-by: Rafał Miłecki +Reviewed-by: Ahmad Fatoum +Signed-off-by: Srinivas Kandagatla +--- + +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -300,4 +300,17 @@ config NVMEM_BRCM_NVRAM + This driver provides support for Broadcom's NVRAM that can be accessed + using I/O mapping. + ++config NVMEM_U_BOOT_ENV ++ tristate "U-Boot environment variables support" ++ depends on OF && MTD ++ select CRC32 ++ help ++ U-Boot stores its setup as environment variables. This driver adds ++ support for verifying & exporting such data. It also exposes variables ++ as NVMEM cells so they can be referenced by other drivers. ++ ++ Currently this drivers works only with env variables on top of MTD. ++ ++ If compiled as module it will be called nvmem_u-boot-env. ++ + endif +--- a/drivers/nvmem/Makefile ++++ b/drivers/nvmem/Makefile +@@ -61,3 +61,5 @@ obj-$(CONFIG_NVMEM_RMEM) += nvmem-rmem. + nvmem-rmem-y := rmem.o + obj-$(CONFIG_NVMEM_BRCM_NVRAM) += nvmem_brcm_nvram.o + nvmem_brcm_nvram-y := brcm_nvram.o ++obj-$(CONFIG_NVMEM_U_BOOT_ENV) += nvmem_u-boot-env.o ++nvmem_u-boot-env-y := u-boot-env.o +--- /dev/null ++++ b/drivers/nvmem/u-boot-env.c +@@ -0,0 +1,218 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++/* ++ * Copyright (C) 2022 Rafał Miłecki ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++enum u_boot_env_format { ++ U_BOOT_FORMAT_SINGLE, ++ U_BOOT_FORMAT_REDUNDANT, ++}; ++ ++struct u_boot_env { ++ struct device *dev; ++ enum u_boot_env_format format; ++ ++ struct mtd_info *mtd; ++ ++ /* Cells */ ++ struct nvmem_cell_info *cells; ++ int ncells; ++}; ++ ++struct u_boot_env_image_single { ++ __le32 crc32; ++ uint8_t data[]; ++} __packed; ++ ++struct u_boot_env_image_redundant { ++ __le32 crc32; ++ u8 mark; ++ uint8_t data[]; ++} __packed; ++ ++static int u_boot_env_read(void *context, unsigned int offset, void *val, ++ size_t bytes) ++{ ++ struct u_boot_env *priv = context; ++ struct device *dev = priv->dev; ++ size_t bytes_read; ++ int err; ++ ++ err = mtd_read(priv->mtd, offset, bytes, &bytes_read, val); ++ if (err && !mtd_is_bitflip(err)) { ++ dev_err(dev, "Failed to read from mtd: %d\n", err); ++ return err; ++ } ++ ++ if (bytes_read != bytes) { ++ dev_err(dev, "Failed to read %zu bytes\n", bytes); ++ return -EIO; ++ } ++ ++ return 0; ++} ++ ++static int u_boot_env_add_cells(struct u_boot_env *priv, uint8_t *buf, ++ size_t data_offset, size_t data_len) ++{ ++ struct device *dev = priv->dev; ++ char *data = buf + data_offset; ++ char *var, *value, *eq; ++ int idx; ++ ++ priv->ncells = 0; ++ for (var = data; var < data + data_len && *var; var += strlen(var) + 1) ++ priv->ncells++; ++ ++ priv->cells = devm_kcalloc(dev, priv->ncells, sizeof(*priv->cells), GFP_KERNEL); ++ if (!priv->cells) ++ return -ENOMEM; ++ ++ for (var = data, idx = 0; ++ var < data + data_len && *var; ++ var = value + strlen(value) + 1, idx++) { ++ eq = strchr(var, '='); ++ if (!eq) ++ break; ++ *eq = '\0'; ++ value = eq + 1; ++ ++ priv->cells[idx].name = devm_kstrdup(dev, var, GFP_KERNEL); ++ if (!priv->cells[idx].name) ++ return -ENOMEM; ++ priv->cells[idx].offset = data_offset + value - data; ++ priv->cells[idx].bytes = strlen(value); ++ } ++ ++ if (WARN_ON(idx != priv->ncells)) ++ priv->ncells = idx; ++ ++ return 0; ++} ++ ++static int u_boot_env_parse(struct u_boot_env *priv) ++{ ++ struct device *dev = priv->dev; ++ size_t crc32_data_offset; ++ size_t crc32_data_len; ++ size_t crc32_offset; ++ size_t data_offset; ++ size_t data_len; ++ uint32_t crc32; ++ uint32_t calc; ++ size_t bytes; ++ uint8_t *buf; ++ int err; ++ ++ buf = kcalloc(1, priv->mtd->size, GFP_KERNEL); ++ if (!buf) { ++ err = -ENOMEM; ++ goto err_out; ++ } ++ ++ err = mtd_read(priv->mtd, 0, priv->mtd->size, &bytes, buf); ++ if ((err && !mtd_is_bitflip(err)) || bytes != priv->mtd->size) { ++ dev_err(dev, "Failed to read from mtd: %d\n", err); ++ goto err_kfree; ++ } ++ ++ switch (priv->format) { ++ case U_BOOT_FORMAT_SINGLE: ++ crc32_offset = offsetof(struct u_boot_env_image_single, crc32); ++ crc32_data_offset = offsetof(struct u_boot_env_image_single, data); ++ data_offset = offsetof(struct u_boot_env_image_single, data); ++ break; ++ case U_BOOT_FORMAT_REDUNDANT: ++ crc32_offset = offsetof(struct u_boot_env_image_redundant, crc32); ++ crc32_data_offset = offsetof(struct u_boot_env_image_redundant, mark); ++ data_offset = offsetof(struct u_boot_env_image_redundant, data); ++ break; ++ } ++ crc32 = le32_to_cpu(*(uint32_t *)(buf + crc32_offset)); ++ crc32_data_len = priv->mtd->size - crc32_data_offset; ++ data_len = priv->mtd->size - data_offset; ++ ++ calc = crc32(~0, buf + crc32_data_offset, crc32_data_len) ^ ~0L; ++ if (calc != crc32) { ++ dev_err(dev, "Invalid calculated CRC32: 0x%08x (expected: 0x%08x)\n", calc, crc32); ++ err = -EINVAL; ++ goto err_kfree; ++ } ++ ++ buf[priv->mtd->size - 1] = '\0'; ++ err = u_boot_env_add_cells(priv, buf, data_offset, data_len); ++ if (err) ++ dev_err(dev, "Failed to add cells: %d\n", err); ++ ++err_kfree: ++ kfree(buf); ++err_out: ++ return err; ++} ++ ++static int u_boot_env_probe(struct platform_device *pdev) ++{ ++ struct nvmem_config config = { ++ .name = "u-boot-env", ++ .reg_read = u_boot_env_read, ++ }; ++ struct device *dev = &pdev->dev; ++ struct device_node *np = dev->of_node; ++ struct u_boot_env *priv; ++ int err; ++ ++ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); ++ if (!priv) ++ return -ENOMEM; ++ priv->dev = dev; ++ ++ priv->format = (uintptr_t)of_device_get_match_data(dev); ++ ++ priv->mtd = of_get_mtd_device_by_node(np); ++ if (IS_ERR(priv->mtd)) { ++ dev_err_probe(dev, PTR_ERR(priv->mtd), "Failed to get %pOF MTD\n", np); ++ return PTR_ERR(priv->mtd); ++ } ++ ++ err = u_boot_env_parse(priv); ++ if (err) ++ return err; ++ ++ config.dev = dev; ++ config.cells = priv->cells; ++ config.ncells = priv->ncells; ++ config.priv = priv; ++ config.size = priv->mtd->size; ++ ++ return PTR_ERR_OR_ZERO(devm_nvmem_register(dev, &config)); ++} ++ ++static const struct of_device_id u_boot_env_of_match_table[] = { ++ { .compatible = "u-boot,env", .data = (void *)U_BOOT_FORMAT_SINGLE, }, ++ { .compatible = "u-boot,env-redundant-bool", .data = (void *)U_BOOT_FORMAT_REDUNDANT, }, ++ { .compatible = "u-boot,env-redundant-count", .data = (void *)U_BOOT_FORMAT_REDUNDANT, }, ++ {}, ++}; ++ ++static struct platform_driver u_boot_env_driver = { ++ .probe = u_boot_env_probe, ++ .driver = { ++ .name = "u_boot_env", ++ .of_match_table = u_boot_env_of_match_table, ++ }, ++}; ++module_platform_driver(u_boot_env_driver); ++ ++MODULE_AUTHOR("Rafał Miłecki"); ++MODULE_LICENSE("GPL"); ++MODULE_DEVICE_TABLE(of, u_boot_env_of_match_table); diff --git a/target/linux/generic/pending-5.10/400-mtd-mtdsplit-support.patch b/target/linux/generic/pending-5.10/400-mtd-mtdsplit-support.patch index f37df6d164..ce4743879d 100644 --- a/target/linux/generic/pending-5.10/400-mtd-mtdsplit-support.patch +++ b/target/linux/generic/pending-5.10/400-mtd-mtdsplit-support.patch @@ -298,7 +298,7 @@ static inline uint32_t mtd_div_by_ws(uint64_t sz, struct mtd_info *mtd) { if (mtd->writesize_shift) -@@ -678,6 +696,13 @@ extern void __put_mtd_device(struct mtd_ +@@ -679,6 +697,13 @@ extern struct mtd_info *of_get_mtd_devic extern struct mtd_info *get_mtd_device_nm(const char *name); extern void put_mtd_device(struct mtd_info *mtd); diff --git a/target/linux/generic/pending-5.10/495-mtd-core-add-get_mtd_device_by_node.patch b/target/linux/generic/pending-5.10/495-mtd-core-add-get_mtd_device_by_node.patch index cc5946ac05..66017e1648 100644 --- a/target/linux/generic/pending-5.10/495-mtd-core-add-get_mtd_device_by_node.patch +++ b/target/linux/generic/pending-5.10/495-mtd-core-add-get_mtd_device_by_node.patch @@ -17,7 +17,7 @@ Reviewed-by: Miquel Raynal --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c -@@ -1117,6 +1117,44 @@ out_unlock: +@@ -1145,6 +1145,44 @@ out_unlock: } EXPORT_SYMBOL_GPL(get_mtd_device_nm); @@ -64,9 +64,9 @@ Reviewed-by: Miquel Raynal mutex_lock(&mtd_table_mutex); --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h -@@ -696,6 +696,8 @@ extern struct mtd_info *get_mtd_device(s - extern int __get_mtd_device(struct mtd_info *mtd); +@@ -697,6 +697,8 @@ extern int __get_mtd_device(struct mtd_i extern void __put_mtd_device(struct mtd_info *mtd); + extern struct mtd_info *of_get_mtd_device_by_node(struct device_node *np); extern struct mtd_info *get_mtd_device_nm(const char *name); +extern struct mtd_info *get_mtd_device_by_node( + const struct device_node *of_node); diff --git a/target/linux/generic/pending-5.15/400-mtd-mtdsplit-support.patch b/target/linux/generic/pending-5.15/400-mtd-mtdsplit-support.patch index 8b34f4f467..d07afd70ee 100644 --- a/target/linux/generic/pending-5.15/400-mtd-mtdsplit-support.patch +++ b/target/linux/generic/pending-5.15/400-mtd-mtdsplit-support.patch @@ -288,7 +288,7 @@ Subject: [PATCH] mtd: mtdsplit support static inline uint32_t mtd_div_by_ws(uint64_t sz, struct mtd_info *mtd) { if (mtd->writesize_shift) -@@ -685,6 +703,13 @@ extern void __put_mtd_device(struct mtd_ +@@ -686,6 +704,13 @@ extern struct mtd_info *of_get_mtd_devic extern struct mtd_info *get_mtd_device_nm(const char *name); extern void put_mtd_device(struct mtd_info *mtd); diff --git a/target/linux/generic/pending-5.15/495-mtd-core-add-get_mtd_device_by_node.patch b/target/linux/generic/pending-5.15/495-mtd-core-add-get_mtd_device_by_node.patch index 431c80795e..3e14a1dd31 100644 --- a/target/linux/generic/pending-5.15/495-mtd-core-add-get_mtd_device_by_node.patch +++ b/target/linux/generic/pending-5.15/495-mtd-core-add-get_mtd_device_by_node.patch @@ -17,7 +17,7 @@ Reviewed-by: Miquel Raynal --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c -@@ -1274,6 +1274,44 @@ out_unlock: +@@ -1302,6 +1302,44 @@ out_unlock: } EXPORT_SYMBOL_GPL(get_mtd_device_nm); @@ -64,9 +64,9 @@ Reviewed-by: Miquel Raynal mutex_lock(&mtd_table_mutex); --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h -@@ -703,6 +703,8 @@ extern struct mtd_info *get_mtd_device(s - extern int __get_mtd_device(struct mtd_info *mtd); +@@ -704,6 +704,8 @@ extern int __get_mtd_device(struct mtd_i extern void __put_mtd_device(struct mtd_info *mtd); + extern struct mtd_info *of_get_mtd_device_by_node(struct device_node *np); extern struct mtd_info *get_mtd_device_nm(const char *name); +extern struct mtd_info *get_mtd_device_by_node( + const struct device_node *of_node); From d79048e9e54e9171815f5dc719af71d6b75fbc01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Wed, 17 Aug 2022 22:40:30 +0200 Subject: [PATCH 03/28] kernel: add CONFIG_NVMEM_U_BOOT_ENV symbol to configs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes: U-Boot environment variables support (NVMEM_U_BOOT_ENV) [N/m/y/?] (NEW) Fixes: 34cf310435044 ("kernel: backport U-Boot environment data NVMEM driver") Signed-off-by: Rafał Miłecki --- target/linux/generic/config-5.10 | 1 + target/linux/generic/config-5.15 | 1 + 2 files changed, 2 insertions(+) diff --git a/target/linux/generic/config-5.10 b/target/linux/generic/config-5.10 index 104fc625d9..7e9eb6143a 100644 --- a/target/linux/generic/config-5.10 +++ b/target/linux/generic/config-5.10 @@ -4240,6 +4240,7 @@ CONFIG_NMI_LOG_BUF_SHIFT=13 # CONFIG_NVMEM_IMX_OCOTP is not set # CONFIG_NVMEM_REBOOT_MODE is not set # CONFIG_NVMEM_SYSFS is not set +# CONFIG_NVMEM_U_BOOT_ENV is not set # CONFIG_NVME_FC is not set # CONFIG_NVME_TARGET is not set # CONFIG_NVME_TCP is not set diff --git a/target/linux/generic/config-5.15 b/target/linux/generic/config-5.15 index bbf4364a4f..13b52d6b5e 100644 --- a/target/linux/generic/config-5.15 +++ b/target/linux/generic/config-5.15 @@ -4407,6 +4407,7 @@ CONFIG_NMI_LOG_BUF_SHIFT=13 # CONFIG_NVMEM_REBOOT_MODE is not set # CONFIG_NVMEM_RMEM is not set # CONFIG_NVMEM_SYSFS is not set +# CONFIG_NVMEM_U_BOOT_ENV is not set # CONFIG_NVME_FC is not set # CONFIG_NVME_TARGET is not set # CONFIG_NVME_TCP is not set From fb47b9fa1aa760de58f1b43d9f3e654acf1f1671 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Wed, 17 Aug 2022 22:45:11 +0200 Subject: [PATCH 04/28] bcm4908: enable NVMEM U-Boot env data driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's needed for devices with U-Boot bootloader. Signed-off-by: Rafał Miłecki --- target/linux/bcm4908/config-5.10 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/target/linux/bcm4908/config-5.10 b/target/linux/bcm4908/config-5.10 index 3246b42168..866fbaf105 100644 --- a/target/linux/bcm4908/config-5.10 +++ b/target/linux/bcm4908/config-5.10 @@ -160,6 +160,9 @@ CONFIG_NET_FLOW_LIMIT=y CONFIG_NET_SWITCHDEV=y CONFIG_NO_IOPORT_MAP=y CONFIG_NR_CPUS=4 +CONFIG_NVMEM=y +CONFIG_NVMEM_SYSFS=y +CONFIG_NVMEM_U_BOOT_ENV=y CONFIG_OF=y CONFIG_OF_ADDRESS=y CONFIG_OF_EARLY_FLATTREE=y From 60738fedede1746922a8b227f24ad5c733661585 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Tue, 16 Aug 2022 23:38:52 +0200 Subject: [PATCH 05/28] iproute2: Fix KERNEL_INCLUDE in SDK In the SDK the folder $(LINUX_DIR)/user_headers/include does not exist, but it more or less contains the same content as $(LINUX_DIR)/include/uapi which also exists in the SDK. Since iproute2 commit 1d819dcc741e ("configure: fix parsing issue on include_dir option") it checks if this folder exists and aborts the build if it does not exists. https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=1d819dcc741e25958190e31f8186c940713fa0a8 With this commit the KERNEL_INCLUDE variable points to a valid folder with the kernel include headers. I am not sure if they are actually needed because the build worked before even with an invalid path. Signed-off-by: Hauke Mehrtens --- package/network/utils/iproute2/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/network/utils/iproute2/Makefile b/package/network/utils/iproute2/Makefile index 5439c050c1..4c21d4d877 100644 --- a/package/network/utils/iproute2/Makefile +++ b/package/network/utils/iproute2/Makefile @@ -176,7 +176,7 @@ TARGET_LDFLAGS += -Wl,--gc-sections -Wl,--as-needed TARGET_CPPFLAGS += -I$(STAGING_DIR)/usr/include/libnl-tiny MAKE_FLAGS += \ - KERNEL_INCLUDE="$(LINUX_DIR)/user_headers/include" \ + KERNEL_INCLUDE="$(LINUX_DIR)/include/uapi" \ SHARED_LIBS=$(SHARED_LIBS) \ IP_CONFIG_TINY=$(IP_CONFIG_TINY) \ BUILD_VARIANT=$(BUILD_VARIANT) \ From 9c8605dee238cdf52e88b6a1aa64d5b7bf5dd846 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Thu, 18 Aug 2022 18:02:48 +0200 Subject: [PATCH 06/28] ramips: fix ZyXEL NWA55AXE model name The model name was missing a letter. Signed-off-by: David Bauer --- target/linux/ramips/dts/mt7621_zyxel_nwa55axe.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ramips/dts/mt7621_zyxel_nwa55axe.dts b/target/linux/ramips/dts/mt7621_zyxel_nwa55axe.dts index 04bbe340f2..7f0a6d2cdf 100644 --- a/target/linux/ramips/dts/mt7621_zyxel_nwa55axe.dts +++ b/target/linux/ramips/dts/mt7621_zyxel_nwa55axe.dts @@ -2,5 +2,5 @@ / { compatible = "zyxel,nwa55axe", "mediatek,mt7621-soc"; - model = "ZyXEL NWA55AX"; + model = "ZyXEL NWA55AXE"; }; From 12c971bc26ac0ff04257bc475fff6fa68068c6c0 Mon Sep 17 00:00:00 2001 From: Mikhail Zhilkin Date: Tue, 12 Jul 2022 14:52:04 +0000 Subject: [PATCH 07/28] base-files: add mtd_get_mac_encrypted_arcadyan function Some Arcadyan devices (e.g. MTS WG430223) keep their config in encrypted mtd. This adds mtd_get_mac_encrypted_arcadyan() function to get the MAC address from the encrypted partition. Function uses uencrypt utility for decryption (and openssl if the uencrypt wasn't found). Signed-off-by: Mikhail Zhilkin --- .../base-files/files/lib/functions/system.sh | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/package/base-files/files/lib/functions/system.sh b/package/base-files/files/lib/functions/system.sh index 0ac2912014..c17354d945 100644 --- a/package/base-files/files/lib/functions/system.sh +++ b/package/base-files/files/lib/functions/system.sh @@ -79,6 +79,37 @@ mtd_get_mac_ascii() { [ -n "$mac_dirty" ] && macaddr_canonicalize "$mac_dirty" } +mtd_get_mac_encrypted_arcadyan() { + local iv="00000000000000000000000000000000" + local key="2A4B303D7644395C3B2B7053553C5200" + local mac_dirty + local mtdname="$1" + local part + local size + + part=$(find_mtd_part "$mtdname") + if [ -z "$part" ]; then + echo "mtd_get_mac_encrypted_arcadyan: partition $mtdname not found!" >&2 + return + fi + + # Config decryption and getting mac. Trying uencrypt and openssl utils. + size=$((0x$(dd if=$part skip=9 bs=1 count=4 2>/dev/null | hexdump -v -e '1/4 "%08x"'))) + if [[ -f "/usr/bin/uencrypt" ]]; then + mac_dirty=$(dd if=$part bs=1 count=$size skip=$((0x100)) 2>/dev/null | \ + uencrypt -d -n -k $key -i $iv | grep mac | cut -c 5-) + elif [[ -f "/usr/bin/openssl" ]]; then + mac_dirty=$(dd if=$part bs=1 count=$size skip=$((0x100)) 2>/dev/null | \ + openssl aes-128-cbc -d -nopad -K $key -iv $iv | grep mac | cut -c 5-) + else + echo "mtd_get_mac_encrypted_arcadyan: Neither uencrypt nor openssl was found!" >&2 + return + fi + + # "canonicalize" mac + [ -n "$mac_dirty" ] && macaddr_canonicalize "$mac_dirty" +} + mtd_get_mac_text() { local mtdname=$1 local offset=$(($2)) From a6b0d0806055a53a2538df83f8322c38ee9f3441 Mon Sep 17 00:00:00 2001 From: Mikhail Zhilkin Date: Sat, 9 Jul 2022 17:09:57 +0000 Subject: [PATCH 08/28] =?UTF-8?q?ramips:=20get=20MAC=20addr=20from=20the?= =?UTF-8?q?=20encrypted=20partition=20(WG4=D1=85=D1=85223)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit resolves #10062. Adds decryption of the Arcadyan WG4xx223 configuration partition (board_data)to get base MAC address from it. As a result, after this change the hack with saving MAC addressees to u-boot-env before installation of OpenWrt is no longer necessary. This is necessary for the following devices: - Beeline Smartbox Flash (Arcadyan WG443223) - MTS WG430223 (Arcadyan WG430223) Example: +----------------+-------------------+------------------------+ | | MTS WG430223 | Beeline Smartbox Flash | +----------------+-------------------+------------------------+ | base mac (mtd) | A4:xx:xx:51:xx:F4 | 30:xx:xx:51:xx:06 | | label | A4:xx:xx:51:xx:F4 | 30:xx:xx:51:xx:09 | | LAN | A4:xx:xx:51:xx:F6 | 30:xx:xx:51:xx:09 | | WAN | A4:xx:xx:51:xx:F4 | 30:xx:xx:51:xx:06 | | WLAN_2g | A4:xx:xx:51:xx:F5 | 30:xx:xx:51:xx:07 | | WLAN_5g | A6:xx:xx:21:xx:F5 | 32:xx:xx:41:xx:07 | +----------------+-------------------+------------------------+ Collected statistic shows that the 2-4th bits of the 7th byte of the WLAN_5g MAC are the constant (see #10062 for more details): - Beeline Smartbox Flash - 100 - MTS WG430223 - 010 Signed-off-by: Mikhail Zhilkin --- target/linux/ramips/image/mt7621.mk | 4 ++-- .../mt7621/base-files/etc/board.d/02_network | 14 ++++++++----- .../etc/hotplug.d/ieee80211/10_fix_wifi_mac | 21 +++++++++++++------ 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 96ae2765b9..c3a63fa934 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -311,7 +311,7 @@ define Device/beeline_smartbox-flash IMAGE/factory.trx := append-kernel | append-ubi | check-size IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata DEVICE_PACKAGES := kmod-usb3 kmod-mt7615e kmod-mt7615-firmware \ - uboot-envtools + uboot-envtools uencrypt endef TARGET_DEVICES += beeline_smartbox-flash @@ -1327,7 +1327,7 @@ define Device/mts_wg430223 IMAGES += factory.trx IMAGE/factory.trx := append-kernel | append-ubi | check-size IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware uboot-envtools + DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware uboot-envtools uencrypt endef TARGET_DEVICES += mts_wg430223 diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network index 7211422364..af493789ba 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network @@ -138,11 +138,10 @@ ramips_setup_macs() wan_mac=$(mtd_get_mac_ascii u-boot-env et1macaddr) label_mac=$(mtd_get_mac_binary factory 0x4) ;; - beeline,smartbox-flash|\ - mts,wg430223) - lan_mac=$(mtd_get_mac_ascii u-boot-env eth2macaddr) - wan_mac=$(mtd_get_mac_ascii u-boot-env eth3macaddr) - label_mac=$lan_mac + beeline,smartbox-flash) + wan_mac=$(mtd_get_mac_encrypted_arcadyan "board_data") + label_mac=$(macaddr_add "$wan_mac" 3) + lan_mac=$label_mac ;; buffalo,wsr-1166dhp) local index="$(find_mtd_index "board_data")" @@ -212,6 +211,11 @@ ramips_setup_macs() wan_mac=$label_mac lan_mac=$(macaddr_add $label_mac 1) ;; + mts,wg430223) + wan_mac=$(mtd_get_mac_encrypted_arcadyan "board_data") + label_mac=$wan_mac + lan_mac=$(macaddr_add "$wan_mac" 2) + ;; netgear,wax202) lan_mac=$(mtd_get_mac_ascii Config mac) wan_mac=$(macaddr_add "$lan_mac" 1) diff --git a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac index 0ace1933e3..d1ce370cad 100644 --- a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac +++ b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac @@ -10,12 +10,13 @@ PHYNBR=${DEVPATH##*/phy} board=$(board_name) case "$board" in - beeline,smartbox-flash|\ - mts,wg430223) - hw_mac_addr_ra0="$(mtd_get_mac_ascii u-boot-env ra0macaddr)" - hw_mac_addr_rax0="$(mtd_get_mac_ascii u-boot-env rax0macaddr)" - [ "$PHYNBR" = "0" ] && echo -n $hw_mac_addr_ra0 > /sys${DEVPATH}/macaddress - [ "$PHYNBR" = "1" ] && echo -n $hw_mac_addr_rax0 > /sys${DEVPATH}/macaddress + beeline,smartbox-flash) + hw_mac_addr=$(macaddr_add $(mtd_get_mac_encrypted_arcadyan "board_data") 1) + [ "$PHYNBR" = "0" ] && echo -n "$hw_mac_addr" > /sys${DEVPATH}/macaddress + hw_mac_addr=$(macaddr_setbit $hw_mac_addr 26) + hw_mac_addr=$(macaddr_unsetbit $hw_mac_addr 27) + hw_mac_addr=$(macaddr_unsetbit $hw_mac_addr 28) + [ "$PHYNBR" = "1" ] && macaddr_setbit_la $hw_mac_addr > /sys${DEVPATH}/macaddress ;; cudy,x6) hw_mac_addr="$(mtd_get_mac_binary factory 0x4)" @@ -88,6 +89,14 @@ case "$board" in [ "$PHYNBR" = "0" ] && macaddr_add $hw_mac_addr 2 > /sys${DEVPATH}/macaddress [ "$PHYNBR" = "1" ] && macaddr_add $hw_mac_addr 3 > /sys${DEVPATH}/macaddress ;; + mts,wg430223) + hw_mac_addr=$(macaddr_add $(mtd_get_mac_encrypted_arcadyan "board_data") 1) + [ "$PHYNBR" = "0" ] && echo -n "$hw_mac_addr" > /sys${DEVPATH}/macaddress + hw_mac_addr=$(macaddr_unsetbit $hw_mac_addr 26) + hw_mac_addr=$(macaddr_setbit $hw_mac_addr 27) + hw_mac_addr=$(macaddr_unsetbit $hw_mac_addr 28) + [ "$PHYNBR" = "1" ] && macaddr_setbit_la $hw_mac_addr > /sys${DEVPATH}/macaddress + ;; oraybox,x3a) if [ "$PHYNBR" = "1" ]; then hw_mac_addr="$(mtd_get_mac_binary factory 0x4)" From 764600648f4b138979848a484df553825a140166 Mon Sep 17 00:00:00 2001 From: Nick French Date: Sat, 13 Aug 2022 10:23:58 -0500 Subject: [PATCH 09/28] uencrypt: support all available ciphers Modify uencrypt to support any cipher provided by ssl library. Original tool supported only AES-128-CBC to decrypt the config mtd of Arcadyan WG430223/WG443223. TP-Link Deco S4 has mtd configuration encrypted with DES-ECB, so make the cipher generic to support both routers. Signed-off-by: Nick French Reviewed-by: Eneas U de Queiroz >cotequeiroz@gmail.com> --- package/utils/uencrypt/Makefile | 15 ++++---- package/utils/uencrypt/src/uencrypt.c | 55 +++++++++++++++++++++------ 2 files changed, 52 insertions(+), 18 deletions(-) diff --git a/package/utils/uencrypt/Makefile b/package/utils/uencrypt/Makefile index 77fdf64e0e..9307f97b6e 100644 --- a/package/utils/uencrypt/Makefile +++ b/package/utils/uencrypt/Makefile @@ -22,16 +22,17 @@ CMAKE_OPTIONS+=$(if $(CONFIG_UENCRYPT_WOLFSSL),-DUSE_WOLFSSL=1) define Package/uencrypt SECTION:=utils CATEGORY:=Base system - TITLE:=Decryption utility for Arcadyan WG4xx223 - DEPENDS:=@TARGET_ramips_mt7621 +UENCRYPT_WOLFSSL:libwolfssl +UENCRYPT_OPENSSL:libopenssl + TITLE:=Decryption utility for Arcadyan WG4xx223 and TP-Link Deco S4 + DEPENDS:=+UENCRYPT_WOLFSSL:libwolfssl +UENCRYPT_OPENSSL:libopenssl endef define Package/uencrypt/description - This is a small AES-128-CBC encrypton/decryption program. - Even though it can be used for regular encryption and - decryption operations using AES-128-CBC, it is included - here to unencrypt the configuration from mtd on Arcadyan - WG430223 and WG443223 routers. + This is a small encrypton/decryption program. It defaults + to AES-128-CBC, but supports any encryption provided by + the available openssl/wolfssl library. Even though it can + be used for regular encryption and decryption operations, + it is included here to unencrypt the configuration from mtd + on Arcadyan WG430223/WG443223 and TP-Link Deco S4 routers endef define Package/uencrypt/config diff --git a/package/utils/uencrypt/src/uencrypt.c b/package/utils/uencrypt/src/uencrypt.c index c4199b057a..ab9a202cec 100644 --- a/package/utils/uencrypt/src/uencrypt.c +++ b/package/utils/uencrypt/src/uencrypt.c @@ -5,6 +5,7 @@ #include #include #include +#include #include #ifdef USE_WOLFSSL @@ -14,7 +15,7 @@ # include #endif -int do_crypt(FILE *infile, FILE *outfile, const char *key, const char *iv, +int do_crypt(FILE *infile, FILE *outfile, const EVP_CIPHER *cipher, const char *key, const char *iv, int enc, int padding) { EVP_CIPHER_CTX *ctx; @@ -22,7 +23,7 @@ int do_crypt(FILE *infile, FILE *outfile, const char *key, const char *iv, int inlen, outlen; ctx = EVP_CIPHER_CTX_new(); - EVP_CipherInit_ex(ctx, EVP_aes_128_cbc(), NULL, key, iv, enc); + EVP_CipherInit_ex(ctx, cipher, NULL, key, iv, enc); EVP_CIPHER_CTX_set_padding(ctx, padding); for (;;) { @@ -53,9 +54,27 @@ static void check_enc_dec(const int enc) exit(EXIT_FAILURE); } +#ifndef USE_WOLFSSL +static void print_ciphers(const OBJ_NAME *name,void *arg) { + fprintf(arg, "\t%s\n", name->name); +} +#endif + +static void check_cipher(const EVP_CIPHER *cipher) +{ + if (cipher == NULL) { + fprintf(stderr, "Error: invalid cipher: %s.\n", optarg); +#ifndef USE_WOLFSSL + fprintf(stderr, "Supported ciphers: \n", optarg); + OBJ_NAME_do_all_sorted(OBJ_NAME_TYPE_CIPHER_METH, print_ciphers, stderr); +#endif + exit(EXIT_FAILURE); + } +} + static void show_usage(const char* name) { - fprintf(stderr, "Usage: %s: [-d | -e] [-n] -k key -i iv\n" + fprintf(stderr, "Usage: %s: [-d | -e] [-n] -k key [-i iv] [-c cipher]\n" "-d = decrypt; -e = encrypt; -n = no padding\n", name); } @@ -67,10 +86,19 @@ int main(int argc, char *argv[]) long len; int opt; int padding = 1; + int need_iv = 1; + const EVP_CIPHER *cipher = EVP_aes_128_cbc(); int ret; - while ((opt = getopt(argc, argv, "dei:k:n")) != -1) { + while ((opt = getopt(argc, argv, "c:dei:k:n")) != -1) { switch (opt) { + case 'c': + cipher = EVP_get_cipherbyname(optarg); + check_cipher(cipher); + int arglen = strlen(optarg); + if (arglen > 3 && strncmp(optarg+arglen-3, "ecb", 3) == 0) //if ends with "ecb" + need_iv = 0; + break; case 'd': check_enc_dec(enc); enc = 0; @@ -81,16 +109,16 @@ int main(int argc, char *argv[]) break; case 'i': iv = OPENSSL_hexstr2buf((const char *)optarg, &len); - if (iv == NULL || len != 16) { - fprintf(stderr, "Error setting IV to %s. The IV should be 16 bytes, encoded in hex.\n", + if (iv == NULL) { + fprintf(stderr, "Error setting IV to %s. The IV should be encoded in hex.\n", optarg); exit(EINVAL); } break; case 'k': key = OPENSSL_hexstr2buf((const char *)optarg, &len); - if (key == NULL || len != 16) { - fprintf(stderr, "Error setting key to %s. The key should be 16 bytes, encoded in hex.\n", + if (key == NULL) { + fprintf(stderr, "Error setting key to %s. The key should be encoded in hex.\n", optarg); exit(EINVAL); } @@ -103,12 +131,17 @@ int main(int argc, char *argv[]) exit(EINVAL); } } - if (iv == NULL || key == NULL) { - fprintf(stderr, "Error: %s not set.\n", key ? "iv" : (iv ? "key" : "key and iv")); + if (need_iv && iv == NULL) { + fprintf(stderr, "Error: iv not set.\n"); + show_usage(argv[0]); + exit(EXIT_FAILURE); + } + if (key == NULL) { + fprintf(stderr, "Error: key not set.\n"); show_usage(argv[0]); exit(EXIT_FAILURE); } - ret = do_crypt(stdin, stdout, key, iv, !!enc, padding); + ret = do_crypt(stdin, stdout, cipher, key, iv, !!enc, padding); if (ret) fprintf(stderr, "Error during crypt operation.\n"); OPENSSL_free(iv); From 51ec9b38647281271c4112556b7d09096971ba1f Mon Sep 17 00:00:00 2001 From: Daniel Groth Date: Fri, 12 Aug 2022 20:10:20 +0200 Subject: [PATCH 10/28] realtek: d-link: dgs-1210 remake of the device tree MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I have collected the known information from the dts files we have. After that I made a new device tree that should work for this whole D-Link switch family. This device tree is based on modules where you first select which SoC group the device belongs to. Then you include the GPIO dtsi file depending on what hardware your device has, see examples below. This tree is also expandable for more hardware, see the part 'Future expansion possibilities' further down. ------------------------------------------------------------------------------- The device tree now looks like this: ---------------- | rtl838x.dtsi | // Note 1. ---------------- | | --------------------------------------- | rtl838x_d-link_dgs-1210_common.dtsi | // Note 2. --------------------------------------- | | -------------- |-------| device.dts | // Note 3. | -------------- | ------------------------------------- | rtl83xx_d-link_dgs-1210_gpio.dtsi | // Note 4. ------------------------------------- | | -------------- |-------| device.dts | // Note 5. -------------- Note 1; Included in rtl838x_d-link_dgs-1210_common.dtsi. Note 2; SoC level information and memory mapping. Choose which one to include in the device dts. Note 3; At this point dgs-1210-16 will come out here. Note 4; In this dtsi only common board hardware based on the rtl8231 is found. No PoE based hardware in this dtsi. In this dtsi there is no <#include> to above *_common.dtsi. Note 5; Device dts with only rtl8231 based hardware without PoE will come out here. ------------------------------------------------------------------------------- How to set up in dts file: The device dts will have one of these two <#include> alternatives. This alternative includes only common features: <#include "rtl838x_d-link_dgs-1210_common.dtsi"> This alternative includes common and the rtl8231 GPIO (no PoE) features: <#include "rtl838x_d-link_dgs-1210_common.dtsi"> <#include "rtl83xx_d-link_dgs-1210_gpio.dtsi"> ------------------------------------------------------------------------------- Implementation: Finally, I also implemented this new family device tree on the current supported devices: dgs-1210-10p dgs-1210-16 dgs-1210-20 dgs-1210-28 The implementation for the dgs-1210-10p is different. I have removed the information from the rtl8382_d-link_dgs-1210-10p.dts that is already present in rtl838x_d-link_dgs-1210_common.dtsi. Since the rest isn't officially probed in the device dts I do not want to include the rtl83xx_d-link_dgs-1210_gpio.dtsi with dgs-1210-10p.dts. Since I don't have these devices to test on I have built the original firmware for each one of these devices before this change and saved the dtb file and then compared the original dtb file with the dtb file built with this new device tree. ------------------------------------------------------------------------------- Future expansion possibilities: In parallel with the rtl838x_d-link_dgs-1210_common.dtsi in the tree map we can make a rtl839x_d-link_dgs-1210_common.dtsi to use the rtl839x.dtsi if the need arises with more devices based on rtl839x soc. When we have more PoE devices so the hardware map for these gets more clear we can make a rtl83xx_d-link_dgs-1210_poe.dtsi below the rtl83xx_d-link_dgs-1210_gpio.dtsi in the tree map. I looked at the port and switch setup to see if it could be moved to the dtsi. I decided not to touch this part now. The reason was that there isn't really any meaningful way this could be shared between the devices. The only thing in common over the family is the 8+2sfp ports on the dgs-1210-10xx device. And then there is the hot plug SFP and I2C ports that aren’t implemented on any device. So maybe when we see the whole port map for the family then maybe the ports can be moved to a *_common.dtsi but I don't think it is the right moment for that now. Signed-off-by: Daniel Groth [Capitalisation of abbreviations and 'D-Link'] Signed-off-by: Sander Vanheule --- .../dts-5.10/rtl8382_d-link_dgs-1210-10p.dts | 81 +------------------ .../dts-5.10/rtl8382_d-link_dgs-1210-16.dts | 2 +- .../dts-5.10/rtl8382_d-link_dgs-1210-20.dts | 27 +------ .../dts-5.10/rtl8382_d-link_dgs-1210-28.dts | 27 +------ ...si => rtl838x_d-link_dgs-1210_common.dtsi} | 3 +- .../rtl83xx_d-link_dgs-1210_gpio.dtsi | 27 +++++++ 6 files changed, 34 insertions(+), 133 deletions(-) rename target/linux/realtek/dts-5.10/{rtl8382_d-link_dgs-1210.dtsi => rtl838x_d-link_dgs-1210_common.dtsi} (99%) create mode 100644 target/linux/realtek/dts-5.10/rtl83xx_d-link_dgs-1210_gpio.dtsi diff --git a/target/linux/realtek/dts-5.10/rtl8382_d-link_dgs-1210-10p.dts b/target/linux/realtek/dts-5.10/rtl8382_d-link_dgs-1210-10p.dts index 3321887c9a..e57197d55c 100644 --- a/target/linux/realtek/dts-5.10/rtl8382_d-link_dgs-1210-10p.dts +++ b/target/linux/realtek/dts-5.10/rtl8382_d-link_dgs-1210-10p.dts @@ -1,38 +1,11 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT -#include "rtl838x.dtsi" - -#include -#include +#include "rtl838x_d-link_dgs-1210_common.dtsi" / { compatible = "d-link,dgs-1210-10p", "realtek,rtl838x-soc"; model = "D-Link DGS-1210-10P"; - aliases { - led-boot = &led_power; - led-failsafe = &led_power; - led-running = &led_power; - led-upgrade = &led_power; - }; - - memory@0 { - device_type = "memory"; - reg = <0x0 0x8000000>; - }; - - leds { - pinctrl-names = "default"; - pinctrl-0 = <&pinmux_disable_sys_led>; - compatible = "gpio-leds"; - - led_power: power { - // GPIO 0 seems to provide power to the leds - label = "green:power"; - gpios = <&gpio0 0 GPIO_ACTIVE_LOW>; - }; - }; - keys { compatible = "gpio-keys-polled"; poll-interval = <20>; @@ -53,58 +26,6 @@ }; }; - -&spi0 { - status = "okay"; - flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <10000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - reg = <0x00000000 0x80000>; - read-only; - }; - partition@80000 { - label = "u-boot-env"; - reg = <0x00080000 0x40000>; - read-only; - }; - partition@c0000 { - label = "u-boot-env2"; - reg = <0x000c0000 0x40000>; - }; - partition@280000 { - label = "firmware"; - compatible = "denx,uimage"; - reg = <0x00100000 0xd80000>; - }; - partition@be80000 { - label = "kernel2"; - reg = <0x00e80000 0x180000>; - }; - partition@1000000 { - label = "sysinfo"; - reg = <0x01000000 0x40000>; - }; - partition@1040000 { - label = "rootfs2"; - reg = <0x01040000 0xc00000>; - }; - partition@1c40000 { - label = "jffs2"; - reg = <0x01c40000 0x3c0000>; - }; - }; - }; -}; - &uart1 { status = "okay"; }; diff --git a/target/linux/realtek/dts-5.10/rtl8382_d-link_dgs-1210-16.dts b/target/linux/realtek/dts-5.10/rtl8382_d-link_dgs-1210-16.dts index ac51185ed0..28c64c2ab4 100644 --- a/target/linux/realtek/dts-5.10/rtl8382_d-link_dgs-1210-16.dts +++ b/target/linux/realtek/dts-5.10/rtl8382_d-link_dgs-1210-16.dts @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT -#include "rtl8382_d-link_dgs-1210.dtsi" +#include "rtl838x_d-link_dgs-1210_common.dtsi" / { compatible = "d-link,dgs-1210-16", "realtek,rtl838x-soc"; diff --git a/target/linux/realtek/dts-5.10/rtl8382_d-link_dgs-1210-20.dts b/target/linux/realtek/dts-5.10/rtl8382_d-link_dgs-1210-20.dts index cd495bc343..f96f08db29 100644 --- a/target/linux/realtek/dts-5.10/rtl8382_d-link_dgs-1210-20.dts +++ b/target/linux/realtek/dts-5.10/rtl8382_d-link_dgs-1210-20.dts @@ -1,34 +1,11 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT -#include "rtl8382_d-link_dgs-1210.dtsi" +#include "rtl838x_d-link_dgs-1210_common.dtsi" +#include "rtl83xx_d-link_dgs-1210_gpio.dtsi" / { compatible = "d-link,dgs-1210-20", "realtek,rtl838x-soc"; model = "D-Link DGS-1210-20"; - - gpio-restart { - compatible = "gpio-restart"; - gpios = <&gpio1 34 GPIO_ACTIVE_LOW>; - open-source; - }; - - keys { - compatible = "gpio-keys-polled"; - poll-interval = <20>; - - reset { - label = "reset"; - gpios = <&gpio1 33 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - - gpio1: rtl8231-gpio { - compatible = "realtek,rtl8231-gpio"; - #gpio-cells = <2>; - gpio-controller; - indirect-access-bus-id = <0>; - }; }; ðernet0 { diff --git a/target/linux/realtek/dts-5.10/rtl8382_d-link_dgs-1210-28.dts b/target/linux/realtek/dts-5.10/rtl8382_d-link_dgs-1210-28.dts index a73e19e16f..a4a450cc09 100644 --- a/target/linux/realtek/dts-5.10/rtl8382_d-link_dgs-1210-28.dts +++ b/target/linux/realtek/dts-5.10/rtl8382_d-link_dgs-1210-28.dts @@ -1,34 +1,11 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT -#include "rtl8382_d-link_dgs-1210.dtsi" +#include "rtl838x_d-link_dgs-1210_common.dtsi" +#include "rtl83xx_d-link_dgs-1210_gpio.dtsi" / { compatible = "d-link,dgs-1210-28", "realtek,rtl838x-soc"; model = "D-Link DGS-1210-28"; - - gpio-restart { - compatible = "gpio-restart"; - gpios = <&gpio1 34 GPIO_ACTIVE_LOW>; - open-source; - }; - - keys { - compatible = "gpio-keys-polled"; - poll-interval = <20>; - - reset { - label = "reset"; - gpios = <&gpio1 33 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - - gpio1: rtl8231-gpio { - compatible = "realtek,rtl8231-gpio"; - #gpio-cells = <2>; - gpio-controller; - indirect-access-bus-id = <0>; - }; }; ðernet0 { diff --git a/target/linux/realtek/dts-5.10/rtl8382_d-link_dgs-1210.dtsi b/target/linux/realtek/dts-5.10/rtl838x_d-link_dgs-1210_common.dtsi similarity index 99% rename from target/linux/realtek/dts-5.10/rtl8382_d-link_dgs-1210.dtsi rename to target/linux/realtek/dts-5.10/rtl838x_d-link_dgs-1210_common.dtsi index 565ba45de6..c1deff4bba 100644 --- a/target/linux/realtek/dts-5.10/rtl8382_d-link_dgs-1210.dtsi +++ b/target/linux/realtek/dts-5.10/rtl838x_d-link_dgs-1210_common.dtsi @@ -18,10 +18,9 @@ reg = <0x0 0x8000000>; }; - leds { + leds: leds { pinctrl-names = "default"; pinctrl-0 = <&pinmux_disable_sys_led>; - compatible = "gpio-leds"; led_power: power { diff --git a/target/linux/realtek/dts-5.10/rtl83xx_d-link_dgs-1210_gpio.dtsi b/target/linux/realtek/dts-5.10/rtl83xx_d-link_dgs-1210_gpio.dtsi new file mode 100644 index 0000000000..b1477aa182 --- /dev/null +++ b/target/linux/realtek/dts-5.10/rtl83xx_d-link_dgs-1210_gpio.dtsi @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/ { + gpio-restart { + compatible = "gpio-restart"; + gpios = <&gpio1 34 GPIO_ACTIVE_LOW>; + open-source; + }; + + keys: keys { + compatible = "gpio-keys-polled"; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio1 33 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio1: rtl8231-gpio { + compatible = "realtek,rtl8231-gpio"; + #gpio-cells = <2>; + gpio-controller; + indirect-access-bus-id = <0>; + }; +}; From 8c04a5c45677aa460d75dcbb9ba40b1b8c343eda Mon Sep 17 00:00:00 2001 From: Daniel Groth Date: Fri, 12 Aug 2022 20:11:54 +0200 Subject: [PATCH 11/28] realtek: d-link: add support for dgs-1210-10mp General hardware info: ------------------------------------------------------------------------------- D-Link DGS-1210-10MP is a switch with 8 ethernet ports and 2 SFP ports, all ports Gbit capable. It is based on a RTL8380 SoC @ 500MHz, DRAM 128MB and 32MB flash. All ethernet ports are 802.3af/at PoE capable with a total PoE power budget of 130W. File info: ------------------------------------------------------------------------------- The dgs-1210-10mp is very similar to dgs-1210-10p so I used that as a start. rtl838x.mk: - Removed lua-rs232 package since it was a leftover from the old rtl83xx-poe package. - Updated the soc to 8380. - Specified device variant: F. - Installed the new realtek-poe package. rtl8380_d-link_dgs-1210-10mp.dts: - Moved dgs-1210 family common parts and non PoE related ports on rtl8231 to the new device tree dtsi files. Serial connection: ------------------------------------------------------------------------------- The UART for the SoC (115200 8N1) is available close to the front panel next to the LED/key card connector via unpopulated standard 0.1" pin header marked j4. Pin1 is marked with arrow and square. Pin 1: Vcc 3,3V Pin 2: Tx Pin 3: Rx Pin 4: Gnd Installation with TFTP from u-boot ------------------------------------------------------------------------------- I originally used the install procedure: 'OpenWrt installation using the TFTP method and serial console access' found in the device wiki for the dgs-1210-16. < https://openwrt.org/toh/d-link/dgs-1210-16_g1#openwrt_installation_using _the_tftp_method_and_serial_console_access > About the realtek-poe package ------------------------------------------------------------------------------- The realtek-poe package is installed but there isn't any automatic PoE config setting at this time so for now the PoE config must be edited manually. Original OEM hardware/firmware data at first installation ------------------------------------------------------------------------------- It has been installed, developed, and tested on a device with these OEM hardware and firmware versions. - U-boot: 2011.12.(2.1.5.67086)-Candidate1 (Jun 22 2020 - 15:03:58) - Boot version: 1.01.001 - Firmware version: 6.20.007 - Hardware version: F1 Things to be done when support are developed ------------------------------------------------------------------------------- - realtek-poe has been included in OpenWrt but the automatic config handling has not been solved yet so in the future there will probably be some minor updates for this device to handle the poe config. - LED link_act and poe are per function supposed to be connected to the PoE system. But some software development is also needed to make this LED work and shift the LED array between act and poe indication and to shift the mode lights with mode key. - LED poe_max should probably be used as straight forward error output from the realtek-poe package error handling. But no code has been written for this. - SFP is currently not hot pluggable. Development is under progress to get working I2C communication with SFP and have them hot pluggable. When any device in the dgs-1210 family gets this working, I expect it should be possible to implement the same solution in this device. Signed-off-by: Daniel Groth [Capitalisation of abbreviations, DEVICE_VARIANT and update filenames, device compatibles on single line] Signed-off-by: Sander Vanheule --- package/boot/uboot-envtools/files/realtek | 3 +- .../rtl8380_d-link_dgs-1210-10mp-f.dts | 87 +++++++++++++++++++ target/linux/realtek/image/rtl838x.mk | 9 ++ 3 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 target/linux/realtek/dts-5.10/rtl8380_d-link_dgs-1210-10mp-f.dts diff --git a/package/boot/uboot-envtools/files/realtek b/package/boot/uboot-envtools/files/realtek index 39be783ea3..e1eb1a6ac6 100644 --- a/package/boot/uboot-envtools/files/realtek +++ b/package/boot/uboot-envtools/files/realtek @@ -8,10 +8,11 @@ touch /etc/config/ubootenv board=$(board_name) case "$board" in +d-link,dgs-1210-10mp|\ +d-link,dgs-1210-10p|\ d-link,dgs-1210-16|\ d-link,dgs-1210-20|\ d-link,dgs-1210-28|\ -d-link,dgs-1210-10p|\ zyxel,gs1900-8|\ zyxel,gs1900-8hp-v1|\ zyxel,gs1900-8hp-v2|\ diff --git a/target/linux/realtek/dts-5.10/rtl8380_d-link_dgs-1210-10mp-f.dts b/target/linux/realtek/dts-5.10/rtl8380_d-link_dgs-1210-10mp-f.dts new file mode 100644 index 0000000000..3e8e97986c --- /dev/null +++ b/target/linux/realtek/dts-5.10/rtl8380_d-link_dgs-1210-10mp-f.dts @@ -0,0 +1,87 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "rtl838x_d-link_dgs-1210_common.dtsi" +#include "rtl83xx_d-link_dgs-1210_gpio.dtsi" + +/ { + compatible = "d-link,dgs-1210-10mp-f", "realtek,rtl8382-soc", "realtek,rtl838x-soc"; + + model = "D-Link DGS-1210-10MP F"; +}; + +&leds { + link_act { + label = "green:link_act"; + gpios = <&gpio1 28 GPIO_ACTIVE_LOW>; + }; + + poe { + label = "green:poe"; + gpios = <&gpio1 29 GPIO_ACTIVE_LOW>; + }; + + poe_max { + label = "yellow:poe_max"; + gpios = <&gpio1 27 GPIO_ACTIVE_LOW>; + }; +}; + +&keys { + mode { + label = "mode"; + gpios = <&gpio1 30 GPIO_ACTIVE_LOW>; + linux,code = ; + }; +}; + +&uart1 { + status = "okay"; +}; + +ðernet0 { + mdio: mdio-bus { + compatible = "realtek,rtl838x-mdio"; + regmap = <ðernet0>; + #address-cells = <1>; + #size-cells = <0>; + + INTERNAL_PHY(8) + INTERNAL_PHY(9) + INTERNAL_PHY(10) + INTERNAL_PHY(11) + INTERNAL_PHY(12) + INTERNAL_PHY(13) + INTERNAL_PHY(14) + INTERNAL_PHY(15) + INTERNAL_PHY(24) + INTERNAL_PHY(26) + }; +}; + +&switch0 { + ports { + #address-cells = <1>; + #size-cells = <0>; + + SWITCH_PORT(8, 1, internal) + SWITCH_PORT(9, 2, internal) + SWITCH_PORT(10, 3, internal) + SWITCH_PORT(11, 4, internal) + SWITCH_PORT(12, 5, internal) + SWITCH_PORT(13, 6, internal) + SWITCH_PORT(14, 7, internal) + SWITCH_PORT(15, 8, internal) + SWITCH_SFP_PORT(24, 9, rgmii-id) + SWITCH_SFP_PORT(26, 10, rgmii-id) + + port@28 { + ethernet = <ðernet0>; + reg = <28>; + phy-mode = "internal"; + fixed-link { + speed = <1000>; + full-duplex; + }; + }; + }; +}; diff --git a/target/linux/realtek/image/rtl838x.mk b/target/linux/realtek/image/rtl838x.mk index e748d414bc..3e27576bda 100644 --- a/target/linux/realtek/image/rtl838x.mk +++ b/target/linux/realtek/image/rtl838x.mk @@ -27,6 +27,15 @@ define Device/d-link_dgs-1210 dlink-version | dlink-headers endef +define Device/d-link_dgs-1210-10mp-f + $(Device/d-link_dgs-1210) + SOC := rtl8380 + DEVICE_MODEL := DGS-1210-10MP + DEVICE_VARIANT := F + DEVICE_PACKAGES += realtek-poe +endef +TARGET_DEVICES += d-link_dgs-1210-10mp-f + define Device/d-link_dgs-1210-10p $(Device/d-link_dgs-1210) DEVICE_MODEL := DGS-1210-10P From 396e190f0be7caa15d3d217d30c15df8a77047d1 Mon Sep 17 00:00:00 2001 From: Markus Stockhausen Date: Fri, 19 Aug 2022 21:08:42 +0200 Subject: [PATCH 12/28] realtek: more generic platform initialization Platform startup still "guesses" the CPU clock speed by DT fixed values. If possible take clock rates from a to be developed driver and align to MIPS generic platfom initialization code. Pack old behaviour into a fallback function. We might get rid of that some day. Signed-off-by: Markus Stockhausen --- .../files-5.10/arch/mips/rtl838x/setup.c | 39 ++++++++++++++++--- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/target/linux/realtek/files-5.10/arch/mips/rtl838x/setup.c b/target/linux/realtek/files-5.10/arch/mips/rtl838x/setup.c index e0adbf87e9..b4d415ab44 100644 --- a/target/linux/realtek/files-5.10/arch/mips/rtl838x/setup.c +++ b/target/linux/realtek/files-5.10/arch/mips/rtl838x/setup.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -48,14 +49,11 @@ void __init plat_mem_setup(void) __dt_setup_arch(dtb); } -void __init plat_time_init(void) +void plat_time_init_fallback(void) { struct device_node *np; u32 freq = 500000000; - of_clk_init(NULL); - timer_probe(); - np = of_find_node_by_name(NULL, "cpus"); if (!np) { pr_err("Missing 'cpus' DT node, using default frequency."); @@ -66,10 +64,41 @@ void __init plat_time_init(void) pr_info("CPU frequency from device tree: %dMHz", freq / 1000000); of_node_put(np); } - mips_hpt_frequency = freq / 2; } +void __init plat_time_init(void) +{ +/* + * Initialization routine resembles generic MIPS plat_time_init() with + * lazy error handling. The final fallback is only needed until we have + * converted all device trees to new clock syntax. + */ + struct device_node *np; + struct clk *clk; + + of_clk_init(NULL); + + mips_hpt_frequency = 0; + np = of_get_cpu_node(0, NULL); + if (!np) { + pr_err("Failed to get CPU node\n"); + } else { + clk = of_clk_get(np, 0); + if (IS_ERR(clk)) { + pr_err("Failed to get CPU clock: %ld\n", PTR_ERR(clk)); + } else { + mips_hpt_frequency = clk_get_rate(clk) / 2; + clk_put(clk); + } + } + + if (!mips_hpt_frequency) + plat_time_init_fallback(); + + timer_probe(); +} + void __init arch_init_irq(void) { irqchip_init(); From f338f76a66a50d201ae57c98852aa9c74e9e278a Mon Sep 17 00:00:00 2001 From: Sultan Alsawaf Date: Thu, 21 Jul 2022 23:36:31 -0700 Subject: [PATCH 13/28] mac80211: parse the correct set of HE capabilities for AP mode It is common for 802.11ax NICs to support more than just AP mode, which results in there being a distinct set of HE capabilities for each mode. As (bad) luck would have it, iw prints out info for each HE mode in sequential order according to `enum nl80211_iftype`, and AP mode isn't always first. As a result, the wrong set of HE capabilities can be parsed if an AP NIC supports station (managed) mode or any other mode preceding AP mode, since only the first set of HE capabilities printed by iw is parsed from awk's output. This has a noticeable impact on beamforming for example, since managed mode usually doesn't have beamformer capabilities enabled, while AP mode does. Hostapd won't be set up with the configs to enable beamformer capabilities in this scenario, causing hostapd to disable beamforming to HE stations even when it's supported by the AP. Always parse the correct set of HE capabilities for AP mode to fix this. This is achieved by trimming all of iw's output prior to the AP mode capabilities, which ensures that the first set of HE capabilities are always for AP mode. Signed-off-by: Sultan Alsawaf --- package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh index 62afd9e6a0..f524940854 100644 --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh @@ -421,9 +421,9 @@ mac80211_hostapd_setup_base() { he_spr_non_srg_obss_pd_max_offset:1 \ he_bss_color - he_phy_cap=$(iw phy "$phy" info | awk -F "[()]" '/HE PHY Capabilities/ { print $2 }' | head -1) + he_phy_cap=$(iw phy "$phy" info | sed -n '/HE Iftypes: AP/,$p' | awk -F "[()]" '/HE PHY Capabilities/ { print $2 }' | head -1) he_phy_cap=${he_phy_cap:2} - he_mac_cap=$(iw phy "$phy" info | awk -F "[()]" '/HE MAC Capabilities/ { print $2 }' | head -1) + he_mac_cap=$(iw phy "$phy" info | sed -n '/HE Iftypes: AP/,$p' | awk -F "[()]" '/HE MAC Capabilities/ { print $2 }' | head -1) he_mac_cap=${he_mac_cap:2} append base_cfg "ieee80211ax=1" "$N" From 832e7b817221d288df76b763ca12c585365db5d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibaut=20VAR=C3=88NE?= Date: Tue, 16 Aug 2022 19:00:47 +0200 Subject: [PATCH 14/28] build: always set CONFIG_IPV6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Disabling this build tunable breaks build and seems unrealistically likely to be fixed. This patch sets the related CONFIG to always true and removes the config prompt, keeping the change minimal, and, should !CONFIG_IPV6 ever be fixed, easy to revert. Signed-off-by: Thibaut VARÈNE Acked-by: Stijn Tintel Acked-by: Paul Spooren Acked-by: Josef.Schlehofer Acked-by: Jo-Philipp Wich --- config/Config-build.in | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/config/Config-build.in b/config/Config-build.in index ef1a10c28d..400bf15665 100644 --- a/config/Config-build.in +++ b/config/Config-build.in @@ -150,11 +150,7 @@ menu "Global build settings" Adds -g3 to the CFLAGS. config IPV6 - bool - prompt "Enable IPv6 support in packages" - default y - help - Enables IPv6 support in kernel (builtin) and packages. + def_bool y comment "Stripping options" From cc6a323e2328176b732b13f1f09745354270cd39 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 20 Aug 2022 22:51:29 +0200 Subject: [PATCH 15/28] iwinfo: update to latest HEAD 0dad3e6 Add support for CCMP-256 and GCMP-256 ciphers Signed-off-by: Hauke Mehrtens --- package/network/utils/iwinfo/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/network/utils/iwinfo/Makefile b/package/network/utils/iwinfo/Makefile index b23726ebb0..4735181712 100644 --- a/package/network/utils/iwinfo/Makefile +++ b/package/network/utils/iwinfo/Makefile @@ -11,9 +11,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/iwinfo.git -PKG_SOURCE_DATE:=2022-08-13 -PKG_SOURCE_VERSION:=705d3b5cc30ed1ac3b2fed131259bcbc61177e41 -PKG_MIRROR_HASH:=091b7f20e95e9f1dfb993d71172d96590041f985e422b7248e15b11798a73644 +PKG_SOURCE_DATE:=2022-08-19 +PKG_SOURCE_VERSION:=0dad3e6660594592071ae49a77a907e2b11a98fe +PKG_MIRROR_HASH:=2162ee3158328ffe39018e50f34d74b47a6c7a26460e30d7984ca16cbc859d80 PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=GPL-2.0 From 8008816a2ceeb7e66d27d9882685933bb9df4c76 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 20 Aug 2022 22:52:49 +0200 Subject: [PATCH 16/28] netifd: update to git HEAD 87fbefd interface: support "zone" config option bfa039c netifd: fix WPA3 enterprise ciphers Signed-off-by: Hauke Mehrtens --- package/network/config/netifd/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile index 9de4cb1df8..ed451518f2 100644 --- a/package/network/config/netifd/Makefile +++ b/package/network/config/netifd/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git -PKG_SOURCE_DATE:=2022-06-01 -PKG_SOURCE_VERSION:=39ef9fe1388029c476db62889ef2ef5661613321 -PKG_MIRROR_HASH:=a17353a33ae4ee0aec790169715e91e634660e15eb33900ec4a23c698425de8a +PKG_SOURCE_DATE:=2022-08-19 +PKG_SOURCE_VERSION:=bfa039c414bc6613cc5361aaf5fa6baf5fa0264b +PKG_MIRROR_HASH:=f2fef3b61ffeecb116f63a4d53838d1d754f7c52750fd30e3304d26aa578d778 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0 From 9fbb76c0470fd54f1f34909b1098d0f76078878f Mon Sep 17 00:00:00 2001 From: Joerg Werner Date: Sun, 26 Jun 2022 17:18:39 +0200 Subject: [PATCH 17/28] hostapd: fix WPA3 enterprise keys and ciphers WPA3 enterprise requires group_mgmt_cipher=BIP-GMAC-256 and if 802.11r is active also wpa_key_mgmt FT-EAP-SHA384. This commit also requires corresponding changes in netifd. Signed-off-by: Joerg Werner --- package/network/services/hostapd/files/hostapd.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh index 72ff65b4f1..00de1e07ec 100644 --- a/package/network/services/hostapd/files/hostapd.sh +++ b/package/network/services/hostapd/files/hostapd.sh @@ -48,12 +48,15 @@ hostapd_append_wpa_key_mgmt() { ;; eap192) append wpa_key_mgmt "WPA-EAP-SUITE-B-192" - [ "${ieee80211r:-0}" -gt 0 ] && append wpa_key_mgmt "FT-EAP" + [ "${ieee80211r:-0}" -gt 0 ] && append wpa_key_mgmt "FT-EAP-SHA384" ;; eap-eap192) append wpa_key_mgmt "WPA-EAP-SUITE-B-192" append wpa_key_mgmt "WPA-EAP" - [ "${ieee80211r:-0}" -gt 0 ] && append wpa_key_mgmt "FT-EAP" + [ "${ieee80211r:-0}" -gt 0 ] && { + append wpa_key_mgmt "FT-EAP-SHA384" + append wpa_key_mgmt "FT-EAP" + } [ "${ieee80211w:-0}" -gt 0 ] && append wpa_key_mgmt "WPA-EAP-SHA256" ;; sae) @@ -968,7 +971,11 @@ hostapd_set_bss_options() { json_get_vars ieee80211w_mgmt_cipher ieee80211w_max_timeout ieee80211w_retry_timeout append bss_conf "ieee80211w=$ieee80211w" "$N" [ "$ieee80211w" -gt "0" ] && { - append bss_conf "group_mgmt_cipher=${ieee80211w_mgmt_cipher:-AES-128-CMAC}" "$N" + if [ "$auth_type" = "eap192" ]; then + append bss_conf "group_mgmt_cipher=BIP-GMAC-256" "$N" + else + append bss_conf "group_mgmt_cipher=${ieee80211w_mgmt_cipher:-AES-128-CMAC}" "$N" + fi [ -n "$ieee80211w_max_timeout" ] && \ append bss_conf "assoc_sa_query_max_timeout=$ieee80211w_max_timeout" "$N" [ -n "$ieee80211w_retry_timeout" ] && \ From 4807bd6a00bcf44dd821047db76a2a799f403cd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= Date: Tue, 5 Jul 2022 17:10:43 +0300 Subject: [PATCH 18/28] ramips: fix GB-PC1 and GB-PC2 device support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change switch port labels to ethblack & ethblue. Change lan1 & lan2 LEDs to ethblack_act & ethblue_act and fix GPIO pins. Add the external phy with ethyellow label on the GB-PC2 devicetree. Do not claim rgmii2 as gpio, it's used for ethernet with rgmii2 function. Enable ICPlus PHY driver for IP1001 which GB-PC2 has got. Update interface name and change netdev function. Enable lzma compression to make up for the increased size of the kernel. Make spi flash bindings on par with mainline Linux to fix read errors. Tested on GB-PC2 by Petr. Tested-by: Petr Louda Signed-off-by: Arınç ÜNAL --- .../linux/ramips/dts/mt7621_gnubee_gb-pc1.dts | 51 ++++++------ .../linux/ramips/dts/mt7621_gnubee_gb-pc2.dts | 77 ++++++++++--------- target/linux/ramips/image/mt7621.mk | 2 + .../mt7621/base-files/etc/board.d/01_leds | 4 +- .../mt7621/base-files/etc/board.d/02_network | 6 +- target/linux/ramips/mt7621/config-5.10 | 1 + target/linux/ramips/mt7621/config-5.15 | 1 + 7 files changed, 74 insertions(+), 68 deletions(-) diff --git a/target/linux/ramips/dts/mt7621_gnubee_gb-pc1.dts b/target/linux/ramips/dts/mt7621_gnubee_gb-pc1.dts index 6854d56266..21a1839127 100644 --- a/target/linux/ramips/dts/mt7621_gnubee_gb-pc1.dts +++ b/target/linux/ramips/dts/mt7621_gnubee_gb-pc1.dts @@ -8,10 +8,10 @@ model = "GB-PC1"; aliases { - led-boot = &led_status; - led-failsafe = &led_status; - led-running = &led_status; - led-upgrade = &led_status; + led-boot = &led_system; + led-failsafe = &led_system; + led-running = &led_system; + led-upgrade = &led_system; }; keys { @@ -27,24 +27,26 @@ leds { compatible = "gpio-leds"; - system { - label = "green:system"; + ethblack_act { + label = "green:ethblack_act"; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + }; + + ethblue_act { + label = "green:ethblue_act"; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + }; + + power { + label = "green:power"; gpios = <&gpio 6 GPIO_ACTIVE_LOW>; + linux,default-trigger = "default-on"; }; - led_status: status { - label = "green:status"; + led_system: system { + label = "green:system"; gpios = <&gpio 8 GPIO_ACTIVE_LOW>; - }; - - lan1 { - label = "green:lan1"; - gpios = <&gpio 24 GPIO_ACTIVE_LOW>; - }; - - lan2 { - label = "green:lan2"; - gpios = <&gpio 25 GPIO_ACTIVE_LOW>; + linux,default-trigger = "disk-activity"; }; }; }; @@ -59,9 +61,8 @@ flash@0 { compatible = "jedec,spi-nor"; reg = <0>; - spi-max-frequency = <80000000>; + spi-max-frequency = <50000000>; broken-flash-reset; - m25p,fast-read; partitions { compatible = "fixed-partitions"; @@ -99,10 +100,6 @@ status = "okay"; }; -ðernet { - pinctrl-0 = <&mdio_pins>, <&rgmii1_pins>; -}; - &gmac0 { nvmem-cells = <&macaddr_factory_e000>; nvmem-cell-names = "mac-address"; @@ -112,19 +109,19 @@ ports { port@0 { status = "okay"; - label = "lan1"; + label = "ethblack"; }; port@4 { status = "okay"; - label = "lan2"; + label = "ethblue"; }; }; }; &state_default { gpio { - groups = "jtag", "rgmii2", "uart3", "wdt"; + groups = "jtag", "uart3", "wdt"; function = "gpio"; }; }; diff --git a/target/linux/ramips/dts/mt7621_gnubee_gb-pc2.dts b/target/linux/ramips/dts/mt7621_gnubee_gb-pc2.dts index de113c2a5a..cd72ea1d62 100644 --- a/target/linux/ramips/dts/mt7621_gnubee_gb-pc2.dts +++ b/target/linux/ramips/dts/mt7621_gnubee_gb-pc2.dts @@ -8,10 +8,10 @@ model = "GB-PC2"; aliases { - led-boot = &led_status; - led-failsafe = &led_status; - led-running = &led_status; - led-upgrade = &led_status; + led-boot = &led_system; + led-failsafe = &led_system; + led-running = &led_system; + led-upgrade = &led_system; }; keys { @@ -27,34 +27,26 @@ leds { compatible = "gpio-leds"; - system { - label = "green:system"; + ethblack_act { + label = "green:ethblack_act"; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + }; + + ethblue_act { + label = "green:ethblue_act"; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + }; + + power { + label = "green:power"; gpios = <&gpio 6 GPIO_ACTIVE_LOW>; + linux,default-trigger = "default-on"; }; - led_status: status { - label = "green:status"; + led_system: system { + label = "green:system"; gpios = <&gpio 8 GPIO_ACTIVE_LOW>; - }; - - lan1 { - label = "green:lan1"; - gpios = <&gpio 24 GPIO_ACTIVE_LOW>; - }; - - lan2 { - label = "green:lan2"; - gpios = <&gpio 25 GPIO_ACTIVE_LOW>; - }; - - lan3-yellow { - label = "yellow:lan3"; - gpios = <&gpio 13 GPIO_ACTIVE_LOW>; - }; - - lan3-green { - label = "green:lan3"; - gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + linux,default-trigger = "disk-activity"; }; }; }; @@ -69,9 +61,8 @@ flash@0 { compatible = "jedec,spi-nor"; reg = <0>; - spi-max-frequency = <80000000>; + spi-max-frequency = <50000000>; broken-flash-reset; - m25p,fast-read; partitions { compatible = "fixed-partitions"; @@ -109,32 +100,44 @@ status = "okay"; }; -ðernet { - pinctrl-0 = <&mdio_pins>, <&rgmii1_pins>; -}; - &gmac0 { nvmem-cells = <&macaddr_factory_e000>; nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "ethyellow"; + phy-handle = <ðphy5>; + + nvmem-cells = <&macaddr_factory_e000>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy5: ethernet-phy@5 { + reg = <5>; + phy-mode = "rgmii-rxid"; + }; +}; + &switch0 { ports { port@0 { status = "okay"; - label = "lan1"; + label = "ethblack"; }; port@4 { status = "okay"; - label = "lan2"; + label = "ethblue"; }; }; }; &state_default { gpio { - groups = "jtag", "rgmii2", "uart3", "wdt"; + groups = "jtag", "uart3", "wdt"; function = "gpio"; }; }; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index c3a63fa934..dbafaaddde 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -771,6 +771,7 @@ TARGET_DEVICES += glinet_gl-mt1300 define Device/gnubee_gb-pc1 $(Device/dsa-migration) + $(Device/uimage-lzma-loader) DEVICE_VENDOR := GnuBee DEVICE_MODEL := Personal Cloud One DEVICE_PACKAGES := kmod-ata-ahci kmod-usb3 kmod-sdhci-mt7620 -wpad-basic-wolfssl @@ -780,6 +781,7 @@ TARGET_DEVICES += gnubee_gb-pc1 define Device/gnubee_gb-pc2 $(Device/dsa-migration) + $(Device/uimage-lzma-loader) DEVICE_VENDOR := GnuBee DEVICE_MODEL := Personal Cloud Two DEVICE_PACKAGES := kmod-ata-ahci kmod-usb3 kmod-sdhci-mt7620 -wpad-basic-wolfssl 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 0daf15dd4d..0e8244772d 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds @@ -66,8 +66,8 @@ dlink,dir-882-r1) ;; gnubee,gb-pc1|\ gnubee,gb-pc2) - ucidef_set_led_netdev "lan1" "lan1" "green:lan1" "lan1" - ucidef_set_led_netdev "lan2" "lan2" "green:lan2" "lan2" + ucidef_set_led_netdev "ethblack_act" "ethblack act" "green:ethblack_act" "ethblack" "tx rx" + ucidef_set_led_netdev "ethblue_act" "ethblue act" "green:ethblue_act" "ethblue" "tx rx" ;; linksys,e5600) ucidef_set_led_netdev "wan" "wan link" "blue:wan" "wan" "link" diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network index af493789ba..1fa6182c4d 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network @@ -71,9 +71,11 @@ ramips_setup_interfaces() uci add_list firewall.@zone[1].network='eth_data' uci add_list firewall.@zone[1].network='eth_om' ;; - gnubee,gb-pc1|\ + gnubee,gb-pc1) + ucidef_set_interface_lan "ethblack ethblue" + ;; gnubee,gb-pc2) - ucidef_set_interface_lan "lan1 lan2" + ucidef_set_interface_lan "ethblack ethblue ethyellow" ;; linksys,re6500|\ netgear,wac104|\ diff --git a/target/linux/ramips/mt7621/config-5.10 b/target/linux/ramips/mt7621/config-5.10 index 761ed23d77..1b415f3e66 100644 --- a/target/linux/ramips/mt7621/config-5.10 +++ b/target/linux/ramips/mt7621/config-5.10 @@ -100,6 +100,7 @@ CONFIG_I2C_BOARDINFO=y CONFIG_I2C_CHARDEV=y CONFIG_I2C_GPIO=y CONFIG_I2C_MT7621=y +CONFIG_ICPLUS_PHY=y CONFIG_INITRAMFS_SOURCE="" CONFIG_IRQCHIP=y CONFIG_IRQ_DOMAIN=y diff --git a/target/linux/ramips/mt7621/config-5.15 b/target/linux/ramips/mt7621/config-5.15 index 5fbcefc3ae..cbab647d7c 100644 --- a/target/linux/ramips/mt7621/config-5.15 +++ b/target/linux/ramips/mt7621/config-5.15 @@ -105,6 +105,7 @@ CONFIG_I2C_BOARDINFO=y CONFIG_I2C_CHARDEV=y CONFIG_I2C_GPIO=y CONFIG_I2C_MT7621=y +CONFIG_ICPLUS_PHY=y # CONFIG_INGENIC_CGU_JZ4760 is not set CONFIG_INITRAMFS_SOURCE="" CONFIG_IRQCHIP=y From 271456abd895934f90af37c4c4521e94fdcda4b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= Date: Sun, 14 Aug 2022 10:44:12 +0300 Subject: [PATCH 19/28] ramips: mt7621-dts: do not claim rgmii2 group as gpio for certain devices MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These devices do not use rgmii2 as gpio, therefore remove rgmii2 pin group from state-default. Remove overwriting the ethernet node for these devices. Move claiming the rgmii2 group from mt7621_zyxel_nwa-ax.dtsi to mt7621_zyxel_nwa50ax.dts as it's only the latter using rgmii2 pins as gpio. Remove duplicate ethernet overwrite from mt7621_tplink_archer-x6-v3.dtsi. Claim rgmii2 group as gpio on mt7621_bolt_arion.dts as it uses an rgmii2 pin, 26, as gpio. Signed-off-by: Arınç ÜNAL --- target/linux/ramips/dts/mt7621_bolt_arion.dts | 6 +++++- .../linux/ramips/dts/mt7621_buffalo_wsr-1166dhp.dts | 6 +----- target/linux/ramips/dts/mt7621_buffalo_wsr-600dhp.dts | 6 +----- .../ramips/dts/mt7621_mediatek_ap-mt7621a-v60.dts | 6 +----- .../ramips/dts/mt7621_mediatek_mt7621-eval-board.dts | 6 +----- .../linux/ramips/dts/mt7621_tplink_archer-c6u-v1.dts | 5 ----- .../linux/ramips/dts/mt7621_tplink_archer-x6-v3.dtsi | 5 ----- .../linux/ramips/dts/mt7621_zbtlink_zbt-wg1602.dtsi | 6 +----- target/linux/ramips/dts/mt7621_zyxel_nr7101.dts | 6 +----- target/linux/ramips/dts/mt7621_zyxel_nwa-ax.dtsi | 6 +----- target/linux/ramips/dts/mt7621_zyxel_nwa50ax.dts | 11 +++++++++++ 11 files changed, 23 insertions(+), 46 deletions(-) diff --git a/target/linux/ramips/dts/mt7621_bolt_arion.dts b/target/linux/ramips/dts/mt7621_bolt_arion.dts index a665b7b143..7ba413932e 100644 --- a/target/linux/ramips/dts/mt7621_bolt_arion.dts +++ b/target/linux/ramips/dts/mt7621_bolt_arion.dts @@ -163,9 +163,13 @@ }; }; +ðernet { + pinctrl-0 = <&mdio_pins>, <&rgmii1_pins>; +}; + &state_default { gpio { - groups = "jtag", "uart2", "uart3", "wdt"; + groups = "jtag", "uart2", "uart3", "wdt", "rgmii2"; function = "gpio"; }; }; diff --git a/target/linux/ramips/dts/mt7621_buffalo_wsr-1166dhp.dts b/target/linux/ramips/dts/mt7621_buffalo_wsr-1166dhp.dts index 74d8fbe1d1..5a259e154c 100644 --- a/target/linux/ramips/dts/mt7621_buffalo_wsr-1166dhp.dts +++ b/target/linux/ramips/dts/mt7621_buffalo_wsr-1166dhp.dts @@ -152,10 +152,6 @@ }; }; -ðernet { - pinctrl-0 = <&mdio_pins>, <&rgmii1_pins>; -}; - &switch0 { ports { port@0 { @@ -187,7 +183,7 @@ &state_default { gpio { - groups = "i2c", "uart2", "uart3", "rgmii2", "sdhci"; + groups = "i2c", "uart2", "uart3", "sdhci"; function = "gpio"; }; }; diff --git a/target/linux/ramips/dts/mt7621_buffalo_wsr-600dhp.dts b/target/linux/ramips/dts/mt7621_buffalo_wsr-600dhp.dts index 0f3b0fd8f0..15d055bee6 100644 --- a/target/linux/ramips/dts/mt7621_buffalo_wsr-600dhp.dts +++ b/target/linux/ramips/dts/mt7621_buffalo_wsr-600dhp.dts @@ -149,7 +149,7 @@ &state_default { gpio { - groups = "i2c", "uart2", "uart3", "rgmii2", "sdhci"; + groups = "i2c", "uart2", "uart3", "sdhci"; function = "gpio"; }; }; @@ -172,10 +172,6 @@ }; }; -ðernet { - pinctrl-0 = <&mdio_pins>, <&rgmii1_pins>; -}; - &gmac0 { nvmem-cells = <&macaddr_factory_4>; nvmem-cell-names = "mac-address"; diff --git a/target/linux/ramips/dts/mt7621_mediatek_ap-mt7621a-v60.dts b/target/linux/ramips/dts/mt7621_mediatek_ap-mt7621a-v60.dts index 43cf502b0b..a89d9189c0 100644 --- a/target/linux/ramips/dts/mt7621_mediatek_ap-mt7621a-v60.dts +++ b/target/linux/ramips/dts/mt7621_mediatek_ap-mt7621a-v60.dts @@ -32,7 +32,7 @@ &state_default { gpio { - groups = "uart2", "rgmii2"; + groups = "uart2"; function = "gpio"; }; }; @@ -112,10 +112,6 @@ status = "okay"; }; -ðernet { - pinctrl-0 = <&mdio_pins>, <&rgmii1_pins>; -}; - &gmac0 { nvmem-cells = <&macaddr_factory_5>; nvmem-cell-names = "mac-address"; diff --git a/target/linux/ramips/dts/mt7621_mediatek_mt7621-eval-board.dts b/target/linux/ramips/dts/mt7621_mediatek_mt7621-eval-board.dts index ce627d6621..dcdcc261b3 100644 --- a/target/linux/ramips/dts/mt7621_mediatek_mt7621-eval-board.dts +++ b/target/linux/ramips/dts/mt7621_mediatek_mt7621-eval-board.dts @@ -39,10 +39,6 @@ status = "okay"; }; -ðernet { - pinctrl-0 = <&mdio_pins>, <&rgmii1_pins>; -}; - &switch0 { ports { port@0 { @@ -74,7 +70,7 @@ &state_default { gpio { - groups = "i2c", "uart2", "uart3", "rgmii2", "sdhci"; + groups = "i2c", "uart2", "uart3", "sdhci"; function = "gpio"; }; }; diff --git a/target/linux/ramips/dts/mt7621_tplink_archer-c6u-v1.dts b/target/linux/ramips/dts/mt7621_tplink_archer-c6u-v1.dts index 93ceeb08f4..67668657bd 100644 --- a/target/linux/ramips/dts/mt7621_tplink_archer-c6u-v1.dts +++ b/target/linux/ramips/dts/mt7621_tplink_archer-c6u-v1.dts @@ -163,11 +163,6 @@ }; }; -ðernet { - pinctrl-names = "default"; - pinctrl-0 = <&rgmii1_pins &mdio_pins>; -}; - &gmac0 { nvmem-cells = <&macaddr_config_8>; nvmem-cell-names = "mac-address"; diff --git a/target/linux/ramips/dts/mt7621_tplink_archer-x6-v3.dtsi b/target/linux/ramips/dts/mt7621_tplink_archer-x6-v3.dtsi index 6454273f49..217c1b60fe 100644 --- a/target/linux/ramips/dts/mt7621_tplink_archer-x6-v3.dtsi +++ b/target/linux/ramips/dts/mt7621_tplink_archer-x6-v3.dtsi @@ -120,11 +120,6 @@ }; }; -ðernet { - pinctrl-names = "default"; - pinctrl-0 = <&rgmii1_pins &mdio_pins>; -}; - &pcie { status = "okay"; }; diff --git a/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg1602.dtsi b/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg1602.dtsi index 4830206ae1..356cf4b442 100644 --- a/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg1602.dtsi +++ b/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg1602.dtsi @@ -148,10 +148,6 @@ }; }; -ðernet { - pinctrl-0 = <&mdio_pins>, <&rgmii1_pins>; -}; - &gmac0 { nvmem-cells = <&macaddr_factory_e000>; nvmem-cell-names = "mac-address"; @@ -190,7 +186,7 @@ &state_default { gpio { - groups = "i2c", "rgmii2", "uart2", "wdt"; + groups = "i2c", "uart2", "wdt"; function = "gpio"; }; }; diff --git a/target/linux/ramips/dts/mt7621_zyxel_nr7101.dts b/target/linux/ramips/dts/mt7621_zyxel_nr7101.dts index 71eb4c9414..63d992973a 100644 --- a/target/linux/ramips/dts/mt7621_zyxel_nr7101.dts +++ b/target/linux/ramips/dts/mt7621_zyxel_nr7101.dts @@ -143,10 +143,6 @@ }; }; -ðernet { - pinctrl-0 = <&mdio_pins>, <&rgmii1_pins>; -}; - &gmac0 { nvmem-cells = <&macaddr_factory_e000>; nvmem-cell-names = "mac-address"; @@ -163,7 +159,7 @@ &state_default { gpio { - groups = "i2c", "rgmii2", "uart3", "jtag", "wdt"; + groups = "i2c", "uart3", "jtag", "wdt"; function = "gpio"; }; }; diff --git a/target/linux/ramips/dts/mt7621_zyxel_nwa-ax.dtsi b/target/linux/ramips/dts/mt7621_zyxel_nwa-ax.dtsi index e1353346a8..fa7e23dd47 100644 --- a/target/linux/ramips/dts/mt7621_zyxel_nwa-ax.dtsi +++ b/target/linux/ramips/dts/mt7621_zyxel_nwa-ax.dtsi @@ -141,11 +141,7 @@ &state_default { gpio { - groups = "uart3", "rgmii2"; + groups = "uart3"; function = "gpio"; }; }; - -ðernet { - pinctrl-0 = <&mdio_pins>, <&rgmii1_pins>; -}; diff --git a/target/linux/ramips/dts/mt7621_zyxel_nwa50ax.dts b/target/linux/ramips/dts/mt7621_zyxel_nwa50ax.dts index 70323f2422..62ba49e797 100644 --- a/target/linux/ramips/dts/mt7621_zyxel_nwa50ax.dts +++ b/target/linux/ramips/dts/mt7621_zyxel_nwa50ax.dts @@ -43,3 +43,14 @@ }; }; }; + +ðernet { + pinctrl-0 = <&mdio_pins>, <&rgmii1_pins>; +}; + +&state_default { + gpio { + groups = "uart3", "rgmii2"; + function = "gpio"; + }; +}; From 81bd10e4a2f49f8351779a4b464d331f79f6a15c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= Date: Tue, 5 Jul 2022 17:34:11 +0300 Subject: [PATCH 20/28] ramips: mt7621-dts: remove DTS_LEGACY from ethernet node MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove DTS_LEGACY put for claiming pin groups for the ethernet node from the ethernet node. It's not an old kernel trait. These bindings need to be there on the newer kernels as well. Fixes: a3764ee29dd0 ("ramips: add linux 5.15 support for mt7621") Signed-off-by: Arınç ÜNAL --- target/linux/ramips/dts/mt7621.dtsi | 2 -- 1 file changed, 2 deletions(-) diff --git a/target/linux/ramips/dts/mt7621.dtsi b/target/linux/ramips/dts/mt7621.dtsi index 3e86a7894a..c9f50a62f3 100644 --- a/target/linux/ramips/dts/mt7621.dtsi +++ b/target/linux/ramips/dts/mt7621.dtsi @@ -486,10 +486,8 @@ mediatek,ethsys = <&sysc>; -#ifdef DTS_LEGACY pinctrl-names = "default"; pinctrl-0 = <&mdio_pins>, <&rgmii1_pins>, <&rgmii2_pins>; -#endif gmac0: mac@0 { compatible = "mediatek,eth-mac"; From f1c9afd801380a05a91d979b475c76cc0a67caae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= Date: Wed, 6 Jul 2022 01:20:32 +0300 Subject: [PATCH 21/28] ramips: mt7621-dts: mux phy0/4 to gmac1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mux the MT7530 switch's phy0/4 to the SoC's gmac1 on devices where RGMII2 pins are available. This achieves 2 Gbps total bandwidth to the CPU using the second RGMII. The ports called "wan" are muxed where possible. On a minority of devices, this is not possible. Those cases: mt7621_ampedwireless_ally-r1900k.dts: lan3 mt7621_ubnt_edgerouter-x.dts: eth0 mt7621_gnubee_gb-pc1.dts: ethblue mt7621_linksys_re6500.dts: lan1 mt7621_netgear_wac104.dts: lan4 mt7621_tplink_eap235-wall-v1.dts: lan0 mt7621_tplink_eap615-wall-v1.dts: lan0 mt7621_ubnt_usw-flex.dts: lan1 The "wan" port is just what the vendor designated on the board/plastic chasis of the device. On a technical level, there is no difference between a lan and wan port on MT7621AT, MT7621DAT and MT7621ST SoCs. Prefer connecting to WAN via the port described above for these devices to benefit the feature brought with this patch. mt7621_d-team_newifi-d2.dts cannot benefit this feature, although it looks like it should, because the rgmii2 pins are wired to unused components. Tested on a range of devices documented on the GitHub PR. Link: https://github.com/openwrt/openwrt/pull/10238 Signed-off-by: Arınç ÜNAL --- target/linux/ramips/dts/mt7621_adslr_g7.dts | 24 +++++++++++------ .../ramips/dts/mt7621_afoundry_ew1200.dts | 24 +++++++++++------ .../dts/mt7621_ampedwireless_ally-r1900k.dts | 17 ++++++++---- .../ramips/dts/mt7621_arcadyan_wg4xx223.dtsi | 20 ++++++++++---- .../ramips/dts/mt7621_asiarf_ap7621-001.dts | 24 +++++++++++------ .../ramips/dts/mt7621_asiarf_ap7621-nv1.dts | 24 +++++++++++------ .../linux/ramips/dts/mt7621_asus_rt-ac57u.dts | 22 +++++++++++----- .../ramips/dts/mt7621_asus_rt-acx5p.dtsi | 20 ++++++++++---- .../linux/ramips/dts/mt7621_asus_rt-ax53u.dts | 20 ++++++++++---- .../ramips/dts/mt7621_asus_rt-n56u-b1.dts | 24 +++++++++++------ .../dts/mt7621_beeline_smartbox-giga.dts | 25 +++++++++++------- .../dts/mt7621_beeline_smartbox-turbo.dts | 25 +++++++++++------- .../ramips/dts/mt7621_buffalo_wsr-1166dhp.dts | 17 ++++++++---- .../dts/mt7621_buffalo_wsr-2533dhpl.dts | 21 +++++++++++---- .../ramips/dts/mt7621_buffalo_wsr-600dhp.dts | 20 ++++++++++---- .../linux/ramips/dts/mt7621_cudy_wr1300.dts | 24 +++++++++++------ .../linux/ramips/dts/mt7621_cudy_wr2100.dts | 25 +++++++++++------- target/linux/ramips/dts/mt7621_cudy_x6.dts | 24 +++++++++++------ .../ramips/dts/mt7621_dlink_dir-853-a3.dts | 22 +++++++++++----- .../ramips/dts/mt7621_dlink_dir-853-r1.dts | 26 ++++++++++++------- .../ramips/dts/mt7621_dlink_dir-860l-b1.dts | 20 ++++++++++---- .../ramips/dts/mt7621_dlink_dir-867-a1.dts | 2 +- .../ramips/dts/mt7621_dlink_dir-878-a1.dts | 2 +- .../ramips/dts/mt7621_dlink_dir-878-r1.dts | 2 +- .../ramips/dts/mt7621_dlink_dir-882-a1.dts | 2 +- .../ramips/dts/mt7621_dlink_dir-882-r1.dts | 2 +- .../ramips/dts/mt7621_dlink_dir-8xx.dtsi | 17 ++++++++---- .../ramips/dts/mt7621_dlink_dir-xx60-a1.dtsi | 22 +++++++++++----- .../linux/ramips/dts/mt7621_edimax_rx21s.dtsi | 20 ++++++++++---- .../dts/mt7621_elecom_wrc-1167ghbk2-s.dts | 22 +++++++++++----- .../dts/mt7621_elecom_wrc-1167gs2-b.dts | 2 +- .../ramips/dts/mt7621_elecom_wrc-1167gst2.dts | 2 +- .../ramips/dts/mt7621_elecom_wrc-1750gs.dts | 2 +- .../ramips/dts/mt7621_elecom_wrc-1750gst2.dts | 2 +- .../ramips/dts/mt7621_elecom_wrc-1750gsv.dts | 2 +- .../ramips/dts/mt7621_elecom_wrc-1900gst.dts | 2 +- .../dts/mt7621_elecom_wrc-2533ghbk-i.dts | 17 ++++++++---- .../ramips/dts/mt7621_elecom_wrc-2533gs2.dts | 2 +- .../ramips/dts/mt7621_elecom_wrc-2533gst.dts | 2 +- .../ramips/dts/mt7621_elecom_wrc-2533gst2.dts | 2 +- .../ramips/dts/mt7621_elecom_wrc-gs.dtsi | 19 +++++++++----- .../ramips/dts/mt7621_gehua_ghl-r-001.dts | 24 +++++++++++------ .../ramips/dts/mt7621_glinet_gl-mt1300.dts | 24 +++++++++++------ .../linux/ramips/dts/mt7621_gnubee_gb-pc1.dts | 20 ++++++++++---- .../dts/mt7621_hilink_hlk-7621a-evb.dts | 17 ++++++++---- .../linux/ramips/dts/mt7621_hiwifi_hc5962.dts | 17 ++++++++---- target/linux/ramips/dts/mt7621_humax_e10.dts | 24 +++++++++++------ .../ramips/dts/mt7621_iodata_wn-ax1167gr.dts | 24 +++++++++++------ .../ramips/dts/mt7621_iodata_wn-dx1200gr.dts | 24 +++++++++++------ .../ramips/dts/mt7621_iodata_wn-gx300gr.dts | 24 +++++++++++------ .../ramips/dts/mt7621_iodata_wn-xx-xr.dtsi | 24 +++++++++++------ .../ramips/dts/mt7621_iodata_wnpr2600g.dts | 20 ++++++++++---- .../ramips/dts/mt7621_iptime_a3002mesh.dts | 22 +++++++++++----- .../ramips/dts/mt7621_iptime_a3004ns-dual.dts | 22 +++++++++++----- .../linux/ramips/dts/mt7621_iptime_a3004t.dts | 24 +++++++++++------ .../ramips/dts/mt7621_iptime_a6004ns-m.dtsi | 22 +++++++++++----- .../linux/ramips/dts/mt7621_iptime_a8004t.dts | 22 +++++++++++----- .../ramips/dts/mt7621_iptime_ax2004m.dts | 24 +++++++++++------ .../linux/ramips/dts/mt7621_iptime_t5004.dts | 17 ++++++++---- .../ramips/dts/mt7621_jcg_jhr-ac876m.dts | 23 +++++++++++----- target/linux/ramips/dts/mt7621_jcg_q20.dts | 22 +++++++++++----- target/linux/ramips/dts/mt7621_jcg_y2.dts | 22 +++++++++++----- .../ramips/dts/mt7621_lenovo_newifi-d1.dts | 22 +++++++++++----- .../linux/ramips/dts/mt7621_linksys_e5600.dts | 17 ++++++++---- .../ramips/dts/mt7621_linksys_ea6350-v4.dts | 17 ++++++++++-- .../ramips/dts/mt7621_linksys_ea7xxx.dtsi | 17 ++++++++---- .../ramips/dts/mt7621_linksys_re6500.dts | 20 ++++++++++---- .../dts/mt7621_mediatek_ap-mt7621a-v60.dts | 24 +++++++++++------ .../dts/mt7621_mediatek_mt7621-eval-board.dts | 17 ++++++++---- .../mt7621_mikrotik_routerboard-750gr3.dts | 20 ++++++++++++++ .../dts/mt7621_mikrotik_routerboard-m33g.dts | 17 ++++++++---- .../linux/ramips/dts/mt7621_mqmaker_witi.dts | 24 +++++++++++------ .../linux/ramips/dts/mt7621_netgear_r6220.dts | 2 +- .../dts/mt7621_netgear_sercomm_ayx.dtsi | 17 ++++++++---- .../dts/mt7621_netgear_sercomm_bzv.dtsi | 24 +++++++++++------ .../dts/mt7621_netgear_sercomm_chj.dtsi | 24 +++++++++++------ .../ramips/dts/mt7621_netgear_wac104.dts | 20 ++++++++++---- .../ramips/dts/mt7621_netgear_wax202.dts | 17 ++++++++---- .../ramips/dts/mt7621_netgear_wndr3700-v5.dts | 2 +- .../linux/ramips/dts/mt7621_netis_wf2881.dts | 22 +++++++++++----- .../linux/ramips/dts/mt7621_oraybox_x3a.dts | 24 +++++++++++------ .../linux/ramips/dts/mt7621_phicomm_k2p.dts | 22 +++++++++++----- .../linux/ramips/dts/mt7621_planex_vr500.dts | 22 +++++++++++----- .../dts/mt7621_raisecom_msg1500-x-00.dts | 17 ++++++++---- .../dts/mt7621_renkforce_ws-wn530hp3-a.dts | 24 +++++++++++------ .../dts/mt7621_samknows_whitebox-v8.dts | 22 +++++++++++----- .../dts/mt7621_storylink_sap-g3200u3.dts | 24 +++++++++++------ .../ramips/dts/mt7621_tenbay_t-mb5eu-v01.dts | 26 ++++++++++++------- .../ramips/dts/mt7621_totolink_a7000r.dts | 24 +++++++++++------ .../ramips/dts/mt7621_totolink_x5000r.dts | 22 +++++++++++----- .../dts/mt7621_tplink_archer-c6u-v1.dts | 24 +++++++++++------ .../dts/mt7621_tplink_eap235-wall-v1.dts | 20 ++++++++++---- .../dts/mt7621_tplink_eap615-wall-v1.dts | 20 ++++++++++---- .../ramips/dts/mt7621_ubnt_edgerouter-x.dts | 23 ++++++++++++++++ .../linux/ramips/dts/mt7621_ubnt_usw-flex.dts | 20 ++++++++++---- .../dts/mt7621_unielec_u7621-01-16m.dts | 2 +- .../ramips/dts/mt7621_unielec_u7621-01.dtsi | 17 ++++++++---- .../dts/mt7621_unielec_u7621-06-16m.dts | 2 +- .../dts/mt7621_unielec_u7621-06-64m.dts | 2 +- .../ramips/dts/mt7621_unielec_u7621-06.dtsi | 17 ++++++++---- .../dts/mt7621_xiaomi_mi-router-3-pro.dts | 22 +++++++++++----- .../ramips/dts/mt7621_xiaomi_mi-router-4.dts | 22 +++++++++++----- .../dts/mt7621_xiaomi_mi-router-4a-3g-v2.dtsi | 24 +++++++++++------ .../dts/mt7621_xiaomi_mi-router-cr660x.dtsi | 22 +++++++++++----- .../dts/mt7621_xiaomi_router-ac2100.dtsi | 22 +++++++++++----- .../linux/ramips/dts/mt7621_xiaoyu_xy-c5.dts | 24 +++++++++++------ .../ramips/dts/mt7621_youhua_wr1200js.dts | 22 +++++++++++----- .../linux/ramips/dts/mt7621_youku_yk-l2.dts | 22 +++++++++++----- .../linux/ramips/dts/mt7621_yuncore_ax820.dts | 24 +++++++++++------ .../ramips/dts/mt7621_zbtlink_zbt-we1326.dts | 22 +++++++++++----- .../ramips/dts/mt7621_zbtlink_zbt-we3526.dts | 22 +++++++++++----- .../ramips/dts/mt7621_zbtlink_zbt-wg1602.dtsi | 22 +++++++++++----- .../ramips/dts/mt7621_zbtlink_zbt-wg1608.dtsi | 22 +++++++++++----- 113 files changed, 1429 insertions(+), 635 deletions(-) diff --git a/target/linux/ramips/dts/mt7621_adslr_g7.dts b/target/linux/ramips/dts/mt7621_adslr_g7.dts index 95f2ac3a20..956733f7c3 100644 --- a/target/linux/ramips/dts/mt7621_adslr_g7.dts +++ b/target/linux/ramips/dts/mt7621_adslr_g7.dts @@ -105,6 +105,22 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; + + nvmem-cells = <&macaddr_factory_e00c>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <1>; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { ports { port@0 { @@ -126,14 +142,6 @@ status = "okay"; label = "lan4"; }; - - port@4 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_factory_e00c>; - nvmem-cell-names = "mac-address"; - mac-address-increment = <1>; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_afoundry_ew1200.dts b/target/linux/ramips/dts/mt7621_afoundry_ew1200.dts index 2ed9f716ab..119acd977c 100644 --- a/target/linux/ramips/dts/mt7621_afoundry_ew1200.dts +++ b/target/linux/ramips/dts/mt7621_afoundry_ew1200.dts @@ -110,6 +110,22 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; + + nvmem-cells = <&macaddr_factory_e000>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <1>; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { ports { port@0 { @@ -131,14 +147,6 @@ status = "okay"; label = "lan4"; }; - - port@4 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_factory_e000>; - nvmem-cell-names = "mac-address"; - mac-address-increment = <1>; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_ampedwireless_ally-r1900k.dts b/target/linux/ramips/dts/mt7621_ampedwireless_ally-r1900k.dts index cd2536e179..07e0d23788 100644 --- a/target/linux/ramips/dts/mt7621_ampedwireless_ally-r1900k.dts +++ b/target/linux/ramips/dts/mt7621_ampedwireless_ally-r1900k.dts @@ -7,6 +7,18 @@ model = "Amped Wireless ALLY-R1900K"; }; +&gmac1 { + status = "okay"; + label = "lan3"; + phy-handle = <ðphy4>; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { ports { port@1 { @@ -23,10 +35,5 @@ status = "okay"; label = "lan2"; }; - - port@4 { - status = "okay"; - label = "lan3"; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_arcadyan_wg4xx223.dtsi b/target/linux/ramips/dts/mt7621_arcadyan_wg4xx223.dtsi index 5a845c4e9b..8c4be8440d 100644 --- a/target/linux/ramips/dts/mt7621_arcadyan_wg4xx223.dtsi +++ b/target/linux/ramips/dts/mt7621_arcadyan_wg4xx223.dtsi @@ -171,6 +171,21 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; + + nvmem-cells = <&macaddr_factory_fff0>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { ports { port@2 { @@ -182,11 +197,6 @@ status = "okay"; label = "lan1"; }; - - port@4 { - status = "okay"; - label = "wan"; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_asiarf_ap7621-001.dts b/target/linux/ramips/dts/mt7621_asiarf_ap7621-001.dts index c74fee3102..5e57842d68 100644 --- a/target/linux/ramips/dts/mt7621_asiarf_ap7621-001.dts +++ b/target/linux/ramips/dts/mt7621_asiarf_ap7621-001.dts @@ -7,19 +7,27 @@ model = "AsiaRF AP7621-001"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; + + nvmem-cells = <&macaddr_factory_e000>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <1>; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { ports { port@0 { status = "okay"; label = "lan"; }; - - port@4 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_factory_e000>; - nvmem-cell-names = "mac-address"; - mac-address-increment = <1>; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_asiarf_ap7621-nv1.dts b/target/linux/ramips/dts/mt7621_asiarf_ap7621-nv1.dts index 907b6d1470..dabc1a3bd3 100644 --- a/target/linux/ramips/dts/mt7621_asiarf_ap7621-nv1.dts +++ b/target/linux/ramips/dts/mt7621_asiarf_ap7621-nv1.dts @@ -7,16 +7,24 @@ model = "AsiaRF AP7621-NV1"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy0>; + + nvmem-cells = <&macaddr_factory_e000>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <1>; +}; + +&mdio { + ethphy0: ethernet-phy@0 { + reg = <0>; + }; +}; + &switch0 { ports { - port@0 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_factory_e000>; - nvmem-cell-names = "mac-address"; - mac-address-increment = <1>; - }; - port@2 { status = "okay"; label = "lan1"; diff --git a/target/linux/ramips/dts/mt7621_asus_rt-ac57u.dts b/target/linux/ramips/dts/mt7621_asus_rt-ac57u.dts index 60ab3e1646..4e8c68ddf1 100644 --- a/target/linux/ramips/dts/mt7621_asus_rt-ac57u.dts +++ b/target/linux/ramips/dts/mt7621_asus_rt-ac57u.dts @@ -134,15 +134,23 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy0>; + + nvmem-cells = <&macaddr_factory_e006>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy0: ethernet-phy@0 { + reg = <0>; + }; +}; + &switch0 { ports { - port@0 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_factory_e006>; - nvmem-cell-names = "mac-address"; - }; - port@1 { status = "okay"; label = "lan1"; diff --git a/target/linux/ramips/dts/mt7621_asus_rt-acx5p.dtsi b/target/linux/ramips/dts/mt7621_asus_rt-acx5p.dtsi index 0ccc3c7ecc..b71437bfe6 100644 --- a/target/linux/ramips/dts/mt7621_asus_rt-acx5p.dtsi +++ b/target/linux/ramips/dts/mt7621_asus_rt-acx5p.dtsi @@ -135,13 +135,23 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy0>; + + nvmem-cells = <&macaddr_factory_e000>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy0: ethernet-phy@0 { + reg = <0>; + }; +}; + &switch0 { ports { - port@0 { - status = "okay"; - label = "wan"; - }; - port@1 { status = "okay"; label = "lan1"; diff --git a/target/linux/ramips/dts/mt7621_asus_rt-ax53u.dts b/target/linux/ramips/dts/mt7621_asus_rt-ax53u.dts index 790f6cecb5..329121595a 100644 --- a/target/linux/ramips/dts/mt7621_asus_rt-ax53u.dts +++ b/target/linux/ramips/dts/mt7621_asus_rt-ax53u.dts @@ -126,13 +126,23 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy0>; + + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy0: ethernet-phy@0 { + reg = <0>; + }; +}; + &switch0 { ports { - port@0 { - status = "okay"; - label = "wan"; - }; - port@1 { status = "okay"; label = "lan1"; diff --git a/target/linux/ramips/dts/mt7621_asus_rt-n56u-b1.dts b/target/linux/ramips/dts/mt7621_asus_rt-n56u-b1.dts index 63ab424b88..c8d286e7ed 100644 --- a/target/linux/ramips/dts/mt7621_asus_rt-n56u-b1.dts +++ b/target/linux/ramips/dts/mt7621_asus_rt-n56u-b1.dts @@ -10,7 +10,7 @@ model = "ASUS RT-N56U B1"; aliases { - label-mac-device = &wan; + label-mac-device = &gmac1; led-boot = &led_power; led-failsafe = &led_power; led-running = &led_power; @@ -144,6 +144,21 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; + + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { ports { port@0 { @@ -165,13 +180,6 @@ status = "okay"; label = "lan1"; }; - - wan: port@4 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_factory_4>; - nvmem-cell-names = "mac-address"; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_beeline_smartbox-giga.dts b/target/linux/ramips/dts/mt7621_beeline_smartbox-giga.dts index efea79e2e2..22fc065eb2 100644 --- a/target/linux/ramips/dts/mt7621_beeline_smartbox-giga.dts +++ b/target/linux/ramips/dts/mt7621_beeline_smartbox-giga.dts @@ -202,17 +202,24 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy0>; + + nvmem-cells = <&macaddr_factory_21000>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <(1)>; +}; + +&mdio { + ethphy0: ethernet-phy@0 { + reg = <0>; + }; +}; + &switch0 { ports { - port@0 { - status = "okay"; - label = "wan"; - - nvmem-cells = <&macaddr_factory_21000>; - nvmem-cell-names = "mac-address"; - mac-address-increment = <(1)>; - }; - port@1 { status = "okay"; label = "lan1"; diff --git a/target/linux/ramips/dts/mt7621_beeline_smartbox-turbo.dts b/target/linux/ramips/dts/mt7621_beeline_smartbox-turbo.dts index d987046a0f..733be13e13 100644 --- a/target/linux/ramips/dts/mt7621_beeline_smartbox-turbo.dts +++ b/target/linux/ramips/dts/mt7621_beeline_smartbox-turbo.dts @@ -202,17 +202,24 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy0>; + + nvmem-cells = <&macaddr_factory_21000>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <(1)>; +}; + +&mdio { + ethphy0: ethernet-phy@0 { + reg = <0>; + }; +}; + &switch0 { ports { - port@0 { - status = "okay"; - label = "wan"; - - nvmem-cells = <&macaddr_factory_21000>; - nvmem-cell-names = "mac-address"; - mac-address-increment = <(1)>; - }; - port@1 { status = "okay"; label = "lan1"; diff --git a/target/linux/ramips/dts/mt7621_buffalo_wsr-1166dhp.dts b/target/linux/ramips/dts/mt7621_buffalo_wsr-1166dhp.dts index 5a259e154c..a8d76b544e 100644 --- a/target/linux/ramips/dts/mt7621_buffalo_wsr-1166dhp.dts +++ b/target/linux/ramips/dts/mt7621_buffalo_wsr-1166dhp.dts @@ -152,6 +152,18 @@ }; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { ports { port@0 { @@ -173,11 +185,6 @@ status = "okay"; label = "lan4"; }; - - port@4 { - status = "okay"; - label = "wan"; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_buffalo_wsr-2533dhpl.dts b/target/linux/ramips/dts/mt7621_buffalo_wsr-2533dhpl.dts index 789edca6df..be85e8ee6e 100644 --- a/target/linux/ramips/dts/mt7621_buffalo_wsr-2533dhpl.dts +++ b/target/linux/ramips/dts/mt7621_buffalo_wsr-2533dhpl.dts @@ -169,13 +169,24 @@ mac-address-increment = <(-1)>; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy0>; + + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <(-1)>; +}; + +&mdio { + ethphy0: ethernet-phy@0 { + reg = <0>; + }; +}; + &switch0 { ports { - port@0 { - status = "okay"; - label = "wan"; - }; - port@1 { status = "okay"; label = "lan4"; diff --git a/target/linux/ramips/dts/mt7621_buffalo_wsr-600dhp.dts b/target/linux/ramips/dts/mt7621_buffalo_wsr-600dhp.dts index 15d055bee6..f46bc256d0 100644 --- a/target/linux/ramips/dts/mt7621_buffalo_wsr-600dhp.dts +++ b/target/linux/ramips/dts/mt7621_buffalo_wsr-600dhp.dts @@ -177,6 +177,21 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; + + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { ports { port@0 { @@ -198,11 +213,6 @@ status = "okay"; label = "lan4"; }; - - port@4 { - status = "okay"; - label = "wan"; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_cudy_wr1300.dts b/target/linux/ramips/dts/mt7621_cudy_wr1300.dts index 3fd67c967a..2398612847 100644 --- a/target/linux/ramips/dts/mt7621_cudy_wr1300.dts +++ b/target/linux/ramips/dts/mt7621_cudy_wr1300.dts @@ -159,6 +159,22 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; + + nvmem-cells = <&macaddr_bdinfo_de00>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <1>; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { ports { port@0 { @@ -180,14 +196,6 @@ status = "okay"; label = "lan1"; }; - - port@4 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_bdinfo_de00>; - nvmem-cell-names = "mac-address"; - mac-address-increment = <1>; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_cudy_wr2100.dts b/target/linux/ramips/dts/mt7621_cudy_wr2100.dts index 21d03322a7..b2e75762a5 100644 --- a/target/linux/ramips/dts/mt7621_cudy_wr2100.dts +++ b/target/linux/ramips/dts/mt7621_cudy_wr2100.dts @@ -169,6 +169,22 @@ }; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; + + nvmem-cells = <&macaddr_bdinfo_de00>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <1>; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { ports { port@0 { @@ -190,15 +206,6 @@ status = "okay"; label = "lan4"; }; - - port@4 { - status = "okay"; - label = "wan"; - - nvmem-cells = <&macaddr_bdinfo_de00>; - nvmem-cell-names = "mac-address"; - mac-address-increment = <1>; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_cudy_x6.dts b/target/linux/ramips/dts/mt7621_cudy_x6.dts index ebb2149172..ad51aca28f 100644 --- a/target/linux/ramips/dts/mt7621_cudy_x6.dts +++ b/target/linux/ramips/dts/mt7621_cudy_x6.dts @@ -128,6 +128,22 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; + + nvmem-cells = <&macaddr_bdinfo_de00>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <1>; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { ports { port@0 { @@ -149,14 +165,6 @@ status = "okay"; label = "lan4"; }; - - port@4 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_bdinfo_de00>; - nvmem-cell-names = "mac-address"; - mac-address-increment = <1>; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_dlink_dir-853-a3.dts b/target/linux/ramips/dts/mt7621_dlink_dir-853-a3.dts index 49d0c050f5..5408e51399 100644 --- a/target/linux/ramips/dts/mt7621_dlink_dir-853-a3.dts +++ b/target/linux/ramips/dts/mt7621_dlink_dir-853-a3.dts @@ -169,6 +169,21 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; + + nvmem-cells = <&macaddr_factory_e006>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { ports { port@0 { @@ -190,13 +205,6 @@ status = "okay"; label = "lan1"; }; - - port@4 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_factory_e006>; - nvmem-cell-names = "mac-address"; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_dlink_dir-853-r1.dts b/target/linux/ramips/dts/mt7621_dlink_dir-853-r1.dts index c0ad172939..8ec6ef3a7d 100644 --- a/target/linux/ramips/dts/mt7621_dlink_dir-853-r1.dts +++ b/target/linux/ramips/dts/mt7621_dlink_dir-853-r1.dts @@ -12,7 +12,7 @@ model = "D-Link DIR-853 R1"; aliases { - label-mac-device = &wan; + label-mac-device = &gmac1; led-boot = &led_power_orange; led-failsafe = &led_power_blue; @@ -110,6 +110,22 @@ mac-address-increment = <(-1)>; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; + + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <(-2)>; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { ports { port@0 { @@ -131,14 +147,6 @@ status = "okay"; label = "lan1"; }; - - wan: port@4 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_factory_4>; - nvmem-cell-names = "mac-address"; - mac-address-increment = <(-2)>; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_dlink_dir-860l-b1.dts b/target/linux/ramips/dts/mt7621_dlink_dir-860l-b1.dts index 7a48a931e7..fac41f206b 100644 --- a/target/linux/ramips/dts/mt7621_dlink_dir-860l-b1.dts +++ b/target/linux/ramips/dts/mt7621_dlink_dir-860l-b1.dts @@ -114,13 +114,23 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy0>; + + nvmem-cells = <&macaddr_radio_4>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy0: ethernet-phy@0 { + reg = <0>; + }; +}; + &switch0 { ports { - port@0 { - status = "okay"; - label = "wan"; - }; - port@1 { status = "okay"; label = "lan4"; diff --git a/target/linux/ramips/dts/mt7621_dlink_dir-867-a1.dts b/target/linux/ramips/dts/mt7621_dlink_dir-867-a1.dts index 0f09fae246..ae0cc8fc8a 100644 --- a/target/linux/ramips/dts/mt7621_dlink_dir-867-a1.dts +++ b/target/linux/ramips/dts/mt7621_dlink_dir-867-a1.dts @@ -17,7 +17,7 @@ nvmem-cell-names = "mac-address"; }; -&wan { +&gmac1 { nvmem-cells = <&macaddr_factory_e006>; nvmem-cell-names = "mac-address"; }; 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 9c73ffa123..31b41f8384 100644 --- a/target/linux/ramips/dts/mt7621_dlink_dir-878-a1.dts +++ b/target/linux/ramips/dts/mt7621_dlink_dir-878-a1.dts @@ -17,7 +17,7 @@ nvmem-cell-names = "mac-address"; }; -&wan { +&gmac1 { nvmem-cells = <&macaddr_factory_e006>; nvmem-cell-names = "mac-address"; }; diff --git a/target/linux/ramips/dts/mt7621_dlink_dir-878-r1.dts b/target/linux/ramips/dts/mt7621_dlink_dir-878-r1.dts index b6453bdd21..dbde89b220 100644 --- a/target/linux/ramips/dts/mt7621_dlink_dir-878-r1.dts +++ b/target/linux/ramips/dts/mt7621_dlink_dir-878-r1.dts @@ -17,7 +17,7 @@ nvmem-cell-names = "mac-address"; }; -&wan { +&gmac1 { nvmem-cells = <&macaddr_factory_e006>; nvmem-cell-names = "mac-address"; }; diff --git a/target/linux/ramips/dts/mt7621_dlink_dir-882-a1.dts b/target/linux/ramips/dts/mt7621_dlink_dir-882-a1.dts index 3db056f68f..d6206427bf 100644 --- a/target/linux/ramips/dts/mt7621_dlink_dir-882-a1.dts +++ b/target/linux/ramips/dts/mt7621_dlink_dir-882-a1.dts @@ -33,7 +33,7 @@ nvmem-cell-names = "mac-address"; }; -&wan { +&gmac1 { nvmem-cells = <&macaddr_factory_e006>; nvmem-cell-names = "mac-address"; }; diff --git a/target/linux/ramips/dts/mt7621_dlink_dir-882-r1.dts b/target/linux/ramips/dts/mt7621_dlink_dir-882-r1.dts index 6cfa28b7cf..6288d19c8a 100644 --- a/target/linux/ramips/dts/mt7621_dlink_dir-882-r1.dts +++ b/target/linux/ramips/dts/mt7621_dlink_dir-882-r1.dts @@ -33,7 +33,7 @@ nvmem-cell-names = "mac-address"; }; -&wan { +&gmac1 { nvmem-cells = <&macaddr_factory_e006>; nvmem-cell-names = "mac-address"; }; diff --git a/target/linux/ramips/dts/mt7621_dlink_dir-8xx.dtsi b/target/linux/ramips/dts/mt7621_dlink_dir-8xx.dtsi index 556ca8b003..b570d074c6 100644 --- a/target/linux/ramips/dts/mt7621_dlink_dir-8xx.dtsi +++ b/target/linux/ramips/dts/mt7621_dlink_dir-8xx.dtsi @@ -90,6 +90,18 @@ }; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { ports { port@0 { @@ -111,11 +123,6 @@ status = "okay"; label = "lan1"; }; - - wan: port@4 { - status = "okay"; - label = "wan"; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_dlink_dir-xx60-a1.dtsi b/target/linux/ramips/dts/mt7621_dlink_dir-xx60-a1.dtsi index 9dcc050af2..07f84592e4 100644 --- a/target/linux/ramips/dts/mt7621_dlink_dir-xx60-a1.dtsi +++ b/target/linux/ramips/dts/mt7621_dlink_dir-xx60-a1.dtsi @@ -154,6 +154,21 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; + + nvmem-cells = <&macaddr_factory_e006>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { ports { port@0 { @@ -175,13 +190,6 @@ status = "okay"; label = "lan1"; }; - - port@4 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_factory_e006>; - nvmem-cell-names = "mac-address"; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_edimax_rx21s.dtsi b/target/linux/ramips/dts/mt7621_edimax_rx21s.dtsi index f9a6c375c2..1301f1375c 100644 --- a/target/linux/ramips/dts/mt7621_edimax_rx21s.dtsi +++ b/target/linux/ramips/dts/mt7621_edimax_rx21s.dtsi @@ -122,13 +122,23 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy0>; + + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy0: ethernet-phy@0 { + reg = <0>; + }; +}; + &switch0 { ports { - port@0 { - status = "okay"; - label = "wan"; - }; - port@1 { status = "okay"; label = "lan4"; diff --git a/target/linux/ramips/dts/mt7621_elecom_wrc-1167ghbk2-s.dts b/target/linux/ramips/dts/mt7621_elecom_wrc-1167ghbk2-s.dts index 8e87fd06bc..2fdb62840a 100644 --- a/target/linux/ramips/dts/mt7621_elecom_wrc-1167ghbk2-s.dts +++ b/target/linux/ramips/dts/mt7621_elecom_wrc-1167ghbk2-s.dts @@ -71,15 +71,23 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy0>; + + nvmem-cells = <&macaddr_factory_e006>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy0: ethernet-phy@0 { + reg = <0>; + }; +}; + &switch0 { ports { - port@0 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_factory_e006>; - nvmem-cell-names = "mac-address"; - }; - port@1 { status = "okay"; label = "lan4"; diff --git a/target/linux/ramips/dts/mt7621_elecom_wrc-1167gs2-b.dts b/target/linux/ramips/dts/mt7621_elecom_wrc-1167gs2-b.dts index 97e0ab2956..81ace64e44 100644 --- a/target/linux/ramips/dts/mt7621_elecom_wrc-1167gs2-b.dts +++ b/target/linux/ramips/dts/mt7621_elecom_wrc-1167gs2-b.dts @@ -12,7 +12,7 @@ nvmem-cell-names = "mac-address"; }; -&wan { +&gmac1 { nvmem-cells = <&macaddr_factory_fffa>; nvmem-cell-names = "mac-address"; }; diff --git a/target/linux/ramips/dts/mt7621_elecom_wrc-1167gst2.dts b/target/linux/ramips/dts/mt7621_elecom_wrc-1167gst2.dts index dfc58c1ff6..cb2e202793 100644 --- a/target/linux/ramips/dts/mt7621_elecom_wrc-1167gst2.dts +++ b/target/linux/ramips/dts/mt7621_elecom_wrc-1167gst2.dts @@ -12,7 +12,7 @@ nvmem-cell-names = "mac-address"; }; -&wan { +&gmac1 { nvmem-cells = <&macaddr_factory_e006>; nvmem-cell-names = "mac-address"; }; diff --git a/target/linux/ramips/dts/mt7621_elecom_wrc-1750gs.dts b/target/linux/ramips/dts/mt7621_elecom_wrc-1750gs.dts index 2f82eaf12b..8450af5907 100644 --- a/target/linux/ramips/dts/mt7621_elecom_wrc-1750gs.dts +++ b/target/linux/ramips/dts/mt7621_elecom_wrc-1750gs.dts @@ -44,7 +44,7 @@ nvmem-cell-names = "mac-address"; }; -&wan { +&gmac1 { nvmem-cells = <&macaddr_factory_e006>; nvmem-cell-names = "mac-address"; }; diff --git a/target/linux/ramips/dts/mt7621_elecom_wrc-1750gst2.dts b/target/linux/ramips/dts/mt7621_elecom_wrc-1750gst2.dts index 2eda4ba23a..a57a4290af 100644 --- a/target/linux/ramips/dts/mt7621_elecom_wrc-1750gst2.dts +++ b/target/linux/ramips/dts/mt7621_elecom_wrc-1750gst2.dts @@ -44,7 +44,7 @@ nvmem-cell-names = "mac-address"; }; -&wan { +&gmac1 { nvmem-cells = <&macaddr_factory_e006>; nvmem-cell-names = "mac-address"; }; diff --git a/target/linux/ramips/dts/mt7621_elecom_wrc-1750gsv.dts b/target/linux/ramips/dts/mt7621_elecom_wrc-1750gsv.dts index 7f2f04d9ea..f01f6fc25f 100644 --- a/target/linux/ramips/dts/mt7621_elecom_wrc-1750gsv.dts +++ b/target/linux/ramips/dts/mt7621_elecom_wrc-1750gsv.dts @@ -44,7 +44,7 @@ nvmem-cell-names = "mac-address"; }; -&wan { +&gmac1 { nvmem-cells = <&macaddr_factory_e006>; nvmem-cell-names = "mac-address"; }; diff --git a/target/linux/ramips/dts/mt7621_elecom_wrc-1900gst.dts b/target/linux/ramips/dts/mt7621_elecom_wrc-1900gst.dts index df66c2772d..ec433e265d 100644 --- a/target/linux/ramips/dts/mt7621_elecom_wrc-1900gst.dts +++ b/target/linux/ramips/dts/mt7621_elecom_wrc-1900gst.dts @@ -44,7 +44,7 @@ nvmem-cell-names = "mac-address"; }; -&wan { +&gmac1 { nvmem-cells = <&macaddr_factory_e006>; nvmem-cell-names = "mac-address"; }; diff --git a/target/linux/ramips/dts/mt7621_elecom_wrc-2533ghbk-i.dts b/target/linux/ramips/dts/mt7621_elecom_wrc-2533ghbk-i.dts index a5436d55d7..8da1099dc9 100644 --- a/target/linux/ramips/dts/mt7621_elecom_wrc-2533ghbk-i.dts +++ b/target/linux/ramips/dts/mt7621_elecom_wrc-2533ghbk-i.dts @@ -136,13 +136,20 @@ }; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy0>; +}; + +&mdio { + ethphy0: ethernet-phy@0 { + reg = <0>; + }; +}; + &switch0 { ports { - port@0 { - status = "okay"; - label = "wan"; - }; - port@1 { status = "okay"; label = "lan4"; diff --git a/target/linux/ramips/dts/mt7621_elecom_wrc-2533gs2.dts b/target/linux/ramips/dts/mt7621_elecom_wrc-2533gs2.dts index 0036b52032..7e88f7be04 100644 --- a/target/linux/ramips/dts/mt7621_elecom_wrc-2533gs2.dts +++ b/target/linux/ramips/dts/mt7621_elecom_wrc-2533gs2.dts @@ -44,7 +44,7 @@ nvmem-cell-names = "mac-address"; }; -&wan { +&gmac1 { nvmem-cells = <&macaddr_factory_fffa>; nvmem-cell-names = "mac-address"; }; diff --git a/target/linux/ramips/dts/mt7621_elecom_wrc-2533gst.dts b/target/linux/ramips/dts/mt7621_elecom_wrc-2533gst.dts index acf6ddab94..1d174006bd 100644 --- a/target/linux/ramips/dts/mt7621_elecom_wrc-2533gst.dts +++ b/target/linux/ramips/dts/mt7621_elecom_wrc-2533gst.dts @@ -42,7 +42,7 @@ nvmem-cell-names = "mac-address"; }; -&wan { +&gmac1 { nvmem-cells = <&macaddr_factory_e006>; nvmem-cell-names = "mac-address"; }; diff --git a/target/linux/ramips/dts/mt7621_elecom_wrc-2533gst2.dts b/target/linux/ramips/dts/mt7621_elecom_wrc-2533gst2.dts index dbf0f4d202..b71a2b4390 100644 --- a/target/linux/ramips/dts/mt7621_elecom_wrc-2533gst2.dts +++ b/target/linux/ramips/dts/mt7621_elecom_wrc-2533gst2.dts @@ -44,7 +44,7 @@ nvmem-cell-names = "mac-address"; }; -&wan { +&gmac1 { nvmem-cells = <&macaddr_factory_e006>; nvmem-cell-names = "mac-address"; }; diff --git a/target/linux/ramips/dts/mt7621_elecom_wrc-gs.dtsi b/target/linux/ramips/dts/mt7621_elecom_wrc-gs.dtsi index 9cf2b666b4..acd3004eb7 100644 --- a/target/linux/ramips/dts/mt7621_elecom_wrc-gs.dtsi +++ b/target/linux/ramips/dts/mt7621_elecom_wrc-gs.dtsi @@ -11,7 +11,7 @@ led-failsafe = &led_power_green; led-running = &led_power_green; led-upgrade = &led_power_green; - label-mac-device = &wan; + label-mac-device = &gmac1; }; leds: leds { @@ -83,13 +83,20 @@ }; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy0>; +}; + +&mdio { + ethphy0: ethernet-phy@0 { + reg = <0>; + }; +}; + &switch0 { ports { - wan: port@0 { - status = "okay"; - label = "wan"; - }; - port@1 { status = "okay"; label = "lan4"; diff --git a/target/linux/ramips/dts/mt7621_gehua_ghl-r-001.dts b/target/linux/ramips/dts/mt7621_gehua_ghl-r-001.dts index 4f652b90bb..cb9f9bdad1 100644 --- a/target/linux/ramips/dts/mt7621_gehua_ghl-r-001.dts +++ b/target/linux/ramips/dts/mt7621_gehua_ghl-r-001.dts @@ -111,6 +111,22 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; + + nvmem-cells = <&macaddr_factory_e000>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <1>; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { ports { port@0 { @@ -127,14 +143,6 @@ status = "okay"; label = "lan3"; }; - - port@4 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_factory_e000>; - nvmem-cell-names = "mac-address"; - mac-address-increment = <1>; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_glinet_gl-mt1300.dts b/target/linux/ramips/dts/mt7621_glinet_gl-mt1300.dts index 384da1bfa9..a332a87a57 100644 --- a/target/linux/ramips/dts/mt7621_glinet_gl-mt1300.dts +++ b/target/linux/ramips/dts/mt7621_glinet_gl-mt1300.dts @@ -14,7 +14,7 @@ led-failsafe = &led_run; led-running = &led_run; led-upgrade = &led_run; - label-mac-device = &wan; + label-mac-device = &gmac1; }; chosen { @@ -121,6 +121,21 @@ mac-address-increment = <1>; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; + + nvmem-cells = <&macaddr_factory_4000>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { ports { port@2 { @@ -132,13 +147,6 @@ status = "okay"; label = "lan2"; }; - - wan: port@4 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_factory_4000>; - nvmem-cell-names = "mac-address"; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_gnubee_gb-pc1.dts b/target/linux/ramips/dts/mt7621_gnubee_gb-pc1.dts index 21a1839127..29f9f09ee5 100644 --- a/target/linux/ramips/dts/mt7621_gnubee_gb-pc1.dts +++ b/target/linux/ramips/dts/mt7621_gnubee_gb-pc1.dts @@ -105,17 +105,27 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "ethblue"; + phy-handle = <ðphy4>; + + nvmem-cells = <&macaddr_factory_e000>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { ports { port@0 { status = "okay"; label = "ethblack"; }; - - port@4 { - status = "okay"; - label = "ethblue"; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_hilink_hlk-7621a-evb.dts b/target/linux/ramips/dts/mt7621_hilink_hlk-7621a-evb.dts index 9776f43e02..3fb267d782 100644 --- a/target/linux/ramips/dts/mt7621_hilink_hlk-7621a-evb.dts +++ b/target/linux/ramips/dts/mt7621_hilink_hlk-7621a-evb.dts @@ -61,6 +61,18 @@ }; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { ports { port@0 { @@ -82,11 +94,6 @@ status = "okay"; label = "lan4"; }; - - port@4 { - status = "okay"; - label = "wan"; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_hiwifi_hc5962.dts b/target/linux/ramips/dts/mt7621_hiwifi_hc5962.dts index 774fb93d9c..d9ca1012ce 100644 --- a/target/linux/ramips/dts/mt7621_hiwifi_hc5962.dts +++ b/target/linux/ramips/dts/mt7621_hiwifi_hc5962.dts @@ -129,6 +129,18 @@ }; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { ports { port@1 { @@ -145,11 +157,6 @@ status = "okay"; label = "lan3"; }; - - port@4 { - status = "okay"; - label = "wan"; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_humax_e10.dts b/target/linux/ramips/dts/mt7621_humax_e10.dts index 41587629c0..638d73c3ef 100644 --- a/target/linux/ramips/dts/mt7621_humax_e10.dts +++ b/target/linux/ramips/dts/mt7621_humax_e10.dts @@ -15,7 +15,7 @@ led-failsafe = &led_power; led-running = &led_power; led-upgrade = &led_power; - label-mac-device = &wan; + label-mac-device = &gmac1; }; gpio-export { @@ -132,15 +132,23 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy0>; + + nvmem-cells = <&macaddr_factory_1000d>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy0: ethernet-phy@0 { + reg = <0>; + }; +}; + &switch0 { ports { - wan: port@0 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_factory_1000d>; - nvmem-cell-names = "mac-address"; - }; - port@1 { status = "okay"; label = "lan"; diff --git a/target/linux/ramips/dts/mt7621_iodata_wn-ax1167gr.dts b/target/linux/ramips/dts/mt7621_iodata_wn-ax1167gr.dts index cc6446b75c..69c79d7dc7 100644 --- a/target/linux/ramips/dts/mt7621_iodata_wn-ax1167gr.dts +++ b/target/linux/ramips/dts/mt7621_iodata_wn-ax1167gr.dts @@ -132,16 +132,24 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy0>; + + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <1>; +}; + +&mdio { + ethphy0: ethernet-phy@0 { + reg = <0>; + }; +}; + &switch0 { ports { - port@0 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_factory_4>; - nvmem-cell-names = "mac-address"; - mac-address-increment = <1>; - }; - port@1 { status = "okay"; label = "lan4"; diff --git a/target/linux/ramips/dts/mt7621_iodata_wn-dx1200gr.dts b/target/linux/ramips/dts/mt7621_iodata_wn-dx1200gr.dts index b63b4783b8..4837f29a46 100644 --- a/target/linux/ramips/dts/mt7621_iodata_wn-dx1200gr.dts +++ b/target/linux/ramips/dts/mt7621_iodata_wn-dx1200gr.dts @@ -14,7 +14,7 @@ led-failsafe = &led_power; led-running = &led_power; led-upgrade = &led_power; - label-mac-device = &wan; + label-mac-device = &gmac1; }; leds { @@ -131,15 +131,23 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy0>; + + nvmem-cells = <&macaddr_factory_1e006>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy0: ethernet-phy@0 { + reg = <0>; + }; +}; + &switch0 { ports { - wan: port@0 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_factory_1e006>; - nvmem-cell-names = "mac-address"; - }; - port@1 { status = "okay"; label = "lan4"; diff --git a/target/linux/ramips/dts/mt7621_iodata_wn-gx300gr.dts b/target/linux/ramips/dts/mt7621_iodata_wn-gx300gr.dts index 398a84117c..8a09675bff 100644 --- a/target/linux/ramips/dts/mt7621_iodata_wn-gx300gr.dts +++ b/target/linux/ramips/dts/mt7621_iodata_wn-gx300gr.dts @@ -132,16 +132,24 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy0>; + + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <1>; +}; + +&mdio { + ethphy0: ethernet-phy@0 { + reg = <0>; + }; +}; + &switch0 { ports { - port@0 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_factory_4>; - nvmem-cell-names = "mac-address"; - mac-address-increment = <1>; - }; - port@1 { status = "okay"; label = "lan4"; diff --git a/target/linux/ramips/dts/mt7621_iodata_wn-xx-xr.dtsi b/target/linux/ramips/dts/mt7621_iodata_wn-xx-xr.dtsi index 1dd3d77878..89e7f4b3e9 100644 --- a/target/linux/ramips/dts/mt7621_iodata_wn-xx-xr.dtsi +++ b/target/linux/ramips/dts/mt7621_iodata_wn-xx-xr.dtsi @@ -11,7 +11,7 @@ led-failsafe = &led_power; led-running = &led_power; led-upgrade = &led_power; - label-mac-device = &wan; + label-mac-device = &gmac1; }; leds { @@ -122,15 +122,23 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy0>; + + nvmem-cells = <&macaddr_factory_e006>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy0: ethernet-phy@0 { + reg = <0>; + }; +}; + &switch0 { ports { - wan: port@0 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_factory_e006>; - nvmem-cell-names = "mac-address"; - }; - port@1 { status = "okay"; label = "lan4"; diff --git a/target/linux/ramips/dts/mt7621_iodata_wnpr2600g.dts b/target/linux/ramips/dts/mt7621_iodata_wnpr2600g.dts index 6af6bdce7a..871327f8a7 100644 --- a/target/linux/ramips/dts/mt7621_iodata_wnpr2600g.dts +++ b/target/linux/ramips/dts/mt7621_iodata_wnpr2600g.dts @@ -124,13 +124,23 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy0>; + + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy0: ethernet-phy@0 { + reg = <0>; + }; +}; + &switch0 { ports { - port@0 { - status = "okay"; - label = "wan"; - }; - port@1 { status = "okay"; label = "lan4"; diff --git a/target/linux/ramips/dts/mt7621_iptime_a3002mesh.dts b/target/linux/ramips/dts/mt7621_iptime_a3002mesh.dts index dc63adedf0..678ce06806 100644 --- a/target/linux/ramips/dts/mt7621_iptime_a3002mesh.dts +++ b/target/linux/ramips/dts/mt7621_iptime_a3002mesh.dts @@ -109,15 +109,23 @@ mac-address-increment = <(2)>; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy0>; + + nvmem-cells = <&macaddr_uboot_1fc40>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy0: ethernet-phy@0 { + reg = <0>; + }; +}; + &switch0 { ports { - port@0 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_uboot_1fc40>; - nvmem-cell-names = "mac-address"; - }; - port@3 { status = "okay"; label = "lan1"; diff --git a/target/linux/ramips/dts/mt7621_iptime_a3004ns-dual.dts b/target/linux/ramips/dts/mt7621_iptime_a3004ns-dual.dts index fa3f146e81..c08b6427e7 100644 --- a/target/linux/ramips/dts/mt7621_iptime_a3004ns-dual.dts +++ b/target/linux/ramips/dts/mt7621_iptime_a3004ns-dual.dts @@ -94,15 +94,23 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy0>; + + nvmem-cells = <&macaddr_uboot_1fc40>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy0: ethernet-phy@0 { + reg = <0>; + }; +}; + &switch0 { ports { - port@0 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_uboot_1fc40>; - nvmem-cell-names = "mac-address"; - }; - port@1 { status = "okay"; label = "lan1"; diff --git a/target/linux/ramips/dts/mt7621_iptime_a3004t.dts b/target/linux/ramips/dts/mt7621_iptime_a3004t.dts index 704ecac721..97b6b1c3ee 100644 --- a/target/linux/ramips/dts/mt7621_iptime_a3004t.dts +++ b/target/linux/ramips/dts/mt7621_iptime_a3004t.dts @@ -120,16 +120,24 @@ mac-address-increment = <(3)>; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy0>; + + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <(1)>; +}; + +&mdio { + ethphy0: ethernet-phy@0 { + reg = <0>; + }; +}; + &switch0 { ports { - port@0 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_factory_4>; - nvmem-cell-names = "mac-address"; - mac-address-increment = <(1)>; - }; - port@1 { status = "okay"; label = "lan4"; diff --git a/target/linux/ramips/dts/mt7621_iptime_a6004ns-m.dtsi b/target/linux/ramips/dts/mt7621_iptime_a6004ns-m.dtsi index a033d7f665..b00fbeb47f 100644 --- a/target/linux/ramips/dts/mt7621_iptime_a6004ns-m.dtsi +++ b/target/linux/ramips/dts/mt7621_iptime_a6004ns-m.dtsi @@ -112,15 +112,23 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy0>; + + nvmem-cells = <&macaddr_uboot_1fc40>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy0: ethernet-phy@0 { + reg = <0>; + }; +}; + &switch0 { ports { - port@0 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_uboot_1fc40>; - nvmem-cell-names = "mac-address"; - }; - port@1 { status = "okay"; label = "lan1"; diff --git a/target/linux/ramips/dts/mt7621_iptime_a8004t.dts b/target/linux/ramips/dts/mt7621_iptime_a8004t.dts index a00e921a49..0f5870140f 100644 --- a/target/linux/ramips/dts/mt7621_iptime_a8004t.dts +++ b/target/linux/ramips/dts/mt7621_iptime_a8004t.dts @@ -99,15 +99,23 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy0>; + + nvmem-cells = <&macaddr_uboot_1fc40>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy0: ethernet-phy@0 { + reg = <0>; + }; +}; + &switch0 { ports { - port@0 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_uboot_1fc40>; - nvmem-cell-names = "mac-address"; - }; - port@1 { status = "okay"; label = "lan4"; diff --git a/target/linux/ramips/dts/mt7621_iptime_ax2004m.dts b/target/linux/ramips/dts/mt7621_iptime_ax2004m.dts index 6da223689c..554d73ce3d 100644 --- a/target/linux/ramips/dts/mt7621_iptime_ax2004m.dts +++ b/target/linux/ramips/dts/mt7621_iptime_ax2004m.dts @@ -120,16 +120,24 @@ mac-address-increment = <3>; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy0>; + + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <1>; +}; + +&mdio { + ethphy0: ethernet-phy@0 { + reg = <0>; + }; +}; + &switch0 { ports { - port@0 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_factory_4>; - nvmem-cell-names = "mac-address"; - mac-address-increment = <1>; - }; - port@1 { status = "okay"; label = "lan4"; diff --git a/target/linux/ramips/dts/mt7621_iptime_t5004.dts b/target/linux/ramips/dts/mt7621_iptime_t5004.dts index c6c919cfb1..ee82ffbd85 100644 --- a/target/linux/ramips/dts/mt7621_iptime_t5004.dts +++ b/target/linux/ramips/dts/mt7621_iptime_t5004.dts @@ -87,13 +87,20 @@ }; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy0>; +}; + +&mdio { + ethphy0: ethernet-phy@0 { + reg = <0>; + }; +}; + &switch0 { ports { - port@0 { - status = "okay"; - label = "wan"; - }; - port@1 { status = "okay"; label = "lan4"; diff --git a/target/linux/ramips/dts/mt7621_jcg_jhr-ac876m.dts b/target/linux/ramips/dts/mt7621_jcg_jhr-ac876m.dts index da832d6df5..5d346be1d2 100644 --- a/target/linux/ramips/dts/mt7621_jcg_jhr-ac876m.dts +++ b/target/linux/ramips/dts/mt7621_jcg_jhr-ac876m.dts @@ -14,7 +14,7 @@ led-failsafe = &led_wps; led-running = &led_wps; led-upgrade = &led_wps; - label-mac-device = &wan; + label-mac-device = &gmac1; }; leds { @@ -133,6 +133,21 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; + + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { ports { port@0 { @@ -154,12 +169,6 @@ status = "okay"; label = "lan4"; }; - wan: port@4 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_factory_4>; - nvmem-cell-names = "mac-address"; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_jcg_q20.dts b/target/linux/ramips/dts/mt7621_jcg_q20.dts index c9bf648a31..0425c53438 100644 --- a/target/linux/ramips/dts/mt7621_jcg_q20.dts +++ b/target/linux/ramips/dts/mt7621_jcg_q20.dts @@ -148,15 +148,23 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy0>; + + nvmem-cells = <&macaddr_factory_3fffa>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy0: ethernet-phy@0 { + reg = <0>; + }; +}; + &switch0 { ports { - port@0 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_factory_3fffa>; - nvmem-cell-names = "mac-address"; - }; - port@1 { status = "okay"; label = "lan1"; diff --git a/target/linux/ramips/dts/mt7621_jcg_y2.dts b/target/linux/ramips/dts/mt7621_jcg_y2.dts index 5de6ba6d95..f8ae9b41df 100644 --- a/target/linux/ramips/dts/mt7621_jcg_y2.dts +++ b/target/linux/ramips/dts/mt7621_jcg_y2.dts @@ -93,6 +93,21 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; + + nvmem-cells = <&macaddr_factory_e006>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { ports { port@0 { @@ -114,13 +129,6 @@ status = "okay"; label = "lan1"; }; - - wan: port@4 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_factory_e006>; - nvmem-cell-names = "mac-address"; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_lenovo_newifi-d1.dts b/target/linux/ramips/dts/mt7621_lenovo_newifi-d1.dts index e8069ec394..a6e38234da 100644 --- a/target/linux/ramips/dts/mt7621_lenovo_newifi-d1.dts +++ b/target/linux/ramips/dts/mt7621_lenovo_newifi-d1.dts @@ -142,6 +142,21 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; + + nvmem-cells = <&macaddr_factory_e006>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { ports { port@1 { @@ -153,13 +168,6 @@ status = "okay"; label = "lan1"; }; - - port@4 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_factory_e006>; - nvmem-cell-names = "mac-address"; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_linksys_e5600.dts b/target/linux/ramips/dts/mt7621_linksys_e5600.dts index 91db315914..3b23a25f8b 100644 --- a/target/linux/ramips/dts/mt7621_linksys_e5600.dts +++ b/target/linux/ramips/dts/mt7621_linksys_e5600.dts @@ -148,6 +148,18 @@ }; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { ports { port@0 { @@ -169,11 +181,6 @@ status = "okay"; label = "lan4"; }; - - port@4 { - status = "okay"; - label = "wan"; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_linksys_ea6350-v4.dts b/target/linux/ramips/dts/mt7621_linksys_ea6350-v4.dts index 272b01af1e..654c9aa70f 100644 --- a/target/linux/ramips/dts/mt7621_linksys_ea6350-v4.dts +++ b/target/linux/ramips/dts/mt7621_linksys_ea6350-v4.dts @@ -7,6 +7,20 @@ model = "Linksys EA6350 v4"; }; +&gmac1 { + phy-handle = <ðphy4>; +}; + +&mdio { + ethernet-phy@0 { + status = "disabled"; + }; + + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { ports { port@0 { @@ -30,8 +44,7 @@ }; port@4 { - status = "okay"; - label = "wan"; + status = "disabled"; }; }; }; diff --git a/target/linux/ramips/dts/mt7621_linksys_ea7xxx.dtsi b/target/linux/ramips/dts/mt7621_linksys_ea7xxx.dtsi index 5e9c82507d..4663d873fe 100644 --- a/target/linux/ramips/dts/mt7621_linksys_ea7xxx.dtsi +++ b/target/linux/ramips/dts/mt7621_linksys_ea7xxx.dtsi @@ -177,13 +177,20 @@ }; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy0>; +}; + +&mdio { + ethphy0: ethernet-phy@0 { + reg = <0>; + }; +}; + &switch0 { ports { - port@0 { - status = "okay"; - label = "wan"; - }; - port@1 { status = "okay"; label = "lan1"; diff --git a/target/linux/ramips/dts/mt7621_linksys_re6500.dts b/target/linux/ramips/dts/mt7621_linksys_re6500.dts index 680bc863cd..0d0c5c3be5 100644 --- a/target/linux/ramips/dts/mt7621_linksys_re6500.dts +++ b/target/linux/ramips/dts/mt7621_linksys_re6500.dts @@ -117,13 +117,23 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "lan1"; + phy-handle = <ðphy0>; + + nvmem-cells = <&macaddr_factory_2e>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy0: ethernet-phy@0 { + reg = <0>; + }; +}; + &switch0 { ports { - port@0 { - status = "okay"; - label = "lan1"; - }; - port@1 { status = "okay"; label = "lan2"; diff --git a/target/linux/ramips/dts/mt7621_mediatek_ap-mt7621a-v60.dts b/target/linux/ramips/dts/mt7621_mediatek_ap-mt7621a-v60.dts index a89d9189c0..557abcc21a 100644 --- a/target/linux/ramips/dts/mt7621_mediatek_ap-mt7621a-v60.dts +++ b/target/linux/ramips/dts/mt7621_mediatek_ap-mt7621a-v60.dts @@ -117,6 +117,22 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; + + nvmem-cells = <&macaddr_factory_5>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <1>; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { ports { port@0 { @@ -138,14 +154,6 @@ status = "okay"; label = "lan4"; }; - - port@4 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_factory_5>; - nvmem-cell-names = "mac-address"; - mac-address-increment = <1>; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_mediatek_mt7621-eval-board.dts b/target/linux/ramips/dts/mt7621_mediatek_mt7621-eval-board.dts index dcdcc261b3..2da7f983a9 100644 --- a/target/linux/ramips/dts/mt7621_mediatek_mt7621-eval-board.dts +++ b/target/linux/ramips/dts/mt7621_mediatek_mt7621-eval-board.dts @@ -39,6 +39,18 @@ status = "okay"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { ports { port@0 { @@ -60,11 +72,6 @@ status = "okay"; label = "lan4"; }; - - port@4 { - status = "okay"; - label = "wan"; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_mikrotik_routerboard-750gr3.dts b/target/linux/ramips/dts/mt7621_mikrotik_routerboard-750gr3.dts index 7f329b2359..aad8a6776d 100644 --- a/target/linux/ramips/dts/mt7621_mikrotik_routerboard-750gr3.dts +++ b/target/linux/ramips/dts/mt7621_mikrotik_routerboard-750gr3.dts @@ -35,3 +35,23 @@ function = "gpio"; }; }; + +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy0>; +}; + +&mdio { + ethphy0: ethernet-phy@0 { + reg = <0>; + }; +}; + +&switch0 { + ports { + port@0 { + status = "disabled"; + }; + }; +}; diff --git a/target/linux/ramips/dts/mt7621_mikrotik_routerboard-m33g.dts b/target/linux/ramips/dts/mt7621_mikrotik_routerboard-m33g.dts index d457c43426..223d03b9fd 100644 --- a/target/linux/ramips/dts/mt7621_mikrotik_routerboard-m33g.dts +++ b/target/linux/ramips/dts/mt7621_mikrotik_routerboard-m33g.dts @@ -90,13 +90,20 @@ }; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy0>; +}; + +&mdio { + ethphy0: ethernet-phy@0 { + reg = <0>; + }; +}; + &switch0 { ports { - port@0 { - status = "okay"; - label = "wan"; - }; - port@1 { status = "okay"; label = "lan1"; diff --git a/target/linux/ramips/dts/mt7621_mqmaker_witi.dts b/target/linux/ramips/dts/mt7621_mqmaker_witi.dts index cb6310df18..16cebbad74 100644 --- a/target/linux/ramips/dts/mt7621_mqmaker_witi.dts +++ b/target/linux/ramips/dts/mt7621_mqmaker_witi.dts @@ -100,6 +100,22 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; + + nvmem-cells = <&macaddr_factory_e000>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <1>; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { ports { port@0 { @@ -121,14 +137,6 @@ status = "okay"; label = "lan4"; }; - - port@4 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_factory_e000>; - nvmem-cell-names = "mac-address"; - mac-address-increment = <1>; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_netgear_r6220.dts b/target/linux/ramips/dts/mt7621_netgear_r6220.dts index 54489243b8..0f476ef060 100644 --- a/target/linux/ramips/dts/mt7621_netgear_r6220.dts +++ b/target/linux/ramips/dts/mt7621_netgear_r6220.dts @@ -60,7 +60,7 @@ nvmem-cell-names = "mac-address"; }; -&wan { +&gmac1 { nvmem-cells = <&macaddr_factory_4>; nvmem-cell-names = "mac-address"; mac-address-increment = <1>; diff --git a/target/linux/ramips/dts/mt7621_netgear_sercomm_ayx.dtsi b/target/linux/ramips/dts/mt7621_netgear_sercomm_ayx.dtsi index ae9e40e621..0ae6ab46f7 100644 --- a/target/linux/ramips/dts/mt7621_netgear_sercomm_ayx.dtsi +++ b/target/linux/ramips/dts/mt7621_netgear_sercomm_ayx.dtsi @@ -105,6 +105,18 @@ }; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { ports { port@0 { @@ -126,11 +138,6 @@ status = "okay"; label = "lan1"; }; - - wan: port@4 { - status = "okay"; - label = "wan"; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_netgear_sercomm_bzv.dtsi b/target/linux/ramips/dts/mt7621_netgear_sercomm_bzv.dtsi index 2be3f87869..9fa4af8fd6 100644 --- a/target/linux/ramips/dts/mt7621_netgear_sercomm_bzv.dtsi +++ b/target/linux/ramips/dts/mt7621_netgear_sercomm_bzv.dtsi @@ -166,6 +166,22 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; + + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <2>; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { ports { port@0 { @@ -187,14 +203,6 @@ status = "okay"; label = "lan1"; }; - - port@4 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_factory_4>; - nvmem-cell-names = "mac-address"; - mac-address-increment = <2>; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_netgear_sercomm_chj.dtsi b/target/linux/ramips/dts/mt7621_netgear_sercomm_chj.dtsi index c2dc987871..eaf12a891e 100644 --- a/target/linux/ramips/dts/mt7621_netgear_sercomm_chj.dtsi +++ b/target/linux/ramips/dts/mt7621_netgear_sercomm_chj.dtsi @@ -100,6 +100,22 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; + + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <2>; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { ports { port@0 { @@ -121,14 +137,6 @@ status = "okay"; label = "lan1"; }; - - port@4 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_factory_4>; - nvmem-cell-names = "mac-address"; - mac-address-increment = <2>; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_netgear_wac104.dts b/target/linux/ramips/dts/mt7621_netgear_wac104.dts index 61ab0574a7..3b5d6ae2d9 100644 --- a/target/linux/ramips/dts/mt7621_netgear_wac104.dts +++ b/target/linux/ramips/dts/mt7621_netgear_wac104.dts @@ -138,13 +138,23 @@ }; }; +&gmac1 { + status = "okay"; + label = "lan4"; + phy-handle = <ðphy0>; + + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy0: ethernet-phy@0 { + reg = <0>; + }; +}; + &switch0 { ports { - port@0 { - status = "okay"; - label = "lan4"; - }; - port@1 { status = "okay"; label = "lan3"; diff --git a/target/linux/ramips/dts/mt7621_netgear_wax202.dts b/target/linux/ramips/dts/mt7621_netgear_wax202.dts index fef8094256..f17a805363 100644 --- a/target/linux/ramips/dts/mt7621_netgear_wax202.dts +++ b/target/linux/ramips/dts/mt7621_netgear_wax202.dts @@ -243,16 +243,23 @@ }; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy0>; +}; + +&mdio { + ethphy0: ethernet-phy@0 { + reg = <0>; + }; +}; + &switch0 { gpio-controller; #gpio-cells = <2>; ports { - port@0 { - status = "okay"; - label = "wan"; - }; - port@1 { status = "okay"; label = "lan1"; diff --git a/target/linux/ramips/dts/mt7621_netgear_wndr3700-v5.dts b/target/linux/ramips/dts/mt7621_netgear_wndr3700-v5.dts index 972aba1c5e..276e7c959f 100644 --- a/target/linux/ramips/dts/mt7621_netgear_wndr3700-v5.dts +++ b/target/linux/ramips/dts/mt7621_netgear_wndr3700-v5.dts @@ -56,7 +56,7 @@ nvmem-cell-names = "mac-address"; }; -&wan { +&gmac1 { nvmem-cells = <&macaddr_factory_4>; nvmem-cell-names = "mac-address"; mac-address-increment = <1>; diff --git a/target/linux/ramips/dts/mt7621_netis_wf2881.dts b/target/linux/ramips/dts/mt7621_netis_wf2881.dts index 56a2647638..af09073e3d 100644 --- a/target/linux/ramips/dts/mt7621_netis_wf2881.dts +++ b/target/linux/ramips/dts/mt7621_netis_wf2881.dts @@ -126,6 +126,21 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; + + nvmem-cells = <&macaddr_factory_e006>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { ports { port@0 { @@ -147,13 +162,6 @@ status = "okay"; label = "lan1"; }; - - port@4 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_factory_e006>; - nvmem-cell-names = "mac-address"; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_oraybox_x3a.dts b/target/linux/ramips/dts/mt7621_oraybox_x3a.dts index a97b0900aa..fd7a8e6eca 100644 --- a/target/linux/ramips/dts/mt7621_oraybox_x3a.dts +++ b/target/linux/ramips/dts/mt7621_oraybox_x3a.dts @@ -128,6 +128,22 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; + + nvmem-cells = <&macaddr_bdinfo_9>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <1>; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { ports { port@2 { @@ -139,14 +155,6 @@ status = "okay"; label = "lan1"; }; - - port@4 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_bdinfo_9>; - nvmem-cell-names = "mac-address"; - mac-address-increment = <1>; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_phicomm_k2p.dts b/target/linux/ramips/dts/mt7621_phicomm_k2p.dts index 078b76a50b..b18d12608a 100644 --- a/target/linux/ramips/dts/mt7621_phicomm_k2p.dts +++ b/target/linux/ramips/dts/mt7621_phicomm_k2p.dts @@ -112,6 +112,21 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; + + nvmem-cells = <&macaddr_factory_e006>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { ports { port@0 { @@ -133,13 +148,6 @@ status = "okay"; label = "lan4"; }; - - port@4 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_factory_e006>; - nvmem-cell-names = "mac-address"; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_planex_vr500.dts b/target/linux/ramips/dts/mt7621_planex_vr500.dts index fb6a42166f..1da6d2cca1 100644 --- a/target/linux/ramips/dts/mt7621_planex_vr500.dts +++ b/target/linux/ramips/dts/mt7621_planex_vr500.dts @@ -79,6 +79,21 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; + + nvmem-cells = <&macaddr_factory_e006>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { ports { port@0 { @@ -100,13 +115,6 @@ status = "okay"; label = "lan4"; }; - - port@4 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_factory_e006>; - nvmem-cell-names = "mac-address"; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_raisecom_msg1500-x-00.dts b/target/linux/ramips/dts/mt7621_raisecom_msg1500-x-00.dts index 13d39195a9..3c5f1e520c 100644 --- a/target/linux/ramips/dts/mt7621_raisecom_msg1500-x-00.dts +++ b/target/linux/ramips/dts/mt7621_raisecom_msg1500-x-00.dts @@ -115,6 +115,18 @@ }; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { ports { port@0 { @@ -136,11 +148,6 @@ status = "okay"; label = "lan1"; }; - - port@4 { - status = "okay"; - label = "wan"; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_renkforce_ws-wn530hp3-a.dts b/target/linux/ramips/dts/mt7621_renkforce_ws-wn530hp3-a.dts index 13e37d7124..c56c2f1554 100644 --- a/target/linux/ramips/dts/mt7621_renkforce_ws-wn530hp3-a.dts +++ b/target/linux/ramips/dts/mt7621_renkforce_ws-wn530hp3-a.dts @@ -115,6 +115,22 @@ mac-address-increment = <(-2)>; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; + + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <(-1)>; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { ports { port@0 { @@ -126,14 +142,6 @@ status = "okay"; label = "lan1"; }; - - port@4 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_factory_4>; - nvmem-cell-names = "mac-address"; - mac-address-increment = <(-1)>; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_samknows_whitebox-v8.dts b/target/linux/ramips/dts/mt7621_samknows_whitebox-v8.dts index 929c2a8f26..d1f51feddd 100644 --- a/target/linux/ramips/dts/mt7621_samknows_whitebox-v8.dts +++ b/target/linux/ramips/dts/mt7621_samknows_whitebox-v8.dts @@ -110,6 +110,21 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; + + nvmem-cells = <&macaddr_factory_e006>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { ports { port@0 { @@ -131,13 +146,6 @@ status = "okay"; label = "lan4"; }; - - port@4 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_factory_e006>; - nvmem-cell-names = "mac-address"; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_storylink_sap-g3200u3.dts b/target/linux/ramips/dts/mt7621_storylink_sap-g3200u3.dts index 19eb11111d..833e1b07d0 100644 --- a/target/linux/ramips/dts/mt7621_storylink_sap-g3200u3.dts +++ b/target/linux/ramips/dts/mt7621_storylink_sap-g3200u3.dts @@ -106,6 +106,22 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; + + nvmem-cells = <&macaddr_factory_e006>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <1>; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { ports { port@0 { @@ -127,14 +143,6 @@ status = "okay"; label = "lan4"; }; - - port@4 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_factory_e006>; - nvmem-cell-names = "mac-address"; - mac-address-increment = <1>; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_tenbay_t-mb5eu-v01.dts b/target/linux/ramips/dts/mt7621_tenbay_t-mb5eu-v01.dts index d658c454a8..2d91d1c481 100644 --- a/target/linux/ramips/dts/mt7621_tenbay_t-mb5eu-v01.dts +++ b/target/linux/ramips/dts/mt7621_tenbay_t-mb5eu-v01.dts @@ -14,7 +14,7 @@ led-failsafe = &led_red; led-running = &led_blue; led-upgrade = &led_red; - label-mac-device = &wan_port; + label-mac-device = &gmac1; }; chosen { @@ -115,16 +115,24 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy0>; + + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <(-2)>; +}; + +&mdio { + ethphy0: ethernet-phy@0 { + reg = <0>; + }; +}; + &switch0 { ports { - wan_port: port@0 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_factory_4>; - nvmem-cell-names = "mac-address"; - mac-address-increment = <(-2)>; - }; - port@1 { status = "okay"; label = "lan1"; diff --git a/target/linux/ramips/dts/mt7621_totolink_a7000r.dts b/target/linux/ramips/dts/mt7621_totolink_a7000r.dts index e817278728..bba0d4a5d3 100644 --- a/target/linux/ramips/dts/mt7621_totolink_a7000r.dts +++ b/target/linux/ramips/dts/mt7621_totolink_a7000r.dts @@ -104,6 +104,22 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; + + nvmem-cells = <&macaddr_factory_e000>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <1>; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { ports { port@0 { @@ -125,14 +141,6 @@ status = "okay"; label = "lan4"; }; - - port@4 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_factory_e000>; - nvmem-cell-names = "mac-address"; - mac-address-increment = <1>; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_totolink_x5000r.dts b/target/linux/ramips/dts/mt7621_totolink_x5000r.dts index 8066340c5d..bc03ed8690 100644 --- a/target/linux/ramips/dts/mt7621_totolink_x5000r.dts +++ b/target/linux/ramips/dts/mt7621_totolink_x5000r.dts @@ -101,6 +101,21 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; + + nvmem-cells = <&macaddr_factory_e006>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { ports { port@0 { @@ -122,13 +137,6 @@ status = "okay"; label = "lan4"; }; - - port@4 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_factory_e006>; - nvmem-cell-names = "mac-address"; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_tplink_archer-c6u-v1.dts b/target/linux/ramips/dts/mt7621_tplink_archer-c6u-v1.dts index 67668657bd..c626df1ef4 100644 --- a/target/linux/ramips/dts/mt7621_tplink_archer-c6u-v1.dts +++ b/target/linux/ramips/dts/mt7621_tplink_archer-c6u-v1.dts @@ -168,16 +168,24 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy0>; + + nvmem-cells = <&macaddr_config_8>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <1>; +}; + +&mdio { + ethphy0: ethernet-phy@0 { + reg = <0>; + }; +}; + &switch0 { ports { - port@0 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_config_8>; - nvmem-cell-names = "mac-address"; - mac-address-increment = <1>; - }; - port@1 { status = "okay"; label = "lan1"; diff --git a/target/linux/ramips/dts/mt7621_tplink_eap235-wall-v1.dts b/target/linux/ramips/dts/mt7621_tplink_eap235-wall-v1.dts index b40448791a..cd7cae6355 100644 --- a/target/linux/ramips/dts/mt7621_tplink_eap235-wall-v1.dts +++ b/target/linux/ramips/dts/mt7621_tplink_eap235-wall-v1.dts @@ -158,13 +158,23 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "lan0"; + phy-handle = <ðphy0>; + + nvmem-cells = <&macaddr_info_8>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy0: ethernet-phy@0 { + reg = <0>; + }; +}; + &switch0 { ports { - port@0 { - status = "okay"; - label = "lan0"; - }; - port@1 { status = "okay"; label = "lan3"; diff --git a/target/linux/ramips/dts/mt7621_tplink_eap615-wall-v1.dts b/target/linux/ramips/dts/mt7621_tplink_eap615-wall-v1.dts index 0be4af39e8..4fa799789c 100644 --- a/target/linux/ramips/dts/mt7621_tplink_eap615-wall-v1.dts +++ b/target/linux/ramips/dts/mt7621_tplink_eap615-wall-v1.dts @@ -156,14 +156,24 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "lan0"; + phy-handle = <ðphy0>; + + nvmem-cells = <&macaddr_info_8>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy0: ethernet-phy@0 { + reg = <0>; + }; +}; + &switch0 { compatible = "mediatek,mt7530"; ports { - port@0 { - status = "okay"; - label = "lan0"; - }; - port@1 { status = "okay"; label = "lan3"; diff --git a/target/linux/ramips/dts/mt7621_ubnt_edgerouter-x.dts b/target/linux/ramips/dts/mt7621_ubnt_edgerouter-x.dts index bca7c61690..2b5993db44 100644 --- a/target/linux/ramips/dts/mt7621_ubnt_edgerouter-x.dts +++ b/target/linux/ramips/dts/mt7621_ubnt_edgerouter-x.dts @@ -4,3 +4,26 @@ model = "Ubiquiti EdgeRouter X"; compatible = "ubnt,edgerouter-x", "mediatek,mt7621-soc"; }; + +&gmac1 { + status = "okay"; + label = "eth0"; + phy-handle = <ðphy0>; + + nvmem-cells = <&macaddr_factory_22>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy0: ethernet-phy@0 { + reg = <0>; + }; +}; + +&switch0 { + ports { + port@0 { + status = "disabled"; + }; + }; +}; diff --git a/target/linux/ramips/dts/mt7621_ubnt_usw-flex.dts b/target/linux/ramips/dts/mt7621_ubnt_usw-flex.dts index 166320caca..e148242387 100644 --- a/target/linux/ramips/dts/mt7621_ubnt_usw-flex.dts +++ b/target/linux/ramips/dts/mt7621_ubnt_usw-flex.dts @@ -61,6 +61,21 @@ label = "dsa"; }; +&gmac1 { + status = "okay"; + label = "lan1"; + phy-handle = <ðphy4>; + + nvmem-cells = <&macaddr_eeprom>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { ports { port@0 { @@ -82,11 +97,6 @@ status = "okay"; label = "lan2"; }; - - port@4 { - status = "okay"; - label = "lan1"; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_unielec_u7621-01-16m.dts b/target/linux/ramips/dts/mt7621_unielec_u7621-01-16m.dts index 84172cdd17..6e75d1b930 100644 --- a/target/linux/ramips/dts/mt7621_unielec_u7621-01-16m.dts +++ b/target/linux/ramips/dts/mt7621_unielec_u7621-01-16m.dts @@ -52,7 +52,7 @@ nvmem-cell-names = "mac-address"; }; -&wan { +&gmac1 { nvmem-cells = <&macaddr_factory_e000>; nvmem-cell-names = "mac-address"; mac-address-increment = <1>; diff --git a/target/linux/ramips/dts/mt7621_unielec_u7621-01.dtsi b/target/linux/ramips/dts/mt7621_unielec_u7621-01.dtsi index 1d070c7909..f2900e4806 100644 --- a/target/linux/ramips/dts/mt7621_unielec_u7621-01.dtsi +++ b/target/linux/ramips/dts/mt7621_unielec_u7621-01.dtsi @@ -72,13 +72,20 @@ }; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy0>; +}; + +&mdio { + ethphy0: ethernet-phy@0 { + reg = <0>; + }; +}; + &switch0 { ports { - wan: port@0 { - status = "okay"; - label = "wan"; - }; - port@1 { status = "okay"; label = "lan1"; diff --git a/target/linux/ramips/dts/mt7621_unielec_u7621-06-16m.dts b/target/linux/ramips/dts/mt7621_unielec_u7621-06-16m.dts index 41aa2dce5e..d7dd4ccd46 100644 --- a/target/linux/ramips/dts/mt7621_unielec_u7621-06-16m.dts +++ b/target/linux/ramips/dts/mt7621_unielec_u7621-06-16m.dts @@ -57,7 +57,7 @@ nvmem-cell-names = "mac-address"; }; -&wan { +&gmac1 { nvmem-cells = <&macaddr_factory_e000>; nvmem-cell-names = "mac-address"; mac-address-increment = <1>; diff --git a/target/linux/ramips/dts/mt7621_unielec_u7621-06-64m.dts b/target/linux/ramips/dts/mt7621_unielec_u7621-06-64m.dts index a66969a803..669340f194 100644 --- a/target/linux/ramips/dts/mt7621_unielec_u7621-06-64m.dts +++ b/target/linux/ramips/dts/mt7621_unielec_u7621-06-64m.dts @@ -58,7 +58,7 @@ nvmem-cell-names = "mac-address"; }; -&wan { +&gmac1 { nvmem-cells = <&macaddr_factory_e000>; nvmem-cell-names = "mac-address"; mac-address-increment = <1>; diff --git a/target/linux/ramips/dts/mt7621_unielec_u7621-06.dtsi b/target/linux/ramips/dts/mt7621_unielec_u7621-06.dtsi index 8dad53812f..9e91a0a299 100644 --- a/target/linux/ramips/dts/mt7621_unielec_u7621-06.dtsi +++ b/target/linux/ramips/dts/mt7621_unielec_u7621-06.dtsi @@ -73,6 +73,18 @@ status = "okay"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { ports { port@0 { @@ -94,11 +106,6 @@ status = "okay"; label = "lan4"; }; - - wan: port@4 { - status = "okay"; - label = "wan"; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_xiaomi_mi-router-3-pro.dts b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-3-pro.dts index e9bd6e1cab..64f588dc50 100644 --- a/target/linux/ramips/dts/mt7621_xiaomi_mi-router-3-pro.dts +++ b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-3-pro.dts @@ -180,6 +180,21 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; + + nvmem-cells = <&macaddr_factory_e000>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { ports { port@1 { @@ -196,13 +211,6 @@ status = "okay"; label = "lan1"; }; - - port@4 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_factory_e000>; - nvmem-cell-names = "mac-address"; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4.dts b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4.dts index 67a44dad11..232a720e54 100644 --- a/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4.dts +++ b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4.dts @@ -69,6 +69,21 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; + + nvmem-cells = <&macaddr_factory_e006>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { ports { port@1 { @@ -80,13 +95,6 @@ status = "okay"; label = "lan1"; }; - - port@4 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_factory_e006>; - nvmem-cell-names = "mac-address"; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-3g-v2.dtsi b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-3g-v2.dtsi index 4c469a2836..a0ee79ae23 100644 --- a/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-3g-v2.dtsi +++ b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-3g-v2.dtsi @@ -11,7 +11,7 @@ led-failsafe = &led_status_yellow; led-running = &led_status_blue; led-upgrade = &led_status_yellow; - label-mac-device = &wan; + label-mac-device = &gmac1; }; chosen { @@ -135,6 +135,21 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; + + nvmem-cells = <&macaddr_factory_e006>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { ports { port@2 { @@ -146,13 +161,6 @@ status = "okay"; label = "lan1"; }; - - wan: port@4 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_factory_e006>; - nvmem-cell-names = "mac-address"; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_xiaomi_mi-router-cr660x.dtsi b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-cr660x.dtsi index dfdbcc77d4..a6c0033227 100644 --- a/target/linux/ramips/dts/mt7621_xiaomi_mi-router-cr660x.dtsi +++ b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-cr660x.dtsi @@ -144,6 +144,21 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; + + nvmem-cells = <&macaddr_factory_3fffa>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { ports { port@0 { @@ -160,13 +175,6 @@ status = "okay"; label = "lan3"; }; - - port@4 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_factory_3fffa>; - nvmem-cell-names = "mac-address"; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_xiaomi_router-ac2100.dtsi b/target/linux/ramips/dts/mt7621_xiaomi_router-ac2100.dtsi index 7faf9b3e89..78f154b3ae 100644 --- a/target/linux/ramips/dts/mt7621_xiaomi_router-ac2100.dtsi +++ b/target/linux/ramips/dts/mt7621_xiaomi_router-ac2100.dtsi @@ -29,15 +29,23 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy0>; + + nvmem-cells = <&macaddr_factory_e006>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy0: ethernet-phy@0 { + reg = <0>; + }; +}; + &switch0 { ports { - port@0 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_factory_e006>; - nvmem-cell-names = "mac-address"; - }; - port@2 { status = "okay"; label = "lan1"; diff --git a/target/linux/ramips/dts/mt7621_xiaoyu_xy-c5.dts b/target/linux/ramips/dts/mt7621_xiaoyu_xy-c5.dts index 0027bc96fe..e4de0b8231 100644 --- a/target/linux/ramips/dts/mt7621_xiaoyu_xy-c5.dts +++ b/target/linux/ramips/dts/mt7621_xiaoyu_xy-c5.dts @@ -90,6 +90,22 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; + + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <1>; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { ports { port@0 { @@ -111,14 +127,6 @@ status = "okay"; label = "lan4"; }; - - port@4 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_factory_4>; - nvmem-cell-names = "mac-address"; - mac-address-increment = <1>; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_youhua_wr1200js.dts b/target/linux/ramips/dts/mt7621_youhua_wr1200js.dts index 6813a2cf05..2d61b87560 100644 --- a/target/linux/ramips/dts/mt7621_youhua_wr1200js.dts +++ b/target/linux/ramips/dts/mt7621_youhua_wr1200js.dts @@ -129,15 +129,23 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy0>; + + nvmem-cells = <&macaddr_factory_e006>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy0: ethernet-phy@0 { + reg = <0>; + }; +}; + &switch0 { ports { - port@0 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_factory_e006>; - nvmem-cell-names = "mac-address"; - }; - port@1 { status = "okay"; label = "lan1"; diff --git a/target/linux/ramips/dts/mt7621_youku_yk-l2.dts b/target/linux/ramips/dts/mt7621_youku_yk-l2.dts index 19ba7c08de..e588e047eb 100644 --- a/target/linux/ramips/dts/mt7621_youku_yk-l2.dts +++ b/target/linux/ramips/dts/mt7621_youku_yk-l2.dts @@ -137,6 +137,21 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; + + nvmem-cells = <&macaddr_factory_e006>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { ports { port@0 { @@ -158,13 +173,6 @@ status = "okay"; label = "lan4"; }; - - port@4 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_factory_e006>; - nvmem-cell-names = "mac-address"; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_yuncore_ax820.dts b/target/linux/ramips/dts/mt7621_yuncore_ax820.dts index 9638f1f060..75fe3cf581 100644 --- a/target/linux/ramips/dts/mt7621_yuncore_ax820.dts +++ b/target/linux/ramips/dts/mt7621_yuncore_ax820.dts @@ -130,16 +130,24 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy0>; + + nvmem-cells = <&macaddr_factory_e000>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <1>; +}; + +&mdio { + ethphy0: ethernet-phy@0 { + reg = <0>; + }; +}; + &switch0 { ports { - port@0 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_factory_e000>; - nvmem-cell-names = "mac-address"; - mac-address-increment = <1>; - }; - port@1 { status = "okay"; label = "lan"; diff --git a/target/linux/ramips/dts/mt7621_zbtlink_zbt-we1326.dts b/target/linux/ramips/dts/mt7621_zbtlink_zbt-we1326.dts index 80166158b2..6aafe385ae 100644 --- a/target/linux/ramips/dts/mt7621_zbtlink_zbt-we1326.dts +++ b/target/linux/ramips/dts/mt7621_zbtlink_zbt-we1326.dts @@ -78,6 +78,21 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; + + nvmem-cells = <&macaddr_factory_e006>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { ports { port@0 { @@ -99,13 +114,6 @@ status = "okay"; label = "lan4"; }; - - port@4 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_factory_e006>; - nvmem-cell-names = "mac-address"; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_zbtlink_zbt-we3526.dts b/target/linux/ramips/dts/mt7621_zbtlink_zbt-we3526.dts index b156b12fc8..a6d0e9a7c2 100644 --- a/target/linux/ramips/dts/mt7621_zbtlink_zbt-we3526.dts +++ b/target/linux/ramips/dts/mt7621_zbtlink_zbt-we3526.dts @@ -100,6 +100,21 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; + + nvmem-cells = <&macaddr_factory_e006>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { ports { port@0 { @@ -121,13 +136,6 @@ status = "okay"; label = "lan4"; }; - - port@4 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_factory_e006>; - nvmem-cell-names = "mac-address"; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg1602.dtsi b/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg1602.dtsi index 356cf4b442..c80544cfc9 100644 --- a/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg1602.dtsi +++ b/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg1602.dtsi @@ -153,6 +153,21 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; + + nvmem-cells = <&macaddr_factory_e006>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { ports { port@0 { @@ -174,13 +189,6 @@ status = "okay"; label = "lan4"; }; - - port@4 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_factory_e006>; - nvmem-cell-names = "mac-address"; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg1608.dtsi b/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg1608.dtsi index d25217598e..f19cb4db17 100644 --- a/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg1608.dtsi +++ b/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg1608.dtsi @@ -170,6 +170,21 @@ nvmem-cell-names = "mac-address"; }; +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; + + nvmem-cells = <&macaddr_factory_e006>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + &switch0 { gpio-controller; #gpio-cells = <2>; @@ -194,13 +209,6 @@ status = "okay"; label = "lan4"; }; - - port@4 { - status = "okay"; - label = "wan"; - nvmem-cells = <&macaddr_factory_e006>; - nvmem-cell-names = "mac-address"; - }; }; }; From 20f8101a26d0affd9a68f972a8bc65b02d7d4300 Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Thu, 18 Aug 2022 14:49:25 +0200 Subject: [PATCH 22/28] tools/xz: update to 5.2.6 This update contains a security fix to xzgrep (CVE-2022-1271, ZDI-CAN-16587). Release notes: https://git.tukaani.org/?p=xz.git;a=blob;f=NEWS;hb=HEAD Signed-off-by: Nick Hainke --- tools/xz/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/xz/Makefile b/tools/xz/Makefile index 4b13f727da..ef0ed02396 100644 --- a/tools/xz/Makefile +++ b/tools/xz/Makefile @@ -7,12 +7,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=xz -PKG_VERSION:=5.2.5 +PKG_VERSION:=5.2.6 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=@SF/lzmautils \ http://tukaani.org/xz -PKG_HASH:=5117f930900b341493827d63aa910ff5e011e0b994197c3b71c08a20228a42df +PKG_HASH:=13e3402e301b6018f6a71ef0e497f714c6d11e214ae82dab156b81c2a64acb25 PKG_CPE_ID:=cpe:/a:tukaani:xz HOST_BUILD_PARALLEL:=1 From ce3e467d6134fc56317bf851d4f25d7da80df38e Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Thu, 18 Aug 2022 14:42:01 +0200 Subject: [PATCH 23/28] tools/isl: update to 0.25 Update isl to latest version. Signed-off-by: Nick Hainke --- tools/isl/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/isl/Makefile b/tools/isl/Makefile index 32c3cda9a2..e9674debc2 100644 --- a/tools/isl/Makefile +++ b/tools/isl/Makefile @@ -7,11 +7,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=isl -PKG_VERSION:=0.24 +PKG_VERSION:=0.25 PKG_SOURCE_URL:=https://libisl.sourceforge.io/ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_HASH:=043105cc544f416b48736fff8caf077fb0663a717d06b1113f16e391ac99ebad +PKG_HASH:=be7b210647ccadf90a2f0b000fca11a4d40546374a850db67adb32fad4b230d9 HOST_BUILD_PARALLEL:=1 From 3b2f19271cc2cd92a4f3c184f6362c2ec2793041 Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Thu, 18 Aug 2022 07:22:52 +0200 Subject: [PATCH 24/28] tools/cmake: update to 3.24.1 Update cmake to newest version. Signed-off-by: Nick Hainke --- tools/cmake/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/cmake/Makefile b/tools/cmake/Makefile index 4391586b2d..9650755ba0 100644 --- a/tools/cmake/Makefile +++ b/tools/cmake/Makefile @@ -7,14 +7,14 @@ include $(TOPDIR)/rules.mk PKG_NAME:=cmake -PKG_VERSION:=3.22.3 +PKG_VERSION:=3.24.1 PKG_RELEASE:=1 PKG_CPE_ID:=cpe:/a:kitware:cmake PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/Kitware/CMake/releases/download/v$(PKG_VERSION)/ \ - https://cmake.org/files/v3.22/ -PKG_HASH:=9f8469166f94553b6978a16ee29227ec49a2eb5ceb608275dec40d8ae0d1b5a0 + https://cmake.org/files/v3.24/ +PKG_HASH:=4931e277a4db1a805f13baa7013a7757a0cbfe5b7932882925c7061d9d1fa82b HOST_BUILD_PARALLEL:=1 HOST_CONFIGURE_PARALLEL:=1 From 251ecfe37914919422d74dd32fab15a86f65e879 Mon Sep 17 00:00:00 2001 From: Sebastian Schaper Date: Wed, 9 Sep 2020 20:42:53 +0200 Subject: [PATCH 25/28] ath79: add support for ZyXEL NWA1121-NI Specifications: * AR9342, 16 MiB Flash, 64 MiB RAM, 802.11n 2T2R, 2.4 GHz * 1x Gigabit Ethernet (AR8035), 802.3af PoE Installation: * OEM Web UI is at 192.168.1.2 login as `admin` with password `1234` * Flash factory-AABJ.bin The string `AABJ` needs to be present within the file name of the uploaded image to be accepted by the OEM Web-based updater, the factory image is named accordingly to save the user from the hassle of manual renaming. TFTP Recovery: * Open the case, connect to TTL UART port (this is the official method described by Zyxel, the reset button is useless during power-on) * Extract factory image (.tar.bz2), serve `vmlinux_mi124_f1e.lzma.uImage` and `mi124_f1e-jffs2` via tftp at 192.168.1.10 * Interrupt uboot countdown, execute commands `run lk` `run lf` to flash the kernel / filesystem accordingly MAC addresses as verified by OEM firmware: use address source LAN *:cc mib0 0x30 ('eth0mac'), art 0x1002 (label) 2g *:cd mib0 0x4b ('wifi0mac') Signed-off-by: Sebastian Schaper --- .../ath79/dts/ar9342_zyxel_nwa1121-ni.dts | 31 ++++ .../linux/ath79/dts/ar9342_zyxel_nwa11xx.dtsi | 166 ++++++++++++++++++ .../generic/base-files/etc/board.d/02_network | 3 +- target/linux/ath79/image/generic.mk | 31 +++- 4 files changed, 229 insertions(+), 2 deletions(-) create mode 100644 target/linux/ath79/dts/ar9342_zyxel_nwa1121-ni.dts create mode 100644 target/linux/ath79/dts/ar9342_zyxel_nwa11xx.dtsi diff --git a/target/linux/ath79/dts/ar9342_zyxel_nwa1121-ni.dts b/target/linux/ath79/dts/ar9342_zyxel_nwa1121-ni.dts new file mode 100644 index 0000000000..65dc8c0440 --- /dev/null +++ b/target/linux/ath79/dts/ar9342_zyxel_nwa1121-ni.dts @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "ar9342_zyxel_nwa11xx.dtsi" + +/ { + compatible = "zyxel,nwa1121-ni", "qca,ar9342"; + model = "Zyxel NWA1121-NI"; + + aliases { + label-mac-device = ð0; + led-boot = &led_status_green; + led-failsafe = &led_status_amber; + led-running = &led_status_green; + led-upgrade = &led_status_amber; + }; + + leds { + compatible = "gpio-leds"; + + led_status_green: status_green { + label = "green:status"; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + + led_status_amber: status_amber { + label = "amber:status"; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + }; + }; +}; diff --git a/target/linux/ath79/dts/ar9342_zyxel_nwa11xx.dtsi b/target/linux/ath79/dts/ar9342_zyxel_nwa11xx.dtsi new file mode 100644 index 0000000000..7cc1bba3fc --- /dev/null +++ b/target/linux/ath79/dts/ar9342_zyxel_nwa11xx.dtsi @@ -0,0 +1,166 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "ar9344.dtsi" + +#include +#include +#include + +/ { + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + }; + }; + + virtual_flash { + compatible = "mtd-concat"; + + devices = <&fwconcat0 &fwconcat1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + compatible = "openwrt,uimage", "denx,uimage"; + openwrt,ih-magic = ; + label = "firmware"; + reg = <0x0 0x0>; + }; + }; + }; +}; + +&ref { + clock-frequency = <40000000>; +}; + +&spi { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <50000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x000000 0x040000>; + read-only; + }; + + partition@40000 { + label = "u-boot-env"; + reg = <0x040000 0x010000>; + }; + + fwconcat0: partition@50000 { + label = "fwconcat0"; + reg = <0x050000 0x800000>; + }; + + partition@850000 { + label = "loader"; + reg = <0x850000 0x010000>; + read-only; + }; + + fwconcat1: partition@860000 { + label = "fwconcat1"; + reg = <0x860000 0x740000>; + }; + + partition@fa0000 { + label = "config"; + reg = <0xfa0000 0x040000>; + read-only; + }; + + partition@fe0000 { + label = "mib0"; + reg = <0xfe0000 0x010000>; + read-only; + + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_mib0_4b: macaddr@4b { + reg = <0x4b 0x11>; + }; + + macaddr_mib0_66: macaddr@66 { + reg = <0x66 0x11>; + }; + }; + + art: partition@ff0000 { + label = "art"; + reg = <0xff0000 0x010000>; + read-only; + + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + calibration_ath9k: calibration@1000 { + reg = <0x1000 0x440>; + }; + + macaddr_art_1002: macaddr@1002 { + reg = <0x1002 0x6>; + }; + }; + }; + }; +}; + +&mdio0 { + status = "okay"; + + phy0: ethernet-phy@0 { + reg = <0>; + phy-mode = "rgmii"; + }; +}; + +ð0 { + status = "okay"; + + pll-data = <0x06000000 0x00000101 0x00001313>; + + nvmem-cells = <&macaddr_art_1002>; + nvmem-cell-names = "mac-address"; + + phy-mode = "rgmii-id"; + phy-handle = <&phy0>; + + gmac-config { + device = <&gmac>; + rxdv-delay = <3>; + rxd-delay = <3>; + txen-delay = <3>; + txd-delay = <3>; + rgmii-gmac0 = <1>; + }; +}; + +&wmac { + status = "okay"; + + ieee80211-freq-limit = <2402000 2482000>; + + nvmem-cells = <&macaddr_mib0_4b>, <&calibration_ath9k>; + nvmem-cell-names = "mac-address-ascii", "calibration"; +}; diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network b/target/linux/ath79/generic/base-files/etc/board.d/02_network index f10737f2fb..34f04b5300 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network @@ -109,7 +109,8 @@ ath79_setup_interfaces() ubnt,unifiac-mesh|\ ubnt,unifi|\ wd,mynet-wifi-rangeextender|\ - winchannel,wb2000) + winchannel,wb2000|\ + zyxel,nwa1121-ni) ucidef_set_interface_lan "eth0" ;; airtight,c-75) diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index 4aa6ed6480..9ba5e20e57 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -9,7 +9,7 @@ DEVICE_VARS += ADDPATTERN_ID ADDPATTERN_VERSION DEVICE_VARS += SEAMA_SIGNATURE SEAMA_MTDBLOCK DEVICE_VARS += KERNEL_INITRAMFS_PREFIX DAP_SIGNATURE DEVICE_VARS += EDIMAX_HEADER_MAGIC EDIMAX_HEADER_MODEL -DEVICE_VARS += OPENMESH_CE_TYPE +DEVICE_VARS += OPENMESH_CE_TYPE ZYXEL_MODEL_STRING define Build/add-elecom-factory-initramfs $(eval edimax_model=$(word 1,$(1))) @@ -161,6 +161,13 @@ define Build/wrgg-pad-rootfs $(STAGING_DIR_HOST)/bin/padjffs2 $(IMAGE_ROOTFS) -c 64 >>$@ endef +define Build/zyxel-tar-bz2 + mkdir -p $@.tmp + mv $@ $@.tmp/$(word 2,$(1)) + cp $(KDIR)/loader-$(DEVICE_NAME).uImage $@.tmp/$(word 1,$(1)).lzma.uImage + $(TAR) -cjf $@ -C $@.tmp . + rm -rf $@.tmp +endef define Device/seama KERNEL := kernel-bin | append-dtb | relocate-kernel | lzma @@ -2687,6 +2694,28 @@ define Device/zbtlink_zbt-wd323 endef TARGET_DEVICES += zbtlink_zbt-wd323 +define Device/zyxel_nwa11xx + $(Device/loader-okli-uimage) + SOC := ar9342 + DEVICE_VENDOR := ZyXEL + LOADER_FLASH_OFFS := 0x050000 + KERNEL := kernel-bin | append-dtb | lzma | uImage lzma -M 0x4f4b4c49 + IMAGE_SIZE := 8192k + IMAGES += factory-$$$$(ZYXEL_MODEL_STRING).bin + IMAGE/factory-$$$$(ZYXEL_MODEL_STRING).bin := \ + append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | \ + pad-rootfs | pad-to 8192k | check-size | zyxel-tar-bz2 \ + vmlinux_mi124_f1e mi124_f1e-jffs2 | append-md5sum-bin +endef + +define Device/zyxel_nwa1121-ni + $(Device/zyxel_nwa11xx) + DEVICE_MODEL := NWA1121 + DEVICE_VARIANT := NI + ZYXEL_MODEL_STRING := AABJ +endef +TARGET_DEVICES += zyxel_nwa1121-ni + define Device/zyxel_nbg6616 SOC := qca9557 DEVICE_VENDOR := ZyXEL From 527be5a456cecdc4e3296816906e117ec04bfdff Mon Sep 17 00:00:00 2001 From: Sebastian Schaper Date: Sun, 28 Mar 2021 00:32:46 +0100 Subject: [PATCH 26/28] ath79: add support for ZyXEL NWA1123-NI Specifications: * AR9342, 16 MiB Flash, 64 MiB RAM, 802.11n 2T2R, 2.4 GHz * AR9382 PCIe card, 802.11n 2T2R, 5 GHz * 1x Gigabit Ethernet (AR8035), 802.3af PoE Installation: * OEM Web UI is at 192.168.1.2 login as `admin` with password `1234` * Flash factory-AAEO.bin The string `AAEO` needs to be present within the file name of the uploaded image to be accepted by the OEM Web-based updater, the factory image is named accordingly to save the user from the hassle of manual renaming. TFTP Recovery: * Open the case, connect to TTL UART port (this is the official method described by Zyxel, the reset button is useless during power-on) * Extract factory image (.tar.bz2), serve `vmlinux_mi124_f1e.lzma.uImage` and `mi124_f1e-jffs2` via tftp at 192.168.1.10 * Interrupt uboot countdown, execute commands `run lk` `run lf` to flash the kernel / filesystem accordingly MAC addresses as verified by OEM firmware: use address source LAN *:fb mib0 0x30 ('eth0mac'), art 0x1002 (label) 2g *:fc mib0 0x4b ('wifi0mac') 5g *:fd mib0 0x66 ('wifi1mac') Signed-off-by: Sebastian Schaper --- .../ath79/dts/ar9342_zyxel_nwa1123-ni.dts | 35 +++++++++++++++++++ .../generic/base-files/etc/board.d/02_network | 3 +- .../etc/hotplug.d/ieee80211/10_fix_wifi_mac | 4 +++ target/linux/ath79/image/generic.mk | 8 +++++ 4 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 target/linux/ath79/dts/ar9342_zyxel_nwa1123-ni.dts diff --git a/target/linux/ath79/dts/ar9342_zyxel_nwa1123-ni.dts b/target/linux/ath79/dts/ar9342_zyxel_nwa1123-ni.dts new file mode 100644 index 0000000000..b999c960c4 --- /dev/null +++ b/target/linux/ath79/dts/ar9342_zyxel_nwa1123-ni.dts @@ -0,0 +1,35 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "ar9342_zyxel_nwa11xx.dtsi" + +/ { + compatible = "zyxel,nwa1123-ni", "qca,ar9342"; + model = "Zyxel NWA1123-NI"; + + aliases { + label-mac-device = ð0; + led-boot = &led_status_green; + led-failsafe = &led_status_amber; + led-running = &led_status_green; + led-upgrade = &led_status_amber; + }; + + leds { + compatible = "gpio-leds"; + + led_status_green: status_green { + label = "green:status"; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + + led_status_amber: status_amber { + label = "amber:status"; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&pcie { + status = "okay"; +}; diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network b/target/linux/ath79/generic/base-files/etc/board.d/02_network index 34f04b5300..f0bc9b3a9c 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network @@ -110,7 +110,8 @@ ath79_setup_interfaces() ubnt,unifi|\ wd,mynet-wifi-rangeextender|\ winchannel,wb2000|\ - zyxel,nwa1121-ni) + zyxel,nwa1121-ni|\ + zyxel,nwa1123-ni) ucidef_set_interface_lan "eth0" ;; airtight,c-75) diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac b/target/linux/ath79/generic/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac index 95ff6083c7..15bdf81a05 100644 --- a/target/linux/ath79/generic/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac +++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac @@ -68,4 +68,8 @@ case "$board" in [ "$PHYNBR" -eq 1 ] && \ mtd_get_mac_ascii u-boot-env ethaddr > /sys${DEVPATH}/macaddress ;; + zyxel,nwa1123-ni) + [ "$PHYNBR" -eq 1 ] && \ + mtd_get_mac_text mib0 0x66 > /sys${DEVPATH}/macaddress + ;; esac diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index 9ba5e20e57..617f1eed30 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -2716,6 +2716,14 @@ define Device/zyxel_nwa1121-ni endef TARGET_DEVICES += zyxel_nwa1121-ni +define Device/zyxel_nwa1123-ni + $(Device/zyxel_nwa11xx) + DEVICE_MODEL := NWA1123 + DEVICE_VARIANT := NI + ZYXEL_MODEL_STRING := AAEO +endef +TARGET_DEVICES += zyxel_nwa1123-ni + define Device/zyxel_nbg6616 SOC := qca9557 DEVICE_VENDOR := ZyXEL From a6e0ca96da45067026f9c74ed1e0e16fc1cf7b7c Mon Sep 17 00:00:00 2001 From: Sebastian Schaper Date: Sun, 28 Mar 2021 00:33:45 +0100 Subject: [PATCH 27/28] ath79: add support for ZyXEL NWA1123-AC Specifications: * AR9342, 16 MiB Flash, 64 MiB RAM, 802.11n 2T2R, 2.4 GHz * QCA9882 PCIe card, 802.11ac 2T2R * 1x Gigabit Ethernet (AR8035), 802.3af PoE Installation: * OEM Web UI is at 192.168.1.2 login as `admin` with password `1234` * Flash factory-AAOX.bin The string `AAOX` needs to be present within the file name of the uploaded image to be accepted by the OEM Web-based updater, the factory image is named accordingly to save the user from the hassle of manual renaming. TFTP Recovery: * Open the case, connect to TTL UART port (this is the official method described by Zyxel, the reset button is useless during power-on) * Extract factory image (.tar.bz2), serve `vmlinux_mi124_f1e.lzma.uImage` and `mi124_f1e-jffs2` via tftp at 192.168.1.10 * Interrupt uboot countdown, execute commands `run lk` `run lf` to flash the kernel / filesystem accordingly MAC addresses as verified by OEM firmware: use address source LAN *:1c mib0 0x30 ('eth0mac'), art 0x1002 (label) 2g *:1c mib0 0x4b ('wifi0mac') 5g *:1e mib0 0x66 ('wifi1mac') Signed-off-by: Sebastian Schaper --- .../ath79/dts/ar9342_zyxel_nwa1123-ac.dts | 35 +++++++++++++++++++ .../generic/base-files/etc/board.d/02_network | 1 + .../etc/hotplug.d/ieee80211/10_fix_wifi_mac | 4 +++ target/linux/ath79/image/generic.mk | 10 ++++++ 4 files changed, 50 insertions(+) create mode 100644 target/linux/ath79/dts/ar9342_zyxel_nwa1123-ac.dts diff --git a/target/linux/ath79/dts/ar9342_zyxel_nwa1123-ac.dts b/target/linux/ath79/dts/ar9342_zyxel_nwa1123-ac.dts new file mode 100644 index 0000000000..68d4930813 --- /dev/null +++ b/target/linux/ath79/dts/ar9342_zyxel_nwa1123-ac.dts @@ -0,0 +1,35 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "ar9342_zyxel_nwa11xx.dtsi" + +/ { + compatible = "zyxel,nwa1123-ac", "qca,ar9342"; + model = "Zyxel NWA1123-AC"; + + aliases { + label-mac-device = ð0; + led-boot = &led_status_green; + led-failsafe = &led_status_amber; + led-running = &led_status_green; + led-upgrade = &led_status_amber; + }; + + leds { + compatible = "gpio-leds"; + + led_status_green: status_green { + label = "green:status"; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + + led_status_amber: status_amber { + label = "amber:status"; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&pcie { + status = "okay"; +}; diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network b/target/linux/ath79/generic/base-files/etc/board.d/02_network index f0bc9b3a9c..9656c009a1 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network @@ -111,6 +111,7 @@ ath79_setup_interfaces() wd,mynet-wifi-rangeextender|\ winchannel,wb2000|\ zyxel,nwa1121-ni|\ + zyxel,nwa1123-ac|\ zyxel,nwa1123-ni) ucidef_set_interface_lan "eth0" ;; diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac b/target/linux/ath79/generic/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac index 15bdf81a05..57458cdef0 100644 --- a/target/linux/ath79/generic/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac +++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac @@ -68,6 +68,10 @@ case "$board" in [ "$PHYNBR" -eq 1 ] && \ mtd_get_mac_ascii u-boot-env ethaddr > /sys${DEVPATH}/macaddress ;; + zyxel,nwa1123-ac) + [ "$PHYNBR" -eq 0 ] && \ + mtd_get_mac_text mib0 0x66 > /sys${DEVPATH}/macaddress + ;; zyxel,nwa1123-ni) [ "$PHYNBR" -eq 1 ] && \ mtd_get_mac_text mib0 0x66 > /sys${DEVPATH}/macaddress diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index 617f1eed30..612b79f8d6 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -2716,6 +2716,16 @@ define Device/zyxel_nwa1121-ni endef TARGET_DEVICES += zyxel_nwa1121-ni +define Device/zyxel_nwa1123-ac + $(Device/zyxel_nwa11xx) + DEVICE_MODEL := NWA1123 + DEVICE_VARIANT := AC + ZYXEL_MODEL_STRING := AAOX + DEVICE_PACKAGES := kmod-ath10k-ct-smallbuffers \ + ath10k-firmware-qca988x-ct +endef +TARGET_DEVICES += zyxel_nwa1123-ac + define Device/zyxel_nwa1123-ni $(Device/zyxel_nwa11xx) DEVICE_MODEL := NWA1123 From a434795809bb0759947f57117a28cd0df5e19e76 Mon Sep 17 00:00:00 2001 From: Sebastian Schaper Date: Sun, 7 Aug 2022 00:59:06 +0200 Subject: [PATCH 28/28] ath79: add support for ZyXEL NWA1100-NH Specifications: * AR9342, 16 MiB Flash, 64 MiB RAM, 802.11n 2T2R, 2.4 GHz * 1x Gigabit Ethernet (AR8035), 802.3af PoE Installation: * OEM Web UI is at 192.168.1.2 login as `admin` with password `1234` * Flash factory-AASI.bin The string `AASI` needs to be present within the file name of the uploaded image to be accepted by the OEM Web-based updater, the factory image is named accordingly to save the user from the hassle of manual renaming. TFTP Recovery: * Open the case, connect to TTL UART port (this is the official method described by Zyxel, the reset button is useless during power-on) * Extract factory image (.tar.bz2), serve `vmlinux_mi124_f1e.lzma.uImage` and `mi124_f1e-jffs2` via tftp at 192.168.1.10 * Interrupt uboot countdown, execute commands `run lk` `run lf` to flash the kernel / filesystem accordingly MAC addresses as verified by OEM firmware: use address source LAN *:cc mib0 0x30 ('eth0mac'), art 0x1002 (label) 2g *:cd mib0 0x4b ('wifi0mac') Signed-off-by: Sebastian Schaper --- .../ath79/dts/ar9342_zyxel_nwa1100-nh.dts | 46 +++++++++++++++++++ .../generic/base-files/etc/board.d/01_leds | 3 ++ .../generic/base-files/etc/board.d/02_network | 1 + target/linux/ath79/image/generic.mk | 8 ++++ 4 files changed, 58 insertions(+) create mode 100644 target/linux/ath79/dts/ar9342_zyxel_nwa1100-nh.dts diff --git a/target/linux/ath79/dts/ar9342_zyxel_nwa1100-nh.dts b/target/linux/ath79/dts/ar9342_zyxel_nwa1100-nh.dts new file mode 100644 index 0000000000..fd438059e5 --- /dev/null +++ b/target/linux/ath79/dts/ar9342_zyxel_nwa1100-nh.dts @@ -0,0 +1,46 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "ar9342_zyxel_nwa11xx.dtsi" + +/ { + compatible = "zyxel,nwa1100-nh", "qca,ar9342"; + model = "Zyxel NWA1100-NH"; + + aliases { + label-mac-device = ð0; + led-boot = &led_status_green; + led-failsafe = &led_status_red; + led-running = &led_status_green; + led-upgrade = &led_status_red; + }; + leds { + compatible = "gpio-leds"; + + led_status_green: status_green { + label = "green:status"; + gpios = <&gpio 12 GPIO_ACTIVE_HIGH>; + default-state = "on"; + }; + + led_status_red: status_red { + label = "red:status"; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + }; + + led_wlan_green: wlan_green { + label = "green:wlan"; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + led_lan_green: lan_green { + label = "green:lan"; + gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + }; + + led_lan_amber: lan_amber { + label = "amber:lan"; + gpios = <&gpio 17 GPIO_ACTIVE_LOW>; + }; + }; +}; diff --git a/target/linux/ath79/generic/base-files/etc/board.d/01_leds b/target/linux/ath79/generic/base-files/etc/board.d/01_leds index b3a8b2fbb6..188262018c 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/01_leds +++ b/target/linux/ath79/generic/base-files/etc/board.d/01_leds @@ -484,6 +484,9 @@ zbtlink,zbt-wd323) ucidef_set_led_switch "lan1" "LAN1" "orange:lan1" "switch0" "0x10" ucidef_set_led_switch "lan2" "LAN2" "orange:lan2" "switch0" "0x08" ;; +zyxel,nwa1100-nh) + ucidef_set_led_netdev "lan_data" "LAN_DATA" "amber:lan" "eth0" "tx rx" + ucidef_set_led_netdev "lan_link" "LAN_LINK" "green:lan" "eth0" "link" esac board_config_flush diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network b/target/linux/ath79/generic/base-files/etc/board.d/02_network index 9656c009a1..c576dacee5 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network @@ -110,6 +110,7 @@ ath79_setup_interfaces() ubnt,unifi|\ wd,mynet-wifi-rangeextender|\ winchannel,wb2000|\ + zyxel,nwa1100-nh|\ zyxel,nwa1121-ni|\ zyxel,nwa1123-ac|\ zyxel,nwa1123-ni) diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index 612b79f8d6..575004ea15 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -2708,6 +2708,14 @@ define Device/zyxel_nwa11xx vmlinux_mi124_f1e mi124_f1e-jffs2 | append-md5sum-bin endef +define Device/zyxel_nwa1100-nh + $(Device/zyxel_nwa11xx) + DEVICE_MODEL := NWA1100 + DEVICE_VARIANT := NH + ZYXEL_MODEL_STRING := AASI +endef +TARGET_DEVICES += zyxel_nwa1100-nh + define Device/zyxel_nwa1121-ni $(Device/zyxel_nwa11xx) DEVICE_MODEL := NWA1121