From d57e50ab464fe53174eb97e2de2339ed6491c736 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Fri, 29 Apr 2022 18:20:53 +0800 Subject: [PATCH 01/48] x86: use vendor driver of r8152 for better compatibility Signed-off-by: Tianling Shen (cherry picked from commit b3e29a647845180a481e5097bbf8aecf9e3337f2) --- target/linux/x86/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/x86/Makefile b/target/linux/x86/Makefile index f08156e40a..f9d7486959 100644 --- a/target/linux/x86/Makefile +++ b/target/linux/x86/Makefile @@ -25,7 +25,7 @@ DEFAULT_PACKAGES += partx-utils mkf2fs fdisk e2fsprogs kmod-usb-hid kmod-rt2800- autocore-x86 kmod-sound-hda-core kmod-sound-hda-codec-realtek kmod-sound-hda-codec-via \ kmod-sound-via82xx kmod-sound-hda-intel kmod-sound-hda-codec-hdmi kmod-sound-i8x0 \ kmod-usb-audio kmod-usb-net kmod-usb-net-asix kmod-usb-net-asix-ax88179 kmod-usb-net-rtl8150 \ - kmod-usb-net-rtl8152 kmod-mlx4-core kmod-mlx5-core automount + kmod-usb-net-rtl8152-vendor kmod-mlx4-core kmod-mlx5-core automount $(eval $(call BuildTarget)) From e4fdf8e43eb0e0110fddfb8b70248cd56d523c66 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Tue, 3 May 2022 18:45:57 +0800 Subject: [PATCH 02/48] iucode-tool: fix build Signed-off-by: Tianling Shen (cherry picked from commit 4b39ebcebb6cceeefdc1fff75e7540c0703247fd) --- package/system/iucode-tool/patches/100_headers.patch | 10 ++++++++++ ...puid-compatibility-header-to-build-on-non-x86.patch | 6 +----- 2 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 package/system/iucode-tool/patches/100_headers.patch diff --git a/package/system/iucode-tool/patches/100_headers.patch b/package/system/iucode-tool/patches/100_headers.patch new file mode 100644 index 0000000000..4eb77e7cd9 --- /dev/null +++ b/package/system/iucode-tool/patches/100_headers.patch @@ -0,0 +1,10 @@ +--- a/iucode_tool.c ++++ b/iucode_tool.c +@@ -24,6 +24,7 @@ + #include + #include + #include ++#include + #include + #include + #include diff --git a/package/system/iucode-tool/patches/200_add-cpuid-compatibility-header-to-build-on-non-x86.patch b/package/system/iucode-tool/patches/200_add-cpuid-compatibility-header-to-build-on-non-x86.patch index 900f3596f8..6b340bb391 100644 --- a/package/system/iucode-tool/patches/200_add-cpuid-compatibility-header-to-build-on-non-x86.patch +++ b/package/system/iucode-tool/patches/200_add-cpuid-compatibility-header-to-build-on-non-x86.patch @@ -11,7 +11,7 @@ Signed-off-by: Sergey V. Lobanov --- /dev/null +++ b/cpuid-compat/cpuid.h -@@ -0,0 +1,17 @@ +@@ -0,0 +1,13 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * cpuid compatibility header to build iucode-tool on non-x86 hosts @@ -19,10 +19,6 @@ Signed-off-by: Sergey V. Lobanov + * Copyright (C) 2022 Sergey V. Lobanov + */ + -+#ifdef __APPLE__ -+# include -+#endif -+ +static __inline int __get_cpuid (unsigned int leaf, + unsigned int *eax, unsigned int *ebx, + unsigned int *ecx, unsigned int *edx) From d202ea41de7d99ebd658cfcd489eded9f79b325a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kerma=20G=C3=A9rald?= Date: Fri, 29 Apr 2022 00:08:09 +0200 Subject: [PATCH 03/48] f2fs-tools: fix resize.f2fs (#9800) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit resolve issue - https://github.com/openwrt/openwrt/issues/9800 add the upstream patch: - f2fs-tools.git/patch/?id=f056fbeff08d30a6d9acdb9e06704461ceee3500 Signed-off-by: Kerma Gérald (cherry picked from commit 1aac1b36d3cf44c8bfa8d4a6d8df6e815fc06529) --- package/utils/f2fs-tools/Makefile | 2 +- ...esize_f2fs-fix_wrong_ovp_calculation.patch | 46 +++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 package/utils/f2fs-tools/patches/200-resize_f2fs-fix_wrong_ovp_calculation.patch diff --git a/package/utils/f2fs-tools/Makefile b/package/utils/f2fs-tools/Makefile index 44ab63c403..3c53f27d79 100644 --- a/package/utils/f2fs-tools/Makefile +++ b/package/utils/f2fs-tools/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=f2fs-tools PKG_VERSION:=1.14.0 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs-tools.git/snapshot/ diff --git a/package/utils/f2fs-tools/patches/200-resize_f2fs-fix_wrong_ovp_calculation.patch b/package/utils/f2fs-tools/patches/200-resize_f2fs-fix_wrong_ovp_calculation.patch new file mode 100644 index 0000000000..0b433f76c4 --- /dev/null +++ b/package/utils/f2fs-tools/patches/200-resize_f2fs-fix_wrong_ovp_calculation.patch @@ -0,0 +1,46 @@ +From f056fbeff08d30a6d9acdb9e06704461ceee3500 Mon Sep 17 00:00:00 2001 +From: Jaegeuk Kim +Date: Thu, 1 Apr 2021 20:13:55 -0700 +Subject: resize.f2fs: fix wrong ovp calculation + +beroal reported a mount failure due to broken valid_user_blocks. +[ 6890.647749] F2FS-fs (loop0): Wrong valid_user_blocks: 16040048, +user_block_count: 10016768 + +From fsck, + +segment_count_main [0x 9a95 : 39573] +-> 39573 * 2MB = 78GB as user space + +overprov_segment_count [0x 4e29 : 20009] +-> 20009 * 2MB = 40GB as overprovisioned space which user can't see. + +But, +[FSCK] valid_block_count matching with CP [Ok..] [0xf4c070] +-> 0xf4c070 = 16040048 + +valid_block_count [0x f4c070 : 16040048] +-> So, this is correct. + +It turns out resize.f2fs gave very large and wrong overprovisioning space +result in shortage of user blocks. The root cause was f2fs_get_usable_segments() +didn't consider resize case which needs segment_count_main from new superblock. + +Fixes: f8410857b7a8 ("f2fs-tools: zns zone-capacity support") +Signed-off-by: Jaegeuk Kim +--- + lib/libf2fs_zoned.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/lib/libf2fs_zoned.c ++++ b/lib/libf2fs_zoned.c +@@ -495,6 +495,9 @@ uint32_t f2fs_get_usable_segments(struct + int i, j; + uint32_t usable_segs = 0, zone_segs; + ++ if (c.func == RESIZE) ++ return get_sb(segment_count_main); ++ + for (i = 0; i < c.ndevs; i++) { + if (c.devices[i].zoned_model != F2FS_ZONED_HM) { + usable_segs += c.devices[i].total_segments; From f5c769bf9b4f266b052159a4cce31304d1b301ba Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Sun, 10 Apr 2022 09:00:59 +0200 Subject: [PATCH 04/48] mdadm: update to 4.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refreshed patches: - 100-cross_compile.patch Manually refreshed patches: - 200-reduce_size.patch Removed patches: - 101-mdadm.h-Undefine-dprintf-before-redefining.patch - 102-Add-missing-include-file-sys-sysmacros.h.patch Changes: e30ca260 Release mdadm-4.2 8c80d305 Monitor: print message before quit for no array to monitor ced5fa8b mdadm: block creation with long names b71de056 Correct checking if file descriptors are valid b2e4f084 Incremental: Close unclosed mdfd in IncrementalScan() 195d1d76 imsm: assert if there is migration but prev_map doesn't exist 75f3ba25 imsm: free allocated memory in imsm_fix_size_mismatch bce0eab3 Release mdadm-4.2-rc3 4389ce73 imsm: introduce helpers to manage file descriptors 8e1a258e mdadm/Detail: Can't show container name correctly when unpluging disks a35aa68f mdadm/lib: Define a new helper function is_dev_alived 1c66260d Fix 2 dc stream buffer d64a37b9 Assemble: apply sysfs rules 5f6dedfb Fix potential overlap dest buffer a0422106 disallow create or grow clustered bitmap with writemostly set cf16a350 Fix buffer size warning for strcpy 60815698 Refactor parse_num and use it to parse optarg. f7889e51 Fix error message when creating raid 4, 5 and 10 54604768 mdadm: fix coredump of mdadm --monitor -r feeb2785 Utils: Change sprintf to snprintf b8bbf264 Release mdadm-4.2-rc2 e6878148 Assemble: skip devices that don't match uuid instead of aborting the assembly. 0663137c Add monitor delay parameter to mdadm.conf 2b2c5668 tests: Avoid passing chunk size when creating RAID 1 7d374a18 Fix memory leak after "mdadm --detail" 92a647c8 Assemble: start dirty and degraded array. 1c275381 imsm: fix num_data_stripes after raid0 takeover 5b30a34a Add error handling for chunk size in RAID1 3a85bf0e imsm: Fix possible memory leaks and refactor freeing struct dl ccd61ebf mdadm: Fix building errors 601ffa78 Don't associate spares with other arrays during RAID Examine 8d69bf14 Remove Spare drives line from details for external metadata 7d8935cb imsm: correct offset for 4k disks in --examine output dca80fcd Use dev_open in validate geometry container f421731c mdadm/super1: It needs to specify int32 for bitmap_offset 1f5d54a0 Manage: Call validate_geometry when adding drive to external container 8662f92d imsm: Limit support to the lowest namespace fcebeb77 imsm: add devpath_to_char method 7c798f87 imsm: add generic method to resolve "device" links 0530e2e0 Prevent user from using --stop with ambiguous args 83b3de77 Fix some building errors ff904202 imsm: change wrong size verification c11b1c3c Release mdadm-4.2-rc1 aec01630 super-intel.c: Handle errors from calls to get_dev_sector_size() 78c93b00 mdadm: fix growing containers af3396da Monitor: make libudev dependency optional f94df5cf imsm: support for third Sata controller d835518b imsm: nvme multipath support 4036e7ee imsm: extend curr_migr_unit to u64 bdbe7f81 Grow: Block reshape when external metadata and write-intent bitmap 848d71c9 Create: Block automatic enabling bitmap for external metadata 19ad203e imsm: Update-subarray for write-intent bitmap dc95f821 Add "bitmap" to allowed command-line values 69d40de4 imsm: Adding a spare to an existing array with bitmap fbc42556 imsm: Write-intent bitmap support b554ab5c Enable bitmap support for external metadata b090e910 Modify mdstat parsing for volumes with the bitmap db537788 It should be FAILED when raid has not enough active disks c7b8547c imsm: add verbose flag to compare_super 49b69533 mdmonitor: check if udev has finished events processing 0d583954 Document PPL in man md 2f86fda3 imsm: use saved fds during migration f7a6246b super1.c: avoid useless sync when bitmap switches from clustered to none e6561c4d super1: fix Floating point exception 8818d4e7 Grow: be careful of corrupt dev_roles list 4ae96c80 mdadm: fix reshape from RAID5 to RAID6 with backup file 1fe2e100 mdadm/bitmap: locate bitmap calcuate bitmap position wrongly 75562b57 Dump: get stat from a wrong metadata file when restoring metadata 69068584 Incremental: Remove redundant spare movement logic a64f1263 udev: start grow service automatically b4a5ad49 Make target to install binaries only 9c030dad mdadm/Detail: show correct state for clustered array ff6bb131 mdadm: Unify forks behaviour a8f3cfd5 imsm: limit support to first NVMe namespace ca4b156b Monitor: don't use default modes when creating a file b65c1f4a imsm: remove redundant calls to imsm_get_map 895ffd99 imsm: update num_data_stripes according to dev_size ce559078 Create.c: close mdfd and generate uevent c3129b39 Detail: fix segfault during IMSM raid creation 97b51a2c Super1: allow RAID0 layout setting to be removed. 7f3b2d1d Check if other Monitor instance running before fork. cab9c67d mdmonitor: set small delay once 007087d0 Monitor: stop notifing about containers. e2308733 Monitor: refresh mdstat fd after select 2ce09172 Don't create bitmap for raid5 with journal disk 64bf4dff Detail: show correct raid level when the array is inactive 5f418455 manual: update --examine-badblocks 5e592e1e mdadm/md.4: update path to in-kernel-tree documentation 138a9e9b Specify nodes number when updating cluster nodes 77b72fa8 mdadm/Grow: prevent md's fd from being occupied during delayed time bcf40dbb Update link to Intel page for IMSM 8e41153c Use more secure HTTPS URLs 2cf04330 Detect too-small device: error rather than underflow/crash 7758ada9 Block overwriting existing links while manual assembly d92cee7b restripe: fix ignoring return value of ‘read’ and lseek 7d90f760 Include count for \0 character when using strncpy to implement strdup. f4c8a605 uuid.c: split uuid stuffs from util.c 03ab9763 Makefile: add EXTRAVERSION support 3b7aae92 mdcheck: Log when done 7b99edab Assemble.c: respect force flag. ec7d7cee clean up meaning of small typo 5cfb79de Assemble: print error message if mdadm fails assembling with --uuid option 12724c01 Manage, imsm: Write metadata before add 1c294b5d Detail: adding sync status for cluster device 185ec439 Monitor: improve check_one_sharer() for checking duplicated process e1b92ee0 udev: Ignore change event for imsm ba1b3bc8 imsm: show Subarray and Volume ID in --examine output e48aed3c imsm: support the Array Creation Time field in metadata 9e449405 Detail: show correct bitmap info for cluster raid device 06a6101c imsm: Correct minimal device size. 45c43276 imsm: Remove --dump/--restore implementation 3364781b imsm: pass subarray id to kill_subarray function fd38b8ea Remove the legacy whitespace 2551061c mdadm.8: add note information for raid0 growing operation 1e93d0d1 imsm: fill working_disks according to metadata. 42e641ab Add support for Tebibytes 4431efeb imsm: Update grow manual. e1512e7b mdcheck service can't start succesfully because of syntax error 1a874930 Change warning message aced6fc9 Respect $(CROSS_COMPILE) when $(CC) is the default 027c099f Assemble: add support for RAID0 layouts. 329dfc28 Create: add support for RAID0 layouts. 6da53c0e imsm: Change the way of printing nvme drives in detail-platform. b771faef imsm: return correct uuid for volume in detail 4b31846f Remove unused code 9cf361f8 Fix up a few formatting issues 02af3793 Remove last traces of HOT_ADD_DISK 1cc3965d Manage: Remove the legacy code for md driver prior to 0.90.03 761e3bd9 super-intel: don't mark structs 'packed' unnecessarily 85b83a79 SUSE-mdadm_env.sh: handle MDADM_CHECK_DURATION 4ca799c5 mdcheck: use ${} to pass variable to mdcheck 6636788a mdcheck: when mdcheck_start is enabled, enable mdcheck_continue too. 1a1ced1e imsm: allow to specify second volume size b6180160 imsm: save current_vol number 7bd59e79 udev: allow for udev attribute reading bug. 61109314 Don't need to check recovery after re-add when no I/O writes to raid 8063fd0f Init devlist as an array e53cb968 mdadm/md.4: add the descriptions for bitmap sysfs nodes 2c2d9c48 mdadm: force a uuid swap on big endian 43ebc910 mdadm: Introduce new array state 'broken' for raid0/linear fd5b09c9 mdadm: check value returned by snprintf against errors 91c97c54 imsm: close removed drive fd. 1a52f1fc udev: add --no-devices option for calling 'mdadm --detail' d11abe4b mdadm: add --no-devices to avoid component devices detail information 452dc4d1 mdadm.h: include sysmacros.h unconditionally b0681598 mdadm: load default sysfs attributes after assemblation 486720e0 super-intel: Use put_unaligned in split_ull 7039d1f8 mdadm.h: Introduced unaligned {get,put}_unaligned{16,32}() a4f7290c super-intel: Fix issue with abs() being irrelevant 4ec389e3 Enable probe_roms to scan more than 6 roms. ae7d61e3 mdmon: fix wrong array state when disk fails during mdmon startup 3c9b46cf udev: Add udev rules to create by-partuuid for md device 22dc741f Create: Block rounding size to max 05501181 imsm: fix spare activation for old matrix arrays 227aeaa8 add missing units to --examine 2b57e4fe Assemble: Fix starting array with initial reshape checkpoint d2e11da4 mdmon: wait for previous mdmon to exit during takeover 69d08478 mdmon: don't attempt to manage new arrays when terminating 76b906d2 mdadm/tests: add one test case for failfast of raid1 cab114c5 Fix reshape for decreasing data offset e3615ecb Detail.c: do not skip first character when calling xstrdup in Detail() ebf3be99 Fix spelling typos. 9f421827 imsm: fix reshape for >2TB drives a4e96fd8 imsm: finish recovery when drive with rebuild fails 757e5543 policy.c: Fix for compiler error 467e6a1b policy.c: prevent NULL pointer referencing 76d505de Grow: report correct new chunk size. 085df422 Grow: avoid overflow in compute_backup_blocks() 563ac108 Assemble: mask FAILFAST and WRITEMOSTLY flags when finding the most recent device d7a1fda2 imsm: update metadata correctly while raid10 double degradation 7cd7e91a Monitor: add system timer to run --oneshot periodically 4199d3c6 mdcheck: add systemd unit files to run mdcheck. cd72f9d1 policy: support devices with multiple paths. 6b611284 Document PART-POLICY lines 0833f9c3 Assemble: keep MD_DISK_FAILFAST and MD_DISK_WRITEMOSTLY flag Signed-off-by: Nick Hainke (cherry picked from commit ab4eafbed974c6ead13b11a50b3032670c26540a) --- package/utils/mdadm/Makefile | 15 +++++--- .../mdadm/patches/100-cross_compile.patch | 2 +- ...h-Undefine-dprintf-before-redefining.patch | 38 ------------------- ...missing-include-file-sys-sysmacros.h.patch | 29 -------------- .../utils/mdadm/patches/200-reduce_size.patch | 20 +++++----- 5 files changed, 21 insertions(+), 83 deletions(-) delete mode 100644 package/utils/mdadm/patches/101-mdadm.h-Undefine-dprintf-before-redefining.patch delete mode 100644 package/utils/mdadm/patches/102-Add-missing-include-file-sys-sysmacros.h.patch diff --git a/package/utils/mdadm/Makefile b/package/utils/mdadm/Makefile index f6696bf21c..553728194e 100644 --- a/package/utils/mdadm/Makefile +++ b/package/utils/mdadm/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mdadm -PKG_VERSION:=4.1 -PKG_RELEASE:=2 +PKG_VERSION:=4.2 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/linux/utils/raid/mdadm -PKG_HASH:=ab7688842908d3583a704d491956f31324c3a5fc9f6a04653cb75d19f1934f4a +PKG_HASH:=461c215670864bb74a4d1a3620684aa2b2f8296dffa06743f26dda5557acf01d PKG_MAINTAINER:=Felix Fietkau PKG_CPE_ID:=cpe:/a:mdadm_project:mdadm @@ -48,11 +48,16 @@ TARGET_CFLAGS += \ -DCONFFILE='\"/var/etc/mdadm.conf\"' \ -DMAP_DIR='\"/var/run/mdadm\"' \ -DMDMON_DIR='\"/var/run/mdadm\"' \ - -DFAILED_SLOTS_DIR='\"/var/run/mdadm/failed-slots\"' + -DFAILED_SLOTS_DIR='\"/var/run/mdadm/failed-slots\"' \ + -DNO_LIBUDEV + +TARGET_CXFLAGS = -DNO_LIBUDEV TARGET_LDFLAGS += -Wl,--gc-sections -MAKE_FLAGS += CHECK_RUN_DIR=0 +MAKE_FLAGS += \ + CHECK_RUN_DIR=0 \ + CXFLAGS="$(TARGET_CXFLAGS)" define Build/Compile $(call Build/Compile/Default,mdadm) diff --git a/package/utils/mdadm/patches/100-cross_compile.patch b/package/utils/mdadm/patches/100-cross_compile.patch index 0a5fa017c6..790d7755b0 100644 --- a/package/utils/mdadm/patches/100-cross_compile.patch +++ b/package/utils/mdadm/patches/100-cross_compile.patch @@ -1,6 +1,6 @@ --- a/Makefile +++ b/Makefile -@@ -97,7 +97,7 @@ DLM:=$(shell [ -f /usr/include/libdlm.h +@@ -99,7 +99,7 @@ DLM:=$(shell [ -f /usr/include/libdlm.h DIRFLAGS = -DMAP_DIR=\"$(MAP_DIR)\" -DMAP_FILE=\"$(MAP_FILE)\" DIRFLAGS += -DMDMON_DIR=\"$(MDMON_DIR)\" DIRFLAGS += -DFAILED_SLOTS_DIR=\"$(FAILED_SLOTS_DIR)\" diff --git a/package/utils/mdadm/patches/101-mdadm.h-Undefine-dprintf-before-redefining.patch b/package/utils/mdadm/patches/101-mdadm.h-Undefine-dprintf-before-redefining.patch deleted file mode 100644 index 356d0deec8..0000000000 --- a/package/utils/mdadm/patches/101-mdadm.h-Undefine-dprintf-before-redefining.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 6d369e8f226594632ce4260129509daf7030de0a Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Mon, 9 May 2016 22:03:57 +0000 -Subject: [PATCH] mdadm.h: Undefine dprintf before redefining - -dprintf is also defined in libc see -usr/include/bits/stdio2.h, this comes into -play especially when fortify sources is enabled -and compilers like clang reports the override - -In file included from policy.c:25: -./mdadm.h:1562:9: error: 'dprintf' macro redefined [-Werror,-Wmacro-redefined] - ^ -/mnt/oe/openembedded-core/build/tmp-glibc/sysroots/qemux86/usr/include/bits/stdio2.h:145:12: note: previous definition is here - -Signed-off-by: Khem Raj ---- -Upstream-Status: Pending - - mdadm.h | 2 ++ - 1 file changed, 2 insertions(+) - ---- a/mdadm.h -+++ b/mdadm.h -@@ -1649,11 +1649,13 @@ static inline char *to_subarray(struct m - } - - #ifdef DEBUG -+#undef dprintf - #define dprintf(fmt, arg...) \ - fprintf(stderr, "%s: %s: "fmt, Name, __func__, ##arg) - #define dprintf_cont(fmt, arg...) \ - fprintf(stderr, fmt, ##arg) - #else -+#undef dprintf - #define dprintf(fmt, arg...) \ - ({ if (0) fprintf(stderr, "%s: %s: " fmt, Name, __func__, ##arg); 0; }) - #define dprintf_cont(fmt, arg...) \ diff --git a/package/utils/mdadm/patches/102-Add-missing-include-file-sys-sysmacros.h.patch b/package/utils/mdadm/patches/102-Add-missing-include-file-sys-sysmacros.h.patch deleted file mode 100644 index 891b5c62f0..0000000000 --- a/package/utils/mdadm/patches/102-Add-missing-include-file-sys-sysmacros.h.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 452dc4d13a012cdcb05088c0dbc699959c4d6c73 Mon Sep 17 00:00:00 2001 -From: Baruch Siach -Date: Tue, 6 Aug 2019 16:05:23 +0300 -Subject: mdadm.h: include sysmacros.h unconditionally - -musl libc now also requires sys/sysmacros.h for the major/minor macros. -All supported libc implementations carry sys/sysmacros.h, including -diet-libc, klibc, and uclibc-ng. - -Cc: Hauke Mehrtens -Signed-off-by: Baruch Siach -Signed-off-by: Jes Sorensen ---- - mdadm.h | 2 -- - 1 file changed, 2 deletions(-) - ---- a/mdadm.h -+++ b/mdadm.h -@@ -45,10 +45,8 @@ extern __off64_t lseek64 __P ((int __fd, - #include - #include - #include --#ifdef __GLIBC__ - /* Newer glibc requires sys/sysmacros.h directly for makedev() */ - #include --#endif - #ifdef __dietlibc__ - #include - /* dietlibc has deprecated random and srandom!! */ diff --git a/package/utils/mdadm/patches/200-reduce_size.patch b/package/utils/mdadm/patches/200-reduce_size.patch index 6905c2ccfe..163e125c22 100644 --- a/package/utils/mdadm/patches/200-reduce_size.patch +++ b/package/utils/mdadm/patches/200-reduce_size.patch @@ -1,19 +1,19 @@ --- a/Incremental.c +++ b/Incremental.c -@@ -1619,6 +1619,10 @@ static int Incremental_container(struct - if (ra_all == ra_blocked) - return 0; +@@ -983,6 +983,10 @@ static int array_try_spare(char *devname + goto next; + } -+#ifndef MDADM_FULL -+ return 0; -+#endif ++ #ifndef MDADM_FULL ++ return 0; ++ #endif + - /* Now move all suitable spares from spare container */ - domains = domain_from_array(list, st->ss->name); - memcpy(suuid, uuid_zero, sizeof(int[4])); + dl = domain_from_array(sra, st2->ss->name); + if (domain_test(dl, pol, st2->ss->name) != 1) { + /* domain test fails */ --- a/util.c +++ b/util.c -@@ -1220,7 +1220,9 @@ void wait_for(char *dev, int fd) +@@ -1147,7 +1147,9 @@ void wait_for(char *dev, int fd) struct superswitch *superlist[] = { &super0, &super1, From bb058fa5074c0ed6bb4241a5502c8a9c3bbaa3ca Mon Sep 17 00:00:00 2001 From: Dominick Grift Date: Sun, 1 May 2022 19:54:04 +0200 Subject: [PATCH 05/48] base-files: address sed in-place without SELinux awareness sed(1) in busybox does not support this functionality: https://git.savannah.gnu.org/cgit/sed.git/tree/sed/execute.c#n598 This causes /etc/group to become mislabeled when a package requests that a uid/gid be added on OpenWrt with SELinux Signed-off-by: Daniel Golle [move restorecon inside lock] Signed-off-by: Dominick Grift (cherry picked from commit 5109bd164c8f2273329483f990188fb36cf3ad68) --- package/base-files/files/lib/functions.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/package/base-files/files/lib/functions.sh b/package/base-files/files/lib/functions.sh index 56fe8800f7..b53e23995f 100644 --- a/package/base-files/files/lib/functions.sh +++ b/package/base-files/files/lib/functions.sh @@ -340,6 +340,7 @@ group_add_user() { [ -n "$(echo $grp | grep ":$")" ] && delim="" [ -n "$IPKG_INSTROOT" ] || lock /var/lock/passwd sed -i "s/$grp/$grp$delim$2/g" ${IPKG_INSTROOT}/etc/group + selinuxenabled 2>/dev/null && restorecon /etc/group [ -n "$IPKG_INSTROOT" ] || lock -u /var/lock/passwd } From c17b66ca94e544626eb3155aee6222d9bccf8c31 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Mon, 2 May 2022 19:58:56 +0100 Subject: [PATCH 06/48] base-files: add missing $IPKG_INSTROOT to restorecon call Update to overlooked v2 version of Dominick Grift's patch. Fixes: 5109bd164c ("base-files: address sed in-place without SELinux awareness") Signed-off-by: Daniel Golle (cherry picked from commit 6d7272852e0b2634b2fa93a131ea8659ec87f079) --- package/base-files/files/lib/functions.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/package/base-files/files/lib/functions.sh b/package/base-files/files/lib/functions.sh index b53e23995f..b5db77e9f6 100644 --- a/package/base-files/files/lib/functions.sh +++ b/package/base-files/files/lib/functions.sh @@ -340,7 +340,9 @@ group_add_user() { [ -n "$(echo $grp | grep ":$")" ] && delim="" [ -n "$IPKG_INSTROOT" ] || lock /var/lock/passwd sed -i "s/$grp/$grp$delim$2/g" ${IPKG_INSTROOT}/etc/group - selinuxenabled 2>/dev/null && restorecon /etc/group + if [ -x /usr/sbin/selinuxenabled ] && selinuxenabled; then + selinuxenabled 2>/dev/null && restorecon ${IPKG_INSTROOT}/etc/group + fi [ -n "$IPKG_INSTROOT" ] || lock -u /var/lock/passwd } From 3d8aaec85007bb41da482f93cd6edd01b5616698 Mon Sep 17 00:00:00 2001 From: Dominick Grift Date: Sat, 16 Apr 2022 15:10:39 +0200 Subject: [PATCH 07/48] selinux-policy: update to version 1.1 try to clean up some labeling inconsistencies iwinfo loose ends ucode loose ends Makefile: adjust mintesttgt (adds blockmount/blockd) nftables: reads inherited netifd pipe ucode: reads inherited netifd pipes mountroot: fowner sandbox: writes inherited dropbear pipes unbound related to /tmp/etc/ssl unbound loose ends adds a sslconftmpfile for /tmp/etc/ssl README: maintain a wish list in the README iwinfo: netifd forgot write gptfdisk loose ends iwinfo: netifd wpad reads/writes inherited netifd fifo files netifd (mac80211.sh) executes iwinfo luci: executes wireguard luci-cgi: audits xtables execute access rcuhttpd: lists ssl certfile dirs iwinfo, wifi,nftables usage of ttyd pty if available urandomseed: seedrng needs cap_sys_admin iwinfo iwinfo, nftables and some chronyd rules related to ntp nts server nftables, wifi and adds iwinfo skel nftables, rpcd, ucode nftables, ucode and seedrng ucode, fw3/nftables, luci adds ucode skel and some fw3/nftables related urandomseed: some seedrng rules fw3 adds some support for fw4 urandomseed: /etc/seedrng is for seed.credit hotplugcal: runs ucode which is interpreter like adds a nftables skeleton and makes xtables optional agent: allow all agents to write inherited dropbear pipes urandomseed: this seems to be replaced by seedrng kmodloader: label /etc/modules.conf kmodloader.conffile Revert "shelexecfile: remove auditallow rule" Makefile: sort the modules to process by secilc Moves back to git.defensec.nl unbound odhcpd (ip) reads net proc tcp dump shelexecfile: remove auditallow rule rrd.cil: fixes indent Target rddtool from cgi-io instead of runnit it without transition rrd.cil related rrd, rpcd, cgiio clean ups related to luci-app-statistics Rules for rrd files and luci-statistics unboundcontrol ordering Several missing permissions blockmount, dnsmasq, hotplugcall, rpcd, unbound adds mctp_socket (linux 5.15) ip: forgot tc-tiny type transition to go along with the fc spec ip: adds a fc spec for tc-tiny (called by sqm) adds ttyACM fc spec and various assorted loose ends .gitattributes: do not export the github workflows workflow use selinux 3.3 project moved back to https://git.defensec.nl/selinux-policy.git Signed-off-by: Dominick Grift (cherry picked from commit 43794570986e33770d9039399d16a665f6c7c495) --- package/system/selinux-policy/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/system/selinux-policy/Makefile b/package/system/selinux-policy/Makefile index 0b85920170..10eff7be57 100644 --- a/package/system/selinux-policy/Makefile +++ b/package/system/selinux-policy/Makefile @@ -7,9 +7,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:=selinux-policy PKG_SOURCE_PROTO:=git -PKG_SOURCE_URL:=https://github.com/DefenSec/selinux-policy -PKG_VERSION:=1.0 -PKG_MIRROR_HASH:=2358a064d1231d39e6292d646e1a38898d949b8bef6558ac1e0992d3b5bca33f +PKG_SOURCE_URL:=https://git.defensec.nl/selinux-policy.git +PKG_VERSION:=1.1 +PKG_MIRROR_HASH:=657ec1ff51ab946753fb3559384511a536ac1e018691f3e49cbab21c55d23e08 PKG_SOURCE_VERSION:=v$(PKG_VERSION) PKG_BUILD_DEPENDS:=secilc/host policycoreutils/host From bdabc092d3ace491c8dbd3d8ab121793ec6f482c Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Mon, 2 May 2022 21:07:16 +0100 Subject: [PATCH 08/48] base-files: simplify restorecon logic Remove forgotten redundant selinuxenabled call and skip the whole thing in case $IPKG_INSTROOT is set as labels are anyway applied only later on in fakeroot when squashfs is created. Fixes: 6d7272852e ("base-files: add missing $IPKG_INSTROOT to restorecon call") Signed-off-by: Daniel Golle (cherry picked from commit 7b07c3cff57f057d6780d34adeb23c06123732db) --- package/base-files/files/lib/functions.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/base-files/files/lib/functions.sh b/package/base-files/files/lib/functions.sh index b5db77e9f6..1edb5d6f44 100644 --- a/package/base-files/files/lib/functions.sh +++ b/package/base-files/files/lib/functions.sh @@ -340,8 +340,8 @@ group_add_user() { [ -n "$(echo $grp | grep ":$")" ] && delim="" [ -n "$IPKG_INSTROOT" ] || lock /var/lock/passwd sed -i "s/$grp/$grp$delim$2/g" ${IPKG_INSTROOT}/etc/group - if [ -x /usr/sbin/selinuxenabled ] && selinuxenabled; then - selinuxenabled 2>/dev/null && restorecon ${IPKG_INSTROOT}/etc/group + if [ -z "$IPKG_INSTROOT" ] && [ -x /usr/sbin/selinuxenabled ] && selinuxenabled; then + restorecon /etc/group fi [ -n "$IPKG_INSTROOT" ] || lock -u /var/lock/passwd } From e8f4cf7cff18263a61368dd31ae19956327ad8d2 Mon Sep 17 00:00:00 2001 From: ZiMing Mo Date: Wed, 4 May 2022 17:20:06 +0800 Subject: [PATCH 09/48] r8168: bump to 8.050.00 Signed-off-by: ZiMing Mo (cherry picked from commit 662ff61b56101dbe3e7f8c4654cd4b8439d14120) --- package/kernel/r8168/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/kernel/r8168/Makefile b/package/kernel/r8168/Makefile index 15316c0b21..a68b74e225 100644 --- a/package/kernel/r8168/Makefile +++ b/package/kernel/r8168/Makefile @@ -7,14 +7,14 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=r8168 -PKG_VERSION:=8.049.02 +PKG_VERSION:=8.050.00 PKG_RELEASE:=$(AUTORELEAE) PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://github.com/BROBIRD/openwrt-r8168.git -PKG_SOURCE_DATE:=2021-10-08 -PKG_SOURCE_VERSION:=2b969c15afe403a685fc7ee069620782241e3ad6 -PKG_MIRROR_HASH:=e4632c10d460f005eff76da8a183d7ff0c8819b0d099872589b7b06a9b8d9952 +PKG_SOURCE_DATE:=2022-05-03 +PKG_SOURCE_VERSION:=1c18465e76ed6872f001d08e2fe0c139fc80ef7e +PKG_MIRROR_HASH:=5ca8242bd209079a5abac608a865f86e727cc8de15a460d7d78e611d0c443f15 PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) From db825d3f3882bc48451f9dc4ba69d46f166247f6 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Mon, 2 May 2022 16:32:48 +0800 Subject: [PATCH 10/48] x86: drop duplicate sets Signed-off-by: Tianling Shen (cherry picked from commit 7014ff8199b296917c4957da37999db6adec58a6) --- target/linux/x86/image/64.mk | 4 ++-- target/linux/x86/image/generic.mk | 4 ++-- target/linux/x86/image/legacy.mk | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/target/linux/x86/image/64.mk b/target/linux/x86/image/64.mk index 9c9decbf79..d751447d84 100644 --- a/target/linux/x86/image/64.mk +++ b/target/linux/x86/image/64.mk @@ -1,7 +1,7 @@ define Device/generic DEVICE_TITLE := Generic x86/64 - DEVICE_PACKAGES += kmod-amazon-ena kmod-bnx2 kmod-e1000e kmod-e1000 \ - kmod-forcedeth kmod-igb kmod-ixgbe kmod-amd-xgbe kmod-r8169 + DEVICE_PACKAGES += kmod-amazon-ena kmod-bnx2 kmod-e1000 \ + kmod-forcedeth kmod-amd-xgbe GRUB2_VARIANT := generic endef TARGET_DEVICES += generic diff --git a/target/linux/x86/image/generic.mk b/target/linux/x86/image/generic.mk index 8a23afef0a..ad19882a25 100644 --- a/target/linux/x86/image/generic.mk +++ b/target/linux/x86/image/generic.mk @@ -1,7 +1,7 @@ define Device/generic DEVICE_TITLE := Generic x86 - DEVICE_PACKAGES += kmod-3c59x kmod-8139too kmod-e100 kmod-e1000 kmod-natsemi \ - kmod-ne2k-pci kmod-pcnet32 kmod-r8169 kmod-sis900 kmod-tg3 \ + DEVICE_PACKAGES += kmod-3c59x kmod-e100 kmod-e1000 kmod-natsemi \ + kmod-ne2k-pci kmod-pcnet32 kmod-sis900 kmod-tg3 \ kmod-via-rhine kmod-via-velocity kmod-forcedeth GRUB2_VARIANT := generic endef diff --git a/target/linux/x86/image/legacy.mk b/target/linux/x86/image/legacy.mk index 5c13f95157..7610acba76 100644 --- a/target/linux/x86/image/legacy.mk +++ b/target/linux/x86/image/legacy.mk @@ -1,7 +1,7 @@ define Device/generic DEVICE_TITLE := Generic x86/legacy - DEVICE_PACKAGES += kmod-3c59x kmod-8139too kmod-e100 kmod-e1000 \ - kmod-natsemi kmod-ne2k-pci kmod-pcnet32 kmod-r8169 kmod-sis900 \ + DEVICE_PACKAGES += kmod-3c59x kmod-e100 kmod-e1000 \ + kmod-natsemi kmod-ne2k-pci kmod-pcnet32 kmod-sis900 \ kmod-tg3 kmod-via-rhine kmod-via-velocity kmod-forcedeth GRUB2_VARIANT := legacy endef From 3ded6f27adb06ff6b457775b53055c2ea7a08367 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Fri, 6 May 2022 22:10:58 +0800 Subject: [PATCH 11/48] scripts/download.pl: drop broken mirror Signed-off-by: Tianling Shen (cherry picked from commit 02edeb14690c14bd7021b4be2270286bb4bb9108) --- scripts/download.pl | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/download.pl b/scripts/download.pl index ddb41290d0..d5c1e96763 100755 --- a/scripts/download.pl +++ b/scripts/download.pl @@ -288,7 +288,6 @@ foreach my $mirror (@ARGV) { } # push @mirrors, 'https://mirror01.download.immortalwrt.eu.org'; -# push @mirrors, 'https://mirror02.download.immortalwrt.eu.org'; push @mirrors, 'https://mirror2.immortalwrt.org/sources'; push @mirrors, 'https://mirror.immortalwrt.org/sources'; push @mirrors, 'https://sources.immortalwrt.org'; From dfe1cb5d4cd1d065583bd3ba05e69b691e432a54 Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Tue, 5 Apr 2022 15:26:24 +0200 Subject: [PATCH 12/48] libnfnetlink: update to 1.0.2 Changes: c63f193 bump version to 1.0.2 3cffa84 libnfnetlink: Check getsockname() return code 90ba679 include: Silence gcc warning in linux_list.h bb4f6c8 Make it clear that this library is deprecated e46569c Minimally resurrect doxygen documentation 5087de4 libnfnetlink: hide private symbols 62ca426 autogen: don't convert __u16 to u_int16_t efa1d8e src: Use stdint types everywhere 7a1a07c include: Sync with kernel headers 7633f0c libnfnetlink: initialize attribute padding to resolve valgrind warnings 94b68f3 configure: uclinux is also linux 617fe82 src: get source code license header in sync with current licensing terms 97a3960 build: resolve automake-1.12 warnings Removed the patch 100-missing_include.patch, libnfnetlink compiles fine with musl without this patch. Signed-off-by: Nick Hainke --- package/libs/libnfnetlink/Makefile | 6 +++--- .../patches/100-missing_include.patch | 20 ------------------- 2 files changed, 3 insertions(+), 23 deletions(-) delete mode 100644 package/libs/libnfnetlink/patches/100-missing_include.patch diff --git a/package/libs/libnfnetlink/Makefile b/package/libs/libnfnetlink/Makefile index bc64ff111d..57bb0cdb98 100644 --- a/package/libs/libnfnetlink/Makefile +++ b/package/libs/libnfnetlink/Makefile @@ -8,14 +8,14 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libnfnetlink -PKG_VERSION:=1.0.1 -PKG_RELEASE:=4 +PKG_VERSION:=1.0.2 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:= \ http://www.netfilter.org/projects/libnfnetlink/files/ \ ftp://ftp.netfilter.org/pub/libnfnetlink/ -PKG_HASH:=f270e19de9127642d2a11589ef2ec97ef90a649a74f56cf9a96306b04817b51a +PKG_HASH:=b064c7c3d426efb4786e60a8e6859b82ee2f2c5e49ffeea640cfe4fe33cbc376 PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=GPL-2.0+ diff --git a/package/libs/libnfnetlink/patches/100-missing_include.patch b/package/libs/libnfnetlink/patches/100-missing_include.patch deleted file mode 100644 index 163307d895..0000000000 --- a/package/libs/libnfnetlink/patches/100-missing_include.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/include/libnfnetlink/libnfnetlink.h -+++ b/include/libnfnetlink/libnfnetlink.h -@@ -15,6 +15,7 @@ - #define aligned_u64 unsigned long long __attribute__((aligned(8))) - #endif - -+#include - #include /* for sa_family_t */ - #include - #include ---- a/include/libnfnetlink/linux_nfnetlink.h -+++ b/include/libnfnetlink/linux_nfnetlink.h -@@ -1,6 +1,6 @@ - #ifndef _NFNETLINK_H - #define _NFNETLINK_H --#include -+#include - #include - - enum nfnetlink_groups { From 9753e37e236c48e8f79dd8094eb0cf233a8fa909 Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Tue, 5 Apr 2022 15:01:43 +0200 Subject: [PATCH 13/48] libmnl: update to 1.0.5 Changes: Duncan Roe (5): nlmsg: Fix a missing doxygen section trailer build: doc: "make" builds & installs a full set of man pages build: doc: get rid of the need for manual updating of Makefile build: If doxygen is not available, be sure to report "doxygen: no" to ./configure src: doc: Fix messed-up Netlink message batch diagram Fernando Fernandez Mancera (1): src: fix doxygen function documentation Florian Westphal (1): libmnl: zero attribute padding Guillaume Nault (1): callback: mark cb_ctl_array 'const' in mnl_cb_run2() Kylie McClain (1): examples: nfct-daemon: Fix test building on musl libc Laura Garcia Liebana (4): examples: add arp cache dump example examples: fix neigh max attributes examples: fix print line format examples: reduce LOCs during neigh attributes validation Pablo Neira Ayuso (3): doxygen: remove EXPORT_SYMBOL from the output include: add MNL_SOCKET_DUMP_SIZE definition build: libmnl 1.0.5 release Petr Vorel (1): examples: Add rtnl-addr-add.c Stephen Hemminger (1): examples: rtnl-addr-dump: fix typo igo95862 (1): doxygen: Fixed link to the git source tree on the website. Signed-off-by: Nick Hainke --- package/libs/libmnl/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/libs/libmnl/Makefile b/package/libs/libmnl/Makefile index 13628728e6..2632cc2d94 100644 --- a/package/libs/libmnl/Makefile +++ b/package/libs/libmnl/Makefile @@ -8,14 +8,14 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libmnl -PKG_VERSION:=1.0.4 -PKG_RELEASE:=2 +PKG_VERSION:=1.0.5 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:= \ http://www.netfilter.org/projects/libmnl/files \ ftp://ftp.netfilter.org/pub/libmnl -PKG_HASH:=171f89699f286a5854b72b91d06e8f8e3683064c5901fb09d954a9ab6f551f81 +PKG_HASH:=274b9b919ef3152bfb3da3a13c950dd60d6e2bcd54230ffeca298d03b40d0525 PKG_MAINTAINER:=Jo-Philipp Wich From 29d359d1c46822408c3b25986e1203e007bd9d48 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Fri, 15 Apr 2022 01:15:26 +0100 Subject: [PATCH 14/48] mtools: update to version 4.0.39 Improvements since the 4.0.38 release are: - Rename strtoi to strosi (string to signed int). The strtoi function on BSD does something else (returns an intmax, not an int) Signed-off-by: Daniel Golle --- tools/mtools/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/mtools/Makefile b/tools/mtools/Makefile index 90a4119af4..db364c9c93 100644 --- a/tools/mtools/Makefile +++ b/tools/mtools/Makefile @@ -7,11 +7,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mtools -PKG_VERSION:=4.0.38 +PKG_VERSION:=4.0.39 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=@GNU/$(PKG_NAME) -PKG_HASH:=7b94485f486e7df08cca68b00a164a13cd38f4c63cb8684d188759ee7bc5e729 +PKG_HASH:=397f1e2b7b7a2a270eb7970fa363e445f956926ec51e8170c3869da85b0987bd HOST_BUILD_PARALLEL:=1 From 5422b6537ccb4e514a78ca43bfdac9e19b0f3922 Mon Sep 17 00:00:00 2001 From: Eneas U de Queiroz Date: Thu, 31 Mar 2022 10:38:49 -0300 Subject: [PATCH 15/48] mediatek: remove crypto-hw-mtk package The MediaTek's Crypto Engine module is only available for mt7623, in which case it is built into the kernel. Signed-off-by: Eneas U de Queiroz --- target/linux/mediatek/modules.mk | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/target/linux/mediatek/modules.mk b/target/linux/mediatek/modules.mk index 7f8c038cae..f9e38b6e4c 100644 --- a/target/linux/mediatek/modules.mk +++ b/target/linux/mediatek/modules.mk @@ -26,26 +26,3 @@ define KernelPackage/sdhci-mtk endef $(eval $(call KernelPackage,sdhci-mtk)) - -define KernelPackage/crypto-hw-mtk - TITLE:= MediaTek's Crypto Engine module - DEPENDS:=@TARGET_mediatek - KCONFIG:= \ - CONFIG_CRYPTO_HW=y \ - CONFIG_CRYPTO_AES=y \ - CONFIG_CRYPTO_AEAD=y \ - CONFIG_CRYPTO_SHA1=y \ - CONFIG_CRYPTO_SHA256=y \ - CONFIG_CRYPTO_SHA512=y \ - CONFIG_CRYPTO_HMAC=y \ - CONFIG_CRYPTO_DEV_MEDIATEK - FILES:=$(LINUX_DIR)/drivers/crypto/mediatek/mtk-crypto.ko - AUTOLOAD:=$(call AutoLoad,90,mtk-crypto) - $(call AddDepends/crypto) -endef - -define KernelPackage/crypto-hw-mtk/description - MediaTek's EIP97 Cryptographic Engine driver. -endef - -$(eval $(call KernelPackage,crypto-hw-mtk)) From 3aa44f2e96ab0a12b07bfc90ed72e3be29c551dd Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Sat, 29 Feb 2020 13:57:09 +0100 Subject: [PATCH 16/48] mvebu: fix build regression due to neon-asm ghash module This patch fixes the regression caused by adding the NEON variant of the ghash as the default ghash package package: > ERROR: module '[...]/arch/arm/crypto/ghash-arm-ce.ko' is missing. > modules/crypto.mk:286: recipe for target > '[...]/kmod-crypto-ghash_4.19.106-1_aarch64_cortex-a53.ipk' failed This patch limits the scope to the ARM32/cortexa9 target of mvebu. Fixes: 285df63efc70 ("kernel: build neon-asm version of ghash module") Signed-off-by: Christian Lamparter (cherry picked from commit 632a7b29972f0176fb621090e2bbab46a710a24c) --- package/kernel/linux/modules/crypto.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/kernel/linux/modules/crypto.mk b/package/kernel/linux/modules/crypto.mk index 6413827d91..74d8caa3d3 100644 --- a/package/kernel/linux/modules/crypto.mk +++ b/package/kernel/linux/modules/crypto.mk @@ -277,7 +277,7 @@ endef KernelPackage/crypto-ghash/imx6=$(KernelPackage/crypto-ghash/arm-ce) KernelPackage/crypto-ghash/ipq40xx=$(KernelPackage/crypto-ghash/arm-ce) -KernelPackage/crypto-ghash/mvebu=$(KernelPackage/crypto-ghash/arm-ce) +KernelPackage/crypto-ghash/mvebu/cortexa9=$(KernelPackage/crypto-ghash/arm-ce) $(eval $(call KernelPackage,crypto-ghash)) From 8c4f8311b117952c5c65b38a5bcf020d7822a619 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 29 Jan 2022 17:32:42 +0100 Subject: [PATCH 17/48] kernel: Make kmod-usb-net-lan78xx depend on kmod-of-mdio kmod-usb-net-lan78xx depends on kmod-of-mdio when this package is activated. Signed-off-by: Hauke Mehrtens (cherry picked from commit 6cab21bd6d23407fb2dc4cf68015c4998839b5f7) --- package/kernel/linux/modules/usb.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/kernel/linux/modules/usb.mk b/package/kernel/linux/modules/usb.mk index ee2a201f91..37f86d545e 100644 --- a/package/kernel/linux/modules/usb.mk +++ b/package/kernel/linux/modules/usb.mk @@ -1241,7 +1241,7 @@ $(eval $(call KernelPackage,usb-net-kaweth)) define KernelPackage/usb-net-lan78xx TITLE:=USB-To-Ethernet Microchip LAN78XX convertors - DEPENDS:=+kmod-fixed-phy +kmod-phy-microchip + DEPENDS:=+kmod-fixed-phy +kmod-phy-microchip +PACKAGE_kmod-of-mdio:kmod-of-mdio KCONFIG:=CONFIG_USB_LAN78XX FILES:=$(LINUX_DIR)/drivers/$(USBNET_DIR)/lan78xx.ko AUTOLOAD:=$(call AutoProbe,lan78xx) From 4bf7a78d8be1891c5f83b6b2d674b0baac6b930c Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Fri, 13 May 2022 17:57:59 +0800 Subject: [PATCH 18/48] kernel/netdevices: i40e: depends on x86 Signed-off-by: Tianling Shen --- package/kernel/linux/modules/netdevices.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/kernel/linux/modules/netdevices.mk b/package/kernel/linux/modules/netdevices.mk index 754df3c6f7..967cbf11df 100644 --- a/package/kernel/linux/modules/netdevices.mk +++ b/package/kernel/linux/modules/netdevices.mk @@ -671,7 +671,7 @@ $(eval $(call KernelPackage,ixgbevf)) define KernelPackage/i40e SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=Intel(R) Ethernet Controller XL710 Family support - DEPENDS:=@PCI_SUPPORT +kmod-mdio +kmod-ptp +kmod-hwmon-core @!TARGET_ramips + DEPENDS:=@TARGET_x86 @PCI_SUPPORT +kmod-mdio +kmod-ptp +kmod-hwmon-core KCONFIG:=CONFIG_I40E \ CONFIG_I40E_DCB=n FILES:=$(LINUX_DIR)/drivers/net/ethernet/intel/i40e/i40e.ko From 4915d34e9ecc76dba7299d36d9bf8636d9e65946 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Fri, 13 May 2022 18:03:49 +0800 Subject: [PATCH 19/48] kernel: bump to 4.9.313, 4.14.278, 4.19.242 Removed patches: - bcm27xx/patches-4.19/950-0475-usb-xhci-Disable-the-XHCI-5-second-timeout.patch Should be fixed by upstream commit 1c713660c51f3bc64fc1c709ba2bfb358551f3da ("xhci: make xhci_handshake timeout for xhci_reset() adjustable"). Refreshed all patches. Signed-off-by: Tianling Shen --- include/kernel-version.mk | 12 ++++---- .../802-usb-xhci-force-msi-renesas-xhci.patch | 4 +-- .../910-unaligned_access_hacks.patch | 10 +++---- .../910-unaligned_access_hacks.patch | 10 +++---- .../910-unaligned_access_hacks.patch | 10 +++---- .../910-unaligned_access_hacks.patch | 10 +++---- ...-0029-mm-Remove-the-PFN-busy-warning.patch | 2 +- ...Better-coalescing-parameter-defaults.patch | 4 +-- ...it-out-the-BCM54213PE-from-the-BCM54.patch | 8 ++--- ...onfigure-the-LED-outputs-to-be-more-.patch | 4 +-- ...ci-Disable-the-XHCI-5-second-timeout.patch | 29 ------------------- ...hci_fixup_endpoint-for-interval-adju.patch | 4 +-- ...or-host-controllers-that-don-t-updat.patch | 2 +- ...t-Workaround-2-for-Pi4-Ethernet-fail.patch | 2 +- ...ore-event-ring-segment-table-entries.patch | 2 +- ...Encode-link-speed-and-activity-into-.patch | 2 +- ...ow-ethernet-LED-mode-to-be-set-via-d.patch | 6 ++-- ...nge-the-default-ethernet-LED-actions.patch | 4 +-- ...support-for-performing-fake-doorbell.patch | 6 ++-- ...-set-MRSS-128-to-fix-CNS3xxx-BM-DMA..patch | 2 +- .../200-broadcom_phy_reinit.patch | 2 +- ...-set-MRSS-128-to-fix-CNS3xxx-BM-DMA..patch | 2 +- .../200-broadcom_phy_reinit.patch | 2 +- ...tcp-allow-drivers-to-tweak-TSQ-logic.patch | 4 +-- ...ption-fix-dwm-158-3g-modem-interface.patch | 2 +- ...-support-new-device-flag-for-setting.patch | 2 +- ...at-by-skipping-RTT-from-delayed-ACK-.patch | 2 +- ...r-better-deal-with-suboptimal-GSO-II.patch | 8 ++--- ...-bbr-pacing-rate-for-internal-pacing.patch | 6 ++-- ...024-1-tcp-tsq-add-tsq_flags-tsq_enum.patch | 6 ++-- ...ve-one-locked-operation-in-tcp_wfree.patch | 4 +-- ...tsq-add-shortcut-in-tcp_tasklet_func.patch | 6 ++-- ...cp-tsq-avoid-one-atomic-in-tcp_wfree.patch | 4 +-- ...-a-shortcut-in-tcp_small_queue_check.patch | 2 +- ...cp_mtu_probe-is-likely-to-exit-early.patch | 2 +- ...ove-tsq_flags-close-to-sk_wmem_alloc.patch | 14 ++++----- ...-missing-barrier-in-tcp_tasklet_func.patch | 2 +- ...tcp-allow-drivers-to-tweak-TSQ-logic.patch | 4 +-- ...y-broadcom-Add-support-for-BCM54612E.patch | 6 ++-- ...phy-broadcom-add-bcm54xx_auxctl_read.patch | 2 +- ...-phy-broadcom-Add-BCM54810-PHY-entry.patch | 14 ++++----- ...-Move-bcm54xx_auxctl_-read-write-to-.patch | 2 +- ...-use-auxctl-reading-helper-in-BCM546.patch | 2 +- ...y-broadcom-add-support-for-BCM54210E.patch | 8 ++--- ...adcom-rehook-BCM54612E-specific-init.patch | 8 ++--- ...-support-new-device-flag-for-setting.patch | 2 +- ...p-internal-implementation-for-pacing.patch | 14 ++++----- ...at-by-skipping-RTT-from-delayed-ACK-.patch | 2 +- ...r-better-deal-with-suboptimal-GSO-II.patch | 8 ++--- ...-bbr-pacing-rate-for-internal-pacing.patch | 6 ++-- .../998-usb-serial-option-add-u9300.patch | 4 +-- .../998-usb-serial-option-add-u9300.patch | 4 +-- ...mtd-device-named-ubi-or-data-on-boot.patch | 4 +-- .../pending-4.14/532-jffs2_eofdetect.patch | 2 +- .../601-add-kernel-imq-support.patch | 2 +- ...-netfilter_optional_tcp_window_check.patch | 2 +- .../pending-4.14/630-packet_socket_type.patch | 6 ++-- .../pending-4.14/834-ledtrig-libata.patch | 8 ++--- ...mtd-device-named-ubi-or-data-on-boot.patch | 4 +-- .../pending-4.19/532-jffs2_eofdetect.patch | 2 +- .../601-add-kernel-imq-support.patch | 2 +- ...-netfilter_optional_tcp_window_check.patch | 4 +-- .../pending-4.19/630-packet_socket_type.patch | 6 ++-- .../pending-4.19/834-ledtrig-libata.patch | 8 ++--- .../pending-4.9/532-jffs2_eofdetect.patch | 2 +- .../601-add-kernel-imq-support.patch | 2 +- ...-netfilter_optional_tcp_window_check.patch | 2 +- .../pending-4.9/630-packet_socket_type.patch | 6 ++-- ...use-v2-of-the-kpss-bringup-mechanism.patch | 4 +-- ...com-ipq4019-add-USB-devicetree-nodes.patch | 2 +- ...s-ipq4019-Add-a-few-peripheral-nodes.patch | 20 ++++++------- .../079-ARM-dts-ipq4019-fix-PCI-range.patch | 2 +- ...msm-fix-gpio-hog-related-boot-issues.patch | 2 +- ...ts-ipq4019-Add-a-default-chosen-node.patch | 2 +- ...-qcom-ipq4019-enlarge-PCIe-BAR-range.patch | 2 +- ...RM-dts-qcom-ipq4019-Fix-MSI-IRQ-type.patch | 2 +- ...90-ipq40xx-fix-high-resolution-timer.patch | 2 +- .../701-dts-ipq4019-add-mdio-node.patch | 2 +- ...702-dts-ipq4019-add-PHY-switch-nodes.patch | 2 +- ...ts-ipq4019-add-ethernet-essedma-node.patch | 2 +- ...4019-Add-SDHCI-VQMMC-LDO-regulator-n.patch | 2 +- .../853-add-sdhci-msm-node-to-dts.patch | 2 +- ...essedma-disable-default-vlan-tagging.patch | 4 +-- .../996-add-uart2-and-mdio-label.patch | 4 +-- ...4019-use-v2-of-the-kpss-bringup-mech.patch | 2 +- ...-ipq40xx-Fix-booting-secondary-cores.patch | 2 +- ...com-ipq4019-add-USB-devicetree-nodes.patch | 2 +- ...RM-dts-qcom-add-gpio-ranges-property.patch | 2 +- ...86-ipq40xx-fix-high-resolution-timer.patch | 2 +- ...om-ipq4019-Add-SDHCI-controller-node.patch | 2 +- ...dts-IPQ4019-add-SDHCI-VQMMC-LDO-node.patch | 2 +- .../701-dts-ipq4019-add-mdio-node.patch | 2 +- ...702-dts-ipq4019-add-PHY-switch-nodes.patch | 2 +- ...ts-ipq4019-add-ethernet-essedma-node.patch | 2 +- ...essedma-disable-default-vlan-tagging.patch | 4 +-- .../0001-MIPS-lantiq-add-pcie-driver.patch | 2 +- .../807-usb-support-layerscape.patch | 2 +- .../816-pcie-support-layerscape.patch | 2 +- ...CE-RG_IDDIG-to-implement-manual-DRD-.patch | 6 ++-- .../patches-4.19/0900-bt-mtk-serial-fix.patch | 2 +- ...rdvark-Convert-to-use-pci_host_probe.patch | 4 +-- .../oxnas/patches-4.14/999-libata-hacks.patch | 4 +-- 102 files changed, 212 insertions(+), 241 deletions(-) delete mode 100644 target/linux/bcm27xx/patches-4.19/950-0475-usb-xhci-Disable-the-XHCI-5-second-timeout.patch diff --git a/include/kernel-version.mk b/include/kernel-version.mk index a39695b629..f8fe610d11 100644 --- a/include/kernel-version.mk +++ b/include/kernel-version.mk @@ -6,13 +6,13 @@ ifdef CONFIG_TESTING_KERNEL KERNEL_PATCHVER:=$(KERNEL_TESTING_PATCHVER) endif -LINUX_VERSION-4.9 = .309 -LINUX_VERSION-4.14 = .275 -LINUX_VERSION-4.19 = .237 +LINUX_VERSION-4.9 = .313 +LINUX_VERSION-4.14 = .278 +LINUX_VERSION-4.19 = .242 -LINUX_KERNEL_HASH-4.9.309 = e86a55a89e1e28756b890b2b78f8b582d05cecb3509ff5c353e9534866468614 -LINUX_KERNEL_HASH-4.14.275 = 100a9960fb2d8e079c9feeef640715a7fb749ed728a57e427f9e2443212e58f9 -LINUX_KERNEL_HASH-4.19.237 = bafff35102cc486ec2bf94c6d908be8e24017b2e4a1873f52f24c855eb220cd8 +LINUX_KERNEL_HASH-4.9.313 = e03b777861fae559cb7ed635500cde305bc2ca34dee4dc2fe806de0060c87bdc +LINUX_KERNEL_HASH-4.14.278 = 3cd6d4eeb3a5d1c906b35c08f0d602f329410c291233bee1a7a2b168c7378bbe +LINUX_KERNEL_HASH-4.19.242 = 59bcfd094ec26b03ca506199224cff53c13325e62d22bd4e31ef4ccafe7265a2 remove_uri_prefix=$(subst git://,,$(subst http://,,$(subst https://,,$(1)))) sanitize_uri=$(call qstrip,$(subst @,_,$(subst :,_,$(subst .,_,$(subst -,_,$(subst /,_,$(1))))))) diff --git a/target/linux/apm821xx/patches-4.19/802-usb-xhci-force-msi-renesas-xhci.patch b/target/linux/apm821xx/patches-4.19/802-usb-xhci-force-msi-renesas-xhci.patch index dd9cbae4b8..c807ab8ee0 100644 --- a/target/linux/apm821xx/patches-4.19/802-usb-xhci-force-msi-renesas-xhci.patch +++ b/target/linux/apm821xx/patches-4.19/802-usb-xhci-force-msi-renesas-xhci.patch @@ -23,7 +23,7 @@ produce a noisy warning. xhci->quirks |= XHCI_RESET_ON_RESUME; --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c -@@ -426,10 +426,14 @@ static int xhci_try_enable_msi(struct us +@@ -424,10 +424,14 @@ static int xhci_try_enable_msi(struct us free_irq(hcd->irq, hcd); hcd->irq = 0; @@ -43,7 +43,7 @@ produce a noisy warning. hcd->msi_enabled = 1; --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1885,6 +1885,7 @@ struct xhci_hcd { +@@ -1888,6 +1888,7 @@ struct xhci_hcd { /* support xHCI 0.96 spec USB2 software LPM */ unsigned sw_lpm_support:1; /* support xHCI 1.0 spec USB2 hardware LPM */ diff --git a/target/linux/ar71xx/patches-4.14/910-unaligned_access_hacks.patch b/target/linux/ar71xx/patches-4.14/910-unaligned_access_hacks.patch index 31f1ed779d..6e379cfa9e 100644 --- a/target/linux/ar71xx/patches-4.14/910-unaligned_access_hacks.patch +++ b/target/linux/ar71xx/patches-4.14/910-unaligned_access_hacks.patch @@ -336,7 +336,7 @@ return neigh_create(&arp_tbl, pkey, dev); --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c -@@ -454,48 +454,53 @@ static void tcp_options_write(__be32 *pt +@@ -455,48 +455,53 @@ static void tcp_options_write(__be32 *pt u16 options = opts->options; /* mungable copy */ if (unlikely(OPTION_MD5 & options)) { @@ -413,7 +413,7 @@ } if (unlikely(opts->num_sack_blocks)) { -@@ -503,16 +508,17 @@ static void tcp_options_write(__be32 *pt +@@ -504,16 +509,17 @@ static void tcp_options_write(__be32 *pt tp->duplicate_sack : tp->selective_acks; int this_sack; @@ -437,7 +437,7 @@ } tp->rx_opt.dsack = 0; -@@ -525,13 +531,14 @@ static void tcp_options_write(__be32 *pt +@@ -526,13 +532,14 @@ static void tcp_options_write(__be32 *pt if (foc->exp) { len = TCPOLEN_EXP_FASTOPEN_BASE + foc->len; @@ -872,7 +872,7 @@ skb->ip_summed = CHECKSUM_NONE; --- a/include/linux/etherdevice.h +++ b/include/linux/etherdevice.h -@@ -480,7 +480,7 @@ static inline bool is_etherdev_addr(cons +@@ -479,7 +479,7 @@ static inline bool is_etherdev_addr(cons * @b: Pointer to Ethernet header * * Compare two Ethernet headers, returns 0 if equal. @@ -881,7 +881,7 @@ * aligned OR the platform can handle unaligned access. This is the * case for all packets coming into netif_receive_skb or similar * entry points. -@@ -503,11 +503,12 @@ static inline unsigned long compare_ethe +@@ -502,11 +502,12 @@ static inline unsigned long compare_ethe fold |= *(unsigned long *)(a + 6) ^ *(unsigned long *)(b + 6); return fold; #else diff --git a/target/linux/ar71xx/patches-4.9/910-unaligned_access_hacks.patch b/target/linux/ar71xx/patches-4.9/910-unaligned_access_hacks.patch index e6a299708b..904e25fe59 100644 --- a/target/linux/ar71xx/patches-4.9/910-unaligned_access_hacks.patch +++ b/target/linux/ar71xx/patches-4.9/910-unaligned_access_hacks.patch @@ -327,7 +327,7 @@ return neigh_create(&arp_tbl, pkey, dev); --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c -@@ -453,48 +453,53 @@ static void tcp_options_write(__be32 *pt +@@ -454,48 +454,53 @@ static void tcp_options_write(__be32 *pt u16 options = opts->options; /* mungable copy */ if (unlikely(OPTION_MD5 & options)) { @@ -404,7 +404,7 @@ } if (unlikely(opts->num_sack_blocks)) { -@@ -502,16 +507,17 @@ static void tcp_options_write(__be32 *pt +@@ -503,16 +508,17 @@ static void tcp_options_write(__be32 *pt tp->duplicate_sack : tp->selective_acks; int this_sack; @@ -428,7 +428,7 @@ } tp->rx_opt.dsack = 0; -@@ -524,13 +530,14 @@ static void tcp_options_write(__be32 *pt +@@ -525,13 +531,14 @@ static void tcp_options_write(__be32 *pt if (foc->exp) { len = TCPOLEN_EXP_FASTOPEN_BASE + foc->len; @@ -910,7 +910,7 @@ skb->ip_summed = CHECKSUM_NONE; --- a/include/linux/etherdevice.h +++ b/include/linux/etherdevice.h -@@ -435,7 +435,7 @@ static inline bool is_etherdev_addr(cons +@@ -434,7 +434,7 @@ static inline bool is_etherdev_addr(cons * @b: Pointer to Ethernet header * * Compare two Ethernet headers, returns 0 if equal. @@ -919,7 +919,7 @@ * aligned OR the platform can handle unaligned access. This is the * case for all packets coming into netif_receive_skb or similar * entry points. -@@ -458,11 +458,12 @@ static inline unsigned long compare_ethe +@@ -457,11 +457,12 @@ static inline unsigned long compare_ethe fold |= *(unsigned long *)(a + 6) ^ *(unsigned long *)(b + 6); return fold; #else diff --git a/target/linux/ath79/patches-4.14/910-unaligned_access_hacks.patch b/target/linux/ath79/patches-4.14/910-unaligned_access_hacks.patch index c758458fa6..eaf474eb09 100644 --- a/target/linux/ath79/patches-4.14/910-unaligned_access_hacks.patch +++ b/target/linux/ath79/patches-4.14/910-unaligned_access_hacks.patch @@ -327,7 +327,7 @@ return neigh_create(&arp_tbl, pkey, dev); --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c -@@ -454,48 +454,53 @@ static void tcp_options_write(__be32 *pt +@@ -455,48 +455,53 @@ static void tcp_options_write(__be32 *pt u16 options = opts->options; /* mungable copy */ if (unlikely(OPTION_MD5 & options)) { @@ -404,7 +404,7 @@ } if (unlikely(opts->num_sack_blocks)) { -@@ -503,16 +508,17 @@ static void tcp_options_write(__be32 *pt +@@ -504,16 +509,17 @@ static void tcp_options_write(__be32 *pt tp->duplicate_sack : tp->selective_acks; int this_sack; @@ -428,7 +428,7 @@ } tp->rx_opt.dsack = 0; -@@ -525,13 +531,14 @@ static void tcp_options_write(__be32 *pt +@@ -526,13 +532,14 @@ static void tcp_options_write(__be32 *pt if (foc->exp) { len = TCPOLEN_EXP_FASTOPEN_BASE + foc->len; @@ -830,7 +830,7 @@ *sum = csum_fold(csum_partial(diff, sizeof(diff), --- a/include/linux/etherdevice.h +++ b/include/linux/etherdevice.h -@@ -480,7 +480,7 @@ static inline bool is_etherdev_addr(cons +@@ -479,7 +479,7 @@ static inline bool is_etherdev_addr(cons * @b: Pointer to Ethernet header * * Compare two Ethernet headers, returns 0 if equal. @@ -839,7 +839,7 @@ * aligned OR the platform can handle unaligned access. This is the * case for all packets coming into netif_receive_skb or similar * entry points. -@@ -503,11 +503,12 @@ static inline unsigned long compare_ethe +@@ -502,11 +502,12 @@ static inline unsigned long compare_ethe fold |= *(unsigned long *)(a + 6) ^ *(unsigned long *)(b + 6); return fold; #else diff --git a/target/linux/ath79/patches-4.19/910-unaligned_access_hacks.patch b/target/linux/ath79/patches-4.19/910-unaligned_access_hacks.patch index 1ba65d78e8..6697434276 100644 --- a/target/linux/ath79/patches-4.19/910-unaligned_access_hacks.patch +++ b/target/linux/ath79/patches-4.19/910-unaligned_access_hacks.patch @@ -327,7 +327,7 @@ return neigh_create(&arp_tbl, pkey, dev); --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c -@@ -447,48 +447,53 @@ static void tcp_options_write(__be32 *pt +@@ -448,48 +448,53 @@ static void tcp_options_write(__be32 *pt u16 options = opts->options; /* mungable copy */ if (unlikely(OPTION_MD5 & options)) { @@ -404,7 +404,7 @@ } if (unlikely(opts->num_sack_blocks)) { -@@ -496,16 +501,17 @@ static void tcp_options_write(__be32 *pt +@@ -497,16 +502,17 @@ static void tcp_options_write(__be32 *pt tp->duplicate_sack : tp->selective_acks; int this_sack; @@ -428,7 +428,7 @@ } tp->rx_opt.dsack = 0; -@@ -518,13 +524,14 @@ static void tcp_options_write(__be32 *pt +@@ -519,13 +525,14 @@ static void tcp_options_write(__be32 *pt if (foc->exp) { len = TCPOLEN_EXP_FASTOPEN_BASE + foc->len; @@ -821,7 +821,7 @@ *sum = csum_fold(csum_partial(diff, sizeof(diff), --- a/include/linux/etherdevice.h +++ b/include/linux/etherdevice.h -@@ -480,7 +480,7 @@ static inline bool is_etherdev_addr(cons +@@ -479,7 +479,7 @@ static inline bool is_etherdev_addr(cons * @b: Pointer to Ethernet header * * Compare two Ethernet headers, returns 0 if equal. @@ -830,7 +830,7 @@ * aligned OR the platform can handle unaligned access. This is the * case for all packets coming into netif_receive_skb or similar * entry points. -@@ -503,11 +503,12 @@ static inline unsigned long compare_ethe +@@ -502,11 +502,12 @@ static inline unsigned long compare_ethe fold |= *(unsigned long *)(a + 6) ^ *(unsigned long *)(b + 6); return fold; #else diff --git a/target/linux/bcm27xx/patches-4.19/950-0029-mm-Remove-the-PFN-busy-warning.patch b/target/linux/bcm27xx/patches-4.19/950-0029-mm-Remove-the-PFN-busy-warning.patch index 5fcfc4769e..10134d5ca4 100644 --- a/target/linux/bcm27xx/patches-4.19/950-0029-mm-Remove-the-PFN-busy-warning.patch +++ b/target/linux/bcm27xx/patches-4.19/950-0029-mm-Remove-the-PFN-busy-warning.patch @@ -14,7 +14,7 @@ Signed-off-by: Eric Anholt --- a/mm/page_alloc.c +++ b/mm/page_alloc.c -@@ -8017,8 +8017,6 @@ int alloc_contig_range(unsigned long sta +@@ -8024,8 +8024,6 @@ int alloc_contig_range(unsigned long sta /* Make sure the range is really isolated. */ if (test_pages_isolated(outer_start, end, false)) { diff --git a/target/linux/bcm27xx/patches-4.19/950-0470-bcmgenet-Better-coalescing-parameter-defaults.patch b/target/linux/bcm27xx/patches-4.19/950-0470-bcmgenet-Better-coalescing-parameter-defaults.patch index a82ac5b1ba..0d43db4a36 100644 --- a/target/linux/bcm27xx/patches-4.19/950-0470-bcmgenet-Better-coalescing-parameter-defaults.patch +++ b/target/linux/bcm27xx/patches-4.19/950-0470-bcmgenet-Better-coalescing-parameter-defaults.patch @@ -18,7 +18,7 @@ Signed-off-by: Phil Elwell --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c -@@ -2152,7 +2152,7 @@ static void bcmgenet_init_tx_ring(struct +@@ -2159,7 +2159,7 @@ static void bcmgenet_init_tx_ring(struct bcmgenet_tdma_ring_writel(priv, index, 0, TDMA_PROD_INDEX); bcmgenet_tdma_ring_writel(priv, index, 0, TDMA_CONS_INDEX); @@ -27,7 +27,7 @@ Signed-off-by: Phil Elwell /* Disable rate control for now */ bcmgenet_tdma_ring_writel(priv, index, flow_period_val, TDMA_FLOW_PERIOD); -@@ -3585,9 +3585,12 @@ static int bcmgenet_probe(struct platfor +@@ -3592,9 +3592,12 @@ static int bcmgenet_probe(struct platfor netif_set_real_num_rx_queues(priv->dev, priv->hw_params->rx_queues + 1); /* Set default coalescing parameters */ diff --git a/target/linux/bcm27xx/patches-4.19/950-0472-phy-broadcom-split-out-the-BCM54213PE-from-the-BCM54.patch b/target/linux/bcm27xx/patches-4.19/950-0472-phy-broadcom-split-out-the-BCM54213PE-from-the-BCM54.patch index 354cd08f22..bc216813c9 100644 --- a/target/linux/bcm27xx/patches-4.19/950-0472-phy-broadcom-split-out-the-BCM54213PE-from-the-BCM54.patch +++ b/target/linux/bcm27xx/patches-4.19/950-0472-phy-broadcom-split-out-the-BCM54213PE-from-the-BCM54.patch @@ -16,7 +16,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/net/phy/broadcom.c +++ b/drivers/net/phy/broadcom.c -@@ -222,7 +222,8 @@ static void bcm54xx_adjust_rxrefclk(stru +@@ -223,7 +223,8 @@ static void bcm54xx_adjust_rxrefclk(stru /* Abort if we are using an untested phy. */ if (BRCM_PHY_MODEL(phydev) != PHY_ID_BCM57780 && BRCM_PHY_MODEL(phydev) != PHY_ID_BCM50610 && @@ -26,7 +26,7 @@ Signed-off-by: Jonathan Bell return; val = bcm_phy_read_shadow(phydev, BCM54XX_SHD_SCR3); -@@ -604,7 +605,7 @@ static struct phy_driver broadcom_driver +@@ -625,7 +626,7 @@ static struct phy_driver broadcom_driver .config_intr = bcm_phy_config_intr, }, { .phy_id = PHY_ID_BCM54210E, @@ -35,7 +35,7 @@ Signed-off-by: Jonathan Bell .name = "Broadcom BCM54210E", .features = PHY_GBIT_FEATURES, .flags = PHY_HAS_INTERRUPT, -@@ -612,6 +613,15 @@ static struct phy_driver broadcom_driver +@@ -633,6 +634,15 @@ static struct phy_driver broadcom_driver .ack_interrupt = bcm_phy_ack_intr, .config_intr = bcm_phy_config_intr, }, { @@ -51,7 +51,7 @@ Signed-off-by: Jonathan Bell .phy_id = PHY_ID_BCM5461, .phy_id_mask = 0xfffffff0, .name = "Broadcom BCM5461", -@@ -748,7 +758,8 @@ module_phy_driver(broadcom_drivers); +@@ -769,7 +779,8 @@ module_phy_driver(broadcom_drivers); static struct mdio_device_id __maybe_unused broadcom_tbl[] = { { PHY_ID_BCM5411, 0xfffffff0 }, { PHY_ID_BCM5421, 0xfffffff0 }, diff --git a/target/linux/bcm27xx/patches-4.19/950-0473-phy-bcm54213pe-configure-the-LED-outputs-to-be-more-.patch b/target/linux/bcm27xx/patches-4.19/950-0473-phy-bcm54213pe-configure-the-LED-outputs-to-be-more-.patch index 15af5a7ca4..a0e97f05bb 100644 --- a/target/linux/bcm27xx/patches-4.19/950-0473-phy-bcm54213pe-configure-the-LED-outputs-to-be-more-.patch +++ b/target/linux/bcm27xx/patches-4.19/950-0473-phy-bcm54213pe-configure-the-LED-outputs-to-be-more-.patch @@ -18,7 +18,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/net/phy/broadcom.c +++ b/drivers/net/phy/broadcom.c -@@ -52,6 +52,21 @@ static int bcm54210e_config_init(struct +@@ -53,6 +53,21 @@ static int bcm54210e_config_init(struct return 0; } @@ -40,7 +40,7 @@ Signed-off-by: Jonathan Bell static int bcm54612e_config_init(struct phy_device *phydev) { int reg; -@@ -310,6 +325,8 @@ static int bcm54xx_config_init(struct ph +@@ -311,6 +326,8 @@ static int bcm54xx_config_init(struct ph err = bcm54210e_config_init(phydev); if (err) return err; diff --git a/target/linux/bcm27xx/patches-4.19/950-0475-usb-xhci-Disable-the-XHCI-5-second-timeout.patch b/target/linux/bcm27xx/patches-4.19/950-0475-usb-xhci-Disable-the-XHCI-5-second-timeout.patch deleted file mode 100644 index abc576d690..0000000000 --- a/target/linux/bcm27xx/patches-4.19/950-0475-usb-xhci-Disable-the-XHCI-5-second-timeout.patch +++ /dev/null @@ -1,29 +0,0 @@ -From ff7222c0771a5e28666335663571058e560ad32b Mon Sep 17 00:00:00 2001 -From: Tim Gover -Date: Fri, 22 Mar 2019 09:47:14 +0000 -Subject: [PATCH] usb: xhci: Disable the XHCI 5 second timeout - -If the VL805 EEPROM has not been programmed then boot will hang for five -seconds. The timeout seems to be arbitrary and is an unecessary -delay on the first boot. Remove the timeout. - -This is common code and probably can't be upstreamed unless the timeout -can be configurable somehow or perhaps the XHCI driver can be skipped -on the first boot. ---- - drivers/usb/host/xhci.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - ---- a/drivers/usb/host/xhci.c -+++ b/drivers/usb/host/xhci.c -@@ -196,8 +196,9 @@ int xhci_reset(struct xhci_hcd *xhci) - if (xhci->quirks & XHCI_INTEL_HOST) - udelay(1000); - -+ // Hack: reduce handshake timeout from 10s 0.5s due to unprogrammed vl805 - ret = xhci_handshake(&xhci->op_regs->command, -- CMD_RESET, 0, 10 * 1000 * 1000); -+ CMD_RESET, 0, 500 * 1000); - if (ret) - return ret; - diff --git a/target/linux/bcm27xx/patches-4.19/950-0573-xhci-implement-xhci_fixup_endpoint-for-interval-adju.patch b/target/linux/bcm27xx/patches-4.19/950-0573-xhci-implement-xhci_fixup_endpoint-for-interval-adju.patch index 5b6193faae..f343bef64d 100644 --- a/target/linux/bcm27xx/patches-4.19/950-0573-xhci-implement-xhci_fixup_endpoint-for-interval-adju.patch +++ b/target/linux/bcm27xx/patches-4.19/950-0573-xhci-implement-xhci_fixup_endpoint-for-interval-adju.patch @@ -15,7 +15,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c -@@ -1452,6 +1452,103 @@ command_cleanup: +@@ -1460,6 +1460,103 @@ command_cleanup: } /* @@ -119,7 +119,7 @@ Signed-off-by: Jonathan Bell * non-error returns are a promise to giveback() the urb later * we drop ownership so next owner (or urb unlink) can get it */ -@@ -5271,6 +5368,7 @@ static const struct hc_driver xhci_hc_dr +@@ -5279,6 +5376,7 @@ static const struct hc_driver xhci_hc_dr .endpoint_reset = xhci_endpoint_reset, .check_bandwidth = xhci_check_bandwidth, .reset_bandwidth = xhci_reset_bandwidth, diff --git a/target/linux/bcm27xx/patches-4.19/950-0609-xhci-add-quirk-for-host-controllers-that-don-t-updat.patch b/target/linux/bcm27xx/patches-4.19/950-0609-xhci-add-quirk-for-host-controllers-that-don-t-updat.patch index 1e47724126..e058965e31 100644 --- a/target/linux/bcm27xx/patches-4.19/950-0609-xhci-add-quirk-for-host-controllers-that-don-t-updat.patch +++ b/target/linux/bcm27xx/patches-4.19/950-0609-xhci-add-quirk-for-host-controllers-that-don-t-updat.patch @@ -80,7 +80,7 @@ Signed-off-by: Jonathan Bell /* --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1873,6 +1873,7 @@ struct xhci_hcd { +@@ -1876,6 +1876,7 @@ struct xhci_hcd { #define XHCI_ZERO_64B_REGS BIT_ULL(32) #define XHCI_RESET_PLL_ON_DISCONNECT BIT_ULL(34) #define XHCI_SNPS_BROKEN_SUSPEND BIT_ULL(35) diff --git a/target/linux/bcm27xx/patches-4.19/950-0658-net-bcmgenet-Workaround-2-for-Pi4-Ethernet-fail.patch b/target/linux/bcm27xx/patches-4.19/950-0658-net-bcmgenet-Workaround-2-for-Pi4-Ethernet-fail.patch index 9fa889bcfc..a05d73cd45 100644 --- a/target/linux/bcm27xx/patches-4.19/950-0658-net-bcmgenet-Workaround-2-for-Pi4-Ethernet-fail.patch +++ b/target/linux/bcm27xx/patches-4.19/950-0658-net-bcmgenet-Workaround-2-for-Pi4-Ethernet-fail.patch @@ -38,7 +38,7 @@ Signed-off-by: Phil Elwell static inline void bcmgenet_writel(u32 value, void __iomem *offset) { /* MIPS chips strapped for BE will automagically configure the -@@ -1998,6 +2002,11 @@ static void reset_umac(struct bcmgenet_p +@@ -2005,6 +2009,11 @@ static void reset_umac(struct bcmgenet_p bcmgenet_rbuf_ctrl_set(priv, 0); udelay(10); diff --git a/target/linux/bcm27xx/patches-4.19/950-0666-xhci-Use-more-event-ring-segment-table-entries.patch b/target/linux/bcm27xx/patches-4.19/950-0666-xhci-Use-more-event-ring-segment-table-entries.patch index ac97190d3e..5b0f3ab1ad 100644 --- a/target/linux/bcm27xx/patches-4.19/950-0666-xhci-Use-more-event-ring-segment-table-entries.patch +++ b/target/linux/bcm27xx/patches-4.19/950-0666-xhci-Use-more-event-ring-segment-table-entries.patch @@ -47,7 +47,7 @@ Signed-off-by: Jonathan Bell val); --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1644,8 +1644,8 @@ struct urb_priv { +@@ -1647,8 +1647,8 @@ struct urb_priv { * Each segment table entry is 4*32bits long. 1K seems like an ok size: * (1K bytes * 8bytes/bit) / (4*32 bits) = 64 segment entries in the table, * meaning 64 ring segments. diff --git a/target/linux/bcm27xx/patches-4.19/950-0748-net-phy-bcm54xx-Encode-link-speed-and-activity-into-.patch b/target/linux/bcm27xx/patches-4.19/950-0748-net-phy-bcm54xx-Encode-link-speed-and-activity-into-.patch index 9a5e29c208..ba52146fe0 100644 --- a/target/linux/bcm27xx/patches-4.19/950-0748-net-phy-bcm54xx-Encode-link-speed-and-activity-into-.patch +++ b/target/linux/bcm27xx/patches-4.19/950-0748-net-phy-bcm54xx-Encode-link-speed-and-activity-into-.patch @@ -20,7 +20,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/phy/broadcom.c +++ b/drivers/net/phy/broadcom.c -@@ -345,6 +345,19 @@ static int bcm54xx_config_init(struct ph +@@ -346,6 +346,19 @@ static int bcm54xx_config_init(struct ph bcm54xx_phydsp_config(phydev); diff --git a/target/linux/bcm27xx/patches-4.19/950-0749-net-phy-2711-Allow-ethernet-LED-mode-to-be-set-via-d.patch b/target/linux/bcm27xx/patches-4.19/950-0749-net-phy-2711-Allow-ethernet-LED-mode-to-be-set-via-d.patch index 1b922420c0..3e0f90800c 100644 --- a/target/linux/bcm27xx/patches-4.19/950-0749-net-phy-2711-Allow-ethernet-LED-mode-to-be-set-via-d.patch +++ b/target/linux/bcm27xx/patches-4.19/950-0749-net-phy-2711-Allow-ethernet-LED-mode-to-be-set-via-d.patch @@ -87,7 +87,7 @@ Signed-off-by: James Hughes (default "off") --- a/drivers/net/phy/broadcom.c +++ b/drivers/net/phy/broadcom.c -@@ -292,6 +292,9 @@ static void bcm54xx_adjust_rxrefclk(stru +@@ -293,6 +293,9 @@ static void bcm54xx_adjust_rxrefclk(stru static int bcm54xx_config_init(struct phy_device *phydev) { int reg, err, val; @@ -97,7 +97,7 @@ Signed-off-by: James Hughes reg = phy_read(phydev, MII_BCM54XX_ECR); if (reg < 0) -@@ -345,6 +348,8 @@ static int bcm54xx_config_init(struct ph +@@ -346,6 +349,8 @@ static int bcm54xx_config_init(struct ph bcm54xx_phydsp_config(phydev); @@ -106,7 +106,7 @@ Signed-off-by: James Hughes /* Encode link speed into LED1 and LED3 pair (green/amber). * Also flash these two LEDs on activity. This means configuring * them for MULTICOLOR and encoding link/activity into them. -@@ -354,8 +359,8 @@ static int bcm54xx_config_init(struct ph +@@ -355,8 +360,8 @@ static int bcm54xx_config_init(struct ph bcm_phy_write_shadow(phydev, BCM5482_SHD_LEDS1, val); val = BCM_LED_MULTICOLOR_IN_PHASE | diff --git a/target/linux/bcm27xx/patches-4.19/950-0751-net-phy-2711-Change-the-default-ethernet-LED-actions.patch b/target/linux/bcm27xx/patches-4.19/950-0751-net-phy-2711-Change-the-default-ethernet-LED-actions.patch index b00afccd00..2aea41bc62 100644 --- a/target/linux/bcm27xx/patches-4.19/950-0751-net-phy-2711-Change-the-default-ethernet-LED-actions.patch +++ b/target/linux/bcm27xx/patches-4.19/950-0751-net-phy-2711-Change-the-default-ethernet-LED-actions.patch @@ -11,7 +11,7 @@ releases. --- a/drivers/net/phy/broadcom.c +++ b/drivers/net/phy/broadcom.c -@@ -293,7 +293,7 @@ static int bcm54xx_config_init(struct ph +@@ -294,7 +294,7 @@ static int bcm54xx_config_init(struct ph { int reg, err, val; u32 led_modes[] = {BCM_LED_MULTICOLOR_LINK_ACT, @@ -20,7 +20,7 @@ releases. struct device_node *np = phydev->mdio.dev.of_node; reg = phy_read(phydev, MII_BCM54XX_ECR); -@@ -350,10 +350,6 @@ static int bcm54xx_config_init(struct ph +@@ -351,10 +351,6 @@ static int bcm54xx_config_init(struct ph of_property_read_u32_array(np, "led-modes", led_modes, 2); diff --git a/target/linux/bcm53xx/patches-4.19/180-usb-xhci-add-support-for-performing-fake-doorbell.patch b/target/linux/bcm53xx/patches-4.19/180-usb-xhci-add-support-for-performing-fake-doorbell.patch index ae6afa8448..eb5b00c4bf 100644 --- a/target/linux/bcm53xx/patches-4.19/180-usb-xhci-add-support-for-performing-fake-doorbell.patch +++ b/target/linux/bcm53xx/patches-4.19/180-usb-xhci-add-support-for-performing-fake-doorbell.patch @@ -90,7 +90,7 @@ it on BCM4708 family. /* * Reset a halted HC. * -@@ -607,10 +650,20 @@ static int xhci_init(struct usb_hcd *hcd +@@ -605,10 +648,20 @@ static int xhci_init(struct usb_hcd *hcd static int xhci_run_finished(struct xhci_hcd *xhci) { @@ -114,7 +114,7 @@ it on BCM4708 family. xhci->shared_hcd->state = HC_STATE_RUNNING; xhci->cmd_ring_state = CMD_RING_STATE_RUNNING; -@@ -620,6 +673,10 @@ static int xhci_run_finished(struct xhci +@@ -618,6 +671,10 @@ static int xhci_run_finished(struct xhci xhci_dbg_trace(xhci, trace_xhci_dbg_init, "Finished xhci_run for USB3 roothub"); return 0; @@ -127,7 +127,7 @@ it on BCM4708 family. /* --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1873,6 +1873,7 @@ struct xhci_hcd { +@@ -1876,6 +1876,7 @@ struct xhci_hcd { #define XHCI_ZERO_64B_REGS BIT_ULL(32) #define XHCI_RESET_PLL_ON_DISCONNECT BIT_ULL(34) #define XHCI_SNPS_BROKEN_SUSPEND BIT_ULL(35) diff --git a/target/linux/cns3xxx/patches-4.14/130-Extend-PCIE_BUS_PEER2PEER-to-set-MRSS-128-to-fix-CNS3xxx-BM-DMA..patch b/target/linux/cns3xxx/patches-4.14/130-Extend-PCIE_BUS_PEER2PEER-to-set-MRSS-128-to-fix-CNS3xxx-BM-DMA..patch index 43ad7993f9..d61283fe91 100644 --- a/target/linux/cns3xxx/patches-4.14/130-Extend-PCIE_BUS_PEER2PEER-to-set-MRSS-128-to-fix-CNS3xxx-BM-DMA..patch +++ b/target/linux/cns3xxx/patches-4.14/130-Extend-PCIE_BUS_PEER2PEER-to-set-MRSS-128-to-fix-CNS3xxx-BM-DMA..patch @@ -12,7 +12,7 @@ /* For Max performance, the MRRS must be set to the largest supported --- a/include/linux/pci.h +++ b/include/linux/pci.h -@@ -847,7 +847,7 @@ enum pcie_bus_config_types { +@@ -848,7 +848,7 @@ enum pcie_bus_config_types { PCIE_BUS_DEFAULT, /* ensure MPS matches upstream bridge */ PCIE_BUS_SAFE, /* use largest MPS boot-time devices support */ PCIE_BUS_PERFORMANCE, /* use MPS and MRRS for best performance */ diff --git a/target/linux/cns3xxx/patches-4.14/200-broadcom_phy_reinit.patch b/target/linux/cns3xxx/patches-4.14/200-broadcom_phy_reinit.patch index 6880533a05..dd48d2c751 100644 --- a/target/linux/cns3xxx/patches-4.14/200-broadcom_phy_reinit.patch +++ b/target/linux/cns3xxx/patches-4.14/200-broadcom_phy_reinit.patch @@ -1,6 +1,6 @@ --- a/drivers/net/phy/broadcom.c +++ b/drivers/net/phy/broadcom.c -@@ -417,7 +417,11 @@ static int bcm5481_config_aneg(struct ph +@@ -418,7 +418,11 @@ static int bcm5481_config_aneg(struct ph ret = genphy_config_aneg(phydev); /* Then we can set up the delay. */ diff --git a/target/linux/cns3xxx/patches-4.19/130-Extend-PCIE_BUS_PEER2PEER-to-set-MRSS-128-to-fix-CNS3xxx-BM-DMA..patch b/target/linux/cns3xxx/patches-4.19/130-Extend-PCIE_BUS_PEER2PEER-to-set-MRSS-128-to-fix-CNS3xxx-BM-DMA..patch index 6de2df037e..d5b45c4904 100644 --- a/target/linux/cns3xxx/patches-4.19/130-Extend-PCIE_BUS_PEER2PEER-to-set-MRSS-128-to-fix-CNS3xxx-BM-DMA..patch +++ b/target/linux/cns3xxx/patches-4.19/130-Extend-PCIE_BUS_PEER2PEER-to-set-MRSS-128-to-fix-CNS3xxx-BM-DMA..patch @@ -12,7 +12,7 @@ /* --- a/include/linux/pci.h +++ b/include/linux/pci.h -@@ -873,7 +873,7 @@ enum pcie_bus_config_types { +@@ -874,7 +874,7 @@ enum pcie_bus_config_types { PCIE_BUS_DEFAULT, /* Ensure MPS matches upstream bridge */ PCIE_BUS_SAFE, /* Use largest MPS boot-time devices support */ PCIE_BUS_PERFORMANCE, /* Use MPS and MRRS for best performance */ diff --git a/target/linux/cns3xxx/patches-4.19/200-broadcom_phy_reinit.patch b/target/linux/cns3xxx/patches-4.19/200-broadcom_phy_reinit.patch index b0c3299d85..3e4daa4b48 100644 --- a/target/linux/cns3xxx/patches-4.19/200-broadcom_phy_reinit.patch +++ b/target/linux/cns3xxx/patches-4.19/200-broadcom_phy_reinit.patch @@ -1,6 +1,6 @@ --- a/drivers/net/phy/broadcom.c +++ b/drivers/net/phy/broadcom.c -@@ -429,7 +429,11 @@ static int bcm5481_config_aneg(struct ph +@@ -430,7 +430,11 @@ static int bcm5481_config_aneg(struct ph ret = genphy_config_aneg(phydev); /* Then we can set up the delay. */ diff --git a/target/linux/generic/backport-4.14/025-tcp-allow-drivers-to-tweak-TSQ-logic.patch b/target/linux/generic/backport-4.14/025-tcp-allow-drivers-to-tweak-TSQ-logic.patch index 82afb03d29..d77ce8ce60 100644 --- a/target/linux/generic/backport-4.14/025-tcp-allow-drivers-to-tweak-TSQ-logic.patch +++ b/target/linux/generic/backport-4.14/025-tcp-allow-drivers-to-tweak-TSQ-logic.patch @@ -65,7 +65,7 @@ Cc: Kir Kolyshkin * Before updating sk_refcnt, we must commit prior changes to memory --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c -@@ -1701,7 +1701,7 @@ u32 tcp_tso_autosize(const struct sock * +@@ -1702,7 +1702,7 @@ u32 tcp_tso_autosize(const struct sock * { u32 bytes, segs; @@ -74,7 +74,7 @@ Cc: Kir Kolyshkin sk->sk_gso_max_size - 1 - MAX_TCP_HEADER); /* Goal is to send at least one packet per ms, -@@ -2219,7 +2219,7 @@ static bool tcp_small_queue_check(struct +@@ -2220,7 +2220,7 @@ static bool tcp_small_queue_check(struct { unsigned int limit; diff --git a/target/linux/generic/backport-4.14/030-USB-serial-option-fix-dwm-158-3g-modem-interface.patch b/target/linux/generic/backport-4.14/030-USB-serial-option-fix-dwm-158-3g-modem-interface.patch index 81574d8684..f9dea3d460 100644 --- a/target/linux/generic/backport-4.14/030-USB-serial-option-fix-dwm-158-3g-modem-interface.patch +++ b/target/linux/generic/backport-4.14/030-USB-serial-option-fix-dwm-158-3g-modem-interface.patch @@ -30,7 +30,7 @@ Signed-off-by: Johan Hovold --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c -@@ -2072,7 +2072,8 @@ static const struct usb_device_id option +@@ -2084,7 +2084,8 @@ static const struct usb_device_id option { USB_DEVICE_INTERFACE_CLASS(0x2001, 0x7d01, 0xff) }, /* D-Link DWM-156 (variant) */ { USB_DEVICE_INTERFACE_CLASS(0x2001, 0x7d02, 0xff) }, { USB_DEVICE_INTERFACE_CLASS(0x2001, 0x7d03, 0xff) }, diff --git a/target/linux/generic/backport-4.14/076-v4.15-0001-net-phy-broadcom-support-new-device-flag-for-setting.patch b/target/linux/generic/backport-4.14/076-v4.15-0001-net-phy-broadcom-support-new-device-flag-for-setting.patch index a22d272656..421ece5120 100644 --- a/target/linux/generic/backport-4.14/076-v4.15-0001-net-phy-broadcom-support-new-device-flag-for-setting.patch +++ b/target/linux/generic/backport-4.14/076-v4.15-0001-net-phy-broadcom-support-new-device-flag-for-setting.patch @@ -29,7 +29,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/phy/broadcom.c +++ b/drivers/net/phy/broadcom.c -@@ -43,6 +43,12 @@ static int bcm54210e_config_init(struct +@@ -44,6 +44,12 @@ static int bcm54210e_config_init(struct val &= ~BCM54810_SHD_CLK_CTL_GTXCLK_EN; bcm_phy_write_shadow(phydev, BCM54810_SHD_CLK_CTL, val); diff --git a/target/linux/generic/backport-4.14/605-0002-tcp-avoid-min-RTT-bloat-by-skipping-RTT-from-delayed-ACK-.patch b/target/linux/generic/backport-4.14/605-0002-tcp-avoid-min-RTT-bloat-by-skipping-RTT-from-delayed-ACK-.patch index 7c1cc326e9..d0e75b39e0 100644 --- a/target/linux/generic/backport-4.14/605-0002-tcp-avoid-min-RTT-bloat-by-skipping-RTT-from-delayed-ACK-.patch +++ b/target/linux/generic/backport-4.14/605-0002-tcp-avoid-min-RTT-bloat-by-skipping-RTT-from-delayed-ACK-.patch @@ -28,7 +28,7 @@ Signed-off-by: UtsavisGreat --- a/include/net/tcp.h +++ b/include/net/tcp.h -@@ -998,6 +998,7 @@ struct rate_sample { +@@ -999,6 +999,7 @@ struct rate_sample { u32 prior_in_flight; /* in flight before this ACK */ bool is_app_limited; /* is sample from packet with bubble in pipe? */ bool is_retrans; /* is sample from retransmission? */ diff --git a/target/linux/generic/backport-4.14/605-0003-tcp_bbr-better-deal-with-suboptimal-GSO-II.patch b/target/linux/generic/backport-4.14/605-0003-tcp_bbr-better-deal-with-suboptimal-GSO-II.patch index d24dafaa9d..fd837787db 100644 --- a/target/linux/generic/backport-4.14/605-0003-tcp_bbr-better-deal-with-suboptimal-GSO-II.patch +++ b/target/linux/generic/backport-4.14/605-0003-tcp_bbr-better-deal-with-suboptimal-GSO-II.patch @@ -39,7 +39,7 @@ Signed-off-by: UtsavisGreat void __tcp_push_pending_frames(struct sock *sk, unsigned int cur_mss, int nonagle); int __tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb, int segs); -@@ -1025,8 +1023,8 @@ struct tcp_congestion_ops { +@@ -1026,8 +1024,8 @@ struct tcp_congestion_ops { u32 (*undo_cwnd)(struct sock *sk); /* hook for packet ack accounting (optional) */ void (*pkts_acked)(struct sock *sk, const struct ack_sample *sample); @@ -99,7 +99,7 @@ Signed-off-by: UtsavisGreat }; --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c -@@ -1696,8 +1696,8 @@ static bool tcp_nagle_check(bool partial +@@ -1697,8 +1697,8 @@ static bool tcp_nagle_check(bool partial /* Return how many segs we'd like on a TSO packet, * to send one TSO packet per ms */ @@ -110,7 +110,7 @@ Signed-off-by: UtsavisGreat { u32 bytes, segs; -@@ -1713,7 +1713,6 @@ u32 tcp_tso_autosize(const struct sock * +@@ -1714,7 +1714,6 @@ u32 tcp_tso_autosize(const struct sock * return segs; } @@ -118,7 +118,7 @@ Signed-off-by: UtsavisGreat /* Return the number of segments we want in the skb we are transmitting. * See if congestion control module wants to decide; otherwise, autosize. -@@ -1721,11 +1720,13 @@ EXPORT_SYMBOL(tcp_tso_autosize); +@@ -1722,11 +1721,13 @@ EXPORT_SYMBOL(tcp_tso_autosize); static u32 tcp_tso_segs(struct sock *sk, unsigned int mss_now) { const struct tcp_congestion_ops *ca_ops = inet_csk(sk)->icsk_ca_ops; diff --git a/target/linux/generic/backport-4.14/605-0006-tcp_bbr-fix-bbr-pacing-rate-for-internal-pacing.patch b/target/linux/generic/backport-4.14/605-0006-tcp_bbr-fix-bbr-pacing-rate-for-internal-pacing.patch index 50fb35efe1..29f8d41f88 100644 --- a/target/linux/generic/backport-4.14/605-0006-tcp_bbr-fix-bbr-pacing-rate-for-internal-pacing.patch +++ b/target/linux/generic/backport-4.14/605-0006-tcp_bbr-fix-bbr-pacing-rate-for-internal-pacing.patch @@ -23,7 +23,7 @@ Signed-off-by: UtsavisGreat --- a/include/net/tcp.h +++ b/include/net/tcp.h -@@ -1233,6 +1233,17 @@ static inline bool tcp_is_cwnd_limited(c +@@ -1234,6 +1234,17 @@ static inline bool tcp_is_cwnd_limited(c return tp->is_cwnd_limited; } @@ -58,7 +58,7 @@ Signed-off-by: UtsavisGreat rate *= USEC_PER_SEC; --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c -@@ -949,17 +949,6 @@ enum hrtimer_restart tcp_pace_kick(struc +@@ -950,17 +950,6 @@ enum hrtimer_restart tcp_pace_kick(struc return HRTIMER_NORESTART; } @@ -76,7 +76,7 @@ Signed-off-by: UtsavisGreat static void tcp_internal_pacing(struct sock *sk, const struct sk_buff *skb) { u64 len_ns; -@@ -971,9 +960,6 @@ static void tcp_internal_pacing(struct s +@@ -972,9 +961,6 @@ static void tcp_internal_pacing(struct s if (!rate || rate == ~0U) return; diff --git a/target/linux/generic/backport-4.9/024-1-tcp-tsq-add-tsq_flags-tsq_enum.patch b/target/linux/generic/backport-4.9/024-1-tcp-tsq-add-tsq_flags-tsq_enum.patch index 63cd4a1ade..bc18c715eb 100644 --- a/target/linux/generic/backport-4.9/024-1-tcp-tsq-add-tsq_flags-tsq_enum.patch +++ b/target/linux/generic/backport-4.9/024-1-tcp-tsq-add-tsq_flags-tsq_enum.patch @@ -45,7 +45,7 @@ Signed-off-by: David S. Miller return (struct tcp_sock *)sk; --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c -@@ -792,10 +792,10 @@ static void tcp_tasklet_func(unsigned lo +@@ -793,10 +793,10 @@ static void tcp_tasklet_func(unsigned lo } } @@ -60,7 +60,7 @@ Signed-off-by: David S. Miller /** * tcp_release_cb - tcp release_sock() callback * @sk: socket -@@ -816,7 +816,7 @@ void tcp_release_cb(struct sock *sk) +@@ -817,7 +817,7 @@ void tcp_release_cb(struct sock *sk) nflags = flags & ~TCP_DEFERRED_ALL; } while (cmpxchg(&tp->tsq_flags, flags, nflags) != flags); @@ -69,7 +69,7 @@ Signed-off-by: David S. Miller tcp_tsq_handler(sk); /* Here begins the tricky part : -@@ -830,15 +830,15 @@ void tcp_release_cb(struct sock *sk) +@@ -831,15 +831,15 @@ void tcp_release_cb(struct sock *sk) */ sock_release_ownership(sk); diff --git a/target/linux/generic/backport-4.9/024-2-tcp-tsq-remove-one-locked-operation-in-tcp_wfree.patch b/target/linux/generic/backport-4.9/024-2-tcp-tsq-remove-one-locked-operation-in-tcp_wfree.patch index 4eab1fa7d4..c5e7a77c26 100644 --- a/target/linux/generic/backport-4.9/024-2-tcp-tsq-remove-one-locked-operation-in-tcp_wfree.patch +++ b/target/linux/generic/backport-4.9/024-2-tcp-tsq-remove-one-locked-operation-in-tcp_wfree.patch @@ -17,7 +17,7 @@ Signed-off-by: David S. Miller --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c -@@ -868,6 +868,7 @@ void tcp_wfree(struct sk_buff *skb) +@@ -869,6 +869,7 @@ void tcp_wfree(struct sk_buff *skb) { struct sock *sk = skb->sk; struct tcp_sock *tp = tcp_sk(sk); @@ -25,7 +25,7 @@ Signed-off-by: David S. Miller int wmem; /* Keep one reference on sk_wmem_alloc. -@@ -885,11 +886,17 @@ void tcp_wfree(struct sk_buff *skb) +@@ -886,11 +887,17 @@ void tcp_wfree(struct sk_buff *skb) if (wmem >= SKB_TRUESIZE(1) && this_cpu_ksoftirqd() == current) goto out; diff --git a/target/linux/generic/backport-4.9/024-3-tcp-tsq-add-shortcut-in-tcp_tasklet_func.patch b/target/linux/generic/backport-4.9/024-3-tcp-tsq-add-shortcut-in-tcp_tasklet_func.patch index 0d4394b6f4..5d2e055ae5 100644 --- a/target/linux/generic/backport-4.9/024-3-tcp-tsq-add-shortcut-in-tcp_tasklet_func.patch +++ b/target/linux/generic/backport-4.9/024-3-tcp-tsq-add-shortcut-in-tcp_tasklet_func.patch @@ -22,7 +22,7 @@ Signed-off-by: David S. Miller --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c -@@ -775,19 +775,19 @@ static void tcp_tasklet_func(unsigned lo +@@ -776,19 +776,19 @@ static void tcp_tasklet_func(unsigned lo list_for_each_safe(q, n, &list) { tp = list_entry(q, struct tcp_sock, tsq_node); list_del(&tp->tsq_node); @@ -51,7 +51,7 @@ Signed-off-by: David S. Miller sk_free(sk); } } -@@ -892,7 +892,7 @@ void tcp_wfree(struct sk_buff *skb) +@@ -893,7 +893,7 @@ void tcp_wfree(struct sk_buff *skb) if (!(oval & TSQF_THROTTLED) || (oval & TSQF_QUEUED)) goto out; @@ -60,7 +60,7 @@ Signed-off-by: David S. Miller nval = cmpxchg(&tp->tsq_flags, oval, nval); if (nval != oval) continue; -@@ -2241,6 +2241,8 @@ static bool tcp_write_xmit(struct sock * +@@ -2242,6 +2242,8 @@ static bool tcp_write_xmit(struct sock * unlikely(tso_fragment(sk, skb, limit, mss_now, gfp))) break; diff --git a/target/linux/generic/backport-4.9/024-4-tcp-tsq-avoid-one-atomic-in-tcp_wfree.patch b/target/linux/generic/backport-4.9/024-4-tcp-tsq-avoid-one-atomic-in-tcp_wfree.patch index aaacda5e14..37f7f6fe08 100644 --- a/target/linux/generic/backport-4.9/024-4-tcp-tsq-avoid-one-atomic-in-tcp_wfree.patch +++ b/target/linux/generic/backport-4.9/024-4-tcp-tsq-avoid-one-atomic-in-tcp_wfree.patch @@ -16,7 +16,7 @@ Signed-off-by: David S. Miller --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c -@@ -888,6 +888,7 @@ void tcp_wfree(struct sk_buff *skb) +@@ -889,6 +889,7 @@ void tcp_wfree(struct sk_buff *skb) for (oval = READ_ONCE(tp->tsq_flags);; oval = nval) { struct tsq_tasklet *tsq; @@ -24,7 +24,7 @@ Signed-off-by: David S. Miller if (!(oval & TSQF_THROTTLED) || (oval & TSQF_QUEUED)) goto out; -@@ -900,8 +901,10 @@ void tcp_wfree(struct sk_buff *skb) +@@ -901,8 +902,10 @@ void tcp_wfree(struct sk_buff *skb) /* queue this socket to tasklet queue */ local_irq_save(flags); tsq = this_cpu_ptr(&tsq_tasklet); diff --git a/target/linux/generic/backport-4.9/024-5-tcp-tsq-add-a-shortcut-in-tcp_small_queue_check.patch b/target/linux/generic/backport-4.9/024-5-tcp-tsq-add-a-shortcut-in-tcp_small_queue_check.patch index f844412545..59de49cb16 100644 --- a/target/linux/generic/backport-4.9/024-5-tcp-tsq-add-a-shortcut-in-tcp_small_queue_check.patch +++ b/target/linux/generic/backport-4.9/024-5-tcp-tsq-add-a-shortcut-in-tcp_small_queue_check.patch @@ -19,7 +19,7 @@ Signed-off-by: David S. Miller --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c -@@ -2146,6 +2146,15 @@ static bool tcp_small_queue_check(struct +@@ -2147,6 +2147,15 @@ static bool tcp_small_queue_check(struct limit <<= factor; if (atomic_read(&sk->sk_wmem_alloc) > limit) { diff --git a/target/linux/generic/backport-4.9/024-6-tcp-tcp_mtu_probe-is-likely-to-exit-early.patch b/target/linux/generic/backport-4.9/024-6-tcp-tcp_mtu_probe-is-likely-to-exit-early.patch index c83a699046..9382b478cb 100644 --- a/target/linux/generic/backport-4.9/024-6-tcp-tcp_mtu_probe-is-likely-to-exit-early.patch +++ b/target/linux/generic/backport-4.9/024-6-tcp-tcp_mtu_probe-is-likely-to-exit-early.patch @@ -17,7 +17,7 @@ Signed-off-by: David S. Miller --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c -@@ -1978,26 +1978,26 @@ static bool tcp_can_coalesce_send_queue_ +@@ -1979,26 +1979,26 @@ static bool tcp_can_coalesce_send_queue_ */ static int tcp_mtu_probe(struct sock *sk) { diff --git a/target/linux/generic/backport-4.9/024-8-tcp-tsq-move-tsq_flags-close-to-sk_wmem_alloc.patch b/target/linux/generic/backport-4.9/024-8-tcp-tsq-move-tsq_flags-close-to-sk_wmem_alloc.patch index 5168e56178..4d2c6a0657 100644 --- a/target/linux/generic/backport-4.9/024-8-tcp-tsq-move-tsq_flags-close-to-sk_wmem_alloc.patch +++ b/target/linux/generic/backport-4.9/024-8-tcp-tsq-move-tsq_flags-close-to-sk_wmem_alloc.patch @@ -58,7 +58,7 @@ Signed-off-by: David S. Miller goto out; --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c -@@ -775,14 +775,15 @@ static void tcp_tasklet_func(unsigned lo +@@ -776,14 +776,15 @@ static void tcp_tasklet_func(unsigned lo list_for_each_safe(q, n, &list) { tp = list_entry(q, struct tcp_sock, tsq_node); list_del(&tp->tsq_node); @@ -77,7 +77,7 @@ Signed-off-by: David S. Miller tcp_tsq_handler(sk); } bh_unlock_sock(sk); -@@ -805,16 +806,15 @@ static void tcp_tasklet_func(unsigned lo +@@ -806,16 +807,15 @@ static void tcp_tasklet_func(unsigned lo */ void tcp_release_cb(struct sock *sk) { @@ -96,7 +96,7 @@ Signed-off-by: David S. Miller if (flags & TCPF_TSQ_DEFERRED) tcp_tsq_handler(sk); -@@ -886,7 +886,7 @@ void tcp_wfree(struct sk_buff *skb) +@@ -887,7 +887,7 @@ void tcp_wfree(struct sk_buff *skb) if (wmem >= SKB_TRUESIZE(1) && this_cpu_ksoftirqd() == current) goto out; @@ -105,7 +105,7 @@ Signed-off-by: David S. Miller struct tsq_tasklet *tsq; bool empty; -@@ -894,7 +894,7 @@ void tcp_wfree(struct sk_buff *skb) +@@ -895,7 +895,7 @@ void tcp_wfree(struct sk_buff *skb) goto out; nval = (oval & ~TSQF_THROTTLED) | TSQF_QUEUED | TCPF_TSQ_DEFERRED; @@ -114,7 +114,7 @@ Signed-off-by: David S. Miller if (nval != oval) continue; -@@ -2155,7 +2155,7 @@ static bool tcp_small_queue_check(struct +@@ -2156,7 +2156,7 @@ static bool tcp_small_queue_check(struct skb->prev == sk->sk_write_queue.next) return false; @@ -123,7 +123,7 @@ Signed-off-by: David S. Miller /* It is possible TX completion already happened * before we set TSQ_THROTTLED, so we must * test again the condition. -@@ -2253,8 +2253,8 @@ static bool tcp_write_xmit(struct sock * +@@ -2254,8 +2254,8 @@ static bool tcp_write_xmit(struct sock * unlikely(tso_fragment(sk, skb, limit, mss_now, gfp))) break; @@ -134,7 +134,7 @@ Signed-off-by: David S. Miller if (tcp_small_queue_check(sk, skb, 0)) break; -@@ -3578,8 +3578,6 @@ void __tcp_send_ack(struct sock *sk, u32 +@@ -3579,8 +3579,6 @@ void __tcp_send_ack(struct sock *sk, u32 /* We do not want pure acks influencing TCP Small Queues or fq/pacing * too much. * SKB_TRUESIZE(max(1 .. 66, MAX_TCP_HEADER)) is unfortunately ~784 diff --git a/target/linux/generic/backport-4.9/024-9-tcp-add-a-missing-barrier-in-tcp_tasklet_func.patch b/target/linux/generic/backport-4.9/024-9-tcp-add-a-missing-barrier-in-tcp_tasklet_func.patch index a6721f26f5..9447531f4b 100644 --- a/target/linux/generic/backport-4.9/024-9-tcp-add-a-missing-barrier-in-tcp_tasklet_func.patch +++ b/target/linux/generic/backport-4.9/024-9-tcp-add-a-missing-barrier-in-tcp_tasklet_func.patch @@ -30,7 +30,7 @@ Signed-off-by: David S. Miller --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c -@@ -777,6 +777,7 @@ static void tcp_tasklet_func(unsigned lo +@@ -778,6 +778,7 @@ static void tcp_tasklet_func(unsigned lo list_del(&tp->tsq_node); sk = (struct sock *)tp; diff --git a/target/linux/generic/backport-4.9/025-tcp-allow-drivers-to-tweak-TSQ-logic.patch b/target/linux/generic/backport-4.9/025-tcp-allow-drivers-to-tweak-TSQ-logic.patch index e0e06e692e..7c4bb3ccf9 100644 --- a/target/linux/generic/backport-4.9/025-tcp-allow-drivers-to-tweak-TSQ-logic.patch +++ b/target/linux/generic/backport-4.9/025-tcp-allow-drivers-to-tweak-TSQ-logic.patch @@ -65,7 +65,7 @@ Cc: Kir Kolyshkin * Before updating sk_refcnt, we must commit prior changes to memory --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c -@@ -1611,7 +1611,7 @@ u32 tcp_tso_autosize(const struct sock * +@@ -1612,7 +1612,7 @@ u32 tcp_tso_autosize(const struct sock * { u32 bytes, segs; @@ -74,7 +74,7 @@ Cc: Kir Kolyshkin sk->sk_gso_max_size - 1 - MAX_TCP_HEADER); /* Goal is to send at least one packet per ms, -@@ -2142,7 +2142,7 @@ static bool tcp_small_queue_check(struct +@@ -2143,7 +2143,7 @@ static bool tcp_small_queue_check(struct { unsigned int limit; diff --git a/target/linux/generic/backport-4.9/075-v4.10-0002-net-phy-broadcom-Add-support-for-BCM54612E.patch b/target/linux/generic/backport-4.9/075-v4.10-0002-net-phy-broadcom-Add-support-for-BCM54612E.patch index 4caa7b193d..84d881669c 100644 --- a/target/linux/generic/backport-4.9/075-v4.10-0002-net-phy-broadcom-Add-support-for-BCM54612E.patch +++ b/target/linux/generic/backport-4.9/075-v4.10-0002-net-phy-broadcom-Add-support-for-BCM54612E.patch @@ -13,7 +13,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/phy/broadcom.c +++ b/drivers/net/phy/broadcom.c -@@ -337,6 +337,41 @@ static int bcm5481_config_aneg(struct ph +@@ -338,6 +338,41 @@ static int bcm5481_config_aneg(struct ph return ret; } @@ -55,7 +55,7 @@ Signed-off-by: David S. Miller static int brcm_phy_setbits(struct phy_device *phydev, int reg, int set) { int val; -@@ -485,6 +520,18 @@ static struct phy_driver broadcom_driver +@@ -506,6 +541,18 @@ static struct phy_driver broadcom_driver .ack_interrupt = bcm_phy_ack_intr, .config_intr = bcm_phy_config_intr, }, { @@ -74,7 +74,7 @@ Signed-off-by: David S. Miller .phy_id = PHY_ID_BCM54616S, .phy_id_mask = 0xfffffff0, .name = "Broadcom BCM54616S", -@@ -600,6 +647,7 @@ static struct mdio_device_id __maybe_unu +@@ -621,6 +668,7 @@ static struct mdio_device_id __maybe_unu { PHY_ID_BCM5411, 0xfffffff0 }, { PHY_ID_BCM5421, 0xfffffff0 }, { PHY_ID_BCM5461, 0xfffffff0 }, diff --git a/target/linux/generic/backport-4.9/075-v4.10-0003-net-phy-broadcom-add-bcm54xx_auxctl_read.patch b/target/linux/generic/backport-4.9/075-v4.10-0003-net-phy-broadcom-add-bcm54xx_auxctl_read.patch index c9b3b5911e..30f3d9c478 100644 --- a/target/linux/generic/backport-4.9/075-v4.10-0003-net-phy-broadcom-add-bcm54xx_auxctl_read.patch +++ b/target/linux/generic/backport-4.9/075-v4.10-0003-net-phy-broadcom-add-bcm54xx_auxctl_read.patch @@ -12,7 +12,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/phy/broadcom.c +++ b/drivers/net/phy/broadcom.c -@@ -30,6 +30,16 @@ MODULE_DESCRIPTION("Broadcom PHY driver" +@@ -31,6 +31,16 @@ MODULE_DESCRIPTION("Broadcom PHY driver" MODULE_AUTHOR("Maciej W. Rozycki"); MODULE_LICENSE("GPL"); diff --git a/target/linux/generic/backport-4.9/075-v4.10-0004-net-phy-broadcom-Add-BCM54810-PHY-entry.patch b/target/linux/generic/backport-4.9/075-v4.10-0004-net-phy-broadcom-Add-BCM54810-PHY-entry.patch index 34d86e6644..046a53551e 100644 --- a/target/linux/generic/backport-4.9/075-v4.10-0004-net-phy-broadcom-Add-BCM54810-PHY-entry.patch +++ b/target/linux/generic/backport-4.9/075-v4.10-0004-net-phy-broadcom-Add-BCM54810-PHY-entry.patch @@ -17,7 +17,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/phy/broadcom.c +++ b/drivers/net/phy/broadcom.c -@@ -18,7 +18,7 @@ +@@ -19,7 +19,7 @@ #include #include #include @@ -26,7 +26,7 @@ Signed-off-by: David S. Miller #define BRCM_PHY_MODEL(phydev) \ ((phydev)->drv->phy_id & (phydev)->drv->phy_id_mask) -@@ -45,6 +45,34 @@ static int bcm54xx_auxctl_write(struct p +@@ -46,6 +46,34 @@ static int bcm54xx_auxctl_write(struct p return phy_write(phydev, MII_BCM54XX_AUX_CTL, regnum | val); } @@ -61,7 +61,7 @@ Signed-off-by: David S. Miller /* Needs SMDSP clock enabled via bcm54xx_phydsp_config() */ static int bcm50610_a0_workaround(struct phy_device *phydev) { -@@ -217,6 +245,12 @@ static int bcm54xx_config_init(struct ph +@@ -218,6 +246,12 @@ static int bcm54xx_config_init(struct ph (phydev->dev_flags & PHY_BRCM_AUTO_PWRDWN_ENABLE)) bcm54xx_adjust_rxrefclk(phydev); @@ -74,7 +74,7 @@ Signed-off-by: David S. Miller bcm54xx_phydsp_config(phydev); return 0; -@@ -314,6 +348,7 @@ static int bcm5482_read_status(struct ph +@@ -315,6 +349,7 @@ static int bcm5482_read_status(struct ph static int bcm5481_config_aneg(struct phy_device *phydev) { @@ -82,7 +82,7 @@ Signed-off-by: David S. Miller int ret; /* Aneg firsly. */ -@@ -344,6 +379,14 @@ static int bcm5481_config_aneg(struct ph +@@ -345,6 +380,14 @@ static int bcm5481_config_aneg(struct ph phy_write(phydev, 0x18, reg); } @@ -97,7 +97,7 @@ Signed-off-by: David S. Miller return ret; } -@@ -578,6 +621,18 @@ static struct phy_driver broadcom_driver +@@ -599,6 +642,18 @@ static struct phy_driver broadcom_driver .ack_interrupt = bcm_phy_ack_intr, .config_intr = bcm_phy_config_intr, }, { @@ -116,7 +116,7 @@ Signed-off-by: David S. Miller .phy_id = PHY_ID_BCM5482, .phy_id_mask = 0xfffffff0, .name = "Broadcom BCM5482", -@@ -661,6 +716,7 @@ static struct mdio_device_id __maybe_unu +@@ -682,6 +737,7 @@ static struct mdio_device_id __maybe_unu { PHY_ID_BCM54616S, 0xfffffff0 }, { PHY_ID_BCM5464, 0xfffffff0 }, { PHY_ID_BCM5481, 0xfffffff0 }, diff --git a/target/linux/generic/backport-4.9/075-v4.10-0005-net-phy-broadcom-Move-bcm54xx_auxctl_-read-write-to-.patch b/target/linux/generic/backport-4.9/075-v4.10-0005-net-phy-broadcom-Move-bcm54xx_auxctl_-read-write-to-.patch index c8bf54c781..347e0f7140 100644 --- a/target/linux/generic/backport-4.9/075-v4.10-0005-net-phy-broadcom-Move-bcm54xx_auxctl_-read-write-to-.patch +++ b/target/linux/generic/backport-4.9/075-v4.10-0005-net-phy-broadcom-Move-bcm54xx_auxctl_-read-write-to-.patch @@ -50,7 +50,7 @@ Signed-off-by: David S. Miller int bcm_phy_read_misc(struct phy_device *phydev, --- a/drivers/net/phy/broadcom.c +++ b/drivers/net/phy/broadcom.c -@@ -30,21 +30,6 @@ MODULE_DESCRIPTION("Broadcom PHY driver" +@@ -31,21 +31,6 @@ MODULE_DESCRIPTION("Broadcom PHY driver" MODULE_AUTHOR("Maciej W. Rozycki"); MODULE_LICENSE("GPL"); diff --git a/target/linux/generic/backport-4.9/076-v4.11-0005-net-phy-broadcom-use-auxctl-reading-helper-in-BCM546.patch b/target/linux/generic/backport-4.9/076-v4.11-0005-net-phy-broadcom-use-auxctl-reading-helper-in-BCM546.patch index 554e3117d8..0de00bee32 100644 --- a/target/linux/generic/backport-4.9/076-v4.11-0005-net-phy-broadcom-use-auxctl-reading-helper-in-BCM546.patch +++ b/target/linux/generic/backport-4.9/076-v4.11-0005-net-phy-broadcom-use-auxctl-reading-helper-in-BCM546.patch @@ -20,7 +20,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/phy/broadcom.c +++ b/drivers/net/phy/broadcom.c -@@ -395,10 +395,8 @@ static int bcm54612e_config_aneg(struct +@@ -396,10 +396,8 @@ static int bcm54612e_config_aneg(struct (phydev->interface != PHY_INTERFACE_MODE_RGMII_RXID)) { u16 reg; diff --git a/target/linux/generic/backport-4.9/076-v4.11-0006-net-phy-broadcom-add-support-for-BCM54210E.patch b/target/linux/generic/backport-4.9/076-v4.11-0006-net-phy-broadcom-add-support-for-BCM54210E.patch index 5fa7e88c53..77d70a70f3 100644 --- a/target/linux/generic/backport-4.9/076-v4.11-0006-net-phy-broadcom-add-support-for-BCM54210E.patch +++ b/target/linux/generic/backport-4.9/076-v4.11-0006-net-phy-broadcom-add-support-for-BCM54210E.patch @@ -15,7 +15,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/phy/broadcom.c +++ b/drivers/net/phy/broadcom.c -@@ -30,6 +30,22 @@ MODULE_DESCRIPTION("Broadcom PHY driver" +@@ -31,6 +31,22 @@ MODULE_DESCRIPTION("Broadcom PHY driver" MODULE_AUTHOR("Maciej W. Rozycki"); MODULE_LICENSE("GPL"); @@ -38,7 +38,7 @@ Signed-off-by: David S. Miller static int bcm54810_config(struct phy_device *phydev) { int rc, val; -@@ -230,7 +246,11 @@ static int bcm54xx_config_init(struct ph +@@ -231,7 +247,11 @@ static int bcm54xx_config_init(struct ph (phydev->dev_flags & PHY_BRCM_AUTO_PWRDWN_ENABLE)) bcm54xx_adjust_rxrefclk(phydev); @@ -51,7 +51,7 @@ Signed-off-by: David S. Miller err = bcm54810_config(phydev); if (err) return err; -@@ -544,6 +564,17 @@ static struct phy_driver broadcom_driver +@@ -565,6 +585,17 @@ static struct phy_driver broadcom_driver .ack_interrupt = bcm_phy_ack_intr, .config_intr = bcm_phy_config_intr, }, { @@ -69,7 +69,7 @@ Signed-off-by: David S. Miller .phy_id = PHY_ID_BCM5461, .phy_id_mask = 0xfffffff0, .name = "Broadcom BCM5461", -@@ -694,6 +725,7 @@ module_phy_driver(broadcom_drivers); +@@ -715,6 +746,7 @@ module_phy_driver(broadcom_drivers); static struct mdio_device_id __maybe_unused broadcom_tbl[] = { { PHY_ID_BCM5411, 0xfffffff0 }, { PHY_ID_BCM5421, 0xfffffff0 }, diff --git a/target/linux/generic/backport-4.9/076-v4.11-0007-net-phy-broadcom-rehook-BCM54612E-specific-init.patch b/target/linux/generic/backport-4.9/076-v4.11-0007-net-phy-broadcom-rehook-BCM54612E-specific-init.patch index b7326c3df4..af01653d69 100644 --- a/target/linux/generic/backport-4.9/076-v4.11-0007-net-phy-broadcom-rehook-BCM54612E-specific-init.patch +++ b/target/linux/generic/backport-4.9/076-v4.11-0007-net-phy-broadcom-rehook-BCM54612E-specific-init.patch @@ -24,7 +24,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/phy/broadcom.c +++ b/drivers/net/phy/broadcom.c -@@ -46,6 +46,34 @@ static int bcm54210e_config_init(struct +@@ -47,6 +47,34 @@ static int bcm54210e_config_init(struct return 0; } @@ -59,7 +59,7 @@ Signed-off-by: David S. Miller static int bcm54810_config(struct phy_device *phydev) { int rc, val; -@@ -250,6 +278,10 @@ static int bcm54xx_config_init(struct ph +@@ -251,6 +279,10 @@ static int bcm54xx_config_init(struct ph err = bcm54210e_config_init(phydev); if (err) return err; @@ -70,7 +70,7 @@ Signed-off-by: David S. Miller } else if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54810) { err = bcm54810_config(phydev); if (err) -@@ -395,39 +427,6 @@ static int bcm5481_config_aneg(struct ph +@@ -396,39 +428,6 @@ static int bcm5481_config_aneg(struct ph return ret; } @@ -110,7 +110,7 @@ Signed-off-by: David S. Miller static int brcm_phy_setbits(struct phy_device *phydev, int reg, int set) { int val; -@@ -594,7 +593,7 @@ static struct phy_driver broadcom_driver +@@ -615,7 +614,7 @@ static struct phy_driver broadcom_driver SUPPORTED_Pause | SUPPORTED_Asym_Pause, .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, .config_init = bcm54xx_config_init, diff --git a/target/linux/generic/backport-4.9/076-v4.15-0001-net-phy-broadcom-support-new-device-flag-for-setting.patch b/target/linux/generic/backport-4.9/076-v4.15-0001-net-phy-broadcom-support-new-device-flag-for-setting.patch index 334c444692..7de145398f 100644 --- a/target/linux/generic/backport-4.9/076-v4.15-0001-net-phy-broadcom-support-new-device-flag-for-setting.patch +++ b/target/linux/generic/backport-4.9/076-v4.15-0001-net-phy-broadcom-support-new-device-flag-for-setting.patch @@ -29,7 +29,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/phy/broadcom.c +++ b/drivers/net/phy/broadcom.c -@@ -43,6 +43,12 @@ static int bcm54210e_config_init(struct +@@ -44,6 +44,12 @@ static int bcm54210e_config_init(struct val &= ~BCM54810_SHD_CLK_CTL_GTXCLK_EN; bcm_phy_write_shadow(phydev, BCM54810_SHD_CLK_CTL, val); diff --git a/target/linux/generic/backport-4.9/605-0001-tcp-internal-implementation-for-pacing.patch b/target/linux/generic/backport-4.9/605-0001-tcp-internal-implementation-for-pacing.patch index 3164151865..fd78f4ff97 100644 --- a/target/linux/generic/backport-4.9/605-0001-tcp-internal-implementation-for-pacing.patch +++ b/target/linux/generic/backport-4.9/605-0001-tcp-internal-implementation-for-pacing.patch @@ -138,7 +138,7 @@ Signed-off-by: Albert I #define rcu_dereference_sk_user_data(sk) rcu_dereference(__sk_user_data((sk))) --- a/include/net/tcp.h +++ b/include/net/tcp.h -@@ -584,6 +584,7 @@ void tcp_fin(struct sock *sk); +@@ -585,6 +585,7 @@ void tcp_check_space(struct sock *sk); void tcp_init_xmit_timers(struct sock *); static inline void tcp_clear_xmit_timers(struct sock *sk) { @@ -146,7 +146,7 @@ Signed-off-by: Albert I inet_csk_clear_xmit_timers(sk); } -@@ -1970,4 +1971,6 @@ static inline void tcp_listendrop(const +@@ -1971,4 +1972,6 @@ static inline void tcp_listendrop(const __NET_INC_STATS(sock_net(sk), LINUX_MIB_LISTENDROPS); } @@ -193,7 +193,7 @@ Signed-off-by: Albert I static u32 bbr_sndbuf_expand(struct sock *sk) --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c -@@ -913,6 +913,72 @@ out: +@@ -914,6 +914,72 @@ out: sk_free(sk); } @@ -266,7 +266,7 @@ Signed-off-by: Albert I /* This routine actually transmits TCP packets queued in by * tcp_do_sendmsg(). This is used by both the initial * transmission and possible later retransmissions. -@@ -1034,6 +1100,7 @@ static int __tcp_transmit_skb(struct soc +@@ -1035,6 +1101,7 @@ static int __tcp_transmit_skb(struct soc if (skb->len != tcp_header_size) { tcp_event_data_sent(tp, sk); tp->data_segs_out += tcp_skb_pcount(skb); @@ -274,7 +274,7 @@ Signed-off-by: Albert I } if (after(tcb->end_seq, tp->snd_nxt) || tcb->seq == tcb->end_seq) -@@ -2126,6 +2193,12 @@ static int tcp_mtu_probe(struct sock *sk +@@ -2127,6 +2194,12 @@ static int tcp_mtu_probe(struct sock *sk return -1; } @@ -287,7 +287,7 @@ Signed-off-by: Albert I /* TCP Small Queues : * Control number of packets in qdisc/devices to two packets / or ~1 ms. * (These limits are doubled for retransmits) -@@ -2209,6 +2282,9 @@ static bool tcp_write_xmit(struct sock * +@@ -2210,6 +2283,9 @@ static bool tcp_write_xmit(struct sock * while ((skb = tcp_send_head(sk))) { unsigned int limit; @@ -297,7 +297,7 @@ Signed-off-by: Albert I tso_segs = tcp_init_tso_segs(skb, mss_now); BUG_ON(!tso_segs); -@@ -2933,6 +3009,10 @@ void tcp_xmit_retransmit_queue(struct so +@@ -2934,6 +3010,10 @@ void tcp_xmit_retransmit_queue(struct so if (skb == tcp_send_head(sk)) break; diff --git a/target/linux/generic/backport-4.9/605-0003-tcp-avoid-min-RTT-bloat-by-skipping-RTT-from-delayed-ACK-.patch b/target/linux/generic/backport-4.9/605-0003-tcp-avoid-min-RTT-bloat-by-skipping-RTT-from-delayed-ACK-.patch index 7ccb01bead..656e9c8351 100644 --- a/target/linux/generic/backport-4.9/605-0003-tcp-avoid-min-RTT-bloat-by-skipping-RTT-from-delayed-ACK-.patch +++ b/target/linux/generic/backport-4.9/605-0003-tcp-avoid-min-RTT-bloat-by-skipping-RTT-from-delayed-ACK-.patch @@ -28,7 +28,7 @@ Signed-off-by: Albert I --- a/include/net/tcp.h +++ b/include/net/tcp.h -@@ -911,6 +911,7 @@ struct rate_sample { +@@ -912,6 +912,7 @@ struct rate_sample { u32 prior_in_flight; /* in flight before this ACK */ bool is_app_limited; /* is sample from packet with bubble in pipe? */ bool is_retrans; /* is sample from retransmission? */ diff --git a/target/linux/generic/backport-4.9/605-0004-tcp_bbr-better-deal-with-suboptimal-GSO-II.patch b/target/linux/generic/backport-4.9/605-0004-tcp_bbr-better-deal-with-suboptimal-GSO-II.patch index 41410bf84b..529267c6c0 100644 --- a/target/linux/generic/backport-4.9/605-0004-tcp_bbr-better-deal-with-suboptimal-GSO-II.patch +++ b/target/linux/generic/backport-4.9/605-0004-tcp_bbr-better-deal-with-suboptimal-GSO-II.patch @@ -41,7 +41,7 @@ Signed-off-by: Albert I void __tcp_push_pending_frames(struct sock *sk, unsigned int cur_mss, int nonagle); bool tcp_may_send_now(struct sock *sk); -@@ -938,8 +936,8 @@ struct tcp_congestion_ops { +@@ -939,8 +937,8 @@ struct tcp_congestion_ops { u32 (*undo_cwnd)(struct sock *sk); /* hook for packet ack accounting (optional) */ void (*pkts_acked)(struct sock *sk, const struct ack_sample *sample); @@ -101,7 +101,7 @@ Signed-off-by: Albert I }; --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c -@@ -1673,8 +1673,8 @@ static bool tcp_nagle_check(bool partial +@@ -1674,8 +1674,8 @@ static bool tcp_nagle_check(bool partial /* Return how many segs we'd like on a TSO packet, * to send one TSO packet per ms */ @@ -112,7 +112,7 @@ Signed-off-by: Albert I { u32 bytes, segs; -@@ -1690,7 +1690,6 @@ u32 tcp_tso_autosize(const struct sock * +@@ -1691,7 +1691,6 @@ u32 tcp_tso_autosize(const struct sock * return segs; } @@ -120,7 +120,7 @@ Signed-off-by: Albert I /* Return the number of segments we want in the skb we are transmitting. * See if congestion control module wants to decide; otherwise, autosize. -@@ -1698,11 +1697,13 @@ EXPORT_SYMBOL(tcp_tso_autosize); +@@ -1699,11 +1698,13 @@ EXPORT_SYMBOL(tcp_tso_autosize); static u32 tcp_tso_segs(struct sock *sk, unsigned int mss_now) { const struct tcp_congestion_ops *ca_ops = inet_csk(sk)->icsk_ca_ops; diff --git a/target/linux/generic/backport-4.9/605-0007-tcp_bbr-fix-bbr-pacing-rate-for-internal-pacing.patch b/target/linux/generic/backport-4.9/605-0007-tcp_bbr-fix-bbr-pacing-rate-for-internal-pacing.patch index 202ed2d9aa..3e90297235 100644 --- a/target/linux/generic/backport-4.9/605-0007-tcp_bbr-fix-bbr-pacing-rate-for-internal-pacing.patch +++ b/target/linux/generic/backport-4.9/605-0007-tcp_bbr-fix-bbr-pacing-rate-for-internal-pacing.patch @@ -23,7 +23,7 @@ Signed-off-by: Albert I --- a/include/net/tcp.h +++ b/include/net/tcp.h -@@ -1161,6 +1161,17 @@ static inline bool tcp_is_cwnd_limited(c +@@ -1162,6 +1162,17 @@ static inline bool tcp_is_cwnd_limited(c return tp->is_cwnd_limited; } @@ -58,7 +58,7 @@ Signed-off-by: Albert I rate *= USEC_PER_SEC; --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c -@@ -947,17 +947,6 @@ enum hrtimer_restart tcp_pace_kick(struc +@@ -948,17 +948,6 @@ enum hrtimer_restart tcp_pace_kick(struc return HRTIMER_NORESTART; } @@ -76,7 +76,7 @@ Signed-off-by: Albert I static void tcp_internal_pacing(struct sock *sk, const struct sk_buff *skb) { u64 len_ns; -@@ -969,9 +958,6 @@ static void tcp_internal_pacing(struct s +@@ -970,9 +959,6 @@ static void tcp_internal_pacing(struct s if (!rate || rate == ~0U) return; diff --git a/target/linux/generic/hack-4.14/998-usb-serial-option-add-u9300.patch b/target/linux/generic/hack-4.14/998-usb-serial-option-add-u9300.patch index c57a1342e5..2c41f2bdeb 100644 --- a/target/linux/generic/hack-4.14/998-usb-serial-option-add-u9300.patch +++ b/target/linux/generic/hack-4.14/998-usb-serial-option-add-u9300.patch @@ -18,7 +18,7 @@ /* 4G Systems products */ /* This is the 4G XS Stick W14 a.k.a. Mobilcom Debitel Surf-Stick * -@@ -588,6 +589,16 @@ static void option_instat_callback(struc +@@ -590,6 +591,16 @@ static void option_instat_callback(struc /* Device needs ZLP */ #define ZLP BIT(17) @@ -35,7 +35,7 @@ static const struct usb_device_id option_ids[] = { { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, -@@ -622,6 +633,8 @@ static const struct usb_device_id option +@@ -624,6 +635,8 @@ static const struct usb_device_id option { USB_DEVICE(QUANTA_VENDOR_ID, QUANTA_PRODUCT_GLE) }, { USB_DEVICE(QUANTA_VENDOR_ID, 0xea42), .driver_info = RSVD(4) }, diff --git a/target/linux/generic/hack-4.19/998-usb-serial-option-add-u9300.patch b/target/linux/generic/hack-4.19/998-usb-serial-option-add-u9300.patch index 0908aae72d..5b759be687 100644 --- a/target/linux/generic/hack-4.19/998-usb-serial-option-add-u9300.patch +++ b/target/linux/generic/hack-4.19/998-usb-serial-option-add-u9300.patch @@ -18,7 +18,7 @@ /* 4G Systems products */ /* This is the 4G XS Stick W14 a.k.a. Mobilcom Debitel Surf-Stick * -@@ -585,6 +586,16 @@ static void option_instat_callback(struc +@@ -587,6 +588,16 @@ static void option_instat_callback(struc /* Device needs ZLP */ #define ZLP BIT(17) @@ -35,7 +35,7 @@ static const struct usb_device_id option_ids[] = { { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, -@@ -619,6 +630,8 @@ static const struct usb_device_id option +@@ -621,6 +632,8 @@ static const struct usb_device_id option { USB_DEVICE(QUANTA_VENDOR_ID, QUANTA_PRODUCT_GLE) }, { USB_DEVICE(QUANTA_VENDOR_ID, 0xea42), .driver_info = RSVD(4) }, diff --git a/target/linux/generic/pending-4.14/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch b/target/linux/generic/pending-4.14/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch index 992aa4662e..63c9c0c956 100644 --- a/target/linux/generic/pending-4.14/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch +++ b/target/linux/generic/pending-4.14/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch @@ -8,7 +8,7 @@ Signed-off-by: Daniel Golle --- a/drivers/mtd/ubi/build.c +++ b/drivers/mtd/ubi/build.c -@@ -1172,6 +1172,73 @@ static struct mtd_info * __init open_mtd +@@ -1165,6 +1165,73 @@ static struct mtd_info * __init open_mtd return mtd; } @@ -82,7 +82,7 @@ Signed-off-by: Daniel Golle static int __init ubi_init(void) { int err, i, k; -@@ -1255,6 +1322,12 @@ static int __init ubi_init(void) +@@ -1248,6 +1315,12 @@ static int __init ubi_init(void) } } diff --git a/target/linux/generic/pending-4.14/532-jffs2_eofdetect.patch b/target/linux/generic/pending-4.14/532-jffs2_eofdetect.patch index e9952c6d84..d760d06483 100644 --- a/target/linux/generic/pending-4.14/532-jffs2_eofdetect.patch +++ b/target/linux/generic/pending-4.14/532-jffs2_eofdetect.patch @@ -45,7 +45,7 @@ Signed-off-by: Felix Fietkau if (ret < 0) goto out; -@@ -561,6 +567,17 @@ full_scan: +@@ -563,6 +569,17 @@ full_scan: return err; } diff --git a/target/linux/generic/pending-4.14/601-add-kernel-imq-support.patch b/target/linux/generic/pending-4.14/601-add-kernel-imq-support.patch index 1e57fcf500..ff6fcc8c95 100644 --- a/target/linux/generic/pending-4.14/601-add-kernel-imq-support.patch +++ b/target/linux/generic/pending-4.14/601-add-kernel-imq-support.patch @@ -1437,7 +1437,7 @@ /* Interface address info used in eth_type_trans() */ unsigned char *dev_addr; -@@ -3678,6 +3683,19 @@ static inline void netif_tx_unlock_bh(st +@@ -3680,6 +3685,19 @@ static inline void netif_tx_unlock_bh(st } \ } diff --git a/target/linux/generic/pending-4.14/613-netfilter_optional_tcp_window_check.patch b/target/linux/generic/pending-4.14/613-netfilter_optional_tcp_window_check.patch index 69c165bb41..ee4bf191be 100644 --- a/target/linux/generic/pending-4.14/613-netfilter_optional_tcp_window_check.patch +++ b/target/linux/generic/pending-4.14/613-netfilter_optional_tcp_window_check.patch @@ -28,7 +28,7 @@ Signed-off-by: Felix Fietkau /* * Get the required data from the packet. */ -@@ -1489,6 +1495,13 @@ static struct ctl_table tcp_sysctl_table +@@ -1498,6 +1504,13 @@ static struct ctl_table tcp_sysctl_table .mode = 0644, .proc_handler = proc_dointvec, }, diff --git a/target/linux/generic/pending-4.14/630-packet_socket_type.patch b/target/linux/generic/pending-4.14/630-packet_socket_type.patch index 98b20a8246..2023a27e08 100644 --- a/target/linux/generic/pending-4.14/630-packet_socket_type.patch +++ b/target/linux/generic/pending-4.14/630-packet_socket_type.patch @@ -87,7 +87,7 @@ Signed-off-by: Felix Fietkau if (!net_eq(dev_net(dev), sock_net(sk))) goto drop; -@@ -3332,6 +3334,7 @@ static int packet_create(struct net *net +@@ -3337,6 +3339,7 @@ static int packet_create(struct net *net mutex_init(&po->pg_vec_lock); po->rollover = NULL; po->prot_hook.func = packet_rcv; @@ -95,7 +95,7 @@ Signed-off-by: Felix Fietkau if (sock->type == SOCK_PACKET) po->prot_hook.func = packet_rcv_spkt; -@@ -3964,6 +3967,16 @@ packet_setsockopt(struct socket *sock, i +@@ -3969,6 +3972,16 @@ packet_setsockopt(struct socket *sock, i po->xmit = val ? packet_direct_xmit : dev_queue_xmit; return 0; } @@ -112,7 +112,7 @@ Signed-off-by: Felix Fietkau default: return -ENOPROTOOPT; } -@@ -4016,6 +4029,13 @@ static int packet_getsockopt(struct sock +@@ -4021,6 +4034,13 @@ static int packet_getsockopt(struct sock case PACKET_VNET_HDR: val = po->has_vnet_hdr; break; diff --git a/target/linux/generic/pending-4.14/834-ledtrig-libata.patch b/target/linux/generic/pending-4.14/834-ledtrig-libata.patch index fb82edb21b..6bbe4a5465 100644 --- a/target/linux/generic/pending-4.14/834-ledtrig-libata.patch +++ b/target/linux/generic/pending-4.14/834-ledtrig-libata.patch @@ -65,7 +65,7 @@ Signed-off-by: Daniel Golle /** * ata_build_rw_tf - Build ATA taskfile for given read/write request * @tf: Target ATA taskfile -@@ -5160,6 +5173,9 @@ struct ata_queued_cmd *ata_qc_new_init(s +@@ -5163,6 +5176,9 @@ struct ata_queued_cmd *ata_qc_new_init(s if (tag < 0) return NULL; } @@ -75,7 +75,7 @@ Signed-off-by: Daniel Golle qc = __ata_qc_from_tag(ap, tag); qc->tag = tag; -@@ -6063,6 +6079,9 @@ struct ata_port *ata_port_alloc(struct a +@@ -6066,6 +6082,9 @@ struct ata_port *ata_port_alloc(struct a ap->stats.unhandled_irq = 1; ap->stats.idle_irq = 1; #endif @@ -85,7 +85,7 @@ Signed-off-by: Daniel Golle ata_sff_port_init(ap); return ap; -@@ -6084,6 +6103,12 @@ static void ata_host_release(struct devi +@@ -6087,6 +6106,12 @@ static void ata_host_release(struct devi kfree(ap->pmp_link); kfree(ap->slave_link); @@ -98,7 +98,7 @@ Signed-off-by: Daniel Golle kfree(ap); host->ports[i] = NULL; } -@@ -6530,7 +6555,23 @@ int ata_host_register(struct ata_host *h +@@ -6533,7 +6558,23 @@ int ata_host_register(struct ata_host *h host->ports[i]->print_id = atomic_inc_return(&ata_print_id); host->ports[i]->local_port_no = i + 1; } diff --git a/target/linux/generic/pending-4.19/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch b/target/linux/generic/pending-4.19/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch index 79d18d036f..13a1bd7815 100644 --- a/target/linux/generic/pending-4.19/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch +++ b/target/linux/generic/pending-4.19/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch @@ -8,7 +8,7 @@ Signed-off-by: Daniel Golle --- a/drivers/mtd/ubi/build.c +++ b/drivers/mtd/ubi/build.c -@@ -1181,6 +1181,73 @@ static struct mtd_info * __init open_mtd +@@ -1174,6 +1174,73 @@ static struct mtd_info * __init open_mtd return mtd; } @@ -82,7 +82,7 @@ Signed-off-by: Daniel Golle static int __init ubi_init(void) { int err, i, k; -@@ -1264,6 +1331,12 @@ static int __init ubi_init(void) +@@ -1257,6 +1324,12 @@ static int __init ubi_init(void) } } diff --git a/target/linux/generic/pending-4.19/532-jffs2_eofdetect.patch b/target/linux/generic/pending-4.19/532-jffs2_eofdetect.patch index e9952c6d84..d760d06483 100644 --- a/target/linux/generic/pending-4.19/532-jffs2_eofdetect.patch +++ b/target/linux/generic/pending-4.19/532-jffs2_eofdetect.patch @@ -45,7 +45,7 @@ Signed-off-by: Felix Fietkau if (ret < 0) goto out; -@@ -561,6 +567,17 @@ full_scan: +@@ -563,6 +569,17 @@ full_scan: return err; } diff --git a/target/linux/generic/pending-4.19/601-add-kernel-imq-support.patch b/target/linux/generic/pending-4.19/601-add-kernel-imq-support.patch index 4655051b75..b4b575736e 100644 --- a/target/linux/generic/pending-4.19/601-add-kernel-imq-support.patch +++ b/target/linux/generic/pending-4.19/601-add-kernel-imq-support.patch @@ -1132,7 +1132,7 @@ /* Interface address info used in eth_type_trans() */ unsigned char *dev_addr; -@@ -3981,6 +3986,19 @@ static inline void netif_tx_unlock_bh(st +@@ -3983,6 +3988,19 @@ static inline void netif_tx_unlock_bh(st } \ } diff --git a/target/linux/generic/pending-4.19/613-netfilter_optional_tcp_window_check.patch b/target/linux/generic/pending-4.19/613-netfilter_optional_tcp_window_check.patch index e5d72376cc..c7fc4c46b7 100644 --- a/target/linux/generic/pending-4.19/613-netfilter_optional_tcp_window_check.patch +++ b/target/linux/generic/pending-4.19/613-netfilter_optional_tcp_window_check.patch @@ -28,7 +28,7 @@ Signed-off-by: Felix Fietkau /* * Get the required data from the packet. */ -@@ -1066,7 +1072,7 @@ static int tcp_packet(struct nf_conn *ct +@@ -1075,7 +1081,7 @@ static int tcp_packet(struct nf_conn *ct IP_CT_TCP_FLAG_DATA_UNACKNOWLEDGED && timeouts[new_state] > timeouts[TCP_CONNTRACK_UNACK]) timeout = timeouts[TCP_CONNTRACK_UNACK]; @@ -37,7 +37,7 @@ Signed-off-by: Felix Fietkau timeouts[new_state] > timeouts[TCP_CONNTRACK_RETRANS]) timeout = timeouts[TCP_CONNTRACK_RETRANS]; else -@@ -1515,6 +1521,13 @@ static struct ctl_table tcp_sysctl_table +@@ -1524,6 +1530,13 @@ static struct ctl_table tcp_sysctl_table .mode = 0644, .proc_handler = proc_dointvec, }, diff --git a/target/linux/generic/pending-4.19/630-packet_socket_type.patch b/target/linux/generic/pending-4.19/630-packet_socket_type.patch index fd6370338d..66c6f44cef 100644 --- a/target/linux/generic/pending-4.19/630-packet_socket_type.patch +++ b/target/linux/generic/pending-4.19/630-packet_socket_type.patch @@ -87,7 +87,7 @@ Signed-off-by: Felix Fietkau if (!net_eq(dev_net(dev), sock_net(sk))) goto drop; -@@ -3296,6 +3298,7 @@ static int packet_create(struct net *net +@@ -3301,6 +3303,7 @@ static int packet_create(struct net *net mutex_init(&po->pg_vec_lock); po->rollover = NULL; po->prot_hook.func = packet_rcv; @@ -95,7 +95,7 @@ Signed-off-by: Felix Fietkau if (sock->type == SOCK_PACKET) po->prot_hook.func = packet_rcv_spkt; -@@ -3926,6 +3929,16 @@ packet_setsockopt(struct socket *sock, i +@@ -3931,6 +3934,16 @@ packet_setsockopt(struct socket *sock, i po->xmit = val ? packet_direct_xmit : dev_queue_xmit; return 0; } @@ -112,7 +112,7 @@ Signed-off-by: Felix Fietkau default: return -ENOPROTOOPT; } -@@ -3978,6 +3991,13 @@ static int packet_getsockopt(struct sock +@@ -3983,6 +3996,13 @@ static int packet_getsockopt(struct sock case PACKET_VNET_HDR: val = po->has_vnet_hdr; break; diff --git a/target/linux/generic/pending-4.19/834-ledtrig-libata.patch b/target/linux/generic/pending-4.19/834-ledtrig-libata.patch index a76f5b85b8..691b3b825f 100644 --- a/target/linux/generic/pending-4.19/834-ledtrig-libata.patch +++ b/target/linux/generic/pending-4.19/834-ledtrig-libata.patch @@ -65,7 +65,7 @@ Signed-off-by: Daniel Golle /** * ata_build_rw_tf - Build ATA taskfile for given read/write request * @tf: Target ATA taskfile -@@ -5170,6 +5183,9 @@ struct ata_queued_cmd *ata_qc_new_init(s +@@ -5173,6 +5186,9 @@ struct ata_queued_cmd *ata_qc_new_init(s if (tag < 0) return NULL; } @@ -75,7 +75,7 @@ Signed-off-by: Daniel Golle qc = __ata_qc_from_tag(ap, tag); qc->tag = qc->hw_tag = tag; -@@ -6106,6 +6122,9 @@ struct ata_port *ata_port_alloc(struct a +@@ -6109,6 +6125,9 @@ struct ata_port *ata_port_alloc(struct a ap->stats.unhandled_irq = 1; ap->stats.idle_irq = 1; #endif @@ -85,7 +85,7 @@ Signed-off-by: Daniel Golle ata_sff_port_init(ap); return ap; -@@ -6141,6 +6160,12 @@ static void ata_host_release(struct kref +@@ -6144,6 +6163,12 @@ static void ata_host_release(struct kref kfree(ap->pmp_link); kfree(ap->slave_link); @@ -98,7 +98,7 @@ Signed-off-by: Daniel Golle kfree(ap); host->ports[i] = NULL; } -@@ -6604,7 +6629,23 @@ int ata_host_register(struct ata_host *h +@@ -6607,7 +6632,23 @@ int ata_host_register(struct ata_host *h host->ports[i]->print_id = atomic_inc_return(&ata_print_id); host->ports[i]->local_port_no = i + 1; } diff --git a/target/linux/generic/pending-4.9/532-jffs2_eofdetect.patch b/target/linux/generic/pending-4.9/532-jffs2_eofdetect.patch index e9952c6d84..d760d06483 100644 --- a/target/linux/generic/pending-4.9/532-jffs2_eofdetect.patch +++ b/target/linux/generic/pending-4.9/532-jffs2_eofdetect.patch @@ -45,7 +45,7 @@ Signed-off-by: Felix Fietkau if (ret < 0) goto out; -@@ -561,6 +567,17 @@ full_scan: +@@ -563,6 +569,17 @@ full_scan: return err; } diff --git a/target/linux/generic/pending-4.9/601-add-kernel-imq-support.patch b/target/linux/generic/pending-4.9/601-add-kernel-imq-support.patch index 61fc785ace..54b0eb71cb 100644 --- a/target/linux/generic/pending-4.9/601-add-kernel-imq-support.patch +++ b/target/linux/generic/pending-4.9/601-add-kernel-imq-support.patch @@ -1411,7 +1411,7 @@ + --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h -@@ -3695,6 +3695,19 @@ static inline void netif_tx_unlock_bh(st +@@ -3697,6 +3697,19 @@ static inline void netif_tx_unlock_bh(st } \ } diff --git a/target/linux/generic/pending-4.9/613-netfilter_optional_tcp_window_check.patch b/target/linux/generic/pending-4.9/613-netfilter_optional_tcp_window_check.patch index 78a9617762..bf4b59b53c 100644 --- a/target/linux/generic/pending-4.9/613-netfilter_optional_tcp_window_check.patch +++ b/target/linux/generic/pending-4.9/613-netfilter_optional_tcp_window_check.patch @@ -28,7 +28,7 @@ Signed-off-by: Felix Fietkau /* * Get the required data from the packet. */ -@@ -1479,6 +1485,13 @@ static struct ctl_table tcp_sysctl_table +@@ -1488,6 +1494,13 @@ static struct ctl_table tcp_sysctl_table .mode = 0644, .proc_handler = proc_dointvec, }, diff --git a/target/linux/generic/pending-4.9/630-packet_socket_type.patch b/target/linux/generic/pending-4.9/630-packet_socket_type.patch index abe17ef772..18f7a52ff5 100644 --- a/target/linux/generic/pending-4.9/630-packet_socket_type.patch +++ b/target/linux/generic/pending-4.9/630-packet_socket_type.patch @@ -87,7 +87,7 @@ Signed-off-by: Felix Fietkau if (!net_eq(dev_net(dev), sock_net(sk))) goto drop; -@@ -3312,6 +3314,7 @@ static int packet_create(struct net *net +@@ -3317,6 +3319,7 @@ static int packet_create(struct net *net mutex_init(&po->pg_vec_lock); po->rollover = NULL; po->prot_hook.func = packet_rcv; @@ -95,7 +95,7 @@ Signed-off-by: Felix Fietkau if (sock->type == SOCK_PACKET) po->prot_hook.func = packet_rcv_spkt; -@@ -3944,6 +3947,16 @@ packet_setsockopt(struct socket *sock, i +@@ -3949,6 +3952,16 @@ packet_setsockopt(struct socket *sock, i po->xmit = val ? packet_direct_xmit : dev_queue_xmit; return 0; } @@ -112,7 +112,7 @@ Signed-off-by: Felix Fietkau default: return -ENOPROTOOPT; } -@@ -3996,6 +4009,13 @@ static int packet_getsockopt(struct sock +@@ -4001,6 +4014,13 @@ static int packet_getsockopt(struct sock case PACKET_VNET_HDR: val = po->has_vnet_hdr; break; diff --git a/target/linux/ipq40xx/patches-4.14/071-qcom-ipq4019-use-v2-of-the-kpss-bringup-mechanism.patch b/target/linux/ipq40xx/patches-4.14/071-qcom-ipq4019-use-v2-of-the-kpss-bringup-mechanism.patch index d0d08af286..8a0787a78c 100644 --- a/target/linux/ipq40xx/patches-4.14/071-qcom-ipq4019-use-v2-of-the-kpss-bringup-mechanism.patch +++ b/target/linux/ipq40xx/patches-4.14/071-qcom-ipq4019-use-v2-of-the-kpss-bringup-mechanism.patch @@ -67,7 +67,7 @@ Signed-off-by: John Crispin }; pmu { -@@ -213,22 +223,22 @@ +@@ -214,22 +224,22 @@ }; acc0: clock-controller@b088000 { @@ -94,7 +94,7 @@ Signed-off-by: John Crispin reg = <0x0b0b8000 0x1000>, <0xb008000 0x1000>; }; -@@ -256,6 +266,12 @@ +@@ -257,6 +267,12 @@ regulator; }; diff --git a/target/linux/ipq40xx/patches-4.14/077-qcom-ipq4019-add-USB-devicetree-nodes.patch b/target/linux/ipq40xx/patches-4.14/077-qcom-ipq4019-add-USB-devicetree-nodes.patch index be413188a7..cdbb22f422 100644 --- a/target/linux/ipq40xx/patches-4.14/077-qcom-ipq4019-add-USB-devicetree-nodes.patch +++ b/target/linux/ipq40xx/patches-4.14/077-qcom-ipq4019-add-USB-devicetree-nodes.patch @@ -41,7 +41,7 @@ Signed-off-by: John Crispin }; --- a/arch/arm/boot/dts/qcom-ipq4019.dtsi +++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi -@@ -414,5 +414,79 @@ +@@ -415,5 +415,79 @@ "legacy"; status = "disabled"; }; diff --git a/target/linux/ipq40xx/patches-4.14/078-ARM-dts-ipq4019-Add-a-few-peripheral-nodes.patch b/target/linux/ipq40xx/patches-4.14/078-ARM-dts-ipq4019-Add-a-few-peripheral-nodes.patch index b1e0e352ad..f40175cce8 100644 --- a/target/linux/ipq40xx/patches-4.14/078-ARM-dts-ipq4019-Add-a-few-peripheral-nodes.patch +++ b/target/linux/ipq40xx/patches-4.14/078-ARM-dts-ipq4019-Add-a-few-peripheral-nodes.patch @@ -41,7 +41,7 @@ Signed-off-by: Andy Gross }; cpus { -@@ -136,6 +138,12 @@ +@@ -137,6 +139,12 @@ }; }; @@ -54,7 +54,7 @@ Signed-off-by: Andy Gross timer { compatible = "arm,armv7-timer"; interrupts = <1 2 0xf08>, -@@ -181,13 +189,13 @@ +@@ -182,13 +190,13 @@ #gpio-cells = <2>; interrupt-controller; #interrupt-cells = <2>; @@ -70,7 +70,7 @@ Signed-off-by: Andy Gross clocks = <&gcc GCC_BLSP1_AHB_CLK>; clock-names = "bam_clk"; #dma-cells = <1>; -@@ -195,7 +203,7 @@ +@@ -196,7 +204,7 @@ status = "disabled"; }; @@ -79,7 +79,7 @@ Signed-off-by: Andy Gross compatible = "qcom,spi-qup-v2.2.1"; reg = <0x78b5000 0x600>; interrupts = ; -@@ -204,10 +212,26 @@ +@@ -205,10 +213,26 @@ clock-names = "core", "iface"; #address-cells = <1>; #size-cells = <0>; @@ -107,7 +107,7 @@ Signed-off-by: Andy Gross compatible = "qcom,i2c-qup-v2.2.1"; reg = <0x78b7000 0x600>; interrupts = ; -@@ -216,14 +240,29 @@ +@@ -217,14 +241,29 @@ clock-names = "iface", "core"; #address-cells = <1>; #size-cells = <0>; @@ -138,7 +138,7 @@ Signed-off-by: Andy Gross clocks = <&gcc GCC_CRYPTO_AHB_CLK>; clock-names = "bam_clk"; #dma-cells = <1>; -@@ -297,7 +336,7 @@ +@@ -298,7 +337,7 @@ serial@78af000 { compatible = "qcom,msm-uartdm-v1.4", "qcom,msm-uartdm"; reg = <0x78af000 0x200>; @@ -147,7 +147,7 @@ Signed-off-by: Andy Gross status = "disabled"; clocks = <&gcc GCC_BLSP1_UART1_APPS_CLK>, <&gcc GCC_BLSP1_AHB_CLK>; -@@ -309,7 +348,7 @@ +@@ -310,7 +349,7 @@ serial@78b0000 { compatible = "qcom,msm-uartdm-v1.4", "qcom,msm-uartdm"; reg = <0x78b0000 0x200>; @@ -156,7 +156,7 @@ Signed-off-by: Andy Gross status = "disabled"; clocks = <&gcc GCC_BLSP1_UART2_APPS_CLK>, <&gcc GCC_BLSP1_AHB_CLK>; -@@ -331,6 +370,101 @@ +@@ -332,6 +371,101 @@ reg = <0x4ab000 0x4>; }; @@ -258,7 +258,7 @@ Signed-off-by: Andy Gross wifi0: wifi@a000000 { compatible = "qcom,ipq4019-wifi"; reg = <0xa000000 0x200000>; -@@ -364,7 +498,7 @@ +@@ -365,7 +499,7 @@ , , , @@ -267,7 +267,7 @@ Signed-off-by: Andy Gross interrupt-names = "msi0", "msi1", "msi2", "msi3", "msi4", "msi5", "msi6", "msi7", "msi8", "msi9", "msi10", "msi11", -@@ -406,7 +540,7 @@ +@@ -407,7 +541,7 @@ , , , diff --git a/target/linux/ipq40xx/patches-4.14/079-ARM-dts-ipq4019-fix-PCI-range.patch b/target/linux/ipq40xx/patches-4.14/079-ARM-dts-ipq4019-fix-PCI-range.patch index 42ce65034b..6d00d41424 100644 --- a/target/linux/ipq40xx/patches-4.14/079-ARM-dts-ipq4019-fix-PCI-range.patch +++ b/target/linux/ipq40xx/patches-4.14/079-ARM-dts-ipq4019-fix-PCI-range.patch @@ -12,7 +12,7 @@ Signed-off-by: Mathias Kresin --- a/arch/arm/boot/dts/qcom-ipq4019.dtsi +++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi -@@ -385,7 +385,7 @@ +@@ -386,7 +386,7 @@ #size-cells = <2>; ranges = <0x81000000 0 0x40200000 0x40200000 0 0x00100000 diff --git a/target/linux/ipq40xx/patches-4.14/080-pinctrl-msm-fix-gpio-hog-related-boot-issues.patch b/target/linux/ipq40xx/patches-4.14/080-pinctrl-msm-fix-gpio-hog-related-boot-issues.patch index 0efb38b244..fbfb2d006d 100644 --- a/target/linux/ipq40xx/patches-4.14/080-pinctrl-msm-fix-gpio-hog-related-boot-issues.patch +++ b/target/linux/ipq40xx/patches-4.14/080-pinctrl-msm-fix-gpio-hog-related-boot-issues.patch @@ -61,7 +61,7 @@ Origin: other, https://patchwork.kernel.org/patch/10339127/ --- a/arch/arm/boot/dts/qcom-ipq4019.dtsi +++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi -@@ -186,6 +186,7 @@ +@@ -187,6 +187,7 @@ compatible = "qcom,ipq4019-pinctrl"; reg = <0x01000000 0x300000>; gpio-controller; diff --git a/target/linux/ipq40xx/patches-4.14/084-ARM-dts-ipq4019-Add-a-default-chosen-node.patch b/target/linux/ipq40xx/patches-4.14/084-ARM-dts-ipq4019-Add-a-default-chosen-node.patch index 5d9023e60c..9ae913a6da 100644 --- a/target/linux/ipq40xx/patches-4.14/084-ARM-dts-ipq4019-Add-a-default-chosen-node.patch +++ b/target/linux/ipq40xx/patches-4.14/084-ARM-dts-ipq4019-Add-a-default-chosen-node.patch @@ -34,7 +34,7 @@ Signed-off-by: Andy Gross status = "ok"; --- a/arch/arm/boot/dts/qcom-ipq4019.dtsi +++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi -@@ -350,7 +350,7 @@ +@@ -351,7 +351,7 @@ regulator; }; diff --git a/target/linux/ipq40xx/patches-4.14/086-ARM-dts-qcom-ipq4019-enlarge-PCIe-BAR-range.patch b/target/linux/ipq40xx/patches-4.14/086-ARM-dts-qcom-ipq4019-enlarge-PCIe-BAR-range.patch index acea3fb90c..d38a4ddfd2 100644 --- a/target/linux/ipq40xx/patches-4.14/086-ARM-dts-qcom-ipq4019-enlarge-PCIe-BAR-range.patch +++ b/target/linux/ipq40xx/patches-4.14/086-ARM-dts-qcom-ipq4019-enlarge-PCIe-BAR-range.patch @@ -29,7 +29,7 @@ Signed-off-by: Christian Lamparter --- a/arch/arm/boot/dts/qcom-ipq4019.dtsi +++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi -@@ -401,8 +401,8 @@ +@@ -402,8 +402,8 @@ #address-cells = <3>; #size-cells = <2>; diff --git a/target/linux/ipq40xx/patches-4.14/087-ARM-dts-qcom-ipq4019-Fix-MSI-IRQ-type.patch b/target/linux/ipq40xx/patches-4.14/087-ARM-dts-qcom-ipq4019-Fix-MSI-IRQ-type.patch index 7864ef7fdf..163614d2db 100644 --- a/target/linux/ipq40xx/patches-4.14/087-ARM-dts-qcom-ipq4019-Fix-MSI-IRQ-type.patch +++ b/target/linux/ipq40xx/patches-4.14/087-ARM-dts-qcom-ipq4019-Fix-MSI-IRQ-type.patch @@ -21,7 +21,7 @@ Reviewed-by: Bjorn Andersson --- a/arch/arm/boot/dts/qcom-ipq4019.dtsi +++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi -@@ -404,7 +404,7 @@ +@@ -405,7 +405,7 @@ ranges = <0x81000000 0 0x40200000 0x40200000 0 0x00100000>, <0x82000000 0 0x40300000 0x40300000 0 0x00d00000>; diff --git a/target/linux/ipq40xx/patches-4.14/090-ipq40xx-fix-high-resolution-timer.patch b/target/linux/ipq40xx/patches-4.14/090-ipq40xx-fix-high-resolution-timer.patch index 796844d67f..43608ae108 100644 --- a/target/linux/ipq40xx/patches-4.14/090-ipq40xx-fix-high-resolution-timer.patch +++ b/target/linux/ipq40xx/patches-4.14/090-ipq40xx-fix-high-resolution-timer.patch @@ -19,7 +19,7 @@ Signed-off-by: Pavel Kubelun --- a/arch/arm/boot/dts/qcom-ipq4019.dtsi +++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi -@@ -167,6 +167,7 @@ +@@ -168,6 +168,7 @@ <1 4 0xf08>, <1 1 0xf08>; clock-frequency = <48000000>; diff --git a/target/linux/ipq40xx/patches-4.14/701-dts-ipq4019-add-mdio-node.patch b/target/linux/ipq40xx/patches-4.14/701-dts-ipq4019-add-mdio-node.patch index b7e241058c..3ace506f10 100644 --- a/target/linux/ipq40xx/patches-4.14/701-dts-ipq4019-add-mdio-node.patch +++ b/target/linux/ipq40xx/patches-4.14/701-dts-ipq4019-add-mdio-node.patch @@ -15,7 +15,7 @@ so the info might change. --- a/arch/arm/boot/dts/qcom-ipq4019.dtsi +++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi -@@ -567,6 +567,34 @@ +@@ -568,6 +568,34 @@ status = "disabled"; }; diff --git a/target/linux/ipq40xx/patches-4.14/702-dts-ipq4019-add-PHY-switch-nodes.patch b/target/linux/ipq40xx/patches-4.14/702-dts-ipq4019-add-PHY-switch-nodes.patch index cc56a60ea3..9096051564 100644 --- a/target/linux/ipq40xx/patches-4.14/702-dts-ipq4019-add-PHY-switch-nodes.patch +++ b/target/linux/ipq40xx/patches-4.14/702-dts-ipq4019-add-PHY-switch-nodes.patch @@ -14,7 +14,7 @@ Signed-off-by: Christian Lamparter --- a/arch/arm/boot/dts/qcom-ipq4019.dtsi +++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi -@@ -595,6 +595,29 @@ +@@ -596,6 +596,29 @@ }; }; diff --git a/target/linux/ipq40xx/patches-4.14/711-dts-ipq4019-add-ethernet-essedma-node.patch b/target/linux/ipq40xx/patches-4.14/711-dts-ipq4019-add-ethernet-essedma-node.patch index 80b16a8211..4120be4d8c 100644 --- a/target/linux/ipq40xx/patches-4.14/711-dts-ipq4019-add-ethernet-essedma-node.patch +++ b/target/linux/ipq40xx/patches-4.14/711-dts-ipq4019-add-ethernet-essedma-node.patch @@ -25,7 +25,7 @@ Signed-off-by: Christian Lamparter }; cpus { -@@ -618,6 +620,64 @@ +@@ -619,6 +621,64 @@ status = "disabled"; }; diff --git a/target/linux/ipq40xx/patches-4.14/852-ARM-dts-qcom-ipq4019-Add-SDHCI-VQMMC-LDO-regulator-n.patch b/target/linux/ipq40xx/patches-4.14/852-ARM-dts-qcom-ipq4019-Add-SDHCI-VQMMC-LDO-regulator-n.patch index 4a530b4266..cf8ae8194b 100644 --- a/target/linux/ipq40xx/patches-4.14/852-ARM-dts-qcom-ipq4019-Add-SDHCI-VQMMC-LDO-regulator-n.patch +++ b/target/linux/ipq40xx/patches-4.14/852-ARM-dts-qcom-ipq4019-Add-SDHCI-VQMMC-LDO-regulator-n.patch @@ -14,7 +14,7 @@ Signed-off-by: Robert Marko --- a/arch/arm/boot/dts/qcom-ipq4019.dtsi +++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi -@@ -212,6 +212,16 @@ +@@ -213,6 +213,16 @@ interrupts = ; }; diff --git a/target/linux/ipq40xx/patches-4.14/853-add-sdhci-msm-node-to-dts.patch b/target/linux/ipq40xx/patches-4.14/853-add-sdhci-msm-node-to-dts.patch index 36085e0969..c149ae2845 100644 --- a/target/linux/ipq40xx/patches-4.14/853-add-sdhci-msm-node-to-dts.patch +++ b/target/linux/ipq40xx/patches-4.14/853-add-sdhci-msm-node-to-dts.patch @@ -20,7 +20,7 @@ Signed-off-by: Robert Marko --- a/arch/arm/boot/dts/qcom-ipq4019.dtsi +++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi -@@ -222,6 +222,18 @@ +@@ -223,6 +223,18 @@ status = "disabled"; }; diff --git a/target/linux/ipq40xx/patches-4.14/901-essedma-disable-default-vlan-tagging.patch b/target/linux/ipq40xx/patches-4.14/901-essedma-disable-default-vlan-tagging.patch index 46d725eadb..e167d24234 100644 --- a/target/linux/ipq40xx/patches-4.14/901-essedma-disable-default-vlan-tagging.patch +++ b/target/linux/ipq40xx/patches-4.14/901-essedma-disable-default-vlan-tagging.patch @@ -24,7 +24,7 @@ Signed-off-by: Chen Minqiang --- a/arch/arm/boot/dts/qcom-ipq4019.dtsi +++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi -@@ -648,8 +648,7 @@ +@@ -649,8 +649,7 @@ qcom,page-mode = <0>; qcom,rx_head_buf_size = <1540>; qcom,mdio_supported; @@ -34,7 +34,7 @@ Signed-off-by: Chen Minqiang interrupts = <0 65 IRQ_TYPE_EDGE_RISING 0 66 IRQ_TYPE_EDGE_RISING 0 67 IRQ_TYPE_EDGE_RISING -@@ -687,7 +686,7 @@ +@@ -688,7 +687,7 @@ gmac0: gmac0 { local-mac-address = [00 00 00 00 00 00]; diff --git a/target/linux/ipq40xx/patches-4.14/996-add-uart2-and-mdio-label.patch b/target/linux/ipq40xx/patches-4.14/996-add-uart2-and-mdio-label.patch index 5d02307ba8..955ac962ed 100644 --- a/target/linux/ipq40xx/patches-4.14/996-add-uart2-and-mdio-label.patch +++ b/target/linux/ipq40xx/patches-4.14/996-add-uart2-and-mdio-label.patch @@ -1,6 +1,6 @@ --- a/arch/arm/boot/dts/qcom-ipq4019.dtsi +++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi -@@ -392,7 +392,7 @@ +@@ -393,7 +393,7 @@ dma-names = "rx", "tx"; }; @@ -9,7 +9,7 @@ compatible = "qcom,msm-uartdm-v1.4", "qcom,msm-uartdm"; reg = <0x78b0000 0x200>; interrupts = ; -@@ -596,7 +596,7 @@ +@@ -597,7 +597,7 @@ status = "disabled"; }; diff --git a/target/linux/ipq40xx/patches-4.19/071-01-v4.20-ARM-dts-qcom-ipq4019-use-v2-of-the-kpss-bringup-mech.patch b/target/linux/ipq40xx/patches-4.19/071-01-v4.20-ARM-dts-qcom-ipq4019-use-v2-of-the-kpss-bringup-mech.patch index b1d69ca0ee..3a6b1cef3e 100644 --- a/target/linux/ipq40xx/patches-4.19/071-01-v4.20-ARM-dts-qcom-ipq4019-use-v2-of-the-kpss-bringup-mech.patch +++ b/target/linux/ipq40xx/patches-4.19/071-01-v4.20-ARM-dts-qcom-ipq4019-use-v2-of-the-kpss-bringup-mech.patch @@ -68,7 +68,7 @@ Signed-off-by: Andy Gross }; pmu { -@@ -292,22 +301,22 @@ +@@ -293,22 +302,22 @@ }; acc0: clock-controller@b088000 { diff --git a/target/linux/ipq40xx/patches-4.19/071-02-ipq40xx-Fix-booting-secondary-cores.patch b/target/linux/ipq40xx/patches-4.19/071-02-ipq40xx-Fix-booting-secondary-cores.patch index d37a8cb6ba..8071d6ea38 100644 --- a/target/linux/ipq40xx/patches-4.19/071-02-ipq40xx-Fix-booting-secondary-cores.patch +++ b/target/linux/ipq40xx/patches-4.19/071-02-ipq40xx-Fix-booting-secondary-cores.patch @@ -23,7 +23,7 @@ Signed-off-by: Robert Marko }; }; -@@ -344,6 +345,12 @@ +@@ -345,6 +346,12 @@ regulator; }; diff --git a/target/linux/ipq40xx/patches-4.19/077-qcom-ipq4019-add-USB-devicetree-nodes.patch b/target/linux/ipq40xx/patches-4.19/077-qcom-ipq4019-add-USB-devicetree-nodes.patch index 30a0678fd8..829940ee3d 100644 --- a/target/linux/ipq40xx/patches-4.19/077-qcom-ipq4019-add-USB-devicetree-nodes.patch +++ b/target/linux/ipq40xx/patches-4.19/077-qcom-ipq4019-add-USB-devicetree-nodes.patch @@ -41,7 +41,7 @@ Signed-off-by: John Crispin }; --- a/arch/arm/boot/dts/qcom-ipq4019.dtsi +++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi -@@ -568,5 +568,79 @@ +@@ -569,5 +569,79 @@ "legacy"; status = "disabled"; }; diff --git a/target/linux/ipq40xx/patches-4.19/080-ARM-dts-qcom-add-gpio-ranges-property.patch b/target/linux/ipq40xx/patches-4.19/080-ARM-dts-qcom-add-gpio-ranges-property.patch index 3a18ffc08f..7d2c339f61 100644 --- a/target/linux/ipq40xx/patches-4.19/080-ARM-dts-qcom-add-gpio-ranges-property.patch +++ b/target/linux/ipq40xx/patches-4.19/080-ARM-dts-qcom-add-gpio-ranges-property.patch @@ -60,7 +60,7 @@ will be executed twice with the same parameters for the same pinctrl. --- a/arch/arm/boot/dts/qcom-ipq4019.dtsi +++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi -@@ -206,6 +206,7 @@ +@@ -207,6 +207,7 @@ compatible = "qcom,ipq4019-pinctrl"; reg = <0x01000000 0x300000>; gpio-controller; diff --git a/target/linux/ipq40xx/patches-4.19/086-ipq40xx-fix-high-resolution-timer.patch b/target/linux/ipq40xx/patches-4.19/086-ipq40xx-fix-high-resolution-timer.patch index b45182271a..47258a4a18 100644 --- a/target/linux/ipq40xx/patches-4.19/086-ipq40xx-fix-high-resolution-timer.patch +++ b/target/linux/ipq40xx/patches-4.19/086-ipq40xx-fix-high-resolution-timer.patch @@ -19,7 +19,7 @@ Signed-off-by: Pavel Kubelun --- a/arch/arm/boot/dts/qcom-ipq4019.dtsi +++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi -@@ -171,6 +171,7 @@ +@@ -172,6 +172,7 @@ <1 4 0xf08>, <1 1 0xf08>; clock-frequency = <48000000>; diff --git a/target/linux/ipq40xx/patches-4.19/089-v5.5-ARM-dts-qcom-ipq4019-Add-SDHCI-controller-node.patch b/target/linux/ipq40xx/patches-4.19/089-v5.5-ARM-dts-qcom-ipq4019-Add-SDHCI-controller-node.patch index 90e6b25538..4ba7913d32 100644 --- a/target/linux/ipq40xx/patches-4.19/089-v5.5-ARM-dts-qcom-ipq4019-Add-SDHCI-controller-node.patch +++ b/target/linux/ipq40xx/patches-4.19/089-v5.5-ARM-dts-qcom-ipq4019-Add-SDHCI-controller-node.patch @@ -15,7 +15,7 @@ Signed-off-by: Bjorn Andersson --- a/arch/arm/boot/dts/qcom-ipq4019.dtsi +++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi -@@ -214,6 +214,18 @@ +@@ -215,6 +215,18 @@ interrupts = ; }; diff --git a/target/linux/ipq40xx/patches-4.19/100-arm-dts-IPQ4019-add-SDHCI-VQMMC-LDO-node.patch b/target/linux/ipq40xx/patches-4.19/100-arm-dts-IPQ4019-add-SDHCI-VQMMC-LDO-node.patch index 1f346371de..06c59f57d9 100644 --- a/target/linux/ipq40xx/patches-4.19/100-arm-dts-IPQ4019-add-SDHCI-VQMMC-LDO-node.patch +++ b/target/linux/ipq40xx/patches-4.19/100-arm-dts-IPQ4019-add-SDHCI-VQMMC-LDO-node.patch @@ -13,7 +13,7 @@ Signed-off-by: Robert Marko --- a/arch/arm/boot/dts/qcom-ipq4019.dtsi +++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi -@@ -214,6 +214,16 @@ +@@ -215,6 +215,16 @@ interrupts = ; }; diff --git a/target/linux/ipq40xx/patches-4.19/701-dts-ipq4019-add-mdio-node.patch b/target/linux/ipq40xx/patches-4.19/701-dts-ipq4019-add-mdio-node.patch index 7117a4bdfe..24771d0dbf 100644 --- a/target/linux/ipq40xx/patches-4.19/701-dts-ipq4019-add-mdio-node.patch +++ b/target/linux/ipq40xx/patches-4.19/701-dts-ipq4019-add-mdio-node.patch @@ -15,7 +15,7 @@ so the info might change. --- a/arch/arm/boot/dts/qcom-ipq4019.dtsi +++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi -@@ -593,6 +593,34 @@ +@@ -594,6 +594,34 @@ status = "disabled"; }; diff --git a/target/linux/ipq40xx/patches-4.19/702-dts-ipq4019-add-PHY-switch-nodes.patch b/target/linux/ipq40xx/patches-4.19/702-dts-ipq4019-add-PHY-switch-nodes.patch index 4ef8044893..605db0dd96 100644 --- a/target/linux/ipq40xx/patches-4.19/702-dts-ipq4019-add-PHY-switch-nodes.patch +++ b/target/linux/ipq40xx/patches-4.19/702-dts-ipq4019-add-PHY-switch-nodes.patch @@ -14,7 +14,7 @@ Signed-off-by: Christian Lamparter --- a/arch/arm/boot/dts/qcom-ipq4019.dtsi +++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi -@@ -621,6 +621,29 @@ +@@ -622,6 +622,29 @@ }; }; diff --git a/target/linux/ipq40xx/patches-4.19/711-dts-ipq4019-add-ethernet-essedma-node.patch b/target/linux/ipq40xx/patches-4.19/711-dts-ipq4019-add-ethernet-essedma-node.patch index 9f9cb5287c..275a44bcbd 100644 --- a/target/linux/ipq40xx/patches-4.19/711-dts-ipq4019-add-ethernet-essedma-node.patch +++ b/target/linux/ipq40xx/patches-4.19/711-dts-ipq4019-add-ethernet-essedma-node.patch @@ -25,7 +25,7 @@ Signed-off-by: Christian Lamparter }; cpus { -@@ -644,6 +646,64 @@ +@@ -645,6 +647,64 @@ status = "disabled"; }; diff --git a/target/linux/ipq40xx/patches-4.19/901-essedma-disable-default-vlan-tagging.patch b/target/linux/ipq40xx/patches-4.19/901-essedma-disable-default-vlan-tagging.patch index e2cb37fc0c..910f3d3d6e 100644 --- a/target/linux/ipq40xx/patches-4.19/901-essedma-disable-default-vlan-tagging.patch +++ b/target/linux/ipq40xx/patches-4.19/901-essedma-disable-default-vlan-tagging.patch @@ -24,7 +24,7 @@ Signed-off-by: Chen Minqiang --- a/arch/arm/boot/dts/qcom-ipq4019.dtsi +++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi -@@ -652,8 +652,7 @@ +@@ -653,8 +653,7 @@ qcom,page-mode = <0>; qcom,rx_head_buf_size = <1540>; qcom,mdio_supported; @@ -34,7 +34,7 @@ Signed-off-by: Chen Minqiang interrupts = <0 65 IRQ_TYPE_EDGE_RISING 0 66 IRQ_TYPE_EDGE_RISING 0 67 IRQ_TYPE_EDGE_RISING -@@ -691,7 +690,7 @@ +@@ -692,7 +691,7 @@ gmac0: gmac0 { local-mac-address = [00 00 00 00 00 00]; diff --git a/target/linux/lantiq/patches-4.19/0001-MIPS-lantiq-add-pcie-driver.patch b/target/linux/lantiq/patches-4.19/0001-MIPS-lantiq-add-pcie-driver.patch index b08de381ff..d6cf1ebb50 100644 --- a/target/linux/lantiq/patches-4.19/0001-MIPS-lantiq-add-pcie-driver.patch +++ b/target/linux/lantiq/patches-4.19/0001-MIPS-lantiq-add-pcie-driver.patch @@ -5494,7 +5494,7 @@ Signed-off-by: John Crispin (transaction layer end-to-end CRC checking). --- a/include/linux/pci.h +++ b/include/linux/pci.h -@@ -1329,6 +1329,8 @@ void pci_walk_bus(struct pci_bus *top, i +@@ -1330,6 +1330,8 @@ void pci_walk_bus(struct pci_bus *top, i void *userdata); int pci_cfg_space_size(struct pci_dev *dev); unsigned char pci_bus_max_busnr(struct pci_bus *bus); diff --git a/target/linux/layerscape/patches-4.14/807-usb-support-layerscape.patch b/target/linux/layerscape/patches-4.14/807-usb-support-layerscape.patch index e215ceb2dc..859ee99562 100644 --- a/target/linux/layerscape/patches-4.14/807-usb-support-layerscape.patch +++ b/target/linux/layerscape/patches-4.14/807-usb-support-layerscape.patch @@ -1340,7 +1340,7 @@ Signed-off-by: Zhao Chenhui while (ep_ring->dequeue != td->last_trb) --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c -@@ -1625,13 +1625,38 @@ static int xhci_urb_dequeue(struct usb_h +@@ -1636,13 +1636,38 @@ static int xhci_urb_dequeue(struct usb_h ret = -ENOMEM; goto done; } diff --git a/target/linux/layerscape/patches-4.14/816-pcie-support-layerscape.patch b/target/linux/layerscape/patches-4.14/816-pcie-support-layerscape.patch index 4317b757ea..97d2b89e68 100644 --- a/target/linux/layerscape/patches-4.14/816-pcie-support-layerscape.patch +++ b/target/linux/layerscape/patches-4.14/816-pcie-support-layerscape.patch @@ -5808,7 +5808,7 @@ Signed-off-by: Yangbo Lu struct pci_epc *epc; --- a/include/linux/pci.h +++ b/include/linux/pci.h -@@ -1947,6 +1947,7 @@ void pcibios_release_device(struct pci_d +@@ -1948,6 +1948,7 @@ void pcibios_release_device(struct pci_d void pcibios_penalize_isa_irq(int irq, int active); int pcibios_alloc_irq(struct pci_dev *dev); void pcibios_free_irq(struct pci_dev *dev); diff --git a/target/linux/mediatek/patches-4.14/0108-usb-mtu3-use-FORCE-RG_IDDIG-to-implement-manual-DRD-.patch b/target/linux/mediatek/patches-4.14/0108-usb-mtu3-use-FORCE-RG_IDDIG-to-implement-manual-DRD-.patch index 6ff80e446f..f6403fd6f5 100644 --- a/target/linux/mediatek/patches-4.14/0108-usb-mtu3-use-FORCE-RG_IDDIG-to-implement-manual-DRD-.patch +++ b/target/linux/mediatek/patches-4.14/0108-usb-mtu3-use-FORCE-RG_IDDIG-to-implement-manual-DRD-.patch @@ -62,7 +62,7 @@ Signed-off-by: Felipe Balbi --- a/drivers/usb/mtu3/mtu3_dr.c +++ b/drivers/usb/mtu3/mtu3_dr.c -@@ -261,21 +261,22 @@ static void extcon_register_dwork(struct +@@ -259,21 +259,22 @@ static void extcon_register_dwork(struct * depending on user input. * This is useful in special cases, such as uses TYPE-A receptacle but also * wants to support dual-role mode. @@ -93,7 +93,7 @@ Signed-off-by: Felipe Balbi static int ssusb_mode_show(struct seq_file *sf, void *unused) { struct ssusb_mtk *ssusb = sf->private; -@@ -388,17 +389,45 @@ static void ssusb_debugfs_exit(struct ss +@@ -386,17 +387,45 @@ static void ssusb_debugfs_exit(struct ss debugfs_remove_recursive(ssusb->dbgfs_root); } @@ -144,7 +144,7 @@ Signed-off-by: Felipe Balbi return 0; } -@@ -407,8 +436,8 @@ void ssusb_otg_switch_exit(struct ssusb_ +@@ -405,8 +434,8 @@ void ssusb_otg_switch_exit(struct ssusb_ { struct otg_switch_mtk *otg_sx = &ssusb->otg_switch; diff --git a/target/linux/mediatek/patches-4.19/0900-bt-mtk-serial-fix.patch b/target/linux/mediatek/patches-4.19/0900-bt-mtk-serial-fix.patch index ba78262574..ff3883caa2 100644 --- a/target/linux/mediatek/patches-4.19/0900-bt-mtk-serial-fix.patch +++ b/target/linux/mediatek/patches-4.19/0900-bt-mtk-serial-fix.patch @@ -19,7 +19,7 @@ }, [PORT_NPCM] = { .name = "Nuvoton 16550", -@@ -2687,6 +2687,11 @@ serial8250_do_set_termios(struct uart_po +@@ -2699,6 +2699,11 @@ serial8250_do_set_termios(struct uart_po unsigned long flags; unsigned int baud, quot, frac = 0; diff --git a/target/linux/mvebu/patches-4.19/523-Revert-PCI-aardvark-Convert-to-use-pci_host_probe.patch b/target/linux/mvebu/patches-4.19/523-Revert-PCI-aardvark-Convert-to-use-pci_host_probe.patch index ed50174785..88247f213f 100644 --- a/target/linux/mvebu/patches-4.19/523-Revert-PCI-aardvark-Convert-to-use-pci_host_probe.patch +++ b/target/linux/mvebu/patches-4.19/523-Revert-PCI-aardvark-Convert-to-use-pci_host_probe.patch @@ -10,7 +10,7 @@ This reverts commit c8e144f8ab00e6c4a070a932ef9c57db09aa41cf. --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c -@@ -1165,6 +1165,7 @@ static int advk_pcie_probe(struct platfo +@@ -1159,6 +1159,7 @@ static int advk_pcie_probe(struct platfo struct device *dev = &pdev->dev; struct advk_pcie *pcie; struct resource *res; @@ -18,7 +18,7 @@ This reverts commit c8e144f8ab00e6c4a070a932ef9c57db09aa41cf. struct pci_host_bridge *bridge; struct resource_entry *entry; int ret, irq; -@@ -1315,13 +1316,22 @@ static int advk_pcie_probe(struct platfo +@@ -1309,13 +1310,22 @@ static int advk_pcie_probe(struct platfo bridge->map_irq = of_irq_parse_and_map_pci; bridge->swizzle_irq = pci_common_swizzle; diff --git a/target/linux/oxnas/patches-4.14/999-libata-hacks.patch b/target/linux/oxnas/patches-4.14/999-libata-hacks.patch index d223ac469f..39f3b26bb2 100644 --- a/target/linux/oxnas/patches-4.14/999-libata-hacks.patch +++ b/target/linux/oxnas/patches-4.14/999-libata-hacks.patch @@ -15,7 +15,7 @@ /* initialize internal qc */ /* XXX: Tag 0 is used for drivers with legacy EH as some -@@ -5167,6 +5175,9 @@ struct ata_queued_cmd *ata_qc_new_init(s +@@ -5170,6 +5178,9 @@ struct ata_queued_cmd *ata_qc_new_init(s if (unlikely(ap->pflags & ATA_PFLAG_FROZEN)) return NULL; @@ -25,7 +25,7 @@ /* libsas case */ if (ap->flags & ATA_FLAG_SAS_HOST) { tag = ata_sas_allocate_tag(ap); -@@ -5212,6 +5223,8 @@ void ata_qc_free(struct ata_queued_cmd * +@@ -5215,6 +5226,8 @@ void ata_qc_free(struct ata_queued_cmd * qc->tag = ATA_TAG_POISON; if (ap->flags & ATA_FLAG_SAS_HOST) ata_sas_free_tag(tag, ap); From 1e1772cc1e606d86909e66c17a8c6a8ff66ddb38 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Fri, 8 Oct 2021 19:07:14 +0800 Subject: [PATCH 20/48] rt3883: disable build for rt-n56u by default Signed-off-by: Tianling Shen (cherry picked from commit 1d1ba8d71131520de0174058e8f9d33cd21a7adc) --- target/linux/ramips/image/rt3883.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/ramips/image/rt3883.mk b/target/linux/ramips/image/rt3883.mk index b86967b7c3..24362ae5ae 100644 --- a/target/linux/ramips/image/rt3883.mk +++ b/target/linux/ramips/image/rt3883.mk @@ -14,6 +14,7 @@ define Device/asus_rt-n56u DEVICE_MODEL := RT-N56U DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2 swconfig SUPPORTED_DEVICES += rt-n56u + DEFAULT := n endef TARGET_DEVICES += asus_rt-n56u From 107c5d097cc45ef95904a6c2952892d139184616 Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Sun, 6 Sep 2020 19:50:36 +0200 Subject: [PATCH 21/48] ath25: disable devices with 4M flash Devices with 4M flash are not built be default for 20.xx anymore. Building them with buildbot settings does not work anymore anyway. Signed-off-by: Adrian Schmutzler (cherry picked from commit ad22f6a8aae42131cadb06091c11f27571a2ce92) --- target/linux/ath25/image/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/ath25/image/Makefile b/target/linux/ath25/image/Makefile index f273467db0..f203eb1c0f 100644 --- a/target/linux/ath25/image/Makefile +++ b/target/linux/ath25/image/Makefile @@ -88,6 +88,7 @@ TARGET_DEVICES += ubnt2 define Device/ubnt5 DEVICE_TITLE := Ubiquiti XS5 IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | pad-to 128k | mkfwimage XS5 -v XS5.ar2313 + DEFAULT := n endef TARGET_DEVICES += ubnt5 From 88dd5b530b3d0f51b76f49c9a6c0355109535f1b Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Fri, 13 May 2022 19:01:02 +0800 Subject: [PATCH 22/48] armvirt: 64: add missing Kconfig Signed-off-by: Tianling Shen --- target/linux/armvirt/64/config-default | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/armvirt/64/config-default b/target/linux/armvirt/64/config-default index a38a9162b6..82c7fe389f 100644 --- a/target/linux/armvirt/64/config-default +++ b/target/linux/armvirt/64/config-default @@ -26,6 +26,7 @@ CONFIG_ARM64_4K_PAGES=y # CONFIG_ARM64_64K_PAGES is not set CONFIG_ARM64_CONT_SHIFT=4 CONFIG_ARM64_CRYPTO=y +CONFIG_ARM64_ERRATUM_1188873=y CONFIG_ARM64_ERRATUM_819472=y CONFIG_ARM64_ERRATUM_824069=y CONFIG_ARM64_ERRATUM_826319=y From 788154eb44e710b065081b737295ce10a4a8c05f Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 1 May 2021 11:58:47 +0200 Subject: [PATCH 23/48] kernel: qlcnic: add dependency to kmod-hwmon-core QLCNIC_HWMON was activated when hwmon was set, but the dependency was missing. This broke the build bot builds. Fix this by explicitly activating HWMON support and adding a dependency. Fixes: f88c64d28ccf ("kernel: netdev: add qlcnic") Signed-off-by: Hauke Mehrtens (cherry picked from commit 95b210e513d6d369444df41b522f749f1d848048) --- package/kernel/linux/modules/netdevices.mk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/package/kernel/linux/modules/netdevices.mk b/package/kernel/linux/modules/netdevices.mk index 967cbf11df..1d310751df 100644 --- a/package/kernel/linux/modules/netdevices.mk +++ b/package/kernel/linux/modules/netdevices.mk @@ -1176,7 +1176,9 @@ define KernelPackage/qlcnic SUBMENU:=$(NETWORK_DEVICES_MENU) DEPENDS:=@PCI_SUPPORT +kmod-hwmon-core TITLE:=QLogic QLE8240 and QLE8242 device support - KCONFIG:=CONFIG_QLCNIC + KCONFIG:= \ + CONFIG_QLCNIC \ + CONFIG_QLCNIC_HWMON=y FILES:=$(LINUX_DIR)/drivers/net/ethernet/qlogic/qlcnic/qlcnic.ko AUTOLOAD:=$(call AutoProbe,qlcnic) endef From 1c3e741e29aeeeab7ad93eb368d6e954c12da1f7 Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Thu, 22 Jul 2021 16:37:12 +0300 Subject: [PATCH 24/48] kernel: add missing symbol to kmod-qlcnic When the kmod-qlcnic package is built on targets that have CONFIG_PCI_IOV enabled, the CONFIG_QLCNIC_SRIOV symbol is exposed. Enable this symbol in the kmod package to fix its build. Signed-off-by: Stijn Tintel (cherry picked from commit 3cb22b277a312445bfe34f5e32626c4448f95b77) --- package/kernel/linux/modules/netdevices.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package/kernel/linux/modules/netdevices.mk b/package/kernel/linux/modules/netdevices.mk index 1d310751df..cf7473ff8b 100644 --- a/package/kernel/linux/modules/netdevices.mk +++ b/package/kernel/linux/modules/netdevices.mk @@ -1178,7 +1178,8 @@ define KernelPackage/qlcnic TITLE:=QLogic QLE8240 and QLE8242 device support KCONFIG:= \ CONFIG_QLCNIC \ - CONFIG_QLCNIC_HWMON=y + CONFIG_QLCNIC_HWMON=y \ + CONFIG_QLCNIC_SRIOV=y FILES:=$(LINUX_DIR)/drivers/net/ethernet/qlogic/qlcnic/qlcnic.ko AUTOLOAD:=$(call AutoProbe,qlcnic) endef From be03a0e6aa45b868ebf3b4c4eafef4708ef92230 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Fri, 13 May 2022 19:27:58 +0800 Subject: [PATCH 25/48] octeontx: add missing Kconfig Signed-off-by: Tianling Shen --- target/linux/octeontx/config-4.14 | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/octeontx/config-4.14 b/target/linux/octeontx/config-4.14 index 43dbe4d4fa..b5a4a48dc2 100644 --- a/target/linux/octeontx/config-4.14 +++ b/target/linux/octeontx/config-4.14 @@ -46,6 +46,7 @@ CONFIG_ARM64_4K_PAGES=y # CONFIG_ARM64_64K_PAGES is not set CONFIG_ARM64_CONT_SHIFT=4 CONFIG_ARM64_CRYPTO=y +# CONFIG_ARM64_ERRATUM_1188873 is not set CONFIG_ARM64_HW_AFDBM=y # CONFIG_ARM64_LSE_ATOMICS is not set CONFIG_ARM64_PAGE_SHIFT=12 From 6feb6d726a3d003395d04c6a83240d2c2781bc24 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 29 Mar 2020 22:33:10 +0200 Subject: [PATCH 26/48] ramips: Deactivate NETGEAR WNCE2001 by default The root file system is getting too big for this device and this breaks the ramips/rt305x build. Do not build images for this board by default to fix this problem. Signed-off-by: Hauke Mehrtens (cherry picked from commit f46a3c7b14e68cc9f17c6257157c3ae42c5fb64e) --- target/linux/ramips/image/rt305x.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/ramips/image/rt305x.mk b/target/linux/ramips/image/rt305x.mk index 8f9d5856a0..3ada8502da 100644 --- a/target/linux/ramips/image/rt305x.mk +++ b/target/linux/ramips/image/rt305x.mk @@ -710,6 +710,7 @@ define Device/netgear_wnce2001 DEVICE_VENDOR := NETGEAR DEVICE_MODEL := WNCE2001 SUPPORTED_DEVICES += wnce2001 + DEFAULT := n endef TARGET_DEVICES += netgear_wnce2001 From 7db29197e083600fdd920e5619d3bb3d6ecc4890 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Fri, 13 May 2022 19:45:38 +0800 Subject: [PATCH 27/48] kernel: generic: add missing Kconfig Signed-off-by: Tianling Shen --- target/linux/generic/config-4.14 | 1 + target/linux/ramips/mt76x8/config-4.14 | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/generic/config-4.14 b/target/linux/generic/config-4.14 index 9cd682e11c..4e4df6ec16 100644 --- a/target/linux/generic/config-4.14 +++ b/target/linux/generic/config-4.14 @@ -2250,6 +2250,7 @@ CONFIG_IP_ROUTE_VERBOSE=y # CONFIG_IR_LIRC_CODEC is not set # CONFIG_IR_MCEUSB is not set # CONFIG_IR_NEC_DECODER is not set +# CONFIG_IR_PWM_TX is not set # CONFIG_IR_RC5_DECODER is not set # CONFIG_IR_RC6_DECODER is not set # CONFIG_IR_REDRAT3 is not set diff --git a/target/linux/ramips/mt76x8/config-4.14 b/target/linux/ramips/mt76x8/config-4.14 index 287ceec871..eb74043007 100644 --- a/target/linux/ramips/mt76x8/config-4.14 +++ b/target/linux/ramips/mt76x8/config-4.14 @@ -121,7 +121,6 @@ CONFIG_HW_HAS_PCI=y CONFIG_HZ_PERIODIC=y CONFIG_ICPLUS_PHY=y CONFIG_INITRAMFS_SOURCE="" -# CONFIG_IR_PWM_TX is not set CONFIG_IRQCHIP=y CONFIG_IRQ_DOMAIN=y CONFIG_IRQ_FORCED_THREADING=y From fc96ffcc67379271668d396313ebd41bf1d14b34 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Fri, 13 May 2022 19:52:46 +0800 Subject: [PATCH 28/48] kernel/modules: sound: add Gateworks Avila SoC sound support for ipx4xx Signed-off-by: Tianling Shen --- package/kernel/linux/modules/sound.mk | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/package/kernel/linux/modules/sound.mk b/package/kernel/linux/modules/sound.mk index 6f568478d6..67c6eb2972 100644 --- a/package/kernel/linux/modules/sound.mk +++ b/package/kernel/linux/modules/sound.mk @@ -255,6 +255,25 @@ endef $(eval $(call KernelPackage,sound-soc-imx-sgtl5000)) +define KernelPackage/sound-soc-gw_avila + TITLE:=Gateworks Avila SoC sound support + KCONFIG:= \ + CONFIG_SND_GW_AVILA_SOC \ + CONFIG_SND_GW_AVILA_SOC_PCM \ + CONFIG_SND_GW_AVILA_SOC_HSS + FILES:= \ + $(LINUX_DIR)/sound/soc/codecs/snd-soc-tlv320aic3x.ko \ + $(LINUX_DIR)/sound/soc/gw-avila/snd-soc-gw-avila.ko \ + $(LINUX_DIR)/sound/soc/gw-avila/snd-soc-gw-avila-pcm.ko \ + $(LINUX_DIR)/sound/soc/gw-avila/snd-soc-gw-avila-hss.ko + AUTOLOAD:=$(call AutoLoad,65,snd-soc-tlv320aic3x snd-soc-gw-avila snd-soc-gw-avila-pcm snd-soc-gw-avila-hss) + DEPENDS:=@TARGET_ixp4xx +kmod-sound-soc-core + $(call AddDepends/sound) +endef + +$(eval $(call KernelPackage,sound-soc-gw_avila)) + + define KernelPackage/pcspkr DEPENDS:=@TARGET_x86 +kmod-input-core TITLE:=PC speaker support From 86bd28fc33732ff6b2ea2f1bea18504e690969c5 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Fri, 13 May 2022 19:56:49 +0800 Subject: [PATCH 29/48] mpc85xx: p1020: add missing Kconfig Signed-off-by: Tianling Shen --- target/linux/mpc85xx/p1020/config-default | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/mpc85xx/p1020/config-default b/target/linux/mpc85xx/p1020/config-default index 01c18e4d59..51fc9551e5 100644 --- a/target/linux/mpc85xx/p1020/config-default +++ b/target/linux/mpc85xx/p1020/config-default @@ -15,6 +15,7 @@ CONFIG_I2C_CHARDEV=y CONFIG_LEDS_LP5521=y CONFIG_LEDS_LP55XX_COMMON=y CONFIG_LOCK_SPIN_ON_OWNER=y +# CONFIG_MAX77620_THERMAL is not set # CONFIG_MAX77620_WATCHDOG is not set CONFIG_MFD_CORE=y CONFIG_MFD_MAX77620=y From 3c396e2eef977ad57ba6b3f824e350bd1e2e76b8 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Fri, 13 May 2022 21:05:31 +0800 Subject: [PATCH 30/48] kernel: sfp: fix build Signed-off-by: Tianling Shen --- ...ve-fwnode-parsing-into-sfp-bus-layer.patch | 11 +++--- ....5-net-sfp-rework-upstream-interface.patch | 4 +- ...update-to-use-phy_support_asym_pause.patch | 4 +- ...x-link-mode-modification-in-PHY-mode.patch | 4 +- ....17-net-sfp-ignore-disabled-SFP-node.patch | 38 +++++++++++++++++++ ...nterface-mode-from-ethtool-link-mode.patch | 2 +- ...le-start-stop-upstream-notifications.patch | 2 +- ...p-move-phy_start-phy_stop-to-phylink.patch | 4 +- ...ylink-re-split-__phylink_connect_phy.patch | 8 ++-- ...upport-Clause-45-PHYs-on-SFP-modules.patch | 12 +++--- ...t-link_an_mode-configured-and-curren.patch | 34 ++++++++--------- ...link-split-phylink_sfp_module_insert.patch | 10 ++--- ...y-MAC-configuration-for-copper-SFP-m.patch | 10 ++--- ...ke-Broadcom-BCM84881-based-SFPs-work.patch | 4 +- 14 files changed, 93 insertions(+), 54 deletions(-) create mode 100644 target/linux/generic/backport-4.19/745-v5.17-net-sfp-ignore-disabled-SFP-node.patch diff --git a/target/linux/generic/backport-4.19/716-v5.4-net-sfp-move-fwnode-parsing-into-sfp-bus-layer.patch b/target/linux/generic/backport-4.19/716-v5.4-net-sfp-move-fwnode-parsing-into-sfp-bus-layer.patch index 1a7726b224..4825227ee4 100644 --- a/target/linux/generic/backport-4.19/716-v5.4-net-sfp-move-fwnode-parsing-into-sfp-bus-layer.patch +++ b/target/linux/generic/backport-4.19/716-v5.4-net-sfp-move-fwnode-parsing-into-sfp-bus-layer.patch @@ -16,7 +16,7 @@ Signed-off-by: Russell King --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c -@@ -538,20 +538,13 @@ static const struct sfp_upstream_ops sfp +@@ -538,31 +538,17 @@ static const struct sfp_upstream_ops sfp static int phylink_register_sfp(struct phylink *pl, struct fwnode_handle *fwnode) { @@ -42,10 +42,11 @@ Signed-off-by: Russell King return ret; } -@@ -560,9 +553,7 @@ static int phylink_register_sfp(struct p - return 0; - } - +- if (!fwnode_device_is_available(ref.fwnode)) { +- fwnode_handle_put(ref.fwnode); +- return 0; +- } +- - pl->sfp_bus = sfp_register_upstream(ref.fwnode, pl, &sfp_phylink_ops); - if (!pl->sfp_bus) - return -ENOMEM; diff --git a/target/linux/generic/backport-4.19/717-v5.5-net-sfp-rework-upstream-interface.patch b/target/linux/generic/backport-4.19/717-v5.5-net-sfp-rework-upstream-interface.patch index ac77b32a42..a901b15aaf 100644 --- a/target/linux/generic/backport-4.19/717-v5.5-net-sfp-rework-upstream-interface.patch +++ b/target/linux/generic/backport-4.19/717-v5.5-net-sfp-rework-upstream-interface.patch @@ -29,7 +29,7 @@ Signed-off-by: Russell King if (IS_ERR(bus)) { ret = PTR_ERR(bus); netdev_err(pl->netdev, "unable to attach SFP bus: %d\n", ret); -@@ -555,7 +555,10 @@ static int phylink_register_sfp(struct p +@@ -550,7 +550,10 @@ static int phylink_register_sfp(struct p pl->sfp_bus = bus; @@ -41,7 +41,7 @@ Signed-off-by: Russell King } /** -@@ -639,8 +642,7 @@ EXPORT_SYMBOL_GPL(phylink_create); +@@ -634,8 +637,7 @@ EXPORT_SYMBOL_GPL(phylink_create); */ void phylink_destroy(struct phylink *pl) { diff --git a/target/linux/generic/backport-4.19/739-v5.5-net-phylink-update-to-use-phy_support_asym_pause.patch b/target/linux/generic/backport-4.19/739-v5.5-net-phylink-update-to-use-phy_support_asym_pause.patch index f4ffe85a9d..15db0abc96 100644 --- a/target/linux/generic/backport-4.19/739-v5.5-net-phylink-update-to-use-phy_support_asym_pause.patch +++ b/target/linux/generic/backport-4.19/739-v5.5-net-phylink-update-to-use-phy_support_asym_pause.patch @@ -12,7 +12,7 @@ Signed-off-by: Russell King --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c -@@ -683,12 +683,6 @@ static int phylink_bringup_phy(struct ph +@@ -678,12 +678,6 @@ static int phylink_bringup_phy(struct ph u32 advertising; int ret; @@ -25,7 +25,7 @@ Signed-off-by: Russell King /* * This is the new way of dealing with flow control for PHYs, * as described by Timur Tabi in commit 529ed1275263 ("net: phy: -@@ -696,10 +690,13 @@ static int phylink_bringup_phy(struct ph +@@ -691,10 +685,13 @@ static int phylink_bringup_phy(struct ph * using our validate call to the MAC, we rely upon the MAC * clearing the bits from both supported and advertising fields. */ diff --git a/target/linux/generic/backport-4.19/741-v5.5-net-phylink-fix-link-mode-modification-in-PHY-mode.patch b/target/linux/generic/backport-4.19/741-v5.5-net-phylink-fix-link-mode-modification-in-PHY-mode.patch index 51162ba970..596ecc8272 100644 --- a/target/linux/generic/backport-4.19/741-v5.5-net-phylink-fix-link-mode-modification-in-PHY-mode.patch +++ b/target/linux/generic/backport-4.19/741-v5.5-net-phylink-fix-link-mode-modification-in-PHY-mode.patch @@ -25,7 +25,7 @@ Signed-off-by: Russell King --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c -@@ -1215,7 +1215,13 @@ int phylink_ethtool_ksettings_set(struct +@@ -1210,7 +1210,13 @@ int phylink_ethtool_ksettings_set(struct pl->link_config.duplex = our_kset.base.duplex; pl->link_config.an_enabled = our_kset.base.autoneg != AUTONEG_DISABLE; @@ -40,7 +40,7 @@ Signed-off-by: Russell King phylink_mac_config(pl, &pl->link_config); phylink_mac_an_restart(pl); } -@@ -1295,14 +1301,16 @@ int phylink_ethtool_set_pauseparam(struc +@@ -1290,14 +1296,16 @@ int phylink_ethtool_set_pauseparam(struc if (pause->tx_pause) config->pause |= MLO_PAUSE_TX; diff --git a/target/linux/generic/backport-4.19/745-v5.17-net-sfp-ignore-disabled-SFP-node.patch b/target/linux/generic/backport-4.19/745-v5.17-net-sfp-ignore-disabled-SFP-node.patch new file mode 100644 index 0000000000..0a7af3fa93 --- /dev/null +++ b/target/linux/generic/backport-4.19/745-v5.17-net-sfp-ignore-disabled-SFP-node.patch @@ -0,0 +1,38 @@ +From 2148927e6ed43a1667baf7c2ae3e0e05a44b51a0 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marek=20Beh=C3=BAn?= +Date: Wed, 19 Jan 2022 17:44:55 +0100 +Subject: net: sfp: ignore disabled SFP node +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Commit ce0aa27ff3f6 ("sfp: add sfp-bus to bridge between network devices +and sfp cages") added code which finds SFP bus DT node even if the node +is disabled with status = "disabled". Because of this, when phylink is +created, it ends with non-null .sfp_bus member, even though the SFP +module is not probed (because the node is disabled). + +We need to ignore disabled SFP bus node. + +Fixes: ce0aa27ff3f6 ("sfp: add sfp-bus to bridge between network devices and sfp cages") +Signed-off-by: Marek Behún +Cc: stable@vger.kernel.org # 2203cbf2c8b5 ("net: sfp: move fwnode parsing into sfp-bus layer") +Signed-off-by: David S. Miller +--- + drivers/net/phy/sfp-bus.c | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/drivers/net/phy/sfp-bus.c ++++ b/drivers/net/phy/sfp-bus.c +@@ -557,6 +557,11 @@ struct sfp_bus *sfp_bus_find_fwnode(stru + else if (ret < 0) + return ERR_PTR(ret); + ++ if (!fwnode_device_is_available(ref.fwnode)) { ++ fwnode_handle_put(ref.fwnode); ++ return NULL; ++ } ++ + bus = sfp_bus_get(ref.fwnode); + fwnode_handle_put(ref.fwnode); + if (!bus) diff --git a/target/linux/generic/pending-4.19/741-net-sfp-derive-interface-mode-from-ethtool-link-mode.patch b/target/linux/generic/pending-4.19/741-net-sfp-derive-interface-mode-from-ethtool-link-mode.patch index e0dbabc776..f20b66eae7 100644 --- a/target/linux/generic/pending-4.19/741-net-sfp-derive-interface-mode-from-ethtool-link-mode.patch +++ b/target/linux/generic/pending-4.19/741-net-sfp-derive-interface-mode-from-ethtool-link-mode.patch @@ -29,7 +29,7 @@ Signed-off-by: Russell King dev_err(&phydev->mdio.dev, "incompatible SFP module inserted\n"); --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c -@@ -1668,7 +1668,7 @@ static int phylink_sfp_module_insert(voi +@@ -1663,7 +1663,7 @@ static int phylink_sfp_module_insert(voi linkmode_copy(support1, support); diff --git a/target/linux/generic/pending-4.19/743-net-sfp-add-module-start-stop-upstream-notifications.patch b/target/linux/generic/pending-4.19/743-net-sfp-add-module-start-stop-upstream-notifications.patch index c0c3e9e57e..9b3ebe6a4a 100644 --- a/target/linux/generic/pending-4.19/743-net-sfp-add-module-start-stop-upstream-notifications.patch +++ b/target/linux/generic/pending-4.19/743-net-sfp-add-module-start-stop-upstream-notifications.patch @@ -32,7 +32,7 @@ Signed-off-by: Russell King --- a/drivers/net/phy/sfp-bus.c +++ b/drivers/net/phy/sfp-bus.c -@@ -711,6 +711,27 @@ void sfp_module_remove(struct sfp_bus *b +@@ -716,6 +716,27 @@ void sfp_module_remove(struct sfp_bus *b } EXPORT_SYMBOL_GPL(sfp_module_remove); diff --git a/target/linux/generic/pending-4.19/744-net-sfp-move-phy_start-phy_stop-to-phylink.patch b/target/linux/generic/pending-4.19/744-net-sfp-move-phy_start-phy_stop-to-phylink.patch index 1068873085..a646fcd409 100644 --- a/target/linux/generic/pending-4.19/744-net-sfp-move-phy_start-phy_stop-to-phylink.patch +++ b/target/linux/generic/pending-4.19/744-net-sfp-move-phy_start-phy_stop-to-phylink.patch @@ -16,7 +16,7 @@ Signed-off-by: Russell King --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c -@@ -1722,6 +1722,26 @@ static int phylink_sfp_module_insert(voi +@@ -1717,6 +1717,26 @@ static int phylink_sfp_module_insert(voi return ret; } @@ -43,7 +43,7 @@ Signed-off-by: Russell King static void phylink_sfp_link_down(void *upstream) { struct phylink *pl = upstream; -@@ -1757,6 +1777,8 @@ static const struct sfp_upstream_ops sfp +@@ -1752,6 +1772,8 @@ static const struct sfp_upstream_ops sfp .attach = phylink_sfp_attach, .detach = phylink_sfp_detach, .module_insert = phylink_sfp_module_insert, diff --git a/target/linux/generic/pending-4.19/746-net-phylink-re-split-__phylink_connect_phy.patch b/target/linux/generic/pending-4.19/746-net-phylink-re-split-__phylink_connect_phy.patch index fbe0fc176d..c74a56c575 100644 --- a/target/linux/generic/pending-4.19/746-net-phylink-re-split-__phylink_connect_phy.patch +++ b/target/linux/generic/pending-4.19/746-net-phylink-re-split-__phylink_connect_phy.patch @@ -16,7 +16,7 @@ Signed-off-by: Russell King --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c -@@ -733,11 +733,9 @@ static int phylink_bringup_phy(struct ph +@@ -728,11 +728,9 @@ static int phylink_bringup_phy(struct ph return 0; } @@ -30,7 +30,7 @@ Signed-off-by: Russell King if (WARN_ON(pl->link_an_mode == MLO_AN_FIXED || (pl->link_an_mode == MLO_AN_INBAND && phy_interface_mode_is_8023z(interface)))) -@@ -746,15 +744,7 @@ static int __phylink_connect_phy(struct +@@ -741,15 +739,7 @@ static int __phylink_connect_phy(struct if (pl->phydev) return -EBUSY; @@ -47,7 +47,7 @@ Signed-off-by: Russell King } /** -@@ -774,13 +764,23 @@ static int __phylink_connect_phy(struct +@@ -769,13 +759,23 @@ static int __phylink_connect_phy(struct */ int phylink_connect_phy(struct phylink *pl, struct phy_device *phy) { @@ -72,7 +72,7 @@ Signed-off-by: Russell King } EXPORT_SYMBOL_GPL(phylink_connect_phy); -@@ -1764,8 +1764,17 @@ static void phylink_sfp_link_up(void *up +@@ -1759,8 +1759,17 @@ static void phylink_sfp_link_up(void *up static int phylink_sfp_connect_phy(void *upstream, struct phy_device *phy) { struct phylink *pl = upstream; diff --git a/target/linux/generic/pending-4.19/747-net-phylink-support-Clause-45-PHYs-on-SFP-modules.patch b/target/linux/generic/pending-4.19/747-net-phylink-support-Clause-45-PHYs-on-SFP-modules.patch index 70b07fbd51..2cea118c82 100644 --- a/target/linux/generic/pending-4.19/747-net-phylink-support-Clause-45-PHYs-on-SFP-modules.patch +++ b/target/linux/generic/pending-4.19/747-net-phylink-support-Clause-45-PHYs-on-SFP-modules.patch @@ -18,7 +18,7 @@ Signed-off-by: Russell King --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c -@@ -676,7 +676,8 @@ static void phylink_phy_change(struct ph +@@ -671,7 +671,8 @@ static void phylink_phy_change(struct ph phy_duplex_to_str(phydev->duplex)); } @@ -28,7 +28,7 @@ Signed-off-by: Russell King { struct phylink_link_state config; __ETHTOOL_DECLARE_LINK_MODE_MASK(supported); -@@ -696,7 +697,7 @@ static int phylink_bringup_phy(struct ph +@@ -691,7 +692,7 @@ static int phylink_bringup_phy(struct ph ethtool_convert_legacy_u32_to_link_mode(supported, phy->supported); ethtool_convert_legacy_u32_to_link_mode(config.advertising, phy->advertising); @@ -37,7 +37,7 @@ Signed-off-by: Russell King ret = phylink_validate(pl, supported, &config); if (ret) -@@ -712,6 +713,7 @@ static int phylink_bringup_phy(struct ph +@@ -707,6 +708,7 @@ static int phylink_bringup_phy(struct ph mutex_lock(&phy->lock); mutex_lock(&pl->state_mutex); pl->phydev = phy; @@ -45,7 +45,7 @@ Signed-off-by: Russell King linkmode_copy(pl->supported, supported); linkmode_copy(pl->link_config.advertising, config.advertising); -@@ -776,7 +778,7 @@ int phylink_connect_phy(struct phylink * +@@ -771,7 +773,7 @@ int phylink_connect_phy(struct phylink * if (ret < 0) return ret; @@ -54,7 +54,7 @@ Signed-off-by: Russell King if (ret) phy_detach(phy); -@@ -829,7 +831,7 @@ int phylink_of_phy_connect(struct phylin +@@ -824,7 +826,7 @@ int phylink_of_phy_connect(struct phylin if (!phy_dev) return -ENODEV; @@ -63,7 +63,7 @@ Signed-off-by: Russell King if (ret) phy_detach(phy_dev); -@@ -1764,13 +1766,22 @@ static void phylink_sfp_link_up(void *up +@@ -1759,13 +1761,22 @@ static void phylink_sfp_link_up(void *up static int phylink_sfp_connect_phy(void *upstream, struct phy_device *phy) { struct phylink *pl = upstream; diff --git a/target/linux/generic/pending-4.19/748-net-phylink-split-link_an_mode-configured-and-curren.patch b/target/linux/generic/pending-4.19/748-net-phylink-split-link_an_mode-configured-and-curren.patch index 00350be24e..f30d37f0c6 100644 --- a/target/linux/generic/pending-4.19/748-net-phylink-split-link_an_mode-configured-and-curren.patch +++ b/target/linux/generic/pending-4.19/748-net-phylink-split-link_an_mode-configured-and-curren.patch @@ -91,7 +91,7 @@ Signed-off-by: Russell King pl->cur_interface, pl->phydev); netif_carrier_on(ndev); -@@ -615,7 +616,7 @@ struct phylink *phylink_create(struct ne +@@ -610,7 +611,7 @@ struct phylink *phylink_create(struct ne return ERR_PTR(ret); } @@ -100,7 +100,7 @@ Signed-off-by: Russell King ret = phylink_parse_fixedlink(pl, fwnode); if (ret < 0) { kfree(pl); -@@ -623,6 +624,8 @@ struct phylink *phylink_create(struct ne +@@ -618,6 +619,8 @@ struct phylink *phylink_create(struct ne } } @@ -109,7 +109,7 @@ Signed-off-by: Russell King ret = phylink_register_sfp(pl, fwnode); if (ret < 0) { kfree(pl); -@@ -738,8 +741,8 @@ static int phylink_bringup_phy(struct ph +@@ -733,8 +736,8 @@ static int phylink_bringup_phy(struct ph static int phylink_attach_phy(struct phylink *pl, struct phy_device *phy, phy_interface_t interface) { @@ -120,7 +120,7 @@ Signed-off-by: Russell King phy_interface_mode_is_8023z(interface)))) return -EINVAL; -@@ -806,8 +809,8 @@ int phylink_of_phy_connect(struct phylin +@@ -801,8 +804,8 @@ int phylink_of_phy_connect(struct phylin int ret; /* Fixed links and 802.3z are handled without needing a PHY */ @@ -131,7 +131,7 @@ Signed-off-by: Russell King phy_interface_mode_is_8023z(pl->link_interface))) return 0; -@@ -818,7 +821,7 @@ int phylink_of_phy_connect(struct phylin +@@ -813,7 +816,7 @@ int phylink_of_phy_connect(struct phylin phy_node = of_parse_phandle(dn, "phy-device", 0); if (!phy_node) { @@ -140,7 +140,7 @@ Signed-off-by: Russell King return -ENODEV; return 0; } -@@ -881,7 +884,7 @@ int phylink_fixed_state_cb(struct phylin +@@ -876,7 +879,7 @@ int phylink_fixed_state_cb(struct phylin /* It does not make sense to let the link be overriden unless we use * MLO_AN_FIXED */ @@ -149,7 +149,7 @@ Signed-off-by: Russell King return -EINVAL; mutex_lock(&pl->state_mutex); -@@ -931,7 +934,7 @@ void phylink_start(struct phylink *pl) +@@ -926,7 +929,7 @@ void phylink_start(struct phylink *pl) ASSERT_RTNL(); netdev_info(pl->netdev, "configuring for %s/%s link mode\n", @@ -158,7 +158,7 @@ Signed-off-by: Russell King phy_modes(pl->link_config.interface)); /* Always set the carrier off */ -@@ -953,7 +956,7 @@ void phylink_start(struct phylink *pl) +@@ -948,7 +951,7 @@ void phylink_start(struct phylink *pl) clear_bit(PHYLINK_DISABLE_STOPPED, &pl->phylink_disable_state); phylink_run_resolve(pl); @@ -167,7 +167,7 @@ Signed-off-by: Russell King int irq = gpiod_to_irq(pl->link_gpio); if (irq > 0) { -@@ -968,7 +971,7 @@ void phylink_start(struct phylink *pl) +@@ -963,7 +966,7 @@ void phylink_start(struct phylink *pl) if (irq <= 0) mod_timer(&pl->link_poll, jiffies + HZ); } @@ -176,7 +176,7 @@ Signed-off-by: Russell King mod_timer(&pl->link_poll, jiffies + HZ); if (pl->phydev) phy_start(pl->phydev); -@@ -1095,7 +1098,7 @@ int phylink_ethtool_ksettings_get(struct +@@ -1090,7 +1093,7 @@ int phylink_ethtool_ksettings_get(struct linkmode_copy(kset->link_modes.supported, pl->supported); @@ -185,7 +185,7 @@ Signed-off-by: Russell King case MLO_AN_FIXED: /* We are using fixed settings. Report these as the * current link settings - and note that these also -@@ -1168,7 +1171,7 @@ int phylink_ethtool_ksettings_set(struct +@@ -1163,7 +1166,7 @@ int phylink_ethtool_ksettings_set(struct /* If we have a fixed link (as specified by firmware), refuse * to change link parameters. */ @@ -194,7 +194,7 @@ Signed-off-by: Russell King (s->speed != pl->link_config.speed || s->duplex != pl->link_config.duplex)) return -EINVAL; -@@ -1180,7 +1183,7 @@ int phylink_ethtool_ksettings_set(struct +@@ -1175,7 +1178,7 @@ int phylink_ethtool_ksettings_set(struct __clear_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, config.advertising); } else { /* If we have a fixed link, refuse to enable autonegotiation */ @@ -203,7 +203,7 @@ Signed-off-by: Russell King return -EINVAL; config.speed = SPEED_UNKNOWN; -@@ -1222,7 +1225,7 @@ int phylink_ethtool_ksettings_set(struct +@@ -1217,7 +1220,7 @@ int phylink_ethtool_ksettings_set(struct * configuration. For a fixed link, this isn't able to change any * parameters, which just leaves inband mode. */ @@ -212,7 +212,7 @@ Signed-off-by: Russell King !test_bit(PHYLINK_DISABLE_STOPPED, &pl->phylink_disable_state)) { phylink_mac_config(pl, &pl->link_config); phylink_mac_an_restart(pl); -@@ -1312,7 +1315,7 @@ int phylink_ethtool_set_pauseparam(struc +@@ -1307,7 +1310,7 @@ int phylink_ethtool_set_pauseparam(struc pause->tx_pause); } else if (!test_bit(PHYLINK_DISABLE_STOPPED, &pl->phylink_disable_state)) { @@ -221,7 +221,7 @@ Signed-off-by: Russell King case MLO_AN_FIXED: /* Should we allow fixed links to change against the config? */ phylink_resolve_flow(pl, config); -@@ -1501,7 +1504,7 @@ static int phylink_mii_read(struct phyli +@@ -1496,7 +1499,7 @@ static int phylink_mii_read(struct phyli struct phylink_link_state state; int val = 0xffff; @@ -230,7 +230,7 @@ Signed-off-by: Russell King case MLO_AN_FIXED: if (phy_id == 0) { phylink_get_fixed_state(pl, &state); -@@ -1529,7 +1532,7 @@ static int phylink_mii_read(struct phyli +@@ -1524,7 +1527,7 @@ static int phylink_mii_read(struct phyli static int phylink_mii_write(struct phylink *pl, unsigned int phy_id, unsigned int reg, unsigned int val) { @@ -239,7 +239,7 @@ Signed-off-by: Russell King case MLO_AN_FIXED: break; -@@ -1703,10 +1706,10 @@ static int phylink_sfp_module_insert(voi +@@ -1698,10 +1701,10 @@ static int phylink_sfp_module_insert(voi linkmode_copy(pl->link_config.advertising, config.advertising); } diff --git a/target/linux/generic/pending-4.19/749-net-phylink-split-phylink_sfp_module_insert.patch b/target/linux/generic/pending-4.19/749-net-phylink-split-phylink_sfp_module_insert.patch index 7a5283a59c..87d70d1434 100644 --- a/target/linux/generic/pending-4.19/749-net-phylink-split-phylink_sfp_module_insert.patch +++ b/target/linux/generic/pending-4.19/749-net-phylink-split-phylink_sfp_module_insert.patch @@ -13,7 +13,7 @@ Signed-off-by: Russell King --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c -@@ -1638,25 +1638,21 @@ static void phylink_sfp_detach(void *ups +@@ -1633,25 +1633,21 @@ static void phylink_sfp_detach(void *ups pl->netdev->sfp_bus = NULL; } @@ -46,7 +46,7 @@ Signed-off-by: Russell King config.interface = PHY_INTERFACE_MODE_NA; config.speed = SPEED_UNKNOWN; config.duplex = DUPLEX_UNKNOWN; -@@ -1671,8 +1667,6 @@ static int phylink_sfp_module_insert(voi +@@ -1666,8 +1662,6 @@ static int phylink_sfp_module_insert(voi return ret; } @@ -55,7 +55,7 @@ Signed-off-by: Russell King iface = sfp_select_interface(pl->sfp_bus, config.advertising); if (iface == PHY_INTERFACE_MODE_NA) { netdev_err(pl->netdev, -@@ -1682,18 +1676,18 @@ static int phylink_sfp_module_insert(voi +@@ -1677,18 +1671,18 @@ static int phylink_sfp_module_insert(voi } config.interface = iface; @@ -77,7 +77,7 @@ Signed-off-by: Russell King __ETHTOOL_LINK_MODE_MASK_NBITS, support); if (phy_interface_mode_is_8023z(iface) && pl->phydev) -@@ -1706,15 +1700,15 @@ static int phylink_sfp_module_insert(voi +@@ -1701,15 +1695,15 @@ static int phylink_sfp_module_insert(voi linkmode_copy(pl->link_config.advertising, config.advertising); } @@ -96,7 +96,7 @@ Signed-off-by: Russell King phy_modes(config.interface)); } -@@ -1727,6 +1721,21 @@ static int phylink_sfp_module_insert(voi +@@ -1722,6 +1716,21 @@ static int phylink_sfp_module_insert(voi return ret; } diff --git a/target/linux/generic/pending-4.19/750-net-phylink-delay-MAC-configuration-for-copper-SFP-m.patch b/target/linux/generic/pending-4.19/750-net-phylink-delay-MAC-configuration-for-copper-SFP-m.patch index f5618042c9..358b9a1082 100644 --- a/target/linux/generic/pending-4.19/750-net-phylink-delay-MAC-configuration-for-copper-SFP-m.patch +++ b/target/linux/generic/pending-4.19/750-net-phylink-delay-MAC-configuration-for-copper-SFP-m.patch @@ -36,7 +36,7 @@ Signed-off-by: Russell King }; static inline void linkmode_zero(unsigned long *dst) -@@ -1638,7 +1641,7 @@ static void phylink_sfp_detach(void *ups +@@ -1633,7 +1636,7 @@ static void phylink_sfp_detach(void *ups pl->netdev->sfp_bus = NULL; } @@ -45,7 +45,7 @@ Signed-off-by: Russell King const unsigned long *supported, const unsigned long *advertising) { -@@ -1712,7 +1715,7 @@ static int phylink_sfp_config(struct phy +@@ -1707,7 +1710,7 @@ static int phylink_sfp_config(struct phy phy_modes(config.interface)); } @@ -54,7 +54,7 @@ Signed-off-by: Russell King if (changed && !test_bit(PHYLINK_DISABLE_STOPPED, &pl->phylink_disable_state)) -@@ -1725,15 +1728,20 @@ static int phylink_sfp_module_insert(voi +@@ -1720,15 +1723,20 @@ static int phylink_sfp_module_insert(voi const struct sfp_eeprom_id *id) { struct phylink *pl = upstream; @@ -79,7 +79,7 @@ Signed-off-by: Russell King } static int phylink_sfp_module_start(void *upstream) -@@ -1741,10 +1749,19 @@ static int phylink_sfp_module_start(void +@@ -1736,10 +1744,19 @@ static int phylink_sfp_module_start(void struct phylink *pl = upstream; /* If this SFP module has a PHY, start the PHY now. */ @@ -102,7 +102,7 @@ Signed-off-by: Russell King } static void phylink_sfp_module_stop(void *upstream) -@@ -1778,10 +1795,30 @@ static void phylink_sfp_link_up(void *up +@@ -1773,10 +1790,30 @@ static void phylink_sfp_link_up(void *up static int phylink_sfp_connect_phy(void *upstream, struct phy_device *phy) { struct phylink *pl = upstream; diff --git a/target/linux/generic/pending-4.19/751-net-phylink-make-Broadcom-BCM84881-based-SFPs-work.patch b/target/linux/generic/pending-4.19/751-net-phylink-make-Broadcom-BCM84881-based-SFPs-work.patch index c011f3cf8c..1724d445b7 100644 --- a/target/linux/generic/pending-4.19/751-net-phylink-make-Broadcom-BCM84881-based-SFPs-work.patch +++ b/target/linux/generic/pending-4.19/751-net-phylink-make-Broadcom-BCM84881-based-SFPs-work.patch @@ -18,7 +18,7 @@ Signed-off-by: Russell King --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c -@@ -1792,12 +1792,22 @@ static void phylink_sfp_link_up(void *up +@@ -1787,12 +1787,22 @@ static void phylink_sfp_link_up(void *up phylink_run_resolve(pl); } @@ -41,7 +41,7 @@ Signed-off-by: Russell King int ret; /* -@@ -1812,8 +1822,13 @@ static int phylink_sfp_connect_phy(void +@@ -1807,8 +1817,13 @@ static int phylink_sfp_connect_phy(void ethtool_convert_legacy_u32_to_link_mode(supported, phy->supported); ethtool_convert_legacy_u32_to_link_mode(advertising, phy->advertising); From ae00ad5376092b5ac2b9351295fd37203ce07490 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Sat, 14 May 2022 13:40:58 +0800 Subject: [PATCH 31/48] ixp4xx: add missing Kconfig Signed-off-by: Tianling Shen --- target/linux/ixp4xx/config-4.9 | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/ixp4xx/config-4.9 b/target/linux/ixp4xx/config-4.9 index c9b1be9304..0090f28826 100644 --- a/target/linux/ixp4xx/config-4.9 +++ b/target/linux/ixp4xx/config-4.9 @@ -235,6 +235,7 @@ CONFIG_SWIOTLB=y CONFIG_SYS_SUPPORTS_APM_EMULATION=y CONFIG_TICK_CPU_ACCOUNTING=y CONFIG_UNCOMPRESS_INCLUDE="mach/uncompress.h" +CONFIG_UNWINDER_ARM=y CONFIG_USB_EHCI_BIG_ENDIAN_DESC=y CONFIG_USB_EHCI_BIG_ENDIAN_MMIO=y CONFIG_USB_SUPPORT=y From af2f2d70a2edad029cb0e4074f28879fb5745d02 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Sat, 14 May 2022 14:14:23 +0800 Subject: [PATCH 32/48] ixp4xx: add missing Kconfig Signed-off-by: Tianling Shen --- target/linux/ixp4xx/config-4.9 | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/ixp4xx/config-4.9 b/target/linux/ixp4xx/config-4.9 index 0090f28826..85e0e8c931 100644 --- a/target/linux/ixp4xx/config-4.9 +++ b/target/linux/ixp4xx/config-4.9 @@ -236,6 +236,7 @@ CONFIG_SYS_SUPPORTS_APM_EMULATION=y CONFIG_TICK_CPU_ACCOUNTING=y CONFIG_UNCOMPRESS_INCLUDE="mach/uncompress.h" CONFIG_UNWINDER_ARM=y +# CONFIG_UNWINDER_FRAME_POINTER is not set CONFIG_USB_EHCI_BIG_ENDIAN_DESC=y CONFIG_USB_EHCI_BIG_ENDIAN_MMIO=y CONFIG_USB_SUPPORT=y From c812f84eaf0d833c45440c63cc793604fa19423c Mon Sep 17 00:00:00 2001 From: Tomasz Maciej Nowak Date: Wed, 18 Mar 2020 19:04:12 +0100 Subject: [PATCH 33/48] mvebu: cortexa9: correct cpu subtype Armada 370 processors have only 16 double-precision registers. The change introduced by 8dcc1087602e ("toolchain: ARM: Fix toolchain compilation for gcc 8.x") switched accidentally the toolchain for mvebu cortexa9 subtarget to cpu type with 32 double-precision registers. This stems from gcc defaults which assume "vfpv3-d32" if only "vfpv3" as mfpu is specified. That change resulted in unusable image, in which kernel will kill userspace as soon as it causing "Illegal instruction". Ref: https://forum.openwrt.org/t/gcc-was-broken-on-mvebu-armada-370-device-after-commit-on-2019-03-25/43272 Fixes: 8dcc1087602e ("toolchain: ARM: Fix toolchain compilation for gcc 8.x") Signed-off-by: Tomasz Maciej Nowak (cherry picked from commit 2d61f8821c7cf99354e904139226c132554ba180) --- target/linux/mvebu/cortexa9/target.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/mvebu/cortexa9/target.mk b/target/linux/mvebu/cortexa9/target.mk index 2a75599bc9..cdd4d86e49 100644 --- a/target/linux/mvebu/cortexa9/target.mk +++ b/target/linux/mvebu/cortexa9/target.mk @@ -10,5 +10,5 @@ include $(TOPDIR)/rules.mk ARCH:=arm BOARDNAME:=Marvell Armada 37x/38x/XP CPU_TYPE:=cortex-a9 -CPU_SUBTYPE:=vfpv3 +CPU_SUBTYPE:=vfpv3-d16 KERNELNAME:=zImage dtbs From db99e1851d19154bc27603e2e7bb3558d4aaad50 Mon Sep 17 00:00:00 2001 From: Tomasz Maciej Nowak Date: Wed, 18 Mar 2020 19:04:13 +0100 Subject: [PATCH 34/48] tegra: correct cpu subtype Tegra 2 processors have only 16 double-precision registers. The change introduced by 8dcc1087602e ("toolchain: ARM: Fix toolchain compilation for gcc 8.x") switched accidentally the toolchain for tegra target to cpu type with 32 double-precision registers. This stems from gcc defaults which assume "vfpv3-d32" if only "vfpv3" as mfpu is specified. That change resulted in unusable image, in which kernel will kill userspace as soon as it causing "Illegal instruction". Ref: https://forum.openwrt.org/t/gcc-was-broken-on-mvebu-armada-370-device-after-commit-on-2019-03-25/43272 Fixes: 8dcc1087602e ("toolchain: ARM: Fix toolchain compilation for gcc 8.x") Signed-off-by: Tomasz Maciej Nowak (cherry picked from commit 43d1d88510621801d66a0a7f46f4c4f44d89633a) --- target/linux/tegra/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/tegra/Makefile b/target/linux/tegra/Makefile index db58bf53d1..8c4da2e52f 100644 --- a/target/linux/tegra/Makefile +++ b/target/linux/tegra/Makefile @@ -11,7 +11,7 @@ BOARD := tegra BOARDNAME := NVIDIA Tegra FEATURES := audio boot-part display ext4 fpu gpio pci pcie rootfs-part rtc squashfs usb CPU_TYPE := cortex-a9 -CPU_SUBTYPE := vfpv3 +CPU_SUBTYPE := vfpv3-d16 MAINTAINER := Tomasz Maciej Nowak KERNEL_PATCHVER := 4.19 From 19d556319e0319928f47d5327682d2d1df800110 Mon Sep 17 00:00:00 2001 From: Josef Schlehofer Date: Sun, 13 Dec 2020 15:02:36 +0100 Subject: [PATCH 35/48] armvirt/64: change it to cortex-a53 instead of generic Package architecture aarch64_generic [1] can be used just with three devices. One is NanoPI R2S and then there are two development boards from NXP. Let's change armvirt/64 to Cortex A53 (aarch64_cortex-a53) [2]. It has wider support by multiple devices like NanoPI Neo Plus2/Core2, ESPRESSObin, Pine64, and Raspberry Pi 2&3. While looking at ARMvirt/32 it has set CPU_TYPE and CPU_SUBTYPE to be arm_cortex-a15_neon-vfpv4 [3]. It has support to devices like Linksys EA8500 v1, Linksys EA7500 v1, Netgear D7800, Netgear R7500 and so on. Tested with: qemu-system-aarch64 -m 1024 -smp 2 -cpu cortex-a57 -M virt -nographic \ -kernel openwrt-armvirt-64-Image-initramfs Successfully compiled and booted. Here goes the output: root@OpenWrt:/# uname -a Linux OpenWrt 5.4.82 #0 SMP Sun Dec 13 12:52:10 2020 aarch64 GNU/Linux root@OpenWrt:/# cat /etc/openwrt_release DISTRIB_ID='OpenWrt' DISTRIB_RELEASE='SNAPSHOT' DISTRIB_REVISION='r15207-96fca0f807' DISTRIB_TARGET='armvirt/64' DISTRIB_ARCH='aarch64_cortex-a53' DISTRIB_DESCRIPTION='OpenWrt SNAPSHOT r15207-96fca0f807' DISTRIB_TAINTS='no-all' Also, change BOARDNAME to be the same as it is in armvirt/32. [1] https://openwrt.org/docs/techref/instructionset/aarch64_generic [2] https://openwrt.org/docs/techref/instructionset/aarch64_cortex-a53 [3] https://openwrt.org/docs/techref/instructionset/arm_cortex-a15_neon-vfpv4 Signed-off-by: Josef Schlehofer (cherry picked from commit 222dc0ad912370a620172a781a1c429dae01ab08) --- target/linux/armvirt/64/target.mk | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/target/linux/armvirt/64/target.mk b/target/linux/armvirt/64/target.mk index 38d8fa13b6..58adcc7d60 100644 --- a/target/linux/armvirt/64/target.mk +++ b/target/linux/armvirt/64/target.mk @@ -1,8 +1,9 @@ ARCH:=aarch64 SUBTARGET:=64 -BOARDNAME:=ARMv8 multiplatform +BOARDNAME:=QEMU ARMv8 Virtual Machine (cortex-a53) +CPU_TYPE:=cortex-a53 KERNELNAME:=Image define Target/Description - Build multi-platform images for the ARMv8 instruction set architecture + Build multi-platform images for the ARMv8 instruction set architecture endef From 51c26f0c978f63f7c2b9b7da495b2d3e07d51f2d Mon Sep 17 00:00:00 2001 From: Sungbo Eo Date: Sat, 12 Feb 2022 17:01:31 +0900 Subject: [PATCH 36/48] tools: zip: fetch SOURCE_DATE_EPOCH directly Remove "--mtime" option introduced in commit 18c9faa03211 ("tools: zip: add option for reproducible archives") and instead fetch SOURCE_DATE_EPOCH environment variable directly in the code. Ref: https://sourceforge.net/p/infozip/patches/25/ Signed-off-by: Sungbo Eo (cherry picked from commit 39d06472eb93d72940b2728d33e2dafa2676e47b) --- include/image-commands.mk | 1 - ...add-option-for-reproducible-archives.patch | 145 ------------------ .../zip/patches/011-reproducible-mtime.patch | 41 +++++ 3 files changed, 41 insertions(+), 146 deletions(-) delete mode 100644 tools/zip/patches/011-add-option-for-reproducible-archives.patch create mode 100644 tools/zip/patches/011-reproducible-mtime.patch diff --git a/include/image-commands.mk b/include/image-commands.mk index 83f76c2b55..4686c89f61 100644 --- a/include/image-commands.mk +++ b/include/image-commands.mk @@ -184,7 +184,6 @@ define Build/zip mv $@ $@.tmp/$(1) zip -j -X \ - $(if $(SOURCE_DATE_EPOCH),--mtime="$(SOURCE_DATE_EPOCH)") \ $@ $@.tmp/$(if $(1),$(1),$@) rm -rf $@.tmp endef diff --git a/tools/zip/patches/011-add-option-for-reproducible-archives.patch b/tools/zip/patches/011-add-option-for-reproducible-archives.patch deleted file mode 100644 index 45b9d67e15..0000000000 --- a/tools/zip/patches/011-add-option-for-reproducible-archives.patch +++ /dev/null @@ -1,145 +0,0 @@ -From 6d659fc87451c02c8777dc33f750b16834e4c715 Mon Sep 17 00:00:00 2001 -From: Mathias Kresin -Date: Sat, 12 Jan 2019 19:33:33 +0100 -Subject: [PATCH] add option for reproducible archives - -Add the option -mt/--mtime to pass a timestamp which is used as filedate -for the containing files. - -So far, it isn't used for anything written to the extra fields, -therefore requires the -X (eXclude eXtra file attributes) parameter to -be effective. - -Signed-off-by: Mathias Kresin ---- - globals.c | 1 + - util.c | 22 ++++++++++++++++++++++ - zip.c | 6 ++++++ - zip.h | 1 + - zipup.c | 4 +++- - 5 files changed, 33 insertions(+), 1 deletion(-) - ---- a/globals.c -+++ b/globals.c -@@ -205,6 +205,7 @@ uzoff_t bytes_this_split = 0; /* byt - int read_split_archive = 0; /* 1=scanzipf_reg detected spanning signature */ - int split_method = 0; /* 0=no splits, 1=seekable, 2=data desc, -1=no */ - uzoff_t split_size = 0; /* how big each split should be */ -+time_t timestamp = -1; /* fixed timestamp for archive content filedate */ - int split_bell = 0; /* when pause for next split ring bell */ - uzoff_t bytes_prev_splits = 0; /* total bytes written to all splits before this */ - uzoff_t bytes_this_entry = 0; /* bytes written for this entry across all splits */ ---- a/util.c -+++ b/util.c -@@ -1217,6 +1217,7 @@ int DisplayNumString(file, i) - return 0; - } - -+ - /* Read numbers with trailing size multiplier (like 10M) and return number. - 10/30/04 EG */ - -@@ -1279,6 +1280,29 @@ uzoff_t ReadNumString( numstring ) - } - - -+uzoff_t ReadNumStringUL( numstring ) -+ char *numstring; -+{ -+ zoff_t num = 0; -+ -+ /* check if valid number (currently no negatives) */ -+ if (numstring == NULL) { -+ zipwarn("Unable to read empty number in ReadNumString", ""); -+ return (uzoff_t)-1; -+ } -+ if (numstring[0] < '0' || numstring[0] > '9') { -+ zipwarn("Unable to read number (must start with digit): ", numstring); -+ return (uzoff_t)-1; -+ } -+ if (strlen(numstring) > 10) { -+ zipwarn("Number too long to read (10 characters max): ", numstring); -+ return (uzoff_t)-1; -+ } -+ -+ return (uzoff_t)atoll(numstring); -+} -+ -+ - /* Write the number as a string with a multiplier (like 10M) to outstring. - Always writes no more than 3 digits followed maybe by a multiplier and - returns the characters written or -1 if error. ---- a/zip.c -+++ b/zip.c -@@ -1942,6 +1942,7 @@ int set_filetype(out_path) - #ifdef UNICODE_TEST - #define o_sC 0x146 - #endif -+#define o_mt 0x255 - - - /* the below is mainly from the old main command line -@@ -2036,6 +2037,7 @@ struct option_struct far options[] = { - {"m", "move", o_NO_VALUE, o_NOT_NEGATABLE, 'm', "add files to archive then delete files"}, - {"mm", "", o_NO_VALUE, o_NOT_NEGATABLE, o_mm, "not used"}, - {"MM", "must-match", o_NO_VALUE, o_NOT_NEGATABLE, o_MM, "error if in file not matched/not readable"}, -+ {"mt", "mtime", o_REQUIRED_VALUE, o_NOT_NEGATABLE, o_mt, "use fixed timestamp for archive content filedate"}, - {"n", "suffixes", o_REQUIRED_VALUE, o_NOT_NEGATABLE, 'n', "suffixes to not compress: .gz:.zip"}, - {"nw", "no-wild", o_NO_VALUE, o_NOT_NEGATABLE, o_nw, "no wildcards during add or update"}, - #if defined(AMIGA) || defined(MACOS) -@@ -2440,6 +2442,7 @@ char **argv; /* command line - split_method = 0; /* 0=no splits, 1=update LHs, 2=data descriptors */ - split_size = 0; /* how big each split should be */ - split_bell = 0; /* when pause for next split ring bell */ -+ timestamp = -1; /* fixed timestamp for archive content filedate */ - bytes_prev_splits = 0; /* total bytes written to all splits before this */ - bytes_this_entry = 0; /* bytes written for this entry across all splits */ - noisy_splits = 0; /* be verbose about creating splits */ -@@ -2897,6 +2900,9 @@ char **argv; /* command line - dispose = 1; break; - case o_MM: /* Exit with error if input file can't be read */ - bad_open_is_error = 1; break; -+ case o_mt: /* fixed timestamp for archive content filedate */ -+ timestamp = ReadNumStringUL(value); -+ break; - case 'n': /* Don't compress files with a special suffix */ - special = value; - /* special = NULL; */ /* will be set at next argument */ ---- a/zip.h -+++ b/zip.h -@@ -502,6 +502,7 @@ extern uzoff_t bytes_this_split; /* byte - extern int read_split_archive; /* 1=scanzipf_reg detected spanning signature */ - extern int split_method; /* 0=no splits, 1=seekable, 2=data descs, -1=no */ - extern uzoff_t split_size; /* how big each split should be */ -+extern time_t timestamp; /* fixed timestamp for archive content filedate */ - extern int split_bell; /* when pause for next split ring bell */ - extern uzoff_t bytes_prev_splits; /* total bytes written to all splits before this */ - extern uzoff_t bytes_this_entry; /* bytes written for this entry across all splits */ -@@ -789,6 +790,7 @@ char *zip_fzofft OF((zoff_t, char - int DisplayNumString OF ((FILE *file, uzoff_t i)); - int WriteNumString OF((uzoff_t num, char *outstring)); - uzoff_t ReadNumString OF((char *numstring)); -+uzoff_t ReadNumStringUL OF((char *numstring)); - - /* returns true if abbrev is abbreviation for string */ - int abbrevmatch OF((char *, char *, int, int)); ---- a/zipup.c -+++ b/zipup.c -@@ -415,7 +415,6 @@ struct zlist far *z; /* zip entry to - char *tempextra = NULL; - char *tempcextra = NULL; - -- - #ifdef WINDLL - # ifdef ZIP64_SUPPORT - extern _int64 filesize64; -@@ -441,6 +440,9 @@ struct zlist far *z; /* zip entry to - if (tim == 0 || q == (zoff_t) -3) - return ZE_OPEN; - -+ if (timestamp > 0) -+ tim = unix2dostime(×tamp); -+ - /* q is set to -1 if the input file is a device, -2 for a volume label */ - if (q == (zoff_t) -2) { - isdir = 1; diff --git a/tools/zip/patches/011-reproducible-mtime.patch b/tools/zip/patches/011-reproducible-mtime.patch new file mode 100644 index 0000000000..6ce8445e83 --- /dev/null +++ b/tools/zip/patches/011-reproducible-mtime.patch @@ -0,0 +1,41 @@ +From 501ae4e93fd6fa2f7d20d00d1b011f9006802eae Mon Sep 17 00:00:00 2001 +From: "Bernhard M. Wiedemann" +Date: Fri, 3 May 2019 16:32:24 +0200 +Subject: [PATCH] Override mtime with zip -X + +with SOURCE_DATE_EPOCH +to allow for reproducible builds of .zip files + +See https://reproducible-builds.org/ for why this is good +and https://reproducible-builds.org/specs/source-date-epoch/ +for the definition of this variable. + +Uses clamping to keep older mtimes than SOURCE_DATE_EPOCH intact. +--- + zipup.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +--- a/zipup.c ++++ b/zipup.c +@@ -414,6 +414,7 @@ struct zlist far *z; /* zip entry to + ush tempcext = 0; + char *tempextra = NULL; + char *tempcextra = NULL; ++ const char *source_date_epoch; + + + #ifdef WINDLL +@@ -674,6 +675,13 @@ struct zlist far *z; /* zip entry to + + } /* strcmp(z->name, "-") == 0 */ + ++ if (extra_fields == 0 && (source_date_epoch = getenv("SOURCE_DATE_EPOCH")) != NULL) { ++ time_t epoch = strtoull(source_date_epoch, NULL, 10); ++ if (epoch > 0) { ++ ulg epochtim = unix2dostime(&epoch); ++ if (z->tim > epochtim) z->tim = epochtim; ++ } ++ } + if (extra_fields == 2) { + unsigned len; + char *p; From 5b5a34737cfc37a4d80da7ad5e158b36ee7ce5b9 Mon Sep 17 00:00:00 2001 From: Sungbo Eo Date: Sat, 12 Feb 2022 17:01:31 +0900 Subject: [PATCH 37/48] build: image: use UTC for zip timestamp Zip uses DOS timestamp for mtime which is stored in local time and hence depends on the timezone of the build system. Force zip to use UTC timezone to make image builds more reproducible. Signed-off-by: Sungbo Eo (cherry picked from commit e42764cc5fa364e9fa553903c56191484738965e) --- include/image-commands.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/image-commands.mk b/include/image-commands.mk index 4686c89f61..e20c303b71 100644 --- a/include/image-commands.mk +++ b/include/image-commands.mk @@ -183,7 +183,7 @@ define Build/zip mkdir $@.tmp mv $@ $@.tmp/$(1) - zip -j -X \ + TZ=UTC zip -j -X \ $@ $@.tmp/$(if $(1),$(1),$@) rm -rf $@.tmp endef From e333999ecf9dfee2b1c3da22b776eade671d0a4a Mon Sep 17 00:00:00 2001 From: Sungbo Eo Date: Sun, 5 Dec 2021 02:08:48 +0900 Subject: [PATCH 38/48] build: image: improve zip build recipe * clean before build * specify executable path * allow adding extra options for zip * use basename of $@ Signed-off-by: Sungbo Eo (cherry picked from commit 446da706690a239dc7a454102db0b0a3b3a9d1ed) --- include/image-commands.mk | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/include/image-commands.mk b/include/image-commands.mk index e20c303b71..08a9b786a1 100644 --- a/include/image-commands.mk +++ b/include/image-commands.mk @@ -180,11 +180,13 @@ define Build/gzip endef define Build/zip + rm -rf $@.tmp mkdir $@.tmp - mv $@ $@.tmp/$(1) + mv $@ $@.tmp/$(word 1,$(1)) - TZ=UTC zip -j -X \ - $@ $@.tmp/$(if $(1),$(1),$@) + TZ=UTC $(STAGING_DIR_HOST)/bin/zip -j -X \ + $(wordlist 2,$(words $(1)),$(1)) \ + $@ $@.tmp/$(if $(word 1,$(1)),$(word 1,$(1)),$$(basename $@)) rm -rf $@.tmp endef From c1a0582615feec9954260a3b1f8917c70642d08a Mon Sep 17 00:00:00 2001 From: Piotr Dymacz Date: Fri, 1 Apr 2022 17:35:42 +0200 Subject: [PATCH 39/48] image: drop unused 'BuildKernel/MkFIT' The 'MkFIT' recipe is no longer used across whole codebase. Signed-off-by: Piotr Dymacz --- include/image.mk | 8 -------- 1 file changed, 8 deletions(-) diff --git a/include/image.mk b/include/image.mk index e4fa94e6bf..0028d87955 100644 --- a/include/image.mk +++ b/include/image.mk @@ -138,14 +138,6 @@ define Image/BuildKernel/MkuImage -n '$(call toupper,$(ARCH)) $(VERSION_DIST) Linux-$(LINUX_VERSION)' -d $(4) $(5) endef -define Image/BuildKernel/MkFIT - $(TOPDIR)/scripts/mkits.sh \ - -D $(1) -o $(KDIR)/fit-$(1).its -k $(2) $(if $(3),-d $(3)) -C $(4) -a $(5) -e $(6) \ - -c $(if $(DEVICE_DTS_CONFIG),$(DEVICE_DTS_CONFIG),"config@1") \ - -A $(LINUX_KARCH) -v $(LINUX_VERSION) - PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $(KDIR)/fit-$(1).its $(KDIR)/fit-$(1)$(7).itb -endef - ifdef CONFIG_TARGET_IMAGES_GZIP define Image/Gzip rm -f $(1).gz From de12c57c88f4c8fda8a76800c8c8a5691529b93c Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Fri, 13 May 2022 21:55:46 +0200 Subject: [PATCH 40/48] linux-firmware: Update to version 20220509 git log --pretty=oneline --abbrev-commit 20220411..20220509 (sorted) amdgpu: 480d6c2 amdgpu: update dcn_3_1_6_dmcub firmware b4994be amdgpu: update gc_10_3_7_rlc firmware 61eb408 amdgpu: update psp_13_0_8 firmware fcf9d8c amdgpu: update yellow carp DMCUB firmware ath10k: 73743b8 ath10k: QCA4019 hw1.0: update board-2.bin 6ad0930 ath10k: QCA6174 hw3.0: update board-2.bin 729bd7f ath10k: QCA6174 hw3.0: update firmware-6.bin to WLAN.RM.4.4.1-00288-QCARMSWPZ-1 9fce09f ath10k: QCA9888 hw2.0: update board-2.bin b155d85 ath10k: QCA9888 hw2.0: update firmware-5.bin to 10.4-3.9.0.2-00156 44b8aee ath10k: QCA9984 hw1.0: update board-2.bin 4ad3bd3 ath10k: QCA9984 hw1.0: update firmware-5.bin to 10.4-3.9.0.2-00156 1962cba ath10k: QCA99X0 hw2.0: add board-2.bin Signed-off-by: Christian Lamparter --- package/firmware/linux-firmware/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/firmware/linux-firmware/Makefile b/package/firmware/linux-firmware/Makefile index 382807d112..6d474b6452 100644 --- a/package/firmware/linux-firmware/Makefile +++ b/package/firmware/linux-firmware/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=linux-firmware -PKG_VERSION:=20220411 +PKG_VERSION:=20220509 PKG_RELEASE:=1 PKG_SOURCE_URL:=@KERNEL/linux/kernel/firmware PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_HASH:=020b11f6412f4956f5a6f98de7d41867d2b30ea0ce81b1e2d206ec9840363849 +PKG_HASH:=376e0b3d7b4f8aaa2abf7f5ab74803dcf14b06b94e3d841b1467cd9a2848255e PKG_MAINTAINER:=Felix Fietkau From dd7e948e00340fa14c972df7de38c7521e24203f Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sun, 1 May 2022 20:58:33 -0700 Subject: [PATCH 41/48] util-linux: update to 2.38 Various fixes. Signed-off-by: Rosen Penev --- package/utils/util-linux/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/utils/util-linux/Makefile b/package/utils/util-linux/Makefile index c8a365693b..ea3e686486 100644 --- a/package/utils/util-linux/Makefile +++ b/package/utils/util-linux/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=util-linux -PKG_VERSION:=2.37.3 +PKG_VERSION:=2.38 PKG_RELEASE:=$(AUTORELEASE) PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_SOURCE_URL:=@KERNEL/linux/utils/$(PKG_NAME)/v2.37 -PKG_HASH:=590c592e58cd6bf38519cb467af05ce6a1ab18040e3e3418f24bcfb2f55f9776 +PKG_SOURCE_URL:=@KERNEL/linux/utils/$(PKG_NAME)/v2.38 +PKG_HASH:=6d111cbe4d55b336db2f1fbeffbc65b89908704c01136371d32aa9bec373eb64 PKG_CPE_ID:=cpe:/a:kernel:util-linux PKG_LICENSE:=GPL-2.0-only From eab60d315feca87f453fc6c63fde169ea803c897 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Fri, 29 Apr 2022 18:41:45 -0700 Subject: [PATCH 42/48] util-linux: use meson to build Compiles faster, is PIC by default, and does not have pkgconfig files with wrong paths. Add various fixes to it as it seems cross compilation was never tested. Signed-off-by: Rosen Penev --- package/utils/util-linux/Makefile | 117 ++++++++++-------- .../util-linux/patches/010-meson-typo.patch | 20 +++ ...eson-fix-compilation-without-systemd.patch | 22 ++++ .../patches/030-meson-don-t-use-run.patch | 34 +++++ .../040-meson-fix-cpu_set_t-test.patch | 23 ++++ .../050-meson-fix-environ-search.patch | 23 ++++ ...son-add-_GNU_SOURCE-for-sighandler_t.patch | 23 ++++ .../patches/070-meson-fix-isnan-check.patch | 24 ++++ .../patches/080-meson-fix-tzname-check.patch | 23 ++++ .../util-linux/patches/090-meson-libpam.patch | 18 +++ ...-make-libcap-ng-dependent-on-setpriv.patch | 31 +++++ ...n-fix-when-HAVE_CLOCK_GETTIME-is-set.patch | 21 ++++ ...oject-version-from-the-version-gen-s.patch | 20 +++ ...r-in-processing-version-for-pc-files.patch | 26 ++++ .../util-linux/patches/200-meson-no-po.patch | 10 ++ ...se_urandom.patch => 210-use-urandom.patch} | 0 16 files changed, 384 insertions(+), 51 deletions(-) create mode 100644 package/utils/util-linux/patches/010-meson-typo.patch create mode 100644 package/utils/util-linux/patches/020-meson-fix-compilation-without-systemd.patch create mode 100644 package/utils/util-linux/patches/030-meson-don-t-use-run.patch create mode 100644 package/utils/util-linux/patches/040-meson-fix-cpu_set_t-test.patch create mode 100644 package/utils/util-linux/patches/050-meson-fix-environ-search.patch create mode 100644 package/utils/util-linux/patches/060-meson-add-_GNU_SOURCE-for-sighandler_t.patch create mode 100644 package/utils/util-linux/patches/070-meson-fix-isnan-check.patch create mode 100644 package/utils/util-linux/patches/080-meson-fix-tzname-check.patch create mode 100644 package/utils/util-linux/patches/090-meson-libpam.patch create mode 100644 package/utils/util-linux/patches/100-meson-make-libcap-ng-dependent-on-setpriv.patch create mode 100644 package/utils/util-linux/patches/110-meson-fix-when-HAVE_CLOCK_GETTIME-is-set.patch create mode 100644 package/utils/util-linux/patches/120-meson-get-the-project-version-from-the-version-gen-s.patch create mode 100644 package/utils/util-linux/patches/130-meson-fix-error-in-processing-version-for-pc-files.patch create mode 100644 package/utils/util-linux/patches/200-meson-no-po.patch rename package/utils/util-linux/patches/{100-use_urandom.patch => 210-use-urandom.patch} (100%) diff --git a/package/utils/util-linux/Makefile b/package/utils/util-linux/Makefile index ea3e686486..a6e1dce5aa 100644 --- a/package/utils/util-linux/Makefile +++ b/package/utils/util-linux/Makefile @@ -25,14 +25,10 @@ PKG_LICENSE_FILES:= COPYING \ libuuid/COPYING \ Documentation/licenses/COPYING.BSD-3 -PKG_BUILD_PARALLEL:=1 - -PKG_FIXUP:=autoreconf PKG_INSTALL:=1 -DISABLE_NLS:=--disable-nls - include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/meson.mk define Package/util-linux/Default SECTION:=utils @@ -511,44 +507,69 @@ define Package/wipefs/description libblkid. endef -CONFIGURE_ARGS += \ - --disable-use-tty-group \ - --disable-rpath \ - --disable-tls \ - --disable-su \ - --disable-sulogin \ - --disable-makeinstall-chown \ - --disable-login \ - --disable-nologin \ - --disable-lslogins \ - --disable-runuser \ - --disable-chfn-chsh \ - --disable-raw \ - --without-python \ - --without-udev \ - --without-readline \ - --without-libmagic \ - --with-ncursesw - -TARGET_CFLAGS += $(FPIC) -std=gnu99 +MESON_ARGS += \ + -Dsystemd=disabled \ + -Dtinfo=disabled \ + -Dcryptsetup=disabled \ + -Dlibutil=disabled \ + -Dlibutempter=disabled \ + -Dlibpcre2-posix=disabled \ + -Dlibuser=disabled \ + -Duse-tty-group=false \ + -Duse-tls=false \ + -Dbuild-python=disabled \ + -Dbuild-zramctl=disabled \ + -Dbuild-fsck=disabled \ + -Dbuild-wipefs=disabled \ + -Dbuild-fallocate=disabled \ + -Dbuild-setpriv=disabled \ + -Dbuild-hardlink=disabled \ + -Dbuild-cramfs=disabled \ + -Dbuild-bfs=disabled \ + -Dbuild-minix=disabled \ + -Dbuild-fdformat=disabled \ + -Dbuild-lslogins=disabled \ + -Dbuild-wdctl=disabled \ + -Dbuild-cal=disabled \ + -Dbuild-switch_root=disabled \ + -Dbuild-pivot_root=disabled \ + -Dbuild-lsmem=disabled \ + -Dbuild-lsirq=disabled \ + -Dbuild-irqtop=disabled \ + -Dbuild-chmem=disabled \ + -Dbuild-ipcrm=disabled \ + -Dbuild-rfkill=disabled \ + -Dbuild-tunelp=disabled \ + -Dbuild-kill=disabled \ + -Dbuild-last=disabled \ + -Dbuild-utmpdump=disabled \ + -Dbuild-line=disabled \ + -Dbuild-mesg=disabled \ + -Dbuild-raw=disabled \ + -Dbuild-vipw=disabled \ + -Dbuild-newgrp=disabled \ + -Dbuild-chfn-chsh=disabled \ + -Dbuild-login=disabled \ + -Dbuild-nologin=disabled \ + -Dbuild-sulogin=disabled \ + -Dbuild-su=disabled \ + -Dbuild-runuser=disabled \ + -Dbuild-ul=disabled \ + -Dbuild-pg=disabled \ + -Dbuild-write=disabled \ + -Dbuild-bash-completion=disabled \ + -Dbuild-pylibmount=disabled \ + -Dreadline=disabled \ + -Dmagic=disabled \ + -Dncursesw=enabled define Build/InstallDev $(INSTALL_DIR) $(1)/usr/lib/pkgconfig $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/blkid.pc $(1)/usr/lib/pkgconfig - $(SED) 's,/usr/include,$$$${prefix}/include,g' $(1)/usr/lib/pkgconfig/blkid.pc - $(SED) 's,/usr/lib,$$$${exec_prefix}/lib,g' $(1)/usr/lib/pkgconfig/blkid.pc $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/fdisk.pc $(1)/usr/lib/pkgconfig - $(SED) 's,/usr/include,$$$${prefix}/include,g' $(1)/usr/lib/pkgconfig/fdisk.pc - $(SED) 's,/usr/lib,$$$${exec_prefix}/lib,g' $(1)/usr/lib/pkgconfig/fdisk.pc $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/mount.pc $(1)/usr/lib/pkgconfig - $(SED) 's,/usr/include,$$$${prefix}/include,g' $(1)/usr/lib/pkgconfig/mount.pc - $(SED) 's,/usr/lib,$$$${exec_prefix}/lib,g' $(1)/usr/lib/pkgconfig/mount.pc $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/smartcols.pc $(1)/usr/lib/pkgconfig - $(SED) 's,/usr/include,$$$${prefix}/include,g' $(1)/usr/lib/pkgconfig/smartcols.pc - $(SED) 's,/usr/lib,$$$${exec_prefix}/lib,g' $(1)/usr/lib/pkgconfig/smartcols.pc $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/uuid.pc $(1)/usr/lib/pkgconfig - $(SED) 's,/usr/include,$$$${prefix}/include,g' $(1)/usr/lib/pkgconfig/uuid.pc - $(SED) 's,/usr/lib,$$$${exec_prefix}/lib,g' $(1)/usr/lib/pkgconfig/uuid.pc $(INSTALL_DIR) $(1)/usr/include/blkid $(CP) $(PKG_INSTALL_DIR)/usr/include/blkid/blkid.h $(1)/usr/include/blkid @@ -562,43 +583,37 @@ define Build/InstallDev $(CP) $(PKG_INSTALL_DIR)/usr/include/libsmartcols/libsmartcols.h $(1)/usr/include/libsmartcols $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/lib/libblkid.so* $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/lib/libfdisk.so* $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/lib/libmount.so* $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/lib/libuuid.so* $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/lib/libsmartcols.so* $(1)/usr/lib - - $(LN) libblkid.so.1 $(1)/usr/lib/libblkid.so - $(LN) libfdisk.so.1 $(1)/usr/lib/libfdisk.so - $(LN) libmount.so.1 $(1)/usr/lib/libmount.so - $(LN) libuuid.so.1 $(1)/usr/lib/libuuid.so - $(LN) libsmartcols.so.1 $(1)/usr/lib/libsmartcols.so + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libblkid.so* $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libfdisk.so* $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libmount.so* $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libuuid.so* $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsmartcols.so* $(1)/usr/lib endef define Package/libfdisk/install $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/lib/libfdisk.so.* $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libfdisk.so.* $(1)/usr/lib/ endef define Package/libblkid/install $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/lib/libblkid.so.* $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libblkid.so.* $(1)/usr/lib/ endef define Package/libmount/install $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/lib/libmount.so.* $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libmount.so.* $(1)/usr/lib/ endef define Package/libsmartcols/install $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/lib/libsmartcols.so.* $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsmartcols.so.* $(1)/usr/lib/ endef define Package/libuuid/install $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/lib/libuuid.so.* $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libuuid.so.* $(1)/usr/lib/ endef define Package/agetty/install diff --git a/package/utils/util-linux/patches/010-meson-typo.patch b/package/utils/util-linux/patches/010-meson-typo.patch new file mode 100644 index 0000000000..466d942d58 --- /dev/null +++ b/package/utils/util-linux/patches/010-meson-typo.patch @@ -0,0 +1,20 @@ +From c387d4fe7a1435a762a5b7d8b75feb13ad613315 Mon Sep 17 00:00:00 2001 +From: Anatoly Pugachev +Date: Fri, 8 Apr 2022 15:34:16 +0300 +Subject: [PATCH] libfdisk: meson.build fix typo + +--- + libfdisk/meson.build | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/libfdisk/meson.build ++++ b/libfdisk/meson.build +@@ -11,7 +11,7 @@ libfdisk_h = configure_file( + output : 'libfdisk.h', + configuration : defs, + install : build_libfdisk, +- install_dir : join_paths(get_option('includedir'), 'libfisk'), ++ install_dir : join_paths(get_option('includedir'), 'libfdisk'), + ) + + lib_fdisk_sources = ''' diff --git a/package/utils/util-linux/patches/020-meson-fix-compilation-without-systemd.patch b/package/utils/util-linux/patches/020-meson-fix-compilation-without-systemd.patch new file mode 100644 index 0000000000..aa209994ec --- /dev/null +++ b/package/utils/util-linux/patches/020-meson-fix-compilation-without-systemd.patch @@ -0,0 +1,22 @@ +From 38b15ca2dc4ca32bbe4a2449e1c7b645e4577840 Mon Sep 17 00:00:00 2001 +From: Rosen Penev +Date: Fri, 29 Apr 2022 16:53:43 -0700 +Subject: [PATCH 1/7] meson: fix compilation without systemd + +systemdsystemunitdir is used elsewhere. + +Signed-off-by: Rosen Penev +--- + meson.build | 1 + + 1 file changed, 1 insertion(+) + +--- a/meson.build ++++ b/meson.build +@@ -720,6 +720,7 @@ if fs_search_path_extra != '' + endif + conf.set_quoted('FS_SEARCH_PATH', fs_search_path) + ++systemdsystemunitdir = '' + if systemd.found() + systemdsystemunitdir = systemd.get_pkgconfig_variable('systemdsystemunitdir') + endif diff --git a/package/utils/util-linux/patches/030-meson-don-t-use-run.patch b/package/utils/util-linux/patches/030-meson-don-t-use-run.patch new file mode 100644 index 0000000000..7803dd7725 --- /dev/null +++ b/package/utils/util-linux/patches/030-meson-don-t-use-run.patch @@ -0,0 +1,34 @@ +From e25db9169450d3d5fb43656a2eae5c08999310f4 Mon Sep 17 00:00:00 2001 +From: Rosen Penev +Date: Fri, 29 Apr 2022 16:56:54 -0700 +Subject: [PATCH 2/7] meson: don't use run + +Fixes cross compilation. run is not needed anyway. + +Signed-off-by: Rosen Penev +--- + meson.build | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +--- a/meson.build ++++ b/meson.build +@@ -577,8 +577,7 @@ int main(void) { + return tzname ? 0 : 1; + } + '''.format(have ? 1 : 0) +-result = cc.run(code, name : 'using tzname[]') +-have = result.compiled() and result.returncode() == 0 ++have = cc.compiles(code, name : 'using tzname[]') + conf.set('HAVE_TZNAME', have ? 1 : false) + + socket_libs = [] +@@ -641,8 +640,7 @@ int main(void) { + return (*__progname != 0); + } + ''' +-result = cc.run(code, name : 'using __progname') +-have = result.compiled() and result.returncode() == 0 ++have = cc.compiles(code, name : 'using __progname') + conf.set('HAVE___PROGNAME', have ? 1 : false) + + build_plymouth_support = get_option('build-plymouth-support') diff --git a/package/utils/util-linux/patches/040-meson-fix-cpu_set_t-test.patch b/package/utils/util-linux/patches/040-meson-fix-cpu_set_t-test.patch new file mode 100644 index 0000000000..bdbfc4bfe0 --- /dev/null +++ b/package/utils/util-linux/patches/040-meson-fix-cpu_set_t-test.patch @@ -0,0 +1,23 @@ +From 4194bb5b35e9b5f3296bf17b7cabcc5cb1632ba3 Mon Sep 17 00:00:00 2001 +From: Rosen Penev +Date: Fri, 29 Apr 2022 16:55:15 -0700 +Subject: [PATCH 3/7] meson: fix cpu_set_t test + +_GNU_SOURCE is needed here. + +Signed-off-by: Rosen Penev +--- + meson.build | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/meson.build ++++ b/meson.build +@@ -379,7 +379,7 @@ endforeach + have = cc.has_header('sched.h') + conf.set10('HAVE_DECL_CPU_ALLOC', have) + # We get -1 if the size cannot be determined +-have_cpu_set_t = cc.sizeof('cpu_set_t', prefix : '#include ') > 0 ++have_cpu_set_t = cc.sizeof('cpu_set_t', prefix : '#define _GNU_SOURCE\n#include ') > 0 + conf.set('HAVE_CPU_SET_T', have_cpu_set_t ? 1 : false) + + have = cc.has_header_symbol('stdlib.h', 'environ') diff --git a/package/utils/util-linux/patches/050-meson-fix-environ-search.patch b/package/utils/util-linux/patches/050-meson-fix-environ-search.patch new file mode 100644 index 0000000000..2cd02e5b47 --- /dev/null +++ b/package/utils/util-linux/patches/050-meson-fix-environ-search.patch @@ -0,0 +1,23 @@ +From 1e9e2b9fe365cc4a0025d44dc0a9c54bfffe9058 Mon Sep 17 00:00:00 2001 +From: Rosen Penev +Date: Fri, 29 Apr 2022 18:16:17 -0700 +Subject: [PATCH 4/7] meson: fix environ search + +musl has it defined in unistd.h and hidden behind _GNU_SOURCE. + +Signed-off-by: Rosen Penev +--- + meson.build | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/meson.build ++++ b/meson.build +@@ -382,7 +382,7 @@ conf.set10('HAVE_DECL_CPU_ALLOC', have) + have_cpu_set_t = cc.sizeof('cpu_set_t', prefix : '#define _GNU_SOURCE\n#include ') > 0 + conf.set('HAVE_CPU_SET_T', have_cpu_set_t ? 1 : false) + +-have = cc.has_header_symbol('stdlib.h', 'environ') ++have = cc.has_header_symbol('unistd.h', 'environ', prefix : '#define _GNU_SOURCE') + conf.set10('HAVE_ENVIRON_DECL', have) + + have = cc.has_header_symbol('signal.h', 'sighandler_t') diff --git a/package/utils/util-linux/patches/060-meson-add-_GNU_SOURCE-for-sighandler_t.patch b/package/utils/util-linux/patches/060-meson-add-_GNU_SOURCE-for-sighandler_t.patch new file mode 100644 index 0000000000..7f9137f8bc --- /dev/null +++ b/package/utils/util-linux/patches/060-meson-add-_GNU_SOURCE-for-sighandler_t.patch @@ -0,0 +1,23 @@ +From 5d7557eb3827664b2b78145373907f2a6994bdf9 Mon Sep 17 00:00:00 2001 +From: Rosen Penev +Date: Fri, 29 Apr 2022 18:17:52 -0700 +Subject: [PATCH 5/7] meson: add _GNU_SOURCE for sighandler_t + +musl requires it. + +Signed-off-by: Rosen Penev +--- + meson.build | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/meson.build ++++ b/meson.build +@@ -385,7 +385,7 @@ conf.set('HAVE_CPU_SET_T', have_cpu_set_ + have = cc.has_header_symbol('unistd.h', 'environ', prefix : '#define _GNU_SOURCE') + conf.set10('HAVE_ENVIRON_DECL', have) + +-have = cc.has_header_symbol('signal.h', 'sighandler_t') ++have = cc.has_header_symbol('signal.h', 'sighandler_t', prefix : '#define _GNU_SOURCE') + conf.set('HAVE_SIGHANDLER_T', have ? 1 : false) + + have = cc.has_header_symbol('string.h', 'strsignal') diff --git a/package/utils/util-linux/patches/070-meson-fix-isnan-check.patch b/package/utils/util-linux/patches/070-meson-fix-isnan-check.patch new file mode 100644 index 0000000000..a0b104f801 --- /dev/null +++ b/package/utils/util-linux/patches/070-meson-fix-isnan-check.patch @@ -0,0 +1,24 @@ +From 777652585924034deeba98ae3192f26bc32bb661 Mon Sep 17 00:00:00 2001 +From: Rosen Penev +Date: Fri, 29 Apr 2022 18:19:53 -0700 +Subject: [PATCH 6/7] meson: fix isnan check + +musl only has isnan as a macro, not as a function. Handle the former +case. + +Signed-off-by: Rosen Penev +--- + meson.build | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/meson.build ++++ b/meson.build +@@ -622,7 +622,7 @@ rtas_libs = cc.find_library('rtas', requ + conf.set('HAVE_LIBRTAS', rtas_libs.found() ? 1 : false) + + math_libs = [] +-if not cc.has_function('isnan') ++if not cc.has_header_symbol('math.h', 'isnan') + lib = cc.find_library('m', required : true) + if (cc.has_function('isnan', dependencies : lib) and + cc.has_function('__isnan', dependencies : lib)) diff --git a/package/utils/util-linux/patches/080-meson-fix-tzname-check.patch b/package/utils/util-linux/patches/080-meson-fix-tzname-check.patch new file mode 100644 index 0000000000..f5d53c4d36 --- /dev/null +++ b/package/utils/util-linux/patches/080-meson-fix-tzname-check.patch @@ -0,0 +1,23 @@ +From 9a6b2618b46a859388139d1eb18f876886786659 Mon Sep 17 00:00:00 2001 +From: Rosen Penev +Date: Fri, 29 Apr 2022 19:00:53 -0700 +Subject: [PATCH] meson: fix tzname check + +tzname is not a type but a variable. sizeof only works on types. + +Signed-off-by: Rosen Penev +--- + meson.build | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/meson.build ++++ b/meson.build +@@ -565,7 +565,7 @@ have = cc.has_member('struct tm', 'tm_zo + prefix : '#include ') + conf.set('HAVE_STRUCT_TM_TM_ZONE', have ? 1 : false) + +-have = cc.sizeof('tzname', prefix : '#include ') > 0 ++have = cc.has_header_symbol('time.h', 'tzname') + conf.set('HAVE_DECL_TZNAME', have ? 1 : false) + + code = ''' diff --git a/package/utils/util-linux/patches/090-meson-libpam.patch b/package/utils/util-linux/patches/090-meson-libpam.patch new file mode 100644 index 0000000000..c9a91b9937 --- /dev/null +++ b/package/utils/util-linux/patches/090-meson-libpam.patch @@ -0,0 +1,18 @@ +--- a/meson.build ++++ b/meson.build +@@ -299,10 +299,14 @@ conf.set('HAVE_LIBUDEV', lib_udev.found( + + lib_crypt = cc.find_library('crypt') + +-lib_pam = cc.find_library('pam') ++req_libpam = not (get_option('build-login').disabled() or get_option('build-chfn-chsh').disabled() ++ or get_option('build-su').disabled() or get_option('build-runuser').disabled()) ++lib_pam = cc.find_library('pam', required : req_libpam) + if lib_pam.found() + lib_pam_misc = cc.find_library('pam_misc') + lib_pam = [lib_pam, lib_pam_misc] ++else ++ lib_pam_misc = declare_dependency() + endif + + lib_cryptsetup = dependency( diff --git a/package/utils/util-linux/patches/100-meson-make-libcap-ng-dependent-on-setpriv.patch b/package/utils/util-linux/patches/100-meson-make-libcap-ng-dependent-on-setpriv.patch new file mode 100644 index 0000000000..d8b1199004 --- /dev/null +++ b/package/utils/util-linux/patches/100-meson-make-libcap-ng-dependent-on-setpriv.patch @@ -0,0 +1,31 @@ +From cd23a4336f49ba6a12ade557a09589f2a7c966f4 Mon Sep 17 00:00:00 2001 +From: Rosen Penev +Date: Mon, 2 May 2022 16:18:33 -0700 +Subject: [PATCH] meson: make libcap-ng dependent on setpriv + +Signed-off-by: Rosen Penev +--- + meson.build | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/meson.build ++++ b/meson.build +@@ -334,7 +334,8 @@ have = cc.has_function( + conf.set('HAVE_CRYPT_ACTIVATE_BY_SIGNED_KEY', have ? 1 : false) + + lib_cap_ng = dependency( +- 'libcap-ng') ++ 'libcap-ng', ++ required : get_option('build-setpriv')) + + lib_selinux = dependency( + 'libselinux', +@@ -1754,7 +1755,7 @@ if opt and not is_disabler(exe) + exes += exe + endif + +-opt = not get_option('build-setpriv').disabled() ++opt = not get_option('build-setpriv').disabled() and lib_cap_ng.found() + exe = executable( + 'setpriv', + setpriv_sources, diff --git a/package/utils/util-linux/patches/110-meson-fix-when-HAVE_CLOCK_GETTIME-is-set.patch b/package/utils/util-linux/patches/110-meson-fix-when-HAVE_CLOCK_GETTIME-is-set.patch new file mode 100644 index 0000000000..bba8baf5ab --- /dev/null +++ b/package/utils/util-linux/patches/110-meson-fix-when-HAVE_CLOCK_GETTIME-is-set.patch @@ -0,0 +1,21 @@ +From e51565b653cf09985df57cb7254b16d5af5df223 Mon Sep 17 00:00:00 2001 +From: Nicolas Caramelli +Date: Fri, 29 Apr 2022 18:16:36 +0200 +Subject: [PATCH] meson: fix when HAVE_CLOCK_GETTIME is set + +Signed-off-by: Nicolas Caramelli +--- + meson.build | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/meson.build ++++ b/meson.build +@@ -602,7 +602,7 @@ if not have + have = cc.has_function('clock_gettime', + dependencies : realtime_libs) + endif +-conf.set('HAVE_CLOCK_GETTIME', have_dirfd ? 1 : false) ++conf.set('HAVE_CLOCK_GETTIME', have ? 1 : false) + + thread_libs = dependency('threads') + diff --git a/package/utils/util-linux/patches/120-meson-get-the-project-version-from-the-version-gen-s.patch b/package/utils/util-linux/patches/120-meson-get-the-project-version-from-the-version-gen-s.patch new file mode 100644 index 0000000000..8529c8268e --- /dev/null +++ b/package/utils/util-linux/patches/120-meson-get-the-project-version-from-the-version-gen-s.patch @@ -0,0 +1,20 @@ +From e0c1a86bf88b568a7afe8ebaea1b9f84afb892c2 Mon Sep 17 00:00:00 2001 +From: Eli Schwartz +Date: Wed, 4 May 2022 23:52:31 -0400 +Subject: [PATCH] meson: get the project version from the version-gen script + +This matches autotools and ensures that the version number is actually +reliable. +--- + meson.build | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/meson.build ++++ b/meson.build +@@ -1,5 +1,5 @@ + project('util-linux', 'c', +- version : '2.37', ++ version : run_command('tools/git-version-gen', check: true).stdout(), + license : 'GPLv2+') + + pkgconfig = import('pkgconfig') diff --git a/package/utils/util-linux/patches/130-meson-fix-error-in-processing-version-for-pc-files.patch b/package/utils/util-linux/patches/130-meson-fix-error-in-processing-version-for-pc-files.patch new file mode 100644 index 0000000000..75e88682e3 --- /dev/null +++ b/package/utils/util-linux/patches/130-meson-fix-error-in-processing-version-for-pc-files.patch @@ -0,0 +1,26 @@ +From dc307e1cbf73f6dbf72bb049c19d332774cdb4e7 Mon Sep 17 00:00:00 2001 +From: Eli Schwartz +Date: Thu, 5 May 2022 00:16:15 -0400 +Subject: [PATCH] meson: fix error in processing version for pc files + +This awk command was copied verbatim from configure.ac, which included +non-awk syntax because configure.ac cannot contain [ literals. + +Rewrite these autoconf quadrigraphs as their actual values, for meson. + +Fixes always setting the micro version to "0". +--- + meson.build | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/meson.build ++++ b/meson.build +@@ -41,7 +41,7 @@ conf.set_quoted('PACKAGE_VERSION', meson + + codes = [''' {print $1} ''', + ''' {sub("-.*","",$2); print $2} ''', +- ''' {sub("-.*","",$3); print $3 ~ /^@<:@0-9@:>@+$/ ? $3 : 0} '''] ++ ''' {sub("-.*","",$3); print $3 ~ /^[0-9]+$/ ? $3 : 0} '''] + pc_version = [] + foreach code : codes + res = run_command('bash', '-c', diff --git a/package/utils/util-linux/patches/200-meson-no-po.patch b/package/utils/util-linux/patches/200-meson-no-po.patch new file mode 100644 index 0000000000..d626036bb2 --- /dev/null +++ b/package/utils/util-linux/patches/200-meson-no-po.patch @@ -0,0 +1,10 @@ +--- a/meson.build ++++ b/meson.build +@@ -774,7 +774,6 @@ subdir('disk-utils') + subdir('misc-utils') + subdir('text-utils') + subdir('term-utils') +-subdir('po') + + includes = [dir_include, + dir_libblkid, diff --git a/package/utils/util-linux/patches/100-use_urandom.patch b/package/utils/util-linux/patches/210-use-urandom.patch similarity index 100% rename from package/utils/util-linux/patches/100-use_urandom.patch rename to package/utils/util-linux/patches/210-use-urandom.patch From c1470478fb52388dea197b6c3186a987f61e28cd Mon Sep 17 00:00:00 2001 From: Eneas U de Queiroz Date: Tue, 10 May 2022 20:34:57 -0300 Subject: [PATCH 43/48] openssl: bump to 1.1.1o This release comes with a security fix related to c_rehash. OpenWrt does not ship or use it, so it was not affected by the bug. There is a fix for a possible crash in ERR_load_strings() when configured with no-err, which OpenWrt does by default. Signed-off-by: Eneas U de Queiroz --- package/libs/openssl/Makefile | 4 ++-- ...0-e_devcrypto-make-the-dev-crypto-engine-dynamic.patch | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package/libs/openssl/Makefile b/package/libs/openssl/Makefile index a8ec5d015d..87dab1f2dc 100644 --- a/package/libs/openssl/Makefile +++ b/package/libs/openssl/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=openssl PKG_BASE:=1.1.1 -PKG_BUGFIX:=n +PKG_BUGFIX:=o PKG_VERSION:=$(PKG_BASE)$(PKG_BUGFIX) PKG_RELEASE:=$(AUTORELEASE) PKG_USE_MIPS16:=0 @@ -27,7 +27,7 @@ PKG_SOURCE_URL:= \ ftp://ftp.pca.dfn.de/pub/tools/net/openssl/source/ \ ftp://ftp.pca.dfn.de/pub/tools/net/openssl/source/old/$(PKG_BASE)/ -PKG_HASH:=40dceb51a4f6a5275bde0e6bf20ef4b91bfc32ed57c0552e2e8e15463372b17a +PKG_HASH:=9384a2b0570dd80358841464677115df785edb941c71211f75076d72fe6b438f PKG_LICENSE:=OpenSSL PKG_LICENSE_FILES:=LICENSE diff --git a/package/libs/openssl/patches/430-e_devcrypto-make-the-dev-crypto-engine-dynamic.patch b/package/libs/openssl/patches/430-e_devcrypto-make-the-dev-crypto-engine-dynamic.patch index 1298efe546..da9b704501 100644 --- a/package/libs/openssl/patches/430-e_devcrypto-make-the-dev-crypto-engine-dynamic.patch +++ b/package/libs/openssl/patches/430-e_devcrypto-make-the-dev-crypto-engine-dynamic.patch @@ -21,7 +21,7 @@ diff --git a/crypto/engine/build.info b/crypto/engine/build.info diff --git a/crypto/init.c b/crypto/init.c --- a/crypto/init.c +++ b/crypto/init.c -@@ -329,18 +329,6 @@ DEFINE_RUN_ONCE_STATIC(ossl_init_engine_openssl) +@@ -328,18 +328,6 @@ DEFINE_RUN_ONCE_STATIC(ossl_init_engine_openssl) engine_load_openssl_int(); return 1; } @@ -40,7 +40,7 @@ diff --git a/crypto/init.c b/crypto/init.c # ifndef OPENSSL_NO_RDRAND static CRYPTO_ONCE engine_rdrand = CRYPTO_ONCE_STATIC_INIT; -@@ -365,6 +353,18 @@ DEFINE_RUN_ONCE_STATIC(ossl_init_engine_dynamic) +@@ -364,6 +352,18 @@ DEFINE_RUN_ONCE_STATIC(ossl_init_engine_dynamic) return 1; } # ifndef OPENSSL_NO_STATIC_ENGINE @@ -59,7 +59,7 @@ diff --git a/crypto/init.c b/crypto/init.c # if !defined(OPENSSL_NO_HW) && !defined(OPENSSL_NO_HW_PADLOCK) static CRYPTO_ONCE engine_padlock = CRYPTO_ONCE_STATIC_INIT; DEFINE_RUN_ONCE_STATIC(ossl_init_engine_padlock) -@@ -713,11 +713,6 @@ int OPENSSL_init_crypto(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings) +@@ -704,11 +704,6 @@ int OPENSSL_init_crypto(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings) if ((opts & OPENSSL_INIT_ENGINE_OPENSSL) && !RUN_ONCE(&engine_openssl, ossl_init_engine_openssl)) return 0; @@ -71,7 +71,7 @@ diff --git a/crypto/init.c b/crypto/init.c # ifndef OPENSSL_NO_RDRAND if ((opts & OPENSSL_INIT_ENGINE_RDRAND) && !RUN_ONCE(&engine_rdrand, ossl_init_engine_rdrand)) -@@ -727,6 +722,11 @@ int OPENSSL_init_crypto(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings) +@@ -718,6 +713,11 @@ int OPENSSL_init_crypto(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings) && !RUN_ONCE(&engine_dynamic, ossl_init_engine_dynamic)) return 0; # ifndef OPENSSL_NO_STATIC_ENGINE From b67326b9bf2dc2f77bedb2f8deca84cf6e5bc2bf Mon Sep 17 00:00:00 2001 From: Eneas U de Queiroz Date: Tue, 10 May 2022 16:39:11 -0300 Subject: [PATCH 44/48] wolfssl: bump to v5.3.0-stable This is mostly a bug fix release, including two that were already patched here: - 300-fix-SSL_get_verify_result-regression.patch - 400-wolfcrypt-src-port-devcrypto-devcrypto_aes.c-remove-.patch Signed-off-by: Eneas U de Queiroz (cherry picked from commit 73c1fe2890baa5c0bfa46f53c5387f5e47de1acb) --- package/libs/wolfssl/Makefile | 4 ++-- ...fix-SSL_get_verify_result-regression.patch | 24 ------------------- ...rt-devcrypto-devcrypto_aes.c-remove-.patch | 19 --------------- 3 files changed, 2 insertions(+), 45 deletions(-) delete mode 100644 package/libs/wolfssl/patches/300-fix-SSL_get_verify_result-regression.patch delete mode 100644 package/libs/wolfssl/patches/400-wolfcrypt-src-port-devcrypto-devcrypto_aes.c-remove-.patch diff --git a/package/libs/wolfssl/Makefile b/package/libs/wolfssl/Makefile index fbdb71cf34..472a25cf6f 100644 --- a/package/libs/wolfssl/Makefile +++ b/package/libs/wolfssl/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=wolfssl -PKG_VERSION:=5.2.0-stable +PKG_VERSION:=5.3.0-stable PKG_RELEASE:=$(AUTORELEASE) PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/wolfSSL/wolfssl/archive/v$(PKG_VERSION) -PKG_HASH:=409b4646c5f54f642de0e9f3544c3b83de7238134f5b1ff93fb44527bf119d05 +PKG_HASH:=1a3bb310dc01d3e73d9ad91b6ea8249d081016f8eef4ae8f21d3421f91ef1de9 PKG_FIXUP:=libtool PKG_INSTALL:=1 diff --git a/package/libs/wolfssl/patches/300-fix-SSL_get_verify_result-regression.patch b/package/libs/wolfssl/patches/300-fix-SSL_get_verify_result-regression.patch deleted file mode 100644 index d6e7998744..0000000000 --- a/package/libs/wolfssl/patches/300-fix-SSL_get_verify_result-regression.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 87e43dd63ba429297e439f2dfd1ee8b45981e18b Mon Sep 17 00:00:00 2001 -From: Juliusz Sosinowicz -Date: Sat, 12 Feb 2022 00:34:24 +0100 -Subject: [PATCH] Reported in ZD13631 - -`ssl->peerVerifyRet` wasn't being cleared when retrying with an alternative cert chain - -References: https://github.com/wolfSSL/wolfssl/issues/4879 ---- - src/internal.c | 3 +++ - 1 file changed, 3 insertions(+) - ---- a/src/internal.c -+++ b/src/internal.c -@@ -12342,6 +12342,9 @@ int ProcessPeerCerts(WOLFSSL* ssl, byte* - } - - ret = 0; /* clear errors and continue */ -+ #if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) -+ ssl->peerVerifyRet = 0; -+ #endif - args->verifyErr = 0; - } - diff --git a/package/libs/wolfssl/patches/400-wolfcrypt-src-port-devcrypto-devcrypto_aes.c-remove-.patch b/package/libs/wolfssl/patches/400-wolfcrypt-src-port-devcrypto-devcrypto_aes.c-remove-.patch deleted file mode 100644 index 3c0c0a07af..0000000000 --- a/package/libs/wolfssl/patches/400-wolfcrypt-src-port-devcrypto-devcrypto_aes.c-remove-.patch +++ /dev/null @@ -1,19 +0,0 @@ -From 096889927d9528d4fbeb3aab56d1fe8225d2e7ec Mon Sep 17 00:00:00 2001 -From: Daniel Pouzzner -Date: Thu, 14 Apr 2022 20:23:31 -0500 -Subject: [PATCH] wolfcrypt/src/port/devcrypto/devcrypto_aes.c: remove - redundant "int ret" in wc_AesCtrEncrypt() (supersedes #5052). - - -diff --git a/wolfcrypt/src/port/devcrypto/devcrypto_aes.c b/wolfcrypt/src/port/devcrypto/devcrypto_aes.c -index 3bc1d5bb1..28e145e27 100644 ---- a/wolfcrypt/src/port/devcrypto/devcrypto_aes.c -+++ b/wolfcrypt/src/port/devcrypto/devcrypto_aes.c -@@ -208,7 +208,6 @@ int wc_AesCtrEncrypt(Aes* aes, byte* out, const byte* in, word32 sz) - int ret; - struct crypt_op crt; - byte* tmp; -- int ret; - - if (aes == NULL || out == NULL || in == NULL) { - return BAD_FUNC_ARG; From 82059c592b32fd2c8e70ea1bd66120afbcf76506 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Tue, 17 May 2022 15:33:43 +0800 Subject: [PATCH 45/48] ath10k-ct: fix select dependency Signed-off-by: Tianling Shen --- package/kernel/ath10k-ct/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/kernel/ath10k-ct/Makefile b/package/kernel/ath10k-ct/Makefile index d9b7e56ef3..b73446b241 100644 --- a/package/kernel/ath10k-ct/Makefile +++ b/package/kernel/ath10k-ct/Makefile @@ -30,7 +30,7 @@ define KernelPackage/ath10k-ct SUBMENU:=Wireless Drivers TITLE:=ath10k-ct driver optimized for CT ath10k firmware DEPENDS:=+kmod-mac80211 +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11AC_SUPPORT \ - +@DRIVER_11W_SUPPORT @PCI_SUPPORT +kmod-hwmon-core +PACKAGE_kmod-thermal:kmod-thermal + +@DRIVER_11W_SUPPORT @PCI_SUPPORT +kmod-hwmon-core +kmod-thermal FILES:=\ $(PKG_BUILD_DIR)/ath10k$(CT_KVER)/ath10k_pci.ko \ $(PKG_BUILD_DIR)/ath10k$(CT_KVER)/ath10k_core.ko From f068cecb0b96575d1ccd366aec74253e5f773536 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Fri, 29 Apr 2022 18:38:05 +0800 Subject: [PATCH 46/48] r8125: bump to 9.009.00 Switched to GitHub codeload. Signed-off-by: Tianling Shen (cherry picked from commit 5c11bf7327b186a2a7dfc90a66f8668f2a6f954e) --- package/kernel/r8125/Makefile | 14 +- package/kernel/r8125/patches/010-config.patch | 22 + package/kernel/r8125/src/Makefile | 197 - package/kernel/r8125/src/Makefile_linux24x | 75 - package/kernel/r8125/src/r8125.h | 2532 --- package/kernel/r8125/src/r8125_dash.h | 261 - package/kernel/r8125/src/r8125_firmware.c | 264 - package/kernel/r8125/src/r8125_firmware.h | 68 - package/kernel/r8125/src/r8125_n.c | 15695 ---------------- package/kernel/r8125/src/r8125_ptp.c | 594 - package/kernel/r8125/src/r8125_ptp.h | 81 - package/kernel/r8125/src/r8125_realwow.h | 118 - package/kernel/r8125/src/r8125_rss.c | 481 - package/kernel/r8125/src/r8125_rss.h | 69 - package/kernel/r8125/src/rtl_eeprom.c | 289 - package/kernel/r8125/src/rtl_eeprom.h | 53 - package/kernel/r8125/src/rtltool.c | 320 - package/kernel/r8125/src/rtltool.h | 86 - 18 files changed, 33 insertions(+), 21186 deletions(-) create mode 100644 package/kernel/r8125/patches/010-config.patch delete mode 100644 package/kernel/r8125/src/Makefile delete mode 100644 package/kernel/r8125/src/Makefile_linux24x delete mode 100644 package/kernel/r8125/src/r8125.h delete mode 100644 package/kernel/r8125/src/r8125_dash.h delete mode 100644 package/kernel/r8125/src/r8125_firmware.c delete mode 100644 package/kernel/r8125/src/r8125_firmware.h delete mode 100644 package/kernel/r8125/src/r8125_n.c delete mode 100644 package/kernel/r8125/src/r8125_ptp.c delete mode 100644 package/kernel/r8125/src/r8125_ptp.h delete mode 100644 package/kernel/r8125/src/r8125_realwow.h delete mode 100644 package/kernel/r8125/src/r8125_rss.c delete mode 100644 package/kernel/r8125/src/r8125_rss.h delete mode 100644 package/kernel/r8125/src/rtl_eeprom.c delete mode 100644 package/kernel/r8125/src/rtl_eeprom.h delete mode 100644 package/kernel/r8125/src/rtltool.c delete mode 100644 package/kernel/r8125/src/rtltool.h diff --git a/package/kernel/r8125/Makefile b/package/kernel/r8125/Makefile index a4014c08ac..5f2c6d09ab 100644 --- a/package/kernel/r8125/Makefile +++ b/package/kernel/r8125/Makefile @@ -7,9 +7,17 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=r8125 -PKG_VERSION:=9.008.00 +PKG_VERSION:=9.009.00-1 PKG_RELEASE:=$(AUTORELEASE) +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://codeload.github.com/awesometic/realtek-r8125-dkms/tar.gz/$(PKG_VERSION)? +PKG_HASH:=11c09149c8342ba82727a97e17444526f4a6ecec901dd06ea3d442400a316823 +PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/realtek-$(PKG_NAME)-dkms-$(PKG_VERSION) + +PKG_LICENSE:=GPL-2.0-only +PKG_LICENSE_FILE:=LICENSE + include $(INCLUDE_DIR)/package.mk define KernelPackage/r8125 @@ -17,7 +25,7 @@ define KernelPackage/r8125 SUBMENU:=Network Devices VERSION:=$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE) DEPENDS:=@PCI_SUPPORT - FILES:= $(PKG_BUILD_DIR)/r8125.ko + FILES:= $(PKG_BUILD_DIR)/src/r8125.ko AUTOLOAD:=$(call AutoProbe,r8125) endef @@ -26,7 +34,7 @@ define Package/r8125/description endef define Build/Compile - +$(KERNEL_MAKE) M=$(PKG_BUILD_DIR) modules + +$(KERNEL_MAKE) M=$(PKG_BUILD_DIR)/src modules endef $(eval $(call KernelPackage,r8125)) diff --git a/package/kernel/r8125/patches/010-config.patch b/package/kernel/r8125/patches/010-config.patch new file mode 100644 index 0000000000..e7934c01c2 --- /dev/null +++ b/package/kernel/r8125/patches/010-config.patch @@ -0,0 +1,22 @@ +--- a/src/Makefile ++++ b/src/Makefile +@@ -35,16 +35,16 @@ ENABLE_REALWOW_SUPPORT = n + ENABLE_DASH_SUPPORT = n + ENABLE_DASH_PRINTER_SUPPORT = n + CONFIG_DOWN_SPEED_100 = n +-CONFIG_ASPM = y ++CONFIG_ASPM = n + ENABLE_S5WOL = y + ENABLE_S5_KEEP_CURR_MAC = n + ENABLE_EEE = y + ENABLE_S0_MAGIC_PACKET = n + ENABLE_TX_NO_CLOSE = y +-ENABLE_MULTIPLE_TX_QUEUE = n ++ENABLE_MULTIPLE_TX_QUEUE = y + ENABLE_PTP_SUPPORT = n + ENABLE_PTP_MASTER_MODE = n +-ENABLE_RSS_SUPPORT = n ++ENABLE_RSS_SUPPORT = y + ENABLE_LIB_SUPPORT = n + ENABLE_USE_FIRMWARE_FILE = n + DISABLE_PM_SUPPORT = n diff --git a/package/kernel/r8125/src/Makefile b/package/kernel/r8125/src/Makefile deleted file mode 100644 index a6958b86cc..0000000000 --- a/package/kernel/r8125/src/Makefile +++ /dev/null @@ -1,197 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only -################################################################################ -# -# r8125 is the Linux device driver released for Realtek 2.5Gigabit Ethernet -# controllers with PCI-Express interface. -# -# Copyright(c) 2022 Realtek Semiconductor Corp. All rights reserved. -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the Free -# Software Foundation; either version 2 of the License, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -# more details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, see . -# -# Author: -# Realtek NIC software team -# No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan -# -################################################################################ - -################################################################################ -# This product is covered by one or more of the following patents: -# US6,570,884, US6,115,776, and US6,327,625. -################################################################################ - -CONFIG_SOC_LAN = n -ENABLE_REALWOW_SUPPORT = n -ENABLE_DASH_SUPPORT = n -ENABLE_DASH_PRINTER_SUPPORT = n -CONFIG_DOWN_SPEED_100 = n -CONFIG_ASPM = n -ENABLE_S5WOL = y -ENABLE_S5_KEEP_CURR_MAC = n -ENABLE_EEE = y -ENABLE_S0_MAGIC_PACKET = n -ENABLE_TX_NO_CLOSE = y -ENABLE_MULTIPLE_TX_QUEUE = y -ENABLE_PTP_SUPPORT = n -ENABLE_PTP_MASTER_MODE = n -ENABLE_RSS_SUPPORT = y -ENABLE_LIB_SUPPORT = n -ENABLE_USE_FIRMWARE_FILE = n -DISABLE_PM_SUPPORT = n -DISABLE_MULTI_MSIX_VECTOR = n - -ifneq ($(KERNELRELEASE),) - obj-m := r8125.o - r8125-objs := r8125_n.o rtl_eeprom.o rtltool.o - ifeq ($(CONFIG_SOC_LAN), y) - EXTRA_CFLAGS += -DCONFIG_SOC_LAN - endif - ifeq ($(ENABLE_REALWOW_SUPPORT), y) - r8125-objs += r8125_realwow.o - EXTRA_CFLAGS += -DENABLE_REALWOW_SUPPORT - endif - ifeq ($(ENABLE_DASH_SUPPORT), y) - r8125-objs += r8125_dash.o - EXTRA_CFLAGS += -DENABLE_DASH_SUPPORT - endif - ifeq ($(ENABLE_DASH_PRINTER_SUPPORT), y) - r8125-objs += r8125_dash.o - EXTRA_CFLAGS += -DENABLE_DASH_SUPPORT -DENABLE_DASH_PRINTER_SUPPORT - endif - EXTRA_CFLAGS += -DCONFIG_R8125_NAPI - EXTRA_CFLAGS += -DCONFIG_R8125_VLAN - ifeq ($(CONFIG_DOWN_SPEED_100), y) - EXTRA_CFLAGS += -DCONFIG_DOWN_SPEED_100 - endif - ifeq ($(CONFIG_ASPM), y) - EXTRA_CFLAGS += -DCONFIG_ASPM - endif - ifeq ($(ENABLE_S5WOL), y) - EXTRA_CFLAGS += -DENABLE_S5WOL - endif - ifeq ($(ENABLE_S5_KEEP_CURR_MAC), y) - EXTRA_CFLAGS += -DENABLE_S5_KEEP_CURR_MAC - endif - ifeq ($(ENABLE_EEE), y) - EXTRA_CFLAGS += -DENABLE_EEE - endif - ifeq ($(ENABLE_S0_MAGIC_PACKET), y) - EXTRA_CFLAGS += -DENABLE_S0_MAGIC_PACKET - endif - ifeq ($(ENABLE_TX_NO_CLOSE), y) - EXTRA_CFLAGS += -DENABLE_TX_NO_CLOSE - endif - ifeq ($(ENABLE_MULTIPLE_TX_QUEUE), y) - EXTRA_CFLAGS += -DENABLE_MULTIPLE_TX_QUEUE - endif - ifeq ($(ENABLE_PTP_SUPPORT), y) - r8125-objs += r8125_ptp.o - EXTRA_CFLAGS += -DENABLE_PTP_SUPPORT - endif - ifeq ($(ENABLE_PTP_MASTER_MODE), y) - EXTRA_CFLAGS += -DENABLE_PTP_MASTER_MODE - endif - ifeq ($(ENABLE_RSS_SUPPORT), y) - r8125-objs += r8125_rss.o - EXTRA_CFLAGS += -DENABLE_RSS_SUPPORT - endif - ifeq ($(ENABLE_LIB_SUPPORT), y) - r8125-objs += r8125_lib.o - EXTRA_CFLAGS += -DENABLE_LIB_SUPPORT - endif - ifeq ($(ENABLE_USE_FIRMWARE_FILE), y) - r8125-objs += r8125_firmware.o - EXTRA_CFLAGS += -DENABLE_USE_FIRMWARE_FILE - endif - ifeq ($(DISABLE_PM_SUPPORT), y) - EXTRA_CFLAGS += -DDISABLE_PM_SUPPORT - endif - ifeq ($(DISABLE_MULTI_MSIX_VECTOR), y) - EXTRA_CFLAGS += -DDISABLE_MULTI_MSIX_VECTOR - endif -else - BASEDIR := /lib/modules/$(shell uname -r) - KERNELDIR ?= $(BASEDIR)/build - PWD :=$(shell pwd) - DRIVERDIR := $(shell find $(BASEDIR)/kernel/drivers/net/ethernet -name realtek -type d) - ifeq ($(DRIVERDIR),) - DRIVERDIR := $(shell find $(BASEDIR)/kernel/drivers/net -name realtek -type d) - endif - ifeq ($(DRIVERDIR),) - DRIVERDIR := $(BASEDIR)/kernel/drivers/net - endif - RTKDIR := $(subst $(BASEDIR)/,,$(DRIVERDIR)) - - KERNEL_GCC_VERSION := $(shell cat /proc/version | sed -n 's/.*gcc version \([[:digit:]]\.[[:digit:]]\.[[:digit:]]\).*/\1/p') - CCVERSION = $(shell $(CC) -dumpversion) - - KVER = $(shell uname -r) - KMAJ = $(shell echo $(KVER) | \ - sed -e 's/^\([0-9][0-9]*\)\.[0-9][0-9]*\.[0-9][0-9]*.*/\1/') - KMIN = $(shell echo $(KVER) | \ - sed -e 's/^[0-9][0-9]*\.\([0-9][0-9]*\)\.[0-9][0-9]*.*/\1/') - KREV = $(shell echo $(KVER) | \ - sed -e 's/^[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*/\1/') - - kver_ge = $(shell \ - echo test | awk '{if($(KMAJ) < $(1)) {print 0} else { \ - if($(KMAJ) > $(1)) {print 1} else { \ - if($(KMIN) < $(2)) {print 0} else { \ - if($(KMIN) > $(2)) {print 1} else { \ - if($(KREV) < $(3)) {print 0} else { print 1 } \ - }}}}}' \ - ) - -.PHONY: all -all: print_vars clean modules install - -print_vars: - @echo - @echo "CC: " $(CC) - @echo "CCVERSION: " $(CCVERSION) - @echo "KERNEL_GCC_VERSION: " $(KERNEL_GCC_VERSION) - @echo "KVER: " $(KVER) - @echo "KMAJ: " $(KMAJ) - @echo "KMIN: " $(KMIN) - @echo "KREV: " $(KREV) - @echo "BASEDIR: " $(BASEDIR) - @echo "DRIVERDIR: " $(DRIVERDIR) - @echo "PWD: " $(PWD) - @echo "RTKDIR: " $(RTKDIR) - @echo - -.PHONY:modules -modules: -#ifeq ($(call kver_ge,5,0,0),1) - $(MAKE) -C $(KERNELDIR) M=$(PWD) modules -#else -# $(MAKE) -C $(KERNELDIR) SUBDIRS=$(PWD) modules -#endif - -.PHONY:clean -clean: -#ifeq ($(call kver_ge,5,0,0),1) - $(MAKE) -C $(KERNELDIR) M=$(PWD) clean -#else -# $(MAKE) -C $(KERNELDIR) SUBDIRS=$(PWD) clean -#endif - -.PHONY:install -install: -#ifeq ($(call kver_ge,5,0,0),1) - $(MAKE) -C $(KERNELDIR) M=$(PWD) INSTALL_MOD_DIR=$(RTKDIR) modules_install -#else -# $(MAKE) -C $(KERNELDIR) SUBDIRS=$(PWD) INSTALL_MOD_DIR=$(RTKDIR) modules_install -#endif - -endif diff --git a/package/kernel/r8125/src/Makefile_linux24x b/package/kernel/r8125/src/Makefile_linux24x deleted file mode 100644 index 50aef8d4c0..0000000000 --- a/package/kernel/r8125/src/Makefile_linux24x +++ /dev/null @@ -1,75 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only -################################################################################ -# -# r8125 is the Linux device driver released for Realtek 2.5Gigabit Ethernet -# controllers with PCI-Express interface. -# -# Copyright(c) 2022 Realtek Semiconductor Corp. All rights reserved. -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the Free -# Software Foundation; either version 2 of the License, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -# more details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, see . -# -# Author: -# Realtek NIC software team -# No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan -# -################################################################################ - -################################################################################ -# This product is covered by one or more of the following patents: -# US6,570,884, US6,115,776, and US6,327,625. -################################################################################ - -CC := gcc -LD := ld -ARCH := $(shell uname -m | sed 's/i.86/i386/') -KSRC := /lib/modules/$(shell uname -r)/build -CONFIG_FILE := $(KSRC)/include/linux/autoconf.h -KMISC := /lib/modules/$(shell uname -r)/kernel/drivers/net/ - - -ifeq ($(ARCH),x86_64) - MODCFLAGS += -mcmodel=kernel -mno-red-zone -endif - -#standard flags for module builds -MODCFLAGS += -DLINUX -D__KERNEL__ -DMODULE -O2 -pipe -Wall -MODCFLAGS += -I$(KSRC)/include -I. -MODCFLAGS += -DMODVERSIONS -DEXPORT_SYMTAB -include $(KSRC)/include/linux/modversions.h -SOURCE := r8125_n.c rtl_eeprom.c rtltool.c -OBJS := $(SOURCE:.c=.o) - - -SMP := $(shell $(CC) $(MODCFLAGS) -E -dM $(CONFIG_FILE) | \ - grep CONFIG_SMP | awk '{print $$3}') - -ifneq ($(SMP),1) - SMP := 0 -endif - -ifeq ($(SMP),1) - MODCFLAGS += -D__SMP__ -endif - -modules: $(OBJS) - $(LD) -r $^ -o r8125.o - strip --strip-debug r8125.o - -%.o: %.c - $(CC) $(MODCFLAGS) -c $< -o $@ - -clean: - rm *.o -f - -install: - install -m 744 -c r8125.o $(KMISC) diff --git a/package/kernel/r8125/src/r8125.h b/package/kernel/r8125/src/r8125.h deleted file mode 100644 index 6db55e6936..0000000000 --- a/package/kernel/r8125/src/r8125.h +++ /dev/null @@ -1,2532 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* -################################################################################ -# -# r8125 is the Linux device driver released for Realtek 2.5Gigabit Ethernet -# controllers with PCI-Express interface. -# -# Copyright(c) 2022 Realtek Semiconductor Corp. All rights reserved. -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the Free -# Software Foundation; either version 2 of the License, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -# more details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, see . -# -# Author: -# Realtek NIC software team -# No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan -# -################################################################################ -*/ - -/************************************************************************************ - * This product is covered by one or more of the following patents: - * US6,570,884, US6,115,776, and US6,327,625. - ***********************************************************************************/ - -#ifndef __R8125_H -#define __R8125_H - -//#include -#include -#include -#include -#include "r8125_dash.h" -#include "r8125_realwow.h" -#include "r8125_ptp.h" -#include "r8125_rss.h" -#ifdef ENABLE_LIB_SUPPORT -#include "r8125_lib.h" -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32) -typedef int netdev_tx_t; -#endif - -/* -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0)&& !defined(ENABLE_LIB_SUPPORT) -#define RTL_USE_NEW_INTR_API -#endif -*/ - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) -#define skb_transport_offset(skb) (skb->h.raw - skb->data) -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26) -#define device_set_wakeup_enable(dev, val) do {} while (0) -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,14,0) -static inline void ether_addr_copy(u8 *dst, const u8 *src) -{ - u16 *a = (u16 *)dst; - const u16 *b = (const u16 *)src; - - a[0] = b[0]; - a[1] = b[1]; - a[2] = b[2]; -} -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0) -#define IS_ERR_OR_NULL(ptr) (!ptr) -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0) -#define reinit_completion(x) ((x)->done = 0) -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39) -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32) -#define pm_runtime_mark_last_busy(x) -#define pm_runtime_put_autosuspend(x) pm_runtime_put(x) -#define pm_runtime_put_sync_autosuspend(x) pm_runtime_put_sync(x) - -static inline bool pm_runtime_suspended(struct device *dev) -{ - return dev->power.runtime_status == RPM_SUSPENDED - && !dev->power.disable_depth; -} - -static inline bool pm_runtime_active(struct device *dev) -{ - return dev->power.runtime_status == RPM_ACTIVE - || dev->power.disable_depth; -} -#endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36) -#define queue_delayed_work(long_wq, work, delay) schedule_delayed_work(work, delay) -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34) -#define netif_printk(priv, type, level, netdev, fmt, args...) \ - do { \ - if (netif_msg_##type(priv)) \ - printk(level "%s: " fmt,(netdev)->name , ##args); \ - } while (0) - -#define netif_emerg(priv, type, netdev, fmt, args...) \ - netif_printk(priv, type, KERN_EMERG, netdev, fmt, ##args) -#define netif_alert(priv, type, netdev, fmt, args...) \ - netif_printk(priv, type, KERN_ALERT, netdev, fmt, ##args) -#define netif_crit(priv, type, netdev, fmt, args...) \ - netif_printk(priv, type, KERN_CRIT, netdev, fmt, ##args) -#define netif_err(priv, type, netdev, fmt, args...) \ - netif_printk(priv, type, KERN_ERR, netdev, fmt, ##args) -#define netif_warn(priv, type, netdev, fmt, args...) \ - netif_printk(priv, type, KERN_WARNING, netdev, fmt, ##args) -#define netif_notice(priv, type, netdev, fmt, args...) \ - netif_printk(priv, type, KERN_NOTICE, netdev, fmt, ##args) -#define netif_info(priv, type, netdev, fmt, args...) \ - netif_printk(priv, type, KERN_INFO, (netdev), fmt, ##args) -#endif -#endif -#endif -#endif -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15) -#define setup_timer(_timer, _function, _data) \ -do { \ - (_timer)->function = _function; \ - (_timer)->data = _data; \ - init_timer(_timer); \ -} while (0) -#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15) - -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0) -#if defined(skb_vlan_tag_present) && !defined(vlan_tx_tag_present) -#define vlan_tx_tag_present skb_vlan_tag_present -#endif -#if defined(skb_vlan_tag_get) && !defined(vlan_tx_tag_get) -#define vlan_tx_tag_get skb_vlan_tag_get -#endif -#endif //LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0) - -#define RTL_ALLOC_SKB_INTR(napi, length) dev_alloc_skb(length) -#ifdef CONFIG_R8125_NAPI -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) -#undef RTL_ALLOC_SKB_INTR -#define RTL_ALLOC_SKB_INTR(napi, length) napi_alloc_skb(napi, length) -#endif -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0) -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0) -#define netdev_features_t u32 -#endif -#endif - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,5,0) -#define NETIF_F_ALL_CSUM NETIF_F_CSUM_MASK -#else -#ifndef NETIF_F_ALL_CSUM -#define NETIF_F_ALL_CSUM NETIF_F_CSUM_MASK -#endif -#endif - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,37) -#define ENABLE_R8125_PROCFS -#endif - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) -#define NETIF_F_HW_VLAN_RX NETIF_F_HW_VLAN_CTAG_RX -#define NETIF_F_HW_VLAN_TX NETIF_F_HW_VLAN_CTAG_TX -#endif - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) -#define __devinit -#define __devexit -#define __devexit_p(func) func -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) -#define CHECKSUM_PARTIAL CHECKSUM_HW -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) -#define irqreturn_t void -#define IRQ_HANDLED 1 -#define IRQ_NONE 0 -#define IRQ_RETVAL(x) -#endif - -#ifndef NETIF_F_RXALL -#define NETIF_F_RXALL 0 -#endif - -#ifndef NETIF_F_RXFCS -#define NETIF_F_RXFCS 0 -#endif - -#ifndef HAVE_FREE_NETDEV -#define free_netdev(x) kfree(x) -#endif - -#ifndef SET_NETDEV_DEV -#define SET_NETDEV_DEV(net, pdev) -#endif - -#ifndef SET_MODULE_OWNER -#define SET_MODULE_OWNER(dev) -#endif - -#ifndef SA_SHIRQ -#define SA_SHIRQ IRQF_SHARED -#endif - -#ifndef NETIF_F_GSO -#define gso_size tso_size -#define gso_segs tso_segs -#endif - -#ifndef PCI_VENDOR_ID_DLINK -#define PCI_VENDOR_ID_DLINK 0x1186 -#endif - -#ifndef dma_mapping_error -#define dma_mapping_error(a,b) 0 -#endif - -#ifndef netif_err -#define netif_err(a,b,c,d) -#endif - -#ifndef AUTONEG_DISABLE -#define AUTONEG_DISABLE 0x00 -#endif - -#ifndef AUTONEG_ENABLE -#define AUTONEG_ENABLE 0x01 -#endif - -#ifndef BMCR_SPEED1000 -#define BMCR_SPEED1000 0x0040 -#endif - -#ifndef BMCR_SPEED100 -#define BMCR_SPEED100 0x2000 -#endif - -#ifndef BMCR_SPEED10 -#define BMCR_SPEED10 0x0000 -#endif - -#ifndef SPEED_UNKNOWN -#define SPEED_UNKNOWN -1 -#endif - -#ifndef DUPLEX_UNKNOWN -#define DUPLEX_UNKNOWN 0xff -#endif - -#ifndef SUPPORTED_Pause -#define SUPPORTED_Pause (1 << 13) -#endif - -#ifndef SUPPORTED_Asym_Pause -#define SUPPORTED_Asym_Pause (1 << 14) -#endif - -#ifndef MDIO_EEE_100TX -#define MDIO_EEE_100TX 0x0002 -#endif - -#ifndef MDIO_EEE_1000T -#define MDIO_EEE_1000T 0x0004 -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29) -#ifdef CONFIG_NET_POLL_CONTROLLER -#define RTL_NET_POLL_CONTROLLER dev->poll_controller=rtl8125_netpoll -#else -#define RTL_NET_POLL_CONTROLLER -#endif - -#ifdef CONFIG_R8125_VLAN -#define RTL_SET_VLAN dev->vlan_rx_register=rtl8125_vlan_rx_register -#else -#define RTL_SET_VLAN -#endif - -#define RTL_NET_DEVICE_OPS(ops) dev->open=rtl8125_open; \ - dev->hard_start_xmit=rtl8125_start_xmit; \ - dev->get_stats=rtl8125_get_stats; \ - dev->stop=rtl8125_close; \ - dev->tx_timeout=rtl8125_tx_timeout; \ - dev->set_multicast_list=rtl8125_set_rx_mode; \ - dev->change_mtu=rtl8125_change_mtu; \ - dev->set_mac_address=rtl8125_set_mac_address; \ - dev->do_ioctl=rtl8125_do_ioctl; \ - RTL_NET_POLL_CONTROLLER; \ - RTL_SET_VLAN; -#else -#define RTL_NET_DEVICE_OPS(ops) dev->netdev_ops=&ops -#endif - -#ifndef FALSE -#define FALSE 0 -#endif - -#ifndef TRUE -#define TRUE 1 -#endif - -#ifndef false -#define false 0 -#endif - -#ifndef true -#define true 1 -#endif - -//Hardware will continue interrupt 10 times after interrupt finished. -#define RTK_KEEP_INTERRUPT_COUNT (10) - -//the low 32 bit address of receive buffer must be 8-byte alignment. -#ifndef NET_IP_ALIGN -#define NET_IP_ALIGN 2 -#endif -#define RTK_RX_ALIGN 8 - -#ifdef CONFIG_R8125_NAPI -#define NAPI_SUFFIX "-NAPI" -#else -#define NAPI_SUFFIX "" -#endif -#if defined(ENABLE_DASH_PRINTER_SUPPORT) -#define DASH_SUFFIX "-PRINTER" -#elif defined(ENABLE_DASH_SUPPORT) -#define DASH_SUFFIX "-DASH" -#else -#define DASH_SUFFIX "" -#endif - -#if defined(ENABLE_REALWOW_SUPPORT) -#define REALWOW_SUFFIX "-REALWOW" -#else -#define REALWOW_SUFFIX "" -#endif - -#if defined(ENABLE_PTP_SUPPORT) -#define PTP_SUFFIX "-PTP" -#else -#define PTP_SUFFIX "" -#endif - -#if defined(ENABLE_RSS_SUPPORT) -#define RSS_SUFFIX "-RSS" -#else -#define RSS_SUFFIX "" -#endif - -#define RTL8125_VERSION "9.008.00" NAPI_SUFFIX DASH_SUFFIX REALWOW_SUFFIX PTP_SUFFIX RSS_SUFFIX -#define MODULENAME "r8125" -#define PFX MODULENAME ": " - -#define GPL_CLAIM "\ -r8125 Copyright (C) 2022 Realtek NIC software team \n \ -This program comes with ABSOLUTELY NO WARRANTY; for details, please see . \n \ -This is free software, and you are welcome to redistribute it under certain conditions; see . \n" - -#ifdef RTL8125_DEBUG -#define assert(expr) \ - if(!(expr)) { \ - printk( "Assertion failed! %s,%s,%s,line=%d\n", \ - #expr,__FILE__,__FUNCTION__,__LINE__); \ - } -#define dprintk(fmt, args...) do { printk(PFX fmt, ## args); } while (0) -#else -#define assert(expr) do {} while (0) -#define dprintk(fmt, args...) do {} while (0) -#endif /* RTL8125_DEBUG */ - -#define R8125_MSG_DEFAULT \ - (NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_IFUP | NETIF_MSG_IFDOWN) - -#ifdef CONFIG_R8125_NAPI -#define rtl8125_rx_hwaccel_skb vlan_hwaccel_receive_skb -#define rtl8125_rx_quota(count, quota) min(count, quota) -#else -#define rtl8125_rx_hwaccel_skb vlan_hwaccel_rx -#define rtl8125_rx_quota(count, quota) count -#endif - -/* MAC address length */ -#ifndef MAC_ADDR_LEN -#define MAC_ADDR_LEN 6 -#endif - -#ifndef MAC_PROTOCOL_LEN -#define MAC_PROTOCOL_LEN 2 -#endif - -#ifndef ETH_FCS_LEN -#define ETH_FCS_LEN 4 -#endif - -#ifndef NETIF_F_TSO6 -#define NETIF_F_TSO6 0 -#endif - -#define Reserved2_data 7 -#define RX_DMA_BURST 7 /* Maximum PCI burst, '7' is unlimited */ -#define TX_DMA_BURST_unlimited 7 -#define TX_DMA_BURST_1024 6 -#define TX_DMA_BURST_512 5 -#define TX_DMA_BURST_256 4 -#define TX_DMA_BURST_128 3 -#define TX_DMA_BURST_64 2 -#define TX_DMA_BURST_32 1 -#define TX_DMA_BURST_16 0 -#define Reserved1_data 0x3F -#define RxPacketMaxSize 0x3FE8 /* 16K - 1 - ETH_HLEN - VLAN - CRC... */ -#define Jumbo_Frame_1k ETH_DATA_LEN -#define Jumbo_Frame_2k (2*1024 - ETH_HLEN - VLAN_HLEN - ETH_FCS_LEN) -#define Jumbo_Frame_3k (3*1024 - ETH_HLEN - VLAN_HLEN - ETH_FCS_LEN) -#define Jumbo_Frame_4k (4*1024 - ETH_HLEN - VLAN_HLEN - ETH_FCS_LEN) -#define Jumbo_Frame_5k (5*1024 - ETH_HLEN - VLAN_HLEN - ETH_FCS_LEN) -#define Jumbo_Frame_6k (6*1024 - ETH_HLEN - VLAN_HLEN - ETH_FCS_LEN) -#define Jumbo_Frame_7k (7*1024 - ETH_HLEN - VLAN_HLEN - ETH_FCS_LEN) -#define Jumbo_Frame_8k (8*1024 - ETH_HLEN - VLAN_HLEN - ETH_FCS_LEN) -#define Jumbo_Frame_9k (9*1024 - ETH_HLEN - VLAN_HLEN - ETH_FCS_LEN) -#define InterFrameGap 0x03 /* 3 means InterFrameGap = the shortest one */ -#define RxEarly_off_V1 (0x07 << 11) -#define RxEarly_off_V2 (1 << 11) -#define Rx_Single_fetch_V2 (1 << 14) - -#define R8125_REGS_SIZE (256) -#define R8125_MAC_REGS_SIZE (256) -#define R8125_PHY_REGS_SIZE (16*2) -#define R8125_EPHY_REGS_SIZE (31*2) -#define R8125_ERI_REGS_SIZE (0x100) -#define R8125_REGS_DUMP_SIZE (0x400) -#define R8125_PCI_REGS_SIZE (0x100) -#define R8125_NAPI_WEIGHT 64 - -#define R8125_MAX_MSIX_VEC_8125B 32 -#define R8125_MIN_MSIX_VEC_8125B 17 -#define R8125_MAX_MSIX_VEC 32 -#define R8125_MAX_RX_QUEUES_VEC_V3 (16) - -#define RTL8125_TX_TIMEOUT (6 * HZ) -#define RTL8125_LINK_TIMEOUT (1 * HZ) -#define RTL8125_ESD_TIMEOUT (2 * HZ) - -#define MAX_NUM_TX_DESC 1024 /* Maximum number of Tx descriptor registers */ -#define MAX_NUM_RX_DESC 1024 /* Maximum number of Rx descriptor registers */ - -#define MIN_NUM_TX_DESC 256 /* Minimum number of Tx descriptor registers */ -#define MIN_NUM_RX_DESC 256 /* Minimum number of Rx descriptor registers */ - -#define NUM_TX_DESC MAX_NUM_TX_DESC /* Number of Tx descriptor registers */ -#define NUM_RX_DESC MAX_NUM_RX_DESC /* Number of Rx descriptor registers */ - -#define RX_BUF_SIZE 0x05F3 /* 0x05F3 = 1522bye + 1 */ - -#define R8125_MAX_TX_QUEUES (2) -#define R8125_MAX_RX_QUEUES (4) -#define R8125_MAX_QUEUES R8125_MAX_RX_QUEUES - -#define OCP_STD_PHY_BASE 0xa400 - -#ifdef ENABLE_LIB_SUPPORT -#define R8125_MULTI_RX_Q(tp) 0 -#else -#define R8125_MULTI_RX_Q(tp) (tp->num_rx_rings > 1) -#endif - -#define NODE_ADDRESS_SIZE 6 - -#define SHORT_PACKET_PADDING_BUF_SIZE 256 - -#define RTK_MAGIC_DEBUG_VALUE 0x0badbeef - -/* write/read MMIO register */ -#define RTL_W8(tp, reg, val8) writeb((val8), tp->mmio_addr + (reg)) -#define RTL_W16(tp, reg, val16) writew((val16), tp->mmio_addr + (reg)) -#define RTL_W32(tp, reg, val32) writel((val32), tp->mmio_addr + (reg)) -#define RTL_R8(tp, reg) readb(tp->mmio_addr + (reg)) -#define RTL_R16(tp, reg) readw(tp->mmio_addr + (reg)) -#define RTL_R32(tp, reg) ((unsigned long) readl(tp->mmio_addr + (reg))) - -#ifndef DMA_64BIT_MASK -#define DMA_64BIT_MASK 0xffffffffffffffffULL -#endif - -#ifndef DMA_32BIT_MASK -#define DMA_32BIT_MASK 0x00000000ffffffffULL -#endif - -#ifndef NETDEV_TX_OK -#define NETDEV_TX_OK 0 /* driver took care of packet */ -#endif - -#ifndef NETDEV_TX_BUSY -#define NETDEV_TX_BUSY 1 /* driver tx path was busy*/ -#endif - -#ifndef NETDEV_TX_LOCKED -#define NETDEV_TX_LOCKED -1t /* driver tx lock was already taken */ -#endif - -#ifndef ADVERTISED_Pause -#define ADVERTISED_Pause (1 << 13) -#endif - -#ifndef ADVERTISED_Asym_Pause -#define ADVERTISED_Asym_Pause (1 << 14) -#endif - -#ifndef ADVERTISE_PAUSE_CAP -#define ADVERTISE_PAUSE_CAP 0x400 -#endif - -#ifndef ADVERTISE_PAUSE_ASYM -#define ADVERTISE_PAUSE_ASYM 0x800 -#endif - -#ifndef MII_CTRL1000 -#define MII_CTRL1000 0x09 -#endif - -#ifndef ADVERTISE_1000FULL -#define ADVERTISE_1000FULL 0x200 -#endif - -#ifndef ADVERTISE_1000HALF -#define ADVERTISE_1000HALF 0x100 -#endif - -#ifndef ADVERTISED_2500baseX_Full -#define ADVERTISED_2500baseX_Full 0x8000 -#endif - -#define RTK_ADVERTISE_2500FULL 0x80 -#define RTK_LPA_ADVERTISE_2500FULL 0x20 -#define RTK_LPA_ADVERTISE_5000FULL 0x40 -#define RTK_LPA_ADVERTISE_10000FULL 0x800 - -#define RTK_EEE_ADVERTISE_2500FULL 0x01 -#define RTK_LPA_EEE_ADVERTISE_2500FULL 0x01 - -/* Tx NO CLOSE */ -#define MAX_TX_NO_CLOSE_DESC_PTR_V2 0x10000 -#define TX_NO_CLOSE_SW_PTR_MASK_V2 0x1FFFF - -#ifndef ETH_MIN_MTU -#define ETH_MIN_MTU 68 -#endif - -#define D0_SPEED_UP_SPEED_DISABLE 0 -#define D0_SPEED_UP_SPEED_1000 1 -#define D0_SPEED_UP_SPEED_2500 2 - -#define RTL8125_MAC_MCU_PAGE_SIZE 256 //256 words - -#ifndef WRITE_ONCE -#define WRITE_ONCE(var, val) (*((volatile typeof(val) *)(&(var))) = (val)) -#endif -#ifndef READ_ONCE -#define READ_ONCE(var) (*((volatile typeof(var) *)(&(var)))) -#endif - -/*****************************************************************************/ - -//#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,3) -#if (( LINUX_VERSION_CODE < KERNEL_VERSION(2,4,27) ) || \ - (( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) ) && \ - ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,3) ))) -/* copied from linux kernel 2.6.20 include/linux/netdev.h */ -#define NETDEV_ALIGN 32 -#define NETDEV_ALIGN_CONST (NETDEV_ALIGN - 1) - -static inline void *netdev_priv(struct net_device *dev) -{ - return (char *)dev + ((sizeof(struct net_device) - + NETDEV_ALIGN_CONST) - & ~NETDEV_ALIGN_CONST); -} -#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,3) - -/*****************************************************************************/ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) -#define RTLDEV tp -#else -#define RTLDEV dev -#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) -/*****************************************************************************/ - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) -typedef struct net_device *napi_ptr; -typedef int *napi_budget; - -#define napi dev -#define RTL_NAPI_CONFIG(ndev, priv, function, weig) ndev->poll=function; \ - ndev->weight=weig; -#define RTL_NAPI_QUOTA(budget, ndev) min(*budget, ndev->quota) -#define RTL_GET_PRIV(stuct_ptr, priv_struct) netdev_priv(stuct_ptr) -#define RTL_GET_NETDEV(priv_ptr) -#define RTL_RX_QUOTA(budget) *budget -#define RTL_NAPI_QUOTA_UPDATE(ndev, work_done, budget) *budget -= work_done; \ - ndev->quota -= work_done; -#define RTL_NETIF_RX_COMPLETE(dev, napi, work_done) netif_rx_complete(dev) -#define RTL_NETIF_RX_SCHEDULE_PREP(dev, napi) netif_rx_schedule_prep(dev) -#define __RTL_NETIF_RX_SCHEDULE(dev, napi) __netif_rx_schedule(dev) -#define RTL_NAPI_RETURN_VALUE work_done >= work_to_do -#define RTL_NAPI_ENABLE(dev, napi) netif_poll_enable(dev) -#define RTL_NAPI_DISABLE(dev, napi) netif_poll_disable(dev) -#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1)) -#else -typedef struct napi_struct *napi_ptr; -typedef int napi_budget; - -#define RTL_NAPI_CONFIG(ndev, priv, function, weight) netif_napi_add(ndev, &priv->napi, function, weight) -#define RTL_NAPI_QUOTA(budget, ndev) min(budget, budget) -#define RTL_GET_PRIV(stuct_ptr, priv_struct) container_of(stuct_ptr, priv_struct, stuct_ptr) -#define RTL_GET_NETDEV(priv_ptr) struct net_device *dev = priv_ptr->dev; -#define RTL_RX_QUOTA(budget) budget -#define RTL_NAPI_QUOTA_UPDATE(ndev, work_done, budget) -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29) -#define RTL_NETIF_RX_COMPLETE(dev, napi, work_done) netif_rx_complete(dev, napi) -#define RTL_NETIF_RX_SCHEDULE_PREP(dev, napi) netif_rx_schedule_prep(dev, napi) -#define __RTL_NETIF_RX_SCHEDULE(dev, napi) __netif_rx_schedule(dev, napi) -#endif -#if LINUX_VERSION_CODE == KERNEL_VERSION(2,6,29) -#define RTL_NETIF_RX_COMPLETE(dev, napi, work_done) netif_rx_complete(napi) -#define RTL_NETIF_RX_SCHEDULE_PREP(dev, napi) netif_rx_schedule_prep(napi) -#define __RTL_NETIF_RX_SCHEDULE(dev, napi) __netif_rx_schedule(napi) -#endif -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,29) -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) -#define RTL_NETIF_RX_COMPLETE(dev, napi, work_done) napi_complete_done(napi, work_done) -#else -#define RTL_NETIF_RX_COMPLETE(dev, napi, work_done) napi_complete(napi) -#endif -#define RTL_NETIF_RX_SCHEDULE_PREP(dev, napi) napi_schedule_prep(napi) -#define __RTL_NETIF_RX_SCHEDULE(dev, napi) __napi_schedule(napi) -#endif -#define RTL_NAPI_RETURN_VALUE work_done -#define RTL_NAPI_ENABLE(dev, napi) napi_enable(napi) -#define RTL_NAPI_DISABLE(dev, napi) napi_disable(napi) -#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) -#define RTL_NAPI_DEL(priv) -#else -#define RTL_NAPI_DEL(priv) netif_napi_del(&priv->napi) -#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) - -/*****************************************************************************/ -#ifdef CONFIG_R8125_NAPI -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0) -#define RTL_NAPI_CONSUME_SKB_ANY(skb, budget) napi_consume_skb(skb, budget) -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0) -#define RTL_NAPI_CONSUME_SKB_ANY(skb, budget) dev_consume_skb_any(skb); -#else -#define RTL_NAPI_CONSUME_SKB_ANY(skb, budget) dev_kfree_skb_any(skb); -#endif //LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0) -#else //CONFIG_R8125_NAPI -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0) -#define RTL_NAPI_CONSUME_SKB_ANY(skb, budget) dev_consume_skb_any(skb); -#else -#define RTL_NAPI_CONSUME_SKB_ANY(skb, budget) dev_kfree_skb_any(skb); -#endif -#endif //CONFIG_R8125_NAPI - -/*****************************************************************************/ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9) -#ifdef __CHECKER__ -#define __iomem __attribute__((noderef, address_space(2))) -extern void __chk_io_ptr(void __iomem *); -#define __bitwise __attribute__((bitwise)) -#else -#define __iomem -#define __chk_io_ptr(x) (void)0 -#define __bitwise -#endif -#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9) - -/*****************************************************************************/ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,8) -#ifdef __CHECKER__ -#define __force __attribute__((force)) -#else -#define __force -#endif -#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,8) - -#ifndef module_param -#define module_param(v,t,p) MODULE_PARM(v, "i"); -#endif - -#ifndef PCI_DEVICE -#define PCI_DEVICE(vend,dev) \ - .vendor = (vend), .device = (dev), \ - .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID -#endif - -/*****************************************************************************/ -/* 2.5.28 => 2.4.23 */ -#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,5,28) ) - -static inline void _kc_synchronize_irq(void) -{ - synchronize_irq(); -} -#undef synchronize_irq -#define synchronize_irq(X) _kc_synchronize_irq() - -#include -#define work_struct tq_struct -#undef INIT_WORK -#define INIT_WORK(a,b,c) INIT_TQUEUE(a,(void (*)(void *))b,c) -#undef container_of -#define container_of list_entry -#define schedule_work schedule_task -#define flush_scheduled_work flush_scheduled_tasks -#endif /* 2.5.28 => 2.4.17 */ - -/*****************************************************************************/ -/* 2.6.4 => 2.6.0 */ -#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,4) ) -#define MODULE_VERSION(_version) MODULE_INFO(version, _version) -#endif /* 2.6.4 => 2.6.0 */ -/*****************************************************************************/ -/* 2.6.0 => 2.5.28 */ -#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) ) -#define MODULE_INFO(version, _version) -#ifndef CONFIG_E1000_DISABLE_PACKET_SPLIT -#define CONFIG_E1000_DISABLE_PACKET_SPLIT 1 -#endif - -#define pci_set_consistent_dma_mask(dev,mask) 1 - -#undef dev_put -#define dev_put(dev) __dev_put(dev) - -#ifndef skb_fill_page_desc -#define skb_fill_page_desc _kc_skb_fill_page_desc -extern void _kc_skb_fill_page_desc(struct sk_buff *skb, int i, struct page *page, int off, int size); -#endif - -#ifndef pci_dma_mapping_error -#define pci_dma_mapping_error _kc_pci_dma_mapping_error -static inline int _kc_pci_dma_mapping_error(dma_addr_t dma_addr) -{ - return dma_addr == 0; -} -#endif - -#undef ALIGN -#define ALIGN(x,a) (((x)+(a)-1)&~((a)-1)) - -#endif /* 2.6.0 => 2.5.28 */ - -/*****************************************************************************/ -/* 2.4.22 => 2.4.17 */ -#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,4,22) ) -#define pci_name(x) ((x)->slot_name) -#endif /* 2.4.22 => 2.4.17 */ - -/*****************************************************************************/ -/* 2.6.5 => 2.6.0 */ -#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,5) ) -#define pci_dma_sync_single_for_cpu pci_dma_sync_single -#define pci_dma_sync_single_for_device pci_dma_sync_single_for_cpu -#endif /* 2.6.5 => 2.6.0 */ - -/*****************************************************************************/ - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) -/* - * initialize a work-struct's func and data pointers: - */ -#define PREPARE_WORK(_work, _func, _data) \ - do { \ - (_work)->func = _func; \ - (_work)->data = _data; \ - } while (0) - -#endif -/*****************************************************************************/ -/* 2.6.4 => 2.6.0 */ -#if ((LINUX_VERSION_CODE < KERNEL_VERSION(2,4,25) && \ - LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22)) || \ - (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) && \ - LINUX_VERSION_CODE < KERNEL_VERSION(2,6,4))) -#define ETHTOOL_OPS_COMPAT -#endif /* 2.6.4 => 2.6.0 */ - -/*****************************************************************************/ -/* Installations with ethtool version without eeprom, adapter id, or statistics - * support */ - -#ifndef ETH_GSTRING_LEN -#define ETH_GSTRING_LEN 32 -#endif - -#ifndef ETHTOOL_GSTATS -#define ETHTOOL_GSTATS 0x1d -#undef ethtool_drvinfo -#define ethtool_drvinfo k_ethtool_drvinfo -struct k_ethtool_drvinfo { - u32 cmd; - char driver[32]; - char version[32]; - char fw_version[32]; - char bus_info[32]; - char reserved1[32]; - char reserved2[16]; - u32 n_stats; - u32 testinfo_len; - u32 eedump_len; - u32 regdump_len; -}; - -struct ethtool_stats { - u32 cmd; - u32 n_stats; - u64 data[0]; -}; -#endif /* ETHTOOL_GSTATS */ - -#ifndef ETHTOOL_PHYS_ID -#define ETHTOOL_PHYS_ID 0x1c -#endif /* ETHTOOL_PHYS_ID */ - -#ifndef ETHTOOL_GSTRINGS -#define ETHTOOL_GSTRINGS 0x1b -enum ethtool_stringset { - ETH_SS_TEST = 0, - ETH_SS_STATS, -}; -struct ethtool_gstrings { - u32 cmd; /* ETHTOOL_GSTRINGS */ - u32 string_set; /* string set id e.c. ETH_SS_TEST, etc*/ - u32 len; /* number of strings in the string set */ - u8 data[0]; -}; -#endif /* ETHTOOL_GSTRINGS */ - -#ifndef ETHTOOL_TEST -#define ETHTOOL_TEST 0x1a -enum ethtool_test_flags { - ETH_TEST_FL_OFFLINE = (1 << 0), - ETH_TEST_FL_FAILED = (1 << 1), -}; -struct ethtool_test { - u32 cmd; - u32 flags; - u32 reserved; - u32 len; - u64 data[0]; -}; -#endif /* ETHTOOL_TEST */ - -#ifndef ETHTOOL_GEEPROM -#define ETHTOOL_GEEPROM 0xb -#undef ETHTOOL_GREGS -struct ethtool_eeprom { - u32 cmd; - u32 magic; - u32 offset; - u32 len; - u8 data[0]; -}; - -struct ethtool_value { - u32 cmd; - u32 data; -}; -#endif /* ETHTOOL_GEEPROM */ - -#ifndef ETHTOOL_GLINK -#define ETHTOOL_GLINK 0xa -#endif /* ETHTOOL_GLINK */ - -#ifndef ETHTOOL_GREGS -#define ETHTOOL_GREGS 0x00000004 /* Get NIC registers */ -#define ethtool_regs _kc_ethtool_regs -/* for passing big chunks of data */ -struct _kc_ethtool_regs { - u32 cmd; - u32 version; /* driver-specific, indicates different chips/revs */ - u32 len; /* bytes */ - u8 data[0]; -}; -#endif /* ETHTOOL_GREGS */ - -#ifndef ETHTOOL_GMSGLVL -#define ETHTOOL_GMSGLVL 0x00000007 /* Get driver message level */ -#endif -#ifndef ETHTOOL_SMSGLVL -#define ETHTOOL_SMSGLVL 0x00000008 /* Set driver msg level, priv. */ -#endif -#ifndef ETHTOOL_NWAY_RST -#define ETHTOOL_NWAY_RST 0x00000009 /* Restart autonegotiation, priv */ -#endif -#ifndef ETHTOOL_GLINK -#define ETHTOOL_GLINK 0x0000000a /* Get link status */ -#endif -#ifndef ETHTOOL_GEEPROM -#define ETHTOOL_GEEPROM 0x0000000b /* Get EEPROM data */ -#endif -#ifndef ETHTOOL_SEEPROM -#define ETHTOOL_SEEPROM 0x0000000c /* Set EEPROM data */ -#endif -#ifndef ETHTOOL_GCOALESCE -#define ETHTOOL_GCOALESCE 0x0000000e /* Get coalesce config */ -/* for configuring coalescing parameters of chip */ -#define ethtool_coalesce _kc_ethtool_coalesce -struct _kc_ethtool_coalesce { - u32 cmd; /* ETHTOOL_{G,S}COALESCE */ - - /* How many usecs to delay an RX interrupt after - * a packet arrives. If 0, only rx_max_coalesced_frames - * is used. - */ - u32 rx_coalesce_usecs; - - /* How many packets to delay an RX interrupt after - * a packet arrives. If 0, only rx_coalesce_usecs is - * used. It is illegal to set both usecs and max frames - * to zero as this would cause RX interrupts to never be - * generated. - */ - u32 rx_max_coalesced_frames; - - /* Same as above two parameters, except that these values - * apply while an IRQ is being serviced by the host. Not - * all cards support this feature and the values are ignored - * in that case. - */ - u32 rx_coalesce_usecs_irq; - u32 rx_max_coalesced_frames_irq; - - /* How many usecs to delay a TX interrupt after - * a packet is sent. If 0, only tx_max_coalesced_frames - * is used. - */ - u32 tx_coalesce_usecs; - - /* How many packets to delay a TX interrupt after - * a packet is sent. If 0, only tx_coalesce_usecs is - * used. It is illegal to set both usecs and max frames - * to zero as this would cause TX interrupts to never be - * generated. - */ - u32 tx_max_coalesced_frames; - - /* Same as above two parameters, except that these values - * apply while an IRQ is being serviced by the host. Not - * all cards support this feature and the values are ignored - * in that case. - */ - u32 tx_coalesce_usecs_irq; - u32 tx_max_coalesced_frames_irq; - - /* How many usecs to delay in-memory statistics - * block updates. Some drivers do not have an in-memory - * statistic block, and in such cases this value is ignored. - * This value must not be zero. - */ - u32 stats_block_coalesce_usecs; - - /* Adaptive RX/TX coalescing is an algorithm implemented by - * some drivers to improve latency under low packet rates and - * improve throughput under high packet rates. Some drivers - * only implement one of RX or TX adaptive coalescing. Anything - * not implemented by the driver causes these values to be - * silently ignored. - */ - u32 use_adaptive_rx_coalesce; - u32 use_adaptive_tx_coalesce; - - /* When the packet rate (measured in packets per second) - * is below pkt_rate_low, the {rx,tx}_*_low parameters are - * used. - */ - u32 pkt_rate_low; - u32 rx_coalesce_usecs_low; - u32 rx_max_coalesced_frames_low; - u32 tx_coalesce_usecs_low; - u32 tx_max_coalesced_frames_low; - - /* When the packet rate is below pkt_rate_high but above - * pkt_rate_low (both measured in packets per second) the - * normal {rx,tx}_* coalescing parameters are used. - */ - - /* When the packet rate is (measured in packets per second) - * is above pkt_rate_high, the {rx,tx}_*_high parameters are - * used. - */ - u32 pkt_rate_high; - u32 rx_coalesce_usecs_high; - u32 rx_max_coalesced_frames_high; - u32 tx_coalesce_usecs_high; - u32 tx_max_coalesced_frames_high; - - /* How often to do adaptive coalescing packet rate sampling, - * measured in seconds. Must not be zero. - */ - u32 rate_sample_interval; -}; -#endif /* ETHTOOL_GCOALESCE */ - -#ifndef ETHTOOL_SCOALESCE -#define ETHTOOL_SCOALESCE 0x0000000f /* Set coalesce config. */ -#endif -#ifndef ETHTOOL_GRINGPARAM -#define ETHTOOL_GRINGPARAM 0x00000010 /* Get ring parameters */ -/* for configuring RX/TX ring parameters */ -#define ethtool_ringparam _kc_ethtool_ringparam -struct _kc_ethtool_ringparam { - u32 cmd; /* ETHTOOL_{G,S}RINGPARAM */ - - /* Read only attributes. These indicate the maximum number - * of pending RX/TX ring entries the driver will allow the - * user to set. - */ - u32 rx_max_pending; - u32 rx_mini_max_pending; - u32 rx_jumbo_max_pending; - u32 tx_max_pending; - - /* Values changeable by the user. The valid values are - * in the range 1 to the "*_max_pending" counterpart above. - */ - u32 rx_pending; - u32 rx_mini_pending; - u32 rx_jumbo_pending; - u32 tx_pending; -}; -#endif /* ETHTOOL_GRINGPARAM */ - -#ifndef ETHTOOL_SRINGPARAM -#define ETHTOOL_SRINGPARAM 0x00000011 /* Set ring parameters, priv. */ -#endif -#ifndef ETHTOOL_GPAUSEPARAM -#define ETHTOOL_GPAUSEPARAM 0x00000012 /* Get pause parameters */ -/* for configuring link flow control parameters */ -#define ethtool_pauseparam _kc_ethtool_pauseparam -struct _kc_ethtool_pauseparam { - u32 cmd; /* ETHTOOL_{G,S}PAUSEPARAM */ - - /* If the link is being auto-negotiated (via ethtool_cmd.autoneg - * being true) the user may set 'autonet' here non-zero to have the - * pause parameters be auto-negotiated too. In such a case, the - * {rx,tx}_pause values below determine what capabilities are - * advertised. - * - * If 'autoneg' is zero or the link is not being auto-negotiated, - * then {rx,tx}_pause force the driver to use/not-use pause - * flow control. - */ - u32 autoneg; - u32 rx_pause; - u32 tx_pause; -}; -#endif /* ETHTOOL_GPAUSEPARAM */ - -#ifndef ETHTOOL_SPAUSEPARAM -#define ETHTOOL_SPAUSEPARAM 0x00000013 /* Set pause parameters. */ -#endif -#ifndef ETHTOOL_GRXCSUM -#define ETHTOOL_GRXCSUM 0x00000014 /* Get RX hw csum enable (ethtool_value) */ -#endif -#ifndef ETHTOOL_SRXCSUM -#define ETHTOOL_SRXCSUM 0x00000015 /* Set RX hw csum enable (ethtool_value) */ -#endif -#ifndef ETHTOOL_GTXCSUM -#define ETHTOOL_GTXCSUM 0x00000016 /* Get TX hw csum enable (ethtool_value) */ -#endif -#ifndef ETHTOOL_STXCSUM -#define ETHTOOL_STXCSUM 0x00000017 /* Set TX hw csum enable (ethtool_value) */ -#endif -#ifndef ETHTOOL_GSG -#define ETHTOOL_GSG 0x00000018 /* Get scatter-gather enable -* (ethtool_value) */ -#endif -#ifndef ETHTOOL_SSG -#define ETHTOOL_SSG 0x00000019 /* Set scatter-gather enable -* (ethtool_value). */ -#endif -#ifndef ETHTOOL_TEST -#define ETHTOOL_TEST 0x0000001a /* execute NIC self-test, priv. */ -#endif -#ifndef ETHTOOL_GSTRINGS -#define ETHTOOL_GSTRINGS 0x0000001b /* get specified string set */ -#endif -#ifndef ETHTOOL_PHYS_ID -#define ETHTOOL_PHYS_ID 0x0000001c /* identify the NIC */ -#endif -#ifndef ETHTOOL_GSTATS -#define ETHTOOL_GSTATS 0x0000001d /* get NIC-specific statistics */ -#endif -#ifndef ETHTOOL_GTSO -#define ETHTOOL_GTSO 0x0000001e /* Get TSO enable (ethtool_value) */ -#endif -#ifndef ETHTOOL_STSO -#define ETHTOOL_STSO 0x0000001f /* Set TSO enable (ethtool_value) */ -#endif - -#ifndef ETHTOOL_BUSINFO_LEN -#define ETHTOOL_BUSINFO_LEN 32 -#endif - -/*****************************************************************************/ - -enum RTL8125_registers { - MAC0 = 0x00, /* Ethernet hardware address. */ - MAC4 = 0x04, - MAR0 = 0x08, /* Multicast filter. */ - CounterAddrLow = 0x10, - CounterAddrHigh = 0x14, - CustomLED = 0x18, - TxDescStartAddrLow = 0x20, - TxDescStartAddrHigh = 0x24, - TxHDescStartAddrLow = 0x28, - TxHDescStartAddrHigh = 0x2c, - FLASH = 0x30, - INT_CFG0_8125 = 0x34, - ERSR = 0x36, - ChipCmd = 0x37, - TxPoll = 0x38, - IntrMask = 0x3C, - IntrStatus = 0x3E, - TxConfig = 0x40, - RxConfig = 0x44, - TCTR = 0x48, - Cfg9346 = 0x50, - Config0 = 0x51, - Config1 = 0x52, - Config2 = 0x53, - Config3 = 0x54, - Config4 = 0x55, - Config5 = 0x56, - TDFNR = 0x57, - TimeInt0 = 0x58, - TimeInt1 = 0x5C, - PHYAR = 0x60, - CSIDR = 0x64, - CSIAR = 0x68, - PHYstatus = 0x6C, - MACDBG = 0x6D, - GPIO = 0x6E, - PMCH = 0x6F, - ERIDR = 0x70, - ERIAR = 0x74, - INT_CFG1_8125 = 0x7A, - EPHY_RXER_NUM = 0x7C, - EPHYAR = 0x80, - TimeInt2 = 0x8C, - OCPDR = 0xB0, - MACOCP = 0xB0, - OCPAR = 0xB4, - SecMAC0 = 0xB4, - SecMAC4 = 0xB8, - PHYOCP = 0xB8, - DBG_reg = 0xD1, - TwiCmdReg = 0xD2, - MCUCmd_reg = 0xD3, - RxMaxSize = 0xDA, - EFUSEAR = 0xDC, - CPlusCmd = 0xE0, - IntrMitigate = 0xE2, - RxDescAddrLow = 0xE4, - RxDescAddrHigh = 0xE8, - MTPS = 0xEC, - FuncEvent = 0xF0, - PPSW = 0xF2, - FuncEventMask = 0xF4, - TimeInt3 = 0xF4, - FuncPresetState = 0xF8, - CMAC_IBCR0 = 0xF8, - CMAC_IBCR2 = 0xF9, - CMAC_IBIMR0 = 0xFA, - CMAC_IBISR0 = 0xFB, - FuncForceEvent = 0xFC, - //8125 - IMR0_8125 = 0x38, - ISR0_8125 = 0x3C, - TPPOLL_8125 = 0x90, - IMR1_8125 = 0x800, - ISR1_8125 = 0x802, - IMR2_8125 = 0x804, - ISR2_8125 = 0x806, - IMR3_8125 = 0x808, - ISR3_8125 = 0x80A, - BACKUP_ADDR0_8125 = 0x19E0, - BACKUP_ADDR1_8125 = 0X19E4, - TCTR0_8125 = 0x0048, - TCTR1_8125 = 0x004C, - TCTR2_8125 = 0x0088, - TCTR3_8125 = 0x001C, - TIMER_INT0_8125 = 0x0058, - TIMER_INT1_8125 = 0x005C, - TIMER_INT2_8125 = 0x008C, - TIMER_INT3_8125 = 0x00F4, - INT_MITI_V2_0_RX = 0x0A00, - INT_MITI_V2_0_TX = 0x0A02, - INT_MITI_V2_1_RX = 0x0A08, - INT_MITI_V2_1_TX = 0x0A0A, - IMR_V2_CLEAR_REG_8125 = 0x0D00, - ISR_V2_8125 = 0x0D04, - IMR_V2_SET_REG_8125 = 0x0D0C, - TDU_STA_8125 = 0x0D08, - RDU_STA_8125 = 0x0D0A, - TX_NEW_CTRL = 0x203E, - TNPDS_Q1_LOW_8125 = 0x2100, - PLA_TXQ0_IDLE_CREDIT = 0x2500, - PLA_TXQ1_IDLE_CREDIT = 0x2504, - SW_TAIL_PTR0_8125 = 0x2800, - HW_CLO_PTR0_8125 = 0x2802, - RDSAR_Q1_LOW_8125 = 0x4000, - RSS_CTRL_8125 = 0x4500, - Q_NUM_CTRL_8125 = 0x4800, - RSS_KEY_8125 = 0x4600, - RSS_INDIRECTION_TBL_8125_V2 = 0x4700, - EEE_TXIDLE_TIMER_8125 = 0x6048, - PTP_CTRL_8125 = 0x6800, - PTP_STATUS_8125 = 0x6802, - PTP_ISR_8125 = 0x6804, - PTP_IMR_8125 = 0x6805, - PTP_TIME_CORRECT_CMD_8125 = 0x6806, - PTP_SOFT_CONFIG_Time_NS_8125 = 0x6808, - PTP_SOFT_CONFIG_Time_S_8125 = 0x680C, - PTP_LOCAL_Time_SUB_NS_8125 = 0x6814, - PTP_LOCAL_Time_NS_8125 = 0x6818, - PTP_LOCAL_Time_S_8125 = 0x681C, - PTP_Time_SHIFTER_S_8125 = 0x6856, - PPS_RISE_TIME_NS_8125 = 0x68A0, - PPS_RISE_TIME_S_8125 = 0x68A4, -}; - -enum RTL8125_register_content { - /* InterruptStatusBits */ - SYSErr = 0x8000, - PCSTimeout = 0x4000, - SWInt = 0x0100, - TxDescUnavail = 0x0080, - RxFIFOOver = 0x0040, - LinkChg = 0x0020, - RxDescUnavail = 0x0010, - TxErr = 0x0008, - TxOK = 0x0004, - RxErr = 0x0002, - RxOK = 0x0001, - RxDU1 = 0x0002, - RxOK1 = 0x0001, - - /* RxStatusDesc */ - RxRWT = (1 << 22), - RxRES = (1 << 21), - RxRUNT = (1 << 20), - RxCRC = (1 << 19), - - RxRWT_V3 = (1 << 18), - RxRES_V3 = (1 << 20), - RxRUNT_V3 = (1 << 19), - RxCRC_V3 = (1 << 17), - - /* ChipCmdBits */ - StopReq = 0x80, - CmdReset = 0x10, - CmdRxEnb = 0x08, - CmdTxEnb = 0x04, - RxBufEmpty = 0x01, - - /* Cfg9346Bits */ - Cfg9346_Lock = 0x00, - Cfg9346_Unlock = 0xC0, - Cfg9346_EEDO = (1 << 0), - Cfg9346_EEDI = (1 << 1), - Cfg9346_EESK = (1 << 2), - Cfg9346_EECS = (1 << 3), - Cfg9346_EEM0 = (1 << 6), - Cfg9346_EEM1 = (1 << 7), - - /* rx_mode_bits */ - AcceptErr = 0x20, - AcceptRunt = 0x10, - AcceptBroadcast = 0x08, - AcceptMulticast = 0x04, - AcceptMyPhys = 0x02, - AcceptAllPhys = 0x01, - - /* Transmit Priority Polling*/ - HPQ = 0x80, - NPQ = 0x40, - FSWInt = 0x01, - - /* RxConfigBits */ - Reserved2_shift = 13, - RxCfgDMAShift = 8, - EnableRxDescV3 = (1 << 24), - EnableOuterVlan = (1 << 23), - EnableInnerVlan = (1 << 22), - RxCfg_128_int_en = (1 << 15), - RxCfg_fet_multi_en = (1 << 14), - RxCfg_half_refetch = (1 << 13), - RxCfg_pause_slot_en = (1 << 11), - RxCfg_9356SEL = (1 << 6), - - /* TxConfigBits */ - TxInterFrameGapShift = 24, - TxDMAShift = 8, /* DMA burst value (0-7) is shift this many bits */ - TxMACLoopBack = (1 << 17), /* MAC loopback */ - - /* Config1 register */ - LEDS1 = (1 << 7), - LEDS0 = (1 << 6), - Speed_down = (1 << 4), - MEMMAP = (1 << 3), - IOMAP = (1 << 2), - VPD = (1 << 1), - PMEnable = (1 << 0), /* Power Management Enable */ - - /* Config2 register */ - PMSTS_En = (1 << 5), - - /* Config3 register */ - Isolate_en = (1 << 12), /* Isolate enable */ - MagicPacket = (1 << 5), /* Wake up when receives a Magic Packet */ - LinkUp = (1 << 4), /* This bit is reserved in RTL8125B.*/ - /* Wake up when the cable connection is re-established */ - ECRCEN = (1 << 3), /* This bit is reserved in RTL8125B*/ - Jumbo_En0 = (1 << 2), /* This bit is reserved in RTL8125B*/ - RDY_TO_L23 = (1 << 1), /* This bit is reserved in RTL8125B*/ - Beacon_en = (1 << 0), /* This bit is reserved in RTL8125B*/ - - /* Config4 register */ - Jumbo_En1 = (1 << 1), /* This bit is reserved in RTL8125B*/ - - /* Config5 register */ - BWF = (1 << 6), /* Accept Broadcast wakeup frame */ - MWF = (1 << 5), /* Accept Multicast wakeup frame */ - UWF = (1 << 4), /* Accept Unicast wakeup frame */ - LanWake = (1 << 1), /* LanWake enable/disable */ - PMEStatus = (1 << 0), /* PME status can be reset by PCI RST# */ - - /* CPlusCmd */ - EnableBist = (1 << 15), - Macdbgo_oe = (1 << 14), - Normal_mode = (1 << 13), - Force_halfdup = (1 << 12), - Force_rxflow_en = (1 << 11), - Force_txflow_en = (1 << 10), - Cxpl_dbg_sel = (1 << 9),//This bit is reserved in RTL8125B - ASF = (1 << 8),//This bit is reserved in RTL8125C - PktCntrDisable = (1 << 7), - RxVlan = (1 << 6), - RxChkSum = (1 << 5), - Macdbgo_sel = 0x001C, - INTT_0 = 0x0000, - INTT_1 = 0x0001, - INTT_2 = 0x0002, - INTT_3 = 0x0003, - - /* rtl8125_PHYstatus */ - PowerSaveStatus = 0x80, - _2500bpsF = 0x400, - TxFlowCtrl = 0x40, - RxFlowCtrl = 0x20, - _1000bpsF = 0x10, - _100bps = 0x08, - _10bps = 0x04, - LinkStatus = 0x02, - FullDup = 0x01, - - /* DBG_reg */ - Fix_Nak_1 = (1 << 4), - Fix_Nak_2 = (1 << 3), - DBGPIN_E2 = (1 << 0), - - /* ResetCounterCommand */ - CounterReset = 0x1, - /* DumpCounterCommand */ - CounterDump = 0x8, - - /* PHY access */ - PHYAR_Flag = 0x80000000, - PHYAR_Write = 0x80000000, - PHYAR_Read = 0x00000000, - PHYAR_Reg_Mask = 0x1f, - PHYAR_Reg_shift = 16, - PHYAR_Data_Mask = 0xffff, - - /* EPHY access */ - EPHYAR_Flag = 0x80000000, - EPHYAR_Write = 0x80000000, - EPHYAR_Read = 0x00000000, - EPHYAR_Reg_Mask = 0x3f, - EPHYAR_Reg_Mask_v2 = 0x7f, - EPHYAR_Reg_shift = 16, - EPHYAR_Data_Mask = 0xffff, - - /* CSI access */ - CSIAR_Flag = 0x80000000, - CSIAR_Write = 0x80000000, - CSIAR_Read = 0x00000000, - CSIAR_ByteEn = 0x0f, - CSIAR_ByteEn_shift = 12, - CSIAR_Addr_Mask = 0x0fff, - - /* ERI access */ - ERIAR_Flag = 0x80000000, - ERIAR_Write = 0x80000000, - ERIAR_Read = 0x00000000, - ERIAR_Addr_Align = 4, /* ERI access register address must be 4 byte alignment */ - ERIAR_ExGMAC = 0, - ERIAR_MSIX = 1, - ERIAR_ASF = 2, - ERIAR_OOB = 2, - ERIAR_Type_shift = 16, - ERIAR_ByteEn = 0x0f, - ERIAR_ByteEn_shift = 12, - - /* OCP GPHY access */ - OCPDR_Write = 0x80000000, - OCPDR_Read = 0x00000000, - OCPDR_Reg_Mask = 0xFF, - OCPDR_Data_Mask = 0xFFFF, - OCPDR_GPHY_Reg_shift = 16, - OCPAR_Flag = 0x80000000, - OCPAR_GPHY_Write = 0x8000F060, - OCPAR_GPHY_Read = 0x0000F060, - OCPR_Write = 0x80000000, - OCPR_Read = 0x00000000, - OCPR_Addr_Reg_shift = 16, - OCPR_Flag = 0x80000000, - OCP_STD_PHY_BASE_PAGE = 0x0A40, - - /* MCU Command */ - Now_is_oob = (1 << 7), - Txfifo_empty = (1 << 5), - Rxfifo_empty = (1 << 4), - - /* E-FUSE access */ - EFUSE_WRITE = 0x80000000, - EFUSE_WRITE_OK = 0x00000000, - EFUSE_READ = 0x00000000, - EFUSE_READ_OK = 0x80000000, - EFUSE_WRITE_V3 = 0x40000000, - EFUSE_WRITE_OK_V3 = 0x00000000, - EFUSE_READ_V3 = 0x80000000, - EFUSE_READ_OK_V3 = 0x00000000, - EFUSE_Reg_Mask = 0x03FF, - EFUSE_Reg_Shift = 8, - EFUSE_Check_Cnt = 300, - EFUSE_READ_FAIL = 0xFF, - EFUSE_Data_Mask = 0x000000FF, - - /* GPIO */ - GPIO_en = (1 << 0), - - /* PTP */ - PTP_ISR_TOK = (1 << 1), - PTP_ISR_TER = (1 << 2), - PTP_EXEC_CMD = (1 << 7), - PTP_ADJUST_TIME_NS_NEGATIVE = (1 << 30), - PTP_ADJUST_TIME_S_NEGATIVE = (1ULL << 48), - - /* New Interrupt Bits */ - INT_CFG0_ENABLE_8125 = (1 << 0), - INT_CFG0_TIMEOUT0_BYPASS_8125 = (1 << 1), - INT_CFG0_MITIGATION_BYPASS_8125 = (1 << 2), - ISRIMR_V2_ROK_Q0 = (1 << 0), - ISRIMR_TOK_Q0 = (1 << 16), - ISRIMR_TOK_Q1 = (1 << 18), - ISRIMR_V2_LINKCHG = (1 << 21), - - /* Magic Number */ - RTL8125_MAGIC_NUMBER = 0x0badbadbadbadbadull, -}; - -enum _DescStatusBit { - DescOwn = (1 << 31), /* Descriptor is owned by NIC */ - RingEnd = (1 << 30), /* End of descriptor ring */ - FirstFrag = (1 << 29), /* First segment of a packet */ - LastFrag = (1 << 28), /* Final segment of a packet */ - - DescOwn_V3 = (DescOwn), /* Descriptor is owned by NIC */ - RingEnd_V3 = (RingEnd), /* End of descriptor ring */ - FirstFrag_V3 = (1 << 25), /* First segment of a packet */ - LastFrag_V3 = (1 << 24), /* Final segment of a packet */ - - /* Tx private */ - /*------ offset 0 of tx descriptor ------*/ - LargeSend = (1 << 27), /* TCP Large Send Offload (TSO) */ - GiantSendv4 = (1 << 26), /* TCP Giant Send Offload V4 (GSOv4) */ - GiantSendv6 = (1 << 25), /* TCP Giant Send Offload V6 (GSOv6) */ - LargeSend_DP = (1 << 16), /* TCP Large Send Offload (TSO) */ - MSSShift = 16, /* MSS value position */ - MSSMask = 0x7FFU, /* MSS value 11 bits */ - TxIPCS = (1 << 18), /* Calculate IP checksum */ - TxUDPCS = (1 << 17), /* Calculate UDP/IP checksum */ - TxTCPCS = (1 << 16), /* Calculate TCP/IP checksum */ - TxVlanTag = (1 << 17), /* Add VLAN tag */ - - /*@@@@@@ offset 4 of tx descriptor => bits for RTL8125 only begin @@@@@@*/ - TxUDPCS_C = (1 << 31), /* Calculate UDP/IP checksum */ - TxTCPCS_C = (1 << 30), /* Calculate TCP/IP checksum */ - TxIPCS_C = (1 << 29), /* Calculate IP checksum */ - TxIPV6F_C = (1 << 28), /* Indicate it is an IPv6 packet */ - /*@@@@@@ offset 4 of tx descriptor => bits for RTL8125 only end @@@@@@*/ - - - /* Rx private */ - /*------ offset 0 of rx descriptor ------*/ - PID1 = (1 << 18), /* Protocol ID bit 1/2 */ - PID0 = (1 << 17), /* Protocol ID bit 2/2 */ - -#define RxProtoUDP (PID1) -#define RxProtoTCP (PID0) -#define RxProtoIP (PID1 | PID0) -#define RxProtoMask RxProtoIP - - RxIPF = (1 << 16), /* IP checksum failed */ - RxUDPF = (1 << 15), /* UDP/IP checksum failed */ - RxTCPF = (1 << 14), /* TCP/IP checksum failed */ - RxVlanTag = (1 << 16), /* VLAN tag available */ - - /*@@@@@@ offset 0 of rx descriptor => bits for RTL8125 only begin @@@@@@*/ - RxUDPT = (1 << 18), - RxTCPT = (1 << 17), - /*@@@@@@ offset 0 of rx descriptor => bits for RTL8125 only end @@@@@@*/ - - /*@@@@@@ offset 4 of rx descriptor => bits for RTL8125 only begin @@@@@@*/ - RxV6F = (1 << 31), - RxV4F = (1 << 30), - /*@@@@@@ offset 4 of rx descriptor => bits for RTL8125 only end @@@@@@*/ - - - PID1_v3 = (1 << 29), /* Protocol ID bit 1/2 */ - PID0_v3 = (1 << 28), /* Protocol ID bit 2/2 */ - -#define RxProtoUDP_v3 (PID1_v3) -#define RxProtoTCP_v3 (PID0_v3) -#define RxProtoIP_v3 (PID1_v3 | PID0_v3) -#define RxProtoMask_v3 RxProtoIP_v3 - - RxIPF_v3 = (1 << 26), /* IP checksum failed */ - RxUDPF_v3 = (1 << 25), /* UDP/IP checksum failed */ - RxTCPF_v3 = (1 << 24), /* TCP/IP checksum failed */ - RxSCTPF_v3 = (1 << 23), /* TCP/IP checksum failed */ - RxVlanTag_v3 = (RxVlanTag), /* VLAN tag available */ - - /*@@@@@@ offset 0 of rx descriptor => bits for RTL8125 only begin @@@@@@*/ - RxUDPT_v3 = (1 << 29), - RxTCPT_v3 = (1 << 28), - RxSCTP_v3 = (1 << 27), - /*@@@@@@ offset 0 of rx descriptor => bits for RTL8125 only end @@@@@@*/ - - /*@@@@@@ offset 4 of rx descriptor => bits for RTL8125 only begin @@@@@@*/ - RxV6F_v3 = (RxV6F), - RxV4F_v3 = (RxV4F), - /*@@@@@@ offset 4 of rx descriptor => bits for RTL8125 only end @@@@@@*/ -}; - -enum features { -// RTL_FEATURE_WOL = (1 << 0), - RTL_FEATURE_MSI = (1 << 1), - RTL_FEATURE_MSIX = (1 << 2), -}; - -enum wol_capability { - WOL_DISABLED = 0, - WOL_ENABLED = 1 -}; - -enum bits { - BIT_0 = (1 << 0), - BIT_1 = (1 << 1), - BIT_2 = (1 << 2), - BIT_3 = (1 << 3), - BIT_4 = (1 << 4), - BIT_5 = (1 << 5), - BIT_6 = (1 << 6), - BIT_7 = (1 << 7), - BIT_8 = (1 << 8), - BIT_9 = (1 << 9), - BIT_10 = (1 << 10), - BIT_11 = (1 << 11), - BIT_12 = (1 << 12), - BIT_13 = (1 << 13), - BIT_14 = (1 << 14), - BIT_15 = (1 << 15), - BIT_16 = (1 << 16), - BIT_17 = (1 << 17), - BIT_18 = (1 << 18), - BIT_19 = (1 << 19), - BIT_20 = (1 << 20), - BIT_21 = (1 << 21), - BIT_22 = (1 << 22), - BIT_23 = (1 << 23), - BIT_24 = (1 << 24), - BIT_25 = (1 << 25), - BIT_26 = (1 << 26), - BIT_27 = (1 << 27), - BIT_28 = (1 << 28), - BIT_29 = (1 << 29), - BIT_30 = (1 << 30), - BIT_31 = (1 << 31) -}; - -enum effuse { - EFUSE_NOT_SUPPORT = 0, - EFUSE_SUPPORT_V1, - EFUSE_SUPPORT_V2, - EFUSE_SUPPORT_V3, - EFUSE_SUPPORT_V4, -}; -#define RsvdMask 0x3fffc000 -#define RsvdMaskV3 0x3fff8000 - -struct TxDesc { - u32 opts1; - u32 opts2; - u64 addr; - u32 reserved0; - u32 reserved1; - u32 reserved2; - u32 reserved3; -}; - -struct RxDesc { - u32 opts1; - u32 opts2; - u64 addr; -}; - -struct RxDescV3 { - union { - struct { - u32 rsv1; - u32 rsv2; - } RxDescDDWord1; - }; - - union { - struct { - u32 RSSResult; - u16 HeaderBufferLen; - u16 HeaderInfo; - } RxDescNormalDDWord2; - - struct { - u32 rsv5; - u32 rsv6; - } RxDescDDWord2; - }; - - union { - u64 addr; - - struct { - u32 TimeStampLow; - u32 TimeStampHigh; - } RxDescTimeStamp; - - struct { - u32 rsv8; - u32 rsv9; - } RxDescDDWord3; - }; - - union { - struct { - u32 opts2; - u32 opts1; - } RxDescNormalDDWord4; - - struct { - u16 TimeStampHHigh; - u16 rsv11; - u32 opts1; - } RxDescPTPDDWord4; - }; -}; - -enum rxdesc_type { - RXDESC_TYPE_NORMAL=0, - RXDESC_TYPE_NEXT, - RXDESC_TYPE_PTP, - RXDESC_TYPE_MAX -}; - -//Rx Desc Type -enum rx_desc_ring_type { - RX_DESC_RING_TYPE_UNKNOWN=0, - RX_DESC_RING_TYPE_1, - RX_DESC_RING_TYPE_2, - RX_DESC_RING_TYPE_3, - RX_DESC_RING_TYPE_MAX -}; - -enum rx_desc_len { - RX_DESC_LEN_TYPE_1 = (sizeof(struct RxDesc)), - RX_DESC_LEN_TYPE_3 = (sizeof(struct RxDescV3)) -}; - -struct ring_info { - struct sk_buff *skb; - u32 len; - u8 __pad[sizeof(void *) - sizeof(u32)]; -}; - -struct pci_resource { - u8 cmd; - u8 cls; - u16 io_base_h; - u16 io_base_l; - u16 mem_base_h; - u16 mem_base_l; - u8 ilr; - u16 resv_0x1c_h; - u16 resv_0x1c_l; - u16 resv_0x20_h; - u16 resv_0x20_l; - u16 resv_0x24_h; - u16 resv_0x24_l; - u16 resv_0x2c_h; - u16 resv_0x2c_l; - u32 pci_sn_l; - u32 pci_sn_h; -}; - -enum r8125_flag { - R8125_FLAG_DOWN = 0, - R8125_FLAG_TASK_RESET_PENDING, - R8125_FLAG_TASK_ESD_CHECK_PENDING, - R8125_FLAG_TASK_LINKCHG_CHECK_PENDING, - R8125_FLAG_MAX -}; - -struct rtl8125_tx_ring { - void* priv; - u32 index; - u32 cur_tx; /* Index into the Tx descriptor buffer of next Rx pkt. */ - u32 dirty_tx; - u32 num_tx_desc; /* Number of Tx descriptor registers */ - struct TxDesc *TxDescArray; /* 256-aligned Tx descriptor ring */ - dma_addr_t TxPhyAddr; - struct ring_info tx_skb[MAX_NUM_TX_DESC]; /* Tx data buffers */ - - u32 NextHwDesCloPtr; - u32 BeginHwDesCloPtr; - - u16 hw_clo_ptr_reg; - u16 sw_tail_ptr_reg; - - u16 tdsar_reg; /* Transmit Descriptor Start Address */ -}; - -struct rtl8125_rx_ring { - void* priv; - u32 index; - u32 cur_rx; /* Index into the Rx descriptor buffer of next Rx pkt. */ - u32 dirty_rx; - u32 num_rx_desc; /* Number of Rx descriptor registers */ - struct RxDesc *RxDescArray; /* 256-aligned Rx descriptor ring */ - u64 RxDescPhyAddr[MAX_NUM_RX_DESC]; /* Rx desc physical address*/ - dma_addr_t RxPhyAddr; - struct sk_buff *Rx_skbuff[MAX_NUM_RX_DESC]; /* Rx data buffers */ - - u16 rdsar_reg; /* Receive Descriptor Start Address */ -}; - -struct r8125_napi { -#ifdef CONFIG_R8125_NAPI -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) - struct napi_struct napi; -#endif -#endif - void* priv; - int index; -}; - -struct r8125_irq { - irq_handler_t handler; - unsigned int vector; - u8 requested; - char name[IFNAMSIZ + 10]; -}; - -#pragma pack(1) -struct rtl8125_regs { - //00 - u8 mac_id[6]; - u16 reg_06; - u8 mar[8]; - //10 - u64 dtccr; - u16 ledsel0; - u16 legreg; - u32 tctr3; - //20 - u32 txq0_dsc_st_addr_0; - u32 txq0_dsc_st_addr_2; - u64 reg_28; - //30 - u16 rit; - u16 ritc; - u16 reg_34; - u8 reg_36; - u8 command; - u32 imr0; - u32 isr0; - //40 - u32 tcr; - u32 rcr; - u32 tctr0; - u32 tctr1; - //50 - u8 cr93c46; - u8 config0; - u8 config1; - u8 config2; - u8 config3; - u8 config4; - u8 config5; - u8 tdfnr; - u32 timer_int0; - u32 timer_int1; - //60 - u32 gphy_mdcmdio; - u32 csidr; - u32 csiar; - u16 phy_status; - u8 config6; - u8 pmch; - //70 - u32 eridr; - u32 eriar; - u16 config7; - u16 reg_7a; - u32 ephy_rxerr_cnt; - //80 - u32 ephy_mdcmdio; - u16 ledsel2; - u16 ledsel1; - u32 tctr2; - u32 timer_int2; - //90 - u8 tppoll0; - u8 reg_91; - u16 reg_92; - u16 led_feature; - u16 ledsel3; - u16 eee_led_config; - u16 reg_9a; - u32 reg_9c; - //a0 - u32 reg_a0; - u32 reg_a4; - u32 reg_a8; - u32 reg_ac; - //b0 - u32 patch_dbg; - u32 reg_b4; - u32 gphy_ocp; - u32 reg_bc; - //c0 - u32 reg_c0; - u32 reg_c4; - u32 reg_c8; - u16 otp_cmd; - u16 otp_pg_config; - //d0 - u16 phy_pwr; - u8 twsi_ctrl; - u8 oob_ctrl; - u16 mac_dbgo; - u16 mac_dbg; - u16 reg_d8; - u16 rms; - u32 efuse_data; - //e0 - u16 cplus_cmd; - u16 reg_e2; - u32 rxq0_dsc_st_addr_0; - u32 rxq0_dsc_st_addr_2; - u16 reg_ec; - u16 tx10midle_cnt; - //f0 - u16 misc0; - u16 misc1; - u32 timer_int3; - u32 cmac_ib; - u16 reg_fc; - u16 sw_rst; -}; -#pragma pack() - -struct rtl8125_regs_save { - union { - u8 mac_io[R8125_MAC_REGS_SIZE]; - - struct rtl8125_regs mac_reg; - }; - u16 pcie_phy[R8125_EPHY_REGS_SIZE/2]; - u16 eth_phy[R8125_PHY_REGS_SIZE/2]; - u32 eri_reg[R8125_ERI_REGS_SIZE/4]; - u32 pci_reg[R8125_PCI_REGS_SIZE/4]; - u16 sw_tail_ptr_reg[R8125_MAX_TX_QUEUES]; - u16 hw_clo_ptr_reg[R8125_MAX_TX_QUEUES]; - - //ktime_t begin_ktime; - //ktime_t end_ktime; - //u64 duration_ns; - - u16 sw0_tail_ptr; - u16 next_hwq0_clo_ptr; - u16 sw1_tail_ptr; - u16 next_hwq1_clo_ptr; - - u16 int_miti_rxq0; - u16 int_miti_txq0; - u16 int_miti_rxq1; - u16 int_miti_txq1; - u8 int_config; - u32 imr_new; - u32 isr_new; - - u8 tdu_status; - u16 rdu_status; - - u16 tc_mode; - - u32 txq1_dsc_st_addr_0; - u32 txq1_dsc_st_addr_2; - - u32 pla_tx_q0_idle_credit; - u32 pla_tx_q1_idle_credit; - - u32 rxq1_dsc_st_addr_0; - u32 rxq1_dsc_st_addr_2; - - u32 rss_ctrl; - u8 rss_key[RTL8125_RSS_KEY_SIZE]; - u8 rss_i_table[RTL8125_MAX_INDIRECTION_TABLE_ENTRIES]; - u16 rss_queue_num_sel_r; -}; - -struct rtl8125_counters { - /* legacy */ - u64 tx_packets; - u64 rx_packets; - u64 tx_errors; - u32 rx_errors; - u16 rx_missed; - u16 align_errors; - u32 tx_one_collision; - u32 tx_multi_collision; - u64 rx_unicast; - u64 rx_broadcast; - u32 rx_multicast; - u16 tx_aborted; - u16 tx_underrun; - - /* extended */ - u64 tx_octets; - u64 rx_octets; - u64 rx_multicast64; - u64 tx_unicast64; - u64 tx_broadcast64; - u64 tx_multicast64; - u32 tx_pause_on; - u32 tx_pause_off; - u32 tx_pause_all; - u32 tx_deferred; - u32 tx_late_collision; - u32 tx_all_collision; - u32 tx_aborted32; - u32 align_errors32; - u32 rx_frame_too_long; - u32 rx_runt; - u32 rx_pause_on; - u32 rx_pause_off; - u32 rx_pause_all; - u32 rx_unknown_opcode; - u32 rx_mac_error; - u32 tx_underrun32; - u32 rx_mac_missed; - u32 rx_tcam_dropped; - u32 tdu; - u32 rdu; -}; - -/* Flow Control Settings */ -enum rtl8125_fc_mode { - rtl8125_fc_none = 0, - rtl8125_fc_rx_pause, - rtl8125_fc_tx_pause, - rtl8125_fc_full, - rtl8125_fc_default -}; - -struct rtl8125_private { - void __iomem *mmio_addr; /* memory map physical address */ - struct pci_dev *pci_dev; /* Index of PCI device */ - struct net_device *dev; - struct r8125_napi r8125napi[R8125_MAX_MSIX_VEC]; - struct r8125_irq irq_tbl[R8125_MAX_MSIX_VEC]; - unsigned int irq_nvecs; - unsigned int max_irq_nvecs; - unsigned int min_irq_nvecs; - //struct msix_entry msix_entries[R8125_MAX_MSIX_VEC]; - struct net_device_stats stats; /* statistics of net device */ -#ifdef ENABLE_PTP_SUPPORT - spinlock_t lock; /* spin lock flag */ -#endif - u32 msg_enable; - u32 tx_tcp_csum_cmd; - u32 tx_udp_csum_cmd; - u32 tx_ip_csum_cmd; - u32 tx_ipv6_csum_cmd; - int max_jumbo_frame_size; - int chipset; - u32 mcfg; - //u32 cur_rx; /* Index into the Rx descriptor buffer of next Rx pkt. */ - //u32 cur_tx; /* Index into the Tx descriptor buffer of next Rx pkt. */ - //u32 dirty_rx; - //u32 dirty_tx; - //struct TxDesc *TxDescArray; /* 256-aligned Tx descriptor ring */ - //struct RxDesc *RxDescArray; /* 256-aligned Rx descriptor ring */ - //dma_addr_t TxPhyAddr; - //dma_addr_t RxPhyAddr; - //struct sk_buff *Rx_skbuff[MAX_NUM_RX_DESC]; /* Rx data buffers */ - //struct ring_info tx_skb[MAX_NUM_TX_DESC]; /* Tx data buffers */ - unsigned rx_buf_sz; - u16 HwSuppNumTxQueues; - u16 HwSuppNumRxQueues; - unsigned int num_tx_rings; - unsigned int num_rx_rings; - struct rtl8125_tx_ring tx_ring[R8125_MAX_TX_QUEUES]; - struct rtl8125_rx_ring rx_ring[R8125_MAX_RX_QUEUES]; -#ifdef ENABLE_LIB_SUPPORT - struct atomic_notifier_head lib_nh; - struct rtl8125_ring lib_tx_ring[R8125_MAX_TX_QUEUES]; - struct rtl8125_ring lib_rx_ring[R8125_MAX_RX_QUEUES]; -#endif - //struct timer_list esd_timer; - //struct timer_list link_timer; - struct pci_resource pci_cfg_space; - unsigned int esd_flag; - unsigned int pci_cfg_is_read; - unsigned int rtl8125_rx_config; - u16 cp_cmd; - u32 intr_mask; - u32 timer_intr_mask; - u16 isr_reg[R8125_MAX_QUEUES]; - u16 imr_reg[R8125_MAX_QUEUES]; - int phy_auto_nego_reg; - int phy_1000_ctrl_reg; - int phy_2500_ctrl_reg; - u8 org_mac_addr[NODE_ADDRESS_SIZE]; - struct rtl8125_counters *tally_vaddr; - dma_addr_t tally_paddr; - -#ifdef CONFIG_R8125_VLAN - struct vlan_group *vlgrp; -#endif - u8 wol_enabled; - u32 wol_opts; - u8 efuse_ver; - u8 eeprom_type; - u8 autoneg; - u8 duplex; - u32 speed; - u32 advertising; - enum rtl8125_fc_mode fcpause; - u16 eeprom_len; - u16 cur_page; - u32 bios_setting; - - int (*set_speed)(struct net_device *, u8 autoneg, u32 speed, u8 duplex, u32 adv); -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) - void (*get_settings)(struct net_device *, struct ethtool_cmd *); -#else - void (*get_settings)(struct net_device *, struct ethtool_link_ksettings *); -#endif - void (*phy_reset_enable)(struct net_device *); - unsigned int (*phy_reset_pending)(struct net_device *); - unsigned int (*link_ok)(struct net_device *); -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) - struct work_struct reset_task; - struct work_struct esd_task; - struct work_struct linkchg_task; -#else - struct delayed_work reset_task; - struct delayed_work esd_task; - struct delayed_work linkchg_task; -#endif - DECLARE_BITMAP(task_flags, R8125_FLAG_MAX); - unsigned features; - - u8 org_pci_offset_99; - u8 org_pci_offset_180; - u8 issue_offset_99_event; - - u8 org_pci_offset_80; - u8 org_pci_offset_81; - u8 use_timer_interrrupt; - - u32 keep_intr_cnt; - - u8 HwIcVerUnknown; - u8 NotWrRamCodeToMicroP; - u8 NotWrMcuPatchCode; - u8 HwHasWrRamCodeToMicroP; - - u16 sw_ram_code_ver; - u16 hw_ram_code_ver; - - u8 RequireRduNonStopPatch; - - u8 rtk_enable_diag; - - u8 ShortPacketSwChecksum; - - u8 UseSwPaddingShortPkt; - - void *ShortPacketEmptyBuffer; - dma_addr_t ShortPacketEmptyBufferPhy; - - u8 RequireAdcBiasPatch; - u16 AdcBiasPatchIoffset; - - u8 RequireAdjustUpsTxLinkPulseTiming; - u16 SwrCnt1msIni; - - u8 HwSuppNowIsOobVer; - - u8 RequiredSecLanDonglePatch; - - u8 RequirePhyMdiSwapPatch; - - u8 RequireLSOPatch; - - u32 HwFiberModeVer; - u32 HwFiberStat; - u8 HwSwitchMdiToFiber; - - u16 NicCustLedValue; - - u8 HwSuppMagicPktVer; - - u8 HwSuppLinkChgWakeUpVer; - - u8 HwSuppCheckPhyDisableModeVer; - - u8 random_mac; - - u16 phy_reg_aner; - u16 phy_reg_anlpar; - u16 phy_reg_gbsr; - u16 phy_reg_status_2500; - - u32 HwPcieSNOffset; - - u8 HwSuppTxNoCloseVer; - u8 EnableTxNoClose; - - u8 HwSuppIsrVer; - u8 HwCurrIsrVer; - - u8 HwSuppIntMitiVer; - - u8 HwSuppExtendTallyCounterVer; - - u8 check_keep_link_speed; - u8 resume_not_chg_speed; - - u8 HwSuppD0SpeedUpVer; - u8 D0SpeedUpSpeed; - - u8 ring_lib_enabled; - - const char *fw_name; - struct rtl8125_fw *rtl_fw; - u32 ocp_base; - - //Dash+++++++++++++++++ - u8 HwSuppDashVer; - u8 DASH; - u8 dash_printer_enabled; - u8 HwPkgDet; - void __iomem *mapped_cmac_ioaddr; /* mapped cmac memory map physical address */ - void __iomem *cmac_ioaddr; /* cmac memory map physical address */ - -#ifdef ENABLE_DASH_SUPPORT - u16 AfterRecvFromFwBufLen; - u8 AfterRecvFromFwBuf[RECV_FROM_FW_BUF_SIZE]; - u16 AfterSendToFwBufLen; - u8 AfterSendToFwBuf[SEND_TO_FW_BUF_SIZE]; - u16 SendToFwBufferLen; - u32 SizeOfSendToFwBuffer; - u32 SizeOfSendToFwBufferMemAlloc; - u32 NumOfSendToFwBuffer; - - u8 OobReq; - u8 OobAck; - u32 OobReqComplete; - u32 OobAckComplete; - - u8 RcvFwReqSysOkEvt; - u8 RcvFwDashOkEvt; - u8 SendFwHostOkEvt; - - u8 DashFwDisableRx; - - void *UnalignedSendToFwBufferVa; - void *SendToFwBuffer; - u64 SendToFwBufferPhy; - u8 SendingToFw; - dma_addr_t UnalignedSendToFwBufferPa; - PTX_DASH_SEND_FW_DESC TxDashSendFwDesc; - u64 TxDashSendFwDescPhy; - u8 *UnalignedTxDashSendFwDescVa; - u32 SizeOfTxDashSendFwDescMemAlloc; - u32 SizeOfTxDashSendFwDesc; - u32 NumTxDashSendFwDesc; - u32 CurrNumTxDashSendFwDesc; - u32 LastSendNumTxDashSendFwDesc; - dma_addr_t UnalignedTxDashSendFwDescPa; - - u32 NumRecvFromFwBuffer; - u32 SizeOfRecvFromFwBuffer; - u32 SizeOfRecvFromFwBufferMemAlloc; - void *RecvFromFwBuffer; - u64 RecvFromFwBufferPhy; - - void *UnalignedRecvFromFwBufferVa; - dma_addr_t UnalignedRecvFromFwBufferPa; - PRX_DASH_FROM_FW_DESC RxDashRecvFwDesc; - u64 RxDashRecvFwDescPhy; - u8 *UnalignedRxDashRecvFwDescVa; - u32 SizeOfRxDashRecvFwDescMemAlloc; - u32 SizeOfRxDashRecvFwDesc; - u32 NumRxDashRecvFwDesc; - u32 CurrNumRxDashRecvFwDesc; - dma_addr_t UnalignedRxDashRecvFwDescPa; - u8 DashReqRegValue; - u16 HostReqValue; - - u32 CmacResetIsrCounter; - u8 CmacResetIntr; - u8 CmacResetting; - u8 CmacOobIssueCmacReset; - u32 CmacResetbyFwCnt; - -#if defined(ENABLE_DASH_PRINTER_SUPPORT) - struct completion fw_ack; - struct completion fw_req; - struct completion fw_host_ok; -#endif - //Dash----------------- -#endif //ENABLE_DASH_SUPPORT - - //Realwow++++++++++++++ - u8 HwSuppKCPOffloadVer; - - u8 EnableDhcpTimeoutWake; - u8 EnableTeredoOffload; - u8 EnableKCPOffload; -#ifdef ENABLE_REALWOW_SUPPORT - u32 DhcpTimeout; - MP_KCP_INFO MpKCPInfo; - //Realwow-------------- -#endif //ENABLE_REALWOW_SUPPORT - - struct ethtool_eee eee; - -#ifdef ENABLE_R8125_PROCFS - //Procfs support - struct proc_dir_entry *proc_dir; -#endif - u8 InitRxDescType; - u16 RxDescLength; //V1 16 Byte V2 32 Bytes - - u8 HwSuppPtpVer; - u8 EnablePtp; - u8 ptp_master_mode; - s64 ptp_adjust; -#ifdef ENABLE_PTP_SUPPORT - u32 tx_hwtstamp_timeouts; - u32 tx_hwtstamp_skipped; - struct work_struct ptp_tx_work; - struct sk_buff *ptp_tx_skb; - struct hwtstamp_config hwtstamp_config; - unsigned long ptp_tx_start; - struct ptp_clock_info ptp_clock_info; - struct ptp_clock *ptp_clock; -#endif - - u8 HwSuppRssVer; - u8 EnableRss; - u16 HwSuppIndirTblEntries; -#ifdef ENABLE_RSS_SUPPORT - u32 rss_flags; - /* Receive Side Scaling settings */ - u8 rss_key[RTL8125_RSS_KEY_SIZE]; - u8 rss_indir_tbl[RTL8125_MAX_INDIRECTION_TABLE_ENTRIES]; - u32 rss_options; -#endif - - u8 HwSuppMacMcuVer; - u16 MacMcuPageSize; -}; - -#ifdef ENABLE_LIB_SUPPORT -static inline unsigned int -rtl8125_num_lib_tx_rings(struct rtl8125_private *tp) -{ - int count, i; - - for (count = 0, i = tp->num_tx_rings; i < tp->HwSuppNumTxQueues; i++) - if(tp->lib_tx_ring[i].enabled) - count++; - - return count; -} - -static inline unsigned int -rtl8125_num_lib_rx_rings(struct rtl8125_private *tp) -{ - int count, i; - - for (count = 0, i = tp->num_rx_rings; i < tp->HwSuppNumRxQueues; i++) - if(tp->lib_rx_ring[i].enabled) - count++; - - return count; -} - -#else -static inline unsigned int -rtl8125_num_lib_tx_rings(struct rtl8125_private *tp) -{ - return 0; -} - -static inline unsigned int -rtl8125_num_lib_rx_rings(struct rtl8125_private *tp) -{ - return 0; -} -#endif - -static inline unsigned int -rtl8125_tot_tx_rings(struct rtl8125_private *tp) -{ - return tp->num_tx_rings + rtl8125_num_lib_tx_rings(tp); -} - -static inline unsigned int -rtl8125_tot_rx_rings(struct rtl8125_private *tp) -{ - return tp->num_rx_rings + rtl8125_num_lib_rx_rings(tp); -} - -enum eetype { - EEPROM_TYPE_NONE=0, - EEPROM_TYPE_93C46, - EEPROM_TYPE_93C56, - EEPROM_TWSI -}; - -enum mcfg { - CFG_METHOD_2=2, - CFG_METHOD_3, - CFG_METHOD_4, - CFG_METHOD_5, - CFG_METHOD_6, - CFG_METHOD_7, - CFG_METHOD_DEFAULT, - CFG_METHOD_MAX -}; - -#define LSO_32K 32000 -#define LSO_64K 64000 - -#define NIC_MIN_PHYS_BUF_COUNT (2) -#define NIC_MAX_PHYS_BUF_COUNT_LSO_64K (24) -#define NIC_MAX_PHYS_BUF_COUNT_LSO2 (16*4) - -#define GTTCPHO_SHIFT 18 -#define GTTCPHO_MAX 0x7fU -#define GTPKTSIZE_MAX 0x3ffffU -#define TCPHO_SHIFT 18 -#define TCPHO_MAX 0x3ffU -#define LSOPKTSIZE_MAX 0xffffU -#define MSS_MAX 0x07ffu /* MSS value */ - -#define OOB_CMD_RESET 0x00 -#define OOB_CMD_DRIVER_START 0x05 -#define OOB_CMD_DRIVER_STOP 0x06 -#define OOB_CMD_SET_IPMAC 0x41 - -#define WAKEUP_MAGIC_PACKET_NOT_SUPPORT (0) -#define WAKEUP_MAGIC_PACKET_V1 (1) -#define WAKEUP_MAGIC_PACKET_V2 (2) -#define WAKEUP_MAGIC_PACKET_V3 (3) - -//Ram Code Version -#define NIC_RAMCODE_VERSION_CFG_METHOD_2 (0x0b11) -#define NIC_RAMCODE_VERSION_CFG_METHOD_3 (0x0b33) -#define NIC_RAMCODE_VERSION_CFG_METHOD_4 (0x0b17) -#define NIC_RAMCODE_VERSION_CFG_METHOD_5 (0x0b55) - -//hwoptimize -#define HW_PATCH_SOC_LAN (BIT_0) -#define HW_PATCH_SAMSUNG_LAN_DONGLE (BIT_2) - -static const u16 other_q_intr_mask = (RxOK1 | RxDU1); - -void rtl8125_mdio_write(struct rtl8125_private *tp, u16 RegAddr, u16 value); -void rtl8125_mdio_prot_write(struct rtl8125_private *tp, u32 RegAddr, u32 value); -void rtl8125_mdio_prot_direct_write_phy_ocp(struct rtl8125_private *tp, u32 RegAddr, u32 value); -u32 rtl8125_mdio_read(struct rtl8125_private *tp, u16 RegAddr); -u32 rtl8125_mdio_prot_read(struct rtl8125_private *tp, u32 RegAddr); -u32 rtl8125_mdio_prot_direct_read_phy_ocp(struct rtl8125_private *tp, u32 RegAddr); -void rtl8125_ephy_write(struct rtl8125_private *tp, int RegAddr, int value); -void rtl8125_mac_ocp_write(struct rtl8125_private *tp, u16 reg_addr, u16 value); -u32 rtl8125_mac_ocp_read(struct rtl8125_private *tp, u16 reg_addr); -void rtl8125_clear_eth_phy_bit(struct rtl8125_private *tp, u8 addr, u16 mask); -void rtl8125_set_eth_phy_bit(struct rtl8125_private *tp, u8 addr, u16 mask); -void rtl8125_ocp_write(struct rtl8125_private *tp, u16 addr, u8 len, u32 data); -void rtl8125_oob_notify(struct rtl8125_private *tp, u8 cmd); -void rtl8125_init_ring_indexes(struct rtl8125_private *tp); -int rtl8125_eri_write(struct rtl8125_private *tp, int addr, int len, u32 value, int type); -void rtl8125_oob_mutex_lock(struct rtl8125_private *tp); -u32 rtl8125_ocp_read(struct rtl8125_private *tp, u16 addr, u8 len); -u32 rtl8125_ocp_read_with_oob_base_address(struct rtl8125_private *tp, u16 addr, u8 len, u32 base_address); -u32 rtl8125_ocp_write_with_oob_base_address(struct rtl8125_private *tp, u16 addr, u8 len, u32 value, u32 base_address); -u32 rtl8125_eri_read(struct rtl8125_private *tp, int addr, int len, int type); -u32 rtl8125_eri_read_with_oob_base_address(struct rtl8125_private *tp, int addr, int len, int type, u32 base_address); -int rtl8125_eri_write(struct rtl8125_private *tp, int addr, int len, u32 value, int type); -int rtl8125_eri_write_with_oob_base_address(struct rtl8125_private *tp, int addr, int len, u32 value, int type, u32 base_address); -u16 rtl8125_ephy_read(struct rtl8125_private *tp, int RegAddr); -void rtl8125_wait_txrx_fifo_empty(struct net_device *dev); -void rtl8125_enable_now_is_oob(struct rtl8125_private *tp); -void rtl8125_disable_now_is_oob(struct rtl8125_private *tp); -void rtl8125_oob_mutex_unlock(struct rtl8125_private *tp); -void rtl8125_dash2_disable_tx(struct rtl8125_private *tp); -void rtl8125_dash2_enable_tx(struct rtl8125_private *tp); -void rtl8125_dash2_disable_rx(struct rtl8125_private *tp); -void rtl8125_dash2_enable_rx(struct rtl8125_private *tp); -void rtl8125_hw_disable_mac_mcu_bps(struct net_device *dev); -void rtl8125_mark_to_asic(struct rtl8125_private *tp, struct RxDesc *desc, u32 rx_buf_sz); - -static inline void -rtl8125_make_unusable_by_asic(struct rtl8125_private *tp, - struct RxDesc *desc) -{ - if (tp->InitRxDescType == RX_DESC_RING_TYPE_3) { - ((struct RxDescV3 *)desc)->addr = RTL8125_MAGIC_NUMBER; - ((struct RxDescV3 *)desc)->RxDescNormalDDWord4.opts1 &= ~cpu_to_le32(DescOwn | RsvdMaskV3); - } else { - desc->addr = RTL8125_MAGIC_NUMBER; - desc->opts1 &= ~cpu_to_le32(DescOwn | RsvdMask); - } -} - -static inline struct RxDesc* -rtl8125_get_rxdesc(struct rtl8125_private *tp, struct RxDesc *RxDescBase, u32 const cur_rx) -{ - return (struct RxDesc*)((u8*)RxDescBase + (cur_rx * tp->RxDescLength)); -} - -static inline void -rtl8125_disable_hw_interrupt_v2(struct rtl8125_private *tp, - u32 message_id) -{ - RTL_W32(tp, IMR_V2_CLEAR_REG_8125, BIT(message_id)); -} - -static inline void -rtl8125_enable_hw_interrupt_v2(struct rtl8125_private *tp, u32 message_id) -{ - RTL_W32(tp, IMR_V2_SET_REG_8125, BIT(message_id)); -} - -int rtl8125_open(struct net_device *dev); -int rtl8125_close(struct net_device *dev); -void rtl8125_hw_config(struct net_device *dev); -void rtl8125_hw_set_timer_int_8125(struct rtl8125_private *tp, u32 message_id, u8 timer_intmiti_val); -void rtl8125_set_rx_q_num(struct rtl8125_private *tp, unsigned int num_rx_queues); -void rtl8125_set_tx_q_num(struct rtl8125_private *tp, unsigned int num_tx_queues); -void rtl8125_hw_start(struct net_device *dev); -void rtl8125_hw_reset(struct net_device *dev); -void rtl8125_tx_clear(struct rtl8125_private *tp); -void rtl8125_rx_clear(struct rtl8125_private *tp); -int rtl8125_init_ring(struct net_device *dev); -void rtl8125_hw_set_rx_packet_filter(struct net_device *dev); -void rtl8125_enable_hw_linkchg_interrupt(struct rtl8125_private *tp); -int rtl8125_dump_tally_counter(struct rtl8125_private *tp, dma_addr_t paddr); - -#ifndef ENABLE_LIB_SUPPORT -static inline void rtl8125_lib_reset_prepare(struct rtl8125_private *tp) { } -static inline void rtl8125_lib_reset_complete(struct rtl8125_private *tp) { } -#endif - -#define HW_SUPPORT_CHECK_PHY_DISABLE_MODE(_M) ((_M)->HwSuppCheckPhyDisableModeVer > 0 ) -#define HW_HAS_WRITE_PHY_MCU_RAM_CODE(_M) (((_M)->HwHasWrRamCodeToMicroP == TRUE) ? 1 : 0) -#define HW_SUPPORT_D0_SPEED_UP(_M) ((_M)->HwSuppD0SpeedUpVer > 0) -#define HW_SUPPORT_MAC_MCU(_M) ((_M)->HwSuppMacMcuVer > 0) - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34) -#define netdev_mc_count(dev) ((dev)->mc_count) -#define netdev_mc_empty(dev) (netdev_mc_count(dev) == 0) -#define netdev_for_each_mc_addr(mclist, dev) \ - for (mclist = dev->mc_list; mclist; mclist = mclist->next) -#endif - -#endif /* __R8125_H */ diff --git a/package/kernel/r8125/src/r8125_dash.h b/package/kernel/r8125/src/r8125_dash.h deleted file mode 100644 index 6819370dfc..0000000000 --- a/package/kernel/r8125/src/r8125_dash.h +++ /dev/null @@ -1,261 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* -################################################################################ -# -# r8125 is the Linux device driver released for Realtek 2.5Gigabit Ethernet -# controllers with PCI-Express interface. -# -# Copyright(c) 2022 Realtek Semiconductor Corp. All rights reserved. -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the Free -# Software Foundation; either version 2 of the License, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -# more details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, see . -# -# Author: -# Realtek NIC software team -# No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan -# -################################################################################ -*/ - -/************************************************************************************ - * This product is covered by one or more of the following patents: - * US6,570,884, US6,115,776, and US6,327,625. - ***********************************************************************************/ - -#ifndef _LINUX_R8125_DASH_H -#define _LINUX_R8125_DASH_H - -#include - -#define SIOCDEVPRIVATE_RTLDASH SIOCDEVPRIVATE+2 - -enum rtl_dash_cmd { - RTL_DASH_ARP_NS_OFFLOAD = 0, - RTL_DASH_SET_OOB_IPMAC, - RTL_DASH_NOTIFY_OOB, - - RTL_DASH_SEND_BUFFER_DATA_TO_DASH_FW, - RTL_DASH_CHECK_SEND_BUFFER_TO_DASH_FW_COMPLETE, - RTL_DASH_GET_RCV_FROM_FW_BUFFER_DATA, - RTL_DASH_OOB_REQ, - RTL_DASH_OOB_ACK, - RTL_DASH_DETACH_OOB_REQ, - RTL_DASH_DETACH_OOB_ACK, - - RTL_FW_SET_IPV4 = 0x10, - RTL_FW_GET_IPV4, - RTL_FW_SET_IPV6, - RTL_FW_GET_IPV6, - RTL_FW_SET_EXT_SNMP, - RTL_FW_GET_EXT_SNMP, - RTL_FW_SET_WAKEUP_PATTERN, - RTL_FW_GET_WAKEUP_PATTERN, - RTL_FW_DEL_WAKEUP_PATTERN, - - RTLT_DASH_COMMAND_INVALID, -}; - -struct rtl_dash_ip_mac { - struct sockaddr ifru_addr; - struct sockaddr ifru_netmask; - struct sockaddr ifru_hwaddr; -}; - -struct rtl_dash_ioctl_struct { - __u32 cmd; - __u32 offset; - __u32 len; - union { - __u32 data; - void *data_buffer; - }; -}; - -struct settings_ipv4 { - __u32 IPv4addr; - __u32 IPv4mask; - __u32 IPv4Gateway; -}; - -struct settings_ipv6 { - __u32 reserved; - __u32 prefixLen; - __u16 IPv6addr[8]; - __u16 IPv6Gateway[8]; -}; - -struct settings_ext_snmp { - __u16 index; - __u16 oid_get_len; - __u8 oid_for_get[24]; - __u8 reserved0[26]; - __u16 value_len; - __u8 value[256]; - __u8 supported; - __u8 reserved1[27]; -}; - -struct wakeup_pattern { - __u8 index; - __u8 valid; - __u8 start; - __u8 length; - __u8 name[36]; - __u8 mask[16]; - __u8 pattern[128]; - __u32 reserved[2]; -}; - -typedef struct _RX_DASH_FROM_FW_DESC { - u16 length; - u8 statusLowByte; - u8 statusHighByte; - u32 resv; - u64 BufferAddress; -} -RX_DASH_FROM_FW_DESC, *PRX_DASH_FROM_FW_DESC; - -typedef struct _TX_DASH_SEND_FW_DESC { - u16 length; - u8 statusLowByte; - u8 statusHighByte; - u32 resv; - u64 BufferAddress; -} -TX_DASH_SEND_FW_DESC, *PTX_DASH_SEND_FW_DESC; - -typedef struct _OSOOBHdr { - u32 len; - u8 type; - u8 flag; - u8 hostReqV; - u8 res; -} -OSOOBHdr, *POSOOBHdr; - -typedef struct _RX_DASH_BUFFER_TYPE_2 { - OSOOBHdr oobhdr; - u8 RxDataBuffer[0]; -} -RX_DASH_BUFFER_TYPE_2, *PRX_DASH_BUFFER_TYPE_2; - -#define ALIGN_8 (0x7) -#define ALIGN_16 (0xf) -#define ALIGN_32 (0x1f) -#define ALIGN_64 (0x3f) -#define ALIGN_256 (0xff) -#define ALIGN_4096 (0xfff) - -#define OCP_REG_CONFIG0 (0x10) -#define OCP_REG_CONFIG0_REV_F (0xB8) -#define OCP_REG_DASH_POLL (0x30) -#define OCP_REG_HOST_REQ (0x34) -#define OCP_REG_DASH_REQ (0x35) -#define OCP_REG_CR (0x36) -#define OCP_REG_DMEMSTA (0x38) -#define OCP_REG_GPHYAR (0x60) - - -#define OCP_REG_CONFIG0_DASHEN BIT_15 -#define OCP_REG_CONFIG0_OOBRESET BIT_14 -#define OCP_REG_CONFIG0_APRDY BIT_13 -#define OCP_REG_CONFIG0_FIRMWARERDY BIT_12 -#define OCP_REG_CONFIG0_DRIVERRDY BIT_11 -#define OCP_REG_CONFIG0_OOB_WDT BIT_9 -#define OCP_REG_CONFIG0_DRV_WAIT_OOB BIT_8 -#define OCP_REG_CONFIG0_TLSEN BIT_7 - -#define HW_DASH_SUPPORT_DASH(_M) ((_M)->HwSuppDashVer > 0 ) -#define HW_DASH_SUPPORT_TYPE_1(_M) ((_M)->HwSuppDashVer == 1 ) -#define HW_DASH_SUPPORT_TYPE_2(_M) ((_M)->HwSuppDashVer == 2 ) -#define HW_DASH_SUPPORT_TYPE_3(_M) ((_M)->HwSuppDashVer == 3 ) - -#define RECV_FROM_FW_BUF_SIZE (1520) -#define SEND_TO_FW_BUF_SIZE (1520) - -#define RX_DASH_FROM_FW_OWN BIT_15 -#define TX_DASH_SEND_FW_OWN BIT_15 -#define TX_DASH_SEND_FW_OWN_HIGHBYTE BIT_7 - -#define TXS_CC3_0 (BIT_0|BIT_1|BIT_2|BIT_3) -#define TXS_EXC BIT_4 -#define TXS_LNKF BIT_5 -#define TXS_OWC BIT_6 -#define TXS_TES BIT_7 -#define TXS_UNF BIT_9 -#define TXS_LGSEN BIT_11 -#define TXS_LS BIT_12 -#define TXS_FS BIT_13 -#define TXS_EOR BIT_14 -#define TXS_OWN BIT_15 - -#define TPPool_HRDY 0x20 - -#define HostReqReg (0xC0) -#define SystemMasterDescStartAddrLow (0xF0) -#define SystemMasterDescStartAddrHigh (0xF4) -#define SystemSlaveDescStartAddrLow (0xF8) -#define SystemSlaveDescStartAddrHigh (0xFC) - -//DASH Request Type -#define WSMANREG 0x01 -#define OSPUSHDATA 0x02 - -#define RXS_OWN BIT_15 -#define RXS_EOR BIT_14 -#define RXS_FS BIT_13 -#define RXS_LS BIT_12 - -#define ISRIMR_DP_DASH_OK BIT_15 -#define ISRIMR_DP_HOST_OK BIT_13 -#define ISRIMR_DP_REQSYS_OK BIT_11 - -#define ISRIMR_DASH_INTR_EN BIT_12 -#define ISRIMR_DASH_INTR_CMAC_RESET BIT_15 - -#define ISRIMR_DASH_TYPE2_ROK BIT_0 -#define ISRIMR_DASH_TYPE2_RDU BIT_1 -#define ISRIMR_DASH_TYPE2_TOK BIT_2 -#define ISRIMR_DASH_TYPE2_TDU BIT_3 -#define ISRIMR_DASH_TYPE2_TX_FIFO_FULL BIT_4 -#define ISRIMR_DASH_TYPE2_TX_DISABLE_IDLE BIT_5 -#define ISRIMR_DASH_TYPE2_RX_DISABLE_IDLE BIT_6 - -#define CMAC_OOB_STOP 0x25 -#define CMAC_OOB_INIT 0x26 -#define CMAC_OOB_RESET 0x2a - -#define NO_BASE_ADDRESS 0x00000000 -#define RTL8168FP_OOBMAC_BASE 0xBAF70000 -#define RTL8168FP_CMAC_IOBASE 0xBAF20000 -#define RTL8168FP_KVM_BASE 0xBAF80400 -#define CMAC_SYNC_REG 0x20 -#define CMAC_RXDESC_OFFSET 0x90 //RX: 0x90 - 0x98 -#define CMAC_TXDESC_OFFSET 0x98 //TX: 0x98 - 0x9F - -/* cmac write/read MMIO register */ -#define RTL_CMAC_W8(tp, reg, val8) writeb ((val8), tp->cmac_ioaddr + (reg)) -#define RTL_CMAC_W16(tp, reg, val16) writew ((val16), tp->cmac_ioaddr + (reg)) -#define RTL_CMAC_W32(tp, reg, val32) writel ((val32), tp->cmac_ioaddr + (reg)) -#define RTL_CMAC_R8(tp, reg) readb (tp->cmac_ioaddr + (reg)) -#define RTL_CMAC_R16(tp, reg) readw (tp->cmac_ioaddr + (reg)) -#define RTL_CMAC_R32(tp, reg) ((unsigned long) readl (tp->cmac_ioaddr + (reg))) - -int rtl8125_dash_ioctl(struct net_device *dev, struct ifreq *ifr); -void HandleDashInterrupt(struct net_device *dev); -int AllocateDashShareMemory(struct net_device *dev); -void FreeAllocatedDashShareMemory(struct net_device *dev); -void DashHwInit(struct net_device *dev); - - -#endif /* _LINUX_R8125_DASH_H */ diff --git a/package/kernel/r8125/src/r8125_firmware.c b/package/kernel/r8125/src/r8125_firmware.c deleted file mode 100644 index 61b92d11cf..0000000000 --- a/package/kernel/r8125/src/r8125_firmware.c +++ /dev/null @@ -1,264 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* -################################################################################ -# -# r8168 is the Linux device driver released for Realtek Gigabit Ethernet -# controllers with PCI-Express interface. -# -# Copyright(c) 2022 Realtek Semiconductor Corp. All rights reserved. -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the Free -# Software Foundation; either version 2 of the License, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -# more details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, see . -# -# Author: -# Realtek NIC software team -# No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan -# -################################################################################ -*/ - -/************************************************************************************ - * This product is covered by one or more of the following patents: - * US6,570,884, US6,115,776, and US6,327,625. - ***********************************************************************************/ - -#include -#include -#include - -#include "r8125_firmware.h" - -enum rtl_fw_opcode { - PHY_READ = 0x0, - PHY_DATA_OR = 0x1, - PHY_DATA_AND = 0x2, - PHY_BJMPN = 0x3, - PHY_MDIO_CHG = 0x4, - PHY_CLEAR_READCOUNT = 0x7, - PHY_WRITE = 0x8, - PHY_READCOUNT_EQ_SKIP = 0x9, - PHY_COMP_EQ_SKIPN = 0xa, - PHY_COMP_NEQ_SKIPN = 0xb, - PHY_WRITE_PREVIOUS = 0xc, - PHY_SKIPN = 0xd, - PHY_DELAY_MS = 0xe, -}; - -struct fw_info { - u32 magic; - char version[RTL8125_VER_SIZE]; - __le32 fw_start; - __le32 fw_len; - u8 chksum; -} __packed; - -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,16,0) -#define sizeof_field(TYPE, MEMBER) sizeof((((TYPE *)0)->MEMBER)) -#endif -#define FW_OPCODE_SIZE sizeof_field(struct rtl8125_fw_phy_action, code[0]) - -static bool rtl8125_fw_format_ok(struct rtl8125_fw *rtl_fw) -{ - const struct firmware *fw = rtl_fw->fw; - struct fw_info *fw_info = (struct fw_info *)fw->data; - struct rtl8125_fw_phy_action *pa = &rtl_fw->phy_action; - - if (fw->size < FW_OPCODE_SIZE) - return false; - - if (!fw_info->magic) { - size_t i, size, start; - u8 checksum = 0; - - if (fw->size < sizeof(*fw_info)) - return false; - - for (i = 0; i < fw->size; i++) - checksum += fw->data[i]; - if (checksum != 0) - return false; - - start = le32_to_cpu(fw_info->fw_start); - if (start > fw->size) - return false; - - size = le32_to_cpu(fw_info->fw_len); - if (size > (fw->size - start) / FW_OPCODE_SIZE) - return false; - - strscpy(rtl_fw->version, fw_info->version, RTL8125_VER_SIZE); - - pa->code = (__le32 *)(fw->data + start); - pa->size = size; - } else { - if (fw->size % FW_OPCODE_SIZE) - return false; - - strscpy(rtl_fw->version, rtl_fw->fw_name, RTL8125_VER_SIZE); - - pa->code = (__le32 *)fw->data; - pa->size = fw->size / FW_OPCODE_SIZE; - } - - return true; -} - -static bool rtl8125_fw_data_ok(struct rtl8125_fw *rtl_fw) -{ - struct rtl8125_fw_phy_action *pa = &rtl_fw->phy_action; - size_t index; - - for (index = 0; index < pa->size; index++) { - u32 action = le32_to_cpu(pa->code[index]); - u32 val = action & 0x0000ffff; - u32 regno = (action & 0x0fff0000) >> 16; - - switch (action >> 28) { - case PHY_READ: - case PHY_DATA_OR: - case PHY_DATA_AND: - case PHY_CLEAR_READCOUNT: - case PHY_WRITE: - case PHY_WRITE_PREVIOUS: - case PHY_DELAY_MS: - break; - - case PHY_MDIO_CHG: - if (val > 1) - goto out; - break; - - case PHY_BJMPN: - if (regno > index) - goto out; - break; - case PHY_READCOUNT_EQ_SKIP: - if (index + 2 >= pa->size) - goto out; - break; - case PHY_COMP_EQ_SKIPN: - case PHY_COMP_NEQ_SKIPN: - case PHY_SKIPN: - if (index + 1 + regno >= pa->size) - goto out; - break; - - default: - dev_err(rtl_fw->dev, "Invalid action 0x%08x\n", action); - return false; - } - } - - return true; -out: - dev_err(rtl_fw->dev, "Out of range of firmware\n"); - return false; -} - -void rtl8125_fw_write_firmware(struct rtl8125_private *tp, struct rtl8125_fw *rtl_fw) -{ - struct rtl8125_fw_phy_action *pa = &rtl_fw->phy_action; - rtl8125_fw_write_t fw_write = rtl_fw->phy_write; - rtl8125_fw_read_t fw_read = rtl_fw->phy_read; - int predata = 0, count = 0; - size_t index; - - for (index = 0; index < pa->size; index++) { - u32 action = le32_to_cpu(pa->code[index]); - u32 data = action & 0x0000ffff; - u32 regno = (action & 0x0fff0000) >> 16; - enum rtl_fw_opcode opcode = action >> 28; - - if (!action) - break; - - switch (opcode) { - case PHY_READ: - predata = fw_read(tp, regno); - count++; - break; - case PHY_DATA_OR: - predata |= data; - break; - case PHY_DATA_AND: - predata &= data; - break; - case PHY_BJMPN: - index -= (regno + 1); - break; - case PHY_MDIO_CHG: - if (data) { - fw_write = rtl_fw->mac_mcu_write; - fw_read = rtl_fw->mac_mcu_read; - } else { - fw_write = rtl_fw->phy_write; - fw_read = rtl_fw->phy_read; - } - - break; - case PHY_CLEAR_READCOUNT: - count = 0; - break; - case PHY_WRITE: - fw_write(tp, regno, data); - break; - case PHY_READCOUNT_EQ_SKIP: - if (count == data) - index++; - break; - case PHY_COMP_EQ_SKIPN: - if (predata == data) - index += regno; - break; - case PHY_COMP_NEQ_SKIPN: - if (predata != data) - index += regno; - break; - case PHY_WRITE_PREVIOUS: - fw_write(tp, regno, predata); - break; - case PHY_SKIPN: - index += regno; - break; - case PHY_DELAY_MS: - mdelay(data); - break; - } - } -} - -void rtl8125_fw_release_firmware(struct rtl8125_fw *rtl_fw) -{ - release_firmware(rtl_fw->fw); -} - -int rtl8125_fw_request_firmware(struct rtl8125_fw *rtl_fw) -{ - int rc; - - rc = request_firmware(&rtl_fw->fw, rtl_fw->fw_name, rtl_fw->dev); - if (rc < 0) - goto out; - - if (!rtl8125_fw_format_ok(rtl_fw) || !rtl8125_fw_data_ok(rtl_fw)) { - release_firmware(rtl_fw->fw); - rc = -EINVAL; - goto out; - } - - return 0; -out: - dev_err(rtl_fw->dev, "Unable to load firmware %s (%d)\n", - rtl_fw->fw_name, rc); - return rc; -} diff --git a/package/kernel/r8125/src/r8125_firmware.h b/package/kernel/r8125/src/r8125_firmware.h deleted file mode 100644 index df97bf9b14..0000000000 --- a/package/kernel/r8125/src/r8125_firmware.h +++ /dev/null @@ -1,68 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* -################################################################################ -# -# r8125 is the Linux device driver released for Realtek 2.5Gigabit Ethernet -# controllers with PCI-Express interface. -# -# Copyright(c) 2022 Realtek Semiconductor Corp. All rights reserved. -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the Free -# Software Foundation; either version 2 of the License, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -# more details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, see . -# -# Author: -# Realtek NIC software team -# No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan -# -################################################################################ -*/ - -/************************************************************************************ - * This product is covered by one or more of the following patents: - * US6,570,884, US6,115,776, and US6,327,625. - ***********************************************************************************/ - -#ifndef _LINUX_rtl8125_FIRMWARE_H -#define _LINUX_rtl8125_FIRMWARE_H - -#include -#include - -struct rtl8125_private; -typedef void (*rtl8125_fw_write_t)(struct rtl8125_private *tp, u16 reg, u16 val); -typedef u32 (*rtl8125_fw_read_t)(struct rtl8125_private *tp, u16 reg); - -#define RTL8125_VER_SIZE 32 - -struct rtl8125_fw { - rtl8125_fw_write_t phy_write; - rtl8125_fw_read_t phy_read; - rtl8125_fw_write_t mac_mcu_write; - rtl8125_fw_read_t mac_mcu_read; - const struct firmware *fw; - const char *fw_name; - struct device *dev; - - char version[RTL8125_VER_SIZE]; - - struct rtl8125_fw_phy_action { - __le32 *code; - size_t size; - } phy_action; -}; - -int rtl8125_fw_request_firmware(struct rtl8125_fw *rtl_fw); -void rtl8125_fw_release_firmware(struct rtl8125_fw *rtl_fw); -void rtl8125_fw_write_firmware(struct rtl8125_private *tp, struct rtl8125_fw *rtl_fw); - -#endif /* _LINUX_rtl8125_FIRMWARE_H */ diff --git a/package/kernel/r8125/src/r8125_n.c b/package/kernel/r8125/src/r8125_n.c deleted file mode 100644 index abfaf4773f..0000000000 --- a/package/kernel/r8125/src/r8125_n.c +++ /dev/null @@ -1,15695 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* -################################################################################ -# -# r8125 is the Linux device driver released for Realtek 2.5Gigabit Ethernet -# controllers with PCI-Express interface. -# -# Copyright(c) 2022 Realtek Semiconductor Corp. All rights reserved. -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the Free -# Software Foundation; either version 2 of the License, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -# more details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, see . -# -# Author: -# Realtek NIC software team -# No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan -# -################################################################################ -*/ - -/************************************************************************************ - * This product is covered by one or more of the following patents: - * US6,570,884, US6,115,776, and US6,327,625. - ***********************************************************************************/ - -/* - * This driver is modified from r8169.c in Linux kernel 2.6.18 - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22) -#include -#include -#endif -#include -#include -#include -#include - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26) -#if LINUX_VERSION_CODE < KERNEL_VERSION(5,4,0) -#include -#endif -#endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,37) -#include -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) -#define dev_printk(A,B,fmt,args...) printk(A fmt,##args) -#else -#include -#include -#endif - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31) -#include -#endif - -#include -#include - -#include "r8125.h" -#include "rtl_eeprom.h" -#include "rtltool.h" -#include "r8125_firmware.h" - -#ifdef ENABLE_R8125_PROCFS -#include -#include -#endif - -#define FIRMWARE_8125A_3 "rtl_nic/rtl8125a-3.fw" -#define FIRMWARE_8125B_2 "rtl_nic/rtl8125b-2.fw" - -/* Maximum number of multicast addresses to filter (vs. Rx-all-multicast). - The RTL chips use a 64 element hash table based on the Ethernet CRC. */ -static const int multicast_filter_limit = 32; - -static const struct { - const char *name; - const char *fw_name; -} rtl_chip_fw_infos[] = { - /* PCI-E devices. */ - [CFG_METHOD_2] = {"RTL8125A" }, - [CFG_METHOD_3] = {"RTL8125A", FIRMWARE_8125A_3}, - [CFG_METHOD_4] = {"RTL8125B", }, - [CFG_METHOD_5] = {"RTL8125B", FIRMWARE_8125B_2}, - [CFG_METHOD_6] = {"RTL8168KB", FIRMWARE_8125A_3}, - [CFG_METHOD_7] = {"RTL8168KB", FIRMWARE_8125B_2}, - [CFG_METHOD_DEFAULT] = {"Unknown", }, -}; - -#define _R(NAME,MAC,RCR,MASK,JumFrameSz) \ - { .name = NAME, .mcfg = MAC, .RCR_Cfg = RCR, .RxConfigMask = MASK, .jumbo_frame_sz = JumFrameSz } - -static const struct { - const char *name; - u8 mcfg; - u32 RCR_Cfg; - u32 RxConfigMask; /* Clears the bits supported by this chip */ - u32 jumbo_frame_sz; -} rtl_chip_info[] = { - _R("RTL8125A", - CFG_METHOD_2, - BIT_30 | EnableInnerVlan | EnableOuterVlan | (RX_DMA_BURST << RxCfgDMAShift), - 0xff7e5880, - Jumbo_Frame_9k), - - _R("RTL8125A", - CFG_METHOD_3, - BIT_30 | EnableInnerVlan | EnableOuterVlan | (RX_DMA_BURST << RxCfgDMAShift), - 0xff7e5880, - Jumbo_Frame_9k), - - _R("RTL8125B", - CFG_METHOD_4, - BIT_30 | RxCfg_pause_slot_en | EnableInnerVlan | EnableOuterVlan | (RX_DMA_BURST << RxCfgDMAShift), - 0xff7e5880, - Jumbo_Frame_9k), - - _R("RTL8125B", - CFG_METHOD_5, - BIT_30 | RxCfg_pause_slot_en | EnableInnerVlan | EnableOuterVlan | (RX_DMA_BURST << RxCfgDMAShift), - 0xff7e5880, - Jumbo_Frame_9k), - - _R("RTL8168KB", - CFG_METHOD_6, - BIT_30 | EnableInnerVlan | EnableOuterVlan | (RX_DMA_BURST << RxCfgDMAShift), - 0xff7e5880, - Jumbo_Frame_9k), - - _R("RTL8168KB", - CFG_METHOD_7, - BIT_30 | RxCfg_pause_slot_en | EnableInnerVlan | EnableOuterVlan | (RX_DMA_BURST << RxCfgDMAShift), - 0xff7e5880, - Jumbo_Frame_9k), - - _R("Unknown", - CFG_METHOD_DEFAULT, - (RX_DMA_BURST << RxCfgDMAShift), - 0xff7e5880, - Jumbo_Frame_1k) -}; -#undef _R - - -#ifndef PCI_VENDOR_ID_DLINK -#define PCI_VENDOR_ID_DLINK 0x1186 -#endif - -static struct pci_device_id rtl8125_pci_tbl[] = { - { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8125), }, - { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8162), }, - { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x3000), }, - {0,}, -}; - -MODULE_DEVICE_TABLE(pci, rtl8125_pci_tbl); - -static int rx_copybreak = 0; -static int use_dac = 1; -static int timer_count = 0x2600; -static int timer_count_v2 = (0x2600 / 0x100); - -static struct { - u32 msg_enable; -} debug = { -1 }; - -static unsigned int speed_mode = SPEED_2500; -static unsigned int duplex_mode = DUPLEX_FULL; -static unsigned int autoneg_mode = AUTONEG_ENABLE; -static unsigned int advertising_mode = ADVERTISED_10baseT_Half | - ADVERTISED_10baseT_Full | - ADVERTISED_100baseT_Half | - ADVERTISED_100baseT_Full | - ADVERTISED_1000baseT_Half | - ADVERTISED_1000baseT_Full | - ADVERTISED_2500baseX_Full; -#ifdef CONFIG_ASPM -static int aspm = 1; -#else -static int aspm = 0; -#endif -#ifdef ENABLE_S5WOL -static int s5wol = 1; -#else -static int s5wol = 0; -#endif -#ifdef ENABLE_S5_KEEP_CURR_MAC -static int s5_keep_curr_mac = 1; -#else -static int s5_keep_curr_mac = 0; -#endif -#ifdef ENABLE_EEE -static int eee_enable = 1; -#else -static int eee_enable = 0; -#endif -#ifdef CONFIG_SOC_LAN -static ulong hwoptimize = HW_PATCH_SOC_LAN; -#else -static ulong hwoptimize = 0; -#endif -#ifdef ENABLE_S0_MAGIC_PACKET -static int s0_magic_packet = 1; -#else -static int s0_magic_packet = 0; -#endif -#ifdef ENABLE_TX_NO_CLOSE -static int tx_no_close_enable = 1; -#else -static int tx_no_close_enable = 0; -#endif -#ifdef ENABLE_PTP_MASTER_MODE -static int enable_ptp_master_mode = 1; -#else -static int enable_ptp_master_mode = 0; -#endif -#ifdef DISABLE_PM_SUPPORT -static int disable_pm_support = 1; -#else -static int disable_pm_support = 0; -#endif - -MODULE_AUTHOR("Realtek and the Linux r8125 crew "); -MODULE_DESCRIPTION("Realtek RTL8125 2.5Gigabit Ethernet driver"); - -module_param(speed_mode, uint, 0); -MODULE_PARM_DESC(speed_mode, "force phy operation. Deprecated by ethtool (8)."); - -module_param(duplex_mode, uint, 0); -MODULE_PARM_DESC(duplex_mode, "force phy operation. Deprecated by ethtool (8)."); - -module_param(autoneg_mode, uint, 0); -MODULE_PARM_DESC(autoneg_mode, "force phy operation. Deprecated by ethtool (8)."); - -module_param(advertising_mode, uint, 0); -MODULE_PARM_DESC(advertising_mode, "force phy operation. Deprecated by ethtool (8)."); - -module_param(aspm, int, 0); -MODULE_PARM_DESC(aspm, "Enable ASPM."); - -module_param(s5wol, int, 0); -MODULE_PARM_DESC(s5wol, "Enable Shutdown Wake On Lan."); - -module_param(s5_keep_curr_mac, int, 0); -MODULE_PARM_DESC(s5_keep_curr_mac, "Enable Shutdown Keep Current MAC Address."); - -module_param(rx_copybreak, int, 0); -MODULE_PARM_DESC(rx_copybreak, "Copy breakpoint for copy-only-tiny-frames"); - -module_param(use_dac, int, 0); -MODULE_PARM_DESC(use_dac, "Enable PCI DAC. Unsafe on 32 bit PCI slot."); - -module_param(timer_count, int, 0); -MODULE_PARM_DESC(timer_count, "Timer Interrupt Interval."); - -module_param(eee_enable, int, 0); -MODULE_PARM_DESC(eee_enable, "Enable Energy Efficient Ethernet."); - -module_param(hwoptimize, ulong, 0); -MODULE_PARM_DESC(hwoptimize, "Enable HW optimization function."); - -module_param(s0_magic_packet, int, 0); -MODULE_PARM_DESC(s0_magic_packet, "Enable S0 Magic Packet."); - -module_param(tx_no_close_enable, int, 0); -MODULE_PARM_DESC(tx_no_close_enable, "Enable TX No Close."); - -module_param(enable_ptp_master_mode, int, 0); -MODULE_PARM_DESC(enable_ptp_master_mode, "Enable PTP Master Mode."); - -module_param(disable_pm_support, int, 0); -MODULE_PARM_DESC(disable_pm_support, "Disable PM support."); - -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) -module_param_named(debug, debug.msg_enable, int, 0); -MODULE_PARM_DESC(debug, "Debug verbosity level (0=none, ..., 16=all)"); -#endif//LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - -MODULE_LICENSE("GPL"); -#ifdef ENABLE_USE_FIRMWARE_FILE -MODULE_FIRMWARE(FIRMWARE_8125A_3); -MODULE_FIRMWARE(FIRMWARE_8125B_2); -#endif - -MODULE_VERSION(RTL8125_VERSION); - -/* -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0) -static void rtl8125_esd_timer(unsigned long __opaque); -#else -static void rtl8125_esd_timer(struct timer_list *t); -#endif -*/ -/* -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0) -static void rtl8125_link_timer(unsigned long __opaque); -#else -static void rtl8125_link_timer(struct timer_list *t); -#endif -*/ - -static netdev_tx_t rtl8125_start_xmit(struct sk_buff *skb, struct net_device *dev); -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) -static irqreturn_t rtl8125_interrupt(int irq, void *dev_instance, struct pt_regs *regs); -#else -static irqreturn_t rtl8125_interrupt(int irq, void *dev_instance); -#endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) -static irqreturn_t rtl8125_interrupt_msix(int irq, void *dev_instance, struct pt_regs *regs); -#else -static irqreturn_t rtl8125_interrupt_msix(int irq, void *dev_instance); -#endif -static void rtl8125_set_rx_mode(struct net_device *dev); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0) -static void rtl8125_tx_timeout(struct net_device *dev, unsigned int txqueue); -#else -static void rtl8125_tx_timeout(struct net_device *dev); -#endif -static struct net_device_stats *rtl8125_get_stats(struct net_device *dev); -static int rtl8125_rx_interrupt(struct net_device *, struct rtl8125_private *, struct rtl8125_rx_ring *, napi_budget); -static int rtl8125_tx_interrupt(struct rtl8125_tx_ring *ring, int budget); -static int rtl8125_tx_interrupt_with_vector(struct rtl8125_private *tp, const int message_id, int budget); -static void rtl8125_wait_for_quiescence(struct net_device *dev); -static int rtl8125_change_mtu(struct net_device *dev, int new_mtu); -static void rtl8125_down(struct net_device *dev); - -static int rtl8125_set_mac_address(struct net_device *dev, void *p); -static void rtl8125_rar_set(struct rtl8125_private *tp, uint8_t *addr); -static void rtl8125_desc_addr_fill(struct rtl8125_private *); -static void rtl8125_tx_desc_init(struct rtl8125_private *tp); -static void rtl8125_rx_desc_init(struct rtl8125_private *tp); - -static u32 mdio_direct_read_phy_ocp(struct rtl8125_private *tp, u16 RegAddr); -static u16 rtl8125_get_hw_phy_mcu_code_ver(struct rtl8125_private *tp); -static void rtl8125_phy_power_up(struct net_device *dev); -static void rtl8125_phy_power_down(struct net_device *dev); -static int rtl8125_set_speed(struct net_device *dev, u8 autoneg, u32 speed, u8 duplex, u32 adv); -static bool rtl8125_set_phy_mcu_patch_request(struct rtl8125_private *tp); -static bool rtl8125_clear_phy_mcu_patch_request(struct rtl8125_private *tp); - -#ifdef CONFIG_R8125_NAPI -static int rtl8125_poll(napi_ptr napi, napi_budget budget); -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -static void rtl8125_reset_task(void *_data); -static void rtl8125_esd_task(void *_data); -static void rtl8125_linkchg_task(void *_data); -#else -static void rtl8125_reset_task(struct work_struct *work); -static void rtl8125_esd_task(struct work_struct *work); -static void rtl8125_linkchg_task(struct work_struct *work); -#endif -static void rtl8125_schedule_reset_work(struct rtl8125_private *tp); -static void rtl8125_schedule_esd_work(struct rtl8125_private *tp); -static void rtl8125_schedule_linkchg_work(struct rtl8125_private *tp); -static void rtl8125_init_all_schedule_work(struct rtl8125_private *tp); -static void rtl8125_cancel_all_schedule_work(struct rtl8125_private *tp); - -static inline struct device *tp_to_dev(struct rtl8125_private *tp) -{ - return &tp->pci_dev->dev; -} - -#if ((LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) && \ - LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,00))) -void ethtool_convert_legacy_u32_to_link_mode(unsigned long *dst, - u32 legacy_u32) -{ - bitmap_zero(dst, __ETHTOOL_LINK_MODE_MASK_NBITS); - dst[0] = legacy_u32; -} - -bool ethtool_convert_link_mode_to_legacy_u32(u32 *legacy_u32, - const unsigned long *src) -{ - bool retval = true; - - /* TODO: following test will soon always be true */ - if (__ETHTOOL_LINK_MODE_MASK_NBITS > 32) { - __ETHTOOL_DECLARE_LINK_MODE_MASK(ext); - - bitmap_zero(ext, __ETHTOOL_LINK_MODE_MASK_NBITS); - bitmap_fill(ext, 32); - bitmap_complement(ext, ext, __ETHTOOL_LINK_MODE_MASK_NBITS); - if (bitmap_intersects(ext, src, - __ETHTOOL_LINK_MODE_MASK_NBITS)) { - /* src mask goes beyond bit 31 */ - retval = false; - } - } - *legacy_u32 = src[0]; - return retval; -} -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0) - -#ifndef LPA_1000FULL -#define LPA_1000FULL 0x0800 -#endif - -#ifndef LPA_1000HALF -#define LPA_1000HALF 0x0400 -#endif - -#endif //LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0) - -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0) -static inline void eth_hw_addr_random(struct net_device *dev) -{ - random_ether_addr(dev->dev_addr); -} -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) -#undef ethtool_ops -#define ethtool_ops _kc_ethtool_ops - -struct _kc_ethtool_ops { - int (*get_settings)(struct net_device *, struct ethtool_cmd *); - int (*set_settings)(struct net_device *, struct ethtool_cmd *); - void (*get_drvinfo)(struct net_device *, struct ethtool_drvinfo *); - int (*get_regs_len)(struct net_device *); - void (*get_regs)(struct net_device *, struct ethtool_regs *, void *); - void (*get_wol)(struct net_device *, struct ethtool_wolinfo *); - int (*set_wol)(struct net_device *, struct ethtool_wolinfo *); - u32 (*get_msglevel)(struct net_device *); - void (*set_msglevel)(struct net_device *, u32); - int (*nway_reset)(struct net_device *); - u32 (*get_link)(struct net_device *); - int (*get_eeprom_len)(struct net_device *); - int (*get_eeprom)(struct net_device *, struct ethtool_eeprom *, u8 *); - int (*set_eeprom)(struct net_device *, struct ethtool_eeprom *, u8 *); - int (*get_coalesce)(struct net_device *, struct ethtool_coalesce *); - int (*set_coalesce)(struct net_device *, struct ethtool_coalesce *); - void (*get_ringparam)(struct net_device *, struct ethtool_ringparam *); - int (*set_ringparam)(struct net_device *, struct ethtool_ringparam *); - void (*get_pauseparam)(struct net_device *, - struct ethtool_pauseparam*); - int (*set_pauseparam)(struct net_device *, - struct ethtool_pauseparam*); - u32 (*get_rx_csum)(struct net_device *); - int (*set_rx_csum)(struct net_device *, u32); - u32 (*get_tx_csum)(struct net_device *); - int (*set_tx_csum)(struct net_device *, u32); - u32 (*get_sg)(struct net_device *); - int (*set_sg)(struct net_device *, u32); - u32 (*get_tso)(struct net_device *); - int (*set_tso)(struct net_device *, u32); - int (*self_test_count)(struct net_device *); - void (*self_test)(struct net_device *, struct ethtool_test *, u64 *); - void (*get_strings)(struct net_device *, u32 stringset, u8 *); - int (*phys_id)(struct net_device *, u32); - int (*get_stats_count)(struct net_device *); - void (*get_ethtool_stats)(struct net_device *, struct ethtool_stats *, - u64 *); -} *ethtool_ops = NULL; - -#undef SET_ETHTOOL_OPS -#define SET_ETHTOOL_OPS(netdev, ops) (ethtool_ops = (ops)) - -#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0) -#ifndef SET_ETHTOOL_OPS -#define SET_ETHTOOL_OPS(netdev,ops) \ - ( (netdev)->ethtool_ops = (ops) ) -#endif //SET_ETHTOOL_OPS -#endif //LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0) - -//#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,5) -#ifndef netif_msg_init -#define netif_msg_init _kc_netif_msg_init -/* copied from linux kernel 2.6.20 include/linux/netdevice.h */ -static inline u32 netif_msg_init(int debug_value, int default_msg_enable_bits) -{ - /* use default */ - if (debug_value < 0 || debug_value >= (sizeof(u32) * 8)) - return default_msg_enable_bits; - if (debug_value == 0) /* no output */ - return 0; - /* set low N bits */ - return (1 << debug_value) - 1; -} - -#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,5) - -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,22) -static inline void eth_copy_and_sum (struct sk_buff *dest, - const unsigned char *src, - int len, int base) -{ - memcpy (dest->data, src, len); -} -#endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,6,22) - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7) -/* copied from linux kernel 2.6.20 /include/linux/time.h */ -/* Parameters used to convert the timespec values: */ -#define MSEC_PER_SEC 1000L - -/* copied from linux kernel 2.6.20 /include/linux/jiffies.h */ -/* - * Change timeval to jiffies, trying to avoid the - * most obvious overflows.. - * - * And some not so obvious. - * - * Note that we don't want to return MAX_LONG, because - * for various timeout reasons we often end up having - * to wait "jiffies+1" in order to guarantee that we wait - * at _least_ "jiffies" - so "jiffies+1" had better still - * be positive. - */ -#define MAX_JIFFY_OFFSET ((~0UL >> 1)-1) - -/* - * Convert jiffies to milliseconds and back. - * - * Avoid unnecessary multiplications/divisions in the - * two most common HZ cases: - */ -static inline unsigned int _kc_jiffies_to_msecs(const unsigned long j) -{ -#if HZ <= MSEC_PER_SEC && !(MSEC_PER_SEC % HZ) - return (MSEC_PER_SEC / HZ) * j; -#elif HZ > MSEC_PER_SEC && !(HZ % MSEC_PER_SEC) - return (j + (HZ / MSEC_PER_SEC) - 1)/(HZ / MSEC_PER_SEC); -#else - return (j * MSEC_PER_SEC) / HZ; -#endif -} - -static inline unsigned long _kc_msecs_to_jiffies(const unsigned int m) -{ - if (m > _kc_jiffies_to_msecs(MAX_JIFFY_OFFSET)) - return MAX_JIFFY_OFFSET; -#if HZ <= MSEC_PER_SEC && !(MSEC_PER_SEC % HZ) - return (m + (MSEC_PER_SEC / HZ) - 1) / (MSEC_PER_SEC / HZ); -#elif HZ > MSEC_PER_SEC && !(HZ % MSEC_PER_SEC) - return m * (HZ / MSEC_PER_SEC); -#else - return (m * HZ + MSEC_PER_SEC - 1) / MSEC_PER_SEC; -#endif -} -#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7) - - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11) - -/* copied from linux kernel 2.6.12.6 /include/linux/pm.h */ -typedef int __bitwise pci_power_t; - -/* copied from linux kernel 2.6.12.6 /include/linux/pci.h */ -typedef u32 __bitwise pm_message_t; - -#define PCI_D0 ((pci_power_t __force) 0) -#define PCI_D1 ((pci_power_t __force) 1) -#define PCI_D2 ((pci_power_t __force) 2) -#define PCI_D3hot ((pci_power_t __force) 3) -#define PCI_D3cold ((pci_power_t __force) 4) -#define PCI_POWER_ERROR ((pci_power_t __force) -1) - -/* copied from linux kernel 2.6.12.6 /drivers/pci/pci.c */ -/** - * pci_choose_state - Choose the power state of a PCI device - * @dev: PCI device to be suspended - * @state: target sleep state for the whole system. This is the value - * that is passed to suspend() function. - * - * Returns PCI power state suitable for given device and given system - * message. - */ - -pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state) -{ - if (!pci_find_capability(dev, PCI_CAP_ID_PM)) - return PCI_D0; - - switch (state) { - case 0: - return PCI_D0; - case 3: - return PCI_D3hot; - default: - printk("They asked me for state %d\n", state); -// BUG(); - } - return PCI_D0; -} -#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11) - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9) -/** - * msleep_interruptible - sleep waiting for waitqueue interruptions - * @msecs: Time in milliseconds to sleep for - */ -#define msleep_interruptible _kc_msleep_interruptible -unsigned long _kc_msleep_interruptible(unsigned int msecs) -{ - unsigned long timeout = _kc_msecs_to_jiffies(msecs); - - while (timeout && !signal_pending(current)) { - set_current_state(TASK_INTERRUPTIBLE); - timeout = schedule_timeout(timeout); - } - return _kc_jiffies_to_msecs(timeout); -} -#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9) - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7) -/* copied from linux kernel 2.6.20 include/linux/sched.h */ -#ifndef __sched -#define __sched __attribute__((__section__(".sched.text"))) -#endif - -/* copied from linux kernel 2.6.20 kernel/timer.c */ -signed long __sched schedule_timeout_uninterruptible(signed long timeout) -{ - __set_current_state(TASK_UNINTERRUPTIBLE); - return schedule_timeout(timeout); -} - -/* copied from linux kernel 2.6.20 include/linux/mii.h */ -#undef if_mii -#define if_mii _kc_if_mii -static inline struct mii_ioctl_data *if_mii(struct ifreq *rq) -{ - return (struct mii_ioctl_data *) &rq->ifr_ifru; -} -#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7) - -static u32 rtl8125_read_thermal_sensor(struct rtl8125_private *tp) -{ - u16 ts_digout; - - switch (tp->mcfg) { - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_7: - ts_digout = mdio_direct_read_phy_ocp(tp, 0xBD84); - ts_digout &= 0x3ff; - break; - default: - ts_digout = 0xffff; - break; - } - - return ts_digout; -} - -int rtl8125_dump_tally_counter(struct rtl8125_private *tp, dma_addr_t paddr) -{ - u32 cmd; - u32 WaitCnt; - int retval = -1; - - RTL_W32(tp, CounterAddrHigh, (u64)paddr >> 32); - cmd = (u64)paddr & DMA_BIT_MASK(32); - RTL_W32(tp, CounterAddrLow, cmd); - RTL_W32(tp, CounterAddrLow, cmd | CounterDump); - - WaitCnt = 0; - while (RTL_R32(tp, CounterAddrLow) & CounterDump) { - udelay(10); - - WaitCnt++; - if (WaitCnt > 20) - break; - } - - if (WaitCnt <= 20) - retval = 0; - - return retval; -} - -#ifdef ENABLE_R8125_PROCFS -/**************************************************************************** -* -----------------------------PROCFS STUFF------------------------- -***************************************************************************** -*/ - -static struct proc_dir_entry *rtl8125_proc; -static int proc_init_num = 0; - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) -static int proc_get_driver_variable(struct seq_file *m, void *v) -{ - struct net_device *dev = m->private; - struct rtl8125_private *tp = netdev_priv(dev); - - seq_puts(m, "\nDump Driver Variable\n"); - - rtnl_lock(); - - seq_puts(m, "Variable\tValue\n----------\t-----\n"); - seq_printf(m, "MODULENAME\t%s\n", MODULENAME); - seq_printf(m, "driver version\t%s\n", RTL8125_VERSION); - seq_printf(m, "mcfg\t%d\n", tp->mcfg); - seq_printf(m, "chipset\t%d\n", tp->chipset); - seq_printf(m, "chipset_name\t%s\n", rtl_chip_info[tp->chipset].name); - seq_printf(m, "mtu\t%d\n", dev->mtu); - seq_printf(m, "NUM_RX_DESC\t0x%x\n", tp->rx_ring[0].num_rx_desc); - seq_printf(m, "cur_rx0\t0x%x\n", tp->rx_ring[0].cur_rx); - seq_printf(m, "dirty_rx0\t0x%x\n", tp->rx_ring[0].dirty_rx); - seq_printf(m, "cur_rx1\t0x%x\n", tp->rx_ring[1].cur_rx); - seq_printf(m, "dirty_rx1\t0x%x\n", tp->rx_ring[1].dirty_rx); - seq_printf(m, "cur_rx2\t0x%x\n", tp->rx_ring[2].cur_rx); - seq_printf(m, "dirty_rx2\t0x%x\n", tp->rx_ring[2].dirty_rx); - seq_printf(m, "cur_rx3\t0x%x\n", tp->rx_ring[3].cur_rx); - seq_printf(m, "dirty_rx3\t0x%x\n", tp->rx_ring[3].dirty_rx); - seq_printf(m, "NUM_TX_DESC\t0x%x\n", tp->tx_ring[0].num_tx_desc); - seq_printf(m, "cur_tx0\t0x%x\n", tp->tx_ring[0].cur_tx); - seq_printf(m, "dirty_tx0\t0x%x\n", tp->tx_ring[0].dirty_tx); - seq_printf(m, "cur_tx1\t0x%x\n", tp->tx_ring[1].cur_tx); - seq_printf(m, "dirty_tx1\t0x%x\n", tp->tx_ring[1].dirty_tx); - seq_printf(m, "rx_buf_sz\t0x%x\n", tp->rx_buf_sz); - seq_printf(m, "esd_flag\t0x%x\n", tp->esd_flag); - seq_printf(m, "pci_cfg_is_read\t0x%x\n", tp->pci_cfg_is_read); - seq_printf(m, "rtl8125_rx_config\t0x%x\n", tp->rtl8125_rx_config); - seq_printf(m, "cp_cmd\t0x%x\n", tp->cp_cmd); - seq_printf(m, "intr_mask\t0x%x\n", tp->intr_mask); - seq_printf(m, "timer_intr_mask\t0x%x\n", tp->timer_intr_mask); - seq_printf(m, "wol_enabled\t0x%x\n", tp->wol_enabled); - seq_printf(m, "wol_opts\t0x%x\n", tp->wol_opts); - seq_printf(m, "efuse_ver\t0x%x\n", tp->efuse_ver); - seq_printf(m, "eeprom_type\t0x%x\n", tp->eeprom_type); - seq_printf(m, "autoneg\t0x%x\n", tp->autoneg); - seq_printf(m, "duplex\t0x%x\n", tp->duplex); - seq_printf(m, "speed\t%d\n", tp->speed); - seq_printf(m, "advertising\t0x%x\n", tp->advertising); - seq_printf(m, "eeprom_len\t0x%x\n", tp->eeprom_len); - seq_printf(m, "cur_page\t0x%x\n", tp->cur_page); - seq_printf(m, "bios_setting\t0x%x\n", tp->bios_setting); - seq_printf(m, "features\t0x%x\n", tp->features); - seq_printf(m, "org_pci_offset_99\t0x%x\n", tp->org_pci_offset_99); - seq_printf(m, "org_pci_offset_180\t0x%x\n", tp->org_pci_offset_180); - seq_printf(m, "issue_offset_99_event\t0x%x\n", tp->issue_offset_99_event); - seq_printf(m, "org_pci_offset_80\t0x%x\n", tp->org_pci_offset_80); - seq_printf(m, "org_pci_offset_81\t0x%x\n", tp->org_pci_offset_81); - seq_printf(m, "use_timer_interrrupt\t0x%x\n", tp->use_timer_interrrupt); - seq_printf(m, "HwIcVerUnknown\t0x%x\n", tp->HwIcVerUnknown); - seq_printf(m, "NotWrRamCodeToMicroP\t0x%x\n", tp->NotWrRamCodeToMicroP); - seq_printf(m, "NotWrMcuPatchCode\t0x%x\n", tp->NotWrMcuPatchCode); - seq_printf(m, "HwHasWrRamCodeToMicroP\t0x%x\n", tp->HwHasWrRamCodeToMicroP); - seq_printf(m, "sw_ram_code_ver\t0x%x\n", tp->sw_ram_code_ver); - seq_printf(m, "hw_ram_code_ver\t0x%x\n", tp->hw_ram_code_ver); - seq_printf(m, "rtk_enable_diag\t0x%x\n", tp->rtk_enable_diag); - seq_printf(m, "ShortPacketSwChecksum\t0x%x\n", tp->ShortPacketSwChecksum); - seq_printf(m, "UseSwPaddingShortPkt\t0x%x\n", tp->UseSwPaddingShortPkt); - seq_printf(m, "RequireRduNonStopPatch\t0x%x\n", tp->RequireRduNonStopPatch); - seq_printf(m, "RequireAdcBiasPatch\t0x%x\n", tp->RequireAdcBiasPatch); - seq_printf(m, "AdcBiasPatchIoffset\t0x%x\n", tp->AdcBiasPatchIoffset); - seq_printf(m, "RequireAdjustUpsTxLinkPulseTiming\t0x%x\n", tp->RequireAdjustUpsTxLinkPulseTiming); - seq_printf(m, "SwrCnt1msIni\t0x%x\n", tp->SwrCnt1msIni); - seq_printf(m, "HwSuppNowIsOobVer\t0x%x\n", tp->HwSuppNowIsOobVer); - seq_printf(m, "HwFiberModeVer\t0x%x\n", tp->HwFiberModeVer); - seq_printf(m, "HwFiberStat\t0x%x\n", tp->HwFiberStat); - seq_printf(m, "HwSwitchMdiToFiber\t0x%x\n", tp->HwSwitchMdiToFiber); - seq_printf(m, "NicCustLedValue\t0x%x\n", tp->NicCustLedValue); - seq_printf(m, "RequiredSecLanDonglePatch\t0x%x\n", tp->RequiredSecLanDonglePatch); - seq_printf(m, "HwSuppDashVer\t0x%x\n", tp->HwSuppDashVer); - seq_printf(m, "DASH\t0x%x\n", tp->DASH); - seq_printf(m, "dash_printer_enabled\t0x%x\n", tp->dash_printer_enabled); - seq_printf(m, "HwSuppKCPOffloadVer\t0x%x\n", tp->HwSuppKCPOffloadVer); - seq_printf(m, "speed_mode\t0x%x\n", speed_mode); - seq_printf(m, "duplex_mode\t0x%x\n", duplex_mode); - seq_printf(m, "autoneg_mode\t0x%x\n", autoneg_mode); - seq_printf(m, "advertising_mode\t0x%x\n", advertising_mode); - seq_printf(m, "aspm\t0x%x\n", aspm); - seq_printf(m, "s5wol\t0x%x\n", s5wol); - seq_printf(m, "s5_keep_curr_mac\t0x%x\n", s5_keep_curr_mac); - seq_printf(m, "eee_enable\t0x%x\n", tp->eee.eee_enabled); - seq_printf(m, "hwoptimize\t0x%lx\n", hwoptimize); - seq_printf(m, "proc_init_num\t0x%x\n", proc_init_num); - seq_printf(m, "s0_magic_packet\t0x%x\n", s0_magic_packet); - seq_printf(m, "HwSuppMagicPktVer\t0x%x\n", tp->HwSuppMagicPktVer); - seq_printf(m, "HwSuppLinkChgWakeUpVer\t0x%x\n", tp->HwSuppLinkChgWakeUpVer); - seq_printf(m, "HwSuppD0SpeedUpVer\t0x%x\n", tp->HwSuppD0SpeedUpVer); - seq_printf(m, "D0SpeedUpSpeed\t0x%x\n", tp->D0SpeedUpSpeed); - seq_printf(m, "HwSuppCheckPhyDisableModeVer\t0x%x\n", tp->HwSuppCheckPhyDisableModeVer); - seq_printf(m, "HwPkgDet\t0x%x\n", tp->HwPkgDet); - seq_printf(m, "HwSuppTxNoCloseVer\t0x%x\n", tp->HwSuppTxNoCloseVer); - seq_printf(m, "EnableTxNoClose\t0x%x\n", tp->EnableTxNoClose); - seq_printf(m, "NextHwDesCloPtr0\t0x%x\n", tp->tx_ring[0].NextHwDesCloPtr); - seq_printf(m, "BeginHwDesCloPtr0\t0x%x\n", tp->tx_ring[0].BeginHwDesCloPtr); - seq_printf(m, "NextHwDesCloPtr1\t0x%x\n", tp->tx_ring[1].NextHwDesCloPtr); - seq_printf(m, "BeginHwDesCloPtr1\t0x%x\n", tp->tx_ring[1].BeginHwDesCloPtr); - seq_printf(m, "InitRxDescType\t0x%x\n", tp->InitRxDescType); - seq_printf(m, "RxDescLength\t0x%x\n", tp->RxDescLength); - seq_printf(m, "num_rx_rings\t0x%x\n", tp->num_rx_rings); - seq_printf(m, "num_tx_rings\t0x%x\n", tp->num_tx_rings); - seq_printf(m, "tot_rx_rings\t0x%x\n", rtl8125_tot_rx_rings(tp)); - seq_printf(m, "tot_tx_rings\t0x%x\n", rtl8125_tot_tx_rings(tp)); - seq_printf(m, "EnableRss\t0x%x\n", tp->EnableRss); - seq_printf(m, "EnablePtp\t0x%x\n", tp->EnablePtp); - seq_printf(m, "ptp_master_mode\t0x%x\n", tp->ptp_master_mode); - seq_printf(m, "min_irq_nvecs\t0x%x\n", tp->min_irq_nvecs); - seq_printf(m, "irq_nvecs\t0x%x\n", tp->irq_nvecs); - seq_printf(m, "ring_lib_enabled\t0x%x\n", tp->ring_lib_enabled); - seq_printf(m, "HwSuppIsrVer\t0x%x\n", tp->HwSuppIsrVer); - seq_printf(m, "HwCurrIsrVer\t0x%x\n", tp->HwCurrIsrVer); -#ifdef ENABLE_PTP_SUPPORT - seq_printf(m, "tx_hwtstamp_timeouts\t0x%x\n", tp->tx_hwtstamp_timeouts); - seq_printf(m, "tx_hwtstamp_skipped\t0x%x\n", tp->tx_hwtstamp_skipped); -#endif - seq_printf(m, "random_mac\t0x%x\n", tp->random_mac); - seq_printf(m, "org_mac_addr\t%pM\n", tp->org_mac_addr); -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13) - seq_printf(m, "perm_addr\t%pM\n", dev->perm_addr); -#endif - seq_printf(m, "dev_addr\t%pM\n", dev->dev_addr); - - rtnl_unlock(); - - seq_putc(m, '\n'); - return 0; -} - -static int proc_get_tally_counter(struct seq_file *m, void *v) -{ - struct net_device *dev = m->private; - struct rtl8125_private *tp = netdev_priv(dev); - struct rtl8125_counters *counters; - dma_addr_t paddr; - - seq_puts(m, "\nDump Tally Counter\n"); - - rtnl_lock(); - - counters = tp->tally_vaddr; - paddr = tp->tally_paddr; - if (!counters) { - seq_puts(m, "\nDump Tally Counter Fail\n"); - goto out_unlock; - } - - rtl8125_dump_tally_counter(tp, paddr); - - seq_puts(m, "Statistics\tValue\n----------\t-----\n"); - seq_printf(m, "tx_packets\t%lld\n", le64_to_cpu(counters->tx_packets)); - seq_printf(m, "rx_packets\t%lld\n", le64_to_cpu(counters->rx_packets)); - seq_printf(m, "tx_errors\t%lld\n", le64_to_cpu(counters->tx_errors)); - seq_printf(m, "rx_errors\t%d\n", le32_to_cpu(counters->rx_errors)); - seq_printf(m, "rx_missed\t%d\n", le16_to_cpu(counters->rx_missed)); - seq_printf(m, "align_errors\t%d\n", le16_to_cpu(counters->align_errors)); - seq_printf(m, "tx_one_collision\t%d\n", le32_to_cpu(counters->tx_one_collision)); - seq_printf(m, "tx_multi_collision\t%d\n", le32_to_cpu(counters->tx_multi_collision)); - seq_printf(m, "rx_unicast\t%lld\n", le64_to_cpu(counters->rx_unicast)); - seq_printf(m, "rx_broadcast\t%lld\n", le64_to_cpu(counters->rx_broadcast)); - seq_printf(m, "rx_multicast\t%d\n", le32_to_cpu(counters->rx_multicast)); - seq_printf(m, "tx_aborted\t%d\n", le16_to_cpu(counters->tx_aborted)); - seq_printf(m, "tx_underrun\t%d\n", le16_to_cpu(counters->tx_underrun)); - - seq_printf(m, "tx_octets\t%lld\n", le64_to_cpu(counters->tx_octets)); - seq_printf(m, "rx_octets\t%lld\n", le64_to_cpu(counters->rx_octets)); - seq_printf(m, "rx_multicast64\t%lld\n", le64_to_cpu(counters->rx_multicast64)); - seq_printf(m, "tx_unicast64\t%lld\n", le64_to_cpu(counters->tx_unicast64)); - seq_printf(m, "tx_broadcast64\t%lld\n", le64_to_cpu(counters->tx_broadcast64)); - seq_printf(m, "tx_multicast64\t%lld\n", le64_to_cpu(counters->tx_multicast64)); - seq_printf(m, "tx_pause_on\t%d\n", le32_to_cpu(counters->tx_pause_on)); - seq_printf(m, "tx_pause_off\t%d\n", le32_to_cpu(counters->tx_pause_off)); - seq_printf(m, "tx_pause_all\t%d\n", le32_to_cpu(counters->tx_pause_all)); - seq_printf(m, "tx_deferred\t%d\n", le32_to_cpu(counters->tx_deferred)); - seq_printf(m, "tx_late_collision\t%d\n", le32_to_cpu(counters->tx_late_collision)); - seq_printf(m, "tx_all_collision\t%d\n", le32_to_cpu(counters->tx_all_collision)); - seq_printf(m, "tx_aborted32\t%d\n", le32_to_cpu(counters->tx_aborted32)); - seq_printf(m, "align_errors32\t%d\n", le32_to_cpu(counters->align_errors32)); - seq_printf(m, "rx_frame_too_long\t%d\n", le32_to_cpu(counters->rx_frame_too_long)); - seq_printf(m, "rx_runt\t%d\n", le32_to_cpu(counters->rx_runt)); - seq_printf(m, "rx_pause_on\t%d\n", le32_to_cpu(counters->rx_pause_on)); - seq_printf(m, "rx_pause_off\t%d\n", le32_to_cpu(counters->rx_pause_off)); - seq_printf(m, "rx_pause_all\t%d\n", le32_to_cpu(counters->rx_pause_all)); - seq_printf(m, "rx_unknown_opcode\t%d\n", le32_to_cpu(counters->rx_unknown_opcode)); - seq_printf(m, "rx_mac_error\t%d\n", le32_to_cpu(counters->rx_mac_error)); - seq_printf(m, "tx_underrun32\t%d\n", le32_to_cpu(counters->tx_underrun32)); - seq_printf(m, "rx_mac_missed\t%d\n", le32_to_cpu(counters->rx_mac_missed)); - seq_printf(m, "rx_tcam_dropped\t%d\n", le32_to_cpu(counters->rx_tcam_dropped)); - seq_printf(m, "tdu\t%d\n", le32_to_cpu(counters->tdu)); - seq_printf(m, "rdu\t%d\n", le32_to_cpu(counters->rdu)); - - seq_putc(m, '\n'); - -out_unlock: - rtnl_unlock(); - - return 0; -} - -static int proc_get_registers(struct seq_file *m, void *v) -{ - struct net_device *dev = m->private; - int i, n, max = R8125_MAC_REGS_SIZE; - u8 byte_rd; - struct rtl8125_private *tp = netdev_priv(dev); - void __iomem *ioaddr = tp->mmio_addr; - - seq_puts(m, "\nDump MAC Registers\n"); - seq_puts(m, "Offset\tValue\n------\t-----\n"); - - rtnl_lock(); - - for (n = 0; n < max;) { - seq_printf(m, "\n0x%02x:\t", n); - - for (i = 0; i < 16 && n < max; i++, n++) { - byte_rd = readb(ioaddr + n); - seq_printf(m, "%02x ", byte_rd); - } - } - - rtnl_unlock(); - - seq_putc(m, '\n'); - return 0; -} - -static int proc_get_pcie_phy(struct seq_file *m, void *v) -{ - struct net_device *dev = m->private; - int i, n, max = R8125_EPHY_REGS_SIZE/2; - u16 word_rd; - struct rtl8125_private *tp = netdev_priv(dev); - - seq_puts(m, "\nDump PCIE PHY\n"); - seq_puts(m, "\nOffset\tValue\n------\t-----\n "); - - rtnl_lock(); - - for (n = 0; n < max;) { - seq_printf(m, "\n0x%02x:\t", n); - - for (i = 0; i < 8 && n < max; i++, n++) { - word_rd = rtl8125_ephy_read(tp, n); - seq_printf(m, "%04x ", word_rd); - } - } - - rtnl_unlock(); - - seq_putc(m, '\n'); - return 0; -} - -static int proc_get_eth_phy(struct seq_file *m, void *v) -{ - struct net_device *dev = m->private; - int i, n, max = R8125_PHY_REGS_SIZE/2; - u16 word_rd; - struct rtl8125_private *tp = netdev_priv(dev); - - seq_puts(m, "\nDump Ethernet PHY\n"); - seq_puts(m, "\nOffset\tValue\n------\t-----\n "); - - rtnl_lock(); - - seq_puts(m, "\n####################page 0##################\n "); - rtl8125_mdio_write(tp, 0x1f, 0x0000); - for (n = 0; n < max;) { - seq_printf(m, "\n0x%02x:\t", n); - - for (i = 0; i < 8 && n < max; i++, n++) { - word_rd = rtl8125_mdio_read(tp, n); - seq_printf(m, "%04x ", word_rd); - } - } - - rtnl_unlock(); - - seq_putc(m, '\n'); - return 0; -} - -static int proc_get_extended_registers(struct seq_file *m, void *v) -{ - struct net_device *dev = m->private; - int i, n, max = R8125_ERI_REGS_SIZE; - u32 dword_rd; - struct rtl8125_private *tp = netdev_priv(dev); - - seq_puts(m, "\nDump Extended Registers\n"); - seq_puts(m, "\nOffset\tValue\n------\t-----\n "); - - rtnl_lock(); - - for (n = 0; n < max;) { - seq_printf(m, "\n0x%02x:\t", n); - - for (i = 0; i < 4 && n < max; i++, n+=4) { - dword_rd = rtl8125_eri_read(tp, n, 4, ERIAR_ExGMAC); - seq_printf(m, "%08x ", dword_rd); - } - } - - rtnl_unlock(); - - seq_putc(m, '\n'); - return 0; -} - -static int proc_get_pci_registers(struct seq_file *m, void *v) -{ - struct net_device *dev = m->private; - int i, n, max = R8125_PCI_REGS_SIZE; - u32 dword_rd; - struct rtl8125_private *tp = netdev_priv(dev); - - seq_puts(m, "\nDump PCI Registers\n"); - seq_puts(m, "\nOffset\tValue\n------\t-----\n "); - - rtnl_lock(); - - for (n = 0; n < max;) { - seq_printf(m, "\n0x%03x:\t", n); - - for (i = 0; i < 4 && n < max; i++, n+=4) { - pci_read_config_dword(tp->pci_dev, n, &dword_rd); - seq_printf(m, "%08x ", dword_rd); - } - } - - n = 0x110; - pci_read_config_dword(tp->pci_dev, n, &dword_rd); - seq_printf(m, "\n0x%03x:\t%08x ", n, dword_rd); - n = 0x70c; - pci_read_config_dword(tp->pci_dev, n, &dword_rd); - seq_printf(m, "\n0x%03x:\t%08x ", n, dword_rd); - - rtnl_unlock(); - - seq_putc(m, '\n'); - return 0; -} - -static int proc_get_temperature(struct seq_file *m, void *v) -{ - struct net_device *dev = m->private; - struct rtl8125_private *tp = netdev_priv(dev); - u16 ts_digout, tj, fah; - - switch (tp->mcfg) { - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_7: - seq_puts(m, "\nChip Temperature\n"); - break; - default: - seq_puts(m, "\nThis Chip Does Not Support Dump Temperature\n"); - break; - } - - rtnl_lock(); - ts_digout = rtl8125_read_thermal_sensor(tp); - rtnl_unlock(); - - tj = ts_digout / 2; - if (ts_digout <= 512) { - tj = ts_digout / 2; - seq_printf(m, "Cel:%d\n", tj); - fah = tj * (9/5) + 32; - seq_printf(m, "Fah:%d\n", fah); - } else { - tj = (512 - ((ts_digout / 2) - 512)) / 2; - seq_printf(m, "Cel:-%d\n", tj); - fah = tj * (9/5) + 32; - seq_printf(m, "Fah:-%d\n", fah); - } - - seq_putc(m, '\n'); - return 0; -} -#else - -static int proc_get_driver_variable(char *page, char **start, - off_t offset, int count, - int *eof, void *data) -{ - struct net_device *dev = data; - struct rtl8125_private *tp = netdev_priv(dev); - int len = 0; - - len += snprintf(page + len, count - len, - "\nDump Driver Driver\n"); - - rtnl_lock(); - - len += snprintf(page + len, count - len, - "Variable\tValue\n----------\t-----\n"); - - len += snprintf(page + len, count - len, - "MODULENAME\t%s\n" - "driver version\t%s\n" - "mcfg\t%d\n" - "chipset\t%d\n" - "chipset_name\t%s\n" - "mtu\t%d\n" - "NUM_RX_DESC\t0x%x\n" - "cur_rx0\t0x%x\n" - "dirty_rx0\t0x%x\n" - "cur_rx1\t0x%x\n" - "dirty_rx1\t0x%x\n" - "cur_rx2\t0x%x\n" - "dirty_rx2\t0x%x\n" - "cur_rx3\t0x%x\n" - "dirty_rx3\t0x%x\n" - "NUM_TX_DESC\t0x%x\n" - "cur_tx0\t0x%x\n" - "dirty_tx0\t0x%x\n" - "cur_tx1\t0x%x\n" - "dirty_tx1\t0x%x\n" - "rx_buf_sz\t0x%x\n" - "esd_flag\t0x%x\n" - "pci_cfg_is_read\t0x%x\n" - "rtl8125_rx_config\t0x%x\n" - "cp_cmd\t0x%x\n" - "intr_mask\t0x%x\n" - "timer_intr_mask\t0x%x\n" - "wol_enabled\t0x%x\n" - "wol_opts\t0x%x\n" - "efuse_ver\t0x%x\n" - "eeprom_type\t0x%x\n" - "autoneg\t0x%x\n" - "duplex\t0x%x\n" - "speed\t%d\n" - "advertising\t0x%x\n" - "eeprom_len\t0x%x\n" - "cur_page\t0x%x\n" - "bios_setting\t0x%x\n" - "features\t0x%x\n" - "org_pci_offset_99\t0x%x\n" - "org_pci_offset_180\t0x%x\n" - "issue_offset_99_event\t0x%x\n" - "org_pci_offset_80\t0x%x\n" - "org_pci_offset_81\t0x%x\n" - "use_timer_interrrupt\t0x%x\n" - "HwIcVerUnknown\t0x%x\n" - "NotWrRamCodeToMicroP\t0x%x\n" - "NotWrMcuPatchCode\t0x%x\n" - "HwHasWrRamCodeToMicroP\t0x%x\n" - "sw_ram_code_ver\t0x%x\n" - "hw_ram_code_ver\t0x%x\n" - "rtk_enable_diag\t0x%x\n" - "ShortPacketSwChecksum\t0x%x\n" - "UseSwPaddingShortPkt\t0x%x\n" - "RequireRduNonStopPatch\t0x%x\n" - "RequireAdcBiasPatch\t0x%x\n" - "AdcBiasPatchIoffset\t0x%x\n" - "RequireAdjustUpsTxLinkPulseTiming\t0x%x\n" - "SwrCnt1msIni\t0x%x\n" - "HwSuppNowIsOobVer\t0x%x\n" - "HwFiberModeVer\t0x%x\n" - "HwFiberStat\t0x%x\n" - "HwSwitchMdiToFiber\t0x%x\n" - "NicCustLedValue\t0x%x\n" - "RequiredSecLanDonglePatch\t0x%x\n" - "HwSuppDashVer\t0x%x\n" - "DASH\t0x%x\n" - "dash_printer_enabled\t0x%x\n" - "HwSuppKCPOffloadVer\t0x%x\n" - "speed_mode\t0x%x\n" - "duplex_mode\t0x%x\n" - "autoneg_mode\t0x%x\n" - "advertising_mode\t0x%x\n" - "aspm\t0x%x\n" - "s5wol\t0x%x\n" - "s5_keep_curr_mac\t0x%x\n" - "eee_enable\t0x%x\n" - "hwoptimize\t0x%lx\n" - "proc_init_num\t0x%x\n" - "s0_magic_packet\t0x%x\n" - "HwSuppMagicPktVer\t0x%x\n" - "HwSuppLinkChgWakeUpVer\t0x%x\n" - "HwSuppD0SpeedUpVer\t0x%x\n" - "D0SpeedUpSpeed\t0x%x\n" - "HwSuppCheckPhyDisableModeVer\t0x%x\n" - "HwPkgDet\t0x%x\n" - "HwSuppTxNoCloseVer\t0x%x\n" - "EnableTxNoClose\t0x%x\n" - "NextHwDesCloPtr0\t0x%x\n" - "BeginHwDesCloPtr0\t0x%x\n" - "NextHwDesCloPtr1\t0x%x\n" - "BeginHwDesCloPtr1\t0x%x\n" - "InitRxDescType\t0x%x\n" - "RxDescLength\t0x%x\n" - "num_rx_rings\t0x%x\n" - "num_tx_rings\t0x%x\n" - "tot_rx_rings\t0x%x\n" - "tot_tx_rings\t0x%x\n" - "EnableRss\t0x%x\n" - "EnablePtp\t0x%x\n" - "ptp_master_mode\t0x%x\n" - "min_irq_nvecs\t0x%x\n" - "irq_nvecs\t0x%x\n" - "ring_lib_enabled\t0x%x\n" - "HwSuppIsrVer\t0x%x\n" - "HwCurrIsrVer\t0x%x\n" -#ifdef ENABLE_PTP_SUPPORT - "tx_hwtstamp_timeouts\t0x%x\n" - "tx_hwtstamp_skipped\t0x%x\n" -#endif - "random_mac\t0x%x\n" - "org_mac_addr\t%pM\n" -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13) - "perm_addr\t%pM\n" -#endif - "dev_addr\t%pM\n", - MODULENAME, - RTL8125_VERSION, - tp->mcfg, - tp->chipset, - rtl_chip_info[tp->chipset].name, - dev->mtu, - tp->rx_ring[0].num_rx_desc, - tp->rx_ring[0].cur_rx, - tp->rx_ring[0].dirty_rx, - tp->rx_ring[1].cur_rx, - tp->rx_ring[1].dirty_rx, - tp->rx_ring[2].cur_rx, - tp->rx_ring[2].dirty_rx, - tp->rx_ring[3].cur_rx, - tp->rx_ring[3].dirty_rx, - tp->tx_ring[0].num_tx_desc, - tp->tx_ring[0].cur_tx, - tp->tx_ring[0].dirty_tx, - tp->tx_ring[1].cur_tx, - tp->tx_ring[1].dirty_tx, - tp->rx_buf_sz, - tp->esd_flag, - tp->pci_cfg_is_read, - tp->rtl8125_rx_config, - tp->cp_cmd, - tp->intr_mask, - tp->timer_intr_mask, - tp->wol_enabled, - tp->wol_opts, - tp->efuse_ver, - tp->eeprom_type, - tp->autoneg, - tp->duplex, - tp->speed, - tp->advertising, - tp->eeprom_len, - tp->cur_page, - tp->bios_setting, - tp->features, - tp->org_pci_offset_99, - tp->org_pci_offset_180, - tp->issue_offset_99_event, - tp->org_pci_offset_80, - tp->org_pci_offset_81, - tp->use_timer_interrrupt, - tp->HwIcVerUnknown, - tp->NotWrRamCodeToMicroP, - tp->NotWrMcuPatchCode, - tp->HwHasWrRamCodeToMicroP, - tp->sw_ram_code_ver, - tp->hw_ram_code_ver, - tp->rtk_enable_diag, - tp->ShortPacketSwChecksum, - tp->UseSwPaddingShortPkt, - tp->RequireRduNonStopPatch, - tp->RequireAdcBiasPatch, - tp->AdcBiasPatchIoffset, - tp->RequireAdjustUpsTxLinkPulseTiming, - tp->SwrCnt1msIni, - tp->HwSuppNowIsOobVer, - tp->HwFiberModeVer, - tp->HwFiberStat, - tp->HwSwitchMdiToFiber, - tp->NicCustLedValue, - tp->RequiredSecLanDonglePatch, - tp->HwSuppDashVer, - tp->DASH, - tp->dash_printer_enabled, - tp->HwSuppKCPOffloadVer, - speed_mode, - duplex_mode, - autoneg_mode, - advertising_mode, - aspm, - s5wol, - s5_keep_curr_mac, - tp->eee.eee_enabled, - hwoptimize, - proc_init_num, - s0_magic_packet, - tp->HwSuppMagicPktVer, - tp->HwSuppLinkChgWakeUpVer, - tp->HwSuppD0SpeedUpVer, - tp->D0SpeedUpSpeed, - tp->HwSuppCheckPhyDisableModeVer, - tp->HwPkgDet, - tp->HwSuppTxNoCloseVer, - tp->EnableTxNoClose, - tp->tx_ring[0].NextHwDesCloPtr, - tp->tx_ring[0].BeginHwDesCloPtr, - tp->tx_ring[1].NextHwDesCloPtr, - tp->tx_ring[1].BeginHwDesCloPtr, - tp->InitRxDescType, - tp->RxDescLength, - tp->num_rx_rings, - tp->num_tx_rings, - tp->tot_rx_rings, - tp->tot_tx_rings, - tp->EnableRss, - tp->EnablePtp, - tp->ptp_master_mode, - tp->min_irq_nvecs, - tp->irq_nvecs, - tp->ring_lib_enabled, - tp->HwSuppIsrVer, - tp->HwCurrIsrVer, -#ifdef ENABLE_PTP_SUPPORT - tp->tx_hwtstamp_timeouts, - tp->tx_hwtstamp_skipped, -#endif - tp->random_mac, - tp->org_mac_addr, -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13) - dev->perm_addr, -#endif - dev->dev_addr - ); - - rtnl_unlock(); - - len += snprintf(page + len, count - len, "\n"); - - *eof = 1; - return len; -} - -static int proc_get_tally_counter(char *page, char **start, - off_t offset, int count, - int *eof, void *data) -{ - struct net_device *dev = data; - struct rtl8125_private *tp = netdev_priv(dev); - struct rtl8125_counters *counters; - dma_addr_t paddr; - int len = 0; - - len += snprintf(page + len, count - len, - "\nDump Tally Counter\n"); - - rtnl_lock(); - - counters = tp->tally_vaddr; - paddr = tp->tally_paddr; - if (!counters) { - len += snprintf(page + len, count - len, - "\nDump Tally Counter Fail\n"); - goto out_unlock; - } - - rtl8125_dump_tally_counter(tp, paddr); - - len += snprintf(page + len, count - len, - "Statistics\tValue\n----------\t-----\n"); - - len += snprintf(page + len, count - len, - "tx_packets\t%lld\n" - "rx_packets\t%lld\n" - "tx_errors\t%lld\n" - "rx_errors\t%d\n" - "rx_missed\t%d\n" - "align_errors\t%d\n" - "tx_one_collision\t%d\n" - "tx_multi_collision\t%d\n" - "rx_unicast\t%lld\n" - "rx_broadcast\t%lld\n" - "rx_multicast\t%d\n" - "tx_aborted\t%d\n" - "tx_underrun\t%d\n", - - "tx_octets\t%lld\n", - "rx_octets\t%lld\n", - "rx_multicast64\t%lld\n", - "tx_unicast64\t%lld\n", - "tx_broadcast64\t%lld\n", - "tx_multicast64\t%lld\n", - "tx_pause_on\t%d\n", - "tx_pause_off\t%d\n", - "tx_pause_all\t%d\n", - "tx_deferred\t%d\n", - "tx_late_collision\t%d\n", - "tx_all_collision\t%d\n", - "tx_aborted32\t%d\n", - "align_errors32\t%d\n", - "rx_frame_too_long\t%d\n", - "rx_runt\t%d\n", - "rx_pause_on\t%d\n", - "rx_pause_off\t%d\n", - "rx_pause_all\t%d\n", - "rx_unknown_opcode\t%d\n", - "rx_mac_error\t%d\n", - "tx_underrun32\t%d\n", - "rx_mac_missed\t%d\n", - "rx_tcam_dropped\t%d\n", - "tdu\t%d\n", - "rdu\t%d\n", - le64_to_cpu(counters->tx_packets), - le64_to_cpu(counters->rx_packets), - le64_to_cpu(counters->tx_errors), - le32_to_cpu(counters->rx_errors), - le16_to_cpu(counters->rx_missed), - le16_to_cpu(counters->align_errors), - le32_to_cpu(counters->tx_one_collision), - le32_to_cpu(counters->tx_multi_collision), - le64_to_cpu(counters->rx_unicast), - le64_to_cpu(counters->rx_broadcast), - le32_to_cpu(counters->rx_multicast), - le16_to_cpu(counters->tx_aborted), - le16_to_cpu(counters->tx_underrun), - - le64_to_cpu(counters->tx_octets), - le64_to_cpu(counters->rx_octets), - le64_to_cpu(counters->rx_multicast64), - le64_to_cpu(counters->tx_unicast64), - le64_to_cpu(counters->tx_broadcast64), - le64_to_cpu(counters->tx_multicast64), - le32_to_cpu(counters->tx_pause_on), - le32_to_cpu(counters->tx_pause_off), - le32_to_cpu(counters->tx_pause_all), - le32_to_cpu(counters->tx_deferred), - le32_to_cpu(counters->tx_late_collision), - le32_to_cpu(counters->tx_all_collision), - le32_to_cpu(counters->tx_aborted32), - le32_to_cpu(counters->align_errors32), - le32_to_cpu(counters->rx_frame_too_long), - le32_to_cpu(counters->rx_runt), - le32_to_cpu(counters->rx_pause_on), - le32_to_cpu(counters->rx_pause_off), - le32_to_cpu(counters->rx_pause_all), - le32_to_cpu(counters->rx_unknown_opcode), - le32_to_cpu(counters->rx_mac_error), - le32_to_cpu(counters->tx_underrun32), - le32_to_cpu(counters->rx_mac_missed), - le32_to_cpu(counters->rx_tcam_dropped), - le32_to_cpu(counters->tdu), - le32_to_cpu(counters->rdu), - ); - - len += snprintf(page + len, count - len, "\n"); -out_unlock: - rtnl_unlock(); - - *eof = 1; - return len; -} - -static int proc_get_registers(char *page, char **start, - off_t offset, int count, - int *eof, void *data) -{ - struct net_device *dev = data; - int i, n, max = R8125_MAC_REGS_SIZE; - u8 byte_rd; - struct rtl8125_private *tp = netdev_priv(dev); - void __iomem *ioaddr = tp->mmio_addr; - int len = 0; - - len += snprintf(page + len, count - len, - "\nDump MAC Registers\n" - "Offset\tValue\n------\t-----\n"); - - rtnl_lock(); - - for (n = 0; n < max;) { - len += snprintf(page + len, count - len, - "\n0x%02x:\t", - n); - - for (i = 0; i < 16 && n < max; i++, n++) { - byte_rd = readb(ioaddr + n); - len += snprintf(page + len, count - len, - "%02x ", - byte_rd); - } - } - - rtnl_unlock(); - - len += snprintf(page + len, count - len, "\n"); - - *eof = 1; - return len; -} - -static int proc_get_pcie_phy(char *page, char **start, - off_t offset, int count, - int *eof, void *data) -{ - struct net_device *dev = data; - int i, n, max = R8125_EPHY_REGS_SIZE/2; - u16 word_rd; - struct rtl8125_private *tp = netdev_priv(dev); - int len = 0; - - len += snprintf(page + len, count - len, - "\nDump PCIE PHY\n" - "Offset\tValue\n------\t-----\n"); - - rtnl_lock(); - - for (n = 0; n < max;) { - len += snprintf(page + len, count - len, - "\n0x%02x:\t", - n); - - for (i = 0; i < 8 && n < max; i++, n++) { - word_rd = rtl8125_ephy_read(tp, n); - len += snprintf(page + len, count - len, - "%04x ", - word_rd); - } - } - - rtnl_unlock(); - - len += snprintf(page + len, count - len, "\n"); - - *eof = 1; - return len; -} - -static int proc_get_eth_phy(char *page, char **start, - off_t offset, int count, - int *eof, void *data) -{ - struct net_device *dev = data; - int i, n, max = R8125_PHY_REGS_SIZE/2; - u16 word_rd; - struct rtl8125_private *tp = netdev_priv(dev); - int len = 0; - - len += snprintf(page + len, count - len, - "\nDump Ethernet PHY\n" - "Offset\tValue\n------\t-----\n"); - - rtnl_lock(); - - len += snprintf(page + len, count - len, - "\n####################page 0##################\n"); - rtl8125_mdio_write(tp, 0x1f, 0x0000); - for (n = 0; n < max;) { - len += snprintf(page + len, count - len, - "\n0x%02x:\t", - n); - - for (i = 0; i < 8 && n < max; i++, n++) { - word_rd = rtl8125_mdio_read(tp, n); - len += snprintf(page + len, count - len, - "%04x ", - word_rd); - } - } - - rtnl_unlock(); - - len += snprintf(page + len, count - len, "\n"); - - *eof = 1; - return len; -} - -static int proc_get_extended_registers(char *page, char **start, - off_t offset, int count, - int *eof, void *data) -{ - struct net_device *dev = data; - int i, n, max = R8125_ERI_REGS_SIZE; - u32 dword_rd; - struct rtl8125_private *tp = netdev_priv(dev); - int len = 0; - - len += snprintf(page + len, count - len, - "\nDump Extended Registers\n" - "Offset\tValue\n------\t-----\n"); - - rtnl_lock(); - - for (n = 0; n < max;) { - len += snprintf(page + len, count - len, - "\n0x%02x:\t", - n); - - for (i = 0; i < 4 && n < max; i++, n+=4) { - dword_rd = rtl8125_eri_read(tp, n, 4, ERIAR_ExGMAC); - len += snprintf(page + len, count - len, - "%08x ", - dword_rd); - } - } - - rtnl_unlock(); - - len += snprintf(page + len, count - len, "\n"); - - *eof = 1; - return len; -} - -static int proc_get_pci_registers(char *page, char **start, - off_t offset, int count, - int *eof, void *data) -{ - struct net_device *dev = data; - int i, n, max = R8125_PCI_REGS_SIZE; - u32 dword_rd; - struct rtl8125_private *tp = netdev_priv(dev); - int len = 0; - - len += snprintf(page + len, count - len, - "\nDump PCI Registers\n" - "Offset\tValue\n------\t-----\n"); - - rtnl_lock(); - - for (n = 0; n < max;) { - len += snprintf(page + len, count - len, - "\n0x%03x:\t", - n); - - for (i = 0; i < 4 && n < max; i++, n+=4) { - pci_read_config_dword(tp->pci_dev, n, &dword_rd); - len += snprintf(page + len, count - len, - "%08x ", - dword_rd); - } - } - - n = 0x110; - pci_read_config_dword(tp->pci_dev, n, &dword_rd); - len += snprintf(page + len, count - len, - "\n0x%03x:\t%08x ", - n, - dword_rd); - n = 0x70c; - pci_read_config_dword(tp->pci_dev, n, &dword_rd); - len += snprintf(page + len, count - len, - "\n0x%03x:\t%08x ", - n, - dword_rd); - - rtnl_unlock(); - - len += snprintf(page + len, count - len, "\n"); - - *eof = 1; - return len; -} - -static int proc_get_temperature(char *page, char **start, - off_t offset, int count, - int *eof, void *data) -{ - struct net_device *dev = data; - struct rtl8125_private *tp = netdev_priv(dev); - u16 ts_digout, tj, fah; - int len = 0; - - switch (tp->mcfg) { - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_7: - len += snprintf(page + len, count - len, - "\nChip Temperature\n"); - break; - default: - len += snprintf(page + len, count - len, - "\nThis Chip Does Not Support Dump Temperature\n"); - break; - } - - rtnl_lock(); - ts_digout = rtl8125_read_thermal_sensor(tp); - rtnl_unlock(); - - tj = ts_digout / 2; - if (ts_digout <= 512) { - tj = ts_digout / 2; - len += snprintf(page + len, count - len, - "Cel:%d\n", - tj); - fah = tj * (9/5) + 32; - len += snprintf(page + len, count - len, - "Fah:%d\n", - fah); - - } else { - tj = (512 - ((ts_digout / 2) - 512)) / 2; - len += snprintf(page + len, count - len, - "Cel:-%d\n", - tj); - fah = tj * (9/5) + 32; - len += snprintf(page + len, count - len, - "Fah:-%d\n", - fah); - } - - len += snprintf(page + len, count - len, "\n"); - - *eof = 1; - return len; -} -#endif -static void rtl8125_proc_module_init(void) -{ - //create /proc/net/r8125 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32) - rtl8125_proc = proc_mkdir(MODULENAME, init_net.proc_net); -#else - rtl8125_proc = proc_mkdir(MODULENAME, proc_net); -#endif - if (!rtl8125_proc) - dprintk("cannot create %s proc entry \n", MODULENAME); -} - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) -/* - * seq_file wrappers for procfile show routines. - */ -static int rtl8125_proc_open(struct inode *inode, struct file *file) -{ - struct net_device *dev = proc_get_parent_data(inode); - int (*show)(struct seq_file *, void *) = PDE_DATA(inode); - - return single_open(file, show, dev); -} - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0) -static const struct proc_ops rtl8125_proc_fops = { - .proc_open = rtl8125_proc_open, - .proc_read = seq_read, - .proc_lseek = seq_lseek, - .proc_release = single_release, -}; -#else -static const struct file_operations rtl8125_proc_fops = { - .open = rtl8125_proc_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; -#endif - -#endif - -/* - * Table of proc files we need to create. - */ -struct rtl8125_proc_file { - char name[12]; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) - int (*show)(struct seq_file *, void *); -#else - int (*show)(char *, char **, off_t, int, int *, void *); -#endif -}; - -static const struct rtl8125_proc_file rtl8125_proc_files[] = { - { "driver_var", &proc_get_driver_variable }, - { "tally", &proc_get_tally_counter }, - { "registers", &proc_get_registers }, - { "pcie_phy", &proc_get_pcie_phy }, - { "eth_phy", &proc_get_eth_phy }, - { "ext_regs", &proc_get_extended_registers }, - { "pci_regs", &proc_get_pci_registers }, - { "temp", &proc_get_temperature }, - { "", NULL } -}; - -static void rtl8125_proc_init(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - const struct rtl8125_proc_file *f; - struct proc_dir_entry *dir; - - if (rtl8125_proc && !tp->proc_dir) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) - dir = proc_mkdir_data(dev->name, 0, rtl8125_proc, dev); - if (!dir) { - printk("Unable to initialize /proc/net/%s/%s\n", - MODULENAME, dev->name); - return; - } - - tp->proc_dir = dir; - proc_init_num++; - - for (f = rtl8125_proc_files; f->name[0]; f++) { - if (!proc_create_data(f->name, S_IFREG | S_IRUGO, dir, - &rtl8125_proc_fops, f->show)) { - printk("Unable to initialize " - "/proc/net/%s/%s/%s\n", - MODULENAME, dev->name, f->name); - return; - } - } -#else - dir = proc_mkdir(dev->name, rtl8125_proc); - if (!dir) { - printk("Unable to initialize /proc/net/%s/%s\n", - MODULENAME, dev->name); - return; - } - - tp->proc_dir = dir; - proc_init_num++; - - for (f = rtl8125_proc_files; f->name[0]; f++) { - if (!create_proc_read_entry(f->name, S_IFREG | S_IRUGO, - dir, f->show, dev)) { - printk("Unable to initialize " - "/proc/net/%s/%s/%s\n", - MODULENAME, dev->name, f->name); - return; - } - } -#endif - } -} - -static void rtl8125_proc_remove(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - if (tp->proc_dir) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) - remove_proc_subtree(dev->name, rtl8125_proc); - proc_init_num--; - -#else - const struct rtl8125_proc_file *f; - struct rtl8125_private *tp = netdev_priv(dev); - - for (f = rtl8125_proc_files; f->name[0]; f++) - remove_proc_entry(f->name, tp->proc_dir); - - remove_proc_entry(dev->name, rtl8125_proc); - proc_init_num--; -#endif - tp->proc_dir = NULL; - } -} - -#endif //ENABLE_R8125_PROCFS - -static inline u16 map_phy_ocp_addr(u16 PageNum, u8 RegNum) -{ - u16 OcpPageNum = 0; - u8 OcpRegNum = 0; - u16 OcpPhyAddress = 0; - - if ( PageNum == 0 ) { - OcpPageNum = OCP_STD_PHY_BASE_PAGE + ( RegNum / 8 ); - OcpRegNum = 0x10 + ( RegNum % 8 ); - } else { - OcpPageNum = PageNum; - OcpRegNum = RegNum; - } - - OcpPageNum <<= 4; - - if ( OcpRegNum < 16 ) { - OcpPhyAddress = 0; - } else { - OcpRegNum -= 16; - OcpRegNum <<= 1; - - OcpPhyAddress = OcpPageNum + OcpRegNum; - } - - - return OcpPhyAddress; -} - -static void mdio_real_direct_write_phy_ocp(struct rtl8125_private *tp, - u16 RegAddr, - u16 value) -{ - u32 data32; - int i; - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18) - WARN_ON_ONCE(RegAddr % 2); -#endif - data32 = RegAddr/2; - data32 <<= OCPR_Addr_Reg_shift; - data32 |= OCPR_Write | value; - - RTL_W32(tp, PHYOCP, data32); - for (i = 0; i < 100; i++) { - udelay(1); - - if (!(RTL_R32(tp, PHYOCP) & OCPR_Flag)) - break; - } -} - -static void mdio_direct_write_phy_ocp(struct rtl8125_private *tp, - u16 RegAddr, - u16 value) -{ - if (tp->rtk_enable_diag) return; - - mdio_real_direct_write_phy_ocp(tp, RegAddr, value); -} - -/* -static void rtl8125_mdio_write_phy_ocp(struct rtl8125_private *tp, - u16 PageNum, - u32 RegAddr, - u32 value) -{ - u16 ocp_addr; - - ocp_addr = map_phy_ocp_addr(PageNum, RegAddr); - - mdio_direct_write_phy_ocp(tp, ocp_addr, value); -} -*/ - -static void rtl8125_mdio_real_write_phy_ocp(struct rtl8125_private *tp, - u16 PageNum, - u32 RegAddr, - u32 value) -{ - u16 ocp_addr; - - ocp_addr = map_phy_ocp_addr(PageNum, RegAddr); - - mdio_real_direct_write_phy_ocp(tp, ocp_addr, value); -} - -static void mdio_real_write(struct rtl8125_private *tp, - u16 RegAddr, - u16 value) -{ - if (RegAddr == 0x1F) { - tp->cur_page = value; - return; - } - rtl8125_mdio_real_write_phy_ocp(tp, tp->cur_page, RegAddr, value); -} - -void rtl8125_mdio_write(struct rtl8125_private *tp, - u16 RegAddr, - u16 value) -{ - if (tp->rtk_enable_diag) return; - - mdio_real_write(tp, RegAddr, value); -} - -void rtl8125_mdio_prot_write(struct rtl8125_private *tp, - u32 RegAddr, - u32 value) -{ - mdio_real_write(tp, RegAddr, value); -} - -void rtl8125_mdio_prot_direct_write_phy_ocp(struct rtl8125_private *tp, - u32 RegAddr, - u32 value) -{ - mdio_real_direct_write_phy_ocp(tp, RegAddr, value); -} - -static u32 mdio_real_direct_read_phy_ocp(struct rtl8125_private *tp, - u16 RegAddr) -{ - u32 data32; - int i, value = 0; - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18) - WARN_ON_ONCE(RegAddr % 2); -#endif - data32 = RegAddr/2; - data32 <<= OCPR_Addr_Reg_shift; - - RTL_W32(tp, PHYOCP, data32); - for (i = 0; i < 100; i++) { - udelay(1); - - if (RTL_R32(tp, PHYOCP) & OCPR_Flag) - break; - } - value = RTL_R32(tp, PHYOCP) & OCPDR_Data_Mask; - - return value; -} - -static u32 mdio_direct_read_phy_ocp(struct rtl8125_private *tp, - u16 RegAddr) -{ - if (tp->rtk_enable_diag) return 0xffffffff; - - return mdio_real_direct_read_phy_ocp(tp, RegAddr); -} - -/* -static u32 rtl8125_mdio_read_phy_ocp(struct rtl8125_private *tp, - u16 PageNum, - u32 RegAddr) -{ - u16 ocp_addr; - - ocp_addr = map_phy_ocp_addr(PageNum, RegAddr); - - return mdio_direct_read_phy_ocp(tp, ocp_addr); -} -*/ - -static u32 rtl8125_mdio_real_read_phy_ocp(struct rtl8125_private *tp, - u16 PageNum, - u32 RegAddr) -{ - u16 ocp_addr; - - ocp_addr = map_phy_ocp_addr(PageNum, RegAddr); - - return mdio_real_direct_read_phy_ocp(tp, ocp_addr); -} - -static u32 mdio_real_read(struct rtl8125_private *tp, - u16 RegAddr) -{ - return rtl8125_mdio_real_read_phy_ocp(tp, tp->cur_page, RegAddr); -} - -u32 rtl8125_mdio_read(struct rtl8125_private *tp, - u16 RegAddr) -{ - if (tp->rtk_enable_diag) return 0xffffffff; - - return mdio_real_read(tp, RegAddr); -} - -u32 rtl8125_mdio_prot_read(struct rtl8125_private *tp, - u32 RegAddr) -{ - return mdio_real_read(tp, RegAddr); -} - -u32 rtl8125_mdio_prot_direct_read_phy_ocp(struct rtl8125_private *tp, - u32 RegAddr) -{ - return mdio_real_direct_read_phy_ocp(tp, RegAddr); -} - -static void ClearAndSetEthPhyBit(struct rtl8125_private *tp, u8 addr, u16 clearmask, u16 setmask) -{ - u16 PhyRegValue; - - PhyRegValue = rtl8125_mdio_read(tp, addr); - PhyRegValue &= ~clearmask; - PhyRegValue |= setmask; - rtl8125_mdio_write(tp, addr, PhyRegValue); -} - -void rtl8125_clear_eth_phy_bit(struct rtl8125_private *tp, u8 addr, u16 mask) -{ - ClearAndSetEthPhyBit(tp, - addr, - mask, - 0 - ); -} - -void rtl8125_set_eth_phy_bit(struct rtl8125_private *tp, u8 addr, u16 mask) -{ - ClearAndSetEthPhyBit(tp, - addr, - 0, - mask - ); -} - -static void ClearAndSetEthPhyOcpBit(struct rtl8125_private *tp, u16 addr, u16 clearmask, u16 setmask) -{ - u16 PhyRegValue; - - PhyRegValue = mdio_direct_read_phy_ocp(tp, addr); - PhyRegValue &= ~clearmask; - PhyRegValue |= setmask; - mdio_direct_write_phy_ocp(tp, addr, PhyRegValue); -} - -void ClearEthPhyOcpBit(struct rtl8125_private *tp, u16 addr, u16 mask) -{ - ClearAndSetEthPhyOcpBit(tp, - addr, - mask, - 0 - ); -} - -void SetEthPhyOcpBit(struct rtl8125_private *tp, u16 addr, u16 mask) -{ - ClearAndSetEthPhyOcpBit(tp, - addr, - 0, - mask - ); -} - -void rtl8125_mac_ocp_write(struct rtl8125_private *tp, u16 reg_addr, u16 value) -{ - u32 data32; - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18) - WARN_ON_ONCE(reg_addr % 2); -#endif - - data32 = reg_addr/2; - data32 <<= OCPR_Addr_Reg_shift; - data32 += value; - data32 |= OCPR_Write; - - RTL_W32(tp, MACOCP, data32); -} - -u32 rtl8125_mac_ocp_read(struct rtl8125_private *tp, u16 reg_addr) -{ - u32 data32; - u16 data16 = 0; - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18) - WARN_ON_ONCE(reg_addr % 2); -#endif - - data32 = reg_addr/2; - data32 <<= OCPR_Addr_Reg_shift; - - RTL_W32(tp, MACOCP, data32); - data16 = (u16)RTL_R32(tp, MACOCP); - - return data16; -} - -#ifdef ENABLE_USE_FIRMWARE_FILE -static void mac_mcu_write(struct rtl8125_private *tp, u16 reg, u16 value) -{ - if (reg == 0x1f) { - tp->ocp_base = value << 4; - return; - } - - rtl8125_mac_ocp_write(tp, tp->ocp_base + reg, value); -} - -static u32 mac_mcu_read(struct rtl8125_private *tp, u16 reg) -{ - return rtl8125_mac_ocp_read(tp, tp->ocp_base + reg); -} -#endif - -static void -ClearAndSetMcuAccessRegBit( - struct rtl8125_private *tp, - u16 addr, - u16 clearmask, - u16 setmask -) -{ - u16 PhyRegValue; - - PhyRegValue = rtl8125_mac_ocp_read(tp, addr); - PhyRegValue &= ~clearmask; - PhyRegValue |= setmask; - rtl8125_mac_ocp_write(tp, addr, PhyRegValue); -} - -static void -ClearMcuAccessRegBit( - struct rtl8125_private *tp, - u16 addr, - u16 mask -) -{ - ClearAndSetMcuAccessRegBit(tp, - addr, - mask, - 0 - ); -} - -static void -SetMcuAccessRegBit( - struct rtl8125_private *tp, - u16 addr, - u16 mask -) -{ - ClearAndSetMcuAccessRegBit(tp, - addr, - 0, - mask - ); -} - -u32 rtl8125_ocp_read_with_oob_base_address(struct rtl8125_private *tp, u16 addr, u8 len, const u32 base_address) -{ - return rtl8125_eri_read_with_oob_base_address(tp, addr, len, ERIAR_OOB, base_address); -} - -u32 rtl8125_ocp_read(struct rtl8125_private *tp, u16 addr, u8 len) -{ - u32 value = 0; - - if (HW_DASH_SUPPORT_TYPE_2(tp)) - value = rtl8125_ocp_read_with_oob_base_address(tp, addr, len, NO_BASE_ADDRESS); - else if (HW_DASH_SUPPORT_TYPE_3(tp)) - value = rtl8125_ocp_read_with_oob_base_address(tp, addr, len, RTL8168FP_OOBMAC_BASE); - - return value; -} - -u32 rtl8125_ocp_write_with_oob_base_address(struct rtl8125_private *tp, u16 addr, u8 len, u32 value, const u32 base_address) -{ - return rtl8125_eri_write_with_oob_base_address(tp, addr, len, value, ERIAR_OOB, base_address); -} - -void rtl8125_ocp_write(struct rtl8125_private *tp, u16 addr, u8 len, u32 value) -{ - if (HW_DASH_SUPPORT_TYPE_2(tp)) - rtl8125_ocp_write_with_oob_base_address(tp, addr, len, value, NO_BASE_ADDRESS); - else if (HW_DASH_SUPPORT_TYPE_3(tp)) - rtl8125_ocp_write_with_oob_base_address(tp, addr, len, value, RTL8168FP_OOBMAC_BASE); -} - -void rtl8125_oob_mutex_lock(struct rtl8125_private *tp) -{ - u8 reg_16, reg_a0; - u32 wait_cnt_0, wait_Cnt_1; - u16 ocp_reg_mutex_ib; - u16 ocp_reg_mutex_oob; - u16 ocp_reg_mutex_prio; - - if (!tp->DASH) return; - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - default: - ocp_reg_mutex_oob = 0x110; - ocp_reg_mutex_ib = 0x114; - ocp_reg_mutex_prio = 0x11C; - break; - } - - rtl8125_ocp_write(tp, ocp_reg_mutex_ib, 1, BIT_0); - reg_16 = rtl8125_ocp_read(tp, ocp_reg_mutex_oob, 1); - wait_cnt_0 = 0; - while(reg_16) { - reg_a0 = rtl8125_ocp_read(tp, ocp_reg_mutex_prio, 1); - if (reg_a0) { - rtl8125_ocp_write(tp, ocp_reg_mutex_ib, 1, 0x00); - reg_a0 = rtl8125_ocp_read(tp, ocp_reg_mutex_prio, 1); - wait_Cnt_1 = 0; - while(reg_a0) { - reg_a0 = rtl8125_ocp_read(tp, ocp_reg_mutex_prio, 1); - - wait_Cnt_1++; - - if (wait_Cnt_1 > 2000) - break; - }; - rtl8125_ocp_write(tp, ocp_reg_mutex_ib, 1, BIT_0); - - } - reg_16 = rtl8125_ocp_read(tp, ocp_reg_mutex_oob, 1); - - wait_cnt_0++; - - if (wait_cnt_0 > 2000) - break; - }; -} - -void rtl8125_oob_mutex_unlock(struct rtl8125_private *tp) -{ - u16 ocp_reg_mutex_ib; - u16 ocp_reg_mutex_oob; - u16 ocp_reg_mutex_prio; - - if (!tp->DASH) return; - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - default: - ocp_reg_mutex_oob = 0x110; - ocp_reg_mutex_ib = 0x114; - ocp_reg_mutex_prio = 0x11C; - break; - } - - rtl8125_ocp_write(tp, ocp_reg_mutex_prio, 1, BIT_0); - rtl8125_ocp_write(tp, ocp_reg_mutex_ib, 1, 0x00); -} - -void rtl8125_oob_notify(struct rtl8125_private *tp, u8 cmd) -{ - rtl8125_eri_write(tp, 0xE8, 1, cmd, ERIAR_ExGMAC); - - rtl8125_ocp_write(tp, 0x30, 1, 0x01); -} - -static int rtl8125_check_dash(struct rtl8125_private *tp) -{ - if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) { - if (rtl8125_ocp_read(tp, 0x128, 1) & BIT_0) - return 1; - } - - return 0; -} - -void rtl8125_dash2_disable_tx(struct rtl8125_private *tp) -{ - if (!tp->DASH) return; - - if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) { - u16 WaitCnt; - u8 TmpUchar; - - //Disable oob Tx - RTL_CMAC_W8(tp, CMAC_IBCR2, RTL_CMAC_R8(tp, CMAC_IBCR2) & ~( BIT_0 )); - WaitCnt = 0; - - //wait oob tx disable - do { - TmpUchar = RTL_CMAC_R8(tp, CMAC_IBISR0); - - if ( TmpUchar & ISRIMR_DASH_TYPE2_TX_DISABLE_IDLE ) { - break; - } - - udelay( 50 ); - WaitCnt++; - } while(WaitCnt < 2000); - - //Clear ISRIMR_DASH_TYPE2_TX_DISABLE_IDLE - RTL_CMAC_W8(tp, CMAC_IBISR0, RTL_CMAC_R8(tp, CMAC_IBISR0) | ISRIMR_DASH_TYPE2_TX_DISABLE_IDLE); - } -} - -void rtl8125_dash2_enable_tx(struct rtl8125_private *tp) -{ - if (!tp->DASH) return; - - if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) { - RTL_CMAC_W8(tp, CMAC_IBCR2, RTL_CMAC_R8(tp, CMAC_IBCR2) | BIT_0); - } -} - -void rtl8125_dash2_disable_rx(struct rtl8125_private *tp) -{ - if (!tp->DASH) return; - - if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) { - RTL_CMAC_W8(tp, CMAC_IBCR0, RTL_CMAC_R8(tp, CMAC_IBCR0) & ~( BIT_0 )); - } -} - -void rtl8125_dash2_enable_rx(struct rtl8125_private *tp) -{ - if (!tp->DASH) return; - - if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) { - RTL_CMAC_W8(tp, CMAC_IBCR0, RTL_CMAC_R8(tp, CMAC_IBCR0) | BIT_0); - } -} - -static void rtl8125_dash2_disable_txrx(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) { - rtl8125_dash2_disable_tx( tp ); - rtl8125_dash2_disable_rx( tp ); - } -} - -static void rtl8125_driver_start(struct rtl8125_private *tp) -{ - if (!tp->DASH) - return; - - if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) { - int timeout; - u32 tmp_value; - - rtl8125_ocp_write(tp, 0x180, 1, OOB_CMD_DRIVER_START); - tmp_value = rtl8125_ocp_read(tp, 0x30, 1); - tmp_value |= BIT_0; - rtl8125_ocp_write(tp, 0x30, 1, tmp_value); - - for (timeout = 0; timeout < 10; timeout++) { - mdelay(10); - if (rtl8125_ocp_read(tp, 0x124, 1) & BIT_0) - break; - } - } -} - -static void rtl8125_driver_stop(struct rtl8125_private *tp) -{ - if (!tp->DASH) - return; - - if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) { - struct net_device *dev = tp->dev; - int timeout; - u32 tmp_value; - - rtl8125_dash2_disable_txrx(dev); - - rtl8125_ocp_write(tp, 0x180, 1, OOB_CMD_DRIVER_STOP); - tmp_value = rtl8125_ocp_read(tp, 0x30, 1); - tmp_value |= BIT_0; - rtl8125_ocp_write(tp, 0x30, 1, tmp_value); - - for (timeout = 0; timeout < 10; timeout++) { - mdelay(10); - if (!(rtl8125_ocp_read(tp, 0x124, 1) & BIT_0)) - break; - } - } -} - -void rtl8125_ephy_write(struct rtl8125_private *tp, int RegAddr, int value) -{ - int i; - - RTL_W32(tp, EPHYAR, - EPHYAR_Write | - (RegAddr & EPHYAR_Reg_Mask_v2) << EPHYAR_Reg_shift | - (value & EPHYAR_Data_Mask)); - - for (i = 0; i < 10; i++) { - udelay(100); - - /* Check if the RTL8125 has completed EPHY write */ - if (!(RTL_R32(tp, EPHYAR) & EPHYAR_Flag)) - break; - } - - udelay(20); -} - -u16 rtl8125_ephy_read(struct rtl8125_private *tp, int RegAddr) -{ - int i; - u16 value = 0xffff; - - RTL_W32(tp, EPHYAR, - EPHYAR_Read | (RegAddr & EPHYAR_Reg_Mask_v2) << EPHYAR_Reg_shift); - - for (i = 0; i < 10; i++) { - udelay(100); - - /* Check if the RTL8125 has completed EPHY read */ - if (RTL_R32(tp, EPHYAR) & EPHYAR_Flag) { - value = (u16) (RTL_R32(tp, EPHYAR) & EPHYAR_Data_Mask); - break; - } - } - - udelay(20); - - return value; -} - -static void ClearAndSetPCIePhyBit(struct rtl8125_private *tp, u8 addr, u16 clearmask, u16 setmask) -{ - u16 EphyValue; - - EphyValue = rtl8125_ephy_read(tp, addr); - EphyValue &= ~clearmask; - EphyValue |= setmask; - rtl8125_ephy_write(tp, addr, EphyValue); -} - -static void ClearPCIePhyBit(struct rtl8125_private *tp, u8 addr, u16 mask) -{ - ClearAndSetPCIePhyBit( tp, - addr, - mask, - 0 - ); -} - -static void SetPCIePhyBit( struct rtl8125_private *tp, u8 addr, u16 mask) -{ - ClearAndSetPCIePhyBit( tp, - addr, - 0, - mask - ); -} - -static u32 -rtl8125_csi_other_fun_read(struct rtl8125_private *tp, - u8 multi_fun_sel_bit, - u32 addr) -{ - u32 cmd; - int i; - u32 value = 0; - - cmd = CSIAR_Read | CSIAR_ByteEn << CSIAR_ByteEn_shift | (addr & CSIAR_Addr_Mask); - - if (tp->mcfg == CFG_METHOD_DEFAULT) - multi_fun_sel_bit = 0; - - if (multi_fun_sel_bit > 7) - return 0xffffffff; - - cmd |= multi_fun_sel_bit << 16; - - RTL_W32(tp, CSIAR, cmd); - - for (i = 0; i < 10; i++) { - udelay(100); - - /* Check if the RTL8125 has completed CSI read */ - if (RTL_R32(tp, CSIAR) & CSIAR_Flag) { - value = (u32)RTL_R32(tp, CSIDR); - break; - } - } - - udelay(20); - - return value; -} - -static void -rtl8125_csi_other_fun_write(struct rtl8125_private *tp, - u8 multi_fun_sel_bit, - u32 addr, - u32 value) -{ - u32 cmd; - int i; - - RTL_W32(tp, CSIDR, value); - cmd = CSIAR_Write | CSIAR_ByteEn << CSIAR_ByteEn_shift | (addr & CSIAR_Addr_Mask); - if (tp->mcfg == CFG_METHOD_DEFAULT) - multi_fun_sel_bit = 0; - - if ( multi_fun_sel_bit > 7 ) - return; - - cmd |= multi_fun_sel_bit << 16; - - RTL_W32(tp, CSIAR, cmd); - - for (i = 0; i < 10; i++) { - udelay(100); - - /* Check if the RTL8125 has completed CSI write */ - if (!(RTL_R32(tp, CSIAR) & CSIAR_Flag)) - break; - } - - udelay(20); -} - -static u32 -rtl8125_csi_read(struct rtl8125_private *tp, - u32 addr) -{ - u8 multi_fun_sel_bit; - - multi_fun_sel_bit = 0; - - return rtl8125_csi_other_fun_read(tp, multi_fun_sel_bit, addr); -} - -static void -rtl8125_csi_write(struct rtl8125_private *tp, - u32 addr, - u32 value) -{ - u8 multi_fun_sel_bit; - - multi_fun_sel_bit = 0; - - rtl8125_csi_other_fun_write(tp, multi_fun_sel_bit, addr, value); -} - -static u8 -rtl8125_csi_fun0_read_byte(struct rtl8125_private *tp, - u32 addr) -{ - u8 RetVal = 0; - - if (tp->mcfg == CFG_METHOD_DEFAULT) { - struct pci_dev *pdev = tp->pci_dev; - - pci_read_config_byte(pdev, addr, &RetVal); - } else { - u32 TmpUlong; - u16 RegAlignAddr; - u8 ShiftByte; - - RegAlignAddr = addr & ~(0x3); - ShiftByte = addr & (0x3); - TmpUlong = rtl8125_csi_other_fun_read(tp, 0, addr); - TmpUlong >>= (8*ShiftByte); - RetVal = (u8)TmpUlong; - } - - udelay(20); - - return RetVal; -} - -static void -rtl8125_csi_fun0_write_byte(struct rtl8125_private *tp, - u32 addr, - u8 value) -{ - if (tp->mcfg == CFG_METHOD_DEFAULT) { - struct pci_dev *pdev = tp->pci_dev; - - pci_write_config_byte(pdev, addr, value); - } else { - u32 TmpUlong; - u16 RegAlignAddr; - u8 ShiftByte; - - RegAlignAddr = addr & ~(0x3); - ShiftByte = addr & (0x3); - TmpUlong = rtl8125_csi_other_fun_read(tp, 0, RegAlignAddr); - TmpUlong &= ~(0xFF << (8*ShiftByte)); - TmpUlong |= (value << (8*ShiftByte)); - rtl8125_csi_other_fun_write( tp, 0, RegAlignAddr, TmpUlong ); - } - - udelay(20); -} - -u32 rtl8125_eri_read_with_oob_base_address(struct rtl8125_private *tp, int addr, int len, int type, const u32 base_address) -{ - int i, val_shift, shift = 0; - u32 value1 = 0, value2 = 0, mask; - u32 eri_cmd; - const u32 transformed_base_address = ((base_address & 0x00FFF000) << 6) | (base_address & 0x000FFF); - - if (len > 4 || len <= 0) - return -1; - - while (len > 0) { - val_shift = addr % ERIAR_Addr_Align; - addr = addr & ~0x3; - - eri_cmd = ERIAR_Read | - transformed_base_address | - type << ERIAR_Type_shift | - ERIAR_ByteEn << ERIAR_ByteEn_shift | - (addr & 0x0FFF); - if (addr & 0xF000) { - u32 tmp; - - tmp = addr & 0xF000; - tmp >>= 12; - eri_cmd |= (tmp << 20) & 0x00F00000; - } - - RTL_W32(tp, ERIAR, eri_cmd); - - for (i = 0; i < 10; i++) { - udelay(100); - - /* Check if the RTL8125 has completed ERI read */ - if (RTL_R32(tp, ERIAR) & ERIAR_Flag) - break; - } - - if (len == 1) mask = (0xFF << (val_shift * 8)) & 0xFFFFFFFF; - else if (len == 2) mask = (0xFFFF << (val_shift * 8)) & 0xFFFFFFFF; - else if (len == 3) mask = (0xFFFFFF << (val_shift * 8)) & 0xFFFFFFFF; - else mask = (0xFFFFFFFF << (val_shift * 8)) & 0xFFFFFFFF; - - value1 = RTL_R32(tp, ERIDR) & mask; - value2 |= (value1 >> val_shift * 8) << shift * 8; - - if (len <= 4 - val_shift) { - len = 0; - } else { - len -= (4 - val_shift); - shift = 4 - val_shift; - addr += 4; - } - } - - udelay(20); - - return value2; -} - -u32 rtl8125_eri_read(struct rtl8125_private *tp, int addr, int len, int type) -{ - return rtl8125_eri_read_with_oob_base_address(tp, addr, len, type, 0); -} - -int rtl8125_eri_write_with_oob_base_address(struct rtl8125_private *tp, int addr, int len, u32 value, int type, const u32 base_address) -{ - int i, val_shift, shift = 0; - u32 value1 = 0, mask; - u32 eri_cmd; - const u32 transformed_base_address = ((base_address & 0x00FFF000) << 6) | (base_address & 0x000FFF); - - if (len > 4 || len <= 0) - return -1; - - while (len > 0) { - val_shift = addr % ERIAR_Addr_Align; - addr = addr & ~0x3; - - if (len == 1) mask = (0xFF << (val_shift * 8)) & 0xFFFFFFFF; - else if (len == 2) mask = (0xFFFF << (val_shift * 8)) & 0xFFFFFFFF; - else if (len == 3) mask = (0xFFFFFF << (val_shift * 8)) & 0xFFFFFFFF; - else mask = (0xFFFFFFFF << (val_shift * 8)) & 0xFFFFFFFF; - - value1 = rtl8125_eri_read_with_oob_base_address(tp, addr, 4, type, base_address) & ~mask; - value1 |= ((value << val_shift * 8) >> shift * 8); - - RTL_W32(tp, ERIDR, value1); - - eri_cmd = ERIAR_Write | - transformed_base_address | - type << ERIAR_Type_shift | - ERIAR_ByteEn << ERIAR_ByteEn_shift | - (addr & 0x0FFF); - if (addr & 0xF000) { - u32 tmp; - - tmp = addr & 0xF000; - tmp >>= 12; - eri_cmd |= (tmp << 20) & 0x00F00000; - } - - RTL_W32(tp, ERIAR, eri_cmd); - - for (i = 0; i < 10; i++) { - udelay(100); - - /* Check if the RTL8125 has completed ERI write */ - if (!(RTL_R32(tp, ERIAR) & ERIAR_Flag)) - break; - } - - if (len <= 4 - val_shift) { - len = 0; - } else { - len -= (4 - val_shift); - shift = 4 - val_shift; - addr += 4; - } - } - - udelay(20); - - return 0; -} - -int rtl8125_eri_write(struct rtl8125_private *tp, int addr, int len, u32 value, int type) -{ - return rtl8125_eri_write_with_oob_base_address(tp, addr, len, value, type, NO_BASE_ADDRESS); -} - -static void -rtl8125_enable_rxdvgate(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - RTL_W8(tp, 0xF2, RTL_R8(tp, 0xF2) | BIT_3); - mdelay(2); - break; - } -} - -static void -rtl8125_disable_rxdvgate(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - RTL_W8(tp, 0xF2, RTL_R8(tp, 0xF2) & ~BIT_3); - mdelay(2); - break; - } -} - -static u8 -rtl8125_is_gpio_low(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - u8 gpio_low = FALSE; - - switch (tp->HwSuppCheckPhyDisableModeVer) { - case 3: - if (!(rtl8125_mac_ocp_read(tp, 0xDC04) & BIT_13)) - gpio_low = TRUE; - break; - } - - if (gpio_low) - dprintk("gpio is low.\n"); - - return gpio_low; -} - -static u8 -rtl8125_is_phy_disable_mode_enabled(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - u8 phy_disable_mode_enabled = FALSE; - - switch (tp->HwSuppCheckPhyDisableModeVer) { - case 3: - if (RTL_R8(tp, 0xF2) & BIT_5) - phy_disable_mode_enabled = TRUE; - break; - } - - if (phy_disable_mode_enabled) - dprintk("phy disable mode enabled.\n"); - - return phy_disable_mode_enabled; -} - -static u8 -rtl8125_is_in_phy_disable_mode(struct net_device *dev) -{ - u8 in_phy_disable_mode = FALSE; - - if (rtl8125_is_phy_disable_mode_enabled(dev) && rtl8125_is_gpio_low(dev)) - in_phy_disable_mode = TRUE; - - if (in_phy_disable_mode) - dprintk("Hardware is in phy disable mode.\n"); - - return in_phy_disable_mode; -} - -static bool -rtl8125_stop_all_request(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - int i; - - RTL_W8(tp, ChipCmd, RTL_R8(tp, ChipCmd) | StopReq); - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_6: - for (i = 0; i < 20; i++) { - udelay(10); - if (!(RTL_R8(tp, ChipCmd) & StopReq)) break; - } - - if (i == 20) - return 0; - break; - } - - return 1; -} - -void -rtl8125_wait_txrx_fifo_empty(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - int i; - - switch (tp->mcfg) { - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_7: - rtl8125_stop_all_request(dev); - break; - } - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - for (i = 0; i < 3000; i++) { - udelay(50); - if ((RTL_R8(tp, MCUCmd_reg) & (Txfifo_empty | Rxfifo_empty)) == (Txfifo_empty | Rxfifo_empty)) - break; - } - break; - } - - switch (tp->mcfg) { - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_7: - for (i = 0; i < 3000; i++) { - udelay(50); - if ((RTL_R16(tp, IntrMitigate) & (BIT_0 | BIT_1 | BIT_8)) == (BIT_0 | BIT_1 | BIT_8)) - break; - } - break; - } -} - -#ifdef ENABLE_DASH_SUPPORT - -static inline void -rtl8125_enable_dash2_interrupt(struct rtl8125_private *tp) -{ - if (!tp->DASH) return; - - if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) { - RTL_CMAC_W8(tp, CMAC_IBIMR0, ( ISRIMR_DASH_TYPE2_ROK | ISRIMR_DASH_TYPE2_TOK | ISRIMR_DASH_TYPE2_TDU | ISRIMR_DASH_TYPE2_RDU | ISRIMR_DASH_TYPE2_RX_DISABLE_IDLE )); - } -} - -static inline void -rtl8125_disable_dash2_interrupt(struct rtl8125_private *tp) -{ - if (!tp->DASH) return; - - if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) { - RTL_CMAC_W8(tp, CMAC_IBIMR0, 0); - } -} -#endif - -void -rtl8125_enable_hw_linkchg_interrupt(struct rtl8125_private *tp) -{ - switch (tp->HwCurrIsrVer) { - case 2: - RTL_W32(tp, IMR_V2_SET_REG_8125, ISRIMR_V2_LINKCHG); - break; - case 1: - RTL_W32(tp, tp->imr_reg[0], LinkChg | RTL_R32(tp, tp->imr_reg[0])); - break; - } - -#ifdef ENABLE_DASH_SUPPORT - if (tp->DASH) - rtl8125_enable_dash2_interrupt(tp); -#endif -} - -static inline void -rtl8125_enable_hw_interrupt(struct rtl8125_private *tp) -{ - switch (tp->HwCurrIsrVer) { - case 2: - RTL_W32(tp, IMR_V2_SET_REG_8125, tp->intr_mask); - break; - case 1: - RTL_W32(tp, tp->imr_reg[0], tp->intr_mask); - - if (R8125_MULTI_RX_Q(tp)) { - int i; - for (i=1; inum_rx_rings; i++) - RTL_W16(tp, tp->imr_reg[i], other_q_intr_mask); - } - break; - } - -#ifdef ENABLE_DASH_SUPPORT - if (tp->DASH) - rtl8125_enable_dash2_interrupt(tp); -#endif -} - -static inline void rtl8125_clear_hw_isr_v2(struct rtl8125_private *tp, - u32 message_id) -{ - RTL_W32(tp, ISR_V2_8125, BIT(message_id)); -} - -static inline void -rtl8125_disable_hw_interrupt(struct rtl8125_private *tp) -{ - if (tp->HwCurrIsrVer == 2) { - RTL_W32(tp, IMR_V2_CLEAR_REG_8125, 0xFFFFFFFF); - } else { - RTL_W32(tp, tp->imr_reg[0], 0x0000); - - if (R8125_MULTI_RX_Q(tp)) { - int i; - for (i=1; inum_rx_rings; i++) - RTL_W16(tp, tp->imr_reg[i], 0); - } - -#ifdef ENABLE_DASH_SUPPORT - if (tp->DASH) - rtl8125_disable_dash2_interrupt(tp); -#endif - } -} - -static inline void -rtl8125_switch_to_hw_interrupt(struct rtl8125_private *tp) -{ - RTL_W32(tp, TIMER_INT0_8125, 0x0000); - - rtl8125_enable_hw_interrupt(tp); -} - -static inline void -rtl8125_switch_to_timer_interrupt(struct rtl8125_private *tp) -{ - if (tp->use_timer_interrrupt) { - RTL_W32(tp, TIMER_INT0_8125, timer_count); - RTL_W32(tp, TCTR0_8125, timer_count); - RTL_W32(tp, tp->imr_reg[0], tp->timer_intr_mask); - -#ifdef ENABLE_DASH_SUPPORT - if (tp->DASH) - rtl8125_enable_dash2_interrupt(tp); -#endif - } else { - rtl8125_switch_to_hw_interrupt(tp); - } -} - -static void -rtl8125_irq_mask_and_ack(struct rtl8125_private *tp) -{ - rtl8125_disable_hw_interrupt(tp); - - if (tp->HwCurrIsrVer == 2) { - RTL_W32(tp, ISR_V2_8125, 0xFFFFFFFF); - } else { -#ifdef ENABLE_DASH_SUPPORT - if (tp->DASH) { - if (tp->dash_printer_enabled) { - RTL_W32(tp, tp->isr_reg[0], RTL_R32(tp, tp->isr_reg[0]) & - ~(ISRIMR_DASH_INTR_EN | ISRIMR_DASH_INTR_CMAC_RESET)); - } else { - if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) { - RTL_CMAC_W8(tp, CMAC_IBISR0, RTL_CMAC_R8(tp, CMAC_IBISR0)); - } - } - } else { - RTL_W32(tp, tp->isr_reg[0], RTL_R32(tp, tp->isr_reg[0])); - } -#else - RTL_W32(tp, tp->isr_reg[0], RTL_R32(tp, tp->isr_reg[0])); -#endif - if (R8125_MULTI_RX_Q(tp)) { - int i; - for (i=1; inum_rx_rings; i++) - RTL_W16(tp, tp->isr_reg[i], RTL_R16(tp, tp->isr_reg[i])); - } - } -} - -static void -rtl8125_nic_reset(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - int i; - - RTL_W32(tp, RxConfig, (RX_DMA_BURST << RxCfgDMAShift)); - - rtl8125_enable_rxdvgate(dev); - - rtl8125_stop_all_request(dev); - - rtl8125_wait_txrx_fifo_empty(dev); - - mdelay(2); - - /* Soft reset the chip. */ - RTL_W8(tp, ChipCmd, CmdReset); - - /* Check that the chip has finished the reset. */ - for (i = 100; i > 0; i--) { - udelay(100); - if ((RTL_R8(tp, ChipCmd) & CmdReset) == 0) - break; - } -} - -static void -rtl8125_hw_set_interrupt_type(struct rtl8125_private *tp, u8 isr_ver) -{ - u8 tmp; - - switch (tp->HwSuppIsrVer) { - case 2: - tmp = RTL_R8(tp, INT_CFG0_8125); - tmp &= ~(INT_CFG0_ENABLE_8125); - if (isr_ver == 2) - tmp |= INT_CFG0_ENABLE_8125; - RTL_W8(tp, INT_CFG0_8125, tmp); - break; - } -} - -static void -rtl8125_hw_clear_timer_int(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - RTL_W32(tp, TIMER_INT0_8125, 0x0000); - RTL_W32(tp, TIMER_INT1_8125, 0x0000); - RTL_W32(tp, TIMER_INT2_8125, 0x0000); - RTL_W32(tp, TIMER_INT3_8125, 0x0000); - break; - } -} - -static void -rtl8125_hw_clear_int_miti(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - int i; - - switch (tp->HwSuppIntMitiVer) { - case 3: - //IntMITI_0-IntMITI_31 - for (i=0xA00; i<0xB00; i+=4) - RTL_W32(tp, i, 0x0000); - break; - case 4: - //IntMITI_0-IntMITI_15 - for (i = 0xA00; i < 0xA80; i += 4) - RTL_W32(tp, i, 0x0000); - - RTL_W8(tp, INT_CFG0_8125, RTL_R8(tp, INT_CFG0_8125) & - ~(INT_CFG0_TIMEOUT0_BYPASS_8125 | INT_CFG0_MITIGATION_BYPASS_8125)); - - RTL_W16(tp, INT_CFG1_8125, 0x0000); - break; - } -} - -void -rtl8125_hw_set_timer_int_8125(struct rtl8125_private *tp, - u32 message_id, - u8 timer_intmiti_val) -{ - switch (tp->HwSuppIntMitiVer) { - case 4: -#ifdef ENABLE_LIB_SUPPORT - if (message_id < R8125_MAX_RX_QUEUES_VEC_V3) - timer_intmiti_val = 0; -#else - if (tp->EnableRss && (message_id < R8125_MAX_RX_QUEUES_VEC_V3)) - timer_intmiti_val = 0; -#endif //ENABLE_LIB_SUPPORT - if (message_id < R8125_MAX_RX_QUEUES_VEC_V3) //ROK - RTL_W8(tp,INT_MITI_V2_0_RX + 8 * message_id, timer_intmiti_val); - else if (message_id == 16) //TOK - RTL_W8(tp,INT_MITI_V2_0_TX, timer_intmiti_val); - else if (message_id == 18) //TOK - RTL_W8(tp,INT_MITI_V2_1_TX, timer_intmiti_val); - break; - } -} - -void -rtl8125_hw_reset(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - rtl8125_lib_reset_prepare(tp); - - /* Disable interrupts */ - rtl8125_irq_mask_and_ack(tp); - - rtl8125_hw_clear_timer_int(dev); - - rtl8125_nic_reset(dev); -} - -static unsigned int -rtl8125_xmii_reset_pending(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - unsigned int retval; - - rtl8125_mdio_write(tp, 0x1f, 0x0000); - retval = rtl8125_mdio_read(tp, MII_BMCR) & BMCR_RESET; - - return retval; -} - -static unsigned int -rtl8125_xmii_link_ok(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - unsigned int retval; - - retval = (RTL_R16(tp, PHYstatus) & LinkStatus) ? 1 : 0; - - return retval; -} - -static int -rtl8125_wait_phy_reset_complete(struct rtl8125_private *tp) -{ - int i, val; - - for (i = 0; i < 2500; i++) { - val = rtl8125_mdio_read(tp, MII_BMCR) & BMCR_RESET; - if (!val) - return 0; - - mdelay(1); - } - - return -1; -} - -static void -rtl8125_xmii_reset_enable(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - if (rtl8125_is_in_phy_disable_mode(dev)) { - return; - } - - rtl8125_mdio_write(tp, 0x1f, 0x0000); - rtl8125_mdio_write(tp, MII_ADVERTISE, rtl8125_mdio_read(tp, MII_ADVERTISE) & - ~(ADVERTISE_10HALF | ADVERTISE_10FULL | - ADVERTISE_100HALF | ADVERTISE_100FULL)); - rtl8125_mdio_write(tp, MII_CTRL1000, rtl8125_mdio_read(tp, MII_CTRL1000) & - ~(ADVERTISE_1000HALF | ADVERTISE_1000FULL)); - mdio_direct_write_phy_ocp(tp, 0xA5D4, mdio_direct_read_phy_ocp(tp, 0xA5D4) & ~(RTK_ADVERTISE_2500FULL)); - rtl8125_mdio_write(tp, MII_BMCR, BMCR_RESET | BMCR_ANENABLE); - - if (rtl8125_wait_phy_reset_complete(tp) == 0) return; - - if (netif_msg_link(tp)) - printk(KERN_ERR "%s: PHY reset failed.\n", dev->name); -} - -void -rtl8125_init_ring_indexes(struct rtl8125_private *tp) -{ - int i; - - for (i = 0; i < tp->HwSuppNumTxQueues; i++) { - struct rtl8125_tx_ring *ring = &tp->tx_ring[i]; - ring->dirty_tx = ring->cur_tx = 0; - ring->NextHwDesCloPtr = 0; - ring->BeginHwDesCloPtr = 0; - ring->index = i; - ring->priv = tp; - } - - for (i = 0; i < tp->HwSuppNumRxQueues; i++) { - struct rtl8125_rx_ring *ring = &tp->rx_ring[i]; - ring->dirty_rx = ring->cur_rx = 0; - ring->index = i; - ring->priv = tp; - } - -#ifdef ENABLE_LIB_SUPPORT - for (i = 0; i < tp->HwSuppNumTxQueues; i++) { - struct rtl8125_ring *ring = &tp->lib_tx_ring[i]; - ring->direction = RTL8125_CH_DIR_TX; - ring->queue_num = i; - ring->private = tp; - } - - for (i = 0; i < tp->HwSuppNumRxQueues; i++) { - struct rtl8125_ring *ring = &tp->lib_rx_ring[i]; - ring->direction = RTL8125_CH_DIR_RX; - ring->queue_num = i; - ring->private = tp; - } -#endif -} - -static void -rtl8125_issue_offset_99_event(struct rtl8125_private *tp) -{ - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - rtl8125_mac_ocp_write(tp, 0xE09A, rtl8125_mac_ocp_read(tp, 0xE09A) | BIT_0); - break; - } -} - -#ifdef ENABLE_DASH_SUPPORT -static void -NICChkTypeEnableDashInterrupt(struct rtl8125_private *tp) -{ - if (tp->DASH) { - // - // even disconnected, enable 3 dash interrupt mask bits for in-band/out-band communication - // - if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) { - rtl8125_enable_dash2_interrupt(tp); - RTL_W16(tp, IntrMask, (ISRIMR_DASH_INTR_EN | ISRIMR_DASH_INTR_CMAC_RESET)); - } - } -} -#endif - -static int rtl8125_enable_eee_plus(struct rtl8125_private *tp) -{ - int ret; - - ret = 0; - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - rtl8125_mac_ocp_write(tp, 0xE080, rtl8125_mac_ocp_read(tp, 0xE080)|BIT_1); - break; - - default: -// dev_printk(KERN_DEBUG, tp_to_dev(tp), "Not Support EEEPlus\n"); - ret = -EOPNOTSUPP; - break; - } - - return ret; -} - -static int rtl8125_disable_eee_plus(struct rtl8125_private *tp) -{ - int ret; - - ret = 0; - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - rtl8125_mac_ocp_write(tp, 0xE080, rtl8125_mac_ocp_read(tp, 0xE080)&~BIT_1); - break; - - default: -// dev_printk(KERN_DEBUG, tp_to_dev(tp), "Not Support EEEPlus\n"); - ret = -EOPNOTSUPP; - break; - } - - return ret; -} - -static void -rtl8125_link_on_patch(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - rtl8125_hw_config(dev); - - if ((tp->mcfg == CFG_METHOD_2) && - netif_running(dev)) { - if (RTL_R16(tp, PHYstatus)&FullDup) - RTL_W32(tp, TxConfig, (RTL_R32(tp, TxConfig) | (BIT_24 | BIT_25)) & ~BIT_19); - else - RTL_W32(tp, TxConfig, (RTL_R32(tp, TxConfig) | BIT_25) & ~(BIT_19 | BIT_24)); - } - - if ((tp->mcfg == CFG_METHOD_2 || - tp->mcfg == CFG_METHOD_3 || - tp->mcfg == CFG_METHOD_4 || - tp->mcfg == CFG_METHOD_5 || - tp->mcfg == CFG_METHOD_6 || - tp->mcfg == CFG_METHOD_7) && - (RTL_R8(tp, PHYstatus) & _10bps)) - rtl8125_enable_eee_plus(tp); - - rtl8125_hw_start(dev); - - netif_carrier_on(dev); - - netif_tx_wake_all_queues(dev); - - tp->phy_reg_aner = rtl8125_mdio_read(tp, MII_EXPANSION); - tp->phy_reg_anlpar = rtl8125_mdio_read(tp, MII_LPA); - tp->phy_reg_gbsr = rtl8125_mdio_read(tp, MII_STAT1000); - tp->phy_reg_status_2500 = mdio_direct_read_phy_ocp(tp, 0xA5D6); -} - -static void -rtl8125_link_down_patch(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - tp->phy_reg_aner = 0; - tp->phy_reg_anlpar = 0; - tp->phy_reg_gbsr = 0; - tp->phy_reg_status_2500 = 0; - - if (tp->mcfg == CFG_METHOD_2 || - tp->mcfg == CFG_METHOD_3 || - tp->mcfg == CFG_METHOD_4 || - tp->mcfg == CFG_METHOD_5 || - tp->mcfg == CFG_METHOD_6 || - tp->mcfg == CFG_METHOD_7) - rtl8125_disable_eee_plus(tp); - - netif_tx_stop_all_queues(dev); - - netif_carrier_off(dev); - - rtl8125_hw_reset(dev); - - rtl8125_tx_clear(tp); - - rtl8125_rx_clear(tp); - - rtl8125_init_ring(dev); - - rtl8125_enable_hw_linkchg_interrupt(tp); - - //rtl8125_set_speed(dev, tp->autoneg, tp->speed, tp->duplex, tp->advertising); - -#ifdef ENABLE_DASH_SUPPORT - if (tp->DASH) { - NICChkTypeEnableDashInterrupt(tp); - } -#endif -} - -static void -_rtl8125_check_link_status(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - if (tp->link_ok(dev)) { - rtl8125_link_on_patch(dev); - - if (netif_msg_ifup(tp)) - printk(KERN_INFO PFX "%s: link up\n", dev->name); - } else { - if (netif_msg_ifdown(tp)) - printk(KERN_INFO PFX "%s: link down\n", dev->name); - - rtl8125_link_down_patch(dev); - } -} - -static void -rtl8125_check_link_status(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - _rtl8125_check_link_status(dev); - - tp->resume_not_chg_speed = 0; -} - -static void -rtl8125_link_option_giga(u8 *aut, - u32 *spd, - u8 *dup, - u32 *adv) -{ - if ((*spd != SPEED_1000) && - (*spd != SPEED_100) && - (*spd != SPEED_10)) - *spd = SPEED_1000; - - if ((*dup != DUPLEX_FULL) && (*dup != DUPLEX_HALF)) - *dup = DUPLEX_FULL; - - if ((*aut != AUTONEG_ENABLE) && (*aut != AUTONEG_DISABLE)) - *aut = AUTONEG_ENABLE; - - *adv &= (ADVERTISED_10baseT_Half | - ADVERTISED_10baseT_Full | - ADVERTISED_100baseT_Half | - ADVERTISED_100baseT_Full | - ADVERTISED_1000baseT_Half | - ADVERTISED_1000baseT_Full); - if (*adv == 0) - *adv = (ADVERTISED_10baseT_Half | - ADVERTISED_10baseT_Full | - ADVERTISED_100baseT_Half | - ADVERTISED_100baseT_Full | - ADVERTISED_1000baseT_Half | - ADVERTISED_1000baseT_Full); -} - -static void -rtl8125_link_option(u8 *aut, - u32 *spd, - u8 *dup, - u32 *adv) -{ - if ((*spd != SPEED_2500) && (*spd != SPEED_1000) && - (*spd != SPEED_100) && (*spd != SPEED_10)) - *spd = SPEED_2500; - - if ((*dup != DUPLEX_FULL) && (*dup != DUPLEX_HALF)) - *dup = DUPLEX_FULL; - - if ((*aut != AUTONEG_ENABLE) && (*aut != AUTONEG_DISABLE)) - *aut = AUTONEG_ENABLE; - - *adv &= (ADVERTISED_10baseT_Half | - ADVERTISED_10baseT_Full | - ADVERTISED_100baseT_Half | - ADVERTISED_100baseT_Full | - ADVERTISED_1000baseT_Half | - ADVERTISED_1000baseT_Full | - ADVERTISED_2500baseX_Full); - if (*adv == 0) - *adv = (ADVERTISED_10baseT_Half | - ADVERTISED_10baseT_Full | - ADVERTISED_100baseT_Half | - ADVERTISED_100baseT_Full | - ADVERTISED_1000baseT_Half | - ADVERTISED_1000baseT_Full | - ADVERTISED_2500baseX_Full); -} - -/* -static void -rtl8125_enable_ocp_phy_power_saving(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - u16 val; - - if (tp->mcfg == CFG_METHOD_2 || - tp->mcfg == CFG_METHOD_3 || - tp->mcfg == CFG_METHOD_4 || - tp->mcfg == CFG_METHOD_5 || - tp->mcfg == CFG_METHOD_6 || - tp->mcfg == CFG_METHOD_7) { - val = mdio_direct_read_phy_ocp(tp, 0xC416); - if (val != 0x0050) { - rtl8125_set_phy_mcu_patch_request(tp); - mdio_direct_write_phy_ocp(tp, 0xC416, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xC416, 0x0050); - rtl8125_clear_phy_mcu_patch_request(tp); - } - } -} -*/ - -static void -rtl8125_disable_ocp_phy_power_saving(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - u16 val; - - if (tp->mcfg == CFG_METHOD_2 || - tp->mcfg == CFG_METHOD_3 || - tp->mcfg == CFG_METHOD_4 || - tp->mcfg == CFG_METHOD_5 || - tp->mcfg == CFG_METHOD_6 || - tp->mcfg == CFG_METHOD_7) { - val = mdio_direct_read_phy_ocp(tp, 0xC416); - if (val != 0x0500) { - rtl8125_set_phy_mcu_patch_request(tp); - mdio_direct_write_phy_ocp(tp, 0xC416, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xC416, 0x0500); - rtl8125_clear_phy_mcu_patch_request(tp); - } - } -} - -static void -rtl8125_wait_ll_share_fifo_ready(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - int i; - - for (i = 0; i < 10; i++) { - udelay(100); - if (RTL_R16(tp, 0xD2) & BIT_9) - break; - } -} - -static void -rtl8125_disable_pci_offset_99(struct rtl8125_private *tp) -{ - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - rtl8125_mac_ocp_write(tp, 0xE032, rtl8125_mac_ocp_read(tp, 0xE032) & ~(BIT_0 | BIT_1)); - break; - } - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - rtl8125_csi_fun0_write_byte(tp, 0x99, 0x00); - break; - } -} - -static void -rtl8125_enable_pci_offset_99(struct rtl8125_private *tp) -{ - u32 csi_tmp; - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - rtl8125_csi_fun0_write_byte(tp, 0x99, tp->org_pci_offset_99); - break; - } - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - csi_tmp = rtl8125_mac_ocp_read(tp, 0xE032); - csi_tmp &= ~(BIT_0 | BIT_1); - if (tp->org_pci_offset_99 & (BIT_5 | BIT_6)) - csi_tmp |= BIT_1; - if (tp->org_pci_offset_99 & BIT_2) - csi_tmp |= BIT_0; - rtl8125_mac_ocp_write(tp, 0xE032, csi_tmp); - break; - } -} - -static void -rtl8125_init_pci_offset_99(struct rtl8125_private *tp) -{ - u32 csi_tmp; - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - rtl8125_mac_ocp_write(tp, 0xCDD0, 0x9003); - csi_tmp = rtl8125_mac_ocp_read(tp, 0xE034); - csi_tmp |= (BIT_15 | BIT_14); - rtl8125_mac_ocp_write(tp, 0xE034, csi_tmp); - rtl8125_mac_ocp_write(tp, 0xCDD2, 0x889C); - rtl8125_mac_ocp_write(tp, 0xCDD8, 0x9003); - rtl8125_mac_ocp_write(tp, 0xCDD4, 0x8C30); - rtl8125_mac_ocp_write(tp, 0xCDDA, 0x9003); - rtl8125_mac_ocp_write(tp, 0xCDD6, 0x9003); - rtl8125_mac_ocp_write(tp, 0xCDDC, 0x9003); - rtl8125_mac_ocp_write(tp, 0xCDE8, 0x883E); - rtl8125_mac_ocp_write(tp, 0xCDEA, 0x9003); - rtl8125_mac_ocp_write(tp, 0xCDEC, 0x889C); - rtl8125_mac_ocp_write(tp, 0xCDEE, 0x9003); - rtl8125_mac_ocp_write(tp, 0xCDF0, 0x8C09); - rtl8125_mac_ocp_write(tp, 0xCDF2, 0x9003); - csi_tmp = rtl8125_mac_ocp_read(tp, 0xE032); - csi_tmp |= (BIT_14); - rtl8125_mac_ocp_write(tp, 0xE032, csi_tmp); - csi_tmp = rtl8125_mac_ocp_read(tp, 0xE0A2); - csi_tmp |= (BIT_0); - rtl8125_mac_ocp_write(tp, 0xE0A2, csi_tmp); - break; - } - - rtl8125_enable_pci_offset_99(tp); -} - -static void -rtl8125_disable_pci_offset_180(struct rtl8125_private *tp) -{ - u32 csi_tmp; - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - csi_tmp = rtl8125_mac_ocp_read(tp, 0xE092); - csi_tmp &= 0xFF00; - rtl8125_mac_ocp_write(tp, 0xE092, csi_tmp); - break; - } -} - -static void -rtl8125_enable_pci_offset_180(struct rtl8125_private *tp) -{ - u32 csi_tmp; - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - csi_tmp = rtl8125_mac_ocp_read(tp, 0xE094); - csi_tmp &= 0x00FF; - rtl8125_mac_ocp_write(tp, 0xE094, csi_tmp); - break; - } - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - csi_tmp = rtl8125_mac_ocp_read(tp, 0xE092); - csi_tmp &= 0xFF00; - csi_tmp |= BIT_2; - rtl8125_mac_ocp_write(tp, 0xE092, csi_tmp); - break; - } -} - -static void -rtl8125_init_pci_offset_180(struct rtl8125_private *tp) -{ - if (tp->org_pci_offset_180 & (BIT_0|BIT_1)) - rtl8125_enable_pci_offset_180(tp); - else - rtl8125_disable_pci_offset_180(tp); -} - -static void -rtl8125_set_pci_99_180_exit_driver_para(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - if (tp->org_pci_offset_99 & BIT_2) - rtl8125_issue_offset_99_event(tp); - rtl8125_disable_pci_offset_99(tp); - break; - } - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - rtl8125_disable_pci_offset_180(tp); - break; - } -} - -static void -rtl8125_enable_cfg9346_write(struct rtl8125_private *tp) -{ - RTL_W8(tp, Cfg9346, RTL_R8(tp, Cfg9346) | Cfg9346_Unlock); -} - -static void -rtl8125_disable_cfg9346_write(struct rtl8125_private *tp) -{ - RTL_W8(tp, Cfg9346, RTL_R8(tp, Cfg9346) & ~Cfg9346_Unlock); -} - -static void -rtl8125_enable_exit_l1_mask(struct rtl8125_private *tp) -{ - //(1)ERI(0xD4)(OCP 0xC0AC).bit[7:12]=6'b111111, L1 Mask - SetMcuAccessRegBit(tp, 0xC0AC, (BIT_7 | BIT_8 | BIT_9 | BIT_10 | BIT_11 | BIT_12)); -} - -static void -rtl8125_disable_exit_l1_mask(struct rtl8125_private *tp) -{ - //(1)ERI(0xD4)(OCP 0xC0AC).bit[7:12]=6'b000000, L1 Mask - ClearMcuAccessRegBit(tp, 0xC0AC, (BIT_7 | BIT_8 | BIT_9 | BIT_10 | BIT_11 | BIT_12)); -} - -static void -rtl8125_enable_extend_tally_couter(struct rtl8125_private *tp) -{ - switch (tp->HwSuppExtendTallyCounterVer) { - case 1: - SetMcuAccessRegBit(tp, 0xEA84, (BIT_1 | BIT_0)); - break; - } -} - -static void -rtl8125_disable_extend_tally_couter(struct rtl8125_private *tp) -{ - switch (tp->HwSuppExtendTallyCounterVer) { - case 1: - ClearMcuAccessRegBit(tp, 0xEA84, (BIT_1 | BIT_0)); - break; - } -} - -static void -rtl8125_hw_d3_para(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - RTL_W16(tp, RxMaxSize, RX_BUF_SIZE); - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - RTL_W8(tp, 0xF1, RTL_R8(tp, 0xF1) & ~BIT_7); - rtl8125_enable_cfg9346_write(tp); - RTL_W8(tp, Config2, RTL_R8(tp, Config2) & ~BIT_7); - RTL_W8(tp, Config5, RTL_R8(tp, Config5) & ~BIT_0); - rtl8125_disable_cfg9346_write(tp); - break; - } - - rtl8125_disable_exit_l1_mask(tp); - -#ifdef ENABLE_REALWOW_SUPPORT - rtl8125_set_realwow_d3_para(dev); -#endif - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - rtl8125_mac_ocp_write(tp, 0xEA18, 0x0064); - break; - } - - rtl8125_set_pci_99_180_exit_driver_para(dev); - - /*disable ocp phy power saving*/ - if (tp->mcfg == CFG_METHOD_2 || - tp->mcfg == CFG_METHOD_3 || - tp->mcfg == CFG_METHOD_4 || - tp->mcfg == CFG_METHOD_5 || - tp->mcfg == CFG_METHOD_6 || - tp->mcfg == CFG_METHOD_7) - rtl8125_disable_ocp_phy_power_saving(dev); - - rtl8125_disable_rxdvgate(dev); - - rtl8125_disable_extend_tally_couter(tp); -} - -static void -rtl8125_enable_magic_packet(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - switch (tp->HwSuppMagicPktVer) { - case WAKEUP_MAGIC_PACKET_V3: - rtl8125_mac_ocp_write(tp, 0xC0B6, rtl8125_mac_ocp_read(tp, 0xC0B6) | BIT_0); - break; - } -} -static void -rtl8125_disable_magic_packet(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - switch (tp->HwSuppMagicPktVer) { - case WAKEUP_MAGIC_PACKET_V3: - rtl8125_mac_ocp_write(tp, 0xC0B6, rtl8125_mac_ocp_read(tp, 0xC0B6) & ~BIT_0); - break; - } -} - -static void -rtl8125_enable_linkchg_wakeup(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - switch (tp->HwSuppLinkChgWakeUpVer) { - case 3: - RTL_W8(tp, Config3, RTL_R8(tp, Config3) | LinkUp); - ClearAndSetMcuAccessRegBit(tp, 0xE0C6, (BIT_5 | BIT_3 | BIT_2), (BIT_4 | BIT_1 | BIT_0)); - break; - } -} - -static void -rtl8125_disable_linkchg_wakeup(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - switch (tp->HwSuppLinkChgWakeUpVer) { - case 3: - RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~LinkUp); - ClearMcuAccessRegBit(tp, 0xE0C6, (BIT_5 | BIT_4 | BIT_3 | BIT_2 | BIT_1 | BIT_0)); - break; - } -} - -#define WAKE_ANY (WAKE_PHY | WAKE_MAGIC | WAKE_UCAST | WAKE_BCAST | WAKE_MCAST) - -static u32 -rtl8125_get_hw_wol(struct rtl8125_private *tp) -{ - u8 options; - u32 csi_tmp; - u32 wol_opts = 0; - - if (disable_pm_support) - goto out; - - options = RTL_R8(tp, Config1); - if (!(options & PMEnable)) - goto out; - - options = RTL_R8(tp, Config3); - if (options & LinkUp) - wol_opts |= WAKE_PHY; - - switch (tp->HwSuppMagicPktVer) { - case WAKEUP_MAGIC_PACKET_V3: - csi_tmp = rtl8125_mac_ocp_read(tp, 0xC0B6); - if (csi_tmp & BIT_0) - wol_opts |= WAKE_MAGIC; - break; - } - - options = RTL_R8(tp, Config5); - if (options & UWF) - wol_opts |= WAKE_UCAST; - if (options & BWF) - wol_opts |= WAKE_BCAST; - if (options & MWF) - wol_opts |= WAKE_MCAST; - -out: - return wol_opts; -} - -static void -rtl8125_enable_d0_speedup(struct rtl8125_private *tp) -{ - if (FALSE == HW_SUPPORT_D0_SPEED_UP(tp)) return; - if (tp->D0SpeedUpSpeed == D0_SPEED_UP_SPEED_DISABLE) return; - - if (tp->HwSuppD0SpeedUpVer == 1) { - u16 mac_ocp_data; - - RTL_W8(tp, 0xD0, RTL_R8(tp, 0xD0) | BIT_3); - - //speed up speed - mac_ocp_data = rtl8125_mac_ocp_read(tp, 0xE10A); - mac_ocp_data &= ~(BIT_10 | BIT_9 | BIT_8 | BIT_7); - if (tp->D0SpeedUpSpeed == D0_SPEED_UP_SPEED_2500) { - mac_ocp_data |= BIT_7; - } - rtl8125_mac_ocp_write(tp, 0xE10A, mac_ocp_data); - - //speed up flowcontrol - mac_ocp_data = rtl8125_mac_ocp_read(tp, 0xE860); - mac_ocp_data |= (BIT_15 | BIT_14); - rtl8125_mac_ocp_write(tp, 0xE860, mac_ocp_data); - } -} - -static void -rtl8125_disable_d0_speedup(struct rtl8125_private *tp) -{ - if (FALSE == HW_SUPPORT_D0_SPEED_UP(tp)) return; - - if (tp->HwSuppD0SpeedUpVer == 1) - RTL_W8(tp, 0xD0, RTL_R8(tp, 0xD0) & ~BIT_7); -} - -static void -rtl8125_set_hw_wol(struct net_device *dev, u32 wolopts) -{ - struct rtl8125_private *tp = netdev_priv(dev); - int i,tmp; - static struct { - u32 opt; - u16 reg; - u8 mask; - } cfg[] = { - { WAKE_PHY, Config3, LinkUp }, - { WAKE_UCAST, Config5, UWF }, - { WAKE_BCAST, Config5, BWF }, - { WAKE_MCAST, Config5, MWF }, - { WAKE_ANY, Config5, LanWake }, - { WAKE_MAGIC, Config3, MagicPacket }, - }; - - switch (tp->HwSuppMagicPktVer) { - case WAKEUP_MAGIC_PACKET_V3: - default: - tmp = ARRAY_SIZE(cfg) - 1; - - if (wolopts & WAKE_MAGIC) - rtl8125_enable_magic_packet(dev); - else - rtl8125_disable_magic_packet(dev); - break; - } - - rtl8125_enable_cfg9346_write(tp); - - for (i = 0; i < tmp; i++) { - u8 options = RTL_R8(tp, cfg[i].reg) & ~cfg[i].mask; - if (wolopts & cfg[i].opt) - options |= cfg[i].mask; - RTL_W8(tp, cfg[i].reg, options); - } - - switch (tp->HwSuppLinkChgWakeUpVer) { - case 3: - if (wolopts & WAKE_PHY) - rtl8125_enable_linkchg_wakeup(dev); - else - rtl8125_disable_linkchg_wakeup(dev); - break; - } - - rtl8125_disable_cfg9346_write(tp); -} - -static void -rtl8125_phy_restart_nway(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - if (rtl8125_is_in_phy_disable_mode(dev)) return; - - rtl8125_mdio_write(tp, 0x1F, 0x0000); - rtl8125_mdio_write(tp, MII_BMCR, BMCR_ANENABLE | BMCR_ANRESTART); -} - -static void -rtl8125_phy_setup_force_mode(struct net_device *dev, u32 speed, u8 duplex) -{ - struct rtl8125_private *tp = netdev_priv(dev); - u16 bmcr_true_force = 0; - - if (rtl8125_is_in_phy_disable_mode(dev)) return; - - if ((speed == SPEED_10) && (duplex == DUPLEX_HALF)) { - bmcr_true_force = BMCR_SPEED10; - } else if ((speed == SPEED_10) && (duplex == DUPLEX_FULL)) { - bmcr_true_force = BMCR_SPEED10 | BMCR_FULLDPLX; - } else if ((speed == SPEED_100) && (duplex == DUPLEX_HALF)) { - bmcr_true_force = BMCR_SPEED100; - } else if ((speed == SPEED_100) && (duplex == DUPLEX_FULL)) { - bmcr_true_force = BMCR_SPEED100 | BMCR_FULLDPLX; - } else { - netif_err(tp, drv, dev, "Failed to set phy force mode!\n"); - return; - } - - rtl8125_mdio_write(tp, 0x1F, 0x0000); - rtl8125_mdio_write(tp, MII_BMCR, bmcr_true_force); -} - -static void -rtl8125_set_pci_pme(struct rtl8125_private *tp, int set) -{ - struct pci_dev *pdev = tp->pci_dev; - u16 pmc; - - if (!pdev->pm_cap) - return; - - pci_read_config_word(pdev, pdev->pm_cap + PCI_PM_CTRL, &pmc); - pmc |= PCI_PM_CTRL_PME_STATUS; - if (set) - pmc |= PCI_PM_CTRL_PME_ENABLE; - else - pmc &= ~PCI_PM_CTRL_PME_ENABLE; - pci_write_config_word(pdev, pdev->pm_cap + PCI_PM_CTRL, pmc); -} - -static void -rtl8125_set_wol_link_speed(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - int auto_nego; - int giga_ctrl; - int ctrl_2500; - u32 adv; - u16 anlpar; - u16 gbsr; - u16 status_2500; - u16 aner; - - if (tp->autoneg != AUTONEG_ENABLE) - goto exit; - - rtl8125_mdio_write(tp, 0x1F, 0x0000); - - auto_nego = rtl8125_mdio_read(tp, MII_ADVERTISE); - auto_nego &= ~(ADVERTISE_10HALF | ADVERTISE_10FULL - | ADVERTISE_100HALF | ADVERTISE_100FULL); - - giga_ctrl = rtl8125_mdio_read(tp, MII_CTRL1000); - giga_ctrl &= ~(ADVERTISE_1000HALF | ADVERTISE_1000FULL); - - ctrl_2500 = mdio_direct_read_phy_ocp(tp, 0xA5D4); - ctrl_2500 &= ~(RTK_ADVERTISE_2500FULL); - - aner = anlpar = gbsr = status_2500 = 0; - if (tp->link_ok(dev)) { - aner = rtl8125_mdio_read(tp, MII_EXPANSION); - anlpar = rtl8125_mdio_read(tp, MII_LPA); - gbsr = rtl8125_mdio_read(tp, MII_STAT1000); - status_2500 = mdio_direct_read_phy_ocp(tp, 0xA5D6); - } else { - if (netif_running(dev)) { - aner = tp->phy_reg_aner; - anlpar = tp->phy_reg_anlpar; - gbsr = tp->phy_reg_gbsr; - status_2500 = tp->phy_reg_status_2500; - } - } - - if ((aner | anlpar | gbsr | status_2500) == 0) { - int auto_nego_tmp = 0; - adv = tp->advertising; - if ((adv & ADVERTISED_10baseT_Half) && (anlpar & LPA_10HALF)) - auto_nego_tmp |= ADVERTISE_10HALF; - if ((adv & ADVERTISED_10baseT_Full) && (anlpar & LPA_10FULL)) - auto_nego_tmp |= ADVERTISE_10FULL; - if ((adv & ADVERTISED_100baseT_Half) && (anlpar & LPA_100HALF)) - auto_nego_tmp |= ADVERTISE_100HALF; - if ((adv & ADVERTISED_100baseT_Full) && (anlpar & LPA_100FULL)) - auto_nego_tmp |= ADVERTISE_100FULL; - - if (auto_nego_tmp == 0) goto exit; - - auto_nego |= auto_nego_tmp; - goto skip_check_lpa; - } - if (!(aner & EXPANSION_NWAY)) goto exit; - - adv = tp->advertising; - if ((adv & ADVERTISED_10baseT_Half) && (anlpar & LPA_10HALF)) - auto_nego |= ADVERTISE_10HALF; - else if ((adv & ADVERTISED_10baseT_Full) && (anlpar & LPA_10FULL)) - auto_nego |= ADVERTISE_10FULL; - else if ((adv & ADVERTISED_100baseT_Half) && (anlpar & LPA_100HALF)) - auto_nego |= ADVERTISE_100HALF; - else if ((adv & ADVERTISED_100baseT_Full) && (anlpar & LPA_100FULL)) - auto_nego |= ADVERTISE_100FULL; - else if (adv & ADVERTISED_1000baseT_Half && (gbsr & LPA_1000HALF)) - giga_ctrl |= ADVERTISE_1000HALF; - else if (adv & ADVERTISED_1000baseT_Full && (gbsr & LPA_1000FULL)) - giga_ctrl |= ADVERTISE_1000FULL; - else if (adv & ADVERTISED_2500baseX_Full && (status_2500 & RTK_LPA_ADVERTISE_2500FULL)) - ctrl_2500 |= RTK_ADVERTISE_2500FULL; - else - goto exit; - -skip_check_lpa: - if (tp->DASH) - auto_nego |= (ADVERTISE_100FULL | ADVERTISE_100HALF | ADVERTISE_10HALF | ADVERTISE_10FULL); - -#ifdef CONFIG_DOWN_SPEED_100 - auto_nego |= (ADVERTISE_100FULL | ADVERTISE_100HALF | ADVERTISE_10HALF | ADVERTISE_10FULL); -#endif - - rtl8125_mdio_write(tp, MII_ADVERTISE, auto_nego); - rtl8125_mdio_write(tp, MII_CTRL1000, giga_ctrl); - mdio_direct_write_phy_ocp(tp, 0xA5D4, ctrl_2500); - - rtl8125_phy_restart_nway(dev); - -exit: - return; -} - -static bool -rtl8125_keep_wol_link_speed(struct net_device *dev, u8 from_suspend) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - if ((from_suspend && !tp->link_ok(dev)) || - (!from_suspend && tp->resume_not_chg_speed)) - return 1; - - return 0; -} -static void -rtl8125_powerdown_pll(struct net_device *dev, u8 from_suspend) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - tp->check_keep_link_speed = 0; - if (tp->wol_enabled == WOL_ENABLED || tp->DASH || tp->EnableKCPOffload) { - rtl8125_set_hw_wol(dev, tp->wol_opts); - - if (tp->mcfg == CFG_METHOD_2 || - tp->mcfg == CFG_METHOD_3 || - tp->mcfg == CFG_METHOD_4 || - tp->mcfg == CFG_METHOD_5 || - tp->mcfg == CFG_METHOD_6 || - tp->mcfg == CFG_METHOD_7) { - rtl8125_enable_cfg9346_write(tp); - RTL_W8(tp, Config2, RTL_R8(tp, Config2) | PMSTS_En); - rtl8125_disable_cfg9346_write(tp); - } - - /* Enable the PME and clear the status */ - rtl8125_set_pci_pme(tp, 1); - - if (rtl8125_keep_wol_link_speed(dev, from_suspend)) { - if (tp->wol_opts & WAKE_PHY) - tp->check_keep_link_speed = 1; - } else { - if (HW_SUPPORT_D0_SPEED_UP(tp)) { - rtl8125_enable_d0_speedup(tp); - tp->check_keep_link_speed = 1; - } - - rtl8125_set_wol_link_speed(dev); - } - - RTL_W32(tp, RxConfig, RTL_R32(tp, RxConfig) | AcceptBroadcast | AcceptMulticast | AcceptMyPhys); - - return; - } - - if (tp->DASH) - return; - - rtl8125_phy_power_down(dev); - - if (!tp->HwIcVerUnknown) { - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - RTL_W8(tp, PMCH, RTL_R8(tp, PMCH) & ~BIT_7); - break; - } - } - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - RTL_W8(tp, 0xF2, RTL_R8(tp, 0xF2) & ~BIT_6); - break; - } -} - -static void rtl8125_powerup_pll(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - RTL_W8(tp, PMCH, RTL_R8(tp, PMCH) | BIT_7 | BIT_6); - break; - } - - if (tp->resume_not_chg_speed) return; - - rtl8125_phy_power_up(dev); -} - -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22) -static void -rtl8125_get_wol(struct net_device *dev, - struct ethtool_wolinfo *wol) -{ - struct rtl8125_private *tp = netdev_priv(dev); - u8 options; - - wol->wolopts = 0; - - if (tp->mcfg == CFG_METHOD_DEFAULT || disable_pm_support) { - wol->supported = 0; - return; - } else { - wol->supported = WAKE_ANY; - } - - options = RTL_R8(tp, Config1); - if (!(options & PMEnable)) - return; - - wol->wolopts = tp->wol_opts; -} - -static int -rtl8125_set_wol(struct net_device *dev, - struct ethtool_wolinfo *wol) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - if (tp->mcfg == CFG_METHOD_DEFAULT || disable_pm_support) - return -EOPNOTSUPP; - - tp->wol_opts = wol->wolopts; - - tp->wol_enabled = (tp->wol_opts) ? WOL_ENABLED : WOL_DISABLED; - - device_set_wakeup_enable(tp_to_dev(tp), wol->wolopts); - - return 0; -} - -static void -rtl8125_get_drvinfo(struct net_device *dev, - struct ethtool_drvinfo *info) -{ - struct rtl8125_private *tp = netdev_priv(dev); - struct rtl8125_fw *rtl_fw = tp->rtl_fw; - - strcpy(info->driver, MODULENAME); - strcpy(info->version, RTL8125_VERSION); - strcpy(info->bus_info, pci_name(tp->pci_dev)); - info->regdump_len = R8125_REGS_DUMP_SIZE; - info->eedump_len = tp->eeprom_len; - BUILD_BUG_ON(sizeof(info->fw_version) < sizeof(rtl_fw->version)); - if (rtl_fw) - strlcpy(info->fw_version, rtl_fw->version, - sizeof(info->fw_version)); -} - -static int -rtl8125_get_regs_len(struct net_device *dev) -{ - return R8125_REGS_DUMP_SIZE; -} -#endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22) - -static void -rtl8125_set_d0_speedup_speed(struct rtl8125_private *tp) -{ - if (FALSE == HW_SUPPORT_D0_SPEED_UP(tp)) return; - - tp->D0SpeedUpSpeed = D0_SPEED_UP_SPEED_DISABLE; - if (tp->autoneg == AUTONEG_ENABLE) { - if (tp->speed == SPEED_2500) - tp->D0SpeedUpSpeed = D0_SPEED_UP_SPEED_2500; - else if(tp->speed == SPEED_1000) - tp->D0SpeedUpSpeed = D0_SPEED_UP_SPEED_1000; - } -} - -static int -rtl8125_set_speed_xmii(struct net_device *dev, - u8 autoneg, - u32 speed, - u8 duplex, - u32 adv) -{ - struct rtl8125_private *tp = netdev_priv(dev); - int auto_nego = 0; - int giga_ctrl = 0; - int ctrl_2500 = 0; - int rc = -EINVAL; - - //Disable Giga Lite - ClearEthPhyOcpBit(tp, 0xA428, BIT_9); - ClearEthPhyOcpBit(tp, 0xA5EA, BIT_0); - - if (speed != SPEED_2500 && - (speed != SPEED_1000) && - (speed != SPEED_100) && - (speed != SPEED_10)) { - speed = SPEED_2500; - duplex = DUPLEX_FULL; - } - - giga_ctrl = rtl8125_mdio_read(tp, MII_CTRL1000); - giga_ctrl &= ~(ADVERTISE_1000HALF | ADVERTISE_1000FULL); - ctrl_2500 = mdio_direct_read_phy_ocp(tp, 0xA5D4); - ctrl_2500 &= ~(RTK_ADVERTISE_2500FULL); - - if (autoneg == AUTONEG_ENABLE) { - /*n-way force*/ - auto_nego = rtl8125_mdio_read(tp, MII_ADVERTISE); - auto_nego &= ~(ADVERTISE_10HALF | ADVERTISE_10FULL | - ADVERTISE_100HALF | ADVERTISE_100FULL | - ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM); - - if (adv & ADVERTISED_10baseT_Half) - auto_nego |= ADVERTISE_10HALF; - if (adv & ADVERTISED_10baseT_Full) - auto_nego |= ADVERTISE_10FULL; - if (adv & ADVERTISED_100baseT_Half) - auto_nego |= ADVERTISE_100HALF; - if (adv & ADVERTISED_100baseT_Full) - auto_nego |= ADVERTISE_100FULL; - if (adv & ADVERTISED_1000baseT_Half) - giga_ctrl |= ADVERTISE_1000HALF; - if (adv & ADVERTISED_1000baseT_Full) - giga_ctrl |= ADVERTISE_1000FULL; - if (adv & ADVERTISED_2500baseX_Full) - ctrl_2500 |= RTK_ADVERTISE_2500FULL; - - //flow control - if (dev->mtu <= ETH_DATA_LEN && tp->fcpause == rtl8125_fc_full) - auto_nego |= ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM; - - tp->phy_auto_nego_reg = auto_nego; - tp->phy_1000_ctrl_reg = giga_ctrl; - - tp->phy_2500_ctrl_reg = ctrl_2500; - - rtl8125_mdio_write(tp, 0x1f, 0x0000); - rtl8125_mdio_write(tp, MII_ADVERTISE, auto_nego); - rtl8125_mdio_write(tp, MII_CTRL1000, giga_ctrl); - mdio_direct_write_phy_ocp(tp, 0xA5D4, ctrl_2500); - rtl8125_phy_restart_nway(dev); - mdelay(20); - } else { - /*true force*/ - if (speed == SPEED_10 || speed == SPEED_100) - rtl8125_phy_setup_force_mode(dev, speed, duplex); - else - goto out; - } - - tp->autoneg = autoneg; - tp->speed = speed; - tp->duplex = duplex; - tp->advertising = adv; - - rtl8125_set_d0_speedup_speed(tp); - - rc = 0; -out: - return rc; -} - -static int -rtl8125_set_speed(struct net_device *dev, - u8 autoneg, - u32 speed, - u8 duplex, - u32 adv) -{ - struct rtl8125_private *tp = netdev_priv(dev); - int ret; - - if (tp->resume_not_chg_speed) return 0; - - ret = tp->set_speed(dev, autoneg, speed, duplex, adv); - - return ret; -} - -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22) -static int -rtl8125_set_settings(struct net_device *dev, -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) - struct ethtool_cmd *cmd -#else - const struct ethtool_link_ksettings *cmd -#endif - ) -{ - int ret; - u8 autoneg; - u32 speed; - u8 duplex; - u32 supported, advertising; - -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) - autoneg = cmd->autoneg; - speed = cmd->speed; - duplex = cmd->duplex; - supported = cmd->supported; - advertising = cmd->advertising; -#else - const struct ethtool_link_settings *base = &cmd->base; - autoneg = base->autoneg; - speed = base->speed; - duplex = base->duplex; - ethtool_convert_link_mode_to_legacy_u32(&supported, - cmd->link_modes.supported); - ethtool_convert_link_mode_to_legacy_u32(&advertising, - cmd->link_modes.advertising); - if (test_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, - cmd->link_modes.supported)) - supported |= ADVERTISED_2500baseX_Full; - if (test_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, - cmd->link_modes.advertising)) - advertising |= ADVERTISED_2500baseX_Full; -#endif - if (advertising & ~supported) - return -EINVAL; - - ret = rtl8125_set_speed(dev, autoneg, speed, duplex, advertising); - - return ret; -} - -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0) -static u32 -rtl8125_get_tx_csum(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - u32 ret; - -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0) - ret = ((dev->features & NETIF_F_IP_CSUM) != 0); -#else - ret = ((dev->features & (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM)) != 0); -#endif //LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0) - - return ret; -} - -static u32 -rtl8125_get_rx_csum(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - u32 ret; - - ret = tp->cp_cmd & RxChkSum; - - return ret; -} - -static int -rtl8125_set_tx_csum(struct net_device *dev, - u32 data) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - if (tp->mcfg == CFG_METHOD_DEFAULT) - return -EOPNOTSUPP; - -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0) - if (data) - dev->features |= NETIF_F_IP_CSUM; - else - dev->features &= ~NETIF_F_IP_CSUM; -#else - if (data) - dev->features |= (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM); - else - dev->features &= ~(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM); -#endif //LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0) - - return 0; -} - -static int -rtl8125_set_rx_csum(struct net_device *dev, - u32 data) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - if (tp->mcfg == CFG_METHOD_DEFAULT) - return -EOPNOTSUPP; - - if (data) - tp->cp_cmd |= RxChkSum; - else - tp->cp_cmd &= ~RxChkSum; - - RTL_W16(tp, CPlusCmd, tp->cp_cmd); - - return 0; -} -#endif //LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0) -#endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22) - -static u32 -rtl8125_rx_desc_opts1(struct rtl8125_private *tp, - struct RxDesc *desc) -{ - if (tp->InitRxDescType == RX_DESC_RING_TYPE_3) - return ((struct RxDescV3 *)desc)->RxDescNormalDDWord4.opts1; - else - return desc->opts1; -} - -static u32 -rtl8125_rx_desc_opts2(struct rtl8125_private *tp, - struct RxDesc *desc) -{ - if (tp->InitRxDescType == RX_DESC_RING_TYPE_3) - return ((struct RxDescV3 *)desc)->RxDescNormalDDWord4.opts2; - else - return desc->opts2; -} - -#ifdef CONFIG_R8125_VLAN - -static void -rtl8125_clear_rx_desc_opts2(struct rtl8125_private *tp, - struct RxDesc *desc) -{ - if (tp->InitRxDescType == RX_DESC_RING_TYPE_3) - ((struct RxDescV3 *)desc)->RxDescNormalDDWord4.opts2 = 0; - else - desc->opts2 = 0; -} - -static inline u32 -rtl8125_tx_vlan_tag(struct rtl8125_private *tp, - struct sk_buff *skb) -{ -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0) - return (tp->vlgrp && vlan_tx_tag_present(skb)) ? - TxVlanTag | swab16(vlan_tx_tag_get(skb)) : 0x00; -#elif LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0) - return (vlan_tx_tag_present(skb)) ? - TxVlanTag | swab16(vlan_tx_tag_get(skb)) : 0x00; -#else - return (skb_vlan_tag_present(skb)) ? - TxVlanTag | swab16(skb_vlan_tag_get(skb)) : 0x00; -#endif - - return 0; -} - -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0) - -static void -rtl8125_vlan_rx_register(struct net_device *dev, - struct vlan_group *grp) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - tp->vlgrp = grp; - if (tp->mcfg == CFG_METHOD_2 || - tp->mcfg == CFG_METHOD_3 || - tp->mcfg == CFG_METHOD_4 || - tp->mcfg == CFG_METHOD_5 || - tp->mcfg == CFG_METHOD_6 || - tp->mcfg == CFG_METHOD_7) { - if (tp->vlgrp) { - tp->rtl8125_rx_config |= (EnableInnerVlan | EnableOuterVlan); - RTL_W32(tp, RxConfig, RTL_R32(tp, RxConfig) | (EnableInnerVlan | EnableOuterVlan)) - } else { - tp->rtl8125_rx_config &= ~(EnableInnerVlan | EnableOuterVlan); - RTL_W32(tp, RxConfig, RTL_R32(tp, RxConfig) & ~(EnableInnerVlan | EnableOuterVlan)) - } - } -} - -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) -static void -rtl8125_vlan_rx_kill_vid(struct net_device *dev, - unsigned short vid) -{ - struct rtl8125_private *tp = netdev_priv(dev); - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21) - if (tp->vlgrp) - tp->vlgrp->vlan_devices[vid] = NULL; -#else - vlan_group_set_device(tp->vlgrp, vid, NULL); -#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21) -} -#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) - -static int -rtl8125_rx_vlan_skb(struct rtl8125_private *tp, - struct RxDesc *desc, - struct sk_buff *skb) -{ - u32 opts2 = le32_to_cpu(rtl8125_rx_desc_opts2(tp, desc)); - int ret = -1; - -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0) - if (tp->vlgrp && (opts2 & RxVlanTag)) { - rtl8125_rx_hwaccel_skb(skb, tp->vlgrp, - swab16(opts2 & 0xffff)); - ret = 0; - } -#elif LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0) - if (opts2 & RxVlanTag) - __vlan_hwaccel_put_tag(skb, swab16(opts2 & 0xffff)); -#else - if (opts2 & RxVlanTag) - __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), swab16(opts2 & 0xffff)); -#endif - - rtl8125_clear_rx_desc_opts2(tp, desc); - return ret; -} - -#else /* !CONFIG_R8125_VLAN */ - -static inline u32 -rtl8125_tx_vlan_tag(struct rtl8125_private *tp, - struct sk_buff *skb) -{ - return 0; -} - -static int -rtl8125_rx_vlan_skb(struct rtl8125_private *tp, - struct RxDesc *desc, - struct sk_buff *skb) -{ - return -1; -} - -#endif - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0) - -static netdev_features_t rtl8125_fix_features(struct net_device *dev, - netdev_features_t features) -{ - if (dev->mtu > MSS_MAX) - features &= ~NETIF_F_ALL_TSO; - if (dev->mtu > ETH_DATA_LEN) { - features &= ~NETIF_F_ALL_TSO; - features &= ~NETIF_F_ALL_CSUM; - } -#ifndef CONFIG_R8125_VLAN - features &= ~NETIF_F_ALL_CSUM; -#endif - - return features; -} - -static int rtl8125_hw_set_features(struct net_device *dev, - netdev_features_t features) -{ - struct rtl8125_private *tp = netdev_priv(dev); - u32 rx_config; - - rx_config = RTL_R32(tp, RxConfig); - if (features & NETIF_F_RXALL) { - tp->rtl8125_rx_config |= (AcceptErr | AcceptRunt); - rx_config |= (AcceptErr | AcceptRunt); - } else { - tp->rtl8125_rx_config &= ~(AcceptErr | AcceptRunt); - rx_config &= ~(AcceptErr | AcceptRunt); - } - - if (features & NETIF_F_HW_VLAN_RX) { - tp->rtl8125_rx_config |= (EnableInnerVlan | EnableOuterVlan); - rx_config |= (EnableInnerVlan | EnableOuterVlan); - } else { - tp->rtl8125_rx_config &= ~(EnableInnerVlan | EnableOuterVlan); - rx_config &= ~(EnableInnerVlan | EnableOuterVlan); - } - - RTL_W32(tp, RxConfig, rx_config); - - if (features & NETIF_F_RXCSUM) - tp->cp_cmd |= RxChkSum; - else - tp->cp_cmd &= ~RxChkSum; - - RTL_W16(tp, CPlusCmd, tp->cp_cmd); - RTL_R16(tp, CPlusCmd); - - return 0; -} - -static int rtl8125_set_features(struct net_device *dev, - netdev_features_t features) -{ - features &= NETIF_F_RXALL | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_RX; - - rtl8125_hw_set_features(dev, features); - - return 0; -} - -#endif - -static void rtl8125_gset_xmii(struct net_device *dev, -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) - struct ethtool_cmd *cmd -#else - struct ethtool_link_ksettings *cmd -#endif - ) -{ - struct rtl8125_private *tp = netdev_priv(dev); - u16 aner = tp->phy_reg_aner; - u16 anlpar = tp->phy_reg_anlpar; - u16 gbsr = tp->phy_reg_gbsr; - u16 status_2500 = tp->phy_reg_status_2500; - u32 lpa_adv = 0; - u16 status; - u8 autoneg, duplex; - u32 speed = 0; - u16 bmcr; - u32 supported, advertising; - u8 report_lpa = 0; - - supported = SUPPORTED_10baseT_Half | - SUPPORTED_10baseT_Full | - SUPPORTED_100baseT_Half | - SUPPORTED_100baseT_Full | - SUPPORTED_1000baseT_Full | - SUPPORTED_2500baseX_Full | - SUPPORTED_Autoneg | - SUPPORTED_TP | - SUPPORTED_Pause | - SUPPORTED_Asym_Pause; - - if (tp->mcfg == CFG_METHOD_6 || tp->mcfg == CFG_METHOD_7) - supported &= ~SUPPORTED_2500baseX_Full; - - advertising = ADVERTISED_TP; - - rtl8125_mdio_write(tp, 0x1F, 0x0000); - bmcr = rtl8125_mdio_read(tp, MII_BMCR); - - if (bmcr & BMCR_ANENABLE) { - advertising |= ADVERTISED_Autoneg; - autoneg = AUTONEG_ENABLE; - - if (tp->phy_auto_nego_reg & ADVERTISE_10HALF) - advertising |= ADVERTISED_10baseT_Half; - if (tp->phy_auto_nego_reg & ADVERTISE_10FULL) - advertising |= ADVERTISED_10baseT_Full; - if (tp->phy_auto_nego_reg & ADVERTISE_100HALF) - advertising |= ADVERTISED_100baseT_Half; - if (tp->phy_auto_nego_reg & ADVERTISE_100FULL) - advertising |= ADVERTISED_100baseT_Full; - if (tp->phy_1000_ctrl_reg & ADVERTISE_1000FULL) - advertising |= ADVERTISED_1000baseT_Full; - if (tp->phy_2500_ctrl_reg & RTK_ADVERTISE_2500FULL) - advertising |= ADVERTISED_2500baseX_Full; - } else { - autoneg = AUTONEG_DISABLE; - } - - status = RTL_R16(tp, PHYstatus); - if (netif_running(dev) && (status & LinkStatus)) - report_lpa = 1; - - if (report_lpa) { - /*link on*/ - if (status & _2500bpsF) - speed = SPEED_2500; - else if (status & _1000bpsF) - speed = SPEED_1000; - else if (status & _100bps) - speed = SPEED_100; - else if (status & _10bps) - speed = SPEED_10; - - if (status & TxFlowCtrl) - advertising |= ADVERTISED_Asym_Pause; - - if (status & RxFlowCtrl) - advertising |= ADVERTISED_Pause; - - duplex = ((status & (_1000bpsF | _2500bpsF)) || (status & FullDup)) ? - DUPLEX_FULL : DUPLEX_HALF; - - /*link partner*/ - if (aner & EXPANSION_NWAY) - lpa_adv |= ADVERTISED_Autoneg; - if (anlpar & LPA_10HALF) - lpa_adv |= ADVERTISED_10baseT_Half; - if (anlpar & LPA_10FULL) - lpa_adv |= ADVERTISED_10baseT_Full; - if (anlpar & LPA_100HALF) - lpa_adv |= ADVERTISED_100baseT_Half; - if (anlpar & LPA_100FULL) - lpa_adv |= ADVERTISED_100baseT_Full; - if (anlpar & LPA_PAUSE_CAP) - lpa_adv |= ADVERTISED_Pause; - if (anlpar & LPA_PAUSE_ASYM) - lpa_adv |= ADVERTISED_Asym_Pause; - if (gbsr & LPA_1000HALF) - lpa_adv |= ADVERTISED_1000baseT_Half; - if (gbsr & LPA_1000FULL) - lpa_adv |= ADVERTISED_1000baseT_Full; - if (status_2500 & RTK_LPA_ADVERTISE_2500FULL) - lpa_adv |= ADVERTISED_2500baseX_Full; - } else { - /*link down*/ - speed = SPEED_UNKNOWN; - duplex = DUPLEX_UNKNOWN; - lpa_adv = 0; - } - -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) - cmd->supported = supported; - cmd->advertising = advertising; - cmd->autoneg = autoneg; - cmd->speed = speed; - cmd->duplex = duplex; - cmd->port = PORT_TP; - cmd->lp_advertising = lpa_adv; -#else - ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.supported, - supported); - ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.advertising, - advertising); - ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.lp_advertising, - lpa_adv); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,0,0) - if (supported & SUPPORTED_2500baseX_Full) { - linkmode_mod_bit(ETHTOOL_LINK_MODE_2500baseX_Full_BIT, - cmd->link_modes.supported, 0); - linkmode_mod_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, - cmd->link_modes.supported, 1); - } - if (advertising & ADVERTISED_2500baseX_Full) { - linkmode_mod_bit(ETHTOOL_LINK_MODE_2500baseX_Full_BIT, - cmd->link_modes.advertising, 0); - linkmode_mod_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, - cmd->link_modes.advertising, 1); - } - if (report_lpa) { - if (lpa_adv & ADVERTISED_2500baseX_Full) { - linkmode_mod_bit(ETHTOOL_LINK_MODE_2500baseX_Full_BIT, - cmd->link_modes.lp_advertising, 0); - linkmode_mod_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, - cmd->link_modes.lp_advertising, 1); - } - if (status_2500 & RTK_LPA_ADVERTISE_5000FULL) - linkmode_mod_bit(ETHTOOL_LINK_MODE_5000baseT_Full_BIT, - cmd->link_modes.lp_advertising, 1); - if (status_2500 & RTK_LPA_ADVERTISE_10000FULL) - linkmode_mod_bit(ETHTOOL_LINK_MODE_10000baseT_Full_BIT, - cmd->link_modes.lp_advertising, 1); - } -#endif - cmd->base.autoneg = autoneg; - cmd->base.speed = speed; - cmd->base.duplex = duplex; - cmd->base.port = PORT_TP; -#endif -} - -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22) -static int -rtl8125_get_settings(struct net_device *dev, -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) - struct ethtool_cmd *cmd -#else - struct ethtool_link_ksettings *cmd -#endif - ) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - tp->get_settings(dev, cmd); - - return 0; -} - -static void rtl8125_get_regs(struct net_device *dev, struct ethtool_regs *regs, - void *p) -{ - struct rtl8125_private *tp = netdev_priv(dev); - void __iomem *ioaddr = tp->mmio_addr; - unsigned int i; - u8 *data = p; - - if (regs->len < R8125_REGS_DUMP_SIZE) - return /* -EINVAL */; - - memset(p, 0, regs->len); - - for (i = 0; i < R8125_MAC_REGS_SIZE; i++) - *data++ = readb(ioaddr + i); - data = (u8*)p + 256; - - rtl8125_mdio_write(tp, 0x1F, 0x0000); - for (i = 0; i < R8125_PHY_REGS_SIZE/2; i++) { - *(u16*)data = rtl8125_mdio_read(tp, i); - data += 2; - } - data = (u8*)p + 256 * 2; - - for (i = 0; i < R8125_EPHY_REGS_SIZE/2; i++) { - *(u16*)data = rtl8125_ephy_read(tp, i); - data += 2; - } - data = (u8*)p + 256 * 3; - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - default: - for (i = 0; i < R8125_ERI_REGS_SIZE; i+=4) { - *(u32*)data = rtl8125_eri_read(tp, i , 4, ERIAR_ExGMAC); - data += 4; - } - break; - } -} - -static void rtl8125_get_pauseparam(struct net_device *dev, - struct ethtool_pauseparam *pause) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - pause->autoneg = (tp->autoneg ? AUTONEG_ENABLE : AUTONEG_DISABLE); - if (tp->fcpause == rtl8125_fc_rx_pause) - pause->rx_pause = 1; - else if (tp->fcpause == rtl8125_fc_tx_pause) - pause->tx_pause = 1; - else if (tp->fcpause == rtl8125_fc_full) { - pause->rx_pause = 1; - pause->tx_pause = 1; - } -} - -static int rtl8125_set_pauseparam(struct net_device *dev, - struct ethtool_pauseparam *pause) -{ - struct rtl8125_private *tp = netdev_priv(dev); - enum rtl8125_fc_mode newfc; - - if (pause->tx_pause || pause->rx_pause) - newfc = rtl8125_fc_full; - else - newfc = rtl8125_fc_none; - - if (tp->fcpause != newfc) { - tp->fcpause = newfc; - - rtl8125_set_speed(dev, tp->autoneg, tp->speed, tp->duplex, tp->advertising); - } - - return 0; - -} - -static u32 -rtl8125_get_msglevel(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - return tp->msg_enable; -} - -static void -rtl8125_set_msglevel(struct net_device *dev, - u32 value) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - tp->msg_enable = value; -} - -static const char rtl8125_gstrings[][ETH_GSTRING_LEN] = { - /* legacy */ - "tx_packets", - "rx_packets", - "tx_errors", - "rx_errors", - "rx_missed", - "align_errors", - "tx_single_collisions", - "tx_multi_collisions", - "unicast", - "broadcast", - "multicast", - "tx_aborted", - "tx_underrun", - - /* extended */ - "tx_octets", - "rx_octets", - "rx_multicast64", - "tx_unicast64", - "tx_broadcast64", - "tx_multicast64", - "tx_pause_on", - "tx_pause_off", - "tx_pause_all", - "tx_deferred", - "tx_late_collision", - "tx_all_collision", - "tx_aborted32", - "align_errors32", - "rx_frame_too_long", - "rx_runt", - "rx_pause_on", - "rx_pause_off", - "rx_pause_all", - "rx_unknown_opcode", - "rx_mac_error", - "tx_underrun32", - "rx_mac_missed", - "rx_tcam_dropped", - "tdu", - "rdu", -}; -#endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22) - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33) -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22) -static int rtl8125_get_stats_count(struct net_device *dev) -{ - return ARRAY_SIZE(rtl8125_gstrings); -} -#endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22) -#else -static int rtl8125_get_sset_count(struct net_device *dev, int sset) -{ - switch (sset) { - case ETH_SS_STATS: - return ARRAY_SIZE(rtl8125_gstrings); - default: - return -EOPNOTSUPP; - } -} -#endif - -static void -rtl8125_set_ring_size(struct rtl8125_private *tp, u32 rx, u32 tx) -{ - int i; - - for (i = 0; i < tp->num_rx_rings; i++) - tp->rx_ring[i].num_rx_desc = rx; - - for (i = 0; i < tp->num_tx_rings; i++) - tp->tx_ring[i].num_tx_desc = tx; -} - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -static void rtl8125_get_ringparam(struct net_device *dev, - struct ethtool_ringparam *ring) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - ring->rx_max_pending = MAX_NUM_TX_DESC; - ring->tx_max_pending = MAX_NUM_RX_DESC;; - ring->rx_pending = tp->rx_ring[0].num_rx_desc; - ring->tx_pending = tp->tx_ring[0].num_tx_desc; -} - -static int rtl8125_set_ringparam(struct net_device *dev, - struct ethtool_ringparam *ring) -{ - struct rtl8125_private *tp = netdev_priv(dev); - u32 new_rx_count, new_tx_count; - int rc = 0; - - if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending)) - return -EINVAL; - - new_tx_count = clamp_t(u32, ring->tx_pending, - MIN_NUM_TX_DESC, MAX_NUM_TX_DESC); - - new_rx_count = clamp_t(u32, ring->rx_pending, - MIN_NUM_RX_DESC, MAX_NUM_RX_DESC); - - if ((new_rx_count == tp->rx_ring[0].num_rx_desc) && - (new_tx_count == tp->tx_ring[0].num_tx_desc)) { - /* nothing to do */ - return 0; - } - - if (netif_running(dev)) { - rtl8125_wait_for_quiescence(dev); - rtl8125_close(dev); - } - - rtl8125_set_ring_size(tp, new_rx_count, new_tx_count); - - if (netif_running(dev)) - rc = rtl8125_open(dev); - - return rc; -} -#endif //LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) - -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22) -static void -rtl8125_get_ethtool_stats(struct net_device *dev, - struct ethtool_stats *stats, - u64 *data) -{ - struct rtl8125_private *tp = netdev_priv(dev); - struct rtl8125_counters *counters; - dma_addr_t paddr; - - ASSERT_RTNL(); - - counters = tp->tally_vaddr; - paddr = tp->tally_paddr; - if (!counters) - return; - - rtl8125_dump_tally_counter(tp, paddr); - - data[0] = le64_to_cpu(counters->tx_packets); - data[1] = le64_to_cpu(counters->rx_packets); - data[2] = le64_to_cpu(counters->tx_errors); - data[3] = le32_to_cpu(counters->rx_errors); - data[4] = le16_to_cpu(counters->rx_missed); - data[5] = le16_to_cpu(counters->align_errors); - data[6] = le32_to_cpu(counters->tx_one_collision); - data[7] = le32_to_cpu(counters->tx_multi_collision); - data[8] = le64_to_cpu(counters->rx_unicast); - data[9] = le64_to_cpu(counters->rx_broadcast); - data[10] = le32_to_cpu(counters->rx_multicast); - data[11] = le16_to_cpu(counters->tx_aborted); - data[12] = le16_to_cpu(counters->tx_underrun); - - data[13] = le64_to_cpu(counters->tx_octets); - data[14] = le64_to_cpu(counters->rx_octets); - data[15] = le64_to_cpu(counters->rx_multicast64); - data[16] = le64_to_cpu(counters->tx_unicast64); - data[17] = le64_to_cpu(counters->tx_broadcast64); - data[18] = le64_to_cpu(counters->tx_multicast64); - data[19] = le32_to_cpu(counters->tx_pause_on); - data[20] = le32_to_cpu(counters->tx_pause_off); - data[21] = le32_to_cpu(counters->tx_pause_all); - data[22] = le32_to_cpu(counters->tx_deferred); - data[23] = le32_to_cpu(counters->tx_late_collision); - data[24] = le32_to_cpu(counters->tx_all_collision); - data[25] = le32_to_cpu(counters->tx_aborted32); - data[26] = le32_to_cpu(counters->align_errors32); - data[27] = le32_to_cpu(counters->rx_frame_too_long); - data[28] = le32_to_cpu(counters->rx_runt); - data[29] = le32_to_cpu(counters->rx_pause_on); - data[30] = le32_to_cpu(counters->rx_pause_off); - data[31] = le32_to_cpu(counters->rx_pause_all); - data[32] = le32_to_cpu(counters->rx_unknown_opcode); - data[33] = le32_to_cpu(counters->rx_mac_error); - data[34] = le32_to_cpu(counters->tx_underrun32); - data[35] = le32_to_cpu(counters->rx_mac_missed); - data[36] = le32_to_cpu(counters->rx_tcam_dropped); - data[37] = le32_to_cpu(counters->tdu); - data[38] = le32_to_cpu(counters->rdu); -} - -static void -rtl8125_get_strings(struct net_device *dev, - u32 stringset, - u8 *data) -{ - switch (stringset) { - case ETH_SS_STATS: - memcpy(data, rtl8125_gstrings, sizeof(rtl8125_gstrings)); - break; - } -} -#endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22) - -static int rtl_get_eeprom_len(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - return tp->eeprom_len; -} - -static int rtl_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, u8 *buf) -{ - struct rtl8125_private *tp = netdev_priv(dev); - int i,j,ret; - int start_w, end_w; - int VPD_addr, VPD_data; - u32 *eeprom_buff; - u16 tmp; - - if (tp->eeprom_type == EEPROM_TYPE_NONE) { - dev_printk(KERN_DEBUG, tp_to_dev(tp), "Detect none EEPROM\n"); - return -EOPNOTSUPP; - } else if (eeprom->len == 0 || (eeprom->offset+eeprom->len) > tp->eeprom_len) { - dev_printk(KERN_DEBUG, tp_to_dev(tp), "Invalid parameter\n"); - return -EINVAL; - } - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - default: - VPD_addr = 0xD2; - VPD_data = 0xD4; - break; - } - - start_w = eeprom->offset >> 2; - end_w = (eeprom->offset + eeprom->len - 1) >> 2; - - eeprom_buff = kmalloc(sizeof(u32)*(end_w - start_w + 1), GFP_KERNEL); - if (!eeprom_buff) - return -ENOMEM; - - rtl8125_enable_cfg9346_write(tp); - ret = -EFAULT; - for (i=start_w; i<=end_w; i++) { - pci_write_config_word(tp->pci_dev, VPD_addr, (u16)i*4); - ret = -EFAULT; - for (j = 0; j < 10; j++) { - udelay(400); - pci_read_config_word(tp->pci_dev, VPD_addr, &tmp); - if (tmp&0x8000) { - ret = 0; - break; - } - } - - if (ret) - break; - - pci_read_config_dword(tp->pci_dev, VPD_data, &eeprom_buff[i-start_w]); - } - rtl8125_disable_cfg9346_write(tp); - - if (!ret) - memcpy(buf, (u8 *)eeprom_buff + (eeprom->offset & 3), eeprom->len); - - kfree(eeprom_buff); - - return ret; -} - -#undef ethtool_op_get_link -#define ethtool_op_get_link _kc_ethtool_op_get_link -static u32 _kc_ethtool_op_get_link(struct net_device *dev) -{ - return netif_carrier_ok(dev) ? 1 : 0; -} - -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0) -#undef ethtool_op_get_sg -#define ethtool_op_get_sg _kc_ethtool_op_get_sg -static u32 _kc_ethtool_op_get_sg(struct net_device *dev) -{ -#ifdef NETIF_F_SG - return (dev->features & NETIF_F_SG) != 0; -#else - return 0; -#endif -} - -#undef ethtool_op_set_sg -#define ethtool_op_set_sg _kc_ethtool_op_set_sg -static int _kc_ethtool_op_set_sg(struct net_device *dev, u32 data) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - if (tp->mcfg == CFG_METHOD_DEFAULT) - return -EOPNOTSUPP; - -#ifdef NETIF_F_SG - if (data) - dev->features |= NETIF_F_SG; - else - dev->features &= ~NETIF_F_SG; -#endif - - return 0; -} -#endif - -static int rtl8125_enable_eee(struct rtl8125_private *tp) -{ - struct ethtool_eee *eee = &tp->eee; - u16 eee_adv_t = ethtool_adv_to_mmd_eee_adv_t(eee->advertised); - int ret; - - ret = 0; - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_6: - RTL_W16(tp, EEE_TXIDLE_TIMER_8125, eee->tx_lpi_timer); - - SetMcuAccessRegBit(tp, 0xE040, (BIT_1|BIT_0)); - SetMcuAccessRegBit(tp, 0xEB62, (BIT_2|BIT_1)); - - SetEthPhyOcpBit(tp, 0xA432, BIT_4); - ClearAndSetEthPhyOcpBit(tp, - 0xA5D0, - MDIO_EEE_100TX | MDIO_EEE_1000T, - eee_adv_t); - ClearEthPhyOcpBit(tp, 0xA6D4, BIT_0); - - ClearEthPhyOcpBit(tp, 0xA6D8, BIT_4); - ClearEthPhyOcpBit(tp, 0xA428, BIT_7); - ClearEthPhyOcpBit(tp, 0xA4A2, BIT_9); - break; - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_7: - RTL_W16(tp, EEE_TXIDLE_TIMER_8125, eee->tx_lpi_timer); - - SetMcuAccessRegBit(tp, 0xE040, (BIT_1|BIT_0)); - - ClearAndSetEthPhyOcpBit(tp, - 0xA5D0, - MDIO_EEE_100TX | MDIO_EEE_1000T, - eee_adv_t); - if (eee->advertised & SUPPORTED_2500baseX_Full) - SetEthPhyOcpBit(tp, 0xA6D4, BIT_0); - else - ClearEthPhyOcpBit(tp, 0xA6D4, BIT_0); - - ClearEthPhyOcpBit(tp, 0xA6D8, BIT_4); - ClearEthPhyOcpBit(tp, 0xA428, BIT_7); - ClearEthPhyOcpBit(tp, 0xA4A2, BIT_9); - break; - default: -// dev_printk(KERN_DEBUG, tp_to_dev(tp), "Not Support EEE\n"); - ret = -EOPNOTSUPP; - break; - } - - /*Advanced EEE*/ - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - rtl8125_set_phy_mcu_patch_request(tp); - ClearMcuAccessRegBit(tp, 0xE052, BIT_0); - ClearEthPhyOcpBit(tp, 0xA442, BIT_12 | BIT_13); - ClearEthPhyOcpBit(tp, 0xA430, BIT_15); - rtl8125_clear_phy_mcu_patch_request(tp); - break; - } - - return ret; -} - -static int rtl8125_disable_eee(struct rtl8125_private *tp) -{ - int ret; - - ret = 0; - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_6: - ClearMcuAccessRegBit(tp, 0xE040, (BIT_1|BIT_0)); - ClearMcuAccessRegBit(tp, 0xEB62, (BIT_2|BIT_1)); - - ClearEthPhyOcpBit(tp, 0xA432, BIT_4); - ClearEthPhyOcpBit(tp, 0xA5D0, (BIT_2 | BIT_1)); - ClearEthPhyOcpBit(tp, 0xA6D4, BIT_0); - - ClearEthPhyOcpBit(tp, 0xA6D8, BIT_4); - ClearEthPhyOcpBit(tp, 0xA428, BIT_7); - ClearEthPhyOcpBit(tp, 0xA4A2, BIT_9); - break; - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_7: - ClearMcuAccessRegBit(tp, 0xE040, (BIT_1|BIT_0)); - - ClearEthPhyOcpBit(tp, 0xA5D0, (BIT_2 | BIT_1)); - ClearEthPhyOcpBit(tp, 0xA6D4, BIT_0); - - ClearEthPhyOcpBit(tp, 0xA6D8, BIT_4); - ClearEthPhyOcpBit(tp, 0xA428, BIT_7); - ClearEthPhyOcpBit(tp, 0xA4A2, BIT_9); - break; - default: -// dev_printk(KERN_DEBUG, tp_to_dev(tp), "Not Support EEE\n"); - ret = -EOPNOTSUPP; - break; - } - - /*Advanced EEE*/ - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - rtl8125_set_phy_mcu_patch_request(tp); - ClearMcuAccessRegBit(tp, 0xE052, BIT_0); - ClearEthPhyOcpBit(tp, 0xA442, BIT_12 | BIT_13); - ClearEthPhyOcpBit(tp, 0xA430, BIT_15); - rtl8125_clear_phy_mcu_patch_request(tp); - break; - } - - return ret; -} - -static int rtl_nway_reset(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - int ret, bmcr; - - if (unlikely(tp->rtk_enable_diag)) - return -EBUSY; - - /* if autoneg is off, it's an error */ - rtl8125_mdio_write(tp, 0x1F, 0x0000); - bmcr = rtl8125_mdio_read(tp, MII_BMCR); - - if (bmcr & BMCR_ANENABLE) { - bmcr |= BMCR_ANRESTART; - rtl8125_mdio_write(tp, MII_BMCR, bmcr); - ret = 0; - } else { - ret = -EINVAL; - } - - return ret; -} - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0) -static u32 -rtl8125_tx_lpi_timer_to_us(struct rtl8125_private *tp , u32 tx_lpi_timer) -{ - u32 to_us; - u16 status; - - //2.5G : tx_lpi_timer * 3.2ns - //Giga: tx_lpi_timer * 8ns - //100M : tx_lpi_timer * 80ns - to_us = tx_lpi_timer * 80; - status = RTL_R16(tp, PHYstatus); - if (status & LinkStatus) { - /*link on*/ - if (status & _2500bpsF) - to_us = (tx_lpi_timer * 32) / 10; - else if (status & _1000bpsF) - to_us = tx_lpi_timer * 8; - } - - //ns to us - to_us /= 1000; - - return to_us; -} - -static int -rtl_ethtool_get_eee(struct net_device *net, struct ethtool_eee *edata) -{ - struct rtl8125_private *tp = netdev_priv(net); - struct ethtool_eee *eee = &tp->eee; - u32 lp, adv, tx_lpi_timer, supported = 0; - u16 val; - - if (unlikely(tp->rtk_enable_diag)) - return -EBUSY; - - /* Get Supported EEE */ - //val = mdio_direct_read_phy_ocp(tp, 0xA5C4); - //supported = mmd_eee_cap_to_ethtool_sup_t(val); - supported = eee->supported; - - /* Get advertisement EEE */ - val = mdio_direct_read_phy_ocp(tp, 0xA5D0); - adv = mmd_eee_adv_to_ethtool_adv_t(val); - val = mdio_direct_read_phy_ocp(tp, 0xA6D4); - if (val & RTK_EEE_ADVERTISE_2500FULL) - adv |= ADVERTISED_2500baseX_Full; - - /* Get LP advertisement EEE */ - val = mdio_direct_read_phy_ocp(tp, 0xA5D2); - lp = mmd_eee_adv_to_ethtool_adv_t(val); - val = mdio_direct_read_phy_ocp(tp, 0xA6D0); - if (val & RTK_LPA_EEE_ADVERTISE_2500FULL) - lp |= ADVERTISED_2500baseX_Full; - - /* Get EEE Tx LPI timer*/ - tx_lpi_timer = RTL_R16(tp, EEE_TXIDLE_TIMER_8125); - - val = rtl8125_mac_ocp_read(tp, 0xE040); - val &= BIT_1 | BIT_0; - - edata->eee_enabled = !!val; - edata->eee_active = !!(supported & adv & lp); - edata->supported = supported; - edata->advertised = adv; - edata->lp_advertised = lp; - edata->tx_lpi_enabled = edata->eee_enabled; - edata->tx_lpi_timer = rtl8125_tx_lpi_timer_to_us(tp, tx_lpi_timer); - - return 0; -} - -static int -rtl_ethtool_set_eee(struct net_device *net, struct ethtool_eee *edata) -{ - struct rtl8125_private *tp = netdev_priv(net); - struct ethtool_eee *eee = &tp->eee; - u32 advertising; - int rc = 0; - - if (!HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp) || - tp->DASH) - return -EOPNOTSUPP; - - if (unlikely(tp->rtk_enable_diag)) { - dev_printk(KERN_WARNING, tp_to_dev(tp), "Diag Enabled\n"); - rc = -EBUSY; - goto out; - } - - if (tp->autoneg != AUTONEG_ENABLE) { - dev_printk(KERN_WARNING, tp_to_dev(tp), "EEE requires autoneg\n"); - rc = -EINVAL; - goto out; - } - - if (edata->tx_lpi_enabled) { - if (edata->tx_lpi_timer > tp->max_jumbo_frame_size || - edata->tx_lpi_timer < ETH_MIN_MTU) { - dev_printk(KERN_WARNING, tp_to_dev(tp), "Valid LPI timer range is %d to %d. \n", - ETH_MIN_MTU, tp->max_jumbo_frame_size); - rc = -EINVAL; - goto out; - } - } - - advertising = tp->advertising; - if (!edata->advertised) { - edata->advertised = advertising & eee->supported; - } else if (edata->advertised & ~advertising) { - dev_printk(KERN_WARNING, tp_to_dev(tp), "EEE advertised %x must be a subset of autoneg advertised speeds %x\n", - edata->advertised, advertising); - rc = -EINVAL; - goto out; - } - - if (edata->advertised & ~eee->supported) { - dev_printk(KERN_WARNING, tp_to_dev(tp), "EEE advertised %x must be a subset of support %x\n", - edata->advertised, eee->supported); - rc = -EINVAL; - goto out; - } - - //tp->eee.eee_enabled = edata->eee_enabled; - //tp->eee_adv_t = ethtool_adv_to_mmd_eee_adv_t(edata->advertised); - - dev_printk(KERN_WARNING, tp_to_dev(tp), "EEE tx_lpi_timer %x must be a subset of support %x\n", - edata->tx_lpi_timer, eee->tx_lpi_timer); - - eee->advertised = edata->advertised; - eee->tx_lpi_enabled = edata->tx_lpi_enabled; - eee->tx_lpi_timer = edata->tx_lpi_timer; - eee->eee_enabled = edata->eee_enabled; - - if (eee->eee_enabled) - rtl8125_enable_eee(tp); - else - rtl8125_disable_eee(tp); - - rtl_nway_reset(net); - - return rc; - -out: - - return rc; -} -#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0) */ - -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22) -static const struct ethtool_ops rtl8125_ethtool_ops = { - .get_drvinfo = rtl8125_get_drvinfo, - .get_regs_len = rtl8125_get_regs_len, - .get_link = ethtool_op_get_link, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) - .get_ringparam = rtl8125_get_ringparam, - .set_ringparam = rtl8125_set_ringparam, -#endif //LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) - .get_settings = rtl8125_get_settings, - .set_settings = rtl8125_set_settings, -#else - .get_link_ksettings = rtl8125_get_settings, - .set_link_ksettings = rtl8125_set_settings, -#endif //LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) - .get_pauseparam = rtl8125_get_pauseparam, - .set_pauseparam = rtl8125_set_pauseparam, -#endif //LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) - .get_msglevel = rtl8125_get_msglevel, - .set_msglevel = rtl8125_set_msglevel, -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0) - .get_rx_csum = rtl8125_get_rx_csum, - .set_rx_csum = rtl8125_set_rx_csum, - .get_tx_csum = rtl8125_get_tx_csum, - .set_tx_csum = rtl8125_set_tx_csum, - .get_sg = ethtool_op_get_sg, - .set_sg = ethtool_op_set_sg, -#ifdef NETIF_F_TSO - .get_tso = ethtool_op_get_tso, - .set_tso = ethtool_op_set_tso, -#endif //NETIF_F_TSO -#endif //LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0) - .get_regs = rtl8125_get_regs, - .get_wol = rtl8125_get_wol, - .set_wol = rtl8125_set_wol, - .get_strings = rtl8125_get_strings, -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33) - .get_stats_count = rtl8125_get_stats_count, -#else - .get_sset_count = rtl8125_get_sset_count, -#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33) - .get_ethtool_stats = rtl8125_get_ethtool_stats, -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23) -#ifdef ETHTOOL_GPERMADDR - .get_perm_addr = ethtool_op_get_perm_addr, -#endif //ETHTOOL_GPERMADDR -#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23) - .get_eeprom = rtl_get_eeprom, - .get_eeprom_len = rtl_get_eeprom_len, -#ifdef ENABLE_RSS_SUPPORT - .get_rxnfc = rtl8125_get_rxnfc, - .set_rxnfc = rtl8125_set_rxnfc, - .get_rxfh_indir_size = rtl8125_rss_indir_size, - .get_rxfh_key_size = rtl8125_get_rxfh_key_size, - .get_rxfh = rtl8125_get_rxfh, - .set_rxfh = rtl8125_set_rxfh, -#endif //ENABLE_RSS_SUPPORT -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0) -#ifdef ENABLE_PTP_SUPPORT - .get_ts_info = rtl8125_get_ts_info, -#else - .get_ts_info = ethtool_op_get_ts_info, -#endif //ENABLE_PTP_SUPPORT -#endif //LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0) -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0) - .get_eee = rtl_ethtool_get_eee, - .set_eee = rtl_ethtool_set_eee, -#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0) */ - .nway_reset = rtl_nway_reset, - -}; -#endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22) - -#if 0 - -static int rtl8125_enable_green_feature(struct rtl8125_private *tp) -{ - u16 gphy_val; - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - mdio_direct_write_phy_ocp(tp, 0xA436, 0x8011); - SetEthPhyOcpBit(tp, 0xA438, BIT_15); - rtl8125_mdio_write(tp, 0x00, 0x9200); - break; - default: - dev_printk(KERN_DEBUG, tp_to_dev(tp), "Not Support Green Feature\n"); - break; - } - - return 0; -} - -static int rtl8125_disable_green_feature(struct rtl8125_private *tp) -{ - u16 gphy_val; - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - mdio_direct_write_phy_ocp(tp, 0xA436, 0x8011); - ClearEthPhyOcpBit(tp, 0xA438, BIT_15); - rtl8125_mdio_write(tp, 0x00, 0x9200); - break; - default: - dev_printk(KERN_DEBUG, tp_to_dev(tp), "Not Support Green Feature\n"); - break; - } - - return 0; -} - -#endif - -static void rtl8125_get_mac_version(struct rtl8125_private *tp) -{ - u32 reg,val32; - u32 ICVerID; - struct pci_dev *pdev = tp->pci_dev; - - val32 = RTL_R32(tp, TxConfig); - reg = val32 & 0x7c800000; - ICVerID = val32 & 0x00700000; - - switch (reg) { - case 0x60800000: - if (ICVerID == 0x00000000) { - tp->mcfg = CFG_METHOD_2; - } else if (ICVerID == 0x100000) { - tp->mcfg = CFG_METHOD_3; - } else { - tp->mcfg = CFG_METHOD_3; - tp->HwIcVerUnknown = TRUE; - } - - tp->efuse_ver = EFUSE_SUPPORT_V4; - break; - case 0x64000000: - if (ICVerID == 0x00000000) { - tp->mcfg = CFG_METHOD_4; - } else if (ICVerID == 0x100000) { - tp->mcfg = CFG_METHOD_5; - } else { - tp->mcfg = CFG_METHOD_5; - tp->HwIcVerUnknown = TRUE; - } - - tp->efuse_ver = EFUSE_SUPPORT_V4; - break; - default: - printk("unknown chip version (%x)\n",reg); - tp->mcfg = CFG_METHOD_DEFAULT; - tp->HwIcVerUnknown = TRUE; - tp->efuse_ver = EFUSE_NOT_SUPPORT; - break; - } - - if (pdev->subsystem_vendor == 0x8162) { - if (tp->mcfg == CFG_METHOD_3) - tp->mcfg = CFG_METHOD_6; - else if (tp->mcfg == CFG_METHOD_5) - tp->mcfg = CFG_METHOD_7; - } -} - -static void -rtl8125_print_mac_version(struct rtl8125_private *tp) -{ - int i; - for (i = ARRAY_SIZE(rtl_chip_info) - 1; i >= 0; i--) { - if (tp->mcfg == rtl_chip_info[i].mcfg) { - dprintk("Realtek PCIe 2.5GbE Family Controller mcfg = %04d\n", - rtl_chip_info[i].mcfg); - return; - } - } - - dprintk("mac_version == Unknown\n"); -} - -static void -rtl8125_tally_counter_addr_fill(struct rtl8125_private *tp) -{ - if (!tp->tally_paddr) - return; - - RTL_W32(tp, CounterAddrHigh, (u64)tp->tally_paddr >> 32); - RTL_W32(tp, CounterAddrLow, (u64)tp->tally_paddr & (DMA_BIT_MASK(32))); -} - -static void -rtl8125_tally_counter_clear(struct rtl8125_private *tp) -{ - if (!tp->tally_paddr) - return; - - RTL_W32(tp, CounterAddrHigh, (u64)tp->tally_paddr >> 32); - RTL_W32(tp, CounterAddrLow, ((u64)tp->tally_paddr & (DMA_BIT_MASK(32))) | CounterReset); -} - -static void -rtl8125_clear_phy_ups_reg(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - switch (tp->mcfg) { - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_7: - ClearEthPhyOcpBit(tp, 0xA466, BIT_0); - break; - }; - ClearEthPhyOcpBit(tp, 0xA468, BIT_3 | BIT_1); -} - -static int -rtl8125_is_ups_resume(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - if (tp->mcfg == CFG_METHOD_2 || - tp->mcfg == CFG_METHOD_3 || - tp->mcfg == CFG_METHOD_4 || - tp->mcfg == CFG_METHOD_5 || - tp->mcfg == CFG_METHOD_6 || - tp->mcfg == CFG_METHOD_7) - return (rtl8125_mac_ocp_read(tp, 0xD42C) & BIT_8); - - return 0; -} - -static void -rtl8125_clear_ups_resume_bit(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - if (tp->mcfg == CFG_METHOD_2 || - tp->mcfg == CFG_METHOD_3 || - tp->mcfg == CFG_METHOD_4 || - tp->mcfg == CFG_METHOD_5 || - tp->mcfg == CFG_METHOD_6 || - tp->mcfg == CFG_METHOD_7) - rtl8125_mac_ocp_write(tp, 0xD408, rtl8125_mac_ocp_read(tp, 0xD408) & ~(BIT_8)); -} - -static void -rtl8125_wait_phy_ups_resume(struct net_device *dev, u16 PhyState) -{ - struct rtl8125_private *tp = netdev_priv(dev); - u16 TmpPhyState; - int i=0; - - if (tp->mcfg == CFG_METHOD_2 || - tp->mcfg == CFG_METHOD_3 || - tp->mcfg == CFG_METHOD_4 || - tp->mcfg == CFG_METHOD_5 || - tp->mcfg == CFG_METHOD_6 || - tp->mcfg == CFG_METHOD_7) { - do { - TmpPhyState = mdio_direct_read_phy_ocp(tp, 0xA420); - TmpPhyState &= 0x7; - mdelay(1); - i++; - } while ((i < 100) && (TmpPhyState != PhyState)); - } - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18) - WARN_ON_ONCE(i == 100); -#endif -} - -void -rtl8125_enable_now_is_oob(struct rtl8125_private *tp) -{ - if ( tp->HwSuppNowIsOobVer == 1 ) { - RTL_W8(tp, MCUCmd_reg, RTL_R8(tp, MCUCmd_reg) | Now_is_oob); - } -} - -void -rtl8125_disable_now_is_oob(struct rtl8125_private *tp) -{ - if ( tp->HwSuppNowIsOobVer == 1 ) { - RTL_W8(tp, MCUCmd_reg, RTL_R8(tp, MCUCmd_reg) & ~Now_is_oob); - } -} - -static void -rtl8125_exit_oob(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - u16 data16; - - RTL_W32(tp, RxConfig, RTL_R32(tp, RxConfig) & ~(AcceptErr | AcceptRunt | AcceptBroadcast | AcceptMulticast | AcceptMyPhys | AcceptAllPhys)); - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_6: - rtl8125_dash2_disable_txrx(dev); - break; - } - - if (tp->DASH) { - rtl8125_driver_stop(tp); - rtl8125_driver_start(tp); -#ifdef ENABLE_DASH_SUPPORT - DashHwInit(dev); -#endif - } - -#ifdef ENABLE_REALWOW_SUPPORT - rtl8125_realwow_hw_init(dev); -#else - //Disable realwow function - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - rtl8125_mac_ocp_write(tp, 0xC0BC, 0x00FF); - break; - } -#endif //ENABLE_REALWOW_SUPPORT - - rtl8125_nic_reset(dev); - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - rtl8125_disable_now_is_oob(tp); - - data16 = rtl8125_mac_ocp_read(tp, 0xE8DE) & ~BIT_14; - rtl8125_mac_ocp_write(tp, 0xE8DE, data16); - rtl8125_wait_ll_share_fifo_ready(dev); - - rtl8125_mac_ocp_write(tp, 0xC0AA, 0x07D0); - rtl8125_mac_ocp_write(tp, 0xC0A6, 0x01B5); - rtl8125_mac_ocp_write(tp, 0xC01E, 0x5555); - - rtl8125_wait_ll_share_fifo_ready(dev); - break; - } - - //wait ups resume (phy state 2) - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - if (rtl8125_is_ups_resume(dev)) { - rtl8125_wait_phy_ups_resume(dev, 2); - rtl8125_clear_ups_resume_bit(dev); - rtl8125_clear_phy_ups_reg(dev); - } - break; - }; -} - -void -rtl8125_hw_disable_mac_mcu_bps(struct net_device *dev) -{ - u16 regAddr; - - struct rtl8125_private *tp = netdev_priv(dev); - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - rtl8125_enable_cfg9346_write(tp); - RTL_W8(tp, Config5, RTL_R8(tp, Config5) & ~BIT_0); - RTL_W8(tp, Config2, RTL_R8(tp, Config2) & ~BIT_7); - rtl8125_disable_cfg9346_write(tp); - break; - } - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - rtl8125_mac_ocp_write(tp, 0xFC48, 0x0000); - break; - } - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - for (regAddr = 0xFC28; regAddr < 0xFC48; regAddr += 2) { - rtl8125_mac_ocp_write(tp, regAddr, 0x0000); - } - - mdelay(3); - - rtl8125_mac_ocp_write(tp, 0xFC26, 0x0000); - break; - } -} - -#ifndef ENABLE_USE_FIRMWARE_FILE -static void -rtl8125_switch_mac_mcu_ram_code_page(struct rtl8125_private *tp, u16 page) -{ - u16 tmpUshort; - - page &= (BIT_1 | BIT_0); - tmpUshort = rtl8125_mac_ocp_read(tp, 0xE446); - tmpUshort &= ~(BIT_1 | BIT_0); - tmpUshort |= page; - rtl8125_mac_ocp_write(tp, 0xE446, tmpUshort); -} - -static void -_rtl8125_write_mac_mcu_ram_code(struct rtl8125_private *tp, const u16 *entry, u16 entry_cnt) -{ - u16 i; - - for (i = 0; i < entry_cnt; i++) { - rtl8125_mac_ocp_write(tp, 0xF800 + i * 2, entry[i]); - } -} - -static void -_rtl8125_write_mac_mcu_ram_code_with_page(struct rtl8125_private *tp, const u16 *entry, u16 entry_cnt, u16 page_size) -{ - u16 i; - u16 offset; - - if (page_size == 0) return; - - for (i = 0; i < entry_cnt; i++) { - offset = i % page_size; - if (offset == 0) { - u16 page = (i / page_size); - rtl8125_switch_mac_mcu_ram_code_page(tp, page); - } - rtl8125_mac_ocp_write(tp, 0xF800 + offset * 2, entry[i]); - } -} - -static void -rtl8125_write_mac_mcu_ram_code(struct rtl8125_private *tp, const u16 *entry, u16 entry_cnt) -{ - if (FALSE == HW_SUPPORT_MAC_MCU(tp)) return; - if (entry == NULL || entry_cnt == 0) return; - - if (tp->MacMcuPageSize > 0) - _rtl8125_write_mac_mcu_ram_code_with_page(tp, entry, entry_cnt, tp->MacMcuPageSize); - else - _rtl8125_write_mac_mcu_ram_code(tp, entry, entry_cnt); -} - -static void -rtl8125_set_mac_mcu_8125a_1(struct net_device *dev) -{ - rtl8125_hw_disable_mac_mcu_bps(dev); -} - -static void -rtl8125_set_mac_mcu_8125a_2(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - static const u16 mcu_patch_code_8125a_2[] = { - 0xE010, 0xE012, 0xE022, 0xE024, 0xE029, 0xE02B, 0xE094, 0xE09D, 0xE09F, - 0xE0AA, 0xE0B5, 0xE0C6, 0xE0CC, 0xE0D1, 0xE0D6, 0xE0D8, 0xC602, 0xBE00, - 0x0000, 0xC60F, 0x73C4, 0x49B3, 0xF106, 0x73C2, 0xC608, 0xB406, 0xC609, - 0xFF80, 0xC605, 0xB406, 0xC605, 0xFF80, 0x0544, 0x0568, 0xE906, 0xCDE8, - 0xC602, 0xBE00, 0x0000, 0x48C1, 0x48C2, 0x9C46, 0xC402, 0xBC00, 0x0A12, - 0xC602, 0xBE00, 0x0EBA, 0x1501, 0xF02A, 0x1500, 0xF15D, 0xC661, 0x75C8, - 0x49D5, 0xF00A, 0x49D6, 0xF008, 0x49D7, 0xF006, 0x49D8, 0xF004, 0x75D2, - 0x49D9, 0xF150, 0xC553, 0x77A0, 0x75C8, 0x4855, 0x4856, 0x4857, 0x4858, - 0x48DA, 0x48DB, 0x49FE, 0xF002, 0x485A, 0x49FF, 0xF002, 0x485B, 0x9DC8, - 0x75D2, 0x4859, 0x9DD2, 0xC643, 0x75C0, 0x49D4, 0xF033, 0x49D0, 0xF137, - 0xE030, 0xC63A, 0x75C8, 0x49D5, 0xF00E, 0x49D6, 0xF00C, 0x49D7, 0xF00A, - 0x49D8, 0xF008, 0x75D2, 0x49D9, 0xF005, 0xC62E, 0x75C0, 0x49D7, 0xF125, - 0xC528, 0x77A0, 0xC627, 0x75C8, 0x4855, 0x4856, 0x4857, 0x4858, 0x48DA, - 0x48DB, 0x49FE, 0xF002, 0x485A, 0x49FF, 0xF002, 0x485B, 0x9DC8, 0x75D2, - 0x4859, 0x9DD2, 0xC616, 0x75C0, 0x4857, 0x9DC0, 0xC613, 0x75C0, 0x49DA, - 0xF003, 0x49D0, 0xF107, 0xC60B, 0xC50E, 0x48D9, 0x9DC0, 0x4859, 0x9DC0, - 0xC608, 0xC702, 0xBF00, 0x3AE0, 0xE860, 0xB400, 0xB5D4, 0xE908, 0xE86C, - 0x1200, 0xC409, 0x6780, 0x48F1, 0x8F80, 0xC404, 0xC602, 0xBE00, 0x10AA, - 0xC010, 0xEA7C, 0xC602, 0xBE00, 0x0000, 0x740A, 0x4846, 0x4847, 0x9C0A, - 0xC607, 0x74C0, 0x48C6, 0x9CC0, 0xC602, 0xBE00, 0x13FE, 0xE054, 0x72CA, - 0x4826, 0x4827, 0x9ACA, 0xC607, 0x72C0, 0x48A6, 0x9AC0, 0xC602, 0xBE00, - 0x07DC, 0xE054, 0xC60F, 0x74C4, 0x49CC, 0xF109, 0xC60C, 0x74CA, 0x48C7, - 0x9CCA, 0xC609, 0x74C0, 0x4846, 0x9CC0, 0xC602, 0xBE00, 0x2480, 0xE092, - 0xE0C0, 0xE054, 0x7420, 0x48C0, 0x9C20, 0x7444, 0xC602, 0xBE00, 0x12F8, - 0x1BFF, 0x46EB, 0x1BFF, 0xC102, 0xB900, 0x0D5A, 0x1BFF, 0x46EB, 0x1BFF, - 0xC102, 0xB900, 0x0E2A, 0xC602, 0xBE00, 0x0000, 0xC602, 0xBE00, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6486, - 0x0B15, 0x090E, 0x1139 - }; - - rtl8125_hw_disable_mac_mcu_bps(dev); - - rtl8125_write_mac_mcu_ram_code(tp, mcu_patch_code_8125a_2, ARRAY_SIZE(mcu_patch_code_8125a_2)); - - rtl8125_mac_ocp_write(tp, 0xFC26, 0x8000); - - rtl8125_mac_ocp_write(tp, 0xFC2A, 0x0540); - rtl8125_mac_ocp_write(tp, 0xFC2E, 0x0A06); - rtl8125_mac_ocp_write(tp, 0xFC30, 0x0EB8); - rtl8125_mac_ocp_write(tp, 0xFC32, 0x3A5C); - rtl8125_mac_ocp_write(tp, 0xFC34, 0x10A8); - rtl8125_mac_ocp_write(tp, 0xFC40, 0x0D54); - rtl8125_mac_ocp_write(tp, 0xFC42, 0x0E24); - - rtl8125_mac_ocp_write(tp, 0xFC48, 0x307A); -} - -static void -rtl8125_set_mac_mcu_8125b_1(struct net_device *dev) -{ - rtl8125_hw_disable_mac_mcu_bps(dev); -} - -static void -rtl8125_set_mac_mcu_8125b_2(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - static const u16 mcu_patch_code_8125b_2[] = { - 0xE010, 0xE01B, 0xE026, 0xE037, 0xE03D, 0xE057, 0xE05B, 0xE060, 0xE062, - 0xE064, 0xE066, 0xE068, 0xE06A, 0xE06C, 0xE06E, 0xE070, 0x740A, 0x4846, - 0x4847, 0x9C0A, 0xC607, 0x74C0, 0x48C6, 0x9CC0, 0xC602, 0xBE00, 0x13F0, - 0xE054, 0x72CA, 0x4826, 0x4827, 0x9ACA, 0xC607, 0x72C0, 0x48A6, 0x9AC0, - 0xC602, 0xBE00, 0x081C, 0xE054, 0xC60F, 0x74C4, 0x49CC, 0xF109, 0xC60C, - 0x74CA, 0x48C7, 0x9CCA, 0xC609, 0x74C0, 0x4846, 0x9CC0, 0xC602, 0xBE00, - 0x2494, 0xE092, 0xE0C0, 0xE054, 0x7420, 0x48C0, 0x9C20, 0x7444, 0xC602, - 0xBE00, 0x12DC, 0x733A, 0x21B5, 0x25BC, 0x1304, 0xF111, 0x1B12, 0x1D2A, - 0x3168, 0x3ADA, 0x31AB, 0x1A00, 0x9AC0, 0x1300, 0xF1FB, 0x7620, 0x236E, - 0x276F, 0x1A3C, 0x22A1, 0x41B5, 0x9EE2, 0x76E4, 0x486F, 0x9EE4, 0xC602, - 0xBE00, 0x4A26, 0x733A, 0x49BB, 0xC602, 0xBE00, 0x47A2, 0x48C1, 0x48C2, - 0x9C46, 0xC402, 0xBC00, 0x0A52, 0xC602, 0xBE00, 0x0000, 0xC602, 0xBE00, - 0x0000, 0xC602, 0xBE00, 0x0000, 0xC602, 0xBE00, 0x0000, 0xC602, 0xBE00, - 0x0000, 0xC602, 0xBE00, 0x0000, 0xC602, 0xBE00, 0x0000, 0xC602, 0xBE00, - 0x0000, 0xC602, 0xBE00, 0x0000 - }; - - rtl8125_hw_disable_mac_mcu_bps(dev); - - rtl8125_write_mac_mcu_ram_code(tp, mcu_patch_code_8125b_2, ARRAY_SIZE(mcu_patch_code_8125b_2)); - - rtl8125_mac_ocp_write(tp, 0xFC26, 0x8000); - - rtl8125_mac_ocp_write(tp, 0xFC28, 0x13E6); - rtl8125_mac_ocp_write(tp, 0xFC2A, 0x0812); - rtl8125_mac_ocp_write(tp, 0xFC2C, 0x248C); - rtl8125_mac_ocp_write(tp, 0xFC2E, 0x12DA); - rtl8125_mac_ocp_write(tp, 0xFC30, 0x4A20); - rtl8125_mac_ocp_write(tp, 0xFC32, 0x47A0); - rtl8125_mac_ocp_write(tp, 0xFC34, 0x0A46); - - rtl8125_mac_ocp_write(tp, 0xFC48, 0x007F); -} - -static void -rtl8125_hw_mac_mcu_config(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - if (tp->NotWrMcuPatchCode == TRUE) return; - - switch (tp->mcfg) { - case CFG_METHOD_2: - rtl8125_set_mac_mcu_8125a_1(dev); - break; - case CFG_METHOD_3: - case CFG_METHOD_6: - rtl8125_set_mac_mcu_8125a_2(dev); - break; - case CFG_METHOD_4: - rtl8125_set_mac_mcu_8125b_1(dev); - break; - case CFG_METHOD_5: - case CFG_METHOD_7: - rtl8125_set_mac_mcu_8125b_2(dev); - break; - } -} -#endif - -#ifdef ENABLE_USE_FIRMWARE_FILE -static void rtl8125_release_firmware(struct rtl8125_private *tp) -{ - if (tp->rtl_fw) { - rtl8125_fw_release_firmware(tp->rtl_fw); - kfree(tp->rtl_fw); - tp->rtl_fw = NULL; - } -} - -void rtl8125_apply_firmware(struct rtl8125_private *tp) -{ - /* TODO: release firmware if rtl_fw_write_firmware signals failure. */ - if (tp->rtl_fw) { - rtl8125_fw_write_firmware(tp, tp->rtl_fw); - /* At least one firmware doesn't reset tp->ocp_base. */ - tp->ocp_base = OCP_STD_PHY_BASE; - - /* PHY soft reset may still be in progress */ - //phy_read_poll_timeout(tp->phydev, MII_BMCR, val, - // !(val & BMCR_RESET), - // 50000, 600000, true); - rtl8125_wait_phy_reset_complete(tp); - - tp->hw_ram_code_ver = rtl8125_get_hw_phy_mcu_code_ver(tp); - tp->sw_ram_code_ver = tp->hw_ram_code_ver; - tp->HwHasWrRamCodeToMicroP = TRUE; - } -} -#endif - -static void -rtl8125_hw_init(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - u32 csi_tmp; - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - rtl8125_enable_cfg9346_write(tp); - RTL_W8(tp, Config5, RTL_R8(tp, Config5) & ~BIT_0); - RTL_W8(tp, Config2, RTL_R8(tp, Config2) & ~BIT_7); - rtl8125_disable_cfg9346_write(tp); - RTL_W8(tp, 0xF1, RTL_R8(tp, 0xF1) & ~BIT_7); - break; - } - - //Disable UPS - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - rtl8125_mac_ocp_write(tp, 0xD40A, rtl8125_mac_ocp_read( tp, 0xD40A) & ~(BIT_4)); - break; - } - -#ifndef ENABLE_USE_FIRMWARE_FILE - if (!tp->rtl_fw) - rtl8125_hw_mac_mcu_config(dev); -#endif - - /*disable ocp phy power saving*/ - if (tp->mcfg == CFG_METHOD_2 || - tp->mcfg == CFG_METHOD_3 || - tp->mcfg == CFG_METHOD_4 || - tp->mcfg == CFG_METHOD_5 || - tp->mcfg == CFG_METHOD_6 || - tp->mcfg == CFG_METHOD_7) - rtl8125_disable_ocp_phy_power_saving(dev); - - //Set PCIE uncorrectable error status mask pcie 0x108 - csi_tmp = rtl8125_csi_read(tp, 0x108); - csi_tmp |= BIT_20; - rtl8125_csi_write(tp, 0x108, csi_tmp); - - rtl8125_enable_cfg9346_write(tp); - rtl8125_disable_linkchg_wakeup(dev); - rtl8125_disable_cfg9346_write(tp); - rtl8125_disable_magic_packet(dev); - rtl8125_disable_d0_speedup(tp); - rtl8125_set_pci_pme(tp, 0); - if (s0_magic_packet == 1) - rtl8125_enable_magic_packet(dev); - -#ifdef ENABLE_USE_FIRMWARE_FILE - if (tp->rtl_fw && - !tp->resume_not_chg_speed && - !(HW_DASH_SUPPORT_TYPE_3(tp) && - tp->HwPkgDet == 0x06)) - rtl8125_apply_firmware(tp); -#endif -} - -static void -rtl8125_hw_ephy_config(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - switch (tp->mcfg) { - case CFG_METHOD_2: - rtl8125_ephy_write(tp, 0x01, 0xA812); - rtl8125_ephy_write(tp, 0x09, 0x520C); - rtl8125_ephy_write(tp, 0x04, 0xD000); - rtl8125_ephy_write(tp, 0x0D, 0xF702); - rtl8125_ephy_write(tp, 0x0A, 0x8653); - rtl8125_ephy_write(tp, 0x06, 0x001E); - rtl8125_ephy_write(tp, 0x08, 0x3595); - rtl8125_ephy_write(tp, 0x20, 0x9455); - rtl8125_ephy_write(tp, 0x21, 0x99FF); - rtl8125_ephy_write(tp, 0x02, 0x6046); - rtl8125_ephy_write(tp, 0x29, 0xFE00); - rtl8125_ephy_write(tp, 0x23, 0xAB62); - - rtl8125_ephy_write(tp, 0x41, 0xA80C); - rtl8125_ephy_write(tp, 0x49, 0x520C); - rtl8125_ephy_write(tp, 0x44, 0xD000); - rtl8125_ephy_write(tp, 0x4D, 0xF702); - rtl8125_ephy_write(tp, 0x4A, 0x8653); - rtl8125_ephy_write(tp, 0x46, 0x001E); - rtl8125_ephy_write(tp, 0x48, 0x3595); - rtl8125_ephy_write(tp, 0x60, 0x9455); - rtl8125_ephy_write(tp, 0x61, 0x99FF); - rtl8125_ephy_write(tp, 0x42, 0x6046); - rtl8125_ephy_write(tp, 0x69, 0xFE00); - rtl8125_ephy_write(tp, 0x63, 0xAB62); - break; - case CFG_METHOD_3: - case CFG_METHOD_6: - rtl8125_ephy_write(tp, 0x04, 0xD000); - rtl8125_ephy_write(tp, 0x0A, 0x8653); - rtl8125_ephy_write(tp, 0x23, 0xAB66); - rtl8125_ephy_write(tp, 0x20, 0x9455); - rtl8125_ephy_write(tp, 0x21, 0x99FF); - rtl8125_ephy_write(tp, 0x29, 0xFE04); - - rtl8125_ephy_write(tp, 0x44, 0xD000); - rtl8125_ephy_write(tp, 0x4A, 0x8653); - rtl8125_ephy_write(tp, 0x63, 0xAB66); - rtl8125_ephy_write(tp, 0x60, 0x9455); - rtl8125_ephy_write(tp, 0x61, 0x99FF); - rtl8125_ephy_write(tp, 0x69, 0xFE04); - - ClearAndSetPCIePhyBit(tp, - 0x2A, - (BIT_14 | BIT_13 | BIT_12), - (BIT_13 | BIT_12) - ); - ClearPCIePhyBit(tp, 0x19, BIT_6); - SetPCIePhyBit(tp, 0x1B, (BIT_11 | BIT_10 | BIT_9)); - ClearPCIePhyBit(tp, 0x1B, (BIT_14 | BIT_13 | BIT_12)); - rtl8125_ephy_write(tp, 0x02, 0x6042); - rtl8125_ephy_write(tp, 0x06, 0x0014); - - ClearAndSetPCIePhyBit(tp, - 0x6A, - (BIT_14 | BIT_13 | BIT_12), - (BIT_13 | BIT_12) - ); - ClearPCIePhyBit(tp, 0x59, BIT_6); - SetPCIePhyBit(tp, 0x5B, (BIT_11 | BIT_10 | BIT_9)); - ClearPCIePhyBit(tp, 0x5B, (BIT_14 | BIT_13 | BIT_12)); - rtl8125_ephy_write(tp, 0x42, 0x6042); - rtl8125_ephy_write(tp, 0x46, 0x0014); - break; - case CFG_METHOD_4: - rtl8125_ephy_write(tp, 0x06, 0x001F); - rtl8125_ephy_write(tp, 0x0A, 0xB66B); - rtl8125_ephy_write(tp, 0x01, 0xA852); - rtl8125_ephy_write(tp, 0x24, 0x0008); - rtl8125_ephy_write(tp, 0x2F, 0x6052); - rtl8125_ephy_write(tp, 0x0D, 0xF716); - rtl8125_ephy_write(tp, 0x20, 0xD477); - rtl8125_ephy_write(tp, 0x21, 0x4477); - rtl8125_ephy_write(tp, 0x22, 0x0013); - rtl8125_ephy_write(tp, 0x23, 0xBB66); - rtl8125_ephy_write(tp, 0x0B, 0xA909); - rtl8125_ephy_write(tp, 0x29, 0xFF04); - rtl8125_ephy_write(tp, 0x1B, 0x1EA0); - - rtl8125_ephy_write(tp, 0x46, 0x001F); - rtl8125_ephy_write(tp, 0x4A, 0xB66B); - rtl8125_ephy_write(tp, 0x41, 0xA84A); - rtl8125_ephy_write(tp, 0x64, 0x000C); - rtl8125_ephy_write(tp, 0x6F, 0x604A); - rtl8125_ephy_write(tp, 0x4D, 0xF716); - rtl8125_ephy_write(tp, 0x60, 0xD477); - rtl8125_ephy_write(tp, 0x61, 0x4477); - rtl8125_ephy_write(tp, 0x62, 0x0013); - rtl8125_ephy_write(tp, 0x63, 0xBB66); - rtl8125_ephy_write(tp, 0x4B, 0xA909); - rtl8125_ephy_write(tp, 0x69, 0xFF04); - rtl8125_ephy_write(tp, 0x5B, 0x1EA0); - break; - case CFG_METHOD_5: - case CFG_METHOD_7: - rtl8125_ephy_write(tp, 0x0B, 0xA908); - rtl8125_ephy_write(tp, 0x1E, 0x20EB); - rtl8125_ephy_write(tp, 0x22, 0x0023); - rtl8125_ephy_write(tp, 0x02, 0x60C2); - rtl8125_ephy_write(tp, 0x29, 0xFF00); - - rtl8125_ephy_write(tp, 0x4B, 0xA908); - rtl8125_ephy_write(tp, 0x5E, 0x28EB); - rtl8125_ephy_write(tp, 0x62, 0x0023); - rtl8125_ephy_write(tp, 0x42, 0x60C2); - rtl8125_ephy_write(tp, 0x69, 0xFF00); - break; - } -} - -static u16 -rtl8125_get_hw_phy_mcu_code_ver(struct rtl8125_private *tp) -{ - u16 hw_ram_code_ver = ~0; - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - mdio_direct_write_phy_ocp(tp, 0xA436, 0x801E); - hw_ram_code_ver = mdio_direct_read_phy_ocp(tp, 0xA438); - break; - } - - return hw_ram_code_ver; -} - -static int -rtl8125_check_hw_phy_mcu_code_ver(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - int ram_code_ver_match = 0; - - tp->hw_ram_code_ver = rtl8125_get_hw_phy_mcu_code_ver(tp); - - if (tp->hw_ram_code_ver == tp->sw_ram_code_ver) { - ram_code_ver_match = 1; - tp->HwHasWrRamCodeToMicroP = TRUE; - } - - return ram_code_ver_match; -} - -bool -rtl8125_set_phy_mcu_patch_request(struct rtl8125_private *tp) -{ - u16 gphy_val; - u16 WaitCount; - bool bSuccess = TRUE; - - SetEthPhyOcpBit(tp, 0xB820, BIT_4); - - WaitCount = 0; - do { - gphy_val = mdio_direct_read_phy_ocp(tp, 0xB800); - udelay(100); - WaitCount++; - } while (!(gphy_val & BIT_6) && (WaitCount < 1000)); - - if (!(gphy_val & BIT_6) && (WaitCount == 1000)) bSuccess = FALSE; - - if (!bSuccess) - dprintk("rtl8125_set_phy_mcu_patch_request fail.\n"); - - return bSuccess; -} - -bool -rtl8125_clear_phy_mcu_patch_request(struct rtl8125_private *tp) -{ - u16 gphy_val; - u16 WaitCount; - bool bSuccess = TRUE; - - ClearEthPhyOcpBit(tp, 0xB820, BIT_4); - - WaitCount = 0; - do { - gphy_val = mdio_direct_read_phy_ocp(tp, 0xB800); - udelay(100); - WaitCount++; - } while ((gphy_val & BIT_6) && (WaitCount < 1000)); - - if ((gphy_val & BIT_6) && (WaitCount == 1000)) bSuccess = FALSE; - - if (!bSuccess) - dprintk("rtl8125_clear_phy_mcu_patch_request fail.\n"); - - return bSuccess; -} - -#ifndef ENABLE_USE_FIRMWARE_FILE -static void -rtl8125_write_hw_phy_mcu_code_ver(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - mdio_direct_write_phy_ocp(tp, 0xA436, 0x801E); - mdio_direct_write_phy_ocp(tp, 0xA438, tp->sw_ram_code_ver); - tp->hw_ram_code_ver = tp->sw_ram_code_ver; - break; - } -} - -static void -rtl8125_acquire_phy_mcu_patch_key_lock(struct rtl8125_private *tp) -{ - u16 PatchKey; - - switch (tp->mcfg) { - case CFG_METHOD_2: - PatchKey = 0x8600; - break; - case CFG_METHOD_3: - case CFG_METHOD_6: - PatchKey = 0x8601; - break; - case CFG_METHOD_4: - PatchKey = 0x3700; - break; - case CFG_METHOD_5: - case CFG_METHOD_7: - PatchKey = 0x3701; - break; - default: - return; - } - mdio_direct_write_phy_ocp(tp, 0xA436, 0x8024); - mdio_direct_write_phy_ocp(tp, 0xA438, PatchKey); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xB82E); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0001); -} - -static void -rtl8125_release_phy_mcu_patch_key_lock(struct rtl8125_private *tp) -{ - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - mdio_direct_write_phy_ocp(tp, 0xA436, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - ClearEthPhyOcpBit(tp, 0xB82E, BIT_0); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x8024); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - break; - default: - break; - } -} - -static void -rtl8125_set_phy_mcu_ram_code(struct net_device *dev, const u16 *ramcode, u16 codesize) -{ - struct rtl8125_private *tp = netdev_priv(dev); - u16 i; - u16 addr; - u16 val; - - if (ramcode == NULL || codesize % 2) { - goto out; - } - - for (i = 0; i < codesize; i += 2) { - addr = ramcode[i]; - val = ramcode[i + 1]; - if (addr == 0xFFFF && val == 0xFFFF) { - break; - } - mdio_direct_write_phy_ocp(tp, addr, val); - } - -out: - return; -} - -static void -rtl8125_enable_phy_disable_mode(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - switch (tp->HwSuppCheckPhyDisableModeVer) { - case 3: - RTL_W8(tp, 0xF2, RTL_R8(tp, 0xF2) | BIT_5); - break; - } - - dprintk("enable phy disable mode.\n"); -} - -static void -rtl8125_disable_phy_disable_mode(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - switch (tp->HwSuppCheckPhyDisableModeVer) { - case 3: - RTL_W8(tp, 0xF2, RTL_R8(tp, 0xF2) & ~BIT_5); - break; - } - - mdelay(1); - - dprintk("disable phy disable mode.\n"); -} - -static void -rtl8125_set_hw_phy_before_init_phy_mcu(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - u16 PhyRegValue; - - switch (tp->mcfg) { - case CFG_METHOD_4: - mdio_direct_write_phy_ocp(tp, 0xBF86, 0x9000); - - SetEthPhyOcpBit(tp, 0xC402, BIT_10); - ClearEthPhyOcpBit(tp, 0xC402, BIT_10); - - PhyRegValue = mdio_direct_read_phy_ocp(tp, 0xBF86); - PhyRegValue &= (BIT_1 | BIT_0); - if (PhyRegValue != 0) - dprintk("PHY watch dog not clear, value = 0x%x \n", PhyRegValue); - - mdio_direct_write_phy_ocp(tp, 0xBD86, 0x1010); - mdio_direct_write_phy_ocp(tp, 0xBD88, 0x1010); - - ClearAndSetEthPhyOcpBit(tp, - 0xBD4E, - BIT_11 | BIT_10, - BIT_11); - ClearAndSetEthPhyOcpBit(tp, - 0xBF46, - BIT_11 | BIT_10 | BIT_9 | BIT_8, - BIT_10 | BIT_9 | BIT_8); - break; - } -} - -static void -rtl8125_real_set_phy_mcu_8125a_1(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - rtl8125_acquire_phy_mcu_patch_key_lock(tp); - - - SetEthPhyOcpBit(tp, 0xB820, BIT_7); - - - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA016); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA012); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA014); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8013); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8021); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x802f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x803d); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8042); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8051); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8051); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa088); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0a50); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8008); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd014); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd1a3); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x401a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd707); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x40c2); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x60a6); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5f8b); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0a86); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0a6c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8080); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd019); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd1a2); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x401a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd707); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x40c4); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x60a6); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5f8b); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0a86); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0a84); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd503); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8970); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c07); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0901); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd500); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xce01); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xcf09); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd705); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xceff); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xaf0a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd504); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1213); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8401); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd500); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8580); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1253); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd064); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd181); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd704); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4018); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd504); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xc50f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd706); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x2c59); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x804d); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xc60f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf002); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xc605); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xae02); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x10fd); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA026); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xffff); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA024); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xffff); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA022); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x10f4); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA020); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1252); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA006); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1206); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA004); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0a78); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA002); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0a60); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0a4f); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA008); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x3f00); - - - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA016); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0010); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA012); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA014); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8066); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x807c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8089); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x808e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x80a0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x80b2); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x80c2); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd501); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xce01); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x62db); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x655c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd73e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x60e9); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x614a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x61ab); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0501); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0304); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0503); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0304); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0505); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0304); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0509); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0304); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x653c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd73e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x60e9); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x614a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x61ab); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0503); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0304); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0502); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0304); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0506); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0304); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x050a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0304); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd73e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x60e9); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x614a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x61ab); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0505); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0304); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0506); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0304); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0504); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0304); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x050c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0304); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd73e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x60e9); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x614a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x61ab); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0509); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0304); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x050a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0304); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x050c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0304); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0508); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0304); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd501); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xce01); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd73e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x60e9); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x614a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x61ab); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0501); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0321); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0502); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0321); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0504); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0321); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0508); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0321); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0346); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd501); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xce01); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8208); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x609d); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa50f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x001a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0503); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x001a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x607d); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x00ab); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x00ab); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd501); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xce01); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x60fd); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa50f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xce00); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd500); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xaa0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x017b); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0503); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xce00); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd500); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0a05); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x017b); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd501); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xce01); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x60fd); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa50f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xce00); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd500); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xaa0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x01e0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0503); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xce00); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd500); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0a05); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x01e0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x60fd); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa50f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xce00); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd500); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xaa0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0231); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0503); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xce00); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd500); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0a05); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0231); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA08E); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xffff); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA08C); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0221); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA08A); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x01ce); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA088); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0169); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA086); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x00a6); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA084); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x000d); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA082); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0308); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA080); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x029f); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA090); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x007f); - - - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA016); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0020); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA012); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA014); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8017); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x801b); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8029); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8054); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x805a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8064); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x80a7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x9430); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x9480); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb408); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd120); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd057); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x064b); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xcb80); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x9906); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0567); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xcb94); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8190); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x82a0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x800a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8406); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa740); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8dff); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x07e4); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa840); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0773); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xcb91); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4063); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd139); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf002); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd140); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd040); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb404); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d00); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x07dc); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa610); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa110); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa2a0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa404); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd704); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4045); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa180); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd704); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x405d); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa720); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0742); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x07ec); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5f74); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0742); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd702); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x7fb6); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8190); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x82a0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8404); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8610); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d01); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x07dc); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x064b); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x07c0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5fa7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0481); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x94bc); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x870c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa190); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa00a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa280); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa404); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8220); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x078e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xcb92); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa840); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4063); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd140); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf002); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd150); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd040); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd703); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x60a0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x6121); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x61a2); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x6223); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf02f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0cf0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d10); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa740); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf00f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0cf0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d20); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa740); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf00a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0cf0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d30); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa740); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf005); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0cf0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d40); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa740); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x07e4); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa610); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa008); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd704); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4046); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa002); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd704); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x405d); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa720); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0742); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x07f7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5f74); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0742); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd702); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x7fb5); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x800a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0cf0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d00); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x07e4); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa740); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd701); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x3ad4); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0537); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8610); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8840); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x064b); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8301); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x800a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8190); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x82a0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8404); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa70c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x9402); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x890c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8840); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x064b); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA10E); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0642); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA10C); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0686); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA10A); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0788); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA108); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x047b); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA106); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x065c); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA104); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0769); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA102); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0565); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA100); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x06f9); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA110); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x00ff); - - - mdio_direct_write_phy_ocp(tp, 0xA436, 0xb87c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8530); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xb87e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xaf85); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x3caf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8593); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xaf85); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x9caf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x85a5); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf86); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd702); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5afb); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xe083); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xfb0c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x020d); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x021b); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x10bf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x86d7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb7bf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x86da); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xfbe0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x83fc); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c02); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d02); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1b10); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf86); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xda02); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf86); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xdd02); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5afb); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xe083); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xfd0c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x020d); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x021b); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x10bf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x86dd); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb7bf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x86e0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xfbe0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x83fe); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c02); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d02); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1b10); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf86); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xe002); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xaf2f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbd02); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x2cac); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0286); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x65af); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x212b); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x022c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x6002); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x86b6); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xaf21); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0cd1); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x03bf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8710); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb7bf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x870d); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb7bf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8719); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb7bf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8716); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb7bf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x871f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb7bf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x871c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb7bf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8728); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb7bf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8725); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb7bf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8707); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xfbad); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x281c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd100); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0a02); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1302); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x2202); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x2b02); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xae1a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd101); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0a02); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1302); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x2202); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x2b02); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd101); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x3402); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x3102); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x3d02); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x3a02); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4302); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4002); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4c02); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4902); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd100); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x2e02); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x3702); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4602); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4f02); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xaf35); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x7ff8); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xfaef); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x69bf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x86e3); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xfbbf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x86fb); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb7bf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x86e6); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xfbbf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x86fe); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb7bf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x86e9); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xfbbf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8701); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb7bf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x86ec); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xfbbf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8704); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb7bf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x86ef); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0262); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x7cbf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x86f2); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0262); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x7cbf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x86f5); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0262); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x7cbf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x86f8); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0262); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x7cef); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x96fe); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xfc04); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf8fa); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xef69); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf86); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xef02); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x6273); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf86); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf202); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x6273); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf86); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf502); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x6273); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf86); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf802); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x6273); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xef96); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xfefc); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0420); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb540); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x53b5); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4086); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb540); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb9b5); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x40c8); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb03a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xc8b0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbac8); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb13a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xc8b1); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xba77); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbd26); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xffbd); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x2677); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbd28); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xffbd); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x2840); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbd26); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xc8bd); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x2640); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbd28); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xc8bd); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x28bb); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa430); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x98b0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1eba); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb01e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xdcb0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1e98); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb09e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbab0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x9edc); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb09e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x98b1); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1eba); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb11e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xdcb1); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1e98); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb19e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbab1); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x9edc); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb19e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x11b0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1e22); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb01e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x33b0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1e11); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb09e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x22b0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x9e33); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb09e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x11b1); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1e22); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb11e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x33b1); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1e11); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb19e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x22b1); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x9e33); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb19e); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xb85e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x2f71); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xb860); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x20d9); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xb862); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x2109); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xb864); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x34e7); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xb878); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x000f); - - - ClearEthPhyOcpBit(tp, 0xB820, BIT_7); - - - rtl8125_release_phy_mcu_patch_key_lock(tp); -} - -static void -rtl8125_set_phy_mcu_8125a_1(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - rtl8125_set_phy_mcu_patch_request(tp); - - rtl8125_real_set_phy_mcu_8125a_1(dev); - - rtl8125_clear_phy_mcu_patch_request(tp); -} - -static void -rtl8125_real_set_phy_mcu_8125a_2(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - rtl8125_acquire_phy_mcu_patch_key_lock(tp); - - - SetEthPhyOcpBit(tp, 0xB820, BIT_7); - - - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA016); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA012); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA014); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x808b); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x808f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8093); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8097); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x809d); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x80a1); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x80aa); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd718); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x607b); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x40da); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf00e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x42da); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf01e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd718); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x615b); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1456); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x14a4); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x14bc); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd718); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5f2e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf01c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1456); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x14a4); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x14bc); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd718); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5f2e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf024); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1456); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x14a4); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x14bc); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd718); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5f2e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf02c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1456); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x14a4); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x14bc); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd718); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5f2e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf034); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd719); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4118); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd504); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xac11); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd501); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xce01); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa410); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xce00); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd500); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4779); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd504); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xac0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xae01); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd500); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1444); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf034); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd719); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4118); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd504); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xac22); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd501); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xce01); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa420); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xce00); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd500); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4559); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd504); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xac0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xae01); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd500); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1444); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf023); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd719); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4118); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd504); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xac44); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd501); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xce01); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa440); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xce00); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd500); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4339); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd504); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xac0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xae01); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd500); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1444); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf012); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd719); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4118); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd504); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xac88); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd501); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xce01); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa480); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xce00); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd500); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4119); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd504); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xac0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xae01); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd500); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1444); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf001); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1456); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd718); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5fac); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xc48f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x141b); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd504); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x121a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd0b4); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd1bb); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0898); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd0b4); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd1bb); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0a0e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd064); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd18a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0b7e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x401c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd501); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa804); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8804); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x053b); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd500); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa301); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0648); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xc520); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa201); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd701); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x252d); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1646); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd708); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4006); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1646); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0308); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA026); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0307); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA024); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1645); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA022); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0647); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA020); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x053a); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA006); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0b7c); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA004); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0a0c); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA002); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0896); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x11a1); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA008); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xff00); - - - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA016); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0010); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA012); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA014); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8015); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x801a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x801a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x801a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x801a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x801a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x801a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xad02); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x02d7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x00ed); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0509); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xc100); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x008f); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA08E); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xffff); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA08C); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xffff); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA08A); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xffff); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA088); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xffff); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA086); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xffff); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA084); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xffff); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA082); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x008d); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA080); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x00eb); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA090); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0103); - - - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA016); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0020); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA012); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA014); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8014); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8018); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8024); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8051); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8055); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8072); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x80dc); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xfffd); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xfffd); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8301); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x800a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8190); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x82a0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8404); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa70c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x9402); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x890c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8840); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa380); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x066e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xcb91); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4063); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd139); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf002); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd140); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd040); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb404); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d00); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x07e0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa610); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa110); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa2a0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa404); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd704); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4085); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa180); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa404); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8280); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd704); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x405d); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa720); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0743); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x07f0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5f74); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0743); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd702); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x7fb6); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8190); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x82a0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8404); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8610); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d01); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x07e0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x066e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd158); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd04d); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x03d4); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x94bc); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x870c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8380); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd10d); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd040); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x07c4); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5fb4); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa190); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa00a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa280); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa404); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa220); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd130); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd040); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x07c4); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5fb4); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbb80); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd1c4); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd074); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa301); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd704); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x604b); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa90c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0556); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xcb92); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4063); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd116); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf002); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd119); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd040); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd703); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x60a0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x6241); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x63e2); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x6583); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf054); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd701); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x611e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd701); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x40da); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0cf0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d10); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa010); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8740); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf02f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0cf0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d50); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa740); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf02a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd701); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x611e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd701); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x40da); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0cf0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d20); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa010); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8740); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf021); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0cf0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d60); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa740); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf01c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd701); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x611e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd701); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x40da); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0cf0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d30); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa010); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8740); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf013); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0cf0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d70); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa740); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf00e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd701); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x611e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd701); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x40da); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0cf0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d40); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa010); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8740); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf005); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0cf0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d80); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa740); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x07e8); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa610); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd704); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x405d); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa720); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ff4); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa008); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd704); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4046); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa002); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0743); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x07fb); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd703); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x7f6f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x7f4e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x7f2d); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x7f0c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x800a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0cf0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d00); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x07e8); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa740); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0743); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd702); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x7fb5); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd701); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x3ad4); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0556); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8610); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x066e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd1f5); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd049); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x01ec); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA10E); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x01ea); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA10C); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x06a9); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA10A); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x078a); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA108); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x03d2); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA106); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x067f); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA104); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0665); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA102); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA100); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA110); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x00fc); - - - mdio_direct_write_phy_ocp(tp, 0xA436, 0xb87c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8530); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xb87e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xaf85); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x3caf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8545); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xaf85); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x45af); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8545); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xee82); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf900); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0103); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xaf03); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb7f8); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xe0a6); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x00e1); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa601); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xef01); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x58f0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa080); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x37a1); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8402); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xae16); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa185); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x02ae); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x11a1); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8702); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xae0c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa188); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x02ae); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x07a1); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8902); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xae02); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xae1c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xe0b4); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x62e1); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb463); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x6901); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xe4b4); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x62e5); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb463); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xe0b4); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x62e1); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb463); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x6901); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xe4b4); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x62e5); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb463); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xfc04); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xb85e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x03b3); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xb860); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xffff); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xb862); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xffff); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xb864); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xffff); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xb878); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0001); - - - ClearEthPhyOcpBit(tp, 0xB820, BIT_7); - - - rtl8125_release_phy_mcu_patch_key_lock(tp); -} - -static void -rtl8125_set_phy_mcu_8125a_2(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - rtl8125_set_phy_mcu_patch_request(tp); - - rtl8125_real_set_phy_mcu_8125a_2(dev); - - rtl8125_clear_phy_mcu_patch_request(tp); -} - -static const u16 phy_mcu_ram_code_8125b_1[] = { - 0xa436, 0x8024, 0xa438, 0x3700, 0xa436, 0xB82E, 0xa438, 0x0001, - 0xb820, 0x0090, 0xa436, 0xA016, 0xa438, 0x0000, 0xa436, 0xA012, - 0xa438, 0x0000, 0xa436, 0xA014, 0xa438, 0x1800, 0xa438, 0x8010, - 0xa438, 0x1800, 0xa438, 0x8025, 0xa438, 0x1800, 0xa438, 0x803a, - 0xa438, 0x1800, 0xa438, 0x8044, 0xa438, 0x1800, 0xa438, 0x8083, - 0xa438, 0x1800, 0xa438, 0x808d, 0xa438, 0x1800, 0xa438, 0x808d, - 0xa438, 0x1800, 0xa438, 0x808d, 0xa438, 0xd712, 0xa438, 0x4077, - 0xa438, 0xd71e, 0xa438, 0x4159, 0xa438, 0xd71e, 0xa438, 0x6099, - 0xa438, 0x7f44, 0xa438, 0x1800, 0xa438, 0x1a14, 0xa438, 0x9040, - 0xa438, 0x9201, 0xa438, 0x1800, 0xa438, 0x1b1a, 0xa438, 0xd71e, - 0xa438, 0x2425, 0xa438, 0x1a14, 0xa438, 0xd71f, 0xa438, 0x3ce5, - 0xa438, 0x1afb, 0xa438, 0x1800, 0xa438, 0x1b00, 0xa438, 0xd712, - 0xa438, 0x4077, 0xa438, 0xd71e, 0xa438, 0x4159, 0xa438, 0xd71e, - 0xa438, 0x60b9, 0xa438, 0x2421, 0xa438, 0x1c17, 0xa438, 0x1800, - 0xa438, 0x1a14, 0xa438, 0x9040, 0xa438, 0x1800, 0xa438, 0x1c2c, - 0xa438, 0xd71e, 0xa438, 0x2425, 0xa438, 0x1a14, 0xa438, 0xd71f, - 0xa438, 0x3ce5, 0xa438, 0x1c0f, 0xa438, 0x1800, 0xa438, 0x1c13, - 0xa438, 0xd702, 0xa438, 0xd501, 0xa438, 0x6072, 0xa438, 0x8401, - 0xa438, 0xf002, 0xa438, 0xa401, 0xa438, 0x1000, 0xa438, 0x146e, - 0xa438, 0x1800, 0xa438, 0x0b77, 0xa438, 0xd703, 0xa438, 0x665d, - 0xa438, 0x653e, 0xa438, 0x641f, 0xa438, 0xd700, 0xa438, 0x62c4, - 0xa438, 0x6185, 0xa438, 0x6066, 0xa438, 0x1800, 0xa438, 0x165a, - 0xa438, 0xc101, 0xa438, 0xcb00, 0xa438, 0x1000, 0xa438, 0x1945, - 0xa438, 0xd700, 0xa438, 0x7fa6, 0xa438, 0x1800, 0xa438, 0x807d, - 0xa438, 0xc102, 0xa438, 0xcb00, 0xa438, 0x1000, 0xa438, 0x1945, - 0xa438, 0xd700, 0xa438, 0x2569, 0xa438, 0x8058, 0xa438, 0x1800, - 0xa438, 0x807d, 0xa438, 0xc104, 0xa438, 0xcb00, 0xa438, 0x1000, - 0xa438, 0x1945, 0xa438, 0xd700, 0xa438, 0x7fa4, 0xa438, 0x1800, - 0xa438, 0x807d, 0xa438, 0xc120, 0xa438, 0xcb00, 0xa438, 0x1000, - 0xa438, 0x1945, 0xa438, 0xd703, 0xa438, 0x7fbf, 0xa438, 0x1800, - 0xa438, 0x807d, 0xa438, 0xc140, 0xa438, 0xcb00, 0xa438, 0x1000, - 0xa438, 0x1945, 0xa438, 0xd703, 0xa438, 0x7fbe, 0xa438, 0x1800, - 0xa438, 0x807d, 0xa438, 0xc180, 0xa438, 0xcb00, 0xa438, 0x1000, - 0xa438, 0x1945, 0xa438, 0xd703, 0xa438, 0x7fbd, 0xa438, 0xc100, - 0xa438, 0xcb00, 0xa438, 0xd708, 0xa438, 0x6018, 0xa438, 0x1800, - 0xa438, 0x165a, 0xa438, 0x1000, 0xa438, 0x14f6, 0xa438, 0xd014, - 0xa438, 0xd1e3, 0xa438, 0x1000, 0xa438, 0x1356, 0xa438, 0xd705, - 0xa438, 0x5fbe, 0xa438, 0x1800, 0xa438, 0x1559, 0xa436, 0xA026, - 0xa438, 0xffff, 0xa436, 0xA024, 0xa438, 0xffff, 0xa436, 0xA022, - 0xa438, 0xffff, 0xa436, 0xA020, 0xa438, 0x1557, 0xa436, 0xA006, - 0xa438, 0x1677, 0xa436, 0xA004, 0xa438, 0x0b75, 0xa436, 0xA002, - 0xa438, 0x1c17, 0xa436, 0xA000, 0xa438, 0x1b04, 0xa436, 0xA008, - 0xa438, 0x1f00, 0xa436, 0xA016, 0xa438, 0x0020, 0xa436, 0xA012, - 0xa438, 0x0000, 0xa436, 0xA014, 0xa438, 0x1800, 0xa438, 0x8010, - 0xa438, 0x1800, 0xa438, 0x817f, 0xa438, 0x1800, 0xa438, 0x82ab, - 0xa438, 0x1800, 0xa438, 0x83f8, 0xa438, 0x1800, 0xa438, 0x8444, - 0xa438, 0x1800, 0xa438, 0x8454, 0xa438, 0x1800, 0xa438, 0x8459, - 0xa438, 0x1800, 0xa438, 0x8465, 0xa438, 0xcb11, 0xa438, 0xa50c, - 0xa438, 0x8310, 0xa438, 0xd701, 0xa438, 0x4076, 0xa438, 0x0c03, - 0xa438, 0x0903, 0xa438, 0xd700, 0xa438, 0x6083, 0xa438, 0x0c1f, - 0xa438, 0x0d00, 0xa438, 0xf003, 0xa438, 0x0c1f, 0xa438, 0x0d00, - 0xa438, 0x1000, 0xa438, 0x0a7d, 0xa438, 0x1000, 0xa438, 0x0a4d, - 0xa438, 0xcb12, 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd71f, - 0xa438, 0x5f84, 0xa438, 0xd102, 0xa438, 0xd040, 0xa438, 0x1000, - 0xa438, 0x0a5e, 0xa438, 0xd700, 0xa438, 0x5fb4, 0xa438, 0xd701, - 0xa438, 0x60f3, 0xa438, 0xd413, 0xa438, 0x1000, 0xa438, 0x0a37, - 0xa438, 0xd410, 0xa438, 0x1000, 0xa438, 0x0a37, 0xa438, 0xcb13, - 0xa438, 0xa108, 0xa438, 0x1000, 0xa438, 0x0a42, 0xa438, 0x8108, - 0xa438, 0xa00a, 0xa438, 0xa910, 0xa438, 0xa780, 0xa438, 0xd14a, - 0xa438, 0xd048, 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd701, - 0xa438, 0x6255, 0xa438, 0xd700, 0xa438, 0x5f74, 0xa438, 0x6326, - 0xa438, 0xd702, 0xa438, 0x5f07, 0xa438, 0x800a, 0xa438, 0xa004, - 0xa438, 0x1000, 0xa438, 0x0a42, 0xa438, 0x8004, 0xa438, 0xa001, - 0xa438, 0x1000, 0xa438, 0x0a42, 0xa438, 0x8001, 0xa438, 0x0c03, - 0xa438, 0x0902, 0xa438, 0xffe2, 0xa438, 0x1000, 0xa438, 0x0a5e, - 0xa438, 0xd71f, 0xa438, 0x5fab, 0xa438, 0xba08, 0xa438, 0x1000, - 0xa438, 0x0a5e, 0xa438, 0xd71f, 0xa438, 0x7f8b, 0xa438, 0x9a08, - 0xa438, 0x800a, 0xa438, 0xd702, 0xa438, 0x6535, 0xa438, 0xd40d, - 0xa438, 0x1000, 0xa438, 0x0a37, 0xa438, 0xcb14, 0xa438, 0xa004, - 0xa438, 0x1000, 0xa438, 0x0a42, 0xa438, 0x8004, 0xa438, 0xa001, - 0xa438, 0x1000, 0xa438, 0x0a42, 0xa438, 0x8001, 0xa438, 0xa00a, - 0xa438, 0xa780, 0xa438, 0xd14a, 0xa438, 0xd048, 0xa438, 0x1000, - 0xa438, 0x0a5e, 0xa438, 0xd700, 0xa438, 0x5fb4, 0xa438, 0x6206, - 0xa438, 0xd702, 0xa438, 0x5f47, 0xa438, 0x800a, 0xa438, 0xa004, - 0xa438, 0x1000, 0xa438, 0x0a42, 0xa438, 0x8004, 0xa438, 0xa001, - 0xa438, 0x1000, 0xa438, 0x0a42, 0xa438, 0x8001, 0xa438, 0x0c03, - 0xa438, 0x0902, 0xa438, 0x1800, 0xa438, 0x8064, 0xa438, 0x800a, - 0xa438, 0xd40e, 0xa438, 0x1000, 0xa438, 0x0a37, 0xa438, 0xb920, - 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd71f, 0xa438, 0x5fac, - 0xa438, 0x9920, 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd71f, - 0xa438, 0x7f8c, 0xa438, 0xd701, 0xa438, 0x6073, 0xa438, 0xd701, - 0xa438, 0x4216, 0xa438, 0xa004, 0xa438, 0x1000, 0xa438, 0x0a42, - 0xa438, 0x8004, 0xa438, 0xa001, 0xa438, 0x1000, 0xa438, 0x0a42, - 0xa438, 0x8001, 0xa438, 0xd120, 0xa438, 0xd040, 0xa438, 0x1000, - 0xa438, 0x0a5e, 0xa438, 0xd700, 0xa438, 0x5fb4, 0xa438, 0x8504, - 0xa438, 0xcb21, 0xa438, 0xa301, 0xa438, 0x1000, 0xa438, 0x0a5e, - 0xa438, 0xd700, 0xa438, 0x5f9f, 0xa438, 0x8301, 0xa438, 0xd704, - 0xa438, 0x40e0, 0xa438, 0xd196, 0xa438, 0xd04d, 0xa438, 0x1000, - 0xa438, 0x0a5e, 0xa438, 0xd700, 0xa438, 0x5fb4, 0xa438, 0xcb22, - 0xa438, 0x1000, 0xa438, 0x0a6d, 0xa438, 0x0c03, 0xa438, 0x1502, - 0xa438, 0xa640, 0xa438, 0x9503, 0xa438, 0x8910, 0xa438, 0x8720, - 0xa438, 0xd700, 0xa438, 0x6083, 0xa438, 0x0c1f, 0xa438, 0x0d01, - 0xa438, 0xf003, 0xa438, 0x0c1f, 0xa438, 0x0d01, 0xa438, 0x1000, - 0xa438, 0x0a7d, 0xa438, 0x0c1f, 0xa438, 0x0f14, 0xa438, 0xcb23, - 0xa438, 0x8fc0, 0xa438, 0x1000, 0xa438, 0x0a25, 0xa438, 0xaf40, - 0xa438, 0x1000, 0xa438, 0x0a25, 0xa438, 0x0cc0, 0xa438, 0x0f80, - 0xa438, 0x1000, 0xa438, 0x0a25, 0xa438, 0xafc0, 0xa438, 0x1000, - 0xa438, 0x0a25, 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd701, - 0xa438, 0x5dee, 0xa438, 0xcb24, 0xa438, 0x8f1f, 0xa438, 0x1000, - 0xa438, 0x0a5e, 0xa438, 0xd701, 0xa438, 0x7f6e, 0xa438, 0xa111, - 0xa438, 0xa215, 0xa438, 0xa401, 0xa438, 0x8404, 0xa438, 0xa720, - 0xa438, 0xcb25, 0xa438, 0x0c03, 0xa438, 0x1502, 0xa438, 0x8640, - 0xa438, 0x9503, 0xa438, 0x1000, 0xa438, 0x0b43, 0xa438, 0x1000, - 0xa438, 0x0b86, 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xb920, - 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd71f, 0xa438, 0x5fac, - 0xa438, 0x9920, 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd71f, - 0xa438, 0x7f8c, 0xa438, 0xcb26, 0xa438, 0x1000, 0xa438, 0x0a5e, - 0xa438, 0xd71f, 0xa438, 0x5f82, 0xa438, 0x8111, 0xa438, 0x8205, - 0xa438, 0x8404, 0xa438, 0xcb27, 0xa438, 0xd404, 0xa438, 0x1000, - 0xa438, 0x0a37, 0xa438, 0xd700, 0xa438, 0x6083, 0xa438, 0x0c1f, - 0xa438, 0x0d02, 0xa438, 0xf003, 0xa438, 0x0c1f, 0xa438, 0x0d02, - 0xa438, 0x1000, 0xa438, 0x0a7d, 0xa438, 0xa710, 0xa438, 0xa104, - 0xa438, 0x1000, 0xa438, 0x0a42, 0xa438, 0x8104, 0xa438, 0xa001, - 0xa438, 0x1000, 0xa438, 0x0a42, 0xa438, 0x8001, 0xa438, 0xa120, - 0xa438, 0xaa0f, 0xa438, 0x8110, 0xa438, 0xa284, 0xa438, 0xa404, - 0xa438, 0xa00a, 0xa438, 0xd193, 0xa438, 0xd046, 0xa438, 0x1000, - 0xa438, 0x0a5e, 0xa438, 0xd700, 0xa438, 0x5fb4, 0xa438, 0xcb28, - 0xa438, 0xa110, 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd700, - 0xa438, 0x5fa8, 0xa438, 0x8110, 0xa438, 0x8284, 0xa438, 0xa404, - 0xa438, 0x800a, 0xa438, 0x8710, 0xa438, 0xb804, 0xa438, 0x1000, - 0xa438, 0x0a5e, 0xa438, 0xd71f, 0xa438, 0x7f82, 0xa438, 0x9804, - 0xa438, 0xcb29, 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd71f, - 0xa438, 0x5f85, 0xa438, 0xa710, 0xa438, 0xb820, 0xa438, 0x1000, - 0xa438, 0x0a5e, 0xa438, 0xd71f, 0xa438, 0x7f65, 0xa438, 0x9820, - 0xa438, 0xcb2a, 0xa438, 0xa190, 0xa438, 0xa284, 0xa438, 0xa404, - 0xa438, 0xa00a, 0xa438, 0xd13d, 0xa438, 0xd04a, 0xa438, 0x1000, - 0xa438, 0x0a5e, 0xa438, 0xd700, 0xa438, 0x3444, 0xa438, 0x8149, - 0xa438, 0xa220, 0xa438, 0xd1a0, 0xa438, 0xd040, 0xa438, 0x1000, - 0xa438, 0x0a5e, 0xa438, 0xd700, 0xa438, 0x3444, 0xa438, 0x8151, - 0xa438, 0xd702, 0xa438, 0x5f51, 0xa438, 0xcb2f, 0xa438, 0xa302, - 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd708, 0xa438, 0x5f63, - 0xa438, 0xd411, 0xa438, 0x1000, 0xa438, 0x0a37, 0xa438, 0x8302, - 0xa438, 0xd409, 0xa438, 0x1000, 0xa438, 0x0a37, 0xa438, 0xb920, - 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd71f, 0xa438, 0x5fac, - 0xa438, 0x9920, 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd71f, - 0xa438, 0x7f8c, 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd71f, - 0xa438, 0x5fa3, 0xa438, 0x8190, 0xa438, 0x82a4, 0xa438, 0x8404, - 0xa438, 0x800a, 0xa438, 0xb808, 0xa438, 0x1000, 0xa438, 0x0a5e, - 0xa438, 0xd71f, 0xa438, 0x7fa3, 0xa438, 0x9808, 0xa438, 0x1800, - 0xa438, 0x0433, 0xa438, 0xcb15, 0xa438, 0xa508, 0xa438, 0xd700, - 0xa438, 0x6083, 0xa438, 0x0c1f, 0xa438, 0x0d01, 0xa438, 0xf003, - 0xa438, 0x0c1f, 0xa438, 0x0d01, 0xa438, 0x1000, 0xa438, 0x0a7d, - 0xa438, 0x1000, 0xa438, 0x0a4d, 0xa438, 0xa301, 0xa438, 0x1000, - 0xa438, 0x0a5e, 0xa438, 0xd700, 0xa438, 0x5f9f, 0xa438, 0x8301, - 0xa438, 0xd704, 0xa438, 0x40e0, 0xa438, 0xd115, 0xa438, 0xd04f, - 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd700, 0xa438, 0x5fb4, - 0xa438, 0xd413, 0xa438, 0x1000, 0xa438, 0x0a37, 0xa438, 0xcb16, - 0xa438, 0x1000, 0xa438, 0x0a6d, 0xa438, 0x0c03, 0xa438, 0x1502, - 0xa438, 0xa640, 0xa438, 0x9503, 0xa438, 0x8720, 0xa438, 0xd17a, - 0xa438, 0xd04c, 0xa438, 0x0c1f, 0xa438, 0x0f14, 0xa438, 0xcb17, - 0xa438, 0x8fc0, 0xa438, 0x1000, 0xa438, 0x0a25, 0xa438, 0xaf40, - 0xa438, 0x1000, 0xa438, 0x0a25, 0xa438, 0x0cc0, 0xa438, 0x0f80, - 0xa438, 0x1000, 0xa438, 0x0a25, 0xa438, 0xafc0, 0xa438, 0x1000, - 0xa438, 0x0a25, 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd701, - 0xa438, 0x61ce, 0xa438, 0xd700, 0xa438, 0x5db4, 0xa438, 0xcb18, - 0xa438, 0x0c03, 0xa438, 0x1502, 0xa438, 0x8640, 0xa438, 0x9503, - 0xa438, 0xa720, 0xa438, 0x1000, 0xa438, 0x0b43, 0xa438, 0x1000, - 0xa438, 0x0a5e, 0xa438, 0xffd6, 0xa438, 0x8f1f, 0xa438, 0x1000, - 0xa438, 0x0a5e, 0xa438, 0xd701, 0xa438, 0x7f8e, 0xa438, 0xa131, - 0xa438, 0xaa0f, 0xa438, 0xa2d5, 0xa438, 0xa407, 0xa438, 0xa720, - 0xa438, 0x8310, 0xa438, 0xa308, 0xa438, 0x8308, 0xa438, 0xcb19, - 0xa438, 0x0c03, 0xa438, 0x1502, 0xa438, 0x8640, 0xa438, 0x9503, - 0xa438, 0x1000, 0xa438, 0x0b43, 0xa438, 0x1000, 0xa438, 0x0b86, - 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xb920, 0xa438, 0x1000, - 0xa438, 0x0a5e, 0xa438, 0xd71f, 0xa438, 0x5fac, 0xa438, 0x9920, - 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd71f, 0xa438, 0x7f8c, - 0xa438, 0xcb1a, 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd71f, - 0xa438, 0x5f82, 0xa438, 0x8111, 0xa438, 0x82c5, 0xa438, 0xa404, - 0xa438, 0x8402, 0xa438, 0xb804, 0xa438, 0x1000, 0xa438, 0x0a5e, - 0xa438, 0xd71f, 0xa438, 0x7f82, 0xa438, 0x9804, 0xa438, 0xcb1b, - 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd71f, 0xa438, 0x5f85, - 0xa438, 0xa710, 0xa438, 0xb820, 0xa438, 0x1000, 0xa438, 0x0a5e, - 0xa438, 0xd71f, 0xa438, 0x7f65, 0xa438, 0x9820, 0xa438, 0xcb1c, - 0xa438, 0xd700, 0xa438, 0x6083, 0xa438, 0x0c1f, 0xa438, 0x0d02, - 0xa438, 0xf003, 0xa438, 0x0c1f, 0xa438, 0x0d02, 0xa438, 0x1000, - 0xa438, 0x0a7d, 0xa438, 0xa110, 0xa438, 0xa284, 0xa438, 0xa404, - 0xa438, 0x8402, 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd700, - 0xa438, 0x5fa8, 0xa438, 0xcb1d, 0xa438, 0xa180, 0xa438, 0xa402, - 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd700, 0xa438, 0x5fa8, - 0xa438, 0xa220, 0xa438, 0xd1f5, 0xa438, 0xd049, 0xa438, 0x1000, - 0xa438, 0x0a5e, 0xa438, 0xd700, 0xa438, 0x3444, 0xa438, 0x8221, - 0xa438, 0xd702, 0xa438, 0x5f51, 0xa438, 0xb920, 0xa438, 0x1000, - 0xa438, 0x0a5e, 0xa438, 0xd71f, 0xa438, 0x5fac, 0xa438, 0x9920, - 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd71f, 0xa438, 0x7f8c, - 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd71f, 0xa438, 0x5fa3, - 0xa438, 0xa504, 0xa438, 0xd700, 0xa438, 0x6083, 0xa438, 0x0c1f, - 0xa438, 0x0d00, 0xa438, 0xf003, 0xa438, 0x0c1f, 0xa438, 0x0d00, - 0xa438, 0x1000, 0xa438, 0x0a7d, 0xa438, 0xa00a, 0xa438, 0x8190, - 0xa438, 0x82a4, 0xa438, 0x8402, 0xa438, 0xa404, 0xa438, 0xb808, - 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd71f, 0xa438, 0x7fa3, - 0xa438, 0x9808, 0xa438, 0xcb2b, 0xa438, 0xcb2c, 0xa438, 0x1000, - 0xa438, 0x0a5e, 0xa438, 0xd71f, 0xa438, 0x5f84, 0xa438, 0xd14a, - 0xa438, 0xd048, 0xa438, 0xa780, 0xa438, 0xcb2d, 0xa438, 0x1000, - 0xa438, 0x0a5e, 0xa438, 0xd700, 0xa438, 0x5f94, 0xa438, 0x6208, - 0xa438, 0xd702, 0xa438, 0x5f27, 0xa438, 0x800a, 0xa438, 0xa004, - 0xa438, 0x1000, 0xa438, 0x0a42, 0xa438, 0x8004, 0xa438, 0xa001, - 0xa438, 0x1000, 0xa438, 0x0a42, 0xa438, 0x8001, 0xa438, 0x0c03, - 0xa438, 0x0902, 0xa438, 0xa00a, 0xa438, 0xffe9, 0xa438, 0xcb2e, - 0xa438, 0xd700, 0xa438, 0x6083, 0xa438, 0x0c1f, 0xa438, 0x0d02, - 0xa438, 0xf003, 0xa438, 0x0c1f, 0xa438, 0x0d02, 0xa438, 0x1000, - 0xa438, 0x0a7d, 0xa438, 0xa190, 0xa438, 0xa284, 0xa438, 0xa406, - 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd700, 0xa438, 0x5fa8, - 0xa438, 0xa220, 0xa438, 0xd1a0, 0xa438, 0xd040, 0xa438, 0x1000, - 0xa438, 0x0a5e, 0xa438, 0xd700, 0xa438, 0x3444, 0xa438, 0x827d, - 0xa438, 0xd702, 0xa438, 0x5f51, 0xa438, 0xcb2f, 0xa438, 0xa302, - 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd708, 0xa438, 0x5f63, - 0xa438, 0xd411, 0xa438, 0x1000, 0xa438, 0x0a37, 0xa438, 0x8302, - 0xa438, 0xd409, 0xa438, 0x1000, 0xa438, 0x0a37, 0xa438, 0xb920, - 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd71f, 0xa438, 0x5fac, - 0xa438, 0x9920, 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd71f, - 0xa438, 0x7f8c, 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd71f, - 0xa438, 0x5fa3, 0xa438, 0x8190, 0xa438, 0x82a4, 0xa438, 0x8406, - 0xa438, 0x800a, 0xa438, 0xb808, 0xa438, 0x1000, 0xa438, 0x0a5e, - 0xa438, 0xd71f, 0xa438, 0x7fa3, 0xa438, 0x9808, 0xa438, 0x1800, - 0xa438, 0x0433, 0xa438, 0xcb30, 0xa438, 0x8380, 0xa438, 0xcb31, - 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd71f, 0xa438, 0x5f86, - 0xa438, 0x9308, 0xa438, 0xb204, 0xa438, 0xb301, 0xa438, 0x1000, - 0xa438, 0x0a5e, 0xa438, 0xd701, 0xa438, 0x5fa2, 0xa438, 0xb302, - 0xa438, 0x9204, 0xa438, 0xcb32, 0xa438, 0xd408, 0xa438, 0x1000, - 0xa438, 0x0a37, 0xa438, 0xd141, 0xa438, 0xd043, 0xa438, 0x1000, - 0xa438, 0x0a5e, 0xa438, 0xd700, 0xa438, 0x5fb4, 0xa438, 0xd704, - 0xa438, 0x4ccc, 0xa438, 0xd700, 0xa438, 0x4c81, 0xa438, 0xd702, - 0xa438, 0x609e, 0xa438, 0xd1e5, 0xa438, 0xd04d, 0xa438, 0xf003, - 0xa438, 0xd1e5, 0xa438, 0xd04d, 0xa438, 0x1000, 0xa438, 0x0a5e, - 0xa438, 0xd700, 0xa438, 0x5fb4, 0xa438, 0xd700, 0xa438, 0x6083, - 0xa438, 0x0c1f, 0xa438, 0x0d01, 0xa438, 0xf003, 0xa438, 0x0c1f, - 0xa438, 0x0d01, 0xa438, 0x1000, 0xa438, 0x0a7d, 0xa438, 0x8710, - 0xa438, 0xa108, 0xa438, 0x1000, 0xa438, 0x0a42, 0xa438, 0x8108, - 0xa438, 0xa203, 0xa438, 0x8120, 0xa438, 0x8a0f, 0xa438, 0xa111, - 0xa438, 0x8204, 0xa438, 0xa140, 0xa438, 0x1000, 0xa438, 0x0a42, - 0xa438, 0x8140, 0xa438, 0xd17a, 0xa438, 0xd04b, 0xa438, 0x1000, - 0xa438, 0x0a5e, 0xa438, 0xd700, 0xa438, 0x5fb4, 0xa438, 0xa204, - 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd700, 0xa438, 0x5fa7, - 0xa438, 0xb920, 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd71f, - 0xa438, 0x5fac, 0xa438, 0x9920, 0xa438, 0x1000, 0xa438, 0x0a5e, - 0xa438, 0xd71f, 0xa438, 0x7f8c, 0xa438, 0xd404, 0xa438, 0x1000, - 0xa438, 0x0a37, 0xa438, 0xd700, 0xa438, 0x6083, 0xa438, 0x0c1f, - 0xa438, 0x0d02, 0xa438, 0xf003, 0xa438, 0x0c1f, 0xa438, 0x0d02, - 0xa438, 0x1000, 0xa438, 0x0a7d, 0xa438, 0xa710, 0xa438, 0x8101, - 0xa438, 0x8201, 0xa438, 0xa104, 0xa438, 0x1000, 0xa438, 0x0a42, - 0xa438, 0x8104, 0xa438, 0xa120, 0xa438, 0xaa0f, 0xa438, 0x8110, - 0xa438, 0xa284, 0xa438, 0xa404, 0xa438, 0xa00a, 0xa438, 0xd193, - 0xa438, 0xd047, 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd700, - 0xa438, 0x5fb4, 0xa438, 0xa110, 0xa438, 0x1000, 0xa438, 0x0a5e, - 0xa438, 0xd700, 0xa438, 0x5fa8, 0xa438, 0xa180, 0xa438, 0xd13d, - 0xa438, 0xd04a, 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd700, - 0xa438, 0x5fb4, 0xa438, 0xf024, 0xa438, 0xa710, 0xa438, 0xa00a, - 0xa438, 0x8190, 0xa438, 0x8204, 0xa438, 0xa280, 0xa438, 0xa404, - 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd700, 0xa438, 0x5fa7, - 0xa438, 0x8710, 0xa438, 0xb920, 0xa438, 0x1000, 0xa438, 0x0a5e, - 0xa438, 0xd71f, 0xa438, 0x5fac, 0xa438, 0x9920, 0xa438, 0x1000, - 0xa438, 0x0a5e, 0xa438, 0xd71f, 0xa438, 0x7f8c, 0xa438, 0x800a, - 0xa438, 0x8190, 0xa438, 0x8284, 0xa438, 0x8406, 0xa438, 0xd700, - 0xa438, 0x4121, 0xa438, 0xd701, 0xa438, 0x60f3, 0xa438, 0xd1e5, - 0xa438, 0xd04d, 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd700, - 0xa438, 0x5fb4, 0xa438, 0x8710, 0xa438, 0xa00a, 0xa438, 0x8190, - 0xa438, 0x8204, 0xa438, 0xa280, 0xa438, 0xa404, 0xa438, 0xb920, - 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd71f, 0xa438, 0x5fac, - 0xa438, 0x9920, 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd71f, - 0xa438, 0x7f8c, 0xa438, 0xcb33, 0xa438, 0x1000, 0xa438, 0x0a5e, - 0xa438, 0xd71f, 0xa438, 0x5f85, 0xa438, 0xa710, 0xa438, 0xb820, - 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd71f, 0xa438, 0x7f65, - 0xa438, 0x9820, 0xa438, 0xcb34, 0xa438, 0xa00a, 0xa438, 0xa190, - 0xa438, 0xa284, 0xa438, 0xa404, 0xa438, 0x1000, 0xa438, 0x0a5e, - 0xa438, 0xd700, 0xa438, 0x5fa9, 0xa438, 0xd701, 0xa438, 0x6853, - 0xa438, 0xd700, 0xa438, 0x6083, 0xa438, 0x0c1f, 0xa438, 0x0d00, - 0xa438, 0xf003, 0xa438, 0x0c1f, 0xa438, 0x0d00, 0xa438, 0x1000, - 0xa438, 0x0a7d, 0xa438, 0x8190, 0xa438, 0x8284, 0xa438, 0xcb35, - 0xa438, 0xd407, 0xa438, 0x1000, 0xa438, 0x0a37, 0xa438, 0x8110, - 0xa438, 0x8204, 0xa438, 0xa280, 0xa438, 0xa00a, 0xa438, 0xd704, - 0xa438, 0x4215, 0xa438, 0xa304, 0xa438, 0x1000, 0xa438, 0x0a5e, - 0xa438, 0xd700, 0xa438, 0x5fb8, 0xa438, 0xd1c3, 0xa438, 0xd043, - 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd700, 0xa438, 0x5fb4, - 0xa438, 0x8304, 0xa438, 0xd700, 0xa438, 0x4109, 0xa438, 0xf01e, - 0xa438, 0xcb36, 0xa438, 0xd412, 0xa438, 0x1000, 0xa438, 0x0a37, - 0xa438, 0xd700, 0xa438, 0x6309, 0xa438, 0xd702, 0xa438, 0x42c7, - 0xa438, 0x800a, 0xa438, 0x8180, 0xa438, 0x8280, 0xa438, 0x8404, - 0xa438, 0xa004, 0xa438, 0x1000, 0xa438, 0x0a42, 0xa438, 0x8004, - 0xa438, 0xa001, 0xa438, 0x1000, 0xa438, 0x0a42, 0xa438, 0x8001, - 0xa438, 0x0c03, 0xa438, 0x0902, 0xa438, 0xa00a, 0xa438, 0xd14a, - 0xa438, 0xd048, 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd700, - 0xa438, 0x5fb4, 0xa438, 0xd700, 0xa438, 0x6083, 0xa438, 0x0c1f, - 0xa438, 0x0d02, 0xa438, 0xf003, 0xa438, 0x0c1f, 0xa438, 0x0d02, - 0xa438, 0x1000, 0xa438, 0x0a7d, 0xa438, 0xcc55, 0xa438, 0xcb37, - 0xa438, 0xa00a, 0xa438, 0xa190, 0xa438, 0xa2a4, 0xa438, 0xa404, - 0xa438, 0xd700, 0xa438, 0x6041, 0xa438, 0xa402, 0xa438, 0xd13d, - 0xa438, 0xd04a, 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd700, - 0xa438, 0x5fb4, 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd700, - 0xa438, 0x5fa9, 0xa438, 0xd702, 0xa438, 0x5f71, 0xa438, 0xcb38, - 0xa438, 0x8224, 0xa438, 0xa288, 0xa438, 0x8180, 0xa438, 0xa110, - 0xa438, 0xa404, 0xa438, 0x800a, 0xa438, 0xd700, 0xa438, 0x6041, - 0xa438, 0x8402, 0xa438, 0xd415, 0xa438, 0x1000, 0xa438, 0x0a37, - 0xa438, 0xd13d, 0xa438, 0xd04a, 0xa438, 0x1000, 0xa438, 0x0a5e, - 0xa438, 0xd700, 0xa438, 0x5fb4, 0xa438, 0xcb39, 0xa438, 0xa00a, - 0xa438, 0xa190, 0xa438, 0xa2a0, 0xa438, 0xa404, 0xa438, 0xd700, - 0xa438, 0x6041, 0xa438, 0xa402, 0xa438, 0xd17a, 0xa438, 0xd047, - 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd700, 0xa438, 0x5fb4, - 0xa438, 0x1800, 0xa438, 0x0560, 0xa438, 0xa111, 0xa438, 0x0000, - 0xa438, 0x0000, 0xa438, 0x0000, 0xa438, 0x0000, 0xa438, 0xd3f5, - 0xa438, 0xd219, 0xa438, 0x1000, 0xa438, 0x0c31, 0xa438, 0xd708, - 0xa438, 0x5fa5, 0xa438, 0xa215, 0xa438, 0xd30e, 0xa438, 0xd21a, - 0xa438, 0x1000, 0xa438, 0x0c31, 0xa438, 0xd708, 0xa438, 0x63e9, - 0xa438, 0xd708, 0xa438, 0x5f65, 0xa438, 0xd708, 0xa438, 0x7f36, - 0xa438, 0xa004, 0xa438, 0x1000, 0xa438, 0x0c35, 0xa438, 0x8004, - 0xa438, 0xa001, 0xa438, 0x1000, 0xa438, 0x0c35, 0xa438, 0x8001, - 0xa438, 0xd708, 0xa438, 0x4098, 0xa438, 0xd102, 0xa438, 0x9401, - 0xa438, 0xf003, 0xa438, 0xd103, 0xa438, 0xb401, 0xa438, 0x1000, - 0xa438, 0x0c27, 0xa438, 0xa108, 0xa438, 0x1000, 0xa438, 0x0c35, - 0xa438, 0x8108, 0xa438, 0x8110, 0xa438, 0x8294, 0xa438, 0xa202, - 0xa438, 0x1800, 0xa438, 0x0bdb, 0xa438, 0xd39c, 0xa438, 0xd210, - 0xa438, 0x1000, 0xa438, 0x0c31, 0xa438, 0xd708, 0xa438, 0x5fa5, - 0xa438, 0xd39c, 0xa438, 0xd210, 0xa438, 0x1000, 0xa438, 0x0c31, - 0xa438, 0xd708, 0xa438, 0x5fa5, 0xa438, 0x1000, 0xa438, 0x0c31, - 0xa438, 0xd708, 0xa438, 0x29b5, 0xa438, 0x840e, 0xa438, 0xd708, - 0xa438, 0x5f4a, 0xa438, 0x0c1f, 0xa438, 0x1014, 0xa438, 0x1000, - 0xa438, 0x0c31, 0xa438, 0xd709, 0xa438, 0x7fa4, 0xa438, 0x901f, - 0xa438, 0x1800, 0xa438, 0x0c23, 0xa438, 0xcb43, 0xa438, 0xa508, - 0xa438, 0xd701, 0xa438, 0x3699, 0xa438, 0x844a, 0xa438, 0xa504, - 0xa438, 0xa190, 0xa438, 0xa2a0, 0xa438, 0xa404, 0xa438, 0xa00a, - 0xa438, 0xd700, 0xa438, 0x2109, 0xa438, 0x05ea, 0xa438, 0xa402, - 0xa438, 0x1800, 0xa438, 0x05ea, 0xa438, 0xcb90, 0xa438, 0x0cf0, - 0xa438, 0x0ca0, 0xa438, 0x1800, 0xa438, 0x06db, 0xa438, 0xd1ff, - 0xa438, 0xd052, 0xa438, 0xa508, 0xa438, 0x8718, 0xa438, 0xa00a, - 0xa438, 0xa190, 0xa438, 0xa2a0, 0xa438, 0xa404, 0xa438, 0x0cf0, - 0xa438, 0x0c50, 0xa438, 0x1800, 0xa438, 0x09ef, 0xa438, 0x1000, - 0xa438, 0x0a5e, 0xa438, 0xd704, 0xa438, 0x2e70, 0xa438, 0x06da, - 0xa438, 0xd700, 0xa438, 0x5f55, 0xa438, 0xa90c, 0xa438, 0x1800, - 0xa438, 0x0645, 0xa436, 0xA10E, 0xa438, 0x0644, 0xa436, 0xA10C, - 0xa438, 0x09e9, 0xa436, 0xA10A, 0xa438, 0x06da, 0xa436, 0xA108, - 0xa438, 0x05e1, 0xa436, 0xA106, 0xa438, 0x0be4, 0xa436, 0xA104, - 0xa438, 0x0435, 0xa436, 0xA102, 0xa438, 0x0141, 0xa436, 0xA100, - 0xa438, 0x026d, 0xa436, 0xA110, 0xa438, 0x00ff, 0xa436, 0xb87c, - 0xa438, 0x85fe, 0xa436, 0xb87e, 0xa438, 0xaf86, 0xa438, 0x16af, - 0xa438, 0x8699, 0xa438, 0xaf86, 0xa438, 0xe5af, 0xa438, 0x86f9, - 0xa438, 0xaf87, 0xa438, 0x7aaf, 0xa438, 0x883a, 0xa438, 0xaf88, - 0xa438, 0x58af, 0xa438, 0x8b6c, 0xa438, 0xd48b, 0xa438, 0x7c02, - 0xa438, 0x8644, 0xa438, 0x2c00, 0xa438, 0x503c, 0xa438, 0xffd6, - 0xa438, 0xac27, 0xa438, 0x18e1, 0xa438, 0x82fe, 0xa438, 0xad28, - 0xa438, 0x0cd4, 0xa438, 0x8b84, 0xa438, 0x0286, 0xa438, 0x442c, - 0xa438, 0x003c, 0xa438, 0xac27, 0xa438, 0x06ee, 0xa438, 0x8299, - 0xa438, 0x01ae, 0xa438, 0x04ee, 0xa438, 0x8299, 0xa438, 0x00af, - 0xa438, 0x23dc, 0xa438, 0xf9fa, 0xa438, 0xcefa, 0xa438, 0xfbef, - 0xa438, 0x79fb, 0xa438, 0xc4bf, 0xa438, 0x8b76, 0xa438, 0x026c, - 0xa438, 0x6dac, 0xa438, 0x2804, 0xa438, 0xd203, 0xa438, 0xae02, - 0xa438, 0xd201, 0xa438, 0xbdd8, 0xa438, 0x19d9, 0xa438, 0xef94, - 0xa438, 0x026c, 0xa438, 0x6d78, 0xa438, 0x03ef, 0xa438, 0x648a, - 0xa438, 0x0002, 0xa438, 0xbdd8, 0xa438, 0x19d9, 0xa438, 0xef94, - 0xa438, 0x026c, 0xa438, 0x6d78, 0xa438, 0x03ef, 0xa438, 0x7402, - 0xa438, 0x72cd, 0xa438, 0xac50, 0xa438, 0x02ef, 0xa438, 0x643a, - 0xa438, 0x019f, 0xa438, 0xe4ef, 0xa438, 0x4678, 0xa438, 0x03ac, - 0xa438, 0x2002, 0xa438, 0xae02, 0xa438, 0xd0ff, 0xa438, 0xffef, - 0xa438, 0x97ff, 0xa438, 0xfec6, 0xa438, 0xfefd, 0xa438, 0x041f, - 0xa438, 0x771f, 0xa438, 0x221c, 0xa438, 0x450d, 0xa438, 0x481f, - 0xa438, 0x00ac, 0xa438, 0x7f04, 0xa438, 0x1a94, 0xa438, 0xae08, - 0xa438, 0x1a94, 0xa438, 0xac7f, 0xa438, 0x03d7, 0xa438, 0x0100, - 0xa438, 0xef46, 0xa438, 0x0d48, 0xa438, 0x1f00, 0xa438, 0x1c45, - 0xa438, 0xef69, 0xa438, 0xef57, 0xa438, 0xef74, 0xa438, 0x0272, - 0xa438, 0xe8a7, 0xa438, 0xffff, 0xa438, 0x0d1a, 0xa438, 0x941b, - 0xa438, 0x979e, 0xa438, 0x072d, 0xa438, 0x0100, 0xa438, 0x1a64, - 0xa438, 0xef76, 0xa438, 0xef97, 0xa438, 0x0d98, 0xa438, 0xd400, - 0xa438, 0xff1d, 0xa438, 0x941a, 0xa438, 0x89cf, 0xa438, 0x1a75, - 0xa438, 0xaf74, 0xa438, 0xf9bf, 0xa438, 0x8b79, 0xa438, 0x026c, - 0xa438, 0x6da1, 0xa438, 0x0005, 0xa438, 0xe180, 0xa438, 0xa0ae, - 0xa438, 0x03e1, 0xa438, 0x80a1, 0xa438, 0xaf26, 0xa438, 0x9aac, - 0xa438, 0x284d, 0xa438, 0xe08f, 0xa438, 0xffef, 0xa438, 0x10c0, - 0xa438, 0xe08f, 0xa438, 0xfe10, 0xa438, 0x1b08, 0xa438, 0xa000, - 0xa438, 0x04c8, 0xa438, 0xaf40, 0xa438, 0x67c8, 0xa438, 0xbf8b, - 0xa438, 0x8c02, 0xa438, 0x6c4e, 0xa438, 0xc4bf, 0xa438, 0x8b8f, - 0xa438, 0x026c, 0xa438, 0x6def, 0xa438, 0x74e0, 0xa438, 0x830c, - 0xa438, 0xad20, 0xa438, 0x0302, 0xa438, 0x74ac, 0xa438, 0xccef, - 0xa438, 0x971b, 0xa438, 0x76ad, 0xa438, 0x5f02, 0xa438, 0xae13, - 0xa438, 0xef69, 0xa438, 0xef30, 0xa438, 0x1b32, 0xa438, 0xc4ef, - 0xa438, 0x46e4, 0xa438, 0x8ffb, 0xa438, 0xe58f, 0xa438, 0xfce7, - 0xa438, 0x8ffd, 0xa438, 0xcc10, 0xa438, 0x11ae, 0xa438, 0xb8d1, - 0xa438, 0x00a1, 0xa438, 0x1f03, 0xa438, 0xaf40, 0xa438, 0x4fbf, - 0xa438, 0x8b8c, 0xa438, 0x026c, 0xa438, 0x4ec4, 0xa438, 0xbf8b, - 0xa438, 0x8f02, 0xa438, 0x6c6d, 0xa438, 0xef74, 0xa438, 0xe083, - 0xa438, 0x0cad, 0xa438, 0x2003, 0xa438, 0x0274, 0xa438, 0xaccc, - 0xa438, 0xef97, 0xa438, 0x1b76, 0xa438, 0xad5f, 0xa438, 0x02ae, - 0xa438, 0x04ef, 0xa438, 0x69ef, 0xa438, 0x3111, 0xa438, 0xaed1, - 0xa438, 0x0287, 0xa438, 0x80af, 0xa438, 0x2293, 0xa438, 0xf8f9, - 0xa438, 0xfafb, 0xa438, 0xef59, 0xa438, 0xe080, 0xa438, 0x13ad, - 0xa438, 0x252f, 0xa438, 0xbf88, 0xa438, 0x2802, 0xa438, 0x6c6d, - 0xa438, 0xef64, 0xa438, 0x1f44, 0xa438, 0xe18f, 0xa438, 0xb91b, - 0xa438, 0x64ad, 0xa438, 0x4f1d, 0xa438, 0xd688, 0xa438, 0x2bd7, - 0xa438, 0x882e, 0xa438, 0x0274, 0xa438, 0x73ad, 0xa438, 0x5008, - 0xa438, 0xbf88, 0xa438, 0x3102, 0xa438, 0x737c, 0xa438, 0xae03, - 0xa438, 0x0287, 0xa438, 0xd0bf, 0xa438, 0x882b, 0xa438, 0x0273, - 0xa438, 0x73e0, 0xa438, 0x824c, 0xa438, 0xf621, 0xa438, 0xe482, - 0xa438, 0x4cbf, 0xa438, 0x8834, 0xa438, 0x0273, 0xa438, 0x7cef, - 0xa438, 0x95ff, 0xa438, 0xfefd, 0xa438, 0xfc04, 0xa438, 0xf8f9, - 0xa438, 0xfafb, 0xa438, 0xef79, 0xa438, 0xbf88, 0xa438, 0x1f02, - 0xa438, 0x737c, 0xa438, 0x1f22, 0xa438, 0xac32, 0xa438, 0x31ef, - 0xa438, 0x12bf, 0xa438, 0x8822, 0xa438, 0x026c, 0xa438, 0x4ed6, - 0xa438, 0x8fba, 0xa438, 0x1f33, 0xa438, 0xac3c, 0xa438, 0x1eef, - 0xa438, 0x13bf, 0xa438, 0x8837, 0xa438, 0x026c, 0xa438, 0x4eef, - 0xa438, 0x96d8, 0xa438, 0x19d9, 0xa438, 0xbf88, 0xa438, 0x2502, - 0xa438, 0x6c4e, 0xa438, 0xbf88, 0xa438, 0x2502, 0xa438, 0x6c4e, - 0xa438, 0x1616, 0xa438, 0x13ae, 0xa438, 0xdf12, 0xa438, 0xaecc, - 0xa438, 0xbf88, 0xa438, 0x1f02, 0xa438, 0x7373, 0xa438, 0xef97, - 0xa438, 0xfffe, 0xa438, 0xfdfc, 0xa438, 0x0466, 0xa438, 0xac88, - 0xa438, 0x54ac, 0xa438, 0x88f0, 0xa438, 0xac8a, 0xa438, 0x92ac, - 0xa438, 0xbadd, 0xa438, 0xac6c, 0xa438, 0xeeac, 0xa438, 0x6cff, - 0xa438, 0xad02, 0xa438, 0x99ac, 0xa438, 0x0030, 0xa438, 0xac88, - 0xa438, 0xd4c3, 0xa438, 0x5000, 0xa438, 0x0000, 0xa438, 0x0000, - 0xa438, 0x0000, 0xa438, 0x0000, 0xa438, 0x0000, 0xa438, 0x0000, - 0xa438, 0x0000, 0xa438, 0x0000, 0xa438, 0x00b4, 0xa438, 0xecee, - 0xa438, 0x8298, 0xa438, 0x00af, 0xa438, 0x1412, 0xa438, 0xf8bf, - 0xa438, 0x8b5d, 0xa438, 0x026c, 0xa438, 0x6d58, 0xa438, 0x03e1, - 0xa438, 0x8fb8, 0xa438, 0x2901, 0xa438, 0xe58f, 0xa438, 0xb8a0, - 0xa438, 0x0049, 0xa438, 0xef47, 0xa438, 0xe483, 0xa438, 0x02e5, - 0xa438, 0x8303, 0xa438, 0xbfc2, 0xa438, 0x5f1a, 0xa438, 0x95f7, - 0xa438, 0x05ee, 0xa438, 0xffd2, 0xa438, 0x00d8, 0xa438, 0xf605, - 0xa438, 0x1f11, 0xa438, 0xef60, 0xa438, 0xbf8b, 0xa438, 0x3002, - 0xa438, 0x6c4e, 0xa438, 0xbf8b, 0xa438, 0x3302, 0xa438, 0x6c6d, - 0xa438, 0xf728, 0xa438, 0xbf8b, 0xa438, 0x3302, 0xa438, 0x6c4e, - 0xa438, 0xf628, 0xa438, 0xbf8b, 0xa438, 0x3302, 0xa438, 0x6c4e, - 0xa438, 0x0c64, 0xa438, 0xef46, 0xa438, 0xbf8b, 0xa438, 0x6002, - 0xa438, 0x6c4e, 0xa438, 0x0289, 0xa438, 0x9902, 0xa438, 0x3920, - 0xa438, 0xaf89, 0xa438, 0x96a0, 0xa438, 0x0149, 0xa438, 0xef47, - 0xa438, 0xe483, 0xa438, 0x04e5, 0xa438, 0x8305, 0xa438, 0xbfc2, - 0xa438, 0x5f1a, 0xa438, 0x95f7, 0xa438, 0x05ee, 0xa438, 0xffd2, - 0xa438, 0x00d8, 0xa438, 0xf605, 0xa438, 0x1f11, 0xa438, 0xef60, - 0xa438, 0xbf8b, 0xa438, 0x3002, 0xa438, 0x6c4e, 0xa438, 0xbf8b, - 0xa438, 0x3302, 0xa438, 0x6c6d, 0xa438, 0xf729, 0xa438, 0xbf8b, - 0xa438, 0x3302, 0xa438, 0x6c4e, 0xa438, 0xf629, 0xa438, 0xbf8b, - 0xa438, 0x3302, 0xa438, 0x6c4e, 0xa438, 0x0c64, 0xa438, 0xef46, - 0xa438, 0xbf8b, 0xa438, 0x6302, 0xa438, 0x6c4e, 0xa438, 0x0289, - 0xa438, 0x9902, 0xa438, 0x3920, 0xa438, 0xaf89, 0xa438, 0x96a0, - 0xa438, 0x0249, 0xa438, 0xef47, 0xa438, 0xe483, 0xa438, 0x06e5, - 0xa438, 0x8307, 0xa438, 0xbfc2, 0xa438, 0x5f1a, 0xa438, 0x95f7, - 0xa438, 0x05ee, 0xa438, 0xffd2, 0xa438, 0x00d8, 0xa438, 0xf605, - 0xa438, 0x1f11, 0xa438, 0xef60, 0xa438, 0xbf8b, 0xa438, 0x3002, - 0xa438, 0x6c4e, 0xa438, 0xbf8b, 0xa438, 0x3302, 0xa438, 0x6c6d, - 0xa438, 0xf72a, 0xa438, 0xbf8b, 0xa438, 0x3302, 0xa438, 0x6c4e, - 0xa438, 0xf62a, 0xa438, 0xbf8b, 0xa438, 0x3302, 0xa438, 0x6c4e, - 0xa438, 0x0c64, 0xa438, 0xef46, 0xa438, 0xbf8b, 0xa438, 0x6602, - 0xa438, 0x6c4e, 0xa438, 0x0289, 0xa438, 0x9902, 0xa438, 0x3920, - 0xa438, 0xaf89, 0xa438, 0x96ef, 0xa438, 0x47e4, 0xa438, 0x8308, - 0xa438, 0xe583, 0xa438, 0x09bf, 0xa438, 0xc25f, 0xa438, 0x1a95, - 0xa438, 0xf705, 0xa438, 0xeeff, 0xa438, 0xd200, 0xa438, 0xd8f6, - 0xa438, 0x051f, 0xa438, 0x11ef, 0xa438, 0x60bf, 0xa438, 0x8b30, - 0xa438, 0x026c, 0xa438, 0x4ebf, 0xa438, 0x8b33, 0xa438, 0x026c, - 0xa438, 0x6df7, 0xa438, 0x2bbf, 0xa438, 0x8b33, 0xa438, 0x026c, - 0xa438, 0x4ef6, 0xa438, 0x2bbf, 0xa438, 0x8b33, 0xa438, 0x026c, - 0xa438, 0x4e0c, 0xa438, 0x64ef, 0xa438, 0x46bf, 0xa438, 0x8b69, - 0xa438, 0x026c, 0xa438, 0x4e02, 0xa438, 0x8999, 0xa438, 0x0239, - 0xa438, 0x20af, 0xa438, 0x8996, 0xa438, 0xaf39, 0xa438, 0x1ef8, - 0xa438, 0xf9fa, 0xa438, 0xe08f, 0xa438, 0xb838, 0xa438, 0x02ad, - 0xa438, 0x2702, 0xa438, 0xae03, 0xa438, 0xaf8b, 0xa438, 0x201f, - 0xa438, 0x66ef, 0xa438, 0x65bf, 0xa438, 0xc21f, 0xa438, 0x1a96, - 0xa438, 0xf705, 0xa438, 0xeeff, 0xa438, 0xd200, 0xa438, 0xdaf6, - 0xa438, 0x05bf, 0xa438, 0xc22f, 0xa438, 0x1a96, 0xa438, 0xf705, - 0xa438, 0xeeff, 0xa438, 0xd200, 0xa438, 0xdbf6, 0xa438, 0x05ef, - 0xa438, 0x021f, 0xa438, 0x110d, 0xa438, 0x42bf, 0xa438, 0x8b3c, - 0xa438, 0x026c, 0xa438, 0x4eef, 0xa438, 0x021b, 0xa438, 0x031f, - 0xa438, 0x110d, 0xa438, 0x42bf, 0xa438, 0x8b36, 0xa438, 0x026c, - 0xa438, 0x4eef, 0xa438, 0x021a, 0xa438, 0x031f, 0xa438, 0x110d, - 0xa438, 0x42bf, 0xa438, 0x8b39, 0xa438, 0x026c, 0xa438, 0x4ebf, - 0xa438, 0xc23f, 0xa438, 0x1a96, 0xa438, 0xf705, 0xa438, 0xeeff, - 0xa438, 0xd200, 0xa438, 0xdaf6, 0xa438, 0x05bf, 0xa438, 0xc24f, - 0xa438, 0x1a96, 0xa438, 0xf705, 0xa438, 0xeeff, 0xa438, 0xd200, - 0xa438, 0xdbf6, 0xa438, 0x05ef, 0xa438, 0x021f, 0xa438, 0x110d, - 0xa438, 0x42bf, 0xa438, 0x8b45, 0xa438, 0x026c, 0xa438, 0x4eef, - 0xa438, 0x021b, 0xa438, 0x031f, 0xa438, 0x110d, 0xa438, 0x42bf, - 0xa438, 0x8b3f, 0xa438, 0x026c, 0xa438, 0x4eef, 0xa438, 0x021a, - 0xa438, 0x031f, 0xa438, 0x110d, 0xa438, 0x42bf, 0xa438, 0x8b42, - 0xa438, 0x026c, 0xa438, 0x4eef, 0xa438, 0x56d0, 0xa438, 0x201f, - 0xa438, 0x11bf, 0xa438, 0x8b4e, 0xa438, 0x026c, 0xa438, 0x4ebf, - 0xa438, 0x8b48, 0xa438, 0x026c, 0xa438, 0x4ebf, 0xa438, 0x8b4b, - 0xa438, 0x026c, 0xa438, 0x4ee1, 0xa438, 0x8578, 0xa438, 0xef03, - 0xa438, 0x480a, 0xa438, 0x2805, 0xa438, 0xef20, 0xa438, 0x1b01, - 0xa438, 0xad27, 0xa438, 0x3f1f, 0xa438, 0x44e0, 0xa438, 0x8560, - 0xa438, 0xe185, 0xa438, 0x61bf, 0xa438, 0x8b51, 0xa438, 0x026c, - 0xa438, 0x4ee0, 0xa438, 0x8566, 0xa438, 0xe185, 0xa438, 0x67bf, - 0xa438, 0x8b54, 0xa438, 0x026c, 0xa438, 0x4ee0, 0xa438, 0x856c, - 0xa438, 0xe185, 0xa438, 0x6dbf, 0xa438, 0x8b57, 0xa438, 0x026c, - 0xa438, 0x4ee0, 0xa438, 0x8572, 0xa438, 0xe185, 0xa438, 0x73bf, - 0xa438, 0x8b5a, 0xa438, 0x026c, 0xa438, 0x4ee1, 0xa438, 0x8fb8, - 0xa438, 0x5900, 0xa438, 0xf728, 0xa438, 0xe58f, 0xa438, 0xb8af, - 0xa438, 0x8b2c, 0xa438, 0xe185, 0xa438, 0x791b, 0xa438, 0x21ad, - 0xa438, 0x373e, 0xa438, 0x1f44, 0xa438, 0xe085, 0xa438, 0x62e1, - 0xa438, 0x8563, 0xa438, 0xbf8b, 0xa438, 0x5102, 0xa438, 0x6c4e, - 0xa438, 0xe085, 0xa438, 0x68e1, 0xa438, 0x8569, 0xa438, 0xbf8b, - 0xa438, 0x5402, 0xa438, 0x6c4e, 0xa438, 0xe085, 0xa438, 0x6ee1, - 0xa438, 0x856f, 0xa438, 0xbf8b, 0xa438, 0x5702, 0xa438, 0x6c4e, - 0xa438, 0xe085, 0xa438, 0x74e1, 0xa438, 0x8575, 0xa438, 0xbf8b, - 0xa438, 0x5a02, 0xa438, 0x6c4e, 0xa438, 0xe18f, 0xa438, 0xb859, - 0xa438, 0x00f7, 0xa438, 0x28e5, 0xa438, 0x8fb8, 0xa438, 0xae4a, - 0xa438, 0x1f44, 0xa438, 0xe085, 0xa438, 0x64e1, 0xa438, 0x8565, - 0xa438, 0xbf8b, 0xa438, 0x5102, 0xa438, 0x6c4e, 0xa438, 0xe085, - 0xa438, 0x6ae1, 0xa438, 0x856b, 0xa438, 0xbf8b, 0xa438, 0x5402, - 0xa438, 0x6c4e, 0xa438, 0xe085, 0xa438, 0x70e1, 0xa438, 0x8571, - 0xa438, 0xbf8b, 0xa438, 0x5702, 0xa438, 0x6c4e, 0xa438, 0xe085, - 0xa438, 0x76e1, 0xa438, 0x8577, 0xa438, 0xbf8b, 0xa438, 0x5a02, - 0xa438, 0x6c4e, 0xa438, 0xe18f, 0xa438, 0xb859, 0xa438, 0x00f7, - 0xa438, 0x28e5, 0xa438, 0x8fb8, 0xa438, 0xae0c, 0xa438, 0xe18f, - 0xa438, 0xb839, 0xa438, 0x04ac, 0xa438, 0x2f04, 0xa438, 0xee8f, - 0xa438, 0xb800, 0xa438, 0xfefd, 0xa438, 0xfc04, 0xa438, 0xf0ac, - 0xa438, 0x8efc, 0xa438, 0xac8c, 0xa438, 0xf0ac, 0xa438, 0xfaf0, - 0xa438, 0xacf8, 0xa438, 0xf0ac, 0xa438, 0xf6f0, 0xa438, 0xad00, - 0xa438, 0xf0ac, 0xa438, 0xfef0, 0xa438, 0xacfc, 0xa438, 0xf0ac, - 0xa438, 0xf4f0, 0xa438, 0xacf2, 0xa438, 0xf0ac, 0xa438, 0xf0f0, - 0xa438, 0xacb0, 0xa438, 0xf0ac, 0xa438, 0xaef0, 0xa438, 0xacac, - 0xa438, 0xf0ac, 0xa438, 0xaaf0, 0xa438, 0xacee, 0xa438, 0xf0b0, - 0xa438, 0x24f0, 0xa438, 0xb0a4, 0xa438, 0xf0b1, 0xa438, 0x24f0, - 0xa438, 0xb1a4, 0xa438, 0xee8f, 0xa438, 0xb800, 0xa438, 0xd400, - 0xa438, 0x00af, 0xa438, 0x3976, 0xa438, 0x66ac, 0xa438, 0xeabb, - 0xa438, 0xa430, 0xa438, 0x6e50, 0xa438, 0x6e53, 0xa438, 0x6e56, - 0xa438, 0x6e59, 0xa438, 0x6e5c, 0xa438, 0x6e5f, 0xa438, 0x6e62, - 0xa438, 0x6e65, 0xa438, 0xd9ac, 0xa438, 0x70f0, 0xa438, 0xac6a, - 0xa436, 0xb85e, 0xa438, 0x23b7, 0xa436, 0xb860, 0xa438, 0x74db, - 0xa436, 0xb862, 0xa438, 0x268c, 0xa436, 0xb864, 0xa438, 0x3FE5, - 0xa436, 0xb886, 0xa438, 0x2250, 0xa436, 0xb888, 0xa438, 0x140e, - 0xa436, 0xb88a, 0xa438, 0x3696, 0xa436, 0xb88c, 0xa438, 0x3973, - 0xa436, 0xb838, 0xa438, 0x00ff, 0xb820, 0x0010, 0xa436, 0x8464, - 0xa438, 0xaf84, 0xa438, 0x7caf, 0xa438, 0x8485, 0xa438, 0xaf85, - 0xa438, 0x13af, 0xa438, 0x851e, 0xa438, 0xaf85, 0xa438, 0xb9af, - 0xa438, 0x8684, 0xa438, 0xaf87, 0xa438, 0x01af, 0xa438, 0x8701, - 0xa438, 0xac38, 0xa438, 0x03af, 0xa438, 0x38bb, 0xa438, 0xaf38, - 0xa438, 0xc302, 0xa438, 0x4618, 0xa438, 0xbf85, 0xa438, 0x0a02, - 0xa438, 0x54b7, 0xa438, 0xbf85, 0xa438, 0x1002, 0xa438, 0x54c0, - 0xa438, 0xd400, 0xa438, 0x0fbf, 0xa438, 0x8507, 0xa438, 0x024f, - 0xa438, 0x48bf, 0xa438, 0x8504, 0xa438, 0x024f, 0xa438, 0x6759, - 0xa438, 0xf0a1, 0xa438, 0x3008, 0xa438, 0xbf85, 0xa438, 0x0d02, - 0xa438, 0x54c0, 0xa438, 0xae06, 0xa438, 0xbf85, 0xa438, 0x0d02, - 0xa438, 0x54b7, 0xa438, 0xbf85, 0xa438, 0x0402, 0xa438, 0x4f67, - 0xa438, 0xa183, 0xa438, 0x02ae, 0xa438, 0x15a1, 0xa438, 0x8502, - 0xa438, 0xae10, 0xa438, 0x59f0, 0xa438, 0xa180, 0xa438, 0x16bf, - 0xa438, 0x8501, 0xa438, 0x024f, 0xa438, 0x67a1, 0xa438, 0x381b, - 0xa438, 0xae0b, 0xa438, 0xe18f, 0xa438, 0xffbf, 0xa438, 0x84fe, - 0xa438, 0x024f, 0xa438, 0x48ae, 0xa438, 0x17bf, 0xa438, 0x84fe, - 0xa438, 0x0254, 0xa438, 0xb7bf, 0xa438, 0x84fb, 0xa438, 0x0254, - 0xa438, 0xb7ae, 0xa438, 0x09a1, 0xa438, 0x5006, 0xa438, 0xbf84, - 0xa438, 0xfb02, 0xa438, 0x54c0, 0xa438, 0xaf04, 0xa438, 0x4700, - 0xa438, 0xad34, 0xa438, 0xfdad, 0xa438, 0x0670, 0xa438, 0xae14, - 0xa438, 0xf0a6, 0xa438, 0x00b8, 0xa438, 0xbd32, 0xa438, 0x30bd, - 0xa438, 0x30aa, 0xa438, 0xbd2c, 0xa438, 0xccbd, 0xa438, 0x2ca1, - 0xa438, 0x0705, 0xa438, 0xec80, 0xa438, 0xaf40, 0xa438, 0xf7af, - 0xa438, 0x40f5, 0xa438, 0xd101, 0xa438, 0xbf85, 0xa438, 0xa402, - 0xa438, 0x4f48, 0xa438, 0xbf85, 0xa438, 0xa702, 0xa438, 0x54c0, - 0xa438, 0xd10f, 0xa438, 0xbf85, 0xa438, 0xaa02, 0xa438, 0x4f48, - 0xa438, 0x024d, 0xa438, 0x6abf, 0xa438, 0x85ad, 0xa438, 0x024f, - 0xa438, 0x67bf, 0xa438, 0x8ff7, 0xa438, 0xddbf, 0xa438, 0x85b0, - 0xa438, 0x024f, 0xa438, 0x67bf, 0xa438, 0x8ff8, 0xa438, 0xddbf, - 0xa438, 0x85b3, 0xa438, 0x024f, 0xa438, 0x67bf, 0xa438, 0x8ff9, - 0xa438, 0xddbf, 0xa438, 0x85b6, 0xa438, 0x024f, 0xa438, 0x67bf, - 0xa438, 0x8ffa, 0xa438, 0xddd1, 0xa438, 0x00bf, 0xa438, 0x85aa, - 0xa438, 0x024f, 0xa438, 0x4802, 0xa438, 0x4d6a, 0xa438, 0xbf85, - 0xa438, 0xad02, 0xa438, 0x4f67, 0xa438, 0xbf8f, 0xa438, 0xfbdd, - 0xa438, 0xbf85, 0xa438, 0xb002, 0xa438, 0x4f67, 0xa438, 0xbf8f, - 0xa438, 0xfcdd, 0xa438, 0xbf85, 0xa438, 0xb302, 0xa438, 0x4f67, - 0xa438, 0xbf8f, 0xa438, 0xfddd, 0xa438, 0xbf85, 0xa438, 0xb602, - 0xa438, 0x4f67, 0xa438, 0xbf8f, 0xa438, 0xfedd, 0xa438, 0xbf85, - 0xa438, 0xa702, 0xa438, 0x54b7, 0xa438, 0xbf85, 0xa438, 0xa102, - 0xa438, 0x54b7, 0xa438, 0xaf3c, 0xa438, 0x2066, 0xa438, 0xb800, - 0xa438, 0xb8bd, 0xa438, 0x30ee, 0xa438, 0xbd2c, 0xa438, 0xb8bd, - 0xa438, 0x7040, 0xa438, 0xbd86, 0xa438, 0xc8bd, 0xa438, 0x8640, - 0xa438, 0xbd88, 0xa438, 0xc8bd, 0xa438, 0x8802, 0xa438, 0x1929, - 0xa438, 0xa202, 0xa438, 0x02ae, 0xa438, 0x03a2, 0xa438, 0x032e, - 0xa438, 0xd10f, 0xa438, 0xbf85, 0xa438, 0xaa02, 0xa438, 0x4f48, - 0xa438, 0xe18f, 0xa438, 0xf7bf, 0xa438, 0x85ad, 0xa438, 0x024f, - 0xa438, 0x48e1, 0xa438, 0x8ff8, 0xa438, 0xbf85, 0xa438, 0xb002, - 0xa438, 0x4f48, 0xa438, 0xe18f, 0xa438, 0xf9bf, 0xa438, 0x85b3, - 0xa438, 0x024f, 0xa438, 0x48e1, 0xa438, 0x8ffa, 0xa438, 0xbf85, - 0xa438, 0xb602, 0xa438, 0x4f48, 0xa438, 0xae2c, 0xa438, 0xd100, - 0xa438, 0xbf85, 0xa438, 0xaa02, 0xa438, 0x4f48, 0xa438, 0xe18f, - 0xa438, 0xfbbf, 0xa438, 0x85ad, 0xa438, 0x024f, 0xa438, 0x48e1, - 0xa438, 0x8ffc, 0xa438, 0xbf85, 0xa438, 0xb002, 0xa438, 0x4f48, - 0xa438, 0xe18f, 0xa438, 0xfdbf, 0xa438, 0x85b3, 0xa438, 0x024f, - 0xa438, 0x48e1, 0xa438, 0x8ffe, 0xa438, 0xbf85, 0xa438, 0xb602, - 0xa438, 0x4f48, 0xa438, 0xbf86, 0xa438, 0x7e02, 0xa438, 0x4f67, - 0xa438, 0xa100, 0xa438, 0x02ae, 0xa438, 0x25a1, 0xa438, 0x041d, - 0xa438, 0xe18f, 0xa438, 0xf1bf, 0xa438, 0x8675, 0xa438, 0x024f, - 0xa438, 0x48e1, 0xa438, 0x8ff2, 0xa438, 0xbf86, 0xa438, 0x7802, - 0xa438, 0x4f48, 0xa438, 0xe18f, 0xa438, 0xf3bf, 0xa438, 0x867b, - 0xa438, 0x024f, 0xa438, 0x48ae, 0xa438, 0x29a1, 0xa438, 0x070b, - 0xa438, 0xae24, 0xa438, 0xbf86, 0xa438, 0x8102, 0xa438, 0x4f67, - 0xa438, 0xad28, 0xa438, 0x1be1, 0xa438, 0x8ff4, 0xa438, 0xbf86, - 0xa438, 0x7502, 0xa438, 0x4f48, 0xa438, 0xe18f, 0xa438, 0xf5bf, - 0xa438, 0x8678, 0xa438, 0x024f, 0xa438, 0x48e1, 0xa438, 0x8ff6, - 0xa438, 0xbf86, 0xa438, 0x7b02, 0xa438, 0x4f48, 0xa438, 0xaf09, - 0xa438, 0x8420, 0xa438, 0xbc32, 0xa438, 0x20bc, 0xa438, 0x3e76, - 0xa438, 0xbc08, 0xa438, 0xfda6, 0xa438, 0x1a00, 0xa438, 0xb64e, - 0xa438, 0xd101, 0xa438, 0xbf85, 0xa438, 0xa402, 0xa438, 0x4f48, - 0xa438, 0xbf85, 0xa438, 0xa702, 0xa438, 0x54c0, 0xa438, 0xd10f, - 0xa438, 0xbf85, 0xa438, 0xaa02, 0xa438, 0x4f48, 0xa438, 0x024d, - 0xa438, 0x6abf, 0xa438, 0x85ad, 0xa438, 0x024f, 0xa438, 0x67bf, - 0xa438, 0x8ff7, 0xa438, 0xddbf, 0xa438, 0x85b0, 0xa438, 0x024f, - 0xa438, 0x67bf, 0xa438, 0x8ff8, 0xa438, 0xddbf, 0xa438, 0x85b3, - 0xa438, 0x024f, 0xa438, 0x67bf, 0xa438, 0x8ff9, 0xa438, 0xddbf, - 0xa438, 0x85b6, 0xa438, 0x024f, 0xa438, 0x67bf, 0xa438, 0x8ffa, - 0xa438, 0xddd1, 0xa438, 0x00bf, 0xa438, 0x85aa, 0xa438, 0x024f, - 0xa438, 0x4802, 0xa438, 0x4d6a, 0xa438, 0xbf85, 0xa438, 0xad02, - 0xa438, 0x4f67, 0xa438, 0xbf8f, 0xa438, 0xfbdd, 0xa438, 0xbf85, - 0xa438, 0xb002, 0xa438, 0x4f67, 0xa438, 0xbf8f, 0xa438, 0xfcdd, - 0xa438, 0xbf85, 0xa438, 0xb302, 0xa438, 0x4f67, 0xa438, 0xbf8f, - 0xa438, 0xfddd, 0xa438, 0xbf85, 0xa438, 0xb602, 0xa438, 0x4f67, - 0xa438, 0xbf8f, 0xa438, 0xfedd, 0xa438, 0xbf85, 0xa438, 0xa702, - 0xa438, 0x54b7, 0xa438, 0xaf00, 0xa438, 0x8800, 0xa436, 0xb818, - 0xa438, 0x38b8, 0xa436, 0xb81a, 0xa438, 0x0444, 0xa436, 0xb81c, - 0xa438, 0x40ee, 0xa436, 0xb81e, 0xa438, 0x3C1A, 0xa436, 0xb850, - 0xa438, 0x0981, 0xa436, 0xb852, 0xa438, 0x0085, 0xa436, 0xb878, - 0xa438, 0xffff, 0xa436, 0xb884, 0xa438, 0xffff, 0xa436, 0xb832, - 0xa438, 0x003f, 0xa436, 0x0000, 0xa438, 0x0000, 0xa436, 0xB82E, - 0xa438, 0x0000, 0xa436, 0x8024, 0xa438, 0x0000, 0xb820, 0x0000, - 0xa436, 0x801E, 0xa438, 0x0021, 0xFFFF, 0xFFFF -}; - -static const u16 phy_mcu_ram_code_8125b_2[] = { - 0xa436, 0x8024, 0xa438, 0x3701, 0xa436, 0xB82E, 0xa438, 0x0001, - 0xb820, 0x0090, 0xa436, 0xA016, 0xa438, 0x0000, 0xa436, 0xA012, - 0xa438, 0x0000, 0xa436, 0xA014, 0xa438, 0x1800, 0xa438, 0x8010, - 0xa438, 0x1800, 0xa438, 0x801a, 0xa438, 0x1800, 0xa438, 0x803f, - 0xa438, 0x1800, 0xa438, 0x8045, 0xa438, 0x1800, 0xa438, 0x8067, - 0xa438, 0x1800, 0xa438, 0x806d, 0xa438, 0x1800, 0xa438, 0x8079, - 0xa438, 0x1800, 0xa438, 0x807e, 0xa438, 0xd093, 0xa438, 0xd1c4, - 0xa438, 0x1000, 0xa438, 0x135c, 0xa438, 0xd704, 0xa438, 0x5fbc, - 0xa438, 0xd504, 0xa438, 0xc9f1, 0xa438, 0x1800, 0xa438, 0x0fc9, - 0xa438, 0xbb50, 0xa438, 0xd505, 0xa438, 0xa202, 0xa438, 0xd504, - 0xa438, 0x8c0f, 0xa438, 0xd500, 0xa438, 0x1000, 0xa438, 0x1519, - 0xa438, 0x1000, 0xa438, 0x135c, 0xa438, 0xd75e, 0xa438, 0x5fae, - 0xa438, 0x9b50, 0xa438, 0x1000, 0xa438, 0x135c, 0xa438, 0xd75e, - 0xa438, 0x7fae, 0xa438, 0x1000, 0xa438, 0x135c, 0xa438, 0xd707, - 0xa438, 0x40a7, 0xa438, 0xd719, 0xa438, 0x4071, 0xa438, 0x1800, - 0xa438, 0x1557, 0xa438, 0xd719, 0xa438, 0x2f70, 0xa438, 0x803b, - 0xa438, 0x2f73, 0xa438, 0x156a, 0xa438, 0x5e70, 0xa438, 0x1800, - 0xa438, 0x155d, 0xa438, 0xd505, 0xa438, 0xa202, 0xa438, 0xd500, - 0xa438, 0xffed, 0xa438, 0xd709, 0xa438, 0x4054, 0xa438, 0xa788, - 0xa438, 0xd70b, 0xa438, 0x1800, 0xa438, 0x172a, 0xa438, 0xc0c1, - 0xa438, 0xc0c0, 0xa438, 0xd05a, 0xa438, 0xd1ba, 0xa438, 0xd701, - 0xa438, 0x2529, 0xa438, 0x022a, 0xa438, 0xd0a7, 0xa438, 0xd1b9, - 0xa438, 0xa208, 0xa438, 0x1000, 0xa438, 0x080e, 0xa438, 0xd701, - 0xa438, 0x408b, 0xa438, 0x1000, 0xa438, 0x0a65, 0xa438, 0xf003, - 0xa438, 0x1000, 0xa438, 0x0a6b, 0xa438, 0xd701, 0xa438, 0x1000, - 0xa438, 0x0920, 0xa438, 0x1000, 0xa438, 0x0915, 0xa438, 0x1000, - 0xa438, 0x0909, 0xa438, 0x228f, 0xa438, 0x804e, 0xa438, 0x9801, - 0xa438, 0xd71e, 0xa438, 0x5d61, 0xa438, 0xd701, 0xa438, 0x1800, - 0xa438, 0x022a, 0xa438, 0x2005, 0xa438, 0x091a, 0xa438, 0x3bd9, - 0xa438, 0x0919, 0xa438, 0x1800, 0xa438, 0x0916, 0xa438, 0x1000, - 0xa438, 0x14c5, 0xa438, 0xd703, 0xa438, 0x3181, 0xa438, 0x8077, - 0xa438, 0x60ad, 0xa438, 0x1000, 0xa438, 0x135c, 0xa438, 0xd703, - 0xa438, 0x5fba, 0xa438, 0x1800, 0xa438, 0x0cc7, 0xa438, 0xd096, - 0xa438, 0xd1a9, 0xa438, 0xd503, 0xa438, 0x1800, 0xa438, 0x0c94, - 0xa438, 0xa802, 0xa438, 0xa301, 0xa438, 0xa801, 0xa438, 0xc004, - 0xa438, 0xd710, 0xa438, 0x4000, 0xa438, 0x1800, 0xa438, 0x1e79, - 0xa436, 0xA026, 0xa438, 0x1e78, 0xa436, 0xA024, 0xa438, 0x0c93, - 0xa436, 0xA022, 0xa438, 0x0cc5, 0xa436, 0xA020, 0xa438, 0x0915, - 0xa436, 0xA006, 0xa438, 0x020a, 0xa436, 0xA004, 0xa438, 0x1726, - 0xa436, 0xA002, 0xa438, 0x1542, 0xa436, 0xA000, 0xa438, 0x0fc7, - 0xa436, 0xA008, 0xa438, 0xff00, 0xa436, 0xA016, 0xa438, 0x0010, - 0xa436, 0xA012, 0xa438, 0x0000, 0xa436, 0xA014, 0xa438, 0x1800, - 0xa438, 0x8010, 0xa438, 0x1800, 0xa438, 0x801d, 0xa438, 0x1800, - 0xa438, 0x802c, 0xa438, 0x1800, 0xa438, 0x802c, 0xa438, 0x1800, - 0xa438, 0x802c, 0xa438, 0x1800, 0xa438, 0x802c, 0xa438, 0x1800, - 0xa438, 0x802c, 0xa438, 0x1800, 0xa438, 0x802c, 0xa438, 0xd700, - 0xa438, 0x6090, 0xa438, 0x60d1, 0xa438, 0xc95c, 0xa438, 0xf007, - 0xa438, 0x60b1, 0xa438, 0xc95a, 0xa438, 0xf004, 0xa438, 0xc956, - 0xa438, 0xf002, 0xa438, 0xc94e, 0xa438, 0x1800, 0xa438, 0x00cd, - 0xa438, 0xd700, 0xa438, 0x6090, 0xa438, 0x60d1, 0xa438, 0xc95c, - 0xa438, 0xf007, 0xa438, 0x60b1, 0xa438, 0xc95a, 0xa438, 0xf004, - 0xa438, 0xc956, 0xa438, 0xf002, 0xa438, 0xc94e, 0xa438, 0x1000, - 0xa438, 0x022a, 0xa438, 0x1800, 0xa438, 0x0132, 0xa436, 0xA08E, - 0xa438, 0xffff, 0xa436, 0xA08C, 0xa438, 0xffff, 0xa436, 0xA08A, - 0xa438, 0xffff, 0xa436, 0xA088, 0xa438, 0xffff, 0xa436, 0xA086, - 0xa438, 0xffff, 0xa436, 0xA084, 0xa438, 0xffff, 0xa436, 0xA082, - 0xa438, 0x012f, 0xa436, 0xA080, 0xa438, 0x00cc, 0xa436, 0xA090, - 0xa438, 0x0103, 0xa436, 0xA016, 0xa438, 0x0020, 0xa436, 0xA012, - 0xa438, 0x0000, 0xa436, 0xA014, 0xa438, 0x1800, 0xa438, 0x8010, - 0xa438, 0x1800, 0xa438, 0x8020, 0xa438, 0x1800, 0xa438, 0x802a, - 0xa438, 0x1800, 0xa438, 0x8035, 0xa438, 0x1800, 0xa438, 0x803c, - 0xa438, 0x1800, 0xa438, 0x803c, 0xa438, 0x1800, 0xa438, 0x803c, - 0xa438, 0x1800, 0xa438, 0x803c, 0xa438, 0xd107, 0xa438, 0xd042, - 0xa438, 0xa404, 0xa438, 0x1000, 0xa438, 0x09df, 0xa438, 0xd700, - 0xa438, 0x5fb4, 0xa438, 0x8280, 0xa438, 0xd700, 0xa438, 0x6065, - 0xa438, 0xd125, 0xa438, 0xf002, 0xa438, 0xd12b, 0xa438, 0xd040, - 0xa438, 0x1800, 0xa438, 0x077f, 0xa438, 0x0cf0, 0xa438, 0x0c50, - 0xa438, 0xd104, 0xa438, 0xd040, 0xa438, 0x1000, 0xa438, 0x0aa8, - 0xa438, 0xd700, 0xa438, 0x5fb4, 0xa438, 0x1800, 0xa438, 0x0a2e, - 0xa438, 0xcb9b, 0xa438, 0xd110, 0xa438, 0xd040, 0xa438, 0x1000, - 0xa438, 0x0b7b, 0xa438, 0x1000, 0xa438, 0x09df, 0xa438, 0xd700, - 0xa438, 0x5fb4, 0xa438, 0x1800, 0xa438, 0x081b, 0xa438, 0x1000, - 0xa438, 0x09df, 0xa438, 0xd704, 0xa438, 0x7fb8, 0xa438, 0xa718, - 0xa438, 0x1800, 0xa438, 0x074e, 0xa436, 0xA10E, 0xa438, 0xffff, - 0xa436, 0xA10C, 0xa438, 0xffff, 0xa436, 0xA10A, 0xa438, 0xffff, - 0xa436, 0xA108, 0xa438, 0xffff, 0xa436, 0xA106, 0xa438, 0x074d, - 0xa436, 0xA104, 0xa438, 0x0818, 0xa436, 0xA102, 0xa438, 0x0a2c, - 0xa436, 0xA100, 0xa438, 0x077e, 0xa436, 0xA110, 0xa438, 0x000f, - 0xa436, 0xb87c, 0xa438, 0x8625, 0xa436, 0xb87e, 0xa438, 0xaf86, - 0xa438, 0x3daf, 0xa438, 0x8689, 0xa438, 0xaf88, 0xa438, 0x69af, - 0xa438, 0x8887, 0xa438, 0xaf88, 0xa438, 0x9caf, 0xa438, 0x889c, - 0xa438, 0xaf88, 0xa438, 0x9caf, 0xa438, 0x889c, 0xa438, 0xbf86, - 0xa438, 0x49d7, 0xa438, 0x0040, 0xa438, 0x0277, 0xa438, 0x7daf, - 0xa438, 0x2727, 0xa438, 0x0000, 0xa438, 0x7205, 0xa438, 0x0000, - 0xa438, 0x7208, 0xa438, 0x0000, 0xa438, 0x71f3, 0xa438, 0x0000, - 0xa438, 0x71f6, 0xa438, 0x0000, 0xa438, 0x7229, 0xa438, 0x0000, - 0xa438, 0x722c, 0xa438, 0x0000, 0xa438, 0x7217, 0xa438, 0x0000, - 0xa438, 0x721a, 0xa438, 0x0000, 0xa438, 0x721d, 0xa438, 0x0000, - 0xa438, 0x7211, 0xa438, 0x0000, 0xa438, 0x7220, 0xa438, 0x0000, - 0xa438, 0x7214, 0xa438, 0x0000, 0xa438, 0x722f, 0xa438, 0x0000, - 0xa438, 0x7223, 0xa438, 0x0000, 0xa438, 0x7232, 0xa438, 0x0000, - 0xa438, 0x7226, 0xa438, 0xf8f9, 0xa438, 0xfae0, 0xa438, 0x85b3, - 0xa438, 0x3802, 0xa438, 0xad27, 0xa438, 0x02ae, 0xa438, 0x03af, - 0xa438, 0x8830, 0xa438, 0x1f66, 0xa438, 0xef65, 0xa438, 0xbfc2, - 0xa438, 0x1f1a, 0xa438, 0x96f7, 0xa438, 0x05ee, 0xa438, 0xffd2, - 0xa438, 0x00da, 0xa438, 0xf605, 0xa438, 0xbfc2, 0xa438, 0x2f1a, - 0xa438, 0x96f7, 0xa438, 0x05ee, 0xa438, 0xffd2, 0xa438, 0x00db, - 0xa438, 0xf605, 0xa438, 0xef02, 0xa438, 0x1f11, 0xa438, 0x0d42, - 0xa438, 0xbf88, 0xa438, 0x4202, 0xa438, 0x6e7d, 0xa438, 0xef02, - 0xa438, 0x1b03, 0xa438, 0x1f11, 0xa438, 0x0d42, 0xa438, 0xbf88, - 0xa438, 0x4502, 0xa438, 0x6e7d, 0xa438, 0xef02, 0xa438, 0x1a03, - 0xa438, 0x1f11, 0xa438, 0x0d42, 0xa438, 0xbf88, 0xa438, 0x4802, - 0xa438, 0x6e7d, 0xa438, 0xbfc2, 0xa438, 0x3f1a, 0xa438, 0x96f7, - 0xa438, 0x05ee, 0xa438, 0xffd2, 0xa438, 0x00da, 0xa438, 0xf605, - 0xa438, 0xbfc2, 0xa438, 0x4f1a, 0xa438, 0x96f7, 0xa438, 0x05ee, - 0xa438, 0xffd2, 0xa438, 0x00db, 0xa438, 0xf605, 0xa438, 0xef02, - 0xa438, 0x1f11, 0xa438, 0x0d42, 0xa438, 0xbf88, 0xa438, 0x4b02, - 0xa438, 0x6e7d, 0xa438, 0xef02, 0xa438, 0x1b03, 0xa438, 0x1f11, - 0xa438, 0x0d42, 0xa438, 0xbf88, 0xa438, 0x4e02, 0xa438, 0x6e7d, - 0xa438, 0xef02, 0xa438, 0x1a03, 0xa438, 0x1f11, 0xa438, 0x0d42, - 0xa438, 0xbf88, 0xa438, 0x5102, 0xa438, 0x6e7d, 0xa438, 0xef56, - 0xa438, 0xd020, 0xa438, 0x1f11, 0xa438, 0xbf88, 0xa438, 0x5402, - 0xa438, 0x6e7d, 0xa438, 0xbf88, 0xa438, 0x5702, 0xa438, 0x6e7d, - 0xa438, 0xbf88, 0xa438, 0x5a02, 0xa438, 0x6e7d, 0xa438, 0xe185, - 0xa438, 0xa0ef, 0xa438, 0x0348, 0xa438, 0x0a28, 0xa438, 0x05ef, - 0xa438, 0x201b, 0xa438, 0x01ad, 0xa438, 0x2735, 0xa438, 0x1f44, - 0xa438, 0xe085, 0xa438, 0x88e1, 0xa438, 0x8589, 0xa438, 0xbf88, - 0xa438, 0x5d02, 0xa438, 0x6e7d, 0xa438, 0xe085, 0xa438, 0x8ee1, - 0xa438, 0x858f, 0xa438, 0xbf88, 0xa438, 0x6002, 0xa438, 0x6e7d, - 0xa438, 0xe085, 0xa438, 0x94e1, 0xa438, 0x8595, 0xa438, 0xbf88, - 0xa438, 0x6302, 0xa438, 0x6e7d, 0xa438, 0xe085, 0xa438, 0x9ae1, - 0xa438, 0x859b, 0xa438, 0xbf88, 0xa438, 0x6602, 0xa438, 0x6e7d, - 0xa438, 0xaf88, 0xa438, 0x3cbf, 0xa438, 0x883f, 0xa438, 0x026e, - 0xa438, 0x9cad, 0xa438, 0x2835, 0xa438, 0x1f44, 0xa438, 0xe08f, - 0xa438, 0xf8e1, 0xa438, 0x8ff9, 0xa438, 0xbf88, 0xa438, 0x5d02, - 0xa438, 0x6e7d, 0xa438, 0xe08f, 0xa438, 0xfae1, 0xa438, 0x8ffb, - 0xa438, 0xbf88, 0xa438, 0x6002, 0xa438, 0x6e7d, 0xa438, 0xe08f, - 0xa438, 0xfce1, 0xa438, 0x8ffd, 0xa438, 0xbf88, 0xa438, 0x6302, - 0xa438, 0x6e7d, 0xa438, 0xe08f, 0xa438, 0xfee1, 0xa438, 0x8fff, - 0xa438, 0xbf88, 0xa438, 0x6602, 0xa438, 0x6e7d, 0xa438, 0xaf88, - 0xa438, 0x3ce1, 0xa438, 0x85a1, 0xa438, 0x1b21, 0xa438, 0xad37, - 0xa438, 0x341f, 0xa438, 0x44e0, 0xa438, 0x858a, 0xa438, 0xe185, - 0xa438, 0x8bbf, 0xa438, 0x885d, 0xa438, 0x026e, 0xa438, 0x7de0, - 0xa438, 0x8590, 0xa438, 0xe185, 0xa438, 0x91bf, 0xa438, 0x8860, - 0xa438, 0x026e, 0xa438, 0x7de0, 0xa438, 0x8596, 0xa438, 0xe185, - 0xa438, 0x97bf, 0xa438, 0x8863, 0xa438, 0x026e, 0xa438, 0x7de0, - 0xa438, 0x859c, 0xa438, 0xe185, 0xa438, 0x9dbf, 0xa438, 0x8866, - 0xa438, 0x026e, 0xa438, 0x7dae, 0xa438, 0x401f, 0xa438, 0x44e0, - 0xa438, 0x858c, 0xa438, 0xe185, 0xa438, 0x8dbf, 0xa438, 0x885d, - 0xa438, 0x026e, 0xa438, 0x7de0, 0xa438, 0x8592, 0xa438, 0xe185, - 0xa438, 0x93bf, 0xa438, 0x8860, 0xa438, 0x026e, 0xa438, 0x7de0, - 0xa438, 0x8598, 0xa438, 0xe185, 0xa438, 0x99bf, 0xa438, 0x8863, - 0xa438, 0x026e, 0xa438, 0x7de0, 0xa438, 0x859e, 0xa438, 0xe185, - 0xa438, 0x9fbf, 0xa438, 0x8866, 0xa438, 0x026e, 0xa438, 0x7dae, - 0xa438, 0x0ce1, 0xa438, 0x85b3, 0xa438, 0x3904, 0xa438, 0xac2f, - 0xa438, 0x04ee, 0xa438, 0x85b3, 0xa438, 0x00af, 0xa438, 0x39d9, - 0xa438, 0x22ac, 0xa438, 0xeaf0, 0xa438, 0xacf6, 0xa438, 0xf0ac, - 0xa438, 0xfaf0, 0xa438, 0xacf8, 0xa438, 0xf0ac, 0xa438, 0xfcf0, - 0xa438, 0xad00, 0xa438, 0xf0ac, 0xa438, 0xfef0, 0xa438, 0xacf0, - 0xa438, 0xf0ac, 0xa438, 0xf4f0, 0xa438, 0xacf2, 0xa438, 0xf0ac, - 0xa438, 0xb0f0, 0xa438, 0xacae, 0xa438, 0xf0ac, 0xa438, 0xacf0, - 0xa438, 0xacaa, 0xa438, 0xa100, 0xa438, 0x0ce1, 0xa438, 0x8ff7, - 0xa438, 0xbf88, 0xa438, 0x8402, 0xa438, 0x6e7d, 0xa438, 0xaf26, - 0xa438, 0xe9e1, 0xa438, 0x8ff6, 0xa438, 0xbf88, 0xa438, 0x8402, - 0xa438, 0x6e7d, 0xa438, 0xaf26, 0xa438, 0xf520, 0xa438, 0xac86, - 0xa438, 0xbf88, 0xa438, 0x3f02, 0xa438, 0x6e9c, 0xa438, 0xad28, - 0xa438, 0x03af, 0xa438, 0x3324, 0xa438, 0xad38, 0xa438, 0x03af, - 0xa438, 0x32e6, 0xa438, 0xaf32, 0xa438, 0xfb00, 0xa436, 0xb87c, - 0xa438, 0x8ff6, 0xa436, 0xb87e, 0xa438, 0x0705, 0xa436, 0xb87c, - 0xa438, 0x8ff8, 0xa436, 0xb87e, 0xa438, 0x19cc, 0xa436, 0xb87c, - 0xa438, 0x8ffa, 0xa436, 0xb87e, 0xa438, 0x28e3, 0xa436, 0xb87c, - 0xa438, 0x8ffc, 0xa436, 0xb87e, 0xa438, 0x1047, 0xa436, 0xb87c, - 0xa438, 0x8ffe, 0xa436, 0xb87e, 0xa438, 0x0a45, 0xa436, 0xb85e, - 0xa438, 0x271E, 0xa436, 0xb860, 0xa438, 0x3846, 0xa436, 0xb862, - 0xa438, 0x26E6, 0xa436, 0xb864, 0xa438, 0x32E3, 0xa436, 0xb886, - 0xa438, 0xffff, 0xa436, 0xb888, 0xa438, 0xffff, 0xa436, 0xb88a, - 0xa438, 0xffff, 0xa436, 0xb88c, 0xa438, 0xffff, 0xa436, 0xb838, - 0xa438, 0x000f, 0xb820, 0x0010, 0xa436, 0x846e, 0xa438, 0xaf84, - 0xa438, 0x86af, 0xa438, 0x8690, 0xa438, 0xaf86, 0xa438, 0xa4af, - 0xa438, 0x86a4, 0xa438, 0xaf86, 0xa438, 0xa4af, 0xa438, 0x86a4, - 0xa438, 0xaf86, 0xa438, 0xa4af, 0xa438, 0x86a4, 0xa438, 0xee82, - 0xa438, 0x5f00, 0xa438, 0x0284, 0xa438, 0x90af, 0xa438, 0x0441, - 0xa438, 0xf8e0, 0xa438, 0x8ff3, 0xa438, 0xa000, 0xa438, 0x0502, - 0xa438, 0x84a4, 0xa438, 0xae06, 0xa438, 0xa001, 0xa438, 0x0302, - 0xa438, 0x84c8, 0xa438, 0xfc04, 0xa438, 0xf8f9, 0xa438, 0xef59, - 0xa438, 0xe080, 0xa438, 0x15ad, 0xa438, 0x2702, 0xa438, 0xae03, - 0xa438, 0xaf84, 0xa438, 0xc3bf, 0xa438, 0x53ca, 0xa438, 0x0252, - 0xa438, 0xc8ad, 0xa438, 0x2807, 0xa438, 0x0285, 0xa438, 0x2cee, - 0xa438, 0x8ff3, 0xa438, 0x01ef, 0xa438, 0x95fd, 0xa438, 0xfc04, - 0xa438, 0xf8f9, 0xa438, 0xfaef, 0xa438, 0x69bf, 0xa438, 0x53ca, - 0xa438, 0x0252, 0xa438, 0xc8ac, 0xa438, 0x2822, 0xa438, 0xd480, - 0xa438, 0x00bf, 0xa438, 0x8684, 0xa438, 0x0252, 0xa438, 0xa9bf, - 0xa438, 0x8687, 0xa438, 0x0252, 0xa438, 0xa9bf, 0xa438, 0x868a, - 0xa438, 0x0252, 0xa438, 0xa9bf, 0xa438, 0x868d, 0xa438, 0x0252, - 0xa438, 0xa9ee, 0xa438, 0x8ff3, 0xa438, 0x00af, 0xa438, 0x8526, - 0xa438, 0xe08f, 0xa438, 0xf4e1, 0xa438, 0x8ff5, 0xa438, 0xe28f, - 0xa438, 0xf6e3, 0xa438, 0x8ff7, 0xa438, 0x1b45, 0xa438, 0xac27, - 0xa438, 0x0eee, 0xa438, 0x8ff4, 0xa438, 0x00ee, 0xa438, 0x8ff5, - 0xa438, 0x0002, 0xa438, 0x852c, 0xa438, 0xaf85, 0xa438, 0x26e0, - 0xa438, 0x8ff4, 0xa438, 0xe18f, 0xa438, 0xf52c, 0xa438, 0x0001, - 0xa438, 0xe48f, 0xa438, 0xf4e5, 0xa438, 0x8ff5, 0xa438, 0xef96, - 0xa438, 0xfefd, 0xa438, 0xfc04, 0xa438, 0xf8f9, 0xa438, 0xef59, - 0xa438, 0xbf53, 0xa438, 0x2202, 0xa438, 0x52c8, 0xa438, 0xa18b, - 0xa438, 0x02ae, 0xa438, 0x03af, 0xa438, 0x85da, 0xa438, 0xbf57, - 0xa438, 0x7202, 0xa438, 0x52c8, 0xa438, 0xe48f, 0xa438, 0xf8e5, - 0xa438, 0x8ff9, 0xa438, 0xbf57, 0xa438, 0x7502, 0xa438, 0x52c8, - 0xa438, 0xe48f, 0xa438, 0xfae5, 0xa438, 0x8ffb, 0xa438, 0xbf57, - 0xa438, 0x7802, 0xa438, 0x52c8, 0xa438, 0xe48f, 0xa438, 0xfce5, - 0xa438, 0x8ffd, 0xa438, 0xbf57, 0xa438, 0x7b02, 0xa438, 0x52c8, - 0xa438, 0xe48f, 0xa438, 0xfee5, 0xa438, 0x8fff, 0xa438, 0xbf57, - 0xa438, 0x6c02, 0xa438, 0x52c8, 0xa438, 0xa102, 0xa438, 0x13ee, - 0xa438, 0x8ffc, 0xa438, 0x80ee, 0xa438, 0x8ffd, 0xa438, 0x00ee, - 0xa438, 0x8ffe, 0xa438, 0x80ee, 0xa438, 0x8fff, 0xa438, 0x00af, - 0xa438, 0x8599, 0xa438, 0xa101, 0xa438, 0x0cbf, 0xa438, 0x534c, - 0xa438, 0x0252, 0xa438, 0xc8a1, 0xa438, 0x0303, 0xa438, 0xaf85, - 0xa438, 0x77bf, 0xa438, 0x5322, 0xa438, 0x0252, 0xa438, 0xc8a1, - 0xa438, 0x8b02, 0xa438, 0xae03, 0xa438, 0xaf86, 0xa438, 0x64e0, - 0xa438, 0x8ff8, 0xa438, 0xe18f, 0xa438, 0xf9bf, 0xa438, 0x8684, - 0xa438, 0x0252, 0xa438, 0xa9e0, 0xa438, 0x8ffa, 0xa438, 0xe18f, - 0xa438, 0xfbbf, 0xa438, 0x8687, 0xa438, 0x0252, 0xa438, 0xa9e0, - 0xa438, 0x8ffc, 0xa438, 0xe18f, 0xa438, 0xfdbf, 0xa438, 0x868a, - 0xa438, 0x0252, 0xa438, 0xa9e0, 0xa438, 0x8ffe, 0xa438, 0xe18f, - 0xa438, 0xffbf, 0xa438, 0x868d, 0xa438, 0x0252, 0xa438, 0xa9af, - 0xa438, 0x867f, 0xa438, 0xbf53, 0xa438, 0x2202, 0xa438, 0x52c8, - 0xa438, 0xa144, 0xa438, 0x3cbf, 0xa438, 0x547b, 0xa438, 0x0252, - 0xa438, 0xc8e4, 0xa438, 0x8ff8, 0xa438, 0xe58f, 0xa438, 0xf9bf, - 0xa438, 0x547e, 0xa438, 0x0252, 0xa438, 0xc8e4, 0xa438, 0x8ffa, - 0xa438, 0xe58f, 0xa438, 0xfbbf, 0xa438, 0x5481, 0xa438, 0x0252, - 0xa438, 0xc8e4, 0xa438, 0x8ffc, 0xa438, 0xe58f, 0xa438, 0xfdbf, - 0xa438, 0x5484, 0xa438, 0x0252, 0xa438, 0xc8e4, 0xa438, 0x8ffe, - 0xa438, 0xe58f, 0xa438, 0xffbf, 0xa438, 0x5322, 0xa438, 0x0252, - 0xa438, 0xc8a1, 0xa438, 0x4448, 0xa438, 0xaf85, 0xa438, 0xa7bf, - 0xa438, 0x5322, 0xa438, 0x0252, 0xa438, 0xc8a1, 0xa438, 0x313c, - 0xa438, 0xbf54, 0xa438, 0x7b02, 0xa438, 0x52c8, 0xa438, 0xe48f, - 0xa438, 0xf8e5, 0xa438, 0x8ff9, 0xa438, 0xbf54, 0xa438, 0x7e02, - 0xa438, 0x52c8, 0xa438, 0xe48f, 0xa438, 0xfae5, 0xa438, 0x8ffb, - 0xa438, 0xbf54, 0xa438, 0x8102, 0xa438, 0x52c8, 0xa438, 0xe48f, - 0xa438, 0xfce5, 0xa438, 0x8ffd, 0xa438, 0xbf54, 0xa438, 0x8402, - 0xa438, 0x52c8, 0xa438, 0xe48f, 0xa438, 0xfee5, 0xa438, 0x8fff, - 0xa438, 0xbf53, 0xa438, 0x2202, 0xa438, 0x52c8, 0xa438, 0xa131, - 0xa438, 0x03af, 0xa438, 0x85a7, 0xa438, 0xd480, 0xa438, 0x00bf, - 0xa438, 0x8684, 0xa438, 0x0252, 0xa438, 0xa9bf, 0xa438, 0x8687, - 0xa438, 0x0252, 0xa438, 0xa9bf, 0xa438, 0x868a, 0xa438, 0x0252, - 0xa438, 0xa9bf, 0xa438, 0x868d, 0xa438, 0x0252, 0xa438, 0xa9ef, - 0xa438, 0x95fd, 0xa438, 0xfc04, 0xa438, 0xf0d1, 0xa438, 0x2af0, - 0xa438, 0xd12c, 0xa438, 0xf0d1, 0xa438, 0x44f0, 0xa438, 0xd146, - 0xa438, 0xbf86, 0xa438, 0xa102, 0xa438, 0x52c8, 0xa438, 0xbf86, - 0xa438, 0xa102, 0xa438, 0x52c8, 0xa438, 0xd101, 0xa438, 0xaf06, - 0xa438, 0xa570, 0xa438, 0xce42, 0xa436, 0xb818, 0xa438, 0x043d, - 0xa436, 0xb81a, 0xa438, 0x06a3, 0xa436, 0xb81c, 0xa438, 0xffff, - 0xa436, 0xb81e, 0xa438, 0xffff, 0xa436, 0xb850, 0xa438, 0xffff, - 0xa436, 0xb852, 0xa438, 0xffff, 0xa436, 0xb878, 0xa438, 0xffff, - 0xa436, 0xb884, 0xa438, 0xffff, 0xa436, 0xb832, 0xa438, 0x0003, - 0xa436, 0x0000, 0xa438, 0x0000, 0xa436, 0xB82E, 0xa438, 0x0000, - 0xa436, 0x8024, 0xa438, 0x0000, 0xb820, 0x0000, 0xa436, 0x801E, - 0xa438, 0x0020, 0xFFFF, 0xFFFF -}; - -static void -rtl8125_real_set_phy_mcu_8125b_1(struct net_device *dev) -{ - rtl8125_set_phy_mcu_ram_code(dev, - phy_mcu_ram_code_8125b_1, - ARRAY_SIZE(phy_mcu_ram_code_8125b_1) - ); -} - -static void -rtl8125_set_phy_mcu_8125b_1(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - rtl8125_set_phy_mcu_patch_request(tp); - - rtl8125_real_set_phy_mcu_8125b_1(dev); - - rtl8125_clear_phy_mcu_patch_request(tp); -} - -static void -rtl8125_real_set_phy_mcu_8125b_2(struct net_device *dev) -{ - rtl8125_set_phy_mcu_ram_code(dev, - phy_mcu_ram_code_8125b_2, - ARRAY_SIZE(phy_mcu_ram_code_8125b_2) - ); -} - -static void -rtl8125_set_phy_mcu_8125b_2(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - rtl8125_set_phy_mcu_patch_request(tp); - - rtl8125_real_set_phy_mcu_8125b_2(dev); - - rtl8125_clear_phy_mcu_patch_request(tp); -} - -static void -rtl8125_init_hw_phy_mcu(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - u8 require_disable_phy_disable_mode = FALSE; - - if (tp->NotWrRamCodeToMicroP == TRUE) return; - if (rtl8125_check_hw_phy_mcu_code_ver(dev)) return; - - if (HW_SUPPORT_CHECK_PHY_DISABLE_MODE(tp) && rtl8125_is_in_phy_disable_mode(dev)) - require_disable_phy_disable_mode = TRUE; - - if (require_disable_phy_disable_mode) - rtl8125_disable_phy_disable_mode(dev); - - switch (tp->mcfg) { - case CFG_METHOD_2: - rtl8125_set_phy_mcu_8125a_1(dev); - break; - case CFG_METHOD_3: - case CFG_METHOD_6: - rtl8125_set_phy_mcu_8125a_2(dev); - break; - case CFG_METHOD_4: - rtl8125_set_phy_mcu_8125b_1(dev); - break; - case CFG_METHOD_5: - case CFG_METHOD_7: - rtl8125_set_phy_mcu_8125b_2(dev); - break; - } - - if (require_disable_phy_disable_mode) - rtl8125_enable_phy_disable_mode(dev); - - rtl8125_write_hw_phy_mcu_code_ver(dev); - - rtl8125_mdio_write(tp,0x1F, 0x0000); - - tp->HwHasWrRamCodeToMicroP = TRUE; -} -#endif - -static void -rtl8125_enable_phy_aldps(struct rtl8125_private *tp) -{ - //enable aldps - //GPHY OCP 0xA430 bit[2] = 0x1 (en_aldps) - SetEthPhyOcpBit(tp, 0xA430, BIT_2); -} - -static void -rtl8125_hw_phy_config_8125a_1(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - ClearAndSetEthPhyOcpBit(tp, - 0xAD40, - 0x03FF, - 0x84 - ); - - SetEthPhyOcpBit(tp, 0xAD4E, BIT_4); - ClearAndSetEthPhyOcpBit(tp, - 0xAD16, - 0x03FF, - 0x0006 - ); - ClearAndSetEthPhyOcpBit(tp, - 0xAD32, - 0x003F, - 0x0006 - ); - ClearEthPhyOcpBit(tp, 0xAC08, BIT_12); - ClearEthPhyOcpBit(tp, 0xAC08, BIT_8); - ClearAndSetEthPhyOcpBit(tp, - 0xAC8A, - BIT_15|BIT_14|BIT_13|BIT_12, - BIT_14|BIT_13|BIT_12 - ); - SetEthPhyOcpBit(tp, 0xAD18, BIT_10); - SetEthPhyOcpBit(tp, 0xAD1A, 0x3FF); - SetEthPhyOcpBit(tp, 0xAD1C, 0x3FF); - - mdio_direct_write_phy_ocp(tp, 0xA436, 0x80EA); - ClearAndSetEthPhyOcpBit(tp, - 0xA438, - 0xFF00, - 0xC400 - ); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x80EB); - ClearAndSetEthPhyOcpBit(tp, - 0xA438, - 0x0700, - 0x0300 - ); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x80F8); - ClearAndSetEthPhyOcpBit(tp, - 0xA438, - 0xFF00, - 0x1C00 - ); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x80F1); - ClearAndSetEthPhyOcpBit(tp, - 0xA438, - 0xFF00, - 0x3000 - ); - - mdio_direct_write_phy_ocp(tp, 0xA436, 0x80FE); - ClearAndSetEthPhyOcpBit(tp, - 0xA438, - 0xFF00, - 0xA500 - ); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x8102); - ClearAndSetEthPhyOcpBit(tp, - 0xA438, - 0xFF00, - 0x5000 - ); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x8105); - ClearAndSetEthPhyOcpBit(tp, - 0xA438, - 0xFF00, - 0x3300 - ); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x8100); - ClearAndSetEthPhyOcpBit(tp, - 0xA438, - 0xFF00, - 0x7000 - ); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x8104); - ClearAndSetEthPhyOcpBit(tp, - 0xA438, - 0xFF00, - 0xF000 - ); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x8106); - ClearAndSetEthPhyOcpBit(tp, - 0xA438, - 0xFF00, - 0x6500 - ); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x80DC); - ClearAndSetEthPhyOcpBit(tp, - 0xA438, - 0xFF00, - 0xED00 - ); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x80DF); - SetEthPhyOcpBit(tp, 0xA438, BIT_8); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x80E1); - ClearEthPhyOcpBit(tp, 0xA438, BIT_8); - - ClearAndSetEthPhyOcpBit(tp, - 0xBF06, - 0x003F, - 0x38 - ); - - mdio_direct_write_phy_ocp(tp, 0xA436, 0x819F); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xD0B6); - - mdio_direct_write_phy_ocp(tp, 0xBC34, 0x5555); - ClearAndSetEthPhyOcpBit(tp, - 0xBF0A, - BIT_11|BIT_10|BIT_9, - BIT_11|BIT_9 - ); - - ClearEthPhyOcpBit(tp, 0xA5C0, BIT_10); - - SetEthPhyOcpBit(tp, 0xA442, BIT_11); - - //enable aldps - //GPHY OCP 0xA430 bit[2] = 0x1 (en_aldps) - if (aspm) { - if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) { - rtl8125_enable_phy_aldps(tp); - } - } -} - -static void -rtl8125_hw_phy_config_8125a_2(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - SetEthPhyOcpBit(tp, 0xAD4E, BIT_4); - ClearAndSetEthPhyOcpBit(tp, - 0xAD16, - 0x03FF, - 0x03FF - ); - ClearAndSetEthPhyOcpBit(tp, - 0xAD32, - 0x003F, - 0x0006 - ); - ClearEthPhyOcpBit(tp, 0xAC08, BIT_12); - ClearEthPhyOcpBit(tp, 0xAC08, BIT_8); - ClearAndSetEthPhyOcpBit(tp, - 0xACC0, - BIT_1|BIT_0, - BIT_1 - ); - ClearAndSetEthPhyOcpBit(tp, - 0xAD40, - BIT_7|BIT_6|BIT_5, - BIT_6 - ); - ClearAndSetEthPhyOcpBit(tp, - 0xAD40, - BIT_2|BIT_1|BIT_0, - BIT_2 - ); - ClearEthPhyOcpBit(tp, 0xAC14, BIT_7); - ClearEthPhyOcpBit(tp, 0xAC80, BIT_9|BIT_8); - ClearAndSetEthPhyOcpBit(tp, - 0xAC5E, - BIT_2|BIT_1|BIT_0, - BIT_1 - ); - mdio_direct_write_phy_ocp(tp, 0xAD4C, 0x00A8); - mdio_direct_write_phy_ocp(tp, 0xAC5C, 0x01FF); - ClearAndSetEthPhyOcpBit(tp, - 0xAC8A, - BIT_7|BIT_6|BIT_5|BIT_4, - BIT_5|BIT_4 - ); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8157); - ClearAndSetEthPhyOcpBit(tp, - 0xB87E, - 0xFF00, - 0x0500 - ); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8159); - ClearAndSetEthPhyOcpBit(tp, - 0xB87E, - 0xFF00, - 0x0700 - ); - - - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x80A2); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0153); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x809C); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0153); - - - mdio_direct_write_phy_ocp(tp, 0xA436, 0x81B3); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0043); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x00A7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x00D6); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x00EC); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x00F6); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x00FB); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x00FD); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x00FF); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x00BB); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0058); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0029); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0013); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0009); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0004); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0002); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - - - mdio_direct_write_phy_ocp(tp, 0xA436, 0x8257); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x020F); - - - mdio_direct_write_phy_ocp(tp, 0xA436, 0x80EA); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x7843); - - - rtl8125_set_phy_mcu_patch_request(tp); - - ClearEthPhyOcpBit(tp, 0xB896, BIT_0); - ClearEthPhyOcpBit(tp, 0xB892, 0xFF00); - - mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC091); - mdio_direct_write_phy_ocp(tp, 0xB890, 0x6E12); - mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC092); - mdio_direct_write_phy_ocp(tp, 0xB890, 0x1214); - mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC094); - mdio_direct_write_phy_ocp(tp, 0xB890, 0x1516); - mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC096); - mdio_direct_write_phy_ocp(tp, 0xB890, 0x171B); - mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC098); - mdio_direct_write_phy_ocp(tp, 0xB890, 0x1B1C); - mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC09A); - mdio_direct_write_phy_ocp(tp, 0xB890, 0x1F1F); - mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC09C); - mdio_direct_write_phy_ocp(tp, 0xB890, 0x2021); - mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC09E); - mdio_direct_write_phy_ocp(tp, 0xB890, 0x2224); - mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC0A0); - mdio_direct_write_phy_ocp(tp, 0xB890, 0x2424); - mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC0A2); - mdio_direct_write_phy_ocp(tp, 0xB890, 0x2424); - mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC0A4); - mdio_direct_write_phy_ocp(tp, 0xB890, 0x2424); - mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC018); - mdio_direct_write_phy_ocp(tp, 0xB890, 0x0AF2); - mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC01A); - mdio_direct_write_phy_ocp(tp, 0xB890, 0x0D4A); - mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC01C); - mdio_direct_write_phy_ocp(tp, 0xB890, 0x0F26); - mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC01E); - mdio_direct_write_phy_ocp(tp, 0xB890, 0x118D); - mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC020); - mdio_direct_write_phy_ocp(tp, 0xB890, 0x14F3); - mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC022); - mdio_direct_write_phy_ocp(tp, 0xB890, 0x175A); - mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC024); - mdio_direct_write_phy_ocp(tp, 0xB890, 0x19C0); - mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC026); - mdio_direct_write_phy_ocp(tp, 0xB890, 0x1C26); - mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC089); - mdio_direct_write_phy_ocp(tp, 0xB890, 0x6050); - mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC08A); - mdio_direct_write_phy_ocp(tp, 0xB890, 0x5F6E); - mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC08C); - mdio_direct_write_phy_ocp(tp, 0xB890, 0x6E6E); - mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC08E); - mdio_direct_write_phy_ocp(tp, 0xB890, 0x6E6E); - mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC090); - mdio_direct_write_phy_ocp(tp, 0xB890, 0x6E12); - - SetEthPhyOcpBit(tp, 0xB896, BIT_0); - - rtl8125_clear_phy_mcu_patch_request(tp); - - - SetEthPhyOcpBit(tp, 0xD068, BIT_13); - - - mdio_direct_write_phy_ocp(tp, 0xA436, 0x81A2); - SetEthPhyOcpBit(tp, 0xA438, BIT_8); - ClearAndSetEthPhyOcpBit(tp, - 0xB54C, - 0xFF00, - 0xDB00); - - - ClearEthPhyOcpBit(tp, 0xA454, BIT_0); - - - SetEthPhyOcpBit(tp, 0xA5D4, BIT_5); - ClearEthPhyOcpBit(tp, 0xAD4E, BIT_4); - ClearEthPhyOcpBit(tp, 0xA86A, BIT_0); - - - SetEthPhyOcpBit(tp, 0xA442, BIT_11); - - - if (tp->RequirePhyMdiSwapPatch) { - u16 adccal_offset_p0; - u16 adccal_offset_p1; - u16 adccal_offset_p2; - u16 adccal_offset_p3; - u16 rg_lpf_cap_xg_p0; - u16 rg_lpf_cap_xg_p1; - u16 rg_lpf_cap_xg_p2; - u16 rg_lpf_cap_xg_p3; - u16 rg_lpf_cap_p0; - u16 rg_lpf_cap_p1; - u16 rg_lpf_cap_p2; - u16 rg_lpf_cap_p3; - - ClearAndSetEthPhyOcpBit(tp, - 0xD068, - 0x0007, - 0x0001 - ); - ClearAndSetEthPhyOcpBit(tp, - 0xD068, - 0x0018, - 0x0000 - ); - adccal_offset_p0 = mdio_direct_read_phy_ocp(tp, 0xD06A); - adccal_offset_p0 &= 0x07FF; - ClearAndSetEthPhyOcpBit(tp, - 0xD068, - 0x0018, - 0x0008 - ); - adccal_offset_p1 = mdio_direct_read_phy_ocp(tp, 0xD06A); - adccal_offset_p1 &= 0x07FF; - ClearAndSetEthPhyOcpBit(tp, - 0xD068, - 0x0018, - 0x0010 - ); - adccal_offset_p2 = mdio_direct_read_phy_ocp(tp, 0xD06A); - adccal_offset_p2 &= 0x07FF; - ClearAndSetEthPhyOcpBit(tp, - 0xD068, - 0x0018, - 0x0018 - ); - adccal_offset_p3 = mdio_direct_read_phy_ocp(tp, 0xD06A); - adccal_offset_p3 &= 0x07FF; - - - ClearAndSetEthPhyOcpBit(tp, - 0xD068, - 0x0018, - 0x0000 - ); - ClearAndSetEthPhyOcpBit(tp, - 0xD06A, - 0x07FF, - adccal_offset_p3 - ); - ClearAndSetEthPhyOcpBit(tp, - 0xD068, - 0x0018, - 0x0008 - ); - ClearAndSetEthPhyOcpBit(tp, - 0xD06A, - 0x07FF, - adccal_offset_p2 - ); - ClearAndSetEthPhyOcpBit(tp, - 0xD068, - 0x0018, - 0x0010 - ); - ClearAndSetEthPhyOcpBit(tp, - 0xD06A, - 0x07FF, - adccal_offset_p1 - ); - ClearAndSetEthPhyOcpBit(tp, - 0xD068, - 0x0018, - 0x0018 - ); - ClearAndSetEthPhyOcpBit(tp, - 0xD06A, - 0x07FF, - adccal_offset_p0 - ); - - - rg_lpf_cap_xg_p0 = mdio_direct_read_phy_ocp(tp, 0xBD5A); - rg_lpf_cap_xg_p0 &= 0x001F; - rg_lpf_cap_xg_p1 = mdio_direct_read_phy_ocp(tp, 0xBD5A); - rg_lpf_cap_xg_p1 &= 0x1F00; - rg_lpf_cap_xg_p2 = mdio_direct_read_phy_ocp(tp, 0xBD5C); - rg_lpf_cap_xg_p2 &= 0x001F; - rg_lpf_cap_xg_p3 = mdio_direct_read_phy_ocp(tp, 0xBD5C); - rg_lpf_cap_xg_p3 &= 0x1F00; - rg_lpf_cap_p0 = mdio_direct_read_phy_ocp(tp, 0xBC18); - rg_lpf_cap_p0 &= 0x001F; - rg_lpf_cap_p1 = mdio_direct_read_phy_ocp(tp, 0xBC18); - rg_lpf_cap_p1 &= 0x1F00; - rg_lpf_cap_p2 = mdio_direct_read_phy_ocp(tp, 0xBC1A); - rg_lpf_cap_p2 &= 0x001F; - rg_lpf_cap_p3 = mdio_direct_read_phy_ocp(tp, 0xBC1A); - rg_lpf_cap_p3 &= 0x1F00; - - - ClearAndSetEthPhyOcpBit(tp, - 0xBD5A, - 0x001F, - rg_lpf_cap_xg_p3 >> 8 - ); - ClearAndSetEthPhyOcpBit(tp, - 0xBD5A, - 0x1F00, - rg_lpf_cap_xg_p2 << 8 - ); - ClearAndSetEthPhyOcpBit(tp, - 0xBD5C, - 0x001F, - rg_lpf_cap_xg_p1 >> 8 - ); - ClearAndSetEthPhyOcpBit(tp, - 0xBD5C, - 0x1F00, - rg_lpf_cap_xg_p0 << 8 - ); - ClearAndSetEthPhyOcpBit(tp, - 0xBC18, - 0x001F, - rg_lpf_cap_p3 >> 8 - ); - ClearAndSetEthPhyOcpBit(tp, - 0xBC18, - 0x1F00, - rg_lpf_cap_p2 << 8 - ); - ClearAndSetEthPhyOcpBit(tp, - 0xBC1A, - 0x001F, - rg_lpf_cap_p1 >> 8 - ); - ClearAndSetEthPhyOcpBit(tp, - 0xBC1A, - 0x1F00, - rg_lpf_cap_p0 << 8 - ); - } - - - if (aspm) { - if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) { - rtl8125_enable_phy_aldps(tp); - } - } -} - -static void -rtl8125_hw_phy_config_8125b_1(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - SetEthPhyOcpBit(tp, 0xA442, BIT_11); - - - SetEthPhyOcpBit(tp, 0xBC08, (BIT_3 | BIT_2)); - - - if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) { - mdio_direct_write_phy_ocp(tp, 0xA436, 0x8FFF); - ClearAndSetEthPhyOcpBit(tp, - 0xA438, - 0xFF00, - 0x0400 - ); - } - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8560); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x19CC); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8562); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x19CC); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8564); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x19CC); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8566); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x147D); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8568); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x147D); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x856A); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x147D); - if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) { - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FFE); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0907); - } - ClearAndSetEthPhyOcpBit(tp, - 0xACDA, - 0xFF00, - 0xFF00 - ); - ClearAndSetEthPhyOcpBit(tp, - 0xACDE, - 0xF000, - 0xF000 - ); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x80D6); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x2801); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x80F2); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x2801); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x80F4); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x6077); - mdio_direct_write_phy_ocp(tp, 0xB506, 0x01E7); - mdio_direct_write_phy_ocp(tp, 0xAC8C, 0x0FFC); - mdio_direct_write_phy_ocp(tp, 0xAC46, 0xB7B4); - mdio_direct_write_phy_ocp(tp, 0xAC50, 0x0FBC); - mdio_direct_write_phy_ocp(tp, 0xAC3C, 0x9240); - mdio_direct_write_phy_ocp(tp, 0xAC4E, 0x0DB4); - mdio_direct_write_phy_ocp(tp, 0xACC6, 0x0707); - mdio_direct_write_phy_ocp(tp, 0xACC8, 0xA0D3); - mdio_direct_write_phy_ocp(tp, 0xAD08, 0x0007); - - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8013); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0700); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FB9); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x2801); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FBA); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0100); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FBC); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x1900); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FBE); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0xE100); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FC0); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0800); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FC2); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0xE500); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FC4); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0F00); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FC6); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0xF100); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FC8); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0400); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FCa); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0xF300); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FCc); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0xFD00); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FCe); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0xFF00); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FD0); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0xFB00); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FD2); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0100); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FD4); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0xF400); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FD6); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0xFF00); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FD8); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0xF600); - - - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x813D); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x390E); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x814F); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x790E); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x80B0); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0F31); - SetEthPhyOcpBit(tp, 0xBF4C, BIT_1); - SetEthPhyOcpBit(tp, 0xBCCA, (BIT_9 | BIT_8)); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8141); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x320E); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8153); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x720E); - ClearEthPhyOcpBit(tp, 0xA432, BIT_6); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8529); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x050E); - - - mdio_direct_write_phy_ocp(tp, 0xA436, 0x816C); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xC4A0); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x8170); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xC4A0); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x8174); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x04A0); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x8178); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x04A0); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x817C); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0719); - if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) { - mdio_direct_write_phy_ocp(tp, 0xA436, 0x8FF4); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0400); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x8FF1); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0404); - } - mdio_direct_write_phy_ocp(tp, 0xBF4A, 0x001B); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8033); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x7C13); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8037); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x7C13); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x803B); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0xFC32); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x803F); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x7C13); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8043); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x7C13); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8047); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x7C13); - - - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8145); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x370E); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8157); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x770E); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8169); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0D0A); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x817B); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x1D0A); - - - mdio_direct_write_phy_ocp(tp, 0xA436, 0x8217); - ClearAndSetEthPhyOcpBit(tp, - 0xA438, - 0xFF00, - 0x5000 - ); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x821A); - ClearAndSetEthPhyOcpBit(tp, - 0xA438, - 0xFF00, - 0x5000 - ); - - mdio_direct_write_phy_ocp(tp, 0xA436, 0x80DA); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0403); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x80DC); - ClearAndSetEthPhyOcpBit(tp, - 0xA438, - 0xFF00, - 0x1000 - ); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x80B3); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0384); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x80B7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x2007); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x80BA); - ClearAndSetEthPhyOcpBit(tp, - 0xA438, - 0xFF00, - 0x6C00 - ); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x80B5); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xF009); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x80BD); - ClearAndSetEthPhyOcpBit(tp, - 0xA438, - 0xFF00, - 0x9F00 - ); - - mdio_direct_write_phy_ocp(tp, 0xA436, 0x80C7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf083); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x80DD); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x03f0); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x80DF); - ClearAndSetEthPhyOcpBit(tp, - 0xA438, - 0xFF00, - 0x1000 - ); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x80CB); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x2007); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x80CE); - ClearAndSetEthPhyOcpBit(tp, - 0xA438, - 0xFF00, - 0x6C00 - ); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x80C9); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8009); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x80D1); - ClearAndSetEthPhyOcpBit(tp, - 0xA438, - 0xFF00, - 0x8000 - ); - - mdio_direct_write_phy_ocp(tp, 0xA436, 0x80A3); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x200A); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x80A5); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xF0AD); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x809F); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x6073); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x80A1); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x000B); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x80A9); - ClearAndSetEthPhyOcpBit(tp, - 0xA438, - 0xFF00, - 0xC000 - ); - - rtl8125_set_phy_mcu_patch_request(tp); - - ClearEthPhyOcpBit(tp, 0xB896, BIT_0); - ClearEthPhyOcpBit(tp, 0xB892, 0xFF00); - - mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC23E); - mdio_direct_write_phy_ocp(tp, 0xB890, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC240); - mdio_direct_write_phy_ocp(tp, 0xB890, 0x0103); - mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC242); - mdio_direct_write_phy_ocp(tp, 0xB890, 0x0507); - mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC244); - mdio_direct_write_phy_ocp(tp, 0xB890, 0x090B); - mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC246); - mdio_direct_write_phy_ocp(tp, 0xB890, 0x0C0E); - mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC248); - mdio_direct_write_phy_ocp(tp, 0xB890, 0x1012); - mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC24A); - mdio_direct_write_phy_ocp(tp, 0xB890, 0x1416); - - SetEthPhyOcpBit(tp, 0xB896, BIT_0); - - rtl8125_clear_phy_mcu_patch_request(tp); - - - SetEthPhyOcpBit(tp, 0xA86A, BIT_0); - SetEthPhyOcpBit(tp, 0xA6F0, BIT_0); - - - mdio_direct_write_phy_ocp(tp, 0xBFA0, 0xD70D); - mdio_direct_write_phy_ocp(tp, 0xBFA2, 0x4100); - mdio_direct_write_phy_ocp(tp, 0xBFA4, 0xE868); - mdio_direct_write_phy_ocp(tp, 0xBFA6, 0xDC59); - mdio_direct_write_phy_ocp(tp, 0xB54C, 0x3C18); - ClearEthPhyOcpBit(tp, 0xBFA4, BIT_5); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x817D); - SetEthPhyOcpBit(tp, 0xA438, BIT_12); - - - if (aspm) { - if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) { - rtl8125_enable_phy_aldps(tp); - } - } -} - -static void -rtl8125_hw_phy_config_8125b_2(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - SetEthPhyOcpBit(tp, 0xA442, BIT_11); - - - ClearAndSetEthPhyOcpBit(tp, - 0xAC46, - 0x00F0, - 0x0090 - ); - ClearAndSetEthPhyOcpBit(tp, - 0xAD30, - 0x0003, - 0x0001 - ); - - - RTL_W16(tp, EEE_TXIDLE_TIMER_8125, tp->eee.tx_lpi_timer); - - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x80F5); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x760E); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8107); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x360E); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8551); - ClearAndSetEthPhyOcpBit(tp, - 0xB87E, - BIT_15 | BIT_14 | BIT_13 | BIT_12 | BIT_11 | BIT_10 | BIT_9 | BIT_8, - BIT_11 - ); - - ClearAndSetEthPhyOcpBit(tp, - 0xbf00, - 0xE000, - 0xA000 - ); - ClearAndSetEthPhyOcpBit(tp, - 0xbf46, - 0x0F00, - 0x0300 - ); - mdio_direct_write_phy_ocp(tp, 0xa436, 0x8044); - mdio_direct_write_phy_ocp(tp, 0xa438, 0x2417); - mdio_direct_write_phy_ocp(tp, 0xa436, 0x804A); - mdio_direct_write_phy_ocp(tp, 0xa438, 0x2417); - mdio_direct_write_phy_ocp(tp, 0xa436, 0x8050); - mdio_direct_write_phy_ocp(tp, 0xa438, 0x2417); - mdio_direct_write_phy_ocp(tp, 0xa436, 0x8056); - mdio_direct_write_phy_ocp(tp, 0xa438, 0x2417); - mdio_direct_write_phy_ocp(tp, 0xa436, 0x805C); - mdio_direct_write_phy_ocp(tp, 0xa438, 0x2417); - mdio_direct_write_phy_ocp(tp, 0xa436, 0x8062); - mdio_direct_write_phy_ocp(tp, 0xa438, 0x2417); - mdio_direct_write_phy_ocp(tp, 0xa436, 0x8068); - mdio_direct_write_phy_ocp(tp, 0xa438, 0x2417); - mdio_direct_write_phy_ocp(tp, 0xa436, 0x806E); - mdio_direct_write_phy_ocp(tp, 0xa438, 0x2417); - mdio_direct_write_phy_ocp(tp, 0xa436, 0x8074); - mdio_direct_write_phy_ocp(tp, 0xa438, 0x2417); - mdio_direct_write_phy_ocp(tp, 0xa436, 0x807A); - mdio_direct_write_phy_ocp(tp, 0xa438, 0x2417); - - - SetEthPhyOcpBit(tp, 0xA4CA, BIT_6); - - - ClearAndSetEthPhyOcpBit(tp, - 0xBF84, - BIT_15 | BIT_14 | BIT_13, - BIT_15 | BIT_13 - ); - - - mdio_direct_write_phy_ocp(tp, 0xA436, 0x8170); - ClearAndSetEthPhyOcpBit(tp, - 0xA438, - BIT_13 | BIT_10 | BIT_9 | BIT_8, - BIT_15 | BIT_14 | BIT_12 | BIT_11 - ); - - /* - mdio_direct_write_phy_ocp(tp, 0xBFA0, 0xD70D); - mdio_direct_write_phy_ocp(tp, 0xBFA2, 0x4100); - mdio_direct_write_phy_ocp(tp, 0xBFA4, 0xE868); - mdio_direct_write_phy_ocp(tp, 0xBFA6, 0xDC59); - mdio_direct_write_phy_ocp(tp, 0xB54C, 0x3C18); - ClearEthPhyOcpBit(tp, 0xBFA4, BIT_5); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x817D); - SetEthPhyOcpBit(tp, 0xA438, BIT_12); - */ - - - if (aspm) { - if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) { - rtl8125_enable_phy_aldps(tp); - } - } -} - -static void -rtl8125_hw_phy_config(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - if (tp->resume_not_chg_speed) return; - - tp->phy_reset_enable(dev); - - if (HW_DASH_SUPPORT_TYPE_3(tp) && tp->HwPkgDet == 0x06) return; - -#ifndef ENABLE_USE_FIRMWARE_FILE - if (!tp->rtl_fw) { - rtl8125_set_hw_phy_before_init_phy_mcu(dev); - - rtl8125_init_hw_phy_mcu(dev); - } -#endif - - switch (tp->mcfg) { - case CFG_METHOD_2: - rtl8125_hw_phy_config_8125a_1(dev); - break; - case CFG_METHOD_3: - case CFG_METHOD_6: - rtl8125_hw_phy_config_8125a_2(dev); - break; - case CFG_METHOD_4: - rtl8125_hw_phy_config_8125b_1(dev); - break; - case CFG_METHOD_5: - case CFG_METHOD_7: - rtl8125_hw_phy_config_8125b_2(dev); - break; - } - - //legacy force mode(Chap 22) - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - default: - rtl8125_mdio_write(tp, 0x1F, 0x0A5B); - rtl8125_clear_eth_phy_bit(tp, 0x12, BIT_15); - rtl8125_mdio_write(tp, 0x1F, 0x0000); - break; - } - - /*ocp phy power saving*/ - /* - if (aspm) { - if (tp->mcfg == CFG_METHOD_2 || tp->mcfg == CFG_METHOD_3 || - tp->mcfg == CFG_METHOD_6) - rtl8125_enable_ocp_phy_power_saving(dev); - } - */ - - rtl8125_mdio_write(tp, 0x1F, 0x0000); - - if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) { - if (tp->eee.eee_enabled) - rtl8125_enable_eee(tp); - else - rtl8125_disable_eee(tp); - } -} - -static void -rtl8125_up(struct net_device *dev) -{ - rtl8125_hw_init(dev); - rtl8125_hw_reset(dev); - rtl8125_powerup_pll(dev); - rtl8125_hw_ephy_config(dev); - rtl8125_hw_phy_config(dev); - rtl8125_hw_config(dev); -} - -/* -static inline void rtl8125_delete_esd_timer(struct net_device *dev, struct timer_list *timer) -{ - del_timer_sync(timer); -} - -static inline void rtl8125_request_esd_timer(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - struct timer_list *timer = &tp->esd_timer; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0) - setup_timer(timer, rtl8125_esd_timer, (unsigned long)dev); -#else - timer_setup(timer, rtl8125_esd_timer, 0); -#endif - mod_timer(timer, jiffies + RTL8125_ESD_TIMEOUT); -} -*/ - -/* -static inline void rtl8125_delete_link_timer(struct net_device *dev, struct timer_list *timer) -{ - del_timer_sync(timer); -} - -static inline void rtl8125_request_link_timer(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - struct timer_list *timer = &tp->link_timer; - -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0) - setup_timer(timer, rtl8125_link_timer, (unsigned long)dev); -#else - timer_setup(timer, rtl8125_link_timer, 0); -#endif - mod_timer(timer, jiffies + RTL8125_LINK_TIMEOUT); -} -*/ - -#ifdef CONFIG_NET_POLL_CONTROLLER -/* - * Polling 'interrupt' - used by things like netconsole to send skbs - * without having to re-enable interrupts. It's not called while - * the interrupt routine is executing. - */ -static void -rtl8125_netpoll(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - int i; - for (i = 0; i < tp->irq_nvecs; i++) { - struct r8125_irq *irq = &tp->irq_tbl[i]; - struct r8125_napi *r8125napi = &tp->r8125napi[i]; - - disable_irq(irq->vector); - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0) - irq->handler(irq->vector, r8125napi); -#elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) - irq->handler(irq->vector, r8125napi, NULL); -#else - irq->handler(irq->vector, r8125napi); -#endif - - enable_irq(irq->vector); - } -} -#endif //CONFIG_NET_POLL_CONTROLLER - -static void -rtl8125_get_bios_setting(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - tp->bios_setting = RTL_R32(tp, TimeInt2); - break; - } -} - -static void -rtl8125_set_bios_setting(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - RTL_W32(tp, TimeInt2, tp->bios_setting); - break; - } -} - -static void -rtl8125_setup_mqs_reg(struct rtl8125_private *tp) -{ - int i; - - //tx - tp->tx_ring[0].tdsar_reg = TxDescStartAddrLow; - for (i = 1; i < R8125_MAX_TX_QUEUES; i++) { - tp->tx_ring[i].tdsar_reg = (u16)(TNPDS_Q1_LOW_8125 + (i - 1) * 8); - } - - for (i = 0; i < R8125_MAX_TX_QUEUES; i++) { - tp->tx_ring[i].hw_clo_ptr_reg = (u16)(HW_CLO_PTR0_8125 + i * 4); - tp->tx_ring[i].sw_tail_ptr_reg = (u16)(SW_TAIL_PTR0_8125 + i * 4); - } - - //rx - tp->rx_ring[0].rdsar_reg = RxDescAddrLow; - for (i = 1; i < R8125_MAX_RX_QUEUES; i++) { - tp->rx_ring[i].rdsar_reg = (u16)(RDSAR_Q1_LOW_8125 + (i - 1) * 8); - } - - tp->isr_reg[0] = ISR0_8125; - for (i = 1; i < R8125_MAX_QUEUES; i++) { - tp->isr_reg[i] = (u16)(ISR1_8125 + (i - 1) * 4); - } - - tp->imr_reg[0] = IMR0_8125; - for (i = 1; i < R8125_MAX_QUEUES; i++) { - tp->imr_reg[i] = (u16)(IMR1_8125 + (i - 1) * 4); - } -} - -static void -rtl8125_init_software_variable(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - struct pci_dev *pdev = tp->pci_dev; - - rtl8125_get_bios_setting(dev); - -#ifdef ENABLE_LIB_SUPPORT - tp->ring_lib_enabled = 1; -#endif - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - //tp->HwSuppDashVer = 3; - break; - default: - tp->HwSuppDashVer = 0; - break; - } - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - tp->HwPkgDet = rtl8125_mac_ocp_read(tp, 0xDC00); - tp->HwPkgDet = (tp->HwPkgDet >> 3) & 0x07; - break; - } - - if (HW_DASH_SUPPORT_TYPE_3(tp) && tp->HwPkgDet == 0x06) - eee_enable = 0; - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - tp->HwSuppNowIsOobVer = 1; - break; - } - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - tp->HwPcieSNOffset = 0x16C; - break; - } - -#ifdef ENABLE_REALWOW_SUPPORT - rtl8125_get_realwow_hw_version(dev); -#endif //ENABLE_REALWOW_SUPPORT - - if (HW_DASH_SUPPORT_DASH(tp) && rtl8125_check_dash(tp)) - tp->DASH = 1; - else - tp->DASH = 0; - - if (tp->DASH) { - if (HW_DASH_SUPPORT_TYPE_3(tp)) { - u64 CmacMemPhysAddress; - void __iomem *cmac_ioaddr = NULL; - - //map CMAC IO space - CmacMemPhysAddress = rtl8125_csi_other_fun_read(tp, 0, 0x18); - if (!(CmacMemPhysAddress & BIT_0)) { - if (CmacMemPhysAddress & BIT_2) - CmacMemPhysAddress |= (u64)rtl8125_csi_other_fun_read(tp, 0, 0x1C) << 32; - - CmacMemPhysAddress &= 0xFFFFFFF0; - /* ioremap MMIO region */ - cmac_ioaddr = ioremap(CmacMemPhysAddress, R8125_REGS_SIZE); - } - - if (cmac_ioaddr == NULL) { -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - if (netif_msg_probe(tp)) - dev_err(&pdev->dev, "cannot remap CMAC MMIO, aborting\n"); -#endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - } - - if (cmac_ioaddr == NULL) { - tp->DASH = 0; - } else { - tp->mapped_cmac_ioaddr = cmac_ioaddr; - } - } - - eee_enable = 0; - } - - if (HW_DASH_SUPPORT_TYPE_3(tp)) - tp->cmac_ioaddr = tp->mapped_cmac_ioaddr; - - if (aspm) { - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - tp->org_pci_offset_99 = rtl8125_csi_fun0_read_byte(tp, 0x99); - tp->org_pci_offset_99 &= ~(BIT_5|BIT_6); - break; - } - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_6: - tp->org_pci_offset_180 = rtl8125_csi_fun0_read_byte(tp, 0x264); - break; - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_7: - tp->org_pci_offset_180 = rtl8125_csi_fun0_read_byte(tp, 0x214); - break; - } - } - - pci_read_config_byte(pdev, 0x80, &tp->org_pci_offset_80); - pci_read_config_byte(pdev, 0x81, &tp->org_pci_offset_81); - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - default: - tp->use_timer_interrrupt = TRUE; - break; - } - - if (timer_count == 0 || tp->mcfg == CFG_METHOD_DEFAULT) - tp->use_timer_interrrupt = FALSE; - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - tp->HwSuppMagicPktVer = WAKEUP_MAGIC_PACKET_V3; - break; - default: - tp->HwSuppMagicPktVer = WAKEUP_MAGIC_PACKET_NOT_SUPPORT; - break; - } - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - tp->HwSuppLinkChgWakeUpVer = 3; - break; - } - - switch (tp->mcfg) { - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - tp->HwSuppD0SpeedUpVer = 1; - break; - } - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - tp->HwSuppCheckPhyDisableModeVer = 3; - break; - } - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - tp->HwSuppTxNoCloseVer = 3; - break; - } - - if (tp->HwSuppTxNoCloseVer > 0 && tx_no_close_enable == 1) - tp->EnableTxNoClose = TRUE; - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_6: - tp->RequireLSOPatch = TRUE; - break; - } - - switch (tp->mcfg) { - case CFG_METHOD_2: - tp->sw_ram_code_ver = NIC_RAMCODE_VERSION_CFG_METHOD_2; - break; - case CFG_METHOD_3: - case CFG_METHOD_6: - tp->sw_ram_code_ver = NIC_RAMCODE_VERSION_CFG_METHOD_3; - break; - case CFG_METHOD_4: - tp->sw_ram_code_ver = NIC_RAMCODE_VERSION_CFG_METHOD_4; - break; - case CFG_METHOD_5: - case CFG_METHOD_7: - tp->sw_ram_code_ver = NIC_RAMCODE_VERSION_CFG_METHOD_5; - break; - } - - if (tp->HwIcVerUnknown) { - tp->NotWrRamCodeToMicroP = TRUE; - tp->NotWrMcuPatchCode = TRUE; - } - - switch (tp->mcfg) { - case CFG_METHOD_3: - case CFG_METHOD_6: - if ((rtl8125_mac_ocp_read(tp, 0xD442) & BIT_5) && - (mdio_direct_read_phy_ocp(tp, 0xD068) & BIT_1)) - tp->RequirePhyMdiSwapPatch = TRUE; - break; - } - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - tp->HwSuppMacMcuVer = 2; - break; - } - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - tp->MacMcuPageSize = RTL8125_MAC_MCU_PAGE_SIZE; - break; - } - - switch (tp->mcfg) { - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_7: - tp->HwSuppNumTxQueues = 2; - tp->HwSuppNumRxQueues = 4; - break; - default: - tp->HwSuppNumTxQueues = 1; - tp->HwSuppNumRxQueues = 1; - break; - } - - tp->num_tx_rings = 1; -#ifdef ENABLE_MULTIPLE_TX_QUEUE -#ifndef ENABLE_LIB_SUPPORT - tp->num_tx_rings = tp->HwSuppNumTxQueues; -#endif -#endif - - switch (tp->mcfg) { - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_7: - tp->HwSuppRssVer = 5; - tp->HwSuppIndirTblEntries = 128; - break; - } - - tp->num_rx_rings = 1; -#ifdef ENABLE_RSS_SUPPORT -#ifdef ENABLE_LIB_SUPPORT - if (tp->HwSuppRssVer > 0) - tp->EnableRss = 1; -#else - if (tp->HwSuppRssVer > 0) { - u8 rss_queue_num = netif_get_num_default_rss_queues(); - tp->num_rx_rings = (tp->HwSuppNumRxQueues > rss_queue_num)? - rss_queue_num : tp->HwSuppNumRxQueues; - - if (!(tp->num_rx_rings >= 2 && tp->irq_nvecs >= tp->num_rx_rings)) - tp->num_rx_rings = 1; - - if (tp->num_rx_rings >= 2) - tp->EnableRss = 1; - } -#endif -#endif - - rtl8125_setup_mqs_reg(tp); - - rtl8125_set_ring_size(tp, NUM_RX_DESC, NUM_TX_DESC); - - switch (tp->mcfg) { - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_7: - tp->HwSuppPtpVer = 1; - break; - } -#ifdef ENABLE_PTP_SUPPORT - if (tp->HwSuppPtpVer > 0) - tp->EnablePtp = 1; -#endif - - //init interrupt - switch (tp->mcfg) { - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_7: - tp->HwSuppIsrVer = 2; - break; - default: - tp->HwSuppIsrVer = 1; - break; - } - - tp->HwCurrIsrVer = tp->HwSuppIsrVer; - if (tp->HwSuppIsrVer == 2) { - if (!(tp->features & RTL_FEATURE_MSIX) || - tp->irq_nvecs < R8125_MIN_MSIX_VEC_8125B) - tp->HwCurrIsrVer = 1; - } - - if (tp->HwCurrIsrVer < 2 || tp->irq_nvecs < 19) - tp->num_tx_rings = 1; - - if (tp->HwCurrIsrVer == 2) { - int i; - - tp->intr_mask = ISRIMR_V2_LINKCHG | ISRIMR_TOK_Q0; - if (tp->num_tx_rings > 1) - tp->intr_mask |= ISRIMR_TOK_Q1; - - for (i = 0; i < tp->num_rx_rings; i++) - tp->intr_mask |= ISRIMR_V2_ROK_Q0 << i; - } else { - tp->intr_mask = LinkChg | RxDescUnavail | TxOK | RxOK | SWInt; - tp->timer_intr_mask = LinkChg | PCSTimeout; - -#ifdef ENABLE_DASH_SUPPORT - if (tp->DASH) { - if (HW_DASH_SUPPORT_TYPE_3(tp)) { - tp->timer_intr_mask |= ( ISRIMR_DASH_INTR_EN | ISRIMR_DASH_INTR_CMAC_RESET); - tp->intr_mask |= ( ISRIMR_DASH_INTR_EN | ISRIMR_DASH_INTR_CMAC_RESET); - } - } -#endif - } - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_6: - tp->HwSuppIntMitiVer = 3; - break; - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_7: - tp->HwSuppIntMitiVer = 4; - break; - } - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - tp->HwSuppExtendTallyCounterVer = 1; - break; - } - - timer_count_v2 = (timer_count / 0x100); - -#ifndef ENABLE_LIB_SUPPORT - switch (tp->mcfg) { - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_7: - if (tp->HwSuppIsrVer == 2) { - tp->RequireRduNonStopPatch = 1; - tp->EnableRss = 0; - } - break; - } -#endif - - tp->InitRxDescType = RX_DESC_RING_TYPE_1; - if (tp->EnableRss || tp->EnablePtp) - tp->InitRxDescType = RX_DESC_RING_TYPE_3; - - tp->RxDescLength = RX_DESC_LEN_TYPE_1; - if (tp->InitRxDescType == RX_DESC_RING_TYPE_3) - tp->RxDescLength = RX_DESC_LEN_TYPE_3; - - tp->rtl8125_rx_config = rtl_chip_info[tp->chipset].RCR_Cfg; - if (tp->InitRxDescType == RX_DESC_RING_TYPE_3) - tp->rtl8125_rx_config |= EnableRxDescV3; - - tp->NicCustLedValue = RTL_R16(tp, CustomLED); - - tp->wol_opts = rtl8125_get_hw_wol(tp); - tp->wol_enabled = (tp->wol_opts) ? WOL_ENABLED : WOL_DISABLED; - - if (tp->mcfg == CFG_METHOD_6 || tp->mcfg == CFG_METHOD_7) - rtl8125_link_option_giga((u8*)&autoneg_mode, (u32*)&speed_mode, (u8*)&duplex_mode, (u32*)&advertising_mode); - else - rtl8125_link_option((u8*)&autoneg_mode, (u32*)&speed_mode, (u8*)&duplex_mode, (u32*)&advertising_mode); - - tp->autoneg = autoneg_mode; - tp->speed = speed_mode; - tp->duplex = duplex_mode; - tp->advertising = advertising_mode; - tp->fcpause = rtl8125_fc_full; - - tp->max_jumbo_frame_size = rtl_chip_info[tp->chipset].jumbo_frame_sz; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0) - /* MTU range: 60 - hw-specific max */ - dev->min_mtu = ETH_MIN_MTU; - dev->max_mtu = tp->max_jumbo_frame_size; -#endif //LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0) - - if (tp->mcfg != CFG_METHOD_DEFAULT) { - struct ethtool_eee *eee = &tp->eee; - - eee->eee_enabled = eee_enable; - eee->supported = SUPPORTED_100baseT_Full | - SUPPORTED_1000baseT_Full; - switch (tp->mcfg) { - case CFG_METHOD_4: - case CFG_METHOD_5: - eee->supported |= SUPPORTED_2500baseX_Full; - break; - } - eee->advertised = mmd_eee_adv_to_ethtool_adv_t(MDIO_EEE_1000T | MDIO_EEE_100TX); - eee->tx_lpi_timer = dev->mtu + ETH_HLEN + 0x20; - } - - tp->ptp_master_mode = enable_ptp_master_mode; - -#ifdef ENABLE_RSS_SUPPORT - if (tp->EnableRss) - rtl8125_init_rss(tp); -#endif -} - -static void -rtl8125_release_board(struct pci_dev *pdev, - struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - void __iomem *ioaddr = tp->mmio_addr; - - rtl8125_set_bios_setting(dev); - rtl8125_rar_set(tp, tp->org_mac_addr); - tp->wol_enabled = WOL_DISABLED; - - if (!tp->DASH) - rtl8125_phy_power_down(dev); - -#ifdef ENABLE_DASH_SUPPORT - if (tp->DASH) - FreeAllocatedDashShareMemory(dev); -#endif - - if (tp->mapped_cmac_ioaddr != NULL) - iounmap(tp->mapped_cmac_ioaddr); - - iounmap(ioaddr); - pci_release_regions(pdev); - pci_clear_mwi(pdev); - pci_disable_device(pdev); - free_netdev(dev); -} - -static int -rtl8125_get_mac_address(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - int i; - u8 mac_addr[MAC_ADDR_LEN]; - - for (i = 0; i < MAC_ADDR_LEN; i++) - mac_addr[i] = RTL_R8(tp, MAC0 + i); - - if(tp->mcfg == CFG_METHOD_2 || - tp->mcfg == CFG_METHOD_3 || - tp->mcfg == CFG_METHOD_4 || - tp->mcfg == CFG_METHOD_5 || - tp->mcfg == CFG_METHOD_6 || - tp->mcfg == CFG_METHOD_7) { - *(u32*)&mac_addr[0] = RTL_R32(tp, BACKUP_ADDR0_8125); - *(u16*)&mac_addr[4] = RTL_R16(tp, BACKUP_ADDR1_8125); - } - - if (!is_valid_ether_addr(mac_addr)) { - netif_err(tp, probe, dev, "Invalid ether addr %pM\n", - mac_addr); - eth_hw_addr_random(dev); - ether_addr_copy(mac_addr, dev->dev_addr); - netif_info(tp, probe, dev, "Random ether addr %pM\n", - mac_addr); - tp->random_mac = 1; - } - - rtl8125_rar_set(tp, mac_addr); - - for (i = 0; i < MAC_ADDR_LEN; i++) { - dev->dev_addr[i] = RTL_R8(tp, MAC0 + i); - tp->org_mac_addr[i] = dev->dev_addr[i]; /* keep the original MAC address */ - } -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13) - memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); -#endif -// memcpy(dev->dev_addr, dev->dev_addr, dev->addr_len); - - return 0; -} - -/** - * rtl8125_set_mac_address - Change the Ethernet Address of the NIC - * @dev: network interface device structure - * @p: pointer to an address structure - * - * Return 0 on success, negative on failure - **/ -static int -rtl8125_set_mac_address(struct net_device *dev, - void *p) -{ - struct rtl8125_private *tp = netdev_priv(dev); - struct sockaddr *addr = p; - - if (!is_valid_ether_addr(addr->sa_data)) - return -EADDRNOTAVAIL; - - memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); - - rtl8125_rar_set(tp, dev->dev_addr); - - return 0; -} - -/****************************************************************************** - * rtl8125_rar_set - Puts an ethernet address into a receive address register. - * - * tp - The private data structure for driver - * addr - Address to put into receive address register - *****************************************************************************/ -void -rtl8125_rar_set(struct rtl8125_private *tp, - uint8_t *addr) -{ - uint32_t rar_low = 0; - uint32_t rar_high = 0; - - rar_low = ((uint32_t) addr[0] | - ((uint32_t) addr[1] << 8) | - ((uint32_t) addr[2] << 16) | - ((uint32_t) addr[3] << 24)); - - rar_high = ((uint32_t) addr[4] | - ((uint32_t) addr[5] << 8)); - - rtl8125_enable_cfg9346_write(tp); - RTL_W32(tp, MAC0, rar_low); - RTL_W32(tp, MAC4, rar_high); - - rtl8125_disable_cfg9346_write(tp); -} - -#ifdef ETHTOOL_OPS_COMPAT -static int ethtool_get_settings(struct net_device *dev, void *useraddr) -{ - struct ethtool_cmd cmd = { ETHTOOL_GSET }; - int err; - - if (!ethtool_ops->get_settings) - return -EOPNOTSUPP; - - err = ethtool_ops->get_settings(dev, &cmd); - if (err < 0) - return err; - - if (copy_to_user(useraddr, &cmd, sizeof(cmd))) - return -EFAULT; - return 0; -} - -static int ethtool_set_settings(struct net_device *dev, void *useraddr) -{ - struct ethtool_cmd cmd; - - if (!ethtool_ops->set_settings) - return -EOPNOTSUPP; - - if (copy_from_user(&cmd, useraddr, sizeof(cmd))) - return -EFAULT; - - return ethtool_ops->set_settings(dev, &cmd); -} - -static int ethtool_get_drvinfo(struct net_device *dev, void *useraddr) -{ - struct ethtool_drvinfo info; - struct ethtool_ops *ops = ethtool_ops; - - if (!ops->get_drvinfo) - return -EOPNOTSUPP; - - memset(&info, 0, sizeof(info)); - info.cmd = ETHTOOL_GDRVINFO; - ops->get_drvinfo(dev, &info); - - if (ops->self_test_count) - info.testinfo_len = ops->self_test_count(dev); - if (ops->get_stats_count) - info.n_stats = ops->get_stats_count(dev); - if (ops->get_regs_len) - info.regdump_len = ops->get_regs_len(dev); - if (ops->get_eeprom_len) - info.eedump_len = ops->get_eeprom_len(dev); - - if (copy_to_user(useraddr, &info, sizeof(info))) - return -EFAULT; - return 0; -} - -static int ethtool_get_regs(struct net_device *dev, char *useraddr) -{ - struct ethtool_regs regs; - struct ethtool_ops *ops = ethtool_ops; - void *regbuf; - int reglen, ret; - - if (!ops->get_regs || !ops->get_regs_len) - return -EOPNOTSUPP; - - if (copy_from_user(®s, useraddr, sizeof(regs))) - return -EFAULT; - - reglen = ops->get_regs_len(dev); - if (regs.len > reglen) - regs.len = reglen; - - regbuf = kmalloc(reglen, GFP_USER); - if (!regbuf) - return -ENOMEM; - - ops->get_regs(dev, ®s, regbuf); - - ret = -EFAULT; - if (copy_to_user(useraddr, ®s, sizeof(regs))) - goto out; - useraddr += offsetof(struct ethtool_regs, data); - if (copy_to_user(useraddr, regbuf, reglen)) - goto out; - ret = 0; - -out: - kfree(regbuf); - return ret; -} - -static int ethtool_get_wol(struct net_device *dev, char *useraddr) -{ - struct ethtool_wolinfo wol = { ETHTOOL_GWOL }; - - if (!ethtool_ops->get_wol) - return -EOPNOTSUPP; - - ethtool_ops->get_wol(dev, &wol); - - if (copy_to_user(useraddr, &wol, sizeof(wol))) - return -EFAULT; - return 0; -} - -static int ethtool_set_wol(struct net_device *dev, char *useraddr) -{ - struct ethtool_wolinfo wol; - - if (!ethtool_ops->set_wol) - return -EOPNOTSUPP; - - if (copy_from_user(&wol, useraddr, sizeof(wol))) - return -EFAULT; - - return ethtool_ops->set_wol(dev, &wol); -} - -static int ethtool_get_msglevel(struct net_device *dev, char *useraddr) -{ - struct ethtool_value edata = { ETHTOOL_GMSGLVL }; - - if (!ethtool_ops->get_msglevel) - return -EOPNOTSUPP; - - edata.data = ethtool_ops->get_msglevel(dev); - - if (copy_to_user(useraddr, &edata, sizeof(edata))) - return -EFAULT; - return 0; -} - -static int ethtool_set_msglevel(struct net_device *dev, char *useraddr) -{ - struct ethtool_value edata; - - if (!ethtool_ops->set_msglevel) - return -EOPNOTSUPP; - - if (copy_from_user(&edata, useraddr, sizeof(edata))) - return -EFAULT; - - ethtool_ops->set_msglevel(dev, edata.data); - return 0; -} - -static int ethtool_nway_reset(struct net_device *dev) -{ - if (!ethtool_ops->nway_reset) - return -EOPNOTSUPP; - - return ethtool_ops->nway_reset(dev); -} - -static int ethtool_get_link(struct net_device *dev, void *useraddr) -{ - struct ethtool_value edata = { ETHTOOL_GLINK }; - - if (!ethtool_ops->get_link) - return -EOPNOTSUPP; - - edata.data = ethtool_ops->get_link(dev); - - if (copy_to_user(useraddr, &edata, sizeof(edata))) - return -EFAULT; - return 0; -} - -static int ethtool_get_eeprom(struct net_device *dev, void *useraddr) -{ - struct ethtool_eeprom eeprom; - struct ethtool_ops *ops = ethtool_ops; - u8 *data; - int ret; - - if (!ops->get_eeprom || !ops->get_eeprom_len) - return -EOPNOTSUPP; - - if (copy_from_user(&eeprom, useraddr, sizeof(eeprom))) - return -EFAULT; - - /* Check for wrap and zero */ - if (eeprom.offset + eeprom.len <= eeprom.offset) - return -EINVAL; - - /* Check for exceeding total eeprom len */ - if (eeprom.offset + eeprom.len > ops->get_eeprom_len(dev)) - return -EINVAL; - - data = kmalloc(eeprom.len, GFP_USER); - if (!data) - return -ENOMEM; - - ret = -EFAULT; - if (copy_from_user(data, useraddr + sizeof(eeprom), eeprom.len)) - goto out; - - ret = ops->get_eeprom(dev, &eeprom, data); - if (ret) - goto out; - - ret = -EFAULT; - if (copy_to_user(useraddr, &eeprom, sizeof(eeprom))) - goto out; - if (copy_to_user(useraddr + sizeof(eeprom), data, eeprom.len)) - goto out; - ret = 0; - -out: - kfree(data); - return ret; -} - -static int ethtool_set_eeprom(struct net_device *dev, void *useraddr) -{ - struct ethtool_eeprom eeprom; - struct ethtool_ops *ops = ethtool_ops; - u8 *data; - int ret; - - if (!ops->set_eeprom || !ops->get_eeprom_len) - return -EOPNOTSUPP; - - if (copy_from_user(&eeprom, useraddr, sizeof(eeprom))) - return -EFAULT; - - /* Check for wrap and zero */ - if (eeprom.offset + eeprom.len <= eeprom.offset) - return -EINVAL; - - /* Check for exceeding total eeprom len */ - if (eeprom.offset + eeprom.len > ops->get_eeprom_len(dev)) - return -EINVAL; - - data = kmalloc(eeprom.len, GFP_USER); - if (!data) - return -ENOMEM; - - ret = -EFAULT; - if (copy_from_user(data, useraddr + sizeof(eeprom), eeprom.len)) - goto out; - - ret = ops->set_eeprom(dev, &eeprom, data); - if (ret) - goto out; - - if (copy_to_user(useraddr + sizeof(eeprom), data, eeprom.len)) - ret = -EFAULT; - -out: - kfree(data); - return ret; -} - -static int ethtool_get_coalesce(struct net_device *dev, void *useraddr) -{ - struct ethtool_coalesce coalesce = { ETHTOOL_GCOALESCE }; - - if (!ethtool_ops->get_coalesce) - return -EOPNOTSUPP; - - ethtool_ops->get_coalesce(dev, &coalesce); - - if (copy_to_user(useraddr, &coalesce, sizeof(coalesce))) - return -EFAULT; - return 0; -} - -static int ethtool_set_coalesce(struct net_device *dev, void *useraddr) -{ - struct ethtool_coalesce coalesce; - - if (!ethtool_ops->get_coalesce) - return -EOPNOTSUPP; - - if (copy_from_user(&coalesce, useraddr, sizeof(coalesce))) - return -EFAULT; - - return ethtool_ops->set_coalesce(dev, &coalesce); -} - -static int ethtool_get_ringparam(struct net_device *dev, void *useraddr) -{ - struct ethtool_ringparam ringparam = { ETHTOOL_GRINGPARAM }; - - if (!ethtool_ops->get_ringparam) - return -EOPNOTSUPP; - - ethtool_ops->get_ringparam(dev, &ringparam); - - if (copy_to_user(useraddr, &ringparam, sizeof(ringparam))) - return -EFAULT; - return 0; -} - -static int ethtool_set_ringparam(struct net_device *dev, void *useraddr) -{ - struct ethtool_ringparam ringparam; - - if (!ethtool_ops->get_ringparam) - return -EOPNOTSUPP; - - if (copy_from_user(&ringparam, useraddr, sizeof(ringparam))) - return -EFAULT; - - return ethtool_ops->set_ringparam(dev, &ringparam); -} - -static int ethtool_get_pauseparam(struct net_device *dev, void *useraddr) -{ - struct ethtool_pauseparam pauseparam = { ETHTOOL_GPAUSEPARAM }; - - if (!ethtool_ops->get_pauseparam) - return -EOPNOTSUPP; - - ethtool_ops->get_pauseparam(dev, &pauseparam); - - if (copy_to_user(useraddr, &pauseparam, sizeof(pauseparam))) - return -EFAULT; - return 0; -} - -static int ethtool_set_pauseparam(struct net_device *dev, void *useraddr) -{ - struct ethtool_pauseparam pauseparam; - - if (!ethtool_ops->get_pauseparam) - return -EOPNOTSUPP; - - if (copy_from_user(&pauseparam, useraddr, sizeof(pauseparam))) - return -EFAULT; - - return ethtool_ops->set_pauseparam(dev, &pauseparam); -} - -static int ethtool_get_rx_csum(struct net_device *dev, char *useraddr) -{ - struct ethtool_value edata = { ETHTOOL_GRXCSUM }; - - if (!ethtool_ops->get_rx_csum) - return -EOPNOTSUPP; - - edata.data = ethtool_ops->get_rx_csum(dev); - - if (copy_to_user(useraddr, &edata, sizeof(edata))) - return -EFAULT; - return 0; -} - -static int ethtool_set_rx_csum(struct net_device *dev, char *useraddr) -{ - struct ethtool_value edata; - - if (!ethtool_ops->set_rx_csum) - return -EOPNOTSUPP; - - if (copy_from_user(&edata, useraddr, sizeof(edata))) - return -EFAULT; - - ethtool_ops->set_rx_csum(dev, edata.data); - return 0; -} - -static int ethtool_get_tx_csum(struct net_device *dev, char *useraddr) -{ - struct ethtool_value edata = { ETHTOOL_GTXCSUM }; - - if (!ethtool_ops->get_tx_csum) - return -EOPNOTSUPP; - - edata.data = ethtool_ops->get_tx_csum(dev); - - if (copy_to_user(useraddr, &edata, sizeof(edata))) - return -EFAULT; - return 0; -} - -static int ethtool_set_tx_csum(struct net_device *dev, char *useraddr) -{ - struct ethtool_value edata; - - if (!ethtool_ops->set_tx_csum) - return -EOPNOTSUPP; - - if (copy_from_user(&edata, useraddr, sizeof(edata))) - return -EFAULT; - - return ethtool_ops->set_tx_csum(dev, edata.data); -} - -static int ethtool_get_sg(struct net_device *dev, char *useraddr) -{ - struct ethtool_value edata = { ETHTOOL_GSG }; - - if (!ethtool_ops->get_sg) - return -EOPNOTSUPP; - - edata.data = ethtool_ops->get_sg(dev); - - if (copy_to_user(useraddr, &edata, sizeof(edata))) - return -EFAULT; - return 0; -} - -static int ethtool_set_sg(struct net_device *dev, char *useraddr) -{ - struct ethtool_value edata; - - if (!ethtool_ops->set_sg) - return -EOPNOTSUPP; - - if (copy_from_user(&edata, useraddr, sizeof(edata))) - return -EFAULT; - - return ethtool_ops->set_sg(dev, edata.data); -} - -static int ethtool_get_tso(struct net_device *dev, char *useraddr) -{ - struct ethtool_value edata = { ETHTOOL_GTSO }; - - if (!ethtool_ops->get_tso) - return -EOPNOTSUPP; - - edata.data = ethtool_ops->get_tso(dev); - - if (copy_to_user(useraddr, &edata, sizeof(edata))) - return -EFAULT; - return 0; -} - -static int ethtool_set_tso(struct net_device *dev, char *useraddr) -{ - struct ethtool_value edata; - - if (!ethtool_ops->set_tso) - return -EOPNOTSUPP; - - if (copy_from_user(&edata, useraddr, sizeof(edata))) - return -EFAULT; - - return ethtool_ops->set_tso(dev, edata.data); -} - -static int ethtool_self_test(struct net_device *dev, char *useraddr) -{ - struct ethtool_test test; - struct ethtool_ops *ops = ethtool_ops; - u64 *data; - int ret; - - if (!ops->self_test || !ops->self_test_count) - return -EOPNOTSUPP; - - if (copy_from_user(&test, useraddr, sizeof(test))) - return -EFAULT; - - test.len = ops->self_test_count(dev); - data = kmalloc(test.len * sizeof(u64), GFP_USER); - if (!data) - return -ENOMEM; - - ops->self_test(dev, &test, data); - - ret = -EFAULT; - if (copy_to_user(useraddr, &test, sizeof(test))) - goto out; - useraddr += sizeof(test); - if (copy_to_user(useraddr, data, test.len * sizeof(u64))) - goto out; - ret = 0; - -out: - kfree(data); - return ret; -} - -static int ethtool_get_strings(struct net_device *dev, void *useraddr) -{ - struct ethtool_gstrings gstrings; - struct ethtool_ops *ops = ethtool_ops; - u8 *data; - int ret; - - if (!ops->get_strings) - return -EOPNOTSUPP; - - if (copy_from_user(&gstrings, useraddr, sizeof(gstrings))) - return -EFAULT; - - switch (gstrings.string_set) { - case ETH_SS_TEST: - if (!ops->self_test_count) - return -EOPNOTSUPP; - gstrings.len = ops->self_test_count(dev); - break; - case ETH_SS_STATS: - if (!ops->get_stats_count) - return -EOPNOTSUPP; - gstrings.len = ops->get_stats_count(dev); - break; - default: - return -EINVAL; - } - - data = kmalloc(gstrings.len * ETH_GSTRING_LEN, GFP_USER); - if (!data) - return -ENOMEM; - - ops->get_strings(dev, gstrings.string_set, data); - - ret = -EFAULT; - if (copy_to_user(useraddr, &gstrings, sizeof(gstrings))) - goto out; - useraddr += sizeof(gstrings); - if (copy_to_user(useraddr, data, gstrings.len * ETH_GSTRING_LEN)) - goto out; - ret = 0; - -out: - kfree(data); - return ret; -} - -static int ethtool_phys_id(struct net_device *dev, void *useraddr) -{ - struct ethtool_value id; - - if (!ethtool_ops->phys_id) - return -EOPNOTSUPP; - - if (copy_from_user(&id, useraddr, sizeof(id))) - return -EFAULT; - - return ethtool_ops->phys_id(dev, id.data); -} - -static int ethtool_get_stats(struct net_device *dev, void *useraddr) -{ - struct ethtool_stats stats; - struct ethtool_ops *ops = ethtool_ops; - u64 *data; - int ret; - - if (!ops->get_ethtool_stats || !ops->get_stats_count) - return -EOPNOTSUPP; - - if (copy_from_user(&stats, useraddr, sizeof(stats))) - return -EFAULT; - - stats.n_stats = ops->get_stats_count(dev); - data = kmalloc(stats.n_stats * sizeof(u64), GFP_USER); - if (!data) - return -ENOMEM; - - ops->get_ethtool_stats(dev, &stats, data); - - ret = -EFAULT; - if (copy_to_user(useraddr, &stats, sizeof(stats))) - goto out; - useraddr += sizeof(stats); - if (copy_to_user(useraddr, data, stats.n_stats * sizeof(u64))) - goto out; - ret = 0; - -out: - kfree(data); - return ret; -} - -static int ethtool_ioctl(struct ifreq *ifr) -{ - struct net_device *dev = __dev_get_by_name(ifr->ifr_name); - void *useraddr = (void *) ifr->ifr_data; - u32 ethcmd; - - /* - * XXX: This can be pushed down into the ethtool_* handlers that - * need it. Keep existing behaviour for the moment. - */ - if (!capable(CAP_NET_ADMIN)) - return -EPERM; - - if (!dev || !netif_device_present(dev)) - return -ENODEV; - - if (copy_from_user(ðcmd, useraddr, sizeof (ethcmd))) - return -EFAULT; - - switch (ethcmd) { - case ETHTOOL_GSET: - return ethtool_get_settings(dev, useraddr); - case ETHTOOL_SSET: - return ethtool_set_settings(dev, useraddr); - case ETHTOOL_GDRVINFO: - return ethtool_get_drvinfo(dev, useraddr); - case ETHTOOL_GREGS: - return ethtool_get_regs(dev, useraddr); - case ETHTOOL_GWOL: - return ethtool_get_wol(dev, useraddr); - case ETHTOOL_SWOL: - return ethtool_set_wol(dev, useraddr); - case ETHTOOL_GMSGLVL: - return ethtool_get_msglevel(dev, useraddr); - case ETHTOOL_SMSGLVL: - return ethtool_set_msglevel(dev, useraddr); - case ETHTOOL_NWAY_RST: - return ethtool_nway_reset(dev); - case ETHTOOL_GLINK: - return ethtool_get_link(dev, useraddr); - case ETHTOOL_GEEPROM: - return ethtool_get_eeprom(dev, useraddr); - case ETHTOOL_SEEPROM: - return ethtool_set_eeprom(dev, useraddr); - case ETHTOOL_GCOALESCE: - return ethtool_get_coalesce(dev, useraddr); - case ETHTOOL_SCOALESCE: - return ethtool_set_coalesce(dev, useraddr); - case ETHTOOL_GRINGPARAM: - return ethtool_get_ringparam(dev, useraddr); - case ETHTOOL_SRINGPARAM: - return ethtool_set_ringparam(dev, useraddr); - case ETHTOOL_GPAUSEPARAM: - return ethtool_get_pauseparam(dev, useraddr); - case ETHTOOL_SPAUSEPARAM: - return ethtool_set_pauseparam(dev, useraddr); - case ETHTOOL_GRXCSUM: - return ethtool_get_rx_csum(dev, useraddr); - case ETHTOOL_SRXCSUM: - return ethtool_set_rx_csum(dev, useraddr); - case ETHTOOL_GTXCSUM: - return ethtool_get_tx_csum(dev, useraddr); - case ETHTOOL_STXCSUM: - return ethtool_set_tx_csum(dev, useraddr); - case ETHTOOL_GSG: - return ethtool_get_sg(dev, useraddr); - case ETHTOOL_SSG: - return ethtool_set_sg(dev, useraddr); - case ETHTOOL_GTSO: - return ethtool_get_tso(dev, useraddr); - case ETHTOOL_STSO: - return ethtool_set_tso(dev, useraddr); - case ETHTOOL_TEST: - return ethtool_self_test(dev, useraddr); - case ETHTOOL_GSTRINGS: - return ethtool_get_strings(dev, useraddr); - case ETHTOOL_PHYS_ID: - return ethtool_phys_id(dev, useraddr); - case ETHTOOL_GSTATS: - return ethtool_get_stats(dev, useraddr); - default: - return -EOPNOTSUPP; - } - - return -EOPNOTSUPP; -} -#endif //ETHTOOL_OPS_COMPAT - -static int -rtl8125_do_ioctl(struct net_device *dev, - struct ifreq *ifr, - int cmd) -{ - struct rtl8125_private *tp = netdev_priv(dev); - struct mii_ioctl_data *data = if_mii(ifr); - int ret; - - ret = 0; - switch (cmd) { - case SIOCGMIIPHY: - data->phy_id = 32; /* Internal PHY */ - break; - - case SIOCGMIIREG: - rtl8125_mdio_write(tp, 0x1F, 0x0000); - data->val_out = rtl8125_mdio_read(tp, data->reg_num); - break; - - case SIOCSMIIREG: - if (!capable(CAP_NET_ADMIN)) - return -EPERM; - rtl8125_mdio_write(tp, 0x1F, 0x0000); - rtl8125_mdio_write(tp, data->reg_num, data->val_in); - break; - -#ifdef ETHTOOL_OPS_COMPAT - case SIOCETHTOOL: - ret = ethtool_ioctl(ifr); - break; -#endif - -#ifdef ENABLE_DASH_SUPPORT - case SIOCDEVPRIVATE_RTLDASH: - if (!netif_running(dev)) { - ret = -ENODEV; - break; - } - if (!capable(CAP_NET_ADMIN)) { - ret = -EPERM; - break; - } - - ret = rtl8125_dash_ioctl(dev, ifr); - break; -#endif - -#ifdef ENABLE_REALWOW_SUPPORT - case SIOCDEVPRIVATE_RTLREALWOW: - if (!netif_running(dev)) { - ret = -ENODEV; - break; - } - - ret = rtl8125_realwow_ioctl(dev, ifr); - break; -#endif - -#ifdef ENABLE_PTP_SUPPORT - case SIOCSHWTSTAMP: - case SIOCGHWTSTAMP: - if (tp->EnablePtp) - ret = rtl8125_ptp_ioctl(dev, ifr, cmd); - else - ret = -EOPNOTSUPP; - break; -#endif - case SIOCRTLTOOL: - ret = rtl8125_tool_ioctl(tp, ifr); - break; - - default: - ret = -EOPNOTSUPP; - break; - } - - return ret; -} - -static void -rtl8125_phy_power_up(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - if (rtl8125_is_in_phy_disable_mode(dev)) { - return; - } - - rtl8125_mdio_write(tp, 0x1F, 0x0000); - rtl8125_mdio_write(tp, MII_BMCR, BMCR_ANENABLE); - - //wait ups resume (phy state 3) - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - rtl8125_wait_phy_ups_resume(dev, 3); - break; - }; -} - -static void -rtl8125_phy_power_down(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - rtl8125_mdio_write(tp, 0x1F, 0x0000); - rtl8125_mdio_write(tp, MII_BMCR, BMCR_ANENABLE | BMCR_PDOWN); -} - -static int __devinit -rtl8125_init_board(struct pci_dev *pdev, - struct net_device **dev_out, - void __iomem **ioaddr_out) -{ - void __iomem *ioaddr; - struct net_device *dev; - struct rtl8125_private *tp; - int rc = -ENOMEM, i, pm_cap; - - assert(ioaddr_out != NULL); - - /* dev zeroed in alloc_etherdev */ - dev = alloc_etherdev_mq(sizeof (*tp), R8125_MAX_QUEUES); - if (dev == NULL) { -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - if (netif_msg_drv(&debug)) - dev_err(&pdev->dev, "unable to alloc new ethernet\n"); -#endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - goto err_out; - } - - SET_MODULE_OWNER(dev); - SET_NETDEV_DEV(dev, &pdev->dev); - tp = netdev_priv(dev); - tp->dev = dev; - tp->pci_dev = pdev; - tp->msg_enable = netif_msg_init(debug.msg_enable, R8125_MSG_DEFAULT); - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26) - if (!aspm) - pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1 | - PCIE_LINK_STATE_CLKPM); -#endif - - /* enable device (incl. PCI PM wakeup and hotplug setup) */ - rc = pci_enable_device(pdev); - if (rc < 0) { -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - if (netif_msg_probe(tp)) - dev_err(&pdev->dev, "enable failure\n"); -#endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - goto err_out_free_dev; - } - - if (pci_set_mwi(pdev) < 0) { -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - if (netif_msg_drv(&debug)) - dev_info(&pdev->dev, "Mem-Wr-Inval unavailable.\n"); -#endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - } - - /* save power state before pci_enable_device overwrites it */ - pm_cap = pci_find_capability(pdev, PCI_CAP_ID_PM); - if (pm_cap) { - u16 pwr_command; - - pci_read_config_word(pdev, pm_cap + PCI_PM_CTRL, &pwr_command); - } else { -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - if (netif_msg_probe(tp)) { - dev_err(&pdev->dev, "PowerManagement capability not found.\n"); - } -#else - printk("PowerManagement capability not found.\n"); -#endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - - } - - /* make sure PCI base addr 1 is MMIO */ - if (!(pci_resource_flags(pdev, 2) & IORESOURCE_MEM)) { -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - if (netif_msg_probe(tp)) - dev_err(&pdev->dev, "region #1 not an MMIO resource, aborting\n"); -#endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - rc = -ENODEV; - goto err_out_mwi; - } - /* check for weird/broken PCI region reporting */ - if (pci_resource_len(pdev, 2) < R8125_REGS_SIZE) { -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - if (netif_msg_probe(tp)) - dev_err(&pdev->dev, "Invalid PCI region size(s), aborting\n"); -#endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - rc = -ENODEV; - goto err_out_mwi; - } - - rc = pci_request_regions(pdev, MODULENAME); - if (rc < 0) { -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - if (netif_msg_probe(tp)) - dev_err(&pdev->dev, "could not request regions.\n"); -#endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - goto err_out_mwi; - } - - if ((sizeof(dma_addr_t) > 4) && - use_dac && - !pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) && - !pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64))) { - dev->features |= NETIF_F_HIGHDMA; - } else { - rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); - if (rc < 0) { -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - if (netif_msg_probe(tp)) - dev_err(&pdev->dev, "DMA configuration failed.\n"); -#endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - goto err_out_free_res; - } - } - - /* ioremap MMIO region */ - ioaddr = ioremap(pci_resource_start(pdev, 2), pci_resource_len(pdev, 2)); - if (ioaddr == NULL) { -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - if (netif_msg_probe(tp)) - dev_err(&pdev->dev, "cannot remap MMIO, aborting\n"); -#endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - rc = -EIO; - goto err_out_free_res; - } - - tp->mmio_addr = ioaddr; - - /* Identify chip attached to board */ - rtl8125_get_mac_version(tp); - - rtl8125_print_mac_version(tp); - - for (i = ARRAY_SIZE(rtl_chip_info) - 1; i >= 0; i--) { - if (tp->mcfg == rtl_chip_info[i].mcfg) - break; - } - - if (i < 0) { - /* Unknown chip: assume array element #0, original RTL-8125 */ -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - if (netif_msg_probe(tp)) - dev_printk(KERN_DEBUG, &pdev->dev, "unknown chip version, assuming %s\n", rtl_chip_info[0].name); -#else - printk("Realtek unknown chip version, assuming %s\n", rtl_chip_info[0].name); -#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) - i++; - } - - tp->chipset = i; - - *ioaddr_out = ioaddr; - *dev_out = dev; -out: - return rc; - -err_out_free_res: - pci_release_regions(pdev); -err_out_mwi: - pci_clear_mwi(pdev); - pci_disable_device(pdev); -err_out_free_dev: - free_netdev(dev); -err_out: - *ioaddr_out = NULL; - *dev_out = NULL; - goto out; -} - -static void -rtl8125_esd_checker(struct rtl8125_private *tp) -{ - struct net_device *dev = tp->dev; - struct pci_dev *pdev = tp->pci_dev; - u8 cmd; - u16 io_base_l; - u16 mem_base_l; - u16 mem_base_h; - u8 ilr; - u16 resv_0x1c_h; - u16 resv_0x1c_l; - u16 resv_0x20_l; - u16 resv_0x20_h; - u16 resv_0x24_l; - u16 resv_0x24_h; - u16 resv_0x2c_h; - u16 resv_0x2c_l; - u32 pci_sn_l; - u32 pci_sn_h; - - tp->esd_flag = 0; - - pci_read_config_byte(pdev, PCI_COMMAND, &cmd); - if (cmd != tp->pci_cfg_space.cmd) { - printk(KERN_ERR "%s: cmd = 0x%02x, should be 0x%02x \n.", dev->name, cmd, tp->pci_cfg_space.cmd); - pci_write_config_byte(pdev, PCI_COMMAND, tp->pci_cfg_space.cmd); - tp->esd_flag |= BIT_0; - - pci_read_config_byte(pdev, PCI_COMMAND, &cmd); - if (cmd == 0xff) { - printk(KERN_ERR "%s: pci link is down \n.", dev->name); - goto exit; - } - } - - pci_read_config_word(pdev, PCI_BASE_ADDRESS_0, &io_base_l); - if (io_base_l != tp->pci_cfg_space.io_base_l) { - printk(KERN_ERR "%s: io_base_l = 0x%04x, should be 0x%04x \n.", dev->name, io_base_l, tp->pci_cfg_space.io_base_l); - pci_write_config_word(pdev, PCI_BASE_ADDRESS_0, tp->pci_cfg_space.io_base_l); - tp->esd_flag |= BIT_1; - } - - pci_read_config_word(pdev, PCI_BASE_ADDRESS_2, &mem_base_l); - if (mem_base_l != tp->pci_cfg_space.mem_base_l) { - printk(KERN_ERR "%s: mem_base_l = 0x%04x, should be 0x%04x \n.", dev->name, mem_base_l, tp->pci_cfg_space.mem_base_l); - pci_write_config_word(pdev, PCI_BASE_ADDRESS_2, tp->pci_cfg_space.mem_base_l); - tp->esd_flag |= BIT_2; - } - - pci_read_config_word(pdev, PCI_BASE_ADDRESS_2 + 2, &mem_base_h); - if (mem_base_h!= tp->pci_cfg_space.mem_base_h) { - printk(KERN_ERR "%s: mem_base_h = 0x%04x, should be 0x%04x \n.", dev->name, mem_base_h, tp->pci_cfg_space.mem_base_h); - pci_write_config_word(pdev, PCI_BASE_ADDRESS_2 + 2, tp->pci_cfg_space.mem_base_h); - tp->esd_flag |= BIT_3; - } - - pci_read_config_word(pdev, PCI_BASE_ADDRESS_3, &resv_0x1c_l); - if (resv_0x1c_l != tp->pci_cfg_space.resv_0x1c_l) { - printk(KERN_ERR "%s: resv_0x1c_l = 0x%04x, should be 0x%04x \n.", dev->name, resv_0x1c_l, tp->pci_cfg_space.resv_0x1c_l); - pci_write_config_word(pdev, PCI_BASE_ADDRESS_3, tp->pci_cfg_space.resv_0x1c_l); - tp->esd_flag |= BIT_4; - } - - pci_read_config_word(pdev, PCI_BASE_ADDRESS_3 + 2, &resv_0x1c_h); - if (resv_0x1c_h != tp->pci_cfg_space.resv_0x1c_h) { - printk(KERN_ERR "%s: resv_0x1c_h = 0x%04x, should be 0x%04x \n.", dev->name, resv_0x1c_h, tp->pci_cfg_space.resv_0x1c_h); - pci_write_config_word(pdev, PCI_BASE_ADDRESS_3 + 2, tp->pci_cfg_space.resv_0x1c_h); - tp->esd_flag |= BIT_5; - } - - pci_read_config_word(pdev, PCI_BASE_ADDRESS_4, &resv_0x20_l); - if (resv_0x20_l != tp->pci_cfg_space.resv_0x20_l) { - printk(KERN_ERR "%s: resv_0x20_l = 0x%04x, should be 0x%04x \n.", dev->name, resv_0x20_l, tp->pci_cfg_space.resv_0x20_l); - pci_write_config_word(pdev, PCI_BASE_ADDRESS_4, tp->pci_cfg_space.resv_0x20_l); - tp->esd_flag |= BIT_6; - } - - pci_read_config_word(pdev, PCI_BASE_ADDRESS_4 + 2, &resv_0x20_h); - if (resv_0x20_h != tp->pci_cfg_space.resv_0x20_h) { - printk(KERN_ERR "%s: resv_0x20_h = 0x%04x, should be 0x%04x \n.", dev->name, resv_0x20_h, tp->pci_cfg_space.resv_0x20_h); - pci_write_config_word(pdev, PCI_BASE_ADDRESS_4 + 2, tp->pci_cfg_space.resv_0x20_h); - tp->esd_flag |= BIT_7; - } - - pci_read_config_word(pdev, PCI_BASE_ADDRESS_5, &resv_0x24_l); - if (resv_0x24_l != tp->pci_cfg_space.resv_0x24_l) { - printk(KERN_ERR "%s: resv_0x24_l = 0x%04x, should be 0x%04x \n.", dev->name, resv_0x24_l, tp->pci_cfg_space.resv_0x24_l); - pci_write_config_word(pdev, PCI_BASE_ADDRESS_5, tp->pci_cfg_space.resv_0x24_l); - tp->esd_flag |= BIT_8; - } - - pci_read_config_word(pdev, PCI_BASE_ADDRESS_5 + 2, &resv_0x24_h); - if (resv_0x24_h != tp->pci_cfg_space.resv_0x24_h) { - printk(KERN_ERR "%s: resv_0x24_h = 0x%04x, should be 0x%04x \n.", dev->name, resv_0x24_h, tp->pci_cfg_space.resv_0x24_h); - pci_write_config_word(pdev, PCI_BASE_ADDRESS_5 + 2, tp->pci_cfg_space.resv_0x24_h); - tp->esd_flag |= BIT_9; - } - - pci_read_config_byte(pdev, PCI_INTERRUPT_LINE, &ilr); - if (ilr != tp->pci_cfg_space.ilr) { - printk(KERN_ERR "%s: ilr = 0x%02x, should be 0x%02x \n.", dev->name, ilr, tp->pci_cfg_space.ilr); - pci_write_config_byte(pdev, PCI_INTERRUPT_LINE, tp->pci_cfg_space.ilr); - tp->esd_flag |= BIT_10; - } - - pci_read_config_word(pdev, PCI_SUBSYSTEM_VENDOR_ID, &resv_0x2c_l); - if (resv_0x2c_l != tp->pci_cfg_space.resv_0x2c_l) { - printk(KERN_ERR "%s: resv_0x2c_l = 0x%04x, should be 0x%04x \n.", dev->name, resv_0x2c_l, tp->pci_cfg_space.resv_0x2c_l); - pci_write_config_word(pdev, PCI_SUBSYSTEM_VENDOR_ID, tp->pci_cfg_space.resv_0x2c_l); - tp->esd_flag |= BIT_11; - } - - pci_read_config_word(pdev, PCI_SUBSYSTEM_VENDOR_ID + 2, &resv_0x2c_h); - if (resv_0x2c_h != tp->pci_cfg_space.resv_0x2c_h) { - printk(KERN_ERR "%s: resv_0x2c_h = 0x%04x, should be 0x%04x \n.", dev->name, resv_0x2c_h, tp->pci_cfg_space.resv_0x2c_h); - pci_write_config_word(pdev, PCI_SUBSYSTEM_VENDOR_ID + 2, tp->pci_cfg_space.resv_0x2c_h); - tp->esd_flag |= BIT_12; - } - - if (tp->HwPcieSNOffset > 0) { - pci_sn_l = rtl8125_csi_read(tp, tp->HwPcieSNOffset); - if (pci_sn_l != tp->pci_cfg_space.pci_sn_l) { - printk(KERN_ERR "%s: pci_sn_l = 0x%08x, should be 0x%08x \n.", dev->name, pci_sn_l, tp->pci_cfg_space.pci_sn_l); - rtl8125_csi_write(tp, tp->HwPcieSNOffset, tp->pci_cfg_space.pci_sn_l); - tp->esd_flag |= BIT_13; - } - - pci_sn_h = rtl8125_csi_read(tp, tp->HwPcieSNOffset + 4); - if (pci_sn_h != tp->pci_cfg_space.pci_sn_h) { - printk(KERN_ERR "%s: pci_sn_h = 0x%08x, should be 0x%08x \n.", dev->name, pci_sn_h, tp->pci_cfg_space.pci_sn_h); - rtl8125_csi_write(tp, tp->HwPcieSNOffset + 4, tp->pci_cfg_space.pci_sn_h); - tp->esd_flag |= BIT_14; - } - } - - if (tp->esd_flag != 0) { - printk(KERN_ERR "%s: esd_flag = 0x%04x\n.\n", dev->name, tp->esd_flag); - netif_tx_stop_all_queues(dev); - netif_carrier_off(dev); - rtl8125_hw_reset(dev); - rtl8125_tx_clear(tp); - rtl8125_rx_clear(tp); - rtl8125_init_ring(dev); - rtl8125_up(dev); - rtl8125_enable_hw_linkchg_interrupt(tp); - rtl8125_set_speed(dev, tp->autoneg, tp->speed, tp->duplex, tp->advertising); - tp->esd_flag = 0; - } -exit: - return; -} -/* -static void -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0) -rtl8125_esd_timer(unsigned long __opaque) -#else -rtl8125_esd_timer(struct timer_list *t) -#endif -{ -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0) - struct net_device *dev = (struct net_device *)__opaque; - struct rtl8125_private *tp = netdev_priv(dev); - struct timer_list *timer = &tp->esd_timer; -#else - struct rtl8125_private *tp = from_timer(tp, t, esd_timer); - //struct net_device *dev = tp->dev; - struct timer_list *timer = t; -#endif - rtl8125_esd_checker(tp); - - mod_timer(timer, jiffies + timeout); -} -*/ - -/* -static void -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0) -rtl8125_link_timer(unsigned long __opaque) -#else -rtl8125_link_timer(struct timer_list *t) -#endif -{ -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0) - struct net_device *dev = (struct net_device *)__opaque; - struct rtl8125_private *tp = netdev_priv(dev); - struct timer_list *timer = &tp->link_timer; -#else - struct rtl8125_private *tp = from_timer(tp, t, link_timer); - struct net_device *dev = tp->dev; - struct timer_list *timer = t; -#endif - rtl8125_check_link_status(dev); - - mod_timer(timer, jiffies + RTL8125_LINK_TIMEOUT); -} -*/ - -int -rtl8125_enable_msix(struct rtl8125_private *tp) -{ - int i, nvecs = 0; - struct msix_entry msix_ent[R8125_MAX_MSIX_VEC]; - //struct net_device *dev = tp->dev; - //const int len = sizeof(tp->irq_tbl[0].name); - - for (i = 0; i < R8125_MAX_MSIX_VEC; i++) { - msix_ent[i].entry = i; - msix_ent[i].vector = 0; - } - - nvecs = pci_enable_msix_range(tp->pci_dev, msix_ent, - tp->min_irq_nvecs, tp->max_irq_nvecs); - if (nvecs < 0) - goto out; - - for (i = 0; i < nvecs; i++) { - struct r8125_irq *irq = &tp->irq_tbl[i]; - irq->vector = msix_ent[i].vector; - //snprintf(irq->name, len, "%s-%d", dev->name, i); - //irq->handler = rtl8125_interrupt_msix; - } - -out: - return nvecs; -} - -void rtl8125_dump_msix_tbl(struct rtl8125_private *tp) -{ - void __iomem *ioaddr; - - /* ioremap MMIO region */ - ioaddr = ioremap(pci_resource_start(tp->pci_dev, 4), pci_resource_len(tp->pci_dev, 4)); - if (ioaddr) { - int i = 0; - for (i=0; iirq_nvecs; i++) { - printk("entry 0x%d %08X %08X %08X %08X \n", - i, - readl(ioaddr + 16 * i), - readl(ioaddr + 16 * i + 4), - readl(ioaddr + 16 * i + 8), - readl(ioaddr + 16 * i + 12)); - } - iounmap(ioaddr); - } -} - -/* Cfg9346_Unlock assumed. */ -static int rtl8125_try_msi(struct rtl8125_private *tp) -{ - struct pci_dev *pdev = tp->pci_dev; - unsigned msi = 0; - int nvecs = 1; - - tp->max_irq_nvecs = 1; - tp->min_irq_nvecs = 1; -#ifndef DISABLE_MULTI_MSIX_VECTOR - switch (tp->mcfg) { - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_7: - tp->max_irq_nvecs = R8125_MAX_MSIX_VEC_8125B; - tp->min_irq_nvecs = R8125_MIN_MSIX_VEC_8125B; - break; - } -#endif - -#if defined(RTL_USE_NEW_INTR_API) - if ((nvecs = pci_alloc_irq_vectors(pdev, tp->min_irq_nvecs, tp->max_irq_nvecs, PCI_IRQ_MSIX)) > 0) - msi |= RTL_FEATURE_MSIX; - else if ((nvecs = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_ALL_TYPES)) > 0 && - pci_dev_msi_enabled(pdev)) - msi |= RTL_FEATURE_MSI; -#elif LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13) - if ((nvecs = rtl8125_enable_msix(tp)) > 0) - msi |= RTL_FEATURE_MSIX; - else if (!pci_enable_msi(pdev)) - msi |= RTL_FEATURE_MSI; -#endif - if (!(msi & (RTL_FEATURE_MSI | RTL_FEATURE_MSIX))) - dev_info(&pdev->dev, "no MSI/MSI-X. Back to INTx.\n"); - - if (!(msi & RTL_FEATURE_MSIX) || nvecs < 1) - nvecs = 1; - - tp->irq_nvecs = nvecs; - - tp->features |= msi; - - return nvecs; -} - -static void rtl8125_disable_msi(struct pci_dev *pdev, struct rtl8125_private *tp) -{ -#if defined(RTL_USE_NEW_INTR_API) - if (tp->features & (RTL_FEATURE_MSI | RTL_FEATURE_MSIX)) - pci_free_irq_vectors(pdev); -#elif LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13) - if (tp->features & (RTL_FEATURE_MSIX)) - pci_disable_msix(pdev); - else if (tp->features & (RTL_FEATURE_MSI)) - pci_disable_msi(pdev); -#endif - tp->features &= ~(RTL_FEATURE_MSI | RTL_FEATURE_MSIX); -} - -static int rtl8125_get_irq(struct pci_dev *pdev) -{ -#if defined(RTL_USE_NEW_INTR_API) - return pci_irq_vector(pdev, 0); -#else - return pdev->irq; -#endif -} - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29) -static const struct net_device_ops rtl8125_netdev_ops = { - .ndo_open = rtl8125_open, - .ndo_stop = rtl8125_close, - .ndo_get_stats = rtl8125_get_stats, - .ndo_start_xmit = rtl8125_start_xmit, - .ndo_tx_timeout = rtl8125_tx_timeout, - .ndo_change_mtu = rtl8125_change_mtu, - .ndo_set_mac_address = rtl8125_set_mac_address, - .ndo_do_ioctl = rtl8125_do_ioctl, -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0) - .ndo_set_multicast_list = rtl8125_set_rx_mode, -#else - .ndo_set_rx_mode = rtl8125_set_rx_mode, -#endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0) -#ifdef CONFIG_R8125_VLAN - .ndo_vlan_rx_register = rtl8125_vlan_rx_register, -#endif -#else - .ndo_fix_features = rtl8125_fix_features, - .ndo_set_features = rtl8125_set_features, -#endif -#ifdef CONFIG_NET_POLL_CONTROLLER - .ndo_poll_controller = rtl8125_netpoll, -#endif -}; -#endif - - -#ifdef CONFIG_R8125_NAPI - -static int rtl8125_poll(napi_ptr napi, napi_budget budget) -{ - struct r8125_napi *r8125napi = RTL_GET_PRIV(napi, struct r8125_napi); - struct rtl8125_private *tp = r8125napi->priv; - RTL_GET_NETDEV(tp) - unsigned int work_to_do = RTL_NAPI_QUOTA(budget, dev); - unsigned int work_done = 0; - int i; - - for (i = 0; i < tp->num_tx_rings; i++) - rtl8125_tx_interrupt(&tp->tx_ring[i], budget); - - for (i = 0; i < tp->num_rx_rings; i++) - work_done += rtl8125_rx_interrupt(dev, tp, &tp->rx_ring[i], budget); - - RTL_NAPI_QUOTA_UPDATE(dev, work_done, budget); - - if (work_done < work_to_do) { -#ifdef ENABLE_DASH_SUPPORT - if (tp->DASH) - HandleDashInterrupt(tp->dev); -#endif - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0) - if (RTL_NETIF_RX_COMPLETE(dev, napi, work_done) == FALSE) return RTL_NAPI_RETURN_VALUE; -#else - RTL_NETIF_RX_COMPLETE(dev, napi, work_done); -#endif - /* - * 20040426: the barrier is not strictly required but the - * behavior of the irq handler could be less predictable - * without it. Btw, the lack of flush for the posted pci - * write is safe - FR - */ - smp_wmb(); - - rtl8125_switch_to_timer_interrupt(tp); - } - - return RTL_NAPI_RETURN_VALUE; -} - -#if 0 -static int rtl8125_poll_msix_ring(napi_ptr napi, napi_budget budget) -{ - struct r8125_napi *r8125napi = RTL_GET_PRIV(napi, struct r8125_napi); - struct rtl8125_private *tp = r8125napi->priv; - RTL_GET_NETDEV(tp) - unsigned int work_to_do = RTL_NAPI_QUOTA(budget, dev); - unsigned int work_done = 0; - const int message_id = r8125napi->index; - - rtl8125_tx_interrupt_with_vector(tp, message_id, budget); - - work_done += rtl8125_rx_interrupt(dev, tp, &tp->rx_ring[message_id], budget); - - RTL_NAPI_QUOTA_UPDATE(dev, work_done, budget); - - if (work_done < work_to_do) { -#ifdef ENABLE_DASH_SUPPORT - if (tp->DASH && message_id == 0) - HandleDashInterrupt(tp->dev); -#endif - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0) - if (RTL_NETIF_RX_COMPLETE(dev, napi, work_done) == FALSE) return RTL_NAPI_RETURN_VALUE; -#else - RTL_NETIF_RX_COMPLETE(dev, napi, work_done); -#endif - /* - * 20040426: the barrier is not strictly required but the - * behavior of the irq handler could be less predictable - * without it. Btw, the lack of flush for the posted pci - * write is safe - FR - */ - smp_wmb(); - - rtl8125_enable_hw_interrupt_v2(tp, message_id); - } - - return RTL_NAPI_RETURN_VALUE; -} -#endif - -static int rtl8125_poll_msix_tx(napi_ptr napi, napi_budget budget) -{ - struct r8125_napi *r8125napi = RTL_GET_PRIV(napi, struct r8125_napi); - struct rtl8125_private *tp = r8125napi->priv; - RTL_GET_NETDEV(tp) - unsigned int work_to_do = RTL_NAPI_QUOTA(budget, dev); - unsigned int work_done = 0; - const int message_id = r8125napi->index; - - //suppress unused variable - (void)(dev); - - rtl8125_tx_interrupt_with_vector(tp, message_id, budget); - - RTL_NAPI_QUOTA_UPDATE(dev, work_done, budget); - - if (work_done < work_to_do) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0) - if (RTL_NETIF_RX_COMPLETE(dev, napi, work_done) == FALSE) return RTL_NAPI_RETURN_VALUE; -#else - RTL_NETIF_RX_COMPLETE(dev, napi, work_done); -#endif - /* - * 20040426: the barrier is not strictly required but the - * behavior of the irq handler could be less predictable - * without it. Btw, the lack of flush for the posted pci - * write is safe - FR - */ - smp_wmb(); - - rtl8125_enable_hw_interrupt_v2(tp, message_id); - } - - return RTL_NAPI_RETURN_VALUE; -} - -static int rtl8125_poll_msix_other(napi_ptr napi, napi_budget budget) -{ - struct r8125_napi *r8125napi = RTL_GET_PRIV(napi, struct r8125_napi); - struct rtl8125_private *tp = r8125napi->priv; - RTL_GET_NETDEV(tp) - unsigned int work_to_do = RTL_NAPI_QUOTA(budget, dev); - const int message_id = r8125napi->index; - - //suppress unused variable - (void)(dev); - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0) - RTL_NETIF_RX_COMPLETE(dev, napi, work_to_do); -#else - RTL_NETIF_RX_COMPLETE(dev, napi, work_to_do); -#endif - - rtl8125_enable_hw_interrupt_v2(tp, message_id); - - return 1; -} - -static int rtl8125_poll_msix_rx(napi_ptr napi, napi_budget budget) -{ - struct r8125_napi *r8125napi = RTL_GET_PRIV(napi, struct r8125_napi); - struct rtl8125_private *tp = r8125napi->priv; - RTL_GET_NETDEV(tp) - unsigned int work_to_do = RTL_NAPI_QUOTA(budget, dev); - unsigned int work_done = 0; - const int message_id = r8125napi->index; - - work_done += rtl8125_rx_interrupt(dev, tp, &tp->rx_ring[message_id], budget); - - RTL_NAPI_QUOTA_UPDATE(dev, work_done, budget); - - if (work_done < work_to_do) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0) - if (RTL_NETIF_RX_COMPLETE(dev, napi, work_done) == FALSE) return RTL_NAPI_RETURN_VALUE; -#else - RTL_NETIF_RX_COMPLETE(dev, napi, work_done); -#endif - /* - * 20040426: the barrier is not strictly required but the - * behavior of the irq handler could be less predictable - * without it. Btw, the lack of flush for the posted pci - * write is safe - FR - */ - smp_wmb(); - - rtl8125_enable_hw_interrupt_v2(tp, message_id); - } - - return RTL_NAPI_RETURN_VALUE; -} - -static void rtl8125_enable_napi(struct rtl8125_private *tp) -{ -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - int i; - - for (i = 0; i < tp->irq_nvecs; i++) - RTL_NAPI_ENABLE(tp->dev, &tp->r8125napi[i].napi); -#endif -} - -static void rtl8125_disable_napi(struct rtl8125_private *tp) -{ -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - int i; - - for (i = 0; i < tp->irq_nvecs; i++) - RTL_NAPI_DISABLE(tp->dev, &tp->r8125napi[i].napi); -#endif -} - -static void rtl8125_del_napi(struct rtl8125_private *tp) -{ -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - int i; - - for (i = 0; i < tp->irq_nvecs; i++) - RTL_NAPI_DEL((&tp->r8125napi[i])); -#endif -} -#endif //CONFIG_R8125_NAPI - -static void rtl8125_init_napi(struct rtl8125_private *tp) -{ - int i; - - for (i=0; iirq_nvecs; i++) { - struct r8125_napi *r8125napi = &tp->r8125napi[i]; -#ifdef CONFIG_R8125_NAPI - int (*poll)(struct napi_struct *, int); - - if (tp->features & RTL_FEATURE_MSIX && - tp->HwCurrIsrVer == 2) { - if (i < R8125_MAX_RX_QUEUES_VEC_V3) - poll = rtl8125_poll_msix_rx; - else if (i == 16 || i == 18) - poll = rtl8125_poll_msix_tx; - else - poll = rtl8125_poll_msix_other; - } else { - poll = rtl8125_poll; - } - - RTL_NAPI_CONFIG(tp->dev, r8125napi, poll, R8125_NAPI_WEIGHT); -#endif - - r8125napi->priv = tp; - r8125napi->index = i; - } -} - -static int -rtl8125_set_real_num_queue(struct rtl8125_private *tp) -{ - int retval = 0; - - retval = netif_set_real_num_tx_queues(tp->dev, tp->num_tx_rings); - if (retval < 0) - goto exit; - - retval = netif_set_real_num_rx_queues(tp->dev, tp->num_rx_rings); - if (retval < 0) - goto exit; - -exit: - return retval; -} - -static int __devinit -rtl8125_init_one(struct pci_dev *pdev, - const struct pci_device_id *ent) -{ - struct net_device *dev = NULL; - struct rtl8125_private *tp; - void __iomem *ioaddr = NULL; - static int board_idx = -1; - - int rc; - - assert(pdev != NULL); - assert(ent != NULL); - - board_idx++; - - if (netif_msg_drv(&debug)) - printk(KERN_INFO "%s 2.5Gigabit Ethernet driver %s loaded\n", - MODULENAME, RTL8125_VERSION); - - rc = rtl8125_init_board(pdev, &dev, &ioaddr); - if (rc) - goto out; - - tp = netdev_priv(dev); - assert(ioaddr != NULL); - - tp->set_speed = rtl8125_set_speed_xmii; - tp->get_settings = rtl8125_gset_xmii; - tp->phy_reset_enable = rtl8125_xmii_reset_enable; - tp->phy_reset_pending = rtl8125_xmii_reset_pending; - tp->link_ok = rtl8125_xmii_link_ok; - - rc = rtl8125_try_msi(tp); - if (rc < 0) { - dev_err(&pdev->dev, "Can't allocate interrupt\n"); - goto err_out_1; - } -#ifdef ENABLE_PTP_SUPPORT - spin_lock_init(&tp->lock); -#endif - rtl8125_init_software_variable(dev); - - RTL_NET_DEVICE_OPS(rtl8125_netdev_ops); - -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22) - SET_ETHTOOL_OPS(dev, &rtl8125_ethtool_ops); -#endif - - dev->watchdog_timeo = RTL8125_TX_TIMEOUT; - dev->irq = rtl8125_get_irq(pdev); - dev->base_addr = (unsigned long) ioaddr; - - rtl8125_init_napi(tp); - -#ifdef CONFIG_R8125_VLAN - if (tp->mcfg != CFG_METHOD_DEFAULT) { - dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) - dev->vlan_rx_kill_vid = rtl8125_vlan_rx_kill_vid; -#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) - } -#endif - - /* There has been a number of reports that using SG/TSO results in - * tx timeouts. However for a lot of people SG/TSO works fine. - * Therefore disable both features by default, but allow users to - * enable them. Use at own risk! - */ - tp->cp_cmd |= RTL_R16(tp, CPlusCmd); - if (tp->mcfg != CFG_METHOD_DEFAULT) { - dev->features |= NETIF_F_IP_CSUM; -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0) - tp->cp_cmd |= RxChkSum; -#else - dev->features |= NETIF_F_RXCSUM; - dev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | - NETIF_F_RXCSUM | NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; - dev->vlan_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | - NETIF_F_HIGHDMA; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0) - dev->priv_flags |= IFF_LIVE_ADDR_CHANGE; -#endif //LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0) - dev->hw_features |= NETIF_F_RXALL; - dev->hw_features |= NETIF_F_RXFCS; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22) - dev->hw_features |= NETIF_F_IPV6_CSUM | NETIF_F_TSO6; - dev->features |= NETIF_F_IPV6_CSUM; - netif_set_gso_max_size(dev, LSO_64K); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0) - dev->gso_max_segs = NIC_MAX_PHYS_BUF_COUNT_LSO2; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) - dev->gso_min_segs = NIC_MIN_PHYS_BUF_COUNT; -#endif //LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) -#endif //LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0) - -#endif //LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22) -#endif //LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0) - -#ifdef ENABLE_RSS_SUPPORT - if (tp->EnableRss) { - dev->hw_features |= NETIF_F_RXHASH; - dev->features |= NETIF_F_RXHASH; - } -#endif - } - -#ifdef ENABLE_DASH_SUPPORT - if (tp->DASH) - AllocateDashShareMemory(dev); -#endif - -#ifdef ENABLE_LIB_SUPPORT - ATOMIC_INIT_NOTIFIER_HEAD(&tp->lib_nh); -#endif - rtl8125_init_all_schedule_work(tp); - - rc = rtl8125_set_real_num_queue(tp); - if (rc < 0) - goto err_out; - - rtl8125_exit_oob(dev); - - rtl8125_powerup_pll(dev); - - rtl8125_hw_init(dev); - - rtl8125_hw_reset(dev); - - /* Get production from EEPROM */ - rtl8125_eeprom_type(tp); - - if (tp->eeprom_type == EEPROM_TYPE_93C46 || tp->eeprom_type == EEPROM_TYPE_93C56) - rtl8125_set_eeprom_sel_low(tp); - - rtl8125_get_mac_address(dev); - - tp->fw_name = rtl_chip_fw_infos[tp->mcfg].fw_name; - - tp->tally_vaddr = dma_alloc_coherent(&pdev->dev, sizeof(*tp->tally_vaddr), - &tp->tally_paddr, GFP_KERNEL); - if (!tp->tally_vaddr) { - rc = -ENOMEM; - goto err_out; - } - - rtl8125_tally_counter_clear(tp); - - pci_set_drvdata(pdev, dev); - - rc = register_netdev(dev); - if (rc) - goto err_out; - - printk(KERN_INFO "%s: This product is covered by one or more of the following patents: US6,570,884, US6,115,776, and US6,327,625.\n", MODULENAME); - - rtl8125_disable_rxdvgate(dev); - - device_set_wakeup_enable(&pdev->dev, tp->wol_enabled); - - netif_carrier_off(dev); - - printk("%s", GPL_CLAIM); - -out: - return rc; - -err_out: - if (tp->tally_vaddr != NULL) { - dma_free_coherent(&pdev->dev, sizeof(*tp->tally_vaddr), tp->tally_vaddr, - tp->tally_paddr); - - tp->tally_vaddr = NULL; - } -#ifdef CONFIG_R8125_NAPI - rtl8125_del_napi(tp); -#endif - rtl8125_disable_msi(pdev, tp); - -err_out_1: - rtl8125_release_board(pdev, dev); - - goto out; -} - -static void __devexit -rtl8125_remove_one(struct pci_dev *pdev) -{ - struct net_device *dev = pci_get_drvdata(pdev); - struct rtl8125_private *tp = netdev_priv(dev); - - assert(dev != NULL); - assert(tp != NULL); - - set_bit(R8125_FLAG_DOWN, tp->task_flags); - - rtl8125_cancel_all_schedule_work(tp); - -#ifdef CONFIG_R8125_NAPI - rtl8125_del_napi(tp); -#endif - if (tp->DASH) - rtl8125_driver_stop(tp); - - unregister_netdev(dev); - rtl8125_disable_msi(pdev, tp); -#ifdef ENABLE_R8125_PROCFS - rtl8125_proc_remove(dev); -#endif - if (tp->tally_vaddr != NULL) { - dma_free_coherent(&pdev->dev, sizeof(*tp->tally_vaddr), tp->tally_vaddr, tp->tally_paddr); - tp->tally_vaddr = NULL; - } - - rtl8125_release_board(pdev, dev); - -#ifdef ENABLE_USE_FIRMWARE_FILE - rtl8125_release_firmware(tp); -#endif - - pci_set_drvdata(pdev, NULL); -} - -static void -rtl8125_set_rxbufsize(struct rtl8125_private *tp, - struct net_device *dev) -{ - unsigned int mtu = dev->mtu; - - tp->rx_buf_sz = (mtu > ETH_DATA_LEN) ? mtu + ETH_HLEN + 8 + 1 : RX_BUF_SIZE; -} - -static void rtl8125_free_irq(struct rtl8125_private *tp) -{ - int i; - - for (i=0; iirq_nvecs; i++) { - struct r8125_irq *irq = &tp->irq_tbl[i]; - struct r8125_napi *r8125napi = &tp->r8125napi[i]; - - if (irq->requested) { - irq->requested = 0; -#if defined(RTL_USE_NEW_INTR_API) - pci_free_irq(tp->pci_dev, i, r8125napi); -#else - free_irq(irq->vector, r8125napi); -#endif - } - } -} - -static int rtl8125_alloc_irq(struct rtl8125_private *tp) -{ - struct net_device *dev = tp->dev; - int rc = 0; - struct r8125_irq *irq; - struct r8125_napi *r8125napi; - int i = 0; - const int len = sizeof(tp->irq_tbl[0].name); - -#if defined(RTL_USE_NEW_INTR_API) - for (i=0; iirq_nvecs; i++) { - irq = &tp->irq_tbl[i]; - if (tp->features & RTL_FEATURE_MSIX && - tp->HwCurrIsrVer == 2) - irq->handler = rtl8125_interrupt_msix; - else - irq->handler = rtl8125_interrupt; - - r8125napi = &tp->r8125napi[i]; - snprintf(irq->name, len, "%s-%d", dev->name, i); - rc = pci_request_irq(tp->pci_dev, i, irq->handler, NULL, r8125napi, - irq->name); - if (rc) - break; - - irq->vector = pci_irq_vector(tp->pci_dev, i); - irq->requested = 1; - } -#else - unsigned long irq_flags = 0; -#ifdef ENABLE_LIB_SUPPORT - irq_flags |= IRQF_NO_SUSPEND; -#endif - if (tp->features & RTL_FEATURE_MSIX && - tp->HwCurrIsrVer == 2) { - for (i=0; iirq_nvecs; i++) { - irq = &tp->irq_tbl[i]; - irq->handler = rtl8125_interrupt_msix; - r8125napi = &tp->r8125napi[i]; - snprintf(irq->name, len, "%s-%d", dev->name, i); - rc = request_irq(irq->vector, irq->handler, irq_flags, irq->name, r8125napi); - - if (rc) - break; - - irq->requested = 1; - } - } else { - irq = &tp->irq_tbl[0]; - irq->handler = rtl8125_interrupt; - r8125napi = &tp->r8125napi[0]; - snprintf(irq->name, len, "%s-0", dev->name); - if (!(tp->features & RTL_FEATURE_MSIX)) - irq->vector = dev->irq; - irq_flags |= (tp->features & (RTL_FEATURE_MSI | RTL_FEATURE_MSIX)) ? 0 : SA_SHIRQ; - rc = request_irq(irq->vector, irq->handler, irq_flags, irq->name, r8125napi); - - if (rc == 0) - irq->requested = 1; - } -#endif - if (rc) - rtl8125_free_irq(tp); - - return rc; -} - -static int rtl8125_alloc_tx_desc(struct rtl8125_private *tp) -{ - struct rtl8125_tx_ring *ring; - struct pci_dev *pdev = tp->pci_dev; - int i; - - for (i = 0; i < tp->num_tx_rings; i++) { - ring = &tp->tx_ring[i]; - ring->TxDescArray = dma_alloc_coherent(&pdev->dev, - (ring->num_tx_desc * sizeof(struct TxDesc)), - &ring->TxPhyAddr, - GFP_KERNEL); - - if (!ring->TxDescArray) - return -1; - } - - return 0; -} - -static int rtl8125_alloc_rx_desc(struct rtl8125_private *tp) -{ - struct rtl8125_rx_ring *ring; - struct pci_dev *pdev = tp->pci_dev; - int i; - - for (i = 0; i < tp->num_rx_rings; i++) { - ring = &tp->rx_ring[i]; - ring->RxDescArray = dma_alloc_coherent(&pdev->dev, - (ring->num_rx_desc * tp->RxDescLength), - &ring->RxPhyAddr, - GFP_KERNEL); - - if (!ring->RxDescArray) - return -1; - } - - return 0; -} - -static int rtl8125_alloc_patch_mem(struct rtl8125_private *tp) -{ - struct pci_dev *pdev = tp->pci_dev; - - if (tp->RequireRduNonStopPatch) { - tp->ShortPacketEmptyBuffer = dma_alloc_coherent(&pdev->dev, - SHORT_PACKET_PADDING_BUF_SIZE, - &tp->ShortPacketEmptyBufferPhy, - GFP_KERNEL); - if (!tp->ShortPacketEmptyBuffer) - return -1; - - memset(tp->ShortPacketEmptyBuffer, 0x0, SHORT_PACKET_PADDING_BUF_SIZE); - } - - return 0; -} - -static void rtl8125_free_tx_desc(struct rtl8125_private *tp) -{ - struct rtl8125_tx_ring *ring; - struct pci_dev *pdev = tp->pci_dev; - int i; - - for (i = 0; i < tp->num_tx_rings; i++) { - ring = &tp->tx_ring[i]; - if (ring->TxDescArray) { - dma_free_coherent(&pdev->dev, - (ring->num_tx_desc * sizeof(struct TxDesc)), - ring->TxDescArray, - ring->TxPhyAddr); - ring->TxDescArray = NULL; - } - } -} - -static void rtl8125_free_rx_desc(struct rtl8125_private *tp) -{ - struct rtl8125_rx_ring *ring; - struct pci_dev *pdev = tp->pci_dev; - int i; - - for (i = 0; i < tp->num_rx_rings; i++) { - ring = &tp->rx_ring[i]; - if (ring->RxDescArray) { - dma_free_coherent(&pdev->dev, - (ring->num_rx_desc * tp->RxDescLength), - ring->RxDescArray, - ring->RxPhyAddr); - ring->RxDescArray = NULL; - } - } -} - -static void rtl8125_free_patch_mem(struct rtl8125_private *tp) -{ - struct pci_dev *pdev = tp->pci_dev; - - if (tp->ShortPacketEmptyBuffer) { - dma_free_coherent(&pdev->dev, - SHORT_PACKET_PADDING_BUF_SIZE, - tp->ShortPacketEmptyBuffer, - tp->ShortPacketEmptyBufferPhy); - tp->ShortPacketEmptyBuffer = NULL; - } -} - -static void rtl8125_free_alloc_resources(struct rtl8125_private *tp) -{ - rtl8125_free_rx_desc(tp); - - rtl8125_free_tx_desc(tp); - - rtl8125_free_patch_mem(tp); -} - -#ifdef ENABLE_USE_FIRMWARE_FILE -static void rtl8125_request_firmware(struct rtl8125_private *tp) -{ - struct rtl8125_fw *rtl_fw; - - /* firmware loaded already or no firmware available */ - if (tp->rtl_fw || !tp->fw_name) - return; - - rtl_fw = kzalloc(sizeof(*rtl_fw), GFP_KERNEL); - if (!rtl_fw) - return; - - rtl_fw->phy_write = rtl8125_mdio_write; - rtl_fw->phy_read = rtl8125_mdio_read; - rtl_fw->mac_mcu_write = mac_mcu_write; - rtl_fw->mac_mcu_read = mac_mcu_read; - rtl_fw->fw_name = tp->fw_name; - rtl_fw->dev = tp_to_dev(tp); - - if (rtl8125_fw_request_firmware(rtl_fw)) - kfree(rtl_fw); - else - tp->rtl_fw = rtl_fw; -} -#endif - -int rtl8125_open(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - int retval; - - retval = -ENOMEM; - -#ifdef ENABLE_R8125_PROCFS - rtl8125_proc_init(dev); -#endif - rtl8125_set_rxbufsize(tp, dev); - /* - * Rx and Tx descriptors needs 256 bytes alignment. - * pci_alloc_consistent provides more. - */ - if (rtl8125_alloc_tx_desc(tp) < 0 || rtl8125_alloc_rx_desc(tp) < 0) - goto err_free_all_allocated_mem; - - retval = rtl8125_init_ring(dev); - if (retval < 0) - goto err_free_all_allocated_mem; - - retval = rtl8125_alloc_patch_mem(tp); - if (retval < 0) - goto err_free_all_allocated_mem; - - retval = rtl8125_alloc_irq(tp); - if (retval < 0) - goto err_free_all_allocated_mem; - - if (netif_msg_probe(tp)) { - printk(KERN_INFO "%s: 0x%lx, " - "%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x, " - "IRQ %d\n", - dev->name, - dev->base_addr, - dev->dev_addr[0], dev->dev_addr[1], - dev->dev_addr[2], dev->dev_addr[3], - dev->dev_addr[4], dev->dev_addr[5], dev->irq); - } - -#ifdef ENABLE_USE_FIRMWARE_FILE - rtl8125_request_firmware(tp); -#endif - pci_set_master(tp->pci_dev); - -#ifdef CONFIG_R8125_NAPI - rtl8125_enable_napi(tp); -#endif - - rtl8125_exit_oob(dev); - - rtl8125_up(dev); - -#ifdef ENABLE_PTP_SUPPORT - if (tp->EnablePtp) - rtl8125_ptp_init(tp); -#endif - clear_bit(R8125_FLAG_DOWN, tp->task_flags); - - if (tp->resume_not_chg_speed) - rtl8125_check_link_status(dev); - else - rtl8125_set_speed(dev, tp->autoneg, tp->speed, tp->duplex, tp->advertising); - - if (tp->esd_flag == 0) { - //rtl8125_request_esd_timer(dev); - - rtl8125_schedule_esd_work(tp); - } - - //rtl8125_request_link_timer(dev); - - rtl8125_enable_hw_linkchg_interrupt(tp); - -out: - - return retval; - -err_free_all_allocated_mem: - rtl8125_free_alloc_resources(tp); - - goto out; -} - -static void -set_offset70F(struct rtl8125_private *tp, u8 setting) -{ - u32 csi_tmp; - u32 temp = (u32)setting; - temp = temp << 24; - /*set PCI configuration space offset 0x70F to setting*/ - /*When the register offset of PCI configuration space larger than 0xff, use CSI to access it.*/ - - csi_tmp = rtl8125_csi_read(tp, 0x70c) & 0x00ffffff; - rtl8125_csi_write(tp, 0x70c, csi_tmp | temp); -} - -static void -set_offset79(struct rtl8125_private *tp, u8 setting) -{ - //Set PCI configuration space offset 0x79 to setting - - struct pci_dev *pdev = tp->pci_dev; - u8 device_control; - - if (hwoptimize & HW_PATCH_SOC_LAN) return; - - pci_read_config_byte(pdev, 0x79, &device_control); - device_control &= ~0x70; - device_control |= setting; - pci_write_config_byte(pdev, 0x79, device_control); -} - -void -rtl8125_hw_set_rx_packet_filter(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - u32 mc_filter[2]; /* Multicast hash filter */ - int rx_mode; - u32 tmp = 0; - - if (dev->flags & IFF_PROMISC) { - /* Unconditionally log net taps. */ - if (netif_msg_link(tp)) - printk(KERN_NOTICE "%s: Promiscuous mode enabled.\n", - dev->name); - - rx_mode = - AcceptBroadcast | AcceptMulticast | AcceptMyPhys | - AcceptAllPhys; - mc_filter[1] = mc_filter[0] = 0xffffffff; - } else if ((netdev_mc_count(dev) > multicast_filter_limit) - || (dev->flags & IFF_ALLMULTI)) { - /* Too many to filter perfectly -- accept all multicasts. */ - rx_mode = AcceptBroadcast | AcceptMulticast | AcceptMyPhys; - mc_filter[1] = mc_filter[0] = 0xffffffff; - } else { -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35) - struct dev_mc_list *mclist; - unsigned int i; - - rx_mode = AcceptBroadcast | AcceptMyPhys; - mc_filter[1] = mc_filter[0] = 0; - for (i = 0, mclist = dev->mc_list; mclist && i < dev->mc_count; - i++, mclist = mclist->next) { - int bit_nr = ether_crc(ETH_ALEN, mclist->dmi_addr) >> 26; - mc_filter[bit_nr >> 5] |= 1 << (bit_nr & 31); - rx_mode |= AcceptMulticast; - } -#else - struct netdev_hw_addr *ha; - - rx_mode = AcceptBroadcast | AcceptMyPhys; - mc_filter[1] = mc_filter[0] = 0; - netdev_for_each_mc_addr(ha, dev) { - int bit_nr = ether_crc(ETH_ALEN, ha->addr) >> 26; - mc_filter[bit_nr >> 5] |= 1 << (bit_nr & 31); - rx_mode |= AcceptMulticast; - } -#endif - } - - if (dev->features & NETIF_F_RXALL) - rx_mode |= (AcceptErr | AcceptRunt); - - tmp = mc_filter[0]; - mc_filter[0] = swab32(mc_filter[1]); - mc_filter[1] = swab32(tmp); - - tmp = tp->rtl8125_rx_config | rx_mode | (RTL_R32(tp, RxConfig) & rtl_chip_info[tp->chipset].RxConfigMask); - - RTL_W32(tp, RxConfig, tmp); - RTL_W32(tp, MAR0 + 0, mc_filter[0]); - RTL_W32(tp, MAR0 + 4, mc_filter[1]); -} - -static void -rtl8125_set_rx_mode(struct net_device *dev) -{ - rtl8125_hw_set_rx_packet_filter(dev); -} - -void -rtl8125_set_rx_q_num(struct rtl8125_private *tp, - unsigned int num_rx_queues) -{ - u16 q_ctrl; - u16 rx_q_num; - - rx_q_num = (u16)ilog2(num_rx_queues); - rx_q_num &= (BIT_0 | BIT_1 | BIT_2); - rx_q_num <<= 2; - q_ctrl = RTL_R16(tp, Q_NUM_CTRL_8125); - q_ctrl &= ~(BIT_2 | BIT_3 | BIT_4); - q_ctrl |= rx_q_num; - RTL_W16(tp, Q_NUM_CTRL_8125, q_ctrl); -} - -void -rtl8125_set_tx_q_num(struct rtl8125_private *tp, - unsigned int num_tx_queues) -{ - u16 mac_ocp_data; - - mac_ocp_data = rtl8125_mac_ocp_read(tp, 0xE63E); - mac_ocp_data &= ~(BIT_11 | BIT_10); - mac_ocp_data |= ((ilog2(num_tx_queues) & 0x03) << 10); - rtl8125_mac_ocp_write(tp, 0xE63E, mac_ocp_data); -} - -void -rtl8125_hw_config(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - struct pci_dev *pdev = tp->pci_dev; - u16 mac_ocp_data; - int i; - - RTL_W32(tp, RxConfig, (RX_DMA_BURST << RxCfgDMAShift)); - - rtl8125_hw_reset(dev); - - rtl8125_enable_cfg9346_write(tp); - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - RTL_W8(tp, 0xF1, RTL_R8(tp, 0xF1) & ~BIT_7); - RTL_W8(tp, Config2, RTL_R8(tp, Config2) & ~BIT_7); - RTL_W8(tp, Config5, RTL_R8(tp, Config5) & ~BIT_0); - break; - } - - //clear io_rdy_l23 - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~BIT_1); - break; - } - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - //IntMITI_0-IntMITI_31 - for (i=0xA00; i<0xB00; i+=4) - RTL_W32(tp, i, 0x00000000); - break; - } - - //keep magic packet only - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - mac_ocp_data = rtl8125_mac_ocp_read(tp, 0xC0B6); - mac_ocp_data &= BIT_0; - rtl8125_mac_ocp_write(tp, 0xC0B6, mac_ocp_data); - break; - } - - rtl8125_tally_counter_addr_fill(tp); - - rtl8125_enable_extend_tally_couter(tp); - - rtl8125_desc_addr_fill(tp); - - /* Set DMA burst size and Interframe Gap Time */ - RTL_W32(tp, TxConfig, (TX_DMA_BURST_unlimited << TxDMAShift) | - (InterFrameGap << TxInterFrameGapShift)); - - if (tp->EnableTxNoClose) - RTL_W32(tp, TxConfig, (RTL_R32(tp, TxConfig) | BIT_6)); - - if (tp->mcfg == CFG_METHOD_2 || - tp->mcfg == CFG_METHOD_3 || - tp->mcfg == CFG_METHOD_4 || - tp->mcfg == CFG_METHOD_5 || - tp->mcfg == CFG_METHOD_6 || - tp->mcfg == CFG_METHOD_7) { - set_offset70F(tp, 0x27); - set_offset79(tp, 0x50); - - RTL_W16(tp, 0x382, 0x221B); - -#ifdef ENABLE_RSS_SUPPORT - rtl8125_config_rss(tp); -#else - RTL_W32(tp, RSS_CTRL_8125, 0x00); -#endif - rtl8125_set_rx_q_num(tp, rtl8125_tot_rx_rings(tp)); - - RTL_W8(tp, Config1, RTL_R8(tp, Config1) & ~0x10); - - rtl8125_mac_ocp_write(tp, 0xC140, 0xFFFF); - rtl8125_mac_ocp_write(tp, 0xC142, 0xFFFF); - - //new tx desc format - mac_ocp_data = rtl8125_mac_ocp_read(tp, 0xEB58); - mac_ocp_data |= (BIT_0); - rtl8125_mac_ocp_write(tp, 0xEB58, mac_ocp_data); - - mac_ocp_data = rtl8125_mac_ocp_read(tp, 0xE614); - mac_ocp_data &= ~( BIT_10 | BIT_9 | BIT_8); - if (tp->mcfg == CFG_METHOD_4 || tp->mcfg == CFG_METHOD_5 || - tp->mcfg == CFG_METHOD_7) - mac_ocp_data |= ((2 & 0x07) << 8); - else - mac_ocp_data |= ((3 & 0x07) << 8); - rtl8125_mac_ocp_write(tp, 0xE614, mac_ocp_data); - - rtl8125_set_tx_q_num(tp, rtl8125_tot_tx_rings(tp)); - - mac_ocp_data = rtl8125_mac_ocp_read(tp, 0xE63E); - mac_ocp_data &= ~(BIT_5 | BIT_4); - if (tp->mcfg == CFG_METHOD_2 || tp->mcfg == CFG_METHOD_3 || - tp->mcfg == CFG_METHOD_6) - mac_ocp_data |= ((0x02 & 0x03) << 4); - rtl8125_mac_ocp_write(tp, 0xE63E, mac_ocp_data); - - mac_ocp_data = rtl8125_mac_ocp_read(tp, 0xC0B4); - mac_ocp_data &= ~BIT_0; - rtl8125_mac_ocp_write(tp, 0xC0B4, mac_ocp_data); - mac_ocp_data |= BIT_0; - rtl8125_mac_ocp_write(tp, 0xC0B4, mac_ocp_data); - - mac_ocp_data = rtl8125_mac_ocp_read(tp, 0xC0B4); - mac_ocp_data |= (BIT_3|BIT_2); - rtl8125_mac_ocp_write(tp, 0xC0B4, mac_ocp_data); - - mac_ocp_data = rtl8125_mac_ocp_read(tp, 0xEB6A); - mac_ocp_data &= ~(BIT_7 | BIT_6 | BIT_5 | BIT_4 | BIT_3 | BIT_2 | BIT_1 | BIT_0); - mac_ocp_data |= (BIT_5 | BIT_4 | BIT_1 | BIT_0); - rtl8125_mac_ocp_write(tp, 0xEB6A, mac_ocp_data); - - mac_ocp_data = rtl8125_mac_ocp_read(tp, 0xEB50); - mac_ocp_data &= ~(BIT_9 | BIT_8 | BIT_7 | BIT_6 | BIT_5); - mac_ocp_data |= (BIT_6); - rtl8125_mac_ocp_write(tp, 0xEB50, mac_ocp_data); - - mac_ocp_data = rtl8125_mac_ocp_read(tp, 0xE056); - mac_ocp_data &= ~(BIT_7 | BIT_6 | BIT_5 | BIT_4); - //mac_ocp_data |= (BIT_4 | BIT_5); - rtl8125_mac_ocp_write(tp, 0xE056, mac_ocp_data); - - RTL_W8(tp, TDFNR, 0x10); - - RTL_W8(tp, 0xD0, RTL_R8(tp, 0xD0) | BIT_7); - - mac_ocp_data = rtl8125_mac_ocp_read(tp, 0xE040); - mac_ocp_data &= ~(BIT_12); - rtl8125_mac_ocp_write(tp, 0xE040, mac_ocp_data); - - mac_ocp_data = rtl8125_mac_ocp_read(tp, 0xEA1C); - mac_ocp_data &= ~(BIT_1 | BIT_0); - mac_ocp_data |= (BIT_0); - rtl8125_mac_ocp_write(tp, 0xEA1C, mac_ocp_data); - - rtl8125_mac_ocp_write(tp, 0xE0C0, 0x4000); - - SetMcuAccessRegBit(tp, 0xE052, (BIT_6 | BIT_5)); - ClearMcuAccessRegBit(tp, 0xE052, BIT_3 | BIT_7); - - mac_ocp_data = rtl8125_mac_ocp_read(tp, 0xD430); - mac_ocp_data &= ~(BIT_11 | BIT_10 | BIT_9 | BIT_8 | BIT_7 | BIT_6 | BIT_5 | BIT_4 | BIT_3 | BIT_2 | BIT_1 | BIT_0); - mac_ocp_data |= 0x45F; - rtl8125_mac_ocp_write(tp, 0xD430, mac_ocp_data); - - //rtl8125_mac_ocp_write(tp, 0xE0C0, 0x4F87); - if (!tp->DASH) - RTL_W8(tp, 0xD0, RTL_R8(tp, 0xD0) | BIT_6 | BIT_7); - else - RTL_W8(tp, 0xD0, (RTL_R8(tp, 0xD0) & ~BIT_6) | BIT_7); - - if (tp->mcfg == CFG_METHOD_2 || tp->mcfg == CFG_METHOD_3 || - tp->mcfg == CFG_METHOD_6) - RTL_W8(tp, MCUCmd_reg, RTL_R8(tp, MCUCmd_reg) | BIT_0); - - rtl8125_disable_eee_plus(tp); - - mac_ocp_data = rtl8125_mac_ocp_read(tp, 0xEA1C); - mac_ocp_data &= ~(BIT_2); - rtl8125_mac_ocp_write(tp, 0xEA1C, mac_ocp_data); - - SetMcuAccessRegBit(tp, 0xEB54, BIT_0); - udelay(1); - ClearMcuAccessRegBit(tp, 0xEB54, BIT_0); - RTL_W16(tp, 0x1880, RTL_R16(tp, 0x1880) & ~(BIT_4 | BIT_5)); - } - - /* csum offload command for RTL8125 */ - tp->tx_tcp_csum_cmd = TxTCPCS_C; - tp->tx_udp_csum_cmd = TxUDPCS_C; - tp->tx_ip_csum_cmd = TxIPCS_C; - tp->tx_ipv6_csum_cmd = TxIPV6F_C; - - /* config interrupt type for RTL8125B */ - if (tp->HwSuppIsrVer == 2) - rtl8125_hw_set_interrupt_type(tp, tp->HwCurrIsrVer); - - //other hw parameters - rtl8125_hw_clear_timer_int(dev); - - rtl8125_hw_clear_int_miti(dev); - - if (tp->RequireRduNonStopPatch && - tp->ShortPacketEmptyBuffer) { - RTL_W32(tp, RSS_INDIRECTION_TBL_8125_V2, ((u64)tp->ShortPacketEmptyBufferPhy & DMA_BIT_MASK(32))); - RTL_W32(tp, RSS_INDIRECTION_TBL_8125_V2 + 4, ((u64)tp->ShortPacketEmptyBufferPhy >> 32)); - } - - if (tp->use_timer_interrrupt && - (tp->HwCurrIsrVer == 2) && - (tp->HwSuppIntMitiVer == 4) && - (tp->features & RTL_FEATURE_MSIX)) { - int i; - for (i = 0; i < tp->irq_nvecs; i++) - rtl8125_hw_set_timer_int_8125(tp, i, timer_count_v2); - } - - rtl8125_enable_exit_l1_mask(tp); - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - rtl8125_mac_ocp_write(tp, 0xE098, 0xC302); - break; - } - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - if (aspm) { - rtl8125_init_pci_offset_99(tp); - } - break; - } - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - if (aspm) { - rtl8125_init_pci_offset_180(tp); - } - break; - } - - tp->cp_cmd &= ~(EnableBist | Macdbgo_oe | Force_halfdup | - Force_rxflow_en | Force_txflow_en | Cxpl_dbg_sel | - ASF | Macdbgo_sel); - -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0) - RTL_W16(tp, CPlusCmd, tp->cp_cmd); -#else - rtl8125_hw_set_features(dev, dev->features); -#endif - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: { - int timeout; - for (timeout = 0; timeout < 10; timeout++) { - if ((rtl8125_mac_ocp_read(tp, 0xE00E) & BIT_13)==0) - break; - mdelay(1); - } - } - break; - } - - RTL_W16(tp, RxMaxSize, tp->rx_buf_sz); - - rtl8125_disable_rxdvgate(dev); - - if (!tp->pci_cfg_is_read) { - pci_read_config_byte(pdev, PCI_COMMAND, &tp->pci_cfg_space.cmd); - pci_read_config_word(pdev, PCI_BASE_ADDRESS_0, &tp->pci_cfg_space.io_base_l); - pci_read_config_word(pdev, PCI_BASE_ADDRESS_0 + 2, &tp->pci_cfg_space.io_base_h); - pci_read_config_word(pdev, PCI_BASE_ADDRESS_2, &tp->pci_cfg_space.mem_base_l); - pci_read_config_word(pdev, PCI_BASE_ADDRESS_2 + 2, &tp->pci_cfg_space.mem_base_h); - pci_read_config_word(pdev, PCI_BASE_ADDRESS_3, &tp->pci_cfg_space.resv_0x1c_l); - pci_read_config_word(pdev, PCI_BASE_ADDRESS_3 + 2, &tp->pci_cfg_space.resv_0x1c_h); - pci_read_config_byte(pdev, PCI_INTERRUPT_LINE, &tp->pci_cfg_space.ilr); - pci_read_config_word(pdev, PCI_BASE_ADDRESS_4, &tp->pci_cfg_space.resv_0x20_l); - pci_read_config_word(pdev, PCI_BASE_ADDRESS_4 + 2, &tp->pci_cfg_space.resv_0x20_h); - pci_read_config_word(pdev, PCI_BASE_ADDRESS_5, &tp->pci_cfg_space.resv_0x24_l); - pci_read_config_word(pdev, PCI_BASE_ADDRESS_5 + 2, &tp->pci_cfg_space.resv_0x24_h); - pci_read_config_word(pdev, PCI_SUBSYSTEM_VENDOR_ID, &tp->pci_cfg_space.resv_0x2c_l); - pci_read_config_word(pdev, PCI_SUBSYSTEM_VENDOR_ID + 2, &tp->pci_cfg_space.resv_0x2c_h); - if (tp->HwPcieSNOffset > 0) { - tp->pci_cfg_space.pci_sn_l = rtl8125_csi_read(tp, tp->HwPcieSNOffset); - tp->pci_cfg_space.pci_sn_h = rtl8125_csi_read(tp, tp->HwPcieSNOffset + 4); - } - - tp->pci_cfg_is_read = 1; - } - - /* Set Rx packet filter */ - rtl8125_hw_set_rx_packet_filter(dev); - -#ifdef ENABLE_DASH_SUPPORT - if (tp->DASH && !tp->dash_printer_enabled) - NICChkTypeEnableDashInterrupt(tp); -#endif - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - if (aspm) { - RTL_W8(tp, Config5, RTL_R8(tp, Config5) | BIT_0); - RTL_W8(tp, Config2, RTL_R8(tp, Config2) | BIT_7); - } else { - RTL_W8(tp, Config2, RTL_R8(tp, Config2) & ~BIT_7); - RTL_W8(tp, Config5, RTL_R8(tp, Config5) & ~BIT_0); - } - break; - } - - rtl8125_disable_cfg9346_write(tp); - - udelay(10); -} - -void -rtl8125_hw_start(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - RTL_W8(tp, ChipCmd, CmdTxEnb | CmdRxEnb); - - rtl8125_enable_hw_interrupt(tp); - - rtl8125_lib_reset_complete(tp); -} - -static int -rtl8125_change_mtu(struct net_device *dev, - int new_mtu) -{ - struct rtl8125_private *tp = netdev_priv(dev); - int ret = 0; - -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,10,0) - if (new_mtu < ETH_MIN_MTU) - return -EINVAL; - else if (new_mtu > tp->max_jumbo_frame_size) - new_mtu = tp->max_jumbo_frame_size; -#endif //LINUX_VERSION_CODE < KERNEL_VERSION(4,10,0) - - dev->mtu = new_mtu; - - if (!netif_running(dev)) - goto out; - - rtl8125_down(dev); - - rtl8125_set_rxbufsize(tp, dev); - - ret = rtl8125_init_ring(dev); - - if (ret < 0) - goto err_out; - -#ifdef CONFIG_R8125_NAPI - rtl8125_enable_napi(tp); -#endif//CONFIG_R8125_NAPI - - //netif_tx_stop_all_queues(dev); - //netif_carrier_off(dev); - rtl8125_hw_config(dev); - rtl8125_enable_hw_linkchg_interrupt(tp); - - rtl8125_set_speed(dev, tp->autoneg, tp->speed, tp->duplex, tp->advertising); - - //mod_timer(&tp->esd_timer, jiffies + RTL8125_ESD_TIMEOUT); - //mod_timer(&tp->link_timer, jiffies + RTL8125_LINK_TIMEOUT); -out: -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0) - netdev_update_features(dev); -#endif - -err_out: - return ret; -} - -static void -rtl8125_free_rx_skb(struct rtl8125_private *tp, - struct rtl8125_rx_ring *ring, - struct sk_buff **sk_buff, - struct RxDesc *desc, - const u32 cur_rx) -{ - struct pci_dev *pdev = tp->pci_dev; - - dma_unmap_single(&pdev->dev, ring->RxDescPhyAddr[cur_rx], tp->rx_buf_sz, - DMA_FROM_DEVICE); - dev_kfree_skb(*sk_buff); - *sk_buff = NULL; - rtl8125_make_unusable_by_asic(tp, desc); -} - -static inline void -rtl8125_mark_to_asic_v3(struct RxDescV3 *descv3, - u32 rx_buf_sz) -{ - u32 eor = le32_to_cpu(descv3->RxDescNormalDDWord4.opts1) & RingEnd; - - WRITE_ONCE(descv3->RxDescNormalDDWord4.opts1, cpu_to_le32(DescOwn | eor | rx_buf_sz)); -} - -void -rtl8125_mark_to_asic(struct rtl8125_private *tp, - struct RxDesc *desc, - u32 rx_buf_sz) -{ - if (tp->InitRxDescType == RX_DESC_RING_TYPE_3) - rtl8125_mark_to_asic_v3((struct RxDescV3 *)desc, rx_buf_sz); - else { - u32 eor = le32_to_cpu(desc->opts1) & RingEnd; - - WRITE_ONCE(desc->opts1, cpu_to_le32(DescOwn | eor | rx_buf_sz)); - } -} - -static inline void -rtl8125_map_to_asic(struct rtl8125_private *tp, - struct rtl8125_rx_ring *ring, - struct RxDesc *desc, - dma_addr_t mapping, - u32 rx_buf_sz, - const u32 cur_rx) -{ - ring->RxDescPhyAddr[cur_rx] = mapping; - if (tp->InitRxDescType == RX_DESC_RING_TYPE_3) - ((struct RxDescV3 *)desc)->addr = cpu_to_le64(mapping); - else - desc->addr = cpu_to_le64(mapping); - wmb(); - rtl8125_mark_to_asic(tp, desc, rx_buf_sz); -} - -static int -rtl8125_alloc_rx_skb(struct rtl8125_private *tp, - struct rtl8125_rx_ring *ring, - struct sk_buff **sk_buff, - struct RxDesc *desc, - int rx_buf_sz, - const u32 cur_rx, - u8 in_intr) -{ - struct sk_buff *skb; - dma_addr_t mapping; - int ret = 0; - - if (in_intr) - skb = RTL_ALLOC_SKB_INTR(&tp->r8125napi[ring->index].napi, rx_buf_sz + RTK_RX_ALIGN); - else - skb = dev_alloc_skb(rx_buf_sz + RTK_RX_ALIGN); - - if (unlikely(!skb)) - goto err_out; - - skb_reserve(skb, RTK_RX_ALIGN); - - mapping = dma_map_single(tp_to_dev(tp), skb->data, rx_buf_sz, - DMA_FROM_DEVICE); - if (unlikely(dma_mapping_error(tp_to_dev(tp), mapping))) { - if (unlikely(net_ratelimit())) - netif_err(tp, drv, tp->dev, "Failed to map RX DMA!\n"); - goto err_out; - } - - *sk_buff = skb; - rtl8125_map_to_asic(tp, ring, desc, mapping, rx_buf_sz, cur_rx); -out: - return ret; - -err_out: - if (skb) - dev_kfree_skb(skb); - ret = -ENOMEM; - rtl8125_make_unusable_by_asic(tp, desc); - goto out; -} - -static void -_rtl8125_rx_clear(struct rtl8125_private *tp, struct rtl8125_rx_ring *ring) -{ - int i; - - for (i = 0; i < ring->num_rx_desc; i++) { - if (ring->Rx_skbuff[i]) { - rtl8125_free_rx_skb(tp, - ring, - ring->Rx_skbuff + i, - rtl8125_get_rxdesc(tp, ring->RxDescArray, i), - i); - ring->Rx_skbuff[i] = NULL; - } - } -} - -void -rtl8125_rx_clear(struct rtl8125_private *tp) -{ - int i; - - for (i = 0; i < tp->num_rx_rings; i++) - _rtl8125_rx_clear(tp, &tp->rx_ring[i]); -} - -static u32 -rtl8125_rx_fill(struct rtl8125_private *tp, - struct rtl8125_rx_ring *ring, - struct net_device *dev, - u32 start, - u32 end, - u8 in_intr) -{ - u32 cur; - - for (cur = start; end - cur > 0; cur++) { - int ret, i = cur % ring->num_rx_desc; - - if (ring->Rx_skbuff[i]) - continue; - - ret = rtl8125_alloc_rx_skb(tp, - ring, - ring->Rx_skbuff + i, - rtl8125_get_rxdesc(tp, ring->RxDescArray, i), - tp->rx_buf_sz, - i, - in_intr - ); - if (ret < 0) - break; - } - return cur - start; -} - -static inline void -rtl8125_mark_as_last_descriptor_8125(struct RxDescV3 *descv3) -{ - descv3->RxDescNormalDDWord4.opts1 |= cpu_to_le32(RingEnd); -} - -static inline void -rtl8125_mark_as_last_descriptor(struct rtl8125_private *tp, - struct RxDesc *desc) -{ - if (tp->InitRxDescType == RX_DESC_RING_TYPE_3) - rtl8125_mark_as_last_descriptor_8125((struct RxDescV3 *)desc); - else - desc->opts1 |= cpu_to_le32(RingEnd); -} - -static void -rtl8125_desc_addr_fill(struct rtl8125_private *tp) -{ - int i; - - for (i = 0; i < tp->num_tx_rings; i++) { - struct rtl8125_tx_ring *ring = &tp->tx_ring[i]; - RTL_W32(tp, ring->tdsar_reg, ((u64)ring->TxPhyAddr & DMA_BIT_MASK(32))); - RTL_W32(tp, ring->tdsar_reg + 4, ((u64)ring->TxPhyAddr >> 32)); - } - - for (i = 0; i < tp->num_rx_rings; i++) { - struct rtl8125_rx_ring *ring = &tp->rx_ring[i]; - RTL_W32(tp, ring->rdsar_reg, ((u64)ring->RxPhyAddr & DMA_BIT_MASK(32))); - RTL_W32(tp, ring->rdsar_reg + 4, ((u64)ring->RxPhyAddr >> 32)); - } -} - -static void -rtl8125_tx_desc_init(struct rtl8125_private *tp) -{ - int i = 0; - - for (i = 0; i < tp->num_tx_rings; i++) { - struct rtl8125_tx_ring *ring = &tp->tx_ring[i]; - memset(ring->TxDescArray, 0x0, (ring->num_tx_desc * sizeof(struct TxDesc))); - - ring->TxDescArray[ring->num_tx_desc - 1].opts1 = cpu_to_le32(RingEnd); - } -} - -static void -rtl8125_rx_desc_init(struct rtl8125_private *tp) -{ - int i; - - for (i = 0; i < tp->num_rx_rings; i++) { - struct rtl8125_rx_ring *ring = &tp->rx_ring[i]; - memset(ring->RxDescArray, 0x0, - (ring->num_rx_desc * tp->RxDescLength)); - } -} - -int -rtl8125_init_ring(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - int i; - - rtl8125_init_ring_indexes(tp); - - rtl8125_tx_desc_init(tp); - rtl8125_rx_desc_init(tp); - - for (i = 0; i < tp->num_tx_rings; i++) { - struct rtl8125_tx_ring *ring = &tp->tx_ring[i]; - memset(ring->tx_skb, 0x0, sizeof(ring->tx_skb)); - } - - for (i = 0; i < tp->num_rx_rings; i++) { - struct rtl8125_rx_ring *ring = &tp->rx_ring[i]; - - memset(ring->Rx_skbuff, 0x0, sizeof(ring->Rx_skbuff)); - if (rtl8125_rx_fill(tp, ring, dev, 0, ring->num_rx_desc, 0) != ring->num_rx_desc) - goto err_out; - - rtl8125_mark_as_last_descriptor(tp, rtl8125_get_rxdesc(tp, ring->RxDescArray, ring->num_rx_desc - 1)); - } - - return 0; - -err_out: - rtl8125_rx_clear(tp); - return -ENOMEM; -} - -static void -rtl8125_unmap_tx_skb(struct pci_dev *pdev, - struct ring_info *tx_skb, - struct TxDesc *desc) -{ - unsigned int len = tx_skb->len; - - dma_unmap_single(&pdev->dev, le64_to_cpu(desc->addr), len, DMA_TO_DEVICE); - - desc->opts1 = cpu_to_le32(RTK_MAGIC_DEBUG_VALUE); - desc->opts2 = 0x00; - desc->addr = RTL8125_MAGIC_NUMBER; - tx_skb->len = 0; -} - -static void -rtl8125_tx_clear_range(struct rtl8125_private *tp, - struct rtl8125_tx_ring *ring, - u32 start, - unsigned int n) -{ - unsigned int i; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22) - struct net_device *dev = tp->dev; -#endif - - for (i = 0; i < n; i++) { - unsigned int entry = (start + i) % ring->num_tx_desc; - struct ring_info *tx_skb = ring->tx_skb + entry; - unsigned int len = tx_skb->len; - - if (len) { - struct sk_buff *skb = tx_skb->skb; - - rtl8125_unmap_tx_skb(tp->pci_dev, tx_skb, - ring->TxDescArray + entry); - if (skb) { - RTLDEV->stats.tx_dropped++; - dev_kfree_skb_any(skb); - tx_skb->skb = NULL; - } - } - } -} - -void -rtl8125_tx_clear(struct rtl8125_private *tp) -{ - int i; - - for (i = 0; i < tp->num_tx_rings; i++) { - struct rtl8125_tx_ring *ring = &tp->tx_ring[i]; - rtl8125_tx_clear_range(tp, ring, ring->dirty_tx, ring->num_tx_desc); - ring->cur_tx = ring->dirty_tx = 0; - } -} - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -static void rtl8125_schedule_reset_work(struct rtl8125_private *tp) -{ -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - set_bit(R8125_FLAG_TASK_RESET_PENDING, tp->task_flags); - schedule_delayed_work(&tp->reset_task, 4); -#endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) -} - -static void rtl8125_schedule_esd_work(struct rtl8125_private *tp) -{ -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - set_bit(R8125_FLAG_TASK_ESD_CHECK_PENDING, tp->task_flags); - schedule_delayed_work(&tp->esd_task, RTL8125_ESD_TIMEOUT); -#endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) -} - -static void rtl8125_schedule_linkchg_work(struct rtl8125_private *tp) -{ -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - set_bit(R8125_FLAG_TASK_LINKCHG_CHECK_PENDING, tp->task_flags); - schedule_delayed_work(&tp->linkchg_task, 4); -#endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) -} - -#define rtl8125_cancel_schedule_reset_work(a) -#define rtl8125_cancel_schedule_esd_work(a) -#define rtl8125_cancel_schedule_linkchg_work(a) - -#else -static void rtl8125_schedule_reset_work(struct rtl8125_private *tp) -{ - set_bit(R8125_FLAG_TASK_RESET_PENDING, tp->task_flags); - schedule_delayed_work(&tp->reset_task, 4); -} - -static void rtl8125_cancel_schedule_reset_work(struct rtl8125_private *tp) -{ - struct work_struct *work = &tp->reset_task.work; - - if (!work->func) return; - - cancel_delayed_work_sync(&tp->reset_task); -} - -static void rtl8125_schedule_esd_work(struct rtl8125_private *tp) -{ - set_bit(R8125_FLAG_TASK_ESD_CHECK_PENDING, tp->task_flags); - schedule_delayed_work(&tp->esd_task, RTL8125_ESD_TIMEOUT); -} - -static void rtl8125_cancel_schedule_esd_work(struct rtl8125_private *tp) -{ - struct work_struct *work = &tp->esd_task.work; - - if (!work->func) return; - - cancel_delayed_work_sync(&tp->esd_task); -} - -static void rtl8125_schedule_linkchg_work(struct rtl8125_private *tp) -{ - set_bit(R8125_FLAG_TASK_LINKCHG_CHECK_PENDING, tp->task_flags); - schedule_delayed_work(&tp->linkchg_task, RTL8125_ESD_TIMEOUT); -} - -static void rtl8125_cancel_schedule_linkchg_work(struct rtl8125_private *tp) -{ - struct work_struct *work = &tp->linkchg_task.work; - - if (!work->func) return; - - cancel_delayed_work_sync(&tp->linkchg_task); -} -#endif - -static void rtl8125_init_all_schedule_work(struct rtl8125_private *tp) -{ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) - INIT_WORK(&tp->reset_task, rtl8125_reset_task, dev); - INIT_WORK(&tp->esd_task, rtl8125_esd_task, dev); - INIT_WORK(&tp->linkchg_task, rtl8125_linkchg_task, dev); -#else - INIT_DELAYED_WORK(&tp->reset_task, rtl8125_reset_task); - INIT_DELAYED_WORK(&tp->esd_task, rtl8125_esd_task); - INIT_DELAYED_WORK(&tp->linkchg_task, rtl8125_linkchg_task); -#endif -} - -static void rtl8125_cancel_all_schedule_work(struct rtl8125_private *tp) -{ - rtl8125_cancel_schedule_reset_work(tp); - rtl8125_cancel_schedule_esd_work(tp); - rtl8125_cancel_schedule_linkchg_work(tp); -} - -static void -rtl8125_wait_for_irq_complete(struct rtl8125_private *tp) -{ - if (tp->features & RTL_FEATURE_MSIX) { - int i; - for (i = 0; i < tp->irq_nvecs; i++) - synchronize_irq(tp->irq_tbl[i].vector); - } else { - synchronize_irq(tp->dev->irq); - } -} - -static void -_rtl8125_wait_for_quiescence(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - /* Wait for any pending NAPI task to complete */ -#ifdef CONFIG_R8125_NAPI - rtl8125_disable_napi(tp); -#endif//CONFIG_R8125_NAPI - -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,67) - /* Give a racing hard_start_xmit a few cycles to complete. */ - synchronize_net(); -#endif - - rtl8125_irq_mask_and_ack(tp); - - rtl8125_wait_for_irq_complete(tp); -} - -static void -rtl8125_wait_for_quiescence(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - //suppress unused variable - (void)(tp); - - _rtl8125_wait_for_quiescence(dev); - -#ifdef CONFIG_R8125_NAPI - rtl8125_enable_napi(tp); -#endif//CONFIG_R8125_NAPI -} - -static int rtl8125_rx_nostuck(struct rtl8125_private *tp) -{ - int i, ret = 1; - for (i = 0; i < tp->num_rx_rings; i++) - ret &= (tp->rx_ring[i].dirty_rx == tp->rx_ring[i].cur_rx); - return ret; -} - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -static void rtl8125_reset_task(void *_data) -{ - struct net_device *dev = _data; - struct rtl8125_private *tp = netdev_priv(dev); -#else -static void rtl8125_reset_task(struct work_struct *work) -{ - struct rtl8125_private *tp = - container_of(work, struct rtl8125_private, reset_task.work); - struct net_device *dev = tp->dev; -#endif - u32 budget = ~(u32)0; - int i; - - rtnl_lock(); - - if (!netif_running(dev) || - test_bit(R8125_FLAG_DOWN, tp->task_flags) || - !test_and_clear_bit(R8125_FLAG_TASK_RESET_PENDING, tp->task_flags)) - goto out_unlock; - - rtl8125_wait_for_quiescence(dev); - - for (i = 0; i < tp->num_rx_rings; i++) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) - rtl8125_rx_interrupt(dev, tp, &tp->rx_ring[i], &budget); -#else - rtl8125_rx_interrupt(dev, tp, &tp->rx_ring[i], budget); -#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) - } - - netif_tx_stop_all_queues(dev); - netif_carrier_off(dev); - rtl8125_hw_reset(dev); - - rtl8125_tx_clear(tp); - - if (rtl8125_rx_nostuck(tp)) { - rtl8125_rx_clear(tp); - rtl8125_init_ring(dev); -#ifdef ENABLE_PTP_SUPPORT - rtl8125_ptp_reset(tp); -#endif - if (tp->resume_not_chg_speed) { - _rtl8125_check_link_status(dev); - - tp->resume_not_chg_speed = 0; - } else { - rtl8125_enable_hw_linkchg_interrupt(tp); - - rtl8125_set_speed(dev, tp->autoneg, tp->speed, tp->duplex, tp->advertising); - } - } else { - if (unlikely(net_ratelimit())) { - struct rtl8125_private *tp = netdev_priv(dev); - - if (netif_msg_intr(tp)) { - printk(PFX KERN_EMERG - "%s: Rx buffers shortage\n", dev->name); - } - } - rtl8125_schedule_reset_work(tp); - } - -out_unlock: - rtnl_unlock(); -} - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -static void rtl8125_esd_task(void *_data) -{ - struct net_device *dev = _data; - struct rtl8125_private *tp = netdev_priv(dev); -#else -static void rtl8125_esd_task(struct work_struct *work) -{ - struct rtl8125_private *tp = - container_of(work, struct rtl8125_private, esd_task.work); - struct net_device *dev = tp->dev; -#endif - rtnl_lock(); - - if (!netif_running(dev) || - test_bit(R8125_FLAG_DOWN, tp->task_flags) || - !test_and_clear_bit(R8125_FLAG_TASK_ESD_CHECK_PENDING, tp->task_flags)) - goto out_unlock; - - rtl8125_esd_checker(tp); - - rtl8125_schedule_esd_work(tp); - -out_unlock: - rtnl_unlock(); -} - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -static void rtl8125_linkchg_task(void *_data) -{ - struct net_device *dev = _data; - //struct rtl8125_private *tp = netdev_priv(dev); -#else -static void rtl8125_linkchg_task(struct work_struct *work) -{ - struct rtl8125_private *tp = - container_of(work, struct rtl8125_private, linkchg_task.work); - struct net_device *dev = tp->dev; -#endif - rtnl_lock(); - - if (!netif_running(dev) || - test_bit(R8125_FLAG_DOWN, tp->task_flags) || - !test_and_clear_bit(R8125_FLAG_TASK_LINKCHG_CHECK_PENDING, tp->task_flags)) - goto out_unlock; - - rtl8125_check_link_status(dev); - -out_unlock: - rtnl_unlock(); -} - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0) -static void -rtl8125_tx_timeout(struct net_device *dev, unsigned int txqueue) -#else -static void -rtl8125_tx_timeout(struct net_device *dev) -#endif -{ - struct rtl8125_private *tp = netdev_priv(dev); - - /* Let's wait a bit while any (async) irq lands on */ - rtl8125_schedule_reset_work(tp); -} - -static u32 -rtl8125_get_txd_opts1(struct rtl8125_tx_ring *ring, - u32 opts1, - u32 len, - unsigned int entry) -{ - u32 status = opts1 | len; - - if (entry == ring->num_tx_desc - 1) - status |= RingEnd; - - return status; -} - -static int -rtl8125_xmit_frags(struct rtl8125_private *tp, - struct rtl8125_tx_ring *ring, - struct sk_buff *skb, - const u32 *opts) -{ - struct skb_shared_info *info = skb_shinfo(skb); - unsigned int cur_frag, entry; - struct TxDesc *txd = NULL; - const unsigned char nr_frags = info->nr_frags; - unsigned long PktLenCnt = 0; - bool LsoPatchEnabled = FALSE; - - entry = ring->cur_tx; - for (cur_frag = 0; cur_frag < nr_frags; cur_frag++) { - skb_frag_t *frag = info->frags + cur_frag; - dma_addr_t mapping; - u32 status, len; - void *addr; - - entry = (entry + 1) % ring->num_tx_desc; - - txd = ring->TxDescArray + entry; -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0) - len = frag->size; - addr = ((void *) page_address(frag->page)) + frag->page_offset; -#else - len = skb_frag_size(frag); - addr = skb_frag_address(frag); -#endif - if (tp->RequireLSOPatch && - (cur_frag == nr_frags - 1) && - (opts[0] & (GiantSendv4|GiantSendv6)) && - PktLenCnt < ETH_FRAME_LEN && - len > 1) { - len -= 1; - mapping = dma_map_single(tp_to_dev(tp), addr, len, DMA_TO_DEVICE); - - if (unlikely(dma_mapping_error(tp_to_dev(tp), mapping))) { - if (unlikely(net_ratelimit())) - netif_err(tp, drv, tp->dev, - "Failed to map TX fragments DMA!\n"); - goto err_out; - } - - /* anti gcc 2.95.3 bugware (sic) */ - status = rtl8125_get_txd_opts1(ring, opts[0], len, entry); - - txd->addr = cpu_to_le64(mapping); - - ring->tx_skb[entry].len = len; - - txd->opts2 = cpu_to_le32(opts[1]); - wmb(); - txd->opts1 = cpu_to_le32(status); - - //second txd - addr += len; - len = 1; - entry = (entry + 1) % ring->num_tx_desc; - txd = ring->TxDescArray + entry; - cur_frag += 1; - - LsoPatchEnabled = TRUE; - } - - mapping = dma_map_single(tp_to_dev(tp), addr, len, DMA_TO_DEVICE); - - if (unlikely(dma_mapping_error(tp_to_dev(tp), mapping))) { - if (unlikely(net_ratelimit())) - netif_err(tp, drv, tp->dev, - "Failed to map TX fragments DMA!\n"); - goto err_out; - } - - /* anti gcc 2.95.3 bugware (sic) */ - status = rtl8125_get_txd_opts1(ring, opts[0], len, entry); - if (cur_frag == (nr_frags - 1) || LsoPatchEnabled == TRUE) { - //ring->tx_skb[entry].skb = skb; - status |= LastFrag; - } - - txd->addr = cpu_to_le64(mapping); - - ring->tx_skb[entry].len = len; - - txd->opts2 = cpu_to_le32(opts[1]); - wmb(); - txd->opts1 = cpu_to_le32(status); - - PktLenCnt += len; - } - - return cur_frag; - -err_out: - rtl8125_tx_clear_range(tp, ring, ring->cur_tx + 1, cur_frag); - return -EIO; -} - -static inline -__be16 get_protocol(struct sk_buff *skb) -{ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37) - return vlan_get_protocol(skb); -#else - __be16 protocol; - - if (skb->protocol == htons(ETH_P_8021Q)) - protocol = vlan_eth_hdr(skb)->h_vlan_encapsulated_proto; - else - protocol = skb->protocol; - - return protocol; -#endif -} - -static inline -u8 rtl8125_get_l4_protocol(struct sk_buff *skb) -{ - int no = skb_network_offset(skb); - struct ipv6hdr *i6h, _i6h; - struct iphdr *ih, _ih; - u8 ip_protocol = IPPROTO_RAW; - - switch (get_protocol(skb)) { - case __constant_htons(ETH_P_IP): - ih = skb_header_pointer(skb, no, sizeof(_ih), &_ih); - if (ih) - ip_protocol = ih->protocol; - break; - case __constant_htons(ETH_P_IPV6): - i6h = skb_header_pointer(skb, no, sizeof(_i6h), &_i6h); - if (i6h) - ip_protocol = i6h->nexthdr; - break; - } - - return ip_protocol; -} - -static bool rtl8125_skb_pad_with_len(struct sk_buff *skb, unsigned int len) -{ - if (skb_padto(skb, len)) - return false; - skb_put(skb, len - skb->len); - return true; -} - -static bool rtl8125_skb_pad(struct sk_buff *skb) -{ -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) - return rtl8125_skb_pad_with_len(skb, ETH_ZLEN); -#else - return !eth_skb_pad(skb); -#endif -} - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0) -/* msdn_giant_send_check() - * According to the document of microsoft, the TCP Pseudo Header excludes the - * packet length for IPv6 TCP large packets. - */ -static int msdn_giant_send_check(struct sk_buff *skb) -{ - const struct ipv6hdr *ipv6h; - struct tcphdr *th; - int ret; - - ret = skb_cow_head(skb, 0); - if (ret) - return ret; - - ipv6h = ipv6_hdr(skb); - th = tcp_hdr(skb); - - th->check = 0; - th->check = ~tcp_v6_check(0, &ipv6h->saddr, &ipv6h->daddr, 0); - - return ret; -} -#endif - -#define MIN_PATCH_LEN (47) -static u32 -rtl8125_get_patch_pad_len(struct sk_buff *skb) -{ - u32 pad_len = 0; - int trans_data_len; - u32 hdr_len; - u32 pkt_len = skb->len; - u8 ip_protocol; - bool has_trans = skb_transport_header_was_set(skb); - - if (!(has_trans && (pkt_len < 175))) //128 + MIN_PATCH_LEN - goto no_padding; - - ip_protocol = rtl8125_get_l4_protocol(skb); - if (!(ip_protocol == IPPROTO_TCP || ip_protocol == IPPROTO_UDP)) - goto no_padding; - - trans_data_len = pkt_len - - (skb->transport_header - - skb_headroom(skb)); - if (ip_protocol == IPPROTO_UDP) { - if (trans_data_len > 3 && trans_data_len < MIN_PATCH_LEN) { - u16 dest_port = 0; - - skb_copy_bits(skb, skb->transport_header - skb_headroom(skb) + 2, &dest_port, 2); - dest_port = ntohs(dest_port); - - if (dest_port == 0x13f || - dest_port == 0x140) { - pad_len = MIN_PATCH_LEN - trans_data_len; - goto out; - } - } - } - - hdr_len = 0; - if (ip_protocol == IPPROTO_TCP) - hdr_len = 20; - else if (ip_protocol == IPPROTO_UDP) - hdr_len = 8; - if (trans_data_len < hdr_len) - pad_len = hdr_len - trans_data_len; - -out: - if ((pkt_len + pad_len) < ETH_ZLEN) - pad_len = ETH_ZLEN - pkt_len; - - return pad_len; - -no_padding: - - return 0; -} - -static bool -rtl8125_tso_csum(struct sk_buff *skb, - struct net_device *dev, - u32 *opts) -{ - struct rtl8125_private *tp = netdev_priv(dev); - unsigned long large_send = 0; - u32 csum_cmd = 0; - u8 sw_calc_csum = false; - u8 check_patch_required = true; - -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - if (dev->features & (NETIF_F_TSO | NETIF_F_TSO6)) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) - u32 mss = skb_shinfo(skb)->tso_size; -#else - u32 mss = skb_shinfo(skb)->gso_size; -#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) - - /* TCP Segmentation Offload (or TCP Large Send) */ - if (mss) { - u32 transport_offset = (u32)skb_transport_offset(skb); - assert((transport_offset%2) == 0); - switch (get_protocol(skb)) { - case __constant_htons(ETH_P_IP): - if (transport_offset <= GTTCPHO_MAX) { - opts[0] |= GiantSendv4; - opts[0] |= transport_offset << GTTCPHO_SHIFT; - opts[1] |= min(mss, MSS_MAX) << 18; - large_send = 1; - } - break; - case __constant_htons(ETH_P_IPV6): -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0) - if (msdn_giant_send_check(skb)) - return false; -#endif - if (transport_offset <= GTTCPHO_MAX) { - opts[0] |= GiantSendv6; - opts[0] |= transport_offset << GTTCPHO_SHIFT; - opts[1] |= min(mss, MSS_MAX) << 18; - large_send = 1; - } - break; - default: - if (unlikely(net_ratelimit())) - dprintk("tso proto=%x!\n", skb->protocol); - break; - } - - if (large_send == 0) - return false; - - return true; - } - } -#endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - - if (skb->ip_summed == CHECKSUM_PARTIAL) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) - const struct iphdr *ip = skb->nh.iph; - - if (dev->features & NETIF_F_IP_CSUM) { - if (ip->protocol == IPPROTO_TCP) - csum_cmd = tp->tx_ip_csum_cmd | tp->tx_tcp_csum_cmd; - else if (ip->protocol == IPPROTO_UDP) - csum_cmd = tp->tx_ip_csum_cmd | tp->tx_udp_csum_cmd; - else if (ip->protocol == IPPROTO_IP) - csum_cmd = tp->tx_ip_csum_cmd; - } -#else - u8 ip_protocol = IPPROTO_RAW; - - switch (get_protocol(skb)) { - case __constant_htons(ETH_P_IP): - if (dev->features & NETIF_F_IP_CSUM) { - ip_protocol = ip_hdr(skb)->protocol; - csum_cmd = tp->tx_ip_csum_cmd; - } - break; - case __constant_htons(ETH_P_IPV6): - if (dev->features & NETIF_F_IPV6_CSUM) { - u32 transport_offset = (u32)skb_transport_offset(skb); - if (transport_offset > 0 && transport_offset <= TCPHO_MAX) { - ip_protocol = ipv6_hdr(skb)->nexthdr; - csum_cmd = tp->tx_ipv6_csum_cmd; - csum_cmd |= transport_offset << TCPHO_SHIFT; - } - } - break; - default: - if (unlikely(net_ratelimit())) - dprintk("checksum_partial proto=%x!\n", skb->protocol); - break; - } - - if (ip_protocol == IPPROTO_TCP) - csum_cmd |= tp->tx_tcp_csum_cmd; - else if (ip_protocol == IPPROTO_UDP) - csum_cmd |= tp->tx_udp_csum_cmd; -#endif - if (csum_cmd == 0) { - sw_calc_csum = true; -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - WARN_ON(1); /* we need a WARN() */ -#endif - } - - if (ip_protocol == IPPROTO_TCP) - check_patch_required = false; - } - - if (check_patch_required) { - u32 pad_len = rtl8125_get_patch_pad_len(skb); - - if (pad_len > 0) { - if (!rtl8125_skb_pad_with_len(skb, skb->len + pad_len)) - return false; - - if (csum_cmd != 0) - sw_calc_csum = true; - } - } - - if (skb->len < ETH_ZLEN) { - if (tp->UseSwPaddingShortPkt || - (tp->ShortPacketSwChecksum && csum_cmd != 0)) { - if (!rtl8125_skb_pad(skb)) - return false; - - if (csum_cmd != 0) - sw_calc_csum = true; - } - } - - if (sw_calc_csum) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) && LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,7) - skb_checksum_help(&skb, 0); -#elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) && LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10) - skb_checksum_help(skb, 0); -#else - skb_checksum_help(skb); -#endif - } else - opts[1] |= csum_cmd; - - return true; -} - -static bool rtl8125_tx_slots_avail(struct rtl8125_private *tp, - struct rtl8125_tx_ring *ring) -{ - unsigned int slots_avail = READ_ONCE(ring->dirty_tx) + ring->num_tx_desc - - READ_ONCE(ring->cur_tx); - - /* A skbuff with nr_frags needs nr_frags+1 entries in the tx queue */ - return slots_avail > MAX_SKB_FRAGS; -} - -static netdev_tx_t -rtl8125_start_xmit(struct sk_buff *skb, - struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - unsigned int entry; - struct TxDesc *txd; - dma_addr_t mapping; - u32 len; - u32 opts[2]; - netdev_tx_t ret = NETDEV_TX_OK; - int frags; - u8 EnableTxNoClose = tp->EnableTxNoClose; - const u16 queue_mapping = skb_get_queue_mapping(skb); - struct rtl8125_tx_ring *ring; - bool stop_queue; - - assert(queue_mapping < tp->num_tx_rings); - - ring = &tp->tx_ring[queue_mapping]; - - if (unlikely(!rtl8125_tx_slots_avail(tp, ring))) { - if (netif_msg_drv(tp)) { - printk(KERN_ERR - "%s: BUG! Tx Ring[%d] full when queue awake!\n", - dev->name, - queue_mapping); - } - goto err_stop; - } - - entry = ring->cur_tx % ring->num_tx_desc; - txd = ring->TxDescArray + entry; - - if (!EnableTxNoClose) { - if (unlikely(le32_to_cpu(txd->opts1) & DescOwn)) { - if (netif_msg_drv(tp)) { - printk(KERN_ERR - "%s: BUG! Tx Desc is own by hardware!\n", - dev->name); - } - goto err_stop; - } - } - - opts[0] = DescOwn; - opts[1] = rtl8125_tx_vlan_tag(tp, skb); - - if (unlikely(!rtl8125_tso_csum(skb, dev, opts))) - goto err_dma_0; - - frags = rtl8125_xmit_frags(tp, ring, skb, opts); - if (unlikely(frags < 0)) - goto err_dma_0; - if (frags) { - len = skb_headlen(skb); - opts[0] |= FirstFrag; - } else { - len = skb->len; - - //ring->tx_skb[entry].skb = skb; - - opts[0] |= FirstFrag | LastFrag; - } - - opts[0] = rtl8125_get_txd_opts1(ring, opts[0], len, entry); - mapping = dma_map_single(tp_to_dev(tp), skb->data, len, DMA_TO_DEVICE); - if (unlikely(dma_mapping_error(tp_to_dev(tp), mapping))) { - if (unlikely(net_ratelimit())) - netif_err(tp, drv, dev, "Failed to map TX DMA!\n"); - goto err_dma_1; - } - ring->tx_skb[entry].len = len; -#ifdef ENABLE_PTP_SUPPORT - if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)) { - if (tp->hwtstamp_config.tx_type == HWTSTAMP_TX_ON && - !tp->ptp_tx_skb) { - skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS; - - tp->ptp_tx_skb = skb_get(skb); - tp->ptp_tx_start = jiffies; - schedule_work(&tp->ptp_tx_work); - } else { - tp->tx_hwtstamp_skipped++; - } - } -#endif - ring->tx_skb[entry].skb = skb; - txd->addr = cpu_to_le64(mapping); - txd->opts2 = cpu_to_le32(opts[1]); - wmb(); - txd->opts1 = cpu_to_le32(opts[0]); - -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0) - dev->trans_start = jiffies; -#else - skb_tx_timestamp(skb); -#endif //LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0) - - /* rtl_tx needs to see descriptor changes before updated tp->cur_tx */ - smp_wmb(); - - WRITE_ONCE(ring->cur_tx, ring->cur_tx + frags + 1); - - stop_queue = !rtl8125_tx_slots_avail(tp, ring); - if (unlikely(stop_queue)) { - /* Avoid wrongly optimistic queue wake-up: rtl_tx thread must - * not miss a ring update when it notices a stopped queue. - */ - smp_wmb(); - netif_stop_subqueue(dev, queue_mapping); - } - - if (EnableTxNoClose) - RTL_W16(tp, ring->sw_tail_ptr_reg, ring->cur_tx % MAX_TX_NO_CLOSE_DESC_PTR_V2); - else - RTL_W16(tp, TPPOLL_8125, BIT(ring->index)); /* set polling bit */ - - if (unlikely(stop_queue)) { - /* Sync with rtl_tx: - * - publish queue status and cur_tx ring index (write barrier) - * - refresh dirty_tx ring index (read barrier). - * May the current thread have a pessimistic view of the ring - * status and forget to wake up queue, a racing rtl_tx thread - * can't. - */ - smp_mb(); - if (rtl8125_tx_slots_avail(tp, ring)) - netif_start_subqueue(dev, queue_mapping); - } -out: - return ret; -err_dma_1: - ring->tx_skb[entry].skb = NULL; - rtl8125_tx_clear_range(tp, ring, ring->cur_tx + 1, frags); -err_dma_0: - RTLDEV->stats.tx_dropped++; - dev_kfree_skb_any(skb); - ret = NETDEV_TX_OK; - goto out; -err_stop: - netif_stop_subqueue(dev, queue_mapping); - ret = NETDEV_TX_BUSY; - RTLDEV->stats.tx_dropped++; - goto out; -} - -static inline u32 -rtl8125_fast_mod(const u32 input, const u32 ceil) -{ - return input >= ceil ? input % ceil : input; -} - -static int -rtl8125_tx_interrupt(struct rtl8125_tx_ring *ring, int budget) -{ - struct rtl8125_private *tp = ring->priv; - struct net_device *dev = tp->dev; - unsigned int dirty_tx, tx_left; - unsigned int count = 0; - u8 EnableTxNoClose = tp->EnableTxNoClose; - - dirty_tx = ring->dirty_tx; - smp_rmb(); - tx_left = READ_ONCE(ring->cur_tx) - dirty_tx; - if (EnableTxNoClose) { - unsigned int tx_desc_closed; - u32 NextHwDesCloPtr = RTL_R16(tp, ring->hw_clo_ptr_reg); - ring->NextHwDesCloPtr = NextHwDesCloPtr; - smp_rmb(); - tx_desc_closed = rtl8125_fast_mod(NextHwDesCloPtr - ring->BeginHwDesCloPtr, MAX_TX_NO_CLOSE_DESC_PTR_V2); - if(tx_left > tx_desc_closed) tx_left = tx_desc_closed; - ring->BeginHwDesCloPtr = NextHwDesCloPtr; - } - - while (tx_left > 0) { - unsigned int entry = dirty_tx % ring->num_tx_desc; - struct ring_info *tx_skb = ring->tx_skb + entry; - - if (!EnableTxNoClose && - (le32_to_cpu(ring->TxDescArray[entry].opts1) & DescOwn)) - break; - - RTLDEV->stats.tx_bytes += tx_skb->len; - RTLDEV->stats.tx_packets++; - - rtl8125_unmap_tx_skb(tp->pci_dev, - tx_skb, - ring->TxDescArray + entry); - - if (tx_skb->skb != NULL) { - RTL_NAPI_CONSUME_SKB_ANY(tx_skb->skb, budget); - tx_skb->skb = NULL; - } - dirty_tx++; - tx_left--; - } - - if (ring->dirty_tx != dirty_tx) { - count = dirty_tx - ring->dirty_tx; - WRITE_ONCE(ring->dirty_tx, dirty_tx); - smp_wmb(); - if (__netif_subqueue_stopped(dev, ring->index) && - (rtl8125_tx_slots_avail(tp, ring))) { - netif_start_subqueue(dev, ring->index); - } - smp_rmb(); - if (!EnableTxNoClose && (ring->cur_tx != dirty_tx)) { - RTL_W16(tp, TPPOLL_8125, BIT(ring->index)); - } - } - - return count; -} - -static int -rtl8125_tx_interrupt_with_vector(struct rtl8125_private *tp, - const int message_id, - int budget) -{ - int count = 0; - - if (message_id == 16) - count += rtl8125_tx_interrupt(&tp->tx_ring[0], budget); -#ifdef ENABLE_MULTIPLE_TX_QUEUE - else if (message_id == 18) - count += rtl8125_tx_interrupt(&tp->tx_ring[1], budget); -#endif - - return count; -} - -static inline int -rtl8125_fragmented_frame(struct rtl8125_private *tp, u32 status) -{ - if (tp->InitRxDescType == RX_DESC_RING_TYPE_3) - return (status & (FirstFrag_V3 | LastFrag_V3)) != (FirstFrag_V3 | LastFrag_V3); - else - return (status & (FirstFrag | LastFrag)) != (FirstFrag | LastFrag); -} - -static inline int -rtl8125_rx_desc_type(u32 status) -{ - return ((status >> 26) & 0x0F); -} - -static inline void -rtl8125_rx_v3_csum(struct rtl8125_private *tp, - struct sk_buff *skb, - struct RxDescV3 *descv3) -{ - //u32 opts1 = le32_to_cpu(descv3->RxDescNormalDDWord4.opts1); - u32 opts2 = le32_to_cpu(descv3->RxDescNormalDDWord4.opts2); - - /* rx csum offload for RTL8125 */ - if (((opts2 & RxV4F_v3) && !(opts2 & RxIPF_v3)) || (opts2 & RxV6F_v3)) { - if (((opts2 & RxTCPT_v3) && !(opts2 & RxTCPF_v3)) || - ((opts2 & RxUDPT_v3) && !(opts2 & RxUDPF_v3))) - skb->ip_summed = CHECKSUM_UNNECESSARY; - else - skb->ip_summed = CHECKSUM_NONE; - } else - skb->ip_summed = CHECKSUM_NONE; -} - -static inline void -rtl8125_rx_csum(struct rtl8125_private *tp, - struct sk_buff *skb, - struct RxDesc *desc) -{ - if (tp->InitRxDescType == RX_DESC_RING_TYPE_3) - rtl8125_rx_v3_csum(tp, skb, (struct RxDescV3 *)desc); - else { - u32 opts1 = le32_to_cpu(rtl8125_rx_desc_opts1(tp, desc)); - u32 opts2 = le32_to_cpu(rtl8125_rx_desc_opts2(tp, desc)); - - /* rx csum offload for RTL8125 */ - if (((opts2 & RxV4F) && !(opts1 & RxIPF)) || (opts2 & RxV6F)) { - if (((opts1 & RxTCPT) && !(opts1 & RxTCPF)) || - ((opts1 & RxUDPT) && !(opts1 & RxUDPF))) - skb->ip_summed = CHECKSUM_UNNECESSARY; - else - skb->ip_summed = CHECKSUM_NONE; - } else - skb->ip_summed = CHECKSUM_NONE; - } -} - -static inline int -rtl8125_try_rx_copy(struct rtl8125_private *tp, - struct rtl8125_rx_ring *ring, - struct sk_buff **sk_buff, - int pkt_size, - struct RxDesc *desc, - int rx_buf_sz) -{ - int ret = -1; - - if (pkt_size < rx_copybreak) { - struct sk_buff *skb; - - skb = RTL_ALLOC_SKB_INTR(&tp->r8125napi[ring->index].napi, pkt_size + RTK_RX_ALIGN); - if (skb) { - u8 *data; - - data = sk_buff[0]->data; - skb_reserve(skb, RTK_RX_ALIGN); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,37) - prefetch(data - RTK_RX_ALIGN); -#endif - eth_copy_and_sum(skb, data, pkt_size, 0); - *sk_buff = skb; - rtl8125_mark_to_asic(tp, desc, rx_buf_sz); - ret = 0; - } - } - return ret; -} - -static inline void -rtl8125_rx_skb(struct rtl8125_private *tp, - struct sk_buff *skb, - u32 ring_index) -{ -#ifdef CONFIG_R8125_NAPI -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29) - netif_receive_skb(skb); -#else - napi_gro_receive(&tp->r8125napi[ring_index].napi, skb); -#endif -#else - netif_rx(skb); -#endif -} - -static int -rtl8125_check_rx_desc_error(struct net_device *dev, - struct rtl8125_private *tp, - u32 status) -{ - int ret = 0; - - if (tp->InitRxDescType == RX_DESC_RING_TYPE_3) { - if (unlikely(status & RxRES_V3)) { - if (status & (RxRWT_V3 | RxRUNT_V3)) - RTLDEV->stats.rx_length_errors++; - if (status & RxCRC_V3) - RTLDEV->stats.rx_crc_errors++; - - ret = -1; - } - } else { - if (unlikely(status & RxRES)) { - if (status & (RxRWT | RxRUNT)) - RTLDEV->stats.rx_length_errors++; - if (status & RxCRC) - RTLDEV->stats.rx_crc_errors++; - - ret = -1; - } - } - - return ret; -} - -static int -rtl8125_rx_interrupt(struct net_device *dev, - struct rtl8125_private *tp, - struct rtl8125_rx_ring *ring, - napi_budget budget) -{ - unsigned int cur_rx, rx_left; - unsigned int delta, count = 0; - unsigned int entry; - struct RxDesc *desc; - u32 status; - u32 rx_quota; - u64 rx_buf_phy_addr; - u32 ring_index = ring->index; - - assert(dev != NULL); - assert(tp != NULL); - - if (ring->RxDescArray == NULL) - goto rx_out; - - rx_quota = RTL_RX_QUOTA(budget); - cur_rx = ring->cur_rx; - entry = cur_rx % ring->num_rx_desc; - desc = rtl8125_get_rxdesc(tp, ring->RxDescArray, entry); - rx_left = ring->num_rx_desc + ring->dirty_rx - cur_rx; - rx_left = rtl8125_rx_quota(rx_left, (u32)rx_quota); - - for (; rx_left > 0; rx_left--) { - rmb(); - status = le32_to_cpu(rtl8125_rx_desc_opts1(tp, desc)); - if (status & DescOwn) - break; - - if (unlikely(rtl8125_check_rx_desc_error(dev, tp, status) < 0)) { - if (netif_msg_rx_err(tp)) { - printk(KERN_INFO - "%s: Rx ERROR. status = %08x\n", - dev->name, status); - } - - RTLDEV->stats.rx_errors++; - - if (dev->features & NETIF_F_RXALL) - goto process_pkt; - - rtl8125_mark_to_asic(tp, desc, tp->rx_buf_sz); - } else { - struct sk_buff *skb; - int pkt_size; - -process_pkt: - if (likely(!(dev->features & NETIF_F_RXFCS))) - pkt_size = (status & 0x00003fff) - 4; - else - pkt_size = status & 0x00003fff; - - /* - * The driver does not support incoming fragmented - * frames. They are seen as a symptom of over-mtu - * sized frames. - */ - if (unlikely(rtl8125_fragmented_frame(tp, status))) { - RTLDEV->stats.rx_dropped++; - RTLDEV->stats.rx_length_errors++; - rtl8125_mark_to_asic(tp, desc, tp->rx_buf_sz); - continue; - } - - skb = ring->Rx_skbuff[entry]; - - if (!skb) - break; - -#ifdef ENABLE_PTP_SUPPORT - if (tp->EnablePtp) { - u8 desc_type; - - desc_type = rtl8125_rx_desc_type(status); - if (desc_type == RXDESC_TYPE_NEXT && rx_left > 0) { - u32 status_next; - struct RxDescV3 *desc_next; - unsigned int entry_next; - struct sk_buff *skb_next; - - entry_next = (cur_rx + 1) % ring->num_rx_desc; - desc_next = (struct RxDescV3 *)rtl8125_get_rxdesc(tp, ring->RxDescArray, entry_next); - rmb(); - status_next = le32_to_cpu(desc_next->RxDescNormalDDWord4.opts1); - if (unlikely(status_next & DescOwn)) { - udelay(1); - rmb(); - status_next = le32_to_cpu(desc_next->RxDescNormalDDWord4.opts1); - if (unlikely(status_next & DescOwn)) { - if (netif_msg_rx_err(tp)) { - printk(KERN_ERR - "%s: Rx Next Desc ERROR. status = %08x\n", - dev->name, status_next); - } - break; - } - } - - cur_rx++; - rx_left--; - desc_type = rtl8125_rx_desc_type(status_next); - if (desc_type == RXDESC_TYPE_PTP) - rtl8125_rx_ptp_pktstamp(tp, skb, desc_next); - else - WARN_ON(1); - - rx_buf_phy_addr = ring->RxDescPhyAddr[entry_next]; - dma_unmap_single(tp_to_dev(tp), rx_buf_phy_addr, - tp->rx_buf_sz, DMA_FROM_DEVICE); - skb_next = ring->Rx_skbuff[entry_next]; - dev_kfree_skb_any(skb_next); - ring->Rx_skbuff[entry_next] = NULL; - } else - WARN_ON(desc_type != RXDESC_TYPE_NORMAL); - } -#endif - rx_buf_phy_addr = ring->RxDescPhyAddr[entry]; - dma_sync_single_for_cpu(tp_to_dev(tp), - rx_buf_phy_addr, tp->rx_buf_sz, - DMA_FROM_DEVICE); - - if (rtl8125_try_rx_copy(tp, ring, &skb, pkt_size, - desc, tp->rx_buf_sz)) { - ring->Rx_skbuff[entry] = NULL; - dma_unmap_single(tp_to_dev(tp), rx_buf_phy_addr, - tp->rx_buf_sz, DMA_FROM_DEVICE); - } else { - dma_sync_single_for_device(tp_to_dev(tp), rx_buf_phy_addr, - tp->rx_buf_sz, DMA_FROM_DEVICE); - } - -#ifdef ENABLE_RSS_SUPPORT - rtl8125_rx_hash(tp, (struct RxDescV3 *)desc, skb); -#endif - - if (tp->cp_cmd & RxChkSum) - rtl8125_rx_csum(tp, skb, desc); - - skb->dev = dev; - skb_put(skb, pkt_size); - skb->protocol = eth_type_trans(skb, dev); - - if (skb->pkt_type == PACKET_MULTICAST) - RTLDEV->stats.multicast++; - - if (rtl8125_rx_vlan_skb(tp, desc, skb) < 0) - rtl8125_rx_skb(tp, skb, ring_index); - -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,11,0) - dev->last_rx = jiffies; -#endif //LINUX_VERSION_CODE < KERNEL_VERSION(4,11,0) - RTLDEV->stats.rx_bytes += pkt_size; - RTLDEV->stats.rx_packets++; - } - - cur_rx++; - entry = cur_rx % ring->num_rx_desc; - desc = rtl8125_get_rxdesc(tp, ring->RxDescArray, entry); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,37) - prefetch(desc); -#endif - } - - count = cur_rx - ring->cur_rx; - ring->cur_rx = cur_rx; - - delta = rtl8125_rx_fill(tp, ring, dev, ring->dirty_rx, ring->cur_rx, 1); - if (!delta && count && netif_msg_intr(tp)) - printk(KERN_INFO "%s: no Rx buffer allocated\n", dev->name); - ring->dirty_rx += delta; - - /* - * FIXME: until there is periodic timer to try and refill the ring, - * a temporary shortage may definitely kill the Rx process. - * - disable the asic to try and avoid an overflow and kick it again - * after refill ? - * - how do others driver handle this condition (Uh oh...). - */ - if ((ring->dirty_rx + ring->num_rx_desc == ring->cur_rx) && netif_msg_intr(tp)) - printk(KERN_EMERG "%s: Rx buffers exhausted\n", dev->name); - -rx_out: - return count; -} - -static bool -rtl8125_linkchg_interrupt(struct rtl8125_private *tp, u32 status) -{ - if (tp->HwCurrIsrVer == 2) - return status & ISRIMR_V2_LINKCHG; - - return status & LinkChg; -} - -/* - *The interrupt handler does all of the Rx thread work and cleans up after - *the Tx thread. - */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) -static irqreturn_t rtl8125_interrupt(int irq, void *dev_instance, struct pt_regs *regs) -#else -static irqreturn_t rtl8125_interrupt(int irq, void *dev_instance) -#endif -{ - struct r8125_napi *r8125napi = dev_instance; - struct rtl8125_private *tp = r8125napi->priv; - struct net_device *dev = tp->dev; - u32 status; - int handled = 0; - - do { - status = RTL_R32(tp, tp->isr_reg[0]); - - if (!(tp->features & (RTL_FEATURE_MSI | RTL_FEATURE_MSIX))) { - /* hotplug/major error/no more work/shared irq */ - if (!status) - break; - - if (status == 0xFFFFFFFF) - break; - - if (!(status & (tp->intr_mask | tp->timer_intr_mask))) - break; - } - - handled = 1; - -#if defined(RTL_USE_NEW_INTR_API) - if (!tp->irq_tbl[0].requested) - break; -#endif - rtl8125_disable_hw_interrupt(tp); - - RTL_W32(tp, tp->isr_reg[0], status&~RxFIFOOver); - - if (rtl8125_linkchg_interrupt(tp, status)) - rtl8125_schedule_linkchg_work(tp); - -#ifdef ENABLE_DASH_SUPPORT - if (tp->DASH) { - if (HW_DASH_SUPPORT_TYPE_3(tp)) { - u8 DashIntType2Status; - - if (status & ISRIMR_DASH_INTR_CMAC_RESET) - tp->CmacResetIntr = TRUE; - - DashIntType2Status = RTL_CMAC_R8(tp, CMAC_IBISR0); - if (DashIntType2Status & ISRIMR_DASH_TYPE2_ROK) { - tp->RcvFwDashOkEvt = TRUE; - } - if (DashIntType2Status & ISRIMR_DASH_TYPE2_TOK) { - tp->SendFwHostOkEvt = TRUE; - } - if (DashIntType2Status & ISRIMR_DASH_TYPE2_RX_DISABLE_IDLE) { - tp->DashFwDisableRx = TRUE; - } - - RTL_CMAC_W8(tp, CMAC_IBISR0, DashIntType2Status); - } - } -#endif - -#ifdef CONFIG_R8125_NAPI - if (status & tp->intr_mask || tp->keep_intr_cnt-- > 0) { - if (status & tp->intr_mask) - tp->keep_intr_cnt = RTK_KEEP_INTERRUPT_COUNT; - - if (likely(RTL_NETIF_RX_SCHEDULE_PREP(dev, &tp->r8125napi[0].napi))) - __RTL_NETIF_RX_SCHEDULE(dev, &tp->r8125napi[0].napi); - else if (netif_msg_intr(tp)) - printk(KERN_INFO "%s: interrupt %04x in poll\n", - dev->name, status); - } else { - tp->keep_intr_cnt = RTK_KEEP_INTERRUPT_COUNT; - rtl8125_switch_to_hw_interrupt(tp); - } -#else - if (status & tp->intr_mask || tp->keep_intr_cnt-- > 0) { - u32 budget = ~(u32)0; - int i; - - if (status & tp->intr_mask) - tp->keep_intr_cnt = RTK_KEEP_INTERRUPT_COUNT; - - for (i = 0; i < tp->num_tx_rings; i++) - rtl8125_tx_interrupt(&tp->tx_ring[i], ~(u32)0); - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) - rtl8125_rx_interrupt(dev, tp, &tp->rx_ring[0], &budget); -#else - rtl8125_rx_interrupt(dev, tp, &tp->rx_ring[0], budget); -#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) - -#ifdef ENABLE_DASH_SUPPORT - if (tp->DASH) { - struct net_device *dev = tp->dev; - - HandleDashInterrupt(dev); - } -#endif - - rtl8125_switch_to_timer_interrupt(tp); - } else { - tp->keep_intr_cnt = RTK_KEEP_INTERRUPT_COUNT; - rtl8125_switch_to_hw_interrupt(tp); - } -#endif - } while (false); - - return IRQ_RETVAL(handled); -} - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) -static irqreturn_t rtl8125_interrupt_msix(int irq, void *dev_instance, struct pt_regs *regs) -#else -static irqreturn_t rtl8125_interrupt_msix(int irq, void *dev_instance) -#endif -{ - struct r8125_napi *r8125napi = dev_instance; - struct rtl8125_private *tp = r8125napi->priv; - struct net_device *dev = tp->dev; - int message_id = r8125napi->index; -#ifndef CONFIG_R8125_NAPI - u32 budget = ~(u32)0; -#endif - - do { -#if defined(RTL_USE_NEW_INTR_API) - if (!tp->irq_tbl[message_id].requested) - break; -#endif - rtl8125_disable_hw_interrupt_v2(tp, message_id); - - rtl8125_clear_hw_isr_v2(tp, message_id); - - //link change - if (message_id == 21) { - rtl8125_schedule_linkchg_work(tp); - break; - } - -#ifdef CONFIG_R8125_NAPI - if (likely(RTL_NETIF_RX_SCHEDULE_PREP(dev, &r8125napi->napi))) - __RTL_NETIF_RX_SCHEDULE(dev, &r8125napi->napi); - else if (netif_msg_intr(tp)) - printk(KERN_INFO "%s: interrupt message id %d in poll_msix\n", - dev->name, message_id); -#else - rtl8125_tx_interrupt_with_vector(tp, message_id, ~(u32)0); - - if (message_id < tp->num_rx_rings) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) - rtl8125_rx_interrupt(dev, tp, &tp->rx_ring[message_id], &budget); -#else - rtl8125_rx_interrupt(dev, tp, &tp->rx_ring[message_id], budget); -#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) - } - - rtl8125_enable_hw_interrupt_v2(tp, message_id); -#endif - - } while (false); - - return IRQ_HANDLED; -} - -static void rtl8125_down(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - //rtl8125_delete_esd_timer(dev, &tp->esd_timer); - - //rtl8125_delete_link_timer(dev, &tp->link_timer); - - netif_tx_disable(dev); - - _rtl8125_wait_for_quiescence(dev); - - netif_carrier_off(dev); - - rtl8125_hw_reset(dev); - - rtl8125_tx_clear(tp); - - rtl8125_rx_clear(tp); -} - -static int rtl8125_resource_freed(struct rtl8125_private *tp) -{ - int i; - - for (i = 0; i < tp->num_tx_rings; i++) - if (tp->tx_ring[i].TxDescArray) return 0; - - for (i = 0; i < tp->num_rx_rings; i++) - if (tp->rx_ring[i].RxDescArray) return 0; - - return 1; -} - -int rtl8125_close(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - if (!rtl8125_resource_freed(tp)) { - set_bit(R8125_FLAG_DOWN, tp->task_flags); - - rtl8125_down(dev); - - pci_clear_master(tp->pci_dev); - -#ifdef ENABLE_PTP_SUPPORT - rtl8125_ptp_stop(tp); -#endif - rtl8125_hw_d3_para(dev); - - rtl8125_powerdown_pll(dev, 0); - - rtl8125_free_irq(tp); - - rtl8125_free_alloc_resources(tp); - } else { - rtl8125_hw_d3_para(dev); - - rtl8125_powerdown_pll(dev, 0); - } - - return 0; -} - -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,11) -static void rtl8125_shutdown(struct pci_dev *pdev) -{ - struct net_device *dev = pci_get_drvdata(pdev); - struct rtl8125_private *tp = netdev_priv(dev); - - rtnl_lock(); - - if (tp->DASH) - rtl8125_driver_stop(tp); - - rtl8125_set_bios_setting(dev); - if (s5_keep_curr_mac == 0 && tp->random_mac == 0) - rtl8125_rar_set(tp, tp->org_mac_addr); - - if (s5wol == 0) - tp->wol_enabled = WOL_DISABLED; - - rtl8125_close(dev); - rtl8125_disable_msi(pdev, tp); - - rtnl_unlock(); - - if (system_state == SYSTEM_POWER_OFF) { - pci_clear_master(tp->pci_dev); - pci_wake_from_d3(pdev, tp->wol_enabled); - pci_set_power_state(pdev, PCI_D3hot); - } -} -#endif - -/** - * rtl8125_get_stats - Get rtl8125 read/write statistics - * @dev: The Ethernet Device to get statistics for - * - * Get TX/RX statistics for rtl8125 - */ -static struct -net_device_stats *rtl8125_get_stats(struct net_device *dev) -{ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) - struct rtl8125_private *tp = netdev_priv(dev); -#endif - return &RTLDEV->stats; -} - -#ifdef CONFIG_PM - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11) -static int -rtl8125_suspend(struct pci_dev *pdev, u32 state) -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29) -static int -rtl8125_suspend(struct device *device) -#else -static int -rtl8125_suspend(struct pci_dev *pdev, pm_message_t state) -#endif -{ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29) - struct pci_dev *pdev = to_pci_dev(device); - struct net_device *dev = pci_get_drvdata(pdev); -#else - struct net_device *dev = pci_get_drvdata(pdev); -#endif - struct rtl8125_private *tp = netdev_priv(dev); -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) - u32 pci_pm_state = pci_choose_state(pdev, state); -#endif - if (!netif_running(dev)) - goto out; - - //rtl8125_cancel_all_schedule_work(tp); - - //rtl8125_delete_esd_timer(dev, &tp->esd_timer); - - //rtl8125_delete_link_timer(dev, &tp->link_timer); - - rtnl_lock(); - - set_bit(R8125_FLAG_DOWN, tp->task_flags); - - netif_tx_disable(dev); - - netif_carrier_off(dev); - - netif_device_detach(dev); - -#ifdef ENABLE_PTP_SUPPORT - rtl8125_ptp_suspend(tp); -#endif - rtl8125_hw_reset(dev); - - pci_clear_master(pdev); - - rtl8125_hw_d3_para(dev); - - rtl8125_powerdown_pll(dev, 1); - - if (tp->DASH) - rtl8125_driver_stop(tp); - - rtnl_unlock(); -out: - - pci_disable_device(pdev); - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) - pci_save_state(pdev, &pci_pm_state); -#else - pci_save_state(pdev); -#endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29) - pci_enable_wake(pdev, pci_choose_state(pdev, state), tp->wol_enabled); -#endif - - pci_prepare_to_sleep(pdev); - - return 0; -} - -static int -rtl8125_hw_d3_not_power_off(struct net_device *dev) -{ - return rtl8125_check_hw_phy_mcu_code_ver(dev); -} - -static int rtl8125_wait_phy_nway_complete_sleep(struct rtl8125_private *tp) -{ - int i, val; - - for (i = 0; i < 30; i++) { - val = rtl8125_mdio_read(tp, MII_BMSR) & BMSR_ANEGCOMPLETE; - if (val) - return 0; - - msleep(100); - } - - return -1; -} - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29) -static int -rtl8125_resume(struct pci_dev *pdev) -#else -static int -rtl8125_resume(struct device *device) -#endif -{ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29) - struct pci_dev *pdev = to_pci_dev(device); - struct net_device *dev = pci_get_drvdata(pdev); -#else - struct net_device *dev = pci_get_drvdata(pdev); -#endif - struct rtl8125_private *tp = netdev_priv(dev); -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) - u32 pci_pm_state = PCI_D0; -#endif - u32 err; - - rtnl_lock(); - - err = pci_enable_device(pdev); - if (err) { - dev_err(&pdev->dev, "Cannot enable PCI device from suspend\n"); - goto out_unlock; - } -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) - pci_restore_state(pdev, &pci_pm_state); -#else - pci_restore_state(pdev); -#endif - pci_enable_wake(pdev, PCI_D0, 0); - - /* restore last modified mac address */ - rtl8125_rar_set(tp, dev->dev_addr); - - tp->resume_not_chg_speed = 0; - if (tp->check_keep_link_speed && - //tp->link_ok(dev) && - rtl8125_hw_d3_not_power_off(dev) && - rtl8125_wait_phy_nway_complete_sleep(tp) == 0) - tp->resume_not_chg_speed = 1; - - if (!netif_running(dev)) - goto out_unlock; - - pci_set_master(pdev); - - rtl8125_exit_oob(dev); - - rtl8125_up(dev); - - clear_bit(R8125_FLAG_DOWN, tp->task_flags); - - rtl8125_schedule_reset_work(tp); - - rtl8125_schedule_esd_work(tp); - - //mod_timer(&tp->esd_timer, jiffies + RTL8125_ESD_TIMEOUT); - //mod_timer(&tp->link_timer, jiffies + RTL8125_LINK_TIMEOUT); -out_unlock: - netif_device_attach(dev); - - rtnl_unlock(); - - return err; -} - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29) - -static struct dev_pm_ops rtl8125_pm_ops = { - .suspend = rtl8125_suspend, - .resume = rtl8125_resume, - .freeze = rtl8125_suspend, - .thaw = rtl8125_resume, - .poweroff = rtl8125_suspend, - .restore = rtl8125_resume, -}; - -#define RTL8125_PM_OPS (&rtl8125_pm_ops) - -#endif - -#else /* !CONFIG_PM */ - -#define RTL8125_PM_OPS NULL - -#endif /* CONFIG_PM */ - -static struct pci_driver rtl8125_pci_driver = { - .name = MODULENAME, - .id_table = rtl8125_pci_tbl, - .probe = rtl8125_init_one, - .remove = __devexit_p(rtl8125_remove_one), -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,11) - .shutdown = rtl8125_shutdown, -#endif -#ifdef CONFIG_PM -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29) - .suspend = rtl8125_suspend, - .resume = rtl8125_resume, -#else - .driver.pm = RTL8125_PM_OPS, -#endif -#endif -}; - -static int __init -rtl8125_init_module(void) -{ - int ret = 0; -#ifdef ENABLE_R8125_PROCFS - rtl8125_proc_module_init(); -#endif - -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - - ret = pci_register_driver(&rtl8125_pci_driver); -#else - ret = pci_module_init(&rtl8125_pci_driver); -#endif - - return ret; -} - -static void __exit -rtl8125_cleanup_module(void) -{ - pci_unregister_driver(&rtl8125_pci_driver); - -#ifdef ENABLE_R8125_PROCFS - if (rtl8125_proc) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) - remove_proc_subtree(MODULENAME, init_net.proc_net); -#else -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32) - remove_proc_entry(MODULENAME, init_net.proc_net); -#else - remove_proc_entry(MODULENAME, proc_net); -#endif //LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32) -#endif //LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) - rtl8125_proc = NULL; - } -#endif -} - -module_init(rtl8125_init_module); -module_exit(rtl8125_cleanup_module); diff --git a/package/kernel/r8125/src/r8125_ptp.c b/package/kernel/r8125/src/r8125_ptp.c deleted file mode 100644 index 6010a1809c..0000000000 --- a/package/kernel/r8125/src/r8125_ptp.c +++ /dev/null @@ -1,594 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* -################################################################################ -# -# r8125 is the Linux device driver released for Realtek 2.5Gigabit Ethernet -# controllers with PCI-Express interface. -# -# Copyright(c) 2022 Realtek Semiconductor Corp. All rights reserved. -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the Free -# Software Foundation; either version 2 of the License, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -# more details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, see . -# -# Author: -# Realtek NIC software team -# No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan -# -################################################################################ -*/ - -/************************************************************************************ - * This product is covered by one or more of the following patents: - * US6,570,884, US6,115,776, and US6,327,625. - ***********************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "r8125.h" -#include "r8125_ptp.h" - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0) -static inline struct timespec timespec64_to_timespec(const struct timespec64 ts64) -{ - return *(const struct timespec *)&ts64; -} - -static inline struct timespec64 timespec_to_timespec64(const struct timespec ts) -{ - return *(const struct timespec64 *)&ts; -} -#endif - -static int _rtl8125_phc_gettime(struct rtl8125_private *tp, struct timespec64 *ts64) -{ - //get local time - RTL_W16(tp, PTP_TIME_CORRECT_CMD_8125, (PTP_CMD_LATCHED_LOCAL_TIME | PTP_EXEC_CMD)); - - /* nanoseconds */ - //0x6808[29:0] - ts64->tv_nsec = (RTL_R32(tp, PTP_SOFT_CONFIG_Time_NS_8125) & 0x3fffffff) + - tp->ptp_adjust; - - /* seconds */ - //0x680C[47:0] - ts64->tv_sec = RTL_R16(tp, PTP_SOFT_CONFIG_Time_S_8125 + 4); - ts64->tv_sec <<= 32; - ts64->tv_sec |= RTL_R32(tp, PTP_SOFT_CONFIG_Time_S_8125); - - return 0; -} - -static int _rtl8125_phc_settime(struct rtl8125_private *tp, const struct timespec64 *ts64) -{ - /* nanoseconds */ - //0x6808[29:0] - RTL_W32(tp, PTP_SOFT_CONFIG_Time_NS_8125, (ts64->tv_nsec & 0x3fffffff)); - - /* seconds */ - //0x680C[47:0] - RTL_W32(tp, PTP_SOFT_CONFIG_Time_S_8125, ts64->tv_sec); - RTL_W16(tp, PTP_SOFT_CONFIG_Time_S_8125 + 4, (ts64->tv_sec >> 32)); - - //set local time - RTL_W16(tp, PTP_TIME_CORRECT_CMD_8125, (PTP_CMD_SET_LOCAL_TIME | PTP_EXEC_CMD)); - - return 0; -} - -#if 0 -static int _rtl8125_phc_adjtime(struct rtl8125_private *tp, s64 delta) -{ - struct timespec64 now, then = ns_to_timespec64(delta); - u32 nsec; - u64 sec; - - _rtl8125_phc_gettime(tp, &now); - now = timespec64_add(now, then); - - nsec = now.tv_nsec & 0x3fffffff; - sec = now.tv_sec & 0x0000ffffffffffff; - - /* nanoseconds */ - //0x6808[29:0] - RTL_W32(tp, PTP_SOFT_CONFIG_Time_NS_8125, nsec); - - /* seconds */ - //0x680C[47:0] - RTL_W32(tp, PTP_SOFT_CONFIG_Time_S_8125, sec); - RTL_W16(tp, PTP_SOFT_CONFIG_Time_S_8125 + 4, (sec >> 32)); - - //adjust local time - //RTL_W16(tp, PTP_TIME_CORRECT_CMD_8125, (PTP_CMD_DRIFT_LOCAL_TIME | PTP_EXEC_CMD)); - RTL_W16(tp, PTP_TIME_CORRECT_CMD_8125, (PTP_CMD_SET_LOCAL_TIME | PTP_EXEC_CMD)); - - return 0; -} -#endif - -static int rtl8125_phc_adjtime(struct ptp_clock_info *ptp, s64 delta) -{ - struct rtl8125_private *tp = container_of(ptp, struct rtl8125_private, ptp_clock_info); - unsigned long flags; - //int ret = 0; - - //netif_info(tp, drv, tp->dev, "phc adjust time\n"); - - spin_lock_irqsave(&tp->lock, flags); - //ret = _rtl8125_phc_adjtime(tp, delta); - tp->ptp_adjust += delta; - spin_unlock_irqrestore(&tp->lock, flags); - - return 0; -} - -/* -1ppm means every 125MHz plus 125Hz. It also means every 8ns minus 8ns*10^(-6) - -1ns=2^30 sub_ns - -8ns*10^(-6) = 8 * 2^30 sub_ns * 10^(-6) = 2^33 sub_ns * 10^(-6) = 8590 = 0x218E sub_ns - -1ppb means every 125MHz plus 0.125Hz. It also means every 8ns minus 8ns*10^(-9) - -1ns=2^30 sub_ns - -8ns*10^(-9) = 8 * 2^30 sub_ns * 10^(-9) = 2^33 sub_ns * 10^(-9) = 8.59 sub_ns = 9 sub_ns -*/ -static int _rtl8125_phc_adjfreq(struct ptp_clock_info *ptp, s32 ppb) -{ - struct rtl8125_private *tp = container_of(ptp, struct rtl8125_private, ptp_clock_info); - bool negative = false; - u32 sub_ns; - - if (ppb < 0) { - negative = true; - ppb = -ppb; - } - - sub_ns = ppb * 9; - if (negative) { - sub_ns = -sub_ns; - sub_ns &= 0x3fffffff; - sub_ns |= PTP_ADJUST_TIME_NS_NEGATIVE; - } else - sub_ns &= 0x3fffffff; - - /* nanoseconds */ - //0x6808[29:0] - RTL_W32(tp, PTP_SOFT_CONFIG_Time_NS_8125, sub_ns); - - //adjust local time - RTL_W16(tp, PTP_TIME_CORRECT_CMD_8125, (PTP_CMD_DRIFT_LOCAL_TIME | PTP_EXEC_CMD)); - //RTL_W16(tp, PTP_TIME_CORRECT_CMD_8125, (PTP_CMD_SET_LOCAL_TIME | PTP_EXEC_CMD)); - - return 0; -} - -static int rtl8125_phc_adjfreq(struct ptp_clock_info *ptp, s32 delta) -{ - //struct rtl8125_private *tp = container_of(ptp, struct rtl8125_private, ptp_clock_info); - - //netif_info(tp, drv, tp->dev, "phc adjust freq\n"); - - if (delta > ptp->max_adj || delta < -ptp->max_adj) - return -EINVAL; - - _rtl8125_phc_adjfreq(ptp, delta); - - return 0; -} - -static int rtl8125_phc_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts64) -{ - struct rtl8125_private *tp = container_of(ptp, struct rtl8125_private, ptp_clock_info); - unsigned long flags; - int ret; - - //netif_info(tp, drv, tp->dev, "phc get ts\n"); - - spin_lock_irqsave(&tp->lock, flags); - ret = _rtl8125_phc_gettime(tp, ts64); - spin_unlock_irqrestore(&tp->lock, flags); - - return ret; -} - -static int rtl8125_phc_settime(struct ptp_clock_info *ptp, - const struct timespec64 *ts64) -{ - struct rtl8125_private *tp = container_of(ptp, struct rtl8125_private, ptp_clock_info); - unsigned long flags; - int ret; - - //netif_info(tp, drv, tp->dev, "phc set ts\n"); - - spin_lock_irqsave(&tp->lock, flags); - ret = _rtl8125_phc_settime(tp, ts64); - tp->ptp_adjust = 0; - spin_unlock_irqrestore(&tp->lock, flags); - - return ret; -} - -static int rtl8125_phc_enable(struct ptp_clock_info *ptp, - struct ptp_clock_request *rq, int on) -{ - struct rtl8125_private *tp = container_of(ptp, struct rtl8125_private, ptp_clock_info); - unsigned long flags; - u16 ptp_ctrl; - - //netif_info(tp, drv, tp->dev, "phc enable type %x on %d\n", rq->type, on); - - switch (rq->type) { - case PTP_CLK_REQ_PPS: - spin_lock_irqsave(&tp->lock, flags); - ptp_ctrl = RTL_R16(tp, PTP_CTRL_8125); - ptp_ctrl &= ~BIT_15; - if (on) - ptp_ctrl |= BIT_14; - else - ptp_ctrl &= ~BIT_14; - RTL_W16(tp, PTP_CTRL_8125, ptp_ctrl); - spin_unlock_irqrestore(&tp->lock, flags); - return 0; - default: - return -EOPNOTSUPP; - } -} - -int rtl8125_get_ts_info(struct net_device *netdev, - struct ethtool_ts_info *info) -{ - struct rtl8125_private *tp = netdev_priv(netdev); - - /* we always support timestamping disabled */ - info->rx_filters = BIT(HWTSTAMP_FILTER_NONE); - - if (tp->HwSuppPtpVer == 0) - return ethtool_op_get_ts_info(netdev, info); - - info->so_timestamping = SOF_TIMESTAMPING_TX_SOFTWARE | - SOF_TIMESTAMPING_RX_SOFTWARE | - SOF_TIMESTAMPING_SOFTWARE | - SOF_TIMESTAMPING_TX_HARDWARE | - SOF_TIMESTAMPING_RX_HARDWARE | - SOF_TIMESTAMPING_RAW_HARDWARE; - - if (tp->ptp_clock) - info->phc_index = ptp_clock_index(tp->ptp_clock); - else - info->phc_index = -1; - - info->tx_types = BIT(HWTSTAMP_TX_OFF) | BIT(HWTSTAMP_TX_ON); - - info->rx_filters = BIT(HWTSTAMP_FILTER_NONE) | - BIT(HWTSTAMP_FILTER_PTP_V2_EVENT) | - BIT(HWTSTAMP_FILTER_PTP_V2_L4_EVENT) | - BIT(HWTSTAMP_FILTER_PTP_V2_SYNC) | - BIT(HWTSTAMP_FILTER_PTP_V2_L4_SYNC) | - BIT(HWTSTAMP_FILTER_PTP_V2_DELAY_REQ) | - BIT(HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ); - - return 0; -} - -static const struct ptp_clock_info rtl_ptp_clock_info = { - .owner = THIS_MODULE, - .n_alarm = 0, - .n_ext_ts = 0, - .n_per_out = 0, - .n_pins = 0, - .pps = 1, - .adjfreq = rtl8125_phc_adjfreq, - .adjtime = rtl8125_phc_adjtime, - .gettime64 = rtl8125_phc_gettime, - .settime64 = rtl8125_phc_settime, - .enable = rtl8125_phc_enable, -}; - -static int rtl8125_get_tx_ptp_pkt_tstamp(struct rtl8125_private *tp, struct timespec64 *ts64) -{ - return _rtl8125_phc_gettime(tp, ts64); -} - -static void rtl8125_ptp_tx_hwtstamp(struct rtl8125_private *tp) -{ - struct sk_buff *skb = tp->ptp_tx_skb; - struct skb_shared_hwtstamps shhwtstamps = {0}; - struct timespec64 ts64; - - RTL_W8(tp, PTP_ISR_8125, PTP_ISR_TOK | PTP_ISR_TER); - - rtl8125_get_tx_ptp_pkt_tstamp(tp, &ts64); - - /* Upper 32 bits contain s, lower 32 bits contain ns. */ - shhwtstamps.hwtstamp = ktime_set(ts64.tv_sec, - ts64.tv_nsec); - - /* Clear the lock early before calling skb_tstamp_tx so that - * applications are not woken up before the lock bit is clear. We use - * a copy of the skb pointer to ensure other threads can't change it - * while we're notifying the stack. - */ - tp->ptp_tx_skb = NULL; - - /* Notify the stack and free the skb after we've unlocked */ - skb_tstamp_tx(skb, &shhwtstamps); - dev_kfree_skb_any(skb); -} - -#define RTL8125_PTP_TX_TIMEOUT (HZ * 15) -static void rtl8125_ptp_tx_work(struct work_struct *work) -{ - struct rtl8125_private *tp = container_of(work, struct rtl8125_private, - ptp_tx_work); - unsigned long flags; - - spin_lock_irqsave(&tp->lock, flags); - - if (!tp->ptp_tx_skb) - goto Exit; - - if (time_is_before_jiffies(tp->ptp_tx_start + - RTL8125_PTP_TX_TIMEOUT)) { - dev_kfree_skb_any(tp->ptp_tx_skb); - tp->ptp_tx_skb = NULL; - tp->tx_hwtstamp_timeouts++; - /* Clear the tx valid bit in TSYNCTXCTL register to enable - * interrupt - */ - RTL_W8(tp, PTP_ISR_8125, PTP_ISR_TOK | PTP_ISR_TER); - goto Exit; - } - - if (RTL_R8(tp, PTP_ISR_8125) & (PTP_ISR_TOK)) - rtl8125_ptp_tx_hwtstamp(tp); - else - /* reschedule to check later */ - schedule_work(&tp->ptp_tx_work); - -Exit: - spin_unlock_irqrestore(&tp->lock, flags); -} - -static int rtl8125_hwtstamp_enable(struct rtl8125_private *tp, bool enable) -{ - RTL_W16(tp, PTP_CTRL_8125, 0); - if (enable) { - u16 ptp_ctrl; - struct timespec64 ts64; - - //clear ptp isr - RTL_W8(tp, PTP_ISR_8125, 0xff); - //ptp source 0:gphy 1:mac - rtl8125_mac_ocp_write(tp, 0xDC00, rtl8125_mac_ocp_read(tp, 0xDC00) | BIT_6); - //enable ptp - ptp_ctrl = (BIT_0 | BIT_3 | BIT_4 | BIT_6 | BIT_10 | BIT_12 | BIT_13); - if (tp->ptp_master_mode) { - ptp_ctrl &= ~BIT_13; - ptp_ctrl |= BIT_1; - } - RTL_W16(tp, PTP_CTRL_8125, ptp_ctrl); - - //set system time - /* - if (ktime_to_timespec64_cond(ktime_get_real(), &ts64)) - _rtl8125_phc_settime(tp, timespec64_to_timespec(ts64)); - */ - ktime_get_real_ts64(&ts64); - ts64.tv_nsec += tp->ptp_adjust; - _rtl8125_phc_settime(tp, &ts64); - tp->ptp_adjust = 0; - } - - return 0; -} - -static long rtl8125_ptp_create_clock(struct rtl8125_private *tp) -{ - struct net_device *netdev = tp->dev; - long err; - - if (!IS_ERR_OR_NULL(tp->ptp_clock)) - return 0; - - if (tp->HwSuppPtpVer == 0) { - tp->ptp_clock = NULL; - return -EOPNOTSUPP; - } - - tp->ptp_clock_info = rtl_ptp_clock_info; - snprintf(tp->ptp_clock_info.name, sizeof(tp->ptp_clock_info.name), - "%pm", tp->dev->dev_addr); - tp->ptp_clock_info.max_adj = 119304647; - tp->ptp_clock = ptp_clock_register(&tp->ptp_clock_info, &tp->pci_dev->dev); - if (IS_ERR(tp->ptp_clock)) { - err = PTR_ERR(tp->ptp_clock); - tp->ptp_clock = NULL; - netif_err(tp, drv, tp->dev, "ptp_clock_register failed\n"); - return err; - } else - netif_info(tp, drv, tp->dev, "registered PHC device on %s\n", netdev->name); - - return 0; -} - -void rtl8125_ptp_reset(struct rtl8125_private *tp) -{ - if (!tp->ptp_clock) - return; - - netif_info(tp, drv, tp->dev, "reset PHC clock\n"); - - rtl8125_hwtstamp_enable(tp, false); -} - -void rtl8125_ptp_init(struct rtl8125_private *tp) -{ - /* obtain a PTP device, or re-use an existing device */ - if (rtl8125_ptp_create_clock(tp)) - return; - - /* we have a clock so we can initialize work now */ - INIT_WORK(&tp->ptp_tx_work, rtl8125_ptp_tx_work); - - tp->ptp_adjust = 0; - - /* reset the PTP related hardware bits */ - rtl8125_ptp_reset(tp); - - return; -} - -void rtl8125_ptp_suspend(struct rtl8125_private *tp) -{ - if (!tp->ptp_clock) - return; - - netif_info(tp, drv, tp->dev, "suspend PHC clock\n"); - - rtl8125_hwtstamp_enable(tp, false); - - /* ensure that we cancel any pending PTP Tx work item in progress */ - cancel_work_sync(&tp->ptp_tx_work); -} - -void rtl8125_ptp_stop(struct rtl8125_private *tp) -{ - struct net_device *netdev = tp->dev; - - netif_info(tp, drv, tp->dev, "stop PHC clock\n"); - - /* first, suspend PTP activity */ - rtl8125_ptp_suspend(tp); - - /* disable the PTP clock device */ - if (tp->ptp_clock) { - ptp_clock_unregister(tp->ptp_clock); - tp->ptp_clock = NULL; - netif_info(tp, drv, tp->dev, "removed PHC on %s\n", - netdev->name); - } -} - -static int rtl8125_set_tstamp(struct net_device *netdev, struct ifreq *ifr) -{ - struct rtl8125_private *tp = netdev_priv(netdev); - struct hwtstamp_config config; - bool hwtstamp = 0; - - //netif_info(tp, drv, tp->dev, "ptp set ts\n"); - - if (copy_from_user(&config, ifr->ifr_data, sizeof(config))) - return -EFAULT; - - if (config.flags) - return -EINVAL; - - switch (config.tx_type) { - case HWTSTAMP_TX_ON: - hwtstamp = 1; - case HWTSTAMP_TX_OFF: - break; - case HWTSTAMP_TX_ONESTEP_SYNC: - default: - return -ERANGE; - } - - switch (config.rx_filter) { - case HWTSTAMP_FILTER_PTP_V2_EVENT: - case HWTSTAMP_FILTER_PTP_V2_L2_EVENT: - case HWTSTAMP_FILTER_PTP_V2_L4_EVENT: - case HWTSTAMP_FILTER_PTP_V2_SYNC: - case HWTSTAMP_FILTER_PTP_V2_L2_SYNC: - case HWTSTAMP_FILTER_PTP_V2_L4_SYNC: - case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ: - case HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ: - case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ: - config.rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT; - hwtstamp = 1; - case HWTSTAMP_FILTER_NONE: - break; - default: - return -ERANGE; - } - - if (tp->hwtstamp_config.tx_type != config.tx_type || - tp->hwtstamp_config.rx_filter != config.rx_filter) { - tp->hwtstamp_config = config; - rtl8125_hwtstamp_enable(tp, hwtstamp); - } - - return copy_to_user(ifr->ifr_data, &config, - sizeof(config)) ? -EFAULT : 0; -} - -static int rtl8125_get_tstamp(struct net_device *netdev, struct ifreq *ifr) -{ - struct rtl8125_private *tp = netdev_priv(netdev); - - //netif_info(tp, drv, tp->dev, "ptp get ts\n"); - - return copy_to_user(ifr->ifr_data, &tp->hwtstamp_config, - sizeof(tp->hwtstamp_config)) ? -EFAULT : 0; -} - -int rtl8125_ptp_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) -{ - struct rtl8125_private *tp = netdev_priv(netdev); - int ret; - unsigned long flags; - - //netif_info(tp, drv, tp->dev, "ptp ioctl\n"); - - ret = 0; - switch (cmd) { -#ifdef ENABLE_PTP_SUPPORT - case SIOCSHWTSTAMP: - spin_lock_irqsave(&tp->lock, flags); - ret = rtl8125_set_tstamp(netdev, ifr); - spin_unlock_irqrestore(&tp->lock, flags); - break; - case SIOCGHWTSTAMP: - spin_lock_irqsave(&tp->lock, flags); - ret = rtl8125_get_tstamp(netdev, ifr); - spin_unlock_irqrestore(&tp->lock, flags); - break; -#endif - default: - ret = -EOPNOTSUPP; - break; - } - - return ret; -} - -void rtl8125_rx_ptp_pktstamp(struct rtl8125_private *tp, struct sk_buff *skb, - struct RxDescV3 *descv3) -{ - time64_t tv_sec; - long tv_nsec; - - tv_sec = le32_to_cpu(descv3->RxDescTimeStamp.TimeStampHigh) + - ((u64)le32_to_cpu(descv3->RxDescPTPDDWord4.TimeStampHHigh) << 32); - tv_nsec = le32_to_cpu(descv3->RxDescTimeStamp.TimeStampLow) + tp->ptp_adjust; - - skb_hwtstamps(skb)->hwtstamp = ktime_set(tv_sec, tv_nsec); -} diff --git a/package/kernel/r8125/src/r8125_ptp.h b/package/kernel/r8125/src/r8125_ptp.h deleted file mode 100644 index 7a1fe83b9a..0000000000 --- a/package/kernel/r8125/src/r8125_ptp.h +++ /dev/null @@ -1,81 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* -################################################################################ -# -# r8125 is the Linux device driver released for Realtek 2.5Gigabit Ethernet -# controllers with PCI-Express interface. -# -# Copyright(c) 2022 Realtek Semiconductor Corp. All rights reserved. -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the Free -# Software Foundation; either version 2 of the License, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -# more details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, see . -# -# Author: -# Realtek NIC software team -# No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan -# -################################################################################ -*/ - -/************************************************************************************ - * This product is covered by one or more of the following patents: - * US6,570,884, US6,115,776, and US6,327,625. - ***********************************************************************************/ - -#ifndef _LINUX_rtl8125_PTP_H -#define _LINUX_rtl8125_PTP_H - -#include -#include -#include -#include -#include - -struct rtl8125_ptp_info { - s64 time_sec; - u32 time_ns; - u16 ts_info; -}; - -#ifndef _STRUCT_TIMESPEC -#define _STRUCT_TIMESPEC -struct timespec { - __kernel_old_time_t tv_sec; /* seconds */ - long tv_nsec; /* nanoseconds */ -}; -#endif - -enum PTP_CMD_TYPE { - PTP_CMD_SET_LOCAL_TIME = 0, - PTP_CMD_DRIFT_LOCAL_TIME, - PTP_CMD_LATCHED_LOCAL_TIME, -}; - - -struct rtl8125_private; -struct RxDescV3; - -int rtl8125_get_ts_info(struct net_device *netdev, - struct ethtool_ts_info *info); - -void rtl8125_ptp_reset(struct rtl8125_private *tp); -void rtl8125_ptp_init(struct rtl8125_private *tp); -void rtl8125_ptp_suspend(struct rtl8125_private *tp); -void rtl8125_ptp_stop(struct rtl8125_private *tp); - -int rtl8125_ptp_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd); - -void rtl8125_rx_ptp_pktstamp(struct rtl8125_private *tp, struct sk_buff *skb, - struct RxDescV3 *descv3); - -#endif /* _LINUX_rtl8125_PTP_H */ diff --git a/package/kernel/r8125/src/r8125_realwow.h b/package/kernel/r8125/src/r8125_realwow.h deleted file mode 100644 index e5e9b46d61..0000000000 --- a/package/kernel/r8125/src/r8125_realwow.h +++ /dev/null @@ -1,118 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* -################################################################################ -# -# r8125 is the Linux device driver released for Realtek 2.5Gigabit Ethernet -# controllers with PCI-Express interface. -# -# Copyright(c) 2022 Realtek Semiconductor Corp. All rights reserved. -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the Free -# Software Foundation; either version 2 of the License, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -# more details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, see . -# -# Author: -# Realtek NIC software team -# No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan -# -################################################################################ -*/ - -/************************************************************************************ - * This product is covered by one or more of the following patents: - * US6,570,884, US6,115,776, and US6,327,625. - ***********************************************************************************/ - -#ifndef _LINUX_R8125_REALWOW_H -#define _LINUX_R8125_REALWOW_H - -#define SIOCDEVPRIVATE_RTLREALWOW SIOCDEVPRIVATE+3 - -#define MAX_RealWoW_KCP_SIZE (100) -#define MAX_RealWoW_Payload (64) - -#define KA_TX_PACKET_SIZE (100) -#define KA_WAKEUP_PATTERN_SIZE (120) - -//HwSuppKeepAliveOffloadVer -#define HW_SUPPORT_KCP_OFFLOAD(_M) ((_M)->HwSuppKCPOffloadVer > 0) - -enum rtl_realwow_cmd { - - RTL_REALWOW_SET_KCP_DISABLE=0, - RTL_REALWOW_SET_KCP_INFO, - RTL_REALWOW_SET_KCP_CONTENT, - - RTL_REALWOW_SET_KCP_ACKPKTINFO, - RTL_REALWOW_SET_KCP_WPINFO, - RTL_REALWOW_SET_KCPDHCP_TIMEOUT, - - RTLT_REALWOW_COMMAND_INVALID -}; - -struct rtl_realwow_ioctl_struct { - __u32 cmd; - __u32 offset; - __u32 len; - union { - __u32 data; - void *data_buffer; - }; -}; - -typedef struct _MP_KCPInfo { - u8 DIPv4[4]; - u8 MacID[6]; - u16 UdpPort[2]; - u8 PKTLEN[2]; - - u16 ackLostCnt; - u8 KCP_WakePattern[MAX_RealWoW_Payload]; - u8 KCP_AckPacket[MAX_RealWoW_Payload]; - u32 KCP_interval; - u8 KCP_WakePattern_Len; - u8 KCP_AckPacket_Len; - u8 KCP_TxPacket[2][KA_TX_PACKET_SIZE]; -} MP_KCP_INFO, *PMP_KCP_INFO; - -typedef struct _KCPInfo { - u32 nId; // = id - u8 DIPv4[4]; - u8 MacID[6]; - u16 UdpPort; - u16 PKTLEN; -} KCPInfo, *PKCPInfo; - -typedef struct _KCPContent { - u32 id; // = id - u32 mSec; // = msec - u32 size; // =size - u8 bPacket[MAX_RealWoW_KCP_SIZE]; // put packet here -} KCPContent, *PKCPContent; - -typedef struct _RealWoWAckPktInfo { - u16 ackLostCnt; - u16 patterntSize; - u8 pattern[MAX_RealWoW_Payload]; -} RealWoWAckPktInfo,*PRealWoWAckPktInfo; - -typedef struct _RealWoWWPInfo { - u16 patterntSize; - u8 pattern[MAX_RealWoW_Payload]; -} RealWoWWPInfo,*PRealWoWWPInfo; - -int rtl8125_realwow_ioctl(struct net_device *dev, struct ifreq *ifr); -void rtl8125_realwow_hw_init(struct net_device *dev); -void rtl8125_get_realwow_hw_version(struct net_device *dev); -void rtl8125_set_realwow_d3_para(struct net_device *dev); - -#endif /* _LINUX_R8125_REALWOW_H */ diff --git a/package/kernel/r8125/src/r8125_rss.c b/package/kernel/r8125/src/r8125_rss.c deleted file mode 100644 index 1f55c4477e..0000000000 --- a/package/kernel/r8125/src/r8125_rss.c +++ /dev/null @@ -1,481 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* -################################################################################ -# -# r8168 is the Linux device driver released for Realtek Gigabit Ethernet -# controllers with PCI-Express interface. -# -# Copyright(c) 2022 Realtek Semiconductor Corp. All rights reserved. -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the Free -# Software Foundation; either version 2 of the License, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -# more details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, see . -# -# Author: -# Realtek NIC software team -# No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan -# -################################################################################ -*/ - -/************************************************************************************ - * This product is covered by one or more of the following patents: - * US6,570,884, US6,115,776, and US6,327,625. - ***********************************************************************************/ - -#include -#include "r8125.h" - -enum rtl8125_rss_register_content { - /* RSS */ - RSS_CTRL_TCP_IPV4_SUPP = (1 << 0), - RSS_CTRL_IPV4_SUPP = (1 << 1), - RSS_CTRL_TCP_IPV6_SUPP = (1 << 2), - RSS_CTRL_IPV6_SUPP = (1 << 3), - RSS_HALF_SUPP = (1 << 7), - RSS_CTRL_UDP_IPV4_SUPP = (1 << 11), - RSS_CTRL_UDP_IPV6_SUPP = (1 << 12), - RSS_QUAD_CPU_EN = (1 << 16), - RSS_HQ_Q_SUP_R = (1 << 31), -}; - -static int rtl8125_get_rss_hash_opts(struct rtl8125_private *tp, - struct ethtool_rxnfc *cmd) -{ - cmd->data = 0; - - /* Report default options for RSS */ - switch (cmd->flow_type) { - case TCP_V4_FLOW: - cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; - /* fallthrough */ - case UDP_V4_FLOW: - if (tp->rss_flags & RTL_8125_RSS_FLAG_HASH_UDP_IPV4) - cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; - /* fallthrough */ - case IPV4_FLOW: - cmd->data |= RXH_IP_SRC | RXH_IP_DST; - break; - case TCP_V6_FLOW: - cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; - /* fallthrough */ - case UDP_V6_FLOW: - if (tp->rss_flags & RTL_8125_RSS_FLAG_HASH_UDP_IPV6) - cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; - /* fallthrough */ - case IPV6_FLOW: - cmd->data |= RXH_IP_SRC | RXH_IP_DST; - break; - default: - return -EINVAL; - } - - return 0; -} - -int rtl8125_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd, - u32 *rule_locs) -{ - struct rtl8125_private *tp = netdev_priv(dev); - int ret = -EOPNOTSUPP; - - netif_info(tp, drv, tp->dev, "rss get rxnfc\n"); - - if (!(dev->features & NETIF_F_RXHASH)) - return ret; - - switch (cmd->cmd) { - case ETHTOOL_GRXRINGS: - cmd->data = rtl8125_tot_rx_rings(tp); - ret = 0; - break; - case ETHTOOL_GRXFH: - ret = rtl8125_get_rss_hash_opts(tp, cmd); - break; - default: - break; - } - - return ret; -} - -u32 rtl8125_rss_indir_tbl_entries(struct rtl8125_private *tp) -{ - return tp->HwSuppIndirTblEntries; -} - -#define RSS_MASK_BITS_OFFSET (8) -#define RSS_CPU_NUM_OFFSET (16) -#define RTL8125_UDP_RSS_FLAGS (RTL_8125_RSS_FLAG_HASH_UDP_IPV4 | \ - RTL_8125_RSS_FLAG_HASH_UDP_IPV6) -static int _rtl8125_set_rss_hash_opt(struct rtl8125_private *tp) -{ - u32 rss_flags = tp->rss_flags; - u32 hash_mask_len; - u32 rss_ctrl; - - rss_ctrl = ilog2(rtl8125_tot_rx_rings(tp)); - rss_ctrl &= (BIT_0 | BIT_1 | BIT_2); - rss_ctrl <<= RSS_CPU_NUM_OFFSET; - - /* Perform hash on these packet types */ - rss_ctrl |= RSS_CTRL_TCP_IPV4_SUPP - | RSS_CTRL_IPV4_SUPP - | RSS_CTRL_IPV6_SUPP - | RSS_CTRL_TCP_IPV6_SUPP; - - if (rss_flags & RTL_8125_RSS_FLAG_HASH_UDP_IPV4) - rss_ctrl |= RSS_CTRL_UDP_IPV4_SUPP; - - if (rss_flags & RTL_8125_RSS_FLAG_HASH_UDP_IPV6) - rss_ctrl |= RSS_CTRL_UDP_IPV6_SUPP; - - hash_mask_len = ilog2(rtl8125_rss_indir_tbl_entries(tp)); - hash_mask_len &= (BIT_0 | BIT_1 | BIT_2); - rss_ctrl |= hash_mask_len << RSS_MASK_BITS_OFFSET; - - RTL_W32(tp, RSS_CTRL_8125, rss_ctrl); - - return 0; -} - -static int rtl8125_set_rss_hash_opt(struct rtl8125_private *tp, - struct ethtool_rxnfc *nfc) -{ - u32 rss_flags = tp->rss_flags; - - netif_info(tp, drv, tp->dev, "rss set hash\n"); - - /* - * RSS does not support anything other than hashing - * to queues on src and dst IPs and ports - */ - if (nfc->data & ~(RXH_IP_SRC | RXH_IP_DST | - RXH_L4_B_0_1 | RXH_L4_B_2_3)) - return -EINVAL; - - switch (nfc->flow_type) { - case TCP_V4_FLOW: - case TCP_V6_FLOW: - if (!(nfc->data & RXH_IP_SRC) || - !(nfc->data & RXH_IP_DST) || - !(nfc->data & RXH_L4_B_0_1) || - !(nfc->data & RXH_L4_B_2_3)) - return -EINVAL; - break; - case UDP_V4_FLOW: - if (!(nfc->data & RXH_IP_SRC) || - !(nfc->data & RXH_IP_DST)) - return -EINVAL; - switch (nfc->data & (RXH_L4_B_0_1 | RXH_L4_B_2_3)) { - case 0: - rss_flags &= ~RTL_8125_RSS_FLAG_HASH_UDP_IPV4; - break; - case (RXH_L4_B_0_1 | RXH_L4_B_2_3): - rss_flags |= RTL_8125_RSS_FLAG_HASH_UDP_IPV4; - break; - default: - return -EINVAL; - } - break; - case UDP_V6_FLOW: - if (!(nfc->data & RXH_IP_SRC) || - !(nfc->data & RXH_IP_DST)) - return -EINVAL; - switch (nfc->data & (RXH_L4_B_0_1 | RXH_L4_B_2_3)) { - case 0: - rss_flags &= ~RTL_8125_RSS_FLAG_HASH_UDP_IPV6; - break; - case (RXH_L4_B_0_1 | RXH_L4_B_2_3): - rss_flags |= RTL_8125_RSS_FLAG_HASH_UDP_IPV6; - break; - default: - return -EINVAL; - } - break; - case SCTP_V4_FLOW: - case AH_ESP_V4_FLOW: - case AH_V4_FLOW: - case ESP_V4_FLOW: - case SCTP_V6_FLOW: - case AH_ESP_V6_FLOW: - case AH_V6_FLOW: - case ESP_V6_FLOW: - case IP_USER_FLOW: - case ETHER_FLOW: - /* RSS is not supported for these protocols */ - if (nfc->data) { - netif_err(tp, drv, tp->dev, "Command parameters not supported\n"); - return -EINVAL; - } - return 0; - break; - default: - return -EINVAL; - } - - /* if we changed something we need to update flags */ - if (rss_flags != tp->rss_flags) { - u32 rss_ctrl = RTL_R32(tp, RSS_CTRL_8125); - - if ((rss_flags & RTL8125_UDP_RSS_FLAGS) && - !(tp->rss_flags & RTL8125_UDP_RSS_FLAGS)) - netdev_warn(tp->dev, - "enabling UDP RSS: fragmented packets may " - "arrive out of order to the stack above\n"); - - tp->rss_flags = rss_flags; - - /* Perform hash on these packet types */ - rss_ctrl |= RSS_CTRL_TCP_IPV4_SUPP - | RSS_CTRL_IPV4_SUPP - | RSS_CTRL_IPV6_SUPP - | RSS_CTRL_TCP_IPV6_SUPP; - - rss_ctrl &= ~(RSS_CTRL_UDP_IPV4_SUPP | - RSS_CTRL_UDP_IPV6_SUPP); - - if (rss_flags & RTL_8125_RSS_FLAG_HASH_UDP_IPV4) - rss_ctrl |= RSS_CTRL_UDP_IPV4_SUPP; - - if (rss_flags & RTL_8125_RSS_FLAG_HASH_UDP_IPV6) - rss_ctrl |= RSS_CTRL_UDP_IPV6_SUPP; - - RTL_W32(tp, RSS_CTRL_8125, rss_ctrl); - } - - return 0; -} - -int rtl8125_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd) -{ - struct rtl8125_private *tp = netdev_priv(dev); - int ret = -EOPNOTSUPP; - - netif_info(tp, drv, tp->dev, "rss set rxnfc\n"); - - if (!(dev->features & NETIF_F_RXHASH)) - return ret; - - switch (cmd->cmd) { - case ETHTOOL_SRXFH: - ret = rtl8125_set_rss_hash_opt(tp, cmd); - break; - default: - break; - } - - return ret; -} - -static u32 _rtl8125_get_rxfh_key_size(struct rtl8125_private *tp) -{ - return sizeof(tp->rss_key); -} - -u32 rtl8125_get_rxfh_key_size(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - netif_info(tp, drv, tp->dev, "rss get key size\n"); - - if (!(dev->features & NETIF_F_RXHASH)) - return 0; - - return _rtl8125_get_rxfh_key_size(tp); -} - -u32 rtl8125_rss_indir_size(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - netif_info(tp, drv, tp->dev, "rss get indir tbl size\n"); - - if (!(dev->features & NETIF_F_RXHASH)) - return 0; - - return rtl8125_rss_indir_tbl_entries(tp); -} - -static void rtl8125_get_reta(struct rtl8125_private *tp, u32 *indir) -{ - int i, reta_size = rtl8125_rss_indir_tbl_entries(tp); - - for (i = 0; i < reta_size; i++) - indir[i] = tp->rss_indir_tbl[i]; -} - -int rtl8125_get_rxfh(struct net_device *dev, u32 *indir, u8 *key, - u8 *hfunc) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - netif_info(tp, drv, tp->dev, "rss get rxfh\n"); - - if (!(dev->features & NETIF_F_RXHASH)) - return -EOPNOTSUPP; - - if (hfunc) - *hfunc = ETH_RSS_HASH_TOP; - - if (indir) - rtl8125_get_reta(tp, indir); - - if (key) - memcpy(key, tp->rss_key, rtl8125_get_rxfh_key_size(dev)); - - return 0; -} - -static u32 rtl8125_rss_key_reg(struct rtl8125_private *tp) -{ - return RSS_KEY_8125; -} - -static u32 rtl8125_rss_indir_tbl_reg(struct rtl8125_private *tp) -{ - return RSS_INDIRECTION_TBL_8125_V2; -} - -static void rtl8125_store_reta(struct rtl8125_private *tp) -{ - u16 indir_tbl_reg = rtl8125_rss_indir_tbl_reg(tp); - u32 i, reta_entries = rtl8125_rss_indir_tbl_entries(tp); - u32 reta = 0; - u8 *indir_tbl = tp->rss_indir_tbl; - - /* Write redirection table to HW */ - for (i = 0; i < reta_entries; i++) { - reta |= indir_tbl[i] << (i & 0x3) * 8; - if ((i & 3) == 3) { - RTL_W32(tp, indir_tbl_reg, reta); - - indir_tbl_reg += 4; - reta = 0; - } - } -} - -static void rtl8125_store_rss_key(struct rtl8125_private *tp) -{ - const u16 rss_key_reg = rtl8125_rss_key_reg(tp); - u32 i, rss_key_size = _rtl8125_get_rxfh_key_size(tp); - u32 *rss_key = (u32*)tp->rss_key; - - /* Write redirection table to HW */ - for (i = 0; i < rss_key_size; i+=4) - RTL_W32(tp, rss_key_reg + i, *rss_key++); -} - -int rtl8125_set_rxfh(struct net_device *dev, const u32 *indir, - const u8 *key, const u8 hfunc) -{ - struct rtl8125_private *tp = netdev_priv(dev); - int i; - u32 reta_entries = rtl8125_rss_indir_tbl_entries(tp); - - netif_info(tp, drv, tp->dev, "rss set rxfh\n"); - - /* We require at least one supported parameter to be changed and no - * change in any of the unsupported parameters - */ - if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP) - return -EOPNOTSUPP; - - /* Fill out the redirection table */ - if (indir) { - int max_queues = tp->num_rx_rings; - - /* Verify user input. */ - for (i = 0; i < reta_entries; i++) - if (indir[i] >= max_queues) - return -EINVAL; - - for (i = 0; i < reta_entries; i++) - tp->rss_indir_tbl[i] = indir[i]; - } - - /* Fill out the rss hash key */ - if (key) - memcpy(tp->rss_key, key, rtl8125_get_rxfh_key_size(dev)); - - rtl8125_store_reta(tp); - - rtl8125_store_rss_key(tp); - - return 0; -} - -static u32 rtl8125_get_rx_desc_hash(struct rtl8125_private *tp, - struct RxDescV3 *descv3) -{ - return le32_to_cpu(descv3->RxDescNormalDDWord2.RSSResult); -} - -#define RXS_8125B_RSS_UDP BIT(9) -#define RXS_8125_RSS_IPV4 BIT(10) -#define RXS_8125_RSS_IPV6 BIT(12) -#define RXS_8125_RSS_TCP BIT(13) -#define RTL8125_RXS_RSS_L3_TYPE_MASK (RXS_8125_RSS_IPV4 | RXS_8125_RSS_IPV6) -#define RTL8125_RXS_RSS_L4_TYPE_MASK (RXS_8125_RSS_TCP | RXS_8125B_RSS_UDP) -void rtl8125_rx_hash(struct rtl8125_private *tp, - struct RxDescV3 *descv3, - struct sk_buff *skb) -{ - u16 rss_header_info; - - if (!(tp->dev->features & NETIF_F_RXHASH)) - return; - - rss_header_info = le16_to_cpu(descv3->RxDescNormalDDWord2.HeaderInfo); - - if (!(rss_header_info & RTL8125_RXS_RSS_L3_TYPE_MASK)) - return; - - skb_set_hash(skb, rtl8125_get_rx_desc_hash(tp, descv3), - (RTL8125_RXS_RSS_L4_TYPE_MASK & rss_header_info) ? - PKT_HASH_TYPE_L4 : PKT_HASH_TYPE_L3); -} - -void rtl8125_disable_rss(struct rtl8125_private *tp) -{ - RTL_W32(tp, RSS_CTRL_8125, 0x00); -} - -void _rtl8125_config_rss(struct rtl8125_private *tp) -{ - _rtl8125_set_rss_hash_opt(tp); - - rtl8125_store_reta(tp); - - rtl8125_store_rss_key(tp); -} - -void rtl8125_config_rss(struct rtl8125_private *tp) -{ - if (!tp->EnableRss) { - rtl8125_disable_rss(tp); - return; - } - - _rtl8125_config_rss(tp); -} - -void rtl8125_init_rss(struct rtl8125_private *tp) -{ - int i; - - for (i = 0; i < rtl8125_rss_indir_tbl_entries(tp); i++) - tp->rss_indir_tbl[i] = ethtool_rxfh_indir_default(i, tp->num_rx_rings); - - netdev_rss_key_fill(tp->rss_key, RTL8125_RSS_KEY_SIZE); -} diff --git a/package/kernel/r8125/src/r8125_rss.h b/package/kernel/r8125/src/r8125_rss.h deleted file mode 100644 index 8864139509..0000000000 --- a/package/kernel/r8125/src/r8125_rss.h +++ /dev/null @@ -1,69 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* -################################################################################ -# -# r8125 is the Linux device driver released for Realtek 2.5Gigabit Ethernet -# controllers with PCI-Express interface. -# -# Copyright(c) 2022 Realtek Semiconductor Corp. All rights reserved. -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the Free -# Software Foundation; either version 2 of the License, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -# more details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, see . -# -# Author: -# Realtek NIC software team -# No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan -# -################################################################################ -*/ - -/************************************************************************************ - * This product is covered by one or more of the following patents: - * US6,570,884, US6,115,776, and US6,327,625. - ***********************************************************************************/ - -#ifndef _LINUX_rtl8125_RSS_H -#define _LINUX_rtl8125_RSS_H - -#include -#include - -#define RTL8125_RSS_KEY_SIZE 40 /* size of RSS Hash Key in bytes */ -#define RTL8125_MAX_INDIRECTION_TABLE_ENTRIES 128 - -enum rtl8125_rss_flag { - RTL_8125_RSS_FLAG_HASH_UDP_IPV4 = (1 << 0), - RTL_8125_RSS_FLAG_HASH_UDP_IPV6 = (1 << 1), -}; - -struct rtl8125_private; - -int rtl8125_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd, - u32 *rule_locs); -int rtl8125_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd); -u32 rtl8125_get_rxfh_key_size(struct net_device *netdev); -u32 rtl8125_rss_indir_size(struct net_device *netdev); -int rtl8125_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, - u8 *hfunc); -int rtl8125_set_rxfh(struct net_device *netdev, const u32 *indir, - const u8 *key, const u8 hfunc); -void rtl8125_rx_hash(struct rtl8125_private *tp, - struct RxDescV3 *descv3, - struct sk_buff *skb); -void _rtl8125_config_rss(struct rtl8125_private *tp); -void rtl8125_config_rss(struct rtl8125_private *tp); -void rtl8125_init_rss(struct rtl8125_private *tp); -u32 rtl8125_rss_indir_tbl_entries(struct rtl8125_private *tp); -void rtl8125_disable_rss(struct rtl8125_private *tp); - -#endif /* _LINUX_rtl8125_RSS_H */ diff --git a/package/kernel/r8125/src/rtl_eeprom.c b/package/kernel/r8125/src/rtl_eeprom.c deleted file mode 100644 index 03660ddaf1..0000000000 --- a/package/kernel/r8125/src/rtl_eeprom.c +++ /dev/null @@ -1,289 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* -################################################################################ -# -# r8125 is the Linux device driver released for Realtek 2.5Gigabit Ethernet -# controllers with PCI-Express interface. -# -# Copyright(c) 2022 Realtek Semiconductor Corp. All rights reserved. -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the Free -# Software Foundation; either version 2 of the License, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -# more details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, see . -# -# Author: -# Realtek NIC software team -# No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan -# -################################################################################ -*/ - -/************************************************************************************ - * This product is covered by one or more of the following patents: - * US6,570,884, US6,115,776, and US6,327,625. - ***********************************************************************************/ - -#include -#include -#include -#include -#include -#include - -#include - -#include "r8125.h" -#include "rtl_eeprom.h" - -//------------------------------------------------------------------- -//rtl8125_eeprom_type(): -// tell the eeprom type -//return value: -// 0: the eeprom type is 93C46 -// 1: the eeprom type is 93C56 or 93C66 -//------------------------------------------------------------------- -void rtl8125_eeprom_type(struct rtl8125_private *tp) -{ - u16 magic = 0; - - if (tp->mcfg == CFG_METHOD_DEFAULT) - goto out_no_eeprom; - - if(RTL_R8(tp, 0xD2)&0x04) { - //not support - //tp->eeprom_type = EEPROM_TWSI; - //tp->eeprom_len = 256; - goto out_no_eeprom; - } else if(RTL_R32(tp, RxConfig) & RxCfg_9356SEL) { - tp->eeprom_type = EEPROM_TYPE_93C56; - tp->eeprom_len = 256; - } else { - tp->eeprom_type = EEPROM_TYPE_93C46; - tp->eeprom_len = 128; - } - - magic = rtl8125_eeprom_read_sc(tp, 0); - -out_no_eeprom: - if ((magic != 0x8129) && (magic != 0x8128)) { - tp->eeprom_type = EEPROM_TYPE_NONE; - tp->eeprom_len = 0; - } -} - -void rtl8125_eeprom_cleanup(struct rtl8125_private *tp) -{ - u8 x; - - x = RTL_R8(tp, Cfg9346); - x &= ~(Cfg9346_EEDI | Cfg9346_EECS); - - RTL_W8(tp, Cfg9346, x); - - rtl8125_raise_clock(tp, &x); - rtl8125_lower_clock(tp, &x); -} - -int rtl8125_eeprom_cmd_done(struct rtl8125_private *tp) -{ - u8 x; - int i; - - rtl8125_stand_by(tp); - - for (i = 0; i < 50000; i++) { - x = RTL_R8(tp, Cfg9346); - - if (x & Cfg9346_EEDO) { - udelay(RTL_CLOCK_RATE * 2 * 3); - return 0; - } - udelay(1); - } - - return -1; -} - -//------------------------------------------------------------------- -//rtl8125_eeprom_read_sc(): -// read one word from eeprom -//------------------------------------------------------------------- -u16 rtl8125_eeprom_read_sc(struct rtl8125_private *tp, u16 reg) -{ - int addr_sz = 6; - u8 x; - u16 data; - - if(tp->eeprom_type == EEPROM_TYPE_NONE) { - return -1; - } - - if (tp->eeprom_type==EEPROM_TYPE_93C46) - addr_sz = 6; - else if (tp->eeprom_type==EEPROM_TYPE_93C56) - addr_sz = 8; - - x = Cfg9346_EEM1 | Cfg9346_EECS; - RTL_W8(tp, Cfg9346, x); - - rtl8125_shift_out_bits(tp, RTL_EEPROM_READ_OPCODE, 3); - rtl8125_shift_out_bits(tp, reg, addr_sz); - - data = rtl8125_shift_in_bits(tp); - - rtl8125_eeprom_cleanup(tp); - - RTL_W8(tp, Cfg9346, 0); - - return data; -} - -//------------------------------------------------------------------- -//rtl8125_eeprom_write_sc(): -// write one word to a specific address in the eeprom -//------------------------------------------------------------------- -void rtl8125_eeprom_write_sc(struct rtl8125_private *tp, u16 reg, u16 data) -{ - u8 x; - int addr_sz = 6; - int w_dummy_addr = 4; - - if(tp->eeprom_type == EEPROM_TYPE_NONE) { - return ; - } - - if (tp->eeprom_type==EEPROM_TYPE_93C46) { - addr_sz = 6; - w_dummy_addr = 4; - } else if (tp->eeprom_type==EEPROM_TYPE_93C56) { - addr_sz = 8; - w_dummy_addr = 6; - } - - x = Cfg9346_EEM1 | Cfg9346_EECS; - RTL_W8(tp, Cfg9346, x); - - rtl8125_shift_out_bits(tp, RTL_EEPROM_EWEN_OPCODE, 5); - rtl8125_shift_out_bits(tp, reg, w_dummy_addr); - rtl8125_stand_by(tp); - - rtl8125_shift_out_bits(tp, RTL_EEPROM_ERASE_OPCODE, 3); - rtl8125_shift_out_bits(tp, reg, addr_sz); - if (rtl8125_eeprom_cmd_done(tp) < 0) { - return; - } - rtl8125_stand_by(tp); - - rtl8125_shift_out_bits(tp, RTL_EEPROM_WRITE_OPCODE, 3); - rtl8125_shift_out_bits(tp, reg, addr_sz); - rtl8125_shift_out_bits(tp, data, 16); - if (rtl8125_eeprom_cmd_done(tp) < 0) { - return; - } - rtl8125_stand_by(tp); - - rtl8125_shift_out_bits(tp, RTL_EEPROM_EWDS_OPCODE, 5); - rtl8125_shift_out_bits(tp, reg, w_dummy_addr); - - rtl8125_eeprom_cleanup(tp); - RTL_W8(tp, Cfg9346, 0); -} - -void rtl8125_raise_clock(struct rtl8125_private *tp, u8 *x) -{ - *x = *x | Cfg9346_EESK; - RTL_W8(tp, Cfg9346, *x); - udelay(RTL_CLOCK_RATE); -} - -void rtl8125_lower_clock(struct rtl8125_private *tp, u8 *x) -{ - - *x = *x & ~Cfg9346_EESK; - RTL_W8(tp, Cfg9346, *x); - udelay(RTL_CLOCK_RATE); -} - -void rtl8125_shift_out_bits(struct rtl8125_private *tp, int data, int count) -{ - u8 x; - int mask; - - mask = 0x01 << (count - 1); - x = RTL_R8(tp, Cfg9346); - x &= ~(Cfg9346_EEDI | Cfg9346_EEDO); - - do { - if (data & mask) - x |= Cfg9346_EEDI; - else - x &= ~Cfg9346_EEDI; - - RTL_W8(tp, Cfg9346, x); - udelay(RTL_CLOCK_RATE); - rtl8125_raise_clock(tp, &x); - rtl8125_lower_clock(tp, &x); - mask = mask >> 1; - } while(mask); - - x &= ~Cfg9346_EEDI; - RTL_W8(tp, Cfg9346, x); -} - -u16 rtl8125_shift_in_bits(struct rtl8125_private *tp) -{ - u8 x; - u16 d, i; - - x = RTL_R8(tp, Cfg9346); - x &= ~(Cfg9346_EEDI | Cfg9346_EEDO); - - d = 0; - - for (i = 0; i < 16; i++) { - d = d << 1; - rtl8125_raise_clock(tp, &x); - - x = RTL_R8(tp, Cfg9346); - x &= ~Cfg9346_EEDI; - - if (x & Cfg9346_EEDO) - d |= 1; - - rtl8125_lower_clock(tp, &x); - } - - return d; -} - -void rtl8125_stand_by(struct rtl8125_private *tp) -{ - u8 x; - - x = RTL_R8(tp, Cfg9346); - x &= ~(Cfg9346_EECS | Cfg9346_EESK); - RTL_W8(tp, Cfg9346, x); - udelay(RTL_CLOCK_RATE); - - x |= Cfg9346_EECS; - RTL_W8(tp, Cfg9346, x); -} - -void rtl8125_set_eeprom_sel_low(struct rtl8125_private *tp) -{ - RTL_W8(tp, Cfg9346, Cfg9346_EEM1); - RTL_W8(tp, Cfg9346, Cfg9346_EEM1 | Cfg9346_EESK); - - udelay(20); - - RTL_W8(tp, Cfg9346, Cfg9346_EEM1); -} diff --git a/package/kernel/r8125/src/rtl_eeprom.h b/package/kernel/r8125/src/rtl_eeprom.h deleted file mode 100644 index 8faed17cf2..0000000000 --- a/package/kernel/r8125/src/rtl_eeprom.h +++ /dev/null @@ -1,53 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* -################################################################################ -# -# r8125 is the Linux device driver released for Realtek 2.5Gigabit Ethernet -# controllers with PCI-Express interface. -# -# Copyright(c) 2022 Realtek Semiconductor Corp. All rights reserved. -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the Free -# Software Foundation; either version 2 of the License, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -# more details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, see . -# -# Author: -# Realtek NIC software team -# No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan -# -################################################################################ -*/ - -/************************************************************************************ - * This product is covered by one or more of the following patents: - * US6,570,884, US6,115,776, and US6,327,625. - ***********************************************************************************/ - -//EEPROM opcodes -#define RTL_EEPROM_READ_OPCODE 06 -#define RTL_EEPROM_WRITE_OPCODE 05 -#define RTL_EEPROM_ERASE_OPCODE 07 -#define RTL_EEPROM_EWEN_OPCODE 19 -#define RTL_EEPROM_EWDS_OPCODE 16 - -#define RTL_CLOCK_RATE 3 - -void rtl8125_eeprom_type(struct rtl8125_private *tp); -void rtl8125_eeprom_cleanup(struct rtl8125_private *tp); -u16 rtl8125_eeprom_read_sc(struct rtl8125_private *tp, u16 reg); -void rtl8125_eeprom_write_sc(struct rtl8125_private *tp, u16 reg, u16 data); -void rtl8125_shift_out_bits(struct rtl8125_private *tp, int data, int count); -u16 rtl8125_shift_in_bits(struct rtl8125_private *tp); -void rtl8125_raise_clock(struct rtl8125_private *tp, u8 *x); -void rtl8125_lower_clock(struct rtl8125_private *tp, u8 *x); -void rtl8125_stand_by(struct rtl8125_private *tp); -void rtl8125_set_eeprom_sel_low(struct rtl8125_private *tp); diff --git a/package/kernel/r8125/src/rtltool.c b/package/kernel/r8125/src/rtltool.c deleted file mode 100644 index 69ff20e8a2..0000000000 --- a/package/kernel/r8125/src/rtltool.c +++ /dev/null @@ -1,320 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* -################################################################################ -# -# r8125 is the Linux device driver released for Realtek 2.5Gigabit Ethernet -# controllers with PCI-Express interface. -# -# Copyright(c) 2022 Realtek Semiconductor Corp. All rights reserved. -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the Free -# Software Foundation; either version 2 of the License, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -# more details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, see . -# -# Author: -# Realtek NIC software team -# No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan -# -################################################################################ -*/ - -/************************************************************************************ - * This product is covered by one or more of the following patents: - * US6,570,884, US6,115,776, and US6,327,625. - ***********************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "r8125.h" -#include "rtl_eeprom.h" -#include "rtltool.h" - -int rtl8125_tool_ioctl(struct rtl8125_private *tp, struct ifreq *ifr) -{ - struct rtltool_cmd my_cmd; - int ret; - - if (copy_from_user(&my_cmd, ifr->ifr_data, sizeof(my_cmd))) - return -EFAULT; - - ret = 0; - switch (my_cmd.cmd) { - case RTLTOOL_READ_MAC: - if (!capable(CAP_NET_ADMIN)) - return -EPERM; - - if (my_cmd.len==1) - my_cmd.data = readb(tp->mmio_addr+my_cmd.offset); - else if (my_cmd.len==2) - my_cmd.data = readw(tp->mmio_addr+(my_cmd.offset&~1)); - else if (my_cmd.len==4) - my_cmd.data = readl(tp->mmio_addr+(my_cmd.offset&~3)); - else { - ret = -EOPNOTSUPP; - break; - } - - if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(my_cmd))) { - ret = -EFAULT; - break; - } - break; - - case RTLTOOL_WRITE_MAC: - if (!capable(CAP_NET_ADMIN)) - return -EPERM; - - if (my_cmd.len==1) - writeb(my_cmd.data, tp->mmio_addr+my_cmd.offset); - else if (my_cmd.len==2) - writew(my_cmd.data, tp->mmio_addr+(my_cmd.offset&~1)); - else if (my_cmd.len==4) - writel(my_cmd.data, tp->mmio_addr+(my_cmd.offset&~3)); - else { - ret = -EOPNOTSUPP; - break; - } - - break; - - case RTLTOOL_READ_PHY: - if (!capable(CAP_NET_ADMIN)) - return -EPERM; - - my_cmd.data = rtl8125_mdio_prot_read(tp, my_cmd.offset); - if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(my_cmd))) { - ret = -EFAULT; - break; - } - - break; - - case RTLTOOL_WRITE_PHY: - if (!capable(CAP_NET_ADMIN)) - return -EPERM; - - rtl8125_mdio_prot_write(tp, my_cmd.offset, my_cmd.data); - break; - - case RTLTOOL_READ_EPHY: - if (!capable(CAP_NET_ADMIN)) - return -EPERM; - - my_cmd.data = rtl8125_ephy_read(tp, my_cmd.offset); - if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(my_cmd))) { - ret = -EFAULT; - break; - } - - break; - - case RTLTOOL_WRITE_EPHY: - if (!capable(CAP_NET_ADMIN)) - return -EPERM; - - rtl8125_ephy_write(tp, my_cmd.offset, my_cmd.data); - break; - - case RTLTOOL_READ_ERI: - my_cmd.data = 0; - if (my_cmd.len==1 || my_cmd.len==2 || my_cmd.len==4) { - my_cmd.data = rtl8125_eri_read(tp, my_cmd.offset, my_cmd.len, ERIAR_ExGMAC); - } else { - ret = -EOPNOTSUPP; - break; - } - - if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(my_cmd))) { - ret = -EFAULT; - break; - } - - break; - - case RTLTOOL_WRITE_ERI: - if (!capable(CAP_NET_ADMIN)) - return -EPERM; - - if (!capable(CAP_NET_ADMIN)) - return -EPERM; - - if (my_cmd.len==1 || my_cmd.len==2 || my_cmd.len==4) { - rtl8125_eri_write(tp, my_cmd.offset, my_cmd.len, my_cmd.data, ERIAR_ExGMAC); - } else { - ret = -EOPNOTSUPP; - break; - } - break; - - case RTLTOOL_READ_PCI: - if (!capable(CAP_NET_ADMIN)) - return -EPERM; - - my_cmd.data = 0; - if (my_cmd.len==1) - pci_read_config_byte(tp->pci_dev, my_cmd.offset, - (u8 *)&my_cmd.data); - else if (my_cmd.len==2) - pci_read_config_word(tp->pci_dev, my_cmd.offset, - (u16 *)&my_cmd.data); - else if (my_cmd.len==4) - pci_read_config_dword(tp->pci_dev, my_cmd.offset, - &my_cmd.data); - else { - ret = -EOPNOTSUPP; - break; - } - - if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(my_cmd))) { - ret = -EFAULT; - break; - } - break; - - case RTLTOOL_WRITE_PCI: - if (!capable(CAP_NET_ADMIN)) - return -EPERM; - - if (my_cmd.len==1) - pci_write_config_byte(tp->pci_dev, my_cmd.offset, - my_cmd.data); - else if (my_cmd.len==2) - pci_write_config_word(tp->pci_dev, my_cmd.offset, - my_cmd.data); - else if (my_cmd.len==4) - pci_write_config_dword(tp->pci_dev, my_cmd.offset, - my_cmd.data); - else { - ret = -EOPNOTSUPP; - break; - } - - break; - - case RTLTOOL_READ_EEPROM: - if (!capable(CAP_NET_ADMIN)) - return -EPERM; - - my_cmd.data = rtl8125_eeprom_read_sc(tp, my_cmd.offset); - if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(my_cmd))) { - ret = -EFAULT; - break; - } - - break; - - case RTLTOOL_WRITE_EEPROM: - if (!capable(CAP_NET_ADMIN)) - return -EPERM; - - rtl8125_eeprom_write_sc(tp, my_cmd.offset, my_cmd.data); - break; - - case RTL_READ_OOB_MAC: - if (!capable(CAP_NET_ADMIN)) - return -EPERM; - - rtl8125_oob_mutex_lock(tp); - my_cmd.data = rtl8125_ocp_read(tp, my_cmd.offset, 4); - rtl8125_oob_mutex_unlock(tp); - if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(my_cmd))) { - ret = -EFAULT; - break; - } - break; - - case RTL_WRITE_OOB_MAC: - if (!capable(CAP_NET_ADMIN)) - return -EPERM; - - if (my_cmd.len == 0 || my_cmd.len > 4) - return -EOPNOTSUPP; - - rtl8125_oob_mutex_lock(tp); - rtl8125_ocp_write(tp, my_cmd.offset, my_cmd.len, my_cmd.data); - rtl8125_oob_mutex_unlock(tp); - break; - - case RTL_ENABLE_PCI_DIAG: - if (!capable(CAP_NET_ADMIN)) - return -EPERM; - - tp->rtk_enable_diag = 1; - - dprintk("enable rtk diag\n"); - break; - - case RTL_DISABLE_PCI_DIAG: - if (!capable(CAP_NET_ADMIN)) - return -EPERM; - - tp->rtk_enable_diag = 0; - - dprintk("disable rtk diag\n"); - break; - - case RTL_READ_MAC_OCP: - if (!capable(CAP_NET_ADMIN)) - return -EPERM; - - if (my_cmd.offset % 2) - return -EOPNOTSUPP; - - my_cmd.data = rtl8125_mac_ocp_read(tp, my_cmd.offset); - if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(my_cmd))) { - ret = -EFAULT; - break; - } - break; - - case RTL_WRITE_MAC_OCP: - if (!capable(CAP_NET_ADMIN)) - return -EPERM; - - if ((my_cmd.offset % 2) || (my_cmd.len != 2)) - return -EOPNOTSUPP; - - rtl8125_mac_ocp_write(tp, my_cmd.offset, (u16)my_cmd.data); - break; - - case RTL_DIRECT_READ_PHY_OCP: - if (!capable(CAP_NET_ADMIN)) - return -EPERM; - - my_cmd.data = rtl8125_mdio_prot_direct_read_phy_ocp(tp, my_cmd.offset); - if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(my_cmd))) { - ret = -EFAULT; - break; - } - - break; - - case RTL_DIRECT_WRITE_PHY_OCP: - if (!capable(CAP_NET_ADMIN)) - return -EPERM; - - rtl8125_mdio_prot_direct_write_phy_ocp(tp, my_cmd.offset, my_cmd.data); - break; - - default: - ret = -EOPNOTSUPP; - break; - } - - return ret; -} diff --git a/package/kernel/r8125/src/rtltool.h b/package/kernel/r8125/src/rtltool.h deleted file mode 100644 index a54f8e6abd..0000000000 --- a/package/kernel/r8125/src/rtltool.h +++ /dev/null @@ -1,86 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* -################################################################################ -# -# r8125 is the Linux device driver released for Realtek 2.5Gigabit Ethernet -# controllers with PCI-Express interface. -# -# Copyright(c) 2022 Realtek Semiconductor Corp. All rights reserved. -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the Free -# Software Foundation; either version 2 of the License, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -# more details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, see . -# -# Author: -# Realtek NIC software team -# No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan -# -################################################################################ -*/ - -/************************************************************************************ - * This product is covered by one or more of the following patents: - * US6,570,884, US6,115,776, and US6,327,625. - ***********************************************************************************/ - -#ifndef _LINUX_RTLTOOL_H -#define _LINUX_RTLTOOL_H - -#define SIOCRTLTOOL SIOCDEVPRIVATE+1 - -enum rtl_cmd { - RTLTOOL_READ_MAC=0, - RTLTOOL_WRITE_MAC, - RTLTOOL_READ_PHY, - RTLTOOL_WRITE_PHY, - RTLTOOL_READ_EPHY, - RTLTOOL_WRITE_EPHY, - RTLTOOL_READ_ERI, - RTLTOOL_WRITE_ERI, - RTLTOOL_READ_PCI, - RTLTOOL_WRITE_PCI, - RTLTOOL_READ_EEPROM, - RTLTOOL_WRITE_EEPROM, - - RTL_READ_OOB_MAC, - RTL_WRITE_OOB_MAC, - - RTL_ENABLE_PCI_DIAG, - RTL_DISABLE_PCI_DIAG, - - RTL_READ_MAC_OCP, - RTL_WRITE_MAC_OCP, - - RTL_DIRECT_READ_PHY_OCP, - RTL_DIRECT_WRITE_PHY_OCP, - - RTLTOOL_INVALID -}; - -struct rtltool_cmd { - __u32 cmd; - __u32 offset; - __u32 len; - __u32 data; -}; - -enum mode_access { - MODE_NONE=0, - MODE_READ, - MODE_WRITE -}; - -#ifdef __KERNEL__ -int rtl8125_tool_ioctl(struct rtl8125_private *tp, struct ifreq *ifr); -#endif - -#endif /* _LINUX_RTLTOOL_H */ From 3d901b8924d9b5bb158558d6b5b22ef0007b9540 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Tue, 17 May 2022 16:34:48 +0800 Subject: [PATCH 47/48] config/Config-kernel.in: enable namespaces by default Signed-off-by: Tianling Shen --- config/Config-kernel.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/Config-kernel.in b/config/Config-kernel.in index b3f9cccd7e..43132a0e5f 100644 --- a/config/Config-kernel.in +++ b/config/Config-kernel.in @@ -625,7 +625,7 @@ endif config KERNEL_NAMESPACES bool "Enable kernel namespaces" - default n + default y if KERNEL_NAMESPACES From 7b1251c29c0b5455c05f83c0a1b208223b0b5ecc Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Tue, 17 May 2022 16:36:15 +0800 Subject: [PATCH 48/48] config/Config-kernel.in: disable namespaces for small flash devices by default Signed-off-by: Tianling Shen --- config/Config-kernel.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/Config-kernel.in b/config/Config-kernel.in index 43132a0e5f..b126cc988c 100644 --- a/config/Config-kernel.in +++ b/config/Config-kernel.in @@ -625,7 +625,7 @@ endif config KERNEL_NAMESPACES bool "Enable kernel namespaces" - default y + default y if !SMALL_FLASH if KERNEL_NAMESPACES