Merge Official Source
Signed-off-by: CN_SZTL <cnsztl@project-openwrt.eu.org>
This commit is contained in:
commit
181392e4a6
@ -6,9 +6,9 @@ ifdef CONFIG_TESTING_KERNEL
|
||||
KERNEL_PATCHVER:=$(KERNEL_TESTING_PATCHVER)
|
||||
endif
|
||||
|
||||
LINUX_VERSION-5.4 = .95
|
||||
LINUX_VERSION-5.4 = .96
|
||||
|
||||
LINUX_KERNEL_HASH-5.4.95 = 030ae544f346bfa2ce619dd9e17e93d10ec393632d3b6d6cf5d1fc84b914d449
|
||||
LINUX_KERNEL_HASH-5.4.96 = f728de695ec5eb17efa15acaecc48fcd7a6c4a912b51704ed137cccf93f9f5e0
|
||||
|
||||
remove_uri_prefix=$(subst git://,,$(subst http://,,$(subst https://,,$(1))))
|
||||
sanitize_uri=$(call qstrip,$(subst @,_,$(subst :,_,$(subst .,_,$(subst -,_,$(subst /,_,$(1)))))))
|
||||
|
||||
@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=uboot-envtools
|
||||
PKG_DISTNAME:=u-boot
|
||||
PKG_VERSION:=2020.04
|
||||
PKG_VERSION:=2021.01
|
||||
PKG_RELEASE:=$(AUTORELEASE)
|
||||
|
||||
PKG_SOURCE:=$(PKG_DISTNAME)-$(PKG_VERSION).tar.bz2
|
||||
@ -17,7 +17,7 @@ PKG_SOURCE_URL:= \
|
||||
https://ftp.denx.de/pub/u-boot \
|
||||
https://mirror.cyberbits.eu/u-boot \
|
||||
ftp://ftp.denx.de/pub/u-boot
|
||||
PKG_HASH:=fe732aaf037d9cc3c0909bad8362af366ae964bbdac6913a34081ff4ad565372
|
||||
PKG_HASH:=b407e1510a74e863b8b5cb42a24625344f0e0c2fc7582d8c866bd899367d0454
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_DISTNAME)-$(PKG_VERSION)
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_DISTNAME)-$(PKG_VERSION)
|
||||
|
||||
|
||||
@ -112,55 +112,55 @@ endef
|
||||
|
||||
define Download/tiacx100
|
||||
FILE:=tiacx100
|
||||
URL:=http://acx100.erley.org/fw/acx100_1.9.8.b/
|
||||
URL:=@OPENWRT
|
||||
HASH:=4f05913c940c2455b267545b12d93ad81fa5eebb0cbee22a2c7588c50525b4f0
|
||||
endef
|
||||
|
||||
define Download/tiacx100r0d
|
||||
FILE:=tiacx100r0D
|
||||
URL:=http://acx100.erley.org/fw/acx100_1.9.8.b/
|
||||
URL:=@OPENWRT
|
||||
HASH:=6a4a7fbb24a328a88261bc2a507b2a0bf63c91e831e3f1a8caa4f6599b2215e6
|
||||
endef
|
||||
|
||||
define Download/tiacx100r11
|
||||
FILE:=tiacx100r11
|
||||
URL:=http://acx100.erley.org/fw/acx100_1.9.8.b/
|
||||
URL:=@OPENWRT
|
||||
HASH:=e005a93a0b463e01edba2b79038b54c29a7932efee61c851a2ac644b8a4e5dd4
|
||||
endef
|
||||
|
||||
define Download/tiacx100r15
|
||||
FILE:=tiacx100r15
|
||||
URL:=http://acx100.erley.org/fw/acx100_1.9.8.b/
|
||||
URL:=@OPENWRT
|
||||
HASH:=c6f40bead5ef45720e2d72bbe4d998367c2c7857eb7716234aedeb2ad98bcdde
|
||||
endef
|
||||
|
||||
define Download/tiacx111c16
|
||||
FILE:=tiacx111c16
|
||||
URL:=http://acx100.erley.org/fw/acx111_2.3.1.31/
|
||||
URL:=@OPENWRT
|
||||
HASH:=cc6108d577ebc55b924ff6bab44eeee3456d284c63819277cb5460338b2f1bd7
|
||||
endef
|
||||
|
||||
define Download/tiacx111c16_1
|
||||
FILE:=tiacx111c16_1.2.1_34
|
||||
URL:=http://sites.google.com/site/atorkhov/files/
|
||||
URL:=@OPENWRT
|
||||
HASH:=672ed9d02565ab44da450c52f0ced3be99a3a3901f73454455da8e1f98ada220
|
||||
endef
|
||||
|
||||
define Download/tiacx111c17
|
||||
FILE:=tiacx111c17
|
||||
URL:=http://acx100.erley.org/fw/acx111_2.3.1.31/
|
||||
URL:=@OPENWRT
|
||||
HASH:=2bb900a5886dbea2d3504623d9f3ac8abbb2e9fdfcf0fe233e77951dff748a40
|
||||
endef
|
||||
|
||||
define Download/tiacx111c19
|
||||
FILE:=tiacx111c19
|
||||
URL:=http://acx100.erley.org/fw/acx111_2.3.1.31/
|
||||
URL:=@OPENWRT
|
||||
HASH:=383d86a8cfddf92400d661b4e43a9b855350fa656edd4f75b4aff7fab2d00e90
|
||||
endef
|
||||
|
||||
define Download/tiacx111usbc1b
|
||||
FILE:=tiacx111usbc1B
|
||||
URL:=http://acx100.erley.org/fw/acx111_2.4.0.70-USB/
|
||||
URL:=@OPENWRT
|
||||
HASH:=f3c9e574de7073014ab6eef9a0f6412c53ae521b67723360af753c41401ed4d5
|
||||
endef
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=dsl_cpe_control_danube
|
||||
PKG_VERSION:=3.24.4.4
|
||||
PKG_RELEASE:=9
|
||||
PKG_RELEASE:=10
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/dsl_cpe_control-$(PKG_VERSION)
|
||||
PKG_SOURCE_URL:=@OPENWRT
|
||||
@ -35,7 +35,7 @@ define Package/ltq-adsl-app
|
||||
CATEGORY:=Network
|
||||
TITLE:=Lantiq DSL userland tool
|
||||
URL:=http://www.lantiq.com/
|
||||
DEPENDS:=@(TARGET_lantiq_xway||TARGET_lantiq_xway_legacy||TARGET_lantiq_ase) +libpthread +ltq-dsl-base
|
||||
DEPENDS:=@(TARGET_lantiq_xway||TARGET_lantiq_xway_legacy||TARGET_lantiq_ase) +libpthread +ltq-dsl-base +libubox +libubus
|
||||
MENU:=1
|
||||
endef
|
||||
|
||||
@ -75,6 +75,11 @@ CONFIGURE_ARGS += \
|
||||
|
||||
TARGET_CFLAGS += -I$(LINUX_DIR)/include
|
||||
|
||||
define Build/Prepare
|
||||
$(call Build/Prepare/Default)
|
||||
$(CP) ../ltq-vdsl-app/src/src/dsl_cpe_ubus.c $(PKG_BUILD_DIR)/src/
|
||||
endef
|
||||
|
||||
define Package/ltq-adsl-app/install
|
||||
$(INSTALL_DIR) $(1)/etc/init.d $(1)/sbin $(1)/etc/hotplug.d/dsl
|
||||
$(INSTALL_BIN) ./files/dsl_control $(1)/etc/init.d/
|
||||
|
||||
@ -4,10 +4,11 @@
|
||||
START=97
|
||||
USE_PROCD=1
|
||||
|
||||
extra_command "dslstat" "Get DSL status information"
|
||||
extra_command "lucistat" "Get status information in lua friendly format"
|
||||
dslstat() {
|
||||
ubus call dsl metrics
|
||||
}
|
||||
|
||||
. /lib/functions/lantiq_dsl.sh
|
||||
extra_command "dslstat" "Get DSL status information"
|
||||
|
||||
annex_b=10_00_10_00_00_04_00_00
|
||||
annex_bdmt=10_00_00_00_00_00_00_00
|
||||
|
||||
50
package/network/config/ltq-adsl-app/patches/300-ubus.patch
Normal file
50
package/network/config/ltq-adsl-app/patches/300-ubus.patch
Normal file
@ -0,0 +1,50 @@
|
||||
--- a/src/dsl_cpe_control.c
|
||||
+++ b/src/dsl_cpe_control.c
|
||||
@@ -139,6 +139,9 @@ extern DSL_Error_t DSL_CPE_Pipe_StaticRe
|
||||
#endif /* INCLUDE_DSL_RESOURCE_STATISTICS*/
|
||||
#endif
|
||||
|
||||
+extern void ubus_init();
|
||||
+extern void ubus_deinit();
|
||||
+
|
||||
DSL_char_t *g_sFirmwareName1 = DSL_NULL;
|
||||
DSL_char_t *g_sFirmwareName2 = DSL_NULL;
|
||||
#ifdef INCLUDE_SCRIPT_NOTIFICATION
|
||||
@@ -5343,6 +5346,8 @@ DSL_int_t dsl_cpe_daemon (
|
||||
signal (SIGINT, DSL_CPE_TerminationHandler);
|
||||
#endif /* RTEMS*/
|
||||
|
||||
+ ubus_init();
|
||||
+
|
||||
/* Open DSL_CPE_MAX_DEVICE_NUMBER devices*/
|
||||
for (nDevice = 0; nDevice < DSL_CPE_MAX_DEVICE_NUMBER; nDevice++)
|
||||
{
|
||||
@@ -5738,6 +5743,7 @@ DSL_int_t dsl_cpe_daemon (
|
||||
#endif /* INCLUDE_DSL_CPE_CLI_SUPPORT */
|
||||
|
||||
DSL_CPE_CONTROL_EXIT:
|
||||
+ ubus_deinit();
|
||||
|
||||
#ifdef INCLUDE_DSL_BONDING
|
||||
DSL_CPE_BND_Stop((DSL_CPE_BND_Context_t*)pCtrlCtx->pBnd);
|
||||
--- a/src/Makefile.am
|
||||
+++ b/src/Makefile.am
|
||||
@@ -11,7 +11,7 @@ else
|
||||
dsl_cpe_control_common_ldflags =
|
||||
endif
|
||||
|
||||
-dsl_cpe_control_LDADD = -lpthread
|
||||
+dsl_cpe_control_LDADD = -lpthread -lubox -lubus
|
||||
|
||||
if INCLUDE_DSL_CPE_SOAP_SUPPORT
|
||||
dsl_cpe_control_LDADD += -lm
|
||||
@@ -70,7 +70,8 @@ dsl_cpe_control_SOURCES = \
|
||||
dsl_cpe_control.c \
|
||||
dsl_cpe_init_cfg.c \
|
||||
dsl_cpe_linux.c \
|
||||
- dsl_cpe_debug.c
|
||||
+ dsl_cpe_debug.c \
|
||||
+ dsl_cpe_ubus.c
|
||||
|
||||
dsl_cpe_control_SOURCES += \
|
||||
$(dsl_cpe_control_dti_sources)
|
||||
@ -9,7 +9,7 @@ include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=ltq-vdsl-app
|
||||
PKG_VERSION:=4.17.18.6
|
||||
PKG_RELEASE:=5
|
||||
PKG_RELEASE:=6
|
||||
PKG_BASE_NAME:=dsl_cpe_control
|
||||
PKG_SOURCE:=$(PKG_BASE_NAME)_vrx-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=@OPENWRT
|
||||
@ -20,6 +20,7 @@ PKG_LICENSE:=BSD-2-Clause
|
||||
PKG_BUILD_DEPENDS:=ltq-vdsl
|
||||
|
||||
PKG_FLAGS:=nonshared
|
||||
PKG_FIXUP:=autoreconf
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
@ -28,7 +29,7 @@ define Package/ltq-vdsl-app
|
||||
CATEGORY:=Network
|
||||
TITLE:=Lantiq VDSL userland tool
|
||||
URL:=http://www.lantiq.com/
|
||||
DEPENDS:=@TARGET_lantiq_xrx200 +libpthread +librt +ltq-dsl-base
|
||||
DEPENDS:=@TARGET_lantiq_xrx200 +libpthread +librt +ltq-dsl-base +libubox +libubus
|
||||
endef
|
||||
|
||||
define Package/ltq-vdsl-app/description
|
||||
|
||||
@ -4,10 +4,11 @@
|
||||
START=97
|
||||
USE_PROCD=1
|
||||
|
||||
extra_command "dslstat" "Get DSL status information"
|
||||
extra_command "lucistat" "Get status information in lua friendly format"
|
||||
dslstat() {
|
||||
ubus call dsl metrics
|
||||
}
|
||||
|
||||
. /lib/functions/lantiq_dsl.sh
|
||||
extra_command "dslstat" "Get DSL status information"
|
||||
|
||||
#
|
||||
# ITU-T G.997.1 (06/2012) - Section 7.3.1.1.1 (xTU transmission system enabling (XTSE))
|
||||
@ -307,8 +308,6 @@ start_service() {
|
||||
}
|
||||
|
||||
stop_service() {
|
||||
# do not use dsl_cmd to not block when this is locked up by some other proess
|
||||
echo quit > /tmp/pipe/dsl_cpe0_cmd
|
||||
DSL_NOTIFICATION_TYPE="DSL_INTERFACE_STATUS" \
|
||||
DSL_INTERFACE_STATUS="DOWN" \
|
||||
/sbin/dsl_notify.sh
|
||||
|
||||
@ -0,0 +1,19 @@
|
||||
--- a/src/dsl_cpe_control.c
|
||||
+++ b/src/dsl_cpe_control.c
|
||||
@@ -6504,7 +6504,7 @@ DSL_CPE_STATIC void DSL_CPE_Termination
|
||||
/* ignore the signal, we'll handle by ourself */
|
||||
signal (sig, SIG_IGN);
|
||||
|
||||
- if (sig == SIGINT)
|
||||
+ if (sig == SIGINT || sig == SIGTERM)
|
||||
{
|
||||
DSL_CCA_DEBUG(DSL_CCA_DBG_MSG, (DSL_CPE_PREFIX "terminated" DSL_CPE_CRLF));
|
||||
DSL_CPE_Termination ();
|
||||
@@ -6756,6 +6756,7 @@ DSL_int_t dsl_cpe_daemon (
|
||||
|
||||
#ifndef RTEMS
|
||||
signal (SIGINT, DSL_CPE_TerminationHandler);
|
||||
+ signal (SIGTERM, DSL_CPE_TerminationHandler);
|
||||
#endif /* RTEMS*/
|
||||
|
||||
/* Open DSL_CPE_MAX_DSL_ENTITIES devices*/
|
||||
50
package/network/config/ltq-vdsl-app/patches/300-ubus.patch
Normal file
50
package/network/config/ltq-vdsl-app/patches/300-ubus.patch
Normal file
@ -0,0 +1,50 @@
|
||||
--- a/src/dsl_cpe_control.c
|
||||
+++ b/src/dsl_cpe_control.c
|
||||
@@ -177,6 +177,9 @@ extern DSL_Error_t DSL_CPE_Pipe_StaticRe
|
||||
#endif /* INCLUDE_DSL_RESOURCE_STATISTICS*/
|
||||
#endif
|
||||
|
||||
+extern void ubus_init();
|
||||
+extern void ubus_deinit();
|
||||
+
|
||||
DSL_char_t *g_sFirmwareName1 = DSL_NULL;
|
||||
DSL_FirmwareFeatures_t g_nFwFeatures1 = {DSL_FW_XDSLMODE_CLEANED, DSL_FW_XDSLFEATURE_CLEANED,
|
||||
DSL_FW_XDSLFEATURE_CLEANED};
|
||||
@@ -6759,6 +6762,8 @@ DSL_int_t dsl_cpe_daemon (
|
||||
signal (SIGTERM, DSL_CPE_TerminationHandler);
|
||||
#endif /* RTEMS*/
|
||||
|
||||
+ ubus_init();
|
||||
+
|
||||
/* Open DSL_CPE_MAX_DSL_ENTITIES devices*/
|
||||
for (nDevice = 0; nDevice < DSL_CPE_MAX_DSL_ENTITIES; nDevice++)
|
||||
{
|
||||
@@ -7213,6 +7218,7 @@ DSL_int_t dsl_cpe_daemon (
|
||||
#endif /* INCLUDE_DSL_CPE_CLI_SUPPORT */
|
||||
|
||||
DSL_CPE_CONTROL_EXIT:
|
||||
+ ubus_deinit();
|
||||
|
||||
#ifdef INCLUDE_DSL_BONDING
|
||||
DSL_CPE_BND_Stop((DSL_CPE_BND_Context_t*)pCtrlCtx->pBnd);
|
||||
--- a/src/Makefile.am
|
||||
+++ b/src/Makefile.am
|
||||
@@ -11,7 +11,7 @@ else
|
||||
dsl_cpe_control_common_ldflags =
|
||||
endif
|
||||
|
||||
-dsl_cpe_control_LDADD = -lpthread -lrt
|
||||
+dsl_cpe_control_LDADD = -lpthread -lrt -lubox -lubus
|
||||
|
||||
if INCLUDE_DSL_CPE_DTI_SUPPORT
|
||||
dsl_cpe_control_LDADD += -ldti_agent
|
||||
@@ -66,7 +66,8 @@ dsl_cpe_control_SOURCES = \
|
||||
dsl_cpe_control.c \
|
||||
dsl_cpe_init_cfg.c \
|
||||
dsl_cpe_linux.c \
|
||||
- dsl_cpe_debug.c
|
||||
+ dsl_cpe_debug.c \
|
||||
+ dsl_cpe_ubus.c
|
||||
|
||||
dsl_cpe_control_SOURCES += \
|
||||
$(dsl_cpe_control_dti_sources)
|
||||
807
package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c
Normal file
807
package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c
Normal file
@ -0,0 +1,807 @@
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
/*
|
||||
* Copyright (C) 2020 Andre Heider <a.heider@gmail.com>
|
||||
*/
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <libubus.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "dsl_cpe_control.h"
|
||||
#include <drv_dsl_cpe_api_ioctl.h>
|
||||
#ifdef INCLUDE_DSL_CPE_API_VRX
|
||||
#include <drv_mei_cpe_interface.h>
|
||||
#endif
|
||||
|
||||
#define U16(v1, v2) ( \
|
||||
((uint16_t)(v1) << 8) | \
|
||||
((uint16_t)(v2)))
|
||||
|
||||
#define U32(v1, v2, v3, v4) ( \
|
||||
((uint32_t)(v1) << 24) | \
|
||||
((uint32_t)(v2) << 16) | \
|
||||
((uint32_t)(v3) << 8) | \
|
||||
((uint32_t)(v4)))
|
||||
|
||||
#define STR_CASE(id, text) \
|
||||
case id: \
|
||||
str = text; \
|
||||
break;
|
||||
|
||||
#define IOCTL(type, request) \
|
||||
type out; \
|
||||
memset(&out, 0, sizeof(type)); \
|
||||
if (ioctl(fd, request, &out)) \
|
||||
return;
|
||||
|
||||
#define IOCTL_DIR(type, request, dir) \
|
||||
type out; \
|
||||
memset(&out, 0, sizeof(type)); \
|
||||
out.nDirection = dir; \
|
||||
if (ioctl(fd, request, &out)) \
|
||||
return;
|
||||
|
||||
#define IOCTL_DIR_DELT(type, request, dir, delt) \
|
||||
type out; \
|
||||
memset(&out, 0, sizeof(type)); \
|
||||
out.nDirection = dir; \
|
||||
out.nDeltDataType = delt; \
|
||||
if (ioctl(fd, request, &out)) \
|
||||
return;
|
||||
|
||||
typedef enum {
|
||||
ANNEX_UNKNOWN = 0,
|
||||
ANNEX_A,
|
||||
ANNEX_B,
|
||||
ANNEX_C,
|
||||
ANNEX_I,
|
||||
ANNEX_J,
|
||||
ANNEX_L,
|
||||
ANNEX_M,
|
||||
} annex_t;
|
||||
|
||||
typedef enum {
|
||||
STD_UNKNOWN = 0,
|
||||
STD_T1_413,
|
||||
STD_TS_101_388,
|
||||
STD_G_992_1,
|
||||
STD_G_992_2,
|
||||
STD_G_992_3,
|
||||
STD_G_992_4,
|
||||
STD_G_992_5,
|
||||
STD_G_993_1,
|
||||
STD_G_993_2,
|
||||
} standard_t;
|
||||
|
||||
typedef enum {
|
||||
VECTOR_UNKNOWN = 0,
|
||||
VECTOR_OFF,
|
||||
VECTOR_ON_DS,
|
||||
VECTOR_ON_DS_US,
|
||||
} vector_t;
|
||||
|
||||
typedef enum {
|
||||
PROFILE_UNKNOWN = 0,
|
||||
PROFILE_8A,
|
||||
PROFILE_8B,
|
||||
PROFILE_8C,
|
||||
PROFILE_8D,
|
||||
PROFILE_12A,
|
||||
PROFILE_12B,
|
||||
PROFILE_17A,
|
||||
PROFILE_30A,
|
||||
PROFILE_35B,
|
||||
} profile_t;
|
||||
|
||||
static DSL_CPE_ThreadCtrl_t thread;
|
||||
static struct ubus_context *ctx;
|
||||
static struct blob_buf b;
|
||||
|
||||
static inline void m_double(const char *id, double value) {
|
||||
blobmsg_add_double(&b, id, value);
|
||||
}
|
||||
|
||||
static inline void m_bool(const char *id, bool value) {
|
||||
blobmsg_add_u8(&b, id, value);
|
||||
}
|
||||
|
||||
static inline void m_u32(const char *id, uint32_t value) {
|
||||
blobmsg_add_u32(&b, id, value);
|
||||
}
|
||||
|
||||
static inline void m_str(const char *id, const char *value) {
|
||||
blobmsg_add_string(&b, id, value);
|
||||
}
|
||||
|
||||
static inline void m_db(const char *id, int value) {
|
||||
m_double(id, (double)value / 10);
|
||||
}
|
||||
|
||||
static inline void m_array(const char *id, const uint8_t *value, uint8_t len) {
|
||||
void *c = blobmsg_open_array(&b, id);
|
||||
|
||||
for (uint8_t i = 0; i < len; ++i)
|
||||
blobmsg_add_u16(&b, "", value[i]);
|
||||
|
||||
blobmsg_close_array(&b, c);
|
||||
}
|
||||
|
||||
static void m_vendor(const char *id, const uint8_t *value) {
|
||||
// ITU-T T.35: U.S.
|
||||
if (U16(value[0], value[1]) != 0xb500)
|
||||
return;
|
||||
|
||||
const char *str = NULL;
|
||||
switch (U32(value[2], value[3], value[4], value[5])) {
|
||||
STR_CASE(0x414C4342, "Alcatel")
|
||||
STR_CASE(0x414E4456, "Analog Devices")
|
||||
STR_CASE(0x4244434D, "Broadcom")
|
||||
STR_CASE(0x43454E54, "Centillium")
|
||||
STR_CASE(0x4753504E, "Globespan")
|
||||
STR_CASE(0x494B4E53, "Ikanos")
|
||||
STR_CASE(0x4946544E, "Infineon")
|
||||
STR_CASE(0x54535443, "Texas Instruments")
|
||||
STR_CASE(0x544D4D42, "Thomson MultiMedia Broadband")
|
||||
STR_CASE(0x5443544E, "Trend Chip Technologies")
|
||||
STR_CASE(0x53544D49, "ST Micro")
|
||||
};
|
||||
|
||||
if (!str)
|
||||
return;
|
||||
|
||||
if ((value[6] == 0) && (value[7] == 0)) {
|
||||
m_str(id, str);
|
||||
return;
|
||||
}
|
||||
|
||||
char buf[64];
|
||||
sprintf(buf, "%s %d.%d", str, value[6], value[7]);
|
||||
m_str(id, buf);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
annex_t get_annex(const uint8_t *xtse) {
|
||||
if ((xtse[0] & XTSE_1_01_A_T1_413) ||
|
||||
(xtse[0] & XTSE_1_03_A_1_NO) ||
|
||||
(xtse[0] & XTSE_1_04_A_1_O) ||
|
||||
(xtse[1] & XTSE_2_01_A_2_NO) ||
|
||||
(xtse[2] & XTSE_3_03_A_3_NO) ||
|
||||
(xtse[2] & XTSE_3_04_A_3_O) ||
|
||||
(xtse[3] & XTSE_4_01_A_4_NO) ||
|
||||
(xtse[3] & XTSE_4_02_A_4_O) ||
|
||||
(xtse[5] & XTSE_6_01_A_5_NO) ||
|
||||
(xtse[5] & XTSE_6_02_A_5_O) ||
|
||||
(xtse[7] & XTSE_8_01_A))
|
||||
return ANNEX_A;
|
||||
|
||||
if ((xtse[0] & XTSE_1_05_B_1_NO) ||
|
||||
(xtse[0] & XTSE_1_06_B_1_O) ||
|
||||
(xtse[1] & XTSE_2_02_B_2_O) ||
|
||||
(xtse[2] & XTSE_3_05_B_3_NO) ||
|
||||
(xtse[2] & XTSE_3_06_B_3_O) ||
|
||||
(xtse[5] & XTSE_6_03_B_5_NO) ||
|
||||
(xtse[5] & XTSE_6_04_B_5_O) ||
|
||||
(xtse[7] & XTSE_8_02_B))
|
||||
return ANNEX_B;
|
||||
|
||||
if ((xtse[0] & XTSE_1_02_C_TS_101388) ||
|
||||
(xtse[0] & XTSE_1_07_C_1_NO) ||
|
||||
(xtse[0] & XTSE_1_08_C_1_O) ||
|
||||
(xtse[1] & XTSE_2_03_C_2_NO) ||
|
||||
(xtse[1] & XTSE_2_04_C_2_O) ||
|
||||
(xtse[7] & XTSE_8_03_C))
|
||||
return ANNEX_C;
|
||||
|
||||
if ((xtse[3] & XTSE_4_05_I_3_NO) ||
|
||||
(xtse[3] & XTSE_4_06_I_3_O) ||
|
||||
(xtse[4] & XTSE_5_01_I_4_NO) ||
|
||||
(xtse[4] & XTSE_5_02_I_4_O) ||
|
||||
(xtse[5] & XTSE_6_07_I_5_NO) ||
|
||||
(xtse[5] & XTSE_6_08_I_5_O))
|
||||
return ANNEX_I;
|
||||
|
||||
if ((xtse[3] & XTSE_4_07_J_3_NO) ||
|
||||
(xtse[3] & XTSE_4_08_J_3_O) ||
|
||||
(xtse[6] & XTSE_7_01_J_5_NO) ||
|
||||
(xtse[6] & XTSE_7_02_J_5_O))
|
||||
return ANNEX_J;
|
||||
|
||||
if ((xtse[4] & XTSE_5_03_L_3_NO) ||
|
||||
(xtse[4] & XTSE_5_04_L_3_NO) ||
|
||||
(xtse[4] & XTSE_5_05_L_3_O) ||
|
||||
(xtse[4] & XTSE_5_06_L_3_O))
|
||||
return ANNEX_L;
|
||||
|
||||
if ((xtse[4] & XTSE_5_07_M_3_NO) ||
|
||||
(xtse[4] & XTSE_5_08_M_3_O) ||
|
||||
(xtse[6] & XTSE_7_03_M_5_NO) ||
|
||||
(xtse[6] & XTSE_7_04_M_5_O))
|
||||
return ANNEX_M;
|
||||
|
||||
return ANNEX_UNKNOWN;
|
||||
}
|
||||
|
||||
static standard_t get_standard(const uint8_t *xtse) {
|
||||
if (xtse[0] & XTSE_1_01_A_T1_413)
|
||||
return STD_T1_413;
|
||||
|
||||
if (xtse[0] & XTSE_1_02_C_TS_101388)
|
||||
return STD_TS_101_388;
|
||||
|
||||
if ((xtse[0] & XTSE_1_03_A_1_NO) ||
|
||||
(xtse[0] & XTSE_1_04_A_1_O) ||
|
||||
(xtse[0] & XTSE_1_05_B_1_NO) ||
|
||||
(xtse[0] & XTSE_1_06_B_1_O) ||
|
||||
(xtse[0] & XTSE_1_07_C_1_NO) ||
|
||||
(xtse[0] & XTSE_1_08_C_1_O))
|
||||
return STD_G_992_1;
|
||||
|
||||
if ((xtse[1] & XTSE_2_01_A_2_NO) ||
|
||||
(xtse[1] & XTSE_2_02_B_2_O) ||
|
||||
(xtse[1] & XTSE_2_03_C_2_NO) ||
|
||||
(xtse[1] & XTSE_2_04_C_2_O))
|
||||
return STD_G_992_2;
|
||||
|
||||
if ((xtse[2] & XTSE_3_03_A_3_NO) ||
|
||||
(xtse[2] & XTSE_3_04_A_3_O) ||
|
||||
(xtse[2] & XTSE_3_05_B_3_NO) ||
|
||||
(xtse[2] & XTSE_3_06_B_3_O) ||
|
||||
(xtse[3] & XTSE_4_05_I_3_NO) ||
|
||||
(xtse[3] & XTSE_4_06_I_3_O) ||
|
||||
(xtse[3] & XTSE_4_07_J_3_NO) ||
|
||||
(xtse[3] & XTSE_4_08_J_3_O) ||
|
||||
(xtse[4] & XTSE_5_03_L_3_NO) ||
|
||||
(xtse[4] & XTSE_5_04_L_3_NO) ||
|
||||
(xtse[4] & XTSE_5_05_L_3_O) ||
|
||||
(xtse[4] & XTSE_5_06_L_3_O) ||
|
||||
(xtse[4] & XTSE_5_07_M_3_NO) ||
|
||||
(xtse[4] & XTSE_5_08_M_3_O))
|
||||
return STD_G_992_3;
|
||||
|
||||
if ((xtse[3] & XTSE_4_01_A_4_NO) ||
|
||||
(xtse[3] & XTSE_4_02_A_4_O) ||
|
||||
(xtse[4] & XTSE_5_01_I_4_NO) ||
|
||||
(xtse[4] & XTSE_5_02_I_4_O))
|
||||
return STD_G_992_4;
|
||||
|
||||
if ((xtse[5] & XTSE_6_01_A_5_NO) ||
|
||||
(xtse[5] & XTSE_6_02_A_5_O) ||
|
||||
(xtse[5] & XTSE_6_03_B_5_NO) ||
|
||||
(xtse[5] & XTSE_6_04_B_5_O) ||
|
||||
(xtse[5] & XTSE_6_07_I_5_NO) ||
|
||||
(xtse[5] & XTSE_6_08_I_5_O) ||
|
||||
(xtse[6] & XTSE_7_01_J_5_NO) ||
|
||||
(xtse[6] & XTSE_7_02_J_5_O) ||
|
||||
(xtse[6] & XTSE_7_03_M_5_NO) ||
|
||||
(xtse[6] & XTSE_7_04_M_5_O))
|
||||
return STD_G_992_5;
|
||||
|
||||
if (xtse[7] & XTSE_8_08)
|
||||
return STD_G_993_1;
|
||||
|
||||
if ((xtse[7] & XTSE_8_01_A) ||
|
||||
(xtse[7] & XTSE_8_02_B) ||
|
||||
(xtse[7] & XTSE_8_03_C))
|
||||
return STD_G_993_2;
|
||||
|
||||
return STD_UNKNOWN;
|
||||
}
|
||||
|
||||
static void version_information(int fd) {
|
||||
IOCTL(DSL_VersionInformation_t, DSL_FIO_VERSION_INFORMATION_GET)
|
||||
|
||||
m_str("api_version", out.data.DSL_DriverVersionApi);
|
||||
m_str("firmware_version", out.data.DSL_ChipSetFWVersion);
|
||||
m_str("chipset", out.data.DSL_ChipSetType);
|
||||
m_str("driver_version", out.data.DSL_DriverVersionMeiBsp);
|
||||
}
|
||||
|
||||
static void line_state(int fd) {
|
||||
IOCTL(DSL_LineState_t, DSL_FIO_LINE_STATE_GET)
|
||||
|
||||
const char *str;
|
||||
switch (out.data.nLineState) {
|
||||
STR_CASE(DSL_LINESTATE_NOT_INITIALIZED, "Not initialized")
|
||||
STR_CASE(DSL_LINESTATE_EXCEPTION, "Exception")
|
||||
STR_CASE(DSL_LINESTATE_NOT_UPDATED, "Not updated")
|
||||
STR_CASE(DSL_LINESTATE_IDLE_REQUEST, "Idle request")
|
||||
STR_CASE(DSL_LINESTATE_IDLE, "Idle")
|
||||
STR_CASE(DSL_LINESTATE_SILENT_REQUEST, "Silent request")
|
||||
STR_CASE(DSL_LINESTATE_SILENT, "Silent")
|
||||
STR_CASE(DSL_LINESTATE_HANDSHAKE, "Handshake")
|
||||
STR_CASE(DSL_LINESTATE_BONDING_CLR, "Bonding CLR")
|
||||
STR_CASE(DSL_LINESTATE_FULL_INIT, "Full init")
|
||||
STR_CASE(DSL_LINESTATE_SHORT_INIT_ENTRY, "Short init entry")
|
||||
STR_CASE(DSL_LINESTATE_DISCOVERY, "Discovery")
|
||||
STR_CASE(DSL_LINESTATE_TRAINING, "Training")
|
||||
STR_CASE(DSL_LINESTATE_ANALYSIS, "Analysis")
|
||||
STR_CASE(DSL_LINESTATE_EXCHANGE, "Exchange")
|
||||
STR_CASE(DSL_LINESTATE_SHOWTIME_NO_SYNC, "Showtime without TC-Layer sync")
|
||||
STR_CASE(DSL_LINESTATE_SHOWTIME_TC_SYNC, "Showtime with TC-Layer sync")
|
||||
STR_CASE(DSL_LINESTATE_FASTRETRAIN, "Fastretrain")
|
||||
STR_CASE(DSL_LINESTATE_LOWPOWER_L2, "Lowpower L2")
|
||||
STR_CASE(DSL_LINESTATE_LOOPDIAGNOSTIC_ACTIVE, "Loopdiagnostic active")
|
||||
STR_CASE(DSL_LINESTATE_LOOPDIAGNOSTIC_DATA_EXCHANGE, "Loopdiagnostic data exchange")
|
||||
STR_CASE(DSL_LINESTATE_LOOPDIAGNOSTIC_DATA_REQUEST, "Loopdiagnostic data request")
|
||||
STR_CASE(DSL_LINESTATE_LOOPDIAGNOSTIC_COMPLETE, "Loopdiagnostic complete")
|
||||
STR_CASE(DSL_LINESTATE_RESYNC, "Resync")
|
||||
STR_CASE(DSL_LINESTATE_TEST, "Test")
|
||||
STR_CASE(DSL_LINESTATE_TEST_LOOP, "Test loop")
|
||||
STR_CASE(DSL_LINESTATE_TEST_REVERB, "Test reverb")
|
||||
STR_CASE(DSL_LINESTATE_TEST_MEDLEY, "Test medley")
|
||||
STR_CASE(DSL_LINESTATE_TEST_SHOWTIME_LOCK, "Showtime lock")
|
||||
STR_CASE(DSL_LINESTATE_TEST_QUIET, "Quiet")
|
||||
STR_CASE(DSL_LINESTATE_LOWPOWER_L3, "Lowpower L3")
|
||||
#ifndef INCLUDE_DSL_CPE_API_DANUBE
|
||||
STR_CASE(DSL_LINESTATE_DISABLED, "Disabled")
|
||||
STR_CASE(DSL_LINESTATE_T1413, "T1413")
|
||||
STR_CASE(DSL_LINESTATE_ORDERLY_SHUTDOWN_REQUEST, "Orderly shutdown request")
|
||||
STR_CASE(DSL_LINESTATE_ORDERLY_SHUTDOWN, "Orderly shutdown")
|
||||
STR_CASE(DSL_LINESTATE_TEST_FILTERDETECTION_ACTIVE, "Test filterdetection active")
|
||||
STR_CASE(DSL_LINESTATE_TEST_FILTERDETECTION_COMPLETE, "Test filterdetection complete")
|
||||
#endif
|
||||
default:
|
||||
str = NULL;
|
||||
break;
|
||||
};
|
||||
if (str)
|
||||
m_str("state", str);
|
||||
|
||||
m_bool("up", out.data.nLineState == DSL_LINESTATE_SHOWTIME_TC_SYNC);
|
||||
}
|
||||
|
||||
static void pm_channel_counters_showtime(int fd) {
|
||||
IOCTL_DIR(DSL_PM_ChannelCounters_t, DSL_FIO_PM_CHANNEL_COUNTERS_SHOWTIME_GET, DSL_NEAR_END);
|
||||
|
||||
m_u32("uptime", out.interval.nElapsedTime);
|
||||
}
|
||||
|
||||
static void g997_line_inventory(int fd) {
|
||||
IOCTL_DIR(DSL_G997_LineInventory_t, DSL_FIO_G997_LINE_INVENTORY_GET, DSL_DOWNSTREAM)
|
||||
|
||||
m_array("vendor_id", out.data.G994VendorID, DSL_G997_LI_MAXLEN_VENDOR_ID);
|
||||
m_vendor("vendor", out.data.G994VendorID);
|
||||
m_array("system_vendor_id", out.data.SystemVendorID, DSL_G997_LI_MAXLEN_VENDOR_ID);
|
||||
m_vendor("system_vendor", out.data.SystemVendorID);
|
||||
m_array("version", out.data.VersionNumber, DSL_G997_LI_MAXLEN_VERSION);
|
||||
m_array("serial", out.data.SerialNumber, DSL_G997_LI_MAXLEN_SERIAL);
|
||||
}
|
||||
|
||||
static void g997_power_management_status(int fd) {
|
||||
IOCTL(DSL_G997_PowerManagementStatus_t, DSL_FIO_G997_POWER_MANAGEMENT_STATUS_GET)
|
||||
|
||||
const char *str;
|
||||
switch (out.data.nPowerManagementStatus) {
|
||||
STR_CASE(DSL_G997_PMS_NA, "Power management state is not available")
|
||||
STR_CASE(DSL_G997_PMS_L0, "L0 - Synchronized")
|
||||
STR_CASE(DSL_G997_PMS_L1, "L1 - Power Down Data transmission (G.992.2)")
|
||||
STR_CASE(DSL_G997_PMS_L2, "L2 - Power Down Data transmission (G.992.3 and G.992.4)")
|
||||
STR_CASE(DSL_G997_PMS_L3, "L3 - No power")
|
||||
default:
|
||||
str = NULL;
|
||||
break;
|
||||
};
|
||||
if (str)
|
||||
m_str("power_state", str);
|
||||
}
|
||||
|
||||
static void g997_xtu_system_enabling(int fd, standard_t *standard) {
|
||||
IOCTL(DSL_G997_XTUSystemEnabling_t, DSL_FIO_G997_XTU_SYSTEM_ENABLING_STATUS_GET)
|
||||
|
||||
m_array("xtse", out.data.XTSE, DSL_G997_NUM_XTSE_OCTETS);
|
||||
|
||||
const char *str;
|
||||
switch (get_annex(out.data.XTSE)) {
|
||||
STR_CASE(ANNEX_A, "A")
|
||||
STR_CASE(ANNEX_B, "B")
|
||||
STR_CASE(ANNEX_C, "C")
|
||||
STR_CASE(ANNEX_I, "I")
|
||||
STR_CASE(ANNEX_J, "J")
|
||||
STR_CASE(ANNEX_L, "L")
|
||||
STR_CASE(ANNEX_M, "M")
|
||||
default:
|
||||
str = NULL;
|
||||
break;
|
||||
};
|
||||
if (str)
|
||||
m_str("annex", str);
|
||||
|
||||
*standard = get_standard(out.data.XTSE);
|
||||
|
||||
switch (*standard) {
|
||||
STR_CASE(STD_T1_413, "T1.413")
|
||||
STR_CASE(STD_TS_101_388, "TS 101 388")
|
||||
STR_CASE(STD_G_992_1, "G.992.1")
|
||||
STR_CASE(STD_G_992_2, "G.992.2")
|
||||
STR_CASE(STD_G_992_3, "G.992.3")
|
||||
STR_CASE(STD_G_992_4, "G.992.4")
|
||||
STR_CASE(STD_G_992_5, "G.992.5")
|
||||
STR_CASE(STD_G_993_1, "G.993.1")
|
||||
STR_CASE(STD_G_993_2, "G.993.2")
|
||||
default:
|
||||
str = NULL;
|
||||
break;
|
||||
}
|
||||
if (str)
|
||||
m_str("standard", str);
|
||||
}
|
||||
|
||||
static vector_t get_vector_status() {
|
||||
#ifdef INCLUDE_DSL_CPE_API_VRX
|
||||
int fd = open(DSL_CPE_DSL_LOW_DEV "/0", O_RDWR, 0644);
|
||||
if (fd < 0)
|
||||
return VECTOR_UNKNOWN;
|
||||
|
||||
IOCTL_MEI_dsmStatus_t out;
|
||||
memset(&out, 0, sizeof(IOCTL_MEI_dsmStatus_t));
|
||||
int ret = ioctl(fd, FIO_MEI_DSM_STATUS_GET, &out);
|
||||
close(fd);
|
||||
|
||||
if (ret)
|
||||
return VECTOR_UNKNOWN;
|
||||
|
||||
switch (out.eVectorStatus) {
|
||||
case e_MEI_VECTOR_STAT_OFF:
|
||||
return VECTOR_OFF;
|
||||
case e_MEI_VECTOR_STAT_ON_DS:
|
||||
return VECTOR_ON_DS;
|
||||
case e_MEI_VECTOR_STAT_ON_DS_US:
|
||||
return VECTOR_ON_DS_US;
|
||||
default:
|
||||
return VECTOR_UNKNOWN;
|
||||
};
|
||||
#else
|
||||
return VECTOR_UNKNOWN;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void band_plan_status(int fd, profile_t *profile) {
|
||||
#if (INCLUDE_DSL_CPE_API_VDSL_SUPPORT == 1)
|
||||
IOCTL(DSL_BandPlanStatus_t, DSL_FIO_BAND_PLAN_STATUS_GET)
|
||||
|
||||
switch (out.data.nProfile) {
|
||||
case DSL_PROFILE_8A:
|
||||
*profile = PROFILE_8A;
|
||||
break;
|
||||
case DSL_PROFILE_8B:
|
||||
*profile = PROFILE_8B;
|
||||
break;
|
||||
case DSL_PROFILE_8C:
|
||||
*profile = PROFILE_8C;
|
||||
break;
|
||||
case DSL_PROFILE_8D:
|
||||
*profile = PROFILE_8D;
|
||||
break;
|
||||
case DSL_PROFILE_12A:
|
||||
*profile = PROFILE_12A;
|
||||
break;
|
||||
case DSL_PROFILE_12B:
|
||||
*profile = PROFILE_12B;
|
||||
break;
|
||||
case DSL_PROFILE_17A:
|
||||
*profile = PROFILE_17A;
|
||||
break;
|
||||
case DSL_PROFILE_30A:
|
||||
*profile = PROFILE_30A;
|
||||
break;
|
||||
case DSL_PROFILE_35B:
|
||||
*profile = PROFILE_35B;
|
||||
break;
|
||||
default:
|
||||
*profile = PROFILE_UNKNOWN;
|
||||
break;
|
||||
};
|
||||
|
||||
const char *str;
|
||||
switch (*profile) {
|
||||
STR_CASE(PROFILE_8A, "8a")
|
||||
STR_CASE(PROFILE_8B, "8b")
|
||||
STR_CASE(PROFILE_8C, "8c")
|
||||
STR_CASE(PROFILE_8D, "8d")
|
||||
STR_CASE(PROFILE_12A, "12a")
|
||||
STR_CASE(PROFILE_12B, "12b")
|
||||
STR_CASE(PROFILE_17A, "17a")
|
||||
STR_CASE(PROFILE_30A, "30a")
|
||||
STR_CASE(PROFILE_35B, "35b")
|
||||
default:
|
||||
str = NULL;
|
||||
break;
|
||||
};
|
||||
if (str)
|
||||
m_str("profile", str);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void line_feature_config(int fd, DSL_AccessDir_t direction) {
|
||||
IOCTL_DIR(DSL_LineFeature_t, DSL_FIO_LINE_FEATURE_STATUS_GET, direction)
|
||||
|
||||
m_bool("trellis", out.data.bTrellisEnable);
|
||||
m_bool("bitswap", out.data.bBitswapEnable);
|
||||
m_bool("retx", out.data.bReTxEnable);
|
||||
m_bool("virtual_noise", out.data.bVirtualNoiseSupport);
|
||||
}
|
||||
|
||||
static void g997_channel_status(int fd, DSL_AccessDir_t direction) {
|
||||
IOCTL_DIR(DSL_G997_ChannelStatus_t, DSL_FIO_G997_CHANNEL_STATUS_GET, direction);
|
||||
|
||||
m_u32("interleave_delay", out.data.ActualInterleaveDelay * 10);
|
||||
m_u32("data_rate", out.data.ActualDataRate);
|
||||
}
|
||||
|
||||
static void g997_line_status(int fd, DSL_AccessDir_t direction) {
|
||||
IOCTL_DIR_DELT(DSL_G997_LineStatus_t, DSL_FIO_G997_LINE_STATUS_GET, direction, DSL_DELT_DATA_SHOWTIME);
|
||||
|
||||
m_db("latn", out.data.LATN);
|
||||
m_db("satn", out.data.SATN);
|
||||
m_db("snr", out.data.SNR);
|
||||
m_db("actps", out.data.ACTPS);
|
||||
m_db("actatp", out.data.ACTATP);
|
||||
m_u32("attndr", out.data.ATTNDR);
|
||||
}
|
||||
|
||||
static void pm_line_sec_counters_total(int fd, DSL_XTUDir_t direction) {
|
||||
IOCTL_DIR(DSL_PM_LineSecCountersTotal_t, DSL_FIO_PM_LINE_SEC_COUNTERS_TOTAL_GET, direction)
|
||||
|
||||
m_u32("es", out.data.nES);
|
||||
m_u32("ses", out.data.nSES);
|
||||
m_u32("loss", out.data.nLOSS);
|
||||
m_u32("uas", out.data.nUAS);
|
||||
m_u32("lofs", out.data.nLOFS);
|
||||
#ifndef INCLUDE_DSL_CPE_API_DANUBE
|
||||
m_u32("fecs", out.data.nFECS);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void pm_data_path_counters_total(int fd, DSL_XTUDir_t direction) {
|
||||
IOCTL_DIR(DSL_PM_DataPathCountersTotal_t, DSL_FIO_PM_DATA_PATH_COUNTERS_TOTAL_GET, direction);
|
||||
|
||||
m_u32("hec", out.data.nHEC);
|
||||
m_u32("ibe", out.data.nIBE);
|
||||
m_u32("crc_p", out.data.nCRC_P);
|
||||
m_u32("crcp_p", out.data.nCRCP_P);
|
||||
m_u32("cv_p", out.data.nCV_P);
|
||||
m_u32("cvp_p", out.data.nCVP_P);
|
||||
}
|
||||
|
||||
static void retx_statistics(int fd, DSL_XTUDir_t direction) {
|
||||
#ifdef INCLUDE_DSL_CPE_PM_RETX_COUNTERS
|
||||
#ifdef INCLUDE_DSL_CPE_PM_RETX_THRESHOLDS
|
||||
IOCTL_DIR(DSL_ReTxStatistics_t, DSL_FIO_RETX_STATISTICS_GET, direction);
|
||||
|
||||
m_u32("rx_corrupted", out.data.nRxCorruptedTotal);
|
||||
m_u32("rx_uncorrected_protected", out.data.nRxUncorrectedProtected);
|
||||
m_u32("rx_retransmitted", out.data.nRxRetransmitted);
|
||||
m_u32("rx_corrected", out.data.nRxCorrected);
|
||||
m_u32("tx_retransmitted", out.data.nTxRetransmitted);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
static void describe_mode(standard_t standard, profile_t profile, vector_t vector) {
|
||||
char buf[128];
|
||||
|
||||
switch (standard) {
|
||||
case STD_T1_413:
|
||||
strcpy(buf, "T1.413");
|
||||
break;
|
||||
case STD_TS_101_388:
|
||||
strcpy(buf, "TS 101 388");
|
||||
break;
|
||||
case STD_G_992_1:
|
||||
strcpy(buf, "G.992.1 (ADSL)");
|
||||
break;
|
||||
case STD_G_992_2:
|
||||
strcpy(buf, "G.992.2 (ADSL lite)");
|
||||
break;
|
||||
case STD_G_992_3:
|
||||
strcpy(buf, "G.992.3 (ADSL2)");
|
||||
break;
|
||||
case STD_G_992_4:
|
||||
strcpy(buf, "G.992.4 (ADSL2 lite)");
|
||||
break;
|
||||
case STD_G_992_5:
|
||||
strcpy(buf, "G.992.5 (ADSL2+)");
|
||||
break;
|
||||
case STD_G_993_1:
|
||||
strcpy(buf, "G.993.1 (VDSL)");
|
||||
break;
|
||||
case STD_G_993_2:
|
||||
strcpy(buf, "G.993.2 (VDSL2");
|
||||
|
||||
switch (profile) {
|
||||
case PROFILE_8A:
|
||||
strcat(buf, ", Profile 8a");
|
||||
break;
|
||||
case PROFILE_8B:
|
||||
strcat(buf, ", Profile 8b");
|
||||
break;
|
||||
case PROFILE_8C:
|
||||
strcat(buf, ", Profile 8c");
|
||||
break;
|
||||
case PROFILE_8D:
|
||||
strcat(buf, ", Profile 8d");
|
||||
break;
|
||||
case PROFILE_12A:
|
||||
strcat(buf, ", Profile 12a");
|
||||
break;
|
||||
case PROFILE_12B:
|
||||
strcat(buf, ", Profile 12b");
|
||||
break;
|
||||
case PROFILE_17A:
|
||||
strcat(buf, ", Profile 17a");
|
||||
break;
|
||||
case PROFILE_30A:
|
||||
strcat(buf, ", Profile 30a");
|
||||
break;
|
||||
case PROFILE_35B:
|
||||
strcat(buf, ", Profile 35b");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
|
||||
switch (vector) {
|
||||
case VECTOR_ON_DS:
|
||||
strcat(buf, ", with downstream vectoring");
|
||||
break;
|
||||
case VECTOR_ON_DS_US:
|
||||
strcat(buf, ", with down- and upstream vectoring");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
|
||||
strcat(buf, ")");
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
};
|
||||
|
||||
m_str("mode", buf);
|
||||
}
|
||||
|
||||
static int metrics(struct ubus_context *ctx, struct ubus_object *obj,
|
||||
struct ubus_request_data *req, const char *method,
|
||||
struct blob_attr *msg)
|
||||
{
|
||||
int fd;
|
||||
void *c, *c2;
|
||||
standard_t standard = STD_UNKNOWN;
|
||||
profile_t profile = PROFILE_UNKNOWN;
|
||||
vector_t vector = VECTOR_UNKNOWN;
|
||||
|
||||
#ifndef INCLUDE_DSL_CPE_API_DANUBE
|
||||
fd = open(DSL_CPE_DEVICE_NAME "0", O_RDWR, 0644);
|
||||
#else
|
||||
fd = open(DSL_CPE_DEVICE_NAME, O_RDWR, 0644);
|
||||
#endif
|
||||
if (fd < 0)
|
||||
return UBUS_STATUS_UNKNOWN_ERROR;
|
||||
|
||||
blob_buf_init(&b, 0);
|
||||
|
||||
version_information(fd);
|
||||
line_state(fd);
|
||||
pm_channel_counters_showtime(fd);
|
||||
|
||||
c = blobmsg_open_table(&b, "atu_c");
|
||||
g997_line_inventory(fd);
|
||||
blobmsg_close_table(&b, c);
|
||||
|
||||
g997_power_management_status(fd);
|
||||
g997_xtu_system_enabling(fd, &standard);
|
||||
|
||||
if (standard == STD_G_993_2) {
|
||||
band_plan_status(fd, &profile);
|
||||
vector = get_vector_status();
|
||||
}
|
||||
|
||||
describe_mode(standard, profile, vector);
|
||||
|
||||
c = blobmsg_open_table(&b, "upstream");
|
||||
switch (vector) {
|
||||
case VECTOR_OFF:
|
||||
m_bool("vector", false);
|
||||
break;
|
||||
case VECTOR_ON_DS_US:
|
||||
m_bool("vector", true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
line_feature_config(fd, DSL_UPSTREAM);
|
||||
g997_channel_status(fd, DSL_UPSTREAM);
|
||||
g997_line_status(fd, DSL_UPSTREAM);
|
||||
blobmsg_close_table(&b, c);
|
||||
|
||||
c = blobmsg_open_table(&b, "downstream");
|
||||
switch (vector) {
|
||||
case VECTOR_OFF:
|
||||
m_bool("vector", false);
|
||||
break;
|
||||
case VECTOR_ON_DS:
|
||||
case VECTOR_ON_DS_US:
|
||||
m_bool("vector", true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
line_feature_config(fd, DSL_DOWNSTREAM);
|
||||
g997_channel_status(fd, DSL_DOWNSTREAM);
|
||||
g997_line_status(fd, DSL_DOWNSTREAM);
|
||||
blobmsg_close_table(&b, c);
|
||||
|
||||
c = blobmsg_open_table(&b, "errors");
|
||||
c2 = blobmsg_open_table(&b, "near");
|
||||
pm_line_sec_counters_total(fd, DSL_NEAR_END);
|
||||
pm_data_path_counters_total(fd, DSL_NEAR_END);
|
||||
retx_statistics(fd, DSL_NEAR_END);
|
||||
blobmsg_close_table(&b, c2);
|
||||
|
||||
c2 = blobmsg_open_table(&b, "far");
|
||||
pm_line_sec_counters_total(fd, DSL_FAR_END);
|
||||
pm_data_path_counters_total(fd, DSL_FAR_END);
|
||||
retx_statistics(fd, DSL_FAR_END);
|
||||
blobmsg_close_table(&b, c2);
|
||||
blobmsg_close_table(&b, c);
|
||||
|
||||
ubus_send_reply(ctx, req, b.head);
|
||||
|
||||
close(fd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct ubus_method dsl_methods[] = {
|
||||
UBUS_METHOD_NOARG("metrics", metrics),
|
||||
};
|
||||
|
||||
static struct ubus_object_type dsl_object_type =
|
||||
UBUS_OBJECT_TYPE("dsl", dsl_methods);
|
||||
|
||||
static struct ubus_object dsl_object = {
|
||||
.name = "dsl",
|
||||
.type = &dsl_object_type,
|
||||
.methods = dsl_methods,
|
||||
.n_methods = ARRAY_SIZE(dsl_methods),
|
||||
};
|
||||
|
||||
static DSL_int_t ubus_main(DSL_CPE_Thread_Params_t *params) {
|
||||
uloop_run();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ubus_init() {
|
||||
uloop_init();
|
||||
|
||||
ctx = ubus_connect(NULL);
|
||||
if (!ctx)
|
||||
return;
|
||||
|
||||
if (ubus_add_object(ctx, &dsl_object)) {
|
||||
ubus_free(ctx);
|
||||
ctx = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
ubus_add_uloop(ctx);
|
||||
|
||||
DSL_CPE_ThreadInit(&thread, "ubus", ubus_main, DSL_CPE_PIPE_STACK_SIZE, DSL_CPE_PIPE_PRIORITY, 0, 0);
|
||||
}
|
||||
|
||||
void ubus_deinit() {
|
||||
if (!ctx)
|
||||
return;
|
||||
|
||||
ubus_free(ctx);
|
||||
uloop_done();
|
||||
|
||||
DSL_CPE_ThreadShutdown(&thread, 1000);
|
||||
}
|
||||
@ -8,13 +8,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=dnsmasq
|
||||
PKG_UPSTREAM_VERSION:=2.84test3
|
||||
PKG_UPSTREAM_VERSION:=2.84
|
||||
PKG_VERSION:=$(subst test,~~test,$(subst rc,~rc,$(PKG_UPSTREAM_VERSION)))
|
||||
PKG_RELEASE:=1
|
||||
PKG_RELEASE:=$(AUTORELEASE)
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_UPSTREAM_VERSION).tar.xz
|
||||
PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq/test-releases
|
||||
PKG_HASH:=20d1109c991ca08778ea20322b8f3245f2e974688d494b59b2e6ae096ec592b1
|
||||
PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq
|
||||
PKG_HASH:=603195c64b73137609b07e1024ae0b37f652b2f5fe467dce66985b3d1850050c
|
||||
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
PKG_LICENSE_FILES:=COPYING
|
||||
@ -180,7 +180,6 @@ define Package/dnsmasq/install
|
||||
$(INSTALL_BIN) ./files/dhcp-script.sh $(1)/usr/lib/dnsmasq/dhcp-script.sh
|
||||
$(INSTALL_DIR) $(1)/usr/share/acl.d
|
||||
$(INSTALL_DATA) ./files/dnsmasq_acl.json $(1)/usr/share/acl.d/
|
||||
$(INSTALL_DATA) ./files/dnsmasqsec_hotplug_acl.json $(1)/usr/share/acl.d/
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./files/50-dnsmasq-migrate-resolv-conf-auto.sh $(1)/etc/uci-defaults
|
||||
endef
|
||||
|
||||
@ -2,45 +2,52 @@
|
||||
|
||||
[ -f "$USER_DHCPSCRIPT" ] && . "$USER_DHCPSCRIPT" "$@"
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
json_init
|
||||
json_add_array env
|
||||
hotplugobj=""
|
||||
|
||||
case "$1" in
|
||||
add)
|
||||
export ACTION="add"
|
||||
export MACADDR="$2"
|
||||
export IPADDR="$3"
|
||||
export HOSTNAME="$4"
|
||||
exec /sbin/hotplug-call dhcp
|
||||
;;
|
||||
del)
|
||||
export ACTION="remove"
|
||||
export MACADDR="$2"
|
||||
export IPADDR="$3"
|
||||
export HOSTNAME="$4"
|
||||
exec /sbin/hotplug-call dhcp
|
||||
;;
|
||||
old)
|
||||
export ACTION="update"
|
||||
export MACADDR="$2"
|
||||
export IPADDR="$3"
|
||||
export HOSTNAME="$4"
|
||||
exec /sbin/hotplug-call dhcp
|
||||
;;
|
||||
arp-add)
|
||||
export ACTION="add"
|
||||
export MACADDR="$2"
|
||||
export IPADDR="$3"
|
||||
exec /sbin/hotplug-call neigh
|
||||
;;
|
||||
arp-del)
|
||||
export ACTION="remove"
|
||||
export MACADDR="$2"
|
||||
export IPADDR="$3"
|
||||
exec /sbin/hotplug-call neigh
|
||||
;;
|
||||
tftp)
|
||||
export ACTION="add"
|
||||
export TFTP_SIZE="$2"
|
||||
export TFTP_ADDR="$3"
|
||||
export TFTP_PATH="$4"
|
||||
exec /sbin/hotplug-call tftp
|
||||
add | del | old | arp-add | arp-del)
|
||||
json_add_string "" "MACADDR=$2"
|
||||
json_add_string "" "IPADDR=$3"
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$1" in
|
||||
add)
|
||||
json_add_string "" "ACTION=add"
|
||||
json_add_string "" "HOSTNAME=$4"
|
||||
hotplugobj="dhcp"
|
||||
;;
|
||||
del)
|
||||
json_add_string "" "ACTION=remove"
|
||||
json_add_string "" "HOSTNAME=$4"
|
||||
hotplugobj="dhcp"
|
||||
;;
|
||||
old)
|
||||
json_add_string "" "ACTION=update"
|
||||
json_add_string "" "HOSTNAME=$4"
|
||||
hotplugobj="dhcp"
|
||||
;;
|
||||
arp-add)
|
||||
json_add_string "" "ACTION=add"
|
||||
hotplugobj="neigh"
|
||||
;;
|
||||
arp-del)
|
||||
json_add_string "" "ACTION=remove"
|
||||
hotplugobj="neigh"
|
||||
;;
|
||||
tftp)
|
||||
json_add_string "" "ACTION=add"
|
||||
json_add_string "" "TFTP_SIZE=$2"
|
||||
json_add_string "" "TFTP_ADDR=$3"
|
||||
json_add_string "" "TFTP_PATH=$4"
|
||||
hotplugobj="tftp"
|
||||
;;
|
||||
esac
|
||||
|
||||
json_close_array env
|
||||
|
||||
[ -n "$hotplugobj" ] && ubus call hotplug.${hotplugobj} call "$(json_dump)"
|
||||
|
||||
@ -1,4 +1,12 @@
|
||||
{
|
||||
"user": "dnsmasq",
|
||||
"publish": [ "dnsmasq" ]
|
||||
"publish": [ "dnsmasq" ],
|
||||
"access": {
|
||||
"hotplug.dhcp": {
|
||||
"methods": [ "call" ]
|
||||
},
|
||||
"hotplug.neigh": {
|
||||
"methods": [ "call" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@ TIMEVALIDFILE="/var/state/dnsmasqsec"
|
||||
[ -f "$TIMEVALIDFILE" ] || {
|
||||
echo "ntpd says time is valid" >$TIMEVALIDFILE
|
||||
/etc/init.d/dnsmasq enabled && {
|
||||
initscript=dnsmasq
|
||||
. /lib/functions/procd.sh
|
||||
procd_send_signal dnsmasq '*' INT
|
||||
}
|
||||
|
||||
@ -1,8 +0,0 @@
|
||||
{
|
||||
"user": "ntp",
|
||||
"access": {
|
||||
"service": {
|
||||
"methods": [ "signal" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,45 @@
|
||||
From f1204a875e0f16fd645df965db346fc56d2ab1dd Mon Sep 17 00:00:00 2001
|
||||
From: Simon Kelley <simon@thekelleys.org.uk>
|
||||
Date: Fri, 29 Jan 2021 23:20:06 +0000
|
||||
Subject: [PATCH 1/2] Tweak sort order of tags in get-version.
|
||||
|
||||
We want to sort such that the most recent/relevant tag is first
|
||||
and gets used to set the compiled-in version.
|
||||
|
||||
The solution is far from general, but works for the tag formats
|
||||
used by dnsmasq. v2.84 sorts before v2.83, but v2.83 sorts
|
||||
before v2.83rc1 and 2.83rc1 sorts before v2.83test1
|
||||
|
||||
Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
|
||||
---
|
||||
bld/get-version | 7 +++++--
|
||||
1 file changed, 5 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/bld/get-version b/bld/get-version
|
||||
index e472aab..1d7e7f0 100755
|
||||
--- a/bld/get-version
|
||||
+++ b/bld/get-version
|
||||
@@ -9,7 +9,10 @@
|
||||
# If we can find one which matches $v[0-9].* then we assume it's
|
||||
# a version-number tag, else we just use the whole string.
|
||||
# If there is more than one v[0-9].* tag, sort them and use the
|
||||
-# first. This favours, eg v2.63 over 2.63rc6.
|
||||
+# first. The insane arguments to the sort command are to ensure
|
||||
+# that, eg v2.64 comes before v2.63, but v2.63 comes before v2.63rc1
|
||||
+# and v2.63rc1 comes before v2.63test1
|
||||
+
|
||||
|
||||
# Change directory to the toplevel source directory.
|
||||
if test -z "$1" || ! test -d "$1" || ! cd "$1"; then
|
||||
@@ -28,7 +31,7 @@ else
|
||||
vers=`cat $1/VERSION | sed 's/[(), ]/,/ g' | tr ',' '\n' | grep ^v[0-9]`
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
- echo "${vers}" | sort -r | head -n 1 | sed 's/^v//'
|
||||
+ echo "${vers}" | sort -k1.2,1.5r -k 1.6,1.6 -k1.8,1.9r -k1.10,1.11r | head -n 1 | sed 's/^v//'
|
||||
else
|
||||
cat $1/VERSION
|
||||
fi
|
||||
--
|
||||
2.24.3 (Apple Git-128)
|
||||
|
||||
@ -0,0 +1,28 @@
|
||||
From cfcafdd27c74dc187fe96a9cfa88b1aef53540a0 Mon Sep 17 00:00:00 2001
|
||||
From: Simon Kelley <simon@thekelleys.org.uk>
|
||||
Date: Mon, 1 Feb 2021 23:46:43 +0000
|
||||
Subject: [PATCH 2/2] Tweak f1204a875e0f16fd645df965db346fc56d2ab1dd
|
||||
|
||||
This gets, eg, v2.65test1 and v2.65test11 in the correct order.
|
||||
|
||||
Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
|
||||
---
|
||||
bld/get-version | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/bld/get-version b/bld/get-version
|
||||
index 1d7e7f0..1f51768 100755
|
||||
--- a/bld/get-version
|
||||
+++ b/bld/get-version
|
||||
@@ -31,7 +31,7 @@ else
|
||||
vers=`cat $1/VERSION | sed 's/[(), ]/,/ g' | tr ',' '\n' | grep ^v[0-9]`
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
- echo "${vers}" | sort -k1.2,1.5r -k 1.6,1.6 -k1.8,1.9r -k1.10,1.11r | head -n 1 | sed 's/^v//'
|
||||
+ echo "${vers}" | sort -k1.2,1.5Vr -k1.6,1.6 -k1.8,1.9Vr -k1.10,1.11Vr | head -n 1 | sed 's/^v//'
|
||||
else
|
||||
cat $1/VERSION
|
||||
fi
|
||||
--
|
||||
2.24.3 (Apple Git-128)
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ltq-dsl-base
|
||||
PKG_RELEASE:=2
|
||||
PKG_RELEASE:=3
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
||||
@ -1,749 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2012-2014 OpenWrt.org
|
||||
|
||||
if [ "$( which vdsl_cpe_control )" ]; then
|
||||
XDSL_CTRL=vdsl_cpe_control
|
||||
else
|
||||
XDSL_CTRL=dsl_cpe_control
|
||||
fi
|
||||
|
||||
#
|
||||
# Basic functions to send CLI commands to the vdsl_cpe_control daemon
|
||||
#
|
||||
dsl_cmd() {
|
||||
killall -q -0 ${XDSL_CTRL} && (
|
||||
lock /var/lock/dsl_pipe
|
||||
echo "$@" > /tmp/pipe/dsl_cpe0_cmd
|
||||
cat /tmp/pipe/dsl_cpe0_ack
|
||||
lock -u /var/lock/dsl_pipe
|
||||
)
|
||||
}
|
||||
dsl_val() {
|
||||
expr "$1" : '.*'$2'=\([-\.[:alnum:]]*\).*'
|
||||
}
|
||||
dsl_string() {
|
||||
expr "$1" : '.*'$2'=(\([A-Z0-9,]*\))'
|
||||
}
|
||||
|
||||
#
|
||||
# Simple divide by 10 routine to cope with one decimal place
|
||||
#
|
||||
dbt() {
|
||||
local a=$(expr $1 / 10)
|
||||
local b=$(expr $1 % 10)
|
||||
echo "${a}.${b#-}"
|
||||
}
|
||||
#
|
||||
# Take a number and convert to k or meg
|
||||
#
|
||||
scale() {
|
||||
local val=$1
|
||||
local a
|
||||
local b
|
||||
|
||||
if [ "$val" -gt 1000000 ]; then
|
||||
a=$(expr $val / 1000)
|
||||
b=$(expr $a % 1000)
|
||||
a=$(expr $a / 1000)
|
||||
printf "%d.%03d Mb" ${a} ${b}
|
||||
elif [ "$val" -gt 1000 ]; then
|
||||
a=$(expr $val / 1000)
|
||||
printf "%d Kb" ${a}
|
||||
else
|
||||
echo "${val} b"
|
||||
fi
|
||||
}
|
||||
|
||||
scale_latency() {
|
||||
local val=$1
|
||||
local a
|
||||
local b
|
||||
|
||||
a=$(expr $val / 100)
|
||||
b=$(expr $val % 100)
|
||||
printf "%d.%d ms" ${a} ${b}
|
||||
}
|
||||
|
||||
scale_latency_us() {
|
||||
local val=$1
|
||||
|
||||
expr $val \* 10
|
||||
}
|
||||
|
||||
#
|
||||
# convert vendorid into human readable form
|
||||
#
|
||||
parse_vendorid() {
|
||||
local val=$1
|
||||
local name
|
||||
local version
|
||||
|
||||
case "$val" in
|
||||
B5,00,41,4C,43,42*)
|
||||
name="Alcatel"
|
||||
version=${val##*B5,00,41,4C,43,42,}
|
||||
;;
|
||||
B5,00,41,4E,44,56*)
|
||||
name="Analog Devices"
|
||||
version=${val##*B5,00,41,4E,44,56,}
|
||||
;;
|
||||
B5,00,42,44,43,4D*)
|
||||
name="Broadcom"
|
||||
version=${val##*B5,00,42,44,43,4D,}
|
||||
;;
|
||||
B5,00,43,45,4E,54*)
|
||||
name="Centillium"
|
||||
version=${val##*B5,00,43,45,4E,54,}
|
||||
;;
|
||||
B5,00,47,53,50,4E*)
|
||||
name="Globespan"
|
||||
version=${val##*B5,00,47,53,50,4E,}
|
||||
;;
|
||||
B5,00,49,4B,4E,53*)
|
||||
name="Ikanos"
|
||||
version=${val##*B5,00,49,4B,4E,53,}
|
||||
;;
|
||||
B5,00,49,46,54,4E*)
|
||||
name="Infineon"
|
||||
version=${val##*B5,00,49,46,54,4E,}
|
||||
;;
|
||||
B5,00,54,53,54,43*)
|
||||
name="Texas Instruments"
|
||||
version=${val##*B5,00,54,53,54,43,}
|
||||
;;
|
||||
B5,00,54,4D,4D,42*)
|
||||
name="Thomson MultiMedia Broadband"
|
||||
version=${val##*B5,00,54,4D,4D,42,}
|
||||
;;
|
||||
B5,00,54,43,54,4E*)
|
||||
name="Trend Chip Technologies"
|
||||
version=${val##*B5,00,54,43,54,4E,}
|
||||
;;
|
||||
B5,00,53,54,4D,49*)
|
||||
name="ST Micro"
|
||||
version=${val##*B5,00,53,54,4D,49,}
|
||||
;;
|
||||
esac
|
||||
|
||||
[ -n "$name" ] && {
|
||||
val="$name"
|
||||
|
||||
[ "$version" != "00,00" ] && val="$(printf "%s %d.%d" "$val" 0x${version//,/ 0x})"
|
||||
}
|
||||
|
||||
echo "$val"
|
||||
}
|
||||
|
||||
#
|
||||
# Read the data rates for both directions
|
||||
#
|
||||
data_rates() {
|
||||
local csg
|
||||
local dru
|
||||
local drd
|
||||
local sdru
|
||||
local sdrd
|
||||
|
||||
csg=$(dsl_cmd g997csg 0 1)
|
||||
drd=$(dsl_val "$csg" ActualDataRate)
|
||||
|
||||
csg=$(dsl_cmd g997csg 0 0)
|
||||
dru=$(dsl_val "$csg" ActualDataRate)
|
||||
|
||||
[ -z "$drd" ] && drd=0
|
||||
[ -z "$dru" ] && dru=0
|
||||
|
||||
sdrd=$(scale $drd)
|
||||
sdru=$(scale $dru)
|
||||
|
||||
if [ "$action" = "lucistat" ]; then
|
||||
echo "dsl.data_rate_down=$drd"
|
||||
echo "dsl.data_rate_up=$dru"
|
||||
echo "dsl.data_rate_down_s=\"$sdrd\""
|
||||
echo "dsl.data_rate_up_s=\"$sdru\""
|
||||
else
|
||||
echo "Data Rate: Down: ${sdrd}/s / Up: ${sdru}/s"
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Chipset
|
||||
#
|
||||
chipset() {
|
||||
local vig
|
||||
local cs
|
||||
|
||||
vig=$(dsl_cmd vig)
|
||||
cs=$(dsl_val "$vig" DSL_ChipSetType)
|
||||
csfw=$(dsl_val "$vig" DSL_ChipSetFWVersion)
|
||||
csapi=$(dsl_val "$vig" DSL_DriverVersionApi)
|
||||
|
||||
if [ "$action" = "lucistat" ]; then
|
||||
echo "dsl.chipset=\"${cs}\""
|
||||
echo "dsl.firmware_version=\"${csfw}\""
|
||||
echo "dsl.api_version=\"${csapi}\""
|
||||
else
|
||||
echo "Chipset: ${cs}"
|
||||
echo "Firmware Version: ${csfw}"
|
||||
echo "API Version: ${csapi}"
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Vendor information
|
||||
#
|
||||
vendor() {
|
||||
local lig
|
||||
local vid
|
||||
local svid
|
||||
|
||||
lig=$(dsl_cmd g997lig 1)
|
||||
vid=$(dsl_string "$lig" G994VendorID)
|
||||
svid=$(dsl_string "$lig" SystemVendorID)
|
||||
|
||||
vid=$(parse_vendorid $vid)
|
||||
svid=$(parse_vendorid $svid)
|
||||
|
||||
if [ "$action" = "lucistat" ]; then
|
||||
echo "dsl.atuc_vendor_id=\"${vid}\""
|
||||
echo "dsl.atuc_system_vendor_id=\"${svid}\""
|
||||
else
|
||||
echo "ATU-C Vendor ID: ${vid}"
|
||||
echo "ATU-C System Vendor ID: ${svid}"
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# XTSE capabilities
|
||||
#
|
||||
xtse() {
|
||||
local xtusesg
|
||||
local xtse1
|
||||
local xtse2
|
||||
local xtse3
|
||||
local xtse4
|
||||
local xtse5
|
||||
local xtse6
|
||||
local xtse7
|
||||
local xtse8
|
||||
|
||||
local xtse_s=""
|
||||
|
||||
local annex_s=""
|
||||
local line_mode_s=""
|
||||
local vector_s=""
|
||||
|
||||
local dsmsg=""
|
||||
local cmd=""
|
||||
|
||||
xtusesg=$(dsl_cmd g997xtusesg)
|
||||
xtse1=$(dsl_val "$xtusesg" XTSE1)
|
||||
xtse2=$(dsl_val "$xtusesg" XTSE2)
|
||||
xtse3=$(dsl_val "$xtusesg" XTSE3)
|
||||
xtse4=$(dsl_val "$xtusesg" XTSE4)
|
||||
xtse5=$(dsl_val "$xtusesg" XTSE5)
|
||||
xtse6=$(dsl_val "$xtusesg" XTSE6)
|
||||
xtse7=$(dsl_val "$xtusesg" XTSE7)
|
||||
xtse8=$(dsl_val "$xtusesg" XTSE8)
|
||||
|
||||
# Evaluate Annex (according to G.997.1, 7.3.1.1.1)
|
||||
if [ $((xtse1 & 13)) != 0 \
|
||||
-o $((xtse2 & 1)) != 0 \
|
||||
-o $((xtse3 & 12)) != 0 \
|
||||
-o $((xtse4 & 3)) != 0 \
|
||||
-o $((xtse6 & 3)) != 0 \
|
||||
-o $((xtse8 & 1)) != 0 ]; then
|
||||
annex_s=" A,"
|
||||
fi
|
||||
|
||||
if [ $((xtse1 & 48)) != 0 \
|
||||
-o $((xtse2 & 2)) != 0 \
|
||||
-o $((xtse3 & 48)) != 0 \
|
||||
-o $((xtse6 & 12)) != 0 \
|
||||
-o $((xtse8 & 2)) != 0 ]; then
|
||||
annex_s="$annex_s B,"
|
||||
fi
|
||||
|
||||
if [ $((xtse1 & 194)) != 0 \
|
||||
-o $((xtse2 & 12)) != 0 \
|
||||
-o $((xtse8 & 4)) != 0 ]; then
|
||||
annex_s="$annex_s C,"
|
||||
fi
|
||||
|
||||
if [ $((xtse4 & 48)) != 0 \
|
||||
-o $((xtse5 & 3)) != 0 \
|
||||
-o $((xtse6 & 192)) != 0 ]; then
|
||||
annex_s="$annex_s I,"
|
||||
fi
|
||||
|
||||
if [ $((xtse4 & 192)) != 0 \
|
||||
-o $((xtse7 & 3)) != 0 ]; then
|
||||
annex_s="$annex_s J,"
|
||||
fi
|
||||
|
||||
if [ $((xtse5 & 60)) != 0 ]; then
|
||||
annex_s="$annex_s L,"
|
||||
fi
|
||||
|
||||
if [ $((xtse5 & 192)) != 0 \
|
||||
-o $((xtse7 & 12)) != 0 ]; then
|
||||
annex_s="$annex_s M,"
|
||||
fi
|
||||
|
||||
annex_s=${annex_s:1}
|
||||
annex_s=${annex_s%?}
|
||||
|
||||
# Evaluate Line Mode (according to G.997.1, 7.3.1.1.1)
|
||||
|
||||
# Regional standard: ANSI T1.413
|
||||
if [ $((xtse1 & 1)) != 0 ]; then
|
||||
line_mode_s=" T1.413,"
|
||||
fi
|
||||
|
||||
# Regional standard: TS 101 388
|
||||
if [ $((xtse1 & 1)) != 0 ]; then
|
||||
line_mode_s="$line_mode_s TS 101 388,"
|
||||
fi
|
||||
|
||||
if [ $((xtse1 & 252)) != 0 ]; then
|
||||
line_mode_s="$line_mode_s G.992.1 (ADSL),"
|
||||
fi
|
||||
|
||||
if [ $((xtse2 & 15)) != 0 ]; then
|
||||
line_mode_s="$line_mode_s G.992.2 (ADSL lite),"
|
||||
fi
|
||||
|
||||
if [ $((xtse3 & 60)) != 0 \
|
||||
-o $((xtse4 & 240)) != 0 \
|
||||
-o $((xtse5 & 252)) != 0 ]; then
|
||||
line_mode_s="$line_mode_s G.992.3 (ADSL2),"
|
||||
fi
|
||||
|
||||
if [ $((xtse4 & 3)) != 0 \
|
||||
-o $((xtse5 & 3)) != 0 ]; then
|
||||
line_mode_s="$line_mode_s G.992.4 (ADSL2 lite),"
|
||||
fi
|
||||
|
||||
if [ $((xtse6 & 199)) != 0 \
|
||||
-o $((xtse7 & 15)) != 0 ]; then
|
||||
line_mode_s="$line_mode_s G.992.5 (ADSL2+),"
|
||||
fi
|
||||
|
||||
if [ $((xtse8 & 7)) != 0 ]; then
|
||||
dsmsg=$(dsl_cmd dsmsg)
|
||||
vector_s=$(dsl_val "$dsmsg" eVectorStatus)
|
||||
|
||||
case "$vector_s" in
|
||||
"0") line_mode_s="$line_mode_s G.993.2 (VDSL2)," ;;
|
||||
"1") line_mode_s="$line_mode_s G.993.5 (VDSL2 with downstream vectoring)," ;;
|
||||
"2") line_mode_s="$line_mode_s G.993.5 (VDSL2 with down- and upstream vectoring)," ;;
|
||||
*) line_mode_s="$line_mode_s unknown," ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
#!!! PROPRIETARY & INTERMEDIATE USE !!!
|
||||
if [ $((xtse8 & 128)) != 0 ]; then
|
||||
line_mode_s="$line_mode_s G.993.1 (VDSL),"
|
||||
fi
|
||||
|
||||
line_mode_s=${line_mode_s:1}
|
||||
line_mode_s=${line_mode_s%?}
|
||||
|
||||
xtse_s="${xtse1}, ${xtse2}, ${xtse3}, ${xtse4}, ${xtse5}, ${xtse6}, ${xtse7}, ${xtse8}"
|
||||
|
||||
if [ "$action" = "lucistat" ]; then
|
||||
echo "dsl.xtse1=${xtse1:-nil}"
|
||||
echo "dsl.xtse2=${xtse2:-nil}"
|
||||
echo "dsl.xtse3=${xtse3:-nil}"
|
||||
echo "dsl.xtse4=${xtse4:-nil}"
|
||||
echo "dsl.xtse5=${xtse5:-nil}"
|
||||
echo "dsl.xtse6=${xtse6:-nil}"
|
||||
echo "dsl.xtse7=${xtse7:-nil}"
|
||||
echo "dsl.xtse8=${xtse8:-nil}"
|
||||
echo "dsl.xtse_s=\"$xtse_s\""
|
||||
echo "dsl.annex_s=\"${annex_s}\""
|
||||
echo "dsl.line_mode_s=\"${line_mode_s}\""
|
||||
else
|
||||
echo "XTSE Capabilities: ${xtse_s}"
|
||||
echo "Annex: ${annex_s}"
|
||||
echo "Line Mode: ${line_mode_s}"
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Power Management Mode
|
||||
#
|
||||
power_mode() {
|
||||
local pmsg=$(dsl_cmd g997pmsg)
|
||||
local pm=$(dsl_val "$pmsg" nPowerManagementStatus);
|
||||
local s;
|
||||
|
||||
case "$pm" in
|
||||
"-1") s="Power management state is not available" ;;
|
||||
"0") s="L0 - Synchronized" ;;
|
||||
"1") s="L1 - Power Down Data transmission (G.992.2)" ;;
|
||||
"2") s="L2 - Power Down Data transmission (G.992.3 and G.992.4)" ;;
|
||||
"3") s="L3 - No power" ;;
|
||||
*) s="unknown" ;;
|
||||
esac
|
||||
|
||||
if [ "$action" = "lucistat" ]; then
|
||||
echo "dsl.power_mode_num=${pm:-nil}"
|
||||
echo "dsl.power_mode_s=\"$s\""
|
||||
else
|
||||
echo "Power Management Mode: $s"
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Latency type (interleave delay)
|
||||
#
|
||||
latency_delay() {
|
||||
local csg
|
||||
|
||||
local idu
|
||||
local idu_s;
|
||||
local sidu
|
||||
|
||||
local idd
|
||||
local idd_s;
|
||||
local sidd
|
||||
|
||||
csg=$(dsl_cmd g997csg 0 1)
|
||||
idd=$(dsl_val "$csg" ActualInterleaveDelay)
|
||||
|
||||
csg=$(dsl_cmd g997csg 0 0)
|
||||
idu=$(dsl_val "$csg" ActualInterleaveDelay)
|
||||
|
||||
[ -z "$idd" ] && idd=0
|
||||
[ -z "$idu" ] && idu=0
|
||||
|
||||
if [ "$idd" -gt 100 ]; then
|
||||
idd_s="Interleave"
|
||||
else
|
||||
idd_s="Fast"
|
||||
fi
|
||||
|
||||
if [ "$idu" -gt 100 ]; then
|
||||
idu_s="Interleave"
|
||||
else
|
||||
idu_s="Fast"
|
||||
fi
|
||||
|
||||
sidu=$(scale_latency $idu)
|
||||
sidd=$(scale_latency $idd)
|
||||
|
||||
if [ "$action" = "lucistat" ]; then
|
||||
echo "dsl.latency_down=\"$(scale_latency_us $idd)\""
|
||||
echo "dsl.latency_up=\"$(scale_latency_us $idu)\""
|
||||
echo "dsl.latency_num_down=\"$sidd\""
|
||||
echo "dsl.latency_num_up=\"$sidu\""
|
||||
echo "dsl.latency_s_down=\"$idd_s\""
|
||||
echo "dsl.latency_s_up=\"$idu_s\""
|
||||
else
|
||||
echo "Latency [Interleave Delay]: ${sidd} [${idd_s}] ${sidu} [${idu_s}]"
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Errors
|
||||
#
|
||||
errors() {
|
||||
local lsctg
|
||||
local dpctg
|
||||
local fecsf
|
||||
local fecsn
|
||||
local esf
|
||||
local esn
|
||||
local sesf
|
||||
local sesn
|
||||
local lossf
|
||||
local lossn
|
||||
local uasf
|
||||
local uasn
|
||||
|
||||
local crc_pf
|
||||
local crc_pn
|
||||
local crcp_pf
|
||||
local crcp_pn
|
||||
local hecf
|
||||
local hecn
|
||||
|
||||
lsctg=$(dsl_cmd pmlsctg 1)
|
||||
fecsf=$(dsl_val "$lsctg" nFECS)
|
||||
esf=$(dsl_val "$lsctg" nES)
|
||||
sesf=$(dsl_val "$lsctg" nSES)
|
||||
lossf=$(dsl_val "$lsctg" nLOSS)
|
||||
uasf=$(dsl_val "$lsctg" nUAS)
|
||||
|
||||
lsctg=$(dsl_cmd pmlsctg 0)
|
||||
fecsn=$(dsl_val "$lsctg" nFECS)
|
||||
esn=$(dsl_val "$lsctg" nES)
|
||||
sesn=$(dsl_val "$lsctg" nSES)
|
||||
lossn=$(dsl_val "$lsctg" nLOSS)
|
||||
uasn=$(dsl_val "$lsctg" nUAS)
|
||||
|
||||
dpctg=$(dsl_cmd pmdpctg 0 1)
|
||||
hecf=$(dsl_val "$dpctg" nHEC)
|
||||
crc_pf=$(dsl_val "$dpctg" nCRC_P)
|
||||
crcp_pf=$(dsl_val "$dpctg" nCRCP_P)
|
||||
|
||||
dpctg=$(dsl_cmd pmdpctg 0 0)
|
||||
hecn=$(dsl_val "$dpctg" nHEC)
|
||||
crc_pn=$(dsl_val "$dpctg" nCRC_P)
|
||||
crcp_pn=$(dsl_val "$dpctg" nCRCP_P)
|
||||
|
||||
if [ "$action" = "lucistat" ]; then
|
||||
echo "dsl.errors_fecs_near=${fecsn:-nil}"
|
||||
echo "dsl.errors_fecs_far=${fecsf:-nil}"
|
||||
echo "dsl.errors_es_near=${esn:-nil}"
|
||||
echo "dsl.errors_es_far=${esf:-nil}"
|
||||
echo "dsl.errors_ses_near=${sesn:-nil}"
|
||||
echo "dsl.errors_ses_far=${sesf:-nil}"
|
||||
echo "dsl.errors_loss_near=${lossn:-nil}"
|
||||
echo "dsl.errors_loss_far=${lossf:-nil}"
|
||||
echo "dsl.errors_uas_near=${uasn:-nil}"
|
||||
echo "dsl.errors_uas_far=${uasf:-nil}"
|
||||
echo "dsl.errors_hec_near=${hecn:-nil}"
|
||||
echo "dsl.errors_hec_far=${hecf:-nil}"
|
||||
echo "dsl.errors_crc_p_near=${crc_pn:-nil}"
|
||||
echo "dsl.errors_crc_p_far=${crc_pf:-nil}"
|
||||
echo "dsl.errors_crcp_p_near=${crcp_pn:-nil}"
|
||||
echo "dsl.errors_crcp_p_far=${crcp_pf:-nil}"
|
||||
else
|
||||
echo "Forward Error Correction Seconds (FECS): Near: ${fecsn} / Far: ${fecsf}"
|
||||
echo "Errored seconds (ES): Near: ${esn} / Far: ${esf}"
|
||||
echo "Severely Errored Seconds (SES): Near: ${sesn} / Far: ${sesf}"
|
||||
echo "Loss of Signal Seconds (LOSS): Near: ${lossn} / Far: ${lossf}"
|
||||
echo "Unavailable Seconds (UAS): Near: ${uasn} / Far: ${uasf}"
|
||||
echo "Header Error Code Errors (HEC): Near: ${hecn} / Far: ${hecf}"
|
||||
echo "Non Pre-emtive CRC errors (CRC_P): Near: ${crc_pn} / Far: ${crc_pf}"
|
||||
echo "Pre-emtive CRC errors (CRCP_P): Near: ${crcp_pn} / Far: ${crcp_pf}"
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Work out how long the line has been up
|
||||
#
|
||||
line_uptime() {
|
||||
local ccsg
|
||||
local et
|
||||
local etr
|
||||
local d
|
||||
local h
|
||||
local m
|
||||
local s
|
||||
local rc=""
|
||||
|
||||
ccsg=$(dsl_cmd pmccsg 0 0 0)
|
||||
et=$(dsl_val "$ccsg" nElapsedTime)
|
||||
|
||||
[ -z "$et" ] && et=0
|
||||
|
||||
d=$(expr $et / 86400)
|
||||
etr=$(expr $et % 86400)
|
||||
h=$(expr $etr / 3600)
|
||||
etr=$(expr $etr % 3600)
|
||||
m=$(expr $etr / 60)
|
||||
s=$(expr $etr % 60)
|
||||
|
||||
|
||||
[ "${d}${h}${m}${s}" -ne 0 ] && rc="${s}s"
|
||||
[ "${d}${h}${m}" -ne 0 ] && rc="${m}m ${rc}"
|
||||
[ "${d}${h}" -ne 0 ] && rc="${h}h ${rc}"
|
||||
[ "${d}" -ne 0 ] && rc="${d}d ${rc}"
|
||||
|
||||
[ -z "$rc" ] && rc="down"
|
||||
|
||||
|
||||
if [ "$action" = "lucistat" ]; then
|
||||
echo "dsl.line_uptime=${et}"
|
||||
echo "dsl.line_uptime_s=\"${rc}\""
|
||||
else
|
||||
|
||||
echo "Line Uptime Seconds: ${et}"
|
||||
echo "Line Uptime: ${rc}"
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Get noise and attenuation figures
|
||||
#
|
||||
line_data() {
|
||||
local lsg
|
||||
local latnu
|
||||
local latnd
|
||||
local satnu
|
||||
local satnd
|
||||
local snru
|
||||
local snrd
|
||||
local attndru
|
||||
local attndrd
|
||||
local sattndru
|
||||
local sattndrd
|
||||
local actatpu
|
||||
local actatpd
|
||||
|
||||
lsg=$(dsl_cmd g997lsg 1 1)
|
||||
latnd=$(dsl_val "$lsg" LATN)
|
||||
satnd=$(dsl_val "$lsg" SATN)
|
||||
snrd=$(dsl_val "$lsg" SNR)
|
||||
attndrd=$(dsl_val "$lsg" ATTNDR)
|
||||
actatpd=$(dsl_val "$lsg" ACTATP)
|
||||
|
||||
lsg=$(dsl_cmd g997lsg 0 1)
|
||||
latnu=$(dsl_val "$lsg" LATN)
|
||||
satnu=$(dsl_val "$lsg" SATN)
|
||||
snru=$(dsl_val "$lsg" SNR)
|
||||
attndru=$(dsl_val "$lsg" ATTNDR)
|
||||
actatpu=$(dsl_val "$lsg" ACTATP)
|
||||
|
||||
[ -z "$latnd" ] && latnd=0
|
||||
[ -z "$latnu" ] && latnu=0
|
||||
[ -z "$satnd" ] && satnd=0
|
||||
[ -z "$satnu" ] && satnu=0
|
||||
[ -z "$snrd" ] && snrd=0
|
||||
[ -z "$snru" ] && snru=0
|
||||
[ -z "$actatpd" ] && actatpd=0
|
||||
[ -z "$actatpu" ] && actatpu=0
|
||||
|
||||
latnd=$(dbt $latnd)
|
||||
latnu=$(dbt $latnu)
|
||||
satnd=$(dbt $satnd)
|
||||
satnu=$(dbt $satnu)
|
||||
snrd=$(dbt $snrd)
|
||||
snru=$(dbt $snru)
|
||||
actatpd=$(dbt $actatpd)
|
||||
actatpu=$(dbt $actatpu)
|
||||
|
||||
[ -z "$attndrd" ] && attndrd=0
|
||||
[ -z "$attndru" ] && attndru=0
|
||||
|
||||
sattndrd=$(scale $attndrd)
|
||||
sattndru=$(scale $attndru)
|
||||
|
||||
if [ "$action" = "lucistat" ]; then
|
||||
echo "dsl.line_attenuation_down=\"$latnd\""
|
||||
echo "dsl.line_attenuation_up=\"$latnu\""
|
||||
echo "dsl.noise_margin_down=\"$snrd\""
|
||||
echo "dsl.noise_margin_up=\"$snru\""
|
||||
echo "dsl.signal_attenuation_down=\"$satnd\""
|
||||
echo "dsl.signal_attenuation_up=\"$satnu\""
|
||||
echo "dsl.actatp_down=\"$actatpd\""
|
||||
echo "dsl.actatp_up=\"$actatpu\""
|
||||
echo "dsl.max_data_rate_down=$attndrd"
|
||||
echo "dsl.max_data_rate_up=$attndru"
|
||||
echo "dsl.max_data_rate_down_s=\"$sattndrd\""
|
||||
echo "dsl.max_data_rate_up_s=\"$sattndru\""
|
||||
else
|
||||
echo "Line Attenuation (LATN): Down: ${latnd} dB / Up: ${latnu} dB"
|
||||
echo "Signal Attenuation (SATN): Down: ${satnd} dB / Up: ${satnu} dB"
|
||||
echo "Noise Margin (SNR): Down: ${snrd} dB / Up: ${snru} dB"
|
||||
echo "Aggregate Transmit Power (ACTATP): Down: ${actatpd} dB / Up: ${actatpu} dB"
|
||||
echo "Max. Attainable Data Rate (ATTNDR): Down: ${sattndrd}/s / Up: ${sattndru}/s"
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Is the line up? Or what state is it in?
|
||||
#
|
||||
line_state() {
|
||||
local lsg=$(dsl_cmd lsg)
|
||||
local ls=$(dsl_val "$lsg" nLineState);
|
||||
local s;
|
||||
|
||||
case "$ls" in
|
||||
"0x0") s="not initialized" ;;
|
||||
"0x1") s="exception" ;;
|
||||
"0x10") s="not updated" ;;
|
||||
"0xff") s="idle request" ;;
|
||||
"0x100") s="idle" ;;
|
||||
"0x1ff") s="silent request" ;;
|
||||
"0x200") s="silent" ;;
|
||||
"0x300") s="handshake" ;;
|
||||
"0x380") s="full_init" ;;
|
||||
"0x400") s="discovery" ;;
|
||||
"0x500") s="training" ;;
|
||||
"0x600") s="analysis" ;;
|
||||
"0x700") s="exchange" ;;
|
||||
"0x800") s="showtime_no_sync" ;;
|
||||
"0x801") s="showtime_tc_sync" ;;
|
||||
"0x900") s="fastretrain" ;;
|
||||
"0xa00") s="lowpower_l2" ;;
|
||||
"0xb00") s="loopdiagnostic active" ;;
|
||||
"0xb10") s="loopdiagnostic data exchange" ;;
|
||||
"0xb20") s="loopdiagnostic data request" ;;
|
||||
"0xc00") s="loopdiagnostic complete" ;;
|
||||
"0x1000000") s="test" ;;
|
||||
"0xd00") s="resync" ;;
|
||||
"0x3c0") s="short init entry" ;;
|
||||
"") s="not running daemon"; ls="0xfff" ;;
|
||||
*) s="unknown" ;;
|
||||
esac
|
||||
|
||||
if [ "$action" = "lucistat" ]; then
|
||||
echo "dsl.line_state_num=$ls"
|
||||
echo "dsl.line_state_detail=\"$s\""
|
||||
if [ "$ls" = "0x801" ]; then
|
||||
echo "dsl.line_state=\"UP\""
|
||||
else
|
||||
echo "dsl.line_state=\"DOWN\""
|
||||
fi
|
||||
else
|
||||
if [ "$ls" = "0x801" ]; then
|
||||
echo "Line State: UP [$ls: $s]"
|
||||
else
|
||||
echo "Line State: DOWN [$ls: $s]"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Which profile is used?
|
||||
#
|
||||
profile() {
|
||||
local bpstg=$(dsl_cmd bpstg)
|
||||
local profile=$(dsl_val "$bpstg" nProfile);
|
||||
local s;
|
||||
|
||||
case "$profile" in
|
||||
"0") s="8a" ;;
|
||||
"1") s="8b" ;;
|
||||
"2") s="8c" ;;
|
||||
"3") s="8d" ;;
|
||||
"4") s="12a" ;;
|
||||
"5") s="12b" ;;
|
||||
"6") s="17a" ;;
|
||||
"7") s="30a" ;;
|
||||
"8") s="17b" ;;
|
||||
"") s="";;
|
||||
*) s="unknown" ;;
|
||||
esac
|
||||
|
||||
if [ "$action" = "lucistat" ]; then
|
||||
echo "dsl.profile=${profile:-nil}"
|
||||
echo "dsl.profile_s=\"${s}\""
|
||||
else
|
||||
echo "Profile: $s"
|
||||
fi
|
||||
}
|
||||
|
||||
dslstat() {
|
||||
vendor
|
||||
chipset
|
||||
xtse
|
||||
profile
|
||||
line_state
|
||||
errors
|
||||
power_mode
|
||||
latency_delay
|
||||
data_rates
|
||||
line_data
|
||||
line_uptime
|
||||
}
|
||||
|
||||
lucistat() {
|
||||
echo "local dsl={}"
|
||||
dslstat
|
||||
echo "return dsl"
|
||||
}
|
||||
@ -12,9 +12,9 @@ PKG_RELEASE:=$(AUTORELEASE)
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL=$(PROJECT_GIT)/project/procd.git
|
||||
PKG_SOURCE_DATE:=2021-02-02
|
||||
PKG_SOURCE_VERSION:=fd183797bc527a160958a5dee6b5af35646ccc6b
|
||||
PKG_MIRROR_HASH:=29c851100a05e077adc12719b867714d38b06e5cfcd84b9485b1cb5552399f2e
|
||||
PKG_SOURCE_DATE:=2021-02-08
|
||||
PKG_SOURCE_VERSION:=08938fe1cbc06eeaafa39448057368391d165272
|
||||
PKG_MIRROR_HASH:=efc3deac56057e929789d44742858b2a16d976f6bfa0a2036e413d10afcaeee4
|
||||
CMAKE_INSTALL:=1
|
||||
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
|
||||
@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=busybox
|
||||
PKG_VERSION:=1.31.1
|
||||
PKG_RELEASE:=8
|
||||
PKG_RELEASE:=9
|
||||
PKG_FLAGS:=essential
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
||||
@ -145,8 +145,9 @@ endif
|
||||
ifneq ($(CONFIG_BUSYBOX_$(BUSYBOX_SYM)_NTPD),)
|
||||
$(INSTALL_BIN) ./files/sysntpd $(1)/etc/init.d/sysntpd
|
||||
$(INSTALL_BIN) ./files/ntpd-hotplug $(1)/usr/sbin/ntpd-hotplug
|
||||
$(INSTALL_DIR) $(1)/etc/capabilities/
|
||||
$(INSTALL_DIR) $(1)/etc/capabilities $(1)/usr/share/acl.d
|
||||
$(INSTALL_DATA) ./files/ntpd.capabilities $(1)/etc/capabilities/ntpd.json
|
||||
$(INSTALL_DATA) ./files/ntpd_acl.json $(1)/usr/share/acl.d/ntpd.json
|
||||
endif
|
||||
-rm -rf $(1)/lib64
|
||||
endef
|
||||
|
||||
@ -1,2 +1,12 @@
|
||||
#!/bin/sh
|
||||
ACTION="$1" /sbin/hotplug-call ntp
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
addenv="$( env | while read line; do echo "json_add_string \"\" \"$line\";"; done )"
|
||||
json_init
|
||||
json_add_array env
|
||||
json_add_string "" "ACTION=$1"
|
||||
eval "$addenv"
|
||||
json_close_array env
|
||||
|
||||
ubus call hotplug.ntp call "$(json_dump)"
|
||||
|
||||
8
package/utils/busybox/files/ntpd_acl.json
Normal file
8
package/utils/busybox/files/ntpd_acl.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"user": "ntp",
|
||||
"access": {
|
||||
"hotplug.ntp": {
|
||||
"methods": [ "call" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -56,7 +56,12 @@ start_ntpd_instance() {
|
||||
done
|
||||
procd_set_param respawn
|
||||
[ -x /sbin/ujail -a -e /etc/capabilities/ntpd.json ] && {
|
||||
procd_add_jail ntpd
|
||||
procd_add_jail ntpd ubus
|
||||
procd_add_jail_mount "$HOTPLUG_SCRIPT"
|
||||
procd_add_jail_mount "/usr/share/libubox/jshn.sh"
|
||||
procd_add_jail_mount "/usr/bin/env"
|
||||
procd_add_jail_mount "/usr/bin/jshn"
|
||||
procd_add_jail_mount "/bin/ubus"
|
||||
procd_set_param capabilities /etc/capabilities/ntpd.json
|
||||
procd_set_param user ntp
|
||||
procd_set_param group ntp
|
||||
|
||||
@ -43,11 +43,6 @@
|
||||
gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
|
||||
linux,default-trigger = "phy0tpt";
|
||||
};
|
||||
|
||||
lan {
|
||||
label = "blue:lan";
|
||||
gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
};
|
||||
|
||||
virtual_flash {
|
||||
@ -145,21 +140,8 @@
|
||||
};
|
||||
};
|
||||
|
||||
ð0 {
|
||||
status = "okay";
|
||||
|
||||
mtd-mac-address = <&art 0x0>;
|
||||
|
||||
phy-handle = <&swphy0>;
|
||||
|
||||
gmac-config {
|
||||
device = <&gmac>;
|
||||
switch-phy-swap = <1>;
|
||||
};
|
||||
};
|
||||
|
||||
ð1 {
|
||||
compatible = "syscon", "simple-mfd";
|
||||
mtd-mac-address = <&art 0x0>;
|
||||
};
|
||||
|
||||
&wmac {
|
||||
|
||||
102
target/linux/ath79/dts/qca9558_dlink_dap-3662-a1.dts
Normal file
102
target/linux/ath79/dts/qca9558_dlink_dap-3662-a1.dts
Normal file
@ -0,0 +1,102 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
|
||||
|
||||
#include "qca955x_dlink_dap-2xxx.dtsi"
|
||||
|
||||
/ {
|
||||
compatible = "dlink,dap-3662-a1", "qca,qca9558";
|
||||
model = "D-Link DAP-3662 A1";
|
||||
|
||||
aliases {
|
||||
led-boot = &led_power_green;
|
||||
led-failsafe = &led_power_red;
|
||||
led-running = &led_power_green;
|
||||
led-upgrade = &led_power_red;
|
||||
};
|
||||
|
||||
keys {
|
||||
compatible = "gpio-keys";
|
||||
|
||||
reset {
|
||||
label = "reset";
|
||||
linux,code = <KEY_RESTART>;
|
||||
gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
};
|
||||
|
||||
leds {
|
||||
compatible = "gpio-leds";
|
||||
|
||||
led_power_red: power_red {
|
||||
label = "red:power";
|
||||
gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
|
||||
led_power_green: power_green {
|
||||
label = "green:power";
|
||||
gpios = <&gpio 23 GPIO_ACTIVE_LOW>;
|
||||
default-state = "on";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&partitions {
|
||||
partition@70000 {
|
||||
label = "firmware";
|
||||
reg = <0x70000 0xef0000>;
|
||||
compatible = "wrg";
|
||||
};
|
||||
|
||||
partition@f60000 {
|
||||
label = "dlink";
|
||||
reg = <0xf60000 0x90000>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
art: partition@ff0000 {
|
||||
label = "art";
|
||||
reg = <0xff0000 0x10000>;
|
||||
read-only;
|
||||
};
|
||||
};
|
||||
|
||||
&mdio0 {
|
||||
status = "okay";
|
||||
|
||||
phy0: ethernet-phy@0 {
|
||||
reg = <0>;
|
||||
|
||||
qca,ar8327-initvals = <
|
||||
0x04 0x07600000 /* PORT0_PAD_CTRL */
|
||||
0x0c 0x00080080 /* PORT6_PAD_CTRL */
|
||||
0x7c 0x0000007e /* PORT0_STATUS */
|
||||
0x94 0x0000007e /* PORT6_STATUS */
|
||||
>;
|
||||
};
|
||||
};
|
||||
|
||||
ð0 {
|
||||
status = "okay";
|
||||
|
||||
phy-handle = <&phy0>;
|
||||
pll-data = <0x56000000 0x00000101 0x00001616>;
|
||||
|
||||
fixed-link {
|
||||
speed = <1000>;
|
||||
full-duplex;
|
||||
};
|
||||
};
|
||||
|
||||
ð1 {
|
||||
status = "okay";
|
||||
|
||||
pll-data = <0x03000101 0x00000101 0x00001616>;
|
||||
|
||||
fixed-link {
|
||||
speed = <1000>;
|
||||
full-duplex;
|
||||
};
|
||||
};
|
||||
|
||||
&pcie0 {
|
||||
status = "okay";
|
||||
};
|
||||
@ -156,7 +156,6 @@ telco,t1)
|
||||
ucidef_set_led_netdev "wan" "WAN" "blue:wan" "eth1"
|
||||
;;
|
||||
comfast,cf-wr752ac-v1|\
|
||||
engenius,eap300-v2|\
|
||||
enterasys,ws-ap3705i|\
|
||||
openmesh,mr900-v1|\
|
||||
openmesh,mr900-v2|\
|
||||
|
||||
@ -33,7 +33,6 @@ ath79_setup_interfaces()
|
||||
dlink,dap-3320-a1|\
|
||||
dlink,dir-505|\
|
||||
engenius,eap1200h|\
|
||||
engenius,eap300-v2|\
|
||||
engenius,eap600|\
|
||||
engenius,ecb1200|\
|
||||
engenius,ecb1750|\
|
||||
@ -108,6 +107,8 @@ ath79_setup_interfaces()
|
||||
alfa-network,n5q|\
|
||||
devolo,dvl1200e|\
|
||||
devolo,dvl1750e|\
|
||||
engenius,enstationac-v1|\
|
||||
engenius,ews511ap|\
|
||||
ocedo,ursus|\
|
||||
ubnt,unifi-ap-outdoor-plus)
|
||||
ucidef_set_interface_lan "eth0 eth1"
|
||||
@ -203,6 +204,10 @@ ath79_setup_interfaces()
|
||||
ucidef_add_switch "switch0" \
|
||||
"0@eth0" "2:lan" "3:wan" "6@eth1"
|
||||
;;
|
||||
dlink,dap-3662-a1)
|
||||
ucidef_add_switch "switch0" \
|
||||
"0@eth0" "1:lan:2" "2:lan:1" "6@eth1"
|
||||
;;
|
||||
dlink,dch-g020-a1)
|
||||
ucidef_add_switch "switch0" \
|
||||
"0@eth0" "1:lan:2" "2:lan:1"
|
||||
@ -235,13 +240,14 @@ ath79_setup_interfaces()
|
||||
ucidef_add_switch "switch0" \
|
||||
"0@eth0" "1:wan" "2:lan:3" "3:lan:2"
|
||||
;;
|
||||
engenius,ens202ext-v1)
|
||||
ucidef_set_interface_wan "eth1"
|
||||
engenius,eap300-v2)
|
||||
ucidef_add_switch "switch0" \
|
||||
"0@eth0" "1:lan"
|
||||
;;
|
||||
engenius,ews511ap)
|
||||
ucidef_set_interface_lan "eth0 eth1" "dhcp"
|
||||
engenius,ens202ext-v1)
|
||||
ucidef_set_interface_lan "eth1"
|
||||
ucidef_add_switch "switch0" \
|
||||
"0@eth0" "1:lan"
|
||||
;;
|
||||
etactica,eg200)
|
||||
ucidef_set_interface_lan "eth0" "dhcp"
|
||||
@ -501,7 +507,8 @@ ath79_setup_macs()
|
||||
lan_mac=$(mtd_get_mac_ascii bdcfg "lanmac")
|
||||
label_mac=$lan_mac
|
||||
;;
|
||||
dlink,dap-2695-a1)
|
||||
dlink,dap-2695-a1|\
|
||||
dlink,dap-3662-a1)
|
||||
label_mac=$(mtd_get_mac_ascii bdcfg "wlanmac")
|
||||
;;
|
||||
dlink,dir-825-b1)
|
||||
|
||||
@ -56,7 +56,8 @@ case "$FIRMWARE" in
|
||||
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary art 0x0) -1)
|
||||
;;
|
||||
dlink,dap-2660-a1|\
|
||||
dlink,dap-2695-a1)
|
||||
dlink,dap-2695-a1|\
|
||||
dlink,dap-3662-a1)
|
||||
caldata_extract "art" 0x5000 0x844
|
||||
ath10k_patch_mac $(mtd_get_mac_ascii bdcfg wlanmac_a)
|
||||
;;
|
||||
|
||||
@ -27,7 +27,8 @@ case "$board" in
|
||||
mtd_get_mac_ascii bdcfg "wlanmac" > /sys${DEVPATH}/macaddress
|
||||
;;
|
||||
dlink,dap-2660-a1|\
|
||||
dlink,dap-2680-a1)
|
||||
dlink,dap-2680-a1|\
|
||||
dlink,dap-3662-a1)
|
||||
[ "$PHYNBR" -eq 1 ] && \
|
||||
mtd_get_mac_ascii bdcfg "wlanmac" > /sys${DEVPATH}/macaddress
|
||||
;;
|
||||
|
||||
@ -17,7 +17,8 @@ dlink,dap-2230-a1|\
|
||||
dlink,dap-2660-a1|\
|
||||
dlink,dap-2680-a1|\
|
||||
dlink,dap-2695-a1|\
|
||||
dlink,dap-3320-a1)
|
||||
dlink,dap-3320-a1|\
|
||||
dlink,dap-3662-a1)
|
||||
fixwrgg
|
||||
;;
|
||||
qihoo,c301)
|
||||
|
||||
@ -7,7 +7,8 @@ preinit_set_mac_address() {
|
||||
avm,fritzdvbc)
|
||||
ip link set dev eth0 address $(fritz_tffs -n maca -i $(find_mtd_part "tffs (1)"))
|
||||
;;
|
||||
dlink,dap-2695-a1)
|
||||
dlink,dap-2695-a1|\
|
||||
dlink,dap-3662-a1)
|
||||
ip link set dev eth0 address $(mtd_get_mac_ascii bdcfg "lanmac")
|
||||
ip link set dev eth1 address $(mtd_get_mac_ascii bdcfg "wanmac")
|
||||
;;
|
||||
|
||||
@ -821,6 +821,18 @@ define Device/dlink_dap-3320-a1
|
||||
endef
|
||||
TARGET_DEVICES += dlink_dap-3320-a1
|
||||
|
||||
define Device/dlink_dap-3662-a1
|
||||
$(Device/dlink_dap-2xxx)
|
||||
SOC := qca9558
|
||||
DEVICE_VENDOR := D-Link
|
||||
DEVICE_MODEL := DAP-3662
|
||||
DEVICE_VARIANT := A1
|
||||
DEVICE_PACKAGES := ath10k-firmware-qca988x-ct kmod-ath10k-ct
|
||||
IMAGE_SIZE := 15296k
|
||||
DAP_SIGNATURE := wapac11_dkbs_dap3662
|
||||
endef
|
||||
TARGET_DEVICES += dlink_dap-3662-a1
|
||||
|
||||
define Device/dlink_dch-g020-a1
|
||||
SOC := qca9531
|
||||
DEVICE_VENDOR := D-Link
|
||||
|
||||
@ -706,7 +706,7 @@
|
||||
EXPORT_SYMBOL(xfrm_parse_spi);
|
||||
--- a/net/ipv4/tcp_input.c
|
||||
+++ b/net/ipv4/tcp_input.c
|
||||
@@ -3975,14 +3975,16 @@ static bool tcp_parse_aligned_timestamp(
|
||||
@@ -3976,14 +3976,16 @@ static bool tcp_parse_aligned_timestamp(
|
||||
{
|
||||
const __be32 *ptr = (const __be32 *)(th + 1);
|
||||
|
||||
|
||||
@ -54,7 +54,7 @@ ath79_setup_interfaces()
|
||||
ucidef_set_interface_lan "eth0"
|
||||
;;
|
||||
engenius,enh202-v1)
|
||||
ucidef_set_interface_wan "eth0"
|
||||
ucidef_set_interface_lan "eth0"
|
||||
ucidef_add_switch "switch0" \
|
||||
"0@eth1" "4:lan:1"
|
||||
;;
|
||||
|
||||
26
target/linux/bcm4908/base-files/etc/board.d/02_network
Executable file
26
target/linux/bcm4908/base-files/etc/board.d/02_network
Executable file
@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause
|
||||
|
||||
. /lib/functions/system.sh
|
||||
. /lib/functions/uci-defaults.sh
|
||||
|
||||
bcm4908_setup_interfaces()
|
||||
{
|
||||
local board="$1"
|
||||
|
||||
case "$board" in
|
||||
asus,gt-ac5300)
|
||||
ucidef_set_interface_lan "lan1 lan2 lan5 lan6 sw"
|
||||
;;
|
||||
*)
|
||||
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
board_config_update
|
||||
board=$(board_name)
|
||||
bcm4908_setup_interfaces "$board"
|
||||
board_config_flush
|
||||
|
||||
exit 0
|
||||
@ -40,6 +40,7 @@ CONFIG_B53=y
|
||||
# CONFIG_B53_MMAP_DRIVER is not set
|
||||
# CONFIG_B53_SERDES is not set
|
||||
# CONFIG_B53_SRAB_DRIVER is not set
|
||||
CONFIG_BCM4908ENET=y
|
||||
CONFIG_BCM7XXX_PHY=y
|
||||
CONFIG_BCM_NET_PHYLIB=y
|
||||
CONFIG_BCM_PMB=y
|
||||
|
||||
@ -0,0 +1,68 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
#ifndef __UNIMAC_H
|
||||
#define __UNIMAC_H
|
||||
|
||||
#define UMAC_HD_BKP_CTRL 0x004
|
||||
#define HD_FC_EN (1 << 0)
|
||||
#define HD_FC_BKOFF_OK (1 << 1)
|
||||
#define IPG_CONFIG_RX_SHIFT 2
|
||||
#define IPG_CONFIG_RX_MASK 0x1F
|
||||
#define UMAC_CMD 0x008
|
||||
#define CMD_TX_EN (1 << 0)
|
||||
#define CMD_RX_EN (1 << 1)
|
||||
#define CMD_SPEED_10 0
|
||||
#define CMD_SPEED_100 1
|
||||
#define CMD_SPEED_1000 2
|
||||
#define CMD_SPEED_2500 3
|
||||
#define CMD_SPEED_SHIFT 2
|
||||
#define CMD_SPEED_MASK 3
|
||||
#define CMD_PROMISC (1 << 4)
|
||||
#define CMD_PAD_EN (1 << 5)
|
||||
#define CMD_CRC_FWD (1 << 6)
|
||||
#define CMD_PAUSE_FWD (1 << 7)
|
||||
#define CMD_RX_PAUSE_IGNORE (1 << 8)
|
||||
#define CMD_TX_ADDR_INS (1 << 9)
|
||||
#define CMD_HD_EN (1 << 10)
|
||||
#define CMD_SW_RESET_OLD (1 << 11)
|
||||
#define CMD_SW_RESET (1 << 13)
|
||||
#define CMD_LCL_LOOP_EN (1 << 15)
|
||||
#define CMD_AUTO_CONFIG (1 << 22)
|
||||
#define CMD_CNTL_FRM_EN (1 << 23)
|
||||
#define CMD_NO_LEN_CHK (1 << 24)
|
||||
#define CMD_RMT_LOOP_EN (1 << 25)
|
||||
#define CMD_RX_ERR_DISC (1 << 26)
|
||||
#define CMD_PRBL_EN (1 << 27)
|
||||
#define CMD_TX_PAUSE_IGNORE (1 << 28)
|
||||
#define CMD_TX_RX_EN (1 << 29)
|
||||
#define CMD_RUNT_FILTER_DIS (1 << 30)
|
||||
#define UMAC_MAC0 0x00c
|
||||
#define UMAC_MAC1 0x010
|
||||
#define UMAC_MAX_FRAME_LEN 0x014
|
||||
#define UMAC_PAUSE_QUANTA 0x018
|
||||
#define UMAC_MODE 0x044
|
||||
#define MODE_LINK_STATUS (1 << 5)
|
||||
#define UMAC_FRM_TAG0 0x048 /* outer tag */
|
||||
#define UMAC_FRM_TAG1 0x04c /* inner tag */
|
||||
#define UMAC_TX_IPG_LEN 0x05c
|
||||
#define UMAC_EEE_CTRL 0x064
|
||||
#define EN_LPI_RX_PAUSE (1 << 0)
|
||||
#define EN_LPI_TX_PFC (1 << 1)
|
||||
#define EN_LPI_TX_PAUSE (1 << 2)
|
||||
#define EEE_EN (1 << 3)
|
||||
#define RX_FIFO_CHECK (1 << 4)
|
||||
#define EEE_TX_CLK_DIS (1 << 5)
|
||||
#define DIS_EEE_10M (1 << 6)
|
||||
#define LP_IDLE_PREDICTION_MODE (1 << 7)
|
||||
#define UMAC_EEE_LPI_TIMER 0x068
|
||||
#define UMAC_EEE_WAKE_TIMER 0x06C
|
||||
#define UMAC_EEE_REF_COUNT 0x070
|
||||
#define EEE_REFERENCE_COUNT_MASK 0xffff
|
||||
#define UMAC_RX_IPG_INV 0x078
|
||||
#define UMAC_MACSEC_PROG_TX_CRC 0x310
|
||||
#define UMAC_MACSEC_CTRL 0x314
|
||||
#define UMAC_PAUSE_CTRL 0x330
|
||||
#define UMAC_TX_FLUSH 0x334
|
||||
#define UMAC_RX_FIFO_STATUS 0x338
|
||||
#define UMAC_TX_FIFO_STATUS 0x33c
|
||||
|
||||
#endif
|
||||
@ -68,7 +68,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
offset = CORE_STS_OVERRIDE_IMP;
|
||||
else
|
||||
offset = CORE_STS_OVERRIDE_IMP2;
|
||||
@@ -542,7 +543,8 @@ static void bcm_sf2_sw_mac_config(struct
|
||||
@@ -546,7 +547,8 @@ static void bcm_sf2_sw_mac_config(struct
|
||||
if (port == core_readl(priv, CORE_IMP0_PRT_ID))
|
||||
return;
|
||||
|
||||
@ -78,7 +78,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
offset = CORE_STS_OVERRIDE_GMIIP_PORT(port);
|
||||
else
|
||||
offset = CORE_STS_OVERRIDE_GMIIP2_PORT(port);
|
||||
@@ -984,6 +986,30 @@ struct bcm_sf2_of_data {
|
||||
@@ -988,6 +990,30 @@ struct bcm_sf2_of_data {
|
||||
unsigned int num_cfp_rules;
|
||||
};
|
||||
|
||||
@ -109,7 +109,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
/* Register offsets for the SWITCH_REG_* block */
|
||||
static const u16 bcm_sf2_7445_reg_offsets[] = {
|
||||
[REG_SWITCH_CNTRL] = 0x00,
|
||||
@@ -1032,6 +1058,9 @@ static const struct bcm_sf2_of_data bcm_
|
||||
@@ -1036,6 +1062,9 @@ static const struct bcm_sf2_of_data bcm_
|
||||
};
|
||||
|
||||
static const struct of_device_id bcm_sf2_of_match[] = {
|
||||
|
||||
@ -0,0 +1,60 @@
|
||||
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||
Date: Fri, 5 Feb 2021 21:57:41 +0100
|
||||
Subject: [PATCH 1/2] dt-bindings: net: document BCM4908 Ethernet controller
|
||||
|
||||
BCM4908 is a family of SoCs with integrated Ethernet controller.
|
||||
|
||||
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||
---
|
||||
.../bindings/net/brcm,bcm4908enet.yaml | 45 +++++++++++++++++++
|
||||
1 file changed, 45 insertions(+)
|
||||
create mode 100644 Documentation/devicetree/bindings/net/brcm,bcm4908enet.yaml
|
||||
|
||||
--- /dev/null
|
||||
+++ b/Documentation/devicetree/bindings/net/brcm,bcm4908enet.yaml
|
||||
@@ -0,0 +1,45 @@
|
||||
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
|
||||
+%YAML 1.2
|
||||
+---
|
||||
+$id: http://devicetree.org/schemas/net/brcm,bcm4908enet.yaml#
|
||||
+$schema: http://devicetree.org/meta-schemas/core.yaml#
|
||||
+
|
||||
+title: Broadcom BCM4908 Ethernet controller
|
||||
+
|
||||
+description: Broadcom's Ethernet controller integrated into BCM4908 family SoCs
|
||||
+
|
||||
+maintainers:
|
||||
+ - Rafał Miłecki <rafal@milecki.pl>
|
||||
+
|
||||
+properties:
|
||||
+ compatible:
|
||||
+ const: brcm,bcm4908enet
|
||||
+
|
||||
+ reg:
|
||||
+ maxItems: 1
|
||||
+
|
||||
+ interrupts:
|
||||
+ description: RX interrupt
|
||||
+
|
||||
+ interrupt-names:
|
||||
+ const: rx
|
||||
+
|
||||
+required:
|
||||
+ - reg
|
||||
+ - interrupts
|
||||
+ - interrupt-names
|
||||
+
|
||||
+additionalProperties: false
|
||||
+
|
||||
+examples:
|
||||
+ - |
|
||||
+ #include <dt-bindings/interrupt-controller/irq.h>
|
||||
+ #include <dt-bindings/interrupt-controller/arm-gic.h>
|
||||
+
|
||||
+ ethernet@80002000 {
|
||||
+ compatible = "brcm,bcm4908enet";
|
||||
+ reg = <0x80002000 0x1000>;
|
||||
+
|
||||
+ interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ interrupt-names = "rx";
|
||||
+ };
|
||||
@ -0,0 +1,842 @@
|
||||
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||
Date: Fri, 5 Feb 2021 21:59:51 +0100
|
||||
Subject: [PATCH 2/2] net: broadcom: bcm4908enet: add BCM4908 controller driver
|
||||
|
||||
BCM4908 SoCs family uses Ethernel controller that includes UniMAC but
|
||||
uses different DMA engine (than other controllers) and requires
|
||||
different programming.
|
||||
|
||||
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||
---
|
||||
MAINTAINERS | 9 +
|
||||
drivers/net/ethernet/broadcom/Kconfig | 8 +
|
||||
drivers/net/ethernet/broadcom/Makefile | 1 +
|
||||
drivers/net/ethernet/broadcom/bcm4908enet.c | 676 ++++++++++++++++++++
|
||||
drivers/net/ethernet/broadcom/bcm4908enet.h | 96 +++
|
||||
5 files changed, 790 insertions(+)
|
||||
create mode 100644 drivers/net/ethernet/broadcom/bcm4908enet.c
|
||||
create mode 100644 drivers/net/ethernet/broadcom/bcm4908enet.h
|
||||
|
||||
--- a/MAINTAINERS
|
||||
+++ b/MAINTAINERS
|
||||
@@ -3207,6 +3207,15 @@ F: Documentation/devicetree/bindings/mip
|
||||
F: arch/mips/bcm47xx/*
|
||||
F: arch/mips/include/asm/mach-bcm47xx/*
|
||||
|
||||
+BROADCOM BCM4908 ETHERNET DRIVER
|
||||
+M: Rafał Miłecki <rafal@milecki.pl>
|
||||
+M: bcm-kernel-feedback-list@broadcom.com
|
||||
+L: netdev@vger.kernel.org
|
||||
+S: Maintained
|
||||
+F: Documentation/devicetree/bindings/net/brcm,bcm4908enet.yaml
|
||||
+F: drivers/net/ethernet/broadcom/bcm4908enet.*
|
||||
+F: drivers/net/ethernet/broadcom/unimac.h
|
||||
+
|
||||
BROADCOM BCM5301X ARM ARCHITECTURE
|
||||
M: Hauke Mehrtens <hauke@hauke-m.de>
|
||||
M: Rafał Miłecki <zajec5@gmail.com>
|
||||
--- a/drivers/net/ethernet/broadcom/Kconfig
|
||||
+++ b/drivers/net/ethernet/broadcom/Kconfig
|
||||
@@ -51,6 +51,14 @@ config B44_PCI
|
||||
depends on B44_PCI_AUTOSELECT && B44_PCICORE_AUTOSELECT
|
||||
default y
|
||||
|
||||
+config BCM4908ENET
|
||||
+ tristate "Broadcom BCM4908 internal mac support"
|
||||
+ depends on ARCH_BCM4908 || COMPILE_TEST
|
||||
+ default y
|
||||
+ help
|
||||
+ This driver supports Ethernet controller integrated into Broadcom
|
||||
+ BCM4908 family SoCs.
|
||||
+
|
||||
config BCM63XX_ENET
|
||||
tristate "Broadcom 63xx internal mac support"
|
||||
depends on BCM63XX
|
||||
--- a/drivers/net/ethernet/broadcom/Makefile
|
||||
+++ b/drivers/net/ethernet/broadcom/Makefile
|
||||
@@ -4,6 +4,7 @@
|
||||
#
|
||||
|
||||
obj-$(CONFIG_B44) += b44.o
|
||||
+obj-$(CONFIG_BCM4908ENET) += bcm4908enet.o
|
||||
obj-$(CONFIG_BCM63XX_ENET) += bcm63xx_enet.o
|
||||
obj-$(CONFIG_BCMGENET) += genet/
|
||||
obj-$(CONFIG_BNX2) += bnx2.o
|
||||
--- /dev/null
|
||||
+++ b/drivers/net/ethernet/broadcom/bcm4908enet.c
|
||||
@@ -0,0 +1,676 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0-only
|
||||
+/*
|
||||
+ * Copyright (C) 2021 Rafał Miłecki <rafal@milecki.pl>
|
||||
+ */
|
||||
+
|
||||
+#include <linux/delay.h>
|
||||
+#include <linux/etherdevice.h>
|
||||
+#include <linux/interrupt.h>
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/of.h>
|
||||
+#include <linux/platform_device.h>
|
||||
+#include <linux/slab.h>
|
||||
+#include <linux/string.h>
|
||||
+
|
||||
+#include "bcm4908enet.h"
|
||||
+#include "unimac.h"
|
||||
+
|
||||
+#define ENET_DMA_CH_RX_CFG ENET_DMA_CH0_CFG
|
||||
+#define ENET_DMA_CH_TX_CFG ENET_DMA_CH1_CFG
|
||||
+#define ENET_DMA_CH_RX_STATE_RAM ENET_DMA_CH0_STATE_RAM
|
||||
+#define ENET_DMA_CH_TX_STATE_RAM ENET_DMA_CH1_STATE_RAM
|
||||
+
|
||||
+#define ENET_TX_BDS_NUM 200
|
||||
+#define ENET_RX_BDS_NUM 200
|
||||
+#define ENET_RX_BDS_NUM_MAX 8192
|
||||
+
|
||||
+#define ENET_DMA_INT_DEFAULTS (ENET_DMA_CH_CFG_INT_DONE | \
|
||||
+ ENET_DMA_CH_CFG_INT_NO_DESC | \
|
||||
+ ENET_DMA_CH_CFG_INT_BUFF_DONE)
|
||||
+#define ENET_DMA_MAX_BURST_LEN 8 /* in 64 bit words */
|
||||
+
|
||||
+#define ENET_MTU_MIN 60
|
||||
+#define ENET_MTU_MAX 1500 /* Is it possible to support 2044? */
|
||||
+#define ENET_MTU_MAX_EXTRA_SIZE 32 /* L2 */
|
||||
+
|
||||
+struct bcm4908enet_dma_ring_bd {
|
||||
+ __le32 ctl;
|
||||
+ __le32 addr;
|
||||
+} __packed;
|
||||
+
|
||||
+struct bcm4908enet_dma_ring_slot {
|
||||
+ struct sk_buff *skb;
|
||||
+ unsigned int len;
|
||||
+ dma_addr_t dma_addr;
|
||||
+};
|
||||
+
|
||||
+struct bcm4908enet_dma_ring {
|
||||
+ int is_tx;
|
||||
+ int read_idx;
|
||||
+ int write_idx;
|
||||
+ int length;
|
||||
+ u16 cfg_block;
|
||||
+ u16 st_ram_block;
|
||||
+
|
||||
+ union {
|
||||
+ void *cpu_addr;
|
||||
+ struct bcm4908enet_dma_ring_bd *buf_desc;
|
||||
+ };
|
||||
+ dma_addr_t dma_addr;
|
||||
+
|
||||
+ struct bcm4908enet_dma_ring_slot *slots;
|
||||
+};
|
||||
+
|
||||
+struct bcm4908enet {
|
||||
+ struct device *dev;
|
||||
+ struct net_device *netdev;
|
||||
+ struct napi_struct napi;
|
||||
+ void __iomem *base;
|
||||
+
|
||||
+ struct bcm4908enet_dma_ring tx_ring;
|
||||
+ struct bcm4908enet_dma_ring rx_ring;
|
||||
+};
|
||||
+
|
||||
+/***
|
||||
+ * R/W ops
|
||||
+ */
|
||||
+
|
||||
+static inline u32 enet_read(struct bcm4908enet *enet, u16 offset)
|
||||
+{
|
||||
+ return readl(enet->base + offset);
|
||||
+}
|
||||
+
|
||||
+static inline void enet_write(struct bcm4908enet *enet, u16 offset, u32 value)
|
||||
+{
|
||||
+ writel(value, enet->base + offset);
|
||||
+}
|
||||
+
|
||||
+static inline void enet_maskset(struct bcm4908enet *enet, u16 offset, u32 mask, u32 set)
|
||||
+{
|
||||
+ u32 val;
|
||||
+
|
||||
+ WARN_ON(set & ~mask);
|
||||
+
|
||||
+ val = enet_read(enet, offset);
|
||||
+ val = (val & ~mask) | (set & mask);
|
||||
+ enet_write(enet, offset, val);
|
||||
+}
|
||||
+
|
||||
+static inline void enet_set(struct bcm4908enet *enet, u16 offset, u32 set)
|
||||
+{
|
||||
+ enet_maskset(enet, offset, set, set);
|
||||
+}
|
||||
+
|
||||
+static inline u32 enet_umac_read(struct bcm4908enet *enet, u16 offset)
|
||||
+{
|
||||
+ return enet_read(enet, ENET_UNIMAC + offset);
|
||||
+}
|
||||
+
|
||||
+static inline void enet_umac_write(struct bcm4908enet *enet, u16 offset, u32 value)
|
||||
+{
|
||||
+ enet_write(enet, ENET_UNIMAC + offset, value);
|
||||
+}
|
||||
+
|
||||
+static inline void enet_umac_maskset(struct bcm4908enet *enet, u16 offset, u32 mask, u32 set)
|
||||
+{
|
||||
+ enet_maskset(enet, ENET_UNIMAC + offset, mask, set);
|
||||
+}
|
||||
+
|
||||
+static inline void enet_umac_set(struct bcm4908enet *enet, u16 offset, u32 set)
|
||||
+{
|
||||
+ enet_set(enet, ENET_UNIMAC + offset, set);
|
||||
+}
|
||||
+
|
||||
+/***
|
||||
+ * Helpers
|
||||
+ */
|
||||
+
|
||||
+static void bcm4908enet_intrs_on(struct bcm4908enet *enet)
|
||||
+{
|
||||
+ enet_write(enet, ENET_DMA_CH_RX_CFG + ENET_DMA_CH_CFG_INT_MASK, ENET_DMA_INT_DEFAULTS);
|
||||
+}
|
||||
+
|
||||
+static void bcm4908enet_intrs_off(struct bcm4908enet *enet)
|
||||
+{
|
||||
+ enet_write(enet, ENET_DMA_CH_RX_CFG + ENET_DMA_CH_CFG_INT_MASK, 0);
|
||||
+}
|
||||
+
|
||||
+static void bcm4908enet_intrs_ack(struct bcm4908enet *enet)
|
||||
+{
|
||||
+ enet_write(enet, ENET_DMA_CH_RX_CFG + ENET_DMA_CH_CFG_INT_STAT, ENET_DMA_INT_DEFAULTS);
|
||||
+}
|
||||
+
|
||||
+/***
|
||||
+ * DMA
|
||||
+ */
|
||||
+
|
||||
+static int bcm4908_dma_alloc_buf_descs(struct bcm4908enet *enet, struct bcm4908enet_dma_ring *ring)
|
||||
+{
|
||||
+ int size = ring->length * sizeof(struct bcm4908enet_dma_ring_bd);
|
||||
+ struct device *dev = enet->dev;
|
||||
+
|
||||
+ ring->cpu_addr = dma_alloc_coherent(dev, size, &ring->dma_addr, GFP_KERNEL);
|
||||
+ if (!ring->cpu_addr)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ if (((uintptr_t)ring->cpu_addr) & (0x40 - 1)) {
|
||||
+ dev_err(dev, "Invalid DMA ring alignment\n");
|
||||
+ goto err_free_buf_descs;
|
||||
+ }
|
||||
+
|
||||
+ ring->slots = kzalloc(ring->length * sizeof(*ring->slots), GFP_KERNEL);
|
||||
+ if (!ring->slots)
|
||||
+ goto err_free_buf_descs;
|
||||
+
|
||||
+ memset(ring->cpu_addr, 0, size);
|
||||
+
|
||||
+ ring->read_idx = 0;
|
||||
+ ring->write_idx = 0;
|
||||
+
|
||||
+ return 0;
|
||||
+
|
||||
+err_free_buf_descs:
|
||||
+ dma_free_coherent(dev, size, ring->cpu_addr, ring->dma_addr);
|
||||
+ return -ENOMEM;
|
||||
+}
|
||||
+
|
||||
+static void bcm4908enet_dma_free(struct bcm4908enet *enet)
|
||||
+{
|
||||
+ struct bcm4908enet_dma_ring *tx_ring = &enet->tx_ring;
|
||||
+ struct bcm4908enet_dma_ring *rx_ring = &enet->rx_ring;
|
||||
+ struct device *dev = enet->dev;
|
||||
+ int size;
|
||||
+
|
||||
+ size = rx_ring->length * sizeof(struct bcm4908enet_dma_ring_bd);
|
||||
+ if (rx_ring->cpu_addr)
|
||||
+ dma_free_coherent(dev, size, rx_ring->cpu_addr, rx_ring->dma_addr);
|
||||
+ kfree(rx_ring->slots);
|
||||
+
|
||||
+ size = tx_ring->length * sizeof(struct bcm4908enet_dma_ring_bd);
|
||||
+ if (tx_ring->cpu_addr)
|
||||
+ dma_free_coherent(dev, size, tx_ring->cpu_addr, tx_ring->dma_addr);
|
||||
+ kfree(tx_ring->slots);
|
||||
+}
|
||||
+
|
||||
+static int bcm4908enet_dma_alloc(struct bcm4908enet *enet)
|
||||
+{
|
||||
+ struct bcm4908enet_dma_ring *tx_ring = &enet->tx_ring;
|
||||
+ struct bcm4908enet_dma_ring *rx_ring = &enet->rx_ring;
|
||||
+ struct device *dev = enet->dev;
|
||||
+ int err;
|
||||
+
|
||||
+ tx_ring->length = ENET_TX_BDS_NUM;
|
||||
+ tx_ring->is_tx = 1;
|
||||
+ tx_ring->cfg_block = ENET_DMA_CH_TX_CFG;
|
||||
+ tx_ring->st_ram_block = ENET_DMA_CH_TX_STATE_RAM;
|
||||
+ err = bcm4908_dma_alloc_buf_descs(enet, tx_ring);
|
||||
+ if (err) {
|
||||
+ dev_err(dev, "Failed to alloc TX buf descriptors: %d\n", err);
|
||||
+ return err;
|
||||
+ }
|
||||
+
|
||||
+ rx_ring->length = ENET_RX_BDS_NUM;
|
||||
+ rx_ring->is_tx = 0;
|
||||
+ rx_ring->cfg_block = ENET_DMA_CH_RX_CFG;
|
||||
+ rx_ring->st_ram_block = ENET_DMA_CH_RX_STATE_RAM;
|
||||
+ err = bcm4908_dma_alloc_buf_descs(enet, rx_ring);
|
||||
+ if (err) {
|
||||
+ dev_err(dev, "Failed to alloc RX buf descriptors: %d\n", err);
|
||||
+ bcm4908enet_dma_free(enet);
|
||||
+ return err;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void bcm4908enet_dma_reset(struct bcm4908enet *enet)
|
||||
+{
|
||||
+ struct bcm4908enet_dma_ring *rings[] = { &enet->rx_ring, &enet->tx_ring };
|
||||
+ int i;
|
||||
+
|
||||
+ /* Disable the DMA controller and channel */
|
||||
+ for (i = 0; i < ARRAY_SIZE(rings); i++)
|
||||
+ enet_write(enet, rings[i]->cfg_block + ENET_DMA_CH_CFG, 0);
|
||||
+ enet_maskset(enet, ENET_DMA_CONTROLLER_CFG, ENET_DMA_CTRL_CFG_MASTER_EN, 0);
|
||||
+
|
||||
+ /* Reset channels state */
|
||||
+ for (i = 0; i < ARRAY_SIZE(rings); i++) {
|
||||
+ struct bcm4908enet_dma_ring *ring = rings[i];
|
||||
+
|
||||
+ enet_write(enet, ring->st_ram_block + ENET_DMA_CH_STATE_RAM_BASE_DESC_PTR, 0);
|
||||
+ enet_write(enet, ring->st_ram_block + ENET_DMA_CH_STATE_RAM_STATE_DATA, 0);
|
||||
+ enet_write(enet, ring->st_ram_block + ENET_DMA_CH_STATE_RAM_DESC_LEN_STATUS, 0);
|
||||
+ enet_write(enet, ring->st_ram_block + ENET_DMA_CH_STATE_RAM_DESC_BASE_BUFPTR, 0);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static int bcm4908enet_dma_alloc_rx_buf(struct bcm4908enet *enet, unsigned int idx)
|
||||
+{
|
||||
+ struct bcm4908enet_dma_ring_bd *buf_desc = &enet->rx_ring.buf_desc[idx];
|
||||
+ struct bcm4908enet_dma_ring_slot *slot = &enet->rx_ring.slots[idx];
|
||||
+ struct device *dev = enet->dev;
|
||||
+ u32 tmp;
|
||||
+ int err;
|
||||
+
|
||||
+ slot->len = ENET_MTU_MAX + ENET_MTU_MAX_EXTRA_SIZE;
|
||||
+
|
||||
+ slot->skb = netdev_alloc_skb(enet->netdev, slot->len);
|
||||
+ if (!slot->skb)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ slot->dma_addr = dma_map_single(dev, slot->skb->data, slot->len, DMA_FROM_DEVICE);
|
||||
+ err = dma_mapping_error(dev, slot->dma_addr);
|
||||
+ if (err) {
|
||||
+ dev_err(dev, "Failed to map DMA buffer: %d\n", err);
|
||||
+ kfree_skb(slot->skb);
|
||||
+ slot->skb = NULL;
|
||||
+ return err;
|
||||
+ }
|
||||
+
|
||||
+ tmp = slot->len << DMA_CTL_LEN_DESC_BUFLENGTH_SHIFT;
|
||||
+ tmp |= DMA_CTL_STATUS_OWN;
|
||||
+ if (idx == enet->rx_ring.length - 1)
|
||||
+ tmp |= DMA_CTL_STATUS_WRAP;
|
||||
+ buf_desc->ctl = cpu_to_le32(tmp);
|
||||
+ buf_desc->addr = cpu_to_le32(slot->dma_addr);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void bcm4908enet_dma_ring_init(struct bcm4908enet *enet,
|
||||
+ struct bcm4908enet_dma_ring *ring)
|
||||
+{
|
||||
+ int reset_channel = 0; /* We support only 1 main channel (with TX and RX) */
|
||||
+ int reset_subch = ring->is_tx ? 1 : 0;
|
||||
+
|
||||
+ /* Reset the DMA channel */
|
||||
+ enet_write(enet, ENET_DMA_CTRL_CHANNEL_RESET, BIT(reset_channel * 2 + reset_subch));
|
||||
+ enet_write(enet, ENET_DMA_CTRL_CHANNEL_RESET, 0);
|
||||
+
|
||||
+ enet_write(enet, ring->cfg_block + ENET_DMA_CH_CFG, 0);
|
||||
+ enet_write(enet, ring->cfg_block + ENET_DMA_CH_CFG_MAX_BURST, ENET_DMA_MAX_BURST_LEN);
|
||||
+ enet_write(enet, ring->cfg_block + ENET_DMA_CH_CFG_INT_MASK, 0);
|
||||
+
|
||||
+ enet_write(enet, ring->st_ram_block + ENET_DMA_CH_STATE_RAM_BASE_DESC_PTR,
|
||||
+ (uint32_t)ring->dma_addr);
|
||||
+}
|
||||
+
|
||||
+static void bcm4908enet_dma_uninit(struct bcm4908enet *enet)
|
||||
+{
|
||||
+ struct bcm4908enet_dma_ring *rx_ring = &enet->rx_ring;
|
||||
+ struct bcm4908enet_dma_ring_slot *slot;
|
||||
+ struct device *dev = enet->dev;
|
||||
+ int i;
|
||||
+
|
||||
+ for (i = rx_ring->length - 1; i >= 0; i--) {
|
||||
+ slot = &rx_ring->slots[i];
|
||||
+ if (!slot->skb)
|
||||
+ continue;
|
||||
+ dma_unmap_single(dev, slot->dma_addr, slot->len, DMA_FROM_DEVICE);
|
||||
+ kfree_skb(slot->skb);
|
||||
+ slot->skb = NULL;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static int bcm4908enet_dma_init(struct bcm4908enet *enet)
|
||||
+{
|
||||
+ struct bcm4908enet_dma_ring *rx_ring = &enet->rx_ring;
|
||||
+ struct device *dev = enet->dev;
|
||||
+ int err;
|
||||
+ int i;
|
||||
+
|
||||
+ for (i = 0; i < rx_ring->length; i++) {
|
||||
+ err = bcm4908enet_dma_alloc_rx_buf(enet, i);
|
||||
+ if (err) {
|
||||
+ dev_err(dev, "Failed to alloc RX buffer: %d\n", err);
|
||||
+ bcm4908enet_dma_uninit(enet);
|
||||
+ return err;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ bcm4908enet_dma_ring_init(enet, &enet->tx_ring);
|
||||
+ bcm4908enet_dma_ring_init(enet, &enet->rx_ring);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void bcm4908enet_dma_tx_ring_ensable(struct bcm4908enet *enet,
|
||||
+ struct bcm4908enet_dma_ring *ring)
|
||||
+{
|
||||
+ enet_write(enet, ring->cfg_block + ENET_DMA_CH_CFG, ENET_DMA_CH_CFG_ENABLE);
|
||||
+}
|
||||
+
|
||||
+static void bcm4908enet_dma_tx_ring_disable(struct bcm4908enet *enet,
|
||||
+ struct bcm4908enet_dma_ring *ring)
|
||||
+{
|
||||
+ enet_write(enet, ring->cfg_block + ENET_DMA_CH_CFG, 0);
|
||||
+}
|
||||
+
|
||||
+static void bcm4908enet_dma_rx_ring_enable(struct bcm4908enet *enet,
|
||||
+ struct bcm4908enet_dma_ring *ring)
|
||||
+{
|
||||
+ enet_set(enet, ring->cfg_block + ENET_DMA_CH_CFG, ENET_DMA_CH_CFG_ENABLE);
|
||||
+}
|
||||
+
|
||||
+static void bcm4908enet_dma_rx_ring_disable(struct bcm4908enet *enet,
|
||||
+ struct bcm4908enet_dma_ring *ring)
|
||||
+{
|
||||
+ unsigned long deadline;
|
||||
+ u32 tmp;
|
||||
+
|
||||
+ enet_maskset(enet, ring->cfg_block + ENET_DMA_CH_CFG, ENET_DMA_CH_CFG_ENABLE, 0);
|
||||
+
|
||||
+ deadline = jiffies + usecs_to_jiffies(2000);
|
||||
+ do {
|
||||
+ tmp = enet_read(enet, ring->cfg_block + ENET_DMA_CH_CFG);
|
||||
+ if (!(tmp & ENET_DMA_CH_CFG_ENABLE))
|
||||
+ return;
|
||||
+ enet_maskset(enet, ring->cfg_block + ENET_DMA_CH_CFG, ENET_DMA_CH_CFG_ENABLE, 0);
|
||||
+ usleep_range(10, 30);
|
||||
+ } while (!time_after_eq(jiffies, deadline));
|
||||
+
|
||||
+ dev_warn(enet->dev, "Timeout waiting for DMA TX stop\n");
|
||||
+}
|
||||
+
|
||||
+/***
|
||||
+ * Ethernet driver
|
||||
+ */
|
||||
+
|
||||
+static void bcm4908enet_gmac_init(struct bcm4908enet *enet)
|
||||
+{
|
||||
+ u32 cmd;
|
||||
+
|
||||
+ cmd = enet_umac_read(enet, UMAC_CMD);
|
||||
+ enet_umac_write(enet, UMAC_CMD, cmd | CMD_SW_RESET);
|
||||
+ enet_umac_write(enet, UMAC_CMD, cmd & ~CMD_SW_RESET);
|
||||
+
|
||||
+ enet_set(enet, ENET_FLUSH, ENET_FLUSH_RXFIFO_FLUSH | ENET_FLUSH_TXFIFO_FLUSH);
|
||||
+ enet_maskset(enet, ENET_FLUSH, ENET_FLUSH_RXFIFO_FLUSH | ENET_FLUSH_TXFIFO_FLUSH, 0);
|
||||
+
|
||||
+ enet_set(enet, ENET_MIB_CTRL, ENET_MIB_CTRL_CLR_MIB);
|
||||
+ enet_maskset(enet, ENET_MIB_CTRL, ENET_MIB_CTRL_CLR_MIB, 0);
|
||||
+
|
||||
+ cmd = enet_umac_read(enet, UMAC_CMD);
|
||||
+ cmd &= ~(CMD_SPEED_MASK << CMD_SPEED_SHIFT);
|
||||
+ cmd &= ~CMD_TX_EN;
|
||||
+ cmd &= ~CMD_RX_EN;
|
||||
+ cmd |= CMD_SPEED_1000 << CMD_SPEED_SHIFT;
|
||||
+ enet_umac_write(enet, UMAC_CMD, cmd);
|
||||
+
|
||||
+ enet_maskset(enet, ENET_GMAC_STATUS,
|
||||
+ ENET_GMAC_STATUS_ETH_SPEED_MASK |
|
||||
+ ENET_GMAC_STATUS_HD |
|
||||
+ ENET_GMAC_STATUS_AUTO_CFG_EN |
|
||||
+ ENET_GMAC_STATUS_LINK_UP,
|
||||
+ ENET_GMAC_STATUS_ETH_SPEED_1000 |
|
||||
+ ENET_GMAC_STATUS_AUTO_CFG_EN |
|
||||
+ ENET_GMAC_STATUS_LINK_UP);
|
||||
+}
|
||||
+
|
||||
+static irqreturn_t bcm4908enet_irq_handler(int irq, void *dev_id)
|
||||
+{
|
||||
+ struct bcm4908enet *enet = dev_id;
|
||||
+
|
||||
+ bcm4908enet_intrs_off(enet);
|
||||
+ bcm4908enet_intrs_ack(enet);
|
||||
+
|
||||
+ napi_schedule(&enet->napi);
|
||||
+
|
||||
+ return IRQ_HANDLED;
|
||||
+}
|
||||
+
|
||||
+static int bcm4908enet_open(struct net_device *netdev)
|
||||
+{
|
||||
+ struct bcm4908enet *enet = netdev_priv(netdev);
|
||||
+ struct device *dev = enet->dev;
|
||||
+ int err;
|
||||
+
|
||||
+ err = request_irq(netdev->irq, bcm4908enet_irq_handler, 0, "enet", enet);
|
||||
+ if (err) {
|
||||
+ dev_err(dev, "Failed to request IRQ %d: %d\n", netdev->irq, err);
|
||||
+ return err;
|
||||
+ }
|
||||
+
|
||||
+ bcm4908enet_gmac_init(enet);
|
||||
+ bcm4908enet_dma_reset(enet);
|
||||
+ bcm4908enet_dma_init(enet);
|
||||
+
|
||||
+ enet_umac_set(enet, UMAC_CMD, CMD_TX_EN | CMD_RX_EN);
|
||||
+
|
||||
+ enet_set(enet, ENET_DMA_CONTROLLER_CFG, ENET_DMA_CTRL_CFG_MASTER_EN);
|
||||
+ enet_maskset(enet, ENET_DMA_CONTROLLER_CFG, ENET_DMA_CTRL_CFG_FLOWC_CH1_EN, 0);
|
||||
+ bcm4908enet_dma_rx_ring_enable(enet, &enet->rx_ring);
|
||||
+
|
||||
+ napi_enable(&enet->napi);
|
||||
+ netif_carrier_on(netdev);
|
||||
+ netif_start_queue(netdev);
|
||||
+
|
||||
+ bcm4908enet_intrs_ack(enet);
|
||||
+ bcm4908enet_intrs_on(enet);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int bcm4908enet_stop(struct net_device *netdev)
|
||||
+{
|
||||
+ struct bcm4908enet *enet = netdev_priv(netdev);
|
||||
+
|
||||
+ netif_stop_queue(netdev);
|
||||
+ netif_carrier_off(netdev);
|
||||
+ napi_disable(&enet->napi);
|
||||
+
|
||||
+ bcm4908enet_dma_rx_ring_disable(enet, &enet->rx_ring);
|
||||
+ bcm4908enet_dma_tx_ring_disable(enet, &enet->tx_ring);
|
||||
+
|
||||
+ bcm4908enet_dma_uninit(enet);
|
||||
+
|
||||
+ free_irq(enet->netdev->irq, enet);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int bcm4908enet_start_xmit(struct sk_buff *skb, struct net_device *netdev)
|
||||
+{
|
||||
+ struct bcm4908enet *enet = netdev_priv(netdev);
|
||||
+ struct bcm4908enet_dma_ring *ring = &enet->tx_ring;
|
||||
+ struct bcm4908enet_dma_ring_slot *slot;
|
||||
+ struct device *dev = enet->dev;
|
||||
+ struct bcm4908enet_dma_ring_bd *buf_desc;
|
||||
+ int free_buf_descs;
|
||||
+ u32 tmp;
|
||||
+
|
||||
+ /* Free transmitted skbs */
|
||||
+ while (ring->read_idx != ring->write_idx) {
|
||||
+ buf_desc = &ring->buf_desc[ring->read_idx];
|
||||
+ if (buf_desc->ctl & DMA_CTL_STATUS_OWN)
|
||||
+ break;
|
||||
+ slot = &ring->slots[ring->read_idx];
|
||||
+
|
||||
+ dma_unmap_single(dev, slot->dma_addr, slot->len, DMA_TO_DEVICE);
|
||||
+ dev_kfree_skb(slot->skb);
|
||||
+ if (++ring->read_idx == ring->length)
|
||||
+ ring->read_idx = 0;
|
||||
+ }
|
||||
+
|
||||
+ /* Don't use the last empty buf descriptor */
|
||||
+ if (ring->read_idx <= ring->write_idx)
|
||||
+ free_buf_descs = ring->read_idx - ring->write_idx + ring->length;
|
||||
+ else
|
||||
+ free_buf_descs = ring->read_idx - ring->write_idx;
|
||||
+ if (free_buf_descs < 2)
|
||||
+ return NETDEV_TX_BUSY;
|
||||
+
|
||||
+ /* Hardware removes OWN bit after sending data */
|
||||
+ buf_desc = &ring->buf_desc[ring->write_idx];
|
||||
+ if (unlikely(le32_to_cpu(buf_desc->ctl) & DMA_CTL_STATUS_OWN)) {
|
||||
+ netif_stop_queue(netdev);
|
||||
+ return NETDEV_TX_BUSY;
|
||||
+ }
|
||||
+
|
||||
+ slot = &ring->slots[ring->write_idx];
|
||||
+ slot->skb = skb;
|
||||
+ slot->len = skb->len;
|
||||
+ slot->dma_addr = dma_map_single(dev, skb->data, skb->len, DMA_TO_DEVICE);
|
||||
+ if (unlikely(dma_mapping_error(dev, slot->dma_addr)))
|
||||
+ return NETDEV_TX_BUSY;
|
||||
+
|
||||
+ tmp = skb->len << DMA_CTL_LEN_DESC_BUFLENGTH_SHIFT;
|
||||
+ tmp |= DMA_CTL_STATUS_OWN;
|
||||
+ tmp |= DMA_CTL_STATUS_SOP;
|
||||
+ tmp |= DMA_CTL_STATUS_EOP;
|
||||
+ tmp |= DMA_CTL_STATUS_APPEND_CRC;
|
||||
+ if (ring->write_idx + 1 == ring->length - 1)
|
||||
+ tmp |= DMA_CTL_STATUS_WRAP;
|
||||
+
|
||||
+ buf_desc->addr = cpu_to_le32((uint32_t)slot->dma_addr);
|
||||
+ buf_desc->ctl = cpu_to_le32(tmp);
|
||||
+
|
||||
+ bcm4908enet_dma_tx_ring_ensable(enet, &enet->tx_ring);
|
||||
+
|
||||
+ if (++ring->write_idx == ring->length - 1)
|
||||
+ ring->write_idx = 0;
|
||||
+ enet->netdev->stats.tx_bytes += skb->len;
|
||||
+ enet->netdev->stats.tx_packets++;
|
||||
+
|
||||
+ return NETDEV_TX_OK;
|
||||
+}
|
||||
+
|
||||
+static int bcm4908enet_poll(struct napi_struct *napi, int weight)
|
||||
+{
|
||||
+ struct bcm4908enet *enet = container_of(napi, struct bcm4908enet, napi);
|
||||
+ struct device *dev = enet->dev;
|
||||
+ int handled = 0;
|
||||
+
|
||||
+ while (handled < weight) {
|
||||
+ struct bcm4908enet_dma_ring_bd *buf_desc;
|
||||
+ struct bcm4908enet_dma_ring_slot slot;
|
||||
+ u32 ctl;
|
||||
+ int len;
|
||||
+ int err;
|
||||
+
|
||||
+ buf_desc = &enet->rx_ring.buf_desc[enet->rx_ring.read_idx];
|
||||
+ ctl = le32_to_cpu(buf_desc->ctl);
|
||||
+ if (ctl & DMA_CTL_STATUS_OWN)
|
||||
+ break;
|
||||
+
|
||||
+ slot = enet->rx_ring.slots[enet->rx_ring.read_idx];
|
||||
+
|
||||
+ /* Provide new buffer before unpinning the old one */
|
||||
+ err = bcm4908enet_dma_alloc_rx_buf(enet, enet->rx_ring.read_idx);
|
||||
+ if (err)
|
||||
+ break;
|
||||
+
|
||||
+ if (++enet->rx_ring.read_idx == enet->rx_ring.length)
|
||||
+ enet->rx_ring.read_idx = 0;
|
||||
+
|
||||
+ len = (ctl & DMA_CTL_LEN_DESC_BUFLENGTH) >> DMA_CTL_LEN_DESC_BUFLENGTH_SHIFT;
|
||||
+
|
||||
+ if (len < ENET_MTU_MIN ||
|
||||
+ (ctl & (DMA_CTL_STATUS_SOP | DMA_CTL_STATUS_EOP)) != (DMA_CTL_STATUS_SOP | DMA_CTL_STATUS_EOP)) {
|
||||
+ enet->netdev->stats.rx_dropped++;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ dma_unmap_single(dev, slot.dma_addr, slot.len, DMA_FROM_DEVICE);
|
||||
+
|
||||
+ skb_put(slot.skb, len - 4 + 2);
|
||||
+ slot.skb->protocol = eth_type_trans(slot.skb, enet->netdev);
|
||||
+ netif_receive_skb(slot.skb);
|
||||
+
|
||||
+ enet->netdev->stats.rx_packets++;
|
||||
+ enet->netdev->stats.rx_bytes += len;
|
||||
+ }
|
||||
+
|
||||
+ if (handled < weight) {
|
||||
+ napi_complete_done(napi, handled);
|
||||
+ bcm4908enet_intrs_on(enet);
|
||||
+ }
|
||||
+
|
||||
+ return handled;
|
||||
+}
|
||||
+
|
||||
+static const struct net_device_ops bcm96xx_netdev_ops = {
|
||||
+ .ndo_open = bcm4908enet_open,
|
||||
+ .ndo_stop = bcm4908enet_stop,
|
||||
+ .ndo_start_xmit = bcm4908enet_start_xmit,
|
||||
+ .ndo_set_mac_address = eth_mac_addr,
|
||||
+};
|
||||
+
|
||||
+static int bcm4908enet_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct device *dev = &pdev->dev;
|
||||
+ struct net_device *netdev;
|
||||
+ struct bcm4908enet *enet;
|
||||
+ int err;
|
||||
+
|
||||
+ netdev = devm_alloc_etherdev(dev, sizeof(*enet));
|
||||
+ if (!netdev)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ enet = netdev_priv(netdev);
|
||||
+ enet->dev = dev;
|
||||
+ enet->netdev = netdev;
|
||||
+
|
||||
+ enet->base = devm_platform_ioremap_resource(pdev, 0);
|
||||
+ if (IS_ERR(enet->base)) {
|
||||
+ dev_err(dev, "Failed to map registers: %ld\n", PTR_ERR(enet->base));
|
||||
+ return PTR_ERR(enet->base);
|
||||
+ }
|
||||
+
|
||||
+ netdev->irq = platform_get_irq_byname(pdev, "rx");
|
||||
+ if (netdev->irq < 0)
|
||||
+ return netdev->irq;
|
||||
+
|
||||
+ dma_set_coherent_mask(dev, DMA_BIT_MASK(32));
|
||||
+
|
||||
+ err = bcm4908enet_dma_alloc(enet);
|
||||
+ if (err)
|
||||
+ return err;
|
||||
+
|
||||
+ SET_NETDEV_DEV(netdev, &pdev->dev);
|
||||
+ eth_hw_addr_random(netdev);
|
||||
+ netdev->netdev_ops = &bcm96xx_netdev_ops;
|
||||
+ netdev->min_mtu = ETH_ZLEN;
|
||||
+ netdev->mtu = ENET_MTU_MAX;
|
||||
+ netdev->max_mtu = ENET_MTU_MAX;
|
||||
+ netif_napi_add(netdev, &enet->napi, bcm4908enet_poll, 64);
|
||||
+
|
||||
+ err = register_netdev(netdev);
|
||||
+ if (err) {
|
||||
+ bcm4908enet_dma_free(enet);
|
||||
+ return err;
|
||||
+ }
|
||||
+
|
||||
+ platform_set_drvdata(pdev, enet);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int bcm4908enet_remove(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct bcm4908enet *enet = platform_get_drvdata(pdev);
|
||||
+
|
||||
+ unregister_netdev(enet->netdev);
|
||||
+ netif_napi_del(&enet->napi);
|
||||
+ bcm4908enet_dma_free(enet);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct of_device_id bcm4908enet_of_match[] = {
|
||||
+ { .compatible = "brcm,bcm4908enet"},
|
||||
+ {},
|
||||
+};
|
||||
+
|
||||
+static struct platform_driver bcm4908enet_driver = {
|
||||
+ .driver = {
|
||||
+ .name = "bcm4908enet",
|
||||
+ .of_match_table = bcm4908enet_of_match,
|
||||
+ },
|
||||
+ .probe = bcm4908enet_probe,
|
||||
+ .remove = bcm4908enet_remove,
|
||||
+};
|
||||
+module_platform_driver(bcm4908enet_driver);
|
||||
+
|
||||
+MODULE_LICENSE("GPL v2");
|
||||
+MODULE_DEVICE_TABLE(of, bcm4908enet_of_match);
|
||||
--- /dev/null
|
||||
+++ b/drivers/net/ethernet/broadcom/bcm4908enet.h
|
||||
@@ -0,0 +1,96 @@
|
||||
+/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
+#ifndef __BCM4908ENET_H
|
||||
+#define __BCM4908ENET_H
|
||||
+
|
||||
+#define ENET_CONTROL 0x000
|
||||
+#define ENET_MIB_CTRL 0x004
|
||||
+#define ENET_MIB_CTRL_CLR_MIB 0x00000001
|
||||
+#define ENET_RX_ERR_MASK 0x008
|
||||
+#define ENET_MIB_MAX_PKT_SIZE 0x00C
|
||||
+#define ENET_MIB_MAX_PKT_SIZE_VAL 0x00003fff
|
||||
+#define ENET_DIAG_OUT 0x01c
|
||||
+#define ENET_ENABLE_DROP_PKT 0x020
|
||||
+#define ENET_IRQ_ENABLE 0x024
|
||||
+#define ENET_IRQ_ENABLE_OVFL 0x00000001
|
||||
+#define ENET_GMAC_STATUS 0x028
|
||||
+#define ENET_GMAC_STATUS_ETH_SPEED_MASK 0x00000003
|
||||
+#define ENET_GMAC_STATUS_ETH_SPEED_10 0x00000000
|
||||
+#define ENET_GMAC_STATUS_ETH_SPEED_100 0x00000001
|
||||
+#define ENET_GMAC_STATUS_ETH_SPEED_1000 0x00000002
|
||||
+#define ENET_GMAC_STATUS_HD 0x00000004
|
||||
+#define ENET_GMAC_STATUS_AUTO_CFG_EN 0x00000008
|
||||
+#define ENET_GMAC_STATUS_LINK_UP 0x00000010
|
||||
+#define ENET_IRQ_STATUS 0x02c
|
||||
+#define ENET_IRQ_STATUS_OVFL 0x00000001
|
||||
+#define ENET_OVERFLOW_COUNTER 0x030
|
||||
+#define ENET_FLUSH 0x034
|
||||
+#define ENET_FLUSH_RXFIFO_FLUSH 0x00000001
|
||||
+#define ENET_FLUSH_TXFIFO_FLUSH 0x00000002
|
||||
+#define ENET_RSV_SELECT 0x038
|
||||
+#define ENET_BP_FORCE 0x03c
|
||||
+#define ENET_BP_FORCE_FORCE 0x00000001
|
||||
+#define ENET_DMA_RX_OK_TO_SEND_COUNT 0x040
|
||||
+#define ENET_DMA_RX_OK_TO_SEND_COUNT_VAL 0x0000000f
|
||||
+#define ENET_TX_CRC_CTRL 0x044
|
||||
+#define ENET_MIB 0x200
|
||||
+#define ENET_UNIMAC 0x400
|
||||
+#define ENET_DMA 0x800
|
||||
+#define ENET_DMA_CONTROLLER_CFG 0x800
|
||||
+#define ENET_DMA_CTRL_CFG_MASTER_EN 0x00000001
|
||||
+#define ENET_DMA_CTRL_CFG_FLOWC_CH1_EN 0x00000002
|
||||
+#define ENET_DMA_CTRL_CFG_FLOWC_CH3_EN 0x00000004
|
||||
+#define ENET_DMA_FLOWCTL_CH1_THRESH_LO 0x804
|
||||
+#define ENET_DMA_FLOWCTL_CH1_THRESH_HI 0x808
|
||||
+#define ENET_DMA_FLOWCTL_CH1_ALLOC 0x80c
|
||||
+#define ENET_DMA_FLOWCTL_CH1_ALLOC_FORCE 0x80000000
|
||||
+#define ENET_DMA_FLOWCTL_CH3_THRESH_LO 0x810
|
||||
+#define ENET_DMA_FLOWCTL_CH3_THRESH_HI 0x814
|
||||
+#define ENET_DMA_FLOWCTL_CH3_ALLOC 0x818
|
||||
+#define ENET_DMA_FLOWCTL_CH5_THRESH_LO 0x81C
|
||||
+#define ENET_DMA_FLOWCTL_CH5_THRESH_HI 0x820
|
||||
+#define ENET_DMA_FLOWCTL_CH5_ALLOC 0x824
|
||||
+#define ENET_DMA_FLOWCTL_CH7_THRESH_LO 0x828
|
||||
+#define ENET_DMA_FLOWCTL_CH7_THRESH_HI 0x82C
|
||||
+#define ENET_DMA_FLOWCTL_CH7_ALLOC 0x830
|
||||
+#define ENET_DMA_CTRL_CHANNEL_RESET 0x834
|
||||
+#define ENET_DMA_CTRL_CHANNEL_DEBUG 0x838
|
||||
+#define ENET_DMA_CTRL_GLOBAL_INTERRUPT_STATUS 0x840
|
||||
+#define ENET_DMA_CTRL_GLOBAL_INTERRUPT_MASK 0x844
|
||||
+#define ENET_DMA_CH0_CFG 0xa00 /* RX */
|
||||
+#define ENET_DMA_CH1_CFG 0xa10 /* TX */
|
||||
+#define ENET_DMA_CH0_STATE_RAM 0xc00 /* RX */
|
||||
+#define ENET_DMA_CH1_STATE_RAM 0xc10 /* TX */
|
||||
+
|
||||
+#define ENET_DMA_CH_CFG 0x00 /* assorted configuration */
|
||||
+#define ENET_DMA_CH_CFG_ENABLE 0x00000001 /* set to enable channel */
|
||||
+#define ENET_DMA_CH_CFG_PKT_HALT 0x00000002 /* idle after an EOP flag is detected */
|
||||
+#define ENET_DMA_CH_CFG_BURST_HALT 0x00000004 /* idle after finish current memory burst */
|
||||
+#define ENET_DMA_CH_CFG_INT_STAT 0x04 /* interrupts control and status */
|
||||
+#define ENET_DMA_CH_CFG_INT_MASK 0x08 /* interrupts mask */
|
||||
+#define ENET_DMA_CH_CFG_INT_BUFF_DONE 0x00000001 /* buffer done */
|
||||
+#define ENET_DMA_CH_CFG_INT_DONE 0x00000002 /* packet xfer complete */
|
||||
+#define ENET_DMA_CH_CFG_INT_NO_DESC 0x00000004 /* no valid descriptors */
|
||||
+#define ENET_DMA_CH_CFG_INT_RX_ERROR 0x00000008 /* rxdma detect client protocol error */
|
||||
+#define ENET_DMA_CH_CFG_MAX_BURST 0x0c /* max burst length permitted */
|
||||
+#define ENET_DMA_CH_CFG_MAX_BURST_DESCSIZE_SEL 0x00040000 /* DMA Descriptor Size Selection */
|
||||
+#define ENET_DMA_CH_CFG_SIZE 0x10
|
||||
+
|
||||
+#define ENET_DMA_CH_STATE_RAM_BASE_DESC_PTR 0x00 /* descriptor ring start address */
|
||||
+#define ENET_DMA_CH_STATE_RAM_STATE_DATA 0x04 /* state/bytes done/ring offset */
|
||||
+#define ENET_DMA_CH_STATE_RAM_DESC_LEN_STATUS 0x08 /* buffer descriptor status and len */
|
||||
+#define ENET_DMA_CH_STATE_RAM_DESC_BASE_BUFPTR 0x0c /* buffer descrpitor current processing */
|
||||
+#define ENET_DMA_CH_STATE_RAM_SIZE 0x10
|
||||
+
|
||||
+#define DMA_CTL_STATUS_APPEND_CRC 0x00000100
|
||||
+#define DMA_CTL_STATUS_APPEND_BRCM_TAG 0x00000200
|
||||
+#define DMA_CTL_STATUS_PRIO 0x00000C00 /* Prio for Tx */
|
||||
+#define DMA_CTL_STATUS_WRAP 0x00001000 /* */
|
||||
+#define DMA_CTL_STATUS_SOP 0x00002000 /* first buffer in packet */
|
||||
+#define DMA_CTL_STATUS_EOP 0x00004000 /* last buffer in packet */
|
||||
+#define DMA_CTL_STATUS_OWN 0x00008000 /* cleared by DMA, set by SW */
|
||||
+#define DMA_CTL_LEN_DESC_BUFLENGTH 0x0fff0000
|
||||
+#define DMA_CTL_LEN_DESC_BUFLENGTH_SHIFT 16
|
||||
+#define DMA_CTL_LEN_DESC_MULTICAST 0x40000000
|
||||
+#define DMA_CTL_LEN_DESC_USEFPM 0x80000000
|
||||
+
|
||||
+#endif
|
||||
@ -0,0 +1,49 @@
|
||||
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||
Date: Mon, 8 Feb 2021 09:11:36 +0100
|
||||
Subject: [PATCH] arm64: dts: broadcom: bcm4908: describe Ethernet controller
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
BCM4908 SoCs have an integrated Ethernet controller.
|
||||
|
||||
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||
---
|
||||
|
||||
--- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908-asus-gt-ac5300.dts
|
||||
+++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908-asus-gt-ac5300.dts
|
||||
@@ -87,6 +87,17 @@
|
||||
full-duplex;
|
||||
};
|
||||
};
|
||||
+
|
||||
+ port@8 {
|
||||
+ reg = <8>;
|
||||
+ phy-mode = "internal";
|
||||
+ brcm,use-bcm-hdr;
|
||||
+ ethernet = <&gmac>;
|
||||
+ fixed-link {
|
||||
+ speed = <1000>;
|
||||
+ full-duplex;
|
||||
+ };
|
||||
+ };
|
||||
};
|
||||
|
||||
&mdio {
|
||||
--- a/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi
|
||||
+++ b/arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi
|
||||
@@ -112,6 +112,14 @@
|
||||
#size-cells = <1>;
|
||||
ranges = <0x00 0x00 0x80000000 0x281000>;
|
||||
|
||||
+ gmac: ethernet@2000 {
|
||||
+ compatible = "brcm,bcm4908enet";
|
||||
+ reg = <0x2000 0x1000>;
|
||||
+
|
||||
+ interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ interrupt-names = "rx";
|
||||
+ };
|
||||
+
|
||||
usb_phy: usb-phy@c200 {
|
||||
compatible = "brcm,bcm4908-usb-phy";
|
||||
reg = <0xc200 0x100>;
|
||||
@ -1,23 +1,9 @@
|
||||
CONFIG_ARCH_32BIT_OFF_T=y
|
||||
CONFIG_ARCH_CLOCKSOURCE_DATA=y
|
||||
CONFIG_ARCH_HAS_DMA_COHERENT_TO_PFN=y
|
||||
CONFIG_ARCH_HAS_DMA_PREP_COHERENT=y
|
||||
CONFIG_ARCH_HAS_DMA_WRITE_COMBINE=y
|
||||
CONFIG_ARCH_HAS_ELF_RANDOMIZE=y
|
||||
CONFIG_ARCH_HAS_PTE_SPECIAL=y
|
||||
CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE=y
|
||||
CONFIG_ARCH_HAS_UNCACHED_SEGMENT=y
|
||||
CONFIG_ARCH_HIBERNATION_POSSIBLE=y
|
||||
CONFIG_ARCH_MMAP_RND_BITS_MAX=15
|
||||
CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=15
|
||||
CONFIG_ARCH_SUPPORTS_UPROBES=y
|
||||
CONFIG_ARCH_SUSPEND_POSSIBLE=y
|
||||
CONFIG_ARCH_USE_BUILTIN_BSWAP=y
|
||||
CONFIG_ARCH_USE_MEMREMAP_PROT=y
|
||||
CONFIG_ARCH_USE_QUEUED_RWLOCKS=y
|
||||
CONFIG_ARCH_USE_QUEUED_SPINLOCKS=y
|
||||
CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT=y
|
||||
CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y
|
||||
CONFIG_BCM6345_EXT_IRQ=y
|
||||
CONFIG_BCM6345_PERIPH_IRQ=y
|
||||
CONFIG_BCM63XX=y
|
||||
@ -77,11 +63,7 @@ CONFIG_DMA_NONCOHERENT=y
|
||||
CONFIG_DMA_NONCOHERENT_CACHE_SYNC=y
|
||||
CONFIG_DTC=y
|
||||
CONFIG_EARLY_PRINTK=y
|
||||
CONFIG_EFI_EARLYCON=y
|
||||
CONFIG_FIXED_PHY=y
|
||||
CONFIG_FONT_8x16=y
|
||||
CONFIG_FONT_AUTOSELECT=y
|
||||
CONFIG_FONT_SUPPORT=y
|
||||
CONFIG_FW_LOADER_PAGED_BUF=y
|
||||
CONFIG_GENERIC_ATOMIC64=y
|
||||
CONFIG_GENERIC_CLOCKEVENTS=y
|
||||
@ -111,42 +93,8 @@ CONFIG_HANDLE_DOMAIN_IRQ=y
|
||||
CONFIG_HAS_DMA=y
|
||||
CONFIG_HAS_IOMEM=y
|
||||
CONFIG_HAS_IOPORT_MAP=y
|
||||
CONFIG_HAVE_ARCH_COMPILER_H=y
|
||||
CONFIG_HAVE_ARCH_JUMP_LABEL=y
|
||||
CONFIG_HAVE_ARCH_KGDB=y
|
||||
CONFIG_HAVE_ARCH_SECCOMP_FILTER=y
|
||||
CONFIG_HAVE_ARCH_TRACEHOOK=y
|
||||
CONFIG_HAVE_ASM_MODVERSIONS=y
|
||||
CONFIG_HAVE_CLK=y
|
||||
CONFIG_HAVE_CONTEXT_TRACKING=y
|
||||
CONFIG_HAVE_COPY_THREAD_TLS=y
|
||||
CONFIG_HAVE_C_RECORDMCOUNT=y
|
||||
CONFIG_HAVE_DEBUG_KMEMLEAK=y
|
||||
CONFIG_HAVE_DEBUG_STACKOVERFLOW=y
|
||||
CONFIG_HAVE_DMA_CONTIGUOUS=y
|
||||
CONFIG_HAVE_DYNAMIC_FTRACE=y
|
||||
CONFIG_HAVE_FAST_GUP=y
|
||||
CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
|
||||
CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
|
||||
CONFIG_HAVE_FUNCTION_TRACER=y
|
||||
CONFIG_HAVE_GENERIC_VDSO=y
|
||||
CONFIG_HAVE_IDE=y
|
||||
CONFIG_HAVE_IOREMAP_PROT=y
|
||||
CONFIG_HAVE_IRQ_EXIT_ON_IRQ_STACK=y
|
||||
CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y
|
||||
CONFIG_HAVE_LD_DEAD_CODE_DATA_ELIMINATION=y
|
||||
CONFIG_HAVE_MEMBLOCK_NODE_MAP=y
|
||||
CONFIG_HAVE_MOD_ARCH_SPECIFIC=y
|
||||
CONFIG_HAVE_NET_DSA=y
|
||||
CONFIG_HAVE_OPROFILE=y
|
||||
CONFIG_HAVE_PCI=y
|
||||
CONFIG_HAVE_PERF_EVENTS=y
|
||||
CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y
|
||||
CONFIG_HAVE_RSEQ=y
|
||||
CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
|
||||
CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y
|
||||
CONFIG_HW_RANDOM=y
|
||||
# CONFIG_HW_RANDOM_BCM2835 is not set
|
||||
CONFIG_HW_RANDOM_BCM2835=y
|
||||
CONFIG_HZ=250
|
||||
CONFIG_HZ_250=y
|
||||
CONFIG_HZ_PERIODIC=y
|
||||
@ -171,6 +119,7 @@ CONFIG_MIGRATION=y
|
||||
CONFIG_MIPS=y
|
||||
CONFIG_MIPS_ASID_BITS=8
|
||||
CONFIG_MIPS_ASID_SHIFT=0
|
||||
CONFIG_MIPS_CBPF_JIT=y
|
||||
CONFIG_MIPS_CLOCK_VSYSCALL=y
|
||||
# CONFIG_MIPS_CMDLINE_DTB_EXTEND is not set
|
||||
# CONFIG_MIPS_CMDLINE_FROM_BOOTLOADER is not set
|
||||
|
||||
@ -38,7 +38,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
const struct switchdev_obj_port_vlan *vlan);
|
||||
--- a/drivers/net/dsa/bcm_sf2.c
|
||||
+++ b/drivers/net/dsa/bcm_sf2.c
|
||||
@@ -635,7 +635,9 @@ static void bcm_sf2_sw_mac_link_down(str
|
||||
@@ -639,7 +639,9 @@ static void bcm_sf2_sw_mac_link_down(str
|
||||
static void bcm_sf2_sw_mac_link_up(struct dsa_switch *ds, int port,
|
||||
unsigned int mode,
|
||||
phy_interface_t interface,
|
||||
|
||||
@ -3,20 +3,9 @@
|
||||
# CONFIG_ADVANCED_OPTIONS is not set
|
||||
CONFIG_AR8216_PHY=y
|
||||
CONFIG_AR8216_PHY_LEDS=y
|
||||
CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
|
||||
CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
|
||||
CONFIG_ARCH_HAS_DMA_SET_COHERENT_MASK=y
|
||||
CONFIG_ARCH_HAS_ELF_RANDOMIZE=y
|
||||
CONFIG_ARCH_HAS_FORTIFY_SOURCE=y
|
||||
CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y
|
||||
CONFIG_ARCH_HAS_MEMBARRIER_CALLBACKS=y
|
||||
CONFIG_ARCH_HAS_PHYS_TO_DMA=y
|
||||
CONFIG_ARCH_HAS_PTE_SPECIAL=y
|
||||
CONFIG_ARCH_HAS_SG_CHAIN=y
|
||||
CONFIG_ARCH_HAS_STRICT_KERNEL_RWX=y
|
||||
CONFIG_ARCH_HAS_WALK_MEMORY=y
|
||||
CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG=y
|
||||
CONFIG_ARCH_32BIT_OFF_T=y
|
||||
CONFIG_ARCH_HIBERNATION_POSSIBLE=y
|
||||
CONFIG_ARCH_KEEP_MEMBLOCK=y
|
||||
CONFIG_ARCH_MAY_HAVE_PC_FDC=y
|
||||
CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y
|
||||
CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y
|
||||
@ -26,19 +15,13 @@ CONFIG_ARCH_MMAP_RND_BITS_MIN=11
|
||||
CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=17
|
||||
CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=11
|
||||
CONFIG_ARCH_OPTIONAL_KERNEL_RWX=y
|
||||
CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y
|
||||
CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
|
||||
CONFIG_ARCH_SUPPORTS_UPROBES=y
|
||||
CONFIG_ARCH_SUSPEND_POSSIBLE=y
|
||||
CONFIG_ARCH_USE_BUILTIN_BSWAP=y
|
||||
CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y
|
||||
CONFIG_ARCH_WEAK_RELEASE_ACQUIRE=y
|
||||
CONFIG_ASN1=y
|
||||
CONFIG_AUDIT_ARCH=y
|
||||
CONFIG_BLK_MQ_PCI=y
|
||||
CONFIG_BOOKE=y
|
||||
CONFIG_BOOKE_WDT=y
|
||||
CONFIG_BOUNCE=y
|
||||
# CONFIG_BSC9131_RDB is not set
|
||||
# CONFIG_BSC9132_QDS is not set
|
||||
# CONFIG_C293_PCIE is not set
|
||||
@ -47,6 +30,7 @@ CONFIG_CLZ_TAB=y
|
||||
CONFIG_CMDLINE="console=ttyS0,115200"
|
||||
CONFIG_CMDLINE_BOOL=y
|
||||
# CONFIG_CMDLINE_OVERRIDE is not set
|
||||
CONFIG_COMPAT_32BIT_TIME=y
|
||||
# CONFIG_CORENET_GENERIC is not set
|
||||
# CONFIG_CPM2 is not set
|
||||
CONFIG_CPU_BIG_ENDIAN=y
|
||||
@ -70,7 +54,7 @@ CONFIG_CRYPTO_RSA=y
|
||||
# CONFIG_CRYPTO_SHA1_PPC is not set
|
||||
# CONFIG_CRYPTO_SHA1_PPC_SPE is not set
|
||||
# CONFIG_CRYPTO_SHA256_PPC_SPE is not set
|
||||
CONFIG_CRYPTO_WORKQUEUE=y
|
||||
CONFIG_DATA_SHIFT=12
|
||||
CONFIG_DEBUG_BUGVERBOSE=y
|
||||
CONFIG_DNOTIFY=y
|
||||
CONFIG_DTC=y
|
||||
@ -82,19 +66,18 @@ CONFIG_EARLY_PRINTK=y
|
||||
CONFIG_EDAC_ATOMIC_SCRUB=y
|
||||
CONFIG_EDAC_SUPPORT=y
|
||||
CONFIG_ENABLE_MUST_CHECK=y
|
||||
CONFIG_ETEXT_SHIFT=12
|
||||
CONFIG_ETHERNET_PACKET_MANGLE=y
|
||||
# CONFIG_FHCI_DEBUG is not set
|
||||
CONFIG_FIXED_PHY=y
|
||||
CONFIG_FSL_BOOKE=y
|
||||
# CONFIG_FSL_DPAA is not set
|
||||
CONFIG_FSL_EMB_PERFMON=y
|
||||
# CONFIG_FSL_FMAN is not set
|
||||
CONFIG_FSL_GTM=y
|
||||
CONFIG_FSL_LBC=y
|
||||
CONFIG_FSL_PCI=y
|
||||
CONFIG_FSL_PQ_MDIO=y
|
||||
CONFIG_FSL_SOC=y
|
||||
CONFIG_FSL_SOC_BOOKE=y
|
||||
CONFIG_FW_LOADER_PAGED_BUF=y
|
||||
CONFIG_GENERIC_ALLOCATOR=y
|
||||
CONFIG_GENERIC_ATOMIC64=y
|
||||
CONFIG_GENERIC_BUG=y
|
||||
@ -106,7 +89,6 @@ CONFIG_GENERIC_CPU_VULNERABILITIES=y
|
||||
CONFIG_GENERIC_IRQ_SHOW=y
|
||||
CONFIG_GENERIC_IRQ_SHOW_LEVEL=y
|
||||
CONFIG_GENERIC_ISA_DMA=y
|
||||
CONFIG_GENERIC_NVRAM=y
|
||||
CONFIG_GENERIC_PCI_IOMAP=y
|
||||
CONFIG_GENERIC_SMP_IDLE_THREAD=y
|
||||
CONFIG_GENERIC_STRNCPY_FROM_USER=y
|
||||
@ -121,40 +103,10 @@ CONFIG_GPIO_MPC8XXX=y
|
||||
CONFIG_HAS_DMA=y
|
||||
CONFIG_HAS_IOMEM=y
|
||||
CONFIG_HAS_IOPORT_MAP=y
|
||||
CONFIG_HAVE_ARCH_AUDITSYSCALL=y
|
||||
CONFIG_HAVE_ARCH_JUMP_LABEL=y
|
||||
CONFIG_HAVE_ARCH_KGDB=y
|
||||
CONFIG_HAVE_ARCH_SECCOMP_FILTER=y
|
||||
CONFIG_HAVE_ARCH_TRACEHOOK=y
|
||||
CONFIG_HAVE_CBPF_JIT=y
|
||||
CONFIG_HAVE_DEBUG_KMEMLEAK=y
|
||||
CONFIG_HAVE_DEBUG_STACKOVERFLOW=y
|
||||
CONFIG_HAVE_DYNAMIC_FTRACE=y
|
||||
CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
|
||||
CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
|
||||
CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
|
||||
CONFIG_HAVE_FUNCTION_TRACER=y
|
||||
CONFIG_HAVE_GENERIC_GUP=y
|
||||
CONFIG_HAVE_IDE=y
|
||||
CONFIG_HAVE_IOREMAP_PROT=y
|
||||
CONFIG_HAVE_IRQ_EXIT_ON_IRQ_STACK=y
|
||||
CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y
|
||||
CONFIG_HAVE_KPROBES_ON_FTRACE=y
|
||||
CONFIG_HAVE_LD_DEAD_CODE_DATA_ELIMINATION=y
|
||||
CONFIG_HAVE_MEMBLOCK=y
|
||||
CONFIG_HAVE_MEMBLOCK_NODE_MAP=y
|
||||
CONFIG_HAVE_MOD_ARCH_SPECIFIC=y
|
||||
CONFIG_HAVE_NET_DSA=y
|
||||
CONFIG_HAVE_OPROFILE=y
|
||||
CONFIG_HAVE_PERF_EVENTS=y
|
||||
CONFIG_HAVE_PERF_REGS=y
|
||||
CONFIG_HAVE_PERF_USER_STACK_DUMP=y
|
||||
CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y
|
||||
CONFIG_HAVE_RSEQ=y
|
||||
CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
|
||||
CONFIG_HAVE_VIRT_CPU_ACCOUNTING=y
|
||||
# CONFIG_HIVEAP_330 is not set
|
||||
CONFIG_HW_RANDOM=y
|
||||
CONFIG_HZ=250
|
||||
CONFIG_HZ_250=y
|
||||
CONFIG_HZ_PERIODIC=y
|
||||
CONFIG_I2C=y
|
||||
CONFIG_I2C_BOARDINFO=y
|
||||
@ -166,7 +118,6 @@ CONFIG_IRQ_DOMAIN=y
|
||||
CONFIG_IRQ_FORCED_THREADING=y
|
||||
CONFIG_IRQ_WORK=y
|
||||
CONFIG_ISA_DMA_API=y
|
||||
CONFIG_KERNEL_GZIP=y
|
||||
CONFIG_KERNEL_START=0xc0000000
|
||||
# CONFIG_KSI8560 is not set
|
||||
CONFIG_LEGACY_PTYS=y
|
||||
@ -194,18 +145,19 @@ CONFIG_MPIC=y
|
||||
CONFIG_MPIC_TIMER=y
|
||||
CONFIG_MPILIB=y
|
||||
# CONFIG_MTD_CFI is not set
|
||||
CONFIG_MTD_M25P80=y
|
||||
CONFIG_MTD_NAND_CORE=y
|
||||
CONFIG_MTD_NAND_ECC_SW_HAMMING=y
|
||||
CONFIG_MTD_RAW_NAND=y
|
||||
CONFIG_MTD_SPI_NOR=y
|
||||
# CONFIG_MVME2500 is not set
|
||||
CONFIG_NEED_PER_CPU_KM=y
|
||||
CONFIG_NEED_SG_DMA_LENGTH=y
|
||||
CONFIG_NLS=y
|
||||
CONFIG_NO_BOOTMEM=y
|
||||
CONFIG_NR_IRQS=512
|
||||
CONFIG_NVMEM=y
|
||||
CONFIG_OF=y
|
||||
CONFIG_OF_ADDRESS=y
|
||||
CONFIG_OF_DMA_DEFAULT_COHERENT=y
|
||||
CONFIG_OF_EARLY_FLATTREE=y
|
||||
CONFIG_OF_FLATTREE=y
|
||||
CONFIG_OF_GPIO=y
|
||||
@ -248,9 +200,8 @@ CONFIG_PPC_ADV_DEBUG_IACS=2
|
||||
CONFIG_PPC_ADV_DEBUG_REGS=y
|
||||
CONFIG_PPC_BARRIER_NOSPEC=y
|
||||
CONFIG_PPC_BOOK3E_MMU=y
|
||||
# CONFIG_PPC_BOOK3S_32 is not set
|
||||
# CONFIG_PPC_BOOK3S_6xx is not set
|
||||
# CONFIG_PPC_BOOK3S_601 is not set
|
||||
# CONFIG_PPC_BOOK3S_6xx is not set
|
||||
CONFIG_PPC_DOORBELL=y
|
||||
# CONFIG_PPC_E500MC is not set
|
||||
# CONFIG_PPC_EARLY_DEBUG is not set
|
||||
@ -258,30 +209,27 @@ CONFIG_PPC_FSL_BOOK3E=y
|
||||
CONFIG_PPC_INDIRECT_PCI=y
|
||||
# CONFIG_PPC_IRQ_SOFT_MASK_DEBUG is not set
|
||||
CONFIG_PPC_MMU_NOHASH=y
|
||||
CONFIG_PPC_PCI_CHOICE=y
|
||||
CONFIG_PPC_MMU_NOHASH_32=y
|
||||
CONFIG_PPC_PAGE_SHIFT=12
|
||||
# CONFIG_PPC_PTDUMP is not set
|
||||
# CONFIG_PPC_QEMU_E500 is not set
|
||||
CONFIG_PPC_SMP_MUXED_IPI=y
|
||||
CONFIG_PPC_UDBG_16550=y
|
||||
CONFIG_PPC_WERROR=y
|
||||
CONFIG_QE_GPIO=y
|
||||
CONFIG_QE_USB=y
|
||||
CONFIG_QUICC_ENGINE=y
|
||||
CONFIG_RAS=y
|
||||
# CONFIG_RED_15W_REV1 is not set
|
||||
CONFIG_REGMAP=y
|
||||
CONFIG_REGMAP_I2C=y
|
||||
CONFIG_REGMAP_SPI=y
|
||||
CONFIG_RTC_CLASS=y
|
||||
CONFIG_RTC_DRV_GENERIC=y
|
||||
CONFIG_RTC_I2C_AND_SPI=y
|
||||
CONFIG_RTC_MC146818_LIB=y
|
||||
CONFIG_RWSEM_XCHGADD_ALGORITHM=y
|
||||
# CONFIG_SBC8548 is not set
|
||||
# CONFIG_SCOM_DEBUGFS is not set
|
||||
CONFIG_SERIAL_8250_EXTENDED=y
|
||||
CONFIG_SERIAL_8250_FSL=y
|
||||
CONFIG_SERIAL_8250_SHARE_IRQ=y
|
||||
CONFIG_SERIAL_MCTRL_GPIO=y
|
||||
CONFIG_SERIAL_OF_PLATFORM=y
|
||||
# CONFIG_SERIAL_QE is not set
|
||||
CONFIG_SIMPLE_GPIO=y
|
||||
@ -300,6 +248,7 @@ CONFIG_SWCONFIG=y
|
||||
CONFIG_SWPHY=y
|
||||
CONFIG_SYSCTL_EXCEPTION_TRACE=y
|
||||
CONFIG_TASK_SIZE=0xc0000000
|
||||
CONFIG_THREAD_INFO_IN_TASK=y
|
||||
CONFIG_THREAD_SHIFT=13
|
||||
CONFIG_TICK_CPU_ACCOUNTING=y
|
||||
CONFIG_TINY_SRCU=y
|
||||
@ -321,6 +270,5 @@ CONFIG_VM_EVENT_COUNTERS=y
|
||||
CONFIG_WATCHDOG_CORE=y
|
||||
# CONFIG_WS_AP3710I is not set
|
||||
# CONFIG_XES_MPC85xx is not set
|
||||
# CONFIG_XPS_USB_HCD_XILINX is not set
|
||||
CONFIG_XZ_DEC_BCJ=y
|
||||
CONFIG_XZ_DEC_POWERPC=y
|
||||
|
||||
195
target/linux/ramips/dts/mt7621_cudy_wr1300.dts
Normal file
195
target/linux/ramips/dts/mt7621_cudy_wr1300.dts
Normal file
@ -0,0 +1,195 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
|
||||
|
||||
#include "mt7621.dtsi"
|
||||
|
||||
#include <dt-bindings/input/input.h>
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
|
||||
/ {
|
||||
compatible = "cudy,wr1300", "mediatek,mt7621-soc";
|
||||
model = "Cudy WR1300";
|
||||
|
||||
aliases {
|
||||
led-boot = &led_sys;
|
||||
led-failsafe = &led_sys;
|
||||
led-running = &led_sys;
|
||||
led-upgrade = &led_sys;
|
||||
label-mac-device = &gmac0;
|
||||
};
|
||||
|
||||
chosen {
|
||||
bootargs = "console=ttyS0,115200";
|
||||
};
|
||||
|
||||
keys {
|
||||
compatible = "gpio-keys";
|
||||
|
||||
reset {
|
||||
label = "reset";
|
||||
gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
|
||||
linux,code = <KEY_RESTART>;
|
||||
};
|
||||
|
||||
wps {
|
||||
label = "wps";
|
||||
gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
|
||||
linux,code = <KEY_WPS_BUTTON>;
|
||||
};
|
||||
};
|
||||
|
||||
leds {
|
||||
compatible = "gpio-leds";
|
||||
|
||||
led_sys: sys {
|
||||
label = "green:sys";
|
||||
gpios = <&gpio 15 GPIO_ACTIVE_HIGH>;
|
||||
};
|
||||
|
||||
usb {
|
||||
label = "green:usb";
|
||||
gpios = <&gpio 14 GPIO_ACTIVE_HIGH>;
|
||||
trigger-sources = <&xhci_ehci_port1>, <&ehci_port2>;
|
||||
linux,default-trigger = "usbport";
|
||||
};
|
||||
|
||||
wps {
|
||||
label = "green:wps";
|
||||
gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&spi0 {
|
||||
status = "okay";
|
||||
|
||||
flash@0 {
|
||||
compatible = "jedec,spi-nor";
|
||||
reg = <0>;
|
||||
spi-max-frequency = <80000000>;
|
||||
m25p,fast-read;
|
||||
|
||||
partitions {
|
||||
compatible = "fixed-partitions";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
partition@0 {
|
||||
label = "u-boot";
|
||||
reg = <0x0 0x30000>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
partition@30000 {
|
||||
label = "u-boot-env";
|
||||
reg = <0x30000 0x10000>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
factory: partition@40000 {
|
||||
label = "factory";
|
||||
reg = <0x40000 0x10000>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
partition@50000 {
|
||||
compatible = "denx,uimage";
|
||||
label = "firmware";
|
||||
reg = <0x50000 0xf80000>;
|
||||
};
|
||||
|
||||
partition@fd0000 {
|
||||
label = "debug";
|
||||
reg = <0xfd0000 0x10000>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
partition@fe0000 {
|
||||
label = "backup";
|
||||
reg = <0xfe0000 0x10000>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
bdinfo: partition@ff0000 {
|
||||
label = "bdinfo";
|
||||
reg = <0xff0000 0x10000>;
|
||||
read-only;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&pcie {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&pcie0 {
|
||||
wifi@0,0 {
|
||||
compatible = "pci14c3,7603";
|
||||
reg = <0x0000 0 0 0 0>;
|
||||
mediatek,mtd-eeprom = <&factory 0x0000>;
|
||||
mtd-mac-address = <&bdinfo 0xde00>;
|
||||
ieee80211-freq-limit = <2400000 2500000>;
|
||||
|
||||
led {
|
||||
led-active-low;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&pcie1 {
|
||||
wifi@0,0 {
|
||||
compatible = "pci14c3,7662";
|
||||
reg = <0x0000 0 0 0 0>;
|
||||
mediatek,mtd-eeprom = <&factory 0x8000>;
|
||||
mtd-mac-address = <&bdinfo 0xde00>;
|
||||
mtd-mac-address-increment = <2>;
|
||||
ieee80211-freq-limit = <5000000 6000000>;
|
||||
|
||||
led {
|
||||
led-sources = <2>;
|
||||
led-active-low;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&gmac0 {
|
||||
mtd-mac-address = <&bdinfo 0xde00>;
|
||||
};
|
||||
|
||||
&switch0 {
|
||||
ports {
|
||||
port@0 {
|
||||
status = "okay";
|
||||
label = "lan4";
|
||||
};
|
||||
|
||||
port@1 {
|
||||
status = "okay";
|
||||
label = "lan3";
|
||||
};
|
||||
|
||||
port@2 {
|
||||
status = "okay";
|
||||
label = "lan2";
|
||||
};
|
||||
|
||||
port@3 {
|
||||
status = "okay";
|
||||
label = "lan1";
|
||||
};
|
||||
|
||||
port@4 {
|
||||
status = "okay";
|
||||
label = "wan";
|
||||
mtd-mac-address = <&bdinfo 0xde00>;
|
||||
mtd-mac-address-increment = <1>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&state_default {
|
||||
gpio {
|
||||
groups = "wdt", "i2c", "jtag";
|
||||
function = "gpio";
|
||||
};
|
||||
};
|
||||
196
target/linux/ramips/dts/mt7621_iodata_wn-dx1200gr.dts
Normal file
196
target/linux/ramips/dts/mt7621_iodata_wn-dx1200gr.dts
Normal file
@ -0,0 +1,196 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
|
||||
|
||||
#include "mt7621.dtsi"
|
||||
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
#include <dt-bindings/input/input.h>
|
||||
|
||||
/ {
|
||||
compatible = "iodata,wn-dx1200gr", "mediatek,mt7621-soc";
|
||||
model = "I-O DATA WN-DX1200GR";
|
||||
|
||||
aliases {
|
||||
led-boot = &led_power;
|
||||
led-failsafe = &led_power;
|
||||
led-running = &led_power;
|
||||
led-upgrade = &led_power;
|
||||
label-mac-device = &wan;
|
||||
};
|
||||
|
||||
leds {
|
||||
compatible = "gpio-leds";
|
||||
|
||||
wps {
|
||||
label = "blue:wps";
|
||||
gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
|
||||
led_power: power {
|
||||
label = "green:power";
|
||||
gpios = <&gpio 9 GPIO_ACTIVE_HIGH>;
|
||||
};
|
||||
};
|
||||
|
||||
keys {
|
||||
compatible = "gpio-keys";
|
||||
|
||||
reset {
|
||||
label = "reset";
|
||||
gpios = <&gpio 6 GPIO_ACTIVE_LOW>;
|
||||
linux,code = <KEY_RESTART>;
|
||||
};
|
||||
|
||||
repeater {
|
||||
label = "repeater";
|
||||
gpios = <&gpio 7 GPIO_ACTIVE_LOW>;
|
||||
linux,code = <BTN_0>;
|
||||
linux,input-type = <EV_SW>;
|
||||
};
|
||||
|
||||
wps {
|
||||
label = "wps";
|
||||
gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
|
||||
linux,code = <KEY_WPS_BUTTON>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&nand {
|
||||
status = "okay";
|
||||
|
||||
partitions {
|
||||
compatible = "fixed-partitions";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
partition@0 {
|
||||
label = "u-boot";
|
||||
reg = <0x0 0x100000>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
partition@100000 {
|
||||
label = "u-boot-env";
|
||||
reg = <0x100000 0x100000>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
factory: partition@200000 {
|
||||
label = "factory";
|
||||
reg = <0x200000 0x200000>;
|
||||
};
|
||||
|
||||
partition@400000 {
|
||||
label = "kernel";
|
||||
reg = <0x400000 0x400000>;
|
||||
};
|
||||
|
||||
partition@800000 {
|
||||
label = "ubi";
|
||||
reg = <0x800000 0x2e00000>;
|
||||
};
|
||||
|
||||
partition@3600000 {
|
||||
label = "Config";
|
||||
reg = <0x3600000 0x100000>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
partition@3700000 {
|
||||
label = "firmware_2";
|
||||
reg = <0x3700000 0x3200000>;
|
||||
};
|
||||
|
||||
partition@6900000 {
|
||||
label = "Config_2";
|
||||
reg = <0x6900000 0x100000>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
partition@6a00000 {
|
||||
label = "persist";
|
||||
reg = <0x6a00000 0x100000>;
|
||||
};
|
||||
|
||||
partition@6b00000 {
|
||||
label = "idmkey";
|
||||
reg = <0x6b00000 0x100000>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
partition@6c00000 {
|
||||
label = "Backup";
|
||||
reg = <0x6c00000 0x1380000>;
|
||||
read-only;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&gmac0 {
|
||||
mtd-mac-address = <&factory 0x1e000>;
|
||||
};
|
||||
|
||||
&switch0 {
|
||||
ports {
|
||||
wan: port@0 {
|
||||
status = "okay";
|
||||
label = "wan";
|
||||
mtd-mac-address = <&factory 0x1e006>;
|
||||
};
|
||||
|
||||
port@1 {
|
||||
status = "okay";
|
||||
label = "lan4";
|
||||
};
|
||||
|
||||
port@2 {
|
||||
status = "okay";
|
||||
label = "lan3";
|
||||
};
|
||||
|
||||
port@3 {
|
||||
status = "okay";
|
||||
label = "lan2";
|
||||
};
|
||||
|
||||
port@4 {
|
||||
status = "okay";
|
||||
label = "lan1";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&pcie {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&pcie0 {
|
||||
wifi@0,0 {
|
||||
compatible = "mediatek,mt76";
|
||||
reg = <0x0000 0 0 0 0>;
|
||||
|
||||
mediatek,mtd-eeprom = <&factory 0x0>;
|
||||
ieee80211-freq-limit = <2400000 2500000>;
|
||||
};
|
||||
};
|
||||
|
||||
&pcie1 {
|
||||
wifi@0,0 {
|
||||
compatible = "mediatek,mt76";
|
||||
reg = <0x0000 0 0 0 0>;
|
||||
|
||||
mediatek,mtd-eeprom = <&factory 0x8000>;
|
||||
ieee80211-freq-limit = <5000000 6000000>;
|
||||
};
|
||||
};
|
||||
|
||||
&state_default {
|
||||
gpio {
|
||||
groups = "uart2", "uart3", "wdt";
|
||||
function = "gpio";
|
||||
};
|
||||
};
|
||||
|
||||
&xhci {
|
||||
status = "disabled";
|
||||
};
|
||||
130
target/linux/ramips/dts/mt7621_jcg_y2.dts
Normal file
130
target/linux/ramips/dts/mt7621_jcg_y2.dts
Normal file
@ -0,0 +1,130 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
|
||||
|
||||
#include "mt7621.dtsi"
|
||||
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
#include <dt-bindings/input/input.h>
|
||||
|
||||
/ {
|
||||
compatible = "jcg,y2", "mediatek,mt7621-soc";
|
||||
model = "JCG Y2";
|
||||
|
||||
aliases {
|
||||
led-boot = &led_internet;
|
||||
led-failsafe = &led_internet;
|
||||
led-upgrade = &led_internet;
|
||||
};
|
||||
|
||||
leds {
|
||||
compatible = "gpio-leds";
|
||||
|
||||
led_internet: internet {
|
||||
label = "blue:internet";
|
||||
gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
};
|
||||
|
||||
keys {
|
||||
compatible = "gpio-keys";
|
||||
|
||||
reset {
|
||||
label = "reset";
|
||||
gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
|
||||
linux,code = <KEY_RESTART>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&spi0 {
|
||||
status = "okay";
|
||||
|
||||
flash@0 {
|
||||
compatible = "jedec,spi-nor";
|
||||
reg = <0>;
|
||||
spi-max-frequency = <80000000>;
|
||||
m25p,fast-read;
|
||||
|
||||
partitions {
|
||||
compatible = "fixed-partitions";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
partition@0 {
|
||||
label = "bootloader";
|
||||
reg = <0x0 0x30000>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
partition@30000 {
|
||||
label = "config";
|
||||
reg = <0x30000 0x10000>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
factory: partition@40000 {
|
||||
label = "factory";
|
||||
reg = <0x40000 0x10000>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
partition@50000 {
|
||||
compatible = "denx,uimage";
|
||||
label = "firmware";
|
||||
reg = <0x50000 0xfb0000>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&pcie {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&pcie0 {
|
||||
wifi@0,0 {
|
||||
compatible = "mediatek,mt76";
|
||||
reg = <0x0000 0 0 0 0>;
|
||||
mediatek,mtd-eeprom = <&factory 0x0>;
|
||||
};
|
||||
};
|
||||
|
||||
&gmac0 {
|
||||
mtd-mac-address = <&factory 0xe000>;
|
||||
};
|
||||
|
||||
&switch0 {
|
||||
ports {
|
||||
port@0 {
|
||||
status = "okay";
|
||||
label = "lan4";
|
||||
};
|
||||
|
||||
port@1 {
|
||||
status = "okay";
|
||||
label = "lan3";
|
||||
};
|
||||
|
||||
port@2 {
|
||||
status = "okay";
|
||||
label = "lan2";
|
||||
};
|
||||
|
||||
port@3 {
|
||||
status = "okay";
|
||||
label = "lan1";
|
||||
};
|
||||
|
||||
wan: port@4 {
|
||||
status = "okay";
|
||||
label = "wan";
|
||||
mtd-mac-address = <&factory 0xe006>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&state_default {
|
||||
gpio {
|
||||
groups = "jtag", "wdt";
|
||||
function = "gpio";
|
||||
};
|
||||
};
|
||||
@ -222,6 +222,16 @@ define Device/buffalo_wsr-600dhp
|
||||
endef
|
||||
TARGET_DEVICES += buffalo_wsr-600dhp
|
||||
|
||||
define Device/cudy_wr1300
|
||||
$(Device/dsa-migration)
|
||||
IMAGE_SIZE := 15872k
|
||||
DEVICE_VENDOR := Cudy
|
||||
DEVICE_MODEL := WR1300
|
||||
DEVICE_PACKAGES := kmod-mt7603 kmod-mt76x2 kmod-usb2 kmod-usb3 \
|
||||
kmod-usb-ledtrig-usbport
|
||||
endef
|
||||
TARGET_DEVICES += cudy_wr1300
|
||||
|
||||
define Device/dlink_dir-8xx-a1
|
||||
$(Device/dsa-migration)
|
||||
IMAGE_SIZE := 16000k
|
||||
@ -618,6 +628,15 @@ define Device/iodata_wn-dx1167r
|
||||
endef
|
||||
TARGET_DEVICES += iodata_wn-dx1167r
|
||||
|
||||
define Device/iodata_wn-dx1200gr
|
||||
$(Device/iodata_nand)
|
||||
DEVICE_MODEL := WN-DX1200GR
|
||||
KERNEL_INITRAMFS := $(KERNEL_DTB) | loader-kernel | lzma | \
|
||||
uImage lzma -M 0x434f4d43 -n '3.10(XIQ.0)b20' | iodata-mstc-header
|
||||
DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615e kmod-mt7663-firmware-ap
|
||||
endef
|
||||
TARGET_DEVICES += iodata_wn-dx1200gr
|
||||
|
||||
define Device/iodata_wn-gx300gr
|
||||
$(Device/dsa-migration)
|
||||
$(Device/uimage-lzma-loader)
|
||||
@ -675,6 +694,19 @@ define Device/jcg_jhr-ac876m
|
||||
endef
|
||||
TARGET_DEVICES += jcg_jhr-ac876m
|
||||
|
||||
define Device/jcg_y2
|
||||
$(Device/dsa-migration)
|
||||
$(Device/uimage-lzma-loader)
|
||||
IMAGE_SIZE := 16064k
|
||||
IMAGES += factory.bin
|
||||
IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | jcg-header 95.1
|
||||
JCG_MAXSIZE := 16064k
|
||||
DEVICE_VENDOR := JCG
|
||||
DEVICE_MODEL := Y2
|
||||
DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware kmod-usb3
|
||||
endef
|
||||
TARGET_DEVICES += jcg_y2
|
||||
|
||||
define Device/lenovo_newifi-d1
|
||||
$(Device/dsa-migration)
|
||||
$(Device/uimage-lzma-loader)
|
||||
|
||||
@ -601,6 +601,7 @@ define Device/hootoo_ht-tm02
|
||||
DEVICE_MODEL := HT-TM02
|
||||
DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2 kmod-usb-ledtrig-usbport
|
||||
SUPPORTED_DEVICES += ht-tm02
|
||||
DEFAULT := n
|
||||
endef
|
||||
TARGET_DEVICES += hootoo_ht-tm02
|
||||
|
||||
|
||||
@ -19,6 +19,7 @@ d-team,newifi-d2)
|
||||
;;
|
||||
d-team,pbr-m1|\
|
||||
gehua,ghl-r-001|\
|
||||
jcg,y2|\
|
||||
xzwifi,creativebox-v1)
|
||||
ucidef_set_led_netdev "internet" "internet" "blue:internet" "wan"
|
||||
;;
|
||||
|
||||
@ -113,6 +113,14 @@ ramips_setup_macs()
|
||||
wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr)
|
||||
label_mac=$wan_mac
|
||||
;;
|
||||
jcg,y2|\
|
||||
wavlink,wl-wn531a6|\
|
||||
winstars,ws-wn583a6|\
|
||||
zbtlink,zbt-we1326|\
|
||||
zbtlink,zbt-wg3526-16m|\
|
||||
zbtlink,zbt-wg3526-32m)
|
||||
label_mac=$(mtd_get_mac_binary factory 0x4)
|
||||
;;
|
||||
linksys,ea7300-v1|\
|
||||
linksys,ea7300-v2|\
|
||||
linksys,ea7500-v2)
|
||||
@ -128,13 +136,6 @@ ramips_setup_macs()
|
||||
wan_mac=$label_mac
|
||||
lan_mac=$(macaddr_add $label_mac 1)
|
||||
;;
|
||||
wavlink,wl-wn531a6|\
|
||||
winstars,ws-wn583a6|\
|
||||
zbtlink,zbt-we1326|\
|
||||
zbtlink,zbt-wg3526-16m|\
|
||||
zbtlink,zbt-wg3526-32m)
|
||||
label_mac=$(mtd_get_mac_binary factory 0x4)
|
||||
;;
|
||||
esac
|
||||
|
||||
[ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
|
||||
|
||||
@ -16,24 +16,33 @@ iodata_mstc_prepare_fail() {
|
||||
# use 1st image in OpenWrt
|
||||
# - debugflag: enable/disable debug
|
||||
# users can interrupt Z-Loader for recovering the device if enabled
|
||||
#
|
||||
# parameters:
|
||||
# - $1: the offset of "debugflag"
|
||||
iodata_mstc_upgrade_prepare() {
|
||||
local persist_mtd="$(find_mtd_part persist)"
|
||||
local factory_mtd="$(find_mtd_part factory)"
|
||||
local dflag_offset="$1"
|
||||
|
||||
if [ -z "$persist_mtd" -o -z "$factory_mtd" ]; then
|
||||
if [ -z "$dflag_offset" ]; then
|
||||
echo 'no debugflag offset provided'
|
||||
iodata_mstc_prepare_fail
|
||||
fi
|
||||
|
||||
if [ -z "$persist_mtd" ] || [ -z "$factory_mtd" ]; then
|
||||
echo 'cannot find mtd partition(s), "factory" or "persist"'
|
||||
iodata_mstc_prepare_fail
|
||||
fi
|
||||
|
||||
local bootnum=$(hexdump -s 4 -n 1 -e '"%x"' ${persist_mtd})
|
||||
local debugflag=$(hexdump -s 65141 -n 1 -e '"%x"' ${factory_mtd})
|
||||
local debugflag=$(hexdump -s $((dflag_offset)) -n 1 -e '"%x"' ${factory_mtd})
|
||||
|
||||
if [ "$bootnum" != "1" -a "$bootnum" != "2" ]; then
|
||||
if [ "$bootnum" != "1" ] && [ "$bootnum" != "2" ]; then
|
||||
echo "failed to get bootnum, please check the value at 0x4 in ${persist_mtd}"
|
||||
iodata_mstc_prepare_fail
|
||||
fi
|
||||
if [ "$debugflag" != "0" -a "$debugflag" != "1" ]; then
|
||||
echo "failed to get debugflag, please check the value at 0xFE75 in ${factory_mtd}"
|
||||
if [ "$debugflag" != "0" ] && [ "$debugflag" != "1" ]; then
|
||||
echo "failed to get debugflag, please check the value at ${dflag_offset} in ${factory_mtd}"
|
||||
iodata_mstc_prepare_fail
|
||||
fi
|
||||
echo "current: bootnum => ${bootnum}, debugflag => ${debugflag}"
|
||||
@ -46,7 +55,7 @@ iodata_mstc_upgrade_prepare() {
|
||||
echo "### switch to 1st os-image on next boot ###"
|
||||
fi
|
||||
if [ "$debugflag" = "0" ]; then
|
||||
if ! (echo -ne "\x01" | dd bs=1 count=1 seek=65141 conv=notrunc of=${factory_mtd} 2>/dev/null); then
|
||||
if ! (echo -ne "\x01" | dd bs=1 count=1 seek=$((dflag_offset)) conv=notrunc of=${factory_mtd} 2>/dev/null); then
|
||||
echo "failed to set debugflag"
|
||||
iodata_mstc_prepare_fail
|
||||
fi
|
||||
|
||||
@ -71,7 +71,11 @@ platform_do_upgrade() {
|
||||
iodata,wn-ax1167gr2|\
|
||||
iodata,wn-ax2033gr|\
|
||||
iodata,wn-dx1167r)
|
||||
iodata_mstc_upgrade_prepare
|
||||
iodata_mstc_upgrade_prepare "0xfe75"
|
||||
nand_do_upgrade "$1"
|
||||
;;
|
||||
iodata,wn-dx1200gr)
|
||||
iodata_mstc_upgrade_prepare "0x1fe75"
|
||||
nand_do_upgrade "$1"
|
||||
;;
|
||||
ubnt,edgerouter-x|\
|
||||
|
||||
@ -7,14 +7,14 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=mkimage
|
||||
PKG_VERSION:=2020.04
|
||||
PKG_VERSION:=2021.01
|
||||
|
||||
PKG_SOURCE:=u-boot-$(PKG_VERSION).tar.bz2
|
||||
PKG_SOURCE_URL:= \
|
||||
https://mirror.cyberbits.eu/u-boot \
|
||||
https://ftp.denx.de/pub/u-boot \
|
||||
ftp://ftp.denx.de/pub/u-boot
|
||||
PKG_HASH:=fe732aaf037d9cc3c0909bad8362af366ae964bbdac6913a34081ff4ad565372
|
||||
PKG_HASH:=b407e1510a74e863b8b5cb42a24625344f0e0c2fc7582d8c866bd899367d0454
|
||||
|
||||
HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/u-boot-$(PKG_VERSION)
|
||||
|
||||
@ -24,6 +24,8 @@ define Host/Prepare
|
||||
$(Host/Prepare/Default)
|
||||
mkdir -p $(HOST_BUILD_DIR)/include/config
|
||||
touch $(HOST_BUILD_DIR)/include/config/auto.conf
|
||||
mkdir -p $(HOST_BUILD_DIR)/include/generated/
|
||||
touch $(HOST_BUILD_DIR)/include/generated/autoconf.h
|
||||
endef
|
||||
|
||||
define Host/Compile
|
||||
|
||||
@ -1,11 +0,0 @@
|
||||
--- a/tools/fit_image.c
|
||||
+++ b/tools/fit_image.c
|
||||
@@ -642,7 +642,7 @@ static int copyfile(const char *src, con
|
||||
goto out;
|
||||
}
|
||||
|
||||
- fd_dst = open(dst, O_WRONLY | O_CREAT, 0700);
|
||||
+ fd_dst = open(dst, O_WRONLY | O_CREAT, 0744);
|
||||
if (fd_dst < 0) {
|
||||
printf("Can't open file %s (%s)\n", dst, strerror(errno));
|
||||
goto out;
|
||||
@ -2,7 +2,7 @@ This patch makes it possible to set a custom image magic.
|
||||
|
||||
--- a/tools/mkimage.c
|
||||
+++ b/tools/mkimage.c
|
||||
@@ -20,6 +20,7 @@ static struct image_tool_params params =
|
||||
@@ -21,6 +21,7 @@ static struct image_tool_params params =
|
||||
.arch = IH_ARCH_PPC,
|
||||
.type = IH_TYPE_KERNEL,
|
||||
.comp = IH_COMP_GZIP,
|
||||
@ -10,7 +10,7 @@ This patch makes it possible to set a custom image magic.
|
||||
.dtc = MKIMAGE_DEFAULT_DTC_OPTIONS,
|
||||
.imagename = "",
|
||||
.imagename2 = "",
|
||||
@@ -76,11 +77,12 @@ static void usage(const char *msg)
|
||||
@@ -82,11 +83,12 @@ static void usage(const char *msg)
|
||||
" -l ==> list image header information\n",
|
||||
params.cmdname);
|
||||
fprintf(stderr,
|
||||
@ -24,16 +24,16 @@ This patch makes it possible to set a custom image magic.
|
||||
" -a ==> set load address to 'addr' (hex)\n"
|
||||
" -e ==> set entry point to 'ep' (hex)\n"
|
||||
" -n ==> set image name to 'name'\n"
|
||||
@@ -143,7 +145,7 @@ static void process_args(int argc, char
|
||||
@@ -150,7 +152,7 @@ static void process_args(int argc, char
|
||||
int opt;
|
||||
|
||||
while ((opt = getopt(argc, argv,
|
||||
- "a:A:b:c:C:d:D:e:Ef:Fk:i:K:ln:N:p:O:rR:qsT:vVx")) != -1) {
|
||||
+ "a:A:b:c:C:d:D:e:Ef:Fk:i:K:lM:n:N:p:O:rR:qsT:vVx")) != -1) {
|
||||
- "a:A:b:B:c:C:d:D:e:Ef:Fk:i:K:ln:N:p:O:rR:qstT:vVx")) != -1) {
|
||||
+ "a:A:b:B:c:C:d:D:e:Ef:Fk:i:K:lM:n:N:p:O:rR:qstT:vVx")) != -1) {
|
||||
switch (opt) {
|
||||
case 'a':
|
||||
params.addr = strtoull(optarg, &ptr, 16);
|
||||
@@ -221,6 +223,14 @@ static void process_args(int argc, char
|
||||
@@ -237,6 +239,14 @@ static void process_args(int argc, char
|
||||
case 'l':
|
||||
params.lflag = 1;
|
||||
break;
|
||||
@ -61,7 +61,7 @@ This patch makes it possible to set a custom image magic.
|
||||
image_set_load(hdr, addr);
|
||||
--- a/tools/imagetool.h
|
||||
+++ b/tools/imagetool.h
|
||||
@@ -53,6 +53,7 @@ struct image_tool_params {
|
||||
@@ -56,6 +56,7 @@ struct image_tool_params {
|
||||
int arch;
|
||||
int type;
|
||||
int comp;
|
||||
|
||||
@ -12,8 +12,6 @@ parts for these header files manually or remove the usage too.
|
||||
|
||||
__u64 is not available on FreeBSD, remove its usage.
|
||||
|
||||
<malloc.h> has been replaced by <stdlib.h>
|
||||
|
||||
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
|
||||
---
|
||||
include/image.h | 2 ++
|
||||
@ -35,21 +33,6 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
|
||||
#include <stdbool.h>
|
||||
|
||||
/* Define this to avoid #ifdefs later on */
|
||||
--- a/include/imx8image.h
|
||||
+++ b/include/imx8image.h
|
||||
@@ -11,7 +11,12 @@
|
||||
#include <image.h>
|
||||
#include <inttypes.h>
|
||||
#include "imagetool.h"
|
||||
+#ifdef linux
|
||||
#include "linux/kernel.h"
|
||||
+#else
|
||||
+#define ALIGN(x,a) __ALIGN_MASK((x),(typeof(x))(a)-1)
|
||||
+#define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask))
|
||||
+#endif
|
||||
|
||||
#define __packed __attribute__((packed))
|
||||
|
||||
--- a/include/linux/posix_types.h
|
||||
+++ b/include/linux/posix_types.h
|
||||
@@ -43,6 +43,8 @@ typedef void (*__kernel_sighandler_t)(in
|
||||
@ -82,14 +65,3 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
|
||||
typedef __u64 __bitwise __le64;
|
||||
typedef __u64 __bitwise __be64;
|
||||
#endif
|
||||
--- a/lib/rsa/rsa-sign.c
|
||||
+++ b/lib/rsa/rsa-sign.c
|
||||
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
|
||||
#include "mkimage.h"
|
||||
-#include <malloc.h>
|
||||
+#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <image.h>
|
||||
|
||||
@ -1,10 +0,0 @@
|
||||
--- a/tools/imximage.c
|
||||
+++ b/tools/imximage.c
|
||||
@@ -11,7 +11,6 @@
|
||||
#include "imagetool.h"
|
||||
#include <image.h>
|
||||
#include "imximage.h"
|
||||
-#include <generated/autoconf.h>
|
||||
|
||||
#define UNDEFINED 0xFFFFFFFF
|
||||
|
||||
@ -3,10 +3,10 @@ needed dependencies are added too.
|
||||
|
||||
--- a/tools/Makefile
|
||||
+++ b/tools/Makefile
|
||||
@@ -162,7 +162,7 @@ ifneq ($(CONFIG_MX23)$(CONFIG_MX28)$(CON
|
||||
@@ -158,7 +158,7 @@ ifneq ($(CONFIG_MX23)$(CONFIG_MX28)$(CON
|
||||
HOSTCFLAGS_kwbimage.o += \
|
||||
$(shell pkg-config --cflags libssl libcrypto 2> /dev/null || echo "")
|
||||
HOSTLOADLIBES_mkimage += \
|
||||
HOSTLDLIBS_mkimage += \
|
||||
- $(shell pkg-config --libs libssl libcrypto 2> /dev/null || echo "-lssl -lcrypto")
|
||||
+ $(shell pkg-config --libs --static libssl libcrypto 2> /dev/null || echo "-lssl -lcrypto")
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user