pick changes from Tuxedo

This commit is contained in:
RikkaNekoo
2025-12-09 02:03:47 +08:00
parent 150b784fc2
commit c956a0609c
4 changed files with 151 additions and 57 deletions
+3 -3
View File
@@ -1,16 +1,16 @@
pkgbase = yt6801-dkms pkgbase = yt6801-dkms
pkgdesc = Kernel module for Motorcomm YT6801 ethernet controller (DKMS) pkgdesc = Kernel module for Motorcomm YT6801 ethernet controller (DKMS)
pkgver = 1.0.30 pkgver = 1.0.30
pkgrel = 4 pkgrel = 5
url = https://www.motor-comm.com/product/ethernet-control-chip url = https://www.motor-comm.com/product/ethernet-control-chip
arch = x86_64 arch = x86_64
license = GPL-2.0-or-later license = GPL-2.0-or-later
depends = dkms depends = dkms
source = https://www.motor-comm.com/Public/Uploads/uploadfile/files/20250430/yt6801-linux-driver-1.0.30.zip source = https://www.motor-comm.com/Public/Uploads/uploadfile/files/20250430/yt6801-linux-driver-1.0.30.zip
source = fix.patch source = tuxedo.patch
source = drop-flags.patch source = drop-flags.patch
sha256sums = 3dd7173a935da10fb9dfa537fd2bf4d6d3ae90c1d12e8091054667fb911bd6c4 sha256sums = 3dd7173a935da10fb9dfa537fd2bf4d6d3ae90c1d12e8091054667fb911bd6c4
sha256sums = ef1855465b9f3c4102ce88dedb4beaaa12bf2a951adbe220ec617a17eb80c861 sha256sums = 75bfbca4683c2084d8032800a506f2c7c68679a04c196d81755cea91412a3a5a
sha256sums = 814c6a121b392f512ec4c8898dd9f6c50ae3ff9d946bc1d115135fa6f5c6a897 sha256sums = 814c6a121b392f512ec4c8898dd9f6c50ae3ff9d946bc1d115135fa6f5c6a897
pkgname = yt6801-dkms pkgname = yt6801-dkms
+5 -5
View File
@@ -4,22 +4,22 @@
_pkgbase=yt6801 _pkgbase=yt6801
pkgname=yt6801-dkms pkgname=yt6801-dkms
pkgver=1.0.30 pkgver=1.0.30
pkgrel=4 pkgrel=5
pkgdesc="Kernel module for Motorcomm YT6801 ethernet controller (DKMS)" pkgdesc="Kernel module for Motorcomm YT6801 ethernet controller (DKMS)"
arch=('x86_64') arch=('x86_64')
url="https://www.motor-comm.com/product/ethernet-control-chip" url="https://www.motor-comm.com/product/ethernet-control-chip"
license=('GPL-2.0-or-later') license=('GPL-2.0-or-later')
depends=('dkms') depends=('dkms')
source=('https://www.motor-comm.com/Public/Uploads/uploadfile/files/20250430/yt6801-linux-driver-1.0.30.zip' source=('https://www.motor-comm.com/Public/Uploads/uploadfile/files/20250430/yt6801-linux-driver-1.0.30.zip'
'fix.patch' 'tuxedo.patch'
'drop-flags.patch') 'drop-flags.patch')
sha256sums=('3dd7173a935da10fb9dfa537fd2bf4d6d3ae90c1d12e8091054667fb911bd6c4' sha256sums=('3dd7173a935da10fb9dfa537fd2bf4d6d3ae90c1d12e8091054667fb911bd6c4'
'ef1855465b9f3c4102ce88dedb4beaaa12bf2a951adbe220ec617a17eb80c861' '75bfbca4683c2084d8032800a506f2c7c68679a04c196d81755cea91412a3a5a'
'814c6a121b392f512ec4c8898dd9f6c50ae3ff9d946bc1d115135fa6f5c6a897') '814c6a121b392f512ec4c8898dd9f6c50ae3ff9d946bc1d115135fa6f5c6a897')
prepare() { prepare() {
cd ${srcdir} cd ${srcdir}
patch -p1 < fix.patch patch -p1 < tuxedo.patch
patch -p1 < drop-flags.patch patch -p1 < drop-flags.patch
} }
@@ -28,7 +28,7 @@ package() {
install -Dm644 ${srcdir}/src/*.c ${pkgdir}/usr/src/${_pkgbase}-${pkgver}/ install -Dm644 ${srcdir}/src/*.c ${pkgdir}/usr/src/${_pkgbase}-${pkgver}/
install -Dm644 ${srcdir}/src/*.h ${pkgdir}/usr/src/${_pkgbase}-${pkgver}/ install -Dm644 ${srcdir}/src/*.h ${pkgdir}/usr/src/${_pkgbase}-${pkgver}/
install -Dm644 ${srcdir}/src/Makefile ${pkgdir}/usr/src/${_pkgbase}-${pkgver}/ install -Dm644 ${srcdir}/src/Kbuild ${pkgdir}/usr/src/${_pkgbase}-${pkgver}/
install -Dm644 ${srcdir}/src/dkms.conf ${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}/ install -Dm644 ${srcdir}/src/motorcomm ${pkgdir}/usr/src/${_pkgbase}-${pkgver}/
} }
-49
View File
@@ -1,49 +0,0 @@
--- 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 2025-04-28 13:51:16.000000000 +0800
+++ b/src/fuxi-gmac-phy.c 2025-08-14 23:18:43.972276438 +0800
@@ -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");
}
+143
View File
@@ -0,0 +1,143 @@
--- 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