This commit is contained in:
RikkaNekoo
2025-12-19 19:40:34 +08:00
parent c956a0609c
commit 0b3d557c6b
4 changed files with 75 additions and 158 deletions
+6 -6
View File
@@ -1,16 +1,16 @@
pkgbase = yt6801-dkms
pkgdesc = Kernel module for Motorcomm YT6801 ethernet controller (DKMS)
pkgver = 1.0.30
pkgrel = 5
pkgver = 1.0.31
pkgrel = 1
url = https://www.motor-comm.com/product/ethernet-control-chip
arch = x86_64
license = GPL-2.0-or-later
depends = dkms
source = https://www.motor-comm.com/Public/Uploads/uploadfile/files/20250430/yt6801-linux-driver-1.0.30.zip
source = tuxedo.patch
source = yt6801-1.0.31.zip::https://www.motor-comm.com/Cn/Skippower/downloadFile.html?id=1817
source = fix.patch
source = drop-flags.patch
sha256sums = 3dd7173a935da10fb9dfa537fd2bf4d6d3ae90c1d12e8091054667fb911bd6c4
sha256sums = 75bfbca4683c2084d8032800a506f2c7c68679a04c196d81755cea91412a3a5a
sha256sums = 9ea62182bd520483df5fd3ec320262cbdddcc763f3128ae37abd26905a97e14c
sha256sums = 3e850f2d35fd3da6d10035b5ea04e995a0d7962b1c02599b42f1f7a296822e78
sha256sums = 814c6a121b392f512ec4c8898dd9f6c50ae3ff9d946bc1d115135fa6f5c6a897
pkgname = yt6801-dkms
+10 -9
View File
@@ -1,26 +1,27 @@
# Maintainer: Shiina Rikka <rikka@rikka.im>
# Contributor: Eumeryx <eumeryx@foxmail.com>
_pkgbase=yt6801
pkgname=yt6801-dkms
pkgver=1.0.30
pkgrel=5
pkgver=1.0.31
pkgrel=1
pkgdesc="Kernel module for Motorcomm YT6801 ethernet controller (DKMS)"
arch=('x86_64')
url="https://www.motor-comm.com/product/ethernet-control-chip"
license=('GPL-2.0-or-later')
depends=('dkms')
source=('https://www.motor-comm.com/Public/Uploads/uploadfile/files/20250430/yt6801-linux-driver-1.0.30.zip'
'tuxedo.patch'
source=(${_pkgbase}-${pkgver}.zip::'https://www.motor-comm.com/Cn/Skippower/downloadFile.html?id=1817'
'fix.patch'
'drop-flags.patch')
sha256sums=('3dd7173a935da10fb9dfa537fd2bf4d6d3ae90c1d12e8091054667fb911bd6c4'
'75bfbca4683c2084d8032800a506f2c7c68679a04c196d81755cea91412a3a5a'
sha256sums=('9ea62182bd520483df5fd3ec320262cbdddcc763f3128ae37abd26905a97e14c'
'3e850f2d35fd3da6d10035b5ea04e995a0d7962b1c02599b42f1f7a296822e78'
'814c6a121b392f512ec4c8898dd9f6c50ae3ff9d946bc1d115135fa6f5c6a897')
prepare() {
cd ${srcdir}
patch -p1 < tuxedo.patch
mkdir src
tar -zxf ${_pkgbase}-${pkgver}.tar.gz -C src
patch -p1 < drop-flags.patch
patch -p1 < fix.patch
}
package() {
@@ -28,7 +29,7 @@ package() {
install -Dm644 ${srcdir}/src/*.c ${pkgdir}/usr/src/${_pkgbase}-${pkgver}/
install -Dm644 ${srcdir}/src/*.h ${pkgdir}/usr/src/${_pkgbase}-${pkgver}/
install -Dm644 ${srcdir}/src/Kbuild ${pkgdir}/usr/src/${_pkgbase}-${pkgver}/
install -Dm644 ${srcdir}/src/Makefile ${pkgdir}/usr/src/${_pkgbase}-${pkgver}/
install -Dm644 ${srcdir}/src/dkms.conf ${pkgdir}/usr/src/${_pkgbase}-${pkgver}/
install -Dm644 ${srcdir}/src/motorcomm ${pkgdir}/usr/src/${_pkgbase}-${pkgver}/
}
+59
View File
@@ -0,0 +1,59 @@
--- a/src/fuxi-gmac-net.c
+++ b/src/fuxi-gmac-net.c
@@ -772,7 +772,9 @@
static void fxgmac_tx_hang_timer_handler(unsigned long data)
#endif
{
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,16,0))
+ struct fxgmac_channel *channel = timer_container_of(channel, t, expansion.tx_hang_timer);
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
struct fxgmac_channel *channel = from_timer(channel, t, expansion.tx_hang_timer);
#else
struct fxgmac_channel *channel = (struct fxgmac_channel *)data;
--- a/src/fuxi-gmac-phy.c
+++ b/src/fuxi-gmac-phy.c
@@ -322,7 +322,9 @@
static void fxgmac_phy_link_poll(unsigned long data)
#endif
{
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,16,0))
+ struct fxgmac_pdata *pdata = timer_container_of(pdata, t, expansion.phy_poll_tm);
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0))
struct fxgmac_pdata *pdata = from_timer(pdata, t, expansion.phy_poll_tm);
#else
struct fxgmac_pdata *pdata = (struct fxgmac_pdata*)data;
@@ -350,7 +352,9 @@
int fxgmac_phy_timer_init(struct fxgmac_pdata *pdata)
{
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,16,0))
+ timer_init_key(&pdata->expansion.phy_poll_tm, NULL, 0, "fuxi_phy_link_update_timer", NULL);
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0))
init_timer_key(&pdata->expansion.phy_poll_tm, NULL, 0, "fuxi_phy_link_update_timer", NULL);
#else
init_timer_key(&pdata->expansion.phy_poll_tm, 0, "fuxi_phy_link_update_timer", NULL);
@@ -368,6 +372,10 @@
void fxgmac_phy_timer_destroy(struct fxgmac_pdata *pdata)
{
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,15,0))
+ timer_shutdown_sync(&pdata->expansion.phy_poll_tm);
+#else
del_timer_sync(&pdata->expansion.phy_poll_tm);
+#endif
DPRINTK("fxgmac_phy_timer removed\n");
}
--- a/src/fuxi-gmac.h
+++ b/src//fuxi-gmac.h
@@ -50,6 +50,8 @@
#define FXGMAC_NS_IFA_LOCAL_LINK 1
#define FXGMAC_NS_IFA_GLOBAL_UNICAST 2
+#define FXGMAC_INT_MODERATION_ENABLED 1
+
#define FXGMAX_ASPM_WAR_EN
/* Descriptor related parameters */
#if FXGMAC_TX_HANG_TIMER_ENABLED
-143
View File
@@ -1,143 +0,0 @@
--- a/src/fuxi-gmac-net.c
+++ b/src/fuxi-gmac-net.c
@@ -768,7 +768,9 @@
static void fxgmac_tx_hang_timer_handler(unsigned long data)
#endif
{
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,16,0))
+ struct fxgmac_channel *channel = timer_container_of(channel, t, expansion.tx_hang_timer);
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
struct fxgmac_channel *channel = from_timer(channel, t, expansion.tx_hang_timer);
#else
struct fxgmac_channel *channel = (struct fxgmac_channel *)data;
@@ -866,9 +868,9 @@
if (!channel->tx_ring)
break;
- del_timer_sync(&channel->tx_timer);
+ timer_delete_sync(&channel->tx_timer);
#if FXGMAC_TX_HANG_TIMER_ENABLED
- del_timer_sync(&channel->tx_hang_timer);
+ timer_delete_sync(&channel->tx_hang_timer);
channel->tx_hang_timer_active = 0;
#endif
}
@@ -1913,7 +1915,7 @@
DPRINTK( "mgmt_int_isr %lld\n", pstats->mgmt_int_isr);
}
-#if ((LINUX_VERSION_CODE > KERNEL_VERSION(4,0,0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0) || (RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7,8))))
+#if ((LINUX_VERSION_CODE > KERNEL_VERSION(4,0,0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0)))
static void fxgmac_tx_timeout(struct net_device *netdev)
#else
static void fxgmac_tx_timeout(struct net_device *netdev, unsigned int unused)
--- a/src/fuxi-gmac-phy.c
+++ b/src/fuxi-gmac-phy.c
@@ -318,7 +318,9 @@
static void fxgmac_phy_link_poll(unsigned long data)
#endif
{
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,16,0))
+ struct fxgmac_pdata *pdata = timer_container_of(pdata, t, expansion.phy_poll_tm);
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0))
struct fxgmac_pdata *pdata = from_timer(pdata, t, expansion.phy_poll_tm);
#else
struct fxgmac_pdata *pdata = (struct fxgmac_pdata*)data;
@@ -346,7 +348,9 @@
int fxgmac_phy_timer_init(struct fxgmac_pdata *pdata)
{
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,16,0))
+ timer_init_key(&pdata->expansion.phy_poll_tm, NULL, 0, "fuxi_phy_link_update_timer", NULL);
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0))
init_timer_key(&pdata->expansion.phy_poll_tm, NULL, 0, "fuxi_phy_link_update_timer", NULL);
#else
init_timer_key(&pdata->expansion.phy_poll_tm, 0, "fuxi_phy_link_update_timer", NULL);
@@ -364,7 +368,7 @@
void fxgmac_phy_timer_destroy(struct fxgmac_pdata *pdata)
{
- del_timer_sync(&pdata->expansion.phy_poll_tm);
+ timer_delete_sync(&pdata->expansion.phy_poll_tm);
DPRINTK("fxgmac_phy_timer removed\n");
}
--- a/src/fuxi-os.h
+++ b/src/fuxi-os.h
@@ -432,7 +432,7 @@
#else
#define FXGMAC_PR(x...) do { } while (0)
-#define DPRINTK(x...)
+#define DPRINTK(x...) do { } while (0)
#endif
#define IOC_MAGIC 'M'
--- /dev/null
+++ b/src/Kbuild
@@ -0,0 +1,3 @@
+yt6801-objs := fuxi-gmac-common.o fuxi-gmac-desc.o fuxi-gmac-ethtool.o fuxi-gmac-hw.o fuxi-gmac-net.o fuxi-gmac-pci.o fuxi-gmac-phy.o fuxi-efuse.o fuxi-gmac-ioctl.o
+obj-m += yt6801.o
+ccflags-y += -DFXGMAC_ASPM_ENABLED -DFXGMAC_EPHY_LOOPBACK_DETECT_ENABLED
--- a/src/Makefile
+++ /dev/null
@@ -1,53 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-################################################################################
-#
-# Copyright (c) 2023 Motorcomm, Inc.
-# Motorcomm Confidential and Proprietary.
-#
-# This is Motorcomm NIC driver relevant files. Please don't copy, modify,
-# distribute without commercial permission.
-#
-################################################################################
-
-SUBARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/ -e s/s390x/s390/ -e s/parisc64/parisc/ -e s/ppc.*/powerpc/ -e s/mips.*/mips/ -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ -e s/riscv.*/riscv/)
-CURARCH ?= $(SUBARCH)
-ARCH ?= $(SUBARCH)
-CROSS_COMPILE ?=
-#CONFIG_MODULE_SIG=n
-PWD :=$(shell pwd)
-EXTRA_CFLAGS = -Wall -g -I$(CURDIR) -I$(subst fuxi-linux-release-package/module_fuxi/src,common,$(PWD)) -I$(PWD)
-EXTRA_CFLAGS += -DFXGMAC_DEBUG
-
-KSRC_BASE = /lib/modules/$(shell uname -r)
-KSRC = $(KSRC_BASE)/build
-#KDST = /lib/modules/$(shell uname -r)/kernel/drivers/net/ethernet/motorcomm/
-KDST = kernel/drivers/net/ethernet/motorcomm
-ko_dir = $(KSRC_BASE)/$(KDST)/
-KFILE = yt6801
-ko_full = $(ko_dir)$(KFILE).ko
-
-yt6801-objs := fuxi-gmac-common.o fuxi-gmac-desc.o fuxi-gmac-ethtool.o fuxi-gmac-hw.o fuxi-gmac-net.o fuxi-gmac-pci.o fuxi-gmac-phy.o fuxi-efuse.o fuxi-gmac-ioctl.o
-obj-m += yt6801.o
-modules:
- make -C $(KSRC) M=$(PWD) modules
-
-install:
- @echo "KFILE: " $(KFILE)
- @echo "KDST: " $(KDST)
- make -C $(KSRC) M=$(PWD) INSTALL_MOD_DIR=$(KDST) modules_install
- sudo ls -l $(ko_dir)
- depmod $(shell uname -r)
- modprobe $(KFILE)
- @file $(ko_full)
- @echo install done.
- @modinfo $(ko_full)
-
-uninstall:
- sudo ls -l $(ko_dir)
- sudo rm $(ko_full)
- sudo ls -l $(ko_dir)
-
-clean:
- make -C $(KSRC) M=$(PWD) clean
-
-.PHONY:modules install uninstall clean