mirror of
https://github.com/immortalwrt/immortalwrt.git
synced 2025-08-07 22:06:25 +08:00
Merge Official Source
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
@ -447,7 +447,7 @@ find_mmc_part() {
|
||||
fi
|
||||
|
||||
for DEVNAME in /sys/block/$ROOTDEV/mmcblk*p*; do
|
||||
PARTNAME="$(grep PARTNAME ${DEVNAME}/uevent | cut -f2 -d'=')"
|
||||
PARTNAME="$(grep PARTNAME ${DEVNAME}/uevent | cut -f2 -d'=' 2>/dev/null)"
|
||||
[ "$PARTNAME" = "$1" ] && echo "/dev/$(basename $DEVNAME)" && return 0
|
||||
done
|
||||
}
|
||||
|
@ -0,0 +1,55 @@
|
||||
From 0ffd456516b5f0c126c9705d6b2368a45ee2353f Mon Sep 17 00:00:00 2001
|
||||
From: Christian Marangi <ansuelsmth@gmail.com>
|
||||
Date: Sun, 29 Jun 2025 15:21:18 +0200
|
||||
Subject: [PATCH] env: Fix possible out-of-bound access in env_do_env_set
|
||||
|
||||
It was discovered that env_do_env_set() currently suffer from a long
|
||||
time of a possible out-of-bound access for the argv array handling.
|
||||
|
||||
The BUG is present in the function env_do_env_set() line:
|
||||
|
||||
name = argv[1];
|
||||
|
||||
where the function at this point assume the argv at index 1 is always
|
||||
present and can't be NULL. Aside from the fact that it's always
|
||||
better to validate argv entry with the argc variable, situation where
|
||||
the argv[1] is NULL is actually possible and not an error condition.
|
||||
|
||||
A example of where an out-of-bound access is triggered is with the
|
||||
command "askenv - Press ENTER to ...".
|
||||
This is a common pattern for bootmenu entry to ask the user input after
|
||||
a bootmenu command succeeded.
|
||||
|
||||
In the context of such command, the while loop before "name = argv[1];"
|
||||
parse the "-" char as an option arg and increment the argv pointer by
|
||||
one (to make the rest of the logic code ignore the option argv) and
|
||||
decrement argc value.
|
||||
|
||||
The while loop logic is correct but at the "name = argv[1];" line, the
|
||||
argv have only one element left (the "-" char) and accessing argv[1]
|
||||
(aka the secong element from argv pointer) cause an out-of-bound access
|
||||
(making the bootloader eventually crash with strchr searching in invalid
|
||||
data)
|
||||
|
||||
To better handle this and prevent the out-of-bound access, actually
|
||||
check the argv entry left (with the use of the argc variable) and exit
|
||||
early before doing any kind of array access.
|
||||
|
||||
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
||||
---
|
||||
env/common.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
--- a/env/common.c
|
||||
+++ b/env/common.c
|
||||
@@ -82,6 +82,10 @@ int env_do_env_set(int flag, int argc, c
|
||||
}
|
||||
}
|
||||
debug("Final value for argc=%d\n", argc);
|
||||
+ /* Exit early if we don't have an env to apply */
|
||||
+ if (argc < 2)
|
||||
+ return 0;
|
||||
+
|
||||
name = argv[1];
|
||||
|
||||
if (strchr(name, '=')) {
|
@ -40,7 +40,7 @@ Link: https://lore.kernel.org/linux-mtd/20231002140458.147605-1-mmkurbanov@salut
|
||||
|
||||
--- /dev/null
|
||||
+++ b/drivers/mtd/nand/spi/foresee.c
|
||||
@@ -0,0 +1,97 @@
|
||||
@@ -0,0 +1,95 @@
|
||||
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
|
||||
+/*
|
||||
+ * Copyright (c) 2023, SberDevices. All Rights Reserved.
|
||||
@ -96,8 +96,6 @@ Link: https://lore.kernel.org/linux-mtd/20231002140458.147605-1-mmkurbanov@salut
|
||||
+
|
||||
+static int f35sqa002g_ecc_get_status(struct spinand_device *spinand, u8 status)
|
||||
+{
|
||||
+ struct nand_device *nand = spinand_to_nand(spinand);
|
||||
+
|
||||
+ switch (status & STATUS_ECC_MASK) {
|
||||
+ case STATUS_ECC_NO_BITFLIPS:
|
||||
+ return 0;
|
||||
|
@ -19,7 +19,7 @@ Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
|
||||
|
||||
--- a/drivers/mtd/nand/spi/foresee.c
|
||||
+++ b/drivers/mtd/nand/spi/foresee.c
|
||||
@@ -83,6 +83,16 @@ static const struct spinand_info foresee
|
||||
@@ -81,6 +81,16 @@ static const struct spinand_info foresee
|
||||
SPINAND_HAS_QE_BIT,
|
||||
SPINAND_ECCINFO(&f35sqa002g_ooblayout,
|
||||
f35sqa002g_ecc_get_status)),
|
||||
|
@ -356,7 +356,7 @@
|
||||
-CONFIG_LMB_MAX_REGIONS=64
|
||||
--- a/configs/mt7981_nor_rfb_defconfig
|
||||
+++ b/configs/mt7981_nor_rfb_defconfig
|
||||
@@ -5,37 +5,74 @@ CONFIG_ARCH_MEDIATEK=y
|
||||
@@ -5,37 +5,73 @@ CONFIG_ARCH_MEDIATEK=y
|
||||
CONFIG_TEXT_BASE=0x41e00000
|
||||
CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
CONFIG_NR_DRAM_BANKS=1
|
||||
@ -421,9 +421,8 @@
|
||||
CONFIG_ENV_OVERWRITE=y
|
||||
+CONFIG_ENV_IS_IN_MTD=y
|
||||
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
|
||||
+CONFIG_ENV_MTD_NAME="u-boot-env"
|
||||
+CONFIG_ENV_SIZE_REDUND=0x4000
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_ENV_MTD_DEV="u-boot-env"
|
||||
CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
CONFIG_NET_RANDOM_ETHADDR=y
|
||||
CONFIG_REGMAP=y
|
||||
@ -438,7 +437,7 @@
|
||||
# CONFIG_MMC is not set
|
||||
CONFIG_MTD=y
|
||||
CONFIG_DM_MTD=y
|
||||
@@ -60,9 +97,9 @@ CONFIG_PINCTRL_MT7981=y
|
||||
@@ -60,9 +96,9 @@ CONFIG_PINCTRL_MT7981=y
|
||||
CONFIG_POWER_DOMAIN=y
|
||||
CONFIG_MTK_POWER_DOMAIN=y
|
||||
CONFIG_DM_SERIAL=y
|
||||
|
@ -0,0 +1,47 @@
|
||||
From 0508c8e120d275d994e6099eb9c60bfaec0c3f5f Mon Sep 17 00:00:00 2001
|
||||
From: Shiji Yang <yangshiji66@outlook.com>
|
||||
Date: Mon, 21 Jul 2025 21:32:16 +0800
|
||||
Subject: [PATCH 1/2] env: mtd: add the missing put_mtd_device()
|
||||
|
||||
The mtd device is got in setup_mtd_device(), we must put the mtd
|
||||
device before exiting the function to update the mtd use count. This
|
||||
patch fixes the following env error:
|
||||
|
||||
> Removing MTD device #2 (u-boot-env) with use count 1
|
||||
> Error when deleting partition "u-boot-env" (-16)
|
||||
|
||||
Fixes: 03fb08d4aef8 ("env: Introduce support for MTD")
|
||||
Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
|
||||
---
|
||||
env/mtd.c | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
--- a/env/mtd.c
|
||||
+++ b/env/mtd.c
|
||||
@@ -131,6 +131,8 @@ static int env_mtd_save(void)
|
||||
puts("done\n");
|
||||
|
||||
done:
|
||||
+ put_mtd_device(mtd_env);
|
||||
+
|
||||
if (saved_buf)
|
||||
free(saved_buf);
|
||||
|
||||
@@ -188,6 +190,8 @@ static int env_mtd_load(void)
|
||||
gd->env_valid = ENV_VALID;
|
||||
|
||||
out:
|
||||
+ put_mtd_device(mtd_env);
|
||||
+
|
||||
free(buf);
|
||||
|
||||
return ret;
|
||||
@@ -280,6 +284,8 @@ static int env_mtd_erase(void)
|
||||
ret = 0;
|
||||
|
||||
done:
|
||||
+ put_mtd_device(mtd_env);
|
||||
+
|
||||
if (saved_buf)
|
||||
free(saved_buf);
|
||||
|
@ -0,0 +1,25 @@
|
||||
From 0ef932f509fd9f9215af2ea4ca2919d3285ddf60 Mon Sep 17 00:00:00 2001
|
||||
From: Shiji Yang <yangshiji66@outlook.com>
|
||||
Date: Thu, 24 Jul 2025 07:50:40 +0800
|
||||
Subject: [PATCH 2/2] env: mtd: initialize saved_buf pointer
|
||||
|
||||
When sect_size is greater than CONFIG_ENV_SIZE, this wild
|
||||
pointer will cause CPU halt or system crash.
|
||||
|
||||
Fixes: 03fb08d4aef8 ("env: Introduce support for MTD")
|
||||
Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
|
||||
---
|
||||
env/mtd.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/env/mtd.c
|
||||
+++ b/env/mtd.c
|
||||
@@ -201,7 +201,7 @@ static int env_mtd_erase(void)
|
||||
{
|
||||
struct mtd_info *mtd_env;
|
||||
u32 sect_size, sect_num;
|
||||
- char *saved_buf, *tmp;
|
||||
+ char *saved_buf = NULL, *tmp;
|
||||
struct erase_info ei;
|
||||
size_t ret_len;
|
||||
int remaining;
|
@ -1,6 +1,6 @@
|
||||
--- /dev/null
|
||||
+++ b/configs/mt7622_ubnt_unifi-6-lr-v1_defconfig
|
||||
@@ -0,0 +1,114 @@
|
||||
@@ -0,0 +1,113 @@
|
||||
+CONFIG_ARM=y
|
||||
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
|
||||
+CONFIG_POSITION_INDEPENDENT=y
|
||||
@ -56,9 +56,8 @@
|
||||
+CONFIG_CMD_MTDPARTS=y
|
||||
+CONFIG_MTDPARTS_DEFAULT="mtdparts=nor0:128k(bl2),640k(fip),64k(u-boot-env),256k(factory),64k(eeprom),15232k(recovery),-(firmware)"
|
||||
+CONFIG_ENV_IS_IN_MTD=y
|
||||
+CONFIG_ENV_MTD_NAME="nor0"
|
||||
+CONFIG_ENV_SIZE_REDUND=0x4000
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_ENV_MTD_DEV="nor0"
|
||||
+CONFIG_USE_DEFAULT_ENV_FILE=y
|
||||
+CONFIG_DEFAULT_ENV_FILE="defenvs/ubnt_unifi-6-lr_env"
|
||||
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
@ -117,7 +116,7 @@
|
||||
+CONFIG_HEXDUMP=y
|
||||
--- /dev/null
|
||||
+++ b/configs/mt7622_ubnt_unifi-6-lr-v2_defconfig
|
||||
@@ -0,0 +1,114 @@
|
||||
@@ -0,0 +1,113 @@
|
||||
+CONFIG_ARM=y
|
||||
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
|
||||
+CONFIG_POSITION_INDEPENDENT=y
|
||||
@ -173,9 +172,8 @@
|
||||
+CONFIG_CMD_MTDPARTS=y
|
||||
+CONFIG_MTDPARTS_DEFAULT="mtdparts=nor0:128k(bl2),640k(fip),64k(u-boot-env),256k(factory),64k(eeprom),15232k(recovery),-(firmware)"
|
||||
+CONFIG_ENV_IS_IN_MTD=y
|
||||
+CONFIG_ENV_MTD_NAME="nor0"
|
||||
+CONFIG_ENV_SIZE_REDUND=0x4000
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_ENV_MTD_DEV="nor0"
|
||||
+CONFIG_USE_DEFAULT_ENV_FILE=y
|
||||
+CONFIG_DEFAULT_ENV_FILE="defenvs/ubnt_unifi-6-lr-v2_env"
|
||||
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
@ -234,7 +232,7 @@
|
||||
+CONFIG_HEXDUMP=y
|
||||
--- /dev/null
|
||||
+++ b/configs/mt7622_ubnt_unifi-6-lr-v3_defconfig
|
||||
@@ -0,0 +1,113 @@
|
||||
@@ -0,0 +1,112 @@
|
||||
+CONFIG_ARM=y
|
||||
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
|
||||
+CONFIG_POSITION_INDEPENDENT=y
|
||||
@ -290,9 +288,8 @@
|
||||
+CONFIG_CMD_MTDPARTS=y
|
||||
+CONFIG_MTDPARTS_DEFAULT="mtdparts=nor0:128k(bl2),640k(fip),64k(u-boot-env),256k(factory),64k(eeprom),15232k(recovery),-(firmware)"
|
||||
+CONFIG_ENV_IS_IN_MTD=y
|
||||
+CONFIG_ENV_MTD_NAME="nor0"
|
||||
+CONFIG_ENV_SIZE_REDUND=0x4000
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_ENV_MTD_DEV="nor0"
|
||||
+CONFIG_USE_DEFAULT_ENV_FILE=y
|
||||
+CONFIG_DEFAULT_ENV_FILE="defenvs/ubnt_unifi-6-lr_env"
|
||||
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- /dev/null
|
||||
+++ b/configs/mt7621_zbtlink_zbt-wg3526-16m_defconfig
|
||||
@@ -0,0 +1,98 @@
|
||||
@@ -0,0 +1,97 @@
|
||||
+CONFIG_MIPS=y
|
||||
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
|
||||
+CONFIG_SYS_MALLOC_LEN=0x100000
|
||||
@ -64,9 +64,8 @@
|
||||
+# CONFIG_SPL_DOS_PARTITION is not set
|
||||
+# CONFIG_ISO_PARTITION is not set
|
||||
+CONFIG_ENV_IS_IN_MTD=y
|
||||
+CONFIG_ENV_MTD_NAME="nor0"
|
||||
+CONFIG_ENV_SIZE_REDUND=0x10000
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_ENV_MTD_DEV="nor0"
|
||||
+CONFIG_USE_DEFAULT_ENV_FILE=y
|
||||
+CONFIG_DEFAULT_ENV_FILE="defenvs/zbtlink_zbt-wg3526-16m_env"
|
||||
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
|
@ -140,7 +140,7 @@
|
||||
+CONFIG_HEXDUMP=y
|
||||
--- /dev/null
|
||||
+++ b/configs/mt7986a_bpi-r3-nor_defconfig
|
||||
@@ -0,0 +1,137 @@
|
||||
@@ -0,0 +1,136 @@
|
||||
+CONFIG_ARM=y
|
||||
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
|
||||
+CONFIG_POSITION_INDEPENDENT=y
|
||||
@ -213,9 +213,8 @@
|
||||
+CONFIG_ENV_OVERWRITE=y
|
||||
+CONFIG_ENV_IS_IN_MTD=y
|
||||
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
|
||||
+CONFIG_ENV_MTD_NAME="u-boot-env"
|
||||
+CONFIG_ENV_SIZE_REDUND=0x20000
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_ENV_MTD_DEV="u-boot-env"
|
||||
+CONFIG_USE_DEFAULT_ENV_FILE=y
|
||||
+CONFIG_DEFAULT_ENV_FILE="defenvs/bananapi_bpi-r3_nor_env"
|
||||
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
|
@ -253,7 +253,7 @@ Signed-off-by: Enrico Mioso <mrkiko.rs@gmail.com>
|
||||
+};
|
||||
--- /dev/null
|
||||
+++ b/configs/mt7981_gatonetworks_gdsp_defconfig
|
||||
@@ -0,0 +1,146 @@
|
||||
@@ -0,0 +1,145 @@
|
||||
+CONFIG_ARM=y
|
||||
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
|
||||
+CONFIG_POSITION_INDEPENDENT=y
|
||||
@ -341,9 +341,8 @@ Signed-off-by: Enrico Mioso <mrkiko.rs@gmail.com>
|
||||
+CONFIG_EFI_PARTITION=y
|
||||
+CONFIG_ENV_OVERWRITE=y
|
||||
+CONFIG_ENV_IS_IN_MTD=y
|
||||
+CONFIG_ENV_MTD_NAME="u-boot-env"
|
||||
+CONFIG_ENV_SIZE_REDUND=0x0
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_ENV_MTD_DEV="u-boot-env"
|
||||
+CONFIG_USE_DEFAULT_ENV_FILE=y
|
||||
+CONFIG_DEFAULT_ENV_FILE="defenvs/gatonetworks_gdsp_env"
|
||||
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
|
@ -80,7 +80,7 @@
|
||||
+CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2"
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_USE_DEFAULT_ENV_FILE=y
|
||||
+CONFIG_DEFAULT_ENV_FILE="asus_zenwifi-bt8_env"
|
||||
+CONFIG_DEFAULT_ENV_FILE="defenvs/asus_zenwifi-bt8_env"
|
||||
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
+CONFIG_VERSION_VARIABLE=y
|
||||
+CONFIG_NETCONSOLE=y
|
||||
@ -132,7 +132,7 @@
|
||||
+CONFIG_ZSTD=y
|
||||
+CONFIG_HEXDUMP=y
|
||||
--- /dev/null
|
||||
+++ b/asus_zenwifi-bt8_env
|
||||
+++ b/defenvs/asus_zenwifi-bt8_env
|
||||
@@ -0,0 +1,56 @@
|
||||
+ethaddr_factory=ubi read 0x46000000 factory && env readmem -b ethaddr 0x46000004 0x6 ; setenv ethaddr_factory
|
||||
+ipaddr=192.168.1.1
|
||||
|
@ -84,6 +84,10 @@ config MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED
|
||||
bool "MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED"
|
||||
default n
|
||||
|
||||
config MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED
|
||||
bool "MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED"
|
||||
default n
|
||||
|
||||
comment "Curves - unselect old or less-used curves to reduce binary size"
|
||||
|
||||
config MBEDTLS_ECP_DP_SECP192R1_ENABLED
|
||||
|
@ -53,6 +53,7 @@ MBEDTLS_BUILD_OPTS_CIPHERS= \
|
||||
CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED \
|
||||
CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED \
|
||||
CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED \
|
||||
CONFIG_MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED \
|
||||
CONFIG_MBEDTLS_NIST_KW_C \
|
||||
CONFIG_MBEDTLS_RIPEMD160_C \
|
||||
CONFIG_MBEDTLS_RSA_NO_CRT \
|
||||
|
@ -128,7 +128,6 @@ CONFIG_IBM_EMAC_RX_COPY_THRESHOLD=256
|
||||
CONFIG_IBM_EMAC_TAH=y
|
||||
CONFIG_IBM_EMAC_TXB=128
|
||||
# CONFIG_ICON is not set
|
||||
# CONFIG_IDPF is not set
|
||||
CONFIG_ILLEGAL_POINTER_VALUE=0
|
||||
CONFIG_IRQCHIP=y
|
||||
CONFIG_IRQ_DOMAIN=y
|
||||
@ -244,6 +243,7 @@ CONFIG_RAS=y
|
||||
CONFIG_RATIONAL=y
|
||||
CONFIG_REGULATOR=y
|
||||
CONFIG_RSEQ=y
|
||||
CONFIG_RUSTC_HAS_UNNECESSARY_TRANSMUTES=y
|
||||
# CONFIG_SAM440EP is not set
|
||||
# CONFIG_SCOM_DEBUGFS is not set
|
||||
# CONFIG_SEQUOIA is not set
|
||||
|
@ -1,3 +1,4 @@
|
||||
CONFIG_460EX=y
|
||||
CONFIG_APOLLO3G=y
|
||||
CONFIG_ATA=y
|
||||
CONFIG_BCM_NET_PHYLIB=y
|
||||
@ -16,10 +17,10 @@ CONFIG_CRYPTO_CRC32=y
|
||||
CONFIG_CRYPTO_CRC32C=y
|
||||
CONFIG_CRYPTO_MD5_PPC=y
|
||||
CONFIG_CRYPTO_SHA1_PPC=y
|
||||
+# CONFIG_DM_CRYPT is not set
|
||||
+# CONFIG_DM_INIT is not set
|
||||
+# CONFIG_DM_MIRROR is not set
|
||||
+# CONFIG_DM_SNAPSHOT is not set
|
||||
# CONFIG_DM_CRYPT is not set
|
||||
# CONFIG_DM_INIT is not set
|
||||
# CONFIG_DM_MIRROR is not set
|
||||
# CONFIG_DM_SNAPSHOT is not set
|
||||
CONFIG_EXT4_FS=y
|
||||
CONFIG_F2FS_FS=y
|
||||
CONFIG_FREEZER=y
|
||||
@ -47,6 +48,7 @@ CONFIG_PM_SLEEP=y
|
||||
CONFIG_PM_WAKELOCKS=y
|
||||
CONFIG_PM_WAKELOCKS_GC=y
|
||||
CONFIG_PM_WAKELOCKS_LIMIT=100
|
||||
CONFIG_PPC4xx_CPM=y
|
||||
CONFIG_PPC_EARLY_DEBUG=y
|
||||
# CONFIG_PPC_EARLY_DEBUG_16550 is not set
|
||||
CONFIG_PPC_EARLY_DEBUG_44x=y
|
||||
|
@ -98,8 +98,11 @@ static int mtdsplit_h3c_vfs_parse(struct mtd_info *mtd,
|
||||
if (retlen != sizeof(format_flag))
|
||||
return -EIO;
|
||||
|
||||
if (format_flag != FORMAT_FLAG)
|
||||
return -EINVAL;
|
||||
if (format_flag != FORMAT_FLAG) {
|
||||
pr_info("mtdsplit_h3c_vfs: unexpected format flag %08x\n",
|
||||
format_flag);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Check file entry */
|
||||
err = mtd_read(mtd, FILE_ENTRY_OFFSET, sizeof(file_entry), &retlen,
|
||||
@ -110,20 +113,14 @@ static int mtdsplit_h3c_vfs_parse(struct mtd_info *mtd,
|
||||
if (retlen != sizeof(file_entry))
|
||||
return -EIO;
|
||||
|
||||
if (file_entry.flags != FILE_ENTRY_FLAGS)
|
||||
return -EINVAL;
|
||||
|
||||
if (file_entry.parent_block != FILE_ENTRY_PARENT_BLOCK)
|
||||
return -EINVAL;
|
||||
|
||||
if (file_entry.parent_index != FILE_ENTRY_PARENT_INDEX)
|
||||
return -EINVAL;
|
||||
|
||||
if (file_entry.data_block != FILE_ENTRY_DATA_BLOCK)
|
||||
return -EINVAL;
|
||||
|
||||
if (strncmp(file_entry.name, FILE_ENTRY_NAME, sizeof(file_entry.name)) != 0)
|
||||
return -EINVAL;
|
||||
if (file_entry.flags != FILE_ENTRY_FLAGS ||
|
||||
file_entry.parent_block != FILE_ENTRY_PARENT_BLOCK ||
|
||||
file_entry.parent_index != FILE_ENTRY_PARENT_INDEX ||
|
||||
file_entry.data_block != FILE_ENTRY_DATA_BLOCK ||
|
||||
strncmp(file_entry.name, FILE_ENTRY_NAME, sizeof(file_entry.name)) != 0) {
|
||||
pr_info("mtdsplit_h3c_vfs: unexpected file entry - OpenWrt probably not installed\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Find rootfs offset */
|
||||
kernel_size = block_offset(file_entry.data_block +
|
||||
|
@ -1273,8 +1273,16 @@ define Device/iptime_ax3000sm
|
||||
DEVICE_MODEL := AX3000SM
|
||||
DEVICE_DTS := mt7981b-iptime-ax3000sm
|
||||
DEVICE_DTS_DIR := ../dts
|
||||
DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware
|
||||
BLOCKSIZE := 128k
|
||||
PAGESIZE := 2048
|
||||
IMAGE_SIZE := 32768k
|
||||
KERNEL := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb
|
||||
KERNEL_INITRAMFS := kernel-bin | lzma | \
|
||||
fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k
|
||||
IMAGES := factory.bin sysupgrade.bin
|
||||
IMAGE/factory.bin := sysupgrade-tar | append-metadata | check-size | iptime-crc32 ax3ksm
|
||||
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
|
||||
DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware
|
||||
SUPPORTED_DEVICES += mediatek,mt7981-spim-snand-rfb
|
||||
endef
|
||||
TARGET_DEVICES += iptime_ax3000sm
|
||||
|
@ -386,7 +386,7 @@
|
||||
};
|
||||
|
||||
&tsens {
|
||||
status = "okay ";
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&q6v5_wcss {
|
||||
|
@ -321,7 +321,7 @@
|
||||
};
|
||||
|
||||
&tsens {
|
||||
status = "okay ";
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&q6v5_wcss {
|
||||
|
275
target/linux/realtek/dts/rtl9303_hasivo_s1100w-8xgt-se.dts
Normal file
275
target/linux/realtek/dts/rtl9303_hasivo_s1100w-8xgt-se.dts
Normal file
@ -0,0 +1,275 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/dts-v1/;
|
||||
|
||||
#include "rtl930x.dtsi"
|
||||
|
||||
#include <dt-bindings/input/input.h>
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
#include <dt-bindings/leds/common.h>
|
||||
|
||||
/ {
|
||||
compatible = "hasivo,s1100w-8xgt-se", "realtek,rtl930x-soc";
|
||||
model = "Hasivo S1100W-8XGT-SE";
|
||||
|
||||
memory@0 {
|
||||
device_type = "memory";
|
||||
reg = <0x00000000 0x10000000>, /* 256 MiB lowmem */
|
||||
<0x20000000 0x10000000>; /* 256 MiB highmem */
|
||||
};
|
||||
|
||||
aliases {
|
||||
led-boot = &led_sys;
|
||||
led-failsafe = &led_sys;
|
||||
led-running = &led_sys;
|
||||
led-upgrade = &led_sys;
|
||||
};
|
||||
|
||||
chosen {
|
||||
stdout-path = "serial0:38400n8";
|
||||
};
|
||||
|
||||
keys {
|
||||
compatible = "gpio-keys";
|
||||
|
||||
button-reset {
|
||||
label = "reset";
|
||||
gpios = <&gpio0 5 GPIO_ACTIVE_LOW>;
|
||||
linux,code = <KEY_RESTART>;
|
||||
};
|
||||
};
|
||||
|
||||
leds {
|
||||
compatible = "gpio-leds";
|
||||
|
||||
led_sys: led-0 {
|
||||
gpios = <&gpio0 21 GPIO_ACTIVE_HIGH>;
|
||||
color = <LED_COLOR_ID_GREEN>;
|
||||
function = LED_FUNCTION_STATUS;
|
||||
};
|
||||
};
|
||||
|
||||
led_set {
|
||||
compatible = "realtek,rtl9300-leds";
|
||||
active-low;
|
||||
|
||||
/*
|
||||
* LED set 0
|
||||
*
|
||||
* - LED[0](Amber): 5G/LINK/ACT
|
||||
* - LED[1](Green): 10G/LINK/ACT
|
||||
* - LED[2](Amber): 1G/100M/10M/LINK/ACT
|
||||
* - LED[3](Green): 2.5G/LINK/ACT
|
||||
*/
|
||||
led_set0 = <0x0a02 0x0a01 0x0ba0 0x0a08>;
|
||||
};
|
||||
};
|
||||
|
||||
&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>;
|
||||
|
||||
/* stock is LOADER */
|
||||
partition@0 {
|
||||
label = "u-boot";
|
||||
reg = <0x0000000 0x00e0000>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
/* stock is BDINFO */
|
||||
partition@e0000 {
|
||||
label = "u-boot-env";
|
||||
reg = <0x00e0000 0x0010000>;
|
||||
};
|
||||
|
||||
/* stock is SYSINFO */
|
||||
partition@f0000 {
|
||||
label = "u-boot-env2";
|
||||
reg = <0x00f0000 0x0010000>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
/* stock is JFFS2_CFG */
|
||||
partition@100000 {
|
||||
label = "jffs";
|
||||
reg = <0x0100000 0x0100000>;
|
||||
};
|
||||
|
||||
/* stock is JFFS2_LOG */
|
||||
partition@200000 {
|
||||
label = "jffs2";
|
||||
reg = <0x0200000 0x0100000>;
|
||||
};
|
||||
|
||||
/* stock is RUNTIME */
|
||||
partition@300000 {
|
||||
compatible = "openwrt,uimage", "denx,uimage";
|
||||
label = "firmware";
|
||||
reg = <0x0300000 0x0c00000>;
|
||||
};
|
||||
|
||||
/* stock is OEMINFO */
|
||||
partition@f00000 {
|
||||
label = "oeminfo";
|
||||
reg = <0x0f00000 0x0100000>;
|
||||
read-only;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
ðernet0 {
|
||||
mdio: mdio-bus {
|
||||
compatible = "realtek,rtl838x-mdio";
|
||||
regmap = <ðernet0>;
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
phy0: ethernet-phy@0 {
|
||||
compatible = "ethernet-phy-ieee802.3-c45";
|
||||
rtl9300,smi-address = <0 0>;
|
||||
reg = <0>;
|
||||
sds = <2>;
|
||||
};
|
||||
|
||||
phy8: ethernet-phy@8 {
|
||||
compatible = "ethernet-phy-ieee802.3-c45";
|
||||
rtl9300,smi-address = <0 1>;
|
||||
reg = <8>;
|
||||
sds = <3>;
|
||||
};
|
||||
|
||||
phy16: ethernet-phy@16 {
|
||||
compatible = "ethernet-phy-ieee802.3-c45";
|
||||
rtl9300,smi-address = <0 2>;
|
||||
reg = <16>;
|
||||
sds = <4>;
|
||||
};
|
||||
|
||||
phy20: ethernet-phy@20 {
|
||||
compatible = "ethernet-phy-ieee802.3-c45";
|
||||
rtl9300,smi-address = <0 3>;
|
||||
reg = <20>;
|
||||
sds = <5>;
|
||||
};
|
||||
|
||||
phy24: ethernet-phy@24 {
|
||||
compatible = "ethernet-phy-ieee802.3-c45";
|
||||
rtl9300,smi-address = <3 16>;
|
||||
reg = <24>;
|
||||
sds = <6>;
|
||||
};
|
||||
|
||||
phy25: ethernet-phy@25 {
|
||||
compatible = "ethernet-phy-ieee802.3-c45";
|
||||
rtl9300,smi-address = <3 17>;
|
||||
reg = <25>;
|
||||
sds = <7>;
|
||||
};
|
||||
|
||||
phy26: ethernet-phy@26 {
|
||||
compatible = "ethernet-phy-ieee802.3-c45";
|
||||
rtl9300,smi-address = <3 18>;
|
||||
reg = <26>;
|
||||
sds = <8>;
|
||||
};
|
||||
|
||||
phy27: ethernet-phy@27 {
|
||||
compatible = "ethernet-phy-ieee802.3-c45";
|
||||
rtl9300,smi-address = <3 19>;
|
||||
reg = <27>;
|
||||
sds = <9>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&switch0 {
|
||||
ports {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
port@0 {
|
||||
reg = <0>;
|
||||
label = "lan1";
|
||||
phy-mode = "usxgmii";
|
||||
phy-handle = <&phy0>;
|
||||
led-set = <0>;
|
||||
};
|
||||
|
||||
port@8 {
|
||||
reg = <8>;
|
||||
label = "lan2";
|
||||
phy-mode = "usxgmii";
|
||||
phy-handle = <&phy8>;
|
||||
led-set = <0>;
|
||||
};
|
||||
|
||||
port@16 {
|
||||
reg = <16>;
|
||||
label = "lan3";
|
||||
phy-mode = "usxgmii";
|
||||
phy-handle = <&phy16>;
|
||||
led-set = <0>;
|
||||
};
|
||||
|
||||
port@20 {
|
||||
reg = <20>;
|
||||
label = "lan4";
|
||||
phy-mode = "usxgmii";
|
||||
phy-handle = <&phy20>;
|
||||
led-set = <0>;
|
||||
};
|
||||
|
||||
port@24 {
|
||||
reg = <24>;
|
||||
label = "lan5";
|
||||
phy-mode = "usxgmii";
|
||||
phy-handle = <&phy24>;
|
||||
led-set = <0>;
|
||||
};
|
||||
|
||||
port@25 {
|
||||
reg = <25>;
|
||||
label = "lan6";
|
||||
phy-mode = "usxgmii";
|
||||
phy-handle = <&phy25>;
|
||||
led-set = <0>;
|
||||
};
|
||||
|
||||
port@26 {
|
||||
reg = <26>;
|
||||
label = "lan7";
|
||||
phy-mode = "usxgmii";
|
||||
phy-handle = <&phy26>;
|
||||
led-set = <0>;
|
||||
};
|
||||
|
||||
port@27 {
|
||||
reg = <27>;
|
||||
label = "lan8";
|
||||
phy-mode = "usxgmii";
|
||||
phy-handle = <&phy27>;
|
||||
led-set = <0>;
|
||||
};
|
||||
|
||||
/* Internal SoC */
|
||||
port@28 {
|
||||
ethernet = <ðernet0>;
|
||||
reg = <28>;
|
||||
phy-mode = "internal";
|
||||
|
||||
fixed-link {
|
||||
speed = <10000>;
|
||||
full-duplex;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
388
target/linux/realtek/dts/rtl9303_vimin_vm-s100-0800ms.dts
Normal file
388
target/linux/realtek/dts/rtl9303_vimin_vm-s100-0800ms.dts
Normal file
@ -0,0 +1,388 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "rtl930x.dtsi"
|
||||
|
||||
#include <dt-bindings/input/input.h>
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
#include <dt-bindings/leds/common.h>
|
||||
|
||||
/ {
|
||||
compatible = "vimin,vm-s100-0800ms", "realtek,rtl930x-soc";
|
||||
model = "Vimin VM-S100-0800MS";
|
||||
|
||||
memory@0 {
|
||||
device_type = "memory";
|
||||
reg = <0x00000000 0x10000000>, /* first 256 MiB */
|
||||
<0x20000000 0x10000000>; /* remaining 256 MiB */
|
||||
};
|
||||
|
||||
chosen {
|
||||
stdout-path = "serial0:115200n8";
|
||||
};
|
||||
|
||||
i2c_master: i2c@1b00036c {
|
||||
compatible = "realtek,rtl9300-i2c";
|
||||
reg = <0x1b00036c 0x3c>;
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
scl-pin = <8>;
|
||||
sda-pin = <9>;
|
||||
clock-frequency = <100000>;
|
||||
};
|
||||
|
||||
i2c-mux {
|
||||
compatible = "realtek,i2c-mux-rtl9300";
|
||||
i2c-parent = <&i2c_master>;
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
i2c0: i2c@0 {
|
||||
reg = <0>;
|
||||
scl-pin = <8>;
|
||||
sda-pin = <9>;
|
||||
};
|
||||
|
||||
i2c1: i2c@1 {
|
||||
reg = <1>;
|
||||
scl-pin = <8>;
|
||||
sda-pin = <10>;
|
||||
};
|
||||
|
||||
i2c2: i2c@2 {
|
||||
reg = <2>;
|
||||
scl-pin = <8>;
|
||||
sda-pin = <11>;
|
||||
};
|
||||
|
||||
i2c3: i2c@3 {
|
||||
reg = <3>;
|
||||
scl-pin = <8>;
|
||||
sda-pin = <12>;
|
||||
};
|
||||
|
||||
i2c4: i2c@4 {
|
||||
reg = <4>;
|
||||
scl-pin = <8>;
|
||||
sda-pin = <13>;
|
||||
};
|
||||
|
||||
i2c5: i2c@5 {
|
||||
reg = <5>;
|
||||
scl-pin = <8>;
|
||||
sda-pin = <14>;
|
||||
};
|
||||
|
||||
i2c6: i2c@6 {
|
||||
reg = <6>;
|
||||
scl-pin = <8>;
|
||||
sda-pin = <15>;
|
||||
};
|
||||
|
||||
i2c7: i2c@7 {
|
||||
reg = <7>;
|
||||
scl-pin = <8>;
|
||||
sda-pin = <16>;
|
||||
};
|
||||
};
|
||||
|
||||
keys {
|
||||
compatible = "gpio-keys";
|
||||
|
||||
button-reset {
|
||||
label = "reset";
|
||||
gpios = <&gpio0 7 GPIO_ACTIVE_LOW>;
|
||||
linux,code = <KEY_RESTART>;
|
||||
};
|
||||
};
|
||||
|
||||
led_set {
|
||||
compatible = "realtek,rtl9300-leds";
|
||||
active-low;
|
||||
|
||||
/*
|
||||
* LED set 0
|
||||
*
|
||||
* - LED[0](Green): 10M/100M/1G/2.5G/5G/10G/LINK/ACT
|
||||
*/
|
||||
led_set0 = <0x0bab>;
|
||||
};
|
||||
|
||||
sfp0: sfp-p1 {
|
||||
compatible = "sff,sfp";
|
||||
i2c-bus = <&i2c0>;
|
||||
los-gpio = <&gpio1 0 GPIO_ACTIVE_HIGH>;
|
||||
mod-def0-gpio = <&gpio1 1 GPIO_ACTIVE_LOW>;
|
||||
tx-disable-gpio = <&gpio1 2 GPIO_ACTIVE_HIGH>;
|
||||
maximum-power-milliwatt = <2900>;
|
||||
#thermal-sensor-cells = <0>;
|
||||
};
|
||||
|
||||
sfp1: sfp-p2 {
|
||||
compatible = "sff,sfp";
|
||||
i2c-bus = <&i2c1>;
|
||||
los-gpio = <&gpio1 3 GPIO_ACTIVE_HIGH>;
|
||||
mod-def0-gpio = <&gpio1 4 GPIO_ACTIVE_LOW>;
|
||||
tx-disable-gpio = <&gpio1 5 GPIO_ACTIVE_HIGH>;
|
||||
maximum-power-milliwatt = <1500>;
|
||||
#thermal-sensor-cells = <0>;
|
||||
};
|
||||
|
||||
sfp2: sfp-p3 {
|
||||
compatible = "sff,sfp";
|
||||
i2c-bus = <&i2c2>;
|
||||
los-gpio = <&gpio1 6 GPIO_ACTIVE_HIGH>;
|
||||
mod-def0-gpio = <&gpio1 7 GPIO_ACTIVE_LOW>;
|
||||
tx-disable-gpio = <&gpio1 8 GPIO_ACTIVE_HIGH>;
|
||||
maximum-power-milliwatt = <1500>;
|
||||
#thermal-sensor-cells = <0>;
|
||||
};
|
||||
|
||||
sfp3: sfp-p4 {
|
||||
compatible = "sff,sfp";
|
||||
i2c-bus = <&i2c3>;
|
||||
los-gpio = <&gpio1 9 GPIO_ACTIVE_HIGH>;
|
||||
mod-def0-gpio = <&gpio1 10 GPIO_ACTIVE_LOW>;
|
||||
tx-disable-gpio = <&gpio1 11 GPIO_ACTIVE_HIGH>;
|
||||
maximum-power-milliwatt = <2000>;
|
||||
#thermal-sensor-cells = <0>;
|
||||
};
|
||||
|
||||
sfp4: sfp-p5 {
|
||||
compatible = "sff,sfp";
|
||||
i2c-bus = <&i2c4>;
|
||||
los-gpio = <&gpio1 12 GPIO_ACTIVE_HIGH>;
|
||||
mod-def0-gpio = <&gpio1 13 GPIO_ACTIVE_LOW>;
|
||||
tx-disable-gpio = <&gpio1 14 GPIO_ACTIVE_HIGH>;
|
||||
maximum-power-milliwatt = <2000>;
|
||||
#thermal-sensor-cells = <0>;
|
||||
};
|
||||
|
||||
sfp5: sfp-p6 {
|
||||
compatible = "sff,sfp";
|
||||
i2c-bus = <&i2c5>;
|
||||
los-gpio = <&gpio1 21 GPIO_ACTIVE_HIGH>;
|
||||
mod-def0-gpio = <&gpio1 22 GPIO_ACTIVE_LOW>;
|
||||
tx-disable-gpio = <&gpio1 23 GPIO_ACTIVE_HIGH>;
|
||||
maximum-power-milliwatt = <1500>;
|
||||
#thermal-sensor-cells = <0>;
|
||||
};
|
||||
|
||||
sfp6: sfp-p7 {
|
||||
compatible = "sff,sfp";
|
||||
i2c-bus = <&i2c6>;
|
||||
los-gpio = <&gpio1 24 GPIO_ACTIVE_HIGH>;
|
||||
mod-def0-gpio = <&gpio1 25 GPIO_ACTIVE_LOW>;
|
||||
tx-disable-gpio = <&gpio1 26 GPIO_ACTIVE_HIGH>;
|
||||
maximum-power-milliwatt = <1500>;
|
||||
#thermal-sensor-cells = <0>;
|
||||
};
|
||||
|
||||
sfp7: sfp-p8 {
|
||||
compatible = "sff,sfp";
|
||||
i2c-bus = <&i2c7>;
|
||||
los-gpio = <&gpio1 27 GPIO_ACTIVE_HIGH>;
|
||||
mod-def0-gpio = <&gpio1 28 GPIO_ACTIVE_LOW>;
|
||||
tx-disable-gpio = <&gpio1 29 GPIO_ACTIVE_HIGH>;
|
||||
maximum-power-milliwatt = <2900>;
|
||||
#thermal-sensor-cells = <0>;
|
||||
};
|
||||
};
|
||||
|
||||
&mdio_aux {
|
||||
status = "okay";
|
||||
|
||||
gpio1: gpio@0 {
|
||||
compatible = "realtek,rtl8231";
|
||||
reg = <0>;
|
||||
|
||||
gpio-controller;
|
||||
#gpio-cells = <2>;
|
||||
gpio-ranges = <&gpio1 0 0 37>;
|
||||
|
||||
led-controller {
|
||||
compatible = "realtek,rtl8231-leds";
|
||||
status = "disabled";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&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 = <0x0 0xe0000>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
partition@e0000 {
|
||||
label = "u-boot-env";
|
||||
reg = <0xe0000 0x10000>;
|
||||
};
|
||||
|
||||
partition@f0000 {
|
||||
label = "u-boot-env2";
|
||||
reg = <0xf0000 0x10000>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
partition@100000 {
|
||||
label = "jffs";
|
||||
reg = <0x100000 0x100000>;
|
||||
};
|
||||
|
||||
partition@200000 {
|
||||
label = "jffs2";
|
||||
reg = <0x200000 0x100000>;
|
||||
};
|
||||
|
||||
partition@300000 {
|
||||
label = "firmware";
|
||||
reg = <0x300000 0xd00000>;
|
||||
compatible = "openwrt,uimage", "denx,uimage";
|
||||
openwrt,ih-magic = <0x93000000>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
ðernet0 {
|
||||
mdio: mdio-bus {
|
||||
compatible = "realtek,rtl838x-mdio";
|
||||
regmap = <ðernet0>;
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
INTERNAL_PHY_SDS(0, 2)
|
||||
INTERNAL_PHY_SDS(8, 3)
|
||||
INTERNAL_PHY_SDS(16, 4)
|
||||
INTERNAL_PHY_SDS(20, 5)
|
||||
INTERNAL_PHY_SDS(24, 6)
|
||||
INTERNAL_PHY_SDS(25, 7)
|
||||
INTERNAL_PHY_SDS(26, 8)
|
||||
INTERNAL_PHY_SDS(27, 9)
|
||||
};
|
||||
};
|
||||
|
||||
&switch0 {
|
||||
ports {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
port@0 {
|
||||
reg = <0>;
|
||||
label = "lan1";
|
||||
pseudo-phy-handle = <&phy0>;
|
||||
phy-mode = "10gbase-r";
|
||||
sfp = <&sfp0>;
|
||||
managed = "in-band-status";
|
||||
led-set = <0>;
|
||||
};
|
||||
|
||||
port@8 {
|
||||
reg = <8>;
|
||||
label = "lan2";
|
||||
pseudo-phy-handle = <&phy8>;
|
||||
phy-mode = "10gbase-r";
|
||||
sfp = <&sfp1>;
|
||||
managed = "in-band-status";
|
||||
led-set = <0>;
|
||||
};
|
||||
|
||||
port@10 {
|
||||
reg = <16>;
|
||||
label = "lan3";
|
||||
pseudo-phy-handle = <&phy16>;
|
||||
phy-mode = "10gbase-r";
|
||||
sfp = <&sfp2>;
|
||||
managed = "in-band-status";
|
||||
led-set = <0>;
|
||||
};
|
||||
|
||||
port@14 {
|
||||
reg = <20>;
|
||||
label = "lan4";
|
||||
pseudo-phy-handle = <&phy20>;
|
||||
phy-mode = "10gbase-r";
|
||||
sfp = <&sfp3>;
|
||||
managed = "in-band-status";
|
||||
led-set = <0>;
|
||||
};
|
||||
|
||||
port@18 {
|
||||
reg = <24>;
|
||||
label = "lan5";
|
||||
pseudo-phy-handle = <&phy24>;
|
||||
phy-mode = "10gbase-r";
|
||||
sfp = <&sfp4>;
|
||||
managed = "in-band-status";
|
||||
led-set = <0>;
|
||||
};
|
||||
|
||||
port@19 {
|
||||
reg = <25>;
|
||||
label = "lan6";
|
||||
pseudo-phy-handle = <&phy25>;
|
||||
phy-mode = "10gbase-r";
|
||||
sfp = <&sfp5>;
|
||||
managed = "in-band-status";
|
||||
led-set = <0>;
|
||||
};
|
||||
|
||||
port@1a {
|
||||
reg = <26>;
|
||||
label = "lan7";
|
||||
pseudo-phy-handle = <&phy26>;
|
||||
phy-mode = "10gbase-r";
|
||||
sfp = <&sfp6>;
|
||||
managed = "in-band-status";
|
||||
led-set = <0>;
|
||||
};
|
||||
|
||||
port@1b {
|
||||
reg = <27>;
|
||||
label = "lan8";
|
||||
pseudo-phy-handle = <&phy27>;
|
||||
phy-mode = "10gbase-r";
|
||||
sfp = <&sfp7>;
|
||||
managed = "in-band-status";
|
||||
led-set = <0>;
|
||||
};
|
||||
|
||||
port@1c {
|
||||
ethernet = <ðernet0>;
|
||||
reg = <28>;
|
||||
phy-mode = "internal";
|
||||
|
||||
fixed-link {
|
||||
speed = <10000>;
|
||||
full-duplex;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&thermal_zones {
|
||||
sfp-thermal {
|
||||
polling-delay-passive = <10000>;
|
||||
polling-delay = <10000>;
|
||||
thermal-sensors = <&sfp0>, <&sfp1>, <&sfp2>, <&sfp3>, <&sfp4>, <&sfp5>, <&sfp6>, <&sfp7>;
|
||||
trips {
|
||||
sfp-crit {
|
||||
temperature = <110000>;
|
||||
hysteresis = <1000>;
|
||||
type = "critical";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
@ -16,8 +16,18 @@ static const u8 ipv6_all_hosts_mcast_addr_base[ETH_ALEN] =
|
||||
static const u8 ipv6_all_hosts_mcast_addr_mask[ETH_ALEN] =
|
||||
{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
|
||||
|
||||
/* This interval needs to be short enough to prevent an undetected counter
|
||||
* overflow. The octet counters don't need to be considered for this, because
|
||||
* they are 64 bits on all platforms. Based on the possible packets per second
|
||||
* at the highest supported speeds, an interval of a minute is probably a safe
|
||||
* choice for the other counters.
|
||||
*/
|
||||
#define RTLDSA_COUNTERS_POLL_INTERVAL (60 * HZ)
|
||||
|
||||
extern struct rtl83xx_soc_info soc_info;
|
||||
|
||||
static void rtldsa_init_counters(struct rtl838x_switch_priv *priv);
|
||||
|
||||
static void rtl83xx_init_stats(struct rtl838x_switch_priv *priv)
|
||||
{
|
||||
mutex_lock(&priv->reg_mutex);
|
||||
@ -55,53 +65,263 @@ static void rtl83xx_enable_phy_polling(struct rtl838x_switch_priv *priv)
|
||||
sw_w32_mask(0, 0x8000, RTL838X_SMI_GLB_CTRL);
|
||||
}
|
||||
|
||||
const struct rtl83xx_mib_desc rtl83xx_mib[] = {
|
||||
MIB_DESC(2, 0xf8, "ifInOctets"),
|
||||
MIB_DESC(2, 0xf0, "ifOutOctets"),
|
||||
MIB_DESC(1, 0xec, "dot1dTpPortInDiscards"),
|
||||
MIB_DESC(1, 0xe8, "ifInUcastPkts"),
|
||||
MIB_DESC(1, 0xe4, "ifInMulticastPkts"),
|
||||
MIB_DESC(1, 0xe0, "ifInBroadcastPkts"),
|
||||
MIB_DESC(1, 0xdc, "ifOutUcastPkts"),
|
||||
MIB_DESC(1, 0xd8, "ifOutMulticastPkts"),
|
||||
MIB_DESC(1, 0xd4, "ifOutBroadcastPkts"),
|
||||
MIB_DESC(1, 0xd0, "ifOutDiscards"),
|
||||
MIB_DESC(1, 0xcc, ".3SingleCollisionFrames"),
|
||||
MIB_DESC(1, 0xc8, ".3MultipleCollisionFrames"),
|
||||
MIB_DESC(1, 0xc4, ".3DeferredTransmissions"),
|
||||
MIB_DESC(1, 0xc0, ".3LateCollisions"),
|
||||
MIB_DESC(1, 0xbc, ".3ExcessiveCollisions"),
|
||||
MIB_DESC(1, 0xb8, ".3SymbolErrors"),
|
||||
MIB_DESC(1, 0xb4, ".3ControlInUnknownOpcodes"),
|
||||
MIB_DESC(1, 0xb0, ".3InPauseFrames"),
|
||||
MIB_DESC(1, 0xac, ".3OutPauseFrames"),
|
||||
MIB_DESC(1, 0xa8, "DropEvents"),
|
||||
MIB_DESC(1, 0xa4, "tx_BroadcastPkts"),
|
||||
MIB_DESC(1, 0xa0, "tx_MulticastPkts"),
|
||||
MIB_DESC(1, 0x9c, "CRCAlignErrors"),
|
||||
MIB_DESC(1, 0x98, "tx_UndersizePkts"),
|
||||
MIB_DESC(1, 0x94, "rx_UndersizePkts"),
|
||||
MIB_DESC(1, 0x90, "rx_UndersizedropPkts"),
|
||||
MIB_DESC(1, 0x8c, "tx_OversizePkts"),
|
||||
MIB_DESC(1, 0x88, "rx_OversizePkts"),
|
||||
MIB_DESC(1, 0x84, "Fragments"),
|
||||
MIB_DESC(1, 0x80, "Jabbers"),
|
||||
MIB_DESC(1, 0x7c, "Collisions"),
|
||||
MIB_DESC(1, 0x78, "tx_Pkts64Octets"),
|
||||
MIB_DESC(1, 0x74, "rx_Pkts64Octets"),
|
||||
MIB_DESC(1, 0x70, "tx_Pkts65to127Octets"),
|
||||
MIB_DESC(1, 0x6c, "rx_Pkts65to127Octets"),
|
||||
MIB_DESC(1, 0x68, "tx_Pkts128to255Octets"),
|
||||
MIB_DESC(1, 0x64, "rx_Pkts128to255Octets"),
|
||||
MIB_DESC(1, 0x60, "tx_Pkts256to511Octets"),
|
||||
MIB_DESC(1, 0x5c, "rx_Pkts256to511Octets"),
|
||||
MIB_DESC(1, 0x58, "tx_Pkts512to1023Octets"),
|
||||
MIB_DESC(1, 0x54, "rx_Pkts512to1023Octets"),
|
||||
MIB_DESC(1, 0x50, "tx_Pkts1024to1518Octets"),
|
||||
MIB_DESC(1, 0x4c, "rx_StatsPkts1024to1518Octets"),
|
||||
MIB_DESC(1, 0x48, "tx_Pkts1519toMaxOctets"),
|
||||
MIB_DESC(1, 0x44, "rx_Pkts1519toMaxOctets"),
|
||||
MIB_DESC(1, 0x40, "rxMacDiscards")
|
||||
const struct rtldsa_mib_list_item rtldsa_838x_mib_list[] = {
|
||||
MIB_LIST_ITEM("dot1dTpPortInDiscards", MIB_ITEM(MIB_REG_STD, 0xec, 1)),
|
||||
MIB_LIST_ITEM("ifOutDiscards", MIB_ITEM(MIB_REG_STD, 0xd0, 1)),
|
||||
MIB_LIST_ITEM("DropEvents", MIB_ITEM(MIB_REG_STD, 0xa8, 1)),
|
||||
MIB_LIST_ITEM("tx_BroadcastPkts", MIB_ITEM(MIB_REG_STD, 0xa4, 1)),
|
||||
MIB_LIST_ITEM("tx_MulticastPkts", MIB_ITEM(MIB_REG_STD, 0xa0, 1)),
|
||||
MIB_LIST_ITEM("tx_UndersizePkts", MIB_ITEM(MIB_REG_STD, 0x98, 1)),
|
||||
MIB_LIST_ITEM("rx_UndersizeDropPkts", MIB_ITEM(MIB_REG_STD, 0x90, 1)),
|
||||
MIB_LIST_ITEM("tx_OversizePkts", MIB_ITEM(MIB_REG_STD, 0x8c, 1)),
|
||||
MIB_LIST_ITEM("Collisions", MIB_ITEM(MIB_REG_STD, 0x7c, 1)),
|
||||
MIB_LIST_ITEM("rx_MacDiscards", MIB_ITEM(MIB_REG_STD, 0x40, 1))
|
||||
};
|
||||
|
||||
const struct rtldsa_mib_desc rtldsa_838x_mib = {
|
||||
.symbol_errors = MIB_ITEM(MIB_REG_STD, 0xb8, 1),
|
||||
|
||||
.if_in_octets = MIB_ITEM(MIB_REG_STD, 0xf8, 2),
|
||||
.if_out_octets = MIB_ITEM(MIB_REG_STD, 0xf0, 2),
|
||||
.if_in_ucast_pkts = MIB_ITEM(MIB_REG_STD, 0xe8, 1),
|
||||
.if_in_mcast_pkts = MIB_ITEM(MIB_REG_STD, 0xe4, 1),
|
||||
.if_in_bcast_pkts = MIB_ITEM(MIB_REG_STD, 0xe0, 1),
|
||||
.if_out_ucast_pkts = MIB_ITEM(MIB_REG_STD, 0xdc, 1),
|
||||
.if_out_mcast_pkts = MIB_ITEM(MIB_REG_STD, 0xd8, 1),
|
||||
.if_out_bcast_pkts = MIB_ITEM(MIB_REG_STD, 0xd4, 1),
|
||||
.if_out_discards = MIB_ITEM(MIB_REG_STD, 0xd0, 1),
|
||||
.single_collisions = MIB_ITEM(MIB_REG_STD, 0xcc, 1),
|
||||
.multiple_collisions = MIB_ITEM(MIB_REG_STD, 0xc8, 1),
|
||||
.deferred_transmissions = MIB_ITEM(MIB_REG_STD, 0xc4, 1),
|
||||
.late_collisions = MIB_ITEM(MIB_REG_STD, 0xc0, 1),
|
||||
.excessive_collisions = MIB_ITEM(MIB_REG_STD, 0xbc, 1),
|
||||
.crc_align_errors = MIB_ITEM(MIB_REG_STD, 0x9c, 1),
|
||||
|
||||
.unsupported_opcodes = MIB_ITEM(MIB_REG_STD, 0xb4, 1),
|
||||
|
||||
.rx_undersize_pkts = MIB_ITEM(MIB_REG_STD, 0x94, 1),
|
||||
.rx_oversize_pkts = MIB_ITEM(MIB_REG_STD, 0x88, 1),
|
||||
.rx_fragments = MIB_ITEM(MIB_REG_STD, 0x84, 1),
|
||||
.rx_jabbers = MIB_ITEM(MIB_REG_STD, 0x80, 1),
|
||||
|
||||
.tx_pkts = {
|
||||
MIB_ITEM(MIB_REG_STD, 0x78, 1),
|
||||
MIB_ITEM(MIB_REG_STD, 0x70, 1),
|
||||
MIB_ITEM(MIB_REG_STD, 0x68, 1),
|
||||
MIB_ITEM(MIB_REG_STD, 0x60, 1),
|
||||
MIB_ITEM(MIB_REG_STD, 0x58, 1),
|
||||
MIB_ITEM(MIB_REG_STD, 0x50, 1),
|
||||
MIB_ITEM(MIB_REG_STD, 0x48, 1)
|
||||
},
|
||||
.rx_pkts = {
|
||||
MIB_ITEM(MIB_REG_STD, 0x74, 1),
|
||||
MIB_ITEM(MIB_REG_STD, 0x6c, 1),
|
||||
MIB_ITEM(MIB_REG_STD, 0x64, 1),
|
||||
MIB_ITEM(MIB_REG_STD, 0x5c, 1),
|
||||
MIB_ITEM(MIB_REG_STD, 0x54, 1),
|
||||
MIB_ITEM(MIB_REG_STD, 0x4c, 1),
|
||||
MIB_ITEM(MIB_REG_STD, 0x44, 1)
|
||||
},
|
||||
.rmon_ranges = {
|
||||
{ 0, 64 },
|
||||
{ 65, 127 },
|
||||
{ 128, 255 },
|
||||
{ 256, 511 },
|
||||
{ 512, 1023 },
|
||||
{ 1024, 1518 },
|
||||
{ 1519, 10000 }
|
||||
},
|
||||
|
||||
.drop_events = MIB_ITEM(MIB_REG_STD, 0xa8, 1),
|
||||
.collisions = MIB_ITEM(MIB_REG_STD, 0x7c, 1),
|
||||
|
||||
.rx_pause_frames = MIB_ITEM(MIB_REG_STD, 0xb0, 1),
|
||||
.tx_pause_frames = MIB_ITEM(MIB_REG_STD, 0xac, 1),
|
||||
|
||||
.list_count = ARRAY_SIZE(rtldsa_838x_mib_list),
|
||||
.list = rtldsa_838x_mib_list
|
||||
};
|
||||
|
||||
const struct rtldsa_mib_list_item rtldsa_839x_mib_list[] = {
|
||||
MIB_LIST_ITEM("ifOutDiscards", MIB_ITEM(MIB_REG_STD, 0xd4, 1)),
|
||||
MIB_LIST_ITEM("dot1dTpPortInDiscards", MIB_ITEM(MIB_REG_STD, 0xd0, 1)),
|
||||
MIB_LIST_ITEM("DropEvents", MIB_ITEM(MIB_REG_STD, 0xa8, 1)),
|
||||
MIB_LIST_ITEM("tx_BroadcastPkts", MIB_ITEM(MIB_REG_STD, 0xa4, 1)),
|
||||
MIB_LIST_ITEM("tx_MulticastPkts", MIB_ITEM(MIB_REG_STD, 0xa0, 1)),
|
||||
MIB_LIST_ITEM("tx_UndersizePkts", MIB_ITEM(MIB_REG_STD, 0x98, 1)),
|
||||
MIB_LIST_ITEM("rx_UndersizeDropPkts", MIB_ITEM(MIB_REG_STD, 0x90, 1)),
|
||||
MIB_LIST_ITEM("tx_OversizePkts", MIB_ITEM(MIB_REG_STD, 0x8c, 1)),
|
||||
MIB_LIST_ITEM("Collisions", MIB_ITEM(MIB_REG_STD, 0x7c, 1)),
|
||||
MIB_LIST_ITEM("rx_LengthFieldError", MIB_ITEM(MIB_REG_STD, 0x40, 1)),
|
||||
MIB_LIST_ITEM("rx_FalseCarrierTimes", MIB_ITEM(MIB_REG_STD, 0x3c, 1)),
|
||||
MIB_LIST_ITEM("rx_UnderSizeOctets", MIB_ITEM(MIB_REG_STD, 0x38, 1)),
|
||||
MIB_LIST_ITEM("tx_Fragments", MIB_ITEM(MIB_REG_STD, 0x34, 1)),
|
||||
MIB_LIST_ITEM("tx_Jabbers", MIB_ITEM(MIB_REG_STD, 0x30, 1)),
|
||||
MIB_LIST_ITEM("tx_CRCAlignErrors", MIB_ITEM(MIB_REG_STD, 0x2c, 1)),
|
||||
MIB_LIST_ITEM("rx_FramingErrors", MIB_ITEM(MIB_REG_STD, 0x28, 1)),
|
||||
MIB_LIST_ITEM("rx_MacDiscards", MIB_ITEM(MIB_REG_STD, 0x24, 1))
|
||||
};
|
||||
|
||||
const struct rtldsa_mib_desc rtldsa_839x_mib = {
|
||||
.symbol_errors = MIB_ITEM(MIB_REG_STD, 0xb8, 1),
|
||||
|
||||
.if_in_octets = MIB_ITEM(MIB_REG_STD, 0xf8, 2),
|
||||
.if_out_octets = MIB_ITEM(MIB_REG_STD, 0xf0, 2),
|
||||
.if_in_ucast_pkts = MIB_ITEM(MIB_REG_STD, 0xec, 1),
|
||||
.if_in_mcast_pkts = MIB_ITEM(MIB_REG_STD, 0xe8, 1),
|
||||
.if_in_bcast_pkts = MIB_ITEM(MIB_REG_STD, 0xe4, 1),
|
||||
.if_out_ucast_pkts = MIB_ITEM(MIB_REG_STD, 0xe0, 1),
|
||||
.if_out_mcast_pkts = MIB_ITEM(MIB_REG_STD, 0xdc, 1),
|
||||
.if_out_bcast_pkts = MIB_ITEM(MIB_REG_STD, 0xd8, 1),
|
||||
.if_out_discards = MIB_ITEM(MIB_REG_STD, 0xd4, 1),
|
||||
.single_collisions = MIB_ITEM(MIB_REG_STD, 0xcc, 1),
|
||||
.multiple_collisions = MIB_ITEM(MIB_REG_STD, 0xc8, 1),
|
||||
.deferred_transmissions = MIB_ITEM(MIB_REG_STD, 0xc4, 1),
|
||||
.late_collisions = MIB_ITEM(MIB_REG_STD, 0xc0, 1),
|
||||
.excessive_collisions = MIB_ITEM(MIB_REG_STD, 0xbc, 1),
|
||||
.crc_align_errors = MIB_ITEM(MIB_REG_STD, 0x9c, 1),
|
||||
|
||||
.unsupported_opcodes = MIB_ITEM(MIB_REG_STD, 0xb4, 1),
|
||||
|
||||
.rx_undersize_pkts = MIB_ITEM(MIB_REG_STD, 0x94, 1),
|
||||
.rx_oversize_pkts = MIB_ITEM(MIB_REG_STD, 0x88, 1),
|
||||
.rx_fragments = MIB_ITEM(MIB_REG_STD, 0x84, 1),
|
||||
.rx_jabbers = MIB_ITEM(MIB_REG_STD, 0x80, 1),
|
||||
|
||||
.tx_pkts = {
|
||||
MIB_ITEM(MIB_REG_STD, 0x78, 1),
|
||||
MIB_ITEM(MIB_REG_STD, 0x70, 1),
|
||||
MIB_ITEM(MIB_REG_STD, 0x68, 1),
|
||||
MIB_ITEM(MIB_REG_STD, 0x60, 1),
|
||||
MIB_ITEM(MIB_REG_STD, 0x58, 1),
|
||||
MIB_ITEM(MIB_REG_STD, 0x50, 1),
|
||||
MIB_ITEM(MIB_REG_STD, 0x48, 1)
|
||||
},
|
||||
.rx_pkts = {
|
||||
MIB_ITEM(MIB_REG_STD, 0x74, 1),
|
||||
MIB_ITEM(MIB_REG_STD, 0x6c, 1),
|
||||
MIB_ITEM(MIB_REG_STD, 0x64, 1),
|
||||
MIB_ITEM(MIB_REG_STD, 0x5c, 1),
|
||||
MIB_ITEM(MIB_REG_STD, 0x54, 1),
|
||||
MIB_ITEM(MIB_REG_STD, 0x4c, 1),
|
||||
MIB_ITEM(MIB_REG_STD, 0x44, 1)
|
||||
},
|
||||
.rmon_ranges = {
|
||||
{ 0, 64 },
|
||||
{ 65, 127 },
|
||||
{ 128, 255 },
|
||||
{ 256, 511 },
|
||||
{ 512, 1023 },
|
||||
{ 1024, 1518 },
|
||||
{ 1519, 12288 }
|
||||
},
|
||||
|
||||
.drop_events = MIB_ITEM(MIB_REG_STD, 0xa8, 1),
|
||||
.collisions = MIB_ITEM(MIB_REG_STD, 0x7c, 1),
|
||||
|
||||
.rx_pause_frames = MIB_ITEM(MIB_REG_STD, 0xb0, 1),
|
||||
.tx_pause_frames = MIB_ITEM(MIB_REG_STD, 0xac, 1),
|
||||
|
||||
.list_count = ARRAY_SIZE(rtldsa_839x_mib_list),
|
||||
.list = rtldsa_839x_mib_list
|
||||
};
|
||||
|
||||
const struct rtldsa_mib_list_item rtldsa_930x_mib_list[] = {
|
||||
MIB_LIST_ITEM("ifOutDiscards", MIB_ITEM(MIB_REG_STD, 0xbc, 1)),
|
||||
MIB_LIST_ITEM("dot1dTpPortInDiscards", MIB_ITEM(MIB_REG_STD, 0xb8, 1)),
|
||||
MIB_LIST_ITEM("DropEvents", MIB_ITEM(MIB_REG_STD, 0x90, 1)),
|
||||
MIB_LIST_ITEM("tx_BroadcastPkts", MIB_ITEM(MIB_REG_STD, 0x8c, 1)),
|
||||
MIB_LIST_ITEM("tx_MulticastPkts", MIB_ITEM(MIB_REG_STD, 0x88, 1)),
|
||||
MIB_LIST_ITEM("tx_CRCAlignErrors", MIB_ITEM(MIB_REG_STD, 0x84, 1)),
|
||||
MIB_LIST_ITEM("tx_UndersizePkts", MIB_ITEM(MIB_REG_STD, 0x7c, 1)),
|
||||
MIB_LIST_ITEM("tx_OversizePkts", MIB_ITEM(MIB_REG_STD, 0x74, 1)),
|
||||
MIB_LIST_ITEM("tx_Fragments", MIB_ITEM(MIB_REG_STD, 0x6c, 1)),
|
||||
MIB_LIST_ITEM("tx_Jabbers", MIB_ITEM(MIB_REG_STD, 0x64, 1)),
|
||||
MIB_LIST_ITEM("tx_Collisions", MIB_ITEM(MIB_REG_STD, 0x5c, 1)),
|
||||
MIB_LIST_ITEM("rx_UndersizeDropPkts", MIB_ITEM(MIB_REG_PRV, 0x7c, 1)),
|
||||
MIB_LIST_ITEM("tx_PktsFlexibleOctetsSet1", MIB_ITEM(MIB_REG_PRV, 0x68, 1)),
|
||||
MIB_LIST_ITEM("rx_PktsFlexibleOctetsSet1", MIB_ITEM(MIB_REG_PRV, 0x64, 1)),
|
||||
MIB_LIST_ITEM("tx_PktsFlexibleOctetsCRCSet1", MIB_ITEM(MIB_REG_PRV, 0x60, 1)),
|
||||
MIB_LIST_ITEM("rx_PktsFlexibleOctetsCRCSet1", MIB_ITEM(MIB_REG_PRV, 0x5c, 1)),
|
||||
MIB_LIST_ITEM("tx_PktsFlexibleOctetsSet0", MIB_ITEM(MIB_REG_PRV, 0x58, 1)),
|
||||
MIB_LIST_ITEM("rx_PktsFlexibleOctetsSet0", MIB_ITEM(MIB_REG_PRV, 0x54, 1)),
|
||||
MIB_LIST_ITEM("tx_PktsFlexibleOctetsCRCSet0", MIB_ITEM(MIB_REG_PRV, 0x50, 1)),
|
||||
MIB_LIST_ITEM("rx_PktsFlexibleOctetsCRCSet0", MIB_ITEM(MIB_REG_PRV, 0x4c, 1)),
|
||||
MIB_LIST_ITEM("LengthFieldError", MIB_ITEM(MIB_REG_PRV, 0x48, 1)),
|
||||
MIB_LIST_ITEM("FalseCarrierTimes", MIB_ITEM(MIB_REG_PRV, 0x44, 1)),
|
||||
MIB_LIST_ITEM("UndersizeOctets", MIB_ITEM(MIB_REG_PRV, 0x40, 1)),
|
||||
MIB_LIST_ITEM("FramingErrors", MIB_ITEM(MIB_REG_PRV, 0x3c, 1)),
|
||||
MIB_LIST_ITEM("ParserErrors", MIB_ITEM(MIB_REG_PRV, 0x38, 1)),
|
||||
MIB_LIST_ITEM("rx_MacDiscards", MIB_ITEM(MIB_REG_PRV, 0x34, 1)),
|
||||
MIB_LIST_ITEM("rx_MacIPGShortDrop", MIB_ITEM(MIB_REG_PRV, 0x30, 1))
|
||||
};
|
||||
|
||||
const struct rtldsa_mib_desc rtldsa_930x_mib = {
|
||||
.symbol_errors = MIB_ITEM(MIB_REG_STD, 0xa0, 1),
|
||||
|
||||
.if_in_octets = MIB_ITEM(MIB_REG_STD, 0xf8, 2),
|
||||
.if_out_octets = MIB_ITEM(MIB_REG_STD, 0xf0, 2),
|
||||
.if_in_ucast_pkts = MIB_ITEM(MIB_REG_STD, 0xe8, 2),
|
||||
.if_in_mcast_pkts = MIB_ITEM(MIB_REG_STD, 0xe0, 2),
|
||||
.if_in_bcast_pkts = MIB_ITEM(MIB_REG_STD, 0xd8, 2),
|
||||
.if_out_ucast_pkts = MIB_ITEM(MIB_REG_STD, 0xd0, 2),
|
||||
.if_out_mcast_pkts = MIB_ITEM(MIB_REG_STD, 0xc8, 2),
|
||||
.if_out_bcast_pkts = MIB_ITEM(MIB_REG_STD, 0xc0, 2),
|
||||
.if_out_discards = MIB_ITEM(MIB_REG_STD, 0xbc, 1),
|
||||
.single_collisions = MIB_ITEM(MIB_REG_STD, 0xb4, 1),
|
||||
.multiple_collisions = MIB_ITEM(MIB_REG_STD, 0xb0, 1),
|
||||
.deferred_transmissions = MIB_ITEM(MIB_REG_STD, 0xac, 1),
|
||||
.late_collisions = MIB_ITEM(MIB_REG_STD, 0xa8, 1),
|
||||
.excessive_collisions = MIB_ITEM(MIB_REG_STD, 0xa4, 1),
|
||||
.crc_align_errors = MIB_ITEM(MIB_REG_STD, 0x80, 1),
|
||||
.rx_pkts_over_max_octets = MIB_ITEM(MIB_REG_PRV, 0x6c, 1),
|
||||
|
||||
.unsupported_opcodes = MIB_ITEM(MIB_REG_STD, 0x9c, 1),
|
||||
|
||||
.rx_undersize_pkts = MIB_ITEM(MIB_REG_STD, 0x78, 1),
|
||||
.rx_oversize_pkts = MIB_ITEM(MIB_REG_STD, 0x70, 1),
|
||||
.rx_fragments = MIB_ITEM(MIB_REG_STD, 0x68, 1),
|
||||
.rx_jabbers = MIB_ITEM(MIB_REG_STD, 0x60, 1),
|
||||
|
||||
.tx_pkts = {
|
||||
MIB_ITEM(MIB_REG_STD, 0x58, 1),
|
||||
MIB_ITEM(MIB_REG_STD, 0x50, 1),
|
||||
MIB_ITEM(MIB_REG_STD, 0x48, 1),
|
||||
MIB_ITEM(MIB_REG_STD, 0x40, 1),
|
||||
MIB_ITEM(MIB_REG_STD, 0x38, 1),
|
||||
MIB_ITEM(MIB_REG_STD, 0x30, 1),
|
||||
MIB_ITEM(MIB_REG_PRV, 0x78, 1),
|
||||
MIB_ITEM(MIB_REG_PRV, 0x70, 1)
|
||||
},
|
||||
.rx_pkts = {
|
||||
MIB_ITEM(MIB_REG_STD, 0x54, 1),
|
||||
MIB_ITEM(MIB_REG_STD, 0x4c, 1),
|
||||
MIB_ITEM(MIB_REG_STD, 0x44, 1),
|
||||
MIB_ITEM(MIB_REG_STD, 0x3c, 1),
|
||||
MIB_ITEM(MIB_REG_STD, 0x34, 1),
|
||||
MIB_ITEM(MIB_REG_STD, 0x2c, 1),
|
||||
MIB_ITEM(MIB_REG_PRV, 0x74, 1),
|
||||
MIB_ITEM(MIB_REG_PRV, 0x6c, 1),
|
||||
},
|
||||
.rmon_ranges = {
|
||||
{ 0, 64 },
|
||||
{ 65, 127 },
|
||||
{ 128, 255 },
|
||||
{ 256, 511 },
|
||||
{ 512, 1023 },
|
||||
{ 1024, 1518 },
|
||||
{ 1519, 12288 },
|
||||
{ 12289, 65535 }
|
||||
},
|
||||
|
||||
.drop_events = MIB_ITEM(MIB_REG_STD, 0x90, 1),
|
||||
.collisions = MIB_ITEM(MIB_REG_STD, 0x5c, 1),
|
||||
|
||||
.rx_pause_frames = MIB_ITEM(MIB_REG_STD, 0x98, 1),
|
||||
.tx_pause_frames = MIB_ITEM(MIB_REG_STD, 0x94, 1),
|
||||
|
||||
.list_count = ARRAY_SIZE(rtldsa_930x_mib_list),
|
||||
.list = rtldsa_930x_mib_list
|
||||
};
|
||||
|
||||
|
||||
@ -237,6 +457,7 @@ static int rtl83xx_setup(struct dsa_switch *ds)
|
||||
rtl839x_print_matrix();
|
||||
|
||||
rtl83xx_init_stats(priv);
|
||||
rtldsa_init_counters(priv);
|
||||
|
||||
rtl83xx_vlan_setup(priv);
|
||||
|
||||
@ -301,6 +522,7 @@ static int rtl93xx_setup(struct dsa_switch *ds)
|
||||
rtl930x_print_matrix();
|
||||
|
||||
/* TODO: Initialize statistics */
|
||||
rtldsa_init_counters(priv);
|
||||
|
||||
rtl83xx_vlan_setup(priv);
|
||||
|
||||
@ -836,40 +1058,475 @@ static void rtl93xx_phylink_mac_link_up(struct dsa_switch *ds, int port,
|
||||
sw_w32_mask(0, 0x3, priv->r->mac_port_ctrl(port));
|
||||
}
|
||||
|
||||
static void rtl83xx_get_strings(struct dsa_switch *ds,
|
||||
int port, u32 stringset, u8 *data)
|
||||
static const struct rtldsa_mib_desc *rtldsa_get_mib_desc(struct rtl838x_switch_priv *priv)
|
||||
{
|
||||
if (stringset != ETH_SS_STATS)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < ARRAY_SIZE(rtl83xx_mib); i++)
|
||||
ethtool_puts(&data, rtl83xx_mib[i].name);
|
||||
}
|
||||
|
||||
static void rtl83xx_get_ethtool_stats(struct dsa_switch *ds, int port,
|
||||
uint64_t *data)
|
||||
{
|
||||
struct rtl838x_switch_priv *priv = ds->priv;
|
||||
const struct rtl83xx_mib_desc *mib;
|
||||
u64 h;
|
||||
|
||||
for (int i = 0; i < ARRAY_SIZE(rtl83xx_mib); i++) {
|
||||
mib = &rtl83xx_mib[i];
|
||||
|
||||
data[i] = sw_r32(priv->r->stat_port_std_mib + (port << 8) + 252 - mib->offset);
|
||||
if (mib->size == 2) {
|
||||
h = sw_r32(priv->r->stat_port_std_mib + (port << 8) + 248 - mib->offset);
|
||||
data[i] |= h << 32;
|
||||
}
|
||||
switch (priv->family_id) {
|
||||
case RTL8380_FAMILY_ID:
|
||||
return &rtldsa_838x_mib;
|
||||
case RTL8390_FAMILY_ID:
|
||||
return &rtldsa_839x_mib;
|
||||
case RTL9300_FAMILY_ID:
|
||||
return &rtldsa_930x_mib;
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static int rtl83xx_get_sset_count(struct dsa_switch *ds, int port, int sset)
|
||||
static bool rtldsa_read_mib_item(struct rtl838x_switch_priv *priv, int port,
|
||||
const struct rtldsa_mib_item *mib_item,
|
||||
uint64_t *data)
|
||||
{
|
||||
uint32_t high1, high2;
|
||||
int reg, reg_offset, addr_low;
|
||||
|
||||
switch (mib_item->reg) {
|
||||
case MIB_REG_STD:
|
||||
reg = priv->r->stat_port_std_mib;
|
||||
reg_offset = 256;
|
||||
break;
|
||||
case MIB_REG_PRV:
|
||||
reg = priv->r->stat_port_prv_mib;
|
||||
reg_offset = 128;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
addr_low = reg + (port + 1) * reg_offset - 4 - mib_item->offset;
|
||||
|
||||
if (mib_item->size == 2) {
|
||||
high1 = sw_r32(addr_low - 4);
|
||||
*data = sw_r32(addr_low);
|
||||
high2 = sw_r32(addr_low - 4);
|
||||
if (high1 != high2) {
|
||||
/* Low must have wrapped and overflowed into high, read again */
|
||||
*data = sw_r32(addr_low);
|
||||
}
|
||||
*data |= (uint64_t)high2 << 32;
|
||||
} else {
|
||||
*data = sw_r32(addr_low);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void rtldsa_update_counter(struct rtl838x_switch_priv *priv, int port,
|
||||
struct rtldsa_counter *counter,
|
||||
const struct rtldsa_mib_item *mib_item)
|
||||
{
|
||||
uint64_t val;
|
||||
uint32_t val32, diff;
|
||||
|
||||
if (!rtldsa_read_mib_item(priv, port, mib_item, &val))
|
||||
return;
|
||||
|
||||
if (mib_item->size == 2) {
|
||||
counter->val = val;
|
||||
} else {
|
||||
val32 = (uint32_t)val;
|
||||
diff = val32 - counter->last;
|
||||
counter->val += diff;
|
||||
counter->last = val32;
|
||||
}
|
||||
}
|
||||
|
||||
static void rtldsa_update_port_counters(struct rtl838x_switch_priv *priv, int port)
|
||||
{
|
||||
struct rtldsa_counter_state *counters = &priv->ports[port].counters;
|
||||
const struct rtldsa_mib_desc *mib_desc;
|
||||
ktime_t now;
|
||||
|
||||
mib_desc = rtldsa_get_mib_desc(priv);
|
||||
if (!mib_desc)
|
||||
return;
|
||||
|
||||
/* Prevent unnecessary updates when the user accesses different stats quickly.
|
||||
* This compensates a bit for always updating all stats, even when just a
|
||||
* subset is actually requested.
|
||||
*/
|
||||
now = ktime_get();
|
||||
if (ktime_before(now, ktime_add_ms(counters->last_update, 100)))
|
||||
return;
|
||||
counters->last_update = now;
|
||||
|
||||
rtldsa_update_counter(priv, port, &counters->symbol_errors,
|
||||
&mib_desc->symbol_errors);
|
||||
|
||||
rtldsa_update_counter(priv, port, &counters->if_in_octets,
|
||||
&mib_desc->if_in_octets);
|
||||
rtldsa_update_counter(priv, port, &counters->if_out_octets,
|
||||
&mib_desc->if_out_octets);
|
||||
rtldsa_update_counter(priv, port, &counters->if_in_ucast_pkts,
|
||||
&mib_desc->if_in_ucast_pkts);
|
||||
rtldsa_update_counter(priv, port, &counters->if_in_mcast_pkts,
|
||||
&mib_desc->if_in_mcast_pkts);
|
||||
rtldsa_update_counter(priv, port, &counters->if_in_bcast_pkts,
|
||||
&mib_desc->if_in_bcast_pkts);
|
||||
rtldsa_update_counter(priv, port, &counters->if_out_ucast_pkts,
|
||||
&mib_desc->if_out_ucast_pkts);
|
||||
rtldsa_update_counter(priv, port, &counters->if_out_mcast_pkts,
|
||||
&mib_desc->if_out_mcast_pkts);
|
||||
rtldsa_update_counter(priv, port, &counters->if_out_bcast_pkts,
|
||||
&mib_desc->if_out_bcast_pkts);
|
||||
rtldsa_update_counter(priv, port, &counters->if_out_discards,
|
||||
&mib_desc->if_out_discards);
|
||||
rtldsa_update_counter(priv, port, &counters->single_collisions,
|
||||
&mib_desc->single_collisions);
|
||||
rtldsa_update_counter(priv, port, &counters->multiple_collisions,
|
||||
&mib_desc->multiple_collisions);
|
||||
rtldsa_update_counter(priv, port, &counters->deferred_transmissions,
|
||||
&mib_desc->deferred_transmissions);
|
||||
rtldsa_update_counter(priv, port, &counters->late_collisions,
|
||||
&mib_desc->late_collisions);
|
||||
rtldsa_update_counter(priv, port, &counters->excessive_collisions,
|
||||
&mib_desc->excessive_collisions);
|
||||
rtldsa_update_counter(priv, port, &counters->crc_align_errors,
|
||||
&mib_desc->crc_align_errors);
|
||||
rtldsa_update_counter(priv, port, &counters->rx_pkts_over_max_octets,
|
||||
&mib_desc->rx_pkts_over_max_octets);
|
||||
|
||||
rtldsa_update_counter(priv, port, &counters->unsupported_opcodes,
|
||||
&mib_desc->unsupported_opcodes);
|
||||
|
||||
rtldsa_update_counter(priv, port, &counters->rx_undersize_pkts,
|
||||
&mib_desc->rx_undersize_pkts);
|
||||
rtldsa_update_counter(priv, port, &counters->rx_oversize_pkts,
|
||||
&mib_desc->rx_oversize_pkts);
|
||||
rtldsa_update_counter(priv, port, &counters->rx_fragments,
|
||||
&mib_desc->rx_fragments);
|
||||
rtldsa_update_counter(priv, port, &counters->rx_jabbers,
|
||||
&mib_desc->rx_jabbers);
|
||||
|
||||
for (int i = 0; i < ARRAY_SIZE(mib_desc->tx_pkts); i++) {
|
||||
if (mib_desc->tx_pkts[i].reg == MIB_REG_INVALID)
|
||||
break;
|
||||
|
||||
rtldsa_update_counter(priv, port, &counters->tx_pkts[i],
|
||||
&mib_desc->tx_pkts[i]);
|
||||
}
|
||||
for (int i = 0; i < ARRAY_SIZE(mib_desc->rx_pkts); i++) {
|
||||
if (mib_desc->rx_pkts[i].reg == MIB_REG_INVALID)
|
||||
break;
|
||||
|
||||
rtldsa_update_counter(priv, port, &counters->rx_pkts[i],
|
||||
&mib_desc->rx_pkts[i]);
|
||||
}
|
||||
|
||||
rtldsa_update_counter(priv, port, &counters->drop_events,
|
||||
&mib_desc->drop_events);
|
||||
rtldsa_update_counter(priv, port, &counters->collisions,
|
||||
&mib_desc->collisions);
|
||||
|
||||
rtldsa_update_counter(priv, port, &counters->rx_pause_frames,
|
||||
&mib_desc->rx_pause_frames);
|
||||
rtldsa_update_counter(priv, port, &counters->tx_pause_frames,
|
||||
&mib_desc->tx_pause_frames);
|
||||
}
|
||||
|
||||
static void rtldsa_poll_counters(struct work_struct *work)
|
||||
{
|
||||
struct rtl838x_switch_priv *priv = container_of(to_delayed_work(work),
|
||||
struct rtl838x_switch_priv,
|
||||
counters_work);
|
||||
struct rtldsa_counter_state *counters;
|
||||
|
||||
for (int i = 0; i < priv->cpu_port; i++) {
|
||||
if (!priv->ports[i].phy)
|
||||
continue;
|
||||
|
||||
counters = &priv->ports[i].counters;
|
||||
|
||||
spin_lock(&counters->lock);
|
||||
rtldsa_update_port_counters(priv, i);
|
||||
spin_unlock(&counters->lock);
|
||||
}
|
||||
|
||||
schedule_delayed_work(&priv->counters_work, RTLDSA_COUNTERS_POLL_INTERVAL);
|
||||
}
|
||||
|
||||
static void rtldsa_init_counters(struct rtl838x_switch_priv *priv)
|
||||
{
|
||||
struct rtldsa_counter_state *counters;
|
||||
|
||||
for (int i = 0; i < priv->cpu_port; i++) {
|
||||
if (!priv->ports[i].phy)
|
||||
continue;
|
||||
|
||||
counters = &priv->ports[i].counters;
|
||||
|
||||
memset(counters, 0, sizeof(*counters));
|
||||
spin_lock_init(&counters->lock);
|
||||
}
|
||||
|
||||
INIT_DELAYED_WORK(&priv->counters_work, rtldsa_poll_counters);
|
||||
schedule_delayed_work(&priv->counters_work, RTLDSA_COUNTERS_POLL_INTERVAL);
|
||||
}
|
||||
|
||||
static void rtldsa_get_strings(struct dsa_switch *ds,
|
||||
int port, u32 stringset, u8 *data)
|
||||
{
|
||||
struct rtl838x_switch_priv *priv = ds->priv;
|
||||
const struct rtldsa_mib_desc *mib_desc;
|
||||
|
||||
if (stringset != ETH_SS_STATS)
|
||||
return;
|
||||
|
||||
if (port < 0 || port >= priv->cpu_port)
|
||||
return;
|
||||
|
||||
mib_desc = rtldsa_get_mib_desc(priv);
|
||||
if (!mib_desc)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < mib_desc->list_count; i++)
|
||||
ethtool_puts(&data, mib_desc->list[i].name);
|
||||
}
|
||||
|
||||
static void rtldsa_get_ethtool_stats(struct dsa_switch *ds, int port,
|
||||
uint64_t *data)
|
||||
{
|
||||
struct rtl838x_switch_priv *priv = ds->priv;
|
||||
const struct rtldsa_mib_desc *mib_desc;
|
||||
const struct rtldsa_mib_item *mib_item;
|
||||
|
||||
if (port < 0 || port >= priv->cpu_port)
|
||||
return;
|
||||
|
||||
mib_desc = rtldsa_get_mib_desc(priv);
|
||||
if (!mib_desc)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < mib_desc->list_count; i++) {
|
||||
mib_item = &mib_desc->list[i].item;
|
||||
rtldsa_read_mib_item(priv, port, mib_item, &data[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static int rtldsa_get_sset_count(struct dsa_switch *ds, int port, int sset)
|
||||
{
|
||||
struct rtl838x_switch_priv *priv = ds->priv;
|
||||
const struct rtldsa_mib_desc *mib_desc;
|
||||
|
||||
if (sset != ETH_SS_STATS)
|
||||
return 0;
|
||||
|
||||
return ARRAY_SIZE(rtl83xx_mib);
|
||||
if (port < 0 || port >= priv->cpu_port)
|
||||
return 0;
|
||||
|
||||
mib_desc = rtldsa_get_mib_desc(priv);
|
||||
if (!mib_desc)
|
||||
return 0;
|
||||
|
||||
return mib_desc->list_count;
|
||||
}
|
||||
|
||||
|
||||
static void rtldsa_get_eth_phy_stats(struct dsa_switch *ds, int port,
|
||||
struct ethtool_eth_phy_stats *phy_stats)
|
||||
{
|
||||
struct rtl838x_switch_priv *priv = ds->priv;
|
||||
struct rtldsa_counter_state *counters = &priv->ports[port].counters;
|
||||
|
||||
if (port < 0 || port >= priv->cpu_port)
|
||||
return;
|
||||
|
||||
if (!rtldsa_get_mib_desc(priv))
|
||||
return;
|
||||
|
||||
spin_lock(&counters->lock);
|
||||
|
||||
rtldsa_update_port_counters(priv, port);
|
||||
|
||||
phy_stats->SymbolErrorDuringCarrier = counters->symbol_errors.val;
|
||||
|
||||
spin_unlock(&counters->lock);
|
||||
}
|
||||
|
||||
static void rtldsa_get_eth_mac_stats(struct dsa_switch *ds, int port,
|
||||
struct ethtool_eth_mac_stats *mac_stats)
|
||||
{
|
||||
struct rtl838x_switch_priv *priv = ds->priv;
|
||||
struct rtldsa_counter_state *counters = &priv->ports[port].counters;
|
||||
|
||||
if (port < 0 || port >= priv->cpu_port)
|
||||
return;
|
||||
|
||||
if (!rtldsa_get_mib_desc(priv))
|
||||
return;
|
||||
|
||||
spin_lock(&counters->lock);
|
||||
|
||||
rtldsa_update_port_counters(priv, port);
|
||||
|
||||
/* Frame and octet counters are calculated based on RFC3635, while also
|
||||
* taking into account that the behaviour of the hardware counters differs
|
||||
* in some places.
|
||||
*/
|
||||
|
||||
mac_stats->FramesReceivedOK = counters->if_in_ucast_pkts.val +
|
||||
counters->if_in_mcast_pkts.val +
|
||||
counters->if_in_bcast_pkts.val +
|
||||
counters->rx_pause_frames.val +
|
||||
counters->rx_pkts_over_max_octets.val;
|
||||
|
||||
mac_stats->FramesTransmittedOK = counters->if_out_ucast_pkts.val +
|
||||
counters->if_out_mcast_pkts.val +
|
||||
counters->if_out_bcast_pkts.val +
|
||||
counters->tx_pause_frames.val -
|
||||
counters->if_out_discards.val;
|
||||
|
||||
mac_stats->OctetsReceivedOK = counters->if_in_octets.val -
|
||||
18 * mac_stats->FramesReceivedOK;
|
||||
mac_stats->OctetsTransmittedOK = counters->if_out_octets.val -
|
||||
18 * mac_stats->FramesTransmittedOK;
|
||||
|
||||
mac_stats->SingleCollisionFrames = counters->single_collisions.val;
|
||||
mac_stats->MultipleCollisionFrames = counters->multiple_collisions.val;
|
||||
mac_stats->FramesWithDeferredXmissions = counters->deferred_transmissions.val;
|
||||
mac_stats->LateCollisions = counters->late_collisions.val;
|
||||
mac_stats->FramesAbortedDueToXSColls = counters->excessive_collisions.val;
|
||||
|
||||
mac_stats->FrameCheckSequenceErrors = counters->crc_align_errors.val;
|
||||
|
||||
spin_unlock(&counters->lock);
|
||||
}
|
||||
|
||||
static void rtldsa_get_eth_ctrl_stats(struct dsa_switch *ds, int port,
|
||||
struct ethtool_eth_ctrl_stats *ctrl_stats)
|
||||
{
|
||||
struct rtl838x_switch_priv *priv = ds->priv;
|
||||
struct rtldsa_counter_state *counters = &priv->ports[port].counters;
|
||||
|
||||
if (port < 0 || port >= priv->cpu_port)
|
||||
return;
|
||||
|
||||
if (!rtldsa_get_mib_desc(priv))
|
||||
return;
|
||||
|
||||
spin_lock(&counters->lock);
|
||||
|
||||
rtldsa_update_port_counters(priv, port);
|
||||
|
||||
ctrl_stats->UnsupportedOpcodesReceived = counters->unsupported_opcodes.val;
|
||||
|
||||
spin_unlock(&counters->lock);
|
||||
}
|
||||
|
||||
static void rtldsa_get_rmon_stats(struct dsa_switch *ds, int port,
|
||||
struct ethtool_rmon_stats *rmon_stats,
|
||||
const struct ethtool_rmon_hist_range **ranges)
|
||||
{
|
||||
struct rtl838x_switch_priv *priv = ds->priv;
|
||||
const struct rtldsa_mib_desc *mib_desc;
|
||||
struct rtldsa_counter_state *counters = &priv->ports[port].counters;
|
||||
|
||||
if (port < 0 || port >= priv->cpu_port)
|
||||
return;
|
||||
|
||||
mib_desc = rtldsa_get_mib_desc(priv);
|
||||
if (!mib_desc)
|
||||
return;
|
||||
|
||||
spin_lock(&counters->lock);
|
||||
|
||||
rtldsa_update_port_counters(priv, port);
|
||||
|
||||
rmon_stats->undersize_pkts = counters->rx_undersize_pkts.val;
|
||||
rmon_stats->oversize_pkts = counters->rx_oversize_pkts.val;
|
||||
rmon_stats->fragments = counters->rx_fragments.val;
|
||||
rmon_stats->jabbers = counters->rx_jabbers.val;
|
||||
|
||||
for (int i = 0; i < ARRAY_SIZE(mib_desc->rx_pkts); i++) {
|
||||
if (mib_desc->rx_pkts[i].reg == MIB_REG_INVALID)
|
||||
break;
|
||||
|
||||
rmon_stats->hist[i] = counters->rx_pkts[i].val;
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < ARRAY_SIZE(mib_desc->tx_pkts); i++) {
|
||||
if (mib_desc->tx_pkts[i].reg == MIB_REG_INVALID)
|
||||
break;
|
||||
|
||||
rmon_stats->hist_tx[i] = counters->tx_pkts[i].val;
|
||||
}
|
||||
|
||||
*ranges = mib_desc->rmon_ranges;
|
||||
|
||||
spin_unlock(&counters->lock);
|
||||
}
|
||||
|
||||
static void rtldsa_get_stats64(struct dsa_switch *ds, int port,
|
||||
struct rtnl_link_stats64 *s)
|
||||
{
|
||||
struct rtl838x_switch_priv *priv = ds->priv;
|
||||
struct rtldsa_counter_state *counters = &priv->ports[port].counters;
|
||||
|
||||
if (port < 0 || port >= priv->cpu_port)
|
||||
return;
|
||||
|
||||
if (!rtldsa_get_mib_desc(priv)) {
|
||||
dev_get_tstats64(dsa_to_port(ds, port)->user, s);
|
||||
return;
|
||||
}
|
||||
|
||||
spin_lock(&counters->lock);
|
||||
|
||||
rtldsa_update_port_counters(priv, port);
|
||||
|
||||
s->rx_packets = counters->if_in_ucast_pkts.val +
|
||||
counters->if_in_mcast_pkts.val +
|
||||
counters->if_in_bcast_pkts.val +
|
||||
counters->rx_pkts_over_max_octets.val;
|
||||
|
||||
s->tx_packets = counters->if_out_ucast_pkts.val +
|
||||
counters->if_out_mcast_pkts.val +
|
||||
counters->if_out_bcast_pkts.val -
|
||||
counters->if_out_discards.val;
|
||||
|
||||
/* Subtract FCS for each packet, and pause frames */
|
||||
s->rx_bytes = counters->if_in_octets.val -
|
||||
4 * s->rx_packets -
|
||||
64 * counters->rx_pause_frames.val;
|
||||
s->tx_bytes = counters->if_out_octets.val -
|
||||
4 * s->tx_packets -
|
||||
64 * counters->tx_pause_frames.val;
|
||||
|
||||
s->collisions = counters->collisions.val;
|
||||
|
||||
s->rx_dropped = counters->drop_events.val;
|
||||
s->tx_dropped = counters->if_out_discards.val;
|
||||
|
||||
s->rx_crc_errors = counters->crc_align_errors.val;
|
||||
s->rx_errors = s->rx_crc_errors;
|
||||
|
||||
s->tx_aborted_errors = counters->excessive_collisions.val;
|
||||
s->tx_window_errors = counters->late_collisions.val;
|
||||
s->tx_errors = s->tx_aborted_errors + s->tx_window_errors;
|
||||
|
||||
spin_unlock(&counters->lock);
|
||||
}
|
||||
|
||||
static void rtldsa_get_pause_stats(struct dsa_switch *ds, int port,
|
||||
struct ethtool_pause_stats *pause_stats)
|
||||
{
|
||||
struct rtl838x_switch_priv *priv = ds->priv;
|
||||
struct rtldsa_counter_state *counters = &priv->ports[port].counters;
|
||||
|
||||
if (port < 0 || port >= priv->cpu_port)
|
||||
return;
|
||||
|
||||
if (!rtldsa_get_mib_desc(priv))
|
||||
return;
|
||||
|
||||
spin_lock(&counters->lock);
|
||||
|
||||
rtldsa_update_port_counters(priv, port);
|
||||
|
||||
pause_stats->tx_pause_frames = counters->tx_pause_frames.val;
|
||||
pause_stats->rx_pause_frames = counters->rx_pause_frames.val;
|
||||
|
||||
spin_unlock(&counters->lock);
|
||||
}
|
||||
|
||||
static int rtl83xx_mc_group_alloc(struct rtl838x_switch_priv *priv, int port)
|
||||
@ -2068,9 +2725,15 @@ const struct dsa_switch_ops rtl83xx_switch_ops = {
|
||||
.phylink_mac_link_up = rtl83xx_phylink_mac_link_up,
|
||||
.phylink_mac_select_pcs = rtl83xx_phylink_mac_select_pcs,
|
||||
|
||||
.get_strings = rtl83xx_get_strings,
|
||||
.get_ethtool_stats = rtl83xx_get_ethtool_stats,
|
||||
.get_sset_count = rtl83xx_get_sset_count,
|
||||
.get_strings = rtldsa_get_strings,
|
||||
.get_ethtool_stats = rtldsa_get_ethtool_stats,
|
||||
.get_sset_count = rtldsa_get_sset_count,
|
||||
.get_eth_phy_stats = rtldsa_get_eth_phy_stats,
|
||||
.get_eth_mac_stats = rtldsa_get_eth_mac_stats,
|
||||
.get_eth_ctrl_stats = rtldsa_get_eth_ctrl_stats,
|
||||
.get_rmon_stats = rtldsa_get_rmon_stats,
|
||||
.get_stats64 = rtldsa_get_stats64,
|
||||
.get_pause_stats = rtldsa_get_pause_stats,
|
||||
|
||||
.port_enable = rtl83xx_port_enable,
|
||||
.port_disable = rtl83xx_port_disable,
|
||||
@ -2125,9 +2788,15 @@ const struct dsa_switch_ops rtl930x_switch_ops = {
|
||||
.phylink_mac_link_up = rtl93xx_phylink_mac_link_up,
|
||||
.phylink_mac_select_pcs = rtl83xx_phylink_mac_select_pcs,
|
||||
|
||||
.get_strings = rtl83xx_get_strings,
|
||||
.get_ethtool_stats = rtl83xx_get_ethtool_stats,
|
||||
.get_sset_count = rtl83xx_get_sset_count,
|
||||
.get_strings = rtldsa_get_strings,
|
||||
.get_ethtool_stats = rtldsa_get_ethtool_stats,
|
||||
.get_sset_count = rtldsa_get_sset_count,
|
||||
.get_eth_phy_stats = rtldsa_get_eth_phy_stats,
|
||||
.get_eth_mac_stats = rtldsa_get_eth_mac_stats,
|
||||
.get_eth_ctrl_stats = rtldsa_get_eth_ctrl_stats,
|
||||
.get_rmon_stats = rtldsa_get_rmon_stats,
|
||||
.get_stats64 = rtldsa_get_stats64,
|
||||
.get_pause_stats = rtldsa_get_pause_stats,
|
||||
|
||||
.port_enable = rtl83xx_port_enable,
|
||||
.port_disable = rtl83xx_port_disable,
|
||||
|
@ -34,6 +34,7 @@
|
||||
#define RTL838X_STAT_PORT_STD_MIB (0x1200)
|
||||
#define RTL839X_STAT_PORT_STD_MIB (0xC000)
|
||||
#define RTL930X_STAT_PORT_MIB_CNTR (0x0664)
|
||||
#define RTL930X_STAT_PORT_PRVTE_CNTR (0x2364)
|
||||
#define RTL838X_STAT_RST (0x3100)
|
||||
#define RTL839X_STAT_RST (0xF504)
|
||||
#define RTL930X_STAT_RST (0x3240)
|
||||
@ -638,6 +639,51 @@ enum pbvlan_mode {
|
||||
PBVLAN_MODE_ALL_PKT,
|
||||
};
|
||||
|
||||
struct rtldsa_counter {
|
||||
uint64_t val;
|
||||
uint32_t last;
|
||||
};
|
||||
|
||||
struct rtldsa_counter_state {
|
||||
spinlock_t lock;
|
||||
ktime_t last_update;
|
||||
|
||||
struct rtldsa_counter symbol_errors;
|
||||
|
||||
struct rtldsa_counter if_in_octets;
|
||||
struct rtldsa_counter if_out_octets;
|
||||
struct rtldsa_counter if_in_ucast_pkts;
|
||||
struct rtldsa_counter if_in_mcast_pkts;
|
||||
struct rtldsa_counter if_in_bcast_pkts;
|
||||
struct rtldsa_counter if_out_ucast_pkts;
|
||||
struct rtldsa_counter if_out_mcast_pkts;
|
||||
struct rtldsa_counter if_out_bcast_pkts;
|
||||
struct rtldsa_counter if_out_discards;
|
||||
struct rtldsa_counter single_collisions;
|
||||
struct rtldsa_counter multiple_collisions;
|
||||
struct rtldsa_counter deferred_transmissions;
|
||||
struct rtldsa_counter late_collisions;
|
||||
struct rtldsa_counter excessive_collisions;
|
||||
struct rtldsa_counter crc_align_errors;
|
||||
struct rtldsa_counter rx_pkts_over_max_octets;
|
||||
|
||||
struct rtldsa_counter unsupported_opcodes;
|
||||
|
||||
struct rtldsa_counter rx_undersize_pkts;
|
||||
struct rtldsa_counter rx_oversize_pkts;
|
||||
struct rtldsa_counter rx_fragments;
|
||||
struct rtldsa_counter rx_jabbers;
|
||||
|
||||
struct rtldsa_counter tx_pkts[ETHTOOL_RMON_HIST_MAX];
|
||||
struct rtldsa_counter rx_pkts[ETHTOOL_RMON_HIST_MAX];
|
||||
|
||||
struct rtldsa_counter drop_events;
|
||||
struct rtldsa_counter collisions;
|
||||
|
||||
struct rtldsa_counter rx_pause_frames;
|
||||
struct rtldsa_counter tx_pause_frames;
|
||||
};
|
||||
|
||||
struct rtl838x_port {
|
||||
bool enable;
|
||||
u64 pm;
|
||||
@ -650,6 +696,7 @@ struct rtl838x_port {
|
||||
int sds_num;
|
||||
int led_set;
|
||||
int leds_on_this_port;
|
||||
struct rtldsa_counter_state counters;
|
||||
const struct dsa_port *dp;
|
||||
};
|
||||
|
||||
@ -981,6 +1028,7 @@ struct rtl838x_reg {
|
||||
int stat_port_rst;
|
||||
int stat_rst;
|
||||
int stat_port_std_mib;
|
||||
int stat_port_prv_mib;
|
||||
int (*port_iso_ctrl)(int p);
|
||||
void (*traffic_enable)(int source, int dest);
|
||||
void (*traffic_disable)(int source, int dest);
|
||||
@ -1114,6 +1162,7 @@ struct rtl838x_switch_priv {
|
||||
struct rtl838x_l3_intf *interfaces[MAX_INTERFACES];
|
||||
u16 intf_mtus[MAX_INTF_MTUS];
|
||||
int intf_mtu_count[MAX_INTF_MTUS];
|
||||
struct delayed_work counters_work;
|
||||
};
|
||||
|
||||
void rtl838x_dbgfs_init(struct rtl838x_switch_priv *priv);
|
||||
|
@ -17,11 +17,68 @@ struct fdb_update_work {
|
||||
u64 macs[];
|
||||
};
|
||||
|
||||
#define MIB_DESC(_size, _offset, _name) {.size = _size, .offset = _offset, .name = _name}
|
||||
struct rtl83xx_mib_desc {
|
||||
unsigned int size;
|
||||
enum mib_reg {
|
||||
MIB_REG_INVALID = 0,
|
||||
MIB_REG_STD,
|
||||
MIB_REG_PRV
|
||||
};
|
||||
|
||||
#define MIB_ITEM(_reg, _offset, _size) \
|
||||
{.reg = _reg, .offset = _offset, .size = _size}
|
||||
|
||||
#define MIB_LIST_ITEM(_name, _item) \
|
||||
{.name = _name, .item = _item}
|
||||
|
||||
struct rtldsa_mib_item {
|
||||
enum mib_reg reg;
|
||||
unsigned int offset;
|
||||
unsigned int size;
|
||||
};
|
||||
|
||||
struct rtldsa_mib_list_item {
|
||||
const char *name;
|
||||
struct rtldsa_mib_item item;
|
||||
};
|
||||
|
||||
struct rtldsa_mib_desc {
|
||||
struct rtldsa_mib_item symbol_errors;
|
||||
|
||||
struct rtldsa_mib_item if_in_octets;
|
||||
struct rtldsa_mib_item if_out_octets;
|
||||
struct rtldsa_mib_item if_in_ucast_pkts;
|
||||
struct rtldsa_mib_item if_in_mcast_pkts;
|
||||
struct rtldsa_mib_item if_in_bcast_pkts;
|
||||
struct rtldsa_mib_item if_out_ucast_pkts;
|
||||
struct rtldsa_mib_item if_out_mcast_pkts;
|
||||
struct rtldsa_mib_item if_out_bcast_pkts;
|
||||
struct rtldsa_mib_item if_out_discards;
|
||||
struct rtldsa_mib_item single_collisions;
|
||||
struct rtldsa_mib_item multiple_collisions;
|
||||
struct rtldsa_mib_item deferred_transmissions;
|
||||
struct rtldsa_mib_item late_collisions;
|
||||
struct rtldsa_mib_item excessive_collisions;
|
||||
struct rtldsa_mib_item crc_align_errors;
|
||||
struct rtldsa_mib_item rx_pkts_over_max_octets;
|
||||
|
||||
struct rtldsa_mib_item unsupported_opcodes;
|
||||
|
||||
struct rtldsa_mib_item rx_undersize_pkts;
|
||||
struct rtldsa_mib_item rx_oversize_pkts;
|
||||
struct rtldsa_mib_item rx_fragments;
|
||||
struct rtldsa_mib_item rx_jabbers;
|
||||
|
||||
struct rtldsa_mib_item tx_pkts[ETHTOOL_RMON_HIST_MAX];
|
||||
struct rtldsa_mib_item rx_pkts[ETHTOOL_RMON_HIST_MAX];
|
||||
struct ethtool_rmon_hist_range rmon_ranges[ETHTOOL_RMON_HIST_MAX];
|
||||
|
||||
struct rtldsa_mib_item drop_events;
|
||||
struct rtldsa_mib_item collisions;
|
||||
|
||||
struct rtldsa_mib_item rx_pause_frames;
|
||||
struct rtldsa_mib_item tx_pause_frames;
|
||||
|
||||
size_t list_count;
|
||||
const struct rtldsa_mib_list_item *list;
|
||||
};
|
||||
|
||||
/* API for switch table access */
|
||||
|
@ -2439,6 +2439,7 @@ const struct rtl838x_reg rtl930x_reg = {
|
||||
.stat_port_rst = RTL930X_STAT_PORT_RST,
|
||||
.stat_rst = RTL930X_STAT_RST,
|
||||
.stat_port_std_mib = RTL930X_STAT_PORT_MIB_CNTR,
|
||||
.stat_port_prv_mib = RTL930X_STAT_PORT_PRVTE_CNTR,
|
||||
.traffic_enable = rtl930x_traffic_enable,
|
||||
.traffic_disable = rtl930x_traffic_disable,
|
||||
.traffic_get = rtl930x_traffic_get,
|
||||
|
@ -119,6 +119,19 @@ define Device/Default
|
||||
append-metadata
|
||||
endef
|
||||
|
||||
define Device/kernel-lzma
|
||||
KERNEL := \
|
||||
kernel-bin | \
|
||||
append-dtb | \
|
||||
lzma | \
|
||||
uImage lzma
|
||||
KERNEL_INITRAMFS := \
|
||||
kernel-bin | \
|
||||
append-dtb | \
|
||||
lzma | \
|
||||
uImage lzma
|
||||
endef
|
||||
|
||||
define Device/uimage-rt-loader
|
||||
KERNEL/rt-loader := kernel-bin | append-dtb | rt-compress | rt-loader
|
||||
KERNEL := $$(KERNEL/rt-loader) | uImage none
|
||||
|
@ -5,6 +5,19 @@ define Build/xikestor-nosimg
|
||||
mv $@.new $@
|
||||
endef
|
||||
|
||||
define Device/hasivo_s1100w-8xgt-se
|
||||
SOC := rtl9303
|
||||
DEVICE_VENDOR := Hasivo
|
||||
DEVICE_MODEL := S1100W-8XGT-SE
|
||||
IMAGE_SIZE := 12288k
|
||||
KERNEL_INITRAMFS := \
|
||||
kernel-bin | \
|
||||
append-dtb | \
|
||||
lzma | \
|
||||
uImage lzma
|
||||
endef
|
||||
TARGET_DEVICES += hasivo_s1100w-8xgt-se
|
||||
|
||||
define Device/tplink_tl-st1008f_v2
|
||||
SOC := rtl9303
|
||||
UIMAGE_MAGIC := 0x93030000
|
||||
@ -16,6 +29,16 @@ define Device/tplink_tl-st1008f_v2
|
||||
endef
|
||||
TARGET_DEVICES += tplink_tl-st1008f_v2
|
||||
|
||||
define Device/vimin_vm-s100-0800ms
|
||||
SOC := rtl9303
|
||||
UIMAGE_MAGIC := 0x93000000
|
||||
DEVICE_VENDOR := Vimin
|
||||
DEVICE_MODEL := VM-S100-0800MS
|
||||
IMAGE_SIZE := 13312k
|
||||
$(Device/kernel-lzma)
|
||||
endef
|
||||
TARGET_DEVICES += vimin_vm-s100-0800ms
|
||||
|
||||
define Device/xikestor_sks8300-8x
|
||||
SOC := rtl9303
|
||||
DEVICE_VENDOR := XikeStor
|
||||
|
@ -195,6 +195,7 @@ CONFIG_REGMAP_I2C=y
|
||||
CONFIG_REGMAP_MDIO=y
|
||||
CONFIG_REGMAP_MMIO=y
|
||||
CONFIG_RESET_CONTROLLER=y
|
||||
CONFIG_RTL8261N_PHY=y
|
||||
# CONFIG_RTL838X is not set
|
||||
# CONFIG_RTL839X is not set
|
||||
CONFIG_RTL930X=y
|
||||
|
@ -8,11 +8,11 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=bash
|
||||
PKG_CPE_ID:=cpe:/a:gnu:bash
|
||||
PKG_VERSION:=5.2.37
|
||||
PKG_VERSION:=5.3
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=@GNU/bash
|
||||
PKG_HASH:=9599b22ecd1d5787ad7d3b7bf0c59f312b3396d1e281175dd1f8a4014da621ff
|
||||
PKG_HASH:=62dd49c44c399ed1b3f7f731e87a782334d834f08e098a35f2c87547d5dbb269
|
||||
|
||||
HOST_BUILD_PARALLEL := 1
|
||||
|
||||
|
@ -5,12 +5,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fakeroot
|
||||
PKG_VERSION:=1.37
|
||||
PKG_VERSION:=1.37.1.2
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).orig.tar.gz
|
||||
PKG_SOURCE_URL:=@DEBIAN/pool/main/f/fakeroot
|
||||
PKG_HASH:=9831cc912bc1da6dadac15699c5a07a82c00d6f0dd5c15ec02e20908dd527d3a
|
||||
PKG_HASH:=959496928c8a676ec8377f665ff6a19a707bfad693325f9cc4a4126642f53224
|
||||
PKG_LICENSE:=GPL-3.0-or-later
|
||||
PKG_LICENSE_FILES:=COPYING
|
||||
PKG_FIXUP:=autoreconf
|
||||
|
@ -7,11 +7,11 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=mtools
|
||||
PKG_VERSION:=4.0.44
|
||||
PKG_VERSION:=4.0.49
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
||||
PKG_SOURCE_URL:=@GNU/$(PKG_NAME)
|
||||
PKG_HASH:=37dc4df022533c3d4b2ec1c78973c27c7e8b585374c2d46ab64c6a3db31eddb8
|
||||
PKG_HASH:=6fe5193583d6e7c59da75e63d7234f76c0b07caf33b103894f46f66a871ffc9f
|
||||
|
||||
HOST_BUILD_PARALLEL:=1
|
||||
|
||||
|
@ -7,11 +7,11 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=pkgconf
|
||||
PKG_VERSION:=2.2.0
|
||||
PKG_VERSION:=2.5.1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://distfiles.dereferenced.org/pkgconf
|
||||
PKG_HASH:=28f8dfc279a10ef66148befa3f6eb266e5f3570316600208ed50e9781c7269d8
|
||||
PKG_HASH:=ab89d59810d9cad5dfcd508f25efab8ea0b1c8e7bad91c2b6351f13e6a5940d8
|
||||
|
||||
PKG_CPE_ID:=cpe:/a:pkgconf:pkgconf
|
||||
|
||||
|
Reference in New Issue
Block a user