From: Martin Schiller Date: Wed, 21 Aug 2019 06:44:58 +0000 (+0200) Subject: kernel: add new ltq-vdsl-vr11-mei driver X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=bc442076f28937d5d752364be1727e765325cbac;p=openwrt%2Fstaging%2Fdedeckeh.git kernel: add new ltq-vdsl-vr11-mei driver This uses version 1.11.1 of the drv_mei_cpe package from the Intel UGW 8.5.2.10 for the VRX518. Signed-off-by: Martin Schiller [updated for kernel 5.10] Signed-off-by: Jan Hoffmann [update to 1.11.1, switch to tag tarball, update patches] Signed-off-by: Andre Heider [update for kernel 5.15] Signed-off-by: Jan Hoffmann Signed-off-by: Andre Heider --- diff --git a/package/kernel/lantiq/ltq-vdsl-vr11-mei/Makefile b/package/kernel/lantiq/ltq-vdsl-vr11-mei/Makefile new file mode 100644 index 0000000000..990471a219 --- /dev/null +++ b/package/kernel/lantiq/ltq-vdsl-vr11-mei/Makefile @@ -0,0 +1,113 @@ +# 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-vr11-mei +PKG_VERSION:=1.11.1 +PKG_RELEASE:=$(AUTORELEASE) +PKG_BASE_NAME:=dsl_cpe_mei + +UGW_VERSION=8.5.2.10 +UGW_BASENAME=$(PKG_BASE_NAME)-ugw_$(UGW_VERSION) + +PKG_SOURCE:=$(UGW_BASENAME).tar.bz2 +PKG_SOURCE_URL:=https://gitlab.com/prpl-foundation/intel/$(PKG_BASE_NAME)/-/archive/ugw_$(UGW_VERSION)/ +PKG_HASH:=337614473d50ed64de010adaed99a16103e08eea8fc67fe9d6caf155bea33d1d +PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(UGW_BASENAME) +PKG_LICENSE:=GPL-2.0 BSD-2-Clause +PKG_LICENSE_FILES:=LICENSE +PKG_EXTMOD_SUBDIRS:=src + +PKG_FIXUP:=autoreconf +PKG_FLAGS:=nonshared + +include $(INCLUDE_DIR)/package.mk + +define KernelPackage/ltq-vdsl-vr11-mei + TITLE:=mei driver for vdsl + SECTION:=sys + SUBMENU:=Network Devices + DEPENDS:=@TARGET_ipq40xx +kmod-ltq-ifxos +kmod-vrx518_tc + FILES:=$(PKG_BUILD_DIR)/src/drv_mei_cpe.ko + AUTOLOAD:=$(call AutoLoad,50,drv_mei_cpe) +endef + +define KernelPackage/ltq-vdsl-vr11-mei/description + Lantiq MEI CPE Kernel Module Driver +endef + + +define Package/ltq-vdsl-vr11-mei-test + SECTION:=net + CATEGORY:=Network + TITLE:=Lantiq mei driver test tool + URL:=http://www.lantiq.com/ + DEPENDS:=@TARGET_ipq40xx +kmod-ltq-vdsl-vr11-mei +endef + +define Package/ltq-vdsl-vr11-mei-test/description + Userland tool to directly control the mei driver, this is only needed + for test and development purposes. +endef + +MAKE_FLAGS += \ + $(KERNEL_MAKE_FLAGS) \ + SHELL="$(BASH)" + +# ltq-vdsl-app uses a header provided by the MEI driver which has some +# conditionals. +# Define the conditionals here to have the same view on both sides. If you +# change them, you need to change them for the ltq-vdsl-app as well +MEI_DRV_CFLAGS = \ + -DMEI_DRV_ATM_PTM_INTERFACE_ENABLE=1 \ + -DMEI_SUPPORT_DEBUG_STREAMS=1 \ + -DMEI_SUPPORT_OPTIMIZED_FW_DL=1 + +#MEI_DRV_CFLAGS+= \ +# -DMEI_SUPPORT_OPTIMIZED_FW_DL=0 \ +# -DIRQ_POLLING_FORCE=99 + +CONFIGURE_ARGS += \ + --enable-debug-logger-support=no +# --enable-debug-stream-support=no + +# This looks weird, but it's necessary to address the right device. +# (pdev->dev.parent instead of pdev->dev) +MEI_DRV_CFLAGS+= \ + -DMEI_TARGET_x86=1 + +CONFIGURE_ARGS += \ + --enable-kernelincl="$(LINUX_DIR)/include" \ + --enable-device=vr11 \ + --enable-debug \ + --enable-error_print \ + --enable-ifxos-include="-I$(STAGING_DIR)/usr/include/ifxos/" \ + --enable-ifxos-library="-L$(STAGING_DIR)/usr/lib" \ + --enable-add_drv_cflags="$(MEI_DRV_CFLAGS)" \ + --enable-linux-26 \ + --enable-kernelbuild="$(LINUX_DIR)" \ + --enable-drv_test_appl=yes \ + ARCH=$(LINUX_KARCH) + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include/vdsl + $(CP) $(PKG_BUILD_DIR)/src/drv_mei_cpe_api_intern.h $(1)/usr/include/vdsl/ + $(CP) $(PKG_BUILD_DIR)/src/drv_mei_cpe_api_atm_ptm_intern.h $(1)/usr/include/vdsl/ + $(CP) $(PKG_BUILD_DIR)/src/drv_mei_cpe_interface.h $(1)/usr/include/vdsl + $(CP) $(PKG_BUILD_DIR)/src/drv_mei_cpe_config.h $(1)/usr/include/vdsl/ + $(CP) $(PKG_BUILD_DIR)/src/cmv_message_format.h $(1)/usr/include/vdsl/ +endef + +$(eval $(call KernelPackage,ltq-vdsl-vr11-mei)) + +define Package/ltq-vdsl-vr11-mei-test/install + $(INSTALL_DIR) $(1)/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/mei_cpe_drv_test $(1)/bin +endef + +$(eval $(call BuildPackage,ltq-vdsl-vr11-mei-test)) diff --git a/package/kernel/lantiq/ltq-vdsl-vr11-mei/patches/001-fix-compile.patch b/package/kernel/lantiq/ltq-vdsl-vr11-mei/patches/001-fix-compile.patch new file mode 100644 index 0000000000..ff46b1f088 --- /dev/null +++ b/package/kernel/lantiq/ltq-vdsl-vr11-mei/patches/001-fix-compile.patch @@ -0,0 +1,88 @@ +--- a/src/drv_mei_cpe_linux.c ++++ b/src/drv_mei_cpe_linux.c +@@ -1534,7 +1534,7 @@ struct proc_entry { + char name[32]; + proc_rd_callback_t rd; + proc_wr_callback_t wr; +- struct file_operations ops; ++ struct proc_ops ops; + int entity; + }; + +@@ -2068,16 +2068,15 @@ static int mei_proc_single_open(struct i + static void mei_proc_entry_create(struct proc_dir_entry *parent_node, + struct proc_entry *proc_entry) + { +- memset(&proc_entry->ops, 0, sizeof(struct file_operations)); +- proc_entry->ops.owner = THIS_MODULE; ++ memset(&proc_entry->ops, 0, sizeof(struct proc_ops)); + +- proc_entry->ops.open = mei_proc_single_open; +- proc_entry->ops.release = single_release; ++ proc_entry->ops.proc_open = mei_proc_single_open; ++ proc_entry->ops.proc_release = single_release; + +- proc_entry->ops.read = seq_read; +- proc_entry->ops.llseek = seq_lseek; ++ proc_entry->ops.proc_read = seq_read; ++ proc_entry->ops.proc_lseek = seq_lseek; + if (proc_entry->wr) +- proc_entry->ops.write = proc_entry->wr; ++ proc_entry->ops.proc_write = proc_entry->wr; + + proc_create_data(proc_entry->name, + (S_IFREG | S_IRUGO), +--- a/src/drv_mei_cpe_linux.h ++++ b/src/drv_mei_cpe_linux.h +@@ -31,6 +31,7 @@ + #include + + #include ++#include + #include + #include + #include +@@ -122,7 +123,7 @@ typedef int (*MEI_RequestIrq_WrapLinux_t + /** + Function typedef for the Linux free_irq() + */ +-typedef void (*MEI_FreeIrq_WrapLinux_t)( unsigned int usedIrq, ++typedef const void *(*MEI_FreeIrq_WrapLinux_t)( unsigned int usedIrq, + void *usedDevId ); + + +--- a/src/drv_mei_cpe_linux_proc_config.c ++++ b/src/drv_mei_cpe_linux_proc_config.c +@@ -1277,13 +1277,12 @@ static int mei_proc_single_open(struct i + return single_open(file, mei_seq_single_show, PDE_DATA(inode)); + } + +-static struct file_operations proc_ops = { +- .owner = THIS_MODULE, +- .open = mei_proc_single_open, +- .release = single_release, +- .read = seq_read, +- .llseek = seq_lseek, +- .write = MEI_ProcWriteConfig ++static struct proc_ops proc_ops = { ++ .proc_open = mei_proc_single_open, ++ .proc_release = single_release, ++ .proc_read = seq_read, ++ .proc_lseek = seq_lseek, ++ .proc_write = MEI_ProcWriteConfig + }; + + /** +--- a/src/mei_cpe_appl_osmap.h ++++ b/src/mei_cpe_appl_osmap.h +@@ -38,10 +38,6 @@ extern "C" + #include + #include + #include +- +-extern int snprintf (char *__restrict __s, size_t __maxlen, +- __const char *__restrict __format, ...) +- __THROW __attribute__ ((__format__ (__printf__, 3, 4))); + #endif + + /* ========================================================================== diff --git a/package/kernel/lantiq/ltq-vdsl-vr11-mei/patches/010-warnings.patch b/package/kernel/lantiq/ltq-vdsl-vr11-mei/patches/010-warnings.patch new file mode 100644 index 0000000000..f6ee2f7f8b --- /dev/null +++ b/package/kernel/lantiq/ltq-vdsl-vr11-mei/patches/010-warnings.patch @@ -0,0 +1,20 @@ +--- a/src/drv_mei_cpe_dbg_driver.c ++++ b/src/drv_mei_cpe_dbg_driver.c +@@ -309,7 +309,7 @@ MEI_STATIC IFX_void_t MEI_DbgMsgDumpLogW + IFX_int32_t i; + unsigned short paylSize; + union {IFX_uint8_t d8[2]; IFX_uint16_t d16;} temp16; +- union {IFX_uint8_t d8[4]; IFX_uint16_t d32;} temp32; ++ union {IFX_uint8_t d8[4]; IFX_uint32_t d32;} temp32; + + MEI_DbgMsgDumpLogLabel(pCmvMsg, fctOpCode); + +@@ -368,7 +368,7 @@ MEI_STATIC IFX_void_t MEI_DbgMsgDumpTrcW + IFX_int32_t i; + unsigned short paylSize; + union {IFX_uint8_t d8[2]; IFX_uint16_t d16;} temp16; +- union {IFX_uint8_t d8[4]; IFX_uint16_t d32;} temp32; ++ union {IFX_uint8_t d8[4]; IFX_uint32_t d32;} temp32; + + MEI_DbgMsgDumpTraceLabel(pCmvMsg, fctOpCode); + diff --git a/package/kernel/lantiq/ltq-vdsl-vr11-mei/patches/020-not-leak-cflags.patch b/package/kernel/lantiq/ltq-vdsl-vr11-mei/patches/020-not-leak-cflags.patch new file mode 100644 index 0000000000..f6fb48ed6e --- /dev/null +++ b/package/kernel/lantiq/ltq-vdsl-vr11-mei/patches/020-not-leak-cflags.patch @@ -0,0 +1,12 @@ +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -213,8 +213,7 @@ drv_mei_cpe_common_cflags = $(AM_CFLAGS) + else + + drv_mei_cpe_common_cflags = \ +- $(AM_CFLAGS) -D__KERNEL__ -DLINUX -D__linux__ -DMODULE -DEXPORT_SYMTAB \ +- -pipe -Wall -Wimplicit -Wunused -Wuninitialized -Wstrict-aliasing -Wno-date-time ++ -D__KERNEL__ -DLINUX -D__linux__ -DMODULE -DEXPORT_SYMTAB + + endif + diff --git a/package/kernel/lantiq/ltq-vdsl-vr11-mei/patches/100-compat.patch b/package/kernel/lantiq/ltq-vdsl-vr11-mei/patches/100-compat.patch new file mode 100644 index 0000000000..a2e42ccb03 --- /dev/null +++ b/package/kernel/lantiq/ltq-vdsl-vr11-mei/patches/100-compat.patch @@ -0,0 +1,10 @@ +--- a/src/drv_mei_cpe_linux.c ++++ b/src/drv_mei_cpe_linux.c +@@ -4530,7 +4530,6 @@ module_exit (MEI_module_exit); + #ifdef MODULE + MODULE_AUTHOR("www.lantiq.com"); + MODULE_DESCRIPTION("MEI CPE Driver - www.lantiq.com"); +-MODULE_SUPPORTED_DEVICE("MEI CPE Interface"); + MODULE_LICENSE ("GPL"); + #endif /* #ifdef MODULE*/ + diff --git a/package/kernel/lantiq/ltq-vdsl-vr11-mei/patches/101_no-date-time.patch b/package/kernel/lantiq/ltq-vdsl-vr11-mei/patches/101_no-date-time.patch new file mode 100644 index 0000000000..18918b9956 --- /dev/null +++ b/package/kernel/lantiq/ltq-vdsl-vr11-mei/patches/101_no-date-time.patch @@ -0,0 +1,13 @@ +--- a/src/drv_mei_cpe_linux.c ++++ b/src/drv_mei_cpe_linux.c +@@ -1556,8 +1556,8 @@ static void MEI_GetVersionProc(struct se + } + + seq_printf(s, "%s" MEI_DRV_CRLF, &MEI_WHATVERSION[4]); +- seq_printf(s, "Compiled on %s, %s for Linux kernel %s (jiffies: %ld)" MEI_DRV_CRLF, +- __DATE__, __TIME__, UTS_RELEASE, jiffies); ++ seq_printf(s, "Compiled for Linux kernel %s (jiffies: %ld)" MEI_DRV_CRLF, ++ UTS_RELEASE, jiffies); + } + + /** diff --git a/package/kernel/lantiq/ltq-vdsl-vr11-mei/patches/110-reset-g_tx_link_rate-on-showtime-exit.patch b/package/kernel/lantiq/ltq-vdsl-vr11-mei/patches/110-reset-g_tx_link_rate-on-showtime-exit.patch new file mode 100644 index 0000000000..f57b8f076f --- /dev/null +++ b/package/kernel/lantiq/ltq-vdsl-vr11-mei/patches/110-reset-g_tx_link_rate-on-showtime-exit.patch @@ -0,0 +1,12 @@ +--- a/src/drv_mei_cpe_api_atm_ptm_intern.c ++++ b/src/drv_mei_cpe_api_atm_ptm_intern.c +@@ -152,6 +152,9 @@ IFX_int32_t MEI_InternalXtmSwhowtimeExit + /* Get line number*/ + dslLineNum = pMeiDynCntrl->pMeiDev->meiDrvCntrl.dslLineNum; + ++ g_tx_link_rate[dslLineNum][0] = 0; ++ g_tx_link_rate[dslLineNum][1] = 0; ++ + #ifdef PPA_SUPPORTS_CALLBACKS + /* get NULL or function pointer */ + mei_showtime_exit = diff --git a/package/kernel/lantiq/ltq-vdsl-vr11-mei/patches/120-remove-debug-printk.patch b/package/kernel/lantiq/ltq-vdsl-vr11-mei/patches/120-remove-debug-printk.patch new file mode 100644 index 0000000000..24db470c4a --- /dev/null +++ b/package/kernel/lantiq/ltq-vdsl-vr11-mei/patches/120-remove-debug-printk.patch @@ -0,0 +1,10 @@ +--- a/src/drv_mei_cpe_mei_access_vrx.c ++++ b/src/drv_mei_cpe_mei_access_vrx.c +@@ -1691,7 +1691,6 @@ IFX_int32_t MEI_InterfaceDetect( + { + MEI_REG_ACCESS_ME_VERSION_SET(pMeiDrvCntrl, 0x00000000); + hwVers = MEI_REG_ACCESS_ME_VERSION_GET(pMeiDrvCntrl); +- printk ("hwVers=0x%08X\n", hwVers); + + if (MEI_DEVICE_CFG_IS_PLATFORM(e_MEI_DEV_PLATFORM_CONFIG_VR9)) + {