From 4a7e85ebf29109d1f658ea93969ac689e081bfa4 Mon Sep 17 00:00:00 2001 From: RealtekNIC <87769173+RealtekNIC@users.noreply.github.com> Date: Fri, 7 Mar 2025 14:30:30 +0800 Subject: [PATCH] 9.010.01_cdt --- Makefile | 4 +- README | 2 +- src/Kbuild | 20 + src/Makefile | 218 +- src/Makefile_Realtek_original | 197 + src/Makefile_linux24x | 4 +- src/r8125.h | 498 +- src/r8125_dash.h | 19 +- src/r8125_firmware.c | 4 +- src/r8125_firmware.h | 4 +- src/r8125_lib.c | 137 +- src/r8125_lib.h | 4 +- src/r8125_n.c | 11318 +++++++------------------------- src/r8125_ptp.c | 153 +- src/r8125_ptp.h | 4 +- src/r8125_realwow.h | 4 +- src/r8125_rss.c | 190 +- src/r8125_rss.h | 13 +- src/rtl_eeprom.c | 21 +- src/rtl_eeprom.h | 4 +- src/rtltool.c | 4 +- src/rtltool.h | 4 +- 22 files changed, 2970 insertions(+), 9856 deletions(-) create mode 100644 src/Kbuild create mode 100644 src/Makefile_Realtek_original diff --git a/Makefile b/Makefile index dced245..712b6fe 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,10 @@ # SPDX-License-Identifier: GPL-2.0-only ################################################################################ # -# r8125 is the Linux device driver released for Realtek 2.5 Gigabit Ethernet +# r8125 is the Linux device driver released for Realtek 2.5Gigabit Ethernet # controllers with PCI-Express interface. # -# Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved. +# 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 diff --git a/README b/README index 51eeb30..3348a04 100644 --- a/README +++ b/README @@ -1,6 +1,6 @@ - This is the Linux device driver released for Realtek 2.5 Gigabit Ethernet controllers with PCI-Express interface. + This is the Linux device driver released for RealTek RTL8125 2.5Gigabit Ethernet controllers with PCI-Express interface. diff --git a/src/Kbuild b/src/Kbuild new file mode 100644 index 0000000..e86d815 --- /dev/null +++ b/src/Kbuild @@ -0,0 +1,20 @@ +# Features enabled +ifeq ($(building_out_of_srctree),1) +ccflags-y += -I$(TOPDIR)/src/kernel-5.15/kernel_platform/msm-kernel/include/linux +endif + +ccflags-y += -DENABLE_USE_FIRMWARE_FILE +ccflags-y += -DCONFIG_ASPM -DENABLE_S5WOL -DENABLE_EEE -DENABLE_TX_NO_CLOSE -DCONFIG_R8125_NAPI -DCONFIG_R8125_VLAN -DENABLE_DOUBLE_VLAN +ccflags-y += -DENABLE_MULTIPLE_TX_QUEUE -DENABLE_RSS_SUPPORT -DENABLE_LIB_SUPPORT + +ccflags-y += -Wno-error + +obj-m += r8125.o + +r8125-y := r8125_n.o \ + rtl_eeprom.o \ + rtltool.o \ + r8125_rss.o \ + r8125_lib.o \ + r8125_firmware.o + diff --git a/src/Makefile b/src/Makefile index a045cb0..ef0d47a 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,209 +1,29 @@ # SPDX-License-Identifier: GPL-2.0-only -################################################################################ -# -# r8125 is the Linux device driver released for Realtek 2.5 Gigabit Ethernet -# controllers with PCI-Express interface. -# -# Copyright(c) 2024 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 = y -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_PTP_SUPPORT = n -ENABLE_PTP_MASTER_MODE = n -ENABLE_RSS_SUPPORT = y -ENABLE_LIB_SUPPORT = y -ENABLE_USE_FIRMWARE_FILE = y -DISABLE_WOL_SUPPORT = n -DISABLE_MULTI_MSIX_VECTOR = n -ENABLE_DOUBLE_VLAN = n -ENABLE_PAGE_REUSE = n -ENABLE_RX_PACKET_FRAGMENT = n +ifeq ($(KP_MODULE_ROOT),) + KP_MODULE_ROOT=$(KERNEL_SRC)/$(M) +endif -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_WOL_SUPPORT), y) - EXTRA_CFLAGS += -DDISABLE_WOL_SUPPORT - endif - ifeq ($(DISABLE_MULTI_MSIX_VECTOR), y) - EXTRA_CFLAGS += -DDISABLE_MULTI_MSIX_VECTOR - endif - ifeq ($(ENABLE_DOUBLE_VLAN), y) - EXTRA_CFLAGS += -DENABLE_DOUBLE_VLAN - endif - ifeq ($(ENABLE_PAGE_REUSE), y) - EXTRA_CFLAGS += -DENABLE_PAGE_REUSE - endif - ifeq ($(ENABLE_RX_PACKET_FRAGMENT), y) - EXTRA_CFLAGS += -DENABLE_RX_PACKET_FRAGMENT - 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) +M ?= $(shell pwd) - 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/') +r8125-y := r8125_n.o \ + r8125_firmware.o \ + r8125_lib.o \ + r8125_ptp.o \ + r8125_rss.o \ + rtl_eeprom.o \ + rtltool.o - 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 } \ - }}}}}' \ - ) +KERNEL_SRC ?= /lib/modules/$(shell uname -r)/build -.PHONY: all -all: print_vars clean modules install +KBUILD_OPTIONS+=KBUILD_DTC_INCLUDE=$(KP_MODULE_ROOT) +KBUILD_OPTIONS+=CONFIG_R8125=m -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 +all: + $(MAKE) -C $(KERNEL_SRC) M=$(M) modules $(KBUILD_OPTIONS) -.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 +modules_install: + $(MAKE) -C $(KERNEL_SRC) M=$(M) modules_install -.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 + $(MAKE) -C $(KERNEL_SRC) M=$(M) clean diff --git a/src/Makefile_Realtek_original b/src/Makefile_Realtek_original new file mode 100644 index 0000000..28dd23e --- /dev/null +++ b/src/Makefile_Realtek_original @@ -0,0 +1,197 @@ +# 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 = y +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_PTP_SUPPORT = n +ENABLE_PTP_MASTER_MODE = n +ENABLE_RSS_SUPPORT = y +ENABLE_LIB_SUPPORT = y +ENABLE_USE_FIRMWARE_FILE = y +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/src/Makefile_linux24x b/src/Makefile_linux24x index 05c1f6d..50aef8d 100644 --- a/src/Makefile_linux24x +++ b/src/Makefile_linux24x @@ -1,10 +1,10 @@ # SPDX-License-Identifier: GPL-2.0-only ################################################################################ # -# r8125 is the Linux device driver released for Realtek 2.5 Gigabit Ethernet +# r8125 is the Linux device driver released for Realtek 2.5Gigabit Ethernet # controllers with PCI-Express interface. # -# Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved. +# 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 diff --git a/src/r8125.h b/src/r8125.h index bf302be..a8c7a6a 100644 --- a/src/r8125.h +++ b/src/r8125.h @@ -2,10 +2,10 @@ /* ################################################################################ # -# r8125 is the Linux device driver released for Realtek 2.5 Gigabit Ethernet +# r8125 is the Linux device driver released for Realtek 2.5Gigabit Ethernet # controllers with PCI-Express interface. # -# Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved. +# 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 @@ -41,191 +41,22 @@ #include #include "r8125_dash.h" #include "r8125_realwow.h" -#ifdef ENABLE_PTP_SUPPORT #include "r8125_ptp.h" -#endif #include "r8125_rss.h" #ifdef ENABLE_LIB_SUPPORT #include "r8125_lib.h" #endif -#ifndef fallthrough -#define fallthrough -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0) -#define netif_xmit_stopped netif_tx_queue_stopped -#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0) */ - -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) -#ifndef MDIO_AN_EEE_ADV_100TX -#define MDIO_AN_EEE_ADV_100TX 0x0002 /* Advertise 100TX EEE cap */ -#endif -#ifndef MDIO_AN_EEE_ADV_1000T -#define MDIO_AN_EEE_ADV_1000T 0x0004 /* Advertise 1000T EEE cap */ -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0) -#define MDIO_EEE_100TX MDIO_AN_EEE_ADV_100TX /* 100TX EEE cap */ -#define MDIO_EEE_1000T MDIO_AN_EEE_ADV_1000T /* 1000T EEE cap */ -#define MDIO_EEE_10GT 0x0008 /* 10GT EEE cap */ -#define MDIO_EEE_1000KX 0x0010 /* 1000KX EEE cap */ -#define MDIO_EEE_10GKX4 0x0020 /* 10G KX4 EEE cap */ -#define MDIO_EEE_10GKR 0x0040 /* 10G KR EEE cap */ -#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0) */ - -static inline u32 mmd_eee_adv_to_ethtool_adv_t(u16 eee_adv) -{ - u32 adv = 0; - - if (eee_adv & MDIO_EEE_100TX) - adv |= ADVERTISED_100baseT_Full; - if (eee_adv & MDIO_EEE_1000T) - adv |= ADVERTISED_1000baseT_Full; - if (eee_adv & MDIO_EEE_10GT) - adv |= ADVERTISED_10000baseT_Full; - if (eee_adv & MDIO_EEE_1000KX) - adv |= ADVERTISED_1000baseKX_Full; - if (eee_adv & MDIO_EEE_10GKX4) - adv |= ADVERTISED_10000baseKX4_Full; - if (eee_adv & MDIO_EEE_10GKR) - adv |= ADVERTISED_10000baseKR_Full; - - return adv; -} - -static inline u16 ethtool_adv_to_mmd_eee_adv_t(u32 adv) -{ - u16 reg = 0; - - if (adv & ADVERTISED_100baseT_Full) - reg |= MDIO_EEE_100TX; - if (adv & ADVERTISED_1000baseT_Full) - reg |= MDIO_EEE_1000T; - if (adv & ADVERTISED_10000baseT_Full) - reg |= MDIO_EEE_10GT; - if (adv & ADVERTISED_1000baseKX_Full) - reg |= MDIO_EEE_1000KX; - if (adv & ADVERTISED_10000baseKX4_Full) - reg |= MDIO_EEE_10GKX4; - if (adv & ADVERTISED_10000baseKR_Full) - reg |= MDIO_EEE_10GKR; - - return reg; -} -#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) */ - -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0) -static inline bool skb_transport_header_was_set(const struct sk_buff *skb) -{ - return skb->transport_header != ~0U; -} -#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0) */ - -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,3,0) -static inline -ssize_t strscpy(char *dest, const char *src, size_t count) -{ - long res = 0; - - if (count == 0) - return -E2BIG; - - while (count) { - char c; - - c = src[res]; - dest[res] = c; - if (!c) - return res; - res++; - count--; - } - - /* Hit buffer length without finding a NUL; force NUL-termination. */ - if (res) - dest[res-1] = '\0'; - - return -E2BIG; -} -#endif - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0)) -static inline unsigned char *skb_checksum_start(const struct sk_buff *skb) -{ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)) - return skb->head + skb->csum_start; -#else /* < 2.6.22 */ - return skb_transport_header(skb); -#endif -} -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0) -static inline void netdev_tx_sent_queue(struct netdev_queue *dev_queue, - unsigned int bytes) -{ -} -static inline void netdev_tx_completed_queue(struct netdev_queue *dev_queue, - unsigned int pkts, - unsigned int bytes) -{ -} -static inline void netdev_tx_reset_queue(struct netdev_queue *q) {} -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(5,2,0) -#define netdev_xmit_more() (0) -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(5,8,0) -#define netif_testing_on(dev) -#define netif_testing_off(dev) -#endif - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32) typedef int netdev_tx_t; #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(5,12,0) -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,9) -static inline bool page_is_pfmemalloc(struct page *page) -{ - /* - * Page index cannot be this large so this must be - * a pfmemalloc page. - */ - return page->index == -1UL; -} -#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,1,9) */ -static inline bool dev_page_is_reusable(struct page *page) -{ - return likely(page_to_nid(page) == numa_mem_id() && - !page_is_pfmemalloc(page)); -} -#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(4,10,0) -#define dma_map_page_attrs(dev, page, offset, size, dir, attrs) \ - dma_map_page(dev, page, offset, size, dir) -#define dma_unmap_page_attrs(dev, page, size, dir, attrs) \ - dma_unmap_page(dev, page, size, dir) -#endif //LINUX_VERSION_CODE < KERNEL_VERSION(4,10,0) - -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) -#define page_ref_inc(page) atomic_inc(&page->_count) -#endif //LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) - -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,4,216) -#define page_ref_count(page) atomic_read(&page->_count) -#endif //LINUX_VERSION_CODE < KERNEL_VERSION(4,4,216) - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) #define skb_transport_offset(skb) (skb->h.raw - skb->data) #endif @@ -316,21 +147,10 @@ do { \ #endif //LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0) #define RTL_ALLOC_SKB_INTR(napi, length) dev_alloc_skb(length) -#define R8125_USE_NAPI_ALLOC_SKB 0 #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) -#undef R8125_USE_NAPI_ALLOC_SKB -#define R8125_USE_NAPI_ALLOC_SKB 1 -#endif -#endif - -#define RTL_BUILD_SKB_INTR(data, frag_size) build_skb(data, frag_size) -#ifdef CONFIG_R8125_NAPI -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,12,0) -#undef RTL_BUILD_SKB_INTR -#define RTL_BUILD_SKB_INTR(data, frag_size) napi_build_skb(data, frag_size) #endif #endif @@ -356,10 +176,6 @@ do { \ #define ENABLE_R8125_PROCFS #endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0) -#define ENABLE_R8125_SYSFS -#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 @@ -467,27 +283,6 @@ do { \ #define MDIO_EEE_1000T 0x0004 #endif -#ifndef MDIO_EEE_2_5GT -#define MDIO_EEE_2_5GT 0x0001 -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(6,9,0) -#define ethtool_keee ethtool_eee -#define rtl8125_ethtool_adv_to_mmd_eee_adv_cap1_t ethtool_adv_to_mmd_eee_adv_t -static inline u32 rtl8125_ethtool_adv_to_mmd_eee_adv_cap2_t(u32 adv) -{ - u32 result = 0; - - if (adv & SUPPORTED_2500baseX_Full) - result |= MDIO_EEE_2_5GT; - - return result; -} -#else -#define rtl8125_ethtool_adv_to_mmd_eee_adv_cap1_t linkmode_to_mii_eee_cap1_t -#define rtl8125_ethtool_adv_to_mmd_eee_adv_cap2_t linkmode_to_mii_eee_cap2_t -#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(6,9,0) */ - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29) #ifdef CONFIG_NET_POLL_CONTROLLER #define RTL_NET_POLL_CONTROLLER dev->poll_controller=rtl8125_netpoll @@ -539,7 +334,7 @@ static inline u32 rtl8125_ethtool_adv_to_mmd_eee_adv_cap2_t(u32 adv) #ifndef NET_IP_ALIGN #define NET_IP_ALIGN 2 #endif -#define R8125_RX_ALIGN NET_IP_ALIGN +#define RTK_RX_ALIGN 8 #ifdef CONFIG_R8125_NAPI #define NAPI_SUFFIX "-NAPI" @@ -572,19 +367,19 @@ static inline u32 rtl8125_ethtool_adv_to_mmd_eee_adv_cap2_t(u32 adv) #define RSS_SUFFIX "" #endif -#define RTL8125_VERSION "9.013.02" NAPI_SUFFIX DASH_SUFFIX REALWOW_SUFFIX PTP_SUFFIX RSS_SUFFIX +#define RTL8125_VERSION "9.010.01_cdt" NAPI_SUFFIX DASH_SUFFIX REALWOW_SUFFIX PTP_SUFFIX RSS_SUFFIX #define MODULENAME "r8125" #define PFX MODULENAME ": " #define GPL_CLAIM "\ -r8125 Copyright (C) 2024 Realtek NIC software team \n \ +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", \ + printk( "Assertion failed! %s,%s,%s,line=%d\n", \ #expr,__FILE__,__FUNCTION__,__LINE__); \ } #define dprintk(fmt, args...) do { printk(PFX fmt, ## args); } while (0) @@ -622,9 +417,7 @@ This is free software, and you are welcome to redistribute it under certain cond #endif #define Reserved2_data 7 -#define RX_DMA_BURST_unlimited 7 /* Maximum PCI burst, '7' is unlimited */ -#define RX_DMA_BURST_512 5 -#define RX_DMA_BURST_256 4 +#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 @@ -648,8 +441,6 @@ This is free software, and you are welcome to redistribute it under certain cond #define RxEarly_off_V1 (0x07 << 11) #define RxEarly_off_V2 (1 << 11) #define Rx_Single_fetch_V2 (1 << 14) -#define Rx_Close_Multiple (1 << 21) -#define Rx_Fetch_Number_8 (1 << 30) #define R8125_REGS_SIZE (256) #define R8125_MAC_REGS_SIZE (256) @@ -660,12 +451,8 @@ This is free software, and you are welcome to redistribute it under certain cond #define R8125_PCI_REGS_SIZE (0x100) #define R8125_NAPI_WEIGHT 64 -#define R8125_MAX_MSIX_VEC_8125A 4 #define R8125_MAX_MSIX_VEC_8125B 32 -#define R8125_MAX_MSIX_VEC_8125D 32 -#define R8125_MIN_MSIX_VEC_8125B 22 -#define R8125_MIN_MSIX_VEC_8125BP 31 -#define R8125_MIN_MSIX_VEC_8125D 20 +#define R8125_MIN_MSIX_VEC_8125B 17 #define R8125_MAX_MSIX_VEC 32 #define R8125_MAX_RX_QUEUES_VEC_V3 (16) @@ -673,8 +460,6 @@ This is free software, and you are welcome to redistribute it under certain cond #define RTL8125_LINK_TIMEOUT (1 * HZ) #define RTL8125_ESD_TIMEOUT (2 * HZ) -#define rtl8125_rx_page_size(order) (PAGE_SIZE << order) - #define MAX_NUM_TX_DESC 1024 /* Maximum number of Tx descriptor registers */ #define MAX_NUM_RX_DESC 1024 /* Maximum number of Rx descriptor registers */ @@ -685,11 +470,9 @@ This is free software, and you are welcome to redistribute it under certain cond #define NUM_RX_DESC MAX_NUM_RX_DESC /* Number of Rx descriptor registers */ #ifdef ENABLE_DOUBLE_VLAN -#define RX_BUF_SIZE 0x05F6 /* 0x05F6(1526) = 1514 + 8(double vlan) + 4(crc) bytes */ -#define RT_VALN_HLEN 8 /* 8(double vlan) bytes */ +#define RX_BUF_SIZE 0x05F6 /* 0x05F6 = 1526 bytes */ #else -#define RX_BUF_SIZE 0x05F2 /* 0x05F2(1522) = 1514 + 4(single vlan) + 4(crc) bytes */ -#define RT_VALN_HLEN 4 /* 4(single vlan) bytes */ +#define RX_BUF_SIZE 0x05F2 /* 0x05F2 = 1522 bytes */ #endif #define R8125_MAX_TX_QUEUES (2) @@ -776,24 +559,15 @@ This is free software, and you are welcome to redistribute it under certain cond #endif #define RTK_ADVERTISE_2500FULL 0x80 -#define RTK_ADVERTISE_5000FULL 0x100 -#define RTK_ADVERTISE_10000FULL 0x1000 #define RTK_LPA_ADVERTISE_2500FULL 0x20 #define RTK_LPA_ADVERTISE_5000FULL 0x40 #define RTK_LPA_ADVERTISE_10000FULL 0x800 -#define RTK_EEE_ADVERTISE_2500FULL BIT(0) -#define RTK_EEE_ADVERTISE_5000FULL BIT(1) -#define RTK_LPA_EEE_ADVERTISE_2500FULL BIT(0) -#define RTK_LPA_EEE_ADVERTISE_5000FULL BIT(1) +#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 MAX_TX_NO_CLOSE_DESC_PTR_MASK_V2 0xFFFF -#define MAX_TX_NO_CLOSE_DESC_PTR_V3 0x100000000 -#define MAX_TX_NO_CLOSE_DESC_PTR_MASK_V3 0xFFFFFFFF -#define MAX_TX_NO_CLOSE_DESC_PTR_V4 0x80000000 -#define MAX_TX_NO_CLOSE_DESC_PTR_MASK_V4 0x7FFFFFFF #define TX_NO_CLOSE_SW_PTR_MASK_V2 0x1FFFF #ifndef ETH_MIN_MTU @@ -816,9 +590,9 @@ This is free software, and you are welcome to redistribute it under certain cond /*****************************************************************************/ //#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)))) +#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) @@ -954,7 +728,7 @@ extern void __chk_io_ptr(void __iomem *); /*****************************************************************************/ /* 2.5.28 => 2.4.23 */ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,28)) +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,5,28) ) static inline void _kc_synchronize_irq(void) { @@ -975,12 +749,12 @@ static inline void _kc_synchronize_irq(void) /*****************************************************************************/ /* 2.6.4 => 2.6.0 */ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,4)) +#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)) +#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 @@ -1011,13 +785,13 @@ static inline int _kc_pci_dma_mapping_error(dma_addr_t dma_addr) /*****************************************************************************/ /* 2.4.22 => 2.4.17 */ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,22)) +#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)) +#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 */ @@ -1463,13 +1237,6 @@ enum RTL8125_registers { IMR_V2_SET_REG_8125 = 0x0D0C, TDU_STA_8125 = 0x0D08, RDU_STA_8125 = 0x0D0A, - IMR_V4_L2_CLEAR_REG_8125 = 0x0D10, - IMR_V4_L2_SET_REG_8125 = 0x0D18, - ISR_V4_L2_8125 = 0x0D14, - SW_TAIL_PTR0_8125BP = 0x0D30, - SW_TAIL_PTR1_8125BP = 0x0D38, - HW_CLO_PTR0_8125BP = 0x0D34, - HW_CLO_PTR1_8125BP = 0x0D3C, DOUBLE_VLAN_CONFIG = 0x1000, TX_NEW_CTRL = 0x203E, TNPDS_Q1_LOW_8125 = 0x2100, @@ -1477,8 +1244,6 @@ enum RTL8125_registers { PLA_TXQ1_IDLE_CREDIT = 0x2504, SW_TAIL_PTR0_8125 = 0x2800, HW_CLO_PTR0_8125 = 0x2802, - SW_TAIL_PTR0_8126 = 0x2800, - HW_CLO_PTR0_8126 = 0x2800, RDSAR_Q1_LOW_8125 = 0x4000, RSS_CTRL_8125 = 0x4500, Q_NUM_CTRL_8125 = 0x4800, @@ -1492,31 +1257,12 @@ enum RTL8125_registers { PTP_TIME_CORRECT_CMD_8125 = 0x6806, PTP_SOFT_CONFIG_Time_NS_8125 = 0x6808, PTP_SOFT_CONFIG_Time_S_8125 = 0x680C, - PTP_SOFT_CONFIG_Time_Sign = 0x6812, 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, - PTP_EGRESS_TIME_BASE_NS_8125 = 0XCF20, - PTP_EGRESS_TIME_BASE_S_8125 = 0XCF24, - - //TCAM - TCAM_NOTVALID_ADDR = 0xA000, - TCAM_VALID_ADDR = 0xA800, - TCAM_MAC_ADDR = 448, - TCAM_VLAN_TAG = 496, - //TCAM V2 - TCAM_NOTVALID_ADDR_V2 = 0xA000, - TCAM_VALID_ADDR_V2 = 0xB000, - TCAM_MAC_ADDR_V2 = 0x00, - TCAM_VLAN_TAG_V2 = 0x03, - //ipc2 - IB2SOC_SET = 0x0010, - IB2SOC_DATA = 0x0014, - IB2SOC_CMD = 0x0018, - IB2SOC_IMR = 0x001C, }; enum RTL8125_register_content { @@ -1546,10 +1292,6 @@ enum RTL8125_register_content { RxRUNT_V3 = (1 << 19), RxCRC_V3 = (1 << 17), - RxRES_V4 = (1 << 22), - RxRUNT_V4 = (1 << 21), - RxCRC_V4 = (1 << 20), - /* ChipCmdBits */ StopReq = 0x80, CmdReset = 0x10, @@ -1584,7 +1326,6 @@ enum RTL8125_register_content { Reserved2_shift = 13, RxCfgDMAShift = 8, EnableRxDescV3 = (1 << 24), - EnableRxDescV4_1 = (1 << 24), EnableOuterVlan = (1 << 23), EnableInnerVlan = (1 << 22), RxCfg_128_int_en = (1 << 15), @@ -1592,7 +1333,6 @@ enum RTL8125_register_content { RxCfg_half_refetch = (1 << 13), RxCfg_pause_slot_en = (1 << 11), RxCfg_9356SEL = (1 << 6), - EnableRxDescV4_0 = (1 << 1), //not in rcr /* TxConfigBits */ TxInterFrameGapShift = 24, @@ -1651,7 +1391,6 @@ enum RTL8125_register_content { /* rtl8125_PHYstatus */ PowerSaveStatus = 0x80, - _5000bpsF = 0x1000, _2500bpsF = 0x400, TxFlowCtrl = 0x40, RxFlowCtrl = 0x20, @@ -1753,28 +1492,16 @@ enum RTL8125_register_content { PTP_EXEC_CMD = (1 << 7), PTP_ADJUST_TIME_NS_NEGATIVE = (1 << 30), PTP_ADJUST_TIME_S_NEGATIVE = (1ULL << 48), - PTP_SOFT_CONFIG_TIME_NS_NEGATIVE = (1 << 30), - PTP_SOFT_CONFIG_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), - INT_CFG0_RDU_BYPASS_8126 = (1 << 4), - INT_CFG0_MSIX_ENTRY_NUM_MODE = (1 << 5), ISRIMR_V2_ROK_Q0 = (1 << 0), ISRIMR_TOK_Q0 = (1 << 16), ISRIMR_TOK_Q1 = (1 << 18), ISRIMR_V2_LINKCHG = (1 << 21), - ISRIMR_V4_ROK_Q0 = (1 << 0), - ISRIMR_V4_LINKCHG = (1 << 29), - - ISRIMR_V5_ROK_Q0 = (1 << 0), - ISRIMR_V5_TOK_Q0 = (1 << 16), - ISRIMR_V5_TOK_Q1 = (1 << 17), - ISRIMR_V5_LINKCHG = (1 << 18), - /* Magic Number */ RTL8125_MAGIC_NUMBER = 0x0badbadbadbadbadull, }; @@ -1790,11 +1517,6 @@ enum _DescStatusBit { FirstFrag_V3 = (1 << 25), /* First segment of a packet */ LastFrag_V3 = (1 << 24), /* Final segment of a packet */ - DescOwn_V4 = (DescOwn), /* Descriptor is owned by NIC */ - RingEnd_V4 = (RingEnd), /* End of descriptor ring */ - FirstFrag_V4 = (FirstFrag), /* First segment of a packet */ - LastFrag_V4 = (LastFrag), /* Final segment of a packet */ - /* Tx private */ /*------ offset 0 of tx descriptor ------*/ LargeSend = (1 << 27), /* TCP Large Send Offload (TSO) */ @@ -1853,7 +1575,7 @@ enum _DescStatusBit { 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), /* SCTP 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 @@@@@@*/ @@ -1866,23 +1588,6 @@ enum _DescStatusBit { RxV6F_v3 = (RxV6F), RxV4F_v3 = (RxV4F), /*@@@@@@ offset 4 of rx descriptor => bits for RTL8125 only end @@@@@@*/ - - RxIPF_v4 = (1 << 17), /* IP checksum failed */ - RxUDPF_v4 = (1 << 16), /* UDP/IP checksum failed */ - RxTCPF_v4 = (1 << 15), /* TCP/IP checksum failed */ - RxSCTPF_v4 = (1 << 19), /* SCTP checksum failed */ - RxVlanTag_v4 = (RxVlanTag), /* VLAN tag available */ - - /*@@@@@@ offset 0 of rx descriptor => bits for RTL8125 only begin @@@@@@*/ - RxUDPT_v4 = (1 << 19), - RxTCPT_v4 = (1 << 18), - RxSCTP_v4 = (1 << 19), - /*@@@@@@ offset 0 of rx descriptor => bits for RTL8125 only end @@@@@@*/ - - /*@@@@@@ offset 4 of rx descriptor => bits for RTL8125 only begin @@@@@@*/ - RxV6F_v4 = (RxV6F), - RxV4F_v4 = (RxV4F), - /*@@@@@@ offset 4 of rx descriptor => bits for RTL8125 only end @@@@@@*/ }; enum features { @@ -1942,7 +1647,7 @@ enum rtl8125_cp_status { rtl8125_cp_unknown }; -enum efuse { +enum effuse { EFUSE_NOT_SUPPORT = 0, EFUSE_SUPPORT_V1, EFUSE_SUPPORT_V2, @@ -1951,7 +1656,6 @@ enum efuse { }; #define RsvdMask 0x3fffc000 #define RsvdMaskV3 0x3fff8000 -#define RsvdMaskV4 RsvdMaskV3 struct TxDesc { u32 opts1; @@ -2018,22 +1722,6 @@ struct RxDescV3 { }; }; -struct RxDescV4 { - union { - u64 addr; - - struct { - u32 RSSInfo; - u32 RSSResult; - } RxDescNormalDDWord1; - }; - - struct { - u32 opts2; - u32 opts1; - } RxDescNormalDDWord2; -}; - enum rxdesc_type { RXDESC_TYPE_NORMAL=0, RXDESC_TYPE_NEXT, @@ -2047,21 +1735,17 @@ enum rx_desc_ring_type { RX_DESC_RING_TYPE_1, RX_DESC_RING_TYPE_2, RX_DESC_RING_TYPE_3, - RX_DESC_RING_TYPE_4, 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)), - RX_DESC_LEN_TYPE_4 = (sizeof(struct RxDescV4)) + RX_DESC_LEN_TYPE_3 = (sizeof(struct RxDescV3)) }; struct ring_info { struct sk_buff *skb; u32 len; - unsigned int bytecount; - unsigned short gso_segs; u8 __pad[sizeof(void *) - sizeof(u32)]; }; @@ -2093,14 +1777,8 @@ enum r8125_flag { R8125_FLAG_MAX }; -enum r8125_sysfs_flag { - R8125_SYSFS_RTL_ADV = 0, - R8125_SYSFS_FLAG_MAX -}; - struct rtl8125_tx_ring { void* priv; - struct net_device *netdev; u32 index; u32 cur_tx; /* Index into the Tx descriptor buffer of next Rx pkt. */ u32 dirty_tx; @@ -2119,17 +1797,8 @@ struct rtl8125_tx_ring { u16 tdsar_reg; /* Transmit Descriptor Start Address */ }; -struct rtl8125_rx_buffer { - struct page *page; - u32 page_offset; - dma_addr_t dma; - void* data; - struct sk_buff *skb; -}; - struct rtl8125_rx_ring { void* priv; - struct net_device *netdev; u32 index; u32 cur_rx; /* Index into the Rx descriptor buffer of next Rx pkt. */ u32 dirty_rx; @@ -2138,12 +1807,7 @@ struct rtl8125_rx_ring { u32 RxDescAllocSize; u64 RxDescPhyAddr[MAX_NUM_RX_DESC]; /* Rx desc physical address*/ dma_addr_t RxPhyAddr; -#ifdef ENABLE_PAGE_REUSE - struct rtl8125_rx_buffer rx_buffer[MAX_NUM_RX_DESC]; - u16 rx_offset; -#else struct sk_buff *Rx_skbuff[MAX_NUM_RX_DESC]; /* Rx data buffers */ -#endif //ENABLE_PAGE_REUSE u16 rdsar_reg; /* Receive Descriptor Start Address */ }; @@ -2378,27 +2042,6 @@ enum rtl8125_fc_mode { rtl8125_fc_default }; -enum rtl8125_state_t { - __RTL8125_TESTING = 0, - __RTL8125_RESETTING, - __RTL8125_DOWN, - __RTL8125_PTP_TX_IN_PROGRESS, -}; - -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0) -struct ethtool_eee { - __u32 cmd; - __u32 supported; - __u32 advertised; - __u32 lp_advertised; - __u32 eee_active; - __u32 eee_enabled; - __u32 tx_lpi_enabled; - __u32 tx_lpi_timer; - __u32 reserved[2]; -}; -#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0) */ - struct rtl8125_private { void __iomem *mmio_addr; /* memory map physical address */ struct pci_dev *pci_dev; /* Index of PCI device */ @@ -2408,11 +2051,11 @@ struct rtl8125_private { unsigned int irq_nvecs; unsigned int max_irq_nvecs; unsigned int min_irq_nvecs; - unsigned int hw_supp_irq_nvecs; //struct msix_entry msix_entries[R8125_MAX_MSIX_VEC]; struct net_device_stats stats; /* statistics of net device */ - unsigned long state; - +#ifdef ENABLE_PTP_SUPPORT + spinlock_t lock; /* spin lock flag */ +#endif u32 msg_enable; u32 tx_tcp_csum_cmd; u32 tx_udp_csum_cmd; @@ -2432,11 +2075,6 @@ struct rtl8125_private { //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; -#ifdef ENABLE_PAGE_REUSE - unsigned rx_buf_page_order; - unsigned rx_buf_page_size; - u32 page_reuse_fail_cnt; -#endif //ENABLE_PAGE_REUSE u16 HwSuppNumTxQueues; u16 HwSuppNumRxQueues; unsigned int num_tx_rings; @@ -2444,7 +2082,7 @@ struct rtl8125_private { 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 blocking_notifier_head lib_nh; + 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 @@ -2454,7 +2092,6 @@ struct rtl8125_private { unsigned int esd_flag; unsigned int pci_cfg_is_read; unsigned int rtl8125_rx_config; - u16 rms; u16 cp_cmd; u32 intr_mask; u32 timer_intr_mask; @@ -2477,14 +2114,13 @@ struct rtl8125_private { u8 autoneg; u8 duplex; u32 speed; - u64 advertising; + u32 advertising; enum rtl8125_fc_mode fcpause; - u32 HwSuppMaxPhyLinkSpeed; u16 eeprom_len; u16 cur_page; u32 bios_setting; - int (*set_speed)(struct net_device *, u8 autoneg, u32 speed, u8 duplex, u64 adv); + 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 @@ -2511,7 +2147,7 @@ struct rtl8125_private { u8 org_pci_offset_80; u8 org_pci_offset_81; - u8 use_timer_interrupt; + u8 use_timer_interrrupt; u32 keep_intr_cnt; @@ -2523,12 +2159,17 @@ struct rtl8125_private { 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; @@ -2539,8 +2180,6 @@ struct rtl8125_private { u8 RequiredSecLanDonglePatch; - u8 RequiredPfmPatch; - u8 RequirePhyMdiSwapPatch; u8 RequireLSOPatch; @@ -2566,7 +2205,6 @@ struct rtl8125_private { u32 HwPcieSNOffset; - u32 MaxTxDescPtrMask; u8 HwSuppTxNoCloseVer; u8 EnableTxNoClose; @@ -2594,8 +2232,7 @@ struct rtl8125_private { u8 DASH; u8 dash_printer_enabled; u8 HwPkgDet; - u8 HwSuppOcpChannelVer; - u8 AllowAccessDashOcp; + void __iomem *mapped_cmac_ioaddr; /* mapped cmac memory map physical address */ void __iomem *cmac_ioaddr; /* cmac memory map physical address */ #ifdef ENABLE_DASH_SUPPORT @@ -2679,7 +2316,7 @@ struct rtl8125_private { //Realwow-------------- #endif //ENABLE_REALWOW_SUPPORT - struct ethtool_keee eee; + struct ethtool_eee eee; #ifdef ENABLE_R8125_PROCFS //Procfs support @@ -2687,18 +2324,13 @@ struct rtl8125_private { struct proc_dir_entry *proc_dir_debug; struct proc_dir_entry *proc_dir_test; #endif -#ifdef ENABLE_R8125_SYSFS - //sysfs support - DECLARE_BITMAP(sysfs_flag, R8125_SYSFS_FLAG_MAX); - u32 testmode; -#endif - u8 HwSuppRxDescType; 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; @@ -2723,13 +2355,6 @@ struct rtl8125_private { u8 HwSuppMacMcuVer; u16 MacMcuPageSize; - - u8 HwSuppTcamVer; - - u16 TcamNotValidReg; - u16 TcamValidReg; - u16 TcamMaAddrcOffset; - u16 TcamVlanTagOffset; }; #ifdef ENABLE_LIB_SUPPORT @@ -2750,7 +2375,7 @@ rtl8125_num_lib_rx_rings(struct rtl8125_private *tp) { int count, i; - for (count = 0, i = 0; i < tp->HwSuppNumRxQueues; i++) + for (count = 0, i = tp->num_rx_rings; i < tp->HwSuppNumRxQueues; i++) if(tp->lib_rx_ring[i].enabled) count++; @@ -2780,18 +2405,7 @@ rtl8125_tot_tx_rings(struct rtl8125_private *tp) static inline unsigned int rtl8125_tot_rx_rings(struct rtl8125_private *tp) { - unsigned int num_lib_rx_rings; - - num_lib_rx_rings = rtl8125_num_lib_rx_rings(tp); - if (num_lib_rx_rings > 0) - return num_lib_rx_rings; - else - return tp->num_rx_rings; -} - -static inline struct netdev_queue *txring_txq(const struct rtl8125_tx_ring *ring) -{ - return netdev_get_tx_queue(ring->netdev, ring->index); + return tp->num_rx_rings + rtl8125_num_lib_rx_rings(tp); } enum eetype { @@ -2808,10 +2422,6 @@ enum mcfg { CFG_METHOD_5, CFG_METHOD_6, CFG_METHOD_7, - CFG_METHOD_8, - CFG_METHOD_9, - CFG_METHOD_10, - CFG_METHOD_11, CFG_METHOD_DEFAULT, CFG_METHOD_MAX }; @@ -2845,11 +2455,7 @@ enum mcfg { #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 (0x0b99) -#define NIC_RAMCODE_VERSION_CFG_METHOD_8 (0x0013) -#define NIC_RAMCODE_VERSION_CFG_METHOD_9 (0x0001) -#define NIC_RAMCODE_VERSION_CFG_METHOD_10 (0x0016) -#define NIC_RAMCODE_VERSION_CFG_METHOD_11 (0x0001) +#define NIC_RAMCODE_VERSION_CFG_METHOD_5 (0x0b74) //hwoptimize #define HW_PATCH_SOC_LAN (BIT_0) @@ -2865,12 +2471,13 @@ 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); -u16 rtl8125_mac_ocp_read(struct rtl8125_private *tp, u16 reg_addr); +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); @@ -2890,25 +2497,17 @@ 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); -void rtl8125_mark_as_last_descriptor(struct rtl8125_private *tp, struct RxDesc *desc); static inline void rtl8125_make_unusable_by_asic(struct rtl8125_private *tp, struct RxDesc *desc) { - switch (tp->InitRxDescType) { - case RX_DESC_RING_TYPE_3: + 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); - break; - case RX_DESC_RING_TYPE_4: - ((struct RxDescV4 *)desc)->addr = RTL8125_MAGIC_NUMBER; - ((struct RxDescV4 *)desc)->RxDescNormalDDWord2.opts1 &= ~cpu_to_le32(DescOwn | RsvdMaskV4); - break; - default: + } else { desc->addr = RTL8125_MAGIC_NUMBER; desc->opts1 &= ~cpu_to_le32(DescOwn | RsvdMask); - break; } } @@ -2937,7 +2536,6 @@ 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_enable_mcu(struct rtl8125_private *tp, bool enable); void rtl8125_hw_start(struct net_device *dev); void rtl8125_hw_reset(struct net_device *dev); void rtl8125_tx_clear(struct rtl8125_private *tp); @@ -2954,14 +2552,10 @@ 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_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) -#define HW_SUPPORT_TCAM(_M) ((_M)->HwSuppTcamVer > 0) - -#define HW_SUPP_PHY_LINK_SPEED_GIGA(_M) ((_M)->HwSuppMaxPhyLinkSpeed >= 1000) -#define HW_SUPP_PHY_LINK_SPEED_2500M(_M) ((_M)->HwSuppMaxPhyLinkSpeed >= 2500) #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34) #define netdev_mc_count(dev) ((dev)->mc_count) diff --git a/src/r8125_dash.h b/src/r8125_dash.h index 4402bc5..6819370 100644 --- a/src/r8125_dash.h +++ b/src/r8125_dash.h @@ -2,10 +2,10 @@ /* ################################################################################ # -# r8125 is the Linux device driver released for Realtek 2.5 Gigabit Ethernet +# r8125 is the Linux device driver released for Realtek 2.5Gigabit Ethernet # controllers with PCI-Express interface. # -# Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved. +# 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 @@ -164,7 +164,6 @@ RX_DASH_BUFFER_TYPE_2, *PRX_DASH_BUFFER_TYPE_2; #define OCP_REG_CR (0x36) #define OCP_REG_DMEMSTA (0x38) #define OCP_REG_GPHYAR (0x60) -#define OCP_REG_FIRMWARE_MAJOR_VERSION (0x120) #define OCP_REG_CONFIG0_DASHEN BIT_15 @@ -176,16 +175,10 @@ RX_DASH_BUFFER_TYPE_2, *PRX_DASH_BUFFER_TYPE_2; #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 HW_DASH_SUPPORT_TYPE_4(_M) ((_M)->HwSuppDashVer == 4) -#define HW_DASH_SUPPORT_CMAC(_M) (HW_DASH_SUPPORT_TYPE_2(_M) || HW_DASH_SUPPORT_TYPE_3(_M)) -#define HW_DASH_SUPPORT_IPC2(_M) (HW_DASH_SUPPORT_TYPE_4(_M)) -#define HW_DASH_SUPPORT_GET_FIRMWARE_VERSION(_M) (HW_DASH_SUPPORT_TYPE_2(_M) || \ - HW_DASH_SUPPORT_TYPE_3(_M) || \ - HW_DASH_SUPPORT_TYPE_4(_M)) +#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) diff --git a/src/r8125_firmware.c b/src/r8125_firmware.c index 71ef049..61b92d1 100644 --- a/src/r8125_firmware.c +++ b/src/r8125_firmware.c @@ -2,10 +2,10 @@ /* ################################################################################ # -# r8125 is the Linux device driver released for Realtek 2.5 Gigabit Ethernet +# r8168 is the Linux device driver released for Realtek Gigabit Ethernet # controllers with PCI-Express interface. # -# Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved. +# 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 diff --git a/src/r8125_firmware.h b/src/r8125_firmware.h index 6ee0c41..df97bf9 100644 --- a/src/r8125_firmware.h +++ b/src/r8125_firmware.h @@ -2,10 +2,10 @@ /* ################################################################################ # -# r8125 is the Linux device driver released for Realtek 2.5 Gigabit Ethernet +# r8125 is the Linux device driver released for Realtek 2.5Gigabit Ethernet # controllers with PCI-Express interface. # -# Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved. +# 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 diff --git a/src/r8125_lib.c b/src/r8125_lib.c index ea8aefd..9660aca 100644 --- a/src/r8125_lib.c +++ b/src/r8125_lib.c @@ -1,10 +1,10 @@ /* ################################################################################ # -# r8125 is the Linux device driver released for Realtek 2.5 Gigabit Ethernet +# r8168 is the Linux device driver released for Realtek Gigabit Ethernet # controllers with PCI-Express interface. # -# Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved. +# 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 @@ -71,6 +71,22 @@ rtl8125_lib_tx_fill(struct rtl8125_ring *ring) } } +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_lib_rx_fill(struct rtl8125_ring *ring) { @@ -88,36 +104,34 @@ rtl8125_lib_rx_fill(struct rtl8125_ring *ring) rtl8125_get_rxdesc(tp, ring->desc_addr, ring->ring_size - 1)); } -static struct rtl8125_ring *rtl8125_get_tx_ring(struct rtl8125_private *tp) +struct rtl8125_ring *rtl8125_get_tx_ring(struct rtl8125_private *tp) { int i; WARN_ON_ONCE(tp->num_tx_rings < 1); for (i = tp->num_tx_rings; i < tp->HwSuppNumTxQueues; i++) { - if (i < R8125_MAX_TX_QUEUES) { - struct rtl8125_ring *ring = &tp->lib_tx_ring[i]; - if (!ring->allocated) { - ring->allocated = true; - return ring; - } + struct rtl8125_ring *ring = &tp->lib_tx_ring[i]; + if (!ring->allocated) { + ring->allocated = true; + return ring; } } return NULL; } -static struct rtl8125_ring *rtl8125_get_rx_ring(struct rtl8125_private *tp) +struct rtl8125_ring *rtl8125_get_rx_ring(struct rtl8125_private *tp) { int i; - for (i = 0; i < tp->HwSuppNumRxQueues; i++) { - if (i < R8125_MAX_RX_QUEUES) { - struct rtl8125_ring *ring = &tp->lib_rx_ring[i]; - if (!ring->allocated) { - ring->allocated = true; - return ring; - } + WARN_ON_ONCE(tp->num_rx_rings < 1); + + for (i = tp->num_rx_rings; i < tp->HwSuppNumRxQueues; i++) { + struct rtl8125_ring *ring = &tp->lib_rx_ring[i]; + if (!ring->allocated) { + ring->allocated = true; + return ring; } } @@ -142,10 +156,7 @@ static void rtl8125_init_rx_ring(struct rtl8125_ring *ring) rtl8125_lib_rx_fill(ring); - if (ring->queue_num > 0) - rdsar_reg = RDSAR_Q1_LOW_8125 + (ring->queue_num - 1) * 8; - else - rdsar_reg = RxDescAddrLow; + rdsar_reg = RDSAR_Q1_LOW_8125 + (ring->queue_num - 1) * 8; RTL_W32(tp, rdsar_reg, ((u64)ring->desc_daddr & DMA_BIT_MASK(32))); RTL_W32(tp, rdsar_reg + 4, ((u64)ring->desc_daddr >> 32)); } @@ -179,34 +190,34 @@ static void rtl8125_free_ring_mem(struct rtl8125_ring *ring) } if (ring->bufs) { - if (ring->flags & RTL8125_CONTIG_BUFS) { - struct rtl8125_buf *rtl_buf = &ring->bufs[0]; + if (ring->flags & RTL8125_CONTIG_BUFS) { + struct rtl8125_buf *rtl_buf = &ring->bufs[0]; if (rtl_buf->addr) { - dma_free_coherent( - &pdev->dev, - ring->ring_size * ring->buff_size, - rtl_buf->addr, - rtl_buf->dma_addr); + dma_free_coherent( + &pdev->dev, + ring->ring_size * ring->buff_size, + rtl_buf->addr, + rtl_buf->dma_addr); rtl_buf->addr = NULL; } - } else { - for (i=0; iring_size; i++) { - struct rtl8125_buf *rtl_buf = &ring->bufs[i]; - if (rtl_buf->addr) { - dma_free_coherent( - &pdev->dev, - rtl_buf->size, - rtl_buf->addr, - rtl_buf->dma_addr); - - rtl_buf->addr = NULL; - } - } - } - - kfree(ring->bufs); - ring->bufs = 0; + } else { + for (i=0; iring_size ; i++) { + struct rtl8125_buf *rtl_buf = &ring->bufs[i]; + if (rtl_buf->addr) { + dma_free_coherent( + &pdev->dev, + rtl_buf->size, + rtl_buf->addr, + rtl_buf->dma_addr); + + rtl_buf->addr = NULL; + } + } + } + + kfree(ring->bufs); + ring->bufs = 0; } } @@ -309,8 +320,8 @@ struct rtl8125_ring *rtl8125_request_ring(struct net_device *ndev, else if (direction == RTL8125_CH_DIR_RX) ring = rtl8125_get_rx_ring(tp); - if (!ring) - goto error_out; + if (!ring) + goto error_out; ring->ring_size = ring_size; ring->buff_size = buff_size; @@ -350,7 +361,7 @@ static int rtl8125_all_ring_released(struct rtl8125_private *tp) goto exit; } - for (i = 0; i < tp->HwSuppNumRxQueues; i++) { + for (i = tp->num_rx_rings; i < tp->HwSuppNumRxQueues; i++) { struct rtl8125_ring *ring = &tp->lib_rx_ring[i]; if (ring->allocated) goto exit; @@ -498,12 +509,8 @@ int rtl8125_request_event(struct rtl8125_ring *ring, unsigned long flags, /* Update MSI-X table entry with @addr and @data */ /* Initialize any MSI-X/interrupt related register in HW */ u16 reg = message_id * 0x10; - bool locked; - if (!rtnl_trylock()) - locked = false; - else - locked = true; + rtnl_lock(); ring->event.addr = rtl8125_eri_read(tp, reg, 4, ERIAR_MSIX); ring->event.addr |= (u64)rtl8125_eri_read(tp, reg + 4, 4, ERIAR_MSIX) << 32; @@ -515,8 +522,7 @@ int rtl8125_request_event(struct rtl8125_ring *ring, unsigned long flags, rtl8125_eri_write(tp, reg + 8, 4, data, ERIAR_MSIX); rtl8125_eri_write(tp, reg + 12, 4, data >> 32, ERIAR_MSIX); - if (locked) - rtnl_unlock(); + rtnl_unlock(); ring->event.message_id = message_id; ring->event.allocated = 1; @@ -688,12 +694,7 @@ EXPORT_SYMBOL(rtl8125_rss_reset); struct net_device *rtl8125_get_netdev(struct device *dev) { - struct pci_dev *pdev; - - if(!dev) - return NULL; - - pdev = to_pci_dev(dev); + struct pci_dev *pdev = to_pci_dev(dev); /* Get device private data from @dev */ /* Retrieve struct net_device * from device private data */ @@ -715,7 +716,7 @@ int rtl8125_register_notifier(struct net_device *net_dev, { struct rtl8125_private *tp = netdev_priv(net_dev); - return blocking_notifier_chain_register(&tp->lib_nh, nb); + return atomic_notifier_chain_register(&tp->lib_nh, nb); } EXPORT_SYMBOL(rtl8125_register_notifier); @@ -724,21 +725,21 @@ int rtl8125_unregister_notifier(struct net_device *net_dev, { struct rtl8125_private *tp = netdev_priv(net_dev); - return blocking_notifier_chain_unregister(&tp->lib_nh, nb); + return atomic_notifier_chain_unregister(&tp->lib_nh, nb); } EXPORT_SYMBOL(rtl8125_unregister_notifier); void rtl8125_lib_reset_prepare(struct rtl8125_private *tp) { - blocking_notifier_call_chain(&tp->lib_nh, - RTL8125_NOTIFY_RESET_PREPARE, NULL); + atomic_notifier_call_chain(&tp->lib_nh, + RTL8125_NOTIFY_RESET_PREPARE, NULL); } EXPORT_SYMBOL(rtl8125_lib_reset_prepare); void rtl8125_lib_reset_complete(struct rtl8125_private *tp) { - blocking_notifier_call_chain(&tp->lib_nh, - RTL8125_NOTIFY_RESET_COMPLETE, NULL); + atomic_notifier_call_chain(&tp->lib_nh, + RTL8125_NOTIFY_RESET_COMPLETE, NULL); } EXPORT_SYMBOL(rtl8125_lib_reset_complete); @@ -872,7 +873,7 @@ void rtl8125_init_lib_ring(struct rtl8125_private *tp) rtl8125_init_tx_ring(ring); } - for (i = 0; i < tp->HwSuppNumRxQueues; i++) { + for (i = tp->num_rx_rings; i < tp->HwSuppNumRxQueues; i++) { struct rtl8125_ring *ring = &tp->lib_rx_ring[i]; if (!ring->allocated) diff --git a/src/r8125_lib.h b/src/r8125_lib.h index d2ddabe..504b8b7 100644 --- a/src/r8125_lib.h +++ b/src/r8125_lib.h @@ -1,10 +1,10 @@ /* ################################################################################ # -# r8125 is the Linux device driver released for Realtek 2.5 Gigabit Ethernet +# r8125 is the Linux device driver released for Realtek 2.5Gigabit Ethernet # controllers with PCI-Express interface. # -# Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved. +# 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 diff --git a/src/r8125_n.c b/src/r8125_n.c index 8baa2b1..768ba1a 100644 --- a/src/r8125_n.c +++ b/src/r8125_n.c @@ -2,10 +2,10 @@ /* ################################################################################ # -# r8125 is the Linux device driver released for Realtek 2.5 Gigabit Ethernet +# r8125 is the Linux device driver released for Realtek 2.5Gigabit Ethernet # controllers with PCI-Express interface. # -# Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved. +# 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 @@ -77,10 +77,6 @@ #include #endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,4,10) -#include -#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(6,4,10) */ - #include #include @@ -96,10 +92,10 @@ #define FIRMWARE_8125A_3 "rtl_nic/rtl8125a-3.fw" #define FIRMWARE_8125B_2 "rtl_nic/rtl8125b-2.fw" -#define FIRMWARE_8125BP_1 "rtl_nic/rtl8125bp-1.fw" -#define FIRMWARE_8125BP_2 "rtl_nic/rtl8125bp-2.fw" -#define FIRMWARE_8125D_1 "rtl_nic/rtl8125d-1.fw" -#define FIRMWARE_8125D_2 "rtl_nic/rtl8125d-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; @@ -112,10 +108,6 @@ static const struct { [CFG_METHOD_5] = {"RTL8125B", FIRMWARE_8125B_2}, [CFG_METHOD_6] = {"RTL8168KB", FIRMWARE_8125A_3}, [CFG_METHOD_7] = {"RTL8168KB", FIRMWARE_8125B_2}, - [CFG_METHOD_8] = {"RTL8125BP", FIRMWARE_8125BP_1}, - [CFG_METHOD_9] = {"RTL8125BP", FIRMWARE_8125BP_2}, - [CFG_METHOD_10] = {"RTL8125D", FIRMWARE_8125D_1}, - [CFG_METHOD_11] = {"RTL8125D", FIRMWARE_8125D_2}, [CFG_METHOD_DEFAULT] = {"Unknown", }, }; @@ -131,67 +123,43 @@ static const struct { } rtl_chip_info[] = { _R("RTL8125A", CFG_METHOD_2, - Rx_Fetch_Number_8 | EnableInnerVlan | EnableOuterVlan | (RX_DMA_BURST_256 << RxCfgDMAShift), + BIT_30 | EnableInnerVlan | EnableOuterVlan | (RX_DMA_BURST << RxCfgDMAShift), 0xff7e5880, Jumbo_Frame_9k), _R("RTL8125A", CFG_METHOD_3, - Rx_Fetch_Number_8 | EnableInnerVlan | EnableOuterVlan | (RX_DMA_BURST_256 << RxCfgDMAShift), + BIT_30 | EnableInnerVlan | EnableOuterVlan | (RX_DMA_BURST << RxCfgDMAShift), 0xff7e5880, Jumbo_Frame_9k), _R("RTL8125B", CFG_METHOD_4, - Rx_Fetch_Number_8 | RxCfg_pause_slot_en | EnableInnerVlan | EnableOuterVlan | (RX_DMA_BURST_256 << RxCfgDMAShift), + BIT_30 | RxCfg_pause_slot_en | EnableInnerVlan | EnableOuterVlan | (RX_DMA_BURST << RxCfgDMAShift), 0xff7e5880, Jumbo_Frame_9k), _R("RTL8125B", CFG_METHOD_5, - Rx_Fetch_Number_8 | RxCfg_pause_slot_en | EnableInnerVlan | EnableOuterVlan | (RX_DMA_BURST_256 << RxCfgDMAShift), + BIT_30 | RxCfg_pause_slot_en | EnableInnerVlan | EnableOuterVlan | (RX_DMA_BURST << RxCfgDMAShift), 0xff7e5880, Jumbo_Frame_9k), _R("RTL8168KB", CFG_METHOD_6, - Rx_Fetch_Number_8 | EnableInnerVlan | EnableOuterVlan | (RX_DMA_BURST_256 << RxCfgDMAShift), + BIT_30 | EnableInnerVlan | EnableOuterVlan | (RX_DMA_BURST << RxCfgDMAShift), 0xff7e5880, Jumbo_Frame_9k), _R("RTL8168KB", CFG_METHOD_7, - Rx_Fetch_Number_8 | RxCfg_pause_slot_en | EnableInnerVlan | EnableOuterVlan | (RX_DMA_BURST_256 << RxCfgDMAShift), - 0xff7e5880, - Jumbo_Frame_9k), - - _R("RTL8125BP", - CFG_METHOD_8, - Rx_Fetch_Number_8 | Rx_Close_Multiple | RxCfg_pause_slot_en | EnableInnerVlan | EnableOuterVlan | (RX_DMA_BURST_256 << RxCfgDMAShift), - 0xff7e5880, - Jumbo_Frame_9k), - - _R("RTL8125BP", - CFG_METHOD_9, - Rx_Fetch_Number_8 | Rx_Close_Multiple | RxCfg_pause_slot_en | EnableInnerVlan | EnableOuterVlan | (RX_DMA_BURST_256 << RxCfgDMAShift), - 0xff7e5880, - Jumbo_Frame_9k), - - _R("RTL8125D", - CFG_METHOD_10, - Rx_Fetch_Number_8 | Rx_Close_Multiple | RxCfg_pause_slot_en | EnableInnerVlan | EnableOuterVlan | (RX_DMA_BURST_256 << RxCfgDMAShift), - 0xff7e5880, - Jumbo_Frame_9k), - - _R("RTL8125D", - CFG_METHOD_11, - Rx_Fetch_Number_8 | Rx_Close_Multiple | RxCfg_pause_slot_en | EnableInnerVlan | EnableOuterVlan | (RX_DMA_BURST_256 << RxCfgDMAShift), + BIT_30 | RxCfg_pause_slot_en | EnableInnerVlan | EnableOuterVlan | (RX_DMA_BURST << RxCfgDMAShift), 0xff7e5880, Jumbo_Frame_9k), _R("Unknown", CFG_METHOD_DEFAULT, - (RX_DMA_BURST_512 << RxCfgDMAShift), + (RX_DMA_BURST << RxCfgDMAShift), 0xff7e5880, Jumbo_Frame_1k) }; @@ -211,6 +179,7 @@ static struct pci_device_id rtl8125_pci_tbl[] = { 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); @@ -222,6 +191,13 @@ static struct { 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 @@ -262,10 +238,10 @@ static int enable_ptp_master_mode = 1; #else static int enable_ptp_master_mode = 0; #endif -#ifdef DISABLE_WOL_SUPPORT -static int disable_wol_support = 1; +#ifdef DISABLE_PM_SUPPORT +static int disable_pm_support = 1; #else -static int disable_wol_support = 0; +static int disable_pm_support = 0; #endif #ifdef ENABLE_DOUBLE_VLAN @@ -275,7 +251,7 @@ static int enable_double_vlan = 0; #endif MODULE_AUTHOR("Realtek and the Linux r8125 crew "); -MODULE_DESCRIPTION("Realtek r8125 Ethernet controller driver"); +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)."); @@ -286,6 +262,9 @@ 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."); @@ -295,6 +274,9 @@ 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."); @@ -316,8 +298,8 @@ 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_wol_support, int, 0); -MODULE_PARM_DESC(disable_wol_support, "Disable PM support."); +module_param(disable_pm_support, int, 0); +MODULE_PARM_DESC(disable_pm_support, "Disable PM support."); module_param(enable_double_vlan, int, 0); MODULE_PARM_DESC(enable_double_vlan, "Enable Double VLAN."); @@ -331,10 +313,6 @@ MODULE_LICENSE("GPL"); #ifdef ENABLE_USE_FIRMWARE_FILE MODULE_FIRMWARE(FIRMWARE_8125A_3); MODULE_FIRMWARE(FIRMWARE_8125B_2); -MODULE_FIRMWARE(FIRMWARE_8125BP_1); -MODULE_FIRMWARE(FIRMWARE_8125BP_2); -MODULE_FIRMWARE(FIRMWARE_8125D_1); -MODULE_FIRMWARE(FIRMWARE_8125D_2); #endif MODULE_VERSION(RTL8125_VERSION); @@ -371,6 +349,7 @@ 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); @@ -384,15 +363,15 @@ 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 void rtl8125_mdio_direct_write_phy_ocp(struct rtl8125_private *tp, u16 RegAddr,u16 value); -static u32 rtl8125_mdio_direct_read_phy_ocp(struct rtl8125_private *tp, u16 RegAddr); -static void rtl8125_clear_and_set_eth_phy_ocp_bit(struct rtl8125_private *tp, u16 addr, u16 clearmask, u16 setmask); -static void rtl8125_clear_eth_phy_ocp_bit(struct rtl8125_private *tp, u16 addr, u16 mask); -static void rtl8125_set_eth_phy_ocp_bit(struct rtl8125_private *tp, u16 addr, u16 mask); +static void mdio_direct_write_phy_ocp(struct rtl8125_private *tp, u16 RegAddr,u16 value); +static u32 mdio_direct_read_phy_ocp(struct rtl8125_private *tp, u16 RegAddr); +static void ClearAndSetEthPhyOcpBit(struct rtl8125_private *tp, u16 addr, u16 clearmask, u16 setmask); +static void ClearEthPhyOcpBit(struct rtl8125_private *tp, u16 addr, u16 mask); +static void SetEthPhyOcpBit(struct rtl8125_private *tp, u16 addr, u16 mask); 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, u64 adv); +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); @@ -523,7 +502,7 @@ struct _kc_ethtool_ops { #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0) #ifndef SET_ETHTOOL_OPS #define SET_ETHTOOL_OPS(netdev,ops) \ - ((netdev)->ethtool_ops = (ops)) + ( (netdev)->ethtool_ops = (ops) ) #endif //SET_ETHTOOL_OPS #endif //LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0) @@ -549,7 +528,7 @@ static inline void eth_copy_and_sum (struct sk_buff *dest, const unsigned char *src, int len, int base) { - skb_copy_to_linear_data(dest, src, len); + memcpy (dest->data, src, len); } #endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,6,22) @@ -697,9 +676,7 @@ static u32 rtl8125_read_thermal_sensor(struct rtl8125_private *tp) case CFG_METHOD_4: case CFG_METHOD_5: case CFG_METHOD_7: - case CFG_METHOD_10: - case CFG_METHOD_11: - ts_digout = rtl8125_mdio_direct_read_phy_ocp(tp, 0xBD84); + ts_digout = mdio_direct_read_phy_ocp(tp, 0xBD84); ts_digout &= 0x3ff; break; default: @@ -736,62 +713,6 @@ int rtl8125_dump_tally_counter(struct rtl8125_private *tp, dma_addr_t paddr) return retval; } -static u32 -rtl8125_get_hw_clo_ptr(struct rtl8125_tx_ring *ring) -{ - struct rtl8125_private *tp = ring->priv; - - if (!tp) - return 0; - - switch (tp->HwSuppTxNoCloseVer) { - case 3: - return RTL_R16(tp, ring->hw_clo_ptr_reg); - case 4: - case 5: - case 6: - return RTL_R32(tp, ring->hw_clo_ptr_reg); - default: -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - WARN_ON(1); -#endif - return 0; - } -} - -static u32 -rtl8125_get_sw_tail_ptr(struct rtl8125_tx_ring *ring) -{ - struct rtl8125_private *tp = ring->priv; - - if (!tp) - return 0; - - switch (tp->HwSuppTxNoCloseVer) { - case 3: - return RTL_R16(tp, ring->sw_tail_ptr_reg); - case 4: - case 5: - case 6: - return RTL_R32(tp, ring->sw_tail_ptr_reg); - default: -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - WARN_ON(1); -#endif - return 0; - } -} - -static bool -rtl8125_sysfs_testmode_on(struct rtl8125_private *tp) -{ -#ifdef ENABLE_R8125_SYSFS - return !!tp->testmode; -#else - return 1; -#endif -} - static u32 rtl8125_convert_link_speed(u16 status) { u32 speed = SPEED_UNKNOWN; @@ -853,15 +774,15 @@ static void rtl8125_mdi_swap(struct rtl8125_private *tp) tps_p0 << 11; for (i=8; i<12; i++) { - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, reg); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - BIT(i), - val & BIT(i)); + mdio_direct_write_phy_ocp(tp, 0xA436, reg); + ClearAndSetEthPhyOcpBit(tp, + 0xA438, + BIT(i), + val & BIT(i)); } } -static int _rtl8125_vcd_test(struct rtl8125_private *tp) +static int rtl8125_vcd_test(struct rtl8125_private *tp) { u16 val; u32 wait_cnt; @@ -869,14 +790,14 @@ static int _rtl8125_vcd_test(struct rtl8125_private *tp) rtl8125_mdi_swap(tp); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA422, BIT(0)); - rtl8125_set_eth_phy_ocp_bit(tp, 0xA422, 0x00F0); - rtl8125_set_eth_phy_ocp_bit(tp, 0xA422, BIT(0)); + ClearEthPhyOcpBit(tp, 0xA422, BIT(0)); + SetEthPhyOcpBit(tp, 0xA422, 0x00F0); + SetEthPhyOcpBit(tp, 0xA422, BIT(0)); wait_cnt = 0; do { mdelay(1); - val = rtl8125_mdio_direct_read_phy_ocp(tp, 0xA422); + val = mdio_direct_read_phy_ocp(tp, 0xA422); wait_cnt++; } while (!(val & BIT_15) && (wait_cnt < 5000)); @@ -889,51 +810,17 @@ static int _rtl8125_vcd_test(struct rtl8125_private *tp) return ret; } -static int rtl8125_vcd_test(struct rtl8125_private *tp, bool poe_mode) -{ - int ret; - - switch (tp->mcfg) { - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_7: - /* update rtct threshold for poe mode */ - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8FE1); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, poe_mode ? 0x0A44 : 0x0000); - - /* enable rtct poe mode */ - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8FE3); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, poe_mode ? 0x0100 : 0x0000); - - ret = _rtl8125_vcd_test(tp); - - /* disable rtct poe mode */ - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8FE3); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - - /* restore rtct threshold */ - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8FE1); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - break; - default: - ret = _rtl8125_vcd_test(tp); - break; - } - - return ret; -} - static void rtl8125_get_cp_len(struct rtl8125_private *tp, - int cp_len[RTL8125_CP_NUM]) + u16 cp_len[RTL8125_CP_NUM]) { int i; u16 status; - int tmp_cp_len; + u16 tmp_cp_len = 0; status = RTL_R16(tp, PHYstatus); if (status & LinkStatus) { if (status & _10bps) { - tmp_cp_len = -1; + tmp_cp_len = 0; } else if (status & (_100bps | _1000bpsF)) { rtl8125_mdio_write(tp, 0x1f, 0x0a88); tmp_cp_len = rtl8125_mdio_read(tp, 0x10); @@ -953,15 +840,15 @@ static void rtl8125_get_cp_len(struct rtl8125_private *tp, break; } } else - tmp_cp_len = 0; + goto exit; } else - tmp_cp_len = 0; + goto exit; - if (tmp_cp_len > 0) - tmp_cp_len &= 0xff; + tmp_cp_len &= 0xff; for (i=0; i 3) goto exit; - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8027 + 4 * pair_num); - val = rtl8125_mdio_direct_read_phy_ocp(tp, 0xA438); + mdio_direct_write_phy_ocp(tp, 0xA436, 0x8027 + 4 * pair_num); + val = mdio_direct_read_phy_ocp(tp, 0xA438); cp_status = __rtl8125_get_cp_status(val); @@ -1028,8 +915,8 @@ static u16 rtl8125_get_cp_pp(struct rtl8125_private *tp, u8 pair_num) if (pair_num > 3) goto exit; - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8029 + 4 * pair_num); - pp = rtl8125_mdio_direct_read_phy_ocp(tp, 0xA438); + mdio_direct_write_phy_ocp(tp, 0xA436, 0x8029 + 4 * pair_num); + pp = mdio_direct_read_phy_ocp(tp, 0xA438); pp &= 0x3fff; pp /= 80; @@ -1039,30 +926,12 @@ static u16 rtl8125_get_cp_pp(struct rtl8125_private *tp, u8 pair_num) } static void rtl8125_get_cp_status(struct rtl8125_private *tp, - int cp_status[RTL8125_CP_NUM], - bool poe_mode) + int cp_status[RTL8125_CP_NUM]) { - u16 status; int i; - status = RTL_R16(tp, PHYstatus); - if (status & LinkStatus && !(status & (_10bps | _100bps))) { - for (i=0; itx_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); -#ifdef ENABLE_PAGE_REUSE - seq_printf(m, "rx_buf_page_order\t0x%x\n", tp->rx_buf_page_order); - seq_printf(m, "rx_buf_page_size\t0x%x\n", tp->rx_buf_page_size); - seq_printf(m, "page_reuse_fail_cnt\t0x%x\n", tp->page_reuse_fail_cnt); -#endif //ENABLE_PAGE_REUSE 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); @@ -1124,16 +988,17 @@ static int proc_get_driver_variable(struct seq_file *m, void *v) 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%llx\n", tp->advertising); + 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_interrupt\t0x%x\n", tp->use_timer_interrupt); + 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); @@ -1143,6 +1008,7 @@ static int proc_get_driver_variable(struct seq_file *m, void *v) 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); @@ -1153,7 +1019,6 @@ static int proc_get_driver_variable(struct seq_file *m, void *v) 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, "RequiredPfmPatch\t0x%x\n", tp->RequiredPfmPatch); 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); @@ -1161,6 +1026,7 @@ static int proc_get_driver_variable(struct seq_file *m, void *v) 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); @@ -1168,7 +1034,6 @@ static int proc_get_driver_variable(struct seq_file *m, void *v) 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, "disable_wol_support\t0x%x\n", disable_wol_support); seq_printf(m, "enable_double_vlan\t0x%x\n", enable_double_vlan); seq_printf(m, "HwSuppMagicPktVer\t0x%x\n", tp->HwSuppMagicPktVer); seq_printf(m, "HwSuppLinkChgWakeUpVer\t0x%x\n", tp->HwSuppLinkChgWakeUpVer); @@ -1180,26 +1045,19 @@ static int proc_get_driver_variable(struct seq_file *m, void *v) 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, "hw_clo_ptr_reg0\t0x%x\n", rtl8125_get_hw_clo_ptr(&tp->tx_ring[0])); - seq_printf(m, "sw_tail_ptr_reg0\t0x%x\n", rtl8125_get_sw_tail_ptr(&tp->tx_ring[0])); 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, "hw_clo_ptr_reg1\t0x%x\n", rtl8125_get_hw_clo_ptr(&tp->tx_ring[1])); - seq_printf(m, "sw_tail_ptr_reg1\t0x%x\n", rtl8125_get_sw_tail_ptr(&tp->tx_ring[1])); 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, "HwSuppNumRxQueues\t0x%x\n", tp->HwSuppNumRxQueues); - seq_printf(m, "HwSuppNumTxQueues\t0x%x\n", tp->HwSuppNumTxQueues); 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, "hw_supp_irq_nvecs\t0x%x\n", tp->hw_supp_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); @@ -1304,69 +1162,7 @@ static int proc_get_registers(struct seq_file *m, void *v) rtnl_lock(); for (n = 0; n < max;) { - seq_printf(m, "\n0x%04x:\t", n); - - for (i = 0; i < 16 && n < max; i++, n++) { - byte_rd = readb(ioaddr + n); - seq_printf(m, "%02x ", byte_rd); - } - } - - max = 0xB00; - for (n = 0xA00; n < max;) { - seq_printf(m, "\n0x%04x:\t", n); - - for (i = 0; i < 16 && n < max; i++, n++) { - byte_rd = readb(ioaddr + n); - seq_printf(m, "%02x ", byte_rd); - } - } - - max = 0xD40; - for (n = 0xD00; n < max;) { - seq_printf(m, "\n0x%04x:\t", n); - - for (i = 0; i < 16 && n < max; i++, n++) { - byte_rd = readb(ioaddr + n); - seq_printf(m, "%02x ", byte_rd); - } - } - - max = 0x2840; - for (n = 0x2800; n < max;) { - seq_printf(m, "\n0x%04x:\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_all_registers(struct seq_file *m, void *v) -{ - struct net_device *dev = m->private; - int i, n, max; - u8 byte_rd; - struct rtl8125_private *tp = netdev_priv(dev); - void __iomem *ioaddr = tp->mmio_addr; - struct pci_dev *pdev = tp->pci_dev; - - seq_puts(m, "\nDump All MAC Registers\n"); - seq_puts(m, "Offset\tValue\n------\t-----\n"); - - rtnl_lock(); - - max = pci_resource_len(pdev, 2); - max = min(max, 0x8000); - - for (n = 0; n < max;) { - seq_printf(m, "\n0x%04x:\t", n); + seq_printf(m, "\n0x%02x:\t", n); for (i = 0; i < 16 && n < max; i++, n++) { byte_rd = readb(ioaddr + n); @@ -1376,8 +1172,6 @@ static int proc_get_all_registers(struct seq_file *m, void *v) rtnl_unlock(); - seq_printf(m, "\nTotal length:0x%X", max); - seq_putc(m, '\n'); return 0; } @@ -1432,45 +1226,6 @@ static int proc_get_eth_phy(struct seq_file *m, void *v) } } - seq_puts(m, "\n####################extra reg##################\n "); - n = 0xA400; - seq_printf(m, "\n0x%02x:\t", n); - for (i = 0; i < 8; i++, n+=2) { - word_rd = rtl8125_mdio_direct_read_phy_ocp(tp, n); - seq_printf(m, "%04x ", word_rd); - } - - n = 0xA410; - seq_printf(m, "\n0x%02x:\t", n); - for (i = 0; i < 3; i++, n+=2) { - word_rd = rtl8125_mdio_direct_read_phy_ocp(tp, n); - seq_printf(m, "%04x ", word_rd); - } - - n = 0xA434; - seq_printf(m, "\n0x%02x:\t", n); - word_rd = rtl8125_mdio_direct_read_phy_ocp(tp, n); - seq_printf(m, "%04x ", word_rd); - - n = 0xA5D0; - seq_printf(m, "\n0x%02x:\t", n); - for (i = 0; i < 4; i++, n+=2) { - word_rd = rtl8125_mdio_direct_read_phy_ocp(tp, n); - seq_printf(m, "%04x ", word_rd); - } - - n = 0xA61A; - seq_printf(m, "\n0x%02x:\t", n); - word_rd = rtl8125_mdio_direct_read_phy_ocp(tp, n); - seq_printf(m, "%04x ", word_rd); - - n = 0xA6D0; - seq_printf(m, "\n0x%02x:\t", n); - for (i = 0; i < 3; i++, n+=2) { - word_rd = rtl8125_mdio_direct_read_phy_ocp(tp, n); - seq_printf(m, "%04x ", word_rd); - } - rtnl_unlock(); seq_putc(m, '\n'); @@ -1548,26 +1303,15 @@ static int proc_get_temperature(struct seq_file *m, void *v) case CFG_METHOD_4: case CFG_METHOD_5: case CFG_METHOD_7: - case CFG_METHOD_10: - case CFG_METHOD_11: seq_puts(m, "\nChip Temperature\n"); break; default: - return -EOPNOTSUPP; + seq_puts(m, "\nThis Chip Does Not Support Dump Temperature\n"); + break; } rtnl_lock(); - - if (!rtl8125_sysfs_testmode_on(tp)) { - seq_puts(m, "\nPlease turn on ""/sys/class/net//rtk_adv/testmode"".\n\n"); - rtnl_unlock(); - return 0; - } - - netif_testing_on(dev); ts_digout = rtl8125_read_thermal_sensor(tp); - netif_testing_off(dev); - rtnl_unlock(); tj = ts_digout / 2; @@ -1587,42 +1331,32 @@ static int proc_get_temperature(struct seq_file *m, void *v) return 0; } -static int _proc_get_cable_info(struct seq_file *m, void *v, bool poe_mode) +static int proc_get_cable_info(struct seq_file *m, void *v) { int i; u16 status; int cp_status[RTL8125_CP_NUM]; - int cp_len[RTL8125_CP_NUM] = {0}; + u16 cp_len[RTL8125_CP_NUM] = {0}; struct net_device *dev = m->private; struct rtl8125_private *tp = netdev_priv(dev); const char *pair_str[RTL8125_CP_NUM] = {"1-2", "3-6", "4-5", "7-8"}; - int ret; switch (tp->mcfg) { case CFG_METHOD_2 ... CFG_METHOD_7: /* support */ break; default: - ret = -EOPNOTSUPP; - goto error_out; + return -EOPNOTSUPP; } rtnl_lock(); - if (!rtl8125_sysfs_testmode_on(tp)) { - seq_puts(m, "\nPlease turn on ""/sys/class/net//rtk_adv/testmode"".\n\n"); - ret = 0; - goto error_unlock; - } - rtl8125_mdio_write(tp, 0x1F, 0x0000); if (rtl8125_mdio_read(tp, MII_BMCR) & BMCR_PDOWN) { - ret = -EIO; - goto error_unlock; + rtnl_unlock(); + return -EIO; } - netif_testing_on(dev); - status = RTL_R16(tp, PHYstatus); if (status & LinkStatus) seq_printf(m, "\nlink speed:%d", @@ -1632,49 +1366,39 @@ static int _proc_get_cable_info(struct seq_file *m, void *v, bool poe_mode) rtl8125_get_cp_len(tp, cp_len); - rtl8125_get_cp_status(tp, cp_status, poe_mode); + if (tp->link_ok(dev)) { + for (i=0; iphy_reset_enable(dev); - ret = 0; + rtl8125_set_speed(dev, tp->autoneg, tp->speed, tp->duplex, tp->advertising); -error_unlock: rtnl_unlock(); -error_out: - return ret; -} - -static int proc_get_cable_info(struct seq_file *m, void *v) -{ - return _proc_get_cable_info(m, v, 0); -} - -static int proc_get_poe_cable_info(struct seq_file *m, void *v) -{ - return _proc_get_cable_info(m, v, 1); + seq_putc(m, '\n'); + return 0; } -static void _proc_dump_desc(struct seq_file *m, void *desc_base, u32 alloc_size) +void _proc_dump_desc(struct seq_file *m, void *desc_base, u32 alloc_size) { u32 *pdword; int i; @@ -1698,26 +1422,24 @@ static int proc_dump_rx_desc(struct seq_file *m, void *v) { struct net_device *dev = m->private; struct rtl8125_private *tp = netdev_priv(dev); - int i; + struct rtl8125_rx_ring *ring = &tp->rx_ring[0]; - rtnl_lock(); - - for (i = 0; i < tp->num_rx_rings; i++) { - struct rtl8125_rx_ring *ring = &tp->rx_ring[i]; + if (!ring) + return -EOPNOTSUPP; - if (!ring) - continue; + rtnl_lock(); - seq_printf(m, "\ndump rx %d desc:%d\n", i, ring->num_rx_desc); + seq_printf(m, "\ndump rx desc:%d\n", ring->num_rx_desc); - _proc_dump_desc(m, (void*)ring->RxDescArray, ring->RxDescAllocSize); - } + _proc_dump_desc(m, (void*)ring->RxDescArray, ring->RxDescAllocSize); #ifdef ENABLE_LIB_SUPPORT if (rtl8125_num_lib_rx_rings(tp) > 0) { + int i; + for (i = 0; i < tp->HwSuppNumRxQueues; i++) { struct rtl8125_ring *lib_ring = &tp->lib_rx_ring[i]; - if (lib_ring->enabled) { + if(lib_ring->enabled) { seq_printf(m, "\ndump lib rx %d desc:%d\n", i, lib_ring->ring_size); _proc_dump_desc(m, (void*)lib_ring->desc_addr, @@ -1737,26 +1459,24 @@ static int proc_dump_tx_desc(struct seq_file *m, void *v) { struct net_device *dev = m->private; struct rtl8125_private *tp = netdev_priv(dev); - int i; - - rtnl_lock(); + struct rtl8125_tx_ring *ring = &tp->tx_ring[0]; - for (i = 0; i < tp->num_tx_rings; i++) { - struct rtl8125_tx_ring *ring = &tp->tx_ring[i]; + if (!ring) + return -EOPNOTSUPP; - if (!ring) - continue; + rtnl_lock(); - seq_printf(m, "\ndump tx %d desc:%d\n", i, ring->num_tx_desc); + seq_printf(m, "\ndump tx desc:%d\n", ring->num_tx_desc); - _proc_dump_desc(m, (void*)ring->TxDescArray, ring->TxDescAllocSize); - } + _proc_dump_desc(m, (void*)ring->TxDescArray, ring->TxDescAllocSize); #ifdef ENABLE_LIB_SUPPORT if (rtl8125_num_lib_tx_rings(tp) > 0) { + int i; + for (i = 0; i < tp->HwSuppNumTxQueues; i++) { struct rtl8125_ring *lib_ring = &tp->lib_tx_ring[i]; - if (lib_ring->enabled) { + if(lib_ring->enabled) { seq_printf(m, "\ndump lib tx %d desc:%d\n", i, lib_ring->ring_size); _proc_dump_desc(m, (void*)lib_ring->desc_addr, @@ -1774,36 +1494,32 @@ static int proc_dump_tx_desc(struct seq_file *m, void *v) static int proc_dump_msix_tbl(struct seq_file *m, void *v) { - int i, j; - void __iomem *ioaddr; + int i; struct net_device *dev = m->private; struct rtl8125_private *tp = netdev_priv(dev); - /* ioremap MMIO region */ - ioaddr = ioremap(pci_resource_start(tp->pci_dev, 4), pci_resource_len(tp->pci_dev, 4)); - if (!ioaddr) - return -EFAULT; - rtnl_lock(); - seq_printf(m, "\ndump MSI-X Table. Total Entry %d. \n", tp->hw_supp_irq_nvecs); + seq_printf(m, "\ndump MSI-X Table. Total Entry %d. \n", tp->max_irq_nvecs); - for (i=0; ihw_supp_irq_nvecs; i++) { + for (i=0; imax_irq_nvecs; i++) { seq_printf(m, "\n%04x ", i); - for (j=0; j<4; j++) - seq_printf(m, "%08x ", - readl(ioaddr + i*0x10 + 4*j)); + seq_printf(m, "%08x ", rtl8125_eri_read(tp, i*0x10, 4, + ERIAR_MSIX)); + seq_printf(m, "%08x ", rtl8125_eri_read(tp, i*0x10 + 4, 4, + ERIAR_MSIX)); + seq_printf(m, "%08x ", rtl8125_eri_read(tp, i*0x10 + 8, 4, + ERIAR_MSIX)); + seq_printf(m, "%08x ", rtl8125_eri_read(tp, i*0x10 + 12, 4, + ERIAR_MSIX)); } rtnl_unlock(); - iounmap(ioaddr); - seq_putc(m, '\n'); return 0; } - -#else //LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) +#else static int proc_get_driver_variable(char *page, char **start, off_t offset, int count, @@ -1843,11 +1559,6 @@ static int proc_get_driver_variable(char *page, char **start, "cur_tx1\t0x%x\n" "dirty_tx1\t0x%x\n" "rx_buf_sz\t0x%x\n" -#ifdef ENABLE_PAGE_REUSE - "rx_buf_page_order\t0x%x\n" - "rx_buf_page_size\t0x%x\n" - "page_reuse_fail_cnt\t0x%x\n" -#endif //ENABLE_PAGE_REUSE "esd_flag\t0x%x\n" "pci_cfg_is_read\t0x%x\n" "rtl8125_rx_config\t0x%x\n" @@ -1861,16 +1572,17 @@ static int proc_get_driver_variable(char *page, char **start, "autoneg\t0x%x\n" "duplex\t0x%x\n" "speed\t%d\n" - "advertising\t0x%llx\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_interrupt\t0x%x\n" + "use_timer_interrrupt\t0x%x\n" "HwIcVerUnknown\t0x%x\n" "NotWrRamCodeToMicroP\t0x%x\n" "NotWrMcuPatchCode\t0x%x\n" @@ -1880,6 +1592,7 @@ static int proc_get_driver_variable(char *page, char **start, "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" @@ -1890,7 +1603,6 @@ static int proc_get_driver_variable(char *page, char **start, "HwSwitchMdiToFiber\t0x%x\n" "NicCustLedValue\t0x%x\n" "RequiredSecLanDonglePatch\t0x%x\n" - "RequiredPfmPatch\t0x%x\n" "HwSuppDashVer\t0x%x\n" "DASH\t0x%x\n" "dash_printer_enabled\t0x%x\n" @@ -1898,6 +1610,7 @@ static int proc_get_driver_variable(char *page, char **start, "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" @@ -1905,7 +1618,6 @@ static int proc_get_driver_variable(char *page, char **start, "hwoptimize\t0x%lx\n" "proc_init_num\t0x%x\n" "s0_magic_packet\t0x%x\n" - "disable_wol_support\t0x%x\n" "enable_double_vlan\t0x%x\n" "HwSuppMagicPktVer\t0x%x\n" "HwSuppLinkChgWakeUpVer\t0x%x\n" @@ -1917,26 +1629,19 @@ static int proc_get_driver_variable(char *page, char **start, "EnableTxNoClose\t0x%x\n" "NextHwDesCloPtr0\t0x%x\n" "BeginHwDesCloPtr0\t0x%x\n" - "hw_clo_ptr_reg0\t0x%x\n" - "sw_tail_ptr_reg0\t0x%x\n" "NextHwDesCloPtr1\t0x%x\n" "BeginHwDesCloPtr1\t0x%x\n" - "hw_clo_ptr_reg1\t0x%x\n" - "sw_tail_ptr_reg1\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" - "HwSuppNumRxQueues\t0x%x\n" - "HwSuppNumTxQueues\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" - "hw_supp_irq_nvecs\t0x%x\n" "ring_lib_enabled\t0x%x\n" "HwSuppIsrVer\t0x%x\n" "HwCurrIsrVer\t0x%x\n" @@ -1971,11 +1676,6 @@ static int proc_get_driver_variable(char *page, char **start, tp->tx_ring[1].cur_tx, tp->tx_ring[1].dirty_tx, tp->rx_buf_sz, -#ifdef ENABLE_PAGE_REUSE - tp->rx_buf_page_order, - tp->rx_buf_page_size, - tp->page_reuse_fail_cnt, -#endif //ENABLE_PAGE_REUSE tp->esd_flag, tp->pci_cfg_is_read, tp->rtl8125_rx_config, @@ -1992,13 +1692,14 @@ static int proc_get_driver_variable(char *page, char **start, 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_interrupt, + tp->use_timer_interrrupt, tp->HwIcVerUnknown, tp->NotWrRamCodeToMicroP, tp->NotWrMcuPatchCode, @@ -2008,6 +1709,7 @@ static int proc_get_driver_variable(char *page, char **start, tp->rtk_enable_diag, tp->ShortPacketSwChecksum, tp->UseSwPaddingShortPkt, + tp->RequireRduNonStopPatch, tp->RequireAdcBiasPatch, tp->AdcBiasPatchIoffset, tp->RequireAdjustUpsTxLinkPulseTiming, @@ -2018,7 +1720,6 @@ static int proc_get_driver_variable(char *page, char **start, tp->HwSwitchMdiToFiber, tp->NicCustLedValue, tp->RequiredSecLanDonglePatch, - tp->RequiredPfmPatch, tp->HwSuppDashVer, tp->DASH, tp->dash_printer_enabled, @@ -2026,6 +1727,7 @@ static int proc_get_driver_variable(char *page, char **start, speed_mode, duplex_mode, autoneg_mode, + advertising_mode, aspm, s5wol, s5_keep_curr_mac, @@ -2033,7 +1735,6 @@ static int proc_get_driver_variable(char *page, char **start, hwoptimize, proc_init_num, s0_magic_packet, - disable_wol_support, enable_double_vlan, tp->HwSuppMagicPktVer, tp->HwSuppLinkChgWakeUpVer, @@ -2045,26 +1746,19 @@ static int proc_get_driver_variable(char *page, char **start, tp->EnableTxNoClose, tp->tx_ring[0].NextHwDesCloPtr, tp->tx_ring[0].BeginHwDesCloPtr, - rtl8125_get_hw_clo_ptr(&tp->tx_ring[0]), - rtl8125_get_sw_tail_ptr(&tp->tx_ring[0]), tp->tx_ring[1].NextHwDesCloPtr, tp->tx_ring[1].BeginHwDesCloPtr, - rtl8125_get_hw_clo_ptr(&tp->tx_ring[1]), - rtl8125_get_sw_tail_ptr(&tp->tx_ring[1]), tp->InitRxDescType, tp->RxDescLength, tp->num_rx_rings, tp->num_tx_rings, - rtl8125_tot_rx_rings(tp), - rtl8125_tot_tx_rings(tp), - tp->HwSuppNumRxQueues, - tp->HwSuppNumTxQueues, + tp->tot_rx_rings, + tp->tot_tx_rings, tp->EnableRss, tp->EnablePtp, tp->ptp_master_mode, tp->min_irq_nvecs, tp->irq_nvecs, - tp->hw_supp_irq_nvecs, tp->ring_lib_enabled, tp->HwSuppIsrVer, tp->HwCurrIsrVer, @@ -2077,7 +1771,8 @@ static int proc_get_driver_variable(char *page, char **start, #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13) dev->perm_addr, #endif - dev->dev_addr); + dev->dev_addr + ); rtnl_unlock(); @@ -2128,33 +1823,33 @@ static int proc_get_tally_counter(char *page, char **start, "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" + "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), @@ -2195,7 +1890,8 @@ static int proc_get_tally_counter(char *page, char **start, le32_to_cpu(counters->rx_mac_missed), le32_to_cpu(counters->rx_tcam_dropped), le32_to_cpu(counters->tdu), - le32_to_cpu(counters->rdu)); + le32_to_cpu(counters->rdu), + ); len += snprintf(page + len, count - len, "\n"); out_unlock: @@ -2224,49 +1920,7 @@ static int proc_get_registers(char *page, char **start, for (n = 0; n < max;) { len += snprintf(page + len, count - len, - "\n0x%04x:\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); - } - } - - max = 0xB00; - for (n = 0xA00; n < max;) { - len += snprintf(page + len, count - len, - "\n0x%04x:\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); - } - } - - max = 0xD40; - for (n = 0xD00; n < max;) { - len += snprintf(page + len, count - len, - "\n0x%04x:\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); - } - } - - max = 0x2840; - for (n = 0x2800; n < max;) { - len += snprintf(page + len, count - len, - "\n0x%04x:\t", + "\n0x%02x:\t", n); for (i = 0; i < 16 && n < max; i++, n++) { @@ -2285,50 +1939,6 @@ static int proc_get_registers(char *page, char **start, return len; } -static int proc_get_all_registers(char *page, char **start, - off_t offset, int count, - int *eof, void *data) -{ - struct net_device *dev = data; - int i, n, max; - u8 byte_rd; - struct rtl8125_private *tp = netdev_priv(dev); - void __iomem *ioaddr = tp->mmio_addr; - struct pci_dev *pdev = tp->pci_dev; - int len = 0; - - len += snprintf(page + len, count - len, - "\nDump All MAC Registers\n" - "Offset\tValue\n------\t-----\n"); - - rtnl_lock(); - - max = pci_resource_len(pdev, 2); - max = min(max, 0x8000); - - for (n = 0; n < max;) { - len += snprintf(page + len, count - len, - "\n0x%04x:\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, "\nTotal length:0x%X", max); - - 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) @@ -2398,70 +2008,6 @@ static int proc_get_eth_phy(char *page, char **start, } } - len += snprintf(page + len, count - len, - "\n####################extra reg##################\n"); - n = 0xA400; - len += snprintf(page + len, count - len, - "\n0x%02x:\t", - n); - for (i = 0; i < 8; i++, n+=2) { - word_rd = rtl8125_mdio_direct_read_phy_ocp(tp, n); - len += snprintf(page + len, count - len, - "%04x ", - word_rd); - } - - n = 0xA410; - len += snprintf(page + len, count - len, - "\n0x%02x:\t", - n); - for (i = 0; i < 3; i++, n+=2) { - word_rd = rtl8125_mdio_direct_read_phy_ocp(tp, n); - len += snprintf(page + len, count - len, - "%04x ", - word_rd); - } - - n = 0xA434; - len += snprintf(page + len, count - len, - "\n0x%02x:\t", - n); - word_rd = rtl8125_mdio_direct_read_phy_ocp(tp, n); - len += snprintf(page + len, count - len, - "%04x ", - word_rd); - - n = 0xA5D0; - len += snprintf(page + len, count - len, - "\n0x%02x:\t", - n); - for (i = 0; i < 4; i++, n+=2) { - word_rd = rtl8125_mdio_direct_read_phy_ocp(tp, n); - len += snprintf(page + len, count - len, - "%04x ", - word_rd); - } - - n = 0xA61A; - len += snprintf(page + len, count - len, - "\n0x%02x:\t", - n); - word_rd = rtl8125_mdio_direct_read_phy_ocp(tp, n); - len += snprintf(page + len, count - len, - "%04x ", - word_rd); - - n = 0xA6D0; - len += snprintf(page + len, count - len, - "\n0x%02x:\t", - n); - for (i = 0; i < 3; i++, n+=2) { - word_rd = rtl8125_mdio_direct_read_phy_ocp(tp, n); - len += snprintf(page + len, count - len, - "%04x ", - word_rd); - } - rtnl_unlock(); len += snprintf(page + len, count - len, "\n"); @@ -2570,24 +2116,18 @@ static int proc_get_temperature(char *page, char **start, case CFG_METHOD_4: case CFG_METHOD_5: case CFG_METHOD_7: - case CFG_METHOD_10: - case CFG_METHOD_11: len += snprintf(page + len, count - len, "\nChip Temperature\n"); break; default: - return -EOPNOTSUPP; - } - - rtnl_lock(); - - if (!rtl8125_sysfs_testmode_on(tp)) { len += snprintf(page + len, count - len, - "\nPlease turn on ""/sys/class/net//rtk_adv/testmode"".\n\n"); - goto out_unlock; + "\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) { @@ -2613,24 +2153,20 @@ static int proc_get_temperature(char *page, char **start, len += snprintf(page + len, count - len, "\n"); -out_unlock: - rtnl_unlock(); - *eof = 1; return len; } -static int _proc_get_cable_info(char *page, char **start, - off_t offset, int count, - int *eof, void *data, - bool poe_mode) +static int proc_get_cable_info(char *page, char **start, + off_t offset, int count, + int *eof, void *data) { int i; u16 status; int len = 0; struct net_device *dev = data; int cp_status[RTL8125_CP_NUM] = {0}; - int cp_len[RTL8125_CP_NUM] = {0}; + u16 cp_len[RTL8125_CP_NUM] = {0}; struct rtl8125_private *tp = netdev_priv(dev); const char *pair_str[RTL8125_CP_NUM] = {"1-2", "3-6", "4-5", "7-8"}; @@ -2644,12 +2180,6 @@ static int _proc_get_cable_info(char *page, char **start, rtnl_lock(); - if (!rtl8125_sysfs_testmode_on(tp)) { - len += snprintf(page + len, count - len, - "\nPlease turn on ""/sys/class/net//rtk_adv/testmode"".\n\n"); - goto out_unlock; - } - status = RTL_R16(tp, PHYstatus); if (status & LinkStatus) len += snprintf(page + len, count - len, @@ -2661,22 +2191,24 @@ static int _proc_get_cable_info(char *page, char **start, rtl8125_get_cp_len(tp, cp_len); - rtl8125_get_cp_status(tp, cp_status, poe_mode); + if (tp->link_ok(dev)) { + for (i=0; irx_ring[0]; - rtnl_lock(); - - for (i = 0; i < tp->num_rx_rings; i++) { - struct rtl8125_rx_ring *ring = &tp->rx_ring[i]; + if (!ring) + return -EOPNOTSUPP; - if (!ring) - continue; + rtnl_lock(); - len += snprintf(page + len, count - len, - "\ndump rx %d desc:%d", - i, ring->num_rx_desc); + len += snprintf(page + len, count - len, + "\ndump rx desc:%d", + ring->num_rx_desc); - _proc_dump_desc(page, &len, &count, - ring->RxDescArray, - ring->RxDescAllocSize); - } + _proc_dump_desc(page, &len, &count, + ring->RxDescArray, + ring->RxDescAllocSize); #ifdef ENABLE_LIB_SUPPORT if (rtl8125_num_lib_rx_rings(tp) > 0) { + int i; + for (i = 0; i < tp->HwSuppNumRxQueues; i++) { struct rtl8125_ring *lib_ring = &tp->lib_rx_ring[i]; - if (lib_ring->enabled) { + if(lib_ring->enabled) { len += snprintf(page + len, count - len, "\ndump lib rx %d desc:%d", i, @@ -2794,30 +2309,28 @@ static int proc_dump_tx_desc(char *page, char **start, int len = 0; struct net_device *dev = data; struct rtl8125_private *tp = netdev_priv(dev); - int i; - - rtnl_lock(); + struct rtl8125_tx_ring *ring = &tp->tx_ring[0]; - for (i = 0; i < tp->num_tx_rings; i++) { - struct rtl8125_tx_ring *ring = &tp->tx_ring[i]; + if (!ring) + return -EOPNOTSUPP; - if (!ring) - continue; + rtnl_lock(); - len += snprintf(page + len, count - len, - "\ndump tx desc:%d", - ring->num_tx_desc); + len += snprintf(page + len, count - len, + "\ndump tx desc:%d", + ring->num_tx_desc); - _proc_dump_desc(page, &len, &count, - ring->TxDescArray, - ring->TxDescAllocSize); - } + _proc_dump_desc(page, &len, &count, + ring->TxDescArray, + ring->TxDescAllocSize); #ifdef ENABLE_LIB_SUPPORT if (rtl8125_num_lib_tx_rings(tp) > 0) { + int i; + for (i = 0; i < tp->HwSuppNumTxQueues; i++) { struct rtl8125_ring *lib_ring = &tp->lib_tx_ring[i]; - if (lib_ring->enabled) { + if(lib_ring->enabled) { len += snprintf(page + len, count - len, "\ndump lib tx %d desc:%d", i, @@ -2843,29 +2356,33 @@ static int proc_dump_msix_tbl(char *page, char **start, off_t offset, int count, int *eof, void *data) { - int i, j; + int i; int len = 0; - void __iomem *ioaddr; struct net_device *dev = data; struct rtl8125_private *tp = netdev_priv(dev); - /* ioremap MMIO region */ - ioaddr = ioremap(pci_resource_start(tp->pci_dev, 4), pci_resource_len(tp->pci_dev, 4)); - if (!ioaddr) - return -EFAULT; - rtnl_lock(); len += snprintf(page + len, count - len, "\ndump MSI-X Table. Total Entry %d. \n", - tp->hw_supp_irq_nvecs); + tp->max_irq_nvecs); - for (i=0; ihw_supp_irq_nvecs; i++) { + for (i=0; imax_irq_nvecs; i++) { + seq_printf(m, "\n%04x ", i); len += snprintf(page + len, count - len, "\n%04x ", i); - for (j=0; j<4; j++) - len += snprintf(page + len, count - len, "%08x ", - readl(ioaddr + i*0x10 + 4*j)); + len += snprintf(page + len, count - len, + "%08x ", rtl8125_eri_read(tp, i*0x10, 4, + ERIAR_MSIX)); + len += snprintf(page + len, count - len, + "%08x ", rtl8125_eri_read(tp, i*0x10 + 4, 4, + ERIAR_MSIX)); + len += snprintf(page + len, count - len, + "%08x ", rtl8125_eri_read(tp, i*0x10 + 8, 4, + ERIAR_MSIX)); + len += snprintf(page + len, count - len, + "%08x ", rtl8125_eri_read(tp, i*0x10 + 12, 4, + ERIAR_MSIX)); } rtnl_unlock(); @@ -2875,7 +2392,6 @@ static int proc_dump_msix_tbl(char *page, char **start, *eof = 1; return 0; } - #endif //LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) static void rtl8125_proc_module_init(void) @@ -2940,7 +2456,6 @@ static const struct rtl8125_proc_file rtl8125_debug_proc_files[] = { { "driver_var", &proc_get_driver_variable }, { "tally", &proc_get_tally_counter }, { "registers", &proc_get_registers }, - { "registers2", &proc_get_all_registers }, { "pcie_phy", &proc_get_pcie_phy }, { "eth_phy", &proc_get_eth_phy }, { "ext_regs", &proc_get_extended_registers }, @@ -2954,7 +2469,6 @@ static const struct rtl8125_proc_file rtl8125_debug_proc_files[] = { static const struct rtl8125_proc_file rtl8125_test_proc_files[] = { { "temp", &proc_get_temperature }, { "cdt", &proc_get_cable_info }, - { "cdt_poe", &proc_get_poe_cable_info }, { "", NULL } }; @@ -2974,14 +2488,14 @@ static void rtl8125_proc_init(struct net_device *dev) return; #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++; + 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++; /* create debug entry */ dir = proc_mkdir_data(R8125_PROC_DEBUG_DIR, 0, tp->proc_dir, dev); @@ -3013,25 +2527,25 @@ static void rtl8125_proc_init(struct net_device *dev) tp->proc_dir_test = dir; for (f = rtl8125_test_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 " + 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/%s\n", MODULENAME, dev->name, R8125_PROC_TEST_DIR, f->name); - return; + return; + } } - } #else - dir = proc_mkdir(dev->name, rtl8125_proc); - if (!dir) { - printk("Unable to initialize /proc/net/%s/%s\n", - MODULENAME, dev->name); - return; - } + 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++; + tp->proc_dir = dir; + proc_init_num++; /* create debug entry */ dir = proc_mkdir(R8125_PROC_DEBUG_DIR, tp->proc_dir); @@ -3043,9 +2557,9 @@ static void rtl8125_proc_init(struct net_device *dev) tp->proc_dir_debug = dir; for (f = rtl8125_debug_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 " + if (!create_proc_read_entry(f->name, S_IFREG | S_IRUGO, + dir, f->show, dev)) { + printk("Unable to initialize " "/proc/net/%s/%s/%s/%s\n", MODULENAME, dev->name, R8125_PROC_DEBUG_DIR, f->name); @@ -3069,9 +2583,9 @@ static void rtl8125_proc_init(struct net_device *dev) "/proc/net/%s/%s/%s/%s\n", MODULENAME, dev->name, R8125_PROC_TEST_DIR, f->name); - return; + return; + } } - } #endif } @@ -3110,91 +2624,15 @@ static void rtl8125_proc_remove(struct net_device *dev) #endif //ENABLE_R8125_PROCFS -#ifdef ENABLE_R8125_SYSFS -/**************************************************************************** -* -----------------------------SYSFS STUFF------------------------- -***************************************************************************** -*/ -static ssize_t testmode_show(struct device *dev, - struct device_attribute *attr, char *buf) -{ - struct net_device *netdev = to_net_dev(dev); - struct rtl8125_private *tp = netdev_priv(netdev); - - sprintf(buf, "%u\n", tp->testmode); - - return strlen(buf); -} - -static ssize_t testmode_store(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t count) -{ - struct net_device *netdev = to_net_dev(dev); - struct rtl8125_private *tp = netdev_priv(netdev); - u32 testmode; - - if (sscanf(buf, "%u\n", &testmode) != 1) - return -EINVAL; - - if (tp->testmode != testmode) { - rtnl_lock(); - tp->testmode = testmode; - rtnl_unlock(); - } - - return count; -} - -static DEVICE_ATTR_RW(testmode); - -static struct attribute *rtk_adv_attrs[] = { - &dev_attr_testmode.attr, - NULL -}; - -static struct attribute_group rtk_adv_grp = { - .name = "rtl_adv", - .attrs = rtk_adv_attrs, -}; - -static void rtl8125_sysfs_init(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - int ret; - - /* init rtl_adv */ -#ifdef ENABLE_LIB_SUPPORT - tp->testmode = 0; -#else - tp->testmode = 1; -#endif //ENABLE_LIB_SUPPORT - - ret = sysfs_create_group(&dev->dev.kobj, &rtk_adv_grp); - if (ret < 0) - netif_warn(tp, probe, dev, "create rtk_adv_grp fail\n"); - else - set_bit(R8125_SYSFS_RTL_ADV, tp->sysfs_flag); -} - -static void rtl8125_sysfs_remove(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - if (test_and_clear_bit(R8125_SYSFS_RTL_ADV, tp->sysfs_flag)) - sysfs_remove_group(&dev->dev.kobj, &rtk_adv_grp); -} -#endif //ENABLE_R8125_SYSFS - 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); + if ( PageNum == 0 ) { + OcpPageNum = OCP_STD_PHY_BASE_PAGE + ( RegNum / 8 ); + OcpRegNum = 0x10 + ( RegNum % 8 ); } else { OcpPageNum = PageNum; OcpRegNum = RegNum; @@ -3202,7 +2640,7 @@ static inline u16 map_phy_ocp_addr(u16 PageNum, u8 RegNum) OcpPageNum <<= 4; - if (OcpRegNum < 16) { + if ( OcpRegNum < 16 ) { OcpPhyAddress = 0; } else { OcpRegNum -= 16; @@ -3238,12 +2676,11 @@ static void mdio_real_direct_write_phy_ocp(struct rtl8125_private *tp, } } -static void rtl8125_mdio_direct_write_phy_ocp(struct rtl8125_private *tp, - u16 RegAddr, - u16 value) +static void mdio_direct_write_phy_ocp(struct rtl8125_private *tp, + u16 RegAddr, + u16 value) { - if (tp->rtk_enable_diag) - return; + if (tp->rtk_enable_diag) return; mdio_real_direct_write_phy_ocp(tp, RegAddr, value); } @@ -3258,7 +2695,7 @@ static void rtl8125_mdio_write_phy_ocp(struct rtl8125_private *tp, ocp_addr = map_phy_ocp_addr(PageNum, RegAddr); - rtl8125_mdio_direct_write_phy_ocp(tp, ocp_addr, value); + mdio_direct_write_phy_ocp(tp, ocp_addr, value); } */ @@ -3289,8 +2726,7 @@ void rtl8125_mdio_write(struct rtl8125_private *tp, u16 RegAddr, u16 value) { - if (tp->rtk_enable_diag) - return; + if (tp->rtk_enable_diag) return; mdio_real_write(tp, RegAddr, value); } @@ -3333,11 +2769,10 @@ static u32 mdio_real_direct_read_phy_ocp(struct rtl8125_private *tp, return value; } -static u32 rtl8125_mdio_direct_read_phy_ocp(struct rtl8125_private *tp, - u16 RegAddr) +static u32 mdio_direct_read_phy_ocp(struct rtl8125_private *tp, + u16 RegAddr) { - if (tp->rtk_enable_diag) - return 0xffffffff; + if (tp->rtk_enable_diag) return 0xffffffff; return mdio_real_direct_read_phy_ocp(tp, RegAddr); } @@ -3351,7 +2786,7 @@ static u32 rtl8125_mdio_read_phy_ocp(struct rtl8125_private *tp, ocp_addr = map_phy_ocp_addr(PageNum, RegAddr); - return rtl8125_mdio_direct_read_phy_ocp(tp, ocp_addr); + return mdio_direct_read_phy_ocp(tp, ocp_addr); } */ @@ -3375,8 +2810,7 @@ static u32 mdio_real_read(struct rtl8125_private *tp, u32 rtl8125_mdio_read(struct rtl8125_private *tp, u16 RegAddr) { - if (tp->rtk_enable_diag) - return 0xffffffff; + if (tp->rtk_enable_diag) return 0xffffffff; return mdio_real_read(tp, RegAddr); } @@ -3393,7 +2827,7 @@ u32 rtl8125_mdio_prot_direct_read_phy_ocp(struct rtl8125_private *tp, return mdio_real_direct_read_phy_ocp(tp, RegAddr); } -static void rtl8125_clear_and_set_eth_phy_bit(struct rtl8125_private *tp, u8 addr, u16 clearmask, u16 setmask) +static void ClearAndSetEthPhyBit(struct rtl8125_private *tp, u8 addr, u16 clearmask, u16 setmask) { u16 PhyRegValue; @@ -3405,44 +2839,48 @@ static void rtl8125_clear_and_set_eth_phy_bit(struct rtl8125_private *tp, u8 ad void rtl8125_clear_eth_phy_bit(struct rtl8125_private *tp, u8 addr, u16 mask) { - rtl8125_clear_and_set_eth_phy_bit(tp, - addr, - mask, - 0); + ClearAndSetEthPhyBit(tp, + addr, + mask, + 0 + ); } void rtl8125_set_eth_phy_bit(struct rtl8125_private *tp, u8 addr, u16 mask) { - rtl8125_clear_and_set_eth_phy_bit(tp, - addr, - 0, - mask); + ClearAndSetEthPhyBit(tp, + addr, + 0, + mask + ); } -static void rtl8125_clear_and_set_eth_phy_ocp_bit(struct rtl8125_private *tp, u16 addr, u16 clearmask, u16 setmask) +static void ClearAndSetEthPhyOcpBit(struct rtl8125_private *tp, u16 addr, u16 clearmask, u16 setmask) { u16 PhyRegValue; - PhyRegValue = rtl8125_mdio_direct_read_phy_ocp(tp, addr); + PhyRegValue = mdio_direct_read_phy_ocp(tp, addr); PhyRegValue &= ~clearmask; PhyRegValue |= setmask; - rtl8125_mdio_direct_write_phy_ocp(tp, addr, PhyRegValue); + mdio_direct_write_phy_ocp(tp, addr, PhyRegValue); } -static void rtl8125_clear_eth_phy_ocp_bit(struct rtl8125_private *tp, u16 addr, u16 mask) +void ClearEthPhyOcpBit(struct rtl8125_private *tp, u16 addr, u16 mask) { - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - addr, - mask, - 0); + ClearAndSetEthPhyOcpBit(tp, + addr, + mask, + 0 + ); } -static void rtl8125_set_eth_phy_ocp_bit(struct rtl8125_private *tp, u16 addr, u16 mask) +void SetEthPhyOcpBit(struct rtl8125_private *tp, u16 addr, u16 mask) { - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - addr, - 0, - mask); + ClearAndSetEthPhyOcpBit(tp, + addr, + 0, + mask + ); } void rtl8125_mac_ocp_write(struct rtl8125_private *tp, u16 reg_addr, u16 value) @@ -3461,7 +2899,7 @@ void rtl8125_mac_ocp_write(struct rtl8125_private *tp, u16 reg_addr, u16 value) RTL_W32(tp, MACOCP, data32); } -u16 rtl8125_mac_ocp_read(struct rtl8125_private *tp, u16 reg_addr) +u32 rtl8125_mac_ocp_read(struct rtl8125_private *tp, u16 reg_addr) { u32 data32; u16 data16 = 0; @@ -3497,7 +2935,7 @@ static u32 mac_mcu_read(struct rtl8125_private *tp, u16 reg) #endif static void -rtl8125_clear_set_mac_ocp_bit( +ClearAndSetMcuAccessRegBit( struct rtl8125_private *tp, u16 addr, u16 clearmask, @@ -3513,29 +2951,31 @@ rtl8125_clear_set_mac_ocp_bit( } static void -rtl8125_clear_mac_ocp_bit( +ClearMcuAccessRegBit( struct rtl8125_private *tp, u16 addr, u16 mask ) { - rtl8125_clear_set_mac_ocp_bit(tp, - addr, - mask, - 0); + ClearAndSetMcuAccessRegBit(tp, + addr, + mask, + 0 + ); } static void -rtl8125_set_mac_ocp_bit( +SetMcuAccessRegBit( struct rtl8125_private *tp, u16 addr, u16 mask ) { - rtl8125_clear_set_mac_ocp_bit(tp, - addr, - 0, - 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) @@ -3547,12 +2987,9 @@ u32 rtl8125_ocp_read(struct rtl8125_private *tp, u16 addr, u8 len) { u32 value = 0; - if (!tp->AllowAccessDashOcp) - return 0xffffffff; - - if (tp->HwSuppOcpChannelVer == 2) + if (HW_DASH_SUPPORT_TYPE_2(tp)) value = rtl8125_ocp_read_with_oob_base_address(tp, addr, len, NO_BASE_ADDRESS); - else if (tp->HwSuppOcpChannelVer == 3) + else if (HW_DASH_SUPPORT_TYPE_3(tp)) value = rtl8125_ocp_read_with_oob_base_address(tp, addr, len, RTL8168FP_OOBMAC_BASE); return value; @@ -3565,12 +3002,9 @@ u32 rtl8125_ocp_write_with_oob_base_address(struct rtl8125_private *tp, u16 addr void rtl8125_ocp_write(struct rtl8125_private *tp, u16 addr, u8 len, u32 value) { - if (!tp->AllowAccessDashOcp) - return; - - if (tp->HwSuppOcpChannelVer == 2) + if (HW_DASH_SUPPORT_TYPE_2(tp)) rtl8125_ocp_write_with_oob_base_address(tp, addr, len, value, NO_BASE_ADDRESS); - else if (tp->HwSuppOcpChannelVer == 3) + else if (HW_DASH_SUPPORT_TYPE_3(tp)) rtl8125_ocp_write_with_oob_base_address(tp, addr, len, value, RTL8168FP_OOBMAC_BASE); } @@ -3582,21 +3016,20 @@ void rtl8125_oob_mutex_lock(struct rtl8125_private *tp) u16 ocp_reg_mutex_oob; u16 ocp_reg_mutex_prio; - if (!tp->DASH) - return; + 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_8: - case CFG_METHOD_9: + case CFG_METHOD_7: + default: ocp_reg_mutex_oob = 0x110; ocp_reg_mutex_ib = 0x114; ocp_reg_mutex_prio = 0x11C; break; - default: - return; } rtl8125_ocp_write(tp, ocp_reg_mutex_ib, 1, BIT_0); @@ -3634,21 +3067,20 @@ void rtl8125_oob_mutex_unlock(struct rtl8125_private *tp) u16 ocp_reg_mutex_oob; u16 ocp_reg_mutex_prio; - if (!tp->DASH) - return; + 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_8: - case CFG_METHOD_9: + case CFG_METHOD_7: + default: ocp_reg_mutex_oob = 0x110; ocp_reg_mutex_ib = 0x114; ocp_reg_mutex_prio = 0x11C; break; - default: - return; } rtl8125_ocp_write(tp, ocp_reg_mutex_prio, 1, BIT_0); @@ -3662,227 +3094,127 @@ void rtl8125_oob_notify(struct rtl8125_private *tp, u8 cmd) rtl8125_ocp_write(tp, 0x30, 1, 0x01); } -static bool rtl8125_is_allow_access_dash_ocp(struct rtl8125_private *tp) +static int rtl8125_check_dash(struct rtl8125_private *tp) { - bool allow_access = false; - u16 mac_ocp_data; - - if (!HW_DASH_SUPPORT_DASH(tp)) - goto exit; - - allow_access = true; - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - mac_ocp_data = rtl8125_mac_ocp_read(tp, 0xd460); - if (mac_ocp_data == 0xffff || !(mac_ocp_data & BIT_0)) - allow_access = false; - break; - case CFG_METHOD_8: - case CFG_METHOD_9: - mac_ocp_data = rtl8125_mac_ocp_read(tp, 0xd4c0); - if (mac_ocp_data == 0xffff || (mac_ocp_data & BIT_3)) - allow_access = false; - break; - default: - goto exit; + if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) { + if (rtl8125_ocp_read(tp, 0x128, 1) & BIT_0) + return 1; } -exit: - return allow_access; + + return 0; } -static u32 rtl8125_get_dash_fw_ver(struct rtl8125_private *tp) +void rtl8125_dash2_disable_tx(struct rtl8125_private *tp) { - u32 ver = 0xffffffff; + if (!tp->DASH) return; - if (FALSE == HW_DASH_SUPPORT_GET_FIRMWARE_VERSION(tp)) - goto exit; + if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) { + u16 WaitCnt; + u8 TmpUchar; - ver = rtl8125_ocp_read(tp, OCP_REG_FIRMWARE_MAJOR_VERSION, 4); + //Disable oob Tx + RTL_CMAC_W8(tp, CMAC_IBCR2, RTL_CMAC_R8(tp, CMAC_IBCR2) & ~( BIT_0 )); + WaitCnt = 0; -exit: - return ver; -} + //wait oob tx disable + do { + TmpUchar = RTL_CMAC_R8(tp, CMAC_IBISR0); -static int _rtl8125_check_dash(struct rtl8125_private *tp) -{ - if (!tp->AllowAccessDashOcp) - return 0; + if ( TmpUchar & ISRIMR_DASH_TYPE2_TX_DISABLE_IDLE ) { + break; + } - if (rtl8125_ocp_read(tp, 0x128, 1) & BIT_0) - return 1; + udelay( 50 ); + WaitCnt++; + } while(WaitCnt < 2000); - return 0; -} - -static int rtl8125_check_dash(struct rtl8125_private *tp) -{ - if (HW_DASH_SUPPORT_DASH(tp) && _rtl8125_check_dash(tp)) { - u32 ver = rtl8125_get_dash_fw_ver(tp); - if (!(ver == 0 || ver == 0xffffffff)) - return 1; + //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); } - - return 0; -} - -void rtl8125_dash2_disable_tx(struct rtl8125_private *tp) -{ - u16 WaitCnt; - u8 TmpUchar; - - if (!HW_DASH_SUPPORT_CMAC(tp)) - return; - - if (!tp->DASH) - return; - - //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 (!HW_DASH_SUPPORT_CMAC(tp)) - return; - - if (!tp->DASH) - return; + if (!tp->DASH) return; - RTL_CMAC_W8(tp, CMAC_IBCR2, RTL_CMAC_R8(tp, CMAC_IBCR2) | BIT_0); + 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 (!HW_DASH_SUPPORT_CMAC(tp)) - return; - - if (!tp->DASH) - return; + if (!tp->DASH) return; - RTL_CMAC_W8(tp, CMAC_IBCR0, RTL_CMAC_R8(tp, CMAC_IBCR0) & ~(BIT_0)); + 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 (!HW_DASH_SUPPORT_CMAC(tp)) - return; - - if (!tp->DASH) - return; + if (!tp->DASH) return; - RTL_CMAC_W8(tp, CMAC_IBCR0, RTL_CMAC_R8(tp, CMAC_IBCR0) | BIT_0); + 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_CMAC(tp)) - return; - - rtl8125_dash2_disable_tx(tp); - rtl8125_dash2_disable_rx(tp); -} - -static int rtl8125_wait_dash_fw_ready(struct rtl8125_private *tp) -{ - int rc = -1; - int timeout; - - if (!tp->DASH) - goto out; - - for (timeout = 0; timeout < 10; timeout++) { - mdelay(10); - if (rtl8125_ocp_read(tp, 0x124, 1) & BIT_0) { - rc = 1; - goto out; - } + if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) { + rtl8125_dash2_disable_tx( tp ); + rtl8125_dash2_disable_rx( tp ); } - - rc = 0; - -out: - return rc; } -static void -rtl8125_notify_dash_oob_cmac(struct rtl8125_private *tp, u32 cmd) +static void rtl8125_driver_start(struct rtl8125_private *tp) { - u32 tmp_value; - - if (!HW_DASH_SUPPORT_CMAC(tp)) + if (!tp->DASH) return; - rtl8125_ocp_write(tp, 0x180, 4, cmd); - tmp_value = rtl8125_ocp_read(tp, 0x30, 4); - tmp_value |= BIT_0; - rtl8125_ocp_write(tp, 0x30, 4, tmp_value); -} - -static void -rtl8125_notify_dash_oob_ipc2(struct rtl8125_private *tp, u32 cmd) -{ - if (FALSE == HW_DASH_SUPPORT_TYPE_4(tp)) - return; + if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) { + int timeout; + u32 tmp_value; - rtl8125_ocp_write(tp, IB2SOC_DATA, 4, cmd); - rtl8125_ocp_write(tp, IB2SOC_CMD, 4, 0x00); - rtl8125_ocp_write(tp, IB2SOC_SET, 4, 0x01); -} + 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); -static void -rtl8125_notify_dash_oob(struct rtl8125_private *tp, u32 cmd) -{ - switch (tp->HwSuppDashVer) { - case 2: - case 3: - return rtl8125_notify_dash_oob_cmac(tp, cmd); - case 4: - return rtl8125_notify_dash_oob_ipc2(tp, cmd); - default: - return; + for (timeout = 0; timeout < 10; timeout++) { + mdelay(10); + if (rtl8125_ocp_read(tp, 0x124, 1) & BIT_0) + break; + } } } -static void rtl8125_driver_start(struct rtl8125_private *tp) -{ - if (!tp->AllowAccessDashOcp) - return; - - rtl8125_notify_dash_oob(tp, OOB_CMD_DRIVER_START); - - rtl8125_wait_dash_fw_ready(tp); -} - static void rtl8125_driver_stop(struct rtl8125_private *tp) { - struct net_device *dev = tp->dev; - - if (!tp->AllowAccessDashOcp) + if (!tp->DASH) return; - if (HW_DASH_SUPPORT_CMAC(tp)) + 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_notify_dash_oob(tp, OOB_CMD_DRIVER_STOP); + 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); - rtl8125_wait_dash_fw_ready(tp); + 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) @@ -3940,18 +3272,20 @@ static void ClearAndSetPCIePhyBit(struct rtl8125_private *tp, u8 addr, u16 clear static void ClearPCIePhyBit(struct rtl8125_private *tp, u8 addr, u16 mask) { - ClearAndSetPCIePhyBit(tp, - addr, - mask, - 0); + ClearAndSetPCIePhyBit( tp, + addr, + mask, + 0 + ); } -static void SetPCIePhyBit(struct rtl8125_private *tp, u8 addr, u16 mask) +static void SetPCIePhyBit( struct rtl8125_private *tp, u8 addr, u16 mask) { - ClearAndSetPCIePhyBit(tp, - addr, - 0, - mask); + ClearAndSetPCIePhyBit( tp, + addr, + 0, + mask + ); } static u32 @@ -4005,7 +3339,7 @@ rtl8125_csi_other_fun_write(struct rtl8125_private *tp, if (tp->mcfg == CFG_METHOD_DEFAULT) multi_fun_sel_bit = 0; - if (multi_fun_sel_bit > 7) + if ( multi_fun_sel_bit > 7 ) return; cmd |= multi_fun_sel_bit << 16; @@ -4092,7 +3426,7 @@ rtl8125_csi_fun0_write_byte(struct rtl8125_private *tp, 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); + rtl8125_csi_other_fun_write( tp, 0, RegAlignAddr, TmpUlong ); } udelay(R8125_CHANNEL_EXIT_DELAY_TIME); @@ -4240,10 +3574,6 @@ rtl8125_enable_rxdvgate(struct net_device *dev) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: RTL_W8(tp, 0xF2, RTL_R8(tp, 0xF2) | BIT_3); mdelay(2); break; @@ -4262,10 +3592,6 @@ rtl8125_disable_rxdvgate(struct net_device *dev) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: RTL_W8(tp, 0xF2, RTL_R8(tp, 0xF2) & ~BIT_3); mdelay(2); break; @@ -4338,8 +3664,7 @@ rtl8125_stop_all_request(struct net_device *dev) case CFG_METHOD_6: for (i = 0; i < 20; i++) { udelay(10); - if (!(RTL_R8(tp, ChipCmd) & StopReq)) - break; + if (!(RTL_R8(tp, ChipCmd) & StopReq)) break; } if (i == 20) @@ -4360,10 +3685,6 @@ rtl8125_wait_txrx_fifo_empty(struct net_device *dev) case CFG_METHOD_4: case CFG_METHOD_5: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: rtl8125_stop_all_request(dev); break; } @@ -4375,10 +3696,6 @@ rtl8125_wait_txrx_fifo_empty(struct net_device *dev) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: for (i = 0; i < 3000; i++) { udelay(50); if ((RTL_R8(tp, MCUCmd_reg) & (Txfifo_empty | Rxfifo_empty)) == (Txfifo_empty | Rxfifo_empty)) @@ -4391,10 +3708,6 @@ rtl8125_wait_txrx_fifo_empty(struct net_device *dev) case CFG_METHOD_4: case CFG_METHOD_5: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: 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)) @@ -4409,25 +3722,21 @@ rtl8125_wait_txrx_fifo_empty(struct net_device *dev) static inline void rtl8125_enable_dash2_interrupt(struct rtl8125_private *tp) { - if (!HW_DASH_SUPPORT_CMAC(tp)) - return; - - if (!tp->DASH) - return; + if (!tp->DASH) return; - 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)); + 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 (!HW_DASH_SUPPORT_CMAC(tp)) - return; + if (!tp->DASH) return; - if (!tp->DASH) - return; - - RTL_CMAC_W8(tp, CMAC_IBIMR0, 0); + if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) { + RTL_CMAC_W8(tp, CMAC_IBIMR0, 0); + } } #endif @@ -4435,14 +3744,7 @@ void rtl8125_enable_hw_linkchg_interrupt(struct rtl8125_private *tp) { switch (tp->HwCurrIsrVer) { - case 5: - RTL_W32(tp, IMR_V2_SET_REG_8125, ISRIMR_V5_LINKCHG); - break; - case 4: - RTL_W32(tp, IMR_V2_SET_REG_8125, ISRIMR_V4_LINKCHG); - break; case 2: - case 3: RTL_W32(tp, IMR_V2_SET_REG_8125, ISRIMR_V2_LINKCHG); break; case 1: @@ -4461,9 +3763,6 @@ rtl8125_enable_hw_interrupt(struct rtl8125_private *tp) { switch (tp->HwCurrIsrVer) { case 2: - case 3: - case 4: - case 5: RTL_W32(tp, IMR_V2_SET_REG_8125, tp->intr_mask); break; case 1: @@ -4492,10 +3791,8 @@ static inline void rtl8125_clear_hw_isr_v2(struct rtl8125_private *tp, static inline void rtl8125_disable_hw_interrupt(struct rtl8125_private *tp) { - if (tp->HwCurrIsrVer > 1) { + if (tp->HwCurrIsrVer == 2) { RTL_W32(tp, IMR_V2_CLEAR_REG_8125, 0xFFFFFFFF); - if (tp->HwCurrIsrVer > 3) - RTL_W32(tp, IMR_V4_L2_CLEAR_REG_8125, 0xFFFFFFFF); } else { RTL_W32(tp, tp->imr_reg[0], 0x0000); @@ -4523,7 +3820,7 @@ rtl8125_switch_to_hw_interrupt(struct rtl8125_private *tp) static inline void rtl8125_switch_to_timer_interrupt(struct rtl8125_private *tp) { - if (tp->use_timer_interrupt) { + 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); @@ -4542,10 +3839,8 @@ rtl8125_irq_mask_and_ack(struct rtl8125_private *tp) { rtl8125_disable_hw_interrupt(tp); - if (tp->HwCurrIsrVer > 1) { + if (tp->HwCurrIsrVer == 2) { RTL_W32(tp, ISR_V2_8125, 0xFFFFFFFF); - if (tp->HwCurrIsrVer > 3) - RTL_W32(tp, ISR_V4_L2_8125, 0xFFFFFFFF); } else { #ifdef ENABLE_DASH_SUPPORT if (tp->DASH) { @@ -4553,8 +3848,9 @@ rtl8125_irq_mask_and_ack(struct rtl8125_private *tp) 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_CMAC(tp)) + 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])); @@ -4604,9 +3900,6 @@ rtl8125_nic_reset(struct net_device *dev) if ((RTL_R8(tp, ChipCmd) & CmdReset) == 0) break; } - - /* reset rcr */ - RTL_W32(tp, RxConfig, (RX_DMA_BURST_512 << RxCfgDMAShift)); } static void @@ -4614,27 +3907,15 @@ rtl8125_hw_set_interrupt_type(struct rtl8125_private *tp, u8 isr_ver) { u8 tmp; - if (tp->HwSuppIsrVer < 2) - return; - - tmp = RTL_R8(tp, INT_CFG0_8125); - switch (tp->HwSuppIsrVer) { - case 4: - case 5: - tmp &= ~INT_CFG0_MSIX_ENTRY_NUM_MODE; - fallthrough; case 2: - case 3: + tmp = RTL_R8(tp, INT_CFG0_8125); tmp &= ~(INT_CFG0_ENABLE_8125); - if (isr_ver > 1) + if (isr_ver == 2) tmp |= INT_CFG0_ENABLE_8125; + RTL_W8(tp, INT_CFG0_8125, tmp); break; - default: - return; } - - RTL_W8(tp, INT_CFG0_8125, tmp); } static void @@ -4649,10 +3930,6 @@ rtl8125_hw_clear_timer_int(struct net_device *dev) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: RTL_W32(tp, TIMER_INT0_8125, 0x0000); RTL_W32(tp, TIMER_INT1_8125, 0x0000); RTL_W32(tp, TIMER_INT2_8125, 0x0000); @@ -4669,26 +3946,17 @@ rtl8125_hw_clear_int_miti(struct net_device *dev) switch (tp->HwSuppIntMitiVer) { case 3: - case 6: - case 7: //IntMITI_0-IntMITI_31 for (i=0xA00; i<0xB00; i+=4) RTL_W32(tp, i, 0x0000); break; case 4: - case 5: //IntMITI_0-IntMITI_15 for (i = 0xA00; i < 0xA80; i += 4) RTL_W32(tp, i, 0x0000); - if (tp->HwSuppIntMitiVer == 5) - RTL_W8(tp, INT_CFG0_8125, RTL_R8(tp, INT_CFG0_8125) & - ~(INT_CFG0_TIMEOUT0_BYPASS_8125 | - INT_CFG0_MITIGATION_BYPASS_8125 | - INT_CFG0_RDU_BYPASS_8126)); - else - RTL_W8(tp, INT_CFG0_8125, RTL_R8(tp, INT_CFG0_8125) & - ~(INT_CFG0_TIMEOUT0_BYPASS_8125 | INT_CFG0_MITIGATION_BYPASS_8125)); + 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; @@ -4702,40 +3970,18 @@ rtl8125_hw_set_timer_int_8125(struct rtl8125_private *tp, { switch (tp->HwSuppIntMitiVer) { case 4: - case 6: - case 7: #ifdef ENABLE_LIB_SUPPORT if (message_id < R8125_MAX_RX_QUEUES_VEC_V3) timer_intmiti_val = 0; #else - if ((tp->HwCurrIsrVer == 2) && (message_id < R8125_MAX_RX_QUEUES_VEC_V3)) + if (tp->EnableRss && (message_id < R8125_MAX_RX_QUEUES_VEC_V3)) timer_intmiti_val = 0; #endif //ENABLE_LIB_SUPPORT - //ROK - if (message_id < R8125_MAX_RX_QUEUES_VEC_V3) - RTL_W8(tp,INT_MITI_V2_0_RX + 8 * message_id, timer_intmiti_val); - //TOK - if (tp->HwSuppIntMitiVer == 4) { - if (message_id == 16) - RTL_W8(tp,INT_MITI_V2_0_TX, timer_intmiti_val); - if (message_id == 18 && tp->num_tx_rings > 1) - RTL_W8(tp,INT_MITI_V2_1_TX, timer_intmiti_val); - } else if (tp->HwSuppIntMitiVer == 6) { - if (message_id < tp->num_tx_rings) - RTL_W8(tp,INT_MITI_V2_0_TX + 8 * message_id, timer_intmiti_val); - } else if (tp->HwSuppIntMitiVer == 7) { - if (message_id == 16) - RTL_W8(tp,INT_MITI_V2_0_TX, timer_intmiti_val); - if (message_id == 17 && tp->num_tx_rings > 1) - RTL_W8(tp,INT_MITI_V2_1_TX, timer_intmiti_val); - } - break; - case 5: if (message_id < R8125_MAX_RX_QUEUES_VEC_V3) //ROK RTL_W8(tp,INT_MITI_V2_0_RX + 8 * message_id, timer_intmiti_val); - if (message_id == 0) //TOK + else if (message_id == 16) //TOK RTL_W8(tp,INT_MITI_V2_0_TX, timer_intmiti_val); - if (message_id == 1 && tp->num_tx_rings > 1) //TOK + else if (message_id == 18) //TOK RTL_W8(tp,INT_MITI_V2_1_TX, timer_intmiti_val); break; } @@ -4772,13 +4018,11 @@ static unsigned int rtl8125_xmii_link_ok(struct net_device *dev) { struct rtl8125_private *tp = netdev_priv(dev); - u16 status; + unsigned int retval; - status = RTL_R16(tp, PHYstatus); - if (status == 0xffff) - return 0; + retval = (RTL_R16(tp, PHYstatus) & LinkStatus) ? 1 : 0; - return (status & LinkStatus) ? 1 : 0; + return retval; } static int @@ -4802,8 +4046,9 @@ rtl8125_xmii_reset_enable(struct net_device *dev) { struct rtl8125_private *tp = netdev_priv(dev); - if (rtl8125_is_in_phy_disable_mode(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) & @@ -4811,12 +4056,10 @@ rtl8125_xmii_reset_enable(struct net_device *dev) ADVERTISE_100HALF | ADVERTISE_100FULL)); rtl8125_mdio_write(tp, MII_CTRL1000, rtl8125_mdio_read(tp, MII_CTRL1000) & ~(ADVERTISE_1000HALF | ADVERTISE_1000FULL)); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA5D4, rtl8125_mdio_direct_read_phy_ocp(tp, 0xA5D4) & - ~RTK_ADVERTISE_2500FULL); + 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 (rtl8125_wait_phy_reset_complete(tp) == 0) return; if (netif_msg_link(tp)) printk(KERN_ERR "%s: PHY reset failed.\n", dev->name); @@ -4834,10 +4077,6 @@ rtl8125_init_ring_indexes(struct rtl8125_private *tp) ring->BeginHwDesCloPtr = 0; ring->index = i; ring->priv = tp; - ring->netdev = tp->dev; - - /* reset BQL for queue */ - netdev_tx_reset_queue(txring_txq(ring)); } for (i = 0; i < tp->HwSuppNumRxQueues; i++) { @@ -4845,7 +4084,6 @@ rtl8125_init_ring_indexes(struct rtl8125_private *tp) ring->dirty_rx = ring->cur_rx = 0; ring->index = i; ring->priv = tp; - ring->netdev = tp->dev; } #ifdef ENABLE_LIB_SUPPORT @@ -4875,10 +4113,6 @@ rtl8125_issue_offset_99_event(struct rtl8125_private *tp) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: rtl8125_mac_ocp_write(tp, 0xE09A, rtl8125_mac_ocp_read(tp, 0xE09A) | BIT_0); break; } @@ -4888,15 +4122,14 @@ rtl8125_issue_offset_99_event(struct rtl8125_private *tp) static void NICChkTypeEnableDashInterrupt(struct rtl8125_private *tp) { - if (!tp->DASH) - return; - - if (HW_DASH_SUPPORT_CMAC(tp)) { + if (tp->DASH) { // // even disconnected, enable 3 dash interrupt mask bits for in-band/out-band communication // - rtl8125_enable_dash2_interrupt(tp); - RTL_W16(tp, IntrMask, (ISRIMR_DASH_INTR_EN | ISRIMR_DASH_INTR_CMAC_RESET)); + 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 @@ -4913,12 +4146,9 @@ static int rtl8125_enable_eee_plus(struct rtl8125_private *tp) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: 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; @@ -4940,12 +4170,9 @@ static int rtl8125_disable_eee_plus(struct rtl8125_private *tp) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: 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; @@ -4964,10 +4191,6 @@ static void rtl8125_enable_double_vlan(struct rtl8125_private *tp) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: RTL_W16(tp, DOUBLE_VLAN_CONFIG, 0xf002); break; default: @@ -4984,10 +4207,6 @@ static void rtl8125_disable_double_vlan(struct rtl8125_private *tp) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: RTL_W16(tp, DOUBLE_VLAN_CONFIG, 0); break; default: @@ -4995,26 +4214,6 @@ static void rtl8125_disable_double_vlan(struct rtl8125_private *tp) } } -static void -rtl8125_set_pfm_patch(struct rtl8125_private *tp, bool enable) -{ - if (!tp->RequiredPfmPatch) - goto exit; - - if (enable) { - rtl8125_set_mac_ocp_bit(tp, 0xD3F0, BIT_0); - rtl8125_set_mac_ocp_bit(tp, 0xD3F2, BIT_0); - rtl8125_set_mac_ocp_bit(tp, 0xE85A, BIT_6); - } else { - rtl8125_clear_mac_ocp_bit(tp, 0xD3F0, BIT_0); - rtl8125_clear_mac_ocp_bit(tp, 0xD3F2, BIT_0); - rtl8125_clear_mac_ocp_bit(tp, 0xE85A, BIT_6); - } - -exit: - return; -} - static void rtl8125_link_on_patch(struct net_device *dev) { @@ -5030,24 +4229,14 @@ rtl8125_link_on_patch(struct net_device *dev) RTL_W32(tp, TxConfig, (RTL_R32(tp, TxConfig) | BIT_25) & ~(BIT_19 | BIT_24)); } - 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: - case CFG_METHOD_8: - case CFG_METHOD_9: - if (RTL_R8(tp, PHYstatus) & _10bps) - rtl8125_enable_eee_plus(tp); - break; - default: - break; - } - - if (tp->RequiredPfmPatch) - rtl8125_set_pfm_patch(tp, (RTL_R8(tp, PHYstatus) & _10bps) ? 1 : 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) && + (RTL_R8(tp, PHYstatus) & _10bps)) + rtl8125_enable_eee_plus(tp); rtl8125_hw_start(dev); @@ -5058,7 +4247,7 @@ rtl8125_link_on_patch(struct net_device *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 = rtl8125_mdio_direct_read_phy_ocp(tp, 0xA5D6); + tp->phy_reg_status_2500 = mdio_direct_read_phy_ocp(tp, 0xA5D6); } static void @@ -5071,28 +4260,18 @@ rtl8125_link_down_patch(struct net_device *dev) tp->phy_reg_gbsr = 0; tp->phy_reg_status_2500 = 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: - case CFG_METHOD_8: - case CFG_METHOD_9: + 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); - break; - default: - break; - } - if (tp->RequiredPfmPatch) - rtl8125_set_pfm_patch(tp, 1); + netif_tx_stop_all_queues(dev); netif_carrier_off(dev); - netif_tx_disable(dev); - rtl8125_hw_reset(dev); rtl8125_tx_clear(tp); @@ -5106,8 +4285,9 @@ rtl8125_link_down_patch(struct net_device *dev) //rtl8125_set_speed(dev, tp->autoneg, tp->speed, tp->duplex, tp->advertising); #ifdef ENABLE_DASH_SUPPORT - if (tp->DASH) + if (tp->DASH) { NICChkTypeEnableDashInterrupt(tp); + } #endif } @@ -5139,81 +4319,69 @@ rtl8125_check_link_status(struct net_device *dev) tp->resume_not_chg_speed = 0; } -static bool -rtl8125_is_autoneg_mode_valid(u32 autoneg) +static void +rtl8125_link_option_giga(u8 *aut, + u32 *spd, + u8 *dup, + u32 *adv) { - switch(autoneg) { - case AUTONEG_ENABLE: - case AUTONEG_DISABLE: - return true; - default: - return false; - } -} + if ((*spd != SPEED_1000) && + (*spd != SPEED_100) && + (*spd != SPEED_10)) + *spd = SPEED_1000; -static bool -rtl8125_is_speed_mode_valid(u32 speed) -{ - switch(speed) { - case SPEED_2500: - case SPEED_1000: - case SPEED_100: - case SPEED_10: - return true; - default: - return false; - } -} + if ((*dup != DUPLEX_FULL) && (*dup != DUPLEX_HALF)) + *dup = DUPLEX_FULL; -static bool -rtl8125_is_duplex_mode_valid(u8 duplex) -{ - switch(duplex) { - case DUPLEX_FULL: - case DUPLEX_HALF: - return true; - default: - return false; - } + 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_set_link_option(struct rtl8125_private *tp, - u8 autoneg, - u32 speed, - u8 duplex, - enum rtl8125_fc_mode fc) +rtl8125_link_option(u8 *aut, + u32 *spd, + u8 *dup, + u32 *adv) { - u64 adv; - - if (!rtl8125_is_speed_mode_valid(speed)) - speed = SPEED_2500; - - if (!rtl8125_is_duplex_mode_valid(duplex)) - duplex = DUPLEX_FULL; - - if (!rtl8125_is_autoneg_mode_valid(autoneg)) - autoneg = AUTONEG_ENABLE; + if ((*spd != SPEED_2500) && (*spd != SPEED_1000) && + (*spd != SPEED_100) && (*spd != SPEED_10)) + *spd = SPEED_2500; - speed = min(speed, tp->HwSuppMaxPhyLinkSpeed); + if ((*dup != DUPLEX_FULL) && (*dup != DUPLEX_HALF)) + *dup = DUPLEX_FULL; - adv = 0; - switch(speed) { - case SPEED_2500: - adv |= ADVERTISED_2500baseX_Full; - fallthrough; - default: - adv |= (ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full | - ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full | - ADVERTISED_1000baseT_Half | ADVERTISED_1000baseT_Full); - break; - } + if ((*aut != AUTONEG_ENABLE) && (*aut != AUTONEG_DISABLE)) + *aut = AUTONEG_ENABLE; - tp->autoneg = autoneg; - tp->speed = speed; - tp->duplex = duplex; - tp->advertising = adv; - tp->fcpause = fc; + *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); } /* @@ -5223,14 +4391,17 @@ 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_6) { - val = rtl8125_mdio_direct_read_phy_ocp(tp, 0xC416); + 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); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xC416, 0x0000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xC416, 0x0050); + mdio_direct_write_phy_ocp(tp, 0xC416, 0x0000); + mdio_direct_write_phy_ocp(tp, 0xC416, 0x0050); rtl8125_clear_phy_mcu_patch_request(tp); } } @@ -5245,12 +4416,15 @@ rtl8125_disable_ocp_phy_power_saving(struct net_device *dev) if (tp->mcfg == CFG_METHOD_2 || tp->mcfg == CFG_METHOD_3 || - tp->mcfg == CFG_METHOD_6) { - val = rtl8125_mdio_direct_read_phy_ocp(tp, 0xC416); + 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); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xC416, 0x0000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xC416, 0x0500); + mdio_direct_write_phy_ocp(tp, 0xC416, 0x0000); + mdio_direct_write_phy_ocp(tp, 0xC416, 0x0500); rtl8125_clear_phy_mcu_patch_request(tp); } } @@ -5279,10 +4453,6 @@ rtl8125_disable_pci_offset_99(struct rtl8125_private *tp) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: rtl8125_mac_ocp_write(tp, 0xE032, rtl8125_mac_ocp_read(tp, 0xE032) & ~(BIT_0 | BIT_1)); break; } @@ -5294,10 +4464,6 @@ rtl8125_disable_pci_offset_99(struct rtl8125_private *tp) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: rtl8125_csi_fun0_write_byte(tp, 0x99, 0x00); break; } @@ -5315,10 +4481,6 @@ rtl8125_enable_pci_offset_99(struct rtl8125_private *tp) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: rtl8125_csi_fun0_write_byte(tp, 0x99, tp->org_pci_offset_99); break; } @@ -5330,10 +4492,6 @@ rtl8125_enable_pci_offset_99(struct rtl8125_private *tp) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: csi_tmp = rtl8125_mac_ocp_read(tp, 0xE032); csi_tmp &= ~(BIT_0 | BIT_1); if (tp->org_pci_offset_99 & (BIT_5 | BIT_6)) @@ -5357,10 +4515,6 @@ rtl8125_init_pci_offset_99(struct rtl8125_private *tp) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: rtl8125_mac_ocp_write(tp, 0xCDD0, 0x9003); csi_tmp = rtl8125_mac_ocp_read(tp, 0xE034); csi_tmp |= (BIT_15 | BIT_14); @@ -5401,10 +4555,6 @@ rtl8125_disable_pci_offset_180(struct rtl8125_private *tp) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: csi_tmp = rtl8125_mac_ocp_read(tp, 0xE092); csi_tmp &= 0xFF00; rtl8125_mac_ocp_write(tp, 0xE092, csi_tmp); @@ -5424,10 +4574,6 @@ rtl8125_enable_pci_offset_180(struct rtl8125_private *tp) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: csi_tmp = rtl8125_mac_ocp_read(tp, 0xE094); csi_tmp &= 0x00FF; rtl8125_mac_ocp_write(tp, 0xE094, csi_tmp); @@ -5441,10 +4587,6 @@ rtl8125_enable_pci_offset_180(struct rtl8125_private *tp) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: csi_tmp = rtl8125_mac_ocp_read(tp, 0xE092); csi_tmp &= 0xFF00; csi_tmp |= BIT_2; @@ -5471,10 +4613,6 @@ rtl8125_set_pci_99_180_exit_driver_para(struct net_device *dev) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: if (tp->org_pci_offset_99 & BIT_2) rtl8125_issue_offset_99_event(tp); rtl8125_disable_pci_offset_99(tp); @@ -5488,10 +4626,6 @@ rtl8125_set_pci_99_180_exit_driver_para(struct net_device *dev) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: rtl8125_disable_pci_offset_180(tp); break; } @@ -5513,14 +4647,14 @@ static void rtl8125_enable_exit_l1_mask(struct rtl8125_private *tp) { //(1)ERI(0xD4)(OCP 0xC0AC).bit[7:12]=6'b111111, L1 Mask - rtl8125_set_mac_ocp_bit(tp, 0xC0AC, (BIT_7 | BIT_8 | BIT_9 | BIT_10 | BIT_11 | BIT_12)); + 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 - rtl8125_clear_mac_ocp_bit(tp, 0xC0AC, (BIT_7 | BIT_8 | BIT_9 | BIT_10 | BIT_11 | BIT_12)); + ClearMcuAccessRegBit(tp, 0xC0AC, (BIT_7 | BIT_8 | BIT_9 | BIT_10 | BIT_11 | BIT_12)); } static void @@ -5528,7 +4662,7 @@ rtl8125_enable_extend_tally_couter(struct rtl8125_private *tp) { switch (tp->HwSuppExtendTallyCounterVer) { case 1: - rtl8125_set_mac_ocp_bit(tp, 0xEA84, (BIT_1 | BIT_0)); + SetMcuAccessRegBit(tp, 0xEA84, (BIT_1 | BIT_0)); break; } } @@ -5538,23 +4672,18 @@ rtl8125_disable_extend_tally_couter(struct rtl8125_private *tp) { switch (tp->HwSuppExtendTallyCounterVer) { case 1: - rtl8125_clear_mac_ocp_bit(tp, 0xEA84, (BIT_1 | BIT_0)); + ClearMcuAccessRegBit(tp, 0xEA84, (BIT_1 | BIT_0)); break; } } static void -rtl8125_enable_force_clkreq(struct rtl8125_private *tp, bool enable) +rtl8125_hw_d3_para(struct net_device *dev) { - if (enable) - RTL_W8(tp, 0xF1, RTL_R8(tp, 0xF1) | BIT_7); - else - RTL_W8(tp, 0xF1, RTL_R8(tp, 0xF1) & ~BIT_7); -} + struct rtl8125_private *tp = netdev_priv(dev); + + RTL_W16(tp, RxMaxSize, RX_BUF_SIZE); -static void -rtl8125_enable_aspm_clkreq_lock(struct rtl8125_private *tp, bool enable) -{ switch (tp->mcfg) { case CFG_METHOD_2: case CFG_METHOD_3: @@ -5562,29 +4691,19 @@ rtl8125_enable_aspm_clkreq_lock(struct rtl8125_private *tp, bool enable) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: + RTL_W8(tp, 0xF1, RTL_R8(tp, 0xF1) & ~BIT_7); rtl8125_enable_cfg9346_write(tp); - if (enable) { - RTL_W8(tp, Config2, RTL_R8(tp, Config2) | BIT_7); - RTL_W8(tp, Config5, RTL_R8(tp, Config5) | BIT_0); - } else { - RTL_W8(tp, Config2, RTL_R8(tp, Config2) & ~BIT_7); - RTL_W8(tp, Config5, RTL_R8(tp, Config5) & ~BIT_0); - } + 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; } -} -static void -rtl8125_hw_d3_para(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); + rtl8125_disable_exit_l1_mask(tp); - RTL_W16(tp, RxMaxSize, RX_BUF_SIZE); +#ifdef ENABLE_REALWOW_SUPPORT + rtl8125_set_realwow_d3_para(dev); +#endif switch (tp->mcfg) { case CFG_METHOD_2: @@ -5593,27 +4712,19 @@ rtl8125_hw_d3_para(struct net_device *dev) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: - rtl8125_enable_force_clkreq(tp, 0); - rtl8125_enable_aspm_clkreq_lock(tp, 0); + rtl8125_mac_ocp_write(tp, 0xEA18, 0x0064); break; } - rtl8125_disable_exit_l1_mask(tp); - -#ifdef ENABLE_REALWOW_SUPPORT - rtl8125_set_realwow_d3_para(dev); -#endif - 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_6) + 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); @@ -5652,7 +4763,7 @@ rtl8125_enable_linkchg_wakeup(struct net_device *dev) switch (tp->HwSuppLinkChgWakeUpVer) { case 3: RTL_W8(tp, Config3, RTL_R8(tp, Config3) | LinkUp); - rtl8125_clear_set_mac_ocp_bit(tp, 0xE0C6, (BIT_5 | BIT_3 | BIT_2), (BIT_4 | BIT_1 | BIT_0)); + ClearAndSetMcuAccessRegBit(tp, 0xE0C6, (BIT_5 | BIT_3 | BIT_2), (BIT_4 | BIT_1 | BIT_0)); break; } } @@ -5665,7 +4776,7 @@ rtl8125_disable_linkchg_wakeup(struct net_device *dev) switch (tp->HwSuppLinkChgWakeUpVer) { case 3: RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~LinkUp); - rtl8125_clear_mac_ocp_bit(tp, 0xE0C6, (BIT_5 | BIT_4 | BIT_3 | BIT_2 | BIT_1 | BIT_0)); + ClearMcuAccessRegBit(tp, 0xE0C6, (BIT_5 | BIT_4 | BIT_3 | BIT_2 | BIT_1 | BIT_0)); break; } } @@ -5679,7 +4790,7 @@ rtl8125_get_hw_wol(struct rtl8125_private *tp) u32 csi_tmp; u32 wol_opts = 0; - if (disable_wol_support) + if (disable_pm_support) goto out; options = RTL_R8(tp, Config1); @@ -5713,48 +4824,36 @@ rtl8125_get_hw_wol(struct rtl8125_private *tp) static void rtl8125_enable_d0_speedup(struct rtl8125_private *tp) { - u16 clearmask; - u16 setmask; + if (FALSE == HW_SUPPORT_D0_SPEED_UP(tp)) return; + if (tp->D0SpeedUpSpeed == D0_SPEED_UP_SPEED_DISABLE) return; - if (FALSE == HW_SUPPORT_D0_SPEED_UP(tp)) - return; + if (tp->HwSuppD0SpeedUpVer == 1) { + u16 mac_ocp_data; - if (tp->D0SpeedUpSpeed == D0_SPEED_UP_SPEED_DISABLE) - return; + RTL_W8(tp, 0xD0, RTL_R8(tp, 0xD0) | BIT_3); - if (tp->HwSuppD0SpeedUpVer == 1 || tp->HwSuppD0SpeedUpVer == 2) { //speed up speed - clearmask = (BIT_10 | BIT_9 | BIT_8 | BIT_7); - if (tp->D0SpeedUpSpeed == D0_SPEED_UP_SPEED_2500) - setmask = BIT_7; - else - setmask = 0; - rtl8125_clear_set_mac_ocp_bit(tp, 0xE10A, clearmask, setmask); + 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 - clearmask = (BIT_15 | BIT_14); - if (tp->HwSuppD0SpeedUpVer == 2) - clearmask |= BIT_13; - - if (tp->fcpause == rtl8125_fc_full) { - setmask = (BIT_15 | BIT_14); - if (tp->HwSuppD0SpeedUpVer == 2) - setmask |= BIT_13; - } else - setmask = 0; - rtl8125_clear_set_mac_ocp_bit(tp, 0xE860, clearmask, setmask); + 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); } - - RTL_W8(tp, 0xD0, RTL_R8(tp, 0xD0) | BIT_3); } static void rtl8125_disable_d0_speedup(struct rtl8125_private *tp) { - if (FALSE == HW_SUPPORT_D0_SPEED_UP(tp)) - return; + if (FALSE == HW_SUPPORT_D0_SPEED_UP(tp)) return; - RTL_W8(tp, 0xD0, RTL_R8(tp, 0xD0) & ~BIT_3); + if (tp->HwSuppD0SpeedUpVer == 1) + RTL_W8(tp, 0xD0, RTL_R8(tp, 0xD0) & ~BIT_7); } static void @@ -5813,8 +4912,7 @@ rtl8125_phy_restart_nway(struct net_device *dev) { struct rtl8125_private *tp = netdev_priv(dev); - if (rtl8125_is_in_phy_disable_mode(dev)) - return; + 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); @@ -5826,8 +4924,7 @@ 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 (rtl8125_is_in_phy_disable_mode(dev)) return; if ((speed == SPEED_10) && (duplex == DUPLEX_HALF)) { bmcr_true_force = BMCR_SPEED10; @@ -5864,14 +4961,14 @@ rtl8125_set_pci_pme(struct rtl8125_private *tp, int set) pci_write_config_word(pdev, pdev->pm_cap + PCI_PM_CTRL, pmc); } -static int +static void rtl8125_set_wol_link_speed(struct net_device *dev) { struct rtl8125_private *tp = netdev_priv(dev); - int auto_nego = 0; + int auto_nego; int giga_ctrl; int ctrl_2500; - u64 adv; + u32 adv; u16 anlpar; u16 gbsr; u16 status_2500; @@ -5889,8 +4986,8 @@ rtl8125_set_wol_link_speed(struct net_device *dev) giga_ctrl = rtl8125_mdio_read(tp, MII_CTRL1000); giga_ctrl &= ~(ADVERTISE_1000HALF | ADVERTISE_1000FULL); - ctrl_2500 = rtl8125_mdio_direct_read_phy_ocp(tp, 0xA5D4); - ctrl_2500 &= ~RTK_ADVERTISE_2500FULL; + ctrl_2500 = mdio_direct_read_phy_ocp(tp, 0xA5D4); + ctrl_2500 &= ~(RTK_ADVERTISE_2500FULL); aner = tp->phy_reg_aner; anlpar = tp->phy_reg_anlpar; @@ -5900,7 +4997,7 @@ rtl8125_set_wol_link_speed(struct net_device *dev) aner = rtl8125_mdio_read(tp, MII_EXPANSION); anlpar = rtl8125_mdio_read(tp, MII_LPA); gbsr = rtl8125_mdio_read(tp, MII_STAT1000); - status_2500 = rtl8125_mdio_direct_read_phy_ocp(tp, 0xA5D6); + status_2500 = mdio_direct_read_phy_ocp(tp, 0xA5D6); } adv = tp->advertising; @@ -5921,8 +5018,7 @@ rtl8125_set_wol_link_speed(struct net_device *dev) auto_nego |= auto_nego_tmp; goto skip_check_lpa; } - if (!(aner & EXPANSION_NWAY)) - goto exit; + if (!(aner & EXPANSION_NWAY)) goto exit; if ((adv & ADVERTISED_10baseT_Half) && (anlpar & LPA_10HALF)) auto_nego |= ADVERTISE_10HALF; @@ -5951,12 +5047,12 @@ rtl8125_set_wol_link_speed(struct net_device *dev) rtl8125_mdio_write(tp, MII_ADVERTISE, auto_nego); rtl8125_mdio_write(tp, MII_CTRL1000, giga_ctrl); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA5D4, ctrl_2500); + mdio_direct_write_phy_ocp(tp, 0xA5D4, ctrl_2500); rtl8125_phy_restart_nway(dev); exit: - return auto_nego; + return; } static bool @@ -5964,10 +5060,8 @@ 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) && (tp->wol_opts & WAKE_PHY)) - return 1; - - if (!from_suspend && tp->resume_not_chg_speed) + if ((from_suspend && !tp->link_ok(dev)) || + (!from_suspend && tp->resume_not_chg_speed)) return 1; return 0; @@ -5979,37 +5073,32 @@ rtl8125_powerdown_pll(struct net_device *dev, u8 from_suspend) tp->check_keep_link_speed = 0; if (tp->wol_enabled == WOL_ENABLED || tp->DASH || tp->EnableKCPOffload) { - int auto_nego; - rtl8125_set_hw_wol(dev, tp->wol_opts); - switch (tp->mcfg) { - case CFG_METHOD_2 ... CFG_METHOD_11: + 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); - break; - default: - break; - }; + } /* Enable the PME and clear the status */ rtl8125_set_pci_pme(tp, 1); if (rtl8125_keep_wol_link_speed(dev, from_suspend)) { - tp->check_keep_link_speed = 1; + if (tp->wol_opts & WAKE_PHY) + tp->check_keep_link_speed = 1; } else { - if (HW_SUPPORT_D0_SPEED_UP(tp)) { + if (tp->D0SpeedUpSpeed != D0_SPEED_UP_SPEED_DISABLE) { rtl8125_enable_d0_speedup(tp); tp->check_keep_link_speed = 1; } - auto_nego = rtl8125_set_wol_link_speed(dev); - - if (tp->RequiredPfmPatch) - rtl8125_set_pfm_patch(tp, - (auto_nego & (ADVERTISE_10HALF | ADVERTISE_10FULL)) ? - 1 : 0); + rtl8125_set_wol_link_speed(dev); } RTL_W32(tp, RxConfig, RTL_R32(tp, RxConfig) | AcceptBroadcast | AcceptMulticast | AcceptMyPhys); @@ -6030,10 +5119,6 @@ rtl8125_powerdown_pll(struct net_device *dev, u8 from_suspend) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: RTL_W8(tp, PMCH, RTL_R8(tp, PMCH) & ~BIT_7); break; } @@ -6046,10 +5131,6 @@ rtl8125_powerdown_pll(struct net_device *dev, u8 from_suspend) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: RTL_W8(tp, 0xF2, RTL_R8(tp, 0xF2) & ~BIT_6); break; } @@ -6066,16 +5147,11 @@ static void rtl8125_powerup_pll(struct net_device *dev) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: RTL_W8(tp, PMCH, RTL_R8(tp, PMCH) | BIT_7 | BIT_6); break; } - if (tp->resume_not_chg_speed) - return; + if (tp->resume_not_chg_speed) return; rtl8125_phy_power_up(dev); } @@ -6090,7 +5166,7 @@ rtl8125_get_wol(struct net_device *dev, wol->wolopts = 0; - if (tp->mcfg == CFG_METHOD_DEFAULT || disable_wol_support) { + if (tp->mcfg == CFG_METHOD_DEFAULT || disable_pm_support) { wol->supported = 0; return; } else { @@ -6110,7 +5186,7 @@ rtl8125_set_wol(struct net_device *dev, { struct rtl8125_private *tp = netdev_priv(dev); - if (tp->mcfg == CFG_METHOD_DEFAULT || disable_wol_support) + if (tp->mcfg == CFG_METHOD_DEFAULT || disable_pm_support) return -EOPNOTSUPP; tp->wol_opts = wol->wolopts; @@ -6136,7 +5212,7 @@ rtl8125_get_drvinfo(struct net_device *dev, info->eedump_len = tp->eeprom_len; BUILD_BUG_ON(sizeof(info->fw_version) < sizeof(rtl_fw->version)); if (rtl_fw) - strscpy(info->fw_version, rtl_fw->version, + strlcpy(info->fw_version, rtl_fw->version, sizeof(info->fw_version)); } @@ -6150,14 +5226,13 @@ rtl8125_get_regs_len(struct net_device *dev) static void rtl8125_set_d0_speedup_speed(struct rtl8125_private *tp) { - if (FALSE == HW_SUPPORT_D0_SPEED_UP(tp)) - return; + 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) + else if(tp->speed == SPEED_1000) tp->D0SpeedUpSpeed = D0_SPEED_UP_SPEED_1000; } } @@ -6167,7 +5242,7 @@ rtl8125_set_speed_xmii(struct net_device *dev, u8 autoneg, u32 speed, u8 duplex, - u64 adv) + u32 adv) { struct rtl8125_private *tp = netdev_priv(dev); int auto_nego = 0; @@ -6176,10 +5251,13 @@ rtl8125_set_speed_xmii(struct net_device *dev, int rc = -EINVAL; //Disable Giga Lite - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA428, BIT_9); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA5EA, BIT_0); + ClearEthPhyOcpBit(tp, 0xA428, BIT_9); + ClearEthPhyOcpBit(tp, 0xA5EA, BIT_0); - if (!rtl8125_is_speed_mode_valid(speed)) { + if (speed != SPEED_2500 && + (speed != SPEED_1000) && + (speed != SPEED_100) && + (speed != SPEED_10)) { speed = SPEED_2500; duplex = DUPLEX_FULL; adv |= tp->advertising; @@ -6187,8 +5265,8 @@ rtl8125_set_speed_xmii(struct net_device *dev, giga_ctrl = rtl8125_mdio_read(tp, MII_CTRL1000); giga_ctrl &= ~(ADVERTISE_1000HALF | ADVERTISE_1000FULL); - ctrl_2500 = rtl8125_mdio_direct_read_phy_ocp(tp, 0xA5D4); - ctrl_2500 &= ~RTK_ADVERTISE_2500FULL; + ctrl_2500 = mdio_direct_read_phy_ocp(tp, 0xA5D4); + ctrl_2500 &= ~(RTK_ADVERTISE_2500FULL); if (autoneg == AUTONEG_ENABLE) { /*n-way force*/ @@ -6224,7 +5302,7 @@ rtl8125_set_speed_xmii(struct net_device *dev, rtl8125_mdio_write(tp, 0x1f, 0x0000); rtl8125_mdio_write(tp, MII_ADVERTISE, auto_nego); rtl8125_mdio_write(tp, MII_CTRL1000, giga_ctrl); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA5D4, ctrl_2500); + mdio_direct_write_phy_ocp(tp, 0xA5D4, ctrl_2500); rtl8125_phy_restart_nway(dev); mdelay(20); } else { @@ -6252,13 +5330,12 @@ rtl8125_set_speed(struct net_device *dev, u8 autoneg, u32 speed, u8 duplex, - u64 adv) + u32 adv) { struct rtl8125_private *tp = netdev_priv(dev); int ret; - if (tp->resume_not_chg_speed) - return 0; + if (tp->resume_not_chg_speed) return 0; ret = tp->set_speed(dev, autoneg, speed, duplex, adv); @@ -6279,7 +5356,7 @@ rtl8125_set_settings(struct net_device *dev, u8 autoneg; u32 speed; u8 duplex; - u64 supported = 0, advertising = 0; + u32 supported, advertising; #if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) autoneg = cmd->autoneg; @@ -6292,9 +5369,9 @@ rtl8125_set_settings(struct net_device *dev, autoneg = base->autoneg; speed = base->speed; duplex = base->duplex; - ethtool_convert_link_mode_to_legacy_u32((u32*)&supported, + ethtool_convert_link_mode_to_legacy_u32(&supported, cmd->link_modes.supported); - ethtool_convert_link_mode_to_legacy_u32((u32*)&advertising, + 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)) @@ -6315,6 +5392,7 @@ rtl8125_set_settings(struct net_device *dev, 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) @@ -6386,28 +5464,20 @@ static u32 rtl8125_rx_desc_opts1(struct rtl8125_private *tp, struct RxDesc *desc) { - switch (tp->InitRxDescType) { - case RX_DESC_RING_TYPE_3: + if (tp->InitRxDescType == RX_DESC_RING_TYPE_3) return ((struct RxDescV3 *)desc)->RxDescNormalDDWord4.opts1; - case RX_DESC_RING_TYPE_4: - return ((struct RxDescV4 *)desc)->RxDescNormalDDWord2.opts1; - default: + else return desc->opts1; - } } static u32 rtl8125_rx_desc_opts2(struct rtl8125_private *tp, struct RxDesc *desc) { - switch (tp->InitRxDescType) { - case RX_DESC_RING_TYPE_3: + if (tp->InitRxDescType == RX_DESC_RING_TYPE_3) return ((struct RxDescV3 *)desc)->RxDescNormalDDWord4.opts2; - case RX_DESC_RING_TYPE_4: - return ((struct RxDescV4 *)desc)->RxDescNormalDDWord2.opts2; - default: + else return desc->opts2; - } } #ifdef CONFIG_R8125_VLAN @@ -6416,17 +5486,10 @@ static void rtl8125_clear_rx_desc_opts2(struct rtl8125_private *tp, struct RxDesc *desc) { - switch (tp->InitRxDescType) { - case RX_DESC_RING_TYPE_3: + if (tp->InitRxDescType == RX_DESC_RING_TYPE_3) ((struct RxDescV3 *)desc)->RxDescNormalDDWord4.opts2 = 0; - break; - case RX_DESC_RING_TYPE_4: - ((struct RxDescV4 *)desc)->RxDescNormalDDWord2.opts2 = 0; - break; - default: + else desc->opts2 = 0; - break; - } } static inline u32 @@ -6456,18 +5519,12 @@ rtl8125_vlan_rx_register(struct net_device *dev, struct rtl8125_private *tp = netdev_priv(dev); tp->vlgrp = grp; - - 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: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: + 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)) @@ -6475,7 +5532,6 @@ rtl8125_vlan_rx_register(struct net_device *dev, tp->rtl8125_rx_config &= ~(EnableInnerVlan | EnableOuterVlan); RTL_W32(tp, RxConfig, RTL_R32(tp, RxConfig) & ~(EnableInnerVlan | EnableOuterVlan)) } - break; } } @@ -6608,17 +5664,6 @@ static int rtl8125_set_features(struct net_device *dev, #endif -static u8 rtl8125_get_mdi_status(struct rtl8125_private *tp) -{ - if (!tp->link_ok(tp->dev)) - return ETH_TP_MDI_INVALID; - - if (rtl8125_mdio_direct_read_phy_ocp(tp, 0xA444) & BIT_1) - return ETH_TP_MDI; - else - return ETH_TP_MDI_X; -} - static void rtl8125_gset_xmii(struct net_device *dev, #if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) struct ethtool_cmd *cmd @@ -6632,12 +5677,12 @@ static void rtl8125_gset_xmii(struct net_device *dev, u16 anlpar = tp->phy_reg_anlpar; u16 gbsr = tp->phy_reg_gbsr; u16 status_2500 = tp->phy_reg_status_2500; - u64 lpa_adv = 0; + u32 lpa_adv = 0; u16 status; u8 autoneg, duplex; u32 speed = 0; u16 bmcr; - u64 supported, advertising; + u32 supported, advertising; u8 report_lpa = 0; supported = SUPPORTED_10baseT_Half | @@ -6651,12 +5696,16 @@ static void rtl8125_gset_xmii(struct net_device *dev, SUPPORTED_Pause | SUPPORTED_Asym_Pause; - if (!HW_SUPP_PHY_LINK_SPEED_2500M(tp)) + advertising = tp->advertising; + + if (tp->mcfg == CFG_METHOD_6 || tp->mcfg == CFG_METHOD_7) supported &= ~SUPPORTED_2500baseX_Full; - advertising = tp->advertising; + rtl8125_mdio_write(tp, 0x1F, 0x0000); + bmcr = rtl8125_mdio_read(tp, MII_BMCR); + if (tp->phy_auto_nego_reg || tp->phy_1000_ctrl_reg || - tp->phy_2500_ctrl_reg) { + tp->phy_2500_ctrl_reg ) { advertising = 0; if (tp->phy_auto_nego_reg & ADVERTISE_10HALF) advertising |= ADVERTISED_10baseT_Half; @@ -6672,8 +5721,6 @@ static void rtl8125_gset_xmii(struct net_device *dev, advertising |= ADVERTISED_2500baseX_Full; } - rtl8125_mdio_write(tp, 0x1F, 0x0000); - bmcr = rtl8125_mdio_read(tp, MII_BMCR); if (bmcr & BMCR_ANENABLE) { autoneg = AUTONEG_ENABLE; advertising |= ADVERTISED_Autoneg; @@ -6689,7 +5736,14 @@ static void rtl8125_gset_xmii(struct net_device *dev, if (report_lpa) { /*link on*/ - speed = rtl8125_convert_link_speed(status); + 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; @@ -6697,8 +5751,7 @@ static void rtl8125_gset_xmii(struct net_device *dev, if (status & RxFlowCtrl) advertising |= ADVERTISED_Pause; - duplex = ((status & (_1000bpsF | _2500bpsF)) || - (status & FullDup)) ? + duplex = ((status & (_1000bpsF | _2500bpsF)) || (status & FullDup)) ? DUPLEX_FULL : DUPLEX_HALF; /*link partner*/ @@ -6730,14 +5783,13 @@ static void rtl8125_gset_xmii(struct net_device *dev, } #if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) - cmd->supported = (u32)supported; - cmd->advertising = (u32)advertising; + cmd->supported = supported; + cmd->advertising = advertising; cmd->autoneg = autoneg; cmd->speed = speed; cmd->duplex = duplex; cmd->port = PORT_TP; - cmd->lp_advertising = (u32)lpa_adv; - cmd->eth_tp_mdix = rtl8125_get_mdi_status(tp); + cmd->lp_advertising = lpa_adv; #else ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.supported, supported); @@ -6765,13 +5817,18 @@ static void rtl8125_gset_xmii(struct net_device *dev, 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; - cmd->base.eth_tp_mdix = rtl8125_get_mdi_status(tp); #endif } @@ -6829,10 +5886,6 @@ static void rtl8125_get_regs(struct net_device *dev, struct ethtool_regs *regs, case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: default: for (i = 0; i < R8125_ERI_REGS_SIZE; i+=4) { *(u32*)data = rtl8125_eri_read(tp, i , 4, ERIAR_ExGMAC); @@ -6966,10 +6019,10 @@ rtl8125_set_ring_size(struct rtl8125_private *tp, u32 rx, u32 tx) { int i; - for (i = 0; i < R8125_MAX_RX_QUEUES; i++) + for (i = 0; i < tp->num_rx_rings; i++) tp->rx_ring[i].num_rx_desc = rx; - for (i = 0; i < R8125_MAX_TX_QUEUES; i++) + for (i = 0; i < tp->num_tx_rings; i++) tp->tx_ring[i].num_tx_desc = tx; } @@ -6987,7 +6040,7 @@ static void rtl8125_get_ringparam(struct net_device *dev, struct rtl8125_private *tp = netdev_priv(dev); ring->rx_max_pending = MAX_NUM_TX_DESC; - ring->tx_max_pending = MAX_NUM_RX_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; } @@ -7140,10 +6193,6 @@ static int rtl_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: default: VPD_addr = 0xD2; VPD_data = 0xD4; @@ -7225,33 +6274,60 @@ static int _kc_ethtool_op_set_sg(struct net_device *dev, u32 data) } #endif -static void -rtl8125_set_eee_lpi_timer(struct rtl8125_private *tp) +static int rtl8125_enable_eee(struct rtl8125_private *tp) { - u16 dev_lpi_timer; - - dev_lpi_timer = tp->eee.tx_lpi_timer; + 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_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: - RTL_W16(tp, EEE_TXIDLE_TIMER_8125, dev_lpi_timer); + 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; } -} -static bool rtl8125_is_adv_eee_enabled(struct rtl8125_private *tp) -{ + /*Advanced EEE*/ switch (tp->mcfg) { case CFG_METHOD_2: case CFG_METHOD_3: @@ -7259,70 +6335,19 @@ static bool rtl8125_is_adv_eee_enabled(struct rtl8125_private *tp) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - //case CFG_METHOD_10: - //case CFG_METHOD_11: - if (rtl8125_mdio_direct_read_phy_ocp(tp, 0xA430) & BIT_15) - return true; - break; - default: - break; - } - - return false; -} - -static void _rtl8125_disable_adv_eee(struct rtl8125_private *tp) -{ - bool lock; - - if (rtl8125_is_adv_eee_enabled(tp)) - lock = true; - else - lock = false; - - if (lock) rtl8125_set_phy_mcu_patch_request(tp); - - rtl8125_clear_mac_ocp_bit(tp, 0xE052, BIT_0); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA442, BIT_12 | BIT_13); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA430, BIT_15); - - if (lock) + ClearMcuAccessRegBit(tp, 0xE052, BIT_0); + ClearEthPhyOcpBit(tp, 0xA442, BIT_12 | BIT_13); + ClearEthPhyOcpBit(tp, 0xA430, BIT_15); rtl8125_clear_phy_mcu_patch_request(tp); -} - -static void rtl8125_disable_adv_eee(struct rtl8125_private *tp) -{ - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_6: - case CFG_METHOD_8: - case CFG_METHOD_9: - rtl8125_oob_mutex_lock(tp); break; } - _rtl8125_disable_adv_eee(tp); - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_6: - case CFG_METHOD_8: - case CFG_METHOD_9: - rtl8125_oob_mutex_unlock(tp); - break; - } + return ret; } -static int rtl8125_enable_eee(struct rtl8125_private *tp) +static int rtl8125_disable_eee(struct rtl8125_private *tp) { - struct ethtool_keee *eee = &tp->eee; - u16 eee_adv_cap1_t = rtl8125_ethtool_adv_to_mmd_eee_adv_cap1_t(eee->advertised); - u16 eee_adv_cap2_t = rtl8125_ethtool_adv_to_mmd_eee_adv_cap2_t(eee->advertised); int ret; ret = 0; @@ -7330,100 +6355,51 @@ static int rtl8125_enable_eee(struct rtl8125_private *tp) case CFG_METHOD_2: case CFG_METHOD_3: case CFG_METHOD_6: - rtl8125_set_mac_ocp_bit(tp, 0xE040, (BIT_1|BIT_0)); - rtl8125_set_mac_ocp_bit(tp, 0xEB62, (BIT_2|BIT_1)); - - rtl8125_set_eth_phy_ocp_bit(tp, 0xA432, BIT_4); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA5D0, - MDIO_EEE_100TX | MDIO_EEE_1000T, - eee_adv_cap1_t); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA6D4, MDIO_EEE_2_5GT); - - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA6D8, BIT_4); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA428, BIT_7); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA4A2, BIT_9); + 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: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: - rtl8125_set_mac_ocp_bit(tp, 0xE040, (BIT_1|BIT_0)); - - rtl8125_set_eth_phy_ocp_bit(tp, 0xA432, BIT_4); - - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA5D0, - MDIO_EEE_100TX | MDIO_EEE_1000T, - eee_adv_cap1_t); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA6D4, - MDIO_EEE_2_5GT, - eee_adv_cap2_t); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA6D8, BIT_4); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA428, BIT_7); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA4A2, BIT_9); + 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*/ - rtl8125_disable_adv_eee(tp); - - 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: - rtl8125_clear_mac_ocp_bit(tp, 0xE040, (BIT_1|BIT_0)); - rtl8125_clear_mac_ocp_bit(tp, 0xEB62, (BIT_2|BIT_1)); - - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA432, BIT_4); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA5D0, (MDIO_EEE_100TX | MDIO_EEE_1000T)); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA6D4, BIT_0); - - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA6D8, BIT_4); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA428, BIT_7); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA4A2, BIT_9); - break; case CFG_METHOD_4: case CFG_METHOD_5: + case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: - rtl8125_clear_mac_ocp_bit(tp, 0xE040, (BIT_1|BIT_0)); - - rtl8125_set_eth_phy_ocp_bit(tp, 0xA432, BIT_4); - - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA5D0, (MDIO_EEE_100TX | MDIO_EEE_1000T)); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA6D4, MDIO_EEE_2_5GT); - - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA6D8, BIT_4); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA428, BIT_7); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA4A2, BIT_9); - break; - default: - ret = -EOPNOTSUPP; + 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; } - /*Advanced EEE*/ - rtl8125_disable_adv_eee(tp); - return ret; } @@ -7452,22 +6428,22 @@ static int rtl_nway_reset(struct net_device *dev) #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0) static u32 -rtl8125_device_lpi_t_to_ethtool_lpi_t(struct rtl8125_private *tp , u32 lpi_timer) +rtl8125_tx_lpi_timer_to_us(struct rtl8125_private *tp , u32 tx_lpi_timer) { u32 to_us; u16 status; - to_us = lpi_timer * 80; + //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*/ - //2.5G : lpi_timer * 3.2ns - //Giga: lpi_timer * 8ns - //100M : lpi_timer * 80ns if (status & _2500bpsF) - to_us = (lpi_timer * 32) / 10; + to_us = (tx_lpi_timer * 32) / 10; else if (status & _1000bpsF) - to_us = lpi_timer * 8; + to_us = tx_lpi_timer * 8; } //ns to us @@ -7476,134 +6452,6 @@ rtl8125_device_lpi_t_to_ethtool_lpi_t(struct rtl8125_private *tp , u32 lpi_timer return to_us; } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0) -static void -rtl8125_adv_to_linkmode(unsigned long *mode, u64 adv) -{ - linkmode_zero(mode); - - if (adv & ADVERTISED_10baseT_Half) - linkmode_set_bit(ETHTOOL_LINK_MODE_10baseT_Half_BIT, mode); - if (adv & ADVERTISED_10baseT_Full) - linkmode_set_bit(ETHTOOL_LINK_MODE_10baseT_Full_BIT, mode); - if (adv & ADVERTISED_100baseT_Half) - linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Half_BIT, mode); - if (adv & ADVERTISED_100baseT_Full) - linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT, mode); - if (adv & ADVERTISED_1000baseT_Half) - linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Half_BIT, mode); - if (adv & ADVERTISED_1000baseT_Full) - linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, mode); - if (adv & ADVERTISED_2500baseX_Full) - linkmode_set_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, mode); -} - -static int -rtl_ethtool_get_eee(struct net_device *net, struct ethtool_keee *edata) -{ - __ETHTOOL_DECLARE_LINK_MODE_MASK(common); - struct rtl8125_private *tp = netdev_priv(net); - struct ethtool_keee *eee = &tp->eee; - u32 tx_lpi_timer; - u16 val; - - if (unlikely(tp->rtk_enable_diag)) - return -EBUSY; - - /* Get LP advertisement EEE */ - val = rtl8125_mdio_direct_read_phy_ocp(tp, 0xA5D2); - mii_eee_cap1_mod_linkmode_t(edata->lp_advertised, val); - val = rtl8125_mdio_direct_read_phy_ocp(tp, 0xA6D0); - mii_eee_cap2_mod_linkmode_sup_t(edata->lp_advertised, val); - - /* Get EEE Tx LPI timer*/ - tx_lpi_timer = rtl8125_device_lpi_t_to_ethtool_lpi_t(tp, eee->tx_lpi_timer); - - val = rtl8125_mac_ocp_read(tp, 0xE040); - val &= BIT_1 | BIT_0; - - edata->eee_enabled = !!val; - linkmode_copy(edata->supported, eee->supported); - linkmode_copy(edata->advertised, eee->advertised); - edata->tx_lpi_enabled = edata->eee_enabled; - edata->tx_lpi_timer = tx_lpi_timer; - linkmode_and(common, edata->advertised, edata->lp_advertised); - edata->eee_active = !linkmode_empty(common); - - return 0; -} - -static int -rtl_ethtool_set_eee(struct net_device *net, struct ethtool_keee *edata) -{ - __ETHTOOL_DECLARE_LINK_MODE_MASK(advertising); - __ETHTOOL_DECLARE_LINK_MODE_MASK(tmp); - struct rtl8125_private *tp = netdev_priv(net); - struct ethtool_keee *eee = &tp->eee; - 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; - } - } - */ - - rtl8125_adv_to_linkmode(advertising, tp->advertising); - if (linkmode_empty(edata->advertised)) { - linkmode_and(edata->advertised, advertising, eee->supported); - } else if (linkmode_andnot(tmp, edata->advertised, advertising)) { - dev_printk(KERN_WARNING, tp_to_dev(tp), "EEE advertised must be a subset of autoneg advertised speeds\n"); - rc = -EINVAL; - goto out; - } - - if (linkmode_andnot(tmp, edata->advertised, eee->supported)) { - dev_printk(KERN_WARNING, tp_to_dev(tp), "EEE advertised must be a subset of support \n"); - rc = -EINVAL; - goto out; - } - - //tp->eee.eee_enabled = edata->eee_enabled; - //tp->eee_adv_t = rtl8125_ethtool_adv_to_mmd_eee_adv_cap1_t(edata->advertised); - - linkmode_copy(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); - -out: - return rc; -} -#else static int rtl_ethtool_get_eee(struct net_device *net, struct ethtool_eee *edata) { @@ -7616,22 +6464,26 @@ rtl_ethtool_get_eee(struct net_device *net, struct ethtool_eee *edata) return -EBUSY; /* Get Supported EEE */ - //val = rtl8125_mdio_direct_read_phy_ocp(tp, 0xA5C4); + //val = mdio_direct_read_phy_ocp(tp, 0xA5C4); //supported = mmd_eee_cap_to_ethtool_sup_t(val); supported = eee->supported; /* Get advertisement EEE */ - adv = eee->advertised; + 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 = rtl8125_mdio_direct_read_phy_ocp(tp, 0xA5D2); + val = mdio_direct_read_phy_ocp(tp, 0xA5D2); lp = mmd_eee_adv_to_ethtool_adv_t(val); - val = rtl8125_mdio_direct_read_phy_ocp(tp, 0xA6D0); + 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 = rtl8125_device_lpi_t_to_ethtool_lpi_t(tp, 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; @@ -7642,7 +6494,7 @@ rtl_ethtool_get_eee(struct net_device *net, struct ethtool_eee *edata) edata->advertised = adv; edata->lp_advertised = lp; edata->tx_lpi_enabled = edata->eee_enabled; - edata->tx_lpi_timer = tx_lpi_timer; + edata->tx_lpi_timer = rtl8125_tx_lpi_timer_to_us(tp, tx_lpi_timer); return 0; } @@ -7652,7 +6504,7 @@ 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; - u64 advertising; + u32 advertising; int rc = 0; if (!HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp) || @@ -7671,23 +6523,21 @@ rtl_ethtool_set_eee(struct net_device *net, struct ethtool_eee *edata) 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; - } + 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 %llu\n", + 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; @@ -7701,11 +6551,14 @@ rtl_ethtool_set_eee(struct net_device *net, struct ethtool_eee *edata) } //tp->eee.eee_enabled = edata->eee_enabled; - //tp->eee_adv_t = rtl8125_ethtool_adv_to_mmd_eee_adv_cap1_t(edata->advertised); + //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->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) @@ -7715,24 +6568,13 @@ rtl_ethtool_set_eee(struct net_device *net, struct ethtool_eee *edata) rtl_nway_reset(net); -out: return rc; -} -#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0) */ -#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0) */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0) -static void rtl8125_get_channels(struct net_device *dev, - struct ethtool_channels *channel) -{ - struct rtl8125_private *tp = netdev_priv(dev); +out: - channel->max_rx = tp->HwSuppNumRxQueues; - channel->max_tx = tp->HwSuppNumTxQueues; - channel->rx_count = tp->num_rx_rings; - channel->tx_count = tp->num_tx_rings; + return rc; } -#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0) */ +#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 = { @@ -7804,15 +6646,62 @@ static const struct ethtool_ops rtl8125_ethtool_ops = { .get_eee = rtl_ethtool_get_eee, .set_eee = rtl_ethtool_set_eee, #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0) */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0) - .get_channels = rtl8125_get_channels, -#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0) */ .nway_reset = rtl_nway_reset, }; #endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22) -static void rtl8125_get_mac_version(struct rtl8125_private *tp) +#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; @@ -7845,30 +6734,6 @@ static void rtl8125_get_mac_version(struct rtl8125_private *tp) tp->HwIcVerUnknown = TRUE; } - tp->efuse_ver = EFUSE_SUPPORT_V4; - break; - case 0x68000000: - if (ICVerID == 0x00000000) { - tp->mcfg = CFG_METHOD_8; - } else if (ICVerID == 0x100000) { - tp->mcfg = CFG_METHOD_9; - } else { - tp->mcfg = CFG_METHOD_9; - tp->HwIcVerUnknown = TRUE; - } - - tp->efuse_ver = EFUSE_SUPPORT_V4; - break; - case 0x68800000: - if (ICVerID == 0x00000000) { - tp->mcfg = CFG_METHOD_10; - } else if (ICVerID == 0x100000) { - tp->mcfg = CFG_METHOD_11; - } else { - tp->mcfg = CFG_METHOD_11; - tp->HwIcVerUnknown = TRUE; - } - tp->efuse_ver = EFUSE_SUPPORT_V4; break; default: @@ -7879,7 +6744,7 @@ static void rtl8125_get_mac_version(struct rtl8125_private *tp) break; } - if (pdev->device == 0x8162) { + if (pdev->subsystem_vendor == 0x8162) { if (tp->mcfg == CFG_METHOD_3) tp->mcfg = CFG_METHOD_6; else if (tp->mcfg == CFG_METHOD_5) @@ -7893,8 +6758,8 @@ 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 %s Ethernet controller mcfg = %04d\n", - MODULENAME, rtl_chip_info[i].mcfg); + dprintk("Realtek PCIe 2.5GbE Family Controller mcfg = %04d\n", + rtl_chip_info[i].mcfg); return; } } @@ -7931,14 +6796,10 @@ rtl8125_clear_phy_ups_reg(struct net_device *dev) case CFG_METHOD_4: case CFG_METHOD_5: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA466, BIT_0); + ClearEthPhyOcpBit(tp, 0xA466, BIT_0); break; }; - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA468, BIT_3 | BIT_1); + ClearEthPhyOcpBit(tp, 0xA468, BIT_3 | BIT_1); } static int @@ -7946,12 +6807,15 @@ rtl8125_is_ups_resume(struct net_device *dev) { struct rtl8125_private *tp = netdev_priv(dev); - switch (tp->mcfg) { - case CFG_METHOD_2 ... CFG_METHOD_11: + 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); - default: - return 0; - }; + + return 0; } static void @@ -7959,62 +6823,55 @@ rtl8125_clear_ups_resume_bit(struct net_device *dev) { struct rtl8125_private *tp = netdev_priv(dev); - switch (tp->mcfg) { - case CFG_METHOD_2 ... CFG_METHOD_11: - rtl8125_clear_mac_ocp_bit(tp, 0xD42C, BIT_8); - break; - default: - return; - }; -} - -static u8 -rtl8125_get_phy_state(struct rtl8125_private *tp) -{ - switch (tp->mcfg) { - case CFG_METHOD_2 ... CFG_METHOD_11: - return (rtl8125_mdio_direct_read_phy_ocp(tp, 0xA420) & 0x7); - default: - return 0xff; - }; + 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); - int i; + u16 TmpPhyState; + int i=0; - switch (tp->mcfg) { - case CFG_METHOD_2 ... CFG_METHOD_11: - for (i=0; i< 100; i++) { - if (rtl8125_get_phy_state(tp) == PhyState) - break; - else - mdelay(1); - } + 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); + WARN_ON_ONCE(i == 100); #endif - break; - default: - break; - }; } void rtl8125_enable_now_is_oob(struct rtl8125_private *tp) { - if (tp->HwSuppNowIsOobVer == 1) + 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) + if ( tp->HwSuppNowIsOobVer == 1 ) { RTL_W8(tp, MCUCmd_reg, RTL_R8(tp, MCUCmd_reg) & ~Now_is_oob); + } } static void @@ -8025,9 +6882,17 @@ rtl8125_exit_oob(struct net_device *dev) rtl8125_disable_rx_packet_filter(tp); - if (HW_DASH_SUPPORT_DASH(tp)) { - rtl8125_driver_start(tp); + 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 @@ -8044,10 +6909,6 @@ rtl8125_exit_oob(struct net_device *dev) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: rtl8125_mac_ocp_write(tp, 0xC0BC, 0x00FF); break; } @@ -8062,10 +6923,6 @@ rtl8125_exit_oob(struct net_device *dev) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: rtl8125_disable_now_is_oob(tp); data16 = rtl8125_mac_ocp_read(tp, 0xE8DE) & ~BIT_14; @@ -8073,11 +6930,7 @@ rtl8125_exit_oob(struct net_device *dev) rtl8125_wait_ll_share_fifo_ready(dev); rtl8125_mac_ocp_write(tp, 0xC0AA, 0x07D0); -#ifdef ENABLE_LIB_SUPPORT rtl8125_mac_ocp_write(tp, 0xC0A6, 0x04E2); -#else - rtl8125_mac_ocp_write(tp, 0xC0A6, 0x01B5); -#endif rtl8125_mac_ocp_write(tp, 0xC01E, 0x5555); rtl8125_wait_ll_share_fifo_ready(dev); @@ -8092,10 +6945,6 @@ rtl8125_exit_oob(struct net_device *dev) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: if (rtl8125_is_ups_resume(dev)) { rtl8125_wait_phy_ups_resume(dev, 2); rtl8125_clear_ups_resume_bit(dev); @@ -8119,11 +6968,10 @@ rtl8125_hw_disable_mac_mcu_bps(struct net_device *dev) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: - rtl8125_enable_aspm_clkreq_lock(tp, 0); + 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; } @@ -8134,10 +6982,6 @@ rtl8125_hw_disable_mac_mcu_bps(struct net_device *dev) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: rtl8125_mac_ocp_write(tp, 0xFC48, 0x0000); break; } @@ -8149,10 +6993,6 @@ rtl8125_hw_disable_mac_mcu_bps(struct net_device *dev) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: for (regAddr = 0xFC28; regAddr < 0xFC48; regAddr += 2) { rtl8125_mac_ocp_write(tp, regAddr, 0x0000); } @@ -8164,555 +7004,6 @@ rtl8125_hw_disable_mac_mcu_bps(struct net_device *dev) } } -#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, 0x003F); -} - -static void -rtl8125_set_mac_mcu_8125bp_1(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - static const u16 mcu_patch_code_8125bp_1[] = { - 0xE003, 0xE007, 0xE01A, 0x1BC8, 0x46EB, 0xC302, 0xBB00, 0x0F14, 0xC211, - 0x400A, 0xF00A, 0xC20F, 0x400A, 0xF007, 0x73A4, 0xC20C, 0x400A, 0xF102, - 0x48B0, 0x9B20, 0x1B00, 0x9BA0, 0xC602, 0xBE00, 0x4364, 0xE6E0, 0xE6E2, - 0xC01C, 0xB406, 0x1000, 0xF016, 0xC61F, 0x400E, 0xF012, 0x218E, 0x25BE, - 0x1300, 0xF007, 0x7340, 0xC618, 0x400E, 0xF102, 0x48B0, 0x8320, 0xB400, - 0x2402, 0x1000, 0xF003, 0x7342, 0x8322, 0xB000, 0xE007, 0x7322, 0x9B42, - 0x7320, 0x9B40, 0x0300, 0x0300, 0xB006, 0xC302, 0xBB00, 0x413E, 0xE6E0, - 0xC01C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x1171, 0x0B17, 0x0816, 0x1108 - }; - - rtl8125_hw_disable_mac_mcu_bps(dev); - - rtl8125_write_mac_mcu_ram_code(tp, mcu_patch_code_8125bp_1, ARRAY_SIZE(mcu_patch_code_8125bp_1)); - - rtl8125_mac_ocp_write(tp, 0xFC26, 0x8000); - - rtl8125_mac_ocp_write(tp, 0xFC28, 0x0f10); - rtl8125_mac_ocp_write(tp, 0xFC2A, 0x435c); - rtl8125_mac_ocp_write(tp, 0xFC2C, 0x4112); - - rtl8125_mac_ocp_write(tp, 0xFC48, 0x0007); -} - -static void -rtl8125_set_mac_mcu_8125bp_2(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - static const u16 mcu_patch_code_8125bp_2[] = { - 0xE010, 0xE033, 0xE046, 0xE04A, 0xE04C, 0xE04E, 0xE050, 0xE052, 0xE054, - 0xE056, 0xE058, 0xE05A, 0xE05C, 0xE05E, 0xE060, 0xE062, 0xB406, 0x1000, - 0xF016, 0xC61F, 0x400E, 0xF012, 0x218E, 0x25BE, 0x1300, 0xF007, 0x7340, - 0xC618, 0x400E, 0xF102, 0x48B0, 0x8320, 0xB400, 0x2402, 0x1000, 0xF003, - 0x7342, 0x8322, 0xB000, 0xE007, 0x7322, 0x9B42, 0x7320, 0x9B40, 0x0300, - 0x0300, 0xB006, 0xC302, 0xBB00, 0x4168, 0xE6E0, 0xC01C, 0xC211, 0x400A, - 0xF00A, 0xC20F, 0x400A, 0xF007, 0x73A4, 0xC20C, 0x400A, 0xF102, 0x48B0, - 0x9B20, 0x1B00, 0x9BA0, 0xC602, 0xBE00, 0x4392, 0xE6E0, 0xE6E2, 0xC01C, - 0x4166, 0x9CF6, 0xC002, 0xB800, 0x143C, 0xC602, 0xBE00, 0x0000, 0xC602, - 0xBE00, 0x0000, 0xC602, 0xBE00, 0x0000, 0xC602, 0xBE00, 0x0000, 0xC102, - 0xB900, 0x0000, 0xC002, 0xB800, 0x0000, 0xC602, 0xBE00, 0x0000, 0xC602, - 0xBE00, 0x0000, 0xC602, 0xBE00, 0x0000, 0xC602, 0xBE00, 0x0000, 0xC602, - 0xBE00, 0x0000, 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, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1171, - 0x0B18, 0x030D, 0x0A2A - }; - - rtl8125_hw_disable_mac_mcu_bps(dev); - - rtl8125_write_mac_mcu_ram_code(tp, mcu_patch_code_8125bp_2, ARRAY_SIZE(mcu_patch_code_8125bp_2)); - - rtl8125_mac_ocp_write(tp, 0xFC26, 0x8000); - - rtl8125_mac_ocp_write(tp, 0xFC28, 0x413C); - rtl8125_mac_ocp_write(tp, 0xFC2A, 0x438A); - rtl8125_mac_ocp_write(tp, 0xFC2C, 0x143A); - - rtl8125_mac_ocp_write(tp, 0xFC48, 0x0007); -} - -static void -rtl8125_set_mac_mcu_8125d_1(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - static const u16 mcu_patch_code_8125d_1[] = { - 0xE002, 0xE006, 0x4166, 0x9CF6, 0xC002, 0xB800, 0x14A4, 0xC102, 0xB900, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6938, - 0x0A18, 0x0217, 0x0D2A - }; - - rtl8125_hw_disable_mac_mcu_bps(dev); - - rtl8125_write_mac_mcu_ram_code(tp, mcu_patch_code_8125d_1, ARRAY_SIZE(mcu_patch_code_8125d_1)); - - rtl8125_mac_ocp_write(tp, 0xFC26, 0x8000); - - rtl8125_mac_ocp_write(tp, 0xFC28, 0x14A2); - - rtl8125_mac_ocp_write(tp, 0xFC48, 0x0001); -} - -static void -rtl8125_set_mac_mcu_8125d_2(struct net_device *dev) -{ - rtl8125_hw_disable_mac_mcu_bps(dev); -} - -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; - case CFG_METHOD_8: - rtl8125_set_mac_mcu_8125bp_1(dev); - break; - case CFG_METHOD_9: - rtl8125_set_mac_mcu_8125bp_2(dev); - break; - case CFG_METHOD_10: - rtl8125_set_mac_mcu_8125d_1(dev); - break; - case CFG_METHOD_11: - rtl8125_set_mac_mcu_8125d_2(dev); - break; - } -} -#endif - #ifdef ENABLE_USE_FIRMWARE_FILE static void rtl8125_release_firmware(struct rtl8125_private *tp) { @@ -8723,7 +7014,7 @@ static void rtl8125_release_firmware(struct rtl8125_private *tp) } } -static void rtl8125_apply_firmware(struct rtl8125_private *tp) +void rtl8125_apply_firmware(struct rtl8125_private *tp) { /* TODO: release firmware if rtl_fw_write_firmware signals failure. */ if (tp->rtl_fw) { @@ -8757,12 +7048,11 @@ rtl8125_hw_init(struct net_device *dev) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: - rtl8125_enable_aspm_clkreq_lock(tp, 0); - rtl8125_enable_force_clkreq(tp, 0); + 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; } @@ -8774,23 +7064,17 @@ rtl8125_hw_init(struct net_device *dev) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: - rtl8125_mac_ocp_write(tp, 0xD40A, rtl8125_mac_ocp_read(tp, 0xD40A) & ~(BIT_4)); + 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_6) + 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 @@ -8808,7 +7092,10 @@ rtl8125_hw_init(struct net_device *dev) rtl8125_enable_magic_packet(dev); #ifdef ENABLE_USE_FIRMWARE_FILE - if (tp->rtl_fw && !tp->resume_not_chg_speed) + if (tp->rtl_fw && + !tp->resume_not_chg_speed && + !(HW_DASH_SUPPORT_TYPE_3(tp) && + tp->HwPkgDet == 0x06)) rtl8125_apply_firmware(tp); #endif } @@ -8865,7 +7152,8 @@ rtl8125_hw_ephy_config(struct net_device *dev) ClearAndSetPCIePhyBit(tp, 0x2A, (BIT_14 | BIT_13 | BIT_12), - (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)); @@ -8875,7 +7163,8 @@ rtl8125_hw_ephy_config(struct net_device *dev) ClearAndSetPCIePhyBit(tp, 0x6A, (BIT_14 | BIT_13 | BIT_12), - (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)); @@ -8925,12 +7214,6 @@ rtl8125_hw_ephy_config(struct net_device *dev) rtl8125_ephy_write(tp, 0x42, 0x60C2); rtl8125_ephy_write(tp, 0x69, 0xFF00); break; - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: - /* nothing to do */ - break; } } @@ -8946,12 +7229,8 @@ rtl8125_get_hw_phy_mcu_code_ver(struct rtl8125_private *tp) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x801E); - hw_ram_code_ver = rtl8125_mdio_direct_read_phy_ocp(tp, 0xA438); + mdio_direct_write_phy_ocp(tp, 0xA436, 0x801E); + hw_ram_code_ver = mdio_direct_read_phy_ocp(tp, 0xA438); break; } @@ -8962,16 +7241,16 @@ 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 1; - } else { - tp->HwHasWrRamCodeToMicroP = FALSE; - return 0; } + + return ram_code_ver_match; } bool @@ -8981,17 +7260,16 @@ rtl8125_set_phy_mcu_patch_request(struct rtl8125_private *tp) u16 WaitCount; bool bSuccess = TRUE; - rtl8125_set_eth_phy_ocp_bit(tp, 0xB820, BIT_4); + SetEthPhyOcpBit(tp, 0xB820, BIT_4); WaitCount = 0; do { - gphy_val = rtl8125_mdio_direct_read_phy_ocp(tp, 0xB800); + 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 (!(gphy_val & BIT_6) && (WaitCount == 1000)) bSuccess = FALSE; if (!bSuccess) dprintk("rtl8125_set_phy_mcu_patch_request fail.\n"); @@ -9006,17 +7284,16 @@ rtl8125_clear_phy_mcu_patch_request(struct rtl8125_private *tp) u16 WaitCount; bool bSuccess = TRUE; - rtl8125_clear_eth_phy_ocp_bit(tp, 0xB820, BIT_4); + ClearEthPhyOcpBit(tp, 0xB820, BIT_4); WaitCount = 0; do { - gphy_val = rtl8125_mdio_direct_read_phy_ocp(tp, 0xB800); + 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 ((gphy_val & BIT_6) && (WaitCount == 1000)) bSuccess = FALSE; if (!bSuccess) dprintk("rtl8125_clear_phy_mcu_patch_request fail.\n"); @@ -9024,3471 +7301,146 @@ rtl8125_clear_phy_mcu_patch_request(struct rtl8125_private *tp) return bSuccess; } -#ifndef ENABLE_USE_FIRMWARE_FILE static void -rtl8125_write_hw_phy_mcu_code_ver(struct net_device *dev) +rtl8125_enable_phy_aldps(struct rtl8125_private *tp) { - 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: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x801E); - rtl8125_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; - } - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8024); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, PatchKey); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xB82E); - rtl8125_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: - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x0000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xB82E, BIT_0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8024); - rtl8125_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; - } - rtl8125_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: - rtl8125_mdio_direct_write_phy_ocp(tp, 0xBF86, 0x9000); - - rtl8125_set_eth_phy_ocp_bit(tp, 0xC402, BIT_10); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xC402, BIT_10); - - PhyRegValue = rtl8125_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); - - rtl8125_mdio_direct_write_phy_ocp(tp, 0xBD86, 0x1010); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xBD88, 0x1010); - - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xBD4E, - BIT_11 | BIT_10, - BIT_11); - rtl8125_clear_and_set_eth_phy_ocp_bit(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); - - - rtl8125_set_eth_phy_ocp_bit(tp, 0xB820, BIT_7); - - - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA016); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA012); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA014); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8013); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8021); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x802f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x803d); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8042); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8051); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8051); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa088); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0a50); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8008); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd014); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd1a3); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x401a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd707); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x40c2); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x60a6); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x5f8b); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0a86); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0a6c); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8080); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd019); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd1a2); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x401a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd707); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x40c4); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x60a6); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x5f8b); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0a86); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0a84); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd503); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8970); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c07); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0901); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd500); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xce01); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xcf09); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd705); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x4000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xceff); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xaf0a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd504); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1213); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8401); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd500); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8580); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1253); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd064); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd181); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd704); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x4018); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd504); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xc50f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd706); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x2c59); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x804d); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xc60f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xf002); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xc605); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xae02); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x10fd); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA026); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xffff); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA024); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xffff); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA022); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x10f4); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA020); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1252); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA006); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1206); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA004); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0a78); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA002); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0a60); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0a4f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA008); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x3f00); - - - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA016); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0010); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA012); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA014); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8066); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x807c); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8089); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x808e); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x80a0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x80b2); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x80c2); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd501); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xce01); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x62db); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x655c); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd73e); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x60e9); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x614a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x61ab); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0501); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0304); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0503); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0304); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0505); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0304); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0509); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0304); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x653c); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd73e); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x60e9); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x614a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x61ab); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0503); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0304); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0502); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0304); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0506); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0304); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x050a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0304); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd73e); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x60e9); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x614a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x61ab); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0505); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0304); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0506); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0304); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0504); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0304); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x050c); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0304); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd73e); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x60e9); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x614a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x61ab); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0509); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0304); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x050a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0304); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x050c); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0304); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0508); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0304); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd501); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xce01); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd73e); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x60e9); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x614a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x61ab); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0501); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0321); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0502); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0321); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0504); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0321); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0508); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0321); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0346); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd501); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xce01); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8208); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x609d); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa50f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x001a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0503); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x001a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x607d); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x00ab); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x00ab); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd501); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xce01); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x60fd); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa50f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xce00); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd500); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xaa0f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x017b); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0503); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xce00); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd500); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0a05); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x017b); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd501); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xce01); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x60fd); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa50f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xce00); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd500); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xaa0f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x01e0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0503); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xce00); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd500); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0a05); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x01e0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x60fd); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa50f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xce00); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd500); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xaa0f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0231); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0503); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xce00); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd500); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0a05); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0231); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA08E); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xffff); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA08C); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0221); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA08A); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x01ce); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA088); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0169); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA086); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x00a6); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA084); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x000d); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA082); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0308); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA080); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x029f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA090); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x007f); - - - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA016); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0020); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA012); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA014); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8017); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x801b); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8029); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8054); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x805a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8064); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x80a7); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x9430); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x9480); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xb408); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd120); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd057); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x064b); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xcb80); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x9906); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0567); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xcb94); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8190); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x82a0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x800a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8406); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa740); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8dff); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x07e4); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa840); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0773); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xcb91); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x4063); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd139); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xf002); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd140); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd040); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xb404); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d00); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x07dc); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa610); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa110); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa2a0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa404); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd704); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x4045); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa180); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd704); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x405d); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa720); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0742); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x07ec); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x5f74); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0742); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd702); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x7fb6); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8190); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x82a0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8404); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8610); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d01); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x07dc); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x064b); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x07c0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x5fa7); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0481); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x94bc); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x870c); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa190); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa00a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa280); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa404); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8220); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x078e); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xcb92); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa840); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x4063); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd140); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xf002); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd150); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd040); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd703); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x60a0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x6121); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x61a2); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x6223); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xf02f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0cf0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d10); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa740); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xf00f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0cf0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d20); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa740); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xf00a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0cf0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d30); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa740); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xf005); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0cf0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d40); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa740); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x07e4); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa610); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa008); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd704); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x4046); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa002); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd704); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x405d); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa720); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0742); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x07f7); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x5f74); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0742); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd702); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x7fb5); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x800a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0cf0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d00); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x07e4); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa740); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd701); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x3ad4); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0537); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8610); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8840); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x064b); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8301); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x800a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8190); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x82a0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8404); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa70c); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x9402); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x890c); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8840); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x064b); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA10E); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0642); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA10C); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0686); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA10A); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0788); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA108); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x047b); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA106); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x065c); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA104); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0769); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA102); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0565); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA100); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x06f9); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA110); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x00ff); - - - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xb87c); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8530); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xb87e); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xaf85); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x3caf); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8593); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xaf85); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x9caf); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x85a5); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf86); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd702); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x5afb); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xe083); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xfb0c); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x020d); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x021b); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x10bf); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x86d7); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xb7bf); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x86da); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xfbe0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x83fc); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c02); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d02); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1b10); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf86); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xda02); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf86); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xdd02); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x5afb); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xe083); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xfd0c); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x020d); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x021b); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x10bf); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x86dd); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xb7bf); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x86e0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xfbe0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x83fe); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c02); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d02); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1b10); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf86); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xe002); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xaf2f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xbd02); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x2cac); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0286); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x65af); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x212b); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x022c); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x6002); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x86b6); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xaf21); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0cd1); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x03bf); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8710); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xb7bf); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x870d); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xb7bf); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8719); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xb7bf); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8716); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xb7bf); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x871f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xb7bf); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x871c); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xb7bf); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8728); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xb7bf); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8725); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xb7bf); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8707); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xfbad); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x281c); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd100); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0a02); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1302); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x2202); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x2b02); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xae1a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd101); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0a02); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1302); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x2202); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x2b02); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd101); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x3402); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x3102); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x3d02); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x3a02); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x4302); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x4002); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x4c02); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x4902); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd100); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x2e02); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x3702); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x4602); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x4f02); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xaf35); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x7ff8); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xfaef); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x69bf); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x86e3); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xfbbf); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x86fb); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xb7bf); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x86e6); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xfbbf); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x86fe); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xb7bf); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x86e9); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xfbbf); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8701); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xb7bf); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x86ec); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xfbbf); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8704); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xb7bf); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x86ef); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0262); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x7cbf); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x86f2); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0262); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x7cbf); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x86f5); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0262); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x7cbf); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x86f8); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0262); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x7cef); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x96fe); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xfc04); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xf8fa); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xef69); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf86); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xef02); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x6273); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf86); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xf202); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x6273); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf86); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xf502); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x6273); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf86); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xf802); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x6273); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xef96); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xfefc); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0420); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xb540); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x53b5); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x4086); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xb540); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xb9b5); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x40c8); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xb03a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xc8b0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xbac8); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xb13a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xc8b1); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xba77); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xbd26); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xffbd); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x2677); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xbd28); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xffbd); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x2840); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xbd26); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xc8bd); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x2640); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xbd28); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xc8bd); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x28bb); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa430); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x98b0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1eba); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xb01e); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xdcb0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1e98); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xb09e); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xbab0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x9edc); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xb09e); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x98b1); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1eba); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xb11e); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xdcb1); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1e98); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xb19e); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xbab1); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x9edc); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xb19e); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x11b0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1e22); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xb01e); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x33b0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1e11); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xb09e); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x22b0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x9e33); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xb09e); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x11b1); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1e22); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xb11e); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x33b1); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1e11); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xb19e); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x22b1); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x9e33); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xb19e); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xb85e); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x2f71); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xb860); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x20d9); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xb862); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x2109); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xb864); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x34e7); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xb878); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x000f); - - - rtl8125_clear_eth_phy_ocp_bit(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); - - - rtl8125_set_eth_phy_ocp_bit(tp, 0xB820, BIT_7); - - - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA016); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA012); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA014); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x808b); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x808f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8093); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8097); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x809d); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x80a1); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x80aa); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd718); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x607b); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x40da); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xf00e); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x42da); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xf01e); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd718); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x615b); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1456); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x14a4); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x14bc); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd718); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x5f2e); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xf01c); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1456); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x14a4); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x14bc); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd718); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x5f2e); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xf024); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1456); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x14a4); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x14bc); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd718); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x5f2e); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xf02c); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1456); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x14a4); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x14bc); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd718); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x5f2e); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xf034); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd719); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x4118); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd504); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xac11); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd501); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xce01); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa410); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xce00); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd500); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x4779); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd504); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xac0f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xae01); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd500); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1444); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xf034); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd719); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x4118); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd504); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xac22); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd501); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xce01); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa420); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xce00); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd500); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x4559); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd504); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xac0f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xae01); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd500); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1444); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xf023); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd719); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x4118); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd504); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xac44); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd501); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xce01); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa440); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xce00); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd500); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x4339); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd504); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xac0f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xae01); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd500); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1444); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xf012); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd719); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x4118); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd504); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xac88); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd501); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xce01); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa480); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xce00); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd500); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x4119); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd504); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xac0f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xae01); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd500); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1444); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xf001); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1456); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd718); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x5fac); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xc48f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x141b); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd504); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x121a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd0b4); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd1bb); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0898); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd0b4); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd1bb); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0a0e); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd064); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd18a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0b7e); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x401c); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd501); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa804); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8804); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x053b); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd500); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa301); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0648); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xc520); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa201); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd701); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x252d); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1646); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd708); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x4006); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1646); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0308); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA026); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0307); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA024); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1645); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA022); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0647); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA020); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x053a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA006); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0b7c); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA004); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0a0c); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA002); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0896); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x11a1); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA008); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xff00); - - - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA016); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0010); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA012); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA014); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8015); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x801a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x801a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x801a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x801a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x801a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x801a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xad02); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x02d7); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x00ed); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0509); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xc100); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x008f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA08E); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xffff); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA08C); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xffff); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA08A); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xffff); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA088); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xffff); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA086); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xffff); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA084); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xffff); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA082); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x008d); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA080); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x00eb); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA090); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0103); - - - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA016); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0020); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA012); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA014); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8014); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8018); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8024); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8051); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8055); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8072); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x80dc); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xfffd); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xfffd); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8301); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x800a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8190); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x82a0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8404); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa70c); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x9402); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x890c); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8840); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa380); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x066e); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xcb91); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x4063); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd139); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xf002); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd140); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd040); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xb404); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d00); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x07e0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa610); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa110); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa2a0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa404); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd704); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x4085); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa180); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa404); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8280); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd704); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x405d); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa720); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0743); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x07f0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x5f74); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0743); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd702); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x7fb6); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8190); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x82a0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8404); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8610); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d01); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x07e0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x066e); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd158); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd04d); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x03d4); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x94bc); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x870c); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8380); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd10d); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd040); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x07c4); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x5fb4); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa190); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa00a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa280); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa404); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa220); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd130); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd040); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x07c4); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x5fb4); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xbb80); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd1c4); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd074); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa301); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd704); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x604b); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa90c); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0556); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xcb92); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x4063); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd116); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xf002); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd119); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd040); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd703); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x60a0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x6241); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x63e2); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x6583); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xf054); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd701); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x611e); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd701); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x40da); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0cf0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d10); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa010); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8740); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xf02f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0cf0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d50); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa740); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xf02a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd701); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x611e); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd701); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x40da); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0cf0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d20); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa010); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8740); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xf021); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0cf0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d60); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa740); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xf01c); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd701); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x611e); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd701); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x40da); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0cf0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d30); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa010); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8740); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xf013); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0cf0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d70); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa740); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xf00e); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd701); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x611e); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd701); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x40da); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0cf0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d40); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa010); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8740); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xf005); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0cf0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d80); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa740); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x07e8); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa610); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd704); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x405d); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa720); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ff4); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa008); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd704); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x4046); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa002); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0743); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x07fb); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd703); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x7f6f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x7f4e); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x7f2d); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x7f0c); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x800a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0cf0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d00); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x07e8); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa740); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0743); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd702); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x7fb5); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd701); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x3ad4); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0556); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8610); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x066e); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd1f5); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xd049); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x01ec); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA10E); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x01ea); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA10C); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x06a9); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA10A); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x078a); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA108); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x03d2); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA106); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x067f); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA104); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0665); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA102); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA100); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xA110); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x00fc); - - - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xb87c); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8530); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xb87e); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xaf85); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x3caf); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8545); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xaf85); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x45af); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8545); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xee82); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xf900); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0103); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xaf03); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xb7f8); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xe0a6); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x00e1); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa601); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xef01); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x58f0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa080); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x37a1); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8402); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xae16); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa185); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x02ae); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x11a1); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8702); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xae0c); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xa188); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x02ae); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x07a1); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8902); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xae02); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xae1c); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xe0b4); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x62e1); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xb463); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x6901); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xe4b4); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x62e5); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xb463); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xe0b4); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x62e1); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xb463); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x6901); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xe4b4); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x62e5); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xb463); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xfc04); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xb85e); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x03b3); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xb860); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xffff); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xb862); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xffff); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xb864); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xffff); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0xb878); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0001); - - - rtl8125_clear_eth_phy_ocp_bit(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, 0x8071, - 0xa438, 0x1800, 0xa438, 0x80b1, 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, 0xd090, - 0xa438, 0xd1c9, 0xa438, 0x1800, 0xa438, 0x1064, 0xa438, 0xd096, - 0xa438, 0xd1a9, 0xa438, 0xd503, 0xa438, 0xa104, 0xa438, 0x0c07, - 0xa438, 0x0902, 0xa438, 0xd500, 0xa438, 0xbc10, 0xa438, 0xd501, - 0xa438, 0xce01, 0xa438, 0xa201, 0xa438, 0x8201, 0xa438, 0xce00, - 0xa438, 0xd500, 0xa438, 0xc484, 0xa438, 0xd503, 0xa438, 0xcc02, - 0xa438, 0xcd0d, 0xa438, 0xaf01, 0xa438, 0xd500, 0xa438, 0xd703, - 0xa438, 0x4371, 0xa438, 0xbd08, 0xa438, 0x1000, 0xa438, 0x135c, - 0xa438, 0xd75e, 0xa438, 0x5fb3, 0xa438, 0xd503, 0xa438, 0xd0f5, - 0xa438, 0xd1c6, 0xa438, 0x0cf0, 0xa438, 0x0e50, 0xa438, 0xd704, - 0xa438, 0x401c, 0xa438, 0xd0f5, 0xa438, 0xd1c6, 0xa438, 0x0cf0, - 0xa438, 0x0ea0, 0xa438, 0x401c, 0xa438, 0xd07b, 0xa438, 0xd1c5, - 0xa438, 0x8ef0, 0xa438, 0x401c, 0xa438, 0x9d08, 0xa438, 0x1000, - 0xa438, 0x135c, 0xa438, 0xd75e, 0xa438, 0x7fb3, 0xa438, 0x1000, - 0xa438, 0x135c, 0xa438, 0xd75e, 0xa438, 0x5fad, 0xa438, 0x1000, - 0xa438, 0x14c5, 0xa438, 0xd703, 0xa438, 0x3181, 0xa438, 0x80af, - 0xa438, 0x60ad, 0xa438, 0x1000, 0xa438, 0x135c, 0xa438, 0xd703, - 0xa438, 0x5fba, 0xa438, 0x1800, 0xa438, 0x0cc7, 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, 0x1062, 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, 0x88be, 0xa438, 0xaf88, - 0xa438, 0xbeaf, 0xa438, 0x88be, 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, 0xfbee, 0xa438, 0x826a, 0xa438, 0x0002, - 0xa438, 0x88a6, 0xa438, 0xaf04, 0xa438, 0x78f8, 0xa438, 0xfaef, - 0xa438, 0x69e0, 0xa438, 0x8015, 0xa438, 0xad20, 0xa438, 0x06bf, - 0xa438, 0x88bb, 0xa438, 0x0275, 0xa438, 0xb1ef, 0xa438, 0x96fe, - 0xa438, 0xfc04, 0xa438, 0x00b8, 0xa438, 0x7a00, 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, 0x0474, 0xa436, 0xb888, 0xa438, 0xffff, 0xa436, 0xb88a, - 0xa438, 0xffff, 0xa436, 0xb88c, 0xa438, 0xffff, 0xa436, 0xb838, - 0xa438, 0x001f, 0xb820, 0x0010, 0xa436, 0x846e, 0xa438, 0xaf84, - 0xa438, 0x86af, 0xa438, 0x8690, 0xa438, 0xaf86, 0xa438, 0xa4af, - 0xa438, 0x8934, 0xa438, 0xaf89, 0xa438, 0x60af, 0xa438, 0x897e, - 0xa438, 0xaf89, 0xa438, 0xa9af, 0xa438, 0x89a9, 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, 0xa438, 0xee83, 0xa438, 0xc800, - 0xa438, 0x0286, 0xa438, 0xba02, 0xa438, 0x8728, 0xa438, 0x0287, - 0xa438, 0xbe02, 0xa438, 0x87f9, 0xa438, 0x0288, 0xa438, 0xc3af, - 0xa438, 0x4771, 0xa438, 0xf8f9, 0xa438, 0xfafb, 0xa438, 0xef69, - 0xa438, 0xfae0, 0xa438, 0x8015, 0xa438, 0xad25, 0xa438, 0x45d2, - 0xa438, 0x0002, 0xa438, 0x8714, 0xa438, 0xac4f, 0xa438, 0x02ae, - 0xa438, 0x0bef, 0xa438, 0x46f6, 0xa438, 0x273c, 0xa438, 0x0400, - 0xa438, 0xab26, 0xa438, 0xae30, 0xa438, 0xe08f, 0xa438, 0xe9e1, - 0xa438, 0x8fea, 0xa438, 0x1b46, 0xa438, 0xab26, 0xa438, 0xef32, - 0xa438, 0x0c31, 0xa438, 0xbf8f, 0xa438, 0xe91a, 0xa438, 0x93d8, - 0xa438, 0x19d9, 0xa438, 0x1b46, 0xa438, 0xab0a, 0xa438, 0x19d8, - 0xa438, 0x19d9, 0xa438, 0x1b46, 0xa438, 0xaa02, 0xa438, 0xae0c, - 0xa438, 0xbf57, 0xa438, 0x1202, 0xa438, 0x58b1, 0xa438, 0xbf57, - 0xa438, 0x1202, 0xa438, 0x58a8, 0xa438, 0xfeef, 0xa438, 0x96ff, - 0xa438, 0xfefd, 0xa438, 0xfc04, 0xa438, 0xf8fb, 0xa438, 0xef79, - 0xa438, 0xa200, 0xa438, 0x08bf, 0xa438, 0x892e, 0xa438, 0x0252, - 0xa438, 0xc8ef, 0xa438, 0x64ef, 0xa438, 0x97ff, 0xa438, 0xfc04, - 0xa438, 0xf8f9, 0xa438, 0xfafb, 0xa438, 0xef69, 0xa438, 0xfae0, - 0xa438, 0x8015, 0xa438, 0xad25, 0xa438, 0x50d2, 0xa438, 0x0002, - 0xa438, 0x878d, 0xa438, 0xac4f, 0xa438, 0x02ae, 0xa438, 0x0bef, - 0xa438, 0x46f6, 0xa438, 0x273c, 0xa438, 0x1000, 0xa438, 0xab31, - 0xa438, 0xae29, 0xa438, 0xe08f, 0xa438, 0xede1, 0xa438, 0x8fee, - 0xa438, 0x1b46, 0xa438, 0xab1f, 0xa438, 0xa200, 0xa438, 0x04ef, - 0xa438, 0x32ae, 0xa438, 0x02d3, 0xa438, 0x010c, 0xa438, 0x31bf, - 0xa438, 0x8fed, 0xa438, 0x1a93, 0xa438, 0xd819, 0xa438, 0xd91b, - 0xa438, 0x46ab, 0xa438, 0x0e19, 0xa438, 0xd819, 0xa438, 0xd91b, - 0xa438, 0x46aa, 0xa438, 0x0612, 0xa438, 0xa205, 0xa438, 0xc0ae, - 0xa438, 0x0cbf, 0xa438, 0x5712, 0xa438, 0x0258, 0xa438, 0xb1bf, - 0xa438, 0x5712, 0xa438, 0x0258, 0xa438, 0xa8fe, 0xa438, 0xef96, - 0xa438, 0xfffe, 0xa438, 0xfdfc, 0xa438, 0x04f8, 0xa438, 0xfbef, - 0xa438, 0x79a2, 0xa438, 0x0005, 0xa438, 0xbf89, 0xa438, 0x1fae, - 0xa438, 0x1ba2, 0xa438, 0x0105, 0xa438, 0xbf89, 0xa438, 0x22ae, - 0xa438, 0x13a2, 0xa438, 0x0205, 0xa438, 0xbf89, 0xa438, 0x25ae, - 0xa438, 0x0ba2, 0xa438, 0x0305, 0xa438, 0xbf89, 0xa438, 0x28ae, - 0xa438, 0x03bf, 0xa438, 0x892b, 0xa438, 0x0252, 0xa438, 0xc8ef, - 0xa438, 0x64ef, 0xa438, 0x97ff, 0xa438, 0xfc04, 0xa438, 0xf8f9, - 0xa438, 0xfaef, 0xa438, 0x69fa, 0xa438, 0xe080, 0xa438, 0x15ad, - 0xa438, 0x2628, 0xa438, 0xe081, 0xa438, 0xabe1, 0xa438, 0x81ac, - 0xa438, 0xef64, 0xa438, 0xbf57, 0xa438, 0x1802, 0xa438, 0x52c8, - 0xa438, 0x1b46, 0xa438, 0xaa0a, 0xa438, 0xbf57, 0xa438, 0x1b02, - 0xa438, 0x52c8, 0xa438, 0x1b46, 0xa438, 0xab0c, 0xa438, 0xbf57, - 0xa438, 0x1502, 0xa438, 0x58b1, 0xa438, 0xbf57, 0xa438, 0x1502, - 0xa438, 0x58a8, 0xa438, 0xfeef, 0xa438, 0x96fe, 0xa438, 0xfdfc, - 0xa438, 0x04f8, 0xa438, 0xf9ef, 0xa438, 0x59f9, 0xa438, 0xe080, - 0xa438, 0x15ad, 0xa438, 0x2622, 0xa438, 0xbf53, 0xa438, 0x2202, - 0xa438, 0x52c8, 0xa438, 0x3972, 0xa438, 0x9e10, 0xa438, 0xe083, - 0xa438, 0xc9ac, 0xa438, 0x2605, 0xa438, 0x0288, 0xa438, 0x2cae, - 0xa438, 0x0d02, 0xa438, 0x8870, 0xa438, 0xae08, 0xa438, 0xe283, - 0xa438, 0xc9f6, 0xa438, 0x36e6, 0xa438, 0x83c9, 0xa438, 0xfdef, - 0xa438, 0x95fd, 0xa438, 0xfc04, 0xa438, 0xf8f9, 0xa438, 0xfafb, - 0xa438, 0xef79, 0xa438, 0xfbbf, 0xa438, 0x5718, 0xa438, 0x0252, - 0xa438, 0xc8ef, 0xa438, 0x64e2, 0xa438, 0x8fe5, 0xa438, 0xe38f, - 0xa438, 0xe61b, 0xa438, 0x659e, 0xa438, 0x10e4, 0xa438, 0x8fe5, - 0xa438, 0xe58f, 0xa438, 0xe6e2, 0xa438, 0x83c9, 0xa438, 0xf636, - 0xa438, 0xe683, 0xa438, 0xc9ae, 0xa438, 0x13e2, 0xa438, 0x83c9, - 0xa438, 0xf736, 0xa438, 0xe683, 0xa438, 0xc902, 0xa438, 0x5820, - 0xa438, 0xef57, 0xa438, 0xe68f, 0xa438, 0xe7e7, 0xa438, 0x8fe8, - 0xa438, 0xffef, 0xa438, 0x97ff, 0xa438, 0xfefd, 0xa438, 0xfc04, - 0xa438, 0xf8f9, 0xa438, 0xfafb, 0xa438, 0xef79, 0xa438, 0xfbe2, - 0xa438, 0x8fe7, 0xa438, 0xe38f, 0xa438, 0xe8ef, 0xa438, 0x65e2, - 0xa438, 0x81b8, 0xa438, 0xe381, 0xa438, 0xb9ef, 0xa438, 0x7502, - 0xa438, 0x583b, 0xa438, 0xac50, 0xa438, 0x1abf, 0xa438, 0x5718, - 0xa438, 0x0252, 0xa438, 0xc8ef, 0xa438, 0x64e2, 0xa438, 0x8fe5, - 0xa438, 0xe38f, 0xa438, 0xe61b, 0xa438, 0x659e, 0xa438, 0x1ce4, - 0xa438, 0x8fe5, 0xa438, 0xe58f, 0xa438, 0xe6ae, 0xa438, 0x0cbf, - 0xa438, 0x5715, 0xa438, 0x0258, 0xa438, 0xb1bf, 0xa438, 0x5715, - 0xa438, 0x0258, 0xa438, 0xa8e2, 0xa438, 0x83c9, 0xa438, 0xf636, - 0xa438, 0xe683, 0xa438, 0xc9ff, 0xa438, 0xef97, 0xa438, 0xfffe, - 0xa438, 0xfdfc, 0xa438, 0x04f8, 0xa438, 0xf9fa, 0xa438, 0xef69, - 0xa438, 0xe080, 0xa438, 0x15ad, 0xa438, 0x264b, 0xa438, 0xbf53, - 0xa438, 0xca02, 0xa438, 0x52c8, 0xa438, 0xad28, 0xa438, 0x42bf, - 0xa438, 0x8931, 0xa438, 0x0252, 0xa438, 0xc8ef, 0xa438, 0x54bf, - 0xa438, 0x576c, 0xa438, 0x0252, 0xa438, 0xc8a1, 0xa438, 0x001b, - 0xa438, 0xbf53, 0xa438, 0x4c02, 0xa438, 0x52c8, 0xa438, 0xac29, - 0xa438, 0x0dac, 0xa438, 0x2805, 0xa438, 0xa302, 0xa438, 0x16ae, - 0xa438, 0x20a3, 0xa438, 0x0311, 0xa438, 0xae1b, 0xa438, 0xa304, - 0xa438, 0x0cae, 0xa438, 0x16a3, 0xa438, 0x0802, 0xa438, 0xae11, - 0xa438, 0xa309, 0xa438, 0x02ae, 0xa438, 0x0cbf, 0xa438, 0x5715, - 0xa438, 0x0258, 0xa438, 0xb1bf, 0xa438, 0x5715, 0xa438, 0x0258, - 0xa438, 0xa8ef, 0xa438, 0x96fe, 0xa438, 0xfdfc, 0xa438, 0x04f0, - 0xa438, 0xa300, 0xa438, 0xf0a3, 0xa438, 0x02f0, 0xa438, 0xa304, - 0xa438, 0xf0a3, 0xa438, 0x06f0, 0xa438, 0xa308, 0xa438, 0xf0a2, - 0xa438, 0x8074, 0xa438, 0xa600, 0xa438, 0xac4f, 0xa438, 0x02ae, - 0xa438, 0x0bef, 0xa438, 0x46f6, 0xa438, 0x273c, 0xa438, 0x1000, - 0xa438, 0xab1b, 0xa438, 0xae16, 0xa438, 0xe081, 0xa438, 0xabe1, - 0xa438, 0x81ac, 0xa438, 0x1b46, 0xa438, 0xab0c, 0xa438, 0xac32, - 0xa438, 0x04ef, 0xa438, 0x32ae, 0xa438, 0x02d3, 0xa438, 0x04af, - 0xa438, 0x486c, 0xa438, 0xaf48, 0xa438, 0x82af, 0xa438, 0x4888, - 0xa438, 0xe081, 0xa438, 0x9be1, 0xa438, 0x819c, 0xa438, 0xe28f, - 0xa438, 0xe3ad, 0xa438, 0x3009, 0xa438, 0x1f55, 0xa438, 0xe38f, - 0xa438, 0xe20c, 0xa438, 0x581a, 0xa438, 0x45e4, 0xa438, 0x83a6, - 0xa438, 0xe583, 0xa438, 0xa7af, 0xa438, 0x2a75, 0xa438, 0xe08f, - 0xa438, 0xe3ad, 0xa438, 0x201c, 0xa438, 0x1f44, 0xa438, 0xe18f, - 0xa438, 0xe10c, 0xa438, 0x44ef, 0xa438, 0x64e0, 0xa438, 0x8232, - 0xa438, 0xe182, 0xa438, 0x331b, 0xa438, 0x649f, 0xa438, 0x091f, - 0xa438, 0x44e1, 0xa438, 0x8fe2, 0xa438, 0x0c48, 0xa438, 0x1b54, - 0xa438, 0xe683, 0xa438, 0xa6e7, 0xa438, 0x83a7, 0xa438, 0xaf2b, - 0xa438, 0xd900, 0xa436, 0xb818, 0xa438, 0x043d, 0xa436, 0xb81a, - 0xa438, 0x06a3, 0xa436, 0xb81c, 0xa438, 0x476d, 0xa436, 0xb81e, - 0xa438, 0x4852, 0xa436, 0xb850, 0xa438, 0x2A69, 0xa436, 0xb852, - 0xa438, 0x2BD3, 0xa436, 0xb878, 0xa438, 0xffff, 0xa436, 0xb884, - 0xa438, 0xffff, 0xa436, 0xb832, 0xa438, 0x003f, 0xb844, 0xffff, - 0xa436, 0x8fe9, 0xa438, 0x0000, 0xa436, 0x8feb, 0xa438, 0x02fe, - 0xa436, 0x8fed, 0xa438, 0x0019, 0xa436, 0x8fef, 0xa438, 0x0bdb, - 0xa436, 0x8ff1, 0xa438, 0x0ca4, 0xa436, 0x0000, 0xa438, 0x0000, - 0xa436, 0xB82E, 0xa438, 0x0000, 0xa436, 0x8024, 0xa438, 0x0000, - 0xa436, 0x801E, 0xa438, 0x0024, 0xb820, 0x0000, 0xFFFF, 0xFFFF -}; - -static const u16 phy_mcu_ram_code_8125d_1_1[] = { - 0xa436, 0x8023, 0xa438, 0x3800, 0xa436, 0xB82E, 0xa438, 0x0001, - 0xb820, 0x0090, 0xa436, 0xA016, 0xa438, 0x0000, 0xa436, 0xA012, - 0xa438, 0x0000, 0xa436, 0xA014, 0xa438, 0x1800, 0xa438, 0x8010, - 0xa438, 0x1800, 0xa438, 0x8018, 0xa438, 0x1800, 0xa438, 0x8021, - 0xa438, 0x1800, 0xa438, 0x8029, 0xa438, 0x1800, 0xa438, 0x8031, - 0xa438, 0x1800, 0xa438, 0x8035, 0xa438, 0x1800, 0xa438, 0x8035, - 0xa438, 0x1800, 0xa438, 0x8035, 0xa438, 0xd711, 0xa438, 0x6081, - 0xa438, 0x8904, 0xa438, 0x1800, 0xa438, 0x2021, 0xa438, 0xa904, - 0xa438, 0x1800, 0xa438, 0x2021, 0xa438, 0xd75f, 0xa438, 0x4083, - 0xa438, 0xd503, 0xa438, 0xa908, 0xa438, 0x87f0, 0xa438, 0x1000, - 0xa438, 0x17e0, 0xa438, 0x1800, 0xa438, 0x13c3, 0xa438, 0xd707, - 0xa438, 0x2005, 0xa438, 0x8027, 0xa438, 0xd75e, 0xa438, 0x1800, - 0xa438, 0x1434, 0xa438, 0x1800, 0xa438, 0x14a5, 0xa438, 0xc504, - 0xa438, 0xce20, 0xa438, 0xcf01, 0xa438, 0xd70a, 0xa438, 0x4005, - 0xa438, 0xcf02, 0xa438, 0x1800, 0xa438, 0x1c50, 0xa438, 0xa980, - 0xa438, 0xd500, 0xa438, 0x1800, 0xa438, 0x14f3, 0xa436, 0xA026, - 0xa438, 0xffff, 0xa436, 0xA024, 0xa438, 0xffff, 0xa436, 0xA022, - 0xa438, 0xffff, 0xa436, 0xA020, 0xa438, 0x14f2, 0xa436, 0xA006, - 0xa438, 0x1c4f, 0xa436, 0xA004, 0xa438, 0x1433, 0xa436, 0xA002, - 0xa438, 0x13c1, 0xa436, 0xA000, 0xa438, 0x2020, 0xa436, 0xA008, - 0xa438, 0x1f00, 0xa436, 0xA016, 0xa438, 0x0000, 0xa436, 0xA012, - 0xa438, 0x07f8, 0xa436, 0xA014, 0xa438, 0xd04d, 0xa438, 0x8904, - 0xa438, 0x813C, 0xa438, 0xA13D, 0xa438, 0xcc01, 0xa438, 0x0000, - 0xa438, 0x0000, 0xa438, 0x0000, 0xa436, 0xA152, 0xa438, 0x1384, - 0xa436, 0xA154, 0xa438, 0x1fa8, 0xa436, 0xA156, 0xa438, 0x218B, - 0xa436, 0xA158, 0xa438, 0x21B8, 0xa436, 0xA15A, 0xa438, 0x021c, - 0xa436, 0xA15C, 0xa438, 0x3fff, 0xa436, 0xA15E, 0xa438, 0x3fff, - 0xa436, 0xA160, 0xa438, 0x3fff, 0xa436, 0xA150, 0xa438, 0x001f, - 0xa436, 0xA016, 0xa438, 0x0020, 0xa436, 0xA012, 0xa438, 0x1ff8, - 0xa436, 0xA014, 0xa438, 0x001c, 0xa438, 0xce15, 0xa438, 0xd105, - 0xa438, 0xa410, 0xa438, 0x8320, 0xa438, 0xFFD7, 0xa438, 0x0000, - 0xa438, 0x0000, 0xa436, 0xA164, 0xa438, 0x0260, 0xa436, 0xA166, - 0xa438, 0x0add, 0xa436, 0xA168, 0xa438, 0x05CC, 0xa436, 0xA16A, - 0xa438, 0x05C5, 0xa436, 0xA16C, 0xa438, 0x0429, 0xa436, 0xA16E, - 0xa438, 0x07B6, 0xa436, 0xA170, 0xa438, 0x0259, 0xa436, 0xA172, - 0xa438, 0x3fff, 0xa436, 0xA162, 0xa438, 0x003f, 0xa436, 0xA016, - 0xa438, 0x0020, 0xa436, 0xA012, 0xa438, 0x0000, 0xa436, 0xA014, - 0xa438, 0x1800, 0xa438, 0x8010, 0xa438, 0x1800, 0xa438, 0x8023, - 0xa438, 0x1800, 0xa438, 0x80e6, 0xa438, 0x1800, 0xa438, 0x80f0, - 0xa438, 0x1800, 0xa438, 0x80f8, 0xa438, 0x1800, 0xa438, 0x816c, - 0xa438, 0x1800, 0xa438, 0x817d, 0xa438, 0x1800, 0xa438, 0x818b, - 0xa438, 0xa801, 0xa438, 0x9308, 0xa438, 0xb201, 0xa438, 0xb301, - 0xa438, 0xd701, 0xa438, 0x4000, 0xa438, 0xd2ff, 0xa438, 0xb302, - 0xa438, 0xd200, 0xa438, 0xb201, 0xa438, 0xb309, 0xa438, 0xd701, - 0xa438, 0x4000, 0xa438, 0xd2ff, 0xa438, 0xb302, 0xa438, 0xd200, - 0xa438, 0xa800, 0xa438, 0x1800, 0xa438, 0x0031, 0xa438, 0xd700, - 0xa438, 0x4543, 0xa438, 0xd71f, 0xa438, 0x40fe, 0xa438, 0xd1b7, - 0xa438, 0xd049, 0xa438, 0x1000, 0xa438, 0x109e, 0xa438, 0xd700, - 0xa438, 0x5fbb, 0xa438, 0xa220, 0xa438, 0x8501, 0xa438, 0x0c03, - 0xa438, 0x1502, 0xa438, 0x0c70, 0xa438, 0x0b00, 0xa438, 0x0c07, - 0xa438, 0x0604, 0xa438, 0x9503, 0xa438, 0xa510, 0xa438, 0xce49, - 0xa438, 0x1000, 0xa438, 0x10be, 0xa438, 0x8520, 0xa438, 0xa520, - 0xa438, 0xa501, 0xa438, 0xd105, 0xa438, 0xd047, 0xa438, 0x1000, - 0xa438, 0x109e, 0xa438, 0xd707, 0xa438, 0x6087, 0xa438, 0xd700, - 0xa438, 0x5f7b, 0xa438, 0xffe9, 0xa438, 0x1000, 0xa438, 0x109e, - 0xa438, 0x8501, 0xa438, 0xd707, 0xa438, 0x5e08, 0xa438, 0x8530, - 0xa438, 0xba20, 0xa438, 0xf00c, 0xa438, 0xd700, 0xa438, 0x4098, - 0xa438, 0xd1ef, 0xa438, 0xd047, 0xa438, 0xf003, 0xa438, 0xd1db, - 0xa438, 0xd040, 0xa438, 0x1000, 0xa438, 0x109e, 0xa438, 0xd700, - 0xa438, 0x5fbb, 0xa438, 0x8980, 0xa438, 0xd704, 0xa438, 0x40a3, - 0xa438, 0xd702, 0xa438, 0x4060, 0xa438, 0x8410, 0xa438, 0xf002, - 0xa438, 0xa410, 0xa438, 0xce02, 0xa438, 0x1000, 0xa438, 0x10be, - 0xa438, 0xcd81, 0xa438, 0xd412, 0xa438, 0x1000, 0xa438, 0x1069, - 0xa438, 0xcd82, 0xa438, 0xd40e, 0xa438, 0x1000, 0xa438, 0x1069, - 0xa438, 0xcd83, 0xa438, 0x1000, 0xa438, 0x109e, 0xa438, 0xd71f, - 0xa438, 0x5fb4, 0xa438, 0xa00a, 0xa438, 0xa340, 0xa438, 0x0c06, - 0xa438, 0x0102, 0xa438, 0xa240, 0xa438, 0xa290, 0xa438, 0xa324, - 0xa438, 0xab02, 0xa438, 0xd13e, 0xa438, 0xd05a, 0xa438, 0xd13e, - 0xa438, 0xd06b, 0xa438, 0xcd84, 0xa438, 0x1000, 0xa438, 0x109e, - 0xa438, 0xd706, 0xa438, 0x6079, 0xa438, 0xd700, 0xa438, 0x5f5c, - 0xa438, 0xcd8a, 0xa438, 0x1000, 0xa438, 0x109e, 0xa438, 0xd706, - 0xa438, 0x6079, 0xa438, 0xd700, 0xa438, 0x5f5d, 0xa438, 0xcd8b, - 0xa438, 0x1000, 0xa438, 0x109e, 0xa438, 0xcd8c, 0xa438, 0xd700, - 0xa438, 0x6050, 0xa438, 0xab04, 0xa438, 0xd700, 0xa438, 0x4083, - 0xa438, 0xd160, 0xa438, 0xd04b, 0xa438, 0xf003, 0xa438, 0xd193, - 0xa438, 0xd047, 0xa438, 0x1000, 0xa438, 0x109e, 0xa438, 0xd700, - 0xa438, 0x5fbb, 0xa438, 0x1000, 0xa438, 0x109e, 0xa438, 0x8410, - 0xa438, 0xd71f, 0xa438, 0x5f94, 0xa438, 0xb920, 0xa438, 0x1000, - 0xa438, 0x109e, 0xa438, 0xd71f, 0xa438, 0x7fb4, 0xa438, 0x9920, - 0xa438, 0x1000, 0xa438, 0x109e, 0xa438, 0xd71f, 0xa438, 0x6105, - 0xa438, 0x6054, 0xa438, 0xfffb, 0xa438, 0x1000, 0xa438, 0x109e, - 0xa438, 0xd706, 0xa438, 0x5fb9, 0xa438, 0xfff0, 0xa438, 0xa410, - 0xa438, 0xb820, 0xa438, 0xcd85, 0xa438, 0x1000, 0xa438, 0x109e, - 0xa438, 0xd71f, 0xa438, 0x7fa5, 0xa438, 0x9820, 0xa438, 0xbb20, - 0xa438, 0xd105, 0xa438, 0xd042, 0xa438, 0x1000, 0xa438, 0x109e, - 0xa438, 0xd706, 0xa438, 0x5fbb, 0xa438, 0x5f85, 0xa438, 0xd700, - 0xa438, 0x5f5b, 0xa438, 0xd700, 0xa438, 0x6090, 0xa438, 0xd700, - 0xa438, 0x4043, 0xa438, 0xaa20, 0xa438, 0xcd86, 0xa438, 0xd700, - 0xa438, 0x6083, 0xa438, 0xd1c7, 0xa438, 0xd045, 0xa438, 0xf003, - 0xa438, 0xd17a, 0xa438, 0xd04b, 0xa438, 0x1000, 0xa438, 0x109e, - 0xa438, 0xd700, 0xa438, 0x5fbb, 0xa438, 0x0c18, 0xa438, 0x0108, - 0xa438, 0x0c3f, 0xa438, 0x0609, 0xa438, 0x0cfb, 0xa438, 0x0729, - 0xa438, 0xa308, 0xa438, 0x8320, 0xa438, 0xd105, 0xa438, 0xd042, - 0xa438, 0x1000, 0xa438, 0x109e, 0xa438, 0xd700, 0xa438, 0x5fbb, - 0xa438, 0x1800, 0xa438, 0x08f7, 0xa438, 0x1000, 0xa438, 0x109e, - 0xa438, 0x1000, 0xa438, 0x10a3, 0xa438, 0xd700, 0xa438, 0x607b, - 0xa438, 0xd700, 0xa438, 0x5f2b, 0xa438, 0x1800, 0xa438, 0x0a81, - 0xa438, 0xd700, 0xa438, 0x40bd, 0xa438, 0xd707, 0xa438, 0x4065, - 0xa438, 0x1800, 0xa438, 0x1121, 0xa438, 0x1800, 0xa438, 0x1124, - 0xa438, 0xd705, 0xa438, 0x627d, 0xa438, 0xd704, 0xa438, 0x6192, - 0xa438, 0xa00a, 0xa438, 0xd704, 0xa438, 0x41c7, 0xa438, 0xd700, - 0xa438, 0x3691, 0xa438, 0x810c, 0xa438, 0x0c03, 0xa438, 0x1502, - 0xa438, 0xa570, 0xa438, 0x9503, 0xa438, 0xf006, 0xa438, 0x800a, - 0xa438, 0x0c03, 0xa438, 0x1502, 0xa438, 0x8570, 0xa438, 0x9503, - 0xa438, 0x1000, 0xa438, 0x109e, 0xa438, 0x1000, 0xa438, 0x1108, - 0xa438, 0xcd64, 0xa438, 0xd704, 0xa438, 0x3398, 0xa438, 0x8166, - 0xa438, 0xd71f, 0xa438, 0x620e, 0xa438, 0xd704, 0xa438, 0x6096, - 0xa438, 0xd705, 0xa438, 0x6051, 0xa438, 0xf004, 0xa438, 0xd705, - 0xa438, 0x605d, 0xa438, 0xf008, 0xa438, 0xd706, 0xa438, 0x609d, - 0xa438, 0xd705, 0xa438, 0x405f, 0xa438, 0xf003, 0xa438, 0xd700, - 0xa438, 0x5a9b, 0xa438, 0x0c03, 0xa438, 0x1502, 0xa438, 0xc7aa, - 0xa438, 0x9503, 0xa438, 0xd71f, 0xa438, 0x674e, 0xa438, 0xd704, - 0xa438, 0x6096, 0xa438, 0xd705, 0xa438, 0x6051, 0xa438, 0xf005, - 0xa438, 0xd705, 0xa438, 0x607d, 0xa438, 0x1800, 0xa438, 0x0cc7, - 0xa438, 0xd706, 0xa438, 0x60bd, 0xa438, 0xd705, 0xa438, 0x407f, - 0xa438, 0x1800, 0xa438, 0x0e42, 0xa438, 0xce04, 0xa438, 0x1000, - 0xa438, 0x10be, 0xa438, 0xd702, 0xa438, 0x40a4, 0xa438, 0x0c03, - 0xa438, 0x1502, 0xa438, 0x8e20, 0xa438, 0x9503, 0xa438, 0xd702, - 0xa438, 0x40a5, 0xa438, 0x0c03, 0xa438, 0x1502, 0xa438, 0x8e40, - 0xa438, 0x9503, 0xa438, 0x1000, 0xa438, 0x11a4, 0xa438, 0x1000, - 0xa438, 0x109e, 0xa438, 0x1000, 0xa438, 0x1108, 0xa438, 0xcd61, - 0xa438, 0xd704, 0xa438, 0x3398, 0xa438, 0x8166, 0xa438, 0xd704, - 0xa438, 0x6096, 0xa438, 0xd705, 0xa438, 0x6051, 0xa438, 0xf005, - 0xa438, 0xd705, 0xa438, 0x607d, 0xa438, 0x1800, 0xa438, 0x0cc7, - 0xa438, 0xd71f, 0xa438, 0x60ee, 0xa438, 0xd706, 0xa438, 0x7bdd, - 0xa438, 0xd705, 0xa438, 0x5b9f, 0xa438, 0x1800, 0xa438, 0x0e42, - 0xa438, 0x1800, 0xa438, 0x0b5f, 0xa438, 0x0c03, 0xa438, 0x1502, - 0xa438, 0xae40, 0xa438, 0x9503, 0xa438, 0x1800, 0xa438, 0x0c47, - 0xa438, 0x607c, 0xa438, 0x1800, 0xa438, 0x027a, 0xa438, 0x0c03, - 0xa438, 0x1502, 0xa438, 0xae01, 0xa438, 0x9503, 0xa438, 0x1000, - 0xa438, 0x109e, 0xa438, 0xd702, 0xa438, 0x5fa3, 0xa438, 0x0c03, - 0xa438, 0x1502, 0xa438, 0x8e01, 0xa438, 0x9503, 0xa438, 0x1800, - 0xa438, 0x027d, 0xa438, 0x1000, 0xa438, 0x10be, 0xa438, 0xd702, - 0xa438, 0x40a5, 0xa438, 0x0c03, 0xa438, 0x1502, 0xa438, 0x8e40, - 0xa438, 0x9503, 0xa438, 0xd73e, 0xa438, 0x6065, 0xa438, 0x1800, - 0xa438, 0x0cea, 0xa438, 0x1800, 0xa438, 0x0cf4, 0xa438, 0xa290, - 0xa438, 0xa304, 0xa438, 0xab02, 0xa438, 0xd700, 0xa438, 0x6050, - 0xa438, 0xab04, 0xa438, 0x0c38, 0xa438, 0x0608, 0xa438, 0xaa0b, - 0xa438, 0x0c03, 0xa438, 0x1502, 0xa438, 0x8d01, 0xa438, 0x0c03, - 0xa438, 0x1502, 0xa438, 0xae40, 0xa438, 0x9503, 0xa438, 0xd702, - 0xa438, 0x40a4, 0xa438, 0x0c03, 0xa438, 0x1502, 0xa438, 0x8e20, - 0xa438, 0x9503, 0xa438, 0xd700, 0xa438, 0x6078, 0xa438, 0xd700, - 0xa438, 0x609a, 0xa438, 0xd109, 0xa438, 0xd074, 0xa438, 0xf003, - 0xa438, 0xd109, 0xa438, 0xd075, 0xa438, 0xd704, 0xa438, 0x6192, - 0xa438, 0xa00a, 0xa438, 0xd704, 0xa438, 0x41c7, 0xa438, 0xd700, - 0xa438, 0x3691, 0xa438, 0x81bc, 0xa438, 0x0c03, 0xa438, 0x1502, - 0xa438, 0xa570, 0xa438, 0x9503, 0xa438, 0xf006, 0xa438, 0x800a, - 0xa438, 0x0c03, 0xa438, 0x1502, 0xa438, 0x8570, 0xa438, 0x9503, - 0xa438, 0x1000, 0xa438, 0x109e, 0xa438, 0xd704, 0xa438, 0x60f3, - 0xa438, 0xd71f, 0xa438, 0x60ee, 0xa438, 0xd700, 0xa438, 0x5cfe, - 0xa438, 0x1800, 0xa438, 0x0deb, 0xa438, 0x1800, 0xa438, 0x0c47, - 0xa438, 0x1800, 0xa438, 0x0df8, 0xa436, 0xA10E, 0xa438, 0x0dc5, - 0xa436, 0xA10C, 0xa438, 0x0ce8, 0xa436, 0xA10A, 0xa438, 0x0279, - 0xa436, 0xA108, 0xa438, 0x0b19, 0xa436, 0xA106, 0xa438, 0x111f, - 0xa436, 0xA104, 0xa438, 0x0a7b, 0xa436, 0xA102, 0xa438, 0x0ba3, - 0xa436, 0xA100, 0xa438, 0x0022, 0xa436, 0xA110, 0xa438, 0x00ff, - 0xa436, 0xb87c, 0xa438, 0x859b, 0xa436, 0xb87e, 0xa438, 0xaf85, - 0xa438, 0xb3af, 0xa438, 0x863b, 0xa438, 0xaf86, 0xa438, 0x4caf, - 0xa438, 0x8688, 0xa438, 0xaf86, 0xa438, 0xceaf, 0xa438, 0x8744, - 0xa438, 0xaf87, 0xa438, 0x68af, 0xa438, 0x8781, 0xa438, 0xbf5e, - 0xa438, 0x7202, 0xa438, 0x5f7e, 0xa438, 0xac28, 0xa438, 0x68e1, - 0xa438, 0x84e6, 0xa438, 0xad28, 0xa438, 0x09bf, 0xa438, 0x5e75, - 0xa438, 0x025f, 0xa438, 0x7eac, 0xa438, 0x2d59, 0xa438, 0xe18f, - 0xa438, 0xebad, 0xa438, 0x2809, 0xa438, 0xbf5e, 0xa438, 0x7502, - 0xa438, 0x5f7e, 0xa438, 0xac2e, 0xa438, 0x50e1, 0xa438, 0x84e6, - 0xa438, 0xac28, 0xa438, 0x08bf, 0xa438, 0x873e, 0xa438, 0x025f, - 0xa438, 0x3cae, 0xa438, 0x06bf, 0xa438, 0x873e, 0xa438, 0x025f, - 0xa438, 0x33bf, 0xa438, 0x8741, 0xa438, 0x025f, 0xa438, 0x33ee, - 0xa438, 0x8fea, 0xa438, 0x02e1, 0xa438, 0x84e4, 0xa438, 0xad28, - 0xa438, 0x14e1, 0xa438, 0x8fe8, 0xa438, 0xad28, 0xa438, 0x17e1, - 0xa438, 0x84e5, 0xa438, 0x11e5, 0xa438, 0x84e5, 0xa438, 0xa10c, - 0xa438, 0x04ee, 0xa438, 0x84e5, 0xa438, 0x0002, 0xa438, 0x4977, - 0xa438, 0xee84, 0xa438, 0xdc03, 0xa438, 0xae1d, 0xa438, 0xe18f, - 0xa438, 0xe811, 0xa438, 0xe58f, 0xa438, 0xe8ae, 0xa438, 0x14bf, - 0xa438, 0x873e, 0xa438, 0x025f, 0xa438, 0x3cbf, 0xa438, 0x8741, - 0xa438, 0x025f, 0xa438, 0x3cee, 0xa438, 0x8fea, 0xa438, 0x01ee, - 0xa438, 0x84e4, 0xa438, 0x00af, 0xa438, 0x50c1, 0xa438, 0x1f00, - 0xa438, 0xbf5a, 0xa438, 0x6102, 0xa438, 0x5f5f, 0xa438, 0xbf5a, - 0xa438, 0x5e02, 0xa438, 0x5f3c, 0xa438, 0xaf45, 0xa438, 0x7be0, - 0xa438, 0x8012, 0xa438, 0xad23, 0xa438, 0x141f, 0xa438, 0x001f, - 0xa438, 0x22d1, 0xa438, 0x00bf, 0xa438, 0x3fcf, 0xa438, 0x0261, - 0xa438, 0x3412, 0xa438, 0xa204, 0xa438, 0xf6ee, 0xa438, 0x8317, - 0xa438, 0x00e0, 0xa438, 0x8012, 0xa438, 0xad24, 0xa438, 0x141f, - 0xa438, 0x001f, 0xa438, 0x22d1, 0xa438, 0x00bf, 0xa438, 0x3fd7, - 0xa438, 0x0261, 0xa438, 0x3412, 0xa438, 0xa204, 0xa438, 0xf6ee, - 0xa438, 0x8317, 0xa438, 0x00ef, 0xa438, 0x96fe, 0xa438, 0xfdfc, - 0xa438, 0xaf42, 0xa438, 0x9802, 0xa438, 0x56ec, 0xa438, 0xf70b, - 0xa438, 0xac13, 0xa438, 0x0fbf, 0xa438, 0x5e75, 0xa438, 0x025f, - 0xa438, 0x7eac, 0xa438, 0x280c, 0xa438, 0xe2ff, 0xa438, 0xcfad, - 0xa438, 0x32ee, 0xa438, 0x0257, 0xa438, 0x05af, 0xa438, 0x00a4, - 0xa438, 0x0286, 0xa438, 0xaaae, 0xa438, 0xeff8, 0xa438, 0xf9ef, - 0xa438, 0x5902, 0xa438, 0x1fe1, 0xa438, 0xbf59, 0xa438, 0x4d02, - 0xa438, 0x5f3c, 0xa438, 0xac13, 0xa438, 0x09bf, 0xa438, 0x5e75, - 0xa438, 0x025f, 0xa438, 0x7ea1, 0xa438, 0x00f4, 0xa438, 0xbf59, - 0xa438, 0x4d02, 0xa438, 0x5f33, 0xa438, 0xef95, 0xa438, 0xfdfc, - 0xa438, 0x04bf, 0xa438, 0x5e72, 0xa438, 0x025f, 0xa438, 0x7eac, - 0xa438, 0x284a, 0xa438, 0xe184, 0xa438, 0xe6ad, 0xa438, 0x2809, - 0xa438, 0xbf5e, 0xa438, 0x7502, 0xa438, 0x5f7e, 0xa438, 0xac2d, - 0xa438, 0x3be1, 0xa438, 0x8feb, 0xa438, 0xad28, 0xa438, 0x09bf, - 0xa438, 0x5e75, 0xa438, 0x025f, 0xa438, 0x7eac, 0xa438, 0x2e32, - 0xa438, 0xe184, 0xa438, 0xe6ac, 0xa438, 0x2808, 0xa438, 0xbf87, - 0xa438, 0x3e02, 0xa438, 0x5f3c, 0xa438, 0xae06, 0xa438, 0xbf87, - 0xa438, 0x3e02, 0xa438, 0x5f33, 0xa438, 0xbf87, 0xa438, 0x4102, - 0xa438, 0x5f33, 0xa438, 0xee8f, 0xa438, 0xea04, 0xa438, 0xbf5e, - 0xa438, 0x4e02, 0xa438, 0x5f7e, 0xa438, 0xad28, 0xa438, 0x1f02, - 0xa438, 0x4b12, 0xa438, 0xae1a, 0xa438, 0xbf87, 0xa438, 0x3e02, - 0xa438, 0x5f3c, 0xa438, 0xbf87, 0xa438, 0x4102, 0xa438, 0x5f3c, - 0xa438, 0xee8f, 0xa438, 0xea03, 0xa438, 0xbf5e, 0xa438, 0x2a02, - 0xa438, 0x5f33, 0xa438, 0xee84, 0xa438, 0xe701, 0xa438, 0xaf4a, - 0xa438, 0x7444, 0xa438, 0xac0e, 0xa438, 0x55ac, 0xa438, 0x0ebf, - 0xa438, 0x5e75, 0xa438, 0x025f, 0xa438, 0x7ead, 0xa438, 0x2d0b, - 0xa438, 0xbf5e, 0xa438, 0x36e1, 0xa438, 0x8fe9, 0xa438, 0x025f, - 0xa438, 0x5fae, 0xa438, 0x09bf, 0xa438, 0x5e36, 0xa438, 0xe184, - 0xa438, 0xe102, 0xa438, 0x5f5f, 0xa438, 0xee8f, 0xa438, 0xe800, - 0xa438, 0xaf49, 0xa438, 0xcdbf, 0xa438, 0x595c, 0xa438, 0x025f, - 0xa438, 0x7ea1, 0xa438, 0x0203, 0xa438, 0xaf87, 0xa438, 0x79d1, - 0xa438, 0x00af, 0xa438, 0x877c, 0xa438, 0xe181, 0xa438, 0x941f, - 0xa438, 0x00af, 0xa438, 0x3ff7, 0xa438, 0xac4e, 0xa438, 0x06ac, - 0xa438, 0x4003, 0xa438, 0xaf24, 0xa438, 0x97af, 0xa438, 0x2467, - 0xa436, 0xb85e, 0xa438, 0x5082, 0xa436, 0xb860, 0xa438, 0x4575, - 0xa436, 0xb862, 0xa438, 0x425F, 0xa436, 0xb864, 0xa438, 0x0096, - 0xa436, 0xb886, 0xa438, 0x4A44, 0xa436, 0xb888, 0xa438, 0x49c4, - 0xa436, 0xb88a, 0xa438, 0x3FF2, 0xa436, 0xb88c, 0xa438, 0x245C, - 0xa436, 0xb838, 0xa438, 0x00ff, 0xb820, 0x0010, 0xa466, 0x0001, - 0xa436, 0x836a, 0xa438, 0x0001, 0xa436, 0x843d, 0xa438, 0xaf84, - 0xa438, 0xa6af, 0xa438, 0x8540, 0xa438, 0xaf85, 0xa438, 0xaeaf, - 0xa438, 0x85b5, 0xa438, 0xaf87, 0xa438, 0x7daf, 0xa438, 0x8784, - 0xa438, 0xaf87, 0xa438, 0x87af, 0xa438, 0x87e5, 0xa438, 0x0066, - 0xa438, 0x0a03, 0xa438, 0x6607, 0xa438, 0x2666, 0xa438, 0x1c00, - 0xa438, 0x660d, 0xa438, 0x0166, 0xa438, 0x1004, 0xa438, 0x6616, - 0xa438, 0x0566, 0xa438, 0x1f06, 0xa438, 0x6a5d, 0xa438, 0x2766, - 0xa438, 0x1900, 0xa438, 0x6625, 0xa438, 0x2466, 0xa438, 0x2820, - 0xa438, 0x662b, 0xa438, 0x2466, 0xa438, 0x4600, 0xa438, 0x664c, - 0xa438, 0x0166, 0xa438, 0x4902, 0xa438, 0x8861, 0xa438, 0x0388, - 0xa438, 0x5e05, 0xa438, 0x886d, 0xa438, 0x0588, 0xa438, 0x7005, - 0xa438, 0x8873, 0xa438, 0x0588, 0xa438, 0x7605, 0xa438, 0x8879, - 0xa438, 0x0588, 0xa438, 0x7c05, 0xa438, 0x887f, 0xa438, 0x0588, - 0xa438, 0x8205, 0xa438, 0x8885, 0xa438, 0x0588, 0xa438, 0x881e, - 0xa438, 0x13ad, 0xa438, 0x2841, 0xa438, 0xbf64, 0xa438, 0xf102, - 0xa438, 0x6b9d, 0xa438, 0xad28, 0xa438, 0x03af, 0xa438, 0x15fc, - 0xa438, 0xbf65, 0xa438, 0xcb02, 0xa438, 0x6b9d, 0xa438, 0x0d11, - 0xa438, 0xf62f, 0xa438, 0xef31, 0xa438, 0xd202, 0xa438, 0xbf88, - 0xa438, 0x6402, 0xa438, 0x6b52, 0xa438, 0xe082, 0xa438, 0x020d, - 0xa438, 0x01f6, 0xa438, 0x271b, 0xa438, 0x03aa, 0xa438, 0x0182, - 0xa438, 0xe082, 0xa438, 0x010d, 0xa438, 0x01f6, 0xa438, 0x271b, - 0xa438, 0x03aa, 0xa438, 0x0782, 0xa438, 0xbf88, 0xa438, 0x6402, - 0xa438, 0x6b5b, 0xa438, 0xaf15, 0xa438, 0xf9bf, 0xa438, 0x65cb, - 0xa438, 0x026b, 0xa438, 0x9d0d, 0xa438, 0x11f6, 0xa438, 0x2fef, - 0xa438, 0x31e0, 0xa438, 0x8ff7, 0xa438, 0x0d01, 0xa438, 0xf627, - 0xa438, 0x1b03, 0xa438, 0xaa20, 0xa438, 0xe18f, 0xa438, 0xf4d0, - 0xa438, 0x00bf, 0xa438, 0x6587, 0xa438, 0x026b, 0xa438, 0x7ee1, - 0xa438, 0x8ff5, 0xa438, 0xbf65, 0xa438, 0x8a02, 0xa438, 0x6b7e, - 0xa438, 0xe18f, 0xa438, 0xf6bf, 0xa438, 0x6584, 0xa438, 0x026b, - 0xa438, 0x7eaf, 0xa438, 0x15fc, 0xa438, 0xe18f, 0xa438, 0xf1d0, - 0xa438, 0x00bf, 0xa438, 0x6587, 0xa438, 0x026b, 0xa438, 0x7ee1, - 0xa438, 0x8ff2, 0xa438, 0xbf65, 0xa438, 0x8a02, 0xa438, 0x6b7e, - 0xa438, 0xe18f, 0xa438, 0xf3bf, 0xa438, 0x6584, 0xa438, 0xaf15, - 0xa438, 0xfcd1, 0xa438, 0x07bf, 0xa438, 0x65ce, 0xa438, 0x026b, - 0xa438, 0x7ed1, 0xa438, 0x0cbf, 0xa438, 0x65d1, 0xa438, 0x026b, - 0xa438, 0x7ed1, 0xa438, 0x03bf, 0xa438, 0x885e, 0xa438, 0x026b, - 0xa438, 0x7ed1, 0xa438, 0x05bf, 0xa438, 0x8867, 0xa438, 0x026b, - 0xa438, 0x7ed1, 0xa438, 0x07bf, 0xa438, 0x886a, 0xa438, 0x026b, - 0xa438, 0x7ebf, 0xa438, 0x6a6c, 0xa438, 0x026b, 0xa438, 0x5b02, - 0xa438, 0x62b5, 0xa438, 0xbf6a, 0xa438, 0x0002, 0xa438, 0x6b5b, - 0xa438, 0xbf64, 0xa438, 0x4e02, 0xa438, 0x6b9d, 0xa438, 0xac28, - 0xa438, 0x0bbf, 0xa438, 0x6412, 0xa438, 0x026b, 0xa438, 0x9da1, - 0xa438, 0x0502, 0xa438, 0xaeec, 0xa438, 0xd104, 0xa438, 0xbf65, - 0xa438, 0xce02, 0xa438, 0x6b7e, 0xa438, 0xd104, 0xa438, 0xbf65, - 0xa438, 0xd102, 0xa438, 0x6b7e, 0xa438, 0xd102, 0xa438, 0xbf88, - 0xa438, 0x6702, 0xa438, 0x6b7e, 0xa438, 0xd104, 0xa438, 0xbf88, - 0xa438, 0x6a02, 0xa438, 0x6b7e, 0xa438, 0xaf62, 0xa438, 0x72f6, - 0xa438, 0x0af6, 0xa438, 0x09af, 0xa438, 0x34e3, 0xa438, 0x0285, - 0xa438, 0xbe02, 0xa438, 0x106c, 0xa438, 0xaf10, 0xa438, 0x6bf8, - 0xa438, 0xfaef, 0xa438, 0x69e0, 0xa438, 0x804c, 0xa438, 0xac25, - 0xa438, 0x17e0, 0xa438, 0x8040, 0xa438, 0xad25, 0xa438, 0x1a02, - 0xa438, 0x85ed, 0xa438, 0xe080, 0xa438, 0x40ac, 0xa438, 0x2511, - 0xa438, 0xbf87, 0xa438, 0x6502, 0xa438, 0x6b5b, 0xa438, 0xae09, - 0xa438, 0x0287, 0xa438, 0x2402, 0xa438, 0x875a, 0xa438, 0x0287, - 0xa438, 0x4fef, 0xa438, 0x96fe, 0xa438, 0xfc04, 0xa438, 0xf8e0, - 0xa438, 0x8019, 0xa438, 0xad20, 0xa438, 0x11e0, 0xa438, 0x8fe3, - 0xa438, 0xac20, 0xa438, 0x0502, 0xa438, 0x860a, 0xa438, 0xae03, - 0xa438, 0x0286, 0xa438, 0x7802, 0xa438, 0x86c1, 0xa438, 0x0287, - 0xa438, 0x4ffc, 0xa438, 0x04f8, 0xa438, 0xf9ef, 0xa438, 0x79fb, - 0xa438, 0xbf87, 0xa438, 0x6802, 0xa438, 0x6b9d, 0xa438, 0x5c20, - 0xa438, 0x000d, 0xa438, 0x4da1, 0xa438, 0x0151, 0xa438, 0xbf87, - 0xa438, 0x6802, 0xa438, 0x6b9d, 0xa438, 0x5c07, 0xa438, 0xffe3, - 0xa438, 0x8fe4, 0xa438, 0x1b31, 0xa438, 0x9f41, 0xa438, 0x0d48, - 0xa438, 0xe38f, 0xa438, 0xe51b, 0xa438, 0x319f, 0xa438, 0x38bf, - 0xa438, 0x876b, 0xa438, 0x026b, 0xa438, 0x9d5c, 0xa438, 0x07ff, - 0xa438, 0xe38f, 0xa438, 0xe61b, 0xa438, 0x319f, 0xa438, 0x280d, - 0xa438, 0x48e3, 0xa438, 0x8fe7, 0xa438, 0x1b31, 0xa438, 0x9f1f, - 0xa438, 0xbf87, 0xa438, 0x6e02, 0xa438, 0x6b9d, 0xa438, 0x5c07, - 0xa438, 0xffe3, 0xa438, 0x8fe8, 0xa438, 0x1b31, 0xa438, 0x9f0f, - 0xa438, 0x0d48, 0xa438, 0xe38f, 0xa438, 0xe91b, 0xa438, 0x319f, - 0xa438, 0x06ee, 0xa438, 0x8fe3, 0xa438, 0x01ae, 0xa438, 0x04ee, - 0xa438, 0x8fe3, 0xa438, 0x00ff, 0xa438, 0xef97, 0xa438, 0xfdfc, - 0xa438, 0x04f8, 0xa438, 0xf9ef, 0xa438, 0x79fb, 0xa438, 0xbf87, - 0xa438, 0x6802, 0xa438, 0x6b9d, 0xa438, 0x5c20, 0xa438, 0x000d, - 0xa438, 0x4da1, 0xa438, 0x0020, 0xa438, 0xbf87, 0xa438, 0x6802, - 0xa438, 0x6b9d, 0xa438, 0x5c06, 0xa438, 0x000d, 0xa438, 0x49e3, - 0xa438, 0x8fea, 0xa438, 0x1b31, 0xa438, 0x9f0e, 0xa438, 0xbf87, - 0xa438, 0x7102, 0xa438, 0x6b5b, 0xa438, 0xbf87, 0xa438, 0x7702, - 0xa438, 0x6b5b, 0xa438, 0xae0c, 0xa438, 0xbf87, 0xa438, 0x7102, - 0xa438, 0x6b52, 0xa438, 0xbf87, 0xa438, 0x7702, 0xa438, 0x6b52, - 0xa438, 0xee8f, 0xa438, 0xe300, 0xa438, 0xffef, 0xa438, 0x97fd, - 0xa438, 0xfc04, 0xa438, 0xf8f9, 0xa438, 0xef79, 0xa438, 0xfbbf, - 0xa438, 0x8768, 0xa438, 0x026b, 0xa438, 0x9d5c, 0xa438, 0x2000, - 0xa438, 0x0d4d, 0xa438, 0xa101, 0xa438, 0x4abf, 0xa438, 0x8768, - 0xa438, 0x026b, 0xa438, 0x9d5c, 0xa438, 0x07ff, 0xa438, 0xe38f, - 0xa438, 0xeb1b, 0xa438, 0x319f, 0xa438, 0x3a0d, 0xa438, 0x48e3, - 0xa438, 0x8fec, 0xa438, 0x1b31, 0xa438, 0x9f31, 0xa438, 0xbf87, - 0xa438, 0x6b02, 0xa438, 0x6b9d, 0xa438, 0xe38f, 0xa438, 0xed1b, - 0xa438, 0x319f, 0xa438, 0x240d, 0xa438, 0x48e3, 0xa438, 0x8fee, - 0xa438, 0x1b31, 0xa438, 0x9f1b, 0xa438, 0xbf87, 0xa438, 0x6e02, - 0xa438, 0x6b9d, 0xa438, 0xe38f, 0xa438, 0xef1b, 0xa438, 0x319f, - 0xa438, 0x0ebf, 0xa438, 0x8774, 0xa438, 0x026b, 0xa438, 0x5bbf, - 0xa438, 0x877a, 0xa438, 0x026b, 0xa438, 0x5bae, 0xa438, 0x00ff, - 0xa438, 0xef97, 0xa438, 0xfdfc, 0xa438, 0x04f8, 0xa438, 0xef79, - 0xa438, 0xfbe0, 0xa438, 0x8019, 0xa438, 0xad20, 0xa438, 0x1cee, - 0xa438, 0x8fe3, 0xa438, 0x00bf, 0xa438, 0x8771, 0xa438, 0x026b, - 0xa438, 0x52bf, 0xa438, 0x8777, 0xa438, 0x026b, 0xa438, 0x52bf, - 0xa438, 0x8774, 0xa438, 0x026b, 0xa438, 0x52bf, 0xa438, 0x877a, - 0xa438, 0x026b, 0xa438, 0x52ff, 0xa438, 0xef97, 0xa438, 0xfc04, - 0xa438, 0xf8e0, 0xa438, 0x8040, 0xa438, 0xf625, 0xa438, 0xe480, - 0xa438, 0x40fc, 0xa438, 0x04f8, 0xa438, 0xe080, 0xa438, 0x4cf6, - 0xa438, 0x25e4, 0xa438, 0x804c, 0xa438, 0xfc04, 0xa438, 0x55a4, - 0xa438, 0xbaf0, 0xa438, 0xa64a, 0xa438, 0xf0a6, 0xa438, 0x4cf0, - 0xa438, 0xa64e, 0xa438, 0x66a4, 0xa438, 0xb655, 0xa438, 0xa4b6, - 0xa438, 0x00ac, 0xa438, 0x0e11, 0xa438, 0xac0e, 0xa438, 0xee80, - 0xa438, 0x4c3a, 0xa438, 0xaf07, 0xa438, 0xd0af, 0xa438, 0x26d0, - 0xa438, 0xa201, 0xa438, 0x0ebf, 0xa438, 0x663d, 0xa438, 0x026b, - 0xa438, 0x52bf, 0xa438, 0x6643, 0xa438, 0x026b, 0xa438, 0x52ae, - 0xa438, 0x11bf, 0xa438, 0x6643, 0xa438, 0x026b, 0xa438, 0x5bd4, - 0xa438, 0x0054, 0xa438, 0xb4fe, 0xa438, 0xbf66, 0xa438, 0x3d02, - 0xa438, 0x6b5b, 0xa438, 0xd300, 0xa438, 0x020d, 0xa438, 0xf6a2, - 0xa438, 0x0405, 0xa438, 0xe081, 0xa438, 0x47ae, 0xa438, 0x03e0, - 0xa438, 0x8148, 0xa438, 0xac23, 0xa438, 0x02ae, 0xa438, 0x0268, - 0xa438, 0xf01a, 0xa438, 0x10ad, 0xa438, 0x2f04, 0xa438, 0xd100, - 0xa438, 0xae05, 0xa438, 0xad2c, 0xa438, 0x02d1, 0xa438, 0x0f1f, - 0xa438, 0x00a2, 0xa438, 0x0407, 0xa438, 0x3908, 0xa438, 0xad2f, - 0xa438, 0x02d1, 0xa438, 0x0002, 0xa438, 0x0e1c, 0xa438, 0x2b01, - 0xa438, 0xad3a, 0xa438, 0xc9af, 0xa438, 0x0dee, 0xa438, 0xa000, - 0xa438, 0x2702, 0xa438, 0x1beb, 0xa438, 0xe18f, 0xa438, 0xe1ac, - 0xa438, 0x2819, 0xa438, 0xee8f, 0xa438, 0xe101, 0xa438, 0x1f44, - 0xa438, 0xbf65, 0xa438, 0x9302, 0xa438, 0x6b9d, 0xa438, 0xe58f, - 0xa438, 0xe21f, 0xa438, 0x44d1, 0xa438, 0x02bf, 0xa438, 0x6593, - 0xa438, 0x026b, 0xa438, 0x7ee0, 0xa438, 0x82b1, 0xa438, 0xae49, - 0xa438, 0xa001, 0xa438, 0x0502, 0xa438, 0x1c4d, 0xa438, 0xae41, - 0xa438, 0xa002, 0xa438, 0x0502, 0xa438, 0x1c90, 0xa438, 0xae39, - 0xa438, 0xa003, 0xa438, 0x0502, 0xa438, 0x1c9d, 0xa438, 0xae31, - 0xa438, 0xa004, 0xa438, 0x0502, 0xa438, 0x1cbc, 0xa438, 0xae29, - 0xa438, 0xa005, 0xa438, 0x1e02, 0xa438, 0x1cc9, 0xa438, 0xe080, - 0xa438, 0xdfac, 0xa438, 0x2013, 0xa438, 0xac21, 0xa438, 0x10ac, - 0xa438, 0x220d, 0xa438, 0xe18f, 0xa438, 0xe2bf, 0xa438, 0x6593, - 0xa438, 0x026b, 0xa438, 0x7eee, 0xa438, 0x8fe1, 0xa438, 0x00ae, - 0xa438, 0x08a0, 0xa438, 0x0605, 0xa438, 0x021d, 0xa438, 0x07ae, - 0xa438, 0x00e0, 0xa438, 0x82b1, 0xa438, 0xaf1b, 0xa438, 0xe910, - 0xa438, 0xbf4a, 0xa438, 0x99bf, 0xa438, 0x4a00, 0xa438, 0xa86a, - 0xa438, 0xfdad, 0xa438, 0x5eca, 0xa438, 0xad5e, 0xa438, 0x88bd, - 0xa438, 0x2c99, 0xa438, 0xbd2c, 0xa438, 0x33bd, 0xa438, 0x3222, - 0xa438, 0xbd32, 0xa438, 0x11bd, 0xa438, 0x3200, 0xa438, 0xbd32, - 0xa438, 0x77bd, 0xa438, 0x3266, 0xa438, 0xbd32, 0xa438, 0x55bd, - 0xa438, 0x3244, 0xa438, 0xbd32, 0xa436, 0xb818, 0xa438, 0x15c5, - 0xa436, 0xb81a, 0xa438, 0x6255, 0xa436, 0xb81c, 0xa438, 0x34e1, - 0xa436, 0xb81e, 0xa438, 0x1068, 0xa436, 0xb850, 0xa438, 0x07cc, - 0xa436, 0xb852, 0xa438, 0x26ca, 0xa436, 0xb878, 0xa438, 0x0dbf, - 0xa436, 0xb884, 0xa438, 0x1BB1, 0xa436, 0xb832, 0xa438, 0x00ff, - 0xa436, 0x0000, 0xa438, 0x0000, 0xB82E, 0x0000, 0xa436, 0x8023, - 0xa438, 0x0000, 0xa436, 0x801E, 0xa438, 0x0025, 0xB820, 0x0000, - 0xFFFF, 0xFFFF -}; - -static const u16 phy_mcu_ram_code_8125d_1_2[] = { - 0xb892, 0x0000, 0xB88E, 0xC28F, 0xB890, 0x252D, 0xB88E, 0xC290, - 0xB890, 0xC924, 0xB88E, 0xC291, 0xB890, 0xC92E, 0xB88E, 0xC292, - 0xB890, 0xF626, 0xB88E, 0xC293, 0xB890, 0xF630, 0xB88E, 0xC294, - 0xB890, 0xA328, 0xB88E, 0xC295, 0xB890, 0xA332, 0xB88E, 0xC296, - 0xB890, 0xD72B, 0xB88E, 0xC297, 0xB890, 0xD735, 0xB88E, 0xC298, - 0xB890, 0x8A2E, 0xB88E, 0xC299, 0xB890, 0x8A38, 0xB88E, 0xC29A, - 0xB890, 0xBE32, 0xB88E, 0xC29B, 0xB890, 0xBE3C, 0xB88E, 0xC29C, - 0xB890, 0x7436, 0xB88E, 0xC29D, 0xB890, 0x7440, 0xB88E, 0xC29E, - 0xB890, 0xAD3B, 0xB88E, 0xC29F, 0xB890, 0xAD45, 0xB88E, 0xC2A0, - 0xB890, 0x6640, 0xB88E, 0xC2A1, 0xB890, 0x664A, 0xB88E, 0xC2A2, - 0xB890, 0xA646, 0xB88E, 0xC2A3, 0xB890, 0xA650, 0xB88E, 0xC2A4, - 0xB890, 0x624C, 0xB88E, 0xC2A5, 0xB890, 0x6256, 0xB88E, 0xC2A6, - 0xB890, 0xA453, 0xB88E, 0xC2A7, 0xB890, 0xA45D, 0xB88E, 0xC2A8, - 0xB890, 0x665A, 0xB88E, 0xC2A9, 0xB890, 0x6664, 0xB88E, 0xC2AA, - 0xB890, 0xAC62, 0xB88E, 0xC2AB, 0xB890, 0xAC6C, 0xB88E, 0xC2AC, - 0xB890, 0x746A, 0xB88E, 0xC2AD, 0xB890, 0x7474, 0xB88E, 0xC2AE, - 0xB890, 0xBCFA, 0xB88E, 0xC2AF, 0xB890, 0xBCFD, 0xB88E, 0xC2B0, - 0xB890, 0x79FF, 0xB88E, 0xC2B1, 0xB890, 0x7901, 0xB88E, 0xC2B2, - 0xB890, 0xF703, 0xB88E, 0xC2B3, 0xB890, 0xF706, 0xB88E, 0xC2B4, - 0xB890, 0x7408, 0xB88E, 0xC2B5, 0xB890, 0x740A, 0xB88E, 0xC2B6, - 0xB890, 0xF10C, 0xB88E, 0xC2B7, 0xB890, 0xF10F, 0xB88E, 0xC2B8, - 0xB890, 0x6F10, 0xB88E, 0xC2B9, 0xB890, 0x6F13, 0xB88E, 0xC2BA, - 0xB890, 0xEC15, 0xB88E, 0xC2BB, 0xB890, 0xEC18, 0xB88E, 0xC2BC, - 0xB890, 0x6A1A, 0xB88E, 0xC2BD, 0xB890, 0x6A1C, 0xB88E, 0xC2BE, - 0xB890, 0xE71E, 0xB88E, 0xC2BF, 0xB890, 0xE721, 0xB88E, 0xC2C0, - 0xB890, 0x6424, 0xB88E, 0xC2C1, 0xB890, 0x6425, 0xB88E, 0xC2C2, - 0xB890, 0xE228, 0xB88E, 0xC2C3, 0xB890, 0xE22A, 0xB88E, 0xC2C4, - 0xB890, 0x5F2B, 0xB88E, 0xC2C5, 0xB890, 0x5F2E, 0xB88E, 0xC2C6, - 0xB890, 0xDC31, 0xB88E, 0xC2C7, 0xB890, 0xDC33, 0xB88E, 0xC2C8, - 0xB890, 0x2035, 0xB88E, 0xC2C9, 0xB890, 0x2036, 0xB88E, 0xC2CA, - 0xB890, 0x9F3A, 0xB88E, 0xC2CB, 0xB890, 0x9F3A, 0xB88E, 0xC2CC, - 0xB890, 0x4430, 0xFFFF, 0xFFFF -}; - -static const u16 phy_mcu_ram_code_8125d_1_3[] = { - 0xa436, 0xacca, 0xa438, 0x0104, 0xa436, 0xaccc, 0xa438, 0x8000, - 0xa436, 0xacce, 0xa438, 0xffff, 0xa436, 0xacd0, 0xa438, 0x0fff, - 0xa436, 0xacce, 0xa438, 0xfff8, 0xa436, 0xacd0, 0xa438, 0x0fff, - 0xa436, 0xacce, 0xa438, 0xffff, 0xa436, 0xacd0, 0xa438, 0x07ff, - 0xa436, 0xacce, 0xa438, 0xffff, 0xa436, 0xacd0, 0xa438, 0x07ff, - 0xa436, 0xacce, 0xa438, 0xffff, 0xa436, 0xacd0, 0xa438, 0x07ff, - 0xa436, 0xacce, 0xa438, 0xffff, 0xa436, 0xacd0, 0xa438, 0x07ff, - 0xa436, 0xacce, 0xa438, 0xffff, 0xa436, 0xacd0, 0xa438, 0x07ff, - 0xa436, 0xacce, 0xa438, 0xffff, 0xa436, 0xacd0, 0xa438, 0x07ff, - 0xa436, 0xacce, 0xa438, 0xffff, 0xa436, 0xacd0, 0xa438, 0x07ff, - 0xa436, 0xacce, 0xa438, 0xffff, 0xa436, 0xacd0, 0xa438, 0x07ff, - 0xa436, 0xacce, 0xa438, 0xffff, 0xa436, 0xacd0, 0xa438, 0x07ff, - 0xa436, 0xacce, 0xa438, 0xffff, 0xa436, 0xacd0, 0xa438, 0x07ff, - 0xa436, 0xacce, 0xa438, 0xfb47, 0xa436, 0xacd0, 0xa438, 0x07ff, - 0xa436, 0xacce, 0xa438, 0xfb4f, 0xa436, 0xacd0, 0xa438, 0x07ff, - 0xa436, 0xacce, 0xa438, 0x6087, 0xa436, 0xacd0, 0xa438, 0x0180, - 0xa436, 0xacce, 0xa438, 0x600f, 0xa436, 0xacd0, 0xa438, 0x0108, - 0xa436, 0xacce, 0xa438, 0x6807, 0xa436, 0xacd0, 0xa438, 0x0100, - 0xa436, 0xacce, 0xa438, 0x688f, 0xa436, 0xacd0, 0xa438, 0x0188, - 0xa436, 0xacce, 0xa438, 0x7027, 0xa436, 0xacd0, 0xa438, 0x0120, - 0xa436, 0xacce, 0xa438, 0x702f, 0xa436, 0xacd0, 0xa438, 0x0128, - 0xa436, 0xacce, 0xa438, 0x7847, 0xa436, 0xacd0, 0xa438, 0x0140, - 0xa436, 0xacce, 0xa438, 0x784f, 0xa436, 0xacd0, 0xa438, 0x0148, - 0xa436, 0xacce, 0xa438, 0x80a7, 0xa436, 0xacd0, 0xa438, 0x01a0, - 0xa436, 0xacce, 0xa438, 0x88af, 0xa436, 0xacd0, 0xa438, 0x01a8, - 0xa436, 0xacce, 0xa438, 0x8067, 0xa436, 0xacd0, 0xa438, 0x0161, - 0xa436, 0xacce, 0xa438, 0x886f, 0xa436, 0xacd0, 0xa438, 0x0169, - 0xa436, 0xacce, 0xa438, 0xfb57, 0xa436, 0xacd0, 0xa438, 0x07ff, - 0xa436, 0xacce, 0xa438, 0xfb5f, 0xa436, 0xacd0, 0xa438, 0x07ff, - 0xa436, 0xacce, 0xa438, 0x6017, 0xa436, 0xacd0, 0xa438, 0x0110, - 0xa436, 0xacce, 0xa438, 0x601f, 0xa436, 0xacd0, 0xa438, 0x0118, - 0xa436, 0xacce, 0xa438, 0x6837, 0xa436, 0xacd0, 0xa438, 0x0130, - 0xa436, 0xacce, 0xa438, 0x683f, 0xa436, 0xacd0, 0xa438, 0x0138, - 0xa436, 0xacce, 0xa438, 0x7097, 0xa436, 0xacd0, 0xa438, 0x0190, - 0xa436, 0xacce, 0xa438, 0x705f, 0xa436, 0xacd0, 0xa438, 0x0158, - 0xa436, 0xacce, 0xa438, 0x7857, 0xa436, 0xacd0, 0xa438, 0x0150, - 0xa436, 0xacce, 0xa438, 0x789f, 0xa436, 0xacd0, 0xa438, 0x0198, - 0xa436, 0xacce, 0xa438, 0x90b7, 0xa436, 0xacd0, 0xa438, 0x01b0, - 0xa436, 0xacce, 0xa438, 0x98bf, 0xa436, 0xacd0, 0xa438, 0x01b8, - 0xa436, 0xacce, 0xa438, 0x9077, 0xa436, 0xacd0, 0xa438, 0x1171, - 0xa436, 0xacce, 0xa438, 0x987f, 0xa436, 0xacd0, 0xa438, 0x1179, - 0xa436, 0xacca, 0xa438, 0x0004, 0xa436, 0xacc6, 0xa438, 0x0015, - 0xa436, 0xacc8, 0xa438, 0xc000, 0xa436, 0xacc8, 0xa438, 0x0000, - 0xFFFF, 0xFFFF -}; - -static const u16 phy_mcu_ram_code_8125d_2_1[] = { - 0xa436, 0x8023, 0xa438, 0x3801, 0xa436, 0xB82E, 0xa438, 0x0001, - 0xb820, 0x0090, 0xa436, 0xA016, 0xa438, 0x0000, 0xa436, 0xA012, - 0xa438, 0x0000, 0xa436, 0xA014, 0xa438, 0x1800, 0xa438, 0x8010, - 0xa438, 0x1800, 0xa438, 0x8057, 0xa438, 0x1800, 0xa438, 0x808b, - 0xa438, 0x1800, 0xa438, 0x808b, 0xa438, 0x1800, 0xa438, 0x808b, - 0xa438, 0x1800, 0xa438, 0x808b, 0xa438, 0x1800, 0xa438, 0x808b, - 0xa438, 0x1800, 0xa438, 0x808b, 0xa438, 0xd504, 0xa438, 0xd706, - 0xa438, 0x2529, 0xa438, 0x801a, 0xa438, 0xd718, 0xa438, 0x607b, - 0xa438, 0x40da, 0xa438, 0xf013, 0xa438, 0x441a, 0xa438, 0xf02d, - 0xa438, 0xd718, 0xa438, 0x61fb, 0xa438, 0xbb01, 0xa438, 0xd75e, - 0xa438, 0x6171, 0xa438, 0x0cf0, 0xa438, 0x0c10, 0xa438, 0xd501, - 0xa438, 0xce01, 0xa438, 0xd70c, 0xa438, 0x6087, 0xa438, 0x0cf0, - 0xa438, 0x0410, 0xa438, 0xf002, 0xa438, 0xa4f0, 0xa438, 0xf02a, - 0xa438, 0xbb02, 0xa438, 0xd75e, 0xa438, 0x6171, 0xa438, 0x0cf0, - 0xa438, 0x0c20, 0xa438, 0xd501, 0xa438, 0xce01, 0xa438, 0xd70c, - 0xa438, 0x6087, 0xa438, 0x0cf0, 0xa438, 0x0420, 0xa438, 0xf002, - 0xa438, 0xa4f0, 0xa438, 0xf01c, 0xa438, 0xbb04, 0xa438, 0xd75e, - 0xa438, 0x6171, 0xa438, 0x0cf0, 0xa438, 0x0c40, 0xa438, 0xd501, - 0xa438, 0xce01, 0xa438, 0xd70c, 0xa438, 0x6087, 0xa438, 0x0cf0, - 0xa438, 0x0440, 0xa438, 0xf002, 0xa438, 0xa4f0, 0xa438, 0xf00e, - 0xa438, 0xbb08, 0xa438, 0xd75e, 0xa438, 0x6171, 0xa438, 0x0cf0, - 0xa438, 0x0c80, 0xa438, 0xd501, 0xa438, 0xce01, 0xa438, 0xd70c, - 0xa438, 0x6087, 0xa438, 0x0cf0, 0xa438, 0x0480, 0xa438, 0xf002, - 0xa438, 0xa4f0, 0xa438, 0xce00, 0xa438, 0xd500, 0xa438, 0x1800, - 0xa438, 0x165a, 0xa438, 0xd75e, 0xa438, 0x6631, 0xa438, 0xd504, - 0xa438, 0xd71e, 0xa438, 0x649b, 0xa438, 0x631a, 0xa438, 0x6199, - 0xa438, 0x0cf0, 0xa438, 0x0c10, 0xa438, 0xd501, 0xa438, 0xce01, - 0xa438, 0xd70c, 0xa438, 0x6087, 0xa438, 0x0cf0, 0xa438, 0x0410, - 0xa438, 0xf023, 0xa438, 0xa4f0, 0xa438, 0xf021, 0xa438, 0x0cf0, - 0xa438, 0x0c20, 0xa438, 0xd501, 0xa438, 0xce01, 0xa438, 0xd70c, - 0xa438, 0x6087, 0xa438, 0x0cf0, 0xa438, 0x0420, 0xa438, 0xf018, - 0xa438, 0xa4f0, 0xa438, 0xf016, 0xa438, 0x0cf0, 0xa438, 0x0c40, - 0xa438, 0xd501, 0xa438, 0xce01, 0xa438, 0xd70c, 0xa438, 0x6087, - 0xa438, 0x0cf0, 0xa438, 0x0440, 0xa438, 0xf00d, 0xa438, 0xa4f0, - 0xa438, 0xf00b, 0xa438, 0x0cf0, 0xa438, 0x0c80, 0xa438, 0xd501, - 0xa438, 0xce01, 0xa438, 0xd70c, 0xa438, 0x6087, 0xa438, 0x0cf0, - 0xa438, 0x0480, 0xa438, 0xf002, 0xa438, 0xa4f0, 0xa438, 0x1800, - 0xa438, 0x168c, 0xa436, 0xA026, 0xa438, 0xffff, 0xa436, 0xA024, - 0xa438, 0xffff, 0xa436, 0xA022, 0xa438, 0xffff, 0xa436, 0xA020, - 0xa438, 0xffff, 0xa436, 0xA006, 0xa438, 0xffff, 0xa436, 0xA004, - 0xa438, 0xffff, 0xa436, 0xA002, 0xa438, 0x1665, 0xa436, 0xA000, - 0xa438, 0x1611, 0xa436, 0xA008, 0xa438, 0x0300, 0xa436, 0xA016, - 0xa438, 0x0000, 0xa436, 0xA012, 0xa438, 0x07f8, 0xa436, 0xA014, - 0xa438, 0xcc01, 0xa438, 0x0000, 0xa438, 0x0000, 0xa438, 0x0000, - 0xa438, 0x0000, 0xa438, 0x0000, 0xa438, 0x0000, 0xa438, 0x0000, - 0xa436, 0xA152, 0xa438, 0x021c, 0xa436, 0xA154, 0xa438, 0x3fff, - 0xa436, 0xA156, 0xa438, 0x3fff, 0xa436, 0xA158, 0xa438, 0x3fff, - 0xa436, 0xA15A, 0xa438, 0x3fff, 0xa436, 0xA15C, 0xa438, 0x3fff, - 0xa436, 0xA15E, 0xa438, 0x3fff, 0xa436, 0xA160, 0xa438, 0x3fff, - 0xa436, 0xA150, 0xa438, 0x0001, 0xb820, 0x0010, 0xa436, 0x0000, - 0xa438, 0x0000, 0xB82E, 0x0000, 0xa436, 0x8023, 0xa438, 0x0000, - 0xa436, 0x801E, 0xa438, 0x0025, 0xB820, 0x0000, 0xFFFF, 0xFFFF -}; - -static const u16 phy_mcu_ram_code_8125bp_1_1[] = { - 0xa436, 0x8024, 0xa438, 0x3600, 0xa436, 0xB82E, 0xa438, 0x0001, - 0xb820, 0x0090, 0xa436, 0xA016, 0xa438, 0x0000, 0xa436, 0xA012, - 0xa438, 0x0000, 0xa436, 0xA014, 0xa438, 0x1800, 0xa438, 0x8010, - 0xa438, 0x1800, 0xa438, 0x8014, 0xa438, 0x1800, 0xa438, 0x8018, - 0xa438, 0x1800, 0xa438, 0x801c, 0xa438, 0x1800, 0xa438, 0x8020, - 0xa438, 0x1800, 0xa438, 0x8024, 0xa438, 0x1800, 0xa438, 0x8028, - 0xa438, 0x1800, 0xa438, 0x8028, 0xa438, 0xdb20, 0xa438, 0xd501, - 0xa438, 0x1800, 0xa438, 0x034c, 0xa438, 0xdb10, 0xa438, 0xd501, - 0xa438, 0x1800, 0xa438, 0x032c, 0xa438, 0x8620, 0xa438, 0xa480, - 0xa438, 0x1800, 0xa438, 0x1cfe, 0xa438, 0xbf40, 0xa438, 0xd703, - 0xa438, 0x1800, 0xa438, 0x0ce9, 0xa438, 0x9c10, 0xa438, 0x9f40, - 0xa438, 0x1800, 0xa438, 0x137a, 0xa438, 0x9f20, 0xa438, 0x9f40, - 0xa438, 0x1800, 0xa438, 0x16c4, 0xa436, 0xA026, 0xa438, 0xffff, - 0xa436, 0xA024, 0xa438, 0xffff, 0xa436, 0xA022, 0xa438, 0x16c3, - 0xa436, 0xA020, 0xa438, 0x1379, 0xa436, 0xA006, 0xa438, 0x0ce8, - 0xa436, 0xA004, 0xa438, 0x1cfd, 0xa436, 0xA002, 0xa438, 0x032b, - 0xa436, 0xA000, 0xa438, 0x034b, 0xa436, 0xA008, 0xa438, 0x3f00, - 0xa436, 0xA016, 0xa438, 0x0020, 0xa436, 0xA012, 0xa438, 0x0000, - 0xa436, 0xA014, 0xa438, 0x1800, 0xa438, 0x8010, 0xa438, 0x1800, - 0xa438, 0x8018, 0xa438, 0x1800, 0xa438, 0x8021, 0xa438, 0x1800, - 0xa438, 0x802b, 0xa438, 0x1800, 0xa438, 0x8055, 0xa438, 0x1800, - 0xa438, 0x805a, 0xa438, 0x1800, 0xa438, 0x805e, 0xa438, 0x1800, - 0xa438, 0x8062, 0xa438, 0x0000, 0xa438, 0x0000, 0xa438, 0xcb11, - 0xa438, 0xd1b9, 0xa438, 0xd05b, 0xa438, 0x0000, 0xa438, 0x1800, - 0xa438, 0x0284, 0xa438, 0x0000, 0xa438, 0x0000, 0xa438, 0xd700, - 0xa438, 0x5fb4, 0xa438, 0x5f95, 0xa438, 0x0000, 0xa438, 0x0000, - 0xa438, 0x1800, 0xa438, 0x02b7, 0xa438, 0x0000, 0xa438, 0x0000, - 0xa438, 0xcb21, 0xa438, 0x1000, 0xa438, 0x0b34, 0xa438, 0xd71f, - 0xa438, 0x5f5e, 0xa438, 0x0000, 0xa438, 0x1800, 0xa438, 0x0322, - 0xa438, 0xd700, 0xa438, 0xd113, 0xa438, 0xd040, 0xa438, 0x1000, - 0xa438, 0x0a57, 0xa438, 0xd700, 0xa438, 0x5fb4, 0xa438, 0xd700, - 0xa438, 0x6065, 0xa438, 0xd122, 0xa438, 0xf002, 0xa438, 0xd122, - 0xa438, 0xd040, 0xa438, 0x1000, 0xa438, 0x0b53, 0xa438, 0xa008, - 0xa438, 0xd704, 0xa438, 0x4052, 0xa438, 0xa002, 0xa438, 0xd704, - 0xa438, 0x4054, 0xa438, 0xa740, 0xa438, 0x1000, 0xa438, 0x0a57, - 0xa438, 0xd700, 0xa438, 0x5fb4, 0xa438, 0xcb9b, 0xa438, 0xd110, - 0xa438, 0xd040, 0xa438, 0x1000, 0xa438, 0x0c01, 0xa438, 0x1000, - 0xa438, 0x0a57, 0xa438, 0xd700, 0xa438, 0x5fb4, 0xa438, 0x801a, - 0xa438, 0x1000, 0xa438, 0x0a57, 0xa438, 0xd704, 0xa438, 0x7fb9, - 0xa438, 0x1800, 0xa438, 0x088d, 0xa438, 0xcb62, 0xa438, 0xd700, - 0xa438, 0x8880, 0xa438, 0x1800, 0xa438, 0x06cb, 0xa438, 0xbe02, - 0xa438, 0x0000, 0xa438, 0x1800, 0xa438, 0x002c, 0xa438, 0xbe04, - 0xa438, 0x0000, 0xa438, 0x1800, 0xa438, 0x002c, 0xa438, 0xbe08, - 0xa438, 0x0000, 0xa438, 0x1800, 0xa438, 0x002c, 0xa436, 0xA10E, - 0xa438, 0x802a, 0xa436, 0xA10C, 0xa438, 0x8026, 0xa436, 0xA10A, - 0xa438, 0x8022, 0xa436, 0xA108, 0xa438, 0x06ca, 0xa436, 0xA106, - 0xa438, 0x086f, 0xa436, 0xA104, 0xa438, 0x0321, 0xa436, 0xA102, - 0xa438, 0x02b5, 0xa436, 0xA100, 0xa438, 0x0283, 0xa436, 0xA110, - 0xa438, 0x001f, 0xb820, 0x0010, 0xb82e, 0x0000, 0xa436, 0x8024, - 0xa438, 0x0000, 0xB820, 0x0000, 0xFFFF, 0xFFFF -}; - -static const u16 phy_mcu_ram_code_8125bp_1_2[] = { - 0xb892, 0x0000, 0xb88e, 0xC201, 0xb890, 0x2C01, 0xb890, 0xCD02, - 0xb890, 0x0602, 0xb890, 0x5502, 0xb890, 0xB903, 0xb890, 0x3303, - 0xb890, 0xC204, 0xb890, 0x6605, 0xb890, 0x1F05, 0xb890, 0xEE06, - 0xb890, 0xD207, 0xb890, 0xCC08, 0xb890, 0xDA09, 0xb890, 0xFF0B, - 0xb890, 0x380C, 0xb890, 0x87F3, 0xb88e, 0xC27F, 0xb890, 0x2B66, - 0xb890, 0x6666, 0xb890, 0x6666, 0xb890, 0x6666, 0xb890, 0x6666, - 0xb890, 0x6666, 0xb890, 0x6666, 0xb890, 0x6666, 0xb890, 0x66C2, - 0xb88e, 0xC26F, 0xb890, 0x751D, 0xb890, 0x1D1F, 0xb890, 0x2022, - 0xb890, 0x2325, 0xb890, 0x2627, 0xb890, 0x2829, 0xb890, 0x2929, - 0xb890, 0x2A2A, 0xb890, 0x2B66, 0xB820, 0x0000, 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_real_set_phy_mcu_8125d_1_1(struct net_device *dev) -{ - rtl8125_set_phy_mcu_ram_code(dev, - phy_mcu_ram_code_8125d_1_1, - ARRAY_SIZE(phy_mcu_ram_code_8125d_1_1)); -} - -static void -rtl8125_real_set_phy_mcu_8125d_1_2(struct net_device *dev) -{ - rtl8125_set_phy_mcu_ram_code(dev, - phy_mcu_ram_code_8125d_1_2, - ARRAY_SIZE(phy_mcu_ram_code_8125d_1_2)); -} - -static void -rtl8125_real_set_phy_mcu_8125d_1_3(struct net_device *dev) -{ - rtl8125_set_phy_mcu_ram_code(dev, - phy_mcu_ram_code_8125d_1_3, - ARRAY_SIZE(phy_mcu_ram_code_8125d_1_3)); -} - -static void -rtl8125_set_phy_mcu_8125d_1(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - rtl8125_set_phy_mcu_patch_request(tp); - - rtl8125_real_set_phy_mcu_8125d_1_1(dev); - - rtl8125_clear_phy_mcu_patch_request(tp); - - rtl8125_set_phy_mcu_patch_request(tp); - - rtl8125_real_set_phy_mcu_8125d_1_2(dev); - - rtl8125_clear_phy_mcu_patch_request(tp); - - rtl8125_set_phy_mcu_patch_request(tp); - - rtl8125_real_set_phy_mcu_8125d_1_3(dev); - - rtl8125_clear_phy_mcu_patch_request(tp); -} - -static void -rtl8125_real_set_phy_mcu_8125d_2_1(struct net_device *dev) -{ - rtl8125_set_phy_mcu_ram_code(dev, - phy_mcu_ram_code_8125d_2_1, - ARRAY_SIZE(phy_mcu_ram_code_8125d_2_1)); -} - -static void -rtl8125_set_phy_mcu_8125d_2(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - rtl8125_set_phy_mcu_patch_request(tp); - - rtl8125_real_set_phy_mcu_8125d_2_1(dev); - - rtl8125_clear_phy_mcu_patch_request(tp); -} - -static void -rtl8125_real_set_phy_mcu_8125bp_1_1(struct net_device *dev) -{ - rtl8125_set_phy_mcu_ram_code(dev, - phy_mcu_ram_code_8125bp_1_1, - ARRAY_SIZE(phy_mcu_ram_code_8125bp_1_1)); -} - -static void -rtl8125_real_set_phy_mcu_8125bp_1_2(struct net_device *dev) -{ - rtl8125_set_phy_mcu_ram_code(dev, - phy_mcu_ram_code_8125bp_1_2, - ARRAY_SIZE(phy_mcu_ram_code_8125bp_1_2)); -} - -static void -rtl8125_set_phy_mcu_8125bp_1(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - rtl8125_set_phy_mcu_patch_request(tp); - - rtl8125_real_set_phy_mcu_8125bp_1_1(dev); - - rtl8125_clear_phy_mcu_patch_request(tp); - - rtl8125_set_phy_mcu_patch_request(tp); - - rtl8125_real_set_phy_mcu_8125bp_1_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 (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) - 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; - case CFG_METHOD_8: - rtl8125_set_phy_mcu_8125bp_1(dev); - break; - case CFG_METHOD_9: - /* nothing to do */ - break; - case CFG_METHOD_10: - rtl8125_set_phy_mcu_8125d_1(dev); - break; - case CFG_METHOD_11: - rtl8125_set_phy_mcu_8125d_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) - rtl8125_set_eth_phy_ocp_bit(tp, 0xA430, BIT_2); -} + //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); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xAD40, - 0x03FF, - 0x84); - - rtl8125_set_eth_phy_ocp_bit(tp, 0xAD4E, BIT_4); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xAD16, - 0x03FF, - 0x0006); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xAD32, - 0x003F, - 0x0006); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xAC08, BIT_12); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xAC08, BIT_8); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xAC8A, - BIT_15|BIT_14|BIT_13|BIT_12, - BIT_14|BIT_13|BIT_12); - rtl8125_set_eth_phy_ocp_bit(tp, 0xAD18, BIT_10); - rtl8125_set_eth_phy_ocp_bit(tp, 0xAD1A, 0x3FF); - rtl8125_set_eth_phy_ocp_bit(tp, 0xAD1C, 0x3FF); - - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x80EA); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - 0xFF00, - 0xC400); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x80EB); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - 0x0700, - 0x0300); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x80F8); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - 0xFF00, - 0x1C00); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x80F1); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - 0xFF00, - 0x3000); - - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x80FE); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - 0xFF00, - 0xA500); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8102); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - 0xFF00, - 0x5000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8105); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - 0xFF00, - 0x3300); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8100); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - 0xFF00, - 0x7000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8104); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - 0xFF00, - 0xF000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8106); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - 0xFF00, - 0x6500); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x80DC); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - 0xFF00, - 0xED00); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x80DF); - rtl8125_set_eth_phy_ocp_bit(tp, 0xA438, BIT_8); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x80E1); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA438, BIT_8); - - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xBF06, - 0x003F, - 0x38); - - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x819F); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xD0B6); - - rtl8125_mdio_direct_write_phy_ocp(tp, 0xBC34, 0x5555); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xBF0A, - BIT_11|BIT_10|BIT_9, - BIT_11|BIT_9); - - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA5C0, BIT_10); - - rtl8125_set_eth_phy_ocp_bit(tp, 0xA442, BIT_11); + 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 && HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) - rtl8125_enable_phy_aldps(tp); + if (aspm) { + if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) { + rtl8125_enable_phy_aldps(tp); + } + } } static void @@ -12496,189 +7448,198 @@ rtl8125_hw_phy_config_8125a_2(struct net_device *dev) { struct rtl8125_private *tp = netdev_priv(dev); - rtl8125_set_eth_phy_ocp_bit(tp, 0xAD4E, BIT_4); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xAD16, - 0x03FF, - 0x03FF); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xAD32, - 0x003F, - 0x0006); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xAC08, BIT_12); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xAC08, BIT_8); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xACC0, - BIT_1|BIT_0, - BIT_1); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xAD40, - BIT_7|BIT_6|BIT_5, - BIT_6); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xAD40, - BIT_2|BIT_1|BIT_0, - BIT_2); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xAC14, BIT_7); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xAC80, BIT_9|BIT_8); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xAC5E, - BIT_2|BIT_1|BIT_0, - BIT_1); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xAD4C, 0x00A8); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xAC5C, 0x01FF); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xAC8A, - BIT_7|BIT_6|BIT_5|BIT_4, - BIT_5|BIT_4); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8157); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xB87E, - 0xFF00, - 0x0500); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8159); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xB87E, - 0xFF00, - 0x0700); - - - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x80A2); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0153); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x809C); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0153); - - - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x81B3); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0043); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x00A7); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x00D6); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x00EC); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x00F6); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x00FB); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x00FD); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x00FF); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x00BB); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0058); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0029); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0013); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0009); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0004); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0002); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - - - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8257); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x020F); - - - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x80EA); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x7843); + 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); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xB896, BIT_0); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xB892, 0xFF00); - - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC091); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB890, 0x6E12); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC092); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB890, 0x1214); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC094); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB890, 0x1516); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC096); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB890, 0x171B); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC098); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB890, 0x1B1C); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC09A); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB890, 0x1F1F); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC09C); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB890, 0x2021); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC09E); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB890, 0x2224); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC0A0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB890, 0x2424); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC0A2); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB890, 0x2424); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC0A4); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB890, 0x2424); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC018); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB890, 0x0AF2); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC01A); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB890, 0x0D4A); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC01C); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB890, 0x0F26); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC01E); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB890, 0x118D); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC020); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB890, 0x14F3); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC022); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB890, 0x175A); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC024); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB890, 0x19C0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC026); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB890, 0x1C26); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC089); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB890, 0x6050); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC08A); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB890, 0x5F6E); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC08C); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB890, 0x6E6E); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC08E); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB890, 0x6E6E); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC090); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB890, 0x6E12); - - rtl8125_set_eth_phy_ocp_bit(tp, 0xB896, BIT_0); + 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); - rtl8125_set_eth_phy_ocp_bit(tp, 0xD068, BIT_13); + SetEthPhyOcpBit(tp, 0xD068, BIT_13); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x81A2); - rtl8125_set_eth_phy_ocp_bit(tp, 0xA438, BIT_8); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xB54C, - 0xFF00, - 0xDB00); + mdio_direct_write_phy_ocp(tp, 0xA436, 0x81A2); + SetEthPhyOcpBit(tp, 0xA438, BIT_8); + ClearAndSetEthPhyOcpBit(tp, + 0xB54C, + 0xFF00, + 0xDB00); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA454, BIT_0); + ClearEthPhyOcpBit(tp, 0xA454, BIT_0); - rtl8125_set_eth_phy_ocp_bit(tp, 0xA5D4, BIT_5); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xAD4E, BIT_4); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA86A, BIT_0); + SetEthPhyOcpBit(tp, 0xA5D4, BIT_5); + ClearEthPhyOcpBit(tp, 0xAD4E, BIT_4); + ClearEthPhyOcpBit(tp, 0xA86A, BIT_0); - rtl8125_set_eth_phy_ocp_bit(tp, 0xA442, BIT_11); + SetEthPhyOcpBit(tp, 0xA442, BIT_11); if (tp->RequirePhyMdiSwapPatch) { @@ -12695,128 +7656,152 @@ rtl8125_hw_phy_config_8125a_2(struct net_device *dev) u16 rg_lpf_cap_p2; u16 rg_lpf_cap_p3; - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xD068, - 0x0007, - 0x0001); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xD068, - 0x0018, - 0x0000); - adccal_offset_p0 = rtl8125_mdio_direct_read_phy_ocp(tp, 0xD06A); + ClearAndSetEthPhyOcpBit(tp, + 0xD068, + 0x0007, + 0x0001 + ); + ClearAndSetEthPhyOcpBit(tp, + 0xD068, + 0x0018, + 0x0000 + ); + adccal_offset_p0 = mdio_direct_read_phy_ocp(tp, 0xD06A); adccal_offset_p0 &= 0x07FF; - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xD068, - 0x0018, - 0x0008); - adccal_offset_p1 = rtl8125_mdio_direct_read_phy_ocp(tp, 0xD06A); + ClearAndSetEthPhyOcpBit(tp, + 0xD068, + 0x0018, + 0x0008 + ); + adccal_offset_p1 = mdio_direct_read_phy_ocp(tp, 0xD06A); adccal_offset_p1 &= 0x07FF; - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xD068, - 0x0018, - 0x0010); - adccal_offset_p2 = rtl8125_mdio_direct_read_phy_ocp(tp, 0xD06A); + ClearAndSetEthPhyOcpBit(tp, + 0xD068, + 0x0018, + 0x0010 + ); + adccal_offset_p2 = mdio_direct_read_phy_ocp(tp, 0xD06A); adccal_offset_p2 &= 0x07FF; - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xD068, - 0x0018, - 0x0018); - adccal_offset_p3 = rtl8125_mdio_direct_read_phy_ocp(tp, 0xD06A); + ClearAndSetEthPhyOcpBit(tp, + 0xD068, + 0x0018, + 0x0018 + ); + adccal_offset_p3 = mdio_direct_read_phy_ocp(tp, 0xD06A); adccal_offset_p3 &= 0x07FF; - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xD068, - 0x0018, - 0x0000); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xD06A, - 0x07FF, - adccal_offset_p3); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xD068, - 0x0018, - 0x0008); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xD06A, - 0x07FF, - adccal_offset_p2); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xD068, - 0x0018, - 0x0010); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xD06A, - 0x07FF, - adccal_offset_p1); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xD068, - 0x0018, - 0x0018); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xD06A, - 0x07FF, - adccal_offset_p0); - - - rg_lpf_cap_xg_p0 = rtl8125_mdio_direct_read_phy_ocp(tp, 0xBD5A); + 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 = rtl8125_mdio_direct_read_phy_ocp(tp, 0xBD5A); + rg_lpf_cap_xg_p1 = mdio_direct_read_phy_ocp(tp, 0xBD5A); rg_lpf_cap_xg_p1 &= 0x1F00; - rg_lpf_cap_xg_p2 = rtl8125_mdio_direct_read_phy_ocp(tp, 0xBD5C); + rg_lpf_cap_xg_p2 = mdio_direct_read_phy_ocp(tp, 0xBD5C); rg_lpf_cap_xg_p2 &= 0x001F; - rg_lpf_cap_xg_p3 = rtl8125_mdio_direct_read_phy_ocp(tp, 0xBD5C); + rg_lpf_cap_xg_p3 = mdio_direct_read_phy_ocp(tp, 0xBD5C); rg_lpf_cap_xg_p3 &= 0x1F00; - rg_lpf_cap_p0 = rtl8125_mdio_direct_read_phy_ocp(tp, 0xBC18); + rg_lpf_cap_p0 = mdio_direct_read_phy_ocp(tp, 0xBC18); rg_lpf_cap_p0 &= 0x001F; - rg_lpf_cap_p1 = rtl8125_mdio_direct_read_phy_ocp(tp, 0xBC18); + rg_lpf_cap_p1 = mdio_direct_read_phy_ocp(tp, 0xBC18); rg_lpf_cap_p1 &= 0x1F00; - rg_lpf_cap_p2 = rtl8125_mdio_direct_read_phy_ocp(tp, 0xBC1A); + rg_lpf_cap_p2 = mdio_direct_read_phy_ocp(tp, 0xBC1A); rg_lpf_cap_p2 &= 0x001F; - rg_lpf_cap_p3 = rtl8125_mdio_direct_read_phy_ocp(tp, 0xBC1A); + rg_lpf_cap_p3 = mdio_direct_read_phy_ocp(tp, 0xBC1A); rg_lpf_cap_p3 &= 0x1F00; - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xBD5A, - 0x001F, - rg_lpf_cap_xg_p3 >> 8); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xBD5A, - 0x1F00, - rg_lpf_cap_xg_p2 << 8); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xBD5C, - 0x001F, - rg_lpf_cap_xg_p1 >> 8); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xBD5C, - 0x1F00, - rg_lpf_cap_xg_p0 << 8); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xBC18, - 0x001F, - rg_lpf_cap_p3 >> 8); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xBC18, - 0x1F00, - rg_lpf_cap_p2 << 8); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xBC1A, - 0x001F, - rg_lpf_cap_p1 >> 8); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xBC1A, - 0x1F00, - rg_lpf_cap_p0 << 8); - } - - - rtl8125_set_eth_phy_ocp_bit(tp, 0xA424, BIT_3); - - - if (aspm && HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) - rtl8125_enable_phy_aldps(tp); + 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 + ); + } + + + SetEthPhyOcpBit(tp, 0xA424, BIT_3); + + + if (aspm) { + if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) { + rtl8125_enable_phy_aldps(tp); + } + } } static void @@ -12824,269 +7809,284 @@ rtl8125_hw_phy_config_8125b_1(struct net_device *dev) { struct rtl8125_private *tp = netdev_priv(dev); - rtl8125_set_eth_phy_ocp_bit(tp, 0xA442, BIT_11); + SetEthPhyOcpBit(tp, 0xA442, BIT_11); - rtl8125_set_eth_phy_ocp_bit(tp, 0xBC08, (BIT_3 | BIT_2)); + SetEthPhyOcpBit(tp, 0xBC08, (BIT_3 | BIT_2)); if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) { - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8FFF); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - 0xFF00, - 0x0400); - } - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8560); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x19CC); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8562); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x19CC); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8564); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x19CC); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8566); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x147D); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8568); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x147D); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x856A); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x147D); + 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)) { - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FFE); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0907); - } - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xACDA, - 0xFF00, - 0xFF00); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xACDE, - 0xF000, - 0xF000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x80D6); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x2801); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x80F2); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x2801); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x80F4); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x6077); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB506, 0x01E7); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xAC8C, 0x0FFC); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xAC46, 0xB7B4); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xAC50, 0x0FBC); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xAC3C, 0x9240); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xAC4E, 0x0DB4); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xACC6, 0x0707); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xACC8, 0xA0D3); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xAD08, 0x0007); - - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8013); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0700); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FB9); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x2801); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FBA); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0100); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FBC); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x1900); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FBE); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87E, 0xE100); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FC0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0800); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FC2); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87E, 0xE500); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FC4); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0F00); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FC6); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87E, 0xF100); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FC8); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0400); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FCa); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87E, 0xF300); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FCc); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87E, 0xFD00); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FCe); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87E, 0xFF00); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FD0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87E, 0xFB00); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FD2); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0100); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FD4); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87E, 0xF400); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FD6); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87E, 0xFF00); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FD8); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87E, 0xF600); - - - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x813D); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x390E); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x814F); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x790E); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x80B0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0F31); - rtl8125_set_eth_phy_ocp_bit(tp, 0xBF4C, BIT_1); - rtl8125_set_eth_phy_ocp_bit(tp, 0xBCCA, (BIT_9 | BIT_8)); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8141); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x320E); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8153); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x720E); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA432, BIT_6); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8529); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x050E); - - - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x816C); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xC4A0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8170); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xC4A0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8174); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x04A0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8178); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x04A0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x817C); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0719); + 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)) { - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8FF4); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0400); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8FF1); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0404); - } - rtl8125_mdio_direct_write_phy_ocp(tp, 0xBF4A, 0x001B); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8033); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x7C13); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8037); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x7C13); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x803B); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87E, 0xFC32); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x803F); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x7C13); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8043); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x7C13); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8047); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x7C13); - - - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8145); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x370E); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8157); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x770E); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8169); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0D0A); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x817B); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x1D0A); - - - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8217); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - 0xFF00, - 0x5000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x821A); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - 0xFF00, - 0x5000); - - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x80DA); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0403); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x80DC); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - 0xFF00, - 0x1000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x80B3); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0384); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x80B7); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x2007); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x80BA); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - 0xFF00, - 0x6C00); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x80B5); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xF009); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x80BD); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - 0xFF00, - 0x9F00); - - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x80C7); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xf083); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x80DD); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x03f0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x80DF); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - 0xFF00, - 0x1000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x80CB); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x2007); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x80CE); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - 0xFF00, - 0x6C00); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x80C9); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8009); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x80D1); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - 0xFF00, - 0x8000); - - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x80A3); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x200A); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x80A5); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xF0AD); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x809F); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x6073); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x80A1); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x000B); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x80A9); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - 0xFF00, - 0xC000); + 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); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xB896, BIT_0); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xB892, 0xFF00); - - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC23E); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB890, 0x0000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC240); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB890, 0x0103); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC242); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB890, 0x0507); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC244); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB890, 0x090B); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC246); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB890, 0x0C0E); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC248); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB890, 0x1012); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB88E, 0xC24A); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB890, 0x1416); - - rtl8125_set_eth_phy_ocp_bit(tp, 0xB896, BIT_0); + 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); - rtl8125_set_eth_phy_ocp_bit(tp, 0xA86A, BIT_0); - rtl8125_set_eth_phy_ocp_bit(tp, 0xA6F0, BIT_0); + SetEthPhyOcpBit(tp, 0xA86A, BIT_0); + SetEthPhyOcpBit(tp, 0xA6F0, BIT_0); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xBFA0, 0xD70D); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xBFA2, 0x4100); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xBFA4, 0xE868); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xBFA6, 0xDC59); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB54C, 0x3C18); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xBFA4, BIT_5); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x817D); - rtl8125_set_eth_phy_ocp_bit(tp, 0xA438, BIT_12); + 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 && HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) - rtl8125_enable_phy_aldps(tp); + if (aspm) { + if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) { + rtl8125_enable_phy_aldps(tp); + } + } } static void @@ -13094,487 +8094,107 @@ rtl8125_hw_phy_config_8125b_2(struct net_device *dev) { struct rtl8125_private *tp = netdev_priv(dev); - rtl8125_set_eth_phy_ocp_bit(tp, 0xA442, BIT_11); - - - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xAC46, - 0x00F0, - 0x0090); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xAD30, - 0x0003, - 0x0001); - - - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x80F5); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x760E); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8107); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x360E); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8551); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xB87E, - BIT_15 | BIT_14 | BIT_13 | BIT_12 | BIT_11 | BIT_10 | BIT_9 | BIT_8, - BIT_11); - - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xbf00, - 0xE000, - 0xA000); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xbf46, - 0x0F00, - 0x0300); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xa436, 0x8044); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xa438, 0x2417); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xa436, 0x804A); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xa438, 0x2417); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xa436, 0x8050); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xa438, 0x2417); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xa436, 0x8056); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xa438, 0x2417); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xa436, 0x805C); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xa438, 0x2417); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xa436, 0x8062); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xa438, 0x2417); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xa436, 0x8068); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xa438, 0x2417); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xa436, 0x806E); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xa438, 0x2417); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xa436, 0x8074); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xa438, 0x2417); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xa436, 0x807A); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xa438, 0x2417); - - - rtl8125_set_eth_phy_ocp_bit(tp, 0xA4CA, BIT_6); - - - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xBF84, - BIT_15 | BIT_14 | BIT_13, - BIT_15 | BIT_13); - - - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8170); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - BIT_13 | BIT_10 | BIT_9 | BIT_8, - BIT_15 | BIT_14 | BIT_12 | BIT_11); - - - rtl8125_set_eth_phy_ocp_bit(tp, 0xA424, BIT_3); + 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 + ); + + + SetEthPhyOcpBit(tp, 0xA424, BIT_3); /* - rtl8125_mdio_direct_write_phy_ocp(tp, 0xBFA0, 0xD70D); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xBFA2, 0x4100); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xBFA4, 0xE868); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xBFA6, 0xDC59); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB54C, 0x3C18); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xBFA4, BIT_5); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x817D); - rtl8125_set_eth_phy_ocp_bit(tp, 0xA438, BIT_12); + 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); */ +#ifdef ENABLE_LIB_SUPPORT + /* disable phy speed down */ + ClearEthPhyOcpBit(tp, 0xA442, BIT_3 | BIT_2); +#endif /* ENABLE_LIB_SUPPORT */ - if (aspm && HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) - rtl8125_enable_phy_aldps(tp); -} - -static void -rtl8125_hw_phy_config_8125bp_1(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - rtl8125_set_eth_phy_ocp_bit(tp, 0xA442, BIT_11); - - - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA80C, - BIT_14, - BIT_15 | BIT_11 | BIT_10); - - - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8010); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA438, BIT_11); - - - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8088); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xB87E, - 0xFF00, - 0x9000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x808F); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xB87E, - 0xFF00, - 0x9000); - - - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8174); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - BIT_13, - BIT_12 | BIT_11); - - - if (aspm && HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) - rtl8125_enable_phy_aldps(tp); -} - -static void -rtl8125_hw_phy_config_8125bp_2(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - rtl8125_set_eth_phy_ocp_bit(tp, 0xA442, BIT_11); - - - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8010); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA438, BIT_11); - - - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8088); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xB87E, - 0xFF00, - 0x9000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x808F); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xB87E, - 0xFF00, - 0x9000); - - - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8174); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - BIT_13, - BIT_12 | BIT_11); - - - if (aspm && HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) - rtl8125_enable_phy_aldps(tp); -} - -static void -rtl8125_hw_phy_config_8125d_1(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - rtl8125_set_eth_phy_ocp_bit(tp, 0xA442, BIT_11); - - - rtl8125_set_phy_mcu_patch_request(tp); - - rtl8125_set_eth_phy_ocp_bit(tp, 0xBF96, BIT_15); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xBF94, - 0x0007, - 0x0005); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xBF8E, - 0x3C00, - 0x2800); - - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xBCD8, - 0xC000, - 0x4000); - rtl8125_set_eth_phy_ocp_bit(tp, 0xBCD8, BIT_15 | BIT_14); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xBCD8, - 0xC000, - 0x4000); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xBC80, - 0x001F, - 0x0004); - rtl8125_set_eth_phy_ocp_bit(tp, 0xBC82, BIT_15 | BIT_14 | BIT_13); - rtl8125_set_eth_phy_ocp_bit(tp, 0xBC82, BIT_12 | BIT_11 | BIT_10); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xBC80, - 0x001F, - 0x0005); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xBC82, - 0x00E0, - 0x0040); - rtl8125_set_eth_phy_ocp_bit(tp, 0xBC82, BIT_4 | BIT_3 | BIT_2); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xBCD8, BIT_15 | BIT_14); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xBCD8, - 0xC000, - 0x8000); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xBCD8, BIT_15 | BIT_14); - - rtl8125_clear_phy_mcu_patch_request(tp); - - - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x832C); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xB87E, - 0xFF00, - 0x0500); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xB106, - 0x0700, - 0x0100); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xB206, - 0x0700, - 0x0200); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xB306, - 0x0700, - 0x0300); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x80CB); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xB87E, - 0xFF00, - 0x0300); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xBCF4, 0x0000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xBCF6, 0x0000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xBC12, 0x0000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x844d); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xB87E, - 0xFF00, - 0x0200); - if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) { - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8feb); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xB87E, - 0xFF00, - 0x0100); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8fe9); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xB87E, - 0xFF00, - 0x0600); - } - - - rtl8125_clear_eth_phy_ocp_bit(tp, 0xAD40, BIT_5 | BIT_4); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xAD66, - 0x000F, - 0x0007); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xAD68, - 0xF000, - 0x8000); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xAD68, - 0x0F00, - 0x0500); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xAD68, - 0x000F, - 0x0002); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xAD6A, - 0xF000, - 0x7000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xAC50, 0x01E8); - - - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x81FA); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - 0xFF00, - 0x5400); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA864, - 0x00F0, - 0x00C0); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA42C, - 0x00FF, - 0x0002); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x80E1); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - 0xFF00, - 0x0F00); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x80DE); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - 0xF000, - 0x0700); - rtl8125_set_eth_phy_ocp_bit(tp, 0xA846, BIT_7); - - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x80BA); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8A04); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x80BD); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - 0xFF00, - 0xCA00); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x80B7); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - 0xFF00, - 0xB300); - - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x80CE); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8A04); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x80D1); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - 0xFF00, - 0xCA00); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x80CB); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - 0xFF00, - 0xBB00); - - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x80A6); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x4909); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x80A8); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x05B8); - - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8200); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - 0xFF00, - 0x5800); - - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8FF1); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x7078); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8FF3); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x5D78); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8FF5); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x7862); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8FF7); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - 0xFF00, - 0x1400); - - - if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) { - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x814C); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x8455); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x814E); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x84A6); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8163); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - 0xFF00, - 0x0600); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x816A); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - 0xFF00, - 0x0500); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8171); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - 0xFF00, - 0x1f00); - } - - - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xBC3A, - 0x000F, - 0x0006); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8064); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA438, BIT_10 | BIT_9 | BIT_8); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8067); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA438, BIT_10 | BIT_9 | BIT_8); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x806A); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA438, BIT_10 | BIT_9 | BIT_8); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x806D); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA438, BIT_10 | BIT_9 | BIT_8); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8070); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA438, BIT_10 | BIT_9 | BIT_8); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8073); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA438, BIT_10 | BIT_9 | BIT_8); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8076); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA438, BIT_10 | BIT_9 | BIT_8); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8079); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA438, BIT_10 | BIT_9 | BIT_8); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x807C); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA438, BIT_10 | BIT_9 | BIT_8); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x807F); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA438, BIT_10 | BIT_9 | BIT_8); - - - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xBFA0, - 0xFF70, - 0x5500); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xBFA2, 0x9D00); - - - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8165); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - 0x0700, - 0x0200); - - - if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) { - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8019); - rtl8125_set_eth_phy_ocp_bit(tp, 0xA438, BIT_8); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8FE3); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0005); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x00ED); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0502); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0B00); - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA438, 0xD401); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - 0xFF00, - 0x2900); - } - - - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8018); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - 0xFF00, - 0x1700); - - - if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) { - rtl8125_mdio_direct_write_phy_ocp(tp, 0xA436, 0x815B); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - 0xFF00, - 0x1700); + if (aspm) { + if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) { + rtl8125_enable_phy_aldps(tp); + } } - - - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA4E0, BIT_15); - - - rtl8125_set_eth_phy_ocp_bit(tp, 0xA430, BIT_12 | BIT_0); - rtl8125_set_eth_phy_ocp_bit(tp, 0xA442, BIT_7); - - - if (aspm && HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) - rtl8125_enable_phy_aldps(tp); -} - -static void -rtl8125_hw_phy_config_8125d_2(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - rtl8125_set_eth_phy_ocp_bit(tp, 0xA442, BIT_11); - - - rtl8125_set_eth_phy_ocp_bit(tp, 0xA430, BIT_12 | BIT_0); - rtl8125_set_eth_phy_ocp_bit(tp, 0xA442, BIT_7); - - - if (aspm && HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) - rtl8125_enable_phy_aldps(tp); } static void @@ -13582,18 +8202,11 @@ rtl8125_hw_phy_config(struct net_device *dev) { struct rtl8125_private *tp = netdev_priv(dev); - if (tp->resume_not_chg_speed) - return; + if (tp->resume_not_chg_speed) return; tp->phy_reset_enable(dev); -#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 + if (HW_DASH_SUPPORT_TYPE_3(tp) && tp->HwPkgDet == 0x06) return; switch (tp->mcfg) { case CFG_METHOD_2: @@ -13610,18 +8223,6 @@ rtl8125_hw_phy_config(struct net_device *dev) case CFG_METHOD_7: rtl8125_hw_phy_config_8125b_2(dev); break; - case CFG_METHOD_8: - rtl8125_hw_phy_config_8125bp_1(dev); - break; - case CFG_METHOD_9: - rtl8125_hw_phy_config_8125bp_2(dev); - break; - case CFG_METHOD_10: - rtl8125_hw_phy_config_8125d_1(dev); - break; - case CFG_METHOD_11: - rtl8125_hw_phy_config_8125d_2(dev); - break; } //legacy force mode(Chap 22) @@ -13632,12 +8233,10 @@ rtl8125_hw_phy_config(struct net_device *dev) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: default: - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA5B4, BIT_15); + rtl8125_mdio_write(tp, 0x1F, 0x0A5B); + rtl8125_clear_eth_phy_bit(tp, 0x12, BIT_15); + rtl8125_mdio_write(tp, 0x1F, 0x0000); break; } @@ -13741,51 +8340,42 @@ rtl8125_netpoll(struct net_device *dev) #endif //CONFIG_NET_POLL_CONTROLLER static void -rtl8125_setup_interrupt_mask(struct rtl8125_private *tp) +rtl8125_get_bios_setting(struct net_device *dev) { - int i; + struct rtl8125_private *tp = netdev_priv(dev); - if (tp->HwCurrIsrVer == 5) { - tp->intr_mask = ISRIMR_V5_LINKCHG | ISRIMR_V5_TOK_Q0; - if (tp->num_tx_rings > 1) - tp->intr_mask |= ISRIMR_V5_TOK_Q1; - for (i = 0; i < tp->num_rx_rings; i++) - tp->intr_mask |= ISRIMR_V5_ROK_Q0 << i; - } else if (tp->HwCurrIsrVer == 4) { - tp->intr_mask = ISRIMR_V4_LINKCHG; - for (i = 0; i < max(tp->num_tx_rings, tp->num_rx_rings); i++) - tp->intr_mask |= ISRIMR_V4_ROK_Q0 << i; - } else if (tp->HwCurrIsrVer == 3) { - tp->intr_mask = ISRIMR_V2_LINKCHG; - for (i = 0; i < max(tp->num_tx_rings, tp->num_rx_rings); i++) - tp->intr_mask |= ISRIMR_V2_ROK_Q0 << i; - } else if (tp->HwCurrIsrVer == 2) { - tp->intr_mask = ISRIMR_V2_LINKCHG | ISRIMR_TOK_Q0; - if (tp->num_tx_rings > 1) - tp->intr_mask |= ISRIMR_TOK_Q1; + 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; + } +} - 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; +static void +rtl8125_set_bios_setting(struct net_device *dev) +{ + struct rtl8125_private *tp = netdev_priv(dev); -#ifdef ENABLE_DASH_SUPPORT - if (tp->DASH) { - if (HW_DASH_SUPPORT_CMAC(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_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) { - u16 hw_clo_ptr0_reg, sw_tail_ptr0_reg; - u16 reg_len; int i; //tx @@ -13794,42 +8384,26 @@ rtl8125_setup_mqs_reg(struct rtl8125_private *tp) tp->tx_ring[i].tdsar_reg = (u16)(TNPDS_Q1_LOW_8125 + (i - 1) * 8); } - switch (tp->HwSuppTxNoCloseVer) { - case 4: - case 5: - hw_clo_ptr0_reg = HW_CLO_PTR0_8126; - sw_tail_ptr0_reg = SW_TAIL_PTR0_8126; - reg_len = 4; - break; - case 6: - hw_clo_ptr0_reg = HW_CLO_PTR0_8125BP; - sw_tail_ptr0_reg = SW_TAIL_PTR0_8125BP; - reg_len = 8; - break; - default: - hw_clo_ptr0_reg = HW_CLO_PTR0_8125; - sw_tail_ptr0_reg = SW_TAIL_PTR0_8125; - reg_len = 4; - break; - } - for (i = 0; i < R8125_MAX_TX_QUEUES; i++) { - tp->tx_ring[i].hw_clo_ptr_reg = (u16)(hw_clo_ptr0_reg + i * reg_len); - tp->tx_ring[i].sw_tail_ptr_reg = (u16)(sw_tail_ptr0_reg + i * reg_len); + 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++) + 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++) + 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++) + for (i = 1; i < R8125_MAX_QUEUES; i++) { tp->imr_reg[i] = (u16)(IMR1_8125 + (i - 1) * 4); + } } static void @@ -13838,40 +8412,22 @@ 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: { - u8 tmp = (u8)rtl8125_mac_ocp_read(tp, 0xD006); - if (tmp == 0x02 || tmp == 0x04) - tp->HwSuppDashVer = 2; - } - break; - case CFG_METHOD_8: - case CFG_METHOD_9: - tp->HwSuppDashVer = 4; + case CFG_METHOD_3: + //tp->HwSuppDashVer = 3; break; default: tp->HwSuppDashVer = 0; break; } - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - if (HW_DASH_SUPPORT_DASH(tp)) - tp->HwSuppOcpChannelVer = 2; - break; - case CFG_METHOD_8: - case CFG_METHOD_9: - tp->HwSuppOcpChannelVer = 2; - break; - } - tp->AllowAccessDashOcp = rtl8125_is_allow_access_dash_ocp(tp); - switch (tp->mcfg) { case CFG_METHOD_2: case CFG_METHOD_3: @@ -13879,15 +8435,14 @@ rtl8125_init_software_variable(struct net_device *dev) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: 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: @@ -13895,10 +8450,6 @@ rtl8125_init_software_variable(struct net_device *dev) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: tp->HwSuppNowIsOobVer = 1; break; } @@ -13912,25 +8463,52 @@ rtl8125_init_software_variable(struct net_device *dev) case CFG_METHOD_7: tp->HwPcieSNOffset = 0x16C; break; - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: - tp->HwPcieSNOffset = 0x168; - break; } #ifdef ENABLE_REALWOW_SUPPORT rtl8125_get_realwow_hw_version(dev); #endif //ENABLE_REALWOW_SUPPORT - tp->DASH = rtl8125_check_dash(tp); + 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; + } + } - if (tp->DASH) eee_enable = 0; + } - if (HW_DASH_SUPPORT_TYPE_2(tp)) - tp->cmac_ioaddr = tp->mmio_addr; + if (HW_DASH_SUPPORT_TYPE_3(tp)) + tp->cmac_ioaddr = tp->mapped_cmac_ioaddr; if (aspm) { switch (tp->mcfg) { @@ -13940,10 +8518,6 @@ rtl8125_init_software_variable(struct net_device *dev) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: tp->org_pci_offset_99 = rtl8125_csi_fun0_read_byte(tp, 0x99); tp->org_pci_offset_99 &= ~(BIT_5|BIT_6); break; @@ -13951,61 +8525,20 @@ rtl8125_init_software_variable(struct net_device *dev) 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; - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: - tp->org_pci_offset_180 = rtl8125_csi_fun0_read_byte(tp, 0x210); - 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: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: - default: - tp->use_timer_interrupt = TRUE; - break; - } - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: - tp->HwSuppMaxPhyLinkSpeed = 2500; - break; - default: - tp->HwSuppMaxPhyLinkSpeed = 1000; - break; + 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; + } } - if (timer_count == 0 || tp->mcfg == CFG_METHOD_DEFAULT) - tp->use_timer_interrupt = FALSE; + 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: @@ -14014,17 +8547,14 @@ rtl8125_init_software_variable(struct net_device *dev) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: - tp->ShortPacketSwChecksum = TRUE; - tp->UseSwPaddingShortPkt = TRUE; - break; 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: @@ -14032,8 +8562,6 @@ rtl8125_init_software_variable(struct net_device *dev) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_10: - case CFG_METHOD_11: tp->HwSuppMagicPktVer = WAKEUP_MAGIC_PACKET_V3; break; default: @@ -14048,10 +8576,6 @@ rtl8125_init_software_variable(struct net_device *dev) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: tp->HwSuppLinkChgWakeUpVer = 3; break; } @@ -14062,14 +8586,8 @@ rtl8125_init_software_variable(struct net_device *dev) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: tp->HwSuppD0SpeedUpVer = 1; break; - case CFG_METHOD_10: - case CFG_METHOD_11: - tp->HwSuppD0SpeedUpVer = 2; - break; } switch (tp->mcfg) { @@ -14079,10 +8597,6 @@ rtl8125_init_software_variable(struct net_device *dev) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: tp->HwSuppCheckPhyDisableModeVer = 3; break; } @@ -14096,28 +8610,6 @@ rtl8125_init_software_variable(struct net_device *dev) case CFG_METHOD_7: tp->HwSuppTxNoCloseVer = 3; break; - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: - tp->HwSuppTxNoCloseVer = 6; - break; - } - - switch (tp->HwSuppTxNoCloseVer) { - case 5: - case 6: - tp->MaxTxDescPtrMask = MAX_TX_NO_CLOSE_DESC_PTR_MASK_V4; - break; - case 4: - tp->MaxTxDescPtrMask = MAX_TX_NO_CLOSE_DESC_PTR_MASK_V3; - break; - case 3: - tp->MaxTxDescPtrMask = MAX_TX_NO_CLOSE_DESC_PTR_MASK_V2; - break; - default: - tx_no_close_enable = 0; - break; } if (tp->HwSuppTxNoCloseVer > 0 && tx_no_close_enable == 1) @@ -14146,18 +8638,6 @@ rtl8125_init_software_variable(struct net_device *dev) case CFG_METHOD_7: tp->sw_ram_code_ver = NIC_RAMCODE_VERSION_CFG_METHOD_5; break; - case CFG_METHOD_8: - tp->sw_ram_code_ver = NIC_RAMCODE_VERSION_CFG_METHOD_8; - break; - case CFG_METHOD_9: - tp->sw_ram_code_ver = NIC_RAMCODE_VERSION_CFG_METHOD_9; - break; - case CFG_METHOD_10: - tp->sw_ram_code_ver = NIC_RAMCODE_VERSION_CFG_METHOD_10; - break; - case CFG_METHOD_11: - tp->sw_ram_code_ver = NIC_RAMCODE_VERSION_CFG_METHOD_11; - break; } if (tp->HwIcVerUnknown) { @@ -14165,13 +8645,11 @@ rtl8125_init_software_variable(struct net_device *dev) tp->NotWrMcuPatchCode = TRUE; } - rtl8125_check_hw_phy_mcu_code_ver(dev); - switch (tp->mcfg) { case CFG_METHOD_3: case CFG_METHOD_6: if ((rtl8125_mac_ocp_read(tp, 0xD442) & BIT_5) && - (rtl8125_mdio_direct_read_phy_ocp(tp, 0xD068) & BIT_1)) + (mdio_direct_read_phy_ocp(tp, 0xD068) & BIT_1)) tp->RequirePhyMdiSwapPatch = TRUE; break; } @@ -14183,10 +8661,6 @@ rtl8125_init_software_variable(struct net_device *dev) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: tp->HwSuppMacMcuVer = 2; break; } @@ -14198,10 +8672,6 @@ rtl8125_init_software_variable(struct net_device *dev) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: tp->MacMcuPageSize = RTL8125_MAC_MCU_PAGE_SIZE; break; } @@ -14210,10 +8680,6 @@ rtl8125_init_software_variable(struct net_device *dev) case CFG_METHOD_4: case CFG_METHOD_5: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: tp->HwSuppNumTxQueues = 2; tp->HwSuppNumRxQueues = 4; break; @@ -14223,65 +8689,17 @@ rtl8125_init_software_variable(struct net_device *dev) break; } - 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; - case CFG_METHOD_8: - case CFG_METHOD_9: - tp->HwSuppIsrVer = 4; - break; - case CFG_METHOD_10: - case CFG_METHOD_11: - tp->HwSuppIsrVer = 5; - break; - default: - tp->HwSuppIsrVer = 1; - break; - } - - tp->HwCurrIsrVer = tp->HwSuppIsrVer; - if (tp->HwCurrIsrVer > 1) { - if (!(tp->features & RTL_FEATURE_MSIX) || - tp->irq_nvecs < tp->min_irq_nvecs || - (tp->DASH && HW_DASH_SUPPORT_TYPE_4(tp))) - tp->HwCurrIsrVer = 1; - } - tp->num_tx_rings = 1; #ifdef ENABLE_MULTIPLE_TX_QUEUE #ifndef ENABLE_LIB_SUPPORT tp->num_tx_rings = tp->HwSuppNumTxQueues; #endif #endif - if (tp->HwCurrIsrVer < 2 || - (tp->HwCurrIsrVer == 2 && tp->irq_nvecs < 19)) - tp->num_tx_rings = 1; - //RSS switch (tp->mcfg) { case CFG_METHOD_4: case CFG_METHOD_5: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: tp->HwSuppRssVer = 5; tp->HwSuppIndirTblEntries = 128; break; @@ -14293,7 +8711,7 @@ rtl8125_init_software_variable(struct net_device *dev) if (tp->HwSuppRssVer > 0) tp->EnableRss = 1; #else - if (tp->HwSuppRssVer > 0 && tp->HwCurrIsrVer > 1) { + 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; @@ -14307,51 +8725,77 @@ rtl8125_init_software_variable(struct net_device *dev) #endif #endif - //interrupt mask - rtl8125_setup_interrupt_mask(tp); - rtl8125_setup_mqs_reg(tp); rtl8125_set_ring_size(tp, NUM_RX_DESC, NUM_TX_DESC); 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; + tp->HwSuppPtpVer = 1; break; - case CFG_METHOD_8: - case CFG_METHOD_9: - tp->HwSuppIntMitiVer = 6; + } +#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; - case CFG_METHOD_10: - case CFG_METHOD_11: - tp->HwSuppIntMitiVer = 7; + 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_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: - tp->HwSuppTcamVer = 1; - - tp->TcamNotValidReg = TCAM_NOTVALID_ADDR; - tp->TcamValidReg = TCAM_VALID_ADDR; - tp->TcamMaAddrcOffset = TCAM_MAC_ADDR; - tp->TcamVlanTagOffset = TCAM_VLAN_TAG; + tp->HwSuppIntMitiVer = 4; break; } @@ -14362,82 +8806,52 @@ rtl8125_init_software_variable(struct net_device *dev) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: tp->HwSuppExtendTallyCounterVer = 1; break; } timer_count_v2 = (timer_count / 0x100); - /* timer unit is double */ - switch (tp->mcfg) { - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: - timer_count_v2 /= 2; - break; - } - - switch (tp->mcfg) { - case CFG_METHOD_10: - case CFG_METHOD_11: - tp->RequiredPfmPatch = TRUE; - break; - } +#ifndef ENABLE_LIB_SUPPORT 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->HwSuppRxDescType = RX_DESC_RING_TYPE_3; - break; - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: - tp->HwSuppRxDescType = RX_DESC_RING_TYPE_4; - break; - default: - tp->HwSuppRxDescType = RX_DESC_RING_TYPE_1; + 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; - switch (tp->HwSuppRxDescType) { - case RX_DESC_RING_TYPE_3: - if (tp->EnableRss || tp->EnablePtp) { - tp->InitRxDescType = RX_DESC_RING_TYPE_3; - tp->RxDescLength = RX_DESC_LEN_TYPE_3; - } - break; - case RX_DESC_RING_TYPE_4: - if (tp->EnableRss) { - tp->InitRxDescType = RX_DESC_RING_TYPE_4; - tp->RxDescLength = RX_DESC_LEN_TYPE_4; - } - break; - } + 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; - else if (tp->InitRxDescType == RX_DESC_RING_TYPE_4) - tp->rtl8125_rx_config &= ~EnableRxDescV4_1; tp->NicCustLedValue = RTL_R16(tp, CustomLED); tp->wol_opts = rtl8125_get_hw_wol(tp); tp->wol_enabled = (tp->wol_opts) ? WOL_ENABLED : WOL_DISABLED; - rtl8125_set_link_option(tp, autoneg_mode, speed_mode, duplex_mode, - rtl8125_fc_full); + 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) @@ -14447,44 +8861,18 @@ rtl8125_init_software_variable(struct net_device *dev) #endif //LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0) if (tp->mcfg != CFG_METHOD_DEFAULT) { - struct ethtool_keee *eee = &tp->eee; + struct ethtool_eee *eee = &tp->eee; eee->eee_enabled = eee_enable; -#if LINUX_VERSION_CODE < KERNEL_VERSION(6,9,0) eee->supported = SUPPORTED_100baseT_Full | SUPPORTED_1000baseT_Full; - eee->advertised = mmd_eee_adv_to_ethtool_adv_t(MDIO_EEE_1000T | MDIO_EEE_100TX); switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - /* nothing to do */ - break; - default: - if (HW_SUPP_PHY_LINK_SPEED_2500M(tp)) { - eee->supported |= SUPPORTED_2500baseX_Full; - eee->advertised |= SUPPORTED_2500baseX_Full; - } - break; - } -#else - linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT, eee->supported); - linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, eee->supported); - linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT, eee->advertised); - linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, eee->advertised); - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - /* nothing to do */ - break; - default: - if (HW_SUPP_PHY_LINK_SPEED_2500M(tp)) { - linkmode_set_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, eee->supported); - linkmode_set_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, eee->advertised); - } + case CFG_METHOD_4: + case CFG_METHOD_5: + eee->supported |= SUPPORTED_2500baseX_Full; break; } -#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(6,9,0) */ - eee->tx_lpi_enabled = eee_enable; + eee->advertised = mmd_eee_adv_to_ethtool_adv_t(MDIO_EEE_1000T | MDIO_EEE_100TX); eee->tx_lpi_timer = dev->mtu + ETH_HLEN + 0x20; } @@ -14503,6 +8891,7 @@ rtl8125_release_board(struct pci_dev *pdev, 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; @@ -14513,6 +8902,10 @@ rtl8125_release_board(struct pci_dev *pdev, 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); @@ -14540,14 +8933,15 @@ rtl8125_get_mac_address(struct net_device *dev) for (i = 0; i < MAC_ADDR_LEN; i++) mac_addr[i] = RTL_R8(tp, MAC0 + i); - switch (tp->mcfg) { - case CFG_METHOD_2 ... CFG_METHOD_11: + 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); - break; - default: - break; - }; + } if (!is_valid_ether_addr(mac_addr)) { netif_err(tp, probe, dev, "Invalid ether addr %pM\n", @@ -14565,7 +8959,7 @@ rtl8125_get_mac_address(struct net_device *dev) /* keep the original MAC address */ memcpy(tp->org_mac_addr, dev->dev_addr, MAC_ADDR_LEN); #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13) - memcpy(dev->perm_addr, dev->dev_addr, MAC_ADDR_LEN); + memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); #endif return 0; } @@ -15429,8 +9823,9 @@ rtl8125_phy_power_up(struct net_device *dev) { struct rtl8125_private *tp = netdev_priv(dev); - if (rtl8125_is_in_phy_disable_mode(dev)) + if (rtl8125_is_in_phy_disable_mode(dev)) { return; + } rtl8125_mdio_write(tp, 0x1F, 0x0000); rtl8125_mdio_write(tp, MII_BMCR, BMCR_ANENABLE); @@ -15443,10 +9838,6 @@ rtl8125_phy_power_up(struct net_device *dev) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: rtl8125_wait_phy_ups_resume(dev, 3); break; }; @@ -15769,8 +10160,8 @@ rtl8125_esd_checker(struct rtl8125_private *tp) 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); - netif_tx_disable(dev); rtl8125_hw_reset(dev); rtl8125_tx_clear(tp); rtl8125_rx_clear(tp); @@ -15829,32 +10220,8 @@ rtl8125_link_timer(struct timer_list *t) } */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,14,0) -static int pci_enable_msix_range(struct pci_dev *dev, struct msix_entry *entries, - int minvec, int maxvec) -{ - int nvec = maxvec; - int rc; - - if (maxvec < minvec) - return -ERANGE; - - do { - rc = pci_enable_msix(dev, entries, nvec); - if (rc < 0) { - return rc; - } else if (rc > 0) { - if (rc < minvec) - return -ENOSPC; - nvec = rc; - } - } while (rc); - - return nvec; -} -#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,14,0) */ - -static int rtl8125_enable_msix(struct rtl8125_private *tp) +int +rtl8125_enable_msix(struct rtl8125_private *tp) { int i, nvecs = 0; struct msix_entry msix_ent[R8125_MAX_MSIX_VEC]; @@ -15882,59 +10249,44 @@ static int rtl8125_enable_msix(struct rtl8125_private *tp) 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 int hw_supp_irq_nvecs; unsigned msi = 0; int nvecs = 1; - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - hw_supp_irq_nvecs = R8125_MAX_MSIX_VEC_8125A; - break; - case CFG_METHOD_4 ... CFG_METHOD_7: - hw_supp_irq_nvecs = R8125_MAX_MSIX_VEC_8125B; - break; - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: - hw_supp_irq_nvecs = R8125_MAX_MSIX_VEC_8125D; - break; - default: - hw_supp_irq_nvecs = 1; - break; - } - tp->hw_supp_irq_nvecs = clamp_val(hw_supp_irq_nvecs, 1, - R8125_MAX_MSIX_VEC); - + 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 = tp->hw_supp_irq_nvecs; + tp->max_irq_nvecs = R8125_MAX_MSIX_VEC_8125B; tp->min_irq_nvecs = R8125_MIN_MSIX_VEC_8125B; break; - case CFG_METHOD_8: - case CFG_METHOD_9: - tp->max_irq_nvecs = tp->hw_supp_irq_nvecs; - tp->min_irq_nvecs = R8125_MIN_MSIX_VEC_8125BP; - break; - case CFG_METHOD_10: - case CFG_METHOD_11: - tp->max_irq_nvecs = tp->hw_supp_irq_nvecs; - tp->min_irq_nvecs = R8125_MIN_MSIX_VEC_8125D; - break; - default: - tp->max_irq_nvecs = 1; - tp->min_irq_nvecs = 1; - break; } -#ifdef DISABLE_MULTI_MSIX_VECTOR - tp->max_irq_nvecs = 1; #endif #if defined(RTL_USE_NEW_INTR_API) @@ -15985,57 +10337,11 @@ static int rtl8125_get_irq(struct pci_dev *pdev) #endif } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0) -static void -rtl8125_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) -{ - struct rtl8125_private *tp = netdev_priv(dev); - struct rtl8125_counters *counters = tp->tally_vaddr; - dma_addr_t paddr = tp->tally_paddr; - - if (!counters) - return; - - netdev_stats_to_stats64(stats, &dev->stats); - dev_fetch_sw_netstats(stats, dev->tstats); - - /* - * Fetch additional counter values missing in stats collected by driver - * from tally counters. - */ - rtl8125_dump_tally_counter(tp, paddr); - - stats->tx_errors = le64_to_cpu(counters->tx_errors); - stats->collisions = le32_to_cpu(counters->tx_multi_collision); - stats->tx_aborted_errors = le16_to_cpu(counters->tx_aborted); - stats->rx_missed_errors = le16_to_cpu(counters->rx_missed); -} -#else -/** - * 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; -} -#endif //LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36) - #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, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0) - .ndo_get_stats64 = rtl8125_get_stats64, -#else .ndo_get_stats = rtl8125_get_stats, -#endif //LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0) .ndo_start_xmit = rtl8125_start_xmit, .ndo_tx_timeout = rtl8125_tx_timeout, .ndo_change_mtu = rtl8125_change_mtu, @@ -16092,8 +10398,7 @@ static int rtl8125_poll(napi_ptr napi, napi_budget budget) #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; + 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 @@ -16111,6 +10416,7 @@ static int rtl8125_poll(napi_ptr napi, napi_budget budget) 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); @@ -16133,8 +10439,7 @@ static int rtl8125_poll_msix_ring(napi_ptr napi, napi_budget budget) #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; + 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 @@ -16151,6 +10456,7 @@ static int rtl8125_poll_msix_ring(napi_ptr napi, napi_budget budget) return RTL_NAPI_RETURN_VALUE; } +#endif static int rtl8125_poll_msix_tx(napi_ptr napi, napi_budget budget) { @@ -16170,8 +10476,7 @@ static int rtl8125_poll_msix_tx(napi_ptr napi, napi_budget 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; + 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 @@ -16199,7 +10504,6 @@ static int rtl8125_poll_msix_other(napi_ptr napi, napi_budget budget) //suppress unused variable (void)(dev); - (void)(work_to_do); #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0) RTL_NETIF_RX_COMPLETE(dev, napi, work_to_do); @@ -16227,8 +10531,7 @@ static int rtl8125_poll_msix_rx(napi_ptr napi, napi_budget 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; + 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 @@ -16271,7 +10574,7 @@ 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++) + for (i = 0; i < tp->irq_nvecs && i < R8125_MAX_MSIX_VEC; i++) RTL_NAPI_DEL((&tp->r8125napi[i])); #endif } @@ -16286,33 +10589,16 @@ static void rtl8125_init_napi(struct rtl8125_private *tp) #ifdef CONFIG_R8125_NAPI int (*poll)(struct napi_struct *, int); - poll = rtl8125_poll; - if (tp->features & RTL_FEATURE_MSIX) { - switch (tp->HwCurrIsrVer) { - case 5: - if (i < R8125_MAX_RX_QUEUES_VEC_V3) - poll = rtl8125_poll_msix_rx; - else if (i == 16 || i == 17) - poll = rtl8125_poll_msix_tx; - else - poll = rtl8125_poll_msix_other; - break; - case 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; - break; - case 3: - case 4: - if (i < R8125_MAX_RX_QUEUES_VEC_V3) - poll = rtl8125_poll_msix_ring; - else - poll = rtl8125_poll_msix_other; - break; - } + 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); @@ -16340,18 +10626,6 @@ rtl8125_set_real_num_queue(struct rtl8125_private *tp) return retval; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(6,2,0) -void netdev_sw_irq_coalesce_default_on(struct net_device *dev) -{ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0) - WARN_ON(dev->reg_state == NETREG_REGISTERED); - - dev->gro_flush_timeout = 20000; - dev->napi_defer_hard_irqs = 1; -#endif //LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0) -} -#endif //LINUX_VERSION_CODE < KERNEL_VERSION(6,2,0) - static int __devinit rtl8125_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) @@ -16369,7 +10643,7 @@ rtl8125_init_one(struct pci_dev *pdev, board_idx++; if (netif_msg_drv(&debug)) - printk(KERN_INFO "%s Ethernet controller driver %s loaded\n", + printk(KERN_INFO "%s 2.5Gigabit Ethernet driver %s loaded\n", MODULENAME, RTL8125_VERSION); rc = rtl8125_init_board(pdev, &dev, &ioaddr); @@ -16385,19 +10659,14 @@ rtl8125_init_one(struct pci_dev *pdev, tp->phy_reset_pending = rtl8125_xmii_reset_pending; tp->link_ok = rtl8125_xmii_link_ok; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0) - dev->tstats = devm_netdev_alloc_pcpu_stats(&pdev->dev, - struct pcpu_sw_netstats); - if (!dev->tstats) - goto err_out_1; -#endif //LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0) - 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); @@ -16433,16 +10702,6 @@ rtl8125_init_one(struct pci_dev *pdev, tp->cp_cmd |= RxChkSum; #else dev->features |= NETIF_F_RXCSUM; - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_6: - /* nothing to do */ - break; - default: - dev->features |= NETIF_F_SG | NETIF_F_TSO; - break; - }; 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 | @@ -16454,17 +10713,7 @@ rtl8125_init_one(struct pci_dev *pdev, 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; - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_6: - /* nothing to do */ - break; - default: - dev->features |= NETIF_F_TSO6; - break; - }; + dev->features |= NETIF_F_IPV6_CSUM; #if LINUX_VERSION_CODE >= KERNEL_VERSION(5,19,0) netif_set_tso_max_size(dev, LSO_64K); netif_set_tso_max_segs(dev, NIC_MAX_PHYS_BUF_COUNT_LSO2); @@ -16484,20 +10733,18 @@ rtl8125_init_one(struct pci_dev *pdev, #ifdef ENABLE_RSS_SUPPORT if (tp->EnableRss) { dev->hw_features |= NETIF_F_RXHASH; - dev->features |= NETIF_F_RXHASH; + dev->features |= NETIF_F_RXHASH; } #endif } - netdev_sw_irq_coalesce_default_on(dev); - #ifdef ENABLE_DASH_SUPPORT if (tp->DASH) AllocateDashShareMemory(dev); #endif #ifdef ENABLE_LIB_SUPPORT - BLOCKING_INIT_NOTIFIER_HEAD(&tp->lib_nh); + ATOMIC_INIT_NOTIFIER_HEAD(&tp->lib_nh); #endif rtl8125_init_all_schedule_work(tp); @@ -16546,10 +10793,6 @@ rtl8125_init_one(struct pci_dev *pdev, netif_carrier_off(dev); -#ifdef ENABLE_R8125_SYSFS - rtl8125_sysfs_init(dev); -#endif /* ENABLE_R8125_SYSFS */ - printk("%s", GPL_CLAIM); out: @@ -16589,13 +10832,9 @@ rtl8125_remove_one(struct pci_dev *pdev) #ifdef CONFIG_R8125_NAPI rtl8125_del_napi(tp); #endif - if (HW_DASH_SUPPORT_DASH(tp)) + if (tp->DASH) rtl8125_driver_stop(tp); -#ifdef ENABLE_R8125_SYSFS - rtl8125_sysfs_remove(dev); -#endif //ENABLE_R8125_SYSFS - unregister_netdev(dev); rtl8125_disable_msi(pdev, tp); #ifdef ENABLE_R8125_PROCFS @@ -16615,33 +10854,16 @@ rtl8125_remove_one(struct pci_dev *pdev) pci_set_drvdata(pdev, NULL); } -#ifdef ENABLE_PAGE_REUSE -static inline unsigned int rtl8125_rx_page_order(unsigned rx_buf_sz, unsigned page_size) -{ - unsigned truesize = SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) + - SKB_DATA_ALIGN(rx_buf_sz + R8125_RX_ALIGN); - - return get_order(truesize * 2); -} -#endif //ENABLE_PAGE_REUSE - static void rtl8125_set_rxbufsize(struct rtl8125_private *tp, struct net_device *dev) { unsigned int mtu = dev->mtu; - tp->rms = (mtu > ETH_DATA_LEN) ? - mtu + ETH_HLEN + RT_VALN_HLEN + ETH_FCS_LEN: - RX_BUF_SIZE; - tp->rx_buf_sz = tp->rms; -#ifdef ENABLE_RX_PACKET_FRAGMENT - tp->rx_buf_sz = SKB_DATA_ALIGN(RX_BUF_SIZE); -#endif //ENABLE_RX_PACKET_FRAGMENT -#ifdef ENABLE_PAGE_REUSE - tp->rx_buf_page_order = rtl8125_rx_page_order(tp->rx_buf_sz, PAGE_SIZE); - tp->rx_buf_page_size = rtl8125_rx_page_size(tp->rx_buf_page_order); -#endif //ENABLE_PAGE_REUSE + if (enable_double_vlan) + tp->rx_buf_sz = (mtu > ETH_DATA_LEN) ? mtu + ETH_HLEN + 8 + 4 : RX_BUF_SIZE; + else + tp->rx_buf_sz = (mtu > ETH_DATA_LEN) ? mtu + ETH_HLEN + 8 : RX_BUF_SIZE; } static void rtl8125_free_irq(struct rtl8125_private *tp) @@ -16676,7 +10898,7 @@ static int rtl8125_alloc_irq(struct rtl8125_private *tp) for (i=0; iirq_nvecs; i++) { irq = &tp->irq_tbl[i]; if (tp->features & RTL_FEATURE_MSIX && - tp->HwCurrIsrVer > 1) + tp->HwCurrIsrVer == 2) irq->handler = rtl8125_interrupt_msix; else irq->handler = rtl8125_interrupt; @@ -16697,7 +10919,7 @@ static int rtl8125_alloc_irq(struct rtl8125_private *tp) irq_flags |= IRQF_NO_SUSPEND; #endif if (tp->features & RTL_FEATURE_MSIX && - tp->HwCurrIsrVer > 1) { + tp->HwCurrIsrVer == 2) { for (i=0; iirq_nvecs; i++) { irq = &tp->irq_tbl[i]; irq->handler = rtl8125_interrupt_msix; @@ -16772,6 +10994,24 @@ static int rtl8125_alloc_rx_desc(struct rtl8125_private *tp) 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; @@ -16808,11 +11048,26 @@ static void rtl8125_free_rx_desc(struct rtl8125_private *tp) } } +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 @@ -16864,6 +11119,10 @@ int rtl8125_open(struct net_device *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; @@ -16944,8 +11203,7 @@ set_offset79(struct rtl8125_private *tp, u8 setting) struct pci_dev *pdev = tp->pci_dev; u8 device_control; - if (hwoptimize & HW_PATCH_SOC_LAN) - return; + if (hwoptimize & HW_PATCH_SOC_LAN) return; pci_read_config_byte(pdev, 0x79, &device_control); device_control &= ~0x70; @@ -16971,8 +11229,9 @@ rtl8125_hw_set_rx_packet_filter(struct net_device *dev) AcceptBroadcast | AcceptMulticast | AcceptMyPhys | AcceptAllPhys; mc_filter[1] = mc_filter[0] = 0xffffffff; - } else if (dev->flags & IFF_ALLMULTI) { - /* accept all multicasts. */ + } 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 { @@ -17049,61 +11308,6 @@ rtl8125_set_tx_q_num(struct rtl8125_private *tp, rtl8125_mac_ocp_write(tp, 0xE63E, mac_ocp_data); } -void -rtl8125_enable_mcu(struct rtl8125_private *tp, bool enable) -{ - if (FALSE == HW_SUPPORT_MAC_MCU(tp)) - return; - - if (enable) - rtl8125_set_mac_ocp_bit(tp, 0xC0B4, BIT_0); - else - rtl8125_clear_mac_ocp_bit(tp, 0xC0B4, BIT_0); -} - -static void -rtl8125_clear_tcam_entries(struct rtl8125_private *tp) -{ - if (FALSE == HW_SUPPORT_TCAM(tp)) - return; - - rtl8125_set_mac_ocp_bit(tp, 0xEB54, BIT_0); - udelay(1); - rtl8125_clear_mac_ocp_bit(tp, 0xEB54, BIT_0); -} - -static void -rtl8125_enable_tcam(struct rtl8125_private *tp) -{ - if (tp->HwSuppTcamVer != 1) - return; - - RTL_W16(tp, 0x382, 0x221B); -} - -static u8 -rtl8125_get_l1off_cap_bits(struct rtl8125_private *tp) -{ - u8 l1offCapBits = 0; - - l1offCapBits = (BIT_0 | BIT_1); - switch (tp->mcfg) { - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: - l1offCapBits |= (BIT_2 | BIT_3); - break; - default: - break; - } - - return l1offCapBits; -} - void rtl8125_hw_config(struct net_device *dev) { @@ -17123,16 +11327,23 @@ rtl8125_hw_config(struct net_device *dev) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: - rtl8125_enable_force_clkreq(tp, 0); - rtl8125_enable_aspm_clkreq_lock(tp, 0); + 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; } - rtl8125_set_eee_lpi_timer(tp); + //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; + } //keep magic packet only switch (tp->mcfg) { @@ -17142,10 +11353,6 @@ rtl8125_hw_config(struct net_device *dev) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: mac_ocp_data = rtl8125_mac_ocp_read(tp, 0xC0B6); mac_ocp_data &= BIT_0; rtl8125_mac_ocp_write(tp, 0xC0B6, mac_ocp_data); @@ -17170,24 +11377,16 @@ rtl8125_hw_config(struct net_device *dev) else rtl8125_disable_double_vlan(tp); - switch (tp->mcfg) { - case CFG_METHOD_2 ... CFG_METHOD_7: - rtl8125_enable_tcam(tp); - break; - } - 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 || - tp->mcfg == CFG_METHOD_8 || - tp->mcfg == CFG_METHOD_9 || - tp->mcfg == CFG_METHOD_10 || - tp->mcfg == CFG_METHOD_11) { + tp->mcfg == CFG_METHOD_7) { set_offset70F(tp, 0x27); - set_offset79(tp, 0x40); + set_offset79(tp, 0x50); + + RTL_W16(tp, 0x382, 0x221B); #ifdef ENABLE_RSS_SUPPORT rtl8125_config_rss(tp); @@ -17207,7 +11406,7 @@ rtl8125_hw_config(struct net_device *dev) 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); + 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); @@ -17224,11 +11423,14 @@ rtl8125_hw_config(struct net_device *dev) mac_ocp_data |= ((0x02 & 0x03) << 4); rtl8125_mac_ocp_write(tp, 0xE63E, mac_ocp_data); - rtl8125_enable_mcu(tp, 0); - rtl8125_enable_mcu(tp, 1); + 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); + 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); @@ -17248,6 +11450,8 @@ rtl8125_hw_config(struct net_device *dev) 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); @@ -17257,33 +11461,10 @@ rtl8125_hw_config(struct net_device *dev) mac_ocp_data |= (BIT_0); rtl8125_mac_ocp_write(tp, 0xEA1C, mac_ocp_data); - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_6: - case CFG_METHOD_8: - case CFG_METHOD_9: - rtl8125_oob_mutex_lock(tp); - break; - } - - if (tp->mcfg == CFG_METHOD_10 || tp->mcfg == CFG_METHOD_11) - rtl8125_mac_ocp_write(tp, 0xE0C0, 0x4403); - else - rtl8125_mac_ocp_write(tp, 0xE0C0, 0x4000); - - rtl8125_set_mac_ocp_bit(tp, 0xE052, (BIT_6 | BIT_5)); - rtl8125_clear_mac_ocp_bit(tp, 0xE052, BIT_3 | BIT_7); + rtl8125_mac_ocp_write(tp, 0xE0C0, 0x4000); - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_6: - case CFG_METHOD_8: - case CFG_METHOD_9: - rtl8125_oob_mutex_unlock(tp); - break; - } + 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); @@ -17294,31 +11475,22 @@ rtl8125_hw_config(struct net_device *dev) 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)); + 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); - if (tp->mcfg != CFG_METHOD_10 && tp->mcfg != CFG_METHOD_11) - rtl8125_disable_eee_plus(tp); + 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); - rtl8125_clear_tcam_entries(tp); - + SetMcuAccessRegBit(tp, 0xEB54, BIT_0); + udelay(1); + ClearMcuAccessRegBit(tp, 0xEB54, BIT_0); RTL_W16(tp, 0x1880, RTL_R16(tp, 0x1880) & ~(BIT_4 | BIT_5)); - - if (tp->HwSuppRxDescType == RX_DESC_RING_TYPE_4) { - if (tp->InitRxDescType == RX_DESC_RING_TYPE_4) - RTL_W8(tp, 0xd8, RTL_R8(tp, 0xd8) | - EnableRxDescV4_0); - else - RTL_W8(tp, 0xd8, RTL_R8(tp, 0xd8) & - ~EnableRxDescV4_0); - } } /* csum offload command for RTL8125 */ @@ -17328,7 +11500,7 @@ rtl8125_hw_config(struct net_device *dev) tp->tx_ipv6_csum_cmd = TxIPV6F_C; /* config interrupt type for RTL8125B */ - if (tp->HwSuppIsrVer > 1) + if (tp->HwSuppIsrVer == 2) rtl8125_hw_set_interrupt_type(tp, tp->HwCurrIsrVer); //other hw parameters @@ -17336,9 +11508,15 @@ rtl8125_hw_config(struct net_device *dev) rtl8125_hw_clear_int_miti(dev); - if (tp->use_timer_interrupt && - (tp->HwCurrIsrVer > 1) && - (tp->HwSuppIntMitiVer > 3) && + 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++) @@ -17354,10 +11532,6 @@ rtl8125_hw_config(struct net_device *dev) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: rtl8125_mac_ocp_write(tp, 0xE098, 0xC302); break; } @@ -17369,10 +11543,6 @@ rtl8125_hw_config(struct net_device *dev) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: rtl8125_disable_pci_offset_99(tp); if (aspm) { if (tp->org_pci_offset_99 & (BIT_2 | BIT_5 | BIT_6)) @@ -17387,21 +11557,14 @@ rtl8125_hw_config(struct net_device *dev) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: rtl8125_disable_pci_offset_180(tp); if (aspm) { - if (tp->org_pci_offset_180 & rtl8125_get_l1off_cap_bits(tp)) + if (tp->org_pci_offset_180 & (BIT_0|BIT_1)) rtl8125_init_pci_offset_180(tp); } break; } - if (tp->RequiredPfmPatch) - rtl8125_set_pfm_patch(tp, 0); - tp->cp_cmd &= ~(EnableBist | Macdbgo_oe | Force_halfdup | Force_rxflow_en | Force_txflow_en | Cxpl_dbg_sel | ASF | Macdbgo_sel); @@ -17411,8 +11574,25 @@ rtl8125_hw_config(struct net_device *dev) #else rtl8125_hw_set_features(dev, dev->features); #endif - RTL_W16(tp, RxMaxSize, tp->rms); + 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) { @@ -17453,11 +11633,13 @@ rtl8125_hw_config(struct net_device *dev) case CFG_METHOD_5: case CFG_METHOD_6: case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - case CFG_METHOD_11: - rtl8125_enable_aspm_clkreq_lock(tp, aspm ? 1 : 0); + 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; } @@ -17498,220 +11680,39 @@ rtl8125_change_mtu(struct net_device *dev, dev->mtu = new_mtu; - tp->eee.tx_lpi_timer = dev->mtu + ETH_HLEN + 0x20; - 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 - - if (tp->link_ok(dev)) - rtl8125_link_on_patch(dev); - else - rtl8125_link_down_patch(dev); - - //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 inline void -rtl8125_set_desc_dma_addr(struct rtl8125_private *tp, - struct RxDesc *desc, - dma_addr_t mapping) -{ - switch (tp->InitRxDescType) { - case RX_DESC_RING_TYPE_3: - ((struct RxDescV3 *)desc)->addr = cpu_to_le64(mapping); - break; - case RX_DESC_RING_TYPE_4: - ((struct RxDescV4 *)desc)->addr = cpu_to_le64(mapping); - break; - default: - desc->addr = cpu_to_le64(mapping); - break; - } -} - -static inline void -rtl8125_mark_to_asic_v1(struct RxDesc *desc, - u32 rx_buf_sz) -{ - u32 eor = le32_to_cpu(desc->opts1) & RingEnd; - - WRITE_ONCE(desc->opts1, cpu_to_le32(DescOwn | eor | rx_buf_sz)); -} - -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)); -} - -static inline void -rtl8125_mark_to_asic_v4(struct RxDescV4 *descv4, - u32 rx_buf_sz) -{ - u32 eor = le32_to_cpu(descv4->RxDescNormalDDWord2.opts1) & RingEnd; - - WRITE_ONCE(descv4->RxDescNormalDDWord2.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) -{ - switch (tp->InitRxDescType) { - case RX_DESC_RING_TYPE_3: - rtl8125_mark_to_asic_v3((struct RxDescV3 *)desc, rx_buf_sz); - break; - case RX_DESC_RING_TYPE_4: - rtl8125_mark_to_asic_v4((struct RxDescV4 *)desc, rx_buf_sz); - break; - default: - rtl8125_mark_to_asic_v1(desc, rx_buf_sz); - break; - } -} - -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; - rtl8125_set_desc_dma_addr(tp, desc, mapping); - wmb(); - rtl8125_mark_to_asic(tp, desc, rx_buf_sz); -} - -#ifdef ENABLE_PAGE_REUSE - -static int -rtl8125_alloc_rx_page(struct rtl8125_private *tp, struct rtl8125_rx_ring *ring, - struct rtl8125_rx_buffer *rxb) -{ - struct page *page; - dma_addr_t dma; - unsigned int order = tp->rx_buf_page_order; - - //get free page - page = dev_alloc_pages(order); - - if (unlikely(!page)) - return -ENOMEM; - - dma = dma_map_page_attrs(&tp->pci_dev->dev, page, 0, - tp->rx_buf_page_size, - DMA_FROM_DEVICE, - (DMA_ATTR_SKIP_CPU_SYNC | DMA_ATTR_WEAK_ORDERING)); - - if (unlikely(dma_mapping_error(&tp->pci_dev->dev, dma))) { - __free_pages(page, order); - return -ENOMEM; - } - - rxb->page = page; - rxb->data = page_address(page); - rxb->page_offset = ring->rx_offset; - rxb->dma = dma; - - //after page alloc, page refcount already = 1 - - return 0; -} - -static void -rtl8125_free_rx_page(struct rtl8125_private *tp, struct rtl8125_rx_buffer *rxb) -{ - if (!rxb->page) - return; - - dma_unmap_page_attrs(&tp->pci_dev->dev, rxb->dma, - tp->rx_buf_page_size, - DMA_FROM_DEVICE, - (DMA_ATTR_SKIP_CPU_SYNC | DMA_ATTR_WEAK_ORDERING)); - __free_pages(rxb->page, tp->rx_buf_page_order); - rxb->page = NULL; -} - -static void -_rtl8125_rx_clear(struct rtl8125_private *tp, struct rtl8125_rx_ring *ring) -{ - int i; - struct rtl8125_rx_buffer *rxb; - - for (i = 0; i < ring->num_rx_desc; i++) { - rxb = &ring->rx_buffer[i]; - if (rxb->skb) { - dev_kfree_skb(rxb->skb); - rxb->skb = NULL; - } - rtl8125_free_rx_page(tp, rxb); - } -} + rtl8125_set_rxbufsize(tp, dev); -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; - struct rtl8125_rx_buffer *rxb; + ret = rtl8125_init_ring(dev); - for (cur = start; end - cur > 0; cur++) { - int ret, i = cur % ring->num_rx_desc; + if (ret < 0) + goto err_out; - rxb = &ring->rx_buffer[i]; - if (rxb->page) - continue; +#ifdef CONFIG_R8125_NAPI + rtl8125_enable_napi(tp); +#endif//CONFIG_R8125_NAPI - ret = rtl8125_alloc_rx_page(tp, ring, rxb); - if (ret) - break; + //netif_tx_stop_all_queues(dev); + //netif_carrier_off(dev); + rtl8125_hw_config(dev); + rtl8125_enable_hw_linkchg_interrupt(tp); - dma_sync_single_range_for_device(tp_to_dev(tp), - rxb->dma, - rxb->page_offset, - tp->rx_buf_sz, - DMA_FROM_DEVICE); + rtl8125_set_speed(dev, tp->autoneg, tp->speed, tp->duplex, tp->advertising); - rtl8125_map_to_asic(tp, ring, - rtl8125_get_rxdesc(tp, ring->RxDescArray, i), - rxb->dma + rxb->page_offset, - tp->rx_buf_sz, i); - } - return cur - start; -} + //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 -#else //ENABLE_PAGE_REUSE +err_out: + return ret; +} static void rtl8125_free_rx_skb(struct rtl8125_private *tp, @@ -17729,6 +11730,46 @@ rtl8125_free_rx_skb(struct rtl8125_private *tp, 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, @@ -17743,15 +11784,14 @@ rtl8125_alloc_rx_skb(struct rtl8125_private *tp, int ret = 0; if (in_intr) - skb = RTL_ALLOC_SKB_INTR(&tp->r8125napi[ring->index].napi, rx_buf_sz + R8125_RX_ALIGN); + skb = RTL_ALLOC_SKB_INTR(&tp->r8125napi[ring->index].napi, rx_buf_sz + RTK_RX_ALIGN); else - skb = dev_alloc_skb(rx_buf_sz + R8125_RX_ALIGN); + skb = dev_alloc_skb(rx_buf_sz + RTK_RX_ALIGN); if (unlikely(!skb)) goto err_out; - if (!in_intr || !R8125_USE_NAPI_ALLOC_SKB) - skb_reserve(skb, R8125_RX_ALIGN); + skb_reserve(skb, RTK_RX_ALIGN); mapping = dma_map_single(tp_to_dev(tp), skb->data, rx_buf_sz, DMA_FROM_DEVICE); @@ -17779,7 +11819,7 @@ _rtl8125_rx_clear(struct rtl8125_private *tp, struct rtl8125_rx_ring *ring) { int i; - for (i = 0; i < ring->num_rx_desc; i++) { + for (i = 0; i < ring->num_rx_desc && i < MAX_NUM_RX_DESC; i++) { if (ring->Rx_skbuff[i]) { rtl8125_free_rx_skb(tp, ring, @@ -17791,6 +11831,15 @@ _rtl8125_rx_clear(struct rtl8125_private *tp, struct rtl8125_rx_ring *ring) } } +void +rtl8125_rx_clear(struct rtl8125_private *tp) +{ + int i; + + for (i = 0; i < tp->num_rx_rings && i < R8125_MAX_RX_QUEUES ; i++) + _rtl8125_rx_clear(tp, &tp->rx_ring[i]); +} + static u32 rtl8125_rx_fill(struct rtl8125_private *tp, struct rtl8125_rx_ring *ring, @@ -17813,60 +11862,28 @@ rtl8125_rx_fill(struct rtl8125_private *tp, rtl8125_get_rxdesc(tp, ring->RxDescArray, i), tp->rx_buf_sz, i, - in_intr); + in_intr + ); if (ret < 0) break; } return cur - start; } -#endif //ENABLE_PAGE_REUSE - -void -rtl8125_rx_clear(struct rtl8125_private *tp) -{ - int i; - - for (i = 0; i < tp->num_rx_rings; i++) { - struct rtl8125_rx_ring *ring = &tp->rx_ring[i]; - - _rtl8125_rx_clear(tp, ring); - } -} - -static void -rtl8125_mark_as_last_descriptor_v1(struct RxDesc *desc) -{ - desc->opts1 |= cpu_to_le32(RingEnd); -} - -static void -rtl8125_mark_as_last_descriptor_v3(struct RxDescV3 *descv3) +static inline void +rtl8125_mark_as_last_descriptor_8125(struct RxDescV3 *descv3) { descv3->RxDescNormalDDWord4.opts1 |= cpu_to_le32(RingEnd); } -static void -rtl8125_mark_as_last_descriptor_v4(struct RxDescV4 *descv4) -{ - descv4->RxDescNormalDDWord2.opts1 |= cpu_to_le32(RingEnd); -} - -void +static inline void rtl8125_mark_as_last_descriptor(struct rtl8125_private *tp, struct RxDesc *desc) { - switch (tp->InitRxDescType) { - case RX_DESC_RING_TYPE_3: - rtl8125_mark_as_last_descriptor_v3((struct RxDescV3 *)desc); - break; - case RX_DESC_RING_TYPE_4: - rtl8125_mark_as_last_descriptor_v4((struct RxDescV4 *)desc); - break; - default: - rtl8125_mark_as_last_descriptor_v1(desc); - break; - } + 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 @@ -17880,12 +11897,10 @@ rtl8125_desc_addr_fill(struct rtl8125_private *tp) RTL_W32(tp, ring->tdsar_reg + 4, ((u64)ring->TxPhyAddr >> 32)); } - if (rtl8125_num_lib_rx_rings(tp) == 0) { - 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)); - } + 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)); } } @@ -17931,11 +11946,8 @@ rtl8125_init_ring(struct net_device *dev) for (i = 0; i < tp->num_rx_rings; i++) { struct rtl8125_rx_ring *ring = &tp->rx_ring[i]; -#ifdef ENABLE_PAGE_REUSE - ring->rx_offset = R8125_RX_ALIGN; -#else + memset(ring->Rx_skbuff, 0x0, sizeof(ring->Rx_skbuff)); -#endif //ENABLE_PAGE_REUSE if (rtl8125_rx_fill(tp, ring, dev, 0, ring->num_rx_desc, 0) != ring->num_rx_desc) goto err_out; @@ -18046,8 +12058,7 @@ static void rtl8125_cancel_schedule_reset_work(struct rtl8125_private *tp) { struct work_struct *work = &tp->reset_task.work; - if (!work->func) - return; + if (!work->func) return; cancel_delayed_work_sync(&tp->reset_task); } @@ -18062,8 +12073,7 @@ static void rtl8125_cancel_schedule_esd_work(struct rtl8125_private *tp) { struct work_struct *work = &tp->esd_task.work; - if (!work->func) - return; + if (!work->func) return; cancel_delayed_work_sync(&tp->esd_task); } @@ -18078,8 +12088,7 @@ static void rtl8125_cancel_schedule_linkchg_work(struct rtl8125_private *tp) { struct work_struct *work = &tp->linkchg_task.work; - if (!work->func) - return; + if (!work->func) return; cancel_delayed_work_sync(&tp->linkchg_task); } @@ -18152,6 +12161,14 @@ rtl8125_wait_for_quiescence(struct net_device *dev) #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 < R8125_MAX_RX_QUEUES ; 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) { @@ -18164,6 +12181,7 @@ static void rtl8125_reset_task(struct work_struct *work) container_of(work, struct rtl8125_private, reset_task.work); struct net_device *dev = tp->dev; #endif + u32 budget = ~(u32)0; int i; rtnl_lock(); @@ -18173,47 +12191,47 @@ static void rtl8125_reset_task(struct work_struct *work) !test_and_clear_bit(R8125_FLAG_TASK_RESET_PENDING, tp->task_flags)) goto out_unlock; - netdev_err(dev, "Device reseting!\n"); + 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); - netif_tx_disable(dev); - _rtl8125_wait_for_quiescence(dev); rtl8125_hw_reset(dev); rtl8125_tx_clear(tp); - rtl8125_init_ring_indexes(tp); - - rtl8125_tx_desc_init(tp); - for (i = 0; i < tp->num_rx_rings; i++) { - struct rtl8125_rx_ring *ring; - u32 entry; - - ring = &tp->rx_ring[i]; - for (entry = 0; entry < ring->num_rx_desc; entry++) { - struct RxDesc *desc; - - desc = rtl8125_get_rxdesc(tp, ring->RxDescArray, entry); - rtl8125_mark_to_asic(tp, desc, tp->rx_buf_sz); - } - } - + if (rtl8125_rx_nostuck(tp)) { + rtl8125_rx_clear(tp); + rtl8125_init_ring(dev); #ifdef ENABLE_PTP_SUPPORT - rtl8125_ptp_reset(tp); + rtl8125_ptp_reset(tp); #endif + if (tp->resume_not_chg_speed) { + _rtl8125_check_link_status(dev); -#ifdef CONFIG_R8125_NAPI - rtl8125_enable_napi(tp); -#endif //CONFIG_R8125_NAPI - - if (tp->resume_not_chg_speed) { - _rtl8125_check_link_status(dev); + tp->resume_not_chg_speed = 0; + } else { + rtl8125_enable_hw_linkchg_interrupt(tp); - tp->resume_not_chg_speed = 0; + rtl8125_set_speed(dev, tp->autoneg, tp->speed, tp->duplex, tp->advertising); + } } else { - rtl8125_enable_hw_linkchg_interrupt(tp); + if (unlikely(net_ratelimit())) { + struct rtl8125_private *tp = netdev_priv(dev); - rtl8125_set_speed(dev, tp->autoneg, tp->speed, tp->duplex, tp->advertising); + if (netif_msg_intr(tp)) { + printk(PFX KERN_EMERG + "%s: Rx buffers shortage\n", dev->name); + } + } + rtl8125_schedule_reset_work(tp); } out_unlock: @@ -18282,8 +12300,6 @@ rtl8125_tx_timeout(struct net_device *dev) { struct rtl8125_private *tp = netdev_priv(dev); - netdev_err(dev, "Transmit timeout reset Device!\n"); - /* Let's wait a bit while any (async) irq lands on */ rtl8125_schedule_reset_work(tp); } @@ -18379,8 +12395,10 @@ rtl8125_xmit_frags(struct rtl8125_private *tp, /* 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) + if (cur_frag == (nr_frags - 1) || LsoPatchEnabled == TRUE) { + //ring->tx_skb[entry].skb = skb; status |= LastFrag; + } txd->addr = cpu_to_le64(mapping); @@ -18483,20 +12501,9 @@ static int msdn_giant_send_check(struct sk_buff *skb) } #endif -static bool rtl8125_require_pad_ptp_pkt(struct rtl8125_private *tp) -{ - switch (tp->mcfg) { - case CFG_METHOD_2 ... CFG_METHOD_7: - return true; - default: - return false; - } -} - #define MIN_PATCH_LEN (47) static u32 -rtl8125_get_patch_pad_len(struct rtl8125_private *tp, - struct sk_buff *skb) +rtl8125_get_patch_pad_len(struct sk_buff *skb) { u32 pad_len = 0; int trans_data_len; @@ -18505,9 +12512,6 @@ rtl8125_get_patch_pad_len(struct rtl8125_private *tp, u8 ip_protocol; bool has_trans = skb_transport_header_was_set(skb); - if (!rtl8125_require_pad_ptp_pkt(tp)) - goto no_padding; - if (!(has_trans && (pkt_len < 175))) //128 + MIN_PATCH_LEN goto no_padding; @@ -18555,9 +12559,7 @@ rtl8125_get_patch_pad_len(struct rtl8125_private *tp, static bool rtl8125_tso_csum(struct sk_buff *skb, struct net_device *dev, - u32 *opts, - unsigned int *bytecount, - unsigned short *gso_segs) + u32 *opts) { struct rtl8125_private *tp = netdev_priv(dev); unsigned long large_send = 0; @@ -18575,28 +12577,12 @@ rtl8125_tso_csum(struct sk_buff *skb, /* TCP Segmentation Offload (or TCP Large Send) */ if (mss) { - union { - struct iphdr *v4; - struct ipv6hdr *v6; - unsigned char *hdr; - } ip; - union { - struct tcphdr *tcp; - struct udphdr *udp; - unsigned char *hdr; - } l4; - u32 l4_offset, hdr_len; - - ip.hdr = skb_network_header(skb); - l4.hdr = skb_checksum_start(skb); - - l4_offset = skb_transport_offset(skb); - assert((l4_offset%2) == 0); + assert((skb_transport_offset(skb)%2) == 0); switch (get_protocol(skb)) { case __constant_htons(ETH_P_IP): - if (l4_offset <= GTTCPHO_MAX) { + if (skb_transport_offset(skb) <= GTTCPHO_MAX) { opts[0] |= GiantSendv4; - opts[0] |= l4_offset << GTTCPHO_SHIFT; + opts[0] |= skb_transport_offset(skb) << GTTCPHO_SHIFT; opts[1] |= min(mss, MSS_MAX) << 18; large_send = 1; } @@ -18606,9 +12592,9 @@ rtl8125_tso_csum(struct sk_buff *skb, if (msdn_giant_send_check(skb)) return false; #endif - if (l4_offset <= GTTCPHO_MAX) { + if (skb_transport_offset(skb) <= GTTCPHO_MAX) { opts[0] |= GiantSendv6; - opts[0] |= l4_offset << GTTCPHO_SHIFT; + opts[0] |= skb_transport_offset(skb) << GTTCPHO_SHIFT; opts[1] |= min(mss, MSS_MAX) << 18; large_send = 1; } @@ -18622,13 +12608,6 @@ rtl8125_tso_csum(struct sk_buff *skb, if (large_send == 0) return false; - - /* compute length of segmentation header */ - hdr_len = (l4.tcp->doff * 4) + l4_offset; - /* update gso size and bytecount with header size */ - *gso_segs = skb_shinfo(skb)->gso_segs; - *bytecount += (*gso_segs - 1) * hdr_len; - return true; } } @@ -18688,7 +12667,7 @@ rtl8125_tso_csum(struct sk_buff *skb, } if (check_patch_required) { - u32 pad_len = rtl8125_get_patch_pad_len(tp, skb); + u32 pad_len = rtl8125_get_patch_pad_len(skb); if (pad_len > 0) { if (!rtl8125_skb_pad_with_len(skb, skb->len + pad_len)) @@ -18734,33 +12713,11 @@ static bool rtl8125_tx_slots_avail(struct rtl8125_private *tp, return slots_avail > MAX_SKB_FRAGS; } -static inline u32 -rtl8125_fast_mod_mask(const u32 input, const u32 mask) -{ - return input > mask ? input & mask : input; -} - -static void rtl8125_doorbell(struct rtl8125_private *tp, - struct rtl8125_tx_ring *ring) -{ - if (tp->EnableTxNoClose) { - if (tp->HwSuppTxNoCloseVer > 3) - RTL_W32(tp, ring->sw_tail_ptr_reg, ring->cur_tx); - else - RTL_W16(tp, ring->sw_tail_ptr_reg, ring->cur_tx); - } else - RTL_W16(tp, TPPOLL_8125, BIT(ring->index)); /* set polling bit */ -} - static netdev_tx_t rtl8125_start_xmit(struct sk_buff *skb, struct net_device *dev) { struct rtl8125_private *tp = netdev_priv(dev); - unsigned int bytecount; - unsigned short gso_segs; - struct ring_info *last; - unsigned int last_entry; unsigned int entry; struct TxDesc *txd; dma_addr_t mapping; @@ -18801,13 +12758,10 @@ rtl8125_start_xmit(struct sk_buff *skb, } } - bytecount = skb->len; - gso_segs = 1; - opts[0] = DescOwn; opts[1] = rtl8125_tx_vlan_tag(tp, skb); - if (unlikely(!rtl8125_tso_csum(skb, dev, opts, &bytecount, &gso_segs))) + if (unlikely(!rtl8125_tso_csum(skb, dev, opts))) goto err_dma_0; frags = rtl8125_xmit_frags(tp, ring, skb, opts); @@ -18818,6 +12772,9 @@ rtl8125_start_xmit(struct sk_buff *skb, opts[0] |= FirstFrag; } else { len = skb->len; + + //ring->tx_skb[entry].skb = skb; + opts[0] |= FirstFrag | LastFrag; } @@ -18828,39 +12785,27 @@ rtl8125_start_xmit(struct sk_buff *skb, 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 (!test_and_set_bit_lock(__RTL8125_PTP_TX_IN_PROGRESS, &tp->state)) { - 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++; + 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 - /* set first fragment's length */ - ring->tx_skb[entry].len = len; - - /* set skb to last fragment */ - last_entry = (entry + frags) % ring->num_tx_desc; - last = &ring->tx_skb[last_entry]; - last->skb = skb; - last->gso_segs = gso_segs; - last->bytecount = bytecount; - + 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]); - netdev_tx_sent_queue(txring_txq(ring), bytecount); - #if LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0) dev->trans_start = jiffies; #else @@ -18881,126 +12826,84 @@ rtl8125_start_xmit(struct sk_buff *skb, netif_stop_subqueue(dev, queue_mapping); } - if (netif_xmit_stopped(txring_txq(ring)) || !netdev_xmit_more()) - rtl8125_doorbell(tp, ring); - - 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: - 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; -} - -/* recycle tx no close desc*/ -static int -rtl8125_tx_interrupt_noclose(struct rtl8125_tx_ring *ring, int budget) -{ - unsigned int total_bytes = 0, total_packets = 0; - struct rtl8125_private *tp = ring->priv; - struct net_device *dev = tp->dev; - unsigned int dirty_tx, tx_left; - unsigned int tx_desc_closed; - unsigned int count = 0; - - dirty_tx = ring->dirty_tx; - ring->NextHwDesCloPtr = rtl8125_get_hw_clo_ptr(ring); - tx_desc_closed = rtl8125_fast_mod_mask(ring->NextHwDesCloPtr - - ring->BeginHwDesCloPtr, - tp->MaxTxDescPtrMask); - tx_left = min((READ_ONCE(ring->cur_tx) - dirty_tx), tx_desc_closed); - ring->BeginHwDesCloPtr += tx_left; - - while (tx_left > 0) { - unsigned int entry = dirty_tx % ring->num_tx_desc; - struct ring_info *tx_skb = ring->tx_skb + entry; - - rtl8125_unmap_tx_skb(tp->pci_dev, - tx_skb, - ring->TxDescArray + entry); - - if (tx_skb->skb != NULL) { - /* update the statistics for this packet */ - total_bytes += tx_skb->bytecount; - total_packets += tx_skb->gso_segs; - - RTL_NAPI_CONSUME_SKB_ANY(tx_skb->skb, budget); - tx_skb->skb = NULL; - } - dirty_tx++; - tx_left--; - } - - if (total_packets) { - netdev_tx_completed_queue(txring_txq(ring), - total_packets, total_bytes); - - RTLDEV->stats.tx_bytes += total_bytes; - RTLDEV->stats.tx_packets+= total_packets; - } - - 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); - } + 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; +} - return count; +static inline u32 +rtl8125_fast_mod(const u32 input, const u32 ceil) +{ + return input >= ceil ? input % ceil : input; } -/* recycle tx close desc*/ static int -rtl8125_tx_interrupt_close(struct rtl8125_tx_ring *ring, int budget) +rtl8125_tx_interrupt(struct rtl8125_tx_ring *ring, int budget) { - unsigned int total_bytes = 0, total_packets = 0; 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 (le32_to_cpu(ring->TxDescArray[entry].opts1) & DescOwn) + 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) { - /* update the statistics for this packet */ - total_bytes += tx_skb->bytecount; - total_packets += tx_skb->gso_segs; - RTL_NAPI_CONSUME_SKB_ANY(tx_skb->skb, budget); tx_skb->skb = NULL; } @@ -19008,14 +12911,6 @@ rtl8125_tx_interrupt_close(struct rtl8125_tx_ring *ring, int budget) tx_left--; } - if (total_packets) { - netdev_tx_completed_queue(txring_txq(ring), - total_packets, total_bytes); - - RTLDEV->stats.tx_bytes += total_bytes; - RTLDEV->stats.tx_packets+= total_packets; - } - if (ring->dirty_tx != dirty_tx) { count = dirty_tx - ring->dirty_tx; WRITE_ONCE(ring->dirty_tx, dirty_tx); @@ -19024,25 +12919,15 @@ rtl8125_tx_interrupt_close(struct rtl8125_tx_ring *ring, int budget) (rtl8125_tx_slots_avail(tp, ring))) { netif_start_subqueue(dev, ring->index); } - - if (ring->cur_tx != dirty_tx) - rtl8125_doorbell(tp, ring); + smp_rmb(); + if (!EnableTxNoClose && (ring->cur_tx != dirty_tx)) { + RTL_W16(tp, TPPOLL_8125, BIT(ring->index)); + } } return count; } -static int -rtl8125_tx_interrupt(struct rtl8125_tx_ring *ring, int budget) -{ - struct rtl8125_private *tp = ring->priv; - - if (tp->EnableTxNoClose) - return rtl8125_tx_interrupt_noclose(ring, budget); - else - return rtl8125_tx_interrupt_close(ring, budget); -} - static int rtl8125_tx_interrupt_with_vector(struct rtl8125_private *tp, const int message_id, @@ -19050,29 +12935,12 @@ rtl8125_tx_interrupt_with_vector(struct rtl8125_private *tp, { int count = 0; - switch (tp->HwCurrIsrVer) { - case 3: - case 4: - if (message_id < tp->num_tx_rings) - count += rtl8125_tx_interrupt(&tp->tx_ring[message_id], budget); - break; - case 5: - if (message_id == 16) - count += rtl8125_tx_interrupt(&tp->tx_ring[0], budget); -#ifdef ENABLE_MULTIPLE_TX_QUEUE - else if (message_id == 17) - count += rtl8125_tx_interrupt(&tp->tx_ring[1], budget); -#endif - break; - default: - if (message_id == 16) - count += rtl8125_tx_interrupt(&tp->tx_ring[0], budget); + 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); + else if (message_id == 18) + count += rtl8125_tx_interrupt(&tp->tx_ring[1], budget); #endif - break; - } return count; } @@ -19080,27 +12948,10 @@ rtl8125_tx_interrupt_with_vector(struct rtl8125_private *tp, static inline int rtl8125_fragmented_frame(struct rtl8125_private *tp, u32 status) { - switch (tp->InitRxDescType) { - case RX_DESC_RING_TYPE_3: + if (tp->InitRxDescType == RX_DESC_RING_TYPE_3) return (status & (FirstFrag_V3 | LastFrag_V3)) != (FirstFrag_V3 | LastFrag_V3); - case RX_DESC_RING_TYPE_4: - return (status & (FirstFrag_V4 | LastFrag_V4)) != (FirstFrag_V4 | LastFrag_V4); - default: + else return (status & (FirstFrag | LastFrag)) != (FirstFrag | LastFrag); - } -} - -static inline int -rtl8125_is_non_eop(struct rtl8125_private *tp, u32 status) -{ - switch (tp->InitRxDescType) { - case RX_DESC_RING_TYPE_3: - return !(status & LastFrag_V3); - case RX_DESC_RING_TYPE_4: - return !(status & LastFrag_V4); - default: - return !(status & LastFrag); - } } static inline int @@ -19109,48 +12960,23 @@ rtl8125_rx_desc_type(u32 status) return ((status >> 26) & 0x0F); } -static inline void -rtl8125_rx_v1_csum(struct rtl8125_private *tp, - struct sk_buff *skb, - struct RxDesc *desc) -{ - u32 opts1 = le32_to_cpu(desc->opts1); - - if (((opts1 & RxTCPT) && !(opts1 & RxTCPF)) || - ((opts1 & RxUDPT) && !(opts1 & RxUDPF))) - skb->ip_summed = CHECKSUM_UNNECESSARY; - else - skb_checksum_none_assert(skb); -} - 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 & RxTCPT_v3) && !(opts2 & RxTCPF_v3)) || - ((opts2 & RxUDPT_v3) && !(opts2 & RxUDPF_v3))) - skb->ip_summed = CHECKSUM_UNNECESSARY; - else - skb_checksum_none_assert(skb); -} - -static inline void -rtl8125_rx_v4_csum(struct rtl8125_private *tp, - struct sk_buff *skb, - struct RxDescV4 *descv4) -{ - u32 opts1 = le32_to_cpu(descv4->RxDescNormalDDWord2.opts1); - - /* rx csum offload for RTL8125 */ - if (((opts1 & RxTCPT_v4) && !(opts1 & RxTCPF_v4)) || - ((opts1 & RxUDPT_v4) && !(opts1 & RxUDPF_v4))) - skb->ip_summed = CHECKSUM_UNNECESSARY; - else - skb_checksum_none_assert(skb); + 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 @@ -19158,20 +12984,24 @@ rtl8125_rx_csum(struct rtl8125_private *tp, struct sk_buff *skb, struct RxDesc *desc) { - switch (tp->InitRxDescType) { - case RX_DESC_RING_TYPE_3: + if (tp->InitRxDescType == RX_DESC_RING_TYPE_3) rtl8125_rx_v3_csum(tp, skb, (struct RxDescV3 *)desc); - break; - case RX_DESC_RING_TYPE_4: - rtl8125_rx_v4_csum(tp, skb, (struct RxDescV4 *)desc); - break; - default: - rtl8125_rx_v1_csum(tp, skb, desc); - break; + 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, @@ -19182,27 +13012,26 @@ rtl8125_try_rx_copy(struct rtl8125_private *tp, { int ret = -1; - struct sk_buff *skb; + if (pkt_size < rx_copybreak) { + struct sk_buff *skb; - skb = RTL_ALLOC_SKB_INTR(&tp->r8125napi[ring->index].napi, pkt_size + R8125_RX_ALIGN); - if (skb) { - u8 *data; + skb = RTL_ALLOC_SKB_INTR(&tp->r8125napi[ring->index].napi, pkt_size + RTK_RX_ALIGN); + if (skb) { + u8 *data; - data = sk_buff[0]->data; - if (!R8125_USE_NAPI_ALLOC_SKB) - skb_reserve(skb, R8125_RX_ALIGN); + data = sk_buff[0]->data; + skb_reserve(skb, RTK_RX_ALIGN); #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,37) - prefetch(data - R8125_RX_ALIGN); + 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; + 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, @@ -19227,8 +13056,7 @@ rtl8125_check_rx_desc_error(struct net_device *dev, { int ret = 0; - switch (tp->InitRxDescType) { - case RX_DESC_RING_TYPE_3: + if (tp->InitRxDescType == RX_DESC_RING_TYPE_3) { if (unlikely(status & RxRES_V3)) { if (status & (RxRWT_V3 | RxRUNT_V3)) RTLDEV->stats.rx_length_errors++; @@ -19237,18 +13065,7 @@ rtl8125_check_rx_desc_error(struct net_device *dev, ret = -1; } - break; - case RX_DESC_RING_TYPE_4: - if (unlikely(status & RxRES_V4)) { - if (status & RxRUNT_V4) - RTLDEV->stats.rx_length_errors++; - if (status & RxCRC_V4) - RTLDEV->stats.rx_crc_errors++; - - ret = -1; - } - break; - default: + } else { if (unlikely(status & RxRES)) { if (status & (RxRWT | RxRUNT)) RTLDEV->stats.rx_length_errors++; @@ -19257,102 +13074,11 @@ rtl8125_check_rx_desc_error(struct net_device *dev, ret = -1; } - break; } return ret; } -#ifdef ENABLE_PAGE_REUSE - -static inline bool -rtl8125_reuse_rx_ok(struct page *page) -{ - /* avoid re-using remote pages */ - if (!dev_page_is_reusable(page)) { - //printk(KERN_INFO "r8125 page pfmemalloc, can't reuse!\n"); - return false; - } - /* if we are only owner of page we can reuse it */ - if (unlikely(page_ref_count(page) != 1)) { - //printk(KERN_INFO "r8125 page refcnt %d, can't reuse!\n", page_ref_count(page)); - return false; - } - - return true; -} - -static void -rtl8125_reuse_rx_buffer(struct rtl8125_private *tp, struct rtl8125_rx_ring *ring, u32 cur_rx, struct rtl8125_rx_buffer *rxb) -{ - struct page *page = rxb->page; - - u32 dirty_rx = ring->dirty_rx; - u32 entry = dirty_rx % ring->num_rx_desc; - struct rtl8125_rx_buffer *nrxb = &ring->rx_buffer[entry]; - - u32 noffset; - - //the page gonna be shared by us and kernel, keep page ref = 2 - page_ref_inc(page); - - //flip the buffer in page to use next - noffset = rxb->page_offset ^ (tp->rx_buf_page_size / 2); //one page, two buffer, ping-pong - - nrxb->dma = rxb->dma; - nrxb->page_offset = noffset; - nrxb->data = rxb->data; - - if (cur_rx != dirty_rx) { - //move the buffer to other slot - nrxb->page = page; - rxb->page = NULL; - } -} - -static void rtl8125_put_rx_buffer(struct rtl8125_private *tp, - struct rtl8125_rx_ring *ring, - u32 cur_rx, - struct rtl8125_rx_buffer *rxb) -{ - struct rtl8125_rx_buffer *nrxb; - struct page *page = rxb->page; - u32 entry; - - entry = ring->dirty_rx % ring->num_rx_desc; - nrxb = &ring->rx_buffer[entry]; - if (likely(rtl8125_reuse_rx_ok(page))) { - /* hand second half of page back to the ring */ - rtl8125_reuse_rx_buffer(tp, ring, cur_rx, rxb); - } else { - tp->page_reuse_fail_cnt++; - - dma_unmap_page_attrs(&tp->pci_dev->dev, rxb->dma, - tp->rx_buf_page_size, - DMA_FROM_DEVICE, - (DMA_ATTR_SKIP_CPU_SYNC | DMA_ATTR_WEAK_ORDERING)); - //the page ref is kept 1, uniquely owned by kernel now - rxb->page = NULL; - - return; - } - - dma_sync_single_range_for_device(tp_to_dev(tp), - nrxb->dma, - nrxb->page_offset, - tp->rx_buf_sz, - DMA_FROM_DEVICE); - - rtl8125_map_to_asic(tp, ring, - rtl8125_get_rxdesc(tp, ring->RxDescArray, entry), - nrxb->dma + nrxb->page_offset, - tp->rx_buf_sz, entry); - - ring->dirty_rx++; -} - -#endif //ENABLE_PAGE_REUSE - static int rtl8125_rx_interrupt(struct net_device *dev, struct rtl8125_private *tp, @@ -19363,17 +13089,10 @@ rtl8125_rx_interrupt(struct net_device *dev, unsigned int delta, count = 0; unsigned int entry; struct RxDesc *desc; - struct sk_buff *skb; u32 status; u32 rx_quota; - u32 ring_index = ring->index; -#ifdef ENABLE_PAGE_REUSE - struct rtl8125_rx_buffer *rxb; -#else //ENABLE_PAGE_REUSE u64 rx_buf_phy_addr; -#endif //ENABLE_PAGE_REUSE - unsigned int total_rx_multicast_packets = 0; - unsigned int total_rx_bytes = 0, total_rx_packets = 0; + u32 ring_index = ring->index; assert(dev != NULL); assert(tp != NULL); @@ -19383,23 +13102,13 @@ rtl8125_rx_interrupt(struct net_device *dev, 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--, cur_rx++) { -#ifdef ENABLE_PTP_SUPPORT - u8 desc_type = RXDESC_TYPE_NORMAL; - struct RxDescV3 ptp_desc; -#endif //ENABLE_PTP_SUPPORT -#ifndef ENABLE_PAGE_REUSE - const void *rx_buf; -#endif //!ENABLE_PAGE_REUSE - u32 pkt_size; - - entry = cur_rx % ring->num_rx_desc; - desc = rtl8125_get_rxdesc(tp, ring->RxDescArray, entry); + for (; rx_left > 0; rx_left--) { status = le32_to_cpu(rtl8125_rx_desc_opts1(tp, desc)); - if (status & DescOwn) break; @@ -19414,215 +13123,129 @@ rtl8125_rx_interrupt(struct net_device *dev, RTLDEV->stats.rx_errors++; - if (!(dev->features & NETIF_F_RXALL)) - goto release_descriptor; - } - pkt_size = status & 0x00003fff; - if (likely(!(dev->features & NETIF_F_RXFCS))) { -#ifdef ENABLE_RX_PACKET_FRAGMENT - if (rtl8125_is_non_eop(tp, status) && - pkt_size == tp->rx_buf_sz) { - struct RxDesc *desc_next; - unsigned int entry_next; - int pkt_size_next; - u32 status_next; - - entry_next = (cur_rx + 1) % ring->num_rx_desc; - desc_next = rtl8125_get_rxdesc(tp, ring->RxDescArray, entry_next); - status_next = le32_to_cpu(rtl8125_rx_desc_opts1(tp, desc_next)); - if (!(status_next & DescOwn)) { - pkt_size_next = status_next & 0x00003fff; - if (pkt_size_next < ETH_FCS_LEN) - pkt_size -= (ETH_FCS_LEN - pkt_size_next); - } - } -#endif //ENABLE_RX_PACKET_FRAGMENT - if (!rtl8125_is_non_eop(tp, status)) { - if (pkt_size < ETH_FCS_LEN) { -#ifdef ENABLE_RX_PACKET_FRAGMENT - pkt_size = 0; -#else - goto drop_packet; -#endif //ENABLE_RX_PACKET_FRAGMENT - } else - pkt_size -= ETH_FCS_LEN; + 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: + pkt_size = status & 0x00003fff; + if (likely(!(dev->features & NETIF_F_RXFCS))) + pkt_size -= ETH_FCS_LEN; + + /* + * 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)) || + unlikely(pkt_size > tp->rx_buf_sz)) { + RTLDEV->stats.rx_dropped++; + RTLDEV->stats.rx_length_errors++; + rtl8125_mark_to_asic(tp, desc, tp->rx_buf_sz); + continue; } - } - if (unlikely(pkt_size > tp->rx_buf_sz)) - goto drop_packet; + skb = ring->Rx_skbuff[entry]; -#if !defined(ENABLE_RX_PACKET_FRAGMENT) || !defined(ENABLE_PAGE_REUSE) - /* - * 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))) - goto drop_packet; -#endif //!ENABLE_RX_PACKET_FRAGMENT || !ENABLE_PAGE_REUSE + if (!skb) + break; #ifdef ENABLE_PTP_SUPPORT - if (tp->EnablePtp) { - 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; - - cur_rx++; - rx_left--; - entry_next = cur_rx % ring->num_rx_desc; - desc_next = (struct RxDescV3 *)rtl8125_get_rxdesc(tp, ring->RxDescArray, entry_next); - status_next = le32_to_cpu(desc_next->RxDescNormalDDWord4.opts1); - if (unlikely(status_next & DescOwn)) { - udelay(1); + 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)) { - if (netif_msg_rx_err(tp)) { - printk(KERN_ERR - "%s: Rx Next Desc ERROR. status = %08x\n", - dev->name, status_next); + 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; } - rtl8125_set_desc_dma_addr(tp, (struct RxDesc *)desc_next, - ring->RxDescPhyAddr[entry_next]); - wmb(); - rtl8125_mark_to_asic(tp, (struct RxDesc *)desc_next, tp->rx_buf_sz); - goto drop_packet; } - } - - rmb(); - desc_type = rtl8125_rx_desc_type(status_next); - if (desc_type == RXDESC_TYPE_PTP) { - ptp_desc = *desc_next; - rmb(); - rtl8125_set_desc_dma_addr(tp, (struct RxDesc *)desc_next, - ring->RxDescPhyAddr[entry_next]); - wmb(); - rtl8125_mark_to_asic(tp, (struct RxDesc *)desc_next, tp->rx_buf_sz); - } else { - WARN_ON(1); - rtl8125_set_desc_dma_addr(tp, (struct RxDesc *)desc_next, - ring->RxDescPhyAddr[entry_next]); - wmb(); - rtl8125_mark_to_asic(tp, (struct RxDesc *)desc_next, tp->rx_buf_sz); - goto drop_packet; - } - } else - WARN_ON(desc_type != RXDESC_TYPE_NORMAL); - } -#endif -#ifdef ENABLE_PAGE_REUSE - rxb = &ring->rx_buffer[entry]; - skb = rxb->skb; - rxb->skb = NULL; - if (!skb) { - skb = RTL_BUILD_SKB_INTR(rxb->data + rxb->page_offset - ring->rx_offset, tp->rx_buf_page_size / 2); - if (!skb) { - //netdev_err(tp->dev, "Failed to allocate RX skb!\n"); - goto drop_packet; + 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); } - - skb->dev = dev; - if (!R8125_USE_NAPI_ALLOC_SKB) - skb_reserve(skb, R8125_RX_ALIGN); - skb_put(skb, pkt_size); - } else - skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, rxb->page, - rxb->page_offset, pkt_size, tp->rx_buf_page_size / 2); -#ifdef ENABLE_PTP_SUPPORT - if (desc_type == RXDESC_TYPE_PTP) - rtl8125_rx_ptp_pktstamp(tp, skb, &ptp_desc); -#endif //ENABLE_PTP_SUPPORT - //recycle desc - rtl8125_put_rx_buffer(tp, ring, cur_rx, rxb); - - dma_sync_single_range_for_cpu(tp_to_dev(tp), - rxb->dma, - rxb->page_offset, - tp->rx_buf_sz, - DMA_FROM_DEVICE); -#else //ENABLE_PAGE_REUSE - skb = RTL_ALLOC_SKB_INTR(&tp->r8125napi[ring->index].napi, pkt_size + R8125_RX_ALIGN); - if (!skb) { - //netdev_err(tp->dev, "Failed to allocate RX skb!\n"); - goto drop_packet; - } - - skb->dev = dev; - if (!R8125_USE_NAPI_ALLOC_SKB) - skb_reserve(skb, R8125_RX_ALIGN); - skb_put(skb, pkt_size); -#ifdef ENABLE_PTP_SUPPORT - if (desc_type == RXDESC_TYPE_PTP) - rtl8125_rx_ptp_pktstamp(tp, skb, &ptp_desc); -#endif //ENABLE_PTP_SUPPORT - 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); - rx_buf = ring->Rx_skbuff[entry]->data; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,37) - prefetch(rx_buf - R8125_RX_ALIGN); #endif - eth_copy_and_sum(skb, rx_buf, pkt_size, 0); - - dma_sync_single_for_device(tp_to_dev(tp), rx_buf_phy_addr, - tp->rx_buf_sz, DMA_FROM_DEVICE); -#endif //ENABLE_PAGE_REUSE - -#ifdef ENABLE_RX_PACKET_FRAGMENT - if (rtl8125_is_non_eop(tp, status)) { - unsigned int entry_next; - entry_next = (entry + 1) % ring->num_rx_desc; - rxb = &ring->rx_buffer[entry_next]; - rxb->skb = skb; - continue; - } -#endif //ENABLE_RX_PACKET_FRAGMENT + 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, desc, skb); + rtl8125_rx_hash(tp, (struct RxDescV3 *)desc, skb); #endif - rtl8125_rx_csum(tp, skb, desc); - skb->protocol = eth_type_trans(skb, dev); + if (tp->cp_cmd & RxChkSum) + rtl8125_rx_csum(tp, skb, desc); - total_rx_bytes += skb->len; + skb->dev = dev; + skb_put(skb, pkt_size); + skb->protocol = eth_type_trans(skb, dev); - if (skb->pkt_type == PACKET_MULTICAST) - total_rx_multicast_packets++; + 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 (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; + dev->last_rx = jiffies; #endif //LINUX_VERSION_CODE < KERNEL_VERSION(4,11,0) - total_rx_packets++; + RTLDEV->stats.rx_bytes += pkt_size; + RTLDEV->stats.rx_packets++; + } -#ifdef ENABLE_PAGE_REUSE - rxb->skb = NULL; - continue; + 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 - -release_descriptor: - switch (tp->InitRxDescType) { - case RX_DESC_RING_TYPE_3: - case RX_DESC_RING_TYPE_4: - rtl8125_set_desc_dma_addr(tp, desc, - ring->RxDescPhyAddr[entry]); - wmb(); - break; - } - rtl8125_mark_to_asic(tp, desc, tp->rx_buf_sz); - continue; -drop_packet: - RTLDEV->stats.rx_dropped++; - RTLDEV->stats.rx_length_errors++; - goto release_descriptor; } count = cur_rx - ring->cur_rx; @@ -19633,10 +13256,6 @@ rtl8125_rx_interrupt(struct net_device *dev, printk(KERN_INFO "%s: no Rx buffer allocated\n", dev->name); ring->dirty_rx += delta; - RTLDEV->stats.rx_bytes += total_rx_bytes; - RTLDEV->stats.rx_packets += total_rx_packets; - RTLDEV->stats.multicast += total_rx_multicast_packets; - /* * FIXME: until there is periodic timer to try and refill the ring, * a temporary shortage may definitely kill the Rx process. @@ -19648,36 +13267,16 @@ rtl8125_rx_interrupt(struct net_device *dev, printk(KERN_EMERG "%s: Rx buffers exhausted\n", dev->name); rx_out: - return total_rx_packets; + return count; } static bool rtl8125_linkchg_interrupt(struct rtl8125_private *tp, u32 status) { - switch (tp->HwCurrIsrVer) { - case 2: - case 3: + if (tp->HwCurrIsrVer == 2) return status & ISRIMR_V2_LINKCHG; - case 4: - return status & ISRIMR_V4_LINKCHG; - case 5: - return status & ISRIMR_V5_LINKCHG; - default: - return status & LinkChg; - } -} -static u32 -rtl8125_get_linkchg_message_id(struct rtl8125_private *tp) -{ - switch (tp->HwCurrIsrVer) { - case 4: - return 29; - case 5: - return 18; - default: - return 21; - } + return status & LinkChg; } /* @@ -19726,19 +13325,22 @@ static irqreturn_t rtl8125_interrupt(int irq, void *dev_instance) #ifdef ENABLE_DASH_SUPPORT if (tp->DASH) { - if (HW_DASH_SUPPORT_CMAC(tp)) { + 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) + if (DashIntType2Status & ISRIMR_DASH_TYPE2_ROK) { tp->RcvFwDashOkEvt = TRUE; - if (DashIntType2Status & ISRIMR_DASH_TYPE2_TOK) + } + if (DashIntType2Status & ISRIMR_DASH_TYPE2_TOK) { tp->SendFwHostOkEvt = TRUE; - if (DashIntType2Status & ISRIMR_DASH_TYPE2_RX_DISABLE_IDLE) + } + if (DashIntType2Status & ISRIMR_DASH_TYPE2_RX_DISABLE_IDLE) { tp->DashFwDisableRx = TRUE; + } RTL_CMAC_W8(tp, CMAC_IBISR0, DashIntType2Status); } @@ -19814,27 +13416,23 @@ static irqreturn_t rtl8125_interrupt_msix(int irq, void *dev_instance) 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 == rtl8125_get_linkchg_message_id(tp)) { - rtl8125_disable_hw_interrupt_v2(tp, message_id); - rtl8125_clear_hw_isr_v2(tp, message_id); + if (message_id == 21) { rtl8125_schedule_linkchg_work(tp); break; } #ifdef CONFIG_R8125_NAPI - if (likely(RTL_NETIF_RX_SCHEDULE_PREP(dev, &r8125napi->napi))) { - rtl8125_disable_hw_interrupt_v2(tp, message_id); + if (likely(RTL_NETIF_RX_SCHEDULE_PREP(dev, &r8125napi->napi))) __RTL_NETIF_RX_SCHEDULE(dev, &r8125napi->napi); - } else if (netif_msg_intr(tp)) + else if (netif_msg_intr(tp)) printk(KERN_INFO "%s: interrupt message id %d in poll_msix\n", dev->name, message_id); - rtl8125_clear_hw_isr_v2(tp, message_id); #else - rtl8125_disable_hw_interrupt_v2(tp, message_id); - - rtl8125_clear_hw_isr_v2(tp, message_id); - rtl8125_tx_interrupt_with_vector(tp, message_id, ~(u32)0); if (message_id < tp->num_rx_rings) { @@ -19861,12 +13459,12 @@ static void rtl8125_down(struct net_device *dev) //rtl8125_delete_link_timer(dev, &tp->link_timer); - netif_carrier_off(dev); - netif_tx_disable(dev); _rtl8125_wait_for_quiescence(dev); + netif_carrier_off(dev); + rtl8125_hw_reset(dev); rtl8125_tx_clear(tp); @@ -19879,12 +13477,10 @@ 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; + 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; + if (tp->rx_ring[i].RxDescArray) return 0; return 1; } @@ -19927,9 +13523,10 @@ static void rtl8125_shutdown(struct pci_dev *pdev) rtnl_lock(); - if (HW_DASH_SUPPORT_DASH(tp)) + 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); @@ -19949,6 +13546,21 @@ static void rtl8125_shutdown(struct pci_dev *pdev) } #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) @@ -19985,10 +13597,10 @@ rtl8125_suspend(struct pci_dev *pdev, pm_message_t state) set_bit(R8125_FLAG_DOWN, tp->task_flags); - netif_carrier_off(dev); - netif_tx_disable(dev); + netif_carrier_off(dev); + netif_device_detach(dev); #ifdef ENABLE_PTP_SUPPORT @@ -20002,7 +13614,7 @@ rtl8125_suspend(struct pci_dev *pdev, pm_message_t state) rtl8125_powerdown_pll(dev, 1); - if (HW_DASH_SUPPORT_DASH(tp)) + if (tp->DASH) rtl8125_driver_stop(tp); rtnl_unlock(); @@ -20082,8 +13694,6 @@ rtl8125_resume(struct device *device) /* restore last modified mac address */ rtl8125_rar_set(tp, dev->dev_addr); - rtl8125_check_hw_phy_mcu_code_ver(dev); - tp->resume_not_chg_speed = 0; if (tp->check_keep_link_speed && //tp->link_ok(dev) && diff --git a/src/r8125_ptp.c b/src/r8125_ptp.c index 02c1ab0..d574780 100644 --- a/src/r8125_ptp.c +++ b/src/r8125_ptp.c @@ -2,10 +2,10 @@ /* ################################################################################ # -# r8125 is the Linux device driver released for Realtek 2.5 Gigabit Ethernet +# r8125 is the Linux device driver released for Realtek 2.5Gigabit Ethernet # controllers with PCI-Express interface. # -# Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved. +# 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 @@ -40,7 +40,6 @@ #include #include #include -#include #include "r8125.h" #include "r8125_ptp.h" @@ -64,7 +63,8 @@ static int _rtl8125_phc_gettime(struct rtl8125_private *tp, struct timespec64 *t /* nanoseconds */ //0x6808[29:0] - ts64->tv_nsec = (RTL_R32(tp, PTP_SOFT_CONFIG_Time_NS_8125) & 0x3fffffff); + ts64->tv_nsec = (RTL_R32(tp, PTP_SOFT_CONFIG_Time_NS_8125) & 0x3fffffff) + + tp->ptp_adjust; /* seconds */ //0x680C[47:0] @@ -92,38 +92,18 @@ static int _rtl8125_phc_settime(struct rtl8125_private *tp, const struct timespe return 0; } +#if 0 static int _rtl8125_phc_adjtime(struct rtl8125_private *tp, s64 delta) { - struct timespec64 d; - bool negative = false; - u64 tohw; + struct timespec64 now, then = ns_to_timespec64(delta); u32 nsec; u64 sec; - if (delta < 0) { - negative = true; - tohw = -delta; - } else { - tohw = delta; - } - - d = ns_to_timespec64(tohw); - - nsec = d.tv_nsec; - sec = d.tv_sec; + _rtl8125_phc_gettime(tp, &now); + now = timespec64_add(now, then); - if (negative) { - nsec = -nsec; - sec = -sec; - } - - nsec &= 0x3fffffff; - sec &= 0x0000ffffffffffff; - - if (negative) { - nsec |= PTP_SOFT_CONFIG_TIME_NS_NEGATIVE; - sec |= PTP_SOFT_CONFIG_TIME_S_NEGATIVE; - } + nsec = now.tv_nsec & 0x3fffffff; + sec = now.tv_sec & 0x0000ffffffffffff; /* nanoseconds */ //0x6808[29:0] @@ -140,22 +120,24 @@ static int _rtl8125_phc_adjtime(struct rtl8125_private *tp, s64 delta) 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); - int ret; + unsigned long flags; + //int ret = 0; //netif_info(tp, drv, tp->dev, "phc adjust time\n"); - rtnl_lock(); - ret = _rtl8125_phc_adjtime(tp, delta); - rtnl_unlock(); + spin_lock_irqsave(&tp->lock, flags); + //ret = _rtl8125_phc_adjtime(tp, delta); + tp->ptp_adjust += delta; + spin_unlock_irqrestore(&tp->lock, flags); - return ret; + return 0; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(6,2,0) /* 1ppm means every 125MHz plus 125Hz. It also means every 8ns minus 8ns*10^(-6) @@ -199,6 +181,21 @@ static int _rtl8125_phc_adjfreq(struct ptp_clock_info *ptp, s32 ppb) return 0; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,2,0) +static int rtl8125_ptp_adjfine(struct ptp_clock_info *ptp, long scaled_ppm) +{ + s32 ppb = scaled_ppm_to_ppb(scaled_ppm); + + if (ppb > ptp->max_adj || ppb < -ptp->max_adj) + return -EINVAL; + + rtnl_lock(); + _rtl8125_phc_adjfreq(ptp, ppb); + rtnl_unlock(); + + return 0; +} +#else 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); @@ -212,18 +209,19 @@ static int rtl8125_phc_adjfreq(struct ptp_clock_info *ptp, s32 delta) return 0; } -#endif //LINUX_VERSION_CODE < KERNEL_VERSION(6,2,0) +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(6,2,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"); - rtnl_lock(); + spin_lock_irqsave(&tp->lock, flags); ret = _rtl8125_phc_gettime(tp, ts64); - rtnl_unlock(); + spin_unlock_irqrestore(&tp->lock, flags); return ret; } @@ -232,13 +230,15 @@ 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"); - rtnl_lock(); + spin_lock_irqsave(&tp->lock, flags); ret = _rtl8125_phc_settime(tp, ts64); - rtnl_unlock(); + tp->ptp_adjust = 0; + spin_unlock_irqrestore(&tp->lock, flags); return ret; } @@ -247,13 +247,14 @@ 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: - rtnl_lock(); + spin_lock_irqsave(&tp->lock, flags); ptp_ctrl = RTL_R16(tp, PTP_CTRL_8125); ptp_ctrl &= ~BIT_15; if (on) @@ -261,7 +262,7 @@ static int rtl8125_phc_enable(struct ptp_clock_info *ptp, else ptp_ctrl &= ~BIT_14; RTL_W16(tp, PTP_CTRL_8125, ptp_ctrl); - rtnl_unlock(); + spin_unlock_irqrestore(&tp->lock, flags); return 0; default: return -EOPNOTSUPP; @@ -311,34 +312,20 @@ static const struct ptp_clock_info rtl_ptp_clock_info = { .n_per_out = 0, .n_pins = 0, .pps = 1, -#if LINUX_VERSION_CODE < KERNEL_VERSION(6,2,0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,2,0) + .adjfine = rtl8125_ptp_adjfine, +#else .adjfreq = rtl8125_phc_adjfreq, -#endif //LINUX_VERSION_CODE < KERNEL_VERSION(6,2,0) +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(6,2,0) */ .adjtime = rtl8125_phc_adjtime, .gettime64 = rtl8125_phc_gettime, .settime64 = rtl8125_phc_settime, .enable = rtl8125_phc_enable, }; -static int rtl8125_ptp_egresstime(struct rtl8125_private *tp, struct timespec64 *ts64, u32 regnum) +static int rtl8125_get_tx_ptp_pkt_tstamp(struct rtl8125_private *tp, struct timespec64 *ts64) { - /* nanoseconds */ - //[29:0] - ts64->tv_nsec = rtl8125_mac_ocp_read(tp, PTP_EGRESS_TIME_BASE_NS_8125 + regnum * 16 + 2); - ts64->tv_nsec <<= 16; - ts64->tv_nsec |= rtl8125_mac_ocp_read(tp, PTP_EGRESS_TIME_BASE_NS_8125 + regnum * 16); - ts64->tv_nsec &= 0x3fffffff; - - /* seconds */ - //[47:0] - ts64->tv_sec = rtl8125_mac_ocp_read(tp, PTP_EGRESS_TIME_BASE_S_8125 + regnum * 16 + 4); - ts64->tv_sec <<= 16; - ts64->tv_sec |= rtl8125_mac_ocp_read(tp, PTP_EGRESS_TIME_BASE_S_8125 + regnum * 16 + 2); - ts64->tv_sec <<= 16; - ts64->tv_sec |= rtl8125_mac_ocp_read(tp, PTP_EGRESS_TIME_BASE_S_8125 + regnum * 16); - ts64->tv_sec &= 0x0000ffffffffffff; - - return 0; + return _rtl8125_phc_gettime(tp, ts64); } static void rtl8125_ptp_tx_hwtstamp(struct rtl8125_private *tp) @@ -346,18 +333,10 @@ 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; - u32 regnum; RTL_W8(tp, PTP_ISR_8125, PTP_ISR_TOK | PTP_ISR_TER); - //IO 0x2302 bit 10~11 WR_PTR - regnum = RTL_R16(tp, 0x2032) & 0x0C00; - regnum >>= 10; - regnum = (regnum + 3) % 4; - - rtnl_lock(); - rtl8125_ptp_egresstime(tp, &ts64, regnum); - rtnl_unlock(); + 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, @@ -369,7 +348,6 @@ static void rtl8125_ptp_tx_hwtstamp(struct rtl8125_private *tp) * while we're notifying the stack. */ tp->ptp_tx_skb = NULL; - clear_bit_unlock(__RTL8125_PTP_TX_IN_PROGRESS, &tp->state); /* Notify the stack and free the skb after we've unlocked */ skb_tstamp_tx(skb, &shhwtstamps); @@ -381,21 +359,23 @@ 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) - return; + 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; - clear_bit_unlock(__RTL8125_PTP_TX_IN_PROGRESS, &tp->state); 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); - return; + goto Exit; } if (RTL_R8(tp, PTP_ISR_8125) & (PTP_ISR_TOK)) @@ -404,6 +384,8 @@ static void rtl8125_ptp_tx_work(struct work_struct *work) /* 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) @@ -418,9 +400,11 @@ static int rtl8125_hwtstamp_enable(struct rtl8125_private *tp, bool enable) //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); - if (tp->ptp_master_mode) + 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 @@ -429,7 +413,9 @@ static int rtl8125_hwtstamp_enable(struct rtl8125_private *tp, bool enable) _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; @@ -483,6 +469,8 @@ void rtl8125_ptp_init(struct rtl8125_private *tp) /* 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); @@ -584,17 +572,24 @@ static int rtl8125_get_tstamp(struct net_device *netdev, struct ifreq *ifr) 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: @@ -613,7 +608,7 @@ void rtl8125_rx_ptp_pktstamp(struct rtl8125_private *tp, struct sk_buff *skb, tv_sec = le32_to_cpu(descv3->RxDescTimeStamp.TimeStampHigh) + ((u64)le32_to_cpu(descv3->RxDescPTPDDWord4.TimeStampHHigh) << 32); - tv_nsec = le32_to_cpu(descv3->RxDescTimeStamp.TimeStampLow); + tv_nsec = le32_to_cpu(descv3->RxDescTimeStamp.TimeStampLow) + tp->ptp_adjust; skb_hwtstamps(skb)->hwtstamp = ktime_set(tv_sec, tv_nsec); } diff --git a/src/r8125_ptp.h b/src/r8125_ptp.h index b24136a..7a1fe83 100644 --- a/src/r8125_ptp.h +++ b/src/r8125_ptp.h @@ -2,10 +2,10 @@ /* ################################################################################ # -# r8125 is the Linux device driver released for Realtek 2.5 Gigabit Ethernet +# r8125 is the Linux device driver released for Realtek 2.5Gigabit Ethernet # controllers with PCI-Express interface. # -# Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved. +# 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 diff --git a/src/r8125_realwow.h b/src/r8125_realwow.h index 603b877..e5e9b46 100644 --- a/src/r8125_realwow.h +++ b/src/r8125_realwow.h @@ -2,10 +2,10 @@ /* ################################################################################ # -# r8125 is the Linux device driver released for Realtek 2.5 Gigabit Ethernet +# r8125 is the Linux device driver released for Realtek 2.5Gigabit Ethernet # controllers with PCI-Express interface. # -# Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved. +# 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 diff --git a/src/r8125_rss.c b/src/r8125_rss.c index df4349b..3d1266b 100644 --- a/src/r8125_rss.c +++ b/src/r8125_rss.c @@ -2,10 +2,10 @@ /* ################################################################################ # -# r8125 is the Linux device driver released for Realtek 2.5 Gigabit Ethernet +# r8168 is the Linux device driver released for Realtek Gigabit Ethernet # controllers with PCI-Express interface. # -# Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved. +# 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 @@ -46,7 +46,6 @@ enum rtl8125_rss_register_content { RSS_HALF_SUPP = (1 << 7), RSS_CTRL_UDP_IPV4_SUPP = (1 << 11), RSS_CTRL_UDP_IPV6_SUPP = (1 << 12), - RSS_CTRL_UDP_IPV6_EXT_SUPP = (1 << 13), RSS_QUAD_CPU_EN = (1 << 16), RSS_HQ_Q_SUP_R = (1 << 31), }; @@ -60,21 +59,21 @@ static int rtl8125_get_rss_hash_opts(struct rtl8125_private *tp, switch (cmd->flow_type) { case TCP_V4_FLOW: cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; - fallthrough; + /* 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; + /* 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; + /* 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; + /* fallthrough */ case IPV6_FLOW: cmd->data |= RXH_IP_SRC | RXH_IP_DST; break; @@ -142,8 +141,7 @@ static int _rtl8125_set_rss_hash_opt(struct rtl8125_private *tp) rss_ctrl |= RSS_CTRL_UDP_IPV4_SUPP; if (rss_flags & RTL_8125_RSS_FLAG_HASH_UDP_IPV6) - rss_ctrl |= RSS_CTRL_UDP_IPV6_SUPP | - RSS_CTRL_UDP_IPV6_EXT_SUPP; + 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); @@ -250,15 +248,13 @@ static int rtl8125_set_rss_hash_opt(struct rtl8125_private *tp, | RSS_CTRL_TCP_IPV6_EXT_SUPP; rss_ctrl &= ~(RSS_CTRL_UDP_IPV4_SUPP | - RSS_CTRL_UDP_IPV6_SUPP | - RSS_CTRL_UDP_IPV6_EXT_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 | - RSS_CTRL_UDP_IPV6_EXT_SUPP; + rss_ctrl |= RSS_CTRL_UDP_IPV6_SUPP; RTL_W32(tp, RSS_CTRL_8125, rss_ctrl); } @@ -324,6 +320,28 @@ static void rtl8125_get_reta(struct rtl8125_private *tp, u32 *indir) 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; @@ -364,88 +382,6 @@ static void rtl8125_store_rss_key(struct rtl8125_private *tp) RTL_W32(tp, rss_key_reg + i, *rss_key++); } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,8,0) -int rtl8125_get_rxfh(struct net_device *dev, struct ethtool_rxfh_param *rxfh) -{ - 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; - - rxfh->hfunc = ETH_RSS_HASH_TOP; - - if (rxfh->indir) - rtl8125_get_reta(tp, rxfh->indir); - - if (rxfh->key) - memcpy(rxfh->key, tp->rss_key, RTL8125_RSS_KEY_SIZE); - - return 0; -} - -int rtl8125_set_rxfh(struct net_device *dev, struct ethtool_rxfh_param *rxfh, - struct netlink_ext_ack *extack) -{ - 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 (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE && rxfh->hfunc != ETH_RSS_HASH_TOP) - return -EOPNOTSUPP; - - /* Fill out the redirection table */ - if (rxfh->indir) { - int max_queues = tp->num_rx_rings; - - /* Verify user input. */ - for (i = 0; i < reta_entries; i++) - if (rxfh->indir[i] >= max_queues) - return -EINVAL; - - for (i = 0; i < reta_entries; i++) - tp->rss_indir_tbl[i] = rxfh->indir[i]; - } - - /* Fill out the rss hash key */ - if (rxfh->key) - memcpy(tp->rss_key, rxfh->key, RTL8125_RSS_KEY_SIZE); - - rtl8125_store_reta(tp); - - rtl8125_store_rss_key(tp); - - return 0; -} -#else -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_RSS_KEY_SIZE); - - return 0; -} - int rtl8125_set_rxfh(struct net_device *dev, const u32 *indir, const u8 *key, const u8 hfunc) { @@ -476,7 +412,7 @@ int rtl8125_set_rxfh(struct net_device *dev, const u32 *indir, /* Fill out the rss hash key */ if (key) - memcpy(tp->rss_key, key, RTL8125_RSS_KEY_SIZE); + memcpy(tp->rss_key, key, rtl8125_get_rxfh_key_size(dev)); rtl8125_store_reta(tp); @@ -484,19 +420,11 @@ int rtl8125_set_rxfh(struct net_device *dev, const u32 *indir, return 0; } -#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(6,8,0) */ static u32 rtl8125_get_rx_desc_hash(struct rtl8125_private *tp, - struct RxDesc *desc) + struct RxDescV3 *descv3) { - switch (tp->InitRxDescType) { - case RX_DESC_RING_TYPE_3: - return le32_to_cpu(((struct RxDescV3 *)desc)->RxDescNormalDDWord2.RSSResult); - case RX_DESC_RING_TYPE_4: - return le32_to_cpu(((struct RxDescV4 *)desc)->RxDescNormalDDWord1.RSSResult); - default: - return 0; - } + return le32_to_cpu(descv3->RxDescNormalDDWord2.RSSResult); } #define RXS_8125B_RSS_UDP BIT(9) @@ -505,16 +433,9 @@ static u32 rtl8125_get_rx_desc_hash(struct rtl8125_private *tp, #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) - -#define RXS_8125B_RSS_UDP_V4 BIT(27) -#define RXS_8125_RSS_IPV4_V4 BIT(28) -#define RXS_8125_RSS_IPV6_V4 BIT(29) -#define RXS_8125_RSS_TCP_V4 BIT(30) -#define RTL8125_RXS_RSS_L3_TYPE_MASK_V4 (RXS_8125_RSS_IPV4_V4 | RXS_8125_RSS_IPV6_V4) -#define RTL8125_RXS_RSS_L4_TYPE_MASK_V4 (RXS_8125_RSS_TCP_V4 | RXS_8125B_RSS_UDP_V4) -static void rtl8125_rx_hash_v3(struct rtl8125_private *tp, - struct RxDescV3 *descv3, - struct sk_buff *skb) +void rtl8125_rx_hash(struct rtl8125_private *tp, + struct RxDescV3 *descv3, + struct sk_buff *skb) { u16 rss_header_info; @@ -526,46 +447,11 @@ static void rtl8125_rx_hash_v3(struct rtl8125_private *tp, if (!(rss_header_info & RTL8125_RXS_RSS_L3_TYPE_MASK)) return; - skb_set_hash(skb, rtl8125_get_rx_desc_hash(tp, (struct RxDesc *)descv3), + 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); } -static void rtl8125_rx_hash_v4(struct rtl8125_private *tp, - struct RxDescV4 *descv4, - struct sk_buff *skb) -{ - u32 rss_header_info; - - if (!(tp->dev->features & NETIF_F_RXHASH)) - return; - - rss_header_info = le32_to_cpu(descv4->RxDescNormalDDWord1.RSSInfo); - - if (!(rss_header_info & RTL8125_RXS_RSS_L3_TYPE_MASK_V4)) - return; - - skb_set_hash(skb, rtl8125_get_rx_desc_hash(tp, (struct RxDesc *)descv4), - (RTL8125_RXS_RSS_L4_TYPE_MASK_V4 & rss_header_info) ? - PKT_HASH_TYPE_L4 : PKT_HASH_TYPE_L3); -} - -void rtl8125_rx_hash(struct rtl8125_private *tp, - struct RxDesc *desc, - struct sk_buff *skb) -{ - switch (tp->InitRxDescType) { - case RX_DESC_RING_TYPE_3: - rtl8125_rx_hash_v3(tp, (struct RxDescV3 *)desc, skb); - break; - case RX_DESC_RING_TYPE_4: - rtl8125_rx_hash_v4(tp, (struct RxDescV4 *)desc, skb); - break; - default: - return; - } -} - void rtl8125_disable_rss(struct rtl8125_private *tp) { RTL_W32(tp, RSS_CTRL_8125, 0x00); diff --git a/src/r8125_rss.h b/src/r8125_rss.h index 5aaaf82..8864139 100644 --- a/src/r8125_rss.h +++ b/src/r8125_rss.h @@ -2,10 +2,10 @@ /* ################################################################################ # -# r8125 is the Linux device driver released for Realtek 2.5 Gigabit Ethernet +# r8125 is the Linux device driver released for Realtek 2.5Gigabit Ethernet # controllers with PCI-Express interface. # -# Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved. +# 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 @@ -47,25 +47,18 @@ enum rtl8125_rss_flag { }; struct rtl8125_private; -struct RxDesc; 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); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,8,0) -int rtl8125_get_rxfh(struct net_device *dev, struct ethtool_rxfh_param *rxfh); -int rtl8125_set_rxfh(struct net_device *dev, struct ethtool_rxfh_param *rxfh, - struct netlink_ext_ack *extack); -#else 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); -#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(6,8,0) */ void rtl8125_rx_hash(struct rtl8125_private *tp, - struct RxDesc *desc, + struct RxDescV3 *descv3, struct sk_buff *skb); void _rtl8125_config_rss(struct rtl8125_private *tp); void rtl8125_config_rss(struct rtl8125_private *tp); diff --git a/src/rtl_eeprom.c b/src/rtl_eeprom.c index 21b6922..03660dd 100644 --- a/src/rtl_eeprom.c +++ b/src/rtl_eeprom.c @@ -2,10 +2,10 @@ /* ################################################################################ # -# r8125 is the Linux device driver released for Realtek 2.5 Gigabit Ethernet +# r8125 is the Linux device driver released for Realtek 2.5Gigabit Ethernet # controllers with PCI-Express interface. # -# Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved. +# 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 @@ -93,7 +93,7 @@ void rtl8125_eeprom_cleanup(struct rtl8125_private *tp) rtl8125_lower_clock(tp, &x); } -static int rtl8125_eeprom_cmd_done(struct rtl8125_private *tp) +int rtl8125_eeprom_cmd_done(struct rtl8125_private *tp) { u8 x; int i; @@ -123,8 +123,9 @@ u16 rtl8125_eeprom_read_sc(struct rtl8125_private *tp, u16 reg) u8 x; u16 data; - if(tp->eeprom_type == EEPROM_TYPE_NONE) + if(tp->eeprom_type == EEPROM_TYPE_NONE) { return -1; + } if (tp->eeprom_type==EEPROM_TYPE_93C46) addr_sz = 6; @@ -156,8 +157,9 @@ void rtl8125_eeprom_write_sc(struct rtl8125_private *tp, u16 reg, u16 data) int addr_sz = 6; int w_dummy_addr = 4; - if(tp->eeprom_type == EEPROM_TYPE_NONE) - return; + if(tp->eeprom_type == EEPROM_TYPE_NONE) { + return ; + } if (tp->eeprom_type==EEPROM_TYPE_93C46) { addr_sz = 6; @@ -176,15 +178,17 @@ void rtl8125_eeprom_write_sc(struct rtl8125_private *tp, u16 reg, u16 data) 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) + 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) + if (rtl8125_eeprom_cmd_done(tp) < 0) { return; + } rtl8125_stand_by(tp); rtl8125_shift_out_bits(tp, RTL_EEPROM_EWDS_OPCODE, 5); @@ -203,6 +207,7 @@ void rtl8125_raise_clock(struct rtl8125_private *tp, u8 *x) void rtl8125_lower_clock(struct rtl8125_private *tp, u8 *x) { + *x = *x & ~Cfg9346_EESK; RTL_W8(tp, Cfg9346, *x); udelay(RTL_CLOCK_RATE); diff --git a/src/rtl_eeprom.h b/src/rtl_eeprom.h index 9751bf7..8faed17 100644 --- a/src/rtl_eeprom.h +++ b/src/rtl_eeprom.h @@ -2,10 +2,10 @@ /* ################################################################################ # -# r8125 is the Linux device driver released for Realtek 2.5 Gigabit Ethernet +# r8125 is the Linux device driver released for Realtek 2.5Gigabit Ethernet # controllers with PCI-Express interface. # -# Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved. +# 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 diff --git a/src/rtltool.c b/src/rtltool.c index f2f2ed3..f40df6f 100644 --- a/src/rtltool.c +++ b/src/rtltool.c @@ -2,10 +2,10 @@ /* ################################################################################ # -# r8125 is the Linux device driver released for Realtek 2.5 Gigabit Ethernet +# r8125 is the Linux device driver released for Realtek 2.5Gigabit Ethernet # controllers with PCI-Express interface. # -# Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved. +# 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 diff --git a/src/rtltool.h b/src/rtltool.h index 6d4ba69..a54f8e6 100644 --- a/src/rtltool.h +++ b/src/rtltool.h @@ -2,10 +2,10 @@ /* ################################################################################ # -# r8125 is the Linux device driver released for Realtek 2.5 Gigabit Ethernet +# r8125 is the Linux device driver released for Realtek 2.5Gigabit Ethernet # controllers with PCI-Express interface. # -# Copyright(c) 2024 Realtek Semiconductor Corp. All rights reserved. +# 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