diff --git a/config/Config-build.in b/config/Config-build.in index 37cc3d7e5a..8e12199cbd 100644 --- a/config/Config-build.in +++ b/config/Config-build.in @@ -329,27 +329,45 @@ menu "Global build settings" endchoice config TARGET_ROOTFS_SECURITY_LABELS - bool "Enable rootfs security labels" + bool select KERNEL_SQUASHFS_XATTR select KERNEL_EXT4_FS_SECURITY select KERNEL_F2FS_FS_SECURITY select KERNEL_UBIFS_FS_SECURITY select KERNEL_JFFS2_FS_SECURITY + + config SELINUX + bool "Enable SELinux" + select KERNEL_SECURITY_SELINUX + select TARGET_ROOTFS_SECURITY_LABELS + select PACKAGE_procd-selinux + select PACKAGE_busybox-selinux help - This option enables the usage of SELinux labels + This option enables SELinux kernel features, applies security labels + in squashfs rootfs and selects the selinux-variants of busybox and procd. + + Selecting this option results in about 0.5MiB of additional flash space + usage accounting for increased kernel and rootfs size. choice prompt "default SELinux type" depends on TARGET_ROOTFS_SECURITY_LABELS default SELINUXTYPE_dssp help - Choose SELinux policy to be used for build. + Select SELinux policy to be installed and used for applying rootfs labels. + config SELINUXTYPE_targeted bool "targeted" select PACKAGE_refpolicy + help + SELinux Reference Policy (refpolicy) + config SELINUXTYPE_dssp bool "dssp" select PACKAGE_selinux-policy + help + Defensec SELinux Security Policy -- OpenWrt edition + endchoice endmenu diff --git a/config/Config-kernel.in b/config/Config-kernel.in index 6c12503bdb..512f0ad482 100644 --- a/config/Config-kernel.in +++ b/config/Config-kernel.in @@ -1124,6 +1124,7 @@ config KERNEL_SECURITY_SELINUX config KERNEL_SECURITY_SELINUX_BOOTPARAM bool "NSA SELinux boot parameter" depends on KERNEL_SECURITY_SELINUX + default y config KERNEL_SECURITY_SELINUX_DISABLE bool "NSA SELinux runtime disable" @@ -1132,6 +1133,7 @@ config KERNEL_SECURITY_SELINUX_DISABLE config KERNEL_SECURITY_SELINUX_DEVELOP bool "NSA SELinux Development Support" depends on KERNEL_SECURITY_SELINUX + default y config KERNEL_LSM string diff --git a/include/download.mk b/include/download.mk index 9c8ada052b..d393bf3907 100644 --- a/include/download.mk +++ b/include/download.mk @@ -12,9 +12,11 @@ OPENWRT_GIT = $(PROJECT_GIT) LEDE_GIT = $(PROJECT_GIT) ifdef PKG_SOURCE_VERSION -PKG_VERSION ?= $(if $(PKG_SOURCE_DATE),$(PKG_SOURCE_DATE)-)$(call version_abbrev,$(PKG_SOURCE_VERSION)) -PKG_SOURCE_SUBDIR ?= $(PKG_NAME)-$(PKG_VERSION) -PKG_SOURCE ?= $(PKG_SOURCE_SUBDIR).tar.xz + ifndef PKG_VERSION + PKG_VERSION := $(if $(PKG_SOURCE_DATE),$(PKG_SOURCE_DATE)-)$(call version_abbrev,$(PKG_SOURCE_VERSION)) + endif + PKG_SOURCE_SUBDIR ?= $(PKG_NAME)-$(PKG_VERSION) + PKG_SOURCE ?= $(PKG_SOURCE_SUBDIR).tar.xz endif DOWNLOAD_RDEP=$(STAMP_PREPARED) $(HOST_STAMP_PREPARED) diff --git a/include/kernel-version.mk b/include/kernel-version.mk index 9e91c84fff..bec2b73608 100644 --- a/include/kernel-version.mk +++ b/include/kernel-version.mk @@ -7,10 +7,10 @@ ifdef CONFIG_TESTING_KERNEL endif LINUX_VERSION-4.19 = .138 -LINUX_VERSION-5.4 = .70 +LINUX_VERSION-5.4 = .71 LINUX_KERNEL_HASH-4.19.138 = d15c27d05f6c527269b75b30cc72972748e55720e7e00ad8abbaa4fe3b1d5e02 -LINUX_KERNEL_HASH-5.4.70 = c0b3d8085c5ba235df38b00b740e053659709e8a5ca21957a239f6bc22c45007 +LINUX_KERNEL_HASH-5.4.71 = 737049ef3cf38d46ee3b377354336cdbc1c4dd95b4e54975a70716f96c8d6cc7 remove_uri_prefix=$(subst git://,,$(subst http://,,$(subst https://,,$(1)))) sanitize_uri=$(call qstrip,$(subst @,_,$(subst :,_,$(subst .,_,$(subst -,_,$(subst /,_,$(1))))))) diff --git a/include/target.mk b/include/target.mk index 53c84b53f0..2568321b81 100644 --- a/include/target.mk +++ b/include/target.mk @@ -213,6 +213,7 @@ ifeq ($(DUMP),1) CPU_CFLAGS += -mno-branch-likely CPU_CFLAGS_mips32 = -mips32 -mtune=mips32 CPU_CFLAGS_mips64 = -mips64 -mtune=mips64 -mabi=64 + CPU_CFLAGS_mips64r2 = -mips64r2 -mtune=mips64r2 -mabi=64 CPU_CFLAGS_24kc = -mips32r2 -mtune=24kc CPU_CFLAGS_74kc = -mips32r2 -mtune=74kc CPU_CFLAGS_octeonplus = -march=octeon+ -mabi=64 diff --git a/package/Makefile b/package/Makefile index f5373ee65d..ec503dc527 100644 --- a/package/Makefile +++ b/package/Makefile @@ -11,6 +11,7 @@ include $(INCLUDE_DIR)/feeds.mk include $(INCLUDE_DIR)/rootfs.mk -include $(TMP_DIR)/.packagedeps +package-y += kernel/linux $(curdir)/autoremove:=1 $(curdir)/builddirs:=$(sort $(package-) $(package-y) $(package-m)) $(curdir)/builddirs-default:=. $(sort $(package-y) $(package-m)) diff --git a/package/boot/arm-trusted-firmware-mvebu/Makefile b/package/boot/arm-trusted-firmware-mvebu/Makefile index 9e917545a7..38dd9d1635 100644 --- a/package/boot/arm-trusted-firmware-mvebu/Makefile +++ b/package/boot/arm-trusted-firmware-mvebu/Makefile @@ -45,7 +45,7 @@ define Package/arm-trusted-firmware-mvebu-espressobin-v3-v5-1gb-1cs TITLE:=ARM Trusted Firmware for Marvell ESPRESSObin V3-V5 (1GB 1CS) DEPENDS:=+u-boot-espressobin UBOOT:=espressobin - DDR_TOPOLOGY:=2 + DDR_TOPOLOGY:=4 CLOCKSPRESET:=CPU_800_DDR_800 PLAT:=a3700 endef diff --git a/package/boot/uboot-envtools/files/mvebu b/package/boot/uboot-envtools/files/mvebu index 1d3b79b962..85101cf35b 100644 --- a/package/boot/uboot-envtools/files/mvebu +++ b/package/boot/uboot-envtools/files/mvebu @@ -27,7 +27,14 @@ glinet,gl-mv1000) globalscale,espressobin|\ globalscale,espressobin-emmc|\ globalscale,espressobin-v7|\ -globalscale,espressobin-v7-emmc|\ +globalscale,espressobin-v7-emmc) + idx="$(find_mtd_index u-boot-env)" + if [ -n "$idx" ]; then + ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x10000" "1" + else + ubootenv_add_uci_config "/dev/mtd0" "0x3f0000" "0x10000" "0x10000" "1" + fi + ;; marvell,armada8040-mcbin-doubleshot|\ marvell,armada8040-mcbin-singleshot) ubootenv_add_uci_config "/dev/mtd0" "0x3f0000" "0x10000" "0x10000" "1" diff --git a/package/boot/uboot-mvebu/Makefile b/package/boot/uboot-mvebu/Makefile index 9a1b5ed63d..25dd2526e5 100644 --- a/package/boot/uboot-mvebu/Makefile +++ b/package/boot/uboot-mvebu/Makefile @@ -8,10 +8,10 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk -PKG_VERSION:=2020.10-rc4 +PKG_VERSION:=2020.10 PKG_RELEASE:=1 -PKG_HASH:=0a7bdd2c7df2c14daf2730fcf3277fd917aadfaae935529e29c7412314bbf260 +PKG_HASH:=0d481bbdc05c0ee74908ec2f56a6daa53166cc6a78a0e4fac2ac5d025770a622 include $(INCLUDE_DIR)/u-boot.mk include $(INCLUDE_DIR)/package.mk @@ -38,14 +38,12 @@ endef define U-Boot/espressobin NAME:=Marvell ESPRESSObin - BUILD_DEVICES:=globalscale_espressobin globalscale_espressobin-v7 BUILD_SUBTARGET:=cortexa53 UBOOT_CONFIG:=mvebu_espressobin-88f3720 endef define U-Boot/espressobin-emmc NAME:=Marvell ESPRESSObin - BUILD_DEVICES:=globalscale_espressobin-emmc globalscale_espressobin-v7-emmc BUILD_SUBTARGET:=cortexa53 UBOOT_CONFIG:=mvebu_espressobin-88f3720 UBOOT_MAKE_FLAGS+=DEVICE_TREE=armada-3720-espressobin-emmc @@ -53,7 +51,6 @@ endef define U-Boot/uDPU NAME:=Methode uDPU - BUILD_DEVICES:=methode_udpu BUILD_SUBTARGET:=cortexa53 endef @@ -68,12 +65,15 @@ Build/Exports:=$(Host/Exports) define Build/Configure # enable additional options beyond _defconfig - echo CONFIG_NET_RANDOM_ETHADDR=y >> $(PKG_BUILD_DIR)/configs/$(UBOOT_CONFIG)_defconfig echo CONFIG_CMD_SETEXPR=y >> $(PKG_BUILD_DIR)/configs/$(UBOOT_CONFIG)_defconfig $(call Build/Configure/U-Boot) endef +define Package/u-boot/install + $(if $(findstring cortexa53,$(BUILD_SUBTARGET)),,$(Package/u-boot/install/default)) +endef + define Build/InstallDev $(INSTALL_DIR) $(STAGING_DIR_IMAGE) $(CP) $(PKG_BUILD_DIR)/$(UBOOT_IMAGE) $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-$(UBOOT_IMAGE) diff --git a/package/boot/uboot-mvebu/patches/100-add_support_for_macronix_mx25u12835f.patch b/package/boot/uboot-mvebu/patches/100-add_support_for_macronix_mx25u12835f.patch deleted file mode 100644 index f1a292694d..0000000000 --- a/package/boot/uboot-mvebu/patches/100-add_support_for_macronix_mx25u12835f.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/drivers/mtd/spi/spi-nor-ids.c -+++ b/drivers/mtd/spi/spi-nor-ids.c -@@ -151,6 +151,7 @@ const struct flash_info spi_nor_ids[] = - { INFO("mx25u3235f", 0xc22536, 0, 4 * 1024, 1024, SECT_4K) }, - { INFO("mx25u6435f", 0xc22537, 0, 64 * 1024, 128, SECT_4K) }, - { INFO("mx25l12805d", 0xc22018, 0, 64 * 1024, 256, 0) }, -+ { INFO("mx25u12835f", 0xc22538, 0, 64 * 1024, 256, SECT_4K) }, - { INFO("mx25l12855e", 0xc22618, 0, 64 * 1024, 256, 0) }, - { INFO("mx25l25635e", 0xc22019, 0, 64 * 1024, 512, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, - { INFO("mx25u25635f", 0xc22539, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_4B_OPCODES) }, diff --git a/package/boot/uboot-mvebu/patches/120-mvebu_armada-37xx.h_increase_max_gunzip_size.patch b/package/boot/uboot-mvebu/patches/120-mvebu_armada-37xx.h_increase_max_gunzip_size.patch deleted file mode 100644 index c543e5126a..0000000000 --- a/package/boot/uboot-mvebu/patches/120-mvebu_armada-37xx.h_increase_max_gunzip_size.patch +++ /dev/null @@ -1,13 +0,0 @@ -Increase max gunzip size in mvebu_armada-37xx.h. -This is required in order to boot itb images. - ---- a/include/configs/mvebu_armada-37xx.h -+++ b/include/configs/mvebu_armada-37xx.h -@@ -12,6 +12,7 @@ - - /* additions for new ARM relocation support */ - #define CONFIG_SYS_SDRAM_BASE 0x00000000 -+#define CONFIG_SYS_BOOTM_LEN (64 << 20) /* Increase max gunzip size */ - - /* auto boot */ - diff --git a/package/boot/uboot-mvebu/patches/130-mmc-xenon_sdhci-Add-missing-common-host-capabilities.patch b/package/boot/uboot-mvebu/patches/130-mmc-xenon_sdhci-Add-missing-common-host-capabilities.patch deleted file mode 100644 index fa41f01526..0000000000 --- a/package/boot/uboot-mvebu/patches/130-mmc-xenon_sdhci-Add-missing-common-host-capabilities.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 264c45575ec6a3d507dc4e43954b8a78283aca6c Mon Sep 17 00:00:00 2001 -From: Andre Heider -Date: Thu, 10 Sep 2020 17:58:43 +0200 -Subject: [PATCH] mmc: xenon_sdhci: Add missing common host capabilities - -Use mmc_of_parse() to set the common host properties. That includes -"bus-width", so parsing it can be removed from the driver. - -But more importantly, "non-removable" is now respected, which fixes -the usage of eMMC. - -Signed-off-by: Andre Heider ---- - drivers/mmc/xenon_sdhci.c | 18 ++++-------------- - 1 file changed, 4 insertions(+), 14 deletions(-) - ---- a/drivers/mmc/xenon_sdhci.c -+++ b/drivers/mmc/xenon_sdhci.c -@@ -485,20 +485,10 @@ static int xenon_sdhci_probe(struct udev - armada_3700_soc_pad_voltage_set(host); - - host->host_caps = MMC_MODE_HS | MMC_MODE_HS_52MHz | MMC_MODE_DDR_52MHz; -- switch (fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), "bus-width", -- 1)) { -- case 8: -- host->host_caps |= MMC_MODE_8BIT; -- break; -- case 4: -- host->host_caps |= MMC_MODE_4BIT; -- break; -- case 1: -- break; -- default: -- printf("Invalid \"bus-width\" value\n"); -- return -EINVAL; -- } -+ -+ ret = mmc_of_parse(dev, &plat->cfg); -+ if (ret) -+ return ret; - - host->ops = &xenon_sdhci_ops; - diff --git a/package/boot/uboot-mvebu/patches/131-arm64-dts-armada-3720-espressobin-use-Linux-model-co.patch b/package/boot/uboot-mvebu/patches/131-arm64-dts-armada-3720-espressobin-use-Linux-model-co.patch index 1aef9db900..85c61098f8 100644 --- a/package/boot/uboot-mvebu/patches/131-arm64-dts-armada-3720-espressobin-use-Linux-model-co.patch +++ b/package/boot/uboot-mvebu/patches/131-arm64-dts-armada-3720-espressobin-use-Linux-model-co.patch @@ -1,14 +1,16 @@ -From 753947e2c374820dcbc9c86626812aeb7d460653 Mon Sep 17 00:00:00 2001 +From cdcfd9211c805624a702b6ff81b9bd9515344749 Mon Sep 17 00:00:00 2001 From: Andre Heider Date: Fri, 4 Sep 2020 16:34:22 +0200 Subject: [PATCH] arm64: dts: armada-3720-espressobin: use Linux model/compatible strings Fix the actual board vendor and ease synching dts files from Linux. + +Signed-off-by: Andre Heider --- arch/arm/dts/armada-3720-espressobin.dts | 4 ++-- - board/Marvell/mvebu_armada-37xx/board.c | 4 ++-- - 2 files changed, 4 insertions(+), 4 deletions(-) + board/Marvell/mvebu_armada-37xx/board.c | 8 ++++---- + 2 files changed, 6 insertions(+), 6 deletions(-) --- a/arch/arm/dts/armada-3720-espressobin.dts +++ b/arch/arm/dts/armada-3720-espressobin.dts @@ -25,7 +27,24 @@ Fix the actual board vendor and ease synching dts files from Linux. stdout-path = "serial0:115200n8"; --- a/board/Marvell/mvebu_armada-37xx/board.c +++ b/board/Marvell/mvebu_armada-37xx/board.c -@@ -201,7 +201,7 @@ static int mii_multi_chip_mode_write(str +@@ -88,14 +88,14 @@ int board_late_init(void) + if (env_get("fdtfile")) + return 0; + +- if (!of_machine_is_compatible("marvell,armada-3720-espressobin")) ++ if (!of_machine_is_compatible("globalscale,espressobin")) + return 0; + + /* If the memory controller has been configured for DDR4, we're running on v7 */ + ddr4 = ((readl(A3700_CH0_MC_CTRL2_REG) >> A3700_MC_CTRL2_SDRAM_TYPE_OFFS) + & A3700_MC_CTRL2_SDRAM_TYPE_MASK) == A3700_MC_CTRL2_SDRAM_TYPE_DDR4; + +- emmc = of_machine_is_compatible("marvell,armada-3720-espressobin-emmc"); ++ emmc = of_machine_is_compatible("globalscale,espressobin-emmc"); + + if (ddr4 && emmc) + env_set("fdtfile", "marvell/armada-3720-espressobin-v7-emmc.dtb"); +@@ -248,7 +248,7 @@ static int mii_multi_chip_mode_write(str /* Bring-up board-specific network stuff */ int board_network_enable(struct mii_dev *bus) { @@ -34,7 +53,7 @@ Fix the actual board vendor and ease synching dts files from Linux. return 0; /* -@@ -253,7 +253,7 @@ int ft_board_setup(void *blob, struct bd +@@ -300,7 +300,7 @@ int ft_board_setup(void *blob, struct bd int part_off; /* Fill SPI MTD partitions for Linux kernel on Espressobin */ diff --git a/package/boot/uboot-mvebu/patches/132-arm64-dts-armada-3720-espressobin-split-common-parts.patch b/package/boot/uboot-mvebu/patches/132-arm64-dts-armada-3720-espressobin-split-common-parts.patch index d3af221c01..1ca8b8d8dc 100644 --- a/package/boot/uboot-mvebu/patches/132-arm64-dts-armada-3720-espressobin-split-common-parts.patch +++ b/package/boot/uboot-mvebu/patches/132-arm64-dts-armada-3720-espressobin-split-common-parts.patch @@ -1,21 +1,20 @@ -From ee59573dd531df96de0d9dc8e79b34ed3716c864 Mon Sep 17 00:00:00 2001 +From a9ac1dd46a4fd11880be80227e1eb102e3c61dd8 Mon Sep 17 00:00:00 2001 From: Andre Heider Date: Fri, 4 Sep 2020 15:38:58 +0200 -Subject: [PATCH] arm64: dts: armada-3720-espressobin: split common parts to - .dtsi +Subject: [PATCH] arm64: dts: armada-3720-espressobin: split common parts + to .dtsi -Move most of the dts to the new common -arch/arm/dts/armada-3720-espressobin.dtsi file, just like Linux has. +Move most of the dts to the new common armada-3720-espressobin.dtsi +file, just like Linux, but keep the current, downstream based, version. The dts itself is imported from Linux. Signed-off-by: Andre Heider --- - arch/arm/dts/armada-3720-espressobin.dts | 190 ++---------------- - ...sobin.dts => armada-3720-espressobin.dtsi} | 3 - - 2 files changed, 20 insertions(+), 173 deletions(-) - rewrite arch/arm/dts/armada-3720-espressobin.dts (95%) - copy arch/arm/dts/{armada-3720-espressobin.dts => armada-3720-espressobin.dtsi} (96%) + arch/arm/dts/armada-3720-espressobin.dts | 164 +-------------------- + arch/arm/dts/armada-3720-espressobin.dtsi | 167 ++++++++++++++++++++++ + 2 files changed, 174 insertions(+), 157 deletions(-) + create mode 100644 arch/arm/dts/armada-3720-espressobin.dtsi --- a/arch/arm/dts/armada-3720-espressobin.dts +++ b/arch/arm/dts/armada-3720-espressobin.dts diff --git a/package/boot/uboot-mvebu/patches/133-arm64-dts-a3720-add-support-for-boards-with-populate.patch b/package/boot/uboot-mvebu/patches/133-arm64-dts-a3720-add-support-for-boards-with-populate.patch index f35b45d0e1..1e2944b5a2 100644 --- a/package/boot/uboot-mvebu/patches/133-arm64-dts-a3720-add-support-for-boards-with-populate.patch +++ b/package/boot/uboot-mvebu/patches/133-arm64-dts-a3720-add-support-for-boards-with-populate.patch @@ -1,10 +1,12 @@ -From 83908b6e2e5a7d7b0f4d040ffb4bf3ce6807b8fe Mon Sep 17 00:00:00 2001 +From 408bba2fb84ad0b02c3f9529065126b40899e256 Mon Sep 17 00:00:00 2001 From: Andre Heider Date: Fri, 4 Sep 2020 15:44:41 +0200 -Subject: [PATCH] arm64: dts: a3720: add support for boards with populated emmc +Subject: [PATCH] arm64: dts: a3720: add support for espressobin with + populated emmc Import armada-3720-espressobin-emmc.dts from Linux, but use sdhc1 for -emmc, since sdhc0 is used for the sd card. +emmc, since our dtsi is still based on downstream and sdhc0 is used for +the sd card. Signed-off-by: Andre Heider --- diff --git a/package/boot/uboot-mvebu/patches/134-arm-mvebu-Espressobin-Set-environment-variable-fdtfi.patch b/package/boot/uboot-mvebu/patches/134-arm-mvebu-Espressobin-Set-environment-variable-fdtfi.patch deleted file mode 100644 index fd270ddae2..0000000000 --- a/package/boot/uboot-mvebu/patches/134-arm-mvebu-Espressobin-Set-environment-variable-fdtfi.patch +++ /dev/null @@ -1,100 +0,0 @@ -From d59406482c1847959305a986376b35e57da28e69 Mon Sep 17 00:00:00 2001 -From: Andre Heider -Date: Sat, 5 Sep 2020 12:45:59 +0200 -Subject: [PATCH] arm: mvebu: Espressobin: Set environment variable fdtfile - -Required for the generic distro mechanism. - -Linux ships with 4 variants: -marvell/armada-3720-espressobin-v7-emmc.dtb -marvell/armada-3720-espressobin-v7.dtb -marvell/armada-3720-espressobin-emmc.dtb -marvell/armada-3720-espressobin.dtb - -Use available information to determine the appropriate filename. - -Tested on a v5 board without eMMC. - -Signed-off-by: Andre Heider ---- - board/Marvell/mvebu_armada-37xx/board.c | 47 +++++++++++++++++++++ - configs/mvebu_espressobin-88f3720_defconfig | 1 + - 2 files changed, 48 insertions(+) - ---- a/board/Marvell/mvebu_armada-37xx/board.c -+++ b/board/Marvell/mvebu_armada-37xx/board.c -@@ -5,6 +5,7 @@ - - #include - #include -+#include - #include - #include - #include -@@ -50,6 +51,22 @@ DECLARE_GLOBAL_DATA_PTR; - #define MVEBU_G2_SMI_PHY_CMD_REG (24) - #define MVEBU_G2_SMI_PHY_DATA_REG (25) - -+/* -+ * Memory Controller Registers -+ * -+ * Assembled based on public information: -+ * https://gitlab.nic.cz/turris/mox-boot-builder/-/blob/master/wtmi/main.c#L332-336 -+ * https://github.com/MarvellEmbeddedProcessors/mv-ddr-marvell/blob/mv_ddr-armada-18.12/drivers/mv_ddr_mc6.h#L309-L332 -+ * -+ * And checked against the written register values for the various topologies: -+ * https://github.com/MarvellEmbeddedProcessors/mv-ddr-marvell/blob/mv_ddr-armada-atf-mainline/a3700/mv_ddr_tim.h -+ */ -+#define A3700_CH0_MC_CTRL2_REG MVEBU_REGISTER(0x002c4) -+#define A3700_MC_CTRL2_SDRAM_TYPE_MASK 0xf -+#define A3700_MC_CTRL2_SDRAM_TYPE_OFFS 4 -+#define A3700_MC_CTRL2_SDRAM_TYPE_DDR3 2 -+#define A3700_MC_CTRL2_SDRAM_TYPE_DDR4 3 -+ - int board_early_init_f(void) - { - return 0; -@@ -63,6 +80,36 @@ int board_init(void) - return 0; - } - -+#ifdef CONFIG_BOARD_LATE_INIT -+int board_late_init(void) -+{ -+ bool ddr4, emmc; -+ -+ if (env_get("fdtfile")) -+ return 0; -+ -+ if (!of_machine_is_compatible("globalscale,espressobin")) -+ return 0; -+ -+ /* If the memory controller has been configured for DDR4, we're running on v7 */ -+ ddr4 = ((readl(A3700_CH0_MC_CTRL2_REG) >> A3700_MC_CTRL2_SDRAM_TYPE_OFFS) -+ & A3700_MC_CTRL2_SDRAM_TYPE_MASK) == A3700_MC_CTRL2_SDRAM_TYPE_DDR4; -+ -+ emmc = of_machine_is_compatible("globalscale,espressobin-emmc"); -+ -+ if (ddr4 && emmc) -+ env_set("fdtfile", "marvell/armada-3720-espressobin-v7-emmc.dtb"); -+ else if (ddr4) -+ env_set("fdtfile", "marvell/armada-3720-espressobin-v7.dtb"); -+ else if (emmc) -+ env_set("fdtfile", "marvell/armada-3720-espressobin-emmc.dtb"); -+ else -+ env_set("fdtfile", "marvell/armada-3720-espressobin.dtb"); -+ -+ return 0; -+} -+#endif -+ - /* Board specific AHCI / SATA enable code */ - int board_ahci_enable(void) - { ---- a/configs/mvebu_espressobin-88f3720_defconfig -+++ b/configs/mvebu_espressobin-88f3720_defconfig -@@ -84,3 +84,4 @@ CONFIG_USB_ETHER_RTL8152=y - CONFIG_USB_ETHER_SMSC95XX=y - CONFIG_SHA1=y - CONFIG_SHA256=y -+CONFIG_BOARD_LATE_INIT=y diff --git a/package/boot/uboot-sunxi/Makefile b/package/boot/uboot-sunxi/Makefile index ac2f9de888..4363445114 100644 --- a/package/boot/uboot-sunxi/Makefile +++ b/package/boot/uboot-sunxi/Makefile @@ -154,6 +154,12 @@ define U-Boot/nanopi_m1_plus BUILD_DEVICES:=friendlyarm_nanopi-m1-plus endef +define U-Boot/zeropi + BUILD_SUBTARGET:=cortexa7 + NAME:=ZeroPi (H3) + BUILD_DEVICES:=friendlyarm_zeropi +endef + define U-Boot/nanopi_neo_air BUILD_SUBTARGET:=cortexa7 NAME:=U-Boot for NanoPi NEO Air (H3) @@ -299,6 +305,7 @@ UBOOT_TARGETS := \ Linksprite_pcDuino3 \ Lamobo_R1 \ nanopi_m1_plus \ + zeropi \ nanopi_neo \ nanopi_neo_air \ nanopi_neo_plus2 \ diff --git a/package/boot/uboot-sunxi/patches/250-sun8i-h3-zeropi-add-device-tree.patch b/package/boot/uboot-sunxi/patches/250-sun8i-h3-zeropi-add-device-tree.patch new file mode 100644 index 0000000000..4250e4e9db --- /dev/null +++ b/package/boot/uboot-sunxi/patches/250-sun8i-h3-zeropi-add-device-tree.patch @@ -0,0 +1,81 @@ +--- a/arch/arm/dts/Makefile ++++ b/arch/arm/dts/Makefile +@@ -539,7 +539,8 @@ dtb-$(CONFIG_MACH_SUN8I_H3) += \ + sun8i-h3-orangepi-plus.dtb \ + sun8i-h3-orangepi-plus2e.dtb \ + sun8i-h3-orangepi-zero-plus2.dtb \ +- sun8i-h3-rervision-dvk.dtb ++ sun8i-h3-rervision-dvk.dtb \ ++ sun8i-h3-zeropi.dtb + dtb-$(CONFIG_MACH_SUN8I_R40) += \ + sun8i-r40-bananapi-m2-ultra.dtb \ + sun8i-v40-bananapi-m2-berry.dtb +--- /dev/null ++++ b/arch/arm/dts/sun8i-h3-zeropi.dts +@@ -0,0 +1,66 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later OR MIT ++ ++#include "sun8i-h3-nanopi.dtsi" ++ ++/ { ++ model = "FriendlyElec ZeroPi"; ++ compatible = "friendlyarm,zeropi", "allwinner,sun8i-h3"; ++ ++ aliases { ++ ethernet0 = &emac; ++ }; ++ ++ reg_gmac_3v3: gmac-3v3 { ++ compatible = "regulator-fixed"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&gmac_power_pin_nanopi>; ++ regulator-name = "gmac-3v3"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ startup-delay-us = <100000>; ++ enable-active-high; ++ gpio = <&pio 3 6 GPIO_ACTIVE_HIGH>; ++ }; ++}; ++ ++&ehci0 { ++ status = "okay"; ++}; ++ ++&ohci0 { ++ status = "okay"; ++}; ++ ++&pio { ++ gmac_power_pin_nanopi: gmac_power_pin@0 { ++ pins = "PD6"; ++ function = "gpio_out"; ++ }; ++}; ++ ++&external_mdio { ++ ext_rgmii_phy: ethernet-phy@1 { ++ compatible = "ethernet-phy-ieee802.3-c22"; ++ reg = <7>; ++ }; ++}; ++ ++&emac { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&emac_rgmii_pins>; ++ phy-supply = <®_gmac_3v3>; ++ phy-handle = <&ext_rgmii_phy>; ++ phy-mode = "rgmii"; ++ ++ allwinner,leds-active-low; ++ status = "okay"; ++}; ++ ++&usb_otg { ++ status = "okay"; ++ dr_mode = "peripheral"; ++}; ++ ++&usbphy { ++ usb0_id_det-gpios = <&pio 6 12 GPIO_ACTIVE_HIGH>; /* PG12 */ ++}; diff --git a/package/boot/uboot-sunxi/patches/251-sun8i-h3-zeropi-add-defconfig.patch b/package/boot/uboot-sunxi/patches/251-sun8i-h3-zeropi-add-defconfig.patch new file mode 100644 index 0000000000..76e333298e --- /dev/null +++ b/package/boot/uboot-sunxi/patches/251-sun8i-h3-zeropi-add-defconfig.patch @@ -0,0 +1,24 @@ +--- /dev/null ++++ b/configs/zeropi_defconfig +@@ -0,0 +1,21 @@ ++CONFIG_ARM=y ++CONFIG_ARCH_SUNXI=y ++CONFIG_MACH_SUN8I_H3=y ++CONFIG_DRAM_CLK=408 ++CONFIG_DRAM_ZQ=3881979 ++CONFIG_DRAM_ODT_EN=y ++CONFIG_MACPWR="PD6" ++# CONFIG_VIDEO_DE2 is not set ++CONFIG_NR_DRAM_BANKS=1 ++CONFIG_DEFAULT_DEVICE_TREE="sun8i-h3-zeropi" ++# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set ++CONFIG_CONSOLE_MUX=y ++CONFIG_SPL=y ++CONFIG_SYS_CLK_FREQ=480000000 ++# CONFIG_CMD_IMLS is not set ++# CONFIG_CMD_FLASH is not set ++# CONFIG_CMD_FPGA is not set ++CONFIG_SUN8I_EMAC=y ++CONFIG_USB_EHCI_HCD=y ++CONFIG_USB_EHCI_HCD=y ++CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE=y diff --git a/package/devel/perf/Makefile b/package/devel/perf/Makefile index 2258fe0427..6522286736 100644 --- a/package/devel/perf/Makefile +++ b/package/devel/perf/Makefile @@ -10,7 +10,7 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=perf PKG_VERSION:=$(LINUX_VERSION) -PKG_RELEASE:=3 +PKG_RELEASE:=4 PKG_USE_MIPS16:=0 PKG_BUILD_PARALLEL:=1 @@ -22,6 +22,7 @@ PKG_FLAGS:=nonshared PKG_BUILD_DIR:=$(LINUX_DIR)/tools/perf-$(TARGET_DIR_NAME) include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/nls.mk define Package/perf SECTION:=devel @@ -38,6 +39,8 @@ endef HOST_CFLAGS += -I$(LINUX_DIR)/tools/include +TARGET_LDFLAGS += $(INTL_LDFLAGS) + MAKE_FLAGS = \ ARCH="$(LINUX_KARCH)" \ NO_LIBPERL=1 \ @@ -50,11 +53,12 @@ MAKE_FLAGS = \ NO_LIBAUDIT=1 \ NO_LIBCRYPTO=1 \ NO_LIBUNWIND=1 \ + NO_LIBZSTD=1 \ NO_LIBCAP=1 \ CROSS_COMPILE="$(TARGET_CROSS)" \ CC="$(TARGET_CC)" \ LD="$(TARGET_CROSS)ld" \ - CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \ + EXTRA_CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \ LDFLAGS="$(TARGET_LDFLAGS)" \ KBUILD_HOSTCFLAGS="$(HOST_CFLAGS)" \ $(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='') \ diff --git a/package/devel/trace-cmd/Makefile b/package/devel/trace-cmd/Makefile index 25831d8b1b..d1f73ae9bb 100644 --- a/package/devel/trace-cmd/Makefile +++ b/package/devel/trace-cmd/Makefile @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=trace-cmd PKG_VERSION:=v2.6.1 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git/snapshot/ @@ -31,6 +31,7 @@ endef MAKE_FLAGS += \ NO_PYTHON=1 \ + NO_AUDIT=1 \ prefix=/usr PLUGINS_DIR := $(PKG_INSTALL_DIR)/usr/lib/trace-cmd/plugins diff --git a/package/kernel/linux/modules/fs.mk b/package/kernel/linux/modules/fs.mk index cfce929c0c..cabc272282 100644 --- a/package/kernel/linux/modules/fs.mk +++ b/package/kernel/linux/modules/fs.mk @@ -89,7 +89,6 @@ define KernelPackage/fs-cifs TITLE:=CIFS support KCONFIG:= \ CONFIG_CIFS \ - CONFIG_CIFS_XATTR=y \ CONFIG_CIFS_DFS_UPCALL=n \ CONFIG_CIFS_UPCALL=n \ CONFIG_CIFS_SMB311=n @@ -206,13 +205,7 @@ define KernelPackage/fs-f2fs SUBMENU:=$(FS_MENU) TITLE:=F2FS filesystem support DEPENDS:= +kmod-crypto-hash +kmod-crypto-crc32 +!LINUX_4_19:kmod-nls-base - KCONFIG:= \ - CONFIG_F2FS_FS \ - CONFIG_F2FS_STAT_FS=y \ - CONFIG_F2FS_FS_XATTR=y \ - CONFIG_F2FS_FS_POSIX_ACL=n \ - CONFIG_F2FS_FS_SECURITY=n \ - CONFIG_F2FS_CHECK_FS=n + KCONFIG:=CONFIG_F2FS_FS FILES:=$(LINUX_DIR)/fs/f2fs/f2fs.ko AUTOLOAD:=$(call AutoLoad,30,f2fs,1) endef @@ -483,8 +476,7 @@ $(eval $(call KernelPackage,fs-ntfs)) define KernelPackage/fs-reiserfs SUBMENU:=$(FS_MENU) TITLE:=ReiserFS filesystem support - KCONFIG:=CONFIG_REISERFS_FS \ - CONFIG_REISERFS_FS_XATTR=y + KCONFIG:=CONFIG_REISERFS_FS FILES:=$(LINUX_DIR)/fs/reiserfs/reiserfs.ko AUTOLOAD:=$(call AutoLoad,30,reiserfs,1) endef diff --git a/package/kernel/linux/modules/sound.mk b/package/kernel/linux/modules/sound.mk index f975103e50..692ede30ee 100644 --- a/package/kernel/linux/modules/sound.mk +++ b/package/kernel/linux/modules/sound.mk @@ -191,10 +191,10 @@ define KernelPackage/sound-soc-core KCONFIG:= \ CONFIG_SND_SOC \ CONFIG_SND_SOC_ADI=n \ - CONFIG_SND_SOC_DMAENGINE_PCM=y \ + CONFIG_SND_SOC_GENERIC_DMAENGINE_PCM=y \ CONFIG_SND_SOC_ALL_CODECS=n FILES:=$(LINUX_DIR)/sound/soc/snd-soc-core.ko - AUTOLOAD:=$(call AutoLoad,55, snd-soc-core) + AUTOLOAD:=$(call AutoLoad,55,snd-soc-core) $(call AddDepends/sound) endef @@ -254,6 +254,20 @@ endef $(eval $(call KernelPackage,sound-soc-imx-sgtl5000)) +define KernelPackage/sound-soc-spdif + TITLE:=SoC S/PDIF codec support + KCONFIG:=CONFIG_SND_SOC_SPDIF + FILES:= \ + $(LINUX_DIR)/sound/soc/codecs/snd-soc-spdif-tx.ko \ + $(LINUX_DIR)/sound/soc/codecs/snd-soc-spdif-rx.ko + DEPENDS:=+kmod-sound-soc-core + AUTOLOAD:=$(call AutoProbe,snd-soc-spdif-tx snd-soc-spdif-rx) + $(call AddDepends/sound) +endef + +$(eval $(call KernelPackage,sound-soc-spdif)) + + define KernelPackage/pcspkr DEPENDS:=@TARGET_x86 +kmod-input-core TITLE:=PC speaker support diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile index d108d1d123..3614861e83 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:=2020-09-12 -PKG_SOURCE_VERSION:=55a7b6b7f2f773c06a79cb7359ffdab54ba32450 -PKG_MIRROR_HASH:=48625fe7a195053f1eb766eebc055faaf9b0b3e5eb1467080308e758c4ab7419 +PKG_SOURCE_DATE:=2020-10-08 +PKG_SOURCE_VERSION:=64ff909328c095749ef6eaed7302b3e024409d2f +PKG_MIRROR_HASH:=2419944c2e715f1ffaad601ce2a80a6cff279de3912de8262c27183d9c758345 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0 diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile index 6966ebdb89..9ae72e7c28 100644 --- a/package/network/services/hostapd/Makefile +++ b/package/network/services/hostapd/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=hostapd -PKG_RELEASE:=11 +PKG_RELEASE:=12 PKG_SOURCE_URL:=http://w1.fi/hostap.git PKG_SOURCE_PROTO:=git diff --git a/package/network/services/hostapd/src/src/ap/ubus.c b/package/network/services/hostapd/src/src/ap/ubus.c index d816f2c030..5a5dd1a889 100644 --- a/package/network/services/hostapd/src/src/ap/ubus.c +++ b/package/network/services/hostapd/src/src/ap/ubus.c @@ -395,6 +395,7 @@ hostapd_bss_list_bans(struct ubus_context *ctx, struct ubus_object *obj, return 0; } +#ifdef CONFIG_WPS static int hostapd_bss_wps_start(struct ubus_context *ctx, struct ubus_object *obj, struct ubus_request_data *req, const char *method, @@ -411,6 +412,53 @@ hostapd_bss_wps_start(struct ubus_context *ctx, struct ubus_object *obj, return 0; } + +static const char * pbc_status_enum_str(enum pbc_status status) +{ + switch (status) { + case WPS_PBC_STATUS_DISABLE: + return "Disabled"; + case WPS_PBC_STATUS_ACTIVE: + return "Active"; + case WPS_PBC_STATUS_TIMEOUT: + return "Timed-out"; + case WPS_PBC_STATUS_OVERLAP: + return "Overlap"; + default: + return "Unknown"; + } +} + +static int +hostapd_bss_wps_status(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *req, const char *method, + struct blob_attr *msg) +{ + int rc; + struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); + + blob_buf_init(&b, 0); + + blobmsg_add_string(&b, "pbc_status", pbc_status_enum_str(hapd->wps_stats.pbc_status)); + blobmsg_add_string(&b, "last_wps_result", + (hapd->wps_stats.status == WPS_STATUS_SUCCESS ? + "Success": + (hapd->wps_stats.status == WPS_STATUS_FAILURE ? + "Failed" : "None"))); + + /* If status == Failure - Add possible Reasons */ + if(hapd->wps_stats.status == WPS_STATUS_FAILURE && + hapd->wps_stats.failure_reason > 0) + blobmsg_add_string(&b, "reason", wps_ei_str(hapd->wps_stats.failure_reason)); + + if (hapd->wps_stats.status) + blobmsg_printf(&b, "peer_address", MACSTR, MAC2STR(hapd->wps_stats.peer_addr)); + + ubus_send_reply(ctx, req, b.head); + + return 0; +} + static int hostapd_bss_wps_cancel(struct ubus_context *ctx, struct ubus_object *obj, struct ubus_request_data *req, const char *method, @@ -426,6 +474,7 @@ hostapd_bss_wps_cancel(struct ubus_context *ctx, struct ubus_object *obj, return 0; } +#endif /* CONFIG_WPS */ static int hostapd_bss_update_beacon(struct ubus_context *ctx, struct ubus_object *obj, @@ -1100,8 +1149,11 @@ static const struct ubus_method bss_methods[] = { UBUS_METHOD_NOARG("get_clients", hostapd_bss_get_clients), UBUS_METHOD("del_client", hostapd_bss_del_client, del_policy), UBUS_METHOD_NOARG("list_bans", hostapd_bss_list_bans), +#ifdef CONFIG_WPS UBUS_METHOD_NOARG("wps_start", hostapd_bss_wps_start), + UBUS_METHOD_NOARG("wps_status", hostapd_bss_wps_status), UBUS_METHOD_NOARG("wps_cancel", hostapd_bss_wps_cancel), +#endif UBUS_METHOD_NOARG("update_beacon", hostapd_bss_update_beacon), UBUS_METHOD_NOARG("get_features", hostapd_bss_get_features), #ifdef NEED_AP_MLME diff --git a/package/network/services/hostapd/src/src/utils/build_features.h b/package/network/services/hostapd/src/src/utils/build_features.h index 9856756d95..7ca65fa391 100644 --- a/package/network/services/hostapd/src/src/utils/build_features.h +++ b/package/network/services/hostapd/src/src/utils/build_features.h @@ -50,6 +50,10 @@ static inline int has_feature(const char *feat) #ifdef CONFIG_HS20 if (!strcmp(feat, "hs20")) return 1; +#endif +#ifdef CONFIG_WPS + if (!strcmp(feat, "wps")) + return 1; #endif return 0; } diff --git a/package/system/fstools/Makefile b/package/system/fstools/Makefile index dd4ec06bfb..90644532b2 100644 --- a/package/system/fstools/Makefile +++ b/package/system/fstools/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/fstools.git -PKG_MIRROR_HASH:=04cc533f567e8a928a1c13dedcad781e73dfc796db8e83ac1218b47412ce01bd -PKG_SOURCE_DATE:=2020-07-11 -PKG_SOURCE_VERSION:=5345343828df944ae247d91cc77182f87559bc9a +PKG_MIRROR_HASH:=97cfe9528405d9a21c05fa1638780c27a66bfb6f21becfc3f4fdca1420711db8 +PKG_SOURCE_DATE:=2020-10-16 +PKG_SOURCE_VERSION:=f25ab8a8484215e5fc88c952f25db9a06de311f7 CMAKE_INSTALL:=1 PKG_LICENSE:=GPL-2.0 diff --git a/package/system/selinux-policy/Makefile b/package/system/selinux-policy/Makefile index 3b887ff8d6..c2cef3a270 100644 --- a/package/system/selinux-policy/Makefile +++ b/package/system/selinux-policy/Makefile @@ -8,9 +8,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:=selinux-policy PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://git.defensec.nl/selinux-policy.git -PKG_SOURCE_DATE:=2020-10-08 -PKG_SOURCE_VERSION:=cdedea73ecbb8968f9736c35c143b586c8371467 -PKG_MIRROR_HASH:=3d5a6d60b496b51ae272f7cb495a409c724ee193792f78652a2040b57fab56fe +PKG_VERSION:=0.3 +PKG_MIRROR_HASH:=8f224e4e0ecb459648563862e26fcd5d4d113de5daa277363fc4316da5a05360 +PKG_SOURCE_VERSION:=v$(PKG_VERSION) PKG_BUILD_DEPENDS:=secilc/host policycoreutils/host PKG_MAINTAINER:=Dominick Grift diff --git a/package/utils/policycoreutils/Makefile b/package/utils/policycoreutils/Makefile index 6abb64f102..ec55a3d8ee 100644 --- a/package/utils/policycoreutils/Makefile +++ b/package/utils/policycoreutils/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=policycoreutils PKG_VERSION:=3.1 -PKG_RELEASE:=4 +PKG_RELEASE:=5 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/SELinuxProject/selinux/releases/download/20200710 @@ -25,10 +25,6 @@ include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/nls.mk include $(INCLUDE_DIR)/host-build.mk -DIR_SBIN:= \ - restorecon \ - setfiles - DIR_USR_BIN:= \ newrole \ secon @@ -43,7 +39,6 @@ LIBEXEC_UTILS := \ SBIN_UTILS:= \ restorecon_xattr \ - restorecon \ setfiles USR_BIN_UTILS:= \ @@ -76,6 +71,7 @@ HOST_LDFLAGS += -Wl,-rpath=$(STAGING_DIR_HOSTPKG)/lib $(eval $(foreach a,$(DIR_SBIN),ALTS_$(a):=300:/sbin/$(a):/sbin/policycoreutils-$(a)$(newline))) $(eval $(foreach a,$(DIR_USR_BIN),ALTS_$(a):=300:/usr/bin/$(a):/usr/bin/policycoreutils-$(a)$(newline))) $(eval $(foreach a,$(DIR_USR_SBIN),ALTS_$(a):=300:/usr/sbin/$(a):/usr/sbin/policycoreutils-$(a)$(newline))) +ALTS_setfiles:=300:/sbin/restorecon:/sbin/policycoreutils-setfiles 300:/sbin/setfiles:/sbin/policycoreutils-setfiles DEPENDS_genhomedircon:=+libsemanage $(INTL_DEPENDS) DEPENDS_load_policy:=+libselinux $(INTL_DEPENDS) @@ -83,7 +79,6 @@ DEPENDS_newrole:=+libselinux +libaudit +BUSYBOX_CONFIG_PAM:libpam $(INTL_DEPENDS DEPENDS_open_init_pty:=$(INTL_DEPENDS) DEPENDS_pp:=+libsepol $(INTL_DEPENDS) DEPENDS_restorecon_xattr:=+libselinux +libsepol +libaudit $(INTL_DEPENDS) -DEPENDS_restorecon:=+libselinux +libsepol +libaudit $(INTL_DEPENDS) DEPENDS_run_init:=+libselinux +libaudit +BUSYBOX_CONFIG_PAM:libpam $(INTL_DEPENDS) DEPENDS_secon:=+libselinux $(INTL_DEPENDS) DEPENDS_semanage:=+libsemanage diff --git a/scripts/qemustart b/scripts/qemustart index 9ce03901aa..7a2878ea70 100755 --- a/scripts/qemustart +++ b/scripts/qemustart @@ -212,6 +212,7 @@ start_qemu_malta() { local is64 local isel local qemu_exe + local cpu local rootfs="$o_rootfs" local kernel="$o_kernel" local mach="${o_mach:-malta}" @@ -220,6 +221,7 @@ start_qemu_malta() { is64="$(echo $o_subtarget | grep -o 64)" [ "$(echo "$o_subtarget" | grep -o '^..')" = "le" ] && isel="el" qemu_exe="qemu-system-mips$is64$isel" + [ -n "$is64" ] && cpu="MIPS64R2-generic" || cpu="24Kc" [ -n "$kernel" ] || kernel="$o_bindir/openwrt-malta-${o_subtarget%-*}-vmlinux-initramfs.elf" @@ -243,7 +245,7 @@ start_qemu_malta() { ) } - "$qemu_exe" -machine "$mach" -nographic \ + "$qemu_exe" -machine "$mach" -cpu "$cpu" -nographic \ -kernel "$kernel" \ "${o_qemu_extra[@]}" } diff --git a/target/linux/apm821xx/sata/config-default b/target/linux/apm821xx/sata/config-default index daa4646bff..db2c5c8a30 100644 --- a/target/linux/apm821xx/sata/config-default +++ b/target/linux/apm821xx/sata/config-default @@ -15,10 +15,7 @@ CONFIG_GENERIC_PHY=y CONFIG_SATA_DWC=y # CONFIG_SATA_DWC_DEBUG is not set CONFIG_EXT4_FS=y -# CONFIG_F2FS_CHECK_FS is not set CONFIG_F2FS_FS=y -# CONFIG_F2FS_FS_SECURITY is not set -CONFIG_F2FS_STAT_FS=y CONFIG_SCSI=y CONFIG_BLK_DEV_SD=y CONFIG_GPIOLIB=y diff --git a/target/linux/armvirt/config-4.19 b/target/linux/armvirt/config-4.19 index a9a17ecae3..6dbc5aecfd 100644 --- a/target/linux/armvirt/config-4.19 +++ b/target/linux/armvirt/config-4.19 @@ -55,9 +55,7 @@ CONFIG_DEBUG_BUGVERBOSE=y CONFIG_DTC=y CONFIG_EDAC_SUPPORT=y CONFIG_EXT4_FS=y -# CONFIG_F2FS_CHECK_FS is not set CONFIG_F2FS_FS=y -# CONFIG_F2FS_FS_SECURITY is not set CONFIG_FAILOVER=y CONFIG_FIX_EARLYCON_MEM=y CONFIG_FRAME_POINTER=y diff --git a/target/linux/armvirt/config-5.4 b/target/linux/armvirt/config-5.4 index 30ad3d26ea..806de23964 100644 --- a/target/linux/armvirt/config-5.4 +++ b/target/linux/armvirt/config-5.4 @@ -68,9 +68,7 @@ CONFIG_DMA_REMAP=y CONFIG_DTC=y CONFIG_EDAC_SUPPORT=y CONFIG_EXT4_FS=y -# CONFIG_F2FS_CHECK_FS is not set CONFIG_F2FS_FS=y -# CONFIG_F2FS_FS_SECURITY is not set CONFIG_FAILOVER=y CONFIG_FIX_EARLYCON_MEM=y CONFIG_FRAME_POINTER=y diff --git a/target/linux/ath79/dts/ar9344_qxwlan_e750a-v4-16m.dts b/target/linux/ath79/dts/ar9344_qxwlan_e750a-v4-16m.dts new file mode 100644 index 0000000000..61389be127 --- /dev/null +++ b/target/linux/ath79/dts/ar9344_qxwlan_e750a-v4-16m.dts @@ -0,0 +1,49 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "ar9344_qxwlan_e750x.dtsi" + +/ { + model = "Qxwlan E750A v4 16M"; + compatible = "qxwlan,e750a-v4-16m", "qca,ar9344"; +}; + +&leds { + lan { + label = "green:lan"; + gpios = <&gpio 19 GPIO_ACTIVE_LOW>; + }; + + wan { + label = "green:wan"; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + }; +}; + +ð0 { + status = "okay"; + + phy-handle = <&swphy4>; + + mtd-mac-address = <&pridata 0x400>; + mtd-mac-address-increment = <1>; +}; + +ð1 { + status = "okay"; + + mtd-mac-address = <&pridata 0x400>; + + gmac-config { + device = <&gmac>; + switch-phy-swap = <0>; + switch-only-mode = <1>; + }; +}; + +&partitions { + partition@70000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x070000 0xf90000>; + }; +}; diff --git a/target/linux/ath79/dts/ar9344_qxwlan_e750a-v4-8m.dts b/target/linux/ath79/dts/ar9344_qxwlan_e750a-v4-8m.dts new file mode 100644 index 0000000000..e232cdab24 --- /dev/null +++ b/target/linux/ath79/dts/ar9344_qxwlan_e750a-v4-8m.dts @@ -0,0 +1,49 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "ar9344_qxwlan_e750x.dtsi" + +/ { + model = "Qxwlan E750A v4 8M"; + compatible = "qxwlan,e750a-v4-8m", "qca,ar9344"; +}; + +&leds { + lan { + label = "green:lan"; + gpios = <&gpio 19 GPIO_ACTIVE_LOW>; + }; + + wan { + label = "green:wan"; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + }; +}; + +ð0 { + status = "okay"; + + phy-handle = <&swphy4>; + + mtd-mac-address = <&pridata 0x400>; + mtd-mac-address-increment = <1>; +}; + +ð1 { + status = "okay"; + + mtd-mac-address = <&pridata 0x400>; + + gmac-config { + device = <&gmac>; + switch-phy-swap = <0>; + switch-only-mode = <1>; + }; +}; + +&partitions { + partition@70000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x070000 0x790000>; + }; +}; diff --git a/target/linux/ath79/dts/ar9344_qxwlan_e750x.dtsi b/target/linux/ath79/dts/ar9344_qxwlan_e750x.dtsi new file mode 100644 index 0000000000..2cd7b446c6 --- /dev/null +++ b/target/linux/ath79/dts/ar9344_qxwlan_e750x.dtsi @@ -0,0 +1,113 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "ar9344.dtsi" + +#include +#include + +/ { + aliases { + label-mac-device = ð0; + led-boot = &led_system; + led-failsafe = &led_system; + led-running = &led_system; + led-upgrade = &led_system; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + }; + + leds: leds { + compatible = "gpio-leds"; + + led_system: system { + label = "green:system"; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + + sig1 { + label = "green:sig1"; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + }; + + sig2 { + label = "green:sig2"; + gpios = <&gpio 20 GPIO_ACTIVE_LOW>; + }; + + wlan { + label = "green:wlan"; + gpios = <&gpio 21 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +&spi { + status = "okay"; + + num-cs = <1>; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <25000000>; + + partitions: 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>; + read-only; + }; + + pridata: partition@50000 { + label = "pri-data"; + reg = <0x050000 0x010000>; + read-only; + }; + + art: partition@60000 { + label = "art"; + reg = <0x060000 0x010000>; + read-only; + }; + }; + }; +}; + +&ref { + clock-frequency = <40000000>; +}; + +&uart { + status = "okay"; +}; + +&wmac { + status = "okay"; + + mtd-cal-data = <&art 0x1000>; +}; 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 42188d2aa6..f22d78398b 100755 --- a/target/linux/ath79/generic/base-files/etc/board.d/01_leds +++ b/target/linux/ath79/generic/base-files/etc/board.d/01_leds @@ -194,7 +194,9 @@ etactica,eg200) ucidef_set_led_netdev "lan" "LAN" "red:eth0" "eth0" ucidef_set_led_oneshot "modbus" "Modbus" "red:modbus" "100" "33" ;; -glinet,gl-mifi) +glinet,gl-mifi|\ +qxwlan,e750a-v4-8m|\ +qxwlan,e750a-v4-16m) ucidef_set_led_switch "lan" "LAN" "green:lan" "switch0" "0x02" ucidef_set_led_netdev "wan" "WAN" "green:wan" "eth1" ;; diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index dba74ff5d7..2b034eb672 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -1502,6 +1502,27 @@ define Device/qihoo_c301 endef TARGET_DEVICES += qihoo_c301 +define Device/qxwlan_e750a-v4 + SOC := ar9344 + DEVICE_VENDOR := Qxwlan + DEVICE_MODEL := E750A + DEVICE_PACKAGES := kmod-usb2 +endef + +define Device/qxwlan_e750a-v4-16m + $(Device/qxwlan_e750a-v4) + DEVICE_VARIANT := v4 (16M) + IMAGE_SIZE := 15936k +endef +TARGET_DEVICES += qxwlan_e750a-v4-16m + +define Device/qxwlan_e750a-v4-8m + $(Device/qxwlan_e750a-v4) + DEVICE_VARIANT := v4 (8M) + IMAGE_SIZE := 7744k +endef +TARGET_DEVICES += qxwlan_e750a-v4-8m + define Device/rosinson_wr818 SOC := qca9563 DEVICE_VENDOR := Rosinson diff --git a/target/linux/bcm27xx/bcm2708/config-5.4 b/target/linux/bcm27xx/bcm2708/config-5.4 index 3c4dc98eb0..c560ff04ad 100644 --- a/target/linux/bcm27xx/bcm2708/config-5.4 +++ b/target/linux/bcm27xx/bcm2708/config-5.4 @@ -159,7 +159,6 @@ CONFIG_EXT4_FS=y CONFIG_EXT4_FS_POSIX_ACL=y CONFIG_EXT4_FS_SECURITY=y CONFIG_F2FS_FS=y -CONFIG_F2FS_STAT_FS=y CONFIG_FB=y CONFIG_FB_BCM2708=y CONFIG_FB_CFB_COPYAREA=y diff --git a/target/linux/bcm27xx/bcm2709/config-5.4 b/target/linux/bcm27xx/bcm2709/config-5.4 index f76f3aae71..017f3eb0ad 100644 --- a/target/linux/bcm27xx/bcm2709/config-5.4 +++ b/target/linux/bcm27xx/bcm2709/config-5.4 @@ -205,7 +205,6 @@ CONFIG_EXT4_FS=y CONFIG_EXT4_FS_POSIX_ACL=y CONFIG_EXT4_FS_SECURITY=y CONFIG_F2FS_FS=y -CONFIG_F2FS_STAT_FS=y CONFIG_FB=y CONFIG_FB_BCM2708=y CONFIG_FB_CFB_COPYAREA=y diff --git a/target/linux/bcm27xx/bcm2710/config-5.4 b/target/linux/bcm27xx/bcm2710/config-5.4 index 68ef51ca6f..a011e2f213 100644 --- a/target/linux/bcm27xx/bcm2710/config-5.4 +++ b/target/linux/bcm27xx/bcm2710/config-5.4 @@ -248,7 +248,6 @@ CONFIG_EXT4_FS=y CONFIG_EXT4_FS_POSIX_ACL=y CONFIG_EXT4_FS_SECURITY=y CONFIG_F2FS_FS=y -CONFIG_F2FS_STAT_FS=y CONFIG_FB=y CONFIG_FB_BCM2708=y CONFIG_FB_CFB_COPYAREA=y diff --git a/target/linux/bcm27xx/bcm2711/config-5.4 b/target/linux/bcm27xx/bcm2711/config-5.4 index 5561051e97..ee391ff5be 100644 --- a/target/linux/bcm27xx/bcm2711/config-5.4 +++ b/target/linux/bcm27xx/bcm2711/config-5.4 @@ -253,7 +253,6 @@ CONFIG_EXT4_FS=y CONFIG_EXT4_FS_POSIX_ACL=y CONFIG_EXT4_FS_SECURITY=y CONFIG_F2FS_FS=y -CONFIG_F2FS_STAT_FS=y CONFIG_FB=y CONFIG_FB_BCM2708=y CONFIG_FB_CFB_COPYAREA=y diff --git a/target/linux/bcm27xx/patches-5.4/950-0027-mm-Remove-the-PFN-busy-warning.patch b/target/linux/bcm27xx/patches-5.4/950-0027-mm-Remove-the-PFN-busy-warning.patch index 508527359f..b8c9ed0c80 100644 --- a/target/linux/bcm27xx/patches-5.4/950-0027-mm-Remove-the-PFN-busy-warning.patch +++ b/target/linux/bcm27xx/patches-5.4/950-0027-mm-Remove-the-PFN-busy-warning.patch @@ -14,7 +14,7 @@ Signed-off-by: Eric Anholt --- a/mm/page_alloc.c +++ b/mm/page_alloc.c -@@ -8486,8 +8486,6 @@ int alloc_contig_range(unsigned long sta +@@ -8489,8 +8489,6 @@ int alloc_contig_range(unsigned long sta /* Make sure the range is really isolated. */ if (test_pages_isolated(outer_start, end, false)) { diff --git a/target/linux/bcm63xx/base-files/etc/board.d/01_leds b/target/linux/bcm63xx/base-files/etc/board.d/01_leds index cdaf0e77c9..b84009313f 100755 --- a/target/linux/bcm63xx/base-files/etc/board.d/01_leds +++ b/target/linux/bcm63xx/base-files/etc/board.d/01_leds @@ -8,104 +8,91 @@ board_config_update board=$(board_name) -model="${board##*,}" case "$board" in actiontec,r1000h) - ucidef_set_led_usbport "usb" "USB" "R1000H:green:usb" "usb1-port1" "usb2-port1" + ucidef_set_led_usbport "usb" "USB" "green:usb" "usb1-port1" "usb2-port1" ;; -adb,a4001n) - ucidef_set_led_usbdev "usb" "USB" "A4001N:green:usb" "1-1" +adb,a4001n|\ +comtrend,ar-5315u|\ +comtrend,vr-3032u|\ +huawei,hg253s-v2|\ +nucom,r5010un-v2|\ +sagem,fast-2704-v2) + ucidef_set_led_usbdev "usb" "USB" "green:usb" "1-1" ;; adb,a4001n1) - ucidef_set_led_netdev "lan" "LAN" "A4001N1:green:eth" "eth0" - ucidef_set_led_usbdev "usb" "USB" "A4001N1:green:3g" "1-1" + ucidef_set_led_netdev "lan" "LAN" "green:eth" "eth0" + ucidef_set_led_usbdev "usb" "USB" "green:3g" "1-1" ;; adb,pdg-a4001n-a-000-1a1-ax) - ucidef_set_led_netdev "lan" "LAN" "$model:green:internet" "eth0.1" - ucidef_set_led_netdev "wan" "WAN" "$model:green:adsl" "eth0.2" - ucidef_set_led_netdev "wlan0" "WIFI" "$model:green:wifi" "wlan0" - ucidef_set_led_usbdev "usb" "USB" "$model:green:service" "1-1" + ucidef_set_led_netdev "lan" "LAN" "green:internet" "eth0.1" + ucidef_set_led_netdev "wan" "WAN" "green:adsl" "eth0.2" + ucidef_set_led_netdev "wlan0" "WIFI" "green:wifi" "wlan0" + ucidef_set_led_usbdev "usb" "USB" "green:service" "1-1" ;; adb,av4202n) - ucidef_set_led_netdev "wlan0" "WLAN" "AV4202N:blue:wifi" "wlan0" + ucidef_set_led_netdev "wlan0" "WLAN" "blue:wifi" "wlan0" ;; bt,home-hub-2-a) - ucidef_set_led_netdev "lan" "LAN" "HOMEHUB2A:blue:broadband" "eth0.1" - ucidef_set_led_netdev "wlan0" "WIFI" "HOMEHUB2A:green:wireless" "wlan0" - ucidef_set_led_usbdev "usb1" "USB1" "HOMEHUB2A:blue:phone" "1-1" - ucidef_set_led_usbdev "usb2" "USB2" "HOMEHUB2A:green:phone" "2-1" - ;; -comtrend,ar-5315u) - ucidef_set_led_usbdev "usb" "USB" "AR-5315u:green:usb" "1-1" - ;; -comtrend,vr-3032u|\ -huawei,hg253s-v2) - ucidef_set_led_usbdev "usb" "USB" "$model:green:usb" "1-1" + ucidef_set_led_netdev "lan" "LAN" "blue:broadband" "eth0.1" + ucidef_set_led_netdev "wlan0" "WIFI" "green:wireless" "wlan0" + ucidef_set_led_usbdev "usb1" "USB1" "blue:phone" "1-1" + ucidef_set_led_usbdev "usb2" "USB2" "green:phone" "2-1" ;; huawei,echolife-hg553) - ucidef_set_led_netdev "lan" "LAN" "HW553:blue:lan" "eth0" - ucidef_set_led_usbdev "usb1" "USB1" "HW553:red:hspa" "1-1" - ucidef_set_led_usbdev "usb2" "USB2" "HW553:blue:hspa" "1-2" + ucidef_set_led_netdev "lan" "LAN" "blue:lan" "eth0" + ucidef_set_led_usbdev "usb1" "USB1" "red:hspa" "1-1" + ucidef_set_led_usbdev "usb2" "USB2" "blue:hspa" "1-2" ;; huawei,echolife-hg556a-a|\ huawei,echolife-hg556a-b|\ huawei,echolife-hg556a-c) - ucidef_set_led_netdev "lan" "LAN" "HW556:red:dsl" "eth0" - ucidef_set_led_usbdev "usb" "USB" "HW556:red:hspa" "1-2" - ;; -huawei,echolife-hg622) - ucidef_set_led_usbdev "usb" "USB" "HG622:green:usb" "1-2" + ucidef_set_led_netdev "lan" "LAN" "red:dsl" "eth0" + ucidef_set_led_usbdev "usb" "USB" "red:hspa" "1-2" ;; +huawei,echolife-hg622|\ huawei,echolife-hg655b) - ucidef_set_led_usbdev "usb" "USB" "HW65x:green:usb" "1-2" + ucidef_set_led_usbdev "usb" "USB" "green:usb" "1-2" ;; inventel,livebox-1) - ucidef_set_led_netdev "lan" "LAN" "Livebox1:red:traffic" "eth0" - ucidef_set_led_netdev "wan" "WAN" "Livebox1:red:adsl" "eth1" - ucidef_set_led_netdev "wlan0" "WIFI" "Livebox1:red:wifi" "wlan0" + ucidef_set_led_netdev "lan" "LAN" "red:traffic" "eth0" + ucidef_set_led_netdev "wan" "WAN" "red:adsl" "eth1" + ucidef_set_led_netdev "wlan0" "WIFI" "red:wifi" "wlan0" ;; netgear,dgnd3700-v1) - ucidef_set_led_netdev "lan" "LAN" "DGND3700v1_3800B:green:lan" "eth0.1" - ucidef_set_led_netdev "wan" "WAN" "DGND3700v1_3800B:green:inet" "eth0.2" - ucidef_set_led_netdev "wlan0" "WIFI2G" "DGND3700v1_3800B:green:wifi2g" "wlan0" - ucidef_set_led_netdev "wlan1" "WIFI5G" "DGND3700v1_3800B:blue:wifi5g" "wlan1" - ucidef_set_led_usbdev "usb1" "USB1" "DGND3700v1_3800B:green:usb-back" "1-1" - ucidef_set_led_usbdev "usb2" "USB2" "DGND3700v1_3800B:green:usb-front" "1-2" + ucidef_set_led_netdev "lan" "LAN" "green:lan" "eth0.1" + ucidef_set_led_netdev "wan" "WAN" "green:inet" "eth0.2" + ucidef_set_led_netdev "wlan0" "WIFI2G" "green:wifi2g" "wlan0" + ucidef_set_led_netdev "wlan1" "WIFI5G" "blue:wifi5g" "wlan1" + ucidef_set_led_usbdev "usb1" "USB1" "green:usb-back" "1-1" + ucidef_set_led_usbdev "usb2" "USB2" "green:usb-front" "1-2" ;; netgear,dgnd3700-v2) - ucidef_set_led_netdev "lan" "LAN" "$model:green:ethernet" "eth0" - ucidef_set_led_usbdev "usb1" "USB1" "$model:green:usb1" "1-1" - ucidef_set_led_usbdev "usb2" "USB2" "$model:green:usb2" "1-2" + ucidef_set_led_netdev "lan" "LAN" "green:ethernet" "eth0" + ucidef_set_led_usbdev "usb1" "USB1" "green:usb1" "1-1" + ucidef_set_led_usbdev "usb2" "USB2" "green:usb2" "1-2" ;; netgear,evg2000) - ucidef_set_led_netdev "lan" "LAN" "EVG2000:green:lan" "eth0" - ucidef_set_led_netdev "wan" "WAN" "EVG2000:green:wan" "eth1" - ucidef_set_led_netdev "wlan0" "WIFI" "EVG2000:green:wireless" "wlan0" - ucidef_set_led_usbdev "usb1" "USB1" "EVG2000:green:voip1" "1-1" - ucidef_set_led_usbdev "usb2" "USB2" "EVG2000:green:voip2" "1-2" - ;; -nucom,r5010un-v2) - ucidef_set_led_usbdev "usb" "USB" "R5010UNv2:green:usb" "1-1" + ucidef_set_led_netdev "lan" "LAN" "green:lan" "eth0" + ucidef_set_led_netdev "wan" "WAN" "green:wan" "eth1" + ucidef_set_led_netdev "wlan0" "WIFI" "green:wireless" "wlan0" + ucidef_set_led_usbdev "usb1" "USB1" "green:voip1" "1-1" + ucidef_set_led_usbdev "usb2" "USB2" "green:voip2" "1-2" ;; sagem,fast-2704n) - ucidef_set_led_netdev "wan" "WAN" "F@ST2704N:green:inet" "eth0.2" - ;; -sagem,fast-2704-v2) - ucidef_set_led_usbdev "usb" "USB" "F@ST2704V2:green:usb" "1-1" - ;; -sercomm,ad1018) - ucidef_set_led_netdev "wlan0" "WLAN" "$model:green:wifi" "wlan0" + ucidef_set_led_netdev "wan" "WAN" "green:inet" "eth0.2" ;; +sercomm,ad1018|\ sercomm,ad1018-nor) - ucidef_set_led_netdev "wlan0" "WLAN" "AD1018:green:wifi" "wlan0" + ucidef_set_led_netdev "wlan0" "WLAN" "green:wifi" "wlan0" ;; sercomm,h500-s-lowi|\ sercomm,h500-s-vfes) - ucidef_set_led_netdev "wan" "WAN" "h500-s:green:internet" "eth0.2" + ucidef_set_led_netdev "wan" "WAN" "green:internet" "eth0.2" ;; telsey,cpva502plus) - ucidef_set_led_netdev "lan" "LAN" "CPVA502+:amber:link" "eth0" + ucidef_set_led_netdev "lan" "LAN" "amber:link" "eth0" ;; esac diff --git a/target/linux/bcm63xx/base-files/etc/uci-defaults/04_led_migration b/target/linux/bcm63xx/base-files/etc/uci-defaults/04_led_migration new file mode 100644 index 0000000000..33ec4d51f9 --- /dev/null +++ b/target/linux/bcm63xx/base-files/etc/uci-defaults/04_led_migration @@ -0,0 +1,21 @@ +. /lib/functions/migrations.sh + +board=$(board_name) + +case "$board" in +brcm,bcm96318ref-p300|\ +brcm,bcm963281tan|\ +brcm,bcm96328avng|\ +d-link,dsl-2640b-b|\ +d-link,dva-g3810bn-tl|\ +netgear,dg834g-v4|\ +usrobotics,usr9108) + migrate_leds "^.*::=" + ;; +esac + +remove_devicename_leds + +migrations_apply system + +exit 0 diff --git a/target/linux/bcm63xx/dts/bcm3368-netgear-cvg834g.dts b/target/linux/bcm63xx/dts/bcm3368-netgear-cvg834g.dts index c0ec8d70c7..fb22f769d6 100644 --- a/target/linux/bcm63xx/dts/bcm3368-netgear-cvg834g.dts +++ b/target/linux/bcm63xx/dts/bcm3368-netgear-cvg834g.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm3368.dtsi" #include @@ -24,7 +22,7 @@ compatible = "gpio-leds"; led_power_green: power_green { - label = "CVG834G:green:power"; + label = "green:power"; gpios = <&gpio1 5 0>; default-state = "on"; }; diff --git a/target/linux/bcm63xx/dts/bcm3368.dtsi b/target/linux/bcm63xx/dts/bcm3368.dtsi index 66cb6ab8a8..7c392227e2 100644 --- a/target/linux/bcm63xx/dts/bcm3368.dtsi +++ b/target/linux/bcm63xx/dts/bcm3368.dtsi @@ -1,3 +1,5 @@ +/dts-v1/; + / { #address-cells = <1>; #size-cells = <1>; diff --git a/target/linux/bcm63xx/dts/bcm63167-sercomm-h500-s-lowi.dts b/target/linux/bcm63xx/dts/bcm63167-sercomm-h500-s-lowi.dts index 44662a26db..90aa9e1c15 100644 --- a/target/linux/bcm63xx/dts/bcm63167-sercomm-h500-s-lowi.dts +++ b/target/linux/bcm63xx/dts/bcm63167-sercomm-h500-s-lowi.dts @@ -4,8 +4,6 @@ * * Copyright (C) 2020 Daniel González Cabanelas */ - -/dts-v1/; #include "bcm63167-sercomm-h500-s.dtsi" diff --git a/target/linux/bcm63xx/dts/bcm63167-sercomm-h500-s-vfes.dts b/target/linux/bcm63xx/dts/bcm63167-sercomm-h500-s-vfes.dts index 32d8fdbe7e..bd69ccd316 100644 --- a/target/linux/bcm63xx/dts/bcm63167-sercomm-h500-s-vfes.dts +++ b/target/linux/bcm63xx/dts/bcm63167-sercomm-h500-s-vfes.dts @@ -5,8 +5,6 @@ * Copyright (C) 2020 Daniel González Cabanelas */ -/dts-v1/; - #include "bcm63167-sercomm-h500-s.dtsi" / { diff --git a/target/linux/bcm63xx/dts/bcm63167-sercomm-h500-s.dtsi b/target/linux/bcm63xx/dts/bcm63167-sercomm-h500-s.dtsi index 39b2e63eba..0766500734 100644 --- a/target/linux/bcm63xx/dts/bcm63167-sercomm-h500-s.dtsi +++ b/target/linux/bcm63xx/dts/bcm63167-sercomm-h500-s.dtsi @@ -52,58 +52,58 @@ mobile_red { reg = <0>; - label = "h500-s:red:mobile"; + label = "red:mobile"; }; mobile_green { reg = <1>; - label = "h500-s:green:mobile"; + label = "green:mobile"; }; led_power_red: power_red { reg = <8>; - label = "h500-s:red:power"; + label = "red:power"; }; wifi_green { reg = <9>; - label = "h500-s:green:wifi"; + label = "green:wifi"; }; phone_red { reg = <12>; - label = "h500-s:red:phone"; + label = "red:phone"; }; wifi_red { reg = <13>; - label = "h500-s:red:wifi"; + label = "red:wifi"; }; internet_red { reg = <14>; - label = "h500-s:red:internet"; + label = "red:internet"; }; internet_green { reg = <15>; - label = "h500-s:green:internet"; + label = "green:internet"; }; phone_green { reg = <16>; - label = "h500-s:green:phone"; + label = "green:phone"; }; led_power_green: power_green { reg = <17>; - label = "h500-s:green:power"; + label = "green:power"; default-state = "on"; }; mobile_blue { reg = <23>; - label = "h500-s:blue:mobile"; + label = "blue:mobile"; }; }; diff --git a/target/linux/bcm63xx/dts/bcm63168-comtrend-vr-3032u.dts b/target/linux/bcm63xx/dts/bcm63168-comtrend-vr-3032u.dts index 30a7757018..c2505f86ba 100644 --- a/target/linux/bcm63xx/dts/bcm63168-comtrend-vr-3032u.dts +++ b/target/linux/bcm63xx/dts/bcm63168-comtrend-vr-3032u.dts @@ -1,7 +1,5 @@ // SPDX-License-Identifier: GPL-2.0-or-later -/dts-v1/; - #include "bcm63268.dtsi" #include @@ -70,31 +68,31 @@ led@2 { reg = <2>; active-low; - label = "vr-3032u:red:inet"; + label = "red:inet"; }; led@3 { reg = <3>; active-low; - label = "vr-3032u:green:dsl"; + label = "green:dsl"; }; led@4 { reg = <4>; active-low; - label = "vr-3032u:green:usb"; + label = "green:usb"; }; led@7 { reg = <7>; active-low; - label = "vr-3032u:green:wps"; + label = "green:wps"; }; led@8 { reg = <8>; active-low; - label = "vr-3032u:green:inet"; + label = "green:inet"; }; led@9 { @@ -142,7 +140,7 @@ led_power_green: led@20 { reg = <20>; active-low; - label = "vr-3032u:green:power"; + label = "green:power"; default-state = "on"; }; }; diff --git a/target/linux/bcm63xx/dts/bcm63168-sky-sr102.dts b/target/linux/bcm63xx/dts/bcm63168-sky-sr102.dts index 466bfcd096..47ba15608e 100644 --- a/target/linux/bcm63xx/dts/bcm63168-sky-sr102.dts +++ b/target/linux/bcm63xx/dts/bcm63168-sky-sr102.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm63268.dtsi" #include @@ -38,64 +36,64 @@ compatible = "gpio-leds"; lan1_green { - label = "SR102:green:lan1"; + label = "green:lan1"; gpios = <&pinctrl 1 1>; }; power_red { - label = "SR102:red:power"; + label = "red:power"; gpios = <&pinctrl 2 1>; }; wifi_red { - label = "SR102:red:wifi"; + label = "red:wifi"; gpios = <&pinctrl 3 1>; }; inet_red { - label = "SR102:red:inet"; + label = "red:inet"; gpios = <&pinctrl 4 1>; }; inet_white { - label = "SR102:white:inet"; + label = "white:inet"; gpios = <&pinctrl 5 0>; }; led_power_white: power_white { - label = "SR102:white:power"; + label = "white:power"; gpios = <&pinctrl 6 0>; default-state = "on"; }; wifi_white { - label = "SR102:white:wifi"; + label = "white:wifi"; gpios = <&pinctrl 8 0>; }; lan2_red { - label = "SR102:red:lan2"; + label = "red:lan2"; gpios = <&pinctrl 9 1>; }; lan3_red { - label = "SR102:red:lan3"; + label = "red:lan3"; gpios = <&pinctrl 10 1>; }; lan4_red { - label = "SR102:red:lan4"; + label = "red:lan4"; gpios = <&pinctrl 11 1>; }; lan1_red { - label = "SR102:red:lan1"; + label = "red:lan1"; gpios = <&pinctrl 12 1>; }; lan2_green { - label = "SR102:green:lan2"; + label = "green:lan2"; gpios = <&pinctrl 13 0>; }; lan3_green { - label = "SR102:green:lan3"; + label = "green:lan3"; gpios = <&pinctrl 14 1>; }; lan4_green { - label = "SR102:green:lan4"; + label = "green:lan4"; gpios = <&pinctrl 15 1>; }; hd_white { - label = "SR102:white:hd"; + label = "white:hd"; gpios = <&pinctrl 18 0>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm63169-comtrend-vg-8050.dts b/target/linux/bcm63xx/dts/bcm63169-comtrend-vg-8050.dts index fb0c37296f..5d5ba46e3c 100644 --- a/target/linux/bcm63xx/dts/bcm63169-comtrend-vg-8050.dts +++ b/target/linux/bcm63xx/dts/bcm63169-comtrend-vg-8050.dts @@ -1,7 +1,5 @@ // SPDX-License-Identifier: GPL-2.0-or-later -/dts-v1/; - #include "bcm63268.dtsi" #include @@ -56,50 +54,50 @@ led@2 { reg = <2>; active-low; - label = "vg-8050:red:internet"; + label = "red:internet"; }; led@3 { reg = <3>; active-low; - label = "vg-8050:red:power"; + label = "red:power"; }; led_power_green: led@6 { reg = <6>; active-low; - label = "vg-8050:green:power"; + label = "green:power"; default-state = "on"; }; led@7 { reg = <7>; active-low; - label = "vg-8050:green:wps"; + label = "green:wps"; }; led@8 { reg = <8>; active-low; - label = "vg-8050:green:internet"; + label = "green:internet"; }; led@10 { reg = <10>; active-low; - label = "vg-8050:green:voip"; + label = "green:voip"; }; led@12 { reg = <12>; active-low; - label = "vg-8050:red:voip"; + label = "red:voip"; }; led@14 { reg = <14>; active-low; - label = "vg-8050:red:wps"; + label = "red:wps"; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6318-brcm-bcm96318ref-p300.dts b/target/linux/bcm63xx/dts/bcm6318-brcm-bcm96318ref-p300.dts index 92db7c83ad..c6700bdd11 100644 --- a/target/linux/bcm63xx/dts/bcm6318-brcm-bcm96318ref-p300.dts +++ b/target/linux/bcm63xx/dts/bcm6318-brcm-bcm96318ref-p300.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6318.dtsi" #include @@ -38,22 +36,22 @@ compatible = "gpio-leds"; inet { - label = "96318REF_P300:green:inet"; + label = "green:inet"; gpios = <&pinctrl 8 1>; }; inet_fail { - label = "96318REF_P300:red:inet-fail"; + label = "red:inet-fail"; gpios = <&pinctrl 9 1>; }; post_failed { - label = "96318REF_P300:red:post-failed"; + label = "red:post-failed"; gpios = <&pinctrl 11 1>; }; usb_pwron { - label = "96318REF_P300::usb-pwron"; + label = "usb-pwron"; gpios = <&pinctrl 13 1>; default-state = "on"; }; diff --git a/target/linux/bcm63xx/dts/bcm6318-brcm-bcm96318ref.dts b/target/linux/bcm63xx/dts/bcm6318-brcm-bcm96318ref.dts index 4884760abb..89649fa739 100644 --- a/target/linux/bcm63xx/dts/bcm6318-brcm-bcm96318ref.dts +++ b/target/linux/bcm63xx/dts/bcm6318-brcm-bcm96318ref.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6318.dtsi" #include @@ -38,17 +36,17 @@ compatible = "gpio-leds"; inet { - label = "96318REF:green:inet"; + label = "green:inet"; gpios = <&pinctrl 8 1>; }; inet_fail { - label = "96318REF:red:inet-fail"; + label = "red:inet-fail"; gpios = <&pinctrl 9 1>; }; post_failed { - label = "96318REF:red:post-failed"; + label = "red:post-failed"; gpios = <&pinctrl 11 1>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6318-comtrend-ar-5315u.dts b/target/linux/bcm63xx/dts/bcm6318-comtrend-ar-5315u.dts index be10274625..8557730c8c 100644 --- a/target/linux/bcm63xx/dts/bcm6318-comtrend-ar-5315u.dts +++ b/target/linux/bcm63xx/dts/bcm6318-comtrend-ar-5315u.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6318.dtsi" #include @@ -91,20 +89,20 @@ led@0 { reg = <0>; active-low; - label = "AR-5315u:green:wps"; + label = "green:wps"; }; led_power_green: led@1 { reg = <1>; active-low; - label = "AR-5315u:green:power"; + label = "green:power"; default-state = "on"; }; led@2 { reg = <2>; active-low; - label = "AR-5315u:green:usb"; + label = "green:usb"; }; led@4 { @@ -138,25 +136,25 @@ led@8 { reg = <8>; active-low; - label = "AR-5315u:green:inet"; + label = "green:inet"; }; led@9 { reg = <9>; active-low; - label = "AR-5315u:red:inet"; + label = "red:inet"; }; led@10 { reg = <10>; active-low; - label = "AR-5315u:green:dsl"; + label = "green:dsl"; }; led@11 { reg = <11>; active-low; - label = "AR-5315u:red:power"; + label = "red:power"; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6318-d-link-dsl-275xb-d1.dts b/target/linux/bcm63xx/dts/bcm6318-d-link-dsl-275xb-d1.dts index f5084829cf..acf4332a66 100644 --- a/target/linux/bcm63xx/dts/bcm6318-d-link-dsl-275xb-d1.dts +++ b/target/linux/bcm63xx/dts/bcm6318-d-link-dsl-275xb-d1.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6318.dtsi" #include @@ -52,39 +50,39 @@ compatible = "gpio-leds"; led_power_green: power_green { - label = "dsl-275xb:green:power"; + label = "green:power"; gpios = <&pinctrl 3 1>; default-state = "on"; }; inet_green { - label = "dsl-275xb:green:inet"; + label = "green:inet"; gpios = <&pinctrl 8 1>; }; inet_red { - label = "dsl-275xb:red:inet-fail"; + label = "red:inet-fail"; gpios = <&pinctrl 9 1>; }; power_red { - label = "dsl-275xb:red:post-failed"; + label = "red:post-failed"; gpios = <&pinctrl 11 1>; }; wps_blue { - label = "dsl-275xb:blue:wps"; + label = "blue:wps"; gpios = <&pinctrl 16 1>; }; dsl_green { - label = "dsl-275xb:green:dsl"; + label = "green:dsl"; gpios = <&pinctrl 17 1>; }; usb_green { /* not user controllable? */ - label = "dsl-275xb:green:usb"; + label = "green:usb"; gpios = <&pinctrl 49 1>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6318-sagem-fast-2704n.dts b/target/linux/bcm63xx/dts/bcm6318-sagem-fast-2704n.dts index c828531dce..6702ef1656 100644 --- a/target/linux/bcm63xx/dts/bcm6318-sagem-fast-2704n.dts +++ b/target/linux/bcm63xx/dts/bcm6318-sagem-fast-2704n.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6318.dtsi" #include @@ -52,48 +50,48 @@ compatible = "gpio-leds"; wps_green { - label = "F@ST2704N:green:wps"; + label = "green:wps"; gpios = <&pinctrl 2 1>; }; lan1_green { - label = "F@ST2704N:green:lan1"; + label = "green:lan1"; gpios = <&pinctrl 4 1>; }; lan2_green { - label = "F@ST2704N:green:lan2"; + label = "green:lan2"; gpios = <&pinctrl 5 1>; }; lan3_green { - label = "F@ST2704N:green:lan3"; + label = "green:lan3"; gpios = <&pinctrl 6 1>; }; lan4_green { - label = "F@ST2704N:green:lan4"; + label = "green:lan4"; gpios = <&pinctrl 7 1>; }; inet_green { - label = "F@ST2704N:green:inet"; + label = "green:inet"; gpios = <&pinctrl 8 1>; }; inet_red { - label = "F@ST2704N:red:inet"; + label = "red:inet"; gpios = <&pinctrl 9 1>; }; dsl_green { - label = "F@ST2704N:green:dsl"; + label = "green:dsl"; gpios = <&pinctrl 10 1>; }; led_power_red: power_red { - label = "F@ST2704N:red:power"; + label = "red:power"; gpios = <&pinctrl 11 1>; }; power_green { - label = "F@ST2704N:green:power"; + label = "green:power"; gpios = <&pinctrl 47 1>; default-state = "on"; }; usb_green { - label = "F@ST2704N:green:usb"; + label = "green:usb"; gpios = <&pinctrl 49 1>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6318.dtsi b/target/linux/bcm63xx/dts/bcm6318.dtsi index a902c1bd57..ee7db04fe9 100644 --- a/target/linux/bcm63xx/dts/bcm6318.dtsi +++ b/target/linux/bcm63xx/dts/bcm6318.dtsi @@ -1,3 +1,5 @@ +/dts-v1/; + / { #address-cells = <1>; #size-cells = <1>; diff --git a/target/linux/bcm63xx/dts/bcm63268-brcm-bcm963268bu-p300.dts b/target/linux/bcm63xx/dts/bcm63268-brcm-bcm963268bu-p300.dts index 2e3a1afa5a..08959ed156 100644 --- a/target/linux/bcm63xx/dts/bcm63268-brcm-bcm963268bu-p300.dts +++ b/target/linux/bcm63xx/dts/bcm63268-brcm-bcm963268bu-p300.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm63268.dtsi" #include diff --git a/target/linux/bcm63xx/dts/bcm63268-inteno-vg50.dts b/target/linux/bcm63xx/dts/bcm63268-inteno-vg50.dts index 80d5727bc2..fa9856f337 100644 --- a/target/linux/bcm63xx/dts/bcm63268-inteno-vg50.dts +++ b/target/linux/bcm63xx/dts/bcm63268-inteno-vg50.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm63268.dtsi" #include diff --git a/target/linux/bcm63xx/dts/bcm63268.dtsi b/target/linux/bcm63xx/dts/bcm63268.dtsi index 0c08aead20..2c8f28d4b7 100644 --- a/target/linux/bcm63xx/dts/bcm63268.dtsi +++ b/target/linux/bcm63xx/dts/bcm63268.dtsi @@ -1,3 +1,5 @@ +/dts-v1/; + / { #address-cells = <1>; #size-cells = <1>; diff --git a/target/linux/bcm63xx/dts/bcm63269-brcm-bcm963269bhr.dts b/target/linux/bcm63xx/dts/bcm63269-brcm-bcm963269bhr.dts index e3135151c7..186c208a1f 100644 --- a/target/linux/bcm63xx/dts/bcm63269-brcm-bcm963269bhr.dts +++ b/target/linux/bcm63xx/dts/bcm63269-brcm-bcm963269bhr.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm63268.dtsi" #include @@ -31,12 +29,12 @@ compatible = "gpio-leds"; usb1 { - label = "963269BHR:green:usb1"; + label = "green:usb1"; gpios = <&pinctrl 9 1>; }; usb2 { - label = "963269BHR:green:usb2"; + label = "green:usb2"; gpios = <&pinctrl 10 1>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6328-adb-a4001n.dts b/target/linux/bcm63xx/dts/bcm6328-adb-a4001n.dts index ef3dd43732..641de68d35 100644 --- a/target/linux/bcm63xx/dts/bcm6328-adb-a4001n.dts +++ b/target/linux/bcm63xx/dts/bcm6328-adb-a4001n.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6328.dtsi" #include @@ -45,24 +43,24 @@ compatible = "gpio-leds"; inet_red { - label = "A4001N:red:inet"; + label = "red:inet"; gpios = <&pinctrl 1 0>; }; power_red { - label = "A4001N:red:power"; + label = "red:power"; gpios = <&pinctrl 4 0>; }; led_power_green: power_green { - label = "A4001N:green:power"; + label = "green:power"; gpios = <&pinctrl 8 0>; default-state = "on"; }; usb_green { - label = "A4001N:green:usb"; + label = "green:usb"; gpios = <&pinctrl 10 1>; }; dsl_green { - label = "A4001N:green:dsl"; + label = "green:dsl"; gpios = <&pinctrl 11 1>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6328-adb-a4001n1.dts b/target/linux/bcm63xx/dts/bcm6328-adb-a4001n1.dts index 10bbda87cb..bd05547bae 100644 --- a/target/linux/bcm63xx/dts/bcm6328-adb-a4001n1.dts +++ b/target/linux/bcm63xx/dts/bcm6328-adb-a4001n1.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6328.dtsi" #include @@ -45,52 +43,52 @@ compatible = "gpio-leds"; inet_red { - label = "A4001N1:red:inet"; + label = "red:inet"; gpios = <&pinctrl 2 1>; }; ppp_green { - label = "A4001N1:green:ppp"; + label = "green:ppp"; gpios = <&pinctrl 3 1>; }; led_power_green: power_green { - label = "A4001N1:green:power"; + label = "green:power"; gpios = <&pinctrl 4 1>; default-state = "on"; }; ppp_red { - label = "A4001N1:red:ppp"; + label = "red:ppp"; gpios = <&pinctrl 5 1>; }; usb_green { - label = "A4001N1:green:3g"; + label = "green:3g"; gpios = <&pinctrl 6 1>; }; usb_red { - label = "A4001N1:red:3g"; + label = "red:3g"; gpios = <&pinctrl 7 1>; }; power_red { - label = "A4001N1:red:power"; + label = "red:power"; gpios = <&pinctrl 8 1>; }; wlan_green { - label = "A4001N1:green:wlan"; + label = "green:wlan"; gpios = <&pinctrl 9 1>; }; wlan_red { - label = "A4001N1:red:wlan"; + label = "red:wlan"; gpios = <&pinctrl 10 1>; }; inet_green { - label = "A4001N1:green:inet"; + label = "green:inet"; gpios = <&pinctrl 11 1>; }; eth_red { - label = "A4001N1:red:eth"; + label = "red:eth"; gpios = <&pinctrl 20 1>; }; eth_green { - label = "A4001N1:green:eth"; + label = "green:eth"; gpios = <&pinctrl 31 1>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6328-adb-pdg-a4001n-a-000-1a1-ax.dts b/target/linux/bcm63xx/dts/bcm6328-adb-pdg-a4001n-a-000-1a1-ax.dts index 8a6a8b58a2..7b8c03f890 100644 --- a/target/linux/bcm63xx/dts/bcm6328-adb-pdg-a4001n-a-000-1a1-ax.dts +++ b/target/linux/bcm63xx/dts/bcm6328-adb-pdg-a4001n-a-000-1a1-ax.dts @@ -1,7 +1,5 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/dts-v1/; - #include "bcm6328.dtsi" #include @@ -53,61 +51,61 @@ led@2 { reg = <2>; active-low; - label = "pdg-a4001n-a-000-1a1-ax:red:internet"; + label = "red:internet"; }; led@3 { reg = <3>; active-low; - label = "pdg-a4001n-a-000-1a1-ax:green:adsl"; + label = "green:adsl"; }; led@5 { reg = <5>; active-low; - label = "pdg-a4001n-a-000-1a1-ax:red:adsl"; + label = "red:adsl"; }; led@6 { reg = <6>; active-low; - label = "pdg-a4001n-a-000-1a1-ax:green:service"; + label = "green:service"; }; led@7 { reg = <7>; active-low; - label = "pdg-a4001n-a-000-1a1-ax:red:service"; + label = "red:service"; }; led@8 { reg = <8>; active-low; - label = "pdg-a4001n-a-000-1a1-ax:red:power"; + label = "red:power"; }; led@9 { reg = <9>; active-low; - label = "pdg-a4001n-a-000-1a1-ax:green:wifi"; + label = "green:wifi"; }; led@10 { reg = <10>; active-low; - label = "pdg-a4001n-a-000-1a1-ax:red:wifi"; + label = "red:wifi"; }; led@11 { reg = <11>; active-low; - label = "pdg-a4001n-a-000-1a1-ax:green:internet"; + label = "green:internet"; }; led_power_green: led@12 { reg = <12>; active-low; - label = "pdg-a4001n-a-000-1a1-ax:green:power"; + label = "green:power"; default-state = "on"; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6328-brcm-bcm963281tan.dts b/target/linux/bcm63xx/dts/bcm6328-brcm-bcm963281tan.dts index fbf8e7cd47..0d494baeb7 100644 --- a/target/linux/bcm63xx/dts/bcm6328-brcm-bcm963281tan.dts +++ b/target/linux/bcm63xx/dts/bcm6328-brcm-bcm963281tan.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6328.dtsi" #include @@ -24,28 +22,28 @@ compatible = "gpio-leds"; inet { - label = "963281TAN::internet"; + label = "internet"; gpios = <&pinctrl 1 1>; }; led_power: power { - label = "963281TAN::power"; + label = "power"; gpios = <&pinctrl 4 1>; default-state = "on"; }; inet_fail { - label = "963281TAN::internet-fail"; + label = "internet-fail"; gpios = <&pinctrl 7 1>; }; power_fail { - label = "963281TAN::power-fail"; + label = "power-fail"; gpios = <&pinctrl 8 1>; }; wps { - label = "963281TAN::wps"; + label = "wps"; gpios = <&pinctrl 9 1>; }; dsl { - label = "963281TAN::dsl"; + label = "dsl"; gpios = <&pinctrl 11 1>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6328-brcm-bcm96328avng.dts b/target/linux/bcm63xx/dts/bcm6328-brcm-bcm96328avng.dts index 9bec24539b..d047e3fa89 100644 --- a/target/linux/bcm63xx/dts/bcm6328-brcm-bcm96328avng.dts +++ b/target/linux/bcm63xx/dts/bcm6328-brcm-bcm96328avng.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6328.dtsi" #include @@ -24,28 +22,28 @@ compatible = "gpio-leds"; inet_fail { - label = "96328avng::internet-fail"; + label = "internet-fail"; gpios = <&pinctrl 2 1>; }; dsl { - label = "96328avng::dsl"; + label = "dsl"; gpios = <&pinctrl 3 1>; }; led_power: power { - label = "96328avng::power"; + label = "power"; gpios = <&pinctrl 4 1>; default-state = "on"; }; power_fail { - label = "96328avng::power-fail"; + label = "power-fail"; gpios = <&pinctrl 8 1>; }; wps { - label = "96328avng::wps"; + label = "wps"; gpios = <&pinctrl 9 1>; }; inet { - label = "96328avng::internet"; + label = "internet"; gpios = <&pinctrl 11 1>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6328-comtrend-ar-5381u.dts b/target/linux/bcm63xx/dts/bcm6328-comtrend-ar-5381u.dts index ce57ee6413..5878e886d2 100644 --- a/target/linux/bcm63xx/dts/bcm6328-comtrend-ar-5381u.dts +++ b/target/linux/bcm63xx/dts/bcm6328-comtrend-ar-5381u.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6328.dtsi" #include @@ -82,19 +80,19 @@ led_alarm_red: led@2 { reg = <2>; active-low; - label = "AR-5381u:red:alarm"; + label = "red:alarm"; }; led@3 { reg = <3>; active-low; - label = "AR-5381u:green:inet"; + label = "green:inet"; }; led_power_green: led@4 { reg = <4>; active-low; - label = "AR-5381u:green:power"; + label = "green:power"; default-state = "on"; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6328-comtrend-ar-5387un.dts b/target/linux/bcm63xx/dts/bcm6328-comtrend-ar-5387un.dts index 76c9dd8ba4..a703fd6629 100644 --- a/target/linux/bcm63xx/dts/bcm6328-comtrend-ar-5387un.dts +++ b/target/linux/bcm63xx/dts/bcm6328-comtrend-ar-5387un.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6328.dtsi" #include @@ -81,29 +79,29 @@ led@1 { reg = <1>; - label = "AR-5387un:red:inet"; + label = "red:inet"; }; led@4 { reg = <4>; - label = "AR-5387un:red:power"; + label = "red:power"; }; led@7 { reg = <7>; - label = "AR-5387un:green:inet"; + label = "green:inet"; }; led_power_green: led@8 { reg = <8>; - label = "AR-5387un:green:power"; + label = "green:power"; default-state = "on"; }; led@11 { reg = <11>; active-low; - label = "AR-5387un:green:dsl"; + label = "green:dsl"; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6328-d-link-dsl-274xb-f1.dts b/target/linux/bcm63xx/dts/bcm6328-d-link-dsl-274xb-f1.dts index ef8e5eb27e..660a4d570c 100644 --- a/target/linux/bcm63xx/dts/bcm6328-d-link-dsl-274xb-f1.dts +++ b/target/linux/bcm63xx/dts/bcm6328-d-link-dsl-274xb-f1.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6328.dtsi" #include @@ -52,28 +50,28 @@ compatible = "gpio-leds"; inet_red { - label = "dsl-274xb:red:internet"; + label = "red:internet"; gpios = <&pinctrl 2 1>; }; dsl_green { - label = "dsl-274xb:green:dsl"; + label = "green:dsl"; gpios = <&pinctrl 3 1>; }; led_power_green: power_green { - label = "dsl-274xb:green:power"; + label = "green:power"; gpios = <&pinctrl 4 1>; default-state = "on"; }; power_red { - label = "dsl-274xb:red:power"; + label = "red:power"; gpios = <&pinctrl 8 1>; }; wps_blue { - label = "dsl-274xb:blue:wps"; + label = "blue:wps"; gpios = <&pinctrl 9 1>; }; inet_green { - label = "dsl-274xb:green:internet"; + label = "green:internet"; gpios = <&pinctrl 11 1>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6328-nucom-r5010un-v2.dts b/target/linux/bcm63xx/dts/bcm6328-nucom-r5010un-v2.dts index 365a4552f2..08f3736a7b 100644 --- a/target/linux/bcm63xx/dts/bcm6328-nucom-r5010un-v2.dts +++ b/target/linux/bcm63xx/dts/bcm6328-nucom-r5010un-v2.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6328.dtsi" #include @@ -45,32 +43,32 @@ compatible = "gpio-leds"; inet_green { - label = "R5010UNv2:green:inet"; + label = "green:inet"; gpios = <&pinctrl 1 1>; }; inet_fail_red { - label = "R5010UNv2:red:inet-fail"; + label = "red:inet-fail"; gpios = <&pinctrl 2 1>; }; dsl_red { - label = "R5010UNv2:green:dsl"; + label = "green:dsl"; gpios = <&pinctrl 3 1>; }; led_power_green: power_green { - label = "R5010UNv2:green:power"; + label = "green:power"; gpios = <&pinctrl 4 1>; default-state = "on"; }; power_fail_red { - label = "R5010UNv2:red:power-fail"; + label = "red:power-fail"; gpios = <&pinctrl 5 1>; }; wps_green { - label = "R5010UNv2:green:wps"; + label = "green:wps"; gpios = <&pinctrl 10 1>; }; usb_green { - label = "R5010UNv2:green:usb"; + label = "green:usb"; gpios = <&pinctrl 11 1>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6328-sagem-fast-2704-v2.dts b/target/linux/bcm63xx/dts/bcm6328-sagem-fast-2704-v2.dts index 1168047251..ff9b23049b 100644 --- a/target/linux/bcm63xx/dts/bcm6328-sagem-fast-2704-v2.dts +++ b/target/linux/bcm63xx/dts/bcm6328-sagem-fast-2704-v2.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6328.dtsi" #include @@ -52,32 +50,32 @@ compatible = "gpio-leds"; usb_green { - label = "F@ST2704V2:green:usb"; + label = "green:usb"; gpios = <&pinctrl 1 1>; }; inet_red { - label = "F@ST2704V2:red:inet"; + label = "red:inet"; gpios = <&pinctrl 2 1>; }; dsl_green { - label = "F@ST2704V2:green:dsl"; + label = "green:dsl"; gpios = <&pinctrl 3 1>; }; led_power_green: power_green { - label = "F@ST2704V2:green:power"; + label = "green:power"; gpios = <&pinctrl 4 1>; default-state = "on"; }; power_red { - label = "F@ST2704V2:red:power"; + label = "red:power"; gpios = <&pinctrl 5 1>; }; wps_green { - label = "F@ST2704V2:green:wps"; + label = "green:wps"; gpios = <&pinctrl 10 1>; }; inet_green { - label = "F@ST2704V2:green:inet"; + label = "green:inet"; gpios = <&pinctrl 11 1>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6328-sercomm-ad1018-nor.dts b/target/linux/bcm63xx/dts/bcm6328-sercomm-ad1018-nor.dts index 28c0916c0a..83f7578b06 100644 --- a/target/linux/bcm63xx/dts/bcm6328-sercomm-ad1018-nor.dts +++ b/target/linux/bcm63xx/dts/bcm6328-sercomm-ad1018-nor.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6328.dtsi" #include @@ -71,56 +69,56 @@ inet_red@0 { reg = <0>; active-low; - label = "AD1018:red:internet"; + label = "red:internet"; }; inet_green@1 { reg = <1>; active-low; - label = "AD1018:green:internet"; + label = "green:internet"; }; led_power_green: power_green@8 { reg = <8>; active-low; - label = "AD1018:green:power"; + label = "green:power"; default-state = "on"; }; adsl_green@10 { reg = <10>; active-low; - label = "AD1018:green:adsl"; + label = "green:adsl"; }; adsl_red@11 { reg = <11>; active-low; - label = "AD1018:red:adsl"; + label = "red:adsl"; }; phone_green@12 { reg = <12>; active-low; - label = "AD1018:green:phone"; + label = "green:phone"; }; wps_green@13 { reg = <13>; active-low; - label = "AD1018:green:wps"; + label = "green:wps"; }; wifi_green@14 { reg = <14>; active-low; - label = "AD1018:green:wifi"; + label = "green:wifi"; }; usb_green@15 { reg = <15>; active-low; - label = "AD1018:green:usb"; + label = "green:usb"; }; ephy0_spd@17 { diff --git a/target/linux/bcm63xx/dts/bcm6328-sercomm-ad1018.dts b/target/linux/bcm63xx/dts/bcm6328-sercomm-ad1018.dts index e2c2e07d29..edb1ce49a6 100644 --- a/target/linux/bcm63xx/dts/bcm6328-sercomm-ad1018.dts +++ b/target/linux/bcm63xx/dts/bcm6328-sercomm-ad1018.dts @@ -1,7 +1,5 @@ // SPDX-License-Identifier: GPL-2.0-or-later -/dts-v1/; - #include "bcm6328.dtsi" #include @@ -66,56 +64,56 @@ led@0 { reg = <0>; active-low; - label = "ad1018:red:internet"; + label = "red:internet"; }; led@1 { reg = <1>; active-low; - label = "ad1018:green:internet"; + label = "green:internet"; }; led_power_green: led@8 { reg = <8>; active-low; - label = "ad1018:green:power"; + label = "green:power"; default-state = "on"; }; led@10 { reg = <10>; active-low; - label = "ad1018:green:adsl"; + label = "green:adsl"; }; led@11 { reg = <11>; active-low; - label = "ad1018:red:adsl"; + label = "red:adsl"; }; led@12 { reg = <12>; active-low; - label = "ad1018:green:phone"; + label = "green:phone"; }; led@13 { reg = <13>; active-low; - label = "ad1018:green:wps"; + label = "green:wps"; }; led@14 { reg = <14>; active-low; - label = "ad1018:green:wifi"; + label = "green:wifi"; }; led@15 { reg = <15>; active-low; - label = "ad1018:green:usb"; + label = "green:usb"; }; led@17 { diff --git a/target/linux/bcm63xx/dts/bcm6328.dtsi b/target/linux/bcm63xx/dts/bcm6328.dtsi index f62fad783e..9b7e078c6d 100644 --- a/target/linux/bcm63xx/dts/bcm6328.dtsi +++ b/target/linux/bcm63xx/dts/bcm6328.dtsi @@ -1,3 +1,5 @@ +/dts-v1/; + / { #address-cells = <1>; #size-cells = <1>; diff --git a/target/linux/bcm63xx/dts/bcm6338-brcm-bcm96338gw.dts b/target/linux/bcm63xx/dts/bcm6338-brcm-bcm96338gw.dts index cc9be3fce4..885654ad41 100644 --- a/target/linux/bcm63xx/dts/bcm6338-brcm-bcm96338gw.dts +++ b/target/linux/bcm63xx/dts/bcm6338-brcm-bcm96338gw.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6338.dtsi" #include @@ -17,24 +15,24 @@ compatible = "gpio-leds"; power_green { - label = "96338GW:green:power"; + label = "green:power"; gpios = <&gpio0 0 1>; default-state = "on"; }; stop_green { - label = "96338GW:green:stop"; + label = "green:stop"; gpios = <&gpio0 1 1>; }; dsl_green { - label = "96338GW:green:adsl"; + label = "green:adsl"; gpios = <&gpio0 3 1>; }; ppp_fail_green { - label = "96338GW:green:ppp-fail"; + label = "green:ppp-fail"; gpios = <&gpio0 4 1>; }; ses_green { - label = "96338GW:green:ses"; + label = "green:ses"; gpios = <&gpio0 5 1>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6338-brcm-bcm96338w.dts b/target/linux/bcm63xx/dts/bcm6338-brcm-bcm96338w.dts index e5aa4e67f4..3002a9240b 100644 --- a/target/linux/bcm63xx/dts/bcm6338-brcm-bcm96338w.dts +++ b/target/linux/bcm63xx/dts/bcm6338-brcm-bcm96338w.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6338.dtsi" #include @@ -17,24 +15,24 @@ compatible = "gpio-leds"; power_green { - label = "96338W:green:power"; + label = "green:power"; gpios = <&gpio0 0 1>; default-state = "on"; }; stop_green { - label = "96338W:green:stop"; + label = "green:stop"; gpios = <&gpio0 1 1>; }; dsl_green { - label = "96338W:green:adsl"; + label = "green:adsl"; gpios = <&gpio0 3 1>; }; ppp_fail_green { - label = "96338W:green:ppp-fail"; + label = "green:ppp-fail"; gpios = <&gpio0 4 1>; }; ses_green { - label = "96338W:green:ses"; + label = "green:ses"; gpios = <&gpio0 5 1>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6338-d-link-dsl-2640u.dts b/target/linux/bcm63xx/dts/bcm6338-d-link-dsl-2640u.dts index 9d7448e09b..dae5324f0a 100644 --- a/target/linux/bcm63xx/dts/bcm6338-d-link-dsl-2640u.dts +++ b/target/linux/bcm63xx/dts/bcm6338-d-link-dsl-2640u.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6338.dtsi" #include @@ -17,18 +15,18 @@ compatible = "gpio-leds"; green_power { - label = "96338W2_E7T:green:power"; + label = "green:power"; gpios = <&gpio0 0 1>; default-state = "on"; }; green_stop { - label = "96338W2_E7T:green:ppp"; + label = "green:ppp"; gpios = <&gpio0 4 1>; }; green_adsl { - label = "96338W2_E7T:green:ppp-fail"; + label = "green:ppp-fail"; gpios = <&gpio0 5 1>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6338-dynalink-rta1320.dts b/target/linux/bcm63xx/dts/bcm6338-dynalink-rta1320.dts index 39ce0f3591..7d3f4a598f 100644 --- a/target/linux/bcm63xx/dts/bcm6338-dynalink-rta1320.dts +++ b/target/linux/bcm63xx/dts/bcm6338-dynalink-rta1320.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6338.dtsi" #include @@ -17,20 +15,20 @@ compatible = "gpio-leds"; green_power { - label = "RTA1320_16M:green:power"; + label = "green:power"; gpios = <&gpio0 0 1>; default-state = "on"; }; green_stop { - label = "RTA1320_16M:green:stop"; + label = "green:stop"; gpios = <&gpio0 1 1>; }; green_adsl { - label = "RTA1320_16M:green:adsl"; + label = "green:adsl"; gpios = <&gpio0 3 1>; }; green_ppp { - label = "RTA1320_16M:green:ppp"; + label = "green:ppp"; gpios = <&gpio0 4 1>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6338.dtsi b/target/linux/bcm63xx/dts/bcm6338.dtsi index 3d1c068351..fc8b2dfe51 100644 --- a/target/linux/bcm63xx/dts/bcm6338.dtsi +++ b/target/linux/bcm63xx/dts/bcm6338.dtsi @@ -1,3 +1,5 @@ +/dts-v1/; + / { #address-cells = <1>; #size-cells = <1>; diff --git a/target/linux/bcm63xx/dts/bcm6345-brcm-bcm96345gw2.dts b/target/linux/bcm63xx/dts/bcm6345-brcm-bcm96345gw2.dts index 1a86007290..515771904e 100644 --- a/target/linux/bcm63xx/dts/bcm6345-brcm-bcm96345gw2.dts +++ b/target/linux/bcm63xx/dts/bcm6345-brcm-bcm96345gw2.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6345.dtsi" #include diff --git a/target/linux/bcm63xx/dts/bcm6345-dynalink-rta770bw.dts b/target/linux/bcm63xx/dts/bcm6345-dynalink-rta770bw.dts index d86b37e2be..e5b67291b1 100644 --- a/target/linux/bcm63xx/dts/bcm6345-dynalink-rta770bw.dts +++ b/target/linux/bcm63xx/dts/bcm6345-dynalink-rta770bw.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6345.dtsi" #include @@ -38,22 +36,22 @@ compatible = "gpio-leds"; usb { - label = "RTA770BW:green:usb"; + label = "green:usb"; gpios = <&gpio0 7 1>; }; adsl { - label = "RTA770BW:green:adsl"; + label = "green:adsl"; gpios = <&gpio0 8 0>; }; led_diag: diag { - label = "RTA770BW:green:diag"; + label = "green:diag"; gpios = <&gpio0 10 1>; }; wlan { - label = "RTA770BW:green:wlan"; + label = "green:wlan"; gpios = <&gpio0 11 1>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6345-dynalink-rta770w.dts b/target/linux/bcm63xx/dts/bcm6345-dynalink-rta770w.dts index bd304f6f8a..65fb1d7b1e 100644 --- a/target/linux/bcm63xx/dts/bcm6345-dynalink-rta770w.dts +++ b/target/linux/bcm63xx/dts/bcm6345-dynalink-rta770w.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6345.dtsi" #include @@ -38,22 +36,22 @@ compatible = "gpio-leds"; usb { - label = "RTA770W:green:usb"; + label = "green:usb"; gpios = <&gpio0 7 1>; }; adsl { - label = "RTA770W:green:adsl"; + label = "green:adsl"; gpios = <&gpio0 8 0>; }; led_diag: diag { - label = "RTA770W:green:diag"; + label = "green:diag"; gpios = <&gpio0 10 1>; }; wlan { - label = "RTA770W:green:wlan"; + label = "green:wlan"; gpios = <&gpio0 11 1>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6345.dtsi b/target/linux/bcm63xx/dts/bcm6345.dtsi index 7d5f79be35..095af83637 100644 --- a/target/linux/bcm63xx/dts/bcm6345.dtsi +++ b/target/linux/bcm63xx/dts/bcm6345.dtsi @@ -1,3 +1,5 @@ +/dts-v1/; + / { #address-cells = <1>; #size-cells = <1>; diff --git a/target/linux/bcm63xx/dts/bcm6348-asmax-ar-1004g.dts b/target/linux/bcm63xx/dts/bcm6348-asmax-ar-1004g.dts index 5b00d33bde..6ffa3b457d 100644 --- a/target/linux/bcm63xx/dts/bcm6348-asmax-ar-1004g.dts +++ b/target/linux/bcm63xx/dts/bcm6348-asmax-ar-1004g.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6348.dtsi" #include @@ -38,16 +36,16 @@ compatible = "gpio-leds"; led_power_green: power_green { - label = "AR1004G:green:power"; + label = "green:power"; gpios = <&pinctrl 0 1>; default-state = "on"; }; inet_green { - label = "AR1004G:green:inet"; + label = "green:inet"; gpios = <&pinctrl 3 1>; }; power_red { - label = "AR1004G:red:power"; + label = "red:power"; gpios = <&pinctrl 6 1>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6348-belkin-f5d7633.dts b/target/linux/bcm63xx/dts/bcm6348-belkin-f5d7633.dts index fd4cece3fb..620d6510b6 100644 --- a/target/linux/bcm63xx/dts/bcm6348-belkin-f5d7633.dts +++ b/target/linux/bcm63xx/dts/bcm6348-belkin-f5d7633.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6348.dtsi" #include @@ -31,24 +29,24 @@ compatible = "gpio-leds"; power_green { - label = "96348GW-10:green:power"; + label = "green:power"; gpios = <&pinctrl 0 1>; default-state = "on"; }; stop_green { - label = "96348GW-10:green:stop"; + label = "green:stop"; gpios = <&pinctrl 1 1>; }; adsl_fail_green { - label = "96348GW-10:green:adsl-fail"; + label = "green:adsl-fail"; gpios = <&pinctrl 2 1>; }; ppp_green { - label = "96348GW-10:green:ppp"; + label = "green:ppp"; gpios = <&pinctrl 3 1>; }; ppp_fail_green { - label = "96348GW-10:green:ppp-fail"; + label = "green:ppp-fail"; gpios = <&pinctrl 4 1>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6348-brcm-bcm96348gw-10.dts b/target/linux/bcm63xx/dts/bcm6348-brcm-bcm96348gw-10.dts index d63af96ac2..8e19d7a261 100644 --- a/target/linux/bcm63xx/dts/bcm6348-brcm-bcm96348gw-10.dts +++ b/target/linux/bcm63xx/dts/bcm6348-brcm-bcm96348gw-10.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6348.dtsi" #include @@ -31,24 +29,24 @@ compatible = "gpio-leds"; power_green { - label = "96348GW-10:green:power"; + label = "green:power"; gpios = <&pinctrl 0 1>; default-state = "on"; }; stop_green { - label = "96348GW-10:green:stop"; + label = "green:stop"; gpios = <&pinctrl 1 1>; }; adsl_fail_green { - label = "96348GW-10:green:adsl-fail"; + label = "green:adsl-fail"; gpios = <&pinctrl 2 1>; }; ppp_green { - label = "96348GW-10:green:ppp"; + label = "green:ppp"; gpios = <&pinctrl 3 1>; }; ppp_fail_green { - label = "96348GW-10:green:ppp-fail"; + label = "green:ppp-fail"; gpios = <&pinctrl 4 1>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6348-brcm-bcm96348gw-11.dts b/target/linux/bcm63xx/dts/bcm6348-brcm-bcm96348gw-11.dts index e261985b7a..cf983b446b 100644 --- a/target/linux/bcm63xx/dts/bcm6348-brcm-bcm96348gw-11.dts +++ b/target/linux/bcm63xx/dts/bcm6348-brcm-bcm96348gw-11.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6348.dtsi" #include @@ -38,24 +36,24 @@ compatible = "gpio-leds"; led_power_green: power_green { - label = "96348GW-11:green:power"; + label = "green:power"; gpios = <&pinctrl 0 1>; default-state = "on"; }; stop_green { - label = "96348GW-11:green:stop"; + label = "green:stop"; gpios = <&pinctrl 1 1>; }; adsl_fail_green { - label = "96348GW-11:green:adsl-fail"; + label = "green:adsl-fail"; gpios = <&pinctrl 2 1>; }; ppp_green { - label = "96348GW-11:green:ppp"; + label = "green:ppp"; gpios = <&pinctrl 3 1>; }; ppp_fail_green { - label = "96348GW-11:green:ppp-fail"; + label = "green:ppp-fail"; gpios = <&pinctrl 4 1>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6348-brcm-bcm96348gw.dts b/target/linux/bcm63xx/dts/bcm6348-brcm-bcm96348gw.dts index f47d2fd0fa..9eeb50625d 100644 --- a/target/linux/bcm63xx/dts/bcm6348-brcm-bcm96348gw.dts +++ b/target/linux/bcm63xx/dts/bcm6348-brcm-bcm96348gw.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6348.dtsi" #include @@ -38,24 +36,24 @@ compatible = "gpio-leds"; led_power_green: power_green { - label = "96348GW:green:power"; + label = "green:power"; gpios = <&pinctrl 0 1>; default-state = "on"; }; stop_green { - label = "96348GW:green:stop"; + label = "green:stop"; gpios = <&pinctrl 1 1>; }; adsl_fail_green { - label = "96348GW:green:adsl-fail"; + label = "green:adsl-fail"; gpios = <&pinctrl 2 1>; }; ppp_green { - label = "96348GW:green:ppp"; + label = "green:ppp"; gpios = <&pinctrl 3 1>; }; ppp_fail_green { - label = "96348GW:green:ppp-fail"; + label = "green:ppp-fail"; gpios = <&pinctrl 4 1>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6348-brcm-bcm96348r.dts b/target/linux/bcm63xx/dts/bcm6348-brcm-bcm96348r.dts index 04516e20cc..2b54404560 100644 --- a/target/linux/bcm63xx/dts/bcm6348-brcm-bcm96348r.dts +++ b/target/linux/bcm63xx/dts/bcm6348-brcm-bcm96348r.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6348.dtsi" #include @@ -17,24 +15,24 @@ compatible = "gpio-leds"; power_green { - label = "96348R:green:power"; + label = "green:power"; gpios = <&pinctrl 0 1>; default-state = "on"; }; stop_green { - label = "96348R:green:stop"; + label = "green:stop"; gpios = <&pinctrl 1 1>; }; adsl_fail_green { - label = "96348R:green:adsl-fail"; + label = "green:adsl-fail"; gpios = <&pinctrl 2 1>; }; ppp_green { - label = "96348R:green:ppp"; + label = "green:ppp"; gpios = <&pinctrl 3 1>; }; ppp_fail_green { - label = "96348R:green:ppp-fail"; + label = "green:ppp-fail"; gpios = <&pinctrl 4 1>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6348-bt-voyager-2110.dts b/target/linux/bcm63xx/dts/bcm6348-bt-voyager-2110.dts index 0df43e7d53..39aa48971d 100644 --- a/target/linux/bcm63xx/dts/bcm6348-bt-voyager-2110.dts +++ b/target/linux/bcm63xx/dts/bcm6348-bt-voyager-2110.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6348.dtsi" #include @@ -38,23 +36,23 @@ compatible = "gpio-leds"; led_power_green: power_green { - label = "V2110:green:power"; + label = "green:power"; gpios = <&pinctrl 0 1>; }; power_red { - label = "V2110:red:power"; + label = "red:power"; gpios = <&pinctrl 1 1>; }; adsl_green { - label = "V2110:green:adsl"; + label = "green:adsl"; gpios = <&pinctrl 2 1>; }; ppp_green { - label = "V2110:green:ppp"; + label = "green:ppp"; gpios = <&pinctrl 3 1>; }; wireless_green { - label = "V2110:green:wireless"; + label = "green:wireless"; gpios = <&pinctrl 6 1>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6348-bt-voyager-2500v-bb.dts b/target/linux/bcm63xx/dts/bcm6348-bt-voyager-2500v-bb.dts index 7076bad65c..5e399a05a5 100644 --- a/target/linux/bcm63xx/dts/bcm6348-bt-voyager-2500v-bb.dts +++ b/target/linux/bcm63xx/dts/bcm6348-bt-voyager-2500v-bb.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6348.dtsi" #include @@ -31,23 +29,23 @@ compatible = "gpio-leds"; power_green { - label = "V2500V_BB:green:power"; + label = "green:power"; gpios = <&pinctrl 0 1>; }; power_red { - label = "V2500V_BB:red:power"; + label = "red:power"; gpios = <&pinctrl 1 1>; }; adsl_green { - label = "V2500V_BB:green:adsl"; + label = "green:adsl"; gpios = <&pinctrl 2 1>; }; ppp_green { - label = "V2500V_BB:green:ppp"; + label = "green:ppp"; gpios = <&pinctrl 3 1>; }; wireless_green { - label = "V2500V_BB:green:wireless"; + label = "green:wireless"; gpios = <&pinctrl 6 1>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6348-comtrend-ct-5365.dts b/target/linux/bcm63xx/dts/bcm6348-comtrend-ct-5365.dts index 75c0817b20..308139b0ce 100644 --- a/target/linux/bcm63xx/dts/bcm6348-comtrend-ct-5365.dts +++ b/target/linux/bcm63xx/dts/bcm6348-comtrend-ct-5365.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6348.dtsi" #include @@ -45,16 +43,16 @@ compatible = "gpio-leds"; power_green { - label = "96348A-122:green:power"; + label = "green:power"; gpios = <&pinctrl 0 1>; default-state = "on"; }; alarm_red { - label = "96348A-122:red:alarm"; + label = "red:alarm"; gpios = <&pinctrl 2 1>; }; wps_green { - label = "96348A-122:green:wps"; + label = "green:wps"; gpios = <&pinctrl 6 1>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6348-comtrend-ct-536plus.dts b/target/linux/bcm63xx/dts/bcm6348-comtrend-ct-536plus.dts index c7c2147116..e95e4e6e4f 100644 --- a/target/linux/bcm63xx/dts/bcm6348-comtrend-ct-536plus.dts +++ b/target/linux/bcm63xx/dts/bcm6348-comtrend-ct-536plus.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6348.dtsi" #include @@ -38,12 +36,12 @@ compatible = "gpio-leds"; led_power_green: power_green { - label = "CT536_CT5621:green:power"; + label = "green:power"; gpios = <&pinctrl 0 1>; default-state = "on"; }; adsl_fail_green { - label = "CT536_CT5621:green:adsl-fail"; + label = "green:adsl-fail"; gpios = <&pinctrl 2 1>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6348-d-link-dsl-2640b-b.dts b/target/linux/bcm63xx/dts/bcm6348-d-link-dsl-2640b-b.dts index 3a092a8b3e..d71bc4e56a 100644 --- a/target/linux/bcm63xx/dts/bcm6348-d-link-dsl-2640b-b.dts +++ b/target/linux/bcm63xx/dts/bcm6348-d-link-dsl-2640b-b.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6348.dtsi" #include @@ -38,20 +36,20 @@ compatible = "gpio-leds"; led_power_green: power_green { - label = "D-4P-W:green:power"; + label = "green:power"; gpios = <&pinctrl 0 1>; default-state = "on"; }; status { - label = "D-4P-W::status"; + label = "status"; gpios = <&pinctrl 3 1>; }; inet_green { - label = "D-4P-W:green:internet"; + label = "green:internet"; gpios = <&pinctrl 4 1>; }; inet_red { - label = "D-4P-W:red:internet"; + label = "red:internet"; gpios = <&pinctrl 5 1>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6348-davolink-dv-201amr.dts b/target/linux/bcm63xx/dts/bcm6348-davolink-dv-201amr.dts index 59a1b7b5e3..abb2cc0ec7 100644 --- a/target/linux/bcm63xx/dts/bcm6348-davolink-dv-201amr.dts +++ b/target/linux/bcm63xx/dts/bcm6348-davolink-dv-201amr.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6348.dtsi" #include diff --git a/target/linux/bcm63xx/dts/bcm6348-dynalink-rta1025w.dts b/target/linux/bcm63xx/dts/bcm6348-dynalink-rta1025w.dts index 76af7b4147..e107337ea1 100644 --- a/target/linux/bcm63xx/dts/bcm6348-dynalink-rta1025w.dts +++ b/target/linux/bcm63xx/dts/bcm6348-dynalink-rta1025w.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6348.dtsi" #include diff --git a/target/linux/bcm63xx/dts/bcm6348-inventel-livebox-1.dts b/target/linux/bcm63xx/dts/bcm6348-inventel-livebox-1.dts index 719cd16384..df204cc51e 100644 --- a/target/linux/bcm63xx/dts/bcm6348-inventel-livebox-1.dts +++ b/target/linux/bcm63xx/dts/bcm6348-inventel-livebox-1.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6348.dtsi" #include @@ -45,28 +43,28 @@ compatible = "gpio-leds"; led_red_adsl_fail: red_adsl_fail { - label = "Livebox1:red:adsl-fail-power"; + label = "red:adsl-fail-power"; gpios = <&pinctrl 0 0>; default-state = "on"; }; red_adsl { - label = "Livebox1:red:adsl"; + label = "red:adsl"; gpios = <&pinctrl 1 0>; }; red_traffic { - label = "Livebox1:red:traffic"; + label = "red:traffic"; gpios = <&pinctrl 2 0>; }; red_phone { - label = "Livebox1:red:phone"; + label = "red:phone"; gpios = <&pinctrl 3 0>; }; red_wifi { - label = "Livebox1:red:wifi"; + label = "red:wifi"; gpios = <&pinctrl 4 0>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6348-netgear-dg834g-v4.dts b/target/linux/bcm63xx/dts/bcm6348-netgear-dg834g-v4.dts index 65a2ac7587..e91a4105db 100644 --- a/target/linux/bcm63xx/dts/bcm6348-netgear-dg834g-v4.dts +++ b/target/linux/bcm63xx/dts/bcm6348-netgear-dg834g-v4.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6348.dtsi" #include @@ -31,20 +29,20 @@ compatible = "gpio-leds"; power_green { - label = "96348W3:green:power"; + label = "green:power"; gpios = <&pinctrl 0 1>; default-state = "on"; }; status { - label = "96348W3:red:power"; + label = "red:power"; gpios = <&pinctrl 1 1>; }; inet_green { - label = "96348W3::adsl"; + label = "adsl"; gpios = <&pinctrl 2 1>; }; inet_red { - label = "96348W3::internet"; + label = "internet"; gpios = <&pinctrl 3 1>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6348-netgear-dg834gt-pn.dts b/target/linux/bcm63xx/dts/bcm6348-netgear-dg834gt-pn.dts index 3e4b2812ef..3f17f987da 100644 --- a/target/linux/bcm63xx/dts/bcm6348-netgear-dg834gt-pn.dts +++ b/target/linux/bcm63xx/dts/bcm6348-netgear-dg834gt-pn.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6348.dtsi" #include @@ -31,24 +29,24 @@ compatible = "gpio-leds"; power_green { - label = "96348GW-10:green:power"; + label = "green:power"; gpios = <&pinctrl 0 1>; default-state = "on"; }; stop_green { - label = "96348GW-10:green:stop"; + label = "green:stop"; gpios = <&pinctrl 1 1>; }; adsl_fail_green { - label = "96348GW-10:green:adsl-fail"; + label = "green:adsl-fail"; gpios = <&pinctrl 2 1>; }; ppp_green { - label = "96348GW-10:green:ppp"; + label = "green:ppp"; gpios = <&pinctrl 3 1>; }; ppp_fail_green { - label = "96348GW-10:green:ppp-fail"; + label = "green:ppp-fail"; gpios = <&pinctrl 4 1>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6348-sagem-fast-2404.dts b/target/linux/bcm63xx/dts/bcm6348-sagem-fast-2404.dts index d3c0859a65..4abd185ca6 100644 --- a/target/linux/bcm63xx/dts/bcm6348-sagem-fast-2404.dts +++ b/target/linux/bcm63xx/dts/bcm6348-sagem-fast-2404.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6348.dtsi" #include diff --git a/target/linux/bcm63xx/dts/bcm6348-sagem-fast-2604.dts b/target/linux/bcm63xx/dts/bcm6348-sagem-fast-2604.dts index 3aa03b3e04..987903d525 100644 --- a/target/linux/bcm63xx/dts/bcm6348-sagem-fast-2604.dts +++ b/target/linux/bcm63xx/dts/bcm6348-sagem-fast-2604.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6348.dtsi" #include @@ -31,20 +29,20 @@ compatible = "gpio-leds"; power_green { - label = "F@ST2604:green:power"; + label = "green:power"; gpios = <&pinctrl 0 1>; default-state = "on"; }; power_red { - label = "F@ST2604:red:power"; + label = "red:power"; gpios = <&pinctrl 1 1>; }; inet_red { - label = "F@ST2604:red:inet"; + label = "red:inet"; gpios = <&pinctrl 4 1>; }; wps_green { - label = "F@ST2604:green:wps"; + label = "green:wps"; gpios = <&pinctrl 5 1>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6348-t-com-speedport-w-500v.dts b/target/linux/bcm63xx/dts/bcm6348-t-com-speedport-w-500v.dts index 5f7e641251..c096b88d8f 100644 --- a/target/linux/bcm63xx/dts/bcm6348-t-com-speedport-w-500v.dts +++ b/target/linux/bcm63xx/dts/bcm6348-t-com-speedport-w-500v.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6348.dtsi" #include @@ -38,24 +36,24 @@ compatible = "gpio-leds"; led_power_green: power_green { - label = "SPW500V:green:power"; + label = "green:power"; gpios = <&pinctrl 0 1>; default-state = "on"; }; power_red { - label = "SPW500V:red:power"; + label = "red:power"; gpios = <&pinctrl 1 1>; }; ppp_green { - label = "SPW500V:green:ppp"; + label = "green:ppp"; gpios = <&pinctrl 3 1>; }; pstn_green { - label = "SPW500V:green:pstn"; + label = "green:pstn"; gpios = <&pinctrl 28 1>; }; voip_green { - label = "SPW500V:green:voip"; + label = "green:voip"; gpios = <&pinctrl 32 1>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6348-tecom-gw6000.dts b/target/linux/bcm63xx/dts/bcm6348-tecom-gw6000.dts index e3876e1366..a34cd49a46 100644 --- a/target/linux/bcm63xx/dts/bcm6348-tecom-gw6000.dts +++ b/target/linux/bcm63xx/dts/bcm6348-tecom-gw6000.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6348.dtsi" #include diff --git a/target/linux/bcm63xx/dts/bcm6348-tecom-gw6200.dts b/target/linux/bcm63xx/dts/bcm6348-tecom-gw6200.dts index ec1f88573e..5773077b54 100644 --- a/target/linux/bcm63xx/dts/bcm6348-tecom-gw6200.dts +++ b/target/linux/bcm63xx/dts/bcm6348-tecom-gw6200.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6348.dtsi" #include @@ -38,19 +36,19 @@ compatible = "gpio-leds"; led_line1_green: line1_green { - label = "GW6200:green:line1"; + label = "green:line1"; gpios = <&pinctrl 4 1>; }; line2_green { - label = "GW6200:green:line2"; + label = "green:line2"; gpios = <&pinctrl 5 1>; }; line3_green { - label = "GW6200:green:line3"; + label = "green:line3"; gpios = <&pinctrl 6 1>; }; tel_green { - label = "GW6200:green:tel"; + label = "green:tel"; gpios = <&pinctrl 7 1>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6348-telsey-cpva502plus.dts b/target/linux/bcm63xx/dts/bcm6348-telsey-cpva502plus.dts index f0024ae22d..d0ec1cf15e 100644 --- a/target/linux/bcm63xx/dts/bcm6348-telsey-cpva502plus.dts +++ b/target/linux/bcm63xx/dts/bcm6348-telsey-cpva502plus.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6348.dtsi" #include @@ -31,12 +29,12 @@ compatible = "gpio-leds"; phone_green { - label = "CPVA502+:green:phone"; + label = "green:phone"; gpios = <&pinctrl 0 1>; }; link_amber { - label = "CPVA502+:amber:link"; + label = "amber:link"; gpios = <&pinctrl 5 1>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6348-telsey-magic.dts b/target/linux/bcm63xx/dts/bcm6348-telsey-magic.dts index a058736dbd..00ce70f17b 100644 --- a/target/linux/bcm63xx/dts/bcm6348-telsey-magic.dts +++ b/target/linux/bcm63xx/dts/bcm6348-telsey-magic.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6348.dtsi" #include @@ -17,38 +15,38 @@ compatible = "gpio-leds"; power { - label = "MAGIC:green:power"; + label = "green:power"; gpios = <&pinctrl 0 1>; default-state = "on"; }; stop { - label = "MAGIC:green:stop"; + label = "green:stop"; gpios = <&pinctrl 1 1>; }; hpna { - label = "MAGIC:green:hpna"; + label = "green:hpna"; gpios = <&pinctrl 4 1>; }; status { - label = "MAGIC:green:adsl"; + label = "green:adsl"; gpios = <&pinctrl 5 1>; }; voip { - label = "MAGIC:green:voip"; + label = "green:voip"; gpios = <&pinctrl 22 1>; }; wifi { - label = "MAGIC:green:wifi"; + label = "green:wifi"; gpios = <&pinctrl 28 0>; }; usb { - label = "MAGIC:green:usb"; + label = "green:usb"; gpios = <&pinctrl 35 1>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6348-tp-link-td-w8900gb.dts b/target/linux/bcm63xx/dts/bcm6348-tp-link-td-w8900gb.dts index 0d79b40d22..1a49e7ff33 100644 --- a/target/linux/bcm63xx/dts/bcm6348-tp-link-td-w8900gb.dts +++ b/target/linux/bcm63xx/dts/bcm6348-tp-link-td-w8900gb.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6348.dtsi" #include @@ -31,24 +29,24 @@ compatible = "gpio-leds"; power_green { - label = "96348GW-11:green:power"; + label = "green:power"; gpios = <&pinctrl 0 1>; default-state = "on"; }; stop_green { - label = "96348GW-11:green:stop"; + label = "green:stop"; gpios = <&pinctrl 1 1>; }; adsl_fail_green { - label = "96348GW-11:green:adsl-fail"; + label = "green:adsl-fail"; gpios = <&pinctrl 2 1>; }; ppp_green { - label = "96348GW-11:green:ppp"; + label = "green:ppp"; gpios = <&pinctrl 3 1>; }; ppp_fail_green { - label = "96348GW-11:green:ppp-fail"; + label = "green:ppp-fail"; gpios = <&pinctrl 4 1>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6348-usrobotics-usr9108.dts b/target/linux/bcm63xx/dts/bcm6348-usrobotics-usr9108.dts index 4ce7fbce23..412d80a8c3 100644 --- a/target/linux/bcm63xx/dts/bcm6348-usrobotics-usr9108.dts +++ b/target/linux/bcm63xx/dts/bcm6348-usrobotics-usr9108.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6348.dtsi" #include @@ -17,11 +15,11 @@ compatible = "gpio-leds"; usb { - label = "96348GW-A::usb"; + label = "usb"; gpios = <&pinctrl 0 1>; }; dsl { - label = "96348GW-A::adsl"; + label = "adsl"; gpios = <&pinctrl 3 1>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6348.dtsi b/target/linux/bcm63xx/dts/bcm6348.dtsi index f3e17be533..1e04486909 100644 --- a/target/linux/bcm63xx/dts/bcm6348.dtsi +++ b/target/linux/bcm63xx/dts/bcm6348.dtsi @@ -1,3 +1,5 @@ +/dts-v1/; + / { #address-cells = <1>; #size-cells = <1>; diff --git a/target/linux/bcm63xx/dts/bcm6358-alcatel-rg100a.dts b/target/linux/bcm63xx/dts/bcm6358-alcatel-rg100a.dts index e7367b07a3..fdc1edf906 100644 --- a/target/linux/bcm63xx/dts/bcm6358-alcatel-rg100a.dts +++ b/target/linux/bcm63xx/dts/bcm6358-alcatel-rg100a.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6358.dtsi" #include @@ -17,20 +15,20 @@ compatible = "gpio-leds"; stop_green { - label = "96358VW2:green:stop"; + label = "green:stop"; gpios = <&pinctrl 4 1>; }; power_green { - label = "96358VW2:green:power"; + label = "green:power"; gpios = <&pinctrl 5 1>; default-state = "on"; }; adsl_green { - label = "96358VW2:green:adsl"; + label = "green:adsl"; gpios = <&pinctrl 22 1>; }; ppp_fail_green { - label = "96358VW2:green:ppp-fail"; + label = "green:ppp-fail"; gpios = <&pinctrl 23 0>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6358-brcm-bcm96358vw.dts b/target/linux/bcm63xx/dts/bcm6358-brcm-bcm96358vw.dts index fc38c6e51a..bf997935e8 100644 --- a/target/linux/bcm63xx/dts/bcm6358-brcm-bcm96358vw.dts +++ b/target/linux/bcm63xx/dts/bcm6358-brcm-bcm96358vw.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6358.dtsi" #include @@ -17,24 +15,24 @@ compatible = "gpio-leds"; power_green { - label = "96358VW:green:power"; + label = "green:power"; gpios = <&pinctrl 4 0>; default-state = "on"; }; stop_green { - label = "96358VW:green:stop"; + label = "green:stop"; gpios = <&pinctrl 5 0>; }; adsl_fail_green { - label = "96358VW:green:adsl-fail"; + label = "green:adsl-fail"; gpios = <&pinctrl 15 1>; }; ppp_green { - label = "96358VW:green:ppp"; + label = "green:ppp"; gpios = <&pinctrl 22 1>; }; ppp_fail_green { - label = "96358VW:green:ppp-fail"; + label = "green:ppp-fail"; gpios = <&pinctrl 23 1>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6358-brcm-bcm96358vw2.dts b/target/linux/bcm63xx/dts/bcm6358-brcm-bcm96358vw2.dts index 0248f41597..316581d2a5 100644 --- a/target/linux/bcm63xx/dts/bcm6358-brcm-bcm96358vw2.dts +++ b/target/linux/bcm63xx/dts/bcm6358-brcm-bcm96358vw2.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6358.dtsi" #include @@ -17,20 +15,20 @@ compatible = "gpio-leds"; stop_green { - label = "96358VW2:green:stop"; + label = "green:stop"; gpios = <&pinctrl 4 1>; }; power_green { - label = "96358VW2:green:power"; + label = "green:power"; gpios = <&pinctrl 5 1>; default-state = "on"; }; adsl_green { - label = "96358VW2:green:adsl"; + label = "green:adsl"; gpios = <&pinctrl 22 1>; }; ppp_fail_green { - label = "96358VW2:green:ppp-fail"; + label = "green:ppp-fail"; gpios = <&pinctrl 23 0>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6358-bt-home-hub-2-a.dts b/target/linux/bcm63xx/dts/bcm6358-bt-home-hub-2-a.dts index 321e7b3020..b5eea3dcb1 100644 --- a/target/linux/bcm63xx/dts/bcm6358-bt-home-hub-2-a.dts +++ b/target/linux/bcm63xx/dts/bcm6358-bt-home-hub-2-a.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6358.dtsi" #include @@ -58,92 +56,92 @@ led@0 { reg = <0>; active-low; - label = "HOMEHUB2A:red:power"; + label = "red:power"; }; led_power_green: led@1 { reg = <0>; active-low; - label = "HOMEHUB2A:green:power"; + label = "green:power"; default-state = "on"; }; led@2 { reg = <2>; active-low; - label = "HOMEHUB2A:blue:power"; + label = "blue:power"; }; led@3 { reg = <3>; active-low; - label = "HOMEHUB2A:red:broadband"; + label = "red:broadband"; }; led@4 { reg = <4>; active-low; - label = "HOMEHUB2A:green:broadband"; + label = "green:broadband"; }; led@5 { reg = <5>; active-low; - label = "HOMEHUB2A:blue:broadband"; + label = "blue:broadband"; }; led@6 { reg = <6>; active-low; - label = "HOMEHUB2A:red:wireless"; + label = "red:wireless"; }; led@7 { reg = <7>; active-low; - label = "HOMEHUB2A:green:wireless"; + label = "green:wireless"; }; led@8 { reg = <8>; active-low; - label = "HOMEHUB2A:blue:wireless"; + label = "blue:wireless"; }; led@9 { reg = <9>; active-low; - label = "HOMEHUB2A:red:phone"; + label = "red:phone"; }; led@10 { reg = <10>; active-low; - label = "HOMEHUB2A:green:phone"; + label = "green:phone"; }; led@11 { reg = <11>; active-low; - label = "HOMEHUB2A:blue:phone"; + label = "blue:phone"; }; led@12 { reg = <12>; active-low; - label = "HOMEHUB2A:red:upgrading"; + label = "red:upgrading"; }; led_upgrading_green: led@13 { reg = <13>; active-low; - label = "HOMEHUB2A:green:upgrading"; + label = "green:upgrading"; }; led@14 { reg = <14>; active-low; - label = "HOMEHUB2A:blue:upgrading"; + label = "blue:upgrading"; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6358-comtrend-ct-6373.dts b/target/linux/bcm63xx/dts/bcm6358-comtrend-ct-6373.dts index 9c990eeb73..ab9d5659ba 100644 --- a/target/linux/bcm63xx/dts/bcm6358-comtrend-ct-6373.dts +++ b/target/linux/bcm63xx/dts/bcm6358-comtrend-ct-6373.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6358.dtsi" #include @@ -31,16 +29,16 @@ compatible = "gpio-leds"; power_green { - label = "CT6373-1:green:power"; + label = "green:power"; gpios = <&pinctrl 0 0>; default-state = "on"; }; usb_green { - label = "CT6373-1:green:usb"; + label = "green:usb"; gpios = <&pinctrl 3 1>; }; wlan_green { - label = "CT6373-1:green:wlan"; + label = "green:wlan"; gpios = <&pinctrl 9 1>; }; }; @@ -55,25 +53,25 @@ led@0 { reg = <0>; active-low; - label = "CT6373-1:green:adsl"; + label = "green:adsl"; }; led@1 { reg = <1>; active-low; - label = "CT6373-1:green:line"; + label = "green:line"; }; led@2 { reg = <2>; active-low; - label = "CT6373-1:green:fxs1"; + label = "green:fxs1"; }; led@3 { reg = <3>; active-low; - label = "CT6373-1:green:fxs2"; + label = "green:fxs2"; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6358-d-link-dsl-2650u.dts b/target/linux/bcm63xx/dts/bcm6358-d-link-dsl-2650u.dts index caa6d3f4b4..6d26261a34 100644 --- a/target/linux/bcm63xx/dts/bcm6358-d-link-dsl-2650u.dts +++ b/target/linux/bcm63xx/dts/bcm6358-d-link-dsl-2650u.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6358.dtsi" #include @@ -17,20 +15,20 @@ compatible = "gpio-leds"; stop_green { - label = "96358VW2:green:stop"; + label = "green:stop"; gpios = <&pinctrl 4 1>; }; power_green { - label = "96358VW2:green:power"; + label = "green:power"; gpios = <&pinctrl 5 1>; default-state = "on"; }; adsl_green { - label = "96358VW2:green:adsl"; + label = "green:adsl"; gpios = <&pinctrl 22 1>; }; ppp_fail_green { - label = "96358VW2:green:ppp-fail"; + label = "green:ppp-fail"; gpios = <&pinctrl 23 0>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6358-d-link-dsl-274xb-c2.dts b/target/linux/bcm63xx/dts/bcm6358-d-link-dsl-274xb-c2.dts index bd40319f4f..ff007ebe4c 100644 --- a/target/linux/bcm63xx/dts/bcm6358-d-link-dsl-274xb-c2.dts +++ b/target/linux/bcm63xx/dts/bcm6358-d-link-dsl-274xb-c2.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6358.dtsi" #include @@ -38,24 +36,24 @@ compatible = "gpio-leds"; inet_green { - label = "dsl-274xb:green:internet"; + label = "green:internet"; gpios = <&pinctrl 2 0>; }; power_red { - label = "dsl-274xb:red:power"; + label = "red:power"; gpios = <&pinctrl 4 1>; }; led_power_green: power_green { - label = "dsl-274xb:green:power"; + label = "green:power"; gpios = <&pinctrl 5 1>; default-state = "on"; }; dsl_green { - label = "dsl-274xb:green:adsl"; + label = "green:adsl"; gpios = <&pinctrl 9 1>; }; inet_red { - label = "dsl-274xb:red:internet"; + label = "red:internet"; gpios = <&pinctrl 10 0>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6358-d-link-dva-g3810bn-tl.dts b/target/linux/bcm63xx/dts/bcm6358-d-link-dva-g3810bn-tl.dts index 71c8f53676..ef6ff862e5 100644 --- a/target/linux/bcm63xx/dts/bcm6358-d-link-dva-g3810bn-tl.dts +++ b/target/linux/bcm63xx/dts/bcm6358-d-link-dva-g3810bn-tl.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6358.dtsi" #include @@ -31,24 +29,24 @@ compatible = "gpio-leds"; voip { - label = "DVAG3810BN::voip"; + label = "voip"; gpios = <&pinctrl 1 0>; }; power { - label = "DVAG3810BN::power"; + label = "power"; gpios = <&pinctrl 4 0>; default-state = "on"; }; stop { - label = "DVAG3810BN::stop"; + label = "stop"; gpios = <&pinctrl 5 0>; }; dsl { - label = "DVAG3810BN::dsl"; + label = "dsl"; gpios = <&pinctrl 22 1>; }; inet { - label = "DVAG3810BN::internet"; + label = "internet"; gpios = <&pinctrl 23 1>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6358-huawei-echolife-hg553.dts b/target/linux/bcm63xx/dts/bcm6358-huawei-echolife-hg553.dts index 63af70ea2e..243e2ca300 100644 --- a/target/linux/bcm63xx/dts/bcm6358-huawei-echolife-hg553.dts +++ b/target/linux/bcm63xx/dts/bcm6358-huawei-echolife-hg553.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6358.dtsi" #include @@ -45,40 +43,40 @@ compatible = "gpio-leds"; led_power_blue: power_blue { - label = "HW553:blue:power"; + label = "blue:power"; gpios = <&pinctrl 4 1>; default-state = "on"; }; power_red { - label = "HW553:red:power"; + label = "red:power"; gpios = <&pinctrl 5 1>; }; hspa_red { - label = "HW553:red:hspa"; + label = "red:hspa"; gpios = <&pinctrl 12 1>; }; hspa_blue { - label = "HW553:blue:hspa"; + label = "blue:hspa"; gpios = <&pinctrl 13 1>; }; lan_red { - label = "HW553:red:lan"; + label = "red:lan"; gpios = <&pinctrl 22 1>; }; lan_blue { - label = "HW553:blue:lan"; + label = "blue:lan"; gpios = <&pinctrl 23 1>; }; wifi_red { - label = "HW553:red:wifi"; + label = "red:wifi"; gpios = <&pinctrl 25 1>; }; dsl_red { - label = "HW553:red:adsl"; + label = "red:adsl"; gpios = <&pinctrl 34 1>; }; dsl_blue { - label = "HW553:blue:adsl"; + label = "blue:adsl"; gpios = <&pinctrl 35 1>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6358-huawei-echolife-hg556a-a.dts b/target/linux/bcm63xx/dts/bcm6358-huawei-echolife-hg556a-a.dts index 435ed46bb9..76dbe4f92b 100644 --- a/target/linux/bcm63xx/dts/bcm6358-huawei-echolife-hg556a-a.dts +++ b/target/linux/bcm63xx/dts/bcm6358-huawei-echolife-hg556a-a.dts @@ -1,153 +1,43 @@ -/dts-v1/; - -#include "bcm6358.dtsi" - -#include +#include "bcm6358-huawei-echolife-hg556a.dtsi" / { model = "Huawei EchoLife HG556a (version A)"; compatible = "huawei,echolife-hg556a-a", "brcm,bcm6358"; +}; - aliases { - led-boot = &led_power_red; - led-failsafe = &led_power_red; - led-running = &led_power_red; - led-upgrade = &led_power_red; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - help { - label = "help"; - gpios = <&pinctrl 8 1>; - linux,code = ; - debounce-interval = <60>; - }; - - wlan { - label = "wlan"; - gpios = <&pinctrl 9 1>; - linux,code = ; - debounce-interval = <60>; - }; - - restart { - label = "restart"; - gpios = <&pinctrl 10 1>; - linux,code = ; - debounce-interval = <60>; - }; - - reset { - label = "reset"; - gpios = <&pinctrl 11 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - message_red { - label = "HW556:red:message"; - gpios = <&pinctrl 0 1>; - }; - hspa_red { - label = "HW556:red:hspa"; - gpios = <&pinctrl 1 1>; - }; - dsl_red { - label = "HW556:red:dsl"; - gpios = <&pinctrl 2 1>; - }; - led_power_red: power_red { - label = "HW556:red:power"; - gpios = <&pinctrl 3 1>; - default-state = "on"; - }; - all_red { - label = "HW556:red:all"; - gpios = <&pinctrl 6 1>; - default-state = "on"; - }; - lan1_green { - label = "HW556:green:lan1"; - gpios = <&pinctrl 12 1>; - }; - lan1_red { - label = "HW556:red:lan1"; - gpios = <&pinctrl 13 1>; - }; - lan2_green { - label = "HW556:green:lan2"; - gpios = <&pinctrl 15 1>; - }; - lan2_red { - label = "HW556:red:lan2"; - gpios = <&pinctrl 22 1>; - }; - lan3_green { - label = "HW556:green:lan3"; - gpios = <&pinctrl 23 1>; - }; - lan3_red { - label = "HW556:red:lan3"; - gpios = <&pinctrl 26 1>; - }; - lan4_green { - label = "HW556:green:lan4"; - gpios = <&pinctrl 27 1>; - }; - lan4_red { - label = "HW556:red:lan4"; - gpios = <&pinctrl 28 1>; - }; +&gpiokeys { + help { + label = "help"; + gpios = <&pinctrl 8 1>; + linux,code = ; + debounce-interval = <60>; }; }; -&pflash { - status = "okay"; +&gpioleds { + message_red { + label = "red:message"; + gpios = <&pinctrl 0 1>; + }; - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; + hspa_red { + label = "red:hspa"; + gpios = <&pinctrl 1 1>; + }; - cfe@0 { - label = "CFE"; - reg = <0x000000 0x020000>; - read-only; - }; + all_red { + label = "red:all"; + gpios = <&pinctrl 6 1>; + default-state = "on"; + }; - linux@20000 { - label = "linux"; - reg = <0x020000 0xec0000>; - compatible = "brcm,bcm963xx-imagetag"; - }; + lan1_green { + label = "green:lan1"; + gpios = <&pinctrl 12 1>; + }; - cal_data@ee0000 { - label = "cal_data"; - reg = <0xee0000 0x100000>; - read-only; - }; - - nvram@fe0000 { - label = "nvram"; - reg = <0xfe0000 0x020000>; - }; + lan2_green { + label = "green:lan2"; + gpios = <&pinctrl 15 1>; }; }; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6358-huawei-echolife-hg556a-b.dts b/target/linux/bcm63xx/dts/bcm6358-huawei-echolife-hg556a-b.dts index ab31991049..c39e574b36 100644 --- a/target/linux/bcm63xx/dts/bcm6358-huawei-echolife-hg556a-b.dts +++ b/target/linux/bcm63xx/dts/bcm6358-huawei-echolife-hg556a-b.dts @@ -1,153 +1,43 @@ -/dts-v1/; - -#include "bcm6358.dtsi" - -#include +#include "bcm6358-huawei-echolife-hg556a.dtsi" / { model = "Huawei EchoLife HG556a (version B)"; compatible = "huawei,echolife-hg556a-b", "brcm,bcm6358"; +}; - aliases { - led-boot = &led_power_red; - led-failsafe = &led_power_red; - led-running = &led_power_red; - led-upgrade = &led_power_red; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - help { - label = "help"; - gpios = <&pinctrl 8 1>; - linux,code = ; - debounce-interval = <60>; - }; - - wlan { - label = "wlan"; - gpios = <&pinctrl 9 1>; - linux,code = ; - debounce-interval = <60>; - }; - - restart { - label = "restart"; - gpios = <&pinctrl 10 1>; - linux,code = ; - debounce-interval = <60>; - }; - - reset { - label = "reset"; - gpios = <&pinctrl 11 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - message_red { - label = "HW556:red:message"; - gpios = <&pinctrl 0 1>; - }; - hspa_red { - label = "HW556:red:hspa"; - gpios = <&pinctrl 1 1>; - }; - dsl_red { - label = "HW556:red:dsl"; - gpios = <&pinctrl 2 1>; - }; - led_power_red: power_red { - label = "HW556:red:power"; - gpios = <&pinctrl 3 1>; - default-state = "on"; - }; - all_red { - label = "HW556:red:all"; - gpios = <&pinctrl 6 1>; - default-state = "on"; - }; - lan1_green { - label = "HW556:green:lan1"; - gpios = <&pinctrl 12 1>; - }; - lan1_red { - label = "HW556:red:lan1"; - gpios = <&pinctrl 13 1>; - }; - lan2_green { - label = "HW556:green:lan2"; - gpios = <&pinctrl 15 1>; - }; - lan2_red { - label = "HW556:red:lan2"; - gpios = <&pinctrl 22 1>; - }; - lan3_green { - label = "HW556:green:lan3"; - gpios = <&pinctrl 23 1>; - }; - lan3_red { - label = "HW556:red:lan3"; - gpios = <&pinctrl 26 1>; - }; - lan4_green { - label = "HW556:green:lan4"; - gpios = <&pinctrl 27 1>; - }; - lan4_red { - label = "HW556:red:lan4"; - gpios = <&pinctrl 28 1>; - }; +&gpiokeys { + help { + label = "help"; + gpios = <&pinctrl 8 1>; + linux,code = ; + debounce-interval = <60>; }; }; -&pflash { - status = "okay"; +&gpioleds { + message_red { + label = "red:message"; + gpios = <&pinctrl 0 1>; + }; - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; + hspa_red { + label = "red:hspa"; + gpios = <&pinctrl 1 1>; + }; - cfe@0 { - label = "CFE"; - reg = <0x000000 0x020000>; - read-only; - }; + all_red { + label = "red:all"; + gpios = <&pinctrl 6 1>; + default-state = "on"; + }; - linux@20000 { - label = "linux"; - reg = <0x020000 0xec0000>; - compatible = "brcm,bcm963xx-imagetag"; - }; + lan1_green { + label = "green:lan1"; + gpios = <&pinctrl 12 1>; + }; - cal_data@ee0000 { - label = "cal_data"; - reg = <0xee0000 0x100000>; - read-only; - }; - - nvram@fe0000 { - label = "nvram"; - reg = <0xfe0000 0x020000>; - }; + lan2_green { + label = "green:lan2"; + gpios = <&pinctrl 15 1>; }; }; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6358-huawei-echolife-hg556a-c.dts b/target/linux/bcm63xx/dts/bcm6358-huawei-echolife-hg556a-c.dts index 7fcd50269f..3f5931d7bd 100644 --- a/target/linux/bcm63xx/dts/bcm6358-huawei-echolife-hg556a-c.dts +++ b/target/linux/bcm63xx/dts/bcm6358-huawei-echolife-hg556a-c.dts @@ -1,148 +1,37 @@ -/dts-v1/; - -#include "bcm6358.dtsi" - -#include +#include "bcm6358-huawei-echolife-hg556a.dtsi" / { model = "Huawei EchoLife HG556a (version C)"; compatible = "huawei,echolife-hg556a-c", "brcm,bcm6358"; +}; - aliases { - led-boot = &led_power_red; - led-failsafe = &led_power_red; - led-running = &led_power_red; - led-upgrade = &led_power_red; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - help { - label = "help"; - gpios = <&pinctrl 36 1>; - linux,code = ; - debounce-interval = <60>; - }; - - wlan { - label = "wlan"; - gpios = <&pinctrl 9 1>; - linux,code = ; - debounce-interval = <60>; - }; - - restart { - label = "restart"; - gpios = <&pinctrl 10 1>; - linux,code = ; - debounce-interval = <60>; - }; - - reset { - label = "reset"; - gpios = <&pinctrl 11 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - lan1_green { - label = "HW556:green:lan1"; - gpios = <&pinctrl 0 1>; - }; - lan2_green { - label = "HW556:green:lan2"; - gpios = <&pinctrl 1 1>; - }; - dsl_red { - label = "HW556:red:dsl"; - gpios = <&pinctrl 2 1>; - }; - led_power_red: power_red { - label = "HW556:red:power"; - gpios = <&pinctrl 3 1>; - default-state = "on"; - }; - message_red { - label = "HW556:red:message"; - gpios = <&pinctrl 12 1>; - }; - lan1_red { - label = "HW556:red:lan1"; - gpios = <&pinctrl 13 1>; - }; - hspa_red { - label = "HW556:red:hspa"; - gpios = <&pinctrl 15 1>; - }; - lan2_red { - label = "HW556:red:lan2"; - gpios = <&pinctrl 22 1>; - }; - lan3_green { - label = "HW556:green:lan3"; - gpios = <&pinctrl 23 1>; - }; - lan3_red { - label = "HW556:red:lan3"; - gpios = <&pinctrl 26 1>; - }; - lan4_green { - label = "HW556:green:lan4"; - gpios = <&pinctrl 27 1>; - }; - lan4_red { - label = "HW556:red:lan4"; - gpios = <&pinctrl 28 1>; - }; +&gpiokeys { + help { + label = "help"; + gpios = <&pinctrl 36 1>; + linux,code = ; + debounce-interval = <60>; }; }; -&pflash { - status = "okay"; +&gpioleds { + lan1_green { + label = "green:lan1"; + gpios = <&pinctrl 0 1>; + }; - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; + lan2_green { + label = "green:lan2"; + gpios = <&pinctrl 1 1>; + }; - cfe@0 { - label = "CFE"; - reg = <0x000000 0x020000>; - read-only; - }; + message_red { + label = "red:message"; + gpios = <&pinctrl 12 1>; + }; - linux@20000 { - label = "linux"; - reg = <0x020000 0xec0000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - - cal_data@ee0000 { - label = "cal_data"; - reg = <0xee0000 0x100000>; - read-only; - }; - - nvram@fe0000 { - label = "nvram"; - reg = <0xfe0000 0x020000>; - }; + hspa_red { + label = "red:hspa"; + gpios = <&pinctrl 15 1>; }; }; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6358-huawei-echolife-hg556a.dtsi b/target/linux/bcm63xx/dts/bcm6358-huawei-echolife-hg556a.dtsi new file mode 100644 index 0000000000..09a21f7ad7 --- /dev/null +++ b/target/linux/bcm63xx/dts/bcm6358-huawei-echolife-hg556a.dtsi @@ -0,0 +1,127 @@ +#include "bcm6358.dtsi" + +#include + +/ { + aliases { + led-boot = &led_power_red; + led-failsafe = &led_power_red; + led-running = &led_power_red; + led-upgrade = &led_power_red; + }; + + chosen { + bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; + stdout-path = "serial0:115200n8"; + }; + + gpiokeys: keys { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + wlan { + label = "wlan"; + gpios = <&pinctrl 9 1>; + linux,code = ; + debounce-interval = <60>; + }; + + restart { + label = "restart"; + gpios = <&pinctrl 10 1>; + linux,code = ; + debounce-interval = <60>; + }; + + reset { + label = "reset"; + gpios = <&pinctrl 11 1>; + linux,code = ; + debounce-interval = <60>; + }; + }; + + gpioleds: leds { + compatible = "gpio-leds"; + + dsl_red { + label = "red:dsl"; + gpios = <&pinctrl 2 1>; + }; + + led_power_red: power_red { + label = "red:power"; + gpios = <&pinctrl 3 1>; + default-state = "on"; + }; + + lan1_red { + label = "red:lan1"; + gpios = <&pinctrl 13 1>; + }; + + lan2_red { + label = "red:lan2"; + gpios = <&pinctrl 22 1>; + }; + + lan3_green { + label = "green:lan3"; + gpios = <&pinctrl 23 1>; + }; + + lan3_red { + label = "red:lan3"; + gpios = <&pinctrl 26 1>; + }; + + lan4_green { + label = "green:lan4"; + gpios = <&pinctrl 27 1>; + }; + + lan4_red { + label = "red:lan4"; + gpios = <&pinctrl 28 1>; + }; + }; +}; + +&pflash { + status = "okay"; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + cfe@0 { + label = "CFE"; + reg = <0x000000 0x020000>; + read-only; + }; + + linux@20000 { + label = "linux"; + reg = <0x020000 0xec0000>; + compatible = "brcm,bcm963xx-imagetag"; + }; + + cal_data@ee0000 { + label = "cal_data"; + reg = <0xee0000 0x100000>; + read-only; + }; + + nvram@fe0000 { + label = "nvram"; + reg = <0xfe0000 0x020000>; + }; + }; +}; + +&uart0 { + status = "okay"; +}; diff --git a/target/linux/bcm63xx/dts/bcm6358-pirelli-a226.dtsi b/target/linux/bcm63xx/dts/bcm6358-pirelli-a226.dtsi new file mode 100644 index 0000000000..cc833b0c18 --- /dev/null +++ b/target/linux/bcm63xx/dts/bcm6358-pirelli-a226.dtsi @@ -0,0 +1,93 @@ +#include "bcm6358.dtsi" + +#include + +/ { + chosen { + bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; + stdout-path = "serial0:115200n8"; + }; + + keys { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + wps { + label = "wps"; + gpios = <&pinctrl 34 1>; + linux,code = ; + debounce-interval = <60>; + }; + + reset { + label = "reset"; + gpios = <&pinctrl 37 1>; + linux,code = ; + debounce-interval = <60>; + }; + }; + + leds { + compatible = "gpio-leds"; + + voip_red { + label = "red:VoIP"; + gpios = <&pinctrl 0 1>; + }; + eth_red { + label = "red:ethernet"; + gpios = <&pinctrl 1 1>; + }; + dsl_green { + label = "green:ADSL"; + gpios = <&pinctrl 2 1>; + }; + usb_green { + label = "green:USB"; + gpios = <&pinctrl 3 1>; + }; + power_green { + label = "green:power"; + gpios = <&pinctrl 4 1>; + default-state = "on"; + }; + power_red { + label = "red:power"; + gpios = <&pinctrl 5 1>; + }; + inet_red { + label = "red:internet"; + gpios = <&pinctrl 6 1>; + }; + inet_green { + label = "green:internet"; + gpios = <&pinctrl 7 1>; + }; + eth_green { + label = "green:ethernet"; + gpios = <&pinctrl 8 1>; + }; + voip_green { + label = "green:VoIP"; + gpios = <&pinctrl 9 1>; + }; + wifi_red { + label = "red:wifi"; + gpios = <&pinctrl 10 1>; + }; + usb_red { + label = "red:USB"; + gpios = <&pinctrl 11 1>; + }; + dsl_red { + label = "red:ADSL"; + gpios = <&pinctrl 12 1>; + }; + }; +}; + +&uart0 { + status = "okay"; +}; diff --git a/target/linux/bcm63xx/dts/bcm6358-pirelli-a226g.dts b/target/linux/bcm63xx/dts/bcm6358-pirelli-a226g.dts index 9ff56f0611..492fd2ed31 100644 --- a/target/linux/bcm63xx/dts/bcm6358-pirelli-a226g.dts +++ b/target/linux/bcm63xx/dts/bcm6358-pirelli-a226g.dts @@ -1,96 +1,8 @@ -/dts-v1/; - -#include "bcm6358.dtsi" - -#include +#include "bcm6358-pirelli-a226.dtsi" / { model = "Pirelli A226G"; compatible = "pirelli,a226g", "brcm,bcm6358"; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - wps { - label = "wps"; - gpios = <&pinctrl 34 1>; - linux,code = ; - debounce-interval = <60>; - }; - - reset { - label = "reset"; - gpios = <&pinctrl 37 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - voip_red { - label = "DWV-S0:red:VoIP"; - gpios = <&pinctrl 0 1>; - }; - eth_red { - label = "DWV-S0:red:ethernet"; - gpios = <&pinctrl 1 1>; - }; - dsl_green { - label = "DWV-S0:green:ADSL"; - gpios = <&pinctrl 2 1>; - }; - usb_green { - label = "DWV-S0:green:USB"; - gpios = <&pinctrl 3 1>; - }; - power_green { - label = "DWV-S0:green:power"; - gpios = <&pinctrl 4 1>; - default-state = "on"; - }; - power_red { - label = "DWV-S0:red:power"; - gpios = <&pinctrl 5 1>; - }; - inet_red { - label = "DWV-S0:red:internet"; - gpios = <&pinctrl 6 1>; - }; - inet_green { - label = "DWV-S0:green:internet"; - gpios = <&pinctrl 7 1>; - }; - eth_green { - label = "DWV-S0:green:ethernet"; - gpios = <&pinctrl 8 1>; - }; - voip_green { - label = "DWV-S0:green:VoIP"; - gpios = <&pinctrl 9 1>; - }; - wifi_red { - label = "DWV-S0:red:wifi"; - gpios = <&pinctrl 10 1>; - }; - usb_red { - label = "DWV-S0:red:USB"; - gpios = <&pinctrl 11 1>; - }; - dsl_red { - label = "DWV-S0:red:ADSL"; - gpios = <&pinctrl 12 1>; - }; - }; }; &pflash { @@ -119,7 +31,3 @@ }; }; }; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6358-pirelli-a226m-fwb.dts b/target/linux/bcm63xx/dts/bcm6358-pirelli-a226m-fwb.dts index 6a78c5cfa1..1a820fbcbf 100644 --- a/target/linux/bcm63xx/dts/bcm6358-pirelli-a226m-fwb.dts +++ b/target/linux/bcm63xx/dts/bcm6358-pirelli-a226m-fwb.dts @@ -1,96 +1,8 @@ -/dts-v1/; - -#include "bcm6358.dtsi" - -#include +#include "bcm6358-pirelli-a226.dtsi" / { model = "Pirelli A226M-FWB"; compatible = "pirelli,a226m-fwb", "brcm,bcm6358"; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - wps { - label = "wps"; - gpios = <&pinctrl 34 1>; - linux,code = ; - debounce-interval = <60>; - }; - - reset { - label = "reset"; - gpios = <&pinctrl 37 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - voip_red { - label = "DWV-S0:red:VoIP"; - gpios = <&pinctrl 0 1>; - }; - eth_red { - label = "DWV-S0:red:ethernet"; - gpios = <&pinctrl 1 1>; - }; - dsl_green { - label = "DWV-S0:green:ADSL"; - gpios = <&pinctrl 2 1>; - }; - usb_green { - label = "DWV-S0:green:USB"; - gpios = <&pinctrl 3 1>; - }; - power_green { - label = "DWV-S0:green:power"; - gpios = <&pinctrl 4 1>; - default-state = "on"; - }; - power_red { - label = "DWV-S0:red:power"; - gpios = <&pinctrl 5 1>; - }; - inet_red { - label = "DWV-S0:red:internet"; - gpios = <&pinctrl 6 1>; - }; - inet_green { - label = "DWV-S0:green:internet"; - gpios = <&pinctrl 7 1>; - }; - eth_green { - label = "DWV-S0:green:ethernet"; - gpios = <&pinctrl 8 1>; - }; - voip_green { - label = "DWV-S0:green:VoIP"; - gpios = <&pinctrl 9 1>; - }; - wifi_red { - label = "DWV-S0:red:wifi"; - gpios = <&pinctrl 10 1>; - }; - usb_red { - label = "DWV-S0:red:USB"; - gpios = <&pinctrl 11 1>; - }; - dsl_red { - label = "DWV-S0:red:ADSL"; - gpios = <&pinctrl 12 1>; - }; - }; }; &pflash { @@ -119,7 +31,3 @@ }; }; }; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6358-pirelli-a226m.dts b/target/linux/bcm63xx/dts/bcm6358-pirelli-a226m.dts index 8642d9d76a..ba1a8629b5 100644 --- a/target/linux/bcm63xx/dts/bcm6358-pirelli-a226m.dts +++ b/target/linux/bcm63xx/dts/bcm6358-pirelli-a226m.dts @@ -1,96 +1,8 @@ -/dts-v1/; - -#include "bcm6358.dtsi" - -#include +#include "bcm6358-pirelli-a226.dtsi" / { model = "Pirelli A226M"; compatible = "pirelli,a226m", "brcm,bcm6358"; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - wps { - label = "wps"; - gpios = <&pinctrl 34 1>; - linux,code = ; - debounce-interval = <60>; - }; - - reset { - label = "reset"; - gpios = <&pinctrl 37 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - voip_red { - label = "DWV-S0:red:VoIP"; - gpios = <&pinctrl 0 1>; - }; - eth_red { - label = "DWV-S0:red:ethernet"; - gpios = <&pinctrl 1 1>; - }; - dsl_green { - label = "DWV-S0:green:ADSL"; - gpios = <&pinctrl 2 1>; - }; - usb_green { - label = "DWV-S0:green:USB"; - gpios = <&pinctrl 3 1>; - }; - power_green { - label = "DWV-S0:green:power"; - gpios = <&pinctrl 4 1>; - default-state = "on"; - }; - power_red { - label = "DWV-S0:red:power"; - gpios = <&pinctrl 5 1>; - }; - inet_red { - label = "DWV-S0:red:internet"; - gpios = <&pinctrl 6 1>; - }; - inet_green { - label = "DWV-S0:green:internet"; - gpios = <&pinctrl 7 1>; - }; - eth_green { - label = "DWV-S0:green:ethernet"; - gpios = <&pinctrl 8 1>; - }; - voip_green { - label = "DWV-S0:green:VoIP"; - gpios = <&pinctrl 9 1>; - }; - wifi_red { - label = "DWV-S0:red:wifi"; - gpios = <&pinctrl 10 1>; - }; - usb_red { - label = "DWV-S0:red:USB"; - gpios = <&pinctrl 11 1>; - }; - dsl_red { - label = "DWV-S0:red:ADSL"; - gpios = <&pinctrl 12 1>; - }; - }; }; &pflash { @@ -119,7 +31,3 @@ }; }; }; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6358-pirelli-agpf-s0.dts b/target/linux/bcm63xx/dts/bcm6358-pirelli-agpf-s0.dts index 3e020ea010..12e9a0eba3 100644 --- a/target/linux/bcm63xx/dts/bcm6358-pirelli-agpf-s0.dts +++ b/target/linux/bcm63xx/dts/bcm6358-pirelli-agpf-s0.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6358.dtsi" #include @@ -38,60 +36,60 @@ compatible = "gpio-leds"; power_green { - label = "AGPF-S0:green:power"; + label = "green:power"; gpios = <&pinctrl 4 1>; default-state = "on"; }; power_red { - label = "AGPF-S0:red:power"; + label = "red:power"; gpios = <&pinctrl 5 1>; }; service_green { - label = "AGPF-S0:green:service"; + label = "green:service"; gpios = <&pinctrl 6 1>; }; service_red { - label = "AGPF-S0:red:service"; + label = "red:service"; gpios = <&pinctrl 7 1>; }; dsl_green { - label = "AGPF-S0:green:adsl"; + label = "green:adsl"; gpios = <&pinctrl 9 1>; }; dsl_red { - label = "AGPF-S0:red:adsl"; + label = "red:adsl"; gpios = <&pinctrl 10 1>; }; wifi_green { - label = "AGPF-S0:green:wifi"; + label = "green:wifi"; gpios = <&pinctrl 22 1>; }; wifi_red { - label = "AGPF-S0:red:wifi"; + label = "red:wifi"; gpios = <&pinctrl 23 1>; }; inet_red { - label = "AGPF-S0:red:internet"; + label = "red:internet"; gpios = <&pinctrl 24 1>; }; inet_green { - label = "AGPF-S0:green:internet"; + label = "green:internet"; gpios = <&pinctrl 25 1>; }; usr1_green { - label = "AGPF-S0:green:usr1"; + label = "green:usr1"; gpios = <&pinctrl 26 1>; }; usr1_red { - label = "AGPF-S0:red:usr1"; + label = "red:usr1"; gpios = <&pinctrl 27 1>; }; usr2_green { - label = "AGPF-S0:green:usr2"; + label = "green:usr2"; gpios = <&pinctrl 29 1>; }; usr2_red { - label = "AGPF-S0:red:usr2"; + label = "red:usr2"; gpios = <&pinctrl 30 1>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6358-sfr-neufbox-4-foxconn-r1.dts b/target/linux/bcm63xx/dts/bcm6358-sfr-neufbox-4-foxconn-r1.dts index fc15291563..c4c9ee9518 100644 --- a/target/linux/bcm63xx/dts/bcm6358-sfr-neufbox-4-foxconn-r1.dts +++ b/target/linux/bcm63xx/dts/bcm6358-sfr-neufbox-4-foxconn-r1.dts @@ -1,118 +1,31 @@ -/dts-v1/; - -#include "bcm6358.dtsi" - -#include +#include "bcm6358-sfr-neufbox-4.dtsi" / { model = "SFR Neufbox 4 (Foxconn)"; compatible = "sfr,neufbox-4-foxconn-r1", "brcm,bcm6358"; - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - service { - label = "service"; - gpios = <&pinctrl 27 1>; - linux,code = ; - debounce-interval = <60>; - }; - - clip { - label = "clip"; - gpios = <&pinctrl 31 1>; - linux,code = ; - debounce-interval = <60>; - }; - - reset { - label = "reset"; - gpios = <&pinctrl 34 1>; - linux,code = ; - debounce-interval = <60>; - }; - - wps { - label = "wps"; - gpios = <&pinctrl 37 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - leds { compatible = "gpio-leds"; traffic_white { - label = "NB4-FXC-r1:white:traffic"; + label = "white:traffic"; gpios = <&pinctrl 2 0>; }; service_blue { - label = "NB4-FXC-r1:blue:service"; + label = "blue:service"; gpios = <&pinctrl 4 0>; }; wifi_white { - label = "NB4-FXC-r1:white:wifi"; + label = "white:wifi"; gpios = <&pinctrl 15 0>; }; service_red { - label = "NB4-FXC-r1:red:service"; + label = "red:service"; gpios = <&pinctrl 29 0>; }; service_green { - label = "NB4-FXC-r1:green:service"; + label = "green:service"; gpios = <&pinctrl 30 0>; }; }; }; - -&leds { - status = "okay"; - - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_serial_led>; - - led@0 { - reg = <0>; - active-low; - label = "NB4-FXC-r1:white:alarm"; - }; - - led@2 { - reg = <2>; - active-low; - label = "NB4-FXC-r1:white:tv"; - }; - - led@3 { - reg = <3>; - active-low; - label = "NB4-FXC-r1:white:tel"; - }; - - led@4 { - reg = <4>; - active-low; - label = "NB4-FXC-r1:white:adsl"; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "brcm,bcm963xx-cfe-nor-partitions"; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6358-sfr-neufbox-4-sercomm-r0.dts b/target/linux/bcm63xx/dts/bcm6358-sfr-neufbox-4-sercomm-r0.dts index 2889324672..fa23b68ef5 100644 --- a/target/linux/bcm63xx/dts/bcm6358-sfr-neufbox-4-sercomm-r0.dts +++ b/target/linux/bcm63xx/dts/bcm6358-sfr-neufbox-4-sercomm-r0.dts @@ -1,118 +1,31 @@ -/dts-v1/; - -#include "bcm6358.dtsi" - -#include +#include "bcm6358-sfr-neufbox-4.dtsi" / { model = "SFR Neufbox 4 (Sercomm)"; compatible = "sfr,neufbox-4-sercomm-r0", "brcm,bcm6358"; - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - service { - label = "service"; - gpios = <&pinctrl 27 1>; - linux,code = ; - debounce-interval = <60>; - }; - - clip { - label = "clip"; - gpios = <&pinctrl 31 1>; - linux,code = ; - debounce-interval = <60>; - }; - - reset { - label = "reset"; - gpios = <&pinctrl 34 1>; - linux,code = ; - debounce-interval = <60>; - }; - - wps { - label = "wps"; - gpios = <&pinctrl 37 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - leds { compatible = "gpio-leds"; traffic_white { - label = "NB4-SER-r0:white:traffic"; + label = "white:traffic"; gpios = <&pinctrl 2 1>; }; service_blue { - label = "NB4-SER-r0:blue:service"; + label = "blue:service"; gpios = <&pinctrl 4 1>; }; wifi_white { - label = "NB4-SER-r0:white:wifi"; + label = "white:wifi"; gpios = <&pinctrl 15 1>; }; service_red { - label = "NB4-SER-r0:red:service"; + label = "red:service"; gpios = <&pinctrl 29 1>; }; service_green { - label = "NB4-SER-r0:green:service"; + label = "green:service"; gpios = <&pinctrl 30 1>; }; }; }; - -&leds { - status = "okay"; - - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_serial_led>; - - led@0 { - reg = <0>; - active-low; - label = "NB4-SER-r0:white:alarm"; - }; - - led@2 { - reg = <2>; - active-low; - label = "NB4-SER-r0:white:tv"; - }; - - led@3 { - reg = <3>; - active-low; - label = "NB4-SER-r0:white:tel"; - }; - - led@4 { - reg = <4>; - active-low; - label = "NB4-SER-r0:white:adsl"; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "brcm,bcm963xx-cfe-nor-partitions"; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6358-sfr-neufbox-4.dtsi b/target/linux/bcm63xx/dts/bcm6358-sfr-neufbox-4.dtsi new file mode 100644 index 0000000000..58075c879a --- /dev/null +++ b/target/linux/bcm63xx/dts/bcm6358-sfr-neufbox-4.dtsi @@ -0,0 +1,88 @@ +#include "bcm6358.dtsi" + +#include + +/ { + chosen { + bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; + stdout-path = "serial0:115200n8"; + }; + + keys { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + service { + label = "service"; + gpios = <&pinctrl 27 1>; + linux,code = ; + debounce-interval = <60>; + }; + + clip { + label = "clip"; + gpios = <&pinctrl 31 1>; + linux,code = ; + debounce-interval = <60>; + }; + + reset { + label = "reset"; + gpios = <&pinctrl 34 1>; + linux,code = ; + debounce-interval = <60>; + }; + + wps { + label = "wps"; + gpios = <&pinctrl 37 1>; + linux,code = ; + debounce-interval = <60>; + }; + }; +}; + +&leds { + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_serial_led>; + + led@0 { + reg = <0>; + active-low; + label = "white:alarm"; + }; + + led@2 { + reg = <2>; + active-low; + label = "white:tv"; + }; + + led@3 { + reg = <3>; + active-low; + label = "white:tel"; + }; + + led@4 { + reg = <4>; + active-low; + label = "white:adsl"; + }; +}; + +&pflash { + status = "okay"; + + partitions { + compatible = "brcm,bcm963xx-cfe-nor-partitions"; + }; +}; + +&uart0 { + status = "okay"; +}; diff --git a/target/linux/bcm63xx/dts/bcm6358-t-com-speedport-w-303v.dts b/target/linux/bcm63xx/dts/bcm6358-t-com-speedport-w-303v.dts index e61468e91c..7a66e68031 100644 --- a/target/linux/bcm63xx/dts/bcm6358-t-com-speedport-w-303v.dts +++ b/target/linux/bcm63xx/dts/bcm6358-t-com-speedport-w-303v.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6358.dtsi" #include @@ -45,28 +43,28 @@ compatible = "gpio-leds"; ses_green { - label = "spw303v:green:ses"; + label = "green:ses"; gpios = <&pinctrl 0 1>; }; power_adsl_red { - label = "spw303v:red:power+adsl"; + label = "red:power+adsl"; gpios = <&pinctrl 2 1>; }; ppp_green { - label = "spw303v:green:ppp"; + label = "green:ppp"; gpios = <&pinctrl 5 1>; }; led_power_adsl_green: power_adsl_green { - label = "spw303v:green:power+adsl"; + label = "green:power+adsl"; gpios = <&pinctrl 22 1>; default-state = "on"; }; voip_green { - label = "spw303v:green:voip"; + label = "green:voip"; gpios = <&pinctrl 27 1>; }; pots_green { - label = "spw303v:green:pots"; + label = "green:pots"; gpios = <&pinctrl 31 1>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6358-telsey-cpva642.dts b/target/linux/bcm63xx/dts/bcm6358-telsey-cpva642.dts index b02c657fa3..f679b40ac9 100644 --- a/target/linux/bcm63xx/dts/bcm6358-telsey-cpva642.dts +++ b/target/linux/bcm63xx/dts/bcm6358-telsey-cpva642.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6358.dtsi" #include @@ -45,44 +43,44 @@ compatible = "gpio-leds"; eth_green { - label = "CPVA642:green:ether"; + label = "green:ether"; gpios = <&pinctrl 1 1>; }; phone2_green { - label = "CPVA642:green:phone2"; + label = "green:phone2"; gpios = <&pinctrl 2 1>; }; usb_green { - label = "CPVA642:green:usb"; + label = "green:usb"; gpios = <&pinctrl 3 1>; }; phone1_green { - label = "CPVA642:green:phone1"; + label = "green:phone1"; gpios = <&pinctrl 4 1>; }; wifi_red { - label = "CPVA642:red:wifi"; + label = "red:wifi"; gpios = <&pinctrl 6 1>; }; link_red { - label = "CPVA642:red:link"; + label = "red:link"; gpios = <&pinctrl 9 1>; }; link_green { - label = "CPVA642:green:link"; + label = "green:link"; gpios = <&pinctrl 10 1>; }; led_power_green: power_green { - label = "CPVA642:green:power"; + label = "green:power"; gpios = <&pinctrl 11 1>; default-state = "on"; }; power_red { - label = "CPVA642:red:power"; + label = "red:power"; gpios = <&pinctrl 14 1>; }; wifi_green { - label = "CPVA642:green:wifi"; + label = "green:wifi"; gpios = <&pinctrl 28 0>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6358.dtsi b/target/linux/bcm63xx/dts/bcm6358.dtsi index a78cdef373..c2e0a97bb2 100644 --- a/target/linux/bcm63xx/dts/bcm6358.dtsi +++ b/target/linux/bcm63xx/dts/bcm6358.dtsi @@ -1,3 +1,5 @@ +/dts-v1/; + / { #address-cells = <1>; #size-cells = <1>; diff --git a/target/linux/bcm63xx/dts/bcm6359-huawei-echolife-hg520v.dts b/target/linux/bcm63xx/dts/bcm6359-huawei-echolife-hg520v.dts index a14578b622..ec47764ccb 100644 --- a/target/linux/bcm63xx/dts/bcm6359-huawei-echolife-hg520v.dts +++ b/target/linux/bcm63xx/dts/bcm6359-huawei-echolife-hg520v.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6358.dtsi" #include @@ -38,7 +36,7 @@ compatible = "gpio-leds"; led_inet_green: inet_green { - label = "HW520:green:net"; + label = "green:net"; gpios = <&pinctrl 32 1>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6361-sfr-neufbox-6-sercomm-r0.dts b/target/linux/bcm63xx/dts/bcm6361-sfr-neufbox-6-sercomm-r0.dts index af172564a2..c7b6806810 100644 --- a/target/linux/bcm63xx/dts/bcm6361-sfr-neufbox-6-sercomm-r0.dts +++ b/target/linux/bcm63xx/dts/bcm6361-sfr-neufbox-6-sercomm-r0.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6362.dtsi" #include diff --git a/target/linux/bcm63xx/dts/bcm6362-huawei-hg253s-v2.dts b/target/linux/bcm63xx/dts/bcm6362-huawei-hg253s-v2.dts index e198ea2740..255c1c8f6c 100644 --- a/target/linux/bcm63xx/dts/bcm6362-huawei-hg253s-v2.dts +++ b/target/linux/bcm63xx/dts/bcm6362-huawei-hg253s-v2.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6362.dtsi" #include @@ -51,12 +49,12 @@ compatible = "gpio-leds"; led_phone_green: led@28 { - label = "hg253s-v2:green:phone"; + label = "green:phone"; gpios = <&pinctrl 28 1>; }; led@30 { - label = "hg253s-v2:green:usb"; + label = "green:usb"; gpios = <&pinctrl 30 1>; }; }; @@ -71,13 +69,13 @@ led@3 { reg = <3>; active-low; - label = "hg253s-v2:green:internet"; + label = "green:internet"; }; led@5 { reg = <5>; active-low; - label = "hg253s-v2:green:wifi"; + label = "green:wifi"; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6362-netgear-dgnd3700-v2.dts b/target/linux/bcm63xx/dts/bcm6362-netgear-dgnd3700-v2.dts index e3c344f5eb..50133265f7 100644 --- a/target/linux/bcm63xx/dts/bcm6362-netgear-dgnd3700-v2.dts +++ b/target/linux/bcm63xx/dts/bcm6362-netgear-dgnd3700-v2.dts @@ -1,7 +1,5 @@ // SPDX-License-Identifier: GPL-2.0-or-later -/dts-v1/; - #include "bcm6362.dtsi" #include @@ -54,12 +52,12 @@ compatible = "gpio-leds"; led@28 { - label = "dgnd3700-v2:green:dsl"; + label = "green:dsl"; gpios = <&pinctrl 28 1>; }; led@34 { - label = "dgnd3700-v2:red:power"; + label = "red:power"; gpios = <&pinctrl 34 1>; }; }; @@ -78,67 +76,67 @@ led@1 { reg = <1>; active-low; - label = "dgnd3700-v2:green:internet"; + label = "green:internet"; }; led_power_green: led@8 { reg = <8>; - label = "dgnd3700-v2:green:power"; + label = "green:power"; default-state = "on"; }; led@9 { reg = <9>; active-low; - label = "dgnd3700-v2:green:wps"; + label = "green:wps"; }; led@10 { reg = <10>; active-low; - label = "dgnd3700-v2:green:usb1"; + label = "green:usb1"; }; led@11 { reg = <11>; active-low; - label = "dgnd3700-v2:green:usb2"; + label = "green:usb2"; }; led@12 { reg = <12>; active-low; - label = "dgnd3700-v2:amber:internet"; + label = "amber:internet"; }; led@13 { reg = <13>; active-low; - label = "dgnd3700-v2:green:ethernet"; + label = "green:ethernet"; }; led@14 { reg = <14>; active-low; - label = "dgnd3700-v2:amber:dsl"; + label = "amber:dsl"; }; led@16 { reg = <16>; active-low; - label = "dgnd3700-v2:amber:usb1"; + label = "amber:usb1"; }; led@17 { reg = <17>; active-low; - label = "dgnd3700-v2:amber:usb2"; + label = "amber:usb2"; }; led@18 { reg = <18>; active-low; - label = "dgnd3700-v2:amber:ethernet"; + label = "amber:ethernet"; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6362-sagem-fast-2504n.dts b/target/linux/bcm63xx/dts/bcm6362-sagem-fast-2504n.dts index e0716893da..e5ae573c97 100644 --- a/target/linux/bcm63xx/dts/bcm6362-sagem-fast-2504n.dts +++ b/target/linux/bcm63xx/dts/bcm6362-sagem-fast-2504n.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6362.dtsi" #include @@ -45,28 +43,28 @@ compatible = "gpio-leds"; power_orange { - label = "fast2504n:orange:power"; + label = "orange:power"; gpios = <&pinctrl 2 1>; }; power_green { - label = "fast2504n:green:power"; + label = "green:power"; gpios = <&pinctrl 10 1>; default-state = "on"; }; inet_red { - label = "fast2504n:red:internet"; + label = "red:internet"; gpios = <&pinctrl 26 1>; }; led_ok_green: ok_green { - label = "fast2504n:green:ok"; + label = "green:ok"; gpios = <&pinctrl 28 1>; }; ok_orange { - label = "fast2504n:orange:ok"; + label = "orange:ok"; gpios = <&pinctrl 29 1>; }; wlan_orangee { - label = "fast2504n:orange:wlan"; + label = "orange:wlan"; gpios = <&pinctrl 30 1>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6362.dtsi b/target/linux/bcm63xx/dts/bcm6362.dtsi index e639fc8837..0571b1e1ba 100644 --- a/target/linux/bcm63xx/dts/bcm6362.dtsi +++ b/target/linux/bcm63xx/dts/bcm6362.dtsi @@ -1,3 +1,5 @@ +/dts-v1/; + / { #address-cells = <1>; #size-cells = <1>; diff --git a/target/linux/bcm63xx/dts/bcm6368-actiontec-r1000h.dts b/target/linux/bcm63xx/dts/bcm6368-actiontec-r1000h.dts index 951603089b..fa038962c2 100644 --- a/target/linux/bcm63xx/dts/bcm6368-actiontec-r1000h.dts +++ b/target/linux/bcm63xx/dts/bcm6368-actiontec-r1000h.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6368.dtsi" #include @@ -45,38 +43,38 @@ compatible = "gpio-leds"; inet_green { - label = "R1000H:green:inet"; + label = "green:inet"; gpios = <&pinctrl 5 0>; }; usb_green { - label = "R1000H:green:usb"; + label = "green:usb"; gpios = <&pinctrl 21 1>; }; led_power_green: power_green { - label = "R1000H:green:power"; + label = "green:power"; gpios = <&pinctrl 22 0>; default-state = "on"; }; wps_green { - label = "R1000H:green:wps"; + label = "green:wps"; gpios = <&pinctrl 23 1>; }; power_red { - label = "R1000H:red:power"; + label = "red:power"; gpios = <&pinctrl 24 0>; }; wps_red { - label = "R1000H:red:wps"; + label = "red:wps"; gpios = <&pinctrl 30 1>; }; inet_red { - label = "R1000H:red:inet"; + label = "red:inet"; gpios = <&pinctrl 31 0>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6368-adb-av4202n.dts b/target/linux/bcm63xx/dts/bcm6368-adb-av4202n.dts index 8e06985fdd..fb1b4bcf06 100644 --- a/target/linux/bcm63xx/dts/bcm6368-adb-av4202n.dts +++ b/target/linux/bcm63xx/dts/bcm6368-adb-av4202n.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6368.dtsi" #include @@ -46,32 +44,32 @@ compatible = "gpio-leds"; led_power_white: power_white { - label = "AV4202N:white:power"; + label = "white:power"; gpios = <&pinctrl 10 GPIO_ACTIVE_LOW>; default-state = "on"; }; power_red { - label = "AV4202N:red:power"; + label = "red:power"; gpios = <&pinctrl 11 GPIO_ACTIVE_LOW>; }; wan_white { - label = "AV4202N:white:wan"; + label = "white:wan"; gpios = <&pinctrl 26 GPIO_ACTIVE_LOW>; }; wan_red { - label = "AV4202N:red:wan"; + label = "red:wan"; gpios = <&pinctrl 27 GPIO_ACTIVE_LOW>; }; phone_white { - label = "AV4202N:white:phone"; + label = "white:phone"; gpios = <&pinctrl 24 GPIO_ACTIVE_LOW>; }; phone_red { - label = "AV4202N:red:phone"; + label = "red:phone"; gpios = <&pinctrl 25 GPIO_ACTIVE_LOW>; }; wifi { - label = "AV4202N:blue:wifi"; + label = "blue:wifi"; gpios = <&pinctrl 22 GPIO_ACTIVE_LOW>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6368-brcm-bcm96368mvngr.dts b/target/linux/bcm63xx/dts/bcm6368-brcm-bcm96368mvngr.dts index 757009fde6..50c57d5271 100644 --- a/target/linux/bcm63xx/dts/bcm6368-brcm-bcm96368mvngr.dts +++ b/target/linux/bcm63xx/dts/bcm6368-brcm-bcm96368mvngr.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6368.dtsi" #include @@ -17,24 +15,24 @@ compatible = "gpio-leds"; dsl_green { - label = "96368MVNgr:green:adsl"; + label = "green:adsl"; gpios = <&pinctrl 2 1>; }; inet_fail_green { - label = "96368MVNgr:green:inet-fail"; + label = "green:inet-fail"; gpios = <&pinctrl 3 0>; }; inet_green { - label = "96368MVNgr:green:inet"; + label = "green:inet"; gpios = <&pinctrl 5 0>; }; power_green { - label = "96368MVNgr:green:power"; + label = "green:power"; gpios = <&pinctrl 22 0>; default-state = "on"; }; wps_green { - label = "96368MVNgr:green:wps"; + label = "green:wps"; gpios = <&pinctrl 23 1>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6368-brcm-bcm96368mvwg.dts b/target/linux/bcm63xx/dts/bcm6368-brcm-bcm96368mvwg.dts index ba9fcbe12a..664e3e02f5 100644 --- a/target/linux/bcm63xx/dts/bcm6368-brcm-bcm96368mvwg.dts +++ b/target/linux/bcm63xx/dts/bcm6368-brcm-bcm96368mvwg.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6368.dtsi" #include @@ -17,24 +15,24 @@ compatible = "gpio-leds"; dsl_green { - label = "96368MVWG:green:adsl"; + label = "green:adsl"; gpios = <&pinctrl 2 1>; }; ppp_green { - label = "96368MVWG:green:ppp"; + label = "green:ppp"; gpios = <&pinctrl 5 0>; }; power_green { - label = "96368MVWG:green:power"; + label = "green:power"; gpios = <&pinctrl 22 0>; default-state = "on"; }; wps_green { - label = "96368MVWG:green:wps"; + label = "green:wps"; gpios = <&pinctrl 23 1>; }; ppp_fail_red { - label = "96368MVWG:red:ppp-fail"; + label = "red:ppp-fail"; gpios = <&pinctrl 31 0>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6368-comtrend-vr-3025u.dts b/target/linux/bcm63xx/dts/bcm6368-comtrend-vr-3025u.dts index c5a0e1dc21..a237d18ac7 100644 --- a/target/linux/bcm63xx/dts/bcm6368-comtrend-vr-3025u.dts +++ b/target/linux/bcm63xx/dts/bcm6368-comtrend-vr-3025u.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6368.dtsi" #include @@ -38,24 +36,24 @@ compatible = "gpio-leds"; dsl_green { - label = "VR-3025u:green:dsl"; + label = "green:dsl"; gpios = <&pinctrl 2 1>; }; inet_green { - label = "VR-3025u:green:inet"; + label = "green:inet"; gpios = <&pinctrl 5 0>; }; led_power_green: power_green { - label = "VR-3025u:green:power"; + label = "green:power"; gpios = <&pinctrl 22 0>; default-state = "on"; }; power_red { - label = "VR-3025u:red:power"; + label = "red:power"; gpios = <&pinctrl 24 0>; }; inet_red { - label = "VR-3025u:red:inet"; + label = "red:inet"; gpios = <&pinctrl 31 0>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6368-comtrend-vr-3025un.dts b/target/linux/bcm63xx/dts/bcm6368-comtrend-vr-3025un.dts index bd4986312f..2391fb0671 100644 --- a/target/linux/bcm63xx/dts/bcm6368-comtrend-vr-3025un.dts +++ b/target/linux/bcm63xx/dts/bcm6368-comtrend-vr-3025un.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6368.dtsi" #include @@ -38,24 +36,24 @@ compatible = "gpio-leds"; dsl_green { - label = "VR-3025un:green:dsl"; + label = "green:dsl"; gpios = <&pinctrl 2 1>; }; inet_green { - label = "VR-3025un:green:inet"; + label = "green:inet"; gpios = <&pinctrl 5 0>; }; led_power_green: power_green { - label = "VR-3025un:green:power"; + label = "green:power"; gpios = <&pinctrl 22 0>; default-state = "on"; }; power_red { - label = "VR-3025un:red:power"; + label = "red:power"; gpios = <&pinctrl 24 0>; }; inet_red { - label = "VR-3025un:red:inet"; + label = "red:inet"; gpios = <&pinctrl 31 0>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6368-comtrend-vr-3026e.dts b/target/linux/bcm63xx/dts/bcm6368-comtrend-vr-3026e.dts index 705c764c91..b17439ea23 100644 --- a/target/linux/bcm63xx/dts/bcm6368-comtrend-vr-3026e.dts +++ b/target/linux/bcm63xx/dts/bcm6368-comtrend-vr-3026e.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6368.dtsi" #include @@ -38,24 +36,24 @@ compatible = "gpio-leds"; dsl_green { - label = "VR-3026e:green:dsl"; + label = "green:dsl"; gpios = <&pinctrl 2 1>; }; inet_green { - label = "VR-3026e:green:inet"; + label = "green:inet"; gpios = <&pinctrl 5 0>; }; led_power_green: power_green { - label = "VR-3026e:green:power"; + label = "green:power"; gpios = <&pinctrl 22 0>; default-state = "on"; }; power_red { - label = "VR-3026e:red:power"; + label = "red:power"; gpios = <&pinctrl 24 0>; }; inet_red { - label = "VR-3026e:red:inet"; + label = "red:inet"; gpios = <&pinctrl 31 0>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6368-huawei-echolife-hg622.dts b/target/linux/bcm63xx/dts/bcm6368-huawei-echolife-hg622.dts index 37893bd163..95e482bca3 100644 --- a/target/linux/bcm63xx/dts/bcm6368-huawei-echolife-hg622.dts +++ b/target/linux/bcm63xx/dts/bcm6368-huawei-echolife-hg622.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6368.dtsi" #include @@ -32,19 +30,19 @@ compatible = "gpio-leds"; dsl_green { - label = "HG622:green:dsl"; + label = "green:dsl"; gpios = <&pinctrl 2 1>; }; inet_green { - label = "HG622:green:inet"; + label = "green:inet"; gpios = <&pinctrl 5 1>; }; usb_green { - label = "HG622:green:usb"; + label = "green:usb"; gpios = <&pinctrl 11 1>; }; power_green { - label = "HG622:green:power"; + label = "green:power"; gpios = <&pinctrl 22 1>; default-state = "on"; }; diff --git a/target/linux/bcm63xx/dts/bcm6368-huawei-echolife-hg655b.dts b/target/linux/bcm63xx/dts/bcm6368-huawei-echolife-hg655b.dts index 1ad87a9940..124b5ca1b7 100644 --- a/target/linux/bcm63xx/dts/bcm6368-huawei-echolife-hg655b.dts +++ b/target/linux/bcm63xx/dts/bcm6368-huawei-echolife-hg655b.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6368.dtsi" #include @@ -52,29 +50,29 @@ compatible = "gpio-leds"; dsl_green { - label = "HW65x:green:dsl"; + label = "green:dsl"; gpios = <&pinctrl 2 1>; }; internet_green { - label = "HW65x:green:internet"; + label = "green:internet"; gpios = <&pinctrl 5 1>; }; usb_green { - label = "HW65x:green:usb"; + label = "green:usb"; gpios = <&pinctrl 14 1>; }; led_power_green: power_green { - label = "HW65x:green:power"; + label = "green:power"; gpios = <&pinctrl 22 1>; default-state = "on"; }; voip_green { - label = "HW65x:green:voip"; + label = "green:voip"; gpios = <&pinctrl 25 1>; }; wps_green { - label = "HW65x:green:wps"; + label = "green:wps"; gpios = <&pinctrl 27 1>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6368-netgear-dgnd3700-v1.dts b/target/linux/bcm63xx/dts/bcm6368-netgear-dgnd3700-v1.dts index ab1c96f5a7..700adea4c1 100644 --- a/target/linux/bcm63xx/dts/bcm6368-netgear-dgnd3700-v1.dts +++ b/target/linux/bcm63xx/dts/bcm6368-netgear-dgnd3700-v1.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6368.dtsi" #include @@ -52,48 +50,48 @@ compatible = "gpio-leds"; dsl_green { - label = "DGND3700v1_3800B:green:dsl"; + label = "green:dsl"; gpios = <&pinctrl 2 1>; }; inet_red { - label = "DGND3700v1_3800B:red:inet"; + label = "red:inet"; gpios = <&pinctrl 4 1>; }; inet_green { - label = "DGND3700v1_3800B:green:inet"; + label = "green:inet"; gpios = <&pinctrl 5 1>; }; wps_green { - label = "DGND3700v1_3800B:green:wps"; + label = "green:wps"; gpios = <&pinctrl 11 1>; }; usbfront_green { - label = "DGND3700v1_3800B:green:usb-front"; + label = "green:usb-front"; gpios = <&pinctrl 13 1>; }; usbback_green { - label = "DGND3700v1_3800B:green:usb-back"; + label = "green:usb-back"; gpios = <&pinctrl 14 1>; }; power_red { - label = "DGND3700v1_3800B:red:power"; + label = "red:power"; gpios = <&pinctrl 22 1>; }; lan_green { - label = "DGND3700v1_3800B:green:lan"; + label = "green:lan"; gpios = <&pinctrl 23 1>; }; led_power_green: power_green { - label = "DGND3700v1_3800B:green:power"; + label = "green:power"; gpios = <&pinctrl 24 1>; default-state = "on"; }; wifi2g_green { - label = "DGND3700v1_3800B:green:wifi2g"; + label = "green:wifi2g"; gpios = <&pinctrl 26 1>; }; wifi5g_blue { - label = "DGND3700v1_3800B:blue:wifi5g"; + label = "blue:wifi5g"; gpios = <&pinctrl 27 1>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6368-observa-vh4032n.dts b/target/linux/bcm63xx/dts/bcm6368-observa-vh4032n.dts index af65ded980..9ed3cc23d0 100644 --- a/target/linux/bcm63xx/dts/bcm6368-observa-vh4032n.dts +++ b/target/linux/bcm63xx/dts/bcm6368-observa-vh4032n.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6368.dtsi" #include @@ -45,36 +43,36 @@ compatible = "gpio-leds"; dsl_blue { - label = "VH4032N:blue:dsl"; + label = "blue:dsl"; gpios = <&pinctrl 2 1>; }; dsl_red { - label = "VH4032N:red:dsl"; + label = "red:dsl"; gpios = <&pinctrl 5 1>; }; hspa_blue { - label = "VH4032N:blue:hspa"; + label = "blue:hspa"; gpios = <&pinctrl 11 1>; }; hspa_red { - label = "VH4032N:red:hspa"; + label = "red:hspa"; gpios = <&pinctrl 12 1>; }; led_power_blue: power_blue { - label = "VH4032N:blue:power"; + label = "blue:power"; gpios = <&pinctrl 22 0>; default-state = "on"; }; power_red { - label = "VH4032N:red:power"; + label = "red:power"; gpios = <&pinctrl 24 0>; }; voice_blue { - label = "VH4032N:blue:voice"; + label = "blue:voice"; gpios = <&pinctrl 25 1>; }; voice_red { - label = "VH4032N:red:voice"; + label = "red:voice"; gpios = <&pinctrl 26 1>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6368-zyxel-p870hw-51a-v2.dts b/target/linux/bcm63xx/dts/bcm6368-zyxel-p870hw-51a-v2.dts index d990a30af5..0bc66fb031 100644 --- a/target/linux/bcm63xx/dts/bcm6368-zyxel-p870hw-51a-v2.dts +++ b/target/linux/bcm63xx/dts/bcm6368-zyxel-p870hw-51a-v2.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6368.dtsi" #include @@ -45,24 +43,24 @@ compatible = "gpio-leds"; led_power_green: power_green { - label = "P870HW-51a:green:power"; + label = "green:power"; gpios = <&pinctrl 0 0>; default-state = "on"; }; dsl_green { - label = "P870HW-51a:green:dsl"; + label = "green:dsl"; gpios = <&pinctrl 2 1>; }; inet_green { - label = "P870HW-51a:green:inet"; + label = "green:inet"; gpios = <&pinctrl 22 1>; }; wps_orange { - label = "P870HW-51a:orange:wps"; + label = "orange:wps"; gpios = <&pinctrl 24 1>; }; inet_red { - label = "P870HW-51a:red:inet"; + label = "red:inet"; gpios = <&pinctrl 33 1>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6368.dtsi b/target/linux/bcm63xx/dts/bcm6368.dtsi index b539020c21..0e9610dbc5 100644 --- a/target/linux/bcm63xx/dts/bcm6368.dtsi +++ b/target/linux/bcm63xx/dts/bcm6368.dtsi @@ -1,3 +1,5 @@ +/dts-v1/; + / { #address-cells = <1>; #size-cells = <1>; diff --git a/target/linux/bcm63xx/dts/bcm6369-comtrend-wap-5813n.dts b/target/linux/bcm63xx/dts/bcm6369-comtrend-wap-5813n.dts index 7cbc5d6c37..2f0ec53e34 100644 --- a/target/linux/bcm63xx/dts/bcm6369-comtrend-wap-5813n.dts +++ b/target/linux/bcm63xx/dts/bcm6369-comtrend-wap-5813n.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6368.dtsi" #include @@ -52,24 +50,24 @@ compatible = "gpio-leds"; inet_green { - label = "WAP-5813n:green:inet"; + label = "green:inet"; gpios = <&pinctrl 5 0>; }; led_power_green: power_green { - label = "WAP-5813n:green:power"; + label = "green:power"; gpios = <&pinctrl 22 0>; default-state = "on"; }; wps_green { - label = "WAP-5813n:green:wps"; + label = "green:wps"; gpios = <&pinctrl 23 1>; }; power_red { - label = "WAP-5813n:red:power"; + label = "red:power"; gpios = <&pinctrl 24 0>; }; inet_red { - label = "WAP-5813n:red:inet"; + label = "red:inet"; gpios = <&pinctrl 31 0>; }; }; diff --git a/target/linux/bcm63xx/dts/bcm6369-netgear-evg2000.dts b/target/linux/bcm63xx/dts/bcm6369-netgear-evg2000.dts index 77228115d9..b96ba7eb65 100644 --- a/target/linux/bcm63xx/dts/bcm6369-netgear-evg2000.dts +++ b/target/linux/bcm63xx/dts/bcm6369-netgear-evg2000.dts @@ -1,5 +1,3 @@ -/dts-v1/; - #include "bcm6368.dtsi" #include @@ -45,44 +43,44 @@ compatible = "gpio-leds"; voip1_green { - label = "EVG2000:green:voip1"; + label = "green:voip1"; gpios = <&pinctrl 14 1>; }; voip2_green { - label = "EVG2000:green:voip2"; + label = "green:voip2"; gpios = <&pinctrl 2 1>; }; inet_red { - label = "EVG2000:red:inet"; + label = "red:inet"; gpios = <&pinctrl 4 1>; }; inet_green { - label = "EVG2000:green:inet"; + label = "green:inet"; gpios = <&pinctrl 5 1>; }; usb_green { - label = "EVG2000:green:usb"; + label = "green:usb"; gpios = <&pinctrl 15 1>; }; led_power_green: power_green { - label = "EVG2000:green:power"; + label = "green:power"; gpios = <&pinctrl 22 1>; default-state = "on"; }; power_red { - label = "EVG2000:red:power"; + label = "red:power"; gpios = <&pinctrl 23 1>; }; lan_green { - label = "EVG2000:green:lan"; + label = "green:lan"; gpios = <&pinctrl 24 1>; }; wireless_green { - label = "EVG2000:green:wireless"; + label = "green:wireless"; gpios = <&pinctrl 26 1>; }; wan_green { - label = "EVG2000:green:wan"; + label = "green:wan"; gpios = <&pinctrl 27 1>; }; }; diff --git a/target/linux/generic/config-4.19 b/target/linux/generic/config-4.19 index 329a5d588f..68665d4b0b 100644 --- a/target/linux/generic/config-4.19 +++ b/target/linux/generic/config-4.19 @@ -1403,10 +1403,12 @@ CONFIG_EXTRA_TARGETS="" # CONFIG_EXYNOS_VIDEO is not set # CONFIG_EZCHIP_NPS_MANAGEMENT_ENET is not set # CONFIG_EZX_PCAP is not set +# CONFIG_F2FS_CHECK_FS is not set # CONFIG_F2FS_FAULT_INJECTION is not set # CONFIG_F2FS_FS is not set # CONFIG_F2FS_FS_ENCRYPTION is not set # CONFIG_F2FS_FS_POSIX_ACL is not set +# CONFIG_F2FS_FS_SECURITY is not set CONFIG_F2FS_FS_XATTR=y # CONFIG_F2FS_IO_TRACE is not set CONFIG_F2FS_STAT_FS=y @@ -5816,7 +5818,7 @@ CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV=y # CONFIG_V4L_TEST_DRIVERS is not set # CONFIG_VBOXGUEST is not set # CONFIG_VCNL4000 is not set -# CONFIG_VDSO is not set +CONFIG_VDSO=y # CONFIG_VEML6070 is not set # CONFIG_VETH is not set # CONFIG_VEXPRESS_CONFIG is not set diff --git a/target/linux/generic/config-5.4 b/target/linux/generic/config-5.4 index c144933272..f505c2af76 100644 --- a/target/linux/generic/config-5.4 +++ b/target/linux/generic/config-5.4 @@ -6220,7 +6220,7 @@ CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV=y # CONFIG_VBOXGUEST is not set # CONFIG_VCNL4000 is not set # CONFIG_VCNL4035 is not set -# CONFIG_VDSO is not set +CONFIG_VDSO=y # CONFIG_VEML6070 is not set # CONFIG_VETH is not set # CONFIG_VEXPRESS_CONFIG is not set diff --git a/target/linux/generic/hack-5.4/700-swconfig_switch_drivers.patch b/target/linux/generic/hack-5.4/700-swconfig_switch_drivers.patch index b1b7ce7d04..ddb642728b 100644 --- a/target/linux/generic/hack-5.4/700-swconfig_switch_drivers.patch +++ b/target/linux/generic/hack-5.4/700-swconfig_switch_drivers.patch @@ -12,7 +12,7 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig -@@ -249,6 +249,89 @@ config LED_TRIGGER_PHY +@@ -250,6 +250,89 @@ config LED_TRIGGER_PHY for any speed known to the PHY. diff --git a/target/linux/generic/pending-5.4/120-Fix-alloc_node_mem_map-with-ARCH_PFN_OFFSET-calcu.patch b/target/linux/generic/pending-5.4/120-Fix-alloc_node_mem_map-with-ARCH_PFN_OFFSET-calcu.patch index e70b660604..a8a0e27599 100644 --- a/target/linux/generic/pending-5.4/120-Fix-alloc_node_mem_map-with-ARCH_PFN_OFFSET-calcu.patch +++ b/target/linux/generic/pending-5.4/120-Fix-alloc_node_mem_map-with-ARCH_PFN_OFFSET-calcu.patch @@ -71,7 +71,7 @@ Signed-off-by: Tobias Wolf --- a/mm/page_alloc.c +++ b/mm/page_alloc.c -@@ -6860,7 +6860,7 @@ static void __ref alloc_node_mem_map(str +@@ -6861,7 +6861,7 @@ static void __ref alloc_node_mem_map(str mem_map = NODE_DATA(0)->node_mem_map; #if defined(CONFIG_HAVE_MEMBLOCK_NODE_MAP) || defined(CONFIG_FLATMEM) if (page_to_pfn(mem_map) != pgdat->node_start_pfn) diff --git a/target/linux/generic/pending-5.4/752-net-phy-add-Broadcom-BCM84881-PHY-driver.patch b/target/linux/generic/pending-5.4/752-net-phy-add-Broadcom-BCM84881-PHY-driver.patch index 8929f1f19e..783dec0479 100644 --- a/target/linux/generic/pending-5.4/752-net-phy-add-Broadcom-BCM84881-PHY-driver.patch +++ b/target/linux/generic/pending-5.4/752-net-phy-add-Broadcom-BCM84881-PHY-driver.patch @@ -18,7 +18,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig -@@ -329,6 +329,12 @@ config BROADCOM_PHY +@@ -330,6 +330,12 @@ config BROADCOM_PHY Currently supports the BCM5411, BCM5421, BCM5461, BCM54616S, BCM5464, BCM5481, BCM54810 and BCM5482 PHYs. diff --git a/target/linux/generic/pending-5.4/770-13-net-ethernet-mtk_eth_soc-fix-parsing-packets-in-GDM.patch b/target/linux/generic/pending-5.4/770-13-net-ethernet-mtk_eth_soc-fix-parsing-packets-in-GDM.patch index 36a52bbc06..9ef675dcd1 100644 --- a/target/linux/generic/pending-5.4/770-13-net-ethernet-mtk_eth_soc-fix-parsing-packets-in-GDM.patch +++ b/target/linux/generic/pending-5.4/770-13-net-ethernet-mtk_eth_soc-fix-parsing-packets-in-GDM.patch @@ -18,14 +18,7 @@ Signed-off-by: Felix Fietkau #include "mtk_eth_soc.h" -@@ -1240,12 +1241,14 @@ static int mtk_poll_rx(struct napi_struc - u8 *data, *new_data; - struct mtk_rx_dma *rxd, trxd; - int done = 0, bytes = 0; -+ bool uses_dsa = eth->netdev[0] && netdev_uses_dsa(eth->netdev[0]); - - while (done < budget) { - struct net_device *netdev; +@@ -1246,6 +1247,7 @@ static int mtk_poll_rx(struct napi_struc unsigned int pktlen; dma_addr_t dma_addr; int mac; @@ -33,27 +26,26 @@ Signed-off-by: Felix Fietkau ring = mtk_get_rx_ring(eth); if (unlikely(!ring)) -@@ -1259,13 +1262,13 @@ static int mtk_poll_rx(struct napi_struc +@@ -1259,13 +1261,12 @@ static int mtk_poll_rx(struct napi_struc break; /* find out which mac the packet come from. values start at 1 */ - if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) { -+ if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) ++ if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628) || ++ (trxd.rxd4 & RX_DMA_SPECIAL_TAG)) mac = 0; - } else { - mac = (trxd.rxd4 >> RX_DMA_FPORT_SHIFT) & - RX_DMA_FPORT_MASK; - mac--; - } -+ else if (uses_dsa) -+ mac = !(trxd.rxd4 >> 22); + else + mac = ((trxd.rxd4 >> RX_DMA_FPORT_SHIFT) & + RX_DMA_FPORT_MASK) - 1; if (unlikely(mac < 0 || mac >= MTK_MAC_COUNT || !eth->netdev[mac])) -@@ -2247,6 +2250,9 @@ static void mtk_gdm_config(struct mtk_et +@@ -2247,6 +2248,9 @@ static void mtk_gdm_config(struct mtk_et val |= config; @@ -73,3 +65,11 @@ Signed-off-by: Felix Fietkau #define MTK_GDMA_ICS_EN BIT(22) #define MTK_GDMA_TCS_EN BIT(21) #define MTK_GDMA_UCS_EN BIT(20) +@@ -311,6 +312,7 @@ + #define RX_DMA_L4_VALID_PDMA BIT(30) /* when PDMA is used */ + #define RX_DMA_FPORT_SHIFT 19 + #define RX_DMA_FPORT_MASK 0x7 ++#define RX_DMA_SPECIAL_TAG BIT(22) + + /* PHY Indirect Access Control registers */ + #define MTK_PHY_IAC 0x10004 diff --git a/target/linux/generic/pending-5.4/770-14-net-ethernet-mtk_eth_soc-set-PPE-flow-hash-as-skb-ha.patch b/target/linux/generic/pending-5.4/770-14-net-ethernet-mtk_eth_soc-set-PPE-flow-hash-as-skb-ha.patch index 384af9d21d..60ac12c013 100644 --- a/target/linux/generic/pending-5.4/770-14-net-ethernet-mtk_eth_soc-set-PPE-flow-hash-as-skb-ha.patch +++ b/target/linux/generic/pending-5.4/770-14-net-ethernet-mtk_eth_soc-set-PPE-flow-hash-as-skb-ha.patch @@ -10,7 +10,7 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -1318,6 +1318,10 @@ static int mtk_poll_rx(struct napi_struc +@@ -1316,6 +1316,10 @@ static int mtk_poll_rx(struct napi_struc skb->protocol = eth_type_trans(skb, netdev); bytes += pktlen; diff --git a/target/linux/generic/pending-5.4/770-15-net-ethernet-mediatek-mtk_eth_soc-add-support-for-in.patch b/target/linux/generic/pending-5.4/770-15-net-ethernet-mediatek-mtk_eth_soc-add-support-for-in.patch new file mode 100644 index 0000000000..6d729c0f08 --- /dev/null +++ b/target/linux/generic/pending-5.4/770-15-net-ethernet-mediatek-mtk_eth_soc-add-support-for-in.patch @@ -0,0 +1,1058 @@ +From: Felix Fietkau +Date: Sun, 11 Oct 2020 22:23:08 +0200 +Subject: [PATCH] ethernet: mediatek: mtk_eth_soc: add support for + initializing the PPE + +The PPE (packet processing engine) is used to offload NAT/routed or even +bridged flows. This patch brings up the PPE and uses it to get a packet +hash. It also contains some functionality that will be used to bring up +flow offloading later + +Signed-off-by: Felix Fietkau +--- + create mode 100644 drivers/net/ethernet/mediatek/mtk_ppe.c + create mode 100644 drivers/net/ethernet/mediatek/mtk_ppe.h + create mode 100644 drivers/net/ethernet/mediatek/mtk_ppe_regs.h + +--- a/drivers/net/ethernet/mediatek/Makefile ++++ b/drivers/net/ethernet/mediatek/Makefile +@@ -4,4 +4,4 @@ + # + + obj-$(CONFIG_NET_MEDIATEK_SOC) += mtk_eth.o +-mtk_eth-y := mtk_eth_soc.o mtk_sgmii.o mtk_eth_path.o ++mtk_eth-y := mtk_eth_soc.o mtk_sgmii.o mtk_eth_path.o mtk_ppe.o +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +@@ -2277,12 +2277,17 @@ static int mtk_open(struct net_device *d + + /* we run 2 netdevs on the same dma ring so we only bring it up once */ + if (!refcount_read(ð->dma_refcnt)) { +- int err = mtk_start_dma(eth); ++ u32 gdm_config = MTK_GDMA_TO_PDMA; ++ int err; + ++ err = mtk_start_dma(eth); + if (err) + return err; + +- mtk_gdm_config(eth, MTK_GDMA_TO_PDMA); ++ if (eth->soc->offload_version && mtk_ppe_start(ð->ppe) == 0) ++ gdm_config = MTK_GDMA_TO_PPE; ++ ++ mtk_gdm_config(eth, gdm_config); + + napi_enable(ð->tx_napi); + napi_enable(ð->rx_napi); +@@ -2352,6 +2357,9 @@ static int mtk_stop(struct net_device *d + + mtk_dma_free(eth); + ++ if (eth->soc->offload_version) ++ mtk_ppe_stop(ð->ppe); ++ + return 0; + } + +@@ -3141,6 +3149,13 @@ static int mtk_probe(struct platform_dev + goto err_free_dev; + } + ++ if (eth->soc->offload_version) { ++ err = mtk_ppe_init(ð->ppe, eth->dev, ++ eth->base + MTK_ETH_PPE_BASE, 2); ++ if (err) ++ goto err_free_dev; ++ } ++ + for (i = 0; i < MTK_MAX_DEVS; i++) { + if (!eth->netdev[i]) + continue; +@@ -3215,6 +3230,7 @@ static const struct mtk_soc_data mt7621_ + .hw_features = MTK_HW_FEATURES, + .required_clks = MT7621_CLKS_BITMAP, + .required_pctl = false, ++ .offload_version = 2, + }; + + static const struct mtk_soc_data mt7622_data = { +@@ -3223,6 +3239,7 @@ static const struct mtk_soc_data mt7622_ + .hw_features = MTK_HW_FEATURES, + .required_clks = MT7622_CLKS_BITMAP, + .required_pctl = false, ++ .offload_version = 2, + }; + + static const struct mtk_soc_data mt7623_data = { +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h +@@ -16,6 +16,7 @@ + #include + #include + #include ++#include "mtk_ppe.h" + + #define MTK_QDMA_PAGE_SIZE 2048 + #define MTK_MAX_RX_LENGTH 1536 +@@ -87,6 +88,7 @@ + #define MTK_GDMA_TCS_EN BIT(21) + #define MTK_GDMA_UCS_EN BIT(20) + #define MTK_GDMA_TO_PDMA 0x0 ++#define MTK_GDMA_TO_PPE 0x4444 + #define MTK_GDMA_DROP_ALL 0x7777 + + /* Unicast Filter MAC Address Register - Low */ +@@ -308,6 +310,12 @@ + #define RX_DMA_VID(_x) ((_x) & 0xfff) + + /* QDMA descriptor rxd4 */ ++#define MTK_RXD4_FOE_ENTRY GENMASK(13, 0) ++#define MTK_RXD4_PPE_CPU_REASON GENMASK(18, 14) ++#define MTK_RXD4_SRC_PORT GENMASK(21, 19) ++#define MTK_RXD4_ALG GENMASK(31, 22) ++ ++/* QDMA descriptor rxd4 */ + #define RX_DMA_L4_VALID BIT(24) + #define RX_DMA_L4_VALID_PDMA BIT(30) /* when PDMA is used */ + #define RX_DMA_FPORT_SHIFT 19 +@@ -807,6 +815,7 @@ struct mtk_soc_data { + u32 caps; + u32 required_clks; + bool required_pctl; ++ u8 offload_version; + netdev_features_t hw_features; + }; + +@@ -918,6 +927,8 @@ struct mtk_eth { + u32 tx_int_status_reg; + u32 rx_dma_l4_valid; + int ip_align; ++ ++ struct mtk_ppe ppe; + }; + + /* struct mtk_mac - the structure that holds the info about the MACs of the +--- /dev/null ++++ b/drivers/net/ethernet/mediatek/mtk_ppe.c +@@ -0,0 +1,497 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++/* Copyright (C) 2020 Felix Fietkau */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include "mtk_ppe.h" ++#include "mtk_ppe_regs.h" ++ ++static void ppe_w32(struct mtk_ppe *ppe, u32 reg, u32 val) ++{ ++ writel(val, ppe->base + reg); ++} ++ ++static u32 ppe_r32(struct mtk_ppe *ppe, u32 reg) ++{ ++ return readl(ppe->base + reg); ++} ++ ++static u32 ppe_m32(struct mtk_ppe *ppe, u32 reg, u32 mask, u32 set) ++{ ++ u32 val; ++ ++ val = ppe_r32(ppe, reg); ++ val &= ~mask; ++ val |= set; ++ ppe_w32(ppe, reg, val); ++ ++ return val; ++} ++ ++static u32 ppe_set(struct mtk_ppe *ppe, u32 reg, u32 val) ++{ ++ return ppe_m32(ppe, reg, 0, val); ++} ++ ++static u32 ppe_clear(struct mtk_ppe *ppe, u32 reg, u32 val) ++{ ++ return ppe_m32(ppe, reg, val, 0); ++} ++ ++static int mtk_ppe_wait_busy(struct mtk_ppe *ppe) ++{ ++ unsigned long timeout = jiffies + HZ; ++ ++ while (time_is_before_jiffies(timeout)) { ++ if (!(ppe_r32(ppe, MTK_PPE_GLO_CFG) & MTK_PPE_GLO_CFG_BUSY)) ++ return 0; ++ ++ usleep_range(10, 20); ++ } ++ ++ dev_err(ppe->dev, "PPE table busy"); ++ ++ return -ETIMEDOUT; ++} ++ ++static void mtk_ppe_cache_clear(struct mtk_ppe *ppe) ++{ ++ ppe_set(ppe, MTK_PPE_CACHE_CTL, MTK_PPE_CACHE_CTL_CLEAR); ++ ppe_clear(ppe, MTK_PPE_CACHE_CTL, MTK_PPE_CACHE_CTL_CLEAR); ++} ++ ++static void mtk_ppe_cache_enable(struct mtk_ppe *ppe, bool enable) ++{ ++ mtk_ppe_cache_clear(ppe); ++ ++ ppe_m32(ppe, MTK_PPE_CACHE_CTL, MTK_PPE_CACHE_CTL_EN, ++ enable * MTK_PPE_CACHE_CTL_EN); ++} ++ ++static u32 mtk_ppe_hash_entry(struct mtk_foe_entry *e) ++{ ++ u32 hv1, hv2, hv3; ++ u32 hash; ++ ++ switch (FIELD_GET(MTK_FOE_IB1_PACKET_TYPE, e->ib1)) { ++ case MTK_PPE_PKT_TYPE_BRIDGE: ++ hv1 = e->bridge.src_mac_lo; ++ hv1 ^= ((e->bridge.src_mac_hi & 0xffff) << 16); ++ hv2 = e->bridge.src_mac_hi >> 16; ++ hv2 ^= e->bridge.dest_mac_lo; ++ hv3 = e->bridge.dest_mac_hi; ++ break; ++ case MTK_PPE_PKT_TYPE_IPV4_ROUTE: ++ case MTK_PPE_PKT_TYPE_IPV4_HNAPT: ++ hv1 = e->ipv4.orig.ports; ++ hv2 = e->ipv4.orig.dest_ip; ++ hv3 = e->ipv4.orig.src_ip; ++ break; ++ case MTK_PPE_PKT_TYPE_IPV6_ROUTE_3T: ++ case MTK_PPE_PKT_TYPE_IPV6_ROUTE_5T: ++ hv1 = e->ipv6.src_ip[3] ^ e->ipv6.dest_ip[3]; ++ hv1 ^= e->ipv6.ports; ++ ++ hv2 = e->ipv6.src_ip[2] ^ e->ipv6.dest_ip[2]; ++ hv2 ^= e->ipv6.dest_ip[0]; ++ ++ hv3 = e->ipv6.src_ip[1] ^ e->ipv6.dest_ip[1]; ++ hv3 ^= e->ipv6.src_ip[0]; ++ break; ++ case MTK_PPE_PKT_TYPE_IPV4_DSLITE: ++ case MTK_PPE_PKT_TYPE_IPV6_6RD: ++ default: ++ WARN_ON_ONCE(1); ++ return MTK_PPE_HASH_MASK; ++ } ++ ++ hash = (hv1 & hv2) | ((~hv1) & hv3); ++ hash = (hash >> 24) | ((hash & 0xffffff) << 8); ++ hash ^= hv1 ^ hv2 ^ hv3; ++ hash ^= hash >> 16; ++ hash <<= 1; ++ hash &= MTK_PPE_ENTRIES - 1; ++ ++ return hash; ++} ++ ++static inline struct mtk_foe_mac_info * ++mtk_foe_entry_l2(struct mtk_foe_entry *entry) ++{ ++ int type = FIELD_GET(MTK_FOE_IB1_PACKET_TYPE, entry->ib1); ++ ++ if (type >= MTK_PPE_PKT_TYPE_IPV4_DSLITE) ++ return &entry->ipv6.l2; ++ ++ return &entry->ipv4.l2; ++} ++ ++static inline u32 * ++mtk_foe_entry_ib2(struct mtk_foe_entry *entry) ++{ ++ int type = FIELD_GET(MTK_FOE_IB1_PACKET_TYPE, entry->ib1); ++ ++ if (type >= MTK_PPE_PKT_TYPE_IPV4_DSLITE) ++ return &entry->ipv6.ib2; ++ ++ return &entry->ipv4.ib2; ++} ++ ++int mtk_foe_entry_prepare(struct mtk_foe_entry *entry, int type, int l4proto, ++ u8 pse_port, u8 *src_mac, u8 *dest_mac) ++{ ++ struct mtk_foe_mac_info *l2; ++ u32 ports_pad, val; ++ ++ memset(entry, 0, sizeof(*entry)); ++ ++ val = FIELD_PREP(MTK_FOE_IB1_STATE, MTK_FOE_STATE_BIND) | ++ FIELD_PREP(MTK_FOE_IB1_PACKET_TYPE, type) | ++ FIELD_PREP(MTK_FOE_IB1_UDP, l4proto == IPPROTO_UDP) | ++ MTK_FOE_IB1_BIND_TTL | ++ MTK_FOE_IB1_BIND_CACHE | ++ MTK_FOE_IB1_BIND_KEEPALIVE; ++ entry->ib1 = val; ++ ++ val = FIELD_PREP(MTK_FOE_IB2_PORT_MG, 0x3f) | ++ FIELD_PREP(MTK_FOE_IB2_PORT_AG, 0x1f) | ++ FIELD_PREP(MTK_FOE_IB2_DEST_PORT, pse_port); ++ ++ if (is_multicast_ether_addr(dest_mac)) ++ val |= MTK_FOE_IB2_MULTICAST; ++ ++ ports_pad = 0xa5a5a500 | (l4proto & 0xff); ++ if (type == MTK_PPE_PKT_TYPE_IPV4_ROUTE) ++ entry->ipv4.orig.ports = ports_pad; ++ if (type == MTK_PPE_PKT_TYPE_IPV6_ROUTE_3T) ++ entry->ipv6.ports = ports_pad; ++ ++ if (type >= MTK_PPE_PKT_TYPE_IPV4_DSLITE) { ++ entry->ipv6.ib2 = val; ++ l2 = &entry->ipv6.l2; ++ } else { ++ entry->ipv4.ib2 = val; ++ l2 = &entry->ipv4.l2; ++ } ++ ++ l2->dest_mac_hi = get_unaligned_be32(dest_mac); ++ l2->dest_mac_lo = get_unaligned_be16(dest_mac + 4); ++ l2->src_mac_hi = get_unaligned_be32(src_mac); ++ l2->src_mac_lo = get_unaligned_be16(src_mac + 4); ++ ++ if (type >= MTK_PPE_PKT_TYPE_IPV6_ROUTE_3T) ++ l2->etype = ETH_P_IPV6; ++ else ++ l2->etype = ETH_P_IP; ++ ++ return 0; ++} ++ ++int mtk_foe_entry_set_ipv4_tuple(struct mtk_foe_entry *entry, bool egress, ++ __be32 src_addr, __be16 src_port, ++ __be32 dest_addr, __be16 dest_port) ++{ ++ int type = FIELD_GET(MTK_FOE_IB1_PACKET_TYPE, entry->ib1); ++ struct mtk_ipv4_tuple *t; ++ ++ switch (type) { ++ case MTK_PPE_PKT_TYPE_IPV4_HNAPT: ++ if (egress) { ++ t = &entry->ipv4.new; ++ break; ++ } ++ fallthrough; ++ case MTK_PPE_PKT_TYPE_IPV4_DSLITE: ++ case MTK_PPE_PKT_TYPE_IPV4_ROUTE: ++ t = &entry->ipv4.orig; ++ break; ++ case MTK_PPE_PKT_TYPE_IPV6_6RD: ++ entry->ipv6_6rd.tunnel_src_ip = be32_to_cpu(src_addr); ++ entry->ipv6_6rd.tunnel_dest_ip = be32_to_cpu(dest_addr); ++ return 0; ++ default: ++ WARN_ON_ONCE(1); ++ return -EINVAL; ++ } ++ ++ t->src_ip = be32_to_cpu(src_addr); ++ t->dest_ip = be32_to_cpu(dest_addr); ++ ++ if (type == MTK_PPE_PKT_TYPE_IPV4_ROUTE) ++ return 0; ++ ++ t->src_port = be16_to_cpu(src_port); ++ t->dest_port = be16_to_cpu(dest_port); ++ ++ return 0; ++} ++ ++int mtk_foe_entry_set_ipv6_tuple(struct mtk_foe_entry *entry, ++ __be32 *src_addr, __be16 src_port, ++ __be32 *dest_addr, __be16 dest_port) ++{ ++ int type = FIELD_GET(MTK_FOE_IB1_PACKET_TYPE, entry->ib1); ++ u32 *src, *dest; ++ int i; ++ ++ switch (type) { ++ case MTK_PPE_PKT_TYPE_IPV4_DSLITE: ++ src = entry->dslite.tunnel_src_ip; ++ dest = entry->dslite.tunnel_dest_ip; ++ break; ++ case MTK_PPE_PKT_TYPE_IPV6_ROUTE_5T: ++ case MTK_PPE_PKT_TYPE_IPV6_6RD: ++ entry->ipv6.src_port = be16_to_cpu(src_port); ++ entry->ipv6.dest_port = be16_to_cpu(dest_port); ++ fallthrough; ++ case MTK_PPE_PKT_TYPE_IPV6_ROUTE_3T: ++ src = entry->ipv6.src_ip; ++ dest = entry->ipv6.dest_ip; ++ break; ++ default: ++ WARN_ON_ONCE(1); ++ return -EINVAL; ++ }; ++ ++ for (i = 0; i < 4; i++) ++ src[i] = be32_to_cpu(src_addr[i]); ++ for (i = 0; i < 4; i++) ++ dest[i] = be32_to_cpu(dest_addr[i]); ++ ++ return 0; ++} ++ ++int mtk_foe_entry_set_dsa(struct mtk_foe_entry *entry, int port) ++{ ++ struct mtk_foe_mac_info *l2 = mtk_foe_entry_l2(entry); ++ ++ l2->etype = BIT(port); ++ ++ if (!(entry->ib1 & MTK_FOE_IB1_BIND_VLAN_LAYER)) ++ entry->ib1 |= FIELD_PREP(MTK_FOE_IB1_BIND_VLAN_LAYER, 1); ++ else ++ l2->etype |= BIT(8); ++ ++ entry->ib1 &= ~MTK_FOE_IB1_BIND_VLAN_TAG; ++ ++ return 0; ++} ++ ++int mtk_foe_entry_set_vlan(struct mtk_foe_entry *entry, int vid) ++{ ++ struct mtk_foe_mac_info *l2 = mtk_foe_entry_l2(entry); ++ ++ switch (FIELD_GET(MTK_FOE_IB1_BIND_VLAN_LAYER, entry->ib1)) { ++ case 0: ++ entry->ib1 |= MTK_FOE_IB1_BIND_VLAN_TAG | ++ FIELD_PREP(MTK_FOE_IB1_BIND_VLAN_LAYER, 1); ++ l2->vlan1 = vid; ++ return 0; ++ case 1: ++ if (!(entry->ib1 & MTK_FOE_IB1_BIND_VLAN_TAG)) { ++ l2->vlan1 = vid; ++ l2->etype |= BIT(8); ++ } else { ++ l2->vlan2 = vid; ++ entry->ib1 += FIELD_PREP(MTK_FOE_IB1_BIND_VLAN_LAYER, 1); ++ } ++ return 0; ++ default: ++ return -ENOSPC; ++ } ++} ++ ++int mtk_foe_entry_set_pppoe(struct mtk_foe_entry *entry, int sid) ++{ ++ struct mtk_foe_mac_info *l2 = mtk_foe_entry_l2(entry); ++ ++ if (!(entry->ib1 & MTK_FOE_IB1_BIND_VLAN_LAYER) || ++ (entry->ib1 & MTK_FOE_IB1_BIND_VLAN_TAG)) ++ l2->etype = ETH_P_PPP_SES; ++ ++ entry->ib1 |= MTK_FOE_IB1_BIND_PPPOE; ++ l2->pppoe_id = sid; ++ ++ return 0; ++} ++ ++static inline bool mtk_foe_entry_usable(struct mtk_foe_entry *entry) ++{ ++ return !(entry->ib1 & MTK_FOE_IB1_STATIC) && ++ FIELD_GET(MTK_FOE_IB1_STATE, entry->ib1) != MTK_FOE_STATE_BIND; ++} ++ ++int mtk_foe_entry_commit(struct mtk_ppe *ppe, struct mtk_foe_entry *entry, ++ u16 timestamp) ++{ ++ struct mtk_foe_entry *hwe; ++ u32 hash; ++ ++ timestamp &= MTK_FOE_IB1_BIND_TIMESTAMP; ++ entry->ib1 &= ~MTK_FOE_IB1_BIND_TIMESTAMP; ++ entry->ib1 |= FIELD_PREP(MTK_FOE_IB1_BIND_TIMESTAMP, timestamp); ++ ++ hash = mtk_ppe_hash_entry(entry); ++ hwe = &ppe->foe_table[hash]; ++ if (!mtk_foe_entry_usable(hwe)) { ++ hwe++; ++ hash++; ++ ++ if (!mtk_foe_entry_usable(hwe)) ++ return -ENOSPC; ++ } ++ ++ memcpy(&hwe->data, &entry->data, sizeof(hwe->data)); ++ wmb(); ++ hwe->ib1 = entry->ib1; ++ ++ dma_wmb(); ++ ++ mtk_ppe_cache_clear(ppe); ++ ++ return hash; ++} ++ ++int mtk_ppe_init(struct mtk_ppe *ppe, struct device *dev, void __iomem *base, ++ int version) ++{ ++ struct mtk_foe_entry *foe; ++ ++ /* need to allocate a separate device, since it PPE DMA access is ++ * not coherent. ++ */ ++ ppe->base = base; ++ ppe->dev = dev; ++ ppe->version = version; ++ ++ foe = dmam_alloc_coherent(ppe->dev, MTK_PPE_ENTRIES * sizeof(*foe), ++ &ppe->foe_phys, GFP_KERNEL); ++ if (!foe) ++ return -ENOMEM; ++ ++ ppe->foe_table = foe; ++ ++ return 0; ++} ++ ++static void mtk_ppe_init_foe_table(struct mtk_ppe *ppe) ++{ ++ static const u8 skip[] = { 12, 25, 38, 51, 76, 89, 102 }; ++ int i, k; ++ ++ memset(ppe->foe_table, 0, MTK_PPE_ENTRIES * sizeof(ppe->foe_table)); ++ ++ if (!IS_ENABLED(CONFIG_SOC_MT7621)) ++ return; ++ ++ /* skip all entries that cross the 1024 byte boundary */ ++ for (i = 0; i < MTK_PPE_ENTRIES; i += 128) ++ for (k = 0; k < ARRAY_SIZE(skip); k++) ++ ppe->foe_table[i + skip[k]].ib1 |= MTK_FOE_IB1_STATIC; ++} ++ ++int mtk_ppe_start(struct mtk_ppe *ppe) ++{ ++ u32 val; ++ ++ mtk_ppe_init_foe_table(ppe); ++ ppe_w32(ppe, MTK_PPE_TB_BASE, ppe->foe_phys); ++ ++ val = MTK_PPE_TB_CFG_ENTRY_80B | ++ MTK_PPE_TB_CFG_AGE_NON_L4 | ++ MTK_PPE_TB_CFG_AGE_UNBIND | ++ MTK_PPE_TB_CFG_AGE_TCP | ++ MTK_PPE_TB_CFG_AGE_UDP | ++ MTK_PPE_TB_CFG_AGE_TCP_FIN | ++ FIELD_PREP(MTK_PPE_TB_CFG_SEARCH_MISS, ++ MTK_PPE_SEARCH_MISS_ACTION_FORWARD_BUILD) | ++ FIELD_PREP(MTK_PPE_TB_CFG_KEEPALIVE, ++ MTK_PPE_KEEPALIVE_DUP_CPU) | ++ FIELD_PREP(MTK_PPE_TB_CFG_HASH_MODE, 1) | ++ FIELD_PREP(MTK_PPE_TB_CFG_SCAN_MODE, ++ MTK_PPE_SCAN_MODE_KEEPALIVE_AGE) | ++ FIELD_PREP(MTK_PPE_TB_CFG_ENTRY_NUM, ++ MTK_PPE_ENTRIES_SHIFT); ++ ppe_w32(ppe, MTK_PPE_TB_CFG, val); ++ ++ ppe_w32(ppe, MTK_PPE_IP_PROTO_CHK, ++ MTK_PPE_IP_PROTO_CHK_IPV4 | MTK_PPE_IP_PROTO_CHK_IPV6); ++ ++ mtk_ppe_cache_enable(ppe, true); ++ ++ val = MTK_PPE_FLOW_CFG_IP4_TCP_FRAG | ++ MTK_PPE_FLOW_CFG_IP4_UDP_FRAG | ++ MTK_PPE_FLOW_CFG_IP6_3T_ROUTE | ++ MTK_PPE_FLOW_CFG_IP6_5T_ROUTE | ++ MTK_PPE_FLOW_CFG_IP6_6RD | ++ MTK_PPE_FLOW_CFG_IP4_NAT | ++ MTK_PPE_FLOW_CFG_IP4_NAPT | ++ MTK_PPE_FLOW_CFG_IP4_DSLITE | ++ MTK_PPE_FLOW_CFG_L2_BRIDGE | ++ MTK_PPE_FLOW_CFG_IP4_NAT_FRAG; ++ ppe_w32(ppe, MTK_PPE_FLOW_CFG, val); ++ ++ val = FIELD_PREP(MTK_PPE_UNBIND_AGE_MIN_PACKETS, 1000) | ++ FIELD_PREP(MTK_PPE_UNBIND_AGE_DELTA, 3); ++ ppe_w32(ppe, MTK_PPE_UNBIND_AGE, val); ++ ++ val = FIELD_PREP(MTK_PPE_BIND_AGE0_DELTA_UDP, 12) | ++ FIELD_PREP(MTK_PPE_BIND_AGE0_DELTA_NON_L4, 1); ++ ppe_w32(ppe, MTK_PPE_BIND_AGE0, val); ++ ++ val = FIELD_PREP(MTK_PPE_BIND_AGE1_DELTA_TCP_FIN, 1) | ++ FIELD_PREP(MTK_PPE_BIND_AGE1_DELTA_TCP, 7); ++ ppe_w32(ppe, MTK_PPE_BIND_AGE1, val); ++ ++ val = MTK_PPE_BIND_LIMIT0_QUARTER | MTK_PPE_BIND_LIMIT0_HALF; ++ ppe_w32(ppe, MTK_PPE_BIND_LIMIT0, val); ++ ++ val = MTK_PPE_BIND_LIMIT1_FULL | ++ FIELD_PREP(MTK_PPE_BIND_LIMIT1_NON_L4, 1); ++ ppe_w32(ppe, MTK_PPE_BIND_LIMIT1, val); ++ ++ val = FIELD_PREP(MTK_PPE_BIND_RATE_BIND, 30) | ++ FIELD_PREP(MTK_PPE_BIND_RATE_PREBIND, 1); ++ ppe_w32(ppe, MTK_PPE_BIND_RATE, val); ++ ++ /* enable PPE */ ++ val = MTK_PPE_GLO_CFG_EN | ++ MTK_PPE_GLO_CFG_IP4_L4_CS_DROP | ++ MTK_PPE_GLO_CFG_IP4_CS_DROP | ++ MTK_PPE_GLO_CFG_FLOW_DROP_UPDATE; ++ ppe_w32(ppe, MTK_PPE_GLO_CFG, val); ++ ++ ppe_w32(ppe, MTK_PPE_DEFAULT_CPU_PORT, 0); ++ ++ return 0; ++} ++ ++int mtk_ppe_stop(struct mtk_ppe *ppe) ++{ ++ u32 val; ++ int i; ++ ++ for (i = 0; i < MTK_PPE_ENTRIES; i++) ++ ppe->foe_table[i].ib1 = FIELD_PREP(MTK_FOE_IB1_STATE, ++ MTK_FOE_STATE_INVALID); ++ ++ mtk_ppe_cache_enable(ppe, false); ++ ++ /* disable offload engine */ ++ ppe_clear(ppe, MTK_PPE_GLO_CFG, MTK_PPE_GLO_CFG_EN); ++ ppe_w32(ppe, MTK_PPE_FLOW_CFG, 0); ++ ++ /* disable aging */ ++ val = MTK_PPE_TB_CFG_AGE_NON_L4 | ++ MTK_PPE_TB_CFG_AGE_UNBIND | ++ MTK_PPE_TB_CFG_AGE_TCP | ++ MTK_PPE_TB_CFG_AGE_UDP | ++ MTK_PPE_TB_CFG_AGE_TCP_FIN; ++ ppe_clear(ppe, MTK_PPE_TB_CFG, val); ++ ++ return mtk_ppe_wait_busy(ppe); ++} +--- /dev/null ++++ b/drivers/net/ethernet/mediatek/mtk_ppe.h +@@ -0,0 +1,274 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++/* Copyright (C) 2020 Felix Fietkau */ ++ ++#ifndef __MTK_PPE_H ++#define __MTK_PPE_H ++ ++#include ++#include ++ ++#define MTK_ETH_PPE_BASE 0xc00 ++ ++#define MTK_PPE_ENTRIES_SHIFT 3 ++#define MTK_PPE_ENTRIES (1024 << MTK_PPE_ENTRIES_SHIFT) ++#define MTK_PPE_HASH_MASK (MTK_PPE_ENTRIES - 1) ++ ++#define MTK_FOE_IB1_UNBIND_TIMESTAMP GENMASK(7, 0) ++#define MTK_FOE_IB1_UNBIND_PACKETS GENMASK(23, 8) ++#define MTK_FOE_IB1_UNBIND_PREBIND BIT(24) ++ ++#define MTK_FOE_IB1_BIND_TIMESTAMP GENMASK(14, 0) ++#define MTK_FOE_IB1_BIND_KEEPALIVE BIT(15) ++#define MTK_FOE_IB1_BIND_VLAN_LAYER GENMASK(18, 16) ++#define MTK_FOE_IB1_BIND_PPPOE BIT(19) ++#define MTK_FOE_IB1_BIND_VLAN_TAG BIT(20) ++#define MTK_FOE_IB1_BIND_PKT_SAMPLE BIT(21) ++#define MTK_FOE_IB1_BIND_CACHE BIT(22) ++#define MTK_FOE_IB1_BIND_TUNNEL_DECAP BIT(23) ++#define MTK_FOE_IB1_BIND_TTL BIT(24) ++ ++#define MTK_FOE_IB1_PACKET_TYPE GENMASK(27, 25) ++#define MTK_FOE_IB1_STATE GENMASK(29, 28) ++#define MTK_FOE_IB1_UDP BIT(30) ++#define MTK_FOE_IB1_STATIC BIT(31) ++ ++enum { ++ MTK_PPE_PKT_TYPE_IPV4_HNAPT = 0, ++ MTK_PPE_PKT_TYPE_IPV4_ROUTE = 1, ++ MTK_PPE_PKT_TYPE_BRIDGE = 2, ++ MTK_PPE_PKT_TYPE_IPV4_DSLITE = 3, ++ MTK_PPE_PKT_TYPE_IPV6_ROUTE_3T = 4, ++ MTK_PPE_PKT_TYPE_IPV6_ROUTE_5T = 5, ++ MTK_PPE_PKT_TYPE_IPV6_6RD = 7, ++}; ++ ++#define MTK_FOE_IB2_QID GENMASK(3, 0) ++#define MTK_FOE_IB2_PSE_QOS BIT(4) ++#define MTK_FOE_IB2_DEST_PORT GENMASK(7, 5) ++#define MTK_FOE_IB2_MULTICAST BIT(8) ++ ++#define MTK_FOE_IB2_WHNAT_QID2 GENMASK(13, 12) ++#define MTK_FOE_IB2_WHNAT_DEVIDX BIT(16) ++#define MTK_FOE_IB2_WHNAT_NAT BIT(17) ++ ++#define MTK_FOE_IB2_PORT_MG GENMASK(17, 12) ++ ++#define MTK_FOE_IB2_PORT_AG GENMASK(23, 18) ++ ++#define MTK_FOE_IB2_DSCP GENMASK(31, 24) ++ ++#define MTK_FOE_VLAN2_WHNAT_BSS GEMMASK(5, 0) ++#define MTK_FOE_VLAN2_WHNAT_WCID GENMASK(13, 6) ++#define MTK_FOE_VLAN2_WHNAT_RING GENMASK(15, 14) ++ ++enum { ++ MTK_FOE_STATE_INVALID, ++ MTK_FOE_STATE_UNBIND, ++ MTK_FOE_STATE_BIND, ++ MTK_FOE_STATE_FIN ++}; ++ ++struct mtk_foe_mac_info { ++ u16 vlan1; ++ u16 etype; ++ ++ u32 dest_mac_hi; ++ ++ u16 vlan2; ++ u16 dest_mac_lo; ++ ++ u32 src_mac_hi; ++ ++ u16 pppoe_id; ++ u16 src_mac_lo; ++}; ++ ++struct mtk_foe_bridge { ++ u32 dest_mac_hi; ++ ++ u16 src_mac_lo; ++ u16 dest_mac_lo; ++ ++ u32 src_mac_hi; ++ ++ u32 ib2; ++ ++ u32 _rsv[5]; ++ ++ u32 udf_tsid; ++ struct mtk_foe_mac_info l2; ++}; ++ ++struct mtk_ipv4_tuple { ++ u32 src_ip; ++ u32 dest_ip; ++ union { ++ struct { ++ u16 dest_port; ++ u16 src_port; ++ }; ++ struct { ++ u8 protocol; ++ u8 _pad[3]; /* fill with 0xa5a5a5 */ ++ }; ++ u32 ports; ++ }; ++}; ++ ++struct mtk_foe_ipv4 { ++ struct mtk_ipv4_tuple orig; ++ ++ u32 ib2; ++ ++ struct mtk_ipv4_tuple new; ++ ++ u16 timestamp; ++ u16 _rsv0[3]; ++ ++ u32 udf_tsid; ++ ++ struct mtk_foe_mac_info l2; ++}; ++ ++struct mtk_foe_ipv4_dslite { ++ struct mtk_ipv4_tuple ip4; ++ ++ u32 tunnel_src_ip[4]; ++ u32 tunnel_dest_ip[4]; ++ ++ u8 flow_label[3]; ++ u8 priority; ++ ++ u32 udf_tsid; ++ ++ u32 ib2; ++ ++ struct mtk_foe_mac_info l2; ++}; ++ ++struct mtk_foe_ipv6 { ++ u32 src_ip[4]; ++ u32 dest_ip[4]; ++ ++ union { ++ struct { ++ u8 protocol; ++ u8 _pad[3]; /* fill with 0xa5a5a5 */ ++ }; /* 3-tuple */ ++ struct { ++ u16 dest_port; ++ u16 src_port; ++ }; /* 5-tuple */ ++ u32 ports; ++ }; ++ ++ u32 _rsv[3]; ++ ++ u32 udf; ++ ++ u32 ib2; ++ struct mtk_foe_mac_info l2; ++}; ++ ++struct mtk_foe_ipv6_6rd { ++ u32 src_ip[4]; ++ u32 dest_ip[4]; ++ u16 dest_port; ++ u16 src_port; ++ ++ u32 tunnel_src_ip; ++ u32 tunnel_dest_ip; ++ ++ u16 hdr_csum; ++ u8 dscp; ++ u8 ttl; ++ ++ u8 flag; ++ u8 pad; ++ u8 per_flow_6rd_id; ++ u8 pad2; ++ ++ u32 ib2; ++ struct mtk_foe_mac_info l2; ++}; ++ ++struct mtk_foe_entry { ++ u32 ib1; ++ ++ union { ++ struct mtk_foe_bridge bridge; ++ struct mtk_foe_ipv4 ipv4; ++ struct mtk_foe_ipv4_dslite dslite; ++ struct mtk_foe_ipv6 ipv6; ++ struct mtk_foe_ipv6_6rd ipv6_6rd; ++ u32 data[19]; ++ }; ++}; ++ ++enum { ++ MTK_PPE_CPU_REASON_TTL_EXCEEDED = 0x02, ++ MTK_PPE_CPU_REASON_OPTION_HEADER = 0x03, ++ MTK_PPE_CPU_REASON_NO_FLOW = 0x07, ++ MTK_PPE_CPU_REASON_IPV4_FRAG = 0x08, ++ MTK_PPE_CPU_REASON_IPV4_DSLITE_FRAG = 0x09, ++ MTK_PPE_CPU_REASON_IPV4_DSLITE_NO_TCP_UDP = 0x0a, ++ MTK_PPE_CPU_REASON_IPV6_6RD_NO_TCP_UDP = 0x0b, ++ MTK_PPE_CPU_REASON_TCP_FIN_SYN_RST = 0x0c, ++ MTK_PPE_CPU_REASON_UN_HIT = 0x0d, ++ MTK_PPE_CPU_REASON_HIT_UNBIND = 0x0e, ++ MTK_PPE_CPU_REASON_HIT_UNBIND_RATE_REACHED = 0x0f, ++ MTK_PPE_CPU_REASON_HIT_BIND_TCP_FIN = 0x10, ++ MTK_PPE_CPU_REASON_HIT_TTL_1 = 0x11, ++ MTK_PPE_CPU_REASON_HIT_BIND_VLAN_VIOLATION = 0x12, ++ MTK_PPE_CPU_REASON_KEEPALIVE_UC_OLD_HDR = 0x13, ++ MTK_PPE_CPU_REASON_KEEPALIVE_MC_NEW_HDR = 0x14, ++ MTK_PPE_CPU_REASON_KEEPALIVE_DUP_OLD_HDR = 0x15, ++ MTK_PPE_CPU_REASON_HIT_BIND_FORCE_CPU = 0x16, ++ MTK_PPE_CPU_REASON_TUNNEL_OPTION_HEADER = 0x17, ++ MTK_PPE_CPU_REASON_MULTICAST_TO_CPU = 0x18, ++ MTK_PPE_CPU_REASON_MULTICAST_TO_GMAC1_CPU = 0x19, ++ MTK_PPE_CPU_REASON_HIT_PRE_BIND = 0x1a, ++ MTK_PPE_CPU_REASON_PACKET_SAMPLING = 0x1b, ++ MTK_PPE_CPU_REASON_EXCEED_MTU = 0x1c, ++ MTK_PPE_CPU_REASON_PPE_BYPASS = 0x1e, ++ MTK_PPE_CPU_REASON_INVALID = 0x1f, ++}; ++ ++struct mtk_ppe { ++ struct device *dev; ++ void __iomem *base; ++ int version; ++ ++ struct mtk_foe_entry *foe_table; ++ dma_addr_t foe_phys; ++ ++ void *acct_table; ++}; ++ ++int mtk_ppe_init(struct mtk_ppe *ppe, struct device *dev, void __iomem *base, ++ int version); ++int mtk_ppe_start(struct mtk_ppe *ppe); ++int mtk_ppe_stop(struct mtk_ppe *ppe); ++ ++static inline void ++mtk_foe_entry_clear(struct mtk_ppe *ppe, u16 hash) ++{ ++ ppe->foe_table[hash].ib1 = 0; ++ dma_wmb(); ++} ++ ++int mtk_foe_entry_prepare(struct mtk_foe_entry *entry, int type, int l4proto, ++ u8 pse_port, u8 *src_mac, u8 *dest_mac); ++int mtk_foe_entry_set_ipv4_tuple(struct mtk_foe_entry *entry, bool orig, ++ __be32 src_addr, __be16 src_port, ++ __be32 dest_addr, __be16 dest_port); ++int mtk_foe_entry_set_ipv6_tuple(struct mtk_foe_entry *entry, ++ __be32 *src_addr, __be16 src_port, ++ __be32 *dest_addr, __be16 dest_port); ++int mtk_foe_entry_set_dsa(struct mtk_foe_entry *entry, int port); ++int mtk_foe_entry_set_vlan(struct mtk_foe_entry *entry, int vid); ++int mtk_foe_entry_set_pppoe(struct mtk_foe_entry *entry, int sid); ++int mtk_foe_entry_commit(struct mtk_ppe *ppe, struct mtk_foe_entry *entry, ++ u16 timestamp); ++ ++#endif +--- /dev/null ++++ b/drivers/net/ethernet/mediatek/mtk_ppe_regs.h +@@ -0,0 +1,144 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++/* Copyright (C) 2020 Felix Fietkau */ ++ ++#ifndef __MTK_PPE_REGS_H ++#define __MTK_PPE_REGS_H ++ ++#define MTK_PPE_GLO_CFG 0x200 ++#define MTK_PPE_GLO_CFG_EN BIT(0) ++#define MTK_PPE_GLO_CFG_TSID_EN BIT(1) ++#define MTK_PPE_GLO_CFG_IP4_L4_CS_DROP BIT(2) ++#define MTK_PPE_GLO_CFG_IP4_CS_DROP BIT(3) ++#define MTK_PPE_GLO_CFG_TTL0_DROP BIT(4) ++#define MTK_PPE_GLO_CFG_PPE_BSWAP BIT(5) ++#define MTK_PPE_GLO_CFG_PSE_HASH_OFS BIT(6) ++#define MTK_PPE_GLO_CFG_MCAST_TB_EN BIT(7) ++#define MTK_PPE_GLO_CFG_FLOW_DROP_KA BIT(8) ++#define MTK_PPE_GLO_CFG_FLOW_DROP_UPDATE BIT(9) ++#define MTK_PPE_GLO_CFG_UDP_LITE_EN BIT(10) ++#define MTK_PPE_GLO_CFG_UDP_LEN_DROP BIT(11) ++#define MTK_PPE_GLO_CFG_MCAST_ENTRIES GNEMASK(13, 12) ++#define MTK_PPE_GLO_CFG_BUSY BIT(31) ++ ++#define MTK_PPE_FLOW_CFG 0x204 ++#define MTK_PPE_FLOW_CFG_IP4_TCP_FRAG BIT(6) ++#define MTK_PPE_FLOW_CFG_IP4_UDP_FRAG BIT(7) ++#define MTK_PPE_FLOW_CFG_IP6_3T_ROUTE BIT(8) ++#define MTK_PPE_FLOW_CFG_IP6_5T_ROUTE BIT(9) ++#define MTK_PPE_FLOW_CFG_IP6_6RD BIT(10) ++#define MTK_PPE_FLOW_CFG_IP4_NAT BIT(12) ++#define MTK_PPE_FLOW_CFG_IP4_NAPT BIT(13) ++#define MTK_PPE_FLOW_CFG_IP4_DSLITE BIT(14) ++#define MTK_PPE_FLOW_CFG_L2_BRIDGE BIT(15) ++#define MTK_PPE_FLOW_CFG_IP_PROTO_BLACKLIST BIT(16) ++#define MTK_PPE_FLOW_CFG_IP4_NAT_FRAG BIT(17) ++#define MTK_PPE_FLOW_CFG_IP4_HASH_FLOW_LABEL BIT(18) ++#define MTK_PPE_FLOW_CFG_IP4_HASH_GRE_KEY BIT(19) ++#define MTK_PPE_FLOW_CFG_IP6_HASH_GRE_KEY BIT(20) ++ ++#define MTK_PPE_IP_PROTO_CHK 0x208 ++#define MTK_PPE_IP_PROTO_CHK_IPV4 GENMASK(15, 0) ++#define MTK_PPE_IP_PROTO_CHK_IPV6 GENMASK(31, 16) ++ ++#define MTK_PPE_TB_CFG 0x21c ++#define MTK_PPE_TB_CFG_ENTRY_NUM GENMASK(2, 0) ++#define MTK_PPE_TB_CFG_ENTRY_80B BIT(3) ++#define MTK_PPE_TB_CFG_SEARCH_MISS GENMASK(5, 4) ++#define MTK_PPE_TB_CFG_AGE_PREBIND BIT(6) ++#define MTK_PPE_TB_CFG_AGE_NON_L4 BIT(7) ++#define MTK_PPE_TB_CFG_AGE_UNBIND BIT(8) ++#define MTK_PPE_TB_CFG_AGE_TCP BIT(9) ++#define MTK_PPE_TB_CFG_AGE_UDP BIT(10) ++#define MTK_PPE_TB_CFG_AGE_TCP_FIN BIT(11) ++#define MTK_PPE_TB_CFG_KEEPALIVE GENMASK(13, 12) ++#define MTK_PPE_TB_CFG_HASH_MODE GENMASK(15, 14) ++#define MTK_PPE_TB_CFG_SCAN_MODE GENMASK(17, 16) ++#define MTK_PPE_TB_CFG_HASH_DEBUG GENMASK(19, 18) ++ ++enum { ++ MTK_PPE_SCAN_MODE_DISABLED, ++ MTK_PPE_SCAN_MODE_CHECK_AGE, ++ MTK_PPE_SCAN_MODE_KEEPALIVE_AGE, ++}; ++ ++enum { ++ MTK_PPE_KEEPALIVE_DISABLE, ++ MTK_PPE_KEEPALIVE_UNICAST_CPU, ++ MTK_PPE_KEEPALIVE_DUP_CPU = 3, ++}; ++ ++enum { ++ MTK_PPE_SEARCH_MISS_ACTION_DROP, ++ MTK_PPE_SEARCH_MISS_ACTION_FORWARD = 2, ++ MTK_PPE_SEARCH_MISS_ACTION_FORWARD_BUILD = 3, ++}; ++ ++#define MTK_PPE_TB_BASE 0x220 ++ ++#define MTK_PPE_TB_USED 0x224 ++#define MTK_PPE_TB_USED_NUM GENMASK(13, 0) ++ ++#define MTK_PPE_BIND_RATE 0x228 ++#define MTK_PPE_BIND_RATE_BIND GENMASK(15, 0) ++#define MTK_PPE_BIND_RATE_PREBIND GENMASK(31, 16) ++ ++#define MTK_PPE_BIND_LIMIT0 0x22c ++#define MTK_PPE_BIND_LIMIT0_QUARTER GENMASK(13, 0) ++#define MTK_PPE_BIND_LIMIT0_HALF GENMASK(29, 16) ++ ++#define MTK_PPE_BIND_LIMIT1 0x230 ++#define MTK_PPE_BIND_LIMIT1_FULL GENMASK(13, 0) ++#define MTK_PPE_BIND_LIMIT1_NON_L4 GENMASK(23, 16) ++ ++#define MTK_PPE_KEEPALIVE 0x234 ++#define MTK_PPE_KEEPALIVE_TIME GENMASK(15, 0) ++#define MTK_PPE_KEEPALIVE_TIME_TCP GENMASK(23, 16) ++#define MTK_PPE_KEEPALIVE_TIME_UDP GENMASK(31, 24) ++ ++#define MTK_PPE_UNBIND_AGE 0x238 ++#define MTK_PPE_UNBIND_AGE_MIN_PACKETS GENMASK(31, 16) ++#define MTK_PPE_UNBIND_AGE_DELTA GENMASK(7, 0) ++ ++#define MTK_PPE_BIND_AGE0 0x23c ++#define MTK_PPE_BIND_AGE0_DELTA_NON_L4 GENMASK(30, 16) ++#define MTK_PPE_BIND_AGE0_DELTA_UDP GENMASK(14, 0) ++ ++#define MTK_PPE_BIND_AGE1 0x240 ++#define MTK_PPE_BIND_AGE1_DELTA_TCP_FIN GENMASK(30, 16) ++#define MTK_PPE_BIND_AGE1_DELTA_TCP GENMASK(14, 0) ++ ++#define MTK_PPE_HASH_SEED 0x244 ++ ++#define MTK_PPE_DEFAULT_CPU_PORT 0x248 ++#define MTK_PPE_DEFAULT_CPU_PORT_MASK(_n) (GENMASK(2, 0) << ((_n) * 4)) ++ ++#define MTK_PPE_MTU_DROP 0x308 ++ ++#define MTK_PPE_VLAN_MTU0 0x30c ++#define MTK_PPE_VLAN_MTU0_NONE GENMASK(13, 0) ++#define MTK_PPE_VLAN_MTU0_1TAG GENMASK(29, 16) ++ ++#define MTK_PPE_VLAN_MTU1 0x310 ++#define MTK_PPE_VLAN_MTU1_2TAG GENMASK(13, 0) ++#define MTK_PPE_VLAN_MTU1_3TAG GENMASK(29, 16) ++ ++#define MTK_PPE_VPM_TPID 0x318 ++ ++#define MTK_PPE_CACHE_CTL 0x320 ++#define MTK_PPE_CACHE_CTL_EN BIT(0) ++#define MTK_PPE_CACHE_CTL_LOCK_CLR BIT(4) ++#define MTK_PPE_CACHE_CTL_REQ BIT(8) ++#define MTK_PPE_CACHE_CTL_CLEAR BIT(9) ++#define MTK_PPE_CACHE_CTL_CMD GENMASK(13, 12) ++ ++#define MTK_PPE_MIB_CFG 0x334 ++#define MTK_PPE_MIB_CFG_EN BIT(0) ++#define MTK_PPE_MIB_CFG_RD_CLR BIT(1) ++ ++#define MTK_PPE_MIB_TB_BASE 0x338 ++ ++#define MTK_PPE_MIB_CACHE_CTL 0x350 ++#define MTK_PPE_MIB_CACHE_CTL_EN BIT(0) ++#define MTK_PPE_MIB_CACHE_CTL_FLUSH BIT(2) ++ ++#endif diff --git a/target/linux/generic/pending-5.4/770-16-net-ethernet-mediatek-mtk_eth_soc-add-flow-offloadin.patch b/target/linux/generic/pending-5.4/770-16-net-ethernet-mediatek-mtk_eth_soc-add-flow-offloadin.patch new file mode 100644 index 0000000000..810eeda75c --- /dev/null +++ b/target/linux/generic/pending-5.4/770-16-net-ethernet-mediatek-mtk_eth_soc-add-flow-offloadin.patch @@ -0,0 +1,401 @@ +From: Felix Fietkau +Date: Sun, 11 Oct 2020 22:28:32 +0200 +Subject: [PATCH] net: ethernet: mediatek: mtk_eth_soc: add flow offloading + support + +Only supports IPv4 for now + +Signed-off-by: Felix Fietkau +--- + create mode 100644 drivers/net/ethernet/mediatek/mtk_offload.c + create mode 100644 drivers/net/ethernet/mediatek/mtk_ppe_debugfs.c + +--- a/drivers/net/ethernet/mediatek/Makefile ++++ b/drivers/net/ethernet/mediatek/Makefile +@@ -4,4 +4,4 @@ + # + + obj-$(CONFIG_NET_MEDIATEK_SOC) += mtk_eth.o +-mtk_eth-y := mtk_eth_soc.o mtk_sgmii.o mtk_eth_path.o mtk_ppe.o ++mtk_eth-y := mtk_eth_soc.o mtk_sgmii.o mtk_eth_path.o mtk_ppe.o mtk_ppe_debugfs.o mtk_offload.o +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +@@ -19,6 +19,8 @@ + #include + #include + #include ++#include ++#include + #include + + #include "mtk_eth_soc.h" +@@ -1324,8 +1326,12 @@ static int mtk_poll_rx(struct napi_struc + (trxd.rxd2 & RX_DMA_VTAG)) + __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), + RX_DMA_VID(trxd.rxd3)); +- skb_record_rx_queue(skb, 0); +- napi_gro_receive(napi, skb); ++ if (mtk_offload_check_rx(eth, skb, trxd.rxd4) == 0) { ++ skb_record_rx_queue(skb, 0); ++ napi_gro_receive(napi, skb); ++ } else { ++ dev_kfree_skb(skb); ++ } + + skip_rx: + ring->data[idx] = new_data; +@@ -2858,6 +2864,25 @@ static int mtk_set_rxnfc(struct net_devi + return ret; + } + ++static int ++mtk_flow_offload(enum flow_offload_type type, struct flow_offload *flow, ++ struct flow_offload_hw_path *src, ++ struct flow_offload_hw_path *dest) ++{ ++ struct mtk_mac *mac = netdev_priv(src->dev); ++ struct mtk_eth *eth = mac->hw; ++ ++ if (!eth->soc->offload_version) ++ return -EINVAL; ++ ++ if (src->dev->base_addr != dest->dev->base_addr) ++ return -EINVAL; ++ ++ mac = netdev_priv(src->dev); ++ ++ return mtk_flow_offload_add(eth, type, flow, src, dest); ++} ++ + static const struct ethtool_ops mtk_ethtool_ops = { + .get_link_ksettings = mtk_get_link_ksettings, + .set_link_ksettings = mtk_set_link_ksettings, +@@ -2889,6 +2914,7 @@ static const struct net_device_ops mtk_n + #ifdef CONFIG_NET_POLL_CONTROLLER + .ndo_poll_controller = mtk_poll_controller, + #endif ++ .ndo_flow_offload = mtk_flow_offload, + }; + + static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np) +@@ -3154,6 +3180,10 @@ static int mtk_probe(struct platform_dev + eth->base + MTK_ETH_PPE_BASE, 2); + if (err) + goto err_free_dev; ++ ++ err = mtk_flow_offload_init(eth); ++ if (err) ++ goto err_free_dev; + } + + for (i = 0; i < MTK_MAX_DEVS; i++) { +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h +@@ -929,6 +929,7 @@ struct mtk_eth { + int ip_align; + + struct mtk_ppe ppe; ++ struct flow_offload __rcu **foe_flow_table; + }; + + /* struct mtk_mac - the structure that holds the info about the MACs of the +@@ -973,4 +974,12 @@ int mtk_gmac_sgmii_path_setup(struct mtk + int mtk_gmac_gephy_path_setup(struct mtk_eth *eth, int mac_id); + int mtk_gmac_rgmii_path_setup(struct mtk_eth *eth, int mac_id); + ++int mtk_flow_offload_init(struct mtk_eth *eth); ++int mtk_flow_offload_add(struct mtk_eth *eth, ++ enum flow_offload_type type, ++ struct flow_offload *flow, ++ struct flow_offload_hw_path *src, ++ struct flow_offload_hw_path *dest); ++int mtk_offload_check_rx(struct mtk_eth *eth, struct sk_buff *skb, u32 rxd4); ++ + #endif /* MTK_ETH_H */ +--- /dev/null ++++ b/drivers/net/ethernet/mediatek/mtk_offload.c +@@ -0,0 +1,146 @@ ++/* This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; version 2 of the License ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * Copyright (C) 2018 John Crispin ++ */ ++ ++#include ++#include "mtk_eth_soc.h" ++ ++static int ++mtk_offload_prepare_v4(struct mtk_eth *eth, struct mtk_foe_entry *entry, ++ struct flow_offload_tuple *s_tuple, ++ struct flow_offload_tuple *d_tuple, ++ struct flow_offload_hw_path *src, ++ struct flow_offload_hw_path *dest) ++{ ++ int dest_port = 1; ++ ++ if (dest->dev == eth->netdev[1]) ++ dest_port = 2; ++ ++ mtk_foe_entry_prepare(entry, MTK_PPE_PKT_TYPE_IPV4_HNAPT, s_tuple->l4proto, ++ dest_port, dest->eth_src, dest->eth_dest); ++ mtk_foe_entry_set_ipv4_tuple(entry, false, ++ s_tuple->src_v4.s_addr, s_tuple->src_port, ++ s_tuple->dst_v4.s_addr, s_tuple->dst_port); ++ mtk_foe_entry_set_ipv4_tuple(entry, true, ++ d_tuple->dst_v4.s_addr, d_tuple->dst_port, ++ d_tuple->src_v4.s_addr, d_tuple->src_port); ++ ++ if (dest->flags & FLOW_OFFLOAD_PATH_PPPOE) ++ mtk_foe_entry_set_pppoe(entry, dest->pppoe_sid); ++ ++ if (dest->flags & FLOW_OFFLOAD_PATH_VLAN) ++ mtk_foe_entry_set_vlan(entry, dest->vlan_id); ++ ++ if (dest->flags & FLOW_OFFLOAD_PATH_DSA) ++ mtk_foe_entry_set_dsa(entry, dest->dsa_port); ++ ++ return 0; ++} ++ ++int mtk_flow_offload_add(struct mtk_eth *eth, ++ enum flow_offload_type type, ++ struct flow_offload *flow, ++ struct flow_offload_hw_path *src, ++ struct flow_offload_hw_path *dest) ++{ ++ struct flow_offload_tuple *otuple = &flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple; ++ struct flow_offload_tuple *rtuple = &flow->tuplehash[FLOW_OFFLOAD_DIR_REPLY].tuple; ++ struct mtk_foe_entry orig, reply; ++ u32 ohash, rhash, timestamp; ++ ++ if (otuple->l4proto != IPPROTO_TCP && otuple->l4proto != IPPROTO_UDP) ++ return -EINVAL; ++ ++ if (type == FLOW_OFFLOAD_DEL) { ++ ohash = (unsigned long)flow->priv; ++ rhash = ohash >> 16; ++ ohash &= 0xffff; ++ mtk_foe_entry_clear(ð->ppe, ohash); ++ mtk_foe_entry_clear(ð->ppe, rhash); ++ rcu_assign_pointer(eth->foe_flow_table[ohash], NULL); ++ rcu_assign_pointer(eth->foe_flow_table[rhash], NULL); ++ synchronize_rcu(); ++ ++ return 0; ++ } ++ ++ switch (otuple->l3proto) { ++ case AF_INET: ++ if (mtk_offload_prepare_v4(eth, &orig, otuple, rtuple, src, dest) || ++ mtk_offload_prepare_v4(eth, &reply, rtuple, otuple, dest, src)) ++ return -EINVAL; ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ timestamp = mtk_r32(eth, 0x0010); ++ ++ ohash = mtk_foe_entry_commit(ð->ppe, &orig, timestamp); ++ if (ohash < 0) ++ return -EINVAL; ++ ++ rhash = mtk_foe_entry_commit(ð->ppe, &reply, timestamp); ++ if (rhash < 0) { ++ mtk_foe_entry_clear(ð->ppe, ohash); ++ return -EINVAL; ++ } ++ ++ rcu_assign_pointer(eth->foe_flow_table[ohash], flow); ++ rcu_assign_pointer(eth->foe_flow_table[rhash], flow); ++ ++ ohash |= rhash << 16; ++ flow->priv = (void *)(unsigned long)ohash; ++ ++ return 0; ++} ++ ++static void mtk_offload_keepalive(struct mtk_eth *eth, unsigned int hash) ++{ ++ struct flow_offload *flow; ++ ++ rcu_read_lock(); ++ flow = rcu_dereference(eth->foe_flow_table[hash]); ++ if (flow) ++ flow->timeout = jiffies + 30 * HZ; ++ rcu_read_unlock(); ++} ++ ++int mtk_offload_check_rx(struct mtk_eth *eth, struct sk_buff *skb, u32 rxd4) ++{ ++ unsigned int hash; ++ ++ switch (FIELD_GET(MTK_RXD4_PPE_CPU_REASON, rxd4)) { ++ case MTK_PPE_CPU_REASON_KEEPALIVE_UC_OLD_HDR: ++ case MTK_PPE_CPU_REASON_KEEPALIVE_MC_NEW_HDR: ++ case MTK_PPE_CPU_REASON_KEEPALIVE_DUP_OLD_HDR: ++ hash = FIELD_GET(MTK_RXD4_FOE_ENTRY, rxd4); ++ mtk_offload_keepalive(eth, hash); ++ return -1; ++ case MTK_PPE_CPU_REASON_PACKET_SAMPLING: ++ return -1; ++ default: ++ return 0; ++ } ++} ++ ++int mtk_flow_offload_init(struct mtk_eth *eth) ++{ ++ eth->foe_flow_table = devm_kcalloc(eth->dev, MTK_PPE_ENTRIES, ++ sizeof(*eth->foe_flow_table), ++ GFP_KERNEL); ++ ++ if (!eth->foe_flow_table) ++ return -ENOMEM; ++ ++ return 0; ++} +--- a/drivers/net/ethernet/mediatek/mtk_ppe.c ++++ b/drivers/net/ethernet/mediatek/mtk_ppe.c +@@ -375,6 +375,8 @@ int mtk_ppe_init(struct mtk_ppe *ppe, st + + ppe->foe_table = foe; + ++ mtk_ppe_debugfs_init(ppe); ++ + return 0; + } + +--- a/drivers/net/ethernet/mediatek/mtk_ppe.h ++++ b/drivers/net/ethernet/mediatek/mtk_ppe.h +@@ -271,4 +271,7 @@ int mtk_foe_entry_set_pppoe(struct mtk_f + int mtk_foe_entry_commit(struct mtk_ppe *ppe, struct mtk_foe_entry *entry, + u16 timestamp); + ++/* internal */ ++int mtk_ppe_debugfs_init(struct mtk_ppe *ppe); ++ + #endif +--- /dev/null ++++ b/drivers/net/ethernet/mediatek/mtk_ppe_debugfs.c +@@ -0,0 +1,114 @@ ++/* This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; version 2 of the License ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * Copyright (C) 2014-2016 Sean Wang ++ * Copyright (C) 2016-2017 John Crispin ++ * Copyright (C) 2020 Felix Fietkau ++ */ ++ ++#include ++#include ++#include "mtk_eth_soc.h" ++ ++static const char *mtk_foe_entry_state_str[] = { ++ "INVALID", ++ "UNBIND", ++ "BIND", ++ "FIN" ++}; ++ ++static const char *mtk_foe_packet_type_str[] = { ++ "IPV4_HNAPT", ++ "IPV4_HNAT", ++ "IPV6_1T_ROUTE", ++ "IPV4_DSLITE", ++ "IPV6_3T_ROUTE", ++ "IPV6_5T_ROUTE", ++ "IPV6_6RD", ++}; ++ ++#define es(entry) (mtk_foe_entry_state_str[FIELD_GET(MTK_FOE_IB1_STATE, entry->ib1)]) ++//#define ei(entry, end) (MTK_PPE_TBL_SZ - (int)(end - entry)) ++#define pt(entry) (mtk_foe_packet_type_str[FIELD_GET(MTK_FOE_IB1_PACKET_TYPE, entry->ib1)]) ++ ++static int mtk_ppe_debugfs_foe_show(struct seq_file *m, void *private) ++{ ++ struct mtk_ppe *ppe = m->private; ++ int i, count; ++ ++ for (i = 0, count = 0; i < MTK_PPE_ENTRIES; i++) { ++ struct mtk_foe_entry *entry = &ppe->foe_table[i]; ++ ++ if (!FIELD_GET(MTK_FOE_IB1_STATE, entry->ib1)) ++ continue; ++ ++ if (FIELD_GET(MTK_FOE_IB1_PACKET_TYPE, entry->ib1) == ++ MTK_PPE_PKT_TYPE_IPV4_HNAPT) { ++ struct mtk_foe_ipv4 *ip4 = &entry->ipv4; ++ struct mtk_foe_mac_info *l2 = &ip4->l2; ++ ++ __be32 saddr = htonl(ip4->orig.src_ip); ++ __be32 daddr = htonl(ip4->orig.dest_ip); ++ __be32 nsaddr = htonl(ip4->new.src_ip); ++ __be32 ndaddr = htonl(ip4->new.dest_ip); ++ unsigned char h_dest[ETH_ALEN]; ++ unsigned char h_source[ETH_ALEN]; ++ ++ *((__be32 *) h_source) = htonl(l2->src_mac_hi); ++ *((__be16*) &h_source[4]) = htons(l2->src_mac_lo); ++ *((__be32*) h_dest) = htonl(l2->dest_mac_hi); ++ *((__be16*) &h_dest[4]) = htons(l2->dest_mac_lo); ++ seq_printf(m, ++ "(%x)0x%05x|state=%s|type=%s|" ++ "%pI4:%d->%pI4:%d=>%pI4:%d->%pI4:%d|%pM=>%pM|" ++ "etype=0x%04x|info1=0x%x|info2=0x%x|" ++ "vlan1=%d|vlan2=%d\n", ++ count, i, es(entry), pt(entry), ++ &saddr, ip4->orig.src_port, ++ &daddr, ip4->orig.dest_port, ++ &nsaddr, ip4->new.src_port, ++ &ndaddr, ip4->new.dest_port, ++ h_source, h_dest, ++ ntohs(l2->etype), ++ entry->ib1, ++ ip4->ib2, ++ l2->vlan1, ++ l2->vlan2); ++ count++; ++ } else ++ seq_printf(m, "0x%05x state=%s\n", count, es(entry)); ++ } ++ ++ return 0; ++} ++ ++static int mtk_ppe_debugfs_foe_open(struct inode *inode, struct file *file) ++{ ++ return single_open(file, mtk_ppe_debugfs_foe_show, inode->i_private); ++} ++ ++static const struct file_operations mtk_ppe_debugfs_foe_fops = { ++ .open = mtk_ppe_debugfs_foe_open, ++ .read = seq_read, ++ .llseek = seq_lseek, ++ .release = single_release, ++}; ++ ++int mtk_ppe_debugfs_init(struct mtk_ppe *ppe) ++{ ++ struct dentry *root; ++ ++ root = debugfs_create_dir("mtk_ppe", NULL); ++ if (!root) ++ return -ENOMEM; ++ ++ debugfs_create_file("entries", S_IRUGO, root, ppe, &mtk_ppe_debugfs_foe_fops); ++ ++ return 0; ++} diff --git a/target/linux/imx6/config-4.19 b/target/linux/imx6/config-4.19 index 5a3d029680..8435ece397 100644 --- a/target/linux/imx6/config-4.19 +++ b/target/linux/imx6/config-4.19 @@ -188,9 +188,7 @@ CONFIG_EXT4_FS_SECURITY=y CONFIG_EXTCON=y CONFIG_EXTRA_FIRMWARE="imx/sdma/sdma-imx6q.bin" CONFIG_EXTRA_FIRMWARE_DIR="firmware" -# CONFIG_F2FS_CHECK_FS is not set CONFIG_F2FS_FS=y -# CONFIG_F2FS_FS_SECURITY is not set CONFIG_FEC=y CONFIG_FIXED_PHY=y CONFIG_FIX_EARLYCON_MEM=y diff --git a/target/linux/ipq40xx/config-4.19 b/target/linux/ipq40xx/config-4.19 index c70c761d25..0adcc25340 100644 --- a/target/linux/ipq40xx/config-4.19 +++ b/target/linux/ipq40xx/config-4.19 @@ -497,7 +497,6 @@ CONFIG_USB=y CONFIG_USB_COMMON=y CONFIG_USB_SUPPORT=y CONFIG_USE_OF=y -CONFIG_VDSO=y CONFIG_VFP=y CONFIG_VFPv3=y CONFIG_WATCHDOG_CORE=y diff --git a/target/linux/ipq40xx/config-5.4 b/target/linux/ipq40xx/config-5.4 index 671f2b41f5..b442f73fbc 100644 --- a/target/linux/ipq40xx/config-5.4 +++ b/target/linux/ipq40xx/config-5.4 @@ -523,7 +523,6 @@ CONFIG_USB=y CONFIG_USB_COMMON=y CONFIG_USB_SUPPORT=y CONFIG_USE_OF=y -CONFIG_VDSO=y CONFIG_VFP=y CONFIG_VFPv3=y CONFIG_WATCHDOG_CORE=y diff --git a/target/linux/ipq40xx/patches-5.4/700-net-add-qualcomm-mdio.patch b/target/linux/ipq40xx/patches-5.4/700-net-add-qualcomm-mdio.patch index f4e3f7069e..8786330d3b 100644 --- a/target/linux/ipq40xx/patches-5.4/700-net-add-qualcomm-mdio.patch +++ b/target/linux/ipq40xx/patches-5.4/700-net-add-qualcomm-mdio.patch @@ -1,6 +1,6 @@ --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig -@@ -580,6 +580,13 @@ config XILINX_GMII2RGMII +@@ -581,6 +581,13 @@ config XILINX_GMII2RGMII the Reduced Gigabit Media Independent Interface(RGMII) between Ethernet physical media devices and the Gigabit Ethernet controller. diff --git a/target/linux/ipq40xx/patches-5.4/705-net-add-qualcomm-ar40xx-phy.patch b/target/linux/ipq40xx/patches-5.4/705-net-add-qualcomm-ar40xx-phy.patch index 1737181520..a90ae0eb89 100644 --- a/target/linux/ipq40xx/patches-5.4/705-net-add-qualcomm-ar40xx-phy.patch +++ b/target/linux/ipq40xx/patches-5.4/705-net-add-qualcomm-ar40xx-phy.patch @@ -1,6 +1,6 @@ --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig -@@ -587,6 +587,13 @@ config MDIO_IPQ40XX +@@ -588,6 +588,13 @@ config MDIO_IPQ40XX This driver supports the MDIO interface found in Qualcomm Atheros ipq40xx Soc chip. diff --git a/target/linux/ipq806x/config-4.19 b/target/linux/ipq806x/config-4.19 index f61883a6db..b21254ed08 100644 --- a/target/linux/ipq806x/config-4.19 +++ b/target/linux/ipq806x/config-4.19 @@ -494,7 +494,6 @@ CONFIG_USB=y CONFIG_USB_COMMON=y CONFIG_USB_SUPPORT=y CONFIG_USE_OF=y -CONFIG_VDSO=y CONFIG_VFP=y CONFIG_VFPv3=y CONFIG_WATCHDOG_CORE=y diff --git a/target/linux/ipq806x/config-5.4 b/target/linux/ipq806x/config-5.4 index 568c5df39e..20870f75c0 100644 --- a/target/linux/ipq806x/config-5.4 +++ b/target/linux/ipq806x/config-5.4 @@ -512,7 +512,6 @@ CONFIG_USB=y CONFIG_USB_COMMON=y CONFIG_USB_SUPPORT=y CONFIG_USE_OF=y -CONFIG_VDSO=y CONFIG_VFP=y CONFIG_VFPv3=y CONFIG_WATCHDOG_CORE=y diff --git a/target/linux/layerscape/armv7/config-5.4 b/target/linux/layerscape/armv7/config-5.4 index 3e242a2245..56a6dfd913 100644 --- a/target/linux/layerscape/armv7/config-5.4 +++ b/target/linux/layerscape/armv7/config-5.4 @@ -746,7 +746,6 @@ CONFIG_USB_SUPPORT=y CONFIG_USER_NS=y CONFIG_USE_OF=y CONFIG_UTS_NS=y -CONFIG_VDSO=y CONFIG_VEXPRESS_CONFIG=y CONFIG_VEXPRESS_SYSCFG=y CONFIG_VFAT_FS=y diff --git a/target/linux/layerscape/patches-5.4/701-net-0327-at803x-Address-packet-drops-at-low-traffic-rate-due-.patch b/target/linux/layerscape/patches-5.4/701-net-0327-at803x-Address-packet-drops-at-low-traffic-rate-due-.patch index f6cf0e0430..36c393f2d0 100644 --- a/target/linux/layerscape/patches-5.4/701-net-0327-at803x-Address-packet-drops-at-low-traffic-rate-due-.patch +++ b/target/linux/layerscape/patches-5.4/701-net-0327-at803x-Address-packet-drops-at-low-traffic-rate-due-.patch @@ -22,7 +22,7 @@ Signed-off-by: Vladimir Oltean --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig -@@ -370,6 +370,16 @@ config AT803X_PHY +@@ -371,6 +371,16 @@ config AT803X_PHY ---help--- Currently supports the AT8030 and AT8035 model diff --git a/target/linux/layerscape/patches-5.4/701-net-0328-net-phy-Inphi-IN112525_s03-retimer-support.patch b/target/linux/layerscape/patches-5.4/701-net-0328-net-phy-Inphi-IN112525_s03-retimer-support.patch index 46f45dfc69..a074c719d6 100644 --- a/target/linux/layerscape/patches-5.4/701-net-0328-net-phy-Inphi-IN112525_s03-retimer-support.patch +++ b/target/linux/layerscape/patches-5.4/701-net-0328-net-phy-Inphi-IN112525_s03-retimer-support.patch @@ -15,7 +15,7 @@ Signed-off-by: Florin Chiculita --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig -@@ -478,6 +478,11 @@ config ICPLUS_PHY +@@ -479,6 +479,11 @@ config ICPLUS_PHY ---help--- Currently supports the IP175C and IP1001 PHYs. diff --git a/target/linux/malta/README b/target/linux/malta/README index 0bb1a1e35a..bbe806de3d 100644 --- a/target/linux/malta/README +++ b/target/linux/malta/README @@ -11,9 +11,9 @@ For the 32 bit big-endian image: qemu-system-mips -kernel bin/targets/malta/be/openwrt-malta-be-vmlinux-initramfs.elf -nographic -m 256 For the 64 bit little-endian image: -qemu-system-mips64el -kernel bin/targets/malta/le64/openwrt-malta-le64-vmlinux-initramfs.elf -nographic -m 256 +qemu-system-mips64el -kernel bin/targets/malta/le64/openwrt-malta-le64-vmlinux-initramfs.elf -cpu MIPS64R2-generic -nographic -m 256 For the 64 bit big-endian image: -qemu-system-mips64 -kernel bin/targets/malta/be64/openwrt-malta-be64-vmlinux-initramfs.elf -nographic -m 256 +qemu-system-mips64 -kernel bin/targets/malta/be64/openwrt-malta-be64-vmlinux-initramfs.elf -cpu MIPS64R2-generic -nographic -m 256 and enjoy the system bootin. diff --git a/target/linux/malta/be64/config-default b/target/linux/malta/be64/config-default index e7352e68ee..fee1bc8c9d 100644 --- a/target/linux/malta/be64/config-default +++ b/target/linux/malta/be64/config-default @@ -6,18 +6,27 @@ CONFIG_ARCH_MMAP_RND_BITS_MAX=18 CONFIG_ARCH_MMAP_RND_BITS_MIN=12 CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y CONFIG_CPU_BIG_ENDIAN=y +CONFIG_CPU_HAS_RIXI=y # CONFIG_CPU_LITTLE_ENDIAN is not set CONFIG_CPU_MIPS64=y -CONFIG_CPU_MIPS64_R1=y +CONFIG_CPU_MIPS64_R2=y +CONFIG_CPU_MIPSR2=y CONFIG_CPU_SUPPORTS_64BIT_KERNEL=y CONFIG_CPU_SUPPORTS_HUGEPAGES=y +CONFIG_CPU_SUPPORTS_MSA=y CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE=y +CONFIG_HAVE_EBPF_JIT=y +CONFIG_HAVE_KVM=y CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y # CONFIG_MIPS32_N32 is not set # CONFIG_MIPS32_O32 is not set +CONFIG_MIPS_EBPF_JIT=y +CONFIG_MIPS_PGD_C0_CONTEXT=y +CONFIG_MIPS_SPRAM=y # CONFIG_MIPS_VA_BITS_48 is not set CONFIG_MODULES_USE_ELF_RELA=y CONFIG_PGTABLE_LEVELS=3 CONFIG_PHYS_ADDR_T_64BIT=y CONFIG_SYS_SUPPORTS_HUGETLBFS=y +CONFIG_TARGET_ISA_REV=2 CONFIG_ZONE_DMA32=y diff --git a/target/linux/malta/be64/target.mk b/target/linux/malta/be64/target.mk index 3a5bb6a6dc..e992c2c698 100644 --- a/target/linux/malta/be64/target.mk +++ b/target/linux/malta/be64/target.mk @@ -1,5 +1,5 @@ ARCH:=mips64 -CPU_TYPE:=mips64 +CPU_TYPE:=mips64r2 SUBTARGET:=be64 FEATURES+=source-only BOARDNAME:=Big Endian (64-bits) diff --git a/target/linux/malta/config-4.19 b/target/linux/malta/config-4.19 index 1f1b6fb549..862f869704 100644 --- a/target/linux/malta/config-4.19 +++ b/target/linux/malta/config-4.19 @@ -93,9 +93,7 @@ CONFIG_DTC=y CONFIG_DUMMY_CONSOLE=y CONFIG_ENABLE_MUST_CHECK=y CONFIG_EXT4_FS=y -# CONFIG_F2FS_CHECK_FS is not set CONFIG_F2FS_FS=y -# CONFIG_F2FS_FS_SECURITY is not set CONFIG_FS_IOMAP=y CONFIG_FS_MBCACHE=y CONFIG_FS_POSIX_ACL=y diff --git a/target/linux/malta/le64/config-default b/target/linux/malta/le64/config-default index 23e838aaba..531d93d58e 100644 --- a/target/linux/malta/le64/config-default +++ b/target/linux/malta/le64/config-default @@ -5,18 +5,27 @@ CONFIG_ARCH_MMAP_RND_BITS=12 CONFIG_ARCH_MMAP_RND_BITS_MAX=18 CONFIG_ARCH_MMAP_RND_BITS_MIN=12 CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y +CONFIG_CPU_HAS_RIXI=y CONFIG_CPU_LITTLE_ENDIAN=y CONFIG_CPU_MIPS64=y -CONFIG_CPU_MIPS64_R1=y +CONFIG_CPU_MIPS64_R2=y +CONFIG_CPU_MIPSR2=y CONFIG_CPU_SUPPORTS_64BIT_KERNEL=y CONFIG_CPU_SUPPORTS_HUGEPAGES=y +CONFIG_CPU_SUPPORTS_MSA=y CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE=y +CONFIG_HAVE_EBPF_JIT=y +CONFIG_HAVE_KVM=y CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y # CONFIG_MIPS32_N32 is not set # CONFIG_MIPS32_O32 is not set +CONFIG_MIPS_EBPF_JIT=y +CONFIG_MIPS_PGD_C0_CONTEXT=y +CONFIG_MIPS_SPRAM=y # CONFIG_MIPS_VA_BITS_48 is not set CONFIG_MODULES_USE_ELF_RELA=y CONFIG_PGTABLE_LEVELS=3 CONFIG_PHYS_ADDR_T_64BIT=y CONFIG_SYS_SUPPORTS_HUGETLBFS=y +CONFIG_TARGET_ISA_REV=2 CONFIG_ZONE_DMA32=y diff --git a/target/linux/malta/le64/target.mk b/target/linux/malta/le64/target.mk index a0a55af5f7..59dcc86bef 100644 --- a/target/linux/malta/le64/target.mk +++ b/target/linux/malta/le64/target.mk @@ -1,5 +1,5 @@ ARCH:=mips64el -CPU_TYPE:=mips64 +CPU_TYPE:=mips64r2 SUBTARGET:=le64 FEATURES+=source-only BOARDNAME:=Little Endian (64-bits) diff --git a/target/linux/mediatek/mt7623/config-4.19 b/target/linux/mediatek/mt7623/config-4.19 index 56ae95cc31..8434972279 100644 --- a/target/linux/mediatek/mt7623/config-4.19 +++ b/target/linux/mediatek/mt7623/config-4.19 @@ -173,11 +173,7 @@ CONFIG_EDAC_SUPPORT=y CONFIG_EINT_MTK=y CONFIG_ELF_CORE=y CONFIG_EXT4_FS=y -# CONFIG_F2FS_CHECK_FS is not set CONFIG_F2FS_FS=y -# CONFIG_F2FS_FS_SECURITY is not set -CONFIG_F2FS_FS_XATTR=y -CONFIG_F2FS_STAT_FS=y CONFIG_FIXED_PHY=y CONFIG_FIX_EARLYCON_MEM=y CONFIG_FREEZER=y diff --git a/target/linux/mediatek/mt7623/config-5.4 b/target/linux/mediatek/mt7623/config-5.4 index 28760e6003..a6b32ce33b 100644 --- a/target/linux/mediatek/mt7623/config-5.4 +++ b/target/linux/mediatek/mt7623/config-5.4 @@ -184,7 +184,6 @@ CONFIG_EINT_MTK=y CONFIG_ELF_CORE=y CONFIG_EXT4_FS=y CONFIG_F2FS_FS=y -CONFIG_F2FS_STAT_FS=y CONFIG_FIXED_PHY=y CONFIG_FIX_EARLYCON_MEM=y CONFIG_FREEZER=y diff --git a/target/linux/mediatek/patches-5.4/0003-switch-add-mt7531.patch b/target/linux/mediatek/patches-5.4/0003-switch-add-mt7531.patch index 7214dc1b08..2512ed3142 100644 --- a/target/linux/mediatek/patches-5.4/0003-switch-add-mt7531.patch +++ b/target/linux/mediatek/patches-5.4/0003-switch-add-mt7531.patch @@ -1,6 +1,6 @@ --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig -@@ -332,6 +332,8 @@ config RTL8367B_PHY +@@ -333,6 +333,8 @@ config RTL8367B_PHY endif # RTL8366_SMI diff --git a/target/linux/mediatek/patches-5.4/0600-net-phylink-propagate-resolved-link-config-via-mac_l.patch b/target/linux/mediatek/patches-5.4/0600-net-phylink-propagate-resolved-link-config-via-mac_l.patch index b480490b8d..6473dc19c3 100644 --- a/target/linux/mediatek/patches-5.4/0600-net-phylink-propagate-resolved-link-config-via-mac_l.patch +++ b/target/linux/mediatek/patches-5.4/0600-net-phylink-propagate-resolved-link-config-via-mac_l.patch @@ -111,7 +111,7 @@ Signed-off-by: David S. Miller struct mvpp2_port *port = netdev_priv(dev); --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -446,9 +446,10 @@ static void mtk_mac_link_down(struct phy +@@ -448,9 +448,10 @@ static void mtk_mac_link_down(struct phy mtk_w32(mac->hw, mcr, MTK_MAC_MCR(mac->id)); } @@ -199,7 +199,10 @@ Signed-off-by: David S. Miller + * @duplex: link duplex + * @tx_pause: link transmit pause enablement status + * @rx_pause: link receive pause enablement status -+ * + * +- * If @mode is not an in-band negotiation mode (as defined by +- * phylink_autoneg_inband()), allow the link to come up. If @phy +- * is non-%NULL, configure Energy Efficient Ethernet by calling + * Configure the MAC for an established link. + * + * @speed, @duplex, @tx_pause and @rx_pause indicate the finalised link @@ -211,10 +214,7 @@ Signed-off-by: David S. Miller + * Note that when 802.3z in-band negotiation is in use, it is possible + * that the user wishes to override the pause settings, and this should + * be allowed when considering the implementation of this method. - * -- * If @mode is not an in-band negotiation mode (as defined by -- * phylink_autoneg_inband()), allow the link to come up. If @phy -- * is non-%NULL, configure Energy Efficient Ethernet by calling ++ * + * If in-band negotiation mode is disabled, allow the link to come up. If + * @phy is non-%NULL, configure Energy Efficient Ethernet by calling * phy_init_eee() and perform appropriate MAC configuration for EEE. diff --git a/target/linux/mediatek/patches-5.4/0999-hnat.patch b/target/linux/mediatek/patches-5.4/0999-hnat.patch deleted file mode 100644 index f86c882eb2..0000000000 --- a/target/linux/mediatek/patches-5.4/0999-hnat.patch +++ /dev/null @@ -1,1234 +0,0 @@ ---- a/drivers/net/ethernet/mediatek/Kconfig -+++ b/drivers/net/ethernet/mediatek/Kconfig -@@ -15,4 +15,8 @@ config NET_MEDIATEK_SOC - This driver supports the gigabit ethernet MACs in the - MediaTek SoC family. - -+config NET_MEDIATEK_OFFLOAD -+ def_bool NET_MEDIATEK_SOC -+ depends on NET_MEDIATEK_SOC -+ - endif #NET_VENDOR_MEDIATEK ---- a/drivers/net/ethernet/mediatek/Makefile -+++ b/drivers/net/ethernet/mediatek/Makefile -@@ -5,3 +5,4 @@ - - obj-$(CONFIG_NET_MEDIATEK_SOC) += mtk_eth.o - mtk_eth-y := mtk_eth_soc.o mtk_sgmii.o mtk_eth_path.o -+mtk_eth-$(CONFIG_NET_MEDIATEK_OFFLOAD) += mtk_offload.o mtk_debugfs.o ---- /dev/null -+++ b/drivers/net/ethernet/mediatek/mtk_debugfs.c -@@ -0,0 +1,117 @@ -+/* This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; version 2 of the License -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * Copyright (C) 2014-2016 Sean Wang -+ * Copyright (C) 2016-2017 John Crispin -+ */ -+ -+#include "mtk_offload.h" -+ -+static const char *mtk_foe_entry_state_str[] = { -+ "INVALID", -+ "UNBIND", -+ "BIND", -+ "FIN" -+}; -+ -+static const char *mtk_foe_packet_type_str[] = { -+ "IPV4_HNAPT", -+ "IPV4_HNAT", -+ "IPV6_1T_ROUTE", -+ "IPV4_DSLITE", -+ "IPV6_3T_ROUTE", -+ "IPV6_5T_ROUTE", -+ "IPV6_6RD", -+}; -+ -+#define IPV4_HNAPT 0 -+#define IPV4_HNAT 1 -+#define IS_IPV4_HNAPT(x) (((x)->bfib1.pkt_type == IPV4_HNAPT) ? 1: 0) -+struct mtk_eth *_eth; -+#define es(entry) (mtk_foe_entry_state_str[entry->bfib1.state]) -+//#define ei(entry, end) (MTK_PPE_TBL_SZ - (int)(end - entry)) -+#define ei(entry, end) (MTK_PPE_ENTRY_CNT - (int)(end - entry)) -+#define pt(entry) (mtk_foe_packet_type_str[entry->ipv4_hnapt.bfib1.pkt_type]) -+ -+static int mtk_ppe_debugfs_foe_show(struct seq_file *m, void *private) -+{ -+ struct mtk_eth *eth = _eth; -+ struct mtk_foe_entry *entry, *end; -+ int i = 0; -+ -+ entry = eth->foe_table; -+ end = eth->foe_table + MTK_PPE_ENTRY_CNT; -+ -+ while (entry < end) { -+ if (!entry->bfib1.state) { -+ -+ } else if (IS_IPV4_HNAPT(entry)) { -+ __be32 saddr = htonl(entry->ipv4_hnapt.sip); -+ __be32 daddr = htonl(entry->ipv4_hnapt.dip); -+ __be32 nsaddr = htonl(entry->ipv4_hnapt.new_sip); -+ __be32 ndaddr = htonl(entry->ipv4_hnapt.new_dip); -+ unsigned char h_dest[ETH_ALEN]; -+ unsigned char h_source[ETH_ALEN]; -+ -+ *((u32*) h_source) = swab32(entry->ipv4_hnapt.smac_hi); -+ *((u16*) &h_source[4]) = swab16(entry->ipv4_hnapt.smac_lo); -+ *((u32*) h_dest) = swab32(entry->ipv4_hnapt.dmac_hi); -+ *((u16*) &h_dest[4]) = swab16(entry->ipv4_hnapt.dmac_lo); -+ seq_printf(m, -+ "(%x)0x%05x|state=%s|type=%s|" -+ "%pI4:%d->%pI4:%d=>%pI4:%d->%pI4:%d|%pM=>%pM|" -+ "etype=0x%04x|info1=0x%x|info2=0x%x|" -+ "vlan1=%d|vlan2=%d\n", -+ i, -+ ei(entry, end), es(entry), pt(entry), -+ &saddr, entry->ipv4_hnapt.sport, -+ &daddr, entry->ipv4_hnapt.dport, -+ &nsaddr, entry->ipv4_hnapt.new_sport, -+ &ndaddr, entry->ipv4_hnapt.new_dport, h_source, -+ h_dest, ntohs(entry->ipv4_hnapt.etype), -+ entry->ipv4_hnapt.info_blk1, -+ entry->ipv4_hnapt.info_blk2, -+ entry->ipv4_hnapt.vlan1, -+ entry->ipv4_hnapt.vlan2); -+ } else -+ seq_printf(m, "0x%05x state=%s\n", -+ ei(entry, end), es(entry)); -+ entry++; -+ i++; -+ } -+ -+ return 0; -+} -+ -+static int mtk_ppe_debugfs_foe_open(struct inode *inode, struct file *file) -+{ -+ return single_open(file, mtk_ppe_debugfs_foe_show, file->private_data); -+} -+ -+static const struct file_operations mtk_ppe_debugfs_foe_fops = { -+ .open = mtk_ppe_debugfs_foe_open, -+ .read = seq_read, -+ .llseek = seq_lseek, -+ .release = single_release, -+}; -+ -+int mtk_ppe_debugfs_init(struct mtk_eth *eth) -+{ -+ struct dentry *root; -+ -+ _eth = eth; -+ -+ root = debugfs_create_dir("mtk_ppe", NULL); -+ if (!root) -+ return -ENOMEM; -+ -+ debugfs_create_file("all_entry", S_IRUGO, root, eth, &mtk_ppe_debugfs_foe_fops); -+ -+ return 0; -+} ---- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c -+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -19,6 +19,8 @@ - #include - #include - #include -+#include -+#include - #include - - #include "mtk_eth_soc.h" -@@ -1327,8 +1329,16 @@ static int mtk_poll_rx(struct napi_struc - (trxd.rxd2 & RX_DMA_VTAG)) - __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), - RX_DMA_VID(trxd.rxd3)); -- skb_record_rx_queue(skb, 0); -- napi_gro_receive(napi, skb); -+#ifdef CONFIG_NET_MEDIATEK_OFFLOAD -+ if (mtk_offload_check_rx(eth, skb, trxd.rxd4) == 0) { -+#endif -+ skb_record_rx_queue(skb, 0); -+ napi_gro_receive(napi, skb); -+#ifdef CONFIG_NET_MEDIATEK_OFFLOAD -+ } else { -+ dev_kfree_skb(skb); -+ } -+#endif - - skip_rx: - ring->data[idx] = new_data; -@@ -2292,6 +2302,9 @@ static int mtk_open(struct net_device *d - mtk_tx_irq_enable(eth, MTK_TX_DONE_INT); - mtk_rx_irq_enable(eth, MTK_RX_DONE_INT); - refcount_set(ð->dma_refcnt, 1); -+#ifdef CONFIG_NET_MEDIATEK_OFFLOAD -+ mtk_ppe_probe(eth); -+#endif - } - else - refcount_inc(ð->dma_refcnt); -@@ -2355,6 +2368,9 @@ static int mtk_stop(struct net_device *d - - mtk_dma_free(eth); - -+#ifdef CONFIG_NET_MEDIATEK_OFFLOAD -+ mtk_ppe_remove(eth); -+#endif - return 0; - } - -@@ -2853,6 +2869,27 @@ static int mtk_set_rxnfc(struct net_devi - return ret; - } - -+#ifdef CONFIG_NET_MEDIATEK_OFFLOAD -+static int -+mtk_flow_offload(enum flow_offload_type type, struct flow_offload *flow, -+ struct flow_offload_hw_path *src, -+ struct flow_offload_hw_path *dest) -+{ -+ struct mtk_mac *mac = netdev_priv(src->dev); -+ struct mtk_eth *eth = mac->hw; -+ -+ if (!eth->soc->offload_version) -+ return -EINVAL; -+ -+ if (src->dev->base_addr != dest->dev->base_addr) -+ return -EINVAL; -+ -+ mac = netdev_priv(src->dev); -+ -+ return mtk_flow_offload_add(eth, type, flow, src, dest); -+} -+#endif -+ - static const struct ethtool_ops mtk_ethtool_ops = { - .get_link_ksettings = mtk_get_link_ksettings, - .set_link_ksettings = mtk_set_link_ksettings, -@@ -2884,6 +2921,9 @@ static const struct net_device_ops mtk_n - #ifdef CONFIG_NET_POLL_CONTROLLER - .ndo_poll_controller = mtk_poll_controller, - #endif -+#ifdef CONFIG_NET_MEDIATEK_OFFLOAD -+ .ndo_flow_offload = mtk_flow_offload, -+#endif - }; - - static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np) -@@ -3226,6 +3266,7 @@ static const struct mtk_soc_data mt7622_ - .hw_features = MTK_HW_FEATURES, - .required_clks = MT7622_CLKS_BITMAP, - .required_pctl = false, -+ .offload_version = MTK_OFFLOAD_V2, - }; - - static const struct mtk_soc_data mt7623_data = { ---- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h -+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h -@@ -790,6 +790,13 @@ enum mkt_eth_capabilities { - MTK_MUX_U3_GMAC2_TO_QPHY | \ - MTK_MUX_GMAC12_TO_GEPHY_SGMII | MTK_QDMA) - -+enum mtk_flow_offload_version { -+ MTK_OFFLOAD_NONE = 0, -+ MTK_OFFLOAD_V1, -+ MTK_OFFLOAD_V2, -+ MTK_OFFLOAD_V3, -+}; -+ - /* struct mtk_eth_data - This is the structure holding all differences - * among various plaforms - * @ana_rgc3: The offset for register ANA_RGC3 related to -@@ -807,6 +814,7 @@ struct mtk_soc_data { - u32 required_clks; - bool required_pctl; - netdev_features_t hw_features; -+ enum mtk_flow_offload_version offload_version; - }; - - /* currently no SoC has more than 2 macs */ -@@ -832,6 +840,23 @@ struct mtk_sgmii { - u32 ana_rgc3; - }; - -+ -+struct mib_entry { -+ u32 byt_cnt_l; -+ u16 byt_cnt_h; -+ u32 pkt_cnt_l; -+ u8 pkt_cnt_h; -+ u8 resv0; -+ u32 resv1; -+} __packed __aligned(4); -+ -+struct hnat_accounting { -+ u64 bytes; -+ u64 packets; -+}; -+ -+ -+ - /* struct mtk_eth - This is the main datasructure for holding the state - * of the driver - * @dev: The device pointer -@@ -917,6 +942,16 @@ struct mtk_eth { - u32 tx_int_status_reg; - u32 rx_dma_l4_valid; - int ip_align; -+ -+ struct reset_control *rst_ppe; -+ struct mtk_foe_entry *foe_table; -+ dma_addr_t foe_table_phys; -+ struct flow_offload __rcu **foe_flow_table; -+ -+ struct mib_entry *foe_mib_cpu; -+ dma_addr_t foe_mib_dev; -+ struct hnat_accounting *acct; -+ bool per_flow_accounting; - }; - - /* struct mtk_mac - the structure that holds the info about the MACs of the -@@ -949,6 +984,7 @@ void mtk_stats_update_mac(struct mtk_mac - - void mtk_w32(struct mtk_eth *eth, u32 val, unsigned reg); - u32 mtk_r32(struct mtk_eth *eth, unsigned reg); -+u32 mtk_m32(struct mtk_eth *eth, u32 mask, u32 set, unsigned reg); - - int mtk_sgmii_init(struct mtk_sgmii *ss, struct device_node *np, - u32 ana_rgc3); -@@ -961,4 +997,13 @@ int mtk_gmac_sgmii_path_setup(struct mtk - int mtk_gmac_gephy_path_setup(struct mtk_eth *eth, int mac_id); - int mtk_gmac_rgmii_path_setup(struct mtk_eth *eth, int mac_id); - -+int mtk_ppe_probe(struct mtk_eth *eth); -+void mtk_ppe_remove(struct mtk_eth *eth); -+int mtk_flow_offload_add(struct mtk_eth *eth, -+ enum flow_offload_type type, -+ struct flow_offload *flow, -+ struct flow_offload_hw_path *src, -+ struct flow_offload_hw_path *dest); -+int mtk_offload_check_rx(struct mtk_eth *eth, struct sk_buff *skb, u32 rxd4); -+ - #endif /* MTK_ETH_H */ ---- /dev/null -+++ b/drivers/net/ethernet/mediatek/mtk_offload.c -@@ -0,0 +1,609 @@ -+/* This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; version 2 of the License -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * Copyright (C) 2018 John Crispin -+ */ -+ -+#include "mtk_offload.h" -+ -+#define INVALID 0 -+#define UNBIND 1 -+#define BIND 2 -+#define FIN 3 -+ -+#define IPV4_HNAPT 0 -+#define IPV4_HNAT 1 -+ -+static u32 -+mtk_flow_hash_v4(struct flow_offload_tuple *tuple) -+{ -+ u32 ports = ntohs(tuple->src_port) << 16 | ntohs(tuple->dst_port); -+ u32 src = ntohl(tuple->dst_v4.s_addr); -+ u32 dst = ntohl(tuple->src_v4.s_addr); -+ u32 hash = (ports & src) | ((~ports) & dst); -+ u32 hash_23_0 = hash & 0xffffff; -+ u32 hash_31_24 = hash & 0xff000000; -+ -+ hash = ports ^ src ^ dst ^ ((hash_23_0 << 8) | (hash_31_24 >> 24)); -+ hash = ((hash & 0xffff0000) >> 16 ) ^ (hash & 0xfffff); -+ hash &= 0x7ff; -+ hash *= 2;; -+ -+ return hash; -+} -+ -+static int -+mtk_foe_prepare_v4(struct mtk_foe_entry *entry, -+ struct flow_offload_tuple *tuple, -+ struct flow_offload_tuple *dest_tuple, -+ struct flow_offload_hw_path *src, -+ struct flow_offload_hw_path *dest) -+{ -+ int is_mcast = !!is_multicast_ether_addr(dest->eth_dest); -+ -+ if (tuple->l4proto == IPPROTO_UDP) -+ entry->ipv4_hnapt.bfib1.udp = 1; -+ -+ entry->ipv4_hnapt.etype = htons(ETH_P_IP); -+ entry->ipv4_hnapt.bfib1.pkt_type = IPV4_HNAPT; -+ entry->ipv4_hnapt.iblk2.fqos = 0; -+ entry->ipv4_hnapt.bfib1.ttl = 1; -+ entry->ipv4_hnapt.bfib1.cah = 1; -+ entry->ipv4_hnapt.bfib1.ka = 1; -+ entry->ipv4_hnapt.iblk2.mcast = is_mcast; -+ entry->ipv4_hnapt.iblk2.dscp = 0; -+ entry->ipv4_hnapt.iblk2.port_mg = 0x3f; -+ entry->ipv4_hnapt.iblk2.port_ag = 0x1f; -+#ifdef CONFIG_NET_MEDIATEK_HW_QOS -+ entry->ipv4_hnapt.iblk2.qid = 1; -+ entry->ipv4_hnapt.iblk2.fqos = 1; -+#endif -+#ifdef CONFIG_RALINK -+ entry->ipv4_hnapt.iblk2.dp = 1; -+ if ((dest->flags & FLOW_OFFLOAD_PATH_VLAN) && (dest->vlan_id > 1)) -+ entry->ipv4_hnapt.iblk2.qid += 8; -+#else -+ entry->ipv4_hnapt.iblk2.dp = (dest->dev->name[3] - '0') + 1; -+#endif -+ -+ entry->ipv4_hnapt.sip = ntohl(tuple->src_v4.s_addr); -+ entry->ipv4_hnapt.dip = ntohl(tuple->dst_v4.s_addr); -+ entry->ipv4_hnapt.sport = ntohs(tuple->src_port); -+ entry->ipv4_hnapt.dport = ntohs(tuple->dst_port); -+ -+ entry->ipv4_hnapt.new_sip = ntohl(dest_tuple->dst_v4.s_addr); -+ entry->ipv4_hnapt.new_dip = ntohl(dest_tuple->src_v4.s_addr); -+ entry->ipv4_hnapt.new_sport = ntohs(dest_tuple->dst_port); -+ entry->ipv4_hnapt.new_dport = ntohs(dest_tuple->src_port); -+ -+ entry->bfib1.state = BIND; -+ -+ if (dest->flags & FLOW_OFFLOAD_PATH_PPPOE) { -+ entry->bfib1.psn = 1; -+ entry->ipv4_hnapt.etype = htons(ETH_P_PPP_SES); -+ entry->ipv4_hnapt.pppoe_id = dest->pppoe_sid; -+ } -+ -+ if (dest->flags & FLOW_OFFLOAD_PATH_VLAN) { -+ entry->ipv4_hnapt.vlan1 = dest->vlan_id; -+ entry->bfib1.vlan_layer = 1; -+ -+ switch (dest->vlan_proto) { -+ case htons(ETH_P_8021Q): -+ entry->ipv4_hnapt.bfib1.vpm = 1; -+ break; -+ case htons(ETH_P_8021AD): -+ entry->ipv4_hnapt.bfib1.vpm = 2; -+ break; -+ default: -+ return -EINVAL; -+ } -+ } -+ -+ if (dest->flags & FLOW_OFFLOAD_PATH_DSA) { -+ entry->bfib1.vlan_layer = 1; -+ -+ entry->ipv4_hnapt.bfib1.vpm = 0; -+ entry->ipv4_hnapt.etype = BIT(dest->dsa_port); -+ -+ if (dest->flags & FLOW_OFFLOAD_PATH_VLAN) { -+ if (dest->vlan_proto != htons(ETH_P_8021Q)) -+ return -EINVAL; -+ -+ entry->ipv4_hnapt.etype |= BIT(8); -+ } else { -+ entry->ipv4_hnapt.vlan1 = 0; -+ } -+ } -+ -+ return 0; -+} -+ -+static void -+mtk_foe_set_mac(struct mtk_foe_entry *entry, u8 *smac, u8 *dmac) -+{ -+ entry->ipv4_hnapt.dmac_hi = swab32(*((u32*) dmac)); -+ entry->ipv4_hnapt.dmac_lo = swab16(*((u16*) &dmac[4])); -+ entry->ipv4_hnapt.smac_hi = swab32(*((u32*) smac)); -+ entry->ipv4_hnapt.smac_lo = swab16(*((u16*) &smac[4])); -+} -+ -+static int -+mtk_check_entry_available(struct mtk_eth *eth, u32 hash) -+{ -+ struct mtk_foe_entry entry = ((struct mtk_foe_entry *)eth->foe_table)[hash]; -+ -+ return (entry.bfib1.state == BIND)? 0:1; -+} -+ -+static void -+mtk_foe_write(struct mtk_eth *eth, u32 hash, -+ struct mtk_foe_entry *entry) -+{ -+ struct mtk_foe_entry *table = (struct mtk_foe_entry *)eth->foe_table; -+ -+ memcpy(&table[hash], entry, sizeof(*entry)); -+} -+ -+int mtk_flow_offload_add(struct mtk_eth *eth, -+ enum flow_offload_type type, -+ struct flow_offload *flow, -+ struct flow_offload_hw_path *src, -+ struct flow_offload_hw_path *dest) -+{ -+ struct flow_offload_tuple *otuple = &flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple; -+ struct flow_offload_tuple *rtuple = &flow->tuplehash[FLOW_OFFLOAD_DIR_REPLY].tuple; -+ u32 time_stamp = mtk_r32(eth, 0x0010) & (0x7fff); -+ u32 ohash, rhash; -+ struct mtk_foe_entry orig = { -+ .bfib1.time_stamp = time_stamp, -+ .bfib1.psn = 0, -+ }; -+ struct mtk_foe_entry reply = { -+ .bfib1.time_stamp = time_stamp, -+ .bfib1.psn = 0, -+ }; -+ -+ if (otuple->l4proto != IPPROTO_TCP && otuple->l4proto != IPPROTO_UDP) -+ return -EINVAL; -+ -+ if (type == FLOW_OFFLOAD_DEL) { -+ flow = NULL; -+ synchronize_rcu(); -+ return 0; -+ } -+ -+ switch (otuple->l3proto) { -+ case AF_INET: -+ if (mtk_foe_prepare_v4(&orig, otuple, rtuple, src, dest) || -+ mtk_foe_prepare_v4(&reply, rtuple, otuple, dest, src)) -+ return -EINVAL; -+ -+ ohash = mtk_flow_hash_v4(otuple); -+ rhash = mtk_flow_hash_v4(rtuple); -+ break; -+ -+ case AF_INET6: -+ return -EINVAL; -+ -+ default: -+ return -EINVAL; -+ } -+ -+ /* Two-way hash: when hash collision occurs, the hash value will be shifted to the next position. */ -+ if (!mtk_check_entry_available(eth, ohash)){ -+ if (!mtk_check_entry_available(eth, ohash + 1)) -+ return -EINVAL; -+ ohash += 1; -+ } -+ if (!mtk_check_entry_available(eth, rhash)){ -+ if (!mtk_check_entry_available(eth, rhash + 1)) -+ return -EINVAL; -+ rhash += 1; -+ } -+ -+ mtk_foe_set_mac(&orig, dest->eth_src, dest->eth_dest); -+ mtk_foe_set_mac(&reply, src->eth_src, src->eth_dest); -+ mtk_foe_write(eth, ohash, &orig); -+ mtk_foe_write(eth, rhash, &reply); -+ rcu_assign_pointer(eth->foe_flow_table[ohash], flow); -+ rcu_assign_pointer(eth->foe_flow_table[rhash], flow); -+ -+ return 0; -+} -+ -+#ifdef CONFIG_NET_MEDIATEK_HW_QOS -+ -+#define QDMA_TX_SCH_TX 0x1a14 -+ -+static void mtk_ppe_scheduler(struct mtk_eth *eth, int id, u32 rate) -+{ -+ int exp = 0, shift = 0; -+ u32 reg = mtk_r32(eth, QDMA_TX_SCH_TX); -+ u32 val = 0; -+ -+ if (rate) -+ val = BIT(11); -+ -+ while (rate > 127) { -+ rate /= 10; -+ exp++; -+ } -+ -+ val |= (rate & 0x7f) << 4; -+ val |= exp & 0xf; -+ if (id) -+ shift = 16; -+ reg &= ~(0xffff << shift); -+ reg |= val << shift; -+ mtk_w32(eth, val, QDMA_TX_SCH_TX); -+} -+ -+#define QTX_CFG(x) (0x1800 + (x * 0x10)) -+#define QTX_SCH(x) (0x1804 + (x * 0x10)) -+ -+static void mtk_ppe_queue(struct mtk_eth *eth, int id, int sched, int weight, int resv, u32 min_rate, u32 max_rate) -+{ -+ int max_exp = 0, min_exp = 0; -+ u32 reg; -+ -+ if (id >= 16) -+ return; -+ -+ reg = mtk_r32(eth, QTX_SCH(id)); -+ reg &= 0x70000000; -+ -+ if (sched) -+ reg |= BIT(31); -+ -+ if (min_rate) -+ reg |= BIT(27); -+ -+ if (max_rate) -+ reg |= BIT(11); -+ -+ while (max_rate > 127) { -+ max_rate /= 10; -+ max_exp++; -+ } -+ -+ while (min_rate > 127) { -+ min_rate /= 10; -+ min_exp++; -+ } -+ -+ reg |= (min_rate & 0x7f) << 20; -+ reg |= (min_exp & 0xf) << 16; -+ reg |= (weight & 0xf) << 12; -+ reg |= (max_rate & 0x7f) << 4; -+ reg |= max_exp & 0xf; -+ mtk_w32(eth, reg, QTX_SCH(id)); -+ -+ resv &= 0xff; -+ reg = mtk_r32(eth, QTX_CFG(id)); -+ reg &= 0xffff0000; -+ reg |= (resv << 8) | resv; -+ mtk_w32(eth, reg, QTX_CFG(id)); -+} -+#endif -+ -+static int mtk_init_foe_table(struct mtk_eth *eth) -+{ -+ if (eth->foe_table) -+ return 0; -+ -+ eth->foe_flow_table = devm_kcalloc(eth->dev, MTK_PPE_ENTRY_CNT, -+ sizeof(*eth->foe_flow_table), -+ GFP_KERNEL); -+ if (!eth->foe_flow_table) -+ return -EINVAL; -+ -+ /* map the FOE table */ -+ eth->foe_table = dmam_alloc_coherent(eth->dev, MTK_PPE_TBL_SZ, -+ ð->foe_table_phys, GFP_KERNEL); -+ if (!eth->foe_table) { -+ dev_err(eth->dev, "failed to allocate foe table\n"); -+ kfree(eth->foe_flow_table); -+ return -ENOMEM; -+ } -+ -+ -+ return 0; -+} -+ -+static int mtk_ppe_start(struct mtk_eth *eth) -+{ -+ u32 foe_mib_tb_sz; -+ u32 foe_etry_num = MTK_PPE_ENTRY_CNT; -+ -+ int ret; -+ -+ ret = mtk_init_foe_table(eth); -+ if (ret) -+ return ret; -+ -+ /* tell the PPE about the tables base address */ -+ mtk_w32(eth, eth->foe_table_phys, MTK_REG_PPE_TB_BASE); -+ -+ /* flush the table */ -+ memset(eth->foe_table, 0, MTK_PPE_TBL_SZ); -+ -+ eth->per_flow_accounting = false; //true; -+ -+ if (eth->per_flow_accounting) { -+ foe_mib_tb_sz = foe_etry_num * sizeof(struct mib_entry); -+ eth->foe_mib_cpu = dma_alloc_coherent(eth->dev, foe_mib_tb_sz, -+ ð->foe_mib_dev, GFP_KERNEL); -+ if (!eth->foe_mib_cpu) -+ return -1; -+ mtk_w32(eth, eth->foe_mib_dev, MTK_REG_PPE_MIB_TB_BASE); -+ memset(eth->foe_mib_cpu, 0, foe_mib_tb_sz); -+ -+ eth->acct = -+ kzalloc(foe_etry_num * sizeof(struct hnat_accounting), -+ GFP_KERNEL); -+ if (!eth->acct) -+ return -1; -+ } -+ -+ /* setup hashing */ -+ mtk_m32(eth, -+ MTK_PPE_TB_CFG_HASH_MODE_MASK | MTK_PPE_TB_CFG_TBL_SZ_MASK, -+ MTK_PPE_TB_CFG_HASH_MODE1 | MTK_PPE_TB_CFG_TBL_SZ_4K, -+ MTK_REG_PPE_TB_CFG); -+ -+ /* set the default hashing seed */ -+ mtk_w32(eth, MTK_PPE_HASH_SEED, MTK_REG_PPE_HASH_SEED); -+ -+ /* each foe entry is 80bytes and is setup by cpu forwarding*/ -+ mtk_m32(eth, MTK_PPE_CAH_CTRL_X_MODE | MTK_PPE_TB_CFG_ENTRY_SZ_MASK | -+ MTK_PPE_TB_CFG_SMA_MASK, -+ MTK_PPE_TB_CFG_ENTRY_SZ_64B | MTK_PPE_TB_CFG_SMA_FWD_CPU, -+ MTK_REG_PPE_TB_CFG); -+ -+ /* set ip proto */ -+ //writel(0xFFFFFFFF, host->ppe_base + PPE_IP_PROT_CHK); -+ mtk_w32(eth, 0xFFFFFFFF, MTK_REG_PPE_IP_PROT_CHK); -+ -+ /* setup caching */ -+ // cr_set_field(host->ppe_base + PPE_CAH_CTRL, CAH_X_MODE, 1); -+ mtk_m32(eth, 1, MTK_PPE_CAH_CTRL_X_MODE, MTK_REG_PPE_CAH_CTRL); -+ // cr_set_field(host->ppe_base + PPE_CAH_CTRL, CAH_X_MODE, 0); -+ mtk_m32(eth, 0, MTK_PPE_CAH_CTRL_X_MODE, MTK_REG_PPE_CAH_CTRL); -+ // cr_set_field(host->ppe_base + PPE_CAH_CTRL, CAH_EN, 1); -+ mtk_m32(eth, MTK_PPE_CAH_CTRL_X_MODE, MTK_PPE_CAH_CTRL_EN, -+ MTK_REG_PPE_CAH_CTRL); -+ -+ /* enable FOE */ -+ /* cr_set_bits(host->ppe_base + PPE_FLOW_CFG, -+ BIT_UDP_IP4F_NAT_EN | BIT_IPV4_NAT_EN | BIT_IPV4_NAPT_EN | -+ BIT_IPV4_NAT_FRAG_EN | BIT_IPV4_HASH_GREK | -+ BIT_IPV4_DSL_EN | BIT_IPV6_6RD_EN | -+ BIT_IPV6_3T_ROUTE_EN | BIT_IPV6_5T_ROUTE_EN); */ -+ mtk_m32(eth, 0, MTK_PPE_FLOW_CFG_IPV4_NAT_FRAG_EN | -+ MTK_PPE_FLOW_CFG_IPV4_NAPT_EN | MTK_PPE_FLOW_CFG_IPV4_NAT_EN | -+ MTK_PPE_FLOW_CFG_IPV4_GREK_EN, -+ MTK_REG_PPE_FLOW_CFG); -+ -+ mtk_w32(eth, 0x000a7780, MTK_REG_PPE_FLOW_CFG); -+ -+ /* setup flow entry un/bind aging */ -+ // cr_set_field(host->ppe_base + PPE_TB_CFG, NTU_AGE, 1); -+ // cr_set_field(host->ppe_base + PPE_TB_CFG, UNBD_AGE, 1); -+ // cr_set_field(host->ppe_base + PPE_TB_CFG, TCP_AGE, 1); -+ // cr_set_field(host->ppe_base + PPE_TB_CFG, UDP_AGE, 1); -+ // cr_set_field(host->ppe_base + PPE_TB_CFG, FIN_AGE, 1); -+ mtk_m32(eth, 0, -+ MTK_PPE_TB_CFG_UNBD_AGE | MTK_PPE_TB_CFG_NTU_AGE | -+ MTK_PPE_TB_CFG_FIN_AGE | MTK_PPE_TB_CFG_UDP_AGE | -+ MTK_PPE_TB_CFG_TCP_AGE, -+ MTK_REG_PPE_TB_CFG); -+ -+ // cr_set_field(host->ppe_base + PPE_UNB_AGE, UNB_MNP, 1000); -+ // cr_set_field(host->ppe_base + PPE_UNB_AGE, UNB_DLTA, 3); -+ mtk_m32(eth, MTK_PPE_UNB_AGE_MNP_MASK | MTK_PPE_UNB_AGE_DLTA_MASK, -+ MTK_PPE_UNB_AGE_MNP | MTK_PPE_UNB_AGE_DLTA, -+ MTK_REG_PPE_UNB_AGE); -+ -+ // cr_set_field(host->ppe_base + PPE_BND_AGE_0, UDP_DLTA, 12); -+ // cr_set_field(host->ppe_base + PPE_BND_AGE_0, NTU_DLTA, 1); -+ mtk_m32(eth, MTK_PPE_BND_AGE0_NTU_DLTA_MASK | -+ MTK_PPE_BND_AGE0_UDP_DLTA_MASK, -+ MTK_PPE_BND_AGE0_NTU_DLTA | MTK_PPE_BND_AGE0_UDP_DLTA, -+ MTK_REG_PPE_BND_AGE0); -+ mtk_w32(eth, 0x0001000c, MTK_REG_PPE_BND_AGE0); -+ -+ // cr_set_field(host->ppe_base + PPE_BND_AGE_1, FIN_DLTA, 1); -+ // cr_set_field(host->ppe_base + PPE_BND_AGE_1, TCP_DLTA, 7); -+ mtk_m32(eth, MTK_PPE_BND_AGE1_FIN_DLTA_MASK | -+ MTK_PPE_BND_AGE1_TCP_DLTA_MASK, -+ MTK_PPE_BND_AGE1_FIN_DLTA | MTK_PPE_BND_AGE1_TCP_DLTA, -+ MTK_REG_PPE_BND_AGE1); -+ mtk_w32(eth, 0x00010007, MTK_REG_PPE_BND_AGE1); -+ -+ /* setup flow entry keep alive */ -+ // cr_set_field(host->ppe_base + PPE_TB_CFG, SCAN_MODE, 2); -+ // cr_set_field(host->ppe_base + PPE_TB_CFG, KA_CFG, 3); -+ mtk_m32(eth, MTK_PPE_TB_CFG_KA_MASK | MTK_PPE_TB_CFG_SCAN_MODE_MASK, -+ MTK_PPE_TB_CFG_KA | MTK_PPE_TB_CFG_SCAN_MODE, -+ MTK_REG_PPE_TB_CFG); -+ // cr_set_field(host->ppe_base + PPE_KA, KA_T, 1); -+ // cr_set_field(host->ppe_base + PPE_KA, TCP_KA, 1); -+ // cr_set_field(host->ppe_base + PPE_KA, UDP_KA, 1); -+ mtk_w32(eth, MTK_PPE_KA_UDP | MTK_PPE_KA_TCP | MTK_PPE_KA_T, MTK_REG_PPE_KA); -+ -+ /* setup flow entry rate limit */ -+ mtk_w32(eth, (0x3fff << 16) | 0x3fff, MTK_REG_PPE_BIND_LMT_0); -+ mtk_w32(eth, 0x2000000 | MTK_PPE_NTU_KA | 0x3fff, MTK_REG_PPE_BIND_LMT_1); -+ /* 30 packets per second */ -+ mtk_m32(eth, MTK_PPE_BNDR_RATE_MASK, 0x1e, MTK_REG_PPE_BNDR); -+ -+ /* enable the PPE */ -+ mtk_m32(eth, 0, MTK_PPE_GLO_CFG_EN, MTK_REG_PPE_GLO_CFG); -+ -+ /* set the default forwarding port to PDMA */ -+ mtk_w32(eth, 0x0, MTK_REG_PPE_DFT_CPORT); -+ -+ /* disallow packets with TTL=0 */ -+ mtk_m32(eth, 0, MTK_PPE_GLO_CFG_TTL0_DROP, MTK_REG_PPE_GLO_CFG); -+ -+ /*enable ppe mib counter*/ -+ if (eth->per_flow_accounting) { -+ mtk_w32(eth, 0x3, MTK_REG_PPE_MIB_CFG); -+ mtk_w32(eth, 0x3, MTK_REG_PPE_MIB_CAH_CTRL); -+ } -+ -+ /* send all traffic from gmac to the ppe */ -+ mtk_m32(eth, 0xffff, 0x4444, MTK_GDMA_FWD_CFG(0)); -+ mtk_m32(eth, 0xffff, 0x4444, MTK_GDMA_FWD_CFG(1)); -+ -+ mtk_w32(eth, 0x00027fb4, MTK_REG_PPE_TB_CFG); -+ -+ dev_info(eth->dev, "PPE started\n"); -+ -+#ifdef CONFIG_NET_MEDIATEK_HW_QOS -+ mtk_ppe_scheduler(eth, 0, 500000); -+ mtk_ppe_scheduler(eth, 1, 500000); -+ mtk_ppe_queue(eth, 0, 0, 7, 32, 250000, 0); -+ mtk_ppe_queue(eth, 1, 0, 7, 32, 250000, 0); -+ mtk_ppe_queue(eth, 8, 1, 7, 32, 250000, 0); -+ mtk_ppe_queue(eth, 9, 1, 7, 32, 250000, 0); -+#endif -+ -+ return 0; -+} -+ -+static int mtk_ppe_busy_wait(struct mtk_eth *eth) -+{ -+ unsigned long t_start = jiffies; -+ u32 r = 0; -+ -+ while (1) { -+ r = mtk_r32(eth, MTK_REG_PPE_GLO_CFG); -+ if (!(r & MTK_PPE_GLO_CFG_BUSY)) -+ return 0; -+ if (time_after(jiffies, t_start + HZ)) -+ break; -+ usleep_range(10, 20); -+ } -+ -+ dev_err(eth->dev, "ppe: table busy timeout - resetting\n"); -+ reset_control_reset(eth->rst_ppe); -+ -+ return -ETIMEDOUT; -+} -+ -+static int mtk_ppe_stop(struct mtk_eth *eth) -+{ -+ u32 r1 = 0, r2 = 0; -+ int i; -+ -+ /* discard all traffic while we disable the PPE */ -+ mtk_m32(eth, 0xffff, 0x7777, MTK_GDMA_FWD_CFG(0)); -+ mtk_m32(eth, 0xffff, 0x7777, MTK_GDMA_FWD_CFG(1)); -+ -+ if (mtk_ppe_busy_wait(eth)) -+ return -ETIMEDOUT; -+ -+ /* invalidate all flow table entries */ -+ for (i = 0; i < MTK_PPE_ENTRY_CNT; i++) -+ eth->foe_table[i].bfib1.state = FOE_STATE_INVALID; -+ -+ /* disable caching */ -+ mtk_m32(eth, 0, MTK_PPE_CAH_CTRL_X_MODE, MTK_REG_PPE_CAH_CTRL); -+ mtk_m32(eth, MTK_PPE_CAH_CTRL_X_MODE | MTK_PPE_CAH_CTRL_EN, 0, -+ MTK_REG_PPE_CAH_CTRL); -+ -+ /* flush cache has to be ahead of hnat diable --*/ -+ mtk_m32(eth, MTK_PPE_GLO_CFG_EN, 0, MTK_REG_PPE_GLO_CFG); -+ -+ /* disable FOE */ -+ mtk_m32(eth, -+ MTK_PPE_FLOW_CFG_IPV4_NAT_FRAG_EN | -+ MTK_PPE_FLOW_CFG_IPV4_NAPT_EN | MTK_PPE_FLOW_CFG_IPV4_NAT_EN | -+ MTK_PPE_FLOW_CFG_FUC_FOE | MTK_PPE_FLOW_CFG_FMC_FOE, -+ 0, MTK_REG_PPE_FLOW_CFG); -+ -+ /* disable FOE aging */ -+ mtk_m32(eth, 0, -+ MTK_PPE_TB_CFG_FIN_AGE | MTK_PPE_TB_CFG_UDP_AGE | -+ MTK_PPE_TB_CFG_TCP_AGE | MTK_PPE_TB_CFG_UNBD_AGE | -+ MTK_PPE_TB_CFG_NTU_AGE, MTK_REG_PPE_TB_CFG); -+ -+ r1 = mtk_r32(eth, 0x100); -+ r2 = mtk_r32(eth, 0x10c); -+ -+ dev_info(eth->dev, "0x100 = 0x%x, 0x10c = 0x%x\n", r1, r2); -+ -+ if (((r1 & 0xff00) >> 0x8) >= (r1 & 0xff) || -+ ((r1 & 0xff00) >> 0x8) >= (r2 & 0xff)) { -+ dev_info(eth->dev, "reset pse\n"); -+ mtk_w32(eth, 0x1, 0x4); -+ } -+ -+ /* set the foe entry base address to 0 */ -+ mtk_w32(eth, 0, MTK_REG_PPE_TB_BASE); -+ -+ if (mtk_ppe_busy_wait(eth)) -+ return -ETIMEDOUT; -+ -+ /* send all traffic back to the DMA engine */ -+ mtk_m32(eth, 0xffff, 0x0, MTK_GDMA_FWD_CFG(0)); -+ mtk_m32(eth, 0xffff, 0x0, MTK_GDMA_FWD_CFG(1)); -+ return 0; -+} -+ -+static void mtk_offload_keepalive(struct mtk_eth *eth, unsigned int hash) -+{ -+ struct flow_offload *flow; -+ -+ rcu_read_lock(); -+ flow = rcu_dereference(eth->foe_flow_table[hash]); -+ if (flow) -+ flow->timeout = jiffies + 30 * HZ; -+ rcu_read_unlock(); -+} -+ -+int mtk_offload_check_rx(struct mtk_eth *eth, struct sk_buff *skb, u32 rxd4) -+{ -+ unsigned int hash; -+ -+ switch (FIELD_GET(MTK_RXD4_CPU_REASON, rxd4)) { -+ case MTK_CPU_REASON_KEEPALIVE_UC_OLD_HDR: -+ case MTK_CPU_REASON_KEEPALIVE_MC_NEW_HDR: -+ case MTK_CPU_REASON_KEEPALIVE_DUP_OLD_HDR: -+ hash = FIELD_GET(MTK_RXD4_FOE_ENTRY, rxd4); -+ mtk_offload_keepalive(eth, hash); -+ return -1; -+ case MTK_CPU_REASON_PACKET_SAMPLING: -+ return -1; -+ default: -+ return 0; -+ } -+} -+ -+int mtk_ppe_probe(struct mtk_eth *eth) -+{ -+ int err; -+ -+ err = mtk_ppe_start(eth); -+ if (err) -+ return err; -+ -+ err = mtk_ppe_debugfs_init(eth); -+ if (err) -+ return err; -+ -+ return 0; -+} -+ -+void mtk_ppe_remove(struct mtk_eth *eth) -+{ -+ mtk_ppe_stop(eth); -+} ---- /dev/null -+++ b/drivers/net/ethernet/mediatek/mtk_offload.h -@@ -0,0 +1,298 @@ -+/* This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; version 2 of the License -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * Copyright (C) 2014-2016 Sean Wang -+ * Copyright (C) 2016-2017 John Crispin -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "mtk_eth_soc.h" -+ -+#ifdef CONFIG_RALINK -+/* ramips compat */ -+#define mtk_eth fe_priv -+#define MTK_GDMA_FWD_CFG(x) (0x500 + (x * 0x1000)) -+#define mtk_m32 fe_m32 -+ -+static inline u32 -+mtk_r32(struct mtk_eth *eth, u32 reg) -+{ -+ return fe_r32(reg); -+} -+ -+static inline void -+mtk_w32(struct mtk_eth *eth, u32 val, u32 reg) -+{ -+ fe_w32(val, reg); -+} -+#endif -+ -+#define MTK_REG_PPE_GLO_CFG 0xe00 -+#define MTK_PPE_GLO_CFG_BUSY BIT(31) -+#define MTK_PPE_GLO_CFG_TTL0_DROP BIT(4) -+#define MTK_PPE_GLO_CFG_EN BIT(0) -+ -+#define MTK_REG_PPE_FLOW_CFG 0xe04 -+#define MTK_PPE_FLOW_CFG_IPV4_GREK_EN BIT(19) -+#define MTK_PPE_FLOW_CFG_IPV4_NAT_FRAG_EN BIT(17) -+#define MTK_PPE_FLOW_CFG_IPV4_NAPT_EN BIT(13) -+#define MTK_PPE_FLOW_CFG_IPV4_NAT_EN BIT(12) -+#define MTK_PPE_FLOW_CFG_FUC_FOE BIT(2) -+#define MTK_PPE_FLOW_CFG_FMC_FOE BIT(1) -+ -+#define MTK_REG_PPE_IP_PROT_CHK 0xe08 -+ -+#define MTK_REG_PPE_TB_BASE 0xe20 -+ -+#define MTK_REG_PPE_BNDR 0xe28 -+#define MTK_PPE_BNDR_RATE_MASK 0xffff -+ -+#define MTK_REG_PPE_BIND_LMT_0 0xe2C -+ -+#define MTK_REG_PPE_BIND_LMT_1 0xe30 -+#define MTK_PPE_NTU_KA BIT(16) -+ -+#define MTK_REG_PPE_KA 0xe34 -+#define MTK_PPE_KA_T BIT(0) -+#define MTK_PPE_KA_TCP BIT(16) -+#define MTK_PPE_KA_UDP BIT(24) -+ -+#define MTK_REG_PPE_UNB_AGE 0xe38 -+#define MTK_PPE_UNB_AGE_MNP_MASK (0xffff << 16) -+#define MTK_PPE_UNB_AGE_MNP (1000 << 16) -+#define MTK_PPE_UNB_AGE_DLTA_MASK 0xff -+#define MTK_PPE_UNB_AGE_DLTA 3 -+ -+#define MTK_REG_PPE_BND_AGE0 0xe3c -+#define MTK_PPE_BND_AGE0_NTU_DLTA_MASK (0xffff << 16) -+#define MTK_PPE_BND_AGE0_NTU_DLTA (5 << 16) -+#define MTK_PPE_BND_AGE0_UDP_DLTA_MASK 0xffff -+#define MTK_PPE_BND_AGE0_UDP_DLTA 5 -+ -+#define MTK_REG_PPE_BND_AGE1 0xe40 -+#define MTK_PPE_BND_AGE1_FIN_DLTA_MASK (0xffff << 16) -+#define MTK_PPE_BND_AGE1_FIN_DLTA (5 << 16) -+#define MTK_PPE_BND_AGE1_TCP_DLTA_MASK 0xffff -+#define MTK_PPE_BND_AGE1_TCP_DLTA 5 -+ -+#define MTK_REG_PPE_DFT_CPORT 0xe48 -+ -+#define MTK_REG_PPE_TB_CFG 0xe1c -+#define MTK_PPE_TB_CFG_X_MODE_MASK (3 << 18) -+#define MTK_PPE_TB_CFG_HASH_MODE1 BIT(14) -+#define MTK_PPE_TB_CFG_HASH_MODE_MASK (0x3 << 14) -+#define MTK_PPE_TB_CFG_KA (3 << 12) -+#define MTK_PPE_TB_CFG_KA_MASK (0x3 << 12) -+#define MTK_PPE_TB_CFG_SCAN_MODE (2 << 16) -+#define MTK_PPE_TB_CFG_SCAN_MODE_MASK (0x3 << 16) -+#define MTK_PPE_TB_CFG_FIN_AGE BIT(11) -+#define MTK_PPE_TB_CFG_UDP_AGE BIT(10) -+#define MTK_PPE_TB_CFG_TCP_AGE BIT(9) -+#define MTK_PPE_TB_CFG_UNBD_AGE BIT(8) -+#define MTK_PPE_TB_CFG_NTU_AGE BIT(7) -+#define MTK_PPE_TB_CFG_SMA_FWD_CPU (0x3 << 4) -+#define MTK_PPE_TB_CFG_SMA_MASK (0x3 << 4) -+#define MTK_PPE_TB_CFG_ENTRY_SZ_64B 0 -+#define MTK_PPE_TB_CFG_ENTRY_SZ_80B 1 -+#define MTK_PPE_TB_CFG_ENTRY_SZ_MASK BIT(3) -+#define MTK_PPE_TB_CFG_TBL_SZ_4K 4 -+#define MTK_PPE_TB_CFG_TBL_SZ_MASK 0x7 -+ -+#define MTK_REG_PPE_HASH_SEED 0xe44 -+#define MTK_PPE_HASH_SEED 0x12345678 -+ -+ -+#define MTK_REG_PPE_CAH_CTRL 0xf20 -+#define MTK_PPE_CAH_CTRL_X_MODE BIT(9) -+#define MTK_PPE_CAH_CTRL_EN BIT(0) -+ -+#define MTK_REG_PPE_MIB_CFG 0xf34 -+#define MTK_REG_PPE_MIB_TB_BASE 0xf38 -+#define MTK_REG_PPE_MIB_CAH_CTRL 0Xf50 -+ -+ -+struct mtk_foe_unbind_info_blk { -+ u32 time_stamp:8; -+ u32 pcnt:16; /* packet count */ -+ u32 preb:1; -+ u32 pkt_type:3; -+ u32 state:2; -+ u32 udp:1; -+ u32 sta:1; /* static entry */ -+} __attribute__ ((packed)); -+ -+struct mtk_foe_bind_info_blk { -+ u32 time_stamp:15; -+ u32 ka:1; /* keep alive */ -+ u32 vlan_layer:3; -+ u32 psn:1; /* egress packet has PPPoE session */ -+#ifdef CONFIG_RALINK -+ u32 vpm:2; /* 0:ethertype remark, 1:0x8100(CR default) */ -+#else -+ u32 vpm:1; /* 0:ethertype remark, 1:0x8100(CR default) */ -+ u32 ps:1; /* packet sampling */ -+#endif -+ u32 cah:1; /* cacheable flag */ -+ u32 rmt:1; /* remove tunnel ip header (6rd/dslite only) */ -+ u32 ttl:1; -+ u32 pkt_type:3; -+ u32 state:2; -+ u32 udp:1; -+ u32 sta:1; /* static entry */ -+} __attribute__ ((packed)); -+ -+struct mtk_foe_info_blk2 { -+ u32 qid:4; /* QID in Qos Port */ -+ u32 fqos:1; /* force to PSE QoS port */ -+ u32 dp:3; /* force to PSE port x -+ 0:PSE,1:GSW, 2:GMAC,4:PPE,5:QDMA,7=DROP */ -+ u32 mcast:1; /* multicast this packet to CPU */ -+ u32 pcpl:1; /* OSBN */ -+ u32 mlen:1; /* 0:post 1:pre packet length in meter */ -+ u32 alen:1; /* 0:post 1:pre packet length in accounting */ -+ u32 port_mg:6; /* port meter group */ -+ u32 port_ag:6; /* port account group */ -+ u32 dscp:8; /* DSCP value */ -+} __attribute__ ((packed)); -+ -+/* info blk2 for WHNAT */ -+struct hnat_info_blk2_whnat { -+ u32 qid : 4; /* QID[3:0] in Qos Port */ -+ u32 fqos : 1; /* force to PSE QoS port */ -+ u32 dp : 3; /* force to PSE port x -+ * 0:PSE,1:GSW, 2:GMAC,4:PPE,5:QDMA,7=DROP -+ */ -+ u32 mcast : 1; /* multicast this packet to CPU */ -+ u32 pcpl : 1; /* OSBN */ -+ u32 mibf : 1; /* 0:off 1:on PPE MIB counter */ -+ u32 alen : 1; /* 0:post 1:pre packet length in accounting */ -+ u32 qid2 : 2; /* QID[5:4] in Qos Port */ -+ u32 resv : 2; -+ u32 wdmaid : 1; /* 0:to pcie0 dev 1:to pcie1 dev */ -+ u32 winfoi : 1; /* 0:off 1:on Wi-Fi hwnat support */ -+ u32 port_ag : 6; /* port account group */ -+ u32 dscp : 8; /* DSCP value */ -+} __attribute__ ((packed)); -+ -+struct hnat_winfo { -+ u32 bssid : 6; /* WiFi Bssidx */ -+ u32 wcid : 8; /* WiFi wtable Idx */ -+ u32 rxid : 2; /* WiFi Ring idx */ -+} __attribute__ ((packed)); -+ -+struct mtk_foe_ipv4_hnapt { -+ union { -+ struct mtk_foe_bind_info_blk bfib1; -+ struct mtk_foe_unbind_info_blk udib1; -+ u32 info_blk1; -+ }; -+ u32 sip; -+ u32 dip; -+ u16 dport; -+ u16 sport; -+ union { -+ struct mtk_foe_info_blk2 iblk2; -+ struct hnat_info_blk2_whnat iblk2w; -+ u32 info_blk2; -+ }; -+ u32 new_sip; -+ u32 new_dip; -+ u16 new_dport; -+ u16 new_sport; -+ u32 resv1; -+ u32 resv2; -+ u32 resv3:26; -+ u32 act_dp:6; /* UDF */ -+ u16 vlan1; -+ u16 etype; -+ u32 dmac_hi; -+ union { -+ struct hnat_winfo winfo; -+ u16 vlan2; -+ }; -+ u16 dmac_lo; -+ u32 smac_hi; -+ u16 pppoe_id; -+ u16 smac_lo; -+} __attribute__ ((packed)); -+ -+struct mtk_foe_entry { -+ union { -+ struct mtk_foe_unbind_info_blk udib1; -+ struct mtk_foe_bind_info_blk bfib1; -+ struct mtk_foe_ipv4_hnapt ipv4_hnapt; -+ }; -+}; -+ -+enum mtk_foe_entry_state { -+ FOE_STATE_INVALID = 0, -+ FOE_STATE_UNBIND = 1, -+ FOE_STATE_BIND = 2, -+ FOE_STATE_FIN = 3 -+}; -+ -+ -+#define MTK_RXD4_FOE_ENTRY GENMASK(13, 0) -+#define MTK_RXD4_CPU_REASON GENMASK(18, 14) -+#define MTK_RXD4_SRC_PORT GENMASK(21, 19) -+#define MTK_RXD4_ALG GENMASK(31, 22) -+ -+enum mtk_foe_cpu_reason { -+ MTK_CPU_REASON_TTL_EXCEEDED = 0x02, -+ MTK_CPU_REASON_OPTION_HEADER = 0x03, -+ MTK_CPU_REASON_NO_FLOW = 0x07, -+ MTK_CPU_REASON_IPV4_FRAG = 0x08, -+ MTK_CPU_REASON_IPV4_DSLITE_FRAG = 0x09, -+ MTK_CPU_REASON_IPV4_DSLITE_NO_TCP_UDP = 0x0a, -+ MTK_CPU_REASON_IPV6_6RD_NO_TCP_UDP = 0x0b, -+ MTK_CPU_REASON_TCP_FIN_SYN_RST = 0x0c, -+ MTK_CPU_REASON_UN_HIT = 0x0d, -+ MTK_CPU_REASON_HIT_UNBIND = 0x0e, -+ MTK_CPU_REASON_HIT_UNBIND_RATE_REACHED = 0x0f, -+ MTK_CPU_REASON_HIT_BIND_TCP_FIN = 0x10, -+ MTK_CPU_REASON_HIT_TTL_1 = 0x11, -+ MTK_CPU_REASON_HIT_BIND_VLAN_VIOLATION = 0x12, -+ MTK_CPU_REASON_KEEPALIVE_UC_OLD_HDR = 0x13, -+ MTK_CPU_REASON_KEEPALIVE_MC_NEW_HDR = 0x14, -+ MTK_CPU_REASON_KEEPALIVE_DUP_OLD_HDR = 0x15, -+ MTK_CPU_REASON_HIT_BIND_FORCE_CPU = 0x16, -+ MTK_CPU_REASON_TUNNEL_OPTION_HEADER = 0x17, -+ MTK_CPU_REASON_MULTICAST_TO_CPU = 0x18, -+ MTK_CPU_REASON_MULTICAST_TO_GMAC1_CPU = 0x19, -+ MTK_CPU_REASON_HIT_PRE_BIND = 0x1a, -+ MTK_CPU_REASON_PACKET_SAMPLING = 0x1b, -+ MTK_CPU_REASON_EXCEED_MTU = 0x1c, -+ MTK_CPU_REASON_PPE_BYPASS = 0x1e, -+ MTK_CPU_REASON_INVALID = 0x1f, -+}; -+ -+ -+/* our table size is 4K */ -+#define MTK_PPE_ENTRY_CNT 0x4000 -+#define MTK_PPE_TBL_SZ \ -+ (MTK_PPE_ENTRY_CNT * sizeof(struct mtk_foe_entry)) -+ -+int mtk_ppe_debugfs_init(struct mtk_eth *eth); -+ -+ -+ diff --git a/target/linux/mediatek/patches-5.4/1011-net-ethernet-mtk_eth_soc-add-support-for-coherent-DM.patch b/target/linux/mediatek/patches-5.4/1011-net-ethernet-mtk_eth_soc-add-support-for-coherent-DM.patch index ed9aecdf74..18ddd0863e 100644 --- a/target/linux/mediatek/patches-5.4/1011-net-ethernet-mtk_eth_soc-add-support-for-coherent-DM.patch +++ b/target/linux/mediatek/patches-5.4/1011-net-ethernet-mtk_eth_soc-add-support-for-coherent-DM.patch @@ -37,12 +37,13 @@ Signed-off-by: Felix Fietkau #include #include #include -@@ -2486,6 +2487,12 @@ static int mtk_hw_init(struct mtk_eth *e +@@ -2482,6 +2483,13 @@ static int mtk_hw_init(struct mtk_eth *e if (ret) goto err_disable_pm; + if (of_dma_is_coherent(eth->dev->of_node)) { -+ u32 mask = ETHSYS_DMA_AG_MAP_PDMA | ETHSYS_DMA_AG_MAP_QDMA; ++ u32 mask = ETHSYS_DMA_AG_MAP_PDMA | ETHSYS_DMA_AG_MAP_QDMA | ++ ETHSYS_DMA_AG_MAP_PPE; + + regmap_update_bits(eth->ethsys, ETHSYS_DMA_AG_MAP, mask, mask); + } @@ -50,7 +51,7 @@ Signed-off-by: Felix Fietkau if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) { ret = device_reset(eth->dev); if (ret) { -@@ -3088,6 +3095,16 @@ static int mtk_probe(struct platform_dev +@@ -3080,6 +3088,16 @@ static int mtk_probe(struct platform_dev } } @@ -69,7 +70,7 @@ Signed-off-by: Felix Fietkau GFP_KERNEL); --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h -@@ -426,6 +426,11 @@ +@@ -435,6 +435,12 @@ #define RSTCTRL_FE BIT(6) #define RSTCTRL_PPE BIT(31) @@ -77,6 +78,7 @@ Signed-off-by: Felix Fietkau +#define ETHSYS_DMA_AG_MAP 0x408 +#define ETHSYS_DMA_AG_MAP_PDMA BIT(0) +#define ETHSYS_DMA_AG_MAP_QDMA BIT(1) ++#define ETHSYS_DMA_AG_MAP_PPE BIT(2) + /* SGMII subsystem config registers */ /* Register to auto-negotiation restart */ diff --git a/target/linux/mvebu/config-4.19 b/target/linux/mvebu/config-4.19 index 1eae0a55db..7a13cd50c9 100644 --- a/target/linux/mvebu/config-4.19 +++ b/target/linux/mvebu/config-4.19 @@ -176,9 +176,7 @@ CONFIG_EDAC_ATOMIC_SCRUB=y CONFIG_EDAC_SUPPORT=y CONFIG_EXT4_FS=y CONFIG_EXTCON=y -# CONFIG_F2FS_CHECK_FS is not set CONFIG_F2FS_FS=y -# CONFIG_F2FS_FS_SECURITY is not set CONFIG_FIXED_PHY=y CONFIG_FIX_EARLYCON_MEM=y CONFIG_FS_IOMAP=y diff --git a/target/linux/mvebu/cortexa9/base-files/etc/uci-defaults/03_wireless b/target/linux/mvebu/cortexa9/base-files/etc/uci-defaults/03_wireless index 6d4298c098..2039aeaf1b 100644 --- a/target/linux/mvebu/cortexa9/base-files/etc/uci-defaults/03_wireless +++ b/target/linux/mvebu/cortexa9/base-files/etc/uci-defaults/03_wireless @@ -14,9 +14,10 @@ linksys,wrt1200ac|\ linksys,wrt1900ac-v1|\ linksys,wrt1900ac-v2|\ linksys,wrt1900acs|\ +linksys,wrt3200acm|\ linksys,wrt32x) SKU=$(strings /dev/mtd3|sed -ne 's/^cert_region=//p') - WIFIMAC2G=$(macaddr_add $(cat /sys/class/net/eth0/address) +1) + WIFIMAC2G=$(macaddr_add $(mtd_get_mac_ascii devinfo hw_mac_addr) +1) WIFIMAC5G=$(macaddr_add $WIFIMAC2G +1) case "$SKU" in AP) diff --git a/target/linux/mvebu/image/cortexa53.mk b/target/linux/mvebu/image/cortexa53.mk index ff8f2c0930..b65f25472c 100644 --- a/target/linux/mvebu/image/cortexa53.mk +++ b/target/linux/mvebu/image/cortexa53.mk @@ -15,6 +15,7 @@ define Device/globalscale_espressobin DEVICE_ALT0_MODEL := Armada 3700 Community Board DEVICE_ALT0_VARIANT := Non-eMMC SOC := armada-3720 + BOOT_SCRIPT := espressobin endef TARGET_DEVICES += globalscale_espressobin @@ -27,6 +28,7 @@ define Device/globalscale_espressobin-emmc DEVICE_ALT0_MODEL := Armada 3700 Community Board DEVICE_ALT0_VARIANT := eMMC SOC := armada-3720 + BOOT_SCRIPT := espressobin endef TARGET_DEVICES += globalscale_espressobin-emmc @@ -39,6 +41,7 @@ define Device/globalscale_espressobin-v7 DEVICE_ALT0_MODEL := Armada 3700 Community Board DEVICE_ALT0_VARIANT := V7 Non-eMMC SOC := armada-3720 + BOOT_SCRIPT := espressobin endef TARGET_DEVICES += globalscale_espressobin-v7 @@ -51,6 +54,7 @@ define Device/globalscale_espressobin-v7-emmc DEVICE_ALT0_MODEL := Armada 3700 Community Board DEVICE_ALT0_VARIANT := V7 eMMC SOC := armada-3720 + BOOT_SCRIPT := espressobin endef TARGET_DEVICES += globalscale_espressobin-v7-emmc diff --git a/target/linux/mvebu/image/espressobin.bootscript b/target/linux/mvebu/image/espressobin.bootscript new file mode 100644 index 0000000000..07765df979 --- /dev/null +++ b/target/linux/mvebu/image/espressobin.bootscript @@ -0,0 +1,34 @@ +# Bootscript for Globalscale ESPRESSOBin Board + +# Set distro variables if necessary for compability with downstream firmware +if test -z "${kernel_addr_r}"; then + setenv kernel_addr_r 0x7000000 +fi + +if test -z "${fdt_add_r}"; then + setenv fdt_addr_r 0x6f00000 +fi + +if test -z "${devtype}"; then + setenv devtype mmc +fi + +if test -z "${devnum}"; then + if mmc dev 0; then + setenv devnum 0 + elif mmc dev 1; then + setenv devnum 1 + fi +fi + +# figure out partition uuid to pass to the kernel as root= +part uuid ${devtype} ${devnum}:2 uuid + +setenv console "console=ttyMV0,115200 earlycon=ar3700_uart,0xd0012000" +setenv bootargs "root=PARTUUID=${uuid} rw rootwait ${console}" + +echo "Booting Linux from ${devtype} ${devnum} with args: ${bootargs}" +load ${devtype} ${devnum}:1 ${fdt_addr_r} @DTB@.dtb +load ${devtype} ${devnum}:1 ${kernel_addr_r} Image + +booti ${kernel_addr_r} - ${fdt_addr_r} diff --git a/target/linux/mvebu/patches-5.4/402-PCI-aardvark-Wait-for-endpoint-to-be-ready-before-tr.patch b/target/linux/mvebu/patches-5.4/402-PCI-aardvark-Wait-for-endpoint-to-be-ready-before-tr.patch new file mode 100644 index 0000000000..95abbce002 --- /dev/null +++ b/target/linux/mvebu/patches-5.4/402-PCI-aardvark-Wait-for-endpoint-to-be-ready-before-tr.patch @@ -0,0 +1,50 @@ +From f4c7d053d7f77cd5c1a1ba7c7ce085ddba13d1d7 Mon Sep 17 00:00:00 2001 +From: Remi Pommarel +Date: Wed, 22 May 2019 23:33:50 +0200 +Subject: [PATCH] PCI: aardvark: Wait for endpoint to be ready before training + link + +When configuring pcie reset pin from gpio (e.g. initially set by +u-boot) to pcie function this pin goes low for a brief moment +asserting the PERST# signal. Thus connected device enters fundamental +reset process and link configuration can only begin after a minimal +100ms delay (see [1]). + +Because the pin configuration comes from the "default" pinctrl it is +implicitly configured before the probe callback is called: + +driver_probe_device() + really_probe() + ... + pinctrl_bind_pins() /* Here pin goes from gpio to PCIE reset + function and PERST# is asserted */ + ... + drv->probe() + +[1] "PCI Express Base Specification", REV. 4.0 + PCI Express, February 19 2014, 6.6.1 Conventional Reset + +Signed-off-by: Remi Pommarel +Signed-off-by: Lorenzo Pieralisi +Acked-by: Thomas Petazzoni +--- + drivers/pci/controller/pci-aardvark.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +--- a/drivers/pci/controller/pci-aardvark.c ++++ b/drivers/pci/controller/pci-aardvark.c +@@ -337,6 +337,14 @@ static void advk_pcie_setup_hw(struct ad + reg |= PIO_CTRL_ADDR_WIN_DISABLE; + advk_writel(pcie, reg, PIO_CTRL); + ++ /* ++ * PERST# signal could have been asserted by pinctrl subsystem before ++ * probe() callback has been called, making the endpoint going into ++ * fundamental reset. As required by PCI Express spec a delay for at ++ * least 100ms after such a reset before link training is needed. ++ */ ++ msleep(PCI_PM_D3COLD_WAIT); ++ + /* Start link training */ + reg = advk_readl(pcie, PCIE_CORE_LINK_CTRL_STAT_REG); + reg |= PCIE_CORE_LINK_TRAINING; diff --git a/target/linux/mvebu/patches-5.4/403-PCI-aardvark-Don-t-rely-on-jiffies-while-holding-spi.patch b/target/linux/mvebu/patches-5.4/403-PCI-aardvark-Don-t-rely-on-jiffies-while-holding-spi.patch new file mode 100644 index 0000000000..db4afd22a2 --- /dev/null +++ b/target/linux/mvebu/patches-5.4/403-PCI-aardvark-Don-t-rely-on-jiffies-while-holding-spi.patch @@ -0,0 +1,54 @@ +From 7fbcb5da811be7d47468417c7795405058abb3da Mon Sep 17 00:00:00 2001 +From: Remi Pommarel +Date: Fri, 27 Sep 2019 10:55:02 +0200 +Subject: [PATCH] PCI: aardvark: Don't rely on jiffies while holding spinlock + +advk_pcie_wait_pio() can be called while holding a spinlock (from +pci_bus_read_config_dword()), then depends on jiffies in order to +timeout while polling on PIO state registers. In the case the PIO +transaction failed, the timeout will never happen and will also cause +the cpu to stall. + +This decrements a variable and wait instead of using jiffies. + +Signed-off-by: Remi Pommarel +Signed-off-by: Lorenzo Pieralisi +Reviewed-by: Andrew Murray +Acked-by: Thomas Petazzoni +--- + drivers/pci/controller/pci-aardvark.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +--- a/drivers/pci/controller/pci-aardvark.c ++++ b/drivers/pci/controller/pci-aardvark.c +@@ -175,7 +175,8 @@ + (PCIE_CONF_BUS(bus) | PCIE_CONF_DEV(PCI_SLOT(devfn)) | \ + PCIE_CONF_FUNC(PCI_FUNC(devfn)) | PCIE_CONF_REG(where)) + +-#define PIO_TIMEOUT_MS 1 ++#define PIO_RETRY_CNT 500 ++#define PIO_RETRY_DELAY 2 /* 2 us*/ + + #define LINK_WAIT_MAX_RETRIES 10 + #define LINK_WAIT_USLEEP_MIN 90000 +@@ -400,17 +401,16 @@ static void advk_pcie_check_pio_status(s + static int advk_pcie_wait_pio(struct advk_pcie *pcie) + { + struct device *dev = &pcie->pdev->dev; +- unsigned long timeout; ++ int i; + +- timeout = jiffies + msecs_to_jiffies(PIO_TIMEOUT_MS); +- +- while (time_before(jiffies, timeout)) { ++ for (i = 0; i < PIO_RETRY_CNT; i++) { + u32 start, isr; + + start = advk_readl(pcie, PIO_START); + isr = advk_readl(pcie, PIO_ISR); + if (!start && isr) + return 0; ++ udelay(PIO_RETRY_DELAY); + } + + dev_err(dev, "config read/write timed out\n"); diff --git a/target/linux/mvebu/patches-5.4/404-PCI-aardvark-Train-link-immediately-after-enabling-t.patch b/target/linux/mvebu/patches-5.4/404-PCI-aardvark-Train-link-immediately-after-enabling-t.patch new file mode 100644 index 0000000000..c9e49ac2f1 --- /dev/null +++ b/target/linux/mvebu/patches-5.4/404-PCI-aardvark-Train-link-immediately-after-enabling-t.patch @@ -0,0 +1,60 @@ +From 6964494582f56a3882c2c53b0edbfe99eb32b2e1 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Pali=20Roh=C3=A1r?= +Date: Thu, 30 Apr 2020 10:06:14 +0200 +Subject: [PATCH] PCI: aardvark: Train link immediately after enabling training +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Adding even 100ms (PCI_PM_D3COLD_WAIT) delay between enabling link +training and starting link training causes detection issues with some +buggy cards (such as Compex WLE900VX). + +Move the code which enables link training immediately before the one +which starts link traning. + +This fixes detection issues of Compex WLE900VX card on Turris MOX after +cold boot. + +Link: https://lore.kernel.org/r/20200430080625.26070-2-pali@kernel.org +Fixes: f4c7d053d7f7 ("PCI: aardvark: Wait for endpoint to be ready...") +Tested-by: Tomasz Maciej Nowak +Signed-off-by: Pali Rohár +Signed-off-by: Lorenzo Pieralisi +Acked-by: Rob Herring +Acked-by: Thomas Petazzoni +--- + drivers/pci/controller/pci-aardvark.c | 15 +++++++++------ + 1 file changed, 9 insertions(+), 6 deletions(-) + +--- a/drivers/pci/controller/pci-aardvark.c ++++ b/drivers/pci/controller/pci-aardvark.c +@@ -300,11 +300,6 @@ static void advk_pcie_setup_hw(struct ad + reg |= LANE_COUNT_1; + advk_writel(pcie, reg, PCIE_CORE_CTRL0_REG); + +- /* Enable link training */ +- reg = advk_readl(pcie, PCIE_CORE_CTRL0_REG); +- reg |= LINK_TRAINING_EN; +- advk_writel(pcie, reg, PCIE_CORE_CTRL0_REG); +- + /* Enable MSI */ + reg = advk_readl(pcie, PCIE_CORE_CTRL2_REG); + reg |= PCIE_CORE_CTRL2_MSI_ENABLE; +@@ -346,7 +341,15 @@ static void advk_pcie_setup_hw(struct ad + */ + msleep(PCI_PM_D3COLD_WAIT); + +- /* Start link training */ ++ /* Enable link training */ ++ reg = advk_readl(pcie, PCIE_CORE_CTRL0_REG); ++ reg |= LINK_TRAINING_EN; ++ advk_writel(pcie, reg, PCIE_CORE_CTRL0_REG); ++ ++ /* ++ * Start link training immediately after enabling it. ++ * This solves problems for some buggy cards. ++ */ + reg = advk_readl(pcie, PCIE_CORE_LINK_CTRL_STAT_REG); + reg |= PCIE_CORE_LINK_TRAINING; + advk_writel(pcie, reg, PCIE_CORE_LINK_CTRL_STAT_REG); diff --git a/target/linux/mvebu/patches-5.4/405-PCI-aardvark-Improve-link-training.patch b/target/linux/mvebu/patches-5.4/405-PCI-aardvark-Improve-link-training.patch new file mode 100644 index 0000000000..20723894ec --- /dev/null +++ b/target/linux/mvebu/patches-5.4/405-PCI-aardvark-Improve-link-training.patch @@ -0,0 +1,208 @@ +From 43fc679ced18006b12d918d7a8a4af392b7fbfe7 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marek=20Beh=C3=BAn?= +Date: Thu, 30 Apr 2020 10:06:17 +0200 +Subject: [PATCH] PCI: aardvark: Improve link training +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Currently the aardvark driver trains link in PCIe gen2 mode. This may +cause some buggy gen1 cards (such as Compex WLE900VX) to be unstable or +even not detected. Moreover when ASPM code tries to retrain link second +time, these cards may stop responding and link goes down. If gen1 is +used this does not happen. + +Unconditionally forcing gen1 is not a good solution since it may have +performance impact on gen2 cards. + +To overcome this, read 'max-link-speed' property (as defined in PCI +device tree bindings) and use this as max gen mode. Then iteratively try +link training at this mode or lower until successful. After successful +link training choose final controller gen based on Negotiated Link Speed +from Link Status register, which should match card speed. + +Link: https://lore.kernel.org/r/20200430080625.26070-5-pali@kernel.org +Tested-by: Tomasz Maciej Nowak +Signed-off-by: Pali Rohár +Signed-off-by: Marek Behún +Signed-off-by: Lorenzo Pieralisi +Reviewed-by: Rob Herring +Acked-by: Thomas Petazzoni +--- + drivers/pci/controller/pci-aardvark.c | 114 ++++++++++++++++++++------ + 1 file changed, 89 insertions(+), 25 deletions(-) + +--- a/drivers/pci/controller/pci-aardvark.c ++++ b/drivers/pci/controller/pci-aardvark.c +@@ -39,6 +39,7 @@ + #define PCIE_CORE_LINK_CTRL_STAT_REG 0xd0 + #define PCIE_CORE_LINK_L0S_ENTRY BIT(0) + #define PCIE_CORE_LINK_TRAINING BIT(5) ++#define PCIE_CORE_LINK_SPEED_SHIFT 16 + #define PCIE_CORE_LINK_WIDTH_SHIFT 20 + #define PCIE_CORE_ERR_CAPCTL_REG 0x118 + #define PCIE_CORE_ERR_CAPCTL_ECRC_CHK_TX BIT(5) +@@ -201,6 +202,7 @@ struct advk_pcie { + struct mutex msi_used_lock; + u16 msi_msg; + int root_bus_nr; ++ int link_gen; + struct pci_bridge_emul bridge; + }; + +@@ -225,20 +227,16 @@ static int advk_pcie_link_up(struct advk + + static int advk_pcie_wait_for_link(struct advk_pcie *pcie) + { +- struct device *dev = &pcie->pdev->dev; + int retries; + + /* check if the link is up or not */ + for (retries = 0; retries < LINK_WAIT_MAX_RETRIES; retries++) { +- if (advk_pcie_link_up(pcie)) { +- dev_info(dev, "link up\n"); ++ if (advk_pcie_link_up(pcie)) + return 0; +- } + + usleep_range(LINK_WAIT_USLEEP_MIN, LINK_WAIT_USLEEP_MAX); + } + +- dev_err(dev, "link never came up\n"); + return -ETIMEDOUT; + } + +@@ -253,6 +251,85 @@ static void advk_pcie_wait_for_retrain(s + } + } + ++static int advk_pcie_train_at_gen(struct advk_pcie *pcie, int gen) ++{ ++ int ret, neg_gen; ++ u32 reg; ++ ++ /* Setup link speed */ ++ reg = advk_readl(pcie, PCIE_CORE_CTRL0_REG); ++ reg &= ~PCIE_GEN_SEL_MSK; ++ if (gen == 3) ++ reg |= SPEED_GEN_3; ++ else if (gen == 2) ++ reg |= SPEED_GEN_2; ++ else ++ reg |= SPEED_GEN_1; ++ advk_writel(pcie, reg, PCIE_CORE_CTRL0_REG); ++ ++ /* ++ * Enable link training. This is not needed in every call to this ++ * function, just once suffices, but it does not break anything either. ++ */ ++ reg = advk_readl(pcie, PCIE_CORE_CTRL0_REG); ++ reg |= LINK_TRAINING_EN; ++ advk_writel(pcie, reg, PCIE_CORE_CTRL0_REG); ++ ++ /* ++ * Start link training immediately after enabling it. ++ * This solves problems for some buggy cards. ++ */ ++ reg = advk_readl(pcie, PCIE_CORE_LINK_CTRL_STAT_REG); ++ reg |= PCIE_CORE_LINK_TRAINING; ++ advk_writel(pcie, reg, PCIE_CORE_LINK_CTRL_STAT_REG); ++ ++ ret = advk_pcie_wait_for_link(pcie); ++ if (ret) ++ return ret; ++ ++ reg = advk_readl(pcie, PCIE_CORE_LINK_CTRL_STAT_REG); ++ neg_gen = (reg >> PCIE_CORE_LINK_SPEED_SHIFT) & 0xf; ++ ++ return neg_gen; ++} ++ ++static void advk_pcie_train_link(struct advk_pcie *pcie) ++{ ++ struct device *dev = &pcie->pdev->dev; ++ int neg_gen = -1, gen; ++ ++ /* ++ * Try link training at link gen specified by device tree property ++ * 'max-link-speed'. If this fails, iteratively train at lower gen. ++ */ ++ for (gen = pcie->link_gen; gen > 0; --gen) { ++ neg_gen = advk_pcie_train_at_gen(pcie, gen); ++ if (neg_gen > 0) ++ break; ++ } ++ ++ if (neg_gen < 0) ++ goto err; ++ ++ /* ++ * After successful training if negotiated gen is lower than requested, ++ * train again on negotiated gen. This solves some stability issues for ++ * some buggy gen1 cards. ++ */ ++ if (neg_gen < gen) { ++ gen = neg_gen; ++ neg_gen = advk_pcie_train_at_gen(pcie, gen); ++ } ++ ++ if (neg_gen == gen) { ++ dev_info(dev, "link up at gen %i\n", gen); ++ return; ++ } ++ ++err: ++ dev_err(dev, "link never came up\n"); ++} ++ + static void advk_pcie_setup_hw(struct advk_pcie *pcie) + { + u32 reg; +@@ -288,12 +365,6 @@ static void advk_pcie_setup_hw(struct ad + PCIE_CORE_CTRL2_TD_ENABLE; + advk_writel(pcie, reg, PCIE_CORE_CTRL2_REG); + +- /* Set GEN2 */ +- reg = advk_readl(pcie, PCIE_CORE_CTRL0_REG); +- reg &= ~PCIE_GEN_SEL_MSK; +- reg |= SPEED_GEN_2; +- advk_writel(pcie, reg, PCIE_CORE_CTRL0_REG); +- + /* Set lane X1 */ + reg = advk_readl(pcie, PCIE_CORE_CTRL0_REG); + reg &= ~LANE_CNT_MSK; +@@ -341,20 +412,7 @@ static void advk_pcie_setup_hw(struct ad + */ + msleep(PCI_PM_D3COLD_WAIT); + +- /* Enable link training */ +- reg = advk_readl(pcie, PCIE_CORE_CTRL0_REG); +- reg |= LINK_TRAINING_EN; +- advk_writel(pcie, reg, PCIE_CORE_CTRL0_REG); +- +- /* +- * Start link training immediately after enabling it. +- * This solves problems for some buggy cards. +- */ +- reg = advk_readl(pcie, PCIE_CORE_LINK_CTRL_STAT_REG); +- reg |= PCIE_CORE_LINK_TRAINING; +- advk_writel(pcie, reg, PCIE_CORE_LINK_CTRL_STAT_REG); +- +- advk_pcie_wait_for_link(pcie); ++ advk_pcie_train_link(pcie); + + reg = advk_readl(pcie, PCIE_CORE_CMD_STATUS_REG); + reg |= PCIE_CORE_CMD_MEM_ACCESS_EN | +@@ -1036,6 +1094,12 @@ static int advk_pcie_probe(struct platfo + return ret; + } + ++ ret = of_pci_get_max_link_speed(dev->of_node); ++ if (ret <= 0 || ret > 3) ++ pcie->link_gen = 3; ++ else ++ pcie->link_gen = ret; ++ + advk_pcie_setup_hw(pcie); + + advk_sw_pci_bridge_init(pcie); diff --git a/target/linux/mvebu/patches-5.4/406-PCI-aardvark-Issue-PERST-via-GPIO.patch b/target/linux/mvebu/patches-5.4/406-PCI-aardvark-Issue-PERST-via-GPIO.patch new file mode 100644 index 0000000000..1ba70dd6f7 --- /dev/null +++ b/target/linux/mvebu/patches-5.4/406-PCI-aardvark-Issue-PERST-via-GPIO.patch @@ -0,0 +1,123 @@ +From 5169a9851daaa2782a7bd2bb83d5b1bd224b2879 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Pali=20Roh=C3=A1r?= +Date: Thu, 30 Apr 2020 10:06:18 +0200 +Subject: [PATCH] PCI: aardvark: Issue PERST via GPIO +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add support for issuing PERST via GPIO specified in 'reset-gpios' +property (as described in PCI device tree bindings). + +Some buggy cards (e.g. Compex WLE900VX or WLE1216) are not detected +after reboot when PERST is not issued during driver initialization. + +If bootloader already enabled link training then issuing PERST has no +effect for some buggy cards (e.g. Compex WLE900VX) and these cards are +not detected. We therefore clear the LINK_TRAINING_EN register before. + +It was observed that Compex WLE900VX card needs to be in PERST reset +for at least 10ms if bootloader enabled link training. + +Tested on Turris MOX. + +Link: https://lore.kernel.org/r/20200430080625.26070-6-pali@kernel.org +Tested-by: Tomasz Maciej Nowak +Signed-off-by: Pali Rohár +Signed-off-by: Lorenzo Pieralisi +Acked-by: Thomas Petazzoni +--- + drivers/pci/controller/pci-aardvark.c | 43 ++++++++++++++++++++++++++- + 1 file changed, 42 insertions(+), 1 deletion(-) + +--- a/drivers/pci/controller/pci-aardvark.c ++++ b/drivers/pci/controller/pci-aardvark.c +@@ -9,6 +9,7 @@ + */ + + #include ++#include + #include + #include + #include +@@ -17,6 +18,7 @@ + #include + #include + #include ++#include + #include + + #include "../pci.h" +@@ -204,6 +206,7 @@ struct advk_pcie { + int root_bus_nr; + int link_gen; + struct pci_bridge_emul bridge; ++ struct gpio_desc *reset_gpio; + }; + + static inline void advk_writel(struct advk_pcie *pcie, u32 val, u64 reg) +@@ -330,10 +333,31 @@ err: + dev_err(dev, "link never came up\n"); + } + ++static void advk_pcie_issue_perst(struct advk_pcie *pcie) ++{ ++ u32 reg; ++ ++ if (!pcie->reset_gpio) ++ return; ++ ++ /* PERST does not work for some cards when link training is enabled */ ++ reg = advk_readl(pcie, PCIE_CORE_CTRL0_REG); ++ reg &= ~LINK_TRAINING_EN; ++ advk_writel(pcie, reg, PCIE_CORE_CTRL0_REG); ++ ++ /* 10ms delay is needed for some cards */ ++ dev_info(&pcie->pdev->dev, "issuing PERST via reset GPIO for 10ms\n"); ++ gpiod_set_value_cansleep(pcie->reset_gpio, 1); ++ usleep_range(10000, 11000); ++ gpiod_set_value_cansleep(pcie->reset_gpio, 0); ++} ++ + static void advk_pcie_setup_hw(struct advk_pcie *pcie) + { + u32 reg; + ++ advk_pcie_issue_perst(pcie); ++ + /* Set to Direct mode */ + reg = advk_readl(pcie, CTRL_CONFIG_REG); + reg &= ~(CTRL_MODE_MASK << CTRL_MODE_SHIFT); +@@ -406,7 +430,8 @@ static void advk_pcie_setup_hw(struct ad + + /* + * PERST# signal could have been asserted by pinctrl subsystem before +- * probe() callback has been called, making the endpoint going into ++ * probe() callback has been called or issued explicitly by reset gpio ++ * function advk_pcie_issue_perst(), making the endpoint going into + * fundamental reset. As required by PCI Express spec a delay for at + * least 100ms after such a reset before link training is needed. + */ +@@ -1094,6 +1119,22 @@ static int advk_pcie_probe(struct platfo + return ret; + } + ++ pcie->reset_gpio = devm_gpiod_get_from_of_node(dev, dev->of_node, ++ "reset-gpios", 0, ++ GPIOD_OUT_LOW, ++ "pcie1-reset"); ++ ret = PTR_ERR_OR_ZERO(pcie->reset_gpio); ++ if (ret) { ++ if (ret == -ENOENT) { ++ pcie->reset_gpio = NULL; ++ } else { ++ if (ret != -EPROBE_DEFER) ++ dev_err(dev, "Failed to get reset-gpio: %i\n", ++ ret); ++ return ret; ++ } ++ } ++ + ret = of_pci_get_max_link_speed(dev->of_node); + if (ret <= 0 || ret > 3) + pcie->link_gen = 3; diff --git a/target/linux/mvebu/patches-5.4/407-PCI-aardvark-Add-PHY-support.patch b/target/linux/mvebu/patches-5.4/407-PCI-aardvark-Add-PHY-support.patch new file mode 100644 index 0000000000..1d9a9cbb1c --- /dev/null +++ b/target/linux/mvebu/patches-5.4/407-PCI-aardvark-Add-PHY-support.patch @@ -0,0 +1,152 @@ +From 366697018c9a2aa67d457bfdc495115cface6ae8 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marek=20Beh=C3=BAn?= +Date: Thu, 30 Apr 2020 10:06:20 +0200 +Subject: [PATCH] PCI: aardvark: Add PHY support +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +With recent proposed changes for U-Boot it is possible that bootloader +won't initialize the PHY for this controller (currently the PHY is +initialized regardless whether PCI is used in U-Boot, but with these +proposed changes the PHY is initialized only on request). + +Since the mvebu-a3700-comphy driver by Miquèl Raynal supports enabling +PCIe PHY, and since Linux' functionality should be independent on what +bootloader did, add code for enabling generic PHY if found in device OF +node. + +The mvebu-a3700-comphy driver does PHY powering via SMC calls to ARM +Trusted Firmware. The corresponding code in ARM Trusted Firmware skips +one register write which U-Boot does not: step 7 ("Enable TX"), see [1]. +Instead ARM Trusted Firmware expects PCIe driver to do this step, +probably because the register is in PCIe controller address space, +instead of PHY address space. We therefore add this step into the +advk_pcie_setup_hw function. + +[1] https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/tree/drivers/marvell/comphy/phy-comphy-3700.c?h=v2.3-rc2#n836 + +Link: https://lore.kernel.org/r/20200430080625.26070-8-pali@kernel.org +Tested-by: Tomasz Maciej Nowak +Signed-off-by: Marek Behún +Signed-off-by: Lorenzo Pieralisi +Reviewed-by: Rob Herring +Acked-by: Thomas Petazzoni +Cc: Miquèl Raynal +--- + drivers/pci/controller/pci-aardvark.c | 69 +++++++++++++++++++++++++++ + 1 file changed, 69 insertions(+) + +--- a/drivers/pci/controller/pci-aardvark.c ++++ b/drivers/pci/controller/pci-aardvark.c +@@ -16,6 +16,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -103,6 +104,8 @@ + #define PCIE_CORE_CTRL2_STRICT_ORDER_ENABLE BIT(5) + #define PCIE_CORE_CTRL2_OB_WIN_ENABLE BIT(6) + #define PCIE_CORE_CTRL2_MSI_ENABLE BIT(10) ++#define PCIE_CORE_REF_CLK_REG (CONTROL_BASE_ADDR + 0x14) ++#define PCIE_CORE_REF_CLK_TX_ENABLE BIT(1) + #define PCIE_MSG_LOG_REG (CONTROL_BASE_ADDR + 0x30) + #define PCIE_ISR0_REG (CONTROL_BASE_ADDR + 0x40) + #define PCIE_MSG_PM_PME_MASK BIT(7) +@@ -207,6 +210,7 @@ struct advk_pcie { + int link_gen; + struct pci_bridge_emul bridge; + struct gpio_desc *reset_gpio; ++ struct phy *phy; + }; + + static inline void advk_writel(struct advk_pcie *pcie, u32 val, u64 reg) +@@ -358,6 +362,11 @@ static void advk_pcie_setup_hw(struct ad + + advk_pcie_issue_perst(pcie); + ++ /* Enable TX */ ++ reg = advk_readl(pcie, PCIE_CORE_REF_CLK_REG); ++ reg |= PCIE_CORE_REF_CLK_TX_ENABLE; ++ advk_writel(pcie, reg, PCIE_CORE_REF_CLK_REG); ++ + /* Set to Direct mode */ + reg = advk_readl(pcie, CTRL_CONFIG_REG); + reg &= ~(CTRL_MODE_MASK << CTRL_MODE_SHIFT); +@@ -1084,6 +1093,62 @@ out_release_res: + return err; + } + ++static void __maybe_unused advk_pcie_disable_phy(struct advk_pcie *pcie) ++{ ++ phy_power_off(pcie->phy); ++ phy_exit(pcie->phy); ++} ++ ++static int advk_pcie_enable_phy(struct advk_pcie *pcie) ++{ ++ int ret; ++ ++ if (!pcie->phy) ++ return 0; ++ ++ ret = phy_init(pcie->phy); ++ if (ret) ++ return ret; ++ ++ ret = phy_set_mode(pcie->phy, PHY_MODE_PCIE); ++ if (ret) { ++ phy_exit(pcie->phy); ++ return ret; ++ } ++ ++ ret = phy_power_on(pcie->phy); ++ if (ret) { ++ phy_exit(pcie->phy); ++ return ret; ++ } ++ ++ return 0; ++} ++ ++static int advk_pcie_setup_phy(struct advk_pcie *pcie) ++{ ++ struct device *dev = &pcie->pdev->dev; ++ struct device_node *node = dev->of_node; ++ int ret = 0; ++ ++ pcie->phy = devm_of_phy_get(dev, node, NULL); ++ if (IS_ERR(pcie->phy) && (PTR_ERR(pcie->phy) == -EPROBE_DEFER)) ++ return PTR_ERR(pcie->phy); ++ ++ /* Old bindings miss the PHY handle */ ++ if (IS_ERR(pcie->phy)) { ++ dev_warn(dev, "PHY unavailable (%ld)\n", PTR_ERR(pcie->phy)); ++ pcie->phy = NULL; ++ return 0; ++ } ++ ++ ret = advk_pcie_enable_phy(pcie); ++ if (ret) ++ dev_err(dev, "Failed to initialize PHY (%d)\n", ret); ++ ++ return ret; ++} ++ + static int advk_pcie_probe(struct platform_device *pdev) + { + struct device *dev = &pdev->dev; +@@ -1141,6 +1206,10 @@ static int advk_pcie_probe(struct platfo + else + pcie->link_gen = ret; + ++ ret = advk_pcie_setup_phy(pcie); ++ if (ret) ++ return ret; ++ + advk_pcie_setup_hw(pcie); + + advk_sw_pci_bridge_init(pcie); diff --git a/target/linux/mvebu/patches-5.4/408-PCI-aardvark-Don-t-touch-PCIe-registers-if-no-card-c.patch b/target/linux/mvebu/patches-5.4/408-PCI-aardvark-Don-t-touch-PCIe-registers-if-no-card-c.patch new file mode 100644 index 0000000000..9bff37b27a --- /dev/null +++ b/target/linux/mvebu/patches-5.4/408-PCI-aardvark-Don-t-touch-PCIe-registers-if-no-card-c.patch @@ -0,0 +1,50 @@ +From 70e380250c3621c55ff218cbaf2272830d9dbb1d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Pali=20Roh=C3=A1r?= +Date: Thu, 2 Jul 2020 10:30:36 +0200 +Subject: [PATCH] PCI: aardvark: Don't touch PCIe registers if no card + connected +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +When there is no PCIe card connected and advk_pcie_rd_conf() or +advk_pcie_wr_conf() is called for PCI bus which doesn't belong to emulated +root bridge, the aardvark driver throws the following error message: + + advk-pcie d0070000.pcie: config read/write timed out + +Obviously accessing PCIe registers of disconnected card is not possible. + +Extend check in advk_pcie_valid_device() function for validating +availability of PCIe bus. If PCIe link is down, then the device is marked +as Not Found and the driver does not try to access these registers. + +This is just an optimization to prevent accessing PCIe registers when card +is disconnected. Trying to access PCIe registers of disconnected card does +not cause any crash, kernel just needs to wait for a timeout. So if card +disappear immediately after checking for PCIe link (before accessing PCIe +registers), it does not cause any problems. + +Link: https://lore.kernel.org/r/20200702083036.12230-1-pali@kernel.org +Signed-off-by: Pali Rohár +Signed-off-by: Lorenzo Pieralisi +--- + drivers/pci/controller/pci-aardvark.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +--- a/drivers/pci/controller/pci-aardvark.c ++++ b/drivers/pci/controller/pci-aardvark.c +@@ -640,6 +640,13 @@ static bool advk_pcie_valid_device(struc + if ((bus->number == pcie->root_bus_nr) && PCI_SLOT(devfn) != 0) + return false; + ++ /* ++ * If the link goes down after we check for link-up, nothing bad ++ * happens but the config access times out. ++ */ ++ if (bus->number != pcie->root_bus_nr && !advk_pcie_link_up(pcie)) ++ return false; ++ + return true; + } + diff --git a/target/linux/mvebu/patches-5.4/409-phy-marvell-comphy-Convert-internal-SMCC-firmware-re.patch b/target/linux/mvebu/patches-5.4/409-phy-marvell-comphy-Convert-internal-SMCC-firmware-re.patch new file mode 100644 index 0000000000..d496d672e5 --- /dev/null +++ b/target/linux/mvebu/patches-5.4/409-phy-marvell-comphy-Convert-internal-SMCC-firmware-re.patch @@ -0,0 +1,106 @@ +From ea17a0f153af2cd890e4ce517130dcccaa428c13 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Pali=20Roh=C3=A1r?= +Date: Wed, 2 Sep 2020 16:43:43 +0200 +Subject: [PATCH] phy: marvell: comphy: Convert internal SMCC firmware return + codes to errno +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Driver ->power_on and ->power_off callbacks leaks internal SMCC firmware +return codes to phy caller. This patch converts SMCC error codes to +standard linux errno codes. Include file linux/arm-smccc.h already provides +defines for SMCC error codes, so use them instead of custom driver defines. +Note that return value is signed 32bit, but stored in unsigned long type +with zero padding. + +Tested-by: Tomasz Maciej Nowak +Link: https://lore.kernel.org/r/20200902144344.16684-2-pali@kernel.org +Signed-off-by: Pali Rohár +Signed-off-by: Lorenzo Pieralisi +Reviewed-by: Rob Herring +--- + drivers/phy/marvell/phy-mvebu-a3700-comphy.c | 14 +++++++++++--- + drivers/phy/marvell/phy-mvebu-cp110-comphy.c | 14 +++++++++++--- + 2 files changed, 22 insertions(+), 6 deletions(-) + +--- a/drivers/phy/marvell/phy-mvebu-a3700-comphy.c ++++ b/drivers/phy/marvell/phy-mvebu-a3700-comphy.c +@@ -26,7 +26,6 @@ + #define COMPHY_SIP_POWER_ON 0x82000001 + #define COMPHY_SIP_POWER_OFF 0x82000002 + #define COMPHY_SIP_PLL_LOCK 0x82000003 +-#define COMPHY_FW_NOT_SUPPORTED (-1) + + #define COMPHY_FW_MODE_SATA 0x1 + #define COMPHY_FW_MODE_SGMII 0x2 +@@ -112,10 +111,19 @@ static int mvebu_a3700_comphy_smc(unsign + unsigned long mode) + { + struct arm_smccc_res res; ++ s32 ret; + + arm_smccc_smc(function, lane, mode, 0, 0, 0, 0, 0, &res); ++ ret = res.a0; + +- return res.a0; ++ switch (ret) { ++ case SMCCC_RET_SUCCESS: ++ return 0; ++ case SMCCC_RET_NOT_SUPPORTED: ++ return -EOPNOTSUPP; ++ default: ++ return -EINVAL; ++ } + } + + static int mvebu_a3700_comphy_get_fw_mode(int lane, int port, +@@ -220,7 +228,7 @@ static int mvebu_a3700_comphy_power_on(s + } + + ret = mvebu_a3700_comphy_smc(COMPHY_SIP_POWER_ON, lane->id, fw_param); +- if (ret == COMPHY_FW_NOT_SUPPORTED) ++ if (ret == -EOPNOTSUPP) + dev_err(lane->dev, + "unsupported SMC call, try updating your firmware\n"); + +--- a/drivers/phy/marvell/phy-mvebu-cp110-comphy.c ++++ b/drivers/phy/marvell/phy-mvebu-cp110-comphy.c +@@ -123,7 +123,6 @@ + + #define COMPHY_SIP_POWER_ON 0x82000001 + #define COMPHY_SIP_POWER_OFF 0x82000002 +-#define COMPHY_FW_NOT_SUPPORTED (-1) + + /* + * A lane is described by the following bitfields: +@@ -273,10 +272,19 @@ static int mvebu_comphy_smc(unsigned lon + unsigned long lane, unsigned long mode) + { + struct arm_smccc_res res; ++ s32 ret; + + arm_smccc_smc(function, phys, lane, mode, 0, 0, 0, 0, &res); ++ ret = res.a0; + +- return res.a0; ++ switch (ret) { ++ case SMCCC_RET_SUCCESS: ++ return 0; ++ case SMCCC_RET_NOT_SUPPORTED: ++ return -EOPNOTSUPP; ++ default: ++ return -EINVAL; ++ } + } + + static int mvebu_comphy_get_mode(bool fw_mode, int lane, int port, +@@ -819,7 +827,7 @@ static int mvebu_comphy_power_on(struct + if (!ret) + return ret; + +- if (ret == COMPHY_FW_NOT_SUPPORTED) ++ if (ret == -EOPNOTSUPP) + dev_err(priv->dev, + "unsupported SMC call, try updating your firmware\n"); + diff --git a/target/linux/mvebu/patches-5.4/410-PCI-aardvark-Fix-initialization-with-old-Marvell-s-A.patch b/target/linux/mvebu/patches-5.4/410-PCI-aardvark-Fix-initialization-with-old-Marvell-s-A.patch new file mode 100644 index 0000000000..510b7458a5 --- /dev/null +++ b/target/linux/mvebu/patches-5.4/410-PCI-aardvark-Fix-initialization-with-old-Marvell-s-A.patch @@ -0,0 +1,44 @@ +From b0c6ae0f8948a2be6bf4e8b4bbab9ca1343289b6 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Pali=20Roh=C3=A1r?= +Date: Wed, 2 Sep 2020 16:43:44 +0200 +Subject: [PATCH] PCI: aardvark: Fix initialization with old Marvell's Arm + Trusted Firmware +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Old ATF automatically power on pcie phy and does not provide SMC call for +phy power on functionality which leads to aardvark initialization failure: + +[ 0.330134] mvebu-a3700-comphy d0018300.phy: unsupported SMC call, try updating your firmware +[ 0.338846] phy phy-d0018300.phy.1: phy poweron failed --> -95 +[ 0.344753] advk-pcie d0070000.pcie: Failed to initialize PHY (-95) +[ 0.351160] advk-pcie: probe of d0070000.pcie failed with error -95 + +This patch fixes above failure by ignoring 'not supported' error in +aardvark driver. In this case it is expected that phy is already power on. + +Tested-by: Tomasz Maciej Nowak +Link: https://lore.kernel.org/r/20200902144344.16684-3-pali@kernel.org +Fixes: 366697018c9a ("PCI: aardvark: Add PHY support") +Signed-off-by: Pali Rohár +Signed-off-by: Lorenzo Pieralisi +Reviewed-by: Rob Herring +Cc: # 5.8+: ea17a0f153af: phy: marvell: comphy: Convert internal SMCC firmware return codes to errno +--- + drivers/pci/controller/pci-aardvark.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/drivers/pci/controller/pci-aardvark.c ++++ b/drivers/pci/controller/pci-aardvark.c +@@ -1124,7 +1124,9 @@ static int advk_pcie_enable_phy(struct a + } + + ret = phy_power_on(pcie->phy); +- if (ret) { ++ if (ret == -EOPNOTSUPP) { ++ dev_warn(&pcie->pdev->dev, "PHY unsupported by firmware\n"); ++ } else if (ret) { + phy_exit(pcie->phy); + return ret; + } diff --git a/target/linux/mvebu/patches-5.4/521-arm64-dts-marvell-espressobin-Add-ethernet-switch-al.patch b/target/linux/mvebu/patches-5.4/521-arm64-dts-marvell-espressobin-Add-ethernet-switch-al.patch new file mode 100644 index 0000000000..61225387dd --- /dev/null +++ b/target/linux/mvebu/patches-5.4/521-arm64-dts-marvell-espressobin-Add-ethernet-switch-al.patch @@ -0,0 +1,134 @@ +From b64d814257b027e29a474bcd660f6372490138c7 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Pali=20Roh=C3=A1r?= +Date: Mon, 7 Sep 2020 13:27:17 +0200 +Subject: [PATCH] arm64: dts: marvell: espressobin: Add ethernet switch aliases +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Espressobin boards have 3 ethernet ports and some of them got assigned more +then one MAC address. MAC addresses are stored in U-Boot environment. + +Since commit a2c7023f7075c ("net: dsa: read mac address from DT for slave +device") kernel can use MAC addresses from DT for particular DSA port. + +Currently Espressobin DTS file contains alias just for ethernet0. + +This patch defines additional ethernet aliases in Espressobin DTS files, so +bootloader can fill correct MAC address for DSA switch ports if more MAC +addresses were specified. + +DT alias ethernet1 is used for wan port, DT aliases ethernet2 and ethernet3 +are used for lan ports for both Espressobin revisions (V5 and V7). + +Fixes: 5253cb8c00a6f ("arm64: dts: marvell: espressobin: add ethernet alias") +Cc: # a2c7023f7075c: dsa: read mac address +Signed-off-by: Pali Rohár +Reviewed-by: Andrew Lunn +Reviewed-by: Andre Heider +Signed-off-by: Gregory CLEMENT +--- + .../dts/marvell/armada-3720-espressobin-v7-emmc.dts | 10 ++++++++-- + .../boot/dts/marvell/armada-3720-espressobin-v7.dts | 10 ++++++++-- + .../boot/dts/marvell/armada-3720-espressobin.dtsi | 12 ++++++++---- + 3 files changed, 24 insertions(+), 8 deletions(-) + +--- a/arch/arm64/boot/dts/marvell/armada-3720-espressobin-v7-emmc.dts ++++ b/arch/arm64/boot/dts/marvell/armada-3720-espressobin-v7-emmc.dts +@@ -15,16 +15,22 @@ + compatible = "globalscale,espressobin-v7-emmc", "globalscale,espressobin-v7", + "globalscale,espressobin", "marvell,armada3720", + "marvell,armada3710"; ++ ++ aliases { ++ /* ethernet1 is wan port */ ++ ethernet1 = &switch0port3; ++ ethernet3 = &switch0port1; ++ }; + }; + + &ports { +- port@1 { ++ switch0port1: port@1 { + reg = <1>; + label = "lan1"; + phy-handle = <&switch0phy0>; + }; + +- port@3 { ++ switch0port3: port@3 { + reg = <3>; + label = "wan"; + phy-handle = <&switch0phy2>; +--- a/arch/arm64/boot/dts/marvell/armada-3720-espressobin-v7.dts ++++ b/arch/arm64/boot/dts/marvell/armada-3720-espressobin-v7.dts +@@ -14,16 +14,22 @@ + model = "Globalscale Marvell ESPRESSOBin Board V7"; + compatible = "globalscale,espressobin-v7", "globalscale,espressobin", + "marvell,armada3720", "marvell,armada3710"; ++ ++ aliases { ++ /* ethernet1 is wan port */ ++ ethernet1 = &switch0port3; ++ ethernet3 = &switch0port1; ++ }; + }; + + &ports { +- port@1 { ++ switch0port1: port@1 { + reg = <1>; + label = "lan1"; + phy-handle = <&switch0phy0>; + }; + +- port@3 { ++ switch0port3: port@3 { + reg = <3>; + label = "wan"; + phy-handle = <&switch0phy2>; +--- a/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dts ++++ b/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dts +@@ -21,6 +21,10 @@ + + aliases { + ethernet0 = ð0; ++ /* for dsa slave device */ ++ ethernet1 = &switch0port1; ++ ethernet2 = &switch0port2; ++ ethernet3 = &switch0port3; + serial0 = &uart0; + serial1 = &uart1; + }; +@@ -147,7 +151,7 @@ + #address-cells = <1>; + #size-cells = <0>; + +- port@0 { ++ switch0port0: port@0 { + reg = <0>; + label = "cpu"; + ethernet = <ð0>; +@@ -158,19 +162,19 @@ + }; + }; + +- port@1 { ++ switch0port1: port@1 { + reg = <1>; + label = "wan"; + phy-handle = <&switch0phy0>; + }; + +- port@2 { ++ switch0port2: port@2 { + reg = <2>; + label = "lan0"; + phy-handle = <&switch0phy1>; + }; + +- port@3 { ++ switch0port3: port@3 { + reg = <3>; + label = "lan1"; + phy-handle = <&switch0phy2>; diff --git a/target/linux/mvebu/patches-5.4/522-arm64-dts-marvell-armada-3720-espressobin-add-ports-.patch b/target/linux/mvebu/patches-5.4/522-arm64-dts-marvell-armada-3720-espressobin-add-ports-.patch index 7b112eb8ad..a741e378d9 100644 --- a/target/linux/mvebu/patches-5.4/522-arm64-dts-marvell-armada-3720-espressobin-add-ports-.patch +++ b/target/linux/mvebu/patches-5.4/522-arm64-dts-marvell-armada-3720-espressobin-add-ports-.patch @@ -15,7 +15,7 @@ Signed-off-by: Tomasz Maciej Nowak --- a/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dts +++ b/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dts -@@ -143,7 +143,7 @@ +@@ -147,7 +147,7 @@ dsa,member = <0 0>; diff --git a/target/linux/mvebu/patches-5.4/523-arm64-dts-marvell-espressobin-remove-COMPHY-nodes-as.patch b/target/linux/mvebu/patches-5.4/523-arm64-dts-marvell-espressobin-remove-COMPHY-nodes-as.patch index dd7a9b2cd1..44e9a9237b 100644 --- a/target/linux/mvebu/patches-5.4/523-arm64-dts-marvell-espressobin-remove-COMPHY-nodes-as.patch +++ b/target/linux/mvebu/patches-5.4/523-arm64-dts-marvell-espressobin-remove-COMPHY-nodes-as.patch @@ -24,7 +24,7 @@ Signed-off-by: Tomasz Maciej Nowak --- a/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dts +++ b/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dts -@@ -60,8 +60,6 @@ +@@ -64,8 +64,6 @@ /* J6 */ &sata { status = "okay"; @@ -33,7 +33,7 @@ Signed-off-by: Tomasz Maciej Nowak }; /* J1 */ -@@ -127,11 +125,17 @@ +@@ -131,11 +129,17 @@ /* J7 */ &usb3 { status = "okay"; diff --git a/target/linux/mvebu/patches-5.4/552-arm64-dts-marvell-armada-37xx-Set-pcie_reset_pin-to-.patch b/target/linux/mvebu/patches-5.4/552-arm64-dts-marvell-armada-37xx-Set-pcie_reset_pin-to-.patch new file mode 100644 index 0000000000..9eeddaeba1 --- /dev/null +++ b/target/linux/mvebu/patches-5.4/552-arm64-dts-marvell-armada-37xx-Set-pcie_reset_pin-to-.patch @@ -0,0 +1,93 @@ +From 715878016984b2617f6c1f177c50039e12e7bd5b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marek=20Beh=C3=BAn?= +Date: Thu, 30 Apr 2020 10:06:23 +0200 +Subject: [PATCH] arm64: dts: marvell: armada-37xx: Set pcie_reset_pin to gpio + function +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +We found out that we are unable to control the PERST# signal via the +default pin dedicated to be PERST# pin (GPIO2[3] pin) on A3700 SOC when +this pin is in EP_PCIE1_Resetn mode. There is a register in the PCIe +register space called PERSTN_GPIO_EN (D0088004[3]), but changing the +value of this register does not change the pin output when measuring +with voltmeter. + +We do not know if this is a bug in the SOC, or if it works only when +PCIe controller is in a certain state. + +Commit f4c7d053d7f7 ("PCI: aardvark: Wait for endpoint to be ready +before training link") says that when this pin changes pinctrl mode +from EP_PCIE1_Resetn to GPIO, the PERST# signal is asserted for a brief +moment. + +So currently the situation is that on A3700 boards the PERST# signal is +asserted in U-Boot (because the code in U-Boot issues reset via this pin +via GPIO mode), and then in Linux by the obscure and undocumented +mechanism described by the above mentioned commit. + +We want to issue PERST# signal in a known way, therefore this patch +changes the pcie_reset_pin function from "pcie" to "gpio" and adds the +reset-gpios property to the PCIe node in device tree files of +EspressoBin and Armada 3720 Dev Board (Turris Mox device tree already +has this property and uDPU does not have a PCIe port). + +Signed-off-by: Marek Behún +Cc: Remi Pommarel +Tested-by: Tomasz Maciej Nowak +Acked-by: Thomas Petazzoni +Signed-off-by: Gregory CLEMENT +--- + arch/arm64/boot/dts/marvell/armada-3720-db.dts | 3 +++ + arch/arm64/boot/dts/marvell/armada-3720-espressobin.dtsi | 1 + + arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts | 4 ---- + arch/arm64/boot/dts/marvell/armada-37xx.dtsi | 2 +- + 4 files changed, 5 insertions(+), 5 deletions(-) + +--- a/arch/arm64/boot/dts/marvell/armada-3720-db.dts ++++ b/arch/arm64/boot/dts/marvell/armada-3720-db.dts +@@ -128,6 +128,9 @@ + + /* CON15(V2.0)/CON17(V1.4) : PCIe / CON15(V2.0)/CON12(V1.4) :mini-PCIe */ + &pcie0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pcie_reset_pins &pcie_clkreq_pins>; ++ reset-gpios = <&gpiosb 3 GPIO_ACTIVE_LOW>; + status = "okay"; + }; + +--- a/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dts ++++ b/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dts +@@ -59,6 +59,7 @@ + phys = <&comphy1 0>; + pinctrl-names = "default"; + pinctrl-0 = <&pcie_reset_pins &pcie_clkreq_pins>; ++ reset-gpios = <&gpiosb 3 GPIO_ACTIVE_LOW>; + }; + + /* J6 */ +--- a/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts ++++ b/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts +@@ -120,10 +120,6 @@ + }; + }; + +-&pcie_reset_pins { +- function = "gpio"; +-}; +- + &pcie0 { + pinctrl-names = "default"; + pinctrl-0 = <&pcie_reset_pins &pcie_clkreq_pins>; +--- a/arch/arm64/boot/dts/marvell/armada-37xx.dtsi ++++ b/arch/arm64/boot/dts/marvell/armada-37xx.dtsi +@@ -318,7 +318,7 @@ + + pcie_reset_pins: pcie-reset-pins { + groups = "pcie1"; +- function = "pcie"; ++ function = "gpio"; + }; + + pcie_clkreq_pins: pcie-clkreq-pins { diff --git a/target/linux/mvebu/patches-5.4/553-arm64-dts-marvell-armada-37xx-Move-PCIe-comphy-handl.patch b/target/linux/mvebu/patches-5.4/553-arm64-dts-marvell-armada-37xx-Move-PCIe-comphy-handl.patch new file mode 100644 index 0000000000..0c7830cb47 --- /dev/null +++ b/target/linux/mvebu/patches-5.4/553-arm64-dts-marvell-armada-37xx-Move-PCIe-comphy-handl.patch @@ -0,0 +1,57 @@ +From df749cdb015011e9ed8b60ebb84b4e76a9f35735 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marek=20Beh=C3=BAn?= +Date: Thu, 30 Apr 2020 10:06:24 +0200 +Subject: [PATCH] arm64: dts: marvell: armada-37xx: Move PCIe comphy handle + property +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Move the comphy handle property of the PCIe node from board specific +device tree files (EspressoBin and Turris Mox) to the generic +armada-37xx.dtsi. + +This is correct since this is the only possible PCIe PHY configuration +on Armada 37xx, so when PCIe is enabled on any board, this handle is +correct. + +Signed-off-by: Marek Behún +Tested-by: Tomasz Maciej Nowak +Acked-by: Thomas Petazzoni +Signed-off-by: Gregory CLEMENT +--- + arch/arm64/boot/dts/marvell/armada-3720-espressobin.dtsi | 1 - + arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts | 1 - + arch/arm64/boot/dts/marvell/armada-37xx.dtsi | 1 + + 3 files changed, 1 insertion(+), 2 deletions(-) + +--- a/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dts ++++ b/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dts +@@ -56,7 +56,6 @@ + /* J9 */ + &pcie0 { + status = "okay"; +- phys = <&comphy1 0>; + pinctrl-names = "default"; + pinctrl-0 = <&pcie_reset_pins &pcie_clkreq_pins>; + reset-gpios = <&gpiosb 3 GPIO_ACTIVE_LOW>; +--- a/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts ++++ b/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts +@@ -126,7 +126,6 @@ + status = "okay"; + max-link-speed = <2>; + reset-gpios = <&gpiosb 3 GPIO_ACTIVE_LOW>; +- phys = <&comphy1 0>; + + /* enabled by U-Boot if PCIe module is present */ + status = "disabled"; +--- a/arch/arm64/boot/dts/marvell/armada-37xx.dtsi ++++ b/arch/arm64/boot/dts/marvell/armada-37xx.dtsi +@@ -494,6 +494,7 @@ + <0 0 0 2 &pcie_intc 1>, + <0 0 0 3 &pcie_intc 2>, + <0 0 0 4 &pcie_intc 3>; ++ phys = <&comphy1 0>; + pcie_intc: interrupt-controller { + interrupt-controller; + #interrupt-cells = <1>; diff --git a/target/linux/mvebu/patches-5.4/554-arm64-dts-marvell-armada-37xx-Move-PCIe-max-link-spe.patch b/target/linux/mvebu/patches-5.4/554-arm64-dts-marvell-armada-37xx-Move-PCIe-max-link-spe.patch new file mode 100644 index 0000000000..04002480cc --- /dev/null +++ b/target/linux/mvebu/patches-5.4/554-arm64-dts-marvell-armada-37xx-Move-PCIe-max-link-spe.patch @@ -0,0 +1,44 @@ +From 1b5a2dd9e266d78d5fddd7e6b116e47ba9577b5e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Pali=20Roh=C3=A1r?= +Date: Thu, 30 Apr 2020 10:06:25 +0200 +Subject: [PATCH] arm64: dts: marvell: armada-37xx: Move PCIe max-link-speed + property +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Move the max-link-speed property of the PCIe node from board specific +device tree files to the generic armada-37xx.dtsi. + +Armada 37xx supports only PCIe gen2 speed so max-link-speed property +should be in the generic armada-37xx.dtsi file. + +Signed-off-by: Pali Rohár +Tested-by: Tomasz Maciej Nowak +Acked-by: Thomas Petazzoni +Signed-off-by: Gregory CLEMENT +--- + arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts | 1 - + arch/arm64/boot/dts/marvell/armada-37xx.dtsi | 1 + + 2 files changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts ++++ b/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts +@@ -124,7 +124,6 @@ + pinctrl-names = "default"; + pinctrl-0 = <&pcie_reset_pins &pcie_clkreq_pins>; + status = "okay"; +- max-link-speed = <2>; + reset-gpios = <&gpiosb 3 GPIO_ACTIVE_LOW>; + + /* enabled by U-Boot if PCIe module is present */ +--- a/arch/arm64/boot/dts/marvell/armada-37xx.dtsi ++++ b/arch/arm64/boot/dts/marvell/armada-37xx.dtsi +@@ -494,6 +494,7 @@ + <0 0 0 2 &pcie_intc 1>, + <0 0 0 3 &pcie_intc 2>, + <0 0 0 4 &pcie_intc 3>; ++ max-link-speed = <2>; + phys = <&comphy1 0>; + pcie_intc: interrupt-controller { + interrupt-controller; diff --git a/target/linux/octeon/config-4.19 b/target/linux/octeon/config-4.19 index d9a624d3b8..3385271bed 100644 --- a/target/linux/octeon/config-4.19 +++ b/target/linux/octeon/config-4.19 @@ -73,9 +73,7 @@ CONFIG_EDAC_ATOMIC_SCRUB=y CONFIG_EDAC_SUPPORT=y CONFIG_ENABLE_MUST_CHECK=y CONFIG_EXT4_FS=y -# CONFIG_F2FS_CHECK_FS is not set CONFIG_F2FS_FS=y -# CONFIG_F2FS_FS_SECURITY is not set CONFIG_FAT_FS=y CONFIG_FIXED_PHY=y CONFIG_FRAME_WARN=2048 diff --git a/target/linux/omap/config-4.19 b/target/linux/omap/config-4.19 index ead207fc2d..3ecabead88 100644 --- a/target/linux/omap/config-4.19 +++ b/target/linux/omap/config-4.19 @@ -238,9 +238,7 @@ CONFIG_EXT4_FS=y CONFIG_EXTCON=y CONFIG_EXTCON_PALMAS=y CONFIG_EXTCON_USB_GPIO=y -# CONFIG_F2FS_CHECK_FS is not set CONFIG_F2FS_FS=y -# CONFIG_F2FS_FS_SECURITY is not set CONFIG_FANOTIFY=y CONFIG_FAT_FS=y CONFIG_FB_CMDLINE=y diff --git a/target/linux/ramips/patches-5.4/401-net-ethernet-mediatek-support-net-labels.patch b/target/linux/ramips/patches-5.4/401-net-ethernet-mediatek-support-net-labels.patch index 39989ecca1..babd3d833c 100644 --- a/target/linux/ramips/patches-5.4/401-net-ethernet-mediatek-support-net-labels.patch +++ b/target/linux/ramips/patches-5.4/401-net-ethernet-mediatek-support-net-labels.patch @@ -14,7 +14,7 @@ Signed-off-by: René van Dorst --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -2887,6 +2887,7 @@ static const struct net_device_ops mtk_n +@@ -2919,6 +2919,7 @@ static const struct net_device_ops mtk_n static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np) { @@ -22,7 +22,7 @@ Signed-off-by: René van Dorst const __be32 *_id = of_get_property(np, "reg", NULL); struct phylink *phylink; int phy_mode, id, err; -@@ -2979,6 +2980,9 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -3011,6 +3012,9 @@ static int mtk_add_mac(struct mtk_eth *e eth->netdev[id]->max_mtu = MTK_MAX_RX_LENGTH - MTK_RX_ETH_HLEN; diff --git a/target/linux/rtl838x/Makefile b/target/linux/rtl838x/Makefile index 764b94ae38..c4138c7a9a 100644 --- a/target/linux/rtl838x/Makefile +++ b/target/linux/rtl838x/Makefile @@ -7,6 +7,7 @@ ARCH:=mips CPU_TYPE:=4kec BOARD:=rtl838x BOARDNAME:=Realtek MIPS +DEVICE_TYPE:=basic FEATURES:=ramdisk squashfs KERNEL_PATCHVER:=5.4 diff --git a/target/linux/rtl838x/base-files/etc/board.d/01_leds b/target/linux/rtl838x/base-files/etc/board.d/01_leds index 7991b832f6..699ab817dd 100755 --- a/target/linux/rtl838x/base-files/etc/board.d/01_leds +++ b/target/linux/rtl838x/base-files/etc/board.d/01_leds @@ -3,7 +3,6 @@ . /lib/functions/uci-defaults.sh board=$(board_name) -boardname="${board##*,}" board_config_update diff --git a/target/linux/rtl838x/config-5.4 b/target/linux/rtl838x/config-5.4 index a9955b8f92..4d1ba372e6 100644 --- a/target/linux/rtl838x/config-5.4 +++ b/target/linux/rtl838x/config-5.4 @@ -53,6 +53,8 @@ CONFIG_DTC=y CONFIG_EARLY_PRINTK=y CONFIG_EFI_EARLYCON=y CONFIG_ETHERNET_PACKET_MANGLE=y +CONFIG_EXTRA_FIRMWARE="rtl838x_phy/rtl838x_8214fc.fw rtl838x_phy/rtl838x_8218b.fw rtl838x_phy/rtl838x_8380.fw" +CONFIG_EXTRA_FIRMWARE_DIR="firmware" CONFIG_FIXED_PHY=y CONFIG_FONT_8x16=y CONFIG_FONT_AUTOSELECT=y diff --git a/target/linux/rtl838x/dts/rtl8382_allnet_all-sg8208m.dts b/target/linux/rtl838x/dts/rtl8382_allnet_all-sg8208m.dts index 09d5aff0fe..5433b7f372 100644 --- a/target/linux/rtl838x/dts/rtl8382_allnet_all-sg8208m.dts +++ b/target/linux/rtl838x/dts/rtl8382_allnet_all-sg8208m.dts @@ -1,5 +1,4 @@ // SPDX-License-Identifier: GPL-2.0-or-later -/dts-v1/; #include "rtl838x.dtsi" @@ -36,7 +35,7 @@ compatible = "gpio-leds"; led_sys: sys { - label = "all-sg8208m:green:sys"; + label = "green:sys"; gpios = <&gpio0 47 GPIO_ACTIVE_HIGH>; }; // GPIO 25: power on/off all port leds diff --git a/target/linux/rtl838x/dts/rtl8382_d-link_dgs-1210-16.dts b/target/linux/rtl838x/dts/rtl8382_d-link_dgs-1210-16.dts new file mode 100644 index 0000000000..2d7abc00db --- /dev/null +++ b/target/linux/rtl838x/dts/rtl8382_d-link_dgs-1210-16.dts @@ -0,0 +1,335 @@ +#include "rtl838x.dtsi" + +#include +#include + +/ { + compatible = "d-link,dgs-1210-16", "realtek,rtl838x-soc"; + model = "D-Link DGS-1210-16"; + + aliases { + led-boot = &led_power; + led-failsafe = &led_power; + led-running = &led_power; + led-upgrade = &led_power; + }; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + leds { + compatible = "gpio-leds"; + + led_power: power { + label = "green:power"; + gpios = <&gpio0 24 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&gpio0 { + indirect-access-bus-id = <0>; +}; + +&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>; + read-only; + }; + 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>; + }; + }; + }; +}; + +ðernet0 { + mdio: mdio-bus { + compatible = "realtek,rtl838x-mdio"; + regmap = <ðernet0>; + #address-cells = <1>; + #size-cells = <0>; + + /* External phy RTL8218B */ + phy0: ethernet-phy@0 { + reg = <0>; + compatible = "ethernet-phy-ieee802.3-c22"; + }; + phy1: ethernet-phy@1 { + reg = <1>; + compatible = "ethernet-phy-ieee802.3-c22"; + }; + phy2: ethernet-phy@2 { + reg = <2>; + compatible = "ethernet-phy-ieee802.3-c22"; + }; + phy3: ethernet-phy@3 { + reg = <3>; + compatible = "ethernet-phy-ieee802.3-c22"; + }; + phy4: ethernet-phy@4 { + reg = <4>; + compatible = "ethernet-phy-ieee802.3-c22"; + }; + phy5: ethernet-phy@5 { + reg = <5>; + compatible = "ethernet-phy-ieee802.3-c22"; + }; + phy6: ethernet-phy@6 { + reg = <6>; + compatible = "ethernet-phy-ieee802.3-c22"; + }; + phy7: ethernet-phy@7 { + reg = <7>; + compatible = "ethernet-phy-ieee802.3-c22"; + }; + + /* Internal phy RTL8218B */ + phy8: ethernet-phy@8 { + reg = <8>; + compatible = "ethernet-phy-ieee802.3-c22"; + phy-is-integrated; + }; + phy9: ethernet-phy@9 { + reg = <9>; + compatible = "ethernet-phy-ieee802.3-c22"; + phy-is-integrated; + }; + phy10: ethernet-phy@10 { + reg = <10>; + compatible = "ethernet-phy-ieee802.3-c22"; + phy-is-integrated; + }; + phy11: ethernet-phy@11 { + reg = <11>; + compatible = "ethernet-phy-ieee802.3-c22"; + phy-is-integrated; + }; + phy12: ethernet-phy@12 { + reg = <12>; + compatible = "ethernet-phy-ieee802.3-c22"; + phy-is-integrated; + }; + phy13: ethernet-phy@13 { + reg = <13>; + compatible = "ethernet-phy-ieee802.3-c22"; + phy-is-integrated; + }; + phy14: ethernet-phy@14 { + reg = <14>; + compatible = "ethernet-phy-ieee802.3-c22"; + phy-is-integrated; + }; + phy15: ethernet-phy@15 { + reg = <15>; + compatible = "ethernet-phy-ieee802.3-c22"; + phy-is-integrated; + }; + + /* External phy: RTL8214FC */ + phy24: ethernet-phy@24 { + compatible = "ethernet-phy-ieee802.3-c22"; + sfp; + media = "fibre"; + reg = <24>; + }; + phy25: ethernet-phy@25 { + compatible = "ethernet-phy-ieee802.3-c22"; + sfp; + media = "fibre"; + reg = <25>; + }; + phy26: ethernet-phy@26 { + compatible = "ethernet-phy-ieee802.3-c22"; + sfp; + media = "fibre"; + reg = <26>; + }; + phy27: ethernet-phy@27 { + compatible = "ethernet-phy-ieee802.3-c22"; + sfp; + media = "fibre"; + reg = <27>; + }; + }; +}; + +&switch0 { + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "lan1"; + phy-handle = <&phy0>; + phy-mode = "qsgmii"; + }; + port@1 { + reg = <1>; + label = "lan2"; + phy-handle = <&phy1>; + phy-mode = "qsgmii"; + }; + port@2 { + reg = <2>; + label = "lan3"; + phy-handle = <&phy2>; + phy-mode = "qsgmii"; + }; + port@3 { + reg = <3>; + label = "lan4"; + phy-handle = <&phy3>; + phy-mode = "qsgmii"; + }; + port@4 { + reg = <4>; + label = "lan5"; + phy-handle = <&phy4>; + phy-mode = "qsgmii"; + }; + port@5 { + reg = <5>; + label = "lan6"; + phy-handle = <&phy5>; + phy-mode = "qsgmii"; + }; + port@6 { + reg = <6>; + label = "lan7"; + phy-handle = <&phy6>; + phy-mode = "qsgmii"; + }; + port@7 { + reg = <7>; + label = "lan8"; + phy-handle = <&phy7>; + phy-mode = "qsgmii"; + }; + + port@8 { + reg = <8>; + label = "lan9"; + phy-handle = <&phy8>; + phy-mode = "internal"; + }; + port@9 { + reg = <9>; + label = "lan10"; + phy-handle = <&phy9>; + phy-mode = "internal"; + }; + port@10 { + reg = <10>; + label = "lan11"; + phy-handle = <&phy10>; + phy-mode = "internal"; + }; + port@11 { + reg = <11>; + label = "lan12"; + phy-handle = <&phy11>; + phy-mode = "internal"; + }; + port@12 { + reg = <12>; + label = "lan13"; + phy-handle = <&phy12>; + phy-mode = "internal"; + }; + port@13 { + reg = <13>; + label = "lan14"; + phy-handle = <&phy13>; + phy-mode = "internal"; + }; + port@14 { + reg = <14>; + label = "lan15"; + phy-handle = <&phy14>; + phy-mode = "internal"; + }; + port@15 { + reg = <15>; + label = "lan16"; + phy-handle = <&phy15>; + phy-mode = "internal"; + }; + + port@24 { + reg = <24>; + label = "lan17"; + phy-handle = <&phy24>; + phy-mode = "qsgmii"; + }; + port@25 { + reg = <25>; + label = "lan18"; + phy-handle = <&phy25>; + phy-mode = "qsgmii"; + }; + port@26 { + reg = <26>; + label = "lan19"; + phy-handle = <&phy26>; + phy-mode = "qsgmii"; + }; + port@27 { + reg = <27>; + label = "lan20"; + phy-handle = <&phy27>; + phy-mode = "qsgmii"; + }; + port@28 { + ethernet = <ðernet0>; + reg = <28>; + phy-mode = "internal"; + fixed-link { + speed = <1000>; + full-duplex; + }; + }; + }; +}; diff --git a/target/linux/rtl838x/dts/rtl838x.dtsi b/target/linux/rtl838x/dts/rtl838x.dtsi index 63dc9bf1ba..5d562063ea 100644 --- a/target/linux/rtl838x/dts/rtl838x.dtsi +++ b/target/linux/rtl838x/dts/rtl838x.dtsi @@ -1,5 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; + / { #address-cells = <1>; #size-cells = <1>; diff --git a/target/linux/rtl838x/files-5.4/arch/mips/include/asm/mach-rtl838x/mach-rtl838x.h b/target/linux/rtl838x/files-5.4/arch/mips/include/asm/mach-rtl838x/mach-rtl838x.h index cece36635c..4050661d33 100644 --- a/target/linux/rtl838x/files-5.4/arch/mips/include/asm/mach-rtl838x/mach-rtl838x.h +++ b/target/linux/rtl838x/files-5.4/arch/mips/include/asm/mach-rtl838x/mach-rtl838x.h @@ -16,11 +16,13 @@ #define rtl838x_w32(val, reg) __raw_writel(val, reg) #define rtl838x_w32_mask(clear, set, reg) rtl838x_w32((rtl838x_r32(reg) & ~(clear)) | (set), reg) +#define rtl838x_r8(reg) __raw_readb(reg) +#define rtl838x_w8(val, reg) __raw_writeb(val, reg) + #define sw_r32(reg) __raw_readl(RTL838X_SW_BASE + reg) #define sw_w32(val, reg) __raw_writel(val, RTL838X_SW_BASE + reg) #define sw_w32_mask(clear, set, reg) \ sw_w32((sw_r32(reg) & ~(clear)) | (set), reg) - #define sw_r64(reg) ((((u64)__raw_readl(RTL838X_SW_BASE + reg)) << 32) | \ __raw_readl(RTL838X_SW_BASE + reg + 4)) @@ -102,11 +104,15 @@ #define IRR1 (0x0c) -#define IRR1_SETTING ((GPIO_ABCD_RS << 28) | \ +#define IRR1_SETTING_RTL838X ((GPIO_ABCD_RS << 28) | \ (GPIO_EFGH_RS << 24) | \ (RTC_RS << 20) | \ (SWCORE_RS << 16) \ ) +#define IRR1_SETTING_RTL839X ((GPIO_ABCD_RS << 28) | \ + (SWCORE_RS << 16) \ + ) + #define IRR2 (0x10) #define IRR2_SETTING 0 diff --git a/target/linux/rtl838x/files-5.4/arch/mips/rtl838x/irq.c b/target/linux/rtl838x/files-5.4/arch/mips/rtl838x/irq.c index 34e90982b2..0c3a311d1d 100644 --- a/target/linux/rtl838x/files-5.4/arch/mips/rtl838x/irq.c +++ b/target/linux/rtl838x/files-5.4/arch/mips/rtl838x/irq.c @@ -29,36 +29,7 @@ extern struct rtl838x_soc_info soc_info; static DEFINE_RAW_SPINLOCK(irq_lock); extern irqreturn_t c0_compare_interrupt(int irq, void *dev_id); -unsigned int rtl838x_ictl_irq_dispatch1(void); -unsigned int rtl838x_ictl_irq_dispatch2(void); -unsigned int rtl838x_ictl_irq_dispatch3(void); -unsigned int rtl838x_ictl_irq_dispatch4(void); -unsigned int rtl838x_ictl_irq_dispatch5(void); -static struct irqaction irq_cascade1 = { - .handler = no_action, - .name = "RTL838X IRQ cascade1", -}; - -static struct irqaction irq_cascade2 = { - .handler = no_action, - .name = "RTL838X IRQ cascade2", -}; - -static struct irqaction irq_cascade3 = { - .handler = no_action, - .name = "RTL838X IRQ cascade3", -}; - -static struct irqaction irq_cascade4 = { - .handler = no_action, - .name = "RTL838X IRQ cascade4", -}; - -static struct irqaction irq_cascade5 = { - .handler = no_action, - .name = "RTL838X IRQ cascade5", -}; static void rtl838x_ictl_enable_irq(struct irq_data *i) { @@ -69,12 +40,6 @@ static void rtl838x_ictl_enable_irq(struct irq_data *i) raw_spin_unlock_irqrestore(&irq_lock, flags); } -static unsigned int rtl838x_ictl_startup_irq(struct irq_data *i) -{ - rtl838x_ictl_enable_irq(i); - return 0; -} - static void rtl838x_ictl_disable_irq(struct irq_data *i) { unsigned long flags; @@ -94,9 +59,7 @@ static void rtl838x_ictl_eoi_irq(struct irq_data *i) } static struct irq_chip rtl838x_ictl_irq = { - .name = "RTL838X", - .irq_startup = rtl838x_ictl_startup_irq, - .irq_shutdown = rtl838x_ictl_disable_irq, + .name = "RTL83xx", .irq_enable = rtl838x_ictl_enable_irq, .irq_disable = rtl838x_ictl_disable_irq, .irq_ack = rtl838x_ictl_disable_irq, @@ -106,113 +69,57 @@ static struct irq_chip rtl838x_ictl_irq = { }; /* - * RTL8390/80/28 Interrupt Scheme + * RTL8390/80/28 Interrupt Scheme * - * Source IRQ CPU INT - * -------- ------- ------- - * UART0 31 IP3 - * UART1 30 IP2 - * TIMER0 29 IP6 - * TIMER1 28 IP2 - * OCPTO 27 IP2 - * HLXTO 26 IP2 - * SLXTO 25 IP2 - * NIC 24 IP5 - * GPIO_ABCD 23 IP5 - * SWCORE 20 IP4 + * Source IRQ CPU INT + * -------- ------- ------- + * UART0 31 IP3 + * UART1 30 IP2 + * TIMER0 29 IP6 + * TIMER1 28 IP2 + * OCPTO 27 IP2 + * HLXTO 26 IP2 + * SLXTO 25 IP2 + * NIC 24 IP5 + * GPIO_ABCD 23 IP5 + * SWCORE 20 IP4 */ -unsigned int rtl838x_ictl_irq_dispatch1(void) -{ - /* Identify shared IRQ */ - unsigned int extint_ip = icu_r32(GIMR) & icu_r32(GISR); - - if (extint_ip & TC1_IP) - do_IRQ(TC1_IRQ); - else if (extint_ip & UART1_IP) - do_IRQ(UART1_IRQ); - else - spurious_interrupt(); - - return IRQ_HANDLED; -} - -unsigned int rtl838x_ictl_irq_dispatch2(void) -{ - do_IRQ(UART0_IRQ); - return IRQ_HANDLED; -} - -unsigned int rtl838x_ictl_irq_dispatch3(void) -{ - do_IRQ(SWCORE_IRQ); - return IRQ_HANDLED; -} - -unsigned int rtl838x_ictl_irq_dispatch4(void) -{ - /* Identify shared IRQ */ - unsigned int extint_ip = icu_r32(GIMR) & icu_r32(GISR); - - if (extint_ip & NIC_IP) - do_IRQ(NIC_IRQ); - else if (extint_ip & GPIO_ABCD_IP) - do_IRQ(GPIO_ABCD_IRQ); - else if ((extint_ip & GPIO_EFGH_IP) && (soc_info.family == RTL8328_FAMILY_ID)) - do_IRQ(GPIO_EFGH_IRQ); - else - spurious_interrupt(); - - return IRQ_HANDLED; -} - -unsigned int rtl838x_ictl_irq_dispatch5(void) -{ - do_IRQ(TC0_IRQ); - return IRQ_HANDLED; -} - asmlinkage void plat_irq_dispatch(void) { - unsigned int pending; + unsigned int pending, ext_int; - pending = read_c0_cause() & read_c0_status() & ST0_IM; + pending = read_c0_cause(); - if (pending & CAUSEF_IP7) + if (pending & CAUSEF_IP7) { c0_compare_interrupt(7, NULL); - else if (pending & CAUSEF_IP6) - rtl838x_ictl_irq_dispatch5(); - else if (pending & CAUSEF_IP5) - rtl838x_ictl_irq_dispatch4(); - else if (pending & CAUSEF_IP4) - rtl838x_ictl_irq_dispatch3(); - else if (pending & CAUSEF_IP3) - rtl838x_ictl_irq_dispatch2(); - else if (pending & CAUSEF_IP2) - rtl838x_ictl_irq_dispatch1(); - else + } else if (pending & CAUSEF_IP6) { + do_IRQ(TC0_IRQ); + } else if (pending & CAUSEF_IP5) { + ext_int = icu_r32(GIMR) & icu_r32(GISR); + if (ext_int & NIC_IP) + do_IRQ(NIC_IRQ); + else if (ext_int & GPIO_ABCD_IP) + do_IRQ(GPIO_ABCD_IRQ); + else if ((ext_int & GPIO_EFGH_IP) && (soc_info.family == RTL8328_FAMILY_ID)) + do_IRQ(GPIO_EFGH_IRQ); + else + spurious_interrupt(); + } else if (pending & CAUSEF_IP4) { + do_IRQ(SWCORE_IRQ); + } else if (pending & CAUSEF_IP3) { + do_IRQ(UART0_IRQ); + } else if (pending & CAUSEF_IP2) { + ext_int = icu_r32(GIMR) & icu_r32(GISR); + if (ext_int & TC1_IP) + do_IRQ(TC1_IRQ); + else if (ext_int & UART1_IP) + do_IRQ(UART1_IRQ); + else + spurious_interrupt(); + } else { spurious_interrupt(); -} - -static void __init rtl838x_ictl_irq_init(unsigned int irq_base) -{ - int i; - - for (i = 0; i < RTL838X_IRQ_ICTL_NUM; i++) - irq_set_chip_and_handler(irq_base + i, &rtl838x_ictl_irq, handle_level_irq); - - setup_irq(RTL838X_ICTL1_IRQ, &irq_cascade1); - setup_irq(RTL838X_ICTL2_IRQ, &irq_cascade2); - setup_irq(RTL838X_ICTL3_IRQ, &irq_cascade3); - setup_irq(RTL838X_ICTL4_IRQ, &irq_cascade4); - setup_irq(RTL838X_ICTL5_IRQ, &irq_cascade5); - - /* Set GIMR, IRR */ - icu_w32(TC0_IE | UART0_IE, GIMR); - icu_w32(IRR0_SETTING, IRR0); - icu_w32(IRR1_SETTING, IRR1); - icu_w32(IRR2_SETTING, IRR2); - icu_w32(IRR3_SETTING, IRR3); + } } static int intc_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw) @@ -234,11 +141,12 @@ int __init icu_of_init(struct device_node *node, struct device_node *parent) struct resource res; pr_info("Found Interrupt controller: %s (%s)\n", node->name, node->full_name); - if (of_address_to_resource(node, 0, &res)) { + if (of_address_to_resource(node, 0, &res)) panic("Failed to get icu memory range"); - } + if (!request_mem_region(res.start, resource_size(&res), res.name)) pr_err("Failed to request icu memory\n"); + soc_info.icu_base = ioremap(res.start, resource_size(&res)); pr_info("ICU Memory: %08x\n", (u32)soc_info.icu_base); @@ -247,10 +155,44 @@ int __init icu_of_init(struct device_node *node, struct device_node *parent) domain = irq_domain_add_simple(node, 32, 0, &irq_domain_ops, NULL); /* Setup all external HW irqs */ - for (i = 8; i < 32; i++) + for (i = 8; i < RTL838X_IRQ_ICTL_NUM; i++) { irq_domain_associate(domain, i, i); + irq_set_chip_and_handler(RTL838X_IRQ_ICTL_BASE + i, + &rtl838x_ictl_irq, handle_level_irq); + } - rtl838x_ictl_irq_init(RTL838X_IRQ_ICTL_BASE); + if (request_irq(RTL838X_ICTL1_IRQ, no_action, IRQF_NO_THREAD, + "IRQ cascade 1", NULL)) { + pr_err("request_irq() cascade 1 for irq %d failed\n", RTL838X_ICTL1_IRQ); + } + if (request_irq(RTL838X_ICTL2_IRQ, no_action, IRQF_NO_THREAD, + "IRQ cascade 2", NULL)) { + pr_err("request_irq() cascade 2 for irq %d failed\n", RTL838X_ICTL2_IRQ); + } + if (request_irq(RTL838X_ICTL3_IRQ, no_action, IRQF_NO_THREAD, + "IRQ cascade 3", NULL)) { + pr_err("request_irq() cascade 3 for irq %d failed\n", RTL838X_ICTL3_IRQ); + } + if (request_irq(RTL838X_ICTL4_IRQ, no_action, IRQF_NO_THREAD, + "IRQ cascade 4", NULL)) { + pr_err("request_irq() cascade 4 for irq %d failed\n", RTL838X_ICTL4_IRQ); + } + if (request_irq(RTL838X_ICTL5_IRQ, no_action, IRQF_NO_THREAD, + "IRQ cascade 5", NULL)) { + pr_err("request_irq() cascade 5 for irq %d failed\n", RTL838X_ICTL5_IRQ); + } + + /* Set up interrupt routing scheme */ + icu_w32(IRR0_SETTING, IRR0); + if (soc_info.family == RTL8380_FAMILY_ID) + icu_w32(IRR1_SETTING_RTL838X, IRR1); + else + icu_w32(IRR1_SETTING_RTL839X, IRR1); + icu_w32(IRR2_SETTING, IRR2); + icu_w32(IRR3_SETTING, IRR3); + + /* Enable timer0 and uart0 interrupts */ + icu_w32(TC0_IE | UART0_IE, GIMR); return 0; } diff --git a/target/linux/rtl838x/files-5.4/drivers/net/dsa/rtl838x.h b/target/linux/rtl838x/files-5.4/drivers/net/dsa/rtl838x.h index 127a31dca1..2e420a9db4 100644 --- a/target/linux/rtl838x/files-5.4/drivers/net/dsa/rtl838x.h +++ b/target/linux/rtl838x/files-5.4/drivers/net/dsa/rtl838x.h @@ -38,6 +38,14 @@ #define RTL838X_STAT_CTRL (0x3108) #define RTL839X_STAT_CTRL (0x04cc) +/* Registers of the internal Serdes of the 8390 */ +#define RTL8390_SDS0_1_XSG0 (0xA000) +#define RTL8390_SDS0_1_XSG1 (0xA100) +#define RTL839X_SDS12_13_XSG0 (0xB800) +#define RTL839X_SDS12_13_XSG1 (0xB900) +#define RTL839X_SDS12_13_PWR0 (0xb880) +#define RTL839X_SDS12_13_PWR1 (0xb980) + /* Registers of the internal Serdes of the 8380 */ #define MAPLE_SDS4_REG0r RTL838X_SDS4_REG28 #define MAPLE_SDS5_REG0r (RTL838X_SDS4_REG28 + 0x100) diff --git a/target/linux/rtl838x/files-5.4/drivers/net/dsa/rtl838x_phy.c b/target/linux/rtl838x/files-5.4/drivers/net/dsa/rtl838x_phy.c index 209ea50f04..e5dfdcaa07 100644 --- a/target/linux/rtl838x/files-5.4/drivers/net/dsa/rtl838x_phy.c +++ b/target/linux/rtl838x/files-5.4/drivers/net/dsa/rtl838x_phy.c @@ -23,6 +23,7 @@ #define PHY_ID_RTL8218B_E 0x001cc981 #define PHY_ID_RTL8218B_I 0x001cca40 #define PHY_ID_RTL8390_GENERIC 0x001ccab0 +#define PHY_ID_RTL8393_I 0x001c8393 struct __attribute__ ((__packed__)) part { uint16_t start; @@ -118,6 +119,116 @@ void rtl8380_sds_rst(int mac) pr_info("SERDES reset: %d\n", mac); } +int rtl839x_read_sds_phy(int phy_addr, int phy_reg) +{ + int offset = 0; + int reg; + u32 val; + + if (phy_addr == 49) + offset = 0x100; + + /* For the RTL8393 internal SerDes, we simulate a PHY ID in registers 2/3 + * which would otherwise read as 0 + */ + if (soc_info.id == 0x8393) { + if (phy_reg == 2) + return 0x1c; + if (phy_reg == 3) + return 0x8393; + } + + reg = (phy_reg << 1) & 0xfc; + val = sw_r32(RTL839X_SDS12_13_XSG0 + offset + 0x80 + reg); + + if (phy_reg & 1) + val = (val >> 16) & 0xffff; + else + val &= 0xffff; + return val; +} + +int rtl838x_read_sds_phy(int phy_addr, int phy_reg) +{ + int offset = 0; + u32 val; + + if (phy_addr == 26) + offset = 0x100; + val = sw_r32(MAPLE_SDS4_FIB_REG0r + offset + (phy_reg << 2)) & 0xffff; + + return val; +} + +int rtl839x_write_sds_phy(int phy_addr, int phy_reg, u16 v) +{ + int offset = 0; + int reg; + u32 val; + + if (phy_addr == 49) + offset = 0x100; + + reg = (phy_reg << 1) & 0xfc; + val = v; + if (phy_reg & 1) { + val = val << 16; + sw_w32_mask(0xffff0000, val, + RTL839X_SDS12_13_XSG0 + offset + 0x80 + reg); + } else { + sw_w32_mask(0xffff, val, + RTL839X_SDS12_13_XSG0 + offset + 0x80 + reg); + } + + return 0; +} + +/* Read the link and speed status of the 2 internal SGMII/1000Base-X + * ports of the RTL838x SoCs + */ +static int rtl8380_read_status(struct phy_device *phydev) +{ + int err; + int phy_addr = phydev->mdio.addr; + + err = genphy_read_status(phydev); + + if (phydev->link) { + phydev->speed = SPEED_1000; + phydev->duplex = DUPLEX_FULL; + } + + return err; +} + +/* Read the link and speed status of the 2 internal SGMII/1000Base-X + * ports of the RTL8393 SoC + */ +static int rtl8393_read_status(struct phy_device *phydev) +{ + int offset = 0; + int err; + int phy_addr = phydev->mdio.addr; + u32 v; + + err = genphy_read_status(phydev); + if (phy_addr == 49) + offset = 0x100; + + if (phydev->link) { + phydev->speed = SPEED_100; + /* Read SPD_RD_00 (bit 13) and SPD_RD_01 (bit 6) out of the internal + * PHY registers + */ + v = sw_r32(RTL839X_SDS12_13_XSG0 + offset + 0x80); + if (!(v & (1 << 13)) && (v & (1 << 6))) + phydev->speed = SPEED_1000; + phydev->duplex = DUPLEX_FULL; + } + + return err; +} + static struct fw_header * rtl838x_request_fw(struct phy_device *phydev, const struct firmware *fw, const char *name) @@ -140,8 +251,8 @@ rtl838x_request_fw(struct phy_device *phydev, const struct firmware *fw, h = (struct fw_header *) fw->data; pr_info("Firmware loaded. Size %d, magic: %08x\n", fw->size, h->magic); - if (h->phy != 0x83800000) { - pr_err("Wrong firmware file: PHY mismatch.\n"); + if (h->magic != 0x83808380) { + pr_err("Wrong firmware file: MAGIC mismatch.\n"); goto out; } @@ -304,7 +415,7 @@ static int rtl8380_configure_ext_rtl8218b(struct phy_device *phydev) if (!h) return -1; - if (h->phy != 0x8218b00) { + if (h->phy != 0x8218b000) { phydev_err(phydev, "Wrong firmware file: PHY mismatch.\n"); return -1; } @@ -406,7 +517,15 @@ static int rtl8218b_ext_match_phy_device(struct phy_device *phydev) { int addr = phydev->mdio.addr; - return phydev->phy_id == PHY_ID_RTL8218B_E && addr < 8; + /* Both the RTL8214FC and the external RTL8218B have the same + * PHY ID. On the RTL838x, the RTL8218B can only be attached_dev + * at PHY IDs 0-7, while the RTL8214FC must be attached via + * the pair of SGMII/1000Base-X with higher PHY-IDs + */ + if (soc_info.family == RTL8380_FAMILY_ID) + return phydev->phy_id == PHY_ID_RTL8218B_E && addr < 8; + else + return phydev->phy_id == PHY_ID_RTL8218B_E; } @@ -1065,12 +1184,32 @@ static int rtl8380_configure_serdes(struct phy_device *phydev) return 0; } +static int rtl8390_configure_serdes(struct phy_device *phydev) +{ + phydev_info(phydev, "Detected internal RTL8390 SERDES\n"); + + /* In autoneg state, force link, set SR4_CFG_EN_LINK_FIB1G */ + sw_w32_mask(0, 1 << 18, RTL839X_SDS12_13_XSG0 + 0x0a); + + /* Disable EEE: Clear FRE16_EEE_RSG_FIB1G, FRE16_EEE_STD_FIB1G, + * FRE16_C1_PWRSAV_EN_FIB1G, FRE16_C2_PWRSAV_EN_FIB1G + * and FRE16_EEE_QUIET_FIB1G + */ + sw_w32_mask(0x1f << 10, 0, RTL839X_SDS12_13_XSG0 + 0xe0); + + return 0; +} + static int rtl8214fc_phy_probe(struct phy_device *phydev) { struct device *dev = &phydev->mdio.dev; struct rtl838x_phy_priv *priv; int addr = phydev->mdio.addr; + /* 839x has internal SerDes */ + if (soc_info.id == 0x8393) + return -ENODEV; + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM; @@ -1118,7 +1257,7 @@ static int rtl8218b_ext_phy_probe(struct phy_device *phydev) priv->name = "RTL8218B (external)"; /* All base addresses of the PHYs start at multiples of 8 */ - if (!(addr % 8)) { + if (!(addr % 8) && soc_info.family == RTL8380_FAMILY_ID) { /* Configuration must be done while patching still possible */ return rtl8380_configure_ext_rtl8218b(phydev); } @@ -1176,6 +1315,27 @@ static int rtl838x_serdes_probe(struct phy_device *phydev) return -ENODEV; } +static int rtl8393_serdes_probe(struct phy_device *phydev) +{ + struct device *dev = &phydev->mdio.dev; + struct rtl838x_phy_priv *priv; + int addr = phydev->mdio.addr; + + pr_info("%s: id: %d\n", __func__, addr); + if (soc_info.family != RTL8390_FAMILY_ID) + return -ENODEV; + + if (addr < 24) + return -ENODEV; + + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + + priv->name = "RTL8393 Serdes"; + return rtl8390_configure_serdes(phydev); +} + static int rtl8390_serdes_probe(struct phy_device *phydev) { struct device *dev = &phydev->mdio.dev; @@ -1198,8 +1358,8 @@ static int rtl8390_serdes_probe(struct phy_device *phydev) static struct phy_driver rtl838x_phy_driver[] = { { - PHY_ID_MATCH_MODEL(PHY_ID_RTL8214FC), - .name = "REATLTEK RTL8214C", + PHY_ID_MATCH_MODEL(PHY_ID_RTL8214C), + .name = "REALTEK RTL8214C", .features = PHY_GBIT_FEATURES, .match_phy_device = rtl8214c_match_phy_device, .probe = rtl8214c_phy_probe, @@ -1209,7 +1369,7 @@ static struct phy_driver rtl838x_phy_driver[] = { }, { PHY_ID_MATCH_MODEL(PHY_ID_RTL8214FC), - .name = "REATLTEK RTL8214FC", + .name = "REALTEK RTL8214FC", .features = PHY_GBIT_FIBRE_FEATURES, .match_phy_device = rtl8214fc_match_phy_device, .probe = rtl8214fc_phy_probe, @@ -1225,7 +1385,7 @@ static struct phy_driver rtl838x_phy_driver[] = { }, { PHY_ID_MATCH_MODEL(PHY_ID_RTL8218B_E), - .name = "REATLTEK RTL8218B (external)", + .name = "REALTEK RTL8218B (external)", .features = PHY_GBIT_FEATURES, .match_phy_device = rtl8218b_ext_match_phy_device, .probe = rtl8218b_ext_phy_probe, @@ -1239,7 +1399,7 @@ static struct phy_driver rtl838x_phy_driver[] = { }, { PHY_ID_MATCH_MODEL(PHY_ID_RTL8218B_I), - .name = "REATLTEK RTL8218B (internal)", + .name = "REALTEK RTL8218B (internal)", .features = PHY_GBIT_FEATURES, .probe = rtl8218b_int_phy_probe, .suspend = genphy_suspend, @@ -1252,7 +1412,7 @@ static struct phy_driver rtl838x_phy_driver[] = { }, { PHY_ID_MATCH_MODEL(PHY_ID_RTL8218B_I), - .name = "REATLTEK RTL8380 SERDES", + .name = "REALTEK RTL8380 SERDES", .features = PHY_GBIT_FIBRE_FEATURES, .probe = rtl838x_serdes_probe, .suspend = genphy_suspend, @@ -1260,10 +1420,21 @@ static struct phy_driver rtl838x_phy_driver[] = { .set_loopback = genphy_loopback, .read_mmd = rtl8380_rtl8218b_read_mmd, .write_mmd = rtl8380_rtl8218b_write_mmd, + .read_status = rtl8380_read_status, + }, + { + PHY_ID_MATCH_MODEL(PHY_ID_RTL8393_I), + .name = "REALTEK RTL8393 SERDES", + .features = PHY_GBIT_FIBRE_FEATURES, + .probe = rtl8393_serdes_probe, + .suspend = genphy_suspend, + .resume = genphy_resume, + .set_loopback = genphy_loopback, + .read_status = rtl8393_read_status, }, { PHY_ID_MATCH_MODEL(PHY_ID_RTL8390_GENERIC), - .name = "REATLTEK RTL8390 Generic", + .name = "REALTEK RTL8390 Generic", .features = PHY_GBIT_FIBRE_FEATURES, .probe = rtl8390_serdes_probe, .suspend = genphy_suspend, diff --git a/target/linux/rtl838x/base-files/lib/firmware/rtl838x_phy/rtl838x_8214fc.fw b/target/linux/rtl838x/files/firmware/rtl838x_phy/rtl838x_8214fc.fw similarity index 100% rename from target/linux/rtl838x/base-files/lib/firmware/rtl838x_phy/rtl838x_8214fc.fw rename to target/linux/rtl838x/files/firmware/rtl838x_phy/rtl838x_8214fc.fw diff --git a/target/linux/rtl838x/base-files/lib/firmware/rtl838x_phy/rtl838x_8218b.fw b/target/linux/rtl838x/files/firmware/rtl838x_phy/rtl838x_8218b.fw similarity index 91% rename from target/linux/rtl838x/base-files/lib/firmware/rtl838x_phy/rtl838x_8218b.fw rename to target/linux/rtl838x/files/firmware/rtl838x_phy/rtl838x_8218b.fw index a907849fb9..66325ef242 100644 Binary files a/target/linux/rtl838x/base-files/lib/firmware/rtl838x_phy/rtl838x_8218b.fw and b/target/linux/rtl838x/files/firmware/rtl838x_phy/rtl838x_8218b.fw differ diff --git a/target/linux/rtl838x/base-files/lib/firmware/rtl838x_phy/rtl838x_8380.fw b/target/linux/rtl838x/files/firmware/rtl838x_phy/rtl838x_8380.fw similarity index 100% rename from target/linux/rtl838x/base-files/lib/firmware/rtl838x_phy/rtl838x_8380.fw rename to target/linux/rtl838x/files/firmware/rtl838x_phy/rtl838x_8380.fw diff --git a/target/linux/rtl838x/image/Makefile b/target/linux/rtl838x/image/Makefile index eef1fe0a33..291888ab2d 100644 --- a/target/linux/rtl838x/image/Makefile +++ b/target/linux/rtl838x/image/Makefile @@ -41,4 +41,13 @@ define Device/allnet_all-sg8208m endef TARGET_DEVICES += allnet_all-sg8208m +define Device/d-link_dgs-1210-16 + SOC := rtl8382 + IMAGE_SIZE := 13824k + DEVICE_VENDOR := D-Link + DEVICE_MODEL := DGS-1210-16 + DEVICE_PACKAGES := ip-full ip-bridge ethtool tc +endef +TARGET_DEVICES += d-link_dgs-1210-16 + $(eval $(call BuildImage)) diff --git a/target/linux/sunxi/config-4.19 b/target/linux/sunxi/config-4.19 index 37b45c666d..c37457a78e 100644 --- a/target/linux/sunxi/config-4.19 +++ b/target/linux/sunxi/config-4.19 @@ -170,9 +170,7 @@ CONFIG_ELF_CORE=y CONFIG_ENABLE_MUST_CHECK=y CONFIG_EXT4_FS=y CONFIG_EXTCON=y -# CONFIG_F2FS_CHECK_FS is not set CONFIG_F2FS_FS=y -# CONFIG_F2FS_FS_SECURITY is not set CONFIG_FAT_FS=y CONFIG_FB=y CONFIG_FB_CFB_COPYAREA=y @@ -498,6 +496,8 @@ CONFIG_SND_COMPRESS_OFFLOAD=y CONFIG_SND_JACK=y CONFIG_SND_JACK_INPUT_DEV=y CONFIG_SND_PCM=y +CONFIG_SND_SIMPLE_CARD=y +CONFIG_SND_SIMPLE_CARD_UTILS=y CONFIG_SND_SOC=y CONFIG_SND_SOC_I2C_AND_SPI=y # CONFIG_SND_SUN4I_I2S is not set @@ -581,7 +581,6 @@ CONFIG_USB_STORAGE=y CONFIG_USB_SUPPORT=y CONFIG_USERIO=y CONFIG_USE_OF=y -CONFIG_VDSO=y CONFIG_VFAT_FS=y CONFIG_VFP=y CONFIG_VFPv3=y diff --git a/target/linux/sunxi/config-5.4 b/target/linux/sunxi/config-5.4 index fa765b31f8..d34cb4c7ae 100644 --- a/target/linux/sunxi/config-5.4 +++ b/target/linux/sunxi/config-5.4 @@ -484,6 +484,8 @@ CONFIG_SND_COMPRESS_OFFLOAD=y CONFIG_SND_JACK=y CONFIG_SND_JACK_INPUT_DEV=y CONFIG_SND_PCM=y +CONFIG_SND_SIMPLE_CARD=y +CONFIG_SND_SIMPLE_CARD_UTILS=y CONFIG_SND_SOC=y CONFIG_SND_SOC_I2C_AND_SPI=y # CONFIG_SND_SUN4I_I2S is not set @@ -565,7 +567,6 @@ CONFIG_USB_STORAGE=y CONFIG_USB_SUPPORT=y CONFIG_USERIO=y CONFIG_USE_OF=y -CONFIG_VDSO=y CONFIG_VFAT_FS=y CONFIG_VFP=y CONFIG_VFPv3=y diff --git a/target/linux/sunxi/image/cortexa7.mk b/target/linux/sunxi/image/cortexa7.mk index 083010ad8c..f11b13625c 100644 --- a/target/linux/sunxi/image/cortexa7.mk +++ b/target/linux/sunxi/image/cortexa7.mk @@ -47,6 +47,14 @@ define Device/friendlyarm_nanopi-neo-air endef TARGET_DEVICES += friendlyarm_nanopi-neo-air +define Device/friendlyarm_zeropi + DEVICE_VENDOR := FriendlyARM + DEVICE_MODEL := ZeroPi + DEVICE_PACKAGES := kmod-rtc-sunxi + SOC := sun8i-h3 +endef +TARGET_DEVICES += friendlyarm_zeropi + define Device/lamobo_lamobo-r1 DEVICE_VENDOR := Lamobo DEVICE_MODEL := Lamobo R1 @@ -63,13 +71,15 @@ define Device/lemaker_bananapi endef TARGET_DEVICES += lemaker_bananapi -define Device/lemaker_bananapi-m2-ultra - DEVICE_VENDOR := LeMaker +define Device/sinovoip_bananapi-m2-ultra + DEVICE_VENDOR := Sinovoip DEVICE_MODEL := Banana Pi M2 Ultra - DEVICE_PACKAGES:=kmod-rtc-sunxi kmod-ata-sunxi + DEVICE_PACKAGES:=kmod-rtc-sunxi kmod-ata-sunxi kmod-brcmfmac \ + brcmfmac-firmware-43430a0-sdio wpad-basic-wolfssl + SUPPORTED_DEVICES:=lemaker,bananapi-m2-ultra SOC := sun8i-r40 endef -TARGET_DEVICES += lemaker_bananapi-m2-ultra +TARGET_DEVICES += sinovoip_bananapi-m2-ultra define Device/lemaker_bananapro DEVICE_VENDOR := LeMaker diff --git a/target/linux/sunxi/modules.mk b/target/linux/sunxi/modules.mk index b8ea7d5cb6..6d2de98658 100644 --- a/target/linux/sunxi/modules.mk +++ b/target/linux/sunxi/modules.mk @@ -68,7 +68,6 @@ endef $(eval $(call KernelPackage,sun4i-emac)) - define KernelPackage/sound-soc-sunxi TITLE:=AllWinner built-in SoC sound support KCONFIG:=CONFIG_SND_SUN4I_CODEC @@ -83,3 +82,18 @@ define KernelPackage/sound-soc-sunxi/description endef $(eval $(call KernelPackage,sound-soc-sunxi)) + +define KernelPackage/sound-soc-sunxi-spdif + TITLE:=Allwinner A10 SPDIF Support + KCONFIG:=CONFIG_SND_SUN4I_SPDIF + FILES:=$(LINUX_DIR)/sound/soc/sunxi/sun4i-spdif.ko + AUTOLOAD:=$(call AutoLoad,65,sun4i-spdif) + DEPENDS:=@TARGET_sunxi +kmod-sound-soc-spdif + $(call AddDepends/sound) +endef + +define KernelPackage/sound-soc-sunxi-spdif/description + Kernel support for Allwinner A10 SPDIF Support +endef + +$(eval $(call KernelPackage,sound-soc-sunxi-spdif)) diff --git a/target/linux/sunxi/patches-5.4/062-add-sun8i-h3-zeropi-support.patch b/target/linux/sunxi/patches-5.4/062-add-sun8i-h3-zeropi-support.patch new file mode 100644 index 0000000000..dc69f70bbe --- /dev/null +++ b/target/linux/sunxi/patches-5.4/062-add-sun8i-h3-zeropi-support.patch @@ -0,0 +1,79 @@ +--- a/arch/arm/boot/dts/Makefile ++++ b/arch/arm/boot/dts/Makefile +@@ -1118,6 +1118,7 @@ dtb-$(CONFIG_MACH_SUN8I) += \ + sun8i-h3-orangepi-plus2e.dtb \ + sun8i-h3-orangepi-zero-plus2.dtb \ + sun8i-h3-rervision-dvk.dtb \ ++ sun8i-h3-zeropi.dtb \ + sun8i-r16-bananapi-m2m.dtb \ + sun8i-r16-nintendo-nes-classic.dtb \ + sun8i-r16-nintendo-super-nes-classic.dtb \ +--- /dev/null ++++ b/arch/arm/boot/dts/sun8i-h3-zeropi.dts +@@ -0,0 +1,66 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++ ++#include "sun8i-h3-nanopi.dtsi" ++ ++/ { ++ model = "FriendlyElec ZeroPi"; ++ compatible = "friendlyarm,zeropi", "allwinner,sun8i-h3"; ++ ++ aliases { ++ ethernet0 = &emac; ++ }; ++ ++ reg_gmac_3v3: gmac-3v3 { ++ compatible = "regulator-fixed"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&gmac_power_pin_nanopi>; ++ regulator-name = "gmac-3v3"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ startup-delay-us = <100000>; ++ enable-active-high; ++ gpio = <&pio 3 6 GPIO_ACTIVE_HIGH>; ++ }; ++}; ++ ++&ehci0 { ++ status = "okay"; ++}; ++ ++&ohci0 { ++ status = "okay"; ++}; ++ ++&pio { ++ gmac_power_pin_nanopi: gmac_power_pin@0 { ++ pins = "PD6"; ++ function = "gpio_out"; ++ }; ++}; ++ ++&external_mdio { ++ ext_rgmii_phy: ethernet-phy@1 { ++ compatible = "ethernet-phy-ieee802.3-c22"; ++ reg = <7>; ++ }; ++}; ++ ++&emac { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&emac_rgmii_pins>; ++ phy-supply = <®_gmac_3v3>; ++ phy-handle = <&ext_rgmii_phy>; ++ phy-mode = "rgmii"; ++ ++ allwinner,leds-active-low; ++ status = "okay"; ++}; ++ ++&usb_otg { ++ status = "okay"; ++ dr_mode = "peripheral"; ++}; ++ ++&usbphy { ++ usb0_id_det-gpios = <&pio 6 12 GPIO_ACTIVE_HIGH>; /* PG12 */ ++}; diff --git a/target/linux/tegra/config-4.19 b/target/linux/tegra/config-4.19 index 0650783f8b..c5a4c9941d 100644 --- a/target/linux/tegra/config-4.19 +++ b/target/linux/tegra/config-4.19 @@ -195,9 +195,7 @@ CONFIG_EDAC_SUPPORT=y CONFIG_ENABLE_MUST_CHECK=y CONFIG_EXT4_FS=y CONFIG_EXTCON=y -# CONFIG_F2FS_CHECK_FS is not set CONFIG_F2FS_FS=y -# CONFIG_F2FS_FS_SECURITY is not set CONFIG_FB=y CONFIG_FB_CFB_COPYAREA=y CONFIG_FB_CFB_FILLRECT=y @@ -541,7 +539,6 @@ CONFIG_USB_ULPI=y CONFIG_USB_ULPI_VIEWPORT=y # CONFIG_USERIO is not set CONFIG_USE_OF=y -CONFIG_VDSO=y # CONFIG_VFIO is not set CONFIG_VFP=y CONFIG_VFPv3=y diff --git a/target/linux/tegra/config-5.4 b/target/linux/tegra/config-5.4 index 968bcb4620..6bc96d13ce 100644 --- a/target/linux/tegra/config-5.4 +++ b/target/linux/tegra/config-5.4 @@ -210,9 +210,7 @@ CONFIG_EDAC_SUPPORT=y CONFIG_ENABLE_MUST_CHECK=y CONFIG_EXT4_FS=y CONFIG_EXTCON=y -# CONFIG_F2FS_CHECK_FS is not set CONFIG_F2FS_FS=y -# CONFIG_F2FS_FS_SECURITY is not set CONFIG_FB=y CONFIG_FB_CFB_COPYAREA=y CONFIG_FB_CFB_FILLRECT=y @@ -556,7 +554,6 @@ CONFIG_USB_ULPI=y CONFIG_USB_ULPI_VIEWPORT=y # CONFIG_USERIO is not set CONFIG_USE_OF=y -CONFIG_VDSO=y # CONFIG_VFIO is not set CONFIG_VFP=y CONFIG_VFPv3=y diff --git a/target/linux/uml/config/i386 b/target/linux/uml/config/i386 index 94a972792a..5a066ac6a3 100644 --- a/target/linux/uml/config/i386 +++ b/target/linux/uml/config/i386 @@ -30,7 +30,6 @@ CONFIG_DNOTIFY=y # CONFIG_EARLY_PRINTK is not set CONFIG_EXT4_FS=y CONFIG_F2FS_FS=y -CONFIG_F2FS_STAT_FS=y CONFIG_FAILOVER=y CONFIG_FS_IOMAP=y CONFIG_FS_MBCACHE=y diff --git a/target/linux/uml/config/x86_64 b/target/linux/uml/config/x86_64 index 988ef22faf..d3b3704f6c 100644 --- a/target/linux/uml/config/x86_64 +++ b/target/linux/uml/config/x86_64 @@ -32,7 +32,6 @@ CONFIG_DNOTIFY=y # CONFIG_EARLY_PRINTK is not set CONFIG_EXT4_FS=y CONFIG_F2FS_FS=y -CONFIG_F2FS_STAT_FS=y CONFIG_FAILOVER=y CONFIG_FS_IOMAP=y CONFIG_FS_MBCACHE=y diff --git a/target/linux/uml/patches-5.4/101-mconsole-exec.patch b/target/linux/uml/patches-5.4/101-mconsole-exec.patch index 827e85606b..ca4f27b53f 100644 --- a/target/linux/uml/patches-5.4/101-mconsole-exec.patch +++ b/target/linux/uml/patches-5.4/101-mconsole-exec.patch @@ -153,7 +153,7 @@ pid_t pid; --- a/kernel/umh.c +++ b/kernel/umh.c -@@ -75,6 +75,28 @@ static int call_usermodehelper_exec_asyn +@@ -76,6 +76,28 @@ static int call_usermodehelper_exec_asyn flush_signal_handlers(current, 1); spin_unlock_irq(¤t->sighand->siglock); @@ -180,9 +180,9 @@ + } + /* - * Our parent (unbound workqueue) runs with elevated scheduling - * priority. Avoid propagating that into the userspace child. -@@ -353,6 +375,20 @@ static void helper_unlock(void) + * Initial kernel threads share ther FS with init, in order to + * get the init root directory. But we've now created a new +@@ -362,6 +384,20 @@ static void helper_unlock(void) wake_up(&running_helpers_waitq); } diff --git a/target/linux/x86/config-4.19 b/target/linux/x86/config-4.19 index 34c10ae409..fad10dfef4 100644 --- a/target/linux/x86/config-4.19 +++ b/target/linux/x86/config-4.19 @@ -128,9 +128,7 @@ CONFIG_EDAC_SUPPORT=y # CONFIG_EDD is not set # CONFIG_EUROTECH_WDT is not set CONFIG_EXT4_FS=y -# CONFIG_F2FS_CHECK_FS is not set CONFIG_F2FS_FS=y -# CONFIG_F2FS_FS_SECURITY is not set # CONFIG_F71808E_WDT is not set CONFIG_FIRMWARE_MEMMAP=y CONFIG_FIX_EARLYCON_MEM=y diff --git a/target/linux/x86/config-5.4 b/target/linux/x86/config-5.4 index a2b18f33f0..83d9cf2e05 100644 --- a/target/linux/x86/config-5.4 +++ b/target/linux/x86/config-5.4 @@ -145,9 +145,7 @@ CONFIG_EFI_EARLYCON=y # CONFIG_EISA is not set # CONFIG_EUROTECH_WDT is not set CONFIG_EXT4_FS=y -# CONFIG_F2FS_CHECK_FS is not set CONFIG_F2FS_FS=y -# CONFIG_F2FS_FS_SECURITY is not set # CONFIG_F71808E_WDT is not set CONFIG_FIRMWARE_MEMMAP=y CONFIG_FIX_EARLYCON_MEM=y diff --git a/target/linux/zynq/config-4.19 b/target/linux/zynq/config-4.19 index c12bd5f8c1..1581521d89 100644 --- a/target/linux/zynq/config-4.19 +++ b/target/linux/zynq/config-4.19 @@ -192,9 +192,7 @@ CONFIG_ELF_CORE=y CONFIG_ENABLE_MUST_CHECK=y CONFIG_EXT4_FS=y CONFIG_EXTCON=y -# CONFIG_F2FS_CHECK_FS is not set CONFIG_F2FS_FS=y -# CONFIG_F2FS_FS_SECURITY is not set CONFIG_FB=y CONFIG_FB_CFB_COPYAREA=y CONFIG_FB_CFB_FILLRECT=y diff --git a/target/linux/zynq/config-5.4 b/target/linux/zynq/config-5.4 index d389a27a03..5b7b0ebfb3 100644 --- a/target/linux/zynq/config-5.4 +++ b/target/linux/zynq/config-5.4 @@ -203,9 +203,7 @@ CONFIG_ELF_CORE=y CONFIG_ENABLE_MUST_CHECK=y CONFIG_EXT4_FS=y CONFIG_EXTCON=y -# CONFIG_F2FS_CHECK_FS is not set CONFIG_F2FS_FS=y -# CONFIG_F2FS_FS_SECURITY is not set CONFIG_FB=y CONFIG_FB_CFB_COPYAREA=y CONFIG_FB_CFB_FILLRECT=y diff --git a/toolchain/glibc/common.mk b/toolchain/glibc/common.mk index 6b3f15b129..2a223484da 100644 --- a/toolchain/glibc/common.mk +++ b/toolchain/glibc/common.mk @@ -12,8 +12,8 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) -PKG_SOURCE_VERSION:=6fdf971c9dbf7dac9bea552113fe4694015bbc4d -PKG_MIRROR_HASH:=80998023c237bd0eaa38554e18536d8f66223e97fc5ade015a2d2aadf587d1f0 +PKG_SOURCE_VERSION:=32965a46ce978f271ec6d3745f951da111c8e74a +PKG_MIRROR_HASH:=f4d2e53aef57412740536fc9aea6cdcebc4b2b50461343f4eb438d507705e046 PKG_SOURCE_URL:=https://sourceware.org/git/glibc.git PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz