--- /dev/null
+# Copyright (C) 2012 OpenWrt.org
+# Copyright (C) 2015-2016 Lantiq Beteiligungs GmbH & Co KG.
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/kernel.mk
+
+PKG_NAME:=ltq-vdsl-vr9
+PKG_VERSION:=4.17.18.6
+PKG_RELEASE:=7
+
+PKG_BASE_NAME:=drv_dsl_cpe_api
+PKG_SOURCE:=$(PKG_BASE_NAME)_vrx-$(PKG_VERSION).tar.gz
+PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_BASE_NAME)-$(PKG_VERSION)
+PKG_SOURCE_URL:=@OPENWRT
+PKG_HASH:=b4966a60653acc49254b168c6cc9c49eb36c54548e763617788aa4f252a29f21
+PKG_LICENSE:=GPL-2.0 BSD-2-Clause
+PKG_LICENSE_FILES:=LICENSE
+
+PKG_FIXUP:=autoreconf
+
+PKG_MAINTAINER:=John Crispin <john@phrozen.org>
+
+include $(INCLUDE_DIR)/package.mk
+
+define KernelPackage/ltq-vdsl-vr9
+ TITLE:=vdsl driver
+ SECTION:=sys
+ SUBMENU:=Network Devices
+ DEPENDS:=@TARGET_lantiq_xrx200 +kmod-ltq-vdsl-vr9-mei
+ FILES:=$(PKG_BUILD_DIR)/src/drv_dsl_cpe_api.ko
+ AUTOLOAD:=$(call AutoLoad,51,drv_dsl_cpe_api)
+endef
+
+define Package/ltq-vdsl-vr9/description
+ This package contains the Lantiq DSL CPE API driver.
+
+ Supported Devices:
+ - VRX200 Family
+endef
+
+MAKE_FLAGS += \
+ $(KERNEL_MAKE_FLAGS) \
+ SHELL="$(BASH)"
+
+CONFIGURE_ARGS += --enable-kernel-include="$(LINUX_DIR)/include" \
+ --with-max-device="1" \
+ --with-lines-per-device="1" \
+ --with-channels-per-line="1" \
+ --enable-vrx \
+ --enable-vrx-device=vr9 \
+ --enable-ifxos \
+ --enable-ifxos-include="-I$(STAGING_DIR)/usr/include/ifxos" \
+ --enable-driver-include="-I$(STAGING_DIR)/usr/include/vdsl" \
+ --enable-add-drv-cflags="-DMODULE -DINCLUDE_DSL_ATM_PTM_INTERFACE_SUPPORT" \
+ --enable-linux-26 \
+ --enable-kernelbuild="$(LINUX_DIR)" \
+ --enable-debug-prints=no \
+ ARCH=mips
+
+CONFIGURE_ARGS += \
+ --enable-model=full \
+ --enable-dsl-ceoc=no
+#CONFIGURE_ARGS += --enable-model=lite
+#CONFIGURE_ARGS += --enable-model=footprint
+#CONFIGURE_ARGS += --enable-model=typical
+#CONFIGURE_ARGS += --enable-model=debug
+
+define Build/InstallDev
+ $(INSTALL_DIR) $(1)/usr/include/drv_vdsl_cpe_api
+ $(CP) $(PKG_BUILD_DIR)/src/include/drv_dsl_cpe*.h $(1)/usr/include/drv_vdsl_cpe_api/
+endef
+
+$(eval $(call KernelPackage,ltq-vdsl-vr9))
--- /dev/null
+--- a/src/include/drv_dsl_cpe_os_linux.h
++++ b/src/include/drv_dsl_cpe_os_linux.h
+@@ -33,6 +33,9 @@
+ #endif
+
+ #include <linux/sched.h>
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0))
++#include <linux/sched/signal.h>
++#endif
+
+ #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33))
+ #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17))
--- /dev/null
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -244,10 +244,7 @@ else
+ drv_dsl_cpe_api_common_mod_cflags =
+ endif
+
+-drv_dsl_cpe_api_common_cflags = -DLINUX -D__LINUX__ -D__KERNEL__ -DEXPORT_SYMTAB \
+- -pipe -Wall -Wformat -Wimplicit -Wunused -Wswitch -Wcomment -Winline \
+- -Wuninitialized -Wparentheses -Wsign-compare -Wreturn-type \
+- -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common
++drv_dsl_cpe_api_common_cflags = -DLINUX -D__LINUX__ -D__KERNEL__ -DEXPORT_SYMTAB
+
+ if DSL_DBG_MAX_LEVEL_SET
+ drv_dsl_cpe_api_common_cflags += -DDSL_DBG_MAX_LEVEL=$(DSL_DBG_MAX_LEVEL_PRE)
+@@ -257,7 +254,7 @@ endif
+ drv_dsl_cpe_api_target_cflags = $(ADD_DRV_CFLAGS)
+
+ # compile cflags
+-drv_dsl_cpe_api_compile_cflags = $(EXTRA_DRV_CFLAGS)
++drv_dsl_cpe_api_compile_cflags =
+
+ if !KERNEL_2_6
+ # the headerfile of linux kernels 2.6.x contain to much arithmetic
+@@ -311,7 +308,7 @@ drv_dsl_cpe_api.ko: $(drv_dsl_cpe_api_SO
+ @echo -e "# drv_dsl_cpe_api: Generated to build Linux 2.6.x kernel object" > $(PWD)/Kbuild
+ @echo -e "obj-m := $(subst .ko,.o,$@)" >> $(PWD)/Kbuild
+ @echo -e "$(subst .ko,,$@)-y := $(drv_dsl_cpe_api_OBJS)" >> $(PWD)/Kbuild
+- @echo -e "EXTRA_CFLAGS := $(CFLAGS) -DHAVE_CONFIG_H $(drv_dsl_cpe_api_CFLAGS) $(DSL_DRIVER_INCL_PATH) $(IFXOS_INCLUDE_PATH) -I@abs_srcdir@/include -I$(PWD)/include" >> $(PWD)/Kbuild
++ @echo -e "EXTRA_CFLAGS := -DHAVE_CONFIG_H $(drv_dsl_cpe_api_CFLAGS) $(DSL_DRIVER_INCL_PATH) $(IFXOS_INCLUDE_PATH) -I@abs_srcdir@/include -I$(PWD)/include" >> $(PWD)/Kbuild
+ $(MAKE) ARCH=@KERNEL_ARCH@ -C @KERNEL_BUILD_PATH@ O=@KERNEL_BUILD_PATH@ M=$(PWD) modules
+
+ clean-generic:
--- /dev/null
+--- a/src/Makefile.in
++++ b/src/Makefile.in
+@@ -117,7 +117,7 @@ POST_UNINSTALL = :
+
+ # the headerfile of linux kernels 2.6.x contain to much arithmetic
+ # with void pointers (which is allowed for gcc!)
+-@KERNEL_2_6_FALSE@am__append_6 = -Wpointer-arith
++@KERNEL_2_6_FALSE@am__append_6 =
+ subdir = src
+ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+ am__aclocal_m4_deps = $(top_srcdir)/configure.in
+--- a/src/common/drv_dsl_cpe_os_linux.c
++++ b/src/common/drv_dsl_cpe_os_linux.c
+@@ -11,6 +11,7 @@
+
+ #define DSL_INTERN
+
++#include <linux/device.h>
+ #include "drv_dsl_cpe_api.h"
+ #include "drv_dsl_cpe_api_ioctl.h"
+
+@@ -249,14 +250,7 @@ static DSL_long_t DSL_DRV_Ioctls(DSL_DRV
+ }
+
+ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
+- if (pFile->f_dentry != DSL_NULL)
+- {
+- pINode = pFile->f_dentry->d_inode;
+- }
+- else
+- {
+- pINode = DSL_NULL;
+- }
++ pINode = file_inode(pFile);
+ #endif
+
+ if (pINode == DSL_NULL)
+@@ -491,7 +485,11 @@ DSL_void_t* DSL_DRV_VMalloc(
+ DSL_DRV_size_t nSize)
+ {
+ /* VRX500-BU: Better to use vmalloc or vzmalloc here?! */
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5,9,0)
+ return __vmalloc((unsigned long)nSize, GFP_KERNEL, PAGE_KERNEL);
++#else
++ return __vmalloc((unsigned long)nSize, GFP_KERNEL);
++#endif
+ /* return vmalloc(nSize);*/
+ }
+
+@@ -917,12 +915,19 @@ DSL_int32_t DSL_DRV_ThreadShutdown(
+
+ DSL_uint32_t DSL_DRV_SysTimeGet(DSL_uint32_t nOffset)
+ {
+- struct timeval tv;
+ DSL_uint32_t nTime = 0;
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0))
++ struct timeval tv;
+
+ memset(&tv, 0, sizeof(tv));
+ do_gettimeofday(&tv);
+ nTime = (DSL_uint32_t)tv.tv_sec;
++#else
++ struct timespec64 now;
++
++ ktime_get_real_ts64(&now);
++ nTime = (DSL_uint32_t)now.tv_sec;
++#endif
+
+ if ( (nOffset == 0) || (nOffset > nTime) )
+ {
+@@ -1203,6 +1208,9 @@ static void DSL_DRV_NlSendMsg(DSL_char_t
+ }
+ #endif
+
++static struct class *dsl_class;
++static dev_t dsl_devt;
++
+ /* Entry point of driver */
+ int __init DSL_ModuleInit(void)
+ {
+@@ -1241,6 +1249,10 @@ int __init DSL_ModuleInit(void)
+
+ DSL_DRV_DevNodeInit();
+
++ dsl_class = class_create(THIS_MODULE, DRV_DSL_CPE_API_DEV_NAME);
++ dsl_devt = MKDEV(DRV_DSL_CPE_API_DEV_MAJOR, 0);
++ device_create(dsl_class, NULL, dsl_devt, NULL, "dsl_cpe_api/0");
++
+ return 0;
+ }
+
+@@ -1248,6 +1260,11 @@ void __exit DSL_ModuleCleanup(void)
+ {
+ printk("Module will be unloaded"DSL_DRV_CRLF);
+
++ device_destroy(dsl_class, dsl_devt);
++ dsl_devt = NULL;
++ class_destroy(dsl_class);
++ dsl_class = NULL;
++
+ unregister_chrdev(nMajorNum, DRV_DSL_CPE_API_DEV_NAME);
+
+ DSL_DRV_Cleanup();
+--- a/src/device/drv_dsl_cpe_device_vrx.c
++++ b/src/device/drv_dsl_cpe_device_vrx.c
+@@ -5337,6 +5337,7 @@ DSL_Error_t DSL_DRV_DEV_HybridTypeGet(
+ #undef DSL_DBG_BLOCK
+ #define DSL_DBG_BLOCK DSL_DBG_NOTIFICATIONS
+
++#if 0
+ DSL_Error_t DSL_DRV_DEV_MeiTcLayerSignaling
+ (
+ DSL_Context_t *pContext,
+@@ -5384,6 +5385,15 @@ DSL_Error_t DSL_DRV_DEV_MeiTcLayerSignal
+
+ return nErrCode;
+ }
++#else
++DSL_Error_t DSL_DRV_DEV_MeiTcLayerSignaling
++(
++ DSL_Context_t *pContext,
++ DSL_TcLayerSelection_t nTcLayer)
++{
++ return DSL_SUCCESS;
++}
++#endif
+
+ DSL_Error_t DSL_DRV_DEV_MeiShowtimeSignaling
+ (
--- /dev/null
+--- a/src/include/drv_dsl_cpe_pm_core.h
++++ b/src/include/drv_dsl_cpe_pm_core.h
+@@ -1510,9 +1510,9 @@ typedef struct
+ /** Common PM module mutex*/
+ DSL_DRV_Mutex_t pmMutex;
+ /** PM module direction Near-End mutex*/
+- DSL_DRV_Mutex_t pmNeMutex;
++ struct semaphore pmNeMutex;
+ /** PM module direction Far-End mutex*/
+- DSL_DRV_Mutex_t pmFeMutex;
++ struct semaphore pmFeMutex;
+ /** PM module Near-End access mutex*/
+ DSL_DRV_Mutex_t pmNeAccessMutex;
+ /** PM module Far-End access mutex*/
+--- a/src/pm/drv_dsl_cpe_api_pm.c
++++ b/src/pm/drv_dsl_cpe_api_pm.c
+@@ -220,9 +220,9 @@ DSL_Error_t DSL_DRV_PM_Start(
+ /* init PM module common mutex */
+ DSL_DRV_MUTEX_INIT(DSL_DRV_PM_CONTEXT(pContext)->pmMutex);
+ /* init PM module direction Near-End mutex */
+- DSL_DRV_MUTEX_INIT(DSL_DRV_PM_CONTEXT(pContext)->pmNeMutex);
++ sema_init(&(DSL_DRV_PM_CONTEXT(pContext)->pmNeMutex),1);
+ /* init PM module direction Far-End mutex */
+- DSL_DRV_MUTEX_INIT(DSL_DRV_PM_CONTEXT(pContext)->pmFeMutex);
++ sema_init(&(DSL_DRV_PM_CONTEXT(pContext)->pmFeMutex),1);
+ /* init PM module Near-End access mutex */
+ DSL_DRV_MUTEX_INIT(DSL_DRV_PM_CONTEXT(pContext)->pmNeAccessMutex);
+ /* init PM module Far-End access mutex */
+@@ -592,7 +592,7 @@ DSL_Error_t DSL_DRV_PM_Stop(
+ if( DSL_DRV_PM_CONTEXT(pContext)->pmThreadFe.bRun != DSL_TRUE )
+ {
+ DSL_DEBUG(DSL_DBG_WRN,
+- (pContext, SYS_DBG_WRN"DSL[%02d]: PM module Near-End thread already stopped"
++ (pContext, SYS_DBG_WRN"DSL[%02d]: PM module Far-End thread already stopped"
+ DSL_DRV_CRLF, DSL_DEV_NUM(pContext)));
+ }
+ else
+--- a/src/pm/drv_dsl_cpe_pm_core.c
++++ b/src/pm/drv_dsl_cpe_pm_core.c
+@@ -1022,7 +1022,7 @@ DSL_Error_t DSL_DRV_PM_DirectionMutexCon
+ {
+ if( bLock )
+ {
+- if( DSL_DRV_MUTEX_LOCK(DSL_DRV_PM_CONTEXT(pContext)->pmNeMutex) )
++ if(down_interruptible(&(DSL_DRV_PM_CONTEXT(pContext)->pmNeMutex)))
+ {
+ DSL_DEBUG( DSL_DBG_ERR,
+ (pContext, SYS_DBG_ERR"DSL[%02d]: ERROR - Couldn't lock PM NE mutex!"
+@@ -1034,14 +1034,14 @@ DSL_Error_t DSL_DRV_PM_DirectionMutexCon
+ else
+ {
+ /* Unlock PM module NE Mutex*/
+- DSL_DRV_MUTEX_UNLOCK(DSL_DRV_PM_CONTEXT(pContext)->pmNeMutex);
++ up(&(DSL_DRV_PM_CONTEXT(pContext)->pmNeMutex));
+ }
+ }
+ else
+ {
+ if( bLock )
+ {
+- if( DSL_DRV_MUTEX_LOCK(DSL_DRV_PM_CONTEXT(pContext)->pmFeMutex) )
++ if(down_interruptible(&(DSL_DRV_PM_CONTEXT(pContext)->pmFeMutex)))
+ {
+ DSL_DEBUG( DSL_DBG_ERR,
+ (pContext, SYS_DBG_ERR"DSL[%02d]: ERROR - Couldn't lock PM FE mutex!"
+@@ -1053,7 +1053,7 @@ DSL_Error_t DSL_DRV_PM_DirectionMutexCon
+ else
+ {
+ /* Unlock PM module FE Mutex*/
+- DSL_DRV_MUTEX_UNLOCK(DSL_DRV_PM_CONTEXT(pContext)->pmFeMutex);
++ up(&(DSL_DRV_PM_CONTEXT(pContext)->pmFeMutex));
+ }
+ }
+
+@@ -1139,7 +1139,7 @@ DSL_Error_t DSL_DRV_PM_Lock(DSL_Context_
+ if( !(DSL_DRV_PM_CONTEXT(pContext)->bPmLock) )
+ {
+ /* Lock PM module Near-End Mutex*/
+- if( DSL_DRV_MUTEX_LOCK(DSL_DRV_PM_CONTEXT(pContext)->pmNeMutex) )
++ if(down_interruptible(&(DSL_DRV_PM_CONTEXT(pContext)->pmNeMutex)))
+ {
+ DSL_DEBUG( DSL_DBG_ERR,
+ (pContext, SYS_DBG_ERR"DSL[%02d]: ERROR - Couldn't lock PM NE mutex!"
+@@ -1148,8 +1148,8 @@ DSL_Error_t DSL_DRV_PM_Lock(DSL_Context_
+ return DSL_ERR_SEMAPHORE_GET;
+ }
+
+- /* Lock PM module Near-End Mutex*/
+- if( DSL_DRV_MUTEX_LOCK(DSL_DRV_PM_CONTEXT(pContext)->pmFeMutex) )
++ /* Lock PM module Far-End Mutex*/
++ if( down_interruptible(&(DSL_DRV_PM_CONTEXT(pContext)->pmFeMutex)) )
+ {
+ DSL_DEBUG( DSL_DBG_ERR,
+ (pContext, SYS_DBG_ERR"DSL[%02d]: ERROR - Couldn't lock PM FE mutex!"
+@@ -1193,10 +1193,10 @@ DSL_Error_t DSL_DRV_PM_UnLock(DSL_Contex
+ if( DSL_DRV_PM_CONTEXT(pContext)->bPmLock )
+ {
+ /* Unlock PM module NE Mutex*/
+- DSL_DRV_MUTEX_UNLOCK(DSL_DRV_PM_CONTEXT(pContext)->pmNeMutex);
++ up(&(DSL_DRV_PM_CONTEXT(pContext)->pmNeMutex));
+
+ /* Unlock PM module FE Mutex*/
+- DSL_DRV_MUTEX_UNLOCK(DSL_DRV_PM_CONTEXT(pContext)->pmFeMutex);
++ up(&(DSL_DRV_PM_CONTEXT(pContext)->pmFeMutex));
+
+ /* Clear bPmLock flag*/
+ DSL_DRV_PM_CONTEXT(pContext)->bPmLock = DSL_FALSE;
--- /dev/null
+--- a/src/include/drv_dsl_cpe_pm_core.h
++++ b/src/include/drv_dsl_cpe_pm_core.h
+@@ -1552,9 +1552,9 @@ typedef struct
+ DSL_boolean_t bShowtimeProcessingStart;
+ /** Showtime reached flag*/
+ DSL_boolean_t bShowtimeInvTrigger;
+- /** Current Showtime synchronization time to be used, (msec) */
++ /** Current Showtime synchronization time to be used, (sec) */
+ DSL_uint32_t nCurrShowtimeTime;
+- /** Showtime synchronization time to be used, (msec) */
++ /** Showtime synchronization time to be used, (sec) */
+ DSL_uint32_t nElapsedShowtimeTime;
+ /** Actual Line state*/
+ DSL_LineStateValue_t nLineState;
+--- a/src/pm/drv_dsl_cpe_api_pm.c
++++ b/src/pm/drv_dsl_cpe_api_pm.c
+@@ -1475,7 +1475,7 @@ DSL_Error_t DSL_DRV_PM_ChannelCountersTo
+ }
+
+ /* Fill Total Counters elapsed time*/
+- pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime/DSL_PM_MSEC;
++ pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime;
+
+ pChCounters = DSL_DRV_PM_PTR_CHANNEL_COUNTERS_TOTAL(pCounters->nChannel,pCounters->nDirection);
+
+@@ -1535,7 +1535,7 @@ DSL_Error_t DSL_DRV_PM_ChannelCountersEx
+ }
+
+ /* Fill Total Counters elapsed time*/
+- pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime/DSL_PM_MSEC;
++ pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime;
+
+ pChCounters = DSL_DRV_PM_PTR_CHANNEL_COUNTERS_TOTAL_EXT(pCounters->nChannel);
+
+@@ -2518,7 +2518,7 @@ DSL_Error_t DSL_DRV_PM_DataPathCountersT
+ }
+
+ /* Fill Total Counters elapsed time*/
+- pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime/DSL_PM_MSEC;
++ pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime;
+
+ pDpCounters = DSL_DRV_PM_PTR_DATAPATH_COUNTERS_TOTAL(pCounters->nChannel,pCounters->nDirection);
+
+@@ -3352,7 +3352,7 @@ DSL_Error_t DSL_DRV_PM_DataPathFailureCo
+ }
+
+ /* Fill Total Counters elapsed time*/
+- pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime/DSL_PM_MSEC;
++ pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime;
+
+ pDpCounters = DSL_DRV_PM_PTR_DATAPATH_FAILURE_COUNTERS_TOTAL(pCounters->nChannel,pCounters->nDirection);
+
+@@ -4130,7 +4130,7 @@ DSL_Error_t DSL_DRV_PM_LineSecCountersTo
+ }
+
+ /* Fill Total Counters elapsed time*/
+- pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime/DSL_PM_MSEC;
++ pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime;
+
+ pLineCounters = DSL_DRV_PM_PTR_LINE_SEC_COUNTERS_TOTAL(pCounters->nDirection);
+
+@@ -4787,7 +4787,7 @@ DSL_Error_t DSL_DRV_PM_LineInitCountersT
+ }
+
+ /* Fill Total Counters elapsed time*/
+- pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime/DSL_PM_MSEC;
++ pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime;
+
+ pLinitCounters = DSL_DRV_PM_PTR_LINE_INIT_COUNTERS_TOTAL();
+
+@@ -5240,7 +5240,7 @@ DSL_Error_t DSL_DRV_PM_LineEventShowtime
+ }
+
+ /* Fill Total Counters elapsed time*/
+- pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime/DSL_PM_MSEC;
++ pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime;
+
+ pLfCounters = DSL_DRV_PM_PTR_LINE_EVENT_SHOWTIME_COUNTERS_TOTAL(pCounters->nDirection);
+
+@@ -5720,7 +5720,7 @@ DSL_Error_t DSL_DRV_PM_ReTxCountersTotal
+ }
+
+ /* Fill Total Counters elapsed time*/
+- pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime/DSL_PM_MSEC;
++ pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime;
+
+ pReTxCounters = DSL_DRV_PM_PTR_RETX_COUNTERS_TOTAL(pCounters->nDirection);
+
+--- a/src/pm/drv_dsl_cpe_pm_core.c
++++ b/src/pm/drv_dsl_cpe_pm_core.c
+@@ -60,6 +60,7 @@ static DSL_Error_t DSL_DRV_PM_SyncTimeUp
+ {
+ DSL_Error_t nErrCode = DSL_SUCCESS;
+ DSL_uint32_t msecTimeFrame = DSL_PM_COUNTER_POLLING_CYCLE,
++ secTimeFrame = DSL_PM_COUNTER_POLLING_CYCLE/DSL_PM_MSEC,
+ nCurrMsTime = 0;
+ #ifdef INCLUDE_DSL_CPE_PM_HISTORY
+ DSL_uint32_t nCurrSysTime = 0, nPrevElapsedTime = 0;
+@@ -99,10 +100,13 @@ static DSL_Error_t DSL_DRV_PM_SyncTimeUp
+ {
+ /* Get elapsed time [msec] since the last entry*/
+ msecTimeFrame = nCurrMsTime - DSL_DRV_PM_CONTEXT(pContext)->nLastMsTimeCheck;
++
++ /* Get elapsed time [sec] since the last entry*/
++ secTimeFrame = (nCurrMsTime/DSL_PM_MSEC) - (DSL_DRV_PM_CONTEXT(pContext)->nLastMsTimeCheck/DSL_PM_MSEC);
+ }
+
+ /* Get Total Elapsed Time Since the PM module startup*/
+- DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime += msecTimeFrame;
++ DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime += secTimeFrame;
+
+ /* Set last time check to the current time*/
+ DSL_DRV_PM_CONTEXT(pContext)->nLastMsTimeCheck = nCurrMsTime;
+@@ -140,7 +144,7 @@ static DSL_Error_t DSL_DRV_PM_SyncTimeUp
+ else
+ {
+ /* Update current showtime elapsed time*/
+- DSL_DRV_PM_CONTEXT(pContext)->nCurrShowtimeTime += (msecTimeFrame/DSL_PM_MSEC);
++ DSL_DRV_PM_CONTEXT(pContext)->nCurrShowtimeTime += secTimeFrame;
+ DSL_DRV_PM_CONTEXT(pContext)->nElapsedShowtimeTime =
+ DSL_DRV_PM_CONTEXT(pContext)->nCurrShowtimeTime;
+ }
+++ /dev/null
-# Copyright (C) 2012 OpenWrt.org
-# Copyright (C) 2015-2016 Lantiq Beteiligungs GmbH & Co KG.
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-
-include $(TOPDIR)/rules.mk
-include $(INCLUDE_DIR)/kernel.mk
-
-PKG_NAME:=ltq-vdsl-vr9
-PKG_VERSION:=4.17.18.6
-PKG_RELEASE:=7
-
-PKG_BASE_NAME:=drv_dsl_cpe_api
-PKG_SOURCE:=$(PKG_BASE_NAME)_vrx-$(PKG_VERSION).tar.gz
-PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_BASE_NAME)-$(PKG_VERSION)
-PKG_SOURCE_URL:=@OPENWRT
-PKG_HASH:=b4966a60653acc49254b168c6cc9c49eb36c54548e763617788aa4f252a29f21
-PKG_LICENSE:=GPL-2.0 BSD-2-Clause
-PKG_LICENSE_FILES:=LICENSE
-
-PKG_FIXUP:=autoreconf
-
-PKG_MAINTAINER:=John Crispin <john@phrozen.org>
-
-include $(INCLUDE_DIR)/package.mk
-
-define KernelPackage/ltq-vdsl-vr9
- TITLE:=vdsl driver
- SECTION:=sys
- SUBMENU:=Network Devices
- DEPENDS:=@TARGET_lantiq_xrx200 +kmod-ltq-vdsl-vr9-mei
- FILES:=$(PKG_BUILD_DIR)/src/drv_dsl_cpe_api.ko
- AUTOLOAD:=$(call AutoLoad,51,drv_dsl_cpe_api)
-endef
-
-define Package/ltq-vdsl-vr9/description
- This package contains the Lantiq DSL CPE API driver.
-
- Supported Devices:
- - VRX200 Family
-endef
-
-MAKE_FLAGS += \
- $(KERNEL_MAKE_FLAGS) \
- SHELL="$(BASH)"
-
-CONFIGURE_ARGS += --enable-kernel-include="$(LINUX_DIR)/include" \
- --with-max-device="1" \
- --with-lines-per-device="1" \
- --with-channels-per-line="1" \
- --enable-vrx \
- --enable-vrx-device=vr9 \
- --enable-ifxos \
- --enable-ifxos-include="-I$(STAGING_DIR)/usr/include/ifxos" \
- --enable-driver-include="-I$(STAGING_DIR)/usr/include/vdsl" \
- --enable-add-drv-cflags="-DMODULE -DINCLUDE_DSL_ATM_PTM_INTERFACE_SUPPORT" \
- --enable-linux-26 \
- --enable-kernelbuild="$(LINUX_DIR)" \
- --enable-debug-prints=no \
- ARCH=mips
-
-CONFIGURE_ARGS += \
- --enable-model=full \
- --enable-dsl-ceoc=no
-#CONFIGURE_ARGS += --enable-model=lite
-#CONFIGURE_ARGS += --enable-model=footprint
-#CONFIGURE_ARGS += --enable-model=typical
-#CONFIGURE_ARGS += --enable-model=debug
-
-define Build/InstallDev
- $(INSTALL_DIR) $(1)/usr/include/drv_vdsl_cpe_api
- $(CP) $(PKG_BUILD_DIR)/src/include/drv_dsl_cpe*.h $(1)/usr/include/drv_vdsl_cpe_api/
-endef
-
-$(eval $(call KernelPackage,ltq-vdsl-vr9))
+++ /dev/null
---- a/src/include/drv_dsl_cpe_os_linux.h
-+++ b/src/include/drv_dsl_cpe_os_linux.h
-@@ -33,6 +33,9 @@
- #endif
-
- #include <linux/sched.h>
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0))
-+#include <linux/sched/signal.h>
-+#endif
-
- #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33))
- #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17))
+++ /dev/null
---- a/src/Makefile.am
-+++ b/src/Makefile.am
-@@ -244,10 +244,7 @@ else
- drv_dsl_cpe_api_common_mod_cflags =
- endif
-
--drv_dsl_cpe_api_common_cflags = -DLINUX -D__LINUX__ -D__KERNEL__ -DEXPORT_SYMTAB \
-- -pipe -Wall -Wformat -Wimplicit -Wunused -Wswitch -Wcomment -Winline \
-- -Wuninitialized -Wparentheses -Wsign-compare -Wreturn-type \
-- -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common
-+drv_dsl_cpe_api_common_cflags = -DLINUX -D__LINUX__ -D__KERNEL__ -DEXPORT_SYMTAB
-
- if DSL_DBG_MAX_LEVEL_SET
- drv_dsl_cpe_api_common_cflags += -DDSL_DBG_MAX_LEVEL=$(DSL_DBG_MAX_LEVEL_PRE)
-@@ -257,7 +254,7 @@ endif
- drv_dsl_cpe_api_target_cflags = $(ADD_DRV_CFLAGS)
-
- # compile cflags
--drv_dsl_cpe_api_compile_cflags = $(EXTRA_DRV_CFLAGS)
-+drv_dsl_cpe_api_compile_cflags =
-
- if !KERNEL_2_6
- # the headerfile of linux kernels 2.6.x contain to much arithmetic
-@@ -311,7 +308,7 @@ drv_dsl_cpe_api.ko: $(drv_dsl_cpe_api_SO
- @echo -e "# drv_dsl_cpe_api: Generated to build Linux 2.6.x kernel object" > $(PWD)/Kbuild
- @echo -e "obj-m := $(subst .ko,.o,$@)" >> $(PWD)/Kbuild
- @echo -e "$(subst .ko,,$@)-y := $(drv_dsl_cpe_api_OBJS)" >> $(PWD)/Kbuild
-- @echo -e "EXTRA_CFLAGS := $(CFLAGS) -DHAVE_CONFIG_H $(drv_dsl_cpe_api_CFLAGS) $(DSL_DRIVER_INCL_PATH) $(IFXOS_INCLUDE_PATH) -I@abs_srcdir@/include -I$(PWD)/include" >> $(PWD)/Kbuild
-+ @echo -e "EXTRA_CFLAGS := -DHAVE_CONFIG_H $(drv_dsl_cpe_api_CFLAGS) $(DSL_DRIVER_INCL_PATH) $(IFXOS_INCLUDE_PATH) -I@abs_srcdir@/include -I$(PWD)/include" >> $(PWD)/Kbuild
- $(MAKE) ARCH=@KERNEL_ARCH@ -C @KERNEL_BUILD_PATH@ O=@KERNEL_BUILD_PATH@ M=$(PWD) modules
-
- clean-generic:
+++ /dev/null
---- a/src/Makefile.in
-+++ b/src/Makefile.in
-@@ -117,7 +117,7 @@ POST_UNINSTALL = :
-
- # the headerfile of linux kernels 2.6.x contain to much arithmetic
- # with void pointers (which is allowed for gcc!)
--@KERNEL_2_6_FALSE@am__append_6 = -Wpointer-arith
-+@KERNEL_2_6_FALSE@am__append_6 =
- subdir = src
- ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
- am__aclocal_m4_deps = $(top_srcdir)/configure.in
---- a/src/common/drv_dsl_cpe_os_linux.c
-+++ b/src/common/drv_dsl_cpe_os_linux.c
-@@ -11,6 +11,7 @@
-
- #define DSL_INTERN
-
-+#include <linux/device.h>
- #include "drv_dsl_cpe_api.h"
- #include "drv_dsl_cpe_api_ioctl.h"
-
-@@ -249,14 +250,7 @@ static DSL_long_t DSL_DRV_Ioctls(DSL_DRV
- }
-
- #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
-- if (pFile->f_dentry != DSL_NULL)
-- {
-- pINode = pFile->f_dentry->d_inode;
-- }
-- else
-- {
-- pINode = DSL_NULL;
-- }
-+ pINode = file_inode(pFile);
- #endif
-
- if (pINode == DSL_NULL)
-@@ -491,7 +485,11 @@ DSL_void_t* DSL_DRV_VMalloc(
- DSL_DRV_size_t nSize)
- {
- /* VRX500-BU: Better to use vmalloc or vzmalloc here?! */
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5,9,0)
- return __vmalloc((unsigned long)nSize, GFP_KERNEL, PAGE_KERNEL);
-+#else
-+ return __vmalloc((unsigned long)nSize, GFP_KERNEL);
-+#endif
- /* return vmalloc(nSize);*/
- }
-
-@@ -917,12 +915,19 @@ DSL_int32_t DSL_DRV_ThreadShutdown(
-
- DSL_uint32_t DSL_DRV_SysTimeGet(DSL_uint32_t nOffset)
- {
-- struct timeval tv;
- DSL_uint32_t nTime = 0;
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0))
-+ struct timeval tv;
-
- memset(&tv, 0, sizeof(tv));
- do_gettimeofday(&tv);
- nTime = (DSL_uint32_t)tv.tv_sec;
-+#else
-+ struct timespec64 now;
-+
-+ ktime_get_real_ts64(&now);
-+ nTime = (DSL_uint32_t)now.tv_sec;
-+#endif
-
- if ( (nOffset == 0) || (nOffset > nTime) )
- {
-@@ -1203,6 +1208,9 @@ static void DSL_DRV_NlSendMsg(DSL_char_t
- }
- #endif
-
-+static struct class *dsl_class;
-+static dev_t dsl_devt;
-+
- /* Entry point of driver */
- int __init DSL_ModuleInit(void)
- {
-@@ -1241,6 +1249,10 @@ int __init DSL_ModuleInit(void)
-
- DSL_DRV_DevNodeInit();
-
-+ dsl_class = class_create(THIS_MODULE, DRV_DSL_CPE_API_DEV_NAME);
-+ dsl_devt = MKDEV(DRV_DSL_CPE_API_DEV_MAJOR, 0);
-+ device_create(dsl_class, NULL, dsl_devt, NULL, "dsl_cpe_api/0");
-+
- return 0;
- }
-
-@@ -1248,6 +1260,11 @@ void __exit DSL_ModuleCleanup(void)
- {
- printk("Module will be unloaded"DSL_DRV_CRLF);
-
-+ device_destroy(dsl_class, dsl_devt);
-+ dsl_devt = NULL;
-+ class_destroy(dsl_class);
-+ dsl_class = NULL;
-+
- unregister_chrdev(nMajorNum, DRV_DSL_CPE_API_DEV_NAME);
-
- DSL_DRV_Cleanup();
---- a/src/device/drv_dsl_cpe_device_vrx.c
-+++ b/src/device/drv_dsl_cpe_device_vrx.c
-@@ -5337,6 +5337,7 @@ DSL_Error_t DSL_DRV_DEV_HybridTypeGet(
- #undef DSL_DBG_BLOCK
- #define DSL_DBG_BLOCK DSL_DBG_NOTIFICATIONS
-
-+#if 0
- DSL_Error_t DSL_DRV_DEV_MeiTcLayerSignaling
- (
- DSL_Context_t *pContext,
-@@ -5384,6 +5385,15 @@ DSL_Error_t DSL_DRV_DEV_MeiTcLayerSignal
-
- return nErrCode;
- }
-+#else
-+DSL_Error_t DSL_DRV_DEV_MeiTcLayerSignaling
-+(
-+ DSL_Context_t *pContext,
-+ DSL_TcLayerSelection_t nTcLayer)
-+{
-+ return DSL_SUCCESS;
-+}
-+#endif
-
- DSL_Error_t DSL_DRV_DEV_MeiShowtimeSignaling
- (
+++ /dev/null
---- a/src/include/drv_dsl_cpe_pm_core.h
-+++ b/src/include/drv_dsl_cpe_pm_core.h
-@@ -1510,9 +1510,9 @@ typedef struct
- /** Common PM module mutex*/
- DSL_DRV_Mutex_t pmMutex;
- /** PM module direction Near-End mutex*/
-- DSL_DRV_Mutex_t pmNeMutex;
-+ struct semaphore pmNeMutex;
- /** PM module direction Far-End mutex*/
-- DSL_DRV_Mutex_t pmFeMutex;
-+ struct semaphore pmFeMutex;
- /** PM module Near-End access mutex*/
- DSL_DRV_Mutex_t pmNeAccessMutex;
- /** PM module Far-End access mutex*/
---- a/src/pm/drv_dsl_cpe_api_pm.c
-+++ b/src/pm/drv_dsl_cpe_api_pm.c
-@@ -220,9 +220,9 @@ DSL_Error_t DSL_DRV_PM_Start(
- /* init PM module common mutex */
- DSL_DRV_MUTEX_INIT(DSL_DRV_PM_CONTEXT(pContext)->pmMutex);
- /* init PM module direction Near-End mutex */
-- DSL_DRV_MUTEX_INIT(DSL_DRV_PM_CONTEXT(pContext)->pmNeMutex);
-+ sema_init(&(DSL_DRV_PM_CONTEXT(pContext)->pmNeMutex),1);
- /* init PM module direction Far-End mutex */
-- DSL_DRV_MUTEX_INIT(DSL_DRV_PM_CONTEXT(pContext)->pmFeMutex);
-+ sema_init(&(DSL_DRV_PM_CONTEXT(pContext)->pmFeMutex),1);
- /* init PM module Near-End access mutex */
- DSL_DRV_MUTEX_INIT(DSL_DRV_PM_CONTEXT(pContext)->pmNeAccessMutex);
- /* init PM module Far-End access mutex */
-@@ -592,7 +592,7 @@ DSL_Error_t DSL_DRV_PM_Stop(
- if( DSL_DRV_PM_CONTEXT(pContext)->pmThreadFe.bRun != DSL_TRUE )
- {
- DSL_DEBUG(DSL_DBG_WRN,
-- (pContext, SYS_DBG_WRN"DSL[%02d]: PM module Near-End thread already stopped"
-+ (pContext, SYS_DBG_WRN"DSL[%02d]: PM module Far-End thread already stopped"
- DSL_DRV_CRLF, DSL_DEV_NUM(pContext)));
- }
- else
---- a/src/pm/drv_dsl_cpe_pm_core.c
-+++ b/src/pm/drv_dsl_cpe_pm_core.c
-@@ -1022,7 +1022,7 @@ DSL_Error_t DSL_DRV_PM_DirectionMutexCon
- {
- if( bLock )
- {
-- if( DSL_DRV_MUTEX_LOCK(DSL_DRV_PM_CONTEXT(pContext)->pmNeMutex) )
-+ if(down_interruptible(&(DSL_DRV_PM_CONTEXT(pContext)->pmNeMutex)))
- {
- DSL_DEBUG( DSL_DBG_ERR,
- (pContext, SYS_DBG_ERR"DSL[%02d]: ERROR - Couldn't lock PM NE mutex!"
-@@ -1034,14 +1034,14 @@ DSL_Error_t DSL_DRV_PM_DirectionMutexCon
- else
- {
- /* Unlock PM module NE Mutex*/
-- DSL_DRV_MUTEX_UNLOCK(DSL_DRV_PM_CONTEXT(pContext)->pmNeMutex);
-+ up(&(DSL_DRV_PM_CONTEXT(pContext)->pmNeMutex));
- }
- }
- else
- {
- if( bLock )
- {
-- if( DSL_DRV_MUTEX_LOCK(DSL_DRV_PM_CONTEXT(pContext)->pmFeMutex) )
-+ if(down_interruptible(&(DSL_DRV_PM_CONTEXT(pContext)->pmFeMutex)))
- {
- DSL_DEBUG( DSL_DBG_ERR,
- (pContext, SYS_DBG_ERR"DSL[%02d]: ERROR - Couldn't lock PM FE mutex!"
-@@ -1053,7 +1053,7 @@ DSL_Error_t DSL_DRV_PM_DirectionMutexCon
- else
- {
- /* Unlock PM module FE Mutex*/
-- DSL_DRV_MUTEX_UNLOCK(DSL_DRV_PM_CONTEXT(pContext)->pmFeMutex);
-+ up(&(DSL_DRV_PM_CONTEXT(pContext)->pmFeMutex));
- }
- }
-
-@@ -1139,7 +1139,7 @@ DSL_Error_t DSL_DRV_PM_Lock(DSL_Context_
- if( !(DSL_DRV_PM_CONTEXT(pContext)->bPmLock) )
- {
- /* Lock PM module Near-End Mutex*/
-- if( DSL_DRV_MUTEX_LOCK(DSL_DRV_PM_CONTEXT(pContext)->pmNeMutex) )
-+ if(down_interruptible(&(DSL_DRV_PM_CONTEXT(pContext)->pmNeMutex)))
- {
- DSL_DEBUG( DSL_DBG_ERR,
- (pContext, SYS_DBG_ERR"DSL[%02d]: ERROR - Couldn't lock PM NE mutex!"
-@@ -1148,8 +1148,8 @@ DSL_Error_t DSL_DRV_PM_Lock(DSL_Context_
- return DSL_ERR_SEMAPHORE_GET;
- }
-
-- /* Lock PM module Near-End Mutex*/
-- if( DSL_DRV_MUTEX_LOCK(DSL_DRV_PM_CONTEXT(pContext)->pmFeMutex) )
-+ /* Lock PM module Far-End Mutex*/
-+ if( down_interruptible(&(DSL_DRV_PM_CONTEXT(pContext)->pmFeMutex)) )
- {
- DSL_DEBUG( DSL_DBG_ERR,
- (pContext, SYS_DBG_ERR"DSL[%02d]: ERROR - Couldn't lock PM FE mutex!"
-@@ -1193,10 +1193,10 @@ DSL_Error_t DSL_DRV_PM_UnLock(DSL_Contex
- if( DSL_DRV_PM_CONTEXT(pContext)->bPmLock )
- {
- /* Unlock PM module NE Mutex*/
-- DSL_DRV_MUTEX_UNLOCK(DSL_DRV_PM_CONTEXT(pContext)->pmNeMutex);
-+ up(&(DSL_DRV_PM_CONTEXT(pContext)->pmNeMutex));
-
- /* Unlock PM module FE Mutex*/
-- DSL_DRV_MUTEX_UNLOCK(DSL_DRV_PM_CONTEXT(pContext)->pmFeMutex);
-+ up(&(DSL_DRV_PM_CONTEXT(pContext)->pmFeMutex));
-
- /* Clear bPmLock flag*/
- DSL_DRV_PM_CONTEXT(pContext)->bPmLock = DSL_FALSE;
+++ /dev/null
---- a/src/include/drv_dsl_cpe_pm_core.h
-+++ b/src/include/drv_dsl_cpe_pm_core.h
-@@ -1552,9 +1552,9 @@ typedef struct
- DSL_boolean_t bShowtimeProcessingStart;
- /** Showtime reached flag*/
- DSL_boolean_t bShowtimeInvTrigger;
-- /** Current Showtime synchronization time to be used, (msec) */
-+ /** Current Showtime synchronization time to be used, (sec) */
- DSL_uint32_t nCurrShowtimeTime;
-- /** Showtime synchronization time to be used, (msec) */
-+ /** Showtime synchronization time to be used, (sec) */
- DSL_uint32_t nElapsedShowtimeTime;
- /** Actual Line state*/
- DSL_LineStateValue_t nLineState;
---- a/src/pm/drv_dsl_cpe_api_pm.c
-+++ b/src/pm/drv_dsl_cpe_api_pm.c
-@@ -1475,7 +1475,7 @@ DSL_Error_t DSL_DRV_PM_ChannelCountersTo
- }
-
- /* Fill Total Counters elapsed time*/
-- pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime/DSL_PM_MSEC;
-+ pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime;
-
- pChCounters = DSL_DRV_PM_PTR_CHANNEL_COUNTERS_TOTAL(pCounters->nChannel,pCounters->nDirection);
-
-@@ -1535,7 +1535,7 @@ DSL_Error_t DSL_DRV_PM_ChannelCountersEx
- }
-
- /* Fill Total Counters elapsed time*/
-- pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime/DSL_PM_MSEC;
-+ pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime;
-
- pChCounters = DSL_DRV_PM_PTR_CHANNEL_COUNTERS_TOTAL_EXT(pCounters->nChannel);
-
-@@ -2518,7 +2518,7 @@ DSL_Error_t DSL_DRV_PM_DataPathCountersT
- }
-
- /* Fill Total Counters elapsed time*/
-- pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime/DSL_PM_MSEC;
-+ pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime;
-
- pDpCounters = DSL_DRV_PM_PTR_DATAPATH_COUNTERS_TOTAL(pCounters->nChannel,pCounters->nDirection);
-
-@@ -3352,7 +3352,7 @@ DSL_Error_t DSL_DRV_PM_DataPathFailureCo
- }
-
- /* Fill Total Counters elapsed time*/
-- pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime/DSL_PM_MSEC;
-+ pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime;
-
- pDpCounters = DSL_DRV_PM_PTR_DATAPATH_FAILURE_COUNTERS_TOTAL(pCounters->nChannel,pCounters->nDirection);
-
-@@ -4130,7 +4130,7 @@ DSL_Error_t DSL_DRV_PM_LineSecCountersTo
- }
-
- /* Fill Total Counters elapsed time*/
-- pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime/DSL_PM_MSEC;
-+ pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime;
-
- pLineCounters = DSL_DRV_PM_PTR_LINE_SEC_COUNTERS_TOTAL(pCounters->nDirection);
-
-@@ -4787,7 +4787,7 @@ DSL_Error_t DSL_DRV_PM_LineInitCountersT
- }
-
- /* Fill Total Counters elapsed time*/
-- pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime/DSL_PM_MSEC;
-+ pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime;
-
- pLinitCounters = DSL_DRV_PM_PTR_LINE_INIT_COUNTERS_TOTAL();
-
-@@ -5240,7 +5240,7 @@ DSL_Error_t DSL_DRV_PM_LineEventShowtime
- }
-
- /* Fill Total Counters elapsed time*/
-- pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime/DSL_PM_MSEC;
-+ pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime;
-
- pLfCounters = DSL_DRV_PM_PTR_LINE_EVENT_SHOWTIME_COUNTERS_TOTAL(pCounters->nDirection);
-
-@@ -5720,7 +5720,7 @@ DSL_Error_t DSL_DRV_PM_ReTxCountersTotal
- }
-
- /* Fill Total Counters elapsed time*/
-- pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime/DSL_PM_MSEC;
-+ pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime;
-
- pReTxCounters = DSL_DRV_PM_PTR_RETX_COUNTERS_TOTAL(pCounters->nDirection);
-
---- a/src/pm/drv_dsl_cpe_pm_core.c
-+++ b/src/pm/drv_dsl_cpe_pm_core.c
-@@ -60,6 +60,7 @@ static DSL_Error_t DSL_DRV_PM_SyncTimeUp
- {
- DSL_Error_t nErrCode = DSL_SUCCESS;
- DSL_uint32_t msecTimeFrame = DSL_PM_COUNTER_POLLING_CYCLE,
-+ secTimeFrame = DSL_PM_COUNTER_POLLING_CYCLE/DSL_PM_MSEC,
- nCurrMsTime = 0;
- #ifdef INCLUDE_DSL_CPE_PM_HISTORY
- DSL_uint32_t nCurrSysTime = 0, nPrevElapsedTime = 0;
-@@ -99,10 +100,13 @@ static DSL_Error_t DSL_DRV_PM_SyncTimeUp
- {
- /* Get elapsed time [msec] since the last entry*/
- msecTimeFrame = nCurrMsTime - DSL_DRV_PM_CONTEXT(pContext)->nLastMsTimeCheck;
-+
-+ /* Get elapsed time [sec] since the last entry*/
-+ secTimeFrame = (nCurrMsTime/DSL_PM_MSEC) - (DSL_DRV_PM_CONTEXT(pContext)->nLastMsTimeCheck/DSL_PM_MSEC);
- }
-
- /* Get Total Elapsed Time Since the PM module startup*/
-- DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime += msecTimeFrame;
-+ DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime += secTimeFrame;
-
- /* Set last time check to the current time*/
- DSL_DRV_PM_CONTEXT(pContext)->nLastMsTimeCheck = nCurrMsTime;
-@@ -140,7 +144,7 @@ static DSL_Error_t DSL_DRV_PM_SyncTimeUp
- else
- {
- /* Update current showtime elapsed time*/
-- DSL_DRV_PM_CONTEXT(pContext)->nCurrShowtimeTime += (msecTimeFrame/DSL_PM_MSEC);
-+ DSL_DRV_PM_CONTEXT(pContext)->nCurrShowtimeTime += secTimeFrame;
- DSL_DRV_PM_CONTEXT(pContext)->nElapsedShowtimeTime =
- DSL_DRV_PM_CONTEXT(pContext)->nCurrShowtimeTime;
- }
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_BASE_NAME)-$(PKG_VERSION)
PKG_LICENSE:=BSD-2-Clause
-PKG_BUILD_DEPENDS:=ltq-vdsl
+PKG_BUILD_DEPENDS:=ltq-vdsl-vr9
PKG_FLAGS:=nonshared
PKG_FIXUP:=autoreconf